text: 'use strict';"use strict";(function(e,a){"object"===typeof exports&&"undefined"!==typeof module?a(exports):"function"===typeof define&&define.amd?define(["exports"],a):(e=e||self,a(e.glMatrix={}))})(this,function(e){function a(k,p,v){var z=p[0],D=p[1],G=p[2];p=p[3];var I=v[0],M=v[1],O=v[2];v=v[3];k[0]=z*I+G*M;k[1]=D*I+p*M;k[2]=z*O+G*v;k[3]=D*O+p*v;return k}function b(k,p,v){k[0]=p[0]-v[0];k[1]=p[1]-v[1];k[2]=p[2]-v[2];k[3]=p[3]-v[3];return k}function d(k,p,v){var z=p[0],D=p[1],G=p[2],I=p[3],M=p[4];p=p[5];var O=v[0],Q=v[1],S=v[2],U=v[3],Y=v[4];v=v[5];k[0]=z*O+G*Q;k[1]=D*O+I*Q;k[2]=z*S+G*U;k[3]=D*S+I*U;k[4]=z*Y+G*v+M;k[5]=D*Y+I*v+p;return k}function c(k,p,v){k[0]=p[0]-v[0];k[1]=p[1]-v[1];k[2]=p[2]-v[2];k[3]=p[3]-v[3];k[4]=p[4]-v[4];k[5]=p[5]-v[5];return k}function f(){var k=new ra(9);ra!=Float32Array&&(k[1]=0,k[2]=0,k[3]=0,k[5]=0,k[6]=0,k[7]=0);k[0]=1;k[4]=1;k[8]=1;return k}function h(k,p,v){var z=p[0],D=p[1],G=p[2],I=p[3],M=p[4],O=p[5],Q=p[6],S=p[7];p=p[8];var U=v[0],Y=v[1],X=v[2],ea=v[3],ca=v[4],aa=v[5],wa=v[6],pa=v[7];v=v[8];k[0]=U*z+Y*I+X*Q;k[1]=U*D+Y*M+X*S;k[2]=U*G+Y*O+X*p;k[3]=ea*z+ca*I+aa*Q;k[4]=ea*D+ca*M+aa*S;k[5]=ea*G+ca*O+aa*p;k[6]=wa*z+pa*I+v*Q;k[7]=wa*D+pa*M+v*S;k[8]=wa*G+pa*O+v*p;return k}function g(k,p,v){k[0]=p[0]-v[0];k[1]=p[1]-v[1];k[2]=p[2]-v[2];k[3]=p[3]-v[3];k[4]=p[4]-v[4];k[5]=p[5]-v[5];k[6]=p[6]-v[6];k[7]=p[7]-v[7];k[8]=p[8]-v[8];return k}function l(k){k[0]=1;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=1;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=1;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k}function m(k,p,v){var z=p[0],D=p[1],G=p[2],I=p[3],M=p[4],O=p[5],Q=p[6],S=p[7],U=p[8],Y=p[9],X=p[10],ea=p[11],ca=p[12],aa=p[13],wa=p[14];p=p[15];var pa=v[0],ua=v[1],va=v[2],ta=v[3];k[0]=pa*z+ua*M+va*U+ta*ca;k[1]=pa*D+ua*O+va*Y+ta*aa;k[2]=pa*G+ua*Q+va*X+ta*wa;k[3]=pa*I+ua*S+va*ea+ta*p;pa=v[4];ua=v[5];va=v[6];ta=v[7];k[4]=pa*z+ua*M+va*U+ta*ca;k[5]=pa*D+ua*O+va*Y+ta*aa;k[6]=pa*G+ua*Q+va*X+ta*wa;k[7]=pa*I+ua*S+va*ea+ta*p;pa=v[8];ua=v[9];va=v[10];ta=v[11];k[8]=pa*z+ua*M+va*U+ta*ca;k[9]=pa*D+ua*O+va*Y+ta*aa;k[10]=pa*G+ua*Q+va*X+ta*wa;k[11]=pa*I+ua*S+va*ea+ta*p;pa=v[12];ua=v[13];va=v[14];ta=v[15];k[12]=pa*z+ua*M+va*U+ta*ca;k[13]=pa*D+ua*O+va*Y+ta*aa;k[14]=pa*G+ua*Q+va*X+ta*wa;k[15]=pa*I+ua*S+va*ea+ta*p;return k}function u(k,p,v){var z=p[0],D=p[1],G=p[2],I=p[3],M=z+z,O=D+D,Q=G+G;p=z*M;var S=z*O;z*=Q;var U=D*O;D*=Q;G*=Q;M*=I;O*=I;I*=Q;k[0]=1-(U+G);k[1]=S+I;k[2]=z-O;k[3]=0;k[4]=S-I;k[5]=1-(p+G);k[6]=D+M;k[7]=0;k[8]=z+O;k[9]=D-M;k[10]=1-(p+U);k[11]=0;k[12]=v[0];k[13]=v[1];k[14]=v[2];k[15]=1;return k}function x(k,p){k[0]=p[12];k[1]=p[13];k[2]=p[14];return k}function n(k,p){var v=p[4],z=p[5],D=p[6],G=p[8],I=p[9],M=p[10];k[0]=Math.hypot(p[0],p[1],p[2]);k[1]=Math.hypot(v,z,D);k[2]=Math.hypot(G,I,M);return k}function q(k,p){var v=new ra(3);n(v,p);var z=1/v[0],D=1/v[1],G=1/v[2],I=p[0]*z;v=p[1]*D;var M=p[2]*G,O=p[4]*z,Q=p[5]*D,S=p[6]*G;z*=p[8];D*=p[9];p=p[10]*G;G=I+Q+p;0<G?(I=2*Math.sqrt(G+1),k[3]=.25*I,k[0]=(S-D)/I,k[1]=(z-M)/I,k[2]=(v-O)/I):I>Q&&I>p?(I=2*Math.sqrt(1+I-Q-p),k[3]=(S-D)/I,k[0]=.25*I,k[1]=(v+O)/I,k[2]=(z+M)/I):Q>p?(I=2*Math.sqrt(1+Q-I-p),k[3]=(z-M)/I,k[0]=(v+O)/I,k[1]=.25*I,k[2]=(S+D)/I):(I=2*Math.sqrt(1+p-I-Q),k[3]=(v-O)/I,k[0]=(z+M)/I,k[1]=(S+D)/I,k[2]=.25*I);return k}function t(k,p,v){k[0]=p[0]-v[0];k[1]=p[1]-v[1];k[2]=p[2]-v[2];k[3]=p[3]-v[3];k[4]=p[4]-v[4];k[5]=p[5]-v[5];k[6]=p[6]-v[6];k[7]=p[7]-v[7];k[8]=p[8]-v[8];k[9]=p[9]-v[9];k[10]=p[10]-v[10];k[11]=p[11]-v[11];k[12]=p[12]-v[12];k[13]=p[13]-v[13];k[14]=p[14]-v[14];k[15]=p[15]-v[15];return k}function r(){var k=new ra(3);ra!=Float32Array&&(k[0]=0,k[1]=0,k[2]=0);return k}function w(k){return Math.hypot(k[0],k[1],k[2])}function y(k,p,v){var z=new ra(3);z[0]=k;z[1]=p;z[2]=v;return z}function B(k,p,v){k[0]=p[0]-v[0];k[1]=p[1]-v[1];k[2]=p[2]-v[2];return k}function E(k,p,v){k[0]=p[0]*v[0];k[1]=p[1]*v[1];k[2]=p[2]*v[2];return k}function H(k,p,v){k[0]=p[0]/v[0];k[1]=p[1]/v[1];k[2]=p[2]/v[2];return k}function K(k,p){return Math.hypot(p[0]-k[0],p[1]-k[1],p[2]-k[2])}function C(k,p){var v=p[0]-k[0],z=p[1]-k[1];k=p[2]-k[2];return v*v+z*z+k*k}function A(k){var p=k[0],v=k[1];k=k[2];return p*p+v*v+k*k}function F(k,p){var v=p[0],z=p[1],D=p[2];v=v*v+z*z+D*D;0<v&&(v=1/Math.sqrt(v));k[0]=p[0]*v;k[1]=p[1]*v;k[2]=p[2]*v;return k}function J(k,p){return k[0]*p[0]+k[1]*p[1]+k[2]*p[2]}function L(k,p,v){var z=p[0],D=p[1];p=p[2];var G=v[0],I=v[1];v=v[2];k[0]=D*v-p*I;k[1]=p*G-z*v;k[2]=z*I-D*G;return k}function R(){var k=new ra(4);ra!=Float32Array&&(k[0]=0,k[1]=0,k[2]=0,k[3]=0);return k}function T(k){var p=new ra(4);p[0]=k[0];p[1]=k[1];p[2]=k[2];p[3]=k[3];return p}function V(k,p,v,z){var D=new ra(4);D[0]=k;D[1]=p;D[2]=v;D[3]=z;return D}function ba(k,p){k[0]=p[0];k[1]=p[1];k[2]=p[2];k[3]=p[3];return k}function ia(k,p,v,z,D){k[0]=p;k[1]=v;k[2]=z;k[3]=D;return k}function ja(k,p,v){k[0]=p[0]+v[0];k[1]=p[1]+v[1];k[2]=p[2]+v[2];k[3]=p[3]+v[3];return k}function qa(k,p,v){k[0]=p[0]-v[0];k[1]=p[1]-v[1];k[2]=p[2]-v[2];k[3]=p[3]-v[3];return k}function za(k,p,v){k[0]=p[0]*v[0];k[1]=p[1]*v[1];k[2]=p[2]*v[2];k[3]=p[3]*v[3];return k}function Ca(k,p,v){k[0]=p[0]/v[0];k[1]=p[1]/v[1];k[2]=p[2]/v[2];k[3]=p[3]/v[3];return k}function Ma(k,p,v){k[0]=p[0]*v;k[1]=p[1]*v;k[2]=p[2]*v;k[3]=p[3]*v;return k}function Fa(k,p){return Math.hypot(p[0]-k[0],p[1]-k[1],p[2]-k[2],p[3]-k[3])}function La(k,p){var v=p[0]-k[0],z=p[1]-k[1],D=p[2]-k[2];k=p[3]-k[3];return v*v+z*z+D*D+k*k}function na(k){return Math.hypot(k[0],k[1],k[2],k[3])}function Sa(k){var p=k[0],v=k[1],z=k[2];k=k[3];return p*p+v*v+z*z+k*k}function Aa(k,p){var v=p[0],z=p[1],D=p[2];p=p[3];var G=v*v+z*z+D*D+p*p;0<G&&(G=1/Math.sqrt(G));k[0]=v*G;k[1]=z*G;k[2]=D*G;k[3]=p*G;return k}function Na(k,p){return k[0]*p[0]+k[1]*p[1]+k[2]*p[2]+k[3]*p[3]}function lb(k,p,v,z){var D=p[0],G=p[1],I=p[2];p=p[3];k[0]=D+z*(v[0]-D);k[1]=G+z*(v[1]-G);k[2]=I+z*(v[2]-I);k[3]=p+z*(v[3]-p);return k}function mb(k,p){return k[0]===p[0]&&k[1]===p[1]&&k[2]===p[2]&&k[3]===p[3]}function nb(k,p){var v=k[0],z=k[1],D=k[2];k=k[3];var G=p[0],I=p[1],M=p[2];p=p[3];return Math.abs(v-G)<=1E-6*Math.max(1,Math.abs(v),Math.abs(G))&&Math.abs(z-I)<=1E-6*Math.max(1,Math.abs(z),Math.abs(I))&&Math.abs(D-M)<=1E-6*Math.max(1,Math.abs(D),Math.abs(M))&&Math.abs(k-p)<=1E-6*Math.max(1,Math.abs(k),Math.abs(p))}function ab(){var k=new ra(4);ra!=Float32Array&&(k[0]=0,k[1]=0,k[2]=0);k[3]=1;return k}function ob(k,p,v){v*=.5;var z=Math.sin(v);k[0]=z*p[0];k[1]=z*p[1];k[2]=z*p[2];k[3]=Math.cos(v);return k}function pb(k,p,v){var z=p[0],D=p[1],G=p[2];p=p[3];var I=v[0],M=v[1],O=v[2];v=v[3];k[0]=z*v+p*I+D*O-G*M;k[1]=D*v+p*M+G*I-z*O;k[2]=G*v+p*O+z*M-D*I;k[3]=p*v-z*I-D*M-G*O;return k}function qb(k,p,v){v*=.5;var z=p[0],D=p[1],G=p[2];p=p[3];var I=Math.sin(v);v=Math.cos(v);k[0]=z*v+p*I;k[1]=D*v+G*I;k[2]=G*v-D*I;k[3]=p*v-z*I;return k}function rb(k,p,v){v*=.5;var z=p[0],D=p[1],G=p[2];p=p[3];var I=Math.sin(v);v=Math.cos(v);k[0]=z*v-G*I;k[1]=D*v+p*I;k[2]=G*v+z*I;k[3]=p*v-D*I;return k}function sb(k,p,v){v*=.5;var z=p[0],D=p[1],G=p[2];p=p[3];var I=Math.sin(v);v=Math.cos(v);k[0]=z*v+D*I;k[1]=D*v-z*I;k[2]=G*v+p*I;k[3]=p*v-G*I;return k}function tb(k,p){var v=p[0],z=p[1],D=p[2],G=Math.sqrt(v*v+z*z+D*D);p=Math.exp(p[3]);var I=0<G?p*Math.sin(G)/G:0;k[0]=v*I;k[1]=z*I;k[2]=D*I;k[3]=p*Math.cos(G);return k}function ub(k,p){var v=p[0],z=p[1],D=p[2];p=p[3];var G=Math.sqrt(v*v+z*z+D*D);G=0<G?Math.atan2(G,p)/G:0;k[0]=v*G;k[1]=z*G;k[2]=D*G;k[3]=.5*Math.log(v*v+z*z+D*D+p*p);return k}function bb(k,p,v,z){var D=p[0],G=p[1],I=p[2];p=p[3];var M=v[0],O=v[1],Q=v[2];v=v[3];var S=D*M+G*O+I*Q+p*v;0>S&&(S=-S,M=-M,O=-O,Q=-Q,v=-v);if(1E-6<1-S){var U=Math.acos(S);var Y=Math.sin(U);S=Math.sin((1-z)*U)/Y;z=Math.sin(z*U)/Y}else S=1-z;k[0]=S*D+z*M;k[1]=S*G+z*O;k[2]=S*I+z*Q;k[3]=S*p+z*v;return k}function vb(k,p){var v=p[0]+p[4]+p[8];if(0<v)v=Math.sqrt(v+1),k[3]=.5*v,v=.5/v,k[0]=(p[5]-p[7])*v,k[1]=(p[6]-p[2])*v,k[2]=(p[1]-p[3])*v;else{var z=0;p[4]>p[0]&&(z=1);p[8]>p[3*z+z]&&(z=2);var D=(z+1)%3,G=(z+2)%3;v=Math.sqrt(p[3*z+z]-p[3*D+D]-p[3*G+G]+1);k[z]=.5*v;v=.5/v;k[3]=(p[3*D+G]-p[3*G+D])*v;k[D]=(p[3*D+z]+p[3*z+D])*v;k[G]=(p[3*G+z]+p[3*z+G])*v}return k}function wb(k,p,v){var z=.5*v[0],D=.5*v[1];v=.5*v[2];var G=p[0],I=p[1],M=p[2];p=p[3];k[0]=G;k[1]=I;k[2]=M;k[3]=p;k[4]=z*p+D*M-v*I;k[5]=D*p+v*G-z*M;k[6]=v*p+z*I-D*G;k[7]=-z*G-D*I-v*M;return k}function xb(k,p){k[0]=p[0];k[1]=p[1];k[2]=p[2];k[3]=p[3];k[4]=p[4];k[5]=p[5];k[6]=p[6];k[7]=p[7];return k}function yb(k,p,v){var z=p[0],D=p[1],G=p[2],I=p[3],M=v[4],O=v[5],Q=v[6],S=v[7],U=p[4],Y=p[5],X=p[6];p=p[7];var ea=v[0],ca=v[1],aa=v[2];v=v[3];k[0]=z*v+I*ea+D*aa-G*ca;k[1]=D*v+I*ca+G*ea-z*aa;k[2]=G*v+I*aa+z*ca-D*ea;k[3]=I*v-z*ea-D*ca-G*aa;k[4]=z*S+I*M+D*Q-G*O+U*v+p*ea+Y*aa-X*ca;k[5]=D*S+I*O+G*M-z*Q+Y*v+p*ca+X*ea-U*aa;k[6]=G*S+I*Q+z*O-D*M+X*v+p*aa+U*ca-Y*ea;k[7]=I*S-z*M-D*O-G*Q+p*v-U*ea-Y*ca-X*aa;return k}function cb(){var k=new ra(2);ra!=Float32Array&&(k[0]=0,k[1]=0);return k}function Xa(k,p,v){k[0]=p[0]-v[0];k[1]=p[1]-v[1];return k}function db(k,p,v){k[0]=p[0]*v[0];k[1]=p[1]*v[1];return k}function eb(k,p,v){k[0]=p[0]/v[0];k[1]=p[1]/v[1];return k}function Ya(k,p){return Math.hypot(p[0]-k[0],p[1]-k[1])}function fb(k,p){var v=p[0]-k[0];k=p[1]-k[1];return v*v+k*k}function Ta(k){return Math.hypot(k[0],k[1])}function gb(k){var p=k[0];k=k[1];return p*p+k*k}var ra="undefined"!==typeof Float32Array?Float32Array:Array,Qa=Math.random,zb=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var k=0,p=arguments.length;p--;)k+=arguments[p]*arguments[p];return Math.sqrt(k)});var Ab=Object.freeze({__proto__:null,EPSILON:1E-6,get ARRAY_TYPE(){return ra},RANDOM:Qa,setMatrixArrayType:function(k){ra=k},toRadian:function(k){return k*zb},equals:function(k,p){return Math.abs(k-p)<=1E-6*Math.max(1,Math.abs(k),Math.abs(p))}}),Db=Object.freeze({__proto__:null,create:function(){var k=new ra(4);ra!=Float32Array&&(k[1]=0,k[2]=0);k[0]=1;k[3]=1;return k},clone:function(k){var p=new ra(4);p[0]=k[0];p[1]=k[1];p[2]=k[2];p[3]=k[3];return p},copy:function(k,p){k[0]=p[0];k[1]=p[1];k[2]=p[2];k[3]=p[3];return k},identity:function(k){k[0]=1;k[1]=0;k[2]=0;k[3]=1;return k},fromValues:function(k,p,v,z){var D=new ra(4);D[0]=k;D[1]=p;D[2]=v;D[3]=z;return D},set:function(k,p,v,z,D){k[0]=p;k[1]=v;k[2]=z;k[3]=D;return k},transpose:function(k,p){if(k===p){var v=p[1];k[1]=p[2];k[2]=v}else k[0]=p[0],k[1]=p[2],k[2]=p[1],k[3]=p[3];return k},invert:function(k,p){var v=p[0],z=p[1],D=p[2];p=p[3];var G=v*p-D*z;if(!G)return null;G=1/G;k[0]=p*G;k[1]=-z*G;k[2]=-D*G;k[3]=v*G;return k},adjoint:function(k,p){var v=p[0];k[0]=p[3];k[1]=-p[1];k[2]=-p[2];k[3]=v;return k},determinant:function(k){return k[0]*k[3]-k[2]*k[1]},multiply:a,rotate:function(k,p,v){var z=p[0],D=p[1],G=p[2];p=p[3];var I=Math.sin(v);v=Math.cos(v);k[0]=z*v+G*I;k[1]=D*v+p*I;k[2]=z*-I+
  G*v;k[3]=D*-I+p*v;return k},scale:function(k,p,v){var z=p[1],D=p[2],G=p[3],I=v[0];v=v[1];k[0]=p[0]*I;k[1]=z*I;k[2]=D*v;k[3]=G*v;return k},fromRotation:function(k,p){var v=Math.sin(p);p=Math.cos(p);k[0]=p;k[1]=v;k[2]=-v;k[3]=p;return k},fromScaling:function(k,p){k[0]=p[0];k[1]=0;k[2]=0;k[3]=p[1];return k},str:function(k){return"mat2("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+")"},frob:function(k){return Math.hypot(k[0],k[1],k[2],k[3])},LDU:function(k,p,v,z){k[2]=z[2]/z[0];v[0]=z[0];v[1]=z[1];v[3]=z[3]-k[2]*v[1];return[k,p,v]},add:function(k,p,v){k[0]=p[0]+v[0];k[1]=p[1]+v[1];k[2]=p[2]+v[2];k[3]=p[3]+v[3];return k},subtract:b,exactEquals:function(k,p){return k[0]===p[0]&&k[1]===p[1]&&k[2]===p[2]&&k[3]===p[3]},equals:function(k,p){var v=k[0],z=k[1],D=k[2];k=k[3];var G=p[0],I=p[1],M=p[2];p=p[3];return Math.abs(v-G)<=1E-6*Math.max(1,Math.abs(v),Math.abs(G))&&Math.abs(z-I)<=1E-6*Math.max(1,Math.abs(z),Math.abs(I))&&Math.abs(D-M)<=1E-6*Math.max(1,Math.abs(D),Math.abs(M))&&Math.abs(k-p)<=1E-6*Math.max(1,Math.abs(k),Math.abs(p))},multiplyScalar:function(k,p,v){k[0]=p[0]*v;k[1]=p[1]*v;k[2]=p[2]*v;k[3]=p[3]*v;return k},multiplyScalarAndAdd:function(k,p,v,z){k[0]=p[0]+v[0]*z;k[1]=p[1]+v[1]*z;k[2]=p[2]+v[2]*z;k[3]=p[3]+v[3]*z;return k},mul:a,sub:b}),Eb=Object.freeze({__proto__:null,create:function(){var k=new ra(6);ra!=Float32Array&&(k[1]=0,k[2]=0,k[4]=0,k[5]=0);k[0]=1;k[3]=1;return k},clone:function(k){var p=new ra(6);p[0]=k[0];p[1]=k[1];p[2]=k[2];p[3]=k[3];p[4]=k[4];p[5]=k[5];return p},copy:function(k,p){k[0]=p[0];k[1]=p[1];k[2]=p[2];k[3]=p[3];k[4]=p[4];k[5]=p[5];return k},identity:function(k){k[0]=1;k[1]=0;k[2]=0;k[3]=1;k[4]=0;k[5]=0;return k},fromValues:function(k,p,v,z,D,G){var I=new ra(6);I[0]=k;I[1]=p;I[2]=v;I[3]=z;I[4]=D;I[5]=G;return I},set:function(k,p,v,z,D,G,I){k[0]=p;k[1]=v;k[2]=z;k[3]=D;k[4]=G;k[5]=I;return k},invert:function(k,p){var v=p[0],z=p[1],D=p[2],G=p[3],I=p[4];p=p[5];var M=v*G-z*D;if(!M)return null;M=1/M;k[0]=G*M;k[1]=-z*M;k[2]=-D*M;k[3]=v*M;k[4]=(D*p-G*I)*M;k[5]=(z*I-v*p)*M;return k},determinant:function(k){return k[0]*k[3]-k[1]*k[2]},multiply:d,rotate:function(k,p,v){var z=p[0],D=p[1],G=p[2],I=p[3],M=p[4];p=p[5];var O=Math.sin(v);v=Math.cos(v);k[0]=z*v+G*O;k[1]=D*v+I*O;k[2]=z*-O+G*v;k[3]=D*-O+I*v;k[4]=M;k[5]=p;return k},scale:function(k,p,v){var z=p[1],D=p[2],G=p[3],I=p[4],M=p[5],O=v[0];v=v[1];k[0]=p[0]*O;k[1]=z*O;k[2]=D*v;k[3]=G*v;k[4]=I;k[5]=M;return k},translate:function(k,p,v){var z=p[0],D=p[1],G=p[2],I=p[3],M=p[4];p=p[5];var O=v[0];v=v[1];k[0]=z;k[1]=D;k[2]=G;k[3]=I;k[4]=z*O+G*v+M;k[5]=D*O+I*v+p;return k},fromRotation:function(k,p){var v=Math.sin(p);p=Math.cos(p);k[0]=p;k[1]=v;k[2]=-v;k[3]=p;k[4]=0;k[5]=0;return k},fromScaling:function(k,p){k[0]=p[0];k[1]=0;k[2]=0;k[3]=p[1];k[4]=0;k[5]=0;return k},fromTranslation:function(k,p){k[0]=1;k[1]=0;k[2]=0;k[3]=1;k[4]=p[0];k[5]=p[1];return k},str:function(k){return"mat2d("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+", "+k[4]+", "+k[5]+")"},frob:function(k){return Math.hypot(k[0],k[1],k[2],k[3],k[4],k[5],1)},add:function(k,p,v){k[0]=p[0]+v[0];k[1]=p[1]+v[1];k[2]=p[2]+v[2];k[3]=p[3]+v[3];k[4]=p[4]+v[4];k[5]=p[5]+v[5];return k},subtract:c,multiplyScalar:function(k,p,v){k[0]=p[0]*v;k[1]=p[1]*v;k[2]=p[2]*v;k[3]=p[3]*v;k[4]=p[4]*v;k[5]=p[5]*v;return k},multiplyScalarAndAdd:function(k,p,v,z){k[0]=p[0]+v[0]*z;k[1]=p[1]+v[1]*z;k[2]=p[2]+v[2]*z;k[3]=p[3]+v[3]*z;k[4]=p[4]+v[4]*z;k[5]=p[5]+v[5]*z;return k},exactEquals:function(k,p){return k[0]===p[0]&&k[1]===p[1]&&k[2]===p[2]&&k[3]===p[3]&&k[4]===p[4]&&k[5]===p[5]},equals:function(k,p){var v=k[0],z=k[1],D=k[2],G=k[3],I=k[4];k=k[5];var M=p[0],O=p[1],Q=p[2],S=p[3],U=p[4];p=p[5];return Math.abs(v-M)<=1E-6*Math.max(1,Math.abs(v),Math.abs(M))&&Math.abs(z-O)<=1E-6*Math.max(1,Math.abs(z),Math.abs(O))&&Math.abs(D-Q)<=1E-6*Math.max(1,Math.abs(D),Math.abs(Q))&&Math.abs(G-S)<=1E-6*Math.max(1,Math.abs(G),Math.abs(S))&&Math.abs(I-U)<=1E-6*Math.max(1,Math.abs(I),Math.abs(U))&&Math.abs(k-p)<=1E-6*Math.max(1,Math.abs(k),Math.abs(p))},mul:d,sub:c}),Fb=Object.freeze({__proto__:null,create:f,fromMat4:function(k,p){k[0]=p[0];k[1]=p[1];k[2]=p[2];k[3]=p[4];k[4]=p[5];k[5]=p[6];k[6]=p[8];k[7]=p[9];k[8]=p[10];return k},clone:function(k){var p=new ra(9);p[0]=k[0];p[1]=k[1];p[2]=k[2];p[3]=k[3];p[4]=k[4];p[5]=k[5];p[6]=k[6];p[7]=k[7];p[8]=k[8];return p},copy:function(k,p){k[0]=p[0];k[1]=p[1];k[2]=p[2];k[3]=p[3];k[4]=p[4];k[5]=p[5];k[6]=p[6];k[7]=p[7];k[8]=p[8];return k},fromValues:function(k,p,v,z,D,G,I,M,O){var Q=new ra(9);Q[0]=k;Q[1]=p;Q[2]=v;Q[3]=z;Q[4]=D;Q[5]=G;Q[6]=I;Q[7]=M;Q[8]=O;return Q},set:function(k,p,v,z,D,G,I,M,O,Q){k[0]=p;k[1]=v;k[2]=z;k[3]=D;k[4]=G;k[5]=I;k[6]=M;k[7]=O;k[8]=Q;return k},identity:function(k){k[0]=1;k[1]=0;k[2]=0;k[3]=0;k[4]=1;k[5]=0;k[6]=0;k[7]=0;k[8]=1;return k},transpose:function(k,p){if(k===p){var v=p[1],z=p[2],D=p[5];k[1]=p[3];k[2]=p[6];k[3]=v;k[5]=p[7];k[6]=z;k[7]=D}else k[0]=p[0],k[1]=p[3],k[2]=p[6],k[3]=p[1],k[4]=p[4],k[5]=p[7],k[6]=p[2],k[7]=p[5],k[8]=p[8];return k},invert:function(k,p){var v=p[0],z=p[1],D=p[2],G=p[3],I=p[4],M=p[5],O=p[6],Q=p[7];p=p[8];var S=p*I-M*Q,U=-p*G+M*O,Y=Q*G-I*O,X=v*S+z*U+D*Y;if(!X)return null;X=1/X;k[0]=S*X;k[1]=(-p*z+D*Q)*X;k[2]=(M*z-D*I)*X;k[3]=U*X;k[4]=(p*v-D*O)*X;k[5]=(-M*v+D*G)*X;k[6]=Y*X;k[7]=(-Q*v+z*O)*X;k[8]=(I*v-z*G)*X;return k},adjoint:function(k,p){var v=p[0],z=p[1],D=p[2],G=p[3],I=p[4],M=p[5],O=p[6],Q=p[7];p=p[8];k[0]=I*p-M*Q;k[1]=D*Q-z*p;k[2]=z*M-D*I;k[3]=M*O-G*p;k[4]=v*p-D*O;k[5]=D*G-v*M;k[6]=G*Q-I*O;k[7]=z*O-v*Q;k[8]=v*I-z*G;return k},determinant:function(k){var p=k[3],v=k[4],z=k[5],D=k[6],G=k[7],I=k[8];return k[0]*(I*v-z*G)+k[1]*(-I*p+z*D)+k[2]*(G*p-v*D)},multiply:h,translate:function(k,p,v){var z=p[0],D=p[1],G=p[2],I=p[3],M=p[4],O=p[5],Q=p[6],S=p[7];p=p[8];var U=v[0];v=v[1];k[0]=z;k[1]=D;k[2]=G;k[3]=I;k[4]=M;k[5]=O;k[6]=U*z+v*I+Q;k[7]=U*D+v*M+S;k[8]=U*G+v*O+p;return k},rotate:function(k,p,v){var z=p[0],D=p[1],G=p[2],I=p[3],M=p[4],O=p[5],Q=p[6],S=p[7];p=p[8];var U=Math.sin(v);v=Math.cos(v);k[0]=v*z+U*I;k[1]=v*D+U*M;k[2]=v*G+U*O;k[3]=v*I-U*z;k[4]=v*M-U*D;k[5]=v*O-U*G;k[6]=Q;k[7]=S;k[8]=p;return k},scale:function(k,p,v){var z=v[0];v=v[1];k[0]=z*p[0];k[1]=z*p[1];k[2]=z*p[2];k[3]=v*p[3];k[4]=v*p[4];k[5]=v*p[5];k[6]=p[6];k[7]=p[7];k[8]=p[8];return k},fromTranslation:function(k,p){k[0]=1;k[1]=0;k[2]=0;k[3]=0;k[4]=1;k[5]=0;k[6]=p[0];k[7]=p[1];k[8]=1;return k},fromRotation:function(k,p){var v=Math.sin(p);p=Math.cos(p);k[0]=p;k[1]=v;k[2]=0;k[3]=-v;k[4]=p;k[5]=0;k[6]=0;k[7]=0;k[8]=1;return k},fromScaling:function(k,p){k[0]=p[0];k[1]=0;k[2]=0;k[3]=0;k[4]=p[1];k[5]=0;k[6]=0;k[7]=0;k[8]=1;return k},fromMat2d:function(k,p){k[0]=p[0];k[1]=p[1];k[2]=0;k[3]=p[2];k[4]=p[3];k[5]=0;k[6]=p[4];k[7]=p[5];k[8]=1;return k},fromQuat:function(k,p){var v=p[0],z=p[1],D=p[2];p=p[3];var G=v+v,I=z+z,M=D+D;v*=G;var O=z*G;z*=I;var Q=D*G,S=D*I;D*=M;G*=p;I*=p;p*=M;k[0]=1-z-D;k[3]=O-p;k[6]=Q+I;k[1]=O+p;k[4]=1-v-D;k[7]=S-G;k[2]=Q-I;k[5]=S+G;k[8]=1-v-z;return k},normalFromMat4:function(k,p){var v=p[0],z=p[1],D=p[2],G=p[3],I=p[4],M=p[5],O=p[6],Q=p[7],S=p[8],U=p[9],Y=p[10],X=p[11],ea=p[12],ca=p[13],aa=p[14];p=p[15];var wa=v*M-z*I,pa=v*O-D*I,ua=v*Q-G*I,va=z*O-D*M,ta=z*Q-G*M,Ga=D*Q-G*O,Ha=S*ca-U*ea,Ia=S*aa-Y*ea;S=S*p-X*ea;var Ja=U*aa-Y*ca;U=U*p-X*ca;Y=Y*p-X*aa;X=wa*Y-pa*U+ua*Ja+va*S-ta*Ia+Ga*Ha;if(!X)return null;X=1/X;k[0]=(M*Y-O*U+Q*Ja)*X;k[1]=(O*S-I*Y-Q*Ia)*X;k[2]=(I*U-M*S+Q*Ha)*X;k[3]=(D*U-z*Y-G*Ja)*X;k[4]=(v*Y-D*S+G*Ia)*X;k[5]=(z*S-v*U-G*Ha)*X;k[6]=(ca*Ga-aa*ta+p*va)*X;k[7]=(aa*ua-ea*Ga-p*pa)*X;k[8]=(ea*ta-ca*ua+p*wa)*X;return k},projection:function(k,p,v){k[0]=2/p;k[1]=0;k[2]=0;k[3]=0;k[4]=-2/v;k[5]=0;k[6]=-1;k[7]=1;k[8]=1;return k},str:function(k){return"mat3("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+", "+k[4]+", "+k[5]+", "+k[6]+", "+k[7]+", "+k[8]+")"},frob:function(k){return Math.hypot(k[0],k[1],k[2],k[3],k[4],k[5],k[6],k[7],k[8])},add:function(k,p,v){k[0]=p[0]+v[0];k[1]=p[1]+v[1];k[2]=p[2]+v[2];k[3]=p[3]+v[3];k[4]=p[4]+v[4];k[5]=p[5]+v[5];k[6]=p[6]+v[6];k[7]=p[7]+v[7];k[8]=p[8]+v[8];return k},subtract:g,multiplyScalar:function(k,p,v){k[0]=p[0]*v;k[1]=p[1]*v;k[2]=p[2]*v;k[3]=p[3]*v;k[4]=p[4]*v;k[5]=p[5]*v;k[6]=p[6]*v;k[7]=p[7]*v;k[8]=p[8]*v;return k},multiplyScalarAndAdd:function(k,p,v,z){k[0]=p[0]+v[0]*z;k[1]=p[1]+v[1]*z;k[2]=p[2]+v[2]*z;k[3]=p[3]+v[3]*z;k[4]=p[4]+v[4]*z;k[5]=p[5]+v[5]*z;k[6]=p[6]+v[6]*z;k[7]=p[7]+v[7]*z;k[8]=p[8]+v[8]*z;return k},exactEquals:function(k,p){return k[0]===p[0]&&k[1]===p[1]&&k[2]===p[2]&&k[3]===p[3]&&k[4]===p[4]&&k[5]===p[5]&&k[6]===p[6]&&k[7]===p[7]&&k[8]===p[8]},equals:function(k,p){var v=k[0],z=k[1],D=k[2],G=k[3],I=k[4],M=k[5],O=k[6],Q=k[7];k=k[8];var S=p[0],U=p[1],Y=p[2],X=p[3],ea=p[4],ca=p[5],aa=p[6],wa=p[7];p=p[8];return Math.abs(v-S)<=1E-6*Math.max(1,Math.abs(v),Math.abs(S))&&Math.abs(z-U)<=1E-6*Math.max(1,Math.abs(z),Math.abs(U))&&Math.abs(D-Y)<=1E-6*Math.max(1,Math.abs(D),Math.abs(Y))&&Math.abs(G-X)<=1E-6*Math.max(1,Math.abs(G),Math.abs(X))&&Math.abs(I-ea)<=1E-6*Math.max(1,Math.abs(I),Math.abs(ea))&&Math.abs(M-ca)<=1E-6*Math.max(1,Math.abs(M),Math.abs(ca))&&Math.abs(O-aa)<=1E-6*Math.max(1,Math.abs(O),Math.abs(aa))&&Math.abs(Q-wa)<=1E-6*Math.max(1,Math.abs(Q),Math.abs(wa))&&Math.abs(k-p)<=1E-6*Math.max(1,Math.abs(k),Math.abs(p))},mul:h,sub:g}),Gb=Object.freeze({__proto__:null,create:function(){var k=new ra(16);ra!=Float32Array&&(k[1]=0,k[2]=0,k[3]=0,k[4]=0,k[6]=0,k[7]=0,k[8]=0,k[9]=0,k[11]=0,k[12]=0,k[13]=0,k[14]=0);k[0]=1;k[5]=1;k[10]=1;k[15]=1;return k},clone:function(k){var p=new ra(16);p[0]=k[0];p[1]=k[1];p[2]=k[2];p[3]=k[3];p[4]=k[4];p[5]=k[5];p[6]=k[6];p[7]=k[7];p[8]=k[8];p[9]=k[9];p[10]=k[10];p[11]=k[11];p[12]=k[12];p[13]=k[13];p[14]=k[14];p[15]=k[15];return p},copy:function(k,p){k[0]=p[0];k[1]=p[1];k[2]=p[2];k[3]=p[3];k[4]=p[4];k[5]=p[5];k[6]=p[6];k[7]=p[7];k[8]=p[8];k[9]=p[9];k[10]=p[10];k[11]=p[11];k[12]=p[12];k[13]=p[13];k[14]=p[14];k[15]=p[15];return k},fromValues:function(k,p,v,z,D,G,I,M,O,Q,S,U,Y,X,ea,ca){var aa=new ra(16);aa[0]=k;aa[1]=p;aa[2]=v;aa[3]=z;aa[4]=D;aa[5]=G;aa[6]=I;aa[7]=M;aa[8]=O;aa[9]=Q;aa[10]=S;aa[11]=U;aa[12]=Y;aa[13]=X;aa[14]=ea;aa[15]=ca;return aa},set:function(k,p,v,z,D,G,I,M,O,Q,S,U,Y,X,ea,ca,aa){k[0]=p;k[1]=v;k[2]=z;k[3]=D;k[4]=G;k[5]=I;k[6]=M;k[7]=O;k[8]=Q;k[9]=S;k[10]=U;k[11]=Y;k[12]=X;k[13]=ea;k[14]=ca;k[15]=aa;return k},identity:l,transpose:function(k,p){if(k===p){var v=p[1],z=p[2],D=p[3],G=p[6],I=p[7],M=p[11];k[1]=p[4];k[2]=p[8];k[3]=p[12];k[4]=v;k[6]=p[9];k[7]=p[13];k[8]=z;k[9]=G;k[11]=p[14];k[12]=D;k[13]=I;k[14]=M}else k[0]=p[0],k[1]=p[4],k[2]=p[8],k[3]=p[12],k[4]=p[1],k[5]=p[5],k[6]=p[9],k[7]=p[13],k[8]=p[2],k[9]=p[6],k[10]=p[10],k[11]=p[14],k[12]=p[3],k[13]=p[7],k[14]=p[11],k[15]=p[15];return k},invert:function(k,p){var v=p[0],z=p[1],D=p[2],G=p[3],I=p[4],M=p[5],O=p[6],Q=p[7],S=p[8],U=p[9],Y=p[10],X=p[11],ea=p[12],ca=p[13],aa=p[14];p=p[15];var wa=v*M-z*I,pa=v*O-D*I,ua=v*Q-G*I,va=z*O-D*M,ta=z*Q-G*M,Ga=D*Q-G*O,Ha=S*ca-U*ea,Ia=S*aa-Y*ea,Ja=S*p-X*ea,Oa=U*aa-Y*ca,Va=U*p-X*ca,Wa=Y*p-X*aa,Ba=wa*Wa-pa*Va+ua*Oa+va*Ja-ta*Ia+Ga*Ha;if(!Ba)return null;Ba=1/Ba;k[0]=(M*Wa-O*Va+Q*Oa)*Ba;k[1]=(D*Va-z*Wa-G*Oa)*Ba;k[2]=(ca*Ga-aa*ta+p*va)*Ba;k[3]=(Y*ta-U*Ga-X*va)*Ba;k[4]=(O*Ja-I*Wa-Q*Ia)*Ba;k[5]=(v*Wa-D*Ja+G*Ia)*Ba;k[6]=(aa*ua-
  ea*Ga-p*pa)*Ba;k[7]=(S*Ga-Y*ua+X*pa)*Ba;k[8]=(I*Va-M*Ja+Q*Ha)*Ba;k[9]=(z*Ja-v*Va-G*Ha)*Ba;k[10]=(ea*ta-ca*ua+p*wa)*Ba;k[11]=(U*ua-S*ta-X*wa)*Ba;k[12]=(M*Ia-I*Oa-O*Ha)*Ba;k[13]=(v*Oa-z*Ia+D*Ha)*Ba;k[14]=(ca*pa-ea*va-aa*wa)*Ba;k[15]=(S*va-U*pa+Y*wa)*Ba;return k},adjoint:function(k,p){var v=p[0],z=p[1],D=p[2],G=p[3],I=p[4],M=p[5],O=p[6],Q=p[7],S=p[8],U=p[9],Y=p[10],X=p[11],ea=p[12],ca=p[13],aa=p[14];p=p[15];k[0]=M*(Y*p-X*aa)-U*(O*p-Q*aa)+ca*(O*X-Q*Y);k[1]=-(z*(Y*p-X*aa)-U*(D*p-G*aa)+ca*(D*X-G*Y));k[2]=z*(O*p-Q*aa)-M*(D*p-G*aa)+ca*(D*Q-G*O);k[3]=-(z*(O*X-Q*Y)-M*(D*X-G*Y)+U*(D*Q-G*O));k[4]=-(I*(Y*p-X*aa)-S*(O*p-Q*aa)+ea*(O*X-Q*Y));k[5]=v*(Y*p-X*aa)-S*(D*p-G*aa)+ea*(D*X-G*Y);k[6]=-(v*(O*p-Q*aa)-I*(D*p-G*aa)+ea*(D*Q-G*O));k[7]=v*(O*X-Q*Y)-I*(D*X-G*Y)+S*(D*Q-G*O);k[8]=I*(U*p-X*ca)-S*(M*p-Q*ca)+ea*(M*X-Q*U);k[9]=-(v*(U*p-X*ca)-S*(z*p-G*ca)+ea*(z*X-G*U));k[10]=v*(M*p-Q*ca)-I*(z*p-G*ca)+ea*(z*Q-G*M);k[11]=-(v*(M*X-Q*U)-I*(z*X-G*U)+S*(z*Q-G*M));k[12]=-(I*(U*aa-Y*ca)-S*(M*aa-O*ca)+ea*(M*Y-O*U));k[13]=v*(U*aa-Y*ca)-S*(z*aa-D*ca)+ea*(z*Y-D*U);k[14]=-(v*(M*aa-O*ca)-I*(z*aa-D*ca)+ea*(z*O-D*M));k[15]=v*(M*Y-O*U)-I*(z*Y-D*U)+S*(z*O-D*M);return k},determinant:function(k){var p=k[0],v=k[1],z=k[2],D=k[3],G=k[4],I=k[5],M=k[6],O=k[7],Q=k[8],S=k[9],U=k[10],Y=k[11],X=k[12],ea=k[13],ca=k[14];k=k[15];return(p*I-v*G)*(U*k-Y*ca)-(p*M-z*G)*(S*k-Y*ea)+(p*O-D*G)*(S*ca-U*ea)+(v*M-z*I)*(Q*k-Y*X)-(v*O-D*I)*(Q*ca-U*X)+(z*O-D*M)*(Q*ea-S*X)},multiply:m,translate:function(k,p,v){var z=v[0],D=v[1];v=v[2];if(p===k)k[12]=p[0]*z+p[4]*D+p[8]*v+p[12],k[13]=p[1]*z+p[5]*D+p[9]*v+p[13],k[14]=p[2]*z+p[6]*D+p[10]*v+p[14],k[15]=p[3]*z+p[7]*D+p[11]*v+p[15];else{var G=p[0];var I=p[1];var M=p[2];var O=p[3];var Q=p[4];var S=p[5];var U=p[6];var Y=p[7];var X=p[8];var ea=p[9];var ca=p[10];var aa=p[11];k[0]=G;k[1]=I;k[2]=M;k[3]=O;k[4]=Q;k[5]=S;k[6]=U;k[7]=Y;k[8]=X;k[9]=ea;k[10]=ca;k[11]=aa;k[12]=G*z+Q*D+X*v+p[12];k[13]=I*z+S*D+ea*v+p[13];k[14]=M*z+U*D+ca*v+p[14];k[15]=O*z+Y*D+aa*v+p[15]}return k},scale:function(k,p,v){var z=v[0],D=v[1];v=v[2];k[0]=p[0]*z;k[1]=p[1]*z;k[2]=p[2]*z;k[3]=p[3]*z;k[4]=p[4]*D;k[5]=p[5]*D;k[6]=p[6]*D;k[7]=p[7]*D;k[8]=p[8]*v;k[9]=p[9]*v;k[10]=p[10]*v;k[11]=p[11]*v;k[12]=p[12];k[13]=p[13];k[14]=p[14];k[15]=p[15];return k},rotate:function(k,p,v,z){var D=z[0],G=z[1];z=z[2];var I=Math.hypot(D,G,z);if(1E-6>I)return null;I=1/I;D*=I;G*=I;z*=I;var M=Math.sin(v);var O=Math.cos(v);var Q=1-O;v=p[0];I=p[1];var S=p[2];var U=p[3];var Y=p[4];var X=p[5];var ea=p[6];var ca=p[7];var aa=p[8];var wa=p[9];var pa=p[10];var ua=p[11];var va=D*D*Q+O;var ta=G*D*Q+z*M;var Ga=z*D*Q-G*M;var Ha=D*G*Q-z*M;var Ia=G*G*Q+O;var Ja=z*G*Q+D*M;var Oa=D*z*Q+G*M;D=G*z*Q-D*M;G=z*z*Q+O;k[0]=v*va+Y*ta+aa*Ga;k[1]=I*va+X*ta+wa*Ga;k[2]=S*va+ea*ta+pa*Ga;k[3]=U*va+ca*ta+ua*Ga;k[4]=v*Ha+Y*Ia+aa*Ja;k[5]=I*Ha+X*Ia+wa*Ja;k[6]=S*Ha+ea*Ia+pa*Ja;k[7]=U*Ha+ca*Ia+ua*Ja;k[8]=v*Oa+Y*D+aa*G;k[9]=I*Oa+X*D+wa*G;k[10]=S*Oa+ea*D+pa*G;k[11]=U*Oa+ca*D+ua*G;p!==k&&(k[12]=p[12],k[13]=p[13],k[14]=p[14],k[15]=p[15]);return k},rotateX:function(k,p,v){var z=Math.sin(v);v=Math.cos(v);var D=p[4],G=p[5],I=p[6],M=p[7],O=p[8],Q=p[9],S=p[10],U=p[11];p!==k&&(k[0]=p[0],k[1]=p[1],k[2]=p[2],k[3]=p[3],k[12]=p[12],k[13]=p[13],k[14]=p[14],k[15]=p[15]);k[4]=D*v+O*z;k[5]=G*v+Q*z;k[6]=I*v+S*z;k[7]=M*v+U*z;k[8]=O*v-D*z;k[9]=Q*v-G*z;k[10]=S*v-I*z;k[11]=U*v-M*z;return k},rotateY:function(k,p,v){var z=Math.sin(v);v=Math.cos(v);var D=p[0],G=p[1],I=p[2],M=p[3],O=p[8],Q=p[9],S=p[10],U=p[11];p!==k&&(k[4]=p[4],k[5]=p[5],k[6]=p[6],k[7]=p[7],k[12]=p[12],k[13]=p[13],k[14]=p[14],k[15]=p[15]);k[0]=D*v-O*z;k[1]=G*v-Q*z;k[2]=I*v-S*z;k[3]=M*v-U*z;k[8]=D*z+O*v;k[9]=G*z+Q*v;k[10]=I*z+S*v;k[11]=M*z+U*v;return k},rotateZ:function(k,p,v){var z=Math.sin(v);v=Math.cos(v);var D=p[0],G=p[1],I=p[2],M=p[3],O=p[4],Q=p[5],S=p[6],U=p[7];p!==k&&(k[8]=p[8],k[9]=p[9],k[10]=p[10],k[11]=p[11],k[12]=p[12],k[13]=p[13],k[14]=p[14],k[15]=p[15]);k[0]=D*v+O*z;k[1]=G*v+Q*z;k[2]=I*v+S*z;k[3]=M*v+U*z;k[4]=O*v-D*z;k[5]=Q*v-G*z;k[6]=S*v-I*z;k[7]=U*v-M*z;return k},fromTranslation:function(k,p){k[0]=1;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=1;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=1;k[11]=0;k[12]=p[0];k[13]=p[1];k[14]=p[2];k[15]=1;return k},fromScaling:function(k,p){k[0]=p[0];k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=p[1];k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=p[2];k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromRotation:function(k,p,v){var z=v[0],D=v[1];v=v[2];var G=Math.hypot(z,D,v);if(1E-6>G)return null;G=1/G;z*=G;D*=G;v*=G;G=Math.sin(p);p=Math.cos(p);var I=1-p;k[0]=z*z*I+p;k[1]=D*z*I+v*G;k[2]=v*z*I-D*G;k[3]=0;k[4]=z*D*I-v*G;k[5]=D*D*I+p;k[6]=v*D*I+z*G;k[7]=0;k[8]=z*v*I+D*G;k[9]=D*v*I-z*G;k[10]=v*v*I+p;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromXRotation:function(k,p){var v=Math.sin(p);p=Math.cos(p);k[0]=1;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=p;k[6]=v;k[7]=0;k[8]=0;k[9]=-v;k[10]=p;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromYRotation:function(k,p){var v=Math.sin(p);p=Math.cos(p);k[0]=p;k[1]=0;k[2]=-v;k[3]=0;k[4]=0;k[5]=1;k[6]=0;k[7]=0;k[8]=v;k[9]=0;k[10]=p;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromZRotation:function(k,p){var v=Math.sin(p);p=Math.cos(p);k[0]=p;k[1]=v;k[2]=0;k[3]=0;k[4]=-v;k[5]=p;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=1;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromRotationTranslation:u,fromQuat2:function(k,p){var v=new ra(3),z=-p[0],D=-p[1],G=-p[2],I=p[3],M=p[4],O=p[5],Q=p[6],S=p[7],U=z*z+D*D+G*G+I*I;0<U?(v[0]=2*(M*I+S*z+O*G-Q*D)/U,v[1]=2*(O*I+S*D+Q*z-M*G)/U,v[2]=2*(Q*I+S*G+M*D-O*z)/U):(v[0]=2*(M*I+S*z+O*G-Q*D),v[1]=2*(O*I+S*D+Q*z-M*G),v[2]=2*(Q*I+S*G+M*D-O*z));u(k,p,v);return k},getTranslation:x,getScaling:n,getRotation:q,fromRotationTranslationScale:function(k,p,v,z){var D=p[0],G=p[1],I=p[2],M=p[3],O=D+D,Q=G+G,S=I+I;p=D*O;var U=D*Q;D*=S;var Y=G*Q;G*=S;I*=S;O*=M;Q*=M;M*=S;S=z[0];var X=z[1];z=z[2];k[0]=(1-(Y+I))*S;k[1]=(U+M)*S;k[2]=(D-Q)*S;k[3]=0;k[4]=(U-M)*X;k[5]=(1-(p+I))*X;k[6]=(G+O)*X;k[7]=0;k[8]=(D+Q)*z;k[9]=(G-O)*z;k[10]=(1-(p+Y))*z;k[11]=0;k[12]=v[0];k[13]=v[1];k[14]=v[2];k[15]=1;return k},fromRotationTranslationScaleOrigin:function(k,p,v,z,D){var G=p[0],I=p[1],M=p[2],O=p[3],Q=G+G,S=I+I,U=M+M;p=G*Q;var Y=G*S,X=G*U;G=I*S;I*=U;var ea=M*U;M=O*Q;S*=O;var ca=O*U,aa=z[0],wa=z[1];U=z[2];z=D[0];O=D[1];D=D[2];Q=(1-(G+ea))*aa;var pa=(Y+ca)*aa;aa*=X-S;Y=(Y-ca)*wa;ea=(1-(p+ea))*wa;wa*=I+M;X=(X+S)*U;I=(I-M)*U;p=(1-(p+G))*U;k[0]=Q;k[1]=pa;k[2]=aa;k[3]=0;k[4]=Y;k[5]=ea;k[6]=wa;k[7]=0;k[8]=X;k[9]=I;k[10]=p;k[11]=0;k[12]=v[0]+z-(Q*z+Y*O+X*D);k[13]=v[1]+O-(pa*z+ea*O+I*D);k[14]=v[2]+D-(aa*z+wa*O+p*D);k[15]=1;return k},fromQuat:function(k,p){var v=p[0],z=p[1],D=p[2];p=p[3];var G=v+v,I=z+z,M=D+D;v*=G;var O=z*G;z*=I;var Q=D*G,S=D*I;D*=M;G*=p;I*=p;p*=M;k[0]=1-z-D;k[1]=O+p;k[2]=Q-I;k[3]=0;k[4]=O-p;k[5]=1-v-D;k[6]=S+G;k[7]=0;k[8]=Q+I;k[9]=S-G;k[10]=1-v-z;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},frustum:function(k,p,v,z,D,G,I){var M=1/(v-p),O=1/(D-z),Q=1/(G-I);k[0]=2*G*M;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=2*G*O;k[6]=0;k[7]=0;k[8]=(v+p)*M;k[9]=(D+z)*O;k[10]=(I+G)*Q;k[11]=-1;k[12]=0;k[13]=0;k[14]=I*G*2*Q;k[15]=0;return k},perspective:function(k,p,v,z,D){p=1/Math.tan(p/2);k[0]=p/v;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=p;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[11]=-1;k[12]=0;k[13]=0;k[15]=0;null!=D&&Infinity!==D?(v=1/(z-D),k[10]=(D+z)*v,k[14]=2*D*z*v):(k[10]=-1,k[14]=-2*z);return k},perspectiveFromFieldOfView:function(k,p,v,z){var D=Math.tan(p.upDegrees*Math.PI/180),G=Math.tan(p.downDegrees*Math.PI/180),I=Math.tan(p.leftDegrees*Math.PI/180);p=Math.tan(p.rightDegrees*Math.PI/180);var M=2/(I+p),O=2/(D+G);k[0]=M;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=O;k[6]=0;k[7]=0;k[8]=-((I-p)*M*.5);k[9]=(D-G)*O*.5;k[10]=z/(v-z);k[11]=-1;k[12]=0;k[13]=0;k[14]=z*v/(v-z);k[15]=0;return k},ortho:function(k,p,v,z,D,G,I){var M=1/(p-v),O=1/(z-D),Q=1/(G-I);k[0]=-2*M;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=-2*O;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=2*Q;k[11]=0;k[12]=(p+v)*M;k[13]=(D+z)*O;k[14]=(I+G)*Q;k[15]=1;return k},lookAt:function(k,p,v,z){var D=p[0],G=p[1];p=p[2];var I=z[0];var M=z[1];var O=z[2];var Q=v[0];z=v[1];var S=v[2];if(1E-6>Math.abs(D-Q)&&1E-6>Math.abs(G-z)&&1E-6>Math.abs(p-S))return l(k);v=D-Q;z=G-z;Q=p-S;var U=1/Math.hypot(v,z,Q);v*=U;z*=U;Q*=U;S=M*Q-O*z;O=O*v-I*Q;I=I*z-M*v;(U=Math.hypot(S,O,I))?(U=1/U,S*=U,O*=U,I*=U):I=O=S=0;M=z*I-Q*O;var Y=Q*S-v*I;var X=v*O-z*S;(U=Math.hypot(M,Y,X))?(U=1/U,M*=U,Y*=U,X*=U):X=Y=M=0;k[0]=S;k[1]=M;k[2]=v;k[3]=0;k[4]=O;k[5]=Y;k[6]=z;k[7]=0;k[8]=I;k[9]=X;k[10]=Q;k[11]=0;k[12]=-(S*D+O*G+I*p);k[13]=-(M*D+Y*G+X*p);k[14]=-(v*D+z*G+Q*p);k[15]=1;return k},targetTo:function(k,p,v,z){var D=p[0],G=p[1];p=p[2];var I=z[0],M=z[1],O=z[2];z=D-v[0];var Q=G-v[1];v=p-v[2];var S=z*z+Q*Q+v*v;0<S&&(S=1/Math.sqrt(S),z*=S,Q*=S,v*=S);var U=M*v-O*Q;O=O*z-I*v;I=I*Q-M*z;S=U*U+O*O+I*I;0<S&&(S=1/Math.sqrt(S),U*=S,O*=S,I*=S);k[0]=U;k[1]=O;k[2]=I;k[3]=0;k[4]=Q*I-v*O;k[5]=v*U-z*I;k[6]=z*O-Q*U;k[7]=0;k[8]=z;k[9]=Q;k[10]=v;k[11]=0;k[12]=D;k[13]=G;k[14]=p;k[15]=1;return k},str:function(k){return"mat4("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+", "+k[4]+", "+k[5]+", "+k[6]+", "+k[7]+", "+k[8]+", "+k[9]+", "+k[10]+", "+k[11]+", "+k[12]+", "+k[13]+", "+k[14]+", "+k[15]+")"},frob:function(k){return Math.hypot(k[0],k[1],k[2],k[3],k[4],k[5],k[6],k[7],k[8],k[9],k[10],k[11],k[12],k[13],k[14],k[15])},add:function(k,p,v){k[0]=p[0]+v[0];k[1]=p[1]+v[1];k[2]=p[2]+v[2];k[3]=p[3]+v[3];k[4]=p[4]+v[4];k[5]=p[5]+v[5];k[6]=p[6]+v[6];k[7]=p[7]+v[7];k[8]=p[8]+v[8];k[9]=p[9]+v[9];k[10]=p[10]+v[10];k[11]=p[11]+v[11];k[12]=p[12]+v[12];k[13]=p[13]+v[13];k[14]=p[14]+v[14];k[15]=p[15]+v[15];return k},subtract:t,multiplyScalar:function(k,p,v){k[0]=p[0]*v;k[1]=p[1]*v;k[2]=p[2]*v;k[3]=p[3]*v;k[4]=p[4]*v;k[5]=p[5]*v;k[6]=p[6]*v;k[7]=p[7]*v;k[8]=p[8]*v;k[9]=p[9]*v;k[10]=p[10]*v;k[11]=p[11]*v;k[12]=p[12]*v;k[13]=p[13]*v;k[14]=p[14]*v;k[15]=p[15]*v;return k},multiplyScalarAndAdd:function(k,p,v,z){k[0]=p[0]+v[0]*z;k[1]=p[1]+v[1]*z;k[2]=p[2]+v[2]*z;k[3]=p[3]+v[3]*z;k[4]=p[4]+v[4]*z;k[5]=p[5]+v[5]*z;k[6]=p[6]+v[6]*z;k[7]=p[7]+v[7]*z;k[8]=p[8]+v[8]*z;k[9]=p[9]+v[9]*z;k[10]=p[10]+v[10]*z;k[11]=p[11]+v[11]*z;k[12]=p[12]+v[12]*z;k[13]=p[13]+v[13]*z;k[14]=p[14]+v[14]*z;k[15]=p[15]+v[15]*z;return k},exactEquals:function(k,p){return k[0]===p[0]&&k[1]===p[1]&&k[2]===p[2]&&k[3]===p[3]&&k[4]===p[4]&&k[5]===p[5]&&k[6]===p[6]&&k[7]===p[7]&&k[8]===p[8]&&k[9]===p[9]&&k[10]===p[10]&&k[11]===p[11]&&k[12]===p[12]&&k[13]===p[13]&&k[14]===p[14]&&k[15]===p[15]},equals:function(k,p){var v=k[0],z=k[1],D=k[2],G=k[3],I=k[4],M=k[5],O=k[6],Q=k[7],S=k[8],U=k[9],Y=k[10],X=k[11],ea=k[12],ca=k[13],aa=k[14];k=k[15];var wa=p[0],pa=p[1],ua=p[2],va=p[3],ta=p[4],Ga=p[5],Ha=p[6],Ia=p[7],Ja=p[8],Oa=p[9],Va=p[10],Wa=p[11],Ba=p[12],Bb=p[13],Cb=p[14];p=p[15];return Math.abs(v-
  wa)<=1E-6*Math.max(1,Math.abs(v),Math.abs(wa))&&Math.abs(z-pa)<=1E-6*Math.max(1,Math.abs(z),Math.abs(pa))&&Math.abs(D-ua)<=1E-6*Math.max(1,Math.abs(D),Math.abs(ua))&&Math.abs(G-va)<=1E-6*Math.max(1,Math.abs(G),Math.abs(va))&&Math.abs(I-ta)<=1E-6*Math.max(1,Math.abs(I),Math.abs(ta))&&Math.abs(M-Ga)<=1E-6*Math.max(1,Math.abs(M),Math.abs(Ga))&&Math.abs(O-Ha)<=1E-6*Math.max(1,Math.abs(O),Math.abs(Ha))&&Math.abs(Q-Ia)<=1E-6*Math.max(1,Math.abs(Q),Math.abs(Ia))&&Math.abs(S-Ja)<=1E-6*Math.max(1,Math.abs(S),Math.abs(Ja))&&Math.abs(U-Oa)<=1E-6*Math.max(1,Math.abs(U),Math.abs(Oa))&&Math.abs(Y-Va)<=1E-6*Math.max(1,Math.abs(Y),Math.abs(Va))&&Math.abs(X-Wa)<=1E-6*Math.max(1,Math.abs(X),Math.abs(Wa))&&Math.abs(ea-Ba)<=1E-6*Math.max(1,Math.abs(ea),Math.abs(Ba))&&Math.abs(ca-Bb)<=1E-6*Math.max(1,Math.abs(ca),Math.abs(Bb))&&Math.abs(aa-Cb)<=1E-6*Math.max(1,Math.abs(aa),Math.abs(Cb))&&Math.abs(k-p)<=1E-6*Math.max(1,Math.abs(k),Math.abs(p))},mul:m,sub:t}),hb=function(){var k=r();return function(p,v,z,D,G,I){v||(v=3);z||(z=0);for(D=D?Math.min(D*v+z,p.length):p.length;z<D;z+=v)k[0]=p[z],k[1]=p[z+1],k[2]=p[z+2],G(k,k,I),p[z]=k[0],p[z+1]=k[1],p[z+2]=k[2];return p}}();hb=Object.freeze({__proto__:null,create:r,clone:function(k){var p=new ra(3);p[0]=k[0];p[1]=k[1];p[2]=k[2];return p},length:w,fromValues:y,copy:function(k,p){k[0]=p[0];k[1]=p[1];k[2]=p[2];return k},set:function(k,p,v,z){k[0]=p;k[1]=v;k[2]=z;return k},add:function(k,p,v){k[0]=p[0]+v[0];k[1]=p[1]+v[1];k[2]=p[2]+v[2];return k},subtract:B,multiply:E,divide:H,ceil:function(k,p){k[0]=Math.ceil(p[0]);k[1]=Math.ceil(p[1]);k[2]=Math.ceil(p[2]);return k},floor:function(k,p){k[0]=Math.floor(p[0]);k[1]=Math.floor(p[1]);k[2]=Math.floor(p[2]);return k},min:function(k,p,v){k[0]=Math.min(p[0],v[0]);k[1]=Math.min(p[1],v[1]);k[2]=Math.min(p[2],v[2]);return k},max:function(k,p,v){k[0]=Math.max(p[0],v[0]);k[1]=Math.max(p[1],v[1]);k[2]=Math.max(p[2],v[2]);return k},round:function(k,p){k[0]=Math.round(p[0]);k[1]=Math.round(p[1]);k[2]=Math.round(p[2]);return k},scale:function(k,p,v){k[0]=p[0]*v;k[1]=p[1]*v;k[2]=p[2]*v;return k},scaleAndAdd:function(k,p,v,z){k[0]=p[0]+v[0]*z;k[1]=p[1]+v[1]*z;k[2]=p[2]+v[2]*z;return k},distance:K,squaredDistance:C,squaredLength:A,negate:function(k,p){k[0]=-p[0];k[1]=-p[1];k[2]=-p[2];return k},inverse:function(k,p){k[0]=1/p[0];k[1]=1/p[1];k[2]=1/p[2];return k},normalize:F,dot:J,cross:L,lerp:function(k,p,v,z){var D=p[0],G=p[1];p=p[2];k[0]=D+z*(v[0]-D);k[1]=G+z*(v[1]-G);k[2]=p+z*(v[2]-p);return k},hermite:function(k,p,v,z,D,G){var I=G*G,M=I*(2*G-3)+1,O=I*(G-2)+G,Q=I*(G-1);G=I*(3-2*G);k[0]=p[0]*M+v[0]*O+z[0]*Q+D[0]*G;k[1]=p[1]*M+v[1]*O+z[1]*Q+D[1]*G;k[2]=p[2]*M+v[2]*O+z[2]*Q+D[2]*G;return k},bezier:function(k,p,v,z,D,G){var I=1-G,M=I*I,O=G*G,Q=M*I;M*=3*G;I*=3*O;G*=O;k[0]=p[0]*Q+v[0]*M+z[0]*I+D[0]*G;k[1]=p[1]*Q+v[1]*M+z[1]*I+D[1]*G;k[2]=p[2]*Q+v[2]*M+z[2]*I+D[2]*G;return k},random:function(k,p){p=p||1;var v=2*Qa()*Math.PI,z=2*Qa()-1,D=Math.sqrt(1-z*z)*p;k[0]=Math.cos(v)*D;k[1]=Math.sin(v)*D;k[2]=z*p;return k},transformMat4:function(k,p,v){var z=p[0],D=p[1];p=p[2];var G=v[3]*z+v[7]*D+v[11]*p+v[15];G=G||1;k[0]=(v[0]*z+v[4]*D+v[8]*p+v[12])/G;k[1]=(v[1]*z+v[5]*D+v[9]*p+v[13])/G;k[2]=(v[2]*z+v[6]*D+v[10]*p+v[14])/G;return k},transformMat3:function(k,p,v){var z=p[0],D=p[1];p=p[2];k[0]=z*v[0]+D*v[3]+p*v[6];k[1]=z*v[1]+D*v[4]+p*v[7];k[2]=z*v[2]+D*v[5]+p*v[8];return k},transformQuat:function(k,p,v){var z=v[0],D=v[1],G=v[2],I=p[0],M=p[1];p=p[2];var O=D*p-G*M,Q=G*I-z*p,S=z*M-D*I;v=2*v[3];k[0]=I+O*v+2*(D*S-G*Q);k[1]=M+Q*v+2*(G*O-z*S);k[2]=p+S*v+2*(z*Q-D*O);return k},rotateX:function(k,p,v,z){var D=[],G=[];D[0]=p[0]-v[0];D[1]=p[1]-v[1];D[2]=p[2]-v[2];G[0]=D[0];G[1]=D[1]*Math.cos(z)-D[2]*Math.sin(z);G[2]=D[1]*Math.sin(z)+D[2]*Math.cos(z);k[0]=G[0]+v[0];k[1]=G[1]+v[1];k[2]=G[2]+v[2];return k},rotateY:function(k,p,v,z){var D=[],G=[];D[0]=p[0]-v[0];D[1]=p[1]-v[1];D[2]=p[2]-v[2];G[0]=D[2]*Math.sin(z)+D[0]*Math.cos(z);G[1]=D[1];G[2]=D[2]*Math.cos(z)-D[0]*Math.sin(z);k[0]=G[0]+v[0];k[1]=G[1]+v[1];k[2]=G[2]+v[2];return k},rotateZ:function(k,p,v,z){var D=[],G=[];D[0]=p[0]-v[0];D[1]=p[1]-v[1];D[2]=p[2]-v[2];G[0]=D[0]*Math.cos(z)-D[1]*Math.sin(z);G[1]=D[0]*Math.sin(z)+D[1]*Math.cos(z);G[2]=D[2];k[0]=G[0]+v[0];k[1]=G[1]+v[1];k[2]=G[2]+v[2];return k},angle:function(k,p){var v=k[0],z=k[1],D=k[2],G=p[0],I=p[1],M=p[2];k=(v=Math.sqrt(v*v+z*z+D*D)*Math.sqrt(G*G+I*I+M*M))&&J(k,p)/v;return Math.acos(Math.min(Math.max(k,-1),1))},zero:function(k){k[0]=0;k[1]=0;k[2]=0;return k},str:function(k){return"vec3("+k[0]+", "+k[1]+", "+k[2]+")"},exactEquals:function(k,p){return k[0]===p[0]&&k[1]===p[1]&&k[2]===p[2]},equals:function(k,p){var v=k[0],z=k[1];k=k[2];var D=p[0],G=p[1];p=p[2];return Math.abs(v-D)<=1E-6*Math.max(1,Math.abs(v),Math.abs(D))&&Math.abs(z-G)<=1E-6*Math.max(1,Math.abs(z),Math.abs(G))&&Math.abs(k-p)<=1E-6*Math.max(1,Math.abs(k),Math.abs(p))},sub:B,mul:E,div:H,dist:K,sqrDist:C,len:w,sqrLen:A,forEach:hb});var ib=function(){var k=R();return function(p,v,z,D,G,I){v||(v=4);z||(z=0);for(D=D?Math.min(D*v+z,p.length):p.length;z<D;z+=v)k[0]=p[z],k[1]=p[z+1],k[2]=p[z+2],k[3]=p[z+3],G(k,k,I),p[z]=k[0],p[z+1]=k[1],p[z+2]=k[2],p[z+3]=k[3];return p}}();ib=Object.freeze({__proto__:null,create:R,clone:T,fromValues:V,copy:ba,set:ia,add:ja,subtract:qa,multiply:za,divide:Ca,ceil:function(k,p){k[0]=Math.ceil(p[0]);k[1]=Math.ceil(p[1]);k[2]=Math.ceil(p[2]);k[3]=Math.ceil(p[3]);return k},floor:function(k,p){k[0]=Math.floor(p[0]);k[1]=Math.floor(p[1]);k[2]=Math.floor(p[2]);k[3]=Math.floor(p[3]);return k},min:function(k,p,v){k[0]=Math.min(p[0],v[0]);k[1]=Math.min(p[1],v[1]);k[2]=Math.min(p[2],v[2]);k[3]=Math.min(p[3],v[3]);return k},max:function(k,p,v){k[0]=Math.max(p[0],v[0]);k[1]=Math.max(p[1],v[1]);k[2]=Math.max(p[2],v[2]);k[3]=Math.max(p[3],v[3]);return k},round:function(k,p){k[0]=Math.round(p[0]);k[1]=Math.round(p[1]);k[2]=Math.round(p[2]);k[3]=Math.round(p[3]);return k},scale:Ma,scaleAndAdd:function(k,p,v,z){k[0]=p[0]+v[0]*z;k[1]=p[1]+v[1]*z;k[2]=p[2]+v[2]*z;k[3]=p[3]+v[3]*z;return k},distance:Fa,squaredDistance:La,length:na,squaredLength:Sa,negate:function(k,p){k[0]=-p[0];k[1]=-p[1];k[2]=-p[2];k[3]=-p[3];return k},inverse:function(k,p){k[0]=1/p[0];k[1]=1/p[1];k[2]=1/p[2];k[3]=1/p[3];return k},normalize:Aa,dot:Na,cross:function(k,p,v,z){var D=v[0]*z[1]-v[1]*z[0],G=v[0]*z[2]-v[2]*z[0],I=v[0]*z[3]-v[3]*z[0],M=v[1]*z[2]-v[2]*z[1],O=v[1]*z[3]-v[3]*z[1];v=v[2]*z[3]-v[3]*z[2];z=p[0];var Q=p[1],S=p[2];p=p[3];k[0]=Q*v-S*O+p*M;k[1]=-(z*v)+S*I-p*G;k[2]=z*O-Q*I+p*D;k[3]=-(z*M)+Q*G-S*D;return k},lerp:lb,random:function(k,p){p=p||1;do{var v=2*Qa()-1;var z=2*Qa()-1;var D=v*v+z*z}while(1<=D);do{var G=2*Qa()-1;var I=2*Qa()-1;var M=G*G+I*I}while(1<=M);D=Math.sqrt((1-D)/M);k[0]=p*v;k[1]=p*z;k[2]=p*G*D;k[3]=p*I*D;return k},transformMat4:function(k,p,v){var z=p[0],D=p[1],G=p[2];p=p[3];k[0]=v[0]*z+v[4]*D+v[8]*G+v[12]*p;k[1]=v[1]*z+v[5]*D+v[9]*G+v[13]*p;k[2]=v[2]*z+v[6]*D+v[10]*G+v[14]*p;k[3]=v[3]*z+v[7]*D+v[11]*G+v[15]*p;return k},transformQuat:function(k,p,v){var z=p[0],D=p[1],G=p[2],I=v[0],M=v[1],O=v[2];v=v[3];var Q=v*z+M*G-O*D,S=v*D+O*z-I*G,U=v*G+I*D-M*z;z=-I*z-
  M*D-O*G;k[0]=Q*v+z*-I+S*-O-U*-M;k[1]=S*v+z*-M+U*-I-Q*-O;k[2]=U*v+z*-O+Q*-M-S*-I;k[3]=p[3];return k},zero:function(k){k[0]=0;k[1]=0;k[2]=0;k[3]=0;return k},str:function(k){return"vec4("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+")"},exactEquals:mb,equals:nb,sub:qa,mul:za,div:Ca,dist:Fa,sqrDist:La,len:na,sqrLen:Sa,forEach:ib});var jb=function(){var k=r(),p=y(1,0,0),v=y(0,1,0);return function(z,D,G){var I=J(D,G);if(-.999999>I)return L(k,p,D),1E-6>w(k)&&L(k,v,D),F(k,k),ob(z,k,Math.PI),z;if(.999999<I)return z[0]=0,z[1]=0,z[2]=0,z[3]=1,z;L(k,D,G);z[0]=k[0];z[1]=k[1];z[2]=k[2];z[3]=1+I;return Aa(z,z)}}(),kb=function(){var k=ab(),p=ab();return function(v,z,D,G,I,M){bb(k,z,I,M);bb(p,D,G,M);bb(v,k,p,2*M*(1-M));return v}}(),Za=function(){var k=f();return function(p,v,z,D){k[0]=z[0];k[3]=z[1];k[6]=z[2];k[1]=D[0];k[4]=D[1];k[7]=D[2];k[2]=-v[0];k[5]=-v[1];k[8]=-v[2];return Aa(p,vb(p,k))}}();jb=Object.freeze({__proto__:null,create:ab,identity:function(k){k[0]=0;k[1]=0;k[2]=0;k[3]=1;return k},setAxisAngle:ob,getAxisAngle:function(k,p){var v=2*Math.acos(p[3]),z=Math.sin(v/2);1E-6<z?(k[0]=p[0]/z,k[1]=p[1]/z,k[2]=p[2]/z):(k[0]=1,k[1]=0,k[2]=0);return v},getAngle:function(k,p){k=Na(k,p);return Math.acos(2*k*k-1)},multiply:pb,rotateX:qb,rotateY:rb,rotateZ:sb,calculateW:function(k,p){var v=p[0],z=p[1];p=p[2];k[0]=v;k[1]=z;k[2]=p;k[3]=Math.sqrt(Math.abs(1-v*v-z*z-p*p));return k},exp:tb,ln:ub,pow:function(k,p,v){ub(k,p);Ma(k,k,v);tb(k,k);return k},slerp:bb,random:function(k){var p=Qa(),v=Qa(),z=Qa(),D=Math.sqrt(1-p);p=Math.sqrt(p);k[0]=D*Math.sin(2*Math.PI*v);k[1]=D*Math.cos(2*Math.PI*v);k[2]=p*Math.sin(2*Math.PI*z);k[3]=p*Math.cos(2*Math.PI*z);return k},invert:function(k,p){var v=p[0],z=p[1],D=p[2];p=p[3];var G=v*v+z*z+D*D+p*p;G=G?1/G:0;k[0]=-v*G;k[1]=-z*G;k[2]=-D*G;k[3]=p*G;return k},conjugate:function(k,p){k[0]=-p[0];k[1]=-p[1];k[2]=-p[2];k[3]=p[3];return k},fromMat3:vb,fromEuler:function(k,p,v,z){var D=.5*Math.PI/180;p*=D;v*=D;z*=D;D=Math.sin(p);p=Math.cos(p);var G=Math.sin(v);v=Math.cos(v);var I=Math.sin(z);z=Math.cos(z);k[0]=D*v*z-p*G*I;k[1]=p*G*z+D*v*I;k[2]=p*v*I-D*G*z;k[3]=p*v*z+D*G*I;return k},str:function(k){return"quat("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+")"},clone:T,fromValues:V,copy:ba,set:ia,add:ja,mul:pb,scale:Ma,dot:Na,lerp:lb,length:na,len:na,squaredLength:Sa,sqrLen:Sa,normalize:Aa,exactEquals:mb,equals:nb,rotationTo:jb,sqlerp:kb,setAxes:Za});kb=Object.freeze({__proto__:null,create:function(){var k=new ra(8);ra!=Float32Array&&(k[0]=0,k[1]=0,k[2]=0,k[4]=0,k[5]=0,k[6]=0,k[7]=0);k[3]=1;return k},clone:function(k){var p=new ra(8);p[0]=k[0];p[1]=k[1];p[2]=k[2];p[3]=k[3];p[4]=k[4];p[5]=k[5];p[6]=k[6];p[7]=k[7];return p},fromValues:function(k,p,v,z,D,G,I,M){var O=new ra(8);O[0]=k;O[1]=p;O[2]=v;O[3]=z;O[4]=D;O[5]=G;O[6]=I;O[7]=M;return O},fromRotationTranslationValues:function(k,p,v,z,D,G,I){var M=new ra(8);M[0]=k;M[1]=p;M[2]=v;M[3]=z;D*=.5;G*=.5;I*=.5;M[4]=D*z+G*v-I*p;M[5]=G*z+I*k-D*v;M[6]=I*z+D*p-G*k;M[7]=-D*k-G*p-I*v;return M},fromRotationTranslation:wb,fromTranslation:function(k,p){k[0]=0;k[1]=0;k[2]=0;k[3]=1;k[4]=.5*p[0];k[5]=.5*p[1];k[6]=.5*p[2];k[7]=0;return k},fromRotation:function(k,p){k[0]=p[0];k[1]=p[1];k[2]=p[2];k[3]=p[3];k[4]=0;k[5]=0;k[6]=0;k[7]=0;return k},fromMat4:function(k,p){var v=ab();q(v,p);var z=new ra(3);x(z,p);wb(k,v,z);return k},copy:xb,identity:function(k){k[0]=0;k[1]=0;k[2]=0;k[3]=1;k[4]=0;k[5]=0;k[6]=0;k[7]=0;return k},set:function(k,p,v,z,D,G,I,M,O){k[0]=p;k[1]=v;k[2]=z;k[3]=D;k[4]=G;k[5]=I;k[6]=M;k[7]=O;return k},getReal:ba,getDual:function(k,p){k[0]=p[4];k[1]=p[5];k[2]=p[6];k[3]=p[7];return k},setReal:ba,setDual:function(k,p){k[4]=p[0];k[5]=p[1];k[6]=p[2];k[7]=p[3];return k},getTranslation:function(k,p){var v=p[4],z=p[5],D=p[6],G=p[7],I=-p[0],M=-p[1],O=-p[2];p=p[3];k[0]=2*(v*p+G*I+z*O-D*M);k[1]=2*(z*p+G*M+D*I-v*O);k[2]=2*(D*p+G*O+v*M-z*I);return k},translate:function(k,p,v){var z=p[0],D=p[1],G=p[2],I=p[3],M=.5*v[0],O=.5*v[1];v=.5*v[2];var Q=p[4],S=p[5],U=p[6];p=p[7];k[0]=z;k[1]=D;k[2]=G;k[3]=I;k[4]=I*M+D*v-G*O+Q;k[5]=I*O+G*M-z*v+S;k[6]=I*v+z*O-D*M+U;k[7]=-z*M-D*O-G*v+p;return k},rotateX:function(k,p,v){var z=-p[0],D=-p[1],G=-p[2],I=p[3],M=p[4],O=p[5],Q=p[6],S=p[7],U=M*I+S*z+O*G-Q*D,Y=O*I+S*D+Q*z-M*G,X=Q*I+S*G+M*D-O*z;M=S*I-M*z-O*D-Q*G;qb(k,p,v);z=k[0];D=k[1];G=k[2];I=k[3];k[4]=U*I+M*z+Y*G-X*D;k[5]=Y*I+M*D+X*z-U*G;k[6]=X*I+M*G+U*D-Y*z;k[7]=M*I-U*z-Y*D-X*G;return k},rotateY:function(k,p,v){var z=-p[0],D=-p[1],G=-p[2],I=p[3],M=p[4],O=p[5],Q=p[6],S=p[7],U=M*I+S*z+O*G-Q*D,Y=O*I+S*D+Q*z-M*G,X=Q*I+S*G+M*D-O*z;M=S*I-M*z-O*D-Q*G;rb(k,p,v);z=k[0];D=k[1];G=k[2];I=k[3];k[4]=U*I+M*z+
  Y*G-X*D;k[5]=Y*I+M*D+X*z-U*G;k[6]=X*I+M*G+U*D-Y*z;k[7]=M*I-U*z-Y*D-X*G;return k},rotateZ:function(k,p,v){var z=-p[0],D=-p[1],G=-p[2],I=p[3],M=p[4],O=p[5],Q=p[6],S=p[7],U=M*I+S*z+O*G-Q*D,Y=O*I+S*D+Q*z-M*G,X=Q*I+S*G+M*D-O*z;M=S*I-M*z-O*D-Q*G;sb(k,p,v);z=k[0];D=k[1];G=k[2];I=k[3];k[4]=U*I+M*z+Y*G-X*D;k[5]=Y*I+M*D+X*z-U*G;k[6]=X*I+M*G+U*D-Y*z;k[7]=M*I-U*z-Y*D-X*G;return k},rotateByQuatAppend:function(k,p,v){var z=v[0],D=v[1],G=v[2];v=v[3];var I=p[0],M=p[1],O=p[2],Q=p[3];k[0]=I*v+Q*z+M*G-O*D;k[1]=M*v+
  Q*D+O*z-I*G;k[2]=O*v+Q*G+I*D-M*z;k[3]=Q*v-I*z-M*D-O*G;I=p[4];M=p[5];O=p[6];Q=p[7];k[4]=I*v+Q*z+M*G-O*D;k[5]=M*v+Q*D+O*z-I*G;k[6]=O*v+Q*G+I*D-M*z;k[7]=Q*v-I*z-M*D-O*G;return k},rotateByQuatPrepend:function(k,p,v){var z=p[0],D=p[1],G=p[2];p=p[3];var I=v[0],M=v[1],O=v[2],Q=v[3];k[0]=z*Q+p*I+D*O-G*M;k[1]=D*Q+p*M+G*I-z*O;k[2]=G*Q+p*O+z*M-D*I;k[3]=p*Q-z*I-D*M-G*O;I=v[4];M=v[5];O=v[6];Q=v[7];k[4]=z*Q+p*I+D*O-G*M;k[5]=D*Q+p*M+G*I-z*O;k[6]=G*Q+p*O+z*M-D*I;k[7]=p*Q-z*I-D*M-G*O;return k},rotateAroundAxis:function(k,p,v,z){if(1E-6>Math.abs(z))return xb(k,p);var D=Math.hypot(v[0],v[1],v[2]);z*=.5;var G=Math.sin(z),I=G*v[0]/D,M=G*v[1]/D;v=G*v[2]/D;z=Math.cos(z);D=p[0];G=p[1];var O=p[2],Q=p[3];k[0]=D*z+Q*I+G*v-O*M;k[1]=G*z+Q*M+O*I-D*v;k[2]=O*z+Q*v+D*M-G*I;k[3]=Q*z-D*I-G*M-O*v;D=p[4];G=p[5];O=p[6];p=p[7];k[4]=D*z+p*I+G*v-O*M;k[5]=G*z+p*M+O*I-D*v;k[6]=O*z+p*v+D*M-G*I;k[7]=p*z-D*I-G*M-O*v;return k},add:function(k,p,v){k[0]=p[0]+v[0];k[1]=p[1]+v[1];k[2]=p[2]+v[2];k[3]=p[3]+v[3];k[4]=p[4]+v[4];k[5]=p[5]+v[5];k[6]=p[6]+
  v[6];k[7]=p[7]+v[7];return k},multiply:yb,mul:yb,scale:function(k,p,v){k[0]=p[0]*v;k[1]=p[1]*v;k[2]=p[2]*v;k[3]=p[3]*v;k[4]=p[4]*v;k[5]=p[5]*v;k[6]=p[6]*v;k[7]=p[7]*v;return k},dot:Na,lerp:function(k,p,v,z){var D=1-z;0>Na(p,v)&&(z=-z);k[0]=p[0]*D+v[0]*z;k[1]=p[1]*D+v[1]*z;k[2]=p[2]*D+v[2]*z;k[3]=p[3]*D+v[3]*z;k[4]=p[4]*D+v[4]*z;k[5]=p[5]*D+v[5]*z;k[6]=p[6]*D+v[6]*z;k[7]=p[7]*D+v[7]*z;return k},invert:function(k,p){var v=Sa(p);k[0]=-p[0]/v;k[1]=-p[1]/v;k[2]=-p[2]/v;k[3]=p[3]/v;k[4]=-p[4]/v;k[5]=-p[5]/v;k[6]=-p[6]/v;k[7]=p[7]/v;return k},conjugate:function(k,p){k[0]=-p[0];k[1]=-p[1];k[2]=-p[2];k[3]=p[3];k[4]=-p[4];k[5]=-p[5];k[6]=-p[6];k[7]=p[7];return k},length:na,len:na,squaredLength:Sa,sqrLen:Sa,normalize:function(k,p){var v=Sa(p);if(0<v){v=Math.sqrt(v);var z=p[0]/v,D=p[1]/v,G=p[2]/v,I=p[3]/v,M=p[4],O=p[5],Q=p[6];p=p[7];var S=z*M+D*O+G*Q+I*p;k[0]=z;k[1]=D;k[2]=G;k[3]=I;k[4]=(M-z*S)/v;k[5]=(O-D*S)/v;k[6]=(Q-G*S)/v;k[7]=(p-I*S)/v}return k},str:function(k){return"quat2("+k[0]+", "+k[1]+", "+k[2]+
  ", "+k[3]+", "+k[4]+", "+k[5]+", "+k[6]+", "+k[7]+")"},exactEquals:function(k,p){return k[0]===p[0]&&k[1]===p[1]&&k[2]===p[2]&&k[3]===p[3]&&k[4]===p[4]&&k[5]===p[5]&&k[6]===p[6]&&k[7]===p[7]},equals:function(k,p){var v=k[0],z=k[1],D=k[2],G=k[3],I=k[4],M=k[5],O=k[6];k=k[7];var Q=p[0],S=p[1],U=p[2],Y=p[3],X=p[4],ea=p[5],ca=p[6];p=p[7];return Math.abs(v-Q)<=1E-6*Math.max(1,Math.abs(v),Math.abs(Q))&&Math.abs(z-S)<=1E-6*Math.max(1,Math.abs(z),Math.abs(S))&&Math.abs(D-U)<=1E-6*Math.max(1,Math.abs(D),Math.abs(U))&&Math.abs(G-Y)<=1E-6*Math.max(1,Math.abs(G),Math.abs(Y))&&Math.abs(I-X)<=1E-6*Math.max(1,Math.abs(I),Math.abs(X))&&Math.abs(M-ea)<=1E-6*Math.max(1,Math.abs(M),Math.abs(ea))&&Math.abs(O-ca)<=1E-6*Math.max(1,Math.abs(O),Math.abs(ca))&&Math.abs(k-p)<=1E-6*Math.max(1,Math.abs(k),Math.abs(p))}});Za=function(){var k=cb();return function(p,v,z,D,G,I){v||(v=2);z||(z=0);for(D=D?Math.min(D*v+z,p.length):p.length;z<D;z+=v)k[0]=p[z],k[1]=p[z+1],G(k,k,I),p[z]=k[0],p[z+1]=k[1];return p}}();Za=Object.freeze({__proto__:null,create:cb,clone:function(k){var p=new ra(2);p[0]=k[0];p[1]=k[1];return p},fromValues:function(k,p){var v=new ra(2);v[0]=k;v[1]=p;return v},copy:function(k,p){k[0]=p[0];k[1]=p[1];return k},set:function(k,p,v){k[0]=p;k[1]=v;return k},add:function(k,p,v){k[0]=p[0]+v[0];k[1]=p[1]+v[1];return k},subtract:Xa,multiply:db,divide:eb,ceil:function(k,p){k[0]=Math.ceil(p[0]);k[1]=Math.ceil(p[1]);return k},floor:function(k,p){k[0]=Math.floor(p[0]);k[1]=Math.floor(p[1]);return k},min:function(k,p,v){k[0]=Math.min(p[0],v[0]);k[1]=Math.min(p[1],v[1]);return k},max:function(k,p,v){k[0]=Math.max(p[0],v[0]);k[1]=Math.max(p[1],v[1]);return k},round:function(k,p){k[0]=Math.round(p[0]);k[1]=Math.round(p[1]);return k},scale:function(k,p,v){k[0]=p[0]*v;k[1]=p[1]*v;return k},scaleAndAdd:function(k,p,v,z){k[0]=p[0]+v[0]*z;k[1]=p[1]+v[1]*z;return k},distance:Ya,squaredDistance:fb,length:Ta,squaredLength:gb,negate:function(k,p){k[0]=-p[0];k[1]=-p[1];return k},inverse:function(k,p){k[0]=1/p[0];k[1]=1/p[1];return k},normalize:function(k,p){var v=p[0],z=p[1];v=v*v+z*z;0<v&&(v=1/Math.sqrt(v));k[0]=p[0]*v;k[1]=p[1]*v;return k},dot:function(k,p){return k[0]*p[0]+k[1]*p[1]},cross:function(k,p,v){p=p[0]*v[1]-p[1]*v[0];k[0]=k[1]=0;k[2]=p;return k},lerp:function(k,p,v,z){var D=p[0];p=p[1];k[0]=D+z*(v[0]-D);k[1]=p+z*(v[1]-p);return k},random:function(k,p){p=p||1;var v=2*Qa()*Math.PI;k[0]=Math.cos(v)*p;k[1]=Math.sin(v)*p;return k},transformMat2:function(k,p,v){var z=p[0];p=p[1];k[0]=v[0]*z+v[2]*p;k[1]=v[1]*z+v[3]*p;return k},transformMat2d:function(k,p,v){var z=p[0];p=p[1];k[0]=v[0]*z+v[2]*p+v[4];k[1]=v[1]*z+v[3]*p+v[5];return k},transformMat3:function(k,p,v){var z=p[0];p=p[1];k[0]=v[0]*z+v[3]*p+v[6];k[1]=v[1]*z+v[4]*p+v[7];return k},transformMat4:function(k,p,v){var z=p[0];p=p[1];k[0]=v[0]*z+v[4]*p+v[12];k[1]=v[1]*z+v[5]*p+v[13];return k},rotate:function(k,p,v,z){var D=p[0]-v[0];p=p[1]-v[1];var G=Math.sin(z);z=Math.cos(z);k[0]=D*z-p*G+v[0];k[1]=D*G+p*z+v[1];return k},angle:function(k,p){var v=k[0];k=k[1];var z=p[0];p=p[1];var D=Math.sqrt(v*v+
  k*k)*Math.sqrt(z*z+p*p);return Math.acos(Math.min(Math.max(D&&(v*z+k*p)/D,-1),1))},zero:function(k){k[0]=0;k[1]=0;return k},str:function(k){return"vec2("+k[0]+", "+k[1]+")"},exactEquals:function(k,p){return k[0]===p[0]&&k[1]===p[1]},equals:function(k,p){var v=k[0];k=k[1];var z=p[0];p=p[1];return Math.abs(v-z)<=1E-6*Math.max(1,Math.abs(v),Math.abs(z))&&Math.abs(k-p)<=1E-6*Math.max(1,Math.abs(k),Math.abs(p))},len:Ta,sub:Xa,mul:db,div:eb,dist:Ya,sqrDist:fb,sqrLen:gb,forEach:Za});e.glMatrix=Ab;e.mat2=Db;e.mat2d=Eb;e.mat3=Fb;e.mat4=Gb;e.quat=jb;e.quat2=kb;e.vec2=Za;e.vec3=hb;e.vec4=ib;Object.defineProperty(e,"__esModule",{value:!0})});{"use strict";function e(A,F,J){var L=[0,0];var R=A[1][1]-A[0][1];var T=A[0][0]-A[1][0];A=R*A[0][0]+T*A[0][1];var V=F[1][1]-F[0][1];var ba=F[0][0]-F[1][0];F=V*F[0][0]+ba*F[0][1];var ia=R*ba-V*T;K(ia,0,J||0)||(L[0]=(ba*A-T*F)/ia,L[1]=(R*F-V*A)/ia);return L}function a(A,F,J,L){var R=F[0]-A[0];F=F[1]-A[1];var T=L[0]-J[0],V=L[1]-J[1];if(0===T*F-V*R)return!1;L=(R*(J[1]-A[1])+F*(A[0]-J[0]))/(T*F-V*R);A=(T*(A[1]-J[1])+V*(J[0]-A[0]))/(V*R-T*F);return 0<=L&&1>=L&&0<=A&&1>=A}function b(A,F,J){return(F[0]-A[0])*(J[1]-A[1])-(J[0]-A[0])*(F[1]-A[1])}function d(A,F,J){return 0<b(A,F,J)}function c(A,F,J){return 0<=b(A,F,J)}function f(A,F,J){return 0>b(A,F,J)}function h(A,F,J){return 0>=b(A,F,J)}var tmpPoint1$$module$str$c3runtime=[],tmpPoint2$$module$str$c3runtime=[];function g(A,F,J,L){if(L){var R=tmpPoint1$$module$str$c3runtime,T=tmpPoint2$$module$str$c3runtime;R[0]=F[0]-A[0];R[1]=F[1]-A[1];T[0]=J[0]-F[0];T[1]=J[1]-F[1];return Math.acos((R[0]*T[0]+R[1]*T[1])/(Math.sqrt(R[0]*R[0]+R[1]*R[1])*Math.sqrt(T[0]*T[0]+
  T[1]*T[1])))<L}return 0===b(A,F,J)}function l(A,F){var J=F[0]-A[0];A=F[1]-A[1];return J*J+A*A}function m(A,F){var J=A.length;return A[0>F?F%J+J:F%J]}function u(A){A.length=0}function x(A,F,J,L){for(;J<L;J++)A.push(F[J])}function n(A){for(var F=[],J=A.length,L=0;L!==J;L++)F.push(A.pop());for(L=0;L!==J;L++)A[L]=F[L]}function q(A,F){return f(m(A,F-1),m(A,F),m(A,F+1))}var tmpLine1$$module$str$c3runtime=[],tmpLine2$$module$str$c3runtime=[];function t(A,F,J){var L=tmpLine1$$module$str$c3runtime,R=tmpLine2$$module$str$c3runtime;if(c(m(A,F+1),m(A,F),m(A,J))&&h(m(A,F-1),m(A,F),m(A,J)))return!1;var T=l(m(A,F),m(A,J));for(var V=0;V!==A.length;++V)if((V+1)%A.length!==F&&V!==F&&c(m(A,F),m(A,J),m(A,V+1))&&h(m(A,F),m(A,J),m(A,V))){L[0]=m(A,F);L[1]=m(A,J);R[0]=m(A,V);R[1]=m(A,V+1);var ba=e(L,R);if(l(m(A,F),ba)<T)return!1}return!0}function r(A,F,J){for(var L=0;L!==A.length;++L)if(L!==F&&L!==J&&(L+1)%A.length!==F&&(L+1)%A.length!==J&&a(m(A,F),m(A,J),m(A,L),m(A,L+1)))return!1;return!0}function w(A,F,J,L){L=L||[];u(L);if(F<J)for(var R=F;R<=J;R++)L.push(A[R]);else{for(R=0;R<=J;R++)L.push(A[R]);for(R=F;R<A.length;R++)L.push(A[R])}return L}function y(A){for(var F=[],J,L,R=[],T=Number.MAX_VALUE,V=0;V<A.length;++V)if(q(A,V))for(var ba=0;ba<A.length;++ba)if(t(A,V,ba)){J=y(w(A,V,ba,R));L=y(w(A,ba,V,R));for(var ia=0;ia<L.length;ia++)J.push(L[ia]);J.length<T&&(F=J,T=J.length,F.push([m(A,V),m(A,ba)]))}return F}function B(A,F){if(0===F.length)return[A];if(F instanceof Array&&F.length&&F[0]instanceof Array&&2===F[0].length&&F[0][0]instanceof
  Array){A=[A];for(var J=0;J<F.length;J++)for(var L=F[J],R=0;R<A.length;R++){var T=B(A[R],L);if(T){A.splice(R,1);A.push(T[0],T[1]);break}}return A}L=F;J=A.indexOf(L[0]);R=A.indexOf(L[1]);return-1!==J&&-1!==R?[w(A,J,R),w(A,R,J)]:!1}function E(A,F,J,L,R){var T=F[1]-A[1];F=A[0]-F[0];A=T*A[0]+F*A[1];var V=L[1]-J[1];L=J[0]-L[0];J=V*J[0]+L*J[1];var ba=T*L-V*F;return K(ba,0,R||0)?[0,0]:[(L*A-F*J)/ba,(T*J-V*A)/ba]}function H(A,F,J,L,R,T,V){T=T||100;V=V||0;R=R||25;F="undefined"!==typeof F?F:[];J=J||[];L=L||[];var ba=[0,0],ia=[0,0],ja=[0,0],qa,za=0,Ca=0,Ma=0,Fa=[],La=[];if(3>A.length)return F;V++;if(V>T)return console.warn("quickDecomp: max level ("+T+") reached."),F;for(var na=0;na<A.length;++na)if(q(A,na)){J.push(A[na]);var Sa=qa=Number.MAX_VALUE;for(var Aa=0;Aa<A.length;++Aa){if(d(m(A,na-1),m(A,na),m(A,Aa))&&h(m(A,na-1),m(A,na),m(A,Aa-1))&&(ja=E(m(A,na-1),m(A,na),m(A,Aa),m(A,Aa-1)),f(m(A,na+1),m(A,na),ja))){var Na=l(A[na],ja);Na<qa&&(qa=Na,ia=ja,Ca=Aa)}d(m(A,na+1),m(A,na),m(A,Aa+1))&&h(m(A,na+1),m(A,na),m(A,Aa))&&(ja=E(m(A,na+1),m(A,na),m(A,Aa),m(A,Aa+1)),d(m(A,na-1),m(A,na),ja)&&(Na=l(A[na],ja),Na<Sa&&(Sa=Na,ba=ja,za=Aa)))}if(Ca===(za+1)%A.length)ja[0]=(ia[0]+ba[0])/2,ja[1]=(ia[1]+ba[1])/2,L.push(ja),na<za?(x(Fa,A,na,za+1),Fa.push(ja),La.push(ja),0!==Ca&&x(La,A,Ca,A.length),x(La,A,0,na+1)):(0!==na&&x(Fa,A,na,A.length),x(Fa,A,0,za+1),Fa.push(ja),La.push(ja),x(La,A,Ca,na+1));else{Ca>za&&(za+=A.length);ba=Number.MAX_VALUE;if(za<Ca)return F;for(Aa=Ca;Aa<=za;++Aa)c(m(A,na-1),m(A,na),m(A,Aa))&&h(m(A,na+1),m(A,na),m(A,Aa))&&(Na=l(m(A,na),m(A,Aa)),Na<ba&&r(A,na,Aa)&&(ba=Na,Ma=Aa%A.length));na<Ma?(x(Fa,A,na,Ma+1),0!==Ma&&x(La,A,Ma,A.length),x(La,A,0,na+1)):(0!==na&&x(Fa,A,na,A.length),x(Fa,A,0,Ma+1),x(La,A,Ma,na+1))}Fa.length<La.length?(H(Fa,F,J,L,R,T,V),H(La,F,J,L,R,T,V)):(H(La,F,J,L,R,T,V),H(Fa,F,J,L,R,T,V));return F}F.push(A);return F}function K(A,F,J){return Math.abs(A-F)<=(J||0)}function C(A,F,J){return K(A[0],F[0],J)&&K(A[1],F[1],J)}self.polyDecomp={decomp:function(A){var F=y(A);return 0<F.length?B(A,F):[A]},quickDecomp:H,isSimple:function(A){var F;for(F=0;F<A.length-1;F++)for(var J=0;J<F-1;J++)if(a(A[F],A[F+1],A[J],A[J+1]))return!1;for(F=1;F<A.length-2;F++)if(a(A[0],A[A.length-1],A[F],A[F+1]))return!1;return!0},removeCollinearPoints:function(A,F){for(var J=0,L=A.length-1;3<A.length&&0<=L;--L)g(m(A,L-1),m(A,L),m(A,L+1),F)&&(A.splice(L%A.length,1),J++);return J},removeDuplicatePoints:function(A,F){for(var J=A.length-1;1<=J;--J)for(var L=A[J],R=J-1;0<=R;--R)C(L,A[R],F)&&A.splice(J,1)},makeCCW:function(A){for(var F=0,J=1;J<A.length;++J)if(A[J][1]<A[F][1]||A[J][1]===A[F][1]&&A[J][0]>A[F][0])F=J;if(d(m(A,F-1),m(A,F),m(A,F+1)))return!1;n(A);return!0}}}
  {"use strict";let e=!1,a=!1,b="dev";const d=self.C3=class{constructor(){throw TypeError("static class can't be instantiated");}static SetReady(){e=!0}static IsReady(){return e}static SetAppStarted(){a=!0}static HasAppStarted(){return a}static SetBuildMode(c){b=c}static GetBuildMode(){return b}static IsReleaseBuild(){return"final"===b}};d.isDebug=!1;d.isDebugDefend=!1;d.hardwareConcurrency=navigator.hardwareConcurrency||2;self.C3X={}}
  {"use strict";const e=self.C3;e.QueryParser=class{constructor(a){this._queryString=a;this._parameters=new Map;this._Parse()}_Parse(){var a=this._queryString;if(a.startsWith("?")||a.startsWith("#"))a=a.substr(1);a=a.split("&");for(const b of a)this._ParseParameter(b)}_ParseParameter(a){if(a)if(a.includes("=")){var b=a.indexOf("="),d=decodeURIComponent(a.substring(0,b));a=decodeURIComponent(a.substring(b+1));this._parameters.set(d,a)}else this._parameters.set(a,null)}LogAll(){for(const a of this._parameters)console.log("[QueryParser] Parameter '"+
  a[0]+"' = "+(null===a[1]?"null":"'"+a[1]+"'"))}Has(a){return this._parameters.has(a)}Get(a){a=this._parameters.get(a);return"undefined"===typeof a?null:a}ClearHash(){history.replaceState("",document.title,location.pathname+location.search)}Reparse(a){this._queryString=a;this._parameters.clear();this._Parse()}};e.QueryString=new e.QueryParser(location.search);e.LocationHashString=new e.QueryParser(location.hash);"dev"!==e.QueryString.Get("mode")&&e.SetBuildMode("final")}
  {"use strict";const e=self.C3,a=navigator.userAgent;let b={linux:/linux|openbsd|freebsd|netbsd/i.test(a),chromeOS:/CrOS/.test(a),windowsTizen:/trident|iemobile|msie|tizen/i.test(a),genericMS:/trident|iemobile|msie|edge\//i.test(a),opera:/OPR\//.test(a),blackberry:/bb10/i.test(a),edge:/edge\//i.test(a),trident:/trident/i.test(a),webkit:/webkit/i.test(a),safari:/safari\//i.test(a),chrome:/chrome\//i.test(a),chromium:/chromium\//i.test(a),crosswalk:/crosswalk|xwalk/i.test(a),nwjs:/nwjs/i.test(a),amazonwebapp:/amazonwebappplatform/i.test(a),webview:/wv\)/.test(a),android:/android/i.test(a),nokia:/nokiabrowser\/[0-9.]+/i.test(a)};var JSCompiler_object_inline_windows_0=/windows\s+nt\s+\d+\.\d+/i.exec(a),JSCompiler_object_inline_OSX_1=/mac\s+os\s+x\s+[0-9_]+/i.exec(a),JSCompiler_object_inline_android_2=/android\s+[0-9.]+/i.exec(a),JSCompiler_object_inline_opera_3=/OPR\/[0-9.]+/.exec(a),JSCompiler_object_inline_tizen_4=/tizen\s+[0-9.]+/i.exec(a),JSCompiler_object_inline_iphone_5=/iphone\s+os\s+[0-9_]+/i.exec(a),JSCompiler_object_inline_ipad_6=/ipad[^)]*os\s+[0-9_]+/i.exec(a),JSCompiler_object_inline_winPhone_7=/windows\s+phone\s+[0-9.]+/i.exec(a),JSCompiler_object_inline_winPhoneOS_8=/windows\s+phone\s+os\s+[0-9.]+/i.exec(a),JSCompiler_object_inline_chrome_9=/chrome\/[0-9.]+/i.exec(a),JSCompiler_object_inline_chromium_10=/chromium\/[0-9.]+/i.exec(a),JSCompiler_object_inline_nwjs_11=/nwjs\/[0-9.]+/i.exec(a),JSCompiler_object_inline_firefox_12=/firefox\/[0-9.]+/i.exec(a),JSCompiler_object_inline_ie_13=/msie\s+[0-9.]+/i.exec(a),JSCompiler_object_inline_edge_14=/edge\/[0-9.]+/i.exec(a),JSCompiler_object_inline_edgeChromium_15=/edg\/[0-9.]+/i.exec(a),JSCompiler_object_inline_silk_16=/silk\/[0-9.]+/i.exec(a);let d="(unknown)",c="(unknown)",f="(unknown)",h="(unknown)",g="(unknown)",l="browser",m=!1,u=!1,x=new Map;function n(t,r,w){!0===r?(w(),x.set(t,!0)):r&&r.length&&(w(r[0]),x.set(t,!0))}n("isWindows",JSCompiler_object_inline_windows_0,t=>{d="Windows";if(t=t.split(" ")[2])switch(t){case "5.0":c="2000";break;case "5.1":c="XP";break;case "5.2":c="XP";break;case "6.0":c="Vista";break;case "6.1":c="7";break;case "6.2":c="8";break;case "6.3":c="8.1";break;case "10.0":c="10"}});n("isOSX",JSCompiler_object_inline_OSX_1,t=>{d="Mac OS X";(t=t.split(" ")[3])&&(c=t.replace("_","."))});n("isLinux",b.linux,()=>{d="Linux"});n("isChromeOS",b.chromeOS,()=>{d="Chrome OS"});n("isAndroid",!b.windowsTizen&&JSCompiler_object_inline_android_2,t=>{d="Android";(t=t.split(" ")[1])&&(c=t)});n("isTizen",JSCompiler_object_inline_tizen_4,t=>{d="Tizen";(t=t.split(" ")[1])&&(c=t)});n("isIPhone",!b.windowsTizen&&JSCompiler_object_inline_iphone_5,t=>{d="iOS";(t=t.split(" ")[2])&&(c=t.replace("_","."))});n("isIPad",!b.windowsTizen&&JSCompiler_object_inline_ipad_6,t=>{d="iOS";(t=t.split(" ")[3])&&(c=t.replace("_","."))});n("isWindowsPhone",JSCompiler_object_inline_winPhone_7,t=>{d="Windows Phone";(t=t.split(" ")[2])&&(c=t)});n("isWindowsPhoneOS",JSCompiler_object_inline_winPhoneOS_8,t=>{d="Windows Phone";(t=t.split(" ")[3])&&(c=t)});n("isBlackberry",b.blackberry,()=>{d="Blackberry";c="10";f="stock";g="webkit"});n("isChrome",!b.edge&&!b.opera&&JSCompiler_object_inline_chrome_9,t=>{f="Chrome";g="Chromium";(t=t.split("/")[1])&&(h=t)});n("isOpera",JSCompiler_object_inline_opera_3,t=>{f="Opera";g="Chromium";(t=t.split("/")[1])&&(h=t)});n("isChromium",JSCompiler_object_inline_chromium_10,t=>{g=f="Chromium";(t=t.split("/")[1])&&(h=t)});n("isFirefox",JSCompiler_object_inline_firefox_12,t=>{f="Firefox";g="Gecko";(t=t.split("/")[1])&&(h=t)});n("isInternetExplorer",JSCompiler_object_inline_ie_13,t=>{f="Internet Explorer";g="Trident";(t=t.split(" ")[1])&&(h=t)});n("isTrident","Internet Explorer"!==f&&b.trident,()=>{g="Trident";var t=/rv:[0-9.]+/i.exec(a);t&&t.length&&(f="Internet Explorer",(t=t[0].split(":")[1])&&(h=t))});n("isEdge",JSCompiler_object_inline_edge_14,t=>{g=f="Edge";(t=t.split("/")[1])&&(h=t)});n("isEdgeChromium",JSCompiler_object_inline_edgeChromium_15,t=>{f="Edge";g="Chromium";(t=t.split("/")[1])&&(h=t)});n("isSafari",b.safari&&!b.nokia&&!b.chrome&&!b.chromium&&!b.genericIE&&!b.blackberry,()=>{f="Safari";g="WebKit";var t=/version\/[0-9.]+/i.exec(a),r=/crios\/[0-9.]+/i.exec(a),w=/fxios\/[0-9.]+/i.exec(a);t&&t.length&&(t=t[0].split("/")[1])&&(h=t);r&&r.length&&(f="Chrome for iOS",(r=r[0].split("/")[1])&&(h=r));w&&w.length&&(f="Firefox for iOS",(w=w[0].split("/")[1])&&(h=w))});n("isSilk",JSCompiler_object_inline_silk_16,t=>{f="Silk";(t=t.split("/")[1])&&(h=t)});n("isCrosswalk",b.crosswalk,()=>l="crosswalk");n("isCordova",self.device&&(self.device.cordova||self.device.phonegap),()=>l="cordova");n("isNWJS",JSCompiler_object_inline_nwjs_11,t=>{l="nwjs";f="NW.js";g="Chromium";(t=t.split("/")[1])&&(h=t)});n("isAmazonWebApp",b.amazonwebapp,()=>l="webapp");n("isHomeScreenWebApp","nwjs"!==l&&"undefined"!==typeof window&&(window.matchMedia&&window.matchMedia("(display-mode: standalone)").matches||navigator.standalone),()=>l="webapp");n("isFalseSafari","Safari"===f&&("Android"===d||"Tizen"===d||"Blackberry"===d),()=>f="stock");n("isAndroidWebview","Chrome"===f&&"browser"===l&&b.webview,()=>l="webview");n("isFirefoxOS","Firefox"===f&&"(unknown)"===d,()=>d="Firefox OS");n("isAndroidFallback","(unknown)"===d&&!b.windowsTizen&&b.android,()=>d="Android");n("isTridentFallback","(unknown)"===d&&b.trident,()=>g="Trident");n("isWebkitFallback","(unknown)"===d&&b.webkit,()=>g="WebKit");n("isDesktop",(()=>"Windows"===d||"Mac OS X"===d||"Linux"===d||"Chrome OS"===d||"nwjs"===l)(),()=>m=!0);u="nwjs"===l;const q="Mac OS X"===d&&navigator.maxTouchPoints&&2<navigator.maxTouchPoints;q&&(d="iOS",c=h,u=m=!1);e.Platform={OS:d,OSVersion:c,Browser:f,BrowserVersion:h,BrowserVersionNumber:parseFloat(h),BrowserEngine:g,Context:l,IsDesktop:m,IsMobile:!m,IsDesktopApp:u,IsChromeWebStore:!!(self.chrome&&self.chrome.runtime&&self.chrome.runtime.id),IsAppleOS:"Mac OS X"===d||"iOS"===d,IsIpadOS:q,IsLinux:"Linux"===d}}"use strict";{const e=new Map,a="undefined"!==typeof IDBObjectStore&&"function"===typeof IDBObjectStore.prototype.getAll,b="undefined"!==typeof IDBObjectStore&&"function"===typeof IDBObjectStore.prototype.getAllKeys;function d(q){return new Promise((t,r)=>{q.onsuccess=()=>t(q.result);q.onerror=()=>r(q.error)})}function c(q){return new Promise((t,r)=>{q.oncomplete=()=>t();q.onerror=()=>r(q.error);q.onabort=()=>r(q.error)})}function f(q,t){return g(q,t)}function h(q,t){return g(q,t,!0)}async function g(q,t,r=!1,w=!0){const y=await l(q);try{const B=y.transaction(["keyvaluepairs"],r?"readwrite":"readonly");return t(B)}catch(B){if(w&&"InvalidStateError"===B.name)return e.delete(q),g(q,t,r,!1);throw B;}}function l(q){u(q);let t=e.get(q);t instanceof Promise||(t=m(q),e.set(q,t),t.catch(r=>e.delete(q)));return t}async function m(q){u(q);const t=indexedDB.open(q,2);t.addEventListener("upgradeneeded",r=>{try{r.target.result.createObjectStore("keyvaluepairs")}catch(w){console.error(`Failed to create objectstore for database ${q}`,w)}});return d(t)}function u(q){if("string"!==typeof q)throw new TypeError("expected string");}function x(q,t){const r=q.objectStore("keyvaluepairs").openCursor();return new Promise(w=>{const y=[];r.onsuccess=B=>{if(B=B.target.result){switch(t){case "entries":y.push([B.key,B.value]);break;case "keys":y.push(B.key);break;case "values":y.push(B.value)}B.continue()}else w(y)}})}class n{constructor(q){u(q);this.name=q}async ready(){await l(this.name)}set(q,t){u(q);return h(this.name,async r=>{var w=r.objectStore("keyvaluepairs").put(t,q);w=d(w);r=c(r);await Promise.all([r,w])})}get(q){u(q);return f(this.name,async t=>{var r=t.objectStore("keyvaluepairs").get(q);r=d(r);t=c(t);[,t]=await Promise.all([t,r]);return t})}delete(q){u(q);return h(this.name,async t=>{var r=t.objectStore("keyvaluepairs").delete(q);r=d(r);t=c(t);await Promise.all([t,r])})}clear(){return h(this.name,async q=>{var t=q.objectStore("keyvaluepairs").clear();t=d(t);q=c(q);await Promise.all([q,t])})}keys(){return f(this.name,async q=>{if(b){var t=q.objectStore("keyvaluepairs").getAllKeys();t=d(t)}else t=x(q,"keys");q=c(q);[,q]=await Promise.all([q,t]);return q})}values(){return f(this.name,async q=>{if(a){var t=q.objectStore("keyvaluepairs").getAll();t=d(t)}else t=x(q,"values");q=c(q);[,q]=await Promise.all([q,t]);return q})}entries(){return f(this.name,async q=>{var t=x(q,"entries");q=c(q);[,t]=await Promise.all([q,t]);return t})}}self.KVStorageContainer=n}"use strict";{const e=self.KVStorageContainer,a=[/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],b=new WeakMap;let d=!1;"undefined"===typeof indexedDB&&(d=!0,console.warn("Unable to use local storage because indexedDB is not defined"));function c(l){throw Error(`"${l}" is not implemented`);}function f(l){if("function"===typeof l)throw Error("localforage callback API is not implemented; please use the promise API instead");}function h(l){return"object"===typeof l?new Promise(m=>{const{port1:u,port2:x}=new MessageChannel;x.onmessage=n=>m(n.data);u.postMessage(l)}):Promise.resolve(l)}class g{constructor(l){this._inst=l;b.set(this,new Map)}_MaybeSwitchToMemoryFallback(l){if(!d)for(const m of a)if(l&&m.test(l.message)){console.error("Unable to use local storage, reverting to in-memory store: ",l,l.message);d=!0;break}}async _getItemFallback(l){l=b.get(this).get(l);l=await h(l);return"undefined"===typeof l?null:l}async _setItemFallback(l,m){m=await h(m);b.get(this).set(l,m)}_removeItemFallback(l){b.get(this).delete(l)}_clearFallback(){b.get(this).clear()}_keysFallback(){return Array.from(b.get(this).keys())}IsUsingFallback(){return d}async getItem(l,m){f(m);if(d)return await this._getItemFallback(l);let u;try{u=await this._inst.get(l)}catch(x){this._MaybeSwitchToMemoryFallback(x);if(d)return await this._getItemFallback(l);console.error(`Error reading '${l}' from storage, returning null: `,x);return null}return"undefined"===typeof u?null:u}async setItem(l,m,u){f(u);"undefined"===typeof m&&(m=null);if(d)await this._setItemFallback(l,m);else try{await this._inst.set(l,m)}catch(x){if(this._MaybeSwitchToMemoryFallback(x),d)await this._setItemFallback(l,m);else throw x;}}async removeItem(l,m){f(m);if(d)this._removeItemFallback(l);else try{await this._inst.delete(l)}catch(u){this._MaybeSwitchToMemoryFallback(u),d?this._removeItemFallback(l):console.error(`Error removing '${l}' from storage: `,u)}}async clear(l){f(l);if(d)this._clearFallback();else try{await this._inst.clear()}catch(m){this._MaybeSwitchToMemoryFallback(m),d?this._clearFallback():console.error("Error clearing storage: ",m)}}async keys(l){f(l);if(d)return this._keysFallback();l=[];try{l=await this._inst.keys()}catch(m){this._MaybeSwitchToMemoryFallback(m);if(d)return this._keysFallback();console.error("Error getting storage keys: ",m)}return l}ready(l){f(l);return d?Promise.resolve(!0):this._inst.ready()}createInstance(l){if("object"!==typeof l)throw new TypeError("invalid options object");l=l.name;if("string"!==typeof l)throw new TypeError("invalid store name");l=new e(l);return new g(l)}length(l){c("localforage.length()")}key(l,m){c("localforage.key()")}iterate(l,m){c("localforage.iterate()")}setDriver(l){c("localforage.setDriver()")}config(l){c("localforage.config()")}defineDriver(l){c("localforage.defineDriver()")}driver(){c("localforage.driver()")}supports(l){c("localforage.supports()")}dropInstance(){c("localforage.dropInstance()")}disableMemoryMode(){d=!1}}self.localforage=new g(new e("localforage"))}
  {"use strict";const e=self.C3;e.Supports={};e.Supports.WebAnimations=(()=>{try{if("Safari"===e.Platform.Browser||"undefined"===typeof document)return!1;const a=document.createElement("div");return"undefined"===typeof a.animate?!1:"undefined"!==typeof a.animate([{opacity:"0"},{opacity:"1"}],1E3).reverse}catch(a){return!1}})();e.Supports.DialogElement="undefined"!==typeof HTMLDialogElement;e.Supports.RequestIdleCallback=!!self.requestIdleCallback;e.Supports.ImageBitmap=!!self.createImageBitmap;e.Supports.ImageBitmapOptions=!1;if(e.Supports.ImageBitmap)try{self.createImageBitmap(new ImageData(32,32),{premultiplyAlpha:"none"}).then(a=>{e.Supports.ImageBitmapOptions=!0}).catch(a=>{e.Supports.ImageBitmapOptions=!1})}catch(a){e.Supports.ImageBitmapOptions=!1}e.Supports.ClipboardReadText=!(!navigator.clipboard||!navigator.clipboard.readText||"Firefox"===e.Platform.Browser);e.Supports.PermissionsQuery=!(!navigator.permissions||!navigator.permissions.query);e.Supports.Proxies="undefined"!==typeof Proxy;e.Supports.DownloadAttribute=(()=>"undefined"===typeof document?!1:"undefined"!==typeof document.createElement("a").download)();e.Supports.CanvasToBlob=(()=>"undefined"!==typeof HTMLCanvasElement&&HTMLCanvasElement.prototype.toBlob)();e.Supports.Fetch="function"===typeof fetch;e.Supports.PersistentStorage=!!(self.isSecureContext&&"Opera"!==e.Platform.Browser&&navigator.storage&&navigator.storage.persist);e.Supports.StorageQuotaEstimate=!!(self.isSecureContext&&navigator.storage&&navigator.storage.estimate);e.Supports.Fullscreen=(()=>{if("undefined"===typeof document||"iOS"===e.Platform.OS)return!1;const a=document.documentElement;return!!(a.requestFullscreen||a.msRequestFullscreen||a.mozRequestFullScreen||a.webkitRequestFullscreen)})();e.Supports.ImageDecoder="undefined"!==typeof self.ImageDecoder;e.Supports.NativeFileSystemAPI=!!self.showOpenFilePicker;e.Supports.NavigatorFontsQuery=!(!navigator.fonts||!navigator.fonts.query)}
  {"use strict";const e=self.C3;if(!String.prototype.trimStart){const a=/^[\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(){return this.replace(a,"")}}if(!String.prototype.trimEnd){const a=/[\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(){return this.replace(a,"")}}String.prototype.replaceAll||(String.prototype.replaceAll=function(a,b){return this.replace(new RegExp(e.EscapeRegex(a),"g"),b)});Array.prototype.values||(Array.prototype.values=function*(){for(const a of this)yield a});if(!Array.prototype.flat){function a(b,d){return b.reduce((c,f)=>{0<d&&Array.isArray(f)?Array.prototype.push.apply(c,a(f,d-1)):c.push(f);return c},[])}Array.prototype.flat=function(b=1){return a(this,b)}}Array.prototype.at||(Array.prototype.at=function(a){a=Math.trunc(a)||0;0>a&&(a+=this.length);if(!(0>a||a>=this.length))return this[a]});String.prototype.at||(String.prototype.at=function(a){a=Math.trunc(a)||0;0>a&&(a+=this.length);if(!(0>a||a>=this.length))return this[a]});RegExp.escape||(RegExp.escape=function(a){return String(a).replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")});navigator.storage&&!navigator.storage.estimate&&navigator.webkitTemporaryStorage&&navigator.webkitTemporaryStorage.queryUsageAndQuota&&(navigator.storage.estimate=function(){return new Promise((a,b)=>navigator.webkitTemporaryStorage.queryUsageAndQuota((d,c)=>a({usage:d,quota:c}),b))});"undefined"===typeof self.isSecureContext&&(self.isSecureContext="https:"===location.protocol);"undefined"===typeof self.globalThis&&(self.globalThis=self)}{"use strict";const e=self.C3;function a(b){let d=e.GetCallStack();console.error("Assertion failure: "+b+"\n\nStack trace:\n"+d)}self.assert=function(b,d){b||a(d)}}
  {"use strict";const e=self.C3,a=self.C3X;e.IsNumber=function(d){return"number"===typeof d};e.IsFiniteNumber=function(d){return e.IsNumber(d)&&isFinite(d)};e.RequireNumber=function(d){if(!e.IsNumber(d))throw new TypeError("expected number");};e.RequireOptionalNumber=function(d){e.IsNullOrUndefined(d)};e.RequireNumberInRange=function(d,c,f){if(!e.IsNumber(d)||isNaN(d)||c>d||f<d)throw new RangeError("number outside of range");};e.RequireAllNumber=function(...d){for(let c of d);};e.RequireFiniteNumber=function(d){if(!e.IsFiniteNumber(d))throw new TypeError("expected finite number");};e.RequireOptionalFiniteNumber=function(d){e.IsNullOrUndefined(d)};e.RequireAllFiniteNumber=function(...d){for(let c of d);};e.IsString=function(d){return"string"===typeof d};e.RequireString=function(d){if(!e.IsString(d))throw new TypeError("expected string");};e.RequireOptionalString=function(d){e.IsNullOrUndefined(d)};e.RequireAllString=function(...d){for(let c of d);};e.IsSimpleObject=function(d){return"object"!==typeof d||null===d?!1:(d=Object.getPrototypeOf(d))?d.constructor===Object:null===d};e.RequireSimpleObject=function(d){if(!e.IsSimpleObject(d))throw new TypeError("expected simple object");};e.RequireOptionalSimpleObject=function(d){if(!e.IsNullOrUndefined(d)&&!e.IsSimpleObject(d))throw new TypeError("expected simple object");};e.IsObject=function(d){return"object"===typeof d&&null!==d&&!Array.isArray(d)};e.RequireObject=function(d){if(!e.IsObject(d))throw new TypeError("expected object");};e.RequireOptionalObject=function(d){e.IsNullOrUndefined(d)};e.RequireAllObject=function(...d){for(let c of d);};e.IsFileLike=function(d){return e.IsInstanceOf(d,Blob)&&"string"===typeof d.name};e.RequireFileLike=function(d){if(!e.IsFileLike(d))throw new TypeError("expected file");};e.RequireOptionalFileLike=function(d){e.IsNullOrUndefined(d)};e.IsArray=function(d){return Array.isArray(d)};e.RequireArray=function(d){if(!e.IsArray(d))throw new TypeError("expected array");};e.RequireOptionalArray=function(d){e.IsNullOrUndefined(d)};e.RequireAllArray=function(...d){for(let c of d);};e.Is2DArray=function(d){return e.IsArray(d)?d.length?e.IsArray(d[0])?!0:!1:!0:!1};e.Require2DArray=function(d){if(!e.Is2DArray(d))throw new TypeError("expected 2d array");for(let c of d)if(!e.IsArray(c))throw new TypeError("expected 2d array");};e.RequireOptional2DArray=function(d){e.IsNullOrUndefined(d)};e.IsFunction=function(d){return"function"===typeof d};e.RequireFunction=function(d,c){if(!e.IsFunction(d))throw new TypeError("expected function");if(!e.IsNullOrUndefined(c)&&d!==c)throw new TypeError("expected same function reference");};e.RequireOptionalFunction=function(d){e.IsNullOrUndefined(d)};e.RequireAllFunction=function(...d){for(let c of d);};e.RequireAnyFunction=function(d,...c){if(!e.IsFunction(d))throw new TypeError("expected function");if(!c.length)throw Error("missing comparison functions");for(let f of c)if(!e.IsNullOrUndefined(f)&&d===f)return;throw new TypeError("expected same function reference");};e.RequireOptionalAllFunction=function(...d){if(!e.IsNullOrUndefined(d))for(let c of d);};e.IsInstanceOf=function(d,c){return d instanceof c};e.IsInstanceOfAny=function(d,...c){for(let f of c)if(e.IsInstanceOf(d,f))return!0;return!1};e.RequireInstanceOf=function(d,c){if(!e.IsInstanceOf(d,c))throw new TypeError("unexpected type");};e.RequireOptionalInstanceOf=function(d,c){e.IsNullOrUndefined(d)};e.RequireAllInstanceOf=function(d,...c){for(let f of c);};e.RequireAnyInstanceOf=function(d,...c){if(!e.IsInstanceOfAny(d,...c))throw new TypeError("unexpected type");};e.RequireAnyOptionalInstanceOf=function(d,...c){if(!e.IsNullOrUndefined(d)&&!e.IsInstanceOfAny(d,...c))throw new TypeError("unexpected type");};e.IsArrayOf=function(d,c){for(let f of d)if(!e.IsInstanceOf(f,c))return!1;return!0};e.IsArrayOfFiniteNumbers=function(d){for(let c of d)if(!e.IsFiniteNumber(c))return!1;return!0};e.RequireArrayOf=function(d,c){for(let f of d);};e.RequireOptionalArrayOf=function(d,c){if(!e.IsNullOrUndefined(d))for(let f of d);};e.RequireArrayOfAny=function(d,...c){for(let f of d);};e.RequireOptionalArrayOfAny=function(d,...c){if(!e.IsNullOrUndefined(d))for(let f of d);};e.IsDOMNode=function(d,c){return e.IsNullOrUndefined(d)||!e.IsString(d.nodeName)?!1:!c||e.equalsNoCase(d.nodeName,c)};e.RequireDOMNode=function(d,c){if(e.IsNullOrUndefined(d)||!e.IsString(d.nodeName))throw new TypeError("expected DOM node");if(c&&!e.equalsNoCase(d.nodeName,c))throw new TypeError(`expected DOM '${c}' node`);};e.RequireOptionalDOMNode=function(d,c){e.IsNullOrUndefined(d)};e.IsHTMLElement=function(d,c){return e.IsNullOrUndefined(d)||!e.IsString(d.tagName)?!1:!c||e.equalsNoCase(d.tagName,c)};e.RequireHTMLElement=function(d,c){if(e.IsNullOrUndefined(d)||!e.IsString(d.tagName))throw new TypeError("expected HTML element");if(c&&!e.equalsNoCase(d.tagName,c))throw new TypeError(`expected HTML '${c}' element`);};e.RequireOptionalHTMLElement=function(d,c){e.IsNullOrUndefined(d)};e.IsDrawable=function(d){return e.IsHTMLElement(d,"img")||e.IsHTMLElement(d,"canvas")||e.IsHTMLElement(d,"video")||"undefined"!==typeof OffscreenCanvas&&d instanceof OffscreenCanvas||"undefined"!==typeof ImageBitmap&&d instanceof ImageBitmap};e.RequireDrawable=function(d){if(!e.IsDrawable(d))throw new TypeError("expected drawable");};e.RequireOptionalDrawable=function(d){e.IsNullOrUndefined(d)};e.IsDrawableOrImageData=function(d){return d instanceof ImageData?!0:e.IsDrawable(d)};e.RequireDrawableOrImageData=function(d){if(!e.IsDrawableOrImageData(d))throw new TypeError("expected drawable or image data");};e.RequireOptionalDrawableOrImageData=function(d){if(!e.IsNullOrUndefined(d)&&!e.IsDrawableOrImageData(d))throw new TypeError("expected drawable or image data");};e.IsStringLike=function(d){return"string"===typeof d||d instanceof e.HtmlString||d instanceof e.BBString};e.RequireStringLike=function(d){if(!e.IsStringLike(d))throw new TypeError("expected string-like");};e.RequireOptionalStringLike=function(d){e.IsNullOrUndefined(d)};e.RequireAllStringLike=function(...d){for(let c of d);};e.RequireOverride=function(){throw Error("must be overridden");};e.NotYetImplemented=function(){throw Error("not yet implemented");};e.IsDefined=function(d,...c){if("undefined"===typeof d)return!1;for(let f of c){if("undefined"===typeof d[f])return!1;d=d[f]}return!0};e.IsNullOrUndefined=function(d){return"undefined"===typeof d||null===d};e.AreArrayElementsOfSameType=function(d){let c=d[0].constructor;for(let f of d)if(f.constructor!==c)return!1;return c};e.AreArrayElementsOfType=function(d,c){for(let f of d)if(!(f instanceof c))return!1;return!0};const b=Object.getPrototypeOf(Uint8Array);e.IsTypedArray=function(d){return e.IsInstanceOf(d,b)};e.RequireTypedArray=function(d){};e.WeakRequireTypedArray=function(d){e.WeakRequireInstanceOf(d,b)};e.WeakRequireAnyInstanceOf=function(d,...c){if(!e.WeakIsAnyInstanceOf(d,...c))throw new TypeError("unexpected type");};e.WeakIsAnyInstanceOf=function(d,...c){for(const f of c)if(e.WeakIsInstanceOf(d,f))return!0;return!1};e.WeakRequireInstanceOf=function(d,c){if(!e.WeakIsInstanceOf(d,c))throw new TypeError("unexpected type");};e.WeakIsInstanceOf=function(d,c){for(;d=Object.getPrototypeOf(d);)if(d.constructor.name===c.name)return!0;return!1};a.RequireNumber=e.RequireNumber;a.RequireOptionalNumber=e.RequireOptionalNumber;a.RequireFiniteNumber=e.RequireFiniteNumber;a.RequireOptionalFiniteNumber=e.RequireOptionalFiniteNumber;a.RequireString=e.RequireString;a.RequireOptionalString=e.RequireOptionalString;a.RequireObject=e.RequireObject;a.RequireOptionalObject=e.RequireOptionalObject;a.RequireArray=e.RequireArray;a.RequireOptionalArray=e.RequireOptionalArray;a.RequireFunction=e.RequireFunction;a.RequireOptionalFunction=e.RequireOptionalFunction;a.RequireInstanceOf=e.RequireInstanceOf;a.RequireOptionalInstanceOf=e.RequireOptionalInstanceOf;a.IsNullOrUndefined=e.IsNullOrUndefined}
  {"use strict";const e=self.C3,a=new Map;e.RafLog=function(t,...r){a.has(t)||a.set(t,-1);-1===a.get(t)&&a.set(t,requestAnimationFrame(()=>{console.log(`%c${t}`,"font-weight: bold",...r);a.set(t,-1)}))};e.GetCallStack=function(){return Error().stack};e.Debugger=function(){debugger};e.cast=function(t,r){return t&&t instanceof r?t:null};e.getName=function(t){return"undefined"===typeof t?"undefined":null===t?"null":"boolean"===typeof t?"<boolean>":e.IsNumber(t)?"<number>":e.IsString(t)?"<string>":e.IsArray(t)?"<array>":"symbol"===typeof t?"<"+t.toString()+">":e.IsFunction(t)?t.name&&"Function"!==t.name?t.name:"<anonymous function>":"object"===typeof t?t.constructor&&t.constructor.name&&"Object"!==t.constructor.name?t.constructor.name:"<anonymous object>":"<unknown>"};e.getType=function(t){return null===t?"null":Array.isArray(t)?"array":typeof t};e.range=function*(t,r){if(!isFinite(Math.abs(t-r)))throw Error("Invalid parameters");if(t>r)for(--t;t>=r;t--)yield t;else for(;t<r;t++)yield t};function b(t,r){t=e.getType(t);r=e.getType(r);return"null"===t||"null"===r?!0:"undefined"===t||"undefined"===r?!1:t===r}let d=new Map,c=new Map,f=new WeakMap,h=new WeakMap;e.DefendHandler={};const g=new Set(["then","splice"]);function l(t){console.warn("[Defence] "+t+" @",e.GetCallStack())}e.DefendHandler.get=function(t,r){r in t||"symbol"===typeof r||g.has(r)||l(`Accessed missing property '${r}' from defended object '${e.getName(t)}', returning undefined`);h.has(t)&&"symbol"!==typeof r&&!g.has(r)&&l(`Accessed property '${r}' on a released object '${e.getName(t)}'\nObject was originally released at: ${h.get(t)})\nCall stack at access: `);return t[r]};e.DefendHandler.set=function(t,r,w){r in t||d.has(t)||l(`Set non-existent property '${r}' to '${w}' on defended object '${e.getName(t)}'`);b(t[r],w)||d.has(t)||l(`Set '${e.getType(t[r])}' property '${r}' to type '${e.getType(w)}' on defended object '${e.getName(t)}'`);h.has(t)&&l(`Set property '${r}' on a released object '${e.getName(t)}'\nObject was originally released at: ${h.get(t)})\nCall stack at access: `);t[r]=w;return!0};e.DefendHandler.deleteProperty=function(t,r){throw new ReferenceError(`Cannot delete property '${r}' from defended object '${e.getName(t)}'`);};e.DefendHandler.defineProperty=function(t,r,w){throw new ReferenceError(`Cannot define property '${r}' on defended object '${e.getName(t)}'`);};e.DefendHandler.enumerate=function(t){throw new ReferenceError(`Cannot enumerate defended object '${e.getName(t)}'`);};let m=-1;function u(){m=-1;if(0<d.size||0<c.size){let t=[...new Set([...d.keys()].map(r=>e.getName(r)))].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: ${t}`);d.clear();c.clear()}}e.DefendedBase=class{constructor(){if(e.isDebugDefend&&e.Supports.Proxies){var t=new.target;t=Object.create(t.prototype);var r=new Proxy(t,e.DefendHandler);d.set(t,r);c.set(r,t);f.set(r,t);-1===m&&(m=requestAnimationFrame(u));return r}}};e.debugDefend=function(t){if(e.isDebugDefend&&e.Supports.Proxies&&t instanceof e.DefendedBase){if(!c.has(t))return t;let r=c.get(t);c.delete(t);d.delete(r);return t}return e.isDebug?Object.seal(t):t};e.New=function(t,...r){let w;try{w=new t(...r)}catch(y){throw c.clear(),d.clear(),y;}e.isDebugDefend&&q(t,w);return e.debugDefend(w)};e.Release=function(t){(t=f.get(t))&&h.set(t,e.GetCallStack())};e.WasReleased=function(t){return(t=f.get(t))?!!h.get(t):!1};let x=new Map;function n(t){let r=new Set;for(let w in t)r.add(w);return r}function q(t,r){r=n(r);let w=x.get(t);if(w){let y=[];for(let B of w.values())r.has(B)?r.delete(B):y.push(B);e.appendArray(y,[...r]);y.length&&console.warn(`[Defence] '${e.getName(t)}' constructor creates inconsistent properties: ${y.join(", ")}`)}else x.set(t,r)}e.PerfMark=class{constructor(t){this._name="";t&&this.start(t)}start(t){this._name=t;performance.mark(this._name+"-Start")}end(){performance.mark(this._name+"-End");performance.measure(this._name,this._name+"-Start",this._name+"-End")}next(t){this.end();this._name=t;performance.mark(this._name+"-Start")}}}
  {"use strict";const e=self.C3,a=2*Math.PI,b=Math.PI/180,d=180/Math.PI;e.wrap=function(h,g,l){h=Math.floor(h);g=Math.floor(g);l=Math.floor(l);return h<g?(h=l-(g-h)%(l-g),h===l?0:h):g+(h-g)%(l-g)};e.mapToRange=function(h,g,l,m,u){return(h-g)*(u-m)/(l-g)+m};e.normalize=function(h,g,l){return(h-g)/(l-g)};e.clamp=function(h,g,l){return h<g?g:h>l?l:h};e.clampAngle=function(h){h%=a;0>h&&(h+=a);return h};e.toRadians=function(h){return h*b};e.toDegrees=function(h){return h*d};e.distanceTo=function(h,g,l,m){return Math.hypot(l-
  h,m-g)};e.distanceSquared=function(h,g,l,m){h=l-h;g=m-g;return h*h+g*g};e.angleTo=function(h,g,l,m){return Math.atan2(m-g,l-h)};e.angleDiff=function(h,g){if(h===g)return 0;h=Math.sin(h)*Math.sin(g)+Math.cos(h)*Math.cos(g);return 1<=h?0:-1>=h?Math.PI:Math.acos(h)};e.angleRotate=function(h,g,l){let m=Math.sin(h),u=Math.cos(h),x=Math.sin(g),n=Math.cos(g);return Math.acos(m*x+u*n)>l?0<u*x-m*n?e.clampAngle(h+l):e.clampAngle(h-l):e.clampAngle(g)};e.angleClockwise=function(h,g){return 0>=Math.cos(h)*Math.sin(g)-
  Math.sin(h)*Math.cos(g)};e.angleLerp=function(h,g,l,m=0){let u=e.angleDiff(h,g);m*=a;return e.angleClockwise(g,h)?e.clampAngle(h+(u+m)*l):e.clampAngle(h-(u+m)*l)};e.angleLerpClockwise=function(h,g,l,m=0){const u=e.angleDiff(h,g);m*=a;return e.angleClockwise(g,h)?e.clampAngle(h+(u+m)*l):e.clampAngle((a-u+m)*l)};e.angleLerpAntiClockwise=function(h,g,l,m=0){const u=e.angleDiff(h,g);m*=a;return e.angleClockwise(g,h)?e.clampAngle((-a+u-m)*l):e.clampAngle(h-(u+m)*l)};e.lerp=function(h,g,l){return h+l*(g-
  h)};e.unlerp=function(h,g,l){return h===g?0:(l-h)/(g-h)};e.relerp=function(h,g,l,m,u){return e.lerp(m,u,e.unlerp(h,g,l))};e.qarp=function(h,g,l,m){return e.lerp(e.lerp(h,g,m),e.lerp(g,l,m),m)};e.cubic=function(h,g,l,m,u){return e.lerp(e.qarp(h,g,l,u),e.qarp(g,l,m,u),u)};e.cosp=function(h,g,l){return(h+g+(h-g)*Math.cos(l*Math.PI))/2};e.isPOT=function(h){return 0<h&&0===(h-1&h)};e.nextHighestPowerOfTwo=function(h){--h;for(let g=1;32>g;g<<=1)h|=h>>g;return h+1};e.roundToNearestFraction=function(h,g){return Math.round(h*g)/g};e.floorToNearestFraction=function(h,g){return Math.floor(h*g)/g};e.round6dp=function(h){return Math.round(1E6*h)/1E6};e.toFixed=function(h,g){h=h.toFixed(g);for(g=h.length-1;0<=g&&"0"===h.charAt(g);--g);0<=g&&"."===h.charAt(g)&&--g;return 0>g?h:h.substr(0,g+1)};e.PackRGB=function(h,g,l){return e.clamp(h,0,255)|e.clamp(g,0,255)<<8|e.clamp(l,0,255)<<16};e.PackRGBAEx=function(h,g,l,m){h=e.clamp(Math.floor(1024*h),-8192,8191);g=e.clamp(Math.floor(1024*g),-8192,8191);l=e.clamp(Math.floor(1024*l),-8192,8191);m=e.clamp(Math.floor(1023*m),0,1023);0>h&&(h+=16384);0>g&&(g+=16384);0>l&&(l+=16384);return-(274877906944*h+16777216*g+1024*l+m)};e.PackRGBEx=function(h,g,l){return e.PackRGBAEx(h,g,l,1)};function c(h){return 0===h&&0>1/h}e.GetRValue=function(h){if(0<=h)return(h&255)/255;h=Math.floor(-h/274877906944);8191<h&&(h-=16384);return h/1024};e.GetGValue=function(h){if(0<=h)return((h&65280)>>8)/255;h=Math.floor(-h%274877906944/16777216);8191<h&&(h-=16384);return h/1024};e.GetBValue=function(h){if(0<=h)return((h&16711680)>>16)/255;h=Math.floor(-h%16777216/1024);8191<h&&(h-=16384);return h/1024};e.GetAValue=function(h){return c(h)?0:0<=h?1:Math.floor(-h%1024)/1023};e.greatestCommonDivisor=function(h,g){h=Math.floor(h);for(g=Math.floor(g);0!==g;){let l=g;g=h%g;h=l}return h};const f=[[3,2],[4,3],[5,4],[5,3],[6,5],[14,9],[16,9],[16,10],[21,9]];e.getAspectRatio=function(h,g){h=Math.floor(h);g=Math.floor(g);if(h===g)return[1,1];for(var l of f){let m=h/l[0]*l[1];if(1>Math.abs(g-m))return l.slice(0);m=h/l[1]*l[0];if(1>Math.abs(g-m))return[l[1],l[0]]}l=e.greatestCommonDivisor(h,g);return[h/l,g/l]};e.segmentsIntersect=function(h,g,l,m,u,x,n,q){var t=Math.min(h,l),r=Math.max(u,n);if(Math.max(h,l)<Math.min(u,n)||t>r)return!1;t=Math.min(g,m);r=Math.max(x,q);if(Math.max(g,m)<Math.min(x,q)||t>r)return!1;t=u-h+n-l;r=x-g+q-m;h=l-h;g=m-g;u=n-u;x=q-x;q=Math.abs(g*u-x*h);return Math.abs(u*r-x*t)>q?!1:Math.abs(h*r-g*t)<=q};e.segmentsIntersectPreCalc=function(h,g,l,m,u,x,n,q,t,r,w,y){const B=Math.max(t,w);if(x<Math.min(t,w)||u>B)return!1;u=Math.max(r,y);if(q<Math.min(r,y)||n>u)return!1;n=t-h+w-l;q=r-g+y-m;h=l-h;g=m-g;t=w-t;r=y-r;y=Math.abs(g*t-r*h);return Math.abs(t*q-r*n)>y?!1:Math.abs(h*q-g*n)<=y};e.segmentIntersectsQuad=function(h,g,l,m,u){const x=Math.min(h,l),n=Math.max(h,l),q=Math.min(g,m),t=Math.max(g,m),r=u.getTlx(),w=u.getTly(),y=u.getTrx(),B=u.getTry(),E=u.getBrx(),H=u.getBry(),K=u.getBlx();u=u.getBly();return e.segmentsIntersectPreCalc(h,g,l,m,x,n,q,t,r,w,y,B)||e.segmentsIntersectPreCalc(h,g,l,m,x,n,q,t,y,B,E,H)||e.segmentsIntersectPreCalc(h,g,l,m,x,n,q,t,E,H,K,u)||e.segmentsIntersectPreCalc(h,g,l,m,x,n,q,t,K,u,r,w)};e.segmentIntersectsAnyN=function(h,g,l,m,u){const x=Math.min(h,l),n=Math.max(h,l),q=Math.min(g,m),t=Math.max(g,m);let r=0;for(let w=u.length-4;r<=w;r+=2)if(e.segmentsIntersectPreCalc(h,g,l,m,x,n,q,t,u[r],u[r+1],u[r+2],u[r+3]))return!0;return e.segmentsIntersectPreCalc(h,g,l,m,x,n,q,t,u[r],u[r+1],u[0],u[1])};e.rayIntersect=function(h,g,l,m,u,x,n,q){l-=h;x=q-x;const t=l*x-(m-g)*(n-u);if(0===t)return 2;m=((g-m)*(n-h)+l*(q-g))/t;return 0<m&&1.000001>m?(x*(n-h)+(u-n)*(q-g))/t:2};e.rayIntersectExtended=function(h,g,l,m,u,x,n,q,t){const r=(n-u)*t;t*=q-x;return e.rayIntersect(h,g,l,m,u-r,x-t,n+r,q+t)};e.isPointInTriangleInclusive=function(h,g,l,m,u,x,n,q){u-=l;x-=m;n-=l;q-=m;h-=l;l=g-m;g=u*u+x*x;m=u*n+x*q;u=u*h+x*l;x=n*n+q*q;n=n*h+q*l;q=1/(g*x-m*m);x=(x*u-m*n)*q;u=(g*n-m*u)*q;return 0<=x&&0<=u&&1>=x+u};e.triangleCartesianToBarycentric=function(h,g,l,m,u,x,n,q){u-=l;x-=m;n-=l;q-=m;h-=l;const t=g-m;g=u*u+x*x;m=u*n+x*q;l=n*n+q*q;u=h*u+t*x;x=h*n+t*q;n=g*l-m*m;q=(l*u-m*x)/n;u=(g*x-m*u)/n;return[1-q-u,q,u]};e.triangleBarycentricToCartesian=function(h,g,l,m,u,x,n,q,t){return[h*m+g*x+l*q,h*u+g*n+l*t]}}
  {"use strict";const e=self.C3;let a=null,b="";if("undefined"!==typeof document){a=document;const l=document.querySelector("base");if(b=l&&l.hasAttribute("href")?l.getAttribute("href"):"")b.startsWith("/")&&(b=b.substr(1)),b.endsWith("/")||(b+="/")}e.GetBaseHref=function(){return b};e.GetBaseURL=function(){if(!a)return"";const l=a.location;return e.GetPathFromURL(l.origin+l.pathname)+b};e.GetPathFromURL=function(l){if(!l.length||l.endsWith("/")||l.endsWith("\\"))return l;const m=Math.max(l.lastIndexOf("/"),l.lastIndexOf("\\"));return-1===m?"":l.substr(0,m+1)};e.GetFilenameFromURL=function(l){if(!l.length)return l;if(l.endsWith("/")||l.endsWith("\\"))return"";const m=Math.max(l.lastIndexOf("/"),l.lastIndexOf("\\"));return-1===m?l:l.substr(m+1)};e.GetFileExtension=function(l){let m=l.lastIndexOf(".");return 1>m?"":l.substr(m)};e.GetFileNamePart=function(l){let m=l.lastIndexOf(".");return 1>m?l:l.substr(0,m)};e.NormalizeFileSeparator=function(l){return l.replace(/\\/g,"/")};e.IsFileExtension=function(l,m){l=l?e.GetFileExtension(l).slice(1):"";return m===l};e.FileNameEquals=function(l,m){let u,x;e.IsFileLike(l)&&(u=e.GetFileNamePart(l.name));e.IsString(l)&&(u=e.GetFileNamePart(l));e.IsFileLike(m)&&(x=e.GetFileNamePart(m.name));e.IsString(m)&&(x=e.GetFileNamePart(m));return u===x};e.ParseFilePath=function(l){l=e.NormalizeFileSeparator(l);let m=/^\w:\//.exec(l);m?(m=m[0],l=l.slice(3),"/"!==l[0]&&(l="/"+l)):m="";l=l.replace(/\/{2,}/g,"/");1<l.length&&"/"===l.slice(-1)&&(l=l.slice(0,-1));var u=l.lastIndexOf("/")+
  1;let x="",n=l,q="";0<u&&(x=l.slice(0,u),n=l.slice(u));l=n;u=n.lastIndexOf(".");0<u&&(q=n.slice(u),l=n.slice(0,-q.length));return{dir:x,base:n,name:l,root:m,ext:q,full:m+x+n}};e.Wait=function(l,m){return new Promise((u,x)=>{self.setTimeout(u,l,m)})};e.swallowException=function(l){try{l()}catch(m){e.isDebug&&console.warn("Swallowed exception: ",m)}};e.noop=function(){};e.equalsNoCase=function(l,m){return"string"!==typeof l||"string"!==typeof m?!1:l===m||l.normalize().toLowerCase()===m.normalize().toLowerCase()};e.equalsCase=function(l,m){return"string"!==typeof l||"string"!==typeof m?!1:l===m?!0:l.normalize()===m.normalize()};e.typedArraySet16=function(l,m,u){l[u++]=m[0];l[u++]=m[1];l[u++]=m[2];l[u++]=m[3];l[u++]=m[4];l[u++]=m[5];l[u++]=m[6];l[u++]=m[7];l[u++]=m[8];l[u++]=m[9];l[u++]=m[10];l[u++]=m[11];l[u++]=m[12];l[u++]=m[13];l[u++]=m[14];l[u]=m[15]};e.truncateArray=function(l,m){l.length=m};e.clearArray=function(l){l&&0!==l.length&&e.truncateArray(l,0)};e.clear2DArray=function(l){if(l){for(let m=0;m<l.length;m++)e.truncateArray(l[m],0);e.truncateArray(l,0)}};e.extendArray=function(l,m,u){m|=0;var x=l.length;if(!(m<=x))for(;x<m;++x)l.push(u)};e.resizeArray=function(l,m,u){m|=0;const x=l.length;m<x?e.truncateArray(l,m):m>x&&e.extendArray(l,m,u)};e.shallowAssignArray=function(l,m){e.clearArray(l);e.appendArray(l,m)};e.appendArray=function(l,m){if(1E4>m.length)l.push(...m);else for(let u=0,x=m.length;u<x;++u)l.push(m[u])};e.arrayRemove=function(l,m){m=Math.floor(m);if(!(0>m||m>=l.length)){for(var u=l.length-1;m<u;++m)l[m]=l[m+1];e.truncateArray(l,u)}};e.arrayFindRemove=function(l,m){m=l.indexOf(m);0<=m&&l.splice(m,1)};e.arraysEqual=function(l,m){let u=l.length;if(m.length!==u)return!1;for(let x=0;x<u;++x)if(l[x]!==m[x])return!1;return!0};e.arrayFilterOut=function(l,m){let u=[],x=0;for(let n=0,q=l.length;n<q;++n){let t=l[n];m(t)?u.push(t):(l[x]=t,++x)}e.truncateArray(l,x);return u};e.arrayRemoveAllInSet=function(l,m){const u=l.length;let x=0;for(let n=0,q=l.length;n<q;++n){let t=l[n];m.has(t)||(l[x++]=t)}e.truncateArray(l,x);return u-x};e.isArrayIndexInBounds=function(l,m){return l!==Math.floor(l)?!1:0<=l&&l<m.length};e.validateArrayIndex=function(l,m){if(!e.isArrayIndexInBounds(l,m))throw new RangeError("array index out of bounds");};e.cloneArray=function(l){return l.slice()};e.deepCloneArray=function(l,m){let u=[];for(let x of l)if(e.IsObject(x)){l=m(x);if(!l)throw Error("missing clone");if(l.constructor!==x.constructor)throw Error("object is not a clone");u.push(l)}else e.IsArray(x)?u.push(e.deepCloneArray(x,m)):u.push(x);return u};e.clone2DArray=function(l){let m=[];for(let u of l)m.push(u.slice());return m};e.mergeSets=function(l,m){return new Set([...l,...m])};e.mergeSetsInPlace=function(l,m){for(const u of m)l.add(u);return l};e.first=function(l){for(let m of l)return m;return null};e.xor=function(l,m){return!l!==!m};e.compare=function(l,m,u){switch(m){case 0:return l===u;case 1:return l!==u;case 2:return l<u;case 3:return l<=u;case 4:return l>u;case 5:return l>=u;default:return!1}};e.hasAnyOwnProperty=function(l){for(let m in l)if(l.hasOwnProperty(m))return!0;return!1};e.PromiseAllWithProgress=function(l,m){return l.length?new Promise((u,x)=>{const n=[];let q=0,t=!1;for(let r=0,w=l.length;r<w;++r)n.push(void 0),l[r].then(y=>{t||(n[r]=y,++q,q===l.length?u(n):m(q,l.length))}).catch(y=>{t=!0;x(y)})}):Promise.resolve([])};let d=[];e.AddLibraryMemoryCallback=function(l){d.push(l)};e.GetEstimatedLibraryMemoryUsage=function(){let l=0;for(let m of d){let u=m();l+=u}return Math.floor(l)};let c=1;const f=new Map,h=new MessageChannel;h.port2.onmessage=function(l){l=l.data;const m=f.get(l);f.delete(l);m&&m(performance.now())};e.RequestUnlimitedAnimationFrame=function(l){const m=c++;f.set(m,l);h.port1.postMessage(m);return m};e.CancelUnlimitedAnimationFrame=function(l){f.delete(l)};e.PostTask=e.RequestUnlimitedAnimationFrame;e.WaitForNextTask=function(){return new Promise(l=>e.PostTask(l))};const g=new Set;e.RequestPostAnimationFrame=function(l){const m=self.requestAnimationFrame(async u=>{await e.WaitForNextTask();g.has(m)&&(g.delete(m),l(u))});g.add(m);return m};e.CancelPostAnimationFrame=function(l){g.has(l)&&(self.cancelAnimationFrame(l),g.delete(l))}}
  {"use strict";const e=self.C3;e.IsAbsoluteURL=function(a){return/^(?:[a-z\-]+:)?\/\//.test(a)||"data:"===a.substr(0,5)||"blob:"===a.substr(0,5)};e.IsRelativeURL=function(a){return!e.IsAbsoluteURL(a)};e.ThrowIfNotOk=function(a){if(!a.ok)throw Error(`fetch '${a.url}' response returned ${a.status} ${a.statusText}`);};e.FetchOk=function(a,b){return fetch(a,b).then(d=>{e.ThrowIfNotOk(d);return d})};e.FetchText=function(a){return e.FetchOk(a).then(b=>b.text())};e.FetchJson=function(a){return e.FetchOk(a).then(b=>b.json())};e.FetchBlob=function(a){return e.FetchOk(a).then(b=>b.blob())};e.FetchArrayBuffer=function(a){return e.FetchOk(a).then(b=>b.arrayBuffer())};e.FetchImage=function(a){return new Promise((b,d)=>{const c=new Image;c.onload=()=>b(c);c.onerror=f=>d(f);c.src=a})};e.BlobToArrayBuffer=function(a){return"function"===typeof a.arrayBuffer?a.arrayBuffer():new Promise((b,d)=>{const c=new FileReader;c.onload=()=>b(c.result);c.onerror=()=>d(c.error);c.readAsArrayBuffer(a)})};e.BlobToString=function(a){return"function"===typeof a.text?a.text():new Promise((b,d)=>{const c=new FileReader;c.onload=()=>b(c.result);c.onerror=()=>d(c.error);c.readAsText(a)})};e.BlobToJson=function(a){return e.BlobToString(a).then(b=>JSON.parse(b))};e.BlobToImage=async function(a,b){a=URL.createObjectURL(a);try{const d=await e.FetchImage(a);URL.revokeObjectURL(a);a="";b&&"function"===typeof d.decode&&await d.decode();return d}finally{a&&URL.revokeObjectURL(a)}};e.CreateCanvas=function(a,b){if("undefined"!==typeof document&&"function"===typeof document.createElement){const d=document.createElement("canvas");d.width=a;d.height=b;return d}return new OffscreenCanvas(a,b)};e.CanvasToBlob=function(a,b,d){"number"!==typeof d&&(d=1);b=b||"image/png";d=e.clamp(d,0,1);return a.toBlob?new Promise(c=>a.toBlob(c,b,d)):a.convertToBlob?a.convertToBlob({type:b,quality:d}):e.Asyncify(()=>e.CanvasToBlobSync(a,b,d))};e.CanvasToBlobSync=function(a,b,d){"number"!==typeof d&&(d=1);b=b||"image/png";d=e.clamp(d,0,1);return e.DataURIToBinaryBlobSync(a.toDataURL(b,d))};e.DataURIToBinaryBlobSync=function(a){a=e.ParseDataURI(a);return e.BinaryStringToBlob(a.data,a.mime_type)};e.ParseDataURI=function(a){if("data:"!==a.substr(0,5))throw new URIError("expected data: uri");var b=a.indexOf(",");if(0>b)throw new URIError("expected comma in data: uri");var d=a.substring(5,b);a=a.substring(b+1);b=d.split(";");d=b[0]||"";let c=b[2];a="base64"===b[1]||"base64"===c?atob(a):decodeURIComponent(a);return{mime_type:d,data:a}};e.BinaryStringToBlob=function(a,b){var d=a.length;let c=d>>2,f=new Uint8Array(d),h=new Uint32Array(f.buffer,0,c),g,l;for(l=g=0;g<c;++g)h[g]=a.charCodeAt(l++)|a.charCodeAt(l++)<<8|a.charCodeAt(l++)<<16|a.charCodeAt(l++)<<24;for(d&=3;d--;)f[l]=a.charCodeAt(l),++l;return b?new Blob([f],{type:b}):new Blob([f])};e.DrawableToBlob=function(a,b,d){const c=e.CreateCanvas(a.width,a.height);c.getContext("2d").drawImage(a,0,0);return e.CanvasToBlob(c,b,d)};e.ImageDataToBlobSync=function(a,b,d){const c=e.CreateCanvas(a.width,a.height);c.getContext("2d").putImageData(a,0,0);return e.CanvasToBlobSync(c,b,d)};e.ImageDataToBlob=function(a,b,d){if(e.Supports.ImageBitmapOptions)return createImageBitmap(a,{premultiplyAlpha:"none"}).then(c=>e.DrawableToBlob(c,b,d));if(e.Supports.ImageBitmap)return createImageBitmap(a).then(c=>e.DrawableToBlob(c,b,d));{const c=e.CreateCanvas(a.width,a.height);c.getContext("2d").putImageData(a,0,0);return e.CanvasToBlob(c,b,d)}};e.CopySet=function(a,b){a.clear();for(const d of b)a.add(d)};e.MapToObject=function(a){const b=Object.create(null);for(const[d,c]of a.entries())b[d]=c;return b};e.ObjectToMap=function(a,b){b.clear();for(const[d,c]of Object.entries(a))b.set(d,c)};e.ToSuperJSON=function d(b){if("object"===typeof b&&null!==b){if(b instanceof Set)return{_c3type_:"set",data:[...b].map(c=>d(c))};if(b instanceof Map)return{_c3type_:"map",data:[...b].map(c=>[c[0],d(c[1])])};{const c=Object.create(null);for(const[f,h]of Object.entries(b))c[f]=d(h);return c}}return b};e.FromSuperJSON=function c(d){if("object"===typeof d&null!==d){if("set"===d._c3type_)return new Set(d.data.map(f=>c(f)));if("map"===d._c3type_)return new Map(d.data.map(f=>[f[0],c(f[1])]));{const f=Object.create(null);for(const[h,g]of Object.entries(d))f[h]=c(g);return f}}return d};e.CSSToCamelCase=function(d){let c="",f=!1;for(const h of d)"-"===h?f=!0:f?(c+=h.toUpperCase(),f=!1):c+=h;return c};e.IsIterator=function(d){return"object"===typeof d&&"function"===typeof d.next};e.MakeFilledArray=function(d,c){const f=[];if("function"===typeof c)for(var h=0;h<d;++h)f.push(c());else for(h=0;h<d;++h)f.push(c);return f}}
  {"use strict";const e=self.C3,a=/([0-9.]+),([0-9.]+)%?,([0-9.]+)%?/i,b=/([0-9.]+),([0-9.]+)%?,([0-9.]+)%?,([0-9.])/i;function d(f){return 0===f.length?"00":1===f.length?"0"+f:f}function c(f,h,g){0>g&&(g+=1);1<g&&--g;return g<1/6?f+6*(h-f)*g:.5>g?h:g<2/3?f+(h-f)*(2/3-g)*6:f}e.Color=class{constructor(f,h,g,l){this._a=this._b=this._g=this._r=0;f instanceof e.Color?this.set(f):this.setRgba(f||0,h||0,g||0,l||0)}setRgb(f,h,g){this._r=+f;this._g=+h;this._b=+g;this.clamp();return this}setRgba(f,h,g,l){this._r=+f;this._g=+h;this._b=+g;this._a=+l;this.clamp();return this}set(f){this._r=f._r;this._g=f._g;this._b=f._b;this._a=f._a;return this}copy(f){return this.set(f)}add(f){this._r+=f._r;this._g+=f._g;this._b+=f._b;this._a+=f._a;this.clamp()}addRgb(f,h,g,l=0){this._r+=+f;this._g+=+h;this._b+=+g;this._a+=+l;this.clamp()}diff(f){this.setR(Math.max(this._r,f._r)-Math.min(this._r,f._r));this.setG(Math.max(this._g,f._g)-Math.min(this._g,f._g));this.setB(Math.max(this._b,f._b)-Math.min(this._b,f._b));this.setA(Math.max(this._a,f._a)-Math.min(this._a,f._a));this.clamp()}copyRgb(f){this._r=f._r;this._g=f._g;this._b=f._b}setR(f){this._r=e.clamp(+f,0,1)}getR(){return this._r}setG(f){this._g=e.clamp(+f,0,1)}getG(){return this._g}setB(f){this._b=e.clamp(+f,0,1)}getB(){return this._b}setA(f){this._a=e.clamp(+f,0,1)}getA(){return this._a}clone(){return e.New(e.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(f,h){f[h++]=this._r;f[h++]=this._g;f[h++]=this._b;f[h]=this._a}equals(f){return this._r===f._r&&this._g===f._g&&this._b===f._b&&this._a===f._a}equalsIgnoringAlpha(f){return this._r===f._r&&this._g===f._g&&this._b===f._b}equalsRgb(f,h,g){return this._r===f&&this._g===h&&this._b===g}equalsRgba(f,h,g,l){return this._r===f&&this._g===h&&this._b===g&&this._a===l}multiply(f){this._r*=f._r;this._g*=f._g;this._b*=f._b;this._a*=f._a}multiplyAlpha(f){this._r*=f;this._g*=f;this._b*=f;this._a*=f}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=e.clamp(this._r,0,1);this._g=e.clamp(this._g,0,1);this._b=e.clamp(this._b,0,1);this._a=e.clamp(this._a,0,1);return this}setFromRgbValue(f){this._r=e.GetRValue(f);this._g=e.GetGValue(f);this._b=e.GetBValue(f);this._a=e.GetAValue(f)}getCssRgb(f,h,g){f=e.IsFiniteNumber(f)?f:this.getR();h=e.IsFiniteNumber(h)?h:this.getG();g=e.IsFiniteNumber(g)?g:this.getB();return`rgb(${100*f}%, ${100*h}%, ${100*g}%)`}getCssRgba(f,h,g,l){f=e.IsFiniteNumber(f)?f:this.getR();h=e.IsFiniteNumber(h)?h:this.getG();g=e.IsFiniteNumber(g)?g:this.getB();l=e.IsFiniteNumber(l)?l:this.getA();return`rgba(${100*f}%, ${100*h}%, ${100*g}%, ${l})`}toHexString(){const f=Math.round(255*this.getR()),h=Math.round(255*this.getG()),g=Math.round(255*this.getB());return"#"+d(f.toString(16))+d(h.toString(16))+d(g.toString(16))}parseHexString(f){if("string"!==typeof f)return!1;f=f.trim();"#"===f.charAt(0)&&(f=f.substr(1));let h,g;if(3===f.length)h=parseInt(f[0],16)/15,g=parseInt(f[1],16)/15,f=parseInt(f[2],16)/15;else if(6===f.length)h=parseInt(f.substr(0,2),16)/255,g=parseInt(f.substr(2,2),16)/255,f=parseInt(f.substr(4,2),16)/255;else return!1;isFinite(h)&&this.setR(h);isFinite(g)&&this.setG(g);isFinite(f)&&this.setB(f);this.setA(1);return!0}toCommaSeparatedRgb(){const f=Math.round(255*this.getR()),h=Math.round(255*this.getG()),g=Math.round(255*this.getB());return`${f}, ${h}, ${g}`}toRgbArray(){const f=Math.round(255*this.getR()),h=Math.round(255*this.getG()),g=Math.round(255*this.getB());return[f,h,g]}parseCommaSeparatedRgb(f){if("string"!==typeof f)return!1;f=f.replace(/^rgb\(|\)|%/,"");var h=f.split(",");if(3>h.length)return!1;f=parseInt(h[0].trim(),10)/255;const g=parseInt(h[1].trim(),10)/255;h=parseInt(h[2].trim(),10)/255;isFinite(f)&&this.setR(f);isFinite(g)&&this.setG(g);isFinite(h)&&this.setB(h);this.setA(1);return!0}parseCommaSeparatedPercentageRgb(f){if("string"!==typeof f)return!1;f=f.replace(/^rgb\(|\)|%/,"");var h=f.split(",");if(3>h.length)return!1;f=parseInt(h[0].trim(),10)/100;const g=parseInt(h[1].trim(),10)/100;h=parseInt(h[2].trim(),10)/100;isFinite(f)&&this.setR(f);isFinite(g)&&this.setG(g);isFinite(h)&&this.setB(h);this.setA(1);return!0}parseCommaSeparatedRgba(f){if("string"!==typeof f)return!1;f=f.replace(/^rgba\(|\)|%/,"");var h=f.split(",");if(4>h.length)return!1;f=parseInt(h[0].trim(),10)/255;const g=parseInt(h[1].trim(),10)/255,l=parseInt(h[2].trim(),10)/255;h=parseFloat(h[3].trim());isFinite(f)&&this.setR(f);isFinite(g)&&this.setG(g);isFinite(l)&&this.setB(l);isFinite(h)&&this.setA(h);return!0}parseCommaSeparatedPercentageRgba(f){if("string"!==typeof f)return!1;f=f.replace(/^rgba\(|\)|%/,"");var h=f.split(",");if(4>h.length)return!1;f=parseInt(h[0].trim(),10)/100;const g=parseInt(h[1].trim(),10)/100,l=parseInt(h[2].trim(),10)/100;h=parseFloat(h[3].trim());isFinite(f)&&this.setR(f);isFinite(g)&&this.setG(g);isFinite(l)&&this.setB(l);isFinite(h)&&this.setA(h);return!0}parseString(f){if("string"!==typeof f)return!1;f=f.replace(/\s+/,"");if(f.includes(",")){if(f.startsWith("rgb("))return f.includes("%")?this.parseCommaSeparatedPercentageRgb(f):this.parseCommaSeparatedRgb(f);if(f.startsWith("rgba("))return f.includes("%")?this.parseCommaSeparatedPercentageRgba(f):this.parseCommaSeparatedRgba(f);if(f.startsWith("hsl(")||f.startsWith("hsla("))return this.parseHSLString(f);{const h=f.split(",");if(f.includes("%")){if(3===h.length)return this.parseCommaSeparatedPercentageRgb(f);if(4===h.length)return this.parseCommaSeparatedPercentageRgba(f)}else{if(3===h.length)return this.parseCommaSeparatedRgb(f);if(4===h.length)return this.parseCommaSeparatedRgba(f)}return!1}}return this.parseHexString(f)}toJSON(){return[this._r,this._g,this._b,this._a]}setFromHSLA(f,h,g,l){f%=360;h=e.clamp(h,0,100);g=e.clamp(g,0,100);l=e.clamp(l,0,1);f/=360;h/=100;g/=100;if(0===h)g=h=f=g;else{const m=.5>g?g*(1+h):g+h-g*h,u=2*g-m;g=c(u,m,f+1/3);h=c(u,m,f);f=c(u,m,f-1/3)}this.setR(g);this.setG(h);this.setB(f);this.setA(l);return this}parseHSLString(f){var h=f.replace(/ |hsl|hsla|\(|\)|;/gi,"");f=a.exec(h);h=b.exec(h);return f&&4===f.length?(this.setFromHSLA(+f[1],+f[2],+f[3],1),!0):h&&5===h.length?(this.setFromHSLA(+f[1],+f[2],+f[3],+f[4]),!0):!1}toHSLAString(){var f=this._r;const h=this._g,g=this._b,l=this._a,m=e.Color.GetHue(f,h,g),u=e.Color.GetSaturation(f,h,g);f=e.Color.GetLuminosity(f,h,g);return`hsla(${m}, ${u}%, ${f}%, ${l})`}toHSLAArray(){const f=this._r,h=this._g,g=this._b;return[e.Color.GetHue(f,h,g),e.Color.GetSaturation(f,h,g),e.Color.GetLuminosity(f,h,g),this._a]}setFromJSON(f){!Array.isArray(f)||3>f.length||(this._r=f[0],this._g=f[1],this._b=f[2],this._a=4<=f.length?f[3]:1)}set r(f){this.setR(f)}get r(){return this.getR()}set g(f){this.setG(f)}get g(){return this.getG()}set b(f){this.setB(f)}get b(){return this.getB()}set a(f){this.setA(f)}get a(){return this.getA()}setAtIndex(f,h){switch(f){case 0:this.setR(h);break;case 1:this.setG(h);break;case 2:this.setB(h);break;case 3:this.setA(h);break;default:throw new RangeError("invalid color index");}}getAtIndex(f){switch(f){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(f,h){let g;if(Array.isArray(f))g=new e.Color,g.setFromJSON(f);else if(f instanceof e.Color)g=f;else throw Error("unexpected type");if(Array.isArray(h))f=new e.Color,f.setFromJSON(h);else if(h instanceof e.Color)f=h;else throw Error("unexpected type");return g.equals(f)}static DiffChannel(f,h){return e.clamp(Math.max(f,h)-Math.min(f,h),0,1)}static Diff(f,h){const g=new e.Color;g.setR(Math.max(f._r,h._r)-Math.min(f._r,h._r));g.setG(Math.max(f._g,h._g)-Math.min(f._g,h._g));g.setB(Math.max(f._b,h._b)-Math.min(f._b,h._b));g.setA(Math.max(f._a,h._a)-Math.min(f._a,h._a));return g}static DiffNoAlpha(f,h){const g=new e.Color(0,0,0,1);g.setR(Math.max(f._r,h._r)-Math.min(f._r,h._r));g.setG(Math.max(f._g,h._g)-Math.min(f._g,h._g));g.setB(Math.max(f._b,h._b)-
  Math.min(f._b,h._b));return g}static GetHue(f,h,g){const l=Math.max(f,h,g),m=Math.min(f,h,g);if(l===m)return 0;let u=0;switch(l){case f:u=(h-g)/(l-m)+(h<g?6:0);break;case h:u=(g-f)/(l-m)+2;break;case g:u=(f-h)/(l-m)+4}return Math.round(u/6*360)}static GetSaturation(f,h,g){const l=Math.max(f,h,g);f=Math.min(f,h,g);if(l===f)return 0;h=l-f;return Math.round(100*(.5<(l+f)/2?h/(2-l-f):h/(l+f)))}static GetLuminosity(f,h,g){const l=Math.max(f,h,g);return l?Math.round((l+Math.min(f,h,g))/2*100):0}};e.Color.White=Object.freeze(e.New(e.Color,1,1,1,1));e.Color.Black=Object.freeze(e.New(e.Color,0,0,0,1));e.Color.TransparentBlack=Object.freeze(e.New(e.Color,0,0,0,0))}
  {"use strict";const e=self.C3;e.Vector2=class{constructor(a,b){this._y=this._x=0;a instanceof e.Vector2?this.copy(a):this.set(a||0,b||0)}set(a,b){this._x=+a;this._y=+b}copy(a){this._x=a._x;this._y=a._y}equals(a){return this._x===a._x&&this._y===a._y}equalsValues(a,b){return this._x===a&&this._y===b}setX(a){this._x=+a}getX(){return this._x}setY(a){this._y=+a}getY(){return this._y}toArray(){return[this._x,this._y]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(a,b){a[b++]=this._x;a[b]=this._y}offset(a,b){this._x+=+a;this._y+=+b}scale(a,b){this._x*=a;this._y*=b}divide(a,b){this._x/=a;this._y/=b}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 e.angleTo(0,0,this._x,this._y)}lengthSquared(){return this._x*this._x+this._y*this._y}length(){return Math.sqrt(this.lengthSquared())}rotatePrecalc(a,b){const d=this._x*b-this._y*a;this._y=this._y*b+this._x*a;this._x=d}rotate(a){0!==a&&this.rotatePrecalc(Math.sin(a),Math.cos(a))}rotateAbout(a,b,d){0===a||b===this._x&&d===this._y||(this._x-=b,this._y-=d,this.rotatePrecalc(Math.sin(a),Math.cos(a)),this._x+=+b,this._y+=+d)}move(a,b){0!==b&&(this._x+=Math.cos(a)*b,this._y+=Math.sin(a)*b)}normalize(){const a=this.length();0!==a&&1!==a&&(this._x/=a,this._y/=a)}clamp(a,b){this._x=e.clamp(this._x,a,b);this._y=e.clamp(this._y,a,b)}}}
  {"use strict";const e=self.C3;e.Rect=class{constructor(a,b,d,c){this._bottom=this._right=this._top=this._left=0;a instanceof e.Rect?this.copy(a):this.set(a||0,b||0,d||0,c||0)}set(a,b,d,c){this._left=+a;this._top=+b;this._right=+d;this._bottom=+c}setWH(a,b,d,c){a=+a;b=+b;this._left=a;this._top=b;this._right=a+ +d;this._bottom=b+ +c}copy(a){this._left=+a._left;this._top=+a._top;this._right=+a._right;this._bottom=+a._bottom}clone(){return new e.Rect(this._left,this._top,this._right,this._bottom)}static Merge(a,b){const d=new e.Rect;d.setLeft(Math.min(a._left,b._left));d.setTop(Math.min(a._top,b._top));d.setRight(Math.max(a._right,b._right));d.setBottom(Math.max(a._bottom,b._bottom));return d}static FromObject(a){return new e.Rect(a.left,a.top,a.right,a.bottom)}equals(a){return this._left===a._left&&this._top===a._top&&this._right===a._right&&this._bottom===a._bottom}equalsWH(a,b,d,c){return this._left===a&&this._top===b&&this.width()===d&&this.height()===c}setLeft(a){this._left=+a}getLeft(){return this._left}setTop(a){this._top=+a}getTop(){return this._top}setRight(a){this._right=+a}getRight(){return this._right}setBottom(a){this._bottom=+a}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(a,b){a[b++]=this._left;a[b++]=this._top;a[b++]=this._right;a[b]=this._bottom}writeAsQuadToTypedArray(a,b){a[b++]=this._left;a[b++]=this._top;a[b++]=this._right;a[b++]=this._top;a[b++]=this._right;a[b++]=this._bottom;a[b++]=this._left;a[b]=this._bottom}writeAsQuadToTypedArray3D(a,b,d){a[b++]=this._left;a[b++]=this._top;a[b++]=d;a[b++]=this._right;a[b++]=this._top;a[b++]=d;a[b++]=this._right;a[b++]=this._bottom;a[b++]=d;a[b++]=this._left;a[b++]=this._bottom;a[b]=d}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(a,b){a=+a;b=+b;this._left+=a;this._top+=b;this._right+=a;this._bottom+=b}offsetLeft(a){this._left+=+a}offsetTop(a){this._top+=+a}offsetRight(a){this._right+=+a}offsetBottom(a){this._bottom+=+a}toSquare(a){if("x"!==a)throw Error("invalid axis, only 'x' supported");this._bottom=this._top<this._bottom?this._left<this._right?this._top+this.width():this._top-this.width():this._left<this._right?this._top-this.width():this._top+this.width()}inflate(a,b){a=+a;b=+b;this._left-=a;this._top-=b;this._right+=a;this._bottom+=b}deflate(a,b){a=+a;b=+b;this._left+=a;this._top+=b;this._right-=a;this._bottom-=b}multiply(a,b){this._left*=a;this._top*=b;this._right*=a;this._bottom*=b}divide(a,b){this._left/=a;this._top/=b;this._right/=a;this._bottom/=b}mirrorAround(a){this._left=+a-this._left;this._right=+a-this._right}flipAround(a){this._top=+a-this._top;this._bottom=+a-this._bottom}swapLeftRight(){const a=this._left;this._left=this._right;this._right=a}swapTopBottom(){const a=this._top;this._top=this._bottom;this._bottom=a}shuntY(a){const b=this._top;this._top=+a-this._bottom;this._bottom=+a-b}round(){this._left=Math.round(this._left);this._top=Math.round(this._top);this._right=Math.round(this._right);this._bottom=Math.round(this._bottom)}roundInner(){this._left=Math.ceil(this._left);this._top=Math.ceil(this._top);this._right=Math.floor(this._right);this._bottom=Math.floor(this._bottom)}roundOuter(){this._left=Math.floor(this._left);this._top=Math.floor(this._top);this._right=Math.ceil(this._right);this._bottom=Math.ceil(this._bottom)}floor(){this._left=Math.floor(this._left);this._top=Math.floor(this._top);this._right=Math.floor(this._right);this._bottom=Math.floor(this._bottom)}ceil(){this._left=Math.ceil(this._left);this._top=Math.ceil(this._top);this._right=Math.ceil(this._right);this._bottom=Math.ceil(this._bottom)}clamp(a,b,d,c){this._left<a&&(this._left=+a);this._top<b&&(this._top=+b);this._right>d&&(this._right=+d);this._bottom>c&&(this._bottom=+c)}clampFlipped(a,b,d,c){this._left<a&&(this._left=+a);this._top>b&&(this._top=+b);this._right>d&&(this._right=+d);this._bottom<c&&(this._bottom=+c)}normalize(){this._left>this._right&&this.swapLeftRight();this._top>this._bottom&&this.swapTopBottom()}intersectsRect(a){return!(a._right<this._left||a._bottom<this._top||a._left>this._right||a._top>this._bottom)}intersectsRectOffset(a,b,d){return!(a._right+b<this._left||a._bottom+d<this._top||a._left+b>this._right||a._top+d>this._bottom)}containsPoint(a,b){return a>=this._left&&a<=this._right&&b>=this._top&&b<=this._bottom}containsRect(a){return a._left>=this._left&&a._top>=this._top&&a._right<=this._right&&a._bottom<=this._bottom}expandToContain(a){a._left<this._left&&(this._left=+a._left);a._top<this._top&&(this._top=+a._top);a._right>this._right&&(this._right=+a._right);a._bottom>this._bottom&&(this._bottom=+a._bottom)}lerpInto(a){this._left=e.lerp(a._left,a._right,this._left);this._top=e.lerp(a._top,a._bottom,this._top);this._right=e.lerp(a._left,a._right,this._right);this._bottom=e.lerp(a._top,a._bottom,this._bottom)}}}
  {"use strict";const e=self.C3;e.Quad=class{constructor(a,b,d,c,f,h,g,l){this._bly=this._blx=this._bry=this._brx=this._try=this._trx=this._tly=this._tlx=0;a instanceof e.Quad?this.copy(a):this.set(a||0,b||0,d||0,c||0,f||0,h||0,g||0,l||0)}set(a,b,d,c,f,h,g,l){this._tlx=+a;this._tly=+b;this._trx=+d;this._try=+c;this._brx=+f;this._bry=+h;this._blx=+g;this._bly=+l}setRect(a,b,d,c){this.set(a,b,d,b,d,c,a,c)}copy(a){this._tlx=a._tlx;this._tly=a._tly;this._trx=a._trx;this._try=a._try;this._brx=a._brx;this._bry=a._bry;this._blx=a._blx;this._bly=a._bly}equals(a){return this._tlx===a._tlx&&this._tly===a._tly&&this._trx===a._trx&&this._try===a._try&&this._brx===a._brx&&this._bry===a._bry&&this._blx===a._blx&&this._bly===a._bly}setTlx(a){this._tlx=+a}getTlx(){return this._tlx}setTly(a){this._tly=+a}getTly(){return this._tly}setTrx(a){this._trx=+a}getTrx(){return this._trx}setTry(a){this._try=+a}getTry(){return this._try}setBrx(a){this._brx=+a}getBrx(){return this._brx}setBry(a){this._bry=+a}getBry(){return this._bry}setBlx(a){this._blx=+a}getBlx(){return this._blx}setBly(a){this._bly=+a}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(a,b){a[b++]=this._tlx;a[b++]=this._tly;a[b++]=this._trx;a[b++]=this._try;a[b++]=this._brx;a[b++]=this._bry;a[b++]=this._blx;a[b]=this._bly}writeToTypedArray3D(a,b,d){a[b++]=this._tlx;a[b++]=this._tly;a[b++]=d;a[b++]=this._trx;a[b++]=this._try;a[b++]=d;a[b++]=this._brx;a[b++]=this._bry;a[b++]=d;a[b++]=this._blx;a[b++]=this._bly;a[b]=d}offset(a,b){a=+a;b=+b;this._tlx+=a;this._tly+=b;this._trx+=a;this._try+=b;this._brx+=a;this._bry+=b;this._blx+=a;this._bly+=b}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(a){this._tlx=a._left;this._tly=a._top;this._trx=a._right;this._try=a._top;this._brx=a._right;this._bry=a._bottom;this._blx=a._left;this._bly=a._bottom}setFromRotatedRect(a,b){0===b?this.setFromRect(a):this.setFromRotatedRectPrecalc(a,Math.sin(b),Math.cos(b))}setFromRotatedRectPrecalc(a,b,d){const c=a._left*b,f=a._top*b,h=a._right*b;b*=a._bottom;const g=a._left*d,l=a._top*d,m=a._right*d;a=a._bottom*d;this._tlx=g-f;this._tly=l+c;this._trx=m-f;this._try=l+h;this._brx=m-b;this._bry=a+h;this._blx=g-b;this._bly=a+c}getBoundingBox(a){a.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(a,b){var d=this._trx-this._tlx,c=this._try-this._tly;const f=this._brx-this._tlx,h=this._bry-this._tly;a-=this._tlx;b-=this._tly;var g=d*d+c*c;let l=d*f+c*h;c=d*a+c*b;const m=f*f+h*h,u=f*a+h*b;let x=1/(g*m-l*l);d=(m*c-l*u)*x;g=(g*u-l*c)*x;if(0<=d&&0<g&&1>d+g)return!0;d=this._blx-this._tlx;c=this._bly-this._tly;g=d*d+c*c;l=d*f+c*h;c=d*a+c*b;x=1/(g*m-l*l);d=(m*c-l*u)*x;g=(g*u-l*c)*x;return 0<=d&&0<g&&1>d+g}midX(){return(this._tlx+this._trx+this._brx+this._blx)/4}midY(){return(this._tly+this._try+this._bry+this._bly)/4}intersectsSegment(a,b,d,c){return this.containsPoint(a,b)||this.containsPoint(d,c)?!0:e.segmentIntersectsQuad(a,b,d,c,this)}intersectsQuad(a){var b=a.midX(),d=a.midY();if(this.containsPoint(b,d))return!0;b=this.midX();d=this.midY();if(a.containsPoint(b,d))return!0;b=this._tlx;d=this._tly;const c=this._trx,f=this._try,h=this._brx,g=this._bry,l=this._blx,m=this._bly;return e.segmentIntersectsQuad(b,d,c,f,a)||e.segmentIntersectsQuad(c,f,h,g,a)||e.segmentIntersectsQuad(h,g,l,m,a)||e.segmentIntersectsQuad(l,m,b,d,a)}rotatePointsAnticlockwise(){const a=this._tlx,b=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=a;this._bly=b}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(a,b){const d=this._getAtIndex(a);this._setAtIndex(a,this._getAtIndex(b));this._setAtIndex(b,d)}_getAtIndex(a){switch(a){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(a,b){b=+b;switch(a){case 0:this._tlx=b;break;case 1:this._tly=b;break;case 2:this._trx=b;break;case 3:this._try=b;break;case 4:this._brx=b;break;case 5:this._bry=b;break;case 6:this._blx=b;break;case 7:this._bly=b;break;default:throw new RangeError("invalid quad point index");}}}}
  {"use strict";const e=self.C3,a=[0,0,1,0,1,1,0,1],b=e.New(e.Quad);e.CollisionPoly=class extends e.DefendedBase{constructor(d,c=!0){super();d||(d=a);this._ptsArr=Float64Array.from(d);this._bbox=new e.Rect;this._isBboxChanged=!0;this._enabled=c}Release(){}pointsArr(){return this._ptsArr}pointCount(){return this._ptsArr.length/2}setPoints(d){this._ptsArr.length===d.length?this._ptsArr.set(d):this._ptsArr=Float64Array.from(d);this._isBboxChanged=!0}setDefaultPoints(){this.setPoints(a)}copy(d){this.setPoints(d._ptsArr)}setBboxChanged(){this._isBboxChanged=!0}_updateBbox(){if(this._isBboxChanged){var d=this._ptsArr,c=d[0],f=d[1],h=c,g=f;for(let l=0,m=d.length;l<m;l+=2){const u=d[l],x=d[l+1];u<c&&(c=u);u>h&&(h=u);x<f&&(f=x);x>g&&(g=x)}this._bbox.set(c,f,h,g);this._isBboxChanged=!1}}setFromRect(d,c,f){let h=this._ptsArr;8!==h.length&&(this._ptsArr=h=new Float64Array(8));h[0]=d.getLeft()-c;h[1]=d.getTop()-f;h[2]=d.getRight()-c;h[3]=d.getTop()-f;h[4]=d.getRight()-c;h[5]=d.getBottom()-f;h[6]=d.getLeft()-c;h[7]=d.getBottom()-f;this._bbox.copy(d);0===c&&0===f||this._bbox.offset(-c,-f);this._isBboxChanged=!1}setFromQuad(d,c,f){b.copy(d);b.offset(c,f);this.setPoints(b.toArray());this._isBboxChanged=!0}transform(d,c,f){let h=0,g=1;0!==f&&(h=Math.sin(f),g=Math.cos(f));this.transformPrecalc(d,c,h,g)}transformPrecalc(d,c,f,h){const g=this._ptsArr;for(let l=0,m=g.length;l<m;l+=2){const u=l+1,x=g[l]*d,n=g[u]*c;g[l]=x*h-n*f;g[u]=n*h+x*f}this._isBboxChanged=!0}offset(d,c){const f=this._ptsArr;for(let h=0,g=f.length;h<g;h+=2)f[h]+=d,f[h+1]+=c}containsPoint(d,c){const f=this._ptsArr;if(d===f[0]&&c===f[1])return!0;this._updateBbox();var h=this._bbox;const g=h.getLeft()-110,l=h.getTop()-101,m=h.getRight()+131;h=h.getBottom()+120;let u,x,n,q,t,r,w,y;g<d?(u=g,n=d):(u=d,n=g);l<c?(x=l,q=c):(x=c,q=l);m<d?(t=m,w=d):(t=d,w=m);h<c?(r=h,y=c):(r=c,y=h);let B=0,E=0;for(let K=0,C=f.length;K<C;K+=2){var H=(K+2)%C;const A=f[K],F=f[K+1],J=f[H];H=f[H+1];e.segmentsIntersectPreCalc(g,l,d,c,u,n,x,q,A,F,J,H)&&++B;e.segmentsIntersectPreCalc(m,h,d,c,t,w,r,y,A,F,J,H)&&++E}return 1===B%2||1===E%2}intersectsPoly(d,c,f){const h=d._ptsArr,g=this._ptsArr;if(this.containsPoint(h[0]+c,h[1]+f)||d.containsPoint(g[0]-c,g[1]-f))return!0;for(let m=0,u=g.length;m<u;m+=2){var l=(m+2)%u;d=g[m];const x=g[m+1],n=g[l];l=g[l+1];let q,t,r,w;d<n?(q=d,r=n):(q=n,r=d);x<l?(t=x,w=l):(t=l,w=x);for(let y=0,B=h.length;y<B;y+=2){const E=(y+2)%B;if(e.segmentsIntersectPreCalc(d,x,n,l,q,r,t,w,h[y]+c,h[y+1]+f,h[E]+c,h[E+1]+f))return!0}}return!1}intersectsSegment(d,c,f,h,g,l){if(this.containsPoint(f-d,h-c)||this.containsPoint(g-
  d,l-c))return!0;let m,u,x,n;f<g?(m=f,x=g):(m=g,x=f);h<l?(u=h,n=l):(u=l,n=h);const q=this._ptsArr;for(let t=0,r=q.length;t<r;t+=2){const w=(t+2)%r;if(e.segmentsIntersectPreCalc(f,h,g,l,m,x,u,n,q[t]+d,q[t+1]+c,q[w]+d,q[w+1]+c))return!0}return!1}mirror(d){const c=this._ptsArr;for(let f=0,h=c.length;f<h;f+=2)c[f]=2*d-c[f];this._isBboxChanged=!0}flip(d){const c=this._ptsArr;for(let f=0,h=c.length;f<h;f+=2){const g=f+1;c[g]=2*d-c[g]}this._isBboxChanged=!0}diag(){const d=this._ptsArr;for(let c=0,f=d.length;c<f;c+=2){const h=c+1,g=d[c];d[c]=d[h];d[h]=g}this._isBboxChanged=!0}GetMidX(){const d=this._ptsArr;let c=0;for(let f=0,h=d.length;f<h;f+=2)c+=d[f];return c/this.pointCount()}GetMidY(){const d=this._ptsArr;let c=0;for(let f=0,h=d.length;f<h;f+=2)c+=d[f+1];return c/this.pointCount()}GetPointsArray(){return this._ptsArr}GetPointCount(){return this.pointCount()}IsEnabled(){return this._enabled}}}
  {"use strict";const e=self.C3;e.PairMap=class extends e.DefendedBase{constructor(a){super();this._firstMap=new Map;if(a)for(const[b,d,c]of a)this.Set(b,d,c)}Release(){this.Clear();this._firstMap=null}Clear(){const a=this._firstMap;for(const b of a.values())b.clear();a.clear()}Set(a,b,d){const c=this._firstMap;let f=c.get(a);f||(f=new Map,c.set(a,f));f.set(b,d)}Get(a,b){return(a=this._firstMap.get(a))?a.get(b):a}Has(a,b){return(a=this._firstMap.get(a))?a.has(b):!1}Delete(a,b){const d=this._firstMap,c=d.get(a);if(!c)return!1;(b=c.delete(b))&&0===c.size&&d.delete(a);return b}DeleteEither(a){const b=this._firstMap,d=b.get(a);d&&(d.clear(),b.delete(a));for(const[c,f]of b.entries())f.delete(a)&&0===f.size&&b.delete(c)}GetSize(){let a=0;for(const b of this._firstMap.values())a+=b.size;return a}*values(){for(const a of this._firstMap.values())yield*a.values()}*keyPairs(){for(const[a,b]of this._firstMap.entries())for(const d of b.keys())yield[a,d]}*entries(){for(const[a,b]of this._firstMap.entries())for(const[d,c]of b.entries())yield[a,d,c]}}}
  {"use strict";const e=self.C3;e.ArraySet=class extends e.DefendedBase{constructor(){super();this._set=new Set;this._arr=[];this._needToRebuildArray=!1}Release(){this.Clear()}Clear(){this._set.clear();e.clearArray(this._arr);this._needToRebuildArray=!1}Add(a){this._set.has(a)||(this._set.add(a),this._needToRebuildArray||this._arr.push(a))}Has(a){return this._set.has(a)}Delete(a){this._set.delete(a)&&(this._needToRebuildArray=!0)}GetSize(){return this._set.size}IsEmpty(){return 0===this._set.size}GetArray(){this._needToRebuildArray&&(this._RebuildArray(),this._needToRebuildArray=!1);return this._arr}_RebuildArray(){const a=this._arr;e.clearArray(a);for(const b of this._set)a.push(b)}}}
  {"use strict";const e=new Map,a=new Map,b=new Map,d=new Map,c=new Map,f=new Map;f.set("linear","noease");f.set("default","noease");self.Ease=class n{constructor(){}static InheritEase(){return"default"}static DefaultEase(){return"noease"}static GetEditorEaseNames(q,...t){this._CreateEaseMap();b.has(q)||b.set(q,new Map);q=[...b.get(q).keys()];q.sort();return[...a.keys()].concat(q).filter(r=>!t.includes(r))}static GetRuntimeEaseNames(){this._CreateEaseMap();const q=[...d.keys()];q.sort();return[...a.keys()].concat(q)}static IsNamePredefined(q){this._CreateEaseMap();return[...a.keys()].includes(q)}static _GetEase(q){const t=f.get(q);if(t)return e.get(t);if(n.IsNamePredefined(q))return e.get(q);if(c.has(q))return c.get(q)}static GetEditorEase(q,t){this._CreateEaseMap();const r=n._GetEase(q);return r?r:b.get(t).get(q)}static GetRuntimeEase(q){this._CreateEaseMap();const t=n._GetEase(q);return t?t:d.get(q)}static GetEaseFromIndex(q){this._CreateEaseMap();return this.GetRuntimeEaseNames()[q]}static GetIndexForEase(q,t){this._CreateEaseMap();return this.GetEditorEaseNames(t).indexOf(q)}static _CreateEaseMap(){0===e.size&&(this._AddPredifinedEase("default",()=>{}),this._AddPredifinedEase("noease",this.NoEase),this._AddPredifinedEase("easeinsine",this.EaseInSine),this._AddPredifinedEase("easeoutsine",this.EaseOutSine),this._AddPredifinedEase("easeinoutsine",this.EaseInOutSine),this._AddPredifinedEase("easeinelastic",this.EaseInElastic),this._AddPredifinedEase("easeoutelastic",this.EaseOutElastic),this._AddPredifinedEase("easeinoutelastic",this.EaseInOutElastic),this._AddPredifinedEase("easeinback",this.EaseInBack),this._AddPredifinedEase("easeoutback",this.EaseOutBack),this._AddPredifinedEase("easeinoutback",this.EaseInOutBack),this._AddPredifinedEase("easeinbounce",this.EaseInBounce),this._AddPredifinedEase("easeoutbounce",this.EaseOutBounce),this._AddPredifinedEase("easeinoutbounce",this.EaseInOutBounce),this._AddPredifinedEase("easeincubic",this.EaseInCubic),this._AddPredifinedEase("easeoutcubic",this.EaseOutCubic),this._AddPredifinedEase("easeinoutcubic",this.EaseInOutCubic),this._AddPredifinedEase("easeinquad",this.EaseInQuad),this._AddPredifinedEase("easeoutquad",this.EaseOutQuad),this._AddPredifinedEase("easeinoutquad",this.EaseInOutQuad),this._AddPredifinedEase("easeinquart",this.EaseInQuart),this._AddPredifinedEase("easeoutquart",this.EaseOutQuart),this._AddPredifinedEase("easeinoutquart",this.EaseInOutQuart),this._AddPredifinedEase("easeinquint",this.EaseInQuint),this._AddPredifinedEase("easeoutquint",this.EaseOutQuint),this._AddPredifinedEase("easeinoutquint",this.EaseInOutQuint),this._AddPredifinedEase("easeincirc",this.EaseInCirc),this._AddPredifinedEase("easeoutcirc",this.EaseOutCirc),this._AddPredifinedEase("easeinoutcirc",this.EaseInOutCirc),this._AddPredifinedEase("easeinexpo",this.EaseInExpo),this._AddPredifinedEase("easeoutexpo",this.EaseOutExpo),this._AddPredifinedEase("easeinoutexpo",this.EaseInOutExpo),this._AddPrivateCustomEase("cubicbezier",this.EaseCubicBezier),this._AddPrivateCustomEase("spline",this.EaseSpline))}static _AddPredifinedEase(q,t){n._AddEase(q,t,"predefined")}static _AddPrivateCustomEase(q,t){n._AddEase(q,t,"private")}static AddCustomEase(q,t,r){this._CreateEaseMap();n._AddEase(q,t,"custom",r)}static RemoveCustomEase(q,t){this.IsNamePredefined(q)||[...c.keys()].includes(q)||(t=b.get(t))&&t.delete(q)}static _AddEase(q,t,r,w){switch(r){case "predefined":e.set(q,t);a.set(q,t);break;case "custom":w?(b.has(w)||b.set(w,new Map),b.get(w).set(q,t)):d.set(q,t);break;case "private":e.set(q,t);c.set(q,t);break;default:throw Error("unexpected ease mode");}}static NoEase(q,t,r,w){return r*q/w+t}static EaseInQuad(q,t,r,w){return r*(q/=w)*q+t}static EaseOutQuad(q,t,r,w){return-r*(q/=w)*(q-2)+t}static EaseInOutQuad(q,t,r,w){return 1>(q/=w/2)?r/2*q*q+t:-r/2*(--q*(q-2)-1)+t}static EaseInCubic(q,t,r,w){return r*(q/=w)*q*q+t}static EaseOutCubic(q,t,r,w){return r*((q=q/w-1)*q*q+1)+t}static EaseInOutCubic(q,t,r,w){return 1>(q/=w/2)?r/2*q*q*q+t:r/2*((q-=2)*q*q+2)+t}static EaseInQuart(q,t,r,w){return r*(q/=w)*q*q*q+t}static EaseOutQuart(q,t,r,w){return-r*((q=q/w-1)*q*q*q-1)+t}static EaseInOutQuart(q,t,r,w){return 1>(q/=w/2)?r/2*q*q*q*q+t:-r/2*((q-=2)*q*q*q-2)+t}static EaseInQuint(q,t,r,w){return r*(q/=w)*q*q*q*q+t}static EaseOutQuint(q,t,r,w){return r*((q=q/w-1)*q*q*q*q+1)+t}static EaseInOutQuint(q,t,r,w){return 1>(q/=w/2)?r/2*q*q*q*q*q+t:r/2*((q-=2)*q*q*q*q+2)+t}static EaseInSine(q,t,r,w){return-r*Math.cos(q/w*(Math.PI/2))+r+t}static EaseOutSine(q,t,r,w){return r*Math.sin(q/w*(Math.PI/2))+t}static EaseInOutSine(q,t,r,w){return-r/2*(Math.cos(Math.PI*q/w)-1)+t}static EaseInExpo(q,t,r,w){return 0===q?t:r*Math.pow(2,10*(q/w-1))+t}static EaseOutExpo(q,t,r,w){return q===w?t+r:r*(-Math.pow(2,-10*q/w)+1)+t}static EaseInOutExpo(q,t,r,w){return 0===q?t:q===w?t+r:1>(q/=w/2)?r/2*Math.pow(2,10*(q-1))+t:r/2*(-Math.pow(2,-10*--q)+2)+t}static EaseInCirc(q,t,r,w){return-r*(Math.sqrt(1-(q/=w)*q)-1)+t}static EaseOutCirc(q,t,r,w){return r*Math.sqrt(1-(q=q/w-1)*q)+t}static EaseInOutCirc(q,t,r,w){return 1>(q/=w/2)?-r/2*(Math.sqrt(1-q*q)-1)+t:r/2*(Math.sqrt(1-(q-=2)*q)+1)+t}static EaseInElastic(q,t,r,w){let y=0,B=r;if(0===q)return t;if(1===(q/=w))return t+r;y||(y=.3*w);B<Math.abs(r)?(B=r,r=y/4):r=y/(2*Math.PI)*Math.asin(r/B);return-(B*Math.pow(2,10*--q)*Math.sin(2*(q*w-r)*Math.PI/y))+t}static EaseOutElastic(q,t,r,w){let y,B=0,E=r;if(0===q)return t;if(1===(q/=w))return t+r;B||(B=.3*w);E<Math.abs(r)?(E=r,y=B/4):y=B/(2*Math.PI)*Math.asin(r/E);return E*Math.pow(2,-10*q)*Math.sin(2*(q*w-y)*Math.PI/B)+r+t}static EaseInOutElastic(q,t,r,w){let y,B=0,E=r;if(0===q)return t;if(2===(q/=w/2))return t+r;B||(B=.3*w*1.5);E<Math.abs(r)?(E=r,y=B/4):y=B/(2*Math.PI)*Math.asin(r/E);return 1>q?-.5*E*Math.pow(2,10*--q)*Math.sin(2*(q*w-y)*Math.PI/B)+t:E*Math.pow(2,-10*--q)*Math.sin(2*(q*w-y)*Math.PI/B)*.5+r+t}static EaseInBack(q,t,r,w,y){void 0===y&&(y=1.70158);return r*(q/=w)*q*((y+1)*q-y)+t}static EaseOutBack(q,t,r,w,y){void 0===y&&(y=1.70158);return r*((q=q/w-1)*q*((y+1)*q+y)+1)+t}static EaseInOutBack(q,t,r,w,y){void 0===y&&(y=1.70158);return 1>(q/=w/2)?r/2*q*q*(((y*=1.525)+1)*q-y)+t:r/2*((q-=2)*q*(((y*=1.525)+1)*q+y)+2)+t}static EaseInBounce(q,t,r,w){return r-n.EaseOutBounce(w-q,0,r,w)+t}static EaseOutBounce(q,t,r,w){return(q/=w)<1/2.75?7.5625*r*q*q+t:q<2/2.75?r*(7.5625*(q-=1.5/2.75)*q+.75)+t:q<2.5/2.75?r*(7.5625*(q-=2.25/2.75)*q+.9375)+t:r*(7.5625*(q-=2.625/2.75)*q+.984375)+t}static EaseInOutBounce(q,t,r,w){return q<w/2?.5*n.EaseInBounce(2*q,0,r,w)+t:.5*n.EaseOutBounce(2*q-w,0,r,w)+.5*r+t}static EaseCubicBezier(q,t,r,w,y){return t+3*q*(r-t)+3*q**2*(t+w-2*r)+q**3*(y-t+3*r-3*w)}static EaseSpline(q,t,r,w,y,B,E,H,K,C){if(w===y&&B===E)return q;q=x(q,t,w,B,H,C);t=h(r,y,E,K);w=g(r,y,E,K);r=l(r,y,E,K);return m(q,t,w,r)}static GetBezierSamples(q,t,r,w){const y=[],B=h(q,t,r,w),E=g(q,t,r,w);q=l(q,t,r,w);for(t=0;11>t;++t)r=m(.1*t,B,E,q),y.push(r);return y}};const h=(n,q,t,r)=>r-3*t+3*q-n,g=(n,q,t,r)=>3*t-6*q+3*n,l=(n,q,t,r)=>3*(q-n),m=(n,q,t,r)=>((q*n+t)*n+r)*n,u=(n,q,t,r)=>3*q*n*n+2*t*n+r,x=(n,q,t,r,w,y)=>{if(1==n)return 1;for(var B=0,E=1,H=y[E];10!=E&&H<=n;)E++,H=y[E],B+=.1;E--;H=y[E];y=B+(n-H)/(y[E+1]-H)*.1;E=h(q,t,r,w);H=g(q,t,r,w);q=l(q,t,r,w);t=u(y,E,H,q);if(0!==t)if(.02<=t)for(B=0;4>B;++B)t=m(y,E,H,q)-n,r=u(y,E,H,q),y-=t/r;else{t=B;B+=.1;r=0;let K;do y=t+(B-t)/2,w=m(y,E,H,q)-n,0<w?B=y:t=y,w=1E-7<Math.abs(w),K=10>++r;while(w&&K)}return y}}
  {"use strict";const e=self.C3;function a(b){e.IsString(b)}e.ProbabilityTable=class{constructor(){this._items=[];this._totalWeight=0}Release(){this.Clear();this._items=null}Clear(){e.clear2DArray(this._items);this._totalWeight=0}GetTotalWeight(){return this._totalWeight}Sample(b=Math.random()*this.GetTotalWeight()){let d=0;for(const[c,f]of this._items)if(d+=c,b<d)return f;return 0}AddItem(b,d){a(d);this._totalWeight+=b;this._items.push([b,d])}RemoveItem(b,d){a(d);const c=0===b;for(let f=0;f<this._items.length;f++){const h=this._items[f],g=h[1]===d;if((c||h[0]===b)&&g){this._items.splice(f,1);this._totalWeight-=h[0];break}}}asJSON(){return JSON.stringify(this._items)}static fromJSON(b){const d=new e.ProbabilityTable;b=JSON.parse(b);for(const c of b)d.AddItem(c[0],c[1]);return d}}}"use strict";self.C3.Event=class{constructor(e,a){this.type=e;this.cancelable=!!a;this.isAsync=this.propagationStopped=this.defaultPrevented=!1}preventDefault(){if(!this.cancelable)throw Error(`event '${this.type}' is not cancelable`);this.defaultPrevented=!0}stopPropagation(){if(!this.cancelable)throw Error(`event '${this.type}' cannot be stopped`);if(this.isAsync)throw Error(`cannot stop async event '${this.type}' propagation`);this.propagationStopped=!0}};{"use strict";const e=self.C3;e.Event.Handler=class extends e.DefendedBase{constructor(a){super();this._type=a;this._captureListeners=[];this._captureListenersSet=new Set;this._listeners=[];this._listenersSet=new Set;this._fireDepth=0;this._queueModifyListeners=[]}Release(){0<this._fireDepth||(e.clearArray(this._captureListeners),this._captureListenersSet.clear(),e.clearArray(this._listeners),this._listenersSet.clear(),e.clearArray(this._queueModifyListeners),e.Release(this))}_AddListener(a,b){this._IsFiring()?this._queueModifyListeners.push({op:"add",func:a,capture:b}):b?this._captureListenersSet.has(a)||(this._captureListeners.push(a),this._captureListenersSet.add(a)):this._listenersSet.has(a)||(this._listeners.push(a),this._listenersSet.add(a))}_RemoveListener(a,b){this._IsFiring()?this._queueModifyListeners.push({op:"remove",func:a,capture:b}):b?this._captureListenersSet.has(a)&&(this._captureListenersSet.delete(a),e.arrayFindRemove(this._captureListeners,a)):this._listenersSet.has(a)&&(this._listenersSet.delete(a),e.arrayFindRemove(this._listeners,a))}_IsEmpty(){return!this._captureListeners.length&&!this._listeners.length}_IsFiring(){return 0<this._fireDepth}_ProcessQueuedListeners(){const a=new Set,b=new Set;for(const d of this._queueModifyListeners)if("add"===d.op)this._AddListener(d.func,d.capture),d.capture?b.delete(d.func):a.delete(d.func);else if("remove"===d.op)d.capture?(this._captureListenersSet.delete(d.func),b.add(d.func)):(this._listenersSet.delete(d.func),a.add(d.func));else throw Error("invalid op");e.arrayRemoveAllInSet(this._listeners,a);e.arrayRemoveAllInSet(this._captureListeners,b);e.clearArray(this._queueModifyListeners)}_FireCancellable(a){this._IncreaseFireDepth();let b=!1;for(let d=0,c=this._captureListeners.length;d<c;++d)if(this._captureListeners[d](a),a.propagationStopped){b=!0;break}if(!b)for(let d=0,c=this._listeners.length;d<c&&(this._listeners[d](a),!a.propagationStopped);++d);this._DecreaseFireDepth();return!a.defaultPrevented}_FireNonCancellable(a){this._IncreaseFireDepth();for(let b=0,d=this._captureListeners.length;b<d;++b)this._captureListeners[b](a);for(let b=0,d=this._listeners.length;b<d;++b)this._listeners[b](a);this._DecreaseFireDepth();return!0}_IncreaseFireDepth(){this._fireDepth++}_DecreaseFireDepth(){this._fireDepth--;0===this._fireDepth&&0<this._queueModifyListeners.length&&this._ProcessQueuedListeners()}SetDelayRemoveEventsEnabled(a){a?this._IncreaseFireDepth():this._DecreaseFireDepth()}_FireAsync(a){let b=[];for(let d=0,c=this._captureListeners.length;d<c;++d){let f=this._captureListeners[d];b.push(e.Asyncify(()=>f(a)))}for(let d=0,c=this._listeners.length;d<c;++d){let f=this._listeners[d];b.push(e.Asyncify(()=>f(a)))}return Promise.all(b).then(()=>!a.defaultPrevented)}_FireAndWait_AsyncOptional(a){const b=[];this._IncreaseFireDepth();for(let c=0,f=this._captureListeners.length;c<f;++c){var d=this._captureListeners[c](a);d instanceof Promise&&b.push(d)}for(let c=0,f=this._listeners.length;c<f;++c)d=this._listeners[c](a),d instanceof Promise&&b.push(d);this._DecreaseFireDepth();return b.length?Promise.all(b).then(()=>!a.defaultPrevented):!a.defaultPrevented}async _FireAndWaitAsync(a){return await this._FireAndWait_AsyncOptional(a)}async _FireAndWaitAsyncSequential(a){this._IncreaseFireDepth();for(let d=0,c=this._captureListeners.length;d<c;++d){var b=this._captureListeners[d](a);b instanceof Promise&&await b}for(let d=0,c=this._listeners.length;d<c;++d)b=this._listeners[d](a),b instanceof Promise&&await b;this._DecreaseFireDepth();return!a.defaultPrevented}*_FireAsGenerator(a){this._IncreaseFireDepth();for(let d=0,c=this._captureListeners.length;d<c;++d){var b=this._captureListeners[d](a);e.IsIterator(b)&&(yield*b)}for(let d=0,c=this._listeners.length;d<c;++d)b=this._listeners[d](a),e.IsIterator(b)&&(yield*b);this._DecreaseFireDepth()}}}
  {"use strict";const e=self.C3;e.Event.Dispatcher=class extends e.DefendedBase{constructor(){super();this._eventHandlers=new Map;this._dispatcherWasReleased=!1}Release(){if(this._dispatcherWasReleased)throw Error("already released");this.ClearEvents();this._dispatcherWasReleased=!0;e.Release(this)}WasReleased(){return this._dispatcherWasReleased}ClearEvents(){for(let a of this._eventHandlers.values())a.Release();this._eventHandlers.clear()}_GetHandlerByType(a,b){let d=this._eventHandlers.get(a);return d?d:b?(d=e.New(e.Event.Handler,a),this._eventHandlers.set(a,d),d):null}HasAnyHandlerFor(a){return this._eventHandlers.has(a)}addEventListener(a,b,d){this._GetHandlerByType(a,!0)._AddListener(b,!!d)}removeEventListener(a,b,d){let c=this._GetHandlerByType(a,!1);c&&(c._RemoveListener(b,!!d),c._IsEmpty()&&this._eventHandlers.delete(a))}dispatchEvent(a){const b=this._GetHandlerByType(a.type,!1);return b?a.cancelable?b._FireCancellable(a):b._FireNonCancellable(a):!0}dispatchEventAsync(a){const b=this._GetHandlerByType(a.type,!1);if(!b)return Promise.resolve(!0);a.isAsync=!0;return b._FireAsync(a)}async dispatchEventAndClearAsync(a){const b=this._GetHandlerByType(a.type,!1);if(!b)return!0;this._eventHandlers.delete(a.type);a.isAsync=!0;a=await b._FireAsync(a);b.Release();return a}async dispatchEventAndWaitAsync(a){const b=this._GetHandlerByType(a.type,!1);return b?await b._FireAndWaitAsync(a):!0}dispatchEventAndWait_AsyncOptional(a){const b=this._GetHandlerByType(a.type,!1);return b?b._FireAndWait_AsyncOptional(a):!0}async dispatchEventAndWaitAsyncSequential(a){const b=this._GetHandlerByType(a.type,!1);return b?await b._FireAndWaitAsyncSequential(a):!0}dispatchGeneratorEvent(a){const b=this._GetHandlerByType(a.type,!1);if(!b)return null;if(a.cancelable)throw Error("not supported");return b._FireAsGenerator(a)}SetDelayRemoveEventsEnabled(a){for(const b of this._eventHandlers.values())b.SetDelayRemoveEventsEnabled(a)}}}
  {"use strict";const e=self.C3,a="undefined"!==typeof requestIdleCallback;let b=[],d=-1,c=0;function f(m){d=a&&0===c?requestIdleCallback(h,{timeout:35}):setTimeout(h,0<c?1:m)}function h(m){d=-1;if(b.length){var u=performance.now(),x=0;do{g(b.shift());var n=performance.now();++x;var q=(n-u)/x*1.1}while(b.length&&(a&&0===c&&"undefined"!==typeof m?q<m.timeRemaining():12>n-u+q));-1===d&&b.length&&f(Math.max(16-(n-u),4))}}function g(m){let u;try{u=m.func()}catch(x){m.reject(x);return}m.resolve(u)}let l=e.QueryString.Has("disable-asyncify");l&&console.warn("[Asyncify] Asyncify has been disabled due to disable-asyncify in the query string. Some work will now be done synchronously.");e.Asyncify=function(m){let u=null;e.isDebug&&(u=e.GetCallStack());return new Promise((x,n)=>{b.push({func:m,resolve:x,reject:n,stack:u});l?g(b.pop()):-1===d&&f(16)})};e.Asyncify.SetHighThroughputMode=function(m){if(m)++c;else if(--c,0>c)throw Error("already turned off high throughput mode");}}
  {"use strict";const e=self.C3;let a=-1;function b(){a=-1}e.FastGetDateNow=function(){-1===a&&(a=Date.now(),self.setTimeout(b,16));return a};let d=-1,c=-1,f=new Set;function h(){c=d=-1;let g=Date.now();for(let l of f)if(l._CheckTimeout(g)){let m=l._GetDeadline();if(-1===c||m<c)c=m}else f.delete(l);-1!==c&&(d=self.setTimeout(h,Math.max(c-g+100,1E3)))}e.IdleTimeout=class{constructor(g,l){this._callback=g;this._timeout=1E3*l;this._deadline=0;this._isActive=!1}Reset(){let g=e.FastGetDateNow();this._deadline=g+this._timeout;this._isActive||(f.add(this),this._isActive=!0);-1===d?(c=this._deadline,d=self.setTimeout(h,this._timeout+100)):this._deadline<c&&c>g+1E3&&(self.clearTimeout(d),c=this._deadline,d=self.setTimeout(h,this._timeout+100))}_CheckTimeout(g){return g>=this._deadline?this._callback()?(this._deadline=g+this._timeout,!0):this._isActive=!1:!0}_GetDeadline(){return this._deadline}Cancel(){this._isActive&&(f.delete(this),this._isActive=!1,0===f.size&&-1!==d&&(self.clearTimeout(d),c=d=-1))}Release(){this.Cancel();this._callback=null}}}
  {"use strict";const e=self.C3;e.Disposable=class a{constructor(b){this._disposed=!1;this._disposeAction=b}Dispose(){this._disposed||(this._disposed=!0,this._disposeAction&&(this._disposeAction(),this._disposeAction=null))}IsDisposed(){return this._disposed}Release(){this.Dispose()}static Release(b){return new a(()=>b.Release())}static From(b,d,c,f,h){if("undefined"===typeof f||null===f)f=!1;else if("boolean"!==typeof f&&"object"!==typeof f)throw new TypeError("invalid event listener options");h&&(c=c.bind(h));if(d.includes(" ")){d=d.split(" ");h=new e.CompositeDisposable;for(let g of d)b.addEventListener(g,c,f),h.Add(e.New(e.Disposable,()=>b.removeEventListener(g,c,f)));return h}b.addEventListener(d,c,f);return e.New(e.Disposable,()=>b.removeEventListener(d,c,f))}};e.StubDisposable=class extends e.Disposable{SetAction(a){this._disposeAction=a}};e.CompositeDisposable=class extends e.Disposable{constructor(...a){super();this._disposables=new Set;for(let b of a)this.Add(b)}Add(...a){if(this._disposed)throw Error("already disposed");for(let b of a)this._disposables.add(b)}Remove(a){if(this._disposed)throw Error("already disposed");this._disposables.delete(a)}RemoveAll(){if(this._disposed)throw Error("already disposed");if(this._disposables){for(let a of this._disposables)a.Dispose();this._disposables.clear()}}IsDisposed(){return this._disposed}Dispose(){if(this._disposed)throw Error("already disposed");this._disposed=!0;for(let a of this._disposables)a.Dispose();this._disposables.clear();this._disposables=null}Release(){this.Dispose()}}}
  {"use strict";const e=self.C3;e.KahanSum=class extends e.DefendedBase{constructor(){super();this._sum=this._t=this._y=this._c=0}Add(a){this._y=+a-this._c;this._t=this._sum+this._y;this._c=this._t-this._sum-this._y;this._sum=this._t}Subtract(a){this._sum-=+a}Get(){return this._sum}Reset(){this._sum=this._t=this._y=this._c=0}Set(a){this._t=this._y=this._c=0;this._sum=+a}Release(){}}}
  {"use strict";const e=self.C3,a={RBnode:function(b){this.tree=b;this.left=this.right=this.tree.sentinel;this.parent=null;this.color=!1;this.key=null},RedBlackSet:function(b){this.size=0;this.sentinel=new a.RBnode(this);this.sentinel.color=!1;this.root=this.sentinel;this.root.parent=this.sentinel;this.compare=b||this.default_compare}};a.RedBlackSet.prototype.default_compare=function(b,d){return b<d?-1:d<b?1:0};a.RedBlackSet.prototype.clone=function(){var b=new a.RedBlackSet(this.compare);b.insertAll(this);return b};a.RedBlackSet.prototype.clear=function(){this.size=0;this.sentinel=new a.RBnode(this);this.sentinel.color=!1;this.root=this.sentinel;this.root.parent=this.sentinel};a.RedBlackSet.prototype.leftRotate=function(b){var d=b.right;b.right=d.left;d.left!=this.sentinel&&(d.left.parent=b);d.parent=b.parent;b.parent==this.sentinel?this.root=d:b==b.parent.left?b.parent.left=d:b.parent.right=d;d.left=b;b.parent=d};a.RedBlackSet.prototype.rightRotate=function(b){var d=b.left;b.left=d.right;d.right!=this.sentinel&&(d.right.parent=b);d.parent=b.parent;b.parent==this.sentinel?this.root=d:b==b.parent.right?b.parent.right=d:b.parent.left=d;d.right=b;b.parent=d};a.RedBlackSet.prototype.insert=function(b){if(this.contains(b))this.get_(b).key=b;else{var d=new a.RBnode(this);d.key=b;b=this.sentinel;for(var c=this.root;c!=this.sentinel;)b=c,c=0>this.compare(d.key,c.key)?c.left:c.right;d.parent=b;b==this.sentinel?this.root=d:0>this.compare(d.key,b.key)?b.left=d:b.right=d;d.left=this.sentinel;d.right=this.sentinel;d.color=!0;this.insertFixup(d);this.size++}};a.RedBlackSet.prototype.insertFixup=function(b){for(;b!=this.sentinel&&b!=this.root&&1==b.parent.color;)if(b.parent==b.parent.parent.left){var d=b.parent.parent.right;1==d.color?(b.parent.color=!1,d.color=!1,b.parent.parent.color=!0,b=b.parent.parent):(b==b.parent.right&&(b=b.parent,this.leftRotate(b)),b.parent.color=!1,b.parent.parent.color=!0,b.parent.parent!=this.sentinel&&this.rightRotate(b.parent.parent))}else d=b.parent.parent.left,1==d.color?(b.parent.color=!1,d.color=!1,b.parent.parent.color=!0,b=b.parent.parent):(b==b.parent.left&&(b=b.parent,this.rightRotate(b)),b.parent.color=!1,b.parent.parent.color=!0,b.parent.parent!=this.sentinel&&this.leftRotate(b.parent.parent));this.root.color=!1};a.RedBlackSet.prototype.delete_=function(b){var d=b.left==this.sentinel||b.right==this.sentinel?b:this.successor_(b);var c=d.left!=this.sentinel?d.left:d.right;c.parent=d.parent;d.parent==this.sentinel?this.root=c:d==d.parent.left?d.parent.left=c:d.parent.right=c;d!=b&&(b.key=d.key);0==d.color&&this.deleteFixup(c);this.size--};a.RedBlackSet.prototype.deleteFixup=function(b){for(;b!=this.root&&0==b.color;)if(b==b.parent.left){var d=b.parent.right;1==d.color&&(d.color=!1,b.parent.color=!0,this.leftRotate(b.parent),d=b.parent.right);0==d.left.color&&0==d.right.color?(d.color=!0,b=b.parent):(0==d.right.color&&(d.left.color=!1,d.color=!0,this.rightRotate(d),d=b.parent.right),d.color=b.parent.color,b.parent.color=!1,d.right.color=!1,this.leftRotate(b.parent),b=this.root)}else d=b.parent.left,1==d.color&&(d.color=!1,b.parent.color=!0,this.rightRotate(b.parent),d=b.parent.left),0==d.right.color&&0==d.left.color?(d.color=!0,b=b.parent):(0==d.left.color&&(d.right.color=!1,d.color=!0,this.leftRotate(d),d=b.parent.left),d.color=b.parent.color,b.parent.color=!1,d.left.color=!1,this.rightRotate(b.parent),b=this.root);b.color=!1};a.RedBlackSet.prototype.remove=function(b){b=this.get_(b);if(b!=this.sentinel){var d=b.key;this.delete_(b);return d}return null};a.RedBlackSet.prototype.removeSwapped=function(b,d){this.remove(d)};a.RedBlackSet.prototype.min=function(b){for(;b.left!=this.sentinel;)b=b.left;return b};a.RedBlackSet.prototype.max=function(b){for(;b.right!=this.sentinel;)b=b.right;return b};a.RedBlackSet.prototype.successor_=function(b){if(b.right!=this.sentinel)return this.min(b.right);for(var d=b.parent;d!=this.sentinel&&b==d.right;)b=d,d=d.parent;return d};a.RedBlackSet.prototype.predeccessor_=function(b){if(b.left!=this.sentinel)return this.max(b.left);for(var d=b.parent;d!=this.sentinel&&b==d.left;)b=d,d=d.parent;return d};a.RedBlackSet.prototype.successor=function(b){if(0<this.size){b=this.get_(b);if(b==this.sentinel)return null;if(b.right!=this.sentinel)return this.min(b.right).key;for(var d=b.parent;d!=this.sentinel&&b==d.right;)b=d,d=d.parent;return d!=this.sentinel?d.key:null}return null};a.RedBlackSet.prototype.predecessor=function(b){if(0<this.size){b=this.get_(b);if(b==this.sentinel)return null;if(b.left!=this.sentinel)return this.max(b.left).key;for(var d=b.parent;d!=this.sentinel&&b==d.left;)b=d,d=d.parent;return d!=this.sentinel?d.key:null}return null};a.RedBlackSet.prototype.getMin=function(){return this.min(this.root).key};a.RedBlackSet.prototype.getMax=function(){return this.max(this.root).key};a.RedBlackSet.prototype.get_=function(b){for(var d=this.root;d!=this.sentinel&&0!=this.compare(d.key,b);)d=0>this.compare(b,d.key)?d.left:d.right;return d};a.RedBlackSet.prototype.contains=function(b){return null!=this.get_(b).key};a.RedBlackSet.prototype.getValues=function(){var b=[];this.forEach(function(d){b.push(d)});return b};a.RedBlackSet.prototype.insertAll=function(b){if("array"==a.typeOf(b))for(var d=0;d<b.length;d++)this.insert(b[d]);else if("function"==a.typeOf(b.forEach))b.forEach(this.insert,this);else if("function"==a.typeOf(b.getValues))for(b=b.getValues(),d=0;d<b.length;d++)this.insert(b[d]);else if("object"==a.typeOf(b))for(d in b)this.insert(b[d])};a.RedBlackSet.prototype.removeAll=function(b){if("array"==a.typeOf(b))for(var d=0;d<b.length;d++)this.remove(b[d]);else if("function"==a.typeOf(b.forEach))b.forEach(this.removeSwapped,this);else if("function"==a.typeOf(b.getValues))for(b=b.getValues(),d=0;d<b.length;d++)this.remove(b[d]);else if("object"==a.typeOf(b))for(d in b)this.remove(b[d])};a.RedBlackSet.prototype.containsAll=function(b){if("array"==a.typeOf(b)){for(var d=0;d<b.length;d++)if(!this.contains(b[d]))return!1;return!0}if("function"==a.typeOf(b.forEach))return b.every(this.contains,this);if("function"==a.typeOf(b.getValues)){b=b.getValues();for(d=0;d<b.length;d++)if(!this.contains(b[d]))return!1;return!0}if("object"==a.typeOf(b)){for(d in b)if(!this.contains(b[d]))return!1;return!0}};a.RedBlackSet.prototype.range=function(b,d){var c=[];this.traverseFromTo(function(f){c.push(f)},b,d);return c};a.RedBlackSet.prototype.traverse=function(b,d){if(!this.isEmpty())for(var c=this.min(this.root);c!=this.sentinel&&!b.call(d,c.key,this);)c=this.successor_(c)};a.RedBlackSet.prototype.traverseFrom=function(b,d,c){if(!this.isEmpty())for(d=this.get_(d);d!=this.sentinel&&!b.call(c,d.key,this);)d=this.successor_(d)};a.RedBlackSet.prototype.traverseTo=function(b,d,c){if(!this.isEmpty()){var f=this.min(this.root);for(d=this.get_(d);f!=d&&!b.call(c,f.key,this);)f=this.successor_(f)}};a.RedBlackSet.prototype.traverseFromTo=function(b,d,c,f){if(!this.isEmpty())for(d=this.get_(d),c=this.get_(c);d!=c&&!b.call(f,d.key,this);)d=this.successor_(d)};a.RedBlackSet.prototype.traverseBackwards=function(b,d){if(!this.isEmpty())for(var c=this.max(this.root);c!=this.sentinel&&!b.call(d,c.key,this);)c=this.predeccessor_(c)};a.RedBlackSet.prototype.forEach=function(b,d){if(!this.isEmpty())for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))b.call(d,c.key,c.key,this)};a.RedBlackSet.prototype.some=function(b,d){if(this.isEmpty())return!1;for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))if(b.call(d,c.key,c.key,this))return!0;return!1};a.RedBlackSet.prototype.every=function(b,d){if(this.isEmpty())return!1;for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))if(!b.call(d,c.key,c.key,this))return!1;return!0};a.RedBlackSet.prototype.map=function(b,d){var c=[];if(this.isEmpty())return c;for(var f=this.min(this.root);f!=this.sentinel;f=this.successor_(f))c.push(b.call(d,f.key,f.key,this));return c};a.RedBlackSet.prototype.filter=function(b,d){var c=[];if(this.isEmpty())return c;for(var f=this.min(this.root);f!=this.sentinel;f=this.successor_(f))b.call(d,f.key,f.key,this)&&c.push(f.key);return c};a.RedBlackSet.prototype.getCount=function(){return this.size};a.RedBlackSet.prototype.isEmpty=function(){return 0==this.size};a.RedBlackSet.prototype.isSubsetOf=function(b){var d=a.getCount(b);if(this.getCount()>d)return!1;d=0;if(this.isEmpty())return!0;for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))a.contains.call(b,b,c.key)&&d++;return d==this.getCount()};a.RedBlackSet.prototype.intersection=function(b){var d=new a.RedBlackSet(this.compare);if(this.isEmpty())return d;for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))b.contains.call(b,c.key,c.key,this)&&d.insert(c.key);return d};e.RedBlackSet=class extends e.DefendedBase{constructor(b){super();this._rbSet=new a.RedBlackSet(b);this._enableQueue=!1;this._queueInsert=new Set;this._queueRemove=new Set}Add(b){this._enableQueue?this._rbSet.contains(b)?this._queueRemove.delete(b):this._queueInsert.add(b):this._rbSet.insert(b)}Remove(b){this._enableQueue?this._rbSet.contains(b)?this._queueRemove.add(b):this._queueInsert.delete(b):this._rbSet.remove(b)}Has(b){return this._enableQueue?this._queueInsert.has(b)?!0:!this._queueRemove.has(b)&&this._rbSet.contains(b):this._rbSet.contains(b)}Clear(){this._rbSet.clear();this._queueInsert.clear();this._queueRemove.clear()}toArray(){if(this._enableQueue)throw Error("cannot be used in queueing mode");return this._rbSet.getValues()}GetSize(){return this._rbSet.getCount()+this._queueInsert.size-this._queueRemove.size}IsEmpty(){return 0===this.GetSize()}Front(){if(this.IsEmpty())throw Error("empty set");if(this._enableQueue)throw Error("cannot be used in queueing mode");const b=this._rbSet;return b.min(b.root).key}Shift(){if(this.IsEmpty())throw Error("empty set");if(this._enableQueue)throw Error("cannot be used in queueing mode");const b=this.Front();this.Remove(b);return b}SetQueueingEnabled(b){b=!!b;if(this._enableQueue!==b&&(this._enableQueue=b,!b)){for(const d of this._queueRemove)this._rbSet.remove(d);this._queueRemove.clear();for(const d of this._queueInsert)this._rbSet.insert(d);this._queueInsert.clear()}}ForEach(b){this._rbSet.forEach(b)}*values(){if(!this.IsEmpty()){var b=this._rbSet;for(let d=b.min(b.root);d!=b.sentinel;d=b.successor_(d))yield d.key}}[Symbol.iterator](){return this.values()}}}
  {"use strict";const e=self.C3;e.PromiseThrottle=class{constructor(a=e.hardwareConcurrency){this._maxParallel=a;this._queue=[];this._activeCount=0}Add(a){return new Promise((b,d)=>{this._queue.push({func:a,resolve:b,reject:d});this._MaybeStartNext()})}_FindInQueue(a){for(let b=0,d=this._queue.length;b<d;++b)if(this._queue[b].func===a)return b;return-1}RemoveAndResolve(a,b){a=this._FindInQueue(a);if(-1===a)throw Error("cannot find promise to resolve");this._queue[a].resolve(b);this._queue.splice(a,1)}RemoveAndReject(a,b){a=this._FindInQueue(a);if(-1===a)throw Error("cannot find promise to reject");this._queue[a].reject(b);this._queue.splice(a,1)}async _MaybeStartNext(){if(this._queue.length&&!(this._activeCount>=this._maxParallel)){this._activeCount++;var a=this._queue.shift();try{const b=await a.func();a.resolve(b)}catch(b){a.reject(b)}this._activeCount--;this._MaybeStartNext()}}static async Batch(a,b){const d=[];let c=!1;const f=async g=>{for(;(g=b.pop())&&!c;)try{d.push(await g())}catch(l){throw c=!0,l;}},h=[];for(;a--;)h.push(f());await Promise.all(h);return d}}}
  {"use strict";const e=self.C3;e.RateLimiter=class{constructor(a,b,d){this._callback=a;this._interval=b;this._intervalOnBattery=d||2*b;this._timerId=-1;this._lastCallTime=-Infinity;this._timerCallFunc=()=>this._OnTimer();this._canRunImmediate=this._ignoreReset=!1;this._callbackArguments=null}SetCanRunImmediate(a){this._canRunImmediate=!!a}_GetInterval(){return"undefined"!==typeof e.Battery&&e.Battery.IsOnBatteryPower()?this._intervalOnBattery:this._interval}Call(...a){if(-1===this._timerId){this._callbackArguments=a;a=e.FastGetDateNow();var b=a-this._lastCallTime,d=this._GetInterval();b>=d&&this._canRunImmediate?(this._lastCallTime=a,this._RunCallback()):this._timerId=self.setTimeout(this._timerCallFunc,Math.max(d-b,4))}}_RunCallback(){this._ignoreReset=!0;const a=this._callbackArguments;this._callbackArguments=null;a?this._callback(...a):this._callback();this._ignoreReset=!1}Reset(){this._ignoreReset||(this._CancelTimer(),this._callbackArguments=null,this._lastCallTime=e.FastGetDateNow())}_OnTimer(){this._timerId=-1;this._lastCallTime=e.FastGetDateNow();this._RunCallback()}_CancelTimer(){-1!==this._timerId&&(self.clearTimeout(this._timerId),this._timerId=-1)}Release(){this._CancelTimer();this._timerCallFunc=this._callbackArguments=this._callback=null}}}
  {"use strict";const e=self.C3;e.SVGRasterManager=class{constructor(){this._images=new Map;this._allowNpotSurfaces=!1;this._redrawCallback=this._releaseResultCallback=this._rasterAtSizeCallback=this._getBaseSizeCallback=null}SetNpotSurfaceAllowed(a){this._allowNpotSurfaces=!!a}IsNpotSurfaceAllowed(){return this._allowNpotSurfaces}SetGetBaseSizeCallback(a){this._getBaseSizeCallback=a}GetBaseSize(a){if(!this._getBaseSizeCallback)throw Error("no get base size callback set");return this._getBaseSizeCallback(a)}SetRasterAtSizeCallback(a){this._rasterAtSizeCallback=a}RasterAtSize(a,b,d,c,f,h){if(!this._rasterAtSizeCallback)throw Error("no raster at size callback set");return this._rasterAtSizeCallback(a,b,d,c,f,h)}SetReleaseResultCallback(a){this._releaseResultCallback=a}ReleaseResult(a){if(!this._releaseResultCallback)throw Error("no release result callback set");this._releaseResultCallback(a)}SetRedrawCallback(a){this._redrawCallback=a}Redraw(){if(!this._redrawCallback)throw Error("no redraw callback set");this._redrawCallback()}AddImage(a){let b=this._images.get(a);b||(b=e.New(e.SVGRasterImage,this,a),this._images.set(a,b));b.IncReference();return b}_RemoveImage(a){this._images.delete(a.GetDataSource())}OnTexturesChanged(){for(const a of this._images.values())a.ReleaseRasterizedResult(),a.ForceRasterAgain()}}}
  {"use strict";const e=self.C3;e.SVGRasterImage=class{constructor(a,b){this._manager=a;this._dataSource=b;this._baseHeight=this._baseWidth=this._refCount=0;this._getBaseSizePromise=this._manager.GetBaseSize(b).then(d=>{this._baseWidth=d[0];this._baseHeight=d[1];this._manager.Redraw()}).catch(d=>{console.error("[SVG] Error loading SVG: ",d);this._hadError=!0;this._manager.Redraw()});this._rasterImageHeight=this._rasterImageWidth=this._rasterSurfaceHeight=this._rasterSurfaceWidth=0;this._isRasterizing=!1;this._rasterizedResult=null;this._hadError=this._forceRaster=!1}Release(){if(0>=this._refCount)throw Error("already released");this._refCount--;0===this._refCount&&this._Release()}ReleaseRasterizedResult(){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 0<this._refCount}GetRasterizedResult(){return this._rasterizedResult}ForceRasterAgain(){this._forceRaster=!0}async StartRasterForSize(a,b,d){if(0!==b&&0!==d&&!this._hadError&&!this._isRasterizing){var c=e.nextHighestPowerOfTwo(Math.ceil(b)),f=e.nextHighestPowerOfTwo(Math.ceil(d)),h=Math.max(c,f);2048<h&&(h=2048/h,b*=h,d*=h,c=Math.min(Math.ceil(c*h),2048),f=Math.min(Math.ceil(f*h),2048));b<c&&d<f&&(d=b/d,c/f>d?(b=f*d,d=f):(b=c,d=c/d));this._manager.IsNpotSurfaceAllowed()&&(c=Math.ceil(b),f=Math.ceil(d));c<=this._rasterSurfaceWidth&&f<=this._rasterSurfaceHeight&&!this._forceRaster||(this._isRasterizing=!0,this._rasterSurfaceWidth=c,this._rasterSurfaceHeight=f,a=await this._manager.RasterAtSize(this._dataSource,a,this._rasterSurfaceWidth,this._rasterSurfaceHeight,b,d),this._manager&&(this.ReleaseRasterizedResult(),this._rasterizedResult=a,this._rasterImageWidth=b,this._rasterImageHeight=d,this._forceRaster=this._isRasterizing=!1,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}}}
  {"use strict";const e=self.C3;e.UTF8_BOM="\ufeff";const a=new Set([..."0123456789"]);e.IsNumericChar=function(m){return a.has(m)};const b=new Set([..." \t\n\r\u00a0\u0085\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u202f\u205f\u3000"]);e.IsWhitespaceChar=function(m){return b.has(m)};e.FilterWhitespace=function(m){return[...m].filter(u=>!e.IsWhitespaceChar(u)).join("")};e.IsStringAllWhitespace=function(m){for(const u of m)if(!e.IsWhitespaceChar(u))return!1;return!0};e.IsUnprintableChar=function(m){return 1===m.length&&32>m.charCodeAt(0)};e.FilterUnprintableChars=function(m){return[...m].filter(u=>!e.IsUnprintableChar(u)).join("")};const d=new Set([..."0123456789.+-e"]);e.IsStringNumber=function(m){m=m.trim();if(!m.length)return!1;let u=m.charAt(0);if("-"!==u&&!a.has(u))return!1;for(let x of m)if(!d.has(x))return!1;return!0};e.RemoveTrailingDigits=function(m){let u=m.length;for(;0<u;){let x=m.charAt(u-1);if(!e.IsNumericChar(x))break;--u}return m.substr(0,u)};e.IncrementNumberAtEndOf=function(m){let u=e.RemoveTrailingDigits(m);m=(m=m.substr(u.length))?(parseInt(m,10)+1).toString():"2";return u+m};const c=new Map([["&","&amp;"],["<","&lt;"],[">","&gt;"],['"',"&quot;"],["'","&#39;"]]);function f(m){return c.get(m)}const h=/[&<>"']/g;e.EscapeHTML=function(m){return m.replace(h,f)};e.EscapeJS=function(m){m=e.ReplaceAll(m,"\\","\\\\");m=e.ReplaceAll(m,'"','\\"');m=e.ReplaceAll(m,"\t","\\t");m=e.ReplaceAll(m,"\r","");return e.ReplaceAll(m,"\n","\\n")};e.EscapeXML=function(m){m=e.ReplaceAll(m,"&","&amp;");m=e.ReplaceAll(m,"<","&lt;");m=e.ReplaceAll(m,">","&gt;");return e.ReplaceAll(m,'"',"&quot;")};const g=/[-[\]{}()*+?.,\\^$|#\s]/g;e.EscapeRegex=function(m){return m.replace(g,"\\$&")};e.FindAll=function(m,u,x=!1){if(!u)return[];x||(m=m.toLowerCase(),u=u.toLowerCase());x=u.length;var n=0;let q=[];for(;-1<(n=m.indexOf(u,n));)q.push(n),n+=x;return q};e.ReplaceAll=function(m,u,x){return m.replaceAll(u,()=>x)};e.ReplaceAllCaseInsensitive=function(m,u,x){return m.replace(new RegExp(e.EscapeRegex(u),"gi"),()=>x)};e.SetElementContent=function(m,u){"string"===typeof u?m.textContent=u:u.isPlainText()?m.textContent=u.toString():(m.innerHTML=u.toHTML(),u instanceof e.BBString&&u.attachLinkHandlers(m))};e.StringLikeEquals=function(m,u){return m instanceof e.HtmlString||m instanceof e.BBString?m.equals(u):u instanceof e.HtmlString||u instanceof e.BBString?u.equals(m):m===u};e.StringSubstitute=function(m,...u){let x=m;for(let n=0,q=u.length;n<q;++n){const t=`{${n}}`;if(!m.includes(t))throw Error(`missing placeholder '${t}' in string substitution`);x=x.replace(t,u[n].toString())}return x};e.StringSubstituteAllowMissing=function(m,...u){let x=m,n=-1,q=-1;for(let t=0,r=u.length;t<r;++t){const w=`{${t}}`;m.includes(w)?(q=t,x=x.replace(w,u[t].toString())):-1===n&&(n=t)}if(0<=n&&0<=q&&n<q)throw Error(`missing placeholder '${n}' in string substitution`);return x};e.StringSubstituteMap=function(m,u){for(let[x,n]of Object.entries(u))m=m.replaceAll(x,n.toString());return m};e.SortAZCaseInsensitive=function(m,u){m=m.toLowerCase();u=u.toLowerCase();return m>u?1:m<u?-1:0};e.FormatDataSize=function(m,u){u="common."+(u?"dataRates":"dataSizes")+".";const x=self.langSub;if(1024>m)return x(u+"bytes",m);if(1048576>m)return m/=1024,m=10>m?Math.round(10*m)/10:Math.round(m),x(u+"kilobytes",m);if(1073741824>m)return m/=1048576,m=10>m?Math.round(10*m)/10:Math.round(m),x(u+"megabytes",m);if(1099511627776>m)return m/=1073741824,m=10>m?Math.round(10*m)/10:Math.round(m),x(u+"gigabytes",m);m/=1099511627776;m=10>m?Math.round(10*m)/10:Math.round(m);return x(u+"terabytes",m)};const l={approximate:!1,days:!0,hours:!0,minutes:!0,seconds:!0};e.FormatTime=function(m,u){u=Object.assign({},l,u);e.Lang.PushContext("common.time");const x=[],n=self.lang,q=self.langPluralSub;if(u.days){var t=Math.floor(m/86400);0<t&&(m-=86400*t,x.push(q(".days",null,t)))}u.hours&&(t=Math.floor(m/3600),0<t||x.length)&&(m-=3600*t,x.push(q(".hours",null,t)));u.minutes&&(t=Math.floor(m/60),0<t||x.length||!u.seconds)&&(m-=60*t,x.push(q(".minutes",null,t)));u.seconds&&x.push(q(".seconds",null,Math.floor(m%60)));m=(u.approximate?n(".approx-prefix"):"")+x.join(n(".separator"));e.Lang.PopContext();return m};e.ZeroPad=function(m,u){let x=0>m?"-":"";m=Math.abs(m);m=m.toString();u-=m.length;for(let n=0;n<u;++n)x+="0";return x+m};e.StringToTitleCase=function(m){return m.toLowerCase().replace(/\b\w/g,u=>u.toUpperCase())};e.CompareVersionStrings=function(m,u){m=m.split(".").map(x=>x.trim());u=u.split(".").map(x=>x.trim());e.resizeArray(m,4,"0");e.resizeArray(u,4,"0");m=m.map(x=>parseInt(x,10));u=u.map(x=>parseInt(x,10));for(let x=0;4>x;++x){const n=m[x]-u[x];if(0!==n)return 0>n?-1:1}return 0};e.CreateGUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,m=>{const u=Math.floor(16*Math.random());return("x"===m?u:u&3|8).toString(16)})};e.StringHammingDistance=function(m,u){if(m.length!==u.length)throw Error("strings must be same length");let x=0;for(let n=0,q=m.length;n<q;++n)m.charAt(n)!==u.charAt(n)&&++x;return x};e.StringLevenshteinDistance=function(m,u){if(0===m.length)return u.length;if(0===u.length)return m.length;let x,n,q,t;if(m.length>u.length){var r=m;m=u;u=r}t=Array(m.length+1);for(r=0;r<=m.length;r++)t[r]=r;for(r=1;r<=u.length;r++){n=r;for(x=1;x<=m.length;x++)q=u[r-1]===m[x-1]?t[x-1]:Math.min(t[x-1]+1,Math.min(n+1,t[x]+1)),t[x-1]=n,n=q;t[m.length]=n}return t[m.length]}}
  {"use strict";const e=self.C3,a=new Map([["b","strong"],["i","em"],["s","s"],["u","u"],["sub","sub"],["sup","sup"],["small","small"],["mark","mark"],["a1","a"],["a2","a"],["a3","a"],["a4","a"],["a5","a"],["a6","a"],["a7","a"],["a8","a"],["a9","a"],["bad",["span","bbCodeBad"]],["good",["span","bbCodeGood"]],["info",["span","bbCodeInfo"]],["h1",["span","bbCodeH1"]],["h2",["span","bbCodeH2"]],["h3",["span","bbCodeH3"]],["h4",["span","bbCodeH4"]],["item",["span","bbCodeItem"]]]),b=/\[(\/?)([a-zA-Z0-9]+)\]/g,d=/\[(\/?)([^\[]*?)\]/g;let c=null,f=0;function h(l,m,u){var x=a.get(u);if(x){if("string"===typeof x){if("a"!==x||m)return"<"+m+x+">";m=parseInt(u.substring(1),10)-1;if(0>m||m>=c.length)throw Error("invalid bbcode link substitution");x=c[m];if("string"===typeof x)return`<a href="${c[m]}">`;if("function"===typeof x)return`<a class="bblink${m}">`;throw new TypeError("invalid bbcode link action");}if(Array.isArray(x))return l=x[0],x=x[1],m?"</"+l+">":`<${l} class="${x}">`}else return"class"===u?m?"</span>":`<span class="bbclass${f++}">`:l}const g=/\n/g;e.BBString=class{constructor(l,m){this._bbstr=m&&m.noEscape?l:e.EscapeHTML(l);this._htmlstr="";this._convertLineBreaks=!1;this._linkActions=[];if(m&&(this._convertLineBreaks=!!m.convertLineBreaks,m.links)){if(9<m.links.length)throw Error("too many links");this._linkActions=m.links}this._hasAnyBBtags=this._bbstr.includes("[");this._needsLineBreakConversion=this._convertLineBreaks&&this._bbstr.includes("\n");this._isPlain=!this._hasAnyBBtags&&!this._needsLineBreakConversion&&!this._bbstr.includes("&");this._hasParsedFragments=!1;this._fragments=[]}toString(){return this._bbstr}valueOf(){return this._bbstr}isPlainText(){return this._isPlain}toPlainText(){return this._hasAnyBBtags?this._bbstr.replace(b,""):this._bbstr}toHTML(){if(this._isPlain)return this._bbstr;if(!this._htmlstr&&this._bbstr){let l=this._bbstr;this._hasAnyBBtags&&(f=0,c=this._linkActions,l=l.replace(b,h),c=null);this._needsLineBreakConversion&&(l=l.replace(g,"<br>"));this._htmlstr=l}return this._htmlstr}attachLinkHandlers(l){if(this._linkActions.length)for(let m=0,u=this._linkActions.length;m<u;++m){const x=this._linkActions[m];if("function"!==typeof x)continue;const n=l.querySelector(".bblink"+m);if(!n)throw Error("unable to attach BBString link handler");n.onclick=x}}equals(l){return l instanceof e.HtmlString?this.toHTML()===l.toHTML():l instanceof e.BBString?this._bbstr===l._bbstr:this._bbstr===l}toFragmentList(){if(this._hasParsedFragments)return this._fragments;const l=this._bbstr,m=[];let u=d.lastIndex=0;for(var x;null!==(x=d.exec(l));){var n=x.index;if(0<n&&"\\"===l.charAt(n-1))continue;var q=x[0],t=x[1];x=x[2];const r=l.substring(u,n);u=n+q.length;r&&this._fragments.push({text:r,styles:m.slice(0)});if(x)if(t)for(x=x.toLowerCase(),n=m.length-1;0<=n;--n){if(m[n].tag===x){m.splice(n,1);break}}else n=x,q=null,t=x.indexOf("="),-1!==t?(n=x.substring(0,t).toLowerCase(),q=x.substring(t+1)):n=n.toLowerCase(),m.push({tag:n,param:q})}u<l.length&&this._fragments.push({text:l.substring(u),styles:m.slice(0)});for(const r of this._fragments)r.text=this._ProcessBBCodeEscapeSequences(r.text);this._hasParsedFragments=!0;return this._fragments}_ProcessBBCodeEscapeSequences(l){l=e.ReplaceAll(l,"\\[","[");return e.ReplaceAll(l,"\\\\","\\")}static StripTags(l){return e.New(e.BBString,l,{noEscape:!0}).toPlainText()}static StripAnyTags(l){return l.replace(d,"")}}}
  {"use strict";const e=self.C3;e.WordWrap=class{constructor(){this._lines=[]}GetLines(){return this._lines}GetLineCount(){return this._lines.length}_MeasureLine(a,b){let d=0,c=0,f=0,h=0,g=0;for(const l of a)-1===l.width&&(a=b(l.text,l.styles),l.width=a.width,l.height=a.height,l.fontBoundingBoxAscent=a.fontBoundingBoxAscent||0,l.fontBoundingBoxDescent=a.fontBoundingBoxDescent||0,l.topToAlphabeticDistance=a.topToAlphabeticDistance||0),d+=l.width,c=Math.max(c,l.height),f=Math.max(f,l.fontBoundingBoxAscent),h=Math.max(h,l.fontBoundingBoxDescent),g=Math.max(g,l.topToAlphabeticDistance);return{width:d,height:c,fontBoundingBoxAscent:f,fontBoundingBoxDescent:h,topToAlphabeticDistance:g}}_AddLine(a,b,d,c,f,h){this._lines.push({fragments:a,width:b,height:d,fontBoundingBoxAscent:c,fontBoundingBoxDescent:f,topToAlphabeticDistance:h})}WordWrap(a,b,d,c,f){"string"===typeof a&&(a=[{text:a,styles:[]}]);e.clearArray(this._lines);if(!(!a.length||1===a.length&&!a[0].text.length||2>d)){if(1===a.length){var h=a[0];const g=h.text;h=h.styles;if(100>=g.length&&!g.includes("\n")){let{width:l,height:m,fontBoundingBoxAscent:u,fontBoundingBoxDescent:x,topToAlphabeticDistance:n}=b(g,h);l+=f;u=u||0;x=x||0;n=n||0;if(l<=d){this._AddLine([{text:g,styles:h,width:l,height:m,fontBoundingBoxAscent:u,fontBoundingBoxDescent:x,topToAlphabeticDistance:n}],l,m,u,x,n);return}}}if("word"===c)c=this._TokeniseWords(a);else{c=[];for(const g of a)e.appendArray(c,[...g.text].map(l=>[{text:l,styles:g.styles}]))}this._WrapText(c,b,d,f)}}_TokeniseWords(a){const b=[];let d=[],c=!1;for(const h of a){var f=h.text;a=h.styles;for(const g of f)"\n"===g?(0<d.length&&b.push(d),b.push([{text:"\n",styles:a}]),d=[]):0===d.length?(d.push({text:g,styles:a}),c=e.IsWhitespaceChar(g)):(f=e.IsWhitespaceChar(g),f===c?(f=d.at(-1),f.styles===a?f.text+=g:d.push({text:g,styles:a})):(b.push(d),d=[],d.push({text:g,styles:a}),c=f))}0<d.length&&b.push(d);return b}_CopyLine(a){return a.map(b=>({text:b.text,styles:b.styles,width:b.width,height:b.height,fontBoundingBoxAscent:b.fontBoundingBoxAscent,fontBoundingBoxDescent:b.fontBoundingBoxDescent,topToAlphabeticDistance:b.topToAlphabeticDistance}))}_AddWordToLine(a,b){var d=a.length?a.at(-1):null;let c=0;d&&b[0].styles===d.styles&&(d.text+=b[0].text,d.width=-1,d.height=-1,d.fontBoundingBoxAscent=-1,d.fontBoundingBoxDescent=-1,d.topToAlphabeticDistance=-1,c=1);for(d=b.length;c<d;++c){const f=b[c];a.push({text:f.text,styles:f.styles,width:-1,height:-1,fontBoundingBoxAscent:-1,fontBoundingBoxDescent:-1,topToAlphabeticDistance:-1})}}_WrapText(a,b,d,c){let f=[],h=0,g=0,l=0,m=0;var u=0;for(const x of a){if(1===x.length&&"\n"===x[0].text){0===g&&(u=b(" ",x[0].styles),g=u.height,l=u.fontBoundingBoxAscent||0,m=u.fontBoundingBoxDescent||0,u=u.topToAlphabeticDistance||0);this._AddLine(f,h,g,l,m,u);f=[];u=m=l=g=h=0;continue}a=this._CopyLine(f);this._AddWordToLine(a,x);const n=this._MeasureLine(a,b),q=n.width;q>=d?(0<f.length&&this._AddLine(f,h,g,l,m,u),f=[],e.IsStringAllWhitespace(x[0].text)?u=m=l=g=h=0:(this._AddWordToLine(f,x),u=this._MeasureLine(f,b),h=u.width,g=u.height,l=u.fontBoundingBoxAscent,m=u.fontBoundingBoxDescent,u=u.topToAlphabeticDistance)):(f=a,h=q,g=n.height,l=n.fontBoundingBoxAscent,m=n.fontBoundingBoxDescent,u=n.topToAlphabeticDistance)}0<f.length&&this._AddLine(f,h,g,l,m,u);this._TrimLinesTrailingWhitespace(b,c)}_TrimLinesTrailingWhitespace(a,b){for(const c of this._lines){const f=c.fragments;if(!f.length)continue;let h=f.at(-1);var d=h.text;const g=d.trimEnd();if(!g)c.width-=h.width,f.pop();else if(g.length<d.length){d=a(g,h.styles).width;const l=h.width-d;h.width=d;h.text=g;c.width-=l}0!==b&&0<f.length&&(h=f.at(-1),h.width+=b,c.width+=b)}}Clear(){e.clearArray(this._lines)}GetMaxLineWidth(){return this._lines.reduce((a,b)=>Math.max(a,b.width),0)}GetTotalLineHeight(){return this._lines.reduce((a,b)=>a+b.height,0)}}}
  {"use strict";const e=self.C3,a=self.glMatrix,b=a.vec3,d=a.vec4,c=a.mat4,f=b.create(),h=b.create(),g=b.create(),l=d.create(),m=c.create(),u=b.create(),x=b.create(),n=b.create(),q=b.create(),t=b.create(),r=b.create(),w=b.create(),y=b.create(),B=d.fromValues(0,0,1,1);e.Gfx={Project(C,A,F,J,L,R,T){const V=J[0]*C+J[4]*A+J[8]*F+J[12],ba=J[1]*C+J[5]*A+J[9]*F+J[13],ia=J[2]*C+J[6]*A+J[10]*F+J[14];J=J[3]*C+J[7]*A+J[11]*F+J[15];C=L[0]*V+L[4]*ba+L[8]*ia+L[12]*J;A=L[1]*V+L[5]*ba+L[9]*ia+L[13]*J;F=L[2]*V+L[6]*ba+L[10]*ia+L[14]*J;L=L[3]*V+L[7]*ba+L[11]*ia+L[15]*J;if(0===L)return!1;L=1/L;T[0]=(C*L*.5+.5)*R[2]+R[0];T[1]=(A*L*.5+.5)*R[3]+R[1];T[2]=.5*(1+F*L);return!0},Unproject(C,A,F,J,L,R,T){c.multiply(m,L,J);if(null===c.invert(m,m))return!1;l[0]=(C-R[0])/R[2]*2-1;l[1]=(A-R[1])/R[3]*2-1;l[2]=2*F-1;l[3]=1;d.transformMat4(l,l,m);if(0===l[3])return!1;l[3]=1/l[3];T[0]=l[0]*l[3];T[1]=l[1]*l[3];T[2]=l[2]*l[3];return!0},UnprojectScreenToWorldZ(C,A,F,J,L,R,T){if(!e.Gfx.Unproject(C,A,0,J,L,R,f)||!e.Gfx.Unproject(C,A,1,J,L,R,h))return!1;b.subtract(h,h,f);b.set(g,0,0,1);C=-F;A=b.dot(g,h);F=0;if(0===A){if(0!==b.dot(g,f)+C)return!1}else if(F=-(b.dot(f,g)+C)/A,0>F)return!1;b.scaleAndAdd(T,f,h,F);return!0}};function E(C,A,F,J){b.subtract(f,F,A);b.subtract(h,C,A);b.cross(g,f,h);b.normalize(g,g);J.set(g[0],g[1],g[2],b.dot(C,g))}function H(C,A,F,J,L,R,T){const V=T.x,ba=T.y,ia=T.z,ja=T.w,qa=T.xF,za=T.yF;T=T.zF;const Ca=1-qa,Ma=1-za,Fa=1-T;return V*C*qa+V*J*Ca+ba*A*za+ba*L*Ma+ia*F*T+ia*R*Fa>=ja?!0:V*J*qa+V*C*Ca+ba*L*za+ba*A*Ma+ia*R*T+ia*F*Fa>ja}class K{constructor(){this.zF=this.yF=this.xF=this.w=this.z=this.y=this.x=NaN}set(C,A,F,J){this.x=C;this.y=A;this.z=F;this.w=J;this.xF=0<C?1:0;this.yF=0<A?1:0;this.zF=0<F?1:0}}e.Gfx.ViewFrustum=class{constructor(){this._leftP=new K;this._topP=new K;this._rightP=new K;this._bottomP=new K;this._nearP=new K;this._farP=new K}CalculatePlanes(C,A){e.Gfx.Unproject(0,1,0,C,A,B,u);e.Gfx.Unproject(1,1,0,C,A,B,x);e.Gfx.Unproject(0,0,0,C,A,B,n);e.Gfx.Unproject(1,0,0,C,A,B,q);e.Gfx.Unproject(0,1,1,C,A,B,t);e.Gfx.Unproject(1,1,1,C,A,B,r);e.Gfx.Unproject(0,0,1,C,A,B,w);e.Gfx.Unproject(1,0,1,C,A,B,y);E(n,u,t,this._leftP);E(u,x,r,this._topP);E(x,q,y,this._rightP);E(q,n,w,this._bottomP);E(w,t,r,this._farP);E(q,x,u,this._nearP)}ContainsAABB(C,A,F,J,L,R){return H(C,A,F,J,L,R,this._leftP)&&H(C,A,F,J,L,R,this._topP)&&H(C,A,F,J,L,R,this._rightP)&&H(C,A,F,J,L,R,this._bottomP)&&H(C,A,F,J,L,R,this._nearP)&&H(C,A,F,J,L,R,this._farP)}}}
  {"use strict";const e=self.C3,a=self.glMatrix,b=a.vec3,d=a.vec4,c=a.mat4,f=c.create(),h=b.fromValues(0,0,0),g=b.fromValues(0,0,0),l=b.fromValues(0,0,0),m=b.fromValues(0,1,0);d.fromValues(0,0,0,0);const u=new e.Quad,x=new e.Rect,n=new e.Quad(0,0,1,0,1,1,0,1);e.Gfx.RendererBase=class{constructor(){this._height=this._width=0;this._fovY=e.toRadians(45);this._tan_fovY_2=Math.tan(this._fovY/2);this._matP=c.create();this._matMV=c.create();this._allShaderPrograms=[];this._shaderProgramsByName=new Map;this._spSmoothLineFill=this._spSmoothEllipseOutline=this._spSmoothEllipseFill=this._spHardEllipseOutline=this._spHardEllipseFill=this._spLinearGradientFill=this._spColorFill=this._spTilemapFill=this._spPoints=this._spTextureFill=null;this._stateGroups=new Map;this._currentStateGroup=null;this._blendModeTable=[];this._namedBlendModeMap=new Map;this._currentZ=this._baseZ=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=!0;this._hasMajorPerformanceCaveat=!1}FillIndexBufferData(q){let t=0,r=q.length,w=0;for(;t<r;)q[t++]=w,q[t++]=w+1,q[t++]=w+2,q[t++]=w,q[t++]=w+2,q[t++]=w+3,w+=4}_ClearState(){this._currentZ=this._baseZ=0;this._spSmoothLineFill=this._spSmoothEllipseOutline=this._spSmoothEllipseFill=this._spHardEllipseOutline=this._spHardEllipseFill=this._spLinearGradientFill=this._spColorFill=this._spTilemapFill=this._spPoints=this._spTextureFill=null;this._ClearAllShaderPrograms()}InitState(){this._ClearState();this._currentStateGroup=null}OnDeviceOrContextLost(){for(const q of this._allShaderPrograms)q.Release();this._ClearState()}GetWidth(){return this._width}GetHeight(){return this._height}GetDefaultCameraZ(){return 100}GetNearZ(){return 1}GetFarZ(){return 1E4}GetFovY(){return this._fovY}_GetTanFovYDiv2(){return this._tan_fovY_2}CalculatePerspectiveMatrix(q,t,r=.5,w=.5){const y=this.GetNearZ(),B=this.GetFarZ();r=1-r;const E=2*r-2;r*=2;const H=2*w-2;w*=2;const K=this._GetTanFovYDiv2()*y;t*=K;c.frustum(q,E*t,r*t,H*K,w*K,y,B)}CalculateOrthographicMatrix(q,t,r,w=1){const y=self.devicePixelRatio,B=2*this.GetDefaultCameraZ()*y*this._GetTanFovYDiv2()/r;t=t*B/(2*y*w);r=r*B/(2*y*w);c.ortho(q,-t,t,-r,r,this.GetNearZ(),this.GetFarZ())}CalculateLookAtModelView(q,t,r,w,y=this.GetScissoredViewportHeight()){y=2*this.GetDefaultCameraZ()*self.devicePixelRatio*this._GetTanFovYDiv2()/y;b.set(l,y,-y,1);b.multiply(h,t,l);b.multiply(g,r,l);c.lookAt(q,h,g,w||m);c.scale(q,q,l)}CalculateLookAtModelView2(q,t,r,w,y,B,E){b.set(h,q,t,r);b.set(g,w,y,B);this.CalculateLookAtModelView(f,h,g,m,E);return f}_AddShaderProgram(q){this._allShaderPrograms.push(q);this._shaderProgramsByName.set(q.GetName(),q)}_RemoveShaderProgram(q){const t=this._allShaderPrograms.indexOf(q);-1!==t&&this._allShaderPrograms.splice(t,1);this._shaderProgramsByName.delete(q.GetName())}_ClearAllShaderPrograms(){e.clearArray(this._allShaderPrograms);this._shaderProgramsByName.clear()}GetShaderProgramByName(q){return this._shaderProgramsByName.get(q)||null}GetTextureFillShaderProgram(){return this._spTextureFill}SetTextureFillMode(){this.SetProgram(this._spTextureFill)}GetPointsRenderingProgram(){return this._spPoints}SetPointsRenderingProgram(){this.SetProgram(this._spPoints)}SetTilemapFillMode(){this.SetProgram(this._spTilemapFill)}SetColorFillMode(){this.SetProgram(this._spColorFill)}SetLinearGradientFillMode(){this.SetProgram(this._spLinearGradientFill)}SetHardEllipseFillMode(){this.SetProgram(this._spHardEllipseFill)}SetHardEllipseOutlineMode(){this.SetProgram(this._spHardEllipseOutline)}SetSmoothEllipseFillMode(){this.SetProgram(this._spSmoothEllipseFill)}SetSmoothEllipseOutlineMode(){this.SetProgram(this._spSmoothEllipseOutline)}SetSmoothLineFillMode(){this.SetProgram(this._spSmoothLineFill)}_SetCurrentStateGroup(q){this._currentStateGroup=q}GetCurrentStateGroup(){return this._currentStateGroup}AcquireStateGroup(q,t,r,w){const y=e.Gfx.StateGroup.MakeKey(q,t,r,w);let B=this._stateGroups.get(y);B||(B=e.New(e.Gfx.StateGroup,this,q,t,r,w),this._stateGroups.set(y,B));B.AddRef();return B}ReleaseStateGroup(q){q.DecRef();0===q._GetRefCount()&&(this._currentStateGroup===q&&(this._currentStateGroup=null),this._stateGroups.delete(q.GetKey()),q.Release())}_InitBlendModeData(q){e.clearArray(this._blendModeTable);this._namedBlendModeMap.clear();for(const t of q){q=t[0];const r=t[1],w=t[2];this._blendModeTable.push([r,w]);this._namedBlendModeMap.set(q,{srcBlend:r,destBlend:w})}}_GetBlendByIndex(q){return this._blendModeTable[q]}GetSrcBlendByIndex(q){return this._GetBlendByIndex(q)[0]}GetDestBlendByIndex(q){return this._GetBlendByIndex(q)[1]}GetNamedBlend(q){q=this._namedBlendModeMap.get(q);if("undefined"===typeof q)throw Error("invalid blend name");return q}SetBaseZ(q){this._baseZ=q}GetBaseZ(){return this._baseZ}SetCurrentZ(q){this._currentZ=q;this._currentStateGroup=null}GetCurrentZ(){return this._currentZ}Line(q,t,r,w){var y=e.angleTo(q,t,r,w),B=.5*this._lineWidth;const E=Math.sin(y)*B;y=Math.cos(y)*B;B=this._lineCap;2===B?this.LinePreCalc_LineCap2(q,t,0,r,w,0,E,y):1===B?this.LinePreCalc_LineCap1(q,t,0,r,w,0,E,y):this.LinePreCalc_LineCap0(q,t,0,r,w,0,E,y)}Line3D(q,t,r,w,y,B){var E=e.angleTo(q,t,w,y),H=.5*this._lineWidth;const K=Math.sin(E)*H;E=Math.cos(E)*H;H=this._lineCap;2===H?this.LinePreCalc_LineCap2(q,t,r,w,y,B,K,E):1===H?this.LinePreCalc_LineCap1(q,t,r,w,y,B,K,E):this.LinePreCalc_LineCap0(q,t,r,w,y,B,K,E)}LinePreCalc_LineCap2(q,t,r,w,y,B,E,H){var K=this._lineOffset;q=q+K-H;t=t+K-E;w=w+K+H;y=y+K+E;K=2*H;const C=2*E;this.Quad3D2(q+E,t-H,r,w+E,y-H,B,w-E-K,y+H-C,B,q-E+K,t+H+C,r,n)}LinePreCalc_LineCap1(q,t,r,w,y,B,E,H){const K=this._lineOffset;q=q+K-H;t=t+K-E;w=w+K+H;y=y+K+E;this.Quad3D2(q+E,t-H,r,w+E,y-H,B,w-E,y+H,B,q-E,t+H,r,n)}LinePreCalc_LineCap0(q,t,r,w,y,B,E,H){const K=this._lineOffset;q+=K;t+=K;w+=K;y+=K;this.Quad3D2(q+E,t-H,r,w+E,y-H,B,w-
  E,y+H,B,q-E,t+H,r,n)}TexturedLine(q,t,r,w,y,B){var E=e.angleTo(q,t,r,w),H=.5*this._lineWidth;const K=Math.sin(E)*H;E=Math.cos(E)*H;H=this._lineCap;2===H?this.TexturedLinePreCalc_LineCap2(q,t,r,w,K,E,y,B):1===H?this.TexturedLinePreCalc_LineCap1(q,t,r,w,K,E,y,B):this.TexturedLinePreCalc_LineCap0(q,t,r,w,K,E,y,B)}TexturedLinePreCalc_LineCap2(q,t,r,w,y,B,E,H){var K=this._lineOffset;q=q+K-B;t=t+K-y;r=r+K+B;w=w+K+y;K=2*B;const C=2*y;u.set(q+y,t-B,r+y,w-B,r-y-K,w+B-C,q-y+K,t+B+C);x.set(E,0,H,0);this.Quad3(u,x)}TexturedLinePreCalc_LineCap1(q,t,r,w,y,B,E,H){const K=this._lineOffset;q=q+K-B;t=t+K-y;r=r+K+B;w=w+K+y;u.set(q+y,t-B,r+y,w-B,r-y,w+B,q-y,t+B);x.set(E,0,H,0);this.Quad3(u,x)}TexturedLinePreCalc_LineCap0(q,t,r,w,y,B,E,H){const K=this._lineOffset;q+=K;t+=K;r+=K;w+=K;u.set(q+y,t-B,r+y,w-B,r-y,w+B,q-y,t+B);x.set(E,0,H,0);this.Quad3(u,x)}LineRect(q,t,r,w){const y=.5*this._lineWidth,B=this._lineCap;2===B?this._LineRectPreCalc_LineCap2(q,t,r,w,y):1===B?this._LineRectPreCalc_LineCap1(q,t,r,w,y):this._LineRectPreCalc_LineCap0(q,t,r,w,y)}_LineRectPreCalc_LineCap2(q,t,r,w,y){this.LinePreCalc_LineCap2(q,t,0,r,t,0,0,y);this.LinePreCalc_LineCap2(r,t,0,r,w,0,y,0);this.LinePreCalc_LineCap2(r,w,0,q,w,0,0,-y);this.LinePreCalc_LineCap2(q,w,0,q,t,0,-y,0)}_LineRectPreCalc_LineCap1(q,t,r,w,y){this.LinePreCalc_LineCap1(q,t,0,r,t,0,0,y);this.LinePreCalc_LineCap1(r,t,0,r,w,0,y,0);this.LinePreCalc_LineCap1(r,w,0,q,w,0,0,-y);this.LinePreCalc_LineCap1(q,w,0,q,t,0,-y,0)}_LineRectPreCalc_LineCap0(q,t,r,w,y){this.LinePreCalc_LineCap0(q,t,0,r,t,0,0,y);this.LinePreCalc_LineCap0(r,t,0,r,w,0,y,0);this.LinePreCalc_LineCap0(r,w,0,q,w,0,0,-y);this.LinePreCalc_LineCap0(q,w,0,q,t,0,-y,0)}LineRect2(q){this.LineRect(q.getLeft(),q.getTop(),q.getRight(),q.getBottom())}LineQuad(q){var t=e.angleTo(q.getTlx(),q.getTly(),q.getTrx(),q.getTry()),r=.5*this._lineWidth;const w=Math.sin(t)*r;t=Math.cos(t)*r;r=this._lineCap;2===r?this._LineQuadPreCalc_LineCap2(q,w,t):1===r?this._LineQuadPreCalc_LineCap1(q,w,t):this._LineQuadPreCalc_LineCap0(q,w,t)}_LineQuadPreCalc_LineCap2(q,t,r){this.LinePreCalc_LineCap2(q.getTlx(),q.getTly(),0,q.getTrx(),q.getTry(),0,t,r);this.LinePreCalc_LineCap2(q.getTrx(),q.getTry(),0,q.getBrx(),q.getBry(),0,r,-t);this.LinePreCalc_LineCap2(q.getBrx(),q.getBry(),0,q.getBlx(),q.getBly(),0,-t,-r);this.LinePreCalc_LineCap2(q.getBlx(),q.getBly(),0,q.getTlx(),q.getTly(),0,-r,t)}_LineQuadPreCalc_LineCap1(q,t,r){this.LinePreCalc_LineCap1(q.getTlx(),q.getTly(),0,q.getTrx(),q.getTry(),0,t,r);this.LinePreCalc_LineCap1(q.getTrx(),q.getTry(),0,q.getBrx(),q.getBry(),0,r,-t);this.LinePreCalc_LineCap1(q.getBrx(),q.getBry(),0,q.getBlx(),q.getBly(),0,-t,-r);this.LinePreCalc_LineCap1(q.getBlx(),q.getBly(),0,q.getTlx(),q.getTly(),0,-r,t)}_LineQuadPreCalc_LineCap0(q,t,r){this.LinePreCalc_LineCap0(q.getTlx(),q.getTly(),0,q.getTrx(),q.getTry(),0,t,r);this.LinePreCalc_LineCap0(q.getTrx(),q.getTry(),0,q.getBrx(),q.getBry(),0,r,-t);this.LinePreCalc_LineCap0(q.getBrx(),q.getBry(),0,q.getBlx(),q.getBly(),0,-t,-r);this.LinePreCalc_LineCap0(q.getBlx(),q.getBly(),0,q.getTlx(),q.getTly(),0,-r,t)}SetLineWidth(q){this._lineWidth=q;this._lineWidthStack[this._lineWidthStack.length-1]=q}GetLineWidth(){return this._lineWidth}PushLineWidth(q){if(100<=this._lineWidthStack.length)throw Error("pushed too many line widths - check push/pop pairs");this._lineWidthStack.push(q);this._lineWidth=q}PopLineWidth(){if(1>=this._lineWidthStack.length)throw 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(q){if("butt"===q)this.PushLineCapButt();else if("square"===q)this.PushLineCapSquare();else if("zag"===q)this.PushLineCapZag();else throw Error("invalid line cap");}PushLineCapButt(){if(100<=this._lineCapStack.length)throw Error("pushed too many line caps - check push/pop pairs");this._lineCapStack.push(0);this._lineCap=0}PushLineCapSquare(){if(100<=this._lineCapStack.length)throw Error("pushed too many line caps - check push/pop pairs");this._lineCapStack.push(1);this._lineCap=1}PushLineCapZag(){if(100<=this._lineCapStack.length)throw Error("pushed too many line caps - check push/pop pairs");this._lineCapStack.push(2);this._lineCap=2}PopLineCap(){if(1>=this._lineCapStack.length)throw Error("cannot pop last line cap - check push/pop pairs");this._lineCapStack.pop();this._lineCap=this._lineCapStack.at(-1)}SetLineOffset(q){this._lineOffset=q;this._lineOffsetStack[this._lineOffsetStack.length-1]=q}GetLineOffset(){return this._lineOffset}PushLineOffset(q){if(100<=this._lineOffsetStack.length)throw Error("pushed too many line offsets - check push/pop pairs");this._lineOffsetStack.push(q);this._lineOffset=q}PopLineOffset(){if(1>=this._lineOffsetStack.length)throw Error("cannot pop last line offset - check push/pop pairs");this._lineOffsetStack.pop();this._lineOffset=this._lineOffsetStack.at(-1)}ConvexPoly(q){var t=q.length/2;if(3>t)throw Error("need at least 3 points");t-=2;const r=t-1,w=q[0],y=q[1];for(let B=0;B<t;B+=2){const E=2*B,H=q[E+2],K=q[E+3],C=q[E+4],A=q[E+5];B===r?this.Quad2(w,y,H,K,C,A,C,A):this.Quad2(w,y,H,K,C,A,q[E+6],q[E+7])}}GetNumVertexComponents(){return 3}Finish(){this.EndBatch(!0);this._frameNumber++}GetFrameNumber(){return this._frameNumber}IncrementFrameNumber(){this._frameNumber++}SetMipmapsEnabled(q){this._enableMipmaps=!!q}AreMipmapsEnabled(){return this._enableMipmaps}SetHasMajorPerformanceCaveat(q){this._hasMajorPerformanceCaveat=!!q}HasMajorPerformanceCaveat(){return this._hasMajorPerformanceCaveat}IsWebGL(){return!1}IsWebGPU(){return!1}}}
  {"use strict";const e=self.C3;e.Gfx.StateGroup=class{constructor(a,b,d,c,f){this._renderer=a;this._refCount=0;this._shaderProgram=null;this._shaderProgramName="";this._blendMode=d;this._color=e.New(e.Color);this._color.set(c);this._zElevation=f;"string"===typeof b?this._shaderProgramName=b:(this._shaderProgram=b,this._shaderProgramName=this._shaderProgram.GetName())}Release(){if(0<this._refCount)throw Error("releasing state group still in use");this._shaderProgram=this._renderer=null;this._shaderProgramName=""}Apply(){const a=this._renderer;a.SetProgram(this._shaderProgram);a.SetBlendMode(this._blendMode);a.SetColor(this._color);a.SetCurrentZ(this._zElevation);a._SetCurrentStateGroup(this)}GetKey(){return e.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(a){this._shaderProgram=a.GetShaderProgramByName(this._shaderProgramName);if(!this._shaderProgram)throw Error("failed to restore shader program");}static MakeKey(a,b,d,c){return("string"===typeof a?a:a.GetName())+","+b+","+d.getR()+","+d.getG()+","+d.getB()+","+d.getA()+","+c}}}
  {"use strict";const e=self.C3,a=e.New(e.Quad);function b(d,c,f){const h=f.getTlx(),g=f.getTly(),l=f.getTrx()-h,m=f.getTry()-g,u=f.getBlx()-h;f=f.getBly()-g;return[h+l*d+u*c,g+m*d+f*c]}e.Gfx.MeshPoint=class{constructor(d,c,f){this._mesh=d;this._col=c;this._row=f;this._v=this._u=this._zElevation=this._y=this._x=0}_Init(d,c,f,h){this._x=d;this._y=c;this._u=f;this._v=h}GetX(){return this._x}SetX(d){this._x!==d&&(this._x=d,this._mesh._SetPointsChanged())}GetY(){return this._y}SetY(d){this._y!==d&&(this._y=d,this._mesh._SetPointsChanged())}GetZElevation(){return this._zElevation}SetZElevation(d){this._zElevation!==d&&(this._zElevation=Math.max(d,0),this._mesh._SetPointsChanged())}GetU(){return this._u}SetU(d){this._u=d}GetV(){return this._v}SetV(d){this._v=d}_Interpolate_TexRect(d,c,f){[this._x,this._y]=b(d._x,d._y,c);this._zElevation=d._zElevation;this._u=e.lerp(f.getLeft(),f.getRight(),d._u);this._v=e.lerp(f.getTop(),f.getBottom(),d._v)}_Interpolate_TexQuad(d,c,f){[this._x,this._y]=b(d._x,d._y,c);this._zElevation=d._zElevation;[this._u,this._v]=b(d._u,d._v,f)}SaveToJson(){return{x:this.GetX(),y:this.GetY(),z:this.GetZElevation(),u:this.GetU(),v:this.GetV()}}LoadFromJson(d){this.SetX(d.x);this.SetY(d.y);d.hasOwnProperty("z")&&this.SetZElevation(d.z);this.SetU(d.u);this.SetV(d.v)}GetMesh(){return this._mesh}GetColumn(){return this._col}GetRow(){return this._row}};e.Gfx.Mesh=class{constructor(d,c,f){if(2>d||2>c)throw Error("invalid mesh size");this._hsize=d;this._vsize=c;this._owner=f||null;this._pts=[];this._minY=this._minX=0;this._maxY=this._maxX=1;this._maxZ=0;this._pointsChanged=!1;f=d-1;const h=c-1;for(let g=0;g<c;++g){const l=[];for(let m=0;m<d;++m){const u=e.New(e.Gfx.MeshPoint,this,m,g),x=m/f,n=g/h;u._Init(x,n,x,n);l.push(u)}this._pts.push(l)}}Release(){e.clearArray(this._pts)}GetHSize(){return this._hsize}GetVSize(){return this._vsize}GetOwner(){return this._owner}_GetPoints(){return this._pts}_SetPointsChanged(){this._pointsChanged=!0}_MaybeComputeBounds(){if(this._pointsChanged){var d=Infinity,c=Infinity,f=-Infinity,h=-Infinity,g=0;for(const l of this._pts)for(const m of l){const u=m.GetX(),x=m.GetY();d=Math.min(d,u);c=Math.min(c,x);f=Math.max(f,u);h=Math.max(h,x);g=Math.max(g,m.GetZElevation())}this._minX=d;this._minY=c;this._maxX=f;this._maxY=h;this._maxZ=g;this._pointsChanged=!1}}GetMinX(){this._MaybeComputeBounds();return this._minX}GetMinY(){this._MaybeComputeBounds();return this._minY}GetMaxX(){this._MaybeComputeBounds();return this._maxX}GetMaxY(){this._MaybeComputeBounds();return this._maxY}GetMaxZ(){this._MaybeComputeBounds();return this._maxZ}HasAnyZElevation(){return 0<this.GetMaxZ()}GetMeshPointAt(d,c){d=Math.floor(d);c=Math.floor(c);return 0>d||d>=this._hsize||0>c||c>=this._vsize?null:this._pts[c][d]}CalculateTransformedMesh(d,c,f){const h=f instanceof e.Rect;if(d.GetHSize()!==this.GetHSize()||d.GetVSize()!==this.GetVSize())throw Error("source mesh wrong size");d=d._pts;const g=this._pts;for(let l=0,m=g.length;l<m;++l){const u=d[l],x=g[l];for(let n=0,q=x.length;n<q;++n){const t=u[n],r=x[n];h?r._Interpolate_TexRect(t,c,f):r._Interpolate_TexQuad(t,c,f)}}}Draw(d){const c=this._pts;let f=c[0];for(let h=1,g=c.length;h<g;++h){const l=c[h];let m=f[0],u=l[0];for(let x=1,n=l.length;x<n;++x){const q=f[x],t=l[x];a.set(m.GetU(),m.GetV(),q.GetU(),q.GetV(),t.GetU(),t.GetV(),u.GetU(),u.GetV());d.Quad3D2(m.GetX(),m.GetY(),m.GetZElevation(),q.GetX(),q.GetY(),q.GetZElevation(),t.GetX(),t.GetY(),t.GetZElevation(),u.GetX(),u.GetY(),u.GetZElevation(),a);m=q;u=t}f=l}}Outline(d,c){c||(c=(g,l,m)=>[g,l,m]);const f=this._pts;let h=f[0];for(let g=1,l=f.length;g<l;++g){const m=f[g];let u=h[0],x=m[0];for(let n=1,q=m.length;n<q;++n){const t=h[n],r=m[n],[w,y,B]=c(u.GetX(),u.GetY(),u.GetZElevation()),[E,H,K]=c(t.GetX(),t.GetY(),t.GetZElevation()),[C,A,F]=c(r.GetX(),r.GetY(),r.GetZElevation()),[J,L,R]=c(x.GetX(),x.GetY(),x.GetZElevation());d.Line3D(w,y,B,E,H,K);d.Line3D(w,y,B,C,A,F);d.Line3D(w,y,B,J,L,R);n===q-1&&d.Line3D(E,H,K,C,A,F);g===l-1&&d.Line3D(J,L,R,C,A,F);u=t;x=r}h=m}}InsertPolyMeshVertices(d){d=d.pointsArr();const c=[],f=this.GetHSize()-1,h=this.GetVSize()-1,g=1/f,l=1/h,m=f-1,u=h-1;let x=d[0],n=d[1],q=e.clamp(Math.floor(x*f),0,m),t=e.clamp(Math.floor(n*h),0,u),r=0,w=0,y=0;var B=-1;const E=()=>{x=e.clamp(e.lerp(x,r,y),0,1);n=e.clamp(e.lerp(n,w,y),0,1);c.push(x,n)};for(let H=0,K=d.length;H<K;H+=2)for(x=d[H],n=d[H+1],c.push(x,n),q=e.clamp(Math.floor(x*f),0,m),t=e.clamp(Math.floor(n*h),0,u),B=(H+2)%K,r=d[B],w=d[B+1],B=-1;;){if(1E6<c.length)throw Error("Too many mesh poly points");const C=q*g,A=t*l,F=(q+1)*g,J=(t+1)*l;e.isPointInTriangleInclusive(x,n,C,A,F,A,F,J);if(0!==B&&(y=e.rayIntersectExtended(x,n,r,w,C,A,F,J,-.001),0<=y&&.99999999>=y)){E();B=0;continue}if(0<t&&2!==B&&(y=e.rayIntersectExtended(x,n,r,w,C,A,F,A,.001),0<=y&&.99999999>=y)){E();t--;B=4;continue}if(q<m&&3!==B&&(y=e.rayIntersectExtended(x,n,r,w,F,A,F,J,.001),0<=y&&.99999999>=y)){E();q++;B=1;continue}if(0<q&&1!==B&&(y=e.rayIntersectExtended(x,n,r,w,C,A,C,J,.001),0<=y&&.99999999>=y)){E();q--;B=3;continue}if(t<u&&4!==B&&(y=e.rayIntersectExtended(x,n,r,w,C,J,F,J,.001),0<=y&&.99999999>=y)){E();t++;B=2;continue}break}return e.New(e.CollisionPoly,c)}TransformCollisionPoly(d,c){d=this._TransformPolyPoints(d);this._SimplifyPoly(d);c.setPoints(d)}_TransformPolyPoints(d){const c=[];d=d.pointsArr();for(let f=0,h=d.length;f<h;f+=2){const[g,l]=this.TransformPoint(d[f],d[f+1]);c.push(g,l)}return c}TransformPoint(d,c){var f=this.GetHSize()-1,h=this.GetVSize()-1,g=1/f,l=1/h;f=e.clamp(Math.floor(d*f),0,f-1);const m=e.clamp(Math.floor(c*h),0,h-1);h=f*g;const u=m*l,x=(f+1)*g,n=(m+1)*l,q=this.GetMeshPointAt(f,m),t=this.GetMeshPointAt(f+1,m+1),r=e.isPointInTriangleInclusive(d,c,h,u,x,u,x,n);g=r?h+g:h;l=r?u:u+l;f=this.GetMeshPointAt(f+(r?1:0),m+(r?0:1));const[w,y,B]=e.triangleCartesianToBarycentric(d,c,h,u,g,l,x,n);return e.triangleBarycentricToCartesian(w,y,B,q.GetX(),q.GetY(),f.GetX(),f.GetY(),t.GetX(),t.GetY())}_SimplifyPoly(d){const c=[];let f=d[0],h=d[1],g=f-d.at(-2),l=h-d.at(-1);for(let u=0,x=d.length;u<x;u+=2){var m=(u+2)%x;const n=d[m];m=d[m+1];const q=n-f,t=m-h,r=1E-7>Math.abs(t)&&1E-7>Math.abs(l)&&Math.sign(q)===Math.sign(g);(!(1E-7>Math.abs(q)&&1E-7>Math.abs(g)&&Math.sign(t)===Math.sign(l)||r)&&1E-7<Math.abs(q/g-t/l)||0==q&&0===t)&&c.push(f,h);f=n;h=m;g=q;l=t}6<=c.length&&c.length<d.length&&e.shallowAssignArray(d,c)}SaveToJson(){return{cols:this.GetHSize(),rows:this.GetVSize(),points:this._pts.map(d=>d.map(c=>c.SaveToJson()))}}LoadFromJson(d){const c=this.GetHSize(),f=this.GetVSize();if(d.cols!==c||d.rows!==f)throw Error("mesh data wrong size");d=d.points;for(let h=0;h<f;++h){const g=d[h];for(let l=0;l<c;++l)this.GetMeshPointAt(l,h).LoadFromJson(g[l])}}}}
  {"use strict";const e=self.C3,a=new Set(["rgba8","rgb8","rgba4","rgb5_a1","rgb565"]),b=new Set(["nearest","bilinear","trilinear"]),d=new Set(["default","low","high"]),c=new Set(["clamp-to-edge","repeat","mirror-repeat"]);function f(m,u){let x,n;switch(m){case "rgba8":m=u.RGBA8;n=x=u.RGBA;u=u.UNSIGNED_BYTE;break;case "rgb8":m=u.RGB8;n=x=u.RGB;u=u.UNSIGNED_BYTE;break;case "rgba4":m=u.RGBA4;n=x=u.RGBA;u=u.UNSIGNED_SHORT_4_4_4_4;break;case "rgb5_a1":m=u.RGB5_A1;n=x=u.RGBA;u=u.UNSIGNED_SHORT_5_5_5_1;break;case "rgb565":m=u.RGB565;n=x=u.RGB;u=u.UNSIGNED_SHORT_5_6_5;break;default:throw Error("invalid pixel format");}return{sizedinternalformat:m,internalformat:x,format:n,type:u}}const h={wrapX:"clamp-to-edge",wrapY:"clamp-to-edge",sampling:"trilinear",anisotropy:0,pixelFormat:"rgba8",mipMap:!0,mipMapQuality:"default",premultiplyAlpha:!0,isSvg:!1,width:-1,height:-1},g={premultiplyAlpha:!0,flipY:!1},l=new Set;e.Gfx.WebGLRendererTexture=class{constructor(m){this._renderer=m;this._texture=null;this._height=this._width=0;this._isStatic=!0;this._wrapY=this._wrapX="clamp-to-edge";this._sampling="trilinear";this._anisotropy=0;this._pixelFormat="rgba8";this._isMipMapped=!1;this._mipMapQuality="default";this._refCount=0}_CreateStatic(m,u){if(!("undefined"!==typeof HTMLImageElement&&m instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&m instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&m instanceof ImageBitmap||"undefined"!==typeof OffscreenCanvas&&m instanceof OffscreenCanvas||m instanceof ImageData||m instanceof ArrayBuffer)&&null!==m)throw Error("invalid texture source");u=Object.assign({},h,u);if(this._texture)throw Error("already created texture");this._wrapX=u.wrapX;this._wrapY=u.wrapY;this._sampling=u.sampling;this._anisotropy=u.anisotropy;this._pixelFormat=u.pixelFormat;this._isMipMapped=!!u.mipMap&&this._renderer.AreMipmapsEnabled();this._mipMapQuality=u.mipMapQuality;if(!c.has(this._wrapX)||!c.has(this._wrapY))throw Error("invalid wrap mode");if(!b.has(this._sampling))throw Error("invalid sampling");if(!a.has(this._pixelFormat))throw Error("invalid pixel format");if(!d.has(this._mipMapQuality))throw Error("invalid mipmap quality");this._isStatic=!0;if(m instanceof ArrayBuffer||null===m||u.isSvg){if(this._width=u.width,this._height=u.height,m instanceof ArrayBuffer&&m.byteLength!==this._width*this._height*4)throw Error("ArrayBuffer wrong size");}else this._width=m.width,this._height=m.height;if(0>=this._width||0>=this._height)throw Error("invalid texture data size");if(u.isSvg){var x=e.CreateCanvas(this._width,this._height);x.getContext("2d").drawImage(m,0,0,this._width,this._height);m=x}var n=e.isPOT(this._width)&&e.isPOT(this._height);x=this._renderer.GetMaxTextureSize();if(this._width>x||this._height>x)throw Error("texture data exceeds maximum texture size");x=this._renderer.GetContext();var q=this._renderer.GetWebGLVersionNumber();this._texture=x.createTexture();x.bindTexture(x.TEXTURE_2D,this._texture);x.pixelStorei(x.UNPACK_PREMULTIPLY_ALPHA_WEBGL,u.premultiplyAlpha);x.pixelStorei(x.UNPACK_FLIP_Y_WEBGL,!1);u=f(this._pixelFormat,x);if(this._renderer.SupportsNPOTTextures()||n||!this._IsTiled())2<=q?(x.texStorage2D(x.TEXTURE_2D,this._isMipMapped?Math.floor(Math.log2(Math.max(this._width,this._height))+1):1,u.sizedinternalformat,this._width,this._height),m instanceof ArrayBuffer?x.texSubImage2D(x.TEXTURE_2D,0,0,0,this._width,this._height,u.format,u.type,new Uint8Array(m)):null!==m&&x.texSubImage2D(x.TEXTURE_2D,0,0,0,u.format,u.type,m)):m instanceof ArrayBuffer?x.texImage2D(x.TEXTURE_2D,0,u.internalformat,this._width,this._height,0,u.format,u.type,new Uint8Array(m)):null===m?x.texImage2D(x.TEXTURE_2D,0,u.internalformat,this._width,this._height,0,u.format,u.type,null):x.texImage2D(x.TEXTURE_2D,0,u.internalformat,u.format,u.type,m);else{if(null===m)throw Error("cannot pass null data when creating a NPOT tiled texture without NPOT support");m instanceof ArrayBuffer&&(m=new ImageData(new Uint8ClampedArray(m),this._width,this._height));m instanceof ImageData&&(n=e.CreateCanvas(this._width,this._height),n.getContext("2d").putImageData(m,0,0),m=n);n=e.CreateCanvas(e.nextHighestPowerOfTwo(this._width),e.nextHighestPowerOfTwo(this._height));q=n.getContext("2d");q.imageSmoothingEnabled="nearest"!==this._sampling;q.drawImage(m,0,0,this._width,this._height,0,0,n.width,n.height);x.texImage2D(x.TEXTURE_2D,0,u.internalformat,u.format,u.type,n)}null!==m&&this._SetTextureParameters(x);x.bindTexture(x.TEXTURE_2D,null);this._renderer._ResetLastTexture();this._refCount=1;l.add(this)}_CreateDynamic(m,u,x){x=Object.assign({},h,x);if(this._texture)throw Error("already created texture");this._wrapX=x.wrapX;this._wrapY=x.wrapY;this._sampling=x.sampling;this._pixelFormat=x.pixelFormat;this._isMipMapped=!!x.mipMap&&this._renderer.AreMipmapsEnabled();this._mipMapQuality=x.mipMapQuality;if(!c.has(this._wrapX)||!c.has(this._wrapY))throw Error("invalid wrap mode");if(!b.has(this._sampling))throw Error("invalid sampling");if(!a.has(this._pixelFormat))throw Error("invalid pixel format");if(!d.has(this._mipMapQuality))throw Error("invalid mipmap quality");this._isStatic=!1;this._width=Math.floor(m);this._height=Math.floor(u);m=e.isPOT(this._width)&&e.isPOT(this._height);u=this._renderer.GetMaxTextureSize();if(0>=this._width||0>=this._height)throw Error("invalid texture size");if(this._width>u||this._height>u)throw Error("texture exceeds maximum texture size");if(!this._renderer.SupportsNPOTTextures()&&this._IsTiled()&&!m)throw Error("non-power-of-two tiled textures not supported");m=this._renderer.GetContext();u=this._renderer.GetWebGLVersionNumber();this._texture=m.createTexture();m.bindTexture(m.TEXTURE_2D,this._texture);m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL,x.premultiplyAlpha);m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,!1);x=f(this._pixelFormat,m);m.texImage2D(m.TEXTURE_2D,0,2<=u?x.sizedinternalformat:x.internalformat,this._width,this._height,0,x.format,x.type,null);this._SetTextureParameters(m);m.bindTexture(m.TEXTURE_2D,null);this._renderer._ResetLastTexture();this._refCount=1;l.add(this)}_GetMipMapHint(m){if("default"===this._mipMapQuality)return this._isStatic?m.NICEST:m.FASTEST;if("low"===this._mipMapQuality)return m.FASTEST;if("high"===this._mipMapQuality)return m.NICEST;throw Error("invalid mipmap quality");}_IsTiled(){return"clamp-to-edge"!==this._wrapX||"clamp-to-edge"!==this._wrapY}_GetTextureWrapMode(m,u){if("clamp-to-edge"===u)return m.CLAMP_TO_EDGE;if("repeat"===u)return m.REPEAT;if("mirror-repeat"===u)return m.MIRRORED_REPEAT;throw Error("invalid wrap mode");}_SetTextureParameters(m){var u=e.isPOT(this._width)&&e.isPOT(this._height);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,this._GetTextureWrapMode(m,this._wrapX));m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,this._GetTextureWrapMode(m,this._wrapY));"nearest"===this._sampling?(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.NEAREST),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.NEAREST),this._isMipMapped=!1):(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.LINEAR),(u||this._renderer.SupportsNPOTTextures())&&this._isMipMapped?(m.hint(m.GENERATE_MIPMAP_HINT,this._GetMipMapHint(m)),m.generateMipmap(m.TEXTURE_2D),u="trilinear"===this._sampling&&!this._renderer.HasMajorPerformanceCaveat(),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,u?m.LINEAR_MIPMAP_LINEAR:m.LINEAR_MIPMAP_NEAREST)):(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.LINEAR),this._isMipMapped=!1));(u=this._renderer._GetAnisotropicExtension())&&0<this._anisotropy&&"nearest"!==this._sampling&&m.texParameterf(m.TEXTURE_2D,u.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(this._anisotropy,this._renderer._GetMaxAnisotropy()))}_Update(m,u){if(!("undefined"!==typeof HTMLImageElement&&m instanceof HTMLImageElement||"undefined"!==typeof HTMLVideoElement&&m instanceof HTMLVideoElement||"undefined"!==typeof HTMLCanvasElement&&m instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&m instanceof ImageBitmap||"undefined"!==typeof OffscreenCanvas&&m instanceof OffscreenCanvas||m instanceof ImageData))throw Error("invalid texture source");if(!this._texture||0>=this._refCount)throw Error("texture not created");if(this._isStatic)throw Error("cannot update static texture");u=Object.assign({},g,u);const x=m.width||m.videoWidth,n=m.height||m.videoHeight;var q=this._renderer.GetWebGLVersionNumber();const t=this._renderer.GetContext();t.bindTexture(t.TEXTURE_2D,this._texture);t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,u.premultiplyAlpha);t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!!u.flipY);u=f(this._pixelFormat,t);q=2<=q?u.sizedinternalformat:u.internalformat;try{if(this._width===x&&this._height===n){const r=e.isPOT(this._width)&&e.isPOT(this._height);t.texSubImage2D(t.TEXTURE_2D,0,0,0,u.format,u.type,m);(r||this._renderer.SupportsNPOTTextures())&&this._isMipMapped&&(t.hint(t.GENERATE_MIPMAP_HINT,this._GetMipMapHint(t)),t.generateMipmap(t.TEXTURE_2D))}else{this._width=x;this._height=n;const r=e.isPOT(this._width)&&e.isPOT(this._height);if(!this._renderer.SupportsNPOTTextures()&&this._IsTiled()&&!r)throw Error("non-power-of-two tiled textures not supported");t.texImage2D(t.TEXTURE_2D,0,q,u.format,u.type,m);(r||this._renderer.SupportsNPOTTextures())&&this._isMipMapped&&(t.hint(t.GENERATE_MIPMAP_HINT,this._GetMipMapHint(t)),t.generateMipmap(t.TEXTURE_2D))}}catch(r){console.error("Error updating WebGL texture: ",r)}t.bindTexture(t.TEXTURE_2D,null);this._renderer._ResetLastTexture()}_Delete(){if(0<this._refCount)throw Error("texture still has references");if(!this._texture)throw Error("already deleted texture");l.delete(this);this._renderer.GetContext().deleteTexture(this._texture);this._texture=null}IsValid(){return!!this._texture}_GetTexture(){return this._texture}GetRenderer(){return this._renderer}AddReference(){this._refCount++}SubtractReference(){if(0>=this._refCount)throw Error("no more references");this._refCount--}GetReferenceCount(){return this._refCount}GetWidth(){return this._width}GetHeight(){return this._height}IsStatic(){return this._isStatic}GetEstimatedMemoryUsage(){let m=this._width*this._height;switch(this._pixelFormat){case "rgba8":m*=4;break;case "rgb8":m*=3;break;case "rgba4":case "rgb5_a1":case "rgb565":m*=2}this._isMipMapped&&(m+=Math.floor(m/3));return m}static OnContextLost(){l.clear()}static allTextures(){return l.values()}}}
  {"use strict";const e=self.C3,a=self.glMatrix.mat4,b=new Set(["nearest","bilinear","trilinear"]),d={sampling:"trilinear",alpha:!0,depth:!1,isSampled:!0,isDefaultSize:!0,multisampling:0},c=new Set;e.Gfx.WebGLRenderTarget=class{constructor(f){this._renderer=f;this._renderBuffer=this._texture=this._frameBuffer=null;this._height=this._width=0;this._isDefaultSize=!0;this._sampling="trilinear";this._alpha=!0;this._depth=!1;this._isSampled=!0;this._multisampling=0;this._projectionMatrix=a.create()}_Create(f,h,g){g=Object.assign({},d,g);const l=this._renderer.GetWebGLVersionNumber();if(this._texture||this._renderBuffer)throw Error("already created render target");this._sampling=g.sampling;this._alpha=!!g.alpha;this._depth=!!g.depth;this._isSampled=!!g.isSampled;this._isDefaultSize=!!g.isDefaultSize;this._multisampling=g.multisampling;if(!b.has(this._sampling))throw Error("invalid sampling");if(0<this._multisampling&&(2>l||this._isSampled))throw Error("invalid use of multisampling");2>l&&(this._isSampled=!0);this._width=f;this._height=h;if(0>=this._width||0>=this._height)throw Error("invalid render target size");this._CalculateProjection();f=this._renderer.GetContext();this._frameBuffer=f.createFramebuffer();f.bindFramebuffer(f.FRAMEBUFFER,this._frameBuffer);this._isSampled?(this._texture=this._renderer.CreateDynamicTexture(this._width,this._height,{sampling:this._sampling,pixelFormat:this._alpha?"rgba8":"rgb8",mipMap:!1}),h=this._texture._GetTexture(),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,h,0)):(this._renderBuffer=f.createRenderbuffer(),f.bindRenderbuffer(f.RENDERBUFFER,this._renderBuffer),h=this._alpha?f.RGBA8:f.RGB8,0<this._multisampling&&((g=f.getInternalformatParameter(f.RENDERBUFFER,h,f.SAMPLES))&&g[0]?(g=g[0],this._multisampling>g&&(this._multisampling=g)):this._multisampling=0),0===this._multisampling?f.renderbufferStorage(f.RENDERBUFFER,h,this._width,this._height):f.renderbufferStorageMultisample(f.RENDERBUFFER,this._multisampling,h,this._width,this._height),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.RENDERBUFFER,this._renderBuffer),f.bindRenderbuffer(f.RENDERBUFFER,null));h=this._renderer._GetDepthBuffer();this._depth&&h&&f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.RENDERBUFFER,h);f.bindFramebuffer(f.FRAMEBUFFER,null);c.add(this)}_Resize(f,h){if(this._width!==f||this._height!==h)this._width=f,this._height=h,this._CalculateProjection(),f=this._renderer.GetContext(),f.bindFramebuffer(f.FRAMEBUFFER,this._frameBuffer),this._texture?this._texture._Update(new ImageData(this._width,this._height)):(f.bindRenderbuffer(f.RENDERBUFFER,this._renderBuffer),f.renderbufferStorage(f.RENDERBUFFER,this._alpha?f.RGBA8:f.RGB8,this._width,this._height),f.bindRenderbuffer(f.RENDERBUFFER,null)),h=this._renderer._GetDepthBuffer(),this._depth&&h&&f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.RENDERBUFFER,h),f.bindFramebuffer(f.FRAMEBUFFER,null)}_Delete(){if(!this._texture&&!this._renderBuffer)throw Error("already deleted render target");c.delete(this);const f=this._renderer.GetContext();f.bindFramebuffer(f.FRAMEBUFFER,this._frameBuffer);this._texture?(f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,null,0),this._renderer.DeleteTexture(this._texture),this._texture=null):this._renderBuffer&&(f.framebufferRenderbuffer(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.RENDERBUFFER,null),f.deleteRenderbuffer(this._renderBuffer),this._renderBuffer=null);f.bindFramebuffer(f.FRAMEBUFFER,null);2<=this._renderer.GetWebGLVersionNumber()&&(f.bindFramebuffer(f.READ_FRAMEBUFFER,null),f.bindFramebuffer(f.DRAW_FRAMEBUFFER,null));f.deleteFramebuffer(this._frameBuffer);this._frameBuffer=this._renderer.GetBatchState().currentFramebuffer=null}_CalculateProjection(){this._renderer.CalculatePerspectiveMatrix(this._projectionMatrix,this._width/this._height)}_GetFramebuffer(){return this._frameBuffer}GetRenderer(){return this._renderer}GetTexture(){return this._texture}GetProjectionMatrix(){return this._projectionMatrix}IsLinearSampling(){return"nearest"!==this._sampling}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 f={sampling:this._sampling,alpha:this._alpha,isSampled:this._isSampled};this._isDefaultSize||(f.width=this._width,f.height=this._height);return f}IsCompatibleWithOptions(f){f=Object.assign({},d,f);return"nearest"!==f.sampling!==this.IsLinearSampling()||!!f.alpha!==this.HasAlpha()||!!f.depth!==this.HasDepthBuffer()||2<=this._renderer.GetWebGLVersionNumber()&&!!f.isSampled!==this.IsSampled()?!1:"number"===typeof f.width||"number"===typeof f.height?!this.IsDefaultSize()&&this.GetWidth()===f.width&&this.GetHeight()===f.height:this.IsDefaultSize()}_GetWebGLTexture(){return this._texture?this._texture._GetTexture():null}GetEstimatedMemoryUsage(){return this._texture?this._texture.GetEstimatedMemoryUsage():this._width*this._height*(this._alpha?4:3)}static async DebugReadPixelsToBlob(f,h){f=await f.ReadBackRenderTargetToImageData(h,!0);return await e.ImageDataToBlob(f)}static OnContextLost(){c.clear()}static allRenderTargets(){return c.values()}static ResizeAll(f,h){for(const g of c)g.IsDefaultSize()&&g._Resize(f,h)}}}
  {"use strict";const e=self.C3,a=new Set("aPos aTex aPoints matP matMV samplerFront samplerBack destStart destEnd srcStart srcEnd srcOriginStart srcOriginEnd pixelSize seconds layerScale layerAngle layoutStart layoutEnd color color2_ pointTexStart pointTexEnd zElevation tileSize tileSpacing outlineThickness".split(" "));e.Gfx.WebGLShaderProgram=class{static async Compile(b,d,c,f){const h=b.GetContext(),g=h.createShader(h.FRAGMENT_SHADER);h.shaderSource(g,d);h.compileShader(g);d=h.createShader(h.VERTEX_SHADER);h.shaderSource(d,c);h.compileShader(d);const l=h.createProgram();h.attachShader(l,g);h.attachShader(l,d);h.bindAttribLocation(l,0,"aPos");h.bindAttribLocation(l,1,"aTex");h.bindAttribLocation(l,2,"aPoints");h.linkProgram(l);const m=b._GetParallelShaderCompileExtension();m?await b._WaitForObjectReady(()=>h.getProgramParameter(l,m.COMPLETION_STATUS_KHR)):await e.Wait(5);if(!h.getShaderParameter(g,h.COMPILE_STATUS))throw f=h.getShaderInfoLog(g),h.deleteShader(g),h.deleteShader(d),h.deleteProgram(l),Error("Error compiling fragment shader: "+
  f);if(!h.getShaderParameter(d,h.COMPILE_STATUS))throw f=h.getShaderInfoLog(d),h.deleteShader(g),h.deleteShader(d),h.deleteProgram(l),Error("Error compiling vertex shader: "+f);if(!h.getProgramParameter(l,h.LINK_STATUS))throw f=h.getProgramInfoLog(l),h.deleteShader(g),h.deleteShader(d),h.deleteProgram(l),Error("Error linking shader program: "+f);(b=e.FilterUnprintableChars(h.getProgramInfoLog(l)||"").trim())&&!e.IsStringAllWhitespace(b)&&console.info(`[WebGL] Shader program '${f}' compilation log: `,b);h.deleteShader(g);h.deleteShader(d);return l}static async Create(b,d,c,f){c=await e.Gfx.WebGLShaderProgram.Compile(b,d.src,c,f);return new e.Gfx.WebGLShaderProgram(b,c,d,f)}constructor(b,d,c,f){const h=b.GetContext();var g=b.GetBatchState();b.EndBatch();h.useProgram(d);this._gl=h;this._renderer=b;this._name=f;this._shaderProgram=d;this._isDeviceTransform="<default-device-transform>"===f;f=h.getAttribLocation(d,"aPos");const l=h.getAttribLocation(d,"aTex");this._locAPoints=h.getAttribLocation(d,"aPoints");-1!==f&&(h.bindBuffer(h.ARRAY_BUFFER,b._vertexBuffer),h.vertexAttribPointer(f,b.GetNumVertexComponents(),h.FLOAT,!1,0,0),h.enableVertexAttribArray(f));-1!==l&&(h.bindBuffer(h.ARRAY_BUFFER,b._texcoordBuffer),h.vertexAttribPointer(l,2,h.FLOAT,!1,0,0),h.enableVertexAttribArray(l));-1!==this._locAPoints&&(h.bindBuffer(h.ARRAY_BUFFER,b._pointBuffer),h.vertexAttribPointer(this._locAPoints,4,h.FLOAT,!1,0,0),h.enableVertexAttribArray(this._locAPoints));h.bindBuffer(h.ARRAY_BUFFER,null);this._uMatP=new e.Gfx.WebGLShaderUniform(this,"matP","mat4");this._uMatMV=new e.Gfx.WebGLShaderUniform(this,"matMV","mat4");this._uColor=new e.Gfx.WebGLShaderUniform(this,"color","vec4");this._uSamplerFront=new e.Gfx.WebGLShaderUniform(this,"samplerFront","sampler");this._uPointTexStart=new e.Gfx.WebGLShaderUniform(this,"pointTexStart","vec2");this._uPointTexEnd=new e.Gfx.WebGLShaderUniform(this,"pointTexEnd","vec2");this._uZElevation=new e.Gfx.WebGLShaderUniform(this,"zElevation","float");this._uTileSize=new e.Gfx.WebGLShaderUniform(this,"tileSize","vec2");this._uTileSpacing=new e.Gfx.WebGLShaderUniform(this,"tileSpacing","vec2");this._uColor2=new e.Gfx.WebGLShaderUniform(this,"color2_","vec4");this._uOutlineThickness=new e.Gfx.WebGLShaderUniform(this,"outlineThickness","float");this._uSamplerBack=new e.Gfx.WebGLShaderUniform(this,"samplerBack","sampler");this._uDestStart=new e.Gfx.WebGLShaderUniform(this,"destStart","vec2");this._uDestEnd=new e.Gfx.WebGLShaderUniform(this,"destEnd","vec2");this._uSrcStart=new e.Gfx.WebGLShaderUniform(this,"srcStart","vec2");this._uSrcEnd=new e.Gfx.WebGLShaderUniform(this,"srcEnd","vec2");this._uSrcOriginStart=new e.Gfx.WebGLShaderUniform(this,"srcOriginStart","vec2");this._uSrcOriginEnd=new e.Gfx.WebGLShaderUniform(this,"srcOriginEnd","vec2");this._uPixelSize=new e.Gfx.WebGLShaderUniform(this,"pixelSize","vec2");this._uSeconds=new e.Gfx.WebGLShaderUniform(this,"seconds","float");this._uLayerScale=new e.Gfx.WebGLShaderUniform(this,"layerScale","float");this._uLayerAngle=new e.Gfx.WebGLShaderUniform(this,"layerAngle","float");this._uLayoutStart=new e.Gfx.WebGLShaderUniform(this,"layoutStart","vec2");this._uLayoutEnd=new e.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._uLayerScale.IsUsed()||this._uLayerAngle.IsUsed()||this._uLayoutStart.IsUsed()||this._uLayoutEnd.IsUsed());this._extendBoxHorizontal=c.extendBoxHorizontal||0;this._extendBoxVertical=c.extendBoxVertical||0;this._crossSampling=!!c.crossSampling;this._mustPreDraw=!!c.mustPreDraw;this._preservesOpaqueness=!!c.preservesOpaqueness;this._animated=!!c.animated;b=c.parameters||[];this._uCustomParameters=[];this._usesDest=this._uDestStart.IsUsed()||this._uDestEnd.IsUsed();this._usesAnySrcRectOrPixelSize=this._uPixelSize.IsUsed()||this._uSrcStart.IsUsed()||this._uSrcEnd.IsUsed()||this._uSrcOriginStart.IsUsed()||this._uSrcOriginEnd.IsUsed();this._needsPostDrawOrExtendBox=this._crossSampling||this._usesDest||0!==this._extendBoxHorizontal||0!==this._extendBoxVertical;this._hasCurrentMatMV=this._hasCurrentMatP=!1;this._uColor.Init4f(1,1,1,1);this._uColor2.Init4f(1,1,1,1);this._uSamplerFront.Init1i(0);this._uSamplerBack.Init1i(1);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._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 m of b)b=m[2],d=new e.Gfx.WebGLShaderUniform(this,m[0],b),"color"===b?d.Init3f(0,0,0):d.Init1f(0),this._uCustomParameters.push(d);this._isDeviceTransform?this._UpdateDeviceTransformUniforms(g.currentMatP):(this.UpdateMatP(g.currentMatP,!0),this.UpdateMatMV(g.currentMV,!0));g=g.currentShader;h.useProgram(g?g._shaderProgram:null)}Release(){this._gl.deleteProgram(this._shaderProgram);this._shaderProgram=null;this._renderer._RemoveShaderProgram(this);this._renderer=this._gl=null}GetName(){return this._name}GetWebGLContext(){return this._gl}GetShaderProgram(){return this._shaderProgram}UsesDest(){return this._usesDest}UsesCrossSampling(){return this._crossSampling}MustPreDraw(){return this._mustPreDraw}PreservesOpaqueness(){return this._preservesOpaqueness}ExtendsBox(){return 0!==this._extendBoxHorizontal||0!==this._extendBoxVertical}GetBoxExtendHorizontal(){return this._extendBoxHorizontal}GetBoxExtendVertical(){return this._extendBoxVertical}UsesAnySrcRectOrPixelSize(){return this._usesAnySrcRectOrPixelSize}NeedsPostDrawOrExtendsBox(){return this._needsPostDrawOrExtendBox}GetParameterCount(){return this._uCustomParameters.length}GetParameterType(b){return this._uCustomParameters[b].GetType()}AreCustomParametersAlreadySetInBatch(b){for(let d=0,c=b.length;d<c;++d)if(!this._uCustomParameters[d].IsSetToCustomInBatch(b[d]))return!1;return!0}SetCustomParametersInBatch(b){for(let d=0,c=b.length;d<c;++d)this._uCustomParameters[d].SetBatchValueCustom(b[d])}AreOptionalUniformsAlreadySetInBatch(b,d,c,f,h,g,l,m,u){return this._uSamplerBack.IsUsed()||this._uPixelSize.IsUsed()&&!this._uPixelSize.IsSetTo2InBatch(h,g)||this._uDestStart.IsUsed()&&!this._uDestStart.IsSetTo2InBatch(b.getLeft(),b.getTop())||this._uDestEnd.IsUsed()&&!this._uDestEnd.IsSetTo2InBatch(b.getRight(),b.getBottom())||this._uLayerScale.IsUsed()&&!this._uLayerScale.IsSetTo1InBatch(l)||this._uLayerAngle.IsUsed()&&!this._uLayerAngle.IsSetTo1InBatch(m)||this._uSrcStart.IsUsed()&&!this._uSrcStart.IsSetTo2InBatch(d.getLeft(),d.getTop())||this._uSrcEnd.IsUsed()&&!this._uSrcEnd.IsSetTo2InBatch(d.getRight(),d.getBottom())||this._uSrcOriginStart.IsUsed()&&!this._uSrcOriginStart.IsSetTo2InBatch(c.getLeft(),c.getTop())||this._uSrcOriginEnd.IsUsed()&&!this._uSrcOriginEnd.IsSetTo2InBatch(c.getRight(),c.getBottom())||this._uLayoutStart.IsUsed()&&!this._uLayoutStart.IsSetTo2InBatch(f.getLeft(),f.getTop())||this._uLayoutEnd.IsUsed()&&!this._uLayoutEnd.IsSetTo2InBatch(f.getTop(),f.getBottom())||this._uSeconds.IsUsed()&&!this._uSeconds.IsSetTo1InBatch(u)?!1:!0}SetOptionalUniformsInBatch(b,d,c,f,h,g,l,m,u){this._uSamplerBack.IsUsed()||(this._uPixelSize.IsUsed()&&this._uPixelSize.SetBatch2(h,g),this._uDestStart.IsUsed()&&this._uDestStart.SetBatch2(b.getLeft(),b.getTop()),this._uDestEnd.IsUsed()&&this._uDestEnd.SetBatch2(b.getRight(),b.getBottom()),this._uLayerScale.IsUsed()&&this._uLayerScale.SetBatch1(l),this._uLayerAngle.IsUsed()&&this._uLayerAngle.SetBatch1(m),this._uSrcStart.IsUsed()&&this._uSrcStart.SetBatch2(d.getLeft(),d.getTop()),this._uSrcEnd.IsUsed()&&this._uSrcEnd.SetBatch2(d.getRight(),d.getBottom()),this._uSrcOriginStart.IsUsed()&&this._uSrcOriginStart.SetBatch2(c.getLeft(),c.getTop()),this._uSrcOriginEnd.IsUsed()&&this._uSrcOriginEnd.SetBatch2(c.getRight(),c.getBottom()),this._uLayoutStart.IsUsed()&&this._uLayoutStart.SetBatch2(f.getLeft(),f.getTop()),this._uLayoutEnd.IsUsed()&&this._uLayoutEnd.SetBatch2(f.getTop(),f.getBottom()),this._uSeconds.IsUsed()&&this._uSeconds.SetBatch1(u))}IsAnimated(){return this._animated}UpdateMatP(b,d){this._hasCurrentMatP&&!d||this._isDeviceTransform||(this._uMatP.IsUsed()&&this._uMatP.UpdateMatrix4fv(b),this._hasCurrentMatP=!0)}SetMatPStale(){this._hasCurrentMatP=!1}UpdateMatMV(b,d){this._hasCurrentMatMV&&!d||this._isDeviceTransform||(this._uMatMV.IsUsed()&&this._uMatMV.UpdateMatrix4fv(b),this._hasCurrentMatMV=!0)}SetMatMVStale(){this._hasCurrentMatMV=!1}_UpdateDeviceTransformUniforms(b){if(!this._isDeviceTransform)throw Error("not device transform shader");this._uMatP.UpdateMatrix4fv(b);b=this._renderer;const d=b.GetWidth()/2,c=b.GetHeight()/2;b=b.CalculateLookAtModelView2(d,c,b.GetDefaultCameraZ()*self.devicePixelRatio,d,c,0);this._uMatMV.UpdateMatrix4fv(b)}UpdateColor(b){this._uColor.IsUsed()&&this._uColor.Update4f(b[0],b[1],b[2],b[3])}static GetReservedUniformNames(){return a}static GetDefaultVertexShaderSource(b){b=b?"highmedp":"mediump";return["#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif\nattribute highp vec3 aPos;",`attribute ${b} vec2 aTex;`,`varying ${b} vec2 vTex;`,"uniform highp mat4 matP;\nuniform highp mat4 matMV;\nvoid main(void) {\n\tgl_Position = matP * matMV * vec4(aPos, 1.0);\n\tvTex = aTex;\n}"].join("\n")}static GetTextureFillFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nuniform lowp sampler2D samplerFront;\nvoid main(void) {\n\tgl_FragColor = texture2D(samplerFront, vTex) * color;\n}"}static GetTilemapFragmentShaderSource(){return"#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif\nvarying highmedp vec2 vTex;\nuniform lowp vec4 color;\nuniform lowp sampler2D samplerFront;\nuniform highmedp vec2 srcStart;\nuniform highmedp vec2 pixelSize;\nuniform highmedp vec2 tileSize;\nuniform highmedp vec2 tileSpacing;\nvoid main(void) {\n\thighmedp vec2 tile = floor(vTex);\n\thighmedp vec2 tex = fract(vTex);\n\thighmedp vec2 tileOrigin = srcStart + tile * (tileSize + tileSpacing);\n\thighmedp vec2 lowerBound = tileOrigin + pixelSize / 2.0;\n\thighmedp vec2 upperBound = tileOrigin + tileSize - pixelSize / 2.0;\n\tgl_FragColor = texture2D(samplerFront, clamp(tex, lowerBound, upperBound), -16.0) * color;\n}"}static GetPointVertexShaderSource(b){return e.Gfx.WebGLShaderProgram.GetPointVertexShaderSource_WebGL1()}static GetPointFragmentShaderSource(b){return e.Gfx.WebGLShaderProgram.GetPointFragmentShaderSource_WebGL1()}static GetPointVertexShaderSource_WebGL1(){return"attribute vec4 aPoints;\nvarying float pointOpacity;\nuniform float zElevation;\nuniform mat4 matP;\nuniform mat4 matMV;\nvoid main(void) {\n\tgl_Position = matP * matMV * vec4(aPoints.xy, zElevation, 1.0);\n\tgl_PointSize = aPoints.z;\n\tpointOpacity = aPoints.w;\n}"}static GetPointFragmentShaderSource_WebGL1(){return"uniform lowp sampler2D samplerFront;\nvarying lowp float pointOpacity;\nuniform mediump vec2 pointTexStart;\nuniform mediump vec2 pointTexEnd;\nuniform lowp vec4 color;\nvoid main(void) {\n\tgl_FragColor = texture2D(samplerFront, mix(pointTexStart, pointTexEnd, gl_PointCoord)) * color * pointOpacity;\n}"}static GetColorFillFragmentShaderSource(){return"uniform lowp vec4 color;\nvoid main(void) {\n\tgl_FragColor = color;\n}"}static GetLinearGradientFillFragmentShaderSource(){return"precision lowp float;\nvarying mediump vec2 vTex;\nuniform vec4 color;\nuniform vec4 color2_;\nvec3 fromLinear(vec3 linearRGB)\n{\n\tbvec3 cutoff = lessThan(linearRGB, vec3(0.0031308));\n\tvec3 higher = vec3(1.055) * pow(abs(linearRGB), vec3(1.0/2.4)) - vec3(0.055);\n\tvec3 lower = linearRGB * vec3(12.92);\n\treturn mix(higher, lower, vec3(cutoff));\n}\nvec3 toLinear(vec3 sRGB)\n{\n\tbvec3 cutoff = lessThan(sRGB, vec3(0.04045));\n\tvec3 higher = pow(abs((sRGB + vec3(0.055))/vec3(1.055)), vec3(2.4));\n\tvec3 lower = sRGB/vec3(12.92);\n\treturn mix(higher, lower, vec3(cutoff));\n}\nvoid main(void) {\n\tvec3 linearGrad = mix(toLinear(color.rgb), toLinear(color2_.rgb), vTex.x);\n\tfloat a = mix(color.a, color2_.a, vTex.x);\n\tgl_FragColor = vec4(fromLinear(linearGrad) * a, a);\n}"}static GetSmoothLineFillFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nvoid main(void) {\n\tlowp float f = 1.0 - abs(vTex.y - 0.5) * 2.0;\n\tgl_FragColor = color * f;\n}"}static GetHardEllipseFillFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nvoid main(void) {\n\tmediump vec2 diff = vTex - vec2(0.5, 0.5);\n\tmediump vec2 diffSq = diff * diff;\n\tmediump float f = step(diffSq.x + diffSq.y, 0.25);\n\tgl_FragColor = color * f;\n}"}static GetHardEllipseOutlineFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nuniform mediump vec2 pixelSize;\nuniform mediump float outlineThickness;\nvoid main(void) {\n\tmediump vec2 diff = vTex - vec2(0.5, 0.5);\n\tmediump vec2 diffSq = diff * diff;\n\tmediump float distSq = diffSq.x + diffSq.y;\n\tmediump vec2 norm = normalize(diff);\n\tmediump vec2 halfNorm = norm * 0.5;\n\tmediump float innerF = step(distSq, 0.25);\n\tmediump vec2 innerEdge = halfNorm - pixelSize * norm * outlineThickness;\n\tmediump vec2 innerEdgeSq = innerEdge * innerEdge;\n\tmediump float outerF = step(innerEdgeSq.x + innerEdgeSq.y, distSq);\n\tgl_FragColor = color * innerF * outerF;\n}"}static GetSmoothEllipseFillFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nuniform mediump vec2 pixelSize;\nvoid main(void) {\n\tmediump vec2 diff = vTex - vec2(0.5, 0.5);\n\tmediump vec2 diffSq = diff * diff;\n\tmediump vec2 norm = normalize(diff);\n\tmediump vec2 halfNorm = norm * 0.5;\n\tmediump vec2 halfNormSq = halfNorm * halfNorm;\n\tmediump vec2 innerEdge = halfNorm - pixelSize * norm;\n\tmediump vec2 innerEdgeSq = innerEdge * innerEdge;\n\tmediump float f = smoothstep(halfNormSq.x + halfNormSq.y, innerEdgeSq.x + innerEdgeSq.y, diffSq.x + diffSq.y);\n\tgl_FragColor = color * f;\n}"}static GetSmoothEllipseOutlineFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nuniform mediump vec2 pixelSize;\nuniform mediump float outlineThickness;\nvoid main(void) {\n\tmediump vec2 diff = vTex - vec2(0.5, 0.5);\n\tmediump vec2 diffSq = diff * diff;\n\tmediump float distSq = diffSq.x + diffSq.y;\n\tmediump vec2 norm = normalize(diff);\n\tmediump vec2 halfNorm = norm * 0.5;\n\tmediump vec2 halfNormSq = halfNorm * halfNorm;\n\tmediump vec2 pxNorm = pixelSize * norm;\n\tmediump vec2 innerEdge1 = halfNorm - pxNorm;\n\tmediump vec2 innerEdge1Sq = innerEdge1 * innerEdge1;\n\tmediump float innerF = smoothstep(halfNormSq.x + halfNormSq.y, innerEdge1Sq.x + innerEdge1Sq.y, distSq);\n\tmediump vec2 innerEdge2 = halfNorm - pxNorm * outlineThickness;\n\tmediump vec2 innerEdge2Sq = innerEdge2 * innerEdge2;\n\tmediump vec2 innerEdge3 = halfNorm - pxNorm * (outlineThickness + 1.0);\n\tmediump vec2 innerEdge3Sq = innerEdge3 * innerEdge3;\n\tmediump float outerF = smoothstep(innerEdge3Sq.x + innerEdge3Sq.y, innerEdge2Sq.x + innerEdge2Sq.y, distSq);\n\tgl_FragColor = color * innerF * outerF;\n}"}}}
  {"use strict";const e=self.C3,a=self.glMatrix.mat4,b=new Map([["float",1],["percent",1],["sampler",1],["vec2",2],["vec3",3],["color",3],["vec4",4],["mat4",16]]);e.Gfx.WebGLShaderUniform=class{constructor(d,c,f){if(!b.has(f))throw Error("invalid uniform type");this._owner=d;this._gl=this._owner.GetWebGLContext();this._name=c;this._type=f;this._isColorType="color"===this._type;this._location=this._gl.getUniformLocation(this._owner.GetShaderProgram(),c);this._isUsed=!!this._location;d=b.get(f);this._lastValue=new Float32Array(d);this._lastBatchValue=new Float32Array(d)}Release(){this._location=this._gl=this._owner=null}IsUsed(){return this._isUsed}GetType(){return this._type}IsColorType(){return this._isColorType}Init1f(d){this.IsUsed()&&(this._lastValue[0]=d,this._lastBatchValue.set(this._lastValue),this._gl.uniform1f(this._location,d))}Init1i(d){this.IsUsed()&&(this._lastValue[0]=d,this._lastBatchValue.set(this._lastValue),this._gl.uniform1i(this._location,d))}Init2f(d,c){this.IsUsed()&&(this._lastValue[0]=d,this._lastValue[1]=c,this._lastBatchValue.set(this._lastValue),this._gl.uniform2f(this._location,d,c))}Init3f(d,c,f){this.IsUsed()&&(this._lastValue[0]=d,this._lastValue[1]=c,this._lastValue[2]=f,this._lastBatchValue.set(this._lastValue),this._gl.uniform3f(this._location,d,c,f))}Init4f(d,c,f,h){this.IsUsed()&&(this._lastValue[0]=d,this._lastValue[1]=c,this._lastValue[2]=f,this._lastValue[3]=h,this._lastBatchValue.set(this._lastValue),this._gl.uniform4f(this._location,d,c,f,h))}Update1f(d){d=Math.fround(d);const c=this._lastValue;c[0]!==d&&(c[0]=d,this._gl.uniform1f(this._location,d))}Update1i(d){const c=this._lastValue;c[0]!==d&&(c[0]=d,this._gl.uniform1i(this._location,d))}Update2f(d,c){d=Math.fround(d);c=Math.fround(c);const f=this._lastValue;if(f[0]!==d||f[1]!==c)f[0]=d,f[1]=c,this._gl.uniform2f(this._location,d,c)}Update3f(d,c,f){d=Math.fround(d);c=Math.fround(c);f=Math.fround(f);const h=this._lastValue;if(h[0]!==d||h[1]!==c||h[2]!==f)h[0]=d,h[1]=c,h[2]=f,this._gl.uniform3f(this._location,d,c,f)}Update4f(d,c,f,h){d=Math.fround(d);c=Math.fround(c);f=Math.fround(f);h=Math.fround(h);const g=this._lastValue;if(g[0]!==d||g[1]!==c||g[2]!==f||g[3]!==h)g[0]=d,g[1]=c,g[2]=f,g[3]=h,this._gl.uniform4f(this._location,d,c,f,h)}UpdateMatrix4fv(d){const c=this._lastValue;a.exactEquals(c,d)||(e.typedArraySet16(c,d,0),this._gl.uniformMatrix4fv(this._location,!1,d))}IsSetToCustomInBatch(d){const c=this._lastBatchValue;return this.IsColorType()?c[0]===Math.fround(d.getR())&&c[1]===Math.fround(d.getG())&&c[2]===Math.fround(d.getB()):c[0]===Math.fround(d)}SetBatchValueCustom(d){const c=this._lastBatchValue;this.IsColorType()?(c[0]=d.getR(),c[1]=d.getG(),c[2]=d.getB()):c[0]=d}IsSetTo1InBatch(d){return this._lastBatchValue[0]===Math.fround(d)}IsSetTo2InBatch(d,c){const f=this._lastBatchValue;return f[0]===Math.fround(d)&&f[1]===Math.fround(c)}SetBatch1(d){this._lastBatchValue[0]=d}SetBatch2(d,c){const f=this._lastBatchValue;f[0]=d;f[1]=c}}}
  {"use strict";const e=self.C3,a=self.glMatrix,b=a.vec4,d=a.mat4;e.Gfx.BatchState=class{constructor(c){this.renderer=c;this.currentMV=d.create();this.currentMatP=d.create();this.currentFramebuffer=null;this.currentColor=b.fromValues(1,1,1,1);this.currentShader=null;this.pointTexCoords=new e.Rect;this.clearColor=e.New(e.Color,0,0,0,0)}};e.Gfx.WebGLBatchJob=class{constructor(c){const f=new ArrayBuffer(96);this._type=0;this._batchState=c;this._gl=c.renderer.GetContext();this._indexCount=this._startIndex=0;this._texParam=null;this._mat4param=new Float32Array(f,0,16);this._colorParam=new Float32Array(f,64,4);this._srcOriginRect=new Float32Array(f,80,4);this._shaderParams=[]}InitQuad(c,f){this._type=1;this._startIndex=c;this._indexCount=f}DoQuad(){const c=this._gl;c.drawElements(c.TRIANGLES,this._indexCount,c.UNSIGNED_SHORT,this._startIndex)}InitSetTexture(c){this._type=2;this._texParam=c}DoSetTexture(){const c=this._gl,f=this._texParam;c.bindTexture(c.TEXTURE_2D,f?f._GetTexture():null)}InitSetColor(c){this._type=3;c.writeToTypedArray(this._colorParam,0)}DoSetColor(){const c=this._colorParam,f=this._batchState;b.copy(f.currentColor,c);f.currentShader.UpdateColor(c)}InitSetGradientColor(c){this._type=21;c.writeToTypedArray(this._colorParam,0)}DoSetGradientColor(){const c=this._colorParam,f=this._batchState.currentShader;f._uColor2.IsUsed()&&f._uColor2.Update4f(c[0],c[1],c[2],c[3])}InitSetBlend(c,f){this._type=4;this._startIndex=c;this._indexCount=f}DoSetBlend(){this._gl.blendFunc(this._startIndex,this._indexCount)}InitSetViewport(c,f,h,g){this._type=5;const l=this._colorParam;l[0]=c;l[1]=f;l[2]=h;l[3]=g}DoSetViewport(){const c=this._colorParam;this._gl.viewport(c[0],c[1],c[2],c[3])}InitSetProjection(c){this._type=6;d.copy(this._mat4param,c)}DoSetProjection(){const c=this._batchState,f=c.renderer._allShaderPrograms,h=c.currentShader,g=this._mat4param;for(let l=0,m=f.length;l<m;++l){const u=f[l];u===h?u.UpdateMatP(g,!0):u.SetMatPStale()}d.copy(c.currentMatP,g)}InitSetModelView(c){this._type=7;d.copy(this._mat4param,c)}DoSetModelView(){const c=this._batchState,f=c.renderer._allShaderPrograms,h=c.currentShader,g=this._mat4param;for(let l=0,m=f.length;l<m;++l){const u=f[l];u===h?u.UpdateMatMV(g,!0):u.SetMatMVStale()}d.copy(c.currentMV,g)}InitSetRenderTarget(c){this._type=8;this._texParam=c}DoSetRenderTarget(){const c=this._gl;var f=this._texParam;const h=this._batchState;f?(f=f._GetFramebuffer(),h.currentFramebuffer=f,c.bindFramebuffer(c.FRAMEBUFFER,f)):(h.currentFramebuffer=null,c.bindFramebuffer(c.FRAMEBUFFER,null))}InitClearSurface(c){this._type=9;c.writeToTypedArray(this._mat4param,0)}InitClearSurface2(c,f,h,g){this._type=9;const l=this._mat4param;l[0]=c;l[1]=f;l[2]=h;l[3]=g}DoClearSurface(){const c=this._gl;var f=this._mat4param,h=this._batchState;const g=h.clearColor;(h=h.renderer._isScissorViewport&&e.isDebug)&&c.disable(c.SCISSOR_TEST);const l=f[0],m=f[1],u=f[2];f=f[3];g.equalsRgba(l,m,u,f)||(c.clearColor(l,m,u,f),g.setRgba(l,m,u,f));c.clear(c.COLOR_BUFFER_BIT);h&&c.enable(c.SCISSOR_TEST)}InitClearRect(c,f,h,g,l,m,u,x){this._type=10;const n=this._mat4param;n[0]=c;n[1]=f;n[2]=h;n[3]=g;n[4]=l;n[5]=m;n[6]=u;n[7]=x}DoClearRectangle(){const c=this._gl;var f=this._mat4param,h=this._batchState;const g=h.renderer;h=h.clearColor;g._isScissorViewport||c.enable(c.SCISSOR_TEST);c.scissor(f[0],f[1],f[2],f[3]);const l=f[4],m=f[5],u=f[6];f=f[7];h.equalsRgba(l,m,u,f)||(c.clearColor(l,m,u,f),h.setRgba(l,m,u,f));c.clear(c.COLOR_BUFFER_BIT);g._isScissorViewport?c.scissor(0,0,g._viewportScissorWidth,g._viewportScissorHeight):c.disable(c.SCISSOR_TEST)}InitSetPointTexCoords(c){this._type=15;c.writeToTypedArray(this._mat4param,0)}DoSetPointTextureCoords(){const c=this._mat4param;this._batchState.pointTexCoords.set(c[0],c[1],c[2],c[3])}InitPoints(c,f){this._type=11;this._startIndex=c;this._indexCount=1;this._mat4param[0]=f}DoPoints(){const c=this._gl,f=this._batchState,h=f.renderer._spPoints;c.useProgram(h._shaderProgram);h.UpdateMatP(f.currentMatP,!1);h.UpdateMatMV(f.currentMV,!1);var g=f.pointTexCoords;h._uPointTexStart.IsUsed()&&h._uPointTexStart.Update2f(g.getLeft(),g.getTop());h._uPointTexEnd.IsUsed()&&h._uPointTexEnd.Update2f(g.getRight(),g.getBottom());g=this._mat4param[0];h._uZElevation.IsUsed()&&h._uZElevation.Update1f(g);h._uColor.IsUsed()&&(g=f.currentColor,h._uColor.Update4f(g[0],g[1],g[2],g[3]));c.drawArrays(c.POINTS,this._startIndex/4,this._indexCount);c.useProgram(f.currentShader._shaderProgram)}InitSetProgram(c){this._type=12;this._texParam=c}DoSetProgram(){var c=this._gl;const f=this._batchState,h=this._texParam;f.currentShader=h;c.useProgram(h._shaderProgram);h.UpdateMatP(f.currentMatP,!1);h.UpdateMatMV(f.currentMV,!1);h._uColor.IsUsed()&&(c=f.currentColor,h._uColor.Update4f(c[0],c[1],c[2],c[3]))}InitSetProgramParameters(){this._type=13}DoSetProgramParameters(){const c=this._batchState.currentShader;c._hasAnyOptionalUniforms&&this._DoSetOptionalUniformProgramParameters(c);c._uCustomParameters.length&&this._DoUpdateCustomProgramParameters(c)}_DoSetOptionalUniformProgramParameters(c){const f=this._gl,h=this._mat4param,g=this._colorParam,l=this._srcOriginRect;if(c._uSamplerBack.IsUsed()){const m=this._batchState.renderer,u=this._texParam;m._lastTexture1!==u&&(f.activeTexture(f.TEXTURE1),f.bindTexture(f.TEXTURE_2D,u?u._GetTexture():null),m._lastTexture1=u,f.activeTexture(f.TEXTURE0))}c._uPixelSize.IsUsed()&&c._uPixelSize.Update2f(h[0],h[1]);c._uDestStart.IsUsed()&&c._uDestStart.Update2f(h[2],h[3]);c._uDestEnd.IsUsed()&&c._uDestEnd.Update2f(h[4],h[5]);c._uLayerScale.IsUsed()&&c._uLayerScale.Update1f(h[6]);c._uLayerAngle.IsUsed()&&c._uLayerAngle.Update1f(h[7]);c._uSrcStart.IsUsed()&&c._uSrcStart.Update2f(h[12],h[13]);c._uSrcEnd.IsUsed()&&c._uSrcEnd.Update2f(h[14],h[15]);c._uSrcOriginStart.IsUsed()&&c._uSrcOriginStart.Update2f(l[0],l[1]);c._uSrcOriginEnd.IsUsed()&&c._uSrcOriginEnd.Update2f(l[2],l[3]);c._uLayoutStart.IsUsed()&&c._uLayoutStart.Update2f(g[0],g[1]);c._uLayoutEnd.IsUsed()&&c._uLayoutEnd.Update2f(g[2],g[3]);c._uSeconds.IsUsed()&&c._uSeconds.Update1f(this._startIndex)}_DoUpdateCustomProgramParameters(c){c=c._uCustomParameters;const f=this._shaderParams;for(let h=0,g=c.length;h<g;++h){const l=c[h],m=f[h];l.IsColorType()?l.Update3f(m.getR(),m.getG(),m.getB()):l.Update1f(m)}}InitInvalidateFramebuffer(c){this._type=14;this._texParam=c}DoInvalidateFramebuffer(){const c=this._gl,f=this._texParam,h=this._batchState.currentFramebuffer;f!==h&&c.bindFramebuffer(c.FRAMEBUFFER,f);c.invalidateFramebuffer(c.FRAMEBUFFER,[c.COLOR_ATTACHMENT0]);f!==h&&c.bindFramebuffer(c.FRAMEBUFFER,h)}InitBlitFramebuffer(c,f,h){this._type=17;const g=this._mat4param,l=this._batchState.renderer;g[0]=c.GetWidth();g[1]=c.GetHeight();g[2]=f?f.GetWidth():l.GetWidth();g[3]=f?f.GetHeight():l.GetHeight();g[4]=c.IsLinearSampling()?1:0;g[5]="stretch"===h;h=this._shaderParams;e.clearArray(h);h.push(c._GetFramebuffer());h.push(f?f._GetFramebuffer():null)}DoBlitFramebuffer(){var c=this._mat4param,f=this._shaderParams;const h=this._gl;var g=c[0],l=c[1],m=c[2];const u=c[3],x=0!==c[4];c=0!==c[5];const n=f[1];h.bindFramebuffer(h.READ_FRAMEBUFFER,f[0]);h.bindFramebuffer(h.DRAW_FRAMEBUFFER,n);c?h.blitFramebuffer(0,0,g,l,0,0,m,u,h.COLOR_BUFFER_BIT,x?h.LINEAR:h.NEAREST):(f=Math.min(g,m),g=Math.min(l,u),m=Math.max(l-u,0),l=Math.max(u-l,0),h.blitFramebuffer(0,m,f,g+m,0,l,f,g+l,h.COLOR_BUFFER_BIT,h.NEAREST))}InitStartQuery(c){this._type=18;this._texParam=c}DoStartQuery(){this._texParam.BeginTimeElapsed();this._texParam=null}InitEndQuery(c){this._type=19;this._texParam=c}DoEndQuery(){this._texParam.EndTimeElapsed();this._texParam=null}InitSetEllipseParams(c,f,h){this._type=20;const g=this._mat4param;g[0]=c;g[1]=f;g[2]=h}DoSetEllipseParams(){const c=this._batchState.currentShader,f=this._mat4param;c._uPixelSize.IsUsed()&&c._uPixelSize.Update2f(f[0],f[1]);c._uOutlineThickness.IsUsed()&&c._uOutlineThickness.Update1f(f[2])}InitSetTilemapInfo(c,f,h,g,l,m,u){this._type=16;const x=this._mat4param;c.writeToTypedArray(x,0);x[4]=1/f;x[5]=1/h;x[6]=g/f;x[7]=l/h;x[8]=m/f;x[9]=u/h}DoSetTilemapInfo(){const c=this._batchState.currentShader,f=this._mat4param;c._uSrcStart.IsUsed()&&c._uSrcStart.Update2f(f[0],f[1]);c._uPixelSize.IsUsed()&&c._uPixelSize.Update2f(f[4],f[5]);c._uTileSize.IsUsed()&&c._uTileSize.Update2f(f[6],f[7]);c._uTileSpacing.IsUsed()&&c._uTileSpacing.Update2f(f[8],f[9])}InitClearDepth(){this._type=22}DoClearDepth(){const c=this._gl;c.clear(c.DEPTH_BUFFER_BIT)}InitSetDepthEnabled(c){this._type=23;this._startIndex=c?1:0}DoSetDepthEnabled(){const c=this._gl;0===this._startIndex?(c.disable(c.DEPTH_TEST),c.depthMask(!1)):(c.enable(c.DEPTH_TEST),c.depthMask(!0))}InitCoplanarStartStencilPass(){this._type=24}DoCoplanarStartStencilPass(){const c=this._gl;c.clear(c.STENCIL_BUFFER_BIT);c.enable(c.STENCIL_TEST);c.stencilFunc(c.ALWAYS,1,1);c.stencilOp(c.KEEP,c.KEEP,c.REPLACE);c.colorMask(!1,!1,!1,!1)}InitCoplanarStartColorPass(){this._type=25}DoCoplanarStartColorPass(){const c=this._gl;c.colorMask(!0,!0,!0,!0);c.stencilFunc(c.EQUAL,1,1);c.stencilOp(c.KEEP,c.KEEP,c.KEEP)}InitCoplanarRestore(){this._type=26}DoCoplanarRestore(){const c=this._gl;c.disable(c.STENCIL_TEST)}Run(){switch(this._type){case 1:this.DoQuad();break;case 2:this.DoSetTexture();break;case 3:this.DoSetColor();break;case 4:this.DoSetBlend();break;case 5:this.DoSetViewport();break;case 6:this.DoSetProjection();break;case 7:this.DoSetModelView();break;case 8:this.DoSetRenderTarget();break;case 9:this.DoClearSurface();break;case 10:this.DoClearRectangle();break;case 11:this.DoPoints();break;case 12:this.DoSetProgram();break;case 13:this.DoSetProgramParameters();break;case 14:this.DoInvalidateFramebuffer();break;case 15:this.DoSetPointTextureCoords();break;case 16:this.DoSetTilemapInfo();break;case 17:this.DoBlitFramebuffer();break;case 18:this.DoStartQuery();break;case 19:this.DoEndQuery();break;case 20:this.DoSetEllipseParams();break;case 21:this.DoSetGradientColor();break;case 22:this.DoClearDepth();break;case 23:this.DoSetDepthEnabled();break;case 24:this.DoCoplanarStartStencilPass();break;case 25:this.DoCoplanarStartColorPass();break;case 26:this.DoCoplanarRestore()}}}}
  {"use strict";const e=self.C3,a={timeout:60},b=new e.Color(0,0,0,1),d=new Set(["left","center","right"]),c=new Set(["top","center","bottom"]),f=new Set(["word","character"]),h=new Set;e.FontManager&&e.FontManager.addEventListener("fontload",n=>{n=n.font.GetName();for(const q of h)(q.IsBBCodeEnabled()||e.equalsNoCase(q.GetFontName(),n))&&q._SetTextChanged()});function g(n,q,t,r,w,y){q?"Gecko"===e.Platform.BrowserEngine?n.strokeText(t,r,w,y):n.strokeText(t,r,w):"Gecko"===e.Platform.BrowserEngine?n.fillText(t,r,w,y):n.fillText(t,r,w)}function l(n,q,t,r,w,y){q?n.strokeRect(t,r,w,y):n.fillRect(t,r,w,y)}function m(n){return 4/3*n}let u=!1,x=!1;e.Gfx.RendererText=class{constructor(n,q){q=Object.assign({},a,q);this._renderer=n;this._fontName="Arial";this._fontSize=16;this._fontSizeScale=1;this._lineHeight=0;this._isItalic=this._isBold=!1;this._colorStr="black";this._isBBcodeEnabled=!1;this.onloadfont=null;this._alreadyLoadedFonts=new Set;this._horizontalAlign="left";this._verticalAlign="top";this._text="";this._bbString=null;this._wrappedText=e.New(e.WordWrap);this._wrapMode="word";this._isUpdating=this._textChanged=!1;this._isAsync=!0;this._drawMaxCharCount=-1;this._height=this._width=this._cssHeight=this._cssWidth=this._drawCharCount=0;this._zoom=1;this._changed=!1;this._measureContextTop=this._measureContext=this._textContext=this._textCanvas=null;this._lastCanvasHeight=this._lastCanvasWidth=-1;this._lastTextCanvasFillStyle=this._lastMeasureCanvasFont=this._lastTextCanvasFont="";this._lastTextCanvasLineWidth=this._lastTextCanvasOpacity=1;this._measureTextCallback=(t,r)=>this._MeasureText(t,r);this._texture=null;this._textureHeight=this._textureWidth=0;this._rcTex=new e.Rect;this._scaleFactor=1;this._needToRecreateTexture=!1;this._textureTimeout=new e.IdleTimeout(()=>{this.ReleaseTexture();this._SetTextCanvasSize(8,8)},q.timeout);this.ontextureupdate=null;this._wasReleased=!1;h.add(this)}Release(){this.onloadfont=null;this._alreadyLoadedFonts.clear();this._measureTextCallback=this._measureContextTop=this._measureContext=this._textContext=this._textCanvas=this._bbString=null;this._textureTimeout.Release();this.ontextureupdate=null;this.ReleaseTexture();this._wrappedText.Clear();this._renderer=this._wrappedText=null;this._wasReleased=!0;h.delete(this)}_SetChanged(){this._changed=!0}_SetTextChanged(){this._SetChanged();this._wrappedText.Clear();this._textChanged=!0}SetIsAsync(n){this._isAsync=!!n}IsAsync(){return this._isAsync}SetBBCodeEnabled(n){n=!!n;this._isBBcodeEnabled!==n&&(n=(this._isBBcodeEnabled=n)?"alphabetic":"top",this._textContext&&(this._textContext.textBaseline=n),this._measureContext&&(this._measureContext.textBaseline=n),this._SetTextChanged())}IsBBCodeEnabled(){return this._isBBcodeEnabled}SetFontName(n){n||(n="serif");this._fontName!==n&&(this._fontName=n,this._SetTextChanged())}GetFontName(){return this._fontName}SetFontSize(n){.1>n&&(n=.1);this._fontSize!==n&&(this._fontSize=n,this._SetTextChanged())}SetFontSizeScale(n){this._fontSizeScale!==n&&(this._fontSizeScale=n,this._SetTextChanged())}SetLineHeight(n){this._lineHeight!==n&&(this._lineHeight=n,this._SetChanged())}SetBold(n){n=!!n;this._isBold!==n&&(this._isBold=n,this._SetTextChanged())}SetItalic(n){n=!!n;this._isItalic!==n&&(this._isItalic=n,this._SetTextChanged())}SetDrawMaxCharacterCount(n){n=Math.floor(n);this._drawMaxCharCount!==n&&(this._drawMaxCharCount=n,this._SetChanged())}GetDrawMaxCharacterCount(){return this._drawMaxCharCount}_GetStyleTag(n,q){for(let t=n.length-1;0<=t;--t){const r=n[t];if(r.tag===q)return r}return null}_HasStyleTag(n,q){return!!this._GetStyleTag(n,q)}_GetFontString(n,q){let t=[];(this._isBold||this._HasStyleTag(q,"b"))&&t.push("bold");(this._isItalic||this._HasStyleTag(q,"i"))&&t.push("italic");var r=this._GetStyleTag(q,"size");r=(r?parseFloat(r.param):this._fontSize)*this._fontSizeScale;n?t.push(r+"pt"):t.push(r*this._scaleFactor*this._zoom*self.devicePixelRatio+"pt");n=this._fontName;(q=this._GetStyleTag(q,"font"))&&q.param&&(n=q.param,this.onloadfont&&!this._alreadyLoadedFonts.has(n)&&(this.onloadfont(n),this._alreadyLoadedFonts.add(n)));n&&t.push('"'+n+'"');return t.join(" ")}SetColor(n){n instanceof e.Color&&(n=n.getCssRgb());this._colorStr!==n&&(this._colorStr=n,this._SetChanged())}SetColorRgb(n,q,t){b.setRgb(n,q,t);this.SetColor(b)}SetHorizontalAlignment(n){if(!d.has(n))throw Error("invalid horizontal alignment");this._horizontalAlign!==n&&(this._horizontalAlign=n,this._SetChanged())}SetVerticalAlignment(n){if(!c.has(n))throw Error("invalid vertical alignment");this._verticalAlign!==n&&(this._verticalAlign=n,this._SetChanged())}SetWordWrapMode(n){if(!f.has(n))throw Error("invalid word wrap mode");this._wrapMode!==n&&(this._wrapMode=n,this._SetTextChanged())}SetText(n){this._text!==n&&(this._text=n,this._SetTextChanged())}SetSize(n,q,t){"undefined"===typeof t&&(t=1);if(!(0>=n||0>=n||this._cssWidth===n&&this._cssHeight===q&&this._zoom===t)){1===this._zoom!==(1===t)&&(this._needToRecreateTexture=!0);var r=this._cssWidth,w=this._zoom;this._cssWidth=n;this._cssHeight=q;this._zoom=t;n=self.devicePixelRatio;this._width=this._cssWidth*this._zoom*n;this._height=this._cssHeight*this._zoom*n;n=Math.max(this._width,this._height);q=Math.min(this._renderer.GetMaxTextureSize(),2048);t=1;n>q&&(t=q/n,this._width=Math.min(this._width*t,q),this._height=Math.min(this._height*t,q));this._scaleFactor=t;0<this._textureWidth&&0<this._textureHeight&&this._zoom===w&&this._rcTex.set(0,0,this._width/this._textureWidth,this._height/this._textureHeight);this._cssWidth!==r?this._SetTextChanged():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+4)-this._lineHeight}GetTexture(){this._textureTimeout.Reset();this._MaybeUpdate();return this._texture}_MaybeUpdate(){this._texture&&!this._changed&&!this._textChanged||this._isUpdating||0>=this._width||0>=this._height||(this._changed=!1,this._isUpdating=!0,this._isAsync?e.Asyncify(()=>this._DoUpdate()):this._DoUpdate())}_DoUpdate(){this._wasReleased||(this._SetTextCanvasSize(Math.ceil(this._width),Math.ceil(this._height)),this._MaybeWrapText(),this._DrawTextToCanvas(),this._UpdateTexture(),this._textureTimeout.Reset(),this._isUpdating=!1)}_SetTextCanvasSize(n,q){this._textCanvas||(this._textCanvas=e.CreateCanvas(16,16));let t=!1;if(this._lastCanvasWidth!==n||this._lastCanvasHeight!==q)this._lastCanvasWidth=n,this._lastCanvasHeight=q,this._textCanvas.width=n,this._textCanvas.height=q,t=!0;this._textContext||(this._textContext=this._textCanvas.getContext("2d"),t=!0);t?(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):this._textContext.clearRect(0,0,n,q)}_MaybeCreateMeasureContext(){this._measureContext||(this._measureContext=e.CreateCanvas(16,16).getContext("2d"),this._measureContextTop=e.CreateCanvas(16,16).getContext("2d"),this._measureContext.textBaseline=this._isBBcodeEnabled?"alphabetic":"top",this._measureContextTop.textBaseline="top")}_SetMeasureFontString(n){this._lastMeasureCanvasFont!==n&&(this._lastMeasureCanvasFont=n,this._measureContext.font=n,this._measureContextTop.font=n)}_SupportsFontBoundingBoxMeasurements(){if(!u){u=!0;this._MaybeCreateMeasureContext();const n=this._measureContext.measureText("test");x="number"===typeof n.fontBoundingBoxAscent&&"number"===typeof n.fontBoundingBoxDescent}return x}_MaybeWrapText(){this._textChanged&&(this._MaybeCreateMeasureContext(),!this._isBBcodeEnabled||this._bbString&&this._bbString.toString()===this._text||(this._bbString=new e.BBString(this._text,{noEscape:!0})),this._wrappedText.WordWrap(this._isBBcodeEnabled?this._bbString.toFragmentList():this._text,this._measureTextCallback,this._cssWidth,this._wrapMode,0),this._textChanged=!1)}_MeasureText(n,q){this._SetMeasureFontString(this._GetFontString(!0,q));q=this._GetStyleTag(q,"size");q=(q?parseFloat(q.param):this._fontSize)*this._fontSizeScale;const t=this._measureContext.measureText(n);let r=0;this._isBBcodeEnabled&&this._SupportsFontBoundingBoxMeasurements()&&(n=this._measureContextTop.measureText(n),r=t.fontBoundingBoxAscent-n.fontBoundingBoxAscent);return{width:t.width,height:m(q),fontBoundingBoxAscent:t.fontBoundingBoxAscent||0,fontBoundingBoxDescent:t.fontBoundingBoxDescent||0,topToAlphabeticDistance:r}}_SetDrawFontString(n){this._lastTextCanvasFont!==n&&(this._lastTextCanvasFont=n,this._textContext.font=n)}_SetDrawCanvasColor(n){this._lastTextCanvasFillStyle!==n&&(this._lastTextCanvasFillStyle=n,this._textContext.fillStyle=n,this._textContext.strokeStyle=n)}_SetDrawCanvasOpacity(n){this._lastTextCanvasOpacity!==n&&(this._lastTextCanvasOpacity=n,this._textContext.globalAlpha=n)}_SetDrawCanvasLineWith(n){this._lastTextCanvasLineWidth!==n&&(this._lastTextCanvasLineWidth=n,this._textContext.lineWidth=n)}_DrawTextToCanvas(){this._drawCharCount=0;const n=this._scaleFactor*this._zoom*self.devicePixelRatio,q=(4+this._lineHeight)*n;var t=0;const r=this._wrappedText.GetLines();if(0!==r.length){var w=this._isBBcodeEnabled&&this._SupportsFontBoundingBoxMeasurements(),y=r[0].height*n;"center"===this._verticalAlign?(t=r.reduce((B,E)=>B+E.height*n+q,0)-q,t=Math.max(this._height/2-t/2,0),w&&(y=r[0].topToAlphabeticDistance*n)):"bottom"===this._verticalAlign&&(t=r.reduce((B,E)=>B+E.height*n+q,0)-this._lineHeight*n,w=w?r.at(-1).fontBoundingBoxDescent*n:0,t=this._height-t-w-2);for(let B=0,E=r.length;B<E;++B){w=r[B];const H=w.height*n,K=t;if(this._isBBcodeEnabled){if(t+=0===B?y:H,0<B&&t>this._height-4*n)break}else if(0<B&&t>=this._height-H)break;0<=K&&this._DrawTextLine(w,t,n);this._isBBcodeEnabled||(t+=H);t+=q}}}_DrawTextLine(n,q,t){let r=0;"center"===this._horizontalAlign?r=(this._width-n.width*t)/2:"right"===this._horizontalAlign&&(r=this._width-n.width*t);for(const w of n.fragments)this._DrawTextFragment(w,r,q,t,n.height),r+=w.width*t}_DrawTextFragment(n,q,t,r,w){const y=this._textContext,B=w/16;w=n.width*r;const E=n.height*r,H=n.height/16;var K=(4+this._lineHeight)*r,C=n.styles;n=n.text;if(-1!==this._drawMaxCharCount){if(this._drawCharCount>=this._drawMaxCharCount)return;this._drawCharCount+n.length>this._drawMaxCharCount&&(n=n.substr(0,this._drawMaxCharCount-this._drawCharCount),w=this._MeasureText(n,C).width*r);this._drawCharCount+=n.length}var A=this._GetStyleTag(C,"background");const F=this._HasStyleTag(C,"u"),J=this._HasStyleTag(C,"s");if((!e.IsStringAllWhitespace(n)||A||F||J)&&!this._HasStyleTag(C,"hide")){var L=this._GetStyleTag(C,"offsetx");q+=L?parseFloat(L.param)*r:0;L=this._GetStyleTag(C,"offsety");t+=L?parseFloat(L.param)*r:0;A&&(this._SetDrawCanvasColor(A.param),y.fillRect(q,t-E,w,E+K));K=this._GetStyleTag(C,"color");this._SetDrawCanvasColor(K?K.param:this._colorStr);A=this._GetStyleTag(C,"opacity");this._SetDrawCanvasOpacity(A?parseFloat(A.param)/100:1);A=(A=this._GetStyleTag(C,"linethickness"))?parseFloat(A.param):1;(L=this._HasStyleTag(C,"stroke"))&&this._SetDrawCanvasLineWith(.5*H*A*this._scaleFactor*this._zoom*self.devicePixelRatio);this._SetDrawFontString(this._GetFontString(!1,C));g(y,L,n,q,t,w);!L&&(this._SetDrawCanvasLineWith(.5*H*A*this._scaleFactor*this._zoom*self.devicePixelRatio),C=this._GetStyleTag(C,"outline"))&&(this._SetDrawCanvasColor(C.param),g(y,!0,n,q,t,w));this._SetDrawCanvasColor(K?K.param:this._colorStr);F&&l(y,L,q,t+r*B,w,r*B*A);J&&(r*=H,y.fillRect(q,t-E/4+r/2-r*A/2,w,r*A))}}_UpdateTexture(){if(!this._renderer.IsContextLost()&&(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),this._needToRecreateTexture&&(this.ReleaseTexture(),this._needToRecreateTexture=!1),this._texture||(this._texture=this._renderer.CreateDynamicTexture(this._textureWidth,this._textureHeight,{mipMap:1===this._zoom,mipMapQuality:"high"})),this._renderer.UpdateTexture(this._textCanvas,this._texture),this.ontextureupdate))this.ontextureupdate()}GetTexRect(){return this._rcTex}ReleaseTexture(){this._texture&&(this._renderer.IsContextLost()||this._renderer.DeleteTexture(this._texture),this._texture=null)}static OnContextLost(){for(const n of h)n.ReleaseTexture()}static GetAll(){return h.values()}}}
  {"use strict";const e=self.C3;class a{constructor(b){this._gl=b.GetContext();this._version=b.GetWebGLVersionNumber();this._timerExt=b._GetDisjointTimerQueryExtension();this._query=null;this._hasResult=this._isActive=!1;this._result=0;this._query=1===this._version?this._timerExt.createQueryEXT():this._gl.createQuery()}Release(){this._DeleteQueryObject();this._timerExt=this._gl=null;this._hasResult=!1}_DeleteQueryObject(){this._query&&(1===this._version?this._timerExt.deleteQueryEXT(this._query):this._gl.deleteQuery(this._query),this._query=null)}BeginTimeElapsed(){if(this._isActive)throw Error("query already active");1===this._version?this._timerExt.beginQueryEXT(this._timerExt.TIME_ELAPSED_EXT,this._query):this._gl.beginQuery(this._timerExt.TIME_ELAPSED_EXT,this._query);this._isActive=!0}EndTimeElapsed(){if(!this._isActive)throw Error("query not active");1===this._version?this._timerExt.endQueryEXT(this._timerExt.TIME_ELAPSED_EXT):this._gl.endQuery(this._timerExt.TIME_ELAPSED_EXT);this._isActive=!1}CheckForResult(){if(this._query&&!this._hasResult&&!this._isActive){var b=1===this._version?this._timerExt.getQueryObjectEXT(this._query,this._timerExt.QUERY_RESULT_AVAILABLE_EXT):this._gl.getQueryParameter(this._query,this._gl.QUERY_RESULT_AVAILABLE);var d=this._gl.getParameter(this._timerExt.GPU_DISJOINT_EXT);b&&!d&&(this._result=1===this._version?this._timerExt.getQueryObjectEXT(this._query,this._timerExt.QUERY_RESULT_EXT):this._gl.getQueryParameter(this._query,this._gl.QUERY_RESULT),this._result/=1E9,this._hasResult=!0);(b||d)&&this._DeleteQueryObject()}}HasResult(){return this._hasResult}GetResult(){if(!this._hasResult)throw Error("no result available");return this._result}}e.Gfx.WebGLTimeElapsedQuery=class{constructor(b){this._renderer=b;this._frameNumber=b.GetFrameNumber();this._isActive=!1;this._parentQuery=null;this._isNested=!1;this._realQuery=null;this._queries=[]}Release(){for(const b of this._queries)b instanceof a&&b.Release();e.clearArray(this._queries);this._renderer=this._realQuery=this._parentQuery=null}BeginTimeElapsed(){if(this._isActive)throw Error("query already active");const b=this._renderer._GetTimeQueryStack();0<b.length?(this._isNested=!0,this._parentQuery=b.at(-1),this._parentQuery._EndReal(),this._parentQuery._queries.push(this)):(this._isNested=!1,this._parentQuery=null);this._isActive=!0;b.push(this);this._StartReal()}EndTimeElapsed(){if(!this._isActive)throw Error("query not active");if(this._renderer._GetTimeQueryStack().pop()!==this)throw Error("can only end most nested query");this._isActive=!1;this._EndReal();this._parentQuery&&(this._parentQuery._StartReal(),this._parentQuery=null)}_StartReal(){this._realQuery=e.New(a,this._renderer);this._queries.push(this._realQuery);this._realQuery.BeginTimeElapsed()}_EndReal(){this._realQuery.EndTimeElapsed();this._realQuery=null}CheckForResult(){for(const b of this._queries)b.CheckForResult()}IsNested(){return this._isNested}HasResult(){return this._queries.every(b=>b.HasResult())}GetResult(){return this._queries.reduce((b,d)=>b+d.GetResult(),0)}GetFrameNumber(){return this._frameNumber}}}
  {"use strict";const e=self.C3;e.Gfx.WebGLQueryResultBuffer=class{constructor(a,b=1E3){this._renderer=a;this._maxQueries=b;this._buffer=[];this._renderer._AddQueryResultBuffer(this)}Release(){this.Clear();this._renderer._RemoveQueryResultBuffer(this);this._renderer=null}Clear(){for(const a of this._buffer)a.Release();e.clearArray(this._buffer)}AddTimeElapsedQuery(){const a=new e.Gfx.WebGLTimeElapsedQuery(this._renderer);this._buffer.push(a);this._buffer.length>this._maxQueries&&this._buffer.shift().Release();return a}CheckForResults(a){for(const b of this._buffer){if(b.GetFrameNumber()>=a)break;if(b.IsNested())break;b.CheckForResult()}}GetFrameRangeResultSum(a,b){if(b<=a)return NaN;let d=0;for(const c of this._buffer){if(c.GetFrameNumber()>=b)break;if(!(c.GetFrameNumber()<a))if(c.HasResult())d+=c.GetResult();else return NaN}return d}DeleteAllBeforeFrameNumber(a){for(let b=0,d=this._buffer.length;b<d;++b){const c=this._buffer[b];if(c.GetFrameNumber()<a)c.Release();else{0<b&&this._buffer.splice(0,b);break}}}}}
  {"use strict";const e=self.C3,a=self.glMatrix,b=a.vec4,d=a.mat4,c={powerPreference:"default",enableGpuProfiling:!0,alpha:!1,lowLatency:!1,depth:!1,maxWebGLVersion:2,failIfMajorPerformanceCaveat:!1},f=new Set(["default","low-power","high-performance"]),h=new e.Quad(0,0,1,0,1,1,0,1),g=d.create(),l=d.create(),m=new e.Quad,u=new e.Rect;let x=null;e.isDebug&&(self.debug_lose_context=function(){x?x.loseContext():console.warn("WEBGL_lose_context not supported")},self.debug_restore_context=function(){x?x.restoreContext():console.warn("WEBGL_lose_context not supported")});const n=new Set;let q=-1;function t(){q=-1;for(const r of n)r.checkFunc()&&(r.resolve(),n.delete(r));0<n.size&&(q=self.requestAnimationFrame(t))}e.Gfx.WebGLRenderer=class extends e.Gfx.RendererBase{constructor(r,w){super();w=Object.assign({},c,w);if(!f.has(w.powerPreference))throw Error("invalid power preference");const y={alpha:!!w.alpha,depth:!1,antialias:!1,powerPreference:w.powerPreference,failIfMajorPerformanceCaveat:!!w.failIfMajorPerformanceCaveat};w.lowLatency&&(y.desynchronized=!0,y.preserveDrawingBuffer=!0);let B=null,E=0;2<=w.maxWebGLVersion&&(B=r.getContext("webgl2",y),E=2);B||(B=r.getContext("webgl",y),E=1);if(!B)throw Error("failed to initialise WebGL context");this._gl=B;this._attribs=B.getContextAttributes();w.lowLatency&&!this._attribs.desynchronized&&console.info("[WebGLRenderer] Low-latency mode specified but is not supported here");this._versionString=B.getParameter(B.VERSION);this._version=E;this._viewport=b.create();this._bbProjectionMatrix=d.create();this._isDepthEnabled=this._usesDepthBuffer=!!w.depth;this._depthBuffer=null;this._isAutoSizeDepthBuffer=!0;this._depthBufferHeight=this._depthBufferWidth=0;this._pointBuffer=this._indexBuffer=this._texcoordBuffer=this._vertexBuffer=null;this._vertexData=new Float32Array(8E3*this.GetNumVertexComponents());this._indexData=new Uint16Array(12E3);this._texcoordData=new Float32Array(16E3);this._pointData=new Float32Array(32E3);this._lastVertexPtr=this._pointPtr=this._texPtr=this._vertexPtr=0;this._spDeviceTransformTextureFill=this._lastProgram=null;this._batch=[];this._topOfBatch=this._batchPtr=0;this._currentRenderTarget=null;this._lastPointZ=0;this._batchState=e.New(e.Gfx.BatchState,this);this._lastColor=e.New(e.Color,1,1,1,1);this._lastTexture1=this._lastTexture0=null;this._lastDestBlend=this._lastSrcBlend=0;this._isScissorViewport=!1;this._viewportScissorHeight=this._viewportScissorWidth=-1;this._lastPointTexCoords=new e.Rect;this._maxTextureSize=-1;this._highpPrecision=this._maxPointSize=this._minPointSize=0;this._unmaskedRenderer=this._unmaskedVendor="(unavailable)";this._extensions=[];this._isInitialisingAfterContextRestored=!1;this._anisotropicExt=this._parallelShaderCompileExt=null;this._maxAnisotropy=0;this._isGpuProfilingEnabled=!!w.enableGpuProfiling;this._timerExt=null;this._allQueryResultBuffers=new Set;this._timeQueryStack=[];this.FillIndexBufferData(this._indexData)}IsWebGL(){return!0}async InitState(){super.InitState();var r=this._gl,w=this.GetNumVertexComponents();this._lastColor.setRgba(1,1,1,1);this._lastTexture1=this._lastTexture0=null;this._pointPtr=this._vertexPtr=0;this._lastVertexPtr=8E3*w-4*w;e.clearArray(this._batch);this._topOfBatch=this._batchPtr=0;this._currentRenderTarget=this._lastProgram=null;this._lastPointTexCoords.set(0,0,1,1);this._lastPointZ=0;w=this._batchState;w.currentShader=null;w.currentFramebuffer=null;b.set(w.currentColor,1,1,1,1);w.clearColor.setRgba(0,0,0,0);w.pointTexCoords.set(0,0,1,1);r.clearColor(0,0,0,0);r.clear(r.COLOR_BUFFER_BIT);r.enable(r.BLEND);r.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA);this._lastSrcBlend=r.ONE;this._lastDestBlend=r.ONE_MINUS_SRC_ALPHA;this._InitBlendModes(r);r.disable(r.CULL_FACE);r.disable(r.STENCIL_TEST);r.disable(r.DITHER);this._usesDepthBuffer?(r.enable(r.DEPTH_TEST),r.depthMask(!0),r.depthFunc(r.LEQUAL)):(r.disable(r.DEPTH_TEST),r.depthMask(!1));this._isDepthEnabled=this._usesDepthBuffer;this._pointBuffer=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,this._pointBuffer);r.bufferData(r.ARRAY_BUFFER,this._pointData.byteLength,r.DYNAMIC_DRAW);this._vertexBuffer=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,this._vertexBuffer);r.bufferData(r.ARRAY_BUFFER,this._vertexData.byteLength,r.DYNAMIC_DRAW);this._texcoordBuffer=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,this._texcoordBuffer);r.bufferData(r.ARRAY_BUFFER,this._texcoordData.byteLength,r.DYNAMIC_DRAW);this._indexBuffer=r.createBuffer();r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,this._indexBuffer);r.bufferData(r.ELEMENT_ARRAY_BUFFER,this._indexData,r.STATIC_DRAW);r.activeTexture(r.TEXTURE0);r.bindTexture(r.TEXTURE_2D,null);this._maxTextureSize=r.getParameter(r.MAX_TEXTURE_SIZE);w=r.getParameter(r.ALIASED_POINT_SIZE_RANGE);this._minPointSize=w[0];this._maxPointSize=w[1];w=r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT);const y=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);this._highpPrecision=w&&y?Math.min(w.precision,y.precision):0;2048<this._maxPointSize&&(this._maxPointSize=2048);this._extensions=r.getSupportedExtensions();if(w=r.getExtension("WEBGL_debug_renderer_info"))this._unmaskedVendor=r.getParameter(w.UNMASKED_VENDOR_WEBGL),this._unmaskedRenderer=r.getParameter(w.UNMASKED_RENDERER_WEBGL);this._parallelShaderCompileExt=r.getExtension("KHR_parallel_shader_compile");e.isDebug&&(x=r.getExtension("WEBGL_lose_context"));if(this._isGpuProfilingEnabled)if(1===this.GetWebGLVersionNumber()){if("Chromium"!==e.Platform.BrowserEngine||81<=e.Platform.BrowserVersionNumber||"undefined"!==typeof document)this._timerExt=r.getExtension("EXT_disjoint_timer_query")}else this._timerExt=r.getExtension("EXT_disjoint_timer_query_webgl2")||r.getExtension("EXT_disjoint_timer_query");this._maxAnisotropy=(this._anisotropicExt=r.getExtension("EXT_texture_filter_anisotropic"))?r.getParameter(this._anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0;r=e.Gfx.WebGLShaderProgram;w=r.GetDefaultVertexShaderSource(!1);r=[[r.GetTextureFillFragmentShaderSource(),w,"<default>"],[r.GetTextureFillFragmentShaderSource(),w,"<default-device-transform>"],[r.GetPointFragmentShaderSource(this._version),r.GetPointVertexShaderSource(this._version),"<point>"],[r.GetColorFillFragmentShaderSource(),w,"<fill>"],[r.GetLinearGradientFillFragmentShaderSource(),w,"<lineargradient>"],[r.GetHardEllipseFillFragmentShaderSource(),w,"<hardellipse>"],[r.GetHardEllipseOutlineFragmentShaderSource(),w,"<hardellipseoutline>"],[r.GetSmoothEllipseFillFragmentShaderSource(),w,"<smoothellipse>"],[r.GetSmoothEllipseOutlineFragmentShaderSource(),w,"<smoothellipseoutline>"],[r.GetSmoothLineFillFragmentShaderSource(),w,"<smoothline>"],[r.GetTilemapFragmentShaderSource(),r.GetDefaultVertexShaderSource(!0),"<tilemap>"]];r=await Promise.all(r.map(B=>this.CreateShaderProgram({src:B[0]},B[1],B[2])));this._spTextureFill=r[0];this._spDeviceTransformTextureFill=r[1];this._spPoints=r[2];this._spColorFill=r[3];this._spLinearGradientFill=r[4];this._spHardEllipseFill=r[5];this._spHardEllipseOutline=r[6];this._spSmoothEllipseFill=r[7];this._spSmoothEllipseOutline=r[8];this._spSmoothLineFill=r[9];this._spTilemapFill=r[10];this.SetTextureFillMode()}async CreateShaderProgram(r,w,y){r=await e.Gfx.WebGLShaderProgram.Create(this,r,w,y);this._AddShaderProgram(r);return r}ResetLastProgram(){this._lastProgram=null}SetSize(r,w,y){if(this._width!==r||this._height!==w||y){this.EndBatch();y=this._gl;var B=this._batchState;this._width=r;this._height=w;r=this.GetScissoredViewportWidth();w=this.GetScissoredViewportHeight();this._SetViewport(0,0,r,w);this.CalculatePerspectiveMatrix(this._bbProjectionMatrix,r/w);this.SetProjectionMatrix(this._bbProjectionMatrix);this._spDeviceTransformTextureFill&&(y.useProgram(this._spDeviceTransformTextureFill.GetShaderProgram()),this._spDeviceTransformTextureFill._UpdateDeviceTransformUniforms(this._matP),this._lastProgram=this._spDeviceTransformTextureFill,this._batchState.currentShader=this._spDeviceTransformTextureFill);y.bindTexture(y.TEXTURE_2D,null);y.activeTexture(y.TEXTURE1);y.bindTexture(y.TEXTURE_2D,null);y.activeTexture(y.TEXTURE0);this._lastTexture1=this._lastTexture0=null;this._usesDepthBuffer&&this._isAutoSizeDepthBuffer&&this._SetDepthBufferSize(this._width,this._height);this._currentRenderTarget&&this._currentRenderTarget._Resize(this._width,this._height);y.bindFramebuffer(y.FRAMEBUFFER,null);this._currentRenderTarget=null;B.currentFramebuffer=null}}_SetDepthBufferSize(r,w){const y=this._gl;if(this._depthBuffer){if(this._depthBufferWidth===r&&this._depthBufferHeight===w)return;y.deleteRenderbuffer(this._depthBuffer)}this._depthBuffer=y.createRenderbuffer();y.bindRenderbuffer(y.RENDERBUFFER,this._depthBuffer);y.renderbufferStorage(y.RENDERBUFFER,2<=this._version?y.DEPTH24_STENCIL8:y.DEPTH_STENCIL,r,w);y.bindRenderbuffer(y.RENDERBUFFER,null);this._depthBufferWidth=r;this._depthBufferHeight=w}SetFixedSizeDepthBuffer(r,w){this._usesDepthBuffer&&(this._isAutoSizeDepthBuffer=!1,this._SetDepthBufferSize(r,w))}SetAutoSizeDepthBuffer(){this._usesDepthBuffer&&(this._isAutoSizeDepthBuffer=!0,this._SetDepthBufferSize(this._width,this._height))}SetViewportScissor(r,w){const y=this._gl;if(this._width===r&&this._height===w)this._isScissorViewport&&(this.EndBatch(),y.disable(y.SCISSOR_TEST),this._isScissorViewport=!1,this._viewportScissorHeight=this._viewportScissorWidth=-1,this.SetSize(this._width,this._height,!0));else if(this._isScissorViewport||(this.EndBatch(),y.enable(y.SCISSOR_TEST),this._isScissorViewport=!0),this._viewportScissorWidth!==r||this._viewportScissorHeight!==w)this.EndBatch(),y.scissor(0,0,r,w),this._viewportScissorWidth=r,this._viewportScissorHeight=w,this.SetSize(this._width,this._height,!0)}RemoveViewportScissor(){const r=this._gl;this._isScissorViewport&&(this.EndBatch(),r.disable(r.SCISSOR_TEST),this._isScissorViewport=!1);this._viewportScissorHeight=this._viewportScissorWidth=-1}GetScissoredViewportWidth(){return this._isScissorViewport?this._viewportScissorWidth:this.GetWidth()}GetScissoredViewportHeight(){return this._isScissorViewport?this._viewportScissorHeight:this.GetHeight()}_SetViewport(r,w,y,B){const E=this._viewport;if(E[0]!==r||E[1]!==w||E[2]!==y||E[3]!==B)this.PushBatch().InitSetViewport(r,w,y,B),b.set(E,r,w,y,B),this._topOfBatch=0}SetProjectionMatrix(r){d.exactEquals(this._matP,r)||(this.PushBatch().InitSetProjection(r),d.copy(this._matP,r),this._topOfBatch=0)}SetDefaultRenderTargetProjectionState(){let r,w;var y=this._currentRenderTarget;null===y||y.IsDefaultSize()&&this._isScissorViewport?(r=this._bbProjectionMatrix,w=this.GetScissoredViewportWidth(),y=this.GetScissoredViewportHeight()):(r=y.GetProjectionMatrix(),w=y.GetWidth(),y=y.GetHeight());this.SetProjectionMatrix(r);this._SetViewport(0,0,w,y)}SetModelViewMatrix(r){d.exactEquals(this._matMV,r)||(this.PushBatch().InitSetModelView(r),d.copy(this._matMV,r),this._topOfBatch=0)}GetBatchState(){return this._batchState}PushBatch(){const r=this._batch;this._batchPtr===r.length&&r.push(new e.Gfx.WebGLBatchJob(this._batchState));return r[this._batchPtr++]}EndBatch(){0===this._batchPtr||this.IsContextLost()||(this._WriteBuffers(),this._ExecuteBatch(),this._topOfBatch=this._pointPtr=this._texPtr=this._vertexPtr=this._batchPtr=0)}_WriteBuffers(){const r=this._gl;0<this._pointPtr&&(r.bindBuffer(r.ARRAY_BUFFER,this._pointBuffer),r.bufferSubData(r.ARRAY_BUFFER,0,this._pointData.subarray(0,this._pointPtr)));0<this._vertexPtr&&(r.bindBuffer(r.ARRAY_BUFFER,this._vertexBuffer),r.bufferSubData(r.ARRAY_BUFFER,0,this._vertexData.subarray(0,this._vertexPtr)),r.bindBuffer(r.ARRAY_BUFFER,this._texcoordBuffer),r.bufferSubData(r.ARRAY_BUFFER,0,this._texcoordData.subarray(0,this._texPtr)))}_ExecuteBatch(){const r=this._batch;for(let w=0,y=this._batchPtr;w<y;++w)r[w].Run()}GetOpacity(){return this._lastColor.getA()}SetColorRgba(r,w,y,B){const E=this._lastColor;E.equalsRgba(r,w,y,B)||(E.setRgba(r,w,y,B),this.PushBatch().InitSetColor(E),this._topOfBatch=0,this._currentStateGroup=null)}SetOpacity(r){const w=this._lastColor;w.getA()!==r&&(w.setA(r),this.PushBatch().InitSetColor(w),this._topOfBatch=0,this._currentStateGroup=null)}SetColor(r){const w=this._lastColor;w.equals(r)||(w.set(r),this.PushBatch().InitSetColor(w),this._topOfBatch=0,this._currentStateGroup=null)}ResetColor(){this.SetColorRgba(1,1,1,1)}GetColor(){return this._lastColor}SetTexture(r){r!==this._lastTexture0&&(this.PushBatch().InitSetTexture(r),this._lastTexture0=r,this._topOfBatch=0)}_ResetLastTexture(){this._lastTexture0=null}SetBlendMode(r){r=this._GetBlendByIndex(r);this._SetBlend(r[0],r[1])}SetNamedBlendMode(r){r=this.GetNamedBlend(r);this._SetBlend(r.srcBlend,r.destBlend)}_SetBlend(r,w){if(r!==this._lastSrcBlend||w!==this._lastDestBlend)this.PushBatch().InitSetBlend(r,w),this._lastSrcBlend=r,this._lastDestBlend=w,this._topOfBatch=0,this._currentStateGroup=null}IsPremultipliedAlphaBlend(){return this._lastSrcBlend===this._gl.ONE&&this._lastDestBlend===this._gl.ONE_MINUS_SRC_ALPHA}SetAlphaBlend(){this._SetBlend(this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA)}SetNoPremultiplyAlphaBlend(){this._SetBlend(this._gl.SRC_ALPHA,this._gl.ONE_MINUS_SRC_ALPHA)}SetCopyBlend(){this._SetBlend(this._gl.ONE,this._gl.ZERO)}Rect(r){this.Rect2(r.getLeft(),r.getTop(),r.getRight(),r.getBottom())}Rect2(r,w,y,B){this.Quad2(r,w,y,w,y,B,r,B)}_ExtendQuadBatch(){let r=this._vertexPtr;r>=this._lastVertexPtr&&(this.EndBatch(),r=0);1===this._topOfBatch?this._batch[this._batchPtr-
  1]._indexCount+=6:(this.PushBatch().InitQuad(r,6),this._topOfBatch=1)}_WriteQuadToVertexBuffer(r){r.writeToTypedArray3D(this._vertexData,this._vertexPtr,this._baseZ+this._currentZ);this._vertexPtr+=12}Quad(r){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(r);h.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad2(r,w,y,B,E,H,K,C){this._ExtendQuadBatch();const A=this._vertexData;let F=this._vertexPtr;const J=this._baseZ+this._currentZ;A[F++]=r;A[F++]=w;A[F++]=J;A[F++]=y;A[F++]=B;A[F++]=J;A[F++]=E;A[F++]=H;A[F++]=J;A[F++]=K;A[F++]=C;A[F++]=J;this._vertexPtr=F;h.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad3(r,w){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(r);w.writeAsQuadToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad4(r,w){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(r);w.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad3D(r,w,y,B,E,H,K,C,A,F,J,L,R){this._ExtendQuadBatch();const T=this._vertexData;let V=this._vertexPtr;const ba=this._baseZ+this._currentZ;T[V++]=r;T[V++]=w;T[V++]=ba+y;T[V++]=B;T[V++]=E;T[V++]=ba+H;T[V++]=K;T[V++]=C;T[V++]=ba+A;T[V++]=F;T[V++]=J;T[V++]=ba+L;this._vertexPtr=V;R.writeAsQuadToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad3D2(r,w,y,B,E,H,K,C,A,F,J,L,R){this._ExtendQuadBatch();const T=this._vertexData;let V=this._vertexPtr;const ba=this._baseZ+this._currentZ;T[V++]=r;T[V++]=w;T[V++]=ba+y;T[V++]=B;T[V++]=E;T[V++]=ba+H;T[V++]=K;T[V++]=C;T[V++]=ba+
  A;T[V++]=F;T[V++]=J;T[V++]=ba+L;this._vertexPtr=V;R.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}FullscreenQuad(r,w){d.copy(g,this._matP);d.copy(l,this._matMV);this.SetDefaultRenderTargetProjectionState();if(this._isScissorViewport){r=this.CalculateLookAtModelView2(0,0,this.GetDefaultCameraZ()*self.devicePixelRatio,0,0,0);this.SetModelViewMatrix(r);r=this._viewportScissorWidth/2;var y=this._viewportScissorHeight/2;u.set(-r,y,-r+this._viewportScissorWidth,y-this._viewportScissorHeight);m.setFromRect(u);u.set(0,0,this._viewportScissorWidth/this._width,this._viewportScissorHeight/this._height);this.Quad3(m,u)}else{const[H,K]=this.GetRenderTargetSize(this._currentRenderTarget);y=this.CalculateLookAtModelView2(0,0,this.GetDefaultCameraZ()*self.devicePixelRatio,0,0,0,K);this.SetModelViewMatrix(y);if("crop"===r&&this._currentRenderTarget&&w){r=this._width/2;y=this._height/2;const C=w.GetWidth();w=w.GetHeight();var B=this._currentRenderTarget.GetWidth(),E=this._currentRenderTarget.GetHeight();B=Math.min(B,C);const A=Math.min(E,w),F=Math.max(w-E,0);E=Math.max(E-w,0);u.set(-r,y-E,-r+B,y-A-E);m.setFromRect(u);u.set(0,F,B,A+F);u.divide(C,w);this.Quad3(m,u)}else r=H/2,y=K/2,this.Rect2(-r,y,r,-y)}this.SetProjectionMatrix(g);this.SetModelViewMatrix(l)}StartRenderingPoints(r){this._lastPointTexCoords.equals(r)||(this._lastPointTexCoords.copy(r),this.PushBatch().InitSetPointTexCoords(r),this._topOfBatch=0)}FinishRenderingPoints(){}Point(r,w,y,B){7996<=this._pointPtr&&this.EndBatch();let E=this._pointPtr;var H=this._baseZ+this._currentZ;2===this._topOfBatch&&this._lastPointZ===H?this._batch[this._batchPtr-1]._indexCount++:(this.PushBatch().InitPoints(E,H),this._topOfBatch=2,this._lastPointZ=H);H=this._pointData;H[E++]=r;H[E++]=w;H[E++]=y;H[E++]=B;this._pointPtr=E}SetProgram(r){this._lastProgram!==r&&(this.PushBatch().InitSetProgram(r),this._lastProgram=r,this._topOfBatch=0,this._currentStateGroup=null)}SetDeviceTransformTextureFillMode(){this.SetProgram(this._spDeviceTransformTextureFill)}SetGradientColor(r){this.PushBatch().InitSetGradientColor(r);this._topOfBatch=0}SetEllipseParams(r,w,y=1){this.PushBatch().InitSetEllipseParams(r,w,y);this._topOfBatch=0}SetTilemapInfo(r,w,y,B,E,H,K){if(this._lastProgram!==this._spTilemapFill)throw Error("must set tilemap fill mode first");this.PushBatch().InitSetTilemapInfo(r,w,y,B,E,H,K);this._topOfBatch=0}SetProgramParameters(r,w,y,B,E,H,K,C,A,F,J){const L=this._lastProgram;var R=L._hasAnyOptionalUniforms;const T=!!J.length;if(R&&!L.AreOptionalUniformsAlreadySetInBatch(w,y,B,E,H,K,C,A,F)||T&&!L.AreCustomParametersAlreadySetInBatch(J)){var V=this.PushBatch();V.InitSetProgramParameters();R&&(L.SetOptionalUniformsInBatch(w,y,B,E,H,K,C,A,F),R=V._mat4param,R[0]=H,R[1]=K,w.writeToTypedArray(R,2),R[6]=C,R[7]=A,y.writeToTypedArray(R,12),w=V._colorParam,E.writeToTypedArray(w,0),E=w[1],w[1]=w[3],w[3]=E,B.writeToTypedArray(V._srcOriginRect,0),V._startIndex=F,L._uSamplerBack.IsUsed()?V._texParam=r?r.GetTexture():null:V._texParam=null);T&&(L.SetCustomParametersInBatch(J),e.shallowAssignArray(V._shaderParams,J));this._topOfBatch=0}}ClearRgba(r,w,y,B){this.PushBatch().InitClearSurface2(r,w,y,B);this._topOfBatch=0}Clear(r){this.PushBatch().InitClearSurface(r);this._topOfBatch=0}ClearRect(r,w,y,B){this.ClearRect4(r,w,y,B,0,0,0,0)}ClearRect2(r){this.ClearRect4(r.getLeft(),r.getTop(),r.width(),r.height(),0,0,0,0)}ClearRect3(r,w){this.ClearRect4(r.getLeft(),r.getTop(),r.width(),r.height(),w.getR(),w.getG(),w.getB(),w.getA())}ClearRect4(r,w,y,B,E,H,K,C){0>y||0>B||(this.PushBatch().InitClearRect(r,w,y,B,E,H,K,C),this._topOfBatch=0)}Start(){}Finish(){super.Finish();this._gl.flush()}ClearDepth(){this._usesDepthBuffer&&this._currentRenderTarget&&this._currentRenderTarget.HasDepthBuffer()&&(this.PushBatch().InitClearDepth(),this._topOfBatch=0)}SetDepthEnabled(r){r=!!r;this._isDepthEnabled!==r&&this._usesDepthBuffer&&(this._isDepthEnabled=r,this.PushBatch().InitSetDepthEnabled(r),this._topOfBatch=0)}_GetDepthBuffer(){return this._depthBuffer}CheckForQueryResults(){for(const r of this._allQueryResultBuffers)r.CheckForResults(this._frameNumber)}IsContextLost(){return!this._gl||this._gl.isContextLost()||this._isInitialisingAfterContextRestored}OnContextLost(){super.OnDeviceOrContextLost();e.Gfx.WebGLRendererTexture.OnContextLost();e.Gfx.WebGLRenderTarget.OnContextLost();e.Gfx.RendererText.OnContextLost();for(const r of this._allQueryResultBuffers)r.Clear();this._extensions=[];this._anisotropicExt=this._parallelShaderCompileExt=this._timerExt=null;this._maxAnisotropy=0;this._unmaskedRenderer=this._unmaskedVendor="(unavailable)";this._depthBuffer=this._spDeviceTransformTextureFill=this._lastProgram=null;for(const r of this._stateGroups.values())r.OnContextLost()}async OnContextRestored(){this._isInitialisingAfterContextRestored=!0;await this.InitState();this._isInitialisingAfterContextRestored=!1;for(const r of this._stateGroups.values())r.OnContextRestored(this);this.SetSize(this._width,this._height,!0)}CreateStaticTexture(r,w){if(this.IsContextLost())throw Error("context lost");this.EndBatch();const y=e.New(e.Gfx.WebGLRendererTexture,this);y._CreateStatic(r,w);return y}CreateStaticTextureAsync(r,w){if(this.IsContextLost())return Promise.reject("context lost");w=Object.assign({},w);const y=w.wrapX&&"clamp-to-edge"!==w.wrapX||w.wrapY&&"clamp-to-edge"!==w.wrapY;if(!e.Supports.ImageBitmapOptions||!this.SupportsNPOTTextures()&&y)return e.Supports.ImageBitmap?createImageBitmap(r).then(B=>e.Asyncify(()=>this.CreateStaticTexture(B,w))):r instanceof Blob?e.BlobToImage(r,!0).then(B=>this.CreateStaticTextureAsync(B,w)):"undefined"!==typeof HTMLImageElement&&r instanceof HTMLImageElement&&"function"===typeof r.decode?r.decode().then(()=>e.Asyncify(()=>this.CreateStaticTexture(r,w))):e.Asyncify(()=>this.CreateStaticTexture(r,w));w.premultiplyAlpha=!1;return createImageBitmap(r,{premultiplyAlpha:"premultiply"}).then(B=>e.Asyncify(()=>this.CreateStaticTexture(B,w)))}CreateDynamicTexture(r,w,y){this.EndBatch();const B=e.New(e.Gfx.WebGLRendererTexture,this);B._CreateDynamic(r,w,y);return B}UpdateTexture(r,w,y){this.EndBatch();w._Update(r,y)}DeleteTexture(r){r&&(r.SubtractReference(),0<r.GetReferenceCount()||(this.EndBatch(),r===this._lastTexture0&&(this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._lastTexture0=null),r===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),r._Delete()))}CreateRenderTarget(r){let w=this._width,y=this._height,B=!0;r&&("number"===typeof r.width&&(w=r.width,B=!1),"number"===typeof r.height&&(y=r.height,B=!1));if(0>=w||0>=y)throw Error("invalid size");this.EndBatch();const E=e.New(e.Gfx.WebGLRenderTarget,this);E._Create(w,y,Object.assign({isDefaultSize:B},r));this._currentRenderTarget=null;this._batchState.currentFramebuffer=null;return E}SetRenderTarget(r){r!==this._currentRenderTarget&&(r&&r.IsDefaultSize()&&r._Resize(this._width,this._height),this.PushBatch().InitSetRenderTarget(r),this._currentRenderTarget=r,this._topOfBatch=0,this.SetDefaultRenderTargetProjectionState())}GetRenderTarget(){return this._currentRenderTarget}GetRenderTargetSize(r){return r?[r.GetWidth(),r.GetHeight()]:[this._width,this._height]}CopyRenderTarget(r,w="stretch"){2>this._version||this._currentRenderTarget&&0<this._currentRenderTarget.GetMultisampling()?(this.SetCopyBlend(),this.ResetColor(),this.DrawRenderTarget(r,w)):(this.PushBatch().InitBlitFramebuffer(r,this._currentRenderTarget,w),this._topOfBatch=0)}DrawRenderTarget(r,w="stretch"){r=r.GetTexture();if(!r)throw Error("not a texture-backed render target");this.SetTexture(r);this.FullscreenQuad(w,r)}InvalidateRenderTarget(r){2>this._version||(this.PushBatch().InitInvalidateFramebuffer(r._GetFramebuffer()),this._topOfBatch=0)}DeleteRenderTarget(r){this.SetRenderTarget(null);this.EndBatch();const w=r.GetTexture();w===this._lastTexture0&&(this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._lastTexture0=null);w===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);r._Delete()}async ReadBackRenderTargetToImageData(r,w,y){this.EndBatch();const B=this._currentRenderTarget;if(r){var E=r.GetWidth();var H=r.GetHeight();var K=r._GetFramebuffer()}else E=this.GetWidth(),H=this.GetHeight(),K=null;let C=r=0;var A=E,F=H;y&&(r=e.clamp(Math.floor(y.getLeft()),0,E-1),C=e.clamp(Math.floor(y.getTop()),0,H-1),A=y.width(),A=0===A?E-r:e.clamp(Math.floor(A),0,E-r),F=y.height(),F=0===F?H-C:e.clamp(Math.floor(F),0,H-C),C=H-(C+F));const J=this._gl;J.bindFramebuffer(J.FRAMEBUFFER,K);H=()=>{J.bindFramebuffer(J.FRAMEBUFFER,null);this._currentRenderTarget=null;this._batchState.currentFramebuffer=null;this.SetRenderTarget(B)};if(!w&&2<=this.GetWebGLVersionNumber()){J.bindFramebuffer(J.READ_FRAMEBUFFER,K);K=J.createBuffer();y=A*F*4;E=J.PIXEL_PACK_BUFFER;J.bindBuffer(E,K);J.bufferData(E,y,J.STREAM_READ);J.readPixels(r,C,A,F,J.RGBA,J.UNSIGNED_BYTE,0);J.bindFramebuffer(J.READ_FRAMEBUFFER,null);J.bindBuffer(E,null);H();const L=J.fenceSync(J.SYNC_GPU_COMMANDS_COMPLETE,0);await this._WaitForObjectReady(()=>J.getSyncParameter(L,J.SYNC_STATUS)===J.SIGNALED);J.deleteSync(L);w=new ImageData(A,F);J.bindBuffer(E,K);J.getBufferSubData(E,0,new Uint8Array(w.data.buffer),0,y);J.bindBuffer(E,null);J.deleteBuffer(K)}else w=new ImageData(A,F),J.readPixels(r,C,A,F,J.RGBA,J.UNSIGNED_BYTE,new Uint8Array(w.data.buffer)),H();return w}CoplanarStartStencilPass(){this.SetDepthEnabled(!0);this.PushBatch().InitCoplanarStartStencilPass();this._topOfBatch=0}CoplanarStartColorPass(){this.SetDepthEnabled(!1);this.PushBatch().InitCoplanarStartColorPass();this._topOfBatch=0}CoplanarRestoreStandardRendering(){this.SetDepthEnabled(!0);this.PushBatch().InitCoplanarRestore();this._topOfBatch=0}StartQuery(r){this.SupportsGPUProfiling()&&(this.PushBatch().InitStartQuery(r),this._topOfBatch=0)}EndQuery(r){this.SupportsGPUProfiling()&&(this.PushBatch().InitEndQuery(r),this._topOfBatch=0)}_WaitForObjectReady(r){const w=new Promise(y=>n.add({resolve:y,checkFunc:r}));-1===q&&(q=self.requestAnimationFrame(t));return w}IsDesynchronized(){return!!this._attribs.desynchronized}GetEstimatedBackBufferMemoryUsage(){return this._width*this._height*(this._attribs.alpha?4:3)}GetEstimatedRenderBufferMemoryUsage(){let r=0;for(const w of e.Gfx.WebGLRenderTarget.allRenderTargets())w.GetTexture()||(r+=w.GetEstimatedMemoryUsage());return r}GetEstimatedTextureMemoryUsage(){let r=0;for(const w of e.Gfx.WebGLRendererTexture.allTextures())r+=w.GetEstimatedMemoryUsage();return r}GetEstimatedTotalMemoryUsage(){return this.GetEstimatedBackBufferMemoryUsage()+this.GetEstimatedRenderBufferMemoryUsage()+this.GetEstimatedTextureMemoryUsage()}GetWebGLVersionString(){return this._versionString}GetWebGLVersionNumber(){return this._version}GetDisplayName(){return"webgl"+
  this.GetWebGLVersionNumber()}SupportsNPOTTextures(){return 2<=this.GetWebGLVersionNumber()}GetMaxTextureSize(){return this._maxTextureSize}GetMinPointSize(){return this._minPointSize}GetMaxPointSize(){return this._maxPointSize}SupportsHighP(){return 0!==this._highpPrecision}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(r){this._allQueryResultBuffers.add(r)}_RemoveQueryResultBuffer(r){this._allQueryResultBuffers.delete(r)}_GetTimeQueryStack(){return this._timeQueryStack}GetContext(){return this._gl}_InitBlendModes(r){this._InitBlendModeData([["normal",r.ONE,r.ONE_MINUS_SRC_ALPHA],["additive",r.ONE,r.ONE],["xor",r.ONE,r.ONE_MINUS_SRC_ALPHA],["copy",r.ONE,r.ZERO],["destination-over",r.ONE_MINUS_DST_ALPHA,r.ONE],["source-in",r.DST_ALPHA,r.ZERO],["destination-in",r.ZERO,r.SRC_ALPHA],["source-out",r.ONE_MINUS_DST_ALPHA,r.ZERO],["destination-out",r.ZERO,r.ONE_MINUS_SRC_ALPHA],["source-atop",r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],["destination-atop",r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA]])}CreateRendererText(){return e.New(e.Gfx.RendererText,this)}CreateWebGLText(){return this.CreateRendererText()}}}
  {"use strict";const e=self.C3,a=self.C3X;let b=null;const d=new Set;function c(l,m){const u=l[0]-m[0];return 0!==u?u:l[1]-m[1]}const f=[],h=[];let g=!1;self.IRuntime=class{constructor(l,m){b=l;Object.defineProperties(this,{assets:{value:b.GetAssetManager().GetIAssetManager(),writable:!1},objects:{value:m,writable:!1},globalVars:{value:{},writable:!1},projectName:{value:b.GetProjectName(),writable:!1},projectVersion:{value:b.GetProjectVersion(),writable:!1},storage:{value:new self.IStorage(b),writable:!1},isInWorker:{value:b.IsInWorker(),writable:!1}});b.UserScriptDispatcher().addEventListener("keydown",u=>{d.has(u.key)?u.stopPropagation():d.add(u.key)});b.UserScriptDispatcher().addEventListener("keyup",u=>d.delete(u.key));b.Dispatcher().addEventListener("window-blur",()=>d.clear());b.IsInWorker()&&(self.alert=u=>{g||(g=!0,console.warn("[Construct 3] 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(u)})}_InitGlobalVars(l){Object.defineProperties(this.globalVars,l)}addEventListener(l,m){b.UserScriptDispatcher().addEventListener(l,m)}removeEventListener(l,m){b.UserScriptDispatcher().removeEventListener(l,m)}callFunction(l,...m){a.RequireString(l);const u=b.GetEventSheetManager(),x=u.GetFunctionBlockByName(l);if(!x)throw Error(`cannot find function name '${l}'`);if(!x.IsEnabled())return x.GetDefaultReturnValue();if(m.length<x.GetFunctionParameterCount())throw Error(`not enough function parameters passed for '${l}' (${m.length} passed, ${x.GetFunctionParameterCount()} expected)`);const n=x.GetEventBlock();l=null;var q=u.GetCurrentEvent();q&&(q=q.GetSolModifiersIncludingParents(),0<q.length&&(l=q,u.PushCleanSol(q)));m=n.RunAsExpressionFunctionCall(n.GetSolModifiersIncludingParents(),x.GetReturnType(),x.GetDefaultReturnValue(),...m);l&&u.PopSol(l);return m}setReturnValue(l){const m=b.GetEventStack().GetCurrentExpFuncStackFrame();if(!m)throw Error("not in a function which returns a value");switch(m.GetFunctionReturnType()){case 1:"number"===typeof l&&m.SetFunctionReturnValue(l);break;case 2:"string"===typeof l&&m.SetFunctionReturnValue(l);break;case 3:"number"!==typeof l&&"string"!==typeof l||m.SetFunctionReturnValue(l)}}get dt(){return b.GetDt()}get gameTime(){return b.GetGameTime()}get wallTime(){return b.GetWallTime()}random(){return b.Random()}get layout(){return b.GetMainRunningLayout().GetILayout()}getLayout(l){const m=b.GetLayoutManager();if("number"===typeof l||"string"===typeof l)l=m.GetLayout(l);else throw new TypeError("expected string or number");if(!l)throw Error("invalid layout");return l.GetILayout()}getAllLayouts(){return b.GetLayoutManager().GetAllLayouts().map(l=>l.GetILayout())}goToLayout(l){const m=b.GetLayoutManager();if("number"===typeof l||"string"===typeof l)l=m.GetLayout(l);else throw new TypeError("expected string or number");if(!l)throw Error("invalid layout");m.IsPendingChangeMainLayout()||m.ChangeMainLayout(l)}get keyboard(){const l=b._GetCommonScriptInterfaces().keyboard;if(!l)throw Error("runtime.keyboard used but Keyboard object missing - add it to your project first");return l}get mouse(){const l=b._GetCommonScriptInterfaces().mouse;if(!l)throw Error("runtime.mouse used but Mouse object missing - add it to your project first");return l}get touch(){const l=b._GetCommonScriptInterfaces().touch;if(!l)throw Error("runtime.touch used but Touch object missing - add it to your project first");return l}invokeDownload(l,m){a.RequireString(l);a.RequireString(m);b.InvokeDownload(l,m)}getInstanceByUid(l){a.RequireFiniteNumber(l);return(l=b.GetInstanceByUID(l))?l.GetInterfaceClass():null}sortZOrder(l,m){a.RequireFunction(m);const u=b.GetCurrentLayout();for(var x of l){l=b._UnwrapIWorldInstance(x);var n=l.GetWorldInfo();f.push([n.GetLayer().GetIndex(),n.GetZIndex()]);h.push(l)}if(0!==f.length){f.sort(c);h.sort((q,t)=>m(q.GetInterfaceClass(),t.GetInterfaceClass()));x=!1;for(let q=0,t=f.length;q<t;++q){l=h[q];n=u.GetLayerByIndex(f[q][0]);const r=f[q][1],w=n._GetInstances();w[r]!==l&&(w[r]=l,l.GetWorldInfo()._SetLayer(n),n.SetZIndicesChanged(),x=!0)}x&&b.UpdateRender();e.clearArray(f);e.clearArray(h)}}alert(l){return b.PostComponentMessageToDOMAsync("runtime","alert",{message:l+(b.IsInWorker()?" [via Web Worker]":"")})}}}
  {"use strict";const e=self.C3;let a=null;self.IAssetManager=class{constructor(b){a=b;Object.defineProperties(this,{isWebMOpusSupported:{value:a.IsAudioFormatSupported("audio/webm; codecs=opus"),writable:!1}})}fetchText(b){return a.FetchText(b)}fetchJson(b){return a.FetchJson(b)}fetchBlob(b){return a.FetchBlob(b)}fetchArrayBuffer(b){return a.FetchArrayBuffer(b)}getProjectFileUrl(b){return a.GetProjectFileUrl(b)}getMediaFileUrl(b){e.IsRelativeURL(b)&&(b=b.toLowerCase());return a.GetMediaFileUrl(b,a.GetMediaSubfolder())}get mediaFolder(){return a.GetMediaSubfolder()}async decodeWebMOpus(b,d){if(this.isWebMOpusSupported)throw Error("decodeWebMOpus(): not supported because WebM Opus is supported by the platform");d=await a.GetRuntime()._WasmDecodeWebMOpus(d);d=new Float32Array(d);b=b.createBuffer(1,d.length,48E3);b.getChannelData(0).set(d);return b}loadScripts(...b){return a.LoadScripts(...b)}compileWebAssembly(b){return a.CompileWebAssembly(b)}loadStyleSheet(b){return a.LoadStyleSheet(b)}}}
  {"use strict";const e=self.C3X;self.IStorage=class{constructor(a){this._storage=a._GetProjectStorage()}getItem(a){e.RequireString(a);return this._storage.getItem(a)}setItem(a,b){e.RequireString(a);return this._storage.setItem(a,b)}removeItem(a){e.RequireString(a);return this._storage.removeItem(a)}clear(){return this._storage.clear()}keys(){return this._storage.keys()}}}
  {"use strict";const e=self.C3X,a=new WeakMap;self.IObjectClass=class{constructor(b){a.set(this,b);Object.defineProperties(this,{name:{value:b.GetName(),writable:!1}});b.GetRuntime()._MapScriptInterface(this,b)}addEventListener(b,d){e.RequireString(b);e.RequireFunction(d);a.get(this).UserScriptDispatcher().addEventListener(b,d)}removeEventListener(b,d){e.RequireString(b);e.RequireFunction(d);a.get(this).UserScriptDispatcher().removeEventListener(b,d)}getAllInstances(){return a.get(this).GetInstances().map(b=>b.GetInterfaceClass())}getFirstInstance(){const b=a.get(this).GetInstances();return 0<b.length?b[0].GetInterfaceClass():null}getPickedInstances(){return a.get(this).GetCurrentSol().GetInstances().map(b=>b.GetInterfaceClass())}getFirstPickedInstance(){const b=a.get(this).GetCurrentSol().GetInstances();return 0<b.length?b[0].GetInterfaceClass():null}*instances(){for(const b of a.get(this).GetInstances())yield b.GetInterfaceClass()}*pickedInstances(){for(const b of a.get(this).GetCurrentSol().GetInstances())yield b.GetInterfaceClass()}setInstanceClass(b){e.RequireFunction(b);if(0<a.get(this).GetInstanceCount())throw Error("setInstanceClass() called too late, because instances have already been created - call in runOnStartup");a.get(this)._SetUserScriptInstanceClass(b)}createInstance(b,d,c,f){e.RequireNumber(d);e.RequireNumber(c);if("number"!==typeof b&&"string"!==typeof b)throw new TypeError("invalid layer parameter");const h=a.get(this),g=h.GetRuntime();b=g.GetMainRunningLayout().GetLayer(b);if(!b)throw Error("invalid layer");d=g.CreateInstance(h,b,d,c,f);f&&b.SortAndAddInstancesByZIndex(d);f=g.GetEventSheetManager();f.BlockFlushingInstances(!0);d._TriggerOnCreatedOnSelfAndRelated();f.BlockFlushingInstances(!1);return d.GetInterfaceClass()}}}
  {"use strict";const e=self.C3X,a=new WeakMap;self.ILayout=class{constructor(b){a.set(this,b);const d=[],c=b.GetEffectList(),f=c.GetAllEffectTypes().length;for(let h=0;h<f;++h)d.push(new self.IEffectInstance(c,h));Object.defineProperties(this,{name:{value:b.GetName(),writable:!1},index:{value:b.GetIndex(),writable:!1},effects:{value:d,writable:!1}})}addEventListener(b,d){e.RequireString(b);e.RequireFunction(d);a.get(this).UserScriptDispatcher().addEventListener(b,d)}removeEventListener(b,d){e.RequireString(b);e.RequireFunction(d);a.get(this).UserScriptDispatcher().removeEventListener(b,d)}get width(){return a.get(this).GetWidth()}set width(b){a.get(this).SetWidth(b)}get height(){return a.get(this).GetHeight()}set height(b){a.get(this).SetHeight(b)}set scale(b){e.RequireFiniteNumber(b);a.get(this).SetScale(b)}get scale(){return a.get(this).GetScale()}set angle(b){e.RequireFiniteNumber(b);a.get(this).SetAngle(b)}get angle(){return a.get(this).GetAngle()}set scrollX(b){e.RequireNumber(b);a.get(this).SetScrollX(b)}get scrollX(){return a.get(this).GetScrollX()}set scrollY(b){e.RequireNumber(b);a.get(this).SetScrollY(b)}get scrollY(){return a.get(this).GetScrollY()}scrollTo(b,d){e.RequireNumber(b);e.RequireNumber(d);const c=a.get(this);c.SetScrollX(b);c.SetScrollY(d)}getLayer(b){const d=a.get(this);if("number"===typeof b||"string"===typeof b)b=d.GetLayer(b);else throw new TypeError("expected string or number");return b?b.GetILayer():null}getAllLayers(){return a.get(this).GetLayers().map(b=>b.GetILayer())}setVanishingPoint(b,d){e.RequireFiniteNumber(b);e.RequireFiniteNumber(d);a.get(this).SetVanishingPointXY(b,d)}getVanishingPoint(){return a.get(this)._GetVanishingPoint()}set projection(b){e.RequireString(b);const d=a.get(this);if("perspective"===b)d.SetPerspectiveProjection();else if("orthographic"===b)d.SetOrthographicProjection();else throw Error("invalid projection");}get projection(){return a.get(this).IsOrthographicProjection()?"orthographic":"perspective"}}}
  {"use strict";const e=self.C3,a=self.C3X,b=new WeakMap,d=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]]),c=new Map([...d.entries()].map(h=>[h[1],h[0]])),f=e.New(e.Color);self.ILayer=class{constructor(h){b.set(this,h);const g=[],l=h.GetEffectList(),m=l.GetAllEffectTypes().length;for(let u=0;u<m;++u)g.push(new self.IEffectInstance(l,u));Object.defineProperties(this,{name:{value:h.GetName(),writable:!1},index:{value:h.GetIndex(),writable:!1},layout:{value:h.GetLayout().GetILayout(),writable:!1},effects:{value:g,writable:!1}})}static _Unwrap(h){return b.get(h)}get isVisible(){return b.get(this).IsVisible()}set isVisible(h){b.get(this).SetVisible(h)}get opacity(){return b.get(this).GetOpacity()}set opacity(h){h=e.clamp(+h,0,1);isNaN(h)||b.get(this).SetOpacity(h)}set scale(h){a.RequireFiniteNumber(h);b.get(this).SetOwnScale(h)}get scale(){return b.get(this).GetOwnScale()}set scaleRate(h){a.RequireFiniteNumber(h);b.get(this).SetScaleRate(h)}get scaleRate(){return b.get(this).GetScaleRate()}set angle(h){a.RequireFiniteNumber(h);b.get(this).SetAngle(h)}get angle(){return b.get(this).GetOwnAngle()}set parallaxX(h){a.RequireFiniteNumber(h);b.get(this).SetParallaxX(h)}get parallaxX(){return b.get(this).GetParallaxX()}set parallaxY(h){a.RequireFiniteNumber(h);b.get(this).SetParallaxY(h)}get parallaxY(){return b.get(this).GetParallaxY()}set zElevation(h){a.RequireFiniteNumber(h);b.get(this).SetZElevation(h)}get zElevation(){return b.get(this).GetZElevation()}set isTransparent(h){b.get(this).SetTransparent(h)}get isTransparent(){return b.get(this).IsTransparent()}set isForceOwnTexture(h){b.get(this).SetForceOwnTexture(h)}get isForceOwnTexture(){return b.get(this).IsForceOwnTexture()}set blendMode(h){a.RequireString(h);h=d.get(h);if("number"!==typeof h)throw Error("invalid blend mode");b.get(this).SetBlendMode(h)}get blendMode(){return c.get(b.get(this).GetBlendMode())}set backgroundColor(h){a.RequireArray(h);if(3>h.length)throw Error("expected 3 elements");f.setRgb(h[0],h[1],h[2]);h=b.get(this);const g=h.GetBackgroundColor();g.equalsIgnoringAlpha(f)||(g.copyRgb(f),h.GetRuntime().UpdateRender())}get backgroundColor(){const h=b.get(this).GetBackgroundColor();return[h.getR(),h.getG(),h.getB()]}set scrollX(h){a.RequireNumber(h);const g=b.get(this);g.SetOwnScrollPositionEnabled(!0);g.SetScrollX(h)}get scrollX(){return b.get(this).GetScrollX()}set scrollY(h){a.RequireNumber(h);const g=b.get(this);g.SetOwnScrollPositionEnabled(!0);g.SetScrollY(h)}get scrollY(){return b.get(this).GetScrollY()}scrollTo(h,g){a.RequireNumber(h);a.RequireNumber(g);const l=b.get(this);l.SetOwnScrollPositionEnabled(!0);l.SetScrollX(h);l.SetScrollY(g)}restoreScrollPosition(){b.get(this).SetOwnScrollPositionEnabled(!1)}getViewport(){return b.get(this).GetViewport().toDOMRect()}cssPxToLayer(h,g,l=0){a.RequireNumber(h);a.RequireNumber(g);a.RequireNumber(l);const m=b.get(this),u=m.GetRuntime();return m.CanvasCssToLayer(h-u.GetCanvasClientX(),g-u.GetCanvasClientY(),l)}layerToCssPx(h,g,l=0){a.RequireNumber(h);a.RequireNumber(g);a.RequireNumber(l);const m=b.get(this),u=m.GetRuntime(),[x,n]=m.LayerToCanvasCss(h,g,l);return[x+u.GetCanvasClientX(),n+u.GetCanvasClientY()]}}}
  {"use strict";const e=self.C3,a=self.C3X,b=new WeakMap,d=new WeakMap;function c(h){let g=d.get(h);if(g)return g;g=e.New(e.Event.Dispatcher);d.set(h,g);return g}let f=null;self.IInstance=class{constructor(){b.set(this,f);const h={runtime:{value:f.GetRuntime().GetIRuntime(),writable:!1},objectType:{value:f.GetObjectClass().GetIObjectClass(),writable:!1},uid:{value:f.GetUID(),writable:!1}};f._GetInstVarsScriptDescriptor(h);f._GetBehaviorsScriptDescriptor(h);Object.defineProperties(this,h);f.GetRuntime()._MapScriptInterface(this,f)}static _Init(h){f=h}static _GetInitInst(){return f}_Release(){const h=d.get(this);h&&(h.Release(),d.delete(this));b.delete(this)}addEventListener(h,g,l){a.RequireString(h);a.RequireFunction(g);c(this).addEventListener(h,g,l)}removeEventListener(h,g,l){a.RequireString(h);a.RequireFunction(g);c(this).removeEventListener(h,g,l)}dispatchEvent(h){c(this).dispatchEvent(h)}destroy(){const h=b.get(this);h.GetRuntime().DestroyInstance(h)}}}
  {"use strict";const e=self.C3,a=self.C3X,b=self.IInstance,d=self.ILayer,c=new WeakMap,f=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]]),h=new Map([...f.entries()].map(l=>[l[1],l[0]])),g=e.New(e.Color);self.IWorldInstance=class l extends b{constructor(){super();var m=b._GetInitInst();c.set(this,m);const u=[];var x=m.GetWorldInfo();if(m=x.GetInstanceEffectList()){x=x.GetObjectClass().GetEffectList().GetAllEffectTypes().length;for(let n=0;n<x;++n)u.push(new self.IEffectInstance(m,n))}Object.defineProperties(this,{effects:{value:u,writable:!1}})}get layout(){return c.get(this).GetWorldInfo().GetLayout().GetILayout()}get layer(){return c.get(this).GetWorldInfo().GetLayer().GetILayer()}get x(){return c.get(this).GetWorldInfo().GetX()}set x(m){m=+m;const u=c.get(this).GetWorldInfo();isNaN(m)||u.GetX()===m||(u.SetX(m),u.SetBboxChanged())}get y(){return c.get(this).GetWorldInfo().GetY()}set y(m){m=+m;const u=c.get(this).GetWorldInfo();isNaN(m)||u.GetY()===m||(u.SetY(m),u.SetBboxChanged())}get zElevation(){return c.get(this).GetWorldInfo().GetZElevation()}set zElevation(m){m=+m;const u=c.get(this),x=u.GetWorldInfo();isNaN(m)||x.GetZElevation()===m||(x.SetZElevation(m),u.GetRuntime().UpdateRender())}get totalZElevation(){return c.get(this).GetWorldInfo().GetTotalZElevation()}get width(){return c.get(this).GetWorldInfo().GetWidth()}set width(m){m=+m;const u=c.get(this).GetWorldInfo();isNaN(m)||u.GetWidth()===m||(u.SetWidth(m),u.SetBboxChanged())}get height(){return c.get(this).GetWorldInfo().GetHeight()}set height(m){m=+m;const u=c.get(this).GetWorldInfo();isNaN(m)||u.GetHeight()===m||(u.SetHeight(m),u.SetBboxChanged())}get angle(){return c.get(this).GetWorldInfo().GetAngle()}set angle(m){m=e.clampAngle(+m);const u=c.get(this).GetWorldInfo();isNaN(m)||u.GetAngle()===m||(u.SetAngle(m),u.SetBboxChanged())}get angleDegrees(){return e.toDegrees(this.angle)}set angleDegrees(m){this.angle=e.toRadians(m)}getBoundingBox(){return c.get(this).GetWorldInfo().GetBoundingBox().toDOMRect()}getBoundingQuad(){return c.get(this).GetWorldInfo().GetBoundingQuad().toDOMQuad()}get isVisible(){return c.get(this).GetWorldInfo().IsVisible()}set isVisible(m){m=!!m;const u=c.get(this),x=u.GetWorldInfo();x.IsVisible()!==m&&(x.SetVisible(m),u.GetRuntime().UpdateRender())}get opacity(){return c.get(this).GetWorldInfo().GetOpacity()}set opacity(m){m=e.clamp(+m,0,1);const u=c.get(this),x=u.GetWorldInfo();isNaN(m)||x.GetOpacity()===m||(x.SetOpacity(m),u.GetRuntime().UpdateRender())}set colorRgb(m){a.RequireArray(m);if(3>m.length)throw Error("expected 3 elements");g.setRgb(m[0],m[1],m[2]);m=c.get(this);const u=m.GetWorldInfo();u.GetUnpremultipliedColor().equalsIgnoringAlpha(g)||(u.SetUnpremultipliedColor(g),m.GetRuntime().UpdateRender())}get colorRgb(){const m=c.get(this).GetWorldInfo().GetUnpremultipliedColor();return[m.getR(),m.getG(),m.getB()]}set blendMode(m){a.RequireString(m);m=f.get(m);if("number"!==typeof m)throw Error("invalid blend mode");const u=c.get(this);u.GetWorldInfo().SetBlendMode(m);u.GetRuntime().UpdateRender()}get blendMode(){return h.get(c.get(this).GetWorldInfo().GetBlendMode())}moveToTop(){c.get(this).GetWorldInfo().ZOrderMoveToTop()}moveToBottom(){c.get(this).GetWorldInfo().ZOrderMoveToBottom()}moveToLayer(m){a.RequireInstanceOf(m,d);m=d._Unwrap(m);if(!m)throw Error("invalid layer");c.get(this).GetWorldInfo().ZOrderMoveToLayer(m)}moveAdjacentToInstance(m,u){a.RequireInstanceOf(m,l);c.get(this).GetWorldInfo().ZOrderMoveAdjacentToInstance(c.get(m),u)}get zIndex(){return c.get(this).GetWorldInfo().GetZIndex()}containsPoint(m,u){a.RequireNumber(m);a.RequireNumber(u);return c.get(this).GetWorldInfo().ContainsPoint(+m,+u)}testOverlap(m){a.RequireInstanceOf(m,l);const u=c.get(this);m=c.get(m);return u.GetRuntime().GetCollisionEngine().TestOverlap(u,m)}testOverlapSolid(){var m=c.get(this);return(m=m.GetRuntime().GetCollisionEngine().TestOverlapSolid(m))?m.GetInterfaceClass():null}getParent(){const m=c.get(this).GetParent();return m?m.GetInterfaceClass():null}getTopParent(){const m=c.get(this).GetTopParent();return m?m.GetInterfaceClass():null}*parents(){for(const m of c.get(this).parents())yield m.GetInterfaceClass()}getChildCount(){return c.get(this).GetChildCount()}getChildAt(m){return(m=c.get(this).GetChildAt(m))?m.GetInterfaceClass():null}*children(){for(const m of c.get(this).children())yield m.GetInterfaceClass()}*allChildren(){for(const m of c.get(this).allChildren())yield m.GetInterfaceClass()}addChild(m,u){a.RequireInstanceOf(m,l);a.RequireOptionalObject(u);u||(u={});const x=c.get(this);m=c.get(m);x.AddChild(m,u)}removeChild(m){a.RequireInstanceOf(m,l);const u=c.get(this);m=c.get(m);u.RemoveChild(m)}removeFromParent(){const m=c.get(this);m.HasParent()&&m.GetParent().RemoveChild(m)}createMesh(m,u){a.RequireFiniteNumber(m);a.RequireFiniteNumber(u);c.get(this).GetWorldInfo().CreateMesh(m,u)}releaseMesh(){const m=c.get(this).GetWorldInfo();m.ReleaseMesh();m.SetBboxChanged()}setMeshPoint(m,u,x){a.RequireFiniteNumber(m);a.RequireFiniteNumber(u);a.RequireObject(x);const n=c.get(this).GetWorldInfo();n.SetMeshPoint(m,u,x)&&n.SetBboxChanged()}getMeshSize(){var m=c.get(this).GetWorldInfo();if(!m.HasMesh())return[0,0];m=m.GetSourceMesh();return[m.GetHSize(),m.GetVSize()]}}}
  {"use strict";const e=self.C3X,a=new WeakMap;self.IDOMInstance=class extends self.IWorldInstance{constructor(){super();a.set(this,self.IInstance._GetInitInst())}getElement(){return a.get(this).GetSdkInstance()._GetElementInDOMMode()}focus(){a.get(this).GetSdkInstance().FocusElement()}blur(){a.get(this).GetSdkInstance().BlurElement()}setCssStyle(b,d){e.RequireString(b);a.get(this).GetSdkInstance().SetElementCSSStyle(b,d)}}}
  {"use strict";const e=self.C3,a=self.C3X,b=new WeakMap,d=new WeakMap;function c(h){let g=d.get(h);if(g)return g;g=e.New(e.Event.Dispatcher);d.set(h,g);return g}let f=null;self.IBehaviorInstance=class{constructor(){b.set(this,f);const h={runtime:{value:f.GetRuntime().GetIRuntime(),writable:!1},behavior:{value:f.GetBehavior().GetIBehavior(),writable:!1}};Object.defineProperties(this,h)}static _Init(h){f=h}static _GetInitInst(){return f}get instance(){return b.get(this).GetObjectInstance().GetInterfaceClass()}_Release(){const h=d.get(this);h&&(h.Release(),d.delete(this));b.delete(this)}addEventListener(h,g,l){a.RequireString(h);a.RequireFunction(g);c(this).addEventListener(h,g,l)}removeEventListener(h,g,l){a.RequireString(h);a.RequireFunction(g);c(this).removeEventListener(h,g,l)}dispatchEvent(h){c(this).dispatchEvent(h)}}}
  {"use strict";const e=new WeakMap;self.IBehavior=class{constructor(a){e.set(this,a);a={runtime:{value:a.GetRuntime().GetIRuntime(),writable:!1}};Object.defineProperties(this,a)}getAllInstances(){return e.get(this).GetInstances().map(a=>a.GetInterfaceClass())}}}
  {"use strict";const e=self.C3,a=self.C3X,b=new WeakMap;self.IEffectInstance=class{constructor(d,c){b.set(this,d);Object.defineProperties(this,{index:{value:c,writable:!1}})}get name(){return b.get(this).GetAllEffectTypes()[this.index].GetName()}get isActive(){return b.get(this).IsEffectIndexActive(this.index)}set isActive(d){d=!!d;const c=b.get(this);c.IsEffectIndexActive(this.index)!==d&&(c.SetEffectIndexActive(this.index,d),c.UpdateActiveEffects(),c.GetRuntime().UpdateRender())}setParameter(d,c){a.RequireFiniteNumber(d);d=Math.floor(+d);const f=b.get(this);var h=f.GetEffectParametersForIndex(this.index);if(0>d||d>=h.length)throw new RangeError("invalid effect parameter index");const g=h[d];if(g instanceof e.Color){if(!Array.isArray(c)||3>c.length)throw new TypeError("expected array with 3 elements");d=c[0];h=c[1];c=c[2];if(g.equalsRgb(d,h,c))return;g.setRgb(d,h,c)}else{if("number"!==typeof c)throw new TypeError("expected number");if(g===c)return;h[d]=c}f.IsEffectIndexActive(this.index)&&f.GetRuntime().UpdateRender()}getParameter(d){a.RequireFiniteNumber(d);d=Math.floor(+d);const c=b.get(this).GetEffectParametersForIndex(this.index);if(0>d||d>=c.length)throw new RangeError("invalid effect parameter index");d=c[d];return d instanceof e.Color?[d.getR(),d.getG(),d.getB()]:d}}}
  {"use strict";const e=self.C3,a=new Set(["local","remote"]),b=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 d(f){if(!f)return"";f=f.split(".");if(2>f.length)return"";f=f.at(-1).toLowerCase();return b.get(f)||""}function c(f){return new Promise((h,g)=>{const l=document.createElement("script");l.onload=h;l.onerror=g;l.async=!1;l.type="module";l.src=f;document.head.appendChild(l)})}e.AssetManager=class extends e.DefendedBase{constructor(f,h){super();var g=h.exportType;this._runtime=f;this._localUrlBlobs=new Map;this._localBlobUrlCache=new Map;this._localBlobSWUrls=new Map;this._isCordova="cordova"===g;this._isiOSCordova=!!h.isiOSCordova;this._isFileProtocol=!!h.isFileProtocol;this._swClientId=h.swClientId;this._supportedAudioFormats=h.supportedAudioFormats||{};this._audioFiles=new Map;this._preloadSounds=!1;this._iconsSubfolder=this._fontsSubfolder=this._mediaSubfolder="";this._defaultLoadPolicy="html5"===g||"scirra-arcade"===g||"instant-games"===g?"remote":"local";this._allAssets=[];this._assetsByUrl=new Map;this._webFonts=[];this._loadPromises=[];this._hasFinishedInitialLoad=!1;this._lastLoadProgress=this._assetSizeLoaded=this._totalAssetSizeToLoad=0;this._hasHadErrorLoading=!1;this._loadingRateLimiter=e.New(e.RateLimiter,()=>this._FireLoadingProgressEvent(),50);this._promiseThrottle=new e.PromiseThrottle(Math.max(e.hardwareConcurrency,8));if(f=h.previewImageBlobs){(g=h.previewProjectFileBlobs)&&Object.assign(f,g);(g=h.projectData)&&(f["data.json"]=g);for(const[l,m]of Object.entries(f))this._localUrlBlobs.set(l.toLowerCase(),m)}if(h=h.previewProjectFileSWUrls)for(const[l,m]of Object.entries(h))this._localBlobSWUrls.set(l,m);this._iAssetManager=new self.IAssetManager(this)}Release(){this._localUrlBlobs.clear();for(const f of this._localBlobUrlCache.values())f.startsWith("blob:")&&URL.revokeObjectURL(f);this._localBlobUrlCache.clear();for(const f of this._allAssets)f.Release();e.clearArray(this._allAssets);this._assetsByUrl.clear();e.clearArray(this._loadPromises);this._runtime=null}GetRuntime(){return this._runtime}_SetMediaSubfolder(f){this._mediaSubfolder=f}GetMediaSubfolder(){return this._mediaSubfolder}_SetFontsSubfolder(f){this._fontsSubfolder=f}GetFontsSubfolder(){return this._fontsSubfolder}_SetIconsSubfolder(f){this._iconsSubfolder=f}GetIconsSubfolder(){return this._iconsSubfolder}IsFileProtocol(){return this._isFileProtocol}_HasLocalUrlBlob(f){return this._localUrlBlobs.has(f.toLowerCase())}_GetLocalUrlBlob(f){return this._localUrlBlobs.get(f.toLowerCase())||null}GetLocalUrlAsBlobUrl(f){if(!this._HasLocalUrlBlob(f))return f;f=f.toLowerCase();var h=this._localBlobUrlCache.get(f);h||(h=this._GetLocalUrlBlob(f),h=URL.createObjectURL(h),this._localBlobUrlCache.set(f,h));return h}FetchBlob(f,h){h=h||this._defaultLoadPolicy;const g=this._GetLocalUrlBlob(f);if(g)return Promise.resolve(g);if(e.IsRelativeURL(f)){const l=f.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsBlob(l):"local"===h?this._promiseThrottle.Add(()=>e.FetchBlob(l)):e.FetchBlob(l)}return e.FetchBlob(f)}FetchArrayBuffer(f){const h=this._GetLocalUrlBlob(f);if(h)return e.BlobToArrayBuffer(h);if(e.IsRelativeURL(f)){const g=f.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsArrayBuffer(g):"local"===this._defaultLoadPolicy?this._promiseThrottle.Add(()=>e.FetchArrayBuffer(g)):e.FetchArrayBuffer(g)}return e.FetchArrayBuffer(f)}FetchText(f){const h=this._GetLocalUrlBlob(f);if(h)return e.BlobToString(h);if(e.IsRelativeURL(f)){const g=f.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsText(g):"local"===this._defaultLoadPolicy?this._promiseThrottle.Add(()=>e.FetchText(g)):e.FetchText(g)}return e.FetchText(f)}async FetchJson(f){f=await this.FetchText(f);return JSON.parse(f)}_CordovaFetchLocalFileAs(f,h){return this._runtime.PostComponentMessageToDOMAsync("runtime","cordova-fetch-local-file",{filename:f,as:h})}CordovaFetchLocalFileAsText(f){return this._CordovaFetchLocalFileAs(f,"text")}async CordovaFetchLocalFileAsBlob(f){const h=await this._CordovaFetchLocalFileAs(f,"buffer");f=d(f);return new Blob([h],{type:f})}async CordovaFetchLocalFileAsBlobURL(f){f=f.toLowerCase();var h=this._localBlobUrlCache.get(f);if(h)return h;h=await this.CordovaFetchLocalFileAsBlob(f);h=URL.createObjectURL(h);this._localBlobUrlCache.set(f,h);return h}CordovaFetchLocalFileAsArrayBuffer(f){return this._CordovaFetchLocalFileAs(f,"buffer")}GetMediaFileUrl(f){return this._HasLocalUrlBlob(f)?this.GetLocalUrlAsBlobUrl(f):this._mediaSubfolder+f.toLowerCase()}GetProjectFileUrl(f,h=""){if(e.IsAbsoluteURL(f)){if(h)throw Error("cannot specify subfolder with remote URL");return Promise.resolve(f)}return this._HasLocalUrlBlob(f)?Promise.resolve(this.GetLocalUrlAsBlobUrl(f)):this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsBlobURL(h+f):Promise.resolve(h+f.toLowerCase())}GetProjectFileIframeUrl(f){if(e.IsAbsoluteURL(f))return Promise.resolve(f);var h=f.indexOf("?"),g=-1===h?"":f.substr(h);h=-1===h?f:f.substr(0,h);return this._HasLocalUrlBlob(h)?(f=this._localBlobSWUrls.get(h)||this.GetLocalUrlAsBlobUrl(h),!f.startsWith("blob:")&&this._swClientId&&(f=new URL(f),g=new URLSearchParams(g),g.set("__c3_client_id",this._swClientId),f.search=g.toString(),f=f.toString()),Promise.resolve(f)):this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsBlobURL(h):Promise.resolve(f.toLowerCase())}LoadProjectFileUrl(f){return this.GetProjectFileUrl(f)}LoadImage(f){if(f.loadPolicy&&!a.has(f.loadPolicy))throw Error("invalid load policy");let h=this._assetsByUrl.get(f.url);if(h)return h;h=e.New(e.ImageAsset,this,{url:f.url,size:f.size||0,loadPolicy:f.loadPolicy||this._defaultLoadPolicy});this._allAssets.push(h);this._assetsByUrl.set(h.GetURL(),h);this._hasFinishedInitialLoad||(this._totalAssetSizeToLoad+=h.GetSize(),this._loadPromises.push(h.Load().then(()=>this._AddLoadedSize(h.GetSize()))));return h}async WaitForAllToLoad(){try{await Promise.all(this._loadPromises),this._lastLoadProgress=1}catch(f){console.error("Error loading: ",f),this._hasHadErrorLoading=!0,this._FireLoadingProgressEvent()}}SetInitialLoadFinished(){this._hasFinishedInitialLoad=!0}HasHadErrorLoading(){return this._hasHadErrorLoading}_AddLoadedSize(f){this._assetSizeLoaded+=f;this._loadingRateLimiter.Call()}_FireLoadingProgressEvent(){const f=e.New(e.Event,"loadingprogress");this._lastLoadProgress=e.clamp(this._assetSizeLoaded/this._totalAssetSizeToLoad,0,1);f.progress=this._lastLoadProgress;this._runtime.Dispatcher().dispatchEvent(f)}GetLoadProgress(){return this._lastLoadProgress}_SetWebFonts(f){e.shallowAssignArray(this._webFonts,f);this._webFonts.length&&this._loadPromises.push(this._LoadWebFonts())}_LoadWebFonts(){if("undefined"===typeof FontFace)return Promise.resolve();const f=[];for(const[h,g,l]of this._webFonts)this._totalAssetSizeToLoad+=l,f.push(this._LoadWebFont(h,g).then(()=>this._AddLoadedSize(l)));return Promise.all(f)}async _LoadWebFont(f,h){try{const g=await this.GetProjectFileUrl(h,this._fontsSubfolder),l=new FontFace(f,`url('${g}')`);this._runtime.IsInWorker()?self.fonts.add(l):document.fonts.add(l);await l.load()}catch(g){console.warn(`[C3 runtime] Failed to load web font '${f}': `,g)}}IsAudioFormatSupported(f){return!!this._supportedAudioFormats[f]}_SetAudioFiles(f,h){this._preloadSounds=!!h;for(const[g,l,m]of f)this._audioFiles.set(g,{fileName:g,formats:l.map(u=>({type:u[0],fileExtension:u[1],fullName:g+u[1],fileSize:u[2]})),isMusic:m})}GetPreferredAudioFile(f){f=this._audioFiles.get(f.toLowerCase());if(!f)return null;let h=null;for(const g of f.formats)if(h||"audio/webm; codecs=opus"!==g.type||(h=g),this.IsAudioFormatSupported(g.type))return g;return h}GetProjectAudioFileUrl(f){return(f=this.GetPreferredAudioFile(f))?{url:this.GetMediaFileUrl(f.fullName),type:f.type}:null}GetAudioToPreload(){if(this._preloadSounds){const f=[];for(const h of this._audioFiles.values()){if(h.isMusic)continue;const g=this.GetPreferredAudioFile(h.fileName);g&&f.push({originalUrl:h.fileName,url:this.GetMediaFileUrl(g.fullName),type:g.type,fileSize:g.fileSize})}return f}return[]}GetIAssetManager(){return this._iAssetManager}async LoadScripts(...f){const h=await Promise.all(f.map(g=>this.GetProjectFileUrl(g)));this._runtime.IsInWorker()?1===f.length?(f=f[0],await self.c3_import((e.IsRelativeURL(f)?"./":"")+f)):(f=f.map(g=>`import "${e.IsRelativeURL(g)?"./":""}${g}";`).join("\n"),f=URL.createObjectURL(new Blob([f],{type:"application/javascript"})),await self.c3_import(f)):await Promise.all(h.map(g=>c(g)))}async CompileWebAssembly(f){if(WebAssembly.compileStreaming)return f=await this.GetProjectFileUrl(f),await WebAssembly.compileStreaming(fetch(f));f=await e.FetchArrayBuffer(f);return await WebAssembly.compile(f)}async LoadStyleSheet(f){f=await this.GetProjectFileUrl(f);return await this._runtime.PostComponentMessageToDOMAsync("runtime","add-stylesheet",{url:f})}}}
  {"use strict";const e=self.C3;e.Asset=class extends e.DefendedBase{constructor(a,b){super();this._assetManager=a;this._runtime=a.GetRuntime();this._url=b.url;this._size=b.size;this._loadPolicy=b.loadPolicy;this._blob=null;this._isLoaded=!1;this._loadPromise=null}Release(){this._blob=this._runtime=this._assetManager=this._loadPromise=null}GetURL(){return this._url}GetSize(){return this._size}Load(){return"local"===this._loadPolicy||this._blob?(this._isLoaded=!0,Promise.resolve()):this._loadPromise?this._loadPromise:this._loadPromise=this._assetManager.FetchBlob(this._url,this._loadPolicy).then(a=>{this._isLoaded=!0;this._loadPromise=null;return this._blob=a}).catch(a=>console.error("Error loading resource: ",a))}IsLoaded(){return this._isLoaded}GetBlob(){return this._blob?Promise.resolve(this._blob):this._loadPromise?this._loadPromise:this._assetManager.FetchBlob(this._url,this._loadPolicy)}}}
  {"use strict";const e=self.C3,a=new e.PromiseThrottle,b=new Set;e.ImageAsset=class extends e.Asset{constructor(d,c){super(d,c);this._webglTexture=this._texturePromise=null;this._refCount=0;this._imageHeight=this._imageWidth=-1;b.add(this)}Release(){this.ReleaseTexture();if(0!==this._refCount)throw Error("released image asset which still has texture references");this._texturePromise=null;b.delete(this);super.Release()}static OnWebGLContextLost(){for(const d of b)d._texturePromise=null,d._webglTexture=null,d._refCount=0}LoadStaticTexture(d,c){c=c||{};this._refCount++;if(this._webglTexture)return Promise.resolve(this._webglTexture);if(this._texturePromise)return this._texturePromise;c.anisotropy=this._runtime.GetCanvasManager().GetTextureAnisotropy();return this._texturePromise=this.GetBlob().then(f=>a.Add(()=>d.CreateStaticTextureAsync(f,c).then(h=>{this._texturePromise=null;if(0===this._refCount)return d.DeleteTexture(h),null;this._webglTexture=h;this._imageWidth=h.GetWidth();this._imageHeight=h.GetHeight();return this._webglTexture}))).catch(f=>{console.error("Failed to load texture: ",f);throw f;})}ReleaseTexture(){if(0>=this._refCount)throw Error("texture released too many times");this._refCount--;0===this._refCount&&this._webglTexture&&(this._webglTexture.GetRenderer().DeleteTexture(this._webglTexture),this._webglTexture=null)}GetTexture(){return this._webglTexture}GetWidth(){return this._imageWidth}GetHeight(){return this._imageHeight}async LoadToDrawable(){const d=await this.GetBlob();return e.Supports.ImageBitmapOptions?await createImageBitmap(d,{premultiplyAlpha:"none"}):e.Supports.ImageBitmap?await createImageBitmap(d):await e.BlobToImage(d)}}}
  {"use strict";const e=self.C3;function a(b,d){return b.GetWorldInfo()._GetLastCachedZIndex()-d.GetWorldInfo()._GetLastCachedZIndex()}e.RenderCell=class extends e.DefendedBase{constructor(b,d,c){super();this._grid=b;this._x=d;this._y=c;this._instances=[];this._isSorted=!0;this._pendingRemoval=new Set;this._isAnyPendingRemoval=!1}Release(){e.clearArray(this._instances);this._pendingRemoval.clear();this._grid=null}Reset(){e.clearArray(this._instances);this._isSorted=!0;this._pendingRemoval.clear();this._isAnyPendingRemoval=!1}SetChanged(){this._isSorted=!1}IsEmpty(){if(!this._instances.length)return!0;if(this._instances.length>this._pendingRemoval.size)return!1;this._FlushPending();return!0}Insert(b){this._pendingRemoval.has(b)?(this._pendingRemoval.delete(b),0===this._pendingRemoval.size&&(this._isAnyPendingRemoval=!1)):(this._instances.push(b),this._isSorted=1===this._instances.length)}Remove(b){this._pendingRemoval.add(b);this._isAnyPendingRemoval=!0;50<=this._pendingRemoval.size&&this._FlushPending()}_FlushPending(){this._isAnyPendingRemoval&&(this._instances.length===this._pendingRemoval.size?this.Reset():(e.arrayRemoveAllInSet(this._instances,this._pendingRemoval),this._pendingRemoval.clear(),this._isAnyPendingRemoval=!1))}_EnsureSorted(){this._isSorted||(this._instances.sort(a),this._isSorted=!0)}Dump(b){this._FlushPending();this._EnsureSorted();this._instances.length&&b.push(this._instances)}}}
  {"use strict";const e=self.C3;e.RenderGrid=class extends e.DefendedBase{constructor(a,b){super();this._cellWidth=a;this._cellHeight=b;this._cells=e.New(e.PairMap)}Release(){this._cells.Release();this._cells=null}GetCell(a,b,d){let c=this._cells.Get(a,b);return c?c:d?(c=e.New(e.RenderCell,this,a,b),this._cells.Set(a,b,c),c):null}XToCell(a){return Math.floor(a/this._cellWidth)}YToCell(a){return Math.floor(a/this._cellHeight)}Update(a,b,d){if(b)for(let c=b.getLeft(),f=b.getRight();c<=f;++c)for(let h=b.getTop(),g=b.getBottom();h<=g;++h){if(d&&d.containsPoint(c,h))continue;const l=this.GetCell(c,h,!1);l&&(l.Remove(a),l.IsEmpty()&&this._cells.Delete(c,h))}if(d)for(let c=d.getLeft(),f=d.getRight();c<=f;++c)for(let h=d.getTop(),g=d.getBottom();h<=g;++h)b&&b.containsPoint(c,h)||this.GetCell(c,h,!0).Insert(a)}QueryRange(a,b){let d=this.XToCell(a.getLeft());const c=this.YToCell(a.getTop()),f=this.XToCell(a.getRight());for(a=this.YToCell(a.getBottom());d<=f;++d)for(let h=c;h<=a;++h){const g=this.GetCell(d,h,!1);g&&g.Dump(b)}}MarkRangeChanged(a){let b=a.getLeft();const d=a.getTop(),c=a.getRight();for(a=a.getBottom();b<=c;++b)for(let f=d;f<=a;++f){const h=this.GetCell(b,f,!1);h&&h.SetChanged()}}}}
  {"use strict";const e=self.C3,a=new e.Rect,b=new e.Quad,d=[],c=new e.Rect,f=new e.Rect,h=self.glMatrix,g=h.vec3,l=h.vec4,m=h.mat4,u=m.create(),x=g.create(),n=l.create(),q=g.create(),t=g.create(),r=g.create(),w=e.New(e.Vector2);function y(C,A){return C.GetWorldInfo()._GetLastCachedZIndex()-A.GetWorldInfo()._GetLastCachedZIndex()}function B(C,A){return C.GetWorldInfo().GetZElevation()-A.GetWorldInfo().GetZElevation()}const E=[],H=[],K=[];e.Layer=class extends e.DefendedBase{constructor(C,A,F){super();this._layout=C;this._runtime=C.GetRuntime();this._name=F[0];this._index=A;this._sid=F[2];this._isVisible=!!F[3];this._backgroundColor=e.New(e.Color);this._backgroundColor.setFromJSON(F[4].map(J=>J/255));this._isTransparent=!!F[5];this._parallaxX=F[6];this._parallaxY=F[7];this._color=e.New(e.Color,1,1,1,F[8]);this._premultipliedColor=e.New(e.Color);this._isForceOwnTexture=F[9];this._renderAs3d=F[17];this._useCameraDistanceDrawOrder=F[18];this._useRenderCells=F[10];this._scaleRate=F[11];this._blendMode=F[12];this._curRenderTarget=null;this._scale=1;this._zElevation=F[16];this._scrollY=this._scrollX=this._angle=0;this._hasOwnScrollPosition=!1;this._viewport=e.New(e.Rect);this._viewportZ0=e.New(e.Rect);this._viewport3D=e.New(e.Rect);this._projectionMatrix=m.create();this._isProjectionMatrixChanged=!0;this._modelViewMatrix=m.create();this._isMVMatrixChanged=!0;this._viewFrustum=e.New(e.Gfx.ViewFrustum);this._isViewFrustumChanged=!0;this._startupInitialInstances=[];this._initialInstances=[];this._createdGlobalUids=[];this._initialUIDsToInstanceData=new Map;this._instances=[];this._anyInstanceZElevated=this._zIndicesUpToDate=!1;this._effectList=e.New(e.EffectList,this,F[15]);this._renderGrid=null;this._lastRenderList=[];this._isRenderListUpToDate=!1;this._lastRenderCells=e.New(e.Rect,0,0,-1,-1);this._curRenderCells=e.New(e.Rect,0,0,-1,-1);this._iLayer=new self.ILayer(this);this._UpdatePremultipliedColor();this.UsesRenderCells()&&(this._renderGrid=e.New(e.RenderGrid,this._runtime.GetOriginalViewportWidth(),this._runtime.GetOriginalViewportHeight()));for(const J of F[14])C=this._runtime.GetObjectClassByIndex(J[1]),this._layout._AddInitialObjectClass(C),C.GetDefaultInstanceData()||(C.SetDefaultInstanceData(J),C._SetDefaultLayerIndex(this._index)),this._initialInstances.push(J),this._initialUIDsToInstanceData.set(J[2],J);e.shallowAssignArray(this._startupInitialInstances,this._initialInstances)}static Create(C,A,F){return e.New(e.Layer,C,A,F)}Release(){this._runtime=this._layout=null}GetInitialInstanceData(C){return this._initialUIDsToInstanceData.get(C)}CreateInitialInstances(C){const A=this._layout.IsFirstVisit();let F=0;const J=this._initialInstances;for(let R=0,T=J.length;R<T;++R){var L=J[R];const V=this._runtime.GetObjectClassByIndex(L[1]);let ba=!0;if(!V.HasPersistBehavior()||A)L=this._runtime.CreateInstanceFromData(L,this,!0),C.push(L),V.IsGlobal()&&(ba=!1,this._createdGlobalUids.push(L.GetUID()));ba&&(J[F]=J[R],++F)}e.truncateArray(J,F);this._runtime.FlushPendingInstances();this.SetZIndicesChanged()}_AddInstance(C,A){const F=C.GetWorldInfo();if(F.GetLayer()!==this)throw Error("instance added to wrong layer");this._instances.push(C);0!==F.GetZElevation()&&(this._anyInstanceZElevated=!0);A&&this.UsesRenderCells()&&C.GetWorldInfo().SetBboxChanged();this.SetZIndicesChanged()}_MaybeAddInstance(C){this._instances.includes(C)||(this._instances.push(C),0!==C.GetWorldInfo().GetZElevation()&&(this._anyInstanceZElevated=!0),this.SetZIndicesChanged())}_PrependInstance(C,A){const F=C.GetWorldInfo();if(F.GetLayer()!==this)throw Error("instance added to wrong layer");this._instances.unshift(C);0!==F.GetZElevation()&&(this._anyInstanceZElevated=!0);this.SetZIndicesChanged();A&&this.UsesRenderCells()&&C.GetWorldInfo().SetBboxChanged()}_RemoveInstance(C,A){const F=this._instances.indexOf(C);0>F||(A&&this.UsesRenderCells()&&C.GetWorldInfo()._RemoveFromRenderCells(),this._instances.splice(F,1),this.SetZIndicesChanged(),this._MaybeResetAnyInstanceZElevatedFlag())}_SetAnyInstanceZElevated(){this._anyInstanceZElevated=!0}_MaybeResetAnyInstanceZElevatedFlag(){0===this._instances.length&&(this._anyInstanceZElevated=!1)}_SortInstancesByLastCachedZIndex(C){if(C){C=new Set;for(var A of this._instances){var F=A.GetWorldInfo()._GetLastCachedZIndex();0<=F&&C.add(F)}A=-1;for(const J of this._instances)if(F=J.GetWorldInfo(),!(0<=F._GetLastCachedZIndex())){for(++A;C.has(A);)++A;F._SetZIndex(A)}}this._instances.sort(y)}_Start(){}_End(){for(const C of this._instances)C.GetObjectClass().IsGlobal()||this._runtime.DestroyInstance(C);this._runtime.FlushPendingInstances();e.clearArray(this._instances);this._anyInstanceZElevated=!1;this.SetZIndicesChanged()}RecreateInitialObjects(C,A,F,J,L){const R=this._runtime.GetEventSheetManager(),T=this._runtime.GetAllObjectClasses(),V=C.IsFamily(),ba=[];for(const qa of this._initialInstances){var ia=qa[0];if(A.containsPoint(ia[0],ia[1])){ia=T[qa[1]];if(ia!==C)if(V){if(!C.FamilyHasMember(ia))continue}else continue;ia=this;var ja=this._runtime.GetCurrentLayout();this.GetLayout()!==ja&&((ia=ja.GetLayerByName(this.GetName()))||(ia=ja.GetLayerByIndex(this.GetIndex())));ja=this._runtime.CreateInstanceFromData(qa,ia,!1,void 0,void 0,!1,L);ia.SortAndAddInstancesByZIndex(ja);ia=ja.GetWorldInfo();ia.OffsetXY(F,J);ia.SetBboxChanged();R.BlockFlushingInstances(!0);ja._TriggerOnCreatedOnSelfAndRelated();R.BlockFlushingInstances(!1);ba.push(ja)}}return ba}GetInstanceCount(){return this._instances.length}GetLayout(){return this._layout}GetName(){return this._name}GetIndex(){return this._index}GetSID(){return this._sid}GetRuntime(){return this._runtime}GetDevicePixelRatio(){return this._runtime.GetDevicePixelRatio()}GetEffectList(){return this._effectList}UsesRenderCells(){return this._useRenderCells&&!this._useCameraDistanceDrawOrder}GetRenderGrid(){return this._renderGrid}SetRenderListStale(){this._isRenderListUpToDate=!1}IsVisible(){return this._isVisible}SetVisible(C){C=!!C;this._isVisible!==C&&(this._isVisible=C,this._runtime.UpdateRender())}SetOwnScrollPositionEnabled(C){C=!!C;if(this._hasOwnScrollPosition!==C){if(this._hasOwnScrollPosition=C)C=this.GetLayout(),this._scrollX=C.GetScrollX(),this._scrollY=C.GetScrollY();this._SetMVMatrixChanged();this._runtime.UpdateRender()}}IsOwnScrollPositionEnabled(){return this._hasOwnScrollPosition}SetScrollX(C){var A=this.GetLayout();const F=A.GetScrollLeftBound();A=A.GetScrollRightBound();C>A&&(C=A);C<F&&(C=F);this._scrollX!==C&&(this._scrollX=C,this.IsOwnScrollPositionEnabled()&&(this._SetMVMatrixChanged(),this._runtime.UpdateRender()))}SetScrollY(C){var A=this.GetLayout();const F=A.GetScrollTopBound();A=A.GetScrollBottomBound();C>A&&(C=A);C<F&&(C=F);this._scrollY!==C&&(this._scrollY=C,this.IsOwnScrollPositionEnabled()&&(this._SetMVMatrixChanged(),this._runtime.UpdateRender()))}GetScrollX(){return this.IsOwnScrollPositionEnabled()?this._scrollX:this.GetLayout().GetScrollX()}GetScrollY(){return this.IsOwnScrollPositionEnabled()?this._scrollY:this.GetLayout().GetScrollY()}GetViewport(){return this._viewport}GetViewport3D(){return this._viewport3D}_GetVanishingPoint(){const C=this.GetLayout();return[C.GetVanishingPointX(),C.GetVanishingPointY()]}GetViewportForZ(C,A){var F=this._viewportZ0;if(0===C)A.copy(F);else{let T=F.midX(),V=F.midY();var J=this.Get2DScaleFactorToZ(C);const ba=F.width()/J;F=F.height()/J;const[ia,ja]=this._GetVanishingPoint();if(.5!==ia||.5!==ja){const qa=this.GetCameraZ();var L=this._runtime,R=100/qa;J=(ia-.5)*L.GetViewportWidth()/R;L=(ja-.5)*L.GetViewportHeight()/R;R=this.GetAngle();0!==R&&(w.set(J,L),w.rotate(R),J=w.getX(),L=w.getY());C=e.unlerp(qa,0,C);T+=e.lerp(J,0,C);V+=e.lerp(L,0,C)}A.set(T-ba/2,V-F/2,T+ba/2,V+F/2)}}GetOpacity(){return this._color.getA()}SetOpacity(C){C=e.clamp(C,0,1);this._color.getA()!==C&&(this._color.setA(C),this._UpdatePremultipliedColor(),this._runtime.UpdateRender())}_UpdatePremultipliedColor(){this._premultipliedColor.copy(this._color);this._premultipliedColor.premultiply()}GetPremultipliedColor(){return this._premultipliedColor}HasDefaultColor(){return this._color.equalsRgba(1,1,1,1)}GetScaleRate(){return this._scaleRate}SetScaleRate(C){this._scaleRate!==C&&(this._scaleRate=C,this._SetMVMatrixChanged(),this._runtime.UpdateRender())}GetParallaxX(){return this._parallaxX}GetParallaxY(){return this._parallaxY}SetParallax(C,A){if(this._parallaxX!==C||this._parallaxY!==A)if(this._parallaxX=C,this._parallaxY=A,this._SetMVMatrixChanged(),this._runtime.UpdateRender(),1!==this._parallaxX||1!==this._parallaxY)for(const F of this._instances)F.GetObjectClass()._SetAnyInstanceParallaxed(!0)}SetParallaxX(C){this.SetParallax(C,this.GetParallaxY())}SetParallaxY(C){this.SetParallax(this.GetParallaxX(),C)}SetZElevation(C){this._zElevation!==C&&(this._zElevation=C,this._runtime.UpdateRender())}GetZElevation(){return this._zElevation}SetAngle(C){C=e.clampAngle(C);this._angle!==C&&(this._angle=C,this._SetMVMatrixChanged(),this._runtime.UpdateRender())}GetAngle(){return e.clampAngle(this._layout.GetAngle()+
  this._angle)}GetOwnAngle(){return this._angle}HasInstances(){return 0<this._instances.length}_GetInstances(){return this._instances}_GetInstancesInDrawOrder(){return this.RendersIn3DMode()&&this._useCameraDistanceDrawOrder?(e.shallowAssignArray(K,this._GetInstances()),K.sort((C,A)=>this._SortInstancesByCameraDistance(C,A)),K):this._GetInstances()}_SortInstancesByCameraDistance(C,A){var F=this.GetLayout().Get3DCameraPosition(),J=F[0],L=F[1];F=F[2];var R=C.GetWorldInfo();const T=A.GetWorldInfo();A=R.GetX()-J;C=R.GetY()-L;R=R.GetZElevation()-F;J=T.GetX()-J;L=T.GetY()-L;F=T.GetZElevation()-F;return J*J+L*L+F*F-(A*A+C*C+R*R)}GetBackgroundColor(){return this._backgroundColor}IsTransparent(){return this._isTransparent}SetTransparent(C){C=!!C;this._isTransparent!==C&&(this._isTransparent=C,this._runtime.UpdateRender())}IsForceOwnTexture(){return this._isForceOwnTexture}SetForceOwnTexture(C){C=!!C;this._isForceOwnTexture!==C&&(this._isForceOwnTexture=C,this._runtime.UpdateRender())}RendersIn2DMode(){return!this.GetRuntime().Uses3DFeatures()||!this._renderAs3d}RendersIn3DMode(){return!this.RendersIn2DMode()}Has3DCamera(){return this.RendersIn3DMode()&&this.GetLayout().Is3DCameraEnabled()}SetBlendMode(C){this._blendMode!==C&&(this._blendMode=C,this._runtime.UpdateRender())}GetBlendMode(){return this._blendMode}IsTransformCompatibleWith(C){return this===C||this._parallaxX===C._parallaxX&&this._parallaxY===C._parallaxY&&this._scale===C._scale&&this._scaleRate===C._scaleRate&&this._angle===C._angle&&this.GetScrollX()===C.GetScrollX()&&this.GetScrollY()===C.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(C){this.SetParallax(C.parallaxX,C.parallaxY);this.SetOwnScale(C.scale);this.SetScaleRate(C.scaleRate);this.SetAngle(C.angle);this.SetOwnScrollPositionEnabled(C.hasOwnScroll);this.SetScrollX(C.scrollX);this.SetScrollY(C.scrollY)}_RemoveAllInstancesInSet(C){0!==C.size&&0<e.arrayRemoveAllInSet(this._instances,C)&&(this._MaybeResetAnyInstanceZElevatedFlag(),this.SetZIndicesChanged())}SetZIndicesChanged(){this._isRenderListUpToDate=this._zIndicesUpToDate=!1}_UpdateZIndices(){if(!this._zIndicesUpToDate){this._instances.sort(B);if(this.UsesRenderCells())for(let C=0,A=this._instances.length;C<A;++C){const F=this._instances[C].GetWorldInfo();F._SetZIndex(C);this._renderGrid.MarkRangeChanged(F.GetRenderCellRange())}else for(let C=0,A=this._instances.length;C<A;++C)this._instances[C].GetWorldInfo()._SetZIndex(C);this._zIndicesUpToDate=!0}}MoveInstanceAdjacent(C,A,F){var J=C.GetWorldInfo();A=A.GetWorldInfo();if(J.GetLayer()!==this||A.GetLayer()!==this)throw Error("can't arrange Z order unless both objects on this layer");J=J.GetZIndex();A=A.GetZIndex();if(J===A+(F?1:-1))return!1;e.arrayRemove(this._instances,J);J<A&&A--;F&&A++;A===this._instances.length?this._instances.push(C):this._instances.splice(A,0,C);this.SetZIndicesChanged();return!0}_MergeSortedZArrays(C,A){const F=[];let J=0,L=0,R=C.length,T=A.length;for(;J<R&&L<T;){const V=C[J],ba=A[L];V.GetWorldInfo()._GetLastCachedZIndex()<ba.GetWorldInfo()._GetLastCachedZIndex()?(F.push(V),++J):(F.push(ba),++L)}for(;J<R;++J)F.push(C[J]);for(;L<T;++L)F.push(A[L]);return F}_MergeAllSortedZArrays_pass(C){const A=[],F=C.length;for(let J=0;J<F-1;J+=2)A.push(this._MergeSortedZArrays(C[J],C[J+1]));1===F%2&&A.push(C[F-1]);return A}_MergeAllSortedZArrays(C){for(;1<C.length;)C=this._MergeAllSortedZArrays_pass(C);return C[0]}_GetRenderCellInstancesToDraw(){this._UpdateZIndices();e.clearArray(d);this._renderGrid.QueryRange(this._viewport,d);return d.length?1===d.length?d[0]:this._MergeAllSortedZArrays(d):[]}_IsOpaque(){return!this.UsesOwnTexture()&&!this.IsTransparent()}ShouldDraw(){return this.IsVisible()&&0<this.GetOpacity()&&(this.HasInstances()||!this.IsTransparent())}UsesOwnTexture(){return this.IsForceOwnTexture()||!this.HasDefaultColor()||0!==this.GetBlendMode()||this._effectList.HasAnyActiveEffect()}GetRenderTarget(){return this._curRenderTarget}_CanFastPathDrawLayer(C){if(0===C.length)return!0;if(2<=C.length)return!1;C=C[0].GetShaderProgram();return!C.MustPreDraw()&&!C.UsesDest()&&!C.UsesCrossSampling()&&this.HasDefaultColor()}Get2DScaleFactorToZ(C){if(this._layout.IsOrthographicProjection())return 1;{const A=this.GetCameraZ();return A/(A-C)}}GetCameraZ(){return 100/this.GetNormalScale()}_SetMVMatrixChanged(){this._isViewFrustumChanged=this._isMVMatrixChanged=!0}_GetModelViewMatrix(C){this._isMVMatrixChanged&&(this._CalculateModelViewMatrix(C,this._modelViewMatrix,0,0,null),this._isMVMatrixChanged=!1);return this._modelViewMatrix}_CalculateModelViewMatrix(C,A,F,J,L){const R=this._runtime;var T=this.GetLayout();const V=R.GetRenderScale();var ba=R.GetParallaxXOrigin(),ia=R.GetParallaxYOrigin();let ja=(this.GetScrollX()-ba)*this._parallaxX+ba;var qa=(this.GetScrollY()-ia)*this._parallaxY+ia;this._runtime.IsPixelRoundingEnabled()&&(ja=Math.round(ja),qa=Math.round(qa));if(this.Has3DCamera())g.copy(q,T.Get3DCameraPosition()),g.copy(t,T.Get3DCameraLookAt()),g.copy(r,T.Get3DCameraUpVector()),T=t[0]-q[0],J=t[1]-q[1],qa=t[2]-q[2],q[0]=(q[0]-ba)*this._parallaxX+ba,q[1]=(q[1]-ia)*this._parallaxY+ia,q[2]*=Math.max(this._parallaxX,this._parallaxY),t[0]=q[0]+T,t[1]=q[1]+J,t[2]=q[2]+qa,g.set(x,V,V,1),g.multiply(q,q,x),g.multiply(t,t,x);else{ba=(ja+F)*V;ia=(qa+J)*V;T=T.IsOrthographicProjection()?100:this.GetCameraZ();J=this.GetAngle();const[za,Ca]=this._GetVanishingPoint();if(.5!==za||.5!==Ca)F=100/T,qa=(za-.5)*R.GetViewportWidth()*V/F,F=(Ca-.5)*R.GetViewportHeight()*V/F,0!==J&&(w.set(qa,F),w.rotate(J),qa=w.getX(),F=w.getY()),ba+=qa,ia+=F;g.set(q,ba,ia,T);g.set(t,ba,ia,T-100);0===J?g.set(r,0,1,0):g.set(r,Math.sin(J),Math.cos(J),0)}C.CalculateLookAtModelView(A,q,t,r,L||R.GetCanvasManager().GetDrawHeight());1!==V&&(g.set(x,V,V,1),m.scale(A,A,x))}_SetProjectionMatrixChanged(){this._isViewFrustumChanged=this._isProjectionMatrixChanged=!0}_GetProjectionMatrix(C){this._isProjectionMatrixChanged&&(this._CalculateProjectionMatrix(C),this._isProjectionMatrixChanged=!1);return this._projectionMatrix}_CalculateProjectionMatrix(C){var A=this._runtime.GetCanvasManager();const[F,J]=this._GetVanishingPoint();if(this._layout.IsOrthographicProjection())C.CalculateOrthographicMatrix(this._projectionMatrix,A.GetDrawWidth(),A.GetDrawHeight());else if(.5===F&&.5===J)m.copy(this._projectionMatrix,A.GetDefaultProjectionMatrix());else{const L=A.GetDrawWidth();A=A.GetDrawHeight();C.CalculatePerspectiveMatrix(this._projectionMatrix,L/A,F,J)}}_SetTransform(C,A=!0,F=0,J=0,L=0){A&&C.SetProjectionMatrix(this._GetProjectionMatrix(C));0===F&&0===J&&0===L?A=this._GetModelViewMatrix(C):(this._CalculateModelViewMatrix(C,u,F,J,L),A=u);C.SetModelViewMatrix(A)}PrepareForDraw(C){this._SetTransform(C);C.SetBaseZ(this.GetZElevation())}Draw(C,A,F){var J=this._runtime.GetCanvasManager();const L=this.UsesOwnTexture();var R=null;let T=null;if(this._runtime.IsGPUProfiling())if(C.IsWebGL()){const V=J.GetLayerTimingsBuffer(this);V&&(T=V.AddTimeElapsedQuery(),C.StartQuery(T))}else C.IsWebGPU()&&C.WriteTimestamp(2*(this.GetIndex()+1));L?(R={sampling:this._runtime.GetSampling()},"low"===J.GetCurrentFullscreenScalingQuality()&&(R.width=J.GetDrawWidth(),R.height=J.GetDrawHeight()),R=this._runtime.GetAdditionalRenderTarget(R),C.SetRenderTarget(R),this.IsTransparent()?C.ClearRgba(0,0,0,0):C.Clear(this._backgroundColor)):(C.SetRenderTarget(A),this.IsTransparent()||F||C.Clear(this._backgroundColor));this._curRenderTarget=R||A;this._SetTransform(C);C.SetBaseZ(this.GetZElevation());C.SetDepthEnabled(this.RendersIn3DMode());this.GetNormalScale()>Number.EPSILON&&(this._UpdateZIndices(),J=this.UsesRenderCells()&&0===this.GetZElevation()&&!this._anyInstanceZElevated,this.Has3DCamera()?this._DrawInstances_3DCamera(C):J?this._DrawInstances_RenderCells(C):this._DrawInstances(C,this._GetInstancesInDrawOrder()));C.SetBaseZ(0);C.SetCurrentZ(0);L&&(C.SetDepthEnabled(!1),this._DrawLayerOwnTextureToRenderTarget(C,R,A,F));T&&C.EndQuery(T);this._runtime.IsGPUProfiling()&&C.IsWebGPU()&&C.WriteTimestamp(2*(this.GetIndex()+1)+1);this._curRenderTarget=null}_DrawInstances(C,A){const F=this._viewport,J=this._curRenderTarget,L=this.GetLayout().IsOrthographicProjection(),R=this.GetLayout().HasVanishingPointOutsideViewport();let T=null;for(let V=0,ba=A.length;V<ba;++V){const ia=A[V];if(ia===T)continue;T=ia;const ja=ia.GetWorldInfo();ja.IsVisible()&&ja.IsInViewport(F,R,L)&&this._DrawInstanceMaybeWithEffects(ia,ja,C,J)}}_DrawInstances_3DCamera(C){const A=this._curRenderTarget,F=this._GetViewFrustum(),J=this._GetInstancesInDrawOrder();for(let V=0,ba=J.length;V<ba;){var L=J[V],R=L.GetWorldInfo();if(!R.IsVisible()||!R.IsInViewport3D(F)){++V;continue}(!L.RendersToOwnZPlane()||0<R.GetDepth())&&H.push(L);var T=L.GetWorldInfo().GetTotalZElevation();E.push(L);let ia=V+1;for(;ia<ba;++ia){const ja=J[ia],qa=ja.GetWorldInfo();if(qa.IsVisible()&&qa.IsInViewport3D(F)){if(qa.GetTotalZElevation()!==T)break;ja.RendersToOwnZPlane()?(0<qa.GetDepth()&&H.push(ja),E.push(ja)):H.push(ja)}}if(1!==E.length||E[0].MustMitigateZFighting()){this._DrawCoplanarInstances_3DCamera(C,E);for(let ja=0,qa=H.length;ja<qa;++ja)L=H[ja],R=L.GetWorldInfo(),R._SetDrawNonBackFacesOnly(!0),this._DrawInstanceMaybeWithEffects(L,R,C,A),R._SetDrawNonBackFacesOnly(!1)}else{this._DrawInstanceMaybeWithEffects(L,R,C,A);for(let ja=0,qa=H.length;ja<qa;++ja)R=H[ja],R!==L&&(T=R.GetWorldInfo(),T.GetLayer()._DrawInstanceMaybeWithEffects(R,T,C,A))}V=ia;e.clearArray(E);e.clearArray(H)}}_DrawCoplanarInstances_3DCamera(C,A){const F=this._curRenderTarget;C.CoplanarStartStencilPass();for(let R=0,T=A.length;R<T;++R){var J=A[R],L=J.GetWorldInfo();L._SetDrawBackFaceOnly(!0);this._DrawInstance(J,L,C)}C.CoplanarStartColorPass();for(let R=0,T=A.length;R<T;++R)J=A[R],L=J.GetWorldInfo(),this._DrawInstanceMaybeWithEffects(J,L,C,F),L._SetDrawBackFaceOnly(!1);C.CoplanarRestoreStandardRendering()}_DrawInstances_RenderCells(C){var A=this._renderGrid;const F=this._curRenderCells,J=this._lastRenderCells,L=this._viewport;F.set(A.XToCell(L.getLeft()),A.YToCell(L.getTop()),A.XToCell(L.getRight()),A.YToCell(L.getBottom()));this._isRenderListUpToDate&&F.equals(J)?A=this._lastRenderList:(A=this._GetRenderCellInstancesToDraw(),this._isRenderListUpToDate=!0,J.copy(F));this._DrawInstances(C,A);A!==this._lastRenderList&&e.shallowAssignArray(this._lastRenderList,A)}_DrawInstanceMaybeWithEffects(C,A,F,J){A.HasAnyActiveEffect()?this._DrawInstanceWithEffectsAndRestore(C,A,F,J):this._DrawInstance(C,A,F)}_DrawInstance(C,A,F){A=A.GetRendererStateGroup();F.GetCurrentStateGroup()!==A&&A.Apply();C.Draw(F)}_DrawInstanceWithEffectsAndRestore(C,A,F,J){this._DrawInstanceWithEffects(C,A,F,J,null)&&this._SetTransform(F)}_DrawInstanceWithEffects(C,A,F,J,L){const R=A.GetInstanceEffectList().GetActiveEffectTypes();if(1===R.length){const T=R[0],V=T.GetShaderProgram();if(!V.NeedsPostDrawOrExtendsBox()&&A.HasDefaultColor()&&!C.MustPreDraw())return this._DrawInstanceWithEffects_FastPath(C,A,T,V,F),!1}C=e.RenderEffectChain(F,this._runtime,C,J,R,L);F.SetBaseZ(this.GetZElevation());return C}_DrawInstanceWithEffects_FastPath(C,A,F,J,L){L.SetProgram(J);L.SetBlendMode(A.GetBlendMode());J.IsAnimated()&&this._runtime.UpdateRender();let R=0,T=0;if(J.UsesAnySrcRectOrPixelSize()){const[V,ba]=C.GetCurrentSurfaceSize();R=1/V;T=1/ba;(J=C.GetCurrentTexRect())?f.copy(J):f.set(0,0,0,0)}F=A.GetInstanceEffectList().GetEffectParametersForIndex(F.GetIndex());L.SetCurrentZ(A.GetZElevation());L.SetProgramParameters(null,c,f,f,A.GetBoundingBox(),R,T,this.GetOwnScale(),this.GetAngle(),this._runtime.GetGameTime(),F);C.Draw(L)}_DrawLayerOwnTextureToRenderTarget(C,A,F,J){const L=this._effectList.GetActiveEffectTypes(),R=this._runtime;if(this._CanFastPathDrawLayer(L)){C.SetRenderTarget(F);if(1===L.length){var T=L[0];F=T.GetShaderProgram();C.SetProgram(F);f.set(0,0,1,1);T=this._effectList.GetEffectParametersForIndex(T.GetIndex());C.SetProgramParameters(null,c,f,f,this._viewport,1/R.GetDrawWidth(),1/R.GetDrawHeight(),this.GetNormalScale(),this.GetAngle(),R.GetGameTime(),T);F.IsAnimated()&&R.UpdateRender()}else C.SetTextureFillMode();J&&0===this._blendMode&&this.HasDefaultColor()&&0===L.length?C.CopyRenderTarget(A):(C.SetBlendMode(this._blendMode),C.SetColor(this._premultipliedColor),C.DrawRenderTarget(A));C.InvalidateRenderTarget(A);R.ReleaseAdditionalRenderTarget(A)}else e.RenderEffectChain(C,R,this,F,L)}GetOwnScale(){return this._scale}SetOwnScale(C){this._scale!==C&&(this._scale=C,this._layout.BoundScrolling(),this._SetMVMatrixChanged(),this._runtime.UpdateRender())}GetRenderScale(){return this.GetNormalScale()*this._runtime.GetRenderScale()}GetDisplayScale(){return this.GetNormalScale()*this._runtime.GetDisplayScale()}GetNormalScale(){return(this._scale*this._layout.GetScale()-1)*this._scaleRate+1}UpdateViewport(){var C=this._runtime.GetParallaxXOrigin(),A=this._runtime.GetParallaxYOrigin(),F=(this.GetScrollX()-C)*this._parallaxX+C,J=(this.GetScrollY()-A)*this._parallaxY+A;C=this.GetNormalScale();A=this._runtime.GetViewportWidth()/C;C=this._runtime.GetViewportHeight()/C;F-=A/2;let L=J-C/2;this._runtime.IsPixelRoundingEnabled()&&(F=Math.round(F),L=Math.round(L));J=this._viewportZ0;J.set(F,L,F+A,L+C);A=this.GetAngle();0!==A&&(a.copy(J),a.offset(-J.midX(),-J.midY()),b.setFromRotatedRect(a,A),b.getBoundingBox(a),a.offset(J.midX(),J.midY()),J.copy(a));A=this._zElevation;this.GetViewportForZ(A,this._viewport);this.Has3DCamera()?this.CalculateViewport3D(A,this._viewport3D):this._viewport3D.copy(this._viewport)}CalculateViewport3D(C,A){var F=this._runtime.GetCanvasManager(),J=F.GetCssWidth();F=F.GetCssHeight();const[L,R]=this.CanvasCssToLayer(0,0,C),[T,V]=this.CanvasCssToLayer(J,0,C),[ba,ia]=this.CanvasCssToLayer(J,F,C),[ja,qa]=this.CanvasCssToLayer(0,F,C);C=Math.min(L,T,ba,ja);J=Math.min(R,V,ia,qa);F=Math.max(L,T,ba,ja);let za=Math.max(R,V,ia,qa);isFinite(C)||(C=-Infinity);isFinite(J)||(J=-Infinity);isFinite(F)||(F=Infinity);isFinite(za)||(za=Infinity);A.set(C,J,F,za)}CanvasCssToLayer(C,A,F=0){return this._CanvasToLayer(C,A,F,this.GetDisplayScale())}DrawSurfaceToLayer(C,A,F=0){return this._CanvasToLayer(C,A,F,this.GetRenderScale()*this.GetDevicePixelRatio())}_CanvasToLayer(C,A,F,J){var L=this._runtime,R=L.GetRenderer();const T=this.GetNormalScale(),V=L.GetViewportWidth()/T;L=L.GetViewportHeight()/T;l.set(n,0,0,V,L);C/=J;A=n[3]-A/J;J=this._GetProjectionMatrix(R);R=this._GetModelViewMatrix(R);return e.Gfx.UnprojectScreenToWorldZ(C,A,F,R,J,n,x)?[x[0],x[1]]:[NaN,NaN]}CanvasCssToLayer_DefaultTransform(C,A){const F=this._scale,J=this._scaleRate,L=this._parallaxX,R=this._parallaxY,T=this._angle;this._parallaxY=this._parallaxX=this._scaleRate=this._scale=1;this._angle=0;this._SetMVMatrixChanged();C=this.CanvasCssToLayer(C,A);this._scale=F;this._scaleRate=J;this._parallaxX=L;this._parallaxY=R;this._angle=T;this._SetMVMatrixChanged();return C}LayerToCanvasCss(C,A,F=0){return this._LayerToCanvas(C,A,F,this.GetDisplayScale())}LayerToDrawSurface(C,A,F=0){return this._LayerToCanvas(C,A,F,this.GetRenderScale()*this.GetDevicePixelRatio())}_LayerToCanvas(C,A,F,J){var L=this._runtime,R=L.GetRenderer();const T=this.GetNormalScale();var V=L.GetViewportWidth()/T;L=L.GetViewportHeight()/T;l.set(n,0,0,V,L);V=this._GetProjectionMatrix(R);R=this._GetModelViewMatrix(R);return e.Gfx.Project(C,A,F,R,V,n,x)?[x[0]*J,(n[3]-x[1])*J]:[NaN,NaN]}_GetLayerToDrawSurfaceScale(C,A){C*=this.GetRenderScale()*this.GetDevicePixelRatio();0!==A&&(C*=this.Get2DScaleFactorToZ(A));return C}_GetViewFrustum(){this._isViewFrustumChanged&&(this._UpdateViewFrustum(),this._isViewFrustumChanged=!1);return this._viewFrustum}_UpdateViewFrustum(){var C=this._runtime.GetRenderer();const A=this._GetProjectionMatrix(C);C=this._GetModelViewMatrix(C);this._viewFrustum.CalculatePlanes(C,A)}_SaveToJson(){return{s:this.GetOwnScale(),a:this.GetOwnAngle(),vl:this._viewport.getLeft(),vt:this._viewport.getTop(),vr:this._viewport.getRight(),vb:this._viewport.getBottom(),v:this.IsVisible(),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}}_LoadFromJson(C){this._scale=C.s;this._angle=C.a;this._viewport.set(C.vl,C.vt,C.vr,C.vb);this._isVisible=!!C.v;this._backgroundColor.setFromJSON(C.bc);this._isTransparent=!!C.t;C.hasOwnProperty("sx")&&(this._scrollX=C.sx);C.hasOwnProperty("sy")&&(this._scrollY=C.sy);C.hasOwnProperty("hosp")&&(this._hasOwnScrollPosition=!!C.hosp);this._parallaxX=C.px;this._parallaxY=C.py;this._color.setFromJSON(C.c);this._scaleRate=C.sr;e.shallowAssignArray(this._createdGlobalUids,C.cg);e.shallowAssignArray(this._initialInstances,this._startupInitialInstances);const A=new Set(this._createdGlobalUids);let F=0;for(let J=0,L=this._initialInstances.length;J<L;++J)A.has(this._initialInstances[J][2])||(this._initialInstances[F]=this._initialInstances[J],++F);e.truncateArray(this._initialInstances,F);this._effectList.LoadFromJson(C.fx);this._SortInstancesByLastCachedZIndex(!1);this.SetZIndicesChanged()}GetILayer(){return this._iLayer}SortAndAddInstancesByZIndex(C){C.GetWorldInfo();if(!this._instances.includes(C))if(C.HasChildren()){var A=[...C.allChildren()];A.push(C);A.sort((J,L)=>{J=J.GetWorldInfo().GetSceneGraphZIndex();L=L.GetWorldInfo().GetSceneGraphZIndex();return J-L});for(var F of A)if(F.IsInContainer())for(const J of F.siblings())A.includes(J)||(C=[...J.allChildren()],C.push(J),C.sort((L,R)=>{L=L.GetWorldInfo().GetSceneGraphZIndex();R=R.GetWorldInfo().GetSceneGraphZIndex();return L-R}),C&&C.length&&A.splice(A.length,0,...C));for(const J of A)this._AddInstance(J,!0)}else if(this._AddInstance(C,!0),C.IsInContainer())for(A of C.siblings())if(F=[...A.allChildren()],F.push(A),F.sort((J,L)=>{J=J.GetWorldInfo().GetSceneGraphZIndex();L=L.GetWorldInfo().GetSceneGraphZIndex();return J-L}),F&&F.length)for(const J of F)this._AddInstance(J,!0)}}}
  {"use strict";const e=self.C3,a=self.C3Debugger,b=e.New(e.Rect),d=e.New(e.Rect),c=e.New(e.Rect),f=e.New(e.Color),h=self.glMatrix.vec3,g=[],l=[],m=[],u=[],x=[];function n(r,w,y,B){return r[0]===Math.fround(w)&&r[1]===Math.fround(y)&&r[2]===Math.fround(B)}let q=null;function t(r,w){q!==r&&(r.PrepareForDraw(w),q=r)}e.Layout=class extends e.DefendedBase{constructor(r,w,y){super();this._layoutManager=r;this._runtime=r.GetRuntime();this._name=y[0];this._originalWidth=y[1];this._originalHeight=y[2];this._width=y[1];this._height=y[2];this._isUnboundedScrolling=!!y[3];this._isOrthographicProjection=!!y[4];this._vanishingPointX=y[5];this._vanishingPointY=y[6];this._eventSheetName=y[7];this._eventSheet=null;this._sid=y[8];this._index=w;this._scrollY=this._scrollX=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=!1;this._cam3dposition=h.create();this._cam3dlook=h.create();this._cam3dup=h.create();this._layers=[];this._layersByName=new Map;this._layersBySid=new Map;this._effectList=e.New(e.EffectList,this,y[11]);this._curRenderTarget=null;this._persistData={};this._isFirstVisit=!0;this._iLayout=new self.ILayout(this);this._userScriptDispatcher=e.New(e.Event.Dispatcher);for(const B of y[9])r=e.Layer.Create(this,this._layers.length,B),this._layers.push(r),this._layersByName.set(r.GetName().toLowerCase(),r),this._layersBySid.set(r.GetSID(),r);for(const B of y[10]){y=this._runtime.GetObjectClassByIndex(B[1]);if(!y)throw Error("missing nonworld object class");y.GetDefaultInstanceData()||y.SetDefaultInstanceData(B);this._initialNonWorld.push(B);this._AddInitialObjectClass(y)}}Release(){for(const r of this._layers)r.Release();e.clearArray(this._layers);this._textureLoadPendingPromises.clear();this._runtime=this._layoutManager=this._eventSheet=null}GetRuntime(){return this._runtime}GetName(){return this._name}GetSID(){return this._sid}GetIndex(){return this._index}GetEffectList(){return this._effectList}GetMinLayerScale(){let r=this._layers[0].GetNormalScale();for(let w=1,y=this._layers.length;w<y;++w){const B=this._layers[w];if(0!==B.GetParallaxX()||0!==B.GetParallaxY())r=Math.min(r,B.GetNormalScale())}return r}_GetScrollBoundMarginHorizontal(){return.5*this._runtime.GetViewportWidth()/this.GetMinLayerScale()}_GetScrollBoundMarginVertical(){return.5*this._runtime.GetViewportHeight()/this.GetMinLayerScale()}GetScrollLeftBound(){return this.IsUnboundedScrolling()?-Infinity:this._GetScrollBoundMarginHorizontal()}GetScrollRightBound(){return this.IsUnboundedScrolling()?Infinity:this.GetWidth()-this._GetScrollBoundMarginHorizontal()}GetScrollTopBound(){return this.IsUnboundedScrolling()?-Infinity:this._GetScrollBoundMarginVertical()}GetScrollBottomBound(){return this.IsUnboundedScrolling()?Infinity:this.GetHeight()-this._GetScrollBoundMarginVertical()}SetScrollX(r){const w=this.GetScrollLeftBound(),y=this.GetScrollRightBound();r>y&&(r=y);r<w&&(r=w);this._scrollX!==r&&(this._scrollX=r,this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}GetScrollX(){return this._scrollX}SetScrollY(r){const w=this.GetScrollTopBound(),y=this.GetScrollBottomBound();r>y&&(r=y);r<w&&(r=w);this._scrollY!==r&&(this._scrollY=r,this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}GetScrollY(){return this._scrollY}IsUnboundedScrolling(){return this._isUnboundedScrolling}BoundScrolling(){this.SetScrollX(this.GetScrollX());this.SetScrollY(this.GetScrollY());for(const r of this._layers)r.IsOwnScrollPositionEnabled()&&(r.SetScrollX(r.GetScrollX()),r.SetScrollY(r.GetScrollY()))}SetVanishingPointXY(r,w){if(this._vanishingPointX!==r||this._vanishingPointY!==w)this._vanishingPointX=r,this._vanishingPointY=w,this.IsPerspectiveProjection()&&(this._SetAllLayersProjectionChanged(),this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}GetVanishingPointX(){return this.IsOrthographicProjection()?.5:this._vanishingPointX}GetVanishingPointY(){return this.IsOrthographicProjection()?.5:this._vanishingPointY}HasVanishingPointOutsideViewport(){const r=this.GetVanishingPointX(),w=this.GetVanishingPointY();return 0>r||1<r||0>w||1<w}SetPerspectiveProjection(){this._isOrthographicProjection&&(this._isOrthographicProjection=!1,this._SetAllLayersProjectionChanged(),this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}SetOrthographicProjection(){this._isOrthographicProjection||(this._isOrthographicProjection=!0,this._SetAllLayersProjectionChanged(),this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}IsOrthographicProjection(){return this._isOrthographicProjection}IsPerspectiveProjection(){return!this.IsOrthographicProjection()}Set3DCameraEnabled(r){r=!!r;this._is3dCameraEnabled!==r&&(this._is3dCameraEnabled=r,this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}Is3DCameraEnabled(){return this._is3dCameraEnabled}Set3DCameraOrientation(r,w,y,B,E,H,K,C,A){n(this._cam3dposition,r,w,y)&&n(this._cam3dlook,B,E,H)&&n(this._cam3dup,K,C,A)||(h.set(this._cam3dposition,r,w,y),h.set(this._cam3dlook,B,E,H),h.set(this._cam3dup,K,C,A),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(r){this._scale!==r&&(this._scale=r,this._SetAllLayersMVChanged(),this.BoundScrolling(),this._runtime.UpdateRender())}SetAngle(r){r=e.clampAngle(r);this._angle!==r&&(this._angle=r,this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}GetAngle(){return this._angle}GetWidth(){return this._width}SetWidth(r){!isFinite(r)||1>r||(this._width=r)}GetHeight(){return this._height}SetHeight(r){!isFinite(r)||1>r||(this._height=r)}GetEventSheet(){return this._eventSheet}GetLayers(){return this._layers}GetLayerCount(){return this._layers.length}GetLayer(r){return"number"===typeof r?this.GetLayerByIndex(r):this.GetLayerByName(r.toString())}GetLayerByIndex(r){r=e.clamp(Math.floor(r),0,this._layers.length-1);return this._layers[r]}GetLayerByName(r){return this._layersByName.get(r.toLowerCase())||null}GetLayerBySID(r){return this._layersBySid.get(r)||null}_SetAllLayersProjectionChanged(){for(const r of this._layers)r._SetProjectionMatrixChanged()}_SetAllLayersMVChanged(){for(const r of this._layers)r._SetMVMatrixChanged()}SaveTransform(){return{scrollX:this.GetScrollX(),scrollY:this.GetScrollY(),scale:this.GetScale(),angle:this.GetAngle(),vpX:this.GetVanishingPointX(),vpY:this.GetVanishingPointY()}}RestoreTransform(r){this.SetScrollX(r.scrollX);this.SetScrollY(r.scrollY);this.SetScale(r.scale);this.SetAngle(r.angle);this.SetVanishingPointXY(r.vpX,r.vpY)}HasOpaqueBottomLayer(){for(const r of this._layers)if(r.ShouldDraw())return r._IsOpaque();return!1}GetLayoutBackgroundColor(){for(const r of this._layers)if(r.ShouldDraw()&&r._IsOpaque())return f.copyRgb(r.GetBackgroundColor()),f.setA(1),f;f.setRgba(0,0,0,0);return f}IsFirstVisit(){return this._isFirstVisit}_GetInitialObjectClasses(){return[...this._initialObjectClasses]}_AddInitialObjectClass(r){if(r.IsInContainer())for(const w of r.GetContainer().GetObjectTypes())this._initialObjectClasses.add(w);else this._initialObjectClasses.add(r)}_GetTextureLoadedObjectTypes(){return[...this._textureLoadedTypes]}_Load(r,w){if(r===this||!w)return Promise.resolve();r&&(e.CopySet(this._textureLoadedTypes,r._textureLoadedTypes),r._textureLoadedTypes.clear());r=[];for(const y of this._initialObjectClasses)this._textureLoadedTypes.has(y)||(r.push(y.LoadTextures(w)),this._textureLoadedTypes.add(y));return Promise.all(r)}async MaybeLoadTexturesFor(r){if(r.IsFamily())throw Error("cannot load textures for family");var w=this._runtime.GetRenderer();!w||w.IsContextLost()||this._textureLoadedTypes.has(r)||(this._textureLoadedTypes.add(r),w=r.LoadTextures(w),this._AddPendingTextureLoadPromise(w),await w,r.OnDynamicTextureLoadComplete(),this._runtime.UpdateRender())}_AddPendingTextureLoadPromise(r){this._textureLoadPendingPromises.add(r);r.then(()=>this._textureLoadPendingPromises.delete(r)).catch(()=>this._textureLoadPendingPromises.delete(r))}WaitForPendingTextureLoadsToComplete(){return Promise.all([...this._textureLoadPendingPromises])}MaybeUnloadTexturesFor(r){if(r.IsFamily()||0<r.GetInstanceCount())throw Error("cannot unload textures");const w=this._runtime.GetRenderer();w&&this._textureLoadedTypes.has(r)&&(this._textureLoadedTypes.delete(r),r.ReleaseTextures(w))}_Unload(r,w){if(r!==this&&w)for(const y of this._textureLoadedTypes)y.IsGlobal()||r._initialObjectClasses.has(y)||(y.ReleaseTextures(),this._textureLoadedTypes.delete(y))}_OnWebGLContextLost(){this._textureLoadedTypes.clear()}async _StartRunning(r){const w=this._runtime,y=this._layoutManager,B=w.GetEventSheetManager();this._eventSheetName&&(this._eventSheet=B.GetEventSheetByName(this._eventSheetName),this._eventSheet._UpdateDeepIncludes());y._SetMainRunningLayout(this);this._width=this._originalWidth;this._height=this._originalHeight;this._scrollX=w.GetOriginalViewportWidth()/2;this._scrollY=w.GetOriginalViewportHeight()/2;this.BoundScrolling();this._MoveGlobalObjectsToThisLayout(r);this._runtime.SetUsingCreatePromises(!0);this._CreateInitialInstances();this._isFirstVisit||this._CreatePersistedInstances();this._CreateAndLinkContainerInstances(this._createdInstances);this._CreateInitialNonWorldInstances();y.ClearPendingChangeLayout();w.FlushPendingInstances();this._runtime.SetUsingCreatePromises(!1);const E=this._runtime.GetCreatePromises();await Promise.all(E);e.clearArray(E);if(!w.IsLoadingState()){for(const H of this._createdInstances)H.SetupInitialSceneGraphConnections();for(const H of this._createdInstances)H._TriggerOnCreated()}e.clearArray(this._createdInstances);await Promise.all([...this._initialObjectClasses].map(H=>H.PreloadTexturesWithInstances(this._runtime.GetRenderer())));r&&(w.Dispatcher().dispatchEvent(new e.Event("beforefirstlayoutstart")),await w.DispatchUserScriptEventAsyncWait(new e.Event("beforeprojectstart")));await this.DispatchUserScriptEventAsyncWait(new e.Event("beforelayoutstart"));w.IsLoadingState()||await w.TriggerAsync(e.Plugins.System.Cnds.OnLayoutStart,null,null);await this.DispatchUserScriptEventAsyncWait(new e.Event("afterlayoutstart"));r&&(w.Dispatcher().dispatchEvent(new e.Event("afterfirstlayoutstart")),await w.DispatchUserScriptEventAsyncWait(new e.Event("afterprojectstart")));B._RunQueuedTriggers(y);await this.WaitForPendingTextureLoadsToComplete();this._SetAllLayersProjectionChanged();this._SetAllLayersMVChanged();this._isFirstVisit=!1}_MoveGlobalObjectsToThisLayout(r){for(const y of this._runtime.GetAllObjectClasses())if(!y.IsFamily()&&y.IsWorldType())for(const B of y.GetInstances()){const E=B.GetWorldInfo();var w=E.GetLayer();w=e.clamp(w.GetIndex(),0,this._layers.length-1);w=this._layers[w];E._SetLayer(w);w._MaybeAddInstance(B)}if(!r)for(const y of this._layers)y._SortInstancesByLastCachedZIndex(!1)}_CreateInitialInstances(){for(const r of this._layers)r.CreateInitialInstances(this._createdInstances),r.UpdateViewport(),r._Start()}_CreatePersistedInstances(){let r=!1;for(const[y,B]of Object.entries(this._persistData)){const E=this._runtime.GetObjectClassBySID(parseInt(y,10));if(E&&!E.IsFamily()&&E.HasPersistBehavior()){for(const H of B){var w=null;if(E.IsWorldType()&&(w=this.GetLayerBySID(H.w.l),!w))continue;w=this._runtime.CreateInstanceFromData(E,w,!1,0,0,!0);w.LoadFromJson(H);r=!0;this._createdInstances.push(w)}e.clearArray(B)}}for(const y of this._layers)y._SortInstancesByLastCachedZIndex(!0),y.SetZIndicesChanged();r&&(this._runtime.FlushPendingInstances(),this._runtime._RefreshUidMap())}_CreateAndLinkContainerInstances(r){for(const y of r){if(!y.IsInContainer())continue;const B=y.GetWorldInfo(),E=y.GetIID();for(const H of y.GetObjectClass().GetContainer().objectTypes())if(H!==y.GetObjectClass()){var w=H.GetInstances();w.length>E?y._AddSibling(w[E]):(w=B?this._runtime.CreateInstanceFromData(H,B.GetLayer(),!0,B.GetX(),B.GetY(),!0):this._runtime.CreateInstanceFromData(H,null,!0,0,0,!0),this._runtime.FlushPendingInstances(),H._UpdateIIDs(),y._AddSibling(w),r.push(w))}}}_CreateInitialNonWorldInstances(){for(const r of this._initialNonWorld)this._runtime.GetObjectClassByIndex(r[1]).IsInContainer()||this._runtime.CreateInstanceFromData(r,null,!0)}_CreateGlobalNonWorlds(){const r=[],w=this._initialNonWorld;let y=0;for(let B=0,E=w.length;B<E;++B){const H=w[B],K=this._runtime.GetObjectClassByIndex(H[1]);K.IsGlobal()?K.IsInContainer()&&K.GetContainer().HasAnyWorldType()||r.push(this._runtime.CreateInstanceFromData(H,null,!0)):(w[y]=H,++y)}e.truncateArray(w,y);this._runtime.FlushPendingInstances();this._CreateAndLinkContainerInstances(r)}RecreateInitialObjects(r,w,y,B,E,H){if(y)return y.RecreateInitialObjects(r,w,B,E,H);y=[];for(const K of this._layers)y.push(K.RecreateInitialObjects(r,w,B,E,H));return y.flat()}async _StopRunning(){const r=this._layoutManager;this._runtime.IsLoadingState()||await this._runtime.TriggerAsync(e.Plugins.System.Cnds.OnLayoutEnd,null,null);r.SetIsEndingLayout(!0);this._runtime.GetEventSheetManager().ClearAllScheduledWaits();this._isFirstVisit||this._SavePersistData();for(const w of this._layers)w._End();for(const w of this._runtime.GetAllObjectClasses())if(!(w.IsGlobal()||w.IsWorldType()||w.GetPlugin().IsSingleGlobal()||w.IsFamily())){for(const y of w.GetInstances())this._runtime.DestroyInstance(y);this._runtime.FlushPendingInstances()}r.SetIsEndingLayout(!1);r.GetMainRunningLayout()===this&&r._SetMainRunningLayout(null)}_SaveInstanceToPersist(r){const w=r.GetObjectClass().GetSID().toString();this._persistData.hasOwnProperty(w)||(this._persistData[w]=[]);this._persistData[w].push(r.SaveToJson())}_SavePersistData(){for(const r of this._layers){r._UpdateZIndices();for(const w of r._GetInstances()){const y=w.GetObjectClass();!y.IsGlobal()&&y.HasPersistBehavior()&&this._SaveInstanceToPersist(w)}}}ResetPersistData(){this._persistData={};this._isFirstVisit=!0}GetRenderTarget(){return this._curRenderTarget}UsesOwnTexture(){return"low"===this._runtime.GetCanvasManager().GetCurrentFullscreenScalingQuality()||this._runtime.UsesAnyBackgroundBlending()||"low-latency"===this._runtime.GetCompositingMode()||this._effectList.HasAnyActiveEffect()||this._runtime.GetRenderer().IsWebGL()&&this._runtime.Uses3DFeatures()}_CanFastPathDrawLayout(r){return 0===r.length?!0:2<=r.length?!1:!r[0].GetShaderProgram().MustPreDraw()}Draw(r){var w=this._runtime.GetCanvasManager();const y=this.UsesOwnTexture();var B=null;y?("low-latency"!==this._runtime.GetCompositingMode()&&(r.SetRenderTarget(null),r.ClearRgba(0,0,0,0)),B={sampling:this._runtime.GetSampling(),isSampled:r.IsWebGPU()||this._runtime.UsesAnyBackgroundBlending()||this._effectList.HasAnyActiveEffect()},"low"===w.GetCurrentFullscreenScalingQuality()&&(B.width=w.GetDrawWidth(),B.height=w.GetDrawHeight()),B=this._runtime.GetAdditionalRenderTarget(B),r.SetRenderTarget(B)):r.SetRenderTarget(null);r.Clear(this.GetLayoutBackgroundColor());this._runtime.Uses3DFeatures()&&r.ClearDepth();this._curRenderTarget=B;for(var E of this._layers)E.UpdateViewport(),E.ShouldDraw()&&g.push(E);for(let H=0,K=g.length;H<K;){w=g[H];if(w.Has3DCamera()&&!w.UsesOwnTexture()){l.push(w);for(E=H+1;E<K;++E){const C=g[E];if(C.Has3DCamera()&&!C.UsesOwnTexture())l.push(g[E]);else break}if(2<=l.length){this._Draw3DLayers(r,B,l);H+=l.length;e.clearArray(l);continue}e.clearArray(l)}w.Draw(r,B,0===H);++H}e.clearArray(g);y&&(r.SetDepthEnabled(!1),this._DrawLayoutOwnTextureToRenderTarget(r,B));this._curRenderTarget=null}_DrawLayoutOwnTextureToRenderTarget(r,w){const y=this._effectList.GetActiveEffectTypes(),B=this._runtime;if(this._CanFastPathDrawLayout(y)){r.SetRenderTarget(null);if(1===y.length){var E=y[0];const H=E.GetShaderProgram();r.SetProgram(H);d.set(0,0,1,1);c.set(0,0,B.GetViewportWidth(),B.GetViewportHeight());E=this._effectList.GetEffectParametersForIndex(E.GetIndex());r.SetProgramParameters(null,b,d,d,c,1/B.GetDrawWidth(),1/B.GetDrawHeight(),this.GetScale(),this.GetAngle(),B.GetGameTime(),E);H.IsAnimated()&&B.UpdateRender()}else r.SetTextureFillMode();0===y.length?r.CopyRenderTarget(w):(r.SetAlphaBlend(),r.ResetColor(),r.DrawRenderTarget(w));r.InvalidateRenderTarget(w);B.ReleaseAdditionalRenderTarget(w)}else e.RenderEffectChain(r,B,this,null,y)}_Draw3DLayers(r,w,y){var B=this._runtime.GetCanvasManager();r.SetDepthEnabled(!0);for(var E of y)E._UpdateZIndices(),e.appendArray(m,E._GetInstancesInDrawOrder());y=y[0];E=null;if(this._runtime.IsGPUProfiling())if(r.IsWebGL()){if(B=B.GetLayerTimingsBuffer(y))E=B.AddTimeElapsedQuery(),r.StartQuery(E)}else r.IsWebGPU()&&r.WriteTimestamp(2*(y.GetIndex()+1));for(let F=0,J=m.length;F<J;){var H=m[F],K=H.GetWorldInfo(),C=K.GetLayer();if(K.IsVisible()&&K.IsInViewport3D(C._GetViewFrustum())){(!H.RendersToOwnZPlane()||0<K.GetDepth())&&x.push(H);var A=H.GetWorldInfo().GetTotalZElevation();u.push(H);for(B=F+1;B<J;++B){const L=m[B],R=L.GetWorldInfo();if(R.IsVisible()&&R.IsInViewport3D(R.GetLayer()._GetViewFrustum())){if(R.GetTotalZElevation()!==A)break;L.RendersToOwnZPlane()?(0<R.GetDepth()&&x.push(L),u.push(L)):x.push(L)}}if(1!==u.length||u[0].MustMitigateZFighting()){this._Draw3DLayersCoplanarInstances(r,w,u);for(let L=0,R=x.length;L<R;++L)H=x[L],K=H.GetWorldInfo(),C=K.GetLayer(),K._SetDrawNonBackFacesOnly(!0),t(C,r),C._DrawInstanceMaybeWithEffects(H,K,r,w),K._SetDrawNonBackFacesOnly(!1)}else{t(C,r);C._DrawInstanceMaybeWithEffects(H,K,r,w);for(let L=0,R=x.length;L<R;++L)K=x[L],K!==H&&(C=K.GetWorldInfo(),A=C.GetLayer(),t(A,r),A._DrawInstanceMaybeWithEffects(K,C,r,w))}F=B;e.clearArray(u);e.clearArray(x)}else++F}E&&r.EndQuery(E);this._runtime.IsGPUProfiling()&&r.IsWebGPU()&&r.WriteTimestamp(2*(y.GetIndex()+1)+1);e.clearArray(m);q=null}_Draw3DLayersCoplanarInstances(r,w,y){r.CoplanarStartStencilPass();for(let K=0,C=y.length;K<C;++K){var B=y[K],E=B.GetWorldInfo(),H=E.GetLayer();E._SetDrawBackFaceOnly(!0);t(H,r);H._DrawInstance(B,E,r)}r.CoplanarStartColorPass();for(let K=0,C=y.length;K<C;++K)B=y[K],E=B.GetWorldInfo(),H=E.GetLayer(),t(H,r),H._DrawInstanceMaybeWithEffects(B,E,r,w),E._SetDrawBackFaceOnly(!1);r.CoplanarRestoreStandardRendering()}_SaveToJson(){const r={sx:this.GetScrollX(),sy:this.GetScrollY(),s:this.GetScale(),a:this.GetAngle(),w:this.GetWidth(),h:this.GetHeight(),ortho:this.IsOrthographicProjection(),vpX:this.GetVanishingPointX(),vpY:this.GetVanishingPointY(),fv:this._isFirstVisit,persist:this._persistData,fx:this._effectList.SaveToJson(),layers:{}};for(const w of this._layers)r.layers[w.GetSID().toString()]=w._SaveToJson();return r}_LoadFromJson(r){this._scrollX=r.sx;this._scrollY=r.sy;this._scale=r.s;this._angle=r.a;this._width=r.w;this._height=r.h;this._isOrthographicProjection=!!r.ortho;r.hasOwnProperty("vpX")&&(this._vanishingPointX=r.vpX);r.hasOwnProperty("vpY")&&(this._vanishingPointY=r.vpY);this._isFirstVisit=!!r.fv;this._persistData=r.persist;this._effectList.LoadFromJson(r.fx);for(const[w,y]of Object.entries(r.layers))r=parseInt(w,10),(r=this.GetLayerBySID(r))&&r._LoadFromJson(y);this._SetAllLayersProjectionChanged();this._SetAllLayersMVChanged()}GetILayout(){return this._iLayout}UserScriptDispatcher(){return this._userScriptDispatcher}DispatchUserScriptEvent(r){r.layout=this.GetILayout();var w=this._runtime;(w=w.IsDebug()&&!w.GetEventSheetManager().IsInEventEngine())&&a.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(r);w&&a.AddScriptTime()}DispatchUserScriptEventAsyncWait(r){r.layout=this.GetILayout();return this._userScriptDispatcher.dispatchEventAndWaitAsync(r)}}}
  {"use strict";const e=self.C3;e.LayoutManager=class extends e.DefendedBase{constructor(a){super();this._runtime=a;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._pendingChangeLayout=this._firstLayout=this._mainRunningLayout=this._runtime=null;e.clearArray(this._allLayouts);this._layoutsByName.clear();this._layoutsBySid.clear();e.clearArray(this._runningSubLayouts)}Create(a){a=e.New(e.Layout,this,this._allLayouts.length,a);this._allLayouts.push(a);this._layoutsByName.set(a.GetName().toLowerCase(),a);this._layoutsBySid.set(a.GetSID(),a)}GetRuntime(){return this._runtime}SetFirstLayout(a){this._firstLayout=a}GetFirstLayout(){if(this._firstLayout)return this._firstLayout;if(this._allLayouts.length)return this._allLayouts[0];throw Error("no first layout");}GetLayoutByName(a){return this._layoutsByName.get(a.toLowerCase())||null}GetLayoutBySID(a){return this._layoutsBySid.get(a)||null}GetLayoutByIndex(a){a=e.clamp(Math.floor(a),0,this._allLayouts.length-1);return this._allLayouts[a]}GetLayout(a){return"number"===typeof a?this.GetLayoutByIndex(a):this.GetLayoutByName(a.toString())}GetAllLayouts(){return this._allLayouts}_SetMainRunningLayout(a){this._mainRunningLayout=a}GetMainRunningLayout(){return this._mainRunningLayout}_AddRunningSubLayout(a){if(this._runningSubLayouts.includes(a))throw Error("layout already running");this._runningSubLayouts.push(a)}_RemoveRunningSubLayout(a){a=this._runningSubLayouts.indexOf(a);if(-1===a)throw Error("layout not running");this._runningSubLayouts.splice(a,1)}*runningLayouts(){this._mainRunningLayout&&(yield this._mainRunningLayout);this._runningSubLayouts.length&&(yield*this._runningSubLayouts)}IsLayoutRunning(a){return this._mainRunningLayout===a||this._runningSubLayouts.includes(a)}SetIsEndingLayout(a){if(a)this._isEndingLayout++;else{if(0>=this._isEndingLayout)throw Error("already unset");this._isEndingLayout--}}IsEndingLayout(){return 0<this._isEndingLayout}ChangeMainLayout(a){this._pendingChangeLayout=a}ClearPendingChangeLayout(){this._pendingChangeLayout=null}IsPendingChangeMainLayout(){return!!this._pendingChangeLayout}GetPendingChangeMainLayout(){return this._pendingChangeLayout}SetAllLayerProjectionChanged(){const a=this.GetMainRunningLayout();a&&a._SetAllLayersProjectionChanged()}SetAllLayerMVChanged(){const a=this.GetMainRunningLayout();a&&a._SetAllLayersMVChanged()}}}
  {"use strict";const e=self.C3;class a{constructor(){this.runtime=this.renderer=null;this.surfaceHeight=this.surfaceWidth=this.drawHeight=this.drawWidth=0;this.layoutRect=new e.Rect;this.rcTexBounce=new e.Rect;this.rcTexDest=new e.Rect;this.rcTexOrigin=new e.Rect;this.screenRect=new e.Rect;this.clearRect=new e.Rect;this.srcRect=new e.Rect;this.fxTex=[null,null];this.fxIndex=0;this.otherFxIndex=1;this.layerAngle=this.layerScale=this.boxExtendVertical=this.boxExtendHorizontal=0;this.renderTarget=this.wi=this.inst=this.layer=this.layout=null;this.didChangeTransform=this.postDraw=this.preDraw=!1;this.opts=null}Clear(){this.opts=this.renderTarget=this.wi=this.inst=this.layer=this.layout=this.runtime=this.renderer=null}ShouldPreDraw(t){t=t.GetShaderProgram();if(t.MustPreDraw())return!0;if(this.inst)return t.UsesDest()&&(0!==this.wi.GetAngle()||0>this.wi.GetWidth()||0>this.wi.GetHeight())||0!==this.boxExtendHorizontal||0!==this.boxExtendVertical||!this.wi.HasDefaultColor()||this.inst.MustPreDraw();if(this.layer)return!this.layer.HasDefaultColor()}ShouldPostDraw(t){t=t.GetShaderProgram();return t.UsesDest()||t.UsesCrossSampling()||this.layout&&"low"===this.runtime.GetCanvasManager().GetCurrentFullscreenScalingQuality()}GetEffectRenderTarget(t){if(0!==t&&1!==t)throw Error("invalid effect target");const r=this.fxTex;if(!r[t]){var w=this.runtime;const y=w.GetCanvasManager();w={sampling:w.GetSampling()};"low"===y.GetCurrentFullscreenScalingQuality()&&(w.width=y.GetDrawWidth(),w.height=y.GetDrawHeight());r[t]=y.GetAdditionalRenderTarget(w)}return r[t]}ReleaseEffectRenderTargets(){const t=this.fxTex,r=this.runtime.GetCanvasManager();t[0]&&(r.ReleaseAdditionalRenderTarget(t[0]),t[0]=null);t[1]&&(r.ReleaseAdditionalRenderTarget(t[1]),t[1]=null)}}const b=[];let d=0;function c(){d===b.length&&b.push(new a);return b[d++]}function f(t){t.ReleaseEffectRenderTargets();t.Clear();d--}const h=new e.Quad;let g=!1;async function l(t,r,w){r=await e.Gfx.WebGLRenderTarget.DebugReadPixelsToBlob(r,w);r=URL.createObjectURL(r);console.log("[FX] "+t+" "+(w?"":" [to display]")+": ",r)}e.RenderEffectChain=function(t,r,w,y,B,E){const H=c();H.renderer=t;H.runtime=r;if(w instanceof e.Instance)H.inst=w,H.wi=H.inst.GetWorldInfo();else if(w instanceof e.Layer)H.layer=w;else if(w instanceof e.Layout)H.layout=w;else throw Error("invalid effects object");w=r.GetCanvasManager();H.renderTarget=y;H.drawWidth=w.GetDrawWidth();H.drawHeight=w.GetDrawHeight();H.surfaceWidth=H.drawWidth;H.surfaceHeight=H.drawHeight;H.fxIndex=0;H.otherFxIndex=1;H.boxExtendHorizontal=0;H.boxExtendVertical=0;H.screenRect.set(0,0,H.drawWidth,H.drawHeight);H.clearRect.set(0,0,H.drawWidth,H.drawHeight);H.didChangeTransform=!1;H.opts=E;H.inst?(y=H.wi,H.layerScale=y.GetLayer().GetRenderScale(),H.layerAngle=y.GetLayer().GetAngle(),H.layoutRect.copy(y.GetBoundingBox())):H.layer?(y=H.layer,H.layerScale=y.GetRenderScale(),H.layerAngle=y.GetAngle(),H.layoutRect.copy(y.GetViewport())):(y=H.layout,H.layerScale=y.GetScale(),H.layerAngle=y.GetAngle(),H.layoutRect.set(0,0,H.drawWidth,H.drawHeight));H.inst?m(H,B):(H.rcTexBounce.set(0,0,H.drawWidth/H.surfaceWidth,H.drawHeight/H.surfaceHeight),H.rcTexDest.copy(H.rcTexBounce),H.rcTexOrigin.copy(H.rcTexBounce),H.rcTexBounce.swapTopBottom(),H.rcTexDest.swapTopBottom(),H.rcTexOrigin.swapTopBottom());t.SetAlphaBlend();t.ResetColor();t.SetBaseZ(0);t.SetCurrentZ(0);H.preDraw=H.ShouldPreDraw(B[0]);H.preDraw&&u(H);t.ResetColor();y=B.length-1;H.postDraw=H.ShouldPostDraw(B[y]);for(let K=0,C=B.length;K<C;++K)E=B[K],w=E.GetShaderProgram(),t.SetProgram(w),w.IsAnimated()&&r.UpdateRender(),0!==K||H.preDraw?(t.SetCopyBlend(),n(H,E,K===y&&!H.postDraw,K)):x(H,E),0===H.fxIndex?(H.fxIndex=1,H.otherFxIndex=0):(H.fxIndex=0,H.otherFxIndex=1);H.postDraw&&q(H,B);t=H.didChangeTransform;f(H);g=!1;return t};function m(t,r){for(let F=0,J=r.length;F<J;++F){var w=r[F].GetShaderProgram();t.boxExtendHorizontal+=w.GetBoxExtendHorizontal();t.boxExtendVertical+=w.GetBoxExtendVertical()}var y=t.wi;r=y.GetLayer();var B=r.GetAngle();w=y.GetBoundingBox();var E=y.GetTotalZElevation();y=y.GetDepth();let[H,K]=r.LayerToDrawSurface(w.getLeft(),w.getTop(),E),[C,A]=r.LayerToDrawSurface(w.getRight(),w.getBottom(),E);if(0!==B||0<y){const[F,J]=r.LayerToDrawSurface(w.getRight(),w.getTop(),E),[L,R]=r.LayerToDrawSurface(w.getLeft(),w.getBottom(),E);if(0<y){B=E+y;const[T,V]=r.LayerToDrawSurface(w.getLeft(),w.getTop(),B),[ba,ia]=r.LayerToDrawSurface(w.getRight(),w.getTop(),B),[ja,qa]=r.LayerToDrawSurface(w.getRight(),w.getBottom(),B),[za,Ca]=r.LayerToDrawSurface(w.getLeft(),w.getBottom(),B);r=Math.min(H,C,F,L,T,ba,ja,za);C=Math.max(H,C,F,L,T,ba,ja,za);H=r;r=Math.min(K,A,J,R,V,ia,qa,Ca);A=Math.max(K,A,J,R,V,ia,qa,Ca);K=r}else r=Math.min(H,C,F,L),C=Math.max(H,C,F,L),H=r,r=Math.min(K,A,J,R),A=Math.max(K,A,J,R),K=r}r=t.screenRect;w=t.rcTexOrigin;B=t.rcTexDest;E=t.clearRect;y=t.rcTexBounce;r.set(H,K,C,A);r.shuntY(t.drawHeight);w.copy(r);w.divide(t.surfaceWidth,t.surfaceHeight);w.swapTopBottom();r.inflate(t.boxExtendHorizontal,t.boxExtendVertical);B.copy(r);B.divide(t.surfaceWidth,t.surfaceHeight);B.swapTopBottom();E.copy(r);E.roundOuter();E.inflate(t.boxExtendHorizontal+
  1,t.boxExtendVertical+1);r.clamp(0,0,t.drawWidth,t.drawHeight);E.clamp(0,0,t.drawWidth,t.drawHeight);y.copy(r);y.divide(t.surfaceWidth,t.surfaceHeight);y.swapTopBottom()}function u(t){const r=t.renderer;r.SetTextureFillMode();const w=t.GetEffectRenderTarget(t.fxIndex);r.SetRenderTarget(w);var y=t.opts;y&&y.preTransform&&y.preTransform();r.ClearRect2(t.clearRect);t.inst?(r.SetColor(t.wi.GetPremultipliedColor()),r.SetCurrentZ(t.wi.GetTotalZElevation()),t.inst.Draw(r),r.SetCurrentZ(0)):(y=(t.layer||t.layout).GetRenderTarget(),t.layer?r.SetColor(t.layer.GetPremultipliedColor()):r.ResetColor(),r.DrawRenderTarget(y),r.InvalidateRenderTarget(y),t.runtime.GetCanvasManager().ReleaseAdditionalRenderTarget(y));t.rcTexDest.clampFlipped(0,1,1,0);t.fxIndex=1;t.otherFxIndex=0;g&&l("Pre-draw",r,w)}function x(t,r){const w=t.renderer,y=t.runtime,B=t.GetEffectRenderTarget(t.fxIndex);w.SetRenderTarget(B);var E=t.opts;E&&E.preTransform&&E.preTransform();w.ClearRect2(t.clearRect);if(t.inst){const[H,K]=t.inst.GetCurrentSurfaceSize();(E=t.inst.GetCurrentTexRect())?t.srcRect.copy(E):t.srcRect.set(0,0,0,0);r=t.wi.GetInstanceEffectList().GetEffectParametersForIndex(r.GetIndex());w.SetProgramParameters(t.renderTarget,t.rcTexDest,t.srcRect,t.srcRect,t.layoutRect,1/H,1/K,t.layerScale,t.layerAngle,y.GetGameTime(),r);w.SetCurrentZ(t.wi.GetTotalZElevation());t.inst.Draw(w);w.SetCurrentZ(0);t.rcTexDest.clampFlipped(0,1,1,0);t.screenRect.shuntY(t.drawHeight)}else r=(t.layer||t.layout).GetEffectList().GetEffectParametersForIndex(r.GetIndex()),w.SetProgramParameters(t.renderTarget,t.rcTexDest,t.rcTexBounce,t.rcTexOrigin,t.layoutRect,1/t.drawWidth,1/t.drawHeight,t.layerScale,t.layerAngle,y.GetGameTime(),r),t=(t.layer||t.layout).GetRenderTarget(),g&&l("Layer target",w,t),w.DrawRenderTarget(t),w.InvalidateRenderTarget(t),y.GetCanvasManager().ReleaseAdditionalRenderTarget(t);g&&l("First bounce",w,B)}function n(t,r,w,y){const B=t.renderer,E=t.runtime;0===y&&t.preDraw&&t.inst&&t.screenRect.shuntY(t.drawHeight);w?(t.inst?B.SetBlendMode(t.wi.GetBlendMode()):t.layer&&B.SetBlendMode(t.layer.GetBlendMode()),w=t.renderTarget,B.SetRenderTarget(w)):(w=t.GetEffectRenderTarget(t.fxIndex),B.SetRenderTarget(w),B.ClearRect2(t.clearRect));r=t.inst?t.wi.GetInstanceEffectList().GetEffectParametersForIndex(r.GetIndex()):(t.layer||t.layout).GetEffectList().GetEffectParametersForIndex(r.GetIndex());B.SetProgramParameters(t.renderTarget,t.rcTexDest,t.rcTexBounce,t.rcTexOrigin,t.layoutRect,1/t.surfaceWidth,1/t.surfaceHeight,t.layerScale,t.layerAngle,E.GetGameTime(),r);r=t.GetEffectRenderTarget(t.otherFxIndex);B.SetTexture(r.GetTexture());E.GetCanvasManager().SetDeviceTransform(B);t.didChangeTransform=!0;h.setFromRect(t.screenRect);B.Quad3(h,t.rcTexBounce);t.inst||B.InvalidateRenderTarget(r);g&&l("Bounce "+y,B,w)}function q(t,r){r=t.renderer;if(t.layout)r.SetTextureFillMode(),r.SetRenderTarget(t.renderTarget),t=t.GetEffectRenderTarget(t.otherFxIndex),r.CopyRenderTarget(t),r.InvalidateRenderTarget(t);else{var w=t.runtime.GetCanvasManager();"low"===w.GetCurrentFullscreenScalingQuality()?(r.SetTextureFillMode(),w.SetDeviceTransform(r,w.GetDrawWidth(),w.GetDrawHeight()),t.didChangeTransform=!0):r.SetDeviceTransformTextureFillMode();t.inst?r.SetBlendMode(t.wi.GetBlendMode()):t.layer&&r.SetBlendMode(t.layer.GetBlendMode());r.SetRenderTarget(t.renderTarget);w=t.GetEffectRenderTarget(t.otherFxIndex);r.SetTexture(w.GetTexture());h.setFromRect(t.screenRect);r.Quad3(h,t.rcTexBounce);t.inst||r.InvalidateRenderTarget(w);g&&l("Post-draw",r,t.renderTarget)}}}
  {"use strict";const e=self.C3,a=/<(.+?)>/g;e.TimelineManager=class extends e.DefendedBase{constructor(b){super();this._runtime=b;this._timelineDataManager=e.New(e.TimelineDataManager);this._pluginInstance=null;this._timelines=[];this._timelinesByName=new Map;this._objectClassToTimelineMap=new Map;this._timelinesCreatedByTemplate=new Map;this._scheduledTimelines=[];this._playingTimelines=[];this._isTickingTimelines=this._changingLayout=this._hasRuntimeListeners=!1;this._tickFunc=()=>this._OnTick();this._tick2Func=()=>this._OnTick2();this._beforeLayoutChange=()=>this._OnBeforeChangeLayout();this._layoutChange=()=>this._OnAfterChangeLayout();this._instanceDestroy=d=>this._OnInstanceDestroy(d.instance);this._afterLoad=d=>this._OnAfterLoad();this._destroyedWhileLoadingState=[]}Release(){this.RemoveRuntimeListeners();this._afterLoad=this._instanceDestroy=this._layoutChange=this._beforeLayoutChange=this._tick2Func=this._tickFunc=null;for(const b of this._timelines)b.Stop(),b.Release();e.clearArray(this._timelines);this._timelines=null;this._timelineDataManager.Release();this._timelineDataManager=null;e.clearArray(this._scheduledTimelines);this._scheduledTimelines=null;e.clearArray(this._playingTimelines);this._playingTimelines=null;this._timelinesByName.clear();this._timelinesByName=null;this._objectClassToTimelineMap.clear();this._objectClassToTimelineMap=null;this._timelinesCreatedByTemplate.clear();this._timelinesCreatedByTemplate=null;e.clearArray(this._destroyedWhileLoadingState);this._runtime=this._destroyedWhileLoadingState=null}AddRuntimeListeners(){const b=this._runtime.Dispatcher();b.addEventListener("pretick",this._tickFunc);b.addEventListener("tick2",this._tick2Func);b.addEventListener("beforelayoutchange",this._beforeLayoutChange);b.addEventListener("layoutchange",this._layoutChange);b.addEventListener("instancedestroy",this._instanceDestroy);b.addEventListener("afterload",this._afterLoad)}RemoveRuntimeListeners(){const b=this._runtime.Dispatcher();b.removeEventListener("pretick",this._tickFunc);b.removeEventListener("tick2",this._tick2Func);b.removeEventListener("beforelayoutchange",this._beforeLayoutChange);b.removeEventListener("layoutchange",this._layoutChange);b.removeEventListener("instancedestroy",this._instanceDestroy);b.removeEventListener("afterload",this._afterLoad)}Create(b){this._timelineDataManager.Add(b);b=e.TimelineState.CreateInitial(b,this);this.Add(b);this.SetTimelineObjectClassesToMap(b);this._timelinesCreatedByTemplate.set(b.GetName(),0)}CreateFromTemplate(b){var d=this.GetTimelineDataManager();b=b.GetTemplateName();d=d.Get(b);d=e.TimelineState.CreateFromTemplate(`${b}:${this._timelinesCreatedByTemplate.get(b)}`,d,this);this._IncreaseTemplateTimelinesCount(b);this.Add(d);return d}_IncreaseTemplateTimelinesCount(b){this._timelinesCreatedByTemplate.set(b,this._timelinesCreatedByTemplate.get(b)+1)}_SetCreatedTemplateTimelinesCount(){for(const b of this._timelines){if(b.IsTemplate())continue;const d=b.GetTemplateName();this._IncreaseTemplateTimelinesCount(d)}}_ClearCreatedTemplateTimelinesCount(){for(const b of this._timelinesCreatedByTemplate.keys())this._timelinesCreatedByTemplate.set(b,0)}Add(b){this._timelines.push(b);this._timelinesByName.set(b.GetName().toLowerCase(),b)}Remove(b){b.IsTemplate()||(e.arrayFindRemove(this._timelines,b),e.arrayFindRemove(this._scheduledTimelines,b),e.arrayFindRemove(this._playingTimelines,b),this._timelinesByName.delete(b.GetName().toLowerCase()),this.RemoveTimelineFromObjectClassMap(b),b.IsReleased()||b.Release())}Trigger(b){this._runtime.Trigger(b,this._pluginInstance,null)}GetRuntime(){return this._runtime}GetTimelineDataManager(){return this._timelineDataManager}SetPluginInstance(b){this._pluginInstance=b}GetPluginInstance(){return this._pluginInstance}*GetTimelines(){for(const b of this._timelines)yield b}SetTimelineObjectClassToMap(b,d){this._objectClassToTimelineMap.has(b)||this._objectClassToTimelineMap.set(b,new Set);this._objectClassToTimelineMap.get(b).add(d)}SetTimelineObjectClassesToMap(b){for(const d of b.GetObjectClasses())this.SetTimelineObjectClassToMap(d,b)}RemoveTimelineFromObjectClassMap(b){for(const[d,c]of this._objectClassToTimelineMap.entries())c.has(b)&&(c.delete(b),0===c.size&&this._objectClassToTimelineMap.delete(d))}GetTimelinesForObjectClass(b){if(this._objectClassToTimelineMap.has(b))return this._objectClassToTimelineMap.get(b)}GetTimelineOfTemplateForInstances(b,d){if(d)for(const c of this._timelines)if(d.every(f=>c.HasTrackInstance(f.instance,f.trackId))&&c.GetName().includes(b.GetName()))return c}GetTimelineByName(b){return this._timelinesByName.get(b.toLowerCase())||null}GetScheduledOrPlayingTimelineByName(b){for(const d of this._scheduledTimelines)if(d.GetName()===b)return d;for(const d of this._playingTimelines)if(d.GetName()===b)return d;return null}*GetTimelinesByName(b){if(a.test(b)){a.lastIndex=0;let c;var d=new Set;do if(c=a.exec(b)){const f=c[1].split(",");for(const h of f)d.add(h)}while(c);for(const f of d.values())(b=this.GetTimelineByName(f))&&(yield b);d.clear()}else(d=this.GetTimelineByName(b))&&(yield d)}*GetTimelinesByTags(b){for(const d of this._timelines)d.HasTags(b)&&(yield d)}AddScheduledTimeline(b){this._scheduledTimelines.includes(b)||this._scheduledTimelines.push(b);this._MaybeEnableRuntimeListeners()}RemovePlayingTimeline(b){e.arrayFindRemove(this._playingTimelines,b);this._MaybeDisableRuntimeListeners()}ScheduleTimeline(b){this._playingTimelines.includes(b)?(b.SetPlaying(!0),b.SetScheduled(!1),b.SetMarkedForRemoval(!1)):(b.SetPlaying(!1),b.SetScheduled(!0),b.SetMarkedForRemoval(!1),this._scheduledTimelines.includes(b)||this._scheduledTimelines.push(b));this._MaybeEnableRuntimeListeners()}DeScheduleTimeline(b){b.SetPlaying(!1);b.SetScheduled(!1);b.ResolvePlayPromise();e.arrayFindRemove(this._scheduledTimelines,b);this._MaybeDisableRuntimeListeners()}CompleteTimeline(b){b.SetPlaying(!1);b.SetScheduled(!1);b.SetMarkedForRemoval(!0)}CompleteTimelineAndResolve(b){this.CompleteTimeline(b);b.ResolvePlayPromise()}_OnTick(){if(!this.GetRuntime().IsLoadingState()&&this._hasRuntimeListeners&&!this._changingLayout){var b=!1;for(this._isTickingTimelines=!0;this._scheduledTimelines.length;){var d=this._scheduledTimelines.pop();d.SetInitialState();this._playingTimelines.push(d)}d=this._runtime.GetDt();var c=this._runtime.GetTimeScale();for(const f of this._playingTimelines){if(f.IsMarkedForRemoval())continue;const h=f.Tick(d,c);!b&&h&&(b=!0)}this._isTickingTimelines=!1;b&&this.GetRuntime().UpdateRender()}}_OnTick2(){if(!this.GetRuntime().IsLoadingState()&&this._hasRuntimeListeners&&!this._changingLayout){var b;for(const d of this._playingTimelines)d.IsMarkedForRemoval()&&(b||(b=new Set),this._MaybeExecuteTimelineFinishTriggers(d),b.add(d));b&&e.arrayRemoveAllInSet(this._playingTimelines,b);this._MaybeDisableRuntimeListeners()}}_MaybeExecuteTimelineFinishTriggers(b){b.IsReleased()||b.HasValidTracks()&&b.IsComplete()&&b.InitialStateSet()&&b.FinishTriggers()}_MaybeEnableRuntimeListeners(){this._hasRuntimeListeners||(this._hasRuntimeListeners=!0)}_MaybeDisableRuntimeListeners(){this._playingTimelines.length||this._scheduledTimelines.length||this._isTickingTimelines||(this._hasRuntimeListeners=!1)}_OnBeforeChangeLayout(){for(this._changingLayout=!0;this._scheduledTimelines.length;)this.DeScheduleTimeline(this._scheduledTimelines.pop());const b=new Set;for(const d of this._playingTimelines)d._OnBeforeChangeLayout()&&b.add(d);e.arrayRemoveAllInSet(this._playingTimelines,b);this._MaybeDisableRuntimeListeners();for(const d of this._timelines)d.CleanCaches()}_OnAfterChangeLayout(){this._changingLayout=!1}_OnInstanceDestroy(b){var d=b.GetObjectClass();if(d=this.GetTimelinesForObjectClass(d))if(this._runtime.IsLoadingState())this._destroyedWhileLoadingState.push(b);else for(const c of d)c.IsTemplate()||(c.IsReleased()?this.Remove(c):c.HasValidTracks()||(this._MaybeExecuteTimelineFinishTriggers(c),this.Remove(c)))}_OnAfterLoad(){for(const b of this._destroyedWhileLoadingState)this._OnInstanceDestroy(b);e.clearArray(this._destroyedWhileLoadingState)}_SaveToJson(){return{timelinesJson:this._SaveTimelinesToJson(),scheduledTimelinesJson:this._SaveScheduledTimelinesToJson(),playingTimelinesJson:this._SavePlayingTimelinesToJson(),hasRuntimeListeners:this._hasRuntimeListeners,changingLayout:this._changingLayout,isTickingTimelines:this._isTickingTimelines}}_LoadFromJson(b){b&&(this._ClearCreatedTemplateTimelinesCount(),this._LoadTimelinesFromJson(b.timelinesJson),this._LoadScheduledTimelinesFromJson(b.scheduledTimelinesJson),this._LoadPlayingTimelinesFromJson(b.playingTimelinesJson),this._hasRuntimeListeners=!b.hasRuntimeListeners,this._changingLayout=!!b.changingLayout,this._isTickingTimelines=!!b.isTickingTimelines,this._SetCreatedTemplateTimelinesCount(),this._MaybeEnableRuntimeListeners(),this._MaybeDisableRuntimeListeners())}_SaveTimelinesToJson(){return this._timelines.map(b=>b._SaveToJson())}_LoadTimelinesFromJson(b){for(const d of b){b=this.GetTimelineByName(d.name);if(!b){b=this._GetTemplateNameFromJson(d);if(!b)continue;b=this.GetTimelineByName(b);b=this.CreateFromTemplate(b)}b._LoadFromJson(d);b.HasTracks()||this.Remove(b)}}_GetTemplateNameFromJson(b){return(b=b.name.split(":"))&&2===b.length?b[0]:null}_SaveScheduledTimelinesToJson(){return this._SaveTimelines(this._scheduledTimelines)}_LoadScheduledTimelinesFromJson(b){this._LoadTimelines(b,this._scheduledTimelines)}_SavePlayingTimelinesToJson(){return this._SaveTimelines(this._playingTimelines)}_LoadPlayingTimelinesFromJson(b){this._LoadTimelines(b,this._playingTimelines)}_IsTimelineInJson(b,d){for(const c of d)if(c===b.GetName())return!0;return!1}_SaveTimelines(b){return b.map(d=>d.GetName())}_LoadTimelines(b,d){var c=new Set;for(const f of d)this._IsTimelineInJson(f,b)||c.add(f);e.arrayRemoveAllInSet(d,c);c=f=>h=>h.GetName()===f;for(const f of b)(b=this.GetTimelineByName(f))&&(d.find(c(f))||d.push(b))}}}
  {"use strict";const e=self.C3;e.TimelineState=class extends e.DefendedBase{constructor(a,b,d){super();this._runtime=d.GetRuntime();this._timelineManager=d;this._timelineDataItem=b;this._name=a;this._tracks=[];for(const c of this._timelineDataItem.GetTrackData().trackDataItems())this._tracks.push(e.TrackState.Create(this,c));this._playResolve=this._playPromise=null;this._playheadTime=e.New(e.KahanSum);this._playheadTime.Set(0);this._playbackRate=1;this._pingPongState=0;this._currentRepeatCount=1;this._initialStateSet=this._isScheduled=this._isPlaying=!1;this._complete=!0;this._markedForRemoval=this._released=!1;this._completedTick=-1;this._firstTick=this._finishedTriggers=this._isTemplate=this._implicitPause=!1;this._lastDelta=NaN;this._tags=[""];this._stringTags="";this._tagsChanged=!1}static CreateInitial(a,b){var d=b.GetTimelineDataManager();const c=d.GetNameId();d=d.Get(a[c]);a=e.New(e.TimelineState,a[c],d,b);a.SetIsTemplate(!0);return a}static CreateFromTemplate(a,b,d){return e.New(e.TimelineState,a,b,d)}static get WORLD_INSTANCE_BOX_CHANGE(){return 1}static get LAYOUT_RENDER_CHANGE(){return e.nextHighestPowerOfTwo(1)}Release(){if(!this.IsReleased()){this._timelineManager.DeScheduleTimeline(this);this._timelineManager.CompleteTimelineAndResolve(this);for(const a of this._tracks)a.Release();e.clearArray(this._tracks);this._tracks=null;this._playheadTime.Release();this._timelineDataItem=this._timelineManager=this._runtime=this._playheadTime=null;this._released=!0;this._playResolve=this._playPromise=null}}GetTimelineManager(){return this._timelineManager}GetRuntime(){return this._runtime}GetTracks(){return this._tracks}GetSimilarPropertyTracks(a,b,d){const c=[];for(const f of this._tracks){if(a!==f.GetInstance())continue;const h=f.GetPropertyTrack(d);h&&b.constructor===h.GetSourceAdapter().constructor&&c.push(h)}return c}HasTracks(){return!!this._tracks.length}GetTrackById(a){for(const b of this._tracks)if(e.equalsNoCase(b.GetId(),a))return b;return null}GetTrackByName(a){for(const b of this._tracks)if(!b.IsInstanceTrack()&&e.equalsNoCase(b.GetName(),a))return b;return null}SetName(a){this._name=a}GetName(){return this._name}GetTimelineDataItem(){return this._timelineDataItem}GetTemplateName(){return this._timelineDataItem.GetName()}GetTotalTime(){return this._timelineDataItem.GetTotalTime()}SetTotalTime(a){this._timelineDataItem.SetTotalTime(a)}GetStep(){return this._timelineDataItem.GetStep()}SetStep(a){this._timelineDataItem.SetStep(a)}GetInterpolationMode(){return this._timelineDataItem.GetInterpolationMode()}SetInterpolationMode(a){this._timelineDataItem.SetInterpolationMode(a)}GetResultMode(){return this._timelineDataItem.GetResultMode()}SetResultMode(a){this._timelineDataItem.GetResultMode(a)}SetEase(a){for(const b of this.GetTracks())b.SetEase(a)}GetLoop(){return this._timelineDataItem.GetLoop()}SetLoop(a){return this._timelineDataItem.SetLoop(a)}GetPingPong(){return this._timelineDataItem.GetPingPong()}SetPingPong(a){return this._timelineDataItem.SetPingPong(a)}GetRepeatCount(){return this._timelineDataItem.GetRepeatCount()}SetPlaybackRate(a){return this._playbackRate=a}GetPlaybackRate(){return this._playbackRate}IsForwardPlayBack(){return this.IsPlaying()?0<this._playbackRate:!0}GetPlayPromise(){return this._playPromise?this._playPromise:this._playPromise=new Promise(a=>{this._playResolve=a})}ResolvePlayPromise(){this._playPromise&&(this._playResolve(),this._playResolve=this._playPromise=null)}SetTags(a){this._tags=e.TimelineState._GetTagArray(a);this._tagsChanged=!0}GetTags(){return this._tags}GetStringTags(){this._tagsChanged&&(this._stringTags=this._tags.join(" "));this._tagsChanged=!1;return this._stringTags}HasTags(a){return this._tags&&this._tags.length?(a=e.TimelineState._GetTagArray(a))&&a.length?a.every(e.TimelineState._HasTag,this):!1:!1}OnStarted(){e.Plugins.Timeline.Cnds.SetTriggerTimeline(this);this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimelineStarted);this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimelineStartedByName);this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimelineStartedByTags);this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnAnyTimelineStarted);e.Plugins.Timeline.Cnds.SetTriggerTimeline(null)}OnCompleted(){this._completedTick=this._runtime.GetTickCount()}FinishTriggers(){this._finishedTriggers||(this._finishedTriggers=!0,e.Plugins.Timeline.Cnds.SetTriggerTimeline(this),this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimelineFinished),this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimelineFinishedByName),this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimelineFinishedByTags),this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnAnyTimelineFinished),e.Plugins.Timeline.Cnds.SetTriggerTimeline(null))}SetPlaying(a){this._isPlaying=a}IsCompletedTick(){return this._completedTick===this._runtime.GetTickCount()}IsPlaying(a=!1){return this.IsCompletedTick()||this.IsScheduled()&&!a?!0:this._isPlaying}_IsPlaying(){return this.IsPlaying(!0)}IsPaused(){return this._IsPaused()}_IsPaused(){return this.IsReleased()||this.IsScheduled()||this._IsPlaying()||this.IsComplete()?!1:!0}SetScheduled(a){this._isScheduled=a}IsScheduled(){return this._isScheduled}SetComplete(a){this._complete=a;a=this.GetTime();if(0>=a||a>=this.GetTotalTime())this._complete=!0}IsComplete(){return this._complete}IsReleased(){return this._released}SetMarkedForRemoval(a){this._markedForRemoval=a}IsMarkedForRemoval(){return this._markedForRemoval}SetImplicitPause(a){this._implicitPause=a}IsImplicitPause(){return this._implicitPause}SetIsTemplate(a){this._isTemplate=!!a}IsTemplate(){return this._isTemplate}InitialStateSet(){return this._initialStateSet}GetTime(){return this._playheadTime.Get()}SetTime(a){const b=this.GetTime();this._SetTime(a);this.SetComplete(!1);this.IsComplete()||this.SetImplicitPause(!0);if(this._IsPlaying()||this.IsScheduled()||!this._initialStateSet)this._IsPlaying()||this.IsScheduled()||this._initialStateSet?this._IsPlaying()?this.Stop():this.IsScheduled()&&(this._timelineManager.DeScheduleTimeline(this),this.SetInitialStateFromSetTime()):this.SetInitialStateFromSetTime();this._Interpolate(a,!1,!0,!0,b)&&this.GetRuntime().UpdateRender();this._OnSetTime()}_SetTime(a){0>a?this._playheadTime.Set(0):a>=this.GetTotalTime()?this._playheadTime.Set(this.GetTotalTime()):this._playheadTime.Set(a)}_OnSetTime(){e.Plugins.Timeline&&this.constructor===e.TimelineState&&(e.Plugins.Timeline.Cnds.SetTriggerTimeline(this),this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimeSet),this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimeSetByName),this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimeSetByTags),e.Plugins.Timeline.Cnds.SetTriggerTimeline(null))}_CanResume(){if(!this.GetLoop())if(this.GetPingPong()&&1===this._pingPongState)if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())return!1}else{if(0>=this.GetTime())return!1}else if(!this.GetLoop()&&!this.GetPingPong())if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())return!1}else if(0>=this.GetTime())return!1;return!0}Resume(){this.IsReleased()||this._CanResume()&&this.Play(!0)}Play(a=!1){return this.IsReleased()||this.IsScheduled()?!1:this._IsPlaying()&&this.IsCompletedTick()?this._SchedulePlayingTimeline():this._IsPlaying()||!this.IsComplete()&&!a&&!this.IsImplicitPause()?!1:this._ScheduleStoppedTimeline()}_SchedulePlayingTimeline(){this.SetImplicitPause(!1);this._timelineManager.RemovePlayingTimeline(this);this._timelineManager.ScheduleTimeline(this);this.GetPlayPromise();return!0}_ScheduleStoppedTimeline(){this.SetImplicitPause(!1);this._timelineManager.ScheduleTimeline(this);this.GetPlayPromise();return!0}Stop(a=!1){this.IsReleased()||(this.SetComplete(a),this._timelineManager.CompleteTimeline(this),this.IsComplete()&&this.ResolvePlayPromise())}Reset(a=!0,b=!1){if(!this.IsReleased()){if(!this._IsPlaying()&&this.IsScheduled())return this._timelineManager.DeScheduleTimeline(this);if(!this.IsComplete()){this.Stop(!0);this.IsForwardPlayBack()?this._SetTime(0):this._SetTime(this.GetTotalTime());var d=this.GetTime();b=b?this._InterpolateBeforeChangeLayout(d):this._Interpolate(d,!1,!1,!0);a&&this._OnSetTime();b&&a&&this.GetRuntime().UpdateRender()}}}ResetBeforeChangeLayout(){this.Reset(!1,!0)}_InterpolateBeforeChangeLayout(a){this._Interpolate(a,!1,!1,!0,NaN,!1,!0)}_OnBeforeChangeLayout(){if(this.IsReleased())return!0;if(this.HasValidGlobalTracks())return!1;this._timelineManager.CompleteTimeline(this);this.ResetBeforeChangeLayout();return!0}SetInitialStateFromSetTime(){this.SetInitialState(!0)}SetInitialState(a){if(!this.IsMarkedForRemoval())if(a){this._firstTick=this._initialStateSet=!0;for(const b of this._tracks)b.SetInitialState()}else if(this.SetPlaying(!0),this.SetScheduled(!1),this.OnStarted(),this.IsComplete()){this._completedTick=-1;this._pingPongState=0;this._currentRepeatCount=1;this._finishedTriggers=this._complete=!1;this._firstTick=this._initialStateSet=!0;this.IsForwardPlayBack()?this._SetTime(0):this._SetTime(this.GetTotalTime());for(const b of this._tracks)b.SetInitialState()}else{this._firstTick=!0;for(const b of this._tracks)b.SetResumeState()}}Tick(a,b){if(0!==a||0!==this._lastDelta){this._lastDelta=a;var d=this.GetTime();this._SetTime(d+a*b*this._playbackRate);var c;this.GetLoop()||this.GetPingPong()?this.GetLoop()&&!this.GetPingPong()?c=this._LoopCompleteCheck():!this.GetLoop()&&this.GetPingPong()?c=this._PingPongCompleteCheck():this.GetLoop()&&this.GetPingPong()&&(c=this._LoopPingPongCompleteCheck()):c=this._SimpleCompleteCheck();if(c){for(const f of this._tracks)f.SetEndState();this.Stop(!0);this.OnCompleted();return!0}return this._Interpolate(this.GetTime(),!0,!1,!1,d,!0)}}_Interpolate(a,b=!1,d=!1,c=!1,f=NaN,h=!1,g=!1){let l=!1;for(var m of this._tracks)m.BeforeInterpolate();for(const u of this._tracks){m=a;if("number"===typeof f){const x=this.GetTime()-u.GetStartOffset(),n=f-u.GetStartOffset();0>x&&0<n&&(m=u.GetStartOffset(),this._SetTime(m))}m=u.Interpolate(m,b,d,c,this._firstTick,g);!l&&m&&(l=!0)}for(const u of this._tracks)u.AfterInterpolate();this._firstTick&&h&&(this._firstTick=!1);return l}_SimpleCompleteCheck(){if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())if(this._currentRepeatCount<this.GetRepeatCount())this._currentRepeatCount++,this._SetTime(0);else return this._SetTime(this.GetTotalTime()),!0}else if(0>=this.GetTime())if(this._currentRepeatCount<this.GetRepeatCount())this._currentRepeatCount++,this._SetTime(this.GetTotalTime());else return this._SetTime(0),!0;return!1}_LoopCompleteCheck(){this.IsForwardPlayBack()?this.GetTime()>=this.GetTotalTime()&&this._SetTime(0):0>=this.GetTime()&&this._SetTime(this.GetTotalTime());return!1}_PingPongCompleteCheck(){if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())if(this._SetTime(this.GetTotalTime()),this.SetPlaybackRate(-1*this.GetPlaybackRate()),1===this._pingPongState)if(this._currentRepeatCount<this.GetRepeatCount())this._currentRepeatCount++,this._pingPongState=0;else return!0;else 0===this._pingPongState&&(this._pingPongState=1)}else if(0>=this.GetTime())if(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate()),1===this._pingPongState)if(this._currentRepeatCount<this.GetRepeatCount())this._currentRepeatCount++,this._pingPongState=0;else return!0;else 0===this._pingPongState&&(this._pingPongState=1);return!1}_LoopPingPongCompleteCheck(){this.IsForwardPlayBack()?this.GetTime()>=this.GetTotalTime()&&(this._SetTime(this.GetTotalTime()),this.SetPlaybackRate(-1*this.GetPlaybackRate())):0>=this.GetTime()&&(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate()));return!1}AddTrack(){var a=this._timelineDataItem.GetTrackData().AddEmptyTrackDataItem();a=e.TrackState.Create(this,a);this._tracks.push(a);return a}CleanCaches(){for(const a of this._tracks)a.CleanCaches()}ClearTrackInstances(){for(const a of this._tracks)a.ClearInstance()}SetTrackInstance(a,b){if(b)for(const d of this._tracks)if(d.IsInstanceTrack()){if(a){if(d.GetId()!==a)continue}else if(d.HasInstance())continue;d.SetInstance(b);this._timelineManager.SetTimelineObjectClassToMap(b.GetObjectClass(),this);break}}HasTrackInstance(a,b){for(const d of this._tracks)if(d.IsInstanceTrack())if(b){if(b===d.GetId()&&a===d.GetInstance())return!0}else if(a===d.GetInstance())return!0;return!1}HasValidTracks(){return this._tracks.some(a=>a.IsInstanceTrack()?a.CanInstanceBeValid():!0)}HasValidGlobalTracks(){return this._tracks.some(a=>a.IsInstanceTrack()?a.CanInstanceBeValid()?(a=a.GetObjectClass())?a.IsGlobal():!1:!1:!1)}GetPropertyTrack(a){for(const b of this.GetTracks())for(const d of b.GetPropertyTracks())if(d.GetPropertyName()===a)return d}GetTrackFromInstance(a){for(const b of this._tracks)if(a===b.GetInstance())return b;return null}GetKeyframeWithTags(a){a=a?a.split(" "):[];a=[...(new Set(a.map(b=>b.toLowerCase().trim()))).values()];for(const b of this.GetTracks())for(const d of b.GetKeyframeDataItems())if(a.every(c=>d.HasTag(c)))return d}GetObjectClasses(){const a=[];for(const b of this.GetTracks())a.push(b.GetObjectClass());return a.filter(b=>b)}_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(a){a&&(this._LoadTracksFromJson(a.tracksJson),this._name=a.name,this._playheadTime.Set(a.playheadTime),this._playbackRate=a.playbackRate,this._pingPongState=a.pingPongState,this._currentRepeatCount=a.currentRepeatCount,this._isPlaying=!!a.isPlaying,this._isScheduled=!!a.isScheduled,this._initialStateSet=!!a.initialStateSet,this._finishedTriggers=a.hasOwnProperty("finishedTriggers")?!!a.finishedTriggers:!1,this._complete=!!a.complete,this._released=!!a.released,this._markedForRemoval=!!a.markedForRemoval,this._completedTick=a.completedTick,this._implicitPause=!!a.implicitPause,this._isTemplate=!!a.isTemplate,this._tags=a.tags.split(" "),this._stringTags=a.stringTags,this._tagsChanged=!!a.tagsChanged,this._firstTick=!!a.firstTick)}_SaveTracksToJson(){return this._tracks.map(a=>a._SaveToJson())}_LoadTracksFromJson(a){a.forEach((b,d)=>{this._tracks[d]._LoadFromJson(b)});this._tracks.filter(b=>b.CanInstanceBeValid())}static _HasTag(a){const b=this.GetTags();return""===a?1===b.length&&""===b[0]:b.includes(a)}static _GetTagArray(a){if(e.IsArray(a))return a.slice(0);if(e.IsString(a))return a.split(" ")}}}
  {"use strict";const e=self.C3;e.TrackState=class extends e.DefendedBase{constructor(a,b){super();this._timeline=a;this._trackDataItem=b;this._trackData=b.GetTrackData();this._objectClassIndex=this._instanceUid=NaN;this._worldInfo=this._instance=null;this._isNested=0<b.GetStartOffset();this._endStateOfNestedSet=this._initialStateOfNestedSet=!1;this._lastKeyframeDataItem=null;this._keyframeDataItems=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemArray();this._propertyTracks=[];for(const d of this._trackDataItem.GetPropertyTrackData().propertyTrackDataItems())this._propertyTracks.push(e.PropertyTrackState.Create(this,d))}static Create(a,b){return e.New(e.TrackState,a,b)}Release(){this._keyframeDataItems=null;for(const a of this._propertyTracks)a.Release();e.clearArray(this._propertyTracks);this._lastKeyframeDataItem=this._trackDataItem=this._worldInfo=this._instance=this._timeline=this._propertyTracks=null}CleanCaches(){for(const a of this._propertyTracks)a.CleanCaches();this._worldInfo=this._instance=null}GetTimeline(){return this._timeline}GetRuntime(){return this._timeline.GetRuntime()}GetKeyframeDataItems(){return this._keyframeDataItems?this._keyframeDataItems:this._keyframeDataItems=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemArray()}GetPropertyTracks(){return this._propertyTracks}GetPropertyTrack(a){for(const b of this._propertyTracks)if(b.GetPropertyName()===a)return b}MaybeGetInstance(){this._instance||this.GetInstance()}IsInstanceValid(){return this._instance?!this._instance.IsDestroyed():!1}CanInstanceBeValid(){if(!this.IsInstanceTrack())return!1;var a=this.GetInstanceUID();return(a=this.GetRuntime().GetInstanceByUID(a))?!a.IsDestroyed():!1}GetObjectClass(){if(this.IsInstanceTrack()){var a=this.GetObjectClassIndex();if(-1!==a)return this.GetRuntime().GetObjectClassByIndex(a)}}ClearInstance(){this._instance=null;this._instanceUid=-1;this._worldInfo=null;this._objectClassIndex=-1}HasInstance(){return!!this._instance}GetInstance(){if(this._instance&&this.IsInstanceValid())return this._instance;const a=this.GetInstanceUID();return this._instance=this.GetRuntime().GetInstanceByUID(a)}SetInstance(a){if(this._instance!==a){this.CleanCaches();this._instance=a;this._objectClassIndex=a.GetObjectClass().GetIndex();this._instanceUid=a.GetUID();this._worldInfo=a.GetWorldInfo();for(const h of this.propertyTrackItems()){const g=h.sourceAdapter;switch(h.propertyTrack.GetSourceAdapterId()){case "instance-variable":g.GetEditorIndex();var b=a.GetObjectClass(),d=b.GetInstanceVariableIndexByName(h.name),c=b.GetInstanceVariableName(d);b=b.GetInstanceVariableType(d);c===h.name&&b===h.type&&g.UpdateInstanceVariableIndex(d);break;case "behavior":var f=h.behaviorType;d=this.GetObjectClass();c=a.GetObjectClass();b=g.GetBehaviorType(c);f&&b&&(f=f.GetName(),d.GetBehaviorIndexByName(f),c.GetBehaviorIndexByName(f),g.GetEditorIndex(),g.UpdateBehaviorTypeSid(b.GetSID()))}}}}*propertyTrackItems(){for(const d of this._propertyTracks){var a=d.GetSourceAdapter(),b=this.GetObjectClass();const c={propertyTrack:d,sourceAdapter:a};switch(d.GetSourceAdapterId()){case "world-instance":c.property=d.GetPropertyName();break;case "instance-variable":a=a.GetEditorIndex();c.name=b.GetInstanceVariableName(a);c.type=b.GetInstanceVariableType(a);break;case "effect":b=b.GetEffectList();a=a.GetEffectType(b);c.effectType=a;break;case "behavior":a=a.GetBehaviorType(b);c.behaviorType=a;break;case "plugin":c.plugin=b.GetPlugin()}yield c}}GetWorldInfo(){if(this._worldInfo&&this.IsInstanceValid())return this._worldInfo;const a=this.GetInstance();a&&(this._worldInfo=a.GetWorldInfo());return this._worldInfo}GetTrackDataItem(){return this._trackDataItem}GetInstanceUID(){return this._instanceUid?this._instanceUid:this._trackDataItem.GetInstanceUID()}SetInstanceUID(a){this._trackDataItem.SetInstanceUID(a)}GetInterpolationMode(){return this._trackDataItem.GetInterpolationMode()}SetInterpolationMode(a){this._trackDataItem.SetInterpolationMode(a)}GetResultMode(){return this._trackDataItem.GetResultMode()}GetId(){return this._trackDataItem.GetId()}GetStartOffset(){return this._trackDataItem.GetStartOffset()}GetLocalTotalTime(){return this._trackDataItem.GetLocalTotalTime()}SetLocalTotalTime(a){this._trackDataItem.SetLocalTotalTime(a)}SetResultMode(a){this._trackDataItem.SetResultMode(a)}SetEase(a){for(const b of this.GetKeyframeDataItems())b.SetEase(a);for(const b of this.GetPropertyTracks())b.SetEase(a)}GetEnable(){return this._trackDataItem.GetEnable()}SetEnable(a){this._trackDataItem.SetEnable(a)}GetObjectClassIndex(){return isNaN(this._objectClassIndex)?this._trackDataItem.GetObjectClassIndex():this._objectClassIndex}SetObjectClassIndex(a){this._trackDataItem.SetObjectClassIndex(a)}SetOriginalWidth(a){this._trackDataItem.SetOriginalWidth(a)}GetOriginalWidth(){const a=this.GetInstance();return a&&a.GetSdkInstance().IsOriginalSizeKnown()?a.GetSdkInstance().GetOriginalWidth():this._trackDataItem.GetOriginalWidth()}SetOriginalHeight(a){this._trackDataItem.SetOriginalHeight(a)}GetOriginalHeight(){const a=this.GetInstance();return a&&a.GetSdkInstance().IsOriginalSizeKnown()?a.GetSdkInstance().GetOriginalHeight():this._trackDataItem.GetOriginalHeight()}GetType(){return this._trackDataItem.GetType()}GetName(){return this._trackDataItem.GetName()}IsInstanceTrack(){return 0===this.GetType()}IsValueTrack(){return 1===this.GetType()}SetInitialState(){this.MaybeGetInstance();if(this.IsInstanceValid()||!this.IsInstanceTrack()){for(var a of this._propertyTracks)a.SetInitialState();a=this.GetTimeline().IsForwardPlayBack()?0:this.GetLocalTotalTime();this._lastKeyframeDataItem=this.GetLastKeyFrameBeforeTime(a);this._endStateOfNestedSet=this._initialStateOfNestedSet=!1;this.Interpolate(a)}}SetResumeState(){this.MaybeGetInstance();if(this.IsInstanceValid()||!this.IsInstanceTrack()){this._timeline.IsForwardPlayBack();var a=this._timeline.GetTime()-this.GetStartOffset();this._lastKeyframeDataItem=this.GetLastKeyFrameBeforeTime(a);for(const b of this._propertyTracks)b.SetResumeState()}}SetEndState(){if(!(this.GetTimeline().IsComplete()||(this.MaybeGetInstance(),!this.IsInstanceValid()&&this.IsInstanceTrack()||this._isNested))){const a=this._timeline.GetTime(),b=this.GetStartOffset()+this.GetLocalTotalTime();a>=b?this.Interpolate(this.GetLocalTotalTime(),!0,!1,!0):0>=a&&this.Interpolate(0,!0,!1,!0)}}BeforeInterpolate(){for(const a of this._propertyTracks)a.BeforeInterpolate()}Interpolate(a,b=!1,d=!1,c=!1,f=!1,h=!1){this.MaybeGetInstance();if(!this.IsInstanceValid()&&this.IsInstanceTrack()||h&&this.IsInstanceTrack()&&this.GetObjectClass().IsGlobal())return!1;a-=this.GetStartOffset();if(0>a)return!1;this.MaybeSetInitialStateOfNestedTrack(a,b);this.MaybeTriggerKeyframeReachedConditions(a,b,f);f=h=!1;for(const g of this._propertyTracks){const l=g.Interpolate(a,d,!1,c);h||0===(l&e.TimelineState.WORLD_INSTANCE_BOX_CHANGE)||(h=!0);f||0===(l&e.TimelineState.LAYOUT_RENDER_CHANGE)||(f=!0)}this.MaybeSetEndStateOfNestedTrack(a,b);h&&(a=this.GetWorldInfo())&&a.SetBboxChanged();return f}AfterInterpolate(){for(const a of this._propertyTracks)a.AfterInterpolate()}MaybeSetInitialStateOfNestedTrack(a,b){if(b&&this._isNested&&!this._initialStateOfNestedSet){if(this.GetTimeline().IsForwardPlayBack()){if(0>a)return;for(const d of this._propertyTracks)d.Interpolate(0,!1,!1,!0)}else{if(a>this.GetLocalTotalTime())return;for(const d of this._propertyTracks)d.Interpolate(this.GetLocalTotalTime(),!1,!1,!0)}for(const d of this._propertyTracks)d.SetInitialState();this._initialStateOfNestedSet=!0}}MaybeSetEndStateOfNestedTrack(a,b){if(b&&this._isNested&&!this._endStateOfNestedSet)if(this.GetTimeline().IsForwardPlayBack()){if(a>=this.GetLocalTotalTime()){for(const d of this._propertyTracks)d.Interpolate(this.GetLocalTotalTime(),!1,!1,!0);this._endStateOfNestedSet=!0}}else if(0>=a){for(const d of this._propertyTracks)d.Interpolate(0,!1,!1,!0);this._endStateOfNestedSet=!0}}MaybeTriggerKeyframeReachedConditions(a,b,d){if(!d&&b)return a=this.GetLastKeyFrameBeforeTime(a),a!==this._lastKeyframeDataItem&&this.OnKeyframeReached(a),this._lastKeyframeDataItem=a}GetLastKeyFrameBeforeTime(a){const b=this.GetTimeline();let d=this._trackData.GetKeyFrameDataItemAtTime(a,this._trackDataItem);return d?d:b.IsForwardPlayBack()?this._trackData.GetFirstKeyFrameDataItemLowerOrEqualThan(a,this._trackDataItem):this._trackData.GetFirstKeyFrameDataItemHigherOrEqualThan(a,this._trackDataItem)}OnKeyframeReached(a){if(e.Plugins.Timeline&&this.GetTimeline().constructor===e.TimelineState){var b=this.GetTimeline();e.Plugins.Timeline.Cnds.SetTriggerTimeline(b);e.Plugins.Timeline.Cnds.SetTriggerKeyframe(a);a=b.GetTimelineManager();a.Trigger(e.Plugins.Timeline.Cnds.OnAnyKeyframeReached);a.Trigger(e.Plugins.Timeline.Cnds.OnKeyframeReached);e.Plugins.Timeline.Cnds.SetTriggerTimeline(null);e.Plugins.Timeline.Cnds.SetTriggerKeyframe(null)}}AddKeyframe(){return this._trackDataItem.GetKeyframeData().AddEmptyKeyframeDataItem()}AddPropertyTrack(){var a=this._trackDataItem.GetPropertyTrackData().AddEmptyPropertyTrackDataItem();a=e.PropertyTrackState.Create(this,a);this._propertyTracks.push(a);return a}DeleteKeyframes(a){this._trackDataItem.GetKeyframeData().DeleteKeyframeDataItems(a)}DeletePropertyKeyframes(a){for(const b of this._propertyTracks)b.DeletePropertyKeyframes(a)}SaveState(){for(const a of this._propertyTracks)a.SaveState()}CompareInitialStateWithCurrent(){this.MaybeGetInstance();if(this.IsInstanceValid()||!this.IsInstanceTrack())for(const a of this._propertyTracks)a.CompareInitialStateWithCurrent()}CompareSaveStateWithCurrent(){this.MaybeGetInstance();if(this.IsInstanceValid()||!this.IsInstanceTrack()){var a=!1;for(const b of this._propertyTracks){const d=b.CompareSaveStateWithCurrent();!a&&d&&(a=!0)}a&&(a=this.AddKeyframe(),a.SetTime(this.GetTimeline().GetTime()),a.SetEase("noease"),a.SetEnable(!0),a.SetTags(""))}}_SaveToJson(){var a=this.GetInstance();a=a?a.GetUID():this.GetInstanceUID();return{propertyTracksJson:this._SavePropertyTracksToJson(),lastKeyframeDataItemJson:this._SaveLastKeyframeDataItemToJson(),initialStateOfNestedSet:this._initialStateOfNestedSet,endStateOfNestedSet:this._endStateOfNestedSet,instanceUid:a}}_LoadFromJson(a){a&&(this._LoadPropertyTracksFromJson(a.propertyTracksJson),this._LoadLastKeyframeDataItemFromJson(a.lastKeyframeDataItemJson),this._LoadInstanceFromJson(a.instanceUid),this._initialStateOfNestedSet=!1,a.hasOwnProperty.initialStateOfNestedSet&&(this._initialStateOfNestedSet=a.initialStateOfNestedSet),this._endStateOfNestedSet=!1,a.hasOwnProperty.endStateOfNestedSet&&(this._endStateOfNestedSet=a.endStateOfNestedSet))}_SaveLastKeyframeDataItemToJson(){return this._trackDataItem.GetKeyframeData().GetKeyframeDataItemIndex(this._lastKeyframeDataItem)}_SavePropertyTracksToJson(){return this._propertyTracks.map(a=>a._SaveToJson())}_LoadPropertyTracksFromJson(a){a.forEach((b,d)=>{this._propertyTracks[d]._LoadFromJson(b)})}_LoadInstanceFromJson(a){if(e.IsFiniteNumber(a)&&(a=this.GetRuntime().GetInstanceByUID(a))){var b=this.GetTimeline();b.ClearTrackInstances();b.SetTrackInstance(this._trackDataItem.GetId(),a)}}_LoadLastKeyframeDataItemFromJson(a){this._lastKeyframeDataItem=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemFromIndex(a)}}}
  {"use strict";const e=self.C3;e.PropertyTrackState=class extends e.DefendedBase{constructor(a,b){super();this._track=a;this._propertyTrackDataItem=b;this._propertyTrackData=b.GetPropertyTrackData();this._sourceAdapter=this.GetSourceAdapter();this._propertyKeyframeDataItems=this._propertyTrackDataItem.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray()}static Create(a,b){return e.New(e.PropertyTrackState,a,b)}Release(){this._track=null;this._sourceAdapter&&(this._sourceAdapter.Release(),this._sourceAdapter=null);this._propertyTrackData=this._propertyTrackDataItem=this._propertyKeyframeDataItems=null}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;let a;switch(this._propertyTrackDataItem.GetSourceAdapterId()){case "behavior":a=new e.PropertyTrackState.BehaviorSourceAdapter(this);break;case "effect":a=new e.PropertyTrackState.EffectSourceAdapter(this);break;case "instance-variable":a=new e.PropertyTrackState.InstanceVariableSourceAdapter(this);break;case "plugin":a=new e.PropertyTrackState.PluginSourceAdapter(this);break;case "world-instance":a=new e.PropertyTrackState.WorldInstanceSourceAdapter(this);break;case "value":a=new e.PropertyTrackState.ValueSourceAdapter(this)}return this._sourceAdapter=a}GetSourceAdapterId(){return this._propertyTrackDataItem.GetSourceAdapterId()}SetSourceAdapterId(a){this._propertyTrackDataItem.SetSourceAdapterId(a)}GetSourceAdapterArgs(){return this._propertyTrackDataItem.GetSourceAdapterArguments()}SetSourceAdapterArgs(a){this._propertyTrackDataItem.SetSourceAdapterArguments(a)}GetSourceAdapterValue(){return this.GetSourceAdapter().GetValue()}GetPropertyName(){return this._propertyTrackDataItem.GetProperty()}SetPropertyName(a){this._propertyTrackDataItem.SetProperty(a)}GetPropertyType(){return this._propertyTrackDataItem.GetType()}SetPropertyType(a){this._propertyTrackDataItem.SetType(a)}GetPropertyKeyframeType(){return this.GetPropertyTrackData().GetFirstPropertyKeyframeDataItem(this._propertyTrackDataItem).GetType()}GetMin(){return this._propertyTrackDataItem.GetMin()}SetMin(a){this._propertyTrackDataItem.SetMin(a)}GetMax(){return this._propertyTrackDataItem.GetMax()}SetMax(a){this._propertyTrackDataItem.SetMax(a)}GetEnable(){return this._propertyTrackDataItem.GetEnable()}SetEnable(a){this._propertyTrackDataItem.SetEnable(a)}GetInterpolationMode(){return this._propertyTrackDataItem.GetInterpolationMode()}SetInterpolationMode(a){this._propertyTrackDataItem.SetInterpolationMode(a)}GetResultMode(){return this._propertyTrackDataItem.GetResultMode()}SetResultMode(a){this._propertyTrackDataItem.SetResultMode(a)}SetEase(a){for(const b of this.GetPropertyKeyframeDataItems())b.SetEase(a)}GetPropertyKeyframeDataItems(){return this._propertyKeyframeDataItems?this._propertyKeyframeDataItems:this._propertyKeyframeDataItems=this._propertyTrackDataItem.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray()}*GetPropertyKeyframeValues(){for(const a of this.GetPropertyKeyframeDataItems())yield a.GetValueWithResultMode()}CleanCaches(){this.GetSourceAdapter().CleanCaches()}GetCurrentState(){return this.GetSourceAdapter().GetCurrentState()}SetInitialState(){this.GetSourceAdapter().SetInitialState()}SetResumeState(){this.GetSourceAdapter().SetResumeState()}BeforeInterpolate(){this.GetSourceAdapter().BeforeInterpolate()}Interpolate(a,b=!1,d=!1,c=!1){var f=this._propertyTrackDataItem;let h=this._propertyTrackData.GetPropertyKeyFrameDataItemAtTime(a,f);h?f=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherThan(a,f):(h=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(a,f),f=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(a,f));return this.GetSourceAdapter().Interpolate(a,h,f,b,d,c)}AfterInterpolate(){this.GetSourceAdapter().AfterInterpolate()}static GetStartPropertyKeyframeForTime(a,b){const d=b.GetPropertyTrackDataItem();b=b._propertyTrackData;let c=b.GetPropertyKeyFrameDataItemAtTime(a,d);c||(c=b.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(a,d));return c}static GetEndPropertyKeyframeForTime(a,b){const d=b.GetPropertyTrackDataItem();b=b._propertyTrackData;return b.GetPropertyKeyFrameDataItemAtTime(a,d)?b.GetFirstPropertyKeyFrameDataItemHigherThan(a,d):b.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(a,d)}AddPropertyKeyframe(){return this._propertyTrackDataItem.GetPropertyKeyframeData().AddEmptyPropertyKeyframeDataItem()}DeletePropertyKeyframes(a){this._propertyTrackDataItem.GetPropertyKeyframeData().DeletePropertyKeyframeDataItems(a)}SaveState(){this.GetSourceAdapter().SaveState()}CompareInitialStateWithCurrent(){if(this.GetSourceAdapter().CompareInitialStateWithCurrent()){const a=this._propertyTrackData.GetFirstPropertyKeyframeDataItem(this._propertyTrackDataItem),b=this.GetSourceAdapter().GetCurrentState();a.SetAbsoluteValue(b)}}CompareSaveStateWithCurrent(){const a=this.GetSourceAdapter().CompareSaveStateWithCurrent();a&&this.AddPropertyKeyframeAtCurrentTime();this.GetSourceAdapter().ClearSaveState();return a}AddPropertyKeyframeAtCurrentTime(){const a=this.GetTimeline().GetTime(),b=this.GetSourceAdapter(),d=e.PropertyTrackState.GetStartPropertyKeyframeForTime(a,this),c=this.AddPropertyKeyframe();c.SetType(d.GetType());c.SetTime(a);c.SetEase(d.GetEase());c.SetEnable(!0);c.SetValue(b.GetValueAtTime());c.SetAbsoluteValue(b.GetCurrentState())}_SaveToJson(){return{sourceAdapterJson:this.GetSourceAdapter()._SaveToJson()}}_LoadFromJson(a){a&&this.GetSourceAdapter()._LoadFromJson(a.sourceAdapterJson)}}}
  {"use strict";const e=self.C3.PropertyTrackState;e.PropertySourceAdapter=class{constructor(a){this._propertyTrack=a;this._propertyAdapter=null}Release(){this._propertyAdapter&&(this._propertyAdapter.Release(),this._propertyAdapter=null);this._propertyTrack=null}GetPropertyTrack(){return this._propertyTrack}CleanCaches(){this._propertyAdapter&&this._propertyAdapter.CleanCaches()}GetPropertyAdapter(){return this._propertyAdapter?this._propertyAdapter:this._propertyAdapter=this._CreatePropertyAdapter()}GetEditorIndex(){}GetIndex(){return this.GetEditorIndex()}GetTarget(){}SetInitialState(){this.GetPropertyAdapter().SetInitialState()}SetResumeState(){this.GetPropertyAdapter().SetResumeState()}BeforeInterpolate(){this.GetPropertyAdapter().BeforeChangeProperty()}Interpolate(a,b,d,c,f,h){const g=e.PropertySourceAdapter.GetInterpolateFunc(this._propertyTrack)(a,b,d,this._propertyTrack);return f?g:this.GetPropertyAdapter().ChangeProperty(a,g,b,d,c,h)}AfterInterpolate(){this.GetPropertyAdapter().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(){return e.PropertySourceAdapter.GetValueAtTime(this._propertyTrack)}_CreatePropertyAdapter(){const a=this._propertyTrack.GetPropertyType();switch(this._propertyTrack.GetPropertyKeyframeType()){case "combo":case "boolean":case "text":case "string":return new e.PropertyInterpolationAdapter.NoInterpolationAdapter(this);case "numeric":case "number":case "angle":return"combo"===a?new e.PropertyInterpolationAdapter.NoInterpolationAdapter(this):new e.PropertyInterpolationAdapter.NumericInterpolationAdapter(this);case "color":case "offsetColor":return new e.PropertyInterpolationAdapter.ColorInterpolationAdapter(this)}}_SaveToJson(){return{propertyAdapterJson:this.GetPropertyAdapter()._SaveToJson()}}_LoadFromJson(a){a&&this.GetPropertyAdapter()._LoadFromJson(a.propertyAdapterJson)}static GetValueAtTime(a){const b=a.GetTrack().GetTimeline().GetTime(),d=e.GetStartPropertyKeyframeForTime(b,a),c=e.GetEndPropertyKeyframeForTime(b,a);return e.PropertySourceAdapter.GetInterpolateFunc(a)(b,d,c,a)}static GetValue(a,b,d){let c=a.GetResultMode();"combo"===a.GetPropertyType()&&(c="absolute");switch(c){case "relative":return b+d;case "absolute":return d}}static GetInterpolateFunc(a){switch(a.GetPropertyKeyframeType()){case "numeric":return e.NumericTypeAdapter.Interpolate;case "angle":return e.AngleTypeAdapter.Interpolate;case "boolean":return e.BooleanTypeAdapter.Interpolate;case "color":return e.ColorTypeAdapter.Interpolate;case "text":return e.TextTypeAdapter.Interpolate}}static GetWillChangeFunc(a){switch(a.GetPropertyKeyframeType()){case "numeric":return e.NumericTypeAdapter.WillChange;case "angle":return e.AngleTypeAdapter.WillChange;case "boolean":return e.BooleanTypeAdapter.WillChange;case "color":return e.ColorTypeAdapter.WillChange;case "text":return e.TextTypeAdapter.WillChange}}}}
  {"use strict";const e=self.C3;class a extends e.PropertyTrackState.PropertySourceAdapter{constructor(b){super(b)}}e.PropertyTrackState.WorldInstanceSourceAdapter=a}
  {"use strict";const e=self.C3;class a extends e.PropertyTrackState.PropertySourceAdapter{constructor(b){super(b);this._updatedIndex=NaN}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]}GetIndex(){return this._updatedIndex?this._updatedIndex:super.GetIndex()}GetTarget(){return this._propertyTrack.GetTrack().GetInstance()}UpdateInstanceVariableIndex(b){this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]!==b&&(this._updatedIndex=b)}Interpolate(b,d,c,f,h,g){if(this.GetPropertyAdapter().CanChange(d.GetValue()))return super.Interpolate(b,d,c,f,h,g)}_SaveToJson(){return Object.assign(super._SaveToJson(),{index:this._updatedIndex})}_LoadFromJson(b){b&&(super._LoadFromJson(b),this._updatedIndex=b.index)}}e.PropertyTrackState.InstanceVariableSourceAdapter=a}
  {"use strict";const e=self.C3;class a extends e.PropertyTrackState.PropertySourceAdapter{constructor(b){super(b);this._sid=NaN}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[1]}GetTarget(){var b=this._propertyTrack.GetPropertyTrackDataItem(),d=this._propertyTrack.GetTrack();b=this._sid?this._sid:b.GetSourceAdapterArguments()[0];d=d.GetInstance();b=d.GetBehaviorIndexBySID(b);return d.GetBehaviorInstances()[b].GetSdkInstance()}GetBehaviorType(b){const d=this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[2];return b.GetBehaviorTypeByName(d)}UpdateBehaviorTypeSid(b){this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]!==b&&(this._sid=b)}Interpolate(b,d,c,f,h,g){const l=this._propertyTrack.GetTrack().GetInstance();if(this.GetBehaviorType(l.GetObjectClass()))return super.Interpolate(b,d,c,f,h,g)}_SaveToJson(){return Object.assign(super._SaveToJson(),{sid:this._sid})}_LoadFromJson(b){b&&(super._LoadFromJson(b),this._sid=b.sid)}}e.PropertyTrackState.BehaviorSourceAdapter=a}
  {"use strict";const e=self.C3;class a extends e.PropertyTrackState.PropertySourceAdapter{constructor(b){super(b)}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[1]}GetTarget(){const b=this._propertyTrack.GetTrack().GetWorldInfo().GetInstanceEffectList();var d=b.GetEffectList();d=this.GetEffectType(d).GetIndex();return b.IsEffectIndexActive(d)?b.GetEffectParametersForIndex(d):null}GetEffectType(b){const d=this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0];return b.GetEffectTypeByName(d)}Interpolate(b,d,c,f,h,g){if(this._IsEffectActive())return super.Interpolate(b,d,c,f,h,g)}_IsEffectActive(){const b=this._propertyTrack.GetTrack().GetWorldInfo().GetInstanceEffectList();var d=b.GetEffectList();if(d=this.GetEffectType(d))return d=d.GetIndex(),b.IsEffectIndexActive(d)}}e.PropertyTrackState.EffectSourceAdapter=a}
  {"use strict";const e=self.C3;class a extends e.PropertyTrackState.PropertySourceAdapter{constructor(b){super(b)}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]}GetTarget(){return this._propertyTrack.GetTrack().GetInstance().GetSdkInstance()}Interpolate(b,d,c,f,h,g){var l=this._propertyTrack.GetTrack();const m=l.GetObjectClass().GetPlugin();l=l.GetInstance().GetObjectClass().GetPlugin();if(m===l)return super.Interpolate(b,d,c,f,h,g)}}e.PropertyTrackState.PluginSourceAdapter=a}
  {"use strict";const e=self.C3;class a extends e.PropertyTrackState.PropertySourceAdapter{constructor(b){super(b);this._value=0;this._init=!1}SetInitialState(){const b=this._propertyTrack.GetPropertyTrackData();let d=this._propertyTrack.GetPropertyTrackDataItem();d=b.GetFirstPropertyKeyframeDataItem(d);this._value=d.GetValueWithResultMode()}SetResumeState(){}GetValue(){this._init||this._propertyTrack.Interpolate(0);return this._value}Interpolate(b,d,c,f,h,g){f=e.PropertyTrackState.NumericTypeAdapter.Interpolate;this._value=f(b,d,c,this._propertyTrack);this._init=!0}SaveState(){}ClearSaveState(){}GetCurrentState(){return this._value}CompareInitialStateWithCurrent(){return!1}CompareSaveStateWithCurrent(){return!1}_SaveToJson(){return{value:this._value,init:this._init}}_LoadFromJson(b){b&&(this._value=b.value,this._init=b.hasOwnProperty("init")?b.init:!0)}}e.PropertyTrackState.ValueSourceAdapter=a}"use strict";self.C3.PropertyTrackState.PropertyInterpolationAdapter=class{constructor(e){this._sourceAdapter=e;this._propertyTrack=e.GetPropertyTrack();this._worldInfo=this._propertyTrack.GetTrack().GetWorldInfo();this._property=this._propertyTrack.GetPropertyName();this._firstAbsoluteUpdate=!1;this._target=this._saveState=null}Release(){this._target=this._saveState=this._worldInfo=this._propertyTrack=this._sourceAdapter=null}CleanCaches(){this._target=this._saveState=this._worldInfo=null}GetPropertyTrack(){return this._propertyTrack}GetWorldInfo(){return this._worldInfo?this._worldInfo:this._worldInfo=this._propertyTrack.GetTrack().GetWorldInfo()}SetFirstAbsoluteUpdate(e){this._firstAbsoluteUpdate=!!e}GetFirstAbsoluteUpdate(){return this._firstAbsoluteUpdate}SetInitialState(){}SetResumeState(){}SetSaveState(){this._saveState=this.GetCurrentState()}ClearSaveState(){this._saveState=null}GetCurrentState(){}CompareInitialStateWithCurrent(){}CompareSaveStateWithCurrent(){}CanChange(e){return typeof this._Getter()===typeof e}BeforeChangeProperty(){}ChangeProperty(e,a,b,d,c){}AfterChangeProperty(){}_FirstKeyframeGetter(){return this._PickTimelinePlaybackMode(()=>{const e=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetFirstPropertyKeyframeDataItem(e)},()=>{const e=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(e)}).GetAbsoluteValue()}_CurrentKeyframeGetter(){const e=this._propertyTrack.GetTimeline().GetTime()-this._propertyTrack.GetTrack().GetStartOffset();return this._PickTimelinePlaybackMode(()=>{const a=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(e,a)},()=>{const a=this._propertyTrack.GetPropertyTrackDataItem(),b=this._propertyTrack.GetPropertyTrackData(),d=b.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(e,a);return d?d:b.GetLastPropertyKeyframeDataItem(a)}).GetAbsoluteValue()}_PickTimelinePlaybackMode(e,a){return this._propertyTrack.GetTimeline().IsForwardPlayBack()?e():a()}_PickResultMode(e,a){return"relative"===this._propertyTrack.GetResultMode()?e():a()}_PickFirstAbsoluteUpdate(e,a){return this.GetFirstAbsoluteUpdate()?(this.SetFirstAbsoluteUpdate(!1),e()):a()}_GetAbsoluteInitialValue(e){}_GetIndex(){return this._sourceAdapter.GetIndex()}_GetTarget(){return this._target?this._target:this._target=this._sourceAdapter.GetTarget()}_PickSource(e,a,b,d,c){switch(this._propertyTrack.GetSourceAdapterId()){case "behavior":return e();case "effect":return a();case "instance-variable":return b();case "plugin":return d();case "world-instance":return c()}}_SaveToJson(){return{firstAbsoluteUpdate:this._firstAbsoluteUpdate,saveState:this._saveState}}_LoadFromJson(e){e&&(this._firstAbsoluteUpdate=e.firstAbsoluteUpdate,this._saveState=e.saveState)}_GetPropertyKeyframeStubs(e,a=!1){const b=[];for(const d of e){e=d.GetTrack().GetStartOffset();for(const c of d.GetPropertyKeyframeDataItems())a&&0===c.GetTime()?b.push({time:e+c.GetTime(),value:c.GetAbsoluteValue()}):a||b.push({time:e+c.GetTime(),value:c.GetAbsoluteValue()})}return b.sort((d,c)=>d.time-c.time)}_GetLastPropertyKeyframeStub(e,a,b){return this._GetPropertyKeyframeStubLowerThanPlayhead(a,b)}_GetPropertyKeyframeStubLowerThanPlayhead(e,a){for(let b=a.length-1;0<=b;b--)if(a[b].time<=e)return a[b];return null}};{"use strict";const e=self.C3,a=new Map,b=[0,0,0];class d extends e.PropertyTrackState.PropertyInterpolationAdapter{constructor(c){super(c)}SetInitialState(){}SetResumeState(){}GetCurrentState(){const c=this._propertyTrack.GetSourceAdapterId(),f=this._GetTarget(),h=this._GetIndex();switch(c){case "behavior":return this._ToColorArray(f.GetPropertyValueByIndex(h));case "effect":return this._ToColorArray(f[h]);case "plugin":return this._ToColorArray(f.GetPropertyValueByIndex(h));case "world-instance":return this._ToColorArray(this._Getter())}}CompareInitialStateWithCurrent(){const c=this._FirstKeyframeGetter();return!this._CompareColors(c,this._Getter())}CompareSaveStateWithCurrent(){return e.IsNullOrUndefined(this._saveState)?!1:!this._CompareColors(this._saveState,this._Getter())}_CompareColors(c,f){return c.equalsIgnoringAlpha(f)}_FirstKeyframeGetter(){const c=super._FirstKeyframeGetter();return this._GetColorFromArray(c)}_CurrentKeyframeGetter(){const c=super._CurrentKeyframeGetter();return this._GetColorFromArray(c)}_GetAbsoluteInitialValue(c){}_ToColorArray(c){return e.IsInstanceOf(c,e.Color)?c.toArray().slice(0,3):c.slice(0,3)}_GetColorFromArray(c){return e.IsInstanceOf(c,e.Color)?c:new e.Color(c[0],c[1],c[2],1)}CanChange(c){return!0}BeforeChangeProperty(){var c=this._propertyTrack.GetInstance();a.has(c)||a.set(c,new Map);c=a.get(c);const f=this._propertyTrack.GetSourceAdapterId();c.has(f)||c.set(f,new Map);c=c.get(f);c.has(this._property)||c.set(this._property,{used:!1,color:new e.Color(0,0,0,1)})}_GetTmpColor(c,f,h){c=a.get(c).get(f).get(h);c.used=!0;return c.color}ChangeProperty(c,f,h,g,l){l=this._propertyTrack.GetTimeline();g=this._propertyTrack.GetTrack();c=this._propertyTrack.GetInstance();var m=this._propertyTrack.GetSourceAdapter();h=this._propertyTrack.GetSourceAdapterId();m=l.GetSimilarPropertyTracks(c,m,this._property);if(1<m.length){if(m=this._GetPropertyKeyframeStubs(m,!0),l=this._GetLastPropertyKeyframeStub(l,l.GetTime(),m))if(g=g.GetStartOffset(),m=l.time-g,0===m)this._GetTmpColor(c,h,this._property).addRgb(f[0],f[1],f[2]);else{if(0>m)return;l=f[0];g=f[1];f=f[2];m=this._propertyTrack.Interpolate(m,!1,!0);l=e.Color.DiffChannel(l,m[0]);g=e.Color.DiffChannel(g,m[1]);f=e.Color.DiffChannel(f,m[2]);this._GetTmpColor(c,h,this._property).addRgb(l,g,f)}}else this._Setter(f[0],f[1],f[2]);return e.TimelineState.LAYOUT_RENDER_CHANGE}AfterChangeProperty(){const c=this._propertyTrack.GetInstance();if(a.has(c)){var f=a.get(c),h=this._propertyTrack.GetSourceAdapterId();if(f.has(h)){var g=f.get(h);if(g.has(this._property)){var l=g.get(this._property),m=l.color;l.used&&this._Setter(m.getR(),m.getG(),m.getB());0===g.size&&f.delete(h);0===f.size&&a.delete(c)}}}}_Getter(){const c=this._propertyTrack.GetSourceAdapterId(),f=this._GetTarget(),h=this._GetIndex();switch(c){case "behavior":return this._GetColorFromArray(f.GetPropertyValueByIndex(h));case "effect":return f[h].clone();case "plugin":return this._GetColorFromArray(f.GetPropertyValueByIndex(h));case "world-instance":return this.GetWorldInfo().GetUnpremultipliedColor().clone()}}_Setter(c,f,h){const g=this._propertyTrack.GetSourceAdapterId(),l=this._GetTarget(),m=this._GetIndex();switch(g){case "behavior":b[0]=c;b[1]=f;b[2]=h;l.SetPropertyValueByIndex(m,b);break;case "effect":l[m].setRgb(c,f,h);break;case "plugin":b[0]=c;b[1]=f;b[2]=h;l.SetPropertyValueByIndex(m,b);break;case "world-instance":this.GetWorldInfo().SetUnpremultipliedColorRGB(c,f,h)}}_SaveToJson(){}_LoadFromJson(c){}}e.PropertyTrackState.PropertyInterpolationAdapter.ColorInterpolationAdapter=d}
  {"use strict";const e=self.C3;class a extends e.PropertyTrackState.PropertyInterpolationAdapter{constructor(b){super(b)}SetInitialState(){}SetResumeState(){}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){return this._FirstKeyframeGetter()!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return e.IsNullOrUndefined(this._saveState)?!1:this._saveState!==this.GetCurrentState()}ChangeProperty(b,d,c,f,h){c=e.PropertyTrackState.PropertySourceAdapter.GetWillChangeFunc(this._propertyTrack);var g=this._propertyTrack;const l=g.GetTrack();f=g.GetSourceAdapterId();h=g.GetTimeline();var m=l.GetInstance();g=g.GetSourceAdapter();m=h.GetSimilarPropertyTracks(m,g,this._property);1<m.length&&(m=this._GetPropertyKeyframeStubs(m),b+=l.GetStartOffset(),b=this._GetLastPropertyKeyframeStub(h,b,m))&&(d=b.value);if(c(this._GetIndex(),this._GetTarget(),d,f))switch(this._Setter(d),f){case "plugin":return e.TimelineState.LAYOUT_RENDER_CHANGE}}_Getter(){const b=this._propertyTrack.GetSourceAdapterId(),d=this._GetTarget(),c=this._GetIndex();switch(b){case "behavior":return d.GetPropertyValueByIndex(c);case "effect":return d[c];case "instance-variable":return d.GetInstanceVariableValue(c);case "plugin":return d.GetPropertyValueByIndex(c)}}_Setter(b){const d=this._propertyTrack.GetSourceAdapterId(),c=this._GetTarget(),f=this._GetIndex();switch(d){case "behavior":c.SetPropertyValueByIndex(f,b);break;case "effect":c[f]=b;break;case "instance-variable":c.SetInstanceVariableValue(f,b);break;case "plugin":c.SetPropertyValueByIndex(f,b)}}}e.PropertyTrackState.PropertyInterpolationAdapter.NoInterpolationAdapter=a}
  {"use strict";const e=self.C3,a=new Map,b=(c,f,h,g,l)=>a.set(c,{setter:f,absolute_setter:h,getter:g,round:l});b("offsetX",(c,f)=>c.OffsetX(f),(c,f)=>c.SetX(f),c=>c.GetX(),!0);b("offsetY",(c,f)=>c.OffsetY(f),(c,f)=>c.SetY(f),c=>c.GetY(),!0);b("offsetWidth",(c,f)=>c.OffsetWidth(f),(c,f)=>c.SetWidth(f),c=>c.GetWidth(),!0);b("offsetHeight",(c,f)=>c.OffsetHeight(f),(c,f)=>c.SetHeight(f),c=>c.GetHeight(),!0);b("offsetAngle",(c,f)=>c.OffsetAngle(f),(c,f)=>c.SetAngle(f),c=>c.GetAngle(),!1);b("offsetOpacity",(c,f,h,g)=>{h=c.GetOpacity()+f;0===g._clampAccumulator?(1<h?g._clampAccumulator+=h-1:0>h&&(g._clampAccumulator+=h),c.OffsetOpacity(f)):(c=c.GetOpacity()+f,0<f&&0<g._clampAccumulator?1<c&&(g._clampAccumulator+=c-1):0<f&&0>g._clampAccumulator?(g._clampAccumulator+=f,0<g._clampAccumulator&&(g._clampAccumulator=0)):0>f&&0<g._clampAccumulator?(g._clampAccumulator+=f,0>g._clampAccumulator&&(g._clampAccumulator=0)):0>f&&0>g._clampAccumulator&&0>c&&(g._clampAccumulator+=c))},(c,f)=>{c.SetOpacity(f)},c=>c.GetOpacity(),!1);b("offsetOriginX",(c,f)=>c.OffsetOriginX(f),(c,f)=>c.SetOriginX(f),c=>c.GetOriginX(),!1);b("offsetOriginY",(c,f)=>c.OffsetOriginY(f),(c,f)=>c.SetOriginY(f),c=>c.GetOriginY(),!1);b("offsetZElevation",(c,f)=>c.OffsetZElevation(f),(c,f)=>c.SetZElevation(f),c=>c.GetZElevation(),!0);b("offsetScaleX",(c,f,h,g)=>{g=0>c.GetWidth()?-1:1;c.GetTransformWithParentWidth();c.OffsetWidth(h.GetOriginalWidth()*g*f)},(c,f,h)=>{c.SetWidth(h.GetOriginalWidth()*f)},(c,f)=>{const h=0>c.GetWidth()?-1:1;if(c.GetTransformWithParentWidth()){var g=c.GetParent(),l=f.GetTimeline().GetTrackFromInstance(g.GetInstance());l?g=g.GetWidth()/l.GetOriginalWidth():(l=g.GetInstance().GetSdkInstance(),g=l.IsOriginalSizeKnown()?g.GetWidth()/l.GetOriginalWidth():1);return c.GetWidth()*h/(f.GetOriginalWidth()*g)}return c.GetWidth()*h/f.GetOriginalWidth()},!1);b("offsetScaleY",(c,f,h,g)=>{g=0>c.GetHeight()?-1:1;c.GetTransformWithParentHeight();c.OffsetHeight(h.GetOriginalHeight()*g*f)},(c,f,h)=>{c.SetHeight(h.GetOriginalHeight()*f)},(c,f)=>{const h=0>c.GetHeight()?-1:1;if(c.GetTransformWithParentHeight()){var g=c.GetParent(),l=f.GetTimeline().GetTrackFromInstance(g.GetInstance());l?g=g.GetHeight()/l.GetOriginalHeight():(l=g.GetInstance().GetSdkInstance(),g=l.IsOriginalSizeKnown()?g.GetHeight()/l.GetOriginalHeight():1);return c.GetHeight()*h/(f.GetOriginalHeight()*g)}return c.GetHeight()*h/f.GetOriginalHeight()},!1);class d extends e.PropertyTrackState.PropertyInterpolationAdapter{constructor(c){super(c);this._clampAccumulator=this._lastValue=0;this._instance_absolute_setter=this._instance_setter=this._instance_getter=null;this._round=!1;e.IsInstanceOf(this._propertyTrack.GetTimeline(),e.Tween)?this._typeAdapter=new e.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTween(this):this._typeAdapter=new e.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTimeline(this);c=this._propertyTrack.GetPropertyName();"world-instance"===this._propertyTrack.GetSourceAdapterId()&&(c=a.get(c),this._instance_getter=c.getter,this._instance_setter=c.setter,this._instance_absolute_setter=c.absolute_setter,this._round=c.round)}Release(){this._instance_absolute_setter=this._instance_setter=this._instance_getter=this._typeAdapter=null;super.Release()}GetLastValue(){return this._lastValue}SetLastValue(c){this._lastValue=c}SetInitialState(){const c=this._typeAdapter.SetInitialState();"number"===typeof c&&(this._lastValue=c);this._clampAccumulator=0}SetResumeState(){const c=this._typeAdapter.SetResumeState();"number"===typeof c&&(this._lastValue=c)}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){return this._FirstKeyframeGetter()!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return e.IsNullOrUndefined(this._saveState)?!1:this._saveState!==this.GetCurrentState()}BeforeChangeProperty(){this._typeAdapter.BeforeChangeProperty()}ChangeProperty(c,f,h,g,l,m,u){return this._typeAdapter.ChangeProperty(c,f,h,g,l,m,u)}AfterChangeProperty(){this._typeAdapter.AfterChangeProperty()}_Getter(){const c=this._GetTarget(),f=this._GetIndex(),h=this._propertyTrack.GetTrack(),g=this.GetWorldInfo();return this._PickSource(()=>c.GetPropertyValueByIndex(f),()=>c[f],()=>c.GetInstanceVariableValue(f),()=>c.GetPropertyValueByIndex(f),()=>this._instance_getter(g,h))}_Setter(c,f,h){const g=this._GetTarget(),l=this._GetIndex(),m=this._propertyTrack.GetTrack(),u=this.GetWorldInfo();this._PickSource(()=>g.OffsetPropertyValueByIndex(l,c),()=>g[l]+=c,()=>g.SetInstanceVariableOffset(l,c),()=>g.OffsetPropertyValueByIndex(l,c),()=>this._instance_setter(u,c,m,this))}_SetterAbsolute(c,f,h){const g=this._GetTarget(),l=this._GetIndex(),m=this._propertyTrack.GetTrack(),u=this.GetWorldInfo();this._PickSource(()=>g.SetPropertyValueByIndex(l,c),()=>g[l]=c,()=>g.SetInstanceVariableValue(l,c),()=>g.SetPropertyValueByIndex(l,c),()=>this._instance_absolute_setter(u,c,m))}_MaybeEnsureValue(c,f,h,g,l,m){this._typeAdapter._MaybeEnsureValue(c,f,h,g,l,m)}_AddDelta(c,f,h){var g=(c.toString().split(".")[1]||"").length;c=this._Getter();g=0===g?this._round?Math.round(c):c:e.toFixed(c,g);this._Setter(g-c,f,h)}_SaveToJson(){return Object.assign(super._SaveToJson(),{v:this._lastValue,a:this._clampAccumulator})}_LoadFromJson(c){c&&(super._LoadFromJson(c),this._lastValue=c.v,this._clampAccumulator=c.a)}}e.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapter=d}
  {"use strict";const e=self.C3,a=new Map;class b{constructor(d){this._numericInterpolationAdapter=d}Release(){this._numericInterpolationAdapter=null}SetInitialState(){const d=this._numericInterpolationAdapter,c=this._numericInterpolationAdapter.GetPropertyTrack();return d._PickResultMode(()=>d._PickTimelinePlaybackMode(()=>0,()=>e.PropertyTrackState.PropertySourceAdapter.GetValueAtTime(c)),()=>{})}SetResumeState(){}BeforeChangeProperty(){const d=this._numericInterpolationAdapter,c=this._numericInterpolationAdapter.GetPropertyTrack(),f=c.GetPropertyName();d._PickResultMode(()=>{},()=>{var h=c.GetInstance();a.has(h)||a.set(h,new Map);h=a.get(h);const g=c.GetSourceAdapterId();h.has(g)||h.set(g,new Map);h=h.get(g);h.has(f)||h.set(f,{used:!1,value:0})})}_GetTmpAbsoluteValueObject(d,c,f){d=a.get(d).get(c).get(f);d.used=!0;return d}ChangeProperty(d,c,f,h,g,l){const m=this._numericInterpolationAdapter,u=this._numericInterpolationAdapter.GetPropertyTrack(),x=u.GetPropertyName();m._PickResultMode(()=>{const n=m.GetLastValue();m._Setter(c-
  n,f,h);l&&this._MaybeEnsureValue(d,f,h,g,n,c);m.SetLastValue(c)},()=>{var n=u.GetTimeline(),q=u.GetTrack();const t=u.GetInstance();var r=u.GetSourceAdapter();const w=u.GetSourceAdapterId();r=n.GetSimilarPropertyTracks(t,r,x);if(1<r.length){if(r=m._GetPropertyKeyframeStubs(r,!0),n=m._GetLastPropertyKeyframeStub(n,n.GetTime(),r))q=q.GetStartOffset(),q=n.time-q,0===q?this._GetTmpAbsoluteValueObject(t,w,x).value+=c:0>q||(q=u.Interpolate(q,!1,!0),this._GetTmpAbsoluteValueObject(t,w,x).value+=c-q)}else m._SetterAbsolute(c)});return m._PickSource(()=>{},()=>e.TimelineState.LAYOUT_RENDER_CHANGE,()=>{},()=>e.TimelineState.LAYOUT_RENDER_CHANGE,()=>e.TimelineState.LAYOUT_RENDER_CHANGE)}AfterChangeProperty(){const d=this._numericInterpolationAdapter,c=this._numericInterpolationAdapter.GetPropertyTrack(),f=c.GetPropertyName();d._PickResultMode(()=>{},()=>{const h=c.GetInstance();if(a.has(h)){var g=a.get(h),l=c.GetSourceAdapterId();if(g.has(l)){var m=g.get(l);if(m.has(f)){var u=m.get(f),x=u.value;u.used&&d._SetterAbsolute(x);m.delete(f);0===m.size&&g.delete(l);0===g.size&&a.delete(h)}}}})}_MaybeEnsureValue(d,c,f,h,g,l){const m=this._numericInterpolationAdapter;h||(c&&d===c.GetTime()?m._AddDelta(c.GetValueWithResultMode(),c,f):f&&d===f.GetTime()?m._AddDelta(f.GetValueWithResultMode(),c,f):0===l-g&&m._AddDelta(c.GetValueWithResultMode(),c,f))}}e.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTimeline=b}
  {"use strict";const e=self.C3;new Map;class a{constructor(b){this._numericInterpolationAdapter=b}Release(){this._numericInterpolationAdapter=null}SetInitialState(){const b=this._numericInterpolationAdapter;b.SetFirstAbsoluteUpdate(!0);return this._GetAbsoluteInitialValue(b._FirstKeyframeGetter())}SetResumeState(){const b=this._numericInterpolationAdapter;if(b._FirstKeyframeGetter()!==b._CurrentKeyframeGetter())return b.SetFirstAbsoluteUpdate(!0),this._GetAbsoluteInitialValue(b._CurrentKeyframeGetter())}BeforeChangeProperty(){}ChangeProperty(b,d,c,f,h,g){const l=this._numericInterpolationAdapter,m=l.GetLastValue();l._PickResultMode(()=>{l._Setter(d-m,c,f);g&&this._MaybeEnsureValue(b,c,f,h,m,d)},()=>{l._PickFirstAbsoluteUpdate(()=>{l._Setter(m,c,f)},()=>{l._Setter(d-m,c,f);g&&this._MaybeEnsureValue(b,c,f,h,m,d)})});l.SetLastValue(d);return l._PickSource(()=>{},()=>e.TimelineState.LAYOUT_RENDER_CHANGE,()=>{},()=>e.TimelineState.LAYOUT_RENDER_CHANGE,()=>e.TimelineState.LAYOUT_RENDER_CHANGE)}AfterChangeProperty(){}_GetAbsoluteInitialValue(b){return b-
  this._numericInterpolationAdapter.GetCurrentState()}_MaybeEnsureValue(b,d,c,f,h,g){const l=this._numericInterpolationAdapter;f?d&&b===d.GetTime()?l._AddDelta(d.GetValueWithResultMode(),d,c):c&&b===c.GetTime()?l._AddDelta(c.GetValueWithResultMode(),d,c):c||l._AddDelta(d.GetValueWithResultMode(),d,c):d&&b===d.GetTime()?l._AddDelta(d.GetValueWithResultMode(),d,c):c&&b===c.GetTime()?l._AddDelta(c.GetValueWithResultMode(),d,c):0===g-h&&l._AddDelta(d.GetValueWithResultMode(),d,c)}}e.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTween=a}
  {"use strict";const e=self.C3,a=self.Ease;e.PropertyTrackState.NumericTypeAdapter=class{constructor(){}static WillChange(b,d,c,f){let h;switch(f){case "behavior":h=d.GetPropertyValueByIndex(b);break;case "effect":h=d[b];break;case "instance-variable":h=d.GetInstanceVariableValue(b);break;case "plugin":h=d.GetPropertyValueByIndex(b)}return h===c?!1:!0}static Interpolate(b,d,c,f){if(!c)return c=f.GetPropertyTrackDataItem(),c=f.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(c),c.GetValueWithResultMode();var h=f.GetInterpolationMode();"default"===h&&(h="continuous");"combo"===f.GetPropertyType()&&(h="discrete");if("discrete"===h)return d.GetValueWithResultMode();if("continuous"===h||"step"===h){"step"===h&&(h=f.GetTimeline().GetStep(),0!==h&&(h=1/h,b=Math.floor(b*h)/h));var g=d.GetTime();const l=c.GetTime();h=d.GetValueWithResultMode();const m=c.GetValueWithResultMode();if(h===m)return h;b=e.normalize(b,g,l);const u=d.GetEase();d=d.GetAddOn("cubic-bezier");c=c.GetAddOn("cubic-bezier");d&&d.GetStartEnable()&&c&&c.GetEndEnable()?(g=l-g,g=a.GetRuntimeEase(u)(g*b,0,1,g),g=a.GetRuntimeEase("cubicbezier")(g,h,h+d.GetStartAnchor(),m+c.GetEndAnchor(),m)):g=a.GetRuntimeEase(u)((l-g)*b,h,m-h,l-g);return"integer"===f.GetPropertyType()?Math.floor(g):g}}}}
  {"use strict";const e=self.C3;e.PropertyTrackState.AngleTypeAdapter=class{constructor(){}static WillChange(a,b,d,c){let f;switch(c){case "behavior":f=b.GetPropertyValueByIndex(a);break;case "effect":f=b[a];break;case "instance-variable":f=b.GetInstanceVariableValue(a);break;case "plugin":f=b.GetPropertyValueByIndex(a)}return f===d?!1:!0}static Interpolate(a,b,d,c){if(!d)return b=c.GetPropertyTrackDataItem(),b=c.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(b),b.GetValueWithResultMode();var f=c.GetInterpolationMode();"default"===f&&(f="continuous");"combo"===c.GetPropertyType()&&(f="discrete");if("discrete"===f)return b.GetValueWithResultMode();if("continuous"===f||"step"===f){"step"===f&&(c=c.GetTimeline().GetStep(),0!==c&&(c=1/c,a=Math.floor(a*c)/c));const h=b.GetTime(),g=d.GetTime();c=b.GetValueWithResultMode();d=d.GetValueWithResultMode();if(f=b.GetAddOn("angle")){const l=f.GetRevolutions();if(c===d&&0===l)return c;a=e.normalize(a,h,g);b=self.Ease.GetRuntimeEase(b.GetEase())(a,0,1,1);switch(f.GetDirection()){case "closest":return e.angleLerp(c,d,b,l);case "clockwise":return e.angleLerpClockwise(c,d,b,l);case "anti-clockwise":return e.angleLerpAntiClockwise(c,d,b,l)}}else{if(c===d)return c;a=e.normalize(a,h,g);b=self.Ease.GetRuntimeEase(b.GetEase());return e.angleLerp(c,d,b(a,0,1,1))}}}}}"use strict";self.C3.PropertyTrackState.BooleanTypeAdapter=class{constructor(){}static WillChange(e,a,b,d){let c;switch(d){case "behavior":c=a.GetPropertyValueByIndex(e);break;case "effect":c=a[e];break;case "instance-variable":c=a.GetInstanceVariableValue(e);break;case "plugin":c=a.GetPropertyValueByIndex(e)}return!!c===!!b?!1:!0}static Interpolate(e,a,b,d){return b?a.GetValueWithResultMode()?1:0:(e=d.GetPropertyTrackDataItem(),e=d.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(e),e.GetValueWithResultMode()?1:0)}};{"use strict";const e=self.C3,a=[0,0,0],b=[0,0,0],d=[0,0,0];e.PropertyTrackState.ColorTypeAdapter=class{constructor(){}static WillChange(c,f,h,g){let l;switch(g){case "behavior":l=f.GetPropertyValueByIndex(c);break;case "effect":l=f[c];break;case "instance-variable":l=f.GetInstanceVariableValue(c);break;case "plugin":l=f.GetPropertyValueByIndex(c)}Array.isArray(h)?(a[0]=h[0],a[1]=h[1],a[2]=h[2]):(d.parseCommaSeparatedRgb(h),a[0]=Math.floor(255*d.getR()),a[1]=Math.floor(255*d.getG()),a[2]=Math.floor(255*d.getB()));Array.isArray(l)?(b[0]=l[0],b[1]=l[1],b[2]=l[2]):(d.parseCommaSeparatedRgb(l),b[0]=Math.floor(255*d.getR()),b[1]=Math.floor(255*d.getG()),b[2]=Math.floor(255*d.getB()));return a[0]!==b[0]||a[1]!==b[1]||a[2]!==b[2]?!0:!1}static Interpolate(c,f,h,g){if(!h){var l=g.GetPropertyTrackDataItem();l=g.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(l);g=l.GetValueWithResultMode();a[0]=g[0];a[1]=g[1];a[2]=g[2];return a}l=g.GetInterpolationMode();"default"===l&&(l="continuous");if("discrete"===l)return g=f.GetValueWithResultMode(),a[0]=g[0],a[1]=g[1],a[2]=g[2],a;if("continuous"===l||"step"===l){"step"===l&&(g=g.GetTimeline().GetStep(),0!==g&&(g=1/g,c=Math.floor(c*g)/g));g=f.GetTime();l=h.GetTime();var m=f.GetValueWithResultMode(),u=h.GetValueWithResultMode();c=e.normalize(c,g,l);var x=f.GetEase();f=m[0];h=m[1];m=m[2];const n=u[0],q=u[1];u=u[2];x=self.Ease.GetRuntimeEase(x);g=l-g;l=g*c;a[0]=f===n?f:x(l,f,n-f,g);a[1]=h===q?h:x(l,h,q-h,g);a[2]=m===u?m:x(l,m,u-m,g);return a}}}}"use strict";self.C3.PropertyTrackState.TextTypeAdapter=class{constructor(){}static WillChange(e,a,b,d){let c;switch(d){case "behavior":c=a.GetPropertyValueByIndex(e);break;case "effect":c=a[e];break;case "instance-variable":c=a.GetInstanceVariableValue(e);break;case "plugin":c=a.GetPropertyValueByIndex(e)}return c===b?!1:!0}static Interpolate(e,a,b,d){return b?a.GetValueWithResultMode():(e=d.GetPropertyTrackDataItem(),e=d.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(e),e.GetValueWithResultMode())}};{"use strict";const e=self.C3;e.TimelineDataManager=class{constructor(){this._timelineDataItems=new Map}Release(){for(const a of this._timelineDataItems.values())a.Release();this._timelineDataItems.clear();this._timelineDataItems=null}Add(a){a=new e.TimelineDataItem(a);const b=a.GetName();this._timelineDataItems.set(b,a)}Get(a){return this._timelineDataItems.get(a)}GetNameId(){return 0}static _CreateDataItems(a,b,d,c){if(b)for(const f of b)e.TimelineDataManager._CreateDataItem("create",f,a,d,c)}static _LoadDataItemsFromJson(a,b,d,c){a.length?b.forEach((f,h)=>{a[h]._LoadFromJson(f)}):b.forEach(f=>{e.TimelineDataManager._CreateDataItem("load",f,a,d,c)})}static _CreateDataItem(a,b,d,c,f){let h;if("function"===typeof c)switch(a){case "load":h=new c(null,f);break;case "create":h=new c(b,f)}else if("object"===typeof c)switch(c=c.map.get(b[c.prop]),a){case "load":h=new c(null,f);break;case "create":h=new c(b,f)}switch(a){case "load":h._LoadFromJson(b);d.push(h);break;case "create":if("function"===typeof h.GetEnable&&!h.GetEnable())return h.Release();d.push(h)}}}}
  {"use strict";const e=self.C3;e.TimelineDataItem=class{constructor(a){this._name="";this._totalTime=NaN;this._step=0;this._resultMode=this._interpolationMode="default";this._pingPong=this._loop=!1;this._repeatCount=1;this._trackData=null;a&&(this._name=a[0],this._totalTime=a[1],this._step=a[2],this._interpolationMode=a[3],this._resultMode=a[4],this._loop=!!a[6],this._pingPong=!!a[7],this._repeatCount=a[8],this._trackData=new e.TrackData(a[5],this))}Release(){this._trackData.Release();this._trackData=null}GetTrackData(){this._trackData||(this._trackData=new e.TrackData(null,this));return this._trackData}GetName(){return this._name}SetName(a){this._name=a}GetTotalTime(){return this._totalTime}SetTotalTime(a){this._totalTime=a}GetStep(){return this._step}SetStep(a){this._step=a}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(a){this._interpolationMode=a}GetResultMode(){return this._resultMode}SetResultMode(a){this._resultMode=a}GetLoop(){return this._loop}SetLoop(a){this._loop=a}GetPingPong(){return this._pingPong}SetPingPong(a){this._pingPong=a}GetRepeatCount(){return this._repeatCount}_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}}_LoadFromJson(a){a&&(this.GetTrackData()._LoadFromJson(a.trackDataJson),this._name=a.name,this._totalTime=a.totalTime,this._step=a.step,this._interpolationMode=a.interpolationMode,this._resultMode=a.resultMode,this._loop=a.loop,this._pingPong=a.pingPong,this._repeatCount=a.repeatCount)}}}
  {"use strict";const e=self.C3;class a{constructor(b,d){this._trackData=d;this._additionalInstanceData=this._instanceData=null;this._objectClassIndex=this._instanceUid=NaN;this._resultMode=this._interpolationMode="default";this._enabled=!1;this._propertyTrackData=this._keyframeData=null;this._id="";this._nestedData=null;this._startOffset=0;this._localTotalTime=this._trackData.GetTimelineDataItem().GetTotalTime();this._type=0;this._name="";b&&(b[0]&&(this._instanceData=b[0],this._instanceUid=b[0][2],this._objectClassIndex=b[0][1]),this._interpolationMode=b[1],this._resultMode=b[2],this._enabled=!!b[3],b[6]&&(this._id=b[6]),b[7]&&(this._nestedData=b[7],this._startOffset=b[7][0],this._localTotalTime=b[7][1]),b[8]&&(this._additionalInstanceData=b[8]),b[8]&&(this._additionalInstanceData=b[8]),b[9]&&(this._type=b[9]),b[10]&&(this._name=b[10]),this._keyframeData=new e.KeyframeData(b[4],this),this._propertyTrackData=new e.PropertyTrackData(b[5],this))}Release(){this._trackData=this._instanceData=null;this._keyframeData&&(this._keyframeData.Release(),this._keyframeData=null);this._propertyTrackData&&(this._propertyTrackData.Release(),this._propertyTrackData=null);this._nestedData=null}GetTrackData(){return this._trackData}GetKeyframeData(){this._keyframeData||(this._keyframeData=new e.KeyframeData(null,this));return this._keyframeData}GetPropertyTrackData(){this._propertyTrackData||(this._propertyTrackData=new e.PropertyTrackData(null,this));return this._propertyTrackData}GetInstanceData(){return this._instanceData}GetObjectClassIndex(){return this._objectClassIndex}SetObjectClassIndex(b){this._objectClassIndex=b}GetInstanceUID(){return this._instanceUid}SetInstanceUID(b){this._instanceUid=b}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(b){this._interpolationMode=b}GetResultMode(){return this._resultMode}SetResultMode(b){this._resultMode=b}GetEnable(){return this._enabled}SetEnable(b){this._enabled=!!b}GetId(){return this._id}GetStartOffset(){return this._startOffset}GetLocalTotalTime(){return this._localTotalTime}SetLocalTotalTime(b){this._localTotalTime=b}GetOriginalWidth(){return this._additionalInstanceData[0]}SetOriginalWidth(b){this._additionalInstanceData||(this._additionalInstanceData=[]);this._additionalInstanceData[0]=b}GetOriginalHeight(){this._additionalInstanceData||(this._additionalInstanceData=[]);return this._additionalInstanceData[1]}SetOriginalHeight(b){this._additionalInstanceData||(this._additionalInstanceData=[]);this._additionalInstanceData[1]=b}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(b){b&&(this._instanceData=b.instanceData,this._instanceUid=b.instanceUid,this._objectClassIndex=b.objectClassIndex,this._interpolationMode=b.interpolationMode,this._resultMode=b.resultMode,this._enabled=b.enabled,this._id=b.id,this._type=b.type?b.type:0,this._type=b.name?b.name:"",this._localTotalTime=this._trackData.GetTimelineDataItem().GetTotalTime(),b.nestedData&&(this._nestedData=b.nestedData,this._startOffset=this._nestedData[0],this._localTotalTime=this._nestedData[1]),b.additionalInstanceData&&(this._additionalInstanceData=b.additionalInstanceData),this.GetKeyframeData()._LoadFromJson(b.keyframeDataJson),this.GetPropertyTrackData()._LoadFromJson(b.propertyTrackDataJson))}}e.TrackData=class{constructor(b,d){this._timelineDataItem=d;this._trackDataItems=[];this._keyframeTimeMap=new Map;e.TimelineDataManager._CreateDataItems(this._trackDataItems,b,a,this)}Release(){this._timelineDataItem=null;for(const b of this._trackDataItems)b.Release();e.clearArray(this._trackDataItems);this._trackDataItems=null;this._keyframeTimeMap.clear();this._keyframeTimeMap=null}GetTimelineDataItem(){return this._timelineDataItem}AddEmptyTrackDataItem(){const b=new a(null,this);this._trackDataItems.push(b);return b}GetFirstKeyframeDataItem(b){return b.GetKeyframeData().GetKeyframeDataItemArray()[0]}GetLastKeyframeDataItem(b){return b.GetKeyframeData().GetKeyframeDataItemArray().at(-1)}GetKeyFrameDataItemAtTime(b,d){const c=this._keyframeTimeMap.get(d);if(c&&c.has(b))return c.get(b);for(const f of d.GetKeyframeData().keyframeDataItems())if(f.GetTime()===b)return c||this._keyframeTimeMap.set(d,new Map),this._keyframeTimeMap.get(d).set(b,f),f}GetFirstKeyFrameDataItemHigherThan(b,d){for(const c of d.GetKeyframeData().keyframeDataItems())if(c.GetTime()>b)return c}GetFirstKeyFrameDataItemHigherOrEqualThan(b,d){for(const c of d.GetKeyframeData().keyframeDataItems())if(c.GetTime()>=b)return c}GetFirstKeyFrameDataItemLowerOrEqualThan(b,d){for(const c of d.GetKeyframeData().keyframeDataItemsReverse())if(c.GetTime()<=b)return c}*trackDataItems(){for(const b of this._trackDataItems)yield b}_SaveToJson(){return{trackDataItemsJson:this._trackDataItems.map(b=>b._SaveToJson())}}_LoadFromJson(b){b&&e.TimelineDataManager._LoadDataItemsFromJson(this._trackDataItems,b.trackDataItemsJson,a,this)}}}
  {"use strict";const e=self.C3;class a{constructor(b,d){this._propertyTrackData=d;this._sourceAdapterId="";this._type=this._property=this._sourceAdapterArguments=null;this._max=this._min=NaN;this._resultMode=this._interpolationMode="default";this._enabled=!1;this._propertyKeyframeData=null;b&&(this._sourceAdapterId=b[0][0],this._sourceAdapterArguments=b[0].slice(1),this._property=b[1],this._type=b[2],this._min=b[3],this._max=b[4],this._interpolationMode=b[5],this._resultMode=b[6],this._enabled=!!b[7],this._propertyKeyframeData=new e.PropertyKeyframeData(b[8],this))}Release(){this._propertyKeyframeData.Release();this._sourceAdapterArguments=this._propertyTrackData=this._propertyKeyframeData=null}GetPropertyTrackData(){return this._propertyTrackData}GetPropertyKeyframeData(){this._propertyKeyframeData||(this._propertyKeyframeData=new e.PropertyKeyframeData(null,this));return this._propertyKeyframeData}GetSourceAdapterId(){return this._sourceAdapterId}SetSourceAdapterId(b){this._sourceAdapterId=b}GetSourceAdapterArguments(){return this._sourceAdapterArguments}SetSourceAdapterArguments(b){this._sourceAdapterArguments=b}GetProperty(){return this._property}SetProperty(b){this._property=b}GetType(){return this._type}SetType(b){this._type=b}GetMin(){return this._min}SetMin(b){this._min=b}GetMax(){return this._max}SetMax(b){this._max=b}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(b){this._interpolationMode=b}GetResultMode(){return this._resultMode}SetResultMode(b){this._resultMode=b}GetEnable(){return this._enabled}SetEnable(b){this._enabled=!!b}_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}}_LoadFromJson(b){b&&(this._sourceAdapterId=b.sourceAdapterId,this._sourceAdapterArguments=b.sourceAdapterArguments,this._property=b.property,this._type=b.type,this._min=b.min,this._max=b.max,this._interpolationMode=b.interpolationMode,this._resultMode=b.resultMode,this._enabled=b.enabled,this.GetPropertyKeyframeData()._LoadFromJson(b.propertyKeyframeDataJson))}}e.PropertyTrackData=class{constructor(b,d){this._trackDataItem=d;this._propertyTrackDataItems=[];this._propertyKeyframeTimeMap=new Map;e.TimelineDataManager._CreateDataItems(this._propertyTrackDataItems,b,a,this)}Release(){this._trackDataItem=null;for(const b of this._propertyTrackDataItems)b.Release();e.clearArray(this._propertyTrackDataItems);this._propertyTrackDataItems=null;this._propertyKeyframeTimeMap.clear();this._propertyKeyframeTimeMap=null}GetTrackDataItem(){return this._trackDataItem}AddEmptyPropertyTrackDataItem(){const b=new a(null,this);this._propertyTrackDataItems.push(b);return b}GetFirstPropertyKeyframeDataItem(b){return b.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray()[0]}GetLastPropertyKeyframeDataItem(b){return b.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray().at(-1)}GetPropertyKeyFrameDataItemAtTime(b,d){const c=this._propertyKeyframeTimeMap.get(d);if(c&&c.has(b))return c.get(b);const f=d.GetPropertyKeyframeData();for(const h of f.propertyKeyframeDataItems())if(h.GetTime()===b)return c||this._propertyKeyframeTimeMap.set(d,new Map),this._propertyKeyframeTimeMap.get(d).set(b,h),h}GetFirstPropertyKeyFrameDataItemHigherThan(b,d){d=d.GetPropertyKeyframeData();for(const c of d.propertyKeyframeDataItems())if(c.GetTime()>b)return c}GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(b,d){d=d.GetPropertyKeyframeData();for(const c of d.propertyKeyframeDataItems())if(c.GetTime()>=b)return c}GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,d){d=d.GetPropertyKeyframeData();for(const c of d.propertyKeyframeDataItemsReverse())if(c.GetTime()<=b)return c}*propertyTrackDataItems(){for(const b of this._propertyTrackDataItems)yield b}_SaveToJson(){return{propertyTrackDataItemsJson:this._propertyTrackDataItems.map(b=>b._SaveToJson())}}_LoadFromJson(b){b&&e.TimelineDataManager._LoadDataItemsFromJson(this._propertyTrackDataItems,b.propertyTrackDataItemsJson,a,this)}}}
  {"use strict";const e=self.C3;class a{constructor(b,d){this._keyframeData=d;this._time=-1;this._ease="noease";this._enable=!1;this._lowerTags=this._tags=null;b&&(this._time=b[0],this._ease=b[1],this._enable=!!b[2],this._tags=(b=b[3])?b.split(" "):[],this._lowerTags=new Set(this._tags.map(c=>c.toLowerCase())))}Release(){this._keyframeData=null;e.clearArray(this._tags);this._tags=null;this._lowerTags.clear();this._lowerTags=null}GetKeyframeData(){return this._keyframeData}GetTime(){return this._time}SetTime(b){this._time=b}GetEase(){return this._ease}SetEase(b){this._ease=b}GetEnable(){return this._enable}SetEnable(b){this._enable=!!b}GetTags(){return this._tags}SetTags(b){this._tags=b?b.split(" "):[];this._lowerTags=new Set(this._tags.map(d=>d.toLowerCase()))}GetLowerTags(){return this._lowerTags}HasTag(b){return this._lowerTags.has(b.toLowerCase())}_SaveToJson(){return{time:this._time,ease:this._ease,enable:this._enable,tags:this._tags}}_LoadFromJson(b){b&&(this._time=b.time,this._ease=b.ease,this._enable=b.enable,this._tags=b.tags,this._lowerTags=new Set(this._tags.map(d=>d.toLowerCase())))}}e.KeyframeData=class{constructor(b,d){this._trackDataItem=d;this._keyframeDataItems=[];e.TimelineDataManager._CreateDataItems(this._keyframeDataItems,b,a,this)}Release(){this._trackDataItem=null;for(const b of this._keyframeDataItems)b.Release();e.clearArray(this._keyframeDataItems);this._keyframeDataItems=null}GetTrackDataItem(){return this._trackDataItem}GetKeyframeDataItemCount(){return this._keyframeDataItems.length}GetKeyframeDataItemArray(){return this._keyframeDataItems}AddEmptyKeyframeDataItem(){const b=new a(null,this);this._keyframeDataItems.push(b);return b}DeleteKeyframeDataItems(b){for(const d of this._keyframeDataItems){if(!b(d))continue;const c=this._keyframeDataItems.indexOf(d);-1!==c&&(d.Release(),this._keyframeDataItems.splice(c,1))}this.SortKeyframeDataItems()}SortKeyframeDataItems(){this._keyframeDataItems.sort((b,d)=>b.GetTime()-d.GetTime())}GetKeyframeDataItemIndex(b){return this._keyframeDataItems.indexOf(b)}GetKeyframeDataItemFromIndex(b){return this._keyframeDataItems[b]}*keyframeDataItems(){for(const b of this._keyframeDataItems)yield b}*keyframeDataItemsReverse(){for(let b=this._keyframeDataItems.length-1;0<=b;b--)yield this._keyframeDataItems[b]}_SaveToJson(){return{keyframeDataItemsJson:this._keyframeDataItems.map(b=>b._SaveToJson())}}_LoadFromJson(b){b&&e.TimelineDataManager._LoadDataItemsFromJson(this._keyframeDataItems,b.keyframeDataItemsJson,a,this)}}}
  {"use strict";const e=self.C3;class a{constructor(b,d){this._propertyKeyframeData=d;this._aValue=this._value=null;this._type="";this._time=NaN;this._ease="noease";this._enable=!1;this._addonData=null;b&&(this._value=b[0][0],this._aValue=b[0][1],this._type=b[0][2],this._time=b[1],this._ease=b[2],this._enable=!!b[3],this._addonData=null,b[4]&&(this._addonData=new e.AddonData(b[4],this)))}Release(){this._propertyKeyframeData=null;this._addonData&&(this._addonData.Release(),this._addonData=null)}GetAddonData(){return this._addonData}GetValue(){return this._value}SetValue(b){"color"===this._type&&e.IsFiniteNumber(b)?(this._value[0]=e.GetRValue(b),this._value[1]=e.GetGValue(b),this._value[2]=e.GetBValue(b)):this._value=b}GetAbsoluteValue(){return this._aValue}SetAbsoluteValue(b){"color"===this._type&&e.IsFiniteNumber(b)?(this._aValue[0]=e.GetRValue(b),this._aValue[1]=e.GetGValue(b),this._aValue[2]=e.GetBValue(b)):this._aValue=b}GetValueWithResultMode(){const b=this._propertyKeyframeData.GetPropertyTrackDataItem().GetResultMode();if("relative"===b)return this.GetValue();if("absolute"===b)return this.GetAbsoluteValue()}GetType(){return this._type}SetType(b){this._type=b}GetTime(){return this._time}SetTime(b){this._time=b}GetEase(){return this._ease}SetEase(b){this._ease=b}GetEnable(){return this._enable}SetEnable(b){this._enable=!!b}GetAddOn(b){if(this.GetAddonData())for(const d of this.GetAddonData().addonDataItems())if(d.GetId()===b)return d}_SaveToJson(){const b=this._addonData;return{addonDataJson:b?b._SaveToJson():b,value:this._value,aValue:this._aValue,type:this._type,time:this._time,ease:this._ease,enable:this._enable}}_LoadFromJson(b){b&&(b.addonDataJson&&this._addonData._SetFromJson(b.addonDataJson),this._value=b.value,this._aValue=b.aValue,this._type=b.type,this._time=b.time,this._ease=b.ease,this._enable=b.enable)}}e.PropertyKeyframeData=class{constructor(b,d){this._propertyTrackDataItem=d;this._propertyKeyframeDataItems=[];e.TimelineDataManager._CreateDataItems(this._propertyKeyframeDataItems,b,a,this)}Release(){this._propertyTrackDataItem=null;for(const b of this._propertyKeyframeDataItems)b.Release();e.clearArray(this._propertyKeyframeDataItems);this._propertyKeyframeDataItems=null}AddEmptyPropertyKeyframeDataItem(){const b=new a(null,this);this._propertyKeyframeDataItems.push(b);return b}DeletePropertyKeyframeDataItems(b){for(const d of this._propertyKeyframeDataItems){if(!b(d))continue;const c=this._propertyKeyframeDataItems.indexOf(d);-1!==c&&(d.Release(),this._propertyKeyframeDataItems.splice(c,1))}this.SortPropertyKeyFrameDataItems()}SortPropertyKeyFrameDataItems(){this._propertyKeyframeDataItems.sort((b,d)=>b.GetTime()-d.GetTime())}GetPropertyTrackDataItem(){return this._propertyTrackDataItem}GetPropertyKeyframeDataItemCount(){return this._propertyKeyframeDataItems.length}GetPropertyKeyframeDataItemArray(){return this._propertyKeyframeDataItems}*propertyKeyframeDataItems(){for(const b of this._propertyKeyframeDataItems)yield b}*propertyKeyframeDataItemsReverse(){for(let b=this._propertyKeyframeDataItems.length-1;0<=b;b--)yield this._propertyKeyframeDataItems[b]}_SaveToJson(){return{propertyKeyframeDataItemsJson:this._propertyKeyframeDataItems.map(b=>b._SaveToJson())}}_LoadFromJson(b){b&&e.TimelineDataManager._LoadDataItemsFromJson(this._propertyKeyframeDataItems,b.propertyKeyframeDataItemsJson,a,this)}}}
  {"use strict";const e=self.C3;class a{constructor(c,f){this._addonData=f;this._id=c[0];this._data=c[1]}Release(){this._data=this._addonData=null}GetAddonData(){return this._addonData}GetId(){return this._id}_SaveToJson(){return{id:this._id,data:this._data}}_LoadFromJson(c){c&&(this._id=c.id,this._data=c.data)}}class b extends a{constructor(c,f){super(c,f);this._startAnchor=this._data[0];this._startEnable=!!this._data[1];this._endAnchor=this._data[2];this._endEnable=!!this._data[3]}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(c){c&&(super._LoadFromJson(c),this._startAnchor=c.startAnchor,this._startEnable=!!c.startEnable,this._endAnchor=c.endAnchor,this._endEnable=!!c.endEnable)}}class d extends a{constructor(c,f){super(c,f);this._direction=this._data[0];this._revolutions=this._data[1]}Release(){super.Release()}GetDirection(){return this._direction}GetRevolutions(){return this._revolutions}_SaveToJson(){return Object.assign(super._SaveToJson(),{direction:this._direction,revolutions:this._revolutions})}_LoadFromJson(c){c&&(super._LoadFromJson(c),this._direction=c.direction,this._revolutions=c.revolutions)}}e.AddonData=class{constructor(c,f){this._propertyKeyframeDataItem=f;this._addonDataItems=[];e.TimelineDataManager._CreateDataItems(this._addonDataItems,c,{prop:0,map:new Map([["cubic-bezier",b],["angle",d]])},this)}Release(){this._propertyKeyframeDataItem=null;for(const c of this._addonDataItems)c.Release();e.clearArray(this._addonDataItems);this._addonDataItems=null}GetPropertyKeyframeDataItem(){return this._propertyKeyframeDataItem}*addonDataItems(){for(const c of this._addonDataItems)yield c}_SaveToJson(){return{addonDataItemsJson:this._addonDataItems.map(c=>c._SaveToJson())}}_LoadFromJson(c){c&&e.TimelineDataManager._LoadDataItemsFromJson(this._addonDataItems,c.addonDataItemsJson,{prop:"id",map:new Map([["cubic-bezier",b],["angle",d]])},this)}}}
  {"use strict";const e=self.C3;let a=0;e.Tween=class extends e.TimelineState{constructor(b,d){super(`tween-${a++}`,b,d);this._id="";this._destroyInstanceOnComplete=!1;this._initialValueMode="start-value";this._on_started_callbacks=this._on_completed_callbacks=null}GetInstance(){var b=this.GetTracks();if(b&&b.length&&(b=b[0])){var d=b.GetInstance();return b.IsInstanceValid()?d:null}}AddStartedCallback(b){this._on_started_callbacks||(this._on_started_callbacks=[]);this._on_started_callbacks.push(b)}AddCompletedCallback(b){this._on_completed_callbacks||(this._on_completed_callbacks=[]);this._on_completed_callbacks.push(b)}RemoveStartedCallback(b){this._on_started_callbacks&&(b=this._on_started_callbacks.indexOf(b),-1!==b&&this._on_started_callbacks.splice(b,1))}RemoveCompletedCallback(b){this._on_completed_callbacks&&(b=this._on_completed_callbacks.indexOf(b),-1!==b&&this._on_completed_callbacks.splice(b,1))}SetStartValue(b,d){for(const f of this._tracks)for(const h of f._propertyTracks){if(h.GetPropertyName()!==d)continue;var c=h.GetPropertyTrackData();const g=h.GetPropertyTrackDataItem();c=c.GetFirstPropertyKeyframeDataItem(g);c.SetValue(b);c.SetAbsoluteValue(b)}}_GetPropertyTrackState(b){for(const d of this._tracks)for(const c of d._propertyTracks)if(c.GetPropertyName()===b)return c}BeforeSetEndValues(b){for(const f of b)b=this._GetPropertyTrackState(f),this.SetStartValue(b.GetCurrentState(),f);if(this.IsForwardPlayBack()){var d=this.GetTotalTime()-this.GetTime();this.SetTotalTime(d);for(var c of this._tracks)c.SetLocalTotalTime(d);this._SetTime(0)}else{c=this.GetTime();this.SetTotalTime(c);for(d of this._tracks)d.SetLocalTotalTime(c);this._SetTime(c)}this.SetInitialStateFromSetTime()}SetEndValue(b,d){var c=this._GetPropertyTrackState(d);d=c.GetPropertyTrackData();c=c.GetPropertyTrackDataItem();d=d.GetLastPropertyKeyframeDataItem(c);d.SetTime(this.GetTotalTime());d.SetValue(b);d.SetAbsoluteValue(b)}SetId(b){this._id=b}GetId(){return this._id}SetInitialValueMode(b){this._initialValueMode=b}GetInitialValueMode(){return this._initialValueMode}SetDestroyInstanceOnComplete(b){this._destroyInstanceOnComplete=b}GetDestroyInstanceOnComplete(){return this._destroyInstanceOnComplete}OnStarted(){if(this._on_started_callbacks)for(const b of this._on_started_callbacks)b(this);if(!this.IsComplete())for(const b of this._tracks)b.CompareSaveStateWithCurrent()}OnCompleted(){this._completedTick=this._runtime.GetTickCount()}FinishTriggers(){if(!this._finishedTriggers&&(this._finishedTriggers=!0,this._on_completed_callbacks))for(const b of this._on_completed_callbacks)b(this)}SetTime(b){this._DeleteIntermediateKeyframes();super.SetTime(b)}SetInitialState(b){if(!this.InitialStateSet()&&"current-state"===this.GetInitialValueMode())for(const d of this._tracks)d.CompareInitialStateWithCurrent();super.SetInitialState(b)}Stop(b=!1){super.Stop(b);if(!this.IsComplete())for(const d of this._tracks)d.SaveState()}Reset(b=!0,d=!1){this._DeleteIntermediateKeyframes();super.Reset(b,d)}_DeleteIntermediateKeyframes(){for(const b of this._tracks){const d=c=>{c=c.GetTime();const f=this.GetTotalTime();return 0!==c&&c!==f};b.DeleteKeyframes(d);b.DeletePropertyKeyframes(d)}}_OnBeforeChangeLayout(){if(this.IsReleased())return!0;const b=this.GetInstance();if(b&&b.GetObjectClass().IsGlobal())return!1;this._timelineManager.CompleteTimeline(this);this.ResetBeforeChangeLayout();return!0}MaybeTriggerKeyframeReachedConditions(){}Tick(b,d){b=this.GetInstance();b=this.GetRuntime().GetDt(b);super.Tick(b,1)}_SaveToJson(){const b=super._SaveToJson(),d=this.GetTimelineDataItem();return Object.assign(b,{tweenDataItemJson:d._SaveToJson(),id:this._id,destroyInstanceOnComplete:this._destroyInstanceOnComplete,initialValueMode:this._initialValueMode})}_LoadFromJson(b){b&&(this.GetTimelineDataItem()._LoadFromJson(b.tweenDataItemJson),super._LoadFromJson(b),this._id=b.id,this._destroyInstanceOnComplete=b.destroyInstanceOnComplete,this._initialValueMode=b.initialValueMode)}static IsPlaying(b){return b.IsPlaying()}static IsPaused(b){return b.IsPaused()}static Build(b){var d=b.runtime.GetTimelineManager(),c=new e.TimelineDataItem;if(b.json){c._LoadFromJson(b.json.tweenDataItemJson);var f=new e.Tween(c,d);f._LoadFromJson(b.json);return f}d=new e.Tween(c,d);e.IsArray(b.propertyTracksConfig)||(b.propertyTracksConfig=[b.propertyTracksConfig]);d.SetId(b.id);d.SetTags(b.tags);d.SetInitialValueMode(b.initialValueMode);d.SetDestroyInstanceOnComplete(b.releaseOnComplete);d.SetLoop(b.loop);d.SetPingPong(b.pingPong);d.SetTotalTime(b.time);d.SetStep(0);d.SetInterpolationMode("default");d.SetResultMode(b.propertyTracksConfig[0].resultMode);c=d.AddTrack();c.SetInstanceUID(b.instance.GetUID());c.SetInterpolationMode("default");c.SetResultMode(b.propertyTracksConfig[0].resultMode);c.SetEnable(!0);c.SetObjectClassIndex(b.instance.GetObjectClass().GetIndex());var h=b.instance.GetSdkInstance(),g=h.IsOriginalSizeKnown()?h.GetOriginalWidth():b.instance.GetWorldInfo().GetWidth();h=h.IsOriginalSizeKnown()?h.GetOriginalHeight():b.instance.GetWorldInfo().GetHeight();c.SetOriginalWidth(g);c.SetOriginalHeight(h);g=c.AddKeyframe();g.SetTime(0);g.SetEase("noease");g.SetEnable(!0);g.SetTags("");g=c.AddKeyframe();g.SetTime(b.time);g.SetEase("noease");g.SetEnable(!0);g.SetTags("");for(f of b.propertyTracksConfig)g=c.AddPropertyTrack(),g.SetSourceAdapterId(f.sourceId),g.SetSourceAdapterArgs(f.sourceArgs),g.SetPropertyName(f.property),g.SetPropertyType(f.type),g.SetMin(NaN),g.SetMax(NaN),g.SetInterpolationMode("default"),g.SetResultMode(f.resultMode),g.SetEnable(!0),h=g.AddPropertyKeyframe(),h.SetType(f.valueType),h.SetTime(0),h.SetEase(f.ease),h.SetEnable(!0),h.SetValue(f.startValue),h.SetAbsoluteValue(f.startValue),g=g.AddPropertyKeyframe(),g.SetType(f.valueType),g.SetTime(b.time),g.SetEase(f.ease),g.SetEnable(!0),g.SetValue(f.endValue),g.SetAbsoluteValue(f.endValue);return d}}}
  {"use strict";const e=self.C3,a=self.Ease;e.Transition=class extends e.DefendedBase{constructor(b){super();this._name=b[0];this._transitionKeyframes=[];for(const d of b[1])b=e.TransitionKeyframe.Create(this,d),this._transitionKeyframes.push(b);this._precalculatedSamples=new Map;this._transitionKeyframeCache=new Map;this._PreCalcSamples();a.AddCustomEase(this._name,(d,c,f,h)=>this.Interpolate(d,c,f,h))}static Create(b){return e.New(e.Transition,b)}Release(){for(const b of this._transitionKeyframes)b.Release();e.clearArray(this._transitionKeyframes);this._transitionKeyframes=null;this._precalculatedSamples.clear();this._precalculatedSamples=null;this._transitionKeyframeCache.clear();this._transitionKeyframeCache=null}GetTransitionKeyFrameAt(b){const d=this._transitionKeyframeCache.get(b);if(d)return d;for(const c of this._transitionKeyframes)if(c.GetValueX()===b)return this._transitionKeyframeCache.set(b,c),c}GetFirstTransitionKeyFrameHigherThan(b){for(const d of this._transitionKeyframes)if(d.GetValueX()>b)return d}GetFirstTransitionKeyFrameHigherOrEqualThan(b){for(const d of this._transitionKeyframes)if(d.GetValueX()>=b)return d}GetFirstTransitionKeyFrameLowerOrEqualThan(b){for(let d=this._transitionKeyframes.length-1;0<=d;d--){const c=this._transitionKeyframes[d];if(c.GetValueX()<=b)return c}}Interpolate(b,d,c,f){var h=b/f;(b=this.GetTransitionKeyFrameAt(h))?f=this.GetFirstTransitionKeyFrameHigherThan(h):(b=this.GetFirstTransitionKeyFrameLowerOrEqualThan(h),f=this.GetFirstTransitionKeyFrameHigherOrEqualThan(h));var g=f.GetValueX()-b.GetValueX();h=e.mapToRange(h,b.GetValueX(),f.GetValueX(),0,g);g=b.GetValueX();const l=b.GetValueY(),m=b.GetValueX()+b.GetStartAnchorX(),u=b.GetValueY()+b.GetStartAnchorY(),x=f.GetValueX()+f.GetEndAnchorX(),n=f.GetValueY()+f.GetEndAnchorY(),q=f.GetValueX();f=f.GetValueY();f=a.GetRuntimeEase("spline")(h,g,l,m,u,x,n,q,f,this._precalculatedSamples.get(b));f+=b.GetValueY();return(1-f)*d+f*(d+c)}_PreCalcSamples(){this._precalculatedSamples.clear();for(let c=0;c<this._transitionKeyframes.length-
  1;c++){var b=this._transitionKeyframes[c];if(!b.GetStartEnable())continue;var d=this._transitionKeyframes[c+1];const f=b.GetValueX(),h=b.GetValueX()+b.GetStartAnchorX(),g=d.GetValueX()+d.GetEndAnchorX();d=d.GetValueX();this._precalculatedSamples.set(b,a.GetBezierSamples(f,h,g,d))}}}}
  {"use strict";const e=self.C3;e.TransitionKeyframe=class extends e.DefendedBase{constructor(a,b){super();this._transition=a;this._valueX=b[0];this._valueY=b[1];this._startAnchorX=b[2];this._startAnchorY=b[3];this._endAnchorX=b[4];this._endAnchorY=b[5];this._startEnable=b[6];this._endEnable=b[7]}Release(){this._transition=null}static Create(a,b){return e.New(e.TransitionKeyframe,a,b)}GetValueX(){return this._valueX}GetValueY(){return this._valueY}GetStartAnchorX(){return this._startAnchorX}GetStartAnchorY(){return this._startAnchorY}GetEndAnchorX(){return this._endAnchorX}GetEndAnchorY(){return this._endAnchorY}GetStartEnable(){return this._startEnable}GetEndEnable(){return this._endEnable}}}
  {"use strict";const e=self.C3;e.TransitionManager=class extends e.DefendedBase{constructor(a){super();this._runtime=a;this._transitions=[]}Release(){for(const a of this._transitions)a.Release();e.clearArray(this._transitions);this._transitions=null}Create(a){this._transitions.push(e.Transition.Create(a))}}}
  {"use strict";const e=self.C3;e.SolStack=class extends e.DefendedBase{constructor(a){super();this._objectClass=a;this._stack=[];this._stack.push(e.New(e.Sol,this));this._index=0;this._current=this._stack[0]}Release(){for(const a of this._stack)a.Release();e.clearArray(this._stack);this._objectClass=this._current=null}GetObjectClass(){return this._objectClass}GetCurrentSol(){return this._current}Clear(){this.GetCurrentSol().Clear()}PushClean(){var a=this._stack,b=++this._index;b===a.length?(b=e.New(e.Sol,this),a.push(b),this._current=b):(a=a[b],a.Reset(),this._current=a)}PushCopy(){const a=this._stack,b=++this._index;b===a.length&&a.push(e.New(e.Sol,this));const d=a[b];d.Copy(a[b-1]);this._current=d}Pop(){this._current=this._stack[--this._index]}RemoveInstances(a){const b=this._stack;for(let d=0,c=b.length;d<c;++d)b[d].RemoveInstances(a)}}}
  {"use strict";const e=self.C3;e.Sol=class extends e.DefendedBase{constructor(a){super();this._stack=a;this._objectClass=this._stack.GetObjectClass();this._eventStack=this._objectClass.GetRuntime().GetEventStack();this._selectAll=!0;this._instances=[];this._elseInstances=[]}Release(){this.ClearArrays();this._eventStack=this._objectClass=this._stack=null}ClearArrays(){e.clearArray(this._instances);e.clearArray(this._elseInstances)}GetObjectClass(){return this._objectClass}IsSelectAll(){return this._selectAll}HasAnyInstances(){return this._selectAll?!!this._objectClass.GetInstanceCount():!!this._instances.length}GetInstances(){return this._selectAll?this._objectClass.GetInstances():this._instances}HasAnyElseInstances(){return!!this._elseInstances.length}GetElseInstances(){return this._elseInstances}GetExpressionInstances(){const a=this.GetInstances();return a.length?a:this._elseInstances}Reset(){this._selectAll=!0;e.clearArray(this._elseInstances)}Clear(){this._selectAll=!0}Copy(a){a.IsSelectAll()?this.Reset():(this._selectAll=!1,e.shallowAssignArray(this._instances,a._instances),e.clearArray(this._elseInstances))}_PushInstance(a){this._instances.push(a)}_PushElseInstance(a){this._elseInstances.push(a)}_SetSelectAll(a){this._selectAll=!!a}_GetOwnInstances(){return this._instances}_GetOwnElseInstances(){return this._elseInstances}SetSinglePicked(a){this._selectAll=!1;e.clearArray(this._instances);this._instances.push(a)}SetArrayPicked(a){this._selectAll=!1;e.shallowAssignArray(this._instances,a)}SetSetPicked(a){this._selectAll=!1;e.clearArray(this._instances);for(const b of a)this._instances.push(b)}AddElseInstances(a,b){for(const d of b)a.has(d)||this._elseInstances.push(d)}TransferElseInstancesToOwn(a){for(const b of a)this._instances.push(b);e.arrayRemoveAllInSet(this._elseInstances,a)}PickOne(a){a&&(this._eventStack.GetCurrentStackFrame().GetCurrentEvent().IsOrBlock()?(this.IsSelectAll()&&(e.clearArray(this._instances),e.shallowAssignArray(this._elseInstances,a.GetObjectClass().GetInstances()),this._selectAll=!1),a=this._elseInstances.indexOf(a),-1!==a&&(this._instances.push(this._elseInstances[a]),this._elseInstances.splice(a,1))):this.SetSinglePicked(a))}RemoveInstances(a){e.arrayRemoveAllInSet(this._instances,a);e.arrayRemoveAllInSet(this._elseInstances,a)}}}
  {"use strict";const e=self.C3;e.EventStack=class extends e.DefendedBase{constructor(a){super();this._eventSheetManager=a;this._runtime=this._eventSheetManager.GetRuntime();this._stack=[];this._stack.push(e.New(e.EventStackFrame,this,null));this._index=0;this._expFuncStack=[]}Release(){for(const a of this._stack)a.Release();e.clearArray(this._stack);e.clearArray(this._expFuncStack);this._runtime=this._eventSheetManager=null}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}GetCurrentStackFrame(){return this._stack[this._index]}Push(a){var b=this._stack;const d=++this._index;if(d===b.length)return a=e.New(e.EventStackFrame,this,a),b.push(a),a;b=b[d];b.Reset(a);return b}Pop(){--this._index}PushExpFunc(a){this._expFuncStack.push(a)}PopExpFunc(){this._expFuncStack.pop()}GetCurrentExpFuncStackFrame(){const a=this._expFuncStack;return 0===a.length?null:a.at(-1)}}}
  {"use strict";const e=self.C3;e.EventStackFrame=class extends e.DefendedBase{constructor(a,b){super();this._stack=a;this._runtime=this._stack.GetRuntime();this._currentEvent=b;this._actIndex=this._cndIndex=0;this._elseBranchRan=this._lastEventTrue=!1;this._expressionObjectClass=null;this._functionReturnValue=this._functionReturnType=0}Release(){this.Reset(null);this._runtime=this._stack=null}Reset(a){this._currentEvent=a;this._actIndex=this._cndIndex=0;this._elseBranchRan=this._lastEventTrue=!1}_Restore(a,b){this._currentEvent=a;this._cndIndex=0;this._actIndex=b}ResetQuick(){this._actIndex=this._cndIndex=0}GetCurrentEvent(){return this._currentEvent}SetCurrentEvent(a){this._currentEvent=a}GetConditionIndex(){return this._cndIndex}SetConditionIndex(a){this._cndIndex=a}GetActionIndex(){return this._actIndex}SetActionIndex(a){this._actIndex=a}SetLastEventTrue(a){this._lastEventTrue=!!a}GetLastEventTrue(){return this._lastEventTrue}SetElseBranchRan(a){this._elseBranchRan=!!a}GetElseBranchRan(){return this._elseBranchRan}SetExpressionObjectClass(a){this._expressionObjectClass=a}GetExpressionObjectClass(){return this._expressionObjectClass}InitCallFunctionExpression(a,b){this._functionReturnType=a;this._functionReturnValue=b}GetFunctionReturnType(){return this._functionReturnType}SetFunctionReturnValue(a){this._functionReturnValue=a}GetFunctionReturnValue(){return this._functionReturnValue}IsSolModifierAfterCnds(){const a=this._currentEvent;return a.IsSolWriterAfterCnds()?!0:this._cndIndex<a.GetConditionCount()-1?!!a.GetSolModifiers().length:!1}}}
  {"use strict";const e=self.C3;e.LocalVarStack=class extends e.DefendedBase{constructor(a){super();this._eventSheetManager=a;this._runtime=this._eventSheetManager.GetRuntime();this._stack=[];this._index=-1;this._current=null;this._initialValues=[]}Release(){e.clearArray(this._stack);this._runtime=this._eventSheetManager=null}_SetInitialValues(a){this._initialValues=a;a=this._initialValues.slice(0);this._stack.push(a);this._index=0;this._current=a}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}GetCurrent(){return this._current}Push(){const a=++this._index,b=this._stack;a===b.length?b.push(this._initialValues.slice(0)):e.shallowAssignArray(b[a],this._initialValues);this._current=b[a]}Pop(){this._current=this._stack[--this._index]}}}
  {"use strict";const e=self.C3;e.LoopStack=class extends e.DefendedBase{constructor(a){super();this._eventSheetManager=a;this._runtime=this._eventSheetManager.GetRuntime();this._stack=[];this._index=-1}Release(){e.clearArray(this._stack);this._runtime=this._eventSheetManager=null}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}IsInLoop(){return 0<=this._index}GetCurrent(){return this._stack[this._index]}Push(){++this._index;if(this._index===this._stack.length){var a=e.New(e.Loop,this);this._stack.push(a);return a}a=this._stack[this._index];a.Reset();return a}Pop(){--this._index}FindByName(a){const b=this._stack;for(let d=this._index;0<=d;--d){const c=b[d];if(c.GetName()===a)return c}return null}_GetStack(){return this._stack.slice(0,this._index+1)}}}
  {"use strict";const e=self.C3;e.Loop=class extends e.DefendedBase{constructor(a){super();this._loopStack=a;this._name="";this._index=0;this._isStopped=!1;this._end=NaN}Reset(){this._name="";this._index=0;this._isStopped=!1;this._end=NaN}SetName(a){this._name=a}GetName(){return this._name}SetIndex(a){this._index=a}GetIndex(){return this._index}Stop(){this._isStopped=!0}IsStopped(){return this._isStopped}SetEnd(a){this._end=a}GetEnd(){return this._end}}}
  {"use strict";const e=self.C3;e.ArrayStack=class extends e.DefendedBase{constructor(){super();this._stack=[];this._index=-1}Release(){e.clearArray(this._stack)}GetCurrent(){return this._stack[this._index]}Push(){++this._index;if(this._index===this._stack.length){const a=[];this._stack.push(a);return a}return this._stack[this._index]}Pop(){--this._index}}}
  {"use strict";const e=self.C3;function a(d,c){return d.GetIndex()-c.GetIndex()}function b(d,c){for(let f=0,h=d.length;f<h;++f)if(d[f]!==c[f])return!1;return!0}e.EventSheetManager=class extends e.DefendedBase{constructor(d){super();this._runtime=d;this._allSheets=[];this._sheetsByName=new Map;this._allGroups=[];this._groupsByName=new Map;this._blocksBySid=new Map;this._cndsBySid=new Map;this._actsBySid=new Map;this._allUniqueSolModifiers=new Map;this._eventVarsBySid=new Map;this._nextLocalVarIndex=0;this._allGlobalVars=[];this._allLocalVars=[];this._localVarInitialValues=[];this._functionBlocksByName=new Map;this._eventStack=e.New(e.EventStack,this);this._localVarStack=e.New(e.LocalVarStack,this);this._loopStack=e.New(e.LoopStack,this);this._triggersToPostInit=[];this._queuedTriggers=[];this._queuedDebugTriggers=[];this._blockFlushingDepth=this._executingTriggerDepth=this._runningEventsDepth=0;this._scheduledWaits=[];this._asyncActionPromises=[];self.c3_callFunction=(c,f)=>this._InvokeFunctionFromJS(c,f)}Release(){this.ClearAllScheduledWaits();this._eventStack.Release();this._eventStack=null;this._localVarStack.Release();this._localVarStack=null;e.clearArray(this._queuedTriggers);e.clearArray(this._queuedDebugTriggers);this._runtime=null;e.clearArray(this._allSheets);this._sheetsByName.clear()}Create(d){d=e.New(e.EventSheet,this,d);this._allSheets.push(d);this._sheetsByName.set(d.GetName().toLowerCase(),d)}_AddTriggerToPostInit(d){this._triggersToPostInit.push(d)}_PostInit(){for(const d of this._functionBlocksByName.values())d._PostInit(!1);for(const d of this._allSheets)d._PostInit();for(const d of this._allSheets)d._UpdateDeepIncludes();for(const d of this._triggersToPostInit)d._PostInit(!1);e.clearArray(this._triggersToPostInit);this._localVarStack._SetInitialValues(this._localVarInitialValues)}GetRuntime(){return this._runtime}GetEventSheetByName(d){return this._sheetsByName.get(d.toLowerCase())||null}_RegisterGroup(d){this._allGroups.push(d);this._groupsByName.set(d.GetGroupName(),d)}_RegisterEventBlock(d){this._blocksBySid.set(d.GetSID(),d)}_RegisterCondition(d){this._cndsBySid.set(d.GetSID(),d)}_RegisterAction(d){this._actsBySid.set(d.GetSID(),d)}_RegisterFunctionBlock(d){this._functionBlocksByName.set(d.GetFunctionName().toLowerCase(),d)}_RegisterEventVariable(d){this._eventVarsBySid.set(d.GetSID(),d);d.IsGlobal()?this._allGlobalVars.push(d):this._allLocalVars.push(d)}_DeduplicateSolModifierList(d){2<=d.length&&d.sort(a);let c=this._allUniqueSolModifiers.get(d.length);c||(c=[],this._allUniqueSolModifiers.set(d.length,c));for(let f=0,h=c.length;f<h;++f){const g=c[f];if(b(d,g))return g}c.push(d);return d}_GetNextLocalVarIndex(d){this._localVarInitialValues.push(d.GetInitialValue());return this._nextLocalVarIndex++}GetEventStack(){return this._eventStack}GetCurrentEventStackFrame(){return this.GetEventStack().GetCurrentStackFrame()}GetCurrentEvent(){return this.GetCurrentEventStackFrame().GetCurrentEvent()}GetCurrentCondition(){const d=this.GetCurrentEventStackFrame();return d.GetCurrentEvent().GetConditionAt(d.GetConditionIndex())}GetCurrentAction(){const d=this.GetCurrentEventStackFrame();return d.GetCurrentEvent().GetActionAt(d.GetActionIndex())}GetLocalVarStack(){return this._localVarStack}GetLoopStack(){return this._loopStack}GetAllLocalVariablesInScope(d){const c=[];for(d=d.GetScopeParent();d;)e.appendArray(c,d._GetAllLocalVariablesInScope()),d=d.GetScopeParent();return c}_GetLocalVariablesScriptInterface(d){const c={};for(const f of this.GetAllLocalVariablesInScope(d))c[f.GetJsPropName()]=f._GetScriptInterfaceDescriptor();return Object.create(Object.prototype,c)}GetEventVariableBySID(d){return this._eventVarsBySid.get(d)||null}GetEventBlockBySID(d){return this._blocksBySid.get(d)||null}GetConditionBySID(d){return this._cndsBySid.get(d)||null}GetActionBySID(d){return this._actsBySid.get(d)||null}GetFunctionBlockByName(d){return this._functionBlocksByName.get(d.toLowerCase())||null}GetAllGlobalVariables(){return this._allGlobalVars}GetAllLocalVariables(){return this._allLocalVars}ResetAllGlobalsToInitialValue(){for(const d of this._allGlobalVars)d.ResetToInitialValue()}GetEventGroupByName(d){return this._groupsByName.get(d.toLowerCase())||null}GetEventGroupBySID(d){return(d=this._blocksBySid.get(d))&&d.IsGroup()?d:null}GetAllGroups(){return this._allGroups}ResetAllGroupsInitialActivation(){for(const d of this._allGroups)d.ResetInitialActivation()}_ResetAllHasRunFlags(){for(const d of this._allSheets)d._ResetHasRunFlag()}RunEvents(d){this._ResetAllHasRunFlags();this._runningEventsDepth++;for(const c of d.runningLayouts())if(d=c.GetEventSheet())this._runtime.PushCurrentLayout(c),d.Run(),this._runtime.PopCurrentLayout();this._runningEventsDepth--}async DebugRunEvents(d){this._ResetAllHasRunFlags();this._runningEventsDepth++;for(const c of this._DebugRunEventsGen(d))await this._runtime.DebugBreak(c);this._runningEventsDepth--}*_DebugRunEventsGen(d){for(const c of d.runningLayouts())if(d=c.GetEventSheet())this._runtime.PushCurrentLayout(c),yield*d.DebugRun(),this._runtime.PopCurrentLayout()}_Trigger(d,c,f,h){let g=!1;if(!d.GetMainRunningLayout())return this.QueueTrigger(c,f,h);this._executingTriggerDepth++;for(const l of d.runningLayouts())if(d=l.GetEventSheet()){this._runtime.PushCurrentLayout(l);for(const m of d.deepIncludes()){const u=m._Trigger(c,f,h);g=g||u}d=d._Trigger(c,f,h);g=g||d;this._runtime.PopCurrentLayout()}this._executingTriggerDepth--;return g}*_DebugTrigger(d,c,f,h){let g=!1;if(!d.GetMainRunningLayout())return this.QueueTrigger(c,f,h);this._executingTriggerDepth++;for(const l of d.runningLayouts())if(d=l.GetEventSheet()){this._runtime.PushCurrentLayout(l);for(const m of d.deepIncludes()){const u=yield*m._DebugTrigger(c,f,h);g=g||u}d=yield*d._DebugTrigger(c,f,h);g=g||d;this._runtime.PopCurrentLayout()}this._executingTriggerDepth--;return g}QueueTrigger(d,c,f){this._queuedTriggers.push([d,c,f]);return!1}QueueDebugTrigger(d,c,f){let h=null;const g=new Promise(l=>h=l);this._queuedDebugTriggers.push([d,c,f,h]);return g}*_RunQueuedDebugTriggersGen(){if(this._runtime.HitBreakpoint())throw Error("should not be in breakpoint");const d=this._runtime.GetLayoutManager();for(;this._queuedDebugTriggers.length;){const[c,f,h,g]=this._queuedDebugTriggers.shift(),l=yield*this._DebugTrigger(d,c,f,h);g(l)}}async RunQueuedDebugTriggersAsync(){for(const d of this._RunQueuedDebugTriggersGen())await this._runtime.DebugBreak(d)}_FastTrigger(d,c,f,h){let g=!1;var l=d.GetMainRunningLayout();if(d=l.GetEventSheet()){this._executingTriggerDepth++;this._runtime.PushCurrentLayout(l);l=d.deepIncludes();for(let m=0,u=l.length;m<u;++m){const x=l[m]._FastTrigger(c,f,h);g=g||x}c=d._FastTrigger(c,f,h);g=g||c;this._runtime.PopCurrentLayout();this._executingTriggerDepth--;return g}}*_DebugFastTrigger(d,c,f,h){let g=!1;var l=d.GetMainRunningLayout();if(d=l.GetEventSheet()){this._executingTriggerDepth++;this._runtime.PushCurrentLayout(l);l=d.deepIncludes();for(let m=0,u=l.length;m<u;++m){const x=yield*l[m]._DebugFastTrigger(c,f,h);g=g||x}c=yield*d._DebugFastTrigger(c,f,h);g=g||c;this._runtime.PopCurrentLayout();this._executingTriggerDepth--;return g}}GetTriggerDepth(){return this._executingTriggerDepth}IsInTrigger(){return 0<this.GetTriggerDepth()}_IncTriggerDepth(){return++this._executingTriggerDepth}_DecTriggerDepth(){--this._executingTriggerDepth}IsRunningEvents(){return 0<this._runningEventsDepth}IsInEventEngine(){return this.IsRunningEvents()||this.IsInTrigger()}_RunQueuedTriggers(d){for(const[c,f,h]of this._queuedTriggers)this._Trigger(d,c,f,h);e.clearArray(this._queuedTriggers)}BlockFlushingInstances(d){d?this._blockFlushingDepth++:this._blockFlushingDepth--}IsFlushingBlocked(){return 0<this._blockFlushingDepth}ClearSol(d){for(let c=0,f=d.length;c<f;++c)d[c].GetSolStack().Clear()}PushCleanSol(d){for(let c=0,f=d.length;c<f;++c)d[c].GetSolStack().PushClean()}PushCopySol(d){for(let c=0,f=d.length;c<f;++c)d[c].GetSolStack().PushCopy()}PopSol(d){for(let c=0,f=d.length;c<f;++c)d[c].GetSolStack().Pop()}AddScheduledWait(){const d=e.New(e.ScheduledWait,this);this._scheduledWaits.push(d);return d}scheduledWaits(){return this._scheduledWaits}RunScheduledWaits(){if(this._scheduledWaits.length){var d=this.GetCurrentEventStackFrame(),c=!1;this._runningEventsDepth++;for(let f=0,h=this._scheduledWaits.length;f<h;++f){const g=this._scheduledWaits[f];g._ShouldRun()&&g._Run(d);g.ShouldRelease()&&(c=!0)}c&&this._FilterScheduledWaitsToRelease();this._runningEventsDepth--}}async DebugRunScheduledWaits(){if(this._scheduledWaits.length){var d=this.GetCurrentEventStackFrame(),c=!1;this._runningEventsDepth++;for(let f=0,h=this._scheduledWaits.length;f<h;++f){const g=this._scheduledWaits[f];g._ShouldRun()&&await g._DebugRun(d);g.ShouldRelease()&&(c=!0)}c&&this._FilterScheduledWaitsToRelease();this._runningEventsDepth--}}_FilterScheduledWaitsToRelease(){const d=e.arrayFilterOut(this._scheduledWaits,c=>c.ShouldRelease());for(const c of d)c.Release()}ClearAllScheduledWaits(){for(const d of this._scheduledWaits)d.Release();e.clearArray(this._scheduledWaits)}RemoveInstancesFromScheduledWaits(d){for(const c of this._scheduledWaits)c.RemoveInstances(d)}AddAsyncActionPromise(d){this._asyncActionPromises.push(d)}ClearAsyncActionPromises(){e.clearArray(this._asyncActionPromises)}GetPromiseForAllAsyncActions(){const d=Promise.all(this._asyncActionPromises);this._asyncActionPromises=[];return d}_SaveToJson(){return{groups:this._SaveGroupsToJson(),cnds:this._SaveCndsToJson(),acts:this._SaveActsToJson(),vars:this._SaveVarsToJson(),waits:this._SaveScheduledWaitsToJson()}}_LoadFromJson(d){this._LoadGroupsFromJson(d.groups);this._LoadCndsFromJson(d.cnds);this._LoadActsFromJson(d.acts);this._LoadVarsFromJson(d.vars);this._LoadScheduledWaitsFromJson(d.waits)}_SaveGroupsToJson(){const d={};for(const c of this.GetAllGroups())d[c.GetSID().toString()]=c.IsGroupActive();return d}_LoadGroupsFromJson(d){for(const[c,f]of Object.entries(d))d=parseInt(c,10),(d=this.GetEventGroupBySID(d))&&d.SetGroupActive(f)}_SaveCndsToJson(){const d={};for(const[c,f]of this._cndsBySid){const h=f._SaveToJson();h&&(d[c.toString()]=h)}return d}_LoadCndsFromJson(d){const c=new Map;for(const[f,h]of Object.entries(d))c.set(parseInt(f,10),h);for(const[f,h]of this._cndsBySid)h._LoadFromJson(c.get(f)||null)}_SaveActsToJson(){const d={};for(const[c,f]of this._actsBySid){const h=f._SaveToJson();h&&(d[c.toString()]=h)}return d}_LoadActsFromJson(d){const c=new Map;for(const[f,h]of Object.entries(d))c.set(parseInt(f,10),h);for(const[f,h]of this._actsBySid)h._LoadFromJson(c.get(f)||null)}_SaveVarsToJson(){const d={};for(const[c,f]of this._eventVarsBySid)f.IsConstant()||!f.IsGlobal()&&!f.IsStatic()||(d[c.toString()]=f.GetValue());return d}_LoadVarsFromJson(d){for(const[c,f]of Object.entries(d))d=parseInt(c,10),(d=this.GetEventVariableBySID(d))&&d.SetValue(f)}_SaveScheduledWaitsToJson(){return this._scheduledWaits.filter(d=>!d.IsPromise()).map(d=>d._SaveToJson())}_LoadScheduledWaitsFromJson(d){this.ClearAllScheduledWaits();for(const c of d)(d=e.ScheduledWait._CreateFromJson(this,c))&&this._scheduledWaits.push(d)}_GetPerfRecords(){return[...this._runtime.GetLayoutManager().runningLayouts()].map(d=>d.GetEventSheet()).filter(d=>d).map(d=>d._GetPerfRecord())}FindFirstFunctionBlockParent(d){for(;d;)if(d=d.GetScopeParent(),d instanceof e.FunctionBlock)return d;return null}_InvokeFunctionFromJS(d,c){Array.isArray(c)||(c=[]);d=this.GetFunctionBlockByName(d.toLowerCase());if(!d)return null;if(!d.IsEnabled())return d.GetDefaultReturnValue();var f=d.GetFunctionParameters();if(c.length<f.length){c=c.slice(0);do c.push(f[c.length].GetInitialValue());while(c.length<f.length)}f=d.GetEventBlock();return f.RunAsExpressionFunctionCall(f.GetSolModifiersIncludingParents(),d.GetReturnType(),d.GetDefaultReturnValue(),...c)}}}
  {"use strict";const e=self.C3;e.EventSheet=class extends e.DefendedBase{constructor(a,b){super();this._eventSheetManager=a;this._runtime=a.GetRuntime();this._name=b[0];this._events=[];this._triggers=new Map;this._fastTriggers=new Map;this._eventsByDisplayNumber=new Map;this._hasRun=!1;this._shallowIncludes=[];this._deepIncludes=[];this._alreadyIncludedSheets=new Set;for(const d of b[1])this._CreateEvent(d,null,this._events);this._perfRecord=this._runtime.IsDebug()?{type:"sheet",name:this._name,totalTimeCounter:0,children:[]}:null}Release(){this._runtime=this._eventSheetManager=null}_CreateEvent(a,b,d){switch(a[0]){case 0:case 3:this._CreateEventBlock(a,b,d);break;case 1:this._CreateEventVariable(a,b,d);break;case 2:this._CreateInclude(a,b,d);break;case 4:this._CreateFunctionBlock(a,b);break;case 5:this._CreateScriptBlock(a,b,d);break;default:throw Error("invalid event type");}}_CreateEventBlock(a,b,d){a=e.EventBlock.Create(this,b,a);if(a.IsOrBlock()){d.push(a);d=a.GetConditions();for(let c=0,f=d.length;c<f;++c)d[c].IsTrigger()&&this._InitTrigger(a,c)}else a.IsTrigger()?this._InitTrigger(a,0):d.push(a)}_CreateFunctionBlock(a,b){a=e.FunctionBlock.Create(this,b,a);this._eventSheetManager._RegisterFunctionBlock(a)}_CreateEventVariable(a,b,d){a=e.EventVariable.Create(this,b,a);d.push(a)}_CreateInclude(a,b,d){a=e.EventInclude.Create(this,b,a);d.push(a)}_CreateScriptBlock(a,b,d){a=e.EventScript.Create(this,b,a);d.push(a)}_InitTrigger(a,b){a.IsOrBlock()||this._eventSheetManager._AddTriggerToPostInit(a);var d=a.GetConditionAt(b),c=d._GetFunc(),f=d.GetObjectClass();if(d.IsFastTrigger()){var h=this._fastTriggers.get(f);h||(h=new Map,this._fastTriggers.set(f,h));d=d.GetFastTriggerValue().toLowerCase();f=h.get(c);f||(f=new Map,h.set(c,f));c=f.get(d);c||(c=[],f.set(d,c));c.push([a,b])}else h=this._triggers.get(f),h||(h={methodMap:new Map,behaviors:new Map},this._triggers.set(f,h)),(f=d.GetBehaviorType())?(d=h.behaviors.get(f),d||(d=new Map,h.behaviors.set(f,d))):d=h.methodMap,h=d.get(c),h||(h=[],d.set(c,h)),h.push([a,b])}_PostInit(){const a=this._events;for(let b=0,d=a.length;b<d;++b){const c=b<d-1&&a[b+1]instanceof e.EventBlock&&a[b+1].IsElseBlock();a[b]._PostInit(c)}}_AddShallowInclude(a){this._shallowIncludes.push(a)}_UpdateDeepIncludes(){e.clearArray(this._deepIncludes);this._AddDeepIncludes(this);this._alreadyIncludedSheets.clear()}_AddDeepIncludes(a){const b=a._deepIncludes,d=a._alreadyIncludedSheets;for(const c of this._shallowIncludes){const f=c.GetIncludeSheet();c.IsActive()&&a!==f&&!d.has(f)&&(d.add(f),f._AddDeepIncludes(a),b.push(f))}}deepIncludes(){return this._deepIncludes}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}GetName(){return this._name}_RegisterEventByDisplayNumber(a,b){this._eventsByDisplayNumber.set(b,a)}_GetEventByDisplayNumber(a){return this._eventsByDisplayNumber.get(a)||null}_ResetHasRunFlag(){this._hasRun=!1}Run(){if(!this._hasRun){var a=this._runtime,b=a.IsCPUProfiling(),d=b?performance.now():0;this._hasRun=!0;var c=this.GetEventSheetManager(),f=c.GetCurrentEventStackFrame();for(const h of this._events)h.Run(f),c.ClearSol(h.GetSolModifiers()),c.ClearAsyncActionPromises(),a.FlushPendingInstances();f.Reset(null);b&&(this._perfRecord.totalTimeCounter+=performance.now()-d)}}*DebugRun(){if(!this._hasRun){this._hasRun=!0;var a=this._runtime,b=this.GetEventSheetManager(),d=b.GetCurrentEventStackFrame();for(const c of this._events)yield*c.DebugRun(d),b.ClearSol(c.GetSolModifiers()),b.ClearAsyncActionPromises(),a.FlushPendingInstances();d.Reset(null)}}_Trigger(a,b,d){if(b){const c=b.GetObjectClass();this._TriggerForClass(a,b,c,d);for(const f of c.GetFamilies())this._TriggerForClass(a,b,f,d)}else return this._TriggerForClass(a,b,null,null)}_TriggerForClass(a,b,d,c){d=this._triggers.get(d);if(!d)return!1;c=c?d.behaviors.get(c):d.methodMap;if(!c)return!1;c=c.get(a);if(!c)return!1;a=!1;for(const[f,h]of c)c=this._ExecuteTrigger(b,f,h),a=a||c;return a}*_DebugTrigger(a,b,d){if(b){const c=b.GetObjectClass();yield*this._DebugTriggerForClass(a,b,c,d);for(const f of c.GetFamilies())yield*this._DebugTriggerForClass(a,b,f,d)}else return yield*this._DebugTriggerForClass(a,b,null,null)}*_DebugTriggerForClass(a,b,d,c){d=this._triggers.get(d);if(!d)return!1;c=c?d.behaviors.get(c):d.methodMap;if(!c)return!1;c=c.get(a);if(!c)return!1;a=!1;for(const[f,h]of c)c=f.DebugCanRunFast()?this._ExecuteTrigger(b,f,h):yield*this._DebugExecuteTrigger(b,f,h),a=a||c;return a}_FastTrigger(a,b,d){b=b.GetObjectClass();b=this._fastTriggers.get(b);if(!b)return!1;a=b.get(a);if(!a)return!1;d=a.get(d);if(!d)return!1;a=!1;for(let c=0,f=d.length;c<f;++c)b=d[c],b=this._ExecuteTrigger(null,b[0],b[1]),a=a||b;return a}*_DebugFastTrigger(a,b,d){b=b.GetObjectClass();b=this._fastTriggers.get(b);if(!b)return!1;a=b.get(a);if(!a)return!1;d=a.get(d);if(!d)return!1;a=!1;for(let f=0,h=d.length;f<h;++f){var c=d[f];b=c[0];c=c[1];b=b.DebugCanRunFast()?this._ExecuteTrigger(null,b,c):yield*this._DebugExecuteTrigger(null,b,c);a=a||b}return a}_ExecuteTrigger(a,b,d){const c=this._runtime,f=this._eventSheetManager,h=f.GetCurrentEvent(),g=f.GetEventStack(),l=f.GetTriggerDepth();let m=!1;h&&f.PushCleanSol(h.GetSolModifiersIncludingParents());f.PushCleanSol(b.GetSolModifiersIncludingParents());const u=1<l;u&&f.GetLocalVarStack().Push();const x=g.Push(b);a&&(b.GetConditions()[d].GetObjectClass().GetCurrentSol().SetSinglePicked(a),a.IsInContainer()&&a.SetSiblingsSinglePicked());a=!0;if(b.GetParent()){const n=b.GetTriggerParents();for(let q=0,t=n.length;q<t;++q)if(!n[q].RunPreTrigger(x)){a=!1;break}}a&&(c.IncrementExecCount(),b.IsOrBlock()?b.RunOrBlockTrigger(x,d):b.Run(x),m=x.GetLastEventTrue());g.Pop();u&&f.GetLocalVarStack().Pop();f.PopSol(b.GetSolModifiersIncludingParents());h&&f.PopSol(h.GetSolModifiersIncludingParents());h||1!==l||(f.ClearAsyncActionPromises(),f.IsFlushingBlocked()||c.FlushPendingInstances());return m}*_DebugExecuteTrigger(a,b,d){const c=this._runtime,f=this._eventSheetManager,h=f.GetCurrentEvent(),g=f.GetEventStack(),l=f.GetTriggerDepth();let m=!1;h&&f.PushCleanSol(h.GetSolModifiersIncludingParents());f.PushCleanSol(b.GetSolModifiersIncludingParents());const u=1<l;u&&f.GetLocalVarStack().Push();const x=g.Push(b);a&&(b.GetConditions()[d].GetObjectClass().GetCurrentSol().SetSinglePicked(a),a.IsInContainer()&&a.SetSiblingsSinglePicked());a=!0;if(b.GetParent()){const n=b.GetTriggerParents();for(let q=0,t=n.length;q<t;++q)if(!(yield*n[q].DebugRunPreTrigger(x))){a=!1;break}}a&&(c.IncrementExecCount(),b.IsOrBlock()?yield*b.DebugRunOrBlockTrigger(x,d):yield*b.DebugRun(x),m=x.GetLastEventTrue());g.Pop();u&&f.GetLocalVarStack().Pop();f.PopSol(b.GetSolModifiersIncludingParents());h&&f.PopSol(h.GetSolModifiersIncludingParents());h||1!==l||(f.ClearAsyncActionPromises(),f.IsFlushingBlocked()||c.FlushPendingInstances());return m}_GetPerfRecord(){return this._perfRecord}}}
  {"use strict";const e=self.C3,a=[];function b(c,f){return!0}function*d(c,f){return!0}e.EventBlock=class extends e.DefendedBase{constructor(c,f,h){super();this._eventSheet=c;this._runtime=c.GetRuntime();this._parent=f;this._scopeParent=null;this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._solModifiers=[];this._solModifiersIncludingParents=[];this._hasElseBlock=this._isTopLevelGroup=this._isSolWriterAfterCnds=this._hasGotSolModifiersIncludingParents=!1;this._isOrBlock=!!h[2];this._isElseBlock=!1;this._triggerParents=null;this._conditions=[];this._actions=[];this._subEvents=[];this._RunActions=b;this._DebugRunActions=d;this._isInitiallyActive=this._isGroup=!1;this._groupName="";this._isGroupActive=!1;this._perfRecord=this._containedIncludes=null;this._sid=h[4];this._displayNumber=h[5];this._eventSheet._RegisterEventByDisplayNumber(this,this._displayNumber);this._debugData=this._runtime.IsDebug()?{isBreakpoint:h[3][0],isBreakable:h[3][1],canRunAllConditionsFast:!1,canRunAllActionsFast:!1,canRunAllSubEventsFast:!1,canRunSelfFast:!1}:null;this.GetEventSheetManager()._RegisterEventBlock(this);3===h[0]&&this._InitGroup(h[1]);c=0;for(var g of h[6])f=e.Condition.Create(this,g,c++),this._conditions.push(f),this._AddSolModifier(f.GetObjectClass());c=0;for(const l of h[7])g=e.Action.Create(this,l,c++),this._actions.push(g);if(9===h.length){h=h[8];for(const l of h)this._eventSheet._CreateEvent(l,this,this._subEvents)}this._conditions.length&&(this._isElseBlock=null===this._conditions[0].GetObjectClass()&&this._conditions[0]._GetFunc()===e.Plugins.System.Cnds.Else);0===this._conditions.length&&(this._conditions=a);0===this._actions.length&&(this._actions=a);0===this._subEvents.length&&(this._subEvents=a)}static Create(c,f,h){return e.New(e.EventBlock,c,f,h)}_InitGroup(c){this._isGroup=!0;this._isGroupActive=this._isInitiallyActive=!!c[0];this._groupName=c[1].toLowerCase();this._containedIncludes=[];this.GetEventSheetManager()._RegisterGroup(this);this._runtime.IsDebug()&&(this._perfRecord={type:"group",name:c[1],totalTimeCounter:0,children:[]})}_AddContainedInclude(c){this._containedIncludes.push(c)}_AddContainerSolModifierToList(c,f){for(const h of c.GetContainer().objectTypes())f.includes(h)||f.push(h)}_AddSolModifierToList(c,f){if(c)if(f.includes(c)||f.push(c),c.IsFamily())for(const h of c.GetFamilyMembers())h.IsInContainer()&&this._AddContainerSolModifierToList(h,f);else c.IsInContainer()&&this._AddContainerSolModifierToList(c,f)}_AddSolModifier(c){this._AddSolModifierToList(c,this._solModifiers)}_AddParentSolModifier(c){this._AddSolModifierToList(c,this._solModifiersIncludingParents)}SetAllSolModifiers(){this._solModifiers=this._runtime.GetAllObjectClasses()}_PostInit(c){this._hasElseBlock=!!c;this._IdentifyTopLevelGroup();this._IdentifyTriggerParents();for(const h of this._conditions)h._PostInit();if(0<this._actions.length){c=!1;for(var f of this._actions)f._PostInit(),f.HasReturnType()&&(c=!0);c?(this._RunActions=this._RunActions_ReturnValue,this._DebugRunActions=this._DebugRunActions_ReturnValue):(this._RunActions=this._RunActions_Fast,this._DebugRunActions=this._DebugRunActions_Fast)}f=this._subEvents;for(let h=0,g=f.length;h<g;++h)c=h<g-1&&f[h+1]instanceof e.EventBlock&&f[h+1].IsElseBlock(),f[h]._PostInit(c);this._debugData&&this._UpdateCanRunFast();this._perfRecord&&this._GetPerfRecordParent()._GetPerfRecord().children.push(this._perfRecord)}_GetPerfRecord(){return this._perfRecord}_GetPerfRecordParent(){let c=this.GetParent();for(;c;){if(c.IsGroup())return c;c=c.GetParent()}return this._eventSheet}_UpdateCanRunFast(){const c=this._debugData;c.canRunAllConditionsFast=this._conditions.every(f=>f.DebugCanRunFast());c.canRunAllActionsFast=this._actions.every(f=>f.DebugCanRunFast());c.canRunAllSubEventsFast=this._subEvents.every(f=>f.DebugCanRunFast());c.canRunSelfFast=c.canRunAllConditionsFast&&c.canRunAllActionsFast&&c.canRunAllSubEventsFast}_UpdateCanRunFastRecursive(){let c=this;do c._UpdateCanRunFast(),c=c.GetParent();while(c)}_IdentifyTopLevelGroup(){if(this.IsGroup()){var c=this.GetParent();for(this._isTopLevelGroup=!0;c;){if(!c.IsGroup()){this._isTopLevelGroup=!1;break}c=c.GetParent()}}}_IdentifySolModifiersIncludingParents(){var c=this._runtime.GetAllObjectClasses();if(this._solModifiers===c)this._solModifiersIncludingParents=c;else{this._solModifiersIncludingParents=e.cloneArray(this._solModifiers);for(c=this.GetParent();c;){for(var f of c._solModifiers)this._AddParentSolModifier(f);c=c.GetParent()}f=this.GetEventSheetManager();this._solModifiers=f._DeduplicateSolModifierList(this._solModifiers);this._solModifiersIncludingParents=f._DeduplicateSolModifierList(this._solModifiersIncludingParents)}}_IdentifyTriggerParents(){if(this.HasAnyTriggeredCondition()){this._triggerParents=[];for(var c=this.GetParent();c;)this._triggerParents.push(c),c=c.GetParent();this._triggerParents.reverse()}}SetSolWriterAfterCnds(){this._isSolWriterAfterCnds=!0;this._parent&&this._parent.SetSolWriterAfterCnds()}IsSolWriterAfterCnds(){return this._isSolWriterAfterCnds}GetSolModifiers(){return this._solModifiers}GetSolModifiersIncludingParents(){this._hasGotSolModifiersIncludingParents||(this._hasGotSolModifiersIncludingParents=!0,this._IdentifySolModifiersIncludingParents());return this._solModifiersIncludingParents}HasSolModifier(c){return this._solModifiers.includes(c)}GetTriggerParents(){return this._triggerParents}GetEventSheet(){return this._eventSheet}GetEventSheetManager(){return this._eventSheet.GetEventSheetManager()}GetRuntime(){return this._runtime}GetParent(){return this._parent}_SetScopeParent(c){this._scopeParent=c}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(c){this._debugData.isBreakpoint=!!c;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(c){c=!!c;if(!this._isGroup)throw Error("not a group");if(this._isGroupActive!==c){this._isGroupActive=c;for(const f of this._containedIncludes)f.UpdateActive();this._containedIncludes.length&&(c=this._runtime.GetCurrentLayout().GetEventSheet())&&c._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 e.FunctionBlock}HasAnyTriggeredCondition(){return this.IsForFunctionBlock()||this._conditions.some(c=>c.IsTrigger())}GetConditions(){return this._conditions}GetConditionCount(){return this._conditions.length}GetConditionAt(c){c=Math.floor(c);if(0>c||c>=this._conditions.length)throw new RangeError("invalid condition index");return this._conditions[c]}GetConditionByDebugIndex(c){return this.GetConditionAt(c)}IsFirstConditionOfType(c){let f=c.GetIndex();if(0===f)return!0;for(--f;0<=f;--f)if(this._conditions[f].GetObjectClass()===c.GetObjectClass())return!1;return!0}GetActions(){return this._actions}GetActionCount(){return this._actions.length}GetActionAt(c){c=Math.floor(c);if(0>c||c>=this._actions.length)throw new RangeError("invalid action index");return this._actions[c]}GetActionByDebugIndex(c){c=Math.floor(c);const f=this._actions.find(h=>h.GetDebugIndex()===c);if(!f)throw new RangeError("invalid action debug index");return f}_HasActionIndex(c){c=Math.floor(c);return 0<=c&&c<this._actions.length}GetSubEvents(){return this._subEvents}_GetAllLocalVariablesInScope(){return this._subEvents.filter(c=>c instanceof e.EventVariable)}RunPreTrigger(c){c.SetCurrentEvent(this);let f=!1;const h=this._conditions;for(let g=0,l=h.length;g<l;++g){const m=h[g];c.SetConditionIndex(g);if(m.IsLooping())throw Error("trigger cannot be used as sub-event to a loop");if(m.Run())f=!0;else if(!this._isOrBlock)return!1}return this._isOrBlock?f:!0}RunOrBlockTrigger(c,f){c.SetCurrentEvent(this);this._conditions[f].Run()&&(this._RunActions(c,0)&&this._RunSubEvents(c),c.SetLastEventTrue(!0))}*DebugRunPreTrigger(c){c.SetCurrentEvent(this);let f=!1;const h=this._conditions;for(let g=0,l=h.length;g<l;++g){const m=h[g];c.SetConditionIndex(g);if(m.IsLooping())throw Error("trigger cannot be used as sub-event to a loop");if(m.DebugCanRunFast()?m.Run():yield*m.DebugRun())f=!0;else if(!this._isOrBlock)return!1}return this._isOrBlock?f:!0}*DebugRunOrBlockTrigger(c,f){c.SetCurrentEvent(this);f=this._conditions[f];if(f.DebugCanRunFast()?f.Run():yield*f.DebugRun())(this.DebugCanRunActionsFast()?this._RunActions(c,0):yield*this._DebugRunActions(c,0))&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():yield*this._DebugRunSubEvents()),c.SetLastEventTrue(!0)}Run(c){c.SetCurrentEvent(this);this._isElseBlock||c.SetElseBranchRan(!1);this._isOrBlock?this._RunOrBlock(c):this._RunAndBlock(c)}*DebugRun(c){if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;c.SetCurrentEvent(this);this._isElseBlock||c.SetElseBranchRan(!1);this._isOrBlock?yield*this._DebugRunOrBlock(c):yield*this._DebugRunAndBlock(c)}_RunOrBlock(c){const f=this._conditions;let h=0===f.length;for(let l=0,m=f.length;l<m;++l){var g=f[l];g.IsTrigger()||(c.SetConditionIndex(l),g=g.Run(),h=h||g)}c.SetLastEventTrue(h);h&&(this._RunActions(c,0)&&this._RunSubEvents(c),this._hasElseBlock&&c.SetElseBranchRan(!0))}*_DebugRunOrBlock(c){const f=this._conditions;let h=0===f.length;for(let l=0,m=f.length;l<m;++l){var g=f[l];g.IsTrigger()||(c.SetConditionIndex(l),g=g.DebugCanRunFast()?g.Run():yield*g.DebugRun(),h=h||g)}c.SetLastEventTrue(h);h&&((this.DebugCanRunActionsFast()?this._RunActions(c,0):yield*this._DebugRunActions(c,0))&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():yield*this._DebugRunSubEvents()),this._hasElseBlock&&c.SetElseBranchRan(!0))}_RunAndBlock(c){const f=this._conditions;for(let h=0,g=f.length;h<g;++h){const l=f[h];c.SetConditionIndex(h);if(!l.Run()){c.SetLastEventTrue(!1);return}}c.SetLastEventTrue(!0);this._RunActions(c,0)&&this._RunSubEvents(c);c.GetLastEventTrue()&&this._hasElseBlock&&c.SetElseBranchRan(!0)}*_DebugRunAndBlock(c){const f=this._conditions;for(let h=0,g=f.length;h<g;++h){const l=f[h];c.SetConditionIndex(h);if(l.DebugCanRunFast()?!l.Run():!(yield*l.DebugRun())){c.SetLastEventTrue(!1);return}}c.SetLastEventTrue(!0);(this.DebugCanRunActionsFast()?this._RunActions(c,0):yield*this._DebugRunActions(c,0))&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():yield*this._DebugRunSubEvents());c.GetLastEventTrue()&&this._hasElseBlock&&c.SetElseBranchRan(!0)}_RunActions_Fast(c,f){const h=this._actions;for(let g=f,l=h.length;g<l;++g)f=h[g],c.SetActionIndex(g),f.Run();return!0}*_DebugRunActions_Fast(c,f){const h=this._actions;for(let g=f,l=h.length;g<l;++g)f=h[g],c.SetActionIndex(g),f.DebugCanRunFast()?f.Run():yield*f.DebugRun();return!0}_RunActions_ReturnValue(c,f){const h=this.GetEventSheetManager(),g=this._actions;for(let l=f,m=g.length;l<m;++l){f=g[l];c.SetActionIndex(l);const u=f.Run();if(f.CanBailOut()&&!0===u)return!1;f.IsAsync()&&u instanceof Promise&&h.AddAsyncActionPromise(u)}return!0}*_DebugRunActions_ReturnValue(c,f){const h=this.GetEventSheetManager(),g=this._actions;for(let l=f,m=g.length;l<m;++l){f=g[l];c.SetActionIndex(l);let u;u=f.DebugCanRunFast()?f.Run():yield*f.DebugRun();if(f.CanBailOut()&&!0===u)return!1;f.IsAsync()&&u instanceof Promise&&h.AddAsyncActionPromise(u)}return!0}_ResumeActionsAndSubEvents(c){this._RunActions(c,c.GetActionIndex())&&this._RunSubEvents()}*_DebugResumeActionsAndSubEvents(c){if(yield*this._DebugRunActions(c,c.GetActionIndex()))yield*this._DebugRunSubEvents()}_RunSubEvents(){if(this._subEvents.length){var c=this.IsGroup()&&this._runtime.IsCPUProfiling(),f=c?performance.now():0,h=this._eventStack,g=h.Push(this);this._isSolWriterAfterCnds?this._RunSubEvents_SolWriterAfterCnds(g):this._RunSubEvents_Fast(g);h.Pop();c&&(this._perfRecord.totalTimeCounter+=performance.now()-f)}}_RunSubEvents_SolWriterAfterCnds(c){const f=this._isGroup,h=this._isTopLevelGroup,g=this.GetEventSheetManager(),l=this._subEvents;for(let m=0,u=l.length,x=u-1;m<u;++m){const n=l[m],q=n.GetSolModifiers(),t=!h||!f&&m<x;t&&g.PushCopySol(q);n.Run(c);t?g.PopSol(q):g.ClearSol(q)}}_RunSubEvents_Fast(c){const f=this._subEvents;for(let h=0,g=f.length;h<g;++h)f[h].Run(c)}*_DebugRunSubEvents(){if(this._subEvents.length){var c=this._eventStack,f=c.Push(this);this._isSolWriterAfterCnds?yield*this._DebugRunSubEvents_SolWriterAfterCnds(f):yield*this._DebugRunSubEvents_Fast(f);c.Pop()}}*_DebugRunSubEvents_SolWriterAfterCnds(c){const f=this._isGroup,h=this._isTopLevelGroup,g=this.GetEventSheetManager(),l=this._subEvents;for(let m=0,u=l.length,x=u-1;m<u;++m){const n=l[m],q=n.GetSolModifiers(),t=!h||!f&&m<x;t&&g.PushCopySol(q);yield*n.DebugRun(c);t?g.PopSol(q):g.ClearSol(q)}}*_DebugRunSubEvents_Fast(c){const f=this._subEvents;for(let h=0,g=f.length;h<g;++h)yield*f[h].DebugRun(c)}Retrigger(c,f){this._runtime.IncrementExecCount();f.ResetQuick();const h=this._conditions;if(!this.IsOrBlock())for(let g=c.GetConditionIndex()+1,l=h.length;g<l;++g)if(c=h[g],f.SetConditionIndex(g),!c.Run())return!1;this._RunActions(f,0)&&this._RunSubEvents(f);return!0}*DebugRetrigger(c,f){this._runtime.IncrementExecCount();f.ResetQuick();const h=this._conditions;if(!this.IsOrBlock())for(let g=c.GetConditionIndex()+1,l=h.length;g<l;++g)if(c=h[g],f.SetConditionIndex(g),c.DebugCanRunFast()?!c.Run():!(yield*c.DebugRun()))return!1;(this.DebugCanRunActionsFast()?this._RunActions(f,0):yield*this._DebugRunActions(f,0))&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():yield*this._DebugRunSubEvents());return!0}DebugCanRunFast(){return!this.IsDebugBreakpoint()&&!this._runtime.DebugBreakNext()&&this._debugData.canRunSelfFast}DebugCanRunActionsFast(){return!this._runtime.DebugBreakNext()&&this._debugData.canRunAllActionsFast}DebugCanRunSubEventsFast(){return!this._runtime.DebugBreakNext()&&this._debugData.canRunAllSubEventsFast}_CheckParentsOKToRun(c){if(this.GetParent()){const f=this.GetTriggerParents();for(let h=0,g=f.length;h<g;++h)if(!f[h].RunPreTrigger(c))return!1}return!0}*_DebugCheckParentsOKToRun(c){if(this.GetParent()){const f=this.GetTriggerParents();for(let h=0,g=f.length;h<g;++h)if(!(yield*f[h].DebugRunPreTrigger(c)))return!1}return!0}_EvaluateFunctionCallParameters(c,f,h){0<f.length?h?(f=f.map(g=>g.Get(0)),c.GetLocalVarStack().Push(),this._scopeParent.SetFunctionParameters(f)):this._scopeParent.EvaluateFunctionParameters(f):h&&c.GetLocalVarStack().Push()}RunAsFunctionCall(c,f){let h,g;const l=0<c.length;var m=this._runtime;const u=this._eventStack,x=m.GetEventSheetManager(),n=1<x._IncTriggerDepth();this._EvaluateFunctionCallParameters(x,f,n);l&&x.PushCleanSol(c);f=u.Push(this);this._CheckParentsOKToRun(f)&&(m.IncrementExecCount(),f.SetCurrentEvent(this),(m=this._scopeParent.IsAsync())&&([g,h]=this._scopeParent.StartAsyncFunctionCall()),this._RunAndBlock(f),m&&this._scopeParent.MaybeFinishAsyncFunctionCall(g));u.Pop();n&&x.GetLocalVarStack().Pop();l&&x.PopSol(c);x._DecTriggerDepth();return h}*DebugRunAsFunctionCall(c,f){let h,g;if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;const l=0<c.length;var m=this._runtime;const u=this._eventStack,x=m.GetEventSheetManager(),n=1<x._IncTriggerDepth();this._EvaluateFunctionCallParameters(x,f,n);l&&x.PushCleanSol(c);f=u.Push(this);if(yield*this._DebugCheckParentsOKToRun(f))m.IncrementExecCount(),f.SetCurrentEvent(this),(m=this._scopeParent.IsAsync())&&([g,h]=this._scopeParent.StartAsyncFunctionCall()),yield*this._DebugRunAndBlock(f),m&&this._scopeParent.MaybeFinishAsyncFunctionCall(g);u.Pop();n&&x.GetLocalVarStack().Pop();l&&x.PopSol(c);x._DecTriggerDepth();return h}RunAsMappedFunctionCall(c){const f=this.GetSolModifiersIncludingParents(),h=0<f.length,g=this._runtime,l=this._eventStack,m=g.GetEventSheetManager(),u=1<m._IncTriggerDepth();u&&m.GetLocalVarStack().Push();this._scopeParent.SetFunctionParameters(c);h&&m.PushCleanSol(f);c=l.Push(this);this._CheckParentsOKToRun(c)&&(g.IncrementExecCount(),c.SetCurrentEvent(this),this._RunAndBlock(c));l.Pop();u&&m.GetLocalVarStack().Pop();h&&m.PopSol(f);m._DecTriggerDepth()}*DebugRunAsMappedFunctionCall(c){if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;const f=this.GetSolModifiersIncludingParents(),h=0<f.length,g=this._runtime,l=this._eventStack,m=g.GetEventSheetManager(),u=1<m._IncTriggerDepth();u&&m.GetLocalVarStack().Push();this._scopeParent.SetFunctionParameters(c);h&&m.PushCleanSol(f);c=l.Push(this);if(yield*this._DebugCheckParentsOKToRun(c))g.IncrementExecCount(),c.SetCurrentEvent(this),yield*this._DebugRunAndBlock(c);l.Pop();u&&m.GetLocalVarStack().Pop();h&&m.PopSol(f);m._DecTriggerDepth()}RunAsExpressionFunctionCall(c,f,h,...g){let l,m;const u=0<c.length,x=this._runtime,n=this._eventStack,q=x.GetEventSheetManager(),t=1<q._IncTriggerDepth();t&&q.GetLocalVarStack().Push();0<g.length&&this._scopeParent.SetFunctionParameters(g);u&&q.PushCleanSol(c);g=n.Push(this);g.InitCallFunctionExpression(f,h);n.PushExpFunc(g);x.SetDebuggingEnabled(!1);this._CheckParentsOKToRun(g)&&(x.IncrementExecCount(),g.SetCurrentEvent(this),(f=this._scopeParent.IsAsync())&&([m,l]=this._scopeParent.StartAsyncFunctionCall()),this._RunAndBlock(g),f&&this._scopeParent.MaybeFinishAsyncFunctionCall(m));x.SetDebuggingEnabled(!0);n.Pop();n.PopExpFunc();t&&q.GetLocalVarStack().Pop();u&&q.PopSol(c);q._DecTriggerDepth();return l||g.GetFunctionReturnValue()}}}
  {"use strict";const e=self.C3,a=[];let b=!1;e.EventScript=class extends e.DefendedBase{constructor(d,c,f){super();const h=d.GetRuntime(),g=d.GetEventSheetManager();this._eventSheet=d;this._eventSheetManager=g;this._runtime=d.GetRuntime();this._parent=c;this._func=h.GetObjectReference(f[1]);this._displayNumber=f[2];this._eventSheet._RegisterEventByDisplayNumber(this,this._displayNumber);this._debugData=h.IsDebug()?{isBreakpoint:f[3][0],isBreakable:f[3][1]}:null}static Create(d,c,f){return e.New(e.EventScript,d,c,f)}_PostInit(){const d=this._func,c=this._runtime.GetEventSheetManager()._GetLocalVariablesScriptInterface(this);this._func=d.bind(null,this._runtime.GetIRuntime(),c)}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(d){this._debugData.isBreakpoint=!!d}IsElseBlock(){return!1}GetSolModifiers(){return a}GetSolModifiersIncludingParents(){return this._parent?this._parent.GetSolModifiersIncludingParents():a}Run(d){d.SetCurrentEvent(this);this._eventSheetManager.AddAsyncActionPromise(this._RunUserScript())}async _RunUserScript(){try{await this._func()}catch(d){console.error(`Unhandled exception running script %c${this.GetEventSheet().GetName()}, event ${this.GetDisplayNumber()}:`,"font-size: 1.2em; font-weight: bold;",d),self.C3Debugger&&self.C3Debugger._SetLastErrorScript(this),b||(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"),b=!0)}}*DebugRun(d){d.SetCurrentEvent(this);if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;this.Run(d)}DebugCanRunFast(){return!this.IsDebugBreakpoint()&&!this._runtime.DebugBreakNext()}static HadUserScriptException(){return b}static SetHadUserScriptException(){b=!0}}}
  {"use strict";const e=self.C3;e.FunctionBlock=class extends e.DefendedBase{constructor(a,b,d){super();this._eventSheet=a;this._runtime=a.GetRuntime();this._parent=b;const c=d[1];this._functionName=c[0];this._returnType=c[1];this._functionParameters=c[2].map(f=>e.EventVariable.Create(a,this,f));this._isEnabled=c[3];this._innerLocalVariables=[];this._isAsync=c[4];this._nextAsyncId=0;this._currentAsyncId=-1;this._asyncMap=new Map;this._eventBlock=e.EventBlock.Create(a,b,d);this._eventBlock._SetScopeParent(this)}static Create(a,b,d){return e.New(e.FunctionBlock,a,b,d)}_PostInit(){for(const a of this._functionParameters)a._PostInit();this._eventBlock._PostInit(!1)}_GetAllLocalVariablesInScope(){return this._functionParameters}GetFunctionParameters(){return this._functionParameters}GetFunctionParameterCount(){return this._functionParameters.length}_RegisterLocalVariable(a){this._innerLocalVariables.push(a)}_GetAllInnerLocalVariables(){return this._innerLocalVariables}EvaluateFunctionParameters(a){const b=this._functionParameters;for(let d=0,c=b.length;d<c;++d)b[d].SetValue(a[d].Get(0))}SetFunctionParameters(a){const b=this._functionParameters;for(let d=0,c=b.length;d<c;++d)b[d].SetValue(a[d])}CaptureFunctionParameters(){return this._functionParameters.map(a=>a.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}IsAsync(){return this._isAsync}StartAsyncFunctionCall(){const a=this._nextAsyncId++;this._currentAsyncId=a;let b;const d=new Promise(c=>b=c);this._asyncMap.set(a,{resolve:b,pauseCount:0});return[a,d]}MaybeFinishAsyncFunctionCall(a){const b=this._asyncMap.get(a);0===b.pauseCount&&(b.resolve(),this._asyncMap.delete(a));this._currentAsyncId=-1}PauseCurrentAsyncFunction(){this._asyncMap.get(this._currentAsyncId).pauseCount++;return this._currentAsyncId}ResumeAsyncFunction(a){this._currentAsyncId=a;this._asyncMap.get(a).pauseCount--}}}
  {"use strict";const e=self.C3,a=[];e.EventVariable=class extends e.DefendedBase{constructor(b,d,c){super();const f=b.GetEventSheetManager();this._eventSheet=b;this._eventSheetManager=f;this._runtime=b.GetRuntime();this._parent=d;this._localVarStack=f.GetLocalVarStack();this._name=c[1];this._type=c[2];this._initialValue=c[3];this._isStatic=!!c[4];this._isConstant=!!c[5];this._isFunctionParameter=d instanceof e.FunctionBlock;this._sid=c[6];this._jsPropName=this._runtime.GetJsPropName(c[8]);this._scriptSetter=h=>this.SetValue(h);this._scriptGetter=()=>this.GetValue();this._hasSingleValue=!this._parent||this._isStatic||this._isConstant;this._value=this._initialValue;this._localIndex=-1;this.IsBoolean()&&(this._value=this._value?1:0);!this.IsLocal()||this.IsStatic()||this.IsConstant()||(this._localIndex=f._GetNextLocalVarIndex(this));f._RegisterEventVariable(this)}static Create(b,d,c){return e.New(e.EventVariable,b,d,c)}_PostInit(){if(this.IsLocal()&&!this.IsStatic()&&!this.IsConstant()&&!this.IsFunctionParameter()){const b=this._eventSheetManager.FindFirstFunctionBlockParent(this);b&&b._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 0===this._type}IsString(){return 1===this._type}IsBoolean(){return 2===this._type}IsElseBlock(){return!1}GetSID(){return this._sid}GetInitialValue(){return this._initialValue}GetSolModifiers(){return a}Run(b){!this.IsLocal()||this.IsStatic()||this.IsConstant()||this.SetValue(this.GetInitialValue())}DebugCanRunFast(){return!0}*DebugRun(b){this.Run(b)}SetValue(b){this.IsNumber()?"number"!==typeof b&&(b=parseFloat(b)):this.IsString()?"string"!==typeof b&&(b=b.toString()):this.IsBoolean()&&(b=b?1:0);this._hasSingleValue?this._value=b:this._localVarStack.GetCurrent()[this._localIndex]=b}GetValue(){return this._hasSingleValue?this._value:this._localVarStack.GetCurrent()[this._localIndex]}GetTypedValue(){let b=this.GetValue();this.IsBoolean()&&(b=!!b);return b}ResetToInitialValue(){this._value=this._initialValue}_GetScriptInterfaceDescriptor(){return{configurable:!1,enumerable:!0,get:this._scriptGetter,set:this._scriptSetter}}}}
  {"use strict";const e=self.C3,a=[];e.EventInclude=class extends e.DefendedBase{constructor(b,d,c){super();const f=b.GetEventSheetManager();this._eventSheet=b;this._eventSheetManager=f;this._runtime=b.GetRuntime();this._parent=d;this._includeSheet=null;this._includeSheetName=c[1];this._isActive=!0}static Create(b,d,c){return e.New(e.EventInclude,b,d,c)}_PostInit(){this._includeSheet=this._eventSheetManager.GetEventSheetByName(this._includeSheetName);this._eventSheet._AddShallowInclude(this);let b=this.GetParent();for(;b;)b instanceof e.EventBlock&&b.IsGroup()&&b._AddContainedInclude(this),b=b.GetParent();this.UpdateActive();this._runtime.IsDebug()&&this._eventSheet._GetPerfRecord().children.push(this._includeSheet._GetPerfRecord())}GetParent(){return this._parent}GetSolModifiers(){return a}GetIncludeSheet(){return this._includeSheet}Run(b){b=!!this.GetParent();const d=this._runtime.GetAllObjectClasses();b&&this._eventSheetManager.PushCleanSol(d);this._includeSheet.Run();b&&this._eventSheetManager.PopSol(d)}*DebugRun(b){b=!!this.GetParent();const d=this._runtime.GetAllObjectClasses();b&&this._eventSheetManager.PushCleanSol(d);yield*this._includeSheet.DebugRun();b&&this._eventSheetManager.PopSol(d)}DebugCanRunFast(){return!1}IsActive(){return this._isActive}UpdateActive(){let b=this.GetParent();for(;b;){if(b instanceof e.EventBlock&&b.IsGroup()&&!b.IsGroupActive()){this._isActive=!1;return}b=b.GetParent()}this._isActive=!0}}}
  {"use strict";const e=self.C3;e.ExpNode=class extends e.DefendedBase{constructor(l){super();this._owner=l;this._runtime=l.GetRuntime()}_PostInit(){}static CreateNode(l,m){return e.New([h,c,f,g,a,b][m[0]],l,m)}};class a extends e.ExpNode{constructor(l,m){super(l);this._systemPlugin=this._runtime.GetSystemPlugin();this._func=this._runtime.GetObjectReference(m[1]);this._func!==e.Plugins.System.Exps.random&&this._func!==e.Plugins.System.Exps.choose||this._owner.SetVariesPerInstance()}GetBoundMethod(){return this._systemPlugin._GetBoundACEMethod(this._func,this._systemPlugin)}}class b extends e.ExpNode{constructor(l,m){super(l);this._functionBlock=null;this._functionName=m[1];this._owner.SetVariesPerInstance()}_PostInit(){const l=this._runtime.GetEventSheetManager();this._functionBlock=l.GetFunctionBlockByName(this._functionName);this._functionName=null;const m=this._owner.GetEventBlock(),u=this._functionBlock.GetEventBlock();this._combinedSolModifiers=[...new Set([...m.GetSolModifiersIncludingParents(),...u.GetSolModifiersIncludingParents()])];this._combinedSolModifiers=l._DeduplicateSolModifierList(this._combinedSolModifiers)}GetBoundMethod(){const l=this._functionBlock;if(l.IsEnabled()){const m=l.GetEventBlock();return e.EventBlock.prototype.RunAsExpressionFunctionCall.bind(m,this._combinedSolModifiers,l.GetReturnType(),l.GetDefaultReturnValue())}{const m=l.GetDefaultReturnValue();return()=>m}}}function d(l,m){if(l>=m)return l%m;0>l&&(l<=-m&&(l%=m),0>l&&(l+=m));return l}class c extends e.ExpNode{constructor(l,m){super(l);this._objectClass=this._runtime.GetObjectClassByIndex(m[1]);this._func=this._runtime.GetObjectReference(m[2]);this._returnsString=!!m[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(...l){const m=this._objectClass,u=m.GetCurrentSol().GetExpressionInstances();var x=u.length;if(0===x)return this._returnsString?"":0;x=d(this._owner.GetSolIndex(),x);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(m);return this._func.apply(u[x].GetSdkInstance(),l)}ExpObject_InstExpr(l,...m){const u=this._objectClass,x=u.GetInstances(),n=x.length;if(0===n)return this._returnsString?"":0;l=d(l,n);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(u);return this._func.apply(x[l].GetSdkInstance(),m)}}class f extends e.ExpNode{constructor(l,m){super(l);this._objectClass=this._runtime.GetObjectClassByIndex(m[1]);this._varIndex=m[3];this._returnsString=!!m[2];this._owner._MaybeVaryFor(this._objectClass)}ExpInstVar(){const l=this._objectClass.GetCurrentSol().GetExpressionInstances();var m=l.length;if(0===m)return this._returnsString?"":0;m=d(this._owner.GetSolIndex(),m);return l[m]._GetInstanceVariableValueUnchecked(this._varIndex)}ExpInstVar_Family(){var l=this._objectClass,m=l.GetCurrentSol().GetExpressionInstances(),u=m.length;if(0===u)return this._returnsString?"":0;u=d(this._owner.GetSolIndex(),u);m=m[u];l=m.GetObjectClass().GetFamilyInstanceVariableOffset(l.GetFamilyIndex());return m._GetInstanceVariableValueUnchecked(this._varIndex+l)}ExpInstVar_InstExpr(l){const m=this._objectClass;var u=m.GetInstances();const x=u.length;if(0===x)return this._returnsString?"":0;l=d(l,x);u=u[l];l=0;m.IsFamily()&&(l=u.GetObjectClass().GetFamilyInstanceVariableOffset(m.GetFamilyIndex()));return u._GetInstanceVariableValueUnchecked(this._varIndex+l)}}class h extends e.ExpNode{constructor(l,m){super(l);this._objectClass=this._runtime.GetObjectClassByIndex(m[1]);this._behaviorType=this._objectClass.GetBehaviorTypeByName(m[2]);this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(m[2]);this._func=this._runtime.GetObjectReference(m[3]);this._returnsString=!!m[4];this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._owner._MaybeVaryFor(this._objectClass)}ExpBehavior(...l){const m=this._objectClass;var u=m.GetCurrentSol().GetExpressionInstances(),x=u.length;if(0===x)return this._returnsString?"":0;x=d(this._owner.GetSolIndex(),x);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(m);u=u[x];x=0;m.IsFamily()&&(x=u.GetObjectClass().GetFamilyBehaviorOffset(m.GetFamilyIndex()));return this._func.apply(u.GetBehaviorInstances()[this._behaviorIndex+x].GetSdkInstance(),l)}ExpBehavior_InstExpr(l,...m){const u=this._objectClass;var x=u.GetInstances();const n=x.length;if(0===n)return this._returnsString?"":0;l=d(l,n);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(u);x=x[l];l=0;u.IsFamily()&&(l=x.GetObjectClass().GetFamilyBehaviorOffset(u.GetFamilyIndex()));return this._func.apply(x.GetBehaviorInstances()[this._behaviorIndex+
  l].GetSdkInstance(),m)}}class g extends e.ExpNode{constructor(l,m){super(l);this._eventVar=null;this._eventVarSid=m[1]}_PostInit(){this._eventVar=this._runtime.GetEventSheetManager().GetEventVariableBySID(this._eventVarSid)}GetVar(){return this._eventVar}}}
  {"use strict";const e=self.C3;e.Parameter=class extends e.DefendedBase{constructor(y,B,E){super();this._owner=y;this._index=E;this._type=B;this.Get=null;this._isConstant=this._variesPerInstance=!1}static Create(y,B,E){const H=B[0];return e.New([b,d,u,f,g,c,l,b,f,f,x,n,u,t,d,m,h,q,r,w][H],y,H,E,B)}_PostInit(){}SetVariesPerInstance(){this._variesPerInstance=!0}_MaybeVaryFor(y){this._variesPerInstance||!y||y.GetPlugin().IsSingleGlobal()||(this._variesPerInstance=!0)}VariesPerInstance(){return this._variesPerInstance}GetIndex(){return this._index}GetRuntime(){return this._owner.GetRuntime()}GetEventBlock(){return this._owner.GetEventBlock()}IsConstant(){return this._isConstant}};function a(y){y=self.C3_ExpressionFuncs[y];if(!y)throw Error("invalid expression number");return y}class b extends e.Parameter{constructor(y,B,E,H){super(y,B,E);this._solIndex=0;y=H[1];this._expressionNumber=y[0];this._numberedNodes=[];this._expressionFunc=null;for(let K=1,C=y.length;K<C;++K)this._numberedNodes.push(e.ExpNode.CreateNode(this,y[K]));this._numberedNodes.length?this.Get=this.GetExpression:(this.Get=a(this._expressionNumber),this._isConstant=!0)}_GetNode(y){if(0>y||y>=this._numberedNodes.length)throw new RangeError("invalid numbered node");return this._numberedNodes[y]}_PostInit(){for(var y of this._numberedNodes)y._PostInit();y=a(this._expressionNumber);this._expressionFunc=this._numberedNodes.length?y(this):y}GetSolIndex(){return this._solIndex}GetExpression(y){this._solIndex=y;return this._expressionFunc()}}class d extends b{constructor(y,B,E,H){super(y,B,E,H);this.Get=this.GetStringExpression;14===B&&(this.GetEventBlock().SetAllSolModifiers(),this._owner instanceof e.Action&&this.GetEventBlock().SetSolWriterAfterCnds())}GetStringExpression(y){this._solIndex=y;y=this._expressionFunc();return"string"===typeof y?y:""}_GetFastTriggerValue(){return a(this._expressionNumber)()}}class c extends b{constructor(y,B,E,H){super(y,B,E,H);this.Get=this.GetLayer;this._isConstant=!1}GetLayer(y){this._solIndex=y;y=this._expressionFunc();return this.GetRuntime().GetCurrentLayout().GetLayer(y)}}class f extends e.Parameter{constructor(y,B,E,H){super(y,B,E);this._combo=H[1];this.Get=this.GetCombo;this._isConstant=!0}GetCombo(){return this._combo}}class h extends e.Parameter{constructor(y,B,E,H){super(y,B,E);this._bool=H[1];this.Get=this.GetBoolean;this._isConstant=!0}GetBoolean(){return this._bool}}class g extends e.Parameter{constructor(y,B,E,H){super(y,B,E);this._objectClass=this.GetRuntime().GetObjectClassByIndex(H[1]);this.Get=this.GetObjectClass;y=this.GetEventBlock();y._AddSolModifier(this._objectClass);this._owner instanceof e.Action?y.SetSolWriterAfterCnds():y.GetParent()&&y.GetParent().SetSolWriterAfterCnds();this._isConstant=!0}GetObjectClass(){return this._objectClass}}
  class l extends e.Parameter{constructor(y,B,E,H){super(y,B,E);this._layout=this.GetRuntime().GetLayoutManager().GetLayoutByName(H[1]);this.Get=this.GetLayout;this._isConstant=!0}GetLayout(){return this._layout}}class m extends e.Parameter{constructor(y,B,E,H){super(y,B,E);this._timeline=this.GetRuntime().GetTimelineManager().GetTimelineByName(H[1]);this.Get=this.GetTimeline;this._isConstant=!0}GetTimeline(){return this._timeline}}class u extends e.Parameter{constructor(y,B,E,H){super(y,B,E);this._fileInfo=H[1];this.Get=this.GetFile;this._isConstant=!0}GetFile(){return this._fileInfo}}class x extends e.Parameter{constructor(y,B,E,H){super(y,B,E);this._instVarIndex=H[1];(y=this._owner.GetObjectClass())&&y.IsFamily()?(this.Get=this.GetFamilyInstanceVariable,this.SetVariesPerInstance()):(this.Get=this.GetInstanceVariable,this._isConstant=!0)}GetInstanceVariable(){return this._instVarIndex}GetFamilyInstanceVariable(y){y=y||0;const B=this._owner.GetObjectClass();var E=B.GetCurrentSol();const H=E.GetInstances();if(H.length)y=H[y%H.length].GetObjectClass();else if(E.HasAnyElseInstances())E=E.GetElseInstances(),y=E[y%E.length].GetObjectClass();else if(0<B.GetInstanceCount())E=B.GetInstances(),y=E[y%E.length].GetObjectClass();else return 0;return this._instVarIndex+y.GetFamilyInstanceVariableOffset(B.GetFamilyIndex())}}class n extends e.Parameter{constructor(y,B,E,H){super(y,B,E);this._eventVarSid=H[1];this._eventVar=null;this.Get=this.GetEventVariable;this._isConstant=!0}_PostInit(){this._eventVar=this.GetRuntime().GetEventSheetManager().GetEventVariableBySID(this._eventVarSid)}GetEventVariable(){return this._eventVar}}
  class q extends e.Parameter{constructor(y,B,E,H){super(y,B,E);this._functionBlockName=H[1];this._functionBlock=null;this.Get=this.GetFunction;this._isConstant=!0}_PostInit(){this._functionBlock=this.GetRuntime().GetEventSheetManager().GetFunctionBlockByName(this._functionBlockName);this._functionBlockName=null}GetFunction(){return this._functionBlock}}class t extends e.Parameter{constructor(y,B,E,H){super(y,B,E);this._subParams=[];this._variadicRet=[];this._isConstant=!0;for(let K=1,C=H.length;K<C;++K)y=e.Parameter.Create(this._owner,H[K],0),this._subParams.push(y),this._variadicRet.push(0),y.IsConstant()||(this._isConstant=!1);this.Get=this.GetVariadic}_PostInit(){for(const y of this._subParams)y._PostInit()}GetVariadic(){const y=this._subParams,B=this._variadicRet;for(let E=0,H=y.length;E<H;++E)B[E]=y[E].Get(0);return B}}class r extends e.Parameter{constructor(y,B,E,H){super(y,B,E);this._easeIndex=H[1];this.Get=this.GetEase;this._isConstant=!0}GetEase(){return this._easeIndex}}class w extends e.Parameter{constructor(y,B,E,H){super(y,B,E);this._brushIndex=H[1];this.Get=this.GetTilemapBrush;this._isConstant=!0}GetTilemapBrush(){return this._brushIndex}}}
  {"use strict";const e=self.C3;function a(c,f){for(let h=0,g=c.length;h<g;++h)f[h]=c[h].Get(0)}const b=[],d=function(){};e.Condition=class extends e.DefendedBase{constructor(c,f,h){super();this._eventBlock=c;this._runtime=c.GetRuntime();this._index=h;this._func=this._runtime.GetObjectReference(f[1]);this._isTrigger=0<f[3];this._isFastTrigger=2===f[3];this._isLooping=!!f[4];this._isInverted=!!f[5];this._isStatic=!!f[6];this._sid=f[7];this._isInOrBlock=this._eventBlock.IsOrBlock();this._behaviorType=this._objectClass=null;this._behaviorIndex=-1;this._systemPlugin=null;this.DebugRun=this.Run=d;this._parameters=[];this._results=[];this._anyParamVariesPerInstance=!1;this._unsavedData=this._savedData=null;this._debugData=this._runtime.IsDebug()?{isBreakpoint:f[8][0],canDebug:f[8][1]}:null;-1===f[0]?this._systemPlugin=this._runtime.GetSystemPlugin():(this._objectClass=this._runtime.GetObjectClassByIndex(f[0]),f[2]&&(this._behaviorType=this._objectClass.GetBehaviorTypeByName(f[2]),this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(f[2])),this._eventBlock.GetParent()&&this._eventBlock.GetParent().SetSolWriterAfterCnds());if(10===f.length){c=f[9];for(let g of c)this._parameters.push(e.Parameter.Create(this,g,this._parameters.length)),this._results.push(0)}0===this._parameters.length&&(this._results=this._parameters=b);this._eventBlock.GetEventSheetManager()._RegisterCondition(this)}static Create(c,f,h){return e.New(e.Condition,c,f,h)}_PostInit(){for(const c of this._parameters)c._PostInit(),c.VariesPerInstance()&&(this._anyParamVariesPerInstance=!0);this._isFastTrigger?(this.Run=this._RunFastTrigger,this.DebugRun=this._DebugRunFastTrigger):this._systemPlugin?(this._SetSystemRunMethod(),this.DebugRun=this._DebugRunSystem):this._objectClass.GetPlugin().IsSingleGlobal()?(this._SetSingleGlobalRunMethod(),this.DebugRun=this._DebugRunSingleGlobal):this._isStatic?(this.Run=this._RunStatic,this.DebugRun=this._DebugRunStatic):(this.Run=this._RunObject,this.DebugRun=this._DebugRunObject)}_SetSystemRunMethod(){this._SetRunMethodForBoundFunc(this._systemPlugin,this._systemPlugin,this._RunSystem)}_SetSingleGlobalRunMethod(){const c=this._objectClass.GetPlugin(),f=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();this._SetRunMethodForBoundFunc(c,f,this._RunSingleGlobal)}_SetRunMethodForBoundFunc(c,f,h){const g=this._func,l=this._isInverted,m=this._parameters;if(0===m.length){const u=c._GetBoundACEMethod(g,f);this.Run=l?function(){return e.xor(u(),l)}:u}else if(1===m.length){const u=m[0];if(!l&&u.IsConstant())this.Run=c._GetBoundACEMethod_1param(g,f,u.Get(0));else{const x=c._GetBoundACEMethod(g,f);this.Run=function(){return e.xor(x(u.Get(0)),l)}}}else if(2===m.length){const u=m[0],x=m[1];if(!l&&u.IsConstant()&&x.IsConstant())this.Run=c._GetBoundACEMethod_2params(g,f,u.Get(0),x.Get(0));else{const n=c._GetBoundACEMethod(g,f);this.Run=function(){return e.xor(n(u.Get(0),x.Get(0)),l)}}}else if(3===m.length){const u=m[0],x=m[1],n=m[2];if(!l&&u.IsConstant()&&x.IsConstant()&&n.IsConstant())this.Run=c._GetBoundACEMethod_3params(g,f,u.Get(0),x.Get(0),n.Get(0));else{const q=c._GetBoundACEMethod(g,f);this.Run=function(){return e.xor(q(u.Get(0),x.Get(0),n.Get(0)),l)}}}else this.Run=h}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(c){this._debugData.isBreakpoint=!!c;this._eventBlock._UpdateCanRunFastRecursive()}_DebugReturnsGenerator(){return this._debugData.canDebug}DebugCanRunFast(){return!this.IsBreakpoint()&&!this._runtime.DebugBreakNext()&&!this._DebugReturnsGenerator()}GetSavedDataMap(){this._savedData||(this._savedData=new Map);return this._savedData}GetUnsavedDataMap(){this._unsavedData||(this._unsavedData=new Map);return this._unsavedData}_RunSystem(){const c=this._results;a(this._parameters,c);return e.xor(this._func.apply(this._systemPlugin,c),this._isInverted)}*_DebugRunSystem(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var c=this._results;a(this._parameters,c);c=this._func.apply(this._systemPlugin,c);e.IsIterator(c)&&(c=yield*c);return e.xor(c,this._isInverted)}return this.Run()}_RunSingleGlobal(){const c=this._results;a(this._parameters,c);const f=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();return e.xor(this._func.apply(f,c),this._isInverted)}*_DebugRunSingleGlobal(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var c=this._results;a(this._parameters,c);const f=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();c=this._func.apply(f,c);e.IsIterator(c)&&(c=yield*c);return e.xor(c,this._isInverted)}return this.Run()}_RunFastTrigger(){return!0}*_DebugRunFastTrigger(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return!0}_RunStatic(){var c=this._results;a(this._parameters,c);c=this._func.apply(this._behaviorType||this._objectClass,c);this._objectClass.ApplySolToContainer();return c}*_DebugRunStatic(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var c=this._results;a(this._parameters,c);c=this._func.apply(this._behaviorType||this._objectClass,c);e.IsIterator(c)&&(c=yield*c);this._objectClass.ApplySolToContainer();return c}return this.Run()}_RunObject(){const c=this._parameters,f=this._results,h=this._objectClass.GetCurrentSol();for(let g=0,l=c.length;g<l;++g){const m=c[g];m.VariesPerInstance()||(f[g]=m.Get(0))}return h.IsSelectAll()?this._RunObject_FirstFilter(h):this._RunObject_NextFilter(h)}*_DebugRunObject(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return this._RunObject()}_EvaluateVaryingParameters(c){const f=this._parameters,h=this._results;for(let g=0,l=f.length;g<l;++g){const m=f[g];m.VariesPerInstance()&&(h[g]=m.Get(c))}}_RunObject_FirstFilter(c){const f=this._objectClass,h=f.IsFamily(),g=f.GetFamilyIndex(),l=this._behaviorIndex,m=0<=l,u=f.GetInstances(),x=this._anyParamVariesPerInstance,n=this._results,q=this._func,t=this._isInverted,r=this._isInOrBlock&&!this._isTrigger;c.ClearArrays();for(let y=0,B=u.length;y<B;++y){const E=u[y];x&&this._EvaluateVaryingParameters(y);var w=void 0;m?(w=h?E.GetObjectClass().GetFamilyBehaviorOffset(g):0,w=q.apply(E.GetBehaviorInstances()[l+w].GetSdkInstance(),n)):w=q.apply(E.GetSdkInstance(),n);e.xor(w,t)?c._PushInstance(E):r&&c._PushElseInstance(E)}f.FinishCondition(!0);c._SetSelectAll(!1);f.ApplySolToContainer();return c.HasAnyInstances()}_RunObject_NextFilter(c){const f=this._objectClass;var h=f.IsFamily();const g=f.GetFamilyIndex(),l=f.IsInContainer(),m=this._behaviorIndex,u=0<=m,x=this._anyParamVariesPerInstance,n=this._results,q=this._func,t=this._isInverted,r=this._isInOrBlock&&!this._isTrigger,w=c._GetOwnInstances(),y=c._GetOwnElseInstances(),B=r&&!this._eventBlock.IsFirstConditionOfType(this),E=B?y:w;let H=0,K=!1;for(let A=0,F=E.length;A<F;++A){const J=E[A];x&&this._EvaluateVaryingParameters(A);var C=void 0;u?(C=h?J.GetObjectClass().GetFamilyBehaviorOffset(g):0,C=q.apply(J.GetBehaviorInstances()[m+C].GetSdkInstance(),n)):C=q.apply(J.GetSdkInstance(),n);e.xor(C,t)?(K=!0,B?(w.push(J),l&&J._PushSiblingsToSolInstances()):(E[H]=J,l&&J._SetSiblingsToSolInstancesIndex(H),++H)):B?(E[H]=J,l&&J._SetSiblingsToSolElseInstancesIndex(H),++H):r&&(y.push(J),l&&J._PushSiblingsToSolElseInstances())}e.truncateArray(E,H);l&&f._TruncateContainerSols(B,H);h=K;B&&!K&&(K=this._OrBlockCheckInstances(w));f.FinishCondition(h||r);return r?K:c.HasAnyInstances()}_OrBlockCheckInstances(c){var f=this._objectClass;const h=f.IsFamily();f=f.GetFamilyIndex();const g=this._anyParamVariesPerInstance,l=this._behaviorIndex,m=0<=l,u=this._results,x=this._func,n=this._isInverted;for(let t=0,r=c.length;t<r;++t){var q=c[t];g&&this._EvaluateVaryingParameters(t);if(m){const w=h?q.GetObjectClass().GetFamilyBehaviorOffset(f):0;q=x.apply(q.GetBehaviorInstances()[l+w].GetSdkInstance(),u)}else q=x.apply(q.GetSdkInstance(),u);if(e.xor(q,n))return!0}return!1}ReevaluateParameter(c,f){return this._parameters[c].Get(f)}GetFastTriggerValue(){const c=this._parameters;if(!c.length)throw Error("no parameters");return c[0]._GetFastTriggerValue()}_SaveToJson(){if(!this._savedData||!this._savedData.size)return null;const c={};for(const[f,h]of this._savedData.entries()){let g=h;"collmemory"===f&&(g=[...h.entries()].map(l=>[l[0].GetUID(),l[1].GetUID(),l[2]]));c[f]=g}return{ex:c}}_LoadFromJson(c){this._savedData&&(this._savedData.clear(),this._savedData=null);if(c){var f=this._runtime,h=c.ex;if(h){c=this.GetSavedDataMap();c.clear();for(const[g,l]of Object.entries(h))h=l,"collmemory"===g&&(h=e.New(e.PairMap,l.map(m=>[f.GetInstanceByUID(m[0]),f.GetInstanceByUID(m[1]),m[2]]).filter(m=>m[0]&&m[1]))),c.set(g,h)}}}}}
  {"use strict";const e=self.C3;function a(f,h){for(let g=0,l=f.length;g<l;++g)h[g]=f[g].Get(0)}const b=[],d=function(){},c=function*(){};e.Action=class extends e.DefendedBase{constructor(f,h,g){super();this._eventBlock=f;this._runtime=f=f.GetRuntime();this._index=g;this._sid=4<=h.length?h[3]:-1;this._actionReturnType=5<=h.length?h[4]:0;this._behaviorType=this._objectClass=this._func=null;this._behaviorIndex=-1;this._systemPlugin=null;this._callFunctionName="";this._combinedSolModifiers=this._callEventBlock=null;this.DebugRun=this.Run=d;this._parameters=[];this._results=[];this._anyParamVariesPerInstance=!1;this._unsavedData=this._savedData=null;const l=(g=-3===h[0])?h[2]:h[5];this._debugData=f.IsDebug()||g?{isBreakpoint:l[0],canDebug:l[1],index:l[2]}:null;-1===h[0]?(this._systemPlugin=f.GetSystemPlugin(),this._func=f.GetObjectReference(h[1])):-2===h[0]?this._callFunctionName=h[1]:g?(this._func=f.GetObjectReference(h[1]),this.Run=this.RunUserScript,this.DebugRun=this.DebugRunUserScript,this._actionReturnType=1):(this._func=f.GetObjectReference(h[1]),this._objectClass=f.GetObjectClassByIndex(h[0]),h[2]&&(this._behaviorType=this._objectClass.GetBehaviorTypeByName(h[2]),this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(h[2])));if(7===h.length){h=h[6];for(const m of h)this._parameters.push(e.Parameter.Create(this,m,this._parameters.length)),this._results.push(0)}0===this._parameters.length&&(this._results=this._parameters=b);this._eventBlock.GetEventSheetManager()._RegisterAction(this)}static Create(f,h,g){return e.New(e.Action,f,h,g)}_PostInit(){for(var f of this._parameters)f._PostInit(),f.VariesPerInstance()&&(this._anyParamVariesPerInstance=!0);if(this._systemPlugin)this._SetSystemRunMethod(),this.DebugRun=this._DebugRunSystem;else if(this._callFunctionName)this._SetCallFunctionRunMethod(),this._callFunctionName="";else if(this.Run===this.RunUserScript){f=this._func;const h=this._runtime.GetEventSheetManager()._GetLocalVariablesScriptInterface(this._eventBlock);this._func=f.bind(null,this._runtime.GetIRuntime(),h)}else this._behaviorType?this.IsAsync()?(this.Run=this._RunBehavior_Async,this.DebugRun=this._DebugRunBehavior_Async):(this.Run=this._RunBehavior,this.DebugRun=this._DebugRunBehavior):this._objectClass.GetPlugin().IsSingleGlobal()?(this._SetSingleGlobalRunMethod(),this.DebugRun=this._DebugRunSingleGlobal):this.IsAsync()?(this.Run=this._RunObject_Async,this.DebugRun=this._DebugRunObject_Async):this._parameters.length?this._parameters.every(h=>h.VariesPerInstance())?(this.Run=this._RunObject_AllParamsVary,this.DebugRun=this._DebugRunObject_AllParamsVary):this._anyParamVariesPerInstance?(this.Run=this._RunObject_SomeParamsVary,this.DebugRun=this._DebugRunObject_SomeParamsVary):this._parameters.every(h=>h.IsConstant())?(a(this._parameters,this._results),this.Run=this._RunObject_ParamsConst,this.DebugRun=this._DebugRunObject_ParamsConst):(this.Run=this._RunObject_ParamsDontVary,this.DebugRun=this._DebugRunObject_ParamsDontVary):(this.Run=this._RunObject_ParamsConst,this.DebugRun=this._DebugRunObject_ParamsConst)}_SetSystemRunMethod(){this._SetRunMethodForBoundFunc(this._systemPlugin,this._systemPlugin,this._RunSystem)}_SetSingleGlobalRunMethod(){const f=this._objectClass.GetPlugin(),h=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();this._SetRunMethodForBoundFunc(f,h,this._RunSingleGlobal)}_SetCallFunctionRunMethod(){const f=this._eventBlock.GetEventSheetManager(),h=f.GetFunctionBlockByName(this._callFunctionName);h.IsEnabled()?(this._callEventBlock=h.GetEventBlock(),this._combinedSolModifiers=[...new Set([...this._eventBlock.GetSolModifiersIncludingParents(),...this._callEventBlock.GetSolModifiersIncludingParents()])],this._combinedSolModifiers=f._DeduplicateSolModifierList(this._combinedSolModifiers),this.Run=e.EventBlock.prototype.RunAsFunctionCall.bind(this._callEventBlock,this._combinedSolModifiers,this._parameters),this.DebugRun=this._DebugRunCallFunction):(this.Run=d,this.DebugRun=c)}_SetRunMethodForBoundFunc(f,h,g){const l=this._func,m=this._parameters;if(0===m.length)this.Run=f._GetBoundACEMethod(l,h);else if(1===m.length){const u=m[0];if(u.IsConstant())this.Run=f._GetBoundACEMethod_1param(l,h,u.Get(0));else{const x=f._GetBoundACEMethod(l,h);this.Run=function(){return x(u.Get(0))}}}else if(2===m.length){const u=m[0],x=m[1];if(u.IsConstant()&&x.IsConstant())this.Run=f._GetBoundACEMethod_2params(l,h,u.Get(0),x.Get(0));else{const n=f._GetBoundACEMethod(l,h);this.Run=function(){return n(u.Get(0),x.Get(0))}}}else if(3===m.length){const u=m[0],x=m[1],n=m[2];if(u.IsConstant()&&x.IsConstant()&&n.IsConstant())this.Run=f._GetBoundACEMethod_3params(l,h,u.Get(0),x.Get(0),n.Get(0));else{const q=f._GetBoundACEMethod(l,h);this.Run=function(){return q(u.Get(0),x.Get(0),n.Get(0))}}}else this.Run=g}GetSID(){return this._sid}IsAsync(){return 1===this._actionReturnType}CanBailOut(){return 2===this._actionReturnType}HasReturnType(){return 0!==this._actionReturnType}GetObjectClass(){return this._objectClass}GetEventBlock(){return this._eventBlock}GetRuntime(){return this._runtime}GetIndex(){return this._index}GetDebugIndex(){return this._debugData.index}GetCombinedSolModifiers(){return this._combinedSolModifiers}IsBreakpoint(){return this._debugData.isBreakpoint}_SetBreakpoint(f){this._debugData.isBreakpoint=!!f;this._eventBlock._UpdateCanRunFastRecursive()}_DebugReturnsGenerator(){return this._debugData.canDebug}DebugCanRunFast(){return!this.IsBreakpoint()&&!this._runtime.DebugBreakNext()&&!this._DebugReturnsGenerator()}GetSavedDataMap(){this._savedData||(this._savedData=new Map);return this._savedData}GetUnsavedDataMap(){this._unsavedData||(this._unsavedData=new Map);return this._unsavedData}_RunSystem(){const f=this._results;a(this._parameters,f);return this._func.apply(this._systemPlugin,f)}*_DebugRunSystem(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._results;a(this._parameters,f);return yield*this._func.apply(this._systemPlugin,f)}return this.Run()}*_DebugRunCallFunction(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return yield*this._callEventBlock.DebugRunAsFunctionCall(this._combinedSolModifiers,this._parameters)}_RunSingleGlobal(){const f=this._results;a(this._parameters,f);return this._func.apply(this._objectClass.GetSingleGlobalInstance().GetSdkInstance(),f)}*_DebugRunSingleGlobal(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._results;a(this._parameters,f);return yield*this._func.apply(this._objectClass.GetSingleGlobalInstance().GetSdkInstance(),f)}return this.Run()}_RunObject_ParamsConst(){const f=this._results,h=this._objectClass.GetCurrentSol().GetInstances();for(let g=0,l=h.length;g<l;++g)this._func.apply(h[g].GetSdkInstance(),f)}*_DebugRunObject_ParamsConst(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._results,h=this._objectClass.GetCurrentSol().GetInstances();for(let g=0,l=h.length;g<l;++g)yield*this._func.apply(h[g].GetSdkInstance(),f)}else this._RunObject_ParamsConst()}_RunObject_ParamsDontVary(){const f=this._results;a(this._parameters,f);const h=this._objectClass.GetCurrentSol().GetInstances();for(let g=0,l=h.length;g<l;++g)this._func.apply(h[g].GetSdkInstance(),f)}*_DebugRunObject_ParamsDontVary(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._results;a(this._parameters,f);const h=this._objectClass.GetCurrentSol().GetInstances();for(let g=0,l=h.length;g<l;++g)yield*this._func.apply(h[g].GetSdkInstance(),f)}else this._RunObject_ParamsDontVary()}_RunObject_AllParamsVary(){const f=this._parameters,h=this._results,g=this._func,l=this._objectClass.GetCurrentSol().GetInstances();for(let m=0,u=l.length;m<u;++m){const x=l[m];for(let n=0,q=f.length;n<q;++n)h[n]=f[n].Get(m);g.apply(x.GetSdkInstance(),h)}}*_DebugRunObject_AllParamsVary(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._parameters,h=this._results,g=this._func,l=this._objectClass.GetCurrentSol().GetInstances();for(let m=0,u=l.length;m<u;++m){const x=l[m];for(let n=0,q=f.length;n<q;++n)h[n]=f[n].Get(m);yield*g.apply(x.GetSdkInstance(),h)}}else this._RunObject_AllParamsVary()}_RunObject_SomeParamsVary(){const f=this._parameters,h=this._results,g=this._func,l=this._objectClass.GetCurrentSol().GetInstances();for(let u=0,x=f.length;u<x;++u){var m=f[u];m.VariesPerInstance()||(h[u]=m.Get(0))}for(let u=0,x=l.length;u<x;++u){m=l[u];for(let n=0,q=f.length;n<q;++n){const t=f[n];t.VariesPerInstance()&&(h[n]=t.Get(u))}g.apply(m.GetSdkInstance(),h)}}*_DebugRunObject_SomeParamsVary(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const h=this._parameters,g=this._results,l=this._func,m=this._objectClass.GetCurrentSol().GetInstances();for(let u=0,x=h.length;u<x;++u){var f=h[u];f.VariesPerInstance()||(g[u]=f.Get(0))}for(let u=0,x=m.length;u<x;++u){f=m[u];for(let n=0,q=h.length;n<q;++n){const t=h[n];t.VariesPerInstance()&&(g[n]=t.Get(u))}yield*l.apply(f.GetSdkInstance(),g)}}else this._RunObject_SomeParamsVary()}_RunBehavior(){var f=this._objectClass;const h=f.IsFamily(),g=f.GetFamilyIndex(),l=this._parameters,m=this._anyParamVariesPerInstance,u=this._results,x=this._func,n=this._behaviorIndex;f=f.GetCurrentSol().GetInstances();for(let r=0,w=l.length;r<w;++r){var q=l[r];q.VariesPerInstance()||(u[r]=q.Get(0))}for(let r=0,w=f.length;r<w;++r){q=f[r];if(m)for(let y=0,B=l.length;y<B;++y){var t=l[y];t.VariesPerInstance()&&(u[y]=t.Get(r))}t=h?q.GetObjectClass().GetFamilyBehaviorOffset(g):0;x.apply(q.GetBehaviorInstances()[n+t].GetSdkInstance(),u)}}*_DebugRunBehavior(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var f=this._objectClass;const l=f.IsFamily(),m=f.GetFamilyIndex(),u=this._parameters,x=this._anyParamVariesPerInstance,n=this._results,q=this._func,t=this._behaviorIndex;f=f.GetCurrentSol().GetInstances();for(let r=0,w=u.length;r<w;++r){var h=u[r];h.VariesPerInstance()||(n[r]=h.Get(0))}for(let r=0,w=f.length;r<w;++r){h=f[r];if(x)for(let y=0,B=u.length;y<B;++y){var g=u[y];g.VariesPerInstance()&&(n[y]=g.Get(r))}g=l?h.GetObjectClass().GetFamilyBehaviorOffset(m):0;yield*q.apply(h.GetBehaviorInstances()[t+g].GetSdkInstance(),n)}}else this._RunBehavior()}_RunObject_Async(){const f=this._parameters,h=this._results,g=this._func,l=this._objectClass.GetCurrentSol().GetInstances(),m=[];for(let u=0,x=l.length;u<x;++u){const n=l[u];for(let q=0,t=f.length;q<t;++q)h[q]=f[q].Get(u);m.push(g.apply(n.GetSdkInstance(),h))}return Promise.all(m)}*_DebugRunObject_Async(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._parameters,h=this._results,g=this._func,l=this._objectClass.GetCurrentSol().GetInstances(),m=[];for(let u=0,x=l.length;u<x;++u){const n=l[u];for(let q=0,t=f.length;q<t;++q)h[q]=f[q].Get(u);m.push(yield*g.apply(n.GetSdkInstance(),h))}return Promise.all(m)}return this._RunObject_Async()}_RunBehavior_Async(){var f=this._objectClass;const h=f.IsFamily(),g=f.GetFamilyIndex(),l=this._parameters,m=this._results,u=this._func,x=this._behaviorIndex;f=f.GetCurrentSol().GetInstances();const n=[];for(let q=0,t=f.length;q<t;++q){const r=f[q];for(let y=0,B=l.length;y<B;++y)m[y]=l[y].Get(q);const w=h?r.GetObjectClass().GetFamilyBehaviorOffset(g):0;n.push(u.apply(r.GetBehaviorInstances()[x+w].GetSdkInstance(),m))}return Promise.all(n)}*_DebugRunBehavior_Async(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var f=this._objectClass;const h=f.IsFamily(),g=f.GetFamilyIndex(),l=this._parameters,m=this._results,u=this._func,x=this._behaviorIndex;f=f.GetCurrentSol().GetInstances();const n=[];for(let q=0,t=f.length;q<t;++q){const r=f[q];for(let y=0,B=l.length;y<B;++y)m[y]=l[y].Get(q);const w=h?r.GetObjectClass().GetFamilyBehaviorOffset(g):0;n.push(yield*u.apply(r.GetBehaviorInstances()[x+w].GetSdkInstance(),m))}return Promise.all(n)}return this._RunBehavior_Async()}async RunUserScript(){try{await this._func()}catch(f){console.error(`Unhandled exception running script %c${this._eventBlock.GetEventSheet().GetName()}, event ${this._eventBlock.GetDisplayNumber()}, action ${this.GetDebugIndex()+1}:`,"font-size: 1.2em; font-weight: bold;",f),self.C3Debugger&&self.C3Debugger._SetLastErrorScript(this),e.EventScript.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"),e.EventScript.SetHadUserScriptException())}}*DebugRunUserScript(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return this.RunUserScript()}_SaveToJson(){return this._savedData&&this._savedData.size?{ex:e.ToSuperJSON(this._savedData)}:null}_LoadFromJson(f){this._savedData&&(this._savedData.clear(),this._savedData=null);f&&(f=f.ex)&&(this._savedData=e.FromSuperJSON(f))}}}
  {"use strict";const e=self.C3,a=new e.Color;function b(N,P){return e.compare(this.GetWorldInfo().GetX(),N,P)}function d(N,P){return e.compare(this.GetWorldInfo().GetY(),N,P)}function c(){const N=this.GetWorldInfo(),P=N.GetLayer();return P.Has3DCamera()?N.IsInViewport3D(P._GetViewFrustum()):N.IsInViewport(P.GetViewport(),N.GetLayout().HasVanishingPointOutsideViewport(),N.GetLayout().IsOrthographicProjection())}function f(){var N=this.GetWorldInfo();const P=N.GetLayout();N=N.GetBoundingBox();return 0>N.getRight()||0>N.getBottom()||N.getLeft()>P.GetWidth()||N.getTop()>P.GetHeight()}function h(N,P,W){const Z=this.GetCurrentSol(),fa=Z.GetInstances();if(!fa.length)return!1;let ha=fa[0];var ka=ha.GetWorldInfo();let sa=ha,ma=e.distanceSquared(ka.GetX(),ka.GetY(),P,W);for(let xa=1,ya=fa.length;xa<ya;++xa)if(ha=fa[xa],ka=ha.GetWorldInfo(),ka=e.distanceSquared(ka.GetX(),ka.GetY(),P,W),0===N&&ka<ma||1===N&&ka>ma)ma=ka,sa=ha;Z.PickOne(sa);return!0}function g(N){const P=this.GetWorldInfo();P.GetX()!==N&&(P.SetX(N),P.SetBboxChanged())}function l(N){const P=this.GetWorldInfo();P.GetY()!==N&&(P.SetY(N),P.SetBboxChanged())}function m(N,P){const W=this.GetWorldInfo();W.EqualsXY(N,P)||(W.SetXY(N,P),W.SetBboxChanged())}function u(N,P){if(N&&(N=N.GetPairedInstance(this._inst))){var[W,Z]=N.GetImagePoint(P);P=this.GetWorldInfo();if(P.GetX()!==W||P.GetY()!==Z)P.SetXY(W,Z),P.SetBboxChanged()}}function x(N){if(0!==N){var P=this.GetWorldInfo();P.OffsetXY(P.GetCosAngle()*N,P.GetSinAngle()*N);P.SetBboxChanged()}}
  function n(N,P){if(0!==P){var W=this.GetWorldInfo();N=e.toRadians(N);W.OffsetXY(Math.cos(N)*P,Math.sin(N)*P);W.SetBboxChanged()}}function q(){return this.GetWorldInfo().GetX()}function t(){return this.GetWorldInfo().GetY()}function r(){return this._runtime.GetDt(this._inst)}function w(N,P){return e.compare(this.GetWorldInfo().GetWidth(),N,P)}function y(N,P){return e.compare(this.GetWorldInfo().GetHeight(),N,P)}function B(N){const P=this.GetWorldInfo();P.GetWidth()!==N&&(P.SetWidth(N),P.SetBboxChanged())}
  function E(N){const P=this.GetWorldInfo();P.GetHeight()!==N&&(P.SetHeight(N),P.SetBboxChanged())}function H(N,P){const W=this.GetWorldInfo();if(W.GetWidth()!==N||W.GetHeight()!==P)W.SetSize(N,P),W.SetBboxChanged()}function K(){return this.GetWorldInfo().GetWidth()}function C(){return this.GetWorldInfo().GetHeight()}function A(){return this.GetWorldInfo().GetBoundingBox().getLeft()}function F(){return this.GetWorldInfo().GetBoundingBox().getTop()}function J(){return this.GetWorldInfo().GetBoundingBox().getRight()}
  function L(){return this.GetWorldInfo().GetBoundingBox().getBottom()}function R(N,P){return e.angleDiff(this.GetWorldInfo().GetAngle(),e.toRadians(P))<=e.toRadians(N)}function T(N){return e.angleClockwise(this.GetWorldInfo().GetAngle(),e.toRadians(N))}function V(N,P){N=e.toRadians(N);P=e.toRadians(P);const W=this.GetWorldInfo().GetAngle();return e.angleClockwise(P,N)?e.angleClockwise(W,N)&&!e.angleClockwise(W,P):!(!e.angleClockwise(W,N)&&e.angleClockwise(W,P))}function ba(N){const P=this.GetWorldInfo();N=e.clampAngle(e.toRadians(N));isNaN(N)||P.GetAngle()===N||(P.SetAngle(N),P.SetBboxChanged())}function ia(N){if(!isNaN(N)&&0!==N){var P=this.GetWorldInfo();P.SetAngle(P.GetAngle()+e.toRadians(N));P.SetBboxChanged()}}function ja(N){if(!isNaN(N)&&0!==N){var P=this.GetWorldInfo();P.SetAngle(P.GetAngle()-e.toRadians(N));P.SetBboxChanged()}}function qa(N,P){const W=this.GetWorldInfo(),Z=W.GetAngle();N=e.angleRotate(Z,e.toRadians(P),e.toRadians(N));isNaN(N)||Z===N||(W.SetAngle(N),W.SetBboxChanged())}function za(N,P,W){const Z=this.GetWorldInfo(),fa=Z.GetAngle();P-=Z.GetX();W-=Z.GetY();N=e.angleRotate(fa,Math.atan2(W,P),e.toRadians(N));isNaN(N)||fa===N||(Z.SetAngle(N),Z.SetBboxChanged())}function Ca(N,P){const W=this.GetWorldInfo(),Z=W.GetAngle();N-=W.GetX();P-=W.GetY();P=Math.atan2(P,N);isNaN(P)||Z===P||(W.SetAngle(P),W.SetBboxChanged())}function Ma(){return e.toDegrees(this.GetWorldInfo().GetAngle())}function Fa(N,P){return e.compare(e.round6dp(100*this.GetWorldInfo().GetOpacity()),N,P)}function La(){return this.GetWorldInfo().IsVisible()}
  function na(N){const P=this.GetWorldInfo();N=2===N?!P.IsVisible():0!==N;P.IsVisible()!==N&&(P.SetVisible(N),this._runtime.UpdateRender())}function Sa(N){N=e.clamp(N/100,0,1);const P=this.GetWorldInfo();P.GetOpacity()!==N&&(P.SetOpacity(N),this._runtime.UpdateRender())}function Aa(N){a.setFromRgbValue(N);N=this.GetWorldInfo();N.GetUnpremultipliedColor().equalsIgnoringAlpha(a)||(N.SetUnpremultipliedColor(a),this._runtime.UpdateRender())}function Na(){const N=this.GetWorldInfo().GetUnpremultipliedColor();return e.PackRGBAEx(N.getR(),N.getG(),N.getB(),N.getA())}function lb(){return e.round6dp(100*this.GetWorldInfo().GetOpacity())}function mb(N){return N?this.GetWorldInfo().GetLayer()===N:!1}function nb(N){const P=this.GetCurrentSol(),W=P.GetInstances();if(!W.length)return!1;let Z=W[0];for(let fa=1,ha=W.length;fa<ha;++fa){const ka=W[fa],sa=ka.GetWorldInfo(),ma=Z.GetWorldInfo(),xa=sa.GetLayer().GetIndex(),ya=ma.GetLayer().GetIndex();if(0===N){if(xa>ya||xa===ya&&sa.GetZIndex()>ma.GetZIndex())Z=ka}else if(xa<ya||xa===ya&&sa.GetZIndex()<ma.GetZIndex())Z=ka}P.PickOne(Z);return!0}function ab(N,P,W){const Z=this.GetWorldInfo();N=0===N?Z.GetZElevation():Z.GetTotalZElevation();return e.compare(N,P,W)}function ob(){this.GetWorldInfo().ZOrderMoveToTop()}function pb(){this.GetWorldInfo().ZOrderMoveToBottom()}function qb(N){N&&this.GetWorldInfo().ZOrderMoveToLayer(N)}function rb(N,P){N=0===N;P&&(P=P.GetFirstPicked(this.GetInstance()))&&this.GetWorldInfo().ZOrderMoveAdjacentToInstance(P,N)}function sb(N){const P=this.GetWorldInfo();P.GetZElevation()!==N&&(P.SetZElevation(N),this._runtime.UpdateRender())}function tb(){return this.GetWorldInfo().GetLayer().GetIndex()}function ub(){return this.GetWorldInfo().GetLayer().GetName()}function bb(){return this.GetWorldInfo().GetZIndex()}function vb(){return this.GetWorldInfo().GetZElevation()}function wb(){return this.GetWorldInfo().GetTotalZElevation()}function xb(N,P){if(P=this.GetObjectClass().GetEffectList().GetEffectTypeByName(P)){P=P.GetIndex();N=1===N;var W=this.GetWorldInfo().GetInstanceEffectList();W.IsEffectIndexActive(P)!==N&&(W.SetEffectIndexActive(P,N),W.UpdateActiveEffects(),this._runtime.UpdateRender())}}function yb(N,P,W){var Z=this.GetObjectClass().GetEffectList().GetEffectTypeByName(N);if(Z){N=Z.GetIndex();var fa=this.GetWorldInfo().GetInstanceEffectList(),ha=fa.GetEffectParametersForIndex(N);P=Math.floor(P);if(!(0>P||P>=ha.length)){Z=Z.GetShaderProgram().GetParameterType(P);if("color"===Z){a.setFromRgbValue(W);P=ha[P];if(a.equalsIgnoringAlpha(P))return;P.copyRgb(a)}else{"percent"===Z&&(W/=100);if(ha[P]===W)return;ha[P]=W}fa.IsEffectIndexActive(N)&&this._runtime.UpdateRender()}}}const cb=e.New(e.Rect),Xa=[],db=[];let eb=!1,Ya=null,fb=!1;const Ta=new Set;function gb(N,P,W,Z){const fa=P.GetUID(),ha=W.GetUID();fa<ha?N.Set(P,W,Z):N.Set(W,P,Z)}function ra(N,P,W){const Z=P.GetUID(),fa=W.GetUID();Z<fa?N.Delete(P,W):N.Delete(W,P)}function Qa(N,P){N.DeleteEither(P)}function zb(N,P,W){const Z=P.GetUID(),fa=W.GetUID();return Z<fa?N.Get(P,W):N.Get(W,P)}function Ab(N,P,W,Z){if(!P)return!1;N=N.GetInstance();const fa=0!==W||0!==Z,ha=N.GetWorldInfo(),ka=N.GetRuntime(),sa=ka.GetCollisionEngine();var ma=ka.GetCurrentCondition();const xa=ma.GetEventBlock().IsOrBlock();var ya=ma.GetObjectClass();ma=ma.IsInverted();const Ka=P.GetCurrentSol();ya=ya!==P;Ya=P;eb=ya&&!ma;fb=!1;let Ra=0,Ea=0,la=!1;Ka.IsSelectAll()?(cb.copy(ha.GetBoundingBox()),cb.offset(W,Z),sa.GetCollisionCandidates(ha.GetLayer(),P,cb,db),P=db):xa?ka.IsCurrentConditionFirst()&&!Ka._GetOwnElseInstances().length&&Ka._GetOwnInstances().length?P=Ka._GetOwnInstances():(P=Ka._GetOwnElseInstances(),fb=!0):P=Ka._GetOwnInstances();fa&&(Ra=ha.GetX(),Ea=ha.GetY(),ha.OffsetXY(W,Z),ha.SetBboxChanged());for(const da of P)if(sa.TestOverlap(N,da)){la=!0;if(ma)break;ya&&Ta.add(da)}fa&&(ha.SetXY(Ra,Ea),ha.SetBboxChanged());e.clearArray(db);return la}function Db(N){N=N.GetRuntime().GetCurrentEvent().IsOrBlock();const P=Ya.GetCurrentSol(),W=P._GetOwnInstances(),Z=P._GetOwnElseInstances();P.IsSelectAll()?(P.SetSetPicked(Ta),N&&(e.clearArray(Z),P.AddElseInstances(Ta,Ya.GetInstances()))):N?fb?P.TransferElseInstancesToOwn(Ta):(P.AddElseInstances(Ta,W),P.SetSetPicked(Ta)):P.SetSetPicked(Ta);Ya.ApplySolToContainer()}function Eb(N,P){eb&&(P&&Db(N),Ta.clear(),Ya=null,eb=!1)}function Fb(N){if(this._runtime.IsDebugging())return Gb.call(this,N);if(!N)return!1;var P=this._runtime;const W=P.GetCollisionEngine(),Z=P.GetEventSheetManager(),fa=Z.GetEventStack();var ha=Z.GetCurrentCondition();const ka=ha.GetObjectClass();var sa=ha.GetSavedDataMap(),ma=ha.GetUnsavedDataMap();ha=fa.GetCurrentStackFrame();const xa=P.GetTickCount(),ya=xa-1,Ka=ha.GetCurrentEvent(),Ra=fa.Push(Ka);let Ea=sa.get("collmemory");Ea||(Ea=e.New(e.PairMap),sa.set("collmemory",Ea));ma.get("collisionCreatedDestroyCallback")||(ma.set("collisionCreatedDestroyCallback",!0),P.Dispatcher().addEventListener("instancedestroy",Ua=>Qa(Ea,Ua.instance)));sa=ka.GetCurrentSol();P=N.GetCurrentSol();sa=sa.GetInstances();ma=null;for(let Ua=0;Ua<sa.length;++Ua){const Da=sa[Ua];P.IsSelectAll()?(W.GetCollisionCandidates(Da.GetWorldInfo().GetLayer(),N,Da.GetWorldInfo().GetBoundingBox(),Xa),ma=Xa,W.AddRegisteredCollisionCandidates(Da,N,ma)):ma=P.GetInstances();for(let $a=0;$a<ma.length;++$a){const Pa=ma[$a];if(W.TestOverlap(Da,Pa)||W.CheckRegisteredCollision(Da,Pa)){var la=zb(Ea,Da,Pa),da=!1,oa=-2;"number"===typeof la&&(da=!0,oa=la);la=!da||oa<ya;gb(Ea,Da,Pa,xa);la&&(la=Ka.GetSolModifiers(),Z.PushCopySol(la),oa=ka.GetCurrentSol(),da=N.GetCurrentSol(),oa._SetSelectAll(!1),da._SetSelectAll(!1),ka===N?(da=oa._GetOwnInstances(),e.clearArray(da),da.push(Da),da.push(Pa),ka.ApplySolToContainer()):(oa=oa._GetOwnInstances(),da=da._GetOwnInstances(),e.clearArray(oa),e.clearArray(da),oa.push(Da),da.push(Pa),ka.ApplySolToContainer(),N.ApplySolToContainer()),Ka.Retrigger(ha,Ra),Z.PopSol(la))}else ra(Ea,Da,Pa)}e.clearArray(Xa)}fa.Pop();return!1}function*Gb(N){if(!N)return!1;var P=this._runtime;const W=P.GetCollisionEngine(),Z=P.GetEventSheetManager(),fa=Z.GetEventStack(),ha=fa.GetCurrentStackFrame(),ka=P.GetTickCount(),sa=ka-1,ma=ha.GetCurrentEvent(),xa=fa.Push(ma);var ya=Z.GetCurrentCondition();const Ka=ya.GetObjectClass();var Ra=ya.GetSavedDataMap();ya=ya.GetUnsavedDataMap();let Ea=Ra.get("collmemory");Ea||(Ea=e.New(e.PairMap),Ra.set("collmemory",Ea));ya.get("collisionCreatedDestroyCallback")||(ya.set("collisionCreatedDestroyCallback",!0),P.Dispatcher().addEventListener("instancedestroy",Ua=>Qa(Ea,Ua.instance)));Ra=Ka.GetCurrentSol();P=N.GetCurrentSol();Ra=Ra.GetInstances();ya=null;for(let Ua=0;Ua<Ra.length;++Ua){const Da=Ra[Ua];P.IsSelectAll()?(W.GetCollisionCandidates(Da.GetWorldInfo().GetLayer(),N,Da.GetWorldInfo().GetBoundingBox(),Xa),ya=Xa,W.AddRegisteredCollisionCandidates(Da,N,ya)):ya=P.GetInstances();for(let $a=0;$a<ya.length;++$a){const Pa=ya[$a];if(W.TestOverlap(Da,Pa)||W.CheckRegisteredCollision(Da,Pa)){var la=zb(Ea,Da,Pa),da=!1,oa=-2;"number"===typeof la&&(da=!0,oa=la);la=!da||oa<sa;gb(Ea,Da,Pa,ka);la&&(la=ma.GetSolModifiers(),Z.PushCopySol(la),oa=Ka.GetCurrentSol(),da=N.GetCurrentSol(),oa._SetSelectAll(!1),da._SetSelectAll(!1),Ka===N?(da=oa._GetOwnInstances(),e.clearArray(da),da.push(Da),da.push(Pa),Ka.ApplySolToContainer()):(oa=oa._GetOwnInstances(),da=da._GetOwnInstances(),e.clearArray(oa),e.clearArray(da),oa.push(Da),da.push(Pa),Ka.ApplySolToContainer(),N.ApplySolToContainer()),yield*ma.DebugRetrigger(ha,xa),Z.PopSol(la))}else ra(Ea,Da,Pa)}e.clearArray(Xa)}fa.Pop();return!1}function hb(N){return Ab(this,N,0,0)}function ib(N,P,W){return Ab(this,N,P,W)}function jb(){return this.GetWorldInfo().HasParent()}
  function kb(){return this.GetWorldInfo().HasChildren()}function Za(N,P){const W=this.GetCurrentSol().GetInstances();if(0===W.length)return!1;const Z=N.GetCurrentSol();var fa=Z.GetInstances();if(0===fa.length)return!1;fa=new Set(fa);const ha=new Set;for(let sa=0,ma=W.length;sa<ma;++sa){var ka=W[sa];if(1===P)for(const xa of ka.parents())xa.BelongsToObjectClass(N)&&fa.has(xa)&&ha.add(xa);else{if(0===P){if(ka=ka.GetParent(),null===ka)continue}else ka=ka.GetTopParent();ka.BelongsToObjectClass(N)&&fa.has(ka)&&ha.add(ka)}}if(0===ha.size)return!1;Z.SetSetPicked(ha);N.ApplySolToContainer();return!0}function k(N,P){const W=this.GetCurrentSol().GetInstances();if(0===W.length)return!1;const Z=N.GetCurrentSol();var fa=Z.GetInstances();if(Z.IsSelectAll()){var ha=[...this._runtime.instancesPendingCreateForObjectClass(N)];0<ha.length&&(fa=fa.concat(ha))}if(0===fa.length)return!1;fa=new Set(fa);ha=new Set;for(let ka=0,sa=W.length;ka<sa;++ka){const ma=W[ka];2===P&&!ma.HasChildren()&&ma.BelongsToObjectClass(N)&&fa.has(ma)&&ha.add(ma);for(const xa of 0===P?ma.children():ma.allChildren())2===P&&xa.HasChildren()||xa.BelongsToObjectClass(N)&&fa.has(xa)&&ha.add(xa)}if(0===ha.size)return!1;Z.SetSetPicked(ha);N.ApplySolToContainer();return!0}function p(N,P){const W=this.GetCurrentSol().GetInstances();if(0===W.length)return!1;const Z=N.GetCurrentSol();var fa=Z.GetInstances();if(Z.IsSelectAll()){var ha=[...this._runtime.instancesPendingCreateForObjectClass(N)];0<ha.length&&(fa=fa.concat(ha))}if(0===fa.length)return!1;fa=new Set(fa);ha=[];for(let ka=0,sa=W.length;ka<sa;++ka){const ma=W[ka].GetChildAt(P);null!==ma&&ma.BelongsToObjectClass(N)&&fa.has(ma)&&ha.push(ma)}if(0===ha.length)return!1;Z.SetArrayPicked(ha);N.ApplySolToContainer();return!0}function v(N,P){return e.compare(this._inst.GetChildCount(),N,P)}function z(N,P,W,Z,fa,ha,ka,sa){const ma=this._inst,xa=this._runtime.GetCurrentAction().GetObjectClass();for(const ya of N.allCorrespondingInstances(ma,xa)){if(!ya.GetPlugin().SupportsSceneGraph())break;ma.AddChild(ya,{transformX:P,transformY:W,transformWidth:Z,transformHeight:fa,transformAngle:ha,transformZElevation:ka,destroyWithParent:sa})}}function D(N){const P=this._inst,W=this._runtime.GetCurrentAction().GetObjectClass();for(const Z of N.allCorrespondingInstances(P,W))P.RemoveChild(Z)}function G(){this._inst.HasParent()&&this._inst.GetParent().RemoveChild(this._inst)}function I(){return this._inst.GetChildCount()}function M(N,P){N=Math.floor(N);P=Math.floor(P);const W=this.GetWorldInfo();2>N||2>P||!isFinite(N)||!isFinite(P)?(W.ReleaseMesh(),W.SetBboxChanged()):W.CreateMesh(N,P)}function O(N,P,W,Z,fa,ha,ka,sa){const ma=this.GetWorldInfo();ma.SetMeshPoint(N,P,{mode:0===W?"absolute":"relative",x:Z,y:fa,zElevation:ha,u:ka,v:sa})&&ma.SetBboxChanged()}function Q(){const N=this.GetWorldInfo();return N.HasMesh()?N.GetSourceMesh().GetHSize():0}function S(){const N=this.GetWorldInfo();return N.HasMesh()?N.GetSourceMesh().GetVSize():0}function U(N){const P=this.GetWorldInfo();N=2===N?!P.IsVisible():0!==N;P.IsVisible()!==N&&P.SetVisible(N)}
  function Y(N,P){this.SetElementCSSStyle(N,P)}function X(N,P){this.SetElementAttribute(N,""+P)}function ea(N){this.RemoveElementAttribute(N)}function ca(){this.FocusElement()}function aa(){this.BlurElement()}function wa(){return this.IsElementFocused()}function pa(N){this._SetEnabled(0!==N)}function ua(){return this._IsEnabled()}function va(N,P,W){return e.compare(this.GetInstance().GetInstanceVariableValue(N),P,W)}function ta(N){return!!this.GetInstance().GetInstanceVariableValue(N)}function Ga(N,P){const W=this.GetCurrentSol(),Z=W.GetInstances();if(!Z.length)return!1;let fa=Z[0],ha=fa,ka=fa.GetInstanceVariableValue(P);for(let sa=1,ma=Z.length;sa<ma;++sa){fa=Z[sa];const xa=fa.GetInstanceVariableValue(P);if(0===N&&xa<ka||1===N&&xa>ka)ka=xa,ha=fa}W.PickOne(ha);return!0}function Ha(N){return this._runtime.GetCurrentCondition().IsInverted()?Ja(this,N):Ia(this,N)}function Ia(N,P){P=N.GetRuntime().GetInstanceByUID(P);if(!P)return!1;const W=N.GetCurrentSol();if(!W.IsSelectAll()&&!W._GetOwnInstances().includes(P))return!1;if(N.IsFamily()){if(P.GetObjectClass().BelongsToFamily(N))return W.PickOne(P),N.ApplySolToContainer(),!0}else if(P.GetObjectClass()===N)return W.PickOne(P),N.ApplySolToContainer(),!0;return!1}function Ja(N,P){const W=N.GetCurrentSol();if(W.IsSelectAll()){W._SetSelectAll(!1);W.ClearArrays();var Z=N.GetInstances();for(let ha=0,ka=Z.length;ha<ka;++ha){var fa=Z[ha];fa.GetUID()===P?W._PushElseInstance(fa):W._PushInstance(fa)}N.ApplySolToContainer();return!!W._GetOwnInstances().length}Z=W._GetOwnInstances();fa=0;for(let ha=0,ka=Z.length;ha<ka;++ha){const sa=Z[ha];Z[fa]=sa;sa.GetUID()===P?W._PushElseInstance(sa):++fa}e.truncateArray(Z,fa);N.ApplySolToContainer();return!!Z.length}function Oa(){this._runtime.DestroyInstance(this._inst)}function Va(){return!0}function Wa(){return!0}function Ba(N,P){this.GetInstance().SetInstanceVariableValue(N,P)}function Bb(N,P){const W=this.GetInstance(),Z=W.GetInstanceVariableValue(N);"number"===typeof Z&&"number"!==typeof P?P=parseFloat(P):"string"===typeof Z&&"string"!==typeof P&&(P=P.toString());W.SetInstanceVariableValue(N,Z+P)}function Cb(N,P){const W=this.GetInstance(),Z=W.GetInstanceVariableValue(N);"number"===typeof Z&&("number"!==typeof P&&(P=parseFloat(P)),W.SetInstanceVariableValue(N,Z-P))}function Hb(N,P){this.GetInstance().SetInstanceVariableValue(N,P?1:0)}function Ib(N){const P=this.GetInstance();P.SetInstanceVariableValue(N,0===P.GetInstanceVariableValue(N)?1:0)}function Jb(N){let P;try{P=JSON.parse(N)}catch(W){console.error("Failed to load from JSON string: ",W);return}N=this.GetInstance();N._OnBeforeLoad("state");N.LoadFromJson(P,"state")}function Kb(){return JSON.stringify(this.GetInstance().SaveToJson("state"))}function Lb(){return this.GetInstance().GetObjectClass().GetName()}function Mb(){const N=this._runtime.GetCurrentEventStackFrame().GetExpressionObjectClass();let P=N.GetInstanceCount();for(const W of this._runtime.instancesPendingCreateForObjectClass(N))++P;return P}function Nb(){return this._runtime.GetCurrentEventStackFrame().GetExpressionObjectClass().GetCurrentSol().GetInstances().length}
  function Ob(){return this._inst.GetIID()}function Pb(){return this._inst.GetUID()}e.AddCommonACEs=function(N,P){const W=N[1],Z=N[4],fa=N[5],ha=N[6],ka=N[7],sa=N[8],ma=N[10],xa=N[11],ya=N[12],Ka=N[13],Ra=N[14],Ea=N[15],la=P.Cnds,da=P.Acts,oa=P.Exps;N[3]&&(la.CompareX=b,la.CompareY=d,la.IsOnScreen=c,la.IsOutsideLayout=f,la.PickDistance=h,da.SetX=g,da.SetY=l,da.SetPos=m,da.SetPosToObject=u,da.MoveForward=x,da.MoveAtAngle=n,oa.X=q,oa.Y=t,oa.dt=r);Z&&(la.CompareWidth=w,la.CompareHeight=y,da.SetWidth=B,da.SetHeight=E,da.SetSize=H,oa.Width=K,oa.Height=C,oa.BBoxLeft=A,oa.BBoxTop=F,oa.BBoxRight=J,oa.BBoxBottom=L);fa&&(la.AngleWithin=R,la.IsClockwiseFrom=T,la.IsBetweenAngles=V,da.SetAngle=ba,da.RotateClockwise=ia,da.RotateCounterclockwise=ja,da.RotateTowardAngle=qa,da.RotateTowardPosition=za,da.SetTowardPosition=Ca,oa.Angle=Ma);ha&&(la.IsVisible=La,la.CompareOpacity=Fa,da.SetVisible=na,da.SetOpacity=Sa,da.SetDefaultColor=Aa,oa.Opacity=lb,oa.ColorValue=Na);ka&&(la.IsOnLayer=mb,la.PickTopBottom=nb,la.CompareZElevation=ab,da.MoveToTop=ob,da.MoveToBottom=pb,da.MoveToLayer=qb,da.ZMoveToObject=rb,da.SetZElevation=sb,oa.LayerNumber=tb,oa.LayerName=ub,oa.ZIndex=bb,oa.ZElevation=vb,oa.TotalZElevation=wb);sa&&(da.SetEffectEnabled=xb,da.SetEffectParam=yb);Ka&&(la.HasParent=jb,la.HasChildren=kb,la.PickParent=Za,la.PickChildren=k,la.PickNthChild=p,la.CompareChildCount=v,da.AddChild=z,da.RemoveChild=D,da.RemoveFromParent=G,oa.ChildCount=I);Ra&&(da.SetMeshSize=M,da.SetMeshPoint=O,oa.MeshColumns=Q,oa.MeshRows=S);ma&&(la.IsVisible=La,da.SetVisible=U,da.SetCSSStyle=Y,da.SetElemAttribute=X,da.RemoveElemAttribute=ea);xa&&(la.IsFocused=wa,da.SetFocus=ca,da.SetBlur=aa);ya&&(la.IsEnabled=ua,da.SetEnabled=pa);Ea&&(la.OnCollision=Fb,la.IsOverlapping=hb,la.IsOverlappingOffset=ib,P.FinishCollisionCondition=Eb);W||(la.CompareInstanceVar=va,la.IsBoolInstanceVarSet=ta,la.PickInstVarHiLow=Ga,la.PickByUID=Ha,da.SetInstanceVar=Ba,da.AddInstanceVar=Bb,da.SubInstanceVar=Cb,da.SetBoolInstanceVar=Hb,da.ToggleBoolInstanceVar=Ib,la.OnCreated=Va,la.OnDestroyed=Wa,da.Destroy=Oa,da.LoadFromJsonString||(da.LoadFromJsonString=Jb),oa.AsJSON||(oa.AsJSON=Kb),oa.Count=Mb,oa.PickedCount=Nb,oa.IID=Ob,oa.UID=Pb,oa.ObjectTypeName=Lb)}}
  {"use strict";const e=self.C3;e.ScheduledWait=class extends e.DefendedBase{constructor(a){super();this._eventSheetManager=a;this._type="";this._time=-1;this._signalTag="";this._isSignalled=!1;this._event=null;this._actIndex=0;this._solModifiers=[];this._sols=new Map;this._callingFunctionBlock=null;this._asyncId=-1;this._functionInnerLocalVars=this._functionParameters=null;this._shouldRelease=!1}Release(){this._type="";this._time=-1;this._signalTag="";this._functionInnerLocalVars=this._functionParameters=this._callingFunctionBlock=this._event=null;this._asyncId=-1;e.clearArray(this._solModifiers);for(const a of this._sols.values())a.Release();this._sols.clear()}_Init(){var a=this._eventSheetManager,b=a.GetRuntime().GetAllObjectClasses();const d=a.GetCurrentEventStackFrame();this._event=d.GetCurrentEvent();this._actIndex=d.GetActionIndex()+1;if(a=a.FindFirstFunctionBlockParent(this._event))this._callingFunctionBlock=a,this._functionParameters=a.CaptureFunctionParameters(),this._functionInnerLocalVars=a._GetAllInnerLocalVariables().map(c=>c.GetValue()),a.IsAsync()&&(this._asyncId=a.PauseCurrentAsyncFunction());for(const c of b)if(b=c.GetCurrentSol(),!b.IsSelectAll()||this._event.HasSolModifier(c))this._solModifiers.push(c),this._sols.set(c,e.New(e.SolState,b))}InitTimer(a){this._type="timer";this._Init();this._time=this._eventSheetManager.GetRuntime().GetGameTime()+a}InitSignal(a){this._type="signal";this._Init();this._signalTag=a.toLowerCase()}InitPromise(a){this._type="promise";this._Init();a.then(()=>this.SetSignalled()).catch(b=>{console.warn("[C3 runtime] Promise rejected in 'Wait for previous actions to complete': ",b);this.SetSignalled()})}IsTimer(){return"timer"===this._type}IsSignal(){return"signal"===this._type}IsPromise(){return"promise"===this._type}GetSignalTag(){return this._signalTag}IsSignalled(){return this._isSignalled}SetSignalled(){this._isSignalled=!0}_ShouldRun(){return this.IsTimer()?this._time<=this._eventSheetManager.GetRuntime().GetGameTime():this.IsSignalled()}_RestoreState(a){a._Restore(this._event,this._actIndex);for(const[b,d]of this._sols.entries())a=b.GetCurrentSol(),d._Restore(a);if(a=this._callingFunctionBlock)a.SetFunctionParameters(this._functionParameters),a._GetAllInnerLocalVariables().map((b,d)=>b.SetValue(this._functionInnerLocalVars[d])),a.IsAsync()&&a.ResumeAsyncFunction(this._asyncId)}_Run(a){this._RestoreState(a);this._event._ResumeActionsAndSubEvents(a);this._callingFunctionBlock&&this._callingFunctionBlock.IsAsync()&&this._callingFunctionBlock.MaybeFinishAsyncFunctionCall(this._asyncId);this._eventSheetManager.ClearSol(this._solModifiers);this._shouldRelease=!0}async _DebugRun(a){this._RestoreState(a);for(const b of this._event._DebugResumeActionsAndSubEvents(a))await this._eventSheetManager.GetRuntime().DebugBreak(b);this._callingFunctionBlock&&this._callingFunctionBlock.IsAsync()&&this._callingFunctionBlock.MaybeFinishAsyncFunctionCall(this._asyncId);this._eventSheetManager.ClearSol(this._solModifiers);this._shouldRelease=!0}ShouldRelease(){return this._shouldRelease}RemoveInstances(a){for(const b of this._sols.values())b.RemoveInstances(a)}_SaveToJson(){const a={},b={t:this._time,st:this._signalTag,s:this._isSignalled,ev:this._event.GetSID(),sm:this._solModifiers.map(d=>d.GetSID()),sols:a};this._event._HasActionIndex(this._actIndex)&&(b.act=this._event.GetActionAt(this._actIndex).GetSID());for(const[d,c]of this._sols)a[d.GetSID().toString()]=c._SaveToJson();return b}static _CreateFromJson(a,b){const d=a.GetRuntime();var c=a.GetEventBlockBySID(b.ev);if(!c)return null;let f=0;if(b.hasOwnProperty("act")){var h=a.GetActionBySID(b.act);if(!h)return null;f=h.GetIndex()}h=e.New(e.ScheduledWait,a);h._time=b.t;h._type=-1===h._time?"signal":"timer";h._signalTag=b.st;h._isSignalled=b.s;h._event=c;h._actIndex=f;for(var g of b.sm)(c=d.GetObjectClassBySID(g))&&h._solModifiers.push(c);for(const[l,m]of Object.entries(b.sols))if(b=parseInt(l,10),b=d.GetObjectClassBySID(b))g=e.New(e.SolState,null),g._LoadFromJson(a,m),h._sols.set(b,g);return h}}}
  {"use strict";const e=self.C3;e.SolState=class extends e.DefendedBase{constructor(a){super();this._objectClass=null;this._isSelectAll=!0;this._instances=[];a&&(this._objectClass=a.GetObjectClass(),this._isSelectAll=a.IsSelectAll(),e.shallowAssignArray(this._instances,a._GetOwnInstances()))}Release(){this._objectClass=null;e.clearArray(this._instances)}_Restore(a){a._SetSelectAll(this._isSelectAll);e.shallowAssignArray(a._GetOwnInstances(),this._instances)}RemoveInstances(a){e.arrayRemoveAllInSet(this._instances,a)}_SaveToJson(){return{sa:this._isSelectAll,insts:this._instances.map(a=>a.GetUID())}}_LoadFromJson(a,b){a=a.GetRuntime();this._isSelectAll=!!b.sa;e.clearArray(this._instances);for(const d of b.insts)(b=a.GetInstanceByUID(d))&&this._instances.push(b)}}}
  {"use strict";const e=self.C3;function a(b,d){let c=b.get(d);c||(c=new Map,b.set(d,c));return c}e.SDKPluginBase=class extends e.DefendedBase{constructor(b){super();this._runtime=b.runtime;this._isSingleGlobal=!!b.isSingleGlobal;this._isWorldType=!!b.isWorld;this._isRotatable=!!b.isRotatable;this._mustPredraw=!!b.mustPredraw;this._hasEffects=!!b.hasEffects;this._supportsSceneGraph=!!b.supportsSceneGraph;this._supportsMesh=!!b.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(b,d){if(!d)throw Error("missing 'this' binding");let c=this._boundACEMethodCache.get(b);if(c)return c;c=b.bind(d);this._boundACEMethodCache.set(b,c);return c}_GetBoundACEMethod_1param(b,d,c){if(!d)throw Error("missing 'this' binding");const f=a(this._boundACEMethodCache_1param,b);let h=f.get(c);if(h)return h;h=b.bind(d,c);f.set(c,h);return h}_GetBoundACEMethod_2params(b,d,c,f){if(!d)throw Error("missing 'this' binding");var h=a(this._boundACEMethodCache_2params,b);h=a(h,c);let g=h.get(f);if(g)return g;g=b.bind(d,c,f);h.set(f,g);return g}_GetBoundACEMethod_3params(b,d,c,f,h){if(!d)throw Error("missing 'this' binding");var g=a(this._boundACEMethodCache_3params,b);g=a(g,c);g=a(g,f);let l=g.get(h);if(l)return l;l=b.bind(d,c,f,h);g.set(h,l);return l}_SetSingleGlobalObjectClass(b){if(!this.IsSingleGlobal())throw Error("must be single-global plugin");this._singleGlobalObjectClass=b}GetSingleGlobalObjectClass(){if(!this.IsSingleGlobal())throw Error("must be single-global plugin");return this._singleGlobalObjectClass}GetSingleGlobalInstance(){if(!this.IsSingleGlobal())throw Error("must be single-global plugin");return this._singleGlobalObjectClass.GetSingleGlobalInstance()}}}
  {"use strict";const e=self.C3;e.SDKDOMPluginBase=class extends e.SDKPluginBase{constructor(a,b){super(a);this._domComponentId=b;this._nextElementId=0;this._instMap=new Map;this.AddElementMessageHandler("elem-focused",d=>d._OnElemFocused());this.AddElementMessageHandler("elem-blurred",d=>{d&&d._OnElemBlurred()})}Release(){super.Release()}_AddElement(a){const b=this._nextElementId++;this._instMap.set(b,a);return b}_RemoveElement(a){this._instMap.delete(a)}AddElementMessageHandler(a,b){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,a,d=>{const c=this._instMap.get(d.elementId);b(c,d)})}}}{"use strict";const e=self.C3;e.SDKTypeBase=class extends e.DefendedBase{constructor(a){super();this._objectClass=a;this._runtime=a.GetRuntime();this._plugin=a.GetPlugin()}Release(){this._plugin=this._runtime=this._objectClass=null}GetObjectClass(){return this._objectClass}GetRuntime(){return this._runtime}GetPlugin(){return this._plugin}GetImageInfo(){return this._objectClass.GetImageInfo()}FinishCondition(a){}LoadTextures(a){}ReleaseTextures(){}OnDynamicTextureLoadComplete(){}PreloadTexturesWithInstances(a){}LoadTilemapData(){}GetScriptInterfaceClass(){return null}}}
  {"use strict";const e=self.C3;e.SDKInstanceBase=class extends e.DefendedBase{constructor(a,b){super();this._inst=a;this._domComponentId=b;this._runtime=a.GetRuntime();this._objectClass=this._inst.GetObjectClass();this._sdkType=this._objectClass.GetSdkType();this._tick2Func=this._tickFunc=null;this._isTicking2=this._isTicking=!1;this._disposables=null;this._wasReleased=!1}Release(){this._wasReleased=!0;this._StopTicking();this._StopTicking2();this._tick2Func=this._tickFunc=null;this._disposables&&(this._disposables.Release(),this._disposables=null);this._sdkType=this._objectClass=this._runtime=this._inst=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(a){return this._runtime.Trigger(a,this._inst,null)}DebugTrigger(a){return this._runtime.DebugTrigger(a,this._inst,null)}TriggerAsync(a){return this._runtime.TriggerAsync(a,this._inst,null)}FastTrigger(a,b){return this._runtime.FastTrigger(a,this._inst,b)}DebugFastTrigger(a,b){return this._runtime.DebugFastTrigger(a,this._inst,b)}ScheduleTriggers(a){return this._runtime.ScheduleTriggers(a)}AddDOMMessageHandler(a,b){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,a,b)}AddDOMMessageHandlers(a){for(const[b,d]of a)this.AddDOMMessageHandler(b,d)}PostToDOM(a,b){this._runtime.PostComponentMessageToDOM(this._domComponentId,a,b)}PostToDOMAsync(a,b){return this._runtime.PostComponentMessageToDOMAsync(this._domComponentId,a,b)}_PostToDOMMaybeSync(a,b){if(this._runtime.IsInWorker())this.PostToDOM(a,b);else return window.c3_runtimeInterface._OnMessageFromRuntime({type:"event",component:this._domComponentId,handler:a,data:b,responseId:null})}Tick(){}Tick2(){}_StartTicking(){this._isTicking||(this._tickFunc||(this._tickFunc=()=>this.Tick()),this._runtime.Dispatcher().addEventListener("tick",this._tickFunc),this._isTicking=!0)}_StopTicking(){this._isTicking&&(this._runtime.Dispatcher().removeEventListener("tick",this._tickFunc),this._isTicking=!1)}IsTicking(){return this._isTicking}_StartTicking2(){this._isTicking2||(this._tick2Func||(this._tick2Func=()=>this.Tick2()),this._runtime.Dispatcher().addEventListener("tick2",this._tick2Func),this._isTicking2=!0)}_StopTicking2(){this._isTicking2&&(this._runtime.Dispatcher().removeEventListener("tick2",this._tick2Func),this._isTicking2=!1)}IsTicking2(){return this._isTicking2}GetDebuggerProperties(){return[]}SaveToJson(){return null}LoadFromJson(a){}GetPropertyValueByIndex(a){}SetPropertyValueByIndex(a,b){}OffsetPropertyValueByIndex(a,b){if(0!==b){var d=this.GetPropertyValueByIndex(a);if("number"!==typeof d)throw Error("expected number");this.SetPropertyValueByIndex(a,d+b)}}SetPropertyColorOffsetValueByIndex(a,b,d,c){}CallAction(a,...b){a.call(this,...b)}CallExpression(a,...b){return a.call(this,...b)}GetScriptInterfaceClass(){return null}}}
  {"use strict";const e=self.C3;e.SDKWorldInstanceBase=class extends e.SDKInstanceBase{constructor(a,b){super(a,b);this._worldInfo=a.GetWorldInfo();this._webglcontextrestored_handler=this._webglcontextlost_handler=null}Release(){if(this._webglcontextlost_handler){const a=this._runtime.Dispatcher();a.removeEventListener("webglcontextlost",this._webglcontextlost_handler);a.removeEventListener("webglcontextrestored",this._webglcontextrestored_handler);this._webglcontextrestored_handler=this._webglcontextlost_handler=null}this._worldInfo=null;super.Release()}HandleWebGLContextLoss(){if(!this._webglcontextlost_handler){this._webglcontextlost_handler=()=>this.OnWebGLContextLost();this._webglcontextrestored_handler=()=>this.OnWebGLContextRestored();var a=this._runtime.Dispatcher();a.addEventListener("webglcontextlost",this._webglcontextlost_handler);a.addEventListener("webglcontextrestored",this._webglcontextrestored_handler)}}OnWebGLContextLost(){}OnWebGLContextRestored(){}GetWorldInfo(){return this._worldInfo}IsOriginalSizeKnown(){return!1}GetOriginalWidth(){if(!this.IsOriginalSizeKnown())throw Error("original size not known");const a=this.GetCurrentImageInfo();if(a)return a.GetWidth()}GetOriginalHeight(){if(!this.IsOriginalSizeKnown())throw Error("original size not known");const a=this.GetCurrentImageInfo();if(a)return a.GetHeight()}GetCurrentImageInfo(){return null}GetCurrentSurfaceSize(){var a=this.GetCurrentImageInfo();return a&&(a=a.GetTexture())?[a.GetWidth(),a.GetHeight()]:[100,100]}GetCurrentTexRect(){const a=this.GetCurrentImageInfo();return a?a.GetTexRect():null}GetCurrentTexQuad(){const a=this.GetCurrentImageInfo();return a?a.GetTexQuad():null}GetImagePoint(a){a=this._inst.GetWorldInfo();return[a.GetX(),a.GetY()]}LoadTilemapData(a,b,d){}TestPointOverlapTile(a,b){}RendersToOwnZPlane(){return!0}}}
  {"use strict";const e=self.C3,a=e.New(e.Rect);e.SDKDOMInstanceBase=class extends e.SDKWorldInstanceBase{constructor(b,d){super(b,d);this._elementId=this.GetPlugin()._AddElement(this);this._isElementShowing=!0;this._autoFontSize=this._elemHasFocus=!1;this._lastRect=e.New(e.Rect,0,0,-1,-1);b=this._runtime.GetCanvasManager();this._lastWindowWidth=b.GetLastWidth();this._lastWindowHeight=b.GetLastHeight();this._isPendingUpdateState=!1;this._StartTicking()}Release(){this.GetPlugin()._RemoveElement(this._elementId);this.PostToDOMElement("destroy");this._elementId=-1;super.Release()}_GetElementInDOMMode(){if(this._runtime.IsInWorker())throw Error("not valid in worker mode");return this._PostToDOMElementMaybeSync("get-element")}PostToDOMElement(b,d){d||(d={});d.elementId=this._elementId;this.PostToDOM(b,d)}_PostToDOMElementMaybeSync(b,d){d||(d={});d.elementId=this._elementId;return this._PostToDOMMaybeSync(b,d)}PostToDOMElementAsync(b,d){d||(d={});d.elementId=this._elementId;return this.PostToDOMAsync(b,d)}CreateElement(b){b||(b={});const d=this.GetWorldInfo().IsVisible();b.elementId=this._elementId;b.isVisible=d;Object.assign(b,this.GetElementState());this._isElementShowing=!!b.isVisible;this._PostToDOMMaybeSync("create",b);this._UpdatePosition(!0)}SetElementVisible(b){b=!!b;this._isElementShowing!==b&&(this._isElementShowing=b,this.PostToDOMElement("set-visible",{isVisible:b}))}Tick(){this._UpdatePosition(!1)}_ShouldPreserveElement(){const b=this._runtime.GetCanvasManager().GetFullscreenMode();return"Android"===e.Platform.OS&&("scale-inner"===b||"scale-outer"===b||"crop"===b)}_UpdatePosition(b){var d=this.GetWorldInfo();const c=d.GetLayer();var f=d.GetX(),h=d.GetY();let[g,l]=c.LayerToCanvasCss(f,h),[m,u]=c.LayerToCanvasCss(f+d.GetWidth(),h+d.GetHeight());f=this._runtime.GetCanvasManager();h=f.GetCssWidth();const x=f.GetCssHeight();if(d.IsVisible()&&c.IsVisible()){if(!this._ShouldPreserveElement()){if(0>=m||0>=u||g>=h||l>=x){this.SetElementVisible(!1);return}1>g&&(g=1);1>l&&(l=1);m>=h&&(m=h-1);u>=x&&(u=x-1)}a.set(g,l,m,u);d=f.GetLastWidth();h=f.GetLastHeight();!b&&a.equals(this._lastRect)&&this._lastWindowWidth===d&&this._lastWindowHeight===h?this.SetElementVisible(!0):(this._lastRect.copy(a),this._lastWindowWidth=d,this._lastWindowHeight=h,this.SetElementVisible(!0),b=null,this._autoFontSize&&(b=c.GetDisplayScale()-.2),this.PostToDOMElement("update-position",{left:Math.round(this._lastRect.getLeft())+f.GetCanvasClientX(),top:Math.round(this._lastRect.getTop())+f.GetCanvasClientY(),width:Math.round(this._lastRect.width()),height:Math.round(this._lastRect.height()),fontSize:b}))}else this.SetElementVisible(!1)}FocusElement(){this._PostToDOMElementMaybeSync("focus",{focus:!0})}BlurElement(){this._PostToDOMElementMaybeSync("focus",{focus:!1})}_OnElemFocused(){this._elemHasFocus=!0}_OnElemBlurred(){this._elemHasFocus=!1}IsElementFocused(){return this._elemHasFocus}SetElementCSSStyle(b,d){this.PostToDOMElement("set-css-style",{prop:e.CSSToCamelCase(b),val:d})}SetElementAttribute(b,d){this.PostToDOMElement("set-attribute",{name:b,val:d})}RemoveElementAttribute(b){this.PostToDOMElement("remove-attribute",{name:b})}UpdateElementState(){this._isPendingUpdateState||(this._isPendingUpdateState=!0,Promise.resolve().then(()=>{this._isPendingUpdateState=!1;this.PostToDOMElement("update-state",this.GetElementState())}))}GetElementState(){}GetElementId(){return this._elementId}}}
  {"use strict";const e=self.C3,a=self.IBehavior;e.SDKBehaviorBase=class extends e.DefendedBase{constructor(b){super();this._runtime=b.runtime;this._myObjectClasses=e.New(e.ArraySet);this._myInstances=e.New(e.ArraySet);this._iBehavior=null;this._scriptInterfaceClass=b.scriptInterfaceClass||null}Release(){this._myInstances.Release();this._myObjectClasses.Release();this._runtime=null}GetRuntime(){return this._runtime}OnCreate(){}_AddObjectClass(b){this._myObjectClasses.Add(b)}GetObjectClasses(){return this._myObjectClasses.GetArray()}_AddInstance(b){this._myInstances.Add(b)}_RemoveInstance(b){this._myInstances.Delete(b)}GetInstances(){return this._myInstances.GetArray()}GetIBehavior(){if(null===this._iBehavior){const b=this._scriptInterfaceClass;if(b){if(this._iBehavior=new b(this),!(this._iBehavior instanceof a))throw new TypeError("script interface class must derive from IBehavior");}else this._iBehavior=new a(this)}return this._iBehavior}}}
  {"use strict";const e=self.C3;e.SDKBehaviorTypeBase=class extends e.DefendedBase{constructor(a){super();this._runtime=a.GetRuntime();this._behaviorType=a;this._objectClass=a.GetObjectClass();this._behavior=a.GetBehavior();this._behavior._AddObjectClass(this._objectClass)}Release(){this._behavior=this._objectClass=this._behaviorType=this._runtime=null}GetBehaviorType(){return this._behaviorType}GetObjectClass(){return this._objectClass}GetRuntime(){return this._runtime}GetBehavior(){return this._behavior}}}
  {"use strict";const e=self.C3;e.SDKBehaviorInstanceBase=class extends e.DefendedBase{constructor(a,b){super();this._behInst=a;this._domComponentId=b;this._inst=a.GetObjectInstance();this._runtime=a.GetRuntime();this._behaviorType=a.GetBehaviorType();this._sdkType=this._behaviorType.GetSdkType();this._isPostTicking=this._isTicking2=this._isTicking=!1;this._disposables=null}Release(){this._StopTicking();this._StopTicking2();this._StopPostTicking();this._disposables&&(this._disposables.Release(),this._disposables=null);this._sdkType=this._behaviorType=this._runtime=this._inst=this._behInst=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(a){return this._runtime.Trigger(a,this._inst,this._behaviorType)}DebugTrigger(a){return this._runtime.DebugTrigger(a,this._inst,this._behaviorType)}TriggerAsync(a){return this._runtime.TriggerAsync(a,this._inst,this._behaviorType)}PostCreate(){}Tick(){}Tick2(){}PostTick(){}_StartTicking(){this._isTicking||(this._runtime._AddBehInstToTick(this),this._isTicking=!0)}_StopTicking(){this._isTicking&&(this._runtime._RemoveBehInstToTick(this),this._isTicking=!1)}IsTicking(){return this._isTicking}_StartTicking2(){this._isTicking2||(this._runtime._AddBehInstToTick2(this),this._isTicking2=!0)}_StopTicking2(){this._isTicking2&&(this._runtime._RemoveBehInstToTick2(this),this._isTicking2=!1)}IsTicking2(){return this._isTicking2}_StartPostTicking(){this._isPostTicking||(this._runtime._AddBehInstToPostTick(this),this._isPostTicking=!0)}_StopPostTicking(){this._isPostTicking&&(this._runtime._RemoveBehInstToPostTick(this),this._isPostTicking=!1)}IsPostTicking(){return this._isPostTicking}GetDebuggerProperties(){return[]}AddDOMMessageHandler(a,b){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,a,b)}OnSpriteFrameChanged(a,b){}SaveToJson(){return null}LoadFromJson(a){}GetPropertyValueByIndex(a){}SetPropertyValueByIndex(a,b){}OffsetPropertyValueByIndex(a,b){if(0!==b){var d=this.GetPropertyValueByIndex(a);if("number"!==typeof d)throw Error("expected number");this.SetPropertyValueByIndex(a,d+b)}}SetPropertyColorOffsetValueByIndex(a,b,d,c){}CallAction(a,...b){a.call(this,...b)}CallExpression(a,...b){return a.call(this,...b)}GetScriptInterfaceClass(){return null}}}
  {"use strict";const e=self.C3;e.Plugins={};e.Behaviors={};e.PluginManager=class extends e.DefendedBase{constructor(a){super();this._runtime=a;this._allPlugins=[];this._pluginsByCtor=new Map;this._systemPlugin=null;this._allBehaviors=[];this._behaviorsByCtor=new Map;this._jumpthruBehavior=this._solidBehavior=null}CreatePlugin(a){const b=this._runtime.GetObjectReference(a[0]);if(!b)throw Error("missing plugin");e.AddCommonACEs(a,b);a=e.New(b,{runtime:this._runtime,isSingleGlobal:a[1],isWorld:a[2],isRotatable:a[5],hasEffects:a[8],mustPredraw:a[9],supportsSceneGraph:a[13],supportsMesh:a[14]});a.OnCreate();this._allPlugins.push(a);this._pluginsByCtor.set(b,a)}CreateSystemPlugin(){this._systemPlugin=e.New(e.Plugins.System,{runtime:this._runtime,isSingleGlobal:!0});this._systemPlugin.OnCreate()}CreateBehavior(a){a=this._runtime.GetObjectReference(a[1]);if(!a)throw Error("missing behavior");const b=e.New(a,{runtime:this._runtime});b.OnCreate();this._allBehaviors.push(b);this._behaviorsByCtor.set(a,b);!this._solidBehavior&&e.Behaviors.solid&&b instanceof e.Behaviors.solid?this._solidBehavior=b:!this._jumpthruBehavior&&e.Behaviors.jumpthru&&b instanceof e.Behaviors.jumpthru&&(this._jumpthruBehavior=b)}GetPluginByConstructorFunction(a){return this._pluginsByCtor.get(a)||null}HasBehaviorByConstructorFunction(a){return this._behaviorsByCtor.has(a)}GetBehaviorByConstructorFunction(a){return this._behaviorsByCtor.get(a)||null}GetSystemPlugin(){return this._systemPlugin}GetSolidBehavior(){return this._solidBehavior}GetJumpthruBehavior(){return this._jumpthruBehavior}}}
  {"use strict";const e=self.C3,a=new Set;e.ImageInfo=class extends e.DefendedBase{constructor(){super();this._url="";this._height=this._width=this._offsetY=this._offsetX=this._size=0;this._hasMetaData=this._isRotated=!1;this._imageAsset=null;this._textureState="";this._rcTex=e.New(e.Rect);this._quadTex=e.New(e.Quad);a.add(this)}Release(){this.ReleaseTexture();this._imageAsset=null;a.delete(this)}static OnWebGLContextLost(){for(const b of a)b._textureState="",b._rcTex.set(0,0,0,0),b._quadTex.setFromRect(b._rcTex)}LoadData(b){this._url=b[0];this._size=b[1];this._offsetX=b[2];this._offsetY=b[3];this._width=b[4];this._height=b[5];this._isRotated=b[6];this._hasMetaData=!0}LoadDynamicAsset(b,d){if(this._imageAsset)throw Error("already loaded asset");this._url=d;const c={};e.IsAbsoluteURL(d)&&(c.loadPolicy="remote");this.LoadAsset(b,c);return this._imageAsset.Load()}ReplaceWith(b){if(b===this)throw Error("cannot replace with self");this.ReleaseTexture();this._url=b._url;this._size=b._size;this._offsetX=b._offsetX;this._offsetY=b._offsetY;this._width=b._width;this._height=b._height;this._hasMetaData=b._hasMetaData;this._imageAsset=b._imageAsset;this._textureState=b._textureState;this._rcTex=b._rcTex;this._quadTex=b._quadTex}GetURL(){return this._url}GetSize(){return this._size}GetOffsetX(){return this._offsetX}GetOffsetY(){return this._offsetY}GetWidth(){return this._width}GetHeight(){return this._height}GetSheetWidth(){return this._imageAsset.GetWidth()}GetSheetHeight(){return this._imageAsset.GetHeight()}LoadAsset(b,d){if(this._imageAsset)throw Error("already got asset");d=Object.assign({},d,{url:this.GetURL(),size:this.GetSize()});this._imageAsset=b.LoadImage(d)}IsLoaded(){return this._imageAsset&&this._imageAsset.IsLoaded()}async LoadStaticTexture(b,d){if(!this._imageAsset)throw Error("no asset");if(this._textureState)throw Error("already loaded texture");this._textureState="loading";b=await this._imageAsset.LoadStaticTexture(b,d);if(!b)return this._textureState="",null;this._textureState="loaded";this._hasMetaData||(this._width=b.GetWidth(),this._height=b.GetHeight(),this._hasMetaData=!0);this._rcTex.set(this._offsetX,this._offsetY,this._offsetX+(this._isRotated?this._height:this._width),this._offsetY+(this._isRotated?this._width:this._height));this._rcTex.divide(b.GetWidth(),b.GetHeight());this._quadTex.setFromRect(this._rcTex);this._isRotated&&this._quadTex.rotatePointsAnticlockwise();return b}ReleaseTexture(){this._textureState&&(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}async ExtractImageToCanvas(){const b=await this._imageAsset.LoadToDrawable(),d=e.CreateCanvas(this._width,this._height);d.getContext("2d").drawImage(b,this._offsetX,this._offsetY,this._width,this._height,0,0,this._width,this._height);return d}}}
  {"use strict";const e=self.C3;e.AnimationInfo=class extends e.DefendedBase{constructor(a){super();this._name=a[0];this._speed=a[1];this._isLooping=!!a[2];this._repeatCount=a[3];this._repeatTo=a[4];this._isPingPong=!!a[5];this._sid=a[6];this._frames=a[7].map(b=>e.New(e.AnimationFrameInfo,b))}Release(){for(const a of this._frames)a.Release();e.clearArray(this._frames)}LoadAllAssets(a){for(const b of this._frames)b.GetImageInfo().LoadAsset(a)}LoadAllTextures(a,b){return Promise.all(this._frames.map(d=>d.GetImageInfo().LoadStaticTexture(a,b)))}ReleaseAllTextures(){for(const a of this._frames)a.GetImageInfo().ReleaseTexture()}GetName(){return this._name}GetSID(){return this._sid}GetFrameCount(){return this._frames.length}GetFrames(){return this._frames}GetFrameAt(a){a=Math.floor(a);if(0>a||a>=this._frames.length)throw new RangeError("invalid frame");return this._frames[a]}GetSpeed(){return this._speed}IsLooping(){return this._isLooping}GetRepeatCount(){return this._repeatCount}GetRepeatTo(){return this._repeatTo}IsPingPong(){return this._isPingPong}}}
  {"use strict";const e=self.C3;e.AnimationFrameInfo=class extends e.DefendedBase{constructor(a){super();this._imageInfo=e.New(e.ImageInfo);this._imageInfo.LoadData(a);this._duration=a[7];this._origin=e.New(e.Vector2,a[8],a[9]);this._imagePoints=a[10].map(b=>e.New(e.ImagePoint,this,b));this._imagePointsByName=new Map;for(const b of this._imagePoints)this._imagePointsByName.set(b.GetName().toLowerCase(),b);this._collisionPoly=null;a=a[11];6<=a.length&&(this._collisionPoly=e.New(e.CollisionPoly,a))}Release(){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(a){return this._imagePointsByName.get(a.toLowerCase())||null}GetImagePointByIndex(a){a=Math.floor(a);return 0>a||a>=this._imagePoints.length?null:this._imagePoints[a]}GetImagePointCount(){return this._imagePoints.length}}}
  {"use strict";const e=self.C3;e.ImagePoint=class extends e.DefendedBase{constructor(a,b){super();this._afi=a;this._name=b[0];this._pos=e.New(e.Vector2,b[1],b[2])}Release(){}GetName(){return this._name}GetX(){return this._pos.getX()}GetY(){return this._pos.getY()}GetVec2(){return this._pos}}}
  {"use strict";const e=self.C3,a=self.C3Debugger,b=self.IObjectClass;e.ObjectClass=class extends e.DefendedBase{constructor(d,c,f){super();const h=d.GetObjectReference(f[1]);this._runtime=d;this._plugin=d.GetPluginManager().GetPluginByConstructorFunction(h);this._sdkType=null;this._instSdkCtor=h.Instance;this._index=c;this._sid=f[11];this._name=f[0];this._jsPropName=this._runtime.GetJsPropName(f[14]);this._isGlobal=!!f[9];this._isFamily=!!f[2];this._isOnLoaderLayout=!!f[10];this._instVars=f[3].map(g=>({sid:g[0],type:g[1],name:g[2],jsPropName:d.GetJsPropName(g[3])}));this._behaviorsCount=f[4];this._effectsCount=f[5];this._isWorldType=this._plugin.IsWorldType();this._effectList=null;this._collisionGrid=e.New(e.SparseGrid,d.GetOriginalViewportWidth(),d.GetOriginalViewportHeight());this._anyCollisionCellChanged=!0;this._anyInstanceParallaxed=!1;this._familyMembersSet=this._familyMembers=null;this._familyIndex=-1;this._familyEffectMap=this._familyBehaviorMap=this._familyInstVarMap=this._familiesSet=this._families=null;this._isInContainer=!1;this._container=null;this._behaviorTypes=f[8].map(g=>e.BehaviorType.Create(this,g));this._behaviorTypesIncludingInherited=[];this._behaviorsByName=new Map;this._behaviorNameToIndex=new Map;this._usedBehaviorCtors=new Set;this._solStack=e.New(e.SolStack,this);this._defaultInstanceData=null;this._defaultLayerIndex=0;this._isContained=!1;this._animationsBySid=this._animationsByName=this._animations=this._imageInfo=this._container=null;this._textureRefCount=0;this._savedData=new Map;this._unsavedData=new Map;this._instances=[];this._iidsStale=!0;this._plugin.HasEffects()&&(this._effectList=e.New(e.EffectList,this,f[12]));f[6]&&(this._imageInfo=e.New(e.ImageInfo),this._imageInfo.LoadData(f[6]));if(f[7]){this._animations=f[7].map(g=>e.New(e.AnimationInfo,g));this._animationsByName=new Map;this._animationsBySid=new Map;for(const g of this._animations)this._animationsByName.set(g.GetName().toLowerCase(),g),this._animationsBySid.set(g.GetSID(),g)}this._isFamily?(this._familyMembers=[],this._familyMembersSet=new Set,this._familyIndex=this._runtime._GetNextFamilyIndex()):(this._families=[],this._familiesSet=new Set,this._familyInstVarMap=[],this._familyBehaviorMap=[],this._familyEffectMap=[]);this._sdkType=e.New(h.Type,this,f[15]);this._instanceUserScriptClass=this._iObjectClass=null;this._userScriptDispatcher=e.New(e.Event.Dispatcher);if(c=this._sdkType.GetScriptInterfaceClass()){if(this._iObjectClass=new c(this),!(this._iObjectClass instanceof b))throw new TypeError("script interface class must derive from IObjectClass");}else this._iObjectClass=new b(this);f[13]&&(c=f[13])&&this._sdkType.LoadTilemapData(c[0],c[1],c[2]);this._runtime.UsesLoaderLayout()&&!this._isFamily&&!this._isOnLoaderLayout&&this._isWorldType||this.OnCreate();this._plugin.IsSingleGlobal()&&(this._plugin._SetSingleGlobalObjectClass(this),this._CreateSingleGlobalInstance(f))}static Create(d,c,f){return e.New(e.ObjectClass,d,c,f)}Release(){this._imageInfo&&(this._imageInfo.Release(),this._imageInfo=null);if(this._animations){for(const d of this._animations)d.Release();e.clearArray(this._animations);this._animationsByName.clear();this._animationsBySid.clear()}this._solStack.Release();this._solStack=null;this._savedData.clear();this._unsavedData.clear();this._runtime=this._container=null}_LoadFamily(d){for(let c=1,f=d.length;c<f;++c){const h=this._runtime.GetObjectClassByIndex(d[c]);this._familyMembers.push(h);this._familyMembersSet.add(h);h._families.push(this);h._familiesSet.add(this)}}_SetContainer(d){this._isInContainer=!0;this._container=d}IsInContainer(){return this._isInContainer}GetContainer(){return this._container}_OnAfterCreate(){var d=0;if(!this._isFamily)for(var c of this._families)for(var f of c.GetBehaviorTypes()){const l=f.GetName().toLowerCase();this._behaviorsByName.set(l,f);this._behaviorNameToIndex.set(l,d);this._behaviorTypesIncludingInherited.push(f);++d}for(var h of this.GetBehaviorTypes())c=h.GetName().toLowerCase(),this._behaviorsByName.set(c,h),this._behaviorNameToIndex.set(c,d),this._behaviorTypesIncludingInherited.push(h),++d;for(var g of this._behaviorTypesIncludingInherited)this._usedBehaviorCtors.add(g.GetBehavior().constructor);if(!this._isFamily&&this._families.length){d=this._runtime.GetFamilyCount();e.extendArray(this._familyInstVarMap,d,0);e.extendArray(this._familyBehaviorMap,d,0);e.extendArray(this._familyEffectMap,d,0);d=[];c=g=h=0;for(const l of this._families)if(f=l.GetFamilyIndex(),this._familyInstVarMap[f]=h,h+=l.GetInstanceVariablesCount(),this._familyBehaviorMap[f]=g,g+=l.GetBehaviorTypesCount(),this._familyEffectMap[f]=c,c+=l.GetEffectTypesCount(),(f=l.GetEffectList())&&this._effectList)for(const m of f.GetAllEffectTypes())d.push(m.Clone(this._effectList));this._effectList&&this._effectList.PrependEffectTypes(d)}}_CreateSingleGlobalInstance(d){const c=this._runtime._GetNewUID(),f=e.New(e.Instance,{runtime:this._runtime,objectType:this,uid:c});f._CreateSdkInstance(d[16],[]);this._runtime._MapInstanceByUID(c,f);this._instances.push(f)}GetSdkType(){return this._sdkType}IsOnLoaderLayout(){return this._isOnLoaderLayout}OnCreate(){this._isFamily||this._sdkType.OnCreate()}HasLoadedTextures(){return 0<this._textureRefCount}LoadTextures(d){if(this._isFamily)return Promise.resolve();this._textureRefCount++;return 1===this._textureRefCount?this._sdkType.LoadTextures(d)||Promise.resolve():Promise.resolve()}ReleaseTextures(){if(!this._isFamily){this._textureRefCount--;if(0>this._textureRefCount)throw Error("released textures too many times");0===this._textureRefCount&&this._sdkType.ReleaseTextures()}}OnDynamicTextureLoadComplete(){if(this._isFamily)throw Error("not applicable to family");this._sdkType.OnDynamicTextureLoadComplete()}PreloadTexturesWithInstances(d){return this._isFamily?Promise.resolve():this._sdkType.PreloadTexturesWithInstances(d)}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(d){return d&&this._usedBehaviorCtors.has(d)}GetInstanceVariablesCount(){return this._instVars.length}GetInstanceVariableSIDs(){return this._instVars.map(d=>d.sid)}GetInstanceVariableIndexBySID(d){return this._instVars.findIndex(c=>c.sid===d)}GetInstanceVariableIndexByName(d){return this._instVars.findIndex(c=>c.name===d)}_GetAllInstanceVariableNames(){return this._instVars.map(d=>d.name)}_GetAllInstanceVariableJsPropNames(){return this._instVars.map(d=>d.jsPropName)}GetInstanceVariableType(d){d=Math.floor(d);if(0>d||d>=this._instVars.length)throw new RangeError("invalid instance variable index");return this._instVars[d].type}GetInstanceVariableName(d){d=Math.floor(d);if(0>d||d>=this._instVars.length)throw new RangeError("invalid instance variable index");return this._instVars[d].name}GetEffectTypesCount(){return this._effectsCount}GetBehaviorTypesIncludingInherited(){return this._behaviorTypesIncludingInherited}GetBehaviorTypeByName(d){return this._behaviorsByName.get(d.toLowerCase())||null}GetBehaviorIndexByName(d){d=this._behaviorNameToIndex.get(d.toLowerCase());return"undefined"===typeof d?-1:d}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(d){this._defaultLayerIndex=d}GetDefaultLayerIndex(){return this._defaultLayerIndex}GetAnimations(){return this._animations}GetAnimationCount(){return this._animations.length}GetFamilies(){return this._families}BelongsToFamily(d){return this._familiesSet.has(d)}GetFamilyMembers(){return this._familyMembers}FamilyHasMember(d){return this._familyMembersSet.has(d)}GetFamilyBehaviorOffset(d){return this._familyBehaviorMap[d]}GetFamilyInstanceVariableOffset(d){return this._familyInstVarMap[d]}GetAnimationByName(d){if(!this._animations)throw Error("no animations");return this._animationsByName.get(d.toLowerCase())||null}GetAnimationBySID(d){if(!this._animations)throw Error("no animations");return this._animationsBySid.get(d)||null}GetFirstAnimationFrame(){if(!this._animations)throw Error("no animations");return this._animations[0].GetFrameAt(0)}GetDefaultInstanceSize(){if(this._animations){const d=this.GetFirstAnimationFrame().GetImageInfo();return[d.GetWidth(),d.GetHeight()]}return this._imageInfo?[this._imageInfo.GetWidth(),this._imageInfo.GetHeight()]:[100,100]}GetSingleGlobalInstance(){if(!this._plugin.IsSingleGlobal())throw Error("not a single-global plugin");return this._instances[0]}GetInstances(){return this._instances}*instances(){yield*this._instances}*instancesIncludingPendingCreate(){yield*this._instances;for(const d of this._runtime._GetInstancesPendingCreate())d.GetObjectClass()===this&&(yield d)}GetInstanceCount(){return this._instances.length}_AddInstance(d){this._instances.push(d)}_SetIIDsStale(){this._iidsStale=!0}_UpdateIIDs(){if(this._iidsStale&&!this._isFamily){var d=this._instances,c=0;for(let f=d.length;c<f;++c)d[c]._SetIID(c);d=this._runtime._GetInstancesPendingCreate();for(const f of d)f.GetObjectClass()===this&&f._SetIID(c++);this._iidsStale=!1}}GetInstanceByIID(d){var c=this._instances;if(d<c.length)return c[d];d-=c.length;c=this._runtime._GetInstancesPendingCreate();for(const f of c)if(f.GetObjectClass()===this){if(0===d)return f;--d}return null}GetFirstPicked(d){if(d&&d.IsInContainer()&&d.GetObjectClass()!==this)for(const c of d.siblings())if(c.GetObjectClass()===this)return c;d=this.GetCurrentSol().GetInstances();return d.length?d[0]:null}GetPairedInstance(d){const c=this.GetCurrentSol().GetInstances();return 0<c.length?c[d.GetIID()%c.length]:null}*allCorrespondingInstances(d,c){const f=this.GetCurrentSol().GetInstances();var h=f.length;const g=c.GetCurrentSol(),l=c.GetCurrentSol().GetInstances(),m=l.length;var u=d.GetIID();if(c.IsFamily()||!g.IsSelectAll())u=l.indexOf(d);d=Math.ceil(h/m);h%=m;0===h||u<h?(u*=d,h=d):(u=h*d+(u-h)*(d-1),h=d-1);for(let x=u,n=u+h;x<n;++x)yield f[x]}FinishCondition(d){this._sdkType.FinishCondition(d)}ApplySolToContainer(){if(this._isInContainer&&!this._isFamily){this._UpdateIIDs();var d=this.GetCurrentSol(),c=d._GetOwnInstances(),f=d.IsSelectAll(),h=this._runtime.GetCurrentEventStackFrame();h=h&&h.GetCurrentEvent()&&h.GetCurrentEvent().IsOrBlock();for(const m of this._container.objectTypes())if(m!==this){m._UpdateIIDs();var g=m.GetCurrentSol();g._SetSelectAll(f);if(!f){var l=g._GetOwnInstances();e.clearArray(l);for(const u of c)l.push(m.GetInstanceByIID(u.GetIID()));if(h){l=d._GetOwnElseInstances();g=g._GetOwnElseInstances();e.clearArray(g);for(const u of l)g.push(m.GetInstanceByIID(u.GetIID()))}}}}}_TruncateContainerSols(d,c){for(const f of this.GetContainer().objectTypes()){const h=f.GetCurrentSol();d?e.truncateArray(h._GetOwnElseInstances(),c):e.truncateArray(h._GetOwnInstances(),c)}}_GetCollisionCellGrid(){return this._collisionGrid}_SetAnyCollisionCellChanged(d){this._anyCollisionCellChanged=!!d}_SetAnyInstanceParallaxed(d){this._anyInstanceParallaxed=!!d}IsAnyInstanceParallaxed(){return this._anyInstanceParallaxed}_UpdateAllCollisionCells(){if(this._anyCollisionCellChanged&&this._isWorldType){for(const d of this._instances)d.GetWorldInfo()._UpdateCollisionCell();for(const d of this._runtime._GetInstancesPendingCreate())d.GetObjectClass()===this&&d.GetWorldInfo()._UpdateCollisionCell();this._anyCollisionCellChanged=!1}}GetSavedDataMap(){this._savedData||(this._savedData=new Map);return this._savedData}GetUnsavedDataMap(){this._unsavedData||(this._unsavedData=new Map);return this._unsavedData}HasSolidBehavior(){return this.UsesBehaviorByCtor(e.Behaviors.solid)}HasNoSaveBehavior(){return this.UsesBehaviorByCtor(e.Behaviors.NoSave)}HasPersistBehavior(){return this.UsesBehaviorByCtor(e.Behaviors.Persist)}_SaveToJson(){const d={instances:this._instances.map(c=>c.SaveToJson())};this._savedData&&this._savedData.size&&(d.ex=e.ToSuperJSON(this._savedData));return d}_LoadFromJson(d){this._savedData&&(this._savedData.clear(),this._savedData=null);var c=d.ex;c&&(this._savedData=e.FromSuperJSON(c));c=this._instances;d=d.instances;for(let f=0,h=Math.min(c.length,d.length);f<h;++f)c[f].LoadFromJson(d[f]);for(let f=d.length,h=c.length;f<h;++f)this._runtime.DestroyInstance(c[f]);for(let f=c.length,h=d.length;f<h;++f){c=d[f];let g=null;if(this.IsWorldType()&&(g=this._runtime.GetMainRunningLayout().GetLayerBySID(c.w.l),!g))continue;this._runtime.CreateInstanceFromData(this._defaultInstanceData||this,g,!1,0,0,!0).LoadFromJson(c)}this._SetIIDsStale()}GetIObjectClass(){return this._iObjectClass}UserScriptDispatcher(){return this._userScriptDispatcher}_GetUserScriptInstanceClass(){return this._instanceUserScriptClass}_SetUserScriptInstanceClass(d){this._instanceUserScriptClass=d}DispatchUserScriptEvent(d){var c=this._runtime;(c=c.IsDebug()&&!c.GetEventSheetManager().IsInEventEngine())&&a.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(d);c&&a.AddScriptTime()}}}
  {"use strict";const e=self.C3;e.Container=class extends e.DefendedBase{constructor(a,b){super();this._runtime=a;this._objectTypes=b;for(const d of this._objectTypes)d._SetContainer(this)}Release(){this._runtime=null}GetRuntime(){return this._runtime}GetObjectTypes(){return this._objectTypes}objectTypes(){return this._objectTypes}HasAnyWorldType(){return this._objectTypes.some(a=>a.IsWorldType())}}}
  {"use strict";const e=self.C3,a=self.C3Debugger,b=self.IInstance,d=[];let c=0;const f=new WeakMap,h=new WeakMap;e.Instance=class extends e.DefendedBase{constructor(g){super();this._runtime=g.runtime;this._objectType=g.objectType;this._iScriptInterface=this._sdkInst=this._worldInfo=null;this._iid=0;this._uid=g.uid;this._puid=c++;this._flags=0;this._behaviorInstances=this._instVarValues=d;var l=this._objectType.GetBehaviorTypesIncludingInherited();0<l.length&&(this._behaviorInstances=l.map((m,u)=>e.New(e.BehaviorInstance,{runtime:this._runtime,behaviorType:m,instance:this,index:u})));this._siblings=this._objectType.IsInContainer()?[]:null;this._timeScale=-1;this._dispatcher=null;l=this.GetPlugin();l.MustPreDraw()&&(this._flags|=4);if(l.IsWorldType())if(this._worldInfo=e.New(e.WorldInfo,this,g.layer),g.worldData)this._worldInfo.Init(g.worldData);else{this._worldInfo.InitNoData();const[m,u]=this._objectType.GetDefaultInstanceSize();this._worldInfo.SetSize(m,u);this.GetObjectClass().UsesEffects()&&this._worldInfo.GetInstanceEffectList().LoadDefaultEffectParameters()}g.instVarData?this._LoadInstanceVariableData(g.instVarData):this._LoadDefaultInstanceVariables()}Release(){this._iScriptInterface&&(this._iScriptInterface._Release(),this._iScriptInterface=null);if(0<this._behaviorInstances.length){for(var g of this._behaviorInstances)g.Release();e.clearArray(this._behaviorInstances)}this._sdkInst.Release();this._sdkInst=null;if(g=f.get(this))g.clear(),f.delete(this);if(g=h.get(this))g.clear(),h.delete(this);this._siblings&&e.clearArray(this._siblings);this._dispatcher&&(this._dispatcher.Release(),this._dispatcher=null);this._objectType=this._runtime=null;0<this._instVarValues.length&&e.clearArray(this._instVarValues);this._worldInfo&&(this._worldInfo.Release(),this._worldInfo=null)}_LoadInstanceVariableData(g){0<g.length&&(this._instVarValues=[],e.shallowAssignArray(this._instVarValues,g))}_LoadDefaultInstanceVariables(){const g=this._objectType.GetInstanceVariablesCount();if(0!==g){this._instVarValues=[];var l=[0,0,""];for(let m=0;m<g;++m)this._instVarValues.push(l[this._objectType.GetInstanceVariableType(m)])}}_CreateSdkInstance(g,l){if(this._sdkInst)throw Error("already got sdk instance");for(let m=0,u=this._behaviorInstances.length;m<u;++m)this._behaviorInstances[m]._CreateSdkInstance(l?l[m]:null);this._sdkInst=e.New(this._objectType.GetInstanceSdkCtor(),this,g);if(!(this._sdkInst instanceof e.SDKInstanceBase))throw Error("sdk type must derive from SDKInstanceBase");for(let m=0,u=this._behaviorInstances.length;m<u;++m)this._behaviorInstances[m].PostCreate();this._objectType._GetUserScriptInstanceClass()&&this._InitUserScriptInterface()}GetSdkInstance(){return this._sdkInst}GetWorldInfo(){return this._worldInfo}GetRuntime(){return this._runtime}GetTimeScale(){return this._timeScale}GetActiveTimeScale(){const g=this._timeScale;return-1===g?this.GetRuntime().GetTimeScale():g}SetTimeScale(g){g=+g;if(0>g||!isFinite(g))g=0;this._timeScale=g}RestoreTimeScale(){this._timeScale=-1}Dispatcher(){this._dispatcher||(this._dispatcher=e.New(e.Event.Dispatcher));return this._dispatcher}Draw(g){this._sdkInst.Draw(g)}OnCreate(g){this._sdkInst.OnCreate(g)}_SetHasTilemap(){this._flags|=2}HasTilemap(){return 0!==(this._flags&2)}_MarkDestroyed(){this._flags|=1}IsDestroyed(){return 0!==(this._flags&1)}MustPreDraw(){return 0!==(this._flags&4)}SetMustMitigateZFighting(){this._flags|=32}MustMitigateZFighting(){return 0!==(this._flags&32)}_IsSolidEnabled(){return 0!==(this._flags&8)}_SetSolidEnabled(g){this._flags=g?this._flags|8:this._flags&-9}_IsJumpthruEnabled(){return 0!==(this._flags&16)}_SetJumpthruEnabled(g){this._flags=g?this._flags|16:this._flags&-17}SetFlag(g,l){g<<=16;this._flags=l?this._flags|g:this._flags&~g}GetFlag(g){return 0!==(this._flags&g<<16)}GetCurrentImageInfo(){return this._sdkInst.GetCurrentImageInfo()}GetCurrentSurfaceSize(){return this._sdkInst.GetCurrentSurfaceSize()}GetCurrentTexRect(){return this._sdkInst.GetCurrentTexRect()}GetCurrentTexQuad(){return this._sdkInst.GetCurrentTexQuad()}GetImagePoint(g){return this._sdkInst.GetImagePoint(g)}GetObjectClass(){return this._objectType}RendersToOwnZPlane(){return this._sdkInst.RendersToOwnZPlane()}BelongsToObjectClass(g){return g.IsFamily()?g.FamilyHasMember(this.GetObjectClass()):this.GetObjectClass()===g}VerifySupportsSceneGraph(){if(!this.GetPlugin().SupportsSceneGraph())throw Error("object does not support scene graph");}HasParent(){return null!==this.GetParent()}GetParent(){var g=this.GetWorldInfo();return g?(g=g.GetParent())?g.GetInstance():null:null}GetTopParent(){var g=this.GetWorldInfo();return g?(g=g.GetTopParent())?g.GetInstance():null:null}*parents(){const g=this.GetWorldInfo();if(g)for(const l of g.parents())yield l.GetInstance()}HasChildren(){const g=this.GetWorldInfo();return g?g.HasChildren():!1}GetChildren(){const g=this.GetWorldInfo();return g?g.GetChildren().map(l=>l.GetInstance()):[]}*children(){const g=this.GetWorldInfo();if(g)for(const l of g.children())yield l.GetInstance()}*allChildren(){const g=this.GetWorldInfo();if(g)for(const l of g.allChildren())yield l.GetInstance()}GetChildCount(){const g=this.GetWorldInfo();return g?g.GetChildCount():0}GetChildAt(g){const l=this.GetWorldInfo();return l?(g=l.GetChildAt(g))?g.GetInstance():null:null}AddChild(g,l){this.VerifySupportsSceneGraph();g.VerifySupportsSceneGraph();this.GetWorldInfo().AddChild(g.GetWorldInfo(),l||{})}RemoveChild(g){const l=this.GetWorldInfo();l&&l.RemoveChild(g.GetWorldInfo())}GetDestroyWithParent(){const g=this.GetWorldInfo();return g?g.GetDestroyWithParent():!1}SetupInitialSceneGraphConnections(){var g=this.GetWorldInfo();if(g&&(g=g.GetSceneGraphChildrenExportData()))for(const l of g)if(g=this._runtime.GetInstanceByUID(l[2])){const m=l[3];this.AddChild(g,{transformX:!!(m>>0&1),transformY:!!(m>>1&1),transformWidth:!!(m>>2&1),transformHeight:!!(m>>3&1),transformAngle:!!(m>>4&1),destroyWithParent:!!(m>>5&1),transformZElevation:!!(m>>6&1)})}}IsInContainer(){return null!==this._siblings}_AddSibling(g){this._siblings.push(g)}GetSiblings(){return this._siblings}HasSibling(g){return!!this.GetSibling(g)}GetSibling(g){const l=this.siblings();if(null===l||0===l.length)return!1;for(const m of l)if(m.GetObjectClass()===g)return m;return null}siblings(){return this._siblings}SetSiblingsSinglePicked(){for(const g of this.siblings())g.GetObjectClass().GetCurrentSol().SetSinglePicked(g)}_PushSiblingsToSolInstances(){for(const g of this.siblings())g.GetObjectClass().GetCurrentSol()._PushInstance(g)}_SetSiblingsToSolInstancesIndex(g){for(const l of this.siblings())l.GetObjectClass().GetCurrentSol()._GetOwnInstances()[g]=l}_PushSiblingsToSolElseInstances(){for(const g of this.siblings())g.GetObjectClass().GetCurrentSol()._PushElseInstance(g)}_SetSiblingsToSolElseInstancesIndex(g){for(const l of this.siblings())l.GetObjectClass().GetCurrentSol()._GetOwnElseInstances()[g]=l}GetPlugin(){return this._objectType.GetPlugin()}_SetIID(g){this._iid=g}GetIID(){this._objectType._UpdateIIDs();return this._iid}GetUID(){return this._uid}GetPUID(){return this._puid}GetBehaviorInstances(){return this._behaviorInstances}GetBehaviorInstanceFromCtor(g){if(!g)return null;for(const l of this._behaviorInstances)if(l.GetBehavior()instanceof g)return l;return null}GetBehaviorSdkInstanceFromCtor(g){return g?(g=this.GetBehaviorInstanceFromCtor(g))?g.GetSdkInstance():null:null}GetBehaviorIndexBySID(g){const l=this._behaviorInstances;for(let m=0,u=l.length;m<u;++m)if(l[m].GetBehaviorType().GetSID()===g)return m;return-1}GetAllInstanceVariableValues(){return this._instVarValues}_GetAllInstanceVariableNames(){return this._objectType._GetAllInstanceVariableNames()}GetInstanceVariableCount(){return this._instVarValues.length}GetInstanceVariableValue(g){g|=0;const l=this._instVarValues;if(0>g||g>=l.length)throw new RangeError("invalid instance variable");return l[g]}_GetInstanceVariableValueUnchecked(g){return this._instVarValues[g]}_GetInstanceVariableTypedValue(g){const l=this._instVarValues[g];return 0===this._objectType.GetInstanceVariableType(g)?!!l:l}SetInstanceVariableValue(g,l){g|=0;const m=this._instVarValues;if(0>g||g>=m.length)throw new RangeError("invalid instance variable");switch(this._objectType.GetInstanceVariableType(g)){case 0:m[g]=l?1:0;break;case 1:m[g]="number"===typeof l?l:parseFloat(l);break;case 2:m[g]="string"===typeof l?l:l.toString();break;default:throw Error("unknown instance variable type");}}SetInstanceVariableOffset(g,l){if(0!==l){g|=0;var m=this._instVarValues;if(0>g||g>=m.length)throw new RangeError("invalid instance variable");var u=m[g];if("number"===typeof u)m[g]="number"===typeof l?m[g]+l:m[g]+parseFloat(l);else{if("boolean"===typeof u)throw Error("can not set offset of boolean variable");if("string"===typeof u)throw Error("can not set offset of string variable");throw Error("unknown instance variable type");}}}GetSavedDataMap(){let g=f.get(this);if(g)return g;g=new Map;f.set(this,g);return g}GetUnsavedDataMap(){let g=h.get(this);if(g)return g;g=new Map;h.set(this,g);return g}_HasAnyCreateDestroyHandler(g){const l=this.GetObjectClass();if(l.UserScriptDispatcher().HasAnyHandlerFor(g))return!0;for(const m of l.GetFamilies())if(m.UserScriptDispatcher().HasAnyHandlerFor(g))return!0;return this._runtime.UserScriptDispatcher().HasAnyHandlerFor(g)?!0:!1}_TriggerOnCreatedOnSelfAndRelated(){const g=new Set;g.add(this);const l=this.GetWorldInfo();if(l&&l.HasChildren())for(const m of this.allChildren())if(g.add(m),m.IsInContainer())for(const u of m.siblings())g.add(u);if(this.IsInContainer())for(const m of this.siblings())g.add(m);for(const m of g.values())m._TriggerOnCreated()}_TriggerOnCreated(){if(this._HasAnyCreateDestroyHandler("instancecreate")){const g=this.GetObjectClass(),l=new e.Event("instancecreate");l.instance=this.GetInterfaceClass();g.DispatchUserScriptEvent(l);for(const m of g.GetFamilies())m.DispatchUserScriptEvent(l);this._runtime.DispatchUserScriptEvent(l)}this._runtime.Trigger(this.GetPlugin().constructor.Cnds.OnCreated,this,null)}_TriggerOnDestroyed(){this._runtime.Trigger(this.GetPlugin().constructor.Cnds.OnDestroyed,this,null)}_FireDestroyedScriptEvents(g){if(this._iScriptInterface){var l=new e.Event("destroy");l.isEndingLayout=g;this.DispatchUserScriptEvent(l)}if(this._HasAnyCreateDestroyHandler("instancedestroy")){l=this.GetObjectClass();var m=new e.Event("instancedestroy");m.instance=this.GetInterfaceClass();m.isEndingLayout=g;l.DispatchUserScriptEvent(m);for(const u of l.GetFamilies())u.DispatchUserScriptEvent(m);this._runtime.DispatchUserScriptEvent(m)}}_GetDebuggerProperties(){return this._sdkInst.GetDebuggerProperties()}SaveToJson(g="full"){const l={};"full"===g?l.uid=this.GetUID():l.c3=!0;if("visual-state"!==g){var m=f.get(this);m&&m.size&&(l.ex=e.ToSuperJSON(m));-1!==this.GetTimeScale()&&(l.mts=this.GetTimeScale());if(0<this._objectType.GetInstanceVariablesCount()){m={};var u=this._objectType.GetInstanceVariableSIDs();for(let x=0,n=this._instVarValues.length;x<n;++x)m[u[x].toString()]=this._instVarValues[x];l.ivs=m}if(this._behaviorInstances.length){m={};for(const x of this._behaviorInstances)(u=x.SaveToJson())&&(m[x.GetBehaviorType().GetSID().toString()]=u);l.behs=m}}this._worldInfo&&(l.w=this._worldInfo._SaveToJson(g));(g=this._sdkInst.SaveToJson())&&(l.data=g);return l}_OnBeforeLoad(g="full"){this._worldInfo&&this._worldInfo._OnBeforeLoad(g)}LoadFromJson(g,l="full"){if("full"===l)this._uid=g.uid;else if(!g.c3)return;if("visual-state"!==l){var m=f.get(this);m&&(m.clear(),f.delete(this));if(m=g.ex)m=e.FromSuperJSON(m),f.set(this,m);this._timeScale=g.hasOwnProperty("mts")?g.mts:-1;if(m=g.ivs)for(const[n,q]of Object.entries(m))if(m=parseInt(n,10),m=this._objectType.GetInstanceVariableIndexBySID(m),!(0>m||m>=this._instVarValues.length)){var u=q;null===u&&(u=NaN);this._instVarValues[m]=u}}if(this.GetPlugin().IsWorldType()){m=g.w;var x=m.l;this._worldInfo.GetLayer().GetSID()!==x&&(u=this._worldInfo.GetLayer(),(x=u.GetLayout().GetLayerBySID(x))?(this._worldInfo._SetLayer(x),u._RemoveInstance(this,!0),x._AddInstance(this,!0),x.SetZIndicesChanged(),this._worldInfo.SetBboxChanged()):"full"===l&&this._runtime.DestroyInstance(this));this._worldInfo._LoadFromJson(m,l)}if("visual-state"!==l&&(l=g.behs))for(const[n,q]of Object.entries(l))l=parseInt(n,10),l=this.GetBehaviorIndexBySID(l),0>l||l>=this._behaviorInstances.length||this._behaviorInstances[l].LoadFromJson(q);(g=g.data)&&this._sdkInst.LoadFromJson(g)}GetInterfaceClass(){return this._iScriptInterface||this._InitUserScriptInterface()}_InitUserScriptInterface(){var g=this._worldInfo?self.IWorldInstance:b;const l=this._sdkInst.GetScriptInterfaceClass(),m=this._objectType._GetUserScriptInstanceClass(),u=m||l||g;b._Init(this);this._iScriptInterface=new u;b._Init(null);if(l&&!(this._iScriptInterface instanceof g))throw new TypeError(`script interface class '${l.name}' does not extend the right base class '${g.name}'`);if(m&&(g=l||g,!(this._iScriptInterface instanceof g)))throw new TypeError(`setInstanceClass(): class '${m.name}' does not extend the right base class '${g.name}'`);return this._iScriptInterface}_GetInstVarsScriptDescriptor(g){if(0!==this._instVarValues.length){var l={},m=this._objectType._GetAllInstanceVariableJsPropNames();for(let u=0,x=m.length;u<x;++u)l[m[u]]={configurable:!1,enumerable:!0,get:e.Instance.prototype._GetInstanceVariableTypedValue.bind(this,u),set:e.Instance.prototype.SetInstanceVariableValue.bind(this,u)};l=Object.create(Object.prototype,l);g.instVars={value:l,writable:!1}}}_GetBehaviorsScriptDescriptor(g){var l=this._behaviorInstances;if(0!==l.length){var m={};for(const u of l)m[u.GetBehaviorType().GetJsPropName()]={value:u.GetScriptInterface(),writable:!1};l=Object.create(Object.prototype,m);g.behaviors={value:l,writable:!1}}}DispatchUserScriptEvent(g){g.instance=this.GetInterfaceClass();var l=this._runtime;(l=l.IsDebug()&&!l.GetEventSheetManager().IsInEventEngine())&&a.StartMeasuringScriptTime();this.GetInterfaceClass().dispatchEvent(g);l&&a.AddScriptTime()}}}
  {"use strict";const e=self.C3;e.SceneGraphInfo=class extends e.DefendedBase{constructor(a){super();this._owner=a;this._parent=null;this._children=[];this._startWidth=a.GetWidth();this._startHeight=a.GetHeight();this._startScaleY=this._startScaleX=1;this._parentStartAngle=0}Release(){this._parent=null;e.clearArray(this._children)}SetParent(a){this._parentStartAngle=(this._parent=a)?a.GetAngle():0}GetParent(){return this._parent}HasChildren(){return 0<this._children.length}GetChildren(){return this._children}GetStartScaleX(){return this._startScaleX}SetStartScaleX(a){this._startScaleX=a}GetStartScaleY(){return this._startScaleY}SetStartScaleY(a){this._startScaleY=a}_GetStartWidth(){return this._startWidth}_GetStartHeight(){return this._startHeight}GetParentScaleX(){return this._owner.GetTransformWithParentWidth()?this._parent.GetWidth()/this._parent._GetSceneGraphInfo()._GetStartWidth():1}GetParentScaleY(){return this._owner.GetTransformWithParentHeight()?this._parent.GetHeight()/this._parent._GetSceneGraphInfo()._GetStartHeight():1}GetParentStartAngle(){return this._parentStartAngle}_SaveToJson(){return{sw:this._startWidth,sh:this._startHeight,sx:this._startScaleX,sy:this._startScaleY,psa:this._parentStartAngle,c:this._children.map(a=>{let b="";a.GetTransformWithParentX()&&(b+="x");a.GetTransformWithParentY()&&(b+="y");a.GetTransformWithParentWidth()&&(b+="w");a.GetTransformWithParentHeight()&&(b+="h");a.GetTransformWithParentAngle()&&(b+="a");a.GetTransformWithParentZElevation()&&(b+="z");a.GetDestroyWithParent()&&(b+="d");return{uid:a.GetInstance().GetUID(),f:b}})}}_LoadFromJson(a){this._startWidth=a.sw;this._startHeight=a.sh;this._startScaleX=a.sx;this._startScaleY=a.sy;this._parentStartAngle=a.psa}_OnAfterLoad(a){const b=this._owner,d=b.GetRuntime();for(const c of a.c){a=d.GetInstanceByUID(c.uid).GetWorldInfo();const f=c.f,h={};h.transformX=f.includes("x");h.transformY=f.includes("y");h.transformWidth=f.includes("w");h.transformHeight=f.includes("h");h.transformAngle=f.includes("a");h.transformZElevation=f.includes("z");h.destroyWithParent=f.includes("d");b.AddChild(a,h)}}}}
  {"use strict";const e=self.C3,a=e.New(e.Rect),b=e.New(e.Quad),d=e.New(e.Event,"bboxchange",!1),c=e.New(e.Color,0,0,0,0),f=e.New(e.CollisionPoly),h=e.New(e.Color,1,1,1,1),g=e.New(e.Rect,0,0,-1,-1),l=e.New(e.Rect,0,0,-1,-1),m=new Set(["absolute","relative"]),u=[];let x=!0;e.WorldInfo=class extends e.DefendedBase{constructor(n,q){super();this._inst=n;this._objectClass=n.GetObjectClass();this._runtime=n.GetRuntime();this._layer=q;this._zIndex=-1;this._flags=196635;this._objectClass.GetPlugin().IsRotatable()&&(this._flags|=128);this._oy=this._ox=this._cosA=this._sinA=this._a=this._depth=this._h=this._w=this._zElevation=this._y=this._x=NaN;this._boundingBox=e.New(e.Rect);this._boundingQuad=e.New(e.Quad);this._collisionCells=l;this._renderCells=g;this._solidFilterTags=this._transformedPolyInfo=this._sourceCollisionPoly=null;this._colorPremultiplied=this._color=h;this._instanceEffectList=this._stateGroup=null;this._inst.GetObjectClass().UsesEffects()&&(this._instanceEffectList=e.New(e.InstanceEffectList,this._inst,this));this._sceneGraphInfo=null;this._sceneGraphFlagsExportData=NaN;this._sceneGraphChildrenExportData=null;this._sceneGraphZIndex=this._sceneGraphZIndexExportData=NaN;this._meshInfo=null}_MarkDestroyed(){this._flags|=256}Release(){this._stateGroup&&(this._runtime.GetRenderer().ReleaseStateGroup(this._stateGroup),this._stateGroup=null);this._sourceCollisionPoly=null;this._transformedPolyInfo&&(this._transformedPolyInfo.poly.Release(),this._transformedPolyInfo=null);this._solidFilterTags&&(this._solidFilterTags.clear(),this._solidFilterTags=null);this.ReleaseMesh();this.HasParent()&&this.GetParent().RemoveChild(this);if(this.HasChildren()){const n=[...this.GetChildren()];for(const q of n)this.RemoveChild(q)}this._ReleaseSceneGraphInfo();this._layer=this._runtime=this._objectClass=this._inst=null}Init(n){x=!1;this.SetXY(n[0],n[1]);this.SetZElevation(n[2]);this.SetSize(n[3],n[4]);this._depth=0;this.IsRotatable()?this.SetAngle(n[6]):this._a=0;c.setFromJSON(n[7]);this._SetColor(c);this.SetOriginX(n[8]);this.SetOriginY(n[9]);this.SetBlendMode(n[10]);this._instanceEffectList&&this._instanceEffectList._LoadEffectParameters(n[12]);n[14]&&(this._sceneGraphFlagsExportData=n[14][0],this._sceneGraphChildrenExportData=n[14][1],this._sceneGraphZIndexExportData=n[14][2]);if(n[15]){var q=n[15];this.CreateMesh(q[0],q[1]);n=this.GetSourceMesh();q=q[2];for(let t=0,r=q.length;t<r;++t){const w=q[t];for(let y=0,B=w.length;y<B;++y){const E=w[y],H=n.GetMeshPointAt(y,t);H.SetX(E[0]);H.SetY(E[1]);H.SetZElevation(E[2]);H.SetU(E[3]);H.SetV(E[4])}}}x=!0;this._UpdateRendererStateGroup()}InitNoData(){this._sinA=this._a=this._depth=this._h=this._w=this._zElevation=this._y=this._x=0;this._cosA=1;this._oy=this._ox=0;this._UpdateRendererStateGroup()}GetRuntime(){return this._runtime}GetObjectClass(){return this._objectClass}GetInstance(){return this._inst}_GetParentOffsetAngle(){return this.GetTransformWithParentAngle()?this.GetParent().GetAngle()-this._sceneGraphInfo.GetParentStartAngle():0}SetX(n){n=+n;if(this.GetTransformWithParentX()){const q=this._sceneGraphInfo;n-=this.GetX();const t=-this._GetParentOffsetAngle();0===t?this._x+=n/q.GetParentScaleX():(this._x+=Math.cos(t)*n/q.GetParentScaleX(),this.GetTransformWithParentY()&&(this._y+=Math.sin(t)*n/q.GetParentScaleY()))}else this._x=n}OffsetX(n){n=+n;this.GetTransformWithParentX()?this.SetX(this.GetX()+n):this._x+=n}GetX(){if(this.GetTransformWithParentX()){let n=this._x;const q=this._sceneGraphInfo,t=this.GetParent(),r=this._GetParentOffsetAngle();0===r?n*=q.GetParentScaleX():(n=n*q.GetParentScaleX()*Math.cos(r),this.GetTransformWithParentY()&&(n-=this._y*q.GetParentScaleY()*Math.sin(r)));return t.GetX()+n}return this._x}SetY(n){n=+n;if(this.GetTransformWithParentY()){const q=this._sceneGraphInfo;n-=this.GetY();const t=-this._GetParentOffsetAngle();0===t?this._y+=n/q.GetParentScaleY():(this.GetTransformWithParentX()&&(this._x-=Math.sin(t)*n/q.GetParentScaleX()),this._y+=Math.cos(t)*n/q.GetParentScaleY())}else this._y=n}OffsetY(n){n=+n;this.GetTransformWithParentY()?this.SetY(this.GetY()+n):this._y+=n}GetY(){if(this.GetTransformWithParentY()){let n=this._y;const q=this._sceneGraphInfo,t=this.GetParent(),r=this._GetParentOffsetAngle();0===r?n*=q.GetParentScaleY():(n=n*q.GetParentScaleY()*Math.cos(r),this.GetTransformWithParentX()&&(n+=this._x*q.GetParentScaleX()*Math.sin(r)));return t.GetY()+n}return this._y}SetXY(n,q){n=+n;q=+q;if(this.GetTransformWithParentXOrY()){const r=this.GetTransformWithParentX(),w=this.GetTransformWithParentY(),y=this._sceneGraphInfo,B=n-this.GetX(),E=q-this.GetY();var t=-this._GetParentOffsetAngle();if(0===t)this._x=r?this._x+B/y.GetParentScaleX():n,this._y=w?this._y+E/y.GetParentScaleY():q;else{const H=Math.sin(t);t=Math.cos(t);this._x=r?w?this._x+(t*B-H*E)/y.GetParentScaleX():this._x+t*B/y.GetParentScaleX():n;this._y=w?r?this._y+(H*B+t*E)/y.GetParentScaleY():this._y+t*E/y.GetParentScaleY():q}}else this._x=n,this._y=q}OffsetXY(n,q){n=+n;q=+q;this.GetTransformWithParentXOrY()?this.SetXY(this.GetX()+n,this.GetY()+q):(this._x+=n,this._y+=q)}EqualsXY(n,q){return this.GetX()===n&&this.GetY()===q}SetZElevation(n){n=+n;this.GetTransformWithParentZElevation()&&(n-=this.GetParent().GetZElevation());this._zElevation!==n&&(this._zElevation=n,this._UpdateZElevation(),n=this.GetLayer(),0!==this._zElevation&&n._SetAnyInstanceZElevated(),n.SetZIndicesChanged())}_UpdateZElevation(){this._UpdateRendererStateGroup();if(this.HasChildren()){const n=this.GetChildren();for(let q=0,t=n.length;q<t;q++){const r=n[q];r.GetTransformWithParentZElevation()&&r._UpdateZElevation()}}}OffsetZElevation(n){this.SetZElevation(this.GetZElevation()+
  n)}GetZElevation(){return this.GetTransformWithParentZElevation()?this.GetParent().GetZElevation()+this._zElevation:this._zElevation}GetTotalZElevation(){return this.GetLayer().GetZElevation()+this.GetZElevation()}SetWidth(n){n=+n;this.GetTransformWithParentWidth()?this._w*=n/this.GetWidth():this._w=n}OffsetWidth(n){n=+n;this.GetTransformWithParentWidth()?this.SetWidth(this.GetWidth()+n):this._w+=n}GetWidth(){return this.GetTransformWithParentWidth()?this.GetParent().GetWidth()*this._w:this._w}SetHeight(n){n=+n;this.GetTransformWithParentHeight()?this._h*=n/this.GetHeight():this._h=n}OffsetHeight(n){n=+n;this.GetTransformWithParentHeight()?this.SetHeight(this.GetHeight()+n):this._h+=n}GetHeight(){return this.GetTransformWithParentHeight()?this.GetParent().GetHeight()*this._h:this._h}SetSize(n,q){n=+n;q=+q;this.GetTransformWithParentWidth()?this._w*=n/this.GetWidth():this._w=n;this.GetTransformWithParentHeight()?this._h*=q/this.GetHeight():this._h=q}GetDepth(){return this._depth}SetDepth(n){if(0>n)throw new RangeError("invalid depth");this._depth=n}GetSceneGraphScale(){if(this.HasParent()){const n=this._sceneGraphInfo;return Math.min(n.GetParentScaleX(),n.GetParentScaleY())}return 1}IsRotatable(){return 0!==(this._flags&128)}SetAngle(n){n=+n;this.IsRotatable()&&(this.GetTransformWithParentAngle()&&(n-=this.GetParent().GetAngle()),n=e.clampAngle(n),this._a!==n&&(this._a=n,this._MarkSinCosAngleChanged()))}OffsetAngle(n){n=+n;0!==n&&this.IsRotatable()&&(this._a=e.clampAngle(this._a+n),this._MarkSinCosAngleChanged())}_MarkSinCosAngleChanged(){this._flags|=262144;if(this.HasChildren()){const n=this.GetChildren();for(let q=0,t=n.length;q<t;q++)n[q]._MarkSinCosAngleChanged()}}GetAngle(){return this.GetTransformWithParentAngle()?e.clampAngle(this.GetParent().GetAngle()+this._a):this._a}_MaybeUpdateSinCosAngle(){const n=this._flags;if(0!==(n&262144)){var q=this.GetAngle();this._sinA=Math.sin(q);this._cosA=Math.cos(q);this._flags=n&-262145}}GetSinAngle(){this._MaybeUpdateSinCosAngle();return this._sinA}GetCosAngle(){this._MaybeUpdateSinCosAngle();return this._cosA}SetOriginX(n){this._ox=+n}OffsetOriginX(n){this._ox+=+n}GetOriginX(){return this._ox}SetOriginY(n){this._oy=+n}OffsetOriginY(n){this._oy+=+n}GetOriginY(){return this._oy}_SetColor(n){this._color.equals(n)||(this._color===h?(this._color=e.New(e.Color,n),this._colorPremultiplied=e.New(e.Color,n),this._colorPremultiplied.premultiply()):n.equalsRgba(1,1,1,1)?this._colorPremultiplied=this._color=h:(this._color.set(n),this._colorPremultiplied.set(n),this._colorPremultiplied.premultiply()),this._UpdateRendererStateGroup())}SetOpacity(n){n=e.clamp(+n,0,1);this._color.a!==n&&(c.copyRgb(this._color),c.a=n,this._SetColor(c))}OffsetOpacity(n){this.SetOpacity(this.GetOpacity()+n)}GetOpacity(){return this._color.a}SetUnpremultipliedColor(n){this._color.equalsIgnoringAlpha(n)||(c.copyRgb(n),c.a=this._color.a,this._SetColor(c))}SetUnpremultipliedColorRGB(n,q,t){c.setRgb(n,q,t);this.SetUnpremultipliedColor(c)}OffsetUnpremultipliedColorRGB(n,q,t){if(0!==n||0!==q||0!==t)c.copyRgb(this._color),c.r+=n,c.g+=q,c.b+=t,this.SetUnpremultipliedColor(c)}GetUnpremultipliedColor(){return this._color}GetPremultipliedColor(){return this._colorPremultiplied}GetDestroyWithParent(){return 0!==(this._flags&512)}SetDestroyWithParent(n){this._SetFlag(512,n)}GetTransformWithParentX(){return 0!==(this._flags&1024)}SetTransformWithParentX(n){this._SetFlag(1024,n)}GetTransformWithParentY(){return 0!==(this._flags&2048)}GetTransformWithParentXOrY(){return 0!==(this._flags&3072)}SetTransformWithParentY(n){this._SetFlag(2048,n)}GetTransformWithParentWidth(){return 0!==(this._flags&4096)}SetTransformWithParentWidth(n){this._SetFlag(4096,n)}GetTransformWithParentHeight(){return 0!==(this._flags&8192)}SetTransformWithParentHeight(n){this._SetFlag(8192,n)}GetTransformWithParentAngle(){return 0!==(this._flags&16384)}SetTransformWithParentAngle(n){this._SetFlag(16384,n)}GetTransformWithParentZElevation(){return 0!==(this._flags&32768)}SetTransformWithParentZElevation(n){this._SetFlag(32768,n)}_ClearAllSceneGraphFlags(){this._flags&=-65025}AddChild(n,q){if(n!==this&&!n.HasParent()&&!this._HasChildRecursive(n)&&!this._HasAnyParent(n)){var t=n.GetX(),r=n.GetY(),w=n.GetWidth(),y=n.GetHeight(),B=n.GetAngle(),E=n.GetZElevation();n._SetParent(this);n.SetTransformWithParentX(q.transformX);n.SetTransformWithParentY(q.transformY);n.SetTransformWithParentWidth(q.transformWidth);n.SetTransformWithParentHeight(q.transformHeight);n.SetTransformWithParentAngle(q.transformAngle);n.SetTransformWithParentZElevation(q.transformZElevation);n.SetDestroyWithParent(q.destroyWithParent);q.transformX&&(n._x=t-this.GetX(),q.transformWidth&&(n._x/=this.GetWidth()/this._sceneGraphInfo._GetStartWidth()));q.transformY&&(n._y=r-this.GetY(),q.transformHeight&&(n._y/=this.GetHeight()/this._sceneGraphInfo._GetStartHeight()));q.transformWidth&&(n._w=w/this.GetWidth(),n._sceneGraphInfo.SetStartScaleX(n._w));q.transformHeight&&(n._h=y/this.GetHeight(),n._sceneGraphInfo.SetStartScaleY(n._h));q.transformAngle&&(n._a=B-this.GetAngle());q.transformZElevation&&(n._zElevation=E-this.GetZElevation());this._AddChildToSceneGraphInfo(n);this.SetBboxChanged()}}RemoveChild(n){if(n.GetParent()===this){var q=n.GetX(),t=n.GetY(),r=n.GetWidth(),w=n.GetHeight(),y=n.GetAngle(),B=n.GetZElevation();n._SetParent(null);n._ClearAllSceneGraphFlags();n.SetXY(q,t);n.SetSize(r,w);n.SetAngle(y);n.SetZElevation(B);this._RemoveChildFromSceneGraphInfo(n);this.SetBboxChanged()}}_ResetAllSceneGraphState(){for(var n of this.children())this.RemoveChild(n);(n=this.GetParent())&&n.RemoveChild(this);this._ClearAllSceneGraphFlags()}HasParent(){return null!==this.GetParent()}GetParent(){const n=this._sceneGraphInfo;return null!==n?n.GetParent():null}GetTopParent(){let n=this;for(;n.HasParent();)n=n.GetParent();return n}*parents(){let n=this.GetParent();for(;n;)yield n,n=n.GetParent()}HasChild(n){return this.GetChildren().includes(n)}HasChildren(){const n=this._sceneGraphInfo;return null!==n?n.HasChildren():!1}GetChildren(){const n=this._sceneGraphInfo;return null!==n?n.GetChildren():u}children(){return this.GetChildren()}*allChildren(){for(const n of this.children())yield n,yield*n.allChildren()}GetChildCount(){return this.GetChildren().length}GetChildAt(n){const q=this.GetChildren();n=Math.floor(+n);return 0>n||n>=q.length?null:q[n]}_CreateSceneGraphInfo(n){this._sceneGraphInfo||(this._sceneGraphInfo=e.New(e.SceneGraphInfo,this));n&&this._sceneGraphInfo.SetParent(n)}_GetSceneGraphInfo(){return this._sceneGraphInfo}_ReleaseSceneGraphInfo(){this._sceneGraphInfo&&(this._sceneGraphInfo.Release(),this._sceneGraphInfo=null)}_SetParent(n){n?(n._CreateSceneGraphInfo(null),this._CreateSceneGraphInfo(n)):(this._sceneGraphInfo&&this._sceneGraphInfo.SetParent(null),this.HasChildren()||this._ReleaseSceneGraphInfo())}_HasAnyParent(n){if(!this.HasParent())return!1;const q=this.GetParent();return q===n?!0:q._HasAnyParent(n)}_HasChildRecursive(n){if(this.HasChild(n))return!0;for(const q of this.GetChildren())if(q._HasChildRecursive(n))return!0;return!1}_AddChildToSceneGraphInfo(n){this._sceneGraphInfo.GetChildren().push(n)}_RemoveChildFromSceneGraphInfo(n){const q=this._sceneGraphInfo.GetChildren(),t=q.indexOf(n);-1!==t&&q.splice(t,1);0!==q.length||this.HasParent()||this._ReleaseSceneGraphInfo();n.HasChildren()||n._ReleaseSceneGraphInfo()}GetSceneGraphChildrenExportData(){return this._sceneGraphChildrenExportData}GetSceneGraphZIndexExportData(){return this._sceneGraphZIndexExportData}GetSceneGraphZIndex(){return this._sceneGraphZIndex}SetSceneGraphZIndex(n){this._sceneGraphZIndex=n}SetUsePointsShaderProgram(){this._SetFlag(524288,!0);this._UpdateRendererStateGroup()}_UpdateRendererStateGroup(){if(x){var n=this._runtime.GetRenderer();this._stateGroup&&n.ReleaseStateGroup(this._stateGroup);var q=0!==(this._flags&524288)?n.GetPointsRenderingProgram()||"<point>":n.GetTextureFillShaderProgram()||"<default>";this._stateGroup=n.AcquireStateGroup(q,this.GetBlendMode(),this._colorPremultiplied,this.GetZElevation())}}GetRendererStateGroup(){return this._stateGroup}HasDefaultColor(){return this._color===h}SetBlendMode(n){n|=0;if(0>n||31<n)throw new RangeError("invalid blend mode");this.GetBlendMode()!==n&&(this._flags=this._flags&-2080374785|n<<26,this._UpdateRendererStateGroup())}GetBlendMode(){return(this._flags&2080374784)>>26}_SetLayer(n){this._layer=n;0!==this.GetZElevation()&&this._layer._SetAnyInstanceZElevated()}GetLayer(){return this._layer}GetLayout(){return this.GetLayer().GetLayout()}_SetZIndex(n){this._zIndex=n|0}GetZIndex(){this._layer._UpdateZIndices();return this._zIndex}_GetLastCachedZIndex(){return this._zIndex}_SetFlag(n,q){this._flags=q?this._flags|n:this._flags&~n}IsVisible(){return 0!==(this._flags&1)}SetVisible(n){this._SetFlag(1,n)}IsCollisionEnabled(){return 0!==(this._flags&8)}SetCollisionEnabled(n){n=!!n;this.IsCollisionEnabled()!==n&&(this._SetFlag(8,n),n?this.SetBboxChanged():this._RemoveFromCollisionCells())}SetSolidCollisionFilter(n,q){this._SetFlag(32,n);this._solidFilterTags&&this._solidFilterTags.clear();if(q.trim()){this._solidFilterTags||(this._solidFilterTags=new Set);for(const t of q.split(" "))t&&this._solidFilterTags.add(t.toLowerCase())}else this._solidFilterTags=null}IsSolidCollisionAllowed(n){const q=0!==(this._flags&32),t=this._solidFilterTags;if(!n||!t)return!q;for(const r of t)if(n.has(r))return q;return!q}SetBboxChanged(){this._flags|=65554;this._objectClass._SetAnyCollisionCellChanged(!0);this._runtime.UpdateRender();this._layer.UsesRenderCells()&&(this.CalculateBbox(this._boundingBox,this._boundingQuad,!0),this._flags&=-3,this._UpdateRenderCell());0!==(this._flags&4)&&this._inst.Dispatcher().dispatchEvent(d);if(null!==this._sceneGraphInfo){const n=this._sceneGraphInfo.GetChildren();for(let q=0,t=n.length;q<t;++q)n[q].SetBboxChanged()}}CalculateBbox(n,q,t){const r=this.GetX(),w=this.GetY(),y=this.GetWidth(),B=this.GetHeight(),E=this.GetAngle();n.setWH(r-this._ox*y,w-this._oy*B,y,B);t&&this.HasMesh()&&this._ExpandBboxForMesh(n);0===E?q.setFromRect(n):(n.offset(-r,-w),q.setFromRotatedRectPrecalc(n,this.GetSinAngle(),this.GetCosAngle()),q.offset(r,w),q.getBoundingBox(n));n.normalize()}_UpdateBbox(){const n=this._flags;0!==(n&2)&&(this.CalculateBbox(this._boundingBox,this._boundingQuad,!0),this._flags=n&-3)}GetBoundingBox(){this._UpdateBbox();return this._boundingBox}GetBoundingQuad(){this._UpdateBbox();return this._boundingQuad}PixelRoundQuad(n){var q=this.GetX(),t=this.GetY();q=Math.round(q)-q;t=Math.round(t)-t;if(0===q&&0===t)return n;b.copy(n);b.offset(q,t);return b}OverwriteBoundingBox(n){this._boundingBox.copy(n);this._boundingQuad.setFromRect(this._boundingBox);this._flags&=-3;this._UpdateCollisionCell();this._UpdateRenderCell()}SetBboxChangeEventEnabled(n){this._SetFlag(4,n)}IsBboxChangeEventEnabled(){return 0!==(this._flags&4)}IsInViewport(n,q,t){return q&&0!==this.GetDepth()?this.IsInViewport3D(this.GetLayer()._GetViewFrustum()):0===this.GetZElevation()||t?n.intersectsRect(this.GetBoundingBox()):this._IsInViewport_ZElevated()}_IsInViewport_ZElevated(){const n=this.GetLayer(),q=this.GetTotalZElevation();if(q>=n.GetCameraZ())return!1;n.GetViewportForZ(q,a);return a.intersectsRect(this.GetBoundingBox())}IsInViewport3D(n){var q=this.GetBoundingBox();const t=q.getLeft(),r=q.getRight(),w=q.getTop();q=q.getBottom();const y=this.GetTotalZElevation(),B=y+this.GetDepth();return n.ContainsAABB(t,w,y,r,q,B)}_SetDrawBackFaceOnly(n){this._SetFlag(1048576,n)}_SetDrawNonBackFacesOnly(n){this._SetFlag(2097152,n)}IsDrawBackFaceOnly(){return 0!==(this._flags&1048576)}IsDrawNonBackFacesOnly(){return 0!==(this._flags&2097152)}SetSourceCollisionPoly(n){this._sourceCollisionPoly=n;this._DiscardTransformedCollisionPoly();this.HasMesh()&&(this._meshInfo.meshPoly=null)}GetSourceCollisionPoly(){return this._sourceCollisionPoly}HasOwnCollisionPoly(){return null!==this._sourceCollisionPoly||this.HasMesh()}GetTransformedCollisionPoly(){return this._GetCustomTransformedCollisionPolyPrecalc(this.GetWidth(),this.GetHeight(),this.GetAngle(),this.GetSinAngle(),this.GetCosAngle())}GetCustomTransformedCollisionPoly(n,q,t){let r=0,w=1;0!==t&&(r=Math.sin(t),w=Math.cos(t));return this._GetCustomTransformedCollisionPolyPrecalc(n,q,t,r,w)}_GetCustomTransformedCollisionPolyPrecalc(n,q,t,r,w){let y=this._transformedPolyInfo;null===y&&(this._transformedPolyInfo=y={poly:e.New(e.CollisionPoly),width:NaN,height:NaN,angle:NaN});const B=y.poly;if(y.width===n&&y.height===q&&y.angle===t)return B;const E=this._sourceCollisionPoly;if(this.HasMesh()){const H=this.GetOriginX(),K=this.GetOriginY(),C=this.GetSourceMesh();let A=this._meshInfo.meshPoly;A||(E?(f.copy(E),f.offset(H,K)):f.setDefaultPoints(),A=C.InsertPolyMeshVertices(f),this._meshInfo.meshPoly=A);C.TransformCollisionPoly(A,B);B.offset(-H,-K);B.transformPrecalc(n,q,r,w)}else E?(B.copy(E),B.transformPrecalc(n,q,r,w)):B.setFromQuad(this.GetBoundingQuad(),-this.GetX(),-this.GetY());y.width=n;y.height=q;y.angle=t;return B}_DiscardTransformedCollisionPoly(){this.SetPhysicsBodyChanged(!0);const n=this._transformedPolyInfo;null!==n&&(n.width=NaN)}CreateMesh(n,q){n=Math.floor(n);q=Math.floor(q);if(!this.GetInstance().GetPlugin().SupportsMesh())throw Error("object does not support mesh");this.ReleaseMesh();this._meshInfo={sourceMesh:e.New(e.Gfx.Mesh,n,q),transformedMesh:e.New(e.Gfx.Mesh,n,q),meshPoly:null}}HasMesh(){return null!==this._meshInfo}GetSourceMesh(){if(!this.HasMesh())throw Error("no mesh");return this._meshInfo.sourceMesh}GetTransformedMesh(){if(!this.HasMesh())throw Error("no mesh");return this._meshInfo.transformedMesh}SetMeshChanged(n){this._SetFlag(65536,n)}IsMeshChanged(){return 0!==(this._flags&65536)}SetPhysicsBodyChanged(n){this._SetFlag(131072,n)}IsPhysicsBodyChanged(){return 0!==(this._flags&131072)}_ExpandBboxForMesh(n){const q=this._meshInfo.sourceMesh,t=Math.min(q.GetMinX(),0),r=Math.min(q.GetMinY(),0),w=Math.max(q.GetMaxX(),1),y=Math.max(q.GetMaxY(),1),B=n.width(),E=n.height();n.offsetLeft(t*B);n.offsetTop(r*E);n.offsetRight((w-1)*B);n.offsetBottom((y-1)*E);this._depth=q.GetMaxZ()}ReleaseMesh(){this._meshInfo&&(this._meshInfo.sourceMesh.Release(),this._meshInfo.transformedMesh.Release(),this._meshInfo=null,this._DiscardTransformedCollisionPoly())}SetMeshPoint(n,q,t){n=Math.floor(n);q=Math.floor(q);var r=t.mode||"absolute";if(!m.has(r))throw Error("invalid mode");r="relative"===r;let w=t.x,y=t.y;const B=t.zElevation;let E="number"===typeof t.u?t.u:r?0:-1;t="number"===typeof t.v?t.v:r?0:-1;if(!this.HasMesh())return!1;const H=this.GetSourceMesh(),K=H.GetMeshPointAt(n,q);if(null===K)return!1;let C=!1;"number"===typeof B&&K.GetZElevation()!==B&&(K.SetZElevation(B),C=!0);r&&(w+=n/(H.GetHSize()-1),y+=q/(H.GetVSize()-1));-1!==E||r?(r&&(E+=n/(H.GetHSize()-1)),E=e.clamp(E,0,1)):E=K.GetU();-1!==t||r?(r&&(t+=q/(H.GetVSize()-1)),t=e.clamp(t,0,1)):t=K.GetV();if(K.GetX()===w&&K.GetY()===y&&K.GetU()===E&&K.GetV()===t)return C;K.SetX(w);K.SetY(y);K.SetU(E);K.SetV(t);this._DiscardTransformedCollisionPoly();return!0}HasTilemap(){return this._inst.HasTilemap()}ContainsPoint(n,q){return this.GetBoundingBox().containsPoint(n,q)&&this.GetBoundingQuad().containsPoint(n,q)?this.HasTilemap()?this._inst.GetSdkInstance().TestPointOverlapTile(n,q):this.HasOwnCollisionPoly()?this.GetTransformedCollisionPoly().containsPoint(n-this.GetX(),q-this.GetY()):!0:!1}_IsCollisionCellChanged(){return 0!==(this._flags&16)}_UpdateCollisionCell(){if(this._IsCollisionCellChanged()&&this.IsCollisionEnabled()&&0===(this._flags&256)){var n=this.GetBoundingBox(),q=this._objectClass._GetCollisionCellGrid(),t=this._collisionCells;a.set(q.XToCell(n.getLeft()),q.YToCell(n.getTop()),q.XToCell(n.getRight()),q.YToCell(n.getBottom()));t.equals(a)||(n=this._inst,t===l?(q.Update(n,null,a),this._collisionCells=e.New(e.Rect,a)):(q.Update(n,t,a),t.copy(a)),this._flags&=-17)}}_RemoveFromCollisionCells(){const n=this._collisionCells;n!==l&&(this._objectClass._GetCollisionCellGrid().Update(this._inst,n,null),this._collisionCells=l)}_UpdateRenderCell(){const n=this.GetLayer();if(n.UsesRenderCells()&&0===(this._flags&256)){var q=n.GetRenderGrid(),t=this.GetBoundingBox(),r=this._renderCells;a.set(q.XToCell(t.getLeft()),q.YToCell(t.getTop()),q.XToCell(t.getRight()),q.YToCell(t.getBottom()));r.equals(a)||(t=this._inst,r===g?(q.Update(t,null,a),this._renderCells=e.New(e.Rect,a)):(q.Update(t,r,a),r.copy(a)),n.SetRenderListStale())}}_RemoveFromRenderCells(){const n=this._renderCells;n!==g&&(this.GetLayer().GetRenderGrid().Update(this._inst,n,null),this._renderCells=g)}GetRenderCellRange(){return this._renderCells}ZOrderMoveToTop(){const n=this._inst,q=this._layer,t=q._GetInstances();t.length&&t.at(-1)===n||(q._RemoveInstance(n,!1),q._AddInstance(n,!1),this._runtime.UpdateRender())}ZOrderMoveToBottom(){const n=this._inst,q=this._layer,t=q._GetInstances();t.length&&t[0]===n||(q._RemoveInstance(n,!1),q._PrependInstance(n,!1),this._runtime.UpdateRender())}ZOrderMoveToLayer(n){const q=this._inst,t=this._layer;if(t.GetLayout()!==n.GetLayout())throw Error("layer from different layout");n!==t&&(t._RemoveInstance(q,!0),this._SetLayer(n),n._AddInstance(q,!0),this._runtime.UpdateRender())}ZOrderMoveAdjacentToInstance(n,q){const t=this._inst;let r=!1;const w=this._layer;if(n.GetUID()!==t.GetUID()){var y=n.GetWorldInfo();if(!y)throw Error("expected world instance");y=y.GetLayer();w.GetIndex()!==y.GetIndex()&&(w._RemoveInstance(t,!0),this._SetLayer(y),y._AddInstance(t,!0),r=!0);n=y.MoveInstanceAdjacent(t,n,!!q);(r||n)&&this._runtime.UpdateRender()}}GetInstanceEffectList(){return this._instanceEffectList}_SetHasAnyActiveEffect(n){this._SetFlag(64,n)}HasAnyActiveEffect(){return 0!==(this._flags&64)}_SaveToJson(n){const q={x:this.GetX(),y:this.GetY(),w:this.GetWidth(),h:this.GetHeight(),l:this.GetLayer().GetSID(),zi:this.GetZIndex()};0!==this.GetZElevation()&&(q.ze=this.GetZElevation());0!==this.GetAngle()&&(q.a=this.GetAngle());this.HasDefaultColor()||(q.c=this._color.toJSON());.5!==this.GetOriginX()&&(q.oX=this.GetOriginX());.5!==this.GetOriginY()&&(q.oY=this.GetOriginY());0!==this.GetBlendMode()&&(q.bm=this.GetBlendMode());this.IsVisible()||(q.v=this.IsVisible());this.IsCollisionEnabled()||(q.ce=this.IsCollisionEnabled());this.IsBboxChangeEventEnabled()&&(q.be=this.IsBboxChangeEventEnabled());this._instanceEffectList&&(q.fx=this._instanceEffectList._SaveToJson());const t=0!==(this._flags&32);t&&(q.sfi=t);this._solidFilterTags&&(q.sft=[...this._solidFilterTags].join(" "));this._sceneGraphInfo&&"visual-state"!==n&&(q.sgi=this._sceneGraphInfo._SaveToJson());this.HasMesh()&&(q.mesh=this.GetSourceMesh().SaveToJson());return q}_OnBeforeLoad(n){"visual-state"!==n&&this._ResetAllSceneGraphState()}_LoadFromJson(n,q){x=!1;this.SetX(n.x);this.SetY(n.y);this.SetWidth(n.w);this.SetHeight(n.h);this._SetZIndex(n.zi);this.SetZElevation(n.hasOwnProperty("ze")?n.ze:0);this.SetAngle(n.hasOwnProperty("a")?n.a:0);n.hasOwnProperty("c")?c.setFromJSON(n.c):n.hasOwnProperty("o")?(c.copyRgb(this._color),c.a=n.o):c.setRgba(1,1,1,1);this._SetColor(c);this.SetOriginX(n.hasOwnProperty("oX")?n.oX:.5);this.SetOriginY(n.hasOwnProperty("oY")?n.oY:.5);this.SetBlendMode(n.hasOwnProperty("bm")?n.bm:0);this.SetVisible(n.hasOwnProperty("v")?n.v:!0);this.SetCollisionEnabled(n.hasOwnProperty("ce")?n.ce:!0);this.SetBboxChangeEventEnabled(n.hasOwnProperty("be")?n.be:!1);this.SetSolidCollisionFilter(n.hasOwnProperty("sfi")?n.sfi:!1,n.hasOwnProperty("sft")?n.sft:"");this._instanceEffectList&&n.hasOwnProperty("fx")&&this._instanceEffectList._LoadFromJson(n.fx);if(n.hasOwnProperty("sgi")&&"visual-state"!==q){this._CreateSceneGraphInfo(null);const t=this._sceneGraphInfo,r=n.sgi;t._LoadFromJson(r);const w=this.GetRuntime().Dispatcher(),y=()=>{w.removeEventListener("afterload",y);0===(this._flags&256)&&t._OnAfterLoad(r)};w.addEventListener("afterload",y)}n.hasOwnProperty("mesh")?(n=n.mesh,this.CreateMesh(n.cols,n.rows),this.GetSourceMesh().LoadFromJson(n)):this.ReleaseMesh();this.SetBboxChanged();x=!0;this._UpdateRendererStateGroup()}}}
  {"use strict";const e=self.C3;e.BehaviorType=class extends e.DefendedBase{constructor(a,b){super();const d=a.GetRuntime(),c=d.GetPluginManager(),f=d.GetObjectReference(b[1]);c.HasBehaviorByConstructorFunction(f)||c.CreateBehavior(b);this._runtime=d;this._objectClass=a;this._behavior=c.GetBehaviorByConstructorFunction(f);this._sdkType=null;this._instSdkCtor=f.Instance;this._sid=b[2];this._name=b[0];this._jsPropName=this._runtime.GetJsPropName(b[3]);this._sdkType=e.New(f.Type,this);this.OnCreate()}static Create(a,b){return e.New(e.BehaviorType,a,b)}Release(){this._behavior=this._runtime=null;this._sdkType.Release();this._instSdkCtor=this._sdkType=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}}}
  {"use strict";const e=self.C3,a=self.IBehaviorInstance;e.BehaviorInstance=class extends e.DefendedBase{constructor(b){super();this._runtime=b.runtime;this._behaviorType=b.behaviorType;this._behavior=this._behaviorType.GetBehavior();this._inst=b.instance;this._index=b.index;this._iScriptInterface=this._sdkInst=null;this._behavior._AddInstance(this._inst)}Release(){this._iScriptInterface&&(this._iScriptInterface._Release(),this._iScriptInterface=null);this._behavior._RemoveInstance(this._inst);this._sdkInst.Release();this._inst=this._behavior=this._behaviorType=this._runtime=this._iScriptInterface=this._sdkInst=null}_CreateSdkInstance(b){if(this._sdkInst)throw Error("already got sdk instance");this._sdkInst=e.New(this._behaviorType.GetInstanceSdkCtor(),this,b);this._InitScriptInterface()}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(b,d){this._sdkInst.OnSpriteFrameChanged(b,d)}_GetDebuggerProperties(){return this._sdkInst.GetDebuggerProperties()}SaveToJson(){return this._sdkInst.SaveToJson()}LoadFromJson(b){return this._sdkInst.LoadFromJson(b)}static SortByTickSequence(b,d){var c=b.GetObjectInstance(),f=d.GetObjectInstance();const h=c.GetObjectClass().GetIndex(),g=f.GetObjectClass().GetIndex();if(h!==g)return h-g;c=c.GetPUID();f=f.GetPUID();return c!==f?c-f:b.GetBehaviorInstance()._GetIndex()-d.GetBehaviorInstance()._GetIndex()}_InitScriptInterface(){const b=this._sdkInst.GetScriptInterfaceClass(),d=b||a;a._Init(this);this._iScriptInterface=new d;a._Init(null);if(b&&!(this._iScriptInterface instanceof a))throw new TypeError(`script interface class '${b.name}' does not extend the right base class '${a.name}'`);}GetScriptInterface(){return this._iScriptInterface}}}
  {"use strict";const e=self.C3;e.EffectList=class extends e.DefendedBase{constructor(a,b){super();this._owner=a;this._allEffectTypes=[];this._activeEffectTypes=[];this._effectTypesByName=new Map;this._effectParams=[];this._preservesOpaqueness=!0;for(const d of b)a=e.New(e.EffectType,this,d,this._allEffectTypes.length),this._allEffectTypes.push(a),this._effectTypesByName.set(a.GetName().toLowerCase(),a),3<=d.length&&this._effectParams.push(this._LoadSingleEffectParameters(d[2]));this.GetRuntime()._AddEffectList(this)}Release(){e.clearArray(this._allEffectTypes);e.clearArray(this._activeEffectTypes);this._effectTypesByName.clear();e.clearArray(this._effectParams);this._owner=null}PrependEffectTypes(a){if(a.length){this._allEffectTypes=a.concat(this._allEffectTypes);for(const b of a)this._effectTypesByName.set(b.GetName().toLowerCase(),b);for(let b=0,d=this._allEffectTypes.length;b<d;++b)this._allEffectTypes[b]._SetIndex(b)}}_LoadSingleEffectParameters(a){a=a.slice(0);for(let b=0,d=a.length;b<d;++b){const c=a[b];if(Array.isArray(c)){const f=e.New(e.Color);f.setFromJSON(c);a[b]=f}}return a}GetOwner(){return this._owner}GetRuntime(){return this._owner.GetRuntime()}UpdateActiveEffects(){e.clearArray(this._activeEffectTypes);let a=!0;for(const b of this._allEffectTypes)b.IsActive()&&(this._activeEffectTypes.push(b),b.GetShaderProgram().PreservesOpaqueness()||(a=!1));this._preservesOpaqueness=a}GetAllEffectTypes(){return this._allEffectTypes}HasAnyEffectType(){return 0<this._allEffectTypes.length}GetEffectTypeByName(a){return this._effectTypesByName.get(a.toLowerCase())||null}GetEffectTypeByIndex(a){a=Math.floor(+a);if(0>a||a>=this._allEffectTypes.length)throw new RangeError("invalid effect type index");return this._allEffectTypes[a]}IsEffectIndexActive(a){return this.GetEffectTypeByIndex(a).IsActive()}SetEffectIndexActive(a,b){this.GetEffectTypeByIndex(a).SetActive(b)}GetActiveEffectTypes(){return this._activeEffectTypes}HasAnyActiveEffect(){return 0<this._activeEffectTypes.length}PreservesOpaqueness(){return this._preservesOpaqueness}GetEffectParametersForIndex(a){return this._effectParams[a]}static SaveFxParamToJson(a){return a&&a instanceof e.Color?{t:"color",v:a.toJSON()}:a}static LoadFxParamFromJson(a){if("object"===typeof a){if("color"===a.t){const b=e.New(e.Color);b.setFromJSON(a.v);return b}throw Error("invalid effect parameter type");}return a}static SaveFxParamsToJson(a){return a.map(e.EffectList.SaveFxParamToJson)}static LoadFxParamsFromJson(a){return a.map(e.EffectList.LoadFxParamFromJson)}SaveToJson(){return this._allEffectTypes.map(a=>({name:a.GetName(),active:a.IsActive(),params:e.EffectList.SaveFxParamsToJson(this._effectParams[a.GetIndex()])}))}LoadFromJson(a){for(const b of a)if(a=this.GetEffectTypeByName(b.name))a.SetActive(b.active),this._effectParams[a.GetIndex()]=e.EffectList.LoadFxParamsFromJson(b.params);this.UpdateActiveEffects()}}}
  {"use strict";const e=self.C3;e.EffectType=class extends e.DefendedBase{constructor(a,b,d){super();this._effectList=a;this._id=b[0];this._name=b[1];this._index=d;this._shaderProgram=null;this._isActive=!0}Release(){this._shaderProgram=this._effectList=null}Clone(a){a=e.New(e.EffectType,a,[this._id,this._name],-1);a._shaderProgram=this._shaderProgram;a._isActive=this._isActive;return a}_InitRenderer(a){a=a.GetShaderProgramByName(this._id);if(!a)throw Error("failed to find shader program '"+this._id+
  "'");this._shaderProgram=a}GetEffectList(){return this._effectList}GetName(){return this._name}_SetIndex(a){this._index=a}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 a=[];for(let b=0,d=this._shaderProgram.GetParameterCount();b<d;++b){const c=this._shaderProgram.GetParameterType(b);if("float"===c||"percent"===c)a.push(0);else if("color"===c)a.push(e.New(e.Color,1,1,1,1));else throw new TypeError("unknown effect parameter type");}return a}}}
  {"use strict";const e=self.C3;e.InstanceEffectList=class extends e.DefendedBase{constructor(a,b,d){super();this._inst=a;this._wi=b;this._effectList=a.GetObjectClass().GetEffectList();this._activeEffectFlags=[];this._activeEffectTypes=[];this._preservesOpaqueness=!0;this._effectParams=[];for(const c of this._effectList.GetAllEffectTypes())this._activeEffectFlags.push(!0);this.UpdateActiveEffects()}Release(){e.clearArray(this._activeEffectFlags);e.clearArray(this._activeEffectTypes);e.clearArray(this._effectParams);this._effectList=this._inst=null}_LoadEffectParameters(a){for(const b of a)this._effectParams.push(this._LoadSingleEffectParameters(b))}_LoadSingleEffectParameters(a){a=a.slice(0);for(let b=0,d=a.length;b<d;++b){const c=a[b];if(Array.isArray(c)){const f=e.New(e.Color);f.setFromJSON(c);a[b]=f}}return a}LoadDefaultEffectParameters(){for(const a of this._effectList.GetAllEffectTypes())this._effectParams.push(a.GetDefaultParameterValues())}GetOwner(){return this._owner}GetEffectList(){return this._effectList}GetRuntime(){return this._inst.GetRuntime()}UpdateActiveEffects(){e.clearArray(this._activeEffectTypes);const a=this._effectList.GetAllEffectTypes(),b=this._activeEffectTypes,d=this._activeEffectFlags;let c=!0;for(let f=0,h=a.length;f<h;++f)if(d[f]){const g=a[f];b.push(g);g.GetShaderProgram().PreservesOpaqueness()||(c=!1)}this._preservesOpaqueness=c;this._wi._SetHasAnyActiveEffect(!!b.length)}GetActiveEffectTypes(){return this._activeEffectTypes}GetEffectParametersForIndex(a){return this._effectParams[a]}PreservesOpaqueness(){return this._preservesOpaqueness}HasAnyActiveBackgroundBlendingEffect(){return this._activeEffectTypes.some(a=>a.GetShaderProgram().UsesDest())}IsEffectIndexActive(a){return this._activeEffectFlags[a]}SetEffectIndexActive(a,b){this._activeEffectFlags[a]=!!b}GetAllEffectTypes(){return this._effectList.GetAllEffectTypes()}_SaveToJson(){return this._effectList.GetAllEffectTypes().map(a=>({name:a.GetName(),active:this._activeEffectFlags[a.GetIndex()],params:e.EffectList.SaveFxParamsToJson(this._effectParams[a.GetIndex()])}))}_LoadFromJson(a){for(const b of a)if(a=this._effectList.GetEffectTypeByName(b.name))this._activeEffectFlags[a.GetIndex()]=b.active,this._effectParams[a.GetIndex()]=e.EffectList.LoadFxParamsFromJson(b.params);this.UpdateActiveEffects()}}}
  {"use strict";const e=self.C3,a=[],b=[],d=[],c=e.New(e.CollisionPoly),f=e.New(e.CollisionPoly),h=e.New(e.Quad),g=e.New(e.Rect),l=e.New(e.Rect);let m=null,u=null,x=null;e.CollisionEngine=class extends e.DefendedBase{constructor(n){super();this._runtime=n;this._registeredCollisions=[];this._polyCheckSec=this._polyCheckCount=this._collisionCheckSec=this._collisionCheckCount=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(n,q){const t=n.GetWorldInfo(),r=q.GetWorldInfo();t&&r&&t.IsCollisionEnabled()&&r.IsCollisionEnabled()&&this._registeredCollisions.push([n,q])}AddRegisteredCollisionCandidates(n,q,t){for(const[r,w]of this._registeredCollisions){let y;if(n===r)y=w;else if(n===w)y=r;else continue;y.BelongsToObjectClass(q)&&(t.includes(y)||t.push(y))}}CheckRegisteredCollision(n,q){if(!this._registeredCollisions.length)return!1;for(const[t,r]of this._registeredCollisions)if(n===t&&q===r||n===r&&q===t)return!0;return!1}ClearRegisteredCollisions(){e.clearArray(this._registeredCollisions)}TestOverlap(n,q){if(!n||!q||n===q)return!1;n=n.GetWorldInfo();q=q.GetWorldInfo();if(!n.IsCollisionEnabled()||!q.IsCollisionEnabled())return!1;this._collisionCheckCount++;const t=n.GetLayer(),r=q.GetLayer();return t.IsTransformCompatibleWith(r)?this._TestOverlap_SameLayers(n,q):this._TestOverlap_DifferentLayers(n,q)}_TestOverlap_SameLayers(n,q){if(!n.GetBoundingBox().intersectsRect(q.GetBoundingBox()))return!1;this._polyCheckCount++;if(!n.GetBoundingQuad().intersectsQuad(q.GetBoundingQuad())||n.HasTilemap()&&q.HasTilemap())return!1;if(n.HasTilemap())return this.TestTilemapOverlap(n,q);if(q.HasTilemap())return this.TestTilemapOverlap(q,n);if(!n.HasOwnCollisionPoly()&&!q.HasOwnCollisionPoly())return!0;const t=n.GetTransformedCollisionPoly(),r=q.GetTransformedCollisionPoly();return t.intersectsPoly(r,q.GetX()-
  n.GetX(),q.GetY()-n.GetY())}_TestOverlap_DifferentLayers(n,q){var t=n.HasTilemap(),r=q.HasTilemap();if(t&&!r)return this.TestTilemapOverlapDifferentLayers(n,q);if(r&&!t)return this.TestTilemapOverlapDifferentLayers(q,n);if(r||t)return!1;r=n.GetLayer();t=q.GetLayer();c.copy(n.GetTransformedCollisionPoly());f.copy(q.GetTransformedCollisionPoly());var w=c.pointsArr();for(let y=0,B=w.length;y<B;y+=2){const E=y+1,H=w[E],[K,C]=r.LayerToCanvasCss(w[y]+n.GetX(),H+n.GetY());w[y]=K;w[E]=C}n=f.pointsArr();for(let y=0,B=n.length;y<B;y+=2){r=y+1;w=n[r];const[E,H]=t.LayerToCanvasCss(n[y]+q.GetX(),w+q.GetY());n[y]=E;n[r]=H}c.setBboxChanged();f.setBboxChanged();this._polyCheckCount++;return c.intersectsPoly(f,0,0)}TestTilemapOverlapDifferentLayers(n,q){var t=n.GetLayer(),r=q.GetLayer();m||(m=e.New(e.CollisionPoly));u||(u=e.New(e.Rect));x||(x=e.New(e.Quad));var w=q.GetX(),y=q.GetY();const[B,E]=r.LayerToCanvasCss(w,y),[H,K]=t.CanvasCssToLayer(B,E);t=H-w;y=K-y;u.copy(q.GetBoundingBox());u.offset(t,y);if(!n.GetBoundingBox().intersectsRect(u))return!1;x.copy(q.GetBoundingQuad());x.offset(t,y);this._polyCheckCount++;if(!n.GetBoundingQuad().intersectsQuad(x))return!1;m.copy(q.GetTransformedCollisionPoly());r=m.pointsArr();for(let C=0,A=r.length;C<A;C+=2)w=C+1,r[C]+=t,r[w]+=y;m.setBboxChanged();return this.TestTilemapOverlap(n,q,H,K,m,u,x)}TestTilemapOverlap(n,q,t,r,w,y,B){y=void 0!==y?y:q.GetBoundingBox();const E=n.GetX(),H=n.GetY();var K=n.GetInstance().GetSdkInstance();t=void 0!==t?t:q.GetX();r=void 0!==r?r:q.GetY();n=q.HasOwnCollisionPoly();B=void 0!==B?B:q.GetBoundingQuad();K.GetCollisionRectCandidates(y,b);for(let F=0,J=b.length;F<J;++F){var C=b[F];K=C.GetRect();this._collisionCheckCount++;if(y.intersectsRectOffset(K,E,H)&&(h.setFromRect(K),h.offset(E,H),h.intersectsQuad(B)))if(n){var A=void 0!==w?w:q.GetTransformedCollisionPoly();if(C=C.GetPoly()){if(this._polyCheckCount++,C.intersectsPoly(A,t-(E+K.getLeft()),r-(H+K.getTop())))return e.clearArray(b),!0}else if(c.setFromQuad(h,0,0),c.intersectsPoly(A,t,r))return e.clearArray(b),!0}else if(A=C.GetPoly()){if(c.setFromQuad(B,0,0),A.intersectsPoly(c,-(E+K.getLeft()),-(H+K.getTop())))return e.clearArray(b),!0}else return e.clearArray(b),!0}e.clearArray(b);return!1}TestAndSelectCanvasPointOverlap(n,q,t,r){const w=n.GetCurrentSol();var y=this._runtime.GetCurrentEvent();if(!y)throw Error("cannot call outside event");y=y.IsOrBlock();if(w.IsSelectAll()){r||(w._SetSelectAll(!1),e.clearArray(w._GetOwnInstances()));for(var B of n.GetInstances()){var E=B.GetWorldInfo(),H=E.GetLayer();const[K,C]=H.CanvasCssToLayer(q,t,E.GetTotalZElevation());if(E.ContainsPoint(K,C)){if(r)return!1;w._PushInstance(B)}else y&&w._PushElseInstance(B)}}else{B=y?w._GetOwnElseInstances():w._GetOwnInstances();E=0;for(let K=0,C=B.length;K<C;++K){H=B[K];const A=H.GetWorldInfo(),F=A.GetLayer(),[J,L]=F.CanvasCssToLayer(q,t,A.GetTotalZElevation());if(A.ContainsPoint(J,L)){if(r)return!1;y?w._PushInstance(H):B[E++]=H}else y&&(B[E++]=H)}r||(B.length=E)}n.ApplySolToContainer();return r?!0:w.HasAnyInstances()}GetCollisionCandidates(n,q,t,r){n=n?1!==n.GetParallaxX()||1!==n.GetParallaxY():!1;if(q.IsFamily())for(const w of q.GetFamilyMembers())n||w.IsAnyInstanceParallaxed()?e.appendArray(r,w.GetInstances()):(w._UpdateAllCollisionCells(),w._GetCollisionCellGrid().QueryRange(t,r));else n||q.IsAnyInstanceParallaxed()?e.appendArray(r,q.GetInstances()):(q._UpdateAllCollisionCells(),q._GetCollisionCellGrid().QueryRange(t,r))}GetObjectClassesCollisionCandidates(n,q,t,r){for(const w of q)this.GetCollisionCandidates(n,w,t,r)}GetSolidCollisionCandidates(n,q,t){const r=this._runtime.GetSolidBehavior();r&&this.GetObjectClassesCollisionCandidates(n,r.GetObjectClasses(),q,t)}GetJumpthruCollisionCandidates(n,q,t){const r=this._runtime.GetJumpthruBehavior();r&&this.GetObjectClassesCollisionCandidates(n,r.GetObjectClasses(),q,t)}IsSolidCollisionAllowed(n,q){return n._IsSolidEnabled()&&(!q||q.GetWorldInfo().IsSolidCollisionAllowed(n.GetSavedDataMap().get("solidTags")))}TestOverlapSolid(n){const q=n.GetWorldInfo();this.GetSolidCollisionCandidates(q.GetLayer(),q.GetBoundingBox(),a);for(const t of a)if(this.IsSolidCollisionAllowed(t,n)&&this.TestOverlap(n,t))return e.clearArray(a),t;e.clearArray(a);return null}TestRectOverlapSolid(n,q){this.GetSolidCollisionCandidates(null,n,a);for(const t of a)if(this.IsSolidCollisionAllowed(t,q)&&this.TestRectOverlap(n,t))return e.clearArray(a),t;e.clearArray(a);return null}TestOverlapJumpthru(n,q){let t=null;q&&(t=d,e.clearArray(t));const r=n.GetWorldInfo();this.GetJumpthruCollisionCandidates(r.GetLayer(),r.GetBoundingBox(),a);for(const w of a)if(w._IsJumpthruEnabled()&&this.TestOverlap(n,w))if(q)t.push(w);else return e.clearArray(a),w;e.clearArray(a);return t}PushOut(n,q,t,r,w){r=r||50;const y=n.GetWorldInfo(),B=y.GetX(),E=y.GetY();for(let H=0;H<r;++H)if(y.SetXY(B+q*H,E+t*H),y.SetBboxChanged(),!this.TestOverlap(n,w))return!0;y.SetXY(B,E);y.SetBboxChanged();return!1}PushOutSolid(n,q,t,r,w,y){r=r||50;const B=n.GetWorldInfo(),E=B.GetX(),H=B.GetY();let K=null,C=null;for(let A=0;A<r;++A)if(B.SetXY(E+q*A,H+t*A),B.SetBboxChanged(),!this.TestOverlap(n,K))if(K=this.TestOverlapSolid(n))C=K;else if(w&&(K=y?this.TestOverlap(n,y)?y:null:this.TestOverlapJumpthru(n))&&(C=K),!K)return C&&this.PushInFractional(n,q,t,C,16,!0),!0;B.SetXY(E,H);B.SetBboxChanged();return!1}PushOutSolidAxis(n,q,t,r){r=r||50;const w=n.GetWorldInfo(),y=w.GetX(),B=w.GetY();let E=null,H=null;for(let K=0;K<r;++K)for(let C=0;2>C;++C){const A=2*C-1;w.SetXY(y+q*K*A,B+t*K*A);w.SetBboxChanged();if(!this.TestOverlap(n,E))if(E=this.TestOverlapSolid(n))H=E;else return H&&this.PushInFractional(n,q*A,t*A,H,16,!0),!0}w.SetXY(y,B);w.SetBboxChanged();return!1}PushInFractional(n,q,t,r,w,y){let B=2,E=!1;var H=!1;const K=n.GetWorldInfo();let C=K.GetX(),A=K.GetY();for(;B<=w;)H=1/B,B*=2,K.OffsetXY(q*H*(E?1:-1),t*H*(E?1:-1)),K.SetBboxChanged(),this.TestOverlap(n,r)||y&&this.TestOverlapSolid(n)?H=E=!0:(H=E=!1,C=K.GetX(),A=K.GetY());H&&(K.SetXY(C,A),K.SetBboxChanged())}PushOutSolidNearest(n,q=100){let t=0;const r=n.GetWorldInfo(),w=r.GetX(),y=r.GetY();let B=0,E=this.TestOverlapSolid(n);if(!E)return!0;for(;t<=q;){let H=0,K=0;switch(B){case 0:H=0;K=-1;t++;break;case 1:H=1;K=-1;break;case 2:H=1;K=0;break;case 3:K=H=1;break;case 4:H=0;K=1;break;case 5:H=-1;K=1;break;case 6:H=-1;K=0;break;case 7:K=H=-1}B=(B+1)%8;r.SetXY(Math.floor(w+H*t),Math.floor(y+K*t));r.SetBboxChanged();if(!this.TestOverlap(n,E)&&(E=this.TestOverlapSolid(n),!E))return!0}r.SetXY(w,y);r.SetBboxChanged();return!1}CalculateBounceAngle(n,q,t,r){const w=n.GetWorldInfo(),y=w.GetX(),B=w.GetY(),E=Math.max(10,e.distanceTo(q,t,y,B));var H=e.angleTo(q,t,y,B),K=r||this.TestOverlapSolid(n);if(!K)return e.clampAngle(H+Math.PI);let C=K;var A=0,F=0;const J=e.toRadians(5);let L;for(L=1;36>L;++L){const R=H-L*J;w.SetXY(q+Math.cos(R)*E,t+Math.sin(R)*E);w.SetBboxChanged();if(!this.TestOverlap(n,C)&&(C=r?null:this.TestOverlapSolid(n),!C)){A=R;break}}36===L&&(A=e.clampAngle(H+Math.PI));C=K;for(L=1;36>L;++L)if(K=H+L*J,w.SetXY(q+Math.cos(K)*E,t+Math.sin(K)*E),w.SetBboxChanged(),!this.TestOverlap(n,C)&&(C=r?null:this.TestOverlapSolid(n),!C)){F=K;break}36===L&&(F=e.clampAngle(H+Math.PI));w.SetXY(y,B);w.SetBboxChanged();if(F===A)return F;n=e.angleDiff(F,A)/2;n=e.angleClockwise(F,A)?e.clampAngle(A+n+Math.PI):e.clampAngle(F+n);A=Math.cos(H);H=Math.sin(H);F=Math.cos(n);n=Math.sin(n);q=A*F+H*n;return e.angleTo(0,0,A-2*q*F,H-2*q*n)}TestSegmentOverlap(n,q,t,r,w){if(!w)return!1;const y=w.GetWorldInfo();if(!y.IsCollisionEnabled())return!1;this._collisionCheckCount++;g.set(Math.min(n,t),Math.min(q,r),Math.max(n,t),Math.max(q,r));if(!y.GetBoundingBox().intersectsRect(g))return!1;if(w.HasTilemap())return this._TestSegmentOverlapTilemap(n,q,t,r,w,y);this._polyCheckCount++;return y.GetBoundingQuad().intersectsSegment(n,q,t,r)?y.HasOwnCollisionPoly()?y.GetTransformedCollisionPoly().intersectsSegment(y.GetX(),y.GetY(),n,q,t,r):!0:!1}_TestSegmentOverlapTilemap(n,q,t,r,w,y){const B=y.GetX();y=y.GetY();w=w.GetSdkInstance();l.set(n,q,t,r);l.normalize();w.GetCollisionRectCandidates(l,b);for(let H=0,K=b.length;H<K;++H){var E=b[H];w=E.GetRect();this._collisionCheckCount++;if(g.intersectsRectOffset(w,B,y)&&(h.setFromRect(w),h.offset(B,y),h.intersectsSegment(n,q,t,r)))if(E=E.GetPoly()){if(this._polyCheckCount++,E.intersectsSegment(B+w.getLeft(),y+w.getTop(),n,q,t,r))return e.clearArray(b),!0}else return e.clearArray(b),!0}e.clearArray(b);return!1}TestRectOverlap(n,q){if(!q)return!1;const t=q.GetWorldInfo();if(!t.IsCollisionEnabled())return!1;this._collisionCheckCount++;if(!t.GetBoundingBox().intersectsRect(n))return!1;if(q.HasTilemap())return this._TestRectOverlapTilemap(n,q,t);this._polyCheckCount++;h.setFromRect(n);if(!t.GetBoundingQuad().intersectsQuad(h))return!1;if(!t.HasOwnCollisionPoly())return!0;c.setFromRect(n,t.GetX(),t.GetY());n=t.GetTransformedCollisionPoly();return c.intersectsPoly(n,0,0)}_TestRectOverlapTilemap(n,q,t){const r=t.GetX();t=t.GetY();q.GetSdkInstance().GetCollisionRectCandidates(n,b);for(let y=0,B=b.length;y<B;++y){var w=b[y];q=w.GetRect();this._collisionCheckCount++;if(n.intersectsRectOffset(q,r,t))if(w=w.GetPoly()){if(this._polyCheckCount++,c.setFromRect(n,0,0),w.intersectsPoly(c,-(r+q.getLeft()),-(t+q.getTop())))return e.clearArray(b),!0}else return e.clearArray(b),!0}e.clearArray(b);return!1}TestRayIntersectsInstance(n,q){if(n){var t=n.GetWorldInfo();t.IsCollisionEnabled()&&(this._collisionCheckCount++,t.GetBoundingBox().intersectsRect(q.rect)&&(n.HasTilemap()?this._TestRayIntersectsTilemap(n,t,q):(this._polyCheckCount++,t.HasOwnCollisionPoly()?q.TestInstancePoly(n,t.GetX(),t.GetY(),t.GetTransformedCollisionPoly()):q.TestInstanceQuad(n,t.GetBoundingQuad()))))}}_TestRayIntersectsTilemap(n,q,t){const r=q.GetX(),w=q.GetY();n.GetSdkInstance().GetCollisionRectCandidates(t.rect,b);for(let B=0,E=b.length;B<E;B++){var y=b[B];const H=y.GetRect();this._collisionCheckCount++;t.rect.intersectsRectOffset(H,r,w)&&(y=y.GetPoly(),this._polyCheckCount++,y?t.TestInstancePoly(n,r+H.getLeft(),w+H.getTop(),y):t.TestInstanceRect(n,q.GetX(),q.GetY(),H))}e.clearArray(b)}}}
  {"use strict";const e=self.C3;e.SparseGrid=class extends e.DefendedBase{constructor(a,b){super();this._cellWidth=a;this._cellHeight=b;this._cells=e.New(e.PairMap)}Release(){this._cells.Release();this._cells=null}GetCell(a,b,d){let c=this._cells.Get(a,b);return c?c:d?(c=e.New(e.GridCell,this,a,b),this._cells.Set(a,b,c),c):null}XToCell(a){a=Math.floor(a/this._cellWidth);return isFinite(a)?a:0}YToCell(a){a=Math.floor(a/this._cellHeight);return isFinite(a)?a:0}Update(a,b,d){if(b)for(let c=b.getLeft(),f=b.getRight();c<=f;++c)for(let h=b.getTop(),g=b.getBottom();h<=g;++h){if(d&&d.containsPoint(c,h))continue;const l=this.GetCell(c,h,!1);l&&(l.Remove(a),l.IsEmpty()&&this._cells.Delete(c,h))}if(d)for(let c=d.getLeft(),f=d.getRight();c<=f;++c)for(let h=d.getTop(),g=d.getBottom();h<=g;++h)b&&b.containsPoint(c,h)||this.GetCell(c,h,!0).Insert(a)}QueryRange(a,b){let d=this.XToCell(a.getLeft());const c=this.YToCell(a.getTop()),f=this.XToCell(a.getRight());a=this.YToCell(a.getBottom());if(isFinite(f)&&isFinite(a))for(;d<=f;++d)for(let h=c;h<=a;++h){const g=this.GetCell(d,h,!1);g&&g.Dump(b)}}}}{"use strict";const e=self.C3;e.GridCell=class extends e.DefendedBase{constructor(a,b,d){super();this._grid=a;this._x=b;this._y=d;this._instances=e.New(e.ArraySet)}Release(){this._instances.Release();this._grid=this._instances=null}IsEmpty(){return this._instances.IsEmpty()}Insert(a){this._instances.Add(a)}Remove(a){this._instances.Delete(a)}Dump(a){e.appendArray(a,this._instances.GetArray())}}}
  {"use strict";const e=self.C3;e.Ray=class{constructor(){this.dy=this.dx=this.y2=this.x2=this.y1=this.x1=0;this.rect=new e.Rect;this.hitFraction=2;this.hitUid=null;this.distance=this.hitY=this.hitX=this.hitNormalDy=this.hitNormalDx=this.hitNormal=0;this.normalX=1;this.normalY=0;this.reflectionX=1;this.reflectionY=0}DidCollide(){return 1.000001>this.hitFraction}Set(a,b,d,c){this.x1=a;this.y1=b;this.x2=d;this.y2=c;this.dx=d-a;this.dy=c-b;this.rect.set(a,b,d,c);this.rect.normalize();this.hitFraction=2;this.hitUid=null;this.distance=this.hitY=this.hitX=this.hitNormalDy=this.hitNormalDx=this.hitNormal=0;this.normalX=1;this.normalY=0;this.reflectionX=1;this.reflectionY=0;return this}Complete(){if(!1!==this.DidCollide()){var a=this.dx*this.hitFraction,b=this.dy*this.hitFraction,d=Math.sqrt(a*a+b*b);a/=d;b/=d;this.distance=d-1E-6;this.hitX=this.x1+a*this.distance;this.hitY=this.y1+b*this.distance;this.hitNormal=Math.atan2(this.hitNormalDy,this.hitNormalDx)+Math.PI/2;this.normalX=Math.cos(this.hitNormal);this.normalY=Math.sin(this.hitNormal);d=a*this.normalX+b*this.normalY;this.reflectionX=a-2*this.normalX*d;this.reflectionY=b-2*this.normalY*d;0<d&&(this.hitNormal=e.clampAngle(this.hitNormal+Math.PI),this.normalX=-this.normalX,this.normalY=-this.normalY)}}TestInstanceSegment(a,b,d,c,f){const h=e.rayIntersect(this.x1,this.y1,this.x2,this.y2,b,d,c,f);0<=h&&h<this.hitFraction&&(this.hitFraction=h,this.hitUid=a.GetUID(),this.hitNormalDx=b-c,this.hitNormalDy=d-f)}TestInstanceRect(a,b,d,c){const f=b+c.getLeft();b+=c.getRight();const h=d+c.getTop();d+=c.getBottom();this.TestInstanceSegment(a,f,h,b,h);this.TestInstanceSegment(a,b,h,b,d);this.TestInstanceSegment(a,b,d,f,d);this.TestInstanceSegment(a,f,d,f,h)}TestInstanceQuad(a,b){const d=b.getTlx(),c=b.getTly(),f=b.getTrx(),h=b.getTry(),g=b.getBrx(),l=b.getBry(),m=b.getBlx();b=b.getBly();this.TestInstanceSegment(a,d,c,f,h);this.TestInstanceSegment(a,f,h,g,l);this.TestInstanceSegment(a,g,l,m,b);this.TestInstanceSegment(a,m,b,d,c)}TestInstancePoly(a,b,d,c){c=c.pointsArr();for(let f=0,h=c.length;f<h;f+=2){const g=(f+2)%h;this.TestInstanceSegment(a,c[f]+b,c[f+1]+d,c[g]+b,c[g+1]+d)}}}}
  {"use strict";const e=self.C3,a=new Set("off crop scale-inner scale-outer letterbox-scale letterbox-integer-scale".split(" ")),b=new Set(["high","low"]),d=self.glMatrix.mat4,c=d.create(),f=e.New(e.Quad),h=e.New(e.Rect);e.CanvasManager=class extends e.DefendedBase{constructor(g){super();this._runtime=g;this._canvas=null;this._isWebGPUEnabled=!1;this._webgpuRenderer=this._webglRenderer=null;this._gpuPreference="high-performance";this._canvasCssOffsetY=this._canvasCssOffsetX=this._canvasDeviceHeight=this._canvasDeviceWidth=this._canvasCssHeight=this._canvasCssWidth=this._windowInnerHeight=this._windowInnerWidth=0;this._enableMipmaps=!0;this._drawHeight=this._drawWidth=this._textureAnisotropy=0;this._documentFullscreenMode=this._fullscreenMode="letterbox-scale";this._deviceTransformOffY=this._deviceTransformOffX=0;this._defaultProjectionMatrix=d.create();this._fullscreenScalingQuality=this._wantFullscreenScalingQuality="high";this._isDocumentFullscreen=!1;this._availableAdditionalRenderTargets=[];this._usedAdditionalRenderTargets=new Set;this._shaderData=self.C3_Shaders;this._gpuTimeEndFrame=this._gpuTimeStartFrame=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=e.New(e.Rect);this._snapshotUrl="";this._snapshotResolve=this._snapshotPromise=null;this._loaderStartTime=this._isPastingToDrawingCanvas=0;this._rafId=-1;this._loadingProgress=0;this._loadingprogress_handler=l=>this._loadingProgress=l.progress;this._percentText=null;this._splashTextures={logo:null,powered:null,website:null};this._splashFadeOutStartTime=this._splashFadeInFinishTime=this._splashFrameNumber=0;this._splashState="fade-in";this._splashDoneResolve=null;this._splashDonePromise=new Promise(l=>this._splashDoneResolve=l)}_SetGPUPowerPreference(g){this._gpuPreference=g}_SetWebGPUEnabled(g){this._isWebGPUEnabled=!!g}async CreateCanvas(g){this._canvas=g.canvas;this._runtime.AddDOMComponentMessageHandler("runtime","window-resize",u=>this._OnWindowResize(u));this._runtime.AddDOMComponentMessageHandler("runtime","fullscreenchange",u=>this._OnFullscreenChange(u));this._runtime.AddDOMComponentMessageHandler("runtime","fullscreenerror",u=>this._OnFullscreenError(u));this._canvas.addEventListener("webglcontextlost",u=>this._OnWebGLContextLost(u));this._canvas.addEventListener("webglcontextrestored",u=>this._OnWebGLContextRestored(u));this._isDocumentFullscreen=!!g.isFullscreen;var l=navigator.gpu&&this._isWebGPUEnabled;let m=!1;if(l)try{await this._InitWebGPUContext(!0)}catch(u){this._webgpuRenderer=null}if(!this.GetRenderer())try{await this._InitWebGLContext(!0)}catch(u){this._webglRenderer=null}this.GetRenderer()||(m=!0);if(!this.GetRenderer()&&l)try{await this._InitWebGPUContext(!1)}catch(u){this._webgpuRenderer=null}if(!this.GetRenderer())try{await this._InitWebGLContext(!1)}catch(u){this._webglRenderer=null}l=this.GetRenderer();if(!l)throw Error("failed to acquire a renderer - check WebGL or WebGPU is supported");l.SetHasMajorPerformanceCaveat(m);this.SetSize(g.windowInnerWidth,g.windowInnerHeight,!0);this._webgpuRenderer?await this._InitWebGPU():this._webglRenderer&&await this._InitWebGL();l.SetMipmapsEnabled(this._enableMipmaps);l.SupportsGPUProfiling()&&(this._gpuLastUtilisation=0);g=!1;for(const u of this._runtime._GetAllEffectLists()){for(const x of u.GetAllEffectTypes())x._InitRenderer(l),x.GetShaderProgram().UsesDest()&&(g=!0);u.UpdateActiveEffects()}this._runtime._SetUsesAnyBackgroundBlending(g)}async _InitWebGPUContext(g){g={powerPreference:this._gpuPreference,depth:this._runtime.Uses3DFeatures(),failIfMajorPerformanceCaveat:g};this._webgpuRenderer=e.New(e.Gfx.WebGPURenderer);await this._webgpuRenderer.Create(this._canvas,g)}async _InitWebGLContext(g){g={powerPreference:this._gpuPreference,enableGpuProfiling:!0,depth:this._runtime.Uses3DFeatures(),failIfMajorPerformanceCaveat:g};"Android"===e.Platform.OS&&"Chromium"===e.Platform.BrowserEngine&&75>e.Platform.BrowserVersionNumber&&(console.warn("[Construct 3] Disabling WebGL 2 because this device appears to be affected by crbug.com/934823. Install software updates to avoid this."),g.maxWebGLVersion=1);"standard"===this._runtime.GetCompositingMode()?g.alpha=!0:(g.alpha=!1,g.lowLatency=!0);this._webglRenderer=e.New(e.Gfx.WebGLRenderer,this._canvas,g);await this._webglRenderer.InitState()}async _InitWebGPU(){if(this._shaderData){const g=[];for(const[l,m]of Object.entries(this._shaderData)){const u=e.Gfx.WebGPUShaderProgram.GetDefaultVertexShaderSource();g.push(this._webgpuRenderer.CreateShaderProgram(l,m.wgsl,u))}await Promise.all(g)}}async _InitWebGL(){if(this._shaderData){const g=[];for(const[l,m]of Object.entries(this._shaderData)){m.src=m.glsl;const u=e.Gfx.WebGLShaderProgram.GetDefaultVertexShaderSource();g.push(this._webglRenderer.CreateShaderProgram(m,u,l))}await Promise.all(g);this._webglRenderer.ResetLastProgram();this._webglRenderer.SetTextureFillMode()}this._webglRenderer.SupportsGPUProfiling()&&(this._gpuFrameTimingsBuffer=e.New(e.Gfx.WebGLQueryResultBuffer,this._webglRenderer))}Release(){this._canvas=this._webglRenderer=this._runtime=null}_OnWindowResize(g){const l=this._runtime,m=g.devicePixelRatio;l.IsInWorker()&&(self.devicePixelRatio=m);l._SetDevicePixelRatio(m);this._isDocumentFullscreen=!!g.isFullscreen;this.SetSize(g.innerWidth,g.innerHeight);l.UpdateRender();l.IsDebug()&&(l.HitBreakpoint()||self.C3Debugger.IsDebuggerPaused())&&l.Render()}_OnFullscreenChange(g){this._isDocumentFullscreen=!!g.isFullscreen;this.SetSize(g.innerWidth,g.innerHeight,!0);this._runtime.UpdateRender()}_OnFullscreenError(g){this._isDocumentFullscreen=!!g.isFullscreen;this.SetSize(g.innerWidth,g.innerHeight,!0);this._runtime.UpdateRender()}SetSize(g,l,m=!1){g=Math.floor(g);l=Math.floor(l);if(0>=g||0>=l)throw Error("invalid size");if(this._windowInnerWidth!==g||this._windowInnerHeight!==l||m){this._windowInnerWidth=g;this._windowInnerHeight=l;m=this.GetCurrentFullscreenMode();"letterbox-scale"===m?this._CalculateLetterboxScale(g,l):"letterbox-integer-scale"===m?this._CalculateLetterboxIntegerScale(g,l):"off"===m?this._CalculateFixedSizeCanvas(g,l):this._CalculateFullsizeCanvas(g,l);this._UpdateFullscreenScalingQuality(m);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});g=this.GetRenderer();g.SetSize(this._canvasDeviceWidth,this._canvasDeviceHeight,!0);for(var u of this._availableAdditionalRenderTargets)g.DeleteRenderTarget(u);e.clearArray(this._availableAdditionalRenderTargets);g.CalculatePerspectiveMatrix(this._defaultProjectionMatrix,this.GetDrawWidth()/this.GetDrawHeight());u=this._runtime.GetLayoutManager();u.SetAllLayerProjectionChanged();u.SetAllLayerMVChanged()}}GetDefaultProjectionMatrix(){return this._defaultProjectionMatrix}_CalculateLetterboxScale(g,l){const m=this._runtime.GetDevicePixelRatio(),u=this._runtime.GetOriginalViewportWidth(),x=this._runtime.GetOriginalViewportHeight(),n=u/x;g/l>n?(this._canvasCssWidth=Math.round(l*n),this._canvasCssHeight=l,this._canvasCssOffsetX=Math.floor((g-this._canvasCssWidth)/2),this._canvasCssOffsetY=0):(this._canvasCssWidth=g,this._canvasCssHeight=Math.round(g/n),this._canvasCssOffsetX=0,this._canvasCssOffsetY=Math.floor((l-this._canvasCssHeight)/2));this._canvasDeviceWidth=Math.round(this._canvasCssWidth*m);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*m);this._runtime.SetViewportSize(u,x)}_CalculateLetterboxIntegerScale(g,l){const m=this._runtime.GetDevicePixelRatio();1!==m&&(g+=1,l+=1);const u=this._runtime.GetOriginalViewportWidth(),x=this._runtime.GetOriginalViewportHeight();var n=u/x;n=g/l>n?l*n*m/u:g/n*m/x;1<n?n=Math.floor(n):1>n&&(n=1/Math.ceil(1/n));this._canvasDeviceWidth=Math.round(u*n);this._canvasDeviceHeight=Math.round(x*n);this._canvasCssWidth=this._canvasDeviceWidth/m;this._canvasCssHeight=this._canvasDeviceHeight/m;this._canvasCssOffsetX=Math.max(Math.floor((g-this._canvasCssWidth)/2),0);this._canvasCssOffsetY=Math.max(Math.floor((l-this._canvasCssHeight)/2),0);this._runtime.SetViewportSize(u,x)}_CalculateFullsizeCanvas(g,l){const m=this._runtime.GetDevicePixelRatio();this._canvasCssWidth=g;this._canvasCssHeight=l;this._canvasDeviceWidth=Math.round(this._canvasCssWidth*m);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*m);this._canvasCssOffsetY=this._canvasCssOffsetX=0;g=this.GetDisplayScale();this._runtime.SetViewportSize(this._canvasCssWidth/g,this._canvasCssHeight/g)}_CalculateFixedSizeCanvas(g,l){const m=this._runtime.GetDevicePixelRatio();this._canvasCssWidth=this._runtime.GetViewportWidth();this._canvasCssHeight=this._runtime.GetViewportHeight();this._canvasDeviceWidth=Math.round(this._canvasCssWidth*m);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*m);this.IsDocumentFullscreen()?(this._canvasCssOffsetX=Math.floor((g-this._canvasCssWidth)/2),this._canvasCssOffsetY=Math.floor((l-this._canvasCssHeight)/2)):this._canvasCssOffsetY=this._canvasCssOffsetX=0;this._runtime.SetViewportSize(this._runtime.GetViewportWidth(),this._runtime.GetViewportHeight())}_UpdateFullscreenScalingQuality(g){if("high"===this._wantFullscreenScalingQuality)this._drawWidth=this._canvasDeviceWidth,this._drawHeight=this._canvasDeviceHeight,this._fullscreenScalingQuality="high";else{let m;if("off"===this.GetCurrentFullscreenMode()){var l=this._runtime.GetViewportWidth();m=this._runtime.GetViewportHeight()}else l=this._runtime.GetOriginalViewportWidth(),m=this._runtime.GetOriginalViewportHeight();this._canvasDeviceWidth<l&&this._canvasDeviceHeight<m?(this._drawWidth=this._canvasDeviceWidth,this._drawHeight=this._canvasDeviceHeight,this._fullscreenScalingQuality="high"):(this._drawWidth=l,this._drawHeight=m,this._fullscreenScalingQuality="low","scale-inner"===g?(g=l/m,l=this._windowInnerWidth/this._windowInnerHeight,l<g?this._drawWidth=this._drawHeight*l:l>g&&(this._drawHeight=this._drawWidth/l)):"scale-outer"===g&&(g=l/m,l=this._windowInnerWidth/this._windowInnerHeight,l>g?this._drawWidth=this._drawHeight*l:l<g&&(this._drawHeight=this._drawWidth/l)))}}IsDocumentFullscreen(){return this._isDocumentFullscreen}SetFullscreenMode(g){if(!a.has(g))throw Error("invalid fullscreen mode");this._fullscreenMode=g;g=this._runtime.GetLayoutManager();g.SetAllLayerProjectionChanged();g.SetAllLayerMVChanged()}GetFullscreenMode(){return this._fullscreenMode}SetDocumentFullscreenMode(g){if(!a.has(g))throw Error("invalid fullscreen mode");this._documentFullscreenMode=g;g=this._runtime.GetLayoutManager();g.SetAllLayerProjectionChanged();g.SetAllLayerMVChanged()}GetDocumentFullscreenMode(){return this._documentFullscreenMode}GetCurrentFullscreenMode(){return this.IsDocumentFullscreen()?this.GetDocumentFullscreenMode():this.GetFullscreenMode()}SetFullscreenScalingQuality(g){if(!b.has(g))throw Error("invalid fullscreen scaling quality");this._wantFullscreenScalingQuality=g;this._runtime.GetLayoutManager().SetAllLayerProjectionChanged()}GetSetFullscreenScalingQuality(){return this._wantFullscreenScalingQuality}GetCurrentFullscreenScalingQuality(){return this._fullscreenScalingQuality}static _FullscreenModeNumberToString(g){switch(g){case 0:return"off";case 1:return"crop";case 2:return"scale-inner";case 3:return"scale-outer";case 4:return"letterbox-scale";case 5:return"letterbox-integer-scale";default:throw Error("invalid fullscreen mode");}}GetLastWidth(){return this._windowInnerWidth}GetLastHeight(){return this._windowInnerHeight}GetDrawWidth(){return this._drawWidth}GetDrawHeight(){return this._drawHeight}SetMipmapsEnabled(g){this._enableMipmaps=!!g}_SetTextureAnisotropy(g){this._textureAnisotropy=g}GetTextureAnisotropy(){return this._textureAnisotropy}IsRendererContextLost(){return this.GetRenderer().IsContextLost()}_OnWebGLContextLost(g){console.log("[Construct 3] WebGL context lost");g.preventDefault();this._availableAdditionalRenderTargets=[];this._usedAdditionalRenderTargets.clear();this._webglRenderer.OnContextLost();this._runtime._OnWebGLContextLost()}async _OnWebGLContextRestored(g){await this._webglRenderer.OnContextRestored();await this._LoadWebGLShaderPrograms();for(const l of this._runtime._GetAllEffectLists())for(const m of l.GetAllEffectTypes())m._InitRenderer(this._webglRenderer);await this._runtime._OnWebGLContextRestored();console.log("[Construct 3] WebGL context restored")}GetWebGLRenderer(){return this._webglRenderer}GetWebGPURenderer(){return this._webgpuRenderer}GetRenderer(){return this._webgpuRenderer||this._webglRenderer}GetRenderScale(){return"low"===this._fullscreenScalingQuality?1/this._runtime.GetDevicePixelRatio():this.GetDisplayScale()}GetDisplayScale(){const g=this.GetCurrentFullscreenMode();if("off"===g||"crop"===g)return 1;const l=this._runtime.GetOriginalViewportWidth(),m=this._runtime.GetOriginalViewportHeight(),u=l/m,x=this._canvasDeviceWidth/this._canvasDeviceHeight;return"scale-inner"!==g&&x>u||"scale-inner"===g&&x<u?this._canvasCssHeight/m:this._canvasCssWidth/l}SetDeviceTransformOffset(g,l){this._deviceTransformOffX=g;this._deviceTransformOffY=l}SetDeviceTransform(g,l,m,u=!0){l=l||this._drawWidth;m=m||this._drawHeight;const x=l/2+this._deviceTransformOffX,n=m/2+this._deviceTransformOffY;if(u){u=this.GetDefaultProjectionMatrix();if(l!==this._drawWidth||m!==this._drawHeight)g.CalculatePerspectiveMatrix(c,l/m),u=c;g.SetProjectionMatrix(u)}l=g.CalculateLookAtModelView2(x,n,g.GetDefaultCameraZ()*this._runtime.GetDevicePixelRatio(),x,n,0,m||this._drawHeight);g.SetModelViewMatrix(l)}SetCssTransform(g,l=!0){const m=this._canvasCssWidth/2,u=this._canvasCssHeight/2;l&&g.SetProjectionMatrix(this.GetDefaultProjectionMatrix());l=g.CalculateLookAtModelView2(m,u,g.GetDefaultCameraZ(),m,u,0);g.SetModelViewMatrix(l)}GetDeviceWidth(){return this._canvasDeviceWidth}GetDeviceHeight(){return this._canvasDeviceHeight}GetCssWidth(){return this._canvasCssWidth}GetCssHeight(){return this._canvasCssHeight}GetCanvasClientX(){return this._canvasCssOffsetX}GetCanvasClientY(){return this._canvasCssOffsetY}GetAdditionalRenderTarget(g){g.depth=this._runtime.Uses3DFeatures();const l=this._availableAdditionalRenderTargets,m=l.findIndex(x=>x.IsCompatibleWithOptions(g));let u;-1!==m?(u=l[m],l.splice(m,1)):u=this.GetRenderer().CreateRenderTarget(g);this._usedAdditionalRenderTargets.add(u);return u}ReleaseAdditionalRenderTarget(g){if(!this._usedAdditionalRenderTargets.has(g))throw Error("render target not in use");this._usedAdditionalRenderTargets.delete(g);this._availableAdditionalRenderTargets.push(g)}*activeLayersGpuProfiles(){for(const g of this._runtime.GetLayoutManager().runningLayouts())for(const l of g.GetLayers()){const m=this._layersGpuProfile.get(l);m&&(yield m)}}GetLayerTimingsBuffer(g){if(!this.GetRenderer().SupportsGPUProfiling())return null;let l=this._layersGpuProfile.get(g);l||(l={name:g.GetName(),timingsBuffer:e.New(e.Gfx.WebGLQueryResultBuffer,this._webglRenderer),curUtilisation:0,lastUtilisation:0},this._layersGpuProfile.set(g,l));return l.timingsBuffer}_Update1sFrameRange(){const g=this.GetRenderer();if(g.SupportsGPUProfiling()&&0===this._gpuTimeEndFrame){this._gpuTimeEndFrame=g.GetFrameNumber();this._gpuCurUtilisation=NaN;for(const l of this.activeLayersGpuProfiles())l.curUtilisation=NaN}}_UpdateTick(){this._webglRenderer&&this._webglRenderer.SupportsGPUProfiling()&&this._UpdateTick_WebGL();this._webgpuRenderer&&this._webgpuRenderer.SupportsGPUProfiling()&&this._UpdateTick_WebGPU()}_UpdateTick_WebGL(){if(isNaN(this._gpuCurUtilisation)&&(this._gpuCurUtilisation=this._gpuFrameTimingsBuffer.GetFrameRangeResultSum(this._gpuTimeStartFrame,this._gpuTimeEndFrame),!isNaN(this._gpuCurUtilisation))){if(this._runtime.IsDebug())for(const g of this.activeLayersGpuProfiles())if(g.curUtilisation=g.timingsBuffer.GetFrameRangeResultSum(this._gpuTimeStartFrame,this._gpuTimeEndFrame),isNaN(g.curUtilisation))return;this._gpuFrameTimingsBuffer.DeleteAllBeforeFrameNumber(this._gpuTimeEndFrame);this._gpuLastUtilisation=Math.min(this._gpuCurUtilisation,1);if(this._runtime.IsDebug()){for(const g of this.activeLayersGpuProfiles())g.timingsBuffer.DeleteAllBeforeFrameNumber(this._gpuTimeEndFrame),g.lastUtilisation=Math.min(g.curUtilisation,1);self.C3Debugger.UpdateGPUProfile(this._gpuLastUtilisation,[...this.activeLayersGpuProfiles()])}this._gpuTimeStartFrame=this._gpuTimeEndFrame;this._gpuTimeEndFrame=0}}GetGPUFrameTimingsBuffer(){return this._gpuFrameTimingsBuffer}_UpdateTick_WebGPU(){if(0!==this._gpuTimeEndFrame){for(var g=this._gpuTimeStartFrame;g<this._gpuTimeEndFrame;++g){var l=this._webgpuFrameTimings.get(g);if(l&&!l.HasResult())return}l=this._runtime.GetMainRunningLayout();g=e.MakeFilledArray(l.GetLayerCount()+1,0);for(var m=this._gpuTimeStartFrame;m<this._gpuTimeEndFrame;++m){var u=this._webgpuFrameTimings.get(m);if(u){u=u.GetResult();for(let x=0,n=Math.min(g.length,u.length/2);x<n;++x){const q=u[2*x],t=u[2*x+1];g[x]=0===Number(q)||0===Number(t)?NaN:g[x]+Number(t-q)/1E9}}}this._gpuLastUtilisation=e.clamp(g[0],0,1);if(this._runtime.IsDebug()){m=[];l=l.GetLayers();for(let x=0,n=Math.min(l.length,g.length-1);x<n;++x)m.push({name:l[x].GetName(),lastUtilisation:e.clamp(g[x+1],0,1)});self.C3Debugger.UpdateGPUProfile(this._gpuLastUtilisation,m)}for(g=this._gpuTimeStartFrame;g<this._gpuTimeEndFrame;++g)this._webgpuFrameTimings.delete(g);this._gpuTimeStartFrame=this._gpuTimeEndFrame;this._gpuTimeEndFrame=0}}_AddWebGPUFrameTiming(g){this._webgpuFrameTimings.set(this._webgpuRenderer.GetFrameNumber(),g)}GetGPUUtilisation(){return this._gpuLastUtilisation}SnapshotCanvas(g,l,m,u,x,n){this._snapshotFormat=g;this._snapshotQuality=l;this._snapshotArea.setWH(m,u,x,n);return this._snapshotPromise?this._snapshotPromise:this._snapshotPromise=new Promise(q=>{this._snapshotResolve=q})}_MaybeTakeSnapshot(){if(this._snapshotFormat){var g=this._canvas,l=this._snapshotArea,m=e.clamp(Math.floor(l.getLeft()),0,g.width),u=e.clamp(Math.floor(l.getTop()),0,g.height),x=l.width();x=0===x?g.width-m:e.clamp(Math.floor(x),0,g.width-m);l=l.height();l=0===l?g.height-u:e.clamp(Math.floor(l),0,g.height-u);(0!==m||0!==u||x!==g.width||l!==g.height)&&0<x&&0<l&&(g=e.CreateCanvas(x,l),g.getContext("2d").drawImage(this._canvas,m,u,x,l,0,0,x,l));e.CanvasToBlob(g,this._snapshotFormat,this._snapshotQuality).then(n=>{this._snapshotUrl=URL.createObjectURL(n);this._snapshotPromise=null;this._snapshotResolve(this._snapshotUrl)});this._snapshotFormat="";this._snapshotQuality=1}}GetCanvasSnapshotUrl(){return this._snapshotUrl}SetIsPastingToDrawingCanvas(g){g?this._isPastingToDrawingCanvas++:this._isPastingToDrawingCanvas--}IsPastingToDrawingCanvas(){return 0<this._isPastingToDrawingCanvas}InitLoadingScreen(g){this._webglRenderer&&(2===g?(this._percentText=e.New(e.Gfx.RendererText,this.GetRenderer()),this._percentText.SetIsAsync(!1),this._percentText.SetFontName("Arial"),this._percentText.SetFontSize(16),this._percentText.SetHorizontalAlignment("center"),this._percentText.SetVerticalAlignment("center"),this._percentText.SetSize(300,200)):0===g?(g=this._runtime.GetLoadingLogoAsset())&&g.LoadStaticTexture(this._webglRenderer).catch(l=>console.warn("[C3 runtime] Failed to create texture for loading logo: ",l)):4===g&&(this._LoadSvgSplashImage("splash-images/splash-logo.svg").then(l=>{"done"===this._splashState?this._webglRenderer.DeleteTexture(l):this._splashTextures.logo=l}).catch(l=>console.warn("Failed to load splash image: ",l)),this._LoadBitmapSplashImage("splash-images/splash-poweredby-512.png").then(l=>{"done"===this._splashState?this._webglRenderer.DeleteTexture(l):this._splashTextures.powered=l}).catch(l=>console.warn("Failed to load splash image: ",l)),this._LoadBitmapSplashImage("splash-images/splash-website-512.png").then(l=>{"done"===this._splashState?this._webglRenderer.DeleteTexture(l):this._splashTextures.website=l}).catch(l=>console.warn("Failed to load splash image: ",l))))}async _LoadSvgSplashImage(g){g=(new URL(g,this._runtime.GetBaseURL())).toString();g=await e.FetchBlob(g);g=await this._runtime.RasterSvgImage(g,2048,2048);return await this._webglRenderer.CreateStaticTextureAsync(g,{mipMapQuality:"high"})}async _LoadBitmapSplashImage(g){g=(new URL(g,this._runtime.GetBaseURL())).toString();g=await e.FetchBlob(g);return await this._webglRenderer.CreateStaticTextureAsync(g,{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());3!==this._runtime.GetLoaderStyle()&&this.HideCordovaSplashScreen()}async EndLoadingScreen(){if(this._webglRenderer){this._loadingProgress=1;var g=this._runtime.GetLoaderStyle();4===g&&await this._splashDonePromise;this._splashDonePromise=this._splashDoneResolve=null;-1!==this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=-1);this._runtime.Dispatcher().removeEventListener("loadingprogress",this._loadingprogress_handler);this._loadingprogress_handler=null;this._percentText&&(this._percentText.Release(),this._percentText=null);this._runtime.ReleaseLoadingLogoAsset();this._webglRenderer.Start();this._splashTextures.logo&&(this._webglRenderer.DeleteTexture(this._splashTextures.logo),this._splashTextures.logo=null);this._splashTextures.powered&&(this._webglRenderer.DeleteTexture(this._splashTextures.powered),this._splashTextures.powered=null);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();3===g&&this.HideCordovaSplashScreen()}}_DrawLoadingScreen(){if(-1!==this._rafId){var g=this._webglRenderer;if(g){g.Start();this._rafId=-1;var l=this._runtime.GetAssetManager().HasHadErrorLoading(),m=this._runtime.GetLoaderStyle();3!==m&&(this.SetCssTransform(g),g.ClearRgba(0,0,0,0),g.ResetColor(),g.SetTextureFillMode(),g.SetTexture(null));if(0===m)this._DrawProgressBarAndLogoLoadingScreen(l);else if(1===m)this._DrawProgressBarLoadingScreen(l,120,0);else if(2===m)this._DrawPercentTextLoadingScreen(l);else if(3===m)e.noop();else if(4===m)this._DrawSplashLoadingScreen(l);else throw Error("invalid loader style");g.Finish();this._rafId=requestAnimationFrame(()=>this._DrawLoadingScreen())}}}_DrawPercentTextLoadingScreen(g){g?this._percentText.SetColorRgb(1,0,0):this._percentText.SetColorRgb(.6,.6,.6);this._percentText.SetText(Math.round(100*this._loadingProgress)+"%");g=this._canvasCssWidth/2;const l=this._canvasCssHeight/2;f.setRect(g-150,l-100,g+150,l+100);this._webglRenderer.SetTexture(this._percentText.GetTexture());this._webglRenderer.Quad3(f,this._percentText.GetTexRect())}_DrawProgressBarLoadingScreen(g,l,m){const u=this._webglRenderer;u.SetColorFillMode();g?u.SetColorRgba(1,0,0,1):u.SetColorRgba(.118,.565,1,1);g=this._canvasCssWidth/2;const x=this._canvasCssHeight/2,n=l/2;h.setWH(g-n,x-4+m,Math.floor(l*this._loadingProgress),8);u.Rect(h);h.setWH(g-n,x-4+m,l,8);h.offset(-.5,-.5);h.inflate(.5,.5);u.SetColorRgba(0,0,0,1);u.LineRect2(h);h.inflate(1,1);u.SetColorRgba(1,1,1,1);u.LineRect2(h)}_DrawProgressBarAndLogoLoadingScreen(g){var l=this._runtime.GetLoadingLogoAsset();if(l)if(l=l.GetTexture()){var m=l.GetWidth(),u=l.GetHeight(),x=this._canvasCssWidth/2,n=this._canvasCssHeight/2,q=m/2;u/=2;f.setRect(x-q,n-u,x+q,n+u);this._webglRenderer.SetTexture(l);this._webglRenderer.Quad(f);this._DrawProgressBarLoadingScreen(g,m,u+16)}else this._DrawProgressBarLoadingScreen(g,120,0);else this._DrawProgressBarLoadingScreen(g,120,0)}_DrawSplashLoadingScreen(g){const l=this._webglRenderer,m=this._splashTextures.logo,u=this._splashTextures.powered,x=this._splashTextures.website,n=Date.now();0===this._splashFrameNumber&&(this._loaderStartTime=n);const q=this._runtime.IsPreview()||this._runtime.IsFBInstantAvailable()&&!this._runtime.IsCordova(),t=q?0:200,r=q?0:3E3;let w=1;"fade-in"===this._splashState?w=Math.min((n-this._loaderStartTime)/300,1):"fade-out"===this._splashState&&(w=Math.max(1-(n-this._splashFadeOutStartTime)/300,0));l.SetColorFillMode();l.SetColorRgba(.231*w,.251*w,.271*w,w);h.set(0,0,this._canvasCssWidth,this._canvasCssHeight);l.Rect(h);const y=Math.ceil(this._canvasCssWidth),B=Math.ceil(this._canvasCssHeight);let E;256<this._canvasCssHeight?(l.SetColorRgba(.302*w,.334*w,.365*w,w),E=Math.max(.005*B,2),h.setWH(0,.8*B-E/2,y,E),l.Rect(h),g?l.SetColorRgba(w,0,0,w):l.SetColorRgba(.161*w,.953*w,.816*w,w),g=y*this._loadingProgress,h.setWH(.5*y-g/2,.8*B-E/2,g,E),l.Rect(h),l.SetColorRgba(w,w,w,w),l.SetTextureFillMode(),u&&(g=1.5*e.clamp(.22*B,105,.6*y),E=g/8,h.setWH(.5*y-g/2,.2*B-E/2,g,E),l.SetTexture(u),l.Rect(h)),m&&(E=g=Math.min(.395*B,.95*y),h.setWH(.5*y-g/2,.485*B-E/2,g,E),l.SetTexture(m),l.Rect(h)),x&&(g=1.5*e.clamp(.22*B,105,.6*y),E=g/8,h.setWH(.5*y-g/2,.868*B-E/2,g,E),l.SetTexture(x),l.Rect(h))):(l.SetColorRgba(.302*w,.334*w,.365*w,w),E=Math.max(.005*B,2),h.setWH(0,.85*B-E/2,y,E),l.Rect(h),g?l.SetColorRgba(w,0,0,w):l.SetColorRgba(.161*w,.953*w,.816*w,w),g=y*this._loadingProgress,h.setWH(.5*y-g/2,.85*B-E/2,g,E),l.Rect(h),l.SetColorRgba(w,w,w,w),l.SetTextureFillMode(),m&&(E=g=.55*B,h.setWH(.5*y-g/2,.45*B-E/2,g,E),l.SetTexture(m),l.Rect(h)));this._splashFrameNumber++;"fade-in"===this._splashState&&300<=n-this._loaderStartTime&&2<=this._splashFrameNumber&&(this._splashState="wait",this._splashFadeInFinishTime=n);"wait"===this._splashState&&n-this._splashFadeInFinishTime>=r&&1<=this._loadingProgress&&(this._splashState="fade-out",this._splashFadeOutStartTime=n);("fade-out"===this._splashState&&n-this._splashFadeOutStartTime>=300+t||q&&1<=this._loadingProgress&&500>n-this._loaderStartTime)&&this._splashDoneResolve()}}}
  {"use strict";const e=self.C3,a=self.C3Debugger,b={messagePort:null,baseUrl:"",headless:!1,hasDom:!0,isInWorker:!1,useAudio:!0,projectData:"",exportType:""};let d=!0;e.Runtime=class extends e.DefendedBase{constructor(c){c=Object.assign({},b,c);super();this._messagePort=c.messagePort;this._baseUrl=c.baseUrl;this._isHeadless=!!c.headless;this._hasDom=!!c.hasDom;this._isInWorker=!!c.isInWorker;d=c.ife;this._useAudio=!!c.useAudio;this._exportType=c.exportType;this._isiOSCordova=!!c.isiOSCordova;this._isiOSWebView=!!c.isiOSWebView;this._isFBInstantAvailable=!!c.isFBInstantAvailable;this._opusWasmScriptUrl=c.opusWasmScriptUrl;this._opusWasmBinaryUrl=c.opusWasmBinaryUrl;this._isDebugging=this._breakpointsEnabled=this._isDebug=!("preview"!==this._exportType||!c.isDebug);this._debuggingDisabled=0;this._additionalLoadPromises=[];this._additionalCreatePromises=[];this._isUsingCreatePromises=!1;this._appId=this._projectUniqueId=this._projectVersion=this._projectName="";this._originalViewportHeight=this._originalViewportWidth=0;this._devicePixelRatio=self.devicePixelRatio;this._loaderStyle=this._viewportHeight=this._viewportWidth=this._parallaxYorigin=this._parallaxXorigin=0;this._usesLoaderLayout=!1;this._isLoading=!0;this._usesAnyBackgroundBlending=!1;this._loadingLogoAsset=null;this._assetManager=e.New(e.AssetManager,this,c);this._layoutManager=e.New(e.LayoutManager,this);this._eventSheetManager=e.New(e.EventSheetManager,this);this._pluginManager=e.New(e.PluginManager,this);this._collisionEngine=e.New(e.CollisionEngine,this);this._timelineManager=e.New(e.TimelineManager,this);this._transitionManager=e.New(e.TransitionManager,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._isFlushingPendingInstances=this._hasPendingInstances=!1;this._nextUid=this._objectCount=0;this._instancesByUid=new Map;this._instancesToReleaseAtEndOfTick=new Set;this._instancesToReleaseAffectedObjectClasses=new Set;this._objectReferenceTable=[];this._jsPropNameTable=[];this._canvasManager=null;this._uses3dFeatures=!1;this._framerateMode="vsync";this._compositingMode="standard";this._sampling="trilinear";this._isPixelRoundingEnabled=!1;this._needRender=!0;this._isPausedOnBlur=this._pauseOnBlur=!1;this._tickCallbacks={normal:f=>{this._ruafId=this._rafId=-1;this.Tick(f)},tickOnly:f=>{this._ruafId=-1;this.Tick(f,!1,"skip-render")},renderOnly:()=>{this._rafId=-1;this.Render()}};this._ruafId=this._rafId=-1;this._execCount=this._tickCountNoSave=this._tickCount=0;this._hasStartedTicking=this._isInTick=this._hasStarted=!1;this._isLayoutFirstTick=!0;this._suspendCount=0;this._scheduleTriggersThrottle=new e.PromiseThrottle(1);this._randomNumberCallback=()=>Math.random();this._dt=this._dt1=this._lastTickTime=this._startTime=0;this._timeScale=1;this._minimumFramerate=30;this._gameTime=e.New(e.KahanSum);this._gameTimeRaw=e.New(e.KahanSum);this._wallTime=e.New(e.KahanSum);this._fpsFrameCount=-1;this._mainThreadTime=this._mainThreadTimeCounter=this._fps=this._fpsLastTime=0;this._isLoadingState=!1;this._loadFromSlotName=this._saveToSlotName="";this._loadFromJson=null;this._lastSaveJson="";this._savegamesStorage=this._projectStorage=null;this._dispatcher=e.New(e.Event.Dispatcher);this._domEventHandlers=new Map;this._pendingResponsePromises=new Map;this._nextDomResponseId=0;this._isReadyToHandleEvents=this._didRequestDeviceMotionEvent=this._didRequestDeviceOrientationEvent=!1;this._waitingToHandleEvents=[];this._eventObjects={pretick:e.New(e.Event,"pretick",!1),tick:e.New(e.Event,"tick",!1),tick2:e.New(e.Event,"tick2",!1),instancedestroy:e.New(e.Event,"instancedestroy",!1),beforelayoutchange:e.New(e.Event,"beforelayoutchange",!1),layoutchange:e.New(e.Event,"layoutchange",!1)};this._eventObjects.instancedestroy.instance=null;this._userScriptDispatcher=e.New(e.Event.Dispatcher);this._userScriptEventObjects=null;this._behInstsToTick=e.New(e.RedBlackSet,e.BehaviorInstance.SortByTickSequence);this._behInstsToPostTick=e.New(e.RedBlackSet,e.BehaviorInstance.SortByTickSequence);this._behInstsToTick2=e.New(e.RedBlackSet,e.BehaviorInstance.SortByTickSequence);this._jobScheduler=e.New(e.JobSchedulerRuntime,this,c.jobScheduler);c.canvas&&(this._canvasManager=e.New(e.CanvasManager,this));this._messagePort.onmessage=f=>this._OnMessageFromDOM(f.data);this.AddDOMComponentMessageHandler("runtime","visibilitychange",f=>this._OnVisibilityChange(f));this.AddDOMComponentMessageHandler("runtime","opus-decode",f=>this._WasmDecodeWebMOpus(f.arrayBuffer));this.AddDOMComponentMessageHandler("runtime","get-remote-preview-status-info",()=>this._GetRemotePreviewStatusInfo());this.AddDOMComponentMessageHandler("runtime","js-invoke-function",f=>this._InvokeFunctionFromJS(f));this.AddDOMComponentMessageHandler("runtime","go-to-last-error-script",self.goToLastErrorScript);this._dispatcher.addEventListener("window-blur",f=>this._OnWindowBlur(f));this._dispatcher.addEventListener("window-focus",()=>this._OnWindowFocus());this._timelineManager.AddRuntimeListeners();this._iRuntime=null;this._interfaceMap=new WeakMap;this._commonScriptInterfaces={keyboard:null,mouse:null,touch:null}}static Create(c){return e.New(e.Runtime,c)}Release(){e.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._canvasManager&&(this._canvasManager.Release(),this._canvasManager=null);this._dispatcher.Release();this._tickEvent=this._dispatcher=null}["_OnMessageFromDOM"](c){const f=c.type;if("event"===f)this._OnEventFromDOM(c);else if("result"===f)this._OnResultFromDOM(c);else throw Error(`unknown message '${f}'`);}_OnEventFromDOM(c){if(this._isReadyToHandleEvents){var f=c.component,h=c.handler,g=c.data,l=c.dispatchOpts,m=!(!l||!l.dispatchRuntimeEvent);l=!(!l||!l.dispatchUserScriptEvent);var u=c.responseId;if("runtime"===f&&(m&&(c=new e.Event(h),c.data=g,this._dispatcher.dispatchEventAndWaitAsyncSequential(c)),l)){c=new e.Event(h,!0);for(const[x,n]of Object.entries(g))c[x]=n;this.DispatchUserScriptEvent(c)}if(c=this._domEventHandlers.get(f))if(c=c.get(h)){m=null;try{m=c(g)}catch(x){console.error(`Exception in '${f}' handler '${h}':`,x);null!==u&&this._PostResultToDOM(u,!1,""+x);return}null!==u&&(m&&m.then?m.then(x=>this._PostResultToDOM(u,!0,x)).catch(x=>{console.error(`Rejection from '${f}' handler '${h}':`,x);this._PostResultToDOM(u,!1,""+x)}):this._PostResultToDOM(u,!0,m))}else m||l||console.warn(`[Runtime] No DOM handler '${h}' for component '${f}'`);else m||l||console.warn(`[Runtime] No DOM event handlers for component '${f}'`)}else this._waitingToHandleEvents.push(c)}_PostResultToDOM(c,f,h){this._messagePort.postMessage({type:"result",responseId:c,isOk:f,result:h})}_OnResultFromDOM(c){const f=c.responseId,h=c.isOk;c=c.result;const g=this._pendingResponsePromises.get(f);h?g.resolve(c):g.reject(c);this._pendingResponsePromises.delete(f)}AddDOMComponentMessageHandler(c,f,h){let g=this._domEventHandlers.get(c);g||(g=new Map,this._domEventHandlers.set(c,g));if(g.has(f))throw Error(`[Runtime] Component '${c}' already has handler '${f}'`);g.set(f,h)}PostComponentMessageToDOM(c,f,h){this._messagePort.postMessage({type:"event",component:c,handler:f,data:h,responseId:null})}PostComponentMessageToDOMAsync(c,f,h){const g=this._nextDomResponseId++,l=new Promise((m,u)=>{this._pendingResponsePromises.set(g,{resolve:m,reject:u})});this._messagePort.postMessage({type:"event",component:c,handler:f,data:h,responseId:g});return l}PostToDebugger(c){if(!this.IsDebug())throw Error("not in debug mode");this.PostComponentMessageToDOM("runtime","post-to-debugger",c)}async Init(c){this.IsDebug()?await a.Init(this):self.C3Debugger&&self.C3Debugger.InitPreview(this);var[f]=await Promise.all([this._assetManager.FetchJson("data.json"),this._MaybeLoadOpusDecoder(),this._jobScheduler.Init()]);this._LoadDataJson(f);await this._InitialiseCanvas(c);this.IsPreview()||console.info("Made with Construct 3, the game and app creator :: https://www.construct.net");this.GetWebGLRenderer()?(f=this.GetWebGLRenderer(),console.info(`[C3 runtime] Hosted in ${this.IsInWorker()?"worker":"DOM"}, rendering with WebGL ${f.GetWebGLVersionNumber()} [${f.GetUnmaskedRenderer()}] (${f.IsDesynchronized()?"desynchronized":"standard"} compositing)`)):this.GetWebGPURenderer()&&console.info(`[C3 runtime] Hosted in ${this.IsInWorker()?"worker":"DOM"}, rendering with experimental WebGPU`);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=!0;for(const h of this._waitingToHandleEvents)this._OnEventFromDOM(h);e.clearArray(this._waitingToHandleEvents);this._canvasManager&&this._canvasManager.StartLoadingScreen();for(const h of c.runOnStartupFunctions)this._additionalLoadPromises.push(this._RunOnStartupFunction(h));await Promise.all([this._assetManager.WaitForAllToLoad(),...this._additionalLoadPromises]);e.clearArray(this._additionalLoadPromises);if(this._assetManager.HasHadErrorLoading())this._canvasManager&&this._canvasManager.HideCordovaSplashScreen();else return this._canvasManager&&await this._canvasManager.EndLoadingScreen(),await this._dispatcher.dispatchEventAndWaitAsync(new e.Event("beforeruntimestart")),await this.Start(),this._messagePort.postMessage({type:"runtime-ready"}),this}async _RunOnStartupFunction(c){try{await c(this._iRuntime)}catch(f){console.error("[C3 runtime] Error in runOnStartup function: ",f)}}_LoadDataJson(c){c=c.project;this._projectName=c[0];this._projectVersion=c[16];this._projectUniqueId=c[31];this._appId=c[38];const f=c[39]||"loading-logo.png";this._isPixelRoundingEnabled=!!c[9];this._originalViewportWidth=this._viewportWidth=c[10];this._originalViewportHeight=this._viewportHeight=c[11];this._parallaxXorigin=this._originalViewportWidth/2;this._parallaxYorigin=this._originalViewportHeight/2;this._compositingMode=c[36];this._framerateMode=c[37];"low-latency"===this._compositingMode&&this.IsAndroidWebView()&&77>=e.Platform.BrowserVersionNumber&&(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=!!c[40];this._sampling=c[14];this._usesLoaderLayout=!!c[18];this._loaderStyle=c[19];this._nextUid=c[21];this._pauseOnBlur=c[22];const h=this._assetManager;h._SetAudioFiles(c[7],c[25]);h._SetMediaSubfolder(c[8]);h._SetFontsSubfolder(c[32]);h._SetIconsSubfolder(c[28]);h._SetWebFonts(c[29]);if(0===this._loaderStyle){let x="";this.IsPreview()?h._HasLocalUrlBlob(f)&&(x=h.GetLocalUrlAsBlobUrl(f)):x=h.GetIconsSubfolder()+f;x&&(this._loadingLogoAsset=h.LoadImage({url:x}))}this._canvasManager&&(this._canvasManager.SetFullscreenMode(e.CanvasManager._FullscreenModeNumberToString(c[12])),this._canvasManager.SetFullscreenScalingQuality(c[23]?"high":"low"),this._canvasManager.SetMipmapsEnabled(0!==c[24]),this._canvasManager._SetGPUPowerPreference(c[34]),this._canvasManager._SetTextureAnisotropy(c[41]),this._canvasManager._SetWebGPUEnabled(c[13]));this._pluginManager.CreateSystemPlugin();this._objectReferenceTable=self.C3_GetObjectRefTable();for(var g of c[2])this._pluginManager.CreatePlugin(g);this._objectReferenceTable=self.C3_GetObjectRefTable();this._LoadJsPropNameTable();for(var l of c[3])g=e.ObjectClass.Create(this,this._allObjectClasses.length,l),this._allObjectClasses.push(g),this._objectClassesByName.set(g.GetName().toLowerCase(),g),this._objectClassesBySid.set(g.GetSID(),g);for(const x of c[4])this._allObjectClasses[x[0]]._LoadFamily(x);for(var m of c[27])l=m.map(x=>this._allObjectClasses[x]),this._allContainers.push(e.New(e.Container,this,l));for(const x of this._allObjectClasses)x._OnAfterCreate();for(const x of c[5])this._layoutManager.Create(x);(m=c[1])&&(m=this._layoutManager.GetLayoutByName(m))&&this._layoutManager.SetFirstLayout(m);for(var u of c[33])this._timelineManager.Create(u);for(const x of c[35])this._transitionManager.Create(x);this._InitScriptInterfaces();for(const x of c[6])this._eventSheetManager.Create(x);this._eventSheetManager._PostInit();this._InitGlobalVariableScriptInterface();e.clearArray(this._objectReferenceTable);this.FlushPendingInstances();u="any";c=c[20];1===c?u="portrait":2===c&&(u="landscape");this.PostComponentMessageToDOM("runtime","set-target-orientation",{targetOrientation:u})}GetLoaderStyle(){return this._loaderStyle}IsFBInstantAvailable(){return this._isFBInstantAvailable}IsLoading(){return this._isLoading}AddLoadPromise(c){this._additionalLoadPromises.push(c)}SetUsingCreatePromises(c){this._isUsingCreatePromises=!!c}AddCreatePromise(c){this._isUsingCreatePromises&&this._additionalCreatePromises.push(c)}GetCreatePromises(){return this._additionalCreatePromises}_GetNextFamilyIndex(){return this._familyCount++}GetFamilyCount(){return this._familyCount}_AddEffectList(c){this._allEffectLists.push(c)}_GetAllEffectLists(){return this._allEffectLists}async _InitialiseCanvas(c){this._canvasManager&&(await this._canvasManager.CreateCanvas(c),this._canvasManager.InitLoadingScreen(this._loaderStyle))}async _MaybeLoadOpusDecoder(){if(!this._assetManager.IsAudioFormatSupported("audio/webm; codecs=opus")){var c=null;try{c=this.IsiOSCordova()&&this._assetManager.IsFileProtocol()?await this._assetManager.CordovaFetchLocalFileAsArrayBuffer(this._opusWasmBinaryUrl):await this._assetManager.FetchArrayBuffer(this._opusWasmBinaryUrl)}catch(f){console.info("Failed to fetch Opus decoder WASM; assuming project has no Opus audio.",f);return}c?this.AddJobWorkerBuffer(c,"opus-decoder-wasm"):this.AddJobWorkerBlob(null,"opus-decoder-wasm");await this.AddJobWorkerScripts([this._opusWasmScriptUrl])}}async _WasmDecodeWebMOpus(c){return await this.AddJob("OpusDecode",{arrayBuffer:c},[c])}async Start(){this._hasStarted=!0;this._startTime=Date.now();if(this._usesLoaderLayout){for(var c of this._allObjectClasses)c.IsFamily()||c.IsOnLoaderLayout()||!c.IsWorldType()||c.OnCreate();this._assetManager.WaitForAllToLoad().then(()=>{this._isLoading=!1;this._OnLoadFinished()})}else this._isLoading=!1;this._assetManager.SetInitialLoadFinished();this.IsDebug()&&a.RuntimeInit(d);for(const f of this._layoutManager.GetAllLayouts())f._CreateGlobalNonWorlds();c=this._layoutManager.GetFirstLayout();await c._Load(null,this.GetRenderer());await c._StartRunning(!0);this._fpsLastTime=performance.now();this._usesLoaderLayout||this._OnLoadFinished();(await this.PostComponentMessageToDOMAsync("runtime","before-start-ticking")).isSuspended?this._suspendCount++:this.Tick()}_OnLoadFinished(){this.Trigger(e.Plugins.System.Cnds.OnLoadFinished,null,null);this.PostComponentMessageToDOM("runtime","register-sw")}GetObjectReference(c){c=Math.floor(c);const f=this._objectReferenceTable;if(0>c||c>=f.length)throw Error("invalid object reference");return f[c]}_LoadJsPropNameTable(){for(const c of self.C3_JsPropNameTable){const f=e.first(Object.keys(c));this._jsPropNameTable.push(f)}}GetJsPropName(c){c=Math.floor(c);const f=this._jsPropNameTable;if(0>c||c>=f.length)throw Error("invalid prop reference");return f[c]}HasDOM(){return this._hasDom}IsHeadless(){return this._isHeadless}IsInWorker(){return this._isInWorker}GetBaseURL(){return this._baseUrl}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 0===this.GetCurrentEventStackFrame().GetConditionIndex()}GetCurrentAction(){return this._eventSheetManager.GetCurrentAction()}GetPluginManager(){return this._pluginManager}GetSystemPlugin(){return this._pluginManager.GetSystemPlugin()}GetObjectClassByIndex(c){c=Math.floor(c);if(0>c||c>=this._allObjectClasses.length)throw new RangeError("invalid index");return this._allObjectClasses[c]}GetObjectClassByName(c){return this._objectClassesByName.get(c.toLowerCase())||null}GetObjectClassBySID(c){return this._objectClassesBySid.get(c)||null}GetSingleGlobalObjectClassByCtor(c){return(c=this._pluginManager.GetPluginByConstructorFunction(c))?c.GetSingleGlobalObjectClass():null}GetAllObjectClasses(){return this._allObjectClasses}*allInstances(){for(const c of this._allObjectClasses)c.IsFamily()||(yield*c.instances())}Dispatcher(){return this._dispatcher}UserScriptDispatcher(){return this._userScriptDispatcher}DispatchUserScriptEvent(c){c.runtime=this.GetIRuntime();const f=this.IsDebug()&&!this._eventSheetManager.IsInEventEngine();f&&a.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(c);f&&a.AddScriptTime()}DispatchUserScriptEventAsyncWait(c){c.runtime=this.GetIRuntime();return this._userScriptDispatcher.dispatchEventAndWaitAsync(c)}GetOriginalViewportWidth(){return this._originalViewportWidth}GetOriginalViewportHeight(){return this._originalViewportHeight}SetOriginalViewportSize(c,f){if(this._originalViewportWidth!==c||this._originalViewportHeight!==f)this._originalViewportWidth=c,this._originalViewportHeight=f,c=this.GetLayoutManager(),c.SetAllLayerProjectionChanged(),c.SetAllLayerMVChanged()}GetViewportWidth(){return this._viewportWidth}GetViewportHeight(){return this._viewportHeight}SetViewportSize(c,f){if(this._viewportWidth!==c||this._viewportHeight!==f)this._viewportWidth=c,this._viewportHeight=f,c=this.GetLayoutManager(),c.SetAllLayerProjectionChanged(),c.SetAllLayerMVChanged()}_SetDevicePixelRatio(c){this._devicePixelRatio=c}GetDevicePixelRatio(){return this._devicePixelRatio}GetParallaxXOrigin(){return this._parallaxXorigin}GetParallaxYOrigin(){return this._parallaxYorigin}GetCanvasManager(){return this._canvasManager}GetDrawWidth(){return this._canvasManager?this._canvasManager.GetDrawWidth():this._viewportWidth}GetDrawHeight(){return this._canvasManager?this._canvasManager.GetDrawHeight():this._viewportHeight}GetRenderScale(){return this._canvasManager?this._canvasManager.GetRenderScale():1}GetDisplayScale(){return this._canvasManager?this._canvasManager.GetDisplayScale():1}GetCanvasClientX(){return this._canvasManager?this._canvasManager.GetCanvasClientX():0}GetCanvasClientY(){return this._canvasManager?this._canvasManager.GetCanvasClientY():0}GetCanvasCssWidth(){return this._canvasManager?this._canvasManager.GetCssWidth():0}GetCanvasCssHeight(){return this._canvasManager?this._canvasManager.GetCssHeight():0}GetFullscreenMode(){return this._canvasManager?this._canvasManager.GetFullscreenMode():"off"}GetAdditionalRenderTarget(c){return this._canvasManager?this._canvasManager.GetAdditionalRenderTarget(c):null}ReleaseAdditionalRenderTarget(c){this._canvasManager&&this._canvasManager.ReleaseAdditionalRenderTarget(c)}_SetUsesAnyBackgroundBlending(c){this._usesAnyBackgroundBlending=!!c}UsesAnyBackgroundBlending(){return this._usesAnyBackgroundBlending}GetGPUUtilisation(){return this._canvasManager?this._canvasManager.GetGPUUtilisation():NaN}IsLinearSampling(){return"nearest"!==this.GetSampling()}GetFramerateMode(){return this._framerateMode}GetCompositingMode(){return this._compositingMode}GetSampling(){return this._sampling}UsesLoaderLayout(){return this._usesLoaderLayout}GetLoadingLogoAsset(){return this._loadingLogoAsset}ReleaseLoadingLogoAsset(){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}GetAssetManager(){return this._assetManager}LoadImage(c){return this._assetManager.LoadImage(c)}CreateInstance(c,f,h,g,l){return this.CreateInstanceFromData(c,f,!1,h,g,!1,l,void 0,l)}CreateInstanceFromData(c,f,h,g,l,m,u,x,n){var q=null;let t=null;if(c instanceof e.ObjectClass){t=c;if(t.IsFamily()){c=t.GetFamilyMembers();var r=Math.floor(this.Random()*c.length);t=c[r]}q=t.GetDefaultInstanceData()}else q=c,t=this.GetObjectClassByIndex(q[1]);var w=t.GetPlugin().IsWorldType();if(this._isLoading&&w&&!t.IsOnLoaderLayout())return null;const y=f;w||(f=null);var B=h&&!m&&q&&!this._instancesByUid.has(q[2])?q[2]:this._nextUid++;r=q?q[0]:null;c=e.New(e.Instance,{runtime:this,objectType:t,layer:f,worldData:r,instVarData:q?q[3]:null,uid:B});this._instancesByUid.set(B,c);B=null;w&&(B=c.GetWorldInfo(),"undefined"!==typeof g&&"undefined"!==typeof l&&(B.SetX(g),B.SetY(l)),t._SetAnyCollisionCellChanged(!0));f&&(n||f._AddInstance(c,!0),1===f.GetParallaxX()&&1===f.GetParallaxY()||t._SetAnyInstanceParallaxed(!0),f.GetLayout().MaybeLoadTexturesFor(t));this._objectCount++;let E=!0;if(x){var H=x.GetObjectClass();H.IsInContainer()&&t.IsInContainer()&&(x=t.GetContainer(),H=H.GetContainer(),x===H&&(E=!1))}if(t.IsInContainer()&&!h&&!m&&E){for(var K of t.GetContainer().objectTypes())K!==t&&(x=this.CreateInstanceFromData(K,y,!1,B?B.GetX():g,B?B.GetY():l,!0,!1,void 0,n),c._AddSibling(x));for(var C of c.siblings()){C._AddSibling(c);for(const A of c.siblings())C!==A&&C._AddSibling(A)}}w&&!h&&u&&this._CreateChildInstancesFromData(c,r,B,f,g,l,n);if(t.IsInContainer()&&!h&&!m&&u)for(const A of c.siblings())if(h=A.GetWorldInfo())K=A.GetPlugin(),C=A.GetObjectClass().GetDefaultInstanceData()[0],K.IsWorldType()?this._CreateChildInstancesFromData(A,C,h,f,h.GetX(),h.GetY(),n):this._CreateChildInstancesFromData(A,C,h,f,void 0,void 0,n);!m&&u&&("undefined"===typeof g&&(g=r[0]),"undefined"===typeof l&&(l=r[1]),f=B.GetTopParent(),g=g-B.GetX()+f.GetX(),l=l-B.GetY()+f.GetY(),f.SetXY(g,l));t._SetIIDsStale();l=q?e.cloneArray(q[5]):null;q=q?q[4].map(A=>e.cloneArray(A)):null;(w=w&&r&&r[13])&&c._SetHasTilemap();c._CreateSdkInstance(l,q);w&&(r=r[13],c.GetSdkInstance().LoadTilemapData(r[2],r[0],r[1]));this._instancesPendingCreate.push(c);this._hasPendingInstances=!0;this.IsDebug()&&a.InstanceCreated(c);return c}_CreateChildInstancesFromData(c,f,h,g,l,m,u){var x=h.GetSceneGraphZIndexExportData(),n=h.GetSceneGraphChildrenExportData();c.GetWorldInfo().SetSceneGraphZIndex(x);if(n){"undefined"===typeof l&&(l=f[0]);"undefined"===typeof m&&(m=f[1]);x=new Set;h=f[0];f=f[1];for(const y of n){var q=y[1],t=y[2];n=y[3];var r=!!y[4];const B=y[5];t=this._layoutManager.GetLayoutBySID(y[0]).GetLayer(q).GetInitialInstanceData(t);q=this.GetObjectClassByIndex(t[1]);var w=c.HasSibling(q);const E=x.has(q);w&&!E&&r?(r=c.GetSibling(q),w=l+t[0][0]-h,t=m+t[0][1]-f,r.GetWorldInfo().SetXY(w,t),r.GetWorldInfo().SetSceneGraphZIndex(B),c.AddChild(r,{transformX:!!(n>>0&1),transformY:!!(n>>1&1),transformWidth:!!(n>>2&1),transformHeight:!!(n>>3&1),transformAngle:!!(n>>4&1),destroyWithParent:!!(n>>5&1),transformZElevation:!!(n>>6&1)}),x.add(q)):(q=this.CreateInstanceFromData(t,g,!1,l+t[0][0]-h,m+t[0][1]-f,!1,!0,c,u),q.GetWorldInfo().SetSceneGraphZIndex(B),c.AddChild(q,{transformX:!!(n>>0&1),transformY:!!(n>>1&1),transformWidth:!!(n>>2&1),transformHeight:!!(n>>3&1),transformAngle:!!(n>>4&1),destroyWithParent:!!(n>>5&1),transformZElevation:!!(n>>6&1)}))}}}DestroyInstance(c){if(!this._instancesToReleaseAtEndOfTick.has(c)){var f=c.GetObjectClass(),h=this._instancesPendingDestroy.get(f);if(h){if(h.has(c))return;h.add(c)}else h=new Set,h.add(c),this._instancesPendingDestroy.set(f,h);this.IsDebug()&&a.InstanceDestroyed(c);c._MarkDestroyed();this._hasPendingInstances=!0;if(c.IsInContainer())for(const g of c.siblings())this.DestroyInstance(g);for(const g of c.children())g.GetDestroyWithParent()&&this.DestroyInstance(g);this._layoutManager.IsEndingLayout()||this._isLoadingState||(f=this.GetEventSheetManager(),f.BlockFlushingInstances(!0),c._TriggerOnDestroyed(),f.BlockFlushingInstances(!1));c._FireDestroyedScriptEvents(this._layoutManager.IsEndingLayout())}}FlushPendingInstances(){this._hasPendingInstances&&(this._isFlushingPendingInstances=!0,this._FlushInstancesPendingCreate(),this._FlushInstancesPendingDestroy(),this._hasPendingInstances=this._isFlushingPendingInstances=!1,this.UpdateRender())}_FlushInstancesPendingCreate(){for(const c of this._instancesPendingCreate){const f=c.GetObjectClass();f._AddInstance(c);for(const h of f.GetFamilies())h._AddInstance(c),h._SetIIDsStale()}e.clearArray(this._instancesPendingCreate)}_FlushInstancesPendingDestroy(){this._dispatcher.SetDelayRemoveEventsEnabled(!0);for(const[c,f]of this._instancesPendingDestroy.entries())this._FlushInstancesPendingDestroyForObjectClass(c,f),f.clear();this._instancesPendingDestroy.clear();this._dispatcher.SetDelayRemoveEventsEnabled(!1)}_FlushInstancesPendingDestroyForObjectClass(c,f){for(const g of f){var h=this._eventObjects.instancedestroy;h.instance=g;this._dispatcher.dispatchEvent(h);this._instancesByUid.delete(g.GetUID());if(h=g.GetWorldInfo())h._RemoveFromCollisionCells(),h._RemoveFromRenderCells(),h._MarkDestroyed();this._instancesToReleaseAtEndOfTick.add(g);this._objectCount--}e.arrayRemoveAllInSet(c.GetInstances(),f);c._SetIIDsStale();this._instancesToReleaseAffectedObjectClasses.add(c);0===c.GetInstances().length&&c._SetAnyInstanceParallaxed(!1);for(const g of c.GetFamilies())e.arrayRemoveAllInSet(g.GetInstances(),f),g._SetIIDsStale(),this._instancesToReleaseAffectedObjectClasses.add(g);if(c.GetPlugin().IsWorldType()){c=new Set([...f].map(g=>g.GetWorldInfo().GetLayer()));for(const g of c)g._RemoveAllInstancesInSet(f)}}_GetInstancesPendingCreate(){return this._instancesPendingCreate}*instancesPendingCreateForObjectClass(c){for(const f of this._GetInstancesPendingCreate())c.IsFamily()?f.GetObjectClass().BelongsToFamily(c)&&(yield f):f.GetObjectClass()===c&&(yield f)}_GetNewUID(){return this._nextUid++}_MapInstanceByUID(c,f){this._instancesByUid.set(c,f)}_OnWebGLContextLost(){this._dispatcher.dispatchEvent(e.New(e.Event,"webglcontextlost"));this.SetSuspended(!0);for(var c of this._allObjectClasses)!c.IsFamily()&&c.HasLoadedTextures()&&c.ReleaseTextures();(c=this.GetMainRunningLayout())&&c._OnWebGLContextLost();e.ImageInfo.OnWebGLContextLost();e.ImageAsset.OnWebGLContextLost()}async _OnWebGLContextRestored(){await this.GetMainRunningLayout()._Load(null,this.GetWebGLRenderer());this._dispatcher.dispatchEvent(e.New(e.Event,"webglcontextrestored"));this.SetSuspended(!1);this.UpdateRender()}_OnVisibilityChange(c){this.SetSuspended(c.hidden)}_OnWindowBlur(c){this.IsPreview()&&this._pauseOnBlur&&!e.Platform.IsMobile&&!c.data.parentHasFocus&&(this.SetSuspended(!0),this._isPausedOnBlur=!0)}_OnWindowFocus(){this._isPausedOnBlur&&(this.SetSuspended(!1),this._isPausedOnBlur=!1)}_RequestAnimationFrame(){const c=this._tickCallbacks;"vsync"===this._framerateMode?-1===this._rafId&&(this._rafId=self.requestAnimationFrame(c.normal)):"unlimited-tick"===this._framerateMode?(-1===this._ruafId&&(this._ruafId=e.RequestUnlimitedAnimationFrame(c.tickOnly)),-1===this._rafId&&(this._rafId=self.requestAnimationFrame(c.renderOnly))):-1===this._ruafId&&(this._ruafId=e.RequestUnlimitedAnimationFrame(c.normal))}_CancelAnimationFrame(){-1!==this._rafId&&(self.cancelAnimationFrame(this._rafId),this._rafId=-1);-1!==this._ruafId&&(e.CancelUnlimitedAnimationFrame(this._ruafId),this._ruafId=-1)}IsSuspended(){return 0<this._suspendCount}SetSuspended(c){var f=this.IsSuspended();this._suspendCount+=c?1:-1;0>this._suspendCount&&(this._suspendCount=0);c=this.IsSuspended();!f&&c?(console.log("[Construct 3] Suspending"),this._CancelAnimationFrame(),this._dispatcher.dispatchEvent(e.New(e.Event,"suspend")),this.Trigger(e.Plugins.System.Cnds.OnSuspend,null,null)):f&&!c&&(console.log("[Construct 3] Resuming"),this._fpsLastTime=this._lastTickTime=f=performance.now(),this._mainThreadTimeCounter=this._mainThreadTime=this._fps=this._fpsFrameCount=0,this._dispatcher.dispatchEvent(e.New(e.Event,"resume")),this.Trigger(e.Plugins.System.Cnds.OnResume,null,null),this.HitBreakpoint()||this.Tick(f))}_AddBehInstToTick(c){this._behInstsToTick.Add(c)}_AddBehInstToPostTick(c){this._behInstsToPostTick.Add(c)}_AddBehInstToTick2(c){this._behInstsToTick2.Add(c)}_RemoveBehInstToTick(c){this._behInstsToTick.Remove(c)}_RemoveBehInstToPostTick(c){this._behInstsToPostTick.Remove(c)}_RemoveBehInstToTick2(c){this._behInstsToTick2.Remove(c)}_BehaviorTick(){this._behInstsToTick.SetQueueingEnabled(!0);for(const c of this._behInstsToTick)c.Tick();this._behInstsToTick.SetQueueingEnabled(!1)}_BehaviorPostTick(){this._behInstsToPostTick.SetQueueingEnabled(!0);for(const c of this._behInstsToPostTick)c.PostTick();this._behInstsToPostTick.SetQueueingEnabled(!1)}_BehaviorTick2(){this._behInstsToTick2.SetQueueingEnabled(!0);for(const c of this._behInstsToTick2)c.Tick2();this._behInstsToTick2.SetQueueingEnabled(!1)}*_DebugBehaviorTick(){this._behInstsToTick.SetQueueingEnabled(!0);for(const c of this._behInstsToTick){const f=c.Tick();e.IsIterator(f)&&(yield*f)}this._behInstsToTick.SetQueueingEnabled(!1)}*_DebugBehaviorPostTick(){this._behInstsToPostTick.SetQueueingEnabled(!0);for(const c of this._behInstsToPostTick){const f=c.PostTick();e.IsIterator(f)&&(yield*f)}this._behInstsToPostTick.SetQueueingEnabled(!1)}*_DebugBehaviorTick2(){this._behInstsToTick2.SetQueueingEnabled(!0);for(const c of this._behInstsToTick2){const f=c.Tick2();e.IsIterator(f)&&(yield*f)}this._behInstsToTick2.SetQueueingEnabled(!1)}async Tick(c,f,h){this._hasStartedTicking=!0;const g="background-wake"===h;h="background-wake"!==h&&"skip-render"!==h;this._hasStarted&&(!this.IsSuspended()||f||g)&&(f=performance.now(),this._isInTick=!0,this._MeasureDt(c||0),c=this.Step_BeforePreTick(),this.IsDebugging()&&await c,c=this._dispatcher.dispatchEventAndWait_AsyncOptional(this._eventObjects.pretick),c instanceof Promise&&await c,c=this.Step_AfterPreTick(),this.IsDebugging()&&await c,this._NeedsHandleSaveOrLoad()&&await this._HandleSaveOrLoad(),this.GetLayoutManager().IsPendingChangeMainLayout()&&await this._MaybeChangeLayout(),c=this.Step_RunEventsEtc(),this.IsDebugging()&&await c,h&&this.Render(),this.IsSuspended()||g||this._RequestAnimationFrame(),this._tickCount++,this._tickCountNoSave++,this._execCount++,this._isInTick=!1,this._mainThreadTimeCounter+=performance.now()-f)}async Step_BeforePreTick(){const c=this._eventSheetManager,f=this.IsDebug();this.FlushPendingInstances();c.BlockFlushingInstances(!0);this.PushCurrentLayout(this.GetMainRunningLayout());f&&a.StartMeasuringTime();this.IsDebugging()?await c.DebugRunScheduledWaits():c.RunScheduledWaits();f&&a.AddEventsTime();this.PopCurrentLayout();c.BlockFlushingInstances(!1);this.FlushPendingInstances();c.BlockFlushingInstances(!0)}async Step_AfterPreTick(){const c=this.IsDebug(),f=this.IsDebugging(),h=this._dispatcher,g=this._eventObjects,l=this._userScriptEventObjects;c&&a.StartMeasuringTime();f?await this.DebugIterateAndBreak(this._DebugBehaviorTick()):this._BehaviorTick();f?await this.DebugIterateAndBreak(this._DebugBehaviorPostTick()):this._BehaviorPostTick();c&&a.AddBehaviorTickTime();c&&a.StartMeasuringTime();f?await this.DebugFireGeneratorEventAndBreak(g.tick):h.dispatchEvent(g.tick);c&&a.AddPluginTickTime();this._eventSheetManager.BlockFlushingInstances(!1);this.DispatchUserScriptEvent(l.tick)}async Step_RunEventsEtc(){const c=this._eventSheetManager,f=this._dispatcher,h=this._eventObjects,g=this.IsDebug(),l=this.IsDebugging();g&&a.StartMeasuringTime();l?await c.DebugRunEvents(this._layoutManager):c.RunEvents(this._layoutManager);g&&a.AddEventsTime();this._collisionEngine.ClearRegisteredCollisions();this._ReleaseInstancesAtEndOfTick();this._isLayoutFirstTick=!1;c.BlockFlushingInstances(!0);g&&a.StartMeasuringTime();l?await this.DebugIterateAndBreak(this._DebugBehaviorTick2()):this._BehaviorTick2();g&&a.AddBehaviorTickTime();g&&a.StartMeasuringTime();l?await this.DebugFireGeneratorEventAndBreak(h.tick2):f.dispatchEvent(h.tick2);g&&a.AddPluginTickTime();c.BlockFlushingInstances(!1);l&&await c.RunQueuedDebugTriggersAsync()}_ReleaseInstancesAtEndOfTick(){if(0!==this._instancesToReleaseAtEndOfTick.size){var c=this._dispatcher;c.SetDelayRemoveEventsEnabled(!0);for(const f of this._instancesToReleaseAffectedObjectClasses)f.GetSolStack().RemoveInstances(this._instancesToReleaseAtEndOfTick);this._instancesToReleaseAffectedObjectClasses.clear();this._eventSheetManager.RemoveInstancesFromScheduledWaits(this._instancesToReleaseAtEndOfTick);for(const f of this._instancesToReleaseAtEndOfTick)f.Release();this._instancesToReleaseAtEndOfTick.clear();c.SetDelayRemoveEventsEnabled(!1)}}async _MaybeChangeLayout(){const c=this.GetLayoutManager();let f=0;for(;c.IsPendingChangeMainLayout()&&10>f++;)await this._DoChangeLayout(c.GetPendingChangeMainLayout())}_MeasureDt(c){let f=0;0!==this._lastTickTime&&(f=Math.max(c-this._lastTickTime,0)/1E3,.5<f&&(f=0),this._dt1=Math.min(f,1/this._minimumFramerate));this._lastTickTime=c;this._dt=this._dt1*this._timeScale;this._gameTime.Add(this._dt);this._gameTimeRaw.Add(f*this._timeScale);this._wallTime.Add(this._dt1);this._canvasManager&&this._canvasManager._UpdateTick();1E3<=c-this._fpsLastTime&&(this._fpsLastTime+=1E3,1E3<=c-this._fpsLastTime&&(this._fpsLastTime=c),this._fps=this._fpsFrameCount,this._fpsFrameCount=0,this._mainThreadTime=Math.min(this._mainThreadTimeCounter/1E3,1),this._mainThreadTimeCounter=0,this._canvasManager&&this._canvasManager._Update1sFrameRange(),this._collisionEngine._Update1sStats(),this.IsDebug()&&a.Update1sPerfStats());this._fpsFrameCount++}async _DoChangeLayout(c){const f=this._dispatcher,h=this.GetLayoutManager().GetMainRunningLayout();await h._StopRunning();h._Unload(c,this.GetRenderer());h===c&&this._eventSheetManager.ClearAllScheduledWaits();this._collisionEngine.ClearRegisteredCollisions();this._ReleaseInstancesAtEndOfTick();f.dispatchEvent(this._eventObjects.beforelayoutchange);e.Asyncify.SetHighThroughputMode(!0);await c._Load(h,this.GetRenderer());e.Asyncify.SetHighThroughputMode(!1);await c._StartRunning(!1);f.dispatchEvent(this._eventObjects.layoutchange);this.UpdateRender();this._isLayoutFirstTick=!0;this.FlushPendingInstances()}UpdateRender(){this._needRender=!0}GetWebGLRenderer(){return this._canvasManager?this._canvasManager.GetWebGLRenderer():null}GetWebGPURenderer(){return this._canvasManager?this._canvasManager.GetWebGPURenderer():null}GetRenderer(){return this._canvasManager?this._canvasManager.GetRenderer():null}Render(){const c=this._canvasManager;if(c&&!c.IsRendererContextLost()){var f=this.GetRenderer(),h=f.SupportsGPUProfiling(),g=h&&f.IsWebGL();h=h&&f.IsWebGPU();g&&f.CheckForQueryResults();if(this._needRender){var l=this._layoutManager.GetMainRunningLayout();f.Start();var m=this.IsDebug();m&&a.StartMeasuringTime();this._needRender=!1;var u=null;g&&(u=c.GetGPUFrameTimingsBuffer().AddTimeElapsedQuery(),f.StartQuery(u));g=null;h&&(g=f.StartFrameTiming(2*(1+l.GetLayerCount())),f.WriteTimestamp(0));this.Uses3DFeatures()&&"low"===c.GetCurrentFullscreenScalingQuality()?f.SetFixedSizeDepthBuffer(c.GetDrawWidth(),c.GetDrawHeight()):f.SetAutoSizeDepthBuffer();this._Render(this.GetRenderer(),l);u&&f.EndQuery(u);h&&(f.WriteTimestamp(1),this._canvasManager._AddWebGPUFrameTiming(g));f.Finish();m&&(a.AddDrawCallsTime(),a.UpdateInspectHighlight());c&&c._MaybeTakeSnapshot()}else f.IncrementFrameNumber()}}_Render(c,f){c.SetTextureFillMode();c.SetAlphaBlend();c.SetColorRgba(1,1,1,1);c.SetRenderTarget(null);c.SetTexture(null);c.SetDepthEnabled(this.Uses3DFeatures());f.Draw(c)}Trigger(c,f,h){if(!this._hasStarted)return!1;var g=!this._isInTick&&!this._eventSheetManager.IsInTrigger();let l=0;g&&(l=performance.now());const m=this.IsDebug();m&&this.SetDebuggingEnabled(!1);c=this._eventSheetManager._Trigger(this._layoutManager,c,f,h);g&&(g=performance.now()-l,this._mainThreadTimeCounter+=g,m&&a.AddTriggersTime(g));m&&this.SetDebuggingEnabled(!0);return c}DebugTrigger(c,f,h){if(!this.IsDebug())return this.Trigger(c,f,h);if(this.HitBreakpoint())throw Error("called DebugTrigger() while stopped on breakpoint");if(!this._isInTick&&!this._eventSheetManager.IsInTrigger())throw Error("called DebugTrigger() outside of event code - use TriggerAsync() instead");return this._eventSheetManager._DebugTrigger(this._layoutManager,c,f,h)}async TriggerAsync(c,f,h){if(!this.IsDebugging())return this.Trigger(c,f,h);if(!this._hasStarted)return!1;if(this.HitBreakpoint())return this._eventSheetManager.QueueDebugTrigger(c,f,h);if(!this.GetMainRunningLayout())return this._eventSheetManager.QueueTrigger(c,f,h);const g=performance.now();c=this._eventSheetManager._DebugTrigger(this._layoutManager,c,f,h);for(f=c.next();!f.done;)await this.DebugBreak(f.value),f=c.next();this.IsSuspended()||this._eventSheetManager.IsInTrigger()||(await this._eventSheetManager.RunQueuedDebugTriggersAsync(),this._hasStartedTicking&&!this._isInTick&&this._RequestAnimationFrame());this._mainThreadTimeCounter+=performance.now()-g;return f.value}FastTrigger(c,f,h){const g=this.IsDebug();g&&this.SetDebuggingEnabled(!1);c=this._eventSheetManager._FastTrigger(this._layoutManager,c,f,h);g&&this.SetDebuggingEnabled(!0);return c}DebugFastTrigger(c,f,h){return this._eventSheetManager._DebugFastTrigger(this._layoutManager,c,f,h)}ScheduleTriggers(c){return this._scheduleTriggersThrottle.Add(c)}PushCurrentLayout(c){this._currentLayoutStack.push(c)}PopCurrentLayout(){if(!this._currentLayoutStack.length)throw Error("layout stack empty");this._currentLayoutStack.pop()}GetCurrentLayout(){return this._currentLayoutStack.length?this._currentLayoutStack.at(-1):this.GetMainRunningLayout()}GetDt(c){return c&&-1!==c.GetTimeScale()?this._dt1*c.GetTimeScale():this._dt}_GetDtFast(){return this._dt}GetDt1(){return this._dt1}GetTimeScale(){return this._timeScale}SetTimeScale(c){if(isNaN(c)||0>c)c=0;this._timeScale=c}SetMinimumFramerate(c){this._minimumFramerate=e.clamp(c,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}IncrementExecCount(){++this._execCount}GetExecCount(){return this._execCount}GetObjectCount(){return this._objectCount}GetProjectName(){return this._projectName}GetProjectVersion(){return this._projectVersion}GetProjectUniqueId(){return this._projectUniqueId}GetAppId(){return this._appId}GetInstanceByUID(c){if(this._isLoadingState)throw Error("cannot call while loading state - wait until afterload event");return this._instancesByUid.get(c)||null}_RefreshUidMap(){this._instancesByUid.clear();for(const c of this._allObjectClasses)if(!c.IsFamily())for(const f of c.GetInstances())this._instancesByUid.set(f.GetUID(),f)}IsPreview(){return"preview"===this._exportType}IsDebug(){return this._isDebug}GetExportType(){return this._exportType}IsCordova(){return"cordova"===this._exportType}IsAndroidWebView(){return"Android"===e.Platform.OS&&("cordova"===this._exportType||"playable-ad"===this._exportType||"instant-games"===this._exportType)}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(){const c=this.GetRenderer();return this.GetViewportHeight()/2/Math.tan(c.GetFovY()/2)/c.GetDefaultCameraZ()}IsLayoutFirstTick(){return this._isLayoutFirstTick}SetPixelRoundingEnabled(c){c=!!c;this._isPixelRoundingEnabled!==c&&(this._isPixelRoundingEnabled=c,this.GetLayoutManager().SetAllLayerMVChanged(),this.UpdateRender())}IsPixelRoundingEnabled(){return this._isPixelRoundingEnabled}SaveToSlot(c){this._saveToSlotName=c}LoadFromSlot(c){this._loadFromSlotName=c}LoadFromJsonString(c){this._loadFromJson=c}GetLastSaveJsonString(){return this._lastSaveJson}_NeedsHandleSaveOrLoad(){return!(!this._saveToSlotName&&!this._loadFromSlotName&&null===this._loadFromJson)}async _HandleSaveOrLoad(){this._saveToSlotName&&(this.FlushPendingInstances(),await this._DoSaveToSlot(this._saveToSlotName),this._ClearSaveOrLoad());this._loadFromSlotName&&(await this._DoLoadFromSlot(this._loadFromSlotName),this._ClearSaveOrLoad(),this.IsDebug()&&a.StepIfPausedInDebugger());if(null!==this._loadFromJson){this.FlushPendingInstances();try{await this._DoLoadFromJsonString(this._loadFromJson),this._lastSaveJson=this._loadFromJson,await this.TriggerAsync(e.Plugins.System.Cnds.OnLoadComplete,null),this._lastSaveJson=""}catch(c){console.error("[Construct 3] Failed to load state from JSON string: ",c),await this.TriggerAsync(e.Plugins.System.Cnds.OnLoadFailed,null)}this._ClearSaveOrLoad()}}_ClearSaveOrLoad(){this._loadFromSlotName=this._saveToSlotName="";this._loadFromJson=null}_GetProjectStorage(){this._projectStorage||(this._projectStorage=localforage.createInstance({name:"c3-localstorage-"+this.GetProjectUniqueId(),description:this.GetProjectName()}));return this._projectStorage}_GetSavegamesStorage(){this._savegamesStorage||(this._savegamesStorage=localforage.createInstance({name:"c3-savegames-"+
  this.GetProjectUniqueId(),description:this.GetProjectName()}));return this._savegamesStorage}async _DoSaveToSlot(c){const f=await this._SaveToJsonString();try{await this._GetSavegamesStorage().setItem(c,f),console.log("[Construct 3] Saved state to storage ("+f.length+" chars)"),this._lastSaveJson=f,await this.TriggerAsync(e.Plugins.System.Cnds.OnSaveComplete,null),this._lastSaveJson=""}catch(h){console.error("[Construct 3] Failed to save state to storage: ",h),await this.TriggerAsync(e.Plugins.System.Cnds.OnSaveFailed,null)}}async _DoLoadFromSlot(c){try{const f=await this._GetSavegamesStorage().getItem(c);if(!f)throw Error("empty slot");console.log("[Construct 3] Loaded state from storage ("+f.length+" chars)");await this._DoLoadFromJsonString(f);this._lastSaveJson=f;await this.TriggerAsync(e.Plugins.System.Cnds.OnLoadComplete,null);this._lastSaveJson=""}catch(f){console.error("[Construct 3] Failed to load state from storage: ",f),await this.TriggerAsync(e.Plugins.System.Cnds.OnLoadFailed,null)}}async _SaveToJsonString(){const c={c3save:!0,version:1,rt:{time:this.GetGameTime(),timeRaw:this.GetGameTimeRaw(),walltime:this.GetWallTime(),timescale:this.GetTimeScale(),tickcount:this.GetTickCount(),execcount:this.GetExecCount(),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(var f of this._allObjectClasses)f.IsFamily()||f.HasNoSaveBehavior()||(c.types[f.GetSID().toString()]=f._SaveToJson());for(const h of this._layoutManager.GetAllLayouts())c.layouts[h.GetSID().toString()]=h._SaveToJson();f=this._CreateUserScriptEvent("save");f.saveData=null;await this.DispatchUserScriptEventAsyncWait(f);c.user_script_data=f.saveData;return JSON.stringify(c)}IsLoadingState(){return this._isLoadingState}async _DoLoadFromJsonString(c){var f=this.GetLayoutManager();c=JSON.parse(c);if(c.c2save)throw Error("C2 saves are incompatible with C3 runtime");if(!c.c3save)throw Error("not valid C3 save data");if(1<c.version)throw Error("C3 save data from future version");this._dispatcher.dispatchEvent(e.New(e.Event,"beforeload"));for(var h of this.allInstances())h._OnBeforeLoad();this._isLoadingState=!0;h=c.rt;this._gameTime.Set(h.time);h.hasOwnProperty("timeRaw")&&this._gameTimeRaw.Set(h.timeRaw);this._wallTime.Set(h.walltime);this._timeScale=h.timescale;this._tickCount=h.tickcount;this._execCount=h.execcount;this._startTime=Date.now()-h.start_time_offset;var g=h.running_layout;if(g!==this.GetMainRunningLayout().GetSID())if(g=f.GetLayoutBySID(g))await this._DoChangeLayout(g);else return;for(const[l,m]of Object.entries(c.types))g=parseInt(l,10),g=this.GetObjectClassBySID(g),!g||g.IsFamily()||g.HasNoSaveBehavior()||g._LoadFromJson(m);this.FlushPendingInstances();this._RefreshUidMap();this._isLoadingState=!1;this._nextUid=h.next_uid;for(const[l,m]of Object.entries(c.layouts))h=parseInt(l,10),(h=f.GetLayoutBySID(h))&&h._LoadFromJson(m);this._eventSheetManager._LoadFromJson(c.events);for(const l of this._allObjectClasses)if(!l.IsFamily()&&l.IsInContainer())for(const m of l.GetInstances()){h=m.GetIID();for(const u of l.GetContainer().objectTypes())if(u!==l){g=u.GetInstances();if(0>h||h>=g.length)throw Error("missing sibling instance");m._AddSibling(g[h])}}this._timelineManager._LoadFromJson(c.timelines);f.SetAllLayerProjectionChanged();f.SetAllLayerMVChanged();this._dispatcher.dispatchEvent(e.New(e.Event,"afterload"));f=this._CreateUserScriptEvent("load");f.saveData=c.user_script_data;await this.DispatchUserScriptEventAsyncWait(f);this.UpdateRender()}async AddJobWorkerScripts(c){c=(await Promise.all(c.map(f=>this._assetManager.FetchBlob(f)))).map(f=>URL.createObjectURL(f));this._jobScheduler.ImportScriptsToJobWorkers(c)}AddJobWorkerBlob(c,f){this._jobScheduler.SendBlobToJobWorkers(c,f)}AddJobWorkerBuffer(c,f){this._jobScheduler.SendBufferToJobWorkers(c,f)}AddJob(c,f,h){return this._jobScheduler.AddJob(c,f,h)}BroadcastJob(c,f,h){return this._jobScheduler.BroadcastJob(c,f,h)}InvokeDownload(c,f){this.PostComponentMessageToDOM("runtime","invoke-download",{url:c,filename:f})}async RasterSvgImage(c,f,h,g,l,m){g=g||f;l=l||h;if(this.IsInWorker())return(await this.PostComponentMessageToDOMAsync("runtime","raster-svg-image",{blob:c,imageWidth:f,imageHeight:h,surfaceWidth:g,surfaceHeight:l,imageBitmapOpts:m})).imageBitmap;c=await self.C3_RasterSvgImageBlob(c,f,h,g,l);return m?await self.createImageBitmap(c,m):c}async GetSvgImageSize(c){return this.IsInWorker()?await this.PostComponentMessageToDOMAsync("runtime","get-svg-image-size",{blob:c}):await self.C3_GetSvgImageSize(c)}RequestDeviceOrientationEvent(){this._didRequestDeviceOrientationEvent||(this._didRequestDeviceOrientationEvent=!0,this.PostComponentMessageToDOM("runtime","enable-device-orientation"))}RequestDeviceMotionEvent(){this._didRequestDeviceMotionEvent||(this._didRequestDeviceMotionEvent=!0,this.PostComponentMessageToDOM("runtime","enable-device-motion"))}Random(){return this._randomNumberCallback()}SetRandomNumberGeneratorCallback(c){this._randomNumberCallback=c}_GetRemotePreviewStatusInfo(){const c=this.GetWebGLRenderer();return{fps:this.GetFPS(),cpu:this.GetMainThreadTime(),gpu:this.GetGPUUtilisation(),layout:this.GetMainRunningLayout()?this.GetMainRunningLayout().GetName():"",renderer:c?c.GetUnmaskedRenderer():"<unavailable>"}}HitBreakpoint(){return this.IsDebug()?a.HitBreakpoint():!1}DebugBreak(c){return this.IsDebugging()?a.DebugBreak(c):Promise.resolve()}DebugBreakNext(){return this.IsDebugging()?a.BreakNext():!1}SetDebugBreakpointsEnabled(c){this._breakpointsEnabled=!!c;this._UpdateDebuggingFlag()}AreDebugBreakpointsEnabled(){return this._breakpointsEnabled}IsDebugging(){return this._isDebugging}SetDebuggingEnabled(c){c?this._debuggingDisabled--:this._debuggingDisabled++;this._UpdateDebuggingFlag()}_UpdateDebuggingFlag(){this._isDebugging=this.IsDebug()&&this._breakpointsEnabled&&0===this._debuggingDisabled}IsCPUProfiling(){return this.IsDebug()&&a.IsCPUProfiling()}IsGPUProfiling(){return this.IsDebug()&&this.GetRenderer().SupportsGPUProfiling()&&a.IsGPUProfiling()}async DebugIterateAndBreak(c){if(c)for(const f of c)await this.DebugBreak(f)}DebugFireGeneratorEventAndBreak(c){return this.DebugIterateAndBreak(this._dispatcher.dispatchGeneratorEvent(c))}_InvokeFunctionFromJS(c){return this._eventSheetManager._InvokeFunctionFromJS(c.name,c.params)}GetIRuntime(){return this._iRuntime}_CreateUserScriptEvent(c){c=e.New(e.Event,c,!1);c.runtime=this._iRuntime;return c}_InitScriptInterfaces(){var c={};for(const f of this._allObjectClasses)c[f.GetJsPropName()]={value:f.GetIObjectClass(),enumerable:!0,writable:!1};c=Object.create(Object.prototype,c);this._iRuntime=new self.IRuntime(this,c);this._userScriptEventObjects={tick:this._CreateUserScriptEvent("tick")}}_InitGlobalVariableScriptInterface(){const c={};for(const f of this.GetEventSheetManager().GetAllGlobalVariables())c[f.GetJsPropName()]=f._GetScriptInterfaceDescriptor();this._iRuntime._InitGlobalVars(c)}_GetCommonScriptInterfaces(){return this._commonScriptInterfaces}_MapScriptInterface(c,f){this._interfaceMap.set(c,f)}_UnwrapScriptInterface(c){return this._interfaceMap.get(c)}_UnwrapIObjectClass(c){if(!(c instanceof self.IObjectClass))throw new TypeError("expected IObjectClass");c=this._UnwrapScriptInterface(c);if(!(c&&c instanceof e.ObjectClass))throw Error("invalid IObjectClass");return c}_UnwrapIWorldInstance(c){if(!(c instanceof
  self.IWorldInstance))throw new TypeError("expected IWorldInstance");c=this._UnwrapScriptInterface(c);if(!(c&&c instanceof e.Instance))throw Error("invalid IInstance");return c}};self.C3_CreateRuntime=e.Runtime.Create;self.C3_InitRuntime=(c,f)=>c.Init(f)}
  {"use strict";const e=self.C3;e.JobSchedulerRuntime=class extends e.DefendedBase{constructor(a,b){super();this._runtime=a;this._jobPromises=new Map;this._nextJobId=0;this._inputPort=b.inputPort;b.outputPort.onmessage=d=>this._OnJobWorkerMessage(d);this._maxNumWorkers=b.maxNumWorkers;this._jobWorkerCount=1;this._hadErrorCreatingWorker=this._isCreatingWorker=!1}async Init(){}ImportScriptsToJobWorkers(a){this._inputPort.postMessage({type:"_import_scripts",scripts:a})}SendBlobToJobWorkers(a,b){this._inputPort.postMessage({type:"_send_blob",blob:a,id:b})}SendBufferToJobWorkers(a,b){this._inputPort.postMessage({type:"_send_buffer",buffer:a,id:b},[a])}AddJob(a,b,d,c,f){d||(d=[]);const h=this._nextJobId++;a={type:a,isBroadcast:!1,jobId:h,params:b,transferables:d};b=new Promise((g,l)=>{this._jobPromises.set(h,{resolve:g,progress:c,reject:l,cancelled:!1})});f&&f.SetAction(()=>this._CancelJob(h));this._inputPort.postMessage(a,d);this._MaybeCreateExtraWorker();return b}BroadcastJob(a,b,d){d||(d=[]);const c=this._nextJobId++;this._inputPort.postMessage({type:a,isBroadcast:!0,jobId:c,params:b,transferables:d},d)}_CancelJob(a){const b=this._jobPromises.get(a);b&&(b.cancelled=!0,b.resolve=null,b.progress=null,b.reject=null,this._inputPort.postMessage({type:"_cancel",jobId:a}))}_OnJobWorkerMessage(a){a=a.data;const b=a.type,d=a.jobId;switch(b){case "result":this._OnJobResult(d,a.result);break;case "progress":this._OnJobProgress(d,a.progress);break;case "error":this._OnJobError(d,a.error);break;case "ready":this._OnJobWorkerReady();break;default:throw Error(`unknown message from worker '${b}'`);}}_OnJobResult(a,b){const d=this._jobPromises.get(a);if(!d)throw Error("invalid job ID");d.cancelled||d.resolve(b);this._jobPromises.delete(a)}_OnJobProgress(a,b){a=this._jobPromises.get(a);if(!a)throw Error("invalid job ID");!a.cancelled&&a.progress&&a.progress(b)}_OnJobError(a,b){const d=this._jobPromises.get(a);if(!d)throw Error("invalid job ID");d.cancelled||d.reject(b);this._jobPromises.delete(a)}_OnJobWorkerReady(){this._isCreatingWorker&&(this._isCreatingWorker=!1,this._jobWorkerCount++,this._jobWorkerCount<this._maxNumWorkers?this._MaybeCreateExtraWorker():this._inputPort.postMessage({type:"_no_more_workers"}))}async _MaybeCreateExtraWorker(){if(!(this._jobWorkerCount>=this._maxNumWorkers||this._isCreatingWorker||this._hadErrorCreatingWorker||this._jobPromises.size<=this._jobWorkerCount))try{this._isCreatingWorker=!0,(await this._runtime.PostComponentMessageToDOMAsync("runtime","create-job-worker")).outputPort.onmessage=a=>this._OnJobWorkerMessage(a)}catch(a){this._hadErrorCreatingWorker=!0,this._isCreatingWorker=!1,console.error(`[Construct 3] Failed to create job worker; stopping creating any more (created ${this._jobWorkerCount} so far)`,a)}}}}self.C3_Shaders={};{"use strict";const e=self.C3;let a=null,b="",d="",c=[],f="",h="",g="";const l=e.New(e.ArrayStack);function m(u,x){u=u[1];x=x[1];if("number"===typeof u&&"number"===typeof x)return u-x;u=""+u;x=""+x;return u<x?-1:u>x?1:0}e.Plugins.System=class extends e.SDKPluginBase{constructor(u){super(u);this._loopStack=this._runtime.GetEventSheetManager().GetLoopStack();this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._imagesLoadingComplete=this._imagesLoadingTotal=0;this._functionMaps=new Map}Release(){super.Release()}UpdateRender(){this._runtime.UpdateRender()}Trigger(u){this._runtime.Trigger(u,null,null)}GetRegex(u,x){a&&u===b&&x===d||(a=new RegExp(u,x),b=u,d=x);a.lastIndex=0;return a}GetRegexMatches(u,x,n){if(u===f&&x===h&&n===g)return c;const q=this.GetRegex(x,n);c=u.match(q);f=u;h=x;g=n;return c}async _LoadTexturesForObjectClasses(u,x){if(x.length){this._imagesLoadingTotal+=x.length;var n=[];for(const q of x)n.push(u.MaybeLoadTexturesFor(q));await e.PromiseAllWithProgress(n,()=>{this._imagesLoadingComplete++});this._imagesLoadingComplete++;this._imagesLoadingComplete===this._imagesLoadingTotal&&(this._runtime.Trigger(e.Plugins.System.Cnds.OnImageLoadingComplete,null,null),this._imagesLoadingTotal=this._imagesLoadingComplete=0)}}_UnloadTexturesForObjectClasses(u,x){for(const n of x)0===n.GetInstanceCount()&&u.MaybeUnloadTexturesFor(n)}_GetForEachStack(){return l}_Repeat(u){var x=this._runtime.GetEventSheetManager();const n=x.GetEventStack(),q=n.GetCurrentStackFrame(),t=q.GetCurrentEvent(),r=t.GetSolModifiers();var w=q.IsSolModifierAfterCnds();const y=n.Push(t),B=x.GetLoopStack(),E=B.Push();E.SetEnd(u);if(w)for(w=0;w<u&&!E.IsStopped();++w)x.PushCopySol(r),E.SetIndex(w),t.Retrigger(q,y),x.PopSol(r);else for(x=0;x<u&&!E.IsStopped();++x)E.SetIndex(x),t.Retrigger(q,y);n.Pop();B.Pop();return!1}*_DebugRepeat(u){var x=this._runtime.GetEventSheetManager();const n=x.GetEventStack(),q=n.GetCurrentStackFrame(),t=q.GetCurrentEvent(),r=t.GetSolModifiers();var w=q.IsSolModifierAfterCnds();const y=n.Push(t),B=x.GetLoopStack(),E=B.Push();E.SetEnd(u);if(w)for(w=0;w<u&&!E.IsStopped();++w)x.PushCopySol(r),E.SetIndex(w),yield*t.DebugRetrigger(q,y),x.PopSol(r);else for(x=0;x<u&&!E.IsStopped();++x)E.SetIndex(x),yield*t.DebugRetrigger(q,y);n.Pop();B.Pop();return!1}_While(){var u=this._runtime.GetEventSheetManager();const x=u.GetEventStack(),n=x.GetCurrentStackFrame(),q=n.GetCurrentEvent(),t=q.GetSolModifiers();var r=n.IsSolModifierAfterCnds();const w=x.Push(q),y=u.GetLoopStack(),B=y.Push();if(r)for(r=0;!B.IsStopped();++r)u.PushCopySol(t),B.SetIndex(r),q.Retrigger(n,w)||B.Stop(),u.PopSol(t);else for(u=0;!B.IsStopped();++u)B.SetIndex(u),q.Retrigger(n,w)||B.Stop();x.Pop();y.Pop();return!1}*_DebugWhile(){var u=this._runtime.GetEventSheetManager();const x=u.GetEventStack(),n=x.GetCurrentStackFrame(),q=n.GetCurrentEvent(),t=q.GetSolModifiers();var r=n.IsSolModifierAfterCnds();const w=x.Push(q),y=u.GetLoopStack(),B=y.Push();if(r)for(r=0;!B.IsStopped();++r)u.PushCopySol(t),B.SetIndex(r),(yield*q.DebugRetrigger(n,w))||B.Stop(),u.PopSol(t);else for(u=0;!B.IsStopped();++u)B.SetIndex(u),(yield*q.DebugRetrigger(n,w))||B.Stop();x.Pop();y.Pop();return!1}_For(u,x,n){var q=this._runtime.GetEventSheetManager();const t=q.GetEventStack(),r=t.GetCurrentStackFrame(),w=r.GetCurrentEvent(),y=w.GetSolModifiers(),B=r.IsSolModifierAfterCnds(),E=t.Push(w),H=q.GetLoopStack(),K=H.Push();K.SetName(u);K.SetEnd(n);if(n<x)if(B)for(u=x;u>=n&&!K.IsStopped();--u)q.PushCopySol(y),K.SetIndex(u),w.Retrigger(r,E),q.PopSol(y);else for(q=x;q>=n&&!K.IsStopped();--q)K.SetIndex(q),w.Retrigger(r,E);else if(B)for(u=x;u<=n&&!K.IsStopped();++u)q.PushCopySol(y),K.SetIndex(u),w.Retrigger(r,E),q.PopSol(y);else for(q=x;q<=n&&!K.IsStopped();++q)K.SetIndex(q),w.Retrigger(r,E);t.Pop();H.Pop();return!1}*_DebugFor(u,x,n){var q=this._runtime.GetEventSheetManager();const t=q.GetEventStack(),r=t.GetCurrentStackFrame(),w=r.GetCurrentEvent(),y=w.GetSolModifiers(),B=r.IsSolModifierAfterCnds(),E=t.Push(w),H=q.GetLoopStack(),K=H.Push();K.SetName(u);K.SetEnd(n);if(n<x)if(B)for(u=x;u>=n&&!K.IsStopped();--u)q.PushCopySol(y),K.SetIndex(u),yield*w.DebugRetrigger(r,E),q.PopSol(y);else for(q=x;q>=n&&!K.IsStopped();--q)K.SetIndex(q),yield*w.DebugRetrigger(r,E);else if(B)for(u=x;u<=n&&!K.IsStopped();++u)q.PushCopySol(y),K.SetIndex(u),yield*w.DebugRetrigger(r,E),q.PopSol(y);else for(q=x;q<=n&&!K.IsStopped();++q)K.SetIndex(q),yield*w.DebugRetrigger(r,E);t.Pop();H.Pop();return!1}_ForEach(u){var x=this._runtime.GetEventSheetManager();const n=x.GetEventStack(),q=n.GetCurrentStackFrame(),t=q.GetCurrentEvent(),r=t.GetSolModifiers();var w=q.IsSolModifierAfterCnds();const y=n.Push(t),B=x.GetLoopStack(),E=B.Push(),H=u.IsInContainer(),K=u.GetCurrentSol(),C=l.Push();e.shallowAssignArray(C,K.GetInstances());E.SetEnd(C.length);if(w)for(let A=0,F=C.length;A<F&&!E.IsStopped();++A)x.PushCopySol(r),w=C[A],u.GetCurrentSol().SetSinglePicked(w),H&&w.SetSiblingsSinglePicked(),E.SetIndex(A),t.Retrigger(q,y),x.PopSol(r);else{K._SetSelectAll(!1);u=K._GetOwnInstances();e.clearArray(u);u.push(null);for(let A=0,F=C.length;A<F&&!E.IsStopped();++A)x=C[A],u[0]=x,H&&x.SetSiblingsSinglePicked(),E.SetIndex(A),t.Retrigger(q,y)}n.Pop();B.Pop();e.clearArray(C);l.Pop();return!1}*_DebugForEach(u){var x=this._runtime.GetEventSheetManager();const n=x.GetEventStack(),q=n.GetCurrentStackFrame(),t=q.GetCurrentEvent(),r=t.GetSolModifiers();var w=q.IsSolModifierAfterCnds();const y=n.Push(t),B=x.GetLoopStack(),E=B.Push(),H=u.IsInContainer(),K=u.GetCurrentSol(),C=l.Push();e.shallowAssignArray(C,K.GetInstances());E.SetEnd(C.length);if(w)for(let A=0,F=C.length;A<F&&!E.IsStopped();++A)x.PushCopySol(r),w=C[A],u.GetCurrentSol().SetSinglePicked(w),H&&w.SetSiblingsSinglePicked(),E.SetIndex(A),yield*t.DebugRetrigger(q,y),x.PopSol(r);else{K._SetSelectAll(!1);u=K._GetOwnInstances();e.clearArray(u);u.push(null);for(let A=0,F=C.length;A<F&&!E.IsStopped();++A)x=C[A],u[0]=x,H&&x.SetSiblingsSinglePicked(),E.SetIndex(A),yield*t.DebugRetrigger(q,y)}n.Pop();B.Pop();e.clearArray(C);l.Pop();return!1}_ForEachOrdered(u,x){var n=this._runtime.GetEventSheetManager();const q=n.GetEventStack(),t=n.GetCurrentCondition(),r=q.GetCurrentStackFrame(),w=r.GetCurrentEvent(),y=w.GetSolModifiers(),B=r.IsSolModifierAfterCnds(),E=q.Push(w),H=n.GetLoopStack(),K=H.Push(),C=u.IsInContainer(),A=u.GetCurrentSol(),F=l.Push();e.clearArray(F);const J=A.GetInstances();K.SetEnd(J.length);for(let L=0,R=J.length;L<R;++L)F.push([J[L],t.ReevaluateParameter(1,L)]);F.sort(m);1===x&&F.reverse();if(B)for(let L=0,R=F.length;L<R&&!K.IsStopped();++L)n.PushCopySol(y),x=F[L][0],u.GetCurrentSol().SetSinglePicked(x),C&&x.SetSiblingsSinglePicked(),K.SetIndex(L),w.Retrigger(r,E),n.PopSol(y);else{A._SetSelectAll(!1);u=A._GetOwnInstances();e.clearArray(u);u.push(null);for(let L=0,R=F.length;L<R&&!K.IsStopped();++L)n=F[L][0],u[0]=n,C&&n.SetSiblingsSinglePicked(),K.SetIndex(L),w.Retrigger(r,E)}q.Pop();H.Pop();e.clearArray(F);l.Pop();return!1}*_DebugForEachOrdered(u,x){var n=this._runtime.GetEventSheetManager();const q=n.GetEventStack(),t=n.GetCurrentCondition(),r=q.GetCurrentStackFrame(),w=r.GetCurrentEvent(),y=w.GetSolModifiers(),B=r.IsSolModifierAfterCnds(),E=q.Push(w),H=n.GetLoopStack(),K=H.Push(),C=u.IsInContainer(),A=u.GetCurrentSol(),F=l.Push();e.clearArray(F);const J=A.GetInstances();K.SetEnd(J.length);for(let L=0,R=J.length;L<R;++L)F.push([J[L],t.ReevaluateParameter(1,L)]);F.sort(m);1===x&&F.reverse();if(B)for(let L=0,R=F.length;L<R&&!K.IsStopped();++L)n.PushCopySol(y),x=F[L][0],u.GetCurrentSol().SetSinglePicked(x),C&&x.SetSiblingsSinglePicked(),K.SetIndex(L),yield*w.DebugRetrigger(r,E),n.PopSol(y);else{A._SetSelectAll(!1);u=A._GetOwnInstances();e.clearArray(u);u.push(null);for(let L=0,R=F.length;L<R&&!K.IsStopped();++L)n=F[L][0],u[0]=n,C&&n.SetSiblingsSinglePicked(),K.SetIndex(L),yield*w.DebugRetrigger(r,E)}q.Pop();H.Pop();e.clearArray(F);l.Pop();return!1}_GetFunctionMap(u,x){let n=this._functionMaps.get(u);if(n)return n;if(!x)return null;n={defaultFunc:null,strMap:new Map};this._functionMaps.set(u,n);return n}_DoCallMappedFunction(u,x,n,q,t){x.GetEventBlock().RunAsMappedFunctionCall(n);q&&u.PopSol(t)}*_DebugDoCallMappedFunction(u,x,n,q,t){yield*x.GetEventBlock().DebugRunAsMappedFunctionCall(n);q&&u.PopSol(t)}}}{"use strict";const e=self.C3;e.Plugins.System.Type=class extends e.DefendedBase{constructor(a){super();this._objectClass=a;this._runtime=a.GetRuntime();this._plugin=a.GetPlugin()}OnCreate(){}Release(){this._plugin=this._runtime=this._objectClass=null}}}
  {"use strict";const e=self.C3;e.Plugins.System.Instance=class extends e.DefendedBase{constructor(a,b){super();this._inst=a;this._objectClass=this._inst.GetObjectClass();this._sdkType=this._objectClass.GetSdkType();this._runtime=this._inst.GetRuntime()}Release(){this._runtime=this._sdkType=this._objectClass=this._inst=null}}}
  {"use strict";const e=self.C3,a=[];e.Plugins.System.Cnds={EveryTick(){return!0},OnLayoutStart(){return!0},OnLayoutEnd(){return!0},OnSuspend(){return!0},OnResume(){return!0},IsSuspended(){return this._runtime.IsSuspended()},Else(){const b=this._runtime.GetCurrentEventStackFrame();return b.GetElseBranchRan()?!1:!b.GetLastEventTrue()},TriggerOnce(){const b=this._runtime.GetCurrentCondition().GetSavedDataMap();let d=b.get("TriggerOnce_lastTick");"undefined"===typeof d&&(d=-1,b.set("TriggerOnce_lastTick",-1));const c=this._runtime.GetTickCount();b.set("TriggerOnce_lastTick",c);return this._runtime.IsLayoutFirstTick()||d!==c-1},Every(b){const d=this._runtime.GetCurrentCondition().GetSavedDataMap(),c=d.get("Every_lastTime")||0,f=this._runtime.GetGameTime();d.has("Every_seconds")||d.set("Every_seconds",b);const h=d.get("Every_seconds");if(f>=c+h)return d.set("Every_lastTime",c+h),f>=d.get("Every_lastTime")+.04&&d.set("Every_lastTime",f),d.set("Every_seconds",b),!0;f<c-.1&&d.set("Every_lastTime",f);return!1},IsGroupActive(b){return(b=this._runtime.GetEventSheetManager().GetEventGroupByName(b))&&b.IsGroupActive()},IsPreview(){return this._runtime.IsPreview()},IsMobile(){return e.Platform.IsMobile},OnLoadFinished(){return!0},OnCanvasSnapshot(){return!0},EffectsSupported(){return!0},OnSaveComplete(){return!0},OnSaveFailed(){return!0},OnLoadComplete(){return!0},OnLoadFailed(){return!0},ObjectUIDExists(b){return!!this._runtime.GetInstanceByUID(b)},IsOnPlatform(b){switch(b){case 0:return"browser"===e.Platform.Context;case 1:return"iOS"===e.Platform.OS;case 2:return"Android"===e.Platform.OS;case 8:return"cordova"===e.Platform.Context;case 9:return"scirra-arcade"===this._runtime.GetExportType();case 10:return"nwjs"===e.Platform.Context;case 13:return"windows-uwp"===this._runtime.GetExportType();default:return!1}},RegexTest(b,d,c){return this.GetRegex(d,c).test(b)},Compare(b,d,c){return e.compare(b,d,c)},CompareBetween(b,d,c){return b>=d&&b<=c},CompareVar(b,d,c){return e.compare(b.GetValue(),d,c)},CompareBoolVar(b){return!!b.GetValue()},CompareTime(b,d){const c=this._runtime.GetGameTime();return 0===b?(b=this._runtime.GetCurrentCondition().GetSavedDataMap(),!b.get("CompareTime_executed")&&c>=d?(b.set("CompareTime_executed",!0),!0):!1):e.compare(c,b,d)},IsNaN(b){return isNaN(b)},AngleWithin(b,d,c){return e.angleDiff(e.toRadians(b),e.toRadians(c))<=e.toRadians(d)},IsClockwiseFrom(b,d){return e.angleClockwise(e.toRadians(b),e.toRadians(d))},IsBetweenAngles(b,d,c){b=e.toRadians(b);d=e.toRadians(d);c=e.toRadians(c);return e.angleClockwise(c,d)?e.angleClockwise(b,d)&&!e.angleClockwise(b,c):!(!e.angleClockwise(b,d)&&e.angleClockwise(b,c))},IsValueType(b,d){return"number"===typeof b?0===d:1===d},EvaluateExpression(b){return!!b},PickByComparison(b,d,c,f){if(!b)return!1;const h=this._GetForEachStack(),g=h.Push(),l=b.GetCurrentSol();e.shallowAssignArray(g,l.GetInstances());l.IsSelectAll()&&e.clearArray(l._GetOwnElseInstances());const m=this._runtime.GetCurrentCondition();let u=0;for(let x=0,n=g.length;x<n;++x){const q=g[x];g[u]=q;d=m.ReevaluateParameter(1,x);f=m.ReevaluateParameter(3,x);e.compare(d,c,f)?++u:l._PushElseInstance(q)}e.truncateArray(g,u);l.SetArrayPicked(g);d=!!g.length;e.clearArray(g);h.Pop();b.ApplySolToContainer();return d},PickByEvaluate(b,d){if(!b)return!1;const c=this._GetForEachStack(),f=c.Push(),h=b.GetCurrentSol();e.shallowAssignArray(f,h.GetInstances());h.IsSelectAll()&&e.clearArray(h._GetOwnElseInstances());const g=this._runtime.GetCurrentCondition();let l=0;for(let m=0,u=f.length;m<u;++m){const x=f[m];f[l]=x;(d=g.ReevaluateParameter(1,m))?++l:h._PushElseInstance(x)}e.truncateArray(f,l);h.SetArrayPicked(f);d=!!f.length;e.clearArray(f);c.Pop();b.ApplySolToContainer();return d},PickNth(b,d){if(!b)return!1;const c=b.GetCurrentSol(),f=c.GetInstances();d=Math.floor(d);if(d>=f.length)return!1;c.PickOne(f[d]);b.ApplySolToContainer();return!0},PickRandom(b){if(!b)return!1;const d=b.GetCurrentSol(),c=d.GetInstances(),f=Math.floor(this._runtime.Random()*c.length);if(f>=c.length)return!1;d.PickOne(c[f]);b.ApplySolToContainer();return!0},PickAll(b){if(!b||!b.GetInstanceCount())return!1;b.GetCurrentSol()._SetSelectAll(!0);b.ApplySolToContainer();return!0},PickOverlappingPoint(b,d,c){if(!b)return!1;const f=b.GetCurrentSol();var h=f.GetInstances();const g=this._runtime.GetCurrentEvent().IsOrBlock(),l=this._runtime.GetCurrentCondition().IsInverted();f.IsSelectAll()?(e.shallowAssignArray(a,h),f.ClearArrays(),f._SetSelectAll(!1)):g?(e.shallowAssignArray(a,f._GetOwnElseInstances()),e.clearArray(f._GetOwnElseInstances())):(e.shallowAssignArray(a,f._GetOwnInstances()),e.clearArray(f._GetOwnInstances()));for(let m=0,u=a.length;m<u;++m)h=a[m],e.xor(h.GetWorldInfo().ContainsPoint(d,c),l)?f._PushInstance(h):f._PushElseInstance(h);b.ApplySolToContainer();return e.xor(!!f._GetOwnInstances().length,l)},PickLastCreated(b){if(!b)return!1;var d=b.IsFamily();let c=null;const f=this._runtime._GetInstancesPendingCreate();for(let h=f.length-1;0<=h;--h){const g=f[h];if(d){if(g.GetObjectClass().BelongsToFamily(b)){c=g;break}}else if(g.GetObjectClass()===b){c=g;break}}c||(d=b.GetInstances(),d.length&&(c=d.at(-1)));if(!c)return!1;b.GetCurrentSol().PickOne(c);b.ApplySolToContainer();return!0},Repeat(b){return this._runtime.IsDebugging()?this._DebugRepeat(b):this._Repeat(b)},While(){return this._runtime.IsDebugging()?this._DebugWhile():this._While()},For(b,d,c){return this._runtime.IsDebugging()?this._DebugFor(b,d,c):this._For(b,d,c)},ForEach(b){return this._runtime.IsDebugging()?this._DebugForEach(b):this._ForEach(b)},ForEachOrdered(b,d,c){return this._runtime.IsDebugging()?this._DebugForEachOrdered(b,c):this._ForEachOrdered(b,c)},LayerVisible(b){return b?b.IsVisible():!1},LayerEmpty(b){return b?!b.GetInstanceCount():!1},LayerCmpOpacity(b,d,c){return b?e.compare(100*b.GetOpacity(),d,c):!1},OnImageLoadingComplete(){return!0},IsLoadingImages(){return 0<this._imagesLoadingTotal}}}
  {"use strict";const e=self.C3;function a(g,l){const m=g[0]-l[0];return 0!==m?m:g[1]-l[1]}function b(g,l){return g[1]-l[1]}const d=[],c=[],f=e.New(e.Rect),h=e.New(e.Color);e.Plugins.System.Acts={SetVar(g,l){g.SetValue(l)},AddVar(g,l){g.IsNumber()&&"number"!==typeof l&&(l=parseFloat(l));g.SetValue(g.GetValue()+l)},SubVar(g,l){g.IsNumber()&&g.SetValue(g.GetValue()-l)},SetBoolVar(g,l){g.SetValue(!!l)},ToggleBoolVar(g){g.SetValue(!g.GetValue())},ResetGlobals(){this._runtime.GetEventSheetManager().ResetAllGlobalsToInitialValue()},CreateObject(g,l,m,u,x){g&&l&&(m=this._runtime.CreateInstance(g,l,m,u,x))&&(x&&l.SortAndAddInstancesByZIndex(m),l=this._runtime.GetEventSheetManager(),l.BlockFlushingInstances(!0),m._TriggerOnCreatedOnSelfAndRelated(),l.BlockFlushingInstances(!1),g.GetCurrentSol().SetSinglePicked(m),m.IsInContainer()&&m.SetSiblingsSinglePicked())},CreateObjectByName(g,l,m,u,x){g&&l&&(g=this._runtime.GetObjectClassByName(g))&&e.Plugins.System.Acts.CreateObject.call(this,g,l,m,u,x)},RecreateInitialObjects(g,l,m,u,x,n,q,t,r,w){if(g){var y=this._runtime.GetCurrentLayout();if(n&&(y=this._runtime.GetLayoutManager().GetLayoutByName(n),!y))return;n=null;if("number"!==typeof q||0<=q)if(n=y.GetLayer(q),!n)return;f.set(l,m,u,x);l=y.RecreateInitialObjects(g,f,n,t,r,w);g.GetCurrentSol().SetArrayPicked(l);g.ApplySolToContainer()}},StopLoop(){const g=this._loopStack;g.IsInLoop()&&g.GetCurrent().Stop()},SetGroupActive(g,l){(g=this._runtime.GetEventSheetManager().GetEventGroupByName(g))&&(0===l?g.SetGroupActive(!1):1===l?g.SetGroupActive(!0):g.SetGroupActive(!g.IsGroupActive()))},SetTimescale(g){this._runtime.SetTimeScale(g)},SetObjectTimescale(g,l){0>l&&(l=0);if(g){g=g.GetCurrentSol().GetInstances();for(const m of g)m.SetTimeScale(l)}},RestoreObjectTimescale(g){if(g){g=g.GetCurrentSol().GetInstances();for(const l of g)l.RestoreTimeScale()}},Wait(g){if(!(0>g))return this._runtime.GetEventSheetManager().AddScheduledWait().InitTimer(g),!0},WaitForSignal(g){this._runtime.GetEventSheetManager().AddScheduledWait().InitSignal(g);return!0},WaitForPreviousActions(){const g=this._runtime.GetEventSheetManager();g.AddScheduledWait().InitPromise(g.GetPromiseForAllAsyncActions());return!0},Signal(g){g=g.toLowerCase();for(const l of this._runtime.GetEventSheetManager().scheduledWaits())l.IsSignal()&&l.GetSignalTag()===g&&l.SetSignalled()},async SnapshotCanvas(g,l,m,u,x,n){const q=this._runtime.GetCanvasManager();q&&(this.UpdateRender(),await q.SnapshotCanvas(0===g?"image/png":"image/jpeg",l/100,m,u,x,n),await this._runtime.TriggerAsync(e.Plugins.System.Cnds.OnCanvasSnapshot,null))},SetCanvasSize(g,l){if(!(0>=g||0>=l)){this._runtime.SetViewportSize(g,l);var m=this._runtime.GetCurrentLayout();m.BoundScrolling();for(const u of m.GetLayers())u.UpdateViewport();if(m=this._runtime.GetCanvasManager())"off"!==m.GetCurrentFullscreenMode()&&this._runtime.SetOriginalViewportSize(g,l),m.SetSize(m.GetLastWidth(),m.GetLastHeight(),!0),this._runtime.UpdateRender()}},SetFullscreenQuality(g){const l=this._runtime.GetCanvasManager();l&&"off"!==l.GetCurrentFullscreenMode()&&(l.SetFullscreenScalingQuality(0!==g?"high":"low"),l.SetSize(l.GetLastWidth(),l.GetLastHeight(),!0))},SaveState(g){this._runtime.SaveToSlot(g)},LoadState(g){this._runtime.LoadFromSlot(g)},LoadStateJSON(g){this._runtime.LoadFromJsonString(g)},SetHalfFramerateMode(g){},ResetPersisted(){for(const g of this._runtime.GetLayoutManager().GetAllLayouts())g.ResetPersistData()},SetPixelRounding(g){this._runtime.SetPixelRoundingEnabled(0!==g)},SetMinimumFramerate(g){this._runtime.SetMinimumFramerate(g)},SortZOrderByInstVar(g,l){if(g){var m=g.GetCurrentSol().GetInstances(),u=this._runtime.GetCurrentLayout(),x=g.IsFamily();g=g.GetFamilyIndex();for(let q=0,t=m.length;q<t;++q){var n=m[q];const r=n.GetWorldInfo();if(!r)continue;let w;w=x?n.GetInstanceVariableValue(l+n.GetObjectClass().GetFamilyInstanceVariableOffset(g)):n.GetInstanceVariableValue(l);d.push([r.GetLayer().GetIndex(),r.GetZIndex()]);c.push([n,w])}if(d.length){d.sort(a);c.sort(b);l=!1;for(let q=0,t=d.length;q<t;++q)m=c[q][0],x=u.GetLayerByIndex(d[q][0]),g=d[q][1],n=x._GetInstances(),n[g]!==m&&(n[g]=m,m.GetWorldInfo()._SetLayer(x),x.SetZIndicesChanged(),l=!0);l&&this._runtime.UpdateRender();e.clearArray(d);e.clearArray(c)}}},GoToLayout(g){if(!this._runtime.IsLoading()){var l=this._runtime.GetLayoutManager();l.IsPendingChangeMainLayout()||l.ChangeMainLayout(g)}},GoToLayoutByName(g){if(!this._runtime.IsLoading()){var l=this._runtime.GetLayoutManager();l.IsPendingChangeMainLayout()||(g=l.GetLayoutByName(g))&&l.ChangeMainLayout(g)}},NextPrevLayout(g){if(!this._runtime.IsLoading()){var l=this._runtime.GetLayoutManager();if(!l.IsPendingChangeMainLayout()){var m=l.GetAllLayouts(),u=m.indexOf(l.GetMainRunningLayout());g&&0===u||(g||u!==m.length-1)&&l.ChangeMainLayout(m[u+(g?-1:1)])}}},RestartLayout(){if(!this._runtime.IsLoading()){var g=this._runtime.GetLayoutManager();g.IsPendingChangeMainLayout()||(g.ChangeMainLayout(g.GetMainRunningLayout()),this._runtime.GetEventSheetManager().ResetAllGroupsInitialActivation())}},SetLayerVisible(g,l){g&&g.SetVisible(l)},SetLayerOpacity(g,l){g&&g.SetOpacity(l/100)},SetLayerScale(g,l){g&&g.SetOwnScale(l)},SetLayerScaleRate(g,l){g&&g.SetScaleRate(l)},SetLayerAngle(g,l){g&&g.SetAngle(e.toRadians(+l))},SetLayerScroll(g,l,m){g&&(g.SetOwnScrollPositionEnabled(!0),g.SetScrollX(l),g.SetScrollY(m))},RestoreLayerScroll(g){g&&g.SetOwnScrollPositionEnabled(!1)},SetLayerParallax(g,l,m){g&&g.SetParallax(l/100,m/100)},SetLayerZElevation(g,l){g&&g.SetZElevation(+l)},SetLayerBackground(g,l){g&&(h.setFromRgbValue(l),h.clamp(),g=g.GetBackgroundColor(),g.equalsIgnoringAlpha(h)||(g.copyRgb(h),this.UpdateRender()))},SetLayerTransparent(g,l){g&&g.SetTransparent(l)},SetLayerBlendMode(g,l){g&&g.SetBlendMode(l)},SetLayerEffectEnabled(g,l,m){g&&(g=g.GetEffectList(),m=g.GetEffectTypeByName(m))&&(l=1===l,m.IsActive()!==l&&(m.SetActive(l),g.UpdateActiveEffects(),this._runtime.UpdateRender()))},SetLayerEffectParam(g,l,m,u){if(g&&(g=g.GetEffectList(),l=g.GetEffectTypeByName(l))){var x=l.GetIndex();g=g.GetEffectParametersForIndex(x);m=Math.floor(m);if(!(0>m||m>=g.length)){x=l.GetShaderProgram().GetParameterType(m);if("color"===x){h.setFromRgbValue(u);m=g[m];if(h.equalsIgnoringAlpha(m))return;m.copyRgb(h)}else{"percent"===x&&(u/=100);if(g[m]===u)return;g[m]=u}l.IsActive()&&this._runtime.UpdateRender()}}},SetLayerForceOwnTexture(g,l){g&&g.SetForceOwnTexture(l)},SetLayoutScale(g){this._runtime.GetCurrentLayout().SetScale(+g)},SetLayoutAngle(g){this._runtime.GetCurrentLayout().SetAngle(e.toRadians(+g))},SetLayoutEffectEnabled(g,l){const m=this._runtime.GetCurrentLayout().GetEffectList();if(l=m.GetEffectTypeByName(l))g=1===g,l.IsActive()!==g&&(l.SetActive(g),m.UpdateActiveEffects(),this._runtime.UpdateRender())},SetLayoutEffectParam(g,l,m){var u=this._runtime.GetCurrentLayout().GetEffectList();if(g=u.GetEffectTypeByName(g)){var x=g.GetIndex();u=u.GetEffectParametersForIndex(x);l=Math.floor(l);if(!(0>l||l>=u.length)){x=g.GetShaderProgram().GetParameterType(l);if("color"===x){h.setFromRgbValue(m);l=u[l];if(h.equalsIgnoringAlpha(l))return;l.copyRgb(h)}else{"percent"===x&&(m/=100);if(u[l]===m)return;u[l]=m}g.IsActive()&&this._runtime.UpdateRender()}}},SetLayoutVanishingPoint(g,l){this._runtime.GetCurrentLayout().SetVanishingPointXY(g/100,l/100)},SetLayoutProjection(g){const l=this._runtime.GetCurrentLayout();0===g?l.SetPerspectiveProjection():l.SetOrthographicProjection()},ScrollX(g){this._runtime.GetCurrentLayout().SetScrollX(g)},ScrollY(g){this._runtime.GetCurrentLayout().SetScrollY(g)},Scroll(g,l){const m=this._runtime.GetCurrentLayout();m.SetScrollX(g);m.SetScrollY(l)},ScrollToObject(g){if(g&&(g=g.GetFirstPicked())&&(g=g.GetWorldInfo())){var l=this._runtime.GetCurrentLayout();l.SetScrollX(g.GetX());l.SetScrollY(g.GetY())}},async LoadObjectTextures(g){const l=this._runtime.GetMainRunningLayout();l&&g&&!this._runtime.IsLoading()&&(g=g.IsFamily()?g.GetFamilyMembers():[g],await this._LoadTexturesForObjectClasses(l,g))},async LoadObjectTexturesByName(g){await e.Plugins.System.Acts.LoadObjectTextures.call(this,this._runtime.GetObjectClassByName(g))},UnloadObjectTextures(g){const l=this._runtime.GetMainRunningLayout();l&&g&&(g=g.IsFamily()?g.GetFamilyMembers():[g],this._UnloadTexturesForObjectClasses(l,g))},UnloadObjectTexturesByName(g){e.Plugins.System.Acts.UnloadObjectTexturesByName.call(this,this._runtime.GetObjectClassByName(g))},UnloadUnusedTextures(){const g=this._runtime.GetMainRunningLayout();if(g){var l=g._GetTextureLoadedObjectTypes();this._UnloadTexturesForObjectClasses(g,l)}},async LoadLayoutTextures(g){const l=this._runtime.GetMainRunningLayout();g&&l&&!this._runtime.IsLoading()&&await this._LoadTexturesForObjectClasses(l,g._GetInitialObjectClasses())},async LoadLayoutTexturesByName(g){const l=this._runtime.GetMainRunningLayout();(g=this._runtime.GetLayoutManager().GetLayoutByName(g))&&l&&!this._runtime.IsLoading()&&await this._LoadTexturesForObjectClasses(l,g._GetInitialObjectClasses())},SetFunctionReturnValue(g){const l=this._eventStack.GetCurrentExpFuncStackFrame();if(l)switch(l.GetFunctionReturnType()){case 1:"number"===typeof g&&l.SetFunctionReturnValue(g);break;case 2:"string"===typeof g&&l.SetFunctionReturnValue(g);break;case 3:l.SetFunctionReturnValue(g)}},MapFunction(g,l,m){var u=this._GetFunctionMap(g.toLowerCase(),!0);const x=u.strMap,n=l.toLowerCase();x.has(n)&&console.warn(`[Construct 3] Function map '${g}' string '${l}' already in map; overwriting entry`);if(u=e.first(x.values())||u.defaultFunc){u=0!==u.GetReturnType();const q=0!==m.GetReturnType();if(u!==q){console.error(`[Construct 3] Function map '${g}' string '${l}' function return type not compatible with other functions in the map; entry ignored`);return}}x.set(n,m)},MapFunctionDefault(g,l){const m=this._GetFunctionMap(g.toLowerCase(),!0);m.defaultFunc&&console.warn(`[Construct 3] Function map '${g}' already has a default; overwriting entry`);var u=e.first(m.strMap.values())||m.defaultFunc;if(u){u=0!==u.GetReturnType();const x=0!==l.GetReturnType();if(u!==x){console.error(`[Construct 3] Function map '${g}' default: function return type not compatible with other functions in the map; entry ignored`);return}}m.defaultFunc=l},CallMappedFunction(g,l,m){m=Math.floor(m);var u=this._GetFunctionMap(g.toLowerCase(),!1);if(u){var x=u.strMap.get(l.toLowerCase());if(!x)if(u.defaultFunc)x=u.defaultFunc,m=0;else{console.warn(`[Construct 3] Call mapped function: no function associated with map '${g}' string '${l}'; call ignored (consider setting a default)`);return}if(x.IsEnabled())if(0!==x.GetReturnType())console.warn(`[Construct 3] Call mapped function: map '${g}' string '${l}' has a return type so cannot be called`);else{g=this._runtime;l=g.GetEventSheetManager();var n=l.GetCurrentEvent();u=n.GetSolModifiersIncludingParents();var q=0<u.length;q&&l.PushCleanSol(u);var t=[];if(n=l.FindFirstFunctionBlockParent(n)){n=n.GetFunctionParameters();for(let r=m,w=n.length;r<w;++r)t.push(n[r].GetValue())}m=x.GetFunctionParameters();for(let r=t.length,w=m.length;r<w;++r)t.push(m[r].GetInitialValue());return g.IsDebugging()?this._DebugDoCallMappedFunction(l,x,t,q,u):this._DoCallMappedFunction(l,x,t,q,u)}}else console.warn(`[Construct 3] Call mapped function: map name '${g}' not found; call ignored`)}}}
  {"use strict";const e=self.C3;e.Plugins.System.Exps={int:function(a){"string"===typeof a&&(a=parseInt(a,10),isNaN(a)&&(a=0));return Math.floor(a)},float:function(a){"string"===typeof a&&(a=parseFloat(a),isNaN(a)&&(a=0));return a},str(a){return a.toString()},len(a){return"string"===typeof a?a.length:0},random(a,b){return"undefined"===typeof b?this._runtime.Random()*a:this._runtime.Random()*(b-a)+a},choose(...a){const b=Math.floor(this._runtime.Random()*a.length);return a[b]},pi(){return Math.PI},infinity(){return Infinity},sqrt(a){return Math.sqrt(a)},abs(a){return Math.abs(a)},round(a){return Math.round(a)},roundtodp(a,b){b=Math.max(Math.floor(b),0);b=Math.pow(10,b);return Math.round((a+Number.EPSILON)*b)/b},floor(a){return Math.floor(a)},ceil(a){return Math.ceil(a)},sign(a){return Math.sign(a)},sin(a){return Math.sin(e.toRadians(a))},cos(a){return Math.cos(e.toRadians(a))},tan(a){return Math.tan(e.toRadians(a))},asin(a){return e.toDegrees(Math.asin(a))},acos(a){return e.toDegrees(Math.acos(a))},atan(a){return e.toDegrees(Math.atan(a))},exp(a){return Math.exp(a)},ln(a){return Math.log(a)},log10(a){return Math.log(a)/Math.LN10},max(...a){let b=a[0];"number"!==typeof b&&(b=0);for(let d=1,c=a.length;d<c;++d){let f=a[d];"number"===typeof f&&b<f&&(b=f)}return b},min(...a){let b=a[0];"number"!==typeof b&&(b=0);for(let d=1,c=a.length;d<c;++d){let f=a[d];"number"===typeof f&&b>f&&(b=f)}return b},clamp(a,b,d){return e.clamp(a,b,d)},distance(a,b,d,c){return e.distanceTo(a,b,d,c)},angle(a,b,d,c){return e.toDegrees(e.angleTo(a,b,d,c))},lerp(a,b,d){return e.lerp(a,b,d)},unlerp(a,b,d){return e.unlerp(a,b,d)},qarp(a,b,d,c){return e.qarp(a,b,d,c)},cubic(a,b,d,c,f){return e.cubic(a,b,d,c,f)},cosp(a,b,d){return e.cosp(a,b,d)},anglediff(a,b){return e.toDegrees(e.angleDiff(e.toRadians(a),e.toRadians(b)))},anglelerp(a,b,d){return e.toDegrees(e.angleLerp(e.toRadians(a),e.toRadians(b),d))},anglerotate(a,b,d){return e.toDegrees(e.angleRotate(e.toRadians(a),e.toRadians(b),e.toRadians(d)))},setbit(a,b,d){b|=0;return(a|0)&~(1<<b)|(0!==d?1:0)<<b},togglebit(a,b){return(a|0)^1<<(b|0)},getbit(a,b){return(a|0)&1<<(b|0)?1:0},newline(){return"\n"},uppercase(a){return"string"===typeof a?a.toUpperCase():""},lowercase(a){return"string"===typeof a?a.toLowerCase():""},left(a,b){return"string"===typeof a?a.substr(0,b):""},mid(a,b,d){return"string"!==typeof a?"":0>d?a.substr(b):a.substr(b,d)},right(a,b){return"string"===typeof a?a.substr(a.length-b):""},trim(a){return"string"===typeof a?a.trim():""},tokenat(a,b,d){if("string"!==typeof a||"string"!==typeof d)return"";a=a.split(d);b=Math.floor(b);return 0>b||b>=a.length?"":a[b]},tokencount(a,b){return"string"===typeof a&&"string"===typeof b&&a.length?a.split(b).length:0},find(a,b){return"string"===typeof a&&"string"===typeof b?a.search(new RegExp(e.EscapeRegex(b),"i")):-1},findcase(a,b){return"string"===typeof a&&"string"===typeof b?a.search(new RegExp(e.EscapeRegex(b),"")):-1},replace(a,b,d){return"string"===typeof a&&"string"===typeof b&&"string"===typeof d?a.replace(new RegExp(e.EscapeRegex(b),"gi"),d):"string"===typeof a?a:""},regexsearch(a,b,d){b=this.GetRegex(b,d);return a?a.search(b):-1},regexreplace(a,b,d,c){b=this.GetRegex(b,d);return a?a.replace(b,c):""},regexmatchcount(a,b,d){return(a=this.GetRegexMatches(a.toString(),b,d))?a.length:0},regexmatchat(a,b,d,c){c=Math.floor(c);a=this.GetRegexMatches(a.toString(),b,d);return!a||0>c||c>=a.length?"":a[c]},zeropad(a,b){let d=0>a?"-":"";0>a&&(a=-a);d+="0".repeat(Math.max(b-a.toString().length,0));return d+a.toString()},urlencode(a){return encodeURIComponent(a)},urldecode(a){return decodeURIComponent(a)},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 e.toDegrees(this._runtime.GetCurrentLayout().GetAngle())},layoutwidth(){return this._runtime.GetCurrentLayout().GetWidth()},layoutheight(){return this._runtime.GetCurrentLayout().GetHeight()},viewportleft(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetViewport3D().getLeft():0},viewporttop(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetViewport3D().getTop():0},viewportright(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetViewport3D().getRight():0},viewportbottom(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetViewport3D().getBottom():0},viewportwidth(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetViewport3D().width():0},viewportheight(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetViewport3D().height():0},canvastolayerx(a,b,d){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.CanvasCssToLayer(b,d)[0]:0},canvastolayery(a,b,d){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.CanvasCssToLayer(b,d)[1]:0},layertocanvasx(a,b,d){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.LayerToCanvasCss(b,d)[0]:0},layertocanvasy(a,b,d){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.LayerToCanvasCss(b,d)[1]:0},layerscale(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetOwnScale():0},layerangle(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?e.toDegrees(a.GetOwnAngle()):0},layeropacity(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?100*a.GetOpacity():0},layerscalerate(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetScaleRate():0},layerscrollx(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetScrollX():0},layerscrolly(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetScrollY():0},layerparallaxx(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?100*a.GetParallaxX():0},layerparallaxy(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?100*a.GetParallaxY():0},layerzelevation(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetZElevation():0},layerindex(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetIndex():-1},canvassnapshot(){const a=this._runtime.GetCanvasManager();return a?a.GetCanvasSnapshotUrl():""},loopindex(a){const b=this._loopStack;return b.IsInLoop()?a?(a=b.FindByName(a))?a.GetIndex():0:b.GetCurrent().GetIndex():0},savestatejson(){return this._runtime.GetLastSaveJsonString()},callmapped(a,b,...d){var c=this._GetFunctionMap(a.toLowerCase(),!1);if(!c)return console.warn(`[Construct 3] Call mapped function: map name '${a}' not found; returning 0`),0;var f=c.strMap.get(b.toLowerCase());if(!f)if(c.defaultFunc)f=c.defaultFunc;else return console.warn(`[Construct 3] Call mapped function: no function associated with map '${a}' string '${b}'; returning 0 (consider setting a default)`),0;c=f.GetReturnType();const h=f.GetDefaultReturnValue();if(0===c)return console.warn(`[Construct 3] Call mapped function: map '${a}' string '${b}' has no return type so cannot be called from an expression; returning 0`),0;if(!f.IsEnabled())return h;a=this._runtime.GetEventSheetManager();b=a.GetCurrentEvent().GetSolModifiersIncludingParents();const g=0<b.length;g&&a.PushCleanSol(b);const l=f.GetFunctionParameters();for(let m=d.length,u=l.length;m<u;++m)d.push(l[m].GetInitialValue());f=f.GetEventBlock();d=f.RunAsExpressionFunctionCall(f.GetSolModifiersIncludingParents(),c,h,...d);g&&a.PopSol(b);return d},loadingprogress(){return this._runtime.GetAssetManager().GetLoadProgress()},imageloadingprogress(){return 0===this._imagesLoadingTotal?1:this._imagesLoadingComplete/this._imagesLoadingTotal},renderer(){return this._runtime.GetWebGPURenderer()?"webgpu":"webgl"},rendererdetail(){return this._runtime.GetWebGPURenderer()?"<unavailable>":this._runtime.GetWebGLRenderer().GetUnmaskedRenderer()},imagememoryusage(){let a=this._runtime.GetRenderer().GetEstimatedTextureMemoryUsage();return Math.round(100*a/1048576)/100},rgb(a,b,d){return e.PackRGB(a,b,d)},rgbex(a,b,d){return e.PackRGBEx(a/100,b/100,d/100)},rgba(a,b,d,c){return e.PackRGBAEx(a/100,b/100,d/100,c/100)},rgbex255(a,b,d){return e.PackRGBEx(a/255,b/255,d/255)},rgba255(a,b,d,c){return e.PackRGBAEx(a/255,b/255,d/255,c/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 e=self.C3;e.Plugins.Sprite=class extends e.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}}}
  {"use strict";const e=self.C3;e.Plugins.Sprite.Type=class extends e.SDKTypeBase{constructor(a){super(a);this._animations=a.GetAnimations()}Release(){e.clearArray(this._animations);super.Release()}OnCreate(){for(const a of this._animations)a.LoadAllAssets(this._runtime)}LoadTextures(a){const b={sampling:this._runtime.GetSampling()};return Promise.all(this._animations.map(d=>d.LoadAllTextures(a,b)))}ReleaseTextures(){for(const a of this._animations)a.ReleaseAllTextures()}OnDynamicTextureLoadComplete(){this._UpdateAllCurrentTexture()}_UpdateAllCurrentTexture(){for(const a of this._objectClass.instancesIncludingPendingCreate())a.GetSdkInstance()._UpdateCurrentTexture()}FinishCondition(a){e.Plugins.Sprite.FinishCollisionCondition(this,a)}}}
  {"use strict";const e=self.C3,a=self.C3X,b=e.New(e.Rect),d=e.New(e.Quad),c=e.New(e.Vector2);e.Plugins.Sprite.Instance=class extends e.SDKWorldInstanceBase{constructor(g,l){super(g);let m=!0,u="",x=0,n=!0;l&&(m=!!l[0],u=l[1],x=l[2],n=l[3]);this._currentAnimation=this._objectClass.GetAnimationByName(u)||this._objectClass.GetAnimations()[0];this._currentFrameIndex=e.clamp(x,0,this._currentAnimation.GetFrameCount()-1);this._currentAnimationFrame=this._currentAnimation.GetFrameAt(this._currentFrameIndex);l=this._currentAnimationFrame.GetImageInfo();this._currentTexture=l.GetTexture();this._currentRcTex=l.GetTexRect();this._currentQuadTex=l.GetTexQuad();this.HandleWebGLContextLoss();g.SetFlag(2,!0);g.SetFlag(1,0<=this._currentAnimation.GetSpeed());this._currentAnimationSpeed=Math.abs(this._currentAnimation.GetSpeed());this._currentAnimationRepeatTo=this._currentAnimation.GetRepeatTo();this._animationTimer=e.New(e.KahanSum);this._animationRepeats=this._frameStartTime=0;this._animTriggerName="";this._changeAnimFrameIndex=-1;this._changeAnimationName="";this._changeAnimationFrom=0;g=this.GetWorldInfo();this._bquadRef=g.GetBoundingQuad();g.SetVisible(m);g.SetCollisionEnabled(n);g.SetOriginX(this._currentAnimationFrame.GetOriginX());g.SetOriginY(this._currentAnimationFrame.GetOriginY());g.SetSourceCollisionPoly(this._currentAnimationFrame.GetCollisionPoly());g.SetBboxChanged();1===this._objectClass.GetAnimationCount()&&1===this._objectClass.GetAnimations()[0].GetFrameCount()||0===this._currentAnimationSpeed||this._StartTicking()}Release(){this._animationTimer=this._currentTexture=this._currentAnimationFrame=this._currentAnimation=null;super.Release()}GetCurrentImageInfo(){return this._currentAnimationFrame.GetImageInfo()}IsOriginalSizeKnown(){return!0}OnWebGLContextLost(){this._currentTexture=null}OnWebGLContextRestored(){this._UpdateCurrentTexture()}Draw(g){var l=this._currentTexture;null!==l&&(g.SetTexture(l),l=this.GetWorldInfo(),l.HasMesh()?this._DrawMesh(l,g):this._DrawStandard(l,g))}_DrawStandard(g,l){let m=this._bquadRef;this._runtime.IsPixelRoundingEnabled()&&(m=g.PixelRoundQuad(m));l.Quad4(m,this._currentQuadTex)}_DrawMesh(g,l){const m=g.GetTransformedMesh();if(g.IsMeshChanged()){g.CalculateBbox(b,d,!1);let u=d;this._runtime.IsPixelRoundingEnabled()&&(u=g.PixelRoundQuad(u));m.CalculateTransformedMesh(g.GetSourceMesh(),u,this._currentQuadTex);g.SetMeshChanged(!1)}m.Draw(l)}GetAnimationTime(){return this._animationTimer.Get()}IsAnimationPlaying(){return this._inst.GetFlag(2)}SetAnimationPlaying(g){this._inst.SetFlag(2,g)}IsPlayingForwards(){return this._inst.GetFlag(1)}SetPlayingForwards(g){this._inst.SetFlag(1,g)}IsInAnimationTrigger(){return this._inst.GetFlag(4)}SetInAnimationTrigger(g){this._inst.SetFlag(4,g)}Tick(){this._changeAnimationName&&this._DoChangeAnimation();0<=this._changeAnimFrameIndex&&this._DoChangeAnimFrame();const g=this._currentAnimationSpeed;if(this.IsAnimationPlaying()&&0!==g){var l=this._runtime.GetDt(this._inst);this._animationTimer.Add(l);l=this.GetAnimationTime();var m=this._currentAnimationFrame,u=m.GetDuration()/g;if(!(l<this._frameStartTime+u)){var x=this._currentAnimation,n=this._currentAnimationRepeatTo,q=x.GetFrameCount(),t=x.GetRepeatCount(),r=x.IsLooping(),w=x.IsPingPong();this.IsPlayingForwards()?this._currentFrameIndex++:this._currentFrameIndex--;this._frameStartTime+=u;this._currentFrameIndex>=q&&(w?(this.SetPlayingForwards(!1),this._currentFrameIndex=q-2):r?this._currentFrameIndex=n:(this._animationRepeats++,this._animationRepeats>=t?this._FinishAnimation(!1):this._currentFrameIndex=n));0>this._currentFrameIndex&&(w?(this._currentFrameIndex=1,this.SetPlayingForwards(!0),r||(this._animationRepeats++,this._animationRepeats>=t&&this._FinishAnimation(!0))):r?this._currentFrameIndex=n:(this._animationRepeats++,this._animationRepeats>=t?this._FinishAnimation(!0):this._currentFrameIndex=n));this._currentFrameIndex=e.clamp(this._currentFrameIndex,0,q-1);u=x.GetFrameAt(this._currentFrameIndex);l>this._frameStartTime+u.GetDuration()/g&&(this._frameStartTime=l);this._OnFrameChanged(m,u)}}else this._StopTicking()}_FinishAnimation(g){this._currentFrameIndex=g?0:this._currentAnimation.GetFrameCount()-
  1;this.SetAnimationPlaying(!1);this._animTriggerName=this._currentAnimation.GetName();this.SetInAnimationTrigger(!0);this.Trigger(e.Plugins.Sprite.Cnds.OnAnyAnimFinished);this.Trigger(e.Plugins.Sprite.Cnds.OnAnimFinished);this.SetInAnimationTrigger(!1);this._animationRepeats=0}_OnFrameChanged(g,l){if(g!==l){var m=this.GetWorldInfo(),u=g.GetImageInfo(),x=l.GetImageInfo(),n=u.GetWidth();u=u.GetHeight();var q=x.GetWidth(),t=x.GetHeight();n!==q&&m.SetWidth(m.GetWidth()*(q/n));u!==t&&m.SetHeight(m.GetHeight()*(t/u));m.SetOriginX(l.GetOriginX());m.SetOriginY(l.GetOriginY());m.SetSourceCollisionPoly(l.GetCollisionPoly());m.SetBboxChanged();this._currentAnimationFrame=l;this._currentTexture=x.GetTexture();this._currentRcTex=x.GetTexRect();this._currentQuadTex=x.GetTexQuad();m=this.GetInstance().GetBehaviorInstances();for(let r=0,w=m.length;r<w;++r)m[r].OnSpriteFrameChanged(g,l);this.Trigger(e.Plugins.Sprite.Cnds.OnFrameChanged);this._runtime.UpdateRender()}}_StartAnim(g){this.SetAnimationPlaying(!0);this._frameStartTime=this.GetAnimationTime();1===g&&0!==this._currentFrameIndex&&(this._changeAnimFrameIndex=0,this.IsInAnimationTrigger()||this._DoChangeAnimFrame());this._StartTicking()}_SetAnim(g,l){this._changeAnimationName=g;this._changeAnimationFrom=l;this._StartTicking();this.IsInAnimationTrigger()||this._DoChangeAnimation()}_GetCurrentAnimationName(){return this._changeAnimationName?this._changeAnimationName:this._currentAnimation.GetName()}_SetAnimFrame(g){isFinite(g)&&(this._changeAnimFrameIndex=g,this.IsInAnimationTrigger()||this._DoChangeAnimFrame())}_GetAnimFrame(){return this._currentFrameIndex}_SetAnimSpeed(g){this._currentAnimationSpeed=Math.abs(g);this.SetPlayingForwards(0<=g);0<this._currentAnimationSpeed&&this._StartTicking()}_GetAnimSpeed(){return this.IsPlayingForwards()?this._currentAnimationSpeed:-this._currentAnimationSpeed}_SetAnimRepeatToFrame(g){this._currentAnimationRepeatTo=g=e.clamp(Math.floor(g),0,this._currentAnimation.GetFrameCount()-1)}_GetAnimRepeatToFrame(){return this._currentAnimationRepeatTo}_DoChangeAnimation(){const g=this._currentAnimationFrame;var l=this._objectClass.GetAnimationByName(this._changeAnimationName);this._changeAnimationName="";!l||l===this._currentAnimation&&this.IsAnimationPlaying()||(this._currentAnimation=l,this.SetPlayingForwards(0<=l.GetSpeed()),this._currentAnimationSpeed=Math.abs(l.GetSpeed()),this._currentAnimationRepeatTo=l.GetRepeatTo(),this._currentFrameIndex=e.clamp(this._currentFrameIndex,0,this._currentAnimation.GetFrameCount()-1),1===this._changeAnimationFrom&&(this._currentFrameIndex=0),this.SetAnimationPlaying(!0),this._frameStartTime=this.GetAnimationTime(),l=this._currentAnimation.GetFrameAt(this._currentFrameIndex),this._OnFrameChanged(g,l))}_DoChangeAnimFrame(){const g=this._currentAnimationFrame;var l=this._currentFrameIndex;this._currentFrameIndex=e.clamp(Math.floor(this._changeAnimFrameIndex),0,this._currentAnimation.GetFrameCount()-1);this._changeAnimFrameIndex=-1;l!==this._currentFrameIndex&&(l=this._currentAnimation.GetFrameAt(this._currentFrameIndex),this._OnFrameChanged(g,l),this._frameStartTime=this.GetAnimationTime())}_UpdateCurrentTexture(){const g=this._currentAnimationFrame.GetImageInfo();this._currentTexture=g.GetTexture();this._currentRcTex=g.GetTexRect();this._currentQuadTex=g.GetTexQuad();this.GetWorldInfo().SetMeshChanged(!0)}GetTexture(){return this._currentTexture}GetTexRect(){return this._currentRcTex}GetTexQuad(){return this._currentQuadTex}GetImagePointCount(){return this._currentAnimationFrame.GetImagePointCount()}GetImagePoint(g){const l=this._currentAnimationFrame,m=this.GetWorldInfo();if("string"===typeof g)g=l.GetImagePointByName(g);else if("number"===typeof g)g=l.GetImagePointByIndex(g-1);else throw new TypeError("expected string or number");if(!g)return[m.GetX(),m.GetY()];c.copy(g.GetVec2());if(m.HasMesh()){const[u,x]=m.GetSourceMesh().TransformPoint(c.getX(),c.getY());c.set(u,x)}c.offset(-l.GetOriginX(),-l.GetOriginY());c.scale(m.GetWidth(),m.GetHeight());c.rotate(m.GetAngle());c.offset(m.GetX(),m.GetY());return[c.getX(),c.getY()]}GetCollisionPolyPointCount(){return this.GetWorldInfo().GetTransformedCollisionPoly().pointCount()}GetCollisionPolyPoint(g){g=Math.floor(g);const l=this.GetWorldInfo();var m=l.GetTransformedCollisionPoly();const u=m.pointCount();g===u&&(g=0);if(0>g||g>=u)return[0,0];m=m.pointsArr();return[m[2*g]+l.GetX(),m[2*g+1]+l.GetY()]}GetDebuggerProperties(){const g=e.Plugins.Sprite.Acts;return[{title:"plugins.sprite.debugger.animation-properties.title",properties:[{name:"plugins.sprite.debugger.animation-properties.current-animation",value:this._currentAnimation.GetName(),onedit:l=>this.CallAction(g.SetAnim,l,0)},{name:"plugins.sprite.debugger.animation-properties.current-frame",value:this._currentFrameIndex,onedit:l=>this.CallAction(g.SetAnimFrame,l)},{name:"plugins.sprite.debugger.animation-properties.is-playing",value:this.IsAnimationPlaying(),onedit:l=>l?this.CallAction(g.StartAnim,0):this.CallAction(g.StopAnim)},{name:"plugins.sprite.debugger.animation-properties.speed",value:this._currentAnimationSpeed,onedit:l=>this.CallAction(g.SetAnimSpeed,l)},{name:"plugins.sprite.debugger.animation-properties.repeats",value:this._animationRepeats,onedit:l=>this._animationRepeats=l}]}]}SaveToJson(){const g={a:this._currentAnimation.GetSID()};0!==this._frameStartTime&&(g.fs=this._frameStartTime);var l=this.GetAnimationTime();0!==l&&(g.at=l);0!==this._currentFrameIndex&&(g.f=this._currentFrameIndex);0!==this._currentAnimationSpeed&&(g.cas=this._currentAnimationSpeed);1!==this._animationRepeats&&(g.ar=this._animationRepeats);0!==this._currentAnimationRepeatTo&&(g.rt=this._currentAnimationRepeatTo);this.IsAnimationPlaying()||(g.ap=this.IsAnimationPlaying());this.IsPlayingForwards()||(g.af=this.IsPlayingForwards());l=this.GetWorldInfo();l.IsCollisionEnabled()&&(g.ce=l.IsCollisionEnabled());return g}LoadFromJson(g){var l=this.GetObjectClass().GetAnimationBySID(g.a);l&&(this._currentAnimation=l);this._frameStartTime=g.hasOwnProperty("fs")?g.fs:0;this._animationTimer.Set(g.hasOwnProperty("at")?g.at:0);l=g.hasOwnProperty("f")?g.f:0;this._currentFrameIndex=e.clamp(l,0,this._currentAnimation.GetFrameCount()-1);this._currentAnimationSpeed=g.hasOwnProperty("cas")?g.cas:0;this._animationRepeats=g.hasOwnProperty("ar")?g.ar:1;l=g.hasOwnProperty("rt")?g.rt:0;this._currentAnimationRepeatTo=e.clamp(l,0,this._currentAnimation.GetFrameCount()-1);this.SetAnimationPlaying(g.hasOwnProperty("ap")?!!g.ap:!0);this.SetPlayingForwards(g.hasOwnProperty("af")?!!g.af:!0);this._currentAnimationFrame=l=this._currentAnimation.GetFrameAt(this._currentFrameIndex);this._UpdateCurrentTexture();const m=this.GetWorldInfo();m.SetOriginX(l.GetOriginX());m.SetOriginY(l.GetOriginY());m.SetSourceCollisionPoly(l.GetCollisionPoly());m.SetCollisionEnabled(!!g.ce)}GetPropertyValueByIndex(g){const l=this.GetWorldInfo();switch(g){case 3:return l.IsCollisionEnabled();case 2:return e.clamp(this._currentFrameIndex,0,this._currentAnimation.GetFrameCount()-1)}}SetPropertyValueByIndex(g,l){var m=this.GetWorldInfo();switch(g){case 3:m.SetCollisionEnabled(!!l);break;case 2:this.SetAnimationPlaying(!1);g=this._currentAnimation.GetFrameCount()-1;m=l=e.clamp(l,0,g);l=this._currentAnimation.GetFrameAt(this._currentFrameIndex);const u=this._currentAnimation.GetFrameAt(m);this._OnFrameChanged(l,u);this._currentFrameIndex=e.clamp(m,0,g)}}GetScriptInterfaceClass(){return self.ISpriteInstance}};const f=new WeakMap,h=new Map([["current-frame",0],["beginning",1]]);self.ISpriteInstance=class extends self.IWorldInstance{constructor(){super();f.set(this,self.IInstance._GetInitInst().GetSdkInstance())}getImagePointCount(){return f.get(this).GetImagePointCount()}getImagePointX(g){if("string"!==typeof g&&"number"!==typeof g)throw new TypeError("expected string or number");return f.get(this).GetImagePoint(g)[0]}getImagePointY(g){if("string"!==typeof g&&"number"!==typeof g)throw new TypeError("expected string or number");return f.get(this).GetImagePoint(g)[1]}getImagePoint(g){if("string"!==typeof g&&"number"!==typeof g)throw new TypeError("expected string or number");return f.get(this).GetImagePoint(g)}getPolyPointCount(){return f.get(this).GetCollisionPolyPointCount()}getPolyPointX(g){a.RequireFiniteNumber(g);return f.get(this).GetCollisionPolyPoint(g)[0]}getPolyPointY(g){a.RequireFiniteNumber(g);return f.get(this).GetCollisionPolyPoint(g)[1]}getPolyPoint(g){a.RequireFiniteNumber(g);return f.get(this).GetCollisionPolyPoint(g)}stopAnimation(){f.get(this).SetAnimationPlaying(!1)}startAnimation(g="current-frame"){a.RequireString(g);g=h.get(g);if("undefined"===typeof g)throw Error("invalid mode");f.get(this)._StartAnim(g)}setAnimation(g,l="beginning"){a.RequireString(g);a.RequireString(l);l=h.get(l);if("undefined"===typeof l)throw Error("invalid mode");f.get(this)._SetAnim(g,l)}get animationName(){return f.get(this)._GetCurrentAnimationName()}set animationFrame(g){a.RequireFiniteNumber(g);f.get(this)._SetAnimFrame(g)}get animationFrame(){return f.get(this)._GetAnimFrame()}set animationSpeed(g){a.RequireFiniteNumber(g);f.get(this)._SetAnimSpeed(g)}get animationSpeed(){return f.get(this)._GetAnimSpeed()}set animationRepeatToFrame(g){a.RequireFiniteNumber(g);f.get(this)._SetAnimRepeatToFrame(g)}get animationRepeatToFrame(){return f.get(this)._GetAnimRepeatToFrame()}get imageWidth(){return f.get(this).GetCurrentImageInfo().GetWidth()}get imageHeight(){return f.get(this).GetCurrentImageInfo().GetHeight()}}}
  {"use strict";const e=self.C3;e.Plugins.Sprite.Cnds={IsAnimPlaying(a){return e.equalsNoCase(this._GetCurrentAnimationName(),a)},CompareFrame(a,b){return e.compare(this._currentFrameIndex,a,b)},CompareAnimSpeed(a,b){return e.compare(this._GetAnimSpeed(),a,b)},OnAnimFinished(a){return e.equalsNoCase(this._animTriggerName,a)},OnAnyAnimFinished(){return!0},OnFrameChanged(){return!0},IsMirrored(){return 0>this.GetWorldInfo().GetWidth()},IsFlipped(){return 0>this.GetWorldInfo().GetHeight()},OnURLLoaded(){return!0},OnURLFailed(){return!0},IsCollisionEnabled(){return this.GetWorldInfo().IsCollisionEnabled()}}}
  {"use strict";const e=self.C3;e.Plugins.Sprite.Acts={Spawn(a,b,d,c){if(a&&b){var[f,h]=this.GetImagePoint(d);if(d=this._runtime.CreateInstance(a,b,f,h,c)){c&&b.SortAndAddInstancesByZIndex(d);a.GetPlugin().IsRotatable()&&(b=d.GetWorldInfo(),b.SetAngle(this.GetWorldInfo().GetAngle()),b.SetBboxChanged());b=this._runtime.GetEventSheetManager();b.BlockFlushingInstances(!0);d._TriggerOnCreatedOnSelfAndRelated();b.BlockFlushingInstances(!1);c=this._runtime.GetCurrentAction().GetSavedDataMap();b=!1;if(!c.has("Spawn_LastExec")||c.get("Spawn_LastExec")<this._runtime.GetExecCount())b=!0,c.set("Spawn_LastExec",this._runtime.GetExecCount());if(a!==this.GetObjectClass()&&(a=a.GetCurrentSol(),a._SetSelectAll(!1),a=a._GetOwnInstances(),b&&e.clearArray(a),a.push(d),d.IsInContainer()))for(const g of d.siblings())d=g.GetObjectClass().GetCurrentSol(),b?d.SetSinglePicked(g):(d._SetSelectAll(!1),d._PushInstance(g))}}},StopAnim(){this.SetAnimationPlaying(!1)},StartAnim(a){this._StartAnim(a)},SetAnim(a,b){this._SetAnim(a,b)},SetAnimFrame(a){this._SetAnimFrame(a)},SetAnimSpeed(a){this._SetAnimSpeed(a)},SetAnimRepeatToFrame(a){this._SetAnimRepeatToFrame(a)},SetMirrored(a){const b=this.GetWorldInfo(),d=b.GetWidth();a=Math.abs(d)*(0===a?-1:1);d!==a&&(b.SetWidth(a),b.SetBboxChanged())},SetFlipped(a){const b=this.GetWorldInfo(),d=b.GetHeight();a=Math.abs(d)*(0===a?-1:1);d!==a&&(b.SetHeight(a),b.SetBboxChanged())},SetScale(a){const b=this._currentAnimationFrame.GetImageInfo(),d=this.GetWorldInfo();var c=0>d.GetWidth()?-1:1;const f=0>d.GetHeight()?-1:1;c*=b.GetWidth()*a;a=b.GetHeight()*a*f;if(d.GetWidth()!==c||d.GetHeight()!==a)d.SetSize(c,a),d.SetBboxChanged()},async LoadURL(a,b,d){d=this._currentAnimationFrame.GetImageInfo();const c=this.GetWorldInfo(),f=this._runtime;if(d.GetURL()===a)0===b&&(c.SetSize(d.GetWidth(),d.GetHeight()),c.SetBboxChanged()),this.Trigger(e.Plugins.Sprite.Cnds.OnURLLoaded);else{var h=e.New(e.ImageInfo);try{await h.LoadDynamicAsset(f,a);if(!h.IsLoaded())throw Error("image failed to load");await h.LoadStaticTexture(f.GetRenderer(),{sampling:this._runtime.GetSampling()})}catch(g){console.error("Load image from URL failed: ",g);this.Trigger(e.Plugins.Sprite.Cnds.OnURLFailed);return}d.ReplaceWith(h);this._sdkType._UpdateAllCurrentTexture();this.WasReleased()||0!==b||(c.SetSize(d.GetWidth(),d.GetHeight()),c.SetBboxChanged());f.UpdateRender();this.WasReleased()||await this.TriggerAsync(e.Plugins.Sprite.Cnds.OnURLLoaded)}},SetCollisions(a){this.GetWorldInfo().SetCollisionEnabled(a)},SetSolidCollisionFilter(a,b){this.GetWorldInfo().SetSolidCollisionFilter(0===a,b)},SetEffect(a){this.GetWorldInfo().SetBlendMode(a);this._runtime.UpdateRender()}}}"use strict";self.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(e){return this.GetImagePoint(e)[0]},ImagePointY(e){return this.GetImagePoint(e)[1]},ImagePointCount(){return this.GetImagePointCount()},ImageWidth(){return this.GetCurrentImageInfo().GetWidth()},ImageHeight(){return this.GetCurrentImageInfo().GetHeight()},PolyPointXAt(e){return this.GetCollisionPolyPoint(e)[0]},PolyPointYAt(e){return this.GetCollisionPolyPoint(e)[1]},PolyPointCount(){return this.GetCollisionPolyPointCount()}};{"use strict";const e=self.C3;e.Plugins.Touch=class extends e.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}}}
  {"use strict";const e=self.C3,a=self.C3X;e.Plugins.Touch.Type=class extends e.SDKTypeBase{constructor(c){super(c)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.ITouchObjectType}};let b=null;function d(){return b.GetSingleGlobalInstance().GetSdkInstance()}self.ITouchObjectType=class extends self.IObjectClass{constructor(c){super(c);b=c;c.GetRuntime()._GetCommonScriptInterfaces().touch=this}requestPermission(c){a.RequireString(c);const f=d();if("orientation"===c)return f._RequestPermission(0);if("motion"===c)return f._RequestPermission(1);throw Error("invalid type");}}}
  {"use strict";const e=self.C3;e.Plugins.Touch.Instance=class extends e.SDKInstanceBase{constructor(a,b){super(a,"touch");this._touches=new Map;this._isMouseDown=this._useMouseInput=!1;this._getTouchIndex=this._curTouchY=this._curTouchX=this._triggerPermission=this._triggerId=this._triggerIndex=this._accWithGZ=this._accWithGY=this._accWithGX=this._accZ=this._accY=this._accX=this._orientGamma=this._orientBeta=this._orientAlpha=this._orientCompassHeading=0;this._permissionPromises=[];b&&(this._useMouseInput=b[0]);this.AddDOMMessageHandler("permission-result",d=>this._OnPermissionResult(d));a=this.GetRuntime().Dispatcher();this._disposables=new e.CompositeDisposable(e.Disposable.From(a,"pointerdown",d=>this._OnPointerDown(d.data)),e.Disposable.From(a,"pointermove",d=>this._OnPointerMove(d.data)),e.Disposable.From(a,"pointerup",d=>this._OnPointerUp(d.data,!1)),e.Disposable.From(a,"pointercancel",d=>this._OnPointerUp(d.data,!0)),e.Disposable.From(a,"deviceorientation",d=>this._OnDeviceOrientation(d.data)),e.Disposable.From(a,"deviceorientationabsolute",d=>this._OnDeviceOrientationAbsolute(d.data)),e.Disposable.From(a,"devicemotion",d=>this._OnDeviceMotion(d.data)),e.Disposable.From(a,"tick2",d=>this._OnTick2()))}Release(){this._touches.clear();super.Release()}_OnPointerDown(a){if("mouse"===a.pointerType)if(this._useMouseInput)this._isMouseDown=!0;else return;const b=a.pointerId;if(!this._touches.has(b)){var d=a.pageX-this._runtime.GetCanvasClientX();a=a.pageY-this._runtime.GetCanvasClientY();var c=performance.now(),f=this._touches.size;this._triggerIndex=f;this._triggerId=b;var h=e.New(e.Plugins.Touch.TouchInfo);h.Init(c,d,a,b,f);this._touches.set(b,h);this.Trigger(e.Plugins.Touch.Cnds.OnNthTouchStart);this.Trigger(e.Plugins.Touch.Cnds.OnTouchStart);this._curTouchX=d;this._curTouchY=a;this.Trigger(e.Plugins.Touch.Cnds.OnTouchObject)}}_OnPointerMove(a){if("mouse"!==a.pointerType||this._isMouseDown){var b=this._touches.get(a.pointerId);if(b){var d=performance.now();if(!(2>d-b.GetTime())){var c=a.pageX-this._runtime.GetCanvasClientX(),f=a.pageY-this._runtime.GetCanvasClientY();b.Update(d,c,f,a.width,a.height,a.pressure)}}}}_OnPointerUp(a,b){if("mouse"===a.pointerType)if(this._isMouseDown)this._isMouseDown=!1;else return;const d=performance.now();a=a.pointerId;const c=this._touches.get(a);c&&(this._triggerIndex=c.GetStartIndex(),this._triggerId=c.GetId(),this.Trigger(e.Plugins.Touch.Cnds.OnNthTouchEnd),this.Trigger(e.Plugins.Touch.Cnds.OnTouchEnd),b||(b=c.ShouldTriggerTap(d),"single-tap"===b?(this.Trigger(e.Plugins.Touch.Cnds.OnTapGesture),this._curTouchX=c.GetX(),this._curTouchY=c.GetY(),this.Trigger(e.Plugins.Touch.Cnds.OnTapGestureObject)):"double-tap"===b&&(this.Trigger(e.Plugins.Touch.Cnds.OnDoubleTapGesture),this._curTouchX=c.GetX(),this._curTouchY=c.GetY(),this.Trigger(e.Plugins.Touch.Cnds.OnDoubleTapGestureObject))),c.Release(),this._touches.delete(a))}_RequestPermission(a){this._PostToDOMMaybeSync("request-permission",{type:a});return new Promise((b,d)=>{this._permissionPromises.push({type:a,resolve:b,reject:d})})}_OnPermissionResult(a){const b=a.result,d=a.type;this._triggerPermission=d;a=this._permissionPromises.filter(c=>c.type===d);for(const c of a)c.resolve(b?"granted":"denied");this._permissionPromises=this._permissionPromises.filter(c=>c.type!==d);b?(this.Trigger(e.Plugins.Touch.Cnds.OnPermissionGranted),0===d?this._runtime.RequestDeviceOrientationEvent():this._runtime.RequestDeviceMotionEvent()):this.Trigger(e.Plugins.Touch.Cnds.OnPermissionDenied)}_OnDeviceOrientation(a){"number"===typeof a.webkitCompassHeading?this._orientCompassHeading=a.webkitCompassHeading:a.absolute&&(this._orientCompassHeading=a.alpha);this._orientAlpha=a.alpha;this._orientBeta=a.beta;this._orientGamma=a.gamma}_OnDeviceOrientationAbsolute(a){this._orientCompassHeading=a.alpha}_OnDeviceMotion(a){const b=a.acceleration;b&&(this._accX=b.x,this._accY=b.y,this._accZ=b.z);if(a=a.accelerationIncludingGravity)this._accWithGX=a.x,this._accWithGY=a.y,this._accWithGZ=a.z}_OnTick2(){const a=performance.now();let b=0;for(const d of this._touches.values())d.GetTime()<=a-50&&d._SetLastTime(a),d.ShouldTriggerHold(a)&&(this._triggerIndex=d.GetStartIndex(),this._triggerId=d.GetId(),this._getTouchIndex=b,this.Trigger(e.Plugins.Touch.Cnds.OnHoldGesture),this._curTouchX=d.GetX(),this._curTouchY=d.GetY(),this.Trigger(e.Plugins.Touch.Cnds.OnHoldGestureObject),this._getTouchIndex=0),++b}_GetTouchByIndex(a){a=Math.floor(a);for(const b of this._touches.values()){if(0===a)return b;--a}return null}_IsClientPosOnCanvas(a,b){return 0<=a&&0<=b&&a<this._runtime.GetCanvasCssWidth()&&b<this._runtime.GetCanvasCssHeight()}GetDebuggerProperties(){return[{title:"plugins.touch.debugger.touches",properties:[...this._touches.values()].map(a=>({name:"$"+a.GetId(),value:a.GetX()+", "+a.GetY()}))}]}}}
  {"use strict";const e=self.C3,a=[];e.Plugins.Touch.Cnds={OnTouchStart(){return!0},OnTouchEnd(){return!0},IsInTouch(){return 0<this._touches.size},OnTouchObject(b){return b&&this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY)?this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(b,this._curTouchX,this._curTouchY,!1):!1},IsTouchingObject(b){if(!b)return!1;const d=b.GetCurrentSol();var c=d.GetInstances();for(const f of c){c=f.GetWorldInfo();const h=c.GetLayer();for(const g of this._touches.values()){if(!this._IsClientPosOnCanvas(g.GetX(),g.GetY()))continue;const[l,m]=h.CanvasCssToLayer(g.GetX(),g.GetY(),c.GetTotalZElevation());if(c.ContainsPoint(l,m)){a.push(f);break}}}return a.length?(d.SetArrayPicked(a),b.ApplySolToContainer(),e.clearArray(a),!0):!1},CompareTouchSpeed(b,d,c){return(b=this._GetTouchByIndex(b))?e.compare(b.GetSpeed(),d,c):!1},OrientationSupported(){return!0},MotionSupported(){return!0},CompareOrientation(b,d,c){this._runtime.RequestDeviceOrientationEvent();return e.compare(0===b?this._orientAlpha:1===b?this._orientBeta:this._orientGamma,d,c)},CompareAcceleration(b,d,c){this._runtime.RequestDeviceMotionEvent();return e.compare(0===b?this._accWithGX:1===b?this._accWithGY:2===b?this._accWithGZ:3===b?this._accX:4===b?this._accY:this._accZ,d,c)},OnNthTouchStart(b){b=Math.floor(b);return b===this._triggerIndex},OnNthTouchEnd(b){b=Math.floor(b);return b===this._triggerIndex},HasNthTouch(b){b=Math.floor(b);return this._touches.size>=b+1},OnHoldGesture(){return!0},OnTapGesture(){return!0},OnDoubleTapGesture(){return!0},OnHoldGestureObject(b){return b&&this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY)?this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(b,this._curTouchX,this._curTouchY,!1):!1},OnTapGestureObject(b){return b&&this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY)?this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(b,this._curTouchX,this._curTouchY,!1):!1},OnDoubleTapGestureObject(b){return b&&this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY)?this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(b,this._curTouchX,this._curTouchY,!1):!1},OnPermissionGranted(b){return this._triggerPermission===b},OnPermissionDenied(b){return this._triggerPermission===b}}}"use strict";self.C3.Plugins.Touch.Acts={RequestPermission(e){this._RequestPermission(e)}};{"use strict";const e=self.C3;e.Plugins.Touch.Exps={TouchCount(){return this._touches.size},X(a){const b=this._GetTouchByIndex(this._getTouchIndex);return b?b.GetPositionForLayer(this._runtime.GetCurrentLayout(),a,!0):0},Y(a){const b=this._GetTouchByIndex(this._getTouchIndex);return b?b.GetPositionForLayer(this._runtime.GetCurrentLayout(),a,!1):0},XAt(a,b){return(a=this._GetTouchByIndex(a))?a.GetPositionForLayer(this._runtime.GetCurrentLayout(),b,!0):0},YAt(a,b){return(a=this._GetTouchByIndex(a))?a.GetPositionForLayer(this._runtime.GetCurrentLayout(),b,!1):0},XForID(a,b){return(a=this._touches.get(a))?a.GetPositionForLayer(this._runtime.GetCurrentLayout(),b,!0):0},YForID(a,b){return(a=this._touches.get(a))?a.GetPositionForLayer(this._runtime.GetCurrentLayout(),b,!1):0},AbsoluteX(){const a=this._GetTouchByIndex(0);return a?a.GetX():0},AbsoluteY(){const a=this._GetTouchByIndex(0);return a?a.GetY():0},AbsoluteXAt(a){return(a=this._GetTouchByIndex(a))?a.GetX():0},AbsoluteYAt(a){return(a=this._GetTouchByIndex(a))?a.GetY():0},AbsoluteXForID(a){return(a=this._touches.get(a))?a.GetX():0},AbsoluteYForID(a){return(a=this._touches.get(a))?a.GetY():0},SpeedAt(a){return(a=this._GetTouchByIndex(a))?a.GetSpeed():0},SpeedForID(a){return(a=this._touches.get(a))?a.GetSpeed():0},AngleAt(a){return(a=this._GetTouchByIndex(a))?e.toDegrees(a.GetAngle()):0},AngleForID(a){return(a=this._touches.get(a))?e.toDegrees(a.GetAngle()):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(a){return(a=this._touches.get(a))?a.GetWidth():0},HeightForID(a){return(a=this._touches.get(a))?a.GetHeight():0},PressureForID(a){return(a=this._touches.get(a))?a.GetPressure():0}}}
  {"use strict";const e=self.C3;let a=-1E3,b=-1E3,d=-1E4;e.Plugins.Touch.TouchInfo=class extends e.DefendedBase{constructor(){super();this._pressure=this._height=this._width=this._lastY=this._lastX=this._y=this._x=this._startY=this._startX=this._lastTime=this._time=this._startTime=this._startIndex=this._pointerId=0;this._isTooFarForHold=this._hasTriggeredHold=!1}Release(){}Init(c,f,h,g,l){this._pointerId=g;this._startIndex=l;this._startTime=this._lastTime=this._time=c;this._startX=f;this._startY=h;this._x=f;this._y=h;this._lastX=f;this._lastY=h}Update(c,f,h,g,l,m){this._lastTime=this._time;this._time=c;this._lastX=this._x;this._lastY=this._y;this._x=f;this._y=h;this._width=g;this._height=l;this._pressure=m;!this._isTooFarForHold&&15<=e.distanceTo(this._startX,this._startY,this._x,this._y)&&(this._isTooFarForHold=!0)}GetId(){return this._pointerId}GetStartIndex(){return this._startIndex}GetTime(){return this._time}_SetLastTime(c){this._lastTime=c}GetX(){return this._x}GetY(){return this._y}GetSpeed(){const c=e.distanceTo(this._x,this._y,this._lastX,this._lastY),f=(this._time-this._lastTime)/1E3;return 0<f?c/f:0}GetAngle(){return e.angleTo(this._lastX,this._lastY,this._x,this._y)}GetWidth(){return this._width}GetHeight(){return this._height}GetPressure(){return this._pressure}ShouldTriggerHold(c){return this._hasTriggeredHold?!1:500<=c-this._startTime&&!this._isTooFarForHold&&15>e.distanceTo(this._startX,this._startY,this._x,this._y)?this._hasTriggeredHold=!0:!1}ShouldTriggerTap(c){if(this._hasTriggeredHold)return"";if(333>=c-this._startTime&&!this._isTooFarForHold&&15>e.distanceTo(this._startX,this._startY,this._x,this._y)){if(666>=c-d&&25>e.distanceTo(a,b,this._x,this._y))return b=a=-1E3,d=-1E4,"double-tap";a=this._x;b=this._y;d=c;return"single-tap"}return""}GetPositionForLayer(c,f,h){return"undefined"===typeof f?c.GetLayerByIndex(0).CanvasCssToLayer_DefaultTransform(this._x,this._y)[h?0:1]:(c=c.GetLayer(f))?c.CanvasCssToLayer(this._x,this._y)[h?0:1]:0}}}
  {"use strict";const e=self.C3;e.Plugins.DrawingCanvas=class extends e.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Plugins.DrawingCanvas.Type=class extends e.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}
  {"use strict";const e=self.C3,a=self.C3X,b=e.New(e.Color),d=e.New(e.Rect),c=e.New(e.Quad);let f=0;e.Plugins.DrawingCanvas.Instance=class extends e.SDKWorldInstanceBase{constructor(g,l){super(g);this._renderTarget=null;this._rcTex=e.New(e.Rect);this._multisampling=0;this._texRenderTarget=null;this._drawCommands=[];this._currentPoly=[];this._drawBlendMode=0;this._texScale=this._drawScale=1;this._lineDashTexture=null;this._savedImageUrl="";this._snapshot=null;this._tempRect=e.New(e.Rect);this._deviceQuadUnrotated=e.New(e.Quad);this._deviceQuadRotated=e.New(e.Quad);l&&(this.GetWorldInfo().SetVisible(!!l[0]),this._multisampling=[0,2,4,8][l[2]]);g=this._runtime.GetRenderer();this._SetDrawingBlendMode(0);g.IsWebGL()&&2>g.GetWebGLVersionNumber()&&(this._multisampling=0);this._StartTicking2()}Release(){this._renderTarget&&(this._renderTarget.GetRenderer().DeleteRenderTarget(this._renderTarget),this._renderTarget=null);this._texRenderTarget&&(this._texRenderTarget.GetRenderer().DeleteRenderTarget(this._texRenderTarget),this._texRenderTarget=null);e.clearArray(this._drawCommands);super.Release()}_ClonePoly(){return this._currentPoly.map(g=>g.slice(0))}_GetLineDashTexture(){this._MaybeCreateLineDashTexture();return this._lineDashTexture}_MaybeCreateLineDashTexture(){if(!this._lineDashTexture){var g=e.CreateCanvas(512,8),l=g.getContext("2d");l.clearRect(0,0,512,8);l.fillStyle="white";l.fillRect(0,0,256,8);this._lineDashTexture=this._runtime.GetRenderer().CreateStaticTexture(g,{wrapX:"repeat",sampling:this._runtime.GetSampling()})}}_SetDrawingBlendMode(g){this._drawBlendMode=g}_ApplyCurrentDrawingBlendMode(g){g.SetBlendMode(this._drawBlendMode)}_AddDrawCommand(g){this._drawCommands.push(g);this._runtime.UpdateRender()}_UpdateRenderTargetSize(g,l,m){this._renderTarget&&g.DeleteRenderTarget(this._renderTarget);this._renderTarget=g.CreateRenderTarget({width:l,height:m,sampling:this._runtime.GetSampling(),isSampled:0===this._multisampling,canReadPixels:0===this._multisampling,multisampling:this._multisampling});0<this._multisampling&&(this._texRenderTarget&&g.DeleteRenderTarget(this._texRenderTarget),this._texRenderTarget=g.CreateRenderTarget({width:l,height:m,sampling:this._runtime.GetSampling(),isSampled:!0,canReadPixels:!0}));g.SetTexture(null)}_GetRenderTarget(){return this._renderTarget}_GetTexRenderTarget(){return this._texRenderTarget}GetMultisampling(){return this._multisampling}_SetRenderTargetDeviceTransform(g){this._runtime.GetCanvasManager().SetDeviceTransform(g,this._renderTarget.GetWidth(),this._renderTarget.GetHeight(),!1)}HasAnyDrawingCommandInQueue(){return this._drawCommands.some(g=>!(g instanceof e.Plugins.DrawingCanvas.DrawCommand.SaveImage))}_CalculateUnrotatedDeviceCoords(g,l){const m=this.GetWorldInfo(),u=m.GetLayer(),x=u.GetLayout(),n=m.GetAngle(),q=u.GetOwnAngle(),t=x.GetAngle();if(0!==n||0!==q||0!==t)x.SetAngle(0),u.SetAngle(0),m.SetAngle(0),m.SetBboxChanged();var r=m.GetBoundingQuad();const[w,y]=u.LayerToDrawSurface(r.getTlx(),r.getTly()),[B,E]=u.LayerToDrawSurface(r.getBrx(),r.getBry());r=w-Math.round(w);const H=y-Math.round(y);g.set(w,y,B,E);g.offset(-r,-H);g.normalize();l.setFromRect(g);if(0!==n||0!==q||0!==t)x.SetAngle(t),u.SetAngle(q),m.SetAngle(n),m.SetBboxChanged()}_CalculateRotatedDeviceCoords(g){var l=this.GetWorldInfo();const m=l.GetLayer(),u=m.GetLayout(),x=m.GetOwnAngle(),n=u.GetAngle();if(0!==x||0!==n)u.SetAngle(0),m.SetAngle(0);l=l.GetBoundingQuad();const[q,t]=m.LayerToDrawSurface(l.getTlx(),l.getTly()),[r,w]=m.LayerToDrawSurface(l.getTrx(),l.getTry()),[y,B]=m.LayerToDrawSurface(l.getBrx(),l.getBry()),[E,H]=m.LayerToDrawSurface(l.getBlx(),l.getBly());l=q-Math.round(q);const K=t-Math.round(t);g.set(q,t,r,w,y,B,E,H);g.offset(l,K);if(0!==x||0!==n)u.SetAngle(n),m.SetAngle(x)}_CalculateSurfaceDeviceSize(){var g=this._runtime.GetRenderer(),l=this._tempRect;this._CalculateUnrotatedDeviceCoords(l,this._deviceQuadUnrotated);this._CalculateRotatedDeviceCoords(this._deviceQuadRotated);let m=Math.ceil(l.width()+.001),u=Math.ceil(l.height()+.001);g.IsWebGL()?this._rcTex.set(0,1,l.width()/m,1-l.height()/u):this._rcTex.set(0,0,l.width()/m,l.height()/u);g=g.GetMaxTextureSize();l=Math.max(m,u);l>g?(this._texScale=g/l,m=Math.round(m*this._texScale),u=Math.round(u*this._texScale)):this._texScale=1;return[m,u]}_MaybeCreateRenderTarget(){if(!this._renderTarget){var[g,l]=this._CalculateSurfaceDeviceSize();0>=g||0>=l||(this._drawScale=d.width()/this.GetWorldInfo().GetWidth(),this._UpdateRenderTargetSize(this._runtime.GetRenderer(),g,l),this.Trigger(e.Plugins.DrawingCanvas.Cnds.OnResolutionChanged))}}Tick2(){const g=this._runtime.GetRenderer();var l=this.GetWorldInfo(),m=this._tempRect;++f;const[u,x]=this._CalculateSurfaceDeviceSize();if(!(0>=u||0>=x)&&(this._drawScale=m.width()/l.GetWidth(),l=this._drawScale*this._texScale,(m=!this._renderTarget||this._renderTarget.GetWidth()!==u||this._renderTarget.GetHeight()!==x)&&this.Trigger(e.Plugins.DrawingCanvas.Cnds.OnResolutionChanged),0<this._drawCommands.length||!this._renderTarget)){(!this._renderTarget||m&&this.HasAnyDrawingCommandInQueue())&&this._UpdateRenderTargetSize(g,u,x);g.SetRenderTarget(this._renderTarget);this._SetRenderTargetDeviceTransform(g);this._ApplyCurrentDrawingBlendMode(g);for(const n of this._drawCommands)n.Do(g,l,this);e.clearArray(this._drawCommands);g.SetAlphaBlend();0<this._multisampling&&(g.SetRenderTarget(this._texRenderTarget),g.CopyRenderTarget(this._renderTarget,"crop"))}--f}Draw(g){const l=this.GetWorldInfo(),m=l.GetLayer(),u=this._runtime.GetCanvasManager(),x=g.GetRenderTarget();let n=this._deviceQuadUnrotated;if(this._renderTarget){g.IsWebGPU()&&g._MaybeDoPendingClearRenderPass(this._renderTarget);0===this._multisampling?g.SetTexture(this._renderTarget.GetTexture()):g.SetTexture(this._texRenderTarget.GetTexture());var q=!1;0<f?(u.SetDeviceTransform(g,x.GetWidth(),x.GetHeight(),!1),q=!0,n=this._deviceQuadRotated):0===l.GetAngle()&&0===m.GetAngle()&&!l.HasMesh()&&m.RendersIn2DMode()?(u.SetDeviceTransform(g),q=!0):n=l.GetBoundingQuad();l.HasMesh()?this._DrawMesh(g,l):g.Quad3(n,this._rcTex);q&&m._SetTransform(g,!1);g.SetTexture(null)}}_DrawMesh(g,l){const m=l.GetTransformedMesh();l.IsMeshChanged()&&(l.CalculateBbox(d,c,!1),m.CalculateTransformedMesh(l.GetSourceMesh(),c,this._rcTex),l.SetMeshChanged(!1));m.Draw(g)}GetSnapshotPixel(g,l){if(!this._snapshot)return[0,0,0,0];var m=this._snapshot.width,u=this._snapshot.height;g=Math.floor(g);l=this._runtime.GetRenderer().IsWebGL()?u-1-Math.floor(l):Math.floor(l);if(0>g||0>l||g>=m||l>=u)return[0,0,0,0];u=this._snapshot.data;const x=l*m*4+4*g;g=u[x]/255;l=u[x+1]/255;m=u[x+2]/255;u=u[x+3]/255;0!==u&&(g/=u,l/=u,m/=u);return[100*g,100*l,100*m,100*u]}SetSnapshotPixel(g,l,m){if(!this._snapshot)return[0,0,0,0];b.setFromRgbValue(m);b.premultiply();m=this._snapshot.width;var u=this._snapshot.height;g=Math.floor(g);l=u-1-Math.floor(l);0>g||0>l||g>=m||l>=u||(u=this._snapshot.data,g=l*m*4+4*g,u[g]=Math.floor(255*b.getR()),u[g+1]=Math.floor(255*b.getG()),u[g+2]=Math.floor(255*b.getB()),u[g+3]=Math.floor(255*b.getA()))}GetImagePixelData(){return new Promise(g=>{this._AddDrawCommand(new e.Plugins.DrawingCanvas.DrawCommand.SaveImage(async l=>{var m=l.data.buffer;const u=l.width;l=l.height;m=await this._runtime.AddJob("ProcessImageData",{buffer:m,width:u,height:l,unpremultiply:!0,flipY:!0},[m]);g(new ImageData(new Uint8ClampedArray(m),u,l))}))})}LoadImagePixelData(g,l,m){this._MaybeCreateRenderTarget();if(!this._renderTarget)throw Error("invalid canvas size");if(g.width!==this._renderTarget.GetWidth()||g.height!==this._renderTarget.GetHeight())throw Error(`wrong size ImageData: expected ${this._renderTarget.GetWidth()} x ${this._renderTarget.GetHeight()}, got ${g.width} x ${g.height}`);e.clearArray(this._drawCommands);const u=this._runtime.GetRenderer();if(this._texRenderTarget){var x=u.GetRenderTarget();const n=this._texRenderTarget.GetTexture();u.UpdateTexture(g,n,{premultiplyAlpha:!!l,flipY:!!m});u.SetRenderTarget(this._renderTarget);u.CopyRenderTarget(this._texRenderTarget,"crop");u.SetRenderTarget(x)}else x=this._renderTarget.GetTexture(),u.UpdateTexture(g,x,{premultiplyAlpha:!!l,flipY:!!m});this._runtime.UpdateRender()}GetScriptInterfaceClass(){return self.IDrawingCanvasInstance}};const h=new WeakMap;self.IDrawingCanvasInstance=class extends self.IWorldInstance{constructor(){super();h.set(this,self.IInstance._GetInitInst().GetSdkInstance())}getImagePixelData(){return h.get(this).GetImagePixelData()}loadImagePixelData(g,l=!1){a.RequireInstanceOf(g,ImageData);h.get(this).LoadImagePixelData(g,l,!0)}get surfaceDeviceWidth(){var g=h.get(this);g._MaybeCreateRenderTarget();g=g._GetRenderTarget();if(!g)throw Error("invalid canvas size");return g.GetWidth()}get surfaceDeviceHeight(){var g=h.get(this);g._MaybeCreateRenderTarget();g=g._GetRenderTarget();if(!g)throw Error("invalid canvas size");return g.GetHeight()}}}"use strict";self.C3.Plugins.DrawingCanvas.Cnds={OnSavedImage(){return!0},OnSnapshot(){return!0},OnResolutionChanged(){return!0}};{"use strict";const e=self.C3;function a(b,d){return b.GetWorldInfo().GetZIndex()-d.GetWorldInfo().GetZIndex()}e.Plugins.DrawingCanvas.Acts={SetEffect(b){this.GetWorldInfo().SetBlendMode(b);this._runtime.UpdateRender()},ClearCanvas(b){e.clearArray(this._drawCommands);this._AddDrawCommand(new e.Plugins.DrawingCanvas.DrawCommand.ClearCanvas(b))},ClearRect(b,d,c,f,h){b!==c&&d!==f&&this._AddDrawCommand(new e.Plugins.DrawingCanvas.DrawCommand.ClearRect(b,d,c,f,h))},FillRect(b,d,c,f,h){b!==c&&d!==f&&this._AddDrawCommand(new e.Plugins.DrawingCanvas.DrawCommand.FillRect(b,d,c,f,h))},FillLinearGradient(b,d,c,f,h,g,l){b!==c&&d!==f&&this._AddDrawCommand(new e.Plugins.DrawingCanvas.DrawCommand.FillLinearGradient(b,d,c,f,h,g,l))},FillEllipse(b,d,c,f,h,g){0>=c||0>=f||this._AddDrawCommand(new e.Plugins.DrawingCanvas.DrawCommand.FillEllipse(b,d,c,f,h,0!==g))},OutlineEllipse(b,d,c,f,h,g,l){0>=c||0>=f||0>=g||this._AddDrawCommand(new e.Plugins.DrawingCanvas.DrawCommand.OutlineEllipse(b,d,c,f,h,g,0!==l))},OutlineRect(b,d,c,f,h,g){b===c||d===f||0>=g||this._AddDrawCommand(new e.Plugins.DrawingCanvas.DrawCommand.OutlineRect(b,d,c,f,h,g))},Line(b,d,c,f,h,g,l){b===c&&d===f||0>=g||this._AddDrawCommand(new e.Plugins.DrawingCanvas.DrawCommand.Line(b,d,c,f,h,g,0===l?"butt":"square"))},LineDashed(b,d,c,f,h,g,l,m){if(!(b===c&&d===f||0>=g||0>=l)){m=0===m?"butt":"square";var u=this._GetLineDashTexture();this._AddDrawCommand(new e.Plugins.DrawingCanvas.DrawCommand.LineDashed(b,d,c,f,h,g,l,u,m))}},AddPolyPoint(b,d){this._currentPoly.push([b,d])},ResetPoly(){e.clearArray(this._currentPoly)},LinePoly(b,d,c){2>this._currentPoly.length||0>=d||(c=0===c?"butt":"square",this._AddDrawCommand(new e.Plugins.DrawingCanvas.DrawCommand.LinePoly(this._ClonePoly(),b,d,c)))},LineDashedPoly(b,d,c,f){if(!(2>this._currentPoly.length||0>=d||0>=c)){f=0===f?"butt":"square";var h=this._GetLineDashTexture();this._AddDrawCommand(new e.Plugins.DrawingCanvas.DrawCommand.LineDashedPoly(this._ClonePoly(),b,d,c,h,f))}},FillPoly(b){3>this._currentPoly.length||this._AddDrawCommand(new e.Plugins.DrawingCanvas.DrawCommand.FillPoly(this._ClonePoly(),b))},SetDrawBlend(b){2<=b&&b++;this._AddDrawCommand(new e.Plugins.DrawingCanvas.DrawCommand.SetDrawBlend(b))},PasteObject(b,d){if(b){var c=this.GetWorldInfo(),f=c.GetBoundingBox(),h=c.GetBoundingQuad();b=b.GetCurrentSol().GetInstances().filter(g=>(g=g.GetWorldInfo())&&f.intersectsRect(g.GetBoundingBox())&&(0===c.GetAngle()||h.intersectsQuad(g.GetBoundingQuad())));0!==b.length&&(b.sort(a),this._AddDrawCommand(new e.Plugins.DrawingCanvas.DrawCommand.DrawInstances(b,0!==d,c)))}},SaveImage(b,d,c,f,h,g){const l=0===b?"image/png":"image/jpeg";d/=100;const m=e.New(e.Rect);m.setWH(c,f,h,g);return new Promise(u=>{this._AddDrawCommand(new e.Plugins.DrawingCanvas.DrawCommand.SaveImage(async x=>{var n=x.data.buffer,q=x.width;x=x.height;const t=this._runtime.GetRenderer().IsWebGL();n=await this._runtime.AddJob("ProcessImageData",{buffer:n,width:q,height:x,unpremultiply:!0,flipY:t&&!e.Supports.ImageBitmapOptions},[n]);x=new ImageData(new Uint8ClampedArray(n),q,x);e.Supports.ImageBitmapOptions?(q=await createImageBitmap(x,{premultiplyAlpha:"none",imageOrientation:t?"flipY":"none"}),q=await e.DrawableToBlob(q,l,d)):q=await e.ImageDataToBlob(x,l,d);this._savedImageUrl&&URL.revokeObjectURL(this._savedImageUrl);this._savedImageUrl=URL.createObjectURL(q);this.Trigger(e.Plugins.DrawingCanvas.Cnds.OnSavedImage);u()},m))})},SaveSnapshot(){return new Promise(b=>{this._AddDrawCommand(new e.Plugins.DrawingCanvas.DrawCommand.SaveImage(d=>{this._snapshot=d;this.Trigger(e.Plugins.DrawingCanvas.Cnds.OnSnapshot);b()}))})},ClearSnapshot(){this._snapshot=null},SnapshotSetPixel(b,d,c){this.SetSnapshotPixel(b,d,c)},LoadSnapshot(){this._snapshot&&this._renderTarget&&this._snapshot.width===this._renderTarget.GetWidth()&&this._snapshot.height===this._renderTarget.GetHeight()&&this.LoadImagePixelData(this._snapshot,!1)}}}"use strict";self.C3.Plugins.DrawingCanvas.Exps={SavedImageURL(){return this._savedImageUrl},SnapshotRedAt(e,a){return this.GetSnapshotPixel(e,a)[0]},SnapshotGreenAt(e,a){return this.GetSnapshotPixel(e,a)[1]},SnapshotBlueAt(e,a){return this.GetSnapshotPixel(e,a)[2]},SnapshotAlphaAt(e,a){return this.GetSnapshotPixel(e,a)[3]},SnapshotWidth(){return this._snapshot?this._snapshot.width:0},SnapshotHeight(){return this._snapshot?this._snapshot.height:0},PixelScale(){return 1/(this._drawScale*this._texScale)},SurfaceDeviceWidth(){const e=this._GetRenderTarget();return e?e.GetWidth():0},SurfaceDeviceHeight(){const e=this._GetRenderTarget();return e?e.GetHeight():0}};{"use strict";const e=self.C3,a=e.New(e.Quad),b=e.New(e.Quad),d=e.New(e.Vector2);e.Plugins.DrawingCanvas.DrawCommand=class{constructor(){}Do(f){throw Error("required override");}};const c=e.Plugins.DrawingCanvas.DrawCommand;c.SaveImage=class extends c{constructor(f,h){super();this._callback=f;this._areaRect=h}Do(f,h,g){h=f.GetRenderTarget();0<h.GetMultisampling()&&(g=g._GetTexRenderTarget(),f.SetRenderTarget(g),f.CopyRenderTarget(h,"crop"),f.SetRenderTarget(h),h=g);f.ReadBackRenderTargetToImageData(h,!1,this._areaRect).then(this._callback)}};c.ClearCanvas=class extends c{constructor(f){super();this._color=e.New(e.Color);this._color.setFromRgbValue(f);this._color.premultiply()}Do(f){f.Clear(this._color)}};c.ClearRect=class extends c{constructor(f,h,g,l,m){super();this._rect=e.New(e.Rect);this._rect.set(f,h,g,l);this._color=e.New(e.Color);this._color.setFromRgbValue(m);this._color.premultiply()}Do(f,h,g){const l=g._GetRenderTarget().GetHeight();this._rect.multiply(h,h);this._rect.shuntY(l);f.SetColorFillMode();f.SetColor(this._color);f.SetBlendMode(3);f.Rect(this._rect);g._ApplyCurrentDrawingBlendMode(f)}};c.FillRect=class extends c{constructor(f,h,g,l,m){super();this._rect=e.New(e.Rect);this._rect.set(f,h,g,l);this._color=e.New(e.Color);this._color.setFromRgbValue(m);this._color.premultiply()}Do(f,h){f.SetColorFillMode();f.SetColor(this._color);this._rect.multiply(h,h);f.Rect(this._rect)}};c.FillLinearGradient=class extends c{constructor(f,h,g,l,m,u,x){super();this._rect=e.New(e.Rect);this._rect.set(f,h,g,l);this._color1=e.New(e.Color);this._color1.setFromRgbValue(m);this._color2=e.New(e.Color);this._color2.setFromRgbValue(u);this._dir=x}Do(f,h){f.SetLinearGradientFillMode();f.SetColor(this._color1);f.SetGradientColor(this._color2);this._rect.multiply(h,h);a.setFromRect(this._rect);0===this._dir?b.set(0,0,1,0,1,1,0,1):b.set(0,1,0,0,1,0,1,1);f.Quad4(a,b)}};c.FillEllipse=class extends c{constructor(f,h,g,l,m,u){super();this._rect=e.New(e.Rect);this._rect.set(f-g,h-l,f+g,h+l);this._color=e.New(e.Color);this._color.setFromRgbValue(m);this._color.premultiply();this._isSmooth=u}Do(f,h){this._rect.multiply(h,h);this._isSmooth?(f.SetSmoothEllipseFillMode(),f.SetColor(this._color),this._rect.inflate(.5,.5),f.SetEllipseParams(1/this._rect.width(),1/this._rect.height())):(f.SetHardEllipseFillMode(),f.SetColor(this._color));f.Rect(this._rect)}};c.OutlineEllipse=class extends c{constructor(f,h,g,l,m,u,x){super();this._rect=e.New(e.Rect);this._rect.set(f-g,h-l,f+g,h+l);this._color=e.New(e.Color);this._color.setFromRgbValue(m);this._color.premultiply();this._thickness=u;this._isSmooth=x}Do(f,h){this._rect.multiply(h,h);this._isSmooth?(f.SetSmoothEllipseOutlineMode(),f.SetColor(this._color),this._rect.inflate(.5,.5),f.SetEllipseParams(1/this._rect.width(),1/this._rect.height(),this._thickness*h)):(f.SetHardEllipseOutlineMode(),f.SetEllipseParams(1/this._rect.width(),1/this._rect.height(),this._thickness*h),f.SetColor(this._color));f.Rect(this._rect)}};c.OutlineRect=class extends c{constructor(f,h,g,l,m,u){super();this._rect=e.New(e.Rect);this._rect.set(f,h,g,l);this._color=e.New(e.Color);this._color.setFromRgbValue(m);this._color.premultiply();this._thickness=u}Do(f,h){f.SetColorFillMode();f.SetColor(this._color);f.PushLineCapZag();f.PushLineWidth(this._thickness*h);this._rect.multiply(h,h);f.LineRect2(this._rect);f.PopLineCap();f.PopLineWidth()}};c.Line=class extends c{constructor(f,h,g,l,m,u,x){super();this._rect=e.New(e.Rect);this._rect.set(f,h,g,l);this._color=e.New(e.Color);this._color.setFromRgbValue(m);this._color.premultiply();this._thickness=u;this._cap=x}Do(f,h){f.SetColorFillMode();f.SetColor(this._color);f.PushLineCap(this._cap);f.PushLineWidth(this._thickness*h);const g=this._rect;g.multiply(h,h);f.Line(g.getLeft(),g.getTop(),g.getRight(),g.getBottom());f.PopLineCap();f.PopLineWidth()}};c.LinePoly=class extends c{constructor(f,h,g,l){super();this._poly=f;this._color=e.New(e.Color);this._color.setFromRgbValue(h);this._color.premultiply();this._thickness=g;this._cap=l}Do(f,h){f.SetColorFillMode();f.SetColor(this._color);f.PushLineCap(this._cap);f.PushLineWidth(this._thickness*h);const g=this._poly;for(let l=0,m=g.length;l<m;++l){const u=(l+1)%m;f.Line(g[l][0]*h,g[l][1]*h,g[u][0]*h,g[u][1]*h)}f.PopLineCap();f.PopLineWidth()}};c.LineDashed=class extends c{constructor(f,h,g,l,m,u,x,n,q){super();this._rect=e.New(e.Rect);this._rect.set(f,h,g,l);this._color=e.New(e.Color);this._color.setFromRgbValue(m);this._color.premultiply();this._thickness=u;this._dashLength=x;this._dashTex=n;this._cap=q}Do(f,h){f.SetTextureFillMode();f.SetTexture(this._dashTex);f.SetColor(this._color);f.PushLineCap(this._cap);f.PushLineWidth(this._thickness*h);const g=this._rect,l=e.distanceTo(g.getLeft(),g.getTop(),g.getRight(),g.getBottom())/(2*this._dashLength);g.multiply(h,h);f.TexturedLine(g.getLeft(),g.getTop(),g.getRight(),g.getBottom(),0,l);f.PopLineCap();f.PopLineWidth()}};c.LineDashedPoly=class extends c{constructor(f,h,g,l,m,u){super();this._poly=f;this._color=e.New(e.Color);this._color.setFromRgbValue(h);this._color.premultiply();this._thickness=g;this._dashLength=l;this._dashTex=m;this._cap=u}Do(f,h){f.SetTextureFillMode();f.SetTexture(this._dashTex);f.SetColor(this._color);f.PushLineCap(this._cap);f.PushLineWidth(this._thickness*h);let g=0;const l=this._poly;for(let u=0,x=l.length;u<x;++u){var m=(u+1)%x;const n=l[u][0],q=l[u][1],t=l[m][0];m=l[m][1];const r=g+e.distanceTo(n,q,t,m)/(2*this._dashLength);f.TexturedLine(n*h,q*h,t*h,m*h,g,r);g=r-Math.floor(r)}f.PopLineCap();f.PopLineWidth()}};c.FillPoly=class extends c{constructor(f,h){super();this._poly=f;this._color=e.New(e.Color);this._color.setFromRgbValue(h);this._color.premultiply()}Do(f,h){f.SetColorFillMode();f.SetColor(this._color);var g=this._poly;for(let l=0,m=g.length;l<m;++l){const u=g[l];u[0]*=h;u[1]*=h}h=self.polyDecomp;if(h.isSimple(g)){h.makeCCW(g);h.removeCollinearPoints(g,e.toRadians(.1));g=h.quickDecomp(g);for(const l of g)f.ConvexPoly(l.flat())}}};c.SetDrawBlend=class extends c{constructor(f){super();this._blendIndex=f}Do(f,h,g){g._SetDrawingBlendMode(this._blendIndex);g._ApplyCurrentDrawingBlendMode(f)}};c.DrawInstances=class extends c{constructor(f,h,g){super();const l=g.GetLayer();this._includeFx=h;this._layoutTransform=l.GetLayout().SaveTransform();this._layerTransforms=new Map;this._layerTransforms.set(l,l.SaveTransform());this._instances=f.map(m=>this._SaveInstanceState(m,g))}_SaveInstanceState(f,h){const g=h.GetAngle();var l=h.GetLayer();const m=f.GetWorldInfo();var u=m.GetLayer();const x=m.GetX(),n=m.GetY(),q=m.GetWidth(),t=m.GetHeight(),r=m.GetAngle();this._layerTransforms.has(u)||this._layerTransforms.set(u,u.SaveTransform());const w=l.IsTransformCompatibleWith(u);if(!w){const[B,E]=u.LayerToDrawSurface(x,n),[H,K]=l.DrawSurfaceToLayer(B,E);m.SetXY(H,K);var y=u.GetNormalScale()/l.GetNormalScale();m.SetSize(q*y,t*y);l=l.GetOwnAngle()-u.GetOwnAngle();m.OffsetAngle(l)}0!==g&&(u=h.GetBoundingQuad(),l=u.midX(),u=u.midY(),y=-h.GetSinAngle(),h=h.GetCosAngle(),d.set(x,n),d.offset(-l,-u),d.rotatePrecalc(y,h),d.offset(l,u),m.SetXY(d.getX(),d.getY()),m.OffsetAngle(-g));0===g&&w||m.SetBboxChanged();f=[f,f.SaveToJson("visual-state")];0===g&&w||(m.SetXY(x,n),m.SetSize(q,t),m.SetAngle(r),m.SetBboxChanged());return f}Do(f,h,g){h=g.GetRuntime().GetCanvasManager();const l=g.GetWorldInfo().GetLayer(),m=l.GetLayout();var u=l.GetViewport(),x=g.GetWorldInfo().GetBoundingBox();const n=g._GetRenderTarget(),q=0<g.GetMultisampling(),t=this._includeFx,r=m.SaveTransform();m.RestoreTransform(this._layoutTransform);const w=new Map;for(const[F,J]of this._layerTransforms)w.set(F,F.SaveTransform()),F.RestoreTransform(J);h.SetIsPastingToDrawingCanvas(!0);var y=(u.width()-x.width())/-2,B=(u.height()-x.height())/-2;const[E,H]=l.LayerToDrawSurface(x.getLeft(),x.getTop());h.SetDeviceTransformOffset(E,H);var K=x.getLeft()-u.getLeft();u=x.getTop()-u.getTop();const C=y+K,A=B+u;y=n.GetHeight();l._SetTransform(f,!1,C,A,y);for(let F=0,J=this._instances.length;F<J;++F){K=this._instances[F];B=K[0];K=K[1];if(B.IsDestroyed())continue;u=B.GetWorldInfo();x=u.GetBoundingBox();const L=B.SaveToJson("visual-state");B.LoadFromJson(K,"visual-state");u.GetBoundingBox();!t||!u.HasAnyActiveEffect()||q&&u.GetInstanceEffectList().HasAnyActiveBackgroundBlendingEffect()?l._DrawInstance(B,u,f):(x.offset(-C,-A),l._DrawInstanceWithEffects(B,u,f,n,{preTransform:()=>l._SetTransform(f,!1,C,A)})&&l._SetTransform(f,!1,C,A,y),u.SetBboxChanged(),u.GetBoundingBox());B.LoadFromJson(L,"visual-state")}h.SetDeviceTransformOffset(0,0);h.SetIsPastingToDrawingCanvas(!1);g._SetRenderTargetDeviceTransform(f);g._ApplyCurrentDrawingBlendMode(f);m.RestoreTransform(r);for(const[F,J]of w)F.RestoreTransform(J)}}}{"use strict";const e=self.C3;e.Plugins.TiledBg=class extends e.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}}}
  {"use strict";const e=self.C3;function a(b){switch(b){case 0:return"clamp-to-edge";case 2:return"mirror-repeat"}return"repeat"}e.Plugins.TiledBg.Type=class extends e.SDKTypeBase{constructor(b,d){super(b);this._wrapY=this._wrapX="repeat";d&&(this._wrapX=a(d[0]),this._wrapY=a(d[1]))}Release(){super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}LoadTextures(b){return this.GetImageInfo().LoadStaticTexture(b,{sampling:this._runtime.GetSampling(),wrapX:this._wrapX,wrapY:this._wrapY})}ReleaseTextures(){this.GetImageInfo().ReleaseTexture()}}}
  {"use strict";const e=self.C3,a=self.C3X,b=e.New(e.Rect),d=e.New(e.Quad),c=e.New(e.Rect),f=e.New(e.Quad);e.Plugins.TiledBg.Instance=class extends e.SDKWorldInstanceBase{constructor(g,l){super(g);this._imageOffsetY=this._imageOffsetX=0;this._imageScaleY=this._imageScaleX=1;this._imageAngle=0;this._ownImageInfo=null;l&&(this.GetWorldInfo().SetVisible(!!l[0]),this._imageOffsetX=l[4],this._imageOffsetY=l[5],this._imageScaleX=l[6],this._imageScaleY=l[7],this._imageAngle=e.toRadians(l[8]))}Release(){this._ReleaseOwnImage();super.Release()}_ReleaseOwnImage(){this._ownImageInfo&&(this._ownImageInfo.Release(),this._ownImageInfo=null)}CalculateTextureCoordsFor3DFace(g,l,m){var u=this.GetCurrentImageInfo();const x=u.GetWidth();u=u.GetHeight();const n=this._imageOffsetX/x,q=this._imageOffsetY/u,t=this._imageAngle;c.set(0,0,g/(x*this._imageScaleX),l/(u*this._imageScaleY));c.offset(-n,-q);0===t?m.setFromRect(c):m.setFromRotatedRect(c,-t)}Draw(g){var l=this.GetCurrentImageInfo(),m=l.GetTexture();if(null!==m){g.SetTexture(m);m=l.GetWidth();l=l.GetHeight();var u=this._imageOffsetX/m,x=this._imageOffsetY/l,n=this.GetWorldInfo();c.set(0,0,n.GetWidth()/(m*this._imageScaleX),n.GetHeight()/(l*this._imageScaleY));c.offset(-u,-x);n.HasMesh()?this._DrawMesh(n,g):this._DrawStandard(n,g)}}_DrawStandard(g,l){let m=g.GetBoundingQuad();this._runtime.IsPixelRoundingEnabled()&&(m=g.PixelRoundQuad(m));0===this._imageAngle?l.Quad3(m,c):(f.setFromRotatedRect(c,-this._imageAngle),l.Quad4(m,f))}_DrawMesh(g,l){const m=g.GetTransformedMesh();if(g.IsMeshChanged()){g.CalculateBbox(b,d,!1);let u=d;this._runtime.IsPixelRoundingEnabled()&&(u=g.PixelRoundQuad(u));let x=c;0!==this._imageAngle&&(f.setFromRotatedRect(c,-this._imageAngle),x=f);m.CalculateTransformedMesh(g.GetSourceMesh(),u,x);g.SetMeshChanged(!1)}m.Draw(l)}GetCurrentImageInfo(){return this._ownImageInfo||this._objectClass.GetImageInfo()}IsOriginalSizeKnown(){return!0}GetTexture(){return this.GetCurrentImageInfo().GetTexture()}_SetMeshChanged(){this.GetWorldInfo().SetMeshChanged(!0)}_SetImageOffsetX(g){this._imageOffsetX!==g&&(this._imageOffsetX=g,this._runtime.UpdateRender(),this._SetMeshChanged())}_GetImageOffsetX(){return this._imageOffsetX}_SetImageOffsetY(g){this._imageOffsetY!==g&&(this._imageOffsetY=g,this._runtime.UpdateRender(),this._SetMeshChanged())}_GetImageOffsetY(){return this._imageOffsetY}_SetImageScaleX(g){this._imageScaleX!==g&&(this._imageScaleX=g,this._runtime.UpdateRender(),this._SetMeshChanged())}_GetImageScaleX(){return this._imageScaleX}_SetImageScaleY(g){this._imageScaleY!==g&&(this._imageScaleY=g,this._runtime.UpdateRender(),this._SetMeshChanged())}_GetImageScaleY(){return this._imageScaleY}_SetImageAngle(g){this._imageAngle!==g&&(this._imageAngle=g,this._runtime.UpdateRender(),this._SetMeshChanged())}_GetImageAngle(){return this._imageAngle}GetPropertyValueByIndex(g){switch(g){case 4:return this._GetImageOffsetX();case 5:return this._GetImageOffsetY();case 6:return this._GetImageScaleX();case 7:return this._GetImageScaleY();case 8:return this._GetImageAngle()}}SetPropertyValueByIndex(g,l){switch(g){case 4:this._SetImageOffsetX(l);break;case 5:this._SetImageOffsetY(l);break;case 6:this._SetImageScaleX(l);break;case 7:this._SetImageScaleY(l);break;case 8:this._SetImageAngle(l)}}GetScriptInterfaceClass(){return self.ITiledBackgroundInstance}};const h=new WeakMap;self.ITiledBackgroundInstance=class extends self.IWorldInstance{constructor(){super();h.set(this,self.IInstance._GetInitInst().GetSdkInstance())}set imageOffsetX(g){a.RequireFiniteNumber(g);h.get(this)._SetImageOffsetX(g)}get imageOffsetX(){return h.get(this)._GetImageOffsetX()}set imageOffsetY(g){a.RequireFiniteNumber(g);h.get(this)._SetImageOffsetY(g)}get imageOffsetY(){return h.get(this)._GetImageOffsetY()}set imageScaleX(g){a.RequireFiniteNumber(g);h.get(this)._SetImageScaleX(g)}get imageScaleX(){return h.get(this)._GetImageScaleX()}set imageScaleY(g){a.RequireFiniteNumber(g);h.get(this)._SetImageScaleY(g)}get imageScaleY(){return h.get(this)._GetImageScaleY()}set imageAngle(g){a.RequireFiniteNumber(g);h.get(this)._SetImageAngle(g)}get imageAngle(){return h.get(this)._GetImageAngle()}set imageAngleDegrees(g){a.RequireFiniteNumber(g);h.get(this)._SetImageAngle(e.toRadians(g))}get imageAngleDegrees(){return e.toDegrees(h.get(this)._GetImageAngle())}get imageWidth(){return h.get(this).GetCurrentImageInfo().GetWidth()}get imageHeight(){return h.get(this).GetCurrentImageInfo().GetHeight()}}}"use strict";self.C3.Plugins.TiledBg.Cnds={OnURLLoaded(){return!0},OnURLFailed(){return!0}};{"use strict";const e=self.C3;e.Plugins.TiledBg.Acts={SetImageOffsetX(a){this._SetImageOffsetX(a)},SetImageOffsetY(a){this._SetImageOffsetY(a)},SetImageScaleX(a){this._SetImageScaleX(a/100)},SetImageScaleY(a){this._SetImageScaleY(a/100)},SetImageAngle(a){this._SetImageAngle(e.toRadians(a))},SetEffect(a){this.GetWorldInfo().SetBlendMode(a);this._runtime.UpdateRender()},async LoadURL(a,b){if(!this._ownImageInfo||this._ownImageInfo.GetURL()!==a){b=this._runtime;var d=e.New(e.ImageInfo);try{await d.LoadDynamicAsset(b,a);if(!d.IsLoaded())throw Error("image failed to load");if(this.WasReleased())return d.Release(),null;if(!await d.LoadStaticTexture(b.GetRenderer(),{sampling:this._runtime.GetSampling(),wrapX:"repeat",wrapY:"repeat"}))return}catch(c){console.error("Load image from URL failed: ",c);this.Trigger(e.Plugins.TiledBg.Cnds.OnURLFailed);return}this.WasReleased()?d.Release():(this._ReleaseOwnImage(),this._ownImageInfo=d,b.UpdateRender(),await this.TriggerAsync(e.Plugins.TiledBg.Cnds.OnURLLoaded))}}}}
  {"use strict";const e=self.C3;e.Plugins.TiledBg.Exps={ImageWidth(){return this.GetCurrentImageInfo().GetWidth()},ImageHeight(){return this.GetCurrentImageInfo().GetHeight()},ImageOffsetX(){return this._imageOffsetX},ImageOffsetY(){return this._imageOffsetY},ImageScaleX(){return 100*this._imageScaleX},ImageScaleY(){return 100*this._imageScaleY},ImageAngle(){return e.toDegrees(this._imageAngle)}}}
  {"use strict";const e=self.C3;e.Plugins.SVGPicture=class extends e.SDKPluginBase{constructor(a){super(a);this._rasterManager=null}Release(){super.Release()}_GetRasterManager(){this._rasterManager||(this._rasterManager=e.New(e.SVGRasterManager),this._rasterManager.SetGetBaseSizeCallback(a=>this._GetSvgBaseSize(a)),this._rasterManager.SetRasterAtSizeCallback((a,b,d,c,f,h)=>this._RasterSvgAtSize(a,b,d,c,f,h)),this._rasterManager.SetReleaseResultCallback(a=>this._ReleaseRasterResult(a)),this._rasterManager.SetRedrawCallback(()=>this._Redraw()),this._rasterManager.SetNpotSurfaceAllowed(this.GetRuntime().GetRenderer().SupportsNPOTTextures()));return this._rasterManager}async _GetSvgBaseSize(a){const b=this.GetRuntime();a=await b.GetAssetManager().FetchBlob(a);return await b.GetSvgImageSize(a)}async _RasterSvgAtSize(a,b,d,c,f,h){const g=this.GetRuntime(),l=await g.GetAssetManager().FetchBlob(a);a={mipMap:!0,mipMapQuality:"high",anisotropy:this._runtime.GetCanvasManager().GetTextureAnisotropy()};let m=null;e.Supports.ImageBitmapOptions&&(m={premultiplyAlpha:"premultiply"},a.premultiplyAlpha=!1);d=await g.RasterSvgImage(l,f,h,d,c,m);return e.Supports.ImageBitmapOptions?b.CreateStaticTexture(d,a):await b.CreateStaticTextureAsync(d,a)}_ReleaseRasterResult(a){a.GetRenderer().DeleteTexture(a)}_Redraw(){this.GetRuntime().UpdateRender()}}}
  {"use strict";const e=self.C3;e.Plugins.SVGPicture.Type=class extends e.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}LoadTextures(a){}ReleaseTextures(){}PreloadTexturesWithInstances(a){const b=new Set;for(const c of this.GetObjectClass().GetInstances()){var d=c.GetSdkInstance();d._UpdateRasterImage();(d=d._GetRasterImage())&&b.add(d)}return Promise.all([...b].map(c=>this._PreloadRasterImage(a,c)))}async _PreloadRasterImage(a,b){await b.WhenBaseSizeReady();var d=b.GetBaseWidth(),c=b.GetBaseHeight();c=d/c;1>c?(d=256*c,c=256):(d=256,c=256/c);await b.StartRasterForSize(a,d,c)}}}
  {"use strict";const e=self.C3,a=e.New(e.Rect),b=e.New(e.Quad);e.Plugins.SVGPicture.Instance=class extends e.SDKWorldInstanceBase{constructor(d,c){super(d);this._svgFilename="";this._rasterImage=null;this._collisionPoly=e.New(e.CollisionPoly);this.GetWorldInfo().SetSourceCollisionPoly(this._collisionPoly);c&&(this._svgFilename=c[0],this.GetWorldInfo().SetVisible(!!c[1]));this._UpdateRasterImage();this.HandleWebGLContextLoss()}Release(){this._ReleaseRasterImage();super.Release()}_GetRasterManager(){return this.GetPlugin()._GetRasterManager()}_ReleaseRasterImage(){this._rasterImage&&(this._rasterImage.Release(),this._rasterImage=null)}_UpdateRasterImage(){this._svgFilename?this._rasterImage&&this._rasterImage.GetDataSource()===this._svgFilename||(this._ReleaseRasterImage(),this._rasterImage=this._GetRasterManager().AddImage(this._svgFilename),this._rasterImage.WhenBaseSizeReady().then(()=>this._UpdateCollisionPolygon())):(this._ReleaseRasterImage(),this._UpdateCollisionPolygon())}_UpdateCollisionPolygon(){const d=this.GetWorldInfo();var c=Math.abs(d.GetWidth()),f=Math.abs(d.GetHeight()),h=c,g=f;if(this._rasterImage){const l=this._rasterImage.GetBaseWidth(),m=this._rasterImage.GetBaseHeight();0!==l&&0!==m&&(g=l/m,c/f>g?(h=f*g,g=f):(h=c,g=c/g))}c=h/c;f=g/f;h=d.GetOriginX();g=d.GetOriginY();a.setWH(h-h*c,g-g*f,c,f);this._collisionPoly.setFromRect(a,h,g);d.SetSourceCollisionPoly(this._collisionPoly)}_GetRasterImage(){return this._rasterImage}OnWebGLContextLost(){this._ReleaseRasterImage()}OnWebGLContextRestored(){this._UpdateRasterImage()}Draw(d){const c=this.GetWorldInfo();var f=c.GetLayer();if(this._rasterImage){var h=this._rasterImage.GetBaseWidth(),g=this._rasterImage.GetBaseHeight();if(0!==h&&0!==g){var l=Math.abs(c.GetWidth()),m=Math.abs(c.GetHeight()),u=c.GetZElevation(),x=f._GetLayerToDrawSurfaceScale(l,u);f=f._GetLayerToDrawSurfaceScale(m,u);g=h/g;l/m>g?(h=f*g,x=m*g,l=m):(h=x,f=x/g,x=l,l/=g);this._rasterImage.StartRasterForSize(d,h,f);if(m=this._rasterImage.GetRasterizedResult())d.SetTexture(m),h=c.GetX(),g=c.GetY(),x*=Math.sign(c.GetWidth()),l*=Math.sign(c.GetHeight()),a.setWH(h-
  c.GetOriginX()*x,g-c.GetOriginY()*l,x,l),0===c.GetAngle()?b.setFromRect(a):(a.offset(-h,-g),b.setFromRotatedRectPrecalc(a,c.GetSinAngle(),c.GetCosAngle()),b.offset(h,g)),a.set(0,0,this._rasterImage.GetRasterWidth()/m.GetWidth(),this._rasterImage.GetRasterHeight()/m.GetHeight()),d.Quad3(b,a)}}}GetPropertyValueByIndex(d){}SetPropertyValueByIndex(d,c){}_SetImage(d){this._svgFilename=d;this._UpdateRasterImage()}GetCurrentSurfaceSize(){if(this._rasterImage){const d=this._rasterImage.GetRasterizedResult();if(d)return[d.GetWidth(),d.GetHeight()]}return[100,100]}GetCurrentTexRect(){if(this._rasterImage){const d=this._rasterImage.GetRasterizedResult();if(d)return a.set(0,0,this._rasterImage.GetRasterWidth()/d.GetWidth(),this._rasterImage.GetRasterHeight()/d.GetHeight()),a}return null}}}"use strict";self.C3.Plugins.SVGPicture.Cnds={};"use strict";self.C3.Plugins.SVGPicture.Acts={SetImage(e){this._SetImage(e)},SetImageByName(e){this._SetImage(e)},SetEffect(e){this.GetWorldInfo().SetBlendMode(e);this._runtime.UpdateRender()}};"use strict";self.C3.Plugins.SVGPicture.Exps={};{"use strict";const e=self.C3;e.Plugins.Browser=class extends e.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Plugins.Browser.Type=class extends e.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}
  {"use strict";const e=self.C3;e.Plugins.Browser.Instance=class extends e.SDKInstanceBase{constructor(a,b){super(a,"browser");this._initLocationStr="";this._isOnline=!1;this._docTitle=this._referrer="";this._isCookieEnabled=!1;this._windowOuterHeight=this._windowOuterWidth=this._screenHeight=this._screenWidth=0;this._isScirraArcade=!1;this.AddDOMMessageHandlers([["online-state",d=>this._OnOnlineStateChanged(d)],["backbutton",()=>this._OnBackButton()],["sw-message",d=>this._OnSWMessage(d)],["hashchange",d=>this._OnHashChange(d)]]);a=this.GetRuntime().Dispatcher();this._disposables=new e.CompositeDisposable(e.Disposable.From(a,"afterfirstlayoutstart",()=>this._OnAfterFirstLayoutStart()),e.Disposable.From(a,"window-resize",()=>this._OnWindowResize()),e.Disposable.From(a,"suspend",()=>this._OnSuspend()),e.Disposable.From(a,"resume",()=>this._OnResume()));this._runtime.AddLoadPromise(this.PostToDOMAsync("get-initial-state",{exportType:this._runtime.GetExportType()}).then(d=>{this._initLocationStr=d.location;this._isOnline=d.isOnline;this._referrer=d.referrer;this._docTitle=d.title;this._isCookieEnabled=d.isCookieEnabled;this._screenWidth=d.screenWidth;this._screenHeight=d.screenHeight;this._windowOuterWidth=d.windowOuterWidth;this._windowOuterHeight=d.windowOuterHeight;this._isScirraArcade=d.isScirraArcade}))}Release(){super.Release()}_OnAfterFirstLayoutStart(){this.PostToDOM("ready-for-sw-messages")}async _OnOnlineStateChanged(a){a=!!a.isOnline;this._isOnline!==a&&((this._isOnline=a)?await this.TriggerAsync(e.Plugins.Browser.Cnds.OnOnline):await this.TriggerAsync(e.Plugins.Browser.Cnds.OnOffline))}async _OnWindowResize(){await this.TriggerAsync(e.Plugins.Browser.Cnds.OnResize)}_OnSuspend(){this.Trigger(e.Plugins.Browser.Cnds.OnPageHidden)}_OnResume(){this.Trigger(e.Plugins.Browser.Cnds.OnPageVisible)}async _OnBackButton(){await this.TriggerAsync(e.Plugins.Browser.Cnds.OnBackButton)}_OnSWMessage(a){a=a.type;"downloading-update"===a?this.Trigger(e.Plugins.Browser.Cnds.OnUpdateFound):"update-ready"===a||"update-pending"===a?this.Trigger(e.Plugins.Browser.Cnds.OnUpdateReady):"offline-ready"===a&&this.Trigger(e.Plugins.Browser.Cnds.OnOfflineReady)}_OnHashChange(a){this._initLocationStr=a.location;this.Trigger(e.Plugins.Browser.Cnds.OnHashChange)}GetDebuggerProperties(){return[{title:"plugins.browser.name",properties:[{name:"plugins.browser.debugger.user-agent",value:navigator.userAgent},{name:"plugins.browser.debugger.is-online",value:this._isOnline},{name:"plugins.browser.debugger.is-fullscreen",value:this._runtime.GetCanvasManager().IsDocumentFullscreen()}]}]}}}"use strict";self.C3.Plugins.Browser.Cnds={IsOnline(){return this._isOnline},OnOnline(){return!0},OnOffline(){return!0},OnResize(){return!0},CookiesEnabled(){return this._isCookieEnabled},IsFullscreen(){return this._runtime.GetCanvasManager().IsDocumentFullscreen()},OnBackButton(){return!0},IsPortraitLandscape(e){const a=this._runtime.GetCanvasManager().GetLastWidth(),b=this._runtime.GetCanvasManager().GetLastHeight();return(a<=b?0:1)===e},OnUpdateFound(){return!0},OnUpdateReady(){return!0},OnOfflineReady(){return!0},OnHashChange(){return!0},PageVisible(){return!this._runtime.IsSuspended()},OnPageHidden(){return!0},OnPageVisible(){return!0},HasJava(){return!1},IsDownloadingUpdate(){return!1},OnMenuButton(){return!1},OnSearchButton(){return!1},IsMetered(){return!1},IsCharging(){return!0},SupportsFullscreen(){return!0}};{"use strict";const e=self.C3,a="portrait landscape portrait-primary portrait-secondary landscape-primary landscape-secondary".split(" ");e.Plugins.Browser.Acts={Alert(b){this.PostToDOM("alert",{message:b.toString()})},Close(){this._isScirraArcade||(this._runtime.IsDebug()?self.C3Debugger.CloseWindow():this.PostToDOM("close"))},Focus(){this.PostToDOM("set-focus",{isFocus:!0})},Blur(){this.PostToDOM("set-focus",{isFocus:!1})},GoBack(){this._isScirraArcade||this.PostToDOM("navigate",{type:"back"})},GoForward(){this._isScirraArcade||this.PostToDOM("navigate",{type:"forward"})},GoHome(){},Reload(){this._isScirraArcade||(this._runtime.IsDebug()?this._runtime.PostToDebugger({type:"reload"}):this.PostToDOM("navigate",{type:"reload"}))},GoToURL(b,d){this._PostToDOMMaybeSync("navigate",{type:"url",url:b,target:d,exportType:this._runtime.GetExportType()})},GoToURLWindow(b,d){this._PostToDOMMaybeSync("navigate",{type:"new-window",url:b,tag:d,exportType:this._runtime.GetExportType()})},RequestFullScreen(b,d){2<=b&&(b+=1);6===b&&(b=2);1===b&&(b=0);b=e.CanvasManager._FullscreenModeNumberToString(b);this._runtime.GetCanvasManager().SetDocumentFullscreenMode(b);this._PostToDOMMaybeSync("request-fullscreen",{navUI:d})},CancelFullScreen(){this._PostToDOMMaybeSync("exit-fullscreen")},Vibrate(b){b=b.split(",");for(let d=0,c=b.length;d<c;++d)b[d]=parseInt(b[d],10);this._PostToDOMMaybeSync("vibrate",{pattern:b})},async InvokeDownload(b,d){b&&d&&(b=await this._runtime.GetAssetManager().GetProjectFileUrl(b),this._runtime.InvokeDownload(b,d))},InvokeDownloadString(b,d,c){c&&(b=`data:${d},${encodeURIComponent(b)}`,this._runtime.InvokeDownload(b,c))},ConsoleLog(b,d){d=d.toString();0===b?console.log(d):1===b?console.warn(d):2===b&&console.error(d)},ConsoleGroup(b){console.group(b)},ConsoleGroupEnd(){console.groupEnd()},ExecJs(b){try{eval(b)}catch(d){console.error("Error executing JavaScript: ",d)}},LockOrientation(b){b=Math.floor(b);0>b||b>=a.length||this._PostToDOMMaybeSync("lock-orientation",{orientation:a[b]})},UnlockOrientation(){this._PostToDOMMaybeSync("unlock-orientation")},LoadStyleSheet(b){this._runtime.GetAssetManager().LoadStyleSheet(b)},SetHash(b){this.PostToDOM("set-hash",{hash:b})}}}"use strict";self.C3.Plugins.Browser.Exps={URL(){return this._runtime.IsInWorker()?this._initLocationStr:location.toString()},Protocol(){return this._runtime.IsInWorker()?(new URL(this._initLocationStr)).protocol:location.protocol},Domain(){return this._runtime.IsInWorker()?(new URL(this._initLocationStr)).hostname:location.hostname},Port(){return this._runtime.IsInWorker()?(new URL(this._initLocationStr)).port:location.port},PathName(){return this._runtime.IsInWorker()?(new URL(this._initLocationStr)).pathname:location.pathname},Hash(){return this._runtime.IsInWorker()?(new URL(this._initLocationStr)).hash:location.hash},QueryString(){return this._runtime.IsInWorker()?(new URL(this._initLocationStr)).search:location.search},QueryParam(e){const a=this._runtime.IsInWorker()?(new URL(this._initLocationStr)).search:location.search;return(e=RegExp("[?&]"+e+"=([^&]*)").exec(a))?decodeURIComponent(e[1].replace(/\+/g," ")):""},Referrer(){return this._referrer},Title(){return this._docTitle},Language(){return navigator.language},Platform(){return navigator.platform},UserAgent(){return navigator.userAgent},ExecJS(e){let a=0;try{a=eval(e)}catch(b){console.error("Error executing JavaScript: ",b)}return"number"===typeof a||"string"===typeof a?a:"boolean"===typeof a?a?1:0:0},Name(){return navigator.appName},Version(){return navigator.appVersion},Product(){return navigator.product},Vendor(){return navigator.vendor},BatteryLevel(){return 1},BatteryTimeLeft(){return Infinity},Bandwidth(){const e=navigator.connection;return e?e.downlink||e.downlinkMax||e.bandwidth||Infinity:Infinity},ConnectionType(){const e=navigator.connection;return e?e.type||"unknown":"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 e=self.C3;e.Plugins.Dictionary=class extends e.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Plugins.Dictionary.Type=class extends e.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}
  {"use strict";const e=self.C3,a=self.IInstance;e.Plugins.Dictionary.Instance=class extends e.SDKInstanceBase{constructor(d,c){super(d);this._data=new Map;this._curKey=""}Release(){this._data.clear();super.Release()}GetAsJsonString(){return JSON.stringify({c2dictionary:!0,data:e.MapToObject(this._data)})}GetDataMap(){return this._data}SaveToJson(){return e.MapToObject(this._data)}LoadFromJson(d){e.ObjectToMap(d,this._data)}GetDebuggerProperties(){return[{title:"plugins.dictionary.name",properties:[{name:"plugins.dictionary.debugger.key-count",value:this._data.size},...[...this._data].map(d=>({name:"$"+d[0],value:d[1],onedit:c=>this._data.set(d[0],c)}))]}]}GetScriptInterfaceClass(){return self.IDictionaryInstance}};const b=new WeakMap;self.IDictionaryInstance=class extends a{constructor(){super();b.set(this,a._GetInitInst().GetSdkInstance())}getDataMap(){return b.get(this).GetDataMap()}}}
  {"use strict";const e=self.C3;e.Plugins.Dictionary.Cnds={CompareValue(a,b,d){a=this._data.get(a);return"undefined"===typeof a?!1:e.compare(a,b,d)},ForEachKey(){const a=this._runtime,b=a.GetEventSheetManager(),d=a.GetCurrentEvent(),c=d.GetSolModifiers(),f=a.GetEventStack(),h=f.GetCurrentStackFrame(),g=f.Push(d);a.SetDebuggingEnabled(!1);for(const l of this._data.keys())this._curKey=l,b.PushCopySol(c),d.Retrigger(h,g),b.PopSol(c);a.SetDebuggingEnabled(!0);this._curKey="";f.Pop();return!1},CompareCurrentValue(a,b){const d=this._data.get(this._curKey);return"undefined"===typeof d?!1:e.compare(d,a,b)},HasKey(a){return this._data.has(a)},IsEmpty(){return 0===this._data.size}}}
  {"use strict";const e=self.C3;e.Plugins.Dictionary.Acts={AddKey(a,b){this._data.set(a,b)},SetKey(a,b){this._data.has(a)&&this._data.set(a,b)},DeleteKey(a){this._data.delete(a)},Clear(){this._data.clear()},JSONLoad(a){let b=null;try{b=JSON.parse(a)}catch(d){console.error("[Construct 3] Error parsing JSON: ",d);return}b.c2dictionary&&e.ObjectToMap(b.data,this._data)},JSONDownload(a){const b=URL.createObjectURL(new Blob([this.GetAsJsonString()],{type:"application/json"}));this._runtime.InvokeDownload(b,a)}}}"use strict";self.C3.Plugins.Dictionary.Exps={Get(e){e=this._data.get(e);return"undefined"===typeof e?0:e},GetDefault(e,a){e=this._data.get(e);return"undefined"===typeof e?a:e},KeyCount(){return this._data.size},CurrentKey(){return this._curKey},CurrentValue(){return this._data.get(this._curKey)||0},AsJSON(){return this.GetAsJsonString()}};{"use strict";const e=self.C3;e.Plugins.LocalStorage=class extends e.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}}}
  {"use strict";const e=self.C3;e.Plugins.LocalStorage.Type=class extends e.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}
  {"use strict";const e=self.C3;e.Plugins.LocalStorage.Instance=class extends e.SDKInstanceBase{constructor(a,b){super(a);this._lastValue=this._currentKey="";this._keyNamesList=[];this._errorMessage="";this._pendingSets=this._pendingGets=0;this._storage=this._runtime._GetProjectStorage();this._debugCache=new Map;this._isLoadingDebugCache=!1}Release(){super.Release()}async _TriggerStorageError(a){this._errorMessage=this._GetErrorString(a);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnError)}_GetErrorString(a){return a?"string"===typeof a?a:"string"===typeof a.message?a.message:"string"===typeof a.name?a.name:"string"===typeof a.data?a.data:"unknown error":"unknown error"}GetDebuggerProperties(){this._isLoadingDebugCache||this._DebugCacheStorage();return[{title:"plugins.localstorage.name",properties:[...this._debugCache.entries()].map(a=>({name:"$"+a[0],value:a[1],onedit:b=>this._storage.setItem(a[0],b)}))}]}async _DebugCacheStorage(){this._isLoadingDebugCache=!0;try{const a=await this._storage.keys();a.sort((d,c)=>{d=d.toLowerCase();c=c.toLowerCase();return d<c?-1:c<d?1:0});const b=await Promise.all(a.map(d=>this._storage.getItem(d)));this._debugCache.clear();for(let d=0,c=a.length;d<c;++d)this._debugCache.set(a[d],b[d])}catch(a){console.warn("[C3 debugger] Error displaying local storage: ",a)}finally{this._isLoadingDebugCache=!1}}}}
  {"use strict";const e=self.C3;e.Plugins.LocalStorage.Cnds={OnItemSet(a){return this._currentKey===a},OnAnyItemSet(){return!0},OnItemGet(a){return this._currentKey===a},OnAnyItemGet(){return!0},OnItemRemoved(a){return this._currentKey===a},OnAnyItemRemoved(){return!0},OnCleared(){return!0},OnAllKeyNamesLoaded(){return!0},OnError(){return!0},OnItemExists(a){return this._currentKey===a},OnItemMissing(a){return this._currentKey===a},CompareKey(a,b){return e.compare(this._currentKey,a,b)},CompareValue(a,b){return e.compare(this._lastValue,a,b)},IsProcessingSets(){return 0<this._pendingSets},IsProcessingGets(){return 0<this._pendingGets},OnAllSetsComplete(){return!0},OnAllGetsComplete(){return!0}}}
  {"use strict";const e=self.C3;function a(b){return"string"===typeof b||"number"===typeof b}e.Plugins.LocalStorage.Acts={async SetItem(b,d){this._pendingSets++;try{const c=await this._storage.setItem(b,d);await this.ScheduleTriggers(async()=>{this._currentKey=b;this._lastValue=c;await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAnyItemSet);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnItemSet)})}catch(c){await this._TriggerStorageError(c)}finally{this._pendingSets--,0===this._pendingSets&&await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAllSetsComplete)}},async SetBinaryItem(b,d){if(d&&(d=d.GetFirstPicked(this._inst))&&(d=d.GetSdkInstance())){d=d.GetArrayBufferReadOnly();this._pendingSets++;try{await this._storage.setItem(b,d),await this.ScheduleTriggers(async()=>{this._currentKey=b;this._lastValue="";await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAnyItemSet);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnItemSet)})}catch(c){await this._TriggerStorageError(c)}finally{this._pendingSets--,0===this._pendingSets&&await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAllSetsComplete)}}},async GetItem(b){this._pendingGets++;try{const d=await this._storage.getItem(b);await this.ScheduleTriggers(async()=>{this._currentKey=b;this._lastValue=a(d)?d:"";await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAnyItemGet);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnItemGet)})}catch(d){await this._TriggerStorageError(d)}finally{this._pendingGets--,0===this._pendingGets&&await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAllGetsComplete)}},async GetBinaryItem(b,d){if(d&&(d=d.GetFirstPicked(this._inst))){var c=d.GetSdkInstance();this._pendingGets++;try{let f=await this._storage.getItem(b);f=f instanceof ArrayBuffer?f:new ArrayBuffer(0);await this.ScheduleTriggers(async()=>{this._lastValue="";this._currentKey=b;c.SetArrayBufferTransfer(f);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAnyItemGet);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnItemGet)})}catch(f){await this._TriggerStorageError(f)}finally{this._pendingGets--,0===this._pendingGets&&await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAllGetsComplete)}}},async CheckItemExists(b){try{const d=await this._storage.getItem(b);await this.ScheduleTriggers(async()=>{this._currentKey=b;"undefined"===typeof d||null===d?(this._lastValue="",await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnItemMissing)):(this._lastValue=a(d)?d:"",await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnItemExists))})}catch(d){await this._TriggerStorageError(d)}},async RemoveItem(b){try{await this._storage.removeItem(b),await this.ScheduleTriggers(async()=>{this._currentKey=b;this._lastValue="";await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAnyItemRemoved);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnItemRemoved)})}catch(d){await this._TriggerStorageError(d)}},async ClearStorage(){try{await this._storage.clear(),await this.ScheduleTriggers(async()=>{this._lastValue=this._currentKey="";e.clearArray(this._keyNamesList);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnCleared)})}catch(b){await this._TriggerStorageError(b)}},async GetAllKeyNames(){try{const b=await this._storage.keys();await this.ScheduleTriggers(async()=>{this._keyNamesList=b;await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAllKeyNamesLoaded)})}catch(b){await this._TriggerStorageError(b)}}}}"use strict";self.C3.Plugins.LocalStorage.Exps={ItemValue(){return this._lastValue},Key(){return this._currentKey},KeyCount(){return this._keyNamesList.length},KeyAt(e){e=Math.floor(e);return 0>e||e>=this._keyNamesList.length?"":this._keyNamesList[e]},ErrorMessage(){return this._errorMessage}};{"use strict";const e=self.C3;e.Plugins.Text=class extends e.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Plugins.Text.Type=class extends e.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}LoadTextures(a){}ReleaseTextures(){}}}
  {"use strict";const e=self.C3,a=self.C3X,b=[0,0,0],d=["left","center","right"],c=["top","center","bottom"],f=new e.Rect,h=new e.Quad,g=new e.Color;e.Plugins.Text.Instance=class extends e.SDKWorldInstanceBase{constructor(n,q){super(n);this._text="";this._enableBBcode=!0;this._faceName="Arial";this._ptSize=12;this._lineHeightOffset=0;this._isItalic=this._isBold=!1;this._color=e.New(e.Color);this._verticalAlign=this._horizontalAlign=0;this._wrapByWord=!0;this._typewriterEndTime=this._typewriterStartTime=-1;this._typewriterLength=0;this._rendererText=e.New(e.Gfx.RendererText,this._runtime.GetRenderer(),{timeout:5});this._rendererText.ontextureupdate=()=>this._runtime.UpdateRender();this._rendererText.SetIsAsync(!1);q&&(this._text=q[0],this._enableBBcode=!!q[1],this._faceName=q[2],this._ptSize=q[3],this._lineHeightOffset=q[4],this._isBold=!!q[5],this._isItalic=!!q[6],this._horizontalAlign=q[8],this._verticalAlign=q[9],this._wrapByWord=0===q[10],n=q[7],this._color.setRgb(n[0],n[1],n[2]),this.GetWorldInfo().SetVisible(q[11]));this._UpdateTextSettings()}Release(){this._CancelTypewriter();this._rendererText.Release();this._rendererText=null;super.Release()}_UpdateTextSettings(){const n=this._rendererText;n.SetText(this._text);n.SetBBCodeEnabled(this._enableBBcode);n.SetFontName(this._faceName);n.SetLineHeight(this._lineHeightOffset);n.SetBold(this._isBold);n.SetItalic(this._isItalic);n.SetColor(this._color);n.SetHorizontalAlignment(d[this._horizontalAlign]);n.SetVerticalAlignment(c[this._verticalAlign]);n.SetWordWrapMode(this._wrapByWord?"word":"character")}_UpdateTextSize(){const n=this.GetWorldInfo();this._rendererText.SetFontSize(this._ptSize);this._rendererText.SetFontSizeScale(n.GetSceneGraphScale());var q=n.GetLayer();q=q.GetRenderScale()*q.Get2DScaleFactorToZ(n.GetTotalZElevation());this._rendererText.SetSize(n.GetWidth(),n.GetHeight(),q)}Draw(n){var q=this.GetWorldInfo();this._UpdateTextSize();const t=this._rendererText.GetTexture();if(t){var r=q.GetLayer();if(0===q.GetAngle()&&0===r.GetAngle()&&0===q.GetTotalZElevation()&&!q.HasMesh()&&r.RendersIn2DMode()){q=q.GetBoundingQuad();const[w,y]=r.LayerToDrawSurface(q.getTlx(),q.getTly()),[B,E]=r.LayerToDrawSurface(q.getBrx(),q.getBry());q=w-Math.round(w);const H=y-Math.round(y);f.set(w,y,B,E);f.offset(-q,-H);h.setFromRect(f);const[K,C]=n.GetRenderTargetSize(n.GetRenderTarget());this._runtime.GetCanvasManager().SetDeviceTransform(n,K,C);n.SetTexture(t);n.Quad3(h,this._rendererText.GetTexRect());r._SetTransform(n)}else n.SetTexture(t),q.HasMesh()?this._DrawMesh(q,n):this._DrawStandard(q,n)}}_DrawStandard(n,q){n=n.GetBoundingQuad();this._runtime.IsPixelRoundingEnabled()&&(n=this._PixelRoundQuad(n));q.Quad3(n,this._rendererText.GetTexRect())}_DrawMesh(n,q){const t=n.GetTransformedMesh();if(n.IsMeshChanged()){n.CalculateBbox(f,h,!1);let r=h;this._runtime.IsPixelRoundingEnabled()&&(r=this._PixelRoundQuad(r));t.CalculateTransformedMesh(n.GetSourceMesh(),r,this._rendererText.GetTexRect());n.SetMeshChanged(!1)}t.Draw(q)}_PixelRoundQuad(n){const q=n.getTlx()-Math.round(n.getTlx()),t=n.getTly()-
  Math.round(n.getTly());if(0===q&&0===t)return n;h.copy(n);h.offset(-q,-t);return h}SaveToJson(){const n={t:this._text,c:this._color.toJSON(),fn:this._faceName,ps:this._ptSize};this._enableBBcode&&(n.bbc=this._enableBBcode);0!==this._horizontalAlign&&(n.ha=this._horizontalAlign);0!==this._verticalAlign&&(n.va=this._verticalAlign);this._wrapByWord||(n.wr=this._wrapByWord);0!==this._lineHeightOffset&&(n.lho=this._lineHeightOffset);this._isBold&&(n.b=this._isBold);this._isItalic&&(n.i=this._isItalic);-1!==this._typewriterEndTime&&(n.tw={st:this._typewriterStartTime,en:this._typewriterEndTime,l:this._typewriterLength});return n}LoadFromJson(n){this._CancelTypewriter();this._text=n.t;this._color.setFromJSON(n.c);this._faceName=n.fn;this._ptSize=n.ps;this._enableBBcode=n.hasOwnProperty("bbc")?n.bbc:!1;this._horizontalAlign=n.hasOwnProperty("ha")?n.ha:0;this._verticalAlign=n.hasOwnProperty("va")?n.va:0;this._wrapByWord=n.hasOwnProperty("wr")?n.wr:!0;this._lineHeightOffset=n.hasOwnProperty("lho")?n.lho:0;this._isBold=n.hasOwnProperty("b")?n.b:!1;this._isItalic=n.hasOwnProperty("i")?n.i:!1;n.hasOwnProperty("tw")&&(n=n.tw,this._typewriterStartTime=n.st,this._typewriterEndTime=n.en,this._typewriterLength=n.l);this._UpdateTextSettings();-1!==this._typewriterEndTime&&this._StartTicking()}GetPropertyValueByIndex(n){switch(n){case 0:return this._text;case 1:return this._enableBBcode;case 2:return this._faceName;case 3:return this._ptSize;case 4:return this._lineHeightOffset;case 5:return this._isBold;case 6:return this._isItalic;case 7:return b[0]=this._color.getR(),b[1]=this._color.getG(),b[2]=this._color.getB(),b;case 8:return this._horizontalAlign;case 9:return this._verticalAlign;case 10:return this._wrapByWord?1:0}}SetPropertyValueByIndex(n,q){switch(n){case 0:if(this._text===q)break;this._text=q;this._UpdateTextSettings();break;case 1:if(this._enableBBcode===!!q)break;this._enableBBcode=!!q;this._UpdateTextSettings();break;case 2:if(this._faceName===q)break;this._faceName=q;this._UpdateTextSettings();break;case 3:if(this._ptSize===q)break;this._ptSize=q;this._UpdateTextSettings();break;case 4:if(this._lineHeightOffset===q)break;this._lineHeightOffset=q;this._UpdateTextSettings();break;case 5:if(this._isBold===!!q)break;this._isBold=!!q;this._UpdateTextSettings();break;case 6:if(this._isItalic===!!q)break;this._isItalic=!!q;this._UpdateTextSettings();break;case 7:n=this._color;if(n.getR()===q[0]&&n.getG()===q[1]&&n.getB()===q[2])break;this._color.setRgb(q[0],q[1],q[2]);this._UpdateTextSettings();break;case 8:if(this._horizontalAlign===q)break;this._horizontalAlign=q;this._UpdateTextSettings();break;case 9:if(this._verticalAlign===q)break;this._verticalAlign=q;this._UpdateTextSettings();break;case 10:this._wrapByWord!==(0===q)&&(this._wrapByWord=0===q,this._UpdateTextSettings())}}SetPropertyColorOffsetValueByIndex(n,q,t,r){if(0!==q||0!==t||0!==r)switch(n){case 7:this._color.addRgb(q,t,r),this._UpdateTextSettings()}}_SetText(n){this._text!==n&&(this._text=n,this._rendererText.SetText(n),this._runtime.UpdateRender())}GetText(){return this._text}_StartTypewriter(n,q){this._SetText(n);this._typewriterStartTime=this._runtime.GetWallTime();this._typewriterEndTime=this._typewriterStartTime+q/this.GetInstance().GetActiveTimeScale();this._typewriterLength=e.BBString.StripAnyTags(n).length;this._rendererText.SetDrawMaxCharacterCount(0);this._StartTicking()}_CancelTypewriter(){this._typewriterEndTime=this._typewriterStartTime=-1;this._typewriterLength=0;this._rendererText.SetDrawMaxCharacterCount(-1);this._StopTicking()}_FinishTypewriter(){-1!==this._typewriterEndTime&&(this._CancelTypewriter(),this.Trigger(e.Plugins.Text.Cnds.OnTypewriterTextFinished),this._runtime.UpdateRender())}_SetFontFace(n){this._faceName!==n&&(this._faceName=n,this._rendererText.SetFontName(n),this._runtime.UpdateRender())}_GetFontFace(){return this._faceName}_SetBold(n){n=!!n;this._isBold!==n&&(this._isBold=n,this._rendererText.SetBold(n),this._runtime.UpdateRender())}_IsBold(){return this._isBold}_SetItalic(n){n=!!n;this._isItalic!==n&&(this._isItalic=n,this._rendererText.SetItalic(n),this._runtime.UpdateRender())}_IsItalic(){return this._isItalic}_SetFontSize(n){this._ptSize!==n&&(this._ptSize=n,this._runtime.UpdateRender())}_GetFontSize(){return this._ptSize}_SetFontColor(n){this._color.equalsIgnoringAlpha(n)||(this._color.copyRgb(n),this._rendererText.SetColor(this._color),this._runtime.UpdateRender())}_GetFontColor(){return this._color}_SetLineHeight(n){this._lineHeightOffset!==n&&(this._lineHeightOffset=n,this._UpdateTextSettings(),this._runtime.UpdateRender())}_GetLineHeight(){return this._lineHeightOffset}_SetHAlign(n){this._horizontalAlign!==n&&(this._horizontalAlign=n,this._UpdateTextSettings(),this._runtime.UpdateRender())}_GetHAlign(){return this._horizontalAlign}_SetVAlign(n){this._verticalAlign!==n&&(this._verticalAlign=n,this._UpdateTextSettings(),this._runtime.UpdateRender())}_GetVAlign(){return this._verticalAlign}_SetWrapByWord(n){n=!!n;this._wrapByWord!==n&&(this._wrapByWord=n,this._UpdateTextSettings(),this._runtime.UpdateRender())}_IsWrapByWord(){return this._wrapByWord}_GetTextWidth(){this._UpdateTextSize();return this._rendererText.GetTextWidth()}_GetTextHeight(){this._UpdateTextSize();return this._rendererText.GetTextHeight()}Tick(){var n=this._runtime.GetWallTime();n>=this._typewriterEndTime?(this._CancelTypewriter(),this.Trigger(e.Plugins.Text.Cnds.OnTypewriterTextFinished),this._runtime.UpdateRender()):(n=e.relerp(this._typewriterStartTime,this._typewriterEndTime,n,0,this._typewriterLength),n=Math.floor(n),n!==this._rendererText.GetDrawMaxCharacterCount()&&(this._rendererText.SetDrawMaxCharacterCount(n),this._runtime.UpdateRender()))}GetDebuggerProperties(){return[{title:"plugins.text.name",properties:[{name:"plugins.text.properties.text.name",value:this._text,onedit:n=>this._SetText(n)}]}]}GetScriptInterfaceClass(){return self.ITextInstance}};const l=new WeakMap,m=new Map([["left",0],["center",1],["right",2]]),u=new Map([["top",0],["center",1],["bottom",2]]),x=new Map([["word",!0],["character",!1]]);self.ITextInstance=class extends self.IWorldInstance{constructor(){super();l.set(this,self.IInstance._GetInitInst().GetSdkInstance())}get text(){return l.get(this).GetText()}set text(n){a.RequireString(n);const q=l.get(this);q._CancelTypewriter();q._SetText(n)}typewriterText(n,q){a.RequireString(n);a.RequireFiniteNumber(q);const t=l.get(this);t._CancelTypewriter();t._StartTypewriter(n,q)}typewriterFinish(){l.get(this)._FinishTypewriter()}set fontFace(n){a.RequireString(n);l.get(this)._SetFontFace(n)}get fontFace(){return l.get(this)._GetFontFace()}set isBold(n){l.get(this)._SetBold(n)}get isBold(){return l.get(this)._IsBold()}set isItalic(n){l.get(this)._SetItalic(n)}get isItalic(){return l.get(this)._IsItalic()}set sizePt(n){a.RequireFiniteNumber(n);l.get(this)._SetFontSize(n)}get sizePt(){return l.get(this)._GetFontSize()}set fontColor(n){a.RequireArray(n);if(3>n.length)throw Error("expected 3 elements");g.setRgb(n[0],n[1],n[2]);l.get(this)._SetFontColor(g)}get fontColor(){const n=l.get(this)._GetFontColor();return[n.getR(),n.getG(),n.getB()]}set lineHeight(n){a.RequireFiniteNumber(n);l.get(this)._SetLineHeight(n)}get lineHeight(){return l.get(this)._GetLineHeight()}set horizontalAlign(n){a.RequireString(n);n=m.get(n);if("undefined"===typeof n)throw Error("invalid mode");l.get(this)._SetHAlign(n)}get horizontalAlign(){return d[l.get(this)._GetHAlign()]}set verticalAlign(n){a.RequireString(n);n=u.get(n);if("undefined"===typeof n)throw Error("invalid mode");l.get(this)._SetVAlign(n)}get verticalAlign(){return c[l.get(this)._GetVAlign()]}set wordWrapMode(n){a.RequireString(n);n=x.get(n);if("undefined"===typeof n)throw Error("invalid mode");l.get(this)._SetWrapByWord(n)}get wordWrapMode(){return l.get(this)._IsWrapByWord()?"word":"character"}get textWidth(){return l.get(this)._GetTextWidth()}get textHeight(){return l.get(this)._GetTextHeight()}}}
  {"use strict";const e=self.C3;e.Plugins.Text.Cnds={CompareText(a,b){return b?this._text===a:e.equalsNoCase(this._text,a)},IsRunningTypewriterText(){return-1!==this._typewriterEndTime},OnTypewriterTextFinished(){return!0}}}
  {"use strict";const e=self.C3,a=e.New(e.Color);e.Plugins.Text.Acts={SetText(b){this._CancelTypewriter();"number"===typeof b&&1E9>b&&(b=Math.round(1E10*b)/1E10);this._SetText(b.toString())},AppendText(b){this._CancelTypewriter();"number"===typeof b&&1E9>b&&(b=Math.round(1E10*b)/1E10);(b=b.toString())&&this._SetText(this._text+b)},TypewriterText(b,d){this._CancelTypewriter();"number"===typeof b&&1E9>b&&(b=Math.round(1E10*b)/1E10);this._StartTypewriter(b.toString(),d)},SetFontFace(b,d){let c=!1,f=!1;switch(d){case 1:c=!0;break;case 2:f=!0;break;case 3:f=c=!0}if(b!==this._faceName||c!==this._isBold||f!==this._isItalic)this._SetFontFace(b),this._SetBold(c),this._SetItalic(f)},SetFontSize(b){this._SetFontSize(b)},SetFontColor(b){a.setFromRgbValue(b);a.clamp();this._SetFontColor(a)},SetWebFont(b,d){console.warn("[Text] 'Set web font' action is deprecated and no longer has any effect")},SetEffect(b){this.GetWorldInfo().SetBlendMode(b);this._runtime.UpdateRender()},TypewriterFinish(){this._FinishTypewriter()},SetLineHeight(b){this._SetLineHeight(b)},SetHAlign(b){this._SetHAlign(b)},SetVAlign(b){this._SetVAlign(b)},SetWrapping(b){this._SetWrapByWord(0===b)}}}{"use strict";const e=self.C3;e.Plugins.Text.Exps={Text(){return this._text},PlainText(){return this._enableBBcode?e.BBString.StripAnyTags(this._text):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 e=self.C3;e.Plugins.Timeline=class extends e.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Plugins.Timeline.Type=class extends e.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}{"use strict";const e=self.C3;e.Plugins.Timeline.Instance=class extends e.SDKInstanceBase{constructor(a,b){super(a);this.GetRuntime().GetTimelineManager().SetPluginInstance(a)}Release(){super.Release()}}}
  {"use strict";const e=self.C3;let a=null,b=null;e.Plugins.Timeline.Cnds={SetTriggerTimeline(d){a=d},GetTriggerTimeline(){return a},SetTriggerKeyframe(d){b=d},GetTriggerKeyframe(){return b},OnTimelineStarted(d){return a===d},OnTimelineStartedByName(d){const c=this._runtime.GetTimelineManager();for(const f of c.GetTimelinesByName(d))if(e.equalsNoCase(a.GetName(),f.GetName()))return!0;return!1},OnTimelineStartedByTags(d){const c=this._runtime.GetTimelineManager();for(const f of c.GetTimelinesByTags(d))if(f.HasTags(a.GetTags()))return!0;return!1},OnAnyTimelineStarted(){return!0},OnTimelineFinished(d){return a===d},OnTimelineFinishedByName(d){const c=this._runtime.GetTimelineManager();for(const f of c.GetTimelinesByName(d))if(e.equalsNoCase(a.GetName(),f.GetName()))return!0;return!1},OnTimelineFinishedByTags(d){const c=this._runtime.GetTimelineManager();for(const f of c.GetTimelinesByTags(d))if(f.HasTags(a.GetTags()))return!0;return!1},OnAnyTimelineFinished(){return!0},IsPlaying(d){return d.IsPlaying()},IsPlayingByName(d){const c=this._runtime.GetTimelineManager();for(const f of c.GetTimelinesByName(d))if(f.IsPlaying())return!0;return!1},IsPlayingByTags(d){const c=this._runtime.GetTimelineManager();for(const f of c.GetTimelinesByTags(d))if(f.IsPlaying())return!0;return!1},IsAnyPlaying(){return[...this._runtime.GetTimelineManager().GetTimelines()].some(d=>d.IsPlaying())},IsPaused(d){return d.IsPaused()},IsPausedByName(d){const c=this._runtime.GetTimelineManager();for(const f of c.GetTimelinesByName(d))if(f.IsPaused())return!0;return!1},IsPausedByTags(d){const c=this._runtime.GetTimelineManager();for(const f of c.GetTimelinesByTags(d))if(f.IsPaused())return!0;return!1},IsAnyPaused(){return[...this._runtime.GetTimelineManager().GetTimelines()].some(d=>d.IsPaused())},OnTimeSet(d){return a===d},OnTimeSetByName(d){const c=this._runtime.GetTimelineManager();for(const f of c.GetTimelinesByName(d))if(a===f)return!0;return!1},OnTimeSetByTags(d){const c=this._runtime.GetTimelineManager();for(const f of c.GetTimelinesByTags(d))if(a===f)return!0;return!1},OnAnyKeyframeReached(){return!!b},OnKeyframeReached(d,c){if(!b||0===b.GetTags().length||!d)return!1;d=d?d.split(" "):[];if(0===c){for(const f of d)if(b.HasTag(f))return!0;return!1}for(const f of d)if(!b.HasTag(f))return!1;return!0}}}
  {"use strict";const e=self.C3,a=new Map,b=(c,f)=>{for(const h of c)f.SetTrackInstance(h.trackId,h.instance)},d=()=>{const c=[];for(const[f,h]of a.entries()){const g=f.GetCurrentSol().GetInstances(),l=h.trackIds.length;for(let m=0;m<l;m++)g[h.startIndex+m]&&c.push({trackId:h.trackIds[m],instance:g[h.startIndex+m]});h.startIndex+=l}return c};e.Plugins.Timeline.Acts={async PlayTimeline(c,f,h){if(c){var g=this._runtime.GetTimelineManager(),l=[];if(a.size){let u=d();do if(u.length){var m=g.GetTimelineOfTemplateForInstances(c,u);m||(m=g.CreateFromTemplate(c),m.ClearTrackInstances(),b(u,m));m.SetTags(f);m.Play()&&l.push(m.GetPlayPromise());u=d()}while(u.length)}else c.SetTags(f),c.Play()&&l.push(c.GetPlayPromise());h||a.clear();await Promise.all(l)}else h||a.clear()},async PlayTimelineByName(c,f){const h=this._runtime.GetTimelineManager(),g=[];for(const l of h.GetTimelinesByName(c))g.push(e.Plugins.Timeline.Acts.PlayTimeline.call(this,l,f,!0));a.clear();await Promise.all(g)},async PlayAllTimelines(){const c=this._runtime.GetTimelineManager(),f=[];for(const h of c.GetTimelines())h.Play()&&f.push(h.GetPlayPromise());a.clear();await Promise.all(f)},PauseTimeline(c){c&&c.Stop()},PauseTimelineByName(c){const f=this._runtime.GetTimelineManager();for(const h of f.GetTimelinesByName(c))e.Plugins.Timeline.Acts.PauseTimeline.call(this,h)},PauseTimelineByTags(c){const f=this._runtime.GetTimelineManager();for(const h of f.GetTimelinesByTags(c))e.Plugins.Timeline.Acts.PauseTimeline.call(this,h)},PauseAllTimelines(){const c=this._runtime.GetTimelineManager();for(const f of c.GetTimelines())f.Stop()},ResumeTimeline(c){c&&c.Resume()},ResumeTimelineByName(c){const f=this._runtime.GetTimelineManager();for(const h of f.GetTimelinesByName(c))e.Plugins.Timeline.Acts.ResumeTimeline.call(this,h)},ResumeTimelineByTags(c){const f=this._runtime.GetTimelineManager();for(const h of f.GetTimelinesByTags(c))e.Plugins.Timeline.Acts.ResumeTimeline.call(this,h)},ResumeAllTimelines(){const c=this._runtime.GetTimelineManager();for(const f of c.GetTimelines())f.Resume()},StopTimeline(c){c&&c.Reset()},StopTimelineByName(c){const f=this._runtime.GetTimelineManager();for(const h of f.GetTimelinesByName(c))e.Plugins.Timeline.Acts.StopTimeline.call(this,h)},StopTimelineByTags(c){const f=this._runtime.GetTimelineManager();for(const h of f.GetTimelinesByTags(c))e.Plugins.Timeline.Acts.StopTimeline.call(this,h)},StopAllTimelines(){const c=this._runtime.GetTimelineManager();for(const f of c.GetTimelines())f.Reset()},SetTimelineTime(c,f){if(c)if(e.IsFiniteNumber(f))c.SetTime(f);else if(e.IsString(f)){const h=c.GetKeyframeWithTags(f);h?c.SetTime(h.GetTime()):e.Plugins.Timeline.Acts.SetTimelineTime.call(this,c,Number(f))}},SetTimelineTimeByName(c,f){const h=this._runtime.GetTimelineManager();for(const g of h.GetTimelinesByName(c))e.Plugins.Timeline.Acts.SetTimelineTime.call(this,g,f)},SetTimelineTimeByTags(c,f){const h=this._runtime.GetTimelineManager();for(const g of h.GetTimelinesByTags(c))e.Plugins.Timeline.Acts.SetTimelineTime.call(this,g,f)},SetTimelinePlaybackRate(c,f){c&&c.SetPlaybackRate(f)},SetTimelinePlaybackRateByName(c,f){const h=this._runtime.GetTimelineManager();for(const g of h.GetTimelinesByName(c))e.Plugins.Timeline.Acts.SetTimelinePlaybackRate.call(this,g,f)},SetTimelinePlaybackRateByTags(c,f){const h=this._runtime.GetTimelineManager();for(const g of h.GetTimelinesByTags(c))e.Plugins.Timeline.Acts.SetTimelinePlaybackRate.call(this,g,f)},SetInstance(c,f){a.has(c)||a.set(c,{startIndex:0,trackIds:[]});a.get(c).trackIds.push(f)}}}
  {"use strict";const e=self.C3;e.Plugins.Timeline.Exps={Time(a){const b=this._runtime.GetTimelineManager();for(const d of b.GetTimelinesByName(a))return d.GetTime();for(const d of b.GetTimelinesByTags(a))return d.GetTime();return 0},TotalTime(a){const b=this._runtime.GetTimelineManager();for(const d of b.GetTimelinesByName(a))return d.GetTotalTime();for(const d of b.GetTimelinesByTags(a))return d.GetTotalTime();return 0},Progress(a){const b=this._runtime.GetTimelineManager();for(const d of b.GetTimelinesByName(a))return d.GetTime()/d.GetTotalTime();for(const d of b.GetTimelinesByTags(a))return d.GetTime()/d.GetTotalTime();return 0},KeyframeTags(){const a=e.Plugins.Timeline.Cnds.GetTriggerKeyframe();return a?a.GetTags().join(" "):""},TimelineName(){const a=e.Plugins.Timeline.Cnds.GetTriggerTimeline();return a?a.GetName():""},TimelineTags(){const a=e.Plugins.Timeline.Cnds.GetTriggerTimeline();return a?a.GetStringTags():""},Value(a,b){const d=this._runtime.GetTimelineManager();for(const f of d.GetTimelinesByName(a)){var c=f.GetTrackByName(b);if(c){if(c=c.GetPropertyTrack("value"))return c.GetSourceAdapterValue()}else if(c=f.GetTrackById(b))if(c=c.GetPropertyTrack("value"))return c.GetSourceAdapterValue()}for(const f of d.GetTimelinesByTags(a))if(a=f.GetTrackByName(b)){if(a=a.GetPropertyTrack("value"))return a.GetSourceAdapterValue()}else if(a=f.GetTrackById(b))if(a=a.GetPropertyTrack("value"))return a.GetSourceAdapterValue();return 0}}}{"use strict";const e=self.C3;e.Plugins.advert=class extends e.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}}}
  {"use strict";const e=self.C3;e.Plugins.advert.Type=class extends e.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}
  {"use strict";const e=self.C3;function a(b){console.log("[C3 advert]",b)}e.Plugins.advert.Instance=class extends e.SDKInstanceBase{constructor(b,d){super(b,"advert");this.testMode=!!d[0];this.consentStatus=this.rewardedInterstitialState=this.rewardedState=this.videoState=this.interstitialState=this.bannerState=this.keyState=null;this.idfaStatus="not-determined";this.isInEeaOrUnknown=!0;this.rewardType="";this.rewardValue=0;this.rewardInterstitialType="";this.rewardInterstitialValue=0;b=this._runtime.Dispatcher();this._disposables=new e.CompositeDisposable(e.Disposable.From(b,"beforeruntimestart",()=>this._OnBeforeRuntimeStart(d)),e.Disposable.From(b,"layoutchange",()=>this._OnLayoutChange()))}async _OnBeforeRuntimeStart(b){var d=b[1];const c=b[2],f=b[3],h=b[4],g=b[5],l=b[6],m=b[7];b=b[8];if(d=this._runtime.IsiOSCordova()?c:d)await this._StatusUpdate(m),this._SetPublicKey(d,f,g,h,l,m,b)}_OnLayoutChange(){"set"===this.keyState&&this.TriggerAsync(e.Plugins.advert.Cnds.OnConfigurationComplete)}async _StatusUpdate(b){try{b=["DISABLED","EEA","NOT_EEA"][b];const d=await this.PostToDOMAsync("StatusUpdate",[this.testMode,b]),[c,f,h]=d.split("&&");this.consentStatus=c;this.idfaStatus=f;this.isInEeaOrUnknown="false"!==h}catch(d){this.SetError("status failed to update",d)}}async _SetPublicKey(b,d,c,f,h,g,l){if(null===this.keyState){this.keyState="busy";h=["eu","always","never"][h];g=["DISABLED","EEA","NOT_EEA"][g];try{const m=await this.PostToDOMAsync("Configure",[b.trim(),d.trim(),c.trim(),f,h,this.testMode,g,l]),[u,x,n]=m.split("&&");this.isInEeaOrUnknown="false"!==n;this.keyState="set";this.consentStatus=u;this.idfaStatus=x;this.SetParameters("configuration complete");await this.TriggerAsync(e.Plugins.advert.Cnds.OnConfigurationComplete)}catch(m){this.keyState=null,this.SetError("configuration failed",m),await this.TriggerAsync(e.Plugins.advert.Cnds.OnConfigurationFailed)}}}PostToDOMAsync(b,d=[]){return super.PostToDOMAsync(b,d)}SetError(b,d){this.SetParameters(b,"string"===typeof d?d:d.message)}SetParameters(b,d="",c="",f=0,h=""){a(`Event (${b} Error (${d}) Type (${c}) Amount (${f}))`);this.errorMessage=d||"";switch(h){case "rewarded":this.rewardType=c||"";this.rewardValue=f||0;break;case "rewarded interstitial":this.rewardInterstitialType=c||"";this.rewardInterstitialValue=f||0;break;default:this.rewardType="",this.rewardValue=0,this.rewardInterstitialType="",this.rewardInterstitialValue=0}}}}"use strict";self.C3.Plugins.advert.Cnds={OnBannerReady(){return!0},OnVideoReady(){return!0},OnRewardedReady(){return!0},OnInterstitialReady(){return!0},OnRewardedInterstitialReady(){return!0},OnBannerFailedToLoad(){return!0},OnVideoFailedToLoad(){return!0},OnRewardedFailedToLoad(){return!0},OnInterstitialFailedToLoad(){return!0},OnRewardedInterstitialFailedToLoad(){return!0},OnBannerShown(){return!0},OnVideoComplete(){return!0},OnRewardedComplete(){return!0},OnInterstitialComplete(){return!0},OnRewardedInterstitialComplete(){return!0},OnBannerHidden(){return!0},OnVideoCancelled(){return!0},OnRewardedCancelled(){return!0},OnInterstitialCancelled(){return!0},OnRewardedInterstitialCancelled(){return!0},OnConfigurationFailed(){return!0},OnConfigurationComplete(){return!0},OnUserPersonalizationUpdated(){return!0},IsShowingBanner(){return"shown"===this.bannerState},IsShowingVideo(){return"shown"===this.videoState},IsShowingRewarded(){return"shown"===this.rewardedState},IsShowingInterstitial(){return"shown"===this.interstitialState},IsShowingRewardedInterstitial(){return"shown"===this.rewardedInterstitialState},IsInEeaOrUnknown(){return this.isInEeaOrUnknown},IsBannerLoaded(){return"loaded"===this.bannerState},IsVideoLoaded(){return"loaded"===this.videoState},IsRewardedLoaded(){return"loaded"===this.rewardedState},IsInterstitialLoaded(){return"loaded"===this.interstitialState},IsRewardedInterstitialLoaded(){return"loaded"===this.rewardedInterstitialState},IsConfigured(){return"set"===this.keyState},OnIDFARequestComplete(){return!0}};{"use strict";const e=self.C3,a="portrait landscape standard large medium full leaderboard".split(" "),b=["bottom","top"];e.Plugins.advert.Acts={async CreateBanner(d,c,f,h){if(null==this.bannerState){this.bannerState="busy";try{await this.PostToDOMAsync("CreateBannerAdvert",[d.trim(),a[c],this.testMode,b[h]]),this.bannerState="loaded",this.SetParameters("banner created"),await this.TriggerAsync(e.Plugins.advert.Cnds.OnBannerReady),0==f&&e.Plugins.advert.Acts.ShowBanner.call(this)}catch(g){this.bannerState=null,this.SetError("failed to create banner",g),await this.TriggerAsync(e.Plugins.advert.Cnds.OnBannerFailedToLoad)}}},async ShowBanner(){if("loaded"==this.bannerState){this.bannerState="busy";try{await this.PostToDOMAsync("ShowBannerAdvert"),this.bannerState="shown",this.SetParameters("banner shown"),await this.TriggerAsync(e.Plugins.advert.Cnds.OnBannerShown)}catch(d){this.bannerState=null,this.SetError("failed to show banner",d)}}},async HideBanner(){if("shown"==this.bannerState){this.bannerState="busy";try{await this.PostToDOMAsync("HideBannerAdvert"),this.bannerState=null,this.SetParameters("banner hidden"),await this.TriggerAsync(e.Plugins.advert.Cnds.OnBannerHidden)}catch(d){this.bannerState=null,this.SetError("failed to hide banner",d)}}},async CreateInterstitial(d,c){if(null==this.interstitialState){this.interstitialState="busy";try{await this.PostToDOMAsync("CreateInterstitialAdvert",[d.trim(),this.testMode]),this.interstitialState="loaded",this.SetParameters("interstitial created"),await this.TriggerAsync(e.Plugins.advert.Cnds.OnInterstitialReady),0==c&&e.Plugins.advert.Acts.ShowInterstitial.call(this)}catch(f){this.interstitialState=null,this.SetError("failed to create interstitial",f),await this.TriggerAsync(e.Plugins.advert.Cnds.OnInterstitialFailedToLoad)}}},async ShowInterstitial(){if("loaded"==this.interstitialState){this.interstitialState="shown";try{await this.PostToDOMAsync("ShowInterstitialAdvert"),this.interstitialState=null,this.SetParameters("interstitial completed"),await this.TriggerAsync(e.Plugins.advert.Cnds.OnInterstitialComplete)}catch(d){this.interstitialState=null,this.SetError("interstitial cancelled",d),await this.TriggerAsync(e.Plugins.advert.Cnds.OnInterstitialCancelled)}}},async CreateVideo(d,c){if(null==this.videoState&&null==this.rewardedState){this.videoState="busy";try{await this.PostToDOMAsync("CreateVideoAdvert",[d.trim(),this.testMode]),this.videoState="loaded",this.SetParameters("video created"),await this.TriggerAsync(e.Plugins.advert.Cnds.OnVideoReady),0==c&&e.Plugins.advert.Acts.ShowVideo.call(this)}catch(f){this.videoState=null,this.SetError("failed to create video",f),await this.TriggerAsync(e.Plugins.advert.Cnds.OnVideoFailedToLoad)}}},async ShowVideo(){if("loaded"==this.videoState){this.videoState="shown";try{const d=await this.PostToDOMAsync("ShowVideoAdvert"),[c,f]=JSON.parse(d);this.videoState=null;this.SetParameters("video completed",null,c,f);await this.TriggerAsync(e.Plugins.advert.Cnds.OnVideoComplete)}catch(d){this.videoState=null,this.SetError("video cancelled",d),await this.TriggerAsync(e.Plugins.advert.Cnds.OnVideoCancelled)}}},async CreateRewarded(d,c){if(null==this.rewardedState&&null==this.videoState){this.rewardedState="busy";try{await this.PostToDOMAsync("CreateRewardedAdvert",[d.trim(),this.testMode]),this.rewardedState="loaded",this.SetParameters("rewarded created"),await this.TriggerAsync(e.Plugins.advert.Cnds.OnRewardedReady),0==c&&e.Plugins.advert.Acts.ShowRewarded.call(this)}catch(f){this.rewardedState=null,this.SetError("failed to create rewarded",f),await this.TriggerAsync(e.Plugins.advert.Cnds.OnRewardedFailedToLoad)}}},async ShowRewarded(){if("loaded"==this.rewardedState){this.rewardedState="shown";try{const d=await this.PostToDOMAsync("ShowRewardedAdvert"),[c,f]=JSON.parse(d);this.rewardedState=null;this.SetParameters("rewarded completed",null,c,f,"rewarded");await this.TriggerAsync(e.Plugins.advert.Cnds.OnRewardedComplete)}catch(d){this.rewardedState=null,this.SetError("rewarded cancelled",d),await this.TriggerAsync(e.Plugins.advert.Cnds.OnRewardedCancelled)}}},async CreateRewardedInterstitial(d,c){if(null==this.rewardedInterstitialState){this.rewardedInterstitialState="busy";try{await this.PostToDOMAsync("CreateRewardedInterstitialAdvert",[d.trim(),this.testMode]),this.rewardedInterstitialState="loaded",this.SetParameters("rewarded interstitial created"),await this.TriggerAsync(e.Plugins.advert.Cnds.OnRewardedInterstitialReady),0==c&&e.Plugins.advert.Acts.ShowRewardedInterstitial.call(this)}catch(f){this.rewardedInterstitialState=null,this.SetError("failed to create rewarded interstitial",f),await this.TriggerAsync(e.Plugins.advert.Cnds.OnRewardedInterstitialFailedToLoad)}}},async ShowRewardedInterstitial(){if("loaded"==this.rewardedInterstitialState){this.rewardedInterstitialState="shown";try{const d=await this.PostToDOMAsync("ShowRewardedInterstitialAdvert"),[c,f]=JSON.parse(d);this.rewardedInterstitialState=null;this.SetParameters("rewarded interstitial completed",null,c,f,"rewarded interstitial");await this.TriggerAsync(e.Plugins.advert.Cnds.OnRewardedInterstitialComplete)}catch(d){this.rewardedInterstitialState=null,this.SetError("rewarded interstitial cancelled",d),await this.TriggerAsync(e.Plugins.advert.Cnds.OnRewardedInterstitialCancelled)}}},SetPublicKey(d,c,f,h,g,l){h=[!0,!1][h];this._SetPublicKey(d,c,f,h,g,l)},async ShowConsentDialog(){if("set"===this.keyState){this.keyState="busy";try{const d=this.idfaStatus,c=await this.PostToDOMAsync("RequestConsent"),[f,h]=c.split("&&");this.keyState="set";this.consentStatus=f;this.idfaStatus=h;d!==this.idfaStatus&&this.Trigger(e.Plugins.advert.Cnds.OnIDFARequestComplete);this.SetParameters("configuration complete");await this.TriggerAsync(e.Plugins.advert.Cnds.OnConfigurationComplete)}catch(d){this.keyState="set",this.SetError("configuration failed",d),await this.TriggerAsync(e.Plugins.advert.Cnds.OnConfigurationFailed)}}},async SetUserPersonalization(d){},async SetMaxAdContentRating(d){if("set"===this.keyState)try{await this.PostToDOMAsync("SetMaxAdContentRating",[["G","PG","T","MA"][d]])}catch(c){}},async TagForChildDirectedTreatment(d){if("set"===this.keyState)try{await this.PostToDOMAsync("TagForChildDirectedTreatment",[d?1:0])}catch(c){}},async TagForUnderAgeOfConsent(d){if("set"===this.keyState)try{await this.PostToDOMAsync("TagForUnderAgeOfConsent",[d?1:0])}catch(c){}},async RequestIDFA(){try{this.idfaStatus=await this.PostToDOMAsync("RequestIDFA")}catch(d){console.warn("Error requesting IDFA: ",d),this.idfaStatus="error"}this.Trigger(e.Plugins.advert.Cnds.OnIDFARequestComplete)}}}"use strict";self.C3.Plugins.advert.Exps={ErrorMessage(){return this.errorMessage||""},RewardType(){return this.rewardType||""},RewardValue(){return this.rewardValue||0},RewardInterstitialType(){return this.rewardInterstitialType||""},RewardInterstitialValue(){return this.rewardInterstitialValue||0},ConsentStatus(){return this.consentStatus||"UNKNOWN"},IDFAStatus(){return this.idfaStatus}};{"use strict";const e=self.C3,a=self.C3X;let b=null,d=null,c=[],f=null,h=null;function g(m,u,x){var n=m.GetSavedDataMap();const q=u.GetSavedDataMap();x?((n=n.get("Physics_DisabledCollisions"))&&n.delete(u.GetSID()),(u=q.get("Physics_DisabledCollisions"))&&u.delete(m.GetSID())):(x=n.get("Physics_DisabledCollisions"),x||(x=new Set,n.set("Physics_DisabledCollisions",x)),n=q.get("Physics_DisabledCollisions"),n||(n=new Set,q.set("Physics_DisabledCollisions",n)),x.add(u.GetSID()),n.add(m.GetSID()))}e.Behaviors.Physics=class extends e.SDKBehaviorBase{constructor(m){m.scriptInterfaceClass=self.IPhysicsBehavior;super(m);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=!0;this._runtime.AddLoadPromise(this._LoadBox2DWasm())}async _LoadBox2DWasm(){const m=await this._runtime.GetAssetManager().GetProjectFileUrl("box2d.wasm");await new Promise(u=>{self.Box2DWasmModule({wasmBinaryFile:m}).then(x=>{f=x;this._InitBox2DWorld();u()})})}_InitBox2DWorld(){const m=this._runtime.GetCollisionEngine();b=e.Behaviors.Physics.GetVec2(0,0);d=e.Behaviors.Physics.GetVec2(0,0);this._world=new f.b2World(e.Behaviors.Physics.GetTempVec2A(0,this._worldG),!0);var u=new f.JSContactListener;u.BeginContact=x=>{var n=f.wrapPointer(x,f.b2Contact);x=e.Behaviors.Physics.Instance.LookupBehInstFromBody(n.GetFixtureA().GetBody());n=e.Behaviors.Physics.Instance.LookupBehInstFromBody(n.GetFixtureB().GetBody());m.RegisterCollision(x.GetObjectInstance(),n.GetObjectInstance())};u.EndContact=()=>{};u.PreSolve=()=>{};u.PostSolve=()=>{};this._world.SetContactListener(u);u=new f.JSContactFilter;u.ShouldCollide=(x,n)=>{if(this._allCollisionsEnabled)return!0;x=f.wrapPointer(x,f.b2Fixture);n=f.wrapPointer(n,f.b2Fixture);x=e.Behaviors.Physics.Instance.LookupBehInstFromBody(x.GetBody());n=e.Behaviors.Physics.Instance.LookupBehInstFromBody(n.GetBody());x=x.GetObjectInstance().GetObjectClass();const q=n.GetObjectInstance().GetObjectClass();n=x.GetSID();const t=q.GetSID();return(x=x.GetSavedDataMap().get("Physics_DisabledCollisions"))&&x.has(t)?!1:(x=q.GetSavedDataMap().get("Physics_DisabledCollisions"))&&x.has(n)?!1:!0};this._world.SetContactFilter(u);this._worldManifold=new f.b2WorldManifold}Release(){super.Release()}GetBox2D(){return f}GetWorld(){return this._world}GetWorldScale(){return this._worldScale}GetSteppingMode(){return this._steppingMode}SetSteppingMode(m){this._steppingMode=m}SetLastUpdateTick(m){this._lastUpdateTick=m}GetLastUpdateTick(){return this._lastUpdateTick}SetVelocityIterations(m){this._velocityIterations=Math.max(m,1)}GetVelocityIterations(){return this._velocityIterations}SetPositionIterations(m){this._positionIterations=Math.max(m,1)}GetPositionIterations(){return this._positionIterations}SetIterations(m,u){this.SetVelocityIterations(m);this.SetPositionIterations(u)}GetGravity(){return this._worldG}SetGravity(m){m!==this._worldG&&(this._world.SetGravity(e.Behaviors.Physics.GetTempVec2A(0,m)),this._worldG=m,this._WakeUpAllPhysicsBodies())}_WakeUpAllPhysicsBodies(){for(const u of this.GetInstances()){var m=e.Behaviors.Physics.Instance.LookupBehInstFromInst(u);m&&(m=m.GetBody())&&m.SetAwake(!0)}}DisableShouldCollideFastPath(){this._allCollisionsEnabled=!1}SetCollisionsEnabled(m,u,x){x=!!x;if(m&&u){if(u.IsFamily())for(const n of u.GetFamilyMembers())g(m,n,x);else g(m,u,x);this.DisableShouldCollideFastPath()}}GetWorldManifold(){return this._worldManifold}static GetPhysicsCollisionKey(){return"Physics_DisabledCollisions"}static GetVec2(m,u){if(c.length){const x=c.pop();x.set_x(m);x.set_y(u);return x}return new f.b2Vec2(m,u)}static FreeVec2(m){c.push(m)}static GetTempVec2A(m,u){b.set_x(m);b.set_y(u);return b}static GetTempVec2B(m,u){d.set_x(m);d.set_y(u);return d}static CreatePolygonShape(m){const u=new f.b2PolygonShape,x=f._malloc(8*m.length);var n=0;for(let q=0;q<m.length;++q)f.HEAPF32[x+n>>2]=m[q].get_x(),f.HEAPF32[x+(n+4)>>2]=m[q].get_y(),n+=8;n=f.wrapPointer(x,f.b2Vec2);u.Set(n,m.length);f._free(x);return u}};const l=["fixed","variable"];self.IPhysicsBehavior=class extends self.IBehavior{constructor(m){super(m);h=m}set worldGravity(m){a.RequireFiniteNumber(m);h.SetGravity(m)}get worldGravity(){return h.GetGravity()}set steppingMode(m){m=l.indexOf(m);if(0>m)throw Error("invalid stepping mode");h.SetSteppingMode(l[m])}get steppingMode(){return l[h.GetSteppingMode()]}set velocityIterations(m){a.RequireFiniteNumber(m);h.SetVelocityIterations(m)}get velocityIterations(){return h.GetVelocityIterations()}set positionIterations(m){a.RequireFiniteNumber(m);h.SetPositionIterations(m)}get positionIterations(){return h.GetPositionIterations()}setCollisionsEnabled(m,u,x){const n=h.GetRuntime();m=n._UnwrapIObjectClass(m);u=n._UnwrapIObjectClass(u);h.SetCollisionsEnabled(m,u,!!x)}}}{"use strict";const e=self.C3;e.Behaviors.Physics.Type=class extends e.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}
  {"use strict";const e=self.C3,a=self.C3X,b=self.IBehaviorInstance,d=new WeakMap,c=new WeakMap,f=new WeakMap,h=e.Behaviors.Physics.GetTempVec2A,g=e.Behaviors.Physics.GetTempVec2B,l=e.New(e.Rect),m=e.New(e.Quad);e.Behaviors.Physics.Instance=class extends e.SDKBehaviorInstanceBase{constructor(n,q){super(n);n=this.GetBehavior();const t=this.GetWorldInfo();this._box2d=n.GetBox2D();this._world=n.GetWorld();this._worldScale=n.GetWorldScale();this._isImmovable=!1;this._collisionMask=0;this._preventRotation=!1;this._density=1;this._friction=.5;this._restitution=.2;this._linearDamping=0;this._angularDamping=.01;this._isBullet=!1;this._isEnabled=!0;this._body=null;this._fixtures=[];this._myJoints=[];this._myCreatedJoints=[];this._joiningMe=new Set;this._lastKnownX=t.GetX();this._lastKnownY=t.GetY();this._lastKnownAngle=t.GetAngle();this._lastHeight=this._lastWidth=0;this._lastTickOverride=!1;q&&(this._isImmovable=!!q[0],this._collisionMask=q[1],this._preventRotation=!!q[2],this._density=q[3],this._friction=q[4],this._restitution=q[5],this._linearDamping=q[6],this._angularDamping=q[7],this._isBullet=!!q[8],this._isEnabled=!!q[9]);q=this._runtime.Dispatcher();this._disposables=new e.CompositeDisposable(e.Disposable.From(q,"instancedestroy",r=>this._OnInstanceDestroyed(r.instance)),e.Disposable.From(q,"beforeload",()=>this._OnBeforeLoad()),e.Disposable.From(q,"afterload",()=>this._OnAfterLoad()));c.set(this._inst,this);this._isEnabled&&this._StartTicking()}PostCreate(){this._CreateBody()}Release(){this._DestroyMyJoints();e.clearArray(this._myCreatedJoints);this._joiningMe.clear();this._body&&(this._DestroyFixtures(),this._world.DestroyBody(this._body),this._body=null);super.Release()}_CreateFixture(n){if(this._body)return n=this._body.CreateFixture(n),this._fixtures.push(n),n}_DestroyFixtures(){if(this._body){for(const n of this._fixtures)this._body.DestroyFixture(n);e.clearArray(this._fixtures)}}_GetBoundingQuadExcludingMesh(){const n=this.GetWorldInfo();return n.HasMesh()?(n.CalculateBbox(l,m,!1),m):n.GetBoundingQuad()}_Destroy(n){this._box2d.destroy(n)}_CreateBody(){if(this._isEnabled){var n=this._box2d.b2FixtureDef,q=this._box2d.b2BodyDef,t=this.GetWorldInfo();if(!this._body){q=new q;q.set_type(this._isImmovable?0:2);var r=this._GetBoundingQuadExcludingMesh();q.set_position(g(r.midX()*this._worldScale,r.midY()*this._worldScale));q.set_angle(t.GetAngle());q.set_fixedRotation(this._preventRotation);q.set_linearDamping(this._linearDamping);q.set_angularDamping(this._angularDamping);q.set_bullet(this._isBullet);this._body=this._world.CreateBody(q);this._Destroy(q);d.set(this._body,this)}this._DestroyFixtures();n=new n;n.set_density(this._density);n.set_friction(this._friction);n.set_restitution(this._restitution);r=t.HasOwnCollisionPoly();q=this._collisionMask;r||this._inst.HasTilemap()||0!==q||(q=1);r=Math.max(Math.abs(t.GetWidth()),1);var w=Math.max(Math.abs(t.GetHeight()),1);0===q?this._inst.HasTilemap()?this._CreateTilemapFixtures(n):this._CreatePolygonFixture(n,r,w):1===q?this._CreateBoundingBoxFixture(n,r,w):this._CreateCircleFixture(n,r,w);this._lastWidth=t.GetWidth();this._lastHeight=t.GetHeight();t.SetPhysicsBodyChanged(!1);this._Destroy(n)}}_CreateBoundingBoxFixture(n,q,t){const r=new this._box2d.b2PolygonShape;r.SetAsBox(q*this._worldScale*.5,t*this._worldScale*.5);n.set_shape(r);this._CreateFixture(n);this._Destroy(r)}_CreateCircleFixture(n,q,t){const r=new this._box2d.b2CircleShape;r.set_m_radius(Math.min(q,t)*this._worldScale*.5);n.set_shape(r);this._CreateFixture(n);this._Destroy(r)}_CreatePolygonFixture(n,q,t){var r=this.GetWorldInfo(),w=0>r.GetWidth();const y=0>r.GetHeight(),B=this._worldScale;var E=r.GetAngle();0!==E&&(r.SetAngle(0),r.SetBboxChanged());var H=this._GetBoundingQuadExcludingMesh();const K=H.midX()-r.GetX();H=H.midY()-r.GetY();0!==E&&(r.SetAngle(E),r.SetBboxChanged());E=r.GetCustomTransformedCollisionPoly(w?-q:q,y?-t:t,0).pointsArr();const C=E.length/2;r=[];for(let A=0;A<C;++A)r.push(e.Behaviors.Physics.GetVec2(E[2*A]-K,E[2*A+1]-H));w!==y&&r.reverse();w=e.Behaviors.Physics.Separator.Separate(r,q*t);for(const A of r)e.Behaviors.Physics.FreeVec2(A);if(w.length)for(const A of w){for(const F of A)F.set_x(F.get_x()*B),F.set_y(F.get_y()*B);q=e.Behaviors.Physics.CreatePolygonShape(A);n.set_shape(q);this._CreateFixture(n);this._Destroy(q);for(const F of A)e.Behaviors.Physics.FreeVec2(F)}else this._CreateBoundingBoxFixture(n,q,t)}_CreateTilemapFixtures(n){var q=this.GetWorldInfo(),t=this._GetBoundingQuadExcludingMesh();const r=t.midX()-q.GetX();q=t.midY()-q.GetY();t=this._worldScale;const w=e.Behaviors.Physics.GetVec2,y=e.Behaviors.Physics.FreeVec2,B=[];this._inst.GetSdkInstance().GetAllCollisionRects(B);const E=[];for(let F=0,J=B.length;F<J;++F){var H=B[F],K=H.GetRect(),C=H.GetPoly();if(C){var A=f.get(C);if(!A){A=C.pointsArr();const L=C.pointCount();for(let R=0;R<L;++R)E.push(w(A[2*R],A[2*R+1]));H=H.GetTileId()&3758096384;(-2147483648===H||1073741824===H||536870912===H||H&-2147483648&&H&1073741824&&H&536870912)&&E.reverse();A=e.Behaviors.Physics.Separator.Separate(E,K.width()*K.height());f.set(C,A);for(const R of E)y(R);e.clearArray(E)}for(let L=0,R=A.length;L<R;++L){C=A[L];for(let T=0,V=C.length;T<V;++T)E.push(w((K.getLeft()+
  C[T].get_x()-r)*t,(K.getTop()+C[T].get_y()-q)*t));C=e.Behaviors.Physics.CreatePolygonShape(E);n.set_shape(C);this._CreateFixture(n);this._Destroy(C);for(const T of E)y(T);e.clearArray(E)}}else E.push(w((K.getLeft()-r)*t,(K.getTop()-q)*t)),E.push(w((K.getRight()-r)*t,(K.getTop()-q)*t)),E.push(w((K.getRight()-r)*t,(K.getBottom()-q)*t)),E.push(w((K.getLeft()-r)*t,(K.getBottom()-q)*t)),K=e.Behaviors.Physics.CreatePolygonShape(E),n.set_shape(K),this._CreateFixture(n),this._Destroy(K);for(const L of E)y(L);e.clearArray(E)}}_DestroyBody(){this._body&&(this._DestroyMyJoints(),d.delete(this._body),this._DestroyFixtures(),this._world.DestroyBody(this._body),this._body=null)}_DestroyMyJoints(){for(const n of this._myJoints)this._world.DestroyJoint(n);e.clearArray(this._myJoints)}_RecreateMyJoints(){for(const n of this._myCreatedJoints)switch(n.type){case 0:this._DoCreateDistanceJoint(...n.params);break;case 1:this._DoCreateRevoluteJoint(...n.params);break;case 2:this._DoCreateLimitedRevoluteJoint(...n.params);break;case 3:this._DoCreatePrismaticJoint(...n.params)}}_GetInstImagePoint(n){var q=this.GetWorldInfo();return-1===n?[q.GetX(),q.GetY()]:0===n&&this._body?(n=this._body.GetPosition(),q=this._body.GetLocalCenter(),[(n.get_x()+q.get_x())/this._worldScale,(n.get_y()+q.get_y())/this._worldScale]):this._inst.GetImagePoint(n)}_CreateDistanceJoint(n,q,t,r,w){this._isEnabled&&q&&q!==this._inst&&e.Behaviors.Physics.Instance.LookupBehInstFromInst(q)&&(this._myCreatedJoints.push({type:0,params:[n,q.GetUID(),t,r,w]}),this._DoCreateDistanceJoint(n,q.GetUID(),t,r,w))}_DoCreateDistanceJoint(n,q,t,r,w){if(this._isEnabled){var y=this._runtime.GetInstanceByUID(q);if(y&&y!==this._inst&&c.has(y)){q=e.Behaviors.Physics.Instance.LookupBehInstFromInst(y);q._joiningMe.add(this._inst);this._UpdateBodyToMatchInstance(!1);q._UpdateBodyToMatchInstance(!1);var[B,E]=this._GetInstImagePoint(n),[H,K]=y.GetImagePoint(t);n=B-H;t=E-K;y=this._worldScale;var C=new this._box2d.b2DistanceJointDef;C.Initialize(this._body,q.GetBody(),h(B*y,E*y),g(H*y,K*y));C.set_length(Math.hypot(n,t)*y);C.set_dampingRatio(r);C.set_frequencyHz(w);this._myJoints.push(this._world.CreateJoint(C));this._Destroy(C)}}}_CreateRevoluteJoint(n,q){this._isEnabled&&q&&q!==this._inst&&e.Behaviors.Physics.Instance.LookupBehInstFromInst(q)&&(this._myCreatedJoints.push({type:1,params:[n,q.GetUID()]}),this._DoCreateRevoluteJoint(n,q.GetUID()))}_DoCreateRevoluteJoint(n,q){if(this._isEnabled&&(q=this._runtime.GetInstanceByUID(q))&&q!==this._inst&&c.has(q)){q=e.Behaviors.Physics.Instance.LookupBehInstFromInst(q);q._joiningMe.add(this._inst);this._UpdateBodyToMatchInstance(!1);q._UpdateBodyToMatchInstance(!1);var[t,r]=this._GetInstImagePoint(n);n=this._worldScale;var w=new this._box2d.b2RevoluteJointDef;w.Initialize(this._body,q.GetBody(),h(t*n,r*n));this._myJoints.push(this._world.CreateJoint(w));this._Destroy(w)}}_CreateLimitedRevoluteJoint(n,q,t,r){this._isEnabled&&q&&q!==this._inst&&e.Behaviors.Physics.Instance.LookupBehInstFromInst(q)&&(t=e.toDegrees(t),r=e.toDegrees(r),this._myCreatedJoints.push({type:2,params:[n,q.GetUID(),t,r]}),this._DoCreateLimitedRevoluteJoint(n,q.GetUID(),t,r))}_DoCreateLimitedRevoluteJoint(n,q,t,r){if(this._isEnabled&&(q=this._runtime.GetInstanceByUID(q))&&q!==this._inst&&c.has(q)){q=e.Behaviors.Physics.Instance.LookupBehInstFromInst(q);q._joiningMe.add(this._inst);this._UpdateBodyToMatchInstance(!1);q._UpdateBodyToMatchInstance(!1);var[w,y]=this._GetInstImagePoint(n);n=this._worldScale;var B=new this._box2d.b2RevoluteJointDef;B.Initialize(this._body,q.GetBody(),h(w*n,y*n));B.set_enableLimit(!0);B.set_lowerAngle(e.toRadians(t));B.set_upperAngle(e.toRadians(r));this._myJoints.push(this._world.CreateJoint(B));this._Destroy(B)}}_CreatePrismaticJoint(n,q,t,r,w,y,B,E,H){this._isEnabled&&q&&q!==this._inst&&e.Behaviors.Physics.Instance.LookupBehInstFromInst(q)&&(t=e.toDegrees(t),E=e.toDegrees(E),this._myCreatedJoints.push({type:3,params:[n,q.GetUID(),t,r,w,y,B,E,H]}),this._DoCreatePrismaticJoint(n,q.GetUID(),t,r,w,y,B,E,H))}_DoCreatePrismaticJoint(n,q,t,r,w,y,B,E,H){if(this._isEnabled&&(q=this._runtime.GetInstanceByUID(q))&&q!==this._inst&&c.has(q)){q=e.Behaviors.Physics.Instance.LookupBehInstFromInst(q);q._joiningMe.add(this._inst);this._UpdateBodyToMatchInstance(!1);q._UpdateBodyToMatchInstance(!1);var[K,C]=this._GetInstImagePoint(n);t=e.toRadians(t);n=Math.cos(t);t=Math.sin(t);var A=this._worldScale,F=new this._box2d.b2PrismaticJointDef;F.Initialize(this._body,q.GetBody(),h(K*A,C*A),g(n,t));F.set_enableLimit(!!r);F.set_lowerTranslation(w*A);F.set_upperTranslation(y*A);F.set_enableMotor(!!B);F.set_motorSpeed(e.toRadians(E));F.set_maxMotorForce(H);this._myJoints.push(this._world.CreateJoint(F));this._Destroy(F)}}_RemoveJoints(){this._isEnabled&&(this._DestroyMyJoints(),e.clearArray(this._myCreatedJoints),this._joiningMe.clear())}_OnInstanceDestroyed(n){const q=n.GetUID();let t=0;for(let r=0,w=this._myCreatedJoints.length;r<w;++r)this._myCreatedJoints[t]=this._myCreatedJoints[r],t<this._myJoints.length&&(this._myJoints[t]=this._myJoints[r]),this._myCreatedJoints[r].params[1]===q?r<this._myJoints.length&&this._world.DestroyJoint(this._myJoints[r]):++t;e.truncateArray(this._myCreatedJoints,t);t<this._myJoints.length&&e.truncateArray(this._myJoints,t);this._joiningMe.delete(n)}GetBody(){return this._body}static LookupBehInstFromBody(n){return d.get(n)||null}static LookupBehInstFromInst(n){return c.get(n)||null}SaveToJson(){const n={e:this._isEnabled,pr:this._preventRotation,d:this._density,fr:this._friction,re:this._restitution,ld:this._linearDamping,ad:this._angularDamping,b:this._isBullet,mcj:this._myCreatedJoints};if(this._isEnabled){const q=this._body.GetLinearVelocity();n.vx=q.get_x();n.vy=q.get_y();n.om=this._body.GetAngularVelocity()}return n}_OnBeforeLoad(){this._DestroyMyJoints();e.clearArray(this._myCreatedJoints);this._joiningMe.clear()}LoadFromJson(n){this._DestroyBody();this._isEnabled=n.e;this._preventRotation=n.pr;this._density=n.d;this._friction=n.fr;this._restitution=n.re;this._linearDamping=n.ld;this._angularDamping=n.ad;this._isBullet=n.b;this._myCreatedJoints=n.mcj;const q=this.GetWorldInfo();this._lastKnownX=q.GetX();this._lastKnownY=q.GetY();this._lastKnownAngle=q.GetAngle();this._lastWidth=q.GetWidth();this._lastHeight=q.GetHeight();this._isEnabled&&(this._CreateBody(),this._body.SetLinearVelocity(h(n.vx,n.vy)),this._body.SetAngularVelocity(n.om),0===n.vx&&0===n.vy&&0===n.om||this._body.SetAwake(!0),this._myCreatedJoints=n.mcj);this._isEnabled?this._StartTicking():this._StopTicking()}_OnAfterLoad(){this._isEnabled&&this._RecreateMyJoints()}Tick(){if(this._isEnabled){var n=this._runtime,q=this.GetBehavior();if(0===q.GetSteppingMode())var t=n.GetTimeScale()/60;else t=n.GetDt(this._inst),t>1/30&&(t=1/30);var r=n.GetTickCountNoSave();if(r>q.GetLastUpdateTick()&&0<n.GetTimeScale()){n=this._runtime.IsDebug();let w=0;n&&(w=performance.now());0!==t&&this._world.Step(t,q.GetVelocityIterations(),q.GetPositionIterations());this._world.ClearForces();n&&self.C3Debugger.AddPhysicsTime(performance.now()-w);q.SetLastUpdateTick(r)}this._UpdateBodyToMatchInstance(!0)}}_UpdateBodyToMatchInstance(n){const q=this._inst.GetWorldInfo();var t=this._worldScale;(q.GetWidth()!==this._lastWidth||q.GetHeight()!==this._lastHeight||q.IsPhysicsBodyChanged())&&this._CreateBody();var r=this._body,w=q.GetX()!==this._lastKnownX||q.GetY()!==this._lastKnownY,y=q.GetAngle()!==this._lastKnownAngle;if(w){var B=this._GetBoundingQuadExcludingMesh();const E=B.midX();B=B.midY();const H=E-this._lastKnownX,K=B-this._lastKnownY;y?r.SetTransform(h(E*t,B*t),q.GetAngle()):r.SetTransform(h(E*t,B*t),r.GetAngle());n&&(r.SetLinearVelocity(h(H,K)),this._lastTickOverride=!0);r.SetAwake(!0)}else n&&this._lastTickOverride&&(n=this._GetBoundingQuadExcludingMesh(),this._lastTickOverride=!1,r.SetLinearVelocity(h(0,0)),r.SetTransform(h(n.midX()*t,n.midY()*t),r.GetAngle()));!w&&y&&(r.SetTransform(r.GetPosition(),q.GetAngle()),r.SetAwake(!0));y=r.GetPosition();w=y.get_x()/t;t=y.get_y()/t;r=r.GetAngle();if(w!==q.GetX()||t!==q.GetY()||r!==q.GetAngle())if(q.SetXY(w,t),q.SetAngle(r),q.SetBboxChanged(),t=this._GetBoundingQuadExcludingMesh(),r=t.midX()-
  q.GetX(),t=t.midY()-q.GetY(),0!==r||0!==t)q.OffsetXY(-r,-t),q.SetBboxChanged();this._lastKnownX=q.GetX();this._lastKnownY=q.GetY();this._lastKnownAngle=q.GetAngle()}GetPropertyValueByIndex(n){switch(n){case 2:return this._IsPreventRotate();case 3:return this._GetDensity();case 4:return this._GetFriction();case 5:return this._GetElasticity();case 6:return this._GetLinearDamping();case 7:return this._GetAngularDamping();case 8:return this._IsBullet();case 9:return this._IsEnabled()}}SetPropertyValueByIndex(n,q){switch(n){case 2:this._SetPreventRotate(q);break;case 3:this._SetDensity(q);break;case 4:this._SetFriction(q);break;case 5:this._SetElasticity(q);break;case 6:this._SetLinearDamping(q);break;case 7:this._SetAngularDamping(q);break;case 8:this._SetBullet(q);break;case 9:this._SetEnabled(q)}}_SetEnabled(n){n=!!n;this._isEnabled&&!n?(this._DestroyBody(),this._isEnabled=!1,this._StopTicking()):!this._isEnabled&&n&&(this._isEnabled=!0,this._CreateBody(),this._StartTicking())}_IsEnabled(){return this._isEnabled}GetDebuggerProperties(){const n=[{name:"behaviors.physics.properties.enabled.name",value:this._IsEnabled(),onedit:q=>this._SetEnabled(q)},{name:"behaviors.physics.properties.immovable.name",value:this._IsImmovable(),onedit:q=>this._SetImmovable(q)},{name:"behaviors.physics.properties.density.name",value:this._GetDensity(),onedit:q=>this._SetDensity(q)},{name:"behaviors.physics.properties.friction.name",value:this._GetFriction(),onedit:q=>this._SetFriction(q)},{name:"behaviors.physics.properties.elasticity.name",value:this._GetElasticity(),onedit:q=>this._SetElasticity(q)},{name:"behaviors.physics.properties.linear-damping.name",value:this._GetLinearDamping(),onedit:q=>this._SetLinearDamping(q)},{name:"behaviors.physics.properties.angular-damping.name",value:this._GetAngularDamping(),onedit:q=>this._SetAngularDamping(q)}];this._isEnabled&&(n.push({name:"behaviors.physics.debugger.is-sleeping",value:this._IsSleeping()}),n.push({name:"behaviors.physics.debugger.velocity-x",value:this._GetVelocityX(),onedit:q=>this._SetVelocity(q,this._GetVelocityY())}),n.push({name:"behaviors.physics.debugger.velocity-y",value:this._GetVelocityY(),onedit:q=>this._SetVelocity(this._GetVelocityX(),q)}),n.push({name:"behaviors.physics.debugger.angular-velocity",value:e.toDegrees(this._GetAngularVelocity()),onedit:q=>this._SetAngularVelocity(e.toRadians(q))}),n.push({name:"behaviors.physics.debugger.mass",value:this._GetMass()}));return[{title:"$"+this.GetBehaviorType().GetName(),properties:n}]}_ApplyForce(n,q,t){const[r,w]=this._GetInstImagePoint(t);this._DoApplyForce(n,q,r,w)}_ApplyForceToward(n,q,t,r){const[w,y]=this._GetInstImagePoint(r);q=e.angleTo(w,y,q,t);this._DoApplyForce(Math.cos(q)*n,Math.sin(q)*n,w,y)}_ApplyForceAtAngle(n,q,t){const[r,w]=this._GetInstImagePoint(t);this._DoApplyForce(Math.cos(q)*n,Math.sin(q)*n,r,w)}_DoApplyForce(n,q,t,r){if(this._isEnabled){var w=this._worldScale;this._body.ApplyForce(h(n,q),g(t*w,r*w),!0)}}_ApplyImpulse(n,q,t){const[r,w]=this._GetInstImagePoint(t);this._DoApplyImpulse(n,q,r,w)}_ApplyImpulseToward(n,q,t,r){const[w,y]=this._GetInstImagePoint(r);q=e.angleTo(w,y,q,t);this._DoApplyImpulse(Math.cos(q)*n,Math.sin(q)*n,w,y)}_ApplyImpulseAtAngle(n,q,t){const[r,w]=this._GetInstImagePoint(t);this._DoApplyImpulse(Math.cos(q)*n,Math.sin(q)*n,r,w)}_DoApplyImpulse(n,q,t,r){if(this._isEnabled){var w=this._worldScale;this._body.ApplyLinearImpulse(h(n,q),g(t*w,r*w),!0);n=this.GetWorldInfo();this._lastKnownX=n.GetX();this._lastKnownY=n.GetY();this._lastTickOverride=!1}}_ApplyTorque(n){this._isEnabled&&this._body.ApplyTorque(n,!0)}_ApplyTorqueToAngle(n,q){q=e.angleClockwise(this.GetWorldInfo().GetAngle(),q)?-1:1;this._ApplyTorque(n*q)}_ApplyTorqueToPosition(n,q,t){var r=this.GetWorldInfo();q=e.angleTo(r.GetX(),r.GetY(),q,t);r=e.angleClockwise(r.GetAngle(),q)?-1:1;this._ApplyTorque(n*r)}_SetAngularVelocity(n){this._isEnabled&&(this._body.SetAngularVelocity(n),this._body.SetAwake(!0))}_GetAngularVelocity(){return this._isEnabled?this._body.GetAngularVelocity():0}_SetVelocity(n,q){if(this._isEnabled){var t=this._worldScale;this._body.SetLinearVelocity(h(n*t,q*t));this._body.SetAwake(!0);n=this.GetWorldInfo();this._lastKnownX=n.GetX();this._lastKnownY=n.GetY();this._lastTickOverride=!1}}_GetVelocity(){if(!this._isEnabled)return[0,0];const n=this._worldScale,q=this._body.GetLinearVelocity();return[q.get_x()/n,q.get_y()/n]}_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(n){if(this._isEnabled&&this._density!==n){this._density=n;for(const q of this._fixtures)q.SetDensity(n);this._body.ResetMassData()}}_GetDensity(){return this._isEnabled?this._density:0}_SetFriction(n){if(this._isEnabled&&this._friction!==n){this._friction=n;for(var q of this._fixtures)q.SetFriction(n);for(n=this._body.GetContactList();this._box2d.getPointer(n);n=n.get_next())(q=n.get_contact())&&q.ResetFriction()}}_GetFriction(){return this._isEnabled?this._friction:0}_SetElasticity(n){if(this._isEnabled&&this._restitution!==n){this._restitution=n;for(const q of this._fixtures)q.SetRestitution(n)}}_GetElasticity(){return this._isEnabled?this._restitution:0}_SetLinearDamping(n){this._isEnabled&&this._linearDamping!==n&&(this._linearDamping=n,this._body.SetLinearDamping(n))}_GetLinearDamping(){return this._isEnabled?this._linearDamping:0}_SetAngularDamping(n){this._isEnabled&&this._angularDamping!==n&&(this._angularDamping=n,this._body.SetAngularDamping(n))}_GetAngularDamping(){return this._isEnabled?this._angularDamping:0}_SetImmovable(n){this._isEnabled&&(n=!!n,this._isImmovable!==n&&(this._isImmovable=n,this._body.SetType(this._isImmovable?0:2),this._body.SetAwake(!0)))}_IsImmovable(){return this._isImmovable}_SetPreventRotate(n){this._isEnabled&&(n=!!n,this._preventRotation!==n&&(this._preventRotation=n,this._body.SetFixedRotation(this._preventRotation),this._body.SetAngularVelocity(0),this._body.SetAwake(!0)))}_IsPreventRotate(){return this._preventRotation}_SetBullet(n){this._isEnabled&&(n=!!n,this._isBullet!==n&&(this._isBullet=n,this._body.SetBullet(this._isBullet),this._body.SetAwake(!0)))}_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 n=this._body.GetPosition(),q=this._body.GetLocalCenter(),t=this._worldScale;return[(n.get_x()+q.get_x())/t,(n.get_y()+q.get_y())/t]}_IsSleeping(){return this._isEnabled?!this._body.IsAwake():!1}_GetContactCount(){if(!this._isEnabled)return 0;let n=0;for(let t=this._body.GetContactList();this._box2d.getPointer(t);t=t.get_next()){var q=t.get_contact();q&&(q=q.GetManifold().get_pointCount(),n+=q)}return n}_GetContactPositionAt(n){n=Math.floor(n);if(!this._isEnabled)return[0,0];var q=0;for(let r=this._body.GetContactList();this._box2d.getPointer(r);r=r.get_next()){var t=r.get_contact();if(!t)continue;const w=t.GetManifold().get_pointCount();if(n>=q&&n<q+w)return n-=q,q=this.GetBehavior().GetWorldManifold(),t.GetWorldManifold(q),t=q.get_points(n),[t.get_x()/this._worldScale,t.get_y()/this._worldScale];q+=w}return[0,0]}GetScriptInterfaceClass(){return self.IPhysicsBehaviorInstance}};const u=new WeakMap;function x(n,q){return u.get(n).GetRuntime()._UnwrapIWorldInstance(q)}self.IPhysicsBehaviorInstance=class extends b{constructor(){super();u.set(this,b._GetInitInst().GetSdkInstance())}get isEnabled(){return u.get(this)._IsEnabled()}set isEnabled(n){u.get(this)._SetEnabled(n)}applyForce(n,q,t=0){a.RequireFiniteNumber(n);a.RequireFiniteNumber(q);u.get(this)._ApplyForce(n,q,t)}applyForceTowardPosition(n,q,t,r=0){a.RequireFiniteNumber(n);a.RequireFiniteNumber(q);a.RequireFiniteNumber(t);u.get(this)._ApplyForceToward(n,q,t,r)}applyForceAtAngle(n,q,t=0){a.RequireFiniteNumber(n);a.RequireFiniteNumber(q);u.get(this)._ApplyForceAtAngle(n,q,t)}applyImpulse(n,q,t=0){a.RequireFiniteNumber(n);a.RequireFiniteNumber(q);u.get(this)._ApplyImpulse(n,q,t)}applyImpulseTowardPosition(n,q,t,r=0){a.RequireFiniteNumber(n);a.RequireFiniteNumber(q);a.RequireFiniteNumber(t);u.get(this)._ApplyImpulseToward(n,q,t,r)}applyImpulseAtAngle(n,q,t=0){a.RequireFiniteNumber(n);a.RequireFiniteNumber(q);u.get(this)._ApplyImpulseAtAngle(n,q,t)}applyTorque(n){a.RequireFiniteNumber(n);u.get(this)._ApplyTorque(n)}applyTorqueToAngle(n,q){a.RequireFiniteNumber(n);a.RequireFiniteNumber(q);u.get(this)._ApplyTorqueToAngle(n,q)}applyTorqueToPosition(n,q,t){a.RequireFiniteNumber(n);a.RequireFiniteNumber(q);a.RequireFiniteNumber(t);u.get(this)._ApplyTorqueToPosition(n,q,t)}set angularVelocity(n){a.RequireFiniteNumber(n);u.get(this)._SetAngularVelocity(n)}get angularVelocity(){return u.get(this)._GetAngularVelocity()}setVelocity(n,q){a.RequireFiniteNumber(n);a.RequireFiniteNumber(q);u.get(this)._SetVelocity(n,q)}getVelocityX(){return u.get(this)._GetVelocityX()}getVelocityY(){return u.get(this)._GetVelocityY()}getVelocity(){return u.get(this)._GetVelocity()}set density(n){a.RequireFiniteNumber(n);u.get(this)._SetDensity(n)}get density(){return u.get(this)._GetDensity()}set friction(n){a.RequireFiniteNumber(n);u.get(this)._SetFriction(n)}get friction(){return u.get(this)._GetFriction()}set elasticity(n){a.RequireFiniteNumber(n);u.get(this)._SetElasticity(n)}get elasticity(){return u.get(this)._GetElasticity()}set linearDamping(n){a.RequireFiniteNumber(n);u.get(this)._SetLinearDamping(n)}get linearDamping(){return u.get(this)._GetLinearDamping()}set angularDamping(n){a.RequireFiniteNumber(n);u.get(this)._SetAngularDamping(n)}get angularDamping(){return u.get(this)._GetAngularDamping()}set isImmovable(n){u.get(this)._SetImmovable(n)}get isImmovable(){return u.get(this)._IsImmovable()}set isPreventRotation(n){u.get(this)._SetPreventRotate(n)}get isPreventRotation(){return u.get(this)._IsPreventRotate()}set isBullet(n){u.get(this)._SetBullet(n)}get isBullet(){return u.get(this)._IsBullet()}get mass(){return u.get(this)._GetMass()}getCenterOfMassX(){return u.get(this)._GetCenterOfMassX()}getCenterOfMassY(){return u.get(this)._GetCenterOfMassY()}getCenterOfMass(){return u.get(this)._GetCenterOfMass()}getContactCount(){return u.get(this)._GetContactCount()}getContactX(n){a.RequireFiniteNumber(n);return u.get(this)._GetContactPositionAt(n)[0]}getContactY(n){a.RequireFiniteNumber(n);return u.get(this)._GetContactPositionAt(n)[1]}getContact(n){a.RequireFiniteNumber(n);return u.get(this)._GetContactPositionAt(n)}get isSleeping(){return u.get(this)._IsSleeping()}createDistanceJoint(n,q,t,r,w){a.RequireFiniteNumber(r);a.RequireFiniteNumber(w);q=x(this,q);u.get(this)._CreateDistanceJoint(n,q,t,r,w)}createRevoluteJoint(n,q){q=x(this,q);u.get(this)._CreateRevoluteJoint(n,q)}createLimitedRevoluteJoint(n,q,t,r){a.RequireFiniteNumber(t);a.RequireFiniteNumber(r);q=x(this,q);u.get(this)._CreateLimitedRevoluteJoint(n,q,t,r)}createPrismaticJoint(n,q,t,r,w,y,B,E,H){q=x(this,q);u.get(this)._CreatePrismaticJoint(n,q,t,r,w,y,B,E,H)}removeAllJoints(){u.get(this)._RemoveJoints()}}}
  {"use strict";const e=self.C3;e.Behaviors.Physics.Cnds={IsSleeping(){return this._IsSleeping()},CompareVelocity(a,b,d){if(!this._isEnabled)return!1;if(0===a)a=this._GetVelocityX();else if(1===a)a=this._GetVelocityY();else{const[c,f]=this._GetVelocity();a=Math.hypot(c,f)}return e.compare(a,b,d)},CompareAngularVelocity(a,b){if(!this._isEnabled)return!1;const d=e.toDegrees(this._GetAngularVelocity());return e.compare(d,a,b)},CompareMass(a,b){if(!this._isEnabled)return!1;const d=this._GetMass();return e.compare(d,a,b)},IsEnabled(){return this._IsEnabled()}}}
  {"use strict";const e=self.C3;e.Behaviors.Physics.Acts={ApplyForce(a,b,d){this._ApplyForce(a,b,d)},ApplyForceToward(a,b,d,c){this._ApplyForceToward(a,b,d,c)},ApplyForceAtAngle(a,b,d){this._ApplyForceAtAngle(a,e.toRadians(b),d)},ApplyImpulse(a,b,d){this._ApplyImpulse(a,b,d)},ApplyImpulseToward(a,b,d,c){this._ApplyImpulseToward(a,b,d,c)},ApplyImpulseAtAngle(a,b,d){this._ApplyImpulseAtAngle(a,e.toRadians(b),d)},ApplyTorque(a){this._ApplyTorque(e.toRadians(a))},ApplyTorqueToAngle(a,b){this._ApplyTorqueToAngle(e.toRadians(a),e.toRadians(b))},ApplyTorqueToPosition(a,b,d){this._ApplyTorqueToPosition(e.toRadians(a),b,d)},SetAngularVelocity(a){this._SetAngularVelocity(e.toRadians(a))},CreateDistanceJoint(a,b,d,c,f){b&&(b=b.GetFirstPicked(this._inst),this._CreateDistanceJoint(a,b,d,c,f))},CreateRevoluteJoint(a,b){b&&(b=b.GetFirstPicked(this._inst),this._CreateRevoluteJoint(a,b))},CreateLimitedRevoluteJoint(a,b,d,c){b&&(b=b.GetFirstPicked(this._inst),this._CreateLimitedRevoluteJoint(a,b,e.toRadians(d),e.toRadians(c)))},CreatePrismaticJoint(a,b,d,c,f,h,g,l,m){b&&(b=b.GetFirstPicked(this._inst),this._CreatePrismaticJoint(a,b,e.toRadians(d),c,f,h,g,e.toRadians(l),m))},RemoveJoints(){this._RemoveJoints()},SetWorldGravity(a){this.GetBehavior().SetGravity(a)},SetSteppingMode(a){this.GetBehavior().SetSteppingMode(a)},SetIterations(a,b){this.GetBehavior().SetIterations(a,b)},SetVelocity(a,b){this._SetVelocity(a,b)},SetDensity(a){this._SetDensity(a)},SetFriction(a){this._SetFriction(a)},SetElasticity(a){this._SetElasticity(a)},SetLinearDamping(a){this._SetLinearDamping(a)},SetAngularDamping(a){this._SetAngularDamping(a)},SetImmovable(a){this._SetImmovable(a)},EnableCollisions(a,b){this.GetBehavior().SetCollisionsEnabled(this.GetObjectClass(),a,0!==b)},SetPreventRotate(a){this._SetPreventRotate(0!==a)},SetBullet(a){this._SetBullet(0!==a)},SetEnabled(a){this._SetEnabled(0!==a)}}}
  {"use strict";const e=self.C3;e.Behaviors.Physics.Exps={VelocityX(){return this._GetVelocityX()},VelocityY(){return this._GetVelocityY()},AngularVelocity(){return e.toDegrees(this._GetAngularVelocity())},Mass(){return this._GetMass()},CenterOfMassX(){return this._GetCenterOfMassX()},CenterOfMassY(){return this._GetCenterOfMassY()},Density(){return this._GetDensity()},Friction(){return this._GetFriction()},Elasticity(){return this._GetElasticity()},LinearDamping(){return this._GetLinearDamping()},AngularDamping(){return this._GetAngularDamping()},ContactCount(){return this._GetContactCount()},ContactXAt(a){return this._GetContactPositionAt(a)[0]},ContactYAt(a){return this._GetContactPositionAt(a)[1]}}}
  {"use strict";const e=self.C3,a={};e.Behaviors.Physics.Separator=a;const b=e.Behaviors.Physics.GetVec2,d=e.Behaviors.Physics.FreeVec2;function c(g){return b(g.get_x(),g.get_y())}a.det=function(g,l,m,u,x,n){return g*u+m*n+x*l-l*m-u*x-n*g};a.hitRay=function(g,l,m,u,x,n,q,t){var r=m-g,w=u-l,y=q-x;const B=t-n;y=(y*(n-l)-B*(x-g))/(w*y-r*B);r=g+y*r;w=l+y*w;g=a.isOnSegment(m,u,g,l,r,w);x=a.isOnSegment(r,w,x,n,q,t);return g&&x?b(r,w):null};a.isOnSegment=function(g,l,m,u,x,n){return(m+.1>=g&&g>=x-.1||m-.1<=g&&g<=x+.1)&&(u+.1>=l&&l>=n-.1||u-.1<=l&&l<=n+.1)&&a.isOnLine(g,l,m,u,x,n)};a.isOnLine=function(g,l,m,u,x,n){return.1<Math.abs(x-m)?.1>Math.abs((n-u)/(x-m)*(g-m)+u-l):.1>Math.abs(g-m)};a.pointsMatch=function(g,l,m,u){return.1>Math.abs(m-g)&&.1>Math.abs(u-l)};a.Separate=function(g,l){g=a.calcShapes(g);let m=[];for(let u=0,x=g.length;u<x;++u){const n=g[u],q=[];let t=0;for(let r=0,w=n.length;r<w;++r){const y=n[r],B=n[(r+1)%w];t+=y.get_x()*B.get_y()-y.get_y()*B.get_x();q.push(b(y.get_x(),y.get_y()))}t=Math.abs(t/2);if(t>=.001*l)m.push(q);else for(let r=0,w=q.length;r<w;r++)d(q[r])}return m=f(m)};a.calcShapes=function(g){var l;let m;var u;let x;let n,q,t,r;let w;var y=0;let B=0,E,H=[],K=[];for(K.push(g);K.length;){g=K[0];m=g.length;E=!0;for(l=0;l<m;l++){n=l;q=l<m-1?l+1:l+1-m;var C=l<m-2?l+2:l+2-m;t=g[n];r=g[q];C=g[C];C=a.det(t.get_x(),t.get_y(),r.get_x(),r.get_y(),C.get_x(),C.get_y());if(0>C){E=!1;var A=1E9;for(u=0;u<m;u++)if(u!==n&&u!==q){l=u;C=u<m-1?u+1:0;var F=g[l];var J=g[C];if(F=a.hitRay(t.get_x(),t.get_y(),r.get_x(),r.get_y(),F.get_x(),F.get_y(),J.get_x(),J.get_y()))J=r.get_x()-F.get_x(),x=r.get_y()-F.get_y(),J=J*J+x*x,J<A?(B=l,y=C,w=F,A=J):d(F)}if(1E9===A)return[];u=[];A=[];l=B;C=y;F=g[l];J=g[C];y=!1;a.pointsMatch(w.get_x(),w.get_y(),J.get_x(),J.get_y())||(u.push(w),y=!0);a.pointsMatch(w.get_x(),w.get_y(),F.get_x(),F.get_y())||(A.push(w),y=!0);y||d(w);B=-1;for(y=n;;){if(y!==C)u.push(g[y]);else{if(0>B||B>=m)return[];a.isOnSegment(J.get_x(),J.get_y(),g[B].get_x(),g[B].get_y(),t.get_x(),t.get_y())||u.push(g[y]);break}B=y;0>y-1?y=m-1:y--}u.reverse();B=-1;for(y=q;;){if(y!==l)A.push(g[y]);else{if(0>B||B>=m)return[];y!==l||a.isOnSegment(F.get_x(),F.get_y(),g[B].get_x(),g[B].get_y(),r.get_x(),r.get_y())||A.push(g[y]);break}B=y;y+1>m-1?y=0:y++}K.push(u,A);K.shift();break}}E&&H.push(K.shift())}return H};function f(g){const l=[];for(const m of g)8>=m.length?l.push(m):l.push.apply(l,h(m));return l}function h(g){const l=[];l.push(g.splice(0,8));const m=l[0][0];let u=l[0][7];for(;g.length;){const x=g.splice(0,Math.min(g.length,6));let n=x.at(-1);x.push(c(m));x.push(c(u));l.push(x);u=n}return l}}
  {"use strict";const e=self.C3;e.Behaviors.scrollto=class extends e.SDKBehaviorBase{constructor(a){super(a);this._shakeMode=this._shakeEnd=this._shakeStart=this._shakeMag=0}Release(){super.Release()}SetShakeMagnitude(a){this._shakeMag=a}GetShakeMagnitude(){return this._shakeMag}SetShakeStart(a){this._shakeStart=a}GetShakeStart(){return this._shakeStart}SetShakeEnd(a){this._shakeEnd=a}GetShakeEnd(){return this._shakeEnd}SetShakeMode(a){this._shakeMode=a}GetShakeMode(){return this._shakeMode}}}
  {"use strict";const e=self.C3;e.Behaviors.scrollto.Type=class extends e.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}
  {"use strict";const e=self.C3;e.Behaviors.scrollto.Instance=class extends e.SDKBehaviorInstanceBase{constructor(a,b){super(a);this._isEnabled=!0;b&&(this._isEnabled=b[0]);this._isEnabled&&this._StartTicking2()}Release(){super.Release()}SaveToJson(){const a=this.GetBehavior();return{e:this._isEnabled,smg:a.GetShakeMagnitude(),ss:a.GetShakeStart(),se:a.GetShakeEnd(),smd:a.GetShakeMode()}}LoadFromJson(a){const b=this.GetBehavior();b.SetShakeMagnitude(a.smg);b.SetShakeStart(a.ss);b.SetShakeEnd(a.se);b.SetShakeMode(a.smd);(this._isEnabled=a.e)?this._StartTicking2():this._StopTicking2()}IsEnabled(){return this._isEnabled}Tick2(){if(this.IsEnabled()){this._runtime.GetDt(this._inst);var a=this.GetBehavior(),b=a.GetInstances(),d=0,c=0,f=0;for(var h of b)(b=h.GetBehaviorInstanceFromCtor(e.Behaviors.scrollto))&&b.GetSdkInstance().IsEnabled()&&(b=h.GetWorldInfo(),d+=b.GetX(),c+=b.GetY(),++f);h=this._inst.GetWorldInfo().GetLayout();var g=this._runtime.GetGameTime(),l=b=0;g>=a.GetShakeStart()&&g<a.GetShakeEnd()&&(b=a.GetShakeMagnitude()*Math.min(this._runtime.GetTimeScale(),1),0===a.GetShakeMode()&&(b*=1-(g-a.GetShakeStart())/(a.GetShakeEnd()-a.GetShakeStart())),a=this._runtime.Random()*Math.PI*2,g=this._runtime.Random()*b,b=Math.cos(a)*g,l=Math.sin(a)*g);h.SetScrollX(d/f+b);h.SetScrollY(c/f+l)}}GetPropertyValueByIndex(a){switch(a){case 0:return this._isEnabled}}SetPropertyValueByIndex(a,b){switch(a){case 0:(this._isEnabled=!!b)?this._StartTicking2():this._StopTicking2()}}}}"use strict";self.C3.Behaviors.scrollto.Cnds={IsEnabled(){return this._isEnabled}};"use strict";self.C3.Behaviors.scrollto.Acts={Shake(e,a,b){const d=this.GetBehavior();d.SetShakeMagnitude(e);d.SetShakeStart(this._runtime.GetGameTime());d.SetShakeEnd(this._runtime.GetGameTime()+a);d.SetShakeMode(b)},SetEnabled(e){(this._isEnabled=0!==e)?this._StartTicking2():this._StopTicking2()}};"use strict";self.C3.Behaviors.scrollto.Exps={};{"use strict";const e=self.C3;e.Behaviors.Tween=class extends e.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}}}
  {"use strict";const e=self.C3;e.Behaviors.Tween.Type=class extends e.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}
  {"use strict";const e=self.C3,a=e.Behaviors.Tween;a.Instance=class extends e.SDKBehaviorInstanceBase{constructor(b,d){super(b);this._allowMultiple=!1;this._enabled=!0;d&&(this._allowMultiple=!1,this._enabled=!!d[0]);this._activeTweens=new Map;this._disabledTweens=[];this._waitingForReleaseTweens=new Map;this._waitingForReleaseTweensJson=this._disabledTweensJson=this._activeTweensJson=this._finishingTween=null;this._finishingTweenName="";this._enabled&&this._StartTicking2();this._afterLoad=c=>this._OnAfterLoad(c);this.GetRuntime().Dispatcher().addEventListener("afterload",this._afterLoad)}Release(){this.GetRuntime().Dispatcher().removeEventListener("afterload",this._afterLoad);this._afterLoad=null;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(b){(this._enabled=b)?this._StartTicking2():this._StopTicking2()}GetEnabled(){return this._enabled}AddToDisabledList(b){this._disabledTweens.push(b)}IsInDisabledList(b){return this._disabledTweens.includes(b)}ClearDisabledList(){e.clearArray(this._disabledTweens)}GetFinishingTween(){return this._finishingTween}IsInstanceValid(){const b=this.GetObjectInstance();return b?!b.IsDestroyed():!1}GetTween(b,d,c=!1){if((d=d?this.PropertyTweens(d,c):this.AllTweens(c))&&d.length)for(const f of d)if(f.HasTags(b))return f}GetTweenIncludingWaitingForRelease(b,d){return this.GetTween(b,d,!0)}*GetTweens(b,d,c=!1){if((d=d?this.PropertyTweens(d,c):this.AllTweens(c))&&d.length)for(const f of d)f.HasTags(b)&&(yield f)}*GetTweensIncludingWaitingForRelease(b,d){yield*this.GetTweens(b,d,!0)}PropertyTweens(b,d){if(d)return d=this._activeTweens.get(b),b=this._waitingForReleaseTweens.get(b),d||(d=[]),b||(b=[]),d.concat(b).filter(c=>c);(b=this._activeTweens.get(b))||(b=[]);return b.filter(c=>c)}AllTweens(b){if(b){b=[...this._activeTweens.values()].flat();const d=[...this._waitingForReleaseTweens.values()].flat();return b.concat(d).filter(c=>c)}return[...this._activeTweens.values()].flat().filter(d=>d)}AllTweensIncludingWaitingForRelease(){return this.AllTweens(!0)}SaveToJson(){return{s:!1,e:!!this._enabled,at:this._SaveActiveTweensToJson(),dt:this._SaveDisabledTweensToJson(),wt:this._SaveWaitingForReleaseTweensToJson(),ft:this._SaveFinishingTweenToJson()}}LoadFromJson(b){b&&(this._activeTweensJson=b.at,this._disabledTweensJson=b.dt,this._waitingForReleaseTweensJson=b.wt,this._finishingTweenName=b.ft,this._allowMultiple=!1,this._enabled=!!b.e)}_OnAfterLoad(b){b=this.GetRuntime().GetTimelineManager();this._PopulateTweenMap(this._activeTweensJson,this._activeTweens,b);if(this._disabledTweensJson){e.clearArray(this._disabledTweens);for(const d of this._disabledTweensJson)this._PopulateTweenArray(this._disabledTweens,d,b)}this._PopulateTweenMap(this._waitingForReleaseTweensJson,this._waitingForReleaseTweens,b);this._finishingTween=this._GetTween(this._finishingTweenName,b);this._enabled?this._StartTicking2():this._StopTicking2()}_PopulateTweenMap(b,d,c){if(b)for(const h in b){let g=d.get(h);g?e.clearArray(g):g=[];var f=b[h];for(const l of f)this._PopulateTweenArray(g,l.name,c)?this._LoadTweenFromJson(l.name,l,c):(f=e.Tween.Build({runtime:this.GetRuntime(),json:l}),f.AddCompletedCallback(m=>this._FinishTriggers(m)),c.AddScheduledTimeline(f),this._PopulateTweenArray(g,f,c));d.set(h,g)}}_GetTween(b,d){return d.GetScheduledOrPlayingTimelineByName(b)}_PopulateTweenArray(b,d,c){if("string"===typeof d){if(d=this._GetTween(d,c))return!!b.push(d)}else return!!b.push(d);return!1}_LoadTweenFromJson(b,d,c){"string"===typeof b?(b=this._GetTween(b,c))&&b._LoadFromJson(d):b._LoadFromJson(d)}_SaveActiveTweensToJson(){const b={};for(const[d,c]of this._activeTweens)b[d]=c.map(f=>f._SaveToJson());return b}_SaveDisabledTweensToJson(){return this._disabledTweens.map(b=>b.GetName())}_SaveWaitingForReleaseTweensToJson(){const b={};for(const[d,c]of this._waitingForReleaseTweens)b[d]=c.map(f=>f._SaveToJson());return b}_SaveFinishingTweenToJson(){return this._finishingTween?this._finishingTween.GetName():""}Tick2(){this._ReleaseWaitingTweens()}CreateTween(b){var d=a.Config.GetPropertyTracksConfig(b.property,b.startValue,b.endValue,b.ease,b.resultMode,this.GetObjectInstance());const c=a.Maps.GetPropertyFromIndex(b.property);a.Maps.IsValueId(c)||this.ReleaseTweens(b.property);d=e.Tween.Build({runtime:this.GetRuntime(),id:c,tags:b.tags,time:b.time,instance:this.GetObjectInstance(),releaseOnComplete:!!b.releaseOnComplete,loop:!!b.loop,pingPong:!!b.pingPong,initialValueMode:b.initialValueMode,propertyTracksConfig:d});d.AddCompletedCallback(f=>this._FinishTriggers(f));this._AddTween(d,b.property);return d}ReleaseTween(b,d=!1){var c=b.GetId();if(this._activeTweens.has(c)&&(c=this._activeTweens.get(c))){const f=c.indexOf(b);-1!==f&&c.splice(f,1)}b.IsReleased()||this._IsInWaitingList(b)||(b.Stop(d),this._AddToWaitingList(b))}ReleaseTweens(b,d=!1){if(e.IsFiniteNumber(b)){var c=a.Maps.GetPropertyFromIndex(b);if(this._activeTweens.has(c)){c=this._activeTweens.get(c);var f=this.GetFinishingTween();for(var h of c)h===f||h.IsReleased()||this._IsInWaitingList(h)||(h.Stop(d),h.Release());e.clearArray(c)}}else{h=this.GetFinishingTween();for(c of this.AllTweens())c===h||c.IsReleased()||this._IsInWaitingList(c)||(c.Stop(d),c.Release());for(f of this._activeTweens.keys())e.clearArray(this._activeTweens.get(f)),this._activeTweens.delete(f);this._activeTweens.clear()}}ReleaseAndCompleteTween(b){this.ReleaseTween(b,!0)}ReleaseAndCompleteTweens(){this.ReleaseTweens(NaN,!0)}GetPropertyValueByIndex(b){switch(b){case 0:return this._enabled}}SetPropertyValueByIndex(b,d){switch(b){case 0:this._enabled=!!d}}_GetBehaviorType(b){b=b.GetInstance().GetBehaviorInstances();for(const d of b)if(b=d.GetBehaviorType(),b.GetInstanceSdkCtor()===this.constructor)return b}Trigger(b,d,c,f){return this._runtime?super.Trigger(b):d.Trigger(b,c,f)}_FinishTriggers(b){this._finishingTween=b;a.Cnds.SetFinishingTween(b);let d,c;if(this.GetRuntime())d=this._inst,c=this._runtime,this.Trigger(a.Cnds.OnTweensFinished),this.Trigger(a.Cnds.OnAnyTweensFinished),this.ReleaseTween(b);else{d=b.GetInstance();if(!d||d&&d.IsDestroyed())return;c=d.GetRuntime();const f=this._GetBehaviorType(b);this.Trigger(a.Cnds.OnTweensFinished,c,d,f);this.Trigger(a.Cnds.OnAnyTweensFinished,c,d,f);b.Stop()}this._finishingTween=null;a.Cnds.SetFinishingTween(null);b.GetDestroyInstanceOnComplete()&&c.DestroyInstance(d)}_AddTween(b,d){d=a.Maps.GetPropertyFromIndex(d);this._activeTweens.has(d)||this._activeTweens.set(d,[]);this._activeTweens.get(d).push(b)}_AddToWaitingList(b){const d=b.GetId();this._waitingForReleaseTweens.has(d)||this._waitingForReleaseTweens.set(d,[]);this._waitingForReleaseTweens.get(d).push(b)}_IsInWaitingList(b){const d=b.GetId();return this._waitingForReleaseTweens.has(d)?this._waitingForReleaseTweens.get(d).includes(b):!1}_ReleaseWaitingTweens(){if(this._waitingForReleaseTweens.size){for(const b of this._waitingForReleaseTweens.values()){for(const d of b)d.IsReleased()||d.Release();e.clearArray(b)}this._waitingForReleaseTweens.clear()}}}}
  {"use strict";const e=self.C3;let a=null;e.Behaviors.Tween.Cnds={SetFinishingTween(b){a=b},OnTweensFinished(b){return a.HasTags(b)},OnAnyTweensFinished(){return!0},IsPlaying(b){return(b=[...this.GetTweensIncludingWaitingForRelease(b)],b.length)?b.some(e.Tween.IsPlaying):!1},IsAnyPlaying(){const b=[...this.AllTweensIncludingWaitingForRelease()];return b&&b.length?b.some(e.Tween.IsPlaying):!1},IsPaused(b){return(b=[...this.GetTweensIncludingWaitingForRelease(b)],b.length)?b.some(e.Tween.IsPaused):!1},IsAnyPaused(){const b=[...this.AllTweensIncludingWaitingForRelease()];return b&&b.length?b.some(e.Tween.IsPaused):!1}}}
  {"use strict";const e=self.C3,a=self.Ease,b=e.Behaviors.Tween;b.Acts={SetEnabled(d){this.SetEnabled(!!d);for(const c of this.AllTweens())d?this.IsInDisabledList(c)&&c.Resume():((c.IsPlaying()||c.IsScheduled())&&this.AddToDisabledList(c),c.Stop());d&&this.ClearDisabledList()},async TweenOneProperty(...d){this.GetEnabled()&&this.IsInstanceValid()&&(d=this.CreateTween(b.TweenArguments.OneProperty(this,...d)),d.Play()&&await d.GetPlayPromise())},async TweenTwoProperties(...d){this.GetEnabled()&&this.IsInstanceValid()&&(d=this.CreateTween(b.TweenArguments.TwoProperties(this,...d)),d.Play()&&await d.GetPlayPromise())},async TweenValue(...d){this.GetEnabled()&&this.IsInstanceValid()&&(d=this.CreateTween(b.TweenArguments.ValueProperty(this,...d)),d.Play()&&await d.GetPlayPromise())},PauseTweens(d){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.GetTweens(d))c.Stop()},PauseAllTweens(){if(this.GetEnabled()&&this.IsInstanceValid())for(const d of this.AllTweens())d.Stop()},ResumeTweens(d){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.GetTweens(d))c.Resume()},ResumeAllTweens(){if(this.GetEnabled()&&this.IsInstanceValid())for(const d of this.AllTweens())d.Resume()},StopTweens(d){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.GetTweens(d))this.ReleaseTween(c)},StopAllTweens(){if(this.GetEnabled()&&this.IsInstanceValid())for(const d of this.AllTweens())this.ReleaseTween(d)},SetOnePropertyTweensEndValue(d,c,f){if(this.GetEnabled()&&this.IsInstanceValid()){c=e.Behaviors.Tween.Maps.GetSinglePropertyFromIndex(c);for(const h of this.GetTweens(d))h.BeforeSetEndValues([c]),h.SetEndValue(f,c)}},SetTwoPropertiesTweensEndValue(d,c,f,h){if(this.GetEnabled()&&this.IsInstanceValid()){c=e.Behaviors.Tween.Maps.GetRealProperties(c);for(const g of this.GetTweens(d))g.BeforeSetEndValues(c),g.SetEndValue(f,c[0]),g.SetEndValue(h,c[1])}},SetValuePropertyTweensStartValue(d,c){if(this.GetEnabled()&&this.IsInstanceValid())for(const f of this.GetTweens(d,"value"))f.SetStartValue(c,"value")},SetValuePropertyTweensEndValue(d,c){if(this.GetEnabled()&&this.IsInstanceValid())for(const f of this.GetTweens(d,"value"))f.BeforeSetEndValues(["value"]),f.SetEndValue(c,"value")},SetTweensEase(d,c){if(this.GetEnabled()&&this.IsInstanceValid()){c=a.GetEaseFromIndex(c);for(const f of this.GetTweens(d))f.SetEase(c)}},SetAllTweensEase(d){if(this.GetEnabled()&&this.IsInstanceValid()){d=a.GetEaseFromIndex(d);for(const c of this.AllTweens())c.SetEase(d)}},SetTweensTime(d,c){if(this.GetEnabled()&&this.IsInstanceValid())for(const f of this.GetTweens(d))f.SetTime(c)},SetAllTweensTime(d){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.AllTweens())c.SetTime(d)},SetTweensPlaybackRate(d,c){if(this.GetEnabled()&&this.IsInstanceValid())for(const f of this.GetTweens(d))f.SetPlaybackRate(c)},SetAllTweensPlaybackRate(d){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.AllTweens())c.SetPlaybackRate(d)},SetTweensDestroyOnComplete(d,c){if(this.GetEnabled()&&this.IsInstanceValid())for(const f of this.GetTweens(d))f.SetDestroyInstanceOnComplete(!!c)},SetAllTweensDestroyOnComplete(d){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.AllTweens())c.SetDestroyInstanceOnComplete(!!d)}}}"use strict";self.C3.Behaviors.Tween.Exps={Time(e){return(e=this.GetTweenIncludingWaitingForRelease(e))?e.GetTime():0},Progress(e){return(e=this.GetTweenIncludingWaitingForRelease(e))?e.GetTime()/e.GetTotalTime():0},Value(e){return(e=this.GetTweenIncludingWaitingForRelease(e,"value"))?e.GetPropertyTrack("value").GetSourceAdapterValue():0},Tags(){return this.GetFinishingTween()?this.GetFinishingTween().GetStringTags():""}};{"use strict";const e=self.C3,a=self.Ease,b=["position","size","scale"],d="offsetX offsetY offsetWidth offsetHeight offsetAngle offsetOpacity offsetColor offsetZElevation offsetScaleX offsetScaleY".split(" "),c=["value"],f=[].concat(b).concat(d).concat(c),h={position:["offsetX","offsetY"],size:["offsetWidth","offsetHeight"],scale:["offsetScaleX","offsetScaleY"]},g=Object.assign({},f.reduce((l,m)=>Object.assign({},l,{[m]:[m]}),{}),h);e.Behaviors.Tween.Maps=class{constructor(){}static GetEases(){return[...a.GetRuntimeEaseNames()]}static GetEaseFromIndex(l){return[...a.GetRuntimeEaseNames()][l]}static GetPropertyFromIndex(l){return f[l]}static GetPropertyIndexFromName(l){return f.indexOf(l)}static GetPairPropertyFromIndex(l){return b[l]}static GetSinglePropertyFromIndex(l){return d[l]}static GetValuePropertyFromIndex(l){return c[l]}static GetPairProperties(l){return h[l]}static GetRealProperties(l){return e.IsString(l)?g[l]:g[f[l]]}static IsPairId(l){return!!h[l]}static IsColorId(l){return"offsetColor"===l}static IsAngleId(l){return"offsetAngle"===l}static IsOpacityId(l){return"offsetOpacity"===l}static IsValueId(l){return"value"===l}}}
  {"use strict";const e=self.C3,a=e.Behaviors.Tween,b=new Map;a.Config=class{constructor(){}static GetPropertyTracksConfig(d,c,f,h,g,l){0===b.size&&this._CreateConfigObjects();var m=a.PropertyTypes.Pick(d);m=b.get(m);e.IsFiniteNumber(d)&&(d=a.Maps.GetPropertyFromIndex(d));return this._GetConfig(m,d,c,f,h,g,l)}static TransformValue(d,c){return e.Behaviors.Tween.GetPropertyTracksConfig(d).valueGetter(c)}static _CreateConfigObjects(){const d=a.PropertyTypes,c=a.ValueGetters;this._AddConfigObject(d.PAIR,this._GetPairConfig,c._GetPropertyValue);this._AddConfigObject(d.COLOR,this._GetColorConfig,c._GetColorPropertyValue);this._AddConfigObject(d.ANGLE,this._GetAngleConfig,c._GetPropertyAngleValue);this._AddConfigObject(d.VALUE,this._GetValueConfig,c._GetPropertyValue);this._AddConfigObject(d.OTHER,this._GetCommonConfig,c._GetPropertyValue)}static _AddConfigObject(d,c,f){b.set(d,this._CreateConfigObject(d,c,f))}static _CreateConfigObject(d,c,f){return{name:d,configFunc:c,valueGetter:f}}static _GetConfig(d,c,f,h,g,l,m){return d.configFunc(c,d.valueGetter(f),d.valueGetter(h),g,l,m)}static _GetPairConfig(d,c,f,h,g,l){return a.Maps.GetPairProperties(d).map((m,u)=>({sourceId:"world-instance",property:m,type:"float",valueType:"numeric",startValue:c[u],endValue:f[u],ease:a.Maps.GetEaseFromIndex(h),resultMode:g}))}static _GetColorConfig(d,c,f,h,g,l){return e.Plugins.Text&&l.GetPlugin()instanceof e.Plugins.Text?{sourceId:"plugin",sourceArgs:[7],property:"color",type:"color",valueType:"color",startValue:c,endValue:f,ease:a.Maps.GetEaseFromIndex(h),resultMode:g}:{sourceId:"world-instance",property:d,type:"color",valueType:"color",startValue:c,endValue:f,ease:a.Maps.GetEaseFromIndex(h),resultMode:g}}static _GetAngleConfig(d,c,f,h,g,l){return{sourceId:"world-instance",property:d,type:"angle",valueType:"angle",startValue:c,endValue:f,ease:a.Maps.GetEaseFromIndex(h),resultMode:g}}static _GetCommonConfig(d,c,f,h,g,l){return{sourceId:"world-instance",property:d,type:"float",valueType:"numeric",startValue:c,endValue:f,ease:a.Maps.GetEaseFromIndex(h),resultMode:g}}static _GetValueConfig(d,c,f,h,g,l){return{sourceId:"value",property:d,type:"float",valueType:"numeric",startValue:c,endValue:f,ease:a.Maps.GetEaseFromIndex(h),resultMode:g}}}}
  {"use strict";const e=self.C3,a=e.Behaviors.Tween,b=Object.assign({},{resultMode:"absolute"},{tags:"",property:"",time:0,ease:0,releaseOnComplete:0,loop:!1,pingPong:!1}),d=Object.assign({},b,{initialValueMode:"current-state",startValue:0,endValue:0}),c=Object.assign({},b,{initialValueMode:"current-state",startValue:[0,0],endValue:[0,0]}),f=Object.assign({},b,{initialValueMode:"current-state",startValue:[0,0,0],endValue:[0,0,0]}),h=Object.assign({},d,{initialValueMode:"start-value"});a.TweenArguments=class{constructor(){}static _SetCommonProperties(g,l,m,u,x,n,q){g.tags=l;g.time=m;g.ease=u;g.releaseOnComplete=x;g.loop=n;g.pingPong=q}static OneProperty(g,l,m,u,x,n,q,t,r){g=a.Maps.GetSinglePropertyFromIndex(m);m=a.Maps.IsColorId(g)?f:d;this._SetCommonProperties(m,l,x,n,q,t,r);a.Maps.IsColorId(g)?(f.endValue[0]=e.GetRValue(u),f.endValue[1]=e.GetGValue(u),f.endValue[2]=e.GetBValue(u),f.property=a.Maps.GetPropertyIndexFromName(g)):a.Maps.IsOpacityId(g)?d.endValue=u/100:d.endValue=u;m.property=a.Maps.GetPropertyIndexFromName(g);return m}static TwoProperties(g,l,m,u,x,n,q,t,r,w){this._SetCommonProperties(c,l,n,q,t,r,w);g=a.Maps.GetPairPropertyFromIndex(m);c.endValue[0]=u;c.endValue[1]=x;c.property=a.Maps.GetPropertyIndexFromName(g);return c}static ValueProperty(g,l,m,u,x,n,q,t,r){this._SetCommonProperties(h,l,x,n,q,t,r);h.startValue=m;h.endValue=u;h.property=a.Maps.GetPropertyIndexFromName("value");return h}}}
  {"use strict";const e=self.C3,a=e.Behaviors.Tween,b=[];a.PropertyTypes=class{constructor(){}static Pick(d){0===b.length&&(b.push({checkFunc:a.Maps.IsPairId,result:this.PAIR}),b.push({checkFunc:a.Maps.IsColorId,result:this.COLOR}),b.push({checkFunc:a.Maps.IsAngleId,result:this.ANGLE}),b.push({checkFunc:a.Maps.IsValueId,result:this.VALUE}),b.push({checkFunc:()=>!0,result:this.OTHER}));e.IsFiniteNumber(d)&&(d=e.Behaviors.Tween.Maps.GetPropertyFromIndex(d));for(const c of b)if(c.checkFunc(d))return c.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 e=self.C3;e.Behaviors.Tween.ValueGetters=class{constructor(){}static _GetPropertyAngleValue(a){a=e.toRadians(parseFloat(a));return e.clampAngle(a)}static _GetColorPropertyValue(a){return a.slice(0)}static _GetPropertyValue(a){return a}}}{"use strict";const e=self.C3;e.Behaviors.Pin=class extends e.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Behaviors.Pin.Type=class extends e.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}
  {"use strict";const e=self.C3;e.Behaviors.Pin.Instance=class extends e.SDKBehaviorInstanceBase{constructor(a,b){super(a);this._pinInst=null;this._pinUid=-1;this._mode="";this._propSet=new Set;this._lastKnownAngle=this._dz=this._dAngle=this._dHeight=this._dWidth=this._dy=this._dx=this._pinImagePoint=this._pinAngle=this._pinDist=0;this._destroy=!1;b&&(this._destroy=b[0]);a=this._runtime.Dispatcher();this._disposables=new e.CompositeDisposable(e.Disposable.From(a,"instancedestroy",d=>this._OnInstanceDestroyed(d.instance)),e.Disposable.From(a,"afterload",d=>this._OnAfterLoad()))}Release(){this._pinInst=null;super.Release()}_SetPinInst(a){a?(this._pinInst=a,this._StartTicking2()):(this._pinInst=null,this._StopTicking2())}_Pin(a,b,d){if(a&&(a=a.GetFirstPicked(this._inst)))if(this._mode=b,this._SetPinInst(a),b=this._inst.GetWorldInfo(),a=a.GetWorldInfo(),"properties"===this._mode){const c=this._propSet;c.clear();for(const f of d)c.add(f);this._dx=b.GetX()-a.GetX();this._dy=b.GetY()-a.GetY();this._dAngle=b.GetAngle()-a.GetAngle();this._lastKnownAngle=b.GetAngle();this._dz=b.GetZElevation()-a.GetZElevation();c.has("x")&&c.has("y")&&(this._pinAngle=e.angleTo(a.GetX(),a.GetY(),b.GetX(),b.GetY())-a.GetAngle(),this._pinDist=e.distanceTo(a.GetX(),a.GetY(),b.GetX(),b.GetY()));c.has("width-abs")?this._dWidth=b.GetWidth()-a.GetWidth():c.has("width-scale")&&(this._dWidth=b.GetWidth()/a.GetWidth());c.has("height-abs")?this._dHeight=b.GetHeight()-a.GetHeight():c.has("height-scale")&&(this._dHeight=b.GetHeight()/a.GetHeight())}else this._pinDist=e.distanceTo(a.GetX(),a.GetY(),b.GetX(),b.GetY())}SaveToJson(){const a=this._propSet,b=this._mode,d={uid:this._pinInst?this._pinInst.GetUID():-1,m:b};if("rope"===b||"bar"===b)d.pd=this._pinDist;else if("properties"===b){d.ps=[...this._propSet];a.has("imagepoint")?d.ip=this._pinImagePoint:a.has("x")&&a.has("y")?(d.pa=this._pinAngle,d.pd=this._pinDist):(a.has("x")&&(d.dx=this._dx),a.has("y")&&(d.dy=this._dy));a.has("angle")&&(d.da=this._dAngle,d.lka=this._lastKnownAngle);if(a.has("width-abs")||a.has("width-scale"))d.dw=this._dWidth;if(a.has("height-abs")||a.has("height-scale"))d.dh=this._dHeight;a.has("z")&&(d.dz=this._dz)}return d}LoadFromJson(a){const b=a.m,d=this._propSet;d.clear();this._pinUid=a.uid;if("number"===typeof b)this._LoadFromJson_Legacy(a);else if(this._mode=b,"rope"===b||"bar"===b)this._pinDist=a.pd;else if("properties"===b){for(const c of a.ps)d.add(c);d.has("imagepoint")?this._pinImagePoint=a.ip:d.has("x")&&d.has("y")?(this._pinAngle=a.pa,this._pinDist=a.pd):(d.has("x")&&(this._dx=a.dx),d.has("y")&&(this._dy=a.dy));d.has("angle")&&(this._dAngle=a.da,this._lastKnownAngle=a.lka||0);if(d.has("width-abs")||d.has("width-scale"))this._dWidth=a.dw;if(d.has("height-abs")||d.has("height-scale"))this._dHeight=a.dh;d.has("z")&&(this._dz=a.dz)}}_LoadFromJson_Legacy(a){const b=this._propSet,d=a.msa,c=a.tsa,f=a.pa,h=a.pd;switch(a.m){case 0:this._mode="properties";b.add("x").add("y").add("angle");this._pinAngle=f;this._pinDist=h;this._dAngle=d-c;this._lastKnownAngle=a.lka;break;case 1:this._mode="properties";b.add("x").add("y");this._pinAngle=f;this._pinDist=h;break;case 2:this._mode="properties";b.add("angle");this._dAngle=d-c;this._lastKnownAngle=a.lka;break;case 3:this._mode="rope";this._pinDist=a.pd;break;case 4:this._mode="bar",this._pinDist=a.pd}}_OnAfterLoad(){-1===this._pinUid?this._SetPinInst(null):(this._SetPinInst(this._runtime.GetInstanceByUID(this._pinUid)),this._pinUid=-1)}_OnInstanceDestroyed(a){this._pinInst===a&&(this._SetPinInst(null),this._destroy&&this._runtime.DestroyInstance(this._inst))}Tick2(){var a=this._pinInst;if(a){var b=a.GetWorldInfo(),d=this._inst.GetWorldInfo(),c=this._mode,f=!1;if("rope"===c||"bar"===c){if(a=e.distanceTo(d.GetX(),d.GetY(),b.GetX(),b.GetY()),a>this._pinDist||"bar"===c&&a<this._pinDist)f=e.angleTo(b.GetX(),b.GetY(),d.GetX(),d.GetY()),d.SetXY(b.GetX()+Math.cos(f)*this._pinDist,b.GetY()+Math.sin(f)*this._pinDist),f=!0}else{c=this._propSet;if(c.has("imagepoint")){const[h,g]=a.GetImagePoint(this._pinImagePoint);d.EqualsXY(h,g)||(d.SetXY(h,g),f=!0)}else if(c.has("x")&&c.has("y")){a=b.GetX()+Math.cos(b.GetAngle()+this._pinAngle)*this._pinDist;const h=b.GetY()+Math.sin(b.GetAngle()+this._pinAngle)*this._pinDist;d.EqualsXY(a,h)||(d.SetXY(a,h),f=!0)}else a=b.GetX()+this._dx,c.has("x")&&a!==d.GetX()&&(d.SetX(a),f=!0),a=b.GetY()+this._dy,c.has("y")&&a!==d.GetY()&&(d.SetY(a),f=!0);c.has("angle")&&(this._lastKnownAngle!==d.GetAngle()&&(this._dAngle=e.clampAngle(this._dAngle+(d.GetAngle()-this._lastKnownAngle))),a=e.clampAngle(b.GetAngle()+this._dAngle),a!==d.GetAngle()&&(d.SetAngle(a),f=!0),this._lastKnownAngle=d.GetAngle());c.has("width-abs")&&(a=b.GetWidth()+this._dWidth,a!==d.GetWidth()&&(d.SetWidth(a),f=!0));c.has("width-scale")&&(a=b.GetWidth()*this._dWidth,a!==d.GetWidth()&&(d.SetWidth(a),f=!0));c.has("height-abs")&&(a=b.GetHeight()+this._dHeight,a!==d.GetHeight()&&(d.SetHeight(a),f=!0));c.has("height-scale")&&(a=b.GetHeight()*this._dHeight,a!==d.GetHeight()&&(d.SetHeight(a),f=!0));c.has("z")&&(a=b.GetZElevation()+this._dz,a!==d.GetZElevation()&&(d.SetZElevation(a),this._runtime.UpdateRender()))}f&&d.SetBboxChanged()}}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.pin.debugger.is-pinned",value:!!this._pinInst},{name:"behaviors.pin.debugger.pinned-uid",value:this._pinInst?this._pinInst.GetUID():0}]}]}}}"use strict";self.C3.Behaviors.Pin.Cnds={IsPinned(){return!!this._pinInst},WillDestroy(){return this._destroy}};"use strict";self.C3.Behaviors.Pin.Acts={PinByDistance(e,a){this._Pin(e,0===a?"rope":"bar")},PinByProperties(e,a,b,d,c,f,h){const g=[];a&&g.push("x");b&&g.push("y");d&&g.push("angle");h&&g.push("z");1===c?g.push("width-abs"):2===c&&g.push("width-scale");1===f?g.push("height-abs"):2===f&&g.push("height-scale");0!==g.length&&this._Pin(e,"properties",g)},PinByImagePoint(e,a,b,d,c,f){const h=["imagepoint"];b&&h.push("angle");f&&h.push("z");1===d?h.push("width-abs"):2===d&&h.push("width-scale");1===c?h.push("height-abs"):2===c&&h.push("height-scale");this._pinImagePoint=a;this._Pin(e,"properties",h)},SetPinDistance(e){if("rope"===this._mode||"bar"===this._mode)this._pinDist=Math.max(e,0)},SetDestroy(e){this._destroy=e},Unpin(){this._SetPinInst(null);this._mode="";this._propSet.clear();this._pinImagePoint=""},Pin(e,a){switch(a){case 0:this._Pin(e,"properties",["x","y","angle"]);break;case 1:this._Pin(e,"properties",["x","y"]);break;case 2:this._Pin(e,"properties",["angle"]);break;case 3:this._Pin(e,"rope");break;case 4:this._Pin(e,"bar")}}};"use strict";self.C3.Behaviors.Pin.Exps={PinnedUID(){return this._pinInst?this._pinInst.GetUID():-1}};{"use strict";const e=self.C3;e.Behaviors.Rotate=class extends e.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Behaviors.Rotate.Type=class extends e.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}
  {"use strict";const e=self.C3;e.Behaviors.Rotate.Instance=class extends e.SDKBehaviorInstanceBase{constructor(a,b){super(a);this._acceleration=this._speed=0;this._isEnabled=!0;b&&(this._speed=e.toRadians(b[0]),this._acceleration=e.toRadians(b[1]),this._isEnabled=b[2]);this._isEnabled&&this._StartTicking()}Release(){super.Release()}SaveToJson(){return{s:this._speed,a:this._acceleration,e:this._isEnabled}}LoadFromJson(a){this._speed=a.s;this._acceleration=a.a;this._SetEnabled(a.e)}Tick(){if(this._isEnabled){var a=this._runtime.GetDt(this._inst);if(0!==a&&(0!==this._acceleration&&(this._speed+=this._acceleration*a),0!==this._speed)){const b=this._inst.GetWorldInfo();b.SetAngle(b.GetAngle()+this._speed*a);b.SetBboxChanged()}}}GetPropertyValueByIndex(a){switch(a){case 0:return e.toDegrees(this._speed);case 1:return e.toDegrees(this._acceleration);case 2:return this._isEnabled}}SetPropertyValueByIndex(a,b){switch(a){case 0:this._speed=e.toRadians(b);break;case 1:this._acceleration=e.toRadians(b);break;case 2:this._SetEnabled(b)}}_SetEnabled(a){(this._isEnabled=!!a)?this._StartTicking():this._StopTicking()}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.rotate.properties.speed.name",value:e.toDegrees(this._speed),onedit:a=>this._speed=e.toRadians(a)},{name:"behaviors.rotate.properties.acceleration.name",value:e.toDegrees(this._acceleration),onedit:a=>this._acceleration=e.toRadians(a)},{name:"behaviors.rotate.properties.enabled.name",value:this._isEnabled,onedit:a=>this._SetEnabled(a)}]}]}}}"use strict";self.C3.Behaviors.Rotate.Cnds={IsEnabled(){return this._isEnabled}};{"use strict";const e=self.C3;e.Behaviors.Rotate.Acts={SetSpeed(a){this._speed=e.toRadians(a)},SetAcceleration(a){this._acceleration=e.toRadians(a)},SetEnabled(a){this._SetEnabled(a)}}}{"use strict";const e=self.C3;e.Behaviors.Rotate.Exps={Speed(){return e.toDegrees(this._speed)},Acceleration(){return e.toDegrees(this._acceleration)}}}{"use strict";const e=self.C3;e.Behaviors.Fade=class extends e.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}}}
  {"use strict";const e=self.C3;e.Behaviors.Fade.Type=class extends e.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}
  {"use strict";const e=self.C3;e.Behaviors.Fade.Instance=class extends e.SDKBehaviorInstanceBase{constructor(a,b){super(a);this._fadeOutTime=this._waitTime=this._fadeInTime=0;this._activeAtStart=this._destroy=!0;this._setMaxOpacity=!1;this._stage=0;this._stageTime=e.New(e.KahanSum);this._maxOpacity=this._inst.GetWorldInfo().GetOpacity()||1;b&&(this._fadeInTime=b[0],this._waitTime=b[1],this._fadeOutTime=b[2],this._destroy=!!b[3],this._stage=(this._activeAtStart=!!b[4])?0:3);this._activeAtStart&&(0===this._fadeInTime?(this._stage=1,0===this._waitTime&&(this._stage=2)):(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(a){this._fadeInTime=a.fit;this._waitTime=a.wt;this._fadeOutTime=a.fot;this._destroy=a.d;this._stage=a.s;this._stageTime.Set(a.st);this._maxOpacity=a.mo}Tick(){var a=this._runtime.GetDt(this._inst);this._stageTime.Add(a);a=this._inst.GetWorldInfo();0===this._stage&&(a.SetOpacity(this._stageTime.Get()/this._fadeInTime*this._maxOpacity),this._runtime.UpdateRender(),a.GetOpacity()>=this._maxOpacity&&(a.SetOpacity(this._maxOpacity),this._stage=1,this._stageTime.Reset(),this.Trigger(e.Behaviors.Fade.Cnds.OnFadeInEnd)));1===this._stage&&this._stageTime.Get()>=this._waitTime&&(this._stage=2,this._stageTime.Reset(),this.Trigger(e.Behaviors.Fade.Cnds.OnWaitEnd));2===this._stage&&0!==this._fadeOutTime&&(a.SetOpacity(this._maxOpacity-this._stageTime.Get()/this._fadeOutTime*this._maxOpacity),this._runtime.UpdateRender(),0>=a.GetOpacity()&&(this._stage=3,this._stageTime.Reset(),this.Trigger(e.Behaviors.Fade.Cnds.OnFadeOutEnd),this._destroy&&this._runtime.DestroyInstance(this._inst)))}Start(){this._stage=0;this._stageTime.Reset();0===this._fadeInTime?(this._stage=1,0===this._waitTime&&(this._stage=2)):(this._inst.GetWorldInfo().SetOpacity(0),this._runtime.UpdateRender())}GetPropertyValueByIndex(a){switch(a){case 0:return this._fadeInTime;case 1:return this._waitTime;case 2:return this._fadeOutTime;case 3:return this._destroy}}SetPropertyValueByIndex(a,b){switch(a){case 0:this._fadeInTime=b;break;case 1:this._waitTime=b;break;case 2:this._fadeOutTime=b;break;case 3:this._destroy=!!b}}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.fade.properties.fade-in-time.name",value:this._fadeInTime,onedit:a=>this._fadeInTime=a},{name:"behaviors.fade.properties.wait-time.name",value:this._waitTime,onedit:a=>this._waitTime=a},{name:"behaviors.fade.properties.fade-out-time.name",value:this._fadeOutTime,onedit:a=>this._fadeOutTime=a},{name:"behaviors.fade.debugger.stage",value:["behaviors.fade.debugger."+["fade-in","wait","fade-out","done"][this._stage]]}]}]}}}"use strict";self.C3.Behaviors.Fade.Cnds={OnFadeOutEnd(){return!0},OnFadeInEnd(){return!0},OnWaitEnd(){return!0}};"use strict";self.C3.Behaviors.Fade.Acts={StartFade(){this._activeAtStart||this._setMaxOpacity||(this._maxOpacity=this._inst.GetWorldInfo().GetOpacity()||1,this._setMaxOpacity=!0);3===this._stage&&this.Start()},RestartFade(){this.Start()},SetFadeInTime(e){0>e&&(e=0);this._fadeInTime=e},SetWaitTime(e){0>e&&(e=0);this._waitTime=e},SetFadeOutTime(e){0>e&&(e=0);this._fadeOutTime=e}};"use strict";self.C3.Behaviors.Fade.Exps={FadeInTime(){return this._fadeInTime},WaitTime(){return this._waitTime},FadeOutTime(){return this._fadeOutTime}};{"use strict";const e=self.C3;e.Behaviors.Flash=class extends e.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Behaviors.Flash.Type=class extends e.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}
  {"use strict";const e=self.C3;e.Behaviors.Flash.Instance=class extends e.SDKBehaviorInstanceBase{constructor(a,b){super(a);this._timeLeft=this._stageTimeLeft=this._stage=this._offTime=this._onTime=0;this._StartTicking()}Release(){super.Release()}SaveToJson(){return{on:this._onTime,off:this._offTime,s:this._stage,stl:this._stageTimeLeft,tl:this._timeLeft}}LoadFromJson(a){this._onTime=a.on;this._offTime=a.off;this._stage=a.s;this._stageTimeLeft=a.stl;this._timeLeft=null===a.tl?Infinity:a.tl}Tick(){if(!(0>=this._timeLeft)){var a=this._runtime.GetDt(this._inst);this._timeLeft-=a;if(0>=this._timeLeft)return this._timeLeft=0,this._inst.GetWorldInfo().SetVisible(!0),this._runtime.UpdateRender(),this.DebugTrigger(e.Behaviors.Flash.Cnds.OnFlashEnded);this._stageTimeLeft-=a;0>=this._stageTimeLeft&&(0===this._stage?(this._inst.GetWorldInfo().SetVisible(!1),this._stage=1,this._stageTimeLeft+=this._offTime):(this._inst.GetWorldInfo().SetVisible(!0),this._stage=0,this._stageTimeLeft+=this._onTime),this._runtime.UpdateRender())}}GetDebuggerProperties(){return[{title:"$"+
  this.GetBehaviorType().GetName(),properties:[{name:"behaviors.flash.debugger.on-time",value:this._onTime,onedit:a=>this._onTime=a},{name:"behaviors.flash.debugger.off-time",value:this._offTime,onedit:a=>this._offTime=a},{name:"behaviors.flash.debugger.is-flashing",value:0<this._timeLeft},{name:"behaviors.flash.debugger.time-left",value:this._timeLeft}]}]}}}"use strict";self.C3.Behaviors.Flash.Cnds={IsFlashing(){return 0<this._timeLeft},OnFlashEnded(){return!0}};"use strict";self.C3.Behaviors.Flash.Acts={Flash(e,a,b){this._onTime=e;this._offTime=a;this._stage=1;this._stageTimeLeft=a;this._timeLeft=b;this._inst.GetWorldInfo().SetVisible(!1);this._runtime.UpdateRender()},StopFlashing(){this._timeLeft=0;this._inst.GetWorldInfo().SetVisible(!0);this._runtime.UpdateRender()}};"use strict";self.C3.Behaviors.Flash.Exps={};{"use strict";const e=self.C3;e.Behaviors.Anchor=class extends e.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}}}
  {"use strict";const e=self.C3;e.Behaviors.Anchor.Type=class extends e.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}
  {"use strict";const e=self.C3;e.Behaviors.Anchor.Instance=class extends e.SDKBehaviorInstanceBase{constructor(a,b){super(a);this._anchorTop=this._anchorLeft=2;this._anchorBottom=this._anchorRight=0;this._isEnabled=!0;a=this._inst.GetWorldInfo().GetBoundingBox();this._xLeft=a.getLeft();this._yTop=a.getTop();this._xRight=this._runtime.GetOriginalViewportWidth()-a.getLeft();this._yBottom=this._runtime.GetOriginalViewportHeight()-a.getTop();this._rDiff=this._runtime.GetOriginalViewportWidth()-a.getRight();this._bDiff=this._runtime.GetOriginalViewportHeight()-a.getBottom();b&&(this._anchorLeft=b[0],this._anchorTop=b[1],this._anchorRight=b[2],this._anchorBottom=b[3],this._isEnabled=!!b[4]);b=this._runtime.Dispatcher();this._disposables=new e.CompositeDisposable(e.Disposable.From(b,"layoutchange",()=>this._OnLayoutChange()));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(a){this._xLeft=a.xl;this._yTop=a.yt;this._xRight=a.xr;this._yBottom=a.yb;this._rDiff=a.rd;this._bDiff=a.bd;this._anchorLeft=a.al;this._anchorTop=a.at;this._anchorRight=a.ar;this._anchorBottom=a.ab;(this._isEnabled=a.e)?this._StartTicking():this._StopTicking()}_UpdatePosition(){if(this._isEnabled){var a=this._inst.GetWorldInfo(),b=a.GetLayer().GetViewport();if(0===this._anchorLeft){var d=b.getLeft()+this._xLeft-
  a.GetBoundingBox().getLeft();0!==d&&(a.OffsetX(d),a.SetBboxChanged())}else 1===this._anchorLeft&&(d=b.getRight()-this._xRight-a.GetBoundingBox().getLeft(),0!==d&&(a.OffsetX(d),a.SetBboxChanged()));0===this._anchorTop?(d=b.getTop()+this._yTop-a.GetBoundingBox().getTop(),0!==d&&(a.OffsetY(d),a.SetBboxChanged())):1===this._anchorTop&&(d=b.getBottom()-this._yBottom-a.GetBoundingBox().getTop(),0!==d&&(a.OffsetY(d),a.SetBboxChanged()));1===this._anchorRight&&(d=b.getRight()-this._rDiff-a.GetBoundingBox().getRight(),0!==d&&(a.OffsetX(a.GetOriginX()*d),a.SetWidth(Math.max(a.GetWidth()+d),0),a.SetBboxChanged(),this._rDiff=b.getRight()-a.GetBoundingBox().getRight()));1===this._anchorBottom&&(d=b.getBottom()-this._bDiff-a.GetBoundingBox().getBottom(),0!==d&&(a.OffsetY(a.GetOriginY()*d),a.SetHeight(Math.max(a.GetHeight()+d,0)),a.SetBboxChanged(),this._bDiff=b.getBottom()-a.GetBoundingBox().getBottom()))}}Tick(){this._UpdatePosition()}_OnLayoutChange(){this._UpdatePosition()}GetPropertyValueByIndex(a){switch(a){case 0:return this._anchorLeft;case 1:return this._anchorTop;case 2:return this._anchorRight;case 3:return this._anchorBottom;case 4:return this._isEnabled}}SetPropertyValueByIndex(a,b){switch(a){case 0:this._anchorLeft=b;break;case 1:this._anchorTop=b;break;case 2:this._anchorRight=b;break;case 3:this._anchorBottom=b;break;case 4:(this._isEnabled=!!b)?this._StartTicking():this._StopTicking()}}}}"use strict";self.C3.Behaviors.Anchor.Cnds={IsEnabled(){return this._isEnabled}};"use strict";self.C3.Behaviors.Anchor.Acts={SetEnabled(e){this._isEnabled&&0===e?(this._isEnabled=!1,this._StopTicking()):this._isEnabled||0===e||(e=this._inst.GetWorldInfo().GetBoundingBox(),this._xLeft=e.getLeft(),this._yTop=e.getTop(),this._xRight=this._runtime.GetOriginalViewportWidth()-e.getLeft(),this._yBottom=this._runtime.GetOriginalViewportHeight()-e.getTop(),this._rDiff=this._runtime.GetOriginalViewportWidth()-e.getRight(),this._bDiff=this._runtime.GetOriginalViewportHeight()-e.getBottom(),this._isEnabled=!0,this._StartTicking())}};"use strict";self.C3.Behaviors.Anchor.Exps={};{const e=self.C3;self.C3_GetObjectRefTable=function(){return[e.Plugins.Sprite,e.Behaviors.Physics,e.Behaviors.scrollto,e.Plugins.Touch,e.Plugins.DrawingCanvas,e.Plugins.TiledBg,e.Plugins.SVGPicture,e.Behaviors.Tween,e.Behaviors.Pin,e.Behaviors.Rotate,e.Plugins.Browser,e.Plugins.Dictionary,e.Plugins.LocalStorage,e.Plugins.Text,e.Plugins.Timeline,e.Behaviors.Fade,e.Plugins.advert,e.Behaviors.Flash,e.Behaviors.Anchor,e.Plugins.System.Cnds.OnLayoutStart,e.Plugins.Sprite.Cnds.CompareInstanceVar,e.Plugins.System.Exps.int,e.Plugins.Dictionary.Exps.Get,e.Plugins.Sprite.Cnds.PickChildren,e.Behaviors.Physics.Acts.SetEnabled,e.Plugins.Sprite.Acts.SetX,e.Plugins.System.Acts.SetLayerVisible,e.Behaviors.Physics.Acts.CreateRevoluteJoint,e.Behaviors.Physics.Acts.SetWorldGravity,e.Behaviors.Physics.Acts.EnableCollisions,e.Plugins.Sprite.Acts.AddChild,e.Plugins.DrawingCanvas.Acts.AddChild,e.Plugins.TiledBg.Acts.MoveToBottom,e.Plugins.Sprite.Acts.SetPos,e.Plugins.Sprite.Exps.X,e.Plugins.Sprite.Exps.Y,e.Behaviors.Pin.Acts.PinByProperties,e.Plugins.Sprite.Acts.MoveToBottom,e.Plugins.System.Acts.SetVar,e.Plugins.Sprite.Acts.MoveToLayer,e.Plugins.Timeline.Acts.PlayTimeline,e.Plugins.Text.Acts.SetText,e.Plugins.Sprite.Acts.SetAnim,e.Plugins.Sprite.Exps.AnimationName,e.Plugins.Sprite.Cnds.PickByUID,e.Plugins.Sprite.Cnds.IsOverlapping,e.Behaviors.Physics.Acts.RemoveJoints,e.Plugins.System.Cnds.Compare,e.Plugins.TiledBg.Acts.SetX,e.Plugins.TiledBg.Exps.X,e.Plugins.Sprite.Acts.Destroy,e.Plugins.System.Cnds.CompareVar,e.Plugins.System.Exps.max,e.Plugins.System.Exps.scrollx,e.Plugins.System.Acts.ScrollX,e.Plugins.System.Cnds.TriggerOnce,e.Plugins.Text.Acts.SetVisible,e.Plugins.System.Cnds.ForEach,e.Behaviors.Physics.Cnds.CompareAngularVelocity,e.Plugins.Sprite.Exps.Width,e.Behaviors.Physics.Acts.SetAngularVelocity,e.Plugins.Touch.Cnds.IsTouchingObject,e.Plugins.Touch.Exps.X,e.Plugins.Touch.Exps.Y,e.Behaviors.Physics.Acts.SetPreventRotate,e.Plugins.Sprite.Cnds.CompareX,e.Plugins.Sprite.Acts.SetWidth,e.Plugins.System.Cnds.Else,e.Plugins.Sprite.Acts.SetTowardPosition,e.Plugins.DrawingCanvas.Acts.FillEllipse,e.Plugins.DrawingCanvas.Exps.X,e.Plugins.System.Exps.rgba,e.Plugins.Sprite.Acts.Spawn,e.Plugins.DrawingCanvas.Acts.Line,e.Plugins.DrawingCanvas.Cnds.CompareX,e.Plugins.DrawingCanvas.Exps.Width,e.Plugins.DrawingCanvas.Acts.SetX,e.Plugins.DrawingCanvas.Acts.ClearCanvas,e.Plugins.System.Cnds.Every,e.Plugins.Sprite.Cnds.CompareOpacity,e.Plugins.Sprite.Acts.SetOpacity,e.Plugins.System.Cnds.PickRandom,e.Plugins.System.Cnds.EveryTick,e.Plugins.System.Exps.random,e.Plugins.Sprite.Exps.Height,e.Plugins.Sprite.Cnds.IsAnimPlaying,e.Plugins.System.Acts.CreateObject,e.Plugins.Sprite.Acts.SetY,e.Plugins.Sprite.Acts.SetAngle,e.Plugins.Sprite.Exps.Angle,e.Plugins.Sprite.Acts.SetHeight,e.Plugins.Sprite.Exps.ImageHeight,e.Plugins.Touch.Cnds.OnTapGestureObject,e.Plugins.Dictionary.Acts.SetKey,e.Plugins.LocalStorage.Acts.SetItem,e.Plugins.Dictionary.Exps.AsJSON,e.Plugins.System.Acts.RestartLayout,e.Plugins.Sprite.Cnds.CompareY,e.Plugins.SVGPicture.Cnds.OnCreated,e.Plugins.System.Acts.Wait,e.Behaviors.Tween.Acts.TweenOneProperty,e.Plugins.Sprite.Cnds.OnCreated,e.Plugins.System.Acts.AddVar,e.Plugins.Sprite.Acts.SetVisible,e.Plugins.Sprite.Acts.MoveToTop,e.Plugins.System.Acts.WaitForSignal,e.Plugins.SVGPicture.Acts.Destroy,e.Plugins.System.Exps.float,e.Plugins.System.Exps.left,e.Plugins.System.Exps.len,e.Plugins.System.Acts.SetFunctionReturnValue,e.Plugins.System.Exps.right,e.Plugins.System.Cnds.For,e.Plugins.TiledBg.Exps.Y,e.Plugins.Sprite.Acts.SetScale,e.Plugins.Sprite.Exps.ImageWidth,e.Behaviors.Physics.Acts.ApplyForceAtAngle,e.Plugins.System.Exps.choose,e.Plugins.Sprite.Acts.SetAnimFrame,e.Plugins.Sprite.Cnds.OnCollision,e.Plugins.Dictionary.Acts.AddKey,e.Plugins.System.Acts.GoToLayout,e.Plugins.LocalStorage.Acts.CheckItemExists,e.Plugins.LocalStorage.Cnds.OnItemMissing,e.Plugins.LocalStorage.Cnds.OnItemExists,e.Plugins.LocalStorage.Acts.GetItem,e.Plugins.LocalStorage.Cnds.OnItemGet,e.Plugins.Dictionary.Acts.JSONLoad,e.Plugins.LocalStorage.Exps.ItemValue,e.Plugins.Dictionary.Cnds.HasKey,e.Plugins.System.Exps.wallclocktime,e.Plugins.advert.Acts.ShowInterstitial,e.Plugins.System.Acts.Signal,e.Plugins.advert.Cnds.OnInterstitialComplete,e.Plugins.Text.Exps.Text,e.Plugins.System.Acts.SetGroupActive,e.Plugins.advert.Cnds.OnInterstitialReady,e.Plugins.advert.Cnds.OnInterstitialFailedToLoad,e.Plugins.advert.Cnds.OnInterstitialCancelled,e.Plugins.System.Cnds.IsGroupActive,e.Plugins.advert.Cnds.IsConfigured,e.Plugins.advert.Acts.CreateInterstitial,e.Plugins.advert.Acts.ShowVideo,e.Plugins.advert.Acts.CreateVideo,e.Plugins.advert.Cnds.OnVideoComplete,e.Plugins.advert.Cnds.OnVideoReady,e.Plugins.System.Cnds.LayerVisible,e.Plugins.advert.Cnds.OnVideoFailedToLoad,e.Plugins.SVGPicture.Acts.SetOpacity,e.Behaviors.Fade.Acts.RestartFade,e.Plugins.advert.Cnds.OnVideoCancelled,e.Behaviors.Flash.Acts.Flash,e.Plugins.Sprite.Acts.SetPosToObject,e.Plugins.Text.Acts.SetPosToObject]};self.C3_JsPropNameTable=[{Physics:0},{ground_physics:0},{ScrollTo:0},{car_:0},{pipe_start:0},{pipe:0},{wheel_:0},{Touch:0},{drawing_helper:0},{input:0},{DrawingCanvas:0},{mark_for_spawmer:0},{TiledBackground:0},{SPAWMER:0},{selector_:0},{Flat_restart_iconsvg:0},{Tween:0},{SVGPicture:0},{pipe_shadow:0},{Pin:0},{car_shadow:0},{wheel_shadow:0},{Rotate:0},{sand_clock:0},{Browser:0},{gameover:0},{Dictionary:0},{LocalStorage:0},{t_score:0},{TiledBackground2:0},{pencil:0},{touch_tuto1:0},{Timeline:0},{Fade:0},{touch_tuto2:0},{t_best:0},{best:0},{mark_for_camera:0},{mark_for_back_:0},{back_:0},{Sprite:0},{t_new_best:0},{MobileAdvert:0},{Sprite3:0},{number:0},{car_group:0},{coin_:0},{Flash:0},{t_coins__:0},{box_car_2:0},{button:0},{button_car:0},{car_selected:0},{button_back:0},{Anchor:0},{ad_cover_:0},{close_ad_reward:0},{button_reward:0},{t_reward:0},{SVGPicture2:0},{svg_loading:0},{price_box:0},{car5_charger:0},{car5_joint:0},{t_price:0},{t_debug_:0},{shadow_h:0},{shadow_v:0},{LOSE:0},{PLAYING:0},{ENTER_A_LINE:0},{TIMER_FOR_END:0},{X_AT_START:0},{SCORE:0},{ADD_FOR_COINS:0},{temporal_score_to_compare:0},{x_:0},{y_:0},{min_disp_hor_spawner:0},{max_disp_hor_spawner:0},{min_disp_hor_spawner_init:0},{max_disp_hor_spawner_init:0},{need_reset_opacity:0},{displace_vertical_pipes:0},{displace_horizontal_spawmer:0},{LAST_SCORE_TO_CHECK:0},{ENTIRE:0},{DECIMAL:0},{number_:0},{SAVE_NAME:0},{VERSION:0},{REWAR_ID:0},{REWAR_STATE:0},{INTER_ID:0},{INTER_STATE:0},{LAST_INTER:0},{REWARD_COINS_:0}]}
  {const e=self.C3;function a(f,h){return"number"===typeof f&&"number"===typeof h}function b(f,h){return a(f,h)?f+h:f}function d(f,h){return a(f,h)?f*h:f}function c(f,h){return"string"===typeof f||"string"===typeof h?("number"===typeof f?(Math.round(1E10*f)/1E10).toString():f)+("number"===typeof h?(Math.round(1E10*h)/1E10).toString():h):f&&h?1:0}self.C3_ExpressionFuncs=[f=>{const h=f._GetNode(0).GetBoundMethod(),g=f._GetNode(1);return()=>h(g.ExpObject("current_car"))},()=>100,()=>"cover_ad",()=>0,()=>22,f=>{const h=f._GetNode(0),g=f._GetNode(1).GetVar();return()=>h.ExpObject()+g.GetValue()},()=>-60,()=>"shadows",f=>{const h=f._GetNode(0);return()=>h.ExpObject()},()=>"",f=>{const h=f._GetNode(0).GetBoundMethod(),g=f._GetNode(1);return()=>"best: "+h(g.ExpObject("best"))+"m"},f=>{const h=f._GetNode(0).GetVar();return()=>h.GetValue()},()=>38,()=>2,()=>1,f=>{const h=f._GetNode(0);return()=>h.ExpObject("best")},f=>{const h=f._GetNode(0),g=f._GetNode(1).GetVar();return()=>b(d(h.ExpObject("best"),100),g.GetValue())},f=>{const h=f._GetNode(0);return()=>c("COINS: ",h.ExpObject("money"))},f=>{const h=f._GetNode(0).GetBoundMethod(),g=f._GetNode(1),l=f._GetNode(2).GetVar(),m=f._GetNode(3).GetVar();return()=>h(Math.abs((g.ExpObject()-l.GetValue())/100),m.GetValue())},f=>{const h=f._GetNode(0).GetBoundMethod(),g=f._GetNode(1).GetVar();return()=>h(g.GetValue())+"m"},f=>{const h=f._GetNode(0).GetBoundMethod();return()=>h()},f=>{const h=f._GetNode(0);return()=>47.352895*Math.PI/360*500/(h.ExpObject()*Math.PI/360)},f=>{const h=f._GetNode(0).GetBoundMethod();return()=>h("screen")},f=>{const h=f._GetNode(0).GetBoundMethod();return()=>h("game")},f=>{const h=f._GetNode(0),g=f._GetNode(1),l=f._GetNode(2).GetBoundMethod(),m=f._GetNode(3).GetBoundMethod();return()=>e.distanceTo(h.ExpObject(),g.ExpObject(),l("game"),m("game"))},f=>{const h=f._GetNode(0).GetBoundMethod(),g=f._GetNode(1).GetBoundMethod(),l=f._GetNode(2),m=f._GetNode(3);return()=>e.distanceTo(h("game"),g("game"),l.ExpObject(),m.ExpObject())},()=>25,f=>{const h=f._GetNode(0),g=f._GetNode(1);return()=>h.ExpObject()-g.ExpObject()},()=>4.5,f=>{const h=f._GetNode(0).GetBoundMethod();return()=>h(0,0,0,100)},()=>"game",f=>{const h=f._GetNode(0),g=f._GetNode(1),l=f._GetNode(2),m=f._GetNode(3);return()=>e.distanceTo(h.ExpObject(),g.ExpObject(),l.ExpObject(),m.ExpObject())},f=>{const h=f._GetNode(0).GetVar(),g=f._GetNode(1);return()=>h.GetValue()-g.ExpObject()},f=>{const h=f._GetNode(0).GetBoundMethod(),g=f._GetNode(1);return()=>h("game")-g.ExpObject()},()=>10,()=>-1E3,f=>{const h=f._GetNode(0),g=f._GetNode(1);return()=>h.ExpObject()-1.3*g.ExpObject()},f=>{const h=f._GetNode(0),g=f._GetNode(1);return()=>h.ExpObject()+2*g.ExpObject()},f=>{const h=f._GetNode(0).GetBoundMethod();return()=>h(0,0,0,0)},f=>{const h=f._GetNode(0);return()=>h.ExpObject()-1E3},()=>50,f=>{const h=f._GetNode(0).GetBoundMethod(),g=f._GetNode(1),l=f._GetNode(2);return()=>h(-g.ExpObject()/2,l.ExpObject()/2)},f=>{const h=f._GetNode(0).GetBoundMethod(),g=f._GetNode(1).GetVar(),l=f._GetNode(2).GetVar();return()=>h(g.GetValue(),l.GetValue())},f=>{const h=f._GetNode(0),g=f._GetNode(1).GetVar();return()=>h.ExpObject()+g.GetValue()/2},()=>"Animation 1",()=>-90,()=>"Animation 2",()=>90,f=>{const h=f._GetNode(0),g=f._GetNode(1).GetBoundMethod(),l=f._GetNode(2).GetVar(),m=f._GetNode(3).GetVar();return()=>h.ExpObject()+g(l.GetValue(),m.GetValue())},f=>{const h=f._GetNode(0);return()=>-1*h.ExpObject()},()=>"Animation 3",f=>{const h=f._GetNode(0),g=f._GetNode(1).GetVar(),l=f._GetNode(2).GetBoundMethod();return()=>h.ExpObject()+g.GetValue()-l(150,220)},()=>"best",f=>{const h=f._GetNode(0).GetBoundMethod(),g=f._GetNode(1).GetVar(),l=f._GetNode(2);return()=>h(g.GetValue(),l.ExpObject("best"))},()=>320,()=>44,()=>3,()=>800,()=>120,()=>"continue_game_over",f=>{const h=f._GetNode(0).GetVar();return()=>Math.floor(h.GetValue())},f=>{const h=f._GetNode(0).GetBoundMethod(),g=f._GetNode(1).GetBoundMethod(),l=f._GetNode(2).GetVar(),m=f._GetNode(3).GetVar();return()=>h(g((l.GetValue()-m.GetValue()).toString(),3))},f=>{const h=f._GetNode(0).GetBoundMethod(),g=f._GetNode(1).GetVar();return()=>h(g.GetValue().toString())},f=>{const h=f._GetNode(0).GetVar();return()=>c(h.GetValue(),".0")},f=>{const h=f._GetNode(0).GetVar(),g=f._GetNode(1).GetBoundMethod(),l=f._GetNode(2).GetVar();return()=>c(h.GetValue(),g(l.GetValue().toString(),2))},()=>"tuto",()=>40,f=>{const h=f._GetNode(0),g=f._GetNode(1).GetBoundMethod();return()=>h.ExpObject()+g(-70,70)},f=>{const h=f._GetNode(0),g=f._GetNode(1).GetBoundMethod();return()=>h.ExpObject()+g(-300,300)},f=>{const h=f._GetNode(0),g=f._GetNode(1),l=f._GetNode(2).GetBoundMethod();return()=>h.ExpObject()/g.ExpObject()*l(1,1.5)},f=>{const h=f._GetNode(0);return()=>3*h.ExpObject()},f=>{const h=f._GetNode(0).GetBoundMethod();return()=>h(20,50)},f=>{const h=f._GetNode(0).GetBoundMethod();return()=>h(-30,30)},f=>{const h=f._GetNode(0).GetBoundMethod(),g=f._GetNode(1).GetBoundMethod();return()=>d(h(400,500),g(1,-1))},f=>{const h=f._GetNode(0).GetBoundMethod();return()=>h(0,1,2,3)},f=>{const h=f._GetNode(0).GetVar();return()=>.9*h.GetValue()},f=>{const h=f._GetNode(0).GetVar();return()=>.99*h.GetValue()},()=>150,()=>200,f=>{const h=f._GetNode(0).GetVar();return()=>.95*h.GetValue()},()=>"money",f=>{const h=f._GetNode(0).GetBoundMethod(),g=f._GetNode(1),l=f._GetNode(2).GetVar();return()=>h(g.ExpObject("money"))+l.GetValue()},f=>{const h=f._GetNode(0).GetVar(),g=f._GetNode(1).GetVar();return()=>h.GetValue()+g.GetValue()},()=>"car_available1",()=>"car_price2",()=>600,()=>"car_price3",()=>1E3,()=>"car_price4",()=>400,()=>"car_price5",()=>"current_car",f=>{const h=f._GetNode(0).GetBoundMethod();return()=>h()-60},()=>"loaded",()=>.2,f=>{const h=f._GetNode(0);return()=>h.ExpObject()+"\ninter complete"},()=>"none",()=>"LOAD_INTER",f=>{const h=f._GetNode(0);return()=>h.ExpObject()+"\ninter ready"},f=>{const h=f._GetNode(0);return()=>h.ExpObject()+"\ninter fail load"},f=>{const h=f._GetNode(0);return()=>h.ExpObject()+"\ninter canceled"},()=>"loading",()=>"ad_reward_cover",f=>{const h=f._GetNode(0);return()=>h.ExpObject()+"\nrewar complete"},f=>{const h=f._GetNode(0);return()=>h.ExpObject()+"\nrewar ready"},f=>{const h=f._GetNode(0);return()=>h.ExpObject()+"\nrewar fail to load"},f=>{const h=f._GetNode(0);return()=>h.ExpObject()+"\nrewar canceled"},f=>{const h=f._GetNode(0).GetBoundMethod(),g=f._GetNode(1),l=f._GetNode(2);return()=>h(g.ExpObject(c("car_available",l.ExpInstVar())))},f=>{const h=f._GetNode(0).GetBoundMethod(),g=f._GetNode(1),l=f._GetNode(2);return()=>h(g.ExpObject(c("car_price",l.ExpInstVar())))},f=>{const h=f._GetNode(0).GetBoundMethod(),g=f._GetNode(1);return()=>h(g.ExpObject("money"))},f=>{const h=f._GetNode(0).GetBoundMethod(),g=f._GetNode(1),l=f._GetNode(2).GetBoundMethod(),m=f._GetNode(3),u=f._GetNode(4);return()=>h(g.ExpObject("money"))-l(m.ExpObject(c("car_price",u.ExpInstVar())))},f=>{const h=f._GetNode(0);return()=>h.ExpInstVar()},f=>{const h=f._GetNode(0);return()=>c("car_available",h.ExpInstVar())},()=>.1,f=>{const h=f._GetNode(0),g=f._GetNode(1);return()=>c("$",h.ExpObject(c("car_price",g.ExpInstVar())))}]}var module$str$c3runtime={};var module$str$__c3root__={};