// Generated by Construct 3, the game and app creator :: https://www.construct.net 'use strict';"use strict"; (function(f,b){"object"===typeof exports&&"undefined"!==typeof module?b(exports):"function"===typeof define&&define.amd?define(["exports"],b):(f="undefined"!==typeof globalThis?globalThis:f||self,b(f.glMatrix={}))})(this,function(f){function b(k,n,v){var z=n[0],C=n[1],D=n[2];n=n[3];var G=v[0],K=v[1],M=v[2];v=v[3];k[0]=z*G+D*K;k[1]=C*G+n*K;k[2]=z*M+D*v;k[3]=C*M+n*v;return k}function a(k,n,v){k[0]=n[0]-v[0];k[1]=n[1]-v[1];k[2]=n[2]-v[2];k[3]=n[3]-v[3];return k}function c(k,n,v){var z=n[0],C=n[1],D= n[2],G=n[3],K=n[4];n=n[5];var M=v[0],O=v[1],R=v[2],T=v[3],Y=v[4];v=v[5];k[0]=z*M+D*O;k[1]=C*M+G*O;k[2]=z*R+D*T;k[3]=C*R+G*T;k[4]=z*Y+D*v+K;k[5]=C*Y+G*v+n;return k}function d(k,n,v){k[0]=n[0]-v[0];k[1]=n[1]-v[1];k[2]=n[2]-v[2];k[3]=n[3]-v[3];k[4]=n[4]-v[4];k[5]=n[5]-v[5];return k}function e(){var k=new sa(9);sa!=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,n,v){var z=n[0],C=n[1],D=n[2],G=n[3],K=n[4],M=n[5],O=n[6],R=n[7];n=n[8];var T=v[0],Y=v[1], X=v[2],fa=v[3],ha=v[4],ba=v[5],qa=v[6],ka=v[7];v=v[8];k[0]=T*z+Y*G+X*O;k[1]=T*C+Y*K+X*R;k[2]=T*D+Y*M+X*n;k[3]=fa*z+ha*G+ba*O;k[4]=fa*C+ha*K+ba*R;k[5]=fa*D+ha*M+ba*n;k[6]=qa*z+ka*G+v*O;k[7]=qa*C+ka*K+v*R;k[8]=qa*D+ka*M+v*n;return k}function g(k,n,v){k[0]=n[0]-v[0];k[1]=n[1]-v[1];k[2]=n[2]-v[2];k[3]=n[3]-v[3];k[4]=n[4]-v[4];k[5]=n[5]-v[5];k[6]=n[6]-v[6];k[7]=n[7]-v[7];k[8]=n[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,n,v){var z=n[0],C=n[1],D=n[2],G=n[3],K=n[4],M=n[5],O=n[6],R=n[7],T=n[8],Y=n[9],X=n[10],fa=n[11],ha=n[12],ba=n[13],qa=n[14];n=n[15];var ka=v[0],ta=v[1],ua=v[2],ra=v[3];k[0]=ka*z+ta*K+ua*T+ra*ha;k[1]=ka*C+ta*M+ua*Y+ra*ba;k[2]=ka*D+ta*O+ua*X+ra*qa;k[3]=ka*G+ta*R+ua*fa+ra*n;ka=v[4];ta=v[5];ua=v[6];ra=v[7];k[4]=ka*z+ta*K+ua*T+ra*ha;k[5]=ka*C+ta*M+ua*Y+ra*ba;k[6]=ka*D+ta*O+ua*X+ra*qa;k[7]=ka*G+ta*R+ua*fa+ra*n;ka=v[8];ta=v[9];ua=v[10];ra=v[11];k[8]=ka*z+ta*K+ ua*T+ra*ha;k[9]=ka*C+ta*M+ua*Y+ra*ba;k[10]=ka*D+ta*O+ua*X+ra*qa;k[11]=ka*G+ta*R+ua*fa+ra*n;ka=v[12];ta=v[13];ua=v[14];ra=v[15];k[12]=ka*z+ta*K+ua*T+ra*ha;k[13]=ka*C+ta*M+ua*Y+ra*ba;k[14]=ka*D+ta*O+ua*X+ra*qa;k[15]=ka*G+ta*R+ua*fa+ra*n;return k}function u(k,n,v){var z=n[0],C=n[1],D=n[2],G=n[3],K=z+z,M=C+C,O=D+D;n=z*K;var R=z*M;z*=O;var T=C*M;C*=O;D*=O;K*=G;M*=G;G*=O;k[0]=1-(T+D);k[1]=R+G;k[2]=z-M;k[3]=0;k[4]=R-G;k[5]=1-(n+D);k[6]=C+K;k[7]=0;k[8]=z+M;k[9]=C-K;k[10]=1-(n+T);k[11]=0;k[12]=v[0];k[13]= v[1];k[14]=v[2];k[15]=1;return k}function w(k,n){k[0]=n[12];k[1]=n[13];k[2]=n[14];return k}function q(k,n){var v=n[4],z=n[5],C=n[6],D=n[8],G=n[9],K=n[10];k[0]=Math.hypot(n[0],n[1],n[2]);k[1]=Math.hypot(v,z,C);k[2]=Math.hypot(D,G,K);return k}function t(k,n){var v=new sa(3);q(v,n);var z=1/v[0],C=1/v[1],D=1/v[2],G=n[0]*z;v=n[1]*C;var K=n[2]*D,M=n[4]*z,O=n[5]*C,R=n[6]*D;z*=n[8];C*=n[9];n=n[10]*D;D=G+O+n;0O&&G>n?(G=2*Math.sqrt(1+ G-O-n),k[3]=(R-C)/G,k[0]=.25*G,k[1]=(v+M)/G,k[2]=(z+K)/G):O>n?(G=2*Math.sqrt(1+O-G-n),k[3]=(z-K)/G,k[0]=(v+M)/G,k[1]=.25*G,k[2]=(R+C)/G):(G=2*Math.sqrt(1+n-G-O),k[3]=(v-M)/G,k[0]=(z+K)/G,k[1]=(R+C)/G,k[2]=.25*G);return k}function p(k,n,v,z,C){n=1/Math.tan(n/2);k[0]=n/v;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=n;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!=C&&Infinity!==C?(v=1/(z-C),k[10]=(C+z)*v,k[14]=2*C*z*v):(k[10]=-1,k[14]=-2*z);return k}function r(k,n,v,z,C,D,G){var K=1/(n-v),M= 1/(z-C),O=1/(D-G);k[0]=-2*K;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=-2*M;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=2*O;k[11]=0;k[12]=(n+v)*K;k[13]=(C+z)*M;k[14]=(G+D)*O;k[15]=1;return k}function x(k,n,v){k[0]=n[0]-v[0];k[1]=n[1]-v[1];k[2]=n[2]-v[2];k[3]=n[3]-v[3];k[4]=n[4]-v[4];k[5]=n[5]-v[5];k[6]=n[6]-v[6];k[7]=n[7]-v[7];k[8]=n[8]-v[8];k[9]=n[9]-v[9];k[10]=n[10]-v[10];k[11]=n[11]-v[11];k[12]=n[12]-v[12];k[13]=n[13]-v[13];k[14]=n[14]-v[14];k[15]=n[15]-v[15];return k}function y(){var k=new sa(3);sa!=Float32Array&& (k[0]=0,k[1]=0,k[2]=0);return k}function E(k){return Math.hypot(k[0],k[1],k[2])}function H(k,n,v){var z=new sa(3);z[0]=k;z[1]=n;z[2]=v;return z}function A(k,n,v){k[0]=n[0]-v[0];k[1]=n[1]-v[1];k[2]=n[2]-v[2];return k}function F(k,n,v){k[0]=n[0]*v[0];k[1]=n[1]*v[1];k[2]=n[2]*v[2];return k}function J(k,n,v){k[0]=n[0]/v[0];k[1]=n[1]/v[1];k[2]=n[2]/v[2];return k}function B(k,n){return Math.hypot(n[0]-k[0],n[1]-k[1],n[2]-k[2])}function I(k,n){var v=n[0]-k[0],z=n[1]-k[1];k=n[2]-k[2];return v*v+z*z+k*k}function L(k){var n= k[0],v=k[1];k=k[2];return n*n+v*v+k*k}function P(k,n){var v=n[0],z=n[1],C=n[2];v=v*v+z*z+C*C;0R&&(R=-R,K=-K,M=-M,O=-O,v=-v);if(1E-6<1-R){var T=Math.acos(R);var Y=Math.sin(T);R=Math.sin((1-z)*T)/Y;z=Math.sin(z*T)/Y}else R=1-z;k[0]=R*C+z*K;k[1]=R*D+z*M;k[2]=R*G+z*O;k[3]=R*n+z*v;return k}function xb(k,n){var v=n[0]+n[4]+n[8];if(0n[0]&&(z=1);n[8]>n[3*z+z]&&(z=2);var C=(z+1)%3,D=(z+2)%3;v=Math.sqrt(n[3*z+z]-n[3*C+C]- n[3*D+D]+1);k[z]=.5*v;v=.5/v;k[3]=(n[3*C+D]-n[3*D+C])*v;k[C]=(n[3*C+z]+n[3*z+C])*v;k[D]=(n[3*D+z]+n[3*z+D])*v}return k}function yb(k,n,v){var z=.5*v[0],C=.5*v[1];v=.5*v[2];var D=n[0],G=n[1],K=n[2];n=n[3];k[0]=D;k[1]=G;k[2]=K;k[3]=n;k[4]=z*n+C*K-v*G;k[5]=C*n+v*D-z*K;k[6]=v*n+z*G-C*D;k[7]=-z*D-C*G-v*K;return k}function zb(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];k[4]=n[4];k[5]=n[5];k[6]=n[6];k[7]=n[7];return k}function eb(k,n,v){var z=n[0],C=n[1],D=n[2],G=n[3],K=v[4],M=v[5],O=v[6],R=v[7],T=n[4], Y=n[5],X=n[6];n=n[7];var fa=v[0],ha=v[1],ba=v[2];v=v[3];k[0]=z*v+G*fa+C*ba-D*ha;k[1]=C*v+G*ha+D*fa-z*ba;k[2]=D*v+G*ba+z*ha-C*fa;k[3]=G*v-z*fa-C*ha-D*ba;k[4]=z*R+G*K+C*O-D*M+T*v+n*fa+Y*ba-X*ha;k[5]=C*R+G*M+D*K-z*O+Y*v+n*ha+X*fa-T*ba;k[6]=D*R+G*O+z*M-C*K+X*v+n*ba+T*ha-Y*fa;k[7]=G*R-z*K-C*M-D*O+n*v-T*fa-Y*ha-X*ba;return k}function Wa(){var k=new sa(2);sa!=Float32Array&&(k[0]=0,k[1]=0);return k}function fb(k,n,v){k[0]=n[0]-v[0];k[1]=n[1]-v[1];return k}function gb(k,n,v){k[0]=n[0]*v[0];k[1]=n[1]*v[1]; return k}function Ya(k,n,v){k[0]=n[0]/v[0];k[1]=n[1]/v[1];return k}function hb(k,n){return Math.hypot(n[0]-k[0],n[1]-k[1])}function Ta(k,n){var v=n[0]-k[0];k=n[1]-k[1];return v*v+k*k}function ib(k){return Math.hypot(k[0],k[1])}function jb(k){var n=k[0];k=k[1];return n*n+k*k}var sa="undefined"!==typeof Float32Array?Float32Array:Array,Sa=Math.random,Ab=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var k=0,n=arguments.length;n--;)k+=arguments[n]*arguments[n];return Math.sqrt(k)});var Db=Object.freeze({__proto__:null, EPSILON:1E-6,get ARRAY_TYPE(){return sa},RANDOM:Sa,ANGLE_ORDER:"zyx",setMatrixArrayType:function(k){sa=k},toRadian:function(k){return k*Ab},equals:function(k,n){return Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))}}),Eb=Object.freeze({__proto__:null,create:function(){var k=new sa(4);sa!=Float32Array&&(k[1]=0,k[2]=0);k[0]=1;k[3]=1;return k},clone:function(k){var n=new sa(4);n[0]=k[0];n[1]=k[1];n[2]=k[2];n[3]=k[3];return n},copy:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];return k}, identity:function(k){k[0]=1;k[1]=0;k[2]=0;k[3]=1;return k},fromValues:function(k,n,v,z){var C=new sa(4);C[0]=k;C[1]=n;C[2]=v;C[3]=z;return C},set:function(k,n,v,z,C){k[0]=n;k[1]=v;k[2]=z;k[3]=C;return k},transpose:function(k,n){if(k===n){var v=n[1];k[1]=n[2];k[2]=v}else k[0]=n[0],k[1]=n[2],k[2]=n[1],k[3]=n[3];return k},invert:function(k,n){var v=n[0],z=n[1],C=n[2];n=n[3];var D=v*n-C*z;if(!D)return null;D=1/D;k[0]=n*D;k[1]=-z*D;k[2]=-C*D;k[3]=v*D;return k},adjoint:function(k,n){var v=n[0];k[0]=n[3]; k[1]=-n[1];k[2]=-n[2];k[3]=v;return k},determinant:function(k){return k[0]*k[3]-k[2]*k[1]},multiply:b,rotate:function(k,n,v){var z=n[0],C=n[1],D=n[2];n=n[3];var G=Math.sin(v);v=Math.cos(v);k[0]=z*v+D*G;k[1]=C*v+n*G;k[2]=z*-G+D*v;k[3]=C*-G+n*v;return k},scale:function(k,n,v){var z=n[1],C=n[2],D=n[3],G=v[0];v=v[1];k[0]=n[0]*G;k[1]=z*G;k[2]=C*v;k[3]=D*v;return k},fromRotation:function(k,n){var v=Math.sin(n);n=Math.cos(n);k[0]=n;k[1]=v;k[2]=-v;k[3]=n;return k},fromScaling:function(k,n){k[0]=n[0];k[1]= 0;k[2]=0;k[3]=n[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,n,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,n,v]},add:function(k,n,v){k[0]=n[0]+v[0];k[1]=n[1]+v[1];k[2]=n[2]+v[2];k[3]=n[3]+v[3];return k},subtract:a,exactEquals:function(k,n){return k[0]===n[0]&&k[1]===n[1]&&k[2]===n[2]&&k[3]===n[3]},equals:function(k,n){var v=k[0],z=k[1],C=k[2];k=k[3];var D=n[0],G=n[1], K=n[2];n=n[3];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(C-K)<=1E-6*Math.max(1,Math.abs(C),Math.abs(K))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},multiplyScalar:function(k,n,v){k[0]=n[0]*v;k[1]=n[1]*v;k[2]=n[2]*v;k[3]=n[3]*v;return k},multiplyScalarAndAdd:function(k,n,v,z){k[0]=n[0]+v[0]*z;k[1]=n[1]+v[1]*z;k[2]=n[2]+v[2]*z;k[3]=n[3]+v[3]*z;return k},mul:b,sub:a}),Fb=Object.freeze({__proto__:null, create:function(){var k=new sa(6);sa!=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 n=new sa(6);n[0]=k[0];n[1]=k[1];n[2]=k[2];n[3]=k[3];n[4]=k[4];n[5]=k[5];return n},copy:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];k[4]=n[4];k[5]=n[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,n,v,z,C,D){var G=new sa(6);G[0]=k;G[1]=n;G[2]=v;G[3]=z;G[4]=C;G[5]=D;return G},set:function(k,n,v,z,C,D,G){k[0]= n;k[1]=v;k[2]=z;k[3]=C;k[4]=D;k[5]=G;return k},invert:function(k,n){var v=n[0],z=n[1],C=n[2],D=n[3],G=n[4];n=n[5];var K=v*D-z*C;if(!K)return null;K=1/K;k[0]=D*K;k[1]=-z*K;k[2]=-C*K;k[3]=v*K;k[4]=(C*n-D*G)*K;k[5]=(z*G-v*n)*K;return k},determinant:function(k){return k[0]*k[3]-k[1]*k[2]},multiply:c,rotate:function(k,n,v){var z=n[0],C=n[1],D=n[2],G=n[3],K=n[4];n=n[5];var M=Math.sin(v);v=Math.cos(v);k[0]=z*v+D*M;k[1]=C*v+G*M;k[2]=z*-M+D*v;k[3]=C*-M+G*v;k[4]=K;k[5]=n;return k},scale:function(k,n,v){var z= n[1],C=n[2],D=n[3],G=n[4],K=n[5],M=v[0];v=v[1];k[0]=n[0]*M;k[1]=z*M;k[2]=C*v;k[3]=D*v;k[4]=G;k[5]=K;return k},translate:function(k,n,v){var z=n[0],C=n[1],D=n[2],G=n[3],K=n[4];n=n[5];var M=v[0];v=v[1];k[0]=z;k[1]=C;k[2]=D;k[3]=G;k[4]=z*M+D*v+K;k[5]=C*M+G*v+n;return k},fromRotation:function(k,n){var v=Math.sin(n);n=Math.cos(n);k[0]=n;k[1]=v;k[2]=-v;k[3]=n;k[4]=0;k[5]=0;return k},fromScaling:function(k,n){k[0]=n[0];k[1]=0;k[2]=0;k[3]=n[1];k[4]=0;k[5]=0;return k},fromTranslation:function(k,n){k[0]=1; k[1]=0;k[2]=0;k[3]=1;k[4]=n[0];k[5]=n[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,n,v){k[0]=n[0]+v[0];k[1]=n[1]+v[1];k[2]=n[2]+v[2];k[3]=n[3]+v[3];k[4]=n[4]+v[4];k[5]=n[5]+v[5];return k},subtract:d,multiplyScalar:function(k,n,v){k[0]=n[0]*v;k[1]=n[1]*v;k[2]=n[2]*v;k[3]=n[3]*v;k[4]=n[4]*v;k[5]=n[5]*v;return k},multiplyScalarAndAdd:function(k,n,v,z){k[0]=n[0]+ v[0]*z;k[1]=n[1]+v[1]*z;k[2]=n[2]+v[2]*z;k[3]=n[3]+v[3]*z;k[4]=n[4]+v[4]*z;k[5]=n[5]+v[5]*z;return k},exactEquals:function(k,n){return k[0]===n[0]&&k[1]===n[1]&&k[2]===n[2]&&k[3]===n[3]&&k[4]===n[4]&&k[5]===n[5]},equals:function(k,n){var v=k[0],z=k[1],C=k[2],D=k[3],G=k[4];k=k[5];var K=n[0],M=n[1],O=n[2],R=n[3],T=n[4];n=n[5];return Math.abs(v-K)<=1E-6*Math.max(1,Math.abs(v),Math.abs(K))&&Math.abs(z-M)<=1E-6*Math.max(1,Math.abs(z),Math.abs(M))&&Math.abs(C-O)<=1E-6*Math.max(1,Math.abs(C),Math.abs(O))&& Math.abs(D-R)<=1E-6*Math.max(1,Math.abs(D),Math.abs(R))&&Math.abs(G-T)<=1E-6*Math.max(1,Math.abs(G),Math.abs(T))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},mul:c,sub:d}),Gb=Object.freeze({__proto__:null,create:e,fromMat4:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[4];k[4]=n[5];k[5]=n[6];k[6]=n[8];k[7]=n[9];k[8]=n[10];return k},clone:function(k){var n=new sa(9);n[0]=k[0];n[1]=k[1];n[2]=k[2];n[3]=k[3];n[4]=k[4];n[5]=k[5];n[6]=k[6];n[7]=k[7];n[8]=k[8];return n},copy:function(k, n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];k[4]=n[4];k[5]=n[5];k[6]=n[6];k[7]=n[7];k[8]=n[8];return k},fromValues:function(k,n,v,z,C,D,G,K,M){var O=new sa(9);O[0]=k;O[1]=n;O[2]=v;O[3]=z;O[4]=C;O[5]=D;O[6]=G;O[7]=K;O[8]=M;return O},set:function(k,n,v,z,C,D,G,K,M,O){k[0]=n;k[1]=v;k[2]=z;k[3]=C;k[4]=D;k[5]=G;k[6]=K;k[7]=M;k[8]=O;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,n){if(k===n){var v=n[1],z=n[2],C=n[5];k[1]=n[3]; k[2]=n[6];k[3]=v;k[5]=n[7];k[6]=z;k[7]=C}else k[0]=n[0],k[1]=n[3],k[2]=n[6],k[3]=n[1],k[4]=n[4],k[5]=n[7],k[6]=n[2],k[7]=n[5],k[8]=n[8];return k},invert:function(k,n){var v=n[0],z=n[1],C=n[2],D=n[3],G=n[4],K=n[5],M=n[6],O=n[7];n=n[8];var R=n*G-K*O,T=-n*D+K*M,Y=O*D-G*M,X=v*R+z*T+C*Y;if(!X)return null;X=1/X;k[0]=R*X;k[1]=(-n*z+C*O)*X;k[2]=(K*z-C*G)*X;k[3]=T*X;k[4]=(n*v-C*M)*X;k[5]=(-K*v+C*D)*X;k[6]=Y*X;k[7]=(-O*v+z*M)*X;k[8]=(G*v-z*D)*X;return k},adjoint:function(k,n){var v=n[0],z=n[1],C=n[2],D=n[3], G=n[4],K=n[5],M=n[6],O=n[7];n=n[8];k[0]=G*n-K*O;k[1]=C*O-z*n;k[2]=z*K-C*G;k[3]=K*M-D*n;k[4]=v*n-C*M;k[5]=C*D-v*K;k[6]=D*O-G*M;k[7]=z*M-v*O;k[8]=v*G-z*D;return k},determinant:function(k){var n=k[3],v=k[4],z=k[5],C=k[6],D=k[7],G=k[8];return k[0]*(G*v-z*D)+k[1]*(-G*n+z*C)+k[2]*(D*n-v*C)},multiply:h,translate:function(k,n,v){var z=n[0],C=n[1],D=n[2],G=n[3],K=n[4],M=n[5],O=n[6],R=n[7];n=n[8];var T=v[0];v=v[1];k[0]=z;k[1]=C;k[2]=D;k[3]=G;k[4]=K;k[5]=M;k[6]=T*z+v*G+O;k[7]=T*C+v*K+R;k[8]=T*D+v*M+n;return k}, rotate:function(k,n,v){var z=n[0],C=n[1],D=n[2],G=n[3],K=n[4],M=n[5],O=n[6],R=n[7];n=n[8];var T=Math.sin(v);v=Math.cos(v);k[0]=v*z+T*G;k[1]=v*C+T*K;k[2]=v*D+T*M;k[3]=v*G-T*z;k[4]=v*K-T*C;k[5]=v*M-T*D;k[6]=O;k[7]=R;k[8]=n;return k},scale:function(k,n,v){var z=v[0];v=v[1];k[0]=z*n[0];k[1]=z*n[1];k[2]=z*n[2];k[3]=v*n[3];k[4]=v*n[4];k[5]=v*n[5];k[6]=n[6];k[7]=n[7];k[8]=n[8];return k},fromTranslation:function(k,n){k[0]=1;k[1]=0;k[2]=0;k[3]=0;k[4]=1;k[5]=0;k[6]=n[0];k[7]=n[1];k[8]=1;return k},fromRotation:function(k, n){var v=Math.sin(n);n=Math.cos(n);k[0]=n;k[1]=v;k[2]=0;k[3]=-v;k[4]=n;k[5]=0;k[6]=0;k[7]=0;k[8]=1;return k},fromScaling:function(k,n){k[0]=n[0];k[1]=0;k[2]=0;k[3]=0;k[4]=n[1];k[5]=0;k[6]=0;k[7]=0;k[8]=1;return k},fromMat2d:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=0;k[3]=n[2];k[4]=n[3];k[5]=0;k[6]=n[4];k[7]=n[5];k[8]=1;return k},fromQuat:function(k,n){var v=n[0],z=n[1],C=n[2];n=n[3];var D=v+v,G=z+z,K=C+C;v*=D;var M=z*D;z*=G;var O=C*D,R=C*G;C*=K;D*=n;G*=n;n*=K;k[0]=1-z-C;k[3]=M-n;k[6]=O+G;k[1]=M+n;k[4]= 1-v-C;k[7]=R-D;k[2]=O-G;k[5]=R+D;k[8]=1-v-z;return k},normalFromMat4:function(k,n){var v=n[0],z=n[1],C=n[2],D=n[3],G=n[4],K=n[5],M=n[6],O=n[7],R=n[8],T=n[9],Y=n[10],X=n[11],fa=n[12],ha=n[13],ba=n[14];n=n[15];var qa=v*K-z*G,ka=v*M-C*G,ta=v*O-D*G,ua=z*M-C*K,ra=z*O-D*K,za=C*O-D*M,Aa=R*ha-T*fa,Ba=R*ba-Y*fa;R=R*n-X*fa;var Ca=T*ba-Y*ha;T=T*n-X*ha;Y=Y*n-X*ba;X=qa*Y-ka*T+ta*Ca+ua*R-ra*Ba+za*Aa;if(!X)return null;X=1/X;k[0]=(K*Y-M*T+O*Ca)*X;k[1]=(M*R-G*Y-O*Ba)*X;k[2]=(G*T-K*R+O*Aa)*X;k[3]=(C*T-z*Y-D*Ca)*X; k[4]=(v*Y-C*R+D*Ba)*X;k[5]=(z*R-v*T-D*Aa)*X;k[6]=(ha*za-ba*ra+n*ua)*X;k[7]=(ba*ta-fa*za-n*ka)*X;k[8]=(fa*ra-ha*ta+n*qa)*X;return k},projection:function(k,n,v){k[0]=2/n;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,n,v){k[0]=n[0]+v[0];k[1]=n[1]+v[1];k[2]=n[2]+v[2]; k[3]=n[3]+v[3];k[4]=n[4]+v[4];k[5]=n[5]+v[5];k[6]=n[6]+v[6];k[7]=n[7]+v[7];k[8]=n[8]+v[8];return k},subtract:g,multiplyScalar:function(k,n,v){k[0]=n[0]*v;k[1]=n[1]*v;k[2]=n[2]*v;k[3]=n[3]*v;k[4]=n[4]*v;k[5]=n[5]*v;k[6]=n[6]*v;k[7]=n[7]*v;k[8]=n[8]*v;return k},multiplyScalarAndAdd:function(k,n,v,z){k[0]=n[0]+v[0]*z;k[1]=n[1]+v[1]*z;k[2]=n[2]+v[2]*z;k[3]=n[3]+v[3]*z;k[4]=n[4]+v[4]*z;k[5]=n[5]+v[5]*z;k[6]=n[6]+v[6]*z;k[7]=n[7]+v[7]*z;k[8]=n[8]+v[8]*z;return k},exactEquals:function(k,n){return k[0]=== n[0]&&k[1]===n[1]&&k[2]===n[2]&&k[3]===n[3]&&k[4]===n[4]&&k[5]===n[5]&&k[6]===n[6]&&k[7]===n[7]&&k[8]===n[8]},equals:function(k,n){var v=k[0],z=k[1],C=k[2],D=k[3],G=k[4],K=k[5],M=k[6],O=k[7];k=k[8];var R=n[0],T=n[1],Y=n[2],X=n[3],fa=n[4],ha=n[5],ba=n[6],qa=n[7];n=n[8];return Math.abs(v-R)<=1E-6*Math.max(1,Math.abs(v),Math.abs(R))&&Math.abs(z-T)<=1E-6*Math.max(1,Math.abs(z),Math.abs(T))&&Math.abs(C-Y)<=1E-6*Math.max(1,Math.abs(C),Math.abs(Y))&&Math.abs(D-X)<=1E-6*Math.max(1,Math.abs(D),Math.abs(X))&& Math.abs(G-fa)<=1E-6*Math.max(1,Math.abs(G),Math.abs(fa))&&Math.abs(K-ha)<=1E-6*Math.max(1,Math.abs(K),Math.abs(ha))&&Math.abs(M-ba)<=1E-6*Math.max(1,Math.abs(M),Math.abs(ba))&&Math.abs(O-qa)<=1E-6*Math.max(1,Math.abs(O),Math.abs(qa))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},mul:h,sub:g}),Hb=Object.freeze({__proto__:null,create:function(){var k=new sa(16);sa!=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 n=new sa(16);n[0]=k[0];n[1]=k[1];n[2]=k[2];n[3]=k[3];n[4]=k[4];n[5]=k[5];n[6]=k[6];n[7]=k[7];n[8]=k[8];n[9]=k[9];n[10]=k[10];n[11]=k[11];n[12]=k[12];n[13]=k[13];n[14]=k[14];n[15]=k[15];return n},copy:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];k[4]=n[4];k[5]=n[5];k[6]=n[6];k[7]=n[7];k[8]=n[8];k[9]=n[9];k[10]=n[10];k[11]=n[11];k[12]=n[12];k[13]=n[13];k[14]=n[14];k[15]=n[15];return k},fromValues:function(k,n,v,z,C,D,G,K,M,O,R,T,Y,X,fa,ha){var ba=new sa(16); ba[0]=k;ba[1]=n;ba[2]=v;ba[3]=z;ba[4]=C;ba[5]=D;ba[6]=G;ba[7]=K;ba[8]=M;ba[9]=O;ba[10]=R;ba[11]=T;ba[12]=Y;ba[13]=X;ba[14]=fa;ba[15]=ha;return ba},set:function(k,n,v,z,C,D,G,K,M,O,R,T,Y,X,fa,ha,ba){k[0]=n;k[1]=v;k[2]=z;k[3]=C;k[4]=D;k[5]=G;k[6]=K;k[7]=M;k[8]=O;k[9]=R;k[10]=T;k[11]=Y;k[12]=X;k[13]=fa;k[14]=ha;k[15]=ba;return k},identity:l,transpose:function(k,n){if(k===n){var v=n[1],z=n[2],C=n[3],D=n[6],G=n[7],K=n[11];k[1]=n[4];k[2]=n[8];k[3]=n[12];k[4]=v;k[6]=n[9];k[7]=n[13];k[8]=z;k[9]=D;k[11]=n[14]; k[12]=C;k[13]=G;k[14]=K}else k[0]=n[0],k[1]=n[4],k[2]=n[8],k[3]=n[12],k[4]=n[1],k[5]=n[5],k[6]=n[9],k[7]=n[13],k[8]=n[2],k[9]=n[6],k[10]=n[10],k[11]=n[14],k[12]=n[3],k[13]=n[7],k[14]=n[11],k[15]=n[15];return k},invert:function(k,n){var v=n[0],z=n[1],C=n[2],D=n[3],G=n[4],K=n[5],M=n[6],O=n[7],R=n[8],T=n[9],Y=n[10],X=n[11],fa=n[12],ha=n[13],ba=n[14];n=n[15];var qa=v*K-z*G,ka=v*M-C*G,ta=v*O-D*G,ua=z*M-C*K,ra=z*O-D*K,za=C*O-D*M,Aa=R*ha-T*fa,Ba=R*ba-Y*fa,Ca=R*n-X*fa,Ja=T*ba-Y*ha,Pa=T*n-X*ha,Qa=Y*n-X*ba, Da=qa*Qa-ka*Pa+ta*Ja+ua*Ca-ra*Ba+za*Aa;if(!Da)return null;Da=1/Da;k[0]=(K*Qa-M*Pa+O*Ja)*Da;k[1]=(C*Pa-z*Qa-D*Ja)*Da;k[2]=(ha*za-ba*ra+n*ua)*Da;k[3]=(Y*ra-T*za-X*ua)*Da;k[4]=(M*Ca-G*Qa-O*Ba)*Da;k[5]=(v*Qa-C*Ca+D*Ba)*Da;k[6]=(ba*ta-fa*za-n*ka)*Da;k[7]=(R*za-Y*ta+X*ka)*Da;k[8]=(G*Pa-K*Ca+O*Aa)*Da;k[9]=(z*Ca-v*Pa-D*Aa)*Da;k[10]=(fa*ra-ha*ta+n*qa)*Da;k[11]=(T*ta-R*ra-X*qa)*Da;k[12]=(K*Ba-G*Ja-M*Aa)*Da;k[13]=(v*Ja-z*Ba+C*Aa)*Da;k[14]=(ha*ka-fa*ua-ba*qa)*Da;k[15]=(R*ua-T*ka+Y*qa)*Da;return k},adjoint:function(k, n){var v=n[0],z=n[1],C=n[2],D=n[3],G=n[4],K=n[5],M=n[6],O=n[7],R=n[8],T=n[9],Y=n[10],X=n[11],fa=n[12],ha=n[13],ba=n[14];n=n[15];var qa=v*K-z*G,ka=v*M-C*G,ta=v*O-D*G,ua=z*M-C*K,ra=z*O-D*K,za=C*O-D*M,Aa=R*ha-T*fa,Ba=R*ba-Y*fa,Ca=R*n-X*fa,Ja=T*ba-Y*ha,Pa=T*n-X*ha,Qa=Y*n-X*ba;k[0]=K*Qa-M*Pa+O*Ja;k[1]=C*Pa-z*Qa-D*Ja;k[2]=ha*za-ba*ra+n*ua;k[3]=Y*ra-T*za-X*ua;k[4]=M*Ca-G*Qa-O*Ba;k[5]=v*Qa-C*Ca+D*Ba;k[6]=ba*ta-fa*za-n*ka;k[7]=R*za-Y*ta+X*ka;k[8]=G*Pa-K*Ca+O*Aa;k[9]=z*Ca-v*Pa-D*Aa;k[10]=fa*ra-ha*ta+n*qa;k[11]= T*ta-R*ra-X*qa;k[12]=K*Ba-G*Ja-M*Aa;k[13]=v*Ja-z*Ba+C*Aa;k[14]=ha*ka-fa*ua-ba*qa;k[15]=R*ua-T*ka+Y*qa;return k},determinant:function(k){var n=k[0],v=k[1],z=k[2],C=k[4],D=k[5],G=k[6],K=k[8],M=k[9],O=k[10],R=k[12],T=k[13],Y=k[14],X=n*D-v*C,fa=n*G-z*C,ha=v*G-z*D,ba=K*T-M*R,qa=K*Y-O*R,ka=M*Y-O*T;return k[7]*(n*ka-v*qa+z*ba)-k[3]*(C*ka-D*qa+G*ba)+k[15]*(K*ha-M*fa+O*X)-k[11]*(R*ha-T*fa+Y*X)},multiply:m,translate:function(k,n,v){var z=v[0],C=v[1];v=v[2];if(n===k)k[12]=n[0]*z+n[4]*C+n[8]*v+n[12],k[13]=n[1]* z+n[5]*C+n[9]*v+n[13],k[14]=n[2]*z+n[6]*C+n[10]*v+n[14],k[15]=n[3]*z+n[7]*C+n[11]*v+n[15];else{var D=n[0];var G=n[1];var K=n[2];var M=n[3];var O=n[4];var R=n[5];var T=n[6];var Y=n[7];var X=n[8];var fa=n[9];var ha=n[10];var ba=n[11];k[0]=D;k[1]=G;k[2]=K;k[3]=M;k[4]=O;k[5]=R;k[6]=T;k[7]=Y;k[8]=X;k[9]=fa;k[10]=ha;k[11]=ba;k[12]=D*z+O*C+X*v+n[12];k[13]=G*z+R*C+fa*v+n[13];k[14]=K*z+T*C+ha*v+n[14];k[15]=M*z+Y*C+ba*v+n[15]}return k},scale:function(k,n,v){var z=v[0],C=v[1];v=v[2];k[0]=n[0]*z;k[1]=n[1]*z; k[2]=n[2]*z;k[3]=n[3]*z;k[4]=n[4]*C;k[5]=n[5]*C;k[6]=n[6]*C;k[7]=n[7]*C;k[8]=n[8]*v;k[9]=n[9]*v;k[10]=n[10]*v;k[11]=n[11]*v;k[12]=n[12];k[13]=n[13];k[14]=n[14];k[15]=n[15];return k},rotate:function(k,n,v,z){var C=z[0],D=z[1];z=z[2];var G=Math.hypot(C,D,z);if(1E-6>G)return null;G=1/G;C*=G;D*=G;z*=G;var K=Math.sin(v);var M=Math.cos(v);var O=1-M;v=n[0];G=n[1];var R=n[2];var T=n[3];var Y=n[4];var X=n[5];var fa=n[6];var ha=n[7];var ba=n[8];var qa=n[9];var ka=n[10];var ta=n[11];var ua=C*C*O+M;var ra=D* C*O+z*K;var za=z*C*O-D*K;var Aa=C*D*O-z*K;var Ba=D*D*O+M;var Ca=z*D*O+C*K;var Ja=C*z*O+D*K;C=D*z*O-C*K;D=z*z*O+M;k[0]=v*ua+Y*ra+ba*za;k[1]=G*ua+X*ra+qa*za;k[2]=R*ua+fa*ra+ka*za;k[3]=T*ua+ha*ra+ta*za;k[4]=v*Aa+Y*Ba+ba*Ca;k[5]=G*Aa+X*Ba+qa*Ca;k[6]=R*Aa+fa*Ba+ka*Ca;k[7]=T*Aa+ha*Ba+ta*Ca;k[8]=v*Ja+Y*C+ba*D;k[9]=G*Ja+X*C+qa*D;k[10]=R*Ja+fa*C+ka*D;k[11]=T*Ja+ha*C+ta*D;n!==k&&(k[12]=n[12],k[13]=n[13],k[14]=n[14],k[15]=n[15]);return k},rotateX:function(k,n,v){var z=Math.sin(v);v=Math.cos(v);var C=n[4],D= n[5],G=n[6],K=n[7],M=n[8],O=n[9],R=n[10],T=n[11];n!==k&&(k[0]=n[0],k[1]=n[1],k[2]=n[2],k[3]=n[3],k[12]=n[12],k[13]=n[13],k[14]=n[14],k[15]=n[15]);k[4]=C*v+M*z;k[5]=D*v+O*z;k[6]=G*v+R*z;k[7]=K*v+T*z;k[8]=M*v-C*z;k[9]=O*v-D*z;k[10]=R*v-G*z;k[11]=T*v-K*z;return k},rotateY:function(k,n,v){var z=Math.sin(v);v=Math.cos(v);var C=n[0],D=n[1],G=n[2],K=n[3],M=n[8],O=n[9],R=n[10],T=n[11];n!==k&&(k[4]=n[4],k[5]=n[5],k[6]=n[6],k[7]=n[7],k[12]=n[12],k[13]=n[13],k[14]=n[14],k[15]=n[15]);k[0]=C*v-M*z;k[1]=D*v-O* z;k[2]=G*v-R*z;k[3]=K*v-T*z;k[8]=C*z+M*v;k[9]=D*z+O*v;k[10]=G*z+R*v;k[11]=K*z+T*v;return k},rotateZ:function(k,n,v){var z=Math.sin(v);v=Math.cos(v);var C=n[0],D=n[1],G=n[2],K=n[3],M=n[4],O=n[5],R=n[6],T=n[7];n!==k&&(k[8]=n[8],k[9]=n[9],k[10]=n[10],k[11]=n[11],k[12]=n[12],k[13]=n[13],k[14]=n[14],k[15]=n[15]);k[0]=C*v+M*z;k[1]=D*v+O*z;k[2]=G*v+R*z;k[3]=K*v+T*z;k[4]=M*v-C*z;k[5]=O*v-D*z;k[6]=R*v-G*z;k[7]=T*v-K*z;return k},fromTranslation:function(k,n){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]=n[0];k[13]=n[1];k[14]=n[2];k[15]=1;return k},fromScaling:function(k,n){k[0]=n[0];k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=n[1];k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=n[2];k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromRotation:function(k,n,v){var z=v[0],C=v[1];v=v[2];var D=Math.hypot(z,C,v);if(1E-6>D)return null;D=1/D;z*=D;C*=D;v*=D;D=Math.sin(n);n=Math.cos(n);var G=1-n;k[0]=z*z*G+n;k[1]=C*z*G+v*D;k[2]=v*z*G-C*D;k[3]=0;k[4]=z*C*G-v*D;k[5]=C*C*G+n;k[6]=v*C*G+z* D;k[7]=0;k[8]=z*v*G+C*D;k[9]=C*v*G-z*D;k[10]=v*v*G+n;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromXRotation:function(k,n){var v=Math.sin(n);n=Math.cos(n);k[0]=1;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=n;k[6]=v;k[7]=0;k[8]=0;k[9]=-v;k[10]=n;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromYRotation:function(k,n){var v=Math.sin(n);n=Math.cos(n);k[0]=n;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]=n;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromZRotation:function(k, n){var v=Math.sin(n);n=Math.cos(n);k[0]=n;k[1]=v;k[2]=0;k[3]=0;k[4]=-v;k[5]=n;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,n){var v=new sa(3),z=-n[0],C=-n[1],D=-n[2],G=n[3],K=n[4],M=n[5],O=n[6],R=n[7],T=z*z+C*C+D*D+G*G;0M&&v>z?(z=2*Math.sqrt(1+v-M-z),k[3]=(O-n)/z,k[0]=.25*z,k[1]=(D+K)/z,k[2]=(R+G)/z):M>z?(z=2*Math.sqrt(1+M-v-z),k[3]= (R-G)/z,k[0]=(D+K)/z,k[1]=.25*z,k[2]=(O+n)/z):(z=2*Math.sqrt(1+z-v-M),k[3]=(D-K)/z,k[0]=(R+G)/z,k[1]=(O+n)/z,k[2]=.25*z);return k},fromRotationTranslationScale:function(k,n,v,z){var C=n[0],D=n[1],G=n[2],K=n[3],M=C+C,O=D+D,R=G+G;n=C*M;var T=C*O;C*=R;var Y=D*O;D*=R;G*=R;M*=K;O*=K;K*=R;R=z[0];var X=z[1];z=z[2];k[0]=(1-(Y+G))*R;k[1]=(T+K)*R;k[2]=(C-O)*R;k[3]=0;k[4]=(T-K)*X;k[5]=(1-(n+G))*X;k[6]=(D+M)*X;k[7]=0;k[8]=(C+O)*z;k[9]=(D-M)*z;k[10]=(1-(n+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,n,v,z,C){var D=n[0],G=n[1],K=n[2],M=n[3],O=D+D,R=G+G,T=K+K;n=D*O;var Y=D*R,X=D*T;D=G*R;G*=T;var fa=K*T;K=M*O;R*=M;var ha=M*T,ba=z[0],qa=z[1];T=z[2];z=C[0];M=C[1];C=C[2];O=(1-(D+fa))*ba;var ka=(Y+ha)*ba;ba*=X-R;Y=(Y-ha)*qa;fa=(1-(n+fa))*qa;qa*=G+K;X=(X+R)*T;G=(G-K)*T;n=(1-(n+D))*T;k[0]=O;k[1]=ka;k[2]=ba;k[3]=0;k[4]=Y;k[5]=fa;k[6]=qa;k[7]=0;k[8]=X;k[9]=G;k[10]=n;k[11]=0;k[12]=v[0]+z-(O*z+Y*M+X*C);k[13]=v[1]+M-(ka*z+fa*M+G*C);k[14]=v[2]+C-(ba*z+ qa*M+n*C);k[15]=1;return k},fromQuat:function(k,n){var v=n[0],z=n[1],C=n[2];n=n[3];var D=v+v,G=z+z,K=C+C;v*=D;var M=z*D;z*=G;var O=C*D,R=C*G;C*=K;D*=n;G*=n;n*=K;k[0]=1-z-C;k[1]=M+n;k[2]=O-G;k[3]=0;k[4]=M-n;k[5]=1-v-C;k[6]=R+D;k[7]=0;k[8]=O+G;k[9]=R-D;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,n,v,z,C,D,G){var K=1/(v-n),M=1/(C-z),O=1/(D-G);k[0]=2*D*K;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=2*D*M;k[6]=0;k[7]=0;k[8]=(v+n)*K;k[9]=(C+z)*M;k[10]=(G+D)*O;k[11]=-1;k[12]=0;k[13]= 0;k[14]=G*D*2*O;k[15]=0;return k},perspectiveNO:p,perspective:p,perspectiveZO:function(k,n,v,z,C){n=1/Math.tan(n/2);k[0]=n/v;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=n;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!=C&&Infinity!==C?(v=1/(z-C),k[10]=C*v,k[14]=C*z*v):(k[10]=-1,k[14]=-z);return k},perspectiveFromFieldOfView:function(k,n,v,z){var C=Math.tan(n.upDegrees*Math.PI/180),D=Math.tan(n.downDegrees*Math.PI/180),G=Math.tan(n.leftDegrees*Math.PI/180);n=Math.tan(n.rightDegrees*Math.PI/ 180);var K=2/(G+n),M=2/(C+D);k[0]=K;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=M;k[6]=0;k[7]=0;k[8]=-((G-n)*K*.5);k[9]=(C-D)*M*.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},orthoNO:r,ortho:r,orthoZO:function(k,n,v,z,C,D,G){var K=1/(n-v),M=1/(z-C);G=1/(D-G);k[0]=-2*K;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=-2*M;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=G;k[11]=0;k[12]=(n+v)*K;k[13]=(C+z)*M;k[14]=D*G;k[15]=1;return k},lookAt:function(k,n,v,z){var C=n[0],D=n[1];n=n[2];var G=z[0];var K=z[1];var M= z[2];var O=v[0];z=v[1];var R=v[2];if(1E-6>Math.abs(C-O)&&1E-6>Math.abs(D-z)&&1E-6>Math.abs(n-R))return l(k);v=C-O;z=D-z;O=n-R;var T=1/Math.hypot(v,z,O);v*=T;z*=T;O*=T;R=K*O-M*z;M=M*v-G*O;G=G*z-K*v;(T=Math.hypot(R,M,G))?(T=1/T,R*=T,M*=T,G*=T):G=M=R=0;K=z*G-O*M;var Y=O*R-v*G;var X=v*M-z*R;(T=Math.hypot(K,Y,X))?(T=1/T,K*=T,Y*=T,X*=T):X=Y=K=0;k[0]=R;k[1]=K;k[2]=v;k[3]=0;k[4]=M;k[5]=Y;k[6]=z;k[7]=0;k[8]=G;k[9]=X;k[10]=O;k[11]=0;k[12]=-(R*C+M*D+G*n);k[13]=-(K*C+Y*D+X*n);k[14]=-(v*C+z*D+O*n);k[15]=1;return k}, targetTo:function(k,n,v,z){var C=n[0],D=n[1];n=n[2];var G=z[0],K=z[1],M=z[2];z=C-v[0];var O=D-v[1];v=n-v[2];var R=z*z+O*O+v*v;0G)return U(k,n,C),1E-6>E(k)&&U(k,v,C),P(k,k),qb(z,k,Math.PI),z;if(.999999Math.abs(z))return zb(k,n);var C=Math.hypot(v[0],v[1],v[2]);z*=.5;var D=Math.sin(z),G=D*v[0]/C,K=D*v[1]/C;v=D*v[2]/C;z=Math.cos(z);C=n[0];D=n[1];var M=n[2],O=n[3];k[0]=C*z+O*G+D*v-M*K;k[1]=D*z+O*K+M*G-C*v;k[2]=M*z+O*v+C*K-D*G;k[3]=O*z-C*G-D*K-M*v; C=n[4];D=n[5];M=n[6];n=n[7];k[4]=C*z+n*G+D*v-M*K;k[5]=D*z+n*K+M*G-C*v;k[6]=M*z+n*v+C*K-D*G;k[7]=n*z-C*G-D*K-M*v;return k},add:function(k,n,v){k[0]=n[0]+v[0];k[1]=n[1]+v[1];k[2]=n[2]+v[2];k[3]=n[3]+v[3];k[4]=n[4]+v[4];k[5]=n[5]+v[5];k[6]=n[6]+v[6];k[7]=n[7]+v[7];return k},multiply:eb,mul:eb,scale:function(k,n,v){k[0]=n[0]*v;k[1]=n[1]*v;k[2]=n[2]*v;k[3]=n[3]*v;k[4]=n[4]*v;k[5]=n[5]*v;k[6]=n[6]*v;k[7]=n[7]*v;return k},dot:Xa,lerp:function(k,n,v,z){var C=1-z;0>Xa(n,v)&&(z=-z);k[0]=n[0]*C+v[0]*z;k[1]= n[1]*C+v[1]*z;k[2]=n[2]*C+v[2]*z;k[3]=n[3]*C+v[3]*z;k[4]=n[4]*C+v[4]*z;k[5]=n[5]*C+v[5]*z;k[6]=n[6]*C+v[6]*z;k[7]=n[7]*C+v[7]*z;return k},invert:function(k,n){var v=Ga(n);k[0]=-n[0]/v;k[1]=-n[1]/v;k[2]=-n[2]/v;k[3]=n[3]/v;k[4]=-n[4]/v;k[5]=-n[5]/v;k[6]=-n[6]/v;k[7]=n[7]/v;return k},conjugate:function(k,n){k[0]=-n[0];k[1]=-n[1];k[2]=-n[2];k[3]=n[3];k[4]=-n[4];k[5]=-n[5];k[6]=-n[6];k[7]=n[7];return k},length:xa,len:xa,squaredLength:Ga,sqrLen:Ga,normalize:function(k,n){var v=Ga(n);if(0=P&&0<=B&&1>=B}function a(B,I,L){return(I[0]-B[0])* (L[1]-B[1])-(L[0]-B[0])*(I[1]-B[1])}function c(B,I,L){return 0a(B,I,L)}function h(B,I,L){return 0>=a(B,I,L)}var tmpPoint1$$module$str$c3runtime=[],tmpPoint2$$module$str$c3runtime=[];function g(B,I,L,P){if(P){var S=tmpPoint1$$module$str$c3runtime,U=tmpPoint2$$module$str$c3runtime;S[0]=I[0]-B[0];S[1]=I[1]-B[1];U[0]=L[0]-I[0];U[1]=L[1]-I[1];return Math.acos((S[0]*U[0]+S[1]*U[1])/(Math.sqrt(S[0]*S[0]+S[1]*S[1])*Math.sqrt(U[0]*U[0]+ U[1]*U[1])))I?I%L+L:I%L]}function u(B){B.length=0}function w(B,I,L,P){for(;LB.length)return I;V++;if(V>U)return console.warn("quickDecomp: max level ("+U+") reached."),I;for(var na=0;naEa&&(Ea+=B.length);Z=Number.MAX_VALUE;if(EaB[I][0])I=L;if(c(m(B,I-1),m(B,I),m(B,I+1)))return!1;q(B);return!0}}} {"use strict";let f=!1,b=!1,a="dev";const c=self.C3=class{constructor(){throw TypeError("static class can't be instantiated");}static SetReady(){f=!0}static IsReady(){return f}static SetAppStarted(){b=!0}static HasAppStarted(){return b}static SetBuildMode(d){a=d}static GetBuildMode(){return a}static IsReleaseBuild(){return"final"===a}};c.isDebug=!1;c.isDebugDefend=!1;c.hardwareConcurrency=navigator.hardwareConcurrency||2;self.C3X={}} {"use strict";const f=self.C3;f.QueryParser=class{constructor(b){this._queryString=b;this._parameters=new Map;this._Parse()}_Parse(){var b=this._queryString;if(b.startsWith("?")||b.startsWith("#"))b=b.substr(1);b=b.split("&");for(const a of b)this._ParseParameter(a)}_ParseParameter(b){if(b)if(b.includes("=")){var a=b.indexOf("="),c=decodeURIComponent(b.substring(0,a));b=decodeURIComponent(b.substring(a+1));this._parameters.set(c,b)}else this._parameters.set(b,null)}LogAll(){for(const b of this._parameters)console.log("[QueryParser] Parameter '"+ b[0]+"' = "+(null===b[1]?"null":"'"+b[1]+"'"))}Has(b){return this._parameters.has(b)}Get(b){b=this._parameters.get(b);return"undefined"===typeof b?null:b}ClearHash(){history.replaceState("",document.title,location.pathname+location.search)}Reparse(b){this._queryString=b;this._parameters.clear();this._Parse()}};f.QueryString=new f.QueryParser(location.search);f.LocationHashString=new f.QueryParser(location.hash);"dev"!==f.QueryString.Get("mode")&&f.SetBuildMode("final")} {"use strict";const f=self.C3,b=navigator.userAgent;let a={linux:/linux|openbsd|freebsd|netbsd/i.test(b),chromeOS:/CrOS/.test(b),windowsTizen:/trident|iemobile|msie|tizen/i.test(b),genericMS:/trident|iemobile|msie|edge\//i.test(b),opera:/OPR\//.test(b),blackberry:/bb10/i.test(b),edge:/edge\//i.test(b),trident:/trident/i.test(b),webkit:/webkit/i.test(b),safari:/safari\//i.test(b),chrome:/chrome\//i.test(b),chromium:/chromium\//i.test(b),crosswalk:/crosswalk|xwalk/i.test(b),nwjs:/nwjs/i.test(b),amazonwebapp:/amazonwebappplatform/i.test(b), webview:/wv\)/.test(b),android:/android/i.test(b),nokia:/nokiabrowser\/[0-9.]+/i.test(b)};var JSCompiler_object_inline_windows_2=/windows\s+nt\s+\d+\.\d+/i.exec(b),JSCompiler_object_inline_OSX_3=/mac\s+os\s+x\s+[0-9_]+/i.exec(b),JSCompiler_object_inline_android_4=/android\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_opera_5=/OPR\/[0-9.]+/.exec(b),JSCompiler_object_inline_tizen_6=/tizen\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_iphone_7=/iphone\s+os\s+[0-9_]+/i.exec(b),JSCompiler_object_inline_ipad_8= /ipad[^)]*os\s+[0-9_]+/i.exec(b),JSCompiler_object_inline_winPhone_9=/windows\s+phone\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_winPhoneOS_10=/windows\s+phone\s+os\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_chrome_11=/chrome\/[0-9.]+/i.exec(b),JSCompiler_object_inline_chromium_12=/chromium\/[0-9.]+/i.exec(b),JSCompiler_object_inline_nwjs_13=/nwjs\/[0-9.]+/i.exec(b),JSCompiler_object_inline_firefox_14=/firefox\/[0-9.]+/i.exec(b),JSCompiler_object_inline_ie_15=/msie\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_edge_16= /edge\/[0-9.]+/i.exec(b),JSCompiler_object_inline_edgeChromium_17=/edg\/[0-9.]+/i.exec(b),JSCompiler_object_inline_silk_18=/silk\/[0-9.]+/i.exec(b);let c="(unknown)",d="(unknown)",e="(unknown)",h="(unknown)",g="(unknown)",l="browser",m=!1,u=!1,w=new Map;function q(p,r,x){!0===r?(x(),w.set(p,!0)):r&&r.length&&(x(r[0]),w.set(p,!0))}q("isWindows",JSCompiler_object_inline_windows_2,p=>{c="Windows";if(p=p.split(" ")[2])switch(p){case "5.0":d="2000";break;case "5.1":d="XP";break;case "5.2":d="XP";break; case "6.0":d="Vista";break;case "6.1":d="7";break;case "6.2":d="8";break;case "6.3":d="8.1";break;case "10.0":d="10"}});q("isOSX",JSCompiler_object_inline_OSX_3,p=>{c="Mac OS X";(p=p.split(" ")[3])&&(d=p.replace("_","."))});q("isLinux",a.linux,()=>{c="Linux"});q("isChromeOS",a.chromeOS,()=>{c="Chrome OS"});q("isAndroid",!a.windowsTizen&&JSCompiler_object_inline_android_4,p=>{c="Android";(p=p.split(" ")[1])&&(d=p)});q("isTizen",JSCompiler_object_inline_tizen_6,p=>{c="Tizen";(p=p.split(" ")[1])&&(d= p)});q("isIPhone",!a.windowsTizen&&JSCompiler_object_inline_iphone_7,p=>{c="iOS";(p=p.split(" ")[2])&&(d=p.replace("_","."))});q("isIPad",!a.windowsTizen&&JSCompiler_object_inline_ipad_8,p=>{c="iOS";(p=p.split(" ")[3])&&(d=p.replace("_","."))});q("isWindowsPhone",JSCompiler_object_inline_winPhone_9,p=>{c="Windows Phone";(p=p.split(" ")[2])&&(d=p)});q("isWindowsPhoneOS",JSCompiler_object_inline_winPhoneOS_10,p=>{c="Windows Phone";(p=p.split(" ")[3])&&(d=p)});q("isBlackberry",a.blackberry,()=>{c="Blackberry"; d="10";e="stock";g="webkit"});q("isChrome",!a.edge&&!a.opera&&JSCompiler_object_inline_chrome_11,p=>{e="Chrome";g="Chromium";(p=p.split("/")[1])&&(h=p)});q("isOpera",JSCompiler_object_inline_opera_5,p=>{e="Opera";g="Chromium";(p=p.split("/")[1])&&(h=p)});q("isChromium",JSCompiler_object_inline_chromium_12,p=>{g=e="Chromium";(p=p.split("/")[1])&&(h=p)});q("isFirefox",JSCompiler_object_inline_firefox_14,p=>{e="Firefox";g="Gecko";(p=p.split("/")[1])&&(h=p)});q("isInternetExplorer",JSCompiler_object_inline_ie_15, p=>{e="Internet Explorer";g="Trident";(p=p.split(" ")[1])&&(h=p)});q("isTrident","Internet Explorer"!==e&&a.trident,()=>{g="Trident";var p=/rv:[0-9.]+/i.exec(b);p&&p.length&&(e="Internet Explorer",(p=p[0].split(":")[1])&&(h=p))});q("isEdge",JSCompiler_object_inline_edge_16,p=>{g=e="Edge";(p=p.split("/")[1])&&(h=p)});q("isEdgeChromium",JSCompiler_object_inline_edgeChromium_17,p=>{e="Edge";g="Chromium";(p=p.split("/")[1])&&(h=p)});q("isSafari",a.safari&&!a.nokia&&!a.chrome&&!a.chromium&&!a.genericIE&& !a.blackberry,()=>{e="Safari";g="WebKit";var p=/version\/[0-9.]+/i.exec(b),r=/crios\/[0-9.]+/i.exec(b),x=/fxios\/[0-9.]+/i.exec(b);p&&p.length&&(p=p[0].split("/")[1])&&(h=p);r&&r.length&&(e="Chrome for iOS",(r=r[0].split("/")[1])&&(h=r));x&&x.length&&(e="Firefox for iOS",(x=x[0].split("/")[1])&&(h=x))});q("isSilk",JSCompiler_object_inline_silk_18,p=>{e="Silk";(p=p.split("/")[1])&&(h=p)});q("isCrosswalk",a.crosswalk,()=>l="crosswalk");q("isCordova",self.device&&(self.device.cordova||self.device.phonegap), ()=>l="cordova");q("isNWJS",JSCompiler_object_inline_nwjs_13,p=>{l="nwjs";e="NW.js";g="Chromium";(p=p.split("/")[1])&&(h=p)});q("isAmazonWebApp",a.amazonwebapp,()=>l="webapp");q("isHomeScreenWebApp","nwjs"!==l&&"undefined"!==typeof window&&(window.matchMedia&&window.matchMedia("(display-mode: standalone)").matches||navigator.standalone),()=>l="webapp");q("isFalseSafari","Safari"===e&&("Android"===c||"Tizen"===c||"Blackberry"===c),()=>e="stock");q("isAndroidWebview","Chrome"===e&&"browser"===l&&a.webview, ()=>l="webview");q("isFirefoxOS","Firefox"===e&&"(unknown)"===c,()=>c="Firefox OS");q("isAndroidFallback","(unknown)"===c&&!a.windowsTizen&&a.android,()=>c="Android");q("isTridentFallback","(unknown)"===c&&a.trident,()=>g="Trident");q("isWebkitFallback","(unknown)"===c&&a.webkit,()=>g="WebKit");q("isDesktop",(()=>"Windows"===c||"Mac OS X"===c||"Linux"===c||"Chrome OS"===c||"nwjs"===l)(),()=>m=!0);u="nwjs"===l;const t="Mac OS X"===c&&navigator.maxTouchPoints&&2{t.onsuccess=()=>p(t.result);t.onerror=()=>r(t.error)})}function d(t){return new Promise((p,r)=>{t.oncomplete=()=>p();t.onerror=()=>r(t.error);t.onabort=()=>r(t.error)})}function e(t,p){return g(t,p)}function h(t,p){return g(t,p,!0)}async function g(t,p,r=!1, x=!0){const y=await l(t);try{const E=y.transaction(["keyvaluepairs"],r?"readwrite":"readonly");return p(E)}catch(E){if(x&&"InvalidStateError"===E.name)return f.delete(t),g(t,p,r,!1);throw E;}}function l(t){u(t);let p=f.get(t);p instanceof Promise||(p=m(t),f.set(t,p),p.catch(r=>f.delete(t)));return p}async function m(t){u(t);const p=indexedDB.open(t,2);p.addEventListener("upgradeneeded",r=>{try{r.target.result.createObjectStore("keyvaluepairs")}catch(x){console.error(`Failed to create objectstore for database ${t}`, x)}});return c(p)}function u(t){if("string"!==typeof t)throw new TypeError("expected string");}function w(t,p){const r=t.objectStore("keyvaluepairs").openCursor();return new Promise(x=>{const y=[];r.onsuccess=E=>{if(E=E.target.result){switch(p){case "entries":y.push([E.key,E.value]);break;case "keys":y.push(E.key);break;case "values":y.push(E.value)}E.continue()}else x(y)}})}class q{constructor(t){u(t);this.name=t}async ready(){await l(this.name)}set(t,p){u(t);return h(this.name,async r=>{var x=r.objectStore("keyvaluepairs").put(p, t);x=c(x);r=d(r);await Promise.all([r,x])})}get(t){u(t);return e(this.name,async p=>{var r=p.objectStore("keyvaluepairs").get(t);r=c(r);p=d(p);[,p]=await Promise.all([p,r]);return p})}delete(t){u(t);return h(this.name,async p=>{var r=p.objectStore("keyvaluepairs").delete(t);r=c(r);p=d(p);await Promise.all([p,r])})}clear(){return h(this.name,async t=>{var p=t.objectStore("keyvaluepairs").clear();p=c(p);t=d(t);await Promise.all([t,p])})}keys(){return e(this.name,async t=>{if(a){var p=t.objectStore("keyvaluepairs").getAllKeys(); p=c(p)}else p=w(t,"keys");t=d(t);[,t]=await Promise.all([t,p]);return t})}values(){return e(this.name,async t=>{if(b){var p=t.objectStore("keyvaluepairs").getAll();p=c(p)}else p=w(t,"values");t=d(t);[,t]=await Promise.all([t,p]);return t})}entries(){return e(this.name,async t=>{var p=w(t,"entries");t=d(t);[,p]=await Promise.all([t,p]);return p})}}self.KVStorageContainer=q}"use strict"; {const f=self.KVStorageContainer,b=[/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],a=new WeakMap;let c=!1;"undefined"===typeof indexedDB&&(c=!0,console.warn("Unable to use local storage because indexedDB is not defined"));function d(l){throw Error(`"${l}" is not implemented`); }function e(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:w}=new MessageChannel;w.onmessage=q=>m(q.data);u.postMessage(l)}):Promise.resolve(l)}class g{constructor(l){this._inst=l;a.set(this,new Map)}_MaybeSwitchToMemoryFallback(l){if(!c)for(const m of b)if(l&&m.test(l.message)){console.error("Unable to use local storage, reverting to in-memory store: ", l,l.message);c=!0;break}}async _getItemFallback(l){l=a.get(this).get(l);l=await h(l);return"undefined"===typeof l?null:l}async _setItemFallback(l,m){m=await h(m);a.get(this).set(l,m)}_removeItemFallback(l){a.get(this).delete(l)}_clearFallback(){a.get(this).clear()}_keysFallback(){return Array.from(a.get(this).keys())}IsUsingFallback(){return c}async getItem(l,m){e(m);if(c)return await this._getItemFallback(l);let u;try{u=await this._inst.get(l)}catch(w){this._MaybeSwitchToMemoryFallback(w);if(c)return await this._getItemFallback(l); console.error(`Error reading '${l}' from storage, returning null: `,w);return null}return"undefined"===typeof u?null:u}async setItem(l,m,u){e(u);"undefined"===typeof m&&(m=null);if(c)await this._setItemFallback(l,m);else try{await this._inst.set(l,m)}catch(w){if(this._MaybeSwitchToMemoryFallback(w),c)await this._setItemFallback(l,m);else throw w;}}async removeItem(l,m){e(m);if(c)this._removeItemFallback(l);else try{await this._inst.delete(l)}catch(u){this._MaybeSwitchToMemoryFallback(u),c?this._removeItemFallback(l): console.error(`Error removing '${l}' from storage: `,u)}}async clear(l){e(l);if(c)this._clearFallback();else try{await this._inst.clear()}catch(m){this._MaybeSwitchToMemoryFallback(m),c?this._clearFallback():console.error("Error clearing storage: ",m)}}async keys(l){e(l);if(c)return this._keysFallback();l=[];try{l=await this._inst.keys()}catch(m){this._MaybeSwitchToMemoryFallback(m);if(c)return this._keysFallback();console.error("Error getting storage keys: ",m)}return l}ready(l){e(l);return c?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 f(l);return new g(l)}length(l){d("localforage.length()")}key(l,m){d("localforage.key()")}iterate(l,m){d("localforage.iterate()")}setDriver(l){d("localforage.setDriver()")}config(l){d("localforage.config()")}defineDriver(l){d("localforage.defineDriver()")}driver(){d("localforage.driver()")}supports(l){d("localforage.supports()")}dropInstance(){d("localforage.dropInstance()")}disableMemoryMode(){c= !1}}self.localforage=new g(new f("localforage"))} {"use strict";const f=self.C3;f.Supports={};f.Supports.WebAnimations=(()=>{try{if("Safari"===f.Platform.Browser||"undefined"===typeof document)return!1;const b=document.createElement("div");return"undefined"===typeof b.animate?!1:"undefined"!==typeof b.animate([{opacity:"0"},{opacity:"1"}],1E3).reverse}catch(b){return!1}})();f.Supports.DialogElement="undefined"!==typeof HTMLDialogElement;f.Supports.RequestIdleCallback=!!self.requestIdleCallback;f.Supports.ImageBitmap=!!self.createImageBitmap&&"Safari"!== f.Platform.Browser;f.Supports.ImageBitmapOptions=!1;if(f.Supports.ImageBitmap)try{self.createImageBitmap(new ImageData(32,32),{resizeWidth:10,resizeHeight:10,premultiplyAlpha:"none"}).then(b=>{f.Supports.ImageBitmapOptions=10===b.width&&10===b.height?!0:!1}).catch(b=>{f.Supports.ImageBitmapOptions=!1})}catch(b){f.Supports.ImageBitmapOptions=!1}f.Supports.ClipboardReadText=!(!navigator.clipboard||!navigator.clipboard.readText||"Firefox"===f.Platform.Browser);f.Supports.PermissionsQuery=!(!navigator.permissions|| !navigator.permissions.query);f.Supports.Proxies="undefined"!==typeof Proxy;f.Supports.DownloadAttribute=(()=>"undefined"===typeof document?!1:"undefined"!==typeof document.createElement("a").download)();f.Supports.CanvasToBlob=(()=>"undefined"!==typeof HTMLCanvasElement&&HTMLCanvasElement.prototype.toBlob)();f.Supports.Fetch="function"===typeof fetch;f.Supports.PersistentStorage=!!(self.isSecureContext&&"Opera"!==f.Platform.Browser&&navigator.storage&&navigator.storage.persist);f.Supports.StorageQuotaEstimate= !!(self.isSecureContext&&navigator.storage&&navigator.storage.estimate);f.Supports.Fullscreen=(()=>{if("undefined"===typeof document||"iOS"===f.Platform.OS)return!1;const b=document.documentElement;return!!(b.requestFullscreen||b.msRequestFullscreen||b.mozRequestFullScreen||b.webkitRequestFullscreen)})();f.Supports.ImageDecoder="undefined"!==typeof self.ImageDecoder;f.Supports.NativeFileSystemAPI=!!self.showOpenFilePicker;f.Supports.NavigatorFontsQuery=!(!navigator.fonts||!navigator.fonts.query)} {"use strict";const f=self.C3;if(!String.prototype.trimStart){const b=/^[\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(b,"")}}if(!String.prototype.trimEnd){const b=/[\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(b, "")}}String.prototype.replaceAll||(String.prototype.replaceAll=function(b,a){return this.replace(new RegExp(f.EscapeRegex(b),"g"),a)});Array.prototype.values||(Array.prototype.values=function*(){for(const b of this)yield b});if(!Array.prototype.flat){function b(a,c){return a.reduce((d,e)=>{0 b&&(b+=this.length);if(!(0>b||b>=this.length))return this[b]});String.prototype.at||(String.prototype.at=function(b){b=Math.trunc(b)||0;0>b&&(b+=this.length);if(!(0>b||b>=this.length))return this[b]});RegExp.escape||(RegExp.escape=function(b){return String(b).replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")});navigator.storage&&!navigator.storage.estimate&&navigator.webkitTemporaryStorage&&navigator.webkitTemporaryStorage.queryUsageAndQuota&&(navigator.storage.estimate=function(){return new Promise((b,a)=>navigator.webkitTemporaryStorage.queryUsageAndQuota((c, d)=>b({usage:c,quota:d}),a))});"undefined"===typeof self.isSecureContext&&(self.isSecureContext="https:"===location.protocol);"undefined"===typeof self.globalThis&&(self.globalThis=self)}{"use strict";const f=self.C3;function b(a){let c=f.GetCallStack();console.error("Assertion failure: "+a+"\n\nStack trace:\n"+c)}self.assert=function(a,c){a||b(c)}} {"use strict";const f=self.C3,b=self.C3X;f.IsNumber=function(c){return"number"===typeof c};f.IsFiniteNumber=function(c){return f.IsNumber(c)&&isFinite(c)};f.RequireNumber=function(c){if(!f.IsNumber(c))throw new TypeError("expected number");};f.RequireOptionalNumber=function(c){f.IsNullOrUndefined(c)};f.RequireNumberInRange=function(c,d,e){if(!f.IsNumber(c)||isNaN(c)||d>c||e{console.log(`%c${r}`,"font-weight: bold",...x);b.set(r,-1)}))};let a;f.StartMeasure=function(r){performance.mark(r);a||(a=new Map);a.has(r)||a.set(r,{current:0,total:0,average:0,calls:1,toString:function(){return`current => ${this.current.toPrecision(3)} :: average => ${this.average.toPrecision(3)} :: calls => ${this.calls}`}})};f.EndMeasure=function(r){performance.measure("measure", r);const x=performance.getEntriesByName("measure")[0];r=a.get(r);r.current=x.duration;r.total+=r.current;r.average=r.total/r.calls;r.calls++;console.log(r.toString());performance.clearMarks();performance.clearMeasures()};f.GetCallStack=function(){return Error().stack};f.Debugger=function(){debugger};f.cast=function(r,x){return r&&r instanceof x?r:null};f.getName=function(r){return"undefined"===typeof r?"undefined":null===r?"null":"boolean"===typeof r?"":f.IsNumber(r)?"":f.IsString(r)? "":f.IsArray(r)?"":"symbol"===typeof r?"<"+r.toString()+">":f.IsFunction(r)?r.name&&"Function"!==r.name?r.name:"":"object"===typeof r?r.constructor&&r.constructor.name&&"Object"!==r.constructor.name?r.constructor.name:"":""};f.getType=function(r){return null===r?"null":Array.isArray(r)?"array":typeof r};f.range=function*(r,x){if(!isFinite(Math.abs(r-x)))throw Error("Invalid parameters");if(r>x)for(--r;r>=x;r--)yield r;else for(;r f.getName(x)))].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: ${r}`);d.clear();e.clear()}}f.DefendedBase=class{constructor(){if(f.isDebugDefend&&f.Supports.Proxies){var r=new.target;r=Object.create(r.prototype);var x=new Proxy(r,f.DefendHandler);d.set(r,x);e.set(x,r);h.set(x,r);-1===u&&(u=requestAnimationFrame(w));return x}}};f.debugDefend=function(r){if(f.isDebugDefend&& f.Supports.Proxies&&r instanceof f.DefendedBase){if(!e.has(r))return r;let x=e.get(r);e.delete(r);d.delete(x);return r}return f.isDebug?Object.seal(r):r};f.New=function(r,...x){let y;try{y=new r(...x)}catch(E){throw e.clear(),d.clear(),E;}f.isDebugDefend&&p(r,y);return f.debugDefend(y)};f.Release=function(r){(r=h.get(r))&&g.set(r,f.GetCallStack())};f.WasReleased=function(r){return(r=h.get(r))?!!g.get(r):!1};let q=new Map;function t(r){let x=new Set;for(let y in r)x.add(y);return x}function p(r,x){x= t(x);let y=q.get(r);if(y){let E=[];for(let H of y.values())x.has(H)?x.delete(H):E.push(H);f.appendArray(E,[...x]);E.length&&console.warn(`[Defence] '${f.getName(r)}' constructor creates inconsistent properties: ${E.join(", ")}`)}else q.set(r,x)}f.PerfMark=class{constructor(r){this._name="";r&&this.start(r)}start(r){this._name=r;performance.mark(this._name+"-Start")}end(){performance.mark(this._name+"-End");performance.measure(this._name,this._name+"-Start",this._name+"-End")}next(r){this.end();this._name= r;performance.mark(this._name+"-Start")}}} {"use strict";const f=self.C3,b=2*Math.PI,a=Math.PI/180,c=180/Math.PI;f.wrap=function(h,g,l){h=Math.floor(h);g=Math.floor(g);l=Math.floor(l);return hl?l:h};f.clampAngle=function(h){h%=b;0>h&&(h+=b);return h};f.toRadians=function(h){return h*a};f.toDegrees=function(h){return h*c};f.distanceTo=function(h,g,l,m){return Math.hypot(l- h,m-g)};f.distanceSquared=function(h,g,l,m){h=l-h;g=m-g;return h*h+g*g};f.angleTo=function(h,g,l,m){return Math.atan2(m-g,l-h)};f.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)};f.angleRotate=function(h,g,l){let m=Math.sin(h),u=Math.cos(h),w=Math.sin(g),q=Math.cos(g);return Math.acos(m*w+u*q)>l?0=Math.cos(h)*Math.sin(g)- Math.sin(h)*Math.cos(g)};f.angleLerp=function(h,g,l,m=0){let u=f.angleDiff(h,g);m*=b;return f.angleClockwise(g,h)?f.clampAngle(h+(u+m)*l):f.clampAngle(h-(u+m)*l)};f.angleLerpClockwise=function(h,g,l,m=0){const u=f.angleDiff(h,g);m*=b;return f.angleClockwise(g,h)?f.clampAngle(h+(u+m)*l):f.clampAngle((b-u+m)*l)};f.angleLerpAntiClockwise=function(h,g,l,m=0){const u=f.angleDiff(h,g);m*=b;return f.angleClockwise(g,h)?f.clampAngle((-b+u-m)*l):f.clampAngle(h-(u+m)*l)};f.lerp=function(h,g,l){return h+l*(g- h)};f.unlerp=function(h,g,l){return h===g?0:(l-h)/(g-h)};f.relerp=function(h,g,l,m,u){return f.lerp(m,u,f.unlerp(h,g,l))};f.qarp=function(h,g,l,m){return f.lerp(f.lerp(h,g,m),f.lerp(g,l,m),m)};f.cubic=function(h,g,l,m,u){return f.lerp(f.qarp(h,g,l,u),f.qarp(g,l,m,u),u)};f.cosp=function(h,g,l){return(h+g+(h-g)*Math.cos(l*Math.PI))/2};f.isPOT=function(h){return 0g;g<<=1)h|=h>>g;return h+1};f.roundToNearestFraction=function(h,g){return Math.round(h* g)/g};f.floorToNearestFraction=function(h,g){return Math.floor(h*g)/g};f.round6dp=function(h){return Math.round(1E6*h)/1E6};f.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)};f.PackRGB=function(h,g,l){return f.clamp(h,0,255)|f.clamp(g,0,255)<<8|f.clamp(l,0,255)<<16};f.PackRGBAEx=function(h,g,l,m){h=f.clamp(Math.floor(1024*h),-8192,8191);g=f.clamp(Math.floor(1024*g),-8192,8191);l=f.clamp(Math.floor(1024*l), -8192,8191);m=f.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)};f.PackRGBEx=function(h,g,l){return f.PackRGBAEx(h,g,l,1)};function d(h){return 0===h&&0>1/h}f.GetRValue=function(h){if(0<=h)return(h&255)/255;h=Math.floor(-h/274877906944);8191>8)/255;h=Math.floor(-h%274877906944/16777216);8191>16)/255;h=Math.floor(-h%16777216/1024);8191Math.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=f.greatestCommonDivisor(h,g);return[h/l,g/l]};f.segmentsIntersect=function(h,g,l,m,u,w,q,t){var p=Math.min(h,l),r=Math.max(u,q);if(Math.max(h,l)r)return!1;p=Math.min(g,m);r=Math.max(w,t);if(Math.max(g,m)r)return!1;p=u-h+q-l;r=w-g+t-m;h=l-h;g=m-g;u=q-u;w=t-w;t=Math.abs(g*u-w*h);return Math.abs(u*r-w*p)>t?!1:Math.abs(h*r-g*p)<=t};f.segmentsIntersectPreCalc=function(h,g,l,m,u,w,q,t,p,r,x,y){const E=Math.max(p,x); if(wE)return!1;u=Math.max(r,y);if(tu)return!1;q=p-h+x-l;t=r-g+y-m;h=l-h;g=m-g;p=x-p;r=y-r;y=Math.abs(g*p-r*h);return Math.abs(p*t-r*q)>y?!1:Math.abs(h*t-g*q)<=y};f.segmentIntersectsQuad=function(h,g,l,m,u){const w=Math.min(h,l),q=Math.max(h,l),t=Math.min(g,m),p=Math.max(g,m),r=u.getTlx(),x=u.getTly(),y=u.getTrx(),E=u.getTry(),H=u.getBrx(),A=u.getBry(),F=u.getBlx();u=u.getBly();return f.segmentsIntersectPreCalc(h,g,l,m,w,q,t,p,r,x,y,E)||f.segmentsIntersectPreCalc(h, g,l,m,w,q,t,p,y,E,H,A)||f.segmentsIntersectPreCalc(h,g,l,m,w,q,t,p,H,A,F,u)||f.segmentsIntersectPreCalc(h,g,l,m,w,q,t,p,F,u,r,x)};f.segmentIntersectsAnyN=function(h,g,l,m,u){const w=Math.min(h,l),q=Math.max(h,l),t=Math.min(g,m),p=Math.max(g,m);let r=0;for(let x=u.length-4;r<=x;r+=2)if(f.segmentsIntersectPreCalc(h,g,l,m,w,q,t,p,u[r],u[r+1],u[r+2],u[r+3]))return!0;return f.segmentsIntersectPreCalc(h,g,l,m,w,q,t,p,u[r],u[r+1],u[0],u[1])};f.rayIntersect=function(h,g,l,m,u,w,q,t){l-=h;w=t-w;const p=l* w-(m-g)*(q-u);if(0===p)return 2;m=((g-m)*(q-h)+l*(t-g))/p;return 0m?(w*(q-h)+(u-q)*(t-g))/p:2};f.rayIntersectExtended=function(h,g,l,m,u,w,q,t,p){const r=(q-u)*p;p*=t-w;return f.rayIntersect(h,g,l,m,u-r,w-p,q+r,t+p)};f.isPointInTriangleInclusive=function(h,g,l,m,u,w,q,t){u-=l;w-=m;q-=l;t-=m;h-=l;l=g-m;g=u*u+w*w;m=u*q+w*t;u=u*h+w*l;w=q*q+t*t;q=q*h+t*l;t=1/(g*w-m*m);w=(w*u-m*q)*t;u=(g*q-m*u)*t;return 0<=w&&0<=u&&1>=w+u};f.triangleCartesianToBarycentric=function(h,g,l,m,u,w,q,t){u-=l;w-= m;q-=l;t-=m;h-=l;const p=g-m;g=u*u+w*w;m=u*q+w*t;l=q*q+t*t;u=h*u+p*w;w=h*q+p*t;q=g*l-m*m;t=(l*u-m*w)/q;u=(g*w-m*u)/q;return[1-t-u,t,u]};f.triangleBarycentricToCartesian=function(h,g,l,m,u,w,q,t,p){return[h*m+g*w+l*t,h*u+g*q+l*p]}} {"use strict";const f=self.C3;let b=null,a="";if("undefined"!==typeof document){b=document;const l=document.querySelector("base");if(a=l&&l.hasAttribute("href")?l.getAttribute("href"):"")a.startsWith("/")&&(a=a.substr(1)),a.endsWith("/")||(a+="/")}f.GetBaseHref=function(){return a};f.GetBaseURL=function(){if(!b)return"";const l=b.location;return f.GetPathFromURL(l.origin+l.pathname)+a};f.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)};f.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)};f.GetFileExtension=function(l){let m=l.lastIndexOf(".");return 1>m?"":l.substr(m)};f.GetFileNamePart=function(l){let m=l.lastIndexOf(".");return 1>m?l:l.substr(0,m)};f.NormalizeFileSeparator=function(l){return l.replace(/\\/g,"/")};f.IsFileExtension=function(l, m){l=l?f.GetFileExtension(l).slice(1):"";return m===l};f.FileNameEquals=function(l,m){let u,w;f.IsFileLike(l)&&(u=f.GetFileNamePart(l.name));f.IsString(l)&&(u=f.GetFileNamePart(l));f.IsFileLike(m)&&(w=f.GetFileNamePart(m.name));f.IsString(m)&&(w=f.GetFileNamePart(m));return u===w};f.ParseFilePath=function(l){l=f.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{self.setTimeout(u,l,m)})};f.swallowException=function(l){try{l()}catch(m){f.isDebug&&console.warn("Swallowed exception: ",m)}};f.noop=function(){};f.equalsNoCase=function(l,m){return"string"!==typeof l||"string"!==typeof m?!1:l===m||l.normalize().toLowerCase()===m.normalize().toLowerCase()}; f.equalsCase=function(l,m){return"string"!==typeof l||"string"!==typeof m?!1:l===m?!0:l.normalize()===m.normalize()};f.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]};f.truncateArray=function(l,m){l.length=m};f.clearArray=function(l){l&&0!==l.length&&f.truncateArray(l,0)};f.clear2DArray=function(l){if(l){for(let m=0;m< l.length;m++)f.truncateArray(l[m],0);f.truncateArray(l,0)}};f.extendArray=function(l,m,u){m|=0;var w=l.length;if(!(m<=w))for(;ww&&f.extendArray(l,m,u)};f.shallowAssignArray=function(l,m){f.clearArray(l);f.appendArray(l,m)};f.appendArray=function(l,m){if(1E4>m.length)l.push(...m);else for(let u=0,w=m.length;um||m>=l.length)){for(var u= l.length-1;mu;case 5:return l>=u;default:return!1}}; f.hasAnyOwnProperty=function(l){for(let m in l)if(l.hasOwnProperty(m))return!0;return!1};f.PromiseAllWithProgress=function(l,m){return l.length?new Promise((u,w)=>{const q=[];let t=0,p=!1;for(let r=0,x=l.length;r{p||(q[r]=y,++t,t===l.length?u(q):m(t,l.length))}).catch(y=>{p=!0;w(y)})}):Promise.resolve([])};let c=[];f.AddLibraryMemoryCallback=function(l){c.push(l)};f.GetEstimatedLibraryMemoryUsage=function(){let l=0;for(let m of c){let u=m();l+=u}return Math.floor(l)}; let d=1;const e=new Map,h=new MessageChannel;h.port2.onmessage=function(l){l=l.data;const m=e.get(l);e.delete(l);m&&m(performance.now())};f.RequestUnlimitedAnimationFrame=function(l){const m=d++;e.set(m,l);h.port1.postMessage(m);return m};f.CancelUnlimitedAnimationFrame=function(l){e.delete(l)};f.PostTask=f.RequestUnlimitedAnimationFrame;f.WaitForNextTask=function(){return new Promise(l=>f.PostTask(l))};const g=new Set;f.RequestPostAnimationFrame=function(l){const m=self.requestAnimationFrame(async u=> {await f.WaitForNextTask();g.has(m)&&(g.delete(m),l(u))});g.add(m);return m};f.CancelPostAnimationFrame=function(l){g.has(l)&&(self.cancelAnimationFrame(l),g.delete(l))}} {"use strict";const f=self.C3;f.IsAbsoluteURL=function(b){return/^(?:[a-z\-]+:)?\/\//.test(b)||"data:"===b.substr(0,5)||"blob:"===b.substr(0,5)};f.IsRelativeURL=function(b){return!f.IsAbsoluteURL(b)};f.ThrowIfNotOk=function(b){if(!b.ok)throw Error(`fetch '${b.url}' response returned ${b.status} ${b.statusText}`);};f.FetchOk=function(b,a){return fetch(b,a).then(c=>{f.ThrowIfNotOk(c);return c})};f.FetchText=function(b){return f.FetchOk(b).then(a=>a.text())};f.FetchJson=function(b){return f.FetchOk(b).then(a=> a.json())};f.FetchBlob=function(b){return f.FetchOk(b).then(a=>a.blob())};f.FetchArrayBuffer=function(b){return f.FetchOk(b).then(a=>a.arrayBuffer())};f.FetchImage=function(b){return new Promise((a,c)=>{const d=new Image;d.onload=()=>a(d);d.onerror=e=>c(e);d.src=b})};f.BlobToArrayBuffer=function(b){return"function"===typeof b.arrayBuffer?b.arrayBuffer():new Promise((a,c)=>{const d=new FileReader;d.onload=()=>a(d.result);d.onerror=()=>c(d.error);d.readAsArrayBuffer(b)})};f.BlobToString=function(b){return"function"=== typeof b.text?b.text():new Promise((a,c)=>{const d=new FileReader;d.onload=()=>a(d.result);d.onerror=()=>c(d.error);d.readAsText(b)})};f.BlobToJson=function(b){return f.BlobToString(b).then(a=>JSON.parse(a))};f.BlobToImage=async function(b,a){b=URL.createObjectURL(b);try{const c=await f.FetchImage(b);URL.revokeObjectURL(b);b="";a&&"function"===typeof c.decode&&await c.decode();return c}finally{b&&URL.revokeObjectURL(b)}};f.CreateCanvas=function(b,a){if("undefined"!==typeof document&&"function"=== typeof document.createElement){const c=document.createElement("canvas");c.width=b;c.height=a;return c}return new OffscreenCanvas(b,a)};f.CanvasToBlob=function(b,a,c){"number"!==typeof c&&(c=1);a=a||"image/png";c=f.clamp(c,0,1);return b.toBlob?new Promise(d=>b.toBlob(d,a,c)):b.convertToBlob?b.convertToBlob({type:a,quality:c}):f.Asyncify(()=>f.CanvasToBlobSync(b,a,c))};f.CanvasToBlobSync=function(b,a,c){"number"!==typeof c&&(c=1);a=a||"image/png";c=f.clamp(c,0,1);return f.DataURIToBinaryBlobSync(b.toDataURL(a, c))};f.DataURIToBinaryBlobSync=function(b){b=f.ParseDataURI(b);return f.BinaryStringToBlob(b.data,b.mime_type)};f.ParseDataURI=function(b){if("data:"!==b.substr(0,5))throw new URIError("expected data: uri");var a=b.indexOf(",");if(0>a)throw new URIError("expected comma in data: uri");var c=b.substring(5,a);b=b.substring(a+1);a=c.split(";");c=a[0]||"";let d=a[2];b="base64"===a[1]||"base64"===d?atob(b):decodeURIComponent(b);return{mime_type:c,data:b}};f.BinaryStringToBlob=function(b,a){var c=b.length; let d=c>>2,e=new Uint8Array(c),h=new Uint32Array(e.buffer,0,d),g,l;for(l=g=0;gf.DrawableToBlob(d,a,c));if(f.Supports.ImageBitmap)return createImageBitmap(b).then(d=>f.DrawableToBlob(d,a,c));{const d=f.CreateCanvas(b.width,b.height);d.getContext("2d").putImageData(b,0,0);return f.CanvasToBlob(d,a,c)}};f.CopySet=function(b,a){b.clear();for(const c of a)b.add(c)};f.MapToObject=function(b){const a=Object.create(null); for(const [c,d]of b.entries())a[c]=d;return a};f.ObjectToMap=function(b,a){a.clear();for(const [c,d]of Object.entries(b))a.set(c,d)};f.ToSuperJSON=function c(a){if("object"===typeof a&&null!==a){if(a instanceof Set)return{_c3type_:"set",data:[...a].map(d=>c(d))};if(a instanceof Map)return{_c3type_:"map",data:[...a].map(d=>[d[0],c(d[1])])};{const d=Object.create(null);for(const [e,h]of Object.entries(a))d[e]=c(h);return d}}return a};f.FromSuperJSON=function d(c){if("object"===typeof c&null!==c){if("set"=== c._c3type_)return new Set(c.data.map(e=>d(e)));if("map"===c._c3type_)return new Map(c.data.map(e=>[e[0],d(e[1])]));{const e=Object.create(null);for(const [h,g]of Object.entries(c))e[h]=d(g);return e}}return c};f.CSSToCamelCase=function(c){let d="",e=!1;for(const h of c)"-"===h?e=!0:e?(d+=h.toUpperCase(),e=!1):d+=h;return d};f.IsIterator=function(c){return"object"===typeof c&&"function"===typeof c.next};f.MakeFilledArray=function(c,d){const e=[];if("function"===typeof d)for(var h=0;hg&&(g+=1);1g?h:g<2/3?e+(h-e)*(2/3-g)*6:e}f.Color=class{constructor(e,h,g,l){this._a=this._b=this._g=this._r=0;e instanceof f.Color?this.set(e):this.setRgba(e||0,h||0,g||0,l||0)}setRgb(e,h,g){this._r=+e;this._g=+h;this._b=+g;this.clamp();return this}setRgba(e,h,g,l){this._r= +e;this._g=+h;this._b=+g;this._a=+l;this.clamp();return this}set(e){this._r=e._r;this._g=e._g;this._b=e._b;this._a=e._a;return this}copy(e){return this.set(e)}add(e){this._r+=e._r;this._g+=e._g;this._b+=e._b;this._a+=e._a;this.clamp()}addRgb(e,h,g,l=0){this._r+=+e;this._g+=+h;this._b+=+g;this._a+=+l;this.clamp()}diff(e){this.setR(Math.max(this._r,e._r)-Math.min(this._r,e._r));this.setG(Math.max(this._g,e._g)-Math.min(this._g,e._g));this.setB(Math.max(this._b,e._b)-Math.min(this._b,e._b));this.setA(Math.max(this._a, e._a)-Math.min(this._a,e._a));this.clamp()}copyRgb(e){this._r=e._r;this._g=e._g;this._b=e._b}setR(e){this._r=f.clamp(+e,0,1)}getR(){return this._r}setG(e){this._g=f.clamp(+e,0,1)}getG(){return this._g}setB(e){this._b=f.clamp(+e,0,1)}getB(){return this._b}setA(e){this._a=f.clamp(+e,0,1)}getA(){return this._a}clone(){return f.New(f.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(e,h){e[h++]= this._r;e[h++]=this._g;e[h++]=this._b;e[h]=this._a}writeRGBToTypedArray(e,h){e[h++]=this._r;e[h++]=this._g;e[h]=this._b}equals(e){return this._r===e._r&&this._g===e._g&&this._b===e._b&&this._a===e._a}equalsIgnoringAlpha(e){return this._r===e._r&&this._g===e._g&&this._b===e._b}equalsRgb(e,h,g){return this._r===e&&this._g===h&&this._b===g}equalsRgba(e,h,g,l){return this._r===e&&this._g===h&&this._b===g&&this._a===l}equalsF32Array(e,h){return e[h]===Math.fround(this._r)&&e[h+1]===Math.fround(this._g)&& e[h+2]===Math.fround(this._b)&&e[h+3]===Math.fround(this._a)}equalsRGBF32Array(e,h){return e[h]===Math.fround(this._r)&&e[h+1]===Math.fround(this._g)&&e[h+2]===Math.fround(this._b)}multiply(e){this._r*=e._r;this._g*=e._g;this._b*=e._b;this._a*=e._a}multiplyAlpha(e){this._r*=e;this._g*=e;this._b*=e;this._a*=e}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=f.clamp(this._r,0,1); this._g=f.clamp(this._g,0,1);this._b=f.clamp(this._b,0,1);this._a=f.clamp(this._a,0,1);return this}setFromRgbValue(e){this._r=f.GetRValue(e);this._g=f.GetGValue(e);this._b=f.GetBValue(e);this._a=f.GetAValue(e)}getCssRgb(e,h,g){e=f.IsFiniteNumber(e)?e:this.getR();h=f.IsFiniteNumber(h)?h:this.getG();g=f.IsFiniteNumber(g)?g:this.getB();return`rgb(${100*e}%, ${100*h}%, ${100*g}%)`}getCssRgba(e,h,g,l){e=f.IsFiniteNumber(e)?e:this.getR();h=f.IsFiniteNumber(h)?h:this.getG();g=f.IsFiniteNumber(g)?g:this.getB(); l=f.IsFiniteNumber(l)?l:this.getA();return`rgba(${100*e}%, ${100*h}%, ${100*g}%, ${l})`}toHexString(){const e=Math.round(255*this.getR()),h=Math.round(255*this.getG()),g=Math.round(255*this.getB());return"#"+c(e.toString(16))+c(h.toString(16))+c(g.toString(16))}parseHexString(e){if("string"!==typeof e)return!1;e=e.trim();"#"===e.charAt(0)&&(e=e.substr(1));let h,g;if(3===e.length)h=parseInt(e[0],16)/15,g=parseInt(e[1],16)/15,e=parseInt(e[2],16)/15;else if(6===e.length)h=parseInt(e.substr(0,2),16)/ 255,g=parseInt(e.substr(2,2),16)/255,e=parseInt(e.substr(4,2),16)/255;else return!1;isFinite(h)&&this.setR(h);isFinite(g)&&this.setG(g);isFinite(e)&&this.setB(e);this.setA(1);return!0}toCommaSeparatedRgb(){const e=Math.round(255*this.getR()),h=Math.round(255*this.getG()),g=Math.round(255*this.getB());return`${e}, ${h}, ${g}`}toRgbArray(){const e=Math.round(255*this.getR()),h=Math.round(255*this.getG()),g=Math.round(255*this.getB());return[e,h,g]}parseCommaSeparatedRgb(e){if("string"!==typeof e)return!1; e=e.replace(/^rgb\(|\)|%/,"");var h=e.split(",");if(3>h.length)return!1;e=parseInt(h[0].trim(),10)/255;const g=parseInt(h[1].trim(),10)/255;h=parseInt(h[2].trim(),10)/255;isFinite(e)&&this.setR(e);isFinite(g)&&this.setG(g);isFinite(h)&&this.setB(h);this.setA(1);return!0}parseCommaSeparatedPercentageRgb(e){if("string"!==typeof e)return!1;e=e.replace(/^rgb\(|\)|%/,"");var h=e.split(",");if(3>h.length)return!1;e=parseInt(h[0].trim(),10)/100;const g=parseInt(h[1].trim(),10)/100;h=parseInt(h[2].trim(), 10)/100;isFinite(e)&&this.setR(e);isFinite(g)&&this.setG(g);isFinite(h)&&this.setB(h);this.setA(1);return!0}parseCommaSeparatedRgba(e){if("string"!==typeof e)return!1;e=e.replace(/^rgba\(|\)|%/,"");var h=e.split(",");if(4>h.length)return!1;e=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(e)&&this.setR(e);isFinite(g)&&this.setG(g);isFinite(l)&&this.setB(l);isFinite(h)&&this.setA(h);return!0}parseCommaSeparatedPercentageRgba(e){if("string"!== typeof e)return!1;e=e.replace(/^rgba\(|\)|%/,"");var h=e.split(",");if(4>h.length)return!1;e=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(e)&&this.setR(e);isFinite(g)&&this.setG(g);isFinite(l)&&this.setB(l);isFinite(h)&&this.setA(h);return!0}parseString(e){if("string"!==typeof e)return!1;e=e.replace(/\s+/,"");if(e.includes(",")){if(e.startsWith("rgb("))return e.includes("%")?this.parseCommaSeparatedPercentageRgb(e): this.parseCommaSeparatedRgb(e);if(e.startsWith("rgba("))return e.includes("%")?this.parseCommaSeparatedPercentageRgba(e):this.parseCommaSeparatedRgba(e);if(e.startsWith("hsl(")||e.startsWith("hsla("))return this.parseHSLString(e);{const h=e.split(",");if(e.includes("%")){if(3===h.length)return this.parseCommaSeparatedPercentageRgb(e);if(4===h.length)return this.parseCommaSeparatedPercentageRgba(e)}else{if(3===h.length)return this.parseCommaSeparatedRgb(e);if(4===h.length)return this.parseCommaSeparatedRgba(e)}return!1}}return this.parseHexString(e)}toJSON(){return[this._r, this._g,this._b,this._a]}setFromHSLA(e,h,g,l){e%=360;h=f.clamp(h,0,100);g=f.clamp(g,0,100);l=f.clamp(l,0,1);e/=360;h/=100;g/=100;if(0===h)g=h=e=g;else{const m=.5>g?g*(1+h):g+h-g*h,u=2*g-m;g=d(u,m,e+1/3);h=d(u,m,e);e=d(u,m,e-1/3)}this.setR(g);this.setG(h);this.setB(e);this.setA(l);return this}parseHSLString(e){var h=e.replace(/ |hsl|hsla|\(|\)|;/gi,"");e=b.exec(h);h=a.exec(h);return e&&4===e.length?(this.setFromHSLA(+e[1],+e[2],+e[3],1),!0):h&&5===h.length?(this.setFromHSLA(+e[1],+e[2],+e[3],+e[4]), !0):!1}toHSLAString(){var e=this._r;const h=this._g,g=this._b,l=this._a,m=f.Color.GetHue(e,h,g),u=f.Color.GetSaturation(e,h,g);e=f.Color.GetLuminosity(e,h,g);return`hsla(${m}, ${u}%, ${e}%, ${l})`}toHSLAArray(){const e=this._r,h=this._g,g=this._b;return[f.Color.GetHue(e,h,g),f.Color.GetSaturation(e,h,g),f.Color.GetLuminosity(e,h,g),this._a]}setFromJSON(e){!Array.isArray(e)||3>e.length||(this._r=e[0],this._g=e[1],this._b=e[2],this._a=4<=e.length?e[3]:1)}set r(e){this.setR(e)}get r(){return this.getR()}set g(e){this.setG(e)}get g(){return this.getG()}set b(e){this.setB(e)}get b(){return this.getB()}set a(e){this.setA(e)}get a(){return this.getA()}setAtIndex(e, h){switch(e){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(e){switch(e){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(e,h){let g;if(Array.isArray(e))g=new f.Color,g.setFromJSON(e);else if(e instanceof f.Color)g=e;else throw Error("unexpected type");if(Array.isArray(h))e= new f.Color,e.setFromJSON(h);else if(h instanceof f.Color)e=h;else throw Error("unexpected type");return g.equals(e)}static DiffChannel(e,h){return f.clamp(Math.max(e,h)-Math.min(e,h),0,1)}static Diff(e,h){const g=new f.Color;g.setR(Math.max(e._r,h._r)-Math.min(e._r,h._r));g.setG(Math.max(e._g,h._g)-Math.min(e._g,h._g));g.setB(Math.max(e._b,h._b)-Math.min(e._b,h._b));g.setA(Math.max(e._a,h._a)-Math.min(e._a,h._a));return g}static DiffNoAlpha(e,h){const g=new f.Color(0,0,0,1);g.setR(Math.max(e._r, h._r)-Math.min(e._r,h._r));g.setG(Math.max(e._g,h._g)-Math.min(e._g,h._g));g.setB(Math.max(e._b,h._b)-Math.min(e._b,h._b));return g}static GetHue(e,h,g){const l=Math.max(e,h,g),m=Math.min(e,h,g);if(l===m)return 0;let u=0;switch(l){case e:u=(h-g)/(l-m)+(h c&&(this._right=+c);this._bottom>d&&(this._bottom=+d)}clampFlipped(b,a,c,d){this._lefta&&(this._top=+a);this._right>c&&(this._right=+c);this._bottomthis._right&&this.swapLeftRight();this._top>this._bottom&&this.swapTopBottom()}intersectsRect(b){return!(b._rightthis._right||b._top>this._bottom)}intersectsRectOffset(b,a,c){return!(b._right+athis._right||b._top+c>this._bottom)}containsPoint(b,a){return b>=this._left&&b<=this._right&&a>=this._top&&a<=this._bottom}containsRect(b){return b._left>=this._left&&b._top>=this._top&&b._right<=this._right&&b._bottom<=this._bottom}expandToContain(b){b._leftthis._right&&(this._right=+b._right);b._bottom>this._bottom&&(this._bottom=+b._bottom)}lerpInto(b){this._left=f.lerp(b._left,b._right,this._left);this._top=f.lerp(b._top, b._bottom,this._top);this._right=f.lerp(b._left,b._right,this._right);this._bottom=f.lerp(b._top,b._bottom,this._bottom)}}} {"use strict";const f=self.C3;f.Quad=class{constructor(b,a,c,d,e,h,g,l){this._bly=this._blx=this._bry=this._brx=this._try=this._trx=this._tly=this._tlx=0;b instanceof f.Quad?this.copy(b):this.set(b||0,a||0,c||0,d||0,e||0,h||0,g||0,l||0)}set(b,a,c,d,e,h,g,l){this._tlx=+b;this._tly=+a;this._trx=+c;this._try=+d;this._brx=+e;this._bry=+h;this._blx=+g;this._bly=+l}setRect(b,a,c,d){this.set(b,a,c,a,c,d,b,d)}copy(b){this._tlx=b._tlx;this._tly=b._tly;this._trx=b._trx;this._try=b._try;this._brx=b._brx;this._bry= b._bry;this._blx=b._blx;this._bly=b._bly}equals(b){return this._tlx===b._tlx&&this._tly===b._tly&&this._trx===b._trx&&this._try===b._try&&this._brx===b._brx&&this._bry===b._bry&&this._blx===b._blx&&this._bly===b._bly}setTlx(b){this._tlx=+b}getTlx(){return this._tlx}setTly(b){this._tly=+b}getTly(){return this._tly}setTrx(b){this._trx=+b}getTrx(){return this._trx}setTry(b){this._try=+b}getTry(){return this._try}setBrx(b){this._brx=+b}getBrx(){return this._brx}setBry(b){this._bry=+b}getBry(){return this._bry}setBlx(b){this._blx= +b}getBlx(){return this._blx}setBly(b){this._bly=+b}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(b,a){b[a++]=this._tlx;b[a++]=this._tly;b[a++]=this._trx;b[a++]=this._try;b[a++]=this._brx; b[a++]=this._bry;b[a++]=this._blx;b[a]=this._bly}writeToTypedArray3D(b,a,c){b[a++]=this._tlx;b[a++]=this._tly;b[a++]=c;b[a++]=this._trx;b[a++]=this._try;b[a++]=c;b[a++]=this._brx;b[a++]=this._bry;b[a++]=c;b[a++]=this._blx;b[a++]=this._bly;b[a]=c}offset(b,a){b=+b;a=+a;this._tlx+=b;this._tly+=a;this._trx+=b;this._try+=a;this._brx+=b;this._bry+=a;this._blx+=b;this._bly+=a}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(b){this._tlx=b._left;this._tly=b._top;this._trx=b._right;this._try=b._top;this._brx=b._right;this._bry=b._bottom;this._blx=b._left;this._bly=b._bottom}setFromRotatedRect(b,a){0===a?this.setFromRect(b):this.setFromRotatedRectPrecalc(b,Math.sin(a),Math.cos(a))}setFromRotatedRectPrecalc(b,a,c){const d=b._left*a,e=b._top*a,h=b._right*a;a*=b._bottom; const g=b._left*c,l=b._top*c,m=b._right*c;b=b._bottom*c;this._tlx=g-e;this._tly=l+d;this._trx=m-e;this._try=l+h;this._brx=m-a;this._bry=b+h;this._blx=g-a;this._bly=b+d}getBoundingBox(b){b.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(b,a){var c=this._trx-this._tlx,d=this._try-this._tly;const e=this._brx-this._tlx,h=this._bry-this._tly; b-=this._tlx;a-=this._tly;var g=c*c+d*d;let l=c*e+d*h;d=c*b+d*a;const m=e*e+h*h,u=e*b+h*a;let w=1/(g*m-l*l);c=(m*d-l*u)*w;g=(g*u-l*d)*w;if(0<=c&&0c+g)return!0;c=this._blx-this._tlx;d=this._bly-this._tly;g=c*c+d*d;l=c*e+d*h;d=c*b+d*a;w=1/(g*m-l*l);c=(m*d-l*u)*w;g=(g*u-l*d)*w;return 0<=c&&0c+g}midX(){return(this._tlx+this._trx+this._brx+this._blx)/4}midY(){return(this._tly+this._try+this._bry+this._bly)/4}intersectsSegment(b,a,c,d){return this.containsPoint(b,a)||this.containsPoint(c,d)? !0:f.segmentIntersectsQuad(b,a,c,d,this)}intersectsQuad(b){var a=b.midX(),c=b.midY();if(this.containsPoint(a,c))return!0;a=this.midX();c=this.midY();if(b.containsPoint(a,c))return!0;a=this._tlx;c=this._tly;const d=this._trx,e=this._try,h=this._brx,g=this._bry,l=this._blx,m=this._bly;return f.segmentIntersectsQuad(a,c,d,e,b)||f.segmentIntersectsQuad(d,e,h,g,b)||f.segmentIntersectsQuad(h,g,l,m,b)||f.segmentIntersectsQuad(l,m,a,c,b)}rotatePointsAnticlockwise(){const b=this._tlx,a=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=b;this._bly=a}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(b,a){const c=this._getAtIndex(b);this._setAtIndex(b,this._getAtIndex(a));this._setAtIndex(a,c)}_getAtIndex(b){switch(b){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(b,a){a=+a;switch(b){case 0:this._tlx=a;break;case 1:this._tly=a;break;case 2:this._trx=a;break;case 3:this._try=a;break;case 4:this._brx=a;break;case 5:this._bry=a;break;case 6:this._blx=a;break;case 7:this._bly=a;break;default:throw new RangeError("invalid quad point index");}}}} {"use strict";const f=self.C3,b=[0,0,1,0,1,1,0,1],a=f.New(f.Quad);f.CollisionPoly=class extends f.DefendedBase{constructor(c,d=!0){super();c||(c=b);this._ptsArr=Float64Array.from(c);this._bbox=new f.Rect;this._isBboxChanged=!0;this._enabled=d}Release(){}pointsArr(){return this._ptsArr}pointCount(){return this._ptsArr.length/2}setPoints(c){this._ptsArr.length===c.length?this._ptsArr.set(c):this._ptsArr=Float64Array.from(c);this._isBboxChanged=!0}setDefaultPoints(){this.setPoints(b)}copy(c){this.setPoints(c._ptsArr)}setBboxChanged(){this._isBboxChanged= !0}_updateBbox(){if(this._isBboxChanged){var c=this._ptsArr,d=c[0],e=c[1],h=d,g=e;for(let l=0,m=c.length;lh&&(h=u);wg&&(g=w)}this._bbox.set(d,e,h,g);this._isBboxChanged=!1}}setFromRect(c,d,e){let h=this._ptsArr;8!==h.length&&(this._ptsArr=h=new Float64Array(8));h[0]=c.getLeft()-d;h[1]=c.getTop()-e;h[2]=c.getRight()-d;h[3]=c.getTop()-e;h[4]=c.getRight()-d;h[5]=c.getBottom()-e;h[6]=c.getLeft()-d;h[7]=c.getBottom()-e;this._bbox.copy(c);0===d&&0=== e||this._bbox.offset(-d,-e);this._isBboxChanged=!1}setFromQuad(c,d,e){a.copy(c);a.offset(d,e);this.setPoints(a.toArray());this._isBboxChanged=!0}transform(c,d,e){let h=0,g=1;0!==e&&(h=Math.sin(e),g=Math.cos(e));this.transformPrecalc(c,d,h,g)}transformPrecalc(c,d,e,h){const g=this._ptsArr;for(let l=0,m=g.length;l!p.includes(r))}static GetRuntimeEaseNames(){this._CreateEaseMap();const t=[...c.keys()];t.sort();return[...b.keys()].concat(t)}static IsNamePredefined(t){this._CreateEaseMap(); return[...b.keys()].includes(t)}static _GetEase(t){const p=e.get(t);if(p)return f.get(p);if(q.IsNamePredefined(t))return f.get(t);if(d.has(t))return d.get(t)}static GetEditorEase(t,p){this._CreateEaseMap();const r=q._GetEase(t);return r?r:a.get(p).get(t)}static GetRuntimeEase(t){this._CreateEaseMap();const p=q._GetEase(t);return p?p:c.get(t)}static GetEaseFromIndex(t){this._CreateEaseMap();return this.GetRuntimeEaseNames()[t]}static GetIndexForEase(t,p){this._CreateEaseMap();return this.GetEditorEaseNames(p).indexOf(t)}static _CreateEaseMap(){0=== f.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(t,p){q._AddEase(t,p,"predefined")}static _AddPrivateCustomEase(t, p){q._AddEase(t,p,"private")}static AddCustomEase(t,p,r){this._CreateEaseMap();q._AddEase(t,p,"custom",r)}static RemoveCustomEase(t,p){this.IsNamePredefined(t)||[...d.keys()].includes(t)||(p=a.get(p))&&p.delete(t)}static _AddEase(t,p,r,x){switch(r){case "predefined":f.set(t,p);b.set(t,p);break;case "custom":x?(a.has(x)||a.set(x,new Map),a.get(x).set(t,p)):c.set(t,p);break;case "private":f.set(t,p);d.set(t,p);break;default:throw Error("unexpected ease mode");}}static NoEase(t,p,r,x){return r*t/x+p}static EaseInQuad(t, p,r,x){return r*(t/=x)*t+p}static EaseOutQuad(t,p,r,x){return-r*(t/=x)*(t-2)+p}static EaseInOutQuad(t,p,r,x){return 1>(t/=x/2)?r/2*t*t+p:-r/2*(--t*(t-2)-1)+p}static EaseInCubic(t,p,r,x){return r*(t/=x)*t*t+p}static EaseOutCubic(t,p,r,x){return r*((t=t/x-1)*t*t+1)+p}static EaseInOutCubic(t,p,r,x){return 1>(t/=x/2)?r/2*t*t*t+p:r/2*((t-=2)*t*t+2)+p}static EaseInQuart(t,p,r,x){return r*(t/=x)*t*t*t+p}static EaseOutQuart(t,p,r,x){return-r*((t=t/x-1)*t*t*t-1)+p}static EaseInOutQuart(t,p,r,x){return 1>(t/= x/2)?r/2*t*t*t*t+p:-r/2*((t-=2)*t*t*t-2)+p}static EaseInQuint(t,p,r,x){return r*(t/=x)*t*t*t*t+p}static EaseOutQuint(t,p,r,x){return r*((t=t/x-1)*t*t*t*t+1)+p}static EaseInOutQuint(t,p,r,x){return 1>(t/=x/2)?r/2*t*t*t*t*t+p:r/2*((t-=2)*t*t*t*t+2)+p}static EaseInSine(t,p,r,x){return-r*Math.cos(t/x*(Math.PI/2))+r+p}static EaseOutSine(t,p,r,x){return r*Math.sin(t/x*(Math.PI/2))+p}static EaseInOutSine(t,p,r,x){return-r/2*(Math.cos(Math.PI*t/x)-1)+p}static EaseInExpo(t,p,r,x){return 0===t?p:r*Math.pow(2, 10*(t/x-1))+p}static EaseOutExpo(t,p,r,x){return t===x?p+r:r*(-Math.pow(2,-10*t/x)+1)+p}static EaseInOutExpo(t,p,r,x){return 0===t?p:t===x?p+r:1>(t/=x/2)?r/2*Math.pow(2,10*(t-1))+p:r/2*(-Math.pow(2,-10*--t)+2)+p}static EaseInCirc(t,p,r,x){return-r*(Math.sqrt(1-(t/=x)*t)-1)+p}static EaseOutCirc(t,p,r,x){return r*Math.sqrt(1-(t=t/x-1)*t)+p}static EaseInOutCirc(t,p,r,x){return 1>(t/=x/2)?-r/2*(Math.sqrt(1-t*t)-1)+p:r/2*(Math.sqrt(1-(t-=2)*t)+1)+p}static EaseInElastic(t,p,r,x){let y=0,E=r;if(0===t)return p; if(1===(t/=x))return p+r;y||(y=.3*x);Et?-.5*H*Math.pow(2,10*--t)*Math.sin(2*(t*x-y)*Math.PI/E)+p:H*Math.pow(2,-10*--t)*Math.sin(2*(t*x-y)*Math.PI/E)*.5+r+p}static EaseInBack(t,p,r,x,y){void 0===y&&(y=1.70158);return r*(t/=x)*t*((y+1)*t-y)+p}static EaseOutBack(t,p,r,x,y){void 0===y&&(y=1.70158);return r*((t=t/x-1)*t*((y+1)*t+y)+1)+p}static EaseInOutBack(t,p,r,x,y){void 0===y&&(y=1.70158);return 1>(t/=x/2)?r/2*t*t*(((y*=1.525)+1)*t-y)+p:r/2*((t-=2)*t*(((y*=1.525)+1)*t+y)+2)+p}static EaseInBounce(t, p,r,x){return r-q.EaseOutBounce(x-t,0,r,x)+p}static EaseOutBounce(t,p,r,x){return(t/=x)<1/2.75?7.5625*r*t*t+p:t<2/2.75?r*(7.5625*(t-=1.5/2.75)*t+.75)+p:t<2.5/2.75?r*(7.5625*(t-=2.25/2.75)*t+.9375)+p:r*(7.5625*(t-=2.625/2.75)*t+.984375)+p}static EaseInOutBounce(t,p,r,x){return tp;++p)r=m(.1*p,E,H,t),y.push(r);return y}};const h=(q,t,p,r)=>r-3*p+3*t-q,g=(q,t,p,r)=>3*p-6*t+3*q,l=(q,t,p,r)=>3*(t-q),m=(q,t,p,r)=>((t*q+p)*q+r)*q,u=(q,t,p,r)=>3*t*q*q+2*p*q+r,w=(q,t,p,r,x,y)=>{if(1==q)return 1;for(var E=0,H=1,A=y[H];10!=H&&A<=q;)H++,A=y[H],E+=.1;H--;A=y[H];y=E+(q-A)/(y[H+1]-A)*.1;H=h(t,p,r,x);A=g(t,p,r,x);t=l(t, p,r,x);p=u(y,H,A,t);if(0!==p)if(.02<=p)for(E=0;4>E;++E)p=m(y,H,A,t)-q,r=u(y,H,A,t),y-=p/r;else{p=E;E+=.1;r=0;let F;do y=p+(E-p)/2,x=m(y,H,A,t)-q,0++r;while(x&&F)}return y}} {"use strict";const f=self.C3;function b(a){f.IsString(a)}f.ProbabilityTable=class{constructor(){this._items=[];this._totalWeight=0}Release(){this.Clear();this._items=null}Clear(){f.clear2DArray(this._items);this._totalWeight=0}GetTotalWeight(){return this._totalWeight}Sample(a=Math.random()*this.GetTotalWeight()){let c=0;for(const [d,e]of this._items)if(c+=d,ae(b)))}for(let c=0,d=this._listeners.length;ce(b)))}return Promise.all(a).then(()=>!b.defaultPrevented)}_FireAndWait_AsyncOptional(b){const a=[];this._IncreaseFireDepth();for(let d=0,e=this._captureListeners.length;d!b.defaultPrevented):!b.defaultPrevented}async _FireAndWaitAsync(b){return await this._FireAndWait_AsyncOptional(b)}async _FireAndWaitAsyncSequential(b){this._IncreaseFireDepth();for(let c=0,d=this._captureListeners.length;cq-u+t));-1===c&&a.length&&e(Math.max(16-(q-u),4))}}function g(m){let u;try{u=m.func()}catch(w){m.reject(w);return}m.resolve(u)}let l= f.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.");f.Asyncify=function(m){let u=null;f.isDebug&&(u=f.GetCallStack());return new Promise((w,q)=>{a.push({func:m,resolve:w,reject:q,stack:u});l?g(a.pop()):-1===c&&e(16)})};f.Asyncify.SetHighThroughputMode=function(m){if(m)++d;else if(--d,0>d)throw Error("already turned off high throughput mode");}} {"use strict";const f=self.C3;let b=-1;function a(){b=-1}f.FastGetDateNow=function(){-1===b&&(b=Date.now(),self.setTimeout(a,16));return b};let c=-1,d=-1,e=new Set;function h(){d=c=-1;let g=Date.now();for(let l of e)if(l._CheckTimeout(g)){let m=l._GetDeadline();if(-1===d||mg+1E3&&(self.clearTimeout(c),d=this._deadline,c=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&&(e.delete(this),this._isActive=!1,0===e.size&&-1!==c&&(self.clearTimeout(c),d=c=-1))}Release(){this.Cancel(); this._callback=null}}} {"use strict";const f=self.C3;f.Disposable=class b{constructor(a){this._disposed=!1;this._disposeAction=a}Dispose(){this._disposed||(this._disposed=!0,this._disposeAction&&(this._disposeAction(),this._disposeAction=null))}IsDisposed(){return this._disposed}Release(){this.Dispose()}static Release(a){return new b(()=>a.Release())}static From(a,c,d,e,h){if("undefined"===typeof e||null===e)e=!1;else if("boolean"!==typeof e&&"object"!==typeof e)throw new TypeError("invalid event listener options");h&& (d=d.bind(h));if(c.includes(" ")){c=c.split(" ");h=new f.CompositeDisposable;for(let g of c)a.addEventListener(g,d,e),h.Add(f.New(f.Disposable,()=>a.removeEventListener(g,d,e)));return h}a.addEventListener(c,d,e);return f.New(f.Disposable,()=>a.removeEventListener(c,d,e))}};f.StubDisposable=class extends f.Disposable{SetAction(b){this._disposeAction=b}};f.CompositeDisposable=class extends f.Disposable{constructor(...b){super();this._disposables=new Set;for(let a of b)this.Add(a)}Add(...b){if(this._disposed)throw Error("already disposed"); for(let a of b)this._disposables.add(a)}Remove(b){if(this._disposed)throw Error("already disposed");this._disposables.delete(b)}RemoveAll(){if(this._disposed)throw Error("already disposed");if(this._disposables){for(let b of this._disposables)b.Dispose();this._disposables.clear()}}IsDisposed(){return this._disposed}Dispose(){if(this._disposed)throw Error("already disposed");this._disposed=!0;for(let b of this._disposables)b.Dispose();this._disposables.clear();this._disposables=null}Release(){this.Dispose()}}} {"use strict";const f=self.C3;f.KahanSum=class extends f.DefendedBase{constructor(){super();this._sum=this._t=this._y=this._c=0}Add(b){this._y=+b-this._c;this._t=this._sum+this._y;this._c=this._t-this._sum-this._y;this._sum=this._t}Subtract(b){this._sum-=+b}Get(){return this._sum}Reset(){this._sum=this._t=this._y=this._c=0}Set(b){this._t=this._y=this._c=0;this._sum=+b}Release(){}}} {"use strict";const f=self.C3,b={RBnode:function(a){this.tree=a;this.left=this.right=this.tree.sentinel;this.parent=null;this.color=!1;this.key=null},RedBlackSet:function(a){this.size=0;this.sentinel=new b.RBnode(this);this.sentinel.color=!1;this.root=this.sentinel;this.root.parent=this.sentinel;this.compare=a||this.default_compare}};b.RedBlackSet.prototype.default_compare=function(a,c){return athis.compare(c.key,d.key)?d.left:d.right;c.parent=a;a==this.sentinel?this.root=c:0>this.compare(c.key,a.key)?a.left=c:a.right=c;c.left=this.sentinel;c.right=this.sentinel; c.color=!0;this.insertFixup(c);this.size++}};b.RedBlackSet.prototype.insertFixup=function(a){for(;a!=this.sentinel&&a!=this.root&&1==a.parent.color;)if(a.parent==a.parent.parent.left){var c=a.parent.parent.right;1==c.color?(a.parent.color=!1,c.color=!1,a.parent.parent.color=!0,a=a.parent.parent):(a==a.parent.right&&(a=a.parent,this.leftRotate(a)),a.parent.color=!1,a.parent.parent.color=!0,a.parent.parent!=this.sentinel&&this.rightRotate(a.parent.parent))}else c=a.parent.parent.left,1==c.color?(a.parent.color= !1,c.color=!1,a.parent.parent.color=!0,a=a.parent.parent):(a==a.parent.left&&(a=a.parent,this.rightRotate(a)),a.parent.color=!1,a.parent.parent.color=!0,a.parent.parent!=this.sentinel&&this.leftRotate(a.parent.parent));this.root.color=!1};b.RedBlackSet.prototype.delete_=function(a){var c=a.left==this.sentinel||a.right==this.sentinel?a:this.successor_(a);var d=c.left!=this.sentinel?c.left:c.right;d.parent=c.parent;c.parent==this.sentinel?this.root=d:c==c.parent.left?c.parent.left=d:c.parent.right= d;c!=a&&(a.key=c.key);0==c.color&&this.deleteFixup(d);this.size--};b.RedBlackSet.prototype.deleteFixup=function(a){for(;a!=this.root&&0==a.color;)if(a==a.parent.left){var c=a.parent.right;1==c.color&&(c.color=!1,a.parent.color=!0,this.leftRotate(a.parent),c=a.parent.right);0==c.left.color&&0==c.right.color?(c.color=!0,a=a.parent):(0==c.right.color&&(c.left.color=!1,c.color=!0,this.rightRotate(c),c=a.parent.right),c.color=a.parent.color,a.parent.color=!1,c.right.color=!1,this.leftRotate(a.parent), a=this.root)}else c=a.parent.left,1==c.color&&(c.color=!1,a.parent.color=!0,this.rightRotate(a.parent),c=a.parent.left),0==c.right.color&&0==c.left.color?(c.color=!0,a=a.parent):(0==c.left.color&&(c.right.color=!1,c.color=!0,this.leftRotate(c),c=a.parent.left),c.color=a.parent.color,a.parent.color=!1,c.left.color=!1,this.rightRotate(a.parent),a=this.root);a.color=!1};b.RedBlackSet.prototype.remove=function(a){a=this.get_(a);if(a!=this.sentinel){var c=a.key;this.delete_(a);return c}return null};b.RedBlackSet.prototype.removeSwapped= function(a,c){this.remove(c)};b.RedBlackSet.prototype.min=function(a){for(;a.left!=this.sentinel;)a=a.left;return a};b.RedBlackSet.prototype.max=function(a){for(;a.right!=this.sentinel;)a=a.right;return a};b.RedBlackSet.prototype.successor_=function(a){if(a.right!=this.sentinel)return this.min(a.right);for(var c=a.parent;c!=this.sentinel&&a==c.right;)a=c,c=c.parent;return c};b.RedBlackSet.prototype.predeccessor_=function(a){if(a.left!=this.sentinel)return this.max(a.left);for(var c=a.parent;c!=this.sentinel&& a==c.left;)a=c,c=c.parent;return c};b.RedBlackSet.prototype.successor=function(a){if(0this.compare(a,c.key)?c.left:c.right;return c};b.RedBlackSet.prototype.contains=function(a){return null!=this.get_(a).key};b.RedBlackSet.prototype.getValues=function(){var a= [];this.forEach(function(c){a.push(c)});return a};b.RedBlackSet.prototype.insertAll=function(a){if("array"==b.typeOf(a))for(var c=0;cc)return!1;c=0;if(this.isEmpty())return!0;for(var d=this.min(this.root);d!=this.sentinel;d=this.successor_(d))b.contains.call(a,a,d.key)&&c++;return c==this.getCount()};b.RedBlackSet.prototype.intersection=function(a){var c=new b.RedBlackSet(this.compare);if(this.isEmpty())return c;for(var d=this.min(this.root);d!=this.sentinel;d=this.successor_(d))a.contains.call(a, d.key,d.key,this)&&c.insert(d.key);return c};f.RedBlackSet=class extends f.DefendedBase{constructor(a){super();this._rbSet=new b.RedBlackSet(a);this._enableQueue=!1;this._queueInsert=new Set;this._queueRemove=new Set}Add(a){this._enableQueue?this._rbSet.contains(a)?this._queueRemove.delete(a):this._queueInsert.add(a):this._rbSet.insert(a)}Remove(a){this._enableQueue?this._rbSet.contains(a)?this._queueRemove.add(a):this._queueInsert.delete(a):this._rbSet.remove(a)}Has(a){return this._enableQueue?this._queueInsert.has(a)? !0:!this._queueRemove.has(a)&&this._rbSet.contains(a):this._rbSet.contains(a)}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 a=this._rbSet;return a.min(a.root).key}Shift(){if(this.IsEmpty())throw Error("empty set");if(this._enableQueue)throw Error("cannot be used in queueing mode");const a=this.Front();this.Remove(a);return a}SetQueueingEnabled(a){a=!!a;if(this._enableQueue!==a&&(this._enableQueue=a,!a)){for(const c of this._queueRemove)this._rbSet.remove(c);this._queueRemove.clear();for(const c of this._queueInsert)this._rbSet.insert(c);this._queueInsert.clear()}}ForEach(a){this._rbSet.forEach(a)}*values(){if(!this.IsEmpty()){var a= this._rbSet;for(let c=a.min(a.root);c!=a.sentinel;c=a.successor_(c))yield c.key}}[Symbol.iterator](){return this.values()}}} {"use strict";const f=self.C3;f.PromiseThrottle=class{constructor(b=f.hardwareConcurrency){this._maxParallel=b;this._queue=[];this._activeCount=0}Add(b){return new Promise((a,c)=>{this._queue.push({func:b,resolve:a,reject:c});this._MaybeStartNext()})}_FindInQueue(b){for(let a=0,c=this._queue.length;a=this._maxParallel)){this._activeCount++;var b=this._queue.shift();try{const a=await b.func();b.resolve(a)}catch(a){b.reject(a)}this._activeCount--;this._MaybeStartNext()}}static async Batch(b,a){const c=[];let d=!1;const e=async g=>{for(;(g=a.pop())&&!d;)try{c.push(await g())}catch(l){throw d= !0,l;}},h=[];for(;b--;)h.push(e());await Promise.all(h);return c}}} {"use strict";const f=self.C3;f.RateLimiter=class{constructor(b,a,c){this._callback=b;this._interval=a;this._intervalOnBattery=c||2*a;this._timerId=-1;this._lastCallTime=-Infinity;this._timerCallFunc=()=>this._OnTimer();this._canRunImmediate=this._ignoreReset=!1;this._callbackArguments=null}SetCanRunImmediate(b){this._canRunImmediate=!!b}_GetInterval(){return"undefined"!==typeof f.Battery&&f.Battery.IsOnBatteryPower()?this._intervalOnBattery:this._interval}Call(...b){if(-1===this._timerId){this._callbackArguments= b;b=f.FastGetDateNow();var a=b-this._lastCallTime,c=this._GetInterval();a>=c&&this._canRunImmediate?(this._lastCallTime=b,this._RunCallback()):this._timerId=self.setTimeout(this._timerCallFunc,Math.max(c-a,4))}}_RunCallback(){this._ignoreReset=!0;const b=this._callbackArguments;this._callbackArguments=null;b?this._callback(...b):this._callback();this._ignoreReset=!1}Reset(){this._ignoreReset||(this._CancelTimer(),this._callbackArguments=null,this._lastCallTime=f.FastGetDateNow())}_OnTimer(){this._timerId= -1;this._lastCallTime=f.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 f=self.C3;f.SVGRasterManager=class{constructor(){this._images=new Map;this._allowNpotSurfaces=!1;this._redrawCallback=this._releaseResultCallback=this._rasterAtSizeCallback=this._getBaseSizeCallback=null}SetNpotSurfaceAllowed(b){this._allowNpotSurfaces=!!b}IsNpotSurfaceAllowed(){return this._allowNpotSurfaces}SetGetBaseSizeCallback(b){this._getBaseSizeCallback=b}GetBaseSize(b){if(!this._getBaseSizeCallback)throw Error("no get base size callback set");return this._getBaseSizeCallback(b)}SetRasterAtSizeCallback(b){this._rasterAtSizeCallback= b}RasterAtSize(b,a,c,d,e,h){if(!this._rasterAtSizeCallback)throw Error("no raster at size callback set");return this._rasterAtSizeCallback(b,a,c,d,e,h)}SetReleaseResultCallback(b){this._releaseResultCallback=b}ReleaseResult(b){if(!this._releaseResultCallback)throw Error("no release result callback set");this._releaseResultCallback(b)}SetRedrawCallback(b){this._redrawCallback=b}Redraw(){if(!this._redrawCallback)throw Error("no redraw callback set");this._redrawCallback()}AddImage(b){let a=this._images.get(b); a||(a=f.New(f.SVGRasterImage,this,b),this._images.set(b,a));a.IncReference();return a}_RemoveImage(b){this._images.delete(b.GetDataSource())}OnTexturesChanged(){for(const b of this._images.values())b.ReleaseRasterizedResult(),b.ForceRasterAgain()}}} {"use strict";const f=self.C3;f.SVGRasterImage=class{constructor(b,a){this._manager=b;this._dataSource=a;this._baseHeight=this._baseWidth=this._refCount=0;this._getBaseSizePromise=this._manager.GetBaseSize(a).then(c=>{this._baseWidth=c[0];this._baseHeight=c[1];this._manager.Redraw()}).catch(c=>{console.error("[SVG] Error loading SVG: ",c);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(b,a,c){if(0!==a&&0!==c&&!this._hadError&&!this._isRasterizing){var d=f.nextHighestPowerOfTwo(Math.ceil(a)),e=f.nextHighestPowerOfTwo(Math.ceil(c)),h=Math.max(d,e);2048c?(a=e*c,c=e):(a=d,c=d/c));this._manager.IsNpotSurfaceAllowed()&&(d=Math.ceil(a),e=Math.ceil(c)); d<=this._rasterSurfaceWidth&&e<=this._rasterSurfaceHeight&&!this._forceRaster||(this._isRasterizing=!0,this._rasterSurfaceWidth=d,this._rasterSurfaceHeight=e,b=await this._manager.RasterAtSize(this._dataSource,b,this._rasterSurfaceWidth,this._rasterSurfaceHeight,a,c),this._manager&&(this.ReleaseRasterizedResult(),this._rasterizedResult=b,this._rasterImageWidth=a,this._rasterImageHeight=c,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 f=self.C3;f.UTF8_BOM="\ufeff";const b=new Set([..."0123456789"]);f.IsNumericChar=function(m){return b.has(m)};const a=new Set([..." \t\n\r\u00a0\u0085\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u202f\u205f\u3000"]);f.IsWhitespaceChar=function(m){return a.has(m)};f.FilterWhitespace=function(m){return[...m].filter(u=>!f.IsWhitespaceChar(u)).join("")};f.IsStringAllWhitespace=function(m){for(const u of m)if(!f.IsWhitespaceChar(u))return!1;return!0}; f.IsUnprintableChar=function(m){return 1===m.length&&32>m.charCodeAt(0)};f.FilterUnprintableChars=function(m){return[...m].filter(u=>!f.IsUnprintableChar(u)).join("")};const c=new Set([..."0123456789.+-e"]);f.IsStringNumber=function(m){m=m.trim();if(!m.length)return!1;let u=m.charAt(0);if("-"!==u&&!b.has(u))return!1;for(let w of m)if(!c.has(w))return!1;return!0};f.RemoveTrailingDigits=function(m){let u=m.length;for(;0",">"],['"',"""],["'","'"]]);function e(m){return d.get(m)}const h=/[&<>"']/g;f.EscapeHTML=function(m){return m.replace(h,e)};f.EscapeJS=function(m){m=f.ReplaceAll(m,"\\","\\\\");m=f.ReplaceAll(m,'"','\\"');m=f.ReplaceAll(m,"\t","\\t");m=f.ReplaceAll(m,"\r","");return f.ReplaceAll(m,"\n","\\n")};f.EscapeXML= function(m){m=f.ReplaceAll(m,"&","&");m=f.ReplaceAll(m,"<","<");m=f.ReplaceAll(m,">",">");return f.ReplaceAll(m,'"',""")};const g=/[-[\]{}()*+?.,\\^$|#\s]/g;f.EscapeRegex=function(m){return m.replace(g,"\\$&")};f.FindAll=function(m,u,w=!1){if(!u)return[];w||(m=m.toLowerCase(),u=u.toLowerCase());w=u.length;var q=0;let t=[];for(;-1<(q=m.indexOf(u,q));)t.push(q),q+=w;return t};f.ReplaceAll=function(m,u,w){return m.replaceAll(u,()=>w)};f.ReplaceAllCaseInsensitive=function(m,u,w){return m.replace(new RegExp(f.EscapeRegex(u), "gi"),()=>w)};f.SetElementContent=function(m,u){"string"===typeof u?m.textContent=u:u.isPlainText()?m.textContent=u.toString():(m.innerHTML=u.toHTML(),u instanceof f.BBString&&u.attachLinkHandlers(m))};f.StringLikeEquals=function(m,u){return m instanceof f.HtmlString||m instanceof f.BBString?m.equals(u):u instanceof f.HtmlString||u instanceof f.BBString?u.equals(m):m===u};f.StringSubstitute=function(m,...u){let w=m;for(let q=0,t=u.length;q u?1:mm)return w(u+"bytes",m);if(1048576>m)return m/=1024,m=10>m?Math.round(10*m)/10:Math.round(m),w(u+"kilobytes",m);if(1073741824>m)return m/=1048576,m=10>m?Math.round(10*m)/10:Math.round(m),w(u+"megabytes",m);if(1099511627776>m)return m/=1073741824,m=10>m?Math.round(10*m)/10:Math.round(m),w(u+"gigabytes",m);m/=1099511627776;m=10>m?Math.round(10*m)/10:Math.round(m);return w(u+"terabytes", m)};const l={approximate:!1,days:!0,hours:!0,minutes:!0,seconds:!0};f.FormatTime=function(m,u){u=Object.assign({},l,u);f.Lang.PushContext("common.time");const w=[],q=self.lang,t=self.langPluralSub;if(u.days){var p=Math.floor(m/86400);0m?"-":"";m=Math.abs(m);m=m.toString();u-=m.length;for(let q=0;qu.toUpperCase())};f.CompareVersionStrings=function(m,u){m=m.split(".").map(w=>w.trim());u=u.split(".").map(w=>w.trim());f.resizeArray(m,4,"0");f.resizeArray(u,4,"0");m=m.map(w=>parseInt(w,10));u=u.map(w=>parseInt(w, 10));for(let w=0;4>w;++w){const q=m[w]-u[w];if(0!==q)return 0>q?-1:1}return 0};f.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)})};f.StringHammingDistance=function(m,u){if(m.length!==u.length)throw Error("strings must be same length");let w=0;for(let q=0,t=m.length;qu.length){var r=m;m=u;u=r}p=Array(m.length+1);for(r=0;r<=m.length;r++)p[r]=r;for(r=1;r<=u.length;r++){q=r;for(w=1;w<=m.length;w++)t=u[r-1]===m[w-1]?p[w-1]:Math.min(p[w-1]+1,Math.min(q+1,p[w]+1)),p[w-1]=q,q=t;p[m.length]=q}return p[m.length]}} {"use strict";const f=self.C3,b=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"]]]),a=/\[(\/?)([a-zA-Z0-9]+)\]/g, c=/\[(\/?)([^\[\n]*?)\]/g;let d=null,e=0;function h(l,m,u){var w=b.get(u);if(w){if("string"===typeof w){if("a"!==w||m)return"<"+m+w+">";m=parseInt(u.substring(1),10)-1;if(0>m||m>=d.length)throw Error("invalid bbcode link substitution");w=d[m];if("string"===typeof w)return``;if("function"===typeof w)return``;throw new TypeError("invalid bbcode link action");}if(Array.isArray(w))return l=w[0],w=w[1],m?"":`<${l} class="${w}">`}else return"class"===u?m? "":``:l}const g=/\n/g;f.BBString=class{constructor(l,m){this._bbstr=m&&m.noEscape?l:f.EscapeHTML(l);this._htmlstr="";this._convertLineBreaks=!1;this._linkActions=[];if(m&&(this._convertLineBreaks=!!m.convertLineBreaks,m.links)){if(9"));this._htmlstr= l}return this._htmlstr}attachLinkHandlers(l){if(this._linkActions.length)for(let m=0,u=this._linkActions.length;mc)){if(1===b.length){var h=b[0];const g= h.text;h=h.styles;if(100>=g.length&&!g.includes("\n")){let {width:l,height:m,fontBoundingBoxAscent:u,fontBoundingBoxDescent:w,topToAlphabeticDistance:q}=a(g,h);l+=e;u=u||0;w=w||0;q=q||0;if(l<=c){this._AddLine([{text:g,styles:h,width:l,height:m,fontBoundingBoxAscent:u,fontBoundingBoxDescent:w,topToAlphabeticDistance:q}],l,m,u,w,q);return}}}if("word"===d)d=this._TokeniseWords(b);else{d=[];for(const g of b)f.appendArray(d,[...g.text].map(l=>[{text:l,styles:g.styles}]))}this._WrapText(d,a,c,e)}}_TokeniseWords(b){const a= [];let c=[],d=!1;for(const h of b){var e=h.text;b=h.styles;for(const g of e)"\n"===g?(0({text:a.text,styles:a.styles,width:a.width,height:a.height,fontBoundingBoxAscent:a.fontBoundingBoxAscent, fontBoundingBoxDescent:a.fontBoundingBoxDescent,topToAlphabeticDistance:a.topToAlphabeticDistance}))}_AddWordToLine(b,a){var c=b.length?b.at(-1):null;let d=0;c&&a[0].styles===c.styles&&(c.text+=a[0].text,c.width=-1,c.height=-1,c.fontBoundingBoxAscent=-1,c.fontBoundingBoxDescent=-1,c.topToAlphabeticDistance=-1,d=1);for(c=a.length;d=c?(0Math.max(b,a.width),0)}GetTotalLineHeight(){return this._lines.reduce((b,a)=>b+a.height,0)}}} {"use strict";const f=self.C3,b=self.glMatrix,a=b.vec3,c=b.vec4,d=b.mat4,e=a.create(),h=a.create(),g=a.create(),l=c.create(),m=d.create(),u=a.create(),w=a.create(),q=a.create(),t=a.create(),p=a.create(),r=a.create(),x=a.create(),y=a.create(),E=c.fromValues(0,0,1,1);f.Gfx={Project(B,I,L,P,S,U,V){const Z=P[0]*B+P[4]*I+P[8]*L+P[12],ma=P[1]*B+P[5]*I+P[9]*L+P[13],va=P[2]*B+P[6]*I+P[10]*L+P[14];P=P[3]*B+P[7]*I+P[11]*L+P[15];B=S[0]*Z+S[4]*ma+S[8]*va+S[12]*P;I=S[1]*Z+S[5]*ma+S[9]*va+S[13]*P;L=S[2]*Z+S[6]* ma+S[10]*va+S[14]*P;S=S[3]*Z+S[7]*ma+S[11]*va+S[15]*P;if(0===S)return!1;S=1/S;V[0]=(B*S*.5+.5)*U[2]+U[0];V[1]=(I*S*.5+.5)*U[3]+U[1];V[2]=.5*(1+L*S);return!0},Unproject(B,I,L,P,S,U,V){d.multiply(m,S,P);if(null===d.invert(m,m))return!1;l[0]=(B-U[0])/U[2]*2-1;l[1]=(I-U[1])/U[3]*2-1;l[2]=2*L-1;l[3]=1;c.transformMat4(l,l,m);if(0===l[3])return!1;l[3]=1/l[3];V[0]=l[0]*l[3];V[1]=l[1]*l[3];V[2]=l[2]*l[3];return!0},UnprojectScreenToWorldZ(B,I,L,P,S,U,V){if(!f.Gfx.Unproject(B,I,0,P,S,U,e)||!f.Gfx.Unproject(B, I,1,P,S,U,h))return!1;a.subtract(h,h,e);a.set(g,0,0,1);B=-L;I=a.dot(g,h);L=0;if(0===I){if(0!==a.dot(g,e)+B)return!1}else if(L=-(a.dot(e,g)+B)/I,0>L)return!1;a.scaleAndAdd(V,e,h,L);return!0}};function H(B,I,L,P){a.subtract(e,L,I);a.subtract(h,B,I);a.cross(g,e,h);a.normalize(g,g);P.set(g[0],g[1],g[2],a.dot(B,g))}function A(B,I,L,P,S,U,V){const Z=V.x,ma=V.y,va=V.z,Na=V.w,Ea=V.xF,Ia=V.yF;V=V.zF;const Ma=1-Ea,Fa=1-Ia,ya=1-V;return Z*B*Ea+Z*P*Ma+ma*I*Ia+ma*S*Fa+va*L*V+va*U*ya>=Na?!0:Z*P*Ea+Z*B*Ma+ma*S* Ia+ma*I*Fa+va*U*V+va*L*ya>Na}function F(B,I,L,P){return P.x*B+P.y*I+P.z*L>=P.w}class J{constructor(){this.zF=this.yF=this.xF=this.w=this.z=this.y=this.x=NaN}set(B,I,L,P){this.x=B;this.y=I;this.z=L;this.w=P;this.xF=0= 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(t){if("butt"===t)this.PushLineCapButt();else if("square"===t)this.PushLineCapSquare(); else if("zag"===t)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(t){this._lineOffset=t;this._lineOffsetStack[this._lineOffsetStack.length-1]=t}GetLineOffset(){return this._lineOffset}PushLineOffset(t){if(100<=this._lineOffsetStack.length)throw Error("pushed too many line offsets - check push/pop pairs");this._lineOffsetStack.push(t);this._lineOffset= t}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(t){var p=t.length/2;if(3>p)throw Error("need at least 3 points");p-=2;const r=p-1,x=t[0],y=t[1];for(let E=0;Ec||2>d)throw Error("invalid mesh size");this._hsize=c;this._vsize=d;this._owner=e||null; this._pts=[];this._minY=this._minX=0;this._maxY=this._maxX=1;this._maxZ=0;this._pointsChanged=!1;e=c-1;const h=d-1;for(let g=0;gc||c>=this._hsize||0>d||d>=this._vsize?null:this._pts[d][c]}CalculateTransformedMesh(c,d,e){const h=e instanceof f.Rect;if(c.GetHSize()!==this.GetHSize()||c.GetVSize()!==this.GetVSize())throw Error("source mesh wrong size");c=c._pts;const g=this._pts;for(let l=0,m=g.length;l[g,l,m]);const e=this._pts;let h=e[0];for(let g=1,l=e.length;g{w=f.clamp(f.lerp(w,r,y),0,1);q=f.clamp(f.lerp(q,x,y),0,1);d.push(w,q)};for(let A=0,F=c.length;A=y)){H();E=0;continue}if(0=y)){H();p--;E=4;continue}if(t=y)){H();t++;E=1;continue}if(0=y)){H();t--;E=3;continue}if(p=y)){H();p++;E=2;continue}break}return f.New(f.CollisionPoly,d)}TransformCollisionPoly(c,d){c=this._TransformPolyPoints(c);this._SimplifyPoly(c);d.setPoints(c)}_TransformPolyPoints(c){const d=[];c=c.pointsArr();for(let e=0,h=c.length;eMath.abs(p)&&1E-7>Math.abs(l)&&Math.sign(t)===Math.sign(g);(!(1E-7>Math.abs(t)&&1E-7>Math.abs(g)&&Math.sign(p)===Math.sign(l)||r)&&1E-7c.map(d=>d.SaveToJson()))}}LoadFromJson(c){const d=this.GetHSize(),e=this.GetVSize();if(c.cols!==d||c.rows!==e)throw Error("mesh data wrong size"); c=c.points;for(let h=0;h=this._width||0>=this._height)throw Error("invalid texture data size");if(u.isSvg){var w=f.CreateCanvas(this._width, this._height);w.getContext("2d").drawImage(m,0,0,this._width,this._height);m=w}var q=f.isPOT(this._width)&&f.isPOT(this._height);w=this._renderer.GetMaxTextureSize();if(this._width>w||this._height>w)throw Error("texture data exceeds maximum texture size");w=this._renderer.GetContext();var t=this._renderer.GetWebGLVersionNumber();this._texture=w.createTexture();w.bindTexture(w.TEXTURE_2D,this._texture);w.pixelStorei(w.UNPACK_PREMULTIPLY_ALPHA_WEBGL,u.premultiplyAlpha);w.pixelStorei(w.UNPACK_FLIP_Y_WEBGL, !1);u=e(this._pixelFormat,w);if(this._renderer.SupportsNPOTTextures()||q||!this._IsTiled())2<=t?(w.texStorage2D(w.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?w.texSubImage2D(w.TEXTURE_2D,0,0,0,this._width,this._height,u.format,u.type,new Uint8Array(m)):null!==m&&w.texSubImage2D(w.TEXTURE_2D,0,0,0,u.format,u.type,m)):m instanceof ArrayBuffer?w.texImage2D(w.TEXTURE_2D,0,u.internalformat, this._width,this._height,0,u.format,u.type,new Uint8Array(m)):null===m?w.texImage2D(w.TEXTURE_2D,0,u.internalformat,this._width,this._height,0,u.format,u.type,null):w.texImage2D(w.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&&(q=f.CreateCanvas(this._width,this._height), q.getContext("2d").putImageData(m,0,0),m=q);q=f.CreateCanvas(f.nextHighestPowerOfTwo(this._width),f.nextHighestPowerOfTwo(this._height));t=q.getContext("2d");t.imageSmoothingEnabled="nearest"!==this._sampling;t.drawImage(m,0,0,this._width,this._height,0,0,q.width,q.height);w.texImage2D(w.TEXTURE_2D,0,u.internalformat,u.format,u.type,q)}null!==m&&this._SetTextureParameters(w);w.bindTexture(w.TEXTURE_2D,null);this._renderer._ResetLastTexture();this._refCount=1;l.add(this)}_CreateDynamic(m,u,w){w=Object.assign({}, h,w);if(this._texture)throw Error("already created texture");this._wrapX=w.wrapX;this._wrapY=w.wrapY;this._sampling=w.sampling;this._pixelFormat=w.pixelFormat;this._isMipMapped=!!w.mipMap&&this._renderer.AreMipmapsEnabled();this._mipMapQuality=w.mipMapQuality;if(!d.has(this._wrapX)||!d.has(this._wrapY))throw Error("invalid wrap mode");if(!a.has(this._sampling))throw Error("invalid sampling");if(!b.has(this._pixelFormat))throw Error("invalid pixel format");if(!c.has(this._mipMapQuality))throw Error("invalid mipmap quality"); this._isStatic=!1;this._width=Math.floor(m);this._height=Math.floor(u);m=f.isPOT(this._width)&&f.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,w.premultiplyAlpha);m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,!1);w=e(this._pixelFormat,m);m.texImage2D(m.TEXTURE_2D,0,2<=u?w.sizedinternalformat:w.internalformat,this._width,this._height,0,w.format,w.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=f.isPOT(this._width)&&f.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._refCount)throw Error("texture not created");if(this._isStatic)throw Error("cannot update static texture"); u=Object.assign({},g,u);const w=m.width||m.videoWidth,q=m.height||m.videoHeight;var t=this._renderer.GetWebGLVersionNumber();const p=this._renderer.GetContext();p.bindTexture(p.TEXTURE_2D,this._texture);p.pixelStorei(p.UNPACK_PREMULTIPLY_ALPHA_WEBGL,u.premultiplyAlpha);p.pixelStorei(p.UNPACK_FLIP_Y_WEBGL,!!u.flipY);u=e(this._pixelFormat,p);t=2<=t?u.sizedinternalformat:u.internalformat;try{if(this._width===w&&this._height===q){const r=f.isPOT(this._width)&&f.isPOT(this._height);p.texSubImage2D(p.TEXTURE_2D, 0,0,0,u.format,u.type,m);(r||this._renderer.SupportsNPOTTextures())&&this._isMipMapped&&(p.hint(p.GENERATE_MIPMAP_HINT,this._GetMipMapHint(p)),p.generateMipmap(p.TEXTURE_2D))}else{this._width=w;this._height=q;const r=f.isPOT(this._width)&&f.isPOT(this._height);if(!this._renderer.SupportsNPOTTextures()&&this._IsTiled()&&!r)throw Error("non-power-of-two tiled textures not supported");p.texImage2D(p.TEXTURE_2D,0,t,u.format,u.type,m);(r||this._renderer.SupportsNPOTTextures())&&this._isMipMapped&&(p.hint(p.GENERATE_MIPMAP_HINT, this._GetMipMapHint(p)),p.generateMipmap(p.TEXTURE_2D))}}catch(r){console.error("Error updating WebGL texture: ",r)}p.bindTexture(p.TEXTURE_2D,null);this._renderer._ResetLastTexture()}_Delete(){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 f=self.C3,b=self.glMatrix.mat4,a=new Set(["nearest","bilinear","trilinear"]),c={sampling:"trilinear",alpha:!0,depth:!1,isSampled:!0,isDefaultSize:!0,multisampling:0},d=new Set;f.Gfx.WebGLRenderTarget=class{constructor(e){this._renderer=e;this._renderBuffer=this._texture=this._frameBufferNoDepth=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= b.create()}_Create(e,h,g){g=Object.assign({},c,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(!a.has(this._sampling))throw Error("invalid sampling");if(0l||this._isSampled))throw Error("invalid use of multisampling"); 2>l&&(this._isSampled=!0);this._width=e;this._height=h;if(0>=this._width||0>=this._height)throw Error("invalid render target size");this._CalculateProjection();e=this._renderer.GetContext();this._frameBuffer=e.createFramebuffer();this._depth&&(this._frameBufferNoDepth=e.createFramebuffer());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(),e.bindFramebuffer(e.FRAMEBUFFER, this._frameBuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,h,0),this._depth&&(e.bindFramebuffer(e.FRAMEBUFFER,this._frameBufferNoDepth),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,h,0))):(this._renderBuffer=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,this._renderBuffer),h=this._alpha?e.RGBA8:e.RGB8,0g&&(this._multisampling= g)):this._multisampling=0),0===this._multisampling?e.renderbufferStorage(e.RENDERBUFFER,h,this._width,this._height):e.renderbufferStorageMultisample(e.RENDERBUFFER,this._multisampling,h,this._width,this._height),e.bindFramebuffer(e.FRAMEBUFFER,this._frameBuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,this._renderBuffer),this._depth&&(e.bindFramebuffer(e.FRAMEBUFFER,this._frameBufferNoDepth),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER, this._renderBuffer)),e.bindRenderbuffer(e.RENDERBUFFER,null));h=this._renderer._GetDepthBuffer();this._depth&&h&&(e.bindFramebuffer(e.FRAMEBUFFER,this._frameBuffer),this._renderer._CanSampleDepth()?e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,h,0):e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,h));e.bindFramebuffer(e.FRAMEBUFFER,null);d.add(this)}_Resize(e,h){if(this._width!==e||this._height!==h)this._width=e,this._height=h,this._CalculateProjection(), e=this._renderer.GetContext(),e.bindFramebuffer(e.FRAMEBUFFER,this._frameBuffer),this._texture?this._texture._Update(new ImageData(this._width,this._height)):(e.bindRenderbuffer(e.RENDERBUFFER,this._renderBuffer),e.renderbufferStorage(e.RENDERBUFFER,this._alpha?e.RGBA8:e.RGB8,this._width,this._height),e.bindRenderbuffer(e.RENDERBUFFER,null)),h=this._renderer._GetDepthBuffer(),this._depth&&h&&(this._renderer._CanSampleDepth()?e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D, h,0):e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,h)),e.bindFramebuffer(e.FRAMEBUFFER,null)}_Delete(){if(!this._texture&&!this._renderBuffer)throw Error("already deleted render target");d.delete(this);var e=this._renderer.GetContext();this._texture?(e.bindFramebuffer(e.FRAMEBUFFER,this._frameBuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,null,0),this._depth&&(e.bindFramebuffer(e.FRAMEBUFFER,this._frameBufferNoDepth),e.framebufferTexture2D(e.FRAMEBUFFER, e.COLOR_ATTACHMENT0,e.TEXTURE_2D,null,0)),this._renderer.DeleteTexture(this._texture),this._texture=null):this._renderBuffer&&(e.bindFramebuffer(e.FRAMEBUFFER,this._frameBuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,null),this._depth&&(e.bindFramebuffer(e.FRAMEBUFFER,this._frameBufferNoDepth),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,null)),e.deleteRenderbuffer(this._renderBuffer),this._renderBuffer=null);e.bindFramebuffer(e.FRAMEBUFFER, null);2<=this._renderer.GetWebGLVersionNumber()&&(e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null));e.deleteFramebuffer(this._frameBuffer);this._depth&&e.deleteFramebuffer(this._frameBufferNoDepth);e=this._renderer.GetBatchState();e.currentFramebuffer=null;this._frameBuffer=e.currentFramebufferNoDepth=null}_CalculateProjection(){this._renderer.CalculatePerspectiveMatrix(this._projectionMatrix,this._width/this._height)}_GetFramebuffer(){return this._frameBuffer}_GetFramebufferNoDepth(){return this._frameBufferNoDepth}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 e={sampling:this._sampling,alpha:this._alpha,isSampled:this._isSampled};this._isDefaultSize||(e.width=this._width,e.height=this._height);return e}IsCompatibleWithOptions(e){e=Object.assign({},c,e);return"nearest"!== e.sampling!==this.IsLinearSampling()||!!e.alpha!==this.HasAlpha()||!!e.depth!==this.HasDepthBuffer()||2<=this._renderer.GetWebGLVersionNumber()&&!!e.isSampled!==this.IsSampled()?!1:"number"===typeof e.width||"number"===typeof e.height?!this.IsDefaultSize()&&this.GetWidth()===e.width&&this.GetHeight()===e.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(e,h){e=await e.ReadBackRenderTargetToImageData(h,!0);return await f.ImageDataToBlob(e)}static OnContextLost(){d.clear()}static allRenderTargets(){return d.values()}static ResizeAll(e,h){for(const g of d)g.IsDefaultSize()&&g._Resize(e,h)}}} {"use strict";const f=self.C3,b=new Set("aPos aTex aPoints matP matMV samplerFront samplerBack samplerDepth destStart destEnd srcStart srcEnd srcOriginStart srcOriginEnd pixelSize seconds devicePixelRatio layerScale layerAngle layoutStart layoutEnd color color2_ pointTexStart pointTexEnd zElevation tileSize tileSpacing outlineThickness".split(" "));f.Gfx.WebGLShaderProgram=class extends f.Gfx.ShaderProgramBase{static async Compile(a,c,d,e){const h=a.GetContext(),g=h.createShader(h.FRAGMENT_SHADER); h.shaderSource(g,c);h.compileShader(g);c=h.createShader(h.VERTEX_SHADER);h.shaderSource(c,d);h.compileShader(c);const l=h.createProgram();h.attachShader(l,g);h.attachShader(l,c);h.bindAttribLocation(l,0,"aPos");h.bindAttribLocation(l,1,"aTex");h.bindAttribLocation(l,2,"aPoints");h.linkProgram(l);const m=a._GetParallelShaderCompileExtension();m?await a._WaitForObjectReady(()=>h.getProgramParameter(l,m.COMPLETION_STATUS_KHR)):await f.Wait(5);if(!h.getShaderParameter(g,h.COMPILE_STATUS))throw e=h.getShaderInfoLog(g), h.deleteShader(g),h.deleteShader(c),h.deleteProgram(l),Error("Error compiling fragment shader: "+e);if(!h.getShaderParameter(c,h.COMPILE_STATUS))throw e=h.getShaderInfoLog(c),h.deleteShader(g),h.deleteShader(c),h.deleteProgram(l),Error("Error compiling vertex shader: "+e);if(!h.getProgramParameter(l,h.LINK_STATUS))throw e=h.getProgramInfoLog(l),h.deleteShader(g),h.deleteShader(c),h.deleteProgram(l),Error("Error linking shader program: "+e);(a=f.FilterUnprintableChars(h.getProgramInfoLog(l)||"").trim())&& !f.IsStringAllWhitespace(a)&&console.info(`[WebGL] Shader program '${e}' compilation log: `,a);h.deleteShader(g);h.deleteShader(c);return l}static async Create(a,c,d,e){d=await f.Gfx.WebGLShaderProgram.Compile(a,c.src,d,e);return new f.Gfx.WebGLShaderProgram(a,d,c,e)}constructor(a,c,d,e){super(a,e,d);const h=a.GetContext();var g=a.GetBatchState();a.EndBatch();h.useProgram(c);this._gl=h;this._shaderProgram=c;this._isDeviceTransform=""===e;e=h.getAttribLocation(c,"aPos");const l= h.getAttribLocation(c,"aTex");this._locAPoints=h.getAttribLocation(c,"aPoints");-1!==e&&(h.bindBuffer(h.ARRAY_BUFFER,a._vertexBuffer),h.vertexAttribPointer(e,a.GetNumVertexComponents(),h.FLOAT,!1,0,0),h.enableVertexAttribArray(e));-1!==l&&(h.bindBuffer(h.ARRAY_BUFFER,a._texcoordBuffer),h.vertexAttribPointer(l,2,h.FLOAT,!1,0,0),h.enableVertexAttribArray(l));-1!==this._locAPoints&&(h.bindBuffer(h.ARRAY_BUFFER,a._pointBuffer),h.vertexAttribPointer(this._locAPoints,4,h.FLOAT,!1,0,0),h.enableVertexAttribArray(this._locAPoints)); h.bindBuffer(h.ARRAY_BUFFER,null);this._uMatP=new f.Gfx.WebGLShaderUniform(this,"matP","mat4");this._uMatMV=new f.Gfx.WebGLShaderUniform(this,"matMV","mat4");this._uColor=new f.Gfx.WebGLShaderUniform(this,"color","vec4");this._uSamplerFront=new f.Gfx.WebGLShaderUniform(this,"samplerFront","sampler");this._uPointTexStart=new f.Gfx.WebGLShaderUniform(this,"pointTexStart","vec2");this._uPointTexEnd=new f.Gfx.WebGLShaderUniform(this,"pointTexEnd","vec2");this._uZElevation=new f.Gfx.WebGLShaderUniform(this, "zElevation","float");this._uTileSize=new f.Gfx.WebGLShaderUniform(this,"tileSize","vec2");this._uTileSpacing=new f.Gfx.WebGLShaderUniform(this,"tileSpacing","vec2");this._uColor2=new f.Gfx.WebGLShaderUniform(this,"color2_","vec4");this._uOutlineThickness=new f.Gfx.WebGLShaderUniform(this,"outlineThickness","float");this._uSamplerBack=new f.Gfx.WebGLShaderUniform(this,"samplerBack","sampler");this._uSamplerDepth=new f.Gfx.WebGLShaderUniform(this,"samplerDepth","sampler");this._uDestStart=new f.Gfx.WebGLShaderUniform(this, "destStart","vec2");this._uDestEnd=new f.Gfx.WebGLShaderUniform(this,"destEnd","vec2");this._uSrcStart=new f.Gfx.WebGLShaderUniform(this,"srcStart","vec2");this._uSrcEnd=new f.Gfx.WebGLShaderUniform(this,"srcEnd","vec2");this._uSrcOriginStart=new f.Gfx.WebGLShaderUniform(this,"srcOriginStart","vec2");this._uSrcOriginEnd=new f.Gfx.WebGLShaderUniform(this,"srcOriginEnd","vec2");this._uPixelSize=new f.Gfx.WebGLShaderUniform(this,"pixelSize","vec2");this._uSeconds=new f.Gfx.WebGLShaderUniform(this,"seconds", "float");this._uDevicePixelRatio=new f.Gfx.WebGLShaderUniform(this,"devicePixelRatio","float");this._uLayerScale=new f.Gfx.WebGLShaderUniform(this,"layerScale","float");this._uLayerAngle=new f.Gfx.WebGLShaderUniform(this,"layerAngle","float");this._uLayoutStart=new f.Gfx.WebGLShaderUniform(this,"layoutStart","vec2");this._uLayoutEnd=new f.Gfx.WebGLShaderUniform(this,"layoutEnd","vec2");this._hasAnyOptionalUniforms=!!(this._uPixelSize.IsUsed()||this._uSeconds.IsUsed()||this._uSamplerBack.IsUsed()|| this._uDestStart.IsUsed()||this._uDestEnd.IsUsed()||this._uSrcStart.IsUsed()||this._uSrcEnd.IsUsed()||this._uSrcOriginStart.IsUsed()||this._uSrcOriginEnd.IsUsed()||this._uDevicePixelRatio.IsUsed()||this._uLayerScale.IsUsed()||this._uLayerAngle.IsUsed()||this._uLayoutStart.IsUsed()||this._uLayoutEnd.IsUsed());a=d.parameters||[];this._uCustomParameters=[];this._usesAnySrcRectOrPixelSize=this._uPixelSize.IsUsed()||this._uSrcStart.IsUsed()||this._uSrcEnd.IsUsed()||this._uSrcOriginStart.IsUsed()||this._uSrcOriginEnd.IsUsed(); 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._uSamplerDepth.Init1i(2);this._uPointTexStart.Init2f(0,0);this._uPointTexEnd.Init2f(1,1);this._uZElevation.Init1f(0);this._uTileSize.Init2f(0,0);this._uTileSpacing.Init2f(0,0);this._uDestStart.Init2f(0,0);this._uDestEnd.Init2f(1,1);this._uSrcStart.Init2f(0,0);this._uSrcEnd.Init2f(0,0);this._uSrcOriginStart.Init2f(0,0);this._uSrcOriginEnd.Init2f(0, 0);this._uPixelSize.Init2f(0,0);this._uDevicePixelRatio.Init1f(1);this._uLayerScale.Init1f(1);this._uLayerAngle.Init1f(0);this._uSeconds.Init1f(0);this._uLayoutStart.Init2f(0,0);this._uLayoutEnd.Init2f(0,0);this._uOutlineThickness.Init1f(1);for(const m of a)a=m[2],c=new f.Gfx.WebGLShaderUniform(this,m[0],a),"color"===a?c.Init3f(0,0,0):c.Init1f(0),this._uCustomParameters.push(c);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._gl=null;super.Release()}GetWebGLContext(){return this._gl}GetShaderProgram(){return this._shaderProgram}GetParameterCount(){return this._uCustomParameters.length}GetParameterType(a){return this._uCustomParameters[a].GetType()}AreCustomParametersAlreadySetInBatch(a){for(let c=0,d=a.length;c{q=q.font.GetName();for(const t of h)(t.IsBBCodeEnabled()||f.equalsNoCase(t.GetFontName(),q))&&t._SetTextChanged()});function g(q,t,p,r,x,y){t?"Gecko"===f.Platform.BrowserEngine?q.strokeText(p,r,x,y):q.strokeText(p,r,x):"Gecko"===f.Platform.BrowserEngine?q.fillText(p, r,x,y):q.fillText(p,r,x)}function l(q,t,p,r,x,y){t?q.strokeRect(p,r,x,y):q.fillRect(p,r,x,y)}function m(q){return 4/3*q}let u=!1,w=!1;f.Gfx.RendererText=class{constructor(q,t){t=Object.assign({},b,t);this._renderer=q;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=f.New(f.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=(p,r)=>this._MeasureText(p,r);this._texture=null;this._textureHeight=this._textureWidth=0;this._rcTex=new f.Rect;this._scaleFactor=1;this._needToRecreateTexture=!1;this._textureTimeout=new f.IdleTimeout(()=>{this.ReleaseTexture();this._SetTextCanvasSize(8,8)},t.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(q){this._isAsync=!!q}IsAsync(){return this._isAsync}SetBBCodeEnabled(q){q=!!q;this._isBBcodeEnabled!==q&&(q=(this._isBBcodeEnabled=q)?"alphabetic": "top",this._textContext&&(this._textContext.textBaseline=q),this._measureContext&&(this._measureContext.textBaseline=q),this._SetTextChanged())}IsBBCodeEnabled(){return this._isBBcodeEnabled}SetFontName(q){q||(q="serif");this._fontName!==q&&(this._fontName=q,this._SetTextChanged())}GetFontName(){return this._fontName}SetFontSize(q){.1>q&&(q=.1);this._fontSize!==q&&(this._fontSize=q,this._SetTextChanged())}SetFontSizeScale(q){this._fontSizeScale!==q&&(this._fontSizeScale=q,this._SetTextChanged())}SetLineHeight(q){this._lineHeight!== q&&(this._lineHeight=q,this._SetChanged())}SetBold(q){q=!!q;this._isBold!==q&&(this._isBold=q,this._SetTextChanged())}SetItalic(q){q=!!q;this._isItalic!==q&&(this._isItalic=q,this._SetTextChanged())}SetDrawMaxCharacterCount(q){q=Math.floor(q);this._drawMaxCharCount!==q&&(this._drawMaxCharCount=q,this._SetChanged())}GetDrawMaxCharacterCount(){return this._drawMaxCharCount}_GetStyleTag(q,t){for(let p=q.length-1;0<=p;--p){const r=q[p];if(r.tag===t)return r}return null}_HasStyleTag(q,t){return!!this._GetStyleTag(q, t)}_GetFontString(q,t){let p=[];(this._isBold||this._HasStyleTag(t,"b"))&&p.push("bold");(this._isItalic||this._HasStyleTag(t,"i"))&&p.push("italic");var r=this._GetStyleTag(t,"size");r=(r?parseFloat(r.param):this._fontSize)*this._fontSizeScale;q?p.push(r+"pt"):p.push(r*this._scaleFactor*this._zoom*self.devicePixelRatio+"pt");q=this._fontName;(t=this._GetStyleTag(t,"font"))&&t.param&&(q=t.param,this.onloadfont&&!this._alreadyLoadedFonts.has(q)&&(this.onloadfont(q),this._alreadyLoadedFonts.add(q))); q&&p.push('"'+q+'"');return p.join(" ")}SetColor(q){q instanceof f.Color&&(q=q.getCssRgb());this._colorStr!==q&&(this._colorStr=q,this._SetChanged())}SetColorRgb(q,t,p){a.setRgb(q,t,p);this.SetColor(a)}SetHorizontalAlignment(q){if(!c.has(q))throw Error("invalid horizontal alignment");this._horizontalAlign!==q&&(this._horizontalAlign=q,this._SetChanged())}SetVerticalAlignment(q){if(!d.has(q))throw Error("invalid vertical alignment");this._verticalAlign!==q&&(this._verticalAlign=q,this._SetChanged())}SetWordWrapMode(q){if(!e.has(q))throw Error("invalid word wrap mode"); this._wrapMode!==q&&(this._wrapMode=q,this._SetTextChanged())}SetText(q){this._text!==q&&(this._text=q,this._SetTextChanged())}SetSize(q,t,p){"undefined"===typeof p&&(p=1);if(!(0>=q||0>=q||this._cssWidth===q&&this._cssHeight===t&&this._zoom===p)){1===this._zoom!==(1===p)&&(this._needToRecreateTexture=!0);var r=this._cssWidth,x=this._zoom;this._cssWidth=q;this._cssHeight=t;this._zoom=p;q=self.devicePixelRatio;this._width=this._cssWidth*this._zoom*q;this._height=this._cssHeight*this._zoom*q;q=Math.max(this._width, this._height);t=Math.min(this._renderer.GetMaxTextureSize(),2048);p=1;q>t&&(p=t/q,this._width=Math.min(this._width*p,t),this._height=Math.min(this._height*p,t));this._scaleFactor=p;0=this._width||0>=this._height||(this._changed=!1,this._isUpdating=!0,this._isAsync?f.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(q,t){this._textCanvas||(this._textCanvas=f.CreateCanvas(16,16));let p=!1;if(this._lastCanvasWidth!==q||this._lastCanvasHeight!==t)this._lastCanvasWidth=q,this._lastCanvasHeight=t,this._textCanvas.width=q,this._textCanvas.height=t,p=!0;this._textContext||(this._textContext=this._textCanvas.getContext("2d"),p=!0);p?(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,q,t)}_MaybeCreateMeasureContext(){this._measureContext||(this._measureContext=f.CreateCanvas(16,16).getContext("2d"),this._measureContextTop=f.CreateCanvas(16,16).getContext("2d"), this._measureContext.textBaseline=this._isBBcodeEnabled?"alphabetic":"top",this._measureContextTop.textBaseline="top")}_SetMeasureFontString(q){this._lastMeasureCanvasFont!==q&&(this._lastMeasureCanvasFont=q,this._measureContext.font=q,this._measureContextTop.font=q)}_SupportsFontBoundingBoxMeasurements(){if(!u){u=!0;this._MaybeCreateMeasureContext();const q=this._measureContext.measureText("test");w="number"===typeof q.fontBoundingBoxAscent&&"number"===typeof q.fontBoundingBoxDescent}return w}_MaybeWrapText(){this._textChanged&& (this._MaybeCreateMeasureContext(),!this._isBBcodeEnabled||this._bbString&&this._bbString.toString()===this._text||(this._bbString=new f.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(q,t){this._SetMeasureFontString(this._GetFontString(!0,t));t=this._GetStyleTag(t,"size");t=(t?parseFloat(t.param):this._fontSize)*this._fontSizeScale; const p=this._measureContext.measureText(q);let r=0;this._isBBcodeEnabled&&this._SupportsFontBoundingBoxMeasurements()&&(q=this._measureContextTop.measureText(q),r=p.fontBoundingBoxAscent-q.fontBoundingBoxAscent);return{width:p.width,height:m(t),fontBoundingBoxAscent:p.fontBoundingBoxAscent||0,fontBoundingBoxDescent:p.fontBoundingBoxDescent||0,topToAlphabeticDistance:r}}_SetDrawFontString(q){this._lastTextCanvasFont!==q&&(this._lastTextCanvasFont=q,this._textContext.font=q)}_SetDrawCanvasColor(q){this._lastTextCanvasFillStyle!== q&&(this._lastTextCanvasFillStyle=q,this._textContext.fillStyle=q,this._textContext.strokeStyle=q)}_SetDrawCanvasOpacity(q){this._lastTextCanvasOpacity!==q&&(this._lastTextCanvasOpacity=q,this._textContext.globalAlpha=q)}_SetDrawCanvasLineWith(q){this._lastTextCanvasLineWidth!==q&&(this._lastTextCanvasLineWidth=q,this._textContext.lineWidth=q)}_DrawTextToCanvas(){this._drawCharCount=0;const q=this._scaleFactor*this._zoom*self.devicePixelRatio,t=(4+this._lineHeight)*q;var p=0;const r=this._wrappedText.GetLines(); if(0!==r.length){var x=this._isBBcodeEnabled&&this._SupportsFontBoundingBoxMeasurements(),y=r[0].height*q;"center"===this._verticalAlign?(p=r.reduce((E,H)=>E+H.height*q+t,0)-t,p=Math.max(this._height/2-p/2,0),x&&(y=r[0].topToAlphabeticDistance*q)):"bottom"===this._verticalAlign&&(p=r.reduce((E,H)=>E+H.height*q+t,0)-this._lineHeight*q,x=x?r.at(-1).fontBoundingBoxDescent*q:0,p=this._height-p-x-2);for(let E=0,H=r.length;Ethis._height-4*q)break}else if(0=this._height-A)break;0<=F&&this._DrawTextLine(x,p,q);this._isBBcodeEnabled||(p+=A);p+=t}}}_DrawTextLine(q,t,p){let r=0;"center"===this._horizontalAlign?r=(this._width-q.width*p)/2:"right"===this._horizontalAlign&&(r=this._width-q.width*p);for(const x of q.fragments)this._DrawTextFragment(x,r,t,p,q.height),r+=x.width*p}_DrawTextFragment(q,t,p,r,x){const y=this._textContext,E=x/16;x=q.width*r;const H=q.height*r,A=q.height/16;var F=(4+this._lineHeight)*r, J=q.styles;q=q.text;if(-1!==this._drawMaxCharCount){if(this._drawCharCount>=this._drawMaxCharCount)return;this._drawCharCount+q.length>this._drawMaxCharCount&&(q=q.substr(0,this._drawMaxCharCount-this._drawCharCount),x=this._MeasureText(q,J).width*r);this._drawCharCount+=q.length}var B=this._GetStyleTag(J,"background");const I=this._HasStyleTag(J,"u"),L=this._HasStyleTag(J,"s");if((!f.IsStringAllWhitespace(q)||B||I||L)&&!this._HasStyleTag(J,"hide")){var P=this._GetStyleTag(J,"offsetx");t+=P?parseFloat(P.param)* r:0;P=this._GetStyleTag(J,"offsety");p+=P?parseFloat(P.param)*r:0;B&&(this._SetDrawCanvasColor(B.param),y.fillRect(t,p-H,x,H+F));F=this._GetStyleTag(J,"color");this._SetDrawCanvasColor(F?F.param:this._colorStr);B=this._GetStyleTag(J,"opacity");this._SetDrawCanvasOpacity(B?parseFloat(B.param)/100:1);B=(B=this._GetStyleTag(J,"linethickness"))?parseFloat(B.param):1;(P=this._HasStyleTag(J,"stroke"))&&this._SetDrawCanvasLineWith(.5*A*B*this._scaleFactor*this._zoom*self.devicePixelRatio);this._SetDrawFontString(this._GetFontString(!1, J));g(y,P,q,t,p,x);!P&&(this._SetDrawCanvasLineWith(.5*A*B*this._scaleFactor*this._zoom*self.devicePixelRatio),J=this._GetStyleTag(J,"outline"))&&(this._SetDrawCanvasColor(J.param),g(y,!0,q,t,p,x));this._SetDrawCanvasColor(F?F.param:this._colorStr);I&&l(y,P,t,p+r*E,x,r*E*B);L&&(r*=A,y.fillRect(t,p-H/4+r/2-r*B/2,x,r*B))}}_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 q of h)q.ReleaseTexture()}static GetAll(){return h.values()}}} {"use strict";const f=self.C3;class b{constructor(a){this._gl=a.GetContext();this._version=a.GetWebGLVersionNumber();this._timerExt=a._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 a=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 c=this._gl.getParameter(this._timerExt.GPU_DISJOINT_EXT);a&&!c&&(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);(a|| c)&&this._DeleteQueryObject()}}HasResult(){return this._hasResult}GetResult(){if(!this._hasResult)throw Error("no result available");return this._result}}f.Gfx.WebGLTimeElapsedQuery=class{constructor(a){this._renderer=a;this._frameNumber=a.GetFrameNumber();this._isActive=!1;this._parentQuery=null;this._isNested=!1;this._realQuery=null;this._queries=[]}Release(){for(const a of this._queries)a instanceof b&&a.Release();f.clearArray(this._queries);this._renderer=this._realQuery=this._parentQuery=null}BeginTimeElapsed(){if(this._isActive)throw Error("query already active"); const a=this._renderer._GetTimeQueryStack();0a.HasResult())}GetResult(){return this._queries.reduce((a,c)=>a+c.GetResult(),0)}GetFrameNumber(){return this._frameNumber}}} {"use strict";const f=self.C3;f.Gfx.WebGLQueryResultBuffer=class{constructor(b,a=1E3){this._renderer=b;this._maxQueries=a;this._buffer=[];this._renderer._AddQueryResultBuffer(this)}Release(){this.Clear();this._renderer._RemoveQueryResultBuffer(this);this._renderer=null}Clear(){for(const b of this._buffer)b.Release();f.clearArray(this._buffer)}AddTimeElapsedQuery(){const b=new f.Gfx.WebGLTimeElapsedQuery(this._renderer);this._buffer.push(b);this._buffer.length>this._maxQueries&&this._buffer.shift().Release(); return b}CheckForResults(b){for(const a of this._buffer){if(a.GetFrameNumber()>=b)break;if(a.IsNested())break;a.CheckForResult()}}GetFrameRangeResultSum(b,a){if(a<=b)return NaN;let c=0;for(const d of this._buffer){if(d.GetFrameNumber()>=a)break;if(!(d.GetFrameNumber()this.GetWebGLVersionNumber()&&this._usesDepthBuffer&&this._canSampleDepth&&(this._depthTextureExt= r.getExtension("WEBGL_depth_texture"),!this._depthTextureExt))throw Error("no depth texture support");r=f.Gfx.WebGLShaderProgram;x=r.GetDefaultVertexShaderSource(!1);r=[[r.GetTextureFillFragmentShaderSource(),x,""],[r.GetTextureFillFragmentShaderSource(),x,""],[r.GetPointFragmentShaderSource(this._version),r.GetPointVertexShaderSource(this._version),""],[r.GetColorFillFragmentShaderSource(),x,""],[r.GetLinearGradientFillFragmentShaderSource(),x,""], [r.GetHardEllipseFillFragmentShaderSource(),x,""],[r.GetHardEllipseOutlineFragmentShaderSource(),x,""],[r.GetSmoothEllipseFillFragmentShaderSource(),x,""],[r.GetSmoothEllipseOutlineFragmentShaderSource(),x,""],[r.GetSmoothLineFillFragmentShaderSource(),x,""],[r.GetTilemapFragmentShaderSource(),r.GetDefaultVertexShaderSource(!0),""]];r=await Promise.all(r.map(E=>this.CreateShaderProgram({src:E[0]},E[1],E[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,x,y){r=await f.Gfx.WebGLShaderProgram.Create(this,r,x,y);this._AddShaderProgram(r);return r}ResetLastProgram(){this._lastProgram= null}SetSize(r,x,y){if(this._width!==r||this._height!==x||y){this.EndBatch();y=this._gl;var E=this._batchState;this._width=r;this._height=x;this._SetViewport(0,0,r,x);this.CalculatePerspectiveMatrix(this._bbProjectionMatrix,r/x);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;E.currentFramebuffer= null;E.currentFramebufferNoDepth=null}}_SetDepthBufferSize(r,x){const y=this._gl;this._depthBuffer&&this._depthBufferWidth===r&&this._depthBufferHeight===x||(this._canSampleDepth?(this._depthBuffer&&y.deleteTexture(this._depthBuffer),this._depthBuffer=y.createTexture(),y.bindTexture(y.TEXTURE_2D,this._depthBuffer),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MAG_FILTER,y.NEAREST),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MIN_FILTER,y.NEAREST),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_S,y.CLAMP_TO_EDGE), y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_T,y.CLAMP_TO_EDGE),2<=this.GetWebGLVersionNumber()?y.texImage2D(y.TEXTURE_2D,0,y.DEPTH24_STENCIL8,r,x,0,y.DEPTH_STENCIL,y.UNSIGNED_INT_24_8,null):this._depthTextureExt&&y.texImage2D(y.TEXTURE_2D,0,y.DEPTH_STENCIL,r,x,0,y.DEPTH_STENCIL,this._depthTextureExt.UNSIGNED_INT_24_8_WEBGL,null),y.bindTexture(y.TEXTURE_2D,null)):(this._depthBuffer&&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,x),y.bindRenderbuffer(y.RENDERBUFFER,null)),this._depthBufferWidth=r,this._depthBufferHeight=x)}SetFixedSizeDepthBuffer(r,x){this._usesDepthBuffer&&(this._isAutoSizeDepthBuffer=!1,this._SetDepthBufferSize(r,x))}SetAutoSizeDepthBuffer(){this._usesDepthBuffer&&(this._isAutoSizeDepthBuffer=!0,this._SetDepthBufferSize(this._width,this._height))}_SetViewport(r,x,y,E){const H=this._viewport;if(H[0]!==r||H[1]!==x|| H[2]!==y||H[3]!==E)this.PushBatch().InitSetViewport(r,x,y,E),a.set(H,r,x,y,E),this._topOfBatch=0}SetProjectionMatrix(r){c.exactEquals(this._matP,r)||(this.PushBatch().InitSetProjection(r),c.copy(this._matP,r),this._topOfBatch=0,this._didChangeTransform=!0)}SetDefaultRenderTargetProjectionState(){let r,x;var y=this._currentRenderTarget;null===y?(r=this._bbProjectionMatrix,x=this.GetWidth(),y=this.GetHeight()):(r=y.GetProjectionMatrix(),x=y.GetWidth(),y=y.GetHeight());this.SetProjectionMatrix(r);this._SetViewport(0, 0,x,y)}SetModelViewMatrix(r){c.exactEquals(this._matMV,r)||(this.PushBatch().InitSetModelView(r),c.copy(this._matMV,r),this._topOfBatch=0,this._didChangeTransform=!0)}ResetDidChangeTransformFlag(){this._didChangeTransform=!1}DidChangeTransform(){return this._didChangeTransform}GetBatchState(){return this._batchState}PushBatch(){const r=this._batch;this._batchPtr===r.length&&r.push(new f.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._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,x,y,E,H,A,F,J){this._ExtendQuadBatch();const B=this._vertexData;let I=this._vertexPtr;const L=this._baseZ+this._currentZ;B[I++]=r;B[I++]=x;B[I++]=L;B[I++]=y;B[I++]=E;B[I++]=L;B[I++]=H;B[I++]=A;B[I++]=L;B[I++]=F;B[I++]=J;B[I++]=L;this._vertexPtr=I;h.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad3(r,x){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(r);x.writeAsQuadToTypedArray(this._texcoordData, this._texPtr);this._texPtr+=8}Quad4(r,x){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(r);x.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad3D(r,x,y,E,H,A,F,J,B,I,L,P,S){this._ExtendQuadBatch();const U=this._vertexData;let V=this._vertexPtr;const Z=this._baseZ+this._currentZ;U[V++]=r;U[V++]=x;U[V++]=Z+y;U[V++]=E;U[V++]=H;U[V++]=Z+A;U[V++]=F;U[V++]=J;U[V++]=Z+B;U[V++]=I;U[V++]=L;U[V++]=Z+P;this._vertexPtr=V;S.writeAsQuadToTypedArray(this._texcoordData,this._texPtr);this._texPtr+= 8}Quad3D2(r,x,y,E,H,A,F,J,B,I,L,P,S){this._ExtendQuadBatch();const U=this._vertexData;let V=this._vertexPtr;const Z=this._baseZ+this._currentZ;U[V++]=r;U[V++]=x;U[V++]=Z+y;U[V++]=E;U[V++]=H;U[V++]=Z+A;U[V++]=F;U[V++]=J;U[V++]=Z+B;U[V++]=I;U[V++]=L;U[V++]=Z+P;this._vertexPtr=V;S.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}FullscreenQuad(r,x){c.copy(g,this._matP);c.copy(l,this._matMV);this.SetDefaultRenderTargetProjectionState();const [y,E]=this.GetRenderTargetSize(this._currentRenderTarget); var H=this.CalculateLookAtModelView2(0,0,this.GetDefaultCameraZ()*self.devicePixelRatio,0,0,0,E);this.SetModelViewMatrix(H);if("crop"===r&&this._currentRenderTarget&&x){r=this._width/2;H=this._height/2;const J=x.GetWidth();x=x.GetHeight();var A=this._currentRenderTarget.GetWidth(),F=this._currentRenderTarget.GetHeight();A=Math.min(A,J);const B=Math.min(F,x),I=Math.max(x-F,0);F=Math.max(F-x,0);u.set(-r,H-F,-r+A,H-B-F);m.setFromRect(u);u.set(0,I,A,B+I);u.divide(J,x);this.Quad3(m,u)}else r=y/2,H=E/2, this.Rect2(-r,H,r,-H);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,x,y,E){7996<=this._pointPtr&&this.EndBatch();let H=this._pointPtr;var A=this._baseZ+this._currentZ;2===this._topOfBatch&&this._lastPointZ===A?this._batch[this._batchPtr-1]._indexCount++:(this.PushBatch().InitPoints(H,A),this._topOfBatch= 2,this._lastPointZ=A);A=this._pointData;A[H++]=r;A[H++]=x;A[H++]=y;A[H++]=E;this._pointPtr=H}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,x,y=1){this.PushBatch().InitSetEllipseParams(r,x,y);this._topOfBatch=0}SetTilemapInfo(r, x,y,E,H,A,F){if(this._lastProgram!==this._spTilemapFill)throw Error("must set tilemap fill mode first");this.PushBatch().InitSetTilemapInfo(r,x,y,E,H,A,F);this._topOfBatch=0}SetProgramParameters(r,x,y,E,H,A,F,J,B,I,L,P){const S=this._lastProgram;var U=S._hasAnyOptionalUniforms;const V=!!P.length;if(U&&!S.AreOptionalUniformsAlreadySetInBatch(x,y,E,H,A,F,J,B,I,L)||V&&!S.AreCustomParametersAlreadySetInBatch(P)){var Z=this.PushBatch();Z.InitSetProgramParameters();U&&(S.SetOptionalUniformsInBatch(x,y, E,H,A,F,J,B,I,L),U=Z._mat4param,U[0]=A,U[1]=F,x.writeToTypedArray(U,2),U[6]=B,U[7]=I,y.writeToTypedArray(U,12),x=Z._colorParam,H.writeToTypedArray(x,0),H=x[1],x[1]=x[3],x[3]=H,E.writeToTypedArray(Z._srcOriginRect,0),Z._startIndex=L,Z._indexCount=J,S._uSamplerBack.IsUsed()?Z._texParam=r?r.GetTexture():null:Z._texParam=null);V&&(S.SetCustomParametersInBatch(P),f.shallowAssignArray(Z._shaderParams,P));this._topOfBatch=0}}ClearRgba(r,x,y,E){this.PushBatch().InitClearSurface2(r,x,y,E);this._topOfBatch= 0}Clear(r){this.PushBatch().InitClearSurface(r);this._topOfBatch=0}Start(){}Finish(){super.Finish();this._gl.flush()}ClearDepth(){this._usesDepthBuffer&&this._currentRenderTarget&&this._currentRenderTarget.HasDepthBuffer()&&(this.PushBatch().InitClearDepth(this._isDepthEnabled),this._topOfBatch=0)}SetDepthEnabled(r){r=!!r;this._isDepthEnabled!==r&&this._usesDepthBuffer&&(this._isDepthEnabled=r,this.PushBatch().InitSetDepthEnabled(r),this._topOfBatch=0)}IsDepthEnabled(){return this._isDepthEnabled}_GetDepthBuffer(){return this._depthBuffer}_CanSampleDepth(){return this._canSampleDepth}SetDepthSamplingEnabled(r){r= !!r;if(this._canSampleDepth&&this._isDepthSamplingEnabled!==r){if(r&&this.IsDepthEnabled())throw Error("depth still enabled");this._isDepthSamplingEnabled=r;this.PushBatch().InitSetDepthSamplingEnabled(r);this._topOfBatch=0}}CheckForQueryResults(){for(const r of this._allQueryResultBuffers)r.CheckForResults(this._frameNumber)}IsContextLost(){return!this._gl||this._gl.isContextLost()||this._isInitialisingAfterContextRestored}OnContextLost(){super.OnDeviceOrContextLost();f.Gfx.WebGLRendererTexture.OnContextLost(); f.Gfx.WebGLRenderTarget.OnContextLost();f.Gfx.RendererText.OnContextLost();for(const r of this._allQueryResultBuffers)r.Clear();this._extensions=[];this._depthTextureExt=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,x){if(this.IsContextLost())throw Error("context lost");this.EndBatch();const y=f.New(f.Gfx.WebGLRendererTexture,this);y._CreateStatic(r,x);return y}CreateStaticTextureAsync(r,x){if(this.IsContextLost())return Promise.reject("context lost");x=Object.assign({},x);const y=x.wrapX&&"clamp-to-edge"!==x.wrapX|| x.wrapY&&"clamp-to-edge"!==x.wrapY;if(!f.Supports.ImageBitmapOptions||!this.SupportsNPOTTextures()&&y)return f.Supports.ImageBitmap?createImageBitmap(r).then(E=>f.Asyncify(()=>this.CreateStaticTexture(E,x))):r instanceof Blob?f.BlobToImage(r,!0).then(E=>this.CreateStaticTextureAsync(E,x)):"undefined"!==typeof HTMLImageElement&&r instanceof HTMLImageElement&&"function"===typeof r.decode?r.decode().then(()=>f.Asyncify(()=>this.CreateStaticTexture(r,x))):f.Asyncify(()=>this.CreateStaticTexture(r,x)); x.premultiplyAlpha=!1;return createImageBitmap(r,{premultiplyAlpha:"premultiply"}).then(E=>f.Asyncify(()=>this.CreateStaticTexture(E,x)))}CreateDynamicTexture(r,x,y){this.EndBatch();const E=f.New(f.Gfx.WebGLRendererTexture,this);E._CreateDynamic(r,x,y);return E}UpdateTexture(r,x,y){this.EndBatch();x._Update(r,y)}DeleteTexture(r){r&&(r.SubtractReference(),0=x||0>=y)throw Error("invalid size");this.EndBatch();const H=f.New(f.Gfx.WebGLRenderTarget,this);H._Create(x,y,Object.assign({isDefaultSize:E},r));this._currentRenderTarget= null;this._batchState.currentFramebuffer=null;this._batchState.currentFramebufferNoDepth=null;return H}SetRenderTarget(r,x=!0){r!==this._currentRenderTarget&&(r&&r.IsDefaultSize()&&r._Resize(this._width,this._height),this.PushBatch().InitSetRenderTarget(r),this._currentRenderTarget=r,this._topOfBatch=0,x&&this.SetDefaultRenderTargetProjectionState())}GetRenderTarget(){return this._currentRenderTarget}GetRenderTargetSize(r){return r?[r.GetWidth(),r.GetHeight()]:[this._width,this._height]}CopyRenderTarget(r, x="stretch"){2>this._version||this._currentRenderTarget&&0this._version||(this.PushBatch().InitInvalidateFramebuffer(r._GetFramebuffer()), this._topOfBatch=0)}DeleteRenderTarget(r){this.SetRenderTarget(null);this.EndBatch();const x=r.GetTexture();x===this._lastTexture0&&(this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._lastTexture0=null);x===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,x,y){this.EndBatch();const E=this._currentRenderTarget;if(r){var H= r.GetWidth();var A=r.GetHeight();var F=r._GetFramebuffer()}else H=this.GetWidth(),A=this.GetHeight(),F=null;let J=r=0;var B=H,I=A;y&&(r=f.clamp(Math.floor(y.getLeft()),0,H-1),J=f.clamp(Math.floor(y.getTop()),0,A-1),B=y.width(),B=0===B?H-r:f.clamp(Math.floor(B),0,H-r),I=y.height(),I=0===I?A-J:f.clamp(Math.floor(I),0,A-J),J=A-(J+I));const L=this._gl;L.bindFramebuffer(L.FRAMEBUFFER,F);A=()=>{L.bindFramebuffer(L.FRAMEBUFFER,null);this._currentRenderTarget=null;this._batchState.currentFramebuffer=null; this._batchState.currentFramebufferNoDepth=null;this.SetRenderTarget(E)};if(!x&&2<=this.GetWebGLVersionNumber()){L.bindFramebuffer(L.READ_FRAMEBUFFER,F);F=L.createBuffer();y=B*I*4;H=L.PIXEL_PACK_BUFFER;L.bindBuffer(H,F);L.bufferData(H,y,L.STREAM_READ);L.readPixels(r,J,B,I,L.RGBA,L.UNSIGNED_BYTE,0);L.bindFramebuffer(L.READ_FRAMEBUFFER,null);L.bindBuffer(H,null);A();const P=L.fenceSync(L.SYNC_GPU_COMMANDS_COMPLETE,0);await this._WaitForObjectReady(()=>L.getSyncParameter(P,L.SYNC_STATUS)===L.SIGNALED); L.deleteSync(P);x=new ImageData(B,I);L.bindBuffer(H,F);L.getBufferSubData(H,0,new Uint8Array(x.data.buffer),0,y);L.bindBuffer(H,null);L.deleteBuffer(F)}else x=new ImageData(B,I),L.readPixels(r,J,B,I,L.RGBA,L.UNSIGNED_BYTE,new Uint8Array(x.data.buffer)),A();return x}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 x=new Promise(y=>q.add({resolve:y,checkFunc:r}));-1===t&&(t=self.requestAnimationFrame(p));return x}IsDesynchronized(){return!!this._attribs.desynchronized}GetEstimatedBackBufferMemoryUsage(){return this._width*this._height* (this._attribs.alpha?4:3)}GetEstimatedRenderBufferMemoryUsage(){let r=0;for(const x of f.Gfx.WebGLRenderTarget.allRenderTargets())x.GetTexture()||(r+=x.GetEstimatedMemoryUsage());return r}GetEstimatedTextureMemoryUsage(){let r=0;for(const x of f.Gfx.WebGLRendererTexture.allTextures())r+=x.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 f.New(f.Gfx.RendererText,this)}CreateWebGLText(){return this.CreateRendererText()}}} {"use strict";const f={getDrawSize:null,getRenderTarget:null,releaseRenderTarget:null,getTime:null,redraw:null};self.C3.Gfx.EffectChainManager=class{constructor(b){b=Object.assign({},f,b);this._cbGetDrawSize=b.getDrawSize;this._cbGetRenderTarget=b.getRenderTarget;this._cbReleaseRenderTarget=b.releaseRenderTarget;this._cbGetTime=b.getTime;this._cbRedraw=b.redraw}GetDrawSize(b){return this._cbGetDrawSize?this._cbGetDrawSize(b):[b.GetWidth(),b.GetHeight()]}GetRenderTarget(b){return this._cbGetRenderTarget(b)}ReleaseRenderTarget(b, a){this._cbReleaseRenderTarget(b,a)}GetTime(){return this._cbGetTime()}Redraw(b){this._cbRedraw(b)}}} {"use strict";const f=self.C3,b=self.glMatrix.mat4,a=f.New(f.Rect),c=f.New(f.Rect),d=f.New(f.Rect),e=f.New(f.Rect),h=b.create(),g=b.create(),l={drawContent:null,getSourceTextureInfo:null,getShaderParameters:null,invalidateRenderTargets:!1},m={indexMap:null,forcePreDraw:!1,forcePostDraw:!1,is3D:!1,isSourceTextureRotated:!1,isRotatedOrNegativeSizeInstance:!1,useFullSurface:!1},u={contentObject:null,contextObject:null,blendMode:0,devicePixelRatio:1,layerScale:1,layerAngle:0,layoutRect:null,drawSurfaceRect:null, drawContentHook:null,compositOffX:0,compositOffY:0,updateOwnProjection:!1};f.Gfx.EffectChain=class{constructor(w,q){q=Object.assign({},l,q);this._manager=w;this._cbDrawContent=q.drawContent;this._cbGetSourceTextureInfo=q.getSourceTextureInfo;this._cbGetShaderParameters=q.getShaderParameters;this._cbDrawContentHook=null;this._shaderProgramList=[];this._shaderProgramIndices=[];this._steps=[];this._blendMode=0;this._isSourceTextureRotated=this._useFullSurface=this._canUseFastPath=this._depthEnabledAtStart= this._didChangeTransform=this._isAnyShaderDepthSampling=this._isAnyShaderAnimated=!1;this._numTempSurfacesRequired=0;this._renderTargets=[null,null,null];this._invalidateRenderTargets=!!q.invalidateRenderTargets;this._drawHeight=this._drawWidth=this._boxExtendVertical=this._boxExtendHorizontal=0;this._contextObject=this._contentObject=null;this._layoutRect=f.New(f.Rect);this._drawSurfaceRect=f.New(f.Rect);this._rcTexOriginal=f.New(f.Rect);this._rcTexBounce=f.New(f.Rect);this._rcTexDest=f.New(f.Rect); this._layerScale=this._devicePixelRatio=1;this._time=this._layerAngle=0;this._destRenderTarget=null;this._compositOffY=this._compositOffX=0;this._updateOwnProjection=!1;this._projectionMatrix=b.create();this._modelViewMatrix=b.create()}Release(){f.clearArray(this._steps);f.clearArray(this._shaderProgramList);f.clearArray(this._shaderProgramIndices);this._cbGetShaderParameters=this._cbGetSourceTextureInfo=this._cbDrawContent=this._contextObject=this._contentObject=null}BuildSteps(w,q){q=Object.assign({}, m,q);f.clearArray(this._steps);this._boxExtendVertical=this._boxExtendHorizontal=0;this._isAnyShaderDepthSampling=this._isAnyShaderAnimated=!1;this._numTempSurfacesRequired=0;this._isSourceTextureRotated=!!q.isSourceTextureRotated;this._useFullSurface=!!q.useFullSurface;f.shallowAssignArray(this._shaderProgramList,w);if(0!==w.length){if(q.indexMap){if(q.indexMap.length!==w.length)throw Error("incorrect indexMap length");f.shallowAssignArray(this._shaderProgramIndices,q.indexMap)}else{f.clearArray(this._shaderProgramIndices); for(let r=0,x=w.length;r=q||0>=t)throw Error("invalid draw size"); this._drawWidth===q&&this._drawHeight===t||this._CalculateDeviceTransformMatrices(w,q,t,0,0,this._projectionMatrix,this._modelViewMatrix);this._drawWidth=q;this._drawHeight=t}_CalculateDeviceTransformMatrices(w,q,t,p,r,x,y){p=q/2+p;r=t/2+r;w.CalculatePerspectiveMatrix(x,q/t);w=w.CalculateLookAtModelView2(p,r,w.GetDefaultCameraZ()*self.devicePixelRatio,p,r,0,t);b.copy(y,w)}_CalculateRectangles(w){this._layoutRect.copy(w.layoutRect);w.drawSurfaceRect?this._drawSurfaceRect.copy(w.drawSurfaceRect):this._drawSurfaceRect.set(0, 0,this._drawWidth,this._drawHeight);this._rcTexOriginal.copy(this._drawSurfaceRect);this._rcTexOriginal.divide(this._drawWidth,this._drawHeight);w=w.layerScale*w.devicePixelRatio;this._drawSurfaceRect.inflate(this._boxExtendHorizontal*w,this._boxExtendVertical*w);this._rcTexDest.copy(this._drawSurfaceRect);this._rcTexDest.divide(this._drawWidth,this._drawHeight);this._drawSurfaceRect.clamp(0,0,this._drawWidth,this._drawHeight);this._rcTexBounce.copy(this._drawSurfaceRect);this._rcTexBounce.divide(this._drawWidth, this._drawHeight)}_OnBeforeStartEffectChain(w){this._depthEnabledAtStart=w.IsDepthEnabled();this._useFullSurface&&(w.SetDepthEnabled(!1),this._isAnyShaderDepthSampling&&w.SetDepthSamplingEnabled(!0));w.IsWebGPU()&&!this._useFullSurface&&(a.copy(this._drawSurfaceRect),a.roundOuter(),w.SetScissorRect(a.getLeft(),a.getTop(),a.width(),a.height()))}_OnAfterEffectChainDrawContent(w){w.ResetColor();this._useFullSurface||(w.SetDepthEnabled(!1),this._isAnyShaderDepthSampling&&w.SetDepthSamplingEnabled(!0)); w.IsWebGPU()&&w.SetNormalizedCoordsProgramVariant(!0)}_OnAfterEndEffectChain(w){w.SetDepthSamplingEnabled(!1);w.SetDepthEnabled(this._depthEnabledAtStart);w.IsWebGPU()&&!this._useFullSurface&&w.RemoveScissorRect();w.IsWebGPU()&&w.SetNormalizedCoordsProgramVariant(!1);this._didChangeTransform=w.DidChangeTransform()}_ClampRcTexDest(){this._rcTexDest.clamp(0,0,1,1)}_GetRenderTargetForId(w){return 0>w?null:this._renderTargets[w]}_GetRenderTarget(){return this._manager.GetRenderTarget(this)}_GetDestRenderTarget(){return this._destRenderTarget}_ReleaseRenderTarget(w){this._manager.ReleaseRenderTarget(w, this)}_GetShaderProgramAt(w){return this._shaderProgramList[w]}_DrawContent(w){this._cbDrawContentHook?this._cbDrawContentHook(this,w,()=>this._cbDrawContent(w,this)):this._cbDrawContent(w,this);this._canUseFastPath||this._OnAfterEffectChainDrawContent(w)}_IsRenderTargetSameSizeAndOffset(w){if(this._useFullSurface)return!0;if(0!==this._compositOffX||0!==this._compositOffY)return!1;const [q,t]=w.GetRenderTargetSize(w.GetRenderTarget());return q!==this._drawWidth||t!==this._drawHeight?!1:!0}_SetDeviceTransform(w, q){let t=this._projectionMatrix,p=this._modelViewMatrix;if(q&&!this._IsRenderTargetSameSizeAndOffset(w)){t=h;p=g;const [r,x]=w.GetRenderTargetSize(w.GetRenderTarget());this._CalculateDeviceTransformMatrices(w,r,x,this._compositOffX,this._compositOffY,t,p);w.IsWebGPU()&&!this._useFullSurface&&w.RemoveScissorRect()}w.SetProjectionMatrix(t);w.SetModelViewMatrix(p)}_Redraw(){this._manager.Redraw(this)}_GetShaderParameters(w){return this._cbGetShaderParameters(this._shaderProgramIndices[w])}_SetProgramParameters(w, q){let t=this._rcTexDest,p=this._rcTexBounce,r=this._rcTexOriginal;w.IsWebGL()&&(c.copy(t),c.flipAround(1),t=c,d.copy(p),d.flipAround(1),p=d,e.copy(r),e.flipAround(1),r=e);this._DoSetProgramParameters(w,q,p,r,t,1/this._drawWidth,1/this._drawHeight)}_SetFirstBounceProgramParameters(w,q){let t=this._rcTexBounce,p=this._rcTexOriginal,r=1/this._drawWidth,x=1/this._drawHeight;if(this._cbGetSourceTextureInfo){let {srcTexRect:E,srcWidth:H,srcHeight:A}=this._cbGetSourceTextureInfo(this._contentObject);E|| (a.set(0,0,0,0),E=a);H||(H=this._drawWidth);A||(A=this._drawHeight);p=t=E;r=1/H;x=1/A}else w.IsWebGL()&&(d.copy(t),d.flipAround(1),t=d,e.copy(p),e.flipAround(1),p=e);let y=this._rcTexDest;w.IsWebGL()&&(y=c,y.copy(this._rcTexDest),y.flipAround(1));this._DoSetProgramParameters(w,q,t,p,y,r,x);w.IsWebGPU()&&this._shaderProgramList[0].BlendsBackground()&&w.SetProgramParameter_IsSrcTexRotated(this._isSourceTextureRotated)}_DoSetProgramParameters(w,q,t,p,r,x,y){q=this._GetShaderParameters(q);w.SetProgramParameters(this._destRenderTarget, r,t,p,this._layoutRect,x,y,this._devicePixelRatio,this._layerScale,this._layerAngle,this._time,q)}_Render_FastPath(w,q){var t=this._shaderProgramList[0];const p=w.IsDepthEnabled(),r=t.UsesDepth();r&&(w.SetDepthEnabled(!1),w.SetDepthSamplingEnabled(!0),this._rcTexDest.set(0,0,1,1),this._rcTexOriginal.set(0,0,1,1));w.SetProgram(t);w.SetBlendMode(this._blendMode);w.SetRenderTarget(this._destRenderTarget);let x;this._rcTexOriginal.set(0,0,1,1);if(t.UsesAnySrcRectOrPixelSize()&&this._cbGetSourceTextureInfo){const {srcTexRect:y, srcWidth:E,srcHeight:H}=this._cbGetSourceTextureInfo(this._contentObject);y&&this._rcTexOriginal.copy(y);t=Number.isFinite(E)?1/E:0;x=Number.isFinite(H)?1/H:0}else{const [y,E]=this._manager.GetDrawSize(w);t=1/y;x=1/E}q.layoutRect?this._layoutRect.copy(q.layoutRect):this._layoutRect.set(0,0,0,0);q=this._GetShaderParameters(0);w.SetProgramParameters(null,this._rcTexDest,this._rcTexOriginal,this._rcTexOriginal,this._layoutRect,t,x,this._devicePixelRatio,this._layerScale,this._layerAngle,this._time,q); w.SetBaseZ(0);this._DrawContent(w);r&&(w.SetDepthSamplingEnabled(!1),w.SetDepthEnabled(p))}IsFastPath(){return this._canUseFastPath}UseFullSurface(){return this._useFullSurface}GetContentObject(){return this._contentObject}GetContextObject(){return this._contextObject}_GetBlendMode(){return this._blendMode}_UpdateOwnProjection(){return this._updateOwnProjection}DidChangeTransform(){return this._didChangeTransform}_GetDrawSurfaceRect(){return this._drawSurfaceRect}_GetRcTexBounce(){return this._rcTexBounce}_ShouldInvalidateRenderTargets(){return this._invalidateRenderTargets}async DebugLogRenderTargetContents(w, q,t){}}}"use strict";self.C3.Gfx.EffectChain.Step=class{constructor(f,b,a,c=-1){this._effectChain=f;this._srcTargetId=b;this._destTargetId=a;this._index=c}GetEffectChain(){return this._effectChain}GetSrcTargetId(){return this._srcTargetId}GetDestTargetId(){return this._destTargetId}GetIndex(){return this._index}GetShaderProgram(){return this.GetEffectChain()._GetShaderProgramAt(this.GetIndex())}Run_WebGL(f,b,a){}Run_WebGPU(f,b,a){}}; {"use strict";const f=self.C3;f.Gfx.EffectChain.Step.PreDraw=class extends f.Gfx.EffectChain.Step{constructor(b,a,c,d){super(b,a,c,d)}Run_WebGL(b,a,c){a=this.GetEffectChain();b.SetAlphaBlend();b.SetTextureFillMode();b.SetRenderTarget(c,a._UpdateOwnProjection());b.ClearRgba(0,0,0,0);a._DrawContent(b);a._ClampRcTexDest()}Run_WebGPU(b,a,c){a=this.GetEffectChain();b.SetAlphaBlend();b.SetTextureFillMode();b.SetRenderTarget(c,!1);b.ClearRgba(0,0,0,0);a._DrawContent(b);a._ClampRcTexDest()}}} {"use strict";const f=self.C3,b=f.New(f.Rect),a=f.New(f.Quad);f.Gfx.EffectChain.Step.PostDraw=class extends f.Gfx.EffectChain.Step{constructor(c,d,e,h){super(c,d,e,h)}Run_WebGL(c,d,e){const h=this.GetEffectChain();c.SetTextureFillMode();c.SetRenderTarget(e);h._SetDeviceTransform(c,!0);c.SetBlendMode(h._GetBlendMode());c.SetTexture(d.GetTexture());a.setFromRect(h._GetDrawSurfaceRect());b.copy(h._GetRcTexBounce());b.flipAround(1);c.Quad3(a,b);h._ShouldInvalidateRenderTargets()&&c.InvalidateRenderTarget(d)}Run_WebGPU(c, d,e){const h=this.GetEffectChain();c.SetTextureFillMode();c.SetRenderTarget(e,!1);h._IsRenderTargetSameSizeAndOffset(c)?a.setFromRect(h._GetRcTexBounce()):(c.SetNormalizedCoordsProgramVariant(!1),h._SetDeviceTransform(c,!0),a.setFromRect(h._GetDrawSurfaceRect()));c.SetBackTexture(null);c.SetBlendMode(h._GetBlendMode());c.SetTexture(d.GetTexture());h.UseFullSurface()?c.FullscreenQuad():c.Quad3(a,h._GetRcTexBounce())}}} {"use strict";const f=self.C3;f.Gfx.EffectChain.Step.FirstBounce=class extends f.Gfx.EffectChain.Step{constructor(b,a,c,d){super(b,a,c,d)}Run_WebGL(b,a,c){a=this.GetEffectChain();b.SetRenderTarget(c,a._UpdateOwnProjection());b.ClearRgba(0,0,0,0);b.SetCopyBlend();b.SetProgram(this.GetShaderProgram());a._SetFirstBounceProgramParameters(b,this.GetIndex());a._DrawContent(b);a._ClampRcTexDest()}Run_WebGPU(b,a,c){a=this.GetEffectChain();b.SetRenderTarget(c,!1);b.ClearRgba(0,0,0,0);b.SetCopyBlend();b.SetProgram(this.GetShaderProgram()); a._SetFirstBounceProgramParameters(b,this.GetIndex());a._DrawContent(b);a._ClampRcTexDest()}}} {"use strict";const f=self.C3,b=f.New(f.Rect),a=f.New(f.Quad);f.Gfx.EffectChain.Step.Bounce=class extends f.Gfx.EffectChain.Step{constructor(c,d,e,h){super(c,d,e,h)}Run_WebGL(c,d,e){const h=this.GetEffectChain();c.SetRenderTarget(e);(e=0===this.GetDestTargetId())?c.SetBlendMode(h._GetBlendMode()):(c.ClearRgba(0,0,0,0),c.SetCopyBlend());c.SetProgram(this.GetShaderProgram());h._SetProgramParameters(c,this.GetIndex());c.SetTexture(d.GetTexture());h._SetDeviceTransform(c,e);a.setFromRect(h._GetDrawSurfaceRect()); b.copy(h._GetRcTexBounce());b.flipAround(1);c.Quad3(a,b);h._ShouldInvalidateRenderTargets()&&c.InvalidateRenderTarget(d)}Run_WebGPU(c,d,e){const h=this.GetEffectChain();c.SetRenderTarget(e,!1);0===this.GetDestTargetId()?(c.SetBlendMode(h._GetBlendMode()),c.SetBackTexture(null),h._IsRenderTargetSameSizeAndOffset(c)?a.setFromRect(h._GetRcTexBounce()):(c.SetNormalizedCoordsProgramVariant(!1),h._SetDeviceTransform(c,!0),a.setFromRect(h._GetDrawSurfaceRect()))):(c.ClearRgba(0,0,0,0),c.SetCopyBlend(),a.setFromRect(h._GetRcTexBounce())); c.SetProgram(this.GetShaderProgram());h._SetProgramParameters(c,this.GetIndex());c.SetTexture(d.GetTexture());h.UseFullSurface()?c.FullscreenQuad():c.Quad3(a,h._GetRcTexBounce())}}} {"use strict";const f=self.C3,b=self.C3X;let a=null;const c=new Set;function d(l,m){const u=l[0]-m[0];return 0!==u?u:l[1]-m[1]}const e=[],h=[];let g=!1;self.IRuntime=class{constructor(l,m){a=l;Object.defineProperties(this,{assets:{value:a.GetAssetManager().GetIAssetManager(),writable:!1},objects:{value:m,writable:!1},globalVars:{value:{},writable:!1},projectName:{value:a.GetProjectName(),writable:!1},projectVersion:{value:a.GetProjectVersion(),writable:!1},storage:{value:new self.IStorage(a),writable:!1}, isInWorker:{value:a.IsInWorker(),writable:!1}});a.UserScriptDispatcher().addEventListener("keydown",u=>{c.has(u.key)?u.stopPropagation():c.add(u.key)});a.UserScriptDispatcher().addEventListener("keyup",u=>c.delete(u.key));a.Dispatcher().addEventListener("window-blur",()=>c.clear());a.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){a.UserScriptDispatcher().addEventListener(l,m)}removeEventListener(l,m){a.UserScriptDispatcher().removeEventListener(l,m)}callFunction(l,...m){b.RequireString(l);const u=a.GetEventSheetManager(),w=u.GetFunctionBlockByName(l);if(!w)throw Error(`cannot find function name '${l}'`);if(!w.IsEnabled())return w.GetDefaultReturnValue();if(m.lengthl.GetILayout())}goToLayout(l){const m=a.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=a._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=a._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=a._GetCommonScriptInterfaces().touch;if(!l)throw Error("runtime.touch used but Touch object missing - add it to your project first");return l}invokeDownload(l,m){b.RequireString(l);b.RequireString(m);a.InvokeDownload(l,m)}getInstanceByUid(l){b.RequireFiniteNumber(l);return(l=a.GetInstanceByUID(l))?l.GetInterfaceClass(): null}sortZOrder(l,m){b.RequireFunction(m);const u=a.GetCurrentLayout();for(var w of l){l=a._UnwrapIWorldInstance(w);var q=l.GetWorldInfo();e.push([q.GetLayer().GetIndex(),q.GetZIndex()]);h.push(l)}if(0!==e.length){e.sort(d);h.sort((t,p)=>m(t.GetInterfaceClass(),p.GetInterfaceClass()));w=!1;for(let t=0,p=e.length;t a.GetInterfaceClass())}getFirstInstance(){const a=b.get(this).GetInstances();return 0a.GetInterfaceClass())}getFirstPickedInstance(){const a=b.get(this).GetCurrentSol().GetInstances();return 0a.GetILayer())}setVanishingPoint(a,c){f.RequireFiniteNumber(a);f.RequireFiniteNumber(c);b.get(this).SetVanishingPointXY(a, c)}getVanishingPoint(){return b.get(this)._GetVanishingPoint()}set projection(a){f.RequireString(a);const c=b.get(this);if("perspective"===a)c.SetPerspectiveProjection();else if("orthographic"===a)c.SetOrthographicProjection();else throw Error("invalid projection");}get projection(){return b.get(this).IsOrthographicProjection()?"orthographic":"perspective"}}} {"use strict";const f=self.C3,b=self.C3X,a=new WeakMap,c=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]]),d=new Map([...c.entries()].map(h=>[h[1],h[0]])),e=f.New(f.Color);self.ILayer=class{constructor(h){a.set(this,h);const g=[],l=h.GetEffectList(),m=l.GetAllEffectTypes().length;for(let u=0;uh.length)throw Error("expected 3 elements");e.setRgb(h[0],h[1],h[2]);h=a.get(this);const g=h.GetBackgroundColor();g.equalsIgnoringAlpha(e)||(g.copyRgb(e),h.GetRuntime().UpdateRender())}get backgroundColor(){const h=a.get(this).GetBackgroundColor();return[h.getR(),h.getG(),h.getB()]}set scrollX(h){b.RequireNumber(h); const g=a.get(this);g.SetOwnScrollPositionEnabled(!0);g.SetScrollX(h)}get scrollX(){return a.get(this).GetScrollX()}set scrollY(h){b.RequireNumber(h);const g=a.get(this);g.SetOwnScrollPositionEnabled(!0);g.SetScrollY(h)}get scrollY(){return a.get(this).GetScrollY()}scrollTo(h,g){b.RequireNumber(h);b.RequireNumber(g);const l=a.get(this);l.SetOwnScrollPositionEnabled(!0);l.SetScrollX(h);l.SetScrollY(g)}restoreScrollPosition(){a.get(this).SetOwnScrollPositionEnabled(!1)}getViewport(){return a.get(this).GetViewport().toDOMRect()}cssPxToLayer(h, g,l=0){b.RequireNumber(h);b.RequireNumber(g);b.RequireNumber(l);const m=a.get(this),u=m.GetRuntime();return m.CanvasCssToLayer(h-u.GetCanvasClientX(),g-u.GetCanvasClientY(),l)}layerToCssPx(h,g,l=0){b.RequireNumber(h);b.RequireNumber(g);b.RequireNumber(l);const m=a.get(this),u=m.GetRuntime(),[w,q]=m.LayerToCanvasCss(h,g,l);return[w+u.GetCanvasClientX(),q+u.GetCanvasClientY()]}}} {"use strict";const f=self.C3,b=self.C3X,a=new WeakMap,c=new WeakMap;function d(h){let g=c.get(h);if(g)return g;g=f.New(f.Event.Dispatcher);c.set(h,g);return g}let e=null;self.IInstance=class{constructor(){a.set(this,e);const h={runtime:{value:e.GetRuntime().GetIRuntime(),writable:!1},objectType:{value:e.GetObjectClass().GetIObjectClass(),writable:!1},uid:{value:e.GetUID(),writable:!1}};e._GetInstVarsScriptDescriptor(h);e._GetBehaviorsScriptDescriptor(h);Object.defineProperties(this,h);e.GetRuntime()._MapScriptInterface(this, e)}static _Init(h){e=h}static _GetInitInst(){return e}_Release(){const h=c.get(this);h&&(h.Release(),c.delete(this));a.delete(this)}addEventListener(h,g,l){b.RequireString(h);b.RequireFunction(g);d(this).addEventListener(h,g,l)}removeEventListener(h,g,l){b.RequireString(h);b.RequireFunction(g);d(this).removeEventListener(h,g,l)}dispatchEvent(h){d(this).dispatchEvent(h)}destroy(){const h=a.get(this);h.GetRuntime().DestroyInstance(h)}}} {"use strict";const f=self.C3,b=self.C3X,a=self.IInstance,c=self.ILayer,d=new WeakMap,e=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([...e.entries()].map(l=>[l[1],l[0]])),g=f.New(f.Color);self.IWorldInstance=class l extends a{constructor(){super();var m=a._GetInitInst();d.set(this,m);const u=[];var w=m.GetWorldInfo();if(m=w.GetInstanceEffectList()){w= w.GetObjectClass().GetEffectList().GetAllEffectTypes().length;for(let q=0;qm.length)throw Error("expected 3 elements");g.setRgb(m[0],m[1],m[2]);m=d.get(this);const u=m.GetWorldInfo();u.GetUnpremultipliedColor().equalsIgnoringAlpha(g)|| (u.SetUnpremultipliedColor(g),m.GetRuntime().UpdateRender())}get colorRgb(){const m=d.get(this).GetWorldInfo().GetUnpremultipliedColor();return[m.getR(),m.getG(),m.getB()]}set blendMode(m){b.RequireString(m);m=e.get(m);if("number"!==typeof m)throw Error("invalid blend mode");const u=d.get(this);u.GetWorldInfo().SetBlendMode(m);u.GetRuntime().UpdateRender()}get blendMode(){return h.get(d.get(this).GetWorldInfo().GetBlendMode())}moveToTop(){d.get(this).GetWorldInfo().ZOrderMoveToTop()}moveToBottom(){d.get(this).GetWorldInfo().ZOrderMoveToBottom()}moveToLayer(m){b.RequireInstanceOf(m, c);m=c._Unwrap(m);if(!m)throw Error("invalid layer");d.get(this).GetWorldInfo().ZOrderMoveToLayer(m)}moveAdjacentToInstance(m,u){b.RequireInstanceOf(m,l);d.get(this).GetWorldInfo().ZOrderMoveAdjacentToInstance(d.get(m),u)}get zIndex(){return d.get(this).GetWorldInfo().GetZIndex()}containsPoint(m,u){b.RequireNumber(m);b.RequireNumber(u);return d.get(this).GetWorldInfo().ContainsPoint(+m,+u)}testOverlap(m){b.RequireInstanceOf(m,l);const u=d.get(this);m=d.get(m);return u.GetRuntime().GetCollisionEngine().TestOverlap(u, m)}testOverlapSolid(){var m=d.get(this);return(m=m.GetRuntime().GetCollisionEngine().TestOverlapSolid(m))?m.GetInterfaceClass():null}getParent(){const m=d.get(this).GetParent();return m?m.GetInterfaceClass():null}getTopParent(){const m=d.get(this).GetTopParent();return m?m.GetInterfaceClass():null}*parents(){for(const m of d.get(this).parents())yield m.GetInterfaceClass()}getChildCount(){return d.get(this).GetChildCount()}getChildAt(m){return(m=d.get(this).GetChildAt(m))?m.GetInterfaceClass():null}*children(){for(const m of d.get(this).children())yield m.GetInterfaceClass()}*allChildren(){for(const m of d.get(this).allChildren())yield m.GetInterfaceClass()}addChild(m, u){b.RequireInstanceOf(m,l);b.RequireOptionalObject(u);u||(u={});const w=d.get(this);m=d.get(m);w.AddChild(m,u)}removeChild(m){b.RequireInstanceOf(m,l);const u=d.get(this);m=d.get(m);u.RemoveChild(m)}removeFromParent(){const m=d.get(this);m.HasParent()&&m.GetParent().RemoveChild(m)}createMesh(m,u){b.RequireFiniteNumber(m);b.RequireFiniteNumber(u);d.get(this).GetWorldInfo().CreateMesh(m,u)}releaseMesh(){const m=d.get(this).GetWorldInfo();m.ReleaseMesh();m.SetBboxChanged()}setMeshPoint(m,u,w){b.RequireFiniteNumber(m); b.RequireFiniteNumber(u);b.RequireObject(w);const q=d.get(this).GetWorldInfo();q.SetMeshPoint(m,u,w)&&q.SetBboxChanged()}getMeshSize(){var m=d.get(this).GetWorldInfo();if(!m.HasMesh())return[0,0];m=m.GetSourceMesh();return[m.GetHSize(),m.GetVSize()]}}} {"use strict";const f=self.C3X,b=new WeakMap;self.IDOMInstance=class extends self.IWorldInstance{constructor(){super();b.set(this,self.IInstance._GetInitInst())}getElement(){return b.get(this).GetSdkInstance()._GetElementInDOMMode()}focus(){b.get(this).GetSdkInstance().FocusElement()}blur(){b.get(this).GetSdkInstance().BlurElement()}setCssStyle(a,c){f.RequireString(a);b.get(this).GetSdkInstance().SetElementCSSStyle(a,c)}}} {"use strict";const f=self.C3,b=self.C3X,a=new WeakMap,c=new WeakMap;function d(h){let g=c.get(h);if(g)return g;g=f.New(f.Event.Dispatcher);c.set(h,g);return g}let e=null;self.IBehaviorInstance=class{constructor(){a.set(this,e);const h={runtime:{value:e.GetRuntime().GetIRuntime(),writable:!1},behavior:{value:e.GetBehavior().GetIBehavior(),writable:!1}};Object.defineProperties(this,h)}static _Init(h){e=h}static _GetInitInst(){return e}get instance(){return a.get(this).GetObjectInstance().GetInterfaceClass()}_Release(){const h= c.get(this);h&&(h.Release(),c.delete(this));a.delete(this)}addEventListener(h,g,l){b.RequireString(h);b.RequireFunction(g);d(this).addEventListener(h,g,l)}removeEventListener(h,g,l){b.RequireString(h);b.RequireFunction(g);d(this).removeEventListener(h,g,l)}dispatchEvent(h){d(this).dispatchEvent(h)}}} {"use strict";const f=new WeakMap;self.IBehavior=class{constructor(b){f.set(this,b);b={runtime:{value:b.GetRuntime().GetIRuntime(),writable:!1}};Object.defineProperties(this,b)}getAllInstances(){return f.get(this).GetInstances().map(b=>b.GetInterfaceClass())}}} {"use strict";const f=self.C3,b=self.C3X,a=new WeakMap;self.IEffectInstance=class{constructor(c,d){a.set(this,c);Object.defineProperties(this,{index:{value:d,writable:!1}})}get name(){return a.get(this).GetAllEffectTypes()[this.index].GetName()}get isActive(){return a.get(this).IsEffectIndexActive(this.index)}set isActive(c){c=!!c;const d=a.get(this);d.IsEffectIndexActive(this.index)!==c&&(d.SetEffectIndexActive(this.index,c),d.UpdateActiveEffects(),d.GetRuntime().UpdateRender())}setParameter(c,d){b.RequireFiniteNumber(c); c=Math.floor(+c);const e=a.get(this);var h=e.GetEffectParametersForIndex(this.index);if(0>c||c>=h.length)throw new RangeError("invalid effect parameter index");const g=h[c];if(g instanceof f.Color){if(!Array.isArray(d)||3>d.length)throw new TypeError("expected array with 3 elements");c=d[0];h=d[1];d=d[2];if(g.equalsRgb(c,h,d))return;g.setRgb(c,h,d)}else{if("number"!==typeof d)throw new TypeError("expected number");if(g===d)return;h[c]=d}e.IsEffectIndexActive(this.index)&&e.GetRuntime().UpdateRender()}getParameter(c){b.RequireFiniteNumber(c); c=Math.floor(+c);const d=a.get(this).GetEffectParametersForIndex(this.index);if(0>c||c>=d.length)throw new RangeError("invalid effect parameter index");c=d[c];return c instanceof f.Color?[c.getR(),c.getG(),c.getB()]:c}}} {"use strict";const f=self.C3,b=new Set(["local","remote"]),a=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 c(e){if(!e)return"";e=e.split(".");if(2>e.length)return"";e=e.at(-1).toLowerCase();return a.get(e)||""}function d(e){return new Promise((h,g)=>{const l=document.createElement("script");l.onload=h;l.onerror=g;l.async=!1;l.type="module"; l.src=e;document.head.appendChild(l)})}f.AssetManager=class extends f.DefendedBase{constructor(e,h){super();var g=h.exportType;this._runtime=e;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=f.New(f.RateLimiter,()=>this._FireLoadingProgressEvent(),50);this._promiseThrottle=new f.PromiseThrottle(Math.max(f.hardwareConcurrency,8)); if(e=h.previewImageBlobs){(g=h.previewProjectFileBlobs)&&Object.assign(e,g);(g=h.projectData)&&(e["data.json"]=g);for(const [l,m]of Object.entries(e))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 e of this._localBlobUrlCache.values())e.startsWith("blob:")&&URL.revokeObjectURL(e);this._localBlobUrlCache.clear(); for(const e of this._allAssets)e.Release();f.clearArray(this._allAssets);this._assetsByUrl.clear();f.clearArray(this._loadPromises);this._runtime=null}GetRuntime(){return this._runtime}_SetMediaSubfolder(e){this._mediaSubfolder=e}GetMediaSubfolder(){return this._mediaSubfolder}_SetFontsSubfolder(e){this._fontsSubfolder=e}GetFontsSubfolder(){return this._fontsSubfolder}_SetIconsSubfolder(e){this._iconsSubfolder=e}GetIconsSubfolder(){return this._iconsSubfolder}IsFileProtocol(){return this._isFileProtocol}_HasLocalUrlBlob(e){return this._localUrlBlobs.has(e.toLowerCase())}_GetLocalUrlBlob(e){return this._localUrlBlobs.get(e.toLowerCase())|| null}GetLocalUrlAsBlobUrl(e){if(!this._HasLocalUrlBlob(e))return e;e=e.toLowerCase();var h=this._localBlobUrlCache.get(e);h||(h=this._GetLocalUrlBlob(e),h=URL.createObjectURL(h),this._localBlobUrlCache.set(e,h));return h}FetchBlob(e,h){h=h||this._defaultLoadPolicy;const g=this._GetLocalUrlBlob(e);if(g)return Promise.resolve(g);if(f.IsRelativeURL(e)){const l=e.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsBlob(l):"local"===h?this._promiseThrottle.Add(()=>f.FetchBlob(l)): f.FetchBlob(l)}return f.FetchBlob(e)}FetchArrayBuffer(e){const h=this._GetLocalUrlBlob(e);if(h)return f.BlobToArrayBuffer(h);if(f.IsRelativeURL(e)){const g=e.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsArrayBuffer(g):"local"===this._defaultLoadPolicy?this._promiseThrottle.Add(()=>f.FetchArrayBuffer(g)):f.FetchArrayBuffer(g)}return f.FetchArrayBuffer(e)}FetchText(e){const h=this._GetLocalUrlBlob(e);if(h)return f.BlobToString(h);if(f.IsRelativeURL(e)){const g= e.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsText(g):"local"===this._defaultLoadPolicy?this._promiseThrottle.Add(()=>f.FetchText(g)):f.FetchText(g)}return f.FetchText(e)}async FetchJson(e){e=await this.FetchText(e);return JSON.parse(e)}_CordovaFetchLocalFileAs(e,h){return this._runtime.PostComponentMessageToDOMAsync("runtime","cordova-fetch-local-file",{filename:e,as:h})}CordovaFetchLocalFileAsText(e){return this._CordovaFetchLocalFileAs(e,"text")}async CordovaFetchLocalFileAsBlob(e){const h= await this._CordovaFetchLocalFileAs(e,"buffer");e=c(e);return new Blob([h],{type:e})}async CordovaFetchLocalFileAsBlobURL(e){e=e.toLowerCase();var h=this._localBlobUrlCache.get(e);if(h)return h;h=await this.CordovaFetchLocalFileAsBlob(e);h=URL.createObjectURL(h);this._localBlobUrlCache.set(e,h);return h}CordovaFetchLocalFileAsArrayBuffer(e){return this._CordovaFetchLocalFileAs(e,"buffer")}GetMediaFileUrl(e){return this._HasLocalUrlBlob(e)?this.GetLocalUrlAsBlobUrl(e):this._mediaSubfolder+e.toLowerCase()}GetProjectFileUrl(e, h=""){if(f.IsAbsoluteURL(e)){if(h)throw Error("cannot specify subfolder with remote URL");return Promise.resolve(e)}return this._HasLocalUrlBlob(e)?Promise.resolve(this.GetLocalUrlAsBlobUrl(e)):this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsBlobURL(h+e):Promise.resolve(h+e.toLowerCase())}GetProjectFileIframeUrl(e){if(f.IsAbsoluteURL(e))return Promise.resolve(e);var h=e.indexOf("?"),g=-1===h?"":e.substr(h);h=-1===h?e:e.substr(0,h);return this._HasLocalUrlBlob(h)?(e=this._localBlobSWUrls.get(h)|| this.GetLocalUrlAsBlobUrl(h),!e.startsWith("blob:")&&this._swClientId&&(e=new URL(e),g=new URLSearchParams(g),g.set("__c3_client_id",this._swClientId),e.search=g.toString(),e=e.toString()),Promise.resolve(e)):this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsBlobURL(h):Promise.resolve(e.toLowerCase())}LoadProjectFileUrl(e){return this.GetProjectFileUrl(e)}LoadImage(e){if(e.loadPolicy&&!b.has(e.loadPolicy))throw Error("invalid load policy");let h=this._assetsByUrl.get(e.url);if(h)return h; h=f.New(f.ImageAsset,this,{url:e.url,size:e.size||0,loadPolicy:e.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(e){console.error("Error loading: ",e),this._hasHadErrorLoading=!0,this._FireLoadingProgressEvent()}}SetInitialLoadFinished(){this._hasFinishedInitialLoad= !0}HasHadErrorLoading(){return this._hasHadErrorLoading}_AddLoadedSize(e){this._assetSizeLoaded+=e;this._loadingRateLimiter.Call()}_FireLoadingProgressEvent(){const e=f.New(f.Event,"loadingprogress");this._lastLoadProgress=f.clamp(this._assetSizeLoaded/this._totalAssetSizeToLoad,0,1);e.progress=this._lastLoadProgress;this._runtime.Dispatcher().dispatchEvent(e)}GetLoadProgress(){return this._lastLoadProgress}_SetWebFonts(e){f.shallowAssignArray(this._webFonts,e);this._webFonts.length&&this._loadPromises.push(this._LoadWebFonts())}_LoadWebFonts(){if("undefined"=== typeof FontFace)return Promise.resolve();const e=[];for(const [h,g,l]of this._webFonts)this._totalAssetSizeToLoad+=l,e.push(this._LoadWebFont(h,g).then(()=>this._AddLoadedSize(l)));return Promise.all(e)}async _LoadWebFont(e,h){try{const g=await this.GetProjectFileUrl(h,this._fontsSubfolder),l=new FontFace(e,`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 '${e}': `,g)}}IsAudioFormatSupported(e){return!!this._supportedAudioFormats[e]}_SetAudioFiles(e, h){this._preloadSounds=!!h;for(const [g,l,m]of e)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(e){e=this._audioFiles.get(e.toLowerCase());if(!e)return null;let h=null;for(const g of e.formats)if(h||"audio/webm; codecs=opus"!==g.type||(h=g),this.IsAudioFormatSupported(g.type))return g;return h}GetProjectAudioFileUrl(e){return(e=this.GetPreferredAudioFile(e))?{url:this.GetMediaFileUrl(e.fullName), type:e.type}:null}GetAudioToPreload(){if(this._preloadSounds){const e=[];for(const h of this._audioFiles.values()){if(h.isMusic)continue;const g=this.GetPreferredAudioFile(h.fileName);g&&e.push({originalUrl:h.fileName,url:this.GetMediaFileUrl(g.fullName),type:g.type,fileSize:g.fileSize})}return e}return[]}GetIAssetManager(){return this._iAssetManager}async LoadScripts(...e){const h=await Promise.all(e.map(g=>this.GetProjectFileUrl(g)));this._runtime.IsInWorker()?1===e.length?(e=e[0],await self.c3_import((f.IsRelativeURL(e)? "./":"")+e)):(e=e.map(g=>`import "${f.IsRelativeURL(g)?"./":""}${g}";`).join("\n"),e=URL.createObjectURL(new Blob([e],{type:"application/javascript"})),await self.c3_import(e)):await Promise.all(h.map(g=>d(g)))}async CompileWebAssembly(e){if(WebAssembly.compileStreaming)return e=await this.GetProjectFileUrl(e),await WebAssembly.compileStreaming(fetch(e));e=await f.FetchArrayBuffer(e);return await WebAssembly.compile(e)}async LoadStyleSheet(e){e=await this.GetProjectFileUrl(e);return await this._runtime.PostComponentMessageToDOMAsync("runtime", "add-stylesheet",{url:e})}}} {"use strict";const f=self.C3;f.Asset=class extends f.DefendedBase{constructor(b,a){super();this._assetManager=b;this._runtime=b.GetRuntime();this._url=a.url;this._size=a.size;this._loadPolicy=a.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(b=>{this._isLoaded=!0;this._loadPromise=null;return this._blob=b}).catch(b=>console.error("Error loading resource: ",b))}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 f=self.C3,b=new f.PromiseThrottle,a=new Set;f.ImageAsset=class extends f.Asset{constructor(c,d){super(c,d);this._webglTexture=this._texturePromise=null;this._refCount=0;this._imageHeight=this._imageWidth=-1;a.add(this)}Release(){this.ReleaseTexture();if(0!==this._refCount)throw Error("released image asset which still has texture references");this._texturePromise=null;a.delete(this);super.Release()}static OnWebGLContextLost(){for(const c of a)c._texturePromise=null,c._webglTexture= null,c._refCount=0}LoadStaticTexture(c,d){d=d||{};this._refCount++;if(this._webglTexture)return Promise.resolve(this._webglTexture);if(this._texturePromise)return this._texturePromise;d.anisotropy=this._runtime.GetCanvasManager().GetTextureAnisotropy();return this._texturePromise=this.GetBlob().then(e=>b.Add(()=>c.CreateStaticTextureAsync(e,d).then(h=>{this._texturePromise=null;if(0===this._refCount)return c.DeleteTexture(h),null;this._webglTexture=h;this._imageWidth=h.GetWidth();this._imageHeight= h.GetHeight();return this._webglTexture}))).catch(e=>{console.error("Failed to load texture: ",e);throw e;})}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 c=await this.GetBlob(); return f.Supports.ImageBitmapOptions?await createImageBitmap(c,{premultiplyAlpha:"none"}):f.Supports.ImageBitmap?await createImageBitmap(c):await f.BlobToImage(c)}}} {"use strict";const f=self.C3;function b(a,c){return a.GetWorldInfo()._GetLastCachedZIndex()-c.GetWorldInfo()._GetLastCachedZIndex()}f.RenderCell=class extends f.DefendedBase{constructor(a,c,d){super();this._grid=a;this._x=c;this._y=d;this._instances=[];this._isSorted=!0;this._pendingRemoval=new Set;this._isAnyPendingRemoval=!1}Release(){f.clearArray(this._instances);this._pendingRemoval.clear();this._grid=null}Reset(){f.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(a){this._pendingRemoval.has(a)?(this._pendingRemoval.delete(a),0===this._pendingRemoval.size&&(this._isAnyPendingRemoval=!1)):(this._instances.push(a),this._isSorted=1===this._instances.length)}Remove(a){this._pendingRemoval.add(a);this._isAnyPendingRemoval=!0;50<=this._pendingRemoval.size&&this._FlushPending()}_FlushPending(){this._isAnyPendingRemoval&& (this._instances.length===this._pendingRemoval.size?this.Reset():(f.arrayRemoveAllInSet(this._instances,this._pendingRemoval),this._pendingRemoval.clear(),this._isAnyPendingRemoval=!1))}_EnsureSorted(){this._isSorted||(this._instances.sort(b),this._isSorted=!0)}Dump(a){this._FlushPending();this._EnsureSorted();this._instances.length&&a.push(this._instances)}}} {"use strict";const f=self.C3;f.RenderGrid=class extends f.DefendedBase{constructor(b,a){super();this._cellWidth=b;this._cellHeight=a;this._cells=f.New(f.PairMap)}Release(){this._cells.Release();this._cells=null}GetCell(b,a,c){let d=this._cells.Get(b,a);return d?d:c?(d=f.New(f.RenderCell,this,b,a),this._cells.Set(b,a,d),d):null}XToCell(b){return Math.floor(b/this._cellWidth)}YToCell(b){return Math.floor(b/this._cellHeight)}Update(b,a,c){if(a)for(let d=a.getLeft(),e=a.getRight();d<=e;++d)for(let h= a.getTop(),g=a.getBottom();h<=g;++h){if(c&&c.containsPoint(d,h))continue;const l=this.GetCell(d,h,!1);l&&(l.Remove(b),l.IsEmpty()&&this._cells.Delete(d,h))}if(c)for(let d=c.getLeft(),e=c.getRight();d<=e;++d)for(let h=c.getTop(),g=c.getBottom();h<=g;++h)a&&a.containsPoint(d,h)||this.GetCell(d,h,!0).Insert(b)}QueryRange(b,a){let c=this.XToCell(b.getLeft());const d=this.YToCell(b.getTop()),e=this.XToCell(b.getRight());for(b=this.YToCell(b.getBottom());c<=e;++c)for(let h=d;h<=b;++h){const g=this.GetCell(c, h,!1);g&&g.Dump(a)}}MarkRangeChanged(b){let a=b.getLeft();const c=b.getTop(),d=b.getRight();for(b=b.getBottom();a<=d;++a)for(let e=c;e<=b;++e){const h=this.GetCell(a,e,!1);h&&h.SetChanged()}}}} {"use strict";const f=self.C3,b=new f.Rect,a=new f.Quad,c=[];new f.Rect;new f.Rect;const d=self.glMatrix,e=d.vec3,h=d.vec4,g=d.mat4,l=g.create(),m=e.create(),u=h.create(),w=e.create(),q=e.create(),t=e.create(),p=f.New(f.Vector2);f.New(f.Rect);function r(A,F){return A.GetWorldInfo()._GetLastCachedZIndex()-F.GetWorldInfo()._GetLastCachedZIndex()}function x(A,F){return A.GetWorldInfo().GetZElevation()-F.GetWorldInfo().GetZElevation()}const y=[],E=[],H=[];f.Layer=class extends f.DefendedBase{constructor(A, F,J){super();this._layout=A;this._runtime=A.GetRuntime();this._parentLayer=F;this._name=J[0];this._index=-1;this._sid=J[2];this._isVisible=!!J[3];this._backgroundColor=f.New(f.Color);this._backgroundColor.setFromJSON(J[4].map(I=>I/255));this._isTransparent=!!J[5];this._parallaxX=J[6];this._parallaxY=J[7];this._color=f.New(f.Color,1,1,1,J[8]);this._premultipliedColor=f.New(f.Color);this._isForceOwnTexture=J[9];this._renderAs3d=J[17];this._useCameraDistanceDrawOrder=J[18];this._useRenderCells=J[10]; this._scaleRate=J[11];this._blendMode=J[12];this._curRenderTarget=null;this._scale=1;this._zElevation=J[16];this._scrollY=this._scrollX=this._angle=0;this._hasOwnScrollPosition=!1;this._viewport=f.New(f.Rect);this._viewportZ0=f.New(f.Rect);this._viewport3D=f.New(f.Rect);this._projectionMatrix=g.create();this._isProjectionMatrixChanged=!0;this._modelViewMatrix=g.create();this._isMVMatrixChanged=!0;this._viewFrustum=f.New(f.Gfx.ViewFrustum);this._isViewFrustumChanged=!0;this._startupInitialInstances= [];this._initialInstancesData=J[14];this._initialInstances=[];this._createdGlobalUids=[];this._initialUIDsToInstanceData=new Map;this._instances=[];this._anyInstanceZElevated=this._zIndicesUpToDate=!1;const B=this._runtime.GetCanvasManager();this._effectList=f.New(f.EffectList,this,J[15]);this._effectChain=f.New(f.Gfx.EffectChain,B.GetEffectChainManager(),{drawContent:(I,L)=>{L=L.GetContentObject();const P=L.GetRenderTarget();I.SetColor(L.GetPremultipliedColor());I.DrawRenderTarget(P);I.InvalidateRenderTarget(P); B.ReleaseAdditionalRenderTarget(P)},getShaderParameters:I=>this.GetEffectList().GetEffectParametersForIndex(I)});this._wasDefaultColor=this._needsRebuildEffectChainSteps=!0;this._renderGrid=null;this._lastRenderList=[];this._isRenderListUpToDate=!1;this._lastRenderCells=f.New(f.Rect,0,0,-1,-1);this._curRenderCells=f.New(f.Rect,0,0,-1,-1);this._iLayer=new self.ILayer(this);this._UpdatePremultipliedColor();this.UsesRenderCells()&&(this._renderGrid=f.New(f.RenderGrid,this._runtime.GetOriginalViewportWidth(), this._runtime.GetOriginalViewportHeight()));this._subLayers=J[19].map(I=>f.New(f.Layer,this._layout,this,I))}_Init(){for(const A of this._initialInstancesData){const F=this._runtime.GetObjectClassByIndex(A[1]);this._layout._AddInitialObjectClass(F);F.GetDefaultInstanceData()||(F.SetDefaultInstanceData(A),F._SetDefaultLayerIndex(this._index));this._initialInstances.push(A);this._initialUIDsToInstanceData.set(A[2],A)}f.shallowAssignArray(this._startupInitialInstances,this._initialInstances);this._initialInstancesData= null}Release(){this._runtime=this._layout=null}GetInitialInstanceData(A){return this._initialUIDsToInstanceData.get(A)}CreateInitialInstances(A){const F=this._layout.IsFirstVisit();let J=0;const B=this._initialInstances;for(let L=0,P=B.length;LJ||(F&&this.UsesRenderCells()&&A.GetWorldInfo()._RemoveFromRenderCells(),this._instances.splice(J,1),this.SetZIndicesChanged(),this._MaybeResetAnyInstanceZElevatedFlag())}_SetAnyInstanceZElevated(){this._anyInstanceZElevated= !0}_MaybeResetAnyInstanceZElevatedFlag(){0===this._instances.length&&(this._anyInstanceZElevated=!1)}_SortInstancesByLastCachedZIndex(A){if(A){A=new Set;for(var F of this._instances){var J=F.GetWorldInfo()._GetLastCachedZIndex();0<=J&&A.add(J)}F=-1;for(const B of this._instances)if(J=B.GetWorldInfo(),!(0<=J._GetLastCachedZIndex())){for(++F;A.has(F);)++F;J._SetZIndex(F)}}this._instances.sort(r)}_Start(){}_End(){for(const A of this._instances)A.GetObjectClass().IsGlobal()||this._runtime.DestroyInstance(A); this._runtime.FlushPendingInstances();f.clearArray(this._instances);this._anyInstanceZElevated=!1;this.SetZIndicesChanged()}RecreateInitialObjects(A,F,J,B,I){const L=this._runtime.GetEventSheetManager(),P=this._runtime.GetAllObjectClasses(),S=A.IsFamily(),U=[];for(const ma of this._initialInstances){var V=ma[0];if(F.containsPoint(V[0],V[1])){V=P[ma[1]];if(V!==A)if(S){if(!A.FamilyHasMember(V))continue}else continue;V=this;var Z=this._runtime.GetCurrentLayout();this.GetLayout()!==Z&&((V=Z.GetLayerByName(this.GetName()))|| (V=Z.GetLayerByIndex(this.GetIndex())));Z=this._runtime.CreateInstanceFromData(ma,V,!1,void 0,void 0,!1,I);V.SortAndAddInstancesByZIndex(Z);V=Z.GetWorldInfo();V.OffsetXY(J,B);V.SetBboxChanged();L.BlockFlushingInstances(!0);Z._TriggerOnCreatedOnSelfAndRelated();L.BlockFlushingInstances(!1);U.push(Z)}}return U}GetInstanceCount(){return this._instances.length}GetLayout(){return this._layout}GetName(){return this._name}_SetIndex(A){this._index=A}GetIndex(){return this._index}GetSID(){return this._sid}GetRuntime(){return this._runtime}GetDevicePixelRatio(){return this._runtime.GetDevicePixelRatio()}GetEffectList(){return this._effectList}GetEffectChain(){this._MaybeRebuildEffectChainSteps(); return this._effectChain}_MaybeRebuildEffectChainSteps(){const A=this.HasDefaultColor();if(this._needsRebuildEffectChainSteps||A!==this._wasDefaultColor){var F=this.GetEffectList().GetActiveEffectTypes();this._effectChain.BuildSteps(F.map(J=>J.GetShaderProgram()),{indexMap:F.map(J=>J.GetIndex()),forcePreDraw:!A,useFullSurface:!0});this._needsRebuildEffectChainSteps=!1;this._wasDefaultColor=A}}UpdateActiveEffects(){this.GetEffectList().UpdateActiveEffects();this._needsRebuildEffectChainSteps=!0}UsesRenderCells(){return this._useRenderCells&& !this._useCameraDistanceDrawOrder}GetRenderGrid(){return this._renderGrid}SetRenderListStale(){this._isRenderListUpToDate=!1}IsVisible(){for(const A of this.selfAndParentLayers())if(!A._IsVisibleFlagSet())return!1;return!0}_IsVisibleFlagSet(){return this._isVisible}SetVisible(A){A=!!A;this._isVisible!==A&&(this._isVisible=A,this._runtime.UpdateRender())}SetOwnScrollPositionEnabled(A){A=!!A;if(this._hasOwnScrollPosition!==A){if(this._hasOwnScrollPosition=A)A=this.GetLayout(),this._scrollX=A.GetScrollX(), this._scrollY=A.GetScrollY();this._SetMVMatrixChanged();this._runtime.UpdateRender()}}IsOwnScrollPositionEnabled(){return this._hasOwnScrollPosition}SetScrollX(A){var F=this.GetLayout();const J=F.GetScrollLeftBound();F=F.GetScrollRightBound();A>F&&(A=F);AF&&(A=F);A< J&&(A=J);this._scrollY!==A&&(this._scrollY=A,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 A=this.GetLayout();return[A.GetVanishingPointX(),A.GetVanishingPointY()]}GetViewportForZ(A, F){var J=this._viewportZ0;if(0===A)F.copy(J);else{let P=J.midX(),S=J.midY();var B=this.Get2DScaleFactorToZ(A);const U=J.width()/B;J=J.height()/B;const [V,Z]=this._GetVanishingPoint();if(.5!==V||.5!==Z){const ma=this.GetCameraZ();var I=this._runtime,L=100/ma;B=(V-.5)*I.GetViewportWidth()/L;I=(Z-.5)*I.GetViewportHeight()/L;L=this.GetAngle();0!==L&&(p.set(B,I),p.rotate(L),B=p.getX(),I=p.getY());A=f.unlerp(ma,0,A);P+=f.lerp(B,0,A);S+=f.lerp(I,0,A)}F.set(P-U/2,S-J/2,P+U/2,S+J/2)}}GetOpacity(){return this._color.getA()}SetOpacity(A){A= f.clamp(A,0,1);this._color.getA()!==A&&(this._color.setA(A),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(A){this._scaleRate!==A&&(this._scaleRate=A,this._SetMVMatrixChanged(),this._runtime.UpdateRender())}GetParallaxX(){return this._parallaxX}GetParallaxY(){return this._parallaxY}SetParallax(A, F){if(this._parallaxX!==A||this._parallaxY!==F)if(this._parallaxX=A,this._parallaxY=F,this._SetMVMatrixChanged(),this._runtime.UpdateRender(),1!==this._parallaxX||1!==this._parallaxY)for(const J of this._instances)J.GetObjectClass()._SetAnyInstanceParallaxed(!0)}SetParallaxX(A){this.SetParallax(A,this.GetParallaxY())}SetParallaxY(A){this.SetParallax(this.GetParallaxX(),A)}SetZElevation(A){this._zElevation!==A&&(this._zElevation=A,this._runtime.UpdateRender())}GetZElevation(){return this._zElevation}SetAngle(A){A= f.clampAngle(A);this._angle!==A&&(this._angle=A,this._SetMVMatrixChanged(),this._runtime.UpdateRender())}GetAngle(){return f.clampAngle(this._layout.GetAngle()+this._angle)}GetOwnAngle(){return this._angle}HasInstances(){return 0this._SortInstancesByCameraDistance(A,F)),H):this._GetInstances()}_AppendAllInstancesIncludingSubLayersInDrawOrder(A){f.appendArray(A, this._GetInstancesInDrawOrder());for(const F of this._subLayers)F.IsVisible()&&0Number.EPSILON&&(this._UpdateZIndices(),B=this.UsesRenderCells()&&0===this.GetZElevation()&&!this._anyInstanceZElevated,this.Has3DCamera()? this._DrawInstances_3DCamera(A):B?this._DrawInstances_RenderCells(A):this._DrawInstances(A,this._GetInstancesInDrawOrder()));A.SetBaseZ(0);A.SetCurrentZ(0);I&&(A.SetDepthEnabled(!1),this._DrawLayerOwnTextureToRenderTarget(A,L,F,J));P&&A.EndQuery(P);this._runtime.IsGPUProfiling()&&A.IsWebGPU()&&A.WriteTimestamp(2*(this.GetIndex()+1)+1);this._curRenderTarget=null}_DrawInstances(A,F){const J=this._viewport,B=this._curRenderTarget,I=this.GetLayout().IsOrthographicProjection(),L=this.GetLayout().HasVanishingPointOutsideViewport(); let P=null;for(let S=0,U=F.length;S=this.GetCameraZ())return null;let [S,U]=this.LayerToDrawSurface(I,L,J),[V,Z]=this.LayerToDrawSurface(P,F,J);if(0!==this.GetAngle()||0{B=B.GetWorldInfo().GetSceneGraphZIndex();I=I.GetWorldInfo().GetSceneGraphZIndex();return B-I});for(var J of F)if(J.IsInContainer())for(const B of J.siblings())F.includes(B)||(A=[...B.allChildren()],A.push(B),A.sort((I,L)=>{I=I.GetWorldInfo().GetSceneGraphZIndex();L=L.GetWorldInfo().GetSceneGraphZIndex();return I-L}),A&&A.length&&F.splice(F.length,0,...A));for(const B of F)this._AddInstance(B,!0)}else if(this._AddInstance(A,!0),A.IsInContainer())for(F of A.siblings())if(J= [...F.allChildren()],J.push(F),J.sort((B,I)=>{B=B.GetWorldInfo().GetSceneGraphZIndex();I=I.GetWorldInfo().GetSceneGraphZIndex();return B-I}),J&&J.length)for(const B of J)this._AddInstance(B,!0)}}} {"use strict";const f=self.C3,b=self.C3Debugger;f.New(f.Rect);f.New(f.Rect);const a=f.New(f.Rect),c=f.New(f.Color),d=self.glMatrix.vec3,e=[],h=[],g=[],l=[];function m(q,t,p,r){return q[0]===Math.fround(t)&&q[1]===Math.fround(p)&&q[2]===Math.fround(r)}let u=null;function w(q,t){u!==q&&(q.PrepareForDraw(t),u=q)}f.Layout=class extends f.DefendedBase{constructor(q,t,p){super();this._layoutManager=q;this._runtime=q.GetRuntime();this._name=p[0];this._originalWidth=p[1];this._originalHeight=p[2];this._width= p[1];this._height=p[2];this._isUnboundedScrolling=!!p[3];this._isOrthographicProjection=!!p[4];this._vanishingPointX=p[5];this._vanishingPointY=p[6];this._eventSheetName=p[7];this._eventSheet=null;this._sid=p[8];this._index=t;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=d.create(); this._cam3dlook=d.create();this._cam3dup=d.create();this._rootLayers=[];this._allLayersFlat=[];this._layersByName=new Map;this._layersBySid=new Map;const r=this._runtime.GetCanvasManager();this._effectList=f.New(f.EffectList,this,p[11]);this._effectChain=f.New(f.Gfx.EffectChain,r.GetEffectChainManager(),{drawContent:(x,y)=>{y=y.GetContentObject().GetRenderTarget();x.ResetColor();x.DrawRenderTarget(y);x.InvalidateRenderTarget(y);r.ReleaseAdditionalRenderTarget(y)},getShaderParameters:x=>this.GetEffectList().GetEffectParametersForIndex(x)}); this._needsRebuildEffectChainSteps=!0;this._wasFullScreenQualityLow=!1;this._curRenderTarget=null;this._persistData={};this._isFirstVisit=!0;this._iLayout=new self.ILayout(this);this._userScriptDispatcher=f.New(f.Event.Dispatcher);for(const x of p[9])this._rootLayers.push(f.New(f.Layer,this,null,x));this._allLayersFlat=[...this.allLayers()];for(let x=0,y=this._allLayersFlat.length;xp.GetShaderProgram()),{indexMap:t.map(p=>p.GetIndex()),forcePostDraw:q,useFullSurface:!0});this._needsRebuildEffectChainSteps=!1;this._wasFullScreenQualityLow=q}}UpdateActiveEffects(){this.GetEffectList().UpdateActiveEffects(); this._needsRebuildEffectChainSteps=!0}GetMinLayerScale(){let q=this._allLayersFlat[0].GetNormalScale();for(let t=1,p=this._allLayersFlat.length;tp&&(q=p);qp&&(q=p);qq||1t||1q||(this._width=q)}GetHeight(){return this._height}SetHeight(q){!isFinite(q)||1>q||(this._height=q)}GetEventSheet(){return this._eventSheet}*allLayers(){for(const q of this._rootLayers)yield*q.selfAndAllSubLayers()}GetLayers(){return this._allLayersFlat}GetLayerCount(){return this._allLayersFlat.length}GetLayer(q){return"number"=== typeof q?this.GetLayerByIndex(q):this.GetLayerByName(q.toString())}GetLayerByIndex(q){q=f.clamp(Math.floor(q),0,this._allLayersFlat.length-1);return this._allLayersFlat[q]}GetLayerByName(q){return this._layersByName.get(q.toLowerCase())||null}GetLayerBySID(q){return this._layersBySid.get(q)||null}_SetAllLayersProjectionChanged(){for(const q of this._allLayersFlat)q._SetProjectionMatrixChanged()}_SetAllLayersMVChanged(){for(const q of this._allLayersFlat)q._SetMVMatrixChanged()}SaveTransform(){return{scrollX:this.GetScrollX(), scrollY:this.GetScrollY(),scale:this.GetScale(),angle:this.GetAngle(),vpX:this.GetVanishingPointX(),vpY:this.GetVanishingPointY()}}RestoreTransform(q){this.SetScrollX(q.scrollX);this.SetScrollY(q.scrollY);this.SetScale(q.scale);this.SetAngle(q.angle);this.SetVanishingPointXY(q.vpX,q.vpY)}GetLayoutBackgroundColor(){let q=this._rootLayers.filter(t=>t.ShouldDraw())[0];for(;q;){if(!q.IsTransparent())return c.copyRgb(q.GetBackgroundColor()),c.setA(1),c;if(q.UsesOwnTexture())return c.setRgba(0,0,0,0),c; q=q.GetSubLayers().filter(t=>t.ShouldDraw())[0]}c.setRgba(0,0,0,0);return c}IsFirstVisit(){return this._isFirstVisit}_GetInitialObjectClasses(){return[...this._initialObjectClasses]}_AddInitialObjectClass(q){if(q.IsInContainer())for(const t of q.GetContainer().GetObjectTypes())this._initialObjectClasses.add(t);else this._initialObjectClasses.add(q)}_GetTextureLoadedObjectTypes(){return[...this._textureLoadedTypes]}_Load(q,t){if(q===this||!t)return Promise.resolve();q&&(f.CopySet(this._textureLoadedTypes, q._textureLoadedTypes),q._textureLoadedTypes.clear());q=[];for(const p of this._initialObjectClasses)this._textureLoadedTypes.has(p)||(q.push(p.LoadTextures(t)),this._textureLoadedTypes.add(p));return Promise.all(q)}async MaybeLoadTexturesFor(q){if(q.IsFamily())throw Error("cannot load textures for family");var t=this._runtime.GetRenderer();!t||t.IsContextLost()||this._textureLoadedTypes.has(q)||(this._textureLoadedTypes.add(q),t=q.LoadTextures(t),this._AddPendingTextureLoadPromise(t),await t,q.OnDynamicTextureLoadComplete(), this._runtime.UpdateRender())}_AddPendingTextureLoadPromise(q){this._textureLoadPendingPromises.add(q);q.then(()=>this._textureLoadPendingPromises.delete(q)).catch(()=>this._textureLoadPendingPromises.delete(q))}WaitForPendingTextureLoadsToComplete(){return Promise.all([...this._textureLoadPendingPromises])}MaybeUnloadTexturesFor(q){if(q.IsFamily()||0y.PreloadTexturesWithInstances(this._runtime.GetRenderer())));q&&(t.Dispatcher().dispatchEvent(new f.Event("beforefirstlayoutstart")),await t.DispatchUserScriptEventAsyncWait(new f.Event("beforeprojectstart"))); await this.DispatchUserScriptEventAsyncWait(new f.Event("beforelayoutstart"));t.IsLoadingState()||await t.TriggerAsync(f.Plugins.System.Cnds.OnLayoutStart,null,null);await this.DispatchUserScriptEventAsyncWait(new f.Event("afterlayoutstart"));q&&(t.Dispatcher().dispatchEvent(new f.Event("afterfirstlayoutstart")),await t.DispatchUserScriptEventAsyncWait(new f.Event("afterprojectstart")));r._RunQueuedTriggers(p);await this.WaitForPendingTextureLoadsToComplete();this._SetAllLayersProjectionChanged(); this._SetAllLayersMVChanged();this._isFirstVisit=!1}_MoveGlobalObjectsToThisLayout(q){for(const p of this._runtime.GetAllObjectClasses())if(!p.IsFamily()&&p.IsWorldType())for(const r of p.GetInstances()){const x=r.GetWorldInfo();var t=x.GetLayer();t=f.clamp(t.GetIndex(),0,this._allLayersFlat.length-1);t=this._allLayersFlat[t];x._SetLayer(t);t._MaybeAddInstance(r)}if(!q)for(const p of this._allLayersFlat)p._SortInstancesByLastCachedZIndex(!1)}_CreateInitialInstances(){for(const q of this._allLayersFlat)q.CreateInitialInstances(this._createdInstances), q.UpdateViewport(),q._Start()}_CreatePersistedInstances(){let q=!1;for(const [p,r]of Object.entries(this._persistData)){const x=this._runtime.GetObjectClassBySID(parseInt(p,10));if(x&&!x.IsFamily()&&x.HasPersistBehavior()){for(const y of r){var t=null;if(x.IsWorldType()&&(t=this.GetLayerBySID(y.w.l),!t))continue;t=this._runtime.CreateInstanceFromData(x,t,!1,0,0,!0);t.LoadFromJson(y);q=!0;this._createdInstances.push(t)}f.clearArray(r)}}for(const p of this._allLayersFlat)p._SortInstancesByLastCachedZIndex(!0), p.SetZIndicesChanged();q&&(this._runtime.FlushPendingInstances(),this._runtime._RefreshUidMap())}_CreateAndLinkContainerInstances(q){for(const p of q){if(!p.IsInContainer())continue;const r=p.GetWorldInfo(),x=p.GetIID();for(const y of p.GetObjectClass().GetContainer().objectTypes())if(y!==p.GetObjectClass()){var t=y.GetInstances();t.length>x?p._AddSibling(t[x]):(t=r?this._runtime.CreateInstanceFromData(y,r.GetLayer(),!0,r.GetX(),r.GetY(),!0):this._runtime.CreateInstanceFromData(y,null,!0,0,0,!0), this._runtime.FlushPendingInstances(),y._UpdateIIDs(),p._AddSibling(t),q.push(t))}}}_CreateInitialNonWorldInstances(){for(const q of this._initialNonWorld)this._runtime.GetObjectClassByIndex(q[1]).IsInContainer()||this._runtime.CreateInstanceFromData(q,null,!0)}_CreateGlobalNonWorlds(){const q=[],t=this._initialNonWorld;let p=0;for(let r=0,x=t.length;rx.ShouldDraw());for(let x=0,y=p.length;x=this._isEndingLayout)throw Error("already unset"); this._isEndingLayout--}}IsEndingLayout(){return 0/g;f.TimelineManager=class extends f.DefendedBase{constructor(a){super();this._runtime=a;this._timelineDataManager=f.New(f.TimelineDataManager);this._pluginInstance=null;this._timelines=[];this._timelinesByName=new Map;this._objectClassToTimelineMap=new Map;this._timelinesCreatedByTemplate=new Map;this._scheduledTimelines=[];this._playingTimelines=[];this._markedForRemovalTimelines=[];this._isTickingTimelines=this._changingLayout=this._hasRuntimeListeners=!1; this._tickFunc=()=>this._OnTick();this._tick2Func=()=>this._OnTick2();this._beforeLayoutChange=()=>this._OnBeforeChangeLayout();this._layoutChange=()=>this._OnAfterChangeLayout();this._instanceDestroy=c=>this._OnInstanceDestroy(c.instance);this._afterLoad=c=>this._OnAfterLoad();this._destroyedWhileLoadingState=[];this._renderChange=0}Release(){this.RemoveRuntimeListeners();this._afterLoad=this._instanceDestroy=this._layoutChange=this._beforeLayoutChange=this._tick2Func=this._tickFunc=null;for(const a of this._timelines)a.Stop(), a.Release();f.clearArray(this._timelines);this._timelines=null;this._timelineDataManager.Release();this._timelineDataManager=null;f.clearArray(this._scheduledTimelines);this._scheduledTimelines=null;f.clearArray(this._playingTimelines);this._playingTimelines=null;f.clearArray(this._markedForRemovalTimelines);this._markedForRemovalTimelines=null;this._timelinesByName.clear();this._timelinesByName=null;this._objectClassToTimelineMap.clear();this._objectClassToTimelineMap=null;this._timelinesCreatedByTemplate.clear(); this._timelinesCreatedByTemplate=null;f.clearArray(this._destroyedWhileLoadingState);this._runtime=this._destroyedWhileLoadingState=null}AddRuntimeListeners(){const a=this._runtime.Dispatcher();a.addEventListener("pretick",this._tickFunc);a.addEventListener("tick2",this._tick2Func);a.addEventListener("beforelayoutchange",this._beforeLayoutChange);a.addEventListener("layoutchange",this._layoutChange);a.addEventListener("instancedestroy",this._instanceDestroy);a.addEventListener("afterload",this._afterLoad)}RemoveRuntimeListeners(){const a= this._runtime.Dispatcher();a.removeEventListener("pretick",this._tickFunc);a.removeEventListener("tick2",this._tick2Func);a.removeEventListener("beforelayoutchange",this._beforeLayoutChange);a.removeEventListener("layoutchange",this._layoutChange);a.removeEventListener("instancedestroy",this._instanceDestroy);a.removeEventListener("afterload",this._afterLoad)}Create(a){this._timelineDataManager.Add(a);a=f.TimelineState.CreateInitial(a,this);this.Add(a);this.SetTimelineObjectClassesToMap(a);this._timelinesCreatedByTemplate.set(a.GetName(), 0)}CreateFromTemplate(a){var c=this.GetTimelineDataManager();a=a.GetTemplateName();c=c.Get(a);c=f.TimelineState.CreateFromTemplate(`${a}:${this._timelinesCreatedByTemplate.get(a)}`,c,this);this._IncreaseTemplateTimelinesCount(a);this.Add(c);return c}_IncreaseTemplateTimelinesCount(a){this._timelinesCreatedByTemplate.set(a,this._timelinesCreatedByTemplate.get(a)+1)}_SetCreatedTemplateTimelinesCount(){for(const a of this._timelines){if(a.IsTemplate())continue;const c=a.GetTemplateName();this._IncreaseTemplateTimelinesCount(c)}}_ClearCreatedTemplateTimelinesCount(){for(const a of this._timelinesCreatedByTemplate.keys())this._timelinesCreatedByTemplate.set(a, 0)}Add(a){this._timelines.push(a);this._timelinesByName.set(a.GetName().toLowerCase(),a)}Remove(a){a.Removed();a.IsTemplate()||(f.arrayFindRemove(this._timelines,a),f.arrayFindRemove(this._scheduledTimelines,a),f.arrayFindRemove(this._playingTimelines,a),f.arrayFindRemove(this._markedForRemovalTimelines,a),this._timelinesByName.delete(a.GetName().toLowerCase()),this.RemoveTimelineFromObjectClassMap(a),a.IsReleased()||a.Release())}Trigger(a){this._runtime.Trigger(a,this._pluginInstance,null)}GetRuntime(){return this._runtime}GetTimelineDataManager(){return this._timelineDataManager}SetPluginInstance(a){this._pluginInstance= a}GetPluginInstance(){return this._pluginInstance}*GetTimelines(){for(const a of this._timelines)yield a}SetTimelineObjectClassToMap(a,c){this._objectClassToTimelineMap.has(a)||this._objectClassToTimelineMap.set(a,new Set);this._objectClassToTimelineMap.get(a).add(c)}SetTimelineObjectClassesToMap(a){for(const c of a.GetObjectClasses())this.SetTimelineObjectClassToMap(c,a)}RemoveTimelineFromObjectClassMap(a){for(const [c,d]of this._objectClassToTimelineMap.entries())d.has(a)&&(d.delete(a),0===d.size&& this._objectClassToTimelineMap.delete(c))}GetTimelinesForObjectClass(a){if(this._objectClassToTimelineMap.has(a))return this._objectClassToTimelineMap.get(a)}GetTimelineOfTemplateForInstances(a,c){if(c)for(const d of this._timelines)if(c.every(e=>d.HasTrackInstance(e.instance,e.trackId))&&d.GetName().includes(a.GetName()))return d}GetTimelineByName(a){return this._timelinesByName.get(a.toLowerCase())||null}GetScheduledOrPlayingTimelineByName(a){for(const c of this._scheduledTimelines)if(c.GetName()=== a)return c;for(const c of this._playingTimelines)if(c.GetName()===a)return c;return null}*GetTimelinesByName(a){if(b.test(a)){b.lastIndex=0;let d;var c=new Set;do if(d=b.exec(a)){const e=d[1].split(",");for(const h of e)c.add(h)}while(d);for(const e of c.values())(a=this.GetTimelineByName(e))&&(yield a);c.clear()}else(c=this.GetTimelineByName(a))&&(yield c)}*GetTimelinesByTags(a){for(const c of this._timelines)c.HasTags(a)&&(yield c)}AddScheduledTimeline(a){this._scheduledTimelines.includes(a)||this._scheduledTimelines.push(a); this._MaybeEnableRuntimeListeners()}RemovePlayingTimeline(a){f.arrayFindRemove(this._playingTimelines,a);this._MaybeDisableRuntimeListeners()}ScheduleTimeline(a){this._playingTimelines.includes(a)?(a.SetPlaying(!0),a.SetScheduled(!1),a.SetMarkedForRemoval(!1)):(a.SetPlaying(!1),a.SetScheduled(!0),a.SetMarkedForRemoval(!1),this._scheduledTimelines.includes(a)||this._scheduledTimelines.push(a));this._MaybeEnableRuntimeListeners()}DeScheduleTimeline(a){a.SetPlaying(!1);a.SetScheduled(!1);a.ResolvePlayPromise(); f.arrayFindRemove(this._scheduledTimelines,a);this._MaybeDisableRuntimeListeners()}CompleteTimeline(a){a.SetPlaying(!1);a.SetScheduled(!1);a.SetMarkedForRemoval(!0);this._markedForRemovalTimelines.push(a);f.arrayFindRemove(this._playingTimelines,a)}CompleteTimelineBeforeChangeOfLayout(a){a.SetPlaying(!1);a.SetScheduled(!1);a.SetMarkedForRemoval(!1);a.SetPlaybackRate(1);f.arrayFindRemove(this._playingTimelines,a)}CompleteTimelineAndResolve(a){this.CompleteTimeline(a);a.ResolvePlayPromise()}_OnTick(){if(!this.GetRuntime().IsLoadingState()&& this._hasRuntimeListeners&&!this._changingLayout){for(this._isTickingTimelines=!0;this._scheduledTimelines.length;){var a=this._scheduledTimelines.pop();a.SetInitialState();0!==a.GetRenderChange()&&(this._renderChange=1);this._playingTimelines.push(a)}a=this._runtime._GetDtFast();var c=this._runtime.GetDt1(),d=this._runtime.GetTimeScale();for(let e=this._playingTimelines.length-1;0<=e;e--)this._playingTimelines[e].Tick(a,d,c);this._isTickingTimelines=!1;0!==this._renderChange&&this.GetRuntime().UpdateRender()}}_OnTick2(){if(!this.GetRuntime().IsLoadingState()&& this._hasRuntimeListeners&&!this._changingLayout){var a;for(let c=0,d=this._markedForRemovalTimelines.length;ca._SaveToJson())}_LoadTimelinesFromJson(a){for(const c of a){a=this.GetTimelineByName(c.name);if(!a){a=this._GetTemplateNameFromJson(c);if(!a)continue;a=this.GetTimelineByName(a);a=this.CreateFromTemplate(a)}a._LoadFromJson(c);a.HasTracks()||this.Remove(a)}}_GetTemplateNameFromJson(a){return(a= a.name.split(":"))&&2===a.length?a[0]:null}_SaveScheduledTimelinesToJson(){return this._SaveTimelines(this._scheduledTimelines)}_LoadScheduledTimelinesFromJson(a){this._LoadTimelines(a,this._scheduledTimelines)}_SavePlayingTimelinesToJson(){return this._SaveTimelines(this._playingTimelines)}_LoadPlayingTimelinesFromJson(a){this._LoadTimelines(a,this._playingTimelines)}_SaveMarkedForRemovalTimelinesToJson(){return this._SaveTimelines(this._markedForRemovalTimelines)}_LoadMarkedForRemovalTimelinesFromJson(a){this._LoadTimelines(a, this._markedForRemovalTimelines)}_IsTimelineInJson(a,c){for(const d of c)if(d===a.GetName())return!0;return!1}_SaveTimelines(a){return a.map(c=>c.GetName())}_LoadTimelines(a,c){var d=new Set;for(const e of c)this._IsTimelineInJson(e,a)||d.add(e);f.arrayRemoveAllInSet(c,d);d=e=>h=>h.GetName()===e;for(const e of a)(a=this.GetTimelineByName(e))&&(c.find(d(e))||c.push(a))}}} {"use strict";const f=self.C3;f.TimelineState=class extends f.DefendedBase{constructor(b,a,c){super();this._runtime=c.GetRuntime();this._timelineManager=c;this._timelineDataItem=a;this._name=b;this._tracks=[];this._tracksLength=0;this._beforeAndAfterTracks=null;this._beforeAndAfterTracksLength=0;this.CreateTrackStates();this._playResolve=this._playPromise=null;this._playheadTime=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;this._hasNestedContent=this._renderChange=0}static CreateInitial(b,a){var c=a.GetTimelineDataManager();const d=c.GetNameId();c=c.Get(b[d]);b=f.New(f.TimelineState,b[d],c,a);b.SetIsTemplate(!0);return b}static CreateFromTemplate(b,a,c){return f.New(f.TimelineState, b,a,c)}Release(){if(!this.IsReleased()){this._timelineManager.DeScheduleTimeline(this);this._timelineManager.CompleteTimelineAndResolve(this);for(const b of this._tracks)b.Release();f.clearArray(this._tracks);this._timelineDataItem=this._timelineManager=this._runtime=this._tracks=null;this._released=!0;this._playResolve=this._playPromise=null}}CreateTrackStates(){for(const b of this._timelineDataItem.GetTrackData().trackDataItems())this._tracksLength=this._tracks.push(f.TrackState.Create(this,b))}GetTimelineManager(){return this._timelineManager}GetRuntime(){return this._runtime}GetTracks(){return this._tracks}GetSimilarPropertyTracks(b, a,c){if(this._hasNestedContent){var d;for(let h=0;h{this._playResolve=b})}ResolvePlayPromise(){this._playPromise&&(this._playResolve(),this._playResolve=this._playPromise=null)}SetTags(b){this._tags=f.TimelineState._GetTagArray(b);this._tagsChanged=!0}GetTags(){return this._tags}GetStringTags(){this._tagsChanged&&(this._stringTags=this._tags.join(" ")); this._tagsChanged=!1;return this._stringTags}HasTags(b){return this._tags&&this._tags.length?(b=f.TimelineState._GetTagArray(b))&&b.length?b.every(f.TimelineState._HasTag,this):!1:!1}OnStarted(){f.Plugins.Timeline.Cnds.SetTriggerTimeline(this);this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnTimelineStarted);this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnTimelineStartedByName);this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnTimelineStartedByTags);this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnAnyTimelineStarted); f.Plugins.Timeline.Cnds.SetTriggerTimeline(null)}OnCompleted(){this._completedTick=this._runtime.GetTickCount()}FinishTriggers(){this._finishedTriggers||(this._finishedTriggers=!0,f.Plugins.Timeline.Cnds.SetTriggerTimeline(this),this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnTimelineFinished),this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnTimelineFinishedByName),this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnTimelineFinishedByTags),this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnAnyTimelineFinished), f.Plugins.Timeline.Cnds.SetTriggerTimeline(null))}SetPlaying(b){this._isPlaying=b}IsCompletedTick(){return this._completedTick===this._runtime.GetTickCount()}IsPlaying(b=!1){return this.IsCompletedTick()||this.IsScheduled()&&!b?!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(b){this._isScheduled=b}IsScheduled(){return this._isScheduled}SetComplete(b){this._complete= b;b=this.GetTime();if(0>=b||b>=this.GetTotalTime())this._complete=!0}IsComplete(){return this._complete}IsReleased(){return this._released}SetMarkedForRemoval(b){this._markedForRemoval=b}IsMarkedForRemoval(){return this._markedForRemoval}SetImplicitPause(b){this._implicitPause=b}IsImplicitPause(){return this._implicitPause}SetIsTemplate(b){this._isTemplate=!!b}IsTemplate(){return this._isTemplate}InitialStateSet(){return this._initialStateSet}GetTime(){return this._playheadTime}SetTime(b){const a= this.GetTime();this._SetTime(b);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._SetUpdateStateBefore();this._Interpolate(b,!1,!0,!0,a);this._SetUpdateStateAfter();this._renderChange&&this.GetRuntime().UpdateRender(); this._OnSetTime()}_SetTime(b){0>b?this._playheadTime=0:b>=this.GetTotalTime()?this._playheadTime=this.GetTotalTime():this._playheadTime=b}_OnSetTime(){f.Plugins.Timeline&&this.constructor===f.TimelineState&&(f.Plugins.Timeline.Cnds.SetTriggerTimeline(this),this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnTimeSet),this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnTimeSetByName),this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnTimeSetByTags),f.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(b=!1){return this.IsReleased()||this.IsScheduled()?!1:this._IsPlaying()&&this.IsCompletedTick()?this._SchedulePlayingTimeline():this._IsPlaying()|| !this.IsComplete()&&!b&&!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(b=!1){this.IsReleased()||(this.SetComplete(b),this._timelineManager.CompleteTimeline(this),this.IsComplete()&& this.ResolvePlayPromise())}Reset(b=!0,a=!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 c=this.GetTime();this._SetUpdateStateBefore();a?this._InterpolateBeforeChangeLayout(c):this._Interpolate(c,!1,!1,!0);b&&this._OnSetTime();this._SetUpdateStateAfter();this._renderChange&&b&&this.GetRuntime().UpdateRender()}}}ResetBeforeChangeLayout(){this.Reset(!1, !0)}_InterpolateBeforeChangeLayout(b){this._Interpolate(b,!1,!1,!0,NaN,!1,!0)}_OnBeforeChangeLayout(){if(this.IsReleased())return!0;if(this.HasValidGlobalTracks())return!1;this._timelineManager.CompleteTimelineBeforeChangeOfLayout(this);this.ResetBeforeChangeLayout();return!0}SetInitialStateFromSetTime(){this.SetInitialState(!0)}SetInitialState(b){if(!this.IsMarkedForRemoval()){if(b){this._firstTick=this._initialStateSet=!0;this._SetUpdateStateBefore();for(const a of this._tracks)a.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());this._SetUpdateStateBefore();for(const a of this._tracks)a.SetInitialState()}else{this._firstTick=!0;this._SetUpdateStateBefore();for(const a of this._tracks)a.SetResumeState()}this._SetUpdateStateAfter()}}GetRenderChange(){return this._renderChange}_SetUpdateStateBefore(){this._hasNestedContent= 0;for(const b of this._tracks)b.IsNested()&&(this._hasNestedContent=1)}_SetUpdateStateAfter(){this._renderChange=0;for(const b of this._tracks)b._SetUpdateState(),0===this._renderChange&&1===b.GetRenderChange()&&(this._renderChange=1),this._beforeAndAfterTracks||1!==b.GetNeedsBeforeAndAfter()||(this._beforeAndAfterTracks||(this._beforeAndAfterTracks=[]),this._beforeAndAfterTracksLength=this._beforeAndAfterTracks.push(b))}Tick(b,a,c){if(0!==b||0!==this._lastDelta){this._lastDelta=b;c=this._playheadTime; a=c+b*a*this._playbackRate;b=this._timelineDataItem._totalTime;this._playheadTime=0>a?0:a>=b?b:a;var d=!1;a=this.GetLoop();var e=this.GetPingPong();a||e?a&&!e?0=b&&this._SetTime(0):0>=this._playheadTime&&this._SetTime(b):!a&&e?0=b&&(this._SetTime(b),this.SetPlaybackRate(-1*this.GetPlaybackRate()),1===this._pingPongState?this._currentRepeatCount=this._playheadTime&&(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate()),1===this._pingPongState?this._currentRepeatCount=b&&(this._SetTime(b),this.SetPlaybackRate(-1*this.GetPlaybackRate())):0>=this._playheadTime&&(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate()))): 0=b&&(this._currentRepeatCount=this._playheadTime&&(this._currentRepeatCountthis._playheadTime-g&&0g?0:g>=b?b:g,h.Interpolate(g,!0,!1,!1,this._firstTick,!1)):h.Interpolate(this._playheadTime,!0,!1,!1,this._firstTick,!1)}else for(d=0;du&&0b.IsInstanceTrack()?b.CanInstanceBeValid():!0)}HasValidGlobalTracks(){return this._tracks.some(b=>b.IsInstanceTrack()?b.CanInstanceBeValid()?(b=b.GetObjectClass())?b.IsGlobal():!1:!1:!1)}GetPropertyTrack(b){for(const a of this.GetTracks())for(const c of a.GetPropertyTracks())if(c.GetPropertyName()===b)return c}GetTrackFromInstance(b){for(const a of this._tracks)if(b=== a.GetInstance())return a;return null}GetKeyframeWithTags(b){b=b?b.split(" "):[];b=[...(new Set(b.map(a=>a.toLowerCase().trim()))).values()];for(const a of this.GetTracks())for(const c of a.GetKeyframeDataItems())if(b.every(d=>c.HasTag(d)))return c}GetObjectClasses(){const b=[];for(const a of this.GetTracks())b.push(a.GetObjectClass());return b.filter(a=>a)}_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(b){b&&(this._LoadTracksFromJson(b.tracksJson), this._name=b.name,this._playheadTime=b.playheadTime,this._playbackRate=b.playbackRate,this._pingPongState=b.pingPongState,this._currentRepeatCount=b.currentRepeatCount,this._isPlaying=!!b.isPlaying,this._isScheduled=!!b.isScheduled,this._initialStateSet=!!b.initialStateSet,this._finishedTriggers=b.hasOwnProperty("finishedTriggers")?!!b.finishedTriggers:!1,this._complete=!!b.complete,this._released=!!b.released,this._markedForRemoval=!!b.markedForRemoval,this._completedTick=b.completedTick,this._implicitPause= !!b.implicitPause,this._isTemplate=!!b.isTemplate,this._tags=b.tags.split(" "),this._stringTags=b.stringTags,this._tagsChanged=!!b.tagsChanged,this._firstTick=!!b.firstTick)}_SaveTracksToJson(){return this._tracks.map(b=>b._SaveToJson())}_LoadTracksFromJson(b){b.forEach((a,c)=>{this._tracks[c]._LoadFromJson(a)});this._tracks.filter(a=>a.CanInstanceBeValid())}static _HasTag(b){const a=this.GetTags();return""===b?1===a.length&&""===a[0]:a.includes(b)}static _GetTagArray(b){if(f.IsArray(b))return b.slice(0); if(f.IsString(b))return b.split(" ")}}} {"use strict";const f=self.C3;f.TrackState=class extends f.DefendedBase{constructor(b,a){super();this._timeline=b;this._trackDataItem=a;this._trackData=a.GetTrackData();this._objectClassIndex=this._instanceUid=NaN;this._worldInfo=this._instance=null;this._isNested=0a.GetNeedsBeforeAndAfter())&&(this._needsBeforeAndAfter=1);this._lastKeyframeDataItem=this._GetLastKeyFrameBeforeTime(b); this._endStateOfNestedSet=this._initialStateOfNestedSet=!1;this.Interpolate(b)}}SetResumeState(){this.MaybeGetInstance();if(this.IsInstanceValid()||!this.IsInstanceTrack()){this._timeline.IsForwardPlayBack();var b=this._timeline.GetTime()-this.GetStartOffset();this._lastKeyframeDataItem=this._GetLastKeyFrameBeforeTime(b);for(const a of this._propertyTracks)a.SetResumeState(b)}}SetEndState(){if(!(this.GetTimeline().IsComplete()||(this.MaybeGetInstance(),!this.IsInstanceValid()&&this.IsInstanceTrack()|| this._isNested))){const b=this._timeline.GetTime(),a=this.GetStartOffset()+this.GetLocalTotalTime();b>=a?this.Interpolate(this.GetLocalTotalTime(),!0,!1,!0):0>=b&&this.Interpolate(0,!0,!1,!0)}}_SetUpdateState(){for(let b=0,a=this._propertyTracks.length;bb))){this.MaybeSetInitialStateOfNestedTrack(b,a);this.MaybeTriggerKeyframeReachedConditions(b,a,e);for(let m=0,u=this._propertyTracks.length;mb)return;for(const c of this._propertyTracks)c.Interpolate(0,!1,!0)}else{if(b>this.GetLocalTotalTime())return; for(const c of this._propertyTracks)c.Interpolate(this.GetLocalTotalTime(),!1,!0)}for(const c of this._propertyTracks)c.SetInitialState();this._initialStateOfNestedSet=!0}}MaybeSetEndStateOfNestedTrack(b,a){if(a&&this._isNested&&!this._endStateOfNestedSet)if(this.GetTimeline().IsForwardPlayBack()){if(b>=this.GetLocalTotalTime()){for(const c of this._propertyTracks)c.Interpolate(this.GetLocalTotalTime(),!1,!0);this._endStateOfNestedSet=!0}}else if(0>=b){for(const c of this._propertyTracks)c.Interpolate(0, !1,!0);this._endStateOfNestedSet=!0}}MaybeTriggerKeyframeReachedConditions(b,a,c){if(!c&&a&&f.Plugins.Timeline){a=this.GetTimeline();c=this._lastKeyframeDataItem.GetNext();var d=this._lastKeyframeDataItem.GetTime(),e=c?c.GetTime():a.GetTotalTime();if(b<=d||b>=e)this._lastKeyframeDataItem=this._trackData.GetFirstKeyFrameDataItemLowerOrEqualThan(b,this._trackDataItem),a.IsForwardPlayBack()?c&&this.OnKeyframeReached(this._lastKeyframeDataItem):this._lastKeyframeDataItem.GetNext()&&this.OnKeyframeReached(this._lastKeyframeDataItem)}}_GetLastKeyFrameBeforeTime(b){const a= this._trackData.GetKeyFrameDataItemAtTime(b,this._trackDataItem);return a?a:this._trackData.GetFirstKeyFrameDataItemLowerOrEqualThan(b,this._trackDataItem)}OnKeyframeReached(b){const a=this.GetTimeline();f.Plugins.Timeline.Cnds.SetTriggerTimeline(a);f.Plugins.Timeline.Cnds.SetTriggerKeyframe(b);b=a.GetTimelineManager();b.Trigger(f.Plugins.Timeline.Cnds.OnAnyKeyframeReached);b.Trigger(f.Plugins.Timeline.Cnds.OnKeyframeReached);f.Plugins.Timeline.Cnds.SetTriggerTimeline(null);f.Plugins.Timeline.Cnds.SetTriggerKeyframe(null)}AddKeyframe(){return this._trackDataItem.GetKeyframeData().AddEmptyKeyframeDataItem()}AddPropertyTrack(){var b= this._trackDataItem.GetPropertyTrackData().AddEmptyPropertyTrackDataItem();b=f.PropertyTrackState.Create(this,b);this._propertyTracks.push(b);return b}DeleteKeyframes(b){this._trackDataItem.GetKeyframeData().DeleteKeyframeDataItems(b)}DeletePropertyKeyframes(b){for(const a of this._propertyTracks)a.DeletePropertyKeyframes(b)}SaveState(){for(const b of this._propertyTracks)b.SaveState()}CompareInitialStateWithCurrent(){this.MaybeGetInstance();if(this.IsInstanceValid()||!this.IsInstanceTrack())for(const b of this._propertyTracks)b.CompareInitialStateWithCurrent()}CompareSaveStateWithCurrent(){this.MaybeGetInstance(); if(this.IsInstanceValid()||!this.IsInstanceTrack()){var b=!1;for(const a of this._propertyTracks){const c=a.CompareSaveStateWithCurrent();!b&&c&&(b=!0)}b&&(b=this.AddKeyframe(),b.SetTime(this.GetTimeline().GetTime()),b.SetEase("noease"),b.SetEnable(!0),b.SetTags(""))}}_SaveToJson(){var b=this.GetInstance();b=b?b.GetUID():this.GetInstanceUID();return{propertyTracksJson:this._SavePropertyTracksToJson(),lastKeyframeDataItemJson:this._SaveLastKeyframeDataItemToJson(),initialStateOfNestedSet:this._initialStateOfNestedSet, endStateOfNestedSet:this._endStateOfNestedSet,instanceUid:b}}_LoadFromJson(b){b&&(this._LoadPropertyTracksFromJson(b.propertyTracksJson),this._LoadLastKeyframeDataItemFromJson(b.lastKeyframeDataItemJson),this._LoadInstanceFromJson(b.instanceUid),this._initialStateOfNestedSet=!1,b.hasOwnProperty.initialStateOfNestedSet&&(this._initialStateOfNestedSet=b.initialStateOfNestedSet),this._endStateOfNestedSet=!1,b.hasOwnProperty.endStateOfNestedSet&&(this._endStateOfNestedSet=b.endStateOfNestedSet))}_SaveLastKeyframeDataItemToJson(){return this._trackDataItem.GetKeyframeData().GetKeyframeDataItemIndex(this._lastKeyframeDataItem)}_SavePropertyTracksToJson(){return this._propertyTracks.map(b=> b._SaveToJson())}_LoadPropertyTracksFromJson(b){b.forEach((a,c)=>{this._propertyTracks[c]._LoadFromJson(a)})}_LoadInstanceFromJson(b){if(f.IsFiniteNumber(b)&&(b=this.GetRuntime().GetInstanceByUID(b))){var a=this.GetTimeline();a.ClearTrackInstances();a.SetTrackInstance(this._trackDataItem.GetId(),b)}}_LoadLastKeyframeDataItemFromJson(b){this._lastKeyframeDataItem=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemFromIndex(b)}}} {"use strict";const f=self.C3;f.PropertyTrackState=class extends f.DefendedBase{constructor(b,a){super();this._track=b;this._propertyTrackDataItem=a;this._propertyTrackData=a.GetPropertyTrackData();this._needsBeforeAndAfter=this._renderChange=this._worldInfoChange=0;this._sourceAdapter=this.GetSourceAdapter();this._propertyKeyframeDataItems=this._propertyTrackDataItem.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();this._absoluteValueObject=this._lastPropertyKeyframeDataItem=null}static Create(b, a){return f.New(f.PropertyTrackState,b,a)}Release(){this._track=null;this._sourceAdapter&&(this._sourceAdapter.Release(),this._sourceAdapter=null);this._propertyTrackData=this._propertyTrackDataItem=this._propertyKeyframeDataItems=null}GetWorldInfoChange(){return this._worldInfoChange}GetRenderChange(){return this._renderChange}GetNeedsBeforeAndAfter(){return this._needsBeforeAndAfter}HasAbsoluteValueObject(){return!!this._absoluteValueObject}SetAbsoluteValueObject(b){this._absoluteValueObject=b}GetAbsoluteValueObject(){return this._absoluteValueObject}GetTrack(){return this._track}GetPropertyTrackDataItem(){return this._propertyTrackDataItem}GetPropertyTrackData(){return this._propertyTrackData}GetTimeline(){return this._track.GetTimeline()}GetRuntime(){return this._track.GetRuntime()}GetInstance(){return this._track.GetInstance()}GetSourceAdapter(){if(this._sourceAdapter)return this._sourceAdapter; let b;switch(this._propertyTrackDataItem.GetSourceAdapterId()){case "behavior":b=new f.PropertyTrackState.BehaviorSourceAdapter(this);break;case "effect":b=new f.PropertyTrackState.EffectSourceAdapter(this);this._renderChange=1;break;case "instance-variable":b=new f.PropertyTrackState.InstanceVariableSourceAdapter(this);break;case "plugin":b=new f.PropertyTrackState.PluginSourceAdapter(this);this._renderChange=1;break;case "world-instance":b=new f.PropertyTrackState.PropertySourceAdapter(this);this._worldInfoChange= this._renderChange=1;break;case "value":b=new f.PropertyTrackState.ValueSourceAdapter(this);break;case "audio":b=new f.PropertyTrackState.AudioSourceAdapter(this)}return this._sourceAdapter=b}GetSourceAdapterId(){return this._propertyTrackDataItem.GetSourceAdapterId()}SetSourceAdapterId(b){this._propertyTrackDataItem.SetSourceAdapterId(b)}GetSourceAdapterArgs(){return this._propertyTrackDataItem.GetSourceAdapterArguments()}SetSourceAdapterArgs(b){this._propertyTrackDataItem.SetSourceAdapterArguments(b)}GetSourceAdapterValue(){return this.GetSourceAdapter().GetValue()}GetPropertyName(){return this._propertyTrackDataItem.GetProperty()}SetPropertyName(b){this._propertyTrackDataItem.SetProperty(b)}GetPropertyType(){return this._propertyTrackDataItem.GetType()}SetPropertyType(b){this._propertyTrackDataItem.SetType(b)}GetPropertyKeyframeType(){return this.GetPropertyTrackData().GetFirstPropertyKeyframeDataItem(this._propertyTrackDataItem).GetType()}GetMin(){return this._propertyTrackDataItem.GetMin()}SetMin(b){this._propertyTrackDataItem.SetMin(b)}GetMax(){return this._propertyTrackDataItem.GetMax()}SetMax(b){this._propertyTrackDataItem.SetMax(b)}GetEnable(){return this._propertyTrackDataItem.GetEnable()}SetEnable(b){this._propertyTrackDataItem.SetEnable(b)}GetInterpolationMode(){return this._propertyTrackDataItem.GetInterpolationMode()}SetInterpolationMode(b){this._propertyTrackDataItem.SetInterpolationMode(b)}GetResultMode(){return this._propertyTrackDataItem.GetResultMode()}SetResultMode(b){this._propertyTrackDataItem.SetResultMode(b)}SetEase(b){for(const a of this.GetPropertyKeyframeDataItems())a.SetEase(b)}CanHavePropertyKeyframes(){return this._propertyTrackDataItem.CanHavePropertyKeyframes()}GetPropertyKeyframeDataItems(){return this._propertyKeyframeDataItems? this._propertyKeyframeDataItems:this._propertyKeyframeDataItems=this._propertyTrackDataItem.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray()}*GetPropertyKeyframeValues(){for(const b of this.GetPropertyKeyframeDataItems())yield b.GetValueWithResultMode()}TimelineRemoved(){this.GetSourceAdapter().TimelineRemoved()}CleanCaches(){this.GetSourceAdapter().CleanCaches()}GetCurrentState(){return this.GetSourceAdapter().GetCurrentState()}SetInitialState(b){this.GetSourceAdapter().SetInitialState(); this._lastPropertyKeyframeDataItem=this._GetLastPropertyKeyFrameBeforeTime(b);this._SetUpdateState()}SetResumeState(b){this.GetSourceAdapter().SetResumeState();this._lastPropertyKeyframeDataItem=this._GetLastPropertyKeyFrameBeforeTime(b)}_SetUpdateState(){var b=this.GetTrack();this._needsBeforeAndAfter=0;if(b.IsInstanceTrack()){var a=this.GetTimeline();b=b.GetInstance();const c=this.GetSourceAdapter(),d=this.GetPropertyName();c.MayNeedBeforeAndAfterInterpolate()?(a=a.GetSimilarPropertyTracks(b,c, d))&&a.length&&(this._needsBeforeAndAfter=1):this._needsBeforeAndAfter=0}}_GetLastPropertyKeyFrameBeforeTime(b){const a=this.GetTimeline(),c=this._propertyTrackData.GetPropertyKeyFrameDataItemAtTime(b,this._propertyTrackDataItem);return c?c:a.IsForwardPlayBack()?this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem):this._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(b,this._propertyTrackDataItem)}BeforeInterpolate(){this._sourceAdapter.BeforeInterpolate()}Interpolate(b, a=!1,c=!1){let d;if(a)var e=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem);else{if(this._lastPropertyKeyframeDataItem){var h=this.GetTimeline();const g=this._lastPropertyKeyframeDataItem.GetNext();e=this._lastPropertyKeyframeDataItem.GetTime();h=g?g.GetTime():h.GetTotalTime();if(b<=e||b>=h)this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem)}else this._lastPropertyKeyframeDataItem= this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem);e=this._lastPropertyKeyframeDataItem}e&&(d=e.GetNext());this._sourceAdapter.Interpolate(b,e,d,a,c)}GetInterpolatedValue(b){if(this._lastPropertyKeyframeDataItem){var a=this.GetTimeline();const d=this._lastPropertyKeyframeDataItem.GetNext();var c=this._lastPropertyKeyframeDataItem.GetTime();a=d?d.GetTime():a.GetTotalTime();if(b<=c||b>=a)this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b, this._propertyTrackDataItem)}else this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem);c=this._lastPropertyKeyframeDataItem;a=c.GetNext();return this._sourceAdapter.GetInterpolatedValue(b,c,a)}AfterInterpolate(){this._sourceAdapter.AfterInterpolate()}static GetStartPropertyKeyframeForTime(b,a){const c=a.GetPropertyTrackDataItem();return a._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,c)}static GetEndPropertyKeyframeForTime(b, a){const c=a.GetPropertyTrackDataItem();return a._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(b,c)}AddPropertyKeyframe(){const b=this._propertyTrackDataItem.GetPropertyKeyframeData().AddEmptyPropertyKeyframeDataItem();this._lastPropertyKeyframeDataItem=null;return b}DeletePropertyKeyframes(b){this._lastPropertyKeyframeDataItem=null;this._propertyTrackDataItem.GetPropertyKeyframeData().DeletePropertyKeyframeDataItems(b)}SaveState(){this.GetSourceAdapter().SaveState()}CompareInitialStateWithCurrent(){if(this.GetSourceAdapter().CompareInitialStateWithCurrent()){const b= this._propertyTrackData.GetFirstPropertyKeyframeDataItem(this._propertyTrackDataItem),a=this.GetSourceAdapter().GetCurrentState();b.SetAbsoluteValue(a)}}CompareSaveStateWithCurrent(){const b=this.GetSourceAdapter().CompareSaveStateWithCurrent();b&&this.AddPropertyKeyframeAtCurrentTime();this.GetSourceAdapter().ClearSaveState();return b}AddPropertyKeyframeAtCurrentTime(){const b=this.GetTimeline().GetTime(),a=this.GetSourceAdapter(),c=f.PropertyTrackState.GetStartPropertyKeyframeForTime(b,this),d= this.AddPropertyKeyframe();d.SetType(c.GetType());d.SetTime(b);d.SetEase(c.GetEase());d.SetEnable(!0);d.SetValue(a.GetValueAtTime());d.SetAbsoluteValue(a.GetCurrentState())}_SaveToJson(){return{sourceAdapterJson:this.GetSourceAdapter()._SaveToJson()}}_LoadFromJson(b){b&&this.GetSourceAdapter()._LoadFromJson(b.sourceAdapterJson)}}} {"use strict";const f=self.C3.PropertyTrackState;f.PropertySourceAdapter=class{constructor(b){this._propertyTrack=b;this._propertyAdapter=null;this.GetPropertyAdapter()}Release(){this._propertyAdapter&&(this._propertyAdapter.Release(),this._propertyAdapter=null);this._propertyTrack=null}MayNeedBeforeAndAfterInterpolate(){return this._propertyAdapter.MayNeedBeforeAndAfterInterpolate()}GetPropertyTrack(){return this._propertyTrack}TimelineRemoved(){this._propertyAdapter&&this._propertyAdapter.TimelineRemoved()}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._propertyAdapter.BeforeChangeProperty()}Interpolate(b,a,c,d,e){let h;switch(this._propertyTrack.GetPropertyKeyframeType()){case "numeric":h= f.NumericTypeAdapter.Interpolate(b,a,c,this._propertyTrack);break;case "angle":h=f.AngleTypeAdapter.Interpolate(b,a,c,this._propertyTrack);break;case "boolean":h=f.BooleanTypeAdapter.Interpolate(b,a,c,this._propertyTrack);break;case "color":h=f.ColorTypeAdapter.Interpolate(b,a,c,this._propertyTrack);break;case "text":h=f.TextTypeAdapter.Interpolate(b,a,c,this._propertyTrack)}this._propertyAdapter.ChangeProperty(b,h,a,c,d,e)}GetInterpolatedValue(b,a,c){switch(this._propertyTrack.GetPropertyKeyframeType()){case "numeric":return f.NumericTypeAdapter.Interpolate(b, a,c,this._propertyTrack);case "angle":return f.AngleTypeAdapter.Interpolate(b,a,c,this._propertyTrack);case "boolean":return f.BooleanTypeAdapter.Interpolate(b,a,c,this._propertyTrack);case "color":return f.ColorTypeAdapter.Interpolate(b,a,c,this._propertyTrack);case "text":return f.TextTypeAdapter.Interpolate(b,a,c,this._propertyTrack)}}AfterInterpolate(){this._propertyAdapter.AfterChangeProperty()}SaveState(){this.GetPropertyAdapter().SetSaveState()}ClearSaveState(){this.GetPropertyAdapter().ClearSaveState()}GetCurrentState(){return this.GetPropertyAdapter().GetCurrentState()}CompareInitialStateWithCurrent(){return this.GetPropertyAdapter().CompareInitialStateWithCurrent()}CompareSaveStateWithCurrent(){return this.GetPropertyAdapter().CompareSaveStateWithCurrent()}GetValueAtTime(){const b= this._propertyTrack,a=b.GetTrack().GetTimeline().GetTime(),c=f.GetStartPropertyKeyframeForTime(a,b),d=c.GetNext();switch(b.GetPropertyKeyframeType()){case "numeric":return f.NumericTypeAdapter.Interpolate(a,c,d,b);case "angle":return f.AngleTypeAdapter.Interpolate(a,c,d,b);case "boolean":return f.BooleanTypeAdapter.Interpolate(a,c,d,b);case "color":return f.ColorTypeAdapter.Interpolate(a,c,d,b);case "text":return f.TextTypeAdapter.Interpolate(a,c,d,b)}}_CreatePropertyAdapter(){const b=this._propertyTrack; switch(b.CanHavePropertyKeyframes()?b.GetPropertyKeyframeType():""){case "combo":case "boolean":case "text":case "string":return new f.PropertyInterpolationAdapter.NoInterpolationAdapter(this);case "numeric":case "number":case "angle":return"combo"===this._propertyTrack.GetPropertyType()?new f.PropertyInterpolationAdapter.NoInterpolationAdapter(this):new f.PropertyInterpolationAdapter.NumericInterpolationAdapter(this);case "color":case "offsetColor":return new f.PropertyInterpolationAdapter.ColorInterpolationAdapter(this); default:return new f.PropertyInterpolationAdapter.NumericInterpolationAdapter(this)}}_SaveToJson(){return{propertyAdapterJson:this.GetPropertyAdapter()._SaveToJson()}}_LoadFromJson(b){b&&this.GetPropertyAdapter()._LoadFromJson(b.propertyAdapterJson)}}} {"use strict";const f=self.C3;class b extends f.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a);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(a){this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]!==a&&(this._updatedIndex= a)}Interpolate(a,c,d,e,h){this.GetPropertyAdapter().CanChange(c.GetValue())&&super.Interpolate(a,c,d,e,h)}GetInterpolatedValue(a,c,d){if(this.GetPropertyAdapter().CanChange(c.GetValue()))return super.GetInterpolatedValue(a,c,d)}_SaveToJson(){return Object.assign(super._SaveToJson(),{index:this._updatedIndex})}_LoadFromJson(a){a&&(super._LoadFromJson(a),this._updatedIndex=a.index)}}f.PropertyTrackState.InstanceVariableSourceAdapter=b} {"use strict";const f=self.C3;class b extends f.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a);this._sid=NaN}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[1]}GetTarget(){var a=this._propertyTrack.GetPropertyTrackDataItem(),c=this._propertyTrack.GetTrack();a=this._sid?this._sid:a.GetSourceAdapterArguments()[0];c=c.GetInstance();a=c.GetBehaviorIndexBySID(a);return c.GetBehaviorInstances()[a].GetSdkInstance()}GetBehaviorType(a){const c= this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[2];return a.GetBehaviorTypeByName(c)}UpdateBehaviorTypeSid(a){this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]!==a&&(this._sid=a)}Interpolate(a,c,d,e,h){const g=this._propertyTrack.GetTrack().GetInstance();this.GetBehaviorType(g.GetObjectClass())&&super.Interpolate(a,c,d,e,h)}GetInterpolatedValue(a,c,d){const e=this._propertyTrack.GetTrack().GetInstance();if(this.GetBehaviorType(e.GetObjectClass()))return super.GetInterpolatedValue(a, c,d)}_SaveToJson(){return Object.assign(super._SaveToJson(),{sid:this._sid})}_LoadFromJson(a){a&&(super._LoadFromJson(a),this._sid=a.sid)}}f.PropertyTrackState.BehaviorSourceAdapter=b} {"use strict";const f=self.C3;class b extends f.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a)}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[1]}GetTarget(){const a=this._propertyTrack.GetTrack().GetWorldInfo().GetInstanceEffectList();var c=a.GetEffectList();c=this.GetEffectType(c).GetIndex();return a.IsEffectIndexActive(c)?a.GetEffectParametersForIndex(c):null}GetEffectType(a){const c=this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]; return a.GetEffectTypeByName(c)}Interpolate(a,c,d,e,h){this._IsEffectActive()&&super.Interpolate(a,c,d,e,h)}GetInterpolatedValue(a,c,d){if(this._IsEffectActive())return super.GetInterpolatedValue(a,c,d)}_IsEffectActive(){const a=this._propertyTrack.GetTrack().GetWorldInfo().GetInstanceEffectList();var c=a.GetEffectList();if(c=this.GetEffectType(c))return c=c.GetIndex(),a.IsEffectIndexActive(c)}}f.PropertyTrackState.EffectSourceAdapter=b} {"use strict";const f=self.C3;class b extends f.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a)}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]}GetTarget(){return this._propertyTrack.GetTrack().GetInstance().GetSdkInstance()}Interpolate(a,c,d,e,h){var g=this._propertyTrack.GetTrack();const l=g.GetObjectClass().GetPlugin();g=g.GetInstance().GetObjectClass().GetPlugin();l===g&&super.Interpolate(a,c,d,e,h)}GetInterpolatedValue(a, c,d){var e=this._propertyTrack.GetTrack();const h=e.GetObjectClass().GetPlugin();e=e.GetInstance().GetObjectClass().GetPlugin();if(h===e)return super.GetInterpolatedValue(a,c,d)}}f.PropertyTrackState.PluginSourceAdapter=b} {"use strict";const f=self.C3;class b extends f.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a);this._value=0;this._init=!1}MayNeedBeforeAndAfterInterpolate(){return!1}SetInitialState(){const a=this._propertyTrack.GetPropertyTrackData();let c=this._propertyTrack.GetPropertyTrackDataItem();c=a.GetFirstPropertyKeyframeDataItem(c);this._value=c.GetValueWithResultMode()}SetResumeState(){}GetValue(){this._init||this._propertyTrack.Interpolate(0);return this._value}Interpolate(a,c,d,e, h){this._value=f.PropertyTrackState.NumericTypeAdapter.Interpolate(a,c,d,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(a){a&&(this._value=a.value,this._init=a.hasOwnProperty("init")?a.init:!0)}}f.PropertyTrackState.ValueSourceAdapter=b} {"use strict";const f=self.C3;class b extends f.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a);this._audioPlaybackStarted=!1;this._expressions=this._actions=this._sdkInstance=null;this._timeline=this._propertyTrack.GetTimeline();this._track=this._propertyTrack.GetTrack();this._sourceAdapterArgs=this._propertyTrack.GetSourceAdapterArgs();this._fileArgs=this._sourceAdapterArgs[0];this._startOffsetTime=this._sourceAdapterArgs[1];this._audioTag=this._sourceAdapterArgs[3]?this._sourceAdapterArgs[3]: Math.random().toString(36).slice(2);this._volume=this._pauseVolume=this._pauseTime=NaN;this._audioSource=null;this._Initialize()}Release(){super.Release();this._audioSource=this._fileArgs=this._sourceAdapterArgs=this._track=this._timeline=this._expressions=this._actions=this._sdkInstance=null}_Initialize(){if(self.C3.Plugins.Audio){var a=this._propertyTrack.GetRuntime().GetObjectClassByName("audio");a&&(this._sdkInstance=a.GetSingleGlobalInstance().GetSdkInstance());this._actions=self.C3.Plugins.Audio.Acts; this._expressions=self.C3.Plugins.Audio.Exps}}_MaybeSetAudioSource(){if(!this._audioSource){var a=this._propertyTrack.GetTrack().GetPropertyTrack("audioSource");a&&(this._audioSource=a.GetSourceAdapter())}}_GetPauseVolume(){const a=this._propertyTrack.GetTrack().GetPropertyTrack("volume");return a?a.GetSourceAdapter()._pauseVolume:this._pauseVolume}TimelineRemoved(){super.TimelineRemoved();this._audioPlaybackStarted=!1;this._sdkInstance&&(this._expressions&&(this._pauseTime=this._expressions.PlaybackTime.call(this._sdkInstance, this._audioTag),this._pauseVolume=this._expressions.Volume.call(this._sdkInstance,this._audioTag)),this._actions&&this._actions.Stop.call(this._sdkInstance,this._audioTag))}GetAudioTag(){return this._audioTag}GetVolume(){return this._volume}SetVolume(a){this._volume=a}SetInitialState(){super.SetInitialState();this._pauseTime=NaN;this._audioPlaybackStarted=!1}SetResumeState(){super.SetResumeState();const a=this._propertyTrack.GetTimeline().GetTime();this._pauseTime=a-this._startOffsetTime;switch(this._propertyTrack.GetPropertyName()){case "volume":this._pauseVolume= this._propertyTrack.GetInterpolatedValue(a)}this._audioPlaybackStarted=!1}Interpolate(a,c,d,e,h){if(this._sdkInstance)switch(this._propertyTrack.GetPropertyName()){case "audioSource":if(!this._timeline.IsForwardPlayBack())break;if(e){this._actions&&this._actions.Stop.call(this._sdkInstance,this._audioTag);break}if(a{if("suspended"===m)this._audioPlaybackStarted=!1;else if(m=(self.performance.now()-g)/1E3,m=l+m,this._actions){let u=this.GetVolume();isNaN(u)?(this.SetVolume(0),u=0):this.SetVolume(u);this._actions.Play.call(this._sdkInstance,this._fileArgs,0,u,this._audioTag,m)}})}else{const g= this._pauseTime;this._pauseTime=NaN;const l=this._GetPauseVolume();this._pauseVolume=NaN;this._sdkInstance.PostToDOMAsync("get-suspended").then(m=>{"suspended"===m?this._audioPlaybackStarted=!1:this._actions&&(this.SetVolume(l),this._actions.Play.call(this._sdkInstance,this._fileArgs,0,l,this._audioTag,g))})}break;case "volume":this._MaybeSetAudioSource(),super.Interpolate(a,c,d,e,h)}}GetInterpolatedValue(a,c,d){if(this._sdkInstance)switch(this._propertyTrack.GetPropertyName()){case "volume":return this._MaybeSetAudioSource(), super.GetInterpolatedValue(a,c,d)}}Getter(a,c){return this._audioSource?this._audioSource.GetVolume():0}Setter(a,c,d,e){this._audioSource&&this._audioSource.SetVolume(this.Getter()+c);this._actions&&this._audioSource&&this._actions.SetVolume.call(this._sdkInstance,this._audioSource.GetAudioTag(),this._audioSource.GetVolume())}AbsoluteSetter(a,c,d){this._audioSource&&this._audioSource.SetVolume(c);this._actions&&this._audioSource&&this._actions.SetVolume.call(this._sdkInstance,this._audioSource.GetAudioTag(), this._audioSource.GetVolume())}DoesRounding(){return!0}_SaveToJson(){return{audioPlaybackStarted:this._audioPlaybackStarted,audioTag:this._audioTag,pauseTime:this._pauseTime,pauseVolume:this._pauseVolume,volume:this._volume}}_LoadFromJson(a){a&&(this._audioPlaybackStarted=a.audioPlaybackStarted,this._audioTag=a.audioTag,this._pauseTime=a.pauseTime,this._pauseVolume=a.pauseVolume,this._volume=a.volume,this._Initialize())}}f.PropertyTrackState.AudioSourceAdapter=b}"use strict"; self.C3.PropertyTrackState.PropertyInterpolationAdapter=class{constructor(f){this._sourceAdapter=f;this._propertyTrack=f.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}MayNeedBeforeAndAfterInterpolate(){return!1}TimelineRemoved(){}CleanCaches(){this._target= this._saveState=this._worldInfo=null}GetSourceAdapter(){return this._sourceAdapter}GetPropertyTrack(){return this._propertyTrack}GetWorldInfo(){return this._worldInfo?this._worldInfo:this._worldInfo=this._propertyTrack.GetTrack().GetWorldInfo()}SetFirstAbsoluteUpdate(f){this._firstAbsoluteUpdate=!!f}GetFirstAbsoluteUpdate(){return this._firstAbsoluteUpdate}SetInitialState(){}SetResumeState(){}SetSaveState(){this._saveState=this.GetCurrentState()}ClearSaveState(){this._saveState=null}GetCurrentState(){}CompareInitialStateWithCurrent(){}CompareSaveStateWithCurrent(){}CanChange(f){return typeof this._Getter()=== typeof f}BeforeChangeProperty(){}ChangeProperty(f,b,a,c,d){}AfterChangeProperty(){}_FirstKeyframeGetter(){return this._PickTimelinePlaybackMode(()=>{const f=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetFirstPropertyKeyframeDataItem(f)},()=>{const f=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(f)}).GetAbsoluteValue()}_CurrentKeyframeGetter(){const f=this._propertyTrack.GetTimeline().GetTime()- this._propertyTrack.GetTrack().GetStartOffset();return this._PickTimelinePlaybackMode(()=>{const b=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(f,b)},()=>{const b=this._propertyTrack.GetPropertyTrackDataItem(),a=this._propertyTrack.GetPropertyTrackData(),c=a.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(f,b);return c?c:a.GetLastPropertyKeyframeDataItem(b)}).GetAbsoluteValue()}_PickTimelinePlaybackMode(f, b){return this._propertyTrack.GetTimeline().IsForwardPlayBack()?f():b()}_PickResultMode(f,b){return"relative"===this._propertyTrack.GetResultMode()?f():b()}_PickFirstAbsoluteUpdate(f,b){return this.GetFirstAbsoluteUpdate()?(this.SetFirstAbsoluteUpdate(!1),f()):b()}_GetAbsoluteInitialValue(f){}_GetIndex(){return this._sourceAdapter.GetIndex()}_GetTarget(){return this._target?this._target:this._target=this._sourceAdapter.GetTarget()}_PickSource(f,b,a,c,d,e){switch(this._propertyTrack.GetSourceAdapterId()){case "behavior":return f(); case "effect":return b();case "instance-variable":return a();case "plugin":return c();case "world-instance":return d();case "audio":return e()}}_SaveToJson(){return{firstAbsoluteUpdate:this._firstAbsoluteUpdate,saveState:this._saveState}}_LoadFromJson(f){f&&(this._firstAbsoluteUpdate=f.firstAbsoluteUpdate,this._saveState=f.saveState)}_GetPropertyKeyframeStubs(f,b=!1){const a=[];for(const c of f){f=c.GetTrack().GetStartOffset();for(const d of c.GetPropertyKeyframeDataItems())b&&0===d.GetTime()?a.push({time:f+ d.GetTime(),value:d.GetAbsoluteValue()}):b||a.push({time:f+d.GetTime(),value:d.GetAbsoluteValue()})}return a.sort((c,d)=>c.time-d.time)}_GetLastPropertyKeyframeStub(f,b,a){return this._GetPropertyKeyframeStubLowerThanPlayhead(b,a)}_GetPropertyKeyframeStubLowerThanPlayhead(f,b){for(let a=b.length-1;0<=a;a--)if(b[a].time<=f)return b[a];return null}}; {"use strict";const f=self.C3,b=new Map,a=[0,0,0];class c extends f.PropertyTrackState.PropertyInterpolationAdapter{constructor(d){super(d)}SetInitialState(){}SetResumeState(){}GetCurrentState(){const d=this._propertyTrack.GetSourceAdapterId(),e=this._GetTarget(),h=this._GetIndex();switch(d){case "behavior":return this._ToColorArray(e.GetPropertyValueByIndex(h));case "effect":return this._ToColorArray(e[h]);case "plugin":return this._ToColorArray(e.GetPropertyValueByIndex(h));case "world-instance":return this._ToColorArray(this._Getter())}}CompareInitialStateWithCurrent(){const d= this._FirstKeyframeGetter();return!this._CompareColors(d,this._Getter())}CompareSaveStateWithCurrent(){return f.IsNullOrUndefined(this._saveState)?!1:!this._CompareColors(this._saveState,this._Getter())}_CompareColors(d,e){return d.equalsIgnoringAlpha(e)}_FirstKeyframeGetter(){const d=super._FirstKeyframeGetter();return this._GetColorFromArray(d)}_CurrentKeyframeGetter(){const d=super._CurrentKeyframeGetter();return this._GetColorFromArray(d)}_GetAbsoluteInitialValue(d){}_ToColorArray(d){return f.IsInstanceOf(d, f.Color)?d.toArray().slice(0,3):d.slice(0,3)}_GetColorFromArray(d){return f.IsInstanceOf(d,f.Color)?d:new f.Color(d[0],d[1],d[2],1)}CanChange(d){return!0}MayNeedBeforeAndAfterInterpolate(){return!0}BeforeChangeProperty(){var d=this._propertyTrack.GetTimeline(),e=this._propertyTrack.GetInstance();const h=this._propertyTrack.GetSourceAdapter();(d=d.GetSimilarPropertyTracks(e,h,this._property))&&1m||(l=e[0],g=e[1],e=e[2],m=this._propertyTrack.Interpolate(m,!1,!0),l=f.Color.DiffChannel(l,m[0]),g=f.Color.DiffChannel(g,m[1]),e=f.Color.DiffChannel(e,m[2]),this._GetTmpColor(d,h,this._property).addRgb(l,g,e))}else this._Setter(e[0],e[1],e[2])}AfterChangeProperty(){const d=this._propertyTrack.GetInstance();if(b.has(d)){var e=b.get(d),h=this._propertyTrack.GetSourceAdapterId(); if(e.has(h)){var g=e.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&&e.delete(h);0===e.size&&b.delete(d)}}}}_Getter(){const d=this._propertyTrack.GetSourceAdapterId(),e=this._GetTarget(),h=this._GetIndex();switch(d){case "behavior":return this._GetColorFromArray(e.GetPropertyValueByIndex(h));case "effect":return e[h].clone();case "plugin":return this._GetColorFromArray(e.GetPropertyValueByIndex(h));case "world-instance":return this.GetWorldInfo().GetUnpremultipliedColor().clone()}}_Setter(d, e,h){const g=this._propertyTrack.GetSourceAdapterId(),l=this._GetTarget(),m=this._GetIndex();switch(g){case "behavior":a[0]=d;a[1]=e;a[2]=h;l.SetPropertyValueByIndex(m,a);break;case "effect":l[m].setRgb(d,e,h);break;case "plugin":a[0]=d;a[1]=e;a[2]=h;l.SetPropertyValueByIndex(m,a);break;case "world-instance":this.GetWorldInfo().SetUnpremultipliedColorRGB(d,e,h)}}_SaveToJson(){}_LoadFromJson(d){}}f.PropertyTrackState.PropertyInterpolationAdapter.ColorInterpolationAdapter=c} {"use strict";const f=self.C3,b=f.PropertyTrackState;class a extends f.PropertyTrackState.PropertyInterpolationAdapter{constructor(c){super(c)}SetInitialState(){}SetResumeState(){}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){return this._FirstKeyframeGetter()!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return f.IsNullOrUndefined(this._saveState)?!1:this._saveState!==this.GetCurrentState()}MayNeedBeforeAndAfterInterpolate(){return!1}ChangeProperty(c,d,e,h,g){e= this._propertyTrack;const l=e.GetTrack();h=e.GetSourceAdapterId();g=e.GetTimeline();var m=l.GetInstance();const u=e.GetSourceAdapter();(m=g.GetSimilarPropertyTracks(m,u,this._property))&&1b.set(d,{setter:e,absolute_setter:h,getter:g,round:l});a("offsetX",(d,e)=>d.OffsetX(e),(d,e)=>d.SetX(e),d=>d.GetX(),!0);a("offsetY",(d,e)=>d.OffsetY(e),(d,e)=>d.SetY(e),d=>d.GetY(),!0);a("offsetWidth",(d,e)=>d.OffsetWidth(e),(d,e)=>d.SetWidth(e),d=>d.GetWidth(),!0);a("offsetHeight",(d,e)=>d.OffsetHeight(e),(d,e)=>d.SetHeight(e),d=>d.GetHeight(),!0);a("offsetAngle",(d,e)=>d.OffsetAngle(e),(d,e)=>d.SetAngle(e),d=>d.GetAngle(),!1);a("offsetOpacity",(d, e,h,g)=>{h=d.GetOpacity()+e;0===g._clampAccumulator?(1h&&(g._clampAccumulator+=h),d.OffsetOpacity(e)):(d=d.GetOpacity()+e,0g._clampAccumulator?(g._clampAccumulator+=e,0e&&0g._clampAccumulator&&(g._clampAccumulator=0)):0>e&&0>g._clampAccumulator&&0>d&&(g._clampAccumulator+=d))},(d,e)=>{d.SetOpacity(e)},d=>d.GetOpacity(), !1);a("offsetOriginX",(d,e)=>d.OffsetOriginX(e),(d,e)=>d.SetOriginX(e),d=>d.GetOriginX(),!1);a("offsetOriginY",(d,e)=>d.OffsetOriginY(e),(d,e)=>d.SetOriginY(e),d=>d.GetOriginY(),!1);a("offsetZElevation",(d,e)=>d.OffsetZElevation(e),(d,e)=>d.SetZElevation(e),d=>d.GetZElevation(),!0);a("offsetScaleX",(d,e,h,g)=>{g=0>d.GetWidth()?-1:1;d.GetTransformWithParentWidth();d.OffsetWidth(h.GetOriginalWidth()*g*e)},(d,e,h)=>{d.SetWidth(h.GetOriginalWidth()*e)},(d,e)=>{const h=0>d.GetWidth()?-1:1;if(d.GetTransformWithParentWidth()){var g= d.GetParent(),l=e.GetTimeline().GetTrackFromInstance(g.GetInstance());l?g=g.GetWidth()/l.GetOriginalWidth():(l=g.GetInstance().GetSdkInstance(),g=l.IsOriginalSizeKnown()?g.GetWidth()/l.GetOriginalWidth():1);return d.GetWidth()*h/(e.GetOriginalWidth()*g)}return d.GetWidth()*h/e.GetOriginalWidth()},!1);a("offsetScaleY",(d,e,h,g)=>{g=0>d.GetHeight()?-1:1;d.GetTransformWithParentHeight();d.OffsetHeight(h.GetOriginalHeight()*g*e)},(d,e,h)=>{d.SetHeight(h.GetOriginalHeight()*e)},(d,e)=>{const h=0>d.GetHeight()? -1:1;if(d.GetTransformWithParentHeight()){var g=d.GetParent(),l=e.GetTimeline().GetTrackFromInstance(g.GetInstance());l?g=g.GetHeight()/l.GetOriginalHeight():(l=g.GetInstance().GetSdkInstance(),g=l.IsOriginalSizeKnown()?g.GetHeight()/l.GetOriginalHeight():1);return d.GetHeight()*h/(e.GetOriginalHeight()*g)}return d.GetHeight()*h/e.GetOriginalHeight()},!1);class c extends f.PropertyTrackState.PropertyInterpolationAdapter{constructor(d){super(d);this._clampAccumulator=this._lastValue=0;this._source_adapter_absolute_setter= this._source_adapter_setter=this._source_adapter_getter=this._instance_absolute_setter=this._instance_setter=this._instance_getter=null;this._round=!1;f.IsInstanceOf(this._propertyTrack.GetTimeline(),f.TweenState)?this._typeAdapter=new f.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTween(this):this._typeAdapter=new f.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTimeline(this);const e=this._propertyTrack.GetPropertyName();switch(this._propertyTrack.GetSourceAdapterId()){case "world-instance":d= b.get(e);this._instance_getter=d.getter;this._instance_setter=d.setter;this._instance_absolute_setter=d.absolute_setter;this._round=d.round;break;case "audio":this._source_adapter_getter=d.Getter,this._source_adapter_setter=d.Setter,this._source_adapter_absolute_setter=d.AbsoluteSetter,this._round=!!d.DoesRounding()}}Release(){this._instance_absolute_setter=this._instance_setter=this._instance_getter=this._typeAdapter=null;super.Release()}MayNeedBeforeAndAfterInterpolate(){return this._typeAdapter.MayNeedBeforeAndAfterInterpolate()}GetLastValue(){return this._lastValue}SetLastValue(d){this._lastValue= d}SetInitialState(){const d=this._typeAdapter.SetInitialState();"number"===typeof d&&(this._lastValue=d);this._clampAccumulator=0}SetResumeState(){const d=this._typeAdapter.SetResumeState();"number"===typeof d&&(this._lastValue=d)}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){return this._FirstKeyframeGetter()!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return f.IsNullOrUndefined(this._saveState)?!1:this._saveState!==this.GetCurrentState()}BeforeChangeProperty(){this._typeAdapter.BeforeChangeProperty()}ChangeProperty(d, e,h,g,l,m,u){return this._typeAdapter.ChangeProperty(d,e,h,g,l,m,u)}AfterChangeProperty(){this._typeAdapter.AfterChangeProperty()}_Getter(){const d=this._GetTarget(),e=this._GetIndex(),h=this.GetWorldInfo(),g=this._propertyTrack.GetTrack();switch(this._propertyTrack.GetSourceAdapterId()){case "behavior":return d.GetPropertyValueByIndex(e);case "effect":return d[e];case "instance-variable":return d.GetInstanceVariableValue(e);case "plugin":return d.GetPropertyValueByIndex(e);case "world-instance":return this._instance_getter(h, g);case "audio":return this._source_adapter_getter.call(this.GetSourceAdapter(),h,g)}}_Setter(d,e,h){e=this._GetTarget();h=this._GetIndex();const g=this.GetWorldInfo(),l=this._propertyTrack.GetTrack();switch(this._propertyTrack.GetSourceAdapterId()){case "behavior":e.OffsetPropertyValueByIndex(h,d);break;case "effect":e[h]+=d;break;case "instance-variable":e.SetInstanceVariableOffset(h,d);break;case "plugin":e.OffsetPropertyValueByIndex(h,d);break;case "world-instance":this._instance_setter(g,d,l, this);break;case "audio":this._source_adapter_setter.call(this.GetSourceAdapter(),g,d,l,this)}}_SetterAbsolute(d,e,h){e=this._GetTarget();h=this._GetIndex();const g=this.GetWorldInfo(),l=this._propertyTrack.GetTrack();switch(this._propertyTrack.GetSourceAdapterId()){case "behavior":e.SetPropertyValueByIndex(h,d);break;case "effect":e[h]=d;break;case "instance-variable":e.SetInstanceVariableValue(h,d);break;case "plugin":e.SetPropertyValueByIndex(h,d);break;case "world-instance":this._instance_absolute_setter(g, d,l);break;case "audio":this._source_adapter_absolute_setter.call(this.GetSourceAdapter(),g,d,l)}}_MaybeEnsureValue(d,e,h,g,l,m){this._typeAdapter._MaybeEnsureValue(d,e,h,g,l,m)}_AddDelta(d,e,h){var g=(d.toString().split(".")[1]||"").length;d=this._Getter();g=0===g?this._round?Math.round(d):d:f.toFixed(d,g);this._Setter(g-d,e,h)}_SaveToJson(){return Object.assign(super._SaveToJson(),{v:this._lastValue,a:this._clampAccumulator})}_LoadFromJson(d){d&&(super._LoadFromJson(d),this._lastValue=d.v,this._clampAccumulator= d.a)}}f.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapter=c} {"use strict";class f{constructor(a){this._used=!1;this._value=0;this._propertyTracks=a;for(let c=0,d=this._propertyTracks.length;ca._PickTimelinePlaybackMode(()=>0,()=>a.GetSourceAdapter().GetValueAtTime()),()=>{})}SetResumeState(){}MayNeedBeforeAndAfterInterpolate(){switch(this._numericInterpolationAdapter.GetPropertyTrack().GetResultMode()){case "relative":return!1;case "absolute":return!0}}BeforeChangeProperty(){var a=this._numericInterpolationAdapter.GetPropertyTrack(),c=a.GetPropertyName();switch(a.GetResultMode()){case "absolute":if(a.HasAbsoluteValueObject())a.GetAbsoluteValueObject().Reset(); else{const d=a.GetTimeline(),e=a.GetInstance();a=a.GetSourceAdapter();(c=d.GetSimilarPropertyTracks(e,a,c))&&1l||(m=m.GetInterpolatedValue(l),a.SetUsed(),a.SetValue(a.GetValue()+(c-m)))}else l._SetterAbsolute(c)}}AfterChangeProperty(){const a=this._numericInterpolationAdapter;var c=this._numericInterpolationAdapter.GetPropertyTrack();switch(c.GetResultMode()){case "absolute":c.HasAbsoluteValueObject()&& (c=c.GetAbsoluteValueObject(),c.GetUsed()&&a._SetterAbsolute(c.GetValue()))}}_MaybeEnsureValue(a,c,d,e,h,g){const l=this._numericInterpolationAdapter;e||(c&&a===c.GetTime()?l._AddDelta(c.GetValueWithResultMode(),c,d):d&&a===d.GetTime()?l._AddDelta(d.GetValueWithResultMode(),c,d):0===g-h&&l._AddDelta(c.GetValueWithResultMode(),c,d))}}self.C3.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTimeline=b} {"use strict";class f{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())}MayNeedBeforeAndAfterInterpolate(){return!1}BeforeChangeProperty(){}ChangeProperty(b, a,c,d,e,h){const g=this._numericInterpolationAdapter,l=g.GetLastValue();switch(g.GetPropertyTrack().GetResultMode()){case "relative":g._Setter(a-l,c,d);h&&this._MaybeEnsureValue(b,c,d,e,l,a);break;case "absolute":g.GetFirstAbsoluteUpdate()?(g.SetFirstAbsoluteUpdate(!1),g._Setter(l,c,d)):(g._Setter(a-l,c,d),h&&this._MaybeEnsureValue(b,c,d,e,l,a))}g.SetLastValue(a)}AfterChangeProperty(){}_GetAbsoluteInitialValue(b){return b-this._numericInterpolationAdapter.GetCurrentState()}_MaybeEnsureValue(b,a,c, d,e,h){const g=this._numericInterpolationAdapter;d?a&&b===a.GetTime()?g._AddDelta(a.GetValueWithResultMode(),a,c):c&&b===c.GetTime()?g._AddDelta(c.GetValueWithResultMode(),a,c):c||g._AddDelta(a.GetValueWithResultMode(),a,c):a&&b===a.GetTime()?g._AddDelta(a.GetValueWithResultMode(),a,c):c&&b===c.GetTime()?g._AddDelta(c.GetValueWithResultMode(),a,c):0===h-e&&g._AddDelta(a.GetValueWithResultMode(),a,c)}}self.C3.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTween=f} {"use strict";const f=self.C3,b=self.Ease;f.PropertyTrackState.NumericTypeAdapter=class{constructor(){}static WillChange(a,c,d,e){let h;switch(e){case "behavior":h=c.GetPropertyValueByIndex(a);break;case "effect":h=c[a];break;case "instance-variable":h=c.GetInstanceVariableValue(a);break;case "plugin":h=c.GetPropertyValueByIndex(a)}return h===d?!1:!0}static Interpolate(a,c,d,e){if(!d)return d=e.GetPropertyTrackDataItem(),d=e.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(d),d.GetValueWithResultMode(); var h=e.GetInterpolationMode();"default"===h&&(h="continuous");"combo"===e.GetPropertyType()&&(h="discrete");if("discrete"===h)return c.GetValueWithResultMode();if("continuous"===h||"step"===h){"step"===h&&(h=e.GetTimeline().GetStep(),0!==h&&(h=1/h,a=Math.floor(a*h)/h));var g=c.GetTime();const l=d.GetTime();h=c.GetValueWithResultMode();const m=d.GetValueWithResultMode();if(h===m)return h;a=f.normalize(a,g,l);const u=c.GetEase();c=c.GetAddOn("cubic-bezier");d=d.GetAddOn("cubic-bezier");c&&c.GetStartEnable()&& d&&d.GetEndEnable()?(g=l-g,g=b.GetRuntimeEase(u)(g*a,0,1,g),g=b.GetRuntimeEase("cubicbezier")(g,h,h+c.GetStartAnchor(),m+d.GetEndAnchor(),m)):g=b.GetRuntimeEase(u)((l-g)*a,h,m-h,l-g);return"integer"===e.GetPropertyType()?Math.floor(g):g}}}} {"use strict";const f=self.C3;f.PropertyTrackState.AngleTypeAdapter=class{constructor(){}static WillChange(b,a,c,d){let e;switch(d){case "behavior":e=a.GetPropertyValueByIndex(b);break;case "effect":e=a[b];break;case "instance-variable":e=a.GetInstanceVariableValue(b);break;case "plugin":e=a.GetPropertyValueByIndex(b)}return e===c?!1:!0}static Interpolate(b,a,c,d){if(!c)return a=d.GetPropertyTrackDataItem(),a=d.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(a),a.GetValueWithResultMode();var e= d.GetInterpolationMode();"default"===e&&(e="continuous");"combo"===d.GetPropertyType()&&(e="discrete");if("discrete"===e)return a.GetValueWithResultMode();if("continuous"===e||"step"===e){"step"===e&&(d=d.GetTimeline().GetStep(),0!==d&&(d=1/d,b=Math.floor(b*d)/d));const h=a.GetTime(),g=c.GetTime();d=a.GetValueWithResultMode();c=c.GetValueWithResultMode();if(e=a.GetAddOn("angle")){const l=e.GetRevolutions();if(d===c&&0===l)return d;b=f.normalize(b,h,g);a=self.Ease.GetRuntimeEase(a.GetEase())(b,0,1, 1);switch(e.GetDirection()){case "closest":return f.angleLerp(d,c,a,l);case "clockwise":return f.angleLerpClockwise(d,c,a,l);case "anti-clockwise":return f.angleLerpAntiClockwise(d,c,a,l)}}else{if(d===c)return d;b=f.normalize(b,h,g);a=self.Ease.GetRuntimeEase(a.GetEase());return f.angleLerp(d,c,a(b,0,1,1))}}}}}"use strict"; self.C3.PropertyTrackState.BooleanTypeAdapter=class{constructor(){}static WillChange(f,b,a,c){let d;switch(c){case "behavior":d=b.GetPropertyValueByIndex(f);break;case "effect":d=b[f];break;case "instance-variable":d=b.GetInstanceVariableValue(f);break;case "plugin":d=b.GetPropertyValueByIndex(f)}return!!d===!!a?!1:!0}static Interpolate(f,b,a,c){return a?b.GetValueWithResultMode()?1:0:(f=c.GetPropertyTrackDataItem(),f=c.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(f),f.GetValueWithResultMode()? 1:0)}}; {"use strict";const f=self.C3,b=[0,0,0],a=[0,0,0],c=[0,0,0];f.PropertyTrackState.ColorTypeAdapter=class{constructor(){}static WillChange(d,e,h,g){let l;switch(g){case "behavior":l=e.GetPropertyValueByIndex(d);break;case "effect":l=e[d];break;case "instance-variable":l=e.GetInstanceVariableValue(d);break;case "plugin":l=e.GetPropertyValueByIndex(d)}Array.isArray(h)?(b[0]=h[0],b[1]=h[1],b[2]=h[2]):(c.parseCommaSeparatedRgb(h),b[0]=Math.floor(255*c.getR()),b[1]=Math.floor(255*c.getG()),b[2]=Math.floor(255*c.getB())); Array.isArray(l)?(a[0]=l[0],a[1]=l[1],a[2]=l[2]):(c.parseCommaSeparatedRgb(l),a[0]=Math.floor(255*c.getR()),a[1]=Math.floor(255*c.getG()),a[2]=Math.floor(255*c.getB()));return b[0]!==a[0]||b[1]!==a[1]||b[2]!==a[2]?!0:!1}static Interpolate(d,e,h,g){if(!h){var l=g.GetPropertyTrackDataItem();l=g.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(l);g=l.GetValueWithResultMode();b[0]=g[0];b[1]=g[1];b[2]=g[2];return b}l=g.GetInterpolationMode();"default"===l&&(l="continuous");if("discrete"===l)return g= e.GetValueWithResultMode(),b[0]=g[0],b[1]=g[1],b[2]=g[2],b;if("continuous"===l||"step"===l){"step"===l&&(g=g.GetTimeline().GetStep(),0!==g&&(g=1/g,d=Math.floor(d*g)/g));g=e.GetTime();l=h.GetTime();var m=e.GetValueWithResultMode(),u=h.GetValueWithResultMode();d=f.normalize(d,g,l);var w=e.GetEase();e=m[0];h=m[1];m=m[2];const q=u[0],t=u[1];u=u[2];w=self.Ease.GetRuntimeEase(w);g=l-g;l=g*d;b[0]=e===q?e:w(l,e,q-e,g);b[1]=h===t?h:w(l,h,t-h,g);b[2]=m===u?m:w(l,m,u-m,g);return b}}}}"use strict"; self.C3.PropertyTrackState.TextTypeAdapter=class{constructor(){}static WillChange(f,b,a,c){let d;switch(c){case "behavior":d=b.GetPropertyValueByIndex(f);break;case "effect":d=b[f];break;case "instance-variable":d=b.GetInstanceVariableValue(f);break;case "plugin":d=b.GetPropertyValueByIndex(f)}return d===a?!1:!0}static Interpolate(f,b,a,c){return a?b.GetValueWithResultMode():(f=c.GetPropertyTrackDataItem(),f=c.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(f),f.GetValueWithResultMode())}}; {"use strict";const f=self.C3;f.TimelineDataManager=class{constructor(){this._timelineDataItems=new Map}Release(){for(const b of this._timelineDataItems.values())b.Release();this._timelineDataItems.clear();this._timelineDataItems=null}Add(b){b=new f.TimelineDataItem(b);const a=b.GetName();this._timelineDataItems.set(a,b)}Get(b){return this._timelineDataItems.get(b)}GetNameId(){return 0}static _CreateDataItems(b,a,c,d){if(a)for(const e of a)f.TimelineDataManager._CreateDataItem("create",e,b,c,d)}static _LoadDataItemsFromJson(b, a,c,d){b.length?a.forEach((e,h)=>{b[h]._LoadFromJson(e)}):a.forEach(e=>{f.TimelineDataManager._CreateDataItem("load",e,b,c,d)})}static _CreateDataItem(b,a,c,d,e){let h;if("function"===typeof d)switch(b){case "load":h=new d(null,e);break;case "create":h=new d(a,e)}else if("object"===typeof d)switch(d=d.map.get(a[d.prop]),b){case "load":h=new d(null,e);break;case "create":h=new d(a,e)}switch(b){case "load":h._LoadFromJson(a);c.push(h);break;case "create":if("function"===typeof h.GetEnable&&!h.GetEnable())return h.Release(); c.push(h)}}}} {"use strict";const f=self.C3;f.TimelineDataItem=class{constructor(b){this._name="";this._totalTime=NaN;this._step=0;this._resultMode=this._interpolationMode="default";this._pingPong=this._loop=!1;this._repeatCount=1;this._trackData=null;b&&(this._name=b[0],this._totalTime=b[1],this._step=b[2],this._interpolationMode=b[3],this._resultMode=b[4],this._loop=!!b[6],this._pingPong=!!b[7],this._repeatCount=b[8],this._trackData=new f.TrackData(b[5],this))}Release(){this._trackData.Release();this._trackData= null}GetTrackData(){this._trackData||(this._trackData=new f.TrackData(null,this));return this._trackData}GetName(){return this._name}SetName(b){this._name=b}GetTotalTime(){return this._totalTime}SetTotalTime(b){this._totalTime=b}GetStep(){return this._step}SetStep(b){this._step=b}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(b){this._interpolationMode=b}GetResultMode(){return this._resultMode}SetResultMode(b){this._resultMode=b}GetLoop(){return this._loop}SetLoop(b){this._loop= b}GetPingPong(){return this._pingPong}SetPingPong(b){this._pingPong=b}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(b){b&&(this.GetTrackData()._LoadFromJson(b.trackDataJson),this._name=b.name,this._totalTime=b.totalTime,this._step= b.step,this._interpolationMode=b.interpolationMode,this._resultMode=b.resultMode,this._loop=b.loop,this._pingPong=b.pingPong,this._repeatCount=b.repeatCount)}}} {"use strict";const f=self.C3;class b{constructor(a,c){this._trackData=c;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="";a&&(a[0]&&(this._instanceData=a[0],this._instanceUid=a[0][2], this._objectClassIndex=a[0][1]),this._interpolationMode=a[1],this._resultMode=a[2],this._enabled=!!a[3],a[6]&&(this._id=a[6]),a[7]&&(this._nestedData=a[7],this._startOffset=a[7][0],this._localTotalTime=a[7][1]),a[8]&&(this._additionalInstanceData=a[8]),a[8]&&(this._additionalInstanceData=a[8]),a[9]&&(this._type=a[9]),a[10]&&(this._name=a[10]),this._keyframeData=new f.KeyframeData(a[4],this),this._propertyTrackData=new f.PropertyTrackData(a[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 f.KeyframeData(null,this));return this._keyframeData}GetPropertyTrackData(){this._propertyTrackData||(this._propertyTrackData=new f.PropertyTrackData(null,this));return this._propertyTrackData}GetInstanceData(){return this._instanceData}GetObjectClassIndex(){return this._objectClassIndex}SetObjectClassIndex(a){this._objectClassIndex= a}GetInstanceUID(){return this._instanceUid}SetInstanceUID(a){this._instanceUid=a}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(a){this._interpolationMode=a}GetResultMode(){return this._resultMode}SetResultMode(a){this._resultMode=a}GetEnable(){return this._enabled}SetEnable(a){this._enabled=!!a}GetId(){return this._id}GetStartOffset(){return this._startOffset}GetLocalTotalTime(){return this._localTotalTime}SetLocalTotalTime(a){this._localTotalTime=a}GetOriginalWidth(){return this._additionalInstanceData[0]}SetOriginalWidth(a){this._additionalInstanceData|| (this._additionalInstanceData=[]);this._additionalInstanceData[0]=a}GetOriginalHeight(){this._additionalInstanceData||(this._additionalInstanceData=[]);return this._additionalInstanceData[1]}SetOriginalHeight(a){this._additionalInstanceData||(this._additionalInstanceData=[]);this._additionalInstanceData[1]=a}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(a){a&&(this._instanceData=a.instanceData,this._instanceUid=a.instanceUid,this._objectClassIndex=a.objectClassIndex,this._interpolationMode=a.interpolationMode,this._resultMode=a.resultMode,this._enabled= a.enabled,this._id=a.id,this._type=a.type?a.type:0,this._name=a.name?a.name:"",this._localTotalTime=this._trackData.GetTimelineDataItem().GetTotalTime(),a.nestedData&&(this._nestedData=a.nestedData,this._startOffset=this._nestedData[0],this._localTotalTime=this._nestedData[1]),a.additionalInstanceData&&(this._additionalInstanceData=a.additionalInstanceData),this.GetKeyframeData()._LoadFromJson(a.keyframeDataJson),this.GetPropertyTrackData()._LoadFromJson(a.propertyTrackDataJson))}}f.TrackData=class{constructor(a, c){this._timelineDataItem=c;this._trackDataItems=[];f.TimelineDataManager._CreateDataItems(this._trackDataItems,a,b,this)}Release(){this._timelineDataItem=null;for(const a of this._trackDataItems)a.Release();f.clearArray(this._trackDataItems);this._trackDataItems=null}GetTimelineDataItem(){return this._timelineDataItem}AddEmptyTrackDataItem(){const a=new b(null,this);this._trackDataItems.push(a);return a}GetFirstKeyframeDataItem(a){return a.GetKeyframeData().GetKeyframeDataItemArray()[0]}GetLastKeyframeDataItem(a){return a.GetKeyframeData().GetKeyframeDataItemArray().at(-1)}GetKeyFrameDataItemAtTime(a, c){c=c.GetKeyframeData().GetKeyframeDataItemArray();const d=c.length;for(let e=0;ea)return h}}GetFirstKeyFrameDataItemHigherOrEqualThan(a,c){c=c.GetKeyframeData().GetKeyframeDataItemArray();const d=c.length;for(let e=0;e=a)return h}}GetFirstKeyFrameDataItemLowerOrEqualThan(a, c){c=c.GetKeyframeData().GetKeyframeDataItemArray();for(let d=c.length-1;0<=d;d--){const e=c[d];if(e.GetTime()<=a)return e}}*trackDataItems(){for(const a of this._trackDataItems)yield a}_SaveToJson(){return{trackDataItemsJson:this._trackDataItems.map(a=>a._SaveToJson())}}_LoadFromJson(a){a&&f.TimelineDataManager._LoadDataItemsFromJson(this._trackDataItems,a.trackDataItemsJson,b,this)}}} {"use strict";const f=self.C3;class b{constructor(a,c){this._propertyTrackData=c;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;this._canHavePropertyKeyframes=!0;a&&(this._sourceAdapterId=a[0][0],this._sourceAdapterArguments=a[0].slice(1),this._property=a[1],this._type=a[2],this._min=a[3],this._max=a[4],this._interpolationMode=a[5],this._resultMode= a[6],this._enabled=!!a[7],this._propertyKeyframeData=new f.PropertyKeyframeData(a[8],this),this._canHavePropertyKeyframes=a[9])}Release(){this._propertyKeyframeData.Release();this._sourceAdapterArguments=this._propertyTrackData=this._propertyKeyframeData=null}GetPropertyTrackData(){return this._propertyTrackData}GetPropertyKeyframeData(){this._propertyKeyframeData||(this._propertyKeyframeData=new f.PropertyKeyframeData(null,this));return this._propertyKeyframeData}GetSourceAdapterId(){return this._sourceAdapterId}SetSourceAdapterId(a){this._sourceAdapterId= a}GetSourceAdapterArguments(){return this._sourceAdapterArguments}SetSourceAdapterArguments(a){this._sourceAdapterArguments=a}GetProperty(){return this._property}SetProperty(a){this._property=a}GetType(){return this._type}SetType(a){this._type=a}GetMin(){return this._min}SetMin(a){this._min=a}GetMax(){return this._max}SetMax(a){this._max=a}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(a){this._interpolationMode=a}GetResultMode(){return this._resultMode}SetResultMode(a){this._resultMode= a}GetEnable(){return this._enabled}SetEnable(a){this._enabled=!!a}CanHavePropertyKeyframes(){return!!this._canHavePropertyKeyframes}_SaveToJson(){return{propertyKeyframeDataJson:this._propertyKeyframeData._SaveToJson(),sourceAdapterId:this._sourceAdapterId,sourceAdapterArguments:this._sourceAdapterArguments,property:this._property,type:this._type,min:this._min,max:this._max,interpolationMode:this._interpolationMode,resultMode:this._resultMode,enabled:this._enabled,canHavePropertyKeyframes:this._canHavePropertyKeyframes}}_LoadFromJson(a){a&& (this._sourceAdapterId=a.sourceAdapterId,this._sourceAdapterArguments=a.sourceAdapterArguments,this._property=a.property,this._type=a.type,this._min=a.min,this._max=a.max,this._interpolationMode=a.interpolationMode,this._resultMode=a.resultMode,this._enabled=a.enabled,this._canHavePropertyKeyframes=a.canHavePropertyKeyframes,this.GetPropertyKeyframeData()._LoadFromJson(a.propertyKeyframeDataJson))}}f.PropertyTrackData=class{constructor(a,c){this._trackDataItem=c;this._propertyTrackDataItems=[];f.TimelineDataManager._CreateDataItems(this._propertyTrackDataItems, a,b,this)}Release(){this._trackDataItem=null;for(const a of this._propertyTrackDataItems)a.Release();f.clearArray(this._propertyTrackDataItems);this._propertyTrackDataItems=null}GetTrackDataItem(){return this._trackDataItem}AddEmptyPropertyTrackDataItem(){const a=new b(null,this);this._propertyTrackDataItems.push(a);return a}GetFirstPropertyKeyframeDataItem(a){return a.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray()[0]}GetLastPropertyKeyframeDataItem(a){return a.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray().at(-1)}GetPropertyKeyFrameDataItemAtTime(a, c){c=c.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();const d=c.length;for(let e=0;ea)return h}}GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(a,c){c=c.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();const d=c.length;for(let e=0;e=a)return h}}GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(a,c){c=c.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();for(let d=c.length-1;0<=d;d--){const e=c[d];if(e.GetTime()<=a)return e}}*propertyTrackDataItems(){for(const a of this._propertyTrackDataItems)yield a}_SaveToJson(){return{propertyTrackDataItemsJson:this._propertyTrackDataItems.map(a=>a._SaveToJson())}}_LoadFromJson(a){a&&f.TimelineDataManager._LoadDataItemsFromJson(this._propertyTrackDataItems,a.propertyTrackDataItemsJson, b,this)}}} {"use strict";const f=self.C3;class b{constructor(a,c){this._keyframeData=c;this._time=-1;this._ease="noease";this._enable=!1;this._lowerTags=this._tags=null;a&&(this._time=a[0],this._ease=a[1],this._enable=!!a[2],this._tags=(a=a[3])?a.split(" "):[],this._lowerTags=new Set(this._tags.map(d=>d.toLowerCase())),this._next=null)}Release(){this._keyframeData=null;f.clearArray(this._tags);this._tags=null;this._lowerTags.clear();this._lowerTags=null}GetKeyframeData(){return this._keyframeData}GetNext(){return this._next}SetNext(a){this._next=a}GetTime(){return this._time}SetTime(a){this._time= a;this._keyframeData._LinkKeyframeDataItems()}GetEase(){return this._ease}SetEase(a){this._ease=a}GetEnable(){return this._enable}SetEnable(a){this._enable=!!a}GetTags(){return this._tags}SetTags(a){this._tags=a?a.split(" "):[];this._lowerTags=new Set(this._tags.map(c=>c.toLowerCase()))}GetLowerTags(){return this._lowerTags}HasTag(a){return this._lowerTags.has(a.toLowerCase())}_SaveToJson(){return{time:this._time,ease:this._ease,enable:this._enable,tags:this._tags}}_LoadFromJson(a){a&&(this._time= a.time,this._ease=a.ease,this._enable=a.enable,this._tags=a.tags,this._lowerTags=new Set(this._tags.map(c=>c.toLowerCase())))}}f.KeyframeData=class{constructor(a,c){this._trackDataItem=c;this._keyframeDataItems=[];f.TimelineDataManager._CreateDataItems(this._keyframeDataItems,a,b,this);this._LinkKeyframeDataItems()}Release(){this._trackDataItem=null;for(const a of this._keyframeDataItems)a.Release();f.clearArray(this._keyframeDataItems);this._keyframeDataItems=null}_LinkKeyframeDataItems(){this._keyframeDataItems.sort((a, c)=>a.GetTime()-c.GetTime());for(let a=0;aa.GetTime()-c.GetTime())}GetKeyframeDataItemIndex(a){return this._keyframeDataItems.indexOf(a)}GetKeyframeDataItemFromIndex(a){return this._keyframeDataItems[a]}*keyframeDataItems(){for(const a of this._keyframeDataItems)yield a}*keyframeDataItemsReverse(){for(let a=this._keyframeDataItems.length- 1;0<=a;a--)yield this._keyframeDataItems[a]}_SaveToJson(){return{keyframeDataItemsJson:this._keyframeDataItems.map(a=>a._SaveToJson())}}_LoadFromJson(a){a&&(f.TimelineDataManager._LoadDataItemsFromJson(this._keyframeDataItems,a.keyframeDataItemsJson,b,this),this._LinkKeyframeDataItems())}}} {"use strict";const f=self.C3;class b{constructor(a,c){this._propertyKeyframeData=c;this._aValue=this._value=null;this._type="";this._time=NaN;this._ease="noease";this._enable=!1;this._addonData=null;this._addonInstance=void 0;a&&(this._value=a[0][0],this._aValue=a[0][1],this._type=a[0][2],this._time=a[1],this._ease=a[2],this._enable=!!a[3],this._addonData=null,a[4]&&(this._addonData=new f.AddonData(a[4],this)),this._next=null)}Release(){this._propertyKeyframeData=null;this._addonData&&(this._addonData.Release(), this._addonData=null)}GetAddonData(){return this._addonData}SetNext(a){this._next=a}GetNext(){return this._next}GetValue(){return this._value}SetValue(a){"color"===this._type&&f.IsFiniteNumber(a)?(this._value[0]=f.GetRValue(a),this._value[1]=f.GetGValue(a),this._value[2]=f.GetBValue(a)):this._value=a}GetAbsoluteValue(){return this._aValue}SetAbsoluteValue(a){"color"===this._type&&f.IsFiniteNumber(a)?(this._aValue[0]=f.GetRValue(a),this._aValue[1]=f.GetGValue(a),this._aValue[2]=f.GetBValue(a)):this._aValue= a}GetValueWithResultMode(){const a=this._propertyKeyframeData.GetPropertyTrackDataItem().GetResultMode();if("relative"===a)return this.GetValue();if("absolute"===a)return this.GetAbsoluteValue()}GetType(){return this._type}SetType(a){this._type=a}GetTime(){return this._time}SetTime(a){this._time=a;this._propertyKeyframeData._LinkPropertyKeyframeDataItems()}GetEase(){return this._ease}SetEase(a){this._ease=a}GetEnable(){return this._enable}SetEnable(a){this._enable=!!a}GetAddOn(a){if(this._addonData){if(this._addonInstance|| null===this._addonInstance)return this._addonInstance;var c=this._addonData.GetAddDataItemArray();if(!c)return this._addonInstance=null;var d=c.length;for(let e=0;ea.GetTime()-c.GetTime());for(let a=0;aa.GetTime()-c.GetTime())}GetPropertyTrackDataItem(){return this._propertyTrackDataItem}GetPropertyKeyframeDataItemCount(){return this._propertyKeyframeDataItems.length}GetPropertyKeyframeDataItemArray(){return this._propertyKeyframeDataItems}*propertyKeyframeDataItems(){for(const a of this._propertyKeyframeDataItems)yield a}*propertyKeyframeDataItemsReverse(){for(let a= this._propertyKeyframeDataItems.length-1;0<=a;a--)yield this._propertyKeyframeDataItems[a]}_SaveToJson(){return{propertyKeyframeDataItemsJson:this._propertyKeyframeDataItems.map(a=>a._SaveToJson())}}_LoadFromJson(a){a&&(f.TimelineDataManager._LoadDataItemsFromJson(this._propertyKeyframeDataItems,a.propertyKeyframeDataItemsJson,b,this),this._LinkPropertyKeyframeDataItems())}}} {"use strict";const f=self.C3;class b{constructor(d,e){this._addonData=e;this._id=d[0];this._data=d[1]}Release(){this._data=this._addonData=null}GetAddonData(){return this._addonData}GetId(){return this._id}_SaveToJson(){return{id:this._id,data:this._data}}_LoadFromJson(d){d&&(this._id=d.id,this._data=d.data)}}class a extends b{constructor(d,e){super(d,e);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(d){d&&(super._LoadFromJson(d),this._startAnchor=d.startAnchor,this._startEnable=!!d.startEnable,this._endAnchor=d.endAnchor,this._endEnable=!!d.endEnable)}}class c extends b{constructor(d,e){super(d,e);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(d){d&&(super._LoadFromJson(d),this._direction=d.direction,this._revolutions=d.revolutions)}}f.AddonData=class{constructor(d,e){this._propertyKeyframeDataItem=e;this._addonDataItems=[];f.TimelineDataManager._CreateDataItems(this._addonDataItems,d,{prop:0,map:new Map([["cubic-bezier",a],["angle",c]])},this)}Release(){this._propertyKeyframeDataItem=null;for(const d of this._addonDataItems)d.Release();f.clearArray(this._addonDataItems); this._addonDataItems=null}GetPropertyKeyframeDataItem(){return this._propertyKeyframeDataItem}GetAddDataItemArray(){return this._addonDataItems}*addonDataItems(){for(const d of this._addonDataItems)yield d}_SaveToJson(){return{addonDataItemsJson:this._addonDataItems.map(d=>d._SaveToJson())}}_LoadFromJson(d){d&&f.TimelineDataManager._LoadDataItemsFromJson(this._addonDataItems,d.addonDataItemsJson,{prop:"id",map:new Map([["cubic-bezier",a],["angle",c]])},this)}}} {"use strict";const f=self.C3;let b=0;f.TweenState=class extends f.TimelineState{constructor(a,c){super(`tween-${b++}`,a,c);this._id="";this._destroyInstanceOnComplete=!1;this._initialValueMode="start-value";this._track=this._on_started_callbacks=this._on_completed_callbacks=this._instance=null}CreateTrackStates(){for(const a of this._timelineDataItem.GetTrackData().trackDataItems())this._tracks.push(f.TweenTrackState.Create(this,a));this._track=this._tracks[0]}AddTrack(){var a=this._timelineDataItem.GetTrackData().AddEmptyTrackDataItem(); a=f.TweenTrackState.Create(this,a);this._tracks.push(a);this._track=this._tracks[0];return a}GetPropertyTrack(a){return this._track.GetPropertyTracks()[0]}SetPropertyType(a){this._propertyType=a}GetInstance(){var a=this.GetTracks();if(a&&a.length&&(this._track=a=a[0])){var c=a.GetInstance();return a.IsInstanceValid()?c:void 0}}AddStartedCallback(a){this._on_started_callbacks||(this._on_started_callbacks=[]);this._on_started_callbacks.push(a)}AddCompletedCallback(a){this._on_completed_callbacks||(this._on_completed_callbacks= []);this._on_completed_callbacks.push(a)}RemoveStartedCallback(a){this._on_started_callbacks&&(a=this._on_started_callbacks.indexOf(a),-1!==a&&this._on_started_callbacks.splice(a,1))}RemoveCompletedCallback(a){this._on_completed_callbacks&&(a=this._on_completed_callbacks.indexOf(a),-1!==a&&this._on_completed_callbacks.splice(a,1))}SetStartValue(a,c){for(const e of this._tracks)for(const h of e._propertyTracks){if(h.GetPropertyName()!==c)continue;var d=h.GetPropertyTrackData();const g=h.GetPropertyTrackDataItem(); d=d.GetFirstPropertyKeyframeDataItem(g);d.SetValue(a);d.SetAbsoluteValue(a)}}_GetPropertyTrackState(a){for(const c of this._tracks)for(const d of c._propertyTracks)if(d.GetPropertyName()===a)return d}BeforeSetEndValues(a){for(const e of a)a=this._GetPropertyTrackState(e),this.SetStartValue(a.GetCurrentState(),e);if(this.IsForwardPlayBack()){var c=this.GetTotalTime()-this.GetTime();this.SetTotalTime(c);for(var d of this._tracks)d.SetLocalTotalTime(c);this._SetTime(0)}else{d=this.GetTime();this.SetTotalTime(d); for(c of this._tracks)c.SetLocalTotalTime(d);this._SetTime(d)}this.SetInitialStateFromSetTime()}SetEndValue(a,c){var d=this._GetPropertyTrackState(c);c=d.GetPropertyTrackData();d=d.GetPropertyTrackDataItem();c=c.GetLastPropertyKeyframeDataItem(d);c.SetTime(this.GetTotalTime());c.SetValue(a);c.SetAbsoluteValue(a)}SetId(a){this._id=a}GetId(){return this._id}SetInitialValueMode(a){this._initialValueMode=a}GetInitialValueMode(){return this._initialValueMode}SetDestroyInstanceOnComplete(a){this._destroyInstanceOnComplete= a}GetDestroyInstanceOnComplete(){return this._destroyInstanceOnComplete}OnStarted(){if(this._on_started_callbacks)for(const a of this._on_started_callbacks)a(this);if(!this.IsComplete())for(const a of this._tracks)a.CompareSaveStateWithCurrent()}OnCompleted(){this._completedTick=this._runtime.GetTickCount()}FinishTriggers(){if(!this._finishedTriggers&&(this._finishedTriggers=!0,this._on_completed_callbacks))for(const a of this._on_completed_callbacks)a(this)}SetTime(a){this._DeleteIntermediateKeyframes(); super.SetTime(a)}SetInitialState(a){if(!this.InitialStateSet()&&"current-state"===this.GetInitialValueMode())for(const c of this._tracks)c.CompareInitialStateWithCurrent();super.SetInitialState(a)}Stop(a=!1){super.Stop(a);if(!this.IsComplete())for(const c of this._tracks)c.SaveState()}Reset(a=!0,c=!1){this._DeleteIntermediateKeyframes();super.Reset(a,c)}_DeleteIntermediateKeyframes(){for(const a of this._tracks){const c=d=>{d=d.GetTime();const e=this.GetTotalTime();return 0!==d&&d!==e};a.DeleteKeyframes(c); a.DeletePropertyKeyframes(c)}}_OnBeforeChangeLayout(){if(this.IsReleased())return!0;const a=this.GetInstance();if(a&&a.GetObjectClass().IsGlobal())return!1;this._timelineManager.CompleteTimelineBeforeChangeOfLayout(this);this.ResetBeforeChangeLayout();return!0}Tick(a,c,d){this._instance||(this._instance=this.GetInstance());if(this._instance&&!this._instance.IsDestroyed()&&(c=this._instance.GetTimeScale(),-1!==c&&(a=d*c),0!==a||0!==this._lastDelta)){this._lastDelta=a;d=this._playheadTime+a*this._playbackRate; a=this._timelineDataItem._totalTime;this._playheadTime=0>d?0:d>=a?a:d;d=!1;c=this.GetLoop();var e=this.GetPingPong();c||e?c&&!e?0=a&&this._SetTime(0):0>=this._playheadTime&&this._SetTime(a):!c&&e?0=a&&(this._SetTime(a),this.SetPlaybackRate(-1*this.GetPlaybackRate()),1===this._pingPongState?this._currentRepeatCount=this._playheadTime&&(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate()),1===this._pingPongState?this._currentRepeatCount=a&&(this._SetTime(a),this.SetPlaybackRate(-1*this.GetPlaybackRate())):0>=this._playheadTime&&(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate()))):0= a&&(this._currentRepeatCount=this._playheadTime&&(this._currentRepeatCount=e)this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem)}else this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem);d=this._lastPropertyKeyframeDataItem}e=d.GetNext()}this._sourceAdapter.Interpolate(b, d,e,a,c)}AddPropertyKeyframe(){const b=this._propertyTrackDataItem.GetPropertyKeyframeData().AddEmptyPropertyKeyframeDataItem();this._lastPropertyKeyframeDataItem=null;this._basic=2>=this.GetPropertyKeyframeDataItems().length;return b}DeletePropertyKeyframes(b){this._lastPropertyKeyframeDataItem=null;this._propertyTrackDataItem.GetPropertyKeyframeData().DeletePropertyKeyframeDataItems(b);this._basic=2>=this.GetPropertyKeyframeDataItems().length}_SaveToJson(){return{sourceAdapterJson:this.GetSourceAdapter()._SaveToJson(), basic:this._basic}}_LoadFromJson(b){b&&(this.GetSourceAdapter()._LoadFromJson(b.sourceAdapterJson),this._basic=b.basic)}}} {"use strict";const f=self.C3,b=self.Ease;f.Transition=class extends f.DefendedBase{constructor(a){super();this._name=a[0];this._transitionKeyframes=[];for(var c of a[1])a=f.TransitionKeyframe.Create(this,c),this._transitionKeyframes.push(a);for(c=0;cthis.Interpolate(d, e,h,g))}static Create(a){return f.New(f.Transition,a)}Release(){for(const a of this._transitionKeyframes)a.Release();f.clearArray(this._transitionKeyframes);this._transitionKeyframes=null;this._precalculatedSamples.clear();this._precalculatedSamples=null;this._transitionKeyframeCache.clear();this._transitionKeyframeCache=null}GetTransitionKeyFrameAt(a){const c=this._transitionKeyframeCache.get(a);if(c)return c;for(const d of this._transitionKeyframes)if(d.GetValueX()===a)return this._transitionKeyframeCache.set(a, d),d}GetFirstTransitionKeyFrameHigherThan(a){for(const c of this._transitionKeyframes)if(c.GetValueX()>a)return c}GetFirstTransitionKeyFrameHigherOrEqualThan(a){for(const c of this._transitionKeyframes)if(c.GetValueX()>=a)return c}GetFirstTransitionKeyFrameLowerThan(a){for(let c=this._transitionKeyframes.length-1;0<=c;c--){const d=this._transitionKeyframes[c];if(d.GetValueX()this._InvokeFunctionFromJS(d, e)}Release(){this.ClearAllScheduledWaits();this._eventStack.Release();this._eventStack=null;this._localVarStack.Release();this._localVarStack=null;f.clearArray(this._queuedTriggers);f.clearArray(this._queuedDebugTriggers);this._runtime=null;f.clearArray(this._allSheets);this._sheetsByName.clear()}Create(c){c=f.New(f.EventSheet,this,c);this._allSheets.push(c);this._sheetsByName.set(c.GetName().toLowerCase(),c)}_AddTriggerToPostInit(c){this._triggersToPostInit.push(c)}_PostInit(){for(const c of this._functionBlocksByName.values())c._PostInit(!1); for(const c of this._allSheets)c._PostInit();for(const c of this._allSheets)c._UpdateDeepIncludes();for(const c of this._triggersToPostInit)c._PostInit(!1);f.clearArray(this._triggersToPostInit);this._localVarStack._SetInitialValues(this._localVarInitialValues)}GetRuntime(){return this._runtime}GetEventSheetByName(c){return this._sheetsByName.get(c.toLowerCase())||null}_RegisterGroup(c){this._allGroups.push(c);this._groupsByName.set(c.GetGroupName(),c)}_RegisterEventBlock(c){this._blocksBySid.set(c.GetSID(), c)}_RegisterCondition(c){this._cndsBySid.set(c.GetSID(),c)}_RegisterAction(c){this._actsBySid.set(c.GetSID(),c)}_RegisterFunctionBlock(c){this._functionBlocksByName.set(c.GetFunctionName().toLowerCase(),c)}_RegisterEventVariable(c){this._eventVarsBySid.set(c.GetSID(),c);c.IsGlobal()?this._allGlobalVars.push(c):this._allLocalVars.push(c)}_DeduplicateSolModifierList(c){2<=c.length&&c.sort(b);let d=this._allUniqueSolModifiers.get(c.length);d||(d=[],this._allUniqueSolModifiers.set(c.length,d));for(let e= 0,h=d.length;eh=l);this._queuedDebugTriggers.push([c,d,e,h]);return g}*_RunQueuedDebugTriggersGen(){if(this._runtime.HitBreakpoint())throw Error("should not be in breakpoint");const c=this._runtime.GetLayoutManager();for(;this._queuedDebugTriggers.length;){const [d,e,h,g]=this._queuedDebugTriggers.shift(),l=yield*this._DebugTrigger(c,d,e,h);g(l)}}async RunQueuedDebugTriggersAsync(){for(const c of this._RunQueuedDebugTriggersGen())await this._runtime.DebugBreak(c)}_FastTrigger(c, d,e,h){let g=!1;var l=c.GetMainRunningLayout();if(c=l.GetEventSheet()){this._executingTriggerDepth++;this._runtime.PushCurrentLayout(l);l=c.deepIncludes();for(let m=0,u=l.length;md.ShouldRelease());for(const d of c)d.Release()}ClearAllScheduledWaits(){for(const c of this._scheduledWaits)c.Release();f.clearArray(this._scheduledWaits)}RemoveInstancesFromScheduledWaits(c){for(const d of this._scheduledWaits)d.RemoveInstances(c)}AddAsyncActionPromise(c){this._asyncActionPromises.push(c)}ClearAsyncActionPromises(){f.clearArray(this._asyncActionPromises)}GetPromiseForAllAsyncActions(){const c= Promise.all(this._asyncActionPromises);this._asyncActionPromises=[];return c}_SaveToJson(){return{groups:this._SaveGroupsToJson(),cnds:this._SaveCndsToJson(),acts:this._SaveActsToJson(),vars:this._SaveVarsToJson(),waits:this._SaveScheduledWaitsToJson()}}_LoadFromJson(c){this._LoadGroupsFromJson(c.groups);this._LoadCndsFromJson(c.cnds);this._LoadActsFromJson(c.acts);this._LoadVarsFromJson(c.vars);this._LoadScheduledWaitsFromJson(c.waits)}_SaveGroupsToJson(){const c={};for(const d of this.GetAllGroups())c[d.GetSID().toString()]= d.IsGroupActive();return c}_LoadGroupsFromJson(c){for(const [d,e]of Object.entries(c))c=parseInt(d,10),(c=this.GetEventGroupBySID(c))&&c.SetGroupActive(e)}_SaveCndsToJson(){const c={};for(const [d,e]of this._cndsBySid){const h=e._SaveToJson();h&&(c[d.toString()]=h)}return c}_LoadCndsFromJson(c){const d=new Map;for(const [e,h]of Object.entries(c))d.set(parseInt(e,10),h);for(const [e,h]of this._cndsBySid)h._LoadFromJson(d.get(e)||null)}_SaveActsToJson(){const c={};for(const [d,e]of this._actsBySid){const h= e._SaveToJson();h&&(c[d.toString()]=h)}return c}_LoadActsFromJson(c){const d=new Map;for(const [e,h]of Object.entries(c))d.set(parseInt(e,10),h);for(const [e,h]of this._actsBySid)h._LoadFromJson(d.get(e)||null)}_SaveVarsToJson(){const c={};for(const [d,e]of this._eventVarsBySid)e.IsConstant()||!e.IsGlobal()&&!e.IsStatic()||(c[d.toString()]=e.GetValue());return c}_LoadVarsFromJson(c){for(const [d,e]of Object.entries(c))c=parseInt(d,10),(c=this.GetEventVariableBySID(c))&&c.SetValue(e)}_SaveScheduledWaitsToJson(){return this._scheduledWaits.filter(c=> !c.IsPromise()).map(c=>c._SaveToJson())}_LoadScheduledWaitsFromJson(c){this.ClearAllScheduledWaits();for(const d of c)(c=f.ScheduledWait._CreateFromJson(this,d))&&this._scheduledWaits.push(c)}_GetPerfRecords(){return[...this._runtime.GetLayoutManager().runningLayouts()].map(c=>c.GetEventSheet()).filter(c=>c).map(c=>c._GetPerfRecord())}FindFirstFunctionBlockParent(c){for(;c;)if(c=c.GetScopeParent(),c instanceof f.FunctionBlock)return c;return null}_InvokeFunctionFromJS(c,d){Array.isArray(d)||(d=[]); c=this.GetFunctionBlockByName(c.toLowerCase());if(!c)return null;if(!c.IsEnabled())return c.GetDefaultReturnValue();var e=c.GetFunctionParameters();if(d.lengthe.DebugCanRunFast());d.canRunAllActionsFast=this._actions.every(e=>e.DebugCanRunFast());d.canRunAllSubEventsFast=this._subEvents.every(e=>e.DebugCanRunFast());d.canRunSelfFast=d.canRunAllConditionsFast&&d.canRunAllActionsFast&&d.canRunAllSubEventsFast}_UpdateCanRunFastRecursive(){let d=this;do d._UpdateCanRunFast(),d=d.GetParent();while(d)}_IdentifyTopLevelGroup(){if(this.IsGroup()){var d=this.GetParent();for(this._isTopLevelGroup=!0;d;){if(!d.IsGroup()){this._isTopLevelGroup= !1;break}d=d.GetParent()}}}_IdentifySolModifiersIncludingParents(){var d=this._runtime.GetAllObjectClasses();if(this._solModifiers===d)this._solModifiersIncludingParents=d;else{this._solModifiersIncludingParents=f.cloneArray(this._solModifiers);for(d=this.GetParent();d;){for(var e of d._solModifiers)this._AddParentSolModifier(e);d=d.GetParent()}e=this.GetEventSheetManager();this._solModifiers=e._DeduplicateSolModifierList(this._solModifiers);this._solModifiersIncludingParents=e._DeduplicateSolModifierList(this._solModifiersIncludingParents)}}_IdentifyTriggerParents(){if(this.HasAnyTriggeredCondition()){this._triggerParents= [];for(var d=this.GetParent();d;)this._triggerParents.push(d),d=d.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(d){return this._solModifiers.includes(d)}GetTriggerParents(){return this._triggerParents}GetEventSheet(){return this._eventSheet}GetEventSheetManager(){return this._eventSheet.GetEventSheetManager()}GetRuntime(){return this._runtime}GetParent(){return this._parent}_SetScopeParent(d){this._scopeParent= d}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(d){this._debugData.isBreakpoint=!!d;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(d){d= !!d;if(!this._isGroup)throw Error("not a group");if(this._isGroupActive!==d){this._isGroupActive=d;for(const e of this._containedIncludes)e.UpdateActive();this._containedIncludes.length&&(d=this._runtime.GetCurrentLayout().GetEventSheet())&&d._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 f.FunctionBlock}HasAnyTriggeredCondition(){return this.IsForFunctionBlock()|| this._conditions.some(d=>d.IsTrigger())}GetConditions(){return this._conditions}GetConditionCount(){return this._conditions.length}GetConditionAt(d){d=Math.floor(d);if(0>d||d>=this._conditions.length)throw new RangeError("invalid condition index");return this._conditions[d]}GetConditionByDebugIndex(d){return this.GetConditionAt(d)}IsFirstConditionOfType(d){let e=d.GetIndex();if(0===e)return!0;for(--e;0<=e;--e)if(this._conditions[e].GetObjectClass()===d.GetObjectClass())return!1;return!0}GetActions(){return this._actions}GetActionCount(){return this._actions.length}GetActionAt(d){d= Math.floor(d);if(0>d||d>=this._actions.length)throw new RangeError("invalid action index");return this._actions[d]}GetActionByDebugIndex(d){d=Math.floor(d);const e=this._actions.find(h=>h.GetDebugIndex()===d);if(!e)throw new RangeError("invalid action debug index");return e}_HasActionIndex(d){d=Math.floor(d);return 0<=d&&dd instanceof f.EventVariable)}RunPreTrigger(d){d.SetCurrentEvent(this); let e=!1;const h=this._conditions;for(let g=0,l=h.length;gg.Get(0)),d.GetLocalVarStack().Push(),this._scopeParent.SetFunctionParameters(e)): this._scopeParent.EvaluateFunctionParameters(e):h&&d.GetLocalVarStack().Push()}RunAsFunctionCall(d,e){let h,g;const l=0f.EventVariable.Create(b,this,e));this._isEnabled=d[3];this._innerLocalVariables=[];this._isAsync=d[4];this._nextAsyncId=0;this._currentAsyncId=-1;this._asyncMap=new Map;this._eventBlock=f.EventBlock.Create(b,a,c);this._eventBlock._SetScopeParent(this)}static Create(b, a,c){return f.New(f.FunctionBlock,b,a,c)}_PostInit(){for(const b of this._functionParameters)b._PostInit();this._eventBlock._PostInit(!1)}_GetAllLocalVariablesInScope(){return this._functionParameters}GetFunctionParameters(){return this._functionParameters}GetFunctionParameterCount(){return this._functionParameters.length}_RegisterLocalVariable(b){this._innerLocalVariables.push(b)}_GetAllInnerLocalVariables(){return this._innerLocalVariables}EvaluateFunctionParameters(b){const a=this._functionParameters; for(let c=0,d=a.length;cb.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 b=this._nextAsyncId++;this._currentAsyncId=b;let a;const c=new Promise(d=>a=d);this._asyncMap.set(b,{resolve:a,pauseCount:0});return[b,c]}MaybeFinishAsyncFunctionCall(b){const a=this._asyncMap.get(b);0===a.pauseCount&&(a.resolve(),this._asyncMap.delete(b));this._currentAsyncId=-1}PauseCurrentAsyncFunction(){this._asyncMap.get(this._currentAsyncId).pauseCount++;return this._currentAsyncId}ResumeAsyncFunction(b){this._currentAsyncId= b;this._asyncMap.get(b).pauseCount--}}} {"use strict";const f=self.C3,b=[];f.EventVariable=class extends f.DefendedBase{constructor(a,c,d){super();const e=a.GetEventSheetManager();this._eventSheet=a;this._eventSheetManager=e;this._runtime=a.GetRuntime();this._parent=c;this._localVarStack=e.GetLocalVarStack();this._name=d[1];this._type=d[2];this._initialValue=d[3];this._isStatic=!!d[4];this._isConstant=!!d[5];this._isFunctionParameter=c instanceof f.FunctionBlock;this._sid=d[6];this._jsPropName=this._runtime.GetJsPropName(d[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=e._GetNextLocalVarIndex(this));e._RegisterEventVariable(this)}static Create(a,c,d){return f.New(f.EventVariable,a,c,d)}_PostInit(){if(this.IsLocal()&&!this.IsStatic()&&!this.IsConstant()&&!this.IsFunctionParameter()){const a= this._eventSheetManager.FindFirstFunctionBlockParent(this);a&&a._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 b}Run(a){!this.IsLocal()||this.IsStatic()||this.IsConstant()||this.SetValue(this.GetInitialValue())}DebugCanRunFast(){return!0}*DebugRun(a){this.Run(a)}SetValue(a){this.IsNumber()?"number"!==typeof a&&(a=parseFloat(a)):this.IsString()?"string"!==typeof a&&(a=a.toString()):this.IsBoolean()&&(a=a?1:0);this._hasSingleValue?this._value=a:this._localVarStack.GetCurrent()[this._localIndex]= a}GetValue(){return this._hasSingleValue?this._value:this._localVarStack.GetCurrent()[this._localIndex]}GetTypedValue(){let a=this.GetValue();this.IsBoolean()&&(a=!!a);return a}ResetToInitialValue(){this._value=this._initialValue}_GetScriptInterfaceDescriptor(){return{configurable:!1,enumerable:!0,get:this._scriptGetter,set:this._scriptSetter}}}} {"use strict";const f=self.C3,b=[];f.EventInclude=class extends f.DefendedBase{constructor(a,c,d){super();const e=a.GetEventSheetManager();this._eventSheet=a;this._eventSheetManager=e;this._runtime=a.GetRuntime();this._parent=c;this._includeSheet=null;this._includeSheetName=d[1];this._isActive=!0}static Create(a,c,d){return f.New(f.EventInclude,a,c,d)}_PostInit(){this._includeSheet=this._eventSheetManager.GetEventSheetByName(this._includeSheetName);this._eventSheet._AddShallowInclude(this);let a= this.GetParent();for(;a;)a instanceof f.EventBlock&&a.IsGroup()&&a._AddContainedInclude(this),a=a.GetParent();this.UpdateActive();this._runtime.IsDebug()&&this._eventSheet._GetPerfRecord().children.push(this._includeSheet._GetPerfRecord())}GetParent(){return this._parent}GetSolModifiers(){return b}GetIncludeSheet(){return this._includeSheet}Run(a){a=!!this.GetParent();const c=this._runtime.GetAllObjectClasses();a&&this._eventSheetManager.PushCleanSol(c);this._includeSheet.Run();a&&this._eventSheetManager.PopSol(c)}*DebugRun(a){a= !!this.GetParent();const c=this._runtime.GetAllObjectClasses();a&&this._eventSheetManager.PushCleanSol(c);yield*this._includeSheet.DebugRun();a&&this._eventSheetManager.PopSol(c)}DebugCanRunFast(){return!1}IsActive(){return this._isActive}UpdateActive(){let a=this.GetParent();for(;a;){if(a instanceof f.EventBlock&&a.IsGroup()&&!a.IsGroupActive()){this._isActive=!1;return}a=a.GetParent()}this._isActive=!0}}} {"use strict";const f=self.C3;f.ExpNode=class extends f.DefendedBase{constructor(l){super();this._owner=l;this._runtime=l.GetRuntime()}_PostInit(){}static CreateNode(l,m){return f.New([h,d,e,g,b,a][m[0]],l,m)}};class b extends f.ExpNode{constructor(l,m){super(l);this._systemPlugin=this._runtime.GetSystemPlugin();this._func=this._runtime.GetObjectReference(m[1]);this._func!==f.Plugins.System.Exps.random&&this._func!==f.Plugins.System.Exps.choose||this._owner.SetVariesPerInstance()}GetBoundMethod(){return this._systemPlugin._GetBoundACEMethod(this._func, this._systemPlugin)}}class a extends f.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 f.EventBlock.prototype.RunAsExpressionFunctionCall.bind(m,this._combinedSolModifiers,l.GetReturnType(),l.GetDefaultReturnValue())}{const m=l.GetDefaultReturnValue();return()=>m}}}function c(l,m){if(l>=m)return l%m;0>l&&(l<=-m&&(l%=m),0>l&&(l+=m));return l}class d extends f.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 w=u.length;if(0===w)return this._returnsString?"":0;w=c(this._owner.GetSolIndex(), w);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(m);return this._func.apply(u[w].GetSdkInstance(),l)}ExpObject_InstExpr(l,...m){const u=this._objectClass,w=u.GetInstances(),q=w.length;if(0===q)return this._returnsString?"":0;l=c(l,q);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(u);return this._func.apply(w[l].GetSdkInstance(),m)}}class e extends f.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=c(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=c(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 w=u.length;if(0===w)return this._returnsString?"":0;l=c(l,w);u=u[l];l=0;m.IsFamily()&&(l=u.GetObjectClass().GetFamilyInstanceVariableOffset(m.GetFamilyIndex()));return u._GetInstanceVariableValueUnchecked(this._varIndex+l)}}class h extends f.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(),w=u.length;if(0===w)return this._returnsString?"":0;w=c(this._owner.GetSolIndex(),w);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(m); u=u[w];w=0;m.IsFamily()&&(w=u.GetObjectClass().GetFamilyBehaviorOffset(m.GetFamilyIndex()));return this._func.apply(u.GetBehaviorInstances()[this._behaviorIndex+w].GetSdkInstance(),l)}ExpBehavior_InstExpr(l,...m){const u=this._objectClass;var w=u.GetInstances();const q=w.length;if(0===q)return this._returnsString?"":0;l=c(l,q);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(u);w=w[l];l=0;u.IsFamily()&&(l=w.GetObjectClass().GetFamilyBehaviorOffset(u.GetFamilyIndex()));return this._func.apply(w.GetBehaviorInstances()[this._behaviorIndex+ l].GetSdkInstance(),m)}}class g extends f.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 f=self.C3;f.Parameter=class extends f.DefendedBase{constructor(y,E,H){super();this._owner=y;this._index=H;this._type=E;this.Get=null;this._isConstant=this._variesPerInstance=!1}static Create(y,E,H){const A=E[0];return f.New([a,c,u,e,g,d,l,a,e,e,w,q,u,p,c,m,h,t,r,x][A],y,A,H,E)}_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 b(y){y=self.C3_ExpressionFuncs[y];if(!y)throw Error("invalid expression number");return y}class a extends f.Parameter{constructor(y,E,H,A){super(y,E,H);this._solIndex=0;y=A[1];this._expressionNumber=y[0];this._numberedNodes=[];this._expressionFunc=null;for(let F=1,J=y.length;Fy||y>=this._numberedNodes.length)throw new RangeError("invalid numbered node"); return this._numberedNodes[y]}_PostInit(){for(var y of this._numberedNodes)y._PostInit();y=b(this._expressionNumber);this._expressionFunc=this._numberedNodes.length?y(this):y}GetSolIndex(){return this._solIndex}GetExpression(y){this._solIndex=y;return this._expressionFunc()}}class c extends a{constructor(y,E,H,A){super(y,E,H,A);this.Get=this.GetStringExpression;14===E&&(this.GetEventBlock().SetAllSolModifiers(),this._owner instanceof f.Action&&this.GetEventBlock().SetSolWriterAfterCnds())}GetStringExpression(y){this._solIndex= y;y=this._expressionFunc();return"string"===typeof y?y:""}_GetFastTriggerValue(){return b(this._expressionNumber)()}}class d extends a{constructor(y,E,H,A){super(y,E,H,A);this.Get=this.GetLayer;this._isConstant=!1}GetLayer(y){this._solIndex=y;y=this._expressionFunc();return this.GetRuntime().GetCurrentLayout().GetLayer(y)}}class e extends f.Parameter{constructor(y,E,H,A){super(y,E,H);this._combo=A[1];this.Get=this.GetCombo;this._isConstant=!0}GetCombo(){return this._combo}}class h extends f.Parameter{constructor(y, E,H,A){super(y,E,H);this._bool=A[1];this.Get=this.GetBoolean;this._isConstant=!0}GetBoolean(){return this._bool}}class g extends f.Parameter{constructor(y,E,H,A){super(y,E,H);this._objectClass=this.GetRuntime().GetObjectClassByIndex(A[1]);this.Get=this.GetObjectClass;y=this.GetEventBlock();y._AddSolModifier(this._objectClass);this._owner instanceof f.Action?y.SetSolWriterAfterCnds():y.GetParent()&&y.GetParent().SetSolWriterAfterCnds();this._isConstant=!0}GetObjectClass(){return this._objectClass}} class l extends f.Parameter{constructor(y,E,H,A){super(y,E,H);this._layout=this.GetRuntime().GetLayoutManager().GetLayoutByName(A[1]);this.Get=this.GetLayout;this._isConstant=!0}GetLayout(){return this._layout}}class m extends f.Parameter{constructor(y,E,H,A){super(y,E,H);this._timeline=this.GetRuntime().GetTimelineManager().GetTimelineByName(A[1]);this.Get=this.GetTimeline;this._isConstant=!0}GetTimeline(){return this._timeline}}class u extends f.Parameter{constructor(y,E,H,A){super(y,E,H);this._fileInfo= A[1];this.Get=this.GetFile;this._isConstant=!0}GetFile(){return this._fileInfo}}class w extends f.Parameter{constructor(y,E,H,A){super(y,E,H);this._instVarIndex=A[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 E=this._owner.GetObjectClass();var H=E.GetCurrentSol();const A=H.GetInstances(); if(A.length)y=A[y%A.length].GetObjectClass();else if(H.HasAnyElseInstances())H=H.GetElseInstances(),y=H[y%H.length].GetObjectClass();else if(0[l[0].GetUID(),l[1].GetUID(),l[2]]));d[e]=g}return{ex:d}}_LoadFromJson(d){this._savedData&&(this._savedData.clear(),this._savedData=null);if(d){var e=this._runtime, h=d.ex;if(h){d=this.GetSavedDataMap();d.clear();for(const [g,l]of Object.entries(h))h=l,"collmemory"===g&&(h=f.New(f.PairMap,l.map(m=>[e.GetInstanceByUID(m[0]),e.GetInstanceByUID(m[1]),m[2]]).filter(m=>m[0]&&m[1]))),d.set(g,h)}}}}} {"use strict";const f=self.C3;function b(e,h){for(let g=0,l=e.length;gh.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())?(b(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 e=this._objectClass.GetPlugin(),h=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();this._SetRunMethodForBoundFunc(e,h,this._RunSingleGlobal)}_SetCallFunctionRunMethod(){const e=this._eventBlock.GetEventSheetManager(),h=e.GetFunctionBlockByName(this._callFunctionName);h.IsEnabled()?(this._callEventBlock=h.GetEventBlock(),this._combinedSolModifiers=[...new Set([...this._eventBlock.GetSolModifiersIncludingParents(),...this._callEventBlock.GetSolModifiersIncludingParents()])], this._combinedSolModifiers=e._DeduplicateSolModifierList(this._combinedSolModifiers),this.Run=f.EventBlock.prototype.RunAsFunctionCall.bind(this._callEventBlock,this._combinedSolModifiers,this._parameters),this.DebugRun=this._DebugRunCallFunction):(this.Run=c,this.DebugRun=d)}_SetRunMethodForBoundFunc(e,h,g){const l=this._func,m=this._parameters;if(0===m.length)this.Run=e._GetBoundACEMethod(l,h);else if(1===m.length){const u=m[0];if(u.IsConstant())this.Run=e._GetBoundACEMethod_1param(l,h,u.Get(0)); else{const w=e._GetBoundACEMethod(l,h);this.Run=function(){return w(u.Get(0))}}}else if(2===m.length){const u=m[0],w=m[1];if(u.IsConstant()&&w.IsConstant())this.Run=e._GetBoundACEMethod_2params(l,h,u.Get(0),w.Get(0));else{const q=e._GetBoundACEMethod(l,h);this.Run=function(){return q(u.Get(0),w.Get(0))}}}else if(3===m.length){const u=m[0],w=m[1],q=m[2];if(u.IsConstant()&&w.IsConstant()&&q.IsConstant())this.Run=e._GetBoundACEMethod_3params(l,h,u.Get(0),w.Get(0),q.Get(0));else{const t=e._GetBoundACEMethod(l, h);this.Run=function(){return t(u.Get(0),w.Get(0),q.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(e){this._debugData.isBreakpoint= !!e;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 e=this._results;b(this._parameters,e);return this._func.apply(this._systemPlugin,e)}*_DebugRunSystem(){if(this.IsBreakpoint()|| this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const e=this._results;b(this._parameters,e);return yield*this._func.apply(this._systemPlugin,e)}return this.Run()}*_DebugRunCallFunction(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return yield*this._callEventBlock.DebugRunAsFunctionCall(this._combinedSolModifiers,this._parameters)}_RunSingleGlobal(){const e=this._results;b(this._parameters,e);return this._func.apply(this._objectClass.GetSingleGlobalInstance().GetSdkInstance(), e)}*_DebugRunSingleGlobal(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const e=this._results;b(this._parameters,e);return yield*this._func.apply(this._objectClass.GetSingleGlobalInstance().GetSdkInstance(),e)}return this.Run()}_RunObject_ParamsConst(){const e=this._results,h=this._objectClass.GetCurrentSol().GetInstances();for(let g=0,l=h.length;g N.getRight()||0>N.getBottom()||N.getLeft()>Q.GetWidth()||N.getTop()>Q.GetHeight()}function h(N,Q,W){const aa=this.GetCurrentSol(),ea=aa.GetInstances();if(!ea.length)return!1;let ca=ea[0];var ia=ca.GetWorldInfo();let oa=ca,ja=f.distanceSquared(ia.GetX(),ia.GetY(),Q,W);for(let wa=1,Ka=ea.length;waja)ja=ia,oa=ca;aa.PickOne(oa);return!0}function g(N){const Q=this.GetWorldInfo();Q.GetX()!== N&&(Q.SetX(N),Q.SetBboxChanged())}function l(N){const Q=this.GetWorldInfo();Q.GetY()!==N&&(Q.SetY(N),Q.SetBboxChanged())}function m(N,Q){const W=this.GetWorldInfo();W.EqualsXY(N,Q)||(W.SetXY(N,Q),W.SetBboxChanged())}function u(N,Q){if(N&&(N=N.GetPairedInstance(this._inst))){var [W,aa]=N.GetImagePoint(Q);Q=this.GetWorldInfo();if(Q.GetX()!==W||Q.GetY()!==aa)Q.SetXY(W,aa),Q.SetBboxChanged()}}function w(N){if(0!==N){var Q=this.GetWorldInfo();Q.OffsetXY(Q.GetCosAngle()*N,Q.GetSinAngle()*N);Q.SetBboxChanged()}} function q(N,Q){if(0!==Q){var W=this.GetWorldInfo();N=f.toRadians(N);W.OffsetXY(Math.cos(N)*Q,Math.sin(N)*Q);W.SetBboxChanged()}}function t(){return this.GetWorldInfo().GetX()}function p(){return this.GetWorldInfo().GetY()}function r(){return this._runtime.GetDt(this._inst)}function x(N,Q){return f.compare(this.GetWorldInfo().GetWidth(),N,Q)}function y(N,Q){return f.compare(this.GetWorldInfo().GetHeight(),N,Q)}function E(N){const Q=this.GetWorldInfo();Q.GetWidth()!==N&&(Q.SetWidth(N),Q.SetBboxChanged())} function H(N){const Q=this.GetWorldInfo();Q.GetHeight()!==N&&(Q.SetHeight(N),Q.SetBboxChanged())}function A(N,Q){const W=this.GetWorldInfo();if(W.GetWidth()!==N||W.GetHeight()!==Q)W.SetSize(N,Q),W.SetBboxChanged()}function F(){return this.GetWorldInfo().GetWidth()}function J(){return this.GetWorldInfo().GetHeight()}function B(){return this.GetWorldInfo().GetBoundingBox().getLeft()}function I(){return this.GetWorldInfo().GetBoundingBox().getTop()}function L(){return this.GetWorldInfo().GetBoundingBox().getRight()} function P(){return this.GetWorldInfo().GetBoundingBox().getBottom()}function S(N,Q){return f.angleDiff(this.GetWorldInfo().GetAngle(),f.toRadians(Q))<=f.toRadians(N)}function U(N){return f.angleClockwise(this.GetWorldInfo().GetAngle(),f.toRadians(N))}function V(N,Q){N=f.toRadians(N);Q=f.toRadians(Q);const W=this.GetWorldInfo().GetAngle();return f.angleClockwise(Q,N)?f.angleClockwise(W,N)&&!f.angleClockwise(W,Q):!(!f.angleClockwise(W,N)&&f.angleClockwise(W,Q))}function Z(N){const Q=this.GetWorldInfo(); N=f.clampAngle(f.toRadians(N));isNaN(N)||Q.GetAngle()===N||(Q.SetAngle(N),Q.SetBboxChanged())}function ma(N){if(!isNaN(N)&&0!==N){var Q=this.GetWorldInfo();Q.SetAngle(Q.GetAngle()+f.toRadians(N));Q.SetBboxChanged()}}function va(N){if(!isNaN(N)&&0!==N){var Q=this.GetWorldInfo();Q.SetAngle(Q.GetAngle()-f.toRadians(N));Q.SetBboxChanged()}}function Na(N,Q){const W=this.GetWorldInfo(),aa=W.GetAngle();N=f.angleRotate(aa,f.toRadians(Q),f.toRadians(N));isNaN(N)||aa===N||(W.SetAngle(N),W.SetBboxChanged())} function Ea(N,Q,W){const aa=this.GetWorldInfo(),ea=aa.GetAngle();Q-=aa.GetX();W-=aa.GetY();N=f.angleRotate(ea,Math.atan2(W,Q),f.toRadians(N));isNaN(N)||ea===N||(aa.SetAngle(N),aa.SetBboxChanged())}function Ia(N,Q){const W=this.GetWorldInfo(),aa=W.GetAngle();N-=W.GetX();Q-=W.GetY();Q=Math.atan2(Q,N);isNaN(Q)||aa===Q||(W.SetAngle(Q),W.SetBboxChanged())}function Ma(){return f.toDegrees(this.GetWorldInfo().GetAngle())}function Fa(N,Q){return f.compare(f.round6dp(100*this.GetWorldInfo().GetOpacity()), N,Q)}function ya(){return this.GetWorldInfo().IsVisible()}function na(N){const Q=this.GetWorldInfo();N=2===N?!Q.IsVisible():0!==N;Q.IsVisible()!==N&&(Q.SetVisible(N),this._runtime.UpdateRender())}function Va(N){N=f.clamp(N/100,0,1);const Q=this.GetWorldInfo();Q.GetOpacity()!==N&&(Q.SetOpacity(N),this._runtime.UpdateRender())}function xa(N){b.setFromRgbValue(N);N=this.GetWorldInfo();N.GetUnpremultipliedColor().equalsIgnoringAlpha(b)||(N.SetUnpremultipliedColor(b),this._runtime.UpdateRender())}function Ga(){const N= this.GetWorldInfo().GetUnpremultipliedColor();return f.PackRGBAEx(N.getR(),N.getG(),N.getB(),N.getA())}function bb(){return f.round6dp(100*this.GetWorldInfo().GetOpacity())}function Xa(N){return N?this.GetWorldInfo().GetLayer()===N:!1}function ob(N){const Q=this.GetCurrentSol(),W=Q.GetInstances();if(!W.length)return!1;let aa=W[0];for(let ea=1,ca=W.length;eaKa|| wa===Ka&&oa.GetZIndex()>ja.GetZIndex())aa=ia}else if(waQ||Q>=ca.length)){aa=aa.GetShaderProgram().GetParameterType(Q);if("color"===aa){b.setFromRgbValue(W); Q=ca[Q];if(b.equalsIgnoringAlpha(Q))return;Q.copyRgb(b)}else{"percent"===aa&&(W/=100);if(ca[Q]===W)return;ca[Q]=W}ea.IsEffectIndexActive(N)&&this._runtime.UpdateRender()}}}const eb=f.New(f.Rect),Wa=[],fb=[];let gb=!1,Ya=null,hb=!1;const Ta=new Set;function ib(N,Q,W,aa){const ea=Q.GetUID(),ca=W.GetUID();easa(La,Ua.instance)));oa=ia.GetCurrentSol();Q=N.GetCurrentSol();oa=oa.GetInstances(); ja=null;for(let Ua=0;Uasa(La,Ua.instance)));oa=ia.GetCurrentSol(); Q=N.GetCurrentSol();oa=oa.GetInstances();ja=null;for(let Ua=0;UaN||2>Q||!isFinite(N)||!isFinite(Q)?(W.ReleaseMesh(),W.SetBboxChanged()):W.CreateMesh(N,Q)}function K(N,Q,W,aa,ea,ca,ia,oa){const ja=this.GetWorldInfo();ja.SetMeshPoint(N,Q,{mode:0===W?"absolute":"relative",x:aa,y:ea,zElevation:ca,u:ia,v:oa})&&ja.SetBboxChanged()}function M(){const N=this.GetWorldInfo();return N.HasMesh()?N.GetSourceMesh().GetHSize():0}function O(){const N=this.GetWorldInfo();return N.HasMesh()?N.GetSourceMesh().GetVSize():0}function R(N){const Q= this.GetWorldInfo();N=2===N?!Q.IsVisible():0!==N;Q.IsVisible()!==N&&Q.SetVisible(N)}function T(N,Q){this.SetElementCSSStyle(N,Q)}function Y(N,Q){this.SetElementAttribute(N,""+Q)}function X(N){this.RemoveElementAttribute(N)}function fa(){this.FocusElement()}function ha(){this.BlurElement()}function ba(){return this.IsElementFocused()}function qa(N){this._SetEnabled(0!==N)}function ka(){return this._IsEnabled()}function ta(N,Q,W){return f.compare(this.GetInstance().GetInstanceVariableValue(N),Q,W)} function ua(N){return!!this.GetInstance().GetInstanceVariableValue(N)}function ra(N,Q){const W=this.GetCurrentSol(),aa=W.GetInstances();if(!aa.length)return!1;let ea=aa[0],ca=ea,ia=ea.GetInstanceVariableValue(Q);for(let oa=1,ja=aa.length;oaia)ia=wa,ca=ea}W.PickOne(ca);return!0}function za(N){return this._runtime.GetCurrentCondition().IsInverted()?Ba(this,N):Aa(this,N)}function Aa(N,Q){Q=N.GetRuntime().GetInstanceByUID(Q); if(!Q)return!1;const W=N.GetCurrentSol();if(!W.IsSelectAll()&&!W._GetOwnInstances().includes(Q))return!1;if(N.IsFamily()){if(Q.GetObjectClass().BelongsToFamily(N))return W.PickOne(Q),N.ApplySolToContainer(),!0}else if(Q.GetObjectClass()===N)return W.PickOne(Q),N.ApplySolToContainer(),!0;return!1}function Ba(N,Q){const W=N.GetCurrentSol();if(W.IsSelectAll()){W._SetSelectAll(!1);W.ClearArrays();var aa=N.GetInstances();for(let ca=0,ia=aa.length;cad.GetValue()),b.IsAsync()&&(this._asyncId=b.PauseCurrentAsyncFunction());for(const d of a)if(a=d.GetCurrentSol(),!a.IsSelectAll()||this._event.HasSolModifier(d))this._solModifiers.push(d),this._sols.set(d,f.New(f.SolState,a))}InitTimer(b){this._type="timer";this._Init();this._time=this._eventSheetManager.GetRuntime().GetGameTime()+b}InitSignal(b){this._type="signal";this._Init();this._signalTag=b.toLowerCase()}InitPromise(b){this._type="promise";this._Init(); b.then(()=>this.SetSignalled()).catch(a=>{console.warn("[C3 runtime] Promise rejected in 'Wait for previous actions to complete': ",a);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(b){b._Restore(this._event, this._actIndex);for(const [a,c]of this._sols.entries())b=a.GetCurrentSol(),c._Restore(b);if(b=this._callingFunctionBlock)b.SetFunctionParameters(this._functionParameters),b._GetAllInnerLocalVariables().map((a,c)=>a.SetValue(this._functionInnerLocalVars[c])),b.IsAsync()&&b.ResumeAsyncFunction(this._asyncId)}_Run(b){this._RestoreState(b);this._event._ResumeActionsAndSubEvents(b);this._callingFunctionBlock&&this._callingFunctionBlock.IsAsync()&&this._callingFunctionBlock.MaybeFinishAsyncFunctionCall(this._asyncId); this._eventSheetManager.ClearSol(this._solModifiers);this._shouldRelease=!0}async _DebugRun(b){this._RestoreState(b);for(const a of this._event._DebugResumeActionsAndSubEvents(b))await this._eventSheetManager.GetRuntime().DebugBreak(a);this._callingFunctionBlock&&this._callingFunctionBlock.IsAsync()&&this._callingFunctionBlock.MaybeFinishAsyncFunctionCall(this._asyncId);this._eventSheetManager.ClearSol(this._solModifiers);this._shouldRelease=!0}ShouldRelease(){return this._shouldRelease}RemoveInstances(b){for(const a of this._sols.values())a.RemoveInstances(b)}_SaveToJson(){const b= {},a={t:this._time,st:this._signalTag,s:this._isSignalled,ev:this._event.GetSID(),sm:this._solModifiers.map(c=>c.GetSID()),sols:b};this._event._HasActionIndex(this._actIndex)&&(a.act=this._event.GetActionAt(this._actIndex).GetSID());for(const [c,d]of this._sols)b[c.GetSID().toString()]=d._SaveToJson();return a}static _CreateFromJson(b,a){const c=b.GetRuntime();var d=b.GetEventBlockBySID(a.ev);if(!d)return null;let e=0;if(a.hasOwnProperty("act")){var h=b.GetActionBySID(a.act);if(!h)return null;e=h.GetIndex()}h= f.New(f.ScheduledWait,b);h._time=a.t;h._type=-1===h._time?"signal":"timer";h._signalTag=a.st;h._isSignalled=a.s;h._event=d;h._actIndex=e;for(var g of a.sm)(d=c.GetObjectClassBySID(g))&&h._solModifiers.push(d);for(const [l,m]of Object.entries(a.sols))if(a=parseInt(l,10),a=c.GetObjectClassBySID(a))g=f.New(f.SolState,null),g._LoadFromJson(b,m),h._sols.set(a,g);return h}}} {"use strict";const f=self.C3;f.SolState=class extends f.DefendedBase{constructor(b){super();this._objectClass=null;this._isSelectAll=!0;this._instances=[];b&&(this._objectClass=b.GetObjectClass(),this._isSelectAll=b.IsSelectAll(),f.shallowAssignArray(this._instances,b._GetOwnInstances()))}Release(){this._objectClass=null;f.clearArray(this._instances)}_Restore(b){b._SetSelectAll(this._isSelectAll);f.shallowAssignArray(b._GetOwnInstances(),this._instances)}RemoveInstances(b){f.arrayRemoveAllInSet(this._instances, b)}_SaveToJson(){return{sa:this._isSelectAll,insts:this._instances.map(b=>b.GetUID())}}_LoadFromJson(b,a){b=b.GetRuntime();this._isSelectAll=!!a.sa;f.clearArray(this._instances);for(const c of a.insts)(a=b.GetInstanceByUID(c))&&this._instances.push(a)}}} {"use strict";const f=self.C3;function b(a,c){let d=a.get(c);d||(d=new Map,a.set(c,d));return d}f.SDKPluginBase=class extends f.DefendedBase{constructor(a){super();this._runtime=a.runtime;this._isSingleGlobal=!!a.isSingleGlobal;this._isWorldType=!!a.isWorld;this._isRotatable=!!a.isRotatable;this._mustPredraw=!!a.mustPredraw;this._hasEffects=!!a.hasEffects;this._supportsSceneGraph=!!a.supportsSceneGraph;this._supportsMesh=!!a.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(a, c){if(!c)throw Error("missing 'this' binding");let d=this._boundACEMethodCache.get(a);if(d)return d;d=a.bind(c);this._boundACEMethodCache.set(a,d);return d}_GetBoundACEMethod_1param(a,c,d){if(!c)throw Error("missing 'this' binding");const e=b(this._boundACEMethodCache_1param,a);let h=e.get(d);if(h)return h;h=a.bind(c,d);e.set(d,h);return h}_GetBoundACEMethod_2params(a,c,d,e){if(!c)throw Error("missing 'this' binding");var h=b(this._boundACEMethodCache_2params,a);h=b(h,d);let g=h.get(e);if(g)return g; g=a.bind(c,d,e);h.set(e,g);return g}_GetBoundACEMethod_3params(a,c,d,e,h){if(!c)throw Error("missing 'this' binding");var g=b(this._boundACEMethodCache_3params,a);g=b(g,d);g=b(g,e);let l=g.get(h);if(l)return l;l=a.bind(c,d,e,h);g.set(h,l);return l}_SetSingleGlobalObjectClass(a){if(!this.IsSingleGlobal())throw Error("must be single-global plugin");this._singleGlobalObjectClass=a}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 f=self.C3;f.SDKDOMPluginBase=class extends f.SDKPluginBase{constructor(b,a){super(b);this._domComponentId=a;this._nextElementId=0;this._instMap=new Map;this.AddElementMessageHandler("elem-focused",c=>c._OnElemFocused());this.AddElementMessageHandler("elem-blurred",c=>{c&&c._OnElemBlurred()})}Release(){super.Release()}_AddElement(b){const a=this._nextElementId++;this._instMap.set(a,b);return a}_RemoveElement(b){this._instMap.delete(b)}AddElementMessageHandler(b,a){this._runtime.AddDOMComponentMessageHandler(this._domComponentId, b,c=>{const d=this._instMap.get(c.elementId);a(d,c)})}}}{"use strict";const f=self.C3;f.SDKTypeBase=class extends f.DefendedBase{constructor(b){super();this._objectClass=b;this._runtime=b.GetRuntime();this._plugin=b.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(b){}LoadTextures(b){}ReleaseTextures(){}OnDynamicTextureLoadComplete(){}PreloadTexturesWithInstances(b){}LoadTilemapData(){}GetScriptInterfaceClass(){return null}}} {"use strict";const f=self.C3;f.SDKInstanceBase=class extends f.DefendedBase{constructor(b,a){super();this._inst=b;this._domComponentId=a;this._runtime=b.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(b){return this._runtime.Trigger(b,this._inst,null)}DebugTrigger(b){return this._runtime.DebugTrigger(b, this._inst,null)}TriggerAsync(b){return this._runtime.TriggerAsync(b,this._inst,null)}FastTrigger(b,a){return this._runtime.FastTrigger(b,this._inst,a)}DebugFastTrigger(b,a){return this._runtime.DebugFastTrigger(b,this._inst,a)}ScheduleTriggers(b){return this._runtime.ScheduleTriggers(b)}AddDOMMessageHandler(b,a){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,b,a)}AddDOMMessageHandlers(b){for(const [a,c]of b)this.AddDOMMessageHandler(a,c)}PostToDOM(b,a){this._runtime.PostComponentMessageToDOM(this._domComponentId, b,a)}PostToDOMAsync(b,a){return this._runtime.PostComponentMessageToDOMAsync(this._domComponentId,b,a)}_PostToDOMMaybeSync(b,a){if(this._runtime.IsInWorker())this.PostToDOM(b,a);else return window.c3_runtimeInterface._OnMessageFromRuntime({type:"event",component:this._domComponentId,handler:b,data:a,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(b){}GetPropertyValueByIndex(b){}SetPropertyValueByIndex(b, a){}OffsetPropertyValueByIndex(b,a){if(0!==a){var c=this.GetPropertyValueByIndex(b);if("number"!==typeof c)throw Error("expected number");this.SetPropertyValueByIndex(b,c+a)}}SetPropertyColorOffsetValueByIndex(b,a,c,d){}CallAction(b,...a){b.call(this,...a)}CallExpression(b,...a){return b.call(this,...a)}GetScriptInterfaceClass(){return null}DispatchScriptEvent(b,a,c){const d=this.GetScriptInterface();b=f.New(f.Event,b,a);b.instance=d;c&&Object.assign(b,c);d.dispatchEvent(b)}}} {"use strict";const f=self.C3;f.SDKWorldInstanceBase=class extends f.SDKInstanceBase{constructor(b,a){super(b,a);this._worldInfo=b.GetWorldInfo();this._webglcontextrestored_handler=this._webglcontextlost_handler=null}Release(){if(this._webglcontextlost_handler){const b=this._runtime.Dispatcher();b.removeEventListener("webglcontextlost",this._webglcontextlost_handler);b.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 b=this._runtime.Dispatcher();b.addEventListener("webglcontextlost",this._webglcontextlost_handler);b.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 b=this.GetCurrentImageInfo();if(b)return b.GetWidth()}GetOriginalHeight(){if(!this.IsOriginalSizeKnown())throw Error("original size not known");const b=this.GetCurrentImageInfo();if(b)return b.GetHeight()}GetCurrentImageInfo(){return null}GetCurrentSurfaceSize(){var b=this.GetCurrentImageInfo();return b&&(b=b.GetTexture())?[b.GetWidth(),b.GetHeight()]:[100,100]}GetCurrentTexRect(){const b=this.GetCurrentImageInfo();return b?b.GetTexRect():null}GetCurrentTexQuad(){const b=this.GetCurrentImageInfo(); return b?b.GetTexQuad():null}IsCurrentTexRotated(){const b=this.GetCurrentImageInfo();return b?b.IsRotated():!1}GetImagePoint(b){b=this._inst.GetWorldInfo();return[b.GetX(),b.GetY()]}LoadTilemapData(b,a,c){}TestPointOverlapTile(b,a){}RendersToOwnZPlane(){return!0}}} {"use strict";const f=self.C3,b=f.New(f.Rect);f.SDKDOMInstanceBase=class extends f.SDKWorldInstanceBase{constructor(a,c){super(a,c);this._elementId=this.GetPlugin()._AddElement(this);this._isElementShowing=!0;this._autoFontSize=this._elemHasFocus=!1;this._lastRect=f.New(f.Rect,0,0,-1,-1);a=this._runtime.GetCanvasManager();this._lastWindowWidth=a.GetLastWidth();this._lastWindowHeight=a.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(a,c){c||(c={});c.elementId=this._elementId;this.PostToDOM(a,c)}_PostToDOMElementMaybeSync(a,c){c||(c={});c.elementId=this._elementId;return this._PostToDOMMaybeSync(a,c)}PostToDOMElementAsync(a,c){c||(c={});c.elementId=this._elementId;return this.PostToDOMAsync(a,c)}CreateElement(a){a|| (a={});const c=this.GetWorldInfo().IsVisible();a.elementId=this._elementId;a.isVisible=c;Object.assign(a,this.GetElementState());this._isElementShowing=!!a.isVisible;this._PostToDOMMaybeSync("create",a);this._UpdatePosition(!0)}SetElementVisible(a){a=!!a;this._isElementShowing!==a&&(this._isElementShowing=a,this.PostToDOMElement("set-visible",{isVisible:a}))}Tick(){this._UpdatePosition(!1)}_ShouldPreserveElement(){const a=this._runtime.GetCanvasManager().GetFullscreenMode();return"Android"===f.Platform.OS&& ("scale-inner"===a||"scale-outer"===a||"crop"===a)}_UpdatePosition(a){var c=this.GetWorldInfo();const d=c.GetLayer();var e=c.GetX(),h=c.GetY();let [g,l]=d.LayerToCanvasCss(e,h),[m,u]=d.LayerToCanvasCss(e+c.GetWidth(),h+c.GetHeight());e=this._runtime.GetCanvasManager();h=e.GetCssWidth();const w=e.GetCssHeight();if(c.IsVisible()&&d.IsVisible()){if(!this._ShouldPreserveElement()){if(0>=m||0>=u||g>=h||l>=w){this.SetElementVisible(!1);return}1>g&&(g=1);1>l&&(l=1);m>=h&&(m=h-1);u>=w&&(u=w-1)}b.set(g,l, m,u);c=e.GetLastWidth();h=e.GetLastHeight();!a&&b.equals(this._lastRect)&&this._lastWindowWidth===c&&this._lastWindowHeight===h?this.SetElementVisible(!0):(this._lastRect.copy(b),this._lastWindowWidth=c,this._lastWindowHeight=h,this.SetElementVisible(!0),a=null,this._autoFontSize&&(a=d.GetDisplayScale()-.2),this.PostToDOMElement("update-position",{left:Math.round(this._lastRect.getLeft())+e.GetCanvasClientX(),top:Math.round(this._lastRect.getTop())+e.GetCanvasClientY(),width:Math.round(this._lastRect.width()), height:Math.round(this._lastRect.height()),fontSize:a}))}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(a,c){this.PostToDOMElement("set-css-style",{prop:f.CSSToCamelCase(a),val:c})}SetElementAttribute(a,c){this.PostToDOMElement("set-attribute", {name:a,val:c})}RemoveElementAttribute(a){this.PostToDOMElement("remove-attribute",{name:a})}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 f=self.C3,b=self.IBehavior;f.SDKBehaviorBase=class extends f.DefendedBase{constructor(a){super();this._runtime=a.runtime;this._myObjectClasses=f.New(f.ArraySet);this._myInstances=f.New(f.ArraySet);this._iBehavior=null;this._scriptInterfaceClass=a.scriptInterfaceClass||null}Release(){this._myInstances.Release();this._myObjectClasses.Release();this._runtime=null}GetRuntime(){return this._runtime}OnCreate(){}_AddObjectClass(a){this._myObjectClasses.Add(a)}GetObjectClasses(){return this._myObjectClasses.GetArray()}_AddInstance(a){this._myInstances.Add(a)}_RemoveInstance(a){this._myInstances.Delete(a)}GetInstances(){return this._myInstances.GetArray()}GetIBehavior(){if(null=== this._iBehavior){const a=this._scriptInterfaceClass;if(a){if(this._iBehavior=new a(this),!(this._iBehavior instanceof b))throw new TypeError("script interface class must derive from IBehavior");}else this._iBehavior=new b(this)}return this._iBehavior}}} {"use strict";const f=self.C3;f.SDKBehaviorTypeBase=class extends f.DefendedBase{constructor(b){super();this._runtime=b.GetRuntime();this._behaviorType=b;this._objectClass=b.GetObjectClass();this._behavior=b.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 f=self.C3;f.SDKBehaviorInstanceBase=class extends f.DefendedBase{constructor(b,a){super();this._behInst=b;this._domComponentId=a;this._inst=b.GetObjectInstance();this._runtime=b.GetRuntime();this._behaviorType=b.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(b){return this._runtime.Trigger(b, this._inst,this._behaviorType)}DebugTrigger(b){return this._runtime.DebugTrigger(b,this._inst,this._behaviorType)}TriggerAsync(b){return this._runtime.TriggerAsync(b,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(b,a){this._runtime.AddDOMComponentMessageHandler(this._domComponentId, b,a)}OnSpriteFrameChanged(b,a){}SaveToJson(){return null}LoadFromJson(b){}GetPropertyValueByIndex(b){}SetPropertyValueByIndex(b,a){}OffsetPropertyValueByIndex(b,a){if(0!==a){var c=this.GetPropertyValueByIndex(b);if("number"!==typeof c)throw Error("expected number");this.SetPropertyValueByIndex(b,c+a)}}SetPropertyColorOffsetValueByIndex(b,a,c,d){}CallAction(b,...a){b.call(this,...a)}CallExpression(b,...a){return b.call(this,...a)}GetScriptInterfaceClass(){return null}DispatchScriptEvent(b,a,c){const d= this.GetScriptInterface();b=f.New(f.Event,b,a);b.behaviorInstance=d;b.instance=d.instance;c&&Object.assign(b,c);d.dispatchEvent(b)}}} {"use strict";const f=self.C3;f.Plugins={};f.Behaviors={};f.PluginManager=class extends f.DefendedBase{constructor(b){super();this._runtime=b;this._allPlugins=[];this._pluginsByCtor=new Map;this._systemPlugin=null;this._allBehaviors=[];this._behaviorsByCtor=new Map;this._jumpthruBehavior=this._solidBehavior=null}CreatePlugin(b){const a=this._runtime.GetObjectReference(b[0]);if(!a)throw Error("missing plugin");f.AddCommonACEs(b,a);b=f.New(a,{runtime:this._runtime,isSingleGlobal:b[1],isWorld:b[2],isRotatable:b[5], hasEffects:b[8],mustPredraw:b[9],supportsSceneGraph:b[13],supportsMesh:b[14]});b.OnCreate();this._allPlugins.push(b);this._pluginsByCtor.set(a,b)}CreateSystemPlugin(){this._systemPlugin=f.New(f.Plugins.System,{runtime:this._runtime,isSingleGlobal:!0});this._systemPlugin.OnCreate()}CreateBehavior(b){b=this._runtime.GetObjectReference(b[1]);if(!b)throw Error("missing behavior");const a=f.New(b,{runtime:this._runtime});a.OnCreate();this._allBehaviors.push(a);this._behaviorsByCtor.set(b,a);!this._solidBehavior&& f.Behaviors.solid&&a instanceof f.Behaviors.solid?this._solidBehavior=a:!this._jumpthruBehavior&&f.Behaviors.jumpthru&&a instanceof f.Behaviors.jumpthru&&(this._jumpthruBehavior=a)}GetPluginByConstructorFunction(b){return this._pluginsByCtor.get(b)||null}HasBehaviorByConstructorFunction(b){return this._behaviorsByCtor.has(b)}GetBehaviorByConstructorFunction(b){return this._behaviorsByCtor.get(b)||null}GetSystemPlugin(){return this._systemPlugin}GetSolidBehavior(){return this._solidBehavior}GetJumpthruBehavior(){return this._jumpthruBehavior}}} {"use strict";const f=self.C3,b=new Set;f.ImageInfo=class extends f.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=f.New(f.Rect);this._quadTex=f.New(f.Quad);b.add(this)}Release(){this.ReleaseTexture();this._imageAsset=null;b.delete(this)}static OnWebGLContextLost(){for(const a of b)a._textureState="",a._rcTex.set(0,0,0,0),a._quadTex.setFromRect(a._rcTex)}LoadData(a){this._url= a[0];this._size=a[1];this._offsetX=a[2];this._offsetY=a[3];this._width=a[4];this._height=a[5];this._isRotated=a[6];this._hasMetaData=!0}LoadDynamicAsset(a,c){if(this._imageAsset)throw Error("already loaded asset");this._url=c;const d={};f.IsAbsoluteURL(c)&&(d.loadPolicy="remote");this.LoadAsset(a,d);return this._imageAsset.Load()}ReplaceWith(a){if(a===this)throw Error("cannot replace with self");this.ReleaseTexture();this._url=a._url;this._size=a._size;this._offsetX=a._offsetX;this._offsetY=a._offsetY; this._width=a._width;this._height=a._height;this._isRotated=a._isRotated;this._hasMetaData=a._hasMetaData;this._imageAsset=a._imageAsset;this._textureState=a._textureState;this._rcTex=a._rcTex;this._quadTex=a._quadTex}GetURL(){return this._url}GetSize(){return this._size}GetOffsetX(){return this._offsetX}GetOffsetY(){return this._offsetY}IsRotated(){return this._isRotated}GetWidth(){return this._width}GetHeight(){return this._height}GetSheetWidth(){return this._imageAsset.GetWidth()}GetSheetHeight(){return this._imageAsset.GetHeight()}LoadAsset(a, c){if(this._imageAsset)throw Error("already got asset");c=Object.assign({},c,{url:this.GetURL(),size:this.GetSize()});this._imageAsset=a.LoadImage(c)}IsLoaded(){return this._imageAsset&&this._imageAsset.IsLoaded()}async LoadStaticTexture(a,c){if(!this._imageAsset)throw Error("no asset");if(this._textureState)throw Error("already loaded texture");this._textureState="loading";a=await this._imageAsset.LoadStaticTexture(a,c);if(!a)return this._textureState="",null;this._textureState="loaded";this._hasMetaData|| (this._width=a.GetWidth(),this._height=a.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(a.GetWidth(),a.GetHeight());this._quadTex.setFromRect(this._rcTex);this._isRotated&&this._quadTex.rotatePointsAnticlockwise();return a}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 a=await this._imageAsset.LoadToDrawable(),c=f.CreateCanvas(this._width,this._height);c.getContext("2d").drawImage(a,this._offsetX,this._offsetY,this._width,this._height,0,0,this._width,this._height);return c}}} {"use strict";const f=self.C3;f.AnimationInfo=class extends f.DefendedBase{constructor(b){super();this._name=b[0];this._speed=b[1];this._isLooping=!!b[2];this._repeatCount=b[3];this._repeatTo=b[4];this._isPingPong=!!b[5];this._sid=b[6];this._frames=b[7].map(a=>f.New(f.AnimationFrameInfo,a))}Release(){for(const b of this._frames)b.Release();f.clearArray(this._frames)}LoadAllAssets(b){for(const a of this._frames)a.GetImageInfo().LoadAsset(b)}LoadAllTextures(b,a){return Promise.all(this._frames.map(c=> c.GetImageInfo().LoadStaticTexture(b,a)))}ReleaseAllTextures(){for(const b of this._frames)b.GetImageInfo().ReleaseTexture()}GetName(){return this._name}GetSID(){return this._sid}GetFrameCount(){return this._frames.length}GetFrames(){return this._frames}GetFrameAt(b){b=Math.floor(b);if(0>b||b>=this._frames.length)throw new RangeError("invalid frame");return this._frames[b]}GetSpeed(){return this._speed}IsLooping(){return this._isLooping}GetRepeatCount(){return this._repeatCount}GetRepeatTo(){return this._repeatTo}IsPingPong(){return this._isPingPong}}} {"use strict";const f=self.C3;f.AnimationFrameInfo=class extends f.DefendedBase{constructor(b){super();this._imageInfo=f.New(f.ImageInfo);this._imageInfo.LoadData(b);this._duration=b[7];this._origin=f.New(f.Vector2,b[8],b[9]);this._imagePoints=b[10].map(a=>f.New(f.ImagePoint,this,a));this._imagePointsByName=new Map;for(const a of this._imagePoints)this._imagePointsByName.set(a.GetName().toLowerCase(),a);this._collisionPoly=null;b=b[11];6<=b.length&&(this._collisionPoly=f.New(f.CollisionPoly,b))}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(b){return this._imagePointsByName.get(b.toLowerCase())||null}GetImagePointByIndex(b){b=Math.floor(b);return 0>b||b>=this._imagePoints.length?null:this._imagePoints[b]}GetImagePointCount(){return this._imagePoints.length}}} {"use strict";const f=self.C3;f.ImagePoint=class extends f.DefendedBase{constructor(b,a){super();this._afi=b;this._name=a[0];this._pos=f.New(f.Vector2,a[1],a[2])}Release(){}GetName(){return this._name}GetX(){return this._pos.getX()}GetY(){return this._pos.getY()}GetVec2(){return this._pos}}} {"use strict";const f=self.C3,b=self.C3Debugger,a=self.IObjectClass;f.ObjectClass=class extends f.DefendedBase{constructor(c,d,e){super();const h=c.GetObjectReference(e[1]);this._runtime=c;this._plugin=c.GetPluginManager().GetPluginByConstructorFunction(h);this._sdkType=null;this._instSdkCtor=h.Instance;this._index=d;this._sid=e[11];this._name=e[0];this._jsPropName=this._runtime.GetJsPropName(e[14]);this._isGlobal=!!e[9];this._isFamily=!!e[2];this._isOnLoaderLayout=!!e[10];this._instVars=e[3].map(g=> ({sid:g[0],type:g[1],name:g[2],jsPropName:c.GetJsPropName(g[3])}));this._behaviorsCount=e[4];this._effectsCount=e[5];this._isWorldType=this._plugin.IsWorldType();this._effectList=null;this._collisionGrid=f.New(f.SparseGrid,c.GetOriginalViewportWidth(),c.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=e[8].map(g=>f.BehaviorType.Create(this,g));this._behaviorTypesIncludingInherited=[];this._behaviorsByName=new Map;this._behaviorNameToIndex=new Map;this._usedBehaviorCtors=new Set;this._solStack=f.New(f.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=f.New(f.EffectList,this,e[12]));e[6]&&(this._imageInfo=f.New(f.ImageInfo),this._imageInfo.LoadData(e[6]));if(e[7]){this._animations=e[7].map(g=>f.New(f.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=f.New(h.Type,this,e[15]);this._instanceUserScriptClass=this._iObjectClass=null;this._userScriptDispatcher=f.New(f.Event.Dispatcher);if(d=this._sdkType.GetScriptInterfaceClass()){if(this._iObjectClass=new d(this),!(this._iObjectClass instanceof a))throw new TypeError("script interface class must derive from IObjectClass"); }else this._iObjectClass=new a(this);e[13]&&(d=e[13])&&this._sdkType.LoadTilemapData(d[0],d[1],d[2]);this._runtime.UsesLoaderLayout()&&!this._isFamily&&!this._isOnLoaderLayout&&this._isWorldType||this.OnCreate();this._plugin.IsSingleGlobal()&&(this._plugin._SetSingleGlobalObjectClass(this),this._CreateSingleGlobalInstance(e))}static Create(c,d,e){return f.New(f.ObjectClass,c,d,e)}Release(){this._imageInfo&&(this._imageInfo.Release(),this._imageInfo=null);if(this._animations){for(const c of this._animations)c.Release(); f.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(c){for(let d=1,e=c.length;dthis._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(c){return this._isFamily? Promise.resolve():this._sdkType.PreloadTexturesWithInstances(c)}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(c){return c&& this._usedBehaviorCtors.has(c)}GetInstanceVariablesCount(){return this._instVars.length}GetInstanceVariableSIDs(){return this._instVars.map(c=>c.sid)}GetInstanceVariableIndexBySID(c){return this._instVars.findIndex(d=>d.sid===c)}GetInstanceVariableIndexByName(c){return this._instVars.findIndex(d=>d.name===c)}_GetAllInstanceVariableNames(){return this._instVars.map(c=>c.name)}_GetAllInstanceVariableJsPropNames(){return this._instVars.map(c=>c.jsPropName)}GetInstanceVariableType(c){c=Math.floor(c); if(0>c||c>=this._instVars.length)throw new RangeError("invalid instance variable index");return this._instVars[c].type}GetInstanceVariableName(c){c=Math.floor(c);if(0>c||c>=this._instVars.length)throw new RangeError("invalid instance variable index");return this._instVars[c].name}GetEffectTypesCount(){return this._effectsCount}GetBehaviorTypesIncludingInherited(){return this._behaviorTypesIncludingInherited}GetBehaviorTypeByName(c){return this._behaviorsByName.get(c.toLowerCase())||null}GetBehaviorIndexByName(c){c= this._behaviorNameToIndex.get(c.toLowerCase());return"undefined"===typeof c?-1:c}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(c){this._defaultInstanceData=c}GetDefaultInstanceData(){return this._defaultInstanceData}_SetDefaultLayerIndex(c){this._defaultLayerIndex= c}GetDefaultLayerIndex(){return this._defaultLayerIndex}GetAnimations(){return this._animations}GetAnimationCount(){return this._animations.length}GetFamilies(){return this._families}BelongsToFamily(c){return this._familiesSet.has(c)}GetFamilyMembers(){return this._familyMembers}FamilyHasMember(c){return this._familyMembersSet.has(c)}GetFamilyBehaviorOffset(c){return this._familyBehaviorMap[c]}GetFamilyInstanceVariableOffset(c){return this._familyInstVarMap[c]}GetAnimationByName(c){if(!this._animations)throw Error("no animations"); return this._animationsByName.get(c.toLowerCase())||null}GetAnimationBySID(c){if(!this._animations)throw Error("no animations");return this._animationsBySid.get(c)||null}GetFirstAnimationFrame(){if(!this._animations)throw Error("no animations");return this._animations[0].GetFrameAt(0)}GetDefaultInstanceSize(){if(this._animations){const c=this.GetFirstAnimationFrame().GetImageInfo();return[c.GetWidth(),c.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 c of this._runtime._GetInstancesPendingCreate())c.GetObjectClass()===this&&(yield c)}GetInstanceCount(){return this._instances.length}_AddInstance(c){this._instances.push(c)}_SetIIDsStale(){this._iidsStale=!0}_UpdateIIDs(){if(this._iidsStale&& !this._isFamily){var c=this._instances,d=0;for(let e=c.length;dd.SaveToJson())};this._savedData&&this._savedData.size&&(c.ex=f.ToSuperJSON(this._savedData));return c}_LoadFromJson(c){this._savedData&&(this._savedData.clear(),this._savedData=null);var d=c.ex;d&&(this._savedData=f.FromSuperJSON(d));d=this._instances;c=c.instances;for(let e=0,h=Math.min(d.length,c.length);eb.IsWorldType())}}} {"use strict";const f=self.C3,b=self.C3Debugger,a=self.IInstance,c=[];let d=0;const e=new WeakMap,h=new WeakMap;f.Instance=class extends f.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=d++;this._flags=0;this._behaviorInstances=this._instVarValues=c;var l=this._objectType.GetBehaviorTypesIncludingInherited();0f.New(f.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=f.New(f.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(0g||!isFinite(g))g=0;this._timeScale=g}RestoreTimeScale(){this._timeScale=-1}Dispatcher(){this._dispatcher||(this._dispatcher=f.New(f.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()}IsCurrentTexRotated(){return this._sdkInst.IsCurrentTexRotated()}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;mg||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=e.get(this);if(g)return g;g=new Map;e.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 f.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 f.Event("destroy");l.isEndingLayout=g;this.DispatchUserScriptEvent(l)}if(this._HasAnyCreateDestroyHandler("instancedestroy")){l=this.GetObjectClass();var m=new f.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=e.get(this);m&&m.size&&(l.ex=f.ToSuperJSON(m));-1!==this.GetTimeScale()&&(l.mts=this.GetTimeScale());if(0m||m>=this._instVarValues.length)){var u=t;null===u&&(u=NaN);this._instVarValues[m]=u}}if(this.GetPlugin().IsWorldType()){m=g.w;var w=m.l;this._worldInfo.GetLayer().GetSID()!==w&&(u=this._worldInfo.GetLayer(),(w=u.GetLayout().GetLayerBySID(w))? (this._worldInfo._SetLayer(w),u._RemoveInstance(this,!0),w._AddInstance(this,!0),w.SetZIndicesChanged(),this._worldInfo.SetBboxChanged()):"full"===l&&this._runtime.DestroyInstance(this));this._worldInfo._LoadFromJson(m,l)}if("visual-state"!==l&&(l=g.behs))for(const [q,t]of Object.entries(l))l=parseInt(q,10),l=this.GetBehaviorIndexBySID(l),0>l||l>=this._behaviorInstances.length||this._behaviorInstances[l].LoadFromJson(t);(g=g.data)&&this._sdkInst.LoadFromJson(g)}GetInterfaceClass(){return this._iScriptInterface|| this._InitUserScriptInterface()}_InitUserScriptInterface(){var g=this._worldInfo?self.IWorldInstance:a;const l=this._sdkInst.GetScriptInterfaceClass(),m=this._objectType._GetUserScriptInstanceClass(),u=m||l||g;a._Init(this);this._iScriptInterface=new u;a._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,w=m.length;u{let a="";b.GetTransformWithParentX()&&(a+="x");b.GetTransformWithParentY()&&(a+="y");b.GetTransformWithParentWidth()&&(a+="w");b.GetTransformWithParentHeight()&&(a+="h");b.GetTransformWithParentAngle()&&(a+="a");b.GetTransformWithParentZElevation()&&(a+="z");b.GetDestroyWithParent()&&(a+="d");return{uid:b.GetInstance().GetUID(),f:a}})}}_LoadFromJson(b){this._startWidth=b.sw;this._startHeight= b.sh;this._startScaleX=b.sx;this._startScaleY=b.sy;this._parentStartAngle=b.psa}_OnAfterLoad(b){const a=this._owner,c=a.GetRuntime();for(const d of b.c){b=c.GetInstanceByUID(d.uid).GetWorldInfo();const e=d.f,h={};h.transformX=e.includes("x");h.transformY=e.includes("y");h.transformWidth=e.includes("w");h.transformHeight=e.includes("h");h.transformAngle=e.includes("a");h.transformZElevation=e.includes("z");h.destroyWithParent=e.includes("d");a.AddChild(b,h)}}}} {"use strict";const f=self.C3,b=f.New(f.Rect),a=f.New(f.Quad),c=f.New(f.Event,"bboxchange",!1),d=f.New(f.Color,0,0,0,0),e=f.New(f.CollisionPoly),h=f.New(f.Color,1,1,1,1),g=f.New(f.Rect,0,0,-1,-1),l=f.New(f.Rect,0,0,-1,-1),m=new Set(["absolute","relative"]),u=[];let w=!0;const q=new WeakMap,t=new WeakMap;f.WorldInfo=class extends f.DefendedBase{constructor(p,r){super();this._inst=p;this._objectClass=p.GetObjectClass();this._runtime=p.GetRuntime();this._layer=r;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=f.New(f.Rect);this._boundingQuad=f.New(f.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=f.New(f.InstanceEffectList, this._inst,this));this._meshInfo=this._sceneGraphInfo=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 p= [...this.GetChildren()];for(const r of p)this.RemoveChild(r)}this._ReleaseSceneGraphInfo();this._layer=this._runtime=this._objectClass=this._inst=null}Init(p){w=!1;this.SetXY(p[0],p[1]);this.SetZElevation(p[2]);this.SetSize(p[3],p[4]);this._depth=0;this.IsRotatable()?this.SetAngle(p[6]):this._a=0;d.setFromJSON(p[7]);this._SetColor(d);this.SetOriginX(p[8]);this.SetOriginY(p[9]);this.SetBlendMode(p[10]);this._instanceEffectList&&this._instanceEffectList._LoadEffectParameters(p[12]);p[14]&&q.set(this, {childrenData:p[14][1],zIndexData:p[14][2]});if(p[15]){var r=p[15];this.CreateMesh(r[0],r[1]);p=this.GetSourceMesh();r=r[2];for(let x=0,y=r.length;xp)throw new RangeError("invalid depth");this._depth=p}GetSceneGraphScale(){if(this.HasParent()){const p=this._sceneGraphInfo;return Math.min(p.GetParentScaleX(),p.GetParentScaleY())}return 1}IsRotatable(){return 0!== (this._flags&128)}SetAngle(p){p=+p;this.IsRotatable()&&(this.GetTransformWithParentAngle()&&(p-=this.GetParent().GetAngle()),p=f.clampAngle(p),this._a!==p&&(this._a=p,this._MarkSinCosAngleChanged()))}OffsetAngle(p){p=+p;0!==p&&this.IsRotatable()&&(this._a=f.clampAngle(this._a+p),this._MarkSinCosAngleChanged())}_MarkSinCosAngleChanged(){this._flags|=262144;if(this.HasChildren()){const p=this.GetChildren();for(let r=0,x=p.length;rp||p>=r.length?null:r[p]}_CreateSceneGraphInfo(p){this._sceneGraphInfo||(this._sceneGraphInfo=f.New(f.SceneGraphInfo,this));p&&this._sceneGraphInfo.SetParent(p)}_GetSceneGraphInfo(){return this._sceneGraphInfo}_ReleaseSceneGraphInfo(){this._sceneGraphInfo&& (this._sceneGraphInfo.Release(),this._sceneGraphInfo=null)}_SetParent(p){p?(p._CreateSceneGraphInfo(null),this._CreateSceneGraphInfo(p)):(this._sceneGraphInfo&&this._sceneGraphInfo.SetParent(null),this.HasChildren()||this._ReleaseSceneGraphInfo())}_HasAnyParent(p){if(!this.HasParent())return!1;const r=this.GetParent();return r===p?!0:r._HasAnyParent(p)}_HasChildRecursive(p){if(this.HasChild(p))return!0;for(const r of this.GetChildren())if(r._HasChildRecursive(p))return!0;return!1}_AddChildToSceneGraphInfo(p){this._sceneGraphInfo.GetChildren().push(p)}_RemoveChildFromSceneGraphInfo(p){const r= this._sceneGraphInfo.GetChildren(),x=r.indexOf(p);-1!==x&&r.splice(x,1);0!==r.length||this.HasParent()||this._ReleaseSceneGraphInfo();p.HasChildren()||p._ReleaseSceneGraphInfo()}GetSceneGraphChildrenExportData(){const p=q.get(this);return p?p.childrenData:null}GetSceneGraphZIndexExportData(){const p=q.get(this);return p?p.zIndexData:NaN}GetSceneGraphZIndex(){return t.get(this)||NaN}SetSceneGraphZIndex(p){t.set(this,p)}SetUsePointsShaderProgram(){this._SetFlag(524288,!0);this._UpdateRendererStateGroup()}_UpdateRendererStateGroup(){if(w){var p= this._runtime.GetRenderer();this._stateGroup&&p.ReleaseStateGroup(this._stateGroup);var r=0!==(this._flags&524288)?p.GetPointsRenderingProgram()||"":p.GetTextureFillShaderProgram()||"";this._stateGroup=p.AcquireStateGroup(r,this.GetBlendMode(),this._colorPremultiplied,this.GetZElevation())}}GetRendererStateGroup(){return this._stateGroup}HasDefaultColor(){return this._color===h}SetBlendMode(p){p|=0;if(0>p||31>26}_SetLayer(p){this._layer=p;0!==this.GetZElevation()&&this._layer._SetAnyInstanceZElevated()}GetLayer(){return this._layer}GetLayout(){return this.GetLayer().GetLayout()}_SetZIndex(p){this._zIndex=p|0}GetZIndex(){this._layer._UpdateZIndices();return this._zIndex}_GetLastCachedZIndex(){return this._zIndex}_SetFlag(p,r){this._flags=r?this._flags|p:this._flags&~p}IsVisible(){return 0!==(this._flags& 1)}SetVisible(p){this._SetFlag(1,p)}IsCollisionEnabled(){return 0!==(this._flags&8)}SetCollisionEnabled(p){p=!!p;this.IsCollisionEnabled()!==p&&(this._SetFlag(8,p),p?this.SetBboxChanged():this._RemoveFromCollisionCells())}SetSolidCollisionFilter(p,r){this._SetFlag(32,p);this._solidFilterTags&&this._solidFilterTags.clear();if(r.trim()){this._solidFilterTags||(this._solidFilterTags=new Set);for(const x of r.split(" "))x&&this._solidFilterTags.add(x.toLowerCase())}else this._solidFilterTags=null}IsSolidCollisionAllowed(p){const r= 0!==(this._flags&32),x=this._solidFilterTags;if(!p||!x)return!r;for(const y of x)if(p.has(y))return r;return!r}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(c);if(null!==this._sceneGraphInfo){const p=this._sceneGraphInfo.GetChildren();for(let r= 0,x=p.length;r=p.GetCameraZ())return!1;p.GetViewportForZ(r,b);return b.intersectsRect(this.GetBoundingBox())}IsInViewport3D(p){var r=this.GetBoundingBox();const x=r.getLeft(),y=r.getRight(),E=r.getTop();r=r.getBottom(); const H=this.GetTotalZElevation(),A=H+this.GetDepth();return p.ContainsAABB(x,E,H,y,r,A)}_SetDrawBackFaceOnly(p){this._SetFlag(1048576,p)}_SetDrawNonBackFacesOnly(p){this._SetFlag(2097152,p)}IsDrawBackFaceOnly(){return 0!==(this._flags&1048576)}IsDrawNonBackFacesOnly(){return 0!==(this._flags&2097152)}SetSourceCollisionPoly(p){this._sourceCollisionPoly=p;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(p,r,x){let y=0,E=1;0!==x&&(y=Math.sin(x),E=Math.cos(x));return this._GetCustomTransformedCollisionPolyPrecalc(p,r,x,y,E)}_GetCustomTransformedCollisionPolyPrecalc(p,r,x,y,E){let H=this._transformedPolyInfo;null===H&&(this._transformedPolyInfo=H={poly:f.New(f.CollisionPoly), width:NaN,height:NaN,angle:NaN});const A=H.poly;if(H.width===p&&H.height===r&&H.angle===x)return A;const F=this._sourceCollisionPoly;if(this.HasMesh()){const J=this.GetOriginX(),B=this.GetOriginY(),I=this.GetSourceMesh();let L=this._meshInfo.meshPoly;L||(F?(e.copy(F),e.offset(J,B)):e.setDefaultPoints(),L=I.InsertPolyMeshVertices(e),this._meshInfo.meshPoly=L);I.TransformCollisionPoly(L,A);A.offset(-J,-B);A.transformPrecalc(p,r,y,E)}else F?(A.copy(F),A.transformPrecalc(p,r,y,E)):A.setFromQuad(this.GetBoundingQuad(), -this.GetX(),-this.GetY());H.width=p;H.height=r;H.angle=x;return A}_DiscardTransformedCollisionPoly(){this.SetPhysicsBodyChanged(!0);const p=this._transformedPolyInfo;null!==p&&(p.width=NaN)}CreateMesh(p,r){p=Math.floor(p);r=Math.floor(r);if(!this.GetInstance().GetPlugin().SupportsMesh())throw Error("object does not support mesh");this.ReleaseMesh();this._meshInfo={sourceMesh:f.New(f.Gfx.Mesh,p,r),transformedMesh:f.New(f.Gfx.Mesh,p,r),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(p){this._SetFlag(65536,p)}IsMeshChanged(){return 0!==(this._flags&65536)}SetPhysicsBodyChanged(p){this._SetFlag(131072,p)}IsPhysicsBodyChanged(){return 0!==(this._flags&131072)}_ExpandBboxForMesh(p){const r=this._meshInfo.sourceMesh,x=Math.min(r.GetMinX(),0),y=Math.min(r.GetMinY(),0),E=Math.max(r.GetMaxX(),1),H=Math.max(r.GetMaxY(),1),A=p.width(),F=p.height(); p.offsetLeft(x*A);p.offsetTop(y*F);p.offsetRight((E-1)*A);p.offsetBottom((H-1)*F);this._depth=r.GetMaxZ()}ReleaseMesh(){this._meshInfo&&(this._meshInfo.sourceMesh.Release(),this._meshInfo.transformedMesh.Release(),this._meshInfo=null,this._DiscardTransformedCollisionPoly())}SetMeshPoint(p,r,x){p=Math.floor(p);r=Math.floor(r);var y=x.mode||"absolute";if(!m.has(y))throw Error("invalid mode");y="relative"===y;let E=x.x,H=x.y;const A=x.zElevation;let F="number"===typeof x.u?x.u:y?0:-1;x="number"===typeof x.v? x.v:y?0:-1;if(!this.HasMesh())return!1;const J=this.GetSourceMesh(),B=J.GetMeshPointAt(p,r);if(null===B)return!1;let I=!1;"number"===typeof A&&B.GetZElevation()!==A&&(B.SetZElevation(A),I=!0);y&&(E+=p/(J.GetHSize()-1),H+=r/(J.GetVSize()-1));-1!==F||y?(y&&(F+=p/(J.GetHSize()-1)),F=f.clamp(F,0,1)):F=B.GetU();-1!==x||y?(y&&(x+=r/(J.GetVSize()-1)),x=f.clamp(x,0,1)):x=B.GetV();if(B.GetX()===E&&B.GetY()===H&&B.GetU()===F&&B.GetV()===x)return I;B.SetX(E);B.SetY(H);B.SetU(F);B.SetV(x);this._DiscardTransformedCollisionPoly(); return!0}HasTilemap(){return this._inst.HasTilemap()}ContainsPoint(p,r){return this.GetBoundingBox().containsPoint(p,r)&&this.GetBoundingQuad().containsPoint(p,r)?this.HasTilemap()?this._inst.GetSdkInstance().TestPointOverlapTile(p,r):this.HasOwnCollisionPoly()?this.GetTransformedCollisionPoly().containsPoint(p-this.GetX(),r-this.GetY()):!0:!1}_IsCollisionCellChanged(){return 0!==(this._flags&16)}_UpdateCollisionCell(){if(this._IsCollisionCellChanged()&&this.IsCollisionEnabled()&&0===(this._flags& 256)){var p=this.GetBoundingBox(),r=this._objectClass._GetCollisionCellGrid(),x=this._collisionCells;b.set(r.XToCell(p.getLeft()),r.YToCell(p.getTop()),r.XToCell(p.getRight()),r.YToCell(p.getBottom()));x.equals(b)||(p=this._inst,x===l?(r.Update(p,null,b),this._collisionCells=f.New(f.Rect,b)):(r.Update(p,x,b),x.copy(b)),this._flags&=-17)}}_RemoveFromCollisionCells(){const p=this._collisionCells;p!==l&&(this._objectClass._GetCollisionCellGrid().Update(this._inst,p,null),this._collisionCells=l)}_UpdateRenderCell(){const p= this.GetLayer();if(p.UsesRenderCells()&&0===(this._flags&256)){var r=p.GetRenderGrid(),x=this.GetBoundingBox(),y=this._renderCells;b.set(r.XToCell(x.getLeft()),r.YToCell(x.getTop()),r.XToCell(x.getRight()),r.YToCell(x.getBottom()));y.equals(b)||(x=this._inst,y===g?(r.Update(x,null,b),this._renderCells=f.New(f.Rect,b)):(r.Update(x,y,b),y.copy(b)),p.SetRenderListStale())}}_RemoveFromRenderCells(){const p=this._renderCells;p!==g&&(this.GetLayer().GetRenderGrid().Update(this._inst,p,null),this._renderCells= g)}GetRenderCellRange(){return this._renderCells}ZOrderMoveToTop(){const p=this._inst,r=this._layer,x=r._GetInstances();x.length&&x.at(-1)===p||(r._RemoveInstance(p,!1),r._AddInstance(p,!1),this._runtime.UpdateRender())}ZOrderMoveToBottom(){const p=this._inst,r=this._layer,x=r._GetInstances();x.length&&x[0]===p||(r._RemoveInstance(p,!1),r._PrependInstance(p,!1),this._runtime.UpdateRender())}ZOrderMoveToLayer(p){const r=this._inst,x=this._layer;if(x.GetLayout()!==p.GetLayout())throw Error("layer from different layout"); p!==x&&(x._RemoveInstance(r,!0),this._SetLayer(p),p._AddInstance(r,!0),this._runtime.UpdateRender())}ZOrderMoveAdjacentToInstance(p,r){const x=this._inst;let y=!1;const E=this._layer;if(p.GetUID()!==x.GetUID()){var H=p.GetWorldInfo();if(!H)throw Error("expected world instance");H=H.GetLayer();E.GetIndex()!==H.GetIndex()&&(E._RemoveInstance(x,!0),this._SetLayer(H),H._AddInstance(x,!0),y=!0);p=H.MoveInstanceAdjacent(x,p,!!r);(y||p)&&this._runtime.UpdateRender()}}GetInstanceEffectList(){return this._instanceEffectList}_SetHasAnyActiveEffect(p){this._SetFlag(64, p)}HasAnyActiveEffect(){return 0!==(this._flags&64)}_SaveToJson(p){const r={x:this.GetX(),y:this.GetY(),w:this.GetWidth(),h:this.GetHeight(),l:this.GetLayer().GetSID(),zi:this.GetZIndex()};0!==this.GetZElevation()&&(r.ze=this.GetZElevation());0!==this.GetAngle()&&(r.a=this.GetAngle());this.HasDefaultColor()||(r.c=this._color.toJSON());.5!==this.GetOriginX()&&(r.oX=this.GetOriginX());.5!==this.GetOriginY()&&(r.oY=this.GetOriginY());0!==this.GetBlendMode()&&(r.bm=this.GetBlendMode());this.IsVisible()|| (r.v=this.IsVisible());this.IsCollisionEnabled()||(r.ce=this.IsCollisionEnabled());this.IsBboxChangeEventEnabled()&&(r.be=this.IsBboxChangeEventEnabled());this._instanceEffectList&&(r.fx=this._instanceEffectList._SaveToJson());const x=0!==(this._flags&32);x&&(r.sfi=x);this._solidFilterTags&&(r.sft=[...this._solidFilterTags].join(" "));this._sceneGraphInfo&&"visual-state"!==p&&(r.sgi=this._sceneGraphInfo._SaveToJson());this.HasMesh()&&(r.mesh=this.GetSourceMesh().SaveToJson());return r}_OnBeforeLoad(p){"visual-state"!== p&&this._ResetAllSceneGraphState()}_LoadFromJson(p,r){w=!1;this.SetX(p.x);this.SetY(p.y);this.SetWidth(p.w);this.SetHeight(p.h);this._SetZIndex(p.zi);this.SetZElevation(p.hasOwnProperty("ze")?p.ze:0);this.SetAngle(p.hasOwnProperty("a")?p.a:0);p.hasOwnProperty("c")?d.setFromJSON(p.c):p.hasOwnProperty("o")?(d.copyRgb(this._color),d.a=p.o):d.setRgba(1,1,1,1);this._SetColor(d);this.SetOriginX(p.hasOwnProperty("oX")?p.oX:.5);this.SetOriginY(p.hasOwnProperty("oY")?p.oY:.5);this.SetBlendMode(p.hasOwnProperty("bm")? p.bm:0);this.SetVisible(p.hasOwnProperty("v")?p.v:!0);this.SetCollisionEnabled(p.hasOwnProperty("ce")?p.ce:!0);this.SetBboxChangeEventEnabled(p.hasOwnProperty("be")?p.be:!1);this.SetSolidCollisionFilter(p.hasOwnProperty("sfi")?p.sfi:!1,p.hasOwnProperty("sft")?p.sft:"");this._instanceEffectList&&p.hasOwnProperty("fx")&&this._instanceEffectList._LoadFromJson(p.fx);if(p.hasOwnProperty("sgi")&&"visual-state"!==r){this._CreateSceneGraphInfo(null);const x=this._sceneGraphInfo,y=p.sgi;x._LoadFromJson(y); const E=this.GetRuntime().Dispatcher(),H=()=>{E.removeEventListener("afterload",H);0===(this._flags&256)&&x._OnAfterLoad(y)};E.addEventListener("afterload",H)}p.hasOwnProperty("mesh")?(p=p.mesh,this.CreateMesh(p.cols,p.rows),this.GetSourceMesh().LoadFromJson(p)):this.ReleaseMesh();this.SetBboxChanged();w=!0;this._UpdateRendererStateGroup()}}} {"use strict";const f=self.C3;f.BehaviorType=class extends f.DefendedBase{constructor(b,a){super();const c=b.GetRuntime(),d=c.GetPluginManager(),e=c.GetObjectReference(a[1]);d.HasBehaviorByConstructorFunction(e)||d.CreateBehavior(a);this._runtime=c;this._objectClass=b;this._behavior=d.GetBehaviorByConstructorFunction(e);this._sdkType=null;this._instSdkCtor=e.Instance;this._sid=a[2];this._name=a[0];this._jsPropName=this._runtime.GetJsPropName(a[3]);this._sdkType=f.New(e.Type,this);this.OnCreate()}static Create(b, a){return f.New(f.BehaviorType,b,a)}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 f=self.C3,b=self.IBehaviorInstance;f.BehaviorInstance=class extends f.DefendedBase{constructor(a){super();this._runtime=a.runtime;this._behaviorType=a.behaviorType;this._behavior=this._behaviorType.GetBehavior();this._inst=a.instance;this._index=a.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(a){if(this._sdkInst)throw Error("already got sdk instance");this._sdkInst=f.New(this._behaviorType.GetInstanceSdkCtor(),this,a);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(a, c){this._sdkInst.OnSpriteFrameChanged(a,c)}_GetDebuggerProperties(){return this._sdkInst.GetDebuggerProperties()}SaveToJson(){return this._sdkInst.SaveToJson()}LoadFromJson(a){return this._sdkInst.LoadFromJson(a)}static SortByTickSequence(a,c){var d=a.GetObjectInstance(),e=c.GetObjectInstance();const h=d.GetObjectClass().GetIndex(),g=e.GetObjectClass().GetIndex();if(h!==g)return h-g;d=d.GetPUID();e=e.GetPUID();return d!==e?d-e:a.GetBehaviorInstance()._GetIndex()-c.GetBehaviorInstance()._GetIndex()}_InitScriptInterface(){const a= this._sdkInst.GetScriptInterfaceClass(),c=a||b;b._Init(this);this._iScriptInterface=new c;b._Init(null);if(a&&!(this._iScriptInterface instanceof b))throw new TypeError(`script interface class '${a.name}' does not extend the right base class '${b.name}'`);}GetScriptInterface(){return this._iScriptInterface}}} {"use strict";const f=self.C3;f.EffectList=class extends f.DefendedBase{constructor(b,a){super();this._owner=b;this._allEffectTypes=[];this._activeEffectTypes=[];this._effectTypesByName=new Map;this._effectParams=[];this._preservesOpaqueness=!0;for(const c of a)b=f.New(f.EffectType,this,c,this._allEffectTypes.length),this._allEffectTypes.push(b),this._effectTypesByName.set(b.GetName().toLowerCase(),b),3<=c.length&&this._effectParams.push(this._LoadSingleEffectParameters(c[2]));this.GetRuntime()._AddEffectList(this)}Release(){f.clearArray(this._allEffectTypes); f.clearArray(this._activeEffectTypes);this._effectTypesByName.clear();f.clearArray(this._effectParams);this._owner=null}PrependEffectTypes(b){if(b.length){this._allEffectTypes=b.concat(this._allEffectTypes);for(const a of b)this._effectTypesByName.set(a.GetName().toLowerCase(),a);for(let a=0,c=this._allEffectTypes.length;ab||b>=this._allEffectTypes.length)throw new RangeError("invalid effect type index");return this._allEffectTypes[b]}IsEffectIndexActive(b){return this.GetEffectTypeByIndex(b).IsActive()}SetEffectIndexActive(b,a){this.GetEffectTypeByIndex(b).SetActive(a)}GetActiveEffectTypes(){return this._activeEffectTypes}HasAnyActiveEffect(){return 0({name:b.GetName(),active:b.IsActive(),params:f.EffectList.SaveFxParamsToJson(this._effectParams[b.GetIndex()])}))}LoadFromJson(b){for(const a of b)if(b= this.GetEffectTypeByName(a.name))b.SetActive(a.active),this._effectParams[b.GetIndex()]=f.EffectList.LoadFxParamsFromJson(a.params);this.UpdateActiveEffects()}}} {"use strict";const f=self.C3;f.EffectType=class extends f.DefendedBase{constructor(b,a,c){super();this._effectList=b;this._id=a[0];this._name=a[1];this._index=c;this._shaderProgram=null;this._isActive=!0}Release(){this._shaderProgram=this._effectList=null}Clone(b){b=f.New(f.EffectType,b,[this._id,this._name],-1);b._shaderProgram=this._shaderProgram;b._isActive=this._isActive;return b}_InitRenderer(b){b=b.GetShaderProgramByName(this._id);if(!b)throw Error("failed to find shader program '"+this._id+ "'");this._shaderProgram=b}GetEffectList(){return this._effectList}GetName(){return this._name}_SetIndex(b){this._index=b}GetIndex(){return this._index}GetOwner(){return this._effectList.GetOwner()}GetRuntime(){return this._effectList.GetRuntime()}SetActive(b){this._isActive=!!b}IsActive(){return this._isActive}GetShaderProgram(){return this._shaderProgram}GetDefaultParameterValues(){const b=[];for(let a=0,c=this._shaderProgram.GetParameterCount();a{d=d.GetContentObject();const e=d.GetWorldInfo();c.SetColor(e.GetPremultipliedColor()); c.SetCurrentZ(e.GetTotalZElevation());d.Draw(c);c.SetCurrentZ(0)},getSourceTextureInfo:c=>{const d=c.GetCurrentTexRect(),[e,h]=c.GetCurrentSurfaceSize();return{srcTexRect:d,srcWidth:e,srcHeight:h}},getShaderParameters:c=>this.GetEffectParametersForIndex(c)});this._activeEffectFlags=[];this._activeEffectTypes=[];this._preservesOpaqueness=!0;this._effectParams=[];for(const c of this._effectList.GetAllEffectTypes())this._activeEffectFlags.push(!0);this.UpdateActiveEffects()}Release(){this._effectChain.Release(); this._effectChain=null;f.clearArray(this._activeEffectFlags);f.clearArray(this._activeEffectTypes);f.clearArray(this._effectParams);this._effectList=this._inst=null}_LoadEffectParameters(b){for(const a of b)this._effectParams.push(this._LoadSingleEffectParameters(a))}_LoadSingleEffectParameters(b){b=b.slice(0);for(let a=0,c=b.length;aa.GetWidth()||0>a.GetHeight();const e=b.IsCurrentTexRotated();if(this._needsRebuildSteps||c!==this._wasDefaultColor||d!==this._was3D||a!==this._wasRotatedOrNegativeSize||e!==this._wasTexRotated)this._effectChain.BuildSteps(this._activeEffectTypes.map(h=>h.GetShaderProgram()),{indexMap:this._activeEffectTypes.map(h=>h.GetIndex()),forcePreDraw:!c||b.MustPreDraw(),is3D:d,isSourceTextureRotated:e,isRotatedOrNegativeSizeInstance:a}), this._needsRebuildSteps=!1,this._wasDefaultColor=c,this._was3D=d,this._wasRotatedOrNegativeSize=a,this._wasTexRotated=e}GetActiveEffectTypes(){return this._activeEffectTypes}GetEffectParametersForIndex(b){return this._effectParams[b]}PreservesOpaqueness(){return this._preservesOpaqueness}HasAnyActiveBackgroundBlendingEffect(){return this._activeEffectTypes.some(b=>b.GetShaderProgram().BlendsBackground())}IsEffectIndexActive(b){return this._activeEffectFlags[b]}SetEffectIndexActive(b,a){this._activeEffectFlags[b]= !!a}GetAllEffectTypes(){return this._effectList.GetAllEffectTypes()}_SaveToJson(){return this._effectList.GetAllEffectTypes().map(b=>({name:b.GetName(),active:this._activeEffectFlags[b.GetIndex()],params:f.EffectList.SaveFxParamsToJson(this._effectParams[b.GetIndex()])}))}_LoadFromJson(b){for(const a of b)if(b=this._effectList.GetEffectTypeByName(a.name))this._activeEffectFlags[b.GetIndex()]=a.active,this._effectParams[b.GetIndex()]=f.EffectList.LoadFxParamsFromJson(a.params);this.UpdateActiveEffects()}}} {"use strict";const f=self.C3,b=[],a=[],c=[],d=f.New(f.CollisionPoly),e=f.New(f.CollisionPoly),h=f.New(f.Quad),g=f.New(f.Rect),l=f.New(f.Rect);let m=null,u=null,w=null;f.CollisionEngine=class extends f.DefendedBase{constructor(q){super();this._runtime=q;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(q,t){const p=q.GetWorldInfo(),r=t.GetWorldInfo();p&&r&&p.IsCollisionEnabled()&&r.IsCollisionEnabled()&&this._registeredCollisions.push([q,t])}AddRegisteredCollisionCandidates(q,t,p){for(const [r,x]of this._registeredCollisions){let y;if(q===r)y=x;else if(q===x)y=r;else continue;y.BelongsToObjectClass(t)&&(p.includes(y)||p.push(y))}}CheckRegisteredCollision(q, t){if(!this._registeredCollisions.length)return!1;for(const [p,r]of this._registeredCollisions)if(q===p&&t===r||q===r&&t===p)return!0;return!1}ClearRegisteredCollisions(){f.clearArray(this._registeredCollisions)}TestOverlap(q,t){if(!q||!t||q===t)return!1;q=q.GetWorldInfo();t=t.GetWorldInfo();if(!q.IsCollisionEnabled()||!t.IsCollisionEnabled())return!1;this._collisionCheckCount++;const p=q.GetLayer(),r=t.GetLayer();return p.IsTransformCompatibleWith(r)?this._TestOverlap_SameLayers(q,t):this._TestOverlap_DifferentLayers(q, t)}_TestOverlap_SameLayers(q,t){if(!q.GetBoundingBox().intersectsRect(t.GetBoundingBox()))return!1;this._polyCheckCount++;if(!q.GetBoundingQuad().intersectsQuad(t.GetBoundingQuad())||q.HasTilemap()&&t.HasTilemap())return!1;if(q.HasTilemap())return this.TestTilemapOverlap(q,t);if(t.HasTilemap())return this.TestTilemapOverlap(t,q);if(!q.HasOwnCollisionPoly()&&!t.HasOwnCollisionPoly())return!0;const p=q.GetTransformedCollisionPoly(),r=t.GetTransformedCollisionPoly();return p.intersectsPoly(r,t.GetX()- q.GetX(),t.GetY()-q.GetY())}_TestOverlap_DifferentLayers(q,t){var p=q.HasTilemap(),r=t.HasTilemap();if(p&&!r)return this.TestTilemapOverlapDifferentLayers(q,t);if(r&&!p)return this.TestTilemapOverlapDifferentLayers(t,q);if(r||p)return!1;r=q.GetLayer();p=t.GetLayer();d.copy(q.GetTransformedCollisionPoly());e.copy(t.GetTransformedCollisionPoly());var x=d.pointsArr();for(let y=0,E=x.length;yJ;++J){const B=2*J-1;x.SetXY(y+t*F*B,E+p*F*B);x.SetBboxChanged();if(!this.TestOverlap(q,H))if(H=this.TestOverlapSolid(q))A=H;else return A&&this.PushInFractional(q,t*B,p*B,A,16,!0),!0}x.SetXY(y,E);x.SetBboxChanged();return!1}PushInFractional(q,t,p,r,x,y){let E=2,H=!1;var A=!1;const F=q.GetWorldInfo();let J=F.GetX(),B=F.GetY();for(;E<=x;)A=1/E,E*=2,F.OffsetXY(t*A*(H?1:-1),p*A*(H?1:-1)),F.SetBboxChanged(),this.TestOverlap(q,r)||y&&this.TestOverlapSolid(q)? A=H=!0:(A=H=!1,J=F.GetX(),B=F.GetY());A&&(F.SetXY(J,B),F.SetBboxChanged())}PushOutSolidNearest(q,t=100){let p=0;const r=q.GetWorldInfo(),x=r.GetX(),y=r.GetY();let E=0,H=this.TestOverlapSolid(q);if(!H)return!0;for(;p<=t;){let A=0,F=0;switch(E){case 0:A=0;F=-1;p++;break;case 1:A=1;F=-1;break;case 2:A=1;F=0;break;case 3:F=A=1;break;case 4:A=0;F=1;break;case 5:A=-1;F=1;break;case 6:A=-1;F=0;break;case 7:F=A=-1}E=(E+1)%8;r.SetXY(Math.floor(x+A*p),Math.floor(y+F*p));r.SetBboxChanged();if(!this.TestOverlap(q, H)&&(H=this.TestOverlapSolid(q),!H))return!0}r.SetXY(x,y);r.SetBboxChanged();return!1}CalculateBounceAngle(q,t,p,r){const x=q.GetWorldInfo(),y=x.GetX(),E=x.GetY(),H=Math.max(10,f.distanceTo(t,p,y,E));var A=f.angleTo(t,p,y,E),F=r||this.TestOverlapSolid(q);if(!F)return f.clampAngle(A+Math.PI);let J=F;var B=0,I=0;const L=f.toRadians(5);let P;for(P=1;36>P;++P){const S=A-P*L;x.SetXY(t+Math.cos(S)*H,p+Math.sin(S)*H);x.SetBboxChanged();if(!this.TestOverlap(q,J)&&(J=r?null:this.TestOverlapSolid(q),!J)){B= S;break}}36===P&&(B=f.clampAngle(A+Math.PI));J=F;for(P=1;36>P;++P)if(F=A+P*L,x.SetXY(t+Math.cos(F)*H,p+Math.sin(F)*H),x.SetBboxChanged(),!this.TestOverlap(q,J)&&(J=r?null:this.TestOverlapSolid(q),!J)){I=F;break}36===P&&(I=f.clampAngle(A+Math.PI));x.SetXY(y,E);x.SetBboxChanged();if(I===B)return I;q=f.angleDiff(I,B)/2;q=f.angleClockwise(I,B)?f.clampAngle(B+q+Math.PI):f.clampAngle(I+q);B=Math.cos(A);A=Math.sin(A);I=Math.cos(q);q=Math.sin(q);t=B*I+A*q;return f.angleTo(0,0,B-2*t*I,A-2*t*q)}TestSegmentOverlap(q, t,p,r,x){if(!x)return!1;const y=x.GetWorldInfo();if(!y.IsCollisionEnabled())return!1;this._collisionCheckCount++;g.set(Math.min(q,p),Math.min(t,r),Math.max(q,p),Math.max(t,r));if(!y.GetBoundingBox().intersectsRect(g))return!1;if(x.HasTilemap())return this._TestSegmentOverlapTilemap(q,t,p,r,x,y);this._polyCheckCount++;return y.GetBoundingQuad().intersectsSegment(q,t,p,r)?y.HasOwnCollisionPoly()?y.GetTransformedCollisionPoly().intersectsSegment(y.GetX(),y.GetY(),q,t,p,r):!0:!1}_TestSegmentOverlapTilemap(q, t,p,r,x,y){const E=y.GetX();y=y.GetY();x=x.GetSdkInstance();l.set(q,t,p,r);l.normalize();x.GetCollisionRectCandidates(l,a);for(let A=0,F=a.length;Athis.hitFraction}Set(b,a,c,d){this.x1=b;this.y1=a;this.x2=c;this.y2=d;this.dx=c-b;this.dy=d-a;this.rect.set(b,a,c,d);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 b=this.dx*this.hitFraction,a=this.dy*this.hitFraction,c=Math.sqrt(b*b+a*a);b/=c;a/=c;this.distance=c-1E-6;this.hitX=this.x1+b*this.distance;this.hitY=this.y1+a*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);c=b*this.normalX+a*this.normalY;this.reflectionX=b-2*this.normalX*c;this.reflectionY=a-2*this.normalY*c;0[this.GetDrawWidth(),this.GetDrawHeight()],getRenderTarget:()=>this.GetEffectCompositorRenderTarget(),releaseRenderTarget:l=>this.ReleaseEffectCompositorRenderTarget(l),getTime:()=>this.GetRuntime().GetGameTime(),redraw:()=>this.GetRuntime().UpdateRender()});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=f.New(f.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);for(const u of this._runtime._GetAllEffectLists()){for(const w of u.GetAllEffectTypes())w._InitRenderer(l);u.UpdateActiveEffects()}}async _InitWebGPUContext(g){g={powerPreference:this._gpuPreference,depth:this._runtime.Uses3DFeatures(),failIfMajorPerformanceCaveat:g,canSampleBackbuffer:this._runtime.UsesAnyBackgroundBlending(),canSampleDepth:this._runtime.UsesAnyDepthSampling()};this._webgpuRenderer=f.New(f.Gfx.WebGPURenderer); await this._webgpuRenderer.Create(this._canvas,g)}async _InitWebGLContext(g){g={powerPreference:this._gpuPreference,enableGpuProfiling:!0,depth:this._runtime.Uses3DFeatures(),canSampleDepth:this._runtime.UsesAnyDepthSampling(),failIfMajorPerformanceCaveat:g};"Android"===f.Platform.OS&&"Chromium"===f.Platform.BrowserEngine&&75>f.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=f.New(f.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)){m.src=m.wgsl;const u=f.Gfx.WebGPUShaderProgram.GetDefaultVertexShaderSource();g.push(this._webgpuRenderer.CreateShaderProgram(m,u,l))}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=f.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=f.New(f.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);f.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(),w=this._runtime.GetOriginalViewportHeight(),q=u/w;g/l>q?(this._canvasCssWidth=Math.round(l*q),this._canvasCssHeight=l,this._canvasCssOffsetX=Math.floor((g-this._canvasCssWidth)/2),this._canvasCssOffsetY= 0):(this._canvasCssWidth=g,this._canvasCssHeight=Math.round(g/q),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,w)}_CalculateLetterboxIntegerScale(g,l){const m=this._runtime.GetDevicePixelRatio();1!==m&&(g+=1,l+=1);const u=this._runtime.GetOriginalViewportWidth(),w=this._runtime.GetOriginalViewportHeight(); var q=u/w;q=g/l>q?l*q*m/u:g/q*m/w;1q&&(q=1/Math.ceil(1/q));this._canvasDeviceWidth=Math.round(u*q);this._canvasDeviceHeight=Math.round(w*q);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,w)}_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._canvasDeviceWidthg&&(this._drawHeight=this._drawWidth/l)):"scale-outer"===g&&(g=l/m,l=this._windowInnerWidth/this._windowInnerHeight,l>g?this._drawWidth=this._drawHeight*l:lu||"scale-inner"===g&&ww.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)}GetEffectCompositorRenderTarget(){const g= {sampling:this._runtime.GetSampling()};"low"===this.GetCurrentFullscreenScalingQuality()&&(g.width=this.GetDrawWidth(),g.height=this.GetDrawHeight());return this.GetAdditionalRenderTarget(g)}ReleaseEffectCompositorRenderTarget(g){this.ReleaseAdditionalRenderTarget(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:f.New(f.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._snapshotResolve=t})}_MaybeTakeSnapshot(){if(this._snapshotFormat){var g=this._canvas,l=this._snapshotArea,m=f.clamp(Math.floor(l.getLeft()),0,g.width), u=f.clamp(Math.floor(l.getTop()),0,g.height),w=l.width();w=0===w?g.width-m:f.clamp(Math.floor(w),0,g.width-m);l=l.height();l=0===l?g.height-u:f.clamp(Math.floor(l),0,g.height-u);(0!==m||0!==u||w!==g.width||l!==g.height)&&0{this._snapshotUrl=URL.createObjectURL(q);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 0console.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 f.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 f.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)f.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;e.setRect(g-150,l-100,g+150,l+100);this._webglRenderer.SetTexture(this._percentText.GetTexture());this._webglRenderer.Quad3(e,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 w=this._canvasCssHeight/2,q=l/2;h.setWH(g-q,w-4+m,Math.floor(l*this._loadingProgress), 8);u.Rect(h);h.setWH(g-q,w-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(),w=this._canvasCssWidth/2,q=this._canvasCssHeight/2,t=m/2;u/=2;e.setRect(w-t,q-u,w+t,q+u);this._webglRenderer.SetTexture(l);this._webglRenderer.Quad(e);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,w=this._splashTextures.website,q=Date.now();0===this._splashFrameNumber&&(this._loaderStartTime=q);const t=this._runtime.IsPreview()||this._runtime.IsFBInstantAvailable()&&!this._runtime.IsCordova(),p=t?0:200,r=t?0:3E3;let x=1;"fade-in"===this._splashState?x=Math.min((q-this._loaderStartTime)/300,1):"fade-out"===this._splashState&& (x=Math.max(1-(q-this._splashFadeOutStartTime)/300,0));l.SetColorFillMode();l.SetColorRgba(.231*x,.251*x,.271*x,x);h.set(0,0,this._canvasCssWidth,this._canvasCssHeight);l.Rect(h);const y=Math.ceil(this._canvasCssWidth),E=Math.ceil(this._canvasCssHeight);let H;256=r&&1<=this._loadingProgress&&(this._splashState="fade-out",this._splashFadeOutStartTime= q);("fade-out"===this._splashState&&q-this._splashFadeOutStartTime>=300+p||t&&1<=this._loadingProgress&&500>q-this._loaderStartTime)&&this._splashDoneResolve()}}} {"use strict";const f=self.C3,b=self.C3Debugger,a={messagePort:null,baseUrl:"",headless:!1,hasDom:!0,isInWorker:!1,useAudio:!0,projectData:"",exportType:""};let c=!0;f.Runtime=class extends f.DefendedBase{constructor(d){d=Object.assign({},a,d);super();this._messagePort=d.messagePort;this._baseUrl=d.baseUrl;this._isHeadless=!!d.headless;this._hasDom=!!d.hasDom;this._isInWorker=!!d.isInWorker;c=d.ife;this._useAudio=!!d.useAudio;this._exportType=d.exportType;this._isiOSCordova=!!d.isiOSCordova;this._isiOSWebView= !!d.isiOSWebView;this._isFBInstantAvailable=!!d.isFBInstantAvailable;this._opusWasmScriptUrl=d.opusWasmScriptUrl;this._opusWasmBinaryUrl=d.opusWasmBinaryUrl;this._isDebugging=this._breakpointsEnabled=this._isDebug=!("preview"!==this._exportType||!d.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._usesAnyDepthSampling=this._usesAnyBackgroundBlending=!1;this._loadingLogoAsset=null;this._assetManager=f.New(f.AssetManager,this,d);this._layoutManager=f.New(f.LayoutManager,this);this._eventSheetManager=f.New(f.EventSheetManager,this);this._pluginManager=f.New(f.PluginManager,this);this._collisionEngine= f.New(f.CollisionEngine,this);this._timelineManager=f.New(f.TimelineManager,this);this._transitionManager=f.New(f.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:e=>{this._ruafId=this._rafId=-1;this.Tick(e)},tickOnly:e=>{this._ruafId=-1;this.Tick(e, !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 f.PromiseThrottle(1);this._randomNumberCallback=()=>Math.random();this._dt=this._dt1=this._lastTickTime=this._startTime=0;this._timeScale=1;this._minimumFramerate=30;this._gameTime=f.New(f.KahanSum);this._gameTimeRaw= f.New(f.KahanSum);this._wallTime=f.New(f.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=f.New(f.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:f.New(f.Event,"pretick",!1),tick:f.New(f.Event,"tick",!1),tick2:f.New(f.Event,"tick2",!1),instancedestroy:f.New(f.Event,"instancedestroy",!1),beforelayoutchange:f.New(f.Event,"beforelayoutchange",!1),layoutchange:f.New(f.Event,"layoutchange",!1)};this._eventObjects.instancedestroy.instance=null;this._userScriptDispatcher=f.New(f.Event.Dispatcher);this._userScriptEventObjects=null;this._behInstsToTick= f.New(f.RedBlackSet,f.BehaviorInstance.SortByTickSequence);this._behInstsToPostTick=f.New(f.RedBlackSet,f.BehaviorInstance.SortByTickSequence);this._behInstsToTick2=f.New(f.RedBlackSet,f.BehaviorInstance.SortByTickSequence);this._jobScheduler=f.New(f.JobSchedulerRuntime,this,d.jobScheduler);d.canvas&&(this._canvasManager=f.New(f.CanvasManager,this));this._messagePort.onmessage=e=>this._OnMessageFromDOM(e.data);this.AddDOMComponentMessageHandler("runtime","visibilitychange",e=>this._OnVisibilityChange(e)); this.AddDOMComponentMessageHandler("runtime","opus-decode",e=>this._WasmDecodeWebMOpus(e.arrayBuffer));this.AddDOMComponentMessageHandler("runtime","get-remote-preview-status-info",()=>this._GetRemotePreviewStatusInfo());this.AddDOMComponentMessageHandler("runtime","js-invoke-function",e=>this._InvokeFunctionFromJS(e));this.AddDOMComponentMessageHandler("runtime","go-to-last-error-script",self.goToLastErrorScript);this._dispatcher.addEventListener("window-blur",e=>this._OnWindowBlur(e));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(d){return f.New(f.Runtime,d)}Release(){f.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"](d){const e=d.type;if("event"===e)this._OnEventFromDOM(d);else if("result"===e)this._OnResultFromDOM(d); else throw Error(`unknown message '${e}'`);}_OnEventFromDOM(d){if(this._isReadyToHandleEvents){var e=d.component,h=d.handler,g=d.data,l=d.dispatchOpts,m=!(!l||!l.dispatchRuntimeEvent);l=!(!l||!l.dispatchUserScriptEvent);var u=d.responseId;if("runtime"===e&&(m&&(d=new f.Event(h),d.data=g,this._dispatcher.dispatchEventAndWaitAsyncSequential(d)),l)){d=new f.Event(h,!0);for(const [w,q]of Object.entries(g))d[w]=q;this.DispatchUserScriptEvent(d)}if(d=this._domEventHandlers.get(e))if(d=d.get(h)){m=null; try{m=d(g)}catch(w){console.error(`Exception in '${e}' handler '${h}':`,w);null!==u&&this._PostResultToDOM(u,!1,""+w);return}null!==u&&(m&&m.then?m.then(w=>this._PostResultToDOM(u,!0,w)).catch(w=>{console.error(`Rejection from '${e}' handler '${h}':`,w);this._PostResultToDOM(u,!1,""+w)}):this._PostResultToDOM(u,!0,m))}else m||l||console.warn(`[Runtime] No DOM handler '${h}' for component '${e}'`);else m||l||console.warn(`[Runtime] No DOM event handlers for component '${e}'`)}else this._waitingToHandleEvents.push(d)}_PostResultToDOM(d, e,h){this._messagePort.postMessage({type:"result",responseId:d,isOk:e,result:h})}_OnResultFromDOM(d){const e=d.responseId,h=d.isOk;d=d.result;const g=this._pendingResponsePromises.get(e);h?g.resolve(d):g.reject(d);this._pendingResponsePromises.delete(e)}AddDOMComponentMessageHandler(d,e,h){let g=this._domEventHandlers.get(d);g||(g=new Map,this._domEventHandlers.set(d,g));if(g.has(e))throw Error(`[Runtime] Component '${d}' already has handler '${e}'`);g.set(e,h)}PostComponentMessageToDOM(d,e,h){this._messagePort.postMessage({type:"event", component:d,handler:e,data:h,responseId:null})}PostComponentMessageToDOMAsync(d,e,h){const g=this._nextDomResponseId++,l=new Promise((m,u)=>{this._pendingResponsePromises.set(g,{resolve:m,reject:u})});this._messagePort.postMessage({type:"event",component:d,handler:e,data:h,responseId:g});return l}PostToDebugger(d){if(!this.IsDebug())throw Error("not in debug mode");this.PostComponentMessageToDOM("runtime","post-to-debugger",d)}async Init(d){this.IsDebug()?await b.Init(this):self.C3Debugger&&self.C3Debugger.InitPreview(this); var [e]=await Promise.all([this._assetManager.FetchJson("data.json"),this._MaybeLoadOpusDecoder(),this._jobScheduler.Init()]);this._LoadDataJson(e);await this._InitialiseCanvas(d);this.IsPreview()||console.info("Made with Construct 3, the game and app creator :: https://www.construct.net");this.GetWebGLRenderer()?(e=this.GetWebGLRenderer(),console.info(`[C3 runtime] Hosted in ${this.IsInWorker()?"worker":"DOM"}, rendering with WebGL ${e.GetWebGLVersionNumber()} [${e.GetUnmaskedRenderer()}] (${e.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);f.clearArray(this._waitingToHandleEvents); this._canvasManager&&this._canvasManager.StartLoadingScreen();for(const h of d.runOnStartupFunctions)this._additionalLoadPromises.push(this._RunOnStartupFunction(h));await Promise.all([this._assetManager.WaitForAllToLoad(),...this._additionalLoadPromises]);f.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 f.Event("beforeruntimestart")), await this.Start(),this._messagePort.postMessage({type:"runtime-ready"}),this}async _RunOnStartupFunction(d){try{await d(this._iRuntime)}catch(e){console.error("[C3 runtime] Error in runOnStartup function: ",e)}}_LoadDataJson(d){d=d.project;this._projectName=d[0];this._projectVersion=d[16];this._projectUniqueId=d[31];this._appId=d[38];const e=d[39]||"loading-logo.png";this._isPixelRoundingEnabled=!!d[9];this._originalViewportWidth=this._viewportWidth=d[10];this._originalViewportHeight=this._viewportHeight= d[11];this._parallaxXorigin=this._originalViewportWidth/2;this._parallaxYorigin=this._originalViewportHeight/2;this._compositingMode=d[36];this._framerateMode=d[37];"low-latency"===this._compositingMode&&this.IsAndroidWebView()&&77>=f.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=!!d[40];this._sampling=d[14];this._usesAnyBackgroundBlending=d[15];this._usesAnyDepthSampling=d[17];this._usesLoaderLayout=!!d[18];this._loaderStyle=d[19];this._nextUid=d[21];this._pauseOnBlur=d[22];const h=this._assetManager;h._SetAudioFiles(d[7],d[25]);h._SetMediaSubfolder(d[8]);h._SetFontsSubfolder(d[32]);h._SetIconsSubfolder(d[28]);h._SetWebFonts(d[29]);if(0===this._loaderStyle){let w="";this.IsPreview()?h._HasLocalUrlBlob(e)&&(w=h.GetLocalUrlAsBlobUrl(e)):w=h.GetIconsSubfolder()+ e;w&&(this._loadingLogoAsset=h.LoadImage({url:w}))}this._canvasManager&&(this._canvasManager.SetFullscreenMode(f.CanvasManager._FullscreenModeNumberToString(d[12])),this._canvasManager.SetFullscreenScalingQuality(d[23]?"high":"low"),this._canvasManager.SetMipmapsEnabled(0!==d[24]),this._canvasManager._SetGPUPowerPreference(d[34]),this._canvasManager._SetTextureAnisotropy(d[41]),this._canvasManager._SetWebGPUEnabled(d[13]));this._pluginManager.CreateSystemPlugin();this._objectReferenceTable=self.C3_GetObjectRefTable(); for(var g of d[2])this._pluginManager.CreatePlugin(g);this._objectReferenceTable=self.C3_GetObjectRefTable();this._LoadJsPropNameTable();for(var l of d[3])g=f.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 w of d[4])this._allObjectClasses[w[0]]._LoadFamily(w);for(var m of d[27])l=m.map(w=>this._allObjectClasses[w]),this._allContainers.push(f.New(f.Container, this,l));for(const w of this._allObjectClasses)w._OnAfterCreate();for(const w of d[5])this._layoutManager.Create(w);(m=d[1])&&(m=this._layoutManager.GetLayoutByName(m))&&this._layoutManager.SetFirstLayout(m);for(var u of d[33])this._timelineManager.Create(u);for(const w of d[35])this._transitionManager.Create(w);this._InitScriptInterfaces();for(const w of d[6])this._eventSheetManager.Create(w);this._eventSheetManager._PostInit();this._InitGlobalVariableScriptInterface();f.clearArray(this._objectReferenceTable); this.FlushPendingInstances();u="any";d=d[20];1===d?u="portrait":2===d&&(u="landscape");this.PostComponentMessageToDOM("runtime","set-target-orientation",{targetOrientation:u})}GetLoaderStyle(){return this._loaderStyle}IsFBInstantAvailable(){return this._isFBInstantAvailable}IsLoading(){return this._isLoading}AddLoadPromise(d){this._additionalLoadPromises.push(d)}SetUsingCreatePromises(d){this._isUsingCreatePromises=!!d}AddCreatePromise(d){this._isUsingCreatePromises&&this._additionalCreatePromises.push(d)}GetCreatePromises(){return this._additionalCreatePromises}_GetNextFamilyIndex(){return this._familyCount++}GetFamilyCount(){return this._familyCount}_AddEffectList(d){this._allEffectLists.push(d)}_GetAllEffectLists(){return this._allEffectLists}async _InitialiseCanvas(d){this._canvasManager&& (await this._canvasManager.CreateCanvas(d),this._canvasManager.InitLoadingScreen(this._loaderStyle))}async _MaybeLoadOpusDecoder(){if(!this._assetManager.IsAudioFormatSupported("audio/webm; codecs=opus")){var d=null;try{d=this.IsiOSCordova()&&this._assetManager.IsFileProtocol()?await this._assetManager.CordovaFetchLocalFileAsArrayBuffer(this._opusWasmBinaryUrl):await this._assetManager.FetchArrayBuffer(this._opusWasmBinaryUrl)}catch(e){console.info("Failed to fetch Opus decoder WASM; assuming project has no Opus audio.", e);return}d?this.AddJobWorkerBuffer(d,"opus-decoder-wasm"):this.AddJobWorkerBlob(null,"opus-decoder-wasm");await this.AddJobWorkerScripts([this._opusWasmScriptUrl])}}async _WasmDecodeWebMOpus(d){return await this.AddJob("OpusDecode",{arrayBuffer:d},[d])}async Start(){this._hasStarted=!0;this._startTime=Date.now();if(this._usesLoaderLayout){for(var d of this._allObjectClasses)d.IsFamily()||d.IsOnLoaderLayout()||!d.IsWorldType()||d.OnCreate();this._assetManager.WaitForAllToLoad().then(()=>{this._isLoading= !1;this._OnLoadFinished()})}else this._isLoading=!1;this._assetManager.SetInitialLoadFinished();this.IsDebug()&&b.RuntimeInit(c);for(const e of this._layoutManager.GetAllLayouts())e._CreateGlobalNonWorlds();d=this._layoutManager.GetFirstLayout();await d._Load(null,this.GetRenderer());await d._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(f.Plugins.System.Cnds.OnLoadFinished,null,null);this.PostComponentMessageToDOM("runtime","register-sw")}GetObjectReference(d){d=Math.floor(d);const e=this._objectReferenceTable;if(0>d||d>=e.length)throw Error("invalid object reference");return e[d]}_LoadJsPropNameTable(){for(const d of self.C3_JsPropNameTable){const e=f.first(Object.keys(d));this._jsPropNameTable.push(e)}}GetJsPropName(d){d=Math.floor(d);const e=this._jsPropNameTable;if(0>d||d>=e.length)throw Error("invalid prop reference"); return e[d]}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(d){d=Math.floor(d);if(0>d||d>=this._allObjectClasses.length)throw new RangeError("invalid index");return this._allObjectClasses[d]}GetObjectClassByName(d){return this._objectClassesByName.get(d.toLowerCase())||null}GetObjectClassBySID(d){return this._objectClassesBySid.get(d)|| null}GetSingleGlobalObjectClassByCtor(d){return(d=this._pluginManager.GetPluginByConstructorFunction(d))?d.GetSingleGlobalObjectClass():null}GetAllObjectClasses(){return this._allObjectClasses}*allInstances(){for(const d of this._allObjectClasses)d.IsFamily()||(yield*d.instances())}Dispatcher(){return this._dispatcher}UserScriptDispatcher(){return this._userScriptDispatcher}DispatchUserScriptEvent(d){d.runtime=this.GetIRuntime();const e=this.IsDebug()&&!this._eventSheetManager.IsInEventEngine();e&& b.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(d);e&&b.AddScriptTime()}DispatchUserScriptEventAsyncWait(d){d.runtime=this.GetIRuntime();return this._userScriptDispatcher.dispatchEventAndWaitAsync(d)}GetOriginalViewportWidth(){return this._originalViewportWidth}GetOriginalViewportHeight(){return this._originalViewportHeight}SetOriginalViewportSize(d,e){if(this._originalViewportWidth!==d||this._originalViewportHeight!==e)this._originalViewportWidth=d,this._originalViewportHeight= e,d=this.GetLayoutManager(),d.SetAllLayerProjectionChanged(),d.SetAllLayerMVChanged()}GetViewportWidth(){return this._viewportWidth}GetViewportHeight(){return this._viewportHeight}SetViewportSize(d,e){if(this._viewportWidth!==d||this._viewportHeight!==e)this._viewportWidth=d,this._viewportHeight=e,d=this.GetLayoutManager(),d.SetAllLayerProjectionChanged(),d.SetAllLayerMVChanged()}_SetDevicePixelRatio(d){this._devicePixelRatio=d}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}GetEffectLayerScaleParam(){return this._canvasManager?this._canvasManager.GetEffectLayerScaleParam():1}GetEffectDevicePixelRatioParam(){return this._canvasManager?this._canvasManager.GetEffectDevicePixelRatioParam(): 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(d){return this._canvasManager?this._canvasManager.GetAdditionalRenderTarget(d): null}ReleaseAdditionalRenderTarget(d){this._canvasManager&&this._canvasManager.ReleaseAdditionalRenderTarget(d)}UsesAnyBackgroundBlending(){return this._usesAnyBackgroundBlending}UsesAnyDepthSampling(){return this._usesAnyDepthSampling}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(d){return this._assetManager.LoadImage(d)}CreateInstance(d,e,h,g,l){return this.CreateInstanceFromData(d,e,!1,h,g,!1,l,void 0,l)}CreateInstanceFromData(d,e,h,g,l, m,u,w,q){var t=null;let p=null;if(d instanceof f.ObjectClass){p=d;if(p.IsFamily()){d=p.GetFamilyMembers();var r=Math.floor(this.Random()*d.length);p=d[r]}t=p.GetDefaultInstanceData()}else t=d,p=this.GetObjectClassByIndex(t[1]);var x=p.GetPlugin().IsWorldType();if(this._isLoading&&x&&!p.IsOnLoaderLayout())return null;const y=e;x||(e=null);var E=h&&!m&&t&&!this._instancesByUid.has(t[2])?t[2]:this._nextUid++;r=t?t[0]:null;d=f.New(f.Instance,{runtime:this,objectType:p,layer:e,worldData:r,instVarData:t? t[3]:null,uid:E});this._instancesByUid.set(E,d);E=null;x&&(E=d.GetWorldInfo(),"undefined"!==typeof g&&"undefined"!==typeof l&&(E.SetX(g),E.SetY(l)),p._SetAnyCollisionCellChanged(!0));e&&(q||e._AddInstance(d,!0),1===e.GetParallaxX()&&1===e.GetParallaxY()||p._SetAnyInstanceParallaxed(!0),e.GetLayout().MaybeLoadTexturesFor(p));this._objectCount++;let H=!0;if(w){var A=w.GetObjectClass();A.IsInContainer()&&p.IsInContainer()&&(w=p.GetContainer(),A=A.GetContainer(),w===A&&(H=!1))}if(p.IsInContainer()&&!h&& !m&&H){for(var F of p.GetContainer().objectTypes())F!==p&&(w=this.CreateInstanceFromData(F,y,!1,E?E.GetX():g,E?E.GetY():l,!0,!1,void 0,q),d._AddSibling(w));for(var J of d.siblings()){J._AddSibling(d);for(const B of d.siblings())J!==B&&J._AddSibling(B)}}x&&!h&&u&&this._CreateChildInstancesFromData(d,r,E,e,g,l,q);if(p.IsInContainer()&&!h&&!m&&u)for(const B of d.siblings())if(h=B.GetWorldInfo())F=B.GetPlugin(),J=B.GetObjectClass().GetDefaultInstanceData()[0],F.IsWorldType()?this._CreateChildInstancesFromData(B, J,h,e,h.GetX(),h.GetY(),q):this._CreateChildInstancesFromData(B,J,h,e,void 0,void 0,q);!m&&u&&("undefined"===typeof g&&(g=r[0]),"undefined"===typeof l&&(l=r[1]),e=E.GetTopParent(),g=g-E.GetX()+e.GetX(),l=l-E.GetY()+e.GetY(),e.SetXY(g,l));p._SetIIDsStale();l=t?f.cloneArray(t[5]):null;t=t?t[4].map(B=>f.cloneArray(B)):null;(x=x&&r&&r[13])&&d._SetHasTilemap();d._CreateSdkInstance(l,t);x&&(r=r[13],d.GetSdkInstance().LoadTilemapData(r[2],r[0],r[1]));this._instancesPendingCreate.push(d);this._hasPendingInstances= !0;this.IsDebug()&&b.InstanceCreated(d);return d}_CreateChildInstancesFromData(d,e,h,g,l,m,u){var w=h.GetSceneGraphZIndexExportData(),q=h.GetSceneGraphChildrenExportData();d.GetWorldInfo().SetSceneGraphZIndex(w);if(q){"undefined"===typeof l&&(l=e[0]);"undefined"===typeof m&&(m=e[1]);w=new Set;h=e[0];e=e[1];for(const y of q){var t=y[1],p=y[2];q=y[3];var r=!!y[4];const E=y[5];p=this._layoutManager.GetLayoutBySID(y[0]).GetLayer(t).GetInitialInstanceData(p);t=this.GetObjectClassByIndex(p[1]);var x=d.HasSibling(t); const H=w.has(t);x&&!H&&r?(r=d.GetSibling(t),x=l+p[0][0]-h,p=m+p[0][1]-e,r.GetWorldInfo().SetXY(x,p),r.GetWorldInfo().SetSceneGraphZIndex(E),d.AddChild(r,{transformX:!!(q>>0&1),transformY:!!(q>>1&1),transformWidth:!!(q>>2&1),transformHeight:!!(q>>3&1),transformAngle:!!(q>>4&1),destroyWithParent:!!(q>>5&1),transformZElevation:!!(q>>6&1)}),w.add(t)):(t=this.CreateInstanceFromData(p,g,!1,l+p[0][0]-h,m+p[0][1]-e,!1,!0,d,u),t.GetWorldInfo().SetSceneGraphZIndex(E),d.AddChild(t,{transformX:!!(q>>0&1),transformY:!!(q>> 1&1),transformWidth:!!(q>>2&1),transformHeight:!!(q>>3&1),transformAngle:!!(q>>4&1),destroyWithParent:!!(q>>5&1),transformZElevation:!!(q>>6&1)}))}}}DestroyInstance(d){if(!this._instancesToReleaseAtEndOfTick.has(d)){var e=d.GetObjectClass(),h=this._instancesPendingDestroy.get(e);if(h){if(h.has(d))return;h.add(d)}else h=new Set,h.add(d),this._instancesPendingDestroy.set(e,h);this.IsDebug()&&b.InstanceDestroyed(d);d._MarkDestroyed();this._hasPendingInstances=!0;if(d.IsInContainer())for(const g of d.siblings())this.DestroyInstance(g); for(const g of d.children())g.GetDestroyWithParent()&&this.DestroyInstance(g);this._layoutManager.IsEndingLayout()||this._isLoadingState||(e=this.GetEventSheetManager(),e.BlockFlushingInstances(!0),d._TriggerOnDestroyed(),e.BlockFlushingInstances(!1));d._FireDestroyedScriptEvents(this._layoutManager.IsEndingLayout())}}FlushPendingInstances(){this._hasPendingInstances&&(this._isFlushingPendingInstances=!0,this._FlushInstancesPendingCreate(),this._FlushInstancesPendingDestroy(),this._hasPendingInstances= this._isFlushingPendingInstances=!1,this.UpdateRender())}_FlushInstancesPendingCreate(){for(const d of this._instancesPendingCreate){const e=d.GetObjectClass();e._AddInstance(d);for(const h of e.GetFamilies())h._AddInstance(d),h._SetIIDsStale()}f.clearArray(this._instancesPendingCreate)}_FlushInstancesPendingDestroy(){this._dispatcher.SetDelayRemoveEventsEnabled(!0);for(const [d,e]of this._instancesPendingDestroy.entries())this._FlushInstancesPendingDestroyForObjectClass(d,e),e.clear();this._instancesPendingDestroy.clear(); this._dispatcher.SetDelayRemoveEventsEnabled(!1)}_FlushInstancesPendingDestroyForObjectClass(d,e){for(const g of e){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--}f.arrayRemoveAllInSet(d.GetInstances(),e);d._SetIIDsStale();this._instancesToReleaseAffectedObjectClasses.add(d); 0===d.GetInstances().length&&d._SetAnyInstanceParallaxed(!1);for(const g of d.GetFamilies())f.arrayRemoveAllInSet(g.GetInstances(),e),g._SetIIDsStale(),this._instancesToReleaseAffectedObjectClasses.add(g);if(d.GetPlugin().IsWorldType()){d=new Set([...e].map(g=>g.GetWorldInfo().GetLayer()));for(const g of d)g._RemoveAllInstancesInSet(e)}}_GetInstancesPendingCreate(){return this._instancesPendingCreate}*instancesPendingCreateForObjectClass(d){for(const e of this._GetInstancesPendingCreate())d.IsFamily()? e.GetObjectClass().BelongsToFamily(d)&&(yield e):e.GetObjectClass()===d&&(yield e)}_GetNewUID(){return this._nextUid++}_MapInstanceByUID(d,e){this._instancesByUid.set(d,e)}_OnWebGLContextLost(){this._dispatcher.dispatchEvent(f.New(f.Event,"webglcontextlost"));this.SetSuspended(!0);for(var d of this._allObjectClasses)!d.IsFamily()&&d.HasLoadedTextures()&&d.ReleaseTextures();(d=this.GetMainRunningLayout())&&d._OnWebGLContextLost();f.ImageInfo.OnWebGLContextLost();f.ImageAsset.OnWebGLContextLost()}async _OnWebGLContextRestored(){await this.GetMainRunningLayout()._Load(null, this.GetWebGLRenderer());this._dispatcher.dispatchEvent(f.New(f.Event,"webglcontextrestored"));this.SetSuspended(!1);this.UpdateRender()}_OnVisibilityChange(d){this.SetSuspended(d.hidden)}_OnWindowBlur(d){this.IsPreview()&&this._pauseOnBlur&&!f.Platform.IsMobile&&!d.data.parentHasFocus&&(this.SetSuspended(!0),this._isPausedOnBlur=!0)}_OnWindowFocus(){this._isPausedOnBlur&&(this.SetSuspended(!1),this._isPausedOnBlur=!1)}_RequestAnimationFrame(){const d=this._tickCallbacks;"vsync"===this._framerateMode? -1===this._rafId&&(this._rafId=self.requestAnimationFrame(d.normal)):"unlimited-tick"===this._framerateMode?(-1===this._ruafId&&(this._ruafId=f.RequestUnlimitedAnimationFrame(d.tickOnly)),-1===this._rafId&&(this._rafId=self.requestAnimationFrame(d.renderOnly))):-1===this._ruafId&&(this._ruafId=f.RequestUnlimitedAnimationFrame(d.normal))}_CancelAnimationFrame(){-1!==this._rafId&&(self.cancelAnimationFrame(this._rafId),this._rafId=-1);-1!==this._ruafId&&(f.CancelUnlimitedAnimationFrame(this._ruafId), this._ruafId=-1)}IsSuspended(){return 0this._suspendCount&&(this._suspendCount=0);d=this.IsSuspended();!e&&d?(console.log("[Construct 3] Suspending"),this._CancelAnimationFrame(),this._dispatcher.dispatchEvent(f.New(f.Event,"suspend")),this.Trigger(f.Plugins.System.Cnds.OnSuspend,null,null)):e&&!d&&(console.log("[Construct 3] Resuming"),this._fpsLastTime=this._lastTickTime=e=performance.now(),this._mainThreadTimeCounter= this._mainThreadTime=this._fps=this._fpsFrameCount=0,this._dispatcher.dispatchEvent(f.New(f.Event,"resume")),this.Trigger(f.Plugins.System.Cnds.OnResume,null,null),this.HitBreakpoint()||this.Tick(e))}_AddBehInstToTick(d){this._behInstsToTick.Add(d)}_AddBehInstToPostTick(d){this._behInstsToPostTick.Add(d)}_AddBehInstToTick2(d){this._behInstsToTick2.Add(d)}_RemoveBehInstToTick(d){this._behInstsToTick.Remove(d)}_RemoveBehInstToPostTick(d){this._behInstsToPostTick.Remove(d)}_RemoveBehInstToTick2(d){this._behInstsToTick2.Remove(d)}_BehaviorTick(){this._behInstsToTick.SetQueueingEnabled(!0); for(const d of this._behInstsToTick)d.Tick();this._behInstsToTick.SetQueueingEnabled(!1)}_BehaviorPostTick(){this._behInstsToPostTick.SetQueueingEnabled(!0);for(const d of this._behInstsToPostTick)d.PostTick();this._behInstsToPostTick.SetQueueingEnabled(!1)}_BehaviorTick2(){this._behInstsToTick2.SetQueueingEnabled(!0);for(const d of this._behInstsToTick2)d.Tick2();this._behInstsToTick2.SetQueueingEnabled(!1)}*_DebugBehaviorTick(){this._behInstsToTick.SetQueueingEnabled(!0);for(const d of this._behInstsToTick){const e= d.Tick();f.IsIterator(e)&&(yield*e)}this._behInstsToTick.SetQueueingEnabled(!1)}*_DebugBehaviorPostTick(){this._behInstsToPostTick.SetQueueingEnabled(!0);for(const d of this._behInstsToPostTick){const e=d.PostTick();f.IsIterator(e)&&(yield*e)}this._behInstsToPostTick.SetQueueingEnabled(!1)}*_DebugBehaviorTick2(){this._behInstsToTick2.SetQueueingEnabled(!0);for(const d of this._behInstsToTick2){const e=d.Tick2();f.IsIterator(e)&&(yield*e)}this._behInstsToTick2.SetQueueingEnabled(!1)}async Tick(d,e, h){this._hasStartedTicking=!0;const g="background-wake"===h;h="background-wake"!==h&&"skip-render"!==h;this._hasStarted&&(!this.IsSuspended()||e||g)&&(e=performance.now(),this._isInTick=!0,this._MeasureDt(d||0),d=this.Step_BeforePreTick(),this.IsDebugging()&&await d,d=this._dispatcher.dispatchEventAndWait_AsyncOptional(this._eventObjects.pretick),d instanceof Promise&&await d,d=this.Step_AfterPreTick(),this.IsDebugging()&&await d,this._NeedsHandleSaveOrLoad()&&await this._HandleSaveOrLoad(),this.GetLayoutManager().IsPendingChangeMainLayout()&& await this._MaybeChangeLayout(),d=this.Step_RunEventsEtc(),this.IsDebugging()&&await d,h&&this.Render(),this.IsSuspended()||g||this._RequestAnimationFrame(),this._tickCount++,this._tickCountNoSave++,this._execCount++,this._isInTick=!1,this._mainThreadTimeCounter+=performance.now()-e)}async Step_BeforePreTick(){const d=this._eventSheetManager,e=this.IsDebug();this.FlushPendingInstances();d.BlockFlushingInstances(!0);this.PushCurrentLayout(this.GetMainRunningLayout());e&&b.StartMeasuringTime();this.IsDebugging()? await d.DebugRunScheduledWaits():d.RunScheduledWaits();e&&b.AddEventsTime();this.PopCurrentLayout();d.BlockFlushingInstances(!1);this.FlushPendingInstances();d.BlockFlushingInstances(!0)}async Step_AfterPreTick(){const d=this.IsDebug(),e=this.IsDebugging(),h=this._dispatcher,g=this._eventObjects,l=this._userScriptEventObjects;d&&b.StartMeasuringTime();e?await this.DebugIterateAndBreak(this._DebugBehaviorTick()):this._BehaviorTick();e?await this.DebugIterateAndBreak(this._DebugBehaviorPostTick()): this._BehaviorPostTick();d&&b.AddBehaviorTickTime();d&&b.StartMeasuringTime();e?await this.DebugFireGeneratorEventAndBreak(g.tick):h.dispatchEvent(g.tick);d&&b.AddPluginTickTime();this._eventSheetManager.BlockFlushingInstances(!1);this.DispatchUserScriptEvent(l.tick)}async Step_RunEventsEtc(){const d=this._eventSheetManager,e=this._dispatcher,h=this._eventObjects,g=this.IsDebug(),l=this.IsDebugging();g&&b.StartMeasuringTime();l?await d.DebugRunEvents(this._layoutManager):d.RunEvents(this._layoutManager); g&&b.AddEventsTime();this._collisionEngine.ClearRegisteredCollisions();this._ReleaseInstancesAtEndOfTick();this._isLayoutFirstTick=!1;d.BlockFlushingInstances(!0);g&&b.StartMeasuringTime();l?await this.DebugIterateAndBreak(this._DebugBehaviorTick2()):this._BehaviorTick2();g&&b.AddBehaviorTickTime();g&&b.StartMeasuringTime();l?await this.DebugFireGeneratorEventAndBreak(h.tick2):e.dispatchEvent(h.tick2);g&&b.AddPluginTickTime();d.BlockFlushingInstances(!1);l&&await d.RunQueuedDebugTriggersAsync()}_ReleaseInstancesAtEndOfTick(){if(0!== this._instancesToReleaseAtEndOfTick.size){var d=this._dispatcher;d.SetDelayRemoveEventsEnabled(!0);for(const e of this._instancesToReleaseAffectedObjectClasses)e.GetSolStack().RemoveInstances(this._instancesToReleaseAtEndOfTick);this._instancesToReleaseAffectedObjectClasses.clear();this._eventSheetManager.RemoveInstancesFromScheduledWaits(this._instancesToReleaseAtEndOfTick);for(const e of this._instancesToReleaseAtEndOfTick)e.Release();this._instancesToReleaseAtEndOfTick.clear();d.SetDelayRemoveEventsEnabled(!1)}}async _MaybeChangeLayout(){const d= this.GetLayoutManager();let e=0;for(;d.IsPendingChangeMainLayout()&&10>e++;)await this._DoChangeLayout(d.GetPendingChangeMainLayout())}_MeasureDt(d){let e=0;0!==this._lastTickTime&&(e=Math.max(d-this._lastTickTime,0)/1E3,.5d)d=0;this._timeScale=d}SetMinimumFramerate(d){this._minimumFramerate=f.clamp(d,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(d){if(this._isLoadingState)throw Error("cannot call while loading state - wait until afterload event"); return this._instancesByUid.get(d)||null}_RefreshUidMap(){this._instancesByUid.clear();for(const d of this._allObjectClasses)if(!d.IsFamily())for(const e of d.GetInstances())this._instancesByUid.set(e.GetUID(),e)}IsPreview(){return"preview"===this._exportType}IsDebug(){return this._isDebug}GetExportType(){return this._exportType}IsCordova(){return"cordova"===this._exportType}IsAndroidWebView(){return"Android"===f.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 d=this.GetRenderer();return this.GetViewportHeight()/2/Math.tan(d.GetFovY()/2)/d.GetDefaultCameraZ()}IsLayoutFirstTick(){return this._isLayoutFirstTick}SetPixelRoundingEnabled(d){d= !!d;this._isPixelRoundingEnabled!==d&&(this._isPixelRoundingEnabled=d,this.GetLayoutManager().SetAllLayerMVChanged(),this.UpdateRender())}IsPixelRoundingEnabled(){return this._isPixelRoundingEnabled}SaveToSlot(d){this._saveToSlotName=d}LoadFromSlot(d){this._loadFromSlotName=d}LoadFromJsonString(d){this._loadFromJson=d}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()&&b.StepIfPausedInDebugger());if(null!==this._loadFromJson){this.FlushPendingInstances();try{await this._DoLoadFromJsonString(this._loadFromJson),this._lastSaveJson=this._loadFromJson,await this.TriggerAsync(f.Plugins.System.Cnds.OnLoadComplete,null),this._lastSaveJson=""}catch(d){console.error("[Construct 3] Failed to load state from JSON string: ", d),await this.TriggerAsync(f.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(d){const e=await this._SaveToJsonString();try{await this._GetSavegamesStorage().setItem(d,e),console.log("[Construct 3] Saved state to storage ("+e.length+" chars)"),this._lastSaveJson=e,await this.TriggerAsync(f.Plugins.System.Cnds.OnSaveComplete,null),this._lastSaveJson=""}catch(h){console.error("[Construct 3] Failed to save state to storage: ",h),await this.TriggerAsync(f.Plugins.System.Cnds.OnSaveFailed, null)}}async _DoLoadFromSlot(d){try{const e=await this._GetSavegamesStorage().getItem(d);if(!e)throw Error("empty slot");console.log("[Construct 3] Loaded state from storage ("+e.length+" chars)");await this._DoLoadFromJsonString(e);this._lastSaveJson=e;await this.TriggerAsync(f.Plugins.System.Cnds.OnLoadComplete,null);this._lastSaveJson=""}catch(e){console.error("[Construct 3] Failed to load state from storage: ",e),await this.TriggerAsync(f.Plugins.System.Cnds.OnLoadFailed,null)}}async _SaveToJsonString(){const d= {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 e of this._allObjectClasses)e.IsFamily()|| e.HasNoSaveBehavior()||(d.types[e.GetSID().toString()]=e._SaveToJson());for(const h of this._layoutManager.GetAllLayouts())d.layouts[h.GetSID().toString()]=h._SaveToJson();e=this._CreateUserScriptEvent("save");e.saveData=null;await this.DispatchUserScriptEventAsyncWait(e);d.user_script_data=e.saveData;return JSON.stringify(d)}IsLoadingState(){return this._isLoadingState}async _DoLoadFromJsonString(d){var e=this.GetLayoutManager();d=JSON.parse(d);if(d.c2save)throw Error("C2 saves are incompatible with C3 runtime"); if(!d.c3save)throw Error("not valid C3 save data");if(1h||h>=g.length)throw Error("missing sibling instance");m._AddSibling(g[h])}}this._timelineManager._LoadFromJson(d.timelines);e.SetAllLayerProjectionChanged();e.SetAllLayerMVChanged();this._dispatcher.dispatchEvent(f.New(f.Event,"afterload"));e=this._CreateUserScriptEvent("load");e.saveData=d.user_script_data; await this.DispatchUserScriptEventAsyncWait(e);this.UpdateRender()}async AddJobWorkerScripts(d){d=(await Promise.all(d.map(e=>this._assetManager.FetchBlob(e)))).map(e=>URL.createObjectURL(e));this._jobScheduler.ImportScriptsToJobWorkers(d)}AddJobWorkerBlob(d,e){this._jobScheduler.SendBlobToJobWorkers(d,e)}AddJobWorkerBuffer(d,e){this._jobScheduler.SendBufferToJobWorkers(d,e)}AddJob(d,e,h){return this._jobScheduler.AddJob(d,e,h)}BroadcastJob(d,e,h){return this._jobScheduler.BroadcastJob(d,e,h)}InvokeDownload(d, e){this.PostComponentMessageToDOM("runtime","invoke-download",{url:d,filename:e})}async RasterSvgImage(d,e,h,g,l,m){g=g||e;l=l||h;if(this.IsInWorker())return(await this.PostComponentMessageToDOMAsync("runtime","raster-svg-image",{blob:d,imageWidth:e,imageHeight:h,surfaceWidth:g,surfaceHeight:l,imageBitmapOpts:m})).imageBitmap;d=await self.C3_RasterSvgImageBlob(d,e,h,g,l);return m?await self.createImageBitmap(d,m):d}async GetSvgImageSize(d){return this.IsInWorker()?await this.PostComponentMessageToDOMAsync("runtime", "get-svg-image-size",{blob:d}):await self.C3_GetSvgImageSize(d)}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(d){this._randomNumberCallback= d}_GetRemotePreviewStatusInfo(){const d=this.GetWebGLRenderer();return{fps:this.GetFPS(),cpu:this.GetMainThreadTime(),gpu:this.GetGPUUtilisation(),layout:this.GetMainRunningLayout()?this.GetMainRunningLayout().GetName():"",renderer:d?d.GetUnmaskedRenderer():""}}HitBreakpoint(){return this.IsDebug()?b.HitBreakpoint():!1}DebugBreak(d){return this.IsDebugging()?b.DebugBreak(d):Promise.resolve()}DebugBreakNext(){return this.IsDebugging()?b.BreakNext():!1}SetDebugBreakpointsEnabled(d){this._breakpointsEnabled= !!d;this._UpdateDebuggingFlag()}AreDebugBreakpointsEnabled(){return this._breakpointsEnabled}IsDebugging(){return this._isDebugging}SetDebuggingEnabled(d){d?this._debuggingDisabled--:this._debuggingDisabled++;this._UpdateDebuggingFlag()}_UpdateDebuggingFlag(){this._isDebugging=this.IsDebug()&&this._breakpointsEnabled&&0===this._debuggingDisabled}IsCPUProfiling(){return this.IsDebug()&&b.IsCPUProfiling()}IsGPUProfiling(){return this.IsDebug()&&this.GetRenderer().SupportsGPUProfiling()&&b.IsGPUProfiling()}async DebugIterateAndBreak(d){if(d)for(const e of d)await this.DebugBreak(e)}DebugFireGeneratorEventAndBreak(d){return this.DebugIterateAndBreak(this._dispatcher.dispatchGeneratorEvent(d))}_InvokeFunctionFromJS(d){return this._eventSheetManager._InvokeFunctionFromJS(d.name, d.params)}GetIRuntime(){return this._iRuntime}_CreateUserScriptEvent(d){d=f.New(f.Event,d,!1);d.runtime=this._iRuntime;return d}_InitScriptInterfaces(){var d={};for(const e of this._allObjectClasses)d[e.GetJsPropName()]={value:e.GetIObjectClass(),enumerable:!0,writable:!1};d=Object.create(Object.prototype,d);this._iRuntime=new self.IRuntime(this,d);this._userScriptEventObjects={tick:this._CreateUserScriptEvent("tick")}}_InitGlobalVariableScriptInterface(){const d={};for(const e of this.GetEventSheetManager().GetAllGlobalVariables())d[e.GetJsPropName()]= e._GetScriptInterfaceDescriptor();this._iRuntime._InitGlobalVars(d)}_GetCommonScriptInterfaces(){return this._commonScriptInterfaces}_MapScriptInterface(d,e){this._interfaceMap.set(d,e)}_UnwrapScriptInterface(d){return this._interfaceMap.get(d)}_UnwrapIObjectClass(d){if(!(d instanceof self.IObjectClass))throw new TypeError("expected IObjectClass");d=this._UnwrapScriptInterface(d);if(!(d&&d instanceof f.ObjectClass))throw Error("invalid IObjectClass");return d}_UnwrapIWorldInstance(d){if(!(d instanceof self.IWorldInstance))throw new TypeError("expected IWorldInstance");d=this._UnwrapScriptInterface(d);if(!(d&&d instanceof f.Instance))throw Error("invalid IInstance");return d}};self.C3_CreateRuntime=f.Runtime.Create;self.C3_InitRuntime=(d,e)=>d.Init(e)} {"use strict";const f=self.C3;f.JobSchedulerRuntime=class extends f.DefendedBase{constructor(b,a){super();this._runtime=b;this._jobPromises=new Map;this._nextJobId=0;this._inputPort=a.inputPort;a.outputPort.onmessage=c=>this._OnJobWorkerMessage(c);this._maxNumWorkers=a.maxNumWorkers;this._jobWorkerCount=1;this._hadErrorCreatingWorker=this._isCreatingWorker=!1}async Init(){}ImportScriptsToJobWorkers(b){this._inputPort.postMessage({type:"_import_scripts",scripts:b})}SendBlobToJobWorkers(b,a){this._inputPort.postMessage({type:"_send_blob", blob:b,id:a})}SendBufferToJobWorkers(b,a){this._inputPort.postMessage({type:"_send_buffer",buffer:b,id:a},[b])}AddJob(b,a,c,d,e){c||(c=[]);const h=this._nextJobId++;b={type:b,isBroadcast:!1,jobId:h,params:a,transferables:c};a=new Promise((g,l)=>{this._jobPromises.set(h,{resolve:g,progress:d,reject:l,cancelled:!1})});e&&e.SetAction(()=>this._CancelJob(h));this._inputPort.postMessage(b,c);this._MaybeCreateExtraWorker();return a}BroadcastJob(b,a,c){c||(c=[]);const d=this._nextJobId++;this._inputPort.postMessage({type:b, isBroadcast:!0,jobId:d,params:a,transferables:c},c)}_CancelJob(b){const a=this._jobPromises.get(b);a&&(a.cancelled=!0,a.resolve=null,a.progress=null,a.reject=null,this._inputPort.postMessage({type:"_cancel",jobId:b}))}_OnJobWorkerMessage(b){b=b.data;const a=b.type,c=b.jobId;switch(a){case "result":this._OnJobResult(c,b.result);break;case "progress":this._OnJobProgress(c,b.progress);break;case "error":this._OnJobError(c,b.error);break;case "ready":this._OnJobWorkerReady();break;default:throw Error(`unknown message from worker '${a}'`); }}_OnJobResult(b,a){const c=this._jobPromises.get(b);if(!c)throw Error("invalid job ID");c.cancelled||c.resolve(a);this._jobPromises.delete(b)}_OnJobProgress(b,a){b=this._jobPromises.get(b);if(!b)throw Error("invalid job ID");!b.cancelled&&b.progress&&b.progress(a)}_OnJobError(b,a){const c=this._jobPromises.get(b);if(!c)throw Error("invalid job ID");c.cancelled||c.reject(a);this._jobPromises.delete(b)}_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=b=>this._OnJobWorkerMessage(b)}catch(b){this._hadErrorCreatingWorker=!0,this._isCreatingWorker= !1,console.error(`[Construct 3] Failed to create job worker; stopping creating any more (created ${this._jobWorkerCount} so far)`,b)}}}}self.C3_Shaders={}; self.C3_Shaders.brightness={glsl:"varying mediump vec2 vTex;\nuniform lowp sampler2D samplerFront;\nuniform lowp float brightness;\nvoid main(void)\n{\nlowp vec4 front = texture2D(samplerFront, vTex);\nlowp float a = front.a;\nif (a != 0.0)\nfront.rgb /= front.a;\nfront.rgb += (brightness - 1.0);\nfront.rgb *= a;\ngl_FragColor = front;\n}",wgsl:"%%SAMPLERFRONT_BINDING%% var samplerFront : sampler;\n%%TEXTUREFRONT_BINDING%% var textureFront : texture_2d;\n[[block]] struct ShaderParams {\nbrightness : f32;\n};\n%%SHADERPARAMS_BINDING%% var shaderParams : ShaderParams;\n%%C3_UTILITY_FUNCTIONS%%\n%%FRAGMENTINPUT_STRUCT%%\n%%FRAGMENTOUTPUT_STRUCT%%\n[[stage(fragment)]]\nfn main(input : FragmentInput) -> FragmentOutput\n{\nvar front : vec4 = c3_unpremultiply(textureSample(textureFront, samplerFront, input.fragUV));\nvar output : FragmentOutput;\noutput.color = vec4((front.rgb + (shaderParams.brightness - 1.0)) * front.a, front.a);\nreturn output;\n}",blendsBackground:!1, usesDepth:!1,extendBoxHorizontal:0,extendBoxVertical:0,crossSampling:!1,mustPreDraw:!1,preservesOpaqueness:!0,animated:!1,parameters:[["brightness",0,"percent"]]}; self.C3_Shaders.grayscale={glsl:"varying mediump vec2 vTex;\nuniform lowp sampler2D samplerFront;\nuniform lowp float intensity;\nvoid main(void)\n{\nlowp vec4 front = texture2D(samplerFront, vTex);\nlowp float gray = front.r * 0.299 + front.g * 0.587 + front.b * 0.114;\ngl_FragColor = mix(front, vec4(gray, gray, gray, front.a), intensity);\n}",wgsl:"%%SAMPLERFRONT_BINDING%% var samplerFront : sampler;\n%%TEXTUREFRONT_BINDING%% var textureFront : texture_2d;\n[[block]] struct ShaderParams {\nintensity : f32;\n};\n%%SHADERPARAMS_BINDING%% var shaderParams : ShaderParams;\n%%C3_UTILITY_FUNCTIONS%%\n%%FRAGMENTINPUT_STRUCT%%\n%%FRAGMENTOUTPUT_STRUCT%%\n[[stage(fragment)]]\nfn main(input : FragmentInput) -> FragmentOutput\n{\nvar front : vec4 = textureSample(textureFront, samplerFront, input.fragUV);\nvar gray : f32 = c3_grayscale(front.rgb);\nvar output : FragmentOutput;\noutput.color = mix(front, vec4(gray, gray, gray, front.a), shaderParams.intensity);\nreturn output;\n}", blendsBackground:!1,usesDepth:!1,extendBoxHorizontal:0,extendBoxVertical:0,crossSampling:!1,mustPreDraw:!1,preservesOpaqueness:!0,animated:!1,parameters:[["intensity",0,"percent"]]}; self.C3_Shaders.vignette={glsl:"varying mediump vec2 vTex;\nuniform lowp sampler2D samplerFront;\nuniform mediump vec2 srcStart;\nuniform mediump vec2 srcEnd;\nuniform mediump float vignetteStart;\nuniform mediump float vignetteEnd;\nvoid main(void)\n{\nlowp vec4 front = texture2D(samplerFront, vTex);\nlowp float a = front.a;\nif (a != 0.0)\nfront.rgb /= a;\nmediump vec2 tex = (vTex - srcStart) / (srcEnd - srcStart);\nlowp float d = distance(tex, vec2(0.5, 0.5));\nfront.rgb *= smoothstep(vignetteEnd, vignetteStart, d);\nfront.rgb *= a;\ngl_FragColor = front;\n}",wgsl:"%%SAMPLERFRONT_BINDING%% var samplerFront : sampler;\n%%TEXTUREFRONT_BINDING%% var textureFront : texture_2d;\n[[block]] struct ShaderParams {\nvignetteStart : f32;\nvignetteEnd : f32;\n};\n%%SHADERPARAMS_BINDING%% var shaderParams : ShaderParams;\n%%C3PARAMS_STRUCT%%\n%%C3_UTILITY_FUNCTIONS%%\n%%FRAGMENTINPUT_STRUCT%%\n%%FRAGMENTOUTPUT_STRUCT%%\nlet center : vec2 = vec2(0.5);\n[[stage(fragment)]]\nfn main(input : FragmentInput) -> FragmentOutput\n{\nvar front : vec4 = c3_unpremultiply(textureSample(textureFront, samplerFront, input.fragUV));\nvar rgb : vec3 = front.rgb;\nvar tex : vec2 = c3_srcToNorm(input.fragUV);\nvar d : f32 = distance(tex, center);\nrgb = rgb * smoothStep(shaderParams.vignetteEnd, shaderParams.vignetteStart, d);\nvar output : FragmentOutput;\noutput.color = vec4(rgb * front.a, front.a);\nreturn output;\n}", blendsBackground:!1,usesDepth:!1,extendBoxHorizontal:0,extendBoxVertical:0,crossSampling:!1,mustPreDraw:!1,preservesOpaqueness:!0,animated:!1,parameters:[["vignetteStart",0,"percent"],["vignetteEnd",0,"percent"]]}; {"use strict";const f=self.C3;let b=null,a="",c="",d=[],e="",h="",g="";const l=f.New(f.ArrayStack);function m(u,w){u=u[1];w=w[1];if("number"===typeof u&&"number"===typeof w)return u-w;u=""+u;w=""+w;return uw?1:0}f.Plugins.System=class extends f.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,w){b&&u===a&&w===c||(b=new RegExp(u,w),a=u,c=w);b.lastIndex=0;return b}GetRegexMatches(u,w,q){if(u===e&&w===h&&q===g)return d;const t=this.GetRegex(w,q);d=u.match(t);e=u;h=w;g=q;return d}async _LoadTexturesForObjectClasses(u,w){if(w.length){this._imagesLoadingTotal+=w.length;var q=[];for(const t of w)q.push(u.MaybeLoadTexturesFor(t));await f.PromiseAllWithProgress(q, ()=>{this._imagesLoadingComplete++});this._imagesLoadingComplete++;this._imagesLoadingComplete===this._imagesLoadingTotal&&(this._runtime.Trigger(f.Plugins.System.Cnds.OnImageLoadingComplete,null,null),this._imagesLoadingTotal=this._imagesLoadingComplete=0)}}_UnloadTexturesForObjectClasses(u,w){for(const q of w)0===q.GetInstanceCount()&&u.MaybeUnloadTexturesFor(q)}_GetForEachStack(){return l}_Repeat(u){var w=this._runtime.GetEventSheetManager();const q=w.GetEventStack(),t=q.GetCurrentStackFrame(), p=t.GetCurrentEvent(),r=p.GetSolModifiers();var x=t.IsSolModifierAfterCnds();const y=q.Push(p),E=w.GetLoopStack(),H=E.Push();H.SetEnd(u);if(x)for(x=0;x=q&&!F.IsStopped();--u)t.PushCopySol(y),F.SetIndex(u),x.Retrigger(r,H),t.PopSol(y);else for(t= w;t>=q&&!F.IsStopped();--t)F.SetIndex(t),x.Retrigger(r,H);else if(E)for(u=w;u<=q&&!F.IsStopped();++u)t.PushCopySol(y),F.SetIndex(u),x.Retrigger(r,H),t.PopSol(y);else for(t=w;t<=q&&!F.IsStopped();++t)F.SetIndex(t),x.Retrigger(r,H);p.Pop();A.Pop();return!1}*_DebugFor(u,w,q){var t=this._runtime.GetEventSheetManager();const p=t.GetEventStack(),r=p.GetCurrentStackFrame(),x=r.GetCurrentEvent(),y=x.GetSolModifiers(),E=r.IsSolModifierAfterCnds(),H=p.Push(x),A=t.GetLoopStack(),F=A.Push();F.SetName(u);F.SetEnd(q); if(q=q&&!F.IsStopped();--u)t.PushCopySol(y),F.SetIndex(u),yield*x.DebugRetrigger(r,H),t.PopSol(y);else for(t=w;t>=q&&!F.IsStopped();--t)F.SetIndex(t),yield*x.DebugRetrigger(r,H);else if(E)for(u=w;u<=q&&!F.IsStopped();++u)t.PushCopySol(y),F.SetIndex(u),yield*x.DebugRetrigger(r,H),t.PopSol(y);else for(t=w;t<=q&&!F.IsStopped();++t)F.SetIndex(t),yield*x.DebugRetrigger(r,H);p.Pop();A.Pop();return!1}_ForEach(u){var w=this._runtime.GetEventSheetManager();const q=w.GetEventStack(),t=q.GetCurrentStackFrame(), p=t.GetCurrentEvent(),r=p.GetSolModifiers();var x=t.IsSolModifierAfterCnds();const y=q.Push(p),E=w.GetLoopStack(),H=E.Push(),A=u.IsInContainer(),F=u.GetCurrentSol(),J=l.Push();f.shallowAssignArray(J,F.GetInstances());H.SetEnd(J.length);if(x)for(let B=0,I=J.length;B=d+h)return c.set("Every_lastTime",d+h),e>=c.get("Every_lastTime")+.04&&c.set("Every_lastTime",e),c.set("Every_seconds",a),!0;e=c&&a<=d},CompareVar(a,c,d){return f.compare(a.GetValue(),c,d)},CompareBoolVar(a){return!!a.GetValue()}, CompareTime(a,c){const d=this._runtime.GetGameTime();return 0===a?(a=this._runtime.GetCurrentCondition().GetSavedDataMap(),!a.get("CompareTime_executed")&&d>=c?(a.set("CompareTime_executed",!0),!0):!1):f.compare(d,a,c)},IsNaN(a){return isNaN(a)},AngleWithin(a,c,d){return f.angleDiff(f.toRadians(a),f.toRadians(d))<=f.toRadians(c)},IsClockwiseFrom(a,c){return f.angleClockwise(f.toRadians(a),f.toRadians(c))},IsBetweenAngles(a,c,d){a=f.toRadians(a);c=f.toRadians(c);d=f.toRadians(d);return f.angleClockwise(d, c)?f.angleClockwise(a,c)&&!f.angleClockwise(a,d):!(!f.angleClockwise(a,c)&&f.angleClockwise(a,d))},IsValueType(a,c){return"number"===typeof a?0===c:1===c},EvaluateExpression(a){return!!a},PickByComparison(a,c,d,e){if(!a)return!1;const h=this._GetForEachStack(),g=h.Push(),l=a.GetCurrentSol();f.shallowAssignArray(g,l.GetInstances());l.IsSelectAll()&&f.clearArray(l._GetOwnElseInstances());const m=this._runtime.GetCurrentCondition();let u=0;for(let w=0,q=g.length;w=e.length)return!1;d.PickOne(e[c]);a.ApplySolToContainer();return!0},PickRandom(a){if(!a)return!1;const c=a.GetCurrentSol(),d=c.GetInstances(),e=Math.floor(this._runtime.Random()*d.length);if(e>=d.length)return!1;c.PickOne(d[e]);a.ApplySolToContainer();return!0},PickAll(a){if(!a|| !a.GetInstanceCount())return!1;a.GetCurrentSol()._SetSelectAll(!0);a.ApplySolToContainer();return!0},PickOverlappingPoint(a,c,d){if(!a)return!1;const e=a.GetCurrentSol();var h=e.GetInstances();const g=this._runtime.GetCurrentEvent().IsOrBlock(),l=this._runtime.GetCurrentCondition().IsInverted();e.IsSelectAll()?(f.shallowAssignArray(b,h),e.ClearArrays(),e._SetSelectAll(!1)):g?(f.shallowAssignArray(b,e._GetOwnElseInstances()),f.clearArray(e._GetOwnElseInstances())):(f.shallowAssignArray(b,e._GetOwnInstances()), f.clearArray(e._GetOwnInstances()));for(let m=0,u=b.length;ml&&(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,w,q){const t=this._runtime.GetCanvasManager();t&&(this.UpdateRender(),await t.SnapshotCanvas(0===g?"image/png":"image/jpeg",l/100,m,u,w,q),await this._runtime.TriggerAsync(f.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(),w=g.IsFamily();g=g.GetFamilyIndex();for(let t=0,p=m.length;tm||m>=g.length)){w=l.GetShaderProgram().GetParameterType(m);if("color"===w){h.setFromRgbValue(u); m=g[m];if(h.equalsIgnoringAlpha(m))return;m.copyRgb(h)}else{"percent"===w&&(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(f.toRadians(+g))},SetLayoutEffectEnabled(g,l){const m=this._runtime.GetCurrentLayout();if(l=m.GetEffectList().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 w=g.GetIndex();u=u.GetEffectParametersForIndex(w);l=Math.floor(l);if(!(0>l||l>=u.length)){w=g.GetShaderProgram().GetParameterType(l);if("color"===w){h.setFromRgbValue(m);l=u[l];if(h.equalsIgnoringAlpha(l))return;l.copyRgb(h)}else{"percent"===w&&(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 f.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){f.Plugins.System.Acts.UnloadObjectTextures.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 w=u.strMap,q=l.toLowerCase();w.has(q)&&console.warn(`[Construct 3] Function map '${g}' string '${l}' already in map; overwriting entry`);if(u=f.first(w.values())||u.defaultFunc){u=0!==u.GetReturnType();const t=0!==m.GetReturnType();if(u!==t){console.error(`[Construct 3] Function map '${g}' string '${l}' function return type not compatible with other functions in the map; entry ignored`);return}}w.set(q,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=f.first(m.strMap.values())||m.defaultFunc;if(u){u=0!==u.GetReturnType();const w=0!==l.GetReturnType();if(u!==w){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 w=u.strMap.get(l.toLowerCase()); if(!w)if(u.defaultFunc)w=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(w.IsEnabled())if(0!==w.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 q=l.GetCurrentEvent();u=q.GetSolModifiersIncludingParents();var t=0e&&(a=e)}return a},clamp(b,a,c){return f.clamp(b,a,c)},distance(b,a,c,d){return f.distanceTo(b,a,c,d)},angle(b,a,c,d){return f.toDegrees(f.angleTo(b,a,c,d))},lerp(b, a,c){return f.lerp(b,a,c)},unlerp(b,a,c){return f.unlerp(b,a,c)},qarp(b,a,c,d){return f.qarp(b,a,c,d)},cubic(b,a,c,d,e){return f.cubic(b,a,c,d,e)},cosp(b,a,c){return f.cosp(b,a,c)},anglediff(b,a){return f.toDegrees(f.angleDiff(f.toRadians(b),f.toRadians(a)))},anglelerp(b,a,c){return f.toDegrees(f.angleLerp(f.toRadians(b),f.toRadians(a),c))},anglerotate(b,a,c){return f.toDegrees(f.angleRotate(f.toRadians(b),f.toRadians(a),f.toRadians(c)))},setbit(b,a,c){a|=0;return(b|0)&~(1<c?b.substr(a):b.substr(a,c)},right(b,a){return"string"===typeof b?b.substr(Math.max(b.length-a,0)):""},trim(b){return"string"===typeof b?b.trim():""},tokenat(b,a,c){if("string"!==typeof b||"string"!==typeof c)return""; b=b.split(c);a=Math.floor(a);return 0>a||a>=b.length?"":b[a]},tokencount(b,a){return"string"===typeof b&&"string"===typeof a&&b.length?b.split(a).length:0},find(b,a){return"string"===typeof b&&"string"===typeof a?b.search(new RegExp(f.EscapeRegex(a),"i")):-1},findcase(b,a){return"string"===typeof b&&"string"===typeof a?b.search(new RegExp(f.EscapeRegex(a),"")):-1},replace(b,a,c){return"string"===typeof b&&"string"===typeof a&&"string"===typeof c?b.replace(new RegExp(f.EscapeRegex(a),"gi"),c):"string"=== typeof b?b:""},regexsearch(b,a,c){a=this.GetRegex(a,c);return b?b.search(a):-1},regexreplace(b,a,c,d){a=this.GetRegex(a,c);return b?b.replace(a,d):""},regexmatchcount(b,a,c){return(b=this.GetRegexMatches(b.toString(),a,c))?b.length:0},regexmatchat(b,a,c,d){d=Math.floor(d);b=this.GetRegexMatches(b.toString(),a,c);return!b||0>d||d>=b.length?"":b[d]},zeropad(b,a){let c=0>b?"-":"";0>b&&(b=-b);c+="0".repeat(Math.max(a-b.toString().length,0));return c+b.toString()},urlencode(b){return encodeURIComponent(b)}, urldecode(b){return decodeURIComponent(b)},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 f.toDegrees(this._runtime.GetCurrentLayout().GetAngle())},layoutwidth(){return this._runtime.GetCurrentLayout().GetWidth()},layoutheight(){return this._runtime.GetCurrentLayout().GetHeight()},viewportleft(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport3D().getLeft(): 0},viewporttop(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport3D().getTop():0},viewportright(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport3D().getRight():0},viewportbottom(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport3D().getBottom():0},viewportwidth(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport3D().width():0},viewportheight(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport3D().height(): 0},canvastolayerx(b,a,c){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.CanvasCssToLayer(a,c)[0]:0},canvastolayery(b,a,c){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.CanvasCssToLayer(a,c)[1]:0},layertocanvasx(b,a,c){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.LayerToCanvasCss(a,c)[0]:0},layertocanvasy(b,a,c){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.LayerToCanvasCss(a,c)[1]:0},layerscale(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetOwnScale(): 0},layerangle(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?f.toDegrees(b.GetOwnAngle()):0},layeropacity(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?100*b.GetOpacity():0},layerscalerate(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetScaleRate():0},layerscrollx(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetScrollX():0},layerscrolly(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetScrollY():0},layerparallaxx(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))? 100*b.GetParallaxX():0},layerparallaxy(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?100*b.GetParallaxY():0},layerzelevation(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetZElevation():0},layerindex(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetIndex():-1},canvassnapshot(){const b=this._runtime.GetCanvasManager();return b?b.GetCanvasSnapshotUrl():""},loopindex(b){const a=this._loopStack;return a.IsInLoop()?b?(b=a.FindByName(b))?b.GetIndex():0:a.GetCurrent().GetIndex(): 0},savestatejson(){return this._runtime.GetLastSaveJsonString()},callmapped(b,a,...c){var d=this._GetFunctionMap(b.toLowerCase(),!1);if(!d)return console.warn(`[Construct 3] Call mapped function: map name '${b}' not found; returning 0`),0;var e=d.strMap.get(a.toLowerCase());if(!e)if(d.defaultFunc)e=d.defaultFunc;else return console.warn(`[Construct 3] Call mapped function: no function associated with map '${b}' string '${a}'; returning 0 (consider setting a default)`),0;d=e.GetReturnType();const h= e.GetDefaultReturnValue();if(0===d)return console.warn(`[Construct 3] Call mapped function: map '${b}' string '${a}' has no return type so cannot be called from an expression; returning 0`),0;if(!e.IsEnabled())return h;b=this._runtime.GetEventSheetManager();a=b.GetCurrentEvent().GetSolModifiersIncludingParents();const g=0":this._runtime.GetWebGLRenderer().GetUnmaskedRenderer()},imagememoryusage(){let b=this._runtime.GetRenderer().GetEstimatedTextureMemoryUsage(); return Math.round(100*b/1048576)/100},rgb(b,a,c){return f.PackRGB(b,a,c)},rgbex(b,a,c){return f.PackRGBEx(b/100,a/100,c/100)},rgba(b,a,c,d){return f.PackRGBAEx(b/100,a/100,c/100,d/100)},rgbex255(b,a,c){return f.PackRGBEx(b/255,a/255,c/255)},rgba255(b,a,c,d){return f.PackRGBAEx(b/255,a/255,c/255,d/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 f=self.C3;f.Plugins.Keyboard=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}} {"use strict";const f=self.C3;f.Plugins.Keyboard.Type=class extends f.SDKTypeBase{constructor(c){super(c)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.IKeyboardObjectType}};let b=null;function a(){return b.GetSingleGlobalInstance().GetSdkInstance()}self.IKeyboardObjectType=class extends self.IObjectClass{constructor(c){super(c);b=c;c.GetRuntime()._GetCommonScriptInterfaces().keyboard=this}isKeyDown(c){const d=a();if("string"===typeof c)return d.IsKeyDown(c);if("number"=== typeof c)return d.IsKeyCodeDown(c);throw new TypeError("expected string or number");}}} {"use strict";const f=self.C3;f.Plugins.Keyboard.Instance=class extends f.SDKInstanceBase{constructor(b,a){super(b);this._keysDownByString=new Set;this._keysDownByWhich=new Set;this._triggerWhich=0;this._triggerTypedKey=this._triggerString="";b=this.GetRuntime().Dispatcher();this._disposables=new f.CompositeDisposable(f.Disposable.From(b,"keydown",c=>this._OnKeyDown(c.data)),f.Disposable.From(b,"keyup",c=>this._OnKeyUp(c.data)),f.Disposable.From(b,"window-blur",()=>this._OnWindowOrKeyboardBlur()), f.Disposable.From(b,"keyboard-blur",()=>this._OnWindowOrKeyboardBlur()))}Release(){super.Release()}_OnKeyDown(b){const a=b.which,c=b.code||a.toString();b=b.key;this._keysDownByString.has(c)||(this._keysDownByString.add(c),this._keysDownByWhich.add(a),this._triggerString=c,this._triggerWhich=a,this._triggerTypedKey=b,this.Trigger(f.Plugins.Keyboard.Cnds.OnAnyKey),this.Trigger(f.Plugins.Keyboard.Cnds.OnKey),this.Trigger(f.Plugins.Keyboard.Cnds.OnLeftRightKeyPressed),this.Trigger(f.Plugins.Keyboard.Cnds.OnKeyCode))}_OnKeyUp(b){const a= b.which,c=b.code||a.toString();b=b.key;this._keysDownByString.delete(c);this._keysDownByWhich.delete(a);this._triggerString=c;this._triggerWhich=a;this._triggerTypedKey=b;this.Trigger(f.Plugins.Keyboard.Cnds.OnAnyKeyReleased);this.Trigger(f.Plugins.Keyboard.Cnds.OnKeyReleased);this.Trigger(f.Plugins.Keyboard.Cnds.OnLeftRightKeyReleased);this.Trigger(f.Plugins.Keyboard.Cnds.OnKeyCodeReleased)}_OnWindowOrKeyboardBlur(){for(const b of this._keysDownByWhich)this._keysDownByWhich.delete(b),this._triggerWhich= b,this.Trigger(f.Plugins.Keyboard.Cnds.OnAnyKeyReleased),this.Trigger(f.Plugins.Keyboard.Cnds.OnKeyReleased),this.Trigger(f.Plugins.Keyboard.Cnds.OnKeyCodeReleased);this._keysDownByString.clear()}IsKeyDown(b){return this._keysDownByString.has(b)}IsKeyCodeDown(b){return this._keysDownByWhich.has(b)}SaveToJson(){return{tk:this._triggerWhich,tkk:this._triggerTypedKey}}LoadFromJson(b){this._triggerWhich=b.tk;b.hasOwnProperty("tkk")&&(this._triggerTypedKey=b.tkk)}GetDebuggerProperties(){return[{title:"plugins.keyboard.name", properties:[{name:"plugins.keyboard.debugger.last-key-code",value:this._triggerWhich},{name:"plugins.keyboard.debugger.last-key-string",value:f.Plugins.Keyboard.Exps.StringFromKeyCode(this._triggerWhich)},{name:"plugins.keyboard.debugger.last-typed-key",value:this._triggerTypedKey}]}]}}} {"use strict";const f="ShiftLeft ShiftRight ControlLeft ControlRight AltLeft AltRight MetaLeft MetaRight".split(" ");self.C3.Plugins.Keyboard.Cnds={IsKeyDown(b){return this._keysDownByWhich.has(b)},OnKey(b){return this._triggerWhich===b},OnAnyKey(){return!0},OnAnyKeyReleased(){return!0},OnKeyReleased(b){return this._triggerWhich===b},IsKeyCodeDown(b){b=Math.floor(b);return this._keysDownByWhich.has(b)},OnKeyCode(b){return this._triggerWhich===b},OnKeyCodeReleased(b){return this._triggerWhich===b}, OnLeftRightKeyPressed(b){return this._triggerString===f[b]},OnLeftRightKeyReleased(b){return this._triggerString===f[b]},IsLeftRightKeyDown(b){return this._keysDownByString.has(f[b])}}}"use strict";self.C3.Plugins.Keyboard.Acts={}; {"use strict";function f(b){b=Math.floor(b);switch(b){case 8:return"backspace";case 9:return"tab";case 13:return"enter";case 16:return"shift";case 17:return"control";case 18:return"alt";case 19:return"pause";case 20:return"capslock";case 27:return"esc";case 33:return"pageup";case 34:return"pagedown";case 35:return"end";case 36:return"home";case 37:return"\u2190";case 38:return"\u2191";case 39:return"\u2192";case 40:return"\u2193";case 45:return"insert";case 46:return"del";case 91:return"left window key"; case 92:return"right window key";case 93:return"select";case 96:return"numpad 0";case 97:return"numpad 1";case 98:return"numpad 2";case 99:return"numpad 3";case 100:return"numpad 4";case 101:return"numpad 5";case 102:return"numpad 6";case 103:return"numpad 7";case 104:return"numpad 8";case 105:return"numpad 9";case 106:return"numpad *";case 107:return"numpad +";case 109:return"numpad -";case 110:return"numpad .";case 111:return"numpad /";case 112:return"F1";case 113:return"F2";case 114:return"F3"; case 115:return"F4";case 116:return"F5";case 117:return"F6";case 118:return"F7";case 119:return"F8";case 120:return"F9";case 121:return"F10";case 122:return"F11";case 123:return"F12";case 144:return"numlock";case 145:return"scroll lock";case 186:return";";case 187:return"=";case 188:return",";case 189:return"-";case 190:return".";case 191:return"/";case 192:return"'";case 219:return"[";case 220:return"\\";case 221:return"]";case 222:return"#";case 223:return"`";default:return String.fromCharCode(b)}} self.C3.Plugins.Keyboard.Exps={LastKeyCode(){return this._triggerWhich},StringFromKeyCode(b){return f(b)},TypedKey(){return this._triggerTypedKey}}}{"use strict";const f=self.C3;f.Plugins.Touch=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}} {"use strict";const f=self.C3,b=self.C3X;f.Plugins.Touch.Type=class extends f.SDKTypeBase{constructor(d){super(d)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.ITouchObjectType}};let a=null;function c(){return a.GetSingleGlobalInstance().GetSdkInstance()}self.ITouchObjectType=class extends self.IObjectClass{constructor(d){super(d);a=d;d.GetRuntime()._GetCommonScriptInterfaces().touch=this}requestPermission(d){b.RequireString(d);const e=c();if("orientation"===d)return e._RequestPermission(0); if("motion"===d)return e._RequestPermission(1);throw Error("invalid type");}}} {"use strict";const f=self.C3;f.Plugins.Touch.Instance=class extends f.SDKInstanceBase{constructor(b,a){super(b,"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=[];a&&(this._useMouseInput= a[0]);this.AddDOMMessageHandler("permission-result",c=>this._OnPermissionResult(c));b=this.GetRuntime().Dispatcher();this._disposables=new f.CompositeDisposable(f.Disposable.From(b,"pointerdown",c=>this._OnPointerDown(c.data)),f.Disposable.From(b,"pointermove",c=>this._OnPointerMove(c.data)),f.Disposable.From(b,"pointerup",c=>this._OnPointerUp(c.data,!1)),f.Disposable.From(b,"pointercancel",c=>this._OnPointerUp(c.data,!0)),f.Disposable.From(b,"deviceorientation",c=>this._OnDeviceOrientation(c.data)), f.Disposable.From(b,"deviceorientationabsolute",c=>this._OnDeviceOrientationAbsolute(c.data)),f.Disposable.From(b,"devicemotion",c=>this._OnDeviceMotion(c.data)),f.Disposable.From(b,"tick2",c=>this._OnTick2()))}Release(){this._touches.clear();super.Release()}_OnPointerDown(b){if("mouse"===b.pointerType)if(this._useMouseInput)this._isMouseDown=!0;else return;const a=b.pointerId;if(!this._touches.has(a)){var c=b.pageX-this._runtime.GetCanvasClientX();b=b.pageY-this._runtime.GetCanvasClientY();var d= performance.now(),e=this._touches.size;this._triggerIndex=e;this._triggerId=a;var h=f.New(f.Plugins.Touch.TouchInfo);h.Init(d,c,b,a,e);this._touches.set(a,h);this.Trigger(f.Plugins.Touch.Cnds.OnNthTouchStart);this.Trigger(f.Plugins.Touch.Cnds.OnTouchStart);this._curTouchX=c;this._curTouchY=b;this.Trigger(f.Plugins.Touch.Cnds.OnTouchObject)}}_OnPointerMove(b){if("mouse"!==b.pointerType||this._isMouseDown){var a=this._touches.get(b.pointerId);if(a){var c=performance.now();if(!(2>c-a.GetTime())){var d= b.pageX-this._runtime.GetCanvasClientX(),e=b.pageY-this._runtime.GetCanvasClientY();a.Update(c,d,e,b.width,b.height,b.pressure)}}}}_OnPointerUp(b,a){if("mouse"===b.pointerType)if(this._isMouseDown)this._isMouseDown=!1;else return;const c=performance.now();b=b.pointerId;const d=this._touches.get(b);d&&(this._triggerIndex=d.GetStartIndex(),this._triggerId=d.GetId(),this.Trigger(f.Plugins.Touch.Cnds.OnNthTouchEnd),this.Trigger(f.Plugins.Touch.Cnds.OnTouchEnd),a||(a=d.ShouldTriggerTap(c),"single-tap"=== a?(this.Trigger(f.Plugins.Touch.Cnds.OnTapGesture),this._curTouchX=d.GetX(),this._curTouchY=d.GetY(),this.Trigger(f.Plugins.Touch.Cnds.OnTapGestureObject)):"double-tap"===a&&(this.Trigger(f.Plugins.Touch.Cnds.OnDoubleTapGesture),this._curTouchX=d.GetX(),this._curTouchY=d.GetY(),this.Trigger(f.Plugins.Touch.Cnds.OnDoubleTapGestureObject))),d.Release(),this._touches.delete(b))}_RequestPermission(b){this._PostToDOMMaybeSync("request-permission",{type:b});return new Promise((a,c)=>{this._permissionPromises.push({type:b, resolve:a,reject:c})})}_OnPermissionResult(b){const a=b.result,c=b.type;this._triggerPermission=c;b=this._permissionPromises.filter(d=>d.type===c);for(const d of b)d.resolve(a?"granted":"denied");this._permissionPromises=this._permissionPromises.filter(d=>d.type!==c);a?(this.Trigger(f.Plugins.Touch.Cnds.OnPermissionGranted),0===c?this._runtime.RequestDeviceOrientationEvent():this._runtime.RequestDeviceMotionEvent()):this.Trigger(f.Plugins.Touch.Cnds.OnPermissionDenied)}_OnDeviceOrientation(b){"number"=== typeof b.webkitCompassHeading?this._orientCompassHeading=b.webkitCompassHeading:b.absolute&&(this._orientCompassHeading=b.alpha);this._orientAlpha=b.alpha;this._orientBeta=b.beta;this._orientGamma=b.gamma}_OnDeviceOrientationAbsolute(b){this._orientCompassHeading=b.alpha}_OnDeviceMotion(b){const a=b.acceleration;a&&(this._accX=a.x,this._accY=a.y,this._accZ=a.z);if(b=b.accelerationIncludingGravity)this._accWithGX=b.x,this._accWithGY=b.y,this._accWithGZ=b.z}_OnTick2(){const b=performance.now();let a= 0;for(const c of this._touches.values())c.GetTime()<=b-50&&c._SetLastTime(b),c.ShouldTriggerHold(b)&&(this._triggerIndex=c.GetStartIndex(),this._triggerId=c.GetId(),this._getTouchIndex=a,this.Trigger(f.Plugins.Touch.Cnds.OnHoldGesture),this._curTouchX=c.GetX(),this._curTouchY=c.GetY(),this.Trigger(f.Plugins.Touch.Cnds.OnHoldGestureObject),this._getTouchIndex=0),++a}_GetTouchByIndex(b){b=Math.floor(b);for(const a of this._touches.values()){if(0===b)return a;--b}return null}_IsClientPosOnCanvas(b,a){return 0<= b&&0<=a&&b({name:"$"+b.GetId(),value:b.GetX()+", "+b.GetY()}))}]}}} {"use strict";const f=self.C3,b=[];f.Plugins.Touch.Cnds={OnTouchStart(){return!0},OnTouchEnd(){return!0},IsInTouch(){return 0=a+1},OnHoldGesture(){return!0},OnTapGesture(){return!0},OnDoubleTapGesture(){return!0}, OnHoldGestureObject(a){return a&&this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY)?this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(a,this._curTouchX,this._curTouchY,!1):!1},OnTapGestureObject(a){return a&&this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY)?this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(a,this._curTouchX,this._curTouchY,!1):!1},OnDoubleTapGestureObject(a){return a&&this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY)?this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(a, this._curTouchX,this._curTouchY,!1):!1},OnPermissionGranted(a){return this._triggerPermission===a},OnPermissionDenied(a){return this._triggerPermission===a}}}"use strict";self.C3.Plugins.Touch.Acts={RequestPermission(f){this._RequestPermission(f)}}; {"use strict";const f=self.C3;f.Plugins.Touch.Exps={TouchCount(){return this._touches.size},X(b){const a=this._GetTouchByIndex(this._getTouchIndex);return a?a.GetPositionForLayer(this._runtime.GetCurrentLayout(),b,!0):0},Y(b){const a=this._GetTouchByIndex(this._getTouchIndex);return a?a.GetPositionForLayer(this._runtime.GetCurrentLayout(),b,!1):0},XAt(b,a){return(b=this._GetTouchByIndex(b))?b.GetPositionForLayer(this._runtime.GetCurrentLayout(),a,!0):0},YAt(b,a){return(b=this._GetTouchByIndex(b))? b.GetPositionForLayer(this._runtime.GetCurrentLayout(),a,!1):0},XForID(b,a){return(b=this._touches.get(b))?b.GetPositionForLayer(this._runtime.GetCurrentLayout(),a,!0):0},YForID(b,a){return(b=this._touches.get(b))?b.GetPositionForLayer(this._runtime.GetCurrentLayout(),a,!1):0},AbsoluteX(){const b=this._GetTouchByIndex(0);return b?b.GetX():0},AbsoluteY(){const b=this._GetTouchByIndex(0);return b?b.GetY():0},AbsoluteXAt(b){return(b=this._GetTouchByIndex(b))?b.GetX():0},AbsoluteYAt(b){return(b=this._GetTouchByIndex(b))? b.GetY():0},AbsoluteXForID(b){return(b=this._touches.get(b))?b.GetX():0},AbsoluteYForID(b){return(b=this._touches.get(b))?b.GetY():0},SpeedAt(b){return(b=this._GetTouchByIndex(b))?b.GetSpeed():0},SpeedForID(b){return(b=this._touches.get(b))?b.GetSpeed():0},AngleAt(b){return(b=this._GetTouchByIndex(b))?f.toDegrees(b.GetAngle()):0},AngleForID(b){return(b=this._touches.get(b))?f.toDegrees(b.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(b){return(b=this._touches.get(b))?b.GetWidth():0},HeightForID(b){return(b=this._touches.get(b))?b.GetHeight():0},PressureForID(b){return(b=this._touches.get(b))?b.GetPressure():0}}} {"use strict";const f=self.C3;let b=-1E3,a=-1E3,c=-1E4;f.Plugins.Touch.TouchInfo=class extends f.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(d,e,h,g,l){this._pointerId=g;this._startIndex=l;this._startTime=this._lastTime=this._time=d;this._startX=e;this._startY=h; this._x=e;this._y=h;this._lastX=e;this._lastY=h}Update(d,e,h,g,l,m){this._lastTime=this._time;this._time=d;this._lastX=this._x;this._lastY=this._y;this._x=e;this._y=h;this._width=g;this._height=l;this._pressure=m;!this._isTooFarForHold&&15<=f.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(d){this._lastTime=d}GetX(){return this._x}GetY(){return this._y}GetSpeed(){const d= f.distanceTo(this._x,this._y,this._lastX,this._lastY),e=(this._time-this._lastTime)/1E3;return 0f.distanceTo(this._startX,this._startY,this._x,this._y)?this._hasTriggeredHold=!0:!1}ShouldTriggerTap(d){if(this._hasTriggeredHold)return""; if(333>=d-this._startTime&&!this._isTooFarForHold&&15>f.distanceTo(this._startX,this._startY,this._x,this._y)){if(666>=d-c&&25>f.distanceTo(b,a,this._x,this._y))return a=b=-1E3,c=-1E4,"double-tap";b=this._x;a=this._y;c=d;return"single-tap"}return""}GetPositionForLayer(d,e,h){return"undefined"===typeof e?d.GetLayerByIndex(0).CanvasCssToLayer_DefaultTransform(this._x,this._y)[h?0:1]:(d=d.GetLayer(e))?d.CanvasCssToLayer(this._x,this._y)[h?0:1]:0}}}{"use strict";const f=self.C3;f.Plugins.Audio=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}} {"use strict";const f=self.C3;f.Plugins.Audio.Type=class extends f.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.IAudioObjectType}};function b(){if(self.C3Audio_DOMInterface)return self.C3Audio_DOMInterface;throw Error("audio scripting API cannot be used here - make sure the project is using DOM mode, not worker mode");}self.IAudioObjectType=class extends self.IObjectClass{constructor(a){super(a)}get audioContext(){return b().GetAudioContext()}get destinationNode(){return b().GetDestinationNode()}}} {"use strict";const f=self.C3,b=["interactive","balanced","playback"];f.Plugins.Audio.Instance=class extends f.SDKInstanceBase{constructor(a,c){super(a,"audio");this._nextPlayTime=0;this._triggerTag="";this._saveLoadMode=this._timeScaleMode=0;this._playInBackground=!1;this._distanceModel=this._panningModel=1;this._listenerX=this._runtime.GetViewportWidth()/2;this._listenerY=this._runtime.GetViewportHeight()/2;this._listenerZ=-600;this._referenceDistance=600;this._maxDistance=1E4;this._rolloffFactor= 1;this._listenerInst=null;this._loadListenerUid=-1;this._masterVolume=1;this._isSilent=!1;this._sampleRate=0;this._effectCount=new Map;this._preloadCount=this._preloadTotal=0;this._remoteUrls=new Map;a="interactive";c&&(this._timeScaleMode=c[0],this._saveLoadMode=c[1],this._playInBackground=c[2],a=b[c[3]],this._panningModel=c[4],this._distanceModel=c[5],this._listenerZ=-c[6],this._referenceDistance=c[7],this._maxDistance=c[8],this._rolloffFactor=c[9]);this._lastAIState=[];this._lastFxState=[];this._lastAnalysersData= [];this.AddDOMMessageHandlers([["state",d=>this._OnUpdateState(d)],["fxstate",d=>this._OnUpdateFxState(d)],["trigger",d=>this._OnTrigger(d)]]);c=this.GetRuntime().Dispatcher();this._disposables=new f.CompositeDisposable(f.Disposable.From(c,"instancedestroy",d=>this._OnInstanceDestroyed(d.instance)),f.Disposable.From(c,"afterload",()=>this._OnAfterLoad()),f.Disposable.From(c,"suspend",()=>this._OnSuspend()),f.Disposable.From(c,"resume",()=>this._OnResume()));this._runtime.AddLoadPromise(this.PostToDOMAsync("create-audio-context", {preloadList:this._runtime.GetAssetManager().GetAudioToPreload().map(d=>({originalUrl:d.originalUrl,url:d.url,type:d.type,fileSize:d.fileSize})),isiOSCordova:this._runtime.IsiOSCordova(),timeScaleMode:this._timeScaleMode,latencyHint:a,panningModel:this._panningModel,distanceModel:this._distanceModel,refDistance:this._referenceDistance,maxDistance:this._maxDistance,rolloffFactor:this._rolloffFactor,listenerPos:[this._listenerX,this._listenerY,this._listenerZ]}).then(d=>{this._sampleRate=d.sampleRate})); this._StartTicking()}Release(){this._listenerInst=null;super.Release()}_OnInstanceDestroyed(a){this._listenerInst===a&&(this._listenerInst=null)}DbToLinearNoCap(a){return Math.pow(10,a/20)}DbToLinear(a){a=this.DbToLinearNoCap(a);return isFinite(a)?Math.max(Math.min(a,1),0):0}LinearToDbNoCap(a){return Math.log(a)/Math.log(10)*20}LinearToDb(a){return this.LinearToDbNoCap(Math.max(Math.min(a,1),0))}_OnSuspend(){this._playInBackground||this.PostToDOM("set-suspended",{isSuspended:!0})}_OnResume(){this._playInBackground|| this.PostToDOM("set-suspended",{isSuspended:!1})}_OnUpdateState(a){const c=a.tickCount,d=this._lastAIState.filter(e=>e.hasOwnProperty("placeholder")&&(e.placeholder>c||-1===e.placeholder));this._lastAIState=a.audioInstances;this._lastAnalysersData=a.analysers;0 f.equalsNoCase(a,c.tag)&&c.isPlaying)}_MaybeMarkAsPlaying(a,c,d,e){if(this._IsTagPlaying(a))return null;a={tag:a,duration:0,volume:e,isPlaying:!0,playbackTime:0,playbackRate:1,uid:-1,bufferOriginalUrl:"",bufferUrl:"",bufferType:"",isMusic:c,isLooping:d,isMuted:!1,resumePosition:0,pan:null,placeholder:-1};this._lastAIState.push(a);return a}async _OnTrigger(a){const c=a.type;this._triggerTag=a.tag;a=a.aiid;if("ended"===c){for(const d of this._lastAIState)if(d.aiid===a){d.isPlaying=!1;break}await this.TriggerAsync(f.Plugins.Audio.Cnds.OnEnded)}else"fade-ended"=== c&&await this.TriggerAsync(f.Plugins.Audio.Cnds.OnFadeEnded)}Tick(){const a={timeScale:this._runtime.GetTimeScale(),gameTime:this._runtime.GetGameTimeRaw(),instPans:this.GetInstancePans(),tickCount:this._runtime.GetTickCountNoSave()};if(this._listenerInst){const c=this._listenerInst.GetWorldInfo();this._listenerX=c.GetX();this._listenerY=c.GetY();a.listenerPos=[this._listenerX,this._listenerY,this._listenerZ]}this.PostToDOM("tick",a)}rotatePtAround(a,c,d,e,h){if(0===d)return[a,c];const g=Math.sin(d); d=Math.cos(d);a-=e;c-=h;const l=a*g;a=a*d-c*g;return[a+e,c*d+l+h]}GetInstancePans(){return this._lastAIState.filter(a=>-1!==a.uid).map(a=>this._runtime.GetInstanceByUID(a.uid)).filter(a=>a).map(a=>{const c=a.GetWorldInfo(),d=c.GetLayer().GetAngle(),[e,h]=this.rotatePtAround(c.GetX(),c.GetY(),-d,this._listenerX,this._listenerY);return{uid:a.GetUID(),x:e,y:h,angle:c.GetAngle()-d}})}GetAnalyserData(a,c){for(const d of this._lastAnalysersData)if(d.index===c&&f.equalsNoCase(d.tag,a))return d;return null}_IncrementEffectCount(a){this._effectCount.set(a, (this._effectCount.get(a)||0)+1)}_ShouldSave(a){return a.hasOwnProperty("placeholder")||3===this._saveLoadMode?!1:a.isMusic&&1===this._saveLoadMode?!1:a.isMusic||2!==this._saveLoadMode?!0:!1}SaveToJson(){return{isSilent:this._isSilent,masterVolume:this._masterVolume,listenerZ:this._listenerZ,listenerUid:this._listenerInst?this._listenerInst.GetUID():-1,remoteUrls:[...this._remoteUrls.entries()],playing:this._lastAIState.filter(a=>this._ShouldSave(a)),effects:this._lastFxState,analysers:this._lastAnalysersData}}LoadFromJson(a){this._isSilent= a.isSilent;this._masterVolume=a.masterVolume;this._listenerZ=a.listenerZ;this._listenerInst=null;this._loadListenerUid=a.listenerUid;this._remoteUrls.clear();if(a.remoteUrls)for(const [c,d]of a.remoteUrls)this._remoteUrls.set(c,d);this._lastAIState=a.playing;this._lastFxState=a.effects;this._lastAnalysersData=a.analysers}_OnAfterLoad(){if(-1!==this._loadListenerUid&&(this._listenerInst=this._runtime.GetInstanceByUID(this._loadListenerUid),this._loadListenerUid=-1,this._listenerInst)){var a=this._listenerInst.GetWorldInfo(); this._listenerX=a.GetX();this._listenerY=a.GetY()}for(var c of this._lastAIState)(a=this._runtime.GetAssetManager().GetProjectAudioFileUrl(c.bufferOriginalUrl))?(c.bufferUrl=a.url,c.bufferType=a.type):c.bufferUrl=null;for(const d of Object.values(this._lastFxState))for(const e of d)e.hasOwnProperty("bufferOriginalUrl")&&(c=this._runtime.GetAssetManager().GetProjectAudioFileUrl(e.bufferOriginalUrl))&&(e.bufferUrl=c.url,e.bufferType=c.type);this.PostToDOM("load-state",{saveLoadMode:this._saveLoadMode, timeScale:this._runtime.GetTimeScale(),gameTime:this._runtime.GetGameTimeRaw(),listenerPos:[this._listenerX,this._listenerY,this._listenerZ],isSilent:this._isSilent,masterVolume:this._masterVolume,playing:this._lastAIState.filter(d=>null!==d.bufferUrl),effects:this._lastFxState})}GetDebuggerProperties(){const a=[];for(const [c,d]of Object.entries(this._lastFxState))a.push({name:"$"+c,value:d.map(e=>e.type).join(", ")});return[{title:"plugins.audio.debugger.tag-effects",properties:a},{title:"plugins.audio.debugger.currently-playing", properties:[{name:"plugins.audio.debugger.currently-playing-count",value:this._lastAIState.length},...this._lastAIState.map((c,d)=>({name:"$#"+d,value:`${c.bufferOriginalUrl} ("${c.tag}") ${Math.round(10*c.playbackTime)/10} / ${Math.round(10*c.duration)/10}`}))]}]}}} {"use strict";const f=self.C3;f.Plugins.Audio.Cnds={OnEnded(b){return f.equalsNoCase(this._triggerTag,b)},OnFadeEnded(b){return f.equalsNoCase(this._triggerTag,b)},PreloadsComplete(){return this._preloadCount===this._preloadTotal},AdvancedAudioSupported(){return!0},IsSilent(){return this._isSilent},IsAnyPlaying(){for(const b of this._lastAIState)if(b.isPlaying)return!0;return!1},IsTagPlaying(b){return this._IsTagPlaying(b)}}} {"use strict";const f=self.C3,b="lowpass highpass bandpass lowshelf highshelf peaking notch allpass".split(" ");f.Plugins.Audio.Acts={async Play(a,c,d,e,h){if(!this._isSilent){var g=a[1],l=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);if(l){h=h?h:0;var m=this._nextPlayTime;this._nextPlayTime=0;var u=this._MaybeMarkAsPlaying(e.toLowerCase(),g,0!==c,this.DbToLinear(d));try{await this.PostToDOMAsync("play",{originalUrl:a[0],url:l.url,type:l.type,isMusic:g,tag:e.toLowerCase(),isLooping:0!== c,vol:this.DbToLinear(d),pos:h,off:m,trueClock:!!self.C3_GetAudioContextCurrentTime})}finally{u&&(u.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtPosition(a,c,d,e,h,g,l,m,u,w){if(!this._isSilent){var q=a[1],t=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);if(t){var p=this._nextPlayTime;this._nextPlayTime=0;var r=this._MaybeMarkAsPlaying(w.toLowerCase(),q,0!==c,this.DbToLinear(d));try{await this.PostToDOMAsync("play",{originalUrl:a[0],url:t.url,type:t.type,isMusic:q, tag:w.toLowerCase(),isLooping:0!==c,vol:this.DbToLinear(d),pos:0,off:p,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:e,y:h,angle:f.toRadians(g),innerAngle:f.toRadians(l),outerAngle:f.toRadians(m),outerGain:this.DbToLinear(u)}})}finally{r&&(r.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtObject(a,c,d,e,h,g,l,m){if(!this._isSilent&&e&&(e=e.GetFirstPicked())&&e.GetWorldInfo()){var u=e.GetWorldInfo(),w=u.GetLayer().GetAngle(),[q,t]=this.rotatePtAround(u.GetX(),u.GetY(),-w, this._listenerX,this._listenerY),p=a[1],r=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);if(r){var x=this._nextPlayTime;this._nextPlayTime=0;var y=this._MaybeMarkAsPlaying(m.toLowerCase(),p,0!==c,this.DbToLinear(d));try{await this.PostToDOMAsync("play",{originalUrl:a[0],url:r.url,type:r.type,isMusic:p,tag:m.toLowerCase(),isLooping:0!==c,vol:this.DbToLinear(d),pos:0,off:x,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:q,y:t,angle:u.GetAngle()-w,innerAngle:f.toRadians(h),outerAngle:f.toRadians(g), outerGain:this.DbToLinear(l),uid:e.GetUID()}})}finally{y&&(y.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayByName(a,c,d,e,h){if(!this._isSilent){a=1===a;var g=this._runtime.GetAssetManager().GetProjectAudioFileUrl(c)||this._remoteUrls.get(c.toLowerCase());if(g){var l=this._nextPlayTime;this._nextPlayTime=0;var m=this._MaybeMarkAsPlaying(h.toLowerCase(),a,0!==d,this.DbToLinear(e));try{await this.PostToDOMAsync("play",{originalUrl:c,url:g.url,type:g.type,isMusic:a,tag:h.toLowerCase(), isLooping:0!==d,vol:this.DbToLinear(e),pos:0,off:l,trueClock:!!self.C3_GetAudioContextCurrentTime})}finally{m&&(m.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtPositionByName(a,c,d,e,h,g,l,m,u,w,q){if(!this._isSilent){a=1===a;var t=this._runtime.GetAssetManager().GetProjectAudioFileUrl(c)||this._remoteUrls.get(c.toLowerCase());if(t){var p=this._nextPlayTime;this._nextPlayTime=0;var r=this._MaybeMarkAsPlaying(q.toLowerCase(),a,0!==d,this.DbToLinear(e));try{await this.PostToDOMAsync("play", {originalUrl:c,url:t.url,type:t.type,isMusic:a,tag:q.toLowerCase(),isLooping:0!==d,vol:this.DbToLinear(e),pos:0,off:p,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:h,y:g,angle:f.toRadians(l),innerAngle:f.toRadians(m),outerAngle:f.toRadians(u),outerGain:this.DbToLinear(w)}})}finally{r&&(r.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtObjectByName(a,c,d,e,h,g,l,m,u){if(!this._isSilent&&!this._isSilent&&h&&(h=h.GetFirstPicked())&&h.GetWorldInfo()){var w=h.GetWorldInfo(), q=w.GetLayer().GetAngle(),[t,p]=this.rotatePtAround(w.GetX(),w.GetY(),-q,this._listenerX,this._listenerY);a=1===a;var r=this._runtime.GetAssetManager().GetProjectAudioFileUrl(c)||this._remoteUrls.get(c.toLowerCase());if(r){var x=this._nextPlayTime;this._nextPlayTime=0;var y=this._MaybeMarkAsPlaying(u.toLowerCase(),a,0!==d,this.DbToLinear(e));try{await this.PostToDOMAsync("play",{originalUrl:c,url:r.url,type:r.type,isMusic:a,tag:u.toLowerCase(),isLooping:0!==d,vol:this.DbToLinear(e),pos:0,off:x,trueClock:!!self.C3_GetAudioContextCurrentTime, panning:{x:t,y:p,angle:w.GetAngle()-q,innerAngle:f.toRadians(g),outerAngle:f.toRadians(l),outerGain:this.DbToLinear(m),uid:h.GetUID()}})}finally{y&&(y.placeholder=this._runtime.GetTickCountNoSave())}}}},SetLooping(a,c){this.PostToDOM("set-looping",{tag:a.toLowerCase(),isLooping:0===c})},SetMuted(a,c){this.PostToDOM("set-muted",{tag:a.toLowerCase(),isMuted:0===c})},SetVolume(a,c){this.PostToDOM("set-volume",{tag:a.toLowerCase(),vol:this.DbToLinear(c)})},FadeVolume(a,c,d,e){this.PostToDOM("fade-volume", {tag:a.toLowerCase(),vol:this.DbToLinear(c),duration:d,stopOnEnd:0===e})},async Preload(a){const c=a[1],d=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);d&&(this._preloadTotal++,await this.PostToDOMAsync("preload",{originalUrl:a[0],url:d.url,type:d.type,isMusic:c}),this._preloadCount++)},async PreloadByName(a,c){a=1===a;const d=this._runtime.GetAssetManager().GetProjectAudioFileUrl(c)||this._remoteUrls.get(c.toLowerCase());d&&(this._preloadTotal++,await this.PostToDOMAsync("preload", {originalUrl:c,url:d.url,type:d.type,isMusic:a}),this._preloadCount++)},SetPlaybackRate(a,c){this.PostToDOM("set-playback-rate",{tag:a.toLowerCase(),rate:Math.max(c,0)})},Stop(a){this.PostToDOM("stop",{tag:a.toLowerCase()})},StopAll(){this.PostToDOM("stop-all")},SetPaused(a,c){this.PostToDOM("set-paused",{tag:a.toLowerCase(),paused:0===c})},Seek(a,c){this.PostToDOM("seek",{tag:a.toLowerCase(),pos:c})},SetSilent(a){2===a&&(a=this._isSilent?1:0);a=0===a;this._isSilent!==a&&(this._isSilent=a,this.PostToDOM("set-silent", {isSilent:a}))},SetMasterVolume(a){a=this.DbToLinear(a);this._masterVolume!==a&&(this._masterVolume=a,this.PostToDOM("set-master-volume",{vol:a}))},AddFilterEffect(a,c,d,e,h,g,l){a=a.toLowerCase();c=b[c];this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"filter",tag:a,params:[c,d,e,h,g,f.clamp(l/100,0,1)]})},AddDelayEffect(a,c,d,e){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"delay",tag:a,params:[c,this.DbToLinear(d),f.clamp(e/100,0,1)]})},AddFlangerEffect(a, c,d,e,h,g){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"flanger",tag:a,params:[c/1E3,d/1E3,e,h/100,f.clamp(g/100,0,1)]})},AddPhaserEffect(a,c,d,e,h,g,l){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"phaser",tag:a,params:[c,d,e,h,g,f.clamp(l/100,0,1)]})},AddConvolutionEffect(a,c,d,e){a=a.toLowerCase();const h=this._runtime.GetAssetManager().GetProjectAudioFileUrl(c[0]);h&&(this._IncrementEffectCount(a),this.PostToDOM("add-effect", {type:"convolution",tag:a,bufferOriginalUrl:c[0],bufferUrl:h.url,bufferType:h.type,params:[0===d,f.clamp(e/100,0,1)]}))},AddGainEffect(a,c){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"gain",tag:a,params:[this.DbToLinear(c)]})},AddMuteEffect(a){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"gain",tag:a,params:[0]})},AddTremoloEffect(a,c,d){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"tremolo", tag:a,params:[c,f.clamp(d/100,0,1)]})},AddRingModEffect(a,c,d){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"ringmod",tag:a,params:[c,f.clamp(d/100,0,1)]})},AddDistortionEffect(a,c,d,e,h,g){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"distortion",tag:a,params:[this.DbToLinearNoCap(c),this.DbToLinearNoCap(d),e,this.DbToLinearNoCap(h),f.clamp(g/100,0,1)]})},AddCompressorEffect(a,c,d,e,h,g){a=a.toLowerCase();this._IncrementEffectCount(a); this.PostToDOM("add-effect",{type:"compressor",tag:a,params:[c,d,e,h/1E3,g/1E3]})},AddAnalyserEffect(a,c,d){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"analyser",tag:a,params:[c,d]})},RemoveEffects(a){a=a.toLowerCase();this._effectCount.set(a,0);this.PostToDOM("remove-effects",{tag:a});this._lastFxState={}},SetEffectParameter(a,c,d,e,h,g){this.PostToDOM("set-effect-param",{tag:a.toLowerCase(),index:Math.floor(c),param:d,value:e,ramp:h,time:g})},SetListenerObject(a){a&& (a=a.GetFirstPicked())&&a.GetWorldInfo()&&(this._listenerInst=a)},SetListenerZ(a){this._listenerZ=a},ScheduleNextPlay(a){this._nextPlayTime=Math.max(a,0)},UnloadAudio(a){const c=a[1];(a=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]))&&this.PostToDOM("unload",{url:a.url,type:a.type,isMusic:c})},UnloadAudioByName(a,c){a=1===a;(c=this._runtime.GetAssetManager().GetProjectAudioFileUrl(c)||this._remoteUrls.get(c.toLowerCase()))&&this.PostToDOM("unload",{url:c.url,type:c.type,isMusic:a})}, UnloadAll(){this.PostToDOM("unload-all")},AddRemoteURL(a,c,d){this._remoteUrls.set(d.toLowerCase(),{url:a,type:c})}}}"use strict"; self.C3.Plugins.Audio.Exps={Duration(f){return(f=this._GetFirstAudioStateByTag(f))?f.duration:0},PlaybackTime(f){return(f=this._GetFirstAudioStateByTag(f))?f.playbackTime:0},PlaybackRate(f){return(f=this._GetFirstAudioStateByTag(f))?f.playbackRate:0},Volume(f){return(f=this._GetFirstAudioStateByTag(f))?this.LinearToDb(f.volume):0},MasterVolume(){return this.LinearToDb(this._masterVolume)},EffectCount(f){return this._effectCount.get(f.toLowerCase())||0},AnalyserFreqBinCount(f,b){return(f=this.GetAnalyserData(f, Math.floor(b)))?f.binCount:0},AnalyserFreqBinAt(f,b,a){f=this.GetAnalyserData(f,Math.floor(b));if(!f)return 0;a=Math.floor(a);return 0>a||a>=f.binCount?0:f.freqBins[a]},AnalyserPeakLevel(f,b){return(f=this.GetAnalyserData(f,Math.floor(b)))?f.peak:0},AnalyserRMSLevel(f,b){return(f=this.GetAnalyserData(f,Math.floor(b)))?f.rms:0},SampleRate(){return this._sampleRate},CurrentTime(){return self.C3_GetAudioContextCurrentTime?self.C3_GetAudioContextCurrentTime():performance.now()/1E3}}; {"use strict";const f=self.C3;f.Plugins.Dictionary=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const f=self.C3;f.Plugins.Dictionary.Type=class extends f.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}} {"use strict";const f=self.C3,b=self.IInstance;f.Plugins.Dictionary.Instance=class extends f.SDKInstanceBase{constructor(c,d){super(c);this._data=new Map;this._curKey=""}Release(){this._data.clear();super.Release()}GetAsJsonString(){return JSON.stringify({c2dictionary:!0,data:f.MapToObject(this._data)})}GetDataMap(){return this._data}SaveToJson(){return f.MapToObject(this._data)}LoadFromJson(c){f.ObjectToMap(c,this._data)}GetDebuggerProperties(){return[{title:"plugins.dictionary.name",properties:[{name:"plugins.dictionary.debugger.key-count", value:this._data.size},...[...this._data].map(c=>({name:"$"+c[0],value:c[1],onedit:d=>this._data.set(c[0],d)}))]}]}GetScriptInterfaceClass(){return self.IDictionaryInstance}};const a=new WeakMap;self.IDictionaryInstance=class extends b{constructor(){super();a.set(this,b._GetInitInst().GetSdkInstance())}getDataMap(){return a.get(this).GetDataMap()}}} {"use strict";const f=self.C3;f.Plugins.Dictionary.Cnds={CompareValue(b,a,c){b=this._data.get(b);return"undefined"===typeof b?!1:f.compare(b,a,c)},ForEachKey(){const b=this._runtime,a=b.GetEventSheetManager(),c=b.GetCurrentEvent(),d=c.GetSolModifiers(),e=b.GetEventStack(),h=e.GetCurrentStackFrame(),g=e.Push(c);b.SetDebuggingEnabled(!1);for(const l of this._data.keys())this._curKey=l,a.PushCopySol(d),c.Retrigger(h,g),a.PopSol(d);b.SetDebuggingEnabled(!0);this._curKey="";e.Pop();return!1},CompareCurrentValue(b, a){const c=this._data.get(this._curKey);return"undefined"===typeof c?!1:f.compare(c,b,a)},HasKey(b){return this._data.has(b)},IsEmpty(){return 0===this._data.size}}} {"use strict";const f=self.C3;f.Plugins.Dictionary.Acts={AddKey(b,a){this._data.set(b,a)},SetKey(b,a){this._data.has(b)&&this._data.set(b,a)},DeleteKey(b){this._data.delete(b)},Clear(){this._data.clear()},JSONLoad(b){let a=null;try{a=JSON.parse(b)}catch(c){console.error("[Construct 3] Error parsing JSON: ",c);return}a.c2dictionary&&f.ObjectToMap(a.data,this._data)},JSONDownload(b){const a=URL.createObjectURL(new Blob([this.GetAsJsonString()],{type:"application/json"}));this._runtime.InvokeDownload(a, b)}}}"use strict";self.C3.Plugins.Dictionary.Exps={Get(f){f=this._data.get(f);return"undefined"===typeof f?0:f},GetDefault(f,b){f=this._data.get(f);return"undefined"===typeof f?b:f},KeyCount(){return this._data.size},CurrentKey(){return this._curKey},CurrentValue(){return this._data.get(this._curKey)||0},AsJSON(){return this.GetAsJsonString()}};{"use strict";const f=self.C3;f.Plugins.LocalStorage=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}} {"use strict";const f=self.C3;f.Plugins.LocalStorage.Type=class extends f.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}} {"use strict";const f=self.C3;f.Plugins.LocalStorage.Instance=class extends f.SDKInstanceBase{constructor(b,a){super(b);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(b){this._errorMessage=this._GetErrorString(b);await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnError)}_GetErrorString(b){return b? "string"===typeof b?b:"string"===typeof b.message?b.message:"string"===typeof b.name?b.name:"string"===typeof b.data?b.data:"unknown error":"unknown error"}GetDebuggerProperties(){this._isLoadingDebugCache||this._DebugCacheStorage();return[{title:"plugins.localstorage.name",properties:[...this._debugCache.entries()].map(b=>({name:"$"+b[0],value:b[1],onedit:a=>this._storage.setItem(b[0],a)}))}]}async _DebugCacheStorage(){this._isLoadingDebugCache=!0;try{const b=await this._storage.keys();b.sort((c, d)=>{c=c.toLowerCase();d=d.toLowerCase();return cthis._storage.getItem(c)));this._debugCache.clear();for(let c=0,d=b.length;c{this._currentKey=a;this._lastValue=d;await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAnyItemSet);await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnItemSet)})}catch(d){await this._TriggerStorageError(d)}finally{this._pendingSets--,0===this._pendingSets&& await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAllSetsComplete)}},async SetBinaryItem(a,c){if(c&&(c=c.GetFirstPicked(this._inst))&&(c=c.GetSdkInstance())){c=c.GetArrayBufferReadOnly();this._pendingSets++;try{await this._storage.setItem(a,c),await this.ScheduleTriggers(async()=>{this._currentKey=a;this._lastValue="";await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAnyItemSet);await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnItemSet)})}catch(d){await this._TriggerStorageError(d)}finally{this._pendingSets--, 0===this._pendingSets&&await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAllSetsComplete)}}},async GetItem(a){this._pendingGets++;try{const c=await this._storage.getItem(a);await this.ScheduleTriggers(async()=>{this._currentKey=a;this._lastValue=b(c)?c:"";await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAnyItemGet);await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnItemGet)})}catch(c){await this._TriggerStorageError(c)}finally{this._pendingGets--,0===this._pendingGets&&await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAllGetsComplete)}}, async GetBinaryItem(a,c){if(c&&(c=c.GetFirstPicked(this._inst))){var d=c.GetSdkInstance();this._pendingGets++;try{let e=await this._storage.getItem(a);e=e instanceof ArrayBuffer?e:new ArrayBuffer(0);await this.ScheduleTriggers(async()=>{this._lastValue="";this._currentKey=a;d.SetArrayBufferTransfer(e);await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAnyItemGet);await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnItemGet)})}catch(e){await this._TriggerStorageError(e)}finally{this._pendingGets--, 0===this._pendingGets&&await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAllGetsComplete)}}},async CheckItemExists(a){try{const c=await this._storage.getItem(a);await this.ScheduleTriggers(async()=>{this._currentKey=a;"undefined"===typeof c||null===c?(this._lastValue="",await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnItemMissing)):(this._lastValue=b(c)?c:"",await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnItemExists))})}catch(c){await this._TriggerStorageError(c)}},async RemoveItem(a){try{await this._storage.removeItem(a), await this.ScheduleTriggers(async()=>{this._currentKey=a;this._lastValue="";await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAnyItemRemoved);await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnItemRemoved)})}catch(c){await this._TriggerStorageError(c)}},async ClearStorage(){try{await this._storage.clear(),await this.ScheduleTriggers(async()=>{this._lastValue=this._currentKey="";f.clearArray(this._keyNamesList);await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnCleared)})}catch(a){await this._TriggerStorageError(a)}}, async GetAllKeyNames(){try{const a=await this._storage.keys();await this.ScheduleTriggers(async()=>{this._keyNamesList=a;await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAllKeyNamesLoaded)})}catch(a){await this._TriggerStorageError(a)}}}}"use strict";self.C3.Plugins.LocalStorage.Exps={ItemValue(){return this._lastValue},Key(){return this._currentKey},KeyCount(){return this._keyNamesList.length},KeyAt(f){f=Math.floor(f);return 0>f||f>=this._keyNamesList.length?"":this._keyNamesList[f]},ErrorMessage(){return this._errorMessage}}; {"use strict";const f=self.C3;f.Plugins.Browser=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const f=self.C3;f.Plugins.Browser.Type=class extends f.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}} {"use strict";const f=self.C3;f.Plugins.Browser.Instance=class extends f.SDKInstanceBase{constructor(b,a){super(b,"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",c=>this._OnOnlineStateChanged(c)],["backbutton",()=>this._OnBackButton()],["sw-message",c=>this._OnSWMessage(c)],["hashchange", c=>this._OnHashChange(c)]]);b=this.GetRuntime().Dispatcher();this._disposables=new f.CompositeDisposable(f.Disposable.From(b,"afterfirstlayoutstart",()=>this._OnAfterFirstLayoutStart()),f.Disposable.From(b,"window-resize",()=>this._OnWindowResize()),f.Disposable.From(b,"suspend",()=>this._OnSuspend()),f.Disposable.From(b,"resume",()=>this._OnResume()));this._runtime.AddLoadPromise(this.PostToDOMAsync("get-initial-state",{exportType:this._runtime.GetExportType()}).then(c=>{this._initLocationStr=c.location; this._isOnline=c.isOnline;this._referrer=c.referrer;this._docTitle=c.title;this._isCookieEnabled=c.isCookieEnabled;this._screenWidth=c.screenWidth;this._screenHeight=c.screenHeight;this._windowOuterWidth=c.windowOuterWidth;this._windowOuterHeight=c.windowOuterHeight;this._isScirraArcade=c.isScirraArcade}))}Release(){super.Release()}_OnAfterFirstLayoutStart(){this.PostToDOM("ready-for-sw-messages")}async _OnOnlineStateChanged(b){b=!!b.isOnline;this._isOnline!==b&&((this._isOnline=b)?await this.TriggerAsync(f.Plugins.Browser.Cnds.OnOnline): await this.TriggerAsync(f.Plugins.Browser.Cnds.OnOffline))}async _OnWindowResize(){await this.TriggerAsync(f.Plugins.Browser.Cnds.OnResize)}_OnSuspend(){this.Trigger(f.Plugins.Browser.Cnds.OnPageHidden)}_OnResume(){this.Trigger(f.Plugins.Browser.Cnds.OnPageVisible)}async _OnBackButton(){await this.TriggerAsync(f.Plugins.Browser.Cnds.OnBackButton)}_OnSWMessage(b){b=b.type;"downloading-update"===b?this.Trigger(f.Plugins.Browser.Cnds.OnUpdateFound):"update-ready"===b||"update-pending"===b?this.Trigger(f.Plugins.Browser.Cnds.OnUpdateReady): "offline-ready"===b&&this.Trigger(f.Plugins.Browser.Cnds.OnOfflineReady)}_OnHashChange(b){this._initLocationStr=b.location;this.Trigger(f.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(f){const b=this._runtime.GetCanvasManager().GetLastWidth(),a=this._runtime.GetCanvasManager().GetLastHeight();return(b<=a?0:1)===f},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 f=self.C3,b="portrait landscape portrait-primary portrait-secondary landscape-primary landscape-secondary".split(" ");f.Plugins.Browser.Acts={Alert(a){this.PostToDOM("alert",{message:a.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(a,c){this._PostToDOMMaybeSync("navigate",{type:"url",url:a,target:c,exportType:this._runtime.GetExportType()})},GoToURLWindow(a,c){this._PostToDOMMaybeSync("navigate",{type:"new-window",url:a,tag:c,exportType:this._runtime.GetExportType()})},RequestFullScreen(a, c){2<=a&&(a+=1);6===a&&(a=2);1===a&&(a=0);a=f.CanvasManager._FullscreenModeNumberToString(a);this._runtime.GetCanvasManager().SetDocumentFullscreenMode(a);this._PostToDOMMaybeSync("request-fullscreen",{navUI:c})},CancelFullScreen(){this._PostToDOMMaybeSync("exit-fullscreen")},Vibrate(a){a=a.split(",");for(let c=0,d=a.length;ca||a>=b.length||this._PostToDOMMaybeSync("lock-orientation",{orientation:b[a]})},UnlockOrientation(){this._PostToDOMMaybeSync("unlock-orientation")}, LoadStyleSheet(a){this._runtime.GetAssetManager().LoadStyleSheet(a)},SetHash(a){this.PostToDOM("set-hash",{hash:a})}}}"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(f){const b=this._runtime.IsInWorker()?(new URL(this._initLocationStr)).search:location.search;return(f=RegExp("[?&]"+f+"=([^&]*)").exec(b))?decodeURIComponent(f[1].replace(/\+/g," ")):""},Referrer(){return this._referrer},Title(){return this._docTitle},Language(){return navigator.language}, Platform(){return navigator.platform},UserAgent(){return navigator.userAgent},ExecJS(f){let b=0;try{b=eval(f)}catch(a){console.error("Error executing JavaScript: ",a)}return"number"===typeof b||"string"===typeof b?b:"boolean"===typeof b?b?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 f=navigator.connection;return f?f.downlink|| f.downlinkMax||f.bandwidth||Infinity:Infinity},ConnectionType(){const f=navigator.connection;return f?f.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 f=self.C3;f.Plugins.gamepad=class extends f.SDKPluginBase{constructor(b){super(b);this._isSupported=!1;this._runtime.AddLoadPromise(this._runtime.PostComponentMessageToDOMAsync("gamepad","is-supported").then(a=>this._isSupported=!!a))}Release(){super.Release()}IsSupported(){return this._isSupported}}}{"use strict";const f=self.C3;f.Plugins.gamepad.Type=class extends f.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}} {"use strict";const f=self.C3;class b{constructor(c,d){this._index=c;this._id=d;this._state=new a;this._oldState=new a;this._buttonsPressed=[];this._buttonsReleased=[]}GetID(){return this._id}Update(c,d){const e=this._oldState;this._oldState=this._state;this._state=e;this._state.Update(c,d);f.resizeArray(this._buttonsPressed,this._state.GetButtonCount(),!1);f.resizeArray(this._buttonsReleased,this._state.GetButtonCount(),!1);for(let h=0,g=this._state.GetButtonCount();hc&&(this._buttonsPressed[h]=!0),.5>d&&.5<=c&&(this._buttonsReleased[h]=!0)}GetButtonCount(){return this._state.GetButtonCount()}GetAxisCount(){return this._state.GetAxisCount()}HasButtonBecomePressed(c){c=Math.floor(c);return 0>c||c>=this._buttonsPressed.length?!1:this._buttonsPressed[c]}HasButtonBecomeReleased(c){c=Math.floor(c);return 0>c||c>=this._buttonsReleased.length?!1:this._buttonsReleased[c]}ResetButtonPressAndReleaseFlags(){this._buttonsPressed.fill(!1); this._buttonsReleased.fill(!1)}GetButtonAt(c){return this._state.GetButtonAt(c)}IsButtonDown(c){return.5<=this._state.GetButtonAt(c)}GetAxisAt(c){return this._state.GetAxisAt(c)}}class a{constructor(){this._buttons=[];this._axes=[]}Update(c,d){const e=this._buttons;let h=0;for(let g=c.length;hc||c>=this._buttons.length?0:this._buttons[c]}GetAxisAt(c){c=Math.floor(c);return 0>c||c>=this._axes.length?0:this._axes[c]}}f.Plugins.gamepad.Instance=class extends f.SDKInstanceBase{constructor(c,d){super(c,"gamepad");this._deadZone=25;this._lastButton=0;this._lastIndex=-1;this._gamepads=new Map;d&&(this._deadZone=d[0]);this.AddDOMMessageHandler("gamepad-connected",e=>this._OnGamepadConnected(e));this.AddDOMMessageHandler("gamepad-disconnected",e=>this._OnGamepadDisconnected(e)); this.AddDOMMessageHandler("input-update",e=>this._OnInputUpdate(e));c=this.GetRuntime().Dispatcher();this._disposables=new f.CompositeDisposable(f.Disposable.From(c,"tick2",()=>this._OnTick2()));this.PostToDOM("ready")}Release(){super.Release()}_OnGamepadConnected(c){const d=c.index;this._lastIndex=d;c=c.id;this._gamepads.has(d)||(this._gamepads.set(d,new b(d,c)),this.Trigger(f.Plugins.gamepad.Cnds.OnGamepadConnected),this._lastIndex=-1)}_OnGamepadDisconnected(c){this._lastIndex=c=c.index;this.Trigger(f.Plugins.gamepad.Cnds.OnGamepadDisconnected); this._gamepads.delete(c);this._lastIndex=-1}_OnInputUpdate(c){for(const d of c)this._OnGamepadInputUpdate(d)}_OnGamepadInputUpdate(c){var d=c.index;this._gamepads.has(d)||this._OnGamepadConnected(c);d=this._gamepads.get(d);d.Update(c.buttons,c.axes);for(let e=0,h=d.GetButtonCount();ethis._OnPointerLockChange(c)],["pointer-lock-error",c=>this._OnPointerLockError(c)]]);b=this.GetRuntime().Dispatcher();this._disposables=new f.CompositeDisposable(f.Disposable.From(b, "pointermove",c=>this._OnPointerMove(c.data)),f.Disposable.From(b,"pointerdown",c=>this._OnPointerDown(c.data)),f.Disposable.From(b,"pointerup",c=>this._OnPointerUp(c.data)),f.Disposable.From(b,"dblclick",c=>this._OnDoubleClick(c.data)),f.Disposable.From(b,"wheel",c=>this._OnMouseWheel(c.data)),f.Disposable.From(b,"window-blur",()=>this._OnWindowBlur()))}Release(){super.Release()}_OnPointerDown(b){"mouse"===b.pointerType&&(this._mouseXcanvas=b.pageX-this._runtime.GetCanvasClientX(),this._mouseYcanvas= b.pageY-this._runtime.GetCanvasClientY(),this._CheckButtonChanges(b.lastButtons,b.buttons))}_OnPointerMove(b){this._movementX=b.movementX;this._movementY=b.movementY;this.Trigger(f.Plugins.Mouse.Cnds.OnMovement);this._movementY=this._movementX=0;"mouse"===b.pointerType&&(this._mouseXcanvas=b.pageX-this._runtime.GetCanvasClientX(),this._mouseYcanvas=b.pageY-this._runtime.GetCanvasClientY(),this._CheckButtonChanges(b.lastButtons,b.buttons))}_OnPointerUp(b){"mouse"===b.pointerType&&this._CheckButtonChanges(b.lastButtons, b.buttons)}_CheckButtonChanges(b,a){this._CheckButtonChange(b,a,1,0);this._CheckButtonChange(b,a,4,1);this._CheckButtonChange(b,a,2,2)}_CheckButtonChange(b,a,c,d){!(b&c)&&a&c?this._OnMouseDown(d):b&c&&!(a&c)&&this._OnMouseUp(d)}_OnMouseDown(b){this._buttonMap[b]=!0;this.Trigger(f.Plugins.Mouse.Cnds.OnAnyClick);this._triggerButton=b;this._triggerType=0;this.Trigger(f.Plugins.Mouse.Cnds.OnClick);this.Trigger(f.Plugins.Mouse.Cnds.OnObjectClicked)}_OnMouseUp(b){this._buttonMap[b]&&(this._buttonMap[b]= !1,this._triggerButton=b,this.Trigger(f.Plugins.Mouse.Cnds.OnRelease))}_OnDoubleClick(b){this._triggerButton=b.button;this._triggerType=1;this.Trigger(f.Plugins.Mouse.Cnds.OnClick);this.Trigger(f.Plugins.Mouse.Cnds.OnObjectClicked)}_OnMouseWheel(b){this._triggerDir=0>b.deltaY?1:0;this.Trigger(f.Plugins.Mouse.Cnds.OnWheel)}_OnWindowBlur(){for(let b=0,a=this._buttonMap.length;b({name:"$"+b.GetName(),value:b.CanvasCssToLayer(this._mouseXcanvas,this._mouseYcanvas).join(", ")}))}]}}} {"use strict";const f=self.C3;f.Plugins.Mouse.Cnds={OnClick(b,a){return this._triggerButton===b&&this._triggerType===a},OnAnyClick(){return!0},IsButtonDown(b){return this._buttonMap[b]},OnRelease(b){return this._triggerButton===b},IsOverObject(b){if(!this._IsMouseOverCanvas())return!1;const a=this._runtime.GetCurrentCondition().IsInverted(),c=this._mouseXcanvas,d=this._mouseYcanvas;return f.xor(this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(b,c,d,a),a)},OnObjectClicked(b,a,c){if(b!== this._triggerButton||a!==this._triggerType||!this._IsMouseOverCanvas())return!1;b=this._mouseXcanvas;a=this._mouseYcanvas;return this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(c,b,a,!1)},OnWheel(b){return this._triggerDir===b},OnPointerLocked(){return!0},OnPointerUnlocked(){return!0},OnPointerLockError(){return!0},HasPointerLock(){return this._hasPointerLock},OnMovement(){return!0}}} {"use strict";const f=self.C3;let b=null;const a="auto pointer text crosshair move help wait none".split(" ");f.Plugins.Mouse.Acts={SetCursor(c){c=a[c];b!==c&&(b=c,this.PostToDOM("cursor",c))},SetCursorSprite(c){if(!f.Platform.IsMobile&&c&&(c=c.GetFirstPicked())){var d=c.GetWorldInfo(),e=c.GetCurrentImageInfo();d&&e&&b!==e&&(b=e,e.ExtractImageToCanvas().then(h=>f.CanvasToBlob(h)).then(h=>{h=`url(${URL.createObjectURL(h)}) ${Math.round(d.GetOriginX()*e.GetWidth())} ${Math.round(d.GetOriginY()*e.GetHeight())}, auto`; this.PostToDOM("cursor","");this.PostToDOM("cursor",h)}))}},RequestPointerLock(){this._PostToDOMMaybeSync("request-pointer-lock")},ReleasePointerLock(){this.PostToDOM("release-pointer-lock")}}}"use strict";self.C3.Plugins.Mouse.Exps={X(f){return this.GetMousePositionForLayer(f)[0]},Y(f){return this.GetMousePositionForLayer(f)[1]},AbsoluteX(){return this._mouseXcanvas},AbsoluteY(){return this._mouseYcanvas},MovementX(){return this._movementX},MovementY(){return this._movementY}}; {"use strict";const f=self.C3;f.Plugins.Function=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const f=self.C3;f.Plugins.Function.Type=class extends f.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}} {"use strict";const f=self.C3;class b{constructor(){this.name="";this.retVal=0;this.params=[]}}f.Plugins.Function.Instance=class extends f.SDKInstanceBase{constructor(a,c){super(a);this._isPreview=this._runtime.IsPreview();this._funcStackPtr=-1;this._funcStack=[];a=(d,e)=>this._InvokeFromJS(d,e);self.c2_callFunction=a;self.c3_callFunction=a}Release(){super.Release()}Push(){const a=this._funcStack,c=++this._funcStackPtr;c===a.length&&a.push(new b);return a[c]}Pop(){--this._funcStackPtr}GetCurrent(){const a= this._funcStackPtr;return 0>a?null:this._funcStack[a]}GetOneAbove(){const a=this._funcStack;return a.length?a[Math.min(this._funcStackPtr+1,a.length-1)]:null}_CallFunction(a,c){const d=this.Push();d.name=a.toLowerCase();d.retVal=0;f.shallowAssignArray(d.params,c);c=this.FastTrigger(f.Plugins.Function.Cnds.OnFunction,d.name);this._isPreview&&!c&&console.warn(`[Construct 3] Function object: called function '${a}' but no event was triggered. Is the function call spelt incorrectly or no longer used?`); this.Pop()}*_DebugCallFunction(a,c){const d=this.Push();d.name=a.toLowerCase();d.retVal=0;f.shallowAssignArray(d.params,c);c=yield*this.DebugFastTrigger(f.Plugins.Function.Cnds.OnFunction,d.name);this._isPreview&&!c&&console.warn(`[Construct 3] Function object: called function '${a}' but no event was triggered. Is the function call spelt incorrectly or no longer used?`);this.Pop()}_InvokeFromJS(a,c){const d=this.Push();d.name=a.toLowerCase();d.retVal=0;d.params=(c||[]).map(e=>"number"===typeof e|| "string"===typeof e?e:"boolean"===typeof e?e?1:0:0);this.FastTrigger(f.Plugins.Function.Cnds.OnFunction,d.name);this.Pop();return d.retVal}}} {"use strict";const f=self.C3;f.Plugins.Function.Cnds={OnFunction(b){return!0},CompareParam(b,a,c){const d=this.GetCurrent();if(!d)return this._isPreview&&console.warn("[Construct 3] Function object: used 'Compare parameter' condition when not in a function call"),!1;const e=d.params;b=Math.floor(b);let h=0;0>b||b>=e.length?this._isPreview&&console.warn(`[Construct 3] Function object: in function '${d.name}', compared parameter out of bounds (accessed index ${b} of ${e.length})`):h=e[b];return f.compare(h, a,c)}}}"use strict";self.C3.Plugins.Function.Acts={CallFunction(f,b){if(this._runtime.IsDebugging())return this._DebugCallFunction(f,b);this._CallFunction(f,b)},SetReturnValue(f){const b=this.GetCurrent();b?b.retVal=f:this._isPreview&&console.warn("[Construct 3] Function object: used 'Set return value' when not in a function call")},CallExpression(f){}}; {"use strict";const f=self.C3;f.Plugins.Function.Exps={ReturnValue(){const b=this.GetOneAbove();return b?b.retVal:0},ParamCount(){const b=this.GetCurrent();if(b)return b.params.length;this._isPreview&&console.warn("[Construct 3] Function object: used 'ParamCount' expression when not in a function call");return 0},Param(b){b=Math.floor(b);const a=this.GetCurrent();if(a){const c=a.params;if(0<=b&&bc.LoadAllTextures(b,a)))}ReleaseTextures(){for(const b of this._animations)b.ReleaseAllTextures()}OnDynamicTextureLoadComplete(){this._UpdateAllCurrentTexture()}_UpdateAllCurrentTexture(){for(const b of this._objectClass.instancesIncludingPendingCreate())b.GetSdkInstance()._UpdateCurrentTexture()}FinishCondition(b){f.Plugins.Sprite.FinishCollisionCondition(this, b)}}} {"use strict";const f=self.C3,b=self.C3X,a=f.New(f.Rect),c=f.New(f.Quad),d=f.New(f.Vector2);f.Plugins.Sprite.Instance=class extends f.SDKWorldInstanceBase{constructor(g,l){super(g);let m=!0,u="",w=0,q=!0;l&&(m=!!l[0],u=l[1],w=l[2],q=l[3]);this._currentAnimation=this._objectClass.GetAnimationByName(u)||this._objectClass.GetAnimations()[0];this._currentFrameIndex=f.clamp(w,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=f.New(f.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(q);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(a,c,!1);let u=c;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=t&&(x?(this.SetPlayingForwards(!1),this._currentFrameIndex=t-2):r?this._currentFrameIndex=q:(this._animationRepeats++,this._animationRepeats>=p?this._FinishAnimation(!1):this._currentFrameIndex=q));0>this._currentFrameIndex&&(x?(this._currentFrameIndex=1,this.SetPlayingForwards(!0), r||(this._animationRepeats++,this._animationRepeats>=p&&this._FinishAnimation(!0))):r?this._currentFrameIndex=q:(this._animationRepeats++,this._animationRepeats>=p?this._FinishAnimation(!0):this._currentFrameIndex=q));this._currentFrameIndex=f.clamp(this._currentFrameIndex,0,t-1);u=w.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.DispatchScriptEvent("animationend",!1,{animationName:this._animTriggerName});this.Trigger(f.Plugins.Sprite.Cnds.OnAnyAnimFinished);this.Trigger(f.Plugins.Sprite.Cnds.OnAnimFinished);this.SetInAnimationTrigger(!1);this._animationRepeats=0}_OnFrameChanged(g,l){if(g!==l){var m=this.GetWorldInfo(),u=g.GetImageInfo(),w=l.GetImageInfo(),q=u.GetWidth();u=u.GetHeight();var t=w.GetWidth(), p=w.GetHeight();q!==t&&m.SetWidth(m.GetWidth()*(t/q));u!==p&&m.SetHeight(m.GetHeight()*(p/u));m.SetOriginX(l.GetOriginX());m.SetOriginY(l.GetOriginY());m.SetSourceCollisionPoly(l.GetCollisionPoly());m.SetBboxChanged();this._currentAnimationFrame=l;this._currentTexture=w.GetTexture();this._currentRcTex=w.GetTexRect();this._currentQuadTex=w.GetTexQuad();m=this.GetInstance().GetBehaviorInstances();for(let r=0,x=m.length;rg||g>=u)return[0,0];m=m.pointsArr();return[m[2*g]+l.GetX(),m[2*g+1]+l.GetY()]}GetDebuggerProperties(){const g=f.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=f.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=f.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 f.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=f.clamp(l,0,g);l=this._currentAnimation.GetFrameAt(this._currentFrameIndex);const u=this._currentAnimation.GetFrameAt(m); this._OnFrameChanged(l,u);this._currentFrameIndex=f.clamp(m,0,g)}}GetScriptInterfaceClass(){return self.ISpriteInstance}};const e=new WeakMap,h=new Map([["current-frame",0],["beginning",1]]);self.ISpriteInstance=class extends self.IWorldInstance{constructor(){super();e.set(this,self.IInstance._GetInitInst().GetSdkInstance())}getImagePointCount(){return e.get(this).GetImagePointCount()}getImagePointX(g){if("string"!==typeof g&&"number"!==typeof g)throw new TypeError("expected string or number");return e.get(this).GetImagePoint(g)[0]}getImagePointY(g){if("string"!== typeof g&&"number"!==typeof g)throw new TypeError("expected string or number");return e.get(this).GetImagePoint(g)[1]}getImagePoint(g){if("string"!==typeof g&&"number"!==typeof g)throw new TypeError("expected string or number");return e.get(this).GetImagePoint(g)}getPolyPointCount(){return e.get(this).GetCollisionPolyPointCount()}getPolyPointX(g){b.RequireFiniteNumber(g);return e.get(this).GetCollisionPolyPoint(g)[0]}getPolyPointY(g){b.RequireFiniteNumber(g);return e.get(this).GetCollisionPolyPoint(g)[1]}getPolyPoint(g){b.RequireFiniteNumber(g); return e.get(this).GetCollisionPolyPoint(g)}stopAnimation(){e.get(this).SetAnimationPlaying(!1)}startAnimation(g="current-frame"){b.RequireString(g);g=h.get(g);if("undefined"===typeof g)throw Error("invalid mode");e.get(this)._StartAnim(g)}setAnimation(g,l="beginning"){b.RequireString(g);b.RequireString(l);l=h.get(l);if("undefined"===typeof l)throw Error("invalid mode");e.get(this)._SetAnim(g,l)}get animationName(){return e.get(this)._GetCurrentAnimationName()}set animationFrame(g){b.RequireFiniteNumber(g); e.get(this)._SetAnimFrame(g)}get animationFrame(){return e.get(this)._GetAnimFrame()}set animationSpeed(g){b.RequireFiniteNumber(g);e.get(this)._SetAnimSpeed(g)}get animationSpeed(){return e.get(this)._GetAnimSpeed()}set animationRepeatToFrame(g){b.RequireFiniteNumber(g);e.get(this)._SetAnimRepeatToFrame(g)}get animationRepeatToFrame(){return e.get(this)._GetAnimRepeatToFrame()}get imageWidth(){return e.get(this).GetCurrentImageInfo().GetWidth()}get imageHeight(){return e.get(this).GetCurrentImageInfo().GetHeight()}}} {"use strict";const f=self.C3;f.Plugins.Sprite.Cnds={IsAnimPlaying(b){return f.equalsNoCase(this._GetCurrentAnimationName(),b)},CompareFrame(b,a){return f.compare(this._currentFrameIndex,b,a)},CompareAnimSpeed(b,a){return f.compare(this._GetAnimSpeed(),b,a)},OnAnimFinished(b){return f.equalsNoCase(this._animTriggerName,b)},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 f=self.C3;f.Plugins.Sprite.Acts={Spawn(b,a,c,d){if(b&&a){var [e,h]=this.GetImagePoint(c);if(c=this._runtime.CreateInstance(b,a,e,h,d)){d&&a.SortAndAddInstancesByZIndex(c);b.GetPlugin().IsRotatable()&&(a=c.GetWorldInfo(),a.SetAngle(this.GetWorldInfo().GetAngle()),a.SetBboxChanged());a=this._runtime.GetEventSheetManager();a.BlockFlushingInstances(!0);c._TriggerOnCreatedOnSelfAndRelated();a.BlockFlushingInstances(!1);d=this._runtime.GetCurrentAction().GetSavedDataMap();a=!1;if(!d.has("Spawn_LastExec")|| d.get("Spawn_LastExec")c.GetWidth()?-1:1;const e=0>c.GetHeight()?-1:1;d*=a.GetWidth()* b;b=a.GetHeight()*b*e;if(c.GetWidth()!==d||c.GetHeight()!==b)c.SetSize(d,b),c.SetBboxChanged()},async LoadURL(b,a,c){c=this._currentAnimationFrame.GetImageInfo();const d=this.GetWorldInfo(),e=this._runtime;if(c.GetURL()===b)0===a&&(d.SetSize(c.GetWidth(),c.GetHeight()),d.SetBboxChanged()),this.Trigger(f.Plugins.Sprite.Cnds.OnURLLoaded);else{var h=f.New(f.ImageInfo);try{await h.LoadDynamicAsset(e,b);if(!h.IsLoaded())throw Error("image failed to load");await h.LoadStaticTexture(e.GetRenderer(),{sampling:this._runtime.GetSampling()})}catch(g){console.error("Load image from URL failed: ", g);this.Trigger(f.Plugins.Sprite.Cnds.OnURLFailed);return}c.ReplaceWith(h);this._sdkType._UpdateAllCurrentTexture();this.WasReleased()||0!==a||(d.SetSize(c.GetWidth(),c.GetHeight()),d.SetBboxChanged());e.UpdateRender();this.WasReleased()||await this.TriggerAsync(f.Plugins.Sprite.Cnds.OnURLLoaded)}},SetCollisions(b){this.GetWorldInfo().SetCollisionEnabled(b)},SetSolidCollisionFilter(b,a){this.GetWorldInfo().SetSolidCollisionFilter(0===b,a)},SetEffect(b){this.GetWorldInfo().SetBlendMode(b);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(f){return this.GetImagePoint(f)[0]},ImagePointY(f){return this.GetImagePoint(f)[1]},ImagePointCount(){return this.GetImagePointCount()},ImageWidth(){return this.GetCurrentImageInfo().GetWidth()}, ImageHeight(){return this.GetCurrentImageInfo().GetHeight()},PolyPointXAt(f){return this.GetCollisionPolyPoint(f)[0]},PolyPointYAt(f){return this.GetCollisionPolyPoint(f)[1]},PolyPointCount(){return this.GetCollisionPolyPointCount()}};{"use strict";const f=self.C3;f.Plugins.TiledBg=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}} {"use strict";const f=self.C3;function b(a){switch(a){case 0:return"clamp-to-edge";case 2:return"mirror-repeat"}return"repeat"}f.Plugins.TiledBg.Type=class extends f.SDKTypeBase{constructor(a,c){super(a);this._wrapY=this._wrapX="repeat";c&&(this._wrapX=b(c[0]),this._wrapY=b(c[1]))}Release(){super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}LoadTextures(a){return this.GetImageInfo().LoadStaticTexture(a,{sampling:this._runtime.GetSampling(),wrapX:this._wrapX,wrapY:this._wrapY})}ReleaseTextures(){this.GetImageInfo().ReleaseTexture()}}} {"use strict";const f=self.C3,b=self.C3X,a=f.New(f.Rect),c=f.New(f.Quad),d=f.New(f.Rect),e=f.New(f.Quad);f.Plugins.TiledBg.Instance=class extends f.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=f.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 w=u.GetWidth();u=u.GetHeight();const q=this._imageOffsetX/w,t=this._imageOffsetY/u,p=this._imageAngle;d.set(0,0,g/(w*this._imageScaleX),l/(u*this._imageScaleY));d.offset(-q,-t);0===p?m.setFromRect(d):m.setFromRotatedRect(d,-p)}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,w=this._imageOffsetY/l,q=this.GetWorldInfo();d.set(0,0,q.GetWidth()/(m*this._imageScaleX),q.GetHeight()/(l*this._imageScaleY));d.offset(-u,-w);q.HasMesh()?this._DrawMesh(q,g):this._DrawStandard(q,g)}}_DrawStandard(g,l){let m=g.GetBoundingQuad();this._runtime.IsPixelRoundingEnabled()&&(m=g.PixelRoundQuad(m));0===this._imageAngle?l.Quad3(m,d):(e.setFromRotatedRect(d,-this._imageAngle),l.Quad4(m,e))}_DrawMesh(g,l){const m=g.GetTransformedMesh(); if(g.IsMeshChanged()){g.CalculateBbox(a,c,!1);let u=c;this._runtime.IsPixelRoundingEnabled()&&(u=g.PixelRoundQuad(u));let w=d;0!==this._imageAngle&&(e.setFromRotatedRect(d,-this._imageAngle),w=e);m.CalculateTransformedMesh(g.GetSourceMesh(),u,w);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){b.RequireFiniteNumber(g);h.get(this)._SetImageOffsetX(g)}get imageOffsetX(){return h.get(this)._GetImageOffsetX()}set imageOffsetY(g){b.RequireFiniteNumber(g); h.get(this)._SetImageOffsetY(g)}get imageOffsetY(){return h.get(this)._GetImageOffsetY()}set imageScaleX(g){b.RequireFiniteNumber(g);h.get(this)._SetImageScaleX(g)}get imageScaleX(){return h.get(this)._GetImageScaleX()}set imageScaleY(g){b.RequireFiniteNumber(g);h.get(this)._SetImageScaleY(g)}get imageScaleY(){return h.get(this)._GetImageScaleY()}set imageAngle(g){b.RequireFiniteNumber(g);h.get(this)._SetImageAngle(g)}get imageAngle(){return h.get(this)._GetImageAngle()}set imageAngleDegrees(g){b.RequireFiniteNumber(g); h.get(this)._SetImageAngle(f.toRadians(g))}get imageAngleDegrees(){return f.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 f=self.C3;f.Plugins.TiledBg.Acts={SetImageOffsetX(b){this._SetImageOffsetX(b)},SetImageOffsetY(b){this._SetImageOffsetY(b)},SetImageScaleX(b){this._SetImageScaleX(b/100)},SetImageScaleY(b){this._SetImageScaleY(b/100)},SetImageAngle(b){this._SetImageAngle(f.toRadians(b))},SetEffect(b){this.GetWorldInfo().SetBlendMode(b);this._runtime.UpdateRender()},async LoadURL(b,a){if(!this._ownImageInfo||this._ownImageInfo.GetURL()!==b){a=this._runtime;var c=f.New(f.ImageInfo);try{await c.LoadDynamicAsset(a, b);if(!c.IsLoaded())throw Error("image failed to load");if(this.WasReleased())return c.Release(),null;if(!await c.LoadStaticTexture(a.GetRenderer(),{sampling:this._runtime.GetSampling(),wrapX:"repeat",wrapY:"repeat"}))return}catch(d){console.error("Load image from URL failed: ",d);this.Trigger(f.Plugins.TiledBg.Cnds.OnURLFailed);return}this.WasReleased()?c.Release():(this._ReleaseOwnImage(),this._ownImageInfo=c,a.UpdateRender(),await this.TriggerAsync(f.Plugins.TiledBg.Cnds.OnURLLoaded))}}}} {"use strict";const f=self.C3;f.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 f.toDegrees(this._imageAngle)}}}{"use strict";const f=self.C3;f.Plugins.Text=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}} {"use strict";const f=self.C3;f.Plugins.Text.Type=class extends f.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}LoadTextures(b){}ReleaseTextures(){}}} {"use strict";const f=self.C3,b=self.C3X,a=[0,0,0],c=["left","center","right"],d=["top","center","bottom"],e=new f.Rect,h=new f.Quad,g=new f.Color;f.Plugins.Text.Instance=class extends f.SDKWorldInstanceBase{constructor(q,t){super(q);this._text="";this._enableBBcode=!0;this._faceName="Arial";this._ptSize=12;this._lineHeightOffset=0;this._isItalic=this._isBold=!1;this._color=f.New(f.Color);this._verticalAlign=this._horizontalAlign=0;this._wrapByWord=!0;this._typewriterEndTime=this._typewriterStartTime= -1;this._typewriterLength=0;this._rendererText=f.New(f.Gfx.RendererText,this._runtime.GetRenderer(),{timeout:5});this._rendererText.ontextureupdate=()=>this._runtime.UpdateRender();this._rendererText.SetIsAsync(!1);t&&(this._text=t[0],this._enableBBcode=!!t[1],this._faceName=t[2],this._ptSize=t[3],this._lineHeightOffset=t[4],this._isBold=!!t[5],this._isItalic=!!t[6],this._horizontalAlign=t[8],this._verticalAlign=t[9],this._wrapByWord=0===t[10],q=t[7],this._color.setRgb(q[0],q[1],q[2]),this.GetWorldInfo().SetVisible(t[11])); this._UpdateTextSettings()}Release(){this._CancelTypewriter();this._rendererText.Release();this._rendererText=null;super.Release()}_UpdateTextSettings(){const q=this._rendererText;q.SetText(this._text);q.SetBBCodeEnabled(this._enableBBcode);q.SetFontName(this._faceName);q.SetLineHeight(this._lineHeightOffset);q.SetBold(this._isBold);q.SetItalic(this._isItalic);q.SetColor(this._color);q.SetHorizontalAlignment(c[this._horizontalAlign]);q.SetVerticalAlignment(d[this._verticalAlign]);q.SetWordWrapMode(this._wrapByWord? "word":"character")}_UpdateTextSize(){const q=this.GetWorldInfo();this._rendererText.SetFontSize(this._ptSize);this._rendererText.SetFontSizeScale(q.GetSceneGraphScale());var t=q.GetLayer();t=t.GetRenderScale()*t.Get2DScaleFactorToZ(q.GetTotalZElevation());this._rendererText.SetSize(q.GetWidth(),q.GetHeight(),t)}Draw(q){var t=this.GetWorldInfo();this._UpdateTextSize();const p=this._rendererText.GetTexture();if(p){var r=t.GetLayer();if(0===t.GetAngle()&&0===r.GetAngle()&&0===t.GetTotalZElevation()&& !t.HasMesh()&&r.RendersIn2DMode()){t=t.GetBoundingQuad();const [x,y]=r.LayerToDrawSurface(t.getTlx(),t.getTly()),[E,H]=r.LayerToDrawSurface(t.getBrx(),t.getBry());t=x-Math.round(x);const A=y-Math.round(y);e.set(x,y,E,H);e.offset(-t,-A);h.setFromRect(e);const [F,J]=q.GetRenderTargetSize(q.GetRenderTarget());this._runtime.GetCanvasManager().SetDeviceTransform(q,F,J);q.SetTexture(p);q.Quad3(h,this._rendererText.GetTexRect());r._SetTransform(q)}else q.SetTexture(p),t.HasMesh()?this._DrawMesh(t,q):this._DrawStandard(t, q)}}_DrawStandard(q,t){q=q.GetBoundingQuad();this._runtime.IsPixelRoundingEnabled()&&(q=this._PixelRoundQuad(q));t.Quad3(q,this._rendererText.GetTexRect())}_DrawMesh(q,t){const p=q.GetTransformedMesh();if(q.IsMeshChanged()){q.CalculateBbox(e,h,!1);let r=h;this._runtime.IsPixelRoundingEnabled()&&(r=this._PixelRoundQuad(r));p.CalculateTransformedMesh(q.GetSourceMesh(),r,this._rendererText.GetTexRect());q.SetMeshChanged(!1)}p.Draw(t)}_PixelRoundQuad(q){const t=q.getTlx()-Math.round(q.getTlx()),p=q.getTly()- Math.round(q.getTly());if(0===t&&0===p)return q;h.copy(q);h.offset(-t,-p);return h}SaveToJson(){const q={t:this._text,c:this._color.toJSON(),fn:this._faceName,ps:this._ptSize};this._enableBBcode&&(q.bbc=this._enableBBcode);0!==this._horizontalAlign&&(q.ha=this._horizontalAlign);0!==this._verticalAlign&&(q.va=this._verticalAlign);this._wrapByWord||(q.wr=this._wrapByWord);0!==this._lineHeightOffset&&(q.lho=this._lineHeightOffset);this._isBold&&(q.b=this._isBold);this._isItalic&&(q.i=this._isItalic); -1!==this._typewriterEndTime&&(q.tw={st:this._typewriterStartTime,en:this._typewriterEndTime,l:this._typewriterLength});return q}LoadFromJson(q){this._CancelTypewriter();this._text=q.t;this._color.setFromJSON(q.c);this._faceName=q.fn;this._ptSize=q.ps;this._enableBBcode=q.hasOwnProperty("bbc")?q.bbc:!1;this._horizontalAlign=q.hasOwnProperty("ha")?q.ha:0;this._verticalAlign=q.hasOwnProperty("va")?q.va:0;this._wrapByWord=q.hasOwnProperty("wr")?q.wr:!0;this._lineHeightOffset=q.hasOwnProperty("lho")? q.lho:0;this._isBold=q.hasOwnProperty("b")?q.b:!1;this._isItalic=q.hasOwnProperty("i")?q.i:!1;q.hasOwnProperty("tw")&&(q=q.tw,this._typewriterStartTime=q.st,this._typewriterEndTime=q.en,this._typewriterLength=q.l);this._UpdateTextSettings();-1!==this._typewriterEndTime&&this._StartTicking()}GetPropertyValueByIndex(q){switch(q){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 a[0]=this._color.getR(),a[1]=this._color.getG(),a[2]=this._color.getB(),a;case 8:return this._horizontalAlign;case 9:return this._verticalAlign;case 10:return this._wrapByWord?1:0}}SetPropertyValueByIndex(q,t){switch(q){case 0:if(this._text===t)break;this._text=t;this._UpdateTextSettings();break;case 1:if(this._enableBBcode===!!t)break;this._enableBBcode=!!t;this._UpdateTextSettings();break;case 2:if(this._faceName===t)break;this._faceName=t;this._UpdateTextSettings(); break;case 3:if(this._ptSize===t)break;this._ptSize=t;this._UpdateTextSettings();break;case 4:if(this._lineHeightOffset===t)break;this._lineHeightOffset=t;this._UpdateTextSettings();break;case 5:if(this._isBold===!!t)break;this._isBold=!!t;this._UpdateTextSettings();break;case 6:if(this._isItalic===!!t)break;this._isItalic=!!t;this._UpdateTextSettings();break;case 7:q=this._color;if(q.getR()===t[0]&&q.getG()===t[1]&&q.getB()===t[2])break;this._color.setRgb(t[0],t[1],t[2]);this._UpdateTextSettings(); break;case 8:if(this._horizontalAlign===t)break;this._horizontalAlign=t;this._UpdateTextSettings();break;case 9:if(this._verticalAlign===t)break;this._verticalAlign=t;this._UpdateTextSettings();break;case 10:this._wrapByWord!==(0===t)&&(this._wrapByWord=0===t,this._UpdateTextSettings())}}SetPropertyColorOffsetValueByIndex(q,t,p,r){if(0!==t||0!==p||0!==r)switch(q){case 7:this._color.addRgb(t,p,r),this._UpdateTextSettings()}}_SetText(q){this._text!==q&&(this._text=q,this._rendererText.SetText(q),this._runtime.UpdateRender())}GetText(){return this._text}_StartTypewriter(q, t){this._SetText(q);this._typewriterStartTime=this._runtime.GetWallTime();this._typewriterEndTime=this._typewriterStartTime+t/this.GetInstance().GetActiveTimeScale();this._typewriterLength=f.BBString.StripAnyTags(q).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(f.Plugins.Text.Cnds.OnTypewriterTextFinished),this._runtime.UpdateRender())}_SetFontFace(q){this._faceName!==q&&(this._faceName=q,this._rendererText.SetFontName(q),this._runtime.UpdateRender())}_GetFontFace(){return this._faceName}_SetBold(q){q=!!q;this._isBold!==q&&(this._isBold=q,this._rendererText.SetBold(q),this._runtime.UpdateRender())}_IsBold(){return this._isBold}_SetItalic(q){q=!!q;this._isItalic!==q&&(this._isItalic=q,this._rendererText.SetItalic(q), this._runtime.UpdateRender())}_IsItalic(){return this._isItalic}_SetFontSize(q){this._ptSize!==q&&(this._ptSize=q,this._runtime.UpdateRender())}_GetFontSize(){return this._ptSize}_SetFontColor(q){this._color.equalsIgnoringAlpha(q)||(this._color.copyRgb(q),this._rendererText.SetColor(this._color),this._runtime.UpdateRender())}_GetFontColor(){return this._color}_SetLineHeight(q){this._lineHeightOffset!==q&&(this._lineHeightOffset=q,this._UpdateTextSettings(),this._runtime.UpdateRender())}_GetLineHeight(){return this._lineHeightOffset}_SetHAlign(q){this._horizontalAlign!== q&&(this._horizontalAlign=q,this._UpdateTextSettings(),this._runtime.UpdateRender())}_GetHAlign(){return this._horizontalAlign}_SetVAlign(q){this._verticalAlign!==q&&(this._verticalAlign=q,this._UpdateTextSettings(),this._runtime.UpdateRender())}_GetVAlign(){return this._verticalAlign}_SetWrapByWord(q){q=!!q;this._wrapByWord!==q&&(this._wrapByWord=q,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 q=this._runtime.GetWallTime();q>=this._typewriterEndTime?(this._CancelTypewriter(),this.Trigger(f.Plugins.Text.Cnds.OnTypewriterTextFinished),this._runtime.UpdateRender()):(q=f.relerp(this._typewriterStartTime,this._typewriterEndTime,q,0,this._typewriterLength),q=Math.floor(q),q!==this._rendererText.GetDrawMaxCharacterCount()&&(this._rendererText.SetDrawMaxCharacterCount(q),this._runtime.UpdateRender()))}GetDebuggerProperties(){return[{title:"plugins.text.name", properties:[{name:"plugins.text.properties.text.name",value:this._text,onedit:q=>this._SetText(q)}]}]}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]]),w=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(q){b.RequireString(q); const t=l.get(this);t._CancelTypewriter();t._SetText(q)}typewriterText(q,t){b.RequireString(q);b.RequireFiniteNumber(t);const p=l.get(this);p._CancelTypewriter();p._StartTypewriter(q,t)}typewriterFinish(){l.get(this)._FinishTypewriter()}set fontFace(q){b.RequireString(q);l.get(this)._SetFontFace(q)}get fontFace(){return l.get(this)._GetFontFace()}set isBold(q){l.get(this)._SetBold(q)}get isBold(){return l.get(this)._IsBold()}set isItalic(q){l.get(this)._SetItalic(q)}get isItalic(){return l.get(this)._IsItalic()}set sizePt(q){b.RequireFiniteNumber(q); l.get(this)._SetFontSize(q)}get sizePt(){return l.get(this)._GetFontSize()}set fontColor(q){b.RequireArray(q);if(3>q.length)throw Error("expected 3 elements");g.setRgb(q[0],q[1],q[2]);l.get(this)._SetFontColor(g)}get fontColor(){const q=l.get(this)._GetFontColor();return[q.getR(),q.getG(),q.getB()]}set lineHeight(q){b.RequireFiniteNumber(q);l.get(this)._SetLineHeight(q)}get lineHeight(){return l.get(this)._GetLineHeight()}set horizontalAlign(q){b.RequireString(q);q=m.get(q);if("undefined"===typeof q)throw Error("invalid mode"); l.get(this)._SetHAlign(q)}get horizontalAlign(){return c[l.get(this)._GetHAlign()]}set verticalAlign(q){b.RequireString(q);q=u.get(q);if("undefined"===typeof q)throw Error("invalid mode");l.get(this)._SetVAlign(q)}get verticalAlign(){return d[l.get(this)._GetVAlign()]}set wordWrapMode(q){b.RequireString(q);q=w.get(q);if("undefined"===typeof q)throw Error("invalid mode");l.get(this)._SetWrapByWord(q)}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 f=self.C3;f.Plugins.Text.Cnds={CompareText(b,a){return a?this._text===b:f.equalsNoCase(this._text,b)},IsRunningTypewriterText(){return-1!==this._typewriterEndTime},OnTypewriterTextFinished(){return!0}}} {"use strict";const f=self.C3,b=f.New(f.Color);f.Plugins.Text.Acts={SetText(a){this._CancelTypewriter();"number"===typeof a&&1E9>a&&(a=Math.round(1E10*a)/1E10);this._SetText(a.toString())},AppendText(a){this._CancelTypewriter();"number"===typeof a&&1E9>a&&(a=Math.round(1E10*a)/1E10);(a=a.toString())&&this._SetText(this._text+a)},TypewriterText(a,c){this._CancelTypewriter();"number"===typeof a&&1E9>a&&(a=Math.round(1E10*a)/1E10);this._StartTypewriter(a.toString(),c)},SetFontFace(a,c){let d=!1,e=!1; switch(c){case 1:d=!0;break;case 2:e=!0;break;case 3:e=d=!0}if(a!==this._faceName||d!==this._isBold||e!==this._isItalic)this._SetFontFace(a),this._SetBold(d),this._SetItalic(e)},SetFontSize(a){this._SetFontSize(a)},SetFontColor(a){b.setFromRgbValue(a);b.clamp();this._SetFontColor(b)},SetWebFont(a,c){console.warn("[Text] 'Set web font' action is deprecated and no longer has any effect")},SetEffect(a){this.GetWorldInfo().SetBlendMode(a);this._runtime.UpdateRender()},TypewriterFinish(){this._FinishTypewriter()}, SetLineHeight(a){this._SetLineHeight(a)},SetHAlign(a){this._SetHAlign(a)},SetVAlign(a){this._SetVAlign(a)},SetWrapping(a){this._SetWrapByWord(0===a)}}}{"use strict";const f=self.C3;f.Plugins.Text.Exps={Text(){return this._text},PlainText(){return this._enableBBcode?f.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 f=self.C3;f.Plugins.NinePatch=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}} {"use strict";const f=self.C3;f.Plugins.NinePatch.Type=class extends f.SDKTypeBase{constructor(b){super(b);this._drawable=this._textureSet=null}Release(){this.ReleaseTextures();super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}async LoadTextures(b){this._drawable=await this.GetImageInfo().ExtractImageToCanvas()}CreatePatch(b,a,c,d){!this._textureSet&&this._drawable&&(this._textureSet=new self.NinePatchTextureSet(this),this._textureSet.CreateTextures(this._drawable,b,a,c,d))}ReleaseTextures(){this._textureSet&& (this._textureSet.Release(),this._textureSet=null)}GetTextureSet(){return this._textureSet}}} {"use strict";const f=self.C3,b=f.New(f.Rect),a=f.New(f.Rect),c=f.New(f.Quad);f.Plugins.NinePatch.Instance=class extends f.SDKWorldInstanceBase{constructor(d,e){super(d);this._bottomMargin=this._topMargin=this._rightMargin=this._leftMargin=16;this._fill=this._edges=1;this._isSeamless=!0;this._callback3d=null;e&&(this._leftMargin=e[0],this._rightMargin=e[1],this._topMargin=e[2],this._bottomMargin=e[3],this._edges=e[4],this._fill=e[5],this._isSeamless=!!e[8],this.GetWorldInfo().SetVisible(!!e[6])); this._sdkType.CreatePatch(this._leftMargin,this._rightMargin,this._topMargin,this._bottomMargin)}Release(){super.Release()}_Set3DCallback(d){this._callback3d=d}Draw(d){const e=this.GetWorldInfo(),h=e.GetBoundingQuad();this._Draw(d,h.getTlx(),h.getTly(),e.GetWidth(),e.GetHeight())}_Draw(d,e,h,g,l){let m=this._sdkType.GetTextureSet();if(!m&&(this._sdkType.CreatePatch(this._leftMargin,this._rightMargin,this._topMargin,this._bottomMargin),m=this._sdkType.GetTextureSet(),!m))return;const u=this._leftMargin, w=this._rightMargin,q=this._topMargin,t=this._bottomMargin;var p=m.GetImageWidth(),r=m.GetImageHeight();p-=w;r-=t;var x=this._isSeamless?1:0;const y=this._edges,E=this._fill;0q&&this._TilePatch(d,m.GetLeftTexture(),e,h+q,u+x,l-q-t,0,0),0q&&this._TilePatch(d,m.GetRightTexture(),e+g-w-x,h+q,w+x,l-q-t,x,0),0u&&this._TilePatch(d,m.GetTopTexture(),e+u,h,g-u-w,q+x,0,0),0u&&this._TilePatch(d,m.GetBottomTexture(),e+u,h+l-t-x,g-u-w,t+x,0,x)):1===y&&(0q&&this._DrawPatch(d,m.GetTexture(),0,q,u,r-q,e,h+q,u,l-q-t),0q&&this._DrawPatch(d,m.GetTexture(),p,q,w,r-q,e+g-w,h+q,w,l-q-t),0u&&this._DrawPatch(d,m.GetTexture(),u,0,p-u,q,e+u,h,g-u-w,q),0u&&this._DrawPatch(d,m.GetTexture(),u,r,p-u,t,e+u,h+l-t,g-u-w,t));r>q&&p>u&&(0===E?this._TilePatch(d,m.GetFillTexture(),e+u,h+q,g-u-w,l-q-t,0,0):1===E&&this._DrawPatch(d,m.GetTexture(),u,q,p-u,r-q,e+u,h+q,g-u-w,l-q-t))}_DrawPatch(d,e,h,g,l,m,u,w,q,t){const p=e.GetWidth(),r=e.GetHeight();d.SetTexture(e);b.set(u,w,u+q,w+t);a.set(h/p,g/r,(h+l)/p,(g+m)/r);null===this._callback3d?(e=this.GetWorldInfo(),g=e.GetBoundingQuad(),h=g.getTlx(),g=g.getTly(),b.offset(-h,-g),c.setFromRotatedRect(b,e.GetAngle()), c.offset(h,g),d.Quad3(c,a)):this._callback3d(b,a)}_TilePatch(d,e,h,g,l,m,u,w){const q=e.GetWidth(),t=e.GetHeight();d.SetTexture(e);b.set(h,g,h+l,g+m);a.set(-u/q,-w/t,(l-u)/q,(m-w)/t);null===this._callback3d?(e=this.GetWorldInfo(),g=e.GetBoundingQuad(),h=g.getTlx(),g=g.getTly(),b.offset(-h,-g),c.setFromRotatedRect(b,e.GetAngle()),c.offset(h,g),d.Quad3(c,a)):this._callback3d(b,a)}GetCurrentImageInfo(){this._objectClass.GetImageInfo()}GetPropertyValueByIndex(d){}SetPropertyValueByIndex(d,e){}}}"use strict"; self.C3.Plugins.NinePatch.Cnds={};"use strict";self.C3.Plugins.NinePatch.Acts={SetEffect(f){this.GetWorldInfo().SetBlendMode(f);this._runtime.UpdateRender()}};"use strict";self.C3.Plugins.NinePatch.Exps={}; {"use strict";const f=self.C3;function b(a){const c=f.CreateCanvas(a.width,a.height);c.getContext("2d").drawImage(a,0,0);return c}self.NinePatchTextureSet=class{constructor(a){this._sdkType=a;this._runtime=this._sdkType.GetRuntime();this._bottomTexture=this._topTexture=this._rightTexture=this._leftTexture=this._fillTexture=this._texture=null;this._imageHeight=this._imageWidth=0;this._renderer=this._runtime.GetRenderer();this._wasReleased=this._isLoading=!1}Release(){this._renderer.IsContextLost()|| (this._renderer.DeleteTexture(this._texture),this._renderer.DeleteTexture(this._fillTexture),this._renderer.DeleteTexture(this._leftTexture),this._renderer.DeleteTexture(this._rightTexture),this._renderer.DeleteTexture(this._topTexture),this._renderer.DeleteTexture(this._bottomTexture));this._renderer=this._sdkType=this._bottomTexture=this._topTexture=this._rightTexture=this._leftTexture=this._fillTexture=this._texture=null;this._wasReleased=!0}WasReleased(){return this._wasReleased}CreateTextures(a, c,d,e,h){this._SliceImage(a,c,d,e,h)}HasCreatedTextures(){return!!this._texture}_SliceImage(a,c,d,e,h){if(!this._wasReleased){var g=a.width,l=a.height;this._imageWidth=g;this._imageHeight=l;var m=g-d,u=l-h,w=this._runtime.GetSampling(),q=this._runtime.GetCanvasManager().GetTextureAnisotropy();this._texture=this._renderer.CreateStaticTexture(b(a),{sampling:w,anisotropy:q});m>c&&u>e&&(this._fillTexture=this._renderer.CreateStaticTexture(this._SliceSubImage(b(a),c,e,m,u),{wrapX:"repeat",wrapY:"repeat", sampling:w,anisotropy:q}));0e&&(this._leftTexture=this._renderer.CreateStaticTexture(this._SliceSubImage(b(a),0,e,c,u),{wrapY:"repeat",sampling:w,anisotropy:q}));0e&&(this._rightTexture=this._renderer.CreateStaticTexture(this._SliceSubImage(b(a),m,e,g,u),{wrapY:"repeat",sampling:w,anisotropy:q}));0c&&(this._topTexture=this._renderer.CreateStaticTexture(this._SliceSubImage(b(a),c,0,m,e),{wrapX:"repeat",sampling:w,anisotropy:q}));0c&&(this._bottomTexture=this._renderer.CreateStaticTexture(this._SliceSubImage(b(a), c,u,m,l),{wrapX:"repeat",sampling:w,anisotropy:q}))}}_SliceSubImage(a,c,d,e,h){e-=c;h-=d;const g=f.CreateCanvas(e,h);g.getContext("2d").drawImage(a,c,d,e,h,0,0,e,h);return g}GetImageWidth(){return this._imageWidth}GetImageHeight(){return this._imageHeight}GetTexture(){return this._texture}GetFillTexture(){return this._fillTexture}GetLeftTexture(){return this._leftTexture}GetRightTexture(){return this._rightTexture}GetTopTexture(){return this._topTexture}GetBottomTexture(){return this._bottomTexture}}} {"use strict";const f=self.C3;f.Plugins.Particles=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const f=self.C3;f.Plugins.Particles.Type=class extends f.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}LoadTextures(b){return this.GetImageInfo().LoadStaticTexture(b,{sampling:this._runtime.GetSampling()})}ReleaseTextures(){this.GetImageInfo().ReleaseTexture()}}} {"use strict";const f=self.C3,b=f.New(f.Rect);f.Plugins.Particles.Instance=class extends f.SDKWorldInstanceBase{constructor(a,c){super(a);this._isFirstTick=!0;this._particleEngine=a=f.New(self.ParticleEngine);a.ononeshotfinish=()=>this._OnOneShotFinish();this._spawnObjectClass=null;this._particleUpdateCallback=(e,h,g,l,m,u)=>this._OnParticleUpdate(e,h,g,l,m,u);this._particleDestroyCallback=e=>this._OnParticleDestroy(e);this._hasAnyDefaultParticle=!0;c&&(a.SetRate(c[0]),a.SetSprayCone(f.toRadians(c[1])), a.SetSprayType(c[2]?"one-shot":"continuous-spray"),this._SetParticleObjectClass(this._runtime.GetObjectClassBySID(c[3])),a.SetInitSpeed(c[4]),a.SetInitSize(c[5]),a.SetInitOpacity(c[6]/100),a.SetGrowRate(c[7]),a.SetInitXRandom(c[8]),a.SetInitYRandom(c[9]),a.SetInitSpeedRandom(c[10]),a.SetInitSizeRandom(c[11]),a.SetGrowRandom(c[12]),a.SetAcceleration(c[13]),a.SetGravity(c[14]),a.SetLifeAngleRandom(c[15]),a.SetLifeSpeedRandom(c[16]),a.SetLifeOpacityRandom(c[17]),a.SetDestroyModeIndex(c[18]),a.SetTimeout(c[19])); this._UpdateEngineParameters();this._spawnObjectClass&&(this._hasAnyDefaultParticle=!1);"one-shot"===a.GetSprayType()?a.CreateOneShotSpray():a.SetSpraying(!0);const d=this.GetWorldInfo();d.SetBboxChangeEventEnabled(!0);this._inst.Dispatcher().addEventListener("bboxchange",()=>{d.OverwriteBoundingBox(this._particleEngine.GetBoundingBox())});this.GetRuntime().GetRenderer().IsWebGPU()&&d.SetUsePointsShaderProgram();this._afterLoad=e=>this._OnAfterLoad(e);this.GetRuntime().Dispatcher().addEventListener("afterload", this._afterLoad);this._StartTicking()}Release(){this.GetRuntime().Dispatcher().removeEventListener("afterload",this._afterLoad);this._afterLoad=null;this._particleEngine.Release();this._particleDestroyCallback=this._particleUpdateCallback=this._particleEngine=null;super.Release()}_SetParticleObjectClass(a){a===this.GetObjectClass()&&(a=null);this._spawnObjectClass=a;this._particleEngine.onparticlecreate=a?c=>this._OnParticleCreate(c):null;this._spawnObjectClass||(this._hasAnyDefaultParticle=!0)}_UpdateEngineParameters(){const a= this._particleEngine,c=this.GetWorldInfo();a.SetMasterOpacity(c.GetOpacity());a.SetPixelRounding(this._runtime.IsPixelRoundingEnabled());a.SetSpawnX(c.GetX());a.SetSpawnY(c.GetY());a.SetSpawnAngle(c.GetAngle());a.SetInitSizeScale(c.GetSceneGraphScale())}_OnOneShotFinish(){this._runtime.DestroyInstance(this._inst)}Draw(a){if(this._hasAnyDefaultParticle){var c=this._objectClass.GetImageInfo(),d=c.GetTexture();if(d){var e=this.GetWorldInfo(),h=e.GetLayer();this._runtime.GetCanvasManager().IsPastingToDrawingCanvas()? b.set(-Infinity,-Infinity,Infinity,Infinity):h.Has3DCamera()?h.CalculateViewport3D(e.GetTotalZElevation(),b):h.GetViewportForZ(e.GetTotalZElevation(),b);a.SetTexture(d);d=h.Get2DScaleFactorToZ(e.GetTotalZElevation());this._particleEngine.SetParticleScale(h.GetRenderScale()*d);this._particleEngine.Draw(a,c.GetTexRect(),b,h.Has3DCamera())}}}SaveToJson(){const a=this._particleEngine;return{r:a.GetRate(),sc:a.GetSprayCone(),st:a.GetSprayType(),isp:a.GetInitSpeed(),isz:a.GetInitSize(),io:a.GetInitOpacity(), gr:a.GetGrowRate(),xr:a.GetInitXRandom(),yr:a.GetInitYRandom(),spr:a.GetInitSpeedRandom(),szr:a.GetInitSizeRandom(),grnd:a.GetGrowRandom(),acc:a.GetAcceleration(),g:a.GetGravity(),lar:a.GetLifeAngleRandom(),lsr:a.GetLifeSpeedRandom(),lor:a.GetLifeOpacityRandom(),dm:a.GetDestroyModeIndex(),to:a.GetTimeout(),s:a.IsSpraying(),pcc:a._GetCreateCounter(),ft:this._isFirstTick,p:a.GetParticles().map(c=>c.toJSON())}}LoadFromJson(a){var c=this._particleEngine;c.SetRate(a.r);c.SetSprayCone(a.sc);c.SetSprayType(a.st); c.SetInitSpeed(a.isp);c.SetInitSize(a.isz);c.SetInitOpacity(a.io);c.SetGrowRate(a.gr);c.SetInitXRandom(a.xr);c.SetInitYRandom(a.yr);c.SetInitSpeedRandom(a.spr);c.SetInitSizeRandom(a.szr);c.SetGrowRandom(a.grnd);c.SetAcceleration(a.acc);c.SetGravity(a.g);c.SetLifeAngleRandom(a.lar);c.SetLifeSpeedRandom(a.lsr);c.SetLifeOpacityRandom(a.lor);c.SetDestroyModeIndex(a.dm);c.SetTimeout(a.to);c.SetSpraying(a.s);c._SetCreateCounter(a.pcc);this._isFirstTick=a.ft;a=a.p;c.SetParticleCount(a.length);c=c.GetParticles(); for(let e=0,h=c.length;ea.SetSpraying(c)},{name:"plugins.particles.properties.rate.name",value:a.GetRate(),onedit:c=>a.SetRate(c)},{name:"plugins.particles.properties.spray-cone.name",value:f.toDegrees(a.GetSprayCone()),onedit:c=>a.SetSprayCone(f.toRadians(c))},{name:"plugins.particles.properties.speed.name",value:a.GetInitSpeed(),onedit:c=>a.SetInitSpeed(c)},{name:"plugins.particles.properties.size.name",value:a.GetInitSize(),onedit:c=>a.SetInitSize(c)},{name:"plugins.particles.properties.opacity.name", value:a.GetInitOpacity(),onedit:c=>a.SetInitOpacity(c)},{name:"plugins.particles.properties.grow-rate.name",value:a.GetGrowRate(),onedit:c=>a.SetGrowRate(c)},{name:"plugins.particles.properties.x-randomiser.name",value:a.GetInitXRandom(),onedit:c=>a.SetInitXRandom(c)},{name:"plugins.particles.properties.y-randomiser.name",value:a.GetInitYRandom(),onedit:c=>a.SetInitYRandom(c)},{name:"plugins.particles.properties.initial-speed-randomiser.name",value:a.GetInitSpeedRandom(),onedit:c=>a.SetInitSpeedRandom(c)}, {name:"plugins.particles.properties.size-randomiser.name",value:a.GetInitSizeRandom(),onedit:c=>a.SetInitSizeRandom(c)},{name:"plugins.particles.properties.grow-rate-randomiser.name",value:a.GetGrowRandom(),onedit:c=>a.SetGrowRandom(c)},{name:"plugins.particles.properties.acceleration.name",value:a.GetAcceleration(),onedit:c=>a.SetAcceleration(c)},{name:"plugins.particles.properties.gravity.name",value:a.GetGravity(),onedit:c=>a.SetGravity(c)},{name:"plugins.particles.properties.angle-randomiser.name", value:a.GetLifeAngleRandom(),onedit:c=>a.SetLifeAngleRandom(c)},{name:"plugins.particles.properties.life-speed-randomiser.name",value:a.GetLifeSpeedRandom(),onedit:c=>a.SetLifeSpeedRandom(c)},{name:"plugins.particles.properties.opacity-randomiser.name",value:a.GetLifeOpacityRandom(),onedit:c=>a.SetLifeOpacityRandom(c)},{name:"plugins.particles.properties.timeout.name",value:a.GetTimeout(),onedit:c=>a.SetTimeout(c)}]}]}}}"use strict";self.C3.Plugins.Particles.Cnds={IsSpraying(){return this._particleEngine.IsSpraying()}}; {"use strict";const f=self.C3;f.Plugins.Particles.Acts={SetSpraying(b){this._particleEngine.SetSpraying(0!==b)},SetRate(b){this._particleEngine.SetRate(b);"one-shot"===this._particleEngine.GetSprayType()&&this._isFirstTick&&this._particleEngine.SetParticleCount(b)},SetParticleObject(b){this._SetParticleObjectClass(b)},UnsetParticleObject(){this._SetParticleObjectClass(null)},SetSprayCone(b){this._particleEngine.SetSprayCone(f.toRadians(b))},SetInitSpeed(b){this._particleEngine.SetInitSpeed(b)},SetInitSize(b){this._particleEngine.SetInitSize(b)}, SetInitOpacity(b){this._particleEngine.SetInitOpacity(b/100)},SetGrowRate(b){this._particleEngine.SetGrowRate(b)},SetXRandomiser(b){this._particleEngine.SetInitXRandom(b)},SetYRandomiser(b){this._particleEngine.SetInitYRandom(b)},SetSpeedRandomiser(b){this._particleEngine.SetInitSpeedRandom(b)},SetSizeRandomiser(b){this._particleEngine.SetInitSizeRandom(b)},SetGrowRateRandomiser(b){this._particleEngine.SetGrowRandom(b)},SetParticleAcc(b){this._particleEngine.SetAcceleration(b)},SetGravity(b){this._particleEngine.SetGravity(b)}, SetAngleRandomiser(b){this._particleEngine.SetLifeAngleRandom(b)},SetLifeSpeedRandomiser(b){this._particleEngine.SetLifeSpeedRandom(b)},SetOpacityRandomiser(b){this._particleEngine.SetLifeOpacityRandom(b)},SetTimeout(b){this._particleEngine.SetTimeout(b)},SetEffect(b){this.GetWorldInfo().SetBlendMode(b);this._runtime.UpdateRender()}}} {"use strict";const f=self.C3;f.Plugins.Particles.Exps={ParticleCount(){return this._particleEngine.GetParticleCount()},Rate(){return this._particleEngine.GetRate()},SprayCone(){return f.toDegrees(this._particleEngine.GetSprayCone())},InitSpeed(){return this._particleEngine.GetInitSpeed()},InitSize(){return this._particleEngine.GetInitSize()},InitOpacity(){return 100*this._particleEngine.GetInitOpacity()},InitGrowRate(){return this._particleEngine.GetGrowRate()},XRandom(){return this._particleEngine.GetInitXRandom()}, YRandom(){return this._particleEngine.GetInitYRandom()},InitSizeRandom(){return this._particleEngine.GetInitSizeRandom()},InitSpeedRandom(){return this._particleEngine.GetInitSpeedRandom()},InitGrowRandom(){return this._particleEngine.GetGrowRandom()},ParticleAcceleration(){return this._particleEngine.GetAcceleration()},Gravity(){return this._particleEngine.GetGravity()},ParticleAngleRandom(){return this._particleEngine.GetLifeAngleRandom()},ParticleSpeedRandom(){return this._particleEngine.GetLifeSpeedRandom()}, ParticleOpacityRandom(){return this._particleEngine.GetLifeOpacityRandom()},Timeout(){return this._particleEngine.GetTimeout()}}} {"use strict";const f=self.C3,b=[],a=new Set(["continuous-spray","one-shot"]),c=["fade-to-invisible","timeout-expired","particle-stopped"];self.ParticleEngine=class{constructor(){this._sprayCone=this._rate=0;this._sprayType="continuous-spray";this._isSpraying=!1;this._masterOpacity=0;this._isPixelRounding=!1;this._initSize=this._initSpeed=this._spawnAngle=this._spawnY=this._spawnX=0;this._initSizeScale=1;this._createCounter=this._timeout=this._destroyMode=this._lifeOpacityRandom=this._lifeSpeedRandom= this._lifeAngleRandom=this._gravity=this._acceleration=this._growRandom=this._initSizeRandom=this._initSpeedRandom=this._yRandom=this._xRandom=this._growRate=this._initOpacity=0;this._particleScale=1;this.onparticlecreate=this.ononeshotfinish=null;this._particles=[];this._boundingBox=new f.Rect;this._color=new f.Color}Release(){this.Cancel();f.clearArray(this._particles);this._color=this._boundingBox=this.onparticlecreate=this.ononeshotfinish=this._particles=null}Cancel(){const d=this._particles; for(let e=0,h=d.length;ee.length)for(e=d-e.length,d=0;d=u)){var w=this._size,q=w*m.GetParticleScale()*d;if(!(1>q)){var t=this._x,p=this._y;m.IsPixelRounding()&&(t=t+.5|0,p=p+.5|0);h.IsWebGPU()?h.Point(t,p,w,u):l||q>h.GetMaxPointSize()||qe.length)if("function"===typeof g)for(var l=e.length;lf.MakeFilledArray(this._cy,()=>f.MakeFilledArray(this._cz,0)))}Release(){this._arr=null;super.Release()}At(e,h,g){e=Math.floor(e);h=Math.floor(h);g=Math.floor(g);return 0<=e&&ee&&(e=0);0>h&&(h=0);0>g&&(g=0);if(this._cx!==e||this._cy!== h||this._cz!==g){this._cx=e;this._cy=h;this._cz=g;var l=this._arr;c(l,e,()=>f.MakeFilledArray(h,()=>f.MakeFilledArray(g,0)));for(let m=0;mf.MakeFilledArray(g,0));for(let u=0;uthis.SetSize(g,this._cy,this._cz)}, {name:"plugins.arr.properties.height.name",value:this._cy,onedit:g=>this.SetSize(this._cx,g,this._cz)},{name:"plugins.arr.properties.depth.name",value:this._cz,onedit:g=>this.SetSize(this._cx,this._cy,g)},{name:"plugins.arr.properties.elements.name",value:this._cx*this._cy*this._cz}]}],h=[];if(1===this._cy&&1===this._cz)for(let g=0;gthis._arr[g][0][0]=l});else for(let g=0;gc?1:0}f.Plugins.Arr.Acts={Clear(a){const c=this._cx,d=this._cy,e=this._cz,h=this._arr;for(let g=0;gf.MakeFilledArray(g,c)),0===a?l.push(e):l.unshift(e),this._cx++;else if(1===d){for(h=0;hb(g[0][0],l[0][0]));else if(1===a)for(d=0;db(g[0],l[0]));else for(a= 0;aa)){var d=this._cx,e=this._cy,h=this._cz,g=this._arr;if(0===c)a>=d||(g.splice(a,1),this._cx--);else if(1===c){if(!(a>=e)){for(e=0;e=h)){for(c=0;cc)){var e=this._cx,h=this._cy,g=this._cz,l=this._arr;if(0===d)c>e||(l.splice(c,0,f.MakeFilledArray(h,()=>f.MakeFilledArray(g,a))),this._cx++); else if(1===d){if(!(c>h)){for(h=0;hg)){for(d=0;d=b.GetShakeStart()&&gthis._SetEnabled(u)},{name:"behaviors.sin.properties.period.name",value:this._GetPeriod(),onedit:u=>this._SetPeriod(u)},{name:"behaviors.sin.properties.magnitude.name",value:this._GetMagnitude_ConvertAngle(),onedit:u=>this._SetMagnitude_ConvertAngle(u)},{name:"behaviors.sin.debugger.value",value:this.WaveFunc(this._GetPhase())*this._GetMagnitude_ConvertAngle()}]}]}GetScriptInterfaceClass(){return self.ISineBehaviorInstance}}; const g=new WeakMap,l="horizontal vertical size width height angle opacity value-only forwards-backwards z-elevation".split(" "),m=["sine","triangle","sawtooth","reverse-sawtooth","square"];self.ISineBehaviorInstance=class extends a{constructor(){super();g.set(this,a._GetInitInst().GetSdkInstance())}set period(u){b.RequireFiniteNumber(u);g.get(this)._SetPeriod(u)}get period(){return g.get(this)._GetPeriod()}set magnitude(u){b.RequireFiniteNumber(u);g.get(this)._SetMagnitude(u)}get magnitude(){return g.get(this)._GetMagnitude()}set phase(u){g.get(this)._SetPhase(u)}get phase(){return g.get(this)._GetPhase()}set movement(u){b.RequireString(u); u=l.indexOf(u);if(-1===u)throw Error("invalid movement");g.get(this)._SetMovement(u)}get movement(){return l[g.get(this)._GetMovement()]}set wave(u){b.RequireString(u);u=m.indexOf(u);if(-1===u)throw Error("invalid wave");g.get(this)._SetWave(u)}get wave(){return m[g.get(this)._GetWave()]}get value(){const u=g.get(this);return u.WaveFunc(u._GetPhase())*u._GetMagnitude()}updateInitialState(){g.get(this).Init()}set isEnabled(u){g.get(this)._SetEnabled(!!u)}get isEnabled(){return g.get(this)._IsEnabled()}}} {"use strict";const f=self.C3;f.Behaviors.Sin.Cnds={IsEnabled(){return this._IsEnabled()},CompareMovement(b){return this._GetMovement()===b},ComparePeriod(b,a){return f.compare(this._GetPeriod(),b,a)},CompareMagnitude(b,a){return f.compare(this._GetMagnitude_ConvertAngle(),b,a)},CompareWave(b){return this._GetWave()===b}}}"use strict"; self.C3.Behaviors.Sin.Acts={SetEnabled(f){this._SetEnabled(0!==f)},SetPeriod(f){this._SetPeriod(f)},SetMagnitude(f){this._SetMagnitude_ConvertAngle(f)},SetMovement(f){this._SetMovement(f)},SetWave(f){this._wave=f},SetPhase(f){const b=2*Math.PI;this._SetPhase(f*b%b)},UpdateInitialState(){this.Init()}};"use strict"; self.C3.Behaviors.Sin.Exps={CyclePosition(){return this._GetPhase()/(2*Math.PI)},Period(){return this._GetPeriod()},Magnitude(){return this._GetMagnitude_ConvertAngle()},Value(){return this.WaveFunc(this._GetPhase())*this._GetMagnitude_ConvertAngle()}};{"use strict";const f=self.C3;f.Behaviors.Fade=class extends f.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const f=self.C3;f.Behaviors.Fade.Type=class extends f.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}} {"use strict";const f=self.C3;f.Behaviors.Fade.Instance=class extends f.SDKBehaviorInstanceBase{constructor(b,a){super(b);this._fadeOutTime=this._waitTime=this._fadeInTime=0;this._activeAtStart=this._destroy=!0;this._setMaxOpacity=!1;this._stage=0;this._stageTime=f.New(f.KahanSum);this._maxOpacity=this._inst.GetWorldInfo().GetOpacity()||1;a&&(this._fadeInTime=a[0],this._waitTime=a[1],this._fadeOutTime=a[2],this._destroy=!!a[3],this._stage=(this._activeAtStart=!!a[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(b){this._fadeInTime=b.fit;this._waitTime=b.wt;this._fadeOutTime=b.fot;this._destroy=b.d;this._stage=b.s;this._stageTime.Set(b.st);this._maxOpacity= b.mo}Tick(){var b=this._runtime.GetDt(this._inst);this._stageTime.Add(b);b=this._inst.GetWorldInfo();0===this._stage&&(b.SetOpacity(this._stageTime.Get()/this._fadeInTime*this._maxOpacity),this._runtime.UpdateRender(),b.GetOpacity()>=this._maxOpacity&&(b.SetOpacity(this._maxOpacity),this._stage=1,this._stageTime.Reset(),this.Trigger(f.Behaviors.Fade.Cnds.OnFadeInEnd)));1===this._stage&&this._stageTime.Get()>=this._waitTime&&(this._stage=2,this._stageTime.Reset(),this.Trigger(f.Behaviors.Fade.Cnds.OnWaitEnd)); 2===this._stage&&0!==this._fadeOutTime&&(b.SetOpacity(this._maxOpacity-this._stageTime.Get()/this._fadeOutTime*this._maxOpacity),this._runtime.UpdateRender(),0>=b.GetOpacity()&&(this._stage=3,this._stageTime.Reset(),this.Trigger(f.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(b){switch(b){case 0:return this._fadeInTime; case 1:return this._waitTime;case 2:return this._fadeOutTime;case 3:return this._destroy}}SetPropertyValueByIndex(b,a){switch(b){case 0:this._fadeInTime=a;break;case 1:this._waitTime=a;break;case 2:this._fadeOutTime=a;break;case 3:this._destroy=!!a}}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.fade.properties.fade-in-time.name",value:this._fadeInTime,onedit:b=>this._fadeInTime=b},{name:"behaviors.fade.properties.wait-time.name",value:this._waitTime, onedit:b=>this._waitTime=b},{name:"behaviors.fade.properties.fade-out-time.name",value:this._fadeOutTime,onedit:b=>this._fadeOutTime=b},{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(f){0>f&&(f=0);this._fadeInTime=f},SetWaitTime(f){0>f&&(f=0);this._waitTime=f},SetFadeOutTime(f){0>f&&(f=0);this._fadeOutTime=f}};"use strict";self.C3.Behaviors.Fade.Exps={FadeInTime(){return this._fadeInTime},WaitTime(){return this._waitTime},FadeOutTime(){return this._fadeOutTime}}; {"use strict";const f=self.C3;f.Behaviors.Pin=class extends f.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const f=self.C3;f.Behaviors.Pin.Type=class extends f.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}} {"use strict";const f=self.C3;f.Behaviors.Pin.Instance=class extends f.SDKBehaviorInstanceBase{constructor(b,a){super(b);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;a&&(this._destroy=a[0]);b=this._runtime.Dispatcher();this._disposables=new f.CompositeDisposable(f.Disposable.From(b,"instancedestroy",c=>this._OnInstanceDestroyed(c.instance)), f.Disposable.From(b,"afterload",c=>this._OnAfterLoad()))}Release(){this._pinInst=null;super.Release()}_SetPinInst(b){b?(this._pinInst=b,this._StartTicking2()):(this._pinInst=null,this._StopTicking2())}_Pin(b,a,c){if(b&&(b=b.GetFirstPicked(this._inst)))if(this._mode=a,this._SetPinInst(b),a=this._inst.GetWorldInfo(),b=b.GetWorldInfo(),"properties"===this._mode){const d=this._propSet;d.clear();for(const e of c)d.add(e);this._dx=a.GetX()-b.GetX();this._dy=a.GetY()-b.GetY();this._dAngle=a.GetAngle()-b.GetAngle(); this._lastKnownAngle=a.GetAngle();this._dz=a.GetZElevation()-b.GetZElevation();d.has("x")&&d.has("y")&&(this._pinAngle=f.angleTo(b.GetX(),b.GetY(),a.GetX(),a.GetY())-b.GetAngle(),this._pinDist=f.distanceTo(b.GetX(),b.GetY(),a.GetX(),a.GetY()));d.has("width-abs")?this._dWidth=a.GetWidth()-b.GetWidth():d.has("width-scale")&&(this._dWidth=a.GetWidth()/b.GetWidth());d.has("height-abs")?this._dHeight=a.GetHeight()-b.GetHeight():d.has("height-scale")&&(this._dHeight=a.GetHeight()/b.GetHeight())}else this._pinDist= f.distanceTo(b.GetX(),b.GetY(),a.GetX(),a.GetY())}SaveToJson(){const b=this._propSet,a=this._mode,c={uid:this._pinInst?this._pinInst.GetUID():-1,m:a,d:this._destroy};if("rope"===a||"bar"===a)c.pd=this._pinDist;else if("properties"===a){c.ps=[...this._propSet];b.has("imagepoint")?c.ip=this._pinImagePoint:b.has("x")&&b.has("y")?(c.pa=this._pinAngle,c.pd=this._pinDist):(b.has("x")&&(c.dx=this._dx),b.has("y")&&(c.dy=this._dy));b.has("angle")&&(c.da=this._dAngle,c.lka=this._lastKnownAngle);if(b.has("width-abs")|| b.has("width-scale"))c.dw=this._dWidth;if(b.has("height-abs")||b.has("height-scale"))c.dh=this._dHeight;b.has("z")&&(c.dz=this._dz)}return c}LoadFromJson(b){const a=b.m,c=this._propSet;c.clear();this._pinUid=b.uid;if("number"===typeof a)this._LoadFromJson_Legacy(b);else if(this._mode=a,b.hasOwnProperty("d")&&(this._destroy=!!b.d),"rope"===a||"bar"===a)this._pinDist=b.pd;else if("properties"===a){for(const d of b.ps)c.add(d);c.has("imagepoint")?this._pinImagePoint=b.ip:c.has("x")&&c.has("y")?(this._pinAngle= b.pa,this._pinDist=b.pd):(c.has("x")&&(this._dx=b.dx),c.has("y")&&(this._dy=b.dy));c.has("angle")&&(this._dAngle=b.da,this._lastKnownAngle=b.lka||0);if(c.has("width-abs")||c.has("width-scale"))this._dWidth=b.dw;if(c.has("height-abs")||c.has("height-scale"))this._dHeight=b.dh;c.has("z")&&(this._dz=b.dz)}}_LoadFromJson_Legacy(b){const a=this._propSet,c=b.msa,d=b.tsa,e=b.pa,h=b.pd;switch(b.m){case 0:this._mode="properties";a.add("x").add("y").add("angle");this._pinAngle=e;this._pinDist=h;this._dAngle= c-d;this._lastKnownAngle=b.lka;break;case 1:this._mode="properties";a.add("x").add("y");this._pinAngle=e;this._pinDist=h;break;case 2:this._mode="properties";a.add("angle");this._dAngle=c-d;this._lastKnownAngle=b.lka;break;case 3:this._mode="rope";this._pinDist=b.pd;break;case 4:this._mode="bar",this._pinDist=b.pd}}_OnAfterLoad(){-1===this._pinUid?this._SetPinInst(null):(this._SetPinInst(this._runtime.GetInstanceByUID(this._pinUid)),this._pinUid=-1)}_OnInstanceDestroyed(b){this._pinInst===b&&(this._SetPinInst(null), this._destroy&&this._runtime.DestroyInstance(this._inst))}Tick2(){var b=this._pinInst;if(b){var a=b.GetWorldInfo(),c=this._inst.GetWorldInfo(),d=this._mode,e=!1;if("rope"===d||"bar"===d){if(b=f.distanceTo(c.GetX(),c.GetY(),a.GetX(),a.GetY()),b>this._pinDist||"bar"===d&&bl&&(h=g=l=0);this._dx=Math.cos(m)*l;this._dy=Math.sin(m)*l}0!==this._g&&(this._dy+=this._g*d,h+=this._g);this._lastX=e.GetX();this._lastY=e.GetY();if(0!==this._dx||0!==this._dy)g=this._dx*d+.5*g*d*d,d=this._dy*d+.5*h*d*d,h=f.distanceTo(0,0,g,d),this._MoveBy(g,d,h),this._travelled+=h,!this._setAngle||0===g&&0===d||(d=f.angleTo(0,0,g,d),e.SetAngle(d),this._lastKnownAngle=e.GetAngle()),e.SetBboxChanged()}}_MoveBy(d,e,h){const g=this.GetWorldInfo(); if(!this._isStepping||h<=this._stepSize)g.OffsetXY(d,e),g.SetBboxChanged(),this._isStepping&&this.Trigger(f.Behaviors.Bullet.Cnds.OnStep);else{this._stopStepping=!1;var l=g.GetX(),m=g.GetY(),u=l+d,w=m+e;e=f.angleTo(0,0,d,e);d=Math.cos(e)*this._stepSize;e=Math.sin(e)*this._stepSize;h=Math.floor(h/this._stepSize);for(let q=1;q<=h;++q)if(g.SetXY(l+d*q,m+e*q),g.SetBboxChanged(),this.Trigger(f.Behaviors.Bullet.Cnds.OnStep),this._inst.IsDestroyed()||this._stopStepping)return;g.SetXY(u,w);g.SetBboxChanged(); this.Trigger(f.Behaviors.Bullet.Cnds.OnStep)}}PostTick(){if(this._isEnabled&&this._bounceOffSolid&&(0!==this._dx||0!==this._dy)){var d=this._runtime.GetDt(this._inst),e=this._inst.GetWorldInfo(),h=this._runtime.GetCollisionEngine(),g=h.TestOverlapSolid(this._inst);if(g){h.RegisterCollision(this._inst,g);g=f.distanceTo(0,0,this._dx,this._dy);const l=h.CalculateBounceAngle(this._inst,this._lastX,this._lastY);this._dx=Math.cos(l)*g;this._dy=Math.sin(l)*g;e.OffsetXY(this._dx*d,this._dy*d);e.SetBboxChanged(); this._setAngle&&(e.SetAngle(l),this._lastKnownAngle=e.GetAngle(),e.SetBboxChanged());h.PushOutSolid(this._inst,this._dx/g,this._dy/g,Math.max(2.5*g*d,30))||h.PushOutSolidNearest(this._inst,100)}}}GetPropertyValueByIndex(d){switch(d){case 0:return this._GetSpeed();case 1:return this._GetAcceleration();case 2:return this._GetGravity();case 4:return this._setAngle;case 5:return this._isStepping;case 6:return this._IsEnabled()}}SetPropertyValueByIndex(d,e){switch(d){case 0:this._SetSpeed(e);break;case 1:this._acc= e;break;case 2:this._g=e;break;case 4:this._setAngle=!!e;break;case 5:this._isStepping=!!e;break;case 6:this._SetEnabled(!!e)}}_SetSpeed(d){const e=f.angleTo(0,0,this._dx,this._dy);this._dx=Math.cos(e)*d;this._dy=Math.sin(e)*d}_GetSpeed(){return f.round6dp(f.distanceTo(0,0,this._dx,this._dy))}_SetAcceleration(d){this._acc=d}_GetAcceleration(){return this._acc}_SetGravity(d){this._g=d}_GetGravity(){return this._g}_SetAngleOfMotion(d){const e=f.distanceTo(0,0,this._dx,this._dy);this._dx=Math.cos(d)* e;this._dy=Math.sin(d)*e}_GetAngleOfMotion(){return f.angleTo(0,0,this._dx,this._dy)}_SetBounceOffSolids(d){d=!!d;this._bounceOffSolid!==d&&(this._bounceOffSolid=d,this._isEnabled&&(this._bounceOffSolid?this._StartPostTicking():this._StopPostTicking()))}_IsBounceOffSolids(){return this._bounceOffSolid}_SetDistanceTravelled(d){this._travelled=d}_GetDistanceTravelled(){return this._travelled}_SetEnabled(d){(this._isEnabled=!!d)?(this._StartTicking(),this._bounceOffSolid&&this._StartPostTicking()):(this._StopTicking(), this._StopPostTicking())}_IsEnabled(){return this._isEnabled}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.bullet.debugger.vector-x",value:this._dx,onedit:d=>this._dx=d},{name:"behaviors.bullet.debugger.vector-y",value:this._dy,onedit:d=>this._dy=d},{name:"behaviors.bullet.properties.speed.name",value:this._GetSpeed(),onedit:d=>this._SetSpeed(d)},{name:"behaviors.bullet.debugger.angle-of-motion",value:f.toDegrees(this._GetAngleOfMotion())}, {name:"behaviors.bullet.properties.gravity.name",value:this._GetGravity(),onedit:d=>this._SetGravity(d)},{name:"behaviors.bullet.properties.acceleration.name",value:this._GetAcceleration(),onedit:d=>this._SetAcceleration(d)},{name:"behaviors.bullet.debugger.distance-travelled",value:this._GetDistanceTravelled()},{name:"behaviors.bullet.properties.enabled.name",value:this._IsEnabled(),onedit:d=>this._SetEnabled(d)}]}]}GetScriptInterfaceClass(){return self.IBulletBehaviorInstance}};const c=new WeakMap; self.IBulletBehaviorInstance=class extends a{constructor(){super();c.set(this,a._GetInitInst().GetSdkInstance())}get speed(){return c.get(this)._GetSpeed()}set speed(d){b.RequireFiniteNumber(d);c.get(this)._SetSpeed(d)}get acceleration(){return c.get(this)._GetAcceleration()}set acceleration(d){b.RequireFiniteNumber(d);c.get(this)._SetAcceleration(d)}get gravity(){return c.get(this)._GetGravity()}set gravity(d){b.RequireFiniteNumber(d);c.get(this)._SetGravity(d)}get angleOfMotion(){return c.get(this)._GetAngleOfMotion()}set angleOfMotion(d){b.RequireFiniteNumber(d); c.get(this)._SetAngleOfMotion(d)}get bounceOffSolids(){return c.get(this)._IsBounceOffSolids()}set bounceOffSolids(d){c.get(this)._SetBounceOffSolids(!!d)}get distanceTravelled(){return c.get(this)._GetDistanceTravelled()}set distanceTravelled(d){b.RequireFiniteNumber(d);c.get(this)._SetDistanceTravelled(d)}get isEnabled(){return c.get(this)._IsEnabled()}set isEnabled(d){c.get(this)._SetEnabled(d)}}} {"use strict";const f=self.C3;f.Behaviors.Bullet.Cnds={CompareSpeed(b,a){return f.compare(Math.sqrt(this._dx*this._dx+this._dy*this._dy),b,a)},CompareTravelled(b,a){return f.compare(this._GetDistanceTravelled(),b,a)},OnStep(){return!0},IsEnabled(){return this._IsEnabled()}}} {"use strict";const f=self.C3;f.Behaviors.Bullet.Acts={SetSpeed(b){this._SetSpeed(b)},SetAcceleration(b){this._SetAcceleration(b)},SetGravity(b){this._SetGravity(b)},SetAngleOfMotion(b){this._SetAngleOfMotion(f.toRadians(b))},Bounce(b){if(b&&(b=b.GetFirstPicked(this._inst))){var a=this._inst.GetWorldInfo(),c=this._runtime.GetCollisionEngine(),d=this._runtime.GetDt(this._inst),e=f.distanceTo(0,0,this._dx,this._dy),h=c.CalculateBounceAngle(this._inst,this._lastX,this._lastY,b);this._dx=Math.cos(h)* e;this._dy=Math.sin(h)*e;a.OffsetXY(this._dx*d,this._dy*d);a.SetBboxChanged();this._setAngle&&(a.SetAngle(h),this._lastKnownAngle=a.GetAngle(),a.SetBboxChanged());0!==e&&(this._bounceOffSolid?c.PushOutSolid(this._inst,this._dx/e,this._dy/e,Math.max(2.5*e*d,30))||c.PushOutSolidNearest(this._inst,100):c.PushOut(this._inst,this._dx/e,this._dy/e,Math.max(2.5*e*d,30),b))}},SetBounceOffSolids(b){this._SetBounceOffSolids(b)},SetDistanceTravelled(b){this._SetDistanceTravelled(b)},SetEnabled(b){this._SetEnabled(b)}, StopStepping(){this._stopStepping=!0}}}{"use strict";const f=self.C3;f.Behaviors.Bullet.Exps={Speed(){return this._GetSpeed()},Acceleration(){return this._GetAcceleration()},AngleOfMotion(){return f.toDegrees(this._GetAngleOfMotion())},DistanceTravelled(){return this._GetDistanceTravelled()},Gravity(){return this._GetGravity()}}}{"use strict";const f=self.C3;f.Behaviors.Rotate=class extends f.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}} {"use strict";const f=self.C3;f.Behaviors.Rotate.Type=class extends f.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}} {"use strict";const f=self.C3;f.Behaviors.Rotate.Instance=class extends f.SDKBehaviorInstanceBase{constructor(b,a){super(b);this._acceleration=this._speed=0;this._isEnabled=!0;a&&(this._speed=f.toRadians(a[0]),this._acceleration=f.toRadians(a[1]),this._isEnabled=a[2]);this._isEnabled&&this._StartTicking()}Release(){super.Release()}SaveToJson(){return{s:this._speed,a:this._acceleration,e:this._isEnabled}}LoadFromJson(b){this._speed=b.s;this._acceleration=b.a;this._SetEnabled(b.e)}Tick(){if(this._isEnabled){var b= this._runtime.GetDt(this._inst);if(0!==b&&(0!==this._acceleration&&(this._speed+=this._acceleration*b),0!==this._speed)){const a=this._inst.GetWorldInfo();a.SetAngle(a.GetAngle()+this._speed*b);a.SetBboxChanged()}}}GetPropertyValueByIndex(b){switch(b){case 0:return f.toDegrees(this._speed);case 1:return f.toDegrees(this._acceleration);case 2:return this._isEnabled}}SetPropertyValueByIndex(b,a){switch(b){case 0:this._speed=f.toRadians(a);break;case 1:this._acceleration=f.toRadians(a);break;case 2:this._SetEnabled(a)}}_SetEnabled(b){(this._isEnabled= !!b)?this._StartTicking():this._StopTicking()}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.rotate.properties.speed.name",value:f.toDegrees(this._speed),onedit:b=>this._speed=f.toRadians(b)},{name:"behaviors.rotate.properties.acceleration.name",value:f.toDegrees(this._acceleration),onedit:b=>this._acceleration=f.toRadians(b)},{name:"behaviors.rotate.properties.enabled.name",value:this._isEnabled,onedit:b=>this._SetEnabled(b)}]}]}}}"use strict"; self.C3.Behaviors.Rotate.Cnds={IsEnabled(){return this._isEnabled}};{"use strict";const f=self.C3;f.Behaviors.Rotate.Acts={SetSpeed(b){this._speed=f.toRadians(b)},SetAcceleration(b){this._acceleration=f.toRadians(b)},SetEnabled(b){this._SetEnabled(b)}}}{"use strict";const f=self.C3;f.Behaviors.Rotate.Exps={Speed(){return f.toDegrees(this._speed)},Acceleration(){return f.toDegrees(this._acceleration)}}}{"use strict";const f=self.C3;f.Behaviors.Timer=class extends f.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}} {"use strict";const f=self.C3;f.Behaviors.Timer.Type=class extends f.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}} {"use strict";const f=self.C3;f.Behaviors.Timer.SingleTimer=class{constructor(b,a,c,d){this._current=f.New(f.KahanSum);this._current.Set(b||0);this._total=f.New(f.KahanSum);this._total.Set(a||0);this._duration=c||0;this._isRegular=!!d;this._isPaused=!1}GetCurrentTime(){return this._current.Get()}GetTotalTime(){return this._total.Get()}GetDuration(){return this._duration}SetPaused(b){this._isPaused=!!b}IsPaused(){return this._isPaused}Add(b){this._current.Add(b);this._total.Add(b)}HasFinished(){return this._current.Get()>= this._duration}Update(){if(this.HasFinished())if(this._isRegular)this._current.Subtract(this._duration);else return!0;return!1}SaveToJson(){return{c:this._current.Get(),t:this._total.Get(),d:this._duration,r:this._isRegular,p:this._isPaused}}LoadFromJson(b){this._current.Set(b.c);this._total.Set(b.t);this._duration=b.d;this._isRegular=!!b.r;this._isPaused=!!b.p}};f.Behaviors.Timer.Instance=class extends f.SDKBehaviorInstanceBase{constructor(b,a){super(b);this._timers=new Map}Release(){this._timers.clear(); super.Release()}_UpdateTickState(){0({name:"$"+b[0],value:`${Math.round(10*b[1].GetCurrentTime())/10} / ${Math.round(10*b[1].GetDuration())/10}`}))}]}}}"use strict"; self.C3.Behaviors.Timer.Cnds={OnTimer(f){return(f=this._timers.get(f.toLowerCase()))?f.HasFinished():!1},IsTimerRunning(f){return this._timers.has(f.toLowerCase())},IsTimerPaused(f){return(f=this._timers.get(f.toLowerCase()))&&f.IsPaused()}}; {"use strict";const f=self.C3;f.Behaviors.Timer.Acts={StartTimer(b,a,c){b=new f.Behaviors.Timer.SingleTimer(0,0,b,1===a);this._timers.set(c.toLowerCase(),b);this._UpdateTickState()},StopTimer(b){this._timers.delete(b.toLowerCase());this._UpdateTickState()},PauseResumeTimer(b,a){(b=this._timers.get(b.toLowerCase()))&&b.SetPaused(0===a)}}}"use strict"; self.C3.Behaviors.Timer.Exps={CurrentTime(f){return(f=this._timers.get(f.toLowerCase()))?f.GetCurrentTime():0},TotalTime(f){return(f=this._timers.get(f.toLowerCase()))?f.GetTotalTime():0},Duration(f){return(f=this._timers.get(f.toLowerCase()))?f.GetDuration():0}};{"use strict";const f=self.C3;f.Behaviors.Tween=class extends f.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const f=self.C3;f.Behaviors.Tween.Type=class extends f.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}} {"use strict";const f=self.C3,b=f.Behaviors.Tween;b.Instance=class extends f.SDKBehaviorInstanceBase{constructor(a,c){super(a);this._allowMultiple=!1;this._enabled=!0;c&&(this._allowMultiple=!1,this._enabled=!!c[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=d=>this._OnAfterLoad(d); 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(a){(this._enabled=a)? this._StartTicking2():this._StopTicking2()}GetEnabled(){return this._enabled}AddToDisabledList(a){this._disabledTweens.push(a)}IsInDisabledList(a){return this._disabledTweens.includes(a)}ClearDisabledList(){f.clearArray(this._disabledTweens)}GetFinishingTween(){return this._finishingTween}IsInstanceValid(){const a=this.GetObjectInstance();return a?!a.IsDestroyed():!1}GetTween(a,c,d=!1){if((c=c?this.PropertyTweens(c,d):this.AllTweens(d))&&c.length)for(const e of c)if(e.HasTags(a))return e}GetTweenIncludingWaitingForRelease(a, c){return this.GetTween(a,c,!0)}*GetTweens(a,c,d=!1){if((c=c?this.PropertyTweens(c,d):this.AllTweens(d))&&c.length)for(const e of c)e.HasTags(a)&&(yield e)}*GetTweensIncludingWaitingForRelease(a,c){yield*this.GetTweens(a,c,!0)}PropertyTweens(a,c){if(c)return c=this._activeTweens.get(a),a=this._waitingForReleaseTweens.get(a),c||(c=[]),a||(a=[]),c.concat(a).filter(d=>d);(a=this._activeTweens.get(a))||(a=[]);return a.filter(d=>d)}AllTweens(a){if(a){a=[...this._activeTweens.values()].flat();const c=[...this._waitingForReleaseTweens.values()].flat(); return a.concat(c).filter(d=>d)}return[...this._activeTweens.values()].flat().filter(c=>c)}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(a){a&&(this._activeTweensJson=a.at,this._disabledTweensJson=a.dt,this._waitingForReleaseTweensJson=a.wt,this._finishingTweenName=a.ft,this._allowMultiple= !1,this._enabled=!!a.e)}_OnAfterLoad(a){a=this.GetRuntime().GetTimelineManager();this._PopulateTweenMap(this._activeTweensJson,this._activeTweens,a);if(this._disabledTweensJson){f.clearArray(this._disabledTweens);for(const c of this._disabledTweensJson)this._PopulateTweenArray(this._disabledTweens,c,a)}this._PopulateTweenMap(this._waitingForReleaseTweensJson,this._waitingForReleaseTweens,a);this._finishingTween=this._GetTween(this._finishingTweenName,a);this._enabled?this._StartTicking2():this._StopTicking2()}_PopulateTweenMap(a, c,d){if(a)for(const h in a){let g=c.get(h);g?f.clearArray(g):g=[];var e=a[h];for(const l of e)this._PopulateTweenArray(g,l.name,d)?this._LoadTweenFromJson(l.name,l,d):(e=f.TweenState.Build({runtime:this.GetRuntime(),json:l}),e.AddCompletedCallback(m=>this._FinishTriggers(m)),d.AddScheduledTimeline(e),this._PopulateTweenArray(g,e,d));c.set(h,g)}}_GetTween(a,c){return c.GetScheduledOrPlayingTimelineByName(a)}_PopulateTweenArray(a,c,d){if("string"===typeof c){if(c=this._GetTween(c,d))return!!a.push(c)}else return!!a.push(c); return!1}_LoadTweenFromJson(a,c,d){"string"===typeof a?(a=this._GetTween(a,d))&&a._LoadFromJson(c):a._LoadFromJson(c)}_SaveActiveTweensToJson(){const a={};for(const [c,d]of this._activeTweens)a[c]=d.map(e=>e._SaveToJson());return a}_SaveDisabledTweensToJson(){return this._disabledTweens.map(a=>a.GetName())}_SaveWaitingForReleaseTweensToJson(){const a={};for(const [c,d]of this._waitingForReleaseTweens)a[c]=d.map(e=>e._SaveToJson());return a}_SaveFinishingTweenToJson(){return this._finishingTween?this._finishingTween.GetName(): ""}Tick2(){this._ReleaseWaitingTweens()}CreateTween(a){var c=b.Config.GetPropertyTracksConfig(a.property,a.startValue,a.endValue,a.ease,a.resultMode,this.GetObjectInstance());const d=b.Maps.GetPropertyFromIndex(a.property);b.Maps.IsValueId(d)||this.ReleaseTweens(a.property);c=f.TweenState.Build({runtime:this.GetRuntime(),id:d,tags:a.tags,time:a.time,instance:this.GetObjectInstance(),releaseOnComplete:!!a.releaseOnComplete,loop:!!a.loop,pingPong:!!a.pingPong,initialValueMode:a.initialValueMode,propertyTracksConfig:c}); c.AddCompletedCallback(e=>this._FinishTriggers(e));this._AddTween(c,a.property);return c}ReleaseTween(a,c=!1){var d=a.GetId();if(this._activeTweens.has(d)&&(d=this._activeTweens.get(d))){const e=d.indexOf(a);-1!==e&&d.splice(e,1)}a.IsReleased()||this._IsInWaitingList(a)||(a.Stop(c),this._AddToWaitingList(a))}ReleaseTweens(a,c=!1){if(f.IsFiniteNumber(a)){var d=b.Maps.GetPropertyFromIndex(a);if(this._activeTweens.has(d)){d=this._activeTweens.get(d);var e=this.GetFinishingTween();for(var h of d)h=== e||h.IsReleased()||this._IsInWaitingList(h)||(h.Stop(c),h.Release());f.clearArray(d)}}else{h=this.GetFinishingTween();for(d of this.AllTweens())d===h||d.IsReleased()||this._IsInWaitingList(d)||(d.Stop(c),d.Release());for(e of this._activeTweens.keys())f.clearArray(this._activeTweens.get(e)),this._activeTweens.delete(e);this._activeTweens.clear()}}ReleaseAndCompleteTween(a){this.ReleaseTween(a,!0)}ReleaseAndCompleteTweens(){this.ReleaseTweens(NaN,!0)}GetPropertyValueByIndex(a){switch(a){case 0:return this._enabled}}SetPropertyValueByIndex(a, c){switch(a){case 0:this._enabled=!!c}}_GetBehaviorType(a){a=a.GetInstance().GetBehaviorInstances();for(const c of a)if(a=c.GetBehaviorType(),a.GetInstanceSdkCtor()===this.constructor)return a}Trigger(a,c,d,e){return this._runtime?super.Trigger(a):c.Trigger(a,d,e)}_FinishTriggers(a){this._finishingTween=a;b.Cnds.SetFinishingTween(a);let c,d;if(this.GetRuntime())c=this._inst,d=this._runtime,this.Trigger(b.Cnds.OnTweensFinished),this.Trigger(b.Cnds.OnAnyTweensFinished),this.ReleaseTween(a);else{c=a.GetInstance(); if(!c||c&&c.IsDestroyed())return;d=c.GetRuntime();const e=this._GetBehaviorType(a);this.Trigger(b.Cnds.OnTweensFinished,d,c,e);this.Trigger(b.Cnds.OnAnyTweensFinished,d,c,e);a.Stop()}this._finishingTween=null;b.Cnds.SetFinishingTween(null);a.GetDestroyInstanceOnComplete()&&d.DestroyInstance(c)}_AddTween(a,c){c=b.Maps.GetPropertyFromIndex(c);this._activeTweens.has(c)||this._activeTweens.set(c,[]);this._activeTweens.get(c).push(a)}_AddToWaitingList(a){const c=a.GetId();this._waitingForReleaseTweens.has(c)|| this._waitingForReleaseTweens.set(c,[]);this._waitingForReleaseTweens.get(c).push(a)}_IsInWaitingList(a){const c=a.GetId();return this._waitingForReleaseTweens.has(c)?this._waitingForReleaseTweens.get(c).includes(a):!1}_ReleaseWaitingTweens(){if(this._waitingForReleaseTweens.size){for(const a of this._waitingForReleaseTweens.values()){for(const c of a)c.IsReleased()||c.Release();f.clearArray(a)}this._waitingForReleaseTweens.clear()}}}} {"use strict";const f=self.C3;let b=null;f.Behaviors.Tween.Cnds={SetFinishingTween(a){b=a},OnTweensFinished(a){return b.HasTags(a)},OnAnyTweensFinished(){return!0},IsPlaying(a){return(a=[...this.GetTweensIncludingWaitingForRelease(a)],a.length)?a.some(f.TweenState.IsPlaying):!1},IsAnyPlaying(){const a=[...this.AllTweensIncludingWaitingForRelease()];return a&&a.length?a.some(f.TweenState.IsPlaying):!1},IsPaused(a){return(a=[...this.GetTweensIncludingWaitingForRelease(a)],a.length)?a.some(f.TweenState.IsPaused): !1},IsAnyPaused(){const a=[...this.AllTweensIncludingWaitingForRelease()];return a&&a.length?a.some(f.TweenState.IsPaused):!1}}} {"use strict";const f=self.C3,b=self.Ease,a=f.Behaviors.Tween;a.Acts={SetEnabled(c){this.SetEnabled(!!c);for(const d of this.AllTweens())c?this.IsInDisabledList(d)&&d.Resume():((d.IsPlaying()||d.IsScheduled())&&this.AddToDisabledList(d),d.Stop());c&&this.ClearDisabledList()},async TweenOneProperty(...c){this.GetEnabled()&&this.IsInstanceValid()&&(c=this.CreateTween(a.TweenArguments.OneProperty(this,...c)),c.Play()&&await c.GetPlayPromise())},async TweenTwoProperties(...c){this.GetEnabled()&&this.IsInstanceValid()&& (c=this.CreateTween(a.TweenArguments.TwoProperties(this,...c)),c.Play()&&await c.GetPlayPromise())},async TweenValue(...c){this.GetEnabled()&&this.IsInstanceValid()&&(c=this.CreateTween(a.TweenArguments.ValueProperty(this,...c)),c.Play()&&await c.GetPlayPromise())},PauseTweens(c){if(this.GetEnabled()&&this.IsInstanceValid())for(const d of this.GetTweens(c))d.Stop()},PauseAllTweens(){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.AllTweens())c.Stop()},ResumeTweens(c){if(this.GetEnabled()&& this.IsInstanceValid())for(const d of this.GetTweens(c))d.Resume()},ResumeAllTweens(){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.AllTweens())c.Resume()},StopTweens(c){if(this.GetEnabled()&&this.IsInstanceValid())for(const d of this.GetTweens(c))this.ReleaseTween(d)},StopAllTweens(){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.AllTweens())this.ReleaseTween(c)},SetOnePropertyTweensEndValue(c,d,e){if(this.GetEnabled()&&this.IsInstanceValid()){d=f.Behaviors.Tween.Maps.GetSinglePropertyFromIndex(d); for(const h of this.GetTweens(c))h.BeforeSetEndValues([d]),h.SetEndValue(e,d)}},SetTwoPropertiesTweensEndValue(c,d,e,h){if(this.GetEnabled()&&this.IsInstanceValid()){d=f.Behaviors.Tween.Maps.GetRealProperties(d);for(const g of this.GetTweens(c))g.BeforeSetEndValues(d),g.SetEndValue(e,d[0]),g.SetEndValue(h,d[1])}},SetValuePropertyTweensStartValue(c,d){if(this.GetEnabled()&&this.IsInstanceValid())for(const e of this.GetTweens(c,"value"))e.SetStartValue(d,"value")},SetValuePropertyTweensEndValue(c,d){if(this.GetEnabled()&& this.IsInstanceValid())for(const e of this.GetTweens(c,"value"))e.BeforeSetEndValues(["value"]),e.SetEndValue(d,"value")},SetTweensEase(c,d){if(this.GetEnabled()&&this.IsInstanceValid()){d=b.GetEaseFromIndex(d);for(const e of this.GetTweens(c))e.SetEase(d)}},SetAllTweensEase(c){if(this.GetEnabled()&&this.IsInstanceValid()){c=b.GetEaseFromIndex(c);for(const d of this.AllTweens())d.SetEase(c)}},SetTweensTime(c,d){if(this.GetEnabled()&&this.IsInstanceValid())for(const e of this.GetTweens(c))e.SetTime(d)}, SetAllTweensTime(c){if(this.GetEnabled()&&this.IsInstanceValid())for(const d of this.AllTweens())d.SetTime(c)},SetTweensPlaybackRate(c,d){if(this.GetEnabled()&&this.IsInstanceValid())for(const e of this.GetTweens(c))e.SetPlaybackRate(d)},SetAllTweensPlaybackRate(c){if(this.GetEnabled()&&this.IsInstanceValid())for(const d of this.AllTweens())d.SetPlaybackRate(c)},SetTweensDestroyOnComplete(c,d){if(this.GetEnabled()&&this.IsInstanceValid())for(const e of this.GetTweens(c))e.SetDestroyInstanceOnComplete(!!d)}, SetAllTweensDestroyOnComplete(c){if(this.GetEnabled()&&this.IsInstanceValid())for(const d of this.AllTweens())d.SetDestroyInstanceOnComplete(!!c)}}}"use strict"; self.C3.Behaviors.Tween.Exps={Time(f){return(f=this.GetTweenIncludingWaitingForRelease(f))?f.GetTime():0},Progress(f){return(f=this.GetTweenIncludingWaitingForRelease(f))?f.GetTime()/f.GetTotalTime():0},Value(f){return(f=this.GetTweenIncludingWaitingForRelease(f,"value"))?f.GetPropertyTrack("value").GetSourceAdapterValue():0},Tags(){return this.GetFinishingTween()?this.GetFinishingTween().GetStringTags():""}}; {"use strict";const f=self.C3,b=self.Ease,a=["position","size","scale"],c="offsetX offsetY offsetWidth offsetHeight offsetAngle offsetOpacity offsetColor offsetZElevation offsetScaleX offsetScaleY".split(" "),d=["value"],e=[].concat(a).concat(c).concat(d),h={position:["offsetX","offsetY"],size:["offsetWidth","offsetHeight"],scale:["offsetScaleX","offsetScaleY"]},g=Object.assign({},e.reduce((l,m)=>Object.assign({},l,{[m]:[m]}),{}),h);f.Behaviors.Tween.Maps=class{constructor(){}static GetEases(){return[...b.GetRuntimeEaseNames()]}static GetEaseFromIndex(l){return[...b.GetRuntimeEaseNames()][l]}static GetPropertyFromIndex(l){return e[l]}static GetPropertyIndexFromName(l){return e.indexOf(l)}static GetPairPropertyFromIndex(l){return a[l]}static GetSinglePropertyFromIndex(l){return c[l]}static GetValuePropertyFromIndex(l){return d[l]}static GetPairProperties(l){return h[l]}static GetRealProperties(l){return f.IsString(l)? g[l]:g[e[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 f=self.C3,b=f.Behaviors.Tween,a=new Map;b.Config=class{constructor(){}static GetPropertyTracksConfig(c,d,e,h,g,l){0===a.size&&this._CreateConfigObjects();var m=b.PropertyTypes.Pick(c);m=a.get(m);f.IsFiniteNumber(c)&&(c=b.Maps.GetPropertyFromIndex(c));return this._GetConfig(m,c,d,e,h,g,l)}static TransformValue(c,d){return f.Behaviors.Tween.GetPropertyTracksConfig(c).valueGetter(d)}static _CreateConfigObjects(){const c=b.PropertyTypes,d=b.ValueGetters;this._AddConfigObject(c.PAIR, this._GetPairConfig,d._GetPropertyValue);this._AddConfigObject(c.COLOR,this._GetColorConfig,d._GetColorPropertyValue);this._AddConfigObject(c.ANGLE,this._GetAngleConfig,d._GetPropertyAngleValue);this._AddConfigObject(c.VALUE,this._GetValueConfig,d._GetPropertyValue);this._AddConfigObject(c.OTHER,this._GetCommonConfig,d._GetPropertyValue)}static _AddConfigObject(c,d,e){a.set(c,this._CreateConfigObject(c,d,e))}static _CreateConfigObject(c,d,e){return{name:c,configFunc:d,valueGetter:e}}static _GetConfig(c, d,e,h,g,l,m){return c.configFunc(d,c.valueGetter(e),c.valueGetter(h),g,l,m)}static _GetPairConfig(c,d,e,h,g,l){return b.Maps.GetPairProperties(c).map((m,u)=>({sourceId:"world-instance",property:m,type:"float",valueType:"numeric",startValue:d[u],endValue:e[u],ease:b.Maps.GetEaseFromIndex(h),resultMode:g}))}static _GetColorConfig(c,d,e,h,g,l){return f.Plugins.Text&&l.GetPlugin()instanceof f.Plugins.Text?{sourceId:"plugin",sourceArgs:[7],property:"color",type:"color",valueType:"color",startValue:d,endValue:e, ease:b.Maps.GetEaseFromIndex(h),resultMode:g}:{sourceId:"world-instance",property:c,type:"color",valueType:"color",startValue:d,endValue:e,ease:b.Maps.GetEaseFromIndex(h),resultMode:g}}static _GetAngleConfig(c,d,e,h,g,l){return{sourceId:"world-instance",property:c,type:"angle",valueType:"angle",startValue:d,endValue:e,ease:b.Maps.GetEaseFromIndex(h),resultMode:g}}static _GetCommonConfig(c,d,e,h,g,l){return{sourceId:"world-instance",property:c,type:"float",valueType:"numeric",startValue:d,endValue:e, ease:b.Maps.GetEaseFromIndex(h),resultMode:g}}static _GetValueConfig(c,d,e,h,g,l){return{sourceId:"value",property:c,type:"float",valueType:"numeric",startValue:d,endValue:e,ease:b.Maps.GetEaseFromIndex(h),resultMode:g}}}} {"use strict";const f=self.C3,b=f.Behaviors.Tween,a=Object.assign({},{resultMode:"absolute"},{tags:"",property:"",time:0,ease:0,releaseOnComplete:0,loop:!1,pingPong:!1}),c=Object.assign({},a,{initialValueMode:"current-state",startValue:0,endValue:0}),d=Object.assign({},a,{initialValueMode:"current-state",startValue:[0,0],endValue:[0,0]}),e=Object.assign({},a,{initialValueMode:"current-state",startValue:[0,0,0],endValue:[0,0,0]}),h=Object.assign({},c,{initialValueMode:"start-value"});b.TweenArguments= class{constructor(){}static _SetCommonProperties(g,l,m,u,w,q,t){g.tags=l;g.time=m;g.ease=u;g.releaseOnComplete=w;g.loop=q;g.pingPong=t}static OneProperty(g,l,m,u,w,q,t,p,r){g=b.Maps.GetSinglePropertyFromIndex(m);m=b.Maps.IsColorId(g)?e:c;this._SetCommonProperties(m,l,w,q,t,p,r);b.Maps.IsColorId(g)?(e.endValue[0]=f.GetRValue(u),e.endValue[1]=f.GetGValue(u),e.endValue[2]=f.GetBValue(u),e.property=b.Maps.GetPropertyIndexFromName(g)):b.Maps.IsOpacityId(g)?c.endValue=u/100:c.endValue=u;m.property=b.Maps.GetPropertyIndexFromName(g); return m}static TwoProperties(g,l,m,u,w,q,t,p,r,x){this._SetCommonProperties(d,l,q,t,p,r,x);g=b.Maps.GetPairPropertyFromIndex(m);d.endValue[0]=u;d.endValue[1]=w;d.property=b.Maps.GetPropertyIndexFromName(g);return d}static ValueProperty(g,l,m,u,w,q,t,p,r){this._SetCommonProperties(h,l,w,q,t,p,r);h.startValue=m;h.endValue=u;h.property=b.Maps.GetPropertyIndexFromName("value");return h}}} {"use strict";const f=self.C3,b=f.Behaviors.Tween,a=[];b.PropertyTypes=class{constructor(){}static Pick(c){0===a.length&&(a.push({checkFunc:b.Maps.IsPairId,result:this.PAIR}),a.push({checkFunc:b.Maps.IsColorId,result:this.COLOR}),a.push({checkFunc:b.Maps.IsAngleId,result:this.ANGLE}),a.push({checkFunc:b.Maps.IsValueId,result:this.VALUE}),a.push({checkFunc:()=>!0,result:this.OTHER}));f.IsFiniteNumber(c)&&(c=f.Behaviors.Tween.Maps.GetPropertyFromIndex(c));for(const d of a)if(d.checkFunc(c))return d.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 f=self.C3;f.Behaviors.Tween.ValueGetters=class{constructor(){}static _GetPropertyAngleValue(b){b=f.toRadians(parseFloat(b));return f.clampAngle(b)}static _GetColorPropertyValue(b){return b.slice(0)}static _GetPropertyValue(b){return b}}} {const f=self.C3;self.C3_GetObjectRefTable=function(){return[f.Plugins.Keyboard,f.Plugins.Touch,f.Plugins.Audio,f.Plugins.Dictionary,f.Plugins.LocalStorage,f.Plugins.Browser,f.Plugins.gamepad,f.Plugins.Mouse,f.Plugins.Function,f.Plugins.Sprite,f.Behaviors.scrollto,f.Behaviors.Sin,f.Behaviors.Fade,f.Behaviors.Pin,f.Plugins.TiledBg,f.Plugins.Text,f.Plugins.NinePatch,f.Behaviors.Persist,f.Plugins.Particles,f.Plugins.Arr,f.Behaviors.Bullet,f.Behaviors.Rotate,f.Behaviors.Timer,f.Behaviors.Tween,f.Plugins.System.Cnds.OnLayoutStart, f.Plugins.Browser.Acts.LoadStyleSheet,f.Plugins.System.Cnds.IsGroupActive,f.Plugins.System.Cnds.Compare,f.Plugins.System.Exps.loadingprogress,f.Plugins.System.Cnds.CompareBoolVar,f.Plugins.System.Cnds.TriggerOnce,f.Plugins.System.Acts.Signal,f.Plugins.System.Acts.MapFunction,f.Plugins.System.Acts.SetBoolVar,f.Plugins.System.Acts.WaitForSignal,f.Plugins.System.Acts.Wait,f.Plugins.System.Acts.GoToLayout,f.Plugins.System.Cnds.EveryTick,f.Plugins.TiledBg.Acts.SetWidth,f.Plugins.System.Exps.layoutwidth, f.Plugins.System.Acts.SetTimescale,f.Plugins.System.Exps.timescale,f.Plugins.System.Exps.dt,f.Plugins.LocalStorage.Acts.CheckItemExists,f.Plugins.LocalStorage.Cnds.OnItemExists,f.Plugins.LocalStorage.Acts.GetItem,f.Plugins.LocalStorage.Cnds.OnItemGet,f.Plugins.System.Acts.SetVar,f.Plugins.LocalStorage.Exps.ItemValue,f.Plugins.Browser.Acts.ConsoleLog,f.Plugins.System.Acts.CallMappedFunction,f.Plugins.System.Acts.SetLayoutScale,f.Plugins.Sprite.Acts.SetPos,f.Plugins.System.Exps.layoutheight,f.Plugins.System.Acts.SetLayerScale, f.Plugins.System.Exps.layoutname,f.Plugins.TiledBg.Acts.SetImageOffsetX,f.Plugins.System.Exps.int,f.Plugins.TiledBg.Acts.SetImageOffsetY,f.Plugins.TiledBg.Exps.ImageScaleY,f.Plugins.System.Cnds.CompareVar,f.Plugins.TiledBg.Acts.SetVisible,f.Plugins.Arr.Acts.Clear,f.Plugins.Arr.Acts.SetSize,f.Plugins.System.Acts.SetLayerVisible,f.Plugins.Sprite.Acts.SetSize,f.Plugins.Sprite.Acts.SetBoolInstanceVar,f.Plugins.System.Acts.CreateObject,f.Plugins.System.Cnds.OnLayoutEnd,f.Plugins.Audio.Acts.PlayByName, f.Plugins.System.Exps.choose,f.Plugins.Sprite.Acts.SetInstanceVar,f.Plugins.Sprite.Acts.SetEffectParam,f.Plugins.System.Exps.layoutscale,f.Plugins.Sprite.Cnds.IsBoolInstanceVarSet,f.Plugins.Sprite.Cnds.CompareWidth,f.Plugins.Sprite.Acts.SetWidth,f.Plugins.Sprite.Exps.Width,f.Plugins.Sprite.Acts.SetHeight,f.Plugins.System.Cnds.Else,f.Plugins.Function.Cnds.OnFunction,f.Plugins.Sprite.Exps.ImagePointX,f.Plugins.Sprite.Exps.ImagePointY,f.Plugins.Sprite.Cnds.OnCreated,f.Behaviors.Sin.Acts.SetMovement, f.Behaviors.Sin.Acts.SetMagnitude,f.Behaviors.Sin.Acts.SetPeriod,f.Behaviors.Sin.Acts.SetEnabled,f.Plugins.Sprite.Acts.SetMirrored,f.Plugins.Sprite.Acts.MoveToBottom,f.Plugins.Sprite.Acts.ZMoveToObject,f.Plugins.Sprite.Cnds.IsAnimPlaying,f.Plugins.Sprite.Acts.SetAngle,f.Plugins.Sprite.Acts.SetAnimFrame,f.Behaviors.Sin.Exps.Period,f.Behaviors.Sin.Acts.SetPhase,f.Behaviors.Sin.Exps.CyclePosition,f.Plugins.Arr.Exps.At,f.Plugins.Arr.Exps.IndexOf,f.Plugins.Sprite.Exps.AnimationFrame,f.Plugins.Sprite.Exps.AnimationFrameCount, f.Plugins.System.Cnds.ForEach,f.Plugins.Sprite.Cnds.CompareInstanceVar,f.Plugins.Sprite.Acts.MoveToLayer,f.Plugins.NinePatch.Acts.SetPos,f.Plugins.NinePatch.Acts.ZMoveToObject,f.Plugins.Text.Acts.SetPos,f.Plugins.NinePatch.Acts.ToggleBoolInstanceVar,f.Plugins.Text.Acts.SetBoolInstanceVar,f.Plugins.Sprite.Acts.SetVisible,f.Plugins.System.Acts.SetGroupActive,f.Plugins.Sprite.Acts.Destroy,f.Plugins.System.Cnds.For,f.Plugins.System.Exps.random,f.Plugins.Sprite.Acts.SetOpacity,f.Behaviors.Bullet.Acts.SetSpeed, f.Behaviors.Bullet.Acts.SetAcceleration,f.Plugins.Sprite.Exps.Opacity,f.Plugins.Sprite.Acts.SetScale,f.Plugins.Sprite.Cnds.IsOutsideLayout,f.Plugins.Touch.Cnds.OnTouchObject,f.Plugins.Sprite.Cnds.IsVisible,f.Plugins.Keyboard.Cnds.OnKey,f.Plugins.System.Acts.ToggleBoolVar,f.Plugins.Audio.Acts.SetSilent,f.Plugins.System.Acts.SetObjectTimescale,f.Behaviors.Timer.Acts.StartTimer,f.Plugins.System.Exps.float,f.Plugins.System.Exps.tokenat,f.Plugins.Dictionary.Exps.Get,f.Plugins.Function.Exps.Param,f.Plugins.Audio.Acts.Seek, f.Plugins.Audio.Acts.Stop,f.Behaviors.Timer.Cnds.OnTimer,f.Plugins.Sprite.Cnds.CompareFrame,f.Plugins.Function.Acts.CallFunction,f.Plugins.System.Exps.tokencount,f.Plugins.Mouse.Cnds.IsOverObject,f.Plugins.Mouse.Acts.SetCursor,f.Plugins.System.Cnds.IsPreview,f.Plugins.System.Acts.AddVar,f.Plugins.Browser.Cnds.IsFullscreen,f.Plugins.Browser.Acts.RequestFullScreen,f.Plugins.Browser.Acts.CancelFullScreen,f.Plugins.Browser.Acts.Focus,f.Plugins.Audio.Acts.SetMasterVolume,f.Plugins.Audio.Cnds.IsTagPlaying, f.Plugins.System.Exps.time,f.Plugins.Arr.Acts.Push,f.Plugins.Text.Acts.SetText,f.Plugins.Text.Exps.Text,f.Plugins.Arr.Exps.Width,f.Plugins.Text.Cnds.CompareText,f.Plugins.Dictionary.Cnds.IsEmpty,f.Plugins.Dictionary.Acts.AddKey,f.Plugins.Sprite.Exps.ImageWidth,f.Plugins.Sprite.Exps.ImageHeight,f.Behaviors.Sin.Acts.UpdateInitialState,f.Plugins.Sprite.Exps.Angle,f.Plugins.System.Cnds.PickAll,f.Plugins.System.Cnds.Every,f.Plugins.Sprite.Acts.ToggleBoolInstanceVar,f.Plugins.Sprite.Exps.Height,f.Plugins.System.Acts.SetLayerEffectEnabled, f.Plugins.Sprite.Acts.SetAnimSpeed,f.Plugins.Sprite.Acts.MoveToTop,f.Plugins.System.Cnds.IsMobile,f.Plugins.Text.Cnds.IsBoolInstanceVarSet,f.Plugins.Text.Acts.SetVisible,f.Plugins.Sprite.Acts.SetAnim,f.Behaviors.Fade.Acts.StartFade,f.Plugins.Particles.Acts.Destroy,f.Plugins.System.Acts.SetLayerAngle,f.Plugins.System.Exps.anglelerp,f.Plugins.System.Exps.layerangle,f.Plugins.Touch.Cnds.IsTouchingObject,f.Plugins.Keyboard.Cnds.IsKeyDown,f.Plugins.gamepad.Cnds.IsButtonDown,f.Plugins.NinePatch.Acts.SetWidth, f.Plugins.System.Exps.max,f.Plugins.NinePatch.Acts.SetInstanceVar,f.Plugins.NinePatch.Acts.SetEffectParam,f.Plugins.NinePatch.Acts.SetX,f.Plugins.NinePatch.Exps.Width,f.Plugins.System.Acts.SubVar,f.Plugins.NinePatch.Cnds.IsBoolInstanceVarSet,f.Plugins.System.Cnds.Repeat,f.Behaviors.Bullet.Acts.SetAngleOfMotion,f.Behaviors.Rotate.Acts.SetSpeed,f.Plugins.System.Exps.loopindex,f.Plugins.Sprite.Acts.Spawn,f.Plugins.Sprite.Exps.LayerName,f.Plugins.LocalStorage.Acts.SetItem,f.Plugins.System.Acts.RestartLayout, f.Plugins.Sprite.Acts.SetEffect,f.Behaviors.scrollto.Acts.Shake,f.Plugins.Browser.Acts.Vibrate,f.Plugins.System.Acts.GoToLayoutByName,f.Plugins.System.Cnds.ForEachOrdered,f.Plugins.Sprite.Exps.Y,f.Behaviors.Fade.Acts.RestartFade,f.Behaviors.Tween.Acts.TweenOneProperty,f.Plugins.Sprite.Exps.Count,f.Plugins.Browser.Exps.ExecJS,f.Plugins.Browser.Acts.ExecJs,f.ScriptsInEvents._poki_Event3_Act2,f.ScriptsInEvents._poki_Event4_Act2,f.ScriptsInEvents._poki_Event5_Act2,f.ScriptsInEvents._poki_Event6_Act2, f.ScriptsInEvents._poki_Event7_Act2,f.ScriptsInEvents._poki_Event8_Act2,f.ScriptsInEvents._poki_Event9_Act2,f.Plugins.Text.Cnds.CompareInstanceVar,f.ScriptsInEvents._pokicontroller_Event4_Act1,f.ScriptsInEvents._pokicontroller_Event6_Act1,f.ScriptsInEvents._pokicontroller_Event7_Act1,f.ScriptsInEvents._pokicontroller_Event8_Act1,f.ScriptsInEvents._pokicontroller_Event13_Act1,f.ScriptsInEvents._pokicontroller_Event14_Act1,f.ScriptsInEvents._pokicontroller_Event15_Act1,f.ScriptsInEvents._pokicontroller_Event16_Act1, f.ScriptsInEvents._pokicontroller_Event17_Act1,f.ScriptsInEvents._pokicontroller_Event18_Act1,f.ScriptsInEvents._pokicontroller_Event19_Act1,f.ScriptsInEvents._pokicontroller_Event20_Act1,f.ScriptsInEvents._pokicontroller_Event25_Act1,f.Plugins.System.Exps.zeropad,f.Plugins.Sprite.Acts.SetY,f.Plugins.Sprite.Acts.SetX,f.Plugins.Sprite.Exps.X,f.Plugins.Sprite.Acts.SetPosToObject,f.Behaviors.Pin.Acts.PinByProperties,f.Plugins.Sprite.Acts.SetDefaultColor]};self.C3_JsPropNameTable=[{Keyboard:0},{Touch:0}, {Audio:0},{Dictionary:0},{LocalStorage:0},{Browser:0},{Gamepad:0},{Mouse:0},{Function:0},{ScrollTo:0},{sineVertical:0},{sineHorizontal:0},{sineAngle:0},{sineScale:0},{camera:0},{Fade:0},{flash:0},{brillo:0},{ui_assets:0},{LogoCintaAnimada:0},{playerIsLeft:0},{Sine:0},{angulo:0},{Pin:0},{skins:0},{fondoLogoPelea:0},{sineHeight:0},{sineWidth:0},{manos:0},{AI_cable:0},{side:0},{hitFlag:0},{input:0},{special_id:0},{thumb:0},{UI_gradienteBlanco:0},{grow:0},{UI_Rounds:0},{boca:0},{ojos:0},{loadBar:0},{UI_gradienteBlancoHorizontal:0}, {logoGlow:0},{isLeft:0},{healthHud:0},{debug:0},{fullWidth:0},{staminaBar:0},{left:0},{buttonName:0},{enabled:0},{startWidth:0},{startHeight:0},{ignore:0},{UI_buttons:0},{hitFX:0},{UI_HealthBarFrame:0},{flash2:0},{healthBar:0},{healthRecoil:0},{healthShadow:0},{playerName:0},{bgOverlay:0},{Persist:0},{round2:0},{round1:0},{barBroken:0},{bt_pause:0},{fade:0},{wait:0},{transitionMask:0},{Particles:0},{id:0},{text:0},{leftOk:0},{rightOK:0},{leftAI:0},{rightAI:0},{ready:0},{Sprite:0},{Array:0},{Backgrounds:0}, {scale:0},{Bullet:0},{speedlines:0},{Opciones:0},{Sprite2:0},{outerFrame:0},{Rotate:0},{match_star:0},{tutorial:0},{pin:0},{hilo:0},{hilo_shadow:0},{mapNames:0},{Dictionary2:0},{tag:0},{Timer:0},{audioplayer:0},{TiledBackground:0},{hitCount:0},{Sine2:0},{Sine3:0},{Sine4:0},{star:0},{startX:0},{startY:0},{Tween:0},{win_pop_up:0},{confetti:0},{circleMask:0},{circle:0},{circleLine:0},{player:0},{bars:0},{topHud:0},{sl:0},{poki_init_resolved:0},{wait_load_time:0},{Mute:0},{adBlock:0},{unlockedCount:0}, {skinsNames:0},{isRandom:0},{skinsHands:0},{introFadingOut:0},{FirstTime:0},{temp:0},{interval:0},{LeftAI:0},{RightAI:0},{Background:0},{background_w:0},{background_h:0},{background_index:0},{tempI:0},{fightState:0},{staminaLeft:0},{staminaRight:0},{healthLeft:0},{healthRight:0},{attackStrenght:0},{staminaRate:0},{winsLeft:0},{winsRight:0},{skinLeftI:0},{skinRightI:0},{skinLeft:0},{skinRight:0},{colorLeft:0},{colorRight:0},{GAfightCount:0},{touchleft:0},{touchright:0},{isPlayingCommercialBreak:0}, {AdBlock2:0},{POKI_Initialized:0},{POKI_ON_FinishedLoading:0},{POKI_ON_adBlock:0},{POKI_ON_CommercialBreakEnd:0},{POKI_ON_Rewarded_Success:0},{POKI_ON_Rewarded_Fail:0},{value:0},{gallerymarginLeft:0},{gallerymarginTop:0},{galleryThumbsPerRow:0},{galleryThumbMargin:0},{galleryOrder:0},{index:0}]} {const f=self.C3;function b(e,h){return"number"===typeof e&&"number"===typeof h}function a(e,h){return b(e,h)?e+h:e}function c(e,h){return b(e,h)?e%h:e}function d(e,h){return"string"===typeof e||"string"===typeof h?("number"===typeof e?(Math.round(1E10*e)/1E10).toString():e)+("number"===typeof h?(Math.round(1E10*h)/1E10).toString():h):e&&h?1:0}self.C3_ExpressionFuncs=[()=>"safari_fix.css",()=>"Load",e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h()},()=>1,()=>"loadercomplete",()=>"",e=>{const h= e._GetNode(0).GetVar();return()=>h.GetValue()},()=>"PokiLandia",e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetBoundMethod();return()=>(h()+150)*g()},e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetBoundMethod();return()=>f.lerp(h(),1,10*g())},()=>"uc",()=>"commercial break end",()=>"on_CommercialBreakEnd",()=>0,()=>2,e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h()/2},()=>"background_scale",()=>1.11,()=>"gallery",e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetVar(), l=e._GetNode(2).GetVar();return()=>-(h(g.GetValue()/3)*l.GetValue())},e=>{const h=e._GetNode(0).GetVar(),g=e._GetNode(1).GetVar(),l=e._GetNode(2);return()=>-(h.GetValue()%3*g.GetValue())*(l.ExpObject()/100)},()=>"Random",()=>"sprites",()=>"transition",()=>"UI",()=>"intro",()=>"loader",()=>"creditos",e=>{const h=e._GetNode(0).GetBoundMethod();return()=>d("sfx_transition",h(1,2,3))},()=>-5,()=>"sfx_transition",e=>{const h=e._GetNode(0),g=e._GetNode(1).GetBoundMethod();return()=>f.lerp(h.ExpInstVar(), 100,3*g())},()=>"Brightness",e=>{const h=e._GetNode(0);return()=>h.ExpInstVar()},e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetBoundMethod();return()=>f.lerp(h(),1,5*g())},()=>1400,e=>{const h=e._GetNode(0),g=e._GetNode(1).GetBoundMethod();return()=>h.ExpObject()+5E3*g()},e=>{const h=e._GetNode(0);return()=>h.ExpObject()},()=>"makeFace",e=>{const h=e._GetNode(0);return()=>h.ExpObject("ojos")},e=>{const h=e._GetNode(0);return()=>h.ExpObject("boca")},()=>"fight",()=>6,()=>16,()=>"Animation", e=>{const h=e._GetNode(0);return()=>h.ExpObject("cable")},()=>"idle",()=>"attack",()=>120,()=>-120,()=>"grid",e=>{const h=e._GetNode(0);return()=>h.ExpBehavior()},e=>{const h=e._GetNode(0),g=e._GetNode(1),l=e._GetNode(2).GetVar();return()=>h.ExpObject(g.ExpObject(l.GetValue()),1)},e=>{const h=e._GetNode(0),g=e._GetNode(1),l=e._GetNode(2).GetVar(),m=e._GetNode(3);return()=>c(a(h.ExpObject(g.ExpObject(l.GetValue()),1),1),m.ExpObject())},()=>100,e=>{const h=e._GetNode(0),g=e._GetNode(1).GetBoundMethod(); return()=>f.lerp(h.ExpInstVar_Family(),100,2.5*g())},e=>{const h=e._GetNode(0),g=e._GetNode(1).GetBoundMethod();return()=>f.lerp(h.ExpInstVar_Family(),100,20*g())},()=>"map",e=>{const h=e._GetNode(0);return()=>h.ExpInstVar_Family()},e=>{const h=e._GetNode(0);return()=>h.ExpObject("health")},e=>{const h=e._GetNode(0);return()=>h.ExpObject("stamina")},e=>{const h=e._GetNode(0);return()=>h.ExpObject("name")},e=>{const h=e._GetNode(0);return()=>h.ExpObject("round1")},e=>{const h=e._GetNode(0);return()=> h.ExpObject("round2")},e=>{const h=e._GetNode(0);return()=>h.ExpObject("brokenBar")},()=>"mainMenu",()=>"selectionMenu",()=>"speedlines",()=>"radialFX",()=>4,()=>"background",e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(0,-180)},()=>200,()=>1E4,e=>{const h=e._GetNode(0),g=e._GetNode(1).GetBoundMethod();return()=>f.lerp(h.ExpObject(),100,3*g())},e=>{const h=e._GetNode(0),g=e._GetNode(1).GetBoundMethod();return()=>f.lerp(h.ExpInstVar(),1,10*g())},e=>{const h=e._GetNode(0).GetBoundMethod(); return()=>h(-240,90)},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(200,600)},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(2E4,4E4)},()=>"sfx_button_bloop2",()=>"bloop",()=>"credits",()=>"playVoice",e=>{const h=e._GetNode(0).GetBoundMethod();return()=>100+h(50)},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>d("tag_",h(0,1E3))},e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetBoundMethod(),l=e._GetNode(2),m=e._GetNode(3).GetBoundMethod();return()=>h(g(l.ExpObject(m(0)), 1,","))},()=>"endSound",()=>"voices",e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetBoundMethod(),l=e._GetNode(2),m=e._GetNode(3).GetBoundMethod();return()=>h(g(l.ExpObject(m(0)),0,","))},()=>"prize",()=>"POKI_RewardedlBreak",e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetVar();return()=>h(g.GetValue(),",")},()=>"POKI_on_Rewarded_Succes",()=>"POKI_on_Rewarded_Fail",()=>"coin",()=>300,()=>.1,()=>-8,()=>.3,()=>"jingle",()=>.5,e=>{const h=e._GetNode(0).GetBoundMethod(), g=e._GetNode(1).GetBoundMethod();return()=>f.lerp(h(),1.2,.3*g())},()=>500,()=>.4,e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetVar();return()=>Math.floor(h(g.GetValue()))},()=>"v_thumb_fighter",()=>"v_welcome",()=>"m_loop",()=>"loop2",()=>"loop3",()=>"loop1",()=>-10,()=>"m_christmas",()=>"logo",e=>{const h=e._GetNode(0).GetBoundMethod();return()=>1+Math.sin(f.toRadians(300*h()))/100},()=>"P1 vs P2",()=>"P1 vs CPU",()=>"Credits",e=>{const h=e._GetNode(0);return()=>h.ExpObject(0)}, ()=>"arrowLeftItalic",()=>"previous",e=>{const h=e._GetNode(0),g=e._GetNode(1);return()=>h.ExpObject(g.ExpObject())-1},e=>{const h=e._GetNode(0).GetVar(),g=e._GetNode(1),l=e._GetNode(2).GetVar();return()=>-1===h.GetValue()?g.ExpObject()-1:l.GetValue()},e=>{const h=e._GetNode(0),g=e._GetNode(1).GetVar();return()=>h.ExpObject(g.GetValue())},()=>"arrowRightItalic",()=>"next",e=>{const h=e._GetNode(0),g=e._GetNode(1),l=e._GetNode(2),m=e._GetNode(3);return()=>h.ExpObject((g.ExpObject(l.ExpObject())+1)% m.ExpObject())},()=>"POKI_CommercialBreak",()=>"POKI_on_CommercialBreakEnd",()=>"bigButton",()=>"mute",e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetVar();return()=>h(g.GetValue())},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>d("sfx_auch",h(1,2))},()=>"auch",()=>.2,()=>"0,3.946326",()=>"3.546326,2.080204",()=>"v_round1",()=>"6.02653,1.293107",()=>"v_round2",()=>"7.319637,1.601996",()=>"v_fight",()=>"8.921633,0.881904",()=>"v_finalRound",()=>"9.803537,1.110043",()=>"v_KO", ()=>"10.91358,1.36701",()=>"v_banter_1",()=>"12.28059,1.01165",()=>"v_banter_2",()=>"13.29224,2.02665",()=>"v_banter_3",()=>"15.31889,3.92496",()=>"v_banter_4",()=>"19.24385,1.48692",()=>"v_banter_5",()=>"20.73077,2.48045",()=>"v_banter_6",()=>"23.21122,0.96132",()=>"v_banter_7",()=>"24.17254,1.12136",()=>"v_banter_8",()=>"25.2939,1.71669",()=>"v_banter_9",()=>"27.01059,0.01531",()=>"v_banter_10",()=>"27.0259,1.23516",()=>"v_banter_11",()=>"28.26106,3.11096",()=>"v_banter_12",()=>"31.37202,1.0344", ()=>"v_banter_13",()=>"32.40642,1.06612",()=>"v_banter_14",()=>"33.47254,1.82231",()=>"v_banter_15",()=>"35.29485,1.31715",e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetBoundMethod(),l=e._GetNode(2).GetVar(),m=e._GetNode(3);return()=>h(g(l.GetValue(),m.ExpObject(),","))},e=>{const h=e._GetNode(0);return()=>1.24*-h.ExpObject()},e=>{const h=e._GetNode(0);return()=>1.24*h.ExpObject()},()=>"m_loop2",()=>"mode",e=>{const h=e._GetNode(0);return()=>h.ExpObject()+2},e=>{const h=e._GetNode(0); return()=>h.ExpObject()-2},()=>"Sky",()=>"New York",()=>"Sahara",()=>"Room",()=>"Jakarta",()=>"San Francisco",()=>"Moscu",()=>"Hawaii",()=>"Castle",()=>"Underwater",()=>"Yucatan",()=>"S\u00e3o Paulo",e=>{const h=e._GetNode(0),g=e._GetNode(1),l=e._GetNode(2).GetVar(),m=e._GetNode(3);return()=>h.ExpObject(g.ExpObject(l.GetValue())%m.ExpObject())},()=>-1,()=>"background_selection",e=>{const h=e._GetNode(0),g=e._GetNode(1),l=e._GetNode(2).GetVar(),m=e._GetNode(3);return()=>h.ExpObject((g.ExpObject(l.GetValue())+ 1)%m.ExpObject())},e=>{const h=e._GetNode(0),g=e._GetNode(1).GetVar(),l=e._GetNode(2);return()=>(h.ExpObject(g.GetValue())-1)%l.ExpObject()},()=>"mode2",e=>{const h=e._GetNode(0).GetVar(),g=e._GetNode(1).GetVar();return()=>(h.GetValue()+1)%g.GetValue()},()=>"left",()=>"right",()=>"center",e=>{const h=e._GetNode(0);return()=>(h.ExpObject()+1)%2},()=>"sfx_character_selected",()=>"selected",e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(2,3,5)},e=>{const h=e._GetNode(0).GetBoundMethod();return()=> h(3,4,5)},()=>1E3,()=>"random",()=>"home",e=>{const h=e._GetNode(0),g=e._GetNode(1),l=e._GetNode(2).GetBoundMethod();return()=>f.lerp(h.ExpObject(),g.ExpInstVar(),20*l())},e=>{const h=e._GetNode(0),g=e._GetNode(1).GetBoundMethod();return()=>f.lerp(h.ExpObject(),0,20*g())},()=>"prevLeft",e=>{const h=e._GetNode(0).GetVar();return()=>h.GetValue()-1},e=>{const h=e._GetNode(0).GetVar(),g=e._GetNode(1).GetVar(),l=e._GetNode(2).GetVar();return()=>-1===h.GetValue()?g.GetValue()-1:l.GetValue()},()=>"nextLeft", ()=>"prevRight",()=>"nextRight",e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1);return()=>Math.floor(h(g.ExpObject()-1)+1)},()=>"Default",()=>8,()=>"POKI_GameplayStart",()=>"Grayscale",()=>-300,e=>{const h=e._GetNode(0).GetVar(),g=e._GetNode(1).GetVar();return()=>h.GetValue()+g.GetValue()},e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetVar(),l=e._GetNode(2).GetVar();return()=>h(g.GetValue(),l.GetValue(),",")},()=>"m_loop3",()=>1.5,()=>"sfx_gong",()=>"gong",()=>"Signs",e=> {const h=e._GetNode(0),g=e._GetNode(1).GetBoundMethod(),l=e._GetNode(2);return()=>h.ExpObject(Math.floor(g(l.ExpObject())))},e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetBoundMethod(),l=e._GetNode(2).GetBoundMethod();return()=>h(g("background"),0,5*l())},e=>{const h=e._GetNode(0);return()=>h.ExpObject()/100},()=>"outro",e=>{const h=e._GetNode(0).GetVar(),g=e._GetNode(1).GetBoundMethod();return()=>f.lerp(h.GetValue(),2,5*g())},()=>"attackingLeft",()=>"attackingRight",()=>"hittingLeft", ()=>"sfx_auch2",()=>"auch2",()=>"hittingRight",()=>"sfx_auch1",()=>"auch1",e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(.2,1.8)},e=>{const h=e._GetNode(0),g=e._GetNode(1),l=e._GetNode(2).GetVar(),m=e._GetNode(3).GetBoundMethod();return()=>f.lerp(h.ExpObject(),g.ExpObject()/100*l.GetValue(),20*m())},e=>{const h=e._GetNode(0),g=e._GetNode(1),l=e._GetNode(2).GetVar(),m=e._GetNode(3).GetBoundMethod();return()=>f.lerp(h.ExpObject(),g.ExpObject()/100*l.GetValue(),2*m())},e=>{const h=e._GetNode(0).GetBoundMethod(), g=e._GetNode(1),l=e._GetNode(2).GetVar();return()=>h(15,g.ExpInstVar()/100*l.GetValue())},e=>{const h=e._GetNode(0),g=e._GetNode(1).GetBoundMethod();return()=>f.lerp(h.ExpInstVar(),100,15*g())},e=>{const h=e._GetNode(0),g=e._GetNode(1).GetBoundMethod();return()=>f.lerp(h.ExpInstVar(),100,10*g())},e=>{const h=e._GetNode(0),g=e._GetNode(1),l=e._GetNode(2).GetVar(),m=e._GetNode(3).GetBoundMethod();return()=>f.lerp(h.ExpObject(),g.ExpObject()/100*-l.GetValue(),20*m())},e=>{const h=e._GetNode(0),g=e._GetNode(1), l=e._GetNode(2).GetVar(),m=e._GetNode(3).GetBoundMethod();return()=>f.lerp(h.ExpObject(),g.ExpObject()/100*-l.GetValue(),2*m())},e=>{const h=e._GetNode(0),g=e._GetNode(1);return()=>h.ExpObject("stamina")+g.ExpObject()},()=>3,()=>"sfx_leftAttack",()=>"leftAttack",()=>"sfx_rightAttack",()=>"rightAttack",()=>"fightHit",e=>{const h=e._GetNode(0),g=e._GetNode(1).GetBoundMethod();return()=>f.lerp(h.ExpObject(),333,1*g())},e=>{const h=e._GetNode(0),g=e._GetNode(1),l=e._GetNode(2).GetBoundMethod();return()=> f.lerp(h.ExpObject(),g.ExpObject()/100*0,30*l())},()=>"rightWins",()=>"winPopUp",()=>170,()=>20,e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetBoundMethod();return()=>h()/2+g(-50,50)},e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetBoundMethod();return()=>h()+g(100)},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(60)+60-180},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(800,1200)},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h("r","g","b")},e=> {const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1);return()=>h(g.ExpObject())},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(-60,60)},()=>5,()=>455,()=>240,e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h()/5+.25},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h()/5},()=>"leftWins",()=>800,()=>"POKI_HappyTime",()=>"broken2",()=>"POKI_GameplayStop",()=>2.5,()=>"quitFight",e=>{const h=e._GetNode(0).GetBoundMethod();return()=>.7*h()},()=>"ending",()=>"sfx_fight_end",()=>"fight_end", ()=>.001,()=>1.2,e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(8,9,10)},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(2,3)},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(0,2,3)},e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetBoundMethod();return()=>f.lerp(h(),1,1.5*g())},()=>50,()=>"100",e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(-5,5)},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>d("sfx_",h("hit1","hit2"))},()=>"hit",()=>115,e=>{const h= e._GetNode(0);return()=>1.14*h.ExpObject()},()=>-3,e=>{const h=e._GetNode(0);return()=>1.38*-h.ExpObject()},()=>-130,e=>{const h=e._GetNode(0);return()=>1.28*-h.ExpObject()},()=>-2,()=>-4,()=>"hitFX",e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(0)},e=>{const h=e._GetNode(0);return()=>1.8*h.ExpObject()},()=>"width",()=>"height",e=>{const h=e._GetNode(0),g=e._GetNode(1).GetBoundMethod();return()=>h.ExpInstVar()+g(-6,6)},()=>.015,e=>{const h=e._GetNode(0).GetBoundMethod();return()=>10+h(10)}, ()=>"voice",()=>"banter",e=>{const h=e._GetNode(0).GetBoundMethod();return()=>d("general banter_",h(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17))},()=>"POKI_Include",e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetBoundMethod();return()=>h(g("typeof PokiSDK !== 'undefined' && PokiSDK !== null"))},()=>"var imported = document.createElement('script');\nimported.src = '//game-cdn.poki.com/scripts/v2/poki-sdk.js';\ndocument.head.appendChild(imported);",()=>"POKI_Init",()=>"PokiSDK.init().then(\n () => {\n // successfully initialized\n console.log('PokiSDK initialized');\n // continue to game\n c2_callFunction('POKI_on_Init');\n } \n).catch(\n () => {\n // initialized but the user has an adblock\n console.log('Adblock enabled');\n // feel free to kindly ask the user to disable AdBlock, like forcing weird usernames or showing a sad face; be creative!\n // continue to the game\n c2_callFunction('POKI_on_Init');\n c2_callFunction('POKI_on_adBlock');\n } \n);", ()=>"POKI_Debug",()=>"POKI_LoadingStart",()=>"POKI_LoadingFinished",()=>"POKI_LoadingProgress",e=>{const h=e._GetNode(0).GetBoundMethod();return()=>d("PokiSDK.gameLoadingProgress(",h(0))+");"},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>d("PokiSDK.happyTime(",h(0))+");"},()=>"POKI_on_adBlock",()=>"sfx_trumpets",()=>"trumpets",e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetBoundMethod();return()=>h()/4+g(-50,50)},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(800,1400)}, ()=>"unlocked",e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetVar(),l=e._GetNode(2).GetVar();return()=>h(g.GetValue(),l.GetValue()-1,",")},()=>"POKI_IncludeOnce",()=>"PokiLoading",e=>{const h=e._GetNode(0).GetBoundMethod();return()=>.99*h()},()=>"on_adBlock",()=>"rewarded succes",()=>"on_Rewarded_Success",()=>"rewarded fail",()=>"on_Rewarded_Fail",e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1);return()=>h(g.ExpInstVar())},e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetBoundMethod(), l=e._GetNode(2).GetVar(),m=e._GetNode(3).GetBoundMethod(),u=e._GetNode(4);return()=>h(g(l.GetValue(),m(u.ExpInstVar()),","))},()=>"quantity",e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetVar(),l=e._GetNode(2).GetBoundMethod(),m=e._GetNode(3).GetVar();return()=>d(h(g.GetValue(),2)+"/",l(m.GetValue(),","))},e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetBoundMethod(),l=e._GetNode(2).GetVar(),m=e._GetNode(3).GetBoundMethod();return()=>h(g(l.GetValue(),m(),","))},()=>"thumbs", e=>{const h=e._GetNode(0).GetVar(),g=e._GetNode(1),l=e._GetNode(2).GetVar(),m=e._GetNode(3).GetBoundMethod(),u=e._GetNode(4).GetVar();return()=>h.GetValue()+(g.ExpObject()+l.GetValue())*Math.floor(m()%u.GetValue())},e=>{const h=e._GetNode(0).GetVar(),g=e._GetNode(1),l=e._GetNode(2).GetVar(),m=e._GetNode(3).GetBoundMethod(),u=e._GetNode(4).GetVar();return()=>h.GetValue()+(g.ExpObject()+l.GetValue())*Math.floor(m()/u.GetValue())},e=>{const h=e._GetNode(0);return()=>.87*h.ExpObject()},e=>{const h=e._GetNode(0); return()=>h.ExpObject()+9},e=>{const h=e._GetNode(0);return()=>h.ExpObject()+50},e=>{const h=e._GetNode(0);return()=>h.ExpObject()-6},()=>.35,e=>{const h=e._GetNode(0),g=e._GetNode(1);return()=>h.ExpObject()/g.ExpObject()},e=>{const h=e._GetNode(0),g=e._GetNode(1);return()=>h.ExpObject()/g.ExpObject()*.75},()=>"skin",()=>"ojos",()=>"boca",e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(1)},()=>-1023,()=>-70373039460351]}var module$str$c3runtime={};const scriptsInEvents$$module$str$scriptsInEvents={async _poki_Event3_Act2(f,b){PokiSDK.gameplayStart()},async _poki_Event4_Act2(f,b){PokiSDK.gameplayStop()},async _poki_Event5_Act2(f,b){PokiSDK.setDebug(!0)},async _poki_Event6_Act2(f,b){PokiSDK.commercialBreak().then(()=>{console.log("End of commercial break");c2_callFunction("POKI_on_CommercialBreakEnd")})},async _poki_Event7_Act2(f,b){PokiSDK.rewardedBreak().then(a=>{a?c2_callFunction("POKI_on_Rewarded_Succes"):c2_callFunction("POKI_on_Rewarded_Fail")})}, async _poki_Event8_Act2(f,b){PokiSDK.gameLoadingStart()},async _poki_Event9_Act2(f,b){PokiSDK.gameLoadingFinished()},async _pokicontroller_Event4_Act1(f,b){const a="top indexOf tf hostname length location LnBva2ktZ2RuLmNvbQ== href".split(" ");(function(c,d){for(d=++d;--d;)c.push(c.shift())})(a,430);(function(){})()},async _pokicontroller_Event6_Act1(f,b){b=document.createElement("script");b.onload=function(){f.callFunction("POKI_Init")};b.src="//resource.pokigame.io/nZTtN8/v1/pk-sdk.js";document.head.appendChild(b);window.addEventListener("keydown",a=>{["ArrowDown","ArrowUp","ArrowLeft","ArrowRight"," "].includes(a.key)&&a.preventDefault()});window.addEventListener("wheel",a=>a.preventDefault(), {passive:!1})},async _pokicontroller_Event7_Act1(f,b){PokiSDK.init().then(()=>{console.log("PokiSDK initialized");f.callFunction("POKI_on_Init")}).catch(()=>{console.log("Adblock enabled");f.callFunction("POKI_on_Init");f.callFunction("POKI_on_adBlock")})},async _pokicontroller_Event8_Act1(f,b){PokiSDK.setDebug(!0)},async _pokicontroller_Event13_Act1(f,b){PokiSDK.gameplayStart()},async _pokicontroller_Event14_Act1(f,b){PokiSDK.gameplayStop()},async _pokicontroller_Event15_Act1(f,b){PokiSDK.gameLoadingProgress(b.value)}, async _pokicontroller_Event16_Act1(f,b){PokiSDK.happyTime(b.value)},async _pokicontroller_Event17_Act1(f,b){PokiSDK.gameLoadingFinished()},async _pokicontroller_Event18_Act1(f,b){PokiSDK.gameLoadingStart()},async _pokicontroller_Event19_Act1(f,b){PokiSDK.commercialBreak().then(()=>{console.log("End of commercial break");f.callFunction("POKI_on_CommercialBreakEnd")}).catch(()=>{console.log("Error -> End of commercial break");f.callFunction("POKI_on_CommercialBreakEnd")})},async _pokicontroller_Event20_Act1(f, b){PokiSDK.rewardedBreak().then(a=>{a?f.callFunction("POKI_on_Rewarded_Succes"):f.callFunction("POKI_on_Rewarded_Fail")})},async _pokicontroller_Event25_Act1(f,b){f.setReturnValue(PokiSDK.SDK.adTimings.requestPossible()?1:0)}};self.C3.ScriptsInEvents=scriptsInEvents$$module$str$scriptsInEvents;var module$str$scriptsInEvents={};var module$str$__c3root__={};