Файловый менеджер - Редактировать - /home/jogoso94/public_html/jogos/swipe_the_pin/scripts/c3runtime.js
�азад
// Generated by Construct 3, the game and app creator :: https://www.construct.net 'use strict';"use strict"; (function(e,b){"object"===typeof exports&&"undefined"!==typeof module?b(exports):"function"===typeof define&&define.amd?define(["exports"],b):(e=e||self,b(e.glMatrix={}))})(this,function(e){function b(h,p,v){var z=p[0],E=p[1],H=p[2];p=p[3];var I=v[0],M=v[1],O=v[2];v=v[3];h[0]=z*I+H*M;h[1]=E*I+p*M;h[2]=z*O+H*v;h[3]=E*O+p*v;return h}function a(h,p,v){h[0]=p[0]-v[0];h[1]=p[1]-v[1];h[2]=p[2]-v[2];h[3]=p[3]-v[3];return h}function d(h,p,v){var z=p[0],E=p[1],H=p[2],I=p[3],M=p[4];p=p[5];var O=v[0],R=v[1], S=v[2],U=v[3],Y=v[4];v=v[5];h[0]=z*O+H*R;h[1]=E*O+I*R;h[2]=z*S+H*U;h[3]=E*S+I*U;h[4]=z*Y+H*v+M;h[5]=E*Y+I*v+p;return h}function c(h,p,v){h[0]=p[0]-v[0];h[1]=p[1]-v[1];h[2]=p[2]-v[2];h[3]=p[3]-v[3];h[4]=p[4]-v[4];h[5]=p[5]-v[5];return h}function f(){var h=new ra(9);ra!=Float32Array&&(h[1]=0,h[2]=0,h[3]=0,h[5]=0,h[6]=0,h[7]=0);h[0]=1;h[4]=1;h[8]=1;return h}function l(h,p,v){var z=p[0],E=p[1],H=p[2],I=p[3],M=p[4],O=p[5],R=p[6],S=p[7];p=p[8];var U=v[0],Y=v[1],X=v[2],ea=v[3],ca=v[4],ba=v[5],wa=v[6],qa= v[7];v=v[8];h[0]=U*z+Y*I+X*R;h[1]=U*E+Y*M+X*S;h[2]=U*H+Y*O+X*p;h[3]=ea*z+ca*I+ba*R;h[4]=ea*E+ca*M+ba*S;h[5]=ea*H+ca*O+ba*p;h[6]=wa*z+qa*I+v*R;h[7]=wa*E+qa*M+v*S;h[8]=wa*H+qa*O+v*p;return h}function g(h,p,v){h[0]=p[0]-v[0];h[1]=p[1]-v[1];h[2]=p[2]-v[2];h[3]=p[3]-v[3];h[4]=p[4]-v[4];h[5]=p[5]-v[5];h[6]=p[6]-v[6];h[7]=p[7]-v[7];h[8]=p[8]-v[8];return h}function k(h){h[0]=1;h[1]=0;h[2]=0;h[3]=0;h[4]=0;h[5]=1;h[6]=0;h[7]=0;h[8]=0;h[9]=0;h[10]=1;h[11]=0;h[12]=0;h[13]=0;h[14]=0;h[15]=1;return h}function m(h, p,v){var z=p[0],E=p[1],H=p[2],I=p[3],M=p[4],O=p[5],R=p[6],S=p[7],U=p[8],Y=p[9],X=p[10],ea=p[11],ca=p[12],ba=p[13],wa=p[14];p=p[15];var qa=v[0],ua=v[1],va=v[2],ta=v[3];h[0]=qa*z+ua*M+va*U+ta*ca;h[1]=qa*E+ua*O+va*Y+ta*ba;h[2]=qa*H+ua*R+va*X+ta*wa;h[3]=qa*I+ua*S+va*ea+ta*p;qa=v[4];ua=v[5];va=v[6];ta=v[7];h[4]=qa*z+ua*M+va*U+ta*ca;h[5]=qa*E+ua*O+va*Y+ta*ba;h[6]=qa*H+ua*R+va*X+ta*wa;h[7]=qa*I+ua*S+va*ea+ta*p;qa=v[8];ua=v[9];va=v[10];ta=v[11];h[8]=qa*z+ua*M+va*U+ta*ca;h[9]=qa*E+ua*O+va*Y+ta*ba;h[10]=qa* H+ua*R+va*X+ta*wa;h[11]=qa*I+ua*S+va*ea+ta*p;qa=v[12];ua=v[13];va=v[14];ta=v[15];h[12]=qa*z+ua*M+va*U+ta*ca;h[13]=qa*E+ua*O+va*Y+ta*ba;h[14]=qa*H+ua*R+va*X+ta*wa;h[15]=qa*I+ua*S+va*ea+ta*p;return h}function u(h,p,v){var z=p[0],E=p[1],H=p[2],I=p[3],M=z+z,O=E+E,R=H+H;p=z*M;var S=z*O;z*=R;var U=E*O;E*=R;H*=R;M*=I;O*=I;I*=R;h[0]=1-(U+H);h[1]=S+I;h[2]=z-O;h[3]=0;h[4]=S-I;h[5]=1-(p+H);h[6]=E+M;h[7]=0;h[8]=z+O;h[9]=E-M;h[10]=1-(p+U);h[11]=0;h[12]=v[0];h[13]=v[1];h[14]=v[2];h[15]=1;return h}function x(h, p){h[0]=p[12];h[1]=p[13];h[2]=p[14];return h}function n(h,p){var v=p[4],z=p[5],E=p[6],H=p[8],I=p[9],M=p[10];h[0]=Math.hypot(p[0],p[1],p[2]);h[1]=Math.hypot(v,z,E);h[2]=Math.hypot(H,I,M);return h}function q(h,p){var v=new ra(3);n(v,p);var z=1/v[0],E=1/v[1],H=1/v[2],I=p[0]*z;v=p[1]*E;var M=p[2]*H,O=p[4]*z,R=p[5]*E,S=p[6]*H;z*=p[8];E*=p[9];p=p[10]*H;H=I+R+p;0<H?(I=2*Math.sqrt(H+1),h[3]=.25*I,h[0]=(S-E)/I,h[1]=(z-M)/I,h[2]=(v-O)/I):I>R&&I>p?(I=2*Math.sqrt(1+I-R-p),h[3]=(S-E)/I,h[0]=.25*I,h[1]=(v+O)/I, h[2]=(z+M)/I):R>p?(I=2*Math.sqrt(1+R-I-p),h[3]=(z-M)/I,h[0]=(v+O)/I,h[1]=.25*I,h[2]=(S+E)/I):(I=2*Math.sqrt(1+p-I-R),h[3]=(v-O)/I,h[0]=(z+M)/I,h[1]=(S+E)/I,h[2]=.25*I);return h}function t(h,p,v){h[0]=p[0]-v[0];h[1]=p[1]-v[1];h[2]=p[2]-v[2];h[3]=p[3]-v[3];h[4]=p[4]-v[4];h[5]=p[5]-v[5];h[6]=p[6]-v[6];h[7]=p[7]-v[7];h[8]=p[8]-v[8];h[9]=p[9]-v[9];h[10]=p[10]-v[10];h[11]=p[11]-v[11];h[12]=p[12]-v[12];h[13]=p[13]-v[13];h[14]=p[14]-v[14];h[15]=p[15]-v[15];return h}function r(){var h=new ra(3);ra!=Float32Array&& (h[0]=0,h[1]=0,h[2]=0);return h}function w(h){return Math.hypot(h[0],h[1],h[2])}function y(h,p,v){var z=new ra(3);z[0]=h;z[1]=p;z[2]=v;return z}function C(h,p,v){h[0]=p[0]-v[0];h[1]=p[1]-v[1];h[2]=p[2]-v[2];return h}function D(h,p,v){h[0]=p[0]*v[0];h[1]=p[1]*v[1];h[2]=p[2]*v[2];return h}function G(h,p,v){h[0]=p[0]/v[0];h[1]=p[1]/v[1];h[2]=p[2]/v[2];return h}function K(h,p){return Math.hypot(p[0]-h[0],p[1]-h[1],p[2]-h[2])}function B(h,p){var v=p[0]-h[0],z=p[1]-h[1];h=p[2]-h[2];return v*v+z*z+h*h}function A(h){var p= h[0],v=h[1];h=h[2];return p*p+v*v+h*h}function F(h,p){var v=p[0],z=p[1],E=p[2];v=v*v+z*z+E*E;0<v&&(v=1/Math.sqrt(v));h[0]=p[0]*v;h[1]=p[1]*v;h[2]=p[2]*v;return h}function J(h,p){return h[0]*p[0]+h[1]*p[1]+h[2]*p[2]}function L(h,p,v){var z=p[0],E=p[1];p=p[2];var H=v[0],I=v[1];v=v[2];h[0]=E*v-p*I;h[1]=p*H-z*v;h[2]=z*I-E*H;return h}function Q(){var h=new ra(4);ra!=Float32Array&&(h[0]=0,h[1]=0,h[2]=0,h[3]=0);return h}function T(h){var p=new ra(4);p[0]=h[0];p[1]=h[1];p[2]=h[2];p[3]=h[3];return p}function V(h, p,v,z){var E=new ra(4);E[0]=h;E[1]=p;E[2]=v;E[3]=z;return E}function aa(h,p){h[0]=p[0];h[1]=p[1];h[2]=p[2];h[3]=p[3];return h}function ha(h,p,v,z,E){h[0]=p;h[1]=v;h[2]=z;h[3]=E;return h}function ja(h,p,v){h[0]=p[0]+v[0];h[1]=p[1]+v[1];h[2]=p[2]+v[2];h[3]=p[3]+v[3];return h}function oa(h,p,v){h[0]=p[0]-v[0];h[1]=p[1]-v[1];h[2]=p[2]-v[2];h[3]=p[3]-v[3];return h}function ya(h,p,v){h[0]=p[0]*v[0];h[1]=p[1]*v[1];h[2]=p[2]*v[2];h[3]=p[3]*v[3];return h}function Ba(h,p,v){h[0]=p[0]/v[0];h[1]=p[1]/v[1];h[2]= p[2]/v[2];h[3]=p[3]/v[3];return h}function La(h,p,v){h[0]=p[0]*v;h[1]=p[1]*v;h[2]=p[2]*v;h[3]=p[3]*v;return h}function Da(h,p){return Math.hypot(p[0]-h[0],p[1]-h[1],p[2]-h[2],p[3]-h[3])}function Ga(h,p){var v=p[0]-h[0],z=p[1]-h[1],E=p[2]-h[2];h=p[3]-h[3];return v*v+z*z+E*E+h*h}function ma(h){return Math.hypot(h[0],h[1],h[2],h[3])}function Oa(h){var p=h[0],v=h[1],z=h[2];h=h[3];return p*p+v*v+z*z+h*h}function Aa(h,p){var v=p[0],z=p[1],E=p[2];p=p[3];var H=v*v+z*z+E*E+p*p;0<H&&(H=1/Math.sqrt(H));h[0]= v*H;h[1]=z*H;h[2]=E*H;h[3]=p*H;return h}function Ma(h,p){return h[0]*p[0]+h[1]*p[1]+h[2]*p[2]+h[3]*p[3]}function bb(h,p,v,z){var E=p[0],H=p[1],I=p[2];p=p[3];h[0]=E+z*(v[0]-E);h[1]=H+z*(v[1]-H);h[2]=I+z*(v[2]-I);h[3]=p+z*(v[3]-p);return h}function cb(h,p){return h[0]===p[0]&&h[1]===p[1]&&h[2]===p[2]&&h[3]===p[3]}function db(h,p){var v=h[0],z=h[1],E=h[2];h=h[3];var H=p[0],I=p[1],M=p[2];p=p[3];return Math.abs(v-H)<=1E-6*Math.max(1,Math.abs(v),Math.abs(H))&&Math.abs(z-I)<=1E-6*Math.max(1,Math.abs(z), Math.abs(I))&&Math.abs(E-M)<=1E-6*Math.max(1,Math.abs(E),Math.abs(M))&&Math.abs(h-p)<=1E-6*Math.max(1,Math.abs(h),Math.abs(p))}function Ya(){var h=new ra(4);ra!=Float32Array&&(h[0]=0,h[1]=0,h[2]=0);h[3]=1;return h}function ob(h,p,v){v*=.5;var z=Math.sin(v);h[0]=z*p[0];h[1]=z*p[1];h[2]=z*p[2];h[3]=Math.cos(v);return h}function pb(h,p,v){var z=p[0],E=p[1],H=p[2];p=p[3];var I=v[0],M=v[1],O=v[2];v=v[3];h[0]=z*v+p*I+E*O-H*M;h[1]=E*v+p*M+H*I-z*O;h[2]=H*v+p*O+z*M-E*I;h[3]=p*v-z*I-E*M-H*O;return h}function qb(h, p,v){v*=.5;var z=p[0],E=p[1],H=p[2];p=p[3];var I=Math.sin(v);v=Math.cos(v);h[0]=z*v+p*I;h[1]=E*v+H*I;h[2]=H*v-E*I;h[3]=p*v-z*I;return h}function rb(h,p,v){v*=.5;var z=p[0],E=p[1],H=p[2];p=p[3];var I=Math.sin(v);v=Math.cos(v);h[0]=z*v-H*I;h[1]=E*v+p*I;h[2]=H*v+z*I;h[3]=p*v-E*I;return h}function sb(h,p,v){v*=.5;var z=p[0],E=p[1],H=p[2];p=p[3];var I=Math.sin(v);v=Math.cos(v);h[0]=z*v+E*I;h[1]=E*v-z*I;h[2]=H*v+p*I;h[3]=p*v-H*I;return h}function tb(h,p){var v=p[0],z=p[1],E=p[2],H=Math.sqrt(v*v+z*z+E*E); p=Math.exp(p[3]);var I=0<H?p*Math.sin(H)/H:0;h[0]=v*I;h[1]=z*I;h[2]=E*I;h[3]=p*Math.cos(H);return h}function ub(h,p){var v=p[0],z=p[1],E=p[2];p=p[3];var H=Math.sqrt(v*v+z*z+E*E);H=0<H?Math.atan2(H,p)/H:0;h[0]=v*H;h[1]=z*H;h[2]=E*H;h[3]=.5*Math.log(v*v+z*z+E*E+p*p);return h}function eb(h,p,v,z){var E=p[0],H=p[1],I=p[2];p=p[3];var M=v[0],O=v[1],R=v[2];v=v[3];var S=E*M+H*O+I*R+p*v;0>S&&(S=-S,M=-M,O=-O,R=-R,v=-v);if(1E-6<1-S){var U=Math.acos(S);var Y=Math.sin(U);S=Math.sin((1-z)*U)/Y;z=Math.sin(z*U)/ Y}else S=1-z;h[0]=S*E+z*M;h[1]=S*H+z*O;h[2]=S*I+z*R;h[3]=S*p+z*v;return h}function vb(h,p){var v=p[0]+p[4]+p[8];if(0<v)v=Math.sqrt(v+1),h[3]=.5*v,v=.5/v,h[0]=(p[5]-p[7])*v,h[1]=(p[6]-p[2])*v,h[2]=(p[1]-p[3])*v;else{var z=0;p[4]>p[0]&&(z=1);p[8]>p[3*z+z]&&(z=2);var E=(z+1)%3,H=(z+2)%3;v=Math.sqrt(p[3*z+z]-p[3*E+E]-p[3*H+H]+1);h[z]=.5*v;v=.5/v;h[3]=(p[3*E+H]-p[3*H+E])*v;h[E]=(p[3*E+z]+p[3*z+E])*v;h[H]=(p[3*H+z]+p[3*z+H])*v}return h}function wb(h,p,v){var z=.5*v[0],E=.5*v[1];v=.5*v[2];var H=p[0],I=p[1], M=p[2];p=p[3];h[0]=H;h[1]=I;h[2]=M;h[3]=p;h[4]=z*p+E*M-v*I;h[5]=E*p+v*H-z*M;h[6]=v*p+z*I-E*H;h[7]=-z*H-E*I-v*M;return h}function xb(h,p){h[0]=p[0];h[1]=p[1];h[2]=p[2];h[3]=p[3];h[4]=p[4];h[5]=p[5];h[6]=p[6];h[7]=p[7];return h}function yb(h,p,v){var z=p[0],E=p[1],H=p[2],I=p[3],M=v[4],O=v[5],R=v[6],S=v[7],U=p[4],Y=p[5],X=p[6];p=p[7];var ea=v[0],ca=v[1],ba=v[2];v=v[3];h[0]=z*v+I*ea+E*ba-H*ca;h[1]=E*v+I*ca+H*ea-z*ba;h[2]=H*v+I*ba+z*ca-E*ea;h[3]=I*v-z*ea-E*ca-H*ba;h[4]=z*S+I*M+E*R-H*O+U*v+p*ea+Y*ba-X* ca;h[5]=E*S+I*O+H*M-z*R+Y*v+p*ca+X*ea-U*ba;h[6]=H*S+I*R+z*O-E*M+X*v+p*ba+U*ca-Y*ea;h[7]=I*S-z*M-E*O-H*R+p*v-U*ea-Y*ca-X*ba;return h}function fb(){var h=new ra(2);ra!=Float32Array&&(h[0]=0,h[1]=0);return h}function Xa(h,p,v){h[0]=p[0]-v[0];h[1]=p[1]-v[1];return h}function gb(h,p,v){h[0]=p[0]*v[0];h[1]=p[1]*v[1];return h}function hb(h,p,v){h[0]=p[0]/v[0];h[1]=p[1]/v[1];return h}function Za(h,p){return Math.hypot(p[0]-h[0],p[1]-h[1])}function ib(h,p){var v=p[0]-h[0];h=p[1]-h[1];return v*v+h*h}function Ta(h){return Math.hypot(h[0], h[1])}function jb(h){var p=h[0];h=h[1];return p*p+h*h}var ra="undefined"!==typeof Float32Array?Float32Array:Array,Ra=Math.random,zb=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var h=0,p=arguments.length;p--;)h+=arguments[p]*arguments[p];return Math.sqrt(h)});var Ab=Object.freeze({__proto__:null,EPSILON:1E-6,get ARRAY_TYPE(){return ra},RANDOM:Ra,setMatrixArrayType:function(h){ra=h},toRadian:function(h){return h*zb},equals:function(h,p){return Math.abs(h-p)<=1E-6*Math.max(1,Math.abs(h),Math.abs(p))}}), Db=Object.freeze({__proto__:null,create:function(){var h=new ra(4);ra!=Float32Array&&(h[1]=0,h[2]=0);h[0]=1;h[3]=1;return h},clone:function(h){var p=new ra(4);p[0]=h[0];p[1]=h[1];p[2]=h[2];p[3]=h[3];return p},copy:function(h,p){h[0]=p[0];h[1]=p[1];h[2]=p[2];h[3]=p[3];return h},identity:function(h){h[0]=1;h[1]=0;h[2]=0;h[3]=1;return h},fromValues:function(h,p,v,z){var E=new ra(4);E[0]=h;E[1]=p;E[2]=v;E[3]=z;return E},set:function(h,p,v,z,E){h[0]=p;h[1]=v;h[2]=z;h[3]=E;return h},transpose:function(h, p){if(h===p){var v=p[1];h[1]=p[2];h[2]=v}else h[0]=p[0],h[1]=p[2],h[2]=p[1],h[3]=p[3];return h},invert:function(h,p){var v=p[0],z=p[1],E=p[2];p=p[3];var H=v*p-E*z;if(!H)return null;H=1/H;h[0]=p*H;h[1]=-z*H;h[2]=-E*H;h[3]=v*H;return h},adjoint:function(h,p){var v=p[0];h[0]=p[3];h[1]=-p[1];h[2]=-p[2];h[3]=v;return h},determinant:function(h){return h[0]*h[3]-h[2]*h[1]},multiply:b,rotate:function(h,p,v){var z=p[0],E=p[1],H=p[2];p=p[3];var I=Math.sin(v);v=Math.cos(v);h[0]=z*v+H*I;h[1]=E*v+p*I;h[2]=z*-I+ H*v;h[3]=E*-I+p*v;return h},scale:function(h,p,v){var z=p[1],E=p[2],H=p[3],I=v[0];v=v[1];h[0]=p[0]*I;h[1]=z*I;h[2]=E*v;h[3]=H*v;return h},fromRotation:function(h,p){var v=Math.sin(p);p=Math.cos(p);h[0]=p;h[1]=v;h[2]=-v;h[3]=p;return h},fromScaling:function(h,p){h[0]=p[0];h[1]=0;h[2]=0;h[3]=p[1];return h},str:function(h){return"mat2("+h[0]+", "+h[1]+", "+h[2]+", "+h[3]+")"},frob:function(h){return Math.hypot(h[0],h[1],h[2],h[3])},LDU:function(h,p,v,z){h[2]=z[2]/z[0];v[0]=z[0];v[1]=z[1];v[3]=z[3]-h[2]* v[1];return[h,p,v]},add:function(h,p,v){h[0]=p[0]+v[0];h[1]=p[1]+v[1];h[2]=p[2]+v[2];h[3]=p[3]+v[3];return h},subtract:a,exactEquals:function(h,p){return h[0]===p[0]&&h[1]===p[1]&&h[2]===p[2]&&h[3]===p[3]},equals:function(h,p){var v=h[0],z=h[1],E=h[2];h=h[3];var H=p[0],I=p[1],M=p[2];p=p[3];return Math.abs(v-H)<=1E-6*Math.max(1,Math.abs(v),Math.abs(H))&&Math.abs(z-I)<=1E-6*Math.max(1,Math.abs(z),Math.abs(I))&&Math.abs(E-M)<=1E-6*Math.max(1,Math.abs(E),Math.abs(M))&&Math.abs(h-p)<=1E-6*Math.max(1,Math.abs(h), Math.abs(p))},multiplyScalar:function(h,p,v){h[0]=p[0]*v;h[1]=p[1]*v;h[2]=p[2]*v;h[3]=p[3]*v;return h},multiplyScalarAndAdd:function(h,p,v,z){h[0]=p[0]+v[0]*z;h[1]=p[1]+v[1]*z;h[2]=p[2]+v[2]*z;h[3]=p[3]+v[3]*z;return h},mul:b,sub:a}),Eb=Object.freeze({__proto__:null,create:function(){var h=new ra(6);ra!=Float32Array&&(h[1]=0,h[2]=0,h[4]=0,h[5]=0);h[0]=1;h[3]=1;return h},clone:function(h){var p=new ra(6);p[0]=h[0];p[1]=h[1];p[2]=h[2];p[3]=h[3];p[4]=h[4];p[5]=h[5];return p},copy:function(h,p){h[0]= p[0];h[1]=p[1];h[2]=p[2];h[3]=p[3];h[4]=p[4];h[5]=p[5];return h},identity:function(h){h[0]=1;h[1]=0;h[2]=0;h[3]=1;h[4]=0;h[5]=0;return h},fromValues:function(h,p,v,z,E,H){var I=new ra(6);I[0]=h;I[1]=p;I[2]=v;I[3]=z;I[4]=E;I[5]=H;return I},set:function(h,p,v,z,E,H,I){h[0]=p;h[1]=v;h[2]=z;h[3]=E;h[4]=H;h[5]=I;return h},invert:function(h,p){var v=p[0],z=p[1],E=p[2],H=p[3],I=p[4];p=p[5];var M=v*H-z*E;if(!M)return null;M=1/M;h[0]=H*M;h[1]=-z*M;h[2]=-E*M;h[3]=v*M;h[4]=(E*p-H*I)*M;h[5]=(z*I-v*p)*M;return h}, determinant:function(h){return h[0]*h[3]-h[1]*h[2]},multiply:d,rotate:function(h,p,v){var z=p[0],E=p[1],H=p[2],I=p[3],M=p[4];p=p[5];var O=Math.sin(v);v=Math.cos(v);h[0]=z*v+H*O;h[1]=E*v+I*O;h[2]=z*-O+H*v;h[3]=E*-O+I*v;h[4]=M;h[5]=p;return h},scale:function(h,p,v){var z=p[1],E=p[2],H=p[3],I=p[4],M=p[5],O=v[0];v=v[1];h[0]=p[0]*O;h[1]=z*O;h[2]=E*v;h[3]=H*v;h[4]=I;h[5]=M;return h},translate:function(h,p,v){var z=p[0],E=p[1],H=p[2],I=p[3],M=p[4];p=p[5];var O=v[0];v=v[1];h[0]=z;h[1]=E;h[2]=H;h[3]=I;h[4]= z*O+H*v+M;h[5]=E*O+I*v+p;return h},fromRotation:function(h,p){var v=Math.sin(p);p=Math.cos(p);h[0]=p;h[1]=v;h[2]=-v;h[3]=p;h[4]=0;h[5]=0;return h},fromScaling:function(h,p){h[0]=p[0];h[1]=0;h[2]=0;h[3]=p[1];h[4]=0;h[5]=0;return h},fromTranslation:function(h,p){h[0]=1;h[1]=0;h[2]=0;h[3]=1;h[4]=p[0];h[5]=p[1];return h},str:function(h){return"mat2d("+h[0]+", "+h[1]+", "+h[2]+", "+h[3]+", "+h[4]+", "+h[5]+")"},frob:function(h){return Math.hypot(h[0],h[1],h[2],h[3],h[4],h[5],1)},add:function(h,p,v){h[0]= p[0]+v[0];h[1]=p[1]+v[1];h[2]=p[2]+v[2];h[3]=p[3]+v[3];h[4]=p[4]+v[4];h[5]=p[5]+v[5];return h},subtract:c,multiplyScalar:function(h,p,v){h[0]=p[0]*v;h[1]=p[1]*v;h[2]=p[2]*v;h[3]=p[3]*v;h[4]=p[4]*v;h[5]=p[5]*v;return h},multiplyScalarAndAdd:function(h,p,v,z){h[0]=p[0]+v[0]*z;h[1]=p[1]+v[1]*z;h[2]=p[2]+v[2]*z;h[3]=p[3]+v[3]*z;h[4]=p[4]+v[4]*z;h[5]=p[5]+v[5]*z;return h},exactEquals:function(h,p){return h[0]===p[0]&&h[1]===p[1]&&h[2]===p[2]&&h[3]===p[3]&&h[4]===p[4]&&h[5]===p[5]},equals:function(h,p){var v= h[0],z=h[1],E=h[2],H=h[3],I=h[4];h=h[5];var M=p[0],O=p[1],R=p[2],S=p[3],U=p[4];p=p[5];return Math.abs(v-M)<=1E-6*Math.max(1,Math.abs(v),Math.abs(M))&&Math.abs(z-O)<=1E-6*Math.max(1,Math.abs(z),Math.abs(O))&&Math.abs(E-R)<=1E-6*Math.max(1,Math.abs(E),Math.abs(R))&&Math.abs(H-S)<=1E-6*Math.max(1,Math.abs(H),Math.abs(S))&&Math.abs(I-U)<=1E-6*Math.max(1,Math.abs(I),Math.abs(U))&&Math.abs(h-p)<=1E-6*Math.max(1,Math.abs(h),Math.abs(p))},mul:d,sub:c}),Fb=Object.freeze({__proto__:null,create:f,fromMat4:function(h, p){h[0]=p[0];h[1]=p[1];h[2]=p[2];h[3]=p[4];h[4]=p[5];h[5]=p[6];h[6]=p[8];h[7]=p[9];h[8]=p[10];return h},clone:function(h){var p=new ra(9);p[0]=h[0];p[1]=h[1];p[2]=h[2];p[3]=h[3];p[4]=h[4];p[5]=h[5];p[6]=h[6];p[7]=h[7];p[8]=h[8];return p},copy:function(h,p){h[0]=p[0];h[1]=p[1];h[2]=p[2];h[3]=p[3];h[4]=p[4];h[5]=p[5];h[6]=p[6];h[7]=p[7];h[8]=p[8];return h},fromValues:function(h,p,v,z,E,H,I,M,O){var R=new ra(9);R[0]=h;R[1]=p;R[2]=v;R[3]=z;R[4]=E;R[5]=H;R[6]=I;R[7]=M;R[8]=O;return R},set:function(h,p, v,z,E,H,I,M,O,R){h[0]=p;h[1]=v;h[2]=z;h[3]=E;h[4]=H;h[5]=I;h[6]=M;h[7]=O;h[8]=R;return h},identity:function(h){h[0]=1;h[1]=0;h[2]=0;h[3]=0;h[4]=1;h[5]=0;h[6]=0;h[7]=0;h[8]=1;return h},transpose:function(h,p){if(h===p){var v=p[1],z=p[2],E=p[5];h[1]=p[3];h[2]=p[6];h[3]=v;h[5]=p[7];h[6]=z;h[7]=E}else h[0]=p[0],h[1]=p[3],h[2]=p[6],h[3]=p[1],h[4]=p[4],h[5]=p[7],h[6]=p[2],h[7]=p[5],h[8]=p[8];return h},invert:function(h,p){var v=p[0],z=p[1],E=p[2],H=p[3],I=p[4],M=p[5],O=p[6],R=p[7];p=p[8];var S=p*I-M*R, U=-p*H+M*O,Y=R*H-I*O,X=v*S+z*U+E*Y;if(!X)return null;X=1/X;h[0]=S*X;h[1]=(-p*z+E*R)*X;h[2]=(M*z-E*I)*X;h[3]=U*X;h[4]=(p*v-E*O)*X;h[5]=(-M*v+E*H)*X;h[6]=Y*X;h[7]=(-R*v+z*O)*X;h[8]=(I*v-z*H)*X;return h},adjoint:function(h,p){var v=p[0],z=p[1],E=p[2],H=p[3],I=p[4],M=p[5],O=p[6],R=p[7];p=p[8];h[0]=I*p-M*R;h[1]=E*R-z*p;h[2]=z*M-E*I;h[3]=M*O-H*p;h[4]=v*p-E*O;h[5]=E*H-v*M;h[6]=H*R-I*O;h[7]=z*O-v*R;h[8]=v*I-z*H;return h},determinant:function(h){var p=h[3],v=h[4],z=h[5],E=h[6],H=h[7],I=h[8];return h[0]*(I* v-z*H)+h[1]*(-I*p+z*E)+h[2]*(H*p-v*E)},multiply:l,translate:function(h,p,v){var z=p[0],E=p[1],H=p[2],I=p[3],M=p[4],O=p[5],R=p[6],S=p[7];p=p[8];var U=v[0];v=v[1];h[0]=z;h[1]=E;h[2]=H;h[3]=I;h[4]=M;h[5]=O;h[6]=U*z+v*I+R;h[7]=U*E+v*M+S;h[8]=U*H+v*O+p;return h},rotate:function(h,p,v){var z=p[0],E=p[1],H=p[2],I=p[3],M=p[4],O=p[5],R=p[6],S=p[7];p=p[8];var U=Math.sin(v);v=Math.cos(v);h[0]=v*z+U*I;h[1]=v*E+U*M;h[2]=v*H+U*O;h[3]=v*I-U*z;h[4]=v*M-U*E;h[5]=v*O-U*H;h[6]=R;h[7]=S;h[8]=p;return h},scale:function(h, p,v){var z=v[0];v=v[1];h[0]=z*p[0];h[1]=z*p[1];h[2]=z*p[2];h[3]=v*p[3];h[4]=v*p[4];h[5]=v*p[5];h[6]=p[6];h[7]=p[7];h[8]=p[8];return h},fromTranslation:function(h,p){h[0]=1;h[1]=0;h[2]=0;h[3]=0;h[4]=1;h[5]=0;h[6]=p[0];h[7]=p[1];h[8]=1;return h},fromRotation:function(h,p){var v=Math.sin(p);p=Math.cos(p);h[0]=p;h[1]=v;h[2]=0;h[3]=-v;h[4]=p;h[5]=0;h[6]=0;h[7]=0;h[8]=1;return h},fromScaling:function(h,p){h[0]=p[0];h[1]=0;h[2]=0;h[3]=0;h[4]=p[1];h[5]=0;h[6]=0;h[7]=0;h[8]=1;return h},fromMat2d:function(h, p){h[0]=p[0];h[1]=p[1];h[2]=0;h[3]=p[2];h[4]=p[3];h[5]=0;h[6]=p[4];h[7]=p[5];h[8]=1;return h},fromQuat:function(h,p){var v=p[0],z=p[1],E=p[2];p=p[3];var H=v+v,I=z+z,M=E+E;v*=H;var O=z*H;z*=I;var R=E*H,S=E*I;E*=M;H*=p;I*=p;p*=M;h[0]=1-z-E;h[3]=O-p;h[6]=R+I;h[1]=O+p;h[4]=1-v-E;h[7]=S-H;h[2]=R-I;h[5]=S+H;h[8]=1-v-z;return h},normalFromMat4:function(h,p){var v=p[0],z=p[1],E=p[2],H=p[3],I=p[4],M=p[5],O=p[6],R=p[7],S=p[8],U=p[9],Y=p[10],X=p[11],ea=p[12],ca=p[13],ba=p[14];p=p[15];var wa=v*M-z*I,qa=v*O-E* I,ua=v*R-H*I,va=z*O-E*M,ta=z*R-H*M,Ha=E*R-H*O,Ia=S*ca-U*ea,Ja=S*ba-Y*ea;S=S*p-X*ea;var Ka=U*ba-Y*ca;U=U*p-X*ca;Y=Y*p-X*ba;X=wa*Y-qa*U+ua*Ka+va*S-ta*Ja+Ha*Ia;if(!X)return null;X=1/X;h[0]=(M*Y-O*U+R*Ka)*X;h[1]=(O*S-I*Y-R*Ja)*X;h[2]=(I*U-M*S+R*Ia)*X;h[3]=(E*U-z*Y-H*Ka)*X;h[4]=(v*Y-E*S+H*Ja)*X;h[5]=(z*S-v*U-H*Ia)*X;h[6]=(ca*Ha-ba*ta+p*va)*X;h[7]=(ba*ua-ea*Ha-p*qa)*X;h[8]=(ea*ta-ca*ua+p*wa)*X;return h},projection:function(h,p,v){h[0]=2/p;h[1]=0;h[2]=0;h[3]=0;h[4]=-2/v;h[5]=0;h[6]=-1;h[7]=1;h[8]=1;return h}, str:function(h){return"mat3("+h[0]+", "+h[1]+", "+h[2]+", "+h[3]+", "+h[4]+", "+h[5]+", "+h[6]+", "+h[7]+", "+h[8]+")"},frob:function(h){return Math.hypot(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8])},add:function(h,p,v){h[0]=p[0]+v[0];h[1]=p[1]+v[1];h[2]=p[2]+v[2];h[3]=p[3]+v[3];h[4]=p[4]+v[4];h[5]=p[5]+v[5];h[6]=p[6]+v[6];h[7]=p[7]+v[7];h[8]=p[8]+v[8];return h},subtract:g,multiplyScalar:function(h,p,v){h[0]=p[0]*v;h[1]=p[1]*v;h[2]=p[2]*v;h[3]=p[3]*v;h[4]=p[4]*v;h[5]=p[5]*v;h[6]=p[6]*v;h[7]=p[7]* v;h[8]=p[8]*v;return h},multiplyScalarAndAdd:function(h,p,v,z){h[0]=p[0]+v[0]*z;h[1]=p[1]+v[1]*z;h[2]=p[2]+v[2]*z;h[3]=p[3]+v[3]*z;h[4]=p[4]+v[4]*z;h[5]=p[5]+v[5]*z;h[6]=p[6]+v[6]*z;h[7]=p[7]+v[7]*z;h[8]=p[8]+v[8]*z;return h},exactEquals:function(h,p){return h[0]===p[0]&&h[1]===p[1]&&h[2]===p[2]&&h[3]===p[3]&&h[4]===p[4]&&h[5]===p[5]&&h[6]===p[6]&&h[7]===p[7]&&h[8]===p[8]},equals:function(h,p){var v=h[0],z=h[1],E=h[2],H=h[3],I=h[4],M=h[5],O=h[6],R=h[7];h=h[8];var S=p[0],U=p[1],Y=p[2],X=p[3],ea=p[4], ca=p[5],ba=p[6],wa=p[7];p=p[8];return Math.abs(v-S)<=1E-6*Math.max(1,Math.abs(v),Math.abs(S))&&Math.abs(z-U)<=1E-6*Math.max(1,Math.abs(z),Math.abs(U))&&Math.abs(E-Y)<=1E-6*Math.max(1,Math.abs(E),Math.abs(Y))&&Math.abs(H-X)<=1E-6*Math.max(1,Math.abs(H),Math.abs(X))&&Math.abs(I-ea)<=1E-6*Math.max(1,Math.abs(I),Math.abs(ea))&&Math.abs(M-ca)<=1E-6*Math.max(1,Math.abs(M),Math.abs(ca))&&Math.abs(O-ba)<=1E-6*Math.max(1,Math.abs(O),Math.abs(ba))&&Math.abs(R-wa)<=1E-6*Math.max(1,Math.abs(R),Math.abs(wa))&& Math.abs(h-p)<=1E-6*Math.max(1,Math.abs(h),Math.abs(p))},mul:l,sub:g}),Gb=Object.freeze({__proto__:null,create:function(){var h=new ra(16);ra!=Float32Array&&(h[1]=0,h[2]=0,h[3]=0,h[4]=0,h[6]=0,h[7]=0,h[8]=0,h[9]=0,h[11]=0,h[12]=0,h[13]=0,h[14]=0);h[0]=1;h[5]=1;h[10]=1;h[15]=1;return h},clone:function(h){var p=new ra(16);p[0]=h[0];p[1]=h[1];p[2]=h[2];p[3]=h[3];p[4]=h[4];p[5]=h[5];p[6]=h[6];p[7]=h[7];p[8]=h[8];p[9]=h[9];p[10]=h[10];p[11]=h[11];p[12]=h[12];p[13]=h[13];p[14]=h[14];p[15]=h[15];return p}, copy:function(h,p){h[0]=p[0];h[1]=p[1];h[2]=p[2];h[3]=p[3];h[4]=p[4];h[5]=p[5];h[6]=p[6];h[7]=p[7];h[8]=p[8];h[9]=p[9];h[10]=p[10];h[11]=p[11];h[12]=p[12];h[13]=p[13];h[14]=p[14];h[15]=p[15];return h},fromValues:function(h,p,v,z,E,H,I,M,O,R,S,U,Y,X,ea,ca){var ba=new ra(16);ba[0]=h;ba[1]=p;ba[2]=v;ba[3]=z;ba[4]=E;ba[5]=H;ba[6]=I;ba[7]=M;ba[8]=O;ba[9]=R;ba[10]=S;ba[11]=U;ba[12]=Y;ba[13]=X;ba[14]=ea;ba[15]=ca;return ba},set:function(h,p,v,z,E,H,I,M,O,R,S,U,Y,X,ea,ca,ba){h[0]=p;h[1]=v;h[2]=z;h[3]=E;h[4]= H;h[5]=I;h[6]=M;h[7]=O;h[8]=R;h[9]=S;h[10]=U;h[11]=Y;h[12]=X;h[13]=ea;h[14]=ca;h[15]=ba;return h},identity:k,transpose:function(h,p){if(h===p){var v=p[1],z=p[2],E=p[3],H=p[6],I=p[7],M=p[11];h[1]=p[4];h[2]=p[8];h[3]=p[12];h[4]=v;h[6]=p[9];h[7]=p[13];h[8]=z;h[9]=H;h[11]=p[14];h[12]=E;h[13]=I;h[14]=M}else h[0]=p[0],h[1]=p[4],h[2]=p[8],h[3]=p[12],h[4]=p[1],h[5]=p[5],h[6]=p[9],h[7]=p[13],h[8]=p[2],h[9]=p[6],h[10]=p[10],h[11]=p[14],h[12]=p[3],h[13]=p[7],h[14]=p[11],h[15]=p[15];return h},invert:function(h, p){var v=p[0],z=p[1],E=p[2],H=p[3],I=p[4],M=p[5],O=p[6],R=p[7],S=p[8],U=p[9],Y=p[10],X=p[11],ea=p[12],ca=p[13],ba=p[14];p=p[15];var wa=v*M-z*I,qa=v*O-E*I,ua=v*R-H*I,va=z*O-E*M,ta=z*R-H*M,Ha=E*R-H*O,Ia=S*ca-U*ea,Ja=S*ba-Y*ea,Ka=S*p-X*ea,Pa=U*ba-Y*ca,Va=U*p-X*ca,Wa=Y*p-X*ba,Ca=wa*Wa-qa*Va+ua*Pa+va*Ka-ta*Ja+Ha*Ia;if(!Ca)return null;Ca=1/Ca;h[0]=(M*Wa-O*Va+R*Pa)*Ca;h[1]=(E*Va-z*Wa-H*Pa)*Ca;h[2]=(ca*Ha-ba*ta+p*va)*Ca;h[3]=(Y*ta-U*Ha-X*va)*Ca;h[4]=(O*Ka-I*Wa-R*Ja)*Ca;h[5]=(v*Wa-E*Ka+H*Ja)*Ca;h[6]=(ba*ua- ea*Ha-p*qa)*Ca;h[7]=(S*Ha-Y*ua+X*qa)*Ca;h[8]=(I*Va-M*Ka+R*Ia)*Ca;h[9]=(z*Ka-v*Va-H*Ia)*Ca;h[10]=(ea*ta-ca*ua+p*wa)*Ca;h[11]=(U*ua-S*ta-X*wa)*Ca;h[12]=(M*Ja-I*Pa-O*Ia)*Ca;h[13]=(v*Pa-z*Ja+E*Ia)*Ca;h[14]=(ca*qa-ea*va-ba*wa)*Ca;h[15]=(S*va-U*qa+Y*wa)*Ca;return h},adjoint:function(h,p){var v=p[0],z=p[1],E=p[2],H=p[3],I=p[4],M=p[5],O=p[6],R=p[7],S=p[8],U=p[9],Y=p[10],X=p[11],ea=p[12],ca=p[13],ba=p[14];p=p[15];h[0]=M*(Y*p-X*ba)-U*(O*p-R*ba)+ca*(O*X-R*Y);h[1]=-(z*(Y*p-X*ba)-U*(E*p-H*ba)+ca*(E*X-H*Y));h[2]= z*(O*p-R*ba)-M*(E*p-H*ba)+ca*(E*R-H*O);h[3]=-(z*(O*X-R*Y)-M*(E*X-H*Y)+U*(E*R-H*O));h[4]=-(I*(Y*p-X*ba)-S*(O*p-R*ba)+ea*(O*X-R*Y));h[5]=v*(Y*p-X*ba)-S*(E*p-H*ba)+ea*(E*X-H*Y);h[6]=-(v*(O*p-R*ba)-I*(E*p-H*ba)+ea*(E*R-H*O));h[7]=v*(O*X-R*Y)-I*(E*X-H*Y)+S*(E*R-H*O);h[8]=I*(U*p-X*ca)-S*(M*p-R*ca)+ea*(M*X-R*U);h[9]=-(v*(U*p-X*ca)-S*(z*p-H*ca)+ea*(z*X-H*U));h[10]=v*(M*p-R*ca)-I*(z*p-H*ca)+ea*(z*R-H*M);h[11]=-(v*(M*X-R*U)-I*(z*X-H*U)+S*(z*R-H*M));h[12]=-(I*(U*ba-Y*ca)-S*(M*ba-O*ca)+ea*(M*Y-O*U));h[13]=v* (U*ba-Y*ca)-S*(z*ba-E*ca)+ea*(z*Y-E*U);h[14]=-(v*(M*ba-O*ca)-I*(z*ba-E*ca)+ea*(z*O-E*M));h[15]=v*(M*Y-O*U)-I*(z*Y-E*U)+S*(z*O-E*M);return h},determinant:function(h){var p=h[0],v=h[1],z=h[2],E=h[3],H=h[4],I=h[5],M=h[6],O=h[7],R=h[8],S=h[9],U=h[10],Y=h[11],X=h[12],ea=h[13],ca=h[14];h=h[15];return(p*I-v*H)*(U*h-Y*ca)-(p*M-z*H)*(S*h-Y*ea)+(p*O-E*H)*(S*ca-U*ea)+(v*M-z*I)*(R*h-Y*X)-(v*O-E*I)*(R*ca-U*X)+(z*O-E*M)*(R*ea-S*X)},multiply:m,translate:function(h,p,v){var z=v[0],E=v[1];v=v[2];if(p===h)h[12]=p[0]* z+p[4]*E+p[8]*v+p[12],h[13]=p[1]*z+p[5]*E+p[9]*v+p[13],h[14]=p[2]*z+p[6]*E+p[10]*v+p[14],h[15]=p[3]*z+p[7]*E+p[11]*v+p[15];else{var H=p[0];var I=p[1];var M=p[2];var O=p[3];var R=p[4];var S=p[5];var U=p[6];var Y=p[7];var X=p[8];var ea=p[9];var ca=p[10];var ba=p[11];h[0]=H;h[1]=I;h[2]=M;h[3]=O;h[4]=R;h[5]=S;h[6]=U;h[7]=Y;h[8]=X;h[9]=ea;h[10]=ca;h[11]=ba;h[12]=H*z+R*E+X*v+p[12];h[13]=I*z+S*E+ea*v+p[13];h[14]=M*z+U*E+ca*v+p[14];h[15]=O*z+Y*E+ba*v+p[15]}return h},scale:function(h,p,v){var z=v[0],E=v[1]; v=v[2];h[0]=p[0]*z;h[1]=p[1]*z;h[2]=p[2]*z;h[3]=p[3]*z;h[4]=p[4]*E;h[5]=p[5]*E;h[6]=p[6]*E;h[7]=p[7]*E;h[8]=p[8]*v;h[9]=p[9]*v;h[10]=p[10]*v;h[11]=p[11]*v;h[12]=p[12];h[13]=p[13];h[14]=p[14];h[15]=p[15];return h},rotate:function(h,p,v,z){var E=z[0],H=z[1];z=z[2];var I=Math.hypot(E,H,z);if(1E-6>I)return null;I=1/I;E*=I;H*=I;z*=I;var M=Math.sin(v);var O=Math.cos(v);var R=1-O;v=p[0];I=p[1];var S=p[2];var U=p[3];var Y=p[4];var X=p[5];var ea=p[6];var ca=p[7];var ba=p[8];var wa=p[9];var qa=p[10];var ua= p[11];var va=E*E*R+O;var ta=H*E*R+z*M;var Ha=z*E*R-H*M;var Ia=E*H*R-z*M;var Ja=H*H*R+O;var Ka=z*H*R+E*M;var Pa=E*z*R+H*M;E=H*z*R-E*M;H=z*z*R+O;h[0]=v*va+Y*ta+ba*Ha;h[1]=I*va+X*ta+wa*Ha;h[2]=S*va+ea*ta+qa*Ha;h[3]=U*va+ca*ta+ua*Ha;h[4]=v*Ia+Y*Ja+ba*Ka;h[5]=I*Ia+X*Ja+wa*Ka;h[6]=S*Ia+ea*Ja+qa*Ka;h[7]=U*Ia+ca*Ja+ua*Ka;h[8]=v*Pa+Y*E+ba*H;h[9]=I*Pa+X*E+wa*H;h[10]=S*Pa+ea*E+qa*H;h[11]=U*Pa+ca*E+ua*H;p!==h&&(h[12]=p[12],h[13]=p[13],h[14]=p[14],h[15]=p[15]);return h},rotateX:function(h,p,v){var z=Math.sin(v); v=Math.cos(v);var E=p[4],H=p[5],I=p[6],M=p[7],O=p[8],R=p[9],S=p[10],U=p[11];p!==h&&(h[0]=p[0],h[1]=p[1],h[2]=p[2],h[3]=p[3],h[12]=p[12],h[13]=p[13],h[14]=p[14],h[15]=p[15]);h[4]=E*v+O*z;h[5]=H*v+R*z;h[6]=I*v+S*z;h[7]=M*v+U*z;h[8]=O*v-E*z;h[9]=R*v-H*z;h[10]=S*v-I*z;h[11]=U*v-M*z;return h},rotateY:function(h,p,v){var z=Math.sin(v);v=Math.cos(v);var E=p[0],H=p[1],I=p[2],M=p[3],O=p[8],R=p[9],S=p[10],U=p[11];p!==h&&(h[4]=p[4],h[5]=p[5],h[6]=p[6],h[7]=p[7],h[12]=p[12],h[13]=p[13],h[14]=p[14],h[15]=p[15]); h[0]=E*v-O*z;h[1]=H*v-R*z;h[2]=I*v-S*z;h[3]=M*v-U*z;h[8]=E*z+O*v;h[9]=H*z+R*v;h[10]=I*z+S*v;h[11]=M*z+U*v;return h},rotateZ:function(h,p,v){var z=Math.sin(v);v=Math.cos(v);var E=p[0],H=p[1],I=p[2],M=p[3],O=p[4],R=p[5],S=p[6],U=p[7];p!==h&&(h[8]=p[8],h[9]=p[9],h[10]=p[10],h[11]=p[11],h[12]=p[12],h[13]=p[13],h[14]=p[14],h[15]=p[15]);h[0]=E*v+O*z;h[1]=H*v+R*z;h[2]=I*v+S*z;h[3]=M*v+U*z;h[4]=O*v-E*z;h[5]=R*v-H*z;h[6]=S*v-I*z;h[7]=U*v-M*z;return h},fromTranslation:function(h,p){h[0]=1;h[1]=0;h[2]=0;h[3]= 0;h[4]=0;h[5]=1;h[6]=0;h[7]=0;h[8]=0;h[9]=0;h[10]=1;h[11]=0;h[12]=p[0];h[13]=p[1];h[14]=p[2];h[15]=1;return h},fromScaling:function(h,p){h[0]=p[0];h[1]=0;h[2]=0;h[3]=0;h[4]=0;h[5]=p[1];h[6]=0;h[7]=0;h[8]=0;h[9]=0;h[10]=p[2];h[11]=0;h[12]=0;h[13]=0;h[14]=0;h[15]=1;return h},fromRotation:function(h,p,v){var z=v[0],E=v[1];v=v[2];var H=Math.hypot(z,E,v);if(1E-6>H)return null;H=1/H;z*=H;E*=H;v*=H;H=Math.sin(p);p=Math.cos(p);var I=1-p;h[0]=z*z*I+p;h[1]=E*z*I+v*H;h[2]=v*z*I-E*H;h[3]=0;h[4]=z*E*I-v*H;h[5]= E*E*I+p;h[6]=v*E*I+z*H;h[7]=0;h[8]=z*v*I+E*H;h[9]=E*v*I-z*H;h[10]=v*v*I+p;h[11]=0;h[12]=0;h[13]=0;h[14]=0;h[15]=1;return h},fromXRotation:function(h,p){var v=Math.sin(p);p=Math.cos(p);h[0]=1;h[1]=0;h[2]=0;h[3]=0;h[4]=0;h[5]=p;h[6]=v;h[7]=0;h[8]=0;h[9]=-v;h[10]=p;h[11]=0;h[12]=0;h[13]=0;h[14]=0;h[15]=1;return h},fromYRotation:function(h,p){var v=Math.sin(p);p=Math.cos(p);h[0]=p;h[1]=0;h[2]=-v;h[3]=0;h[4]=0;h[5]=1;h[6]=0;h[7]=0;h[8]=v;h[9]=0;h[10]=p;h[11]=0;h[12]=0;h[13]=0;h[14]=0;h[15]=1;return h}, fromZRotation:function(h,p){var v=Math.sin(p);p=Math.cos(p);h[0]=p;h[1]=v;h[2]=0;h[3]=0;h[4]=-v;h[5]=p;h[6]=0;h[7]=0;h[8]=0;h[9]=0;h[10]=1;h[11]=0;h[12]=0;h[13]=0;h[14]=0;h[15]=1;return h},fromRotationTranslation:u,fromQuat2:function(h,p){var v=new ra(3),z=-p[0],E=-p[1],H=-p[2],I=p[3],M=p[4],O=p[5],R=p[6],S=p[7],U=z*z+E*E+H*H+I*I;0<U?(v[0]=2*(M*I+S*z+O*H-R*E)/U,v[1]=2*(O*I+S*E+R*z-M*H)/U,v[2]=2*(R*I+S*H+M*E-O*z)/U):(v[0]=2*(M*I+S*z+O*H-R*E),v[1]=2*(O*I+S*E+R*z-M*H),v[2]=2*(R*I+S*H+M*E-O*z));u(h,p, v);return h},getTranslation:x,getScaling:n,getRotation:q,fromRotationTranslationScale:function(h,p,v,z){var E=p[0],H=p[1],I=p[2],M=p[3],O=E+E,R=H+H,S=I+I;p=E*O;var U=E*R;E*=S;var Y=H*R;H*=S;I*=S;O*=M;R*=M;M*=S;S=z[0];var X=z[1];z=z[2];h[0]=(1-(Y+I))*S;h[1]=(U+M)*S;h[2]=(E-R)*S;h[3]=0;h[4]=(U-M)*X;h[5]=(1-(p+I))*X;h[6]=(H+O)*X;h[7]=0;h[8]=(E+R)*z;h[9]=(H-O)*z;h[10]=(1-(p+Y))*z;h[11]=0;h[12]=v[0];h[13]=v[1];h[14]=v[2];h[15]=1;return h},fromRotationTranslationScaleOrigin:function(h,p,v,z,E){var H=p[0], I=p[1],M=p[2],O=p[3],R=H+H,S=I+I,U=M+M;p=H*R;var Y=H*S,X=H*U;H=I*S;I*=U;var ea=M*U;M=O*R;S*=O;var ca=O*U,ba=z[0],wa=z[1];U=z[2];z=E[0];O=E[1];E=E[2];R=(1-(H+ea))*ba;var qa=(Y+ca)*ba;ba*=X-S;Y=(Y-ca)*wa;ea=(1-(p+ea))*wa;wa*=I+M;X=(X+S)*U;I=(I-M)*U;p=(1-(p+H))*U;h[0]=R;h[1]=qa;h[2]=ba;h[3]=0;h[4]=Y;h[5]=ea;h[6]=wa;h[7]=0;h[8]=X;h[9]=I;h[10]=p;h[11]=0;h[12]=v[0]+z-(R*z+Y*O+X*E);h[13]=v[1]+O-(qa*z+ea*O+I*E);h[14]=v[2]+E-(ba*z+wa*O+p*E);h[15]=1;return h},fromQuat:function(h,p){var v=p[0],z=p[1],E=p[2]; p=p[3];var H=v+v,I=z+z,M=E+E;v*=H;var O=z*H;z*=I;var R=E*H,S=E*I;E*=M;H*=p;I*=p;p*=M;h[0]=1-z-E;h[1]=O+p;h[2]=R-I;h[3]=0;h[4]=O-p;h[5]=1-v-E;h[6]=S+H;h[7]=0;h[8]=R+I;h[9]=S-H;h[10]=1-v-z;h[11]=0;h[12]=0;h[13]=0;h[14]=0;h[15]=1;return h},frustum:function(h,p,v,z,E,H,I){var M=1/(v-p),O=1/(E-z),R=1/(H-I);h[0]=2*H*M;h[1]=0;h[2]=0;h[3]=0;h[4]=0;h[5]=2*H*O;h[6]=0;h[7]=0;h[8]=(v+p)*M;h[9]=(E+z)*O;h[10]=(I+H)*R;h[11]=-1;h[12]=0;h[13]=0;h[14]=I*H*2*R;h[15]=0;return h},perspective:function(h,p,v,z,E){p=1/Math.tan(p/ 2);h[0]=p/v;h[1]=0;h[2]=0;h[3]=0;h[4]=0;h[5]=p;h[6]=0;h[7]=0;h[8]=0;h[9]=0;h[11]=-1;h[12]=0;h[13]=0;h[15]=0;null!=E&&Infinity!==E?(v=1/(z-E),h[10]=(E+z)*v,h[14]=2*E*z*v):(h[10]=-1,h[14]=-2*z);return h},perspectiveFromFieldOfView:function(h,p,v,z){var E=Math.tan(p.upDegrees*Math.PI/180),H=Math.tan(p.downDegrees*Math.PI/180),I=Math.tan(p.leftDegrees*Math.PI/180);p=Math.tan(p.rightDegrees*Math.PI/180);var M=2/(I+p),O=2/(E+H);h[0]=M;h[1]=0;h[2]=0;h[3]=0;h[4]=0;h[5]=O;h[6]=0;h[7]=0;h[8]=-((I-p)*M*.5); h[9]=(E-H)*O*.5;h[10]=z/(v-z);h[11]=-1;h[12]=0;h[13]=0;h[14]=z*v/(v-z);h[15]=0;return h},ortho:function(h,p,v,z,E,H,I){var M=1/(p-v),O=1/(z-E),R=1/(H-I);h[0]=-2*M;h[1]=0;h[2]=0;h[3]=0;h[4]=0;h[5]=-2*O;h[6]=0;h[7]=0;h[8]=0;h[9]=0;h[10]=2*R;h[11]=0;h[12]=(p+v)*M;h[13]=(E+z)*O;h[14]=(I+H)*R;h[15]=1;return h},lookAt:function(h,p,v,z){var E=p[0],H=p[1];p=p[2];var I=z[0];var M=z[1];var O=z[2];var R=v[0];z=v[1];var S=v[2];if(1E-6>Math.abs(E-R)&&1E-6>Math.abs(H-z)&&1E-6>Math.abs(p-S))return k(h);v=E-R;z= H-z;R=p-S;var U=1/Math.hypot(v,z,R);v*=U;z*=U;R*=U;S=M*R-O*z;O=O*v-I*R;I=I*z-M*v;(U=Math.hypot(S,O,I))?(U=1/U,S*=U,O*=U,I*=U):I=O=S=0;M=z*I-R*O;var Y=R*S-v*I;var X=v*O-z*S;(U=Math.hypot(M,Y,X))?(U=1/U,M*=U,Y*=U,X*=U):X=Y=M=0;h[0]=S;h[1]=M;h[2]=v;h[3]=0;h[4]=O;h[5]=Y;h[6]=z;h[7]=0;h[8]=I;h[9]=X;h[10]=R;h[11]=0;h[12]=-(S*E+O*H+I*p);h[13]=-(M*E+Y*H+X*p);h[14]=-(v*E+z*H+R*p);h[15]=1;return h},targetTo:function(h,p,v,z){var E=p[0],H=p[1];p=p[2];var I=z[0],M=z[1],O=z[2];z=E-v[0];var R=H-v[1];v=p-v[2];var S= z*z+R*R+v*v;0<S&&(S=1/Math.sqrt(S),z*=S,R*=S,v*=S);var U=M*v-O*R;O=O*z-I*v;I=I*R-M*z;S=U*U+O*O+I*I;0<S&&(S=1/Math.sqrt(S),U*=S,O*=S,I*=S);h[0]=U;h[1]=O;h[2]=I;h[3]=0;h[4]=R*I-v*O;h[5]=v*U-z*I;h[6]=z*O-R*U;h[7]=0;h[8]=z;h[9]=R;h[10]=v;h[11]=0;h[12]=E;h[13]=H;h[14]=p;h[15]=1;return h},str:function(h){return"mat4("+h[0]+", "+h[1]+", "+h[2]+", "+h[3]+", "+h[4]+", "+h[5]+", "+h[6]+", "+h[7]+", "+h[8]+", "+h[9]+", "+h[10]+", "+h[11]+", "+h[12]+", "+h[13]+", "+h[14]+", "+h[15]+")"},frob:function(h){return Math.hypot(h[0], h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15])},add:function(h,p,v){h[0]=p[0]+v[0];h[1]=p[1]+v[1];h[2]=p[2]+v[2];h[3]=p[3]+v[3];h[4]=p[4]+v[4];h[5]=p[5]+v[5];h[6]=p[6]+v[6];h[7]=p[7]+v[7];h[8]=p[8]+v[8];h[9]=p[9]+v[9];h[10]=p[10]+v[10];h[11]=p[11]+v[11];h[12]=p[12]+v[12];h[13]=p[13]+v[13];h[14]=p[14]+v[14];h[15]=p[15]+v[15];return h},subtract:t,multiplyScalar:function(h,p,v){h[0]=p[0]*v;h[1]=p[1]*v;h[2]=p[2]*v;h[3]=p[3]*v;h[4]=p[4]*v;h[5]=p[5]*v;h[6]=p[6]*v;h[7]= p[7]*v;h[8]=p[8]*v;h[9]=p[9]*v;h[10]=p[10]*v;h[11]=p[11]*v;h[12]=p[12]*v;h[13]=p[13]*v;h[14]=p[14]*v;h[15]=p[15]*v;return h},multiplyScalarAndAdd:function(h,p,v,z){h[0]=p[0]+v[0]*z;h[1]=p[1]+v[1]*z;h[2]=p[2]+v[2]*z;h[3]=p[3]+v[3]*z;h[4]=p[4]+v[4]*z;h[5]=p[5]+v[5]*z;h[6]=p[6]+v[6]*z;h[7]=p[7]+v[7]*z;h[8]=p[8]+v[8]*z;h[9]=p[9]+v[9]*z;h[10]=p[10]+v[10]*z;h[11]=p[11]+v[11]*z;h[12]=p[12]+v[12]*z;h[13]=p[13]+v[13]*z;h[14]=p[14]+v[14]*z;h[15]=p[15]+v[15]*z;return h},exactEquals:function(h,p){return h[0]=== p[0]&&h[1]===p[1]&&h[2]===p[2]&&h[3]===p[3]&&h[4]===p[4]&&h[5]===p[5]&&h[6]===p[6]&&h[7]===p[7]&&h[8]===p[8]&&h[9]===p[9]&&h[10]===p[10]&&h[11]===p[11]&&h[12]===p[12]&&h[13]===p[13]&&h[14]===p[14]&&h[15]===p[15]},equals:function(h,p){var v=h[0],z=h[1],E=h[2],H=h[3],I=h[4],M=h[5],O=h[6],R=h[7],S=h[8],U=h[9],Y=h[10],X=h[11],ea=h[12],ca=h[13],ba=h[14];h=h[15];var wa=p[0],qa=p[1],ua=p[2],va=p[3],ta=p[4],Ha=p[5],Ia=p[6],Ja=p[7],Ka=p[8],Pa=p[9],Va=p[10],Wa=p[11],Ca=p[12],Bb=p[13],Cb=p[14];p=p[15];return Math.abs(v- wa)<=1E-6*Math.max(1,Math.abs(v),Math.abs(wa))&&Math.abs(z-qa)<=1E-6*Math.max(1,Math.abs(z),Math.abs(qa))&&Math.abs(E-ua)<=1E-6*Math.max(1,Math.abs(E),Math.abs(ua))&&Math.abs(H-va)<=1E-6*Math.max(1,Math.abs(H),Math.abs(va))&&Math.abs(I-ta)<=1E-6*Math.max(1,Math.abs(I),Math.abs(ta))&&Math.abs(M-Ha)<=1E-6*Math.max(1,Math.abs(M),Math.abs(Ha))&&Math.abs(O-Ia)<=1E-6*Math.max(1,Math.abs(O),Math.abs(Ia))&&Math.abs(R-Ja)<=1E-6*Math.max(1,Math.abs(R),Math.abs(Ja))&&Math.abs(S-Ka)<=1E-6*Math.max(1,Math.abs(S), Math.abs(Ka))&&Math.abs(U-Pa)<=1E-6*Math.max(1,Math.abs(U),Math.abs(Pa))&&Math.abs(Y-Va)<=1E-6*Math.max(1,Math.abs(Y),Math.abs(Va))&&Math.abs(X-Wa)<=1E-6*Math.max(1,Math.abs(X),Math.abs(Wa))&&Math.abs(ea-Ca)<=1E-6*Math.max(1,Math.abs(ea),Math.abs(Ca))&&Math.abs(ca-Bb)<=1E-6*Math.max(1,Math.abs(ca),Math.abs(Bb))&&Math.abs(ba-Cb)<=1E-6*Math.max(1,Math.abs(ba),Math.abs(Cb))&&Math.abs(h-p)<=1E-6*Math.max(1,Math.abs(h),Math.abs(p))},mul:m,sub:t}),kb=function(){var h=r();return function(p,v,z,E,H,I){v|| (v=3);z||(z=0);for(E=E?Math.min(E*v+z,p.length):p.length;z<E;z+=v)h[0]=p[z],h[1]=p[z+1],h[2]=p[z+2],H(h,h,I),p[z]=h[0],p[z+1]=h[1],p[z+2]=h[2];return p}}();kb=Object.freeze({__proto__:null,create:r,clone:function(h){var p=new ra(3);p[0]=h[0];p[1]=h[1];p[2]=h[2];return p},length:w,fromValues:y,copy:function(h,p){h[0]=p[0];h[1]=p[1];h[2]=p[2];return h},set:function(h,p,v,z){h[0]=p;h[1]=v;h[2]=z;return h},add:function(h,p,v){h[0]=p[0]+v[0];h[1]=p[1]+v[1];h[2]=p[2]+v[2];return h},subtract:C,multiply:D, divide:G,ceil:function(h,p){h[0]=Math.ceil(p[0]);h[1]=Math.ceil(p[1]);h[2]=Math.ceil(p[2]);return h},floor:function(h,p){h[0]=Math.floor(p[0]);h[1]=Math.floor(p[1]);h[2]=Math.floor(p[2]);return h},min:function(h,p,v){h[0]=Math.min(p[0],v[0]);h[1]=Math.min(p[1],v[1]);h[2]=Math.min(p[2],v[2]);return h},max:function(h,p,v){h[0]=Math.max(p[0],v[0]);h[1]=Math.max(p[1],v[1]);h[2]=Math.max(p[2],v[2]);return h},round:function(h,p){h[0]=Math.round(p[0]);h[1]=Math.round(p[1]);h[2]=Math.round(p[2]);return h}, scale:function(h,p,v){h[0]=p[0]*v;h[1]=p[1]*v;h[2]=p[2]*v;return h},scaleAndAdd:function(h,p,v,z){h[0]=p[0]+v[0]*z;h[1]=p[1]+v[1]*z;h[2]=p[2]+v[2]*z;return h},distance:K,squaredDistance:B,squaredLength:A,negate:function(h,p){h[0]=-p[0];h[1]=-p[1];h[2]=-p[2];return h},inverse:function(h,p){h[0]=1/p[0];h[1]=1/p[1];h[2]=1/p[2];return h},normalize:F,dot:J,cross:L,lerp:function(h,p,v,z){var E=p[0],H=p[1];p=p[2];h[0]=E+z*(v[0]-E);h[1]=H+z*(v[1]-H);h[2]=p+z*(v[2]-p);return h},hermite:function(h,p,v,z,E, H){var I=H*H,M=I*(2*H-3)+1,O=I*(H-2)+H,R=I*(H-1);H=I*(3-2*H);h[0]=p[0]*M+v[0]*O+z[0]*R+E[0]*H;h[1]=p[1]*M+v[1]*O+z[1]*R+E[1]*H;h[2]=p[2]*M+v[2]*O+z[2]*R+E[2]*H;return h},bezier:function(h,p,v,z,E,H){var I=1-H,M=I*I,O=H*H,R=M*I;M*=3*H;I*=3*O;H*=O;h[0]=p[0]*R+v[0]*M+z[0]*I+E[0]*H;h[1]=p[1]*R+v[1]*M+z[1]*I+E[1]*H;h[2]=p[2]*R+v[2]*M+z[2]*I+E[2]*H;return h},random:function(h,p){p=p||1;var v=2*Ra()*Math.PI,z=2*Ra()-1,E=Math.sqrt(1-z*z)*p;h[0]=Math.cos(v)*E;h[1]=Math.sin(v)*E;h[2]=z*p;return h},transformMat4:function(h, p,v){var z=p[0],E=p[1];p=p[2];var H=v[3]*z+v[7]*E+v[11]*p+v[15];H=H||1;h[0]=(v[0]*z+v[4]*E+v[8]*p+v[12])/H;h[1]=(v[1]*z+v[5]*E+v[9]*p+v[13])/H;h[2]=(v[2]*z+v[6]*E+v[10]*p+v[14])/H;return h},transformMat3:function(h,p,v){var z=p[0],E=p[1];p=p[2];h[0]=z*v[0]+E*v[3]+p*v[6];h[1]=z*v[1]+E*v[4]+p*v[7];h[2]=z*v[2]+E*v[5]+p*v[8];return h},transformQuat:function(h,p,v){var z=v[0],E=v[1],H=v[2],I=p[0],M=p[1];p=p[2];var O=E*p-H*M,R=H*I-z*p,S=z*M-E*I;v=2*v[3];h[0]=I+O*v+2*(E*S-H*R);h[1]=M+R*v+2*(H*O-z*S);h[2]= p+S*v+2*(z*R-E*O);return h},rotateX:function(h,p,v,z){var E=[],H=[];E[0]=p[0]-v[0];E[1]=p[1]-v[1];E[2]=p[2]-v[2];H[0]=E[0];H[1]=E[1]*Math.cos(z)-E[2]*Math.sin(z);H[2]=E[1]*Math.sin(z)+E[2]*Math.cos(z);h[0]=H[0]+v[0];h[1]=H[1]+v[1];h[2]=H[2]+v[2];return h},rotateY:function(h,p,v,z){var E=[],H=[];E[0]=p[0]-v[0];E[1]=p[1]-v[1];E[2]=p[2]-v[2];H[0]=E[2]*Math.sin(z)+E[0]*Math.cos(z);H[1]=E[1];H[2]=E[2]*Math.cos(z)-E[0]*Math.sin(z);h[0]=H[0]+v[0];h[1]=H[1]+v[1];h[2]=H[2]+v[2];return h},rotateZ:function(h, p,v,z){var E=[],H=[];E[0]=p[0]-v[0];E[1]=p[1]-v[1];E[2]=p[2]-v[2];H[0]=E[0]*Math.cos(z)-E[1]*Math.sin(z);H[1]=E[0]*Math.sin(z)+E[1]*Math.cos(z);H[2]=E[2];h[0]=H[0]+v[0];h[1]=H[1]+v[1];h[2]=H[2]+v[2];return h},angle:function(h,p){var v=h[0],z=h[1],E=h[2],H=p[0],I=p[1],M=p[2];h=(v=Math.sqrt(v*v+z*z+E*E)*Math.sqrt(H*H+I*I+M*M))&&J(h,p)/v;return Math.acos(Math.min(Math.max(h,-1),1))},zero:function(h){h[0]=0;h[1]=0;h[2]=0;return h},str:function(h){return"vec3("+h[0]+", "+h[1]+", "+h[2]+")"},exactEquals:function(h, p){return h[0]===p[0]&&h[1]===p[1]&&h[2]===p[2]},equals:function(h,p){var v=h[0],z=h[1];h=h[2];var E=p[0],H=p[1];p=p[2];return Math.abs(v-E)<=1E-6*Math.max(1,Math.abs(v),Math.abs(E))&&Math.abs(z-H)<=1E-6*Math.max(1,Math.abs(z),Math.abs(H))&&Math.abs(h-p)<=1E-6*Math.max(1,Math.abs(h),Math.abs(p))},sub:C,mul:D,div:G,dist:K,sqrDist:B,len:w,sqrLen:A,forEach:kb});var lb=function(){var h=Q();return function(p,v,z,E,H,I){v||(v=4);z||(z=0);for(E=E?Math.min(E*v+z,p.length):p.length;z<E;z+=v)h[0]=p[z],h[1]= p[z+1],h[2]=p[z+2],h[3]=p[z+3],H(h,h,I),p[z]=h[0],p[z+1]=h[1],p[z+2]=h[2],p[z+3]=h[3];return p}}();lb=Object.freeze({__proto__:null,create:Q,clone:T,fromValues:V,copy:aa,set:ha,add:ja,subtract:oa,multiply:ya,divide:Ba,ceil:function(h,p){h[0]=Math.ceil(p[0]);h[1]=Math.ceil(p[1]);h[2]=Math.ceil(p[2]);h[3]=Math.ceil(p[3]);return h},floor:function(h,p){h[0]=Math.floor(p[0]);h[1]=Math.floor(p[1]);h[2]=Math.floor(p[2]);h[3]=Math.floor(p[3]);return h},min:function(h,p,v){h[0]=Math.min(p[0],v[0]);h[1]=Math.min(p[1], v[1]);h[2]=Math.min(p[2],v[2]);h[3]=Math.min(p[3],v[3]);return h},max:function(h,p,v){h[0]=Math.max(p[0],v[0]);h[1]=Math.max(p[1],v[1]);h[2]=Math.max(p[2],v[2]);h[3]=Math.max(p[3],v[3]);return h},round:function(h,p){h[0]=Math.round(p[0]);h[1]=Math.round(p[1]);h[2]=Math.round(p[2]);h[3]=Math.round(p[3]);return h},scale:La,scaleAndAdd:function(h,p,v,z){h[0]=p[0]+v[0]*z;h[1]=p[1]+v[1]*z;h[2]=p[2]+v[2]*z;h[3]=p[3]+v[3]*z;return h},distance:Da,squaredDistance:Ga,length:ma,squaredLength:Oa,negate:function(h, p){h[0]=-p[0];h[1]=-p[1];h[2]=-p[2];h[3]=-p[3];return h},inverse:function(h,p){h[0]=1/p[0];h[1]=1/p[1];h[2]=1/p[2];h[3]=1/p[3];return h},normalize:Aa,dot:Ma,cross:function(h,p,v,z){var E=v[0]*z[1]-v[1]*z[0],H=v[0]*z[2]-v[2]*z[0],I=v[0]*z[3]-v[3]*z[0],M=v[1]*z[2]-v[2]*z[1],O=v[1]*z[3]-v[3]*z[1];v=v[2]*z[3]-v[3]*z[2];z=p[0];var R=p[1],S=p[2];p=p[3];h[0]=R*v-S*O+p*M;h[1]=-(z*v)+S*I-p*H;h[2]=z*O-R*I+p*E;h[3]=-(z*M)+R*H-S*E;return h},lerp:bb,random:function(h,p){p=p||1;do{var v=2*Ra()-1;var z=2*Ra()-1; var E=v*v+z*z}while(1<=E);do{var H=2*Ra()-1;var I=2*Ra()-1;var M=H*H+I*I}while(1<=M);E=Math.sqrt((1-E)/M);h[0]=p*v;h[1]=p*z;h[2]=p*H*E;h[3]=p*I*E;return h},transformMat4:function(h,p,v){var z=p[0],E=p[1],H=p[2];p=p[3];h[0]=v[0]*z+v[4]*E+v[8]*H+v[12]*p;h[1]=v[1]*z+v[5]*E+v[9]*H+v[13]*p;h[2]=v[2]*z+v[6]*E+v[10]*H+v[14]*p;h[3]=v[3]*z+v[7]*E+v[11]*H+v[15]*p;return h},transformQuat:function(h,p,v){var z=p[0],E=p[1],H=p[2],I=v[0],M=v[1],O=v[2];v=v[3];var R=v*z+M*H-O*E,S=v*E+O*z-I*H,U=v*H+I*E-M*z;z=-I*z- M*E-O*H;h[0]=R*v+z*-I+S*-O-U*-M;h[1]=S*v+z*-M+U*-I-R*-O;h[2]=U*v+z*-O+R*-M-S*-I;h[3]=p[3];return h},zero:function(h){h[0]=0;h[1]=0;h[2]=0;h[3]=0;return h},str:function(h){return"vec4("+h[0]+", "+h[1]+", "+h[2]+", "+h[3]+")"},exactEquals:cb,equals:db,sub:oa,mul:ya,div:Ba,dist:Da,sqrDist:Ga,len:ma,sqrLen:Oa,forEach:lb});var mb=function(){var h=r(),p=y(1,0,0),v=y(0,1,0);return function(z,E,H){var I=J(E,H);if(-.999999>I)return L(h,p,E),1E-6>w(h)&&L(h,v,E),F(h,h),ob(z,h,Math.PI),z;if(.999999<I)return z[0]= 0,z[1]=0,z[2]=0,z[3]=1,z;L(h,E,H);z[0]=h[0];z[1]=h[1];z[2]=h[2];z[3]=1+I;return Aa(z,z)}}(),nb=function(){var h=Ya(),p=Ya();return function(v,z,E,H,I,M){eb(h,z,I,M);eb(p,E,H,M);eb(v,h,p,2*M*(1-M));return v}}(),$a=function(){var h=f();return function(p,v,z,E){h[0]=z[0];h[3]=z[1];h[6]=z[2];h[1]=E[0];h[4]=E[1];h[7]=E[2];h[2]=-v[0];h[5]=-v[1];h[8]=-v[2];return Aa(p,vb(p,h))}}();mb=Object.freeze({__proto__:null,create:Ya,identity:function(h){h[0]=0;h[1]=0;h[2]=0;h[3]=1;return h},setAxisAngle:ob,getAxisAngle:function(h, p){var v=2*Math.acos(p[3]),z=Math.sin(v/2);1E-6<z?(h[0]=p[0]/z,h[1]=p[1]/z,h[2]=p[2]/z):(h[0]=1,h[1]=0,h[2]=0);return v},getAngle:function(h,p){h=Ma(h,p);return Math.acos(2*h*h-1)},multiply:pb,rotateX:qb,rotateY:rb,rotateZ:sb,calculateW:function(h,p){var v=p[0],z=p[1];p=p[2];h[0]=v;h[1]=z;h[2]=p;h[3]=Math.sqrt(Math.abs(1-v*v-z*z-p*p));return h},exp:tb,ln:ub,pow:function(h,p,v){ub(h,p);La(h,h,v);tb(h,h);return h},slerp:eb,random:function(h){var p=Ra(),v=Ra(),z=Ra(),E=Math.sqrt(1-p);p=Math.sqrt(p); h[0]=E*Math.sin(2*Math.PI*v);h[1]=E*Math.cos(2*Math.PI*v);h[2]=p*Math.sin(2*Math.PI*z);h[3]=p*Math.cos(2*Math.PI*z);return h},invert:function(h,p){var v=p[0],z=p[1],E=p[2];p=p[3];var H=v*v+z*z+E*E+p*p;H=H?1/H:0;h[0]=-v*H;h[1]=-z*H;h[2]=-E*H;h[3]=p*H;return h},conjugate:function(h,p){h[0]=-p[0];h[1]=-p[1];h[2]=-p[2];h[3]=p[3];return h},fromMat3:vb,fromEuler:function(h,p,v,z){var E=.5*Math.PI/180;p*=E;v*=E;z*=E;E=Math.sin(p);p=Math.cos(p);var H=Math.sin(v);v=Math.cos(v);var I=Math.sin(z);z=Math.cos(z); h[0]=E*v*z-p*H*I;h[1]=p*H*z+E*v*I;h[2]=p*v*I-E*H*z;h[3]=p*v*z+E*H*I;return h},str:function(h){return"quat("+h[0]+", "+h[1]+", "+h[2]+", "+h[3]+")"},clone:T,fromValues:V,copy:aa,set:ha,add:ja,mul:pb,scale:La,dot:Ma,lerp:bb,length:ma,len:ma,squaredLength:Oa,sqrLen:Oa,normalize:Aa,exactEquals:cb,equals:db,rotationTo:mb,sqlerp:nb,setAxes:$a});nb=Object.freeze({__proto__:null,create:function(){var h=new ra(8);ra!=Float32Array&&(h[0]=0,h[1]=0,h[2]=0,h[4]=0,h[5]=0,h[6]=0,h[7]=0);h[3]=1;return h},clone:function(h){var p= new ra(8);p[0]=h[0];p[1]=h[1];p[2]=h[2];p[3]=h[3];p[4]=h[4];p[5]=h[5];p[6]=h[6];p[7]=h[7];return p},fromValues:function(h,p,v,z,E,H,I,M){var O=new ra(8);O[0]=h;O[1]=p;O[2]=v;O[3]=z;O[4]=E;O[5]=H;O[6]=I;O[7]=M;return O},fromRotationTranslationValues:function(h,p,v,z,E,H,I){var M=new ra(8);M[0]=h;M[1]=p;M[2]=v;M[3]=z;E*=.5;H*=.5;I*=.5;M[4]=E*z+H*v-I*p;M[5]=H*z+I*h-E*v;M[6]=I*z+E*p-H*h;M[7]=-E*h-H*p-I*v;return M},fromRotationTranslation:wb,fromTranslation:function(h,p){h[0]=0;h[1]=0;h[2]=0;h[3]=1;h[4]= .5*p[0];h[5]=.5*p[1];h[6]=.5*p[2];h[7]=0;return h},fromRotation:function(h,p){h[0]=p[0];h[1]=p[1];h[2]=p[2];h[3]=p[3];h[4]=0;h[5]=0;h[6]=0;h[7]=0;return h},fromMat4:function(h,p){var v=Ya();q(v,p);var z=new ra(3);x(z,p);wb(h,v,z);return h},copy:xb,identity:function(h){h[0]=0;h[1]=0;h[2]=0;h[3]=1;h[4]=0;h[5]=0;h[6]=0;h[7]=0;return h},set:function(h,p,v,z,E,H,I,M,O){h[0]=p;h[1]=v;h[2]=z;h[3]=E;h[4]=H;h[5]=I;h[6]=M;h[7]=O;return h},getReal:aa,getDual:function(h,p){h[0]=p[4];h[1]=p[5];h[2]=p[6];h[3]= p[7];return h},setReal:aa,setDual:function(h,p){h[4]=p[0];h[5]=p[1];h[6]=p[2];h[7]=p[3];return h},getTranslation:function(h,p){var v=p[4],z=p[5],E=p[6],H=p[7],I=-p[0],M=-p[1],O=-p[2];p=p[3];h[0]=2*(v*p+H*I+z*O-E*M);h[1]=2*(z*p+H*M+E*I-v*O);h[2]=2*(E*p+H*O+v*M-z*I);return h},translate:function(h,p,v){var z=p[0],E=p[1],H=p[2],I=p[3],M=.5*v[0],O=.5*v[1];v=.5*v[2];var R=p[4],S=p[5],U=p[6];p=p[7];h[0]=z;h[1]=E;h[2]=H;h[3]=I;h[4]=I*M+E*v-H*O+R;h[5]=I*O+H*M-z*v+S;h[6]=I*v+z*O-E*M+U;h[7]=-z*M-E*O-H*v+p;return h}, rotateX:function(h,p,v){var z=-p[0],E=-p[1],H=-p[2],I=p[3],M=p[4],O=p[5],R=p[6],S=p[7],U=M*I+S*z+O*H-R*E,Y=O*I+S*E+R*z-M*H,X=R*I+S*H+M*E-O*z;M=S*I-M*z-O*E-R*H;qb(h,p,v);z=h[0];E=h[1];H=h[2];I=h[3];h[4]=U*I+M*z+Y*H-X*E;h[5]=Y*I+M*E+X*z-U*H;h[6]=X*I+M*H+U*E-Y*z;h[7]=M*I-U*z-Y*E-X*H;return h},rotateY:function(h,p,v){var z=-p[0],E=-p[1],H=-p[2],I=p[3],M=p[4],O=p[5],R=p[6],S=p[7],U=M*I+S*z+O*H-R*E,Y=O*I+S*E+R*z-M*H,X=R*I+S*H+M*E-O*z;M=S*I-M*z-O*E-R*H;rb(h,p,v);z=h[0];E=h[1];H=h[2];I=h[3];h[4]=U*I+M*z+ Y*H-X*E;h[5]=Y*I+M*E+X*z-U*H;h[6]=X*I+M*H+U*E-Y*z;h[7]=M*I-U*z-Y*E-X*H;return h},rotateZ:function(h,p,v){var z=-p[0],E=-p[1],H=-p[2],I=p[3],M=p[4],O=p[5],R=p[6],S=p[7],U=M*I+S*z+O*H-R*E,Y=O*I+S*E+R*z-M*H,X=R*I+S*H+M*E-O*z;M=S*I-M*z-O*E-R*H;sb(h,p,v);z=h[0];E=h[1];H=h[2];I=h[3];h[4]=U*I+M*z+Y*H-X*E;h[5]=Y*I+M*E+X*z-U*H;h[6]=X*I+M*H+U*E-Y*z;h[7]=M*I-U*z-Y*E-X*H;return h},rotateByQuatAppend:function(h,p,v){var z=v[0],E=v[1],H=v[2];v=v[3];var I=p[0],M=p[1],O=p[2],R=p[3];h[0]=I*v+R*z+M*H-O*E;h[1]=M*v+ R*E+O*z-I*H;h[2]=O*v+R*H+I*E-M*z;h[3]=R*v-I*z-M*E-O*H;I=p[4];M=p[5];O=p[6];R=p[7];h[4]=I*v+R*z+M*H-O*E;h[5]=M*v+R*E+O*z-I*H;h[6]=O*v+R*H+I*E-M*z;h[7]=R*v-I*z-M*E-O*H;return h},rotateByQuatPrepend:function(h,p,v){var z=p[0],E=p[1],H=p[2];p=p[3];var I=v[0],M=v[1],O=v[2],R=v[3];h[0]=z*R+p*I+E*O-H*M;h[1]=E*R+p*M+H*I-z*O;h[2]=H*R+p*O+z*M-E*I;h[3]=p*R-z*I-E*M-H*O;I=v[4];M=v[5];O=v[6];R=v[7];h[4]=z*R+p*I+E*O-H*M;h[5]=E*R+p*M+H*I-z*O;h[6]=H*R+p*O+z*M-E*I;h[7]=p*R-z*I-E*M-H*O;return h},rotateAroundAxis:function(h, p,v,z){if(1E-6>Math.abs(z))return xb(h,p);var E=Math.hypot(v[0],v[1],v[2]);z*=.5;var H=Math.sin(z),I=H*v[0]/E,M=H*v[1]/E;v=H*v[2]/E;z=Math.cos(z);E=p[0];H=p[1];var O=p[2],R=p[3];h[0]=E*z+R*I+H*v-O*M;h[1]=H*z+R*M+O*I-E*v;h[2]=O*z+R*v+E*M-H*I;h[3]=R*z-E*I-H*M-O*v;E=p[4];H=p[5];O=p[6];p=p[7];h[4]=E*z+p*I+H*v-O*M;h[5]=H*z+p*M+O*I-E*v;h[6]=O*z+p*v+E*M-H*I;h[7]=p*z-E*I-H*M-O*v;return h},add:function(h,p,v){h[0]=p[0]+v[0];h[1]=p[1]+v[1];h[2]=p[2]+v[2];h[3]=p[3]+v[3];h[4]=p[4]+v[4];h[5]=p[5]+v[5];h[6]=p[6]+ v[6];h[7]=p[7]+v[7];return h},multiply:yb,mul:yb,scale:function(h,p,v){h[0]=p[0]*v;h[1]=p[1]*v;h[2]=p[2]*v;h[3]=p[3]*v;h[4]=p[4]*v;h[5]=p[5]*v;h[6]=p[6]*v;h[7]=p[7]*v;return h},dot:Ma,lerp:function(h,p,v,z){var E=1-z;0>Ma(p,v)&&(z=-z);h[0]=p[0]*E+v[0]*z;h[1]=p[1]*E+v[1]*z;h[2]=p[2]*E+v[2]*z;h[3]=p[3]*E+v[3]*z;h[4]=p[4]*E+v[4]*z;h[5]=p[5]*E+v[5]*z;h[6]=p[6]*E+v[6]*z;h[7]=p[7]*E+v[7]*z;return h},invert:function(h,p){var v=Oa(p);h[0]=-p[0]/v;h[1]=-p[1]/v;h[2]=-p[2]/v;h[3]=p[3]/v;h[4]=-p[4]/v;h[5]=-p[5]/ v;h[6]=-p[6]/v;h[7]=p[7]/v;return h},conjugate:function(h,p){h[0]=-p[0];h[1]=-p[1];h[2]=-p[2];h[3]=p[3];h[4]=-p[4];h[5]=-p[5];h[6]=-p[6];h[7]=p[7];return h},length:ma,len:ma,squaredLength:Oa,sqrLen:Oa,normalize:function(h,p){var v=Oa(p);if(0<v){v=Math.sqrt(v);var z=p[0]/v,E=p[1]/v,H=p[2]/v,I=p[3]/v,M=p[4],O=p[5],R=p[6];p=p[7];var S=z*M+E*O+H*R+I*p;h[0]=z;h[1]=E;h[2]=H;h[3]=I;h[4]=(M-z*S)/v;h[5]=(O-E*S)/v;h[6]=(R-H*S)/v;h[7]=(p-I*S)/v}return h},str:function(h){return"quat2("+h[0]+", "+h[1]+", "+h[2]+ ", "+h[3]+", "+h[4]+", "+h[5]+", "+h[6]+", "+h[7]+")"},exactEquals:function(h,p){return h[0]===p[0]&&h[1]===p[1]&&h[2]===p[2]&&h[3]===p[3]&&h[4]===p[4]&&h[5]===p[5]&&h[6]===p[6]&&h[7]===p[7]},equals:function(h,p){var v=h[0],z=h[1],E=h[2],H=h[3],I=h[4],M=h[5],O=h[6];h=h[7];var R=p[0],S=p[1],U=p[2],Y=p[3],X=p[4],ea=p[5],ca=p[6];p=p[7];return Math.abs(v-R)<=1E-6*Math.max(1,Math.abs(v),Math.abs(R))&&Math.abs(z-S)<=1E-6*Math.max(1,Math.abs(z),Math.abs(S))&&Math.abs(E-U)<=1E-6*Math.max(1,Math.abs(E),Math.abs(U))&& Math.abs(H-Y)<=1E-6*Math.max(1,Math.abs(H),Math.abs(Y))&&Math.abs(I-X)<=1E-6*Math.max(1,Math.abs(I),Math.abs(X))&&Math.abs(M-ea)<=1E-6*Math.max(1,Math.abs(M),Math.abs(ea))&&Math.abs(O-ca)<=1E-6*Math.max(1,Math.abs(O),Math.abs(ca))&&Math.abs(h-p)<=1E-6*Math.max(1,Math.abs(h),Math.abs(p))}});$a=function(){var h=fb();return function(p,v,z,E,H,I){v||(v=2);z||(z=0);for(E=E?Math.min(E*v+z,p.length):p.length;z<E;z+=v)h[0]=p[z],h[1]=p[z+1],H(h,h,I),p[z]=h[0],p[z+1]=h[1];return p}}();$a=Object.freeze({__proto__:null, create:fb,clone:function(h){var p=new ra(2);p[0]=h[0];p[1]=h[1];return p},fromValues:function(h,p){var v=new ra(2);v[0]=h;v[1]=p;return v},copy:function(h,p){h[0]=p[0];h[1]=p[1];return h},set:function(h,p,v){h[0]=p;h[1]=v;return h},add:function(h,p,v){h[0]=p[0]+v[0];h[1]=p[1]+v[1];return h},subtract:Xa,multiply:gb,divide:hb,ceil:function(h,p){h[0]=Math.ceil(p[0]);h[1]=Math.ceil(p[1]);return h},floor:function(h,p){h[0]=Math.floor(p[0]);h[1]=Math.floor(p[1]);return h},min:function(h,p,v){h[0]=Math.min(p[0], v[0]);h[1]=Math.min(p[1],v[1]);return h},max:function(h,p,v){h[0]=Math.max(p[0],v[0]);h[1]=Math.max(p[1],v[1]);return h},round:function(h,p){h[0]=Math.round(p[0]);h[1]=Math.round(p[1]);return h},scale:function(h,p,v){h[0]=p[0]*v;h[1]=p[1]*v;return h},scaleAndAdd:function(h,p,v,z){h[0]=p[0]+v[0]*z;h[1]=p[1]+v[1]*z;return h},distance:Za,squaredDistance:ib,length:Ta,squaredLength:jb,negate:function(h,p){h[0]=-p[0];h[1]=-p[1];return h},inverse:function(h,p){h[0]=1/p[0];h[1]=1/p[1];return h},normalize:function(h, p){var v=p[0],z=p[1];v=v*v+z*z;0<v&&(v=1/Math.sqrt(v));h[0]=p[0]*v;h[1]=p[1]*v;return h},dot:function(h,p){return h[0]*p[0]+h[1]*p[1]},cross:function(h,p,v){p=p[0]*v[1]-p[1]*v[0];h[0]=h[1]=0;h[2]=p;return h},lerp:function(h,p,v,z){var E=p[0];p=p[1];h[0]=E+z*(v[0]-E);h[1]=p+z*(v[1]-p);return h},random:function(h,p){p=p||1;var v=2*Ra()*Math.PI;h[0]=Math.cos(v)*p;h[1]=Math.sin(v)*p;return h},transformMat2:function(h,p,v){var z=p[0];p=p[1];h[0]=v[0]*z+v[2]*p;h[1]=v[1]*z+v[3]*p;return h},transformMat2d:function(h, p,v){var z=p[0];p=p[1];h[0]=v[0]*z+v[2]*p+v[4];h[1]=v[1]*z+v[3]*p+v[5];return h},transformMat3:function(h,p,v){var z=p[0];p=p[1];h[0]=v[0]*z+v[3]*p+v[6];h[1]=v[1]*z+v[4]*p+v[7];return h},transformMat4:function(h,p,v){var z=p[0];p=p[1];h[0]=v[0]*z+v[4]*p+v[12];h[1]=v[1]*z+v[5]*p+v[13];return h},rotate:function(h,p,v,z){var E=p[0]-v[0];p=p[1]-v[1];var H=Math.sin(z);z=Math.cos(z);h[0]=E*z-p*H+v[0];h[1]=E*H+p*z+v[1];return h},angle:function(h,p){var v=h[0];h=h[1];var z=p[0];p=p[1];var E=Math.sqrt(v*v+ h*h)*Math.sqrt(z*z+p*p);return Math.acos(Math.min(Math.max(E&&(v*z+h*p)/E,-1),1))},zero:function(h){h[0]=0;h[1]=0;return h},str:function(h){return"vec2("+h[0]+", "+h[1]+")"},exactEquals:function(h,p){return h[0]===p[0]&&h[1]===p[1]},equals:function(h,p){var v=h[0];h=h[1];var z=p[0];p=p[1];return Math.abs(v-z)<=1E-6*Math.max(1,Math.abs(v),Math.abs(z))&&Math.abs(h-p)<=1E-6*Math.max(1,Math.abs(h),Math.abs(p))},len:Ta,sub:Xa,mul:gb,div:hb,dist:Za,sqrDist:ib,sqrLen:jb,forEach:$a});e.glMatrix=Ab;e.mat2= Db;e.mat2d=Eb;e.mat3=Fb;e.mat4=Gb;e.quat=mb;e.quat2=nb;e.vec2=$a;e.vec3=kb;e.vec4=lb;Object.defineProperty(e,"__esModule",{value:!0})}); {"use strict";function e(A,F,J){var L=[0,0];var Q=A[1][1]-A[0][1];var T=A[0][0]-A[1][0];A=Q*A[0][0]+T*A[0][1];var V=F[1][1]-F[0][1];var aa=F[0][0]-F[1][0];F=V*F[0][0]+aa*F[0][1];var ha=Q*aa-V*T;K(ha,0,J||0)||(L[0]=(aa*A-T*F)/ha,L[1]=(Q*F-V*A)/ha);return L}function b(A,F,J,L){var Q=F[0]-A[0];F=F[1]-A[1];var T=L[0]-J[0],V=L[1]-J[1];if(0===T*F-V*Q)return!1;L=(Q*(J[1]-A[1])+F*(A[0]-J[0]))/(T*F-V*Q);A=(T*(A[1]-J[1])+V*(J[0]-A[0]))/(V*Q-T*F);return 0<=L&&1>=L&&0<=A&&1>=A}function a(A,F,J){return(F[0]-A[0])* (J[1]-A[1])-(J[0]-A[0])*(F[1]-A[1])}function d(A,F,J){return 0<a(A,F,J)}function c(A,F,J){return 0<=a(A,F,J)}function f(A,F,J){return 0>a(A,F,J)}function l(A,F,J){return 0>=a(A,F,J)}var tmpPoint1$$module$str$c3runtime=[],tmpPoint2$$module$str$c3runtime=[];function g(A,F,J,L){if(L){var Q=tmpPoint1$$module$str$c3runtime,T=tmpPoint2$$module$str$c3runtime;Q[0]=F[0]-A[0];Q[1]=F[1]-A[1];T[0]=J[0]-F[0];T[1]=J[1]-F[1];return Math.acos((Q[0]*T[0]+Q[1]*T[1])/(Math.sqrt(Q[0]*Q[0]+Q[1]*Q[1])*Math.sqrt(T[0]*T[0]+ T[1]*T[1])))<L}return 0===a(A,F,J)}function k(A,F){var J=F[0]-A[0];A=F[1]-A[1];return J*J+A*A}function m(A,F){var J=A.length;return A[0>F?F%J+J:F%J]}function u(A){A.length=0}function x(A,F,J,L){for(;J<L;J++)A.push(F[J])}function n(A){for(var F=[],J=A.length,L=0;L!==J;L++)F.push(A.pop());for(L=0;L!==J;L++)A[L]=F[L]}function q(A,F){return f(m(A,F-1),m(A,F),m(A,F+1))}var tmpLine1$$module$str$c3runtime=[],tmpLine2$$module$str$c3runtime=[];function t(A,F,J){var L=tmpLine1$$module$str$c3runtime,Q=tmpLine2$$module$str$c3runtime; if(c(m(A,F+1),m(A,F),m(A,J))&&l(m(A,F-1),m(A,F),m(A,J)))return!1;var T=k(m(A,F),m(A,J));for(var V=0;V!==A.length;++V)if((V+1)%A.length!==F&&V!==F&&c(m(A,F),m(A,J),m(A,V+1))&&l(m(A,F),m(A,J),m(A,V))){L[0]=m(A,F);L[1]=m(A,J);Q[0]=m(A,V);Q[1]=m(A,V+1);var aa=e(L,Q);if(k(m(A,F),aa)<T)return!1}return!0}function r(A,F,J){for(var L=0;L!==A.length;++L)if(L!==F&&L!==J&&(L+1)%A.length!==F&&(L+1)%A.length!==J&&b(m(A,F),m(A,J),m(A,L),m(A,L+1)))return!1;return!0}function w(A,F,J,L){L=L||[];u(L);if(F<J)for(var Q= F;Q<=J;Q++)L.push(A[Q]);else{for(Q=0;Q<=J;Q++)L.push(A[Q]);for(Q=F;Q<A.length;Q++)L.push(A[Q])}return L}function y(A){for(var F=[],J,L,Q=[],T=Number.MAX_VALUE,V=0;V<A.length;++V)if(q(A,V))for(var aa=0;aa<A.length;++aa)if(t(A,V,aa)){J=y(w(A,V,aa,Q));L=y(w(A,aa,V,Q));for(var ha=0;ha<L.length;ha++)J.push(L[ha]);J.length<T&&(F=J,T=J.length,F.push([m(A,V),m(A,aa)]))}return F}function C(A,F){if(0===F.length)return[A];if(F instanceof Array&&F.length&&F[0]instanceof Array&&2===F[0].length&&F[0][0]instanceof Array){A=[A];for(var J=0;J<F.length;J++)for(var L=F[J],Q=0;Q<A.length;Q++){var T=C(A[Q],L);if(T){A.splice(Q,1);A.push(T[0],T[1]);break}}return A}L=F;J=A.indexOf(L[0]);Q=A.indexOf(L[1]);return-1!==J&&-1!==Q?[w(A,J,Q),w(A,Q,J)]:!1}function D(A,F,J,L,Q){var T=F[1]-A[1];F=A[0]-F[0];A=T*A[0]+F*A[1];var V=L[1]-J[1];L=J[0]-L[0];J=V*J[0]+L*J[1];var aa=T*L-V*F;return K(aa,0,Q||0)?[0,0]:[(L*A-F*J)/aa,(T*J-V*A)/aa]}function G(A,F,J,L,Q,T,V){T=T||100;V=V||0;Q=Q||25;F="undefined"!==typeof F?F:[];J=J||[];L=L|| [];var aa=[0,0],ha=[0,0],ja=[0,0],oa,ya=0,Ba=0,La=0,Da=[],Ga=[];if(3>A.length)return F;V++;if(V>T)return console.warn("quickDecomp: max level ("+T+") reached."),F;for(var ma=0;ma<A.length;++ma)if(q(A,ma)){J.push(A[ma]);var Oa=oa=Number.MAX_VALUE;for(var Aa=0;Aa<A.length;++Aa){if(d(m(A,ma-1),m(A,ma),m(A,Aa))&&l(m(A,ma-1),m(A,ma),m(A,Aa-1))&&(ja=D(m(A,ma-1),m(A,ma),m(A,Aa),m(A,Aa-1)),f(m(A,ma+1),m(A,ma),ja))){var Ma=k(A[ma],ja);Ma<oa&&(oa=Ma,ha=ja,Ba=Aa)}d(m(A,ma+1),m(A,ma),m(A,Aa+1))&&l(m(A,ma+1), m(A,ma),m(A,Aa))&&(ja=D(m(A,ma+1),m(A,ma),m(A,Aa),m(A,Aa+1)),d(m(A,ma-1),m(A,ma),ja)&&(Ma=k(A[ma],ja),Ma<Oa&&(Oa=Ma,aa=ja,ya=Aa)))}if(Ba===(ya+1)%A.length)ja[0]=(ha[0]+aa[0])/2,ja[1]=(ha[1]+aa[1])/2,L.push(ja),ma<ya?(x(Da,A,ma,ya+1),Da.push(ja),Ga.push(ja),0!==Ba&&x(Ga,A,Ba,A.length),x(Ga,A,0,ma+1)):(0!==ma&&x(Da,A,ma,A.length),x(Da,A,0,ya+1),Da.push(ja),Ga.push(ja),x(Ga,A,Ba,ma+1));else{Ba>ya&&(ya+=A.length);aa=Number.MAX_VALUE;if(ya<Ba)return F;for(Aa=Ba;Aa<=ya;++Aa)c(m(A,ma-1),m(A,ma),m(A,Aa))&& l(m(A,ma+1),m(A,ma),m(A,Aa))&&(Ma=k(m(A,ma),m(A,Aa)),Ma<aa&&r(A,ma,Aa)&&(aa=Ma,La=Aa%A.length));ma<La?(x(Da,A,ma,La+1),0!==La&&x(Ga,A,La,A.length),x(Ga,A,0,ma+1)):(0!==ma&&x(Da,A,ma,A.length),x(Da,A,0,La+1),x(Ga,A,La,ma+1))}Da.length<Ga.length?(G(Da,F,J,L,Q,T,V),G(Ga,F,J,L,Q,T,V)):(G(Ga,F,J,L,Q,T,V),G(Da,F,J,L,Q,T,V));return F}F.push(A);return F}function K(A,F,J){return Math.abs(A-F)<=(J||0)}function B(A,F,J){return K(A[0],F[0],J)&&K(A[1],F[1],J)}self.polyDecomp={decomp:function(A){var F=y(A);return 0< F.length?C(A,F):[A]},quickDecomp:G,isSimple:function(A){var F;for(F=0;F<A.length-1;F++)for(var J=0;J<F-1;J++)if(b(A[F],A[F+1],A[J],A[J+1]))return!1;for(F=1;F<A.length-2;F++)if(b(A[0],A[A.length-1],A[F],A[F+1]))return!1;return!0},removeCollinearPoints:function(A,F){for(var J=0,L=A.length-1;3<A.length&&0<=L;--L)g(m(A,L-1),m(A,L),m(A,L+1),F)&&(A.splice(L%A.length,1),J++);return J},removeDuplicatePoints:function(A,F){for(var J=A.length-1;1<=J;--J)for(var L=A[J],Q=J-1;0<=Q;--Q)B(L,A[Q],F)&&A.splice(J, 1)},makeCCW:function(A){for(var F=0,J=1;J<A.length;++J)if(A[J][1]<A[F][1]||A[J][1]===A[F][1]&&A[J][0]>A[F][0])F=J;if(d(m(A,F-1),m(A,F),m(A,F+1)))return!1;n(A);return!0}}} {"use strict";let e=!1,b=!1,a="dev";const d=self.C3=class{constructor(){throw TypeError("static class can't be instantiated");}static SetReady(){e=!0}static IsReady(){return e}static SetAppStarted(){b=!0}static HasAppStarted(){return b}static SetBuildMode(c){a=c}static GetBuildMode(){return a}static IsReleaseBuild(){return"final"===a}};d.isDebug=!1;d.isDebugDefend=!1;d.hardwareConcurrency=navigator.hardwareConcurrency||2;self.C3X={}} {"use strict";const e=self.C3;e.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("="),d=decodeURIComponent(b.substring(0,a));b=decodeURIComponent(b.substring(a+1));this._parameters.set(d,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()}};e.QueryString=new e.QueryParser(location.search);e.LocationHashString=new e.QueryParser(location.hash);"dev"!==e.QueryString.Get("mode")&&e.SetBuildMode("final")} {"use strict";const e=self.C3,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_0=/windows\s+nt\s+\d+\.\d+/i.exec(b),JSCompiler_object_inline_OSX_1=/mac\s+os\s+x\s+[0-9_]+/i.exec(b),JSCompiler_object_inline_android_2=/android\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_opera_3=/OPR\/[0-9.]+/.exec(b),JSCompiler_object_inline_tizen_4=/tizen\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_iphone_5=/iphone\s+os\s+[0-9_]+/i.exec(b),JSCompiler_object_inline_ipad_6= /ipad[^)]*os\s+[0-9_]+/i.exec(b),JSCompiler_object_inline_winPhone_7=/windows\s+phone\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_winPhoneOS_8=/windows\s+phone\s+os\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_chrome_9=/chrome\/[0-9.]+/i.exec(b),JSCompiler_object_inline_chromium_10=/chromium\/[0-9.]+/i.exec(b),JSCompiler_object_inline_nwjs_11=/nwjs\/[0-9.]+/i.exec(b),JSCompiler_object_inline_firefox_12=/firefox\/[0-9.]+/i.exec(b),JSCompiler_object_inline_ie_13=/msie\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_edge_14= /edge\/[0-9.]+/i.exec(b),JSCompiler_object_inline_edgeChromium_15=/edg\/[0-9.]+/i.exec(b),JSCompiler_object_inline_silk_16=/silk\/[0-9.]+/i.exec(b);let d="(unknown)",c="(unknown)",f="(unknown)",l="(unknown)",g="(unknown)",k="browser",m=!1,u=!1,x=new Map;function n(t,r,w){!0===r?(w(),x.set(t,!0)):r&&r.length&&(w(r[0]),x.set(t,!0))}n("isWindows",JSCompiler_object_inline_windows_0,t=>{d="Windows";if(t=t.split(" ")[2])switch(t){case "5.0":c="2000";break;case "5.1":c="XP";break;case "5.2":c="XP";break; case "6.0":c="Vista";break;case "6.1":c="7";break;case "6.2":c="8";break;case "6.3":c="8.1";break;case "10.0":c="10"}});n("isOSX",JSCompiler_object_inline_OSX_1,t=>{d="Mac OS X";(t=t.split(" ")[3])&&(c=t.replace("_","."))});n("isLinux",a.linux,()=>{d="Linux"});n("isChromeOS",a.chromeOS,()=>{d="Chrome OS"});n("isAndroid",!a.windowsTizen&&JSCompiler_object_inline_android_2,t=>{d="Android";(t=t.split(" ")[1])&&(c=t)});n("isTizen",JSCompiler_object_inline_tizen_4,t=>{d="Tizen";(t=t.split(" ")[1])&&(c= t)});n("isIPhone",!a.windowsTizen&&JSCompiler_object_inline_iphone_5,t=>{d="iOS";(t=t.split(" ")[2])&&(c=t.replace("_","."))});n("isIPad",!a.windowsTizen&&JSCompiler_object_inline_ipad_6,t=>{d="iOS";(t=t.split(" ")[3])&&(c=t.replace("_","."))});n("isWindowsPhone",JSCompiler_object_inline_winPhone_7,t=>{d="Windows Phone";(t=t.split(" ")[2])&&(c=t)});n("isWindowsPhoneOS",JSCompiler_object_inline_winPhoneOS_8,t=>{d="Windows Phone";(t=t.split(" ")[3])&&(c=t)});n("isBlackberry",a.blackberry,()=>{d="Blackberry"; c="10";f="stock";g="webkit"});n("isChrome",!a.edge&&!a.opera&&JSCompiler_object_inline_chrome_9,t=>{f="Chrome";g="Chromium";(t=t.split("/")[1])&&(l=t)});n("isOpera",JSCompiler_object_inline_opera_3,t=>{f="Opera";g="Chromium";(t=t.split("/")[1])&&(l=t)});n("isChromium",JSCompiler_object_inline_chromium_10,t=>{g=f="Chromium";(t=t.split("/")[1])&&(l=t)});n("isFirefox",JSCompiler_object_inline_firefox_12,t=>{f="Firefox";g="Gecko";(t=t.split("/")[1])&&(l=t)});n("isInternetExplorer",JSCompiler_object_inline_ie_13, t=>{f="Internet Explorer";g="Trident";(t=t.split(" ")[1])&&(l=t)});n("isTrident","Internet Explorer"!==f&&a.trident,()=>{g="Trident";var t=/rv:[0-9.]+/i.exec(b);t&&t.length&&(f="Internet Explorer",(t=t[0].split(":")[1])&&(l=t))});n("isEdge",JSCompiler_object_inline_edge_14,t=>{g=f="Edge";(t=t.split("/")[1])&&(l=t)});n("isEdgeChromium",JSCompiler_object_inline_edgeChromium_15,t=>{f="Edge";g="Chromium";(t=t.split("/")[1])&&(l=t)});n("isSafari",a.safari&&!a.nokia&&!a.chrome&&!a.chromium&&!a.genericIE&& !a.blackberry,()=>{f="Safari";g="WebKit";var t=/version\/[0-9.]+/i.exec(b),r=/crios\/[0-9.]+/i.exec(b),w=/fxios\/[0-9.]+/i.exec(b);t&&t.length&&(t=t[0].split("/")[1])&&(l=t);r&&r.length&&(f="Chrome for iOS",(r=r[0].split("/")[1])&&(l=r));w&&w.length&&(f="Firefox for iOS",(w=w[0].split("/")[1])&&(l=w))});n("isSilk",JSCompiler_object_inline_silk_16,t=>{f="Silk";(t=t.split("/")[1])&&(l=t)});n("isCrosswalk",a.crosswalk,()=>k="crosswalk");n("isCordova",self.device&&(self.device.cordova||self.device.phonegap), ()=>k="cordova");n("isNWJS",JSCompiler_object_inline_nwjs_11,t=>{k="nwjs";f="NW.js";g="Chromium";(t=t.split("/")[1])&&(l=t)});n("isAmazonWebApp",a.amazonwebapp,()=>k="webapp");n("isHomeScreenWebApp","nwjs"!==k&&"undefined"!==typeof window&&(window.matchMedia&&window.matchMedia("(display-mode: standalone)").matches||navigator.standalone),()=>k="webapp");n("isFalseSafari","Safari"===f&&("Android"===d||"Tizen"===d||"Blackberry"===d),()=>f="stock");n("isAndroidWebview","Chrome"===f&&"browser"===k&&a.webview, ()=>k="webview");n("isFirefoxOS","Firefox"===f&&"(unknown)"===d,()=>d="Firefox OS");n("isAndroidFallback","(unknown)"===d&&!a.windowsTizen&&a.android,()=>d="Android");n("isTridentFallback","(unknown)"===d&&a.trident,()=>g="Trident");n("isWebkitFallback","(unknown)"===d&&a.webkit,()=>g="WebKit");n("isDesktop",(()=>"Windows"===d||"Mac OS X"===d||"Linux"===d||"Chrome OS"===d||"nwjs"===k)(),()=>m=!0);u="nwjs"===k;const q="Mac OS X"===d&&navigator.maxTouchPoints&&2<navigator.maxTouchPoints;q&&(d="iOS", c=l,u=m=!1);e.Platform={OS:d,OSVersion:c,Browser:f,BrowserVersion:l,BrowserVersionNumber:parseFloat(l),BrowserEngine:g,Context:k,IsDesktop:m,IsMobile:!m,IsDesktopApp:u,IsChromeWebStore:!!(self.chrome&&self.chrome.runtime&&self.chrome.runtime.id),IsAppleOS:"Mac OS X"===d||"iOS"===d,IsIpadOS:q,IsLinux:"Linux"===d}}"use strict"; {const e=new Map,b="undefined"!==typeof IDBObjectStore&&"function"===typeof IDBObjectStore.prototype.getAll,a="undefined"!==typeof IDBObjectStore&&"function"===typeof IDBObjectStore.prototype.getAllKeys;function d(q){return new Promise((t,r)=>{q.onsuccess=()=>t(q.result);q.onerror=()=>r(q.error)})}function c(q){return new Promise((t,r)=>{q.oncomplete=()=>t();q.onerror=()=>r(q.error);q.onabort=()=>r(q.error)})}function f(q,t){return g(q,t)}function l(q,t){return g(q,t,!0)}async function g(q,t,r=!1, w=!0){const y=await k(q);try{const C=y.transaction(["keyvaluepairs"],r?"readwrite":"readonly");return t(C)}catch(C){if(w&&"InvalidStateError"===C.name)return e.delete(q),g(q,t,r,!1);throw C;}}function k(q){u(q);let t=e.get(q);t instanceof Promise||(t=m(q),e.set(q,t),t.catch(r=>e.delete(q)));return t}async function m(q){u(q);const t=indexedDB.open(q,2);t.addEventListener("upgradeneeded",r=>{try{r.target.result.createObjectStore("keyvaluepairs")}catch(w){console.error(`Failed to create objectstore for database ${q}`, w)}});return d(t)}function u(q){if("string"!==typeof q)throw new TypeError("expected string");}function x(q,t){const r=q.objectStore("keyvaluepairs").openCursor();return new Promise(w=>{const y=[];r.onsuccess=C=>{if(C=C.target.result){switch(t){case "entries":y.push([C.key,C.value]);break;case "keys":y.push(C.key);break;case "values":y.push(C.value)}C.continue()}else w(y)}})}class n{constructor(q){u(q);this.name=q}async ready(){await k(this.name)}set(q,t){u(q);return l(this.name,async r=>{var w=r.objectStore("keyvaluepairs").put(t, q);w=d(w);r=c(r);await Promise.all([r,w])})}get(q){u(q);return f(this.name,async t=>{var r=t.objectStore("keyvaluepairs").get(q);r=d(r);t=c(t);[,t]=await Promise.all([t,r]);return t})}delete(q){u(q);return l(this.name,async t=>{var r=t.objectStore("keyvaluepairs").delete(q);r=d(r);t=c(t);await Promise.all([t,r])})}clear(){return l(this.name,async q=>{var t=q.objectStore("keyvaluepairs").clear();t=d(t);q=c(q);await Promise.all([q,t])})}keys(){return f(this.name,async q=>{if(a){var t=q.objectStore("keyvaluepairs").getAllKeys(); t=d(t)}else t=x(q,"keys");q=c(q);[,q]=await Promise.all([q,t]);return q})}values(){return f(this.name,async q=>{if(b){var t=q.objectStore("keyvaluepairs").getAll();t=d(t)}else t=x(q,"values");q=c(q);[,q]=await Promise.all([q,t]);return q})}entries(){return f(this.name,async q=>{var t=x(q,"entries");q=c(q);[,t]=await Promise.all([q,t]);return t})}}self.KVStorageContainer=n}"use strict"; {const e=self.KVStorageContainer,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 d=!1;"undefined"===typeof indexedDB&&(d=!0,console.warn("Unable to use local storage because indexedDB is not defined"));function c(k){throw Error(`"${k}" is not implemented`); }function f(k){if("function"===typeof k)throw Error("localforage callback API is not implemented; please use the promise API instead");}function l(k){return"object"===typeof k?new Promise(m=>{const {port1:u,port2:x}=new MessageChannel;x.onmessage=n=>m(n.data);u.postMessage(k)}):Promise.resolve(k)}class g{constructor(k){this._inst=k;a.set(this,new Map)}_MaybeSwitchToMemoryFallback(k){if(!d)for(const m of b)if(k&&m.test(k.message)){console.error("Unable to use local storage, reverting to in-memory store: ", k,k.message);d=!0;break}}async _getItemFallback(k){k=a.get(this).get(k);k=await l(k);return"undefined"===typeof k?null:k}async _setItemFallback(k,m){m=await l(m);a.get(this).set(k,m)}_removeItemFallback(k){a.get(this).delete(k)}_clearFallback(){a.get(this).clear()}_keysFallback(){return Array.from(a.get(this).keys())}IsUsingFallback(){return d}async getItem(k,m){f(m);if(d)return await this._getItemFallback(k);let u;try{u=await this._inst.get(k)}catch(x){this._MaybeSwitchToMemoryFallback(x);if(d)return await this._getItemFallback(k); console.error(`Error reading '${k}' from storage, returning null: `,x);return null}return"undefined"===typeof u?null:u}async setItem(k,m,u){f(u);"undefined"===typeof m&&(m=null);if(d)await this._setItemFallback(k,m);else try{await this._inst.set(k,m)}catch(x){if(this._MaybeSwitchToMemoryFallback(x),d)await this._setItemFallback(k,m);else throw x;}}async removeItem(k,m){f(m);if(d)this._removeItemFallback(k);else try{await this._inst.delete(k)}catch(u){this._MaybeSwitchToMemoryFallback(u),d?this._removeItemFallback(k): console.error(`Error removing '${k}' from storage: `,u)}}async clear(k){f(k);if(d)this._clearFallback();else try{await this._inst.clear()}catch(m){this._MaybeSwitchToMemoryFallback(m),d?this._clearFallback():console.error("Error clearing storage: ",m)}}async keys(k){f(k);if(d)return this._keysFallback();k=[];try{k=await this._inst.keys()}catch(m){this._MaybeSwitchToMemoryFallback(m);if(d)return this._keysFallback();console.error("Error getting storage keys: ",m)}return k}ready(k){f(k);return d?Promise.resolve(!0): this._inst.ready()}createInstance(k){if("object"!==typeof k)throw new TypeError("invalid options object");k=k.name;if("string"!==typeof k)throw new TypeError("invalid store name");k=new e(k);return new g(k)}length(k){c("localforage.length()")}key(k,m){c("localforage.key()")}iterate(k,m){c("localforage.iterate()")}setDriver(k){c("localforage.setDriver()")}config(k){c("localforage.config()")}defineDriver(k){c("localforage.defineDriver()")}driver(){c("localforage.driver()")}supports(k){c("localforage.supports()")}dropInstance(){c("localforage.dropInstance()")}disableMemoryMode(){d= !1}}self.localforage=new g(new e("localforage"))} {"use strict";const e=self.C3;e.Supports={};e.Supports.WebAnimations=(()=>{try{if("Safari"===e.Platform.Browser||"undefined"===typeof document)return!1;const b=document.createElement("div");return"undefined"===typeof b.animate?!1:"undefined"!==typeof b.animate([{opacity:"0"},{opacity:"1"}],1E3).reverse}catch(b){return!1}})();e.Supports.DialogElement="undefined"!==typeof HTMLDialogElement;e.Supports.RequestIdleCallback=!!self.requestIdleCallback;e.Supports.ImageBitmap=!!self.createImageBitmap;e.Supports.ImageBitmapOptions= !1;if(e.Supports.ImageBitmap)try{self.createImageBitmap(new ImageData(32,32),{premultiplyAlpha:"none"}).then(b=>{e.Supports.ImageBitmapOptions=!0}).catch(b=>{e.Supports.ImageBitmapOptions=!1})}catch(b){e.Supports.ImageBitmapOptions=!1}e.Supports.ClipboardReadText=!(!navigator.clipboard||!navigator.clipboard.readText||"Firefox"===e.Platform.Browser);e.Supports.PermissionsQuery=!(!navigator.permissions||!navigator.permissions.query);e.Supports.Proxies="undefined"!==typeof Proxy;e.Supports.DownloadAttribute= (()=>"undefined"===typeof document?!1:"undefined"!==typeof document.createElement("a").download)();e.Supports.CanvasToBlob=(()=>"undefined"!==typeof HTMLCanvasElement&&HTMLCanvasElement.prototype.toBlob)();e.Supports.Fetch="function"===typeof fetch;e.Supports.PersistentStorage=!!(self.isSecureContext&&"Opera"!==e.Platform.Browser&&navigator.storage&&navigator.storage.persist);e.Supports.StorageQuotaEstimate=!!(self.isSecureContext&&navigator.storage&&navigator.storage.estimate);e.Supports.Fullscreen= (()=>{if("undefined"===typeof document||"iOS"===e.Platform.OS)return!1;const b=document.documentElement;return!!(b.requestFullscreen||b.msRequestFullscreen||b.mozRequestFullScreen||b.webkitRequestFullscreen)})();e.Supports.ImageDecoder="undefined"!==typeof self.ImageDecoder;e.Supports.NativeFileSystemAPI=!!self.showOpenFilePicker;e.Supports.NavigatorFontsQuery=!(!navigator.fonts||!navigator.fonts.query)} {"use strict";const e=self.C3;if(!String.prototype.trimStart){const 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(e.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,d){return a.reduce((c,f)=>{0<d&&Array.isArray(f)?Array.prototype.push.apply(c,b(f,d-1)):c.push(f);return c},[])}Array.prototype.flat=function(a=1){return b(this,a)}}Array.prototype.at||(Array.prototype.at=function(b){b=Math.trunc(b)||0;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((d, c)=>b({usage:d,quota:c}),a))});"undefined"===typeof self.isSecureContext&&(self.isSecureContext="https:"===location.protocol);"undefined"===typeof self.globalThis&&(self.globalThis=self)}{"use strict";const e=self.C3;function b(a){let d=e.GetCallStack();console.error("Assertion failure: "+a+"\n\nStack trace:\n"+d)}self.assert=function(a,d){a||b(d)}} {"use strict";const e=self.C3,b=self.C3X;e.IsNumber=function(d){return"number"===typeof d};e.IsFiniteNumber=function(d){return e.IsNumber(d)&&isFinite(d)};e.RequireNumber=function(d){if(!e.IsNumber(d))throw new TypeError("expected number");};e.RequireOptionalNumber=function(d){e.IsNullOrUndefined(d)};e.RequireNumberInRange=function(d,c,f){if(!e.IsNumber(d)||isNaN(d)||c>d||f<d)throw new RangeError("number outside of range");};e.RequireAllNumber=function(...d){for(let c of d);};e.RequireFiniteNumber= function(d){if(!e.IsFiniteNumber(d))throw new TypeError("expected finite number");};e.RequireOptionalFiniteNumber=function(d){e.IsNullOrUndefined(d)};e.RequireAllFiniteNumber=function(...d){for(let c of d);};e.IsString=function(d){return"string"===typeof d};e.RequireString=function(d){if(!e.IsString(d))throw new TypeError("expected string");};e.RequireOptionalString=function(d){e.IsNullOrUndefined(d)};e.RequireAllString=function(...d){for(let c of d);};e.IsSimpleObject=function(d){return"object"!== typeof d||null===d?!1:(d=Object.getPrototypeOf(d))?d.constructor===Object:null===d};e.RequireSimpleObject=function(d){if(!e.IsSimpleObject(d))throw new TypeError("expected simple object");};e.RequireOptionalSimpleObject=function(d){if(!e.IsNullOrUndefined(d)&&!e.IsSimpleObject(d))throw new TypeError("expected simple object");};e.IsObject=function(d){return"object"===typeof d&&null!==d&&!Array.isArray(d)};e.RequireObject=function(d){if(!e.IsObject(d))throw new TypeError("expected object");};e.RequireOptionalObject= function(d){e.IsNullOrUndefined(d)};e.RequireAllObject=function(...d){for(let c of d);};e.IsFileLike=function(d){return e.IsInstanceOf(d,Blob)&&"string"===typeof d.name};e.RequireFileLike=function(d){if(!e.IsFileLike(d))throw new TypeError("expected file");};e.RequireOptionalFileLike=function(d){e.IsNullOrUndefined(d)};e.IsArray=function(d){return Array.isArray(d)};e.RequireArray=function(d){if(!e.IsArray(d))throw new TypeError("expected array");};e.RequireOptionalArray=function(d){e.IsNullOrUndefined(d)}; e.RequireAllArray=function(...d){for(let c of d);};e.Is2DArray=function(d){return e.IsArray(d)?d.length?e.IsArray(d[0])?!0:!1:!0:!1};e.Require2DArray=function(d){if(!e.Is2DArray(d))throw new TypeError("expected 2d array");for(let c of d)if(!e.IsArray(c))throw new TypeError("expected 2d array");};e.RequireOptional2DArray=function(d){e.IsNullOrUndefined(d)};e.IsFunction=function(d){return"function"===typeof d};e.RequireFunction=function(d,c){if(!e.IsFunction(d))throw new TypeError("expected function"); if(!e.IsNullOrUndefined(c)&&d!==c)throw new TypeError("expected same function reference");};e.RequireOptionalFunction=function(d){e.IsNullOrUndefined(d)};e.RequireAllFunction=function(...d){for(let c of d);};e.RequireAnyFunction=function(d,...c){if(!e.IsFunction(d))throw new TypeError("expected function");if(!c.length)throw Error("missing comparison functions");for(let f of c)if(!e.IsNullOrUndefined(f)&&d===f)return;throw new TypeError("expected same function reference");};e.RequireOptionalAllFunction= function(...d){if(!e.IsNullOrUndefined(d))for(let c of d);};e.IsInstanceOf=function(d,c){return d instanceof c};e.IsInstanceOfAny=function(d,...c){for(let f of c)if(e.IsInstanceOf(d,f))return!0;return!1};e.RequireInstanceOf=function(d,c){if(!e.IsInstanceOf(d,c))throw new TypeError("unexpected type");};e.RequireOptionalInstanceOf=function(d,c){e.IsNullOrUndefined(d)};e.RequireAllInstanceOf=function(d,...c){for(let f of c);};e.RequireAnyInstanceOf=function(d,...c){if(!e.IsInstanceOfAny(d,...c))throw new TypeError("unexpected type"); };e.RequireAnyOptionalInstanceOf=function(d,...c){if(!e.IsNullOrUndefined(d)&&!e.IsInstanceOfAny(d,...c))throw new TypeError("unexpected type");};e.IsArrayOf=function(d,c){for(let f of d)if(!e.IsInstanceOf(f,c))return!1;return!0};e.IsArrayOfFiniteNumbers=function(d){for(let c of d)if(!e.IsFiniteNumber(c))return!1;return!0};e.RequireArrayOf=function(d,c){for(let f of d);};e.RequireOptionalArrayOf=function(d,c){if(!e.IsNullOrUndefined(d))for(let f of d);};e.RequireArrayOfAny=function(d,...c){for(let f of d); };e.RequireOptionalArrayOfAny=function(d,...c){if(!e.IsNullOrUndefined(d))for(let f of d);};e.IsDOMNode=function(d,c){return e.IsNullOrUndefined(d)||!e.IsString(d.nodeName)?!1:!c||e.equalsNoCase(d.nodeName,c)};e.RequireDOMNode=function(d,c){if(e.IsNullOrUndefined(d)||!e.IsString(d.nodeName))throw new TypeError("expected DOM node");if(c&&!e.equalsNoCase(d.nodeName,c))throw new TypeError(`expected DOM '${c}' node`);};e.RequireOptionalDOMNode=function(d,c){e.IsNullOrUndefined(d)};e.IsHTMLElement=function(d, c){return e.IsNullOrUndefined(d)||!e.IsString(d.tagName)?!1:!c||e.equalsNoCase(d.tagName,c)};e.RequireHTMLElement=function(d,c){if(e.IsNullOrUndefined(d)||!e.IsString(d.tagName))throw new TypeError("expected HTML element");if(c&&!e.equalsNoCase(d.tagName,c))throw new TypeError(`expected HTML '${c}' element`);};e.RequireOptionalHTMLElement=function(d,c){e.IsNullOrUndefined(d)};e.IsDrawable=function(d){return e.IsHTMLElement(d,"img")||e.IsHTMLElement(d,"canvas")||e.IsHTMLElement(d,"video")||"undefined"!== typeof OffscreenCanvas&&d instanceof OffscreenCanvas||"undefined"!==typeof ImageBitmap&&d instanceof ImageBitmap};e.RequireDrawable=function(d){if(!e.IsDrawable(d))throw new TypeError("expected drawable");};e.RequireOptionalDrawable=function(d){e.IsNullOrUndefined(d)};e.IsDrawableOrImageData=function(d){return d instanceof ImageData?!0:e.IsDrawable(d)};e.RequireDrawableOrImageData=function(d){if(!e.IsDrawableOrImageData(d))throw new TypeError("expected drawable or image data");};e.RequireOptionalDrawableOrImageData= function(d){if(!e.IsNullOrUndefined(d)&&!e.IsDrawableOrImageData(d))throw new TypeError("expected drawable or image data");};e.IsStringLike=function(d){return"string"===typeof d||d instanceof e.HtmlString||d instanceof e.BBString};e.RequireStringLike=function(d){if(!e.IsStringLike(d))throw new TypeError("expected string-like");};e.RequireOptionalStringLike=function(d){e.IsNullOrUndefined(d)};e.RequireAllStringLike=function(...d){for(let c of d);};e.RequireOverride=function(){throw Error("must be overridden"); };e.NotYetImplemented=function(){throw Error("not yet implemented");};e.IsDefined=function(d,...c){if("undefined"===typeof d)return!1;for(let f of c){if("undefined"===typeof d[f])return!1;d=d[f]}return!0};e.IsNullOrUndefined=function(d){return"undefined"===typeof d||null===d};e.AreArrayElementsOfSameType=function(d){let c=d[0].constructor;for(let f of d)if(f.constructor!==c)return!1;return c};e.AreArrayElementsOfType=function(d,c){for(let f of d)if(!(f instanceof c))return!1;return!0};const a=Object.getPrototypeOf(Uint8Array); e.IsTypedArray=function(d){return e.IsInstanceOf(d,a)};e.RequireTypedArray=function(d){};e.WeakRequireTypedArray=function(d){e.WeakRequireInstanceOf(d,a)};e.WeakRequireAnyInstanceOf=function(d,...c){if(!e.WeakIsAnyInstanceOf(d,...c))throw new TypeError("unexpected type");};e.WeakIsAnyInstanceOf=function(d,...c){for(const f of c)if(e.WeakIsInstanceOf(d,f))return!0;return!1};e.WeakRequireInstanceOf=function(d,c){if(!e.WeakIsInstanceOf(d,c))throw new TypeError("unexpected type");};e.WeakIsInstanceOf= function(d,c){for(;d=Object.getPrototypeOf(d);)if(d.constructor.name===c.name)return!0;return!1};b.RequireNumber=e.RequireNumber;b.RequireOptionalNumber=e.RequireOptionalNumber;b.RequireFiniteNumber=e.RequireFiniteNumber;b.RequireOptionalFiniteNumber=e.RequireOptionalFiniteNumber;b.RequireString=e.RequireString;b.RequireOptionalString=e.RequireOptionalString;b.RequireObject=e.RequireObject;b.RequireOptionalObject=e.RequireOptionalObject;b.RequireArray=e.RequireArray;b.RequireOptionalArray=e.RequireOptionalArray; b.RequireFunction=e.RequireFunction;b.RequireOptionalFunction=e.RequireOptionalFunction;b.RequireInstanceOf=e.RequireInstanceOf;b.RequireOptionalInstanceOf=e.RequireOptionalInstanceOf;b.IsNullOrUndefined=e.IsNullOrUndefined} {"use strict";const e=self.C3,b=new Map;e.RafLog=function(t,...r){b.has(t)||b.set(t,-1);-1===b.get(t)&&b.set(t,requestAnimationFrame(()=>{console.log(`%c${t}`,"font-weight: bold",...r);b.set(t,-1)}))};e.GetCallStack=function(){return Error().stack};e.Debugger=function(){debugger};e.cast=function(t,r){return t&&t instanceof r?t:null};e.getName=function(t){return"undefined"===typeof t?"undefined":null===t?"null":"boolean"===typeof t?"<boolean>":e.IsNumber(t)?"<number>":e.IsString(t)?"<string>":e.IsArray(t)? "<array>":"symbol"===typeof t?"<"+t.toString()+">":e.IsFunction(t)?t.name&&"Function"!==t.name?t.name:"<anonymous function>":"object"===typeof t?t.constructor&&t.constructor.name&&"Object"!==t.constructor.name?t.constructor.name:"<anonymous object>":"<unknown>"};e.getType=function(t){return null===t?"null":Array.isArray(t)?"array":typeof t};e.range=function*(t,r){if(!isFinite(Math.abs(t-r)))throw Error("Invalid parameters");if(t>r)for(--t;t>=r;t--)yield t;else for(;t<r;t++)yield t};function a(t,r){t= e.getType(t);r=e.getType(r);return"null"===t||"null"===r?!0:"undefined"===t||"undefined"===r?!1:t===r}let d=new Map,c=new Map,f=new WeakMap,l=new WeakMap;e.DefendHandler={};const g=new Set(["then","splice"]);function k(t){console.warn("[Defence] "+t+" @",e.GetCallStack())}e.DefendHandler.get=function(t,r){r in t||"symbol"===typeof r||g.has(r)||k(`Accessed missing property '${r}' from defended object '${e.getName(t)}', returning undefined`);l.has(t)&&"symbol"!==typeof r&&!g.has(r)&&k(`Accessed property '${r}' on a released object '${e.getName(t)}'\nObject was originally released at: ${l.get(t)})\nCall stack at access: `); return t[r]};e.DefendHandler.set=function(t,r,w){r in t||d.has(t)||k(`Set non-existent property '${r}' to '${w}' on defended object '${e.getName(t)}'`);a(t[r],w)||d.has(t)||k(`Set '${e.getType(t[r])}' property '${r}' to type '${e.getType(w)}' on defended object '${e.getName(t)}'`);l.has(t)&&k(`Set property '${r}' on a released object '${e.getName(t)}'\nObject was originally released at: ${l.get(t)})\nCall stack at access: `);t[r]=w;return!0};e.DefendHandler.deleteProperty=function(t,r){throw new ReferenceError(`Cannot delete property '${r}' from defended object '${e.getName(t)}'`); };e.DefendHandler.defineProperty=function(t,r,w){throw new ReferenceError(`Cannot define property '${r}' on defended object '${e.getName(t)}'`);};e.DefendHandler.enumerate=function(t){throw new ReferenceError(`Cannot enumerate defended object '${e.getName(t)}'`);};let m=-1;function u(){m=-1;if(0<d.size||0<c.size){let t=[...new Set([...d.keys()].map(r=>e.getName(r)))].join();console.warn(`An object derived from DefendedBase was not protected with debugDefend(). This will disable some checks. See the coding guidelines! Possible affected class names: ${t}`); d.clear();c.clear()}}e.DefendedBase=class{constructor(){if(e.isDebugDefend&&e.Supports.Proxies){var t=new.target;t=Object.create(t.prototype);var r=new Proxy(t,e.DefendHandler);d.set(t,r);c.set(r,t);f.set(r,t);-1===m&&(m=requestAnimationFrame(u));return r}}};e.debugDefend=function(t){if(e.isDebugDefend&&e.Supports.Proxies&&t instanceof e.DefendedBase){if(!c.has(t))return t;let r=c.get(t);c.delete(t);d.delete(r);return t}return e.isDebug?Object.seal(t):t};e.New=function(t,...r){let w;try{w=new t(...r)}catch(y){throw c.clear(), d.clear(),y;}e.isDebugDefend&&q(t,w);return e.debugDefend(w)};e.Release=function(t){(t=f.get(t))&&l.set(t,e.GetCallStack())};e.WasReleased=function(t){return(t=f.get(t))?!!l.get(t):!1};let x=new Map;function n(t){let r=new Set;for(let w in t)r.add(w);return r}function q(t,r){r=n(r);let w=x.get(t);if(w){let y=[];for(let C of w.values())r.has(C)?r.delete(C):y.push(C);e.appendArray(y,[...r]);y.length&&console.warn(`[Defence] '${e.getName(t)}' constructor creates inconsistent properties: ${y.join(", ")}`)}else x.set(t, r)}e.PerfMark=class{constructor(t){this._name="";t&&this.start(t)}start(t){this._name=t;performance.mark(this._name+"-Start")}end(){performance.mark(this._name+"-End");performance.measure(this._name,this._name+"-Start",this._name+"-End")}next(t){this.end();this._name=t;performance.mark(this._name+"-Start")}}} {"use strict";const e=self.C3,b=2*Math.PI,a=Math.PI/180,d=180/Math.PI;e.wrap=function(l,g,k){l=Math.floor(l);g=Math.floor(g);k=Math.floor(k);return l<g?(l=k-(g-l)%(k-g),l===k?0:l):g+(l-g)%(k-g)};e.mapToRange=function(l,g,k,m,u){return(l-g)*(u-m)/(k-g)+m};e.normalize=function(l,g,k){return(l-g)/(k-g)};e.clamp=function(l,g,k){return l<g?g:l>k?k:l};e.clampAngle=function(l){l%=b;0>l&&(l+=b);return l};e.toRadians=function(l){return l*a};e.toDegrees=function(l){return l*d};e.distanceTo=function(l,g,k,m){return Math.hypot(k- l,m-g)};e.distanceSquared=function(l,g,k,m){l=k-l;g=m-g;return l*l+g*g};e.angleTo=function(l,g,k,m){return Math.atan2(m-g,k-l)};e.angleDiff=function(l,g){if(l===g)return 0;l=Math.sin(l)*Math.sin(g)+Math.cos(l)*Math.cos(g);return 1<=l?0:-1>=l?Math.PI:Math.acos(l)};e.angleRotate=function(l,g,k){let m=Math.sin(l),u=Math.cos(l),x=Math.sin(g),n=Math.cos(g);return Math.acos(m*x+u*n)>k?0<u*x-m*n?e.clampAngle(l+k):e.clampAngle(l-k):e.clampAngle(g)};e.angleClockwise=function(l,g){return 0>=Math.cos(l)*Math.sin(g)- Math.sin(l)*Math.cos(g)};e.angleLerp=function(l,g,k,m=0){let u=e.angleDiff(l,g);m*=b;return e.angleClockwise(g,l)?e.clampAngle(l+(u+m)*k):e.clampAngle(l-(u+m)*k)};e.angleLerpClockwise=function(l,g,k,m=0){const u=e.angleDiff(l,g);m*=b;return e.angleClockwise(g,l)?e.clampAngle(l+(u+m)*k):e.clampAngle((b-u+m)*k)};e.angleLerpAntiClockwise=function(l,g,k,m=0){const u=e.angleDiff(l,g);m*=b;return e.angleClockwise(g,l)?e.clampAngle((-b+u-m)*k):e.clampAngle(l-(u+m)*k)};e.lerp=function(l,g,k){return l+k*(g- l)};e.unlerp=function(l,g,k){return l===g?0:(k-l)/(g-l)};e.relerp=function(l,g,k,m,u){return e.lerp(m,u,e.unlerp(l,g,k))};e.qarp=function(l,g,k,m){return e.lerp(e.lerp(l,g,m),e.lerp(g,k,m),m)};e.cubic=function(l,g,k,m,u){return e.lerp(e.qarp(l,g,k,u),e.qarp(g,k,m,u),u)};e.cosp=function(l,g,k){return(l+g+(l-g)*Math.cos(k*Math.PI))/2};e.isPOT=function(l){return 0<l&&0===(l-1&l)};e.nextHighestPowerOfTwo=function(l){--l;for(let g=1;32>g;g<<=1)l|=l>>g;return l+1};e.roundToNearestFraction=function(l,g){return Math.round(l* g)/g};e.floorToNearestFraction=function(l,g){return Math.floor(l*g)/g};e.round6dp=function(l){return Math.round(1E6*l)/1E6};e.toFixed=function(l,g){l=l.toFixed(g);for(g=l.length-1;0<=g&&"0"===l.charAt(g);--g);0<=g&&"."===l.charAt(g)&&--g;return 0>g?l:l.substr(0,g+1)};e.PackRGB=function(l,g,k){return e.clamp(l,0,255)|e.clamp(g,0,255)<<8|e.clamp(k,0,255)<<16};e.PackRGBAEx=function(l,g,k,m){l=e.clamp(Math.floor(1024*l),-8192,8191);g=e.clamp(Math.floor(1024*g),-8192,8191);k=e.clamp(Math.floor(1024*k), -8192,8191);m=e.clamp(Math.floor(1023*m),0,1023);0>l&&(l+=16384);0>g&&(g+=16384);0>k&&(k+=16384);return-(274877906944*l+16777216*g+1024*k+m)};e.PackRGBEx=function(l,g,k){return e.PackRGBAEx(l,g,k,1)};function c(l){return 0===l&&0>1/l}e.GetRValue=function(l){if(0<=l)return(l&255)/255;l=Math.floor(-l/274877906944);8191<l&&(l-=16384);return l/1024};e.GetGValue=function(l){if(0<=l)return((l&65280)>>8)/255;l=Math.floor(-l%274877906944/16777216);8191<l&&(l-=16384);return l/1024};e.GetBValue=function(l){if(0<= l)return((l&16711680)>>16)/255;l=Math.floor(-l%16777216/1024);8191<l&&(l-=16384);return l/1024};e.GetAValue=function(l){return c(l)?0:0<=l?1:Math.floor(-l%1024)/1023};e.greatestCommonDivisor=function(l,g){l=Math.floor(l);for(g=Math.floor(g);0!==g;){let k=g;g=l%g;l=k}return l};const f=[[3,2],[4,3],[5,4],[5,3],[6,5],[14,9],[16,9],[16,10],[21,9]];e.getAspectRatio=function(l,g){l=Math.floor(l);g=Math.floor(g);if(l===g)return[1,1];for(var k of f){let m=l/k[0]*k[1];if(1>Math.abs(g-m))return k.slice(0); m=l/k[1]*k[0];if(1>Math.abs(g-m))return[k[1],k[0]]}k=e.greatestCommonDivisor(l,g);return[l/k,g/k]};e.segmentsIntersect=function(l,g,k,m,u,x,n,q){var t=Math.min(l,k),r=Math.max(u,n);if(Math.max(l,k)<Math.min(u,n)||t>r)return!1;t=Math.min(g,m);r=Math.max(x,q);if(Math.max(g,m)<Math.min(x,q)||t>r)return!1;t=u-l+n-k;r=x-g+q-m;l=k-l;g=m-g;u=n-u;x=q-x;q=Math.abs(g*u-x*l);return Math.abs(u*r-x*t)>q?!1:Math.abs(l*r-g*t)<=q};e.segmentsIntersectPreCalc=function(l,g,k,m,u,x,n,q,t,r,w,y){const C=Math.max(t,w); if(x<Math.min(t,w)||u>C)return!1;u=Math.max(r,y);if(q<Math.min(r,y)||n>u)return!1;n=t-l+w-k;q=r-g+y-m;l=k-l;g=m-g;t=w-t;r=y-r;y=Math.abs(g*t-r*l);return Math.abs(t*q-r*n)>y?!1:Math.abs(l*q-g*n)<=y};e.segmentIntersectsQuad=function(l,g,k,m,u){const x=Math.min(l,k),n=Math.max(l,k),q=Math.min(g,m),t=Math.max(g,m),r=u.getTlx(),w=u.getTly(),y=u.getTrx(),C=u.getTry(),D=u.getBrx(),G=u.getBry(),K=u.getBlx();u=u.getBly();return e.segmentsIntersectPreCalc(l,g,k,m,x,n,q,t,r,w,y,C)||e.segmentsIntersectPreCalc(l, g,k,m,x,n,q,t,y,C,D,G)||e.segmentsIntersectPreCalc(l,g,k,m,x,n,q,t,D,G,K,u)||e.segmentsIntersectPreCalc(l,g,k,m,x,n,q,t,K,u,r,w)};e.segmentIntersectsAnyN=function(l,g,k,m,u){const x=Math.min(l,k),n=Math.max(l,k),q=Math.min(g,m),t=Math.max(g,m);let r=0;for(let w=u.length-4;r<=w;r+=2)if(e.segmentsIntersectPreCalc(l,g,k,m,x,n,q,t,u[r],u[r+1],u[r+2],u[r+3]))return!0;return e.segmentsIntersectPreCalc(l,g,k,m,x,n,q,t,u[r],u[r+1],u[0],u[1])};e.rayIntersect=function(l,g,k,m,u,x,n,q){k-=l;x=q-x;const t=k* x-(m-g)*(n-u);if(0===t)return 2;m=((g-m)*(n-l)+k*(q-g))/t;return 0<m&&1.000001>m?(x*(n-l)+(u-n)*(q-g))/t:2};e.rayIntersectExtended=function(l,g,k,m,u,x,n,q,t){const r=(n-u)*t;t*=q-x;return e.rayIntersect(l,g,k,m,u-r,x-t,n+r,q+t)};e.isPointInTriangleInclusive=function(l,g,k,m,u,x,n,q){u-=k;x-=m;n-=k;q-=m;l-=k;k=g-m;g=u*u+x*x;m=u*n+x*q;u=u*l+x*k;x=n*n+q*q;n=n*l+q*k;q=1/(g*x-m*m);x=(x*u-m*n)*q;u=(g*n-m*u)*q;return 0<=x&&0<=u&&1>=x+u};e.triangleCartesianToBarycentric=function(l,g,k,m,u,x,n,q){u-=k;x-= m;n-=k;q-=m;l-=k;const t=g-m;g=u*u+x*x;m=u*n+x*q;k=n*n+q*q;u=l*u+t*x;x=l*n+t*q;n=g*k-m*m;q=(k*u-m*x)/n;u=(g*x-m*u)/n;return[1-q-u,q,u]};e.triangleBarycentricToCartesian=function(l,g,k,m,u,x,n,q,t){return[l*m+g*x+k*q,l*u+g*n+k*t]}} {"use strict";const e=self.C3;let b=null,a="";if("undefined"!==typeof document){b=document;const k=document.querySelector("base");if(a=k&&k.hasAttribute("href")?k.getAttribute("href"):"")a.startsWith("/")&&(a=a.substr(1)),a.endsWith("/")||(a+="/")}e.GetBaseHref=function(){return a};e.GetBaseURL=function(){if(!b)return"";const k=b.location;return e.GetPathFromURL(k.origin+k.pathname)+a};e.GetPathFromURL=function(k){if(!k.length||k.endsWith("/")||k.endsWith("\\"))return k;const m=Math.max(k.lastIndexOf("/"), k.lastIndexOf("\\"));return-1===m?"":k.substr(0,m+1)};e.GetFilenameFromURL=function(k){if(!k.length)return k;if(k.endsWith("/")||k.endsWith("\\"))return"";const m=Math.max(k.lastIndexOf("/"),k.lastIndexOf("\\"));return-1===m?k:k.substr(m+1)};e.GetFileExtension=function(k){let m=k.lastIndexOf(".");return 1>m?"":k.substr(m)};e.GetFileNamePart=function(k){let m=k.lastIndexOf(".");return 1>m?k:k.substr(0,m)};e.NormalizeFileSeparator=function(k){return k.replace(/\\/g,"/")};e.IsFileExtension=function(k, m){k=k?e.GetFileExtension(k).slice(1):"";return m===k};e.FileNameEquals=function(k,m){let u,x;e.IsFileLike(k)&&(u=e.GetFileNamePart(k.name));e.IsString(k)&&(u=e.GetFileNamePart(k));e.IsFileLike(m)&&(x=e.GetFileNamePart(m.name));e.IsString(m)&&(x=e.GetFileNamePart(m));return u===x};e.ParseFilePath=function(k){k=e.NormalizeFileSeparator(k);let m=/^\w:\//.exec(k);m?(m=m[0],k=k.slice(3),"/"!==k[0]&&(k="/"+k)):m="";k=k.replace(/\/{2,}/g,"/");1<k.length&&"/"===k.slice(-1)&&(k=k.slice(0,-1));var u=k.lastIndexOf("/")+ 1;let x="",n=k,q="";0<u&&(x=k.slice(0,u),n=k.slice(u));k=n;u=n.lastIndexOf(".");0<u&&(q=n.slice(u),k=n.slice(0,-q.length));return{dir:x,base:n,name:k,root:m,ext:q,full:m+x+n}};e.Wait=function(k,m){return new Promise((u,x)=>{self.setTimeout(u,k,m)})};e.swallowException=function(k){try{k()}catch(m){e.isDebug&&console.warn("Swallowed exception: ",m)}};e.noop=function(){};e.equalsNoCase=function(k,m){return"string"!==typeof k||"string"!==typeof m?!1:k===m||k.normalize().toLowerCase()===m.normalize().toLowerCase()}; e.equalsCase=function(k,m){return"string"!==typeof k||"string"!==typeof m?!1:k===m?!0:k.normalize()===m.normalize()};e.typedArraySet16=function(k,m,u){k[u++]=m[0];k[u++]=m[1];k[u++]=m[2];k[u++]=m[3];k[u++]=m[4];k[u++]=m[5];k[u++]=m[6];k[u++]=m[7];k[u++]=m[8];k[u++]=m[9];k[u++]=m[10];k[u++]=m[11];k[u++]=m[12];k[u++]=m[13];k[u++]=m[14];k[u]=m[15]};e.truncateArray=function(k,m){k.length=m};e.clearArray=function(k){k&&0!==k.length&&e.truncateArray(k,0)};e.clear2DArray=function(k){if(k){for(let m=0;m< k.length;m++)e.truncateArray(k[m],0);e.truncateArray(k,0)}};e.extendArray=function(k,m,u){m|=0;var x=k.length;if(!(m<=x))for(;x<m;++x)k.push(u)};e.resizeArray=function(k,m,u){m|=0;const x=k.length;m<x?e.truncateArray(k,m):m>x&&e.extendArray(k,m,u)};e.shallowAssignArray=function(k,m){e.clearArray(k);e.appendArray(k,m)};e.appendArray=function(k,m){if(1E4>m.length)k.push(...m);else for(let u=0,x=m.length;u<x;++u)k.push(m[u])};e.arrayRemove=function(k,m){m=Math.floor(m);if(!(0>m||m>=k.length)){for(var u= k.length-1;m<u;++m)k[m]=k[m+1];e.truncateArray(k,u)}};e.arrayFindRemove=function(k,m){m=k.indexOf(m);0<=m&&k.splice(m,1)};e.arraysEqual=function(k,m){let u=k.length;if(m.length!==u)return!1;for(let x=0;x<u;++x)if(k[x]!==m[x])return!1;return!0};e.arrayFilterOut=function(k,m){let u=[],x=0;for(let n=0,q=k.length;n<q;++n){let t=k[n];m(t)?u.push(t):(k[x]=t,++x)}e.truncateArray(k,x);return u};e.arrayRemoveAllInSet=function(k,m){const u=k.length;let x=0;for(let n=0,q=k.length;n<q;++n){let t=k[n];m.has(t)|| (k[x++]=t)}e.truncateArray(k,x);return u-x};e.isArrayIndexInBounds=function(k,m){return k!==Math.floor(k)?!1:0<=k&&k<m.length};e.validateArrayIndex=function(k,m){if(!e.isArrayIndexInBounds(k,m))throw new RangeError("array index out of bounds");};e.cloneArray=function(k){return k.slice()};e.deepCloneArray=function(k,m){let u=[];for(let x of k)if(e.IsObject(x)){k=m(x);if(!k)throw Error("missing clone");if(k.constructor!==x.constructor)throw Error("object is not a clone");u.push(k)}else e.IsArray(x)? u.push(e.deepCloneArray(x,m)):u.push(x);return u};e.clone2DArray=function(k){let m=[];for(let u of k)m.push(u.slice());return m};e.mergeSets=function(k,m){return new Set([...k,...m])};e.mergeSetsInPlace=function(k,m){for(const u of m)k.add(u);return k};e.first=function(k){for(let m of k)return m;return null};e.xor=function(k,m){return!k!==!m};e.compare=function(k,m,u){switch(m){case 0:return k===u;case 1:return k!==u;case 2:return k<u;case 3:return k<=u;case 4:return k>u;case 5:return k>=u;default:return!1}}; e.hasAnyOwnProperty=function(k){for(let m in k)if(k.hasOwnProperty(m))return!0;return!1};e.PromiseAllWithProgress=function(k,m){return k.length?new Promise((u,x)=>{const n=[];let q=0,t=!1;for(let r=0,w=k.length;r<w;++r)n.push(void 0),k[r].then(y=>{t||(n[r]=y,++q,q===k.length?u(n):m(q,k.length))}).catch(y=>{t=!0;x(y)})}):Promise.resolve([])};let d=[];e.AddLibraryMemoryCallback=function(k){d.push(k)};e.GetEstimatedLibraryMemoryUsage=function(){let k=0;for(let m of d){let u=m();k+=u}return Math.floor(k)}; let c=1;const f=new Map,l=new MessageChannel;l.port2.onmessage=function(k){k=k.data;const m=f.get(k);f.delete(k);m&&m(performance.now())};e.RequestUnlimitedAnimationFrame=function(k){const m=c++;f.set(m,k);l.port1.postMessage(m);return m};e.CancelUnlimitedAnimationFrame=function(k){f.delete(k)};e.PostTask=e.RequestUnlimitedAnimationFrame;e.WaitForNextTask=function(){return new Promise(k=>e.PostTask(k))};const g=new Set;e.RequestPostAnimationFrame=function(k){const m=self.requestAnimationFrame(async u=> {await e.WaitForNextTask();g.has(m)&&(g.delete(m),k(u))});g.add(m);return m};e.CancelPostAnimationFrame=function(k){g.has(k)&&(self.cancelAnimationFrame(k),g.delete(k))}} {"use strict";const e=self.C3;e.IsAbsoluteURL=function(b){return/^(?:[a-z\-]+:)?\/\//.test(b)||"data:"===b.substr(0,5)||"blob:"===b.substr(0,5)};e.IsRelativeURL=function(b){return!e.IsAbsoluteURL(b)};e.ThrowIfNotOk=function(b){if(!b.ok)throw Error(`fetch '${b.url}' response returned ${b.status} ${b.statusText}`);};e.FetchOk=function(b,a){return fetch(b,a).then(d=>{e.ThrowIfNotOk(d);return d})};e.FetchText=function(b){return e.FetchOk(b).then(a=>a.text())};e.FetchJson=function(b){return e.FetchOk(b).then(a=> a.json())};e.FetchBlob=function(b){return e.FetchOk(b).then(a=>a.blob())};e.FetchArrayBuffer=function(b){return e.FetchOk(b).then(a=>a.arrayBuffer())};e.FetchImage=function(b){return new Promise((a,d)=>{const c=new Image;c.onload=()=>a(c);c.onerror=f=>d(f);c.src=b})};e.BlobToArrayBuffer=function(b){return"function"===typeof b.arrayBuffer?b.arrayBuffer():new Promise((a,d)=>{const c=new FileReader;c.onload=()=>a(c.result);c.onerror=()=>d(c.error);c.readAsArrayBuffer(b)})};e.BlobToString=function(b){return"function"=== typeof b.text?b.text():new Promise((a,d)=>{const c=new FileReader;c.onload=()=>a(c.result);c.onerror=()=>d(c.error);c.readAsText(b)})};e.BlobToJson=function(b){return e.BlobToString(b).then(a=>JSON.parse(a))};e.BlobToImage=async function(b,a){b=URL.createObjectURL(b);try{const d=await e.FetchImage(b);URL.revokeObjectURL(b);b="";a&&"function"===typeof d.decode&&await d.decode();return d}finally{b&&URL.revokeObjectURL(b)}};e.CreateCanvas=function(b,a){if("undefined"!==typeof document&&"function"=== typeof document.createElement){const d=document.createElement("canvas");d.width=b;d.height=a;return d}return new OffscreenCanvas(b,a)};e.CanvasToBlob=function(b,a,d){"number"!==typeof d&&(d=1);a=a||"image/png";d=e.clamp(d,0,1);return b.toBlob?new Promise(c=>b.toBlob(c,a,d)):b.convertToBlob?b.convertToBlob({type:a,quality:d}):e.Asyncify(()=>e.CanvasToBlobSync(b,a,d))};e.CanvasToBlobSync=function(b,a,d){"number"!==typeof d&&(d=1);a=a||"image/png";d=e.clamp(d,0,1);return e.DataURIToBinaryBlobSync(b.toDataURL(a, d))};e.DataURIToBinaryBlobSync=function(b){b=e.ParseDataURI(b);return e.BinaryStringToBlob(b.data,b.mime_type)};e.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 d=b.substring(5,a);b=b.substring(a+1);a=d.split(";");d=a[0]||"";let c=a[2];b="base64"===a[1]||"base64"===c?atob(b):decodeURIComponent(b);return{mime_type:d,data:b}};e.BinaryStringToBlob=function(b,a){var d=b.length; let c=d>>2,f=new Uint8Array(d),l=new Uint32Array(f.buffer,0,c),g,k;for(k=g=0;g<c;++g)l[g]=b.charCodeAt(k++)|b.charCodeAt(k++)<<8|b.charCodeAt(k++)<<16|b.charCodeAt(k++)<<24;for(d&=3;d--;)f[k]=b.charCodeAt(k),++k;return a?new Blob([f],{type:a}):new Blob([f])};e.DrawableToBlob=function(b,a,d){const c=e.CreateCanvas(b.width,b.height);c.getContext("2d").drawImage(b,0,0);return e.CanvasToBlob(c,a,d)};e.ImageDataToBlobSync=function(b,a,d){const c=e.CreateCanvas(b.width,b.height);c.getContext("2d").putImageData(b, 0,0);return e.CanvasToBlobSync(c,a,d)};e.ImageDataToBlob=function(b,a,d){if(e.Supports.ImageBitmapOptions)return createImageBitmap(b,{premultiplyAlpha:"none"}).then(c=>e.DrawableToBlob(c,a,d));if(e.Supports.ImageBitmap)return createImageBitmap(b).then(c=>e.DrawableToBlob(c,a,d));{const c=e.CreateCanvas(b.width,b.height);c.getContext("2d").putImageData(b,0,0);return e.CanvasToBlob(c,a,d)}};e.CopySet=function(b,a){b.clear();for(const d of a)b.add(d)};e.MapToObject=function(b){const a=Object.create(null); for(const [d,c]of b.entries())a[d]=c;return a};e.ObjectToMap=function(b,a){a.clear();for(const [d,c]of Object.entries(b))a.set(d,c)};e.ToSuperJSON=function d(a){if("object"===typeof a&&null!==a){if(a instanceof Set)return{_c3type_:"set",data:[...a].map(c=>d(c))};if(a instanceof Map)return{_c3type_:"map",data:[...a].map(c=>[c[0],d(c[1])])};{const c=Object.create(null);for(const [f,l]of Object.entries(a))c[f]=d(l);return c}}return a};e.FromSuperJSON=function c(d){if("object"===typeof d&null!==d){if("set"=== d._c3type_)return new Set(d.data.map(f=>c(f)));if("map"===d._c3type_)return new Map(d.data.map(f=>[f[0],c(f[1])]));{const f=Object.create(null);for(const [l,g]of Object.entries(d))f[l]=c(g);return f}}return d};e.CSSToCamelCase=function(d){let c="",f=!1;for(const l of d)"-"===l?f=!0:f?(c+=l.toUpperCase(),f=!1):c+=l;return c};e.IsIterator=function(d){return"object"===typeof d&&"function"===typeof d.next};e.MakeFilledArray=function(d,c){const f=[];if("function"===typeof c)for(var l=0;l<d;++l)f.push(c()); else for(l=0;l<d;++l)f.push(c);return f}} {"use strict";const e=self.C3,b=/([0-9.]+),([0-9.]+)%?,([0-9.]+)%?/i,a=/([0-9.]+),([0-9.]+)%?,([0-9.]+)%?,([0-9.])/i;function d(f){return 0===f.length?"00":1===f.length?"0"+f:f}function c(f,l,g){0>g&&(g+=1);1<g&&--g;return g<1/6?f+6*(l-f)*g:.5>g?l:g<2/3?f+(l-f)*(2/3-g)*6:f}e.Color=class{constructor(f,l,g,k){this._a=this._b=this._g=this._r=0;f instanceof e.Color?this.set(f):this.setRgba(f||0,l||0,g||0,k||0)}setRgb(f,l,g){this._r=+f;this._g=+l;this._b=+g;this.clamp();return this}setRgba(f,l,g,k){this._r= +f;this._g=+l;this._b=+g;this._a=+k;this.clamp();return this}set(f){this._r=f._r;this._g=f._g;this._b=f._b;this._a=f._a;return this}copy(f){return this.set(f)}add(f){this._r+=f._r;this._g+=f._g;this._b+=f._b;this._a+=f._a;this.clamp()}addRgb(f,l,g,k=0){this._r+=+f;this._g+=+l;this._b+=+g;this._a+=+k;this.clamp()}diff(f){this.setR(Math.max(this._r,f._r)-Math.min(this._r,f._r));this.setG(Math.max(this._g,f._g)-Math.min(this._g,f._g));this.setB(Math.max(this._b,f._b)-Math.min(this._b,f._b));this.setA(Math.max(this._a, f._a)-Math.min(this._a,f._a));this.clamp()}copyRgb(f){this._r=f._r;this._g=f._g;this._b=f._b}setR(f){this._r=e.clamp(+f,0,1)}getR(){return this._r}setG(f){this._g=e.clamp(+f,0,1)}getG(){return this._g}setB(f){this._b=e.clamp(+f,0,1)}getB(){return this._b}setA(f){this._a=e.clamp(+f,0,1)}getA(){return this._a}clone(){return e.New(e.Color,this._r,this._g,this._b,this._a)}toArray(){return[this._r,this._g,this._b,this._a]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(f,l){f[l++]= this._r;f[l++]=this._g;f[l++]=this._b;f[l]=this._a}equals(f){return this._r===f._r&&this._g===f._g&&this._b===f._b&&this._a===f._a}equalsIgnoringAlpha(f){return this._r===f._r&&this._g===f._g&&this._b===f._b}equalsRgb(f,l,g){return this._r===f&&this._g===l&&this._b===g}equalsRgba(f,l,g,k){return this._r===f&&this._g===l&&this._b===g&&this._a===k}multiply(f){this._r*=f._r;this._g*=f._g;this._b*=f._b;this._a*=f._a}multiplyAlpha(f){this._r*=f;this._g*=f;this._b*=f;this._a*=f}premultiply(){this._r*=this._a; this._g*=this._a;this._b*=this._a;return this}unpremultiply(){this._r/=this._a;this._g/=this._a;this._b/=this._a;return this}clamp(){this._r=e.clamp(this._r,0,1);this._g=e.clamp(this._g,0,1);this._b=e.clamp(this._b,0,1);this._a=e.clamp(this._a,0,1);return this}setFromRgbValue(f){this._r=e.GetRValue(f);this._g=e.GetGValue(f);this._b=e.GetBValue(f);this._a=e.GetAValue(f)}getCssRgb(f,l,g){f=e.IsFiniteNumber(f)?f:this.getR();l=e.IsFiniteNumber(l)?l:this.getG();g=e.IsFiniteNumber(g)?g:this.getB();return`rgb(${100* f}%, ${100*l}%, ${100*g}%)`}getCssRgba(f,l,g,k){f=e.IsFiniteNumber(f)?f:this.getR();l=e.IsFiniteNumber(l)?l:this.getG();g=e.IsFiniteNumber(g)?g:this.getB();k=e.IsFiniteNumber(k)?k:this.getA();return`rgba(${100*f}%, ${100*l}%, ${100*g}%, ${k})`}toHexString(){const f=Math.round(255*this.getR()),l=Math.round(255*this.getG()),g=Math.round(255*this.getB());return"#"+d(f.toString(16))+d(l.toString(16))+d(g.toString(16))}parseHexString(f){if("string"!==typeof f)return!1;f=f.trim();"#"===f.charAt(0)&&(f= f.substr(1));let l,g;if(3===f.length)l=parseInt(f[0],16)/15,g=parseInt(f[1],16)/15,f=parseInt(f[2],16)/15;else if(6===f.length)l=parseInt(f.substr(0,2),16)/255,g=parseInt(f.substr(2,2),16)/255,f=parseInt(f.substr(4,2),16)/255;else return!1;isFinite(l)&&this.setR(l);isFinite(g)&&this.setG(g);isFinite(f)&&this.setB(f);this.setA(1);return!0}toCommaSeparatedRgb(){const f=Math.round(255*this.getR()),l=Math.round(255*this.getG()),g=Math.round(255*this.getB());return`${f}, ${l}, ${g}`}toRgbArray(){const f= Math.round(255*this.getR()),l=Math.round(255*this.getG()),g=Math.round(255*this.getB());return[f,l,g]}parseCommaSeparatedRgb(f){if("string"!==typeof f)return!1;f=f.replace(/^rgb\(|\)|%/,"");var l=f.split(",");if(3>l.length)return!1;f=parseInt(l[0].trim(),10)/255;const g=parseInt(l[1].trim(),10)/255;l=parseInt(l[2].trim(),10)/255;isFinite(f)&&this.setR(f);isFinite(g)&&this.setG(g);isFinite(l)&&this.setB(l);this.setA(1);return!0}parseCommaSeparatedPercentageRgb(f){if("string"!==typeof f)return!1;f= f.replace(/^rgb\(|\)|%/,"");var l=f.split(",");if(3>l.length)return!1;f=parseInt(l[0].trim(),10)/100;const g=parseInt(l[1].trim(),10)/100;l=parseInt(l[2].trim(),10)/100;isFinite(f)&&this.setR(f);isFinite(g)&&this.setG(g);isFinite(l)&&this.setB(l);this.setA(1);return!0}parseCommaSeparatedRgba(f){if("string"!==typeof f)return!1;f=f.replace(/^rgba\(|\)|%/,"");var l=f.split(",");if(4>l.length)return!1;f=parseInt(l[0].trim(),10)/255;const g=parseInt(l[1].trim(),10)/255,k=parseInt(l[2].trim(),10)/255;l= parseFloat(l[3].trim());isFinite(f)&&this.setR(f);isFinite(g)&&this.setG(g);isFinite(k)&&this.setB(k);isFinite(l)&&this.setA(l);return!0}parseCommaSeparatedPercentageRgba(f){if("string"!==typeof f)return!1;f=f.replace(/^rgba\(|\)|%/,"");var l=f.split(",");if(4>l.length)return!1;f=parseInt(l[0].trim(),10)/100;const g=parseInt(l[1].trim(),10)/100,k=parseInt(l[2].trim(),10)/100;l=parseFloat(l[3].trim());isFinite(f)&&this.setR(f);isFinite(g)&&this.setG(g);isFinite(k)&&this.setB(k);isFinite(l)&&this.setA(l); return!0}parseString(f){if("string"!==typeof f)return!1;f=f.replace(/\s+/,"");if(f.includes(",")){if(f.startsWith("rgb("))return f.includes("%")?this.parseCommaSeparatedPercentageRgb(f):this.parseCommaSeparatedRgb(f);if(f.startsWith("rgba("))return f.includes("%")?this.parseCommaSeparatedPercentageRgba(f):this.parseCommaSeparatedRgba(f);if(f.startsWith("hsl(")||f.startsWith("hsla("))return this.parseHSLString(f);{const l=f.split(",");if(f.includes("%")){if(3===l.length)return this.parseCommaSeparatedPercentageRgb(f); if(4===l.length)return this.parseCommaSeparatedPercentageRgba(f)}else{if(3===l.length)return this.parseCommaSeparatedRgb(f);if(4===l.length)return this.parseCommaSeparatedRgba(f)}return!1}}return this.parseHexString(f)}toJSON(){return[this._r,this._g,this._b,this._a]}setFromHSLA(f,l,g,k){f%=360;l=e.clamp(l,0,100);g=e.clamp(g,0,100);k=e.clamp(k,0,1);f/=360;l/=100;g/=100;if(0===l)g=l=f=g;else{const m=.5>g?g*(1+l):g+l-g*l,u=2*g-m;g=c(u,m,f+1/3);l=c(u,m,f);f=c(u,m,f-1/3)}this.setR(g);this.setG(l);this.setB(f); this.setA(k);return this}parseHSLString(f){var l=f.replace(/ |hsl|hsla|\(|\)|;/gi,"");f=b.exec(l);l=a.exec(l);return f&&4===f.length?(this.setFromHSLA(+f[1],+f[2],+f[3],1),!0):l&&5===l.length?(this.setFromHSLA(+f[1],+f[2],+f[3],+f[4]),!0):!1}toHSLAString(){var f=this._r;const l=this._g,g=this._b,k=this._a,m=e.Color.GetHue(f,l,g),u=e.Color.GetSaturation(f,l,g);f=e.Color.GetLuminosity(f,l,g);return`hsla(${m}, ${u}%, ${f}%, ${k})`}toHSLAArray(){const f=this._r,l=this._g,g=this._b;return[e.Color.GetHue(f, l,g),e.Color.GetSaturation(f,l,g),e.Color.GetLuminosity(f,l,g),this._a]}setFromJSON(f){!Array.isArray(f)||3>f.length||(this._r=f[0],this._g=f[1],this._b=f[2],this._a=4<=f.length?f[3]:1)}set r(f){this.setR(f)}get r(){return this.getR()}set g(f){this.setG(f)}get g(){return this.getG()}set b(f){this.setB(f)}get b(){return this.getB()}set a(f){this.setA(f)}get a(){return this.getA()}setAtIndex(f,l){switch(f){case 0:this.setR(l);break;case 1:this.setG(l);break;case 2:this.setB(l);break;case 3:this.setA(l); break;default:throw new RangeError("invalid color index");}}getAtIndex(f){switch(f){case 0:return this.getR();case 1:return this.getG();case 2:return this.getB();case 3:return this.getA();default:throw new RangeError("invalid color index");}}static Equals(f,l){let g;if(Array.isArray(f))g=new e.Color,g.setFromJSON(f);else if(f instanceof e.Color)g=f;else throw Error("unexpected type");if(Array.isArray(l))f=new e.Color,f.setFromJSON(l);else if(l instanceof e.Color)f=l;else throw Error("unexpected type"); return g.equals(f)}static DiffChannel(f,l){return e.clamp(Math.max(f,l)-Math.min(f,l),0,1)}static Diff(f,l){const g=new e.Color;g.setR(Math.max(f._r,l._r)-Math.min(f._r,l._r));g.setG(Math.max(f._g,l._g)-Math.min(f._g,l._g));g.setB(Math.max(f._b,l._b)-Math.min(f._b,l._b));g.setA(Math.max(f._a,l._a)-Math.min(f._a,l._a));return g}static DiffNoAlpha(f,l){const g=new e.Color(0,0,0,1);g.setR(Math.max(f._r,l._r)-Math.min(f._r,l._r));g.setG(Math.max(f._g,l._g)-Math.min(f._g,l._g));g.setB(Math.max(f._b,l._b)- Math.min(f._b,l._b));return g}static GetHue(f,l,g){const k=Math.max(f,l,g),m=Math.min(f,l,g);if(k===m)return 0;let u=0;switch(k){case f:u=(l-g)/(k-m)+(l<g?6:0);break;case l:u=(g-f)/(k-m)+2;break;case g:u=(f-l)/(k-m)+4}return Math.round(u/6*360)}static GetSaturation(f,l,g){const k=Math.max(f,l,g);f=Math.min(f,l,g);if(k===f)return 0;l=k-f;return Math.round(100*(.5<(k+f)/2?l/(2-k-f):l/(k+f)))}static GetLuminosity(f,l,g){const k=Math.max(f,l,g);return k?Math.round((k+Math.min(f,l,g))/2*100):0}};e.Color.White= Object.freeze(e.New(e.Color,1,1,1,1));e.Color.Black=Object.freeze(e.New(e.Color,0,0,0,1));e.Color.TransparentBlack=Object.freeze(e.New(e.Color,0,0,0,0))} {"use strict";const e=self.C3;e.Vector2=class{constructor(b,a){this._y=this._x=0;b instanceof e.Vector2?this.copy(b):this.set(b||0,a||0)}set(b,a){this._x=+b;this._y=+a}copy(b){this._x=b._x;this._y=b._y}equals(b){return this._x===b._x&&this._y===b._y}equalsValues(b,a){return this._x===b&&this._y===a}setX(b){this._x=+b}getX(){return this._x}setY(b){this._y=+b}getY(){return this._y}toArray(){return[this._x,this._y]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(b,a){b[a++]= this._x;b[a]=this._y}offset(b,a){this._x+=+b;this._y+=+a}scale(b,a){this._x*=b;this._y*=a}divide(b,a){this._x/=b;this._y/=a}round(){this._x=Math.round(this._x);this._y=Math.round(this._y)}floor(){this._x=Math.floor(this._x);this._y=Math.floor(this._y)}ceil(){this._x=Math.ceil(this._x);this._y=Math.ceil(this._y)}angle(){return e.angleTo(0,0,this._x,this._y)}lengthSquared(){return this._x*this._x+this._y*this._y}length(){return Math.sqrt(this.lengthSquared())}rotatePrecalc(b,a){const d=this._x*a-this._y* b;this._y=this._y*a+this._x*b;this._x=d}rotate(b){0!==b&&this.rotatePrecalc(Math.sin(b),Math.cos(b))}rotateAbout(b,a,d){0===b||a===this._x&&d===this._y||(this._x-=a,this._y-=d,this.rotatePrecalc(Math.sin(b),Math.cos(b)),this._x+=+a,this._y+=+d)}move(b,a){0!==a&&(this._x+=Math.cos(b)*a,this._y+=Math.sin(b)*a)}normalize(){const b=this.length();0!==b&&1!==b&&(this._x/=b,this._y/=b)}clamp(b,a){this._x=e.clamp(this._x,b,a);this._y=e.clamp(this._y,b,a)}}} {"use strict";const e=self.C3;e.Rect=class{constructor(b,a,d,c){this._bottom=this._right=this._top=this._left=0;b instanceof e.Rect?this.copy(b):this.set(b||0,a||0,d||0,c||0)}set(b,a,d,c){this._left=+b;this._top=+a;this._right=+d;this._bottom=+c}setWH(b,a,d,c){b=+b;a=+a;this._left=b;this._top=a;this._right=b+ +d;this._bottom=a+ +c}copy(b){this._left=+b._left;this._top=+b._top;this._right=+b._right;this._bottom=+b._bottom}clone(){return new e.Rect(this._left,this._top,this._right,this._bottom)}static Merge(b, a){const d=new e.Rect;d.setLeft(Math.min(b._left,a._left));d.setTop(Math.min(b._top,a._top));d.setRight(Math.max(b._right,a._right));d.setBottom(Math.max(b._bottom,a._bottom));return d}static FromObject(b){return new e.Rect(b.left,b.top,b.right,b.bottom)}equals(b){return this._left===b._left&&this._top===b._top&&this._right===b._right&&this._bottom===b._bottom}equalsWH(b,a,d,c){return this._left===b&&this._top===a&&this.width()===d&&this.height()===c}setLeft(b){this._left=+b}getLeft(){return this._left}setTop(b){this._top= +b}getTop(){return this._top}setRight(b){this._right=+b}getRight(){return this._right}setBottom(b){this._bottom=+b}getBottom(){return this._bottom}toArray(){return[this._left,this._top,this._right,this._bottom]}toTypedArray(){return new Float64Array(this.toArray())}toDOMRect(){return new DOMRect(this._left,this._top,this.width(),this.height())}writeToTypedArray(b,a){b[a++]=this._left;b[a++]=this._top;b[a++]=this._right;b[a]=this._bottom}writeAsQuadToTypedArray(b,a){b[a++]=this._left;b[a++]=this._top; b[a++]=this._right;b[a++]=this._top;b[a++]=this._right;b[a++]=this._bottom;b[a++]=this._left;b[a]=this._bottom}writeAsQuadToTypedArray3D(b,a,d){b[a++]=this._left;b[a++]=this._top;b[a++]=d;b[a++]=this._right;b[a++]=this._top;b[a++]=d;b[a++]=this._right;b[a++]=this._bottom;b[a++]=d;b[a++]=this._left;b[a++]=this._bottom;b[a]=d}width(){return this._right-this._left}height(){return this._bottom-this._top}midX(){return(this._left+this._right)/2}midY(){return(this._top+this._bottom)/2}offset(b,a){b=+b;a= +a;this._left+=b;this._top+=a;this._right+=b;this._bottom+=a}offsetLeft(b){this._left+=+b}offsetTop(b){this._top+=+b}offsetRight(b){this._right+=+b}offsetBottom(b){this._bottom+=+b}toSquare(b){if("x"!==b)throw Error("invalid axis, only 'x' supported");this._bottom=this._top<this._bottom?this._left<this._right?this._top+this.width():this._top-this.width():this._left<this._right?this._top-this.width():this._top+this.width()}inflate(b,a){b=+b;a=+a;this._left-=b;this._top-=a;this._right+=b;this._bottom+= a}deflate(b,a){b=+b;a=+a;this._left+=b;this._top+=a;this._right-=b;this._bottom-=a}multiply(b,a){this._left*=b;this._top*=a;this._right*=b;this._bottom*=a}divide(b,a){this._left/=b;this._top/=a;this._right/=b;this._bottom/=a}mirrorAround(b){this._left=+b-this._left;this._right=+b-this._right}flipAround(b){this._top=+b-this._top;this._bottom=+b-this._bottom}swapLeftRight(){const b=this._left;this._left=this._right;this._right=b}swapTopBottom(){const b=this._top;this._top=this._bottom;this._bottom= b}shuntY(b){const a=this._top;this._top=+b-this._bottom;this._bottom=+b-a}round(){this._left=Math.round(this._left);this._top=Math.round(this._top);this._right=Math.round(this._right);this._bottom=Math.round(this._bottom)}roundInner(){this._left=Math.ceil(this._left);this._top=Math.ceil(this._top);this._right=Math.floor(this._right);this._bottom=Math.floor(this._bottom)}roundOuter(){this._left=Math.floor(this._left);this._top=Math.floor(this._top);this._right=Math.ceil(this._right);this._bottom=Math.ceil(this._bottom)}floor(){this._left= Math.floor(this._left);this._top=Math.floor(this._top);this._right=Math.floor(this._right);this._bottom=Math.floor(this._bottom)}ceil(){this._left=Math.ceil(this._left);this._top=Math.ceil(this._top);this._right=Math.ceil(this._right);this._bottom=Math.ceil(this._bottom)}clamp(b,a,d,c){this._left<b&&(this._left=+b);this._top<a&&(this._top=+a);this._right>d&&(this._right=+d);this._bottom>c&&(this._bottom=+c)}clampFlipped(b,a,d,c){this._left<b&&(this._left=+b);this._top>a&&(this._top=+a);this._right> d&&(this._right=+d);this._bottom<c&&(this._bottom=+c)}normalize(){this._left>this._right&&this.swapLeftRight();this._top>this._bottom&&this.swapTopBottom()}intersectsRect(b){return!(b._right<this._left||b._bottom<this._top||b._left>this._right||b._top>this._bottom)}intersectsRectOffset(b,a,d){return!(b._right+a<this._left||b._bottom+d<this._top||b._left+a>this._right||b._top+d>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._left<this._left&&(this._left=+b._left);b._top<this._top&&(this._top=+b._top);b._right>this._right&&(this._right=+b._right);b._bottom>this._bottom&&(this._bottom=+b._bottom)}lerpInto(b){this._left=e.lerp(b._left,b._right,this._left);this._top=e.lerp(b._top,b._bottom,this._top);this._right=e.lerp(b._left,b._right,this._right);this._bottom=e.lerp(b._top,b._bottom,this._bottom)}}} {"use strict";const e=self.C3;e.Quad=class{constructor(b,a,d,c,f,l,g,k){this._bly=this._blx=this._bry=this._brx=this._try=this._trx=this._tly=this._tlx=0;b instanceof e.Quad?this.copy(b):this.set(b||0,a||0,d||0,c||0,f||0,l||0,g||0,k||0)}set(b,a,d,c,f,l,g,k){this._tlx=+b;this._tly=+a;this._trx=+d;this._try=+c;this._brx=+f;this._bry=+l;this._blx=+g;this._bly=+k}setRect(b,a,d,c){this.set(b,a,d,a,d,c,b,c)}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,d){b[a++]=this._tlx;b[a++]=this._tly;b[a++]=d;b[a++]=this._trx;b[a++]=this._try;b[a++]=d;b[a++]=this._brx;b[a++]=this._bry;b[a++]=d;b[a++]=this._blx;b[a++]=this._bly;b[a]=d}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,d){const c=b._left*a,f=b._top*a,l=b._right*a;a*=b._bottom; const g=b._left*d,k=b._top*d,m=b._right*d;b=b._bottom*d;this._tlx=g-f;this._tly=k+c;this._trx=m-f;this._try=k+l;this._brx=m-a;this._bry=b+l;this._blx=g-a;this._bly=b+c}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 d=this._trx-this._tlx,c=this._try-this._tly;const f=this._brx-this._tlx,l=this._bry-this._tly; b-=this._tlx;a-=this._tly;var g=d*d+c*c;let k=d*f+c*l;c=d*b+c*a;const m=f*f+l*l,u=f*b+l*a;let x=1/(g*m-k*k);d=(m*c-k*u)*x;g=(g*u-k*c)*x;if(0<=d&&0<g&&1>d+g)return!0;d=this._blx-this._tlx;c=this._bly-this._tly;g=d*d+c*c;k=d*f+c*l;c=d*b+c*a;x=1/(g*m-k*k);d=(m*c-k*u)*x;g=(g*u-k*c)*x;return 0<=d&&0<g&&1>d+g}midX(){return(this._tlx+this._trx+this._brx+this._blx)/4}midY(){return(this._tly+this._try+this._bry+this._bly)/4}intersectsSegment(b,a,d,c){return this.containsPoint(b,a)||this.containsPoint(d,c)? !0:e.segmentIntersectsQuad(b,a,d,c,this)}intersectsQuad(b){var a=b.midX(),d=b.midY();if(this.containsPoint(a,d))return!0;a=this.midX();d=this.midY();if(b.containsPoint(a,d))return!0;a=this._tlx;d=this._tly;const c=this._trx,f=this._try,l=this._brx,g=this._bry,k=this._blx,m=this._bly;return e.segmentIntersectsQuad(a,d,c,f,b)||e.segmentIntersectsQuad(c,f,l,g,b)||e.segmentIntersectsQuad(l,g,k,m,b)||e.segmentIntersectsQuad(k,m,a,d,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 d=this._getAtIndex(b);this._setAtIndex(b,this._getAtIndex(a));this._setAtIndex(a,d)}_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 e=self.C3,b=[0,0,1,0,1,1,0,1],a=e.New(e.Quad);e.CollisionPoly=class extends e.DefendedBase{constructor(d,c=!0){super();d||(d=b);this._ptsArr=Float64Array.from(d);this._bbox=new e.Rect;this._isBboxChanged=!0;this._enabled=c}Release(){}pointsArr(){return this._ptsArr}pointCount(){return this._ptsArr.length/2}setPoints(d){this._ptsArr.length===d.length?this._ptsArr.set(d):this._ptsArr=Float64Array.from(d);this._isBboxChanged=!0}setDefaultPoints(){this.setPoints(b)}copy(d){this.setPoints(d._ptsArr)}setBboxChanged(){this._isBboxChanged= !0}_updateBbox(){if(this._isBboxChanged){var d=this._ptsArr,c=d[0],f=d[1],l=c,g=f;for(let k=0,m=d.length;k<m;k+=2){const u=d[k],x=d[k+1];u<c&&(c=u);u>l&&(l=u);x<f&&(f=x);x>g&&(g=x)}this._bbox.set(c,f,l,g);this._isBboxChanged=!1}}setFromRect(d,c,f){let l=this._ptsArr;8!==l.length&&(this._ptsArr=l=new Float64Array(8));l[0]=d.getLeft()-c;l[1]=d.getTop()-f;l[2]=d.getRight()-c;l[3]=d.getTop()-f;l[4]=d.getRight()-c;l[5]=d.getBottom()-f;l[6]=d.getLeft()-c;l[7]=d.getBottom()-f;this._bbox.copy(d);0===c&&0=== f||this._bbox.offset(-c,-f);this._isBboxChanged=!1}setFromQuad(d,c,f){a.copy(d);a.offset(c,f);this.setPoints(a.toArray());this._isBboxChanged=!0}transform(d,c,f){let l=0,g=1;0!==f&&(l=Math.sin(f),g=Math.cos(f));this.transformPrecalc(d,c,l,g)}transformPrecalc(d,c,f,l){const g=this._ptsArr;for(let k=0,m=g.length;k<m;k+=2){const u=k+1,x=g[k]*d,n=g[u]*c;g[k]=x*l-n*f;g[u]=n*l+x*f}this._isBboxChanged=!0}offset(d,c){const f=this._ptsArr;for(let l=0,g=f.length;l<g;l+=2)f[l]+=d,f[l+1]+=c}containsPoint(d,c){const f= this._ptsArr;if(d===f[0]&&c===f[1])return!0;this._updateBbox();var l=this._bbox;const g=l.getLeft()-110,k=l.getTop()-101,m=l.getRight()+131;l=l.getBottom()+120;let u,x,n,q,t,r,w,y;g<d?(u=g,n=d):(u=d,n=g);k<c?(x=k,q=c):(x=c,q=k);m<d?(t=m,w=d):(t=d,w=m);l<c?(r=l,y=c):(r=c,y=l);let C=0,D=0;for(let K=0,B=f.length;K<B;K+=2){var G=(K+2)%B;const A=f[K],F=f[K+1],J=f[G];G=f[G+1];e.segmentsIntersectPreCalc(g,k,d,c,u,n,x,q,A,F,J,G)&&++C;e.segmentsIntersectPreCalc(m,l,d,c,t,w,r,y,A,F,J,G)&&++D}return 1===C%2|| 1===D%2}intersectsPoly(d,c,f){const l=d._ptsArr,g=this._ptsArr;if(this.containsPoint(l[0]+c,l[1]+f)||d.containsPoint(g[0]-c,g[1]-f))return!0;for(let m=0,u=g.length;m<u;m+=2){var k=(m+2)%u;d=g[m];const x=g[m+1],n=g[k];k=g[k+1];let q,t,r,w;d<n?(q=d,r=n):(q=n,r=d);x<k?(t=x,w=k):(t=k,w=x);for(let y=0,C=l.length;y<C;y+=2){const D=(y+2)%C;if(e.segmentsIntersectPreCalc(d,x,n,k,q,r,t,w,l[y]+c,l[y+1]+f,l[D]+c,l[D+1]+f))return!0}}return!1}intersectsSegment(d,c,f,l,g,k){if(this.containsPoint(f-d,l-c)||this.containsPoint(g- d,k-c))return!0;let m,u,x,n;f<g?(m=f,x=g):(m=g,x=f);l<k?(u=l,n=k):(u=k,n=l);const q=this._ptsArr;for(let t=0,r=q.length;t<r;t+=2){const w=(t+2)%r;if(e.segmentsIntersectPreCalc(f,l,g,k,m,x,u,n,q[t]+d,q[t+1]+c,q[w]+d,q[w+1]+c))return!0}return!1}mirror(d){const c=this._ptsArr;for(let f=0,l=c.length;f<l;f+=2)c[f]=2*d-c[f];this._isBboxChanged=!0}flip(d){const c=this._ptsArr;for(let f=0,l=c.length;f<l;f+=2){const g=f+1;c[g]=2*d-c[g]}this._isBboxChanged=!0}diag(){const d=this._ptsArr;for(let c=0,f=d.length;c< f;c+=2){const l=c+1,g=d[c];d[c]=d[l];d[l]=g}this._isBboxChanged=!0}GetMidX(){const d=this._ptsArr;let c=0;for(let f=0,l=d.length;f<l;f+=2)c+=d[f];return c/this.pointCount()}GetMidY(){const d=this._ptsArr;let c=0;for(let f=0,l=d.length;f<l;f+=2)c+=d[f+1];return c/this.pointCount()}GetPointsArray(){return this._ptsArr}GetPointCount(){return this.pointCount()}IsEnabled(){return this._enabled}}} {"use strict";const e=self.C3;e.PairMap=class extends e.DefendedBase{constructor(b){super();this._firstMap=new Map;if(b)for(const [a,d,c]of b)this.Set(a,d,c)}Release(){this.Clear();this._firstMap=null}Clear(){const b=this._firstMap;for(const a of b.values())a.clear();b.clear()}Set(b,a,d){const c=this._firstMap;let f=c.get(b);f||(f=new Map,c.set(b,f));f.set(a,d)}Get(b,a){return(b=this._firstMap.get(b))?b.get(a):b}Has(b,a){return(b=this._firstMap.get(b))?b.has(a):!1}Delete(b,a){const d=this._firstMap, c=d.get(b);if(!c)return!1;(a=c.delete(a))&&0===c.size&&d.delete(b);return a}DeleteEither(b){const a=this._firstMap,d=a.get(b);d&&(d.clear(),a.delete(b));for(const [c,f]of a.entries())f.delete(b)&&0===f.size&&a.delete(c)}GetSize(){let b=0;for(const a of this._firstMap.values())b+=a.size;return b}*values(){for(const b of this._firstMap.values())yield*b.values()}*keyPairs(){for(const [b,a]of this._firstMap.entries())for(const d of a.keys())yield[b,d]}*entries(){for(const [b,a]of this._firstMap.entries())for(const [d, c]of a.entries())yield[b,d,c]}}} {"use strict";const e=self.C3;e.ArraySet=class extends e.DefendedBase{constructor(){super();this._set=new Set;this._arr=[];this._needToRebuildArray=!1}Release(){this.Clear()}Clear(){this._set.clear();e.clearArray(this._arr);this._needToRebuildArray=!1}Add(b){this._set.has(b)||(this._set.add(b),this._needToRebuildArray||this._arr.push(b))}Has(b){return this._set.has(b)}Delete(b){this._set.delete(b)&&(this._needToRebuildArray=!0)}GetSize(){return this._set.size}IsEmpty(){return 0===this._set.size}GetArray(){this._needToRebuildArray&& (this._RebuildArray(),this._needToRebuildArray=!1);return this._arr}_RebuildArray(){const b=this._arr;e.clearArray(b);for(const a of this._set)b.push(a)}}} {"use strict";const e=new Map,b=new Map,a=new Map,d=new Map,c=new Map,f=new Map;f.set("linear","noease");f.set("default","noease");self.Ease=class n{constructor(){}static InheritEase(){return"default"}static DefaultEase(){return"noease"}static GetEditorEaseNames(q,...t){this._CreateEaseMap();a.has(q)||a.set(q,new Map);q=[...a.get(q).keys()];q.sort();return[...b.keys()].concat(q).filter(r=>!t.includes(r))}static GetRuntimeEaseNames(){this._CreateEaseMap();const q=[...d.keys()];q.sort();return[...b.keys()].concat(q)}static IsNamePredefined(q){this._CreateEaseMap(); return[...b.keys()].includes(q)}static _GetEase(q){const t=f.get(q);if(t)return e.get(t);if(n.IsNamePredefined(q))return e.get(q);if(c.has(q))return c.get(q)}static GetEditorEase(q,t){this._CreateEaseMap();const r=n._GetEase(q);return r?r:a.get(t).get(q)}static GetRuntimeEase(q){this._CreateEaseMap();const t=n._GetEase(q);return t?t:d.get(q)}static GetEaseFromIndex(q){this._CreateEaseMap();return this.GetRuntimeEaseNames()[q]}static GetIndexForEase(q,t){this._CreateEaseMap();return this.GetEditorEaseNames(t).indexOf(q)}static _CreateEaseMap(){0=== e.size&&(this._AddPredifinedEase("default",()=>{}),this._AddPredifinedEase("noease",this.NoEase),this._AddPredifinedEase("easeinsine",this.EaseInSine),this._AddPredifinedEase("easeoutsine",this.EaseOutSine),this._AddPredifinedEase("easeinoutsine",this.EaseInOutSine),this._AddPredifinedEase("easeinelastic",this.EaseInElastic),this._AddPredifinedEase("easeoutelastic",this.EaseOutElastic),this._AddPredifinedEase("easeinoutelastic",this.EaseInOutElastic),this._AddPredifinedEase("easeinback",this.EaseInBack), this._AddPredifinedEase("easeoutback",this.EaseOutBack),this._AddPredifinedEase("easeinoutback",this.EaseInOutBack),this._AddPredifinedEase("easeinbounce",this.EaseInBounce),this._AddPredifinedEase("easeoutbounce",this.EaseOutBounce),this._AddPredifinedEase("easeinoutbounce",this.EaseInOutBounce),this._AddPredifinedEase("easeincubic",this.EaseInCubic),this._AddPredifinedEase("easeoutcubic",this.EaseOutCubic),this._AddPredifinedEase("easeinoutcubic",this.EaseInOutCubic),this._AddPredifinedEase("easeinquad", this.EaseInQuad),this._AddPredifinedEase("easeoutquad",this.EaseOutQuad),this._AddPredifinedEase("easeinoutquad",this.EaseInOutQuad),this._AddPredifinedEase("easeinquart",this.EaseInQuart),this._AddPredifinedEase("easeoutquart",this.EaseOutQuart),this._AddPredifinedEase("easeinoutquart",this.EaseInOutQuart),this._AddPredifinedEase("easeinquint",this.EaseInQuint),this._AddPredifinedEase("easeoutquint",this.EaseOutQuint),this._AddPredifinedEase("easeinoutquint",this.EaseInOutQuint),this._AddPredifinedEase("easeincirc", this.EaseInCirc),this._AddPredifinedEase("easeoutcirc",this.EaseOutCirc),this._AddPredifinedEase("easeinoutcirc",this.EaseInOutCirc),this._AddPredifinedEase("easeinexpo",this.EaseInExpo),this._AddPredifinedEase("easeoutexpo",this.EaseOutExpo),this._AddPredifinedEase("easeinoutexpo",this.EaseInOutExpo),this._AddPrivateCustomEase("cubicbezier",this.EaseCubicBezier),this._AddPrivateCustomEase("spline",this.EaseSpline))}static _AddPredifinedEase(q,t){n._AddEase(q,t,"predefined")}static _AddPrivateCustomEase(q, t){n._AddEase(q,t,"private")}static AddCustomEase(q,t,r){this._CreateEaseMap();n._AddEase(q,t,"custom",r)}static RemoveCustomEase(q,t){this.IsNamePredefined(q)||[...c.keys()].includes(q)||(t=a.get(t))&&t.delete(q)}static _AddEase(q,t,r,w){switch(r){case "predefined":e.set(q,t);b.set(q,t);break;case "custom":w?(a.has(w)||a.set(w,new Map),a.get(w).set(q,t)):d.set(q,t);break;case "private":e.set(q,t);c.set(q,t);break;default:throw Error("unexpected ease mode");}}static NoEase(q,t,r,w){return r*q/w+t}static EaseInQuad(q, t,r,w){return r*(q/=w)*q+t}static EaseOutQuad(q,t,r,w){return-r*(q/=w)*(q-2)+t}static EaseInOutQuad(q,t,r,w){return 1>(q/=w/2)?r/2*q*q+t:-r/2*(--q*(q-2)-1)+t}static EaseInCubic(q,t,r,w){return r*(q/=w)*q*q+t}static EaseOutCubic(q,t,r,w){return r*((q=q/w-1)*q*q+1)+t}static EaseInOutCubic(q,t,r,w){return 1>(q/=w/2)?r/2*q*q*q+t:r/2*((q-=2)*q*q+2)+t}static EaseInQuart(q,t,r,w){return r*(q/=w)*q*q*q+t}static EaseOutQuart(q,t,r,w){return-r*((q=q/w-1)*q*q*q-1)+t}static EaseInOutQuart(q,t,r,w){return 1>(q/= w/2)?r/2*q*q*q*q+t:-r/2*((q-=2)*q*q*q-2)+t}static EaseInQuint(q,t,r,w){return r*(q/=w)*q*q*q*q+t}static EaseOutQuint(q,t,r,w){return r*((q=q/w-1)*q*q*q*q+1)+t}static EaseInOutQuint(q,t,r,w){return 1>(q/=w/2)?r/2*q*q*q*q*q+t:r/2*((q-=2)*q*q*q*q+2)+t}static EaseInSine(q,t,r,w){return-r*Math.cos(q/w*(Math.PI/2))+r+t}static EaseOutSine(q,t,r,w){return r*Math.sin(q/w*(Math.PI/2))+t}static EaseInOutSine(q,t,r,w){return-r/2*(Math.cos(Math.PI*q/w)-1)+t}static EaseInExpo(q,t,r,w){return 0===q?t:r*Math.pow(2, 10*(q/w-1))+t}static EaseOutExpo(q,t,r,w){return q===w?t+r:r*(-Math.pow(2,-10*q/w)+1)+t}static EaseInOutExpo(q,t,r,w){return 0===q?t:q===w?t+r:1>(q/=w/2)?r/2*Math.pow(2,10*(q-1))+t:r/2*(-Math.pow(2,-10*--q)+2)+t}static EaseInCirc(q,t,r,w){return-r*(Math.sqrt(1-(q/=w)*q)-1)+t}static EaseOutCirc(q,t,r,w){return r*Math.sqrt(1-(q=q/w-1)*q)+t}static EaseInOutCirc(q,t,r,w){return 1>(q/=w/2)?-r/2*(Math.sqrt(1-q*q)-1)+t:r/2*(Math.sqrt(1-(q-=2)*q)+1)+t}static EaseInElastic(q,t,r,w){let y=0,C=r;if(0===q)return t; if(1===(q/=w))return t+r;y||(y=.3*w);C<Math.abs(r)?(C=r,r=y/4):r=y/(2*Math.PI)*Math.asin(r/C);return-(C*Math.pow(2,10*--q)*Math.sin(2*(q*w-r)*Math.PI/y))+t}static EaseOutElastic(q,t,r,w){let y,C=0,D=r;if(0===q)return t;if(1===(q/=w))return t+r;C||(C=.3*w);D<Math.abs(r)?(D=r,y=C/4):y=C/(2*Math.PI)*Math.asin(r/D);return D*Math.pow(2,-10*q)*Math.sin(2*(q*w-y)*Math.PI/C)+r+t}static EaseInOutElastic(q,t,r,w){let y,C=0,D=r;if(0===q)return t;if(2===(q/=w/2))return t+r;C||(C=.3*w*1.5);D<Math.abs(r)?(D=r, y=C/4):y=C/(2*Math.PI)*Math.asin(r/D);return 1>q?-.5*D*Math.pow(2,10*--q)*Math.sin(2*(q*w-y)*Math.PI/C)+t:D*Math.pow(2,-10*--q)*Math.sin(2*(q*w-y)*Math.PI/C)*.5+r+t}static EaseInBack(q,t,r,w,y){void 0===y&&(y=1.70158);return r*(q/=w)*q*((y+1)*q-y)+t}static EaseOutBack(q,t,r,w,y){void 0===y&&(y=1.70158);return r*((q=q/w-1)*q*((y+1)*q+y)+1)+t}static EaseInOutBack(q,t,r,w,y){void 0===y&&(y=1.70158);return 1>(q/=w/2)?r/2*q*q*(((y*=1.525)+1)*q-y)+t:r/2*((q-=2)*q*(((y*=1.525)+1)*q+y)+2)+t}static EaseInBounce(q, t,r,w){return r-n.EaseOutBounce(w-q,0,r,w)+t}static EaseOutBounce(q,t,r,w){return(q/=w)<1/2.75?7.5625*r*q*q+t:q<2/2.75?r*(7.5625*(q-=1.5/2.75)*q+.75)+t:q<2.5/2.75?r*(7.5625*(q-=2.25/2.75)*q+.9375)+t:r*(7.5625*(q-=2.625/2.75)*q+.984375)+t}static EaseInOutBounce(q,t,r,w){return q<w/2?.5*n.EaseInBounce(2*q,0,r,w)+t:.5*n.EaseOutBounce(2*q-w,0,r,w)+.5*r+t}static EaseCubicBezier(q,t,r,w,y){return t+3*q*(r-t)+3*q**2*(t+w-2*r)+q**3*(y-t+3*r-3*w)}static EaseSpline(q,t,r,w,y,C,D,G,K,B){if(w===y&&C===D)return q; q=x(q,t,w,C,G,B);t=l(r,y,D,K);w=g(r,y,D,K);r=k(r,y,D,K);return m(q,t,w,r)}static GetBezierSamples(q,t,r,w){const y=[],C=l(q,t,r,w),D=g(q,t,r,w);q=k(q,t,r,w);for(t=0;11>t;++t)r=m(.1*t,C,D,q),y.push(r);return y}};const l=(n,q,t,r)=>r-3*t+3*q-n,g=(n,q,t,r)=>3*t-6*q+3*n,k=(n,q,t,r)=>3*(q-n),m=(n,q,t,r)=>((q*n+t)*n+r)*n,u=(n,q,t,r)=>3*q*n*n+2*t*n+r,x=(n,q,t,r,w,y)=>{if(1==n)return 1;for(var C=0,D=1,G=y[D];10!=D&&G<=n;)D++,G=y[D],C+=.1;D--;G=y[D];y=C+(n-G)/(y[D+1]-G)*.1;D=l(q,t,r,w);G=g(q,t,r,w);q=k(q, t,r,w);t=u(y,D,G,q);if(0!==t)if(.02<=t)for(C=0;4>C;++C)t=m(y,D,G,q)-n,r=u(y,D,G,q),y-=t/r;else{t=C;C+=.1;r=0;let K;do y=t+(C-t)/2,w=m(y,D,G,q)-n,0<w?C=y:t=y,w=1E-7<Math.abs(w),K=10>++r;while(w&&K)}return y}} {"use strict";const e=self.C3;function b(a){e.IsString(a)}e.ProbabilityTable=class{constructor(){this._items=[];this._totalWeight=0}Release(){this.Clear();this._items=null}Clear(){e.clear2DArray(this._items);this._totalWeight=0}GetTotalWeight(){return this._totalWeight}Sample(a=Math.random()*this.GetTotalWeight()){let d=0;for(const [c,f]of this._items)if(d+=c,a<d)return f;return 0}AddItem(a,d){b(d);this._totalWeight+=a;this._items.push([a,d])}RemoveItem(a,d){b(d);const c=0===a;for(let f=0;f<this._items.length;f++){const l= this._items[f],g=l[1]===d;if((c||l[0]===a)&&g){this._items.splice(f,1);this._totalWeight-=l[0];break}}}asJSON(){return JSON.stringify(this._items)}static fromJSON(a){const d=new e.ProbabilityTable;a=JSON.parse(a);for(const c of a)d.AddItem(c[0],c[1]);return d}}}"use strict"; self.C3.Event=class{constructor(e,b){this.type=e;this.cancelable=!!b;this.isAsync=this.propagationStopped=this.defaultPrevented=!1}preventDefault(){if(!this.cancelable)throw Error(`event '${this.type}' is not cancelable`);this.defaultPrevented=!0}stopPropagation(){if(!this.cancelable)throw Error(`event '${this.type}' cannot be stopped`);if(this.isAsync)throw Error(`cannot stop async event '${this.type}' propagation`);this.propagationStopped=!0}}; {"use strict";const e=self.C3;e.Event.Handler=class extends e.DefendedBase{constructor(b){super();this._type=b;this._captureListeners=[];this._captureListenersSet=new Set;this._listeners=[];this._listenersSet=new Set;this._fireDepth=0;this._queueModifyListeners=[]}Release(){0<this._fireDepth||(e.clearArray(this._captureListeners),this._captureListenersSet.clear(),e.clearArray(this._listeners),this._listenersSet.clear(),e.clearArray(this._queueModifyListeners),e.Release(this))}_AddListener(b,a){this._IsFiring()? this._queueModifyListeners.push({op:"add",func:b,capture:a}):a?this._captureListenersSet.has(b)||(this._captureListeners.push(b),this._captureListenersSet.add(b)):this._listenersSet.has(b)||(this._listeners.push(b),this._listenersSet.add(b))}_RemoveListener(b,a){this._IsFiring()?this._queueModifyListeners.push({op:"remove",func:b,capture:a}):a?this._captureListenersSet.has(b)&&(this._captureListenersSet.delete(b),e.arrayFindRemove(this._captureListeners,b)):this._listenersSet.has(b)&&(this._listenersSet.delete(b), e.arrayFindRemove(this._listeners,b))}_IsEmpty(){return!this._captureListeners.length&&!this._listeners.length}_IsFiring(){return 0<this._fireDepth}_ProcessQueuedListeners(){const b=new Set,a=new Set;for(const d of this._queueModifyListeners)if("add"===d.op)this._AddListener(d.func,d.capture),d.capture?a.delete(d.func):b.delete(d.func);else if("remove"===d.op)d.capture?(this._captureListenersSet.delete(d.func),a.add(d.func)):(this._listenersSet.delete(d.func),b.add(d.func));else throw Error("invalid op"); e.arrayRemoveAllInSet(this._listeners,b);e.arrayRemoveAllInSet(this._captureListeners,a);e.clearArray(this._queueModifyListeners)}_FireCancellable(b){this._IncreaseFireDepth();let a=!1;for(let d=0,c=this._captureListeners.length;d<c;++d)if(this._captureListeners[d](b),b.propagationStopped){a=!0;break}if(!a)for(let d=0,c=this._listeners.length;d<c&&(this._listeners[d](b),!b.propagationStopped);++d);this._DecreaseFireDepth();return!b.defaultPrevented}_FireNonCancellable(b){this._IncreaseFireDepth(); for(let a=0,d=this._captureListeners.length;a<d;++a)this._captureListeners[a](b);for(let a=0,d=this._listeners.length;a<d;++a)this._listeners[a](b);this._DecreaseFireDepth();return!0}_IncreaseFireDepth(){this._fireDepth++}_DecreaseFireDepth(){this._fireDepth--;0===this._fireDepth&&0<this._queueModifyListeners.length&&this._ProcessQueuedListeners()}SetDelayRemoveEventsEnabled(b){b?this._IncreaseFireDepth():this._DecreaseFireDepth()}_FireAsync(b){let a=[];for(let d=0,c=this._captureListeners.length;d< c;++d){let f=this._captureListeners[d];a.push(e.Asyncify(()=>f(b)))}for(let d=0,c=this._listeners.length;d<c;++d){let f=this._listeners[d];a.push(e.Asyncify(()=>f(b)))}return Promise.all(a).then(()=>!b.defaultPrevented)}_FireAndWait_AsyncOptional(b){const a=[];this._IncreaseFireDepth();for(let c=0,f=this._captureListeners.length;c<f;++c){var d=this._captureListeners[c](b);d instanceof Promise&&a.push(d)}for(let c=0,f=this._listeners.length;c<f;++c)d=this._listeners[c](b),d instanceof Promise&&a.push(d); this._DecreaseFireDepth();return a.length?Promise.all(a).then(()=>!b.defaultPrevented):!b.defaultPrevented}async _FireAndWaitAsync(b){return await this._FireAndWait_AsyncOptional(b)}async _FireAndWaitAsyncSequential(b){this._IncreaseFireDepth();for(let d=0,c=this._captureListeners.length;d<c;++d){var a=this._captureListeners[d](b);a instanceof Promise&&await a}for(let d=0,c=this._listeners.length;d<c;++d)a=this._listeners[d](b),a instanceof Promise&&await a;this._DecreaseFireDepth();return!b.defaultPrevented}*_FireAsGenerator(b){this._IncreaseFireDepth(); for(let d=0,c=this._captureListeners.length;d<c;++d){var a=this._captureListeners[d](b);e.IsIterator(a)&&(yield*a)}for(let d=0,c=this._listeners.length;d<c;++d)a=this._listeners[d](b),e.IsIterator(a)&&(yield*a);this._DecreaseFireDepth()}}} {"use strict";const e=self.C3;e.Event.Dispatcher=class extends e.DefendedBase{constructor(){super();this._eventHandlers=new Map;this._dispatcherWasReleased=!1}Release(){if(this._dispatcherWasReleased)throw Error("already released");this.ClearEvents();this._dispatcherWasReleased=!0;e.Release(this)}WasReleased(){return this._dispatcherWasReleased}ClearEvents(){for(let b of this._eventHandlers.values())b.Release();this._eventHandlers.clear()}_GetHandlerByType(b,a){let d=this._eventHandlers.get(b);return d? d:a?(d=e.New(e.Event.Handler,b),this._eventHandlers.set(b,d),d):null}HasAnyHandlerFor(b){return this._eventHandlers.has(b)}addEventListener(b,a,d){this._GetHandlerByType(b,!0)._AddListener(a,!!d)}removeEventListener(b,a,d){let c=this._GetHandlerByType(b,!1);c&&(c._RemoveListener(a,!!d),c._IsEmpty()&&this._eventHandlers.delete(b))}dispatchEvent(b){const a=this._GetHandlerByType(b.type,!1);return a?b.cancelable?a._FireCancellable(b):a._FireNonCancellable(b):!0}dispatchEventAsync(b){const a=this._GetHandlerByType(b.type, !1);if(!a)return Promise.resolve(!0);b.isAsync=!0;return a._FireAsync(b)}async dispatchEventAndClearAsync(b){const a=this._GetHandlerByType(b.type,!1);if(!a)return!0;this._eventHandlers.delete(b.type);b.isAsync=!0;b=await a._FireAsync(b);a.Release();return b}async dispatchEventAndWaitAsync(b){const a=this._GetHandlerByType(b.type,!1);return a?await a._FireAndWaitAsync(b):!0}dispatchEventAndWait_AsyncOptional(b){const a=this._GetHandlerByType(b.type,!1);return a?a._FireAndWait_AsyncOptional(b):!0}async dispatchEventAndWaitAsyncSequential(b){const a= this._GetHandlerByType(b.type,!1);return a?await a._FireAndWaitAsyncSequential(b):!0}dispatchGeneratorEvent(b){const a=this._GetHandlerByType(b.type,!1);if(!a)return null;if(b.cancelable)throw Error("not supported");return a._FireAsGenerator(b)}SetDelayRemoveEventsEnabled(b){for(const a of this._eventHandlers.values())a.SetDelayRemoveEventsEnabled(b)}}} {"use strict";const e=self.C3,b="undefined"!==typeof requestIdleCallback;let a=[],d=-1,c=0;function f(m){d=b&&0===c?requestIdleCallback(l,{timeout:35}):setTimeout(l,0<c?1:m)}function l(m){d=-1;if(a.length){var u=performance.now(),x=0;do{g(a.shift());var n=performance.now();++x;var q=(n-u)/x*1.1}while(a.length&&(b&&0===c&&"undefined"!==typeof m?q<m.timeRemaining():12>n-u+q));-1===d&&a.length&&f(Math.max(16-(n-u),4))}}function g(m){let u;try{u=m.func()}catch(x){m.reject(x);return}m.resolve(u)}let k= e.QueryString.Has("disable-asyncify");k&&console.warn("[Asyncify] Asyncify has been disabled due to disable-asyncify in the query string. Some work will now be done synchronously.");e.Asyncify=function(m){let u=null;e.isDebug&&(u=e.GetCallStack());return new Promise((x,n)=>{a.push({func:m,resolve:x,reject:n,stack:u});k?g(a.pop()):-1===d&&f(16)})};e.Asyncify.SetHighThroughputMode=function(m){if(m)++c;else if(--c,0>c)throw Error("already turned off high throughput mode");}} {"use strict";const e=self.C3;let b=-1;function a(){b=-1}e.FastGetDateNow=function(){-1===b&&(b=Date.now(),self.setTimeout(a,16));return b};let d=-1,c=-1,f=new Set;function l(){c=d=-1;let g=Date.now();for(let k of f)if(k._CheckTimeout(g)){let m=k._GetDeadline();if(-1===c||m<c)c=m}else f.delete(k);-1!==c&&(d=self.setTimeout(l,Math.max(c-g+100,1E3)))}e.IdleTimeout=class{constructor(g,k){this._callback=g;this._timeout=1E3*k;this._deadline=0;this._isActive=!1}Reset(){let g=e.FastGetDateNow();this._deadline= g+this._timeout;this._isActive||(f.add(this),this._isActive=!0);-1===d?(c=this._deadline,d=self.setTimeout(l,this._timeout+100)):this._deadline<c&&c>g+1E3&&(self.clearTimeout(d),c=this._deadline,d=self.setTimeout(l,this._timeout+100))}_CheckTimeout(g){return g>=this._deadline?this._callback()?(this._deadline=g+this._timeout,!0):this._isActive=!1:!0}_GetDeadline(){return this._deadline}Cancel(){this._isActive&&(f.delete(this),this._isActive=!1,0===f.size&&-1!==d&&(self.clearTimeout(d),c=d=-1))}Release(){this.Cancel(); this._callback=null}}} {"use strict";const e=self.C3;e.Disposable=class 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,d,c,f,l){if("undefined"===typeof f||null===f)f=!1;else if("boolean"!==typeof f&&"object"!==typeof f)throw new TypeError("invalid event listener options");l&& (c=c.bind(l));if(d.includes(" ")){d=d.split(" ");l=new e.CompositeDisposable;for(let g of d)a.addEventListener(g,c,f),l.Add(e.New(e.Disposable,()=>a.removeEventListener(g,c,f)));return l}a.addEventListener(d,c,f);return e.New(e.Disposable,()=>a.removeEventListener(d,c,f))}};e.StubDisposable=class extends e.Disposable{SetAction(b){this._disposeAction=b}};e.CompositeDisposable=class extends e.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 e=self.C3;e.KahanSum=class extends e.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 e=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,d){return a<d?-1:d<a?1:0};b.RedBlackSet.prototype.clone=function(){var a=new b.RedBlackSet(this.compare);a.insertAll(this); return a};b.RedBlackSet.prototype.clear=function(){this.size=0;this.sentinel=new b.RBnode(this);this.sentinel.color=!1;this.root=this.sentinel;this.root.parent=this.sentinel};b.RedBlackSet.prototype.leftRotate=function(a){var d=a.right;a.right=d.left;d.left!=this.sentinel&&(d.left.parent=a);d.parent=a.parent;a.parent==this.sentinel?this.root=d:a==a.parent.left?a.parent.left=d:a.parent.right=d;d.left=a;a.parent=d};b.RedBlackSet.prototype.rightRotate=function(a){var d=a.left;a.left=d.right;d.right!= this.sentinel&&(d.right.parent=a);d.parent=a.parent;a.parent==this.sentinel?this.root=d:a==a.parent.right?a.parent.right=d:a.parent.left=d;d.right=a;a.parent=d};b.RedBlackSet.prototype.insert=function(a){if(this.contains(a))this.get_(a).key=a;else{var d=new b.RBnode(this);d.key=a;a=this.sentinel;for(var c=this.root;c!=this.sentinel;)a=c,c=0>this.compare(d.key,c.key)?c.left:c.right;d.parent=a;a==this.sentinel?this.root=d:0>this.compare(d.key,a.key)?a.left=d:a.right=d;d.left=this.sentinel;d.right=this.sentinel; d.color=!0;this.insertFixup(d);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 d=a.parent.parent.right;1==d.color?(a.parent.color=!1,d.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 d=a.parent.parent.left,1==d.color?(a.parent.color= !1,d.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 d=a.left==this.sentinel||a.right==this.sentinel?a:this.successor_(a);var c=d.left!=this.sentinel?d.left:d.right;c.parent=d.parent;d.parent==this.sentinel?this.root=c:d==d.parent.left?d.parent.left=c:d.parent.right= c;d!=a&&(a.key=d.key);0==d.color&&this.deleteFixup(c);this.size--};b.RedBlackSet.prototype.deleteFixup=function(a){for(;a!=this.root&&0==a.color;)if(a==a.parent.left){var d=a.parent.right;1==d.color&&(d.color=!1,a.parent.color=!0,this.leftRotate(a.parent),d=a.parent.right);0==d.left.color&&0==d.right.color?(d.color=!0,a=a.parent):(0==d.right.color&&(d.left.color=!1,d.color=!0,this.rightRotate(d),d=a.parent.right),d.color=a.parent.color,a.parent.color=!1,d.right.color=!1,this.leftRotate(a.parent), a=this.root)}else d=a.parent.left,1==d.color&&(d.color=!1,a.parent.color=!0,this.rightRotate(a.parent),d=a.parent.left),0==d.right.color&&0==d.left.color?(d.color=!0,a=a.parent):(0==d.left.color&&(d.right.color=!1,d.color=!0,this.leftRotate(d),d=a.parent.left),d.color=a.parent.color,a.parent.color=!1,d.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 d=a.key;this.delete_(a);return d}return null};b.RedBlackSet.prototype.removeSwapped= function(a,d){this.remove(d)};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 d=a.parent;d!=this.sentinel&&a==d.right;)a=d,d=d.parent;return d};b.RedBlackSet.prototype.predeccessor_=function(a){if(a.left!=this.sentinel)return this.max(a.left);for(var d=a.parent;d!=this.sentinel&& a==d.left;)a=d,d=d.parent;return d};b.RedBlackSet.prototype.successor=function(a){if(0<this.size){a=this.get_(a);if(a==this.sentinel)return null;if(a.right!=this.sentinel)return this.min(a.right).key;for(var d=a.parent;d!=this.sentinel&&a==d.right;)a=d,d=d.parent;return d!=this.sentinel?d.key:null}return null};b.RedBlackSet.prototype.predecessor=function(a){if(0<this.size){a=this.get_(a);if(a==this.sentinel)return null;if(a.left!=this.sentinel)return this.max(a.left).key;for(var d=a.parent;d!=this.sentinel&& a==d.left;)a=d,d=d.parent;return d!=this.sentinel?d.key:null}return null};b.RedBlackSet.prototype.getMin=function(){return this.min(this.root).key};b.RedBlackSet.prototype.getMax=function(){return this.max(this.root).key};b.RedBlackSet.prototype.get_=function(a){for(var d=this.root;d!=this.sentinel&&0!=this.compare(d.key,a);)d=0>this.compare(a,d.key)?d.left:d.right;return d};b.RedBlackSet.prototype.contains=function(a){return null!=this.get_(a).key};b.RedBlackSet.prototype.getValues=function(){var a= [];this.forEach(function(d){a.push(d)});return a};b.RedBlackSet.prototype.insertAll=function(a){if("array"==b.typeOf(a))for(var d=0;d<a.length;d++)this.insert(a[d]);else if("function"==b.typeOf(a.forEach))a.forEach(this.insert,this);else if("function"==b.typeOf(a.getValues))for(a=a.getValues(),d=0;d<a.length;d++)this.insert(a[d]);else if("object"==b.typeOf(a))for(d in a)this.insert(a[d])};b.RedBlackSet.prototype.removeAll=function(a){if("array"==b.typeOf(a))for(var d=0;d<a.length;d++)this.remove(a[d]); else if("function"==b.typeOf(a.forEach))a.forEach(this.removeSwapped,this);else if("function"==b.typeOf(a.getValues))for(a=a.getValues(),d=0;d<a.length;d++)this.remove(a[d]);else if("object"==b.typeOf(a))for(d in a)this.remove(a[d])};b.RedBlackSet.prototype.containsAll=function(a){if("array"==b.typeOf(a)){for(var d=0;d<a.length;d++)if(!this.contains(a[d]))return!1;return!0}if("function"==b.typeOf(a.forEach))return a.every(this.contains,this);if("function"==b.typeOf(a.getValues)){a=a.getValues();for(d= 0;d<a.length;d++)if(!this.contains(a[d]))return!1;return!0}if("object"==b.typeOf(a)){for(d in a)if(!this.contains(a[d]))return!1;return!0}};b.RedBlackSet.prototype.range=function(a,d){var c=[];this.traverseFromTo(function(f){c.push(f)},a,d);return c};b.RedBlackSet.prototype.traverse=function(a,d){if(!this.isEmpty())for(var c=this.min(this.root);c!=this.sentinel&&!a.call(d,c.key,this);)c=this.successor_(c)};b.RedBlackSet.prototype.traverseFrom=function(a,d,c){if(!this.isEmpty())for(d=this.get_(d);d!= this.sentinel&&!a.call(c,d.key,this);)d=this.successor_(d)};b.RedBlackSet.prototype.traverseTo=function(a,d,c){if(!this.isEmpty()){var f=this.min(this.root);for(d=this.get_(d);f!=d&&!a.call(c,f.key,this);)f=this.successor_(f)}};b.RedBlackSet.prototype.traverseFromTo=function(a,d,c,f){if(!this.isEmpty())for(d=this.get_(d),c=this.get_(c);d!=c&&!a.call(f,d.key,this);)d=this.successor_(d)};b.RedBlackSet.prototype.traverseBackwards=function(a,d){if(!this.isEmpty())for(var c=this.max(this.root);c!=this.sentinel&& !a.call(d,c.key,this);)c=this.predeccessor_(c)};b.RedBlackSet.prototype.forEach=function(a,d){if(!this.isEmpty())for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))a.call(d,c.key,c.key,this)};b.RedBlackSet.prototype.some=function(a,d){if(this.isEmpty())return!1;for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))if(a.call(d,c.key,c.key,this))return!0;return!1};b.RedBlackSet.prototype.every=function(a,d){if(this.isEmpty())return!1;for(var c=this.min(this.root);c!=this.sentinel;c= this.successor_(c))if(!a.call(d,c.key,c.key,this))return!1;return!0};b.RedBlackSet.prototype.map=function(a,d){var c=[];if(this.isEmpty())return c;for(var f=this.min(this.root);f!=this.sentinel;f=this.successor_(f))c.push(a.call(d,f.key,f.key,this));return c};b.RedBlackSet.prototype.filter=function(a,d){var c=[];if(this.isEmpty())return c;for(var f=this.min(this.root);f!=this.sentinel;f=this.successor_(f))a.call(d,f.key,f.key,this)&&c.push(f.key);return c};b.RedBlackSet.prototype.getCount=function(){return this.size}; b.RedBlackSet.prototype.isEmpty=function(){return 0==this.size};b.RedBlackSet.prototype.isSubsetOf=function(a){var d=b.getCount(a);if(this.getCount()>d)return!1;d=0;if(this.isEmpty())return!0;for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))b.contains.call(a,a,c.key)&&d++;return d==this.getCount()};b.RedBlackSet.prototype.intersection=function(a){var d=new b.RedBlackSet(this.compare);if(this.isEmpty())return d;for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))a.contains.call(a, c.key,c.key,this)&&d.insert(c.key);return d};e.RedBlackSet=class extends e.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 d of this._queueRemove)this._rbSet.remove(d);this._queueRemove.clear();for(const d of this._queueInsert)this._rbSet.insert(d);this._queueInsert.clear()}}ForEach(a){this._rbSet.forEach(a)}*values(){if(!this.IsEmpty()){var a= this._rbSet;for(let d=a.min(a.root);d!=a.sentinel;d=a.successor_(d))yield d.key}}[Symbol.iterator](){return this.values()}}} {"use strict";const e=self.C3;e.PromiseThrottle=class{constructor(b=e.hardwareConcurrency){this._maxParallel=b;this._queue=[];this._activeCount=0}Add(b){return new Promise((a,d)=>{this._queue.push({func:b,resolve:a,reject:d});this._MaybeStartNext()})}_FindInQueue(b){for(let a=0,d=this._queue.length;a<d;++a)if(this._queue[a].func===b)return a;return-1}RemoveAndResolve(b,a){b=this._FindInQueue(b);if(-1===b)throw Error("cannot find promise to resolve");this._queue[b].resolve(a);this._queue.splice(b, 1)}RemoveAndReject(b,a){b=this._FindInQueue(b);if(-1===b)throw Error("cannot find promise to reject");this._queue[b].reject(a);this._queue.splice(b,1)}async _MaybeStartNext(){if(this._queue.length&&!(this._activeCount>=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 d=[];let c=!1;const f=async g=>{for(;(g=a.pop())&&!c;)try{d.push(await g())}catch(k){throw c= !0,k;}},l=[];for(;b--;)l.push(f());await Promise.all(l);return d}}} {"use strict";const e=self.C3;e.RateLimiter=class{constructor(b,a,d){this._callback=b;this._interval=a;this._intervalOnBattery=d||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 e.Battery&&e.Battery.IsOnBatteryPower()?this._intervalOnBattery:this._interval}Call(...b){if(-1===this._timerId){this._callbackArguments= b;b=e.FastGetDateNow();var a=b-this._lastCallTime,d=this._GetInterval();a>=d&&this._canRunImmediate?(this._lastCallTime=b,this._RunCallback()):this._timerId=self.setTimeout(this._timerCallFunc,Math.max(d-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=e.FastGetDateNow())}_OnTimer(){this._timerId= -1;this._lastCallTime=e.FastGetDateNow();this._RunCallback()}_CancelTimer(){-1!==this._timerId&&(self.clearTimeout(this._timerId),this._timerId=-1)}Release(){this._CancelTimer();this._timerCallFunc=this._callbackArguments=this._callback=null}}} {"use strict";const e=self.C3;e.SVGRasterManager=class{constructor(){this._images=new Map;this._allowNpotSurfaces=!1;this._redrawCallback=this._releaseResultCallback=this._rasterAtSizeCallback=this._getBaseSizeCallback=null}SetNpotSurfaceAllowed(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,d,c,f,l){if(!this._rasterAtSizeCallback)throw Error("no raster at size callback set");return this._rasterAtSizeCallback(b,a,d,c,f,l)}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=e.New(e.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 e=self.C3;e.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(d=>{this._baseWidth=d[0];this._baseHeight=d[1];this._manager.Redraw()}).catch(d=>{console.error("[SVG] Error loading SVG: ",d);this._hadError=!0;this._manager.Redraw()});this._rasterImageHeight=this._rasterImageWidth=this._rasterSurfaceHeight=this._rasterSurfaceWidth=0;this._isRasterizing= !1;this._rasterizedResult=null;this._hadError=this._forceRaster=!1}Release(){if(0>=this._refCount)throw Error("already released");this._refCount--;0===this._refCount&&this._Release()}ReleaseRasterizedResult(){this._rasterizedResult&&(this._manager.ReleaseResult(this._rasterizedResult),this._rasterizedResult=null)}_Release(){this.ReleaseRasterizedResult();this._manager._RemoveImage(this);this._manager=null}GetDataSource(){return this._dataSource}IncReference(){this._refCount++}HasReferences(){return 0< this._refCount}GetRasterizedResult(){return this._rasterizedResult}ForceRasterAgain(){this._forceRaster=!0}async StartRasterForSize(b,a,d){if(0!==a&&0!==d&&!this._hadError&&!this._isRasterizing){var c=e.nextHighestPowerOfTwo(Math.ceil(a)),f=e.nextHighestPowerOfTwo(Math.ceil(d)),l=Math.max(c,f);2048<l&&(l=2048/l,a*=l,d*=l,c=Math.min(Math.ceil(c*l),2048),f=Math.min(Math.ceil(f*l),2048));a<c&&d<f&&(d=a/d,c/f>d?(a=f*d,d=f):(a=c,d=c/d));this._manager.IsNpotSurfaceAllowed()&&(c=Math.ceil(a),f=Math.ceil(d)); c<=this._rasterSurfaceWidth&&f<=this._rasterSurfaceHeight&&!this._forceRaster||(this._isRasterizing=!0,this._rasterSurfaceWidth=c,this._rasterSurfaceHeight=f,b=await this._manager.RasterAtSize(this._dataSource,b,this._rasterSurfaceWidth,this._rasterSurfaceHeight,a,d),this._manager&&(this.ReleaseRasterizedResult(),this._rasterizedResult=b,this._rasterImageWidth=a,this._rasterImageHeight=d,this._forceRaster=this._isRasterizing=!1,this._manager.Redraw()))}}WhenBaseSizeReady(){return this._getBaseSizePromise}GetBaseWidth(){return this._baseWidth}GetBaseHeight(){return this._baseHeight}GetRasterWidth(){return this._rasterImageWidth}GetRasterHeight(){return this._rasterImageHeight}HadError(){return this._hadError}}} {"use strict";const e=self.C3;e.UTF8_BOM="\ufeff";const b=new Set([..."0123456789"]);e.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"]);e.IsWhitespaceChar=function(m){return a.has(m)};e.FilterWhitespace=function(m){return[...m].filter(u=>!e.IsWhitespaceChar(u)).join("")};e.IsStringAllWhitespace=function(m){for(const u of m)if(!e.IsWhitespaceChar(u))return!1;return!0}; e.IsUnprintableChar=function(m){return 1===m.length&&32>m.charCodeAt(0)};e.FilterUnprintableChars=function(m){return[...m].filter(u=>!e.IsUnprintableChar(u)).join("")};const d=new Set([..."0123456789.+-e"]);e.IsStringNumber=function(m){m=m.trim();if(!m.length)return!1;let u=m.charAt(0);if("-"!==u&&!b.has(u))return!1;for(let x of m)if(!d.has(x))return!1;return!0};e.RemoveTrailingDigits=function(m){let u=m.length;for(;0<u;){let x=m.charAt(u-1);if(!e.IsNumericChar(x))break;--u}return m.substr(0,u)}; e.IncrementNumberAtEndOf=function(m){let u=e.RemoveTrailingDigits(m);m=(m=m.substr(u.length))?(parseInt(m,10)+1).toString():"2";return u+m};const c=new Map([["&","&"],["<","<"],[">",">"],['"',"""],["'","'"]]);function f(m){return c.get(m)}const l=/[&<>"']/g;e.EscapeHTML=function(m){return m.replace(l,f)};e.EscapeJS=function(m){m=e.ReplaceAll(m,"\\","\\\\");m=e.ReplaceAll(m,'"','\\"');m=e.ReplaceAll(m,"\t","\\t");m=e.ReplaceAll(m,"\r","");return e.ReplaceAll(m,"\n","\\n")};e.EscapeXML= function(m){m=e.ReplaceAll(m,"&","&");m=e.ReplaceAll(m,"<","<");m=e.ReplaceAll(m,">",">");return e.ReplaceAll(m,'"',""")};const g=/[-[\]{}()*+?.,\\^$|#\s]/g;e.EscapeRegex=function(m){return m.replace(g,"\\$&")};e.FindAll=function(m,u,x=!1){if(!u)return[];x||(m=m.toLowerCase(),u=u.toLowerCase());x=u.length;var n=0;let q=[];for(;-1<(n=m.indexOf(u,n));)q.push(n),n+=x;return q};e.ReplaceAll=function(m,u,x){return m.replaceAll(u,()=>x)};e.ReplaceAllCaseInsensitive=function(m,u,x){return m.replace(new RegExp(e.EscapeRegex(u), "gi"),()=>x)};e.SetElementContent=function(m,u){"string"===typeof u?m.textContent=u:u.isPlainText()?m.textContent=u.toString():(m.innerHTML=u.toHTML(),u instanceof e.BBString&&u.attachLinkHandlers(m))};e.StringLikeEquals=function(m,u){return m instanceof e.HtmlString||m instanceof e.BBString?m.equals(u):u instanceof e.HtmlString||u instanceof e.BBString?u.equals(m):m===u};e.StringSubstitute=function(m,...u){let x=m;for(let n=0,q=u.length;n<q;++n){const t=`{${n}}`;if(!m.includes(t))throw Error(`missing placeholder '${t}' in string substitution`); x=x.replace(t,u[n].toString())}return x};e.StringSubstituteAllowMissing=function(m,...u){let x=m,n=-1,q=-1;for(let t=0,r=u.length;t<r;++t){const w=`{${t}}`;m.includes(w)?(q=t,x=x.replace(w,u[t].toString())):-1===n&&(n=t)}if(0<=n&&0<=q&&n<q)throw Error(`missing placeholder '${n}' in string substitution`);return x};e.StringSubstituteMap=function(m,u){for(let [x,n]of Object.entries(u))m=m.replaceAll(x,n.toString());return m};e.SortAZCaseInsensitive=function(m,u){m=m.toLowerCase();u=u.toLowerCase();return m> u?1:m<u?-1:0};e.FormatDataSize=function(m,u){u="common."+(u?"dataRates":"dataSizes")+".";const x=self.langSub;if(1024>m)return x(u+"bytes",m);if(1048576>m)return m/=1024,m=10>m?Math.round(10*m)/10:Math.round(m),x(u+"kilobytes",m);if(1073741824>m)return m/=1048576,m=10>m?Math.round(10*m)/10:Math.round(m),x(u+"megabytes",m);if(1099511627776>m)return m/=1073741824,m=10>m?Math.round(10*m)/10:Math.round(m),x(u+"gigabytes",m);m/=1099511627776;m=10>m?Math.round(10*m)/10:Math.round(m);return x(u+"terabytes", m)};const k={approximate:!1,days:!0,hours:!0,minutes:!0,seconds:!0};e.FormatTime=function(m,u){u=Object.assign({},k,u);e.Lang.PushContext("common.time");const x=[],n=self.lang,q=self.langPluralSub;if(u.days){var t=Math.floor(m/86400);0<t&&(m-=86400*t,x.push(q(".days",null,t)))}u.hours&&(t=Math.floor(m/3600),0<t||x.length)&&(m-=3600*t,x.push(q(".hours",null,t)));u.minutes&&(t=Math.floor(m/60),0<t||x.length||!u.seconds)&&(m-=60*t,x.push(q(".minutes",null,t)));u.seconds&&x.push(q(".seconds",null,Math.floor(m% 60)));m=(u.approximate?n(".approx-prefix"):"")+x.join(n(".separator"));e.Lang.PopContext();return m};e.ZeroPad=function(m,u){let x=0>m?"-":"";m=Math.abs(m);m=m.toString();u-=m.length;for(let n=0;n<u;++n)x+="0";return x+m};e.StringToTitleCase=function(m){return m.toLowerCase().replace(/\b\w/g,u=>u.toUpperCase())};e.CompareVersionStrings=function(m,u){m=m.split(".").map(x=>x.trim());u=u.split(".").map(x=>x.trim());e.resizeArray(m,4,"0");e.resizeArray(u,4,"0");m=m.map(x=>parseInt(x,10));u=u.map(x=>parseInt(x, 10));for(let x=0;4>x;++x){const n=m[x]-u[x];if(0!==n)return 0>n?-1:1}return 0};e.CreateGUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,m=>{const u=Math.floor(16*Math.random());return("x"===m?u:u&3|8).toString(16)})};e.StringHammingDistance=function(m,u){if(m.length!==u.length)throw Error("strings must be same length");let x=0;for(let n=0,q=m.length;n<q;++n)m.charAt(n)!==u.charAt(n)&&++x;return x};e.StringLevenshteinDistance=function(m,u){if(0===m.length)return u.length; if(0===u.length)return m.length;let x,n,q,t;if(m.length>u.length){var r=m;m=u;u=r}t=Array(m.length+1);for(r=0;r<=m.length;r++)t[r]=r;for(r=1;r<=u.length;r++){n=r;for(x=1;x<=m.length;x++)q=u[r-1]===m[x-1]?t[x-1]:Math.min(t[x-1]+1,Math.min(n+1,t[x]+1)),t[x-1]=n,n=q;t[m.length]=n}return t[m.length]}} {"use strict";const e=self.C3,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, d=/\[(\/?)([^\[]*?)\]/g;let c=null,f=0;function l(k,m,u){var x=b.get(u);if(x){if("string"===typeof x){if("a"!==x||m)return"<"+m+x+">";m=parseInt(u.substring(1),10)-1;if(0>m||m>=c.length)throw Error("invalid bbcode link substitution");x=c[m];if("string"===typeof x)return`<a href="${c[m]}">`;if("function"===typeof x)return`<a class="bblink${m}">`;throw new TypeError("invalid bbcode link action");}if(Array.isArray(x))return k=x[0],x=x[1],m?"</"+k+">":`<${k} class="${x}">`}else return"class"===u?m?"</span>": `<span class="bbclass${f++}">`:k}const g=/\n/g;e.BBString=class{constructor(k,m){this._bbstr=m&&m.noEscape?k:e.EscapeHTML(k);this._htmlstr="";this._convertLineBreaks=!1;this._linkActions=[];if(m&&(this._convertLineBreaks=!!m.convertLineBreaks,m.links)){if(9<m.links.length)throw Error("too many links");this._linkActions=m.links}this._hasAnyBBtags=this._bbstr.includes("[");this._needsLineBreakConversion=this._convertLineBreaks&&this._bbstr.includes("\n");this._isPlain=!this._hasAnyBBtags&&!this._needsLineBreakConversion&& !this._bbstr.includes("&");this._hasParsedFragments=!1;this._fragments=[]}toString(){return this._bbstr}valueOf(){return this._bbstr}isPlainText(){return this._isPlain}toPlainText(){return this._hasAnyBBtags?this._bbstr.replace(a,""):this._bbstr}toHTML(){if(this._isPlain)return this._bbstr;if(!this._htmlstr&&this._bbstr){let k=this._bbstr;this._hasAnyBBtags&&(f=0,c=this._linkActions,k=k.replace(a,l),c=null);this._needsLineBreakConversion&&(k=k.replace(g,"<br>"));this._htmlstr=k}return this._htmlstr}attachLinkHandlers(k){if(this._linkActions.length)for(let m= 0,u=this._linkActions.length;m<u;++m){const x=this._linkActions[m];if("function"!==typeof x)continue;const n=k.querySelector(".bblink"+m);if(!n)throw Error("unable to attach BBString link handler");n.onclick=x}}equals(k){return k instanceof e.HtmlString?this.toHTML()===k.toHTML():k instanceof e.BBString?this._bbstr===k._bbstr:this._bbstr===k}toFragmentList(){if(this._hasParsedFragments)return this._fragments;const k=this._bbstr,m=[];let u=d.lastIndex=0;for(var x;null!==(x=d.exec(k));){var n=x.index; if(0<n&&"\\"===k.charAt(n-1))continue;var q=x[0],t=x[1];x=x[2];const r=k.substring(u,n);u=n+q.length;r&&this._fragments.push({text:r,styles:m.slice(0)});if(x)if(t)for(x=x.toLowerCase(),n=m.length-1;0<=n;--n){if(m[n].tag===x){m.splice(n,1);break}}else n=x,q=null,t=x.indexOf("="),-1!==t?(n=x.substring(0,t).toLowerCase(),q=x.substring(t+1)):n=n.toLowerCase(),m.push({tag:n,param:q})}u<k.length&&this._fragments.push({text:k.substring(u),styles:m.slice(0)});for(const r of this._fragments)r.text=this._ProcessBBCodeEscapeSequences(r.text); this._hasParsedFragments=!0;return this._fragments}_ProcessBBCodeEscapeSequences(k){k=e.ReplaceAll(k,"\\[","[");return e.ReplaceAll(k,"\\\\","\\")}static StripTags(k){return e.New(e.BBString,k,{noEscape:!0}).toPlainText()}static StripAnyTags(k){return k.replace(d,"")}}} {"use strict";const e=self.C3;e.WordWrap=class{constructor(){this._lines=[]}GetLines(){return this._lines}GetLineCount(){return this._lines.length}_MeasureLine(b,a){let d=0,c=0,f=0,l=0,g=0;for(const k of b)-1===k.width&&(b=a(k.text,k.styles),k.width=b.width,k.height=b.height,k.fontBoundingBoxAscent=b.fontBoundingBoxAscent||0,k.fontBoundingBoxDescent=b.fontBoundingBoxDescent||0,k.topToAlphabeticDistance=b.topToAlphabeticDistance||0),d+=k.width,c=Math.max(c,k.height),f=Math.max(f,k.fontBoundingBoxAscent), l=Math.max(l,k.fontBoundingBoxDescent),g=Math.max(g,k.topToAlphabeticDistance);return{width:d,height:c,fontBoundingBoxAscent:f,fontBoundingBoxDescent:l,topToAlphabeticDistance:g}}_AddLine(b,a,d,c,f,l){this._lines.push({fragments:b,width:a,height:d,fontBoundingBoxAscent:c,fontBoundingBoxDescent:f,topToAlphabeticDistance:l})}WordWrap(b,a,d,c,f){"string"===typeof b&&(b=[{text:b,styles:[]}]);e.clearArray(this._lines);if(!(!b.length||1===b.length&&!b[0].text.length||2>d)){if(1===b.length){var l=b[0];const g= l.text;l=l.styles;if(100>=g.length&&!g.includes("\n")){let {width:k,height:m,fontBoundingBoxAscent:u,fontBoundingBoxDescent:x,topToAlphabeticDistance:n}=a(g,l);k+=f;u=u||0;x=x||0;n=n||0;if(k<=d){this._AddLine([{text:g,styles:l,width:k,height:m,fontBoundingBoxAscent:u,fontBoundingBoxDescent:x,topToAlphabeticDistance:n}],k,m,u,x,n);return}}}if("word"===c)c=this._TokeniseWords(b);else{c=[];for(const g of b)e.appendArray(c,[...g.text].map(k=>[{text:k,styles:g.styles}]))}this._WrapText(c,a,d,f)}}_TokeniseWords(b){const a= [];let d=[],c=!1;for(const l of b){var f=l.text;b=l.styles;for(const g of f)"\n"===g?(0<d.length&&a.push(d),a.push([{text:"\n",styles:b}]),d=[]):0===d.length?(d.push({text:g,styles:b}),c=e.IsWhitespaceChar(g)):(f=e.IsWhitespaceChar(g),f===c?(f=d.at(-1),f.styles===b?f.text+=g:d.push({text:g,styles:b})):(a.push(d),d=[],d.push({text:g,styles:b}),c=f))}0<d.length&&a.push(d);return a}_CopyLine(b){return b.map(a=>({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 d=b.length?b.at(-1):null;let c=0;d&&a[0].styles===d.styles&&(d.text+=a[0].text,d.width=-1,d.height=-1,d.fontBoundingBoxAscent=-1,d.fontBoundingBoxDescent=-1,d.topToAlphabeticDistance=-1,c=1);for(d=a.length;c<d;++c){const f=a[c];b.push({text:f.text,styles:f.styles,width:-1,height:-1,fontBoundingBoxAscent:-1,fontBoundingBoxDescent:-1,topToAlphabeticDistance:-1})}}_WrapText(b, a,d,c){let f=[],l=0,g=0,k=0,m=0;var u=0;for(const x of b){if(1===x.length&&"\n"===x[0].text){0===g&&(u=a(" ",x[0].styles),g=u.height,k=u.fontBoundingBoxAscent||0,m=u.fontBoundingBoxDescent||0,u=u.topToAlphabeticDistance||0);this._AddLine(f,l,g,k,m,u);f=[];u=m=k=g=l=0;continue}b=this._CopyLine(f);this._AddWordToLine(b,x);const n=this._MeasureLine(b,a),q=n.width;q>=d?(0<f.length&&this._AddLine(f,l,g,k,m,u),f=[],e.IsStringAllWhitespace(x[0].text)?u=m=k=g=l=0:(this._AddWordToLine(f,x),u=this._MeasureLine(f, a),l=u.width,g=u.height,k=u.fontBoundingBoxAscent,m=u.fontBoundingBoxDescent,u=u.topToAlphabeticDistance)):(f=b,l=q,g=n.height,k=n.fontBoundingBoxAscent,m=n.fontBoundingBoxDescent,u=n.topToAlphabeticDistance)}0<f.length&&this._AddLine(f,l,g,k,m,u);this._TrimLinesTrailingWhitespace(a,c)}_TrimLinesTrailingWhitespace(b,a){for(const c of this._lines){const f=c.fragments;if(!f.length)continue;let l=f.at(-1);var d=l.text;const g=d.trimEnd();if(!g)c.width-=l.width,f.pop();else if(g.length<d.length){d=b(g, l.styles).width;const k=l.width-d;l.width=d;l.text=g;c.width-=k}0!==a&&0<f.length&&(l=f.at(-1),l.width+=a,c.width+=a)}}Clear(){e.clearArray(this._lines)}GetMaxLineWidth(){return this._lines.reduce((b,a)=>Math.max(b,a.width),0)}GetTotalLineHeight(){return this._lines.reduce((b,a)=>b+a.height,0)}}} {"use strict";const e=self.C3,b=self.glMatrix,a=b.vec3,d=b.vec4,c=b.mat4,f=a.create(),l=a.create(),g=a.create(),k=d.create(),m=c.create(),u=a.create(),x=a.create(),n=a.create(),q=a.create(),t=a.create(),r=a.create(),w=a.create(),y=a.create(),C=d.fromValues(0,0,1,1);e.Gfx={Project(B,A,F,J,L,Q,T){const V=J[0]*B+J[4]*A+J[8]*F+J[12],aa=J[1]*B+J[5]*A+J[9]*F+J[13],ha=J[2]*B+J[6]*A+J[10]*F+J[14];J=J[3]*B+J[7]*A+J[11]*F+J[15];B=L[0]*V+L[4]*aa+L[8]*ha+L[12]*J;A=L[1]*V+L[5]*aa+L[9]*ha+L[13]*J;F=L[2]*V+L[6]* aa+L[10]*ha+L[14]*J;L=L[3]*V+L[7]*aa+L[11]*ha+L[15]*J;if(0===L)return!1;L=1/L;T[0]=(B*L*.5+.5)*Q[2]+Q[0];T[1]=(A*L*.5+.5)*Q[3]+Q[1];T[2]=.5*(1+F*L);return!0},Unproject(B,A,F,J,L,Q,T){c.multiply(m,L,J);if(null===c.invert(m,m))return!1;k[0]=(B-Q[0])/Q[2]*2-1;k[1]=(A-Q[1])/Q[3]*2-1;k[2]=2*F-1;k[3]=1;d.transformMat4(k,k,m);if(0===k[3])return!1;k[3]=1/k[3];T[0]=k[0]*k[3];T[1]=k[1]*k[3];T[2]=k[2]*k[3];return!0},UnprojectScreenToWorldZ(B,A,F,J,L,Q,T){if(!e.Gfx.Unproject(B,A,0,J,L,Q,f)||!e.Gfx.Unproject(B, A,1,J,L,Q,l))return!1;a.subtract(l,l,f);a.set(g,0,0,1);B=-F;A=a.dot(g,l);F=0;if(0===A){if(0!==a.dot(g,f)+B)return!1}else if(F=-(a.dot(f,g)+B)/A,0>F)return!1;a.scaleAndAdd(T,f,l,F);return!0}};function D(B,A,F,J){a.subtract(f,F,A);a.subtract(l,B,A);a.cross(g,f,l);a.normalize(g,g);J.set(g[0],g[1],g[2],a.dot(B,g))}function G(B,A,F,J,L,Q,T){const V=T.x,aa=T.y,ha=T.z,ja=T.w,oa=T.xF,ya=T.yF;T=T.zF;const Ba=1-oa,La=1-ya,Da=1-T;return V*B*oa+V*J*Ba+aa*A*ya+aa*L*La+ha*F*T+ha*Q*Da>=ja?!0:V*J*oa+V*B*Ba+aa*L* ya+aa*A*La+ha*Q*T+ha*F*Da>ja}class K{constructor(){this.zF=this.yF=this.xF=this.w=this.z=this.y=this.x=NaN}set(B,A,F,J){this.x=B;this.y=A;this.z=F;this.w=J;this.xF=0<B?1:0;this.yF=0<A?1:0;this.zF=0<F?1:0}}e.Gfx.ViewFrustum=class{constructor(){this._leftP=new K;this._topP=new K;this._rightP=new K;this._bottomP=new K;this._nearP=new K;this._farP=new K}CalculatePlanes(B,A){e.Gfx.Unproject(0,1,0,B,A,C,u);e.Gfx.Unproject(1,1,0,B,A,C,x);e.Gfx.Unproject(0,0,0,B,A,C,n);e.Gfx.Unproject(1,0,0,B,A,C,q);e.Gfx.Unproject(0, 1,1,B,A,C,t);e.Gfx.Unproject(1,1,1,B,A,C,r);e.Gfx.Unproject(0,0,1,B,A,C,w);e.Gfx.Unproject(1,0,1,B,A,C,y);D(n,u,t,this._leftP);D(u,x,r,this._topP);D(x,q,y,this._rightP);D(q,n,w,this._bottomP);D(w,t,r,this._farP);D(q,x,u,this._nearP)}ContainsAABB(B,A,F,J,L,Q){return G(B,A,F,J,L,Q,this._leftP)&&G(B,A,F,J,L,Q,this._topP)&&G(B,A,F,J,L,Q,this._rightP)&&G(B,A,F,J,L,Q,this._bottomP)&&G(B,A,F,J,L,Q,this._nearP)&&G(B,A,F,J,L,Q,this._farP)}}} {"use strict";const e=self.C3,b=self.glMatrix,a=b.vec3,d=b.vec4,c=b.mat4,f=c.create(),l=a.fromValues(0,0,0),g=a.fromValues(0,0,0),k=a.fromValues(0,0,0),m=a.fromValues(0,1,0);d.fromValues(0,0,0,0);const u=new e.Quad,x=new e.Rect,n=new e.Quad(0,0,1,0,1,1,0,1);e.Gfx.RendererBase=class{constructor(){this._height=this._width=0;this._fovY=e.toRadians(45);this._tan_fovY_2=Math.tan(this._fovY/2);this._matP=c.create();this._matMV=c.create();this._allShaderPrograms=[];this._shaderProgramsByName=new Map;this._spSmoothLineFill= this._spSmoothEllipseOutline=this._spSmoothEllipseFill=this._spHardEllipseOutline=this._spHardEllipseFill=this._spLinearGradientFill=this._spColorFill=this._spTilemapFill=this._spPoints=this._spTextureFill=null;this._stateGroups=new Map;this._currentStateGroup=null;this._blendModeTable=[];this._namedBlendModeMap=new Map;this._currentZ=this._baseZ=0;this._lineWidth=1;this._lineWidthStack=[this._lineWidth];this._lineCap=1;this._lineCapStack=[this._lineCap];this._lineOffset=.5;this._lineOffsetStack= [this._lineOffset];this._frameNumber=0;this._enableMipmaps=!0;this._hasMajorPerformanceCaveat=!1}FillIndexBufferData(q){let t=0,r=q.length,w=0;for(;t<r;)q[t++]=w,q[t++]=w+1,q[t++]=w+2,q[t++]=w,q[t++]=w+2,q[t++]=w+3,w+=4}_ClearState(){this._currentZ=this._baseZ=0;this._spSmoothLineFill=this._spSmoothEllipseOutline=this._spSmoothEllipseFill=this._spHardEllipseOutline=this._spHardEllipseFill=this._spLinearGradientFill=this._spColorFill=this._spTilemapFill=this._spPoints=this._spTextureFill=null;this._ClearAllShaderPrograms()}InitState(){this._ClearState(); this._currentStateGroup=null}OnDeviceOrContextLost(){for(const q of this._allShaderPrograms)q.Release();this._ClearState()}GetWidth(){return this._width}GetHeight(){return this._height}GetDefaultCameraZ(){return 100}GetNearZ(){return 1}GetFarZ(){return 1E4}GetFovY(){return this._fovY}_GetTanFovYDiv2(){return this._tan_fovY_2}CalculatePerspectiveMatrix(q,t,r=.5,w=.5){const y=this.GetNearZ(),C=this.GetFarZ();r=1-r;const D=2*r-2;r*=2;const G=2*w-2;w*=2;const K=this._GetTanFovYDiv2()*y;t*=K;c.frustum(q, D*t,r*t,G*K,w*K,y,C)}CalculateOrthographicMatrix(q,t,r,w=1){const y=self.devicePixelRatio,C=2*this.GetDefaultCameraZ()*y*this._GetTanFovYDiv2()/r;t=t*C/(2*y*w);r=r*C/(2*y*w);c.ortho(q,-t,t,-r,r,this.GetNearZ(),this.GetFarZ())}CalculateLookAtModelView(q,t,r,w,y=this.GetScissoredViewportHeight()){y=2*this.GetDefaultCameraZ()*self.devicePixelRatio*this._GetTanFovYDiv2()/y;a.set(k,y,-y,1);a.multiply(l,t,k);a.multiply(g,r,k);c.lookAt(q,l,g,w||m);c.scale(q,q,k)}CalculateLookAtModelView2(q,t,r,w,y,C,D){a.set(l, q,t,r);a.set(g,w,y,C);this.CalculateLookAtModelView(f,l,g,m,D);return f}_AddShaderProgram(q){this._allShaderPrograms.push(q);this._shaderProgramsByName.set(q.GetName(),q)}_RemoveShaderProgram(q){const t=this._allShaderPrograms.indexOf(q);-1!==t&&this._allShaderPrograms.splice(t,1);this._shaderProgramsByName.delete(q.GetName())}_ClearAllShaderPrograms(){e.clearArray(this._allShaderPrograms);this._shaderProgramsByName.clear()}GetShaderProgramByName(q){return this._shaderProgramsByName.get(q)||null}GetTextureFillShaderProgram(){return this._spTextureFill}SetTextureFillMode(){this.SetProgram(this._spTextureFill)}GetPointsRenderingProgram(){return this._spPoints}SetPointsRenderingProgram(){this.SetProgram(this._spPoints)}SetTilemapFillMode(){this.SetProgram(this._spTilemapFill)}SetColorFillMode(){this.SetProgram(this._spColorFill)}SetLinearGradientFillMode(){this.SetProgram(this._spLinearGradientFill)}SetHardEllipseFillMode(){this.SetProgram(this._spHardEllipseFill)}SetHardEllipseOutlineMode(){this.SetProgram(this._spHardEllipseOutline)}SetSmoothEllipseFillMode(){this.SetProgram(this._spSmoothEllipseFill)}SetSmoothEllipseOutlineMode(){this.SetProgram(this._spSmoothEllipseOutline)}SetSmoothLineFillMode(){this.SetProgram(this._spSmoothLineFill)}_SetCurrentStateGroup(q){this._currentStateGroup= q}GetCurrentStateGroup(){return this._currentStateGroup}AcquireStateGroup(q,t,r,w){const y=e.Gfx.StateGroup.MakeKey(q,t,r,w);let C=this._stateGroups.get(y);C||(C=e.New(e.Gfx.StateGroup,this,q,t,r,w),this._stateGroups.set(y,C));C.AddRef();return C}ReleaseStateGroup(q){q.DecRef();0===q._GetRefCount()&&(this._currentStateGroup===q&&(this._currentStateGroup=null),this._stateGroups.delete(q.GetKey()),q.Release())}_InitBlendModeData(q){e.clearArray(this._blendModeTable);this._namedBlendModeMap.clear(); for(const t of q){q=t[0];const r=t[1],w=t[2];this._blendModeTable.push([r,w]);this._namedBlendModeMap.set(q,{srcBlend:r,destBlend:w})}}_GetBlendByIndex(q){return this._blendModeTable[q]}GetSrcBlendByIndex(q){return this._GetBlendByIndex(q)[0]}GetDestBlendByIndex(q){return this._GetBlendByIndex(q)[1]}GetNamedBlend(q){q=this._namedBlendModeMap.get(q);if("undefined"===typeof q)throw Error("invalid blend name");return q}SetBaseZ(q){this._baseZ=q}GetBaseZ(){return this._baseZ}SetCurrentZ(q){this._currentZ= q;this._currentStateGroup=null}GetCurrentZ(){return this._currentZ}Line(q,t,r,w){var y=e.angleTo(q,t,r,w),C=.5*this._lineWidth;const D=Math.sin(y)*C;y=Math.cos(y)*C;C=this._lineCap;2===C?this.LinePreCalc_LineCap2(q,t,0,r,w,0,D,y):1===C?this.LinePreCalc_LineCap1(q,t,0,r,w,0,D,y):this.LinePreCalc_LineCap0(q,t,0,r,w,0,D,y)}Line3D(q,t,r,w,y,C){var D=e.angleTo(q,t,w,y),G=.5*this._lineWidth;const K=Math.sin(D)*G;D=Math.cos(D)*G;G=this._lineCap;2===G?this.LinePreCalc_LineCap2(q,t,r,w,y,C,K,D):1===G?this.LinePreCalc_LineCap1(q, t,r,w,y,C,K,D):this.LinePreCalc_LineCap0(q,t,r,w,y,C,K,D)}LinePreCalc_LineCap2(q,t,r,w,y,C,D,G){var K=this._lineOffset;q=q+K-G;t=t+K-D;w=w+K+G;y=y+K+D;K=2*G;const B=2*D;this.Quad3D2(q+D,t-G,r,w+D,y-G,C,w-D-K,y+G-B,C,q-D+K,t+G+B,r,n)}LinePreCalc_LineCap1(q,t,r,w,y,C,D,G){const K=this._lineOffset;q=q+K-G;t=t+K-D;w=w+K+G;y=y+K+D;this.Quad3D2(q+D,t-G,r,w+D,y-G,C,w-D,y+G,C,q-D,t+G,r,n)}LinePreCalc_LineCap0(q,t,r,w,y,C,D,G){const K=this._lineOffset;q+=K;t+=K;w+=K;y+=K;this.Quad3D2(q+D,t-G,r,w+D,y-G,C,w- D,y+G,C,q-D,t+G,r,n)}TexturedLine(q,t,r,w,y,C){var D=e.angleTo(q,t,r,w),G=.5*this._lineWidth;const K=Math.sin(D)*G;D=Math.cos(D)*G;G=this._lineCap;2===G?this.TexturedLinePreCalc_LineCap2(q,t,r,w,K,D,y,C):1===G?this.TexturedLinePreCalc_LineCap1(q,t,r,w,K,D,y,C):this.TexturedLinePreCalc_LineCap0(q,t,r,w,K,D,y,C)}TexturedLinePreCalc_LineCap2(q,t,r,w,y,C,D,G){var K=this._lineOffset;q=q+K-C;t=t+K-y;r=r+K+C;w=w+K+y;K=2*C;const B=2*y;u.set(q+y,t-C,r+y,w-C,r-y-K,w+C-B,q-y+K,t+C+B);x.set(D,0,G,0);this.Quad3(u, x)}TexturedLinePreCalc_LineCap1(q,t,r,w,y,C,D,G){const K=this._lineOffset;q=q+K-C;t=t+K-y;r=r+K+C;w=w+K+y;u.set(q+y,t-C,r+y,w-C,r-y,w+C,q-y,t+C);x.set(D,0,G,0);this.Quad3(u,x)}TexturedLinePreCalc_LineCap0(q,t,r,w,y,C,D,G){const K=this._lineOffset;q+=K;t+=K;r+=K;w+=K;u.set(q+y,t-C,r+y,w-C,r-y,w+C,q-y,t+C);x.set(D,0,G,0);this.Quad3(u,x)}LineRect(q,t,r,w){const y=.5*this._lineWidth,C=this._lineCap;2===C?this._LineRectPreCalc_LineCap2(q,t,r,w,y):1===C?this._LineRectPreCalc_LineCap1(q,t,r,w,y):this._LineRectPreCalc_LineCap0(q, t,r,w,y)}_LineRectPreCalc_LineCap2(q,t,r,w,y){this.LinePreCalc_LineCap2(q,t,0,r,t,0,0,y);this.LinePreCalc_LineCap2(r,t,0,r,w,0,y,0);this.LinePreCalc_LineCap2(r,w,0,q,w,0,0,-y);this.LinePreCalc_LineCap2(q,w,0,q,t,0,-y,0)}_LineRectPreCalc_LineCap1(q,t,r,w,y){this.LinePreCalc_LineCap1(q,t,0,r,t,0,0,y);this.LinePreCalc_LineCap1(r,t,0,r,w,0,y,0);this.LinePreCalc_LineCap1(r,w,0,q,w,0,0,-y);this.LinePreCalc_LineCap1(q,w,0,q,t,0,-y,0)}_LineRectPreCalc_LineCap0(q,t,r,w,y){this.LinePreCalc_LineCap0(q,t,0,r, t,0,0,y);this.LinePreCalc_LineCap0(r,t,0,r,w,0,y,0);this.LinePreCalc_LineCap0(r,w,0,q,w,0,0,-y);this.LinePreCalc_LineCap0(q,w,0,q,t,0,-y,0)}LineRect2(q){this.LineRect(q.getLeft(),q.getTop(),q.getRight(),q.getBottom())}LineQuad(q){var t=e.angleTo(q.getTlx(),q.getTly(),q.getTrx(),q.getTry()),r=.5*this._lineWidth;const w=Math.sin(t)*r;t=Math.cos(t)*r;r=this._lineCap;2===r?this._LineQuadPreCalc_LineCap2(q,w,t):1===r?this._LineQuadPreCalc_LineCap1(q,w,t):this._LineQuadPreCalc_LineCap0(q,w,t)}_LineQuadPreCalc_LineCap2(q, t,r){this.LinePreCalc_LineCap2(q.getTlx(),q.getTly(),0,q.getTrx(),q.getTry(),0,t,r);this.LinePreCalc_LineCap2(q.getTrx(),q.getTry(),0,q.getBrx(),q.getBry(),0,r,-t);this.LinePreCalc_LineCap2(q.getBrx(),q.getBry(),0,q.getBlx(),q.getBly(),0,-t,-r);this.LinePreCalc_LineCap2(q.getBlx(),q.getBly(),0,q.getTlx(),q.getTly(),0,-r,t)}_LineQuadPreCalc_LineCap1(q,t,r){this.LinePreCalc_LineCap1(q.getTlx(),q.getTly(),0,q.getTrx(),q.getTry(),0,t,r);this.LinePreCalc_LineCap1(q.getTrx(),q.getTry(),0,q.getBrx(),q.getBry(), 0,r,-t);this.LinePreCalc_LineCap1(q.getBrx(),q.getBry(),0,q.getBlx(),q.getBly(),0,-t,-r);this.LinePreCalc_LineCap1(q.getBlx(),q.getBly(),0,q.getTlx(),q.getTly(),0,-r,t)}_LineQuadPreCalc_LineCap0(q,t,r){this.LinePreCalc_LineCap0(q.getTlx(),q.getTly(),0,q.getTrx(),q.getTry(),0,t,r);this.LinePreCalc_LineCap0(q.getTrx(),q.getTry(),0,q.getBrx(),q.getBry(),0,r,-t);this.LinePreCalc_LineCap0(q.getBrx(),q.getBry(),0,q.getBlx(),q.getBly(),0,-t,-r);this.LinePreCalc_LineCap0(q.getBlx(),q.getBly(),0,q.getTlx(), q.getTly(),0,-r,t)}SetLineWidth(q){this._lineWidth=q;this._lineWidthStack[this._lineWidthStack.length-1]=q}GetLineWidth(){return this._lineWidth}PushLineWidth(q){if(100<=this._lineWidthStack.length)throw Error("pushed too many line widths - check push/pop pairs");this._lineWidthStack.push(q);this._lineWidth=q}PopLineWidth(){if(1>=this._lineWidthStack.length)throw Error("cannot pop last line width - check push/pop pairs");this._lineWidthStack.pop();this._lineWidth=this._lineWidthStack.at(-1)}SetLineCapButt(){this._lineCap= 0;this._lineCapStack[this._lineCapStack.length-1]=0}SetLineCapSquare(){this._lineCap=1;this._lineCapStack[this._lineCapStack.length-1]=0}SetLineCapZag(){this._lineCap=2;this._lineCapStack[this._lineCapStack.length-1]=0}PushLineCap(q){if("butt"===q)this.PushLineCapButt();else if("square"===q)this.PushLineCapSquare();else if("zag"===q)this.PushLineCapZag();else throw Error("invalid line cap");}PushLineCapButt(){if(100<=this._lineCapStack.length)throw Error("pushed too many line caps - check push/pop pairs"); this._lineCapStack.push(0);this._lineCap=0}PushLineCapSquare(){if(100<=this._lineCapStack.length)throw Error("pushed too many line caps - check push/pop pairs");this._lineCapStack.push(1);this._lineCap=1}PushLineCapZag(){if(100<=this._lineCapStack.length)throw Error("pushed too many line caps - check push/pop pairs");this._lineCapStack.push(2);this._lineCap=2}PopLineCap(){if(1>=this._lineCapStack.length)throw Error("cannot pop last line cap - check push/pop pairs");this._lineCapStack.pop();this._lineCap= this._lineCapStack.at(-1)}SetLineOffset(q){this._lineOffset=q;this._lineOffsetStack[this._lineOffsetStack.length-1]=q}GetLineOffset(){return this._lineOffset}PushLineOffset(q){if(100<=this._lineOffsetStack.length)throw Error("pushed too many line offsets - check push/pop pairs");this._lineOffsetStack.push(q);this._lineOffset=q}PopLineOffset(){if(1>=this._lineOffsetStack.length)throw Error("cannot pop last line offset - check push/pop pairs");this._lineOffsetStack.pop();this._lineOffset=this._lineOffsetStack.at(-1)}ConvexPoly(q){var t= q.length/2;if(3>t)throw Error("need at least 3 points");t-=2;const r=t-1,w=q[0],y=q[1];for(let C=0;C<t;C+=2){const D=2*C,G=q[D+2],K=q[D+3],B=q[D+4],A=q[D+5];C===r?this.Quad2(w,y,G,K,B,A,B,A):this.Quad2(w,y,G,K,B,A,q[D+6],q[D+7])}}GetNumVertexComponents(){return 3}Finish(){this.EndBatch(!0);this._frameNumber++}GetFrameNumber(){return this._frameNumber}IncrementFrameNumber(){this._frameNumber++}SetMipmapsEnabled(q){this._enableMipmaps=!!q}AreMipmapsEnabled(){return this._enableMipmaps}SetHasMajorPerformanceCaveat(q){this._hasMajorPerformanceCaveat= !!q}HasMajorPerformanceCaveat(){return this._hasMajorPerformanceCaveat}IsWebGL(){return!1}IsWebGPU(){return!1}}} {"use strict";const e=self.C3;e.Gfx.StateGroup=class{constructor(b,a,d,c,f){this._renderer=b;this._refCount=0;this._shaderProgram=null;this._shaderProgramName="";this._blendMode=d;this._color=e.New(e.Color);this._color.set(c);this._zElevation=f;"string"===typeof a?this._shaderProgramName=a:(this._shaderProgram=a,this._shaderProgramName=this._shaderProgram.GetName())}Release(){if(0<this._refCount)throw Error("releasing state group still in use");this._shaderProgram=this._renderer=null;this._shaderProgramName= ""}Apply(){const b=this._renderer;b.SetProgram(this._shaderProgram);b.SetBlendMode(this._blendMode);b.SetColor(this._color);b.SetCurrentZ(this._zElevation);b._SetCurrentStateGroup(this)}GetKey(){return e.Gfx.StateGroup.MakeKey(this._shaderProgramName,this._blendMode,this._color,this._zElevation)}AddRef(){++this._refCount}DecRef(){--this._refCount}_GetRefCount(){return this._refCount}OnContextLost(){this._shaderProgram=null}OnContextRestored(b){this._shaderProgram=b.GetShaderProgramByName(this._shaderProgramName); if(!this._shaderProgram)throw Error("failed to restore shader program");}static MakeKey(b,a,d,c){return("string"===typeof b?b:b.GetName())+","+a+","+d.getR()+","+d.getG()+","+d.getB()+","+d.getA()+","+c}}} {"use strict";const e=self.C3,b=e.New(e.Quad);function a(d,c,f){const l=f.getTlx(),g=f.getTly(),k=f.getTrx()-l,m=f.getTry()-g,u=f.getBlx()-l;f=f.getBly()-g;return[l+k*d+u*c,g+m*d+f*c]}e.Gfx.MeshPoint=class{constructor(d,c,f){this._mesh=d;this._col=c;this._row=f;this._v=this._u=this._zElevation=this._y=this._x=0}_Init(d,c,f,l){this._x=d;this._y=c;this._u=f;this._v=l}GetX(){return this._x}SetX(d){this._x!==d&&(this._x=d,this._mesh._SetPointsChanged())}GetY(){return this._y}SetY(d){this._y!==d&&(this._y= d,this._mesh._SetPointsChanged())}GetZElevation(){return this._zElevation}SetZElevation(d){this._zElevation!==d&&(this._zElevation=Math.max(d,0),this._mesh._SetPointsChanged())}GetU(){return this._u}SetU(d){this._u=d}GetV(){return this._v}SetV(d){this._v=d}_Interpolate_TexRect(d,c,f){[this._x,this._y]=a(d._x,d._y,c);this._zElevation=d._zElevation;this._u=e.lerp(f.getLeft(),f.getRight(),d._u);this._v=e.lerp(f.getTop(),f.getBottom(),d._v)}_Interpolate_TexQuad(d,c,f){[this._x,this._y]=a(d._x,d._y,c); this._zElevation=d._zElevation;[this._u,this._v]=a(d._u,d._v,f)}SaveToJson(){return{x:this.GetX(),y:this.GetY(),z:this.GetZElevation(),u:this.GetU(),v:this.GetV()}}LoadFromJson(d){this.SetX(d.x);this.SetY(d.y);d.hasOwnProperty("z")&&this.SetZElevation(d.z);this.SetU(d.u);this.SetV(d.v)}GetMesh(){return this._mesh}GetColumn(){return this._col}GetRow(){return this._row}};e.Gfx.Mesh=class{constructor(d,c,f){if(2>d||2>c)throw Error("invalid mesh size");this._hsize=d;this._vsize=c;this._owner=f||null; this._pts=[];this._minY=this._minX=0;this._maxY=this._maxX=1;this._maxZ=0;this._pointsChanged=!1;f=d-1;const l=c-1;for(let g=0;g<c;++g){const k=[];for(let m=0;m<d;++m){const u=e.New(e.Gfx.MeshPoint,this,m,g),x=m/f,n=g/l;u._Init(x,n,x,n);k.push(u)}this._pts.push(k)}}Release(){e.clearArray(this._pts)}GetHSize(){return this._hsize}GetVSize(){return this._vsize}GetOwner(){return this._owner}_GetPoints(){return this._pts}_SetPointsChanged(){this._pointsChanged=!0}_MaybeComputeBounds(){if(this._pointsChanged){var d= Infinity,c=Infinity,f=-Infinity,l=-Infinity,g=0;for(const k of this._pts)for(const m of k){const u=m.GetX(),x=m.GetY();d=Math.min(d,u);c=Math.min(c,x);f=Math.max(f,u);l=Math.max(l,x);g=Math.max(g,m.GetZElevation())}this._minX=d;this._minY=c;this._maxX=f;this._maxY=l;this._maxZ=g;this._pointsChanged=!1}}GetMinX(){this._MaybeComputeBounds();return this._minX}GetMinY(){this._MaybeComputeBounds();return this._minY}GetMaxX(){this._MaybeComputeBounds();return this._maxX}GetMaxY(){this._MaybeComputeBounds(); return this._maxY}GetMaxZ(){this._MaybeComputeBounds();return this._maxZ}HasAnyZElevation(){return 0<this.GetMaxZ()}GetMeshPointAt(d,c){d=Math.floor(d);c=Math.floor(c);return 0>d||d>=this._hsize||0>c||c>=this._vsize?null:this._pts[c][d]}CalculateTransformedMesh(d,c,f){const l=f instanceof e.Rect;if(d.GetHSize()!==this.GetHSize()||d.GetVSize()!==this.GetVSize())throw Error("source mesh wrong size");d=d._pts;const g=this._pts;for(let k=0,m=g.length;k<m;++k){const u=d[k],x=g[k];for(let n=0,q=x.length;n< q;++n){const t=u[n],r=x[n];l?r._Interpolate_TexRect(t,c,f):r._Interpolate_TexQuad(t,c,f)}}}Draw(d){const c=this._pts;let f=c[0];for(let l=1,g=c.length;l<g;++l){const k=c[l];let m=f[0],u=k[0];for(let x=1,n=k.length;x<n;++x){const q=f[x],t=k[x];b.set(m.GetU(),m.GetV(),q.GetU(),q.GetV(),t.GetU(),t.GetV(),u.GetU(),u.GetV());d.Quad3D2(m.GetX(),m.GetY(),m.GetZElevation(),q.GetX(),q.GetY(),q.GetZElevation(),t.GetX(),t.GetY(),t.GetZElevation(),u.GetX(),u.GetY(),u.GetZElevation(),b);m=q;u=t}f=k}}Outline(d, c){c||(c=(g,k,m)=>[g,k,m]);const f=this._pts;let l=f[0];for(let g=1,k=f.length;g<k;++g){const m=f[g];let u=l[0],x=m[0];for(let n=1,q=m.length;n<q;++n){const t=l[n],r=m[n],[w,y,C]=c(u.GetX(),u.GetY(),u.GetZElevation()),[D,G,K]=c(t.GetX(),t.GetY(),t.GetZElevation()),[B,A,F]=c(r.GetX(),r.GetY(),r.GetZElevation()),[J,L,Q]=c(x.GetX(),x.GetY(),x.GetZElevation());d.Line3D(w,y,C,D,G,K);d.Line3D(w,y,C,B,A,F);d.Line3D(w,y,C,J,L,Q);n===q-1&&d.Line3D(D,G,K,B,A,F);g===k-1&&d.Line3D(J,L,Q,B,A,F);u=t;x=r}l=m}}InsertPolyMeshVertices(d){d= d.pointsArr();const c=[],f=this.GetHSize()-1,l=this.GetVSize()-1,g=1/f,k=1/l,m=f-1,u=l-1;let x=d[0],n=d[1],q=e.clamp(Math.floor(x*f),0,m),t=e.clamp(Math.floor(n*l),0,u),r=0,w=0,y=0;var C=-1;const D=()=>{x=e.clamp(e.lerp(x,r,y),0,1);n=e.clamp(e.lerp(n,w,y),0,1);c.push(x,n)};for(let G=0,K=d.length;G<K;G+=2)for(x=d[G],n=d[G+1],c.push(x,n),q=e.clamp(Math.floor(x*f),0,m),t=e.clamp(Math.floor(n*l),0,u),C=(G+2)%K,r=d[C],w=d[C+1],C=-1;;){if(1E6<c.length)throw Error("Too many mesh poly points");const B=q* g,A=t*k,F=(q+1)*g,J=(t+1)*k;e.isPointInTriangleInclusive(x,n,B,A,F,A,F,J);if(0!==C&&(y=e.rayIntersectExtended(x,n,r,w,B,A,F,J,-.001),0<=y&&.99999999>=y)){D();C=0;continue}if(0<t&&2!==C&&(y=e.rayIntersectExtended(x,n,r,w,B,A,F,A,.001),0<=y&&.99999999>=y)){D();t--;C=4;continue}if(q<m&&3!==C&&(y=e.rayIntersectExtended(x,n,r,w,F,A,F,J,.001),0<=y&&.99999999>=y)){D();q++;C=1;continue}if(0<q&&1!==C&&(y=e.rayIntersectExtended(x,n,r,w,B,A,B,J,.001),0<=y&&.99999999>=y)){D();q--;C=3;continue}if(t<u&&4!==C&& (y=e.rayIntersectExtended(x,n,r,w,B,J,F,J,.001),0<=y&&.99999999>=y)){D();t++;C=2;continue}break}return e.New(e.CollisionPoly,c)}TransformCollisionPoly(d,c){d=this._TransformPolyPoints(d);this._SimplifyPoly(d);c.setPoints(d)}_TransformPolyPoints(d){const c=[];d=d.pointsArr();for(let f=0,l=d.length;f<l;f+=2){const [g,k]=this.TransformPoint(d[f],d[f+1]);c.push(g,k)}return c}TransformPoint(d,c){var f=this.GetHSize()-1,l=this.GetVSize()-1,g=1/f,k=1/l;f=e.clamp(Math.floor(d*f),0,f-1);const m=e.clamp(Math.floor(c* l),0,l-1);l=f*g;const u=m*k,x=(f+1)*g,n=(m+1)*k,q=this.GetMeshPointAt(f,m),t=this.GetMeshPointAt(f+1,m+1),r=e.isPointInTriangleInclusive(d,c,l,u,x,u,x,n);g=r?l+g:l;k=r?u:u+k;f=this.GetMeshPointAt(f+(r?1:0),m+(r?0:1));const [w,y,C]=e.triangleCartesianToBarycentric(d,c,l,u,g,k,x,n);return e.triangleBarycentricToCartesian(w,y,C,q.GetX(),q.GetY(),f.GetX(),f.GetY(),t.GetX(),t.GetY())}_SimplifyPoly(d){const c=[];let f=d[0],l=d[1],g=f-d.at(-2),k=l-d.at(-1);for(let u=0,x=d.length;u<x;u+=2){var m=(u+2)%x; const n=d[m];m=d[m+1];const q=n-f,t=m-l,r=1E-7>Math.abs(t)&&1E-7>Math.abs(k)&&Math.sign(q)===Math.sign(g);(!(1E-7>Math.abs(q)&&1E-7>Math.abs(g)&&Math.sign(t)===Math.sign(k)||r)&&1E-7<Math.abs(q/g-t/k)||0==q&&0===t)&&c.push(f,l);f=n;l=m;g=q;k=t}6<=c.length&&c.length<d.length&&e.shallowAssignArray(d,c)}SaveToJson(){return{cols:this.GetHSize(),rows:this.GetVSize(),points:this._pts.map(d=>d.map(c=>c.SaveToJson()))}}LoadFromJson(d){const c=this.GetHSize(),f=this.GetVSize();if(d.cols!==c||d.rows!==f)throw Error("mesh data wrong size"); d=d.points;for(let l=0;l<f;++l){const g=d[l];for(let k=0;k<c;++k)this.GetMeshPointAt(k,l).LoadFromJson(g[k])}}}} {"use strict";const e=self.C3,b=new Set(["rgba8","rgb8","rgba4","rgb5_a1","rgb565"]),a=new Set(["nearest","bilinear","trilinear"]),d=new Set(["default","low","high"]),c=new Set(["clamp-to-edge","repeat","mirror-repeat"]);function f(m,u){let x,n;switch(m){case "rgba8":m=u.RGBA8;n=x=u.RGBA;u=u.UNSIGNED_BYTE;break;case "rgb8":m=u.RGB8;n=x=u.RGB;u=u.UNSIGNED_BYTE;break;case "rgba4":m=u.RGBA4;n=x=u.RGBA;u=u.UNSIGNED_SHORT_4_4_4_4;break;case "rgb5_a1":m=u.RGB5_A1;n=x=u.RGBA;u=u.UNSIGNED_SHORT_5_5_5_1;break; case "rgb565":m=u.RGB565;n=x=u.RGB;u=u.UNSIGNED_SHORT_5_6_5;break;default:throw Error("invalid pixel format");}return{sizedinternalformat:m,internalformat:x,format:n,type:u}}const l={wrapX:"clamp-to-edge",wrapY:"clamp-to-edge",sampling:"trilinear",anisotropy:0,pixelFormat:"rgba8",mipMap:!0,mipMapQuality:"default",premultiplyAlpha:!0,isSvg:!1,width:-1,height:-1},g={premultiplyAlpha:!0,flipY:!1},k=new Set;e.Gfx.WebGLRendererTexture=class{constructor(m){this._renderer=m;this._texture=null;this._height= this._width=0;this._isStatic=!0;this._wrapY=this._wrapX="clamp-to-edge";this._sampling="trilinear";this._anisotropy=0;this._pixelFormat="rgba8";this._isMipMapped=!1;this._mipMapQuality="default";this._refCount=0}_CreateStatic(m,u){if(!("undefined"!==typeof HTMLImageElement&&m instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&m instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&m instanceof ImageBitmap||"undefined"!==typeof OffscreenCanvas&&m instanceof OffscreenCanvas|| m instanceof ImageData||m instanceof ArrayBuffer)&&null!==m)throw Error("invalid texture source");u=Object.assign({},l,u);if(this._texture)throw Error("already created texture");this._wrapX=u.wrapX;this._wrapY=u.wrapY;this._sampling=u.sampling;this._anisotropy=u.anisotropy;this._pixelFormat=u.pixelFormat;this._isMipMapped=!!u.mipMap&&this._renderer.AreMipmapsEnabled();this._mipMapQuality=u.mipMapQuality;if(!c.has(this._wrapX)||!c.has(this._wrapY))throw Error("invalid wrap mode");if(!a.has(this._sampling))throw Error("invalid sampling"); if(!b.has(this._pixelFormat))throw Error("invalid pixel format");if(!d.has(this._mipMapQuality))throw Error("invalid mipmap quality");this._isStatic=!0;if(m instanceof ArrayBuffer||null===m||u.isSvg){if(this._width=u.width,this._height=u.height,m instanceof ArrayBuffer&&m.byteLength!==this._width*this._height*4)throw Error("ArrayBuffer wrong size");}else this._width=m.width,this._height=m.height;if(0>=this._width||0>=this._height)throw Error("invalid texture data size");if(u.isSvg){var x=e.CreateCanvas(this._width, this._height);x.getContext("2d").drawImage(m,0,0,this._width,this._height);m=x}var n=e.isPOT(this._width)&&e.isPOT(this._height);x=this._renderer.GetMaxTextureSize();if(this._width>x||this._height>x)throw Error("texture data exceeds maximum texture size");x=this._renderer.GetContext();var q=this._renderer.GetWebGLVersionNumber();this._texture=x.createTexture();x.bindTexture(x.TEXTURE_2D,this._texture);x.pixelStorei(x.UNPACK_PREMULTIPLY_ALPHA_WEBGL,u.premultiplyAlpha);x.pixelStorei(x.UNPACK_FLIP_Y_WEBGL, !1);u=f(this._pixelFormat,x);if(this._renderer.SupportsNPOTTextures()||n||!this._IsTiled())2<=q?(x.texStorage2D(x.TEXTURE_2D,this._isMipMapped?Math.floor(Math.log2(Math.max(this._width,this._height))+1):1,u.sizedinternalformat,this._width,this._height),m instanceof ArrayBuffer?x.texSubImage2D(x.TEXTURE_2D,0,0,0,this._width,this._height,u.format,u.type,new Uint8Array(m)):null!==m&&x.texSubImage2D(x.TEXTURE_2D,0,0,0,u.format,u.type,m)):m instanceof ArrayBuffer?x.texImage2D(x.TEXTURE_2D,0,u.internalformat, this._width,this._height,0,u.format,u.type,new Uint8Array(m)):null===m?x.texImage2D(x.TEXTURE_2D,0,u.internalformat,this._width,this._height,0,u.format,u.type,null):x.texImage2D(x.TEXTURE_2D,0,u.internalformat,u.format,u.type,m);else{if(null===m)throw Error("cannot pass null data when creating a NPOT tiled texture without NPOT support");m instanceof ArrayBuffer&&(m=new ImageData(new Uint8ClampedArray(m),this._width,this._height));m instanceof ImageData&&(n=e.CreateCanvas(this._width,this._height), n.getContext("2d").putImageData(m,0,0),m=n);n=e.CreateCanvas(e.nextHighestPowerOfTwo(this._width),e.nextHighestPowerOfTwo(this._height));q=n.getContext("2d");q.imageSmoothingEnabled="nearest"!==this._sampling;q.drawImage(m,0,0,this._width,this._height,0,0,n.width,n.height);x.texImage2D(x.TEXTURE_2D,0,u.internalformat,u.format,u.type,n)}null!==m&&this._SetTextureParameters(x);x.bindTexture(x.TEXTURE_2D,null);this._renderer._ResetLastTexture();this._refCount=1;k.add(this)}_CreateDynamic(m,u,x){x=Object.assign({}, l,x);if(this._texture)throw Error("already created texture");this._wrapX=x.wrapX;this._wrapY=x.wrapY;this._sampling=x.sampling;this._pixelFormat=x.pixelFormat;this._isMipMapped=!!x.mipMap&&this._renderer.AreMipmapsEnabled();this._mipMapQuality=x.mipMapQuality;if(!c.has(this._wrapX)||!c.has(this._wrapY))throw Error("invalid wrap mode");if(!a.has(this._sampling))throw Error("invalid sampling");if(!b.has(this._pixelFormat))throw Error("invalid pixel format");if(!d.has(this._mipMapQuality))throw Error("invalid mipmap quality"); this._isStatic=!1;this._width=Math.floor(m);this._height=Math.floor(u);m=e.isPOT(this._width)&&e.isPOT(this._height);u=this._renderer.GetMaxTextureSize();if(0>=this._width||0>=this._height)throw Error("invalid texture size");if(this._width>u||this._height>u)throw Error("texture exceeds maximum texture size");if(!this._renderer.SupportsNPOTTextures()&&this._IsTiled()&&!m)throw Error("non-power-of-two tiled textures not supported");m=this._renderer.GetContext();u=this._renderer.GetWebGLVersionNumber(); this._texture=m.createTexture();m.bindTexture(m.TEXTURE_2D,this._texture);m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL,x.premultiplyAlpha);m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,!1);x=f(this._pixelFormat,m);m.texImage2D(m.TEXTURE_2D,0,2<=u?x.sizedinternalformat:x.internalformat,this._width,this._height,0,x.format,x.type,null);this._SetTextureParameters(m);m.bindTexture(m.TEXTURE_2D,null);this._renderer._ResetLastTexture();this._refCount=1;k.add(this)}_GetMipMapHint(m){if("default"===this._mipMapQuality)return this._isStatic? m.NICEST:m.FASTEST;if("low"===this._mipMapQuality)return m.FASTEST;if("high"===this._mipMapQuality)return m.NICEST;throw Error("invalid mipmap quality");}_IsTiled(){return"clamp-to-edge"!==this._wrapX||"clamp-to-edge"!==this._wrapY}_GetTextureWrapMode(m,u){if("clamp-to-edge"===u)return m.CLAMP_TO_EDGE;if("repeat"===u)return m.REPEAT;if("mirror-repeat"===u)return m.MIRRORED_REPEAT;throw Error("invalid wrap mode");}_SetTextureParameters(m){var u=e.isPOT(this._width)&&e.isPOT(this._height);m.texParameteri(m.TEXTURE_2D, m.TEXTURE_WRAP_S,this._GetTextureWrapMode(m,this._wrapX));m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,this._GetTextureWrapMode(m,this._wrapY));"nearest"===this._sampling?(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.NEAREST),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.NEAREST),this._isMipMapped=!1):(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.LINEAR),(u||this._renderer.SupportsNPOTTextures())&&this._isMipMapped?(m.hint(m.GENERATE_MIPMAP_HINT,this._GetMipMapHint(m)),m.generateMipmap(m.TEXTURE_2D), u="trilinear"===this._sampling&&!this._renderer.HasMajorPerformanceCaveat(),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,u?m.LINEAR_MIPMAP_LINEAR:m.LINEAR_MIPMAP_NEAREST)):(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.LINEAR),this._isMipMapped=!1));(u=this._renderer._GetAnisotropicExtension())&&0<this._anisotropy&&"nearest"!==this._sampling&&m.texParameterf(m.TEXTURE_2D,u.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(this._anisotropy,this._renderer._GetMaxAnisotropy()))}_Update(m,u){if(!("undefined"!== typeof HTMLImageElement&&m instanceof HTMLImageElement||"undefined"!==typeof HTMLVideoElement&&m instanceof HTMLVideoElement||"undefined"!==typeof HTMLCanvasElement&&m instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&m instanceof ImageBitmap||"undefined"!==typeof OffscreenCanvas&&m instanceof OffscreenCanvas||m instanceof ImageData))throw Error("invalid texture source");if(!this._texture||0>=this._refCount)throw Error("texture not created");if(this._isStatic)throw Error("cannot update static texture"); u=Object.assign({},g,u);const x=m.width||m.videoWidth,n=m.height||m.videoHeight;var q=this._renderer.GetWebGLVersionNumber();const t=this._renderer.GetContext();t.bindTexture(t.TEXTURE_2D,this._texture);t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,u.premultiplyAlpha);t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!!u.flipY);u=f(this._pixelFormat,t);q=2<=q?u.sizedinternalformat:u.internalformat;try{if(this._width===x&&this._height===n){const r=e.isPOT(this._width)&&e.isPOT(this._height);t.texSubImage2D(t.TEXTURE_2D, 0,0,0,u.format,u.type,m);(r||this._renderer.SupportsNPOTTextures())&&this._isMipMapped&&(t.hint(t.GENERATE_MIPMAP_HINT,this._GetMipMapHint(t)),t.generateMipmap(t.TEXTURE_2D))}else{this._width=x;this._height=n;const r=e.isPOT(this._width)&&e.isPOT(this._height);if(!this._renderer.SupportsNPOTTextures()&&this._IsTiled()&&!r)throw Error("non-power-of-two tiled textures not supported");t.texImage2D(t.TEXTURE_2D,0,q,u.format,u.type,m);(r||this._renderer.SupportsNPOTTextures())&&this._isMipMapped&&(t.hint(t.GENERATE_MIPMAP_HINT, this._GetMipMapHint(t)),t.generateMipmap(t.TEXTURE_2D))}}catch(r){console.error("Error updating WebGL texture: ",r)}t.bindTexture(t.TEXTURE_2D,null);this._renderer._ResetLastTexture()}_Delete(){if(0<this._refCount)throw Error("texture still has references");if(!this._texture)throw Error("already deleted texture");k.delete(this);this._renderer.GetContext().deleteTexture(this._texture);this._texture=null}IsValid(){return!!this._texture}_GetTexture(){return this._texture}GetRenderer(){return this._renderer}AddReference(){this._refCount++}SubtractReference(){if(0>= this._refCount)throw Error("no more references");this._refCount--}GetReferenceCount(){return this._refCount}GetWidth(){return this._width}GetHeight(){return this._height}IsStatic(){return this._isStatic}GetEstimatedMemoryUsage(){let m=this._width*this._height;switch(this._pixelFormat){case "rgba8":m*=4;break;case "rgb8":m*=3;break;case "rgba4":case "rgb5_a1":case "rgb565":m*=2}this._isMipMapped&&(m+=Math.floor(m/3));return m}static OnContextLost(){k.clear()}static allTextures(){return k.values()}}} {"use strict";const e=self.C3,b=self.glMatrix.mat4,a=new Set(["nearest","bilinear","trilinear"]),d={sampling:"trilinear",alpha:!0,depth:!1,isSampled:!0,isDefaultSize:!0,multisampling:0},c=new Set;e.Gfx.WebGLRenderTarget=class{constructor(f){this._renderer=f;this._renderBuffer=this._texture=this._frameBuffer=null;this._height=this._width=0;this._isDefaultSize=!0;this._sampling="trilinear";this._alpha=!0;this._depth=!1;this._isSampled=!0;this._multisampling=0;this._projectionMatrix=b.create()}_Create(f, l,g){g=Object.assign({},d,g);const k=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(0<this._multisampling&&(2>k||this._isSampled))throw Error("invalid use of multisampling");2>k&&(this._isSampled= !0);this._width=f;this._height=l;if(0>=this._width||0>=this._height)throw Error("invalid render target size");this._CalculateProjection();f=this._renderer.GetContext();this._frameBuffer=f.createFramebuffer();f.bindFramebuffer(f.FRAMEBUFFER,this._frameBuffer);this._isSampled?(this._texture=this._renderer.CreateDynamicTexture(this._width,this._height,{sampling:this._sampling,pixelFormat:this._alpha?"rgba8":"rgb8",mipMap:!1}),l=this._texture._GetTexture(),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0, f.TEXTURE_2D,l,0)):(this._renderBuffer=f.createRenderbuffer(),f.bindRenderbuffer(f.RENDERBUFFER,this._renderBuffer),l=this._alpha?f.RGBA8:f.RGB8,0<this._multisampling&&((g=f.getInternalformatParameter(f.RENDERBUFFER,l,f.SAMPLES))&&g[0]?(g=g[0],this._multisampling>g&&(this._multisampling=g)):this._multisampling=0),0===this._multisampling?f.renderbufferStorage(f.RENDERBUFFER,l,this._width,this._height):f.renderbufferStorageMultisample(f.RENDERBUFFER,this._multisampling,l,this._width,this._height),f.framebufferRenderbuffer(f.FRAMEBUFFER, f.COLOR_ATTACHMENT0,f.RENDERBUFFER,this._renderBuffer),f.bindRenderbuffer(f.RENDERBUFFER,null));l=this._renderer._GetDepthBuffer();this._depth&&l&&f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.RENDERBUFFER,l);f.bindFramebuffer(f.FRAMEBUFFER,null);c.add(this)}_Resize(f,l){if(this._width!==f||this._height!==l)this._width=f,this._height=l,this._CalculateProjection(),f=this._renderer.GetContext(),f.bindFramebuffer(f.FRAMEBUFFER,this._frameBuffer),this._texture?this._texture._Update(new ImageData(this._width, this._height)):(f.bindRenderbuffer(f.RENDERBUFFER,this._renderBuffer),f.renderbufferStorage(f.RENDERBUFFER,this._alpha?f.RGBA8:f.RGB8,this._width,this._height),f.bindRenderbuffer(f.RENDERBUFFER,null)),l=this._renderer._GetDepthBuffer(),this._depth&&l&&f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.RENDERBUFFER,l),f.bindFramebuffer(f.FRAMEBUFFER,null)}_Delete(){if(!this._texture&&!this._renderBuffer)throw Error("already deleted render target");c.delete(this);const f=this._renderer.GetContext(); f.bindFramebuffer(f.FRAMEBUFFER,this._frameBuffer);this._texture?(f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,null,0),this._renderer.DeleteTexture(this._texture),this._texture=null):this._renderBuffer&&(f.framebufferRenderbuffer(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.RENDERBUFFER,null),f.deleteRenderbuffer(this._renderBuffer),this._renderBuffer=null);f.bindFramebuffer(f.FRAMEBUFFER,null);2<=this._renderer.GetWebGLVersionNumber()&&(f.bindFramebuffer(f.READ_FRAMEBUFFER,null), f.bindFramebuffer(f.DRAW_FRAMEBUFFER,null));f.deleteFramebuffer(this._frameBuffer);this._frameBuffer=this._renderer.GetBatchState().currentFramebuffer=null}_CalculateProjection(){this._renderer.CalculatePerspectiveMatrix(this._projectionMatrix,this._width/this._height)}_GetFramebuffer(){return this._frameBuffer}GetRenderer(){return this._renderer}GetTexture(){return this._texture}GetProjectionMatrix(){return this._projectionMatrix}IsLinearSampling(){return"nearest"!==this._sampling}HasAlpha(){return this._alpha}IsSampled(){return this._isSampled}HasDepthBuffer(){return this._depth}GetWidth(){return this._width}GetHeight(){return this._height}IsDefaultSize(){return this._isDefaultSize}GetMultisampling(){return this._multisampling}GetOptions(){const f= {sampling:this._sampling,alpha:this._alpha,isSampled:this._isSampled};this._isDefaultSize||(f.width=this._width,f.height=this._height);return f}IsCompatibleWithOptions(f){f=Object.assign({},d,f);return"nearest"!==f.sampling!==this.IsLinearSampling()||!!f.alpha!==this.HasAlpha()||!!f.depth!==this.HasDepthBuffer()||2<=this._renderer.GetWebGLVersionNumber()&&!!f.isSampled!==this.IsSampled()?!1:"number"===typeof f.width||"number"===typeof f.height?!this.IsDefaultSize()&&this.GetWidth()===f.width&&this.GetHeight()=== f.height:this.IsDefaultSize()}_GetWebGLTexture(){return this._texture?this._texture._GetTexture():null}GetEstimatedMemoryUsage(){return this._texture?this._texture.GetEstimatedMemoryUsage():this._width*this._height*(this._alpha?4:3)}static async DebugReadPixelsToBlob(f,l){f=await f.ReadBackRenderTargetToImageData(l,!0);return await e.ImageDataToBlob(f)}static OnContextLost(){c.clear()}static allRenderTargets(){return c.values()}static ResizeAll(f,l){for(const g of c)g.IsDefaultSize()&&g._Resize(f, l)}}} {"use strict";const e=self.C3,b=new Set("aPos aTex aPoints matP matMV samplerFront samplerBack destStart destEnd srcStart srcEnd srcOriginStart srcOriginEnd pixelSize seconds layerScale layerAngle layoutStart layoutEnd color color2_ pointTexStart pointTexEnd zElevation tileSize tileSpacing outlineThickness".split(" "));e.Gfx.WebGLShaderProgram=class{static async Compile(a,d,c,f){const l=a.GetContext(),g=l.createShader(l.FRAGMENT_SHADER);l.shaderSource(g,d);l.compileShader(g);d=l.createShader(l.VERTEX_SHADER);l.shaderSource(d, c);l.compileShader(d);const k=l.createProgram();l.attachShader(k,g);l.attachShader(k,d);l.bindAttribLocation(k,0,"aPos");l.bindAttribLocation(k,1,"aTex");l.bindAttribLocation(k,2,"aPoints");l.linkProgram(k);const m=a._GetParallelShaderCompileExtension();m?await a._WaitForObjectReady(()=>l.getProgramParameter(k,m.COMPLETION_STATUS_KHR)):await e.Wait(5);if(!l.getShaderParameter(g,l.COMPILE_STATUS))throw f=l.getShaderInfoLog(g),l.deleteShader(g),l.deleteShader(d),l.deleteProgram(k),Error("Error compiling fragment shader: "+ f);if(!l.getShaderParameter(d,l.COMPILE_STATUS))throw f=l.getShaderInfoLog(d),l.deleteShader(g),l.deleteShader(d),l.deleteProgram(k),Error("Error compiling vertex shader: "+f);if(!l.getProgramParameter(k,l.LINK_STATUS))throw f=l.getProgramInfoLog(k),l.deleteShader(g),l.deleteShader(d),l.deleteProgram(k),Error("Error linking shader program: "+f);(a=e.FilterUnprintableChars(l.getProgramInfoLog(k)||"").trim())&&!e.IsStringAllWhitespace(a)&&console.info(`[WebGL] Shader program '${f}' compilation log: `, a);l.deleteShader(g);l.deleteShader(d);return k}static async Create(a,d,c,f){c=await e.Gfx.WebGLShaderProgram.Compile(a,d.src,c,f);return new e.Gfx.WebGLShaderProgram(a,c,d,f)}constructor(a,d,c,f){const l=a.GetContext();var g=a.GetBatchState();a.EndBatch();l.useProgram(d);this._gl=l;this._renderer=a;this._name=f;this._shaderProgram=d;this._isDeviceTransform="<default-device-transform>"===f;f=l.getAttribLocation(d,"aPos");const k=l.getAttribLocation(d,"aTex");this._locAPoints=l.getAttribLocation(d, "aPoints");-1!==f&&(l.bindBuffer(l.ARRAY_BUFFER,a._vertexBuffer),l.vertexAttribPointer(f,a.GetNumVertexComponents(),l.FLOAT,!1,0,0),l.enableVertexAttribArray(f));-1!==k&&(l.bindBuffer(l.ARRAY_BUFFER,a._texcoordBuffer),l.vertexAttribPointer(k,2,l.FLOAT,!1,0,0),l.enableVertexAttribArray(k));-1!==this._locAPoints&&(l.bindBuffer(l.ARRAY_BUFFER,a._pointBuffer),l.vertexAttribPointer(this._locAPoints,4,l.FLOAT,!1,0,0),l.enableVertexAttribArray(this._locAPoints));l.bindBuffer(l.ARRAY_BUFFER,null);this._uMatP= new e.Gfx.WebGLShaderUniform(this,"matP","mat4");this._uMatMV=new e.Gfx.WebGLShaderUniform(this,"matMV","mat4");this._uColor=new e.Gfx.WebGLShaderUniform(this,"color","vec4");this._uSamplerFront=new e.Gfx.WebGLShaderUniform(this,"samplerFront","sampler");this._uPointTexStart=new e.Gfx.WebGLShaderUniform(this,"pointTexStart","vec2");this._uPointTexEnd=new e.Gfx.WebGLShaderUniform(this,"pointTexEnd","vec2");this._uZElevation=new e.Gfx.WebGLShaderUniform(this,"zElevation","float");this._uTileSize=new e.Gfx.WebGLShaderUniform(this, "tileSize","vec2");this._uTileSpacing=new e.Gfx.WebGLShaderUniform(this,"tileSpacing","vec2");this._uColor2=new e.Gfx.WebGLShaderUniform(this,"color2_","vec4");this._uOutlineThickness=new e.Gfx.WebGLShaderUniform(this,"outlineThickness","float");this._uSamplerBack=new e.Gfx.WebGLShaderUniform(this,"samplerBack","sampler");this._uDestStart=new e.Gfx.WebGLShaderUniform(this,"destStart","vec2");this._uDestEnd=new e.Gfx.WebGLShaderUniform(this,"destEnd","vec2");this._uSrcStart=new e.Gfx.WebGLShaderUniform(this, "srcStart","vec2");this._uSrcEnd=new e.Gfx.WebGLShaderUniform(this,"srcEnd","vec2");this._uSrcOriginStart=new e.Gfx.WebGLShaderUniform(this,"srcOriginStart","vec2");this._uSrcOriginEnd=new e.Gfx.WebGLShaderUniform(this,"srcOriginEnd","vec2");this._uPixelSize=new e.Gfx.WebGLShaderUniform(this,"pixelSize","vec2");this._uSeconds=new e.Gfx.WebGLShaderUniform(this,"seconds","float");this._uLayerScale=new e.Gfx.WebGLShaderUniform(this,"layerScale","float");this._uLayerAngle=new e.Gfx.WebGLShaderUniform(this, "layerAngle","float");this._uLayoutStart=new e.Gfx.WebGLShaderUniform(this,"layoutStart","vec2");this._uLayoutEnd=new e.Gfx.WebGLShaderUniform(this,"layoutEnd","vec2");this._hasAnyOptionalUniforms=!!(this._uPixelSize.IsUsed()||this._uSeconds.IsUsed()||this._uSamplerBack.IsUsed()||this._uDestStart.IsUsed()||this._uDestEnd.IsUsed()||this._uSrcStart.IsUsed()||this._uSrcEnd.IsUsed()||this._uSrcOriginStart.IsUsed()||this._uSrcOriginEnd.IsUsed()||this._uLayerScale.IsUsed()||this._uLayerAngle.IsUsed()|| this._uLayoutStart.IsUsed()||this._uLayoutEnd.IsUsed());this._extendBoxHorizontal=c.extendBoxHorizontal||0;this._extendBoxVertical=c.extendBoxVertical||0;this._crossSampling=!!c.crossSampling;this._mustPreDraw=!!c.mustPreDraw;this._preservesOpaqueness=!!c.preservesOpaqueness;this._animated=!!c.animated;a=c.parameters||[];this._uCustomParameters=[];this._usesDest=this._uDestStart.IsUsed()||this._uDestEnd.IsUsed();this._usesAnySrcRectOrPixelSize=this._uPixelSize.IsUsed()||this._uSrcStart.IsUsed()|| this._uSrcEnd.IsUsed()||this._uSrcOriginStart.IsUsed()||this._uSrcOriginEnd.IsUsed();this._needsPostDrawOrExtendBox=this._crossSampling||this._usesDest||0!==this._extendBoxHorizontal||0!==this._extendBoxVertical;this._hasCurrentMatMV=this._hasCurrentMatP=!1;this._uColor.Init4f(1,1,1,1);this._uColor2.Init4f(1,1,1,1);this._uSamplerFront.Init1i(0);this._uSamplerBack.Init1i(1);this._uPointTexStart.Init2f(0,0);this._uPointTexEnd.Init2f(1,1);this._uZElevation.Init1f(0);this._uTileSize.Init2f(0,0);this._uTileSpacing.Init2f(0, 0);this._uDestStart.Init2f(0,0);this._uDestEnd.Init2f(1,1);this._uSrcStart.Init2f(0,0);this._uSrcEnd.Init2f(0,0);this._uSrcOriginStart.Init2f(0,0);this._uSrcOriginEnd.Init2f(0,0);this._uPixelSize.Init2f(0,0);this._uLayerScale.Init1f(1);this._uLayerAngle.Init1f(0);this._uSeconds.Init1f(0);this._uLayoutStart.Init2f(0,0);this._uLayoutEnd.Init2f(0,0);this._uOutlineThickness.Init1f(1);for(const m of a)a=m[2],d=new e.Gfx.WebGLShaderUniform(this,m[0],a),"color"===a?d.Init3f(0,0,0):d.Init1f(0),this._uCustomParameters.push(d); this._isDeviceTransform?this._UpdateDeviceTransformUniforms(g.currentMatP):(this.UpdateMatP(g.currentMatP,!0),this.UpdateMatMV(g.currentMV,!0));g=g.currentShader;l.useProgram(g?g._shaderProgram:null)}Release(){this._gl.deleteProgram(this._shaderProgram);this._shaderProgram=null;this._renderer._RemoveShaderProgram(this);this._renderer=this._gl=null}GetName(){return this._name}GetWebGLContext(){return this._gl}GetShaderProgram(){return this._shaderProgram}UsesDest(){return this._usesDest}UsesCrossSampling(){return this._crossSampling}MustPreDraw(){return this._mustPreDraw}PreservesOpaqueness(){return this._preservesOpaqueness}ExtendsBox(){return 0!== this._extendBoxHorizontal||0!==this._extendBoxVertical}GetBoxExtendHorizontal(){return this._extendBoxHorizontal}GetBoxExtendVertical(){return this._extendBoxVertical}UsesAnySrcRectOrPixelSize(){return this._usesAnySrcRectOrPixelSize}NeedsPostDrawOrExtendsBox(){return this._needsPostDrawOrExtendBox}GetParameterCount(){return this._uCustomParameters.length}GetParameterType(a){return this._uCustomParameters[a].GetType()}AreCustomParametersAlreadySetInBatch(a){for(let d=0,c=a.length;d<c;++d)if(!this._uCustomParameters[d].IsSetToCustomInBatch(a[d]))return!1; return!0}SetCustomParametersInBatch(a){for(let d=0,c=a.length;d<c;++d)this._uCustomParameters[d].SetBatchValueCustom(a[d])}AreOptionalUniformsAlreadySetInBatch(a,d,c,f,l,g,k,m,u){return this._uSamplerBack.IsUsed()||this._uPixelSize.IsUsed()&&!this._uPixelSize.IsSetTo2InBatch(l,g)||this._uDestStart.IsUsed()&&!this._uDestStart.IsSetTo2InBatch(a.getLeft(),a.getTop())||this._uDestEnd.IsUsed()&&!this._uDestEnd.IsSetTo2InBatch(a.getRight(),a.getBottom())||this._uLayerScale.IsUsed()&&!this._uLayerScale.IsSetTo1InBatch(k)|| this._uLayerAngle.IsUsed()&&!this._uLayerAngle.IsSetTo1InBatch(m)||this._uSrcStart.IsUsed()&&!this._uSrcStart.IsSetTo2InBatch(d.getLeft(),d.getTop())||this._uSrcEnd.IsUsed()&&!this._uSrcEnd.IsSetTo2InBatch(d.getRight(),d.getBottom())||this._uSrcOriginStart.IsUsed()&&!this._uSrcOriginStart.IsSetTo2InBatch(c.getLeft(),c.getTop())||this._uSrcOriginEnd.IsUsed()&&!this._uSrcOriginEnd.IsSetTo2InBatch(c.getRight(),c.getBottom())||this._uLayoutStart.IsUsed()&&!this._uLayoutStart.IsSetTo2InBatch(f.getLeft(), f.getTop())||this._uLayoutEnd.IsUsed()&&!this._uLayoutEnd.IsSetTo2InBatch(f.getTop(),f.getBottom())||this._uSeconds.IsUsed()&&!this._uSeconds.IsSetTo1InBatch(u)?!1:!0}SetOptionalUniformsInBatch(a,d,c,f,l,g,k,m,u){this._uSamplerBack.IsUsed()||(this._uPixelSize.IsUsed()&&this._uPixelSize.SetBatch2(l,g),this._uDestStart.IsUsed()&&this._uDestStart.SetBatch2(a.getLeft(),a.getTop()),this._uDestEnd.IsUsed()&&this._uDestEnd.SetBatch2(a.getRight(),a.getBottom()),this._uLayerScale.IsUsed()&&this._uLayerScale.SetBatch1(k), this._uLayerAngle.IsUsed()&&this._uLayerAngle.SetBatch1(m),this._uSrcStart.IsUsed()&&this._uSrcStart.SetBatch2(d.getLeft(),d.getTop()),this._uSrcEnd.IsUsed()&&this._uSrcEnd.SetBatch2(d.getRight(),d.getBottom()),this._uSrcOriginStart.IsUsed()&&this._uSrcOriginStart.SetBatch2(c.getLeft(),c.getTop()),this._uSrcOriginEnd.IsUsed()&&this._uSrcOriginEnd.SetBatch2(c.getRight(),c.getBottom()),this._uLayoutStart.IsUsed()&&this._uLayoutStart.SetBatch2(f.getLeft(),f.getTop()),this._uLayoutEnd.IsUsed()&&this._uLayoutEnd.SetBatch2(f.getTop(), f.getBottom()),this._uSeconds.IsUsed()&&this._uSeconds.SetBatch1(u))}IsAnimated(){return this._animated}UpdateMatP(a,d){this._hasCurrentMatP&&!d||this._isDeviceTransform||(this._uMatP.IsUsed()&&this._uMatP.UpdateMatrix4fv(a),this._hasCurrentMatP=!0)}SetMatPStale(){this._hasCurrentMatP=!1}UpdateMatMV(a,d){this._hasCurrentMatMV&&!d||this._isDeviceTransform||(this._uMatMV.IsUsed()&&this._uMatMV.UpdateMatrix4fv(a),this._hasCurrentMatMV=!0)}SetMatMVStale(){this._hasCurrentMatMV=!1}_UpdateDeviceTransformUniforms(a){if(!this._isDeviceTransform)throw Error("not device transform shader"); this._uMatP.UpdateMatrix4fv(a);a=this._renderer;const d=a.GetWidth()/2,c=a.GetHeight()/2;a=a.CalculateLookAtModelView2(d,c,a.GetDefaultCameraZ()*self.devicePixelRatio,d,c,0);this._uMatMV.UpdateMatrix4fv(a)}UpdateColor(a){this._uColor.IsUsed()&&this._uColor.Update4f(a[0],a[1],a[2],a[3])}static GetReservedUniformNames(){return b}static GetDefaultVertexShaderSource(a){a=a?"highmedp":"mediump";return["#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif\nattribute highp vec3 aPos;", `attribute ${a} vec2 aTex;`,`varying ${a} vec2 vTex;`,"uniform highp mat4 matP;\nuniform highp mat4 matMV;\nvoid main(void) {\n\tgl_Position = matP * matMV * vec4(aPos, 1.0);\n\tvTex = aTex;\n}"].join("\n")}static GetTextureFillFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nuniform lowp sampler2D samplerFront;\nvoid main(void) {\n\tgl_FragColor = texture2D(samplerFront, vTex) * color;\n}"}static GetTilemapFragmentShaderSource(){return"#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif\nvarying highmedp vec2 vTex;\nuniform lowp vec4 color;\nuniform lowp sampler2D samplerFront;\nuniform highmedp vec2 srcStart;\nuniform highmedp vec2 pixelSize;\nuniform highmedp vec2 tileSize;\nuniform highmedp vec2 tileSpacing;\nvoid main(void) {\n\thighmedp vec2 tile = floor(vTex);\n\thighmedp vec2 tex = fract(vTex);\n\thighmedp vec2 tileOrigin = srcStart + tile * (tileSize + tileSpacing);\n\thighmedp vec2 lowerBound = tileOrigin + pixelSize / 2.0;\n\thighmedp vec2 upperBound = tileOrigin + tileSize - pixelSize / 2.0;\n\tgl_FragColor = texture2D(samplerFront, clamp(tex, lowerBound, upperBound), -16.0) * color;\n}"}static GetPointVertexShaderSource(a){return e.Gfx.WebGLShaderProgram.GetPointVertexShaderSource_WebGL1()}static GetPointFragmentShaderSource(a){return e.Gfx.WebGLShaderProgram.GetPointFragmentShaderSource_WebGL1()}static GetPointVertexShaderSource_WebGL1(){return"attribute vec4 aPoints;\nvarying float pointOpacity;\nuniform float zElevation;\nuniform mat4 matP;\nuniform mat4 matMV;\nvoid main(void) {\n\tgl_Position = matP * matMV * vec4(aPoints.xy, zElevation, 1.0);\n\tgl_PointSize = aPoints.z;\n\tpointOpacity = aPoints.w;\n}"}static GetPointFragmentShaderSource_WebGL1(){return"uniform lowp sampler2D samplerFront;\nvarying lowp float pointOpacity;\nuniform mediump vec2 pointTexStart;\nuniform mediump vec2 pointTexEnd;\nuniform lowp vec4 color;\nvoid main(void) {\n\tgl_FragColor = texture2D(samplerFront, mix(pointTexStart, pointTexEnd, gl_PointCoord)) * color * pointOpacity;\n}"}static GetColorFillFragmentShaderSource(){return"uniform lowp vec4 color;\nvoid main(void) {\n\tgl_FragColor = color;\n}"}static GetLinearGradientFillFragmentShaderSource(){return"precision lowp float;\nvarying mediump vec2 vTex;\nuniform vec4 color;\nuniform vec4 color2_;\nvec3 fromLinear(vec3 linearRGB)\n{\n\tbvec3 cutoff = lessThan(linearRGB, vec3(0.0031308));\n\tvec3 higher = vec3(1.055) * pow(abs(linearRGB), vec3(1.0/2.4)) - vec3(0.055);\n\tvec3 lower = linearRGB * vec3(12.92);\n\treturn mix(higher, lower, vec3(cutoff));\n}\nvec3 toLinear(vec3 sRGB)\n{\n\tbvec3 cutoff = lessThan(sRGB, vec3(0.04045));\n\tvec3 higher = pow(abs((sRGB + vec3(0.055))/vec3(1.055)), vec3(2.4));\n\tvec3 lower = sRGB/vec3(12.92);\n\treturn mix(higher, lower, vec3(cutoff));\n}\nvoid main(void) {\n\tvec3 linearGrad = mix(toLinear(color.rgb), toLinear(color2_.rgb), vTex.x);\n\tfloat a = mix(color.a, color2_.a, vTex.x);\n\tgl_FragColor = vec4(fromLinear(linearGrad) * a, a);\n}"}static GetSmoothLineFillFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nvoid main(void) {\n\tlowp float f = 1.0 - abs(vTex.y - 0.5) * 2.0;\n\tgl_FragColor = color * f;\n}"}static GetHardEllipseFillFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nvoid main(void) {\n\tmediump vec2 diff = vTex - vec2(0.5, 0.5);\n\tmediump vec2 diffSq = diff * diff;\n\tmediump float f = step(diffSq.x + diffSq.y, 0.25);\n\tgl_FragColor = color * f;\n}"}static GetHardEllipseOutlineFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nuniform mediump vec2 pixelSize;\nuniform mediump float outlineThickness;\nvoid main(void) {\n\tmediump vec2 diff = vTex - vec2(0.5, 0.5);\n\tmediump vec2 diffSq = diff * diff;\n\tmediump float distSq = diffSq.x + diffSq.y;\n\tmediump vec2 norm = normalize(diff);\n\tmediump vec2 halfNorm = norm * 0.5;\n\tmediump float innerF = step(distSq, 0.25);\n\tmediump vec2 innerEdge = halfNorm - pixelSize * norm * outlineThickness;\n\tmediump vec2 innerEdgeSq = innerEdge * innerEdge;\n\tmediump float outerF = step(innerEdgeSq.x + innerEdgeSq.y, distSq);\n\tgl_FragColor = color * innerF * outerF;\n}"}static GetSmoothEllipseFillFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nuniform mediump vec2 pixelSize;\nvoid main(void) {\n\tmediump vec2 diff = vTex - vec2(0.5, 0.5);\n\tmediump vec2 diffSq = diff * diff;\n\tmediump vec2 norm = normalize(diff);\n\tmediump vec2 halfNorm = norm * 0.5;\n\tmediump vec2 halfNormSq = halfNorm * halfNorm;\n\tmediump vec2 innerEdge = halfNorm - pixelSize * norm;\n\tmediump vec2 innerEdgeSq = innerEdge * innerEdge;\n\tmediump float f = smoothstep(halfNormSq.x + halfNormSq.y, innerEdgeSq.x + innerEdgeSq.y, diffSq.x + diffSq.y);\n\tgl_FragColor = color * f;\n}"}static GetSmoothEllipseOutlineFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nuniform mediump vec2 pixelSize;\nuniform mediump float outlineThickness;\nvoid main(void) {\n\tmediump vec2 diff = vTex - vec2(0.5, 0.5);\n\tmediump vec2 diffSq = diff * diff;\n\tmediump float distSq = diffSq.x + diffSq.y;\n\tmediump vec2 norm = normalize(diff);\n\tmediump vec2 halfNorm = norm * 0.5;\n\tmediump vec2 halfNormSq = halfNorm * halfNorm;\n\tmediump vec2 pxNorm = pixelSize * norm;\n\tmediump vec2 innerEdge1 = halfNorm - pxNorm;\n\tmediump vec2 innerEdge1Sq = innerEdge1 * innerEdge1;\n\tmediump float innerF = smoothstep(halfNormSq.x + halfNormSq.y, innerEdge1Sq.x + innerEdge1Sq.y, distSq);\n\tmediump vec2 innerEdge2 = halfNorm - pxNorm * outlineThickness;\n\tmediump vec2 innerEdge2Sq = innerEdge2 * innerEdge2;\n\tmediump vec2 innerEdge3 = halfNorm - pxNorm * (outlineThickness + 1.0);\n\tmediump vec2 innerEdge3Sq = innerEdge3 * innerEdge3;\n\tmediump float outerF = smoothstep(innerEdge3Sq.x + innerEdge3Sq.y, innerEdge2Sq.x + innerEdge2Sq.y, distSq);\n\tgl_FragColor = color * innerF * outerF;\n}"}}} {"use strict";const e=self.C3,b=self.glMatrix.mat4,a=new Map([["float",1],["percent",1],["sampler",1],["vec2",2],["vec3",3],["color",3],["vec4",4],["mat4",16]]);e.Gfx.WebGLShaderUniform=class{constructor(d,c,f){if(!a.has(f))throw Error("invalid uniform type");this._owner=d;this._gl=this._owner.GetWebGLContext();this._name=c;this._type=f;this._isColorType="color"===this._type;this._location=this._gl.getUniformLocation(this._owner.GetShaderProgram(),c);this._isUsed=!!this._location;d=a.get(f);this._lastValue= new Float32Array(d);this._lastBatchValue=new Float32Array(d)}Release(){this._location=this._gl=this._owner=null}IsUsed(){return this._isUsed}GetType(){return this._type}IsColorType(){return this._isColorType}Init1f(d){this.IsUsed()&&(this._lastValue[0]=d,this._lastBatchValue.set(this._lastValue),this._gl.uniform1f(this._location,d))}Init1i(d){this.IsUsed()&&(this._lastValue[0]=d,this._lastBatchValue.set(this._lastValue),this._gl.uniform1i(this._location,d))}Init2f(d,c){this.IsUsed()&&(this._lastValue[0]= d,this._lastValue[1]=c,this._lastBatchValue.set(this._lastValue),this._gl.uniform2f(this._location,d,c))}Init3f(d,c,f){this.IsUsed()&&(this._lastValue[0]=d,this._lastValue[1]=c,this._lastValue[2]=f,this._lastBatchValue.set(this._lastValue),this._gl.uniform3f(this._location,d,c,f))}Init4f(d,c,f,l){this.IsUsed()&&(this._lastValue[0]=d,this._lastValue[1]=c,this._lastValue[2]=f,this._lastValue[3]=l,this._lastBatchValue.set(this._lastValue),this._gl.uniform4f(this._location,d,c,f,l))}Update1f(d){d=Math.fround(d); const c=this._lastValue;c[0]!==d&&(c[0]=d,this._gl.uniform1f(this._location,d))}Update1i(d){const c=this._lastValue;c[0]!==d&&(c[0]=d,this._gl.uniform1i(this._location,d))}Update2f(d,c){d=Math.fround(d);c=Math.fround(c);const f=this._lastValue;if(f[0]!==d||f[1]!==c)f[0]=d,f[1]=c,this._gl.uniform2f(this._location,d,c)}Update3f(d,c,f){d=Math.fround(d);c=Math.fround(c);f=Math.fround(f);const l=this._lastValue;if(l[0]!==d||l[1]!==c||l[2]!==f)l[0]=d,l[1]=c,l[2]=f,this._gl.uniform3f(this._location,d,c, f)}Update4f(d,c,f,l){d=Math.fround(d);c=Math.fround(c);f=Math.fround(f);l=Math.fround(l);const g=this._lastValue;if(g[0]!==d||g[1]!==c||g[2]!==f||g[3]!==l)g[0]=d,g[1]=c,g[2]=f,g[3]=l,this._gl.uniform4f(this._location,d,c,f,l)}UpdateMatrix4fv(d){const c=this._lastValue;b.exactEquals(c,d)||(e.typedArraySet16(c,d,0),this._gl.uniformMatrix4fv(this._location,!1,d))}IsSetToCustomInBatch(d){const c=this._lastBatchValue;return this.IsColorType()?c[0]===Math.fround(d.getR())&&c[1]===Math.fround(d.getG())&& c[2]===Math.fround(d.getB()):c[0]===Math.fround(d)}SetBatchValueCustom(d){const c=this._lastBatchValue;this.IsColorType()?(c[0]=d.getR(),c[1]=d.getG(),c[2]=d.getB()):c[0]=d}IsSetTo1InBatch(d){return this._lastBatchValue[0]===Math.fround(d)}IsSetTo2InBatch(d,c){const f=this._lastBatchValue;return f[0]===Math.fround(d)&&f[1]===Math.fround(c)}SetBatch1(d){this._lastBatchValue[0]=d}SetBatch2(d,c){const f=this._lastBatchValue;f[0]=d;f[1]=c}}} {"use strict";const e=self.C3,b=self.glMatrix,a=b.vec4,d=b.mat4;e.Gfx.BatchState=class{constructor(c){this.renderer=c;this.currentMV=d.create();this.currentMatP=d.create();this.currentFramebuffer=null;this.currentColor=a.fromValues(1,1,1,1);this.currentShader=null;this.pointTexCoords=new e.Rect;this.clearColor=e.New(e.Color,0,0,0,0)}};e.Gfx.WebGLBatchJob=class{constructor(c){const f=new ArrayBuffer(96);this._type=0;this._batchState=c;this._gl=c.renderer.GetContext();this._indexCount=this._startIndex= 0;this._texParam=null;this._mat4param=new Float32Array(f,0,16);this._colorParam=new Float32Array(f,64,4);this._srcOriginRect=new Float32Array(f,80,4);this._shaderParams=[]}InitQuad(c,f){this._type=1;this._startIndex=c;this._indexCount=f}DoQuad(){const c=this._gl;c.drawElements(c.TRIANGLES,this._indexCount,c.UNSIGNED_SHORT,this._startIndex)}InitSetTexture(c){this._type=2;this._texParam=c}DoSetTexture(){const c=this._gl,f=this._texParam;c.bindTexture(c.TEXTURE_2D,f?f._GetTexture():null)}InitSetColor(c){this._type= 3;c.writeToTypedArray(this._colorParam,0)}DoSetColor(){const c=this._colorParam,f=this._batchState;a.copy(f.currentColor,c);f.currentShader.UpdateColor(c)}InitSetGradientColor(c){this._type=21;c.writeToTypedArray(this._colorParam,0)}DoSetGradientColor(){const c=this._colorParam,f=this._batchState.currentShader;f._uColor2.IsUsed()&&f._uColor2.Update4f(c[0],c[1],c[2],c[3])}InitSetBlend(c,f){this._type=4;this._startIndex=c;this._indexCount=f}DoSetBlend(){this._gl.blendFunc(this._startIndex,this._indexCount)}InitSetViewport(c, f,l,g){this._type=5;const k=this._colorParam;k[0]=c;k[1]=f;k[2]=l;k[3]=g}DoSetViewport(){const c=this._colorParam;this._gl.viewport(c[0],c[1],c[2],c[3])}InitSetProjection(c){this._type=6;d.copy(this._mat4param,c)}DoSetProjection(){const c=this._batchState,f=c.renderer._allShaderPrograms,l=c.currentShader,g=this._mat4param;for(let k=0,m=f.length;k<m;++k){const u=f[k];u===l?u.UpdateMatP(g,!0):u.SetMatPStale()}d.copy(c.currentMatP,g)}InitSetModelView(c){this._type=7;d.copy(this._mat4param,c)}DoSetModelView(){const c= this._batchState,f=c.renderer._allShaderPrograms,l=c.currentShader,g=this._mat4param;for(let k=0,m=f.length;k<m;++k){const u=f[k];u===l?u.UpdateMatMV(g,!0):u.SetMatMVStale()}d.copy(c.currentMV,g)}InitSetRenderTarget(c){this._type=8;this._texParam=c}DoSetRenderTarget(){const c=this._gl;var f=this._texParam;const l=this._batchState;f?(f=f._GetFramebuffer(),l.currentFramebuffer=f,c.bindFramebuffer(c.FRAMEBUFFER,f)):(l.currentFramebuffer=null,c.bindFramebuffer(c.FRAMEBUFFER,null))}InitClearSurface(c){this._type= 9;c.writeToTypedArray(this._mat4param,0)}InitClearSurface2(c,f,l,g){this._type=9;const k=this._mat4param;k[0]=c;k[1]=f;k[2]=l;k[3]=g}DoClearSurface(){const c=this._gl;var f=this._mat4param,l=this._batchState;const g=l.clearColor;(l=l.renderer._isScissorViewport&&e.isDebug)&&c.disable(c.SCISSOR_TEST);const k=f[0],m=f[1],u=f[2];f=f[3];g.equalsRgba(k,m,u,f)||(c.clearColor(k,m,u,f),g.setRgba(k,m,u,f));c.clear(c.COLOR_BUFFER_BIT);l&&c.enable(c.SCISSOR_TEST)}InitClearRect(c,f,l,g,k,m,u,x){this._type=10; const n=this._mat4param;n[0]=c;n[1]=f;n[2]=l;n[3]=g;n[4]=k;n[5]=m;n[6]=u;n[7]=x}DoClearRectangle(){const c=this._gl;var f=this._mat4param,l=this._batchState;const g=l.renderer;l=l.clearColor;g._isScissorViewport||c.enable(c.SCISSOR_TEST);c.scissor(f[0],f[1],f[2],f[3]);const k=f[4],m=f[5],u=f[6];f=f[7];l.equalsRgba(k,m,u,f)||(c.clearColor(k,m,u,f),l.setRgba(k,m,u,f));c.clear(c.COLOR_BUFFER_BIT);g._isScissorViewport?c.scissor(0,0,g._viewportScissorWidth,g._viewportScissorHeight):c.disable(c.SCISSOR_TEST)}InitSetPointTexCoords(c){this._type= 15;c.writeToTypedArray(this._mat4param,0)}DoSetPointTextureCoords(){const c=this._mat4param;this._batchState.pointTexCoords.set(c[0],c[1],c[2],c[3])}InitPoints(c,f){this._type=11;this._startIndex=c;this._indexCount=1;this._mat4param[0]=f}DoPoints(){const c=this._gl,f=this._batchState,l=f.renderer._spPoints;c.useProgram(l._shaderProgram);l.UpdateMatP(f.currentMatP,!1);l.UpdateMatMV(f.currentMV,!1);var g=f.pointTexCoords;l._uPointTexStart.IsUsed()&&l._uPointTexStart.Update2f(g.getLeft(),g.getTop()); l._uPointTexEnd.IsUsed()&&l._uPointTexEnd.Update2f(g.getRight(),g.getBottom());g=this._mat4param[0];l._uZElevation.IsUsed()&&l._uZElevation.Update1f(g);l._uColor.IsUsed()&&(g=f.currentColor,l._uColor.Update4f(g[0],g[1],g[2],g[3]));c.drawArrays(c.POINTS,this._startIndex/4,this._indexCount);c.useProgram(f.currentShader._shaderProgram)}InitSetProgram(c){this._type=12;this._texParam=c}DoSetProgram(){var c=this._gl;const f=this._batchState,l=this._texParam;f.currentShader=l;c.useProgram(l._shaderProgram); l.UpdateMatP(f.currentMatP,!1);l.UpdateMatMV(f.currentMV,!1);l._uColor.IsUsed()&&(c=f.currentColor,l._uColor.Update4f(c[0],c[1],c[2],c[3]))}InitSetProgramParameters(){this._type=13}DoSetProgramParameters(){const c=this._batchState.currentShader;c._hasAnyOptionalUniforms&&this._DoSetOptionalUniformProgramParameters(c);c._uCustomParameters.length&&this._DoUpdateCustomProgramParameters(c)}_DoSetOptionalUniformProgramParameters(c){const f=this._gl,l=this._mat4param,g=this._colorParam,k=this._srcOriginRect; if(c._uSamplerBack.IsUsed()){const m=this._batchState.renderer,u=this._texParam;m._lastTexture1!==u&&(f.activeTexture(f.TEXTURE1),f.bindTexture(f.TEXTURE_2D,u?u._GetTexture():null),m._lastTexture1=u,f.activeTexture(f.TEXTURE0))}c._uPixelSize.IsUsed()&&c._uPixelSize.Update2f(l[0],l[1]);c._uDestStart.IsUsed()&&c._uDestStart.Update2f(l[2],l[3]);c._uDestEnd.IsUsed()&&c._uDestEnd.Update2f(l[4],l[5]);c._uLayerScale.IsUsed()&&c._uLayerScale.Update1f(l[6]);c._uLayerAngle.IsUsed()&&c._uLayerAngle.Update1f(l[7]); c._uSrcStart.IsUsed()&&c._uSrcStart.Update2f(l[12],l[13]);c._uSrcEnd.IsUsed()&&c._uSrcEnd.Update2f(l[14],l[15]);c._uSrcOriginStart.IsUsed()&&c._uSrcOriginStart.Update2f(k[0],k[1]);c._uSrcOriginEnd.IsUsed()&&c._uSrcOriginEnd.Update2f(k[2],k[3]);c._uLayoutStart.IsUsed()&&c._uLayoutStart.Update2f(g[0],g[1]);c._uLayoutEnd.IsUsed()&&c._uLayoutEnd.Update2f(g[2],g[3]);c._uSeconds.IsUsed()&&c._uSeconds.Update1f(this._startIndex)}_DoUpdateCustomProgramParameters(c){c=c._uCustomParameters;const f=this._shaderParams; for(let l=0,g=c.length;l<g;++l){const k=c[l],m=f[l];k.IsColorType()?k.Update3f(m.getR(),m.getG(),m.getB()):k.Update1f(m)}}InitInvalidateFramebuffer(c){this._type=14;this._texParam=c}DoInvalidateFramebuffer(){const c=this._gl,f=this._texParam,l=this._batchState.currentFramebuffer;f!==l&&c.bindFramebuffer(c.FRAMEBUFFER,f);c.invalidateFramebuffer(c.FRAMEBUFFER,[c.COLOR_ATTACHMENT0]);f!==l&&c.bindFramebuffer(c.FRAMEBUFFER,l)}InitBlitFramebuffer(c,f,l){this._type=17;const g=this._mat4param,k=this._batchState.renderer; g[0]=c.GetWidth();g[1]=c.GetHeight();g[2]=f?f.GetWidth():k.GetWidth();g[3]=f?f.GetHeight():k.GetHeight();g[4]=c.IsLinearSampling()?1:0;g[5]="stretch"===l;l=this._shaderParams;e.clearArray(l);l.push(c._GetFramebuffer());l.push(f?f._GetFramebuffer():null)}DoBlitFramebuffer(){var c=this._mat4param,f=this._shaderParams;const l=this._gl;var g=c[0],k=c[1],m=c[2];const u=c[3],x=0!==c[4];c=0!==c[5];const n=f[1];l.bindFramebuffer(l.READ_FRAMEBUFFER,f[0]);l.bindFramebuffer(l.DRAW_FRAMEBUFFER,n);c?l.blitFramebuffer(0, 0,g,k,0,0,m,u,l.COLOR_BUFFER_BIT,x?l.LINEAR:l.NEAREST):(f=Math.min(g,m),g=Math.min(k,u),m=Math.max(k-u,0),k=Math.max(u-k,0),l.blitFramebuffer(0,m,f,g+m,0,k,f,g+k,l.COLOR_BUFFER_BIT,l.NEAREST))}InitStartQuery(c){this._type=18;this._texParam=c}DoStartQuery(){this._texParam.BeginTimeElapsed();this._texParam=null}InitEndQuery(c){this._type=19;this._texParam=c}DoEndQuery(){this._texParam.EndTimeElapsed();this._texParam=null}InitSetEllipseParams(c,f,l){this._type=20;const g=this._mat4param;g[0]=c;g[1]= f;g[2]=l}DoSetEllipseParams(){const c=this._batchState.currentShader,f=this._mat4param;c._uPixelSize.IsUsed()&&c._uPixelSize.Update2f(f[0],f[1]);c._uOutlineThickness.IsUsed()&&c._uOutlineThickness.Update1f(f[2])}InitSetTilemapInfo(c,f,l,g,k,m,u){this._type=16;const x=this._mat4param;c.writeToTypedArray(x,0);x[4]=1/f;x[5]=1/l;x[6]=g/f;x[7]=k/l;x[8]=m/f;x[9]=u/l}DoSetTilemapInfo(){const c=this._batchState.currentShader,f=this._mat4param;c._uSrcStart.IsUsed()&&c._uSrcStart.Update2f(f[0],f[1]);c._uPixelSize.IsUsed()&& c._uPixelSize.Update2f(f[4],f[5]);c._uTileSize.IsUsed()&&c._uTileSize.Update2f(f[6],f[7]);c._uTileSpacing.IsUsed()&&c._uTileSpacing.Update2f(f[8],f[9])}InitClearDepth(){this._type=22}DoClearDepth(){const c=this._gl;c.clear(c.DEPTH_BUFFER_BIT)}InitSetDepthEnabled(c){this._type=23;this._startIndex=c?1:0}DoSetDepthEnabled(){const c=this._gl;0===this._startIndex?(c.disable(c.DEPTH_TEST),c.depthMask(!1)):(c.enable(c.DEPTH_TEST),c.depthMask(!0))}InitCoplanarStartStencilPass(){this._type=24}DoCoplanarStartStencilPass(){const c= this._gl;c.clear(c.STENCIL_BUFFER_BIT);c.enable(c.STENCIL_TEST);c.stencilFunc(c.ALWAYS,1,1);c.stencilOp(c.KEEP,c.KEEP,c.REPLACE);c.colorMask(!1,!1,!1,!1)}InitCoplanarStartColorPass(){this._type=25}DoCoplanarStartColorPass(){const c=this._gl;c.colorMask(!0,!0,!0,!0);c.stencilFunc(c.EQUAL,1,1);c.stencilOp(c.KEEP,c.KEEP,c.KEEP)}InitCoplanarRestore(){this._type=26}DoCoplanarRestore(){const c=this._gl;c.disable(c.STENCIL_TEST)}Run(){switch(this._type){case 1:this.DoQuad();break;case 2:this.DoSetTexture(); break;case 3:this.DoSetColor();break;case 4:this.DoSetBlend();break;case 5:this.DoSetViewport();break;case 6:this.DoSetProjection();break;case 7:this.DoSetModelView();break;case 8:this.DoSetRenderTarget();break;case 9:this.DoClearSurface();break;case 10:this.DoClearRectangle();break;case 11:this.DoPoints();break;case 12:this.DoSetProgram();break;case 13:this.DoSetProgramParameters();break;case 14:this.DoInvalidateFramebuffer();break;case 15:this.DoSetPointTextureCoords();break;case 16:this.DoSetTilemapInfo(); break;case 17:this.DoBlitFramebuffer();break;case 18:this.DoStartQuery();break;case 19:this.DoEndQuery();break;case 20:this.DoSetEllipseParams();break;case 21:this.DoSetGradientColor();break;case 22:this.DoClearDepth();break;case 23:this.DoSetDepthEnabled();break;case 24:this.DoCoplanarStartStencilPass();break;case 25:this.DoCoplanarStartColorPass();break;case 26:this.DoCoplanarRestore()}}}} {"use strict";const e=self.C3,b={timeout:60},a=new e.Color(0,0,0,1),d=new Set(["left","center","right"]),c=new Set(["top","center","bottom"]),f=new Set(["word","character"]),l=new Set;e.FontManager&&e.FontManager.addEventListener("fontload",n=>{n=n.font.GetName();for(const q of l)(q.IsBBCodeEnabled()||e.equalsNoCase(q.GetFontName(),n))&&q._SetTextChanged()});function g(n,q,t,r,w,y){q?"Gecko"===e.Platform.BrowserEngine?n.strokeText(t,r,w,y):n.strokeText(t,r,w):"Gecko"===e.Platform.BrowserEngine?n.fillText(t, r,w,y):n.fillText(t,r,w)}function k(n,q,t,r,w,y){q?n.strokeRect(t,r,w,y):n.fillRect(t,r,w,y)}function m(n){return 4/3*n}let u=!1,x=!1;e.Gfx.RendererText=class{constructor(n,q){q=Object.assign({},b,q);this._renderer=n;this._fontName="Arial";this._fontSize=16;this._fontSizeScale=1;this._lineHeight=0;this._isItalic=this._isBold=!1;this._colorStr="black";this._isBBcodeEnabled=!1;this.onloadfont=null;this._alreadyLoadedFonts=new Set;this._horizontalAlign="left";this._verticalAlign="top";this._text=""; this._bbString=null;this._wrappedText=e.New(e.WordWrap);this._wrapMode="word";this._isUpdating=this._textChanged=!1;this._isAsync=!0;this._drawMaxCharCount=-1;this._height=this._width=this._cssHeight=this._cssWidth=this._drawCharCount=0;this._zoom=1;this._changed=!1;this._measureContextTop=this._measureContext=this._textContext=this._textCanvas=null;this._lastCanvasHeight=this._lastCanvasWidth=-1;this._lastTextCanvasFillStyle=this._lastMeasureCanvasFont=this._lastTextCanvasFont="";this._lastTextCanvasLineWidth= this._lastTextCanvasOpacity=1;this._measureTextCallback=(t,r)=>this._MeasureText(t,r);this._texture=null;this._textureHeight=this._textureWidth=0;this._rcTex=new e.Rect;this._scaleFactor=1;this._needToRecreateTexture=!1;this._textureTimeout=new e.IdleTimeout(()=>{this.ReleaseTexture();this._SetTextCanvasSize(8,8)},q.timeout);this.ontextureupdate=null;this._wasReleased=!1;l.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;l.delete(this)}_SetChanged(){this._changed=!0}_SetTextChanged(){this._SetChanged();this._wrappedText.Clear();this._textChanged=!0}SetIsAsync(n){this._isAsync=!!n}IsAsync(){return this._isAsync}SetBBCodeEnabled(n){n=!!n;this._isBBcodeEnabled!==n&&(n=(this._isBBcodeEnabled=n)?"alphabetic": "top",this._textContext&&(this._textContext.textBaseline=n),this._measureContext&&(this._measureContext.textBaseline=n),this._SetTextChanged())}IsBBCodeEnabled(){return this._isBBcodeEnabled}SetFontName(n){n||(n="serif");this._fontName!==n&&(this._fontName=n,this._SetTextChanged())}GetFontName(){return this._fontName}SetFontSize(n){.1>n&&(n=.1);this._fontSize!==n&&(this._fontSize=n,this._SetTextChanged())}SetFontSizeScale(n){this._fontSizeScale!==n&&(this._fontSizeScale=n,this._SetTextChanged())}SetLineHeight(n){this._lineHeight!== n&&(this._lineHeight=n,this._SetChanged())}SetBold(n){n=!!n;this._isBold!==n&&(this._isBold=n,this._SetTextChanged())}SetItalic(n){n=!!n;this._isItalic!==n&&(this._isItalic=n,this._SetTextChanged())}SetDrawMaxCharacterCount(n){n=Math.floor(n);this._drawMaxCharCount!==n&&(this._drawMaxCharCount=n,this._SetChanged())}GetDrawMaxCharacterCount(){return this._drawMaxCharCount}_GetStyleTag(n,q){for(let t=n.length-1;0<=t;--t){const r=n[t];if(r.tag===q)return r}return null}_HasStyleTag(n,q){return!!this._GetStyleTag(n, q)}_GetFontString(n,q){let t=[];(this._isBold||this._HasStyleTag(q,"b"))&&t.push("bold");(this._isItalic||this._HasStyleTag(q,"i"))&&t.push("italic");var r=this._GetStyleTag(q,"size");r=(r?parseFloat(r.param):this._fontSize)*this._fontSizeScale;n?t.push(r+"pt"):t.push(r*this._scaleFactor*this._zoom*self.devicePixelRatio+"pt");n=this._fontName;(q=this._GetStyleTag(q,"font"))&&q.param&&(n=q.param,this.onloadfont&&!this._alreadyLoadedFonts.has(n)&&(this.onloadfont(n),this._alreadyLoadedFonts.add(n))); n&&t.push('"'+n+'"');return t.join(" ")}SetColor(n){n instanceof e.Color&&(n=n.getCssRgb());this._colorStr!==n&&(this._colorStr=n,this._SetChanged())}SetColorRgb(n,q,t){a.setRgb(n,q,t);this.SetColor(a)}SetHorizontalAlignment(n){if(!d.has(n))throw Error("invalid horizontal alignment");this._horizontalAlign!==n&&(this._horizontalAlign=n,this._SetChanged())}SetVerticalAlignment(n){if(!c.has(n))throw Error("invalid vertical alignment");this._verticalAlign!==n&&(this._verticalAlign=n,this._SetChanged())}SetWordWrapMode(n){if(!f.has(n))throw Error("invalid word wrap mode"); this._wrapMode!==n&&(this._wrapMode=n,this._SetTextChanged())}SetText(n){this._text!==n&&(this._text=n,this._SetTextChanged())}SetSize(n,q,t){"undefined"===typeof t&&(t=1);if(!(0>=n||0>=n||this._cssWidth===n&&this._cssHeight===q&&this._zoom===t)){1===this._zoom!==(1===t)&&(this._needToRecreateTexture=!0);var r=this._cssWidth,w=this._zoom;this._cssWidth=n;this._cssHeight=q;this._zoom=t;n=self.devicePixelRatio;this._width=this._cssWidth*this._zoom*n;this._height=this._cssHeight*this._zoom*n;n=Math.max(this._width, this._height);q=Math.min(this._renderer.GetMaxTextureSize(),2048);t=1;n>q&&(t=q/n,this._width=Math.min(this._width*t,q),this._height=Math.min(this._height*t,q));this._scaleFactor=t;0<this._textureWidth&&0<this._textureHeight&&this._zoom===w&&this._rcTex.set(0,0,this._width/this._textureWidth,this._height/this._textureHeight);this._cssWidth!==r?this._SetTextChanged():this._SetChanged()}}GetWidth(){return this._width}GetHeight(){return this._height}GetTextWidth(){this._MaybeWrapText();return this._wrappedText.GetMaxLineWidth()}GetTextHeight(){this._MaybeWrapText(); return this._wrappedText.GetTotalLineHeight()+this._wrappedText.GetLineCount()*(this._lineHeight+4)-this._lineHeight}GetTexture(){this._textureTimeout.Reset();this._MaybeUpdate();return this._texture}_MaybeUpdate(){this._texture&&!this._changed&&!this._textChanged||this._isUpdating||0>=this._width||0>=this._height||(this._changed=!1,this._isUpdating=!0,this._isAsync?e.Asyncify(()=>this._DoUpdate()):this._DoUpdate())}_DoUpdate(){this._wasReleased||(this._SetTextCanvasSize(Math.ceil(this._width),Math.ceil(this._height)), this._MaybeWrapText(),this._DrawTextToCanvas(),this._UpdateTexture(),this._textureTimeout.Reset(),this._isUpdating=!1)}_SetTextCanvasSize(n,q){this._textCanvas||(this._textCanvas=e.CreateCanvas(16,16));let t=!1;if(this._lastCanvasWidth!==n||this._lastCanvasHeight!==q)this._lastCanvasWidth=n,this._lastCanvasHeight=q,this._textCanvas.width=n,this._textCanvas.height=q,t=!0;this._textContext||(this._textContext=this._textCanvas.getContext("2d"),t=!0);t?(this._textContext.textBaseline=this._isBBcodeEnabled? "alphabetic":"top",this._textContext.font=this._lastTextCanvasFont,this._textContext.fillStyle=this._lastTextCanvasFillStyle,this._textContext.strokeStyle=this._lastTextCanvasFillStyle,this._textContext.globalAlpha=this._lastTextCanvasOpacity,this._textContext.lineWidth=this._lastTextCanvasLineWidth):this._textContext.clearRect(0,0,n,q)}_MaybeCreateMeasureContext(){this._measureContext||(this._measureContext=e.CreateCanvas(16,16).getContext("2d"),this._measureContextTop=e.CreateCanvas(16,16).getContext("2d"), this._measureContext.textBaseline=this._isBBcodeEnabled?"alphabetic":"top",this._measureContextTop.textBaseline="top")}_SetMeasureFontString(n){this._lastMeasureCanvasFont!==n&&(this._lastMeasureCanvasFont=n,this._measureContext.font=n,this._measureContextTop.font=n)}_SupportsFontBoundingBoxMeasurements(){if(!u){u=!0;this._MaybeCreateMeasureContext();const n=this._measureContext.measureText("test");x="number"===typeof n.fontBoundingBoxAscent&&"number"===typeof n.fontBoundingBoxDescent}return x}_MaybeWrapText(){this._textChanged&& (this._MaybeCreateMeasureContext(),!this._isBBcodeEnabled||this._bbString&&this._bbString.toString()===this._text||(this._bbString=new e.BBString(this._text,{noEscape:!0})),this._wrappedText.WordWrap(this._isBBcodeEnabled?this._bbString.toFragmentList():this._text,this._measureTextCallback,this._cssWidth,this._wrapMode,0),this._textChanged=!1)}_MeasureText(n,q){this._SetMeasureFontString(this._GetFontString(!0,q));q=this._GetStyleTag(q,"size");q=(q?parseFloat(q.param):this._fontSize)*this._fontSizeScale; const t=this._measureContext.measureText(n);let r=0;this._isBBcodeEnabled&&this._SupportsFontBoundingBoxMeasurements()&&(n=this._measureContextTop.measureText(n),r=t.fontBoundingBoxAscent-n.fontBoundingBoxAscent);return{width:t.width,height:m(q),fontBoundingBoxAscent:t.fontBoundingBoxAscent||0,fontBoundingBoxDescent:t.fontBoundingBoxDescent||0,topToAlphabeticDistance:r}}_SetDrawFontString(n){this._lastTextCanvasFont!==n&&(this._lastTextCanvasFont=n,this._textContext.font=n)}_SetDrawCanvasColor(n){this._lastTextCanvasFillStyle!== n&&(this._lastTextCanvasFillStyle=n,this._textContext.fillStyle=n,this._textContext.strokeStyle=n)}_SetDrawCanvasOpacity(n){this._lastTextCanvasOpacity!==n&&(this._lastTextCanvasOpacity=n,this._textContext.globalAlpha=n)}_SetDrawCanvasLineWith(n){this._lastTextCanvasLineWidth!==n&&(this._lastTextCanvasLineWidth=n,this._textContext.lineWidth=n)}_DrawTextToCanvas(){this._drawCharCount=0;const n=this._scaleFactor*this._zoom*self.devicePixelRatio,q=(4+this._lineHeight)*n;var t=0;const r=this._wrappedText.GetLines(); if(0!==r.length){var w=this._isBBcodeEnabled&&this._SupportsFontBoundingBoxMeasurements(),y=r[0].height*n;"center"===this._verticalAlign?(t=r.reduce((C,D)=>C+D.height*n+q,0)-q,t=Math.max(this._height/2-t/2,0),w&&(y=r[0].topToAlphabeticDistance*n)):"bottom"===this._verticalAlign&&(t=r.reduce((C,D)=>C+D.height*n+q,0)-this._lineHeight*n,w=w?r.at(-1).fontBoundingBoxDescent*n:0,t=this._height-t-w-2);for(let C=0,D=r.length;C<D;++C){w=r[C];const G=w.height*n,K=t;if(this._isBBcodeEnabled){if(t+=0===C?y:G, 0<C&&t>this._height-4*n)break}else if(0<C&&t>=this._height-G)break;0<=K&&this._DrawTextLine(w,t,n);this._isBBcodeEnabled||(t+=G);t+=q}}}_DrawTextLine(n,q,t){let r=0;"center"===this._horizontalAlign?r=(this._width-n.width*t)/2:"right"===this._horizontalAlign&&(r=this._width-n.width*t);for(const w of n.fragments)this._DrawTextFragment(w,r,q,t,n.height),r+=w.width*t}_DrawTextFragment(n,q,t,r,w){const y=this._textContext,C=w/16;w=n.width*r;const D=n.height*r,G=n.height/16;var K=(4+this._lineHeight)*r, B=n.styles;n=n.text;if(-1!==this._drawMaxCharCount){if(this._drawCharCount>=this._drawMaxCharCount)return;this._drawCharCount+n.length>this._drawMaxCharCount&&(n=n.substr(0,this._drawMaxCharCount-this._drawCharCount),w=this._MeasureText(n,B).width*r);this._drawCharCount+=n.length}var A=this._GetStyleTag(B,"background");const F=this._HasStyleTag(B,"u"),J=this._HasStyleTag(B,"s");if((!e.IsStringAllWhitespace(n)||A||F||J)&&!this._HasStyleTag(B,"hide")){var L=this._GetStyleTag(B,"offsetx");q+=L?parseFloat(L.param)* r:0;L=this._GetStyleTag(B,"offsety");t+=L?parseFloat(L.param)*r:0;A&&(this._SetDrawCanvasColor(A.param),y.fillRect(q,t-D,w,D+K));K=this._GetStyleTag(B,"color");this._SetDrawCanvasColor(K?K.param:this._colorStr);A=this._GetStyleTag(B,"opacity");this._SetDrawCanvasOpacity(A?parseFloat(A.param)/100:1);A=(A=this._GetStyleTag(B,"linethickness"))?parseFloat(A.param):1;(L=this._HasStyleTag(B,"stroke"))&&this._SetDrawCanvasLineWith(.5*G*A*this._scaleFactor*this._zoom*self.devicePixelRatio);this._SetDrawFontString(this._GetFontString(!1, B));g(y,L,n,q,t,w);!L&&(this._SetDrawCanvasLineWith(.5*G*A*this._scaleFactor*this._zoom*self.devicePixelRatio),B=this._GetStyleTag(B,"outline"))&&(this._SetDrawCanvasColor(B.param),g(y,!0,n,q,t,w));this._SetDrawCanvasColor(K?K.param:this._colorStr);F&&k(y,L,q,t+r*C,w,r*C*A);J&&(r*=G,y.fillRect(q,t-D/4+r/2-r*A/2,w,r*A))}}_UpdateTexture(){if(!this._renderer.IsContextLost()&&(this._textureWidth=Math.ceil(this._width),this._textureHeight=Math.ceil(this._height),this._rcTex.set(0,0,this._width/this._textureWidth, this._height/this._textureHeight),this._needToRecreateTexture&&(this.ReleaseTexture(),this._needToRecreateTexture=!1),this._texture||(this._texture=this._renderer.CreateDynamicTexture(this._textureWidth,this._textureHeight,{mipMap:1===this._zoom,mipMapQuality:"high"})),this._renderer.UpdateTexture(this._textCanvas,this._texture),this.ontextureupdate))this.ontextureupdate()}GetTexRect(){return this._rcTex}ReleaseTexture(){this._texture&&(this._renderer.IsContextLost()||this._renderer.DeleteTexture(this._texture), this._texture=null)}static OnContextLost(){for(const n of l)n.ReleaseTexture()}static GetAll(){return l.values()}}} {"use strict";const e=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 d=this._gl.getParameter(this._timerExt.GPU_DISJOINT_EXT);a&&!d&&(this._result=1===this._version?this._timerExt.getQueryObjectEXT(this._query,this._timerExt.QUERY_RESULT_EXT):this._gl.getQueryParameter(this._query,this._gl.QUERY_RESULT),this._result/=1E9,this._hasResult=!0);(a|| d)&&this._DeleteQueryObject()}}HasResult(){return this._hasResult}GetResult(){if(!this._hasResult)throw Error("no result available");return this._result}}e.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();e.clearArray(this._queries);this._renderer=this._realQuery=this._parentQuery=null}BeginTimeElapsed(){if(this._isActive)throw Error("query already active"); const a=this._renderer._GetTimeQueryStack();0<a.length?(this._isNested=!0,this._parentQuery=a.at(-1),this._parentQuery._EndReal(),this._parentQuery._queries.push(this)):(this._isNested=!1,this._parentQuery=null);this._isActive=!0;a.push(this);this._StartReal()}EndTimeElapsed(){if(!this._isActive)throw Error("query not active");if(this._renderer._GetTimeQueryStack().pop()!==this)throw Error("can only end most nested query");this._isActive=!1;this._EndReal();this._parentQuery&&(this._parentQuery._StartReal(), this._parentQuery=null)}_StartReal(){this._realQuery=e.New(b,this._renderer);this._queries.push(this._realQuery);this._realQuery.BeginTimeElapsed()}_EndReal(){this._realQuery.EndTimeElapsed();this._realQuery=null}CheckForResult(){for(const a of this._queries)a.CheckForResult()}IsNested(){return this._isNested}HasResult(){return this._queries.every(a=>a.HasResult())}GetResult(){return this._queries.reduce((a,d)=>a+d.GetResult(),0)}GetFrameNumber(){return this._frameNumber}}} {"use strict";const e=self.C3;e.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();e.clearArray(this._buffer)}AddTimeElapsedQuery(){const b=new e.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 d=0;for(const c of this._buffer){if(c.GetFrameNumber()>=a)break;if(!(c.GetFrameNumber()<b))if(c.HasResult())d+=c.GetResult();else return NaN}return d}DeleteAllBeforeFrameNumber(b){for(let a=0,d=this._buffer.length;a<d;++a){const c=this._buffer[a];if(c.GetFrameNumber()<b)c.Release();else{0<a&&this._buffer.splice(0,a);break}}}}} {"use strict";const e=self.C3,b=self.glMatrix,a=b.vec4,d=b.mat4,c={powerPreference:"default",enableGpuProfiling:!0,alpha:!1,lowLatency:!1,depth:!1,maxWebGLVersion:2,failIfMajorPerformanceCaveat:!1},f=new Set(["default","low-power","high-performance"]),l=new e.Quad(0,0,1,0,1,1,0,1),g=d.create(),k=d.create(),m=new e.Quad,u=new e.Rect;let x=null;e.isDebug&&(self.debug_lose_context=function(){x?x.loseContext():console.warn("WEBGL_lose_context not supported")},self.debug_restore_context=function(){x?x.restoreContext(): console.warn("WEBGL_lose_context not supported")});const n=new Set;let q=-1;function t(){q=-1;for(const r of n)r.checkFunc()&&(r.resolve(),n.delete(r));0<n.size&&(q=self.requestAnimationFrame(t))}e.Gfx.WebGLRenderer=class extends e.Gfx.RendererBase{constructor(r,w){super();w=Object.assign({},c,w);if(!f.has(w.powerPreference))throw Error("invalid power preference");const y={alpha:!!w.alpha,depth:!1,antialias:!1,powerPreference:w.powerPreference,failIfMajorPerformanceCaveat:!!w.failIfMajorPerformanceCaveat}; w.lowLatency&&(y.desynchronized=!0,y.preserveDrawingBuffer=!0);let C=null,D=0;2<=w.maxWebGLVersion&&(C=r.getContext("webgl2",y),D=2);C||(C=r.getContext("webgl",y),D=1);if(!C)throw Error("failed to initialise WebGL context");this._gl=C;this._attribs=C.getContextAttributes();w.lowLatency&&!this._attribs.desynchronized&&console.info("[WebGLRenderer] Low-latency mode specified but is not supported here");this._versionString=C.getParameter(C.VERSION);this._version=D;this._viewport=a.create();this._bbProjectionMatrix= d.create();this._isDepthEnabled=this._usesDepthBuffer=!!w.depth;this._depthBuffer=null;this._isAutoSizeDepthBuffer=!0;this._depthBufferHeight=this._depthBufferWidth=0;this._pointBuffer=this._indexBuffer=this._texcoordBuffer=this._vertexBuffer=null;this._vertexData=new Float32Array(8E3*this.GetNumVertexComponents());this._indexData=new Uint16Array(12E3);this._texcoordData=new Float32Array(16E3);this._pointData=new Float32Array(32E3);this._lastVertexPtr=this._pointPtr=this._texPtr=this._vertexPtr=0; this._spDeviceTransformTextureFill=this._lastProgram=null;this._batch=[];this._topOfBatch=this._batchPtr=0;this._currentRenderTarget=null;this._lastPointZ=0;this._batchState=e.New(e.Gfx.BatchState,this);this._lastColor=e.New(e.Color,1,1,1,1);this._lastTexture1=this._lastTexture0=null;this._lastDestBlend=this._lastSrcBlend=0;this._isScissorViewport=!1;this._viewportScissorHeight=this._viewportScissorWidth=-1;this._lastPointTexCoords=new e.Rect;this._maxTextureSize=-1;this._highpPrecision=this._maxPointSize= this._minPointSize=0;this._unmaskedRenderer=this._unmaskedVendor="(unavailable)";this._extensions=[];this._isInitialisingAfterContextRestored=!1;this._anisotropicExt=this._parallelShaderCompileExt=null;this._maxAnisotropy=0;this._isGpuProfilingEnabled=!!w.enableGpuProfiling;this._timerExt=null;this._allQueryResultBuffers=new Set;this._timeQueryStack=[];this.FillIndexBufferData(this._indexData)}IsWebGL(){return!0}async InitState(){super.InitState();var r=this._gl,w=this.GetNumVertexComponents();this._lastColor.setRgba(1, 1,1,1);this._lastTexture1=this._lastTexture0=null;this._pointPtr=this._vertexPtr=0;this._lastVertexPtr=8E3*w-4*w;e.clearArray(this._batch);this._topOfBatch=this._batchPtr=0;this._currentRenderTarget=this._lastProgram=null;this._lastPointTexCoords.set(0,0,1,1);this._lastPointZ=0;w=this._batchState;w.currentShader=null;w.currentFramebuffer=null;a.set(w.currentColor,1,1,1,1);w.clearColor.setRgba(0,0,0,0);w.pointTexCoords.set(0,0,1,1);r.clearColor(0,0,0,0);r.clear(r.COLOR_BUFFER_BIT);r.enable(r.BLEND); r.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA);this._lastSrcBlend=r.ONE;this._lastDestBlend=r.ONE_MINUS_SRC_ALPHA;this._InitBlendModes(r);r.disable(r.CULL_FACE);r.disable(r.STENCIL_TEST);r.disable(r.DITHER);this._usesDepthBuffer?(r.enable(r.DEPTH_TEST),r.depthMask(!0),r.depthFunc(r.LEQUAL)):(r.disable(r.DEPTH_TEST),r.depthMask(!1));this._isDepthEnabled=this._usesDepthBuffer;this._pointBuffer=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,this._pointBuffer);r.bufferData(r.ARRAY_BUFFER,this._pointData.byteLength, r.DYNAMIC_DRAW);this._vertexBuffer=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,this._vertexBuffer);r.bufferData(r.ARRAY_BUFFER,this._vertexData.byteLength,r.DYNAMIC_DRAW);this._texcoordBuffer=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,this._texcoordBuffer);r.bufferData(r.ARRAY_BUFFER,this._texcoordData.byteLength,r.DYNAMIC_DRAW);this._indexBuffer=r.createBuffer();r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,this._indexBuffer);r.bufferData(r.ELEMENT_ARRAY_BUFFER,this._indexData,r.STATIC_DRAW);r.activeTexture(r.TEXTURE0); r.bindTexture(r.TEXTURE_2D,null);this._maxTextureSize=r.getParameter(r.MAX_TEXTURE_SIZE);w=r.getParameter(r.ALIASED_POINT_SIZE_RANGE);this._minPointSize=w[0];this._maxPointSize=w[1];w=r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT);const y=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);this._highpPrecision=w&&y?Math.min(w.precision,y.precision):0;2048<this._maxPointSize&&(this._maxPointSize=2048);this._extensions=r.getSupportedExtensions();if(w=r.getExtension("WEBGL_debug_renderer_info"))this._unmaskedVendor= r.getParameter(w.UNMASKED_VENDOR_WEBGL),this._unmaskedRenderer=r.getParameter(w.UNMASKED_RENDERER_WEBGL);this._parallelShaderCompileExt=r.getExtension("KHR_parallel_shader_compile");e.isDebug&&(x=r.getExtension("WEBGL_lose_context"));if(this._isGpuProfilingEnabled)if(1===this.GetWebGLVersionNumber()){if("Chromium"!==e.Platform.BrowserEngine||81<=e.Platform.BrowserVersionNumber||"undefined"!==typeof document)this._timerExt=r.getExtension("EXT_disjoint_timer_query")}else this._timerExt=r.getExtension("EXT_disjoint_timer_query_webgl2")|| r.getExtension("EXT_disjoint_timer_query");this._maxAnisotropy=(this._anisotropicExt=r.getExtension("EXT_texture_filter_anisotropic"))?r.getParameter(this._anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0;r=e.Gfx.WebGLShaderProgram;w=r.GetDefaultVertexShaderSource(!1);r=[[r.GetTextureFillFragmentShaderSource(),w,"<default>"],[r.GetTextureFillFragmentShaderSource(),w,"<default-device-transform>"],[r.GetPointFragmentShaderSource(this._version),r.GetPointVertexShaderSource(this._version),"<point>"], [r.GetColorFillFragmentShaderSource(),w,"<fill>"],[r.GetLinearGradientFillFragmentShaderSource(),w,"<lineargradient>"],[r.GetHardEllipseFillFragmentShaderSource(),w,"<hardellipse>"],[r.GetHardEllipseOutlineFragmentShaderSource(),w,"<hardellipseoutline>"],[r.GetSmoothEllipseFillFragmentShaderSource(),w,"<smoothellipse>"],[r.GetSmoothEllipseOutlineFragmentShaderSource(),w,"<smoothellipseoutline>"],[r.GetSmoothLineFillFragmentShaderSource(),w,"<smoothline>"],[r.GetTilemapFragmentShaderSource(),r.GetDefaultVertexShaderSource(!0), "<tilemap>"]];r=await Promise.all(r.map(C=>this.CreateShaderProgram({src:C[0]},C[1],C[2])));this._spTextureFill=r[0];this._spDeviceTransformTextureFill=r[1];this._spPoints=r[2];this._spColorFill=r[3];this._spLinearGradientFill=r[4];this._spHardEllipseFill=r[5];this._spHardEllipseOutline=r[6];this._spSmoothEllipseFill=r[7];this._spSmoothEllipseOutline=r[8];this._spSmoothLineFill=r[9];this._spTilemapFill=r[10];this.SetTextureFillMode()}async CreateShaderProgram(r,w,y){r=await e.Gfx.WebGLShaderProgram.Create(this, r,w,y);this._AddShaderProgram(r);return r}ResetLastProgram(){this._lastProgram=null}SetSize(r,w,y){if(this._width!==r||this._height!==w||y){this.EndBatch();y=this._gl;var C=this._batchState;this._width=r;this._height=w;r=this.GetScissoredViewportWidth();w=this.GetScissoredViewportHeight();this._SetViewport(0,0,r,w);this.CalculatePerspectiveMatrix(this._bbProjectionMatrix,r/w);this.SetProjectionMatrix(this._bbProjectionMatrix);this._spDeviceTransformTextureFill&&(y.useProgram(this._spDeviceTransformTextureFill.GetShaderProgram()), this._spDeviceTransformTextureFill._UpdateDeviceTransformUniforms(this._matP),this._lastProgram=this._spDeviceTransformTextureFill,this._batchState.currentShader=this._spDeviceTransformTextureFill);y.bindTexture(y.TEXTURE_2D,null);y.activeTexture(y.TEXTURE1);y.bindTexture(y.TEXTURE_2D,null);y.activeTexture(y.TEXTURE0);this._lastTexture1=this._lastTexture0=null;this._usesDepthBuffer&&this._isAutoSizeDepthBuffer&&this._SetDepthBufferSize(this._width,this._height);this._currentRenderTarget&&this._currentRenderTarget._Resize(this._width, this._height);y.bindFramebuffer(y.FRAMEBUFFER,null);this._currentRenderTarget=null;C.currentFramebuffer=null}}_SetDepthBufferSize(r,w){const y=this._gl;if(this._depthBuffer){if(this._depthBufferWidth===r&&this._depthBufferHeight===w)return;y.deleteRenderbuffer(this._depthBuffer)}this._depthBuffer=y.createRenderbuffer();y.bindRenderbuffer(y.RENDERBUFFER,this._depthBuffer);y.renderbufferStorage(y.RENDERBUFFER,2<=this._version?y.DEPTH24_STENCIL8:y.DEPTH_STENCIL,r,w);y.bindRenderbuffer(y.RENDERBUFFER, null);this._depthBufferWidth=r;this._depthBufferHeight=w}SetFixedSizeDepthBuffer(r,w){this._usesDepthBuffer&&(this._isAutoSizeDepthBuffer=!1,this._SetDepthBufferSize(r,w))}SetAutoSizeDepthBuffer(){this._usesDepthBuffer&&(this._isAutoSizeDepthBuffer=!0,this._SetDepthBufferSize(this._width,this._height))}SetViewportScissor(r,w){const y=this._gl;if(this._width===r&&this._height===w)this._isScissorViewport&&(this.EndBatch(),y.disable(y.SCISSOR_TEST),this._isScissorViewport=!1,this._viewportScissorHeight= this._viewportScissorWidth=-1,this.SetSize(this._width,this._height,!0));else if(this._isScissorViewport||(this.EndBatch(),y.enable(y.SCISSOR_TEST),this._isScissorViewport=!0),this._viewportScissorWidth!==r||this._viewportScissorHeight!==w)this.EndBatch(),y.scissor(0,0,r,w),this._viewportScissorWidth=r,this._viewportScissorHeight=w,this.SetSize(this._width,this._height,!0)}RemoveViewportScissor(){const r=this._gl;this._isScissorViewport&&(this.EndBatch(),r.disable(r.SCISSOR_TEST),this._isScissorViewport= !1);this._viewportScissorHeight=this._viewportScissorWidth=-1}GetScissoredViewportWidth(){return this._isScissorViewport?this._viewportScissorWidth:this.GetWidth()}GetScissoredViewportHeight(){return this._isScissorViewport?this._viewportScissorHeight:this.GetHeight()}_SetViewport(r,w,y,C){const D=this._viewport;if(D[0]!==r||D[1]!==w||D[2]!==y||D[3]!==C)this.PushBatch().InitSetViewport(r,w,y,C),a.set(D,r,w,y,C),this._topOfBatch=0}SetProjectionMatrix(r){d.exactEquals(this._matP,r)||(this.PushBatch().InitSetProjection(r), d.copy(this._matP,r),this._topOfBatch=0)}SetDefaultRenderTargetProjectionState(){let r,w;var y=this._currentRenderTarget;null===y||y.IsDefaultSize()&&this._isScissorViewport?(r=this._bbProjectionMatrix,w=this.GetScissoredViewportWidth(),y=this.GetScissoredViewportHeight()):(r=y.GetProjectionMatrix(),w=y.GetWidth(),y=y.GetHeight());this.SetProjectionMatrix(r);this._SetViewport(0,0,w,y)}SetModelViewMatrix(r){d.exactEquals(this._matMV,r)||(this.PushBatch().InitSetModelView(r),d.copy(this._matMV,r),this._topOfBatch= 0)}GetBatchState(){return this._batchState}PushBatch(){const r=this._batch;this._batchPtr===r.length&&r.push(new e.Gfx.WebGLBatchJob(this._batchState));return r[this._batchPtr++]}EndBatch(){0===this._batchPtr||this.IsContextLost()||(this._WriteBuffers(),this._ExecuteBatch(),this._topOfBatch=this._pointPtr=this._texPtr=this._vertexPtr=this._batchPtr=0)}_WriteBuffers(){const r=this._gl;0<this._pointPtr&&(r.bindBuffer(r.ARRAY_BUFFER,this._pointBuffer),r.bufferSubData(r.ARRAY_BUFFER,0,this._pointData.subarray(0, this._pointPtr)));0<this._vertexPtr&&(r.bindBuffer(r.ARRAY_BUFFER,this._vertexBuffer),r.bufferSubData(r.ARRAY_BUFFER,0,this._vertexData.subarray(0,this._vertexPtr)),r.bindBuffer(r.ARRAY_BUFFER,this._texcoordBuffer),r.bufferSubData(r.ARRAY_BUFFER,0,this._texcoordData.subarray(0,this._texPtr)))}_ExecuteBatch(){const r=this._batch;for(let w=0,y=this._batchPtr;w<y;++w)r[w].Run()}GetOpacity(){return this._lastColor.getA()}SetColorRgba(r,w,y,C){const D=this._lastColor;D.equalsRgba(r,w,y,C)||(D.setRgba(r, w,y,C),this.PushBatch().InitSetColor(D),this._topOfBatch=0,this._currentStateGroup=null)}SetOpacity(r){const w=this._lastColor;w.getA()!==r&&(w.setA(r),this.PushBatch().InitSetColor(w),this._topOfBatch=0,this._currentStateGroup=null)}SetColor(r){const w=this._lastColor;w.equals(r)||(w.set(r),this.PushBatch().InitSetColor(w),this._topOfBatch=0,this._currentStateGroup=null)}ResetColor(){this.SetColorRgba(1,1,1,1)}GetColor(){return this._lastColor}SetTexture(r){r!==this._lastTexture0&&(this.PushBatch().InitSetTexture(r), this._lastTexture0=r,this._topOfBatch=0)}_ResetLastTexture(){this._lastTexture0=null}SetBlendMode(r){r=this._GetBlendByIndex(r);this._SetBlend(r[0],r[1])}SetNamedBlendMode(r){r=this.GetNamedBlend(r);this._SetBlend(r.srcBlend,r.destBlend)}_SetBlend(r,w){if(r!==this._lastSrcBlend||w!==this._lastDestBlend)this.PushBatch().InitSetBlend(r,w),this._lastSrcBlend=r,this._lastDestBlend=w,this._topOfBatch=0,this._currentStateGroup=null}IsPremultipliedAlphaBlend(){return this._lastSrcBlend===this._gl.ONE&&this._lastDestBlend=== this._gl.ONE_MINUS_SRC_ALPHA}SetAlphaBlend(){this._SetBlend(this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA)}SetNoPremultiplyAlphaBlend(){this._SetBlend(this._gl.SRC_ALPHA,this._gl.ONE_MINUS_SRC_ALPHA)}SetCopyBlend(){this._SetBlend(this._gl.ONE,this._gl.ZERO)}Rect(r){this.Rect2(r.getLeft(),r.getTop(),r.getRight(),r.getBottom())}Rect2(r,w,y,C){this.Quad2(r,w,y,w,y,C,r,C)}_ExtendQuadBatch(){let r=this._vertexPtr;r>=this._lastVertexPtr&&(this.EndBatch(),r=0);1===this._topOfBatch?this._batch[this._batchPtr- 1]._indexCount+=6:(this.PushBatch().InitQuad(r,6),this._topOfBatch=1)}_WriteQuadToVertexBuffer(r){r.writeToTypedArray3D(this._vertexData,this._vertexPtr,this._baseZ+this._currentZ);this._vertexPtr+=12}Quad(r){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(r);l.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad2(r,w,y,C,D,G,K,B){this._ExtendQuadBatch();const A=this._vertexData;let F=this._vertexPtr;const J=this._baseZ+this._currentZ;A[F++]=r;A[F++]=w;A[F++]=J;A[F++]=y;A[F++]= C;A[F++]=J;A[F++]=D;A[F++]=G;A[F++]=J;A[F++]=K;A[F++]=B;A[F++]=J;this._vertexPtr=F;l.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad3(r,w){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(r);w.writeAsQuadToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad4(r,w){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(r);w.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad3D(r,w,y,C,D,G,K,B,A,F,J,L,Q){this._ExtendQuadBatch();const T=this._vertexData; let V=this._vertexPtr;const aa=this._baseZ+this._currentZ;T[V++]=r;T[V++]=w;T[V++]=aa+y;T[V++]=C;T[V++]=D;T[V++]=aa+G;T[V++]=K;T[V++]=B;T[V++]=aa+A;T[V++]=F;T[V++]=J;T[V++]=aa+L;this._vertexPtr=V;Q.writeAsQuadToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad3D2(r,w,y,C,D,G,K,B,A,F,J,L,Q){this._ExtendQuadBatch();const T=this._vertexData;let V=this._vertexPtr;const aa=this._baseZ+this._currentZ;T[V++]=r;T[V++]=w;T[V++]=aa+y;T[V++]=C;T[V++]=D;T[V++]=aa+G;T[V++]=K;T[V++]=B;T[V++]=aa+ A;T[V++]=F;T[V++]=J;T[V++]=aa+L;this._vertexPtr=V;Q.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}FullscreenQuad(r,w){d.copy(g,this._matP);d.copy(k,this._matMV);this.SetDefaultRenderTargetProjectionState();if(this._isScissorViewport){r=this.CalculateLookAtModelView2(0,0,this.GetDefaultCameraZ()*self.devicePixelRatio,0,0,0);this.SetModelViewMatrix(r);r=this._viewportScissorWidth/2;var y=this._viewportScissorHeight/2;u.set(-r,y,-r+this._viewportScissorWidth,y-this._viewportScissorHeight); m.setFromRect(u);u.set(0,0,this._viewportScissorWidth/this._width,this._viewportScissorHeight/this._height);this.Quad3(m,u)}else{const [G,K]=this.GetRenderTargetSize(this._currentRenderTarget);y=this.CalculateLookAtModelView2(0,0,this.GetDefaultCameraZ()*self.devicePixelRatio,0,0,0,K);this.SetModelViewMatrix(y);if("crop"===r&&this._currentRenderTarget&&w){r=this._width/2;y=this._height/2;const B=w.GetWidth();w=w.GetHeight();var C=this._currentRenderTarget.GetWidth(),D=this._currentRenderTarget.GetHeight(); C=Math.min(C,B);const A=Math.min(D,w),F=Math.max(w-D,0);D=Math.max(D-w,0);u.set(-r,y-D,-r+C,y-A-D);m.setFromRect(u);u.set(0,F,C,A+F);u.divide(B,w);this.Quad3(m,u)}else r=G/2,y=K/2,this.Rect2(-r,y,r,-y)}this.SetProjectionMatrix(g);this.SetModelViewMatrix(k)}StartRenderingPoints(r){this._lastPointTexCoords.equals(r)||(this._lastPointTexCoords.copy(r),this.PushBatch().InitSetPointTexCoords(r),this._topOfBatch=0)}FinishRenderingPoints(){}Point(r,w,y,C){7996<=this._pointPtr&&this.EndBatch();let D=this._pointPtr; var G=this._baseZ+this._currentZ;2===this._topOfBatch&&this._lastPointZ===G?this._batch[this._batchPtr-1]._indexCount++:(this.PushBatch().InitPoints(D,G),this._topOfBatch=2,this._lastPointZ=G);G=this._pointData;G[D++]=r;G[D++]=w;G[D++]=y;G[D++]=C;this._pointPtr=D}SetProgram(r){this._lastProgram!==r&&(this.PushBatch().InitSetProgram(r),this._lastProgram=r,this._topOfBatch=0,this._currentStateGroup=null)}SetDeviceTransformTextureFillMode(){this.SetProgram(this._spDeviceTransformTextureFill)}SetGradientColor(r){this.PushBatch().InitSetGradientColor(r); this._topOfBatch=0}SetEllipseParams(r,w,y=1){this.PushBatch().InitSetEllipseParams(r,w,y);this._topOfBatch=0}SetTilemapInfo(r,w,y,C,D,G,K){if(this._lastProgram!==this._spTilemapFill)throw Error("must set tilemap fill mode first");this.PushBatch().InitSetTilemapInfo(r,w,y,C,D,G,K);this._topOfBatch=0}SetProgramParameters(r,w,y,C,D,G,K,B,A,F,J){const L=this._lastProgram;var Q=L._hasAnyOptionalUniforms;const T=!!J.length;if(Q&&!L.AreOptionalUniformsAlreadySetInBatch(w,y,C,D,G,K,B,A,F)||T&&!L.AreCustomParametersAlreadySetInBatch(J)){var V= this.PushBatch();V.InitSetProgramParameters();Q&&(L.SetOptionalUniformsInBatch(w,y,C,D,G,K,B,A,F),Q=V._mat4param,Q[0]=G,Q[1]=K,w.writeToTypedArray(Q,2),Q[6]=B,Q[7]=A,y.writeToTypedArray(Q,12),w=V._colorParam,D.writeToTypedArray(w,0),D=w[1],w[1]=w[3],w[3]=D,C.writeToTypedArray(V._srcOriginRect,0),V._startIndex=F,L._uSamplerBack.IsUsed()?V._texParam=r?r.GetTexture():null:V._texParam=null);T&&(L.SetCustomParametersInBatch(J),e.shallowAssignArray(V._shaderParams,J));this._topOfBatch=0}}ClearRgba(r,w, y,C){this.PushBatch().InitClearSurface2(r,w,y,C);this._topOfBatch=0}Clear(r){this.PushBatch().InitClearSurface(r);this._topOfBatch=0}ClearRect(r,w,y,C){this.ClearRect4(r,w,y,C,0,0,0,0)}ClearRect2(r){this.ClearRect4(r.getLeft(),r.getTop(),r.width(),r.height(),0,0,0,0)}ClearRect3(r,w){this.ClearRect4(r.getLeft(),r.getTop(),r.width(),r.height(),w.getR(),w.getG(),w.getB(),w.getA())}ClearRect4(r,w,y,C,D,G,K,B){0>y||0>C||(this.PushBatch().InitClearRect(r,w,y,C,D,G,K,B),this._topOfBatch=0)}Start(){}Finish(){super.Finish(); this._gl.flush()}ClearDepth(){this._usesDepthBuffer&&this._currentRenderTarget&&this._currentRenderTarget.HasDepthBuffer()&&(this.PushBatch().InitClearDepth(),this._topOfBatch=0)}SetDepthEnabled(r){r=!!r;this._isDepthEnabled!==r&&this._usesDepthBuffer&&(this._isDepthEnabled=r,this.PushBatch().InitSetDepthEnabled(r),this._topOfBatch=0)}_GetDepthBuffer(){return this._depthBuffer}CheckForQueryResults(){for(const r of this._allQueryResultBuffers)r.CheckForResults(this._frameNumber)}IsContextLost(){return!this._gl|| this._gl.isContextLost()||this._isInitialisingAfterContextRestored}OnContextLost(){super.OnDeviceOrContextLost();e.Gfx.WebGLRendererTexture.OnContextLost();e.Gfx.WebGLRenderTarget.OnContextLost();e.Gfx.RendererText.OnContextLost();for(const r of this._allQueryResultBuffers)r.Clear();this._extensions=[];this._anisotropicExt=this._parallelShaderCompileExt=this._timerExt=null;this._maxAnisotropy=0;this._unmaskedRenderer=this._unmaskedVendor="(unavailable)";this._depthBuffer=this._spDeviceTransformTextureFill= this._lastProgram=null;for(const r of this._stateGroups.values())r.OnContextLost()}async OnContextRestored(){this._isInitialisingAfterContextRestored=!0;await this.InitState();this._isInitialisingAfterContextRestored=!1;for(const r of this._stateGroups.values())r.OnContextRestored(this);this.SetSize(this._width,this._height,!0)}CreateStaticTexture(r,w){if(this.IsContextLost())throw Error("context lost");this.EndBatch();const y=e.New(e.Gfx.WebGLRendererTexture,this);y._CreateStatic(r,w);return y}CreateStaticTextureAsync(r, w){if(this.IsContextLost())return Promise.reject("context lost");w=Object.assign({},w);const y=w.wrapX&&"clamp-to-edge"!==w.wrapX||w.wrapY&&"clamp-to-edge"!==w.wrapY;if(!e.Supports.ImageBitmapOptions||!this.SupportsNPOTTextures()&&y)return e.Supports.ImageBitmap?createImageBitmap(r).then(C=>e.Asyncify(()=>this.CreateStaticTexture(C,w))):r instanceof Blob?e.BlobToImage(r,!0).then(C=>this.CreateStaticTextureAsync(C,w)):"undefined"!==typeof HTMLImageElement&&r instanceof HTMLImageElement&&"function"=== typeof r.decode?r.decode().then(()=>e.Asyncify(()=>this.CreateStaticTexture(r,w))):e.Asyncify(()=>this.CreateStaticTexture(r,w));w.premultiplyAlpha=!1;return createImageBitmap(r,{premultiplyAlpha:"premultiply"}).then(C=>e.Asyncify(()=>this.CreateStaticTexture(C,w)))}CreateDynamicTexture(r,w,y){this.EndBatch();const C=e.New(e.Gfx.WebGLRendererTexture,this);C._CreateDynamic(r,w,y);return C}UpdateTexture(r,w,y){this.EndBatch();w._Update(r,y)}DeleteTexture(r){r&&(r.SubtractReference(),0<r.GetReferenceCount()|| (this.EndBatch(),r===this._lastTexture0&&(this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._lastTexture0=null),r===this._lastTexture1&&(this._gl.activeTexture(this._gl.TEXTURE1),this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._gl.activeTexture(this._gl.TEXTURE0),this._lastTexture1=null),r._Delete()))}CreateRenderTarget(r){let w=this._width,y=this._height,C=!0;r&&("number"===typeof r.width&&(w=r.width,C=!1),"number"===typeof r.height&&(y=r.height,C=!1));if(0>=w||0>=y)throw Error("invalid size"); this.EndBatch();const D=e.New(e.Gfx.WebGLRenderTarget,this);D._Create(w,y,Object.assign({isDefaultSize:C},r));this._currentRenderTarget=null;this._batchState.currentFramebuffer=null;return D}SetRenderTarget(r){r!==this._currentRenderTarget&&(r&&r.IsDefaultSize()&&r._Resize(this._width,this._height),this.PushBatch().InitSetRenderTarget(r),this._currentRenderTarget=r,this._topOfBatch=0,this.SetDefaultRenderTargetProjectionState())}GetRenderTarget(){return this._currentRenderTarget}GetRenderTargetSize(r){return r? [r.GetWidth(),r.GetHeight()]:[this._width,this._height]}CopyRenderTarget(r,w="stretch"){2>this._version||this._currentRenderTarget&&0<this._currentRenderTarget.GetMultisampling()?(this.SetCopyBlend(),this.ResetColor(),this.DrawRenderTarget(r,w)):(this.PushBatch().InitBlitFramebuffer(r,this._currentRenderTarget,w),this._topOfBatch=0)}DrawRenderTarget(r,w="stretch"){r=r.GetTexture();if(!r)throw Error("not a texture-backed render target");this.SetTexture(r);this.FullscreenQuad(w,r)}InvalidateRenderTarget(r){2> this._version||(this.PushBatch().InitInvalidateFramebuffer(r._GetFramebuffer()),this._topOfBatch=0)}DeleteRenderTarget(r){this.SetRenderTarget(null);this.EndBatch();const w=r.GetTexture();w===this._lastTexture0&&(this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._lastTexture0=null);w===this._lastTexture1&&(this._gl.activeTexture(this._gl.TEXTURE1),this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._gl.activeTexture(this._gl.TEXTURE0),this._lastTexture1=null);r._Delete()}async ReadBackRenderTargetToImageData(r, w,y){this.EndBatch();const C=this._currentRenderTarget;if(r){var D=r.GetWidth();var G=r.GetHeight();var K=r._GetFramebuffer()}else D=this.GetWidth(),G=this.GetHeight(),K=null;let B=r=0;var A=D,F=G;y&&(r=e.clamp(Math.floor(y.getLeft()),0,D-1),B=e.clamp(Math.floor(y.getTop()),0,G-1),A=y.width(),A=0===A?D-r:e.clamp(Math.floor(A),0,D-r),F=y.height(),F=0===F?G-B:e.clamp(Math.floor(F),0,G-B),B=G-(B+F));const J=this._gl;J.bindFramebuffer(J.FRAMEBUFFER,K);G=()=>{J.bindFramebuffer(J.FRAMEBUFFER,null);this._currentRenderTarget= null;this._batchState.currentFramebuffer=null;this.SetRenderTarget(C)};if(!w&&2<=this.GetWebGLVersionNumber()){J.bindFramebuffer(J.READ_FRAMEBUFFER,K);K=J.createBuffer();y=A*F*4;D=J.PIXEL_PACK_BUFFER;J.bindBuffer(D,K);J.bufferData(D,y,J.STREAM_READ);J.readPixels(r,B,A,F,J.RGBA,J.UNSIGNED_BYTE,0);J.bindFramebuffer(J.READ_FRAMEBUFFER,null);J.bindBuffer(D,null);G();const L=J.fenceSync(J.SYNC_GPU_COMMANDS_COMPLETE,0);await this._WaitForObjectReady(()=>J.getSyncParameter(L,J.SYNC_STATUS)===J.SIGNALED); J.deleteSync(L);w=new ImageData(A,F);J.bindBuffer(D,K);J.getBufferSubData(D,0,new Uint8Array(w.data.buffer),0,y);J.bindBuffer(D,null);J.deleteBuffer(K)}else w=new ImageData(A,F),J.readPixels(r,B,A,F,J.RGBA,J.UNSIGNED_BYTE,new Uint8Array(w.data.buffer)),G();return w}CoplanarStartStencilPass(){this.SetDepthEnabled(!0);this.PushBatch().InitCoplanarStartStencilPass();this._topOfBatch=0}CoplanarStartColorPass(){this.SetDepthEnabled(!1);this.PushBatch().InitCoplanarStartColorPass();this._topOfBatch=0}CoplanarRestoreStandardRendering(){this.SetDepthEnabled(!0); this.PushBatch().InitCoplanarRestore();this._topOfBatch=0}StartQuery(r){this.SupportsGPUProfiling()&&(this.PushBatch().InitStartQuery(r),this._topOfBatch=0)}EndQuery(r){this.SupportsGPUProfiling()&&(this.PushBatch().InitEndQuery(r),this._topOfBatch=0)}_WaitForObjectReady(r){const w=new Promise(y=>n.add({resolve:y,checkFunc:r}));-1===q&&(q=self.requestAnimationFrame(t));return w}IsDesynchronized(){return!!this._attribs.desynchronized}GetEstimatedBackBufferMemoryUsage(){return this._width*this._height* (this._attribs.alpha?4:3)}GetEstimatedRenderBufferMemoryUsage(){let r=0;for(const w of e.Gfx.WebGLRenderTarget.allRenderTargets())w.GetTexture()||(r+=w.GetEstimatedMemoryUsage());return r}GetEstimatedTextureMemoryUsage(){let r=0;for(const w of e.Gfx.WebGLRendererTexture.allTextures())r+=w.GetEstimatedMemoryUsage();return r}GetEstimatedTotalMemoryUsage(){return this.GetEstimatedBackBufferMemoryUsage()+this.GetEstimatedRenderBufferMemoryUsage()+this.GetEstimatedTextureMemoryUsage()}GetWebGLVersionString(){return this._versionString}GetWebGLVersionNumber(){return this._version}GetDisplayName(){return"webgl"+ this.GetWebGLVersionNumber()}SupportsNPOTTextures(){return 2<=this.GetWebGLVersionNumber()}GetMaxTextureSize(){return this._maxTextureSize}GetMinPointSize(){return this._minPointSize}GetMaxPointSize(){return this._maxPointSize}SupportsHighP(){return 0!==this._highpPrecision}GetHighPPrecision(){return this._highpPrecision}GetUnmaskedVendor(){return this._unmaskedVendor}GetUnmaskedRenderer(){return this._unmaskedRenderer}GetExtensions(){return this._extensions}SupportsGPUProfiling(){return!!this._timerExt}_GetDisjointTimerQueryExtension(){return this._timerExt}_GetParallelShaderCompileExtension(){return this._parallelShaderCompileExt}_GetAnisotropicExtension(){return this._anisotropicExt}_GetMaxAnisotropy(){return this._maxAnisotropy}_AddQueryResultBuffer(r){this._allQueryResultBuffers.add(r)}_RemoveQueryResultBuffer(r){this._allQueryResultBuffers.delete(r)}_GetTimeQueryStack(){return this._timeQueryStack}GetContext(){return this._gl}_InitBlendModes(r){this._InitBlendModeData([["normal", r.ONE,r.ONE_MINUS_SRC_ALPHA],["additive",r.ONE,r.ONE],["xor",r.ONE,r.ONE_MINUS_SRC_ALPHA],["copy",r.ONE,r.ZERO],["destination-over",r.ONE_MINUS_DST_ALPHA,r.ONE],["source-in",r.DST_ALPHA,r.ZERO],["destination-in",r.ZERO,r.SRC_ALPHA],["source-out",r.ONE_MINUS_DST_ALPHA,r.ZERO],["destination-out",r.ZERO,r.ONE_MINUS_SRC_ALPHA],["source-atop",r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],["destination-atop",r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA]])}CreateRendererText(){return e.New(e.Gfx.RendererText,this)}CreateWebGLText(){return this.CreateRendererText()}}} {"use strict";const e=self.C3,b=self.C3X;let a=null;const d=new Set;function c(k,m){const u=k[0]-m[0];return 0!==u?u:k[1]-m[1]}const f=[],l=[];let g=!1;self.IRuntime=class{constructor(k,m){a=k;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=>{d.has(u.key)?u.stopPropagation():d.add(u.key)});a.UserScriptDispatcher().addEventListener("keyup",u=>d.delete(u.key));a.Dispatcher().addEventListener("window-blur",()=>d.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(k){Object.defineProperties(this.globalVars,k)}addEventListener(k,m){a.UserScriptDispatcher().addEventListener(k,m)}removeEventListener(k,m){a.UserScriptDispatcher().removeEventListener(k,m)}callFunction(k,...m){b.RequireString(k);const u=a.GetEventSheetManager(),x=u.GetFunctionBlockByName(k);if(!x)throw Error(`cannot find function name '${k}'`);if(!x.IsEnabled())return x.GetDefaultReturnValue();if(m.length<x.GetFunctionParameterCount())throw Error(`not enough function parameters passed for '${k}' (${m.length} passed, ${x.GetFunctionParameterCount()} expected)`); const n=x.GetEventBlock();k=null;var q=u.GetCurrentEvent();q&&(q=q.GetSolModifiersIncludingParents(),0<q.length&&(k=q,u.PushCleanSol(q)));m=n.RunAsExpressionFunctionCall(n.GetSolModifiersIncludingParents(),x.GetReturnType(),x.GetDefaultReturnValue(),...m);k&&u.PopSol(k);return m}setReturnValue(k){const m=a.GetEventStack().GetCurrentExpFuncStackFrame();if(!m)throw Error("not in a function which returns a value");switch(m.GetFunctionReturnType()){case 1:"number"===typeof k&&m.SetFunctionReturnValue(k); break;case 2:"string"===typeof k&&m.SetFunctionReturnValue(k);break;case 3:"number"!==typeof k&&"string"!==typeof k||m.SetFunctionReturnValue(k)}}get dt(){return a.GetDt()}get gameTime(){return a.GetGameTime()}get wallTime(){return a.GetWallTime()}random(){return a.Random()}get layout(){return a.GetMainRunningLayout().GetILayout()}getLayout(k){const m=a.GetLayoutManager();if("number"===typeof k||"string"===typeof k)k=m.GetLayout(k);else throw new TypeError("expected string or number");if(!k)throw Error("invalid layout"); return k.GetILayout()}getAllLayouts(){return a.GetLayoutManager().GetAllLayouts().map(k=>k.GetILayout())}goToLayout(k){const m=a.GetLayoutManager();if("number"===typeof k||"string"===typeof k)k=m.GetLayout(k);else throw new TypeError("expected string or number");if(!k)throw Error("invalid layout");m.IsPendingChangeMainLayout()||m.ChangeMainLayout(k)}get keyboard(){const k=a._GetCommonScriptInterfaces().keyboard;if(!k)throw Error("runtime.keyboard used but Keyboard object missing - add it to your project first"); return k}get mouse(){const k=a._GetCommonScriptInterfaces().mouse;if(!k)throw Error("runtime.mouse used but Mouse object missing - add it to your project first");return k}get touch(){const k=a._GetCommonScriptInterfaces().touch;if(!k)throw Error("runtime.touch used but Touch object missing - add it to your project first");return k}invokeDownload(k,m){b.RequireString(k);b.RequireString(m);a.InvokeDownload(k,m)}getInstanceByUid(k){b.RequireFiniteNumber(k);return(k=a.GetInstanceByUID(k))?k.GetInterfaceClass(): null}sortZOrder(k,m){b.RequireFunction(m);const u=a.GetCurrentLayout();for(var x of k){k=a._UnwrapIWorldInstance(x);var n=k.GetWorldInfo();f.push([n.GetLayer().GetIndex(),n.GetZIndex()]);l.push(k)}if(0!==f.length){f.sort(c);l.sort((q,t)=>m(q.GetInterfaceClass(),t.GetInterfaceClass()));x=!1;for(let q=0,t=f.length;q<t;++q){k=l[q];n=u.GetLayerByIndex(f[q][0]);const r=f[q][1],w=n._GetInstances();w[r]!==k&&(w[r]=k,k.GetWorldInfo()._SetLayer(n),n.SetZIndicesChanged(),x=!0)}x&&a.UpdateRender();e.clearArray(f); e.clearArray(l)}}alert(k){return a.PostComponentMessageToDOMAsync("runtime","alert",{message:k+(a.IsInWorker()?" [via Web Worker]":"")})}}} {"use strict";const e=self.C3;let b=null;self.IAssetManager=class{constructor(a){b=a;Object.defineProperties(this,{isWebMOpusSupported:{value:b.IsAudioFormatSupported("audio/webm; codecs=opus"),writable:!1}})}fetchText(a){return b.FetchText(a)}fetchJson(a){return b.FetchJson(a)}fetchBlob(a){return b.FetchBlob(a)}fetchArrayBuffer(a){return b.FetchArrayBuffer(a)}getProjectFileUrl(a){return b.GetProjectFileUrl(a)}getMediaFileUrl(a){e.IsRelativeURL(a)&&(a=a.toLowerCase());return b.GetMediaFileUrl(a,b.GetMediaSubfolder())}get mediaFolder(){return b.GetMediaSubfolder()}async decodeWebMOpus(a, d){if(this.isWebMOpusSupported)throw Error("decodeWebMOpus(): not supported because WebM Opus is supported by the platform");d=await b.GetRuntime()._WasmDecodeWebMOpus(d);d=new Float32Array(d);a=a.createBuffer(1,d.length,48E3);a.getChannelData(0).set(d);return a}loadScripts(...a){return b.LoadScripts(...a)}compileWebAssembly(a){return b.CompileWebAssembly(a)}loadStyleSheet(a){return b.LoadStyleSheet(a)}}} {"use strict";const e=self.C3X;self.IStorage=class{constructor(b){this._storage=b._GetProjectStorage()}getItem(b){e.RequireString(b);return this._storage.getItem(b)}setItem(b,a){e.RequireString(b);return this._storage.setItem(b,a)}removeItem(b){e.RequireString(b);return this._storage.removeItem(b)}clear(){return this._storage.clear()}keys(){return this._storage.keys()}}} {"use strict";const e=self.C3X,b=new WeakMap;self.IObjectClass=class{constructor(a){b.set(this,a);Object.defineProperties(this,{name:{value:a.GetName(),writable:!1}});a.GetRuntime()._MapScriptInterface(this,a)}addEventListener(a,d){e.RequireString(a);e.RequireFunction(d);b.get(this).UserScriptDispatcher().addEventListener(a,d)}removeEventListener(a,d){e.RequireString(a);e.RequireFunction(d);b.get(this).UserScriptDispatcher().removeEventListener(a,d)}getAllInstances(){return b.get(this).GetInstances().map(a=> a.GetInterfaceClass())}getFirstInstance(){const a=b.get(this).GetInstances();return 0<a.length?a[0].GetInterfaceClass():null}getPickedInstances(){return b.get(this).GetCurrentSol().GetInstances().map(a=>a.GetInterfaceClass())}getFirstPickedInstance(){const a=b.get(this).GetCurrentSol().GetInstances();return 0<a.length?a[0].GetInterfaceClass():null}*instances(){for(const a of b.get(this).GetInstances())yield a.GetInterfaceClass()}*pickedInstances(){for(const a of b.get(this).GetCurrentSol().GetInstances())yield a.GetInterfaceClass()}setInstanceClass(a){e.RequireFunction(a); if(0<b.get(this).GetInstanceCount())throw Error("setInstanceClass() called too late, because instances have already been created - call in runOnStartup");b.get(this)._SetUserScriptInstanceClass(a)}createInstance(a,d,c,f){e.RequireNumber(d);e.RequireNumber(c);if("number"!==typeof a&&"string"!==typeof a)throw new TypeError("invalid layer parameter");const l=b.get(this),g=l.GetRuntime();a=g.GetMainRunningLayout().GetLayer(a);if(!a)throw Error("invalid layer");d=g.CreateInstance(l,a,d,c,f);f&&a.SortAndAddInstancesByZIndex(d); f=g.GetEventSheetManager();f.BlockFlushingInstances(!0);d._TriggerOnCreatedOnSelfAndRelated();f.BlockFlushingInstances(!1);return d.GetInterfaceClass()}}} {"use strict";const e=self.C3X,b=new WeakMap;self.ILayout=class{constructor(a){b.set(this,a);const d=[],c=a.GetEffectList(),f=c.GetAllEffectTypes().length;for(let l=0;l<f;++l)d.push(new self.IEffectInstance(c,l));Object.defineProperties(this,{name:{value:a.GetName(),writable:!1},index:{value:a.GetIndex(),writable:!1},effects:{value:d,writable:!1}})}addEventListener(a,d){e.RequireString(a);e.RequireFunction(d);b.get(this).UserScriptDispatcher().addEventListener(a,d)}removeEventListener(a,d){e.RequireString(a); e.RequireFunction(d);b.get(this).UserScriptDispatcher().removeEventListener(a,d)}get width(){return b.get(this).GetWidth()}set width(a){b.get(this).SetWidth(a)}get height(){return b.get(this).GetHeight()}set height(a){b.get(this).SetHeight(a)}set scale(a){e.RequireFiniteNumber(a);b.get(this).SetScale(a)}get scale(){return b.get(this).GetScale()}set angle(a){e.RequireFiniteNumber(a);b.get(this).SetAngle(a)}get angle(){return b.get(this).GetAngle()}set scrollX(a){e.RequireNumber(a);b.get(this).SetScrollX(a)}get scrollX(){return b.get(this).GetScrollX()}set scrollY(a){e.RequireNumber(a); b.get(this).SetScrollY(a)}get scrollY(){return b.get(this).GetScrollY()}scrollTo(a,d){e.RequireNumber(a);e.RequireNumber(d);const c=b.get(this);c.SetScrollX(a);c.SetScrollY(d)}getLayer(a){const d=b.get(this);if("number"===typeof a||"string"===typeof a)a=d.GetLayer(a);else throw new TypeError("expected string or number");return a?a.GetILayer():null}getAllLayers(){return b.get(this).GetLayers().map(a=>a.GetILayer())}setVanishingPoint(a,d){e.RequireFiniteNumber(a);e.RequireFiniteNumber(d);b.get(this).SetVanishingPointXY(a, d)}getVanishingPoint(){return b.get(this)._GetVanishingPoint()}set projection(a){e.RequireString(a);const d=b.get(this);if("perspective"===a)d.SetPerspectiveProjection();else if("orthographic"===a)d.SetOrthographicProjection();else throw Error("invalid projection");}get projection(){return b.get(this).IsOrthographicProjection()?"orthographic":"perspective"}}} {"use strict";const e=self.C3,b=self.C3X,a=new WeakMap,d=new Map([["normal",0],["additive",1],["copy",3],["destination-over",4],["source-in",5],["destination-in",6],["source-out",7],["destination-out",8],["source-atop",9],["destination-atop",10]]),c=new Map([...d.entries()].map(l=>[l[1],l[0]])),f=e.New(e.Color);self.ILayer=class{constructor(l){a.set(this,l);const g=[],k=l.GetEffectList(),m=k.GetAllEffectTypes().length;for(let u=0;u<m;++u)g.push(new self.IEffectInstance(k,u));Object.defineProperties(this, {name:{value:l.GetName(),writable:!1},index:{value:l.GetIndex(),writable:!1},layout:{value:l.GetLayout().GetILayout(),writable:!1},effects:{value:g,writable:!1}})}static _Unwrap(l){return a.get(l)}get isVisible(){return a.get(this).IsVisible()}set isVisible(l){a.get(this).SetVisible(l)}get opacity(){return a.get(this).GetOpacity()}set opacity(l){l=e.clamp(+l,0,1);isNaN(l)||a.get(this).SetOpacity(l)}set scale(l){b.RequireFiniteNumber(l);a.get(this).SetOwnScale(l)}get scale(){return a.get(this).GetOwnScale()}set scaleRate(l){b.RequireFiniteNumber(l); a.get(this).SetScaleRate(l)}get scaleRate(){return a.get(this).GetScaleRate()}set angle(l){b.RequireFiniteNumber(l);a.get(this).SetAngle(l)}get angle(){return a.get(this).GetOwnAngle()}set parallaxX(l){b.RequireFiniteNumber(l);a.get(this).SetParallaxX(l)}get parallaxX(){return a.get(this).GetParallaxX()}set parallaxY(l){b.RequireFiniteNumber(l);a.get(this).SetParallaxY(l)}get parallaxY(){return a.get(this).GetParallaxY()}set zElevation(l){b.RequireFiniteNumber(l);a.get(this).SetZElevation(l)}get zElevation(){return a.get(this).GetZElevation()}set isTransparent(l){a.get(this).SetTransparent(l)}get isTransparent(){return a.get(this).IsTransparent()}set isForceOwnTexture(l){a.get(this).SetForceOwnTexture(l)}get isForceOwnTexture(){return a.get(this).IsForceOwnTexture()}set blendMode(l){b.RequireString(l); l=d.get(l);if("number"!==typeof l)throw Error("invalid blend mode");a.get(this).SetBlendMode(l)}get blendMode(){return c.get(a.get(this).GetBlendMode())}set backgroundColor(l){b.RequireArray(l);if(3>l.length)throw Error("expected 3 elements");f.setRgb(l[0],l[1],l[2]);l=a.get(this);const g=l.GetBackgroundColor();g.equalsIgnoringAlpha(f)||(g.copyRgb(f),l.GetRuntime().UpdateRender())}get backgroundColor(){const l=a.get(this).GetBackgroundColor();return[l.getR(),l.getG(),l.getB()]}set scrollX(l){b.RequireNumber(l); const g=a.get(this);g.SetOwnScrollPositionEnabled(!0);g.SetScrollX(l)}get scrollX(){return a.get(this).GetScrollX()}set scrollY(l){b.RequireNumber(l);const g=a.get(this);g.SetOwnScrollPositionEnabled(!0);g.SetScrollY(l)}get scrollY(){return a.get(this).GetScrollY()}scrollTo(l,g){b.RequireNumber(l);b.RequireNumber(g);const k=a.get(this);k.SetOwnScrollPositionEnabled(!0);k.SetScrollX(l);k.SetScrollY(g)}restoreScrollPosition(){a.get(this).SetOwnScrollPositionEnabled(!1)}getViewport(){return a.get(this).GetViewport().toDOMRect()}cssPxToLayer(l, g,k=0){b.RequireNumber(l);b.RequireNumber(g);b.RequireNumber(k);const m=a.get(this),u=m.GetRuntime();return m.CanvasCssToLayer(l-u.GetCanvasClientX(),g-u.GetCanvasClientY(),k)}layerToCssPx(l,g,k=0){b.RequireNumber(l);b.RequireNumber(g);b.RequireNumber(k);const m=a.get(this),u=m.GetRuntime(),[x,n]=m.LayerToCanvasCss(l,g,k);return[x+u.GetCanvasClientX(),n+u.GetCanvasClientY()]}}} {"use strict";const e=self.C3,b=self.C3X,a=new WeakMap,d=new WeakMap;function c(l){let g=d.get(l);if(g)return g;g=e.New(e.Event.Dispatcher);d.set(l,g);return g}let f=null;self.IInstance=class{constructor(){a.set(this,f);const l={runtime:{value:f.GetRuntime().GetIRuntime(),writable:!1},objectType:{value:f.GetObjectClass().GetIObjectClass(),writable:!1},uid:{value:f.GetUID(),writable:!1}};f._GetInstVarsScriptDescriptor(l);f._GetBehaviorsScriptDescriptor(l);Object.defineProperties(this,l);f.GetRuntime()._MapScriptInterface(this, f)}static _Init(l){f=l}static _GetInitInst(){return f}_Release(){const l=d.get(this);l&&(l.Release(),d.delete(this));a.delete(this)}addEventListener(l,g,k){b.RequireString(l);b.RequireFunction(g);c(this).addEventListener(l,g,k)}removeEventListener(l,g,k){b.RequireString(l);b.RequireFunction(g);c(this).removeEventListener(l,g,k)}dispatchEvent(l){c(this).dispatchEvent(l)}destroy(){const l=a.get(this);l.GetRuntime().DestroyInstance(l)}}} {"use strict";const e=self.C3,b=self.C3X,a=self.IInstance,d=self.ILayer,c=new WeakMap,f=new Map([["normal",0],["additive",1],["copy",3],["destination-over",4],["source-in",5],["destination-in",6],["source-out",7],["destination-out",8],["source-atop",9],["destination-atop",10]]),l=new Map([...f.entries()].map(k=>[k[1],k[0]])),g=e.New(e.Color);self.IWorldInstance=class k extends a{constructor(){super();var m=a._GetInitInst();c.set(this,m);const u=[];var x=m.GetWorldInfo();if(m=x.GetInstanceEffectList()){x= x.GetObjectClass().GetEffectList().GetAllEffectTypes().length;for(let n=0;n<x;++n)u.push(new self.IEffectInstance(m,n))}Object.defineProperties(this,{effects:{value:u,writable:!1}})}get layout(){return c.get(this).GetWorldInfo().GetLayout().GetILayout()}get layer(){return c.get(this).GetWorldInfo().GetLayer().GetILayer()}get x(){return c.get(this).GetWorldInfo().GetX()}set x(m){m=+m;const u=c.get(this).GetWorldInfo();isNaN(m)||u.GetX()===m||(u.SetX(m),u.SetBboxChanged())}get y(){return c.get(this).GetWorldInfo().GetY()}set y(m){m= +m;const u=c.get(this).GetWorldInfo();isNaN(m)||u.GetY()===m||(u.SetY(m),u.SetBboxChanged())}get zElevation(){return c.get(this).GetWorldInfo().GetZElevation()}set zElevation(m){m=+m;const u=c.get(this),x=u.GetWorldInfo();isNaN(m)||x.GetZElevation()===m||(x.SetZElevation(m),u.GetRuntime().UpdateRender())}get totalZElevation(){return c.get(this).GetWorldInfo().GetTotalZElevation()}get width(){return c.get(this).GetWorldInfo().GetWidth()}set width(m){m=+m;const u=c.get(this).GetWorldInfo();isNaN(m)|| u.GetWidth()===m||(u.SetWidth(m),u.SetBboxChanged())}get height(){return c.get(this).GetWorldInfo().GetHeight()}set height(m){m=+m;const u=c.get(this).GetWorldInfo();isNaN(m)||u.GetHeight()===m||(u.SetHeight(m),u.SetBboxChanged())}get angle(){return c.get(this).GetWorldInfo().GetAngle()}set angle(m){m=e.clampAngle(+m);const u=c.get(this).GetWorldInfo();isNaN(m)||u.GetAngle()===m||(u.SetAngle(m),u.SetBboxChanged())}get angleDegrees(){return e.toDegrees(this.angle)}set angleDegrees(m){this.angle=e.toRadians(m)}getBoundingBox(){return c.get(this).GetWorldInfo().GetBoundingBox().toDOMRect()}getBoundingQuad(){return c.get(this).GetWorldInfo().GetBoundingQuad().toDOMQuad()}get isVisible(){return c.get(this).GetWorldInfo().IsVisible()}set isVisible(m){m= !!m;const u=c.get(this),x=u.GetWorldInfo();x.IsVisible()!==m&&(x.SetVisible(m),u.GetRuntime().UpdateRender())}get opacity(){return c.get(this).GetWorldInfo().GetOpacity()}set opacity(m){m=e.clamp(+m,0,1);const u=c.get(this),x=u.GetWorldInfo();isNaN(m)||x.GetOpacity()===m||(x.SetOpacity(m),u.GetRuntime().UpdateRender())}set colorRgb(m){b.RequireArray(m);if(3>m.length)throw Error("expected 3 elements");g.setRgb(m[0],m[1],m[2]);m=c.get(this);const u=m.GetWorldInfo();u.GetUnpremultipliedColor().equalsIgnoringAlpha(g)|| (u.SetUnpremultipliedColor(g),m.GetRuntime().UpdateRender())}get colorRgb(){const m=c.get(this).GetWorldInfo().GetUnpremultipliedColor();return[m.getR(),m.getG(),m.getB()]}set blendMode(m){b.RequireString(m);m=f.get(m);if("number"!==typeof m)throw Error("invalid blend mode");const u=c.get(this);u.GetWorldInfo().SetBlendMode(m);u.GetRuntime().UpdateRender()}get blendMode(){return l.get(c.get(this).GetWorldInfo().GetBlendMode())}moveToTop(){c.get(this).GetWorldInfo().ZOrderMoveToTop()}moveToBottom(){c.get(this).GetWorldInfo().ZOrderMoveToBottom()}moveToLayer(m){b.RequireInstanceOf(m, d);m=d._Unwrap(m);if(!m)throw Error("invalid layer");c.get(this).GetWorldInfo().ZOrderMoveToLayer(m)}moveAdjacentToInstance(m,u){b.RequireInstanceOf(m,k);c.get(this).GetWorldInfo().ZOrderMoveAdjacentToInstance(c.get(m),u)}get zIndex(){return c.get(this).GetWorldInfo().GetZIndex()}containsPoint(m,u){b.RequireNumber(m);b.RequireNumber(u);return c.get(this).GetWorldInfo().ContainsPoint(+m,+u)}testOverlap(m){b.RequireInstanceOf(m,k);const u=c.get(this);m=c.get(m);return u.GetRuntime().GetCollisionEngine().TestOverlap(u, m)}testOverlapSolid(){var m=c.get(this);return(m=m.GetRuntime().GetCollisionEngine().TestOverlapSolid(m))?m.GetInterfaceClass():null}getParent(){const m=c.get(this).GetParent();return m?m.GetInterfaceClass():null}getTopParent(){const m=c.get(this).GetTopParent();return m?m.GetInterfaceClass():null}*parents(){for(const m of c.get(this).parents())yield m.GetInterfaceClass()}getChildCount(){return c.get(this).GetChildCount()}getChildAt(m){return(m=c.get(this).GetChildAt(m))?m.GetInterfaceClass():null}*children(){for(const m of c.get(this).children())yield m.GetInterfaceClass()}*allChildren(){for(const m of c.get(this).allChildren())yield m.GetInterfaceClass()}addChild(m, u){b.RequireInstanceOf(m,k);b.RequireOptionalObject(u);u||(u={});const x=c.get(this);m=c.get(m);x.AddChild(m,u)}removeChild(m){b.RequireInstanceOf(m,k);const u=c.get(this);m=c.get(m);u.RemoveChild(m)}removeFromParent(){const m=c.get(this);m.HasParent()&&m.GetParent().RemoveChild(m)}createMesh(m,u){b.RequireFiniteNumber(m);b.RequireFiniteNumber(u);c.get(this).GetWorldInfo().CreateMesh(m,u)}releaseMesh(){const m=c.get(this).GetWorldInfo();m.ReleaseMesh();m.SetBboxChanged()}setMeshPoint(m,u,x){b.RequireFiniteNumber(m); b.RequireFiniteNumber(u);b.RequireObject(x);const n=c.get(this).GetWorldInfo();n.SetMeshPoint(m,u,x)&&n.SetBboxChanged()}getMeshSize(){var m=c.get(this).GetWorldInfo();if(!m.HasMesh())return[0,0];m=m.GetSourceMesh();return[m.GetHSize(),m.GetVSize()]}}} {"use strict";const e=self.C3X,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,d){e.RequireString(a);b.get(this).GetSdkInstance().SetElementCSSStyle(a,d)}}} {"use strict";const e=self.C3,b=self.C3X,a=new WeakMap,d=new WeakMap;function c(l){let g=d.get(l);if(g)return g;g=e.New(e.Event.Dispatcher);d.set(l,g);return g}let f=null;self.IBehaviorInstance=class{constructor(){a.set(this,f);const l={runtime:{value:f.GetRuntime().GetIRuntime(),writable:!1},behavior:{value:f.GetBehavior().GetIBehavior(),writable:!1}};Object.defineProperties(this,l)}static _Init(l){f=l}static _GetInitInst(){return f}get instance(){return a.get(this).GetObjectInstance().GetInterfaceClass()}_Release(){const l= d.get(this);l&&(l.Release(),d.delete(this));a.delete(this)}addEventListener(l,g,k){b.RequireString(l);b.RequireFunction(g);c(this).addEventListener(l,g,k)}removeEventListener(l,g,k){b.RequireString(l);b.RequireFunction(g);c(this).removeEventListener(l,g,k)}dispatchEvent(l){c(this).dispatchEvent(l)}}} {"use strict";const e=new WeakMap;self.IBehavior=class{constructor(b){e.set(this,b);b={runtime:{value:b.GetRuntime().GetIRuntime(),writable:!1}};Object.defineProperties(this,b)}getAllInstances(){return e.get(this).GetInstances().map(b=>b.GetInterfaceClass())}}} {"use strict";const e=self.C3,b=self.C3X,a=new WeakMap;self.IEffectInstance=class{constructor(d,c){a.set(this,d);Object.defineProperties(this,{index:{value:c,writable:!1}})}get name(){return a.get(this).GetAllEffectTypes()[this.index].GetName()}get isActive(){return a.get(this).IsEffectIndexActive(this.index)}set isActive(d){d=!!d;const c=a.get(this);c.IsEffectIndexActive(this.index)!==d&&(c.SetEffectIndexActive(this.index,d),c.UpdateActiveEffects(),c.GetRuntime().UpdateRender())}setParameter(d,c){b.RequireFiniteNumber(d); d=Math.floor(+d);const f=a.get(this);var l=f.GetEffectParametersForIndex(this.index);if(0>d||d>=l.length)throw new RangeError("invalid effect parameter index");const g=l[d];if(g instanceof e.Color){if(!Array.isArray(c)||3>c.length)throw new TypeError("expected array with 3 elements");d=c[0];l=c[1];c=c[2];if(g.equalsRgb(d,l,c))return;g.setRgb(d,l,c)}else{if("number"!==typeof c)throw new TypeError("expected number");if(g===c)return;l[d]=c}f.IsEffectIndexActive(this.index)&&f.GetRuntime().UpdateRender()}getParameter(d){b.RequireFiniteNumber(d); d=Math.floor(+d);const c=a.get(this).GetEffectParametersForIndex(this.index);if(0>d||d>=c.length)throw new RangeError("invalid effect parameter index");d=c[d];return d instanceof e.Color?[d.getR(),d.getG(),d.getB()]:d}}} {"use strict";const e=self.C3,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 d(f){if(!f)return"";f=f.split(".");if(2>f.length)return"";f=f.at(-1).toLowerCase();return a.get(f)||""}function c(f){return new Promise((l,g)=>{const k=document.createElement("script");k.onload=l;k.onerror=g;k.async=!1;k.type="module"; k.src=f;document.head.appendChild(k)})}e.AssetManager=class extends e.DefendedBase{constructor(f,l){super();var g=l.exportType;this._runtime=f;this._localUrlBlobs=new Map;this._localBlobUrlCache=new Map;this._localBlobSWUrls=new Map;this._isCordova="cordova"===g;this._isiOSCordova=!!l.isiOSCordova;this._isFileProtocol=!!l.isFileProtocol;this._swClientId=l.swClientId;this._supportedAudioFormats=l.supportedAudioFormats||{};this._audioFiles=new Map;this._preloadSounds=!1;this._iconsSubfolder=this._fontsSubfolder= this._mediaSubfolder="";this._defaultLoadPolicy="html5"===g||"scirra-arcade"===g||"instant-games"===g?"remote":"local";this._allAssets=[];this._assetsByUrl=new Map;this._webFonts=[];this._loadPromises=[];this._hasFinishedInitialLoad=!1;this._lastLoadProgress=this._assetSizeLoaded=this._totalAssetSizeToLoad=0;this._hasHadErrorLoading=!1;this._loadingRateLimiter=e.New(e.RateLimiter,()=>this._FireLoadingProgressEvent(),50);this._promiseThrottle=new e.PromiseThrottle(Math.max(e.hardwareConcurrency,8)); if(f=l.previewImageBlobs){(g=l.previewProjectFileBlobs)&&Object.assign(f,g);(g=l.projectData)&&(f["data.json"]=g);for(const [k,m]of Object.entries(f))this._localUrlBlobs.set(k.toLowerCase(),m)}if(l=l.previewProjectFileSWUrls)for(const [k,m]of Object.entries(l))this._localBlobSWUrls.set(k,m);this._iAssetManager=new self.IAssetManager(this)}Release(){this._localUrlBlobs.clear();for(const f of this._localBlobUrlCache.values())f.startsWith("blob:")&&URL.revokeObjectURL(f);this._localBlobUrlCache.clear(); for(const f of this._allAssets)f.Release();e.clearArray(this._allAssets);this._assetsByUrl.clear();e.clearArray(this._loadPromises);this._runtime=null}GetRuntime(){return this._runtime}_SetMediaSubfolder(f){this._mediaSubfolder=f}GetMediaSubfolder(){return this._mediaSubfolder}_SetFontsSubfolder(f){this._fontsSubfolder=f}GetFontsSubfolder(){return this._fontsSubfolder}_SetIconsSubfolder(f){this._iconsSubfolder=f}GetIconsSubfolder(){return this._iconsSubfolder}IsFileProtocol(){return this._isFileProtocol}_HasLocalUrlBlob(f){return this._localUrlBlobs.has(f.toLowerCase())}_GetLocalUrlBlob(f){return this._localUrlBlobs.get(f.toLowerCase())|| null}GetLocalUrlAsBlobUrl(f){if(!this._HasLocalUrlBlob(f))return f;f=f.toLowerCase();var l=this._localBlobUrlCache.get(f);l||(l=this._GetLocalUrlBlob(f),l=URL.createObjectURL(l),this._localBlobUrlCache.set(f,l));return l}FetchBlob(f,l){l=l||this._defaultLoadPolicy;const g=this._GetLocalUrlBlob(f);if(g)return Promise.resolve(g);if(e.IsRelativeURL(f)){const k=f.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsBlob(k):"local"===l?this._promiseThrottle.Add(()=>e.FetchBlob(k)): e.FetchBlob(k)}return e.FetchBlob(f)}FetchArrayBuffer(f){const l=this._GetLocalUrlBlob(f);if(l)return e.BlobToArrayBuffer(l);if(e.IsRelativeURL(f)){const g=f.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsArrayBuffer(g):"local"===this._defaultLoadPolicy?this._promiseThrottle.Add(()=>e.FetchArrayBuffer(g)):e.FetchArrayBuffer(g)}return e.FetchArrayBuffer(f)}FetchText(f){const l=this._GetLocalUrlBlob(f);if(l)return e.BlobToString(l);if(e.IsRelativeURL(f)){const g= f.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsText(g):"local"===this._defaultLoadPolicy?this._promiseThrottle.Add(()=>e.FetchText(g)):e.FetchText(g)}return e.FetchText(f)}async FetchJson(f){f=await this.FetchText(f);return JSON.parse(f)}_CordovaFetchLocalFileAs(f,l){return this._runtime.PostComponentMessageToDOMAsync("runtime","cordova-fetch-local-file",{filename:f,as:l})}CordovaFetchLocalFileAsText(f){return this._CordovaFetchLocalFileAs(f,"text")}async CordovaFetchLocalFileAsBlob(f){const l= await this._CordovaFetchLocalFileAs(f,"buffer");f=d(f);return new Blob([l],{type:f})}async CordovaFetchLocalFileAsBlobURL(f){f=f.toLowerCase();var l=this._localBlobUrlCache.get(f);if(l)return l;l=await this.CordovaFetchLocalFileAsBlob(f);l=URL.createObjectURL(l);this._localBlobUrlCache.set(f,l);return l}CordovaFetchLocalFileAsArrayBuffer(f){return this._CordovaFetchLocalFileAs(f,"buffer")}GetMediaFileUrl(f){return this._HasLocalUrlBlob(f)?this.GetLocalUrlAsBlobUrl(f):this._mediaSubfolder+f.toLowerCase()}GetProjectFileUrl(f, l=""){if(e.IsAbsoluteURL(f)){if(l)throw Error("cannot specify subfolder with remote URL");return Promise.resolve(f)}return this._HasLocalUrlBlob(f)?Promise.resolve(this.GetLocalUrlAsBlobUrl(f)):this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsBlobURL(l+f):Promise.resolve(l+f.toLowerCase())}GetProjectFileIframeUrl(f){if(e.IsAbsoluteURL(f))return Promise.resolve(f);var l=f.indexOf("?"),g=-1===l?"":f.substr(l);l=-1===l?f:f.substr(0,l);return this._HasLocalUrlBlob(l)?(f=this._localBlobSWUrls.get(l)|| this.GetLocalUrlAsBlobUrl(l),!f.startsWith("blob:")&&this._swClientId&&(f=new URL(f),g=new URLSearchParams(g),g.set("__c3_client_id",this._swClientId),f.search=g.toString(),f=f.toString()),Promise.resolve(f)):this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsBlobURL(l):Promise.resolve(f.toLowerCase())}LoadProjectFileUrl(f){return this.GetProjectFileUrl(f)}LoadImage(f){if(f.loadPolicy&&!b.has(f.loadPolicy))throw Error("invalid load policy");let l=this._assetsByUrl.get(f.url);if(l)return l; l=e.New(e.ImageAsset,this,{url:f.url,size:f.size||0,loadPolicy:f.loadPolicy||this._defaultLoadPolicy});this._allAssets.push(l);this._assetsByUrl.set(l.GetURL(),l);this._hasFinishedInitialLoad||(this._totalAssetSizeToLoad+=l.GetSize(),this._loadPromises.push(l.Load().then(()=>this._AddLoadedSize(l.GetSize()))));return l}async WaitForAllToLoad(){try{await Promise.all(this._loadPromises),this._lastLoadProgress=1}catch(f){console.error("Error loading: ",f),this._hasHadErrorLoading=!0,this._FireLoadingProgressEvent()}}SetInitialLoadFinished(){this._hasFinishedInitialLoad= !0}HasHadErrorLoading(){return this._hasHadErrorLoading}_AddLoadedSize(f){this._assetSizeLoaded+=f;this._loadingRateLimiter.Call()}_FireLoadingProgressEvent(){const f=e.New(e.Event,"loadingprogress");this._lastLoadProgress=e.clamp(this._assetSizeLoaded/this._totalAssetSizeToLoad,0,1);f.progress=this._lastLoadProgress;this._runtime.Dispatcher().dispatchEvent(f)}GetLoadProgress(){return this._lastLoadProgress}_SetWebFonts(f){e.shallowAssignArray(this._webFonts,f);this._webFonts.length&&this._loadPromises.push(this._LoadWebFonts())}_LoadWebFonts(){if("undefined"=== typeof FontFace)return Promise.resolve();const f=[];for(const [l,g,k]of this._webFonts)this._totalAssetSizeToLoad+=k,f.push(this._LoadWebFont(l,g).then(()=>this._AddLoadedSize(k)));return Promise.all(f)}async _LoadWebFont(f,l){try{const g=await this.GetProjectFileUrl(l,this._fontsSubfolder),k=new FontFace(f,`url('${g}')`);this._runtime.IsInWorker()?self.fonts.add(k):document.fonts.add(k);await k.load()}catch(g){console.warn(`[C3 runtime] Failed to load web font '${f}': `,g)}}IsAudioFormatSupported(f){return!!this._supportedAudioFormats[f]}_SetAudioFiles(f, l){this._preloadSounds=!!l;for(const [g,k,m]of f)this._audioFiles.set(g,{fileName:g,formats:k.map(u=>({type:u[0],fileExtension:u[1],fullName:g+u[1],fileSize:u[2]})),isMusic:m})}GetPreferredAudioFile(f){f=this._audioFiles.get(f.toLowerCase());if(!f)return null;let l=null;for(const g of f.formats)if(l||"audio/webm; codecs=opus"!==g.type||(l=g),this.IsAudioFormatSupported(g.type))return g;return l}GetProjectAudioFileUrl(f){return(f=this.GetPreferredAudioFile(f))?{url:this.GetMediaFileUrl(f.fullName), type:f.type}:null}GetAudioToPreload(){if(this._preloadSounds){const f=[];for(const l of this._audioFiles.values()){if(l.isMusic)continue;const g=this.GetPreferredAudioFile(l.fileName);g&&f.push({originalUrl:l.fileName,url:this.GetMediaFileUrl(g.fullName),type:g.type,fileSize:g.fileSize})}return f}return[]}GetIAssetManager(){return this._iAssetManager}async LoadScripts(...f){const l=await Promise.all(f.map(g=>this.GetProjectFileUrl(g)));this._runtime.IsInWorker()?1===f.length?(f=f[0],await self.c3_import((e.IsRelativeURL(f)? "./":"")+f)):(f=f.map(g=>`import "${e.IsRelativeURL(g)?"./":""}${g}";`).join("\n"),f=URL.createObjectURL(new Blob([f],{type:"application/javascript"})),await self.c3_import(f)):await Promise.all(l.map(g=>c(g)))}async CompileWebAssembly(f){if(WebAssembly.compileStreaming)return f=await this.GetProjectFileUrl(f),await WebAssembly.compileStreaming(fetch(f));f=await e.FetchArrayBuffer(f);return await WebAssembly.compile(f)}async LoadStyleSheet(f){f=await this.GetProjectFileUrl(f);return await this._runtime.PostComponentMessageToDOMAsync("runtime", "add-stylesheet",{url:f})}}} {"use strict";const e=self.C3;e.Asset=class extends e.DefendedBase{constructor(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 e=self.C3,b=new e.PromiseThrottle,a=new Set;e.ImageAsset=class extends e.Asset{constructor(d,c){super(d,c);this._webglTexture=this._texturePromise=null;this._refCount=0;this._imageHeight=this._imageWidth=-1;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 d of a)d._texturePromise=null,d._webglTexture= null,d._refCount=0}LoadStaticTexture(d,c){c=c||{};this._refCount++;if(this._webglTexture)return Promise.resolve(this._webglTexture);if(this._texturePromise)return this._texturePromise;c.anisotropy=this._runtime.GetCanvasManager().GetTextureAnisotropy();return this._texturePromise=this.GetBlob().then(f=>b.Add(()=>d.CreateStaticTextureAsync(f,c).then(l=>{this._texturePromise=null;if(0===this._refCount)return d.DeleteTexture(l),null;this._webglTexture=l;this._imageWidth=l.GetWidth();this._imageHeight= l.GetHeight();return this._webglTexture}))).catch(f=>{console.error("Failed to load texture: ",f);throw f;})}ReleaseTexture(){if(0>=this._refCount)throw Error("texture released too many times");this._refCount--;0===this._refCount&&this._webglTexture&&(this._webglTexture.GetRenderer().DeleteTexture(this._webglTexture),this._webglTexture=null)}GetTexture(){return this._webglTexture}GetWidth(){return this._imageWidth}GetHeight(){return this._imageHeight}async LoadToDrawable(){const d=await this.GetBlob(); return e.Supports.ImageBitmapOptions?await createImageBitmap(d,{premultiplyAlpha:"none"}):e.Supports.ImageBitmap?await createImageBitmap(d):await e.BlobToImage(d)}}} {"use strict";const e=self.C3;function b(a,d){return a.GetWorldInfo()._GetLastCachedZIndex()-d.GetWorldInfo()._GetLastCachedZIndex()}e.RenderCell=class extends e.DefendedBase{constructor(a,d,c){super();this._grid=a;this._x=d;this._y=c;this._instances=[];this._isSorted=!0;this._pendingRemoval=new Set;this._isAnyPendingRemoval=!1}Release(){e.clearArray(this._instances);this._pendingRemoval.clear();this._grid=null}Reset(){e.clearArray(this._instances);this._isSorted=!0;this._pendingRemoval.clear();this._isAnyPendingRemoval= !1}SetChanged(){this._isSorted=!1}IsEmpty(){if(!this._instances.length)return!0;if(this._instances.length>this._pendingRemoval.size)return!1;this._FlushPending();return!0}Insert(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():(e.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 e=self.C3;e.RenderGrid=class extends e.DefendedBase{constructor(b,a){super();this._cellWidth=b;this._cellHeight=a;this._cells=e.New(e.PairMap)}Release(){this._cells.Release();this._cells=null}GetCell(b,a,d){let c=this._cells.Get(b,a);return c?c:d?(c=e.New(e.RenderCell,this,b,a),this._cells.Set(b,a,c),c):null}XToCell(b){return Math.floor(b/this._cellWidth)}YToCell(b){return Math.floor(b/this._cellHeight)}Update(b,a,d){if(a)for(let c=a.getLeft(),f=a.getRight();c<=f;++c)for(let l= a.getTop(),g=a.getBottom();l<=g;++l){if(d&&d.containsPoint(c,l))continue;const k=this.GetCell(c,l,!1);k&&(k.Remove(b),k.IsEmpty()&&this._cells.Delete(c,l))}if(d)for(let c=d.getLeft(),f=d.getRight();c<=f;++c)for(let l=d.getTop(),g=d.getBottom();l<=g;++l)a&&a.containsPoint(c,l)||this.GetCell(c,l,!0).Insert(b)}QueryRange(b,a){let d=this.XToCell(b.getLeft());const c=this.YToCell(b.getTop()),f=this.XToCell(b.getRight());for(b=this.YToCell(b.getBottom());d<=f;++d)for(let l=c;l<=b;++l){const g=this.GetCell(d, l,!1);g&&g.Dump(a)}}MarkRangeChanged(b){let a=b.getLeft();const d=b.getTop(),c=b.getRight();for(b=b.getBottom();a<=c;++a)for(let f=d;f<=b;++f){const l=this.GetCell(a,f,!1);l&&l.SetChanged()}}}} {"use strict";const e=self.C3,b=new e.Rect,a=new e.Quad,d=[],c=new e.Rect,f=new e.Rect,l=self.glMatrix,g=l.vec3,k=l.vec4,m=l.mat4,u=m.create(),x=g.create(),n=k.create(),q=g.create(),t=g.create(),r=g.create(),w=e.New(e.Vector2);function y(B,A){return B.GetWorldInfo()._GetLastCachedZIndex()-A.GetWorldInfo()._GetLastCachedZIndex()}function C(B,A){return B.GetWorldInfo().GetZElevation()-A.GetWorldInfo().GetZElevation()}const D=[],G=[],K=[];e.Layer=class extends e.DefendedBase{constructor(B,A,F){super(); this._layout=B;this._runtime=B.GetRuntime();this._name=F[0];this._index=A;this._sid=F[2];this._isVisible=!!F[3];this._backgroundColor=e.New(e.Color);this._backgroundColor.setFromJSON(F[4].map(J=>J/255));this._isTransparent=!!F[5];this._parallaxX=F[6];this._parallaxY=F[7];this._color=e.New(e.Color,1,1,1,F[8]);this._premultipliedColor=e.New(e.Color);this._isForceOwnTexture=F[9];this._renderAs3d=F[17];this._useCameraDistanceDrawOrder=F[18];this._useRenderCells=F[10];this._scaleRate=F[11];this._blendMode= F[12];this._curRenderTarget=null;this._scale=1;this._zElevation=F[16];this._scrollY=this._scrollX=this._angle=0;this._hasOwnScrollPosition=!1;this._viewport=e.New(e.Rect);this._viewportZ0=e.New(e.Rect);this._viewport3D=e.New(e.Rect);this._projectionMatrix=m.create();this._isProjectionMatrixChanged=!0;this._modelViewMatrix=m.create();this._isMVMatrixChanged=!0;this._viewFrustum=e.New(e.Gfx.ViewFrustum);this._isViewFrustumChanged=!0;this._startupInitialInstances=[];this._initialInstances=[];this._createdGlobalUids= [];this._initialUIDsToInstanceData=new Map;this._instances=[];this._anyInstanceZElevated=this._zIndicesUpToDate=!1;this._effectList=e.New(e.EffectList,this,F[15]);this._renderGrid=null;this._lastRenderList=[];this._isRenderListUpToDate=!1;this._lastRenderCells=e.New(e.Rect,0,0,-1,-1);this._curRenderCells=e.New(e.Rect,0,0,-1,-1);this._iLayer=new self.ILayer(this);this._UpdatePremultipliedColor();this.UsesRenderCells()&&(this._renderGrid=e.New(e.RenderGrid,this._runtime.GetOriginalViewportWidth(),this._runtime.GetOriginalViewportHeight())); for(const J of F[14])B=this._runtime.GetObjectClassByIndex(J[1]),this._layout._AddInitialObjectClass(B),B.GetDefaultInstanceData()||(B.SetDefaultInstanceData(J),B._SetDefaultLayerIndex(this._index)),this._initialInstances.push(J),this._initialUIDsToInstanceData.set(J[2],J);e.shallowAssignArray(this._startupInitialInstances,this._initialInstances)}static Create(B,A,F){return e.New(e.Layer,B,A,F)}Release(){this._runtime=this._layout=null}GetInitialInstanceData(B){return this._initialUIDsToInstanceData.get(B)}CreateInitialInstances(B){const A= this._layout.IsFirstVisit();let F=0;const J=this._initialInstances;for(let Q=0,T=J.length;Q<T;++Q){var L=J[Q];const V=this._runtime.GetObjectClassByIndex(L[1]);let aa=!0;if(!V.HasPersistBehavior()||A)L=this._runtime.CreateInstanceFromData(L,this,!0),B.push(L),V.IsGlobal()&&(aa=!1,this._createdGlobalUids.push(L.GetUID()));aa&&(J[F]=J[Q],++F)}e.truncateArray(J,F);this._runtime.FlushPendingInstances();this.SetZIndicesChanged()}_AddInstance(B,A){const F=B.GetWorldInfo();if(F.GetLayer()!==this)throw Error("instance added to wrong layer"); this._instances.push(B);0!==F.GetZElevation()&&(this._anyInstanceZElevated=!0);A&&this.UsesRenderCells()&&B.GetWorldInfo().SetBboxChanged();this.SetZIndicesChanged()}_MaybeAddInstance(B){this._instances.includes(B)||(this._instances.push(B),0!==B.GetWorldInfo().GetZElevation()&&(this._anyInstanceZElevated=!0),this.SetZIndicesChanged())}_PrependInstance(B,A){const F=B.GetWorldInfo();if(F.GetLayer()!==this)throw Error("instance added to wrong layer");this._instances.unshift(B);0!==F.GetZElevation()&& (this._anyInstanceZElevated=!0);this.SetZIndicesChanged();A&&this.UsesRenderCells()&&B.GetWorldInfo().SetBboxChanged()}_RemoveInstance(B,A){const F=this._instances.indexOf(B);0>F||(A&&this.UsesRenderCells()&&B.GetWorldInfo()._RemoveFromRenderCells(),this._instances.splice(F,1),this.SetZIndicesChanged(),this._MaybeResetAnyInstanceZElevatedFlag())}_SetAnyInstanceZElevated(){this._anyInstanceZElevated=!0}_MaybeResetAnyInstanceZElevatedFlag(){0===this._instances.length&&(this._anyInstanceZElevated=!1)}_SortInstancesByLastCachedZIndex(B){if(B){B= new Set;for(var A of this._instances){var F=A.GetWorldInfo()._GetLastCachedZIndex();0<=F&&B.add(F)}A=-1;for(const J of this._instances)if(F=J.GetWorldInfo(),!(0<=F._GetLastCachedZIndex())){for(++A;B.has(A);)++A;F._SetZIndex(A)}}this._instances.sort(y)}_Start(){}_End(){for(const B of this._instances)B.GetObjectClass().IsGlobal()||this._runtime.DestroyInstance(B);this._runtime.FlushPendingInstances();e.clearArray(this._instances);this._anyInstanceZElevated=!1;this.SetZIndicesChanged()}RecreateInitialObjects(B, A,F,J,L){const Q=this._runtime.GetEventSheetManager(),T=this._runtime.GetAllObjectClasses(),V=B.IsFamily(),aa=[];for(const oa of this._initialInstances){var ha=oa[0];if(A.containsPoint(ha[0],ha[1])){ha=T[oa[1]];if(ha!==B)if(V){if(!B.FamilyHasMember(ha))continue}else continue;ha=this;var ja=this._runtime.GetCurrentLayout();this.GetLayout()!==ja&&((ha=ja.GetLayerByName(this.GetName()))||(ha=ja.GetLayerByIndex(this.GetIndex())));ja=this._runtime.CreateInstanceFromData(oa,ha,!1,void 0,void 0,!1,L);ha.SortAndAddInstancesByZIndex(ja); ha=ja.GetWorldInfo();ha.OffsetXY(F,J);ha.SetBboxChanged();Q.BlockFlushingInstances(!0);ja._TriggerOnCreatedOnSelfAndRelated();Q.BlockFlushingInstances(!1);aa.push(ja)}}return aa}GetInstanceCount(){return this._instances.length}GetLayout(){return this._layout}GetName(){return this._name}GetIndex(){return this._index}GetSID(){return this._sid}GetRuntime(){return this._runtime}GetDevicePixelRatio(){return this._runtime.GetDevicePixelRatio()}GetEffectList(){return this._effectList}UsesRenderCells(){return this._useRenderCells&& !this._useCameraDistanceDrawOrder}GetRenderGrid(){return this._renderGrid}SetRenderListStale(){this._isRenderListUpToDate=!1}IsVisible(){return this._isVisible}SetVisible(B){B=!!B;this._isVisible!==B&&(this._isVisible=B,this._runtime.UpdateRender())}SetOwnScrollPositionEnabled(B){B=!!B;if(this._hasOwnScrollPosition!==B){if(this._hasOwnScrollPosition=B)B=this.GetLayout(),this._scrollX=B.GetScrollX(),this._scrollY=B.GetScrollY();this._SetMVMatrixChanged();this._runtime.UpdateRender()}}IsOwnScrollPositionEnabled(){return this._hasOwnScrollPosition}SetScrollX(B){var A= this.GetLayout();const F=A.GetScrollLeftBound();A=A.GetScrollRightBound();B>A&&(B=A);B<F&&(B=F);this._scrollX!==B&&(this._scrollX=B,this.IsOwnScrollPositionEnabled()&&(this._SetMVMatrixChanged(),this._runtime.UpdateRender()))}SetScrollY(B){var A=this.GetLayout();const F=A.GetScrollTopBound();A=A.GetScrollBottomBound();B>A&&(B=A);B<F&&(B=F);this._scrollY!==B&&(this._scrollY=B,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 B=this.GetLayout();return[B.GetVanishingPointX(),B.GetVanishingPointY()]}GetViewportForZ(B,A){var F=this._viewportZ0;if(0===B)A.copy(F);else{let T=F.midX(),V=F.midY();var J=this.Get2DScaleFactorToZ(B);const aa=F.width()/J;F=F.height()/J;const [ha,ja]=this._GetVanishingPoint(); if(.5!==ha||.5!==ja){const oa=this.GetCameraZ();var L=this._runtime,Q=100/oa;J=(ha-.5)*L.GetViewportWidth()/Q;L=(ja-.5)*L.GetViewportHeight()/Q;Q=this.GetAngle();0!==Q&&(w.set(J,L),w.rotate(Q),J=w.getX(),L=w.getY());B=e.unlerp(oa,0,B);T+=e.lerp(J,0,B);V+=e.lerp(L,0,B)}A.set(T-aa/2,V-F/2,T+aa/2,V+F/2)}}GetOpacity(){return this._color.getA()}SetOpacity(B){B=e.clamp(B,0,1);this._color.getA()!==B&&(this._color.setA(B),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(B){this._scaleRate!==B&&(this._scaleRate=B,this._SetMVMatrixChanged(),this._runtime.UpdateRender())}GetParallaxX(){return this._parallaxX}GetParallaxY(){return this._parallaxY}SetParallax(B,A){if(this._parallaxX!==B||this._parallaxY!==A)if(this._parallaxX=B,this._parallaxY=A,this._SetMVMatrixChanged(), this._runtime.UpdateRender(),1!==this._parallaxX||1!==this._parallaxY)for(const F of this._instances)F.GetObjectClass()._SetAnyInstanceParallaxed(!0)}SetParallaxX(B){this.SetParallax(B,this.GetParallaxY())}SetParallaxY(B){this.SetParallax(this.GetParallaxX(),B)}SetZElevation(B){this._zElevation!==B&&(this._zElevation=B,this._runtime.UpdateRender())}GetZElevation(){return this._zElevation}SetAngle(B){B=e.clampAngle(B);this._angle!==B&&(this._angle=B,this._SetMVMatrixChanged(),this._runtime.UpdateRender())}GetAngle(){return e.clampAngle(this._layout.GetAngle()+ this._angle)}GetOwnAngle(){return this._angle}HasInstances(){return 0<this._instances.length}_GetInstances(){return this._instances}_GetInstancesInDrawOrder(){return this.RendersIn3DMode()&&this._useCameraDistanceDrawOrder?(e.shallowAssignArray(K,this._GetInstances()),K.sort((B,A)=>this._SortInstancesByCameraDistance(B,A)),K):this._GetInstances()}_SortInstancesByCameraDistance(B,A){var F=this.GetLayout().Get3DCameraPosition(),J=F[0],L=F[1];F=F[2];var Q=B.GetWorldInfo();const T=A.GetWorldInfo();A= Q.GetX()-J;B=Q.GetY()-L;Q=Q.GetZElevation()-F;J=T.GetX()-J;L=T.GetY()-L;F=T.GetZElevation()-F;return J*J+L*L+F*F-(A*A+B*B+Q*Q)}GetBackgroundColor(){return this._backgroundColor}IsTransparent(){return this._isTransparent}SetTransparent(B){B=!!B;this._isTransparent!==B&&(this._isTransparent=B,this._runtime.UpdateRender())}IsForceOwnTexture(){return this._isForceOwnTexture}SetForceOwnTexture(B){B=!!B;this._isForceOwnTexture!==B&&(this._isForceOwnTexture=B,this._runtime.UpdateRender())}RendersIn2DMode(){return!this.GetRuntime().Uses3DFeatures()|| !this._renderAs3d}RendersIn3DMode(){return!this.RendersIn2DMode()}Has3DCamera(){return this.RendersIn3DMode()&&this.GetLayout().Is3DCameraEnabled()}SetBlendMode(B){this._blendMode!==B&&(this._blendMode=B,this._runtime.UpdateRender())}GetBlendMode(){return this._blendMode}IsTransformCompatibleWith(B){return this===B||this._parallaxX===B._parallaxX&&this._parallaxY===B._parallaxY&&this._scale===B._scale&&this._scaleRate===B._scaleRate&&this._angle===B._angle&&this.GetScrollX()===B.GetScrollX()&&this.GetScrollY()=== B.GetScrollY()}SaveTransform(){return{parallaxX:this.GetParallaxX(),parallaxY:this.GetParallaxY(),scale:this.GetOwnScale(),scaleRate:this.GetScaleRate(),angle:this.GetOwnAngle(),hasOwnScroll:this.IsOwnScrollPositionEnabled(),scrollX:this.GetScrollX(),scrollY:this.GetScrollY()}}RestoreTransform(B){this.SetParallax(B.parallaxX,B.parallaxY);this.SetOwnScale(B.scale);this.SetScaleRate(B.scaleRate);this.SetAngle(B.angle);this.SetOwnScrollPositionEnabled(B.hasOwnScroll);this.SetScrollX(B.scrollX);this.SetScrollY(B.scrollY)}_RemoveAllInstancesInSet(B){0!== B.size&&0<e.arrayRemoveAllInSet(this._instances,B)&&(this._MaybeResetAnyInstanceZElevatedFlag(),this.SetZIndicesChanged())}SetZIndicesChanged(){this._isRenderListUpToDate=this._zIndicesUpToDate=!1}_UpdateZIndices(){if(!this._zIndicesUpToDate){this._instances.sort(C);if(this.UsesRenderCells())for(let B=0,A=this._instances.length;B<A;++B){const F=this._instances[B].GetWorldInfo();F._SetZIndex(B);this._renderGrid.MarkRangeChanged(F.GetRenderCellRange())}else for(let B=0,A=this._instances.length;B<A;++B)this._instances[B].GetWorldInfo()._SetZIndex(B); this._zIndicesUpToDate=!0}}MoveInstanceAdjacent(B,A,F){var J=B.GetWorldInfo();A=A.GetWorldInfo();if(J.GetLayer()!==this||A.GetLayer()!==this)throw Error("can't arrange Z order unless both objects on this layer");J=J.GetZIndex();A=A.GetZIndex();if(J===A+(F?1:-1))return!1;e.arrayRemove(this._instances,J);J<A&&A--;F&&A++;A===this._instances.length?this._instances.push(B):this._instances.splice(A,0,B);this.SetZIndicesChanged();return!0}_MergeSortedZArrays(B,A){const F=[];let J=0,L=0,Q=B.length,T=A.length; for(;J<Q&&L<T;){const V=B[J],aa=A[L];V.GetWorldInfo()._GetLastCachedZIndex()<aa.GetWorldInfo()._GetLastCachedZIndex()?(F.push(V),++J):(F.push(aa),++L)}for(;J<Q;++J)F.push(B[J]);for(;L<T;++L)F.push(A[L]);return F}_MergeAllSortedZArrays_pass(B){const A=[],F=B.length;for(let J=0;J<F-1;J+=2)A.push(this._MergeSortedZArrays(B[J],B[J+1]));1===F%2&&A.push(B[F-1]);return A}_MergeAllSortedZArrays(B){for(;1<B.length;)B=this._MergeAllSortedZArrays_pass(B);return B[0]}_GetRenderCellInstancesToDraw(){this._UpdateZIndices(); e.clearArray(d);this._renderGrid.QueryRange(this._viewport,d);return d.length?1===d.length?d[0]:this._MergeAllSortedZArrays(d):[]}_IsOpaque(){return!this.UsesOwnTexture()&&!this.IsTransparent()}ShouldDraw(){return this.IsVisible()&&0<this.GetOpacity()&&(this.HasInstances()||!this.IsTransparent())}UsesOwnTexture(){return this.IsForceOwnTexture()||!this.HasDefaultColor()||0!==this.GetBlendMode()||this._effectList.HasAnyActiveEffect()}GetRenderTarget(){return this._curRenderTarget}_CanFastPathDrawLayer(B){if(0=== B.length)return!0;if(2<=B.length)return!1;B=B[0].GetShaderProgram();return!B.MustPreDraw()&&!B.UsesDest()&&!B.UsesCrossSampling()&&this.HasDefaultColor()}Get2DScaleFactorToZ(B){if(this._layout.IsOrthographicProjection())return 1;{const A=this.GetCameraZ();return A/(A-B)}}GetCameraZ(){return 100/this.GetNormalScale()}_SetMVMatrixChanged(){this._isViewFrustumChanged=this._isMVMatrixChanged=!0}_GetModelViewMatrix(B){this._isMVMatrixChanged&&(this._CalculateModelViewMatrix(B,this._modelViewMatrix,0,0, null),this._isMVMatrixChanged=!1);return this._modelViewMatrix}_CalculateModelViewMatrix(B,A,F,J,L){const Q=this._runtime;var T=this.GetLayout();const V=Q.GetRenderScale();var aa=Q.GetParallaxXOrigin(),ha=Q.GetParallaxYOrigin();let ja=(this.GetScrollX()-aa)*this._parallaxX+aa;var oa=(this.GetScrollY()-ha)*this._parallaxY+ha;this._runtime.IsPixelRoundingEnabled()&&(ja=Math.round(ja),oa=Math.round(oa));if(this.Has3DCamera())g.copy(q,T.Get3DCameraPosition()),g.copy(t,T.Get3DCameraLookAt()),g.copy(r, T.Get3DCameraUpVector()),T=t[0]-q[0],J=t[1]-q[1],oa=t[2]-q[2],q[0]=(q[0]-aa)*this._parallaxX+aa,q[1]=(q[1]-ha)*this._parallaxY+ha,q[2]*=Math.max(this._parallaxX,this._parallaxY),t[0]=q[0]+T,t[1]=q[1]+J,t[2]=q[2]+oa,g.set(x,V,V,1),g.multiply(q,q,x),g.multiply(t,t,x);else{aa=(ja+F)*V;ha=(oa+J)*V;T=T.IsOrthographicProjection()?100:this.GetCameraZ();J=this.GetAngle();const [ya,Ba]=this._GetVanishingPoint();if(.5!==ya||.5!==Ba)F=100/T,oa=(ya-.5)*Q.GetViewportWidth()*V/F,F=(Ba-.5)*Q.GetViewportHeight()* V/F,0!==J&&(w.set(oa,F),w.rotate(J),oa=w.getX(),F=w.getY()),aa+=oa,ha+=F;g.set(q,aa,ha,T);g.set(t,aa,ha,T-100);0===J?g.set(r,0,1,0):g.set(r,Math.sin(J),Math.cos(J),0)}B.CalculateLookAtModelView(A,q,t,r,L||Q.GetCanvasManager().GetDrawHeight());1!==V&&(g.set(x,V,V,1),m.scale(A,A,x))}_SetProjectionMatrixChanged(){this._isViewFrustumChanged=this._isProjectionMatrixChanged=!0}_GetProjectionMatrix(B){this._isProjectionMatrixChanged&&(this._CalculateProjectionMatrix(B),this._isProjectionMatrixChanged=!1); return this._projectionMatrix}_CalculateProjectionMatrix(B){var A=this._runtime.GetCanvasManager();const [F,J]=this._GetVanishingPoint();if(this._layout.IsOrthographicProjection())B.CalculateOrthographicMatrix(this._projectionMatrix,A.GetDrawWidth(),A.GetDrawHeight());else if(.5===F&&.5===J)m.copy(this._projectionMatrix,A.GetDefaultProjectionMatrix());else{const L=A.GetDrawWidth();A=A.GetDrawHeight();B.CalculatePerspectiveMatrix(this._projectionMatrix,L/A,F,J)}}_SetTransform(B,A=!0,F=0,J=0,L=0){A&& B.SetProjectionMatrix(this._GetProjectionMatrix(B));0===F&&0===J&&0===L?A=this._GetModelViewMatrix(B):(this._CalculateModelViewMatrix(B,u,F,J,L),A=u);B.SetModelViewMatrix(A)}PrepareForDraw(B){this._SetTransform(B);B.SetBaseZ(this.GetZElevation())}Draw(B,A,F){var J=this._runtime.GetCanvasManager();const L=this.UsesOwnTexture();var Q=null;let T=null;if(this._runtime.IsGPUProfiling())if(B.IsWebGL()){const V=J.GetLayerTimingsBuffer(this);V&&(T=V.AddTimeElapsedQuery(),B.StartQuery(T))}else B.IsWebGPU()&& B.WriteTimestamp(2*(this.GetIndex()+1));L?(Q={sampling:this._runtime.GetSampling()},"low"===J.GetCurrentFullscreenScalingQuality()&&(Q.width=J.GetDrawWidth(),Q.height=J.GetDrawHeight()),Q=this._runtime.GetAdditionalRenderTarget(Q),B.SetRenderTarget(Q),this.IsTransparent()?B.ClearRgba(0,0,0,0):B.Clear(this._backgroundColor)):(B.SetRenderTarget(A),this.IsTransparent()||F||B.Clear(this._backgroundColor));this._curRenderTarget=Q||A;this._SetTransform(B);B.SetBaseZ(this.GetZElevation());B.SetDepthEnabled(this.RendersIn3DMode()); this.GetNormalScale()>Number.EPSILON&&(this._UpdateZIndices(),J=this.UsesRenderCells()&&0===this.GetZElevation()&&!this._anyInstanceZElevated,this.Has3DCamera()?this._DrawInstances_3DCamera(B):J?this._DrawInstances_RenderCells(B):this._DrawInstances(B,this._GetInstancesInDrawOrder()));B.SetBaseZ(0);B.SetCurrentZ(0);L&&(B.SetDepthEnabled(!1),this._DrawLayerOwnTextureToRenderTarget(B,Q,A,F));T&&B.EndQuery(T);this._runtime.IsGPUProfiling()&&B.IsWebGPU()&&B.WriteTimestamp(2*(this.GetIndex()+1)+1);this._curRenderTarget= null}_DrawInstances(B,A){const F=this._viewport,J=this._curRenderTarget,L=this.GetLayout().IsOrthographicProjection(),Q=this.GetLayout().HasVanishingPointOutsideViewport();let T=null;for(let V=0,aa=A.length;V<aa;++V){const ha=A[V];if(ha===T)continue;T=ha;const ja=ha.GetWorldInfo();ja.IsVisible()&&ja.IsInViewport(F,Q,L)&&this._DrawInstanceMaybeWithEffects(ha,ja,B,J)}}_DrawInstances_3DCamera(B){const A=this._curRenderTarget,F=this._GetViewFrustum(),J=this._GetInstancesInDrawOrder();for(let V=0,aa=J.length;V< aa;){var L=J[V],Q=L.GetWorldInfo();if(!Q.IsVisible()||!Q.IsInViewport3D(F)){++V;continue}(!L.RendersToOwnZPlane()||0<Q.GetDepth())&&G.push(L);var T=L.GetWorldInfo().GetTotalZElevation();D.push(L);let ha=V+1;for(;ha<aa;++ha){const ja=J[ha],oa=ja.GetWorldInfo();if(oa.IsVisible()&&oa.IsInViewport3D(F)){if(oa.GetTotalZElevation()!==T)break;ja.RendersToOwnZPlane()?(0<oa.GetDepth()&&G.push(ja),D.push(ja)):G.push(ja)}}if(1!==D.length||D[0].MustMitigateZFighting()){this._DrawCoplanarInstances_3DCamera(B, D);for(let ja=0,oa=G.length;ja<oa;++ja)L=G[ja],Q=L.GetWorldInfo(),Q._SetDrawNonBackFacesOnly(!0),this._DrawInstanceMaybeWithEffects(L,Q,B,A),Q._SetDrawNonBackFacesOnly(!1)}else{this._DrawInstanceMaybeWithEffects(L,Q,B,A);for(let ja=0,oa=G.length;ja<oa;++ja)Q=G[ja],Q!==L&&(T=Q.GetWorldInfo(),T.GetLayer()._DrawInstanceMaybeWithEffects(Q,T,B,A))}V=ha;e.clearArray(D);e.clearArray(G)}}_DrawCoplanarInstances_3DCamera(B,A){const F=this._curRenderTarget;B.CoplanarStartStencilPass();for(let Q=0,T=A.length;Q< T;++Q){var J=A[Q],L=J.GetWorldInfo();L._SetDrawBackFaceOnly(!0);this._DrawInstance(J,L,B)}B.CoplanarStartColorPass();for(let Q=0,T=A.length;Q<T;++Q)J=A[Q],L=J.GetWorldInfo(),this._DrawInstanceMaybeWithEffects(J,L,B,F),L._SetDrawBackFaceOnly(!1);B.CoplanarRestoreStandardRendering()}_DrawInstances_RenderCells(B){var A=this._renderGrid;const F=this._curRenderCells,J=this._lastRenderCells,L=this._viewport;F.set(A.XToCell(L.getLeft()),A.YToCell(L.getTop()),A.XToCell(L.getRight()),A.YToCell(L.getBottom())); this._isRenderListUpToDate&&F.equals(J)?A=this._lastRenderList:(A=this._GetRenderCellInstancesToDraw(),this._isRenderListUpToDate=!0,J.copy(F));this._DrawInstances(B,A);A!==this._lastRenderList&&e.shallowAssignArray(this._lastRenderList,A)}_DrawInstanceMaybeWithEffects(B,A,F,J){A.HasAnyActiveEffect()?this._DrawInstanceWithEffectsAndRestore(B,A,F,J):this._DrawInstance(B,A,F)}_DrawInstance(B,A,F){A=A.GetRendererStateGroup();F.GetCurrentStateGroup()!==A&&A.Apply();B.Draw(F)}_DrawInstanceWithEffectsAndRestore(B, A,F,J){this._DrawInstanceWithEffects(B,A,F,J,null)&&this._SetTransform(F)}_DrawInstanceWithEffects(B,A,F,J,L){const Q=A.GetInstanceEffectList().GetActiveEffectTypes();if(1===Q.length){const T=Q[0],V=T.GetShaderProgram();if(!V.NeedsPostDrawOrExtendsBox()&&A.HasDefaultColor()&&!B.MustPreDraw())return this._DrawInstanceWithEffects_FastPath(B,A,T,V,F),!1}B=e.RenderEffectChain(F,this._runtime,B,J,Q,L);F.SetBaseZ(this.GetZElevation());return B}_DrawInstanceWithEffects_FastPath(B,A,F,J,L){L.SetProgram(J); L.SetBlendMode(A.GetBlendMode());J.IsAnimated()&&this._runtime.UpdateRender();let Q=0,T=0;if(J.UsesAnySrcRectOrPixelSize()){const [V,aa]=B.GetCurrentSurfaceSize();Q=1/V;T=1/aa;(J=B.GetCurrentTexRect())?f.copy(J):f.set(0,0,0,0)}F=A.GetInstanceEffectList().GetEffectParametersForIndex(F.GetIndex());L.SetCurrentZ(A.GetZElevation());L.SetProgramParameters(null,c,f,f,A.GetBoundingBox(),Q,T,this.GetOwnScale(),this.GetAngle(),this._runtime.GetGameTime(),F);B.Draw(L)}_DrawLayerOwnTextureToRenderTarget(B,A, F,J){const L=this._effectList.GetActiveEffectTypes(),Q=this._runtime;if(this._CanFastPathDrawLayer(L)){B.SetRenderTarget(F);if(1===L.length){var T=L[0];F=T.GetShaderProgram();B.SetProgram(F);f.set(0,0,1,1);T=this._effectList.GetEffectParametersForIndex(T.GetIndex());B.SetProgramParameters(null,c,f,f,this._viewport,1/Q.GetDrawWidth(),1/Q.GetDrawHeight(),this.GetNormalScale(),this.GetAngle(),Q.GetGameTime(),T);F.IsAnimated()&&Q.UpdateRender()}else B.SetTextureFillMode();J&&0===this._blendMode&&this.HasDefaultColor()&& 0===L.length?B.CopyRenderTarget(A):(B.SetBlendMode(this._blendMode),B.SetColor(this._premultipliedColor),B.DrawRenderTarget(A));B.InvalidateRenderTarget(A);Q.ReleaseAdditionalRenderTarget(A)}else e.RenderEffectChain(B,Q,this,F,L)}GetOwnScale(){return this._scale}SetOwnScale(B){this._scale!==B&&(this._scale=B,this._layout.BoundScrolling(),this._SetMVMatrixChanged(),this._runtime.UpdateRender())}GetRenderScale(){return this.GetNormalScale()*this._runtime.GetRenderScale()}GetDisplayScale(){return this.GetNormalScale()* this._runtime.GetDisplayScale()}GetNormalScale(){return(this._scale*this._layout.GetScale()-1)*this._scaleRate+1}UpdateViewport(){var B=this._runtime.GetParallaxXOrigin(),A=this._runtime.GetParallaxYOrigin(),F=(this.GetScrollX()-B)*this._parallaxX+B,J=(this.GetScrollY()-A)*this._parallaxY+A;B=this.GetNormalScale();A=this._runtime.GetViewportWidth()/B;B=this._runtime.GetViewportHeight()/B;F-=A/2;let L=J-B/2;this._runtime.IsPixelRoundingEnabled()&&(F=Math.round(F),L=Math.round(L));J=this._viewportZ0; J.set(F,L,F+A,L+B);A=this.GetAngle();0!==A&&(b.copy(J),b.offset(-J.midX(),-J.midY()),a.setFromRotatedRect(b,A),a.getBoundingBox(b),b.offset(J.midX(),J.midY()),J.copy(b));A=this._zElevation;this.GetViewportForZ(A,this._viewport);this.Has3DCamera()?this.CalculateViewport3D(A,this._viewport3D):this._viewport3D.copy(this._viewport)}CalculateViewport3D(B,A){var F=this._runtime.GetCanvasManager(),J=F.GetCssWidth();F=F.GetCssHeight();const [L,Q]=this.CanvasCssToLayer(0,0,B),[T,V]=this.CanvasCssToLayer(J, 0,B),[aa,ha]=this.CanvasCssToLayer(J,F,B),[ja,oa]=this.CanvasCssToLayer(0,F,B);B=Math.min(L,T,aa,ja);J=Math.min(Q,V,ha,oa);F=Math.max(L,T,aa,ja);let ya=Math.max(Q,V,ha,oa);isFinite(B)||(B=-Infinity);isFinite(J)||(J=-Infinity);isFinite(F)||(F=Infinity);isFinite(ya)||(ya=Infinity);A.set(B,J,F,ya)}CanvasCssToLayer(B,A,F=0){return this._CanvasToLayer(B,A,F,this.GetDisplayScale())}DrawSurfaceToLayer(B,A,F=0){return this._CanvasToLayer(B,A,F,this.GetRenderScale()*this.GetDevicePixelRatio())}_CanvasToLayer(B, A,F,J){var L=this._runtime,Q=L.GetRenderer();const T=this.GetNormalScale(),V=L.GetViewportWidth()/T;L=L.GetViewportHeight()/T;k.set(n,0,0,V,L);B/=J;A=n[3]-A/J;J=this._GetProjectionMatrix(Q);Q=this._GetModelViewMatrix(Q);return e.Gfx.UnprojectScreenToWorldZ(B,A,F,Q,J,n,x)?[x[0],x[1]]:[NaN,NaN]}CanvasCssToLayer_DefaultTransform(B,A){const F=this._scale,J=this._scaleRate,L=this._parallaxX,Q=this._parallaxY,T=this._angle;this._parallaxY=this._parallaxX=this._scaleRate=this._scale=1;this._angle=0;this._SetMVMatrixChanged(); B=this.CanvasCssToLayer(B,A);this._scale=F;this._scaleRate=J;this._parallaxX=L;this._parallaxY=Q;this._angle=T;this._SetMVMatrixChanged();return B}LayerToCanvasCss(B,A,F=0){return this._LayerToCanvas(B,A,F,this.GetDisplayScale())}LayerToDrawSurface(B,A,F=0){return this._LayerToCanvas(B,A,F,this.GetRenderScale()*this.GetDevicePixelRatio())}_LayerToCanvas(B,A,F,J){var L=this._runtime,Q=L.GetRenderer();const T=this.GetNormalScale();var V=L.GetViewportWidth()/T;L=L.GetViewportHeight()/T;k.set(n,0,0,V, L);V=this._GetProjectionMatrix(Q);Q=this._GetModelViewMatrix(Q);return e.Gfx.Project(B,A,F,Q,V,n,x)?[x[0]*J,(n[3]-x[1])*J]:[NaN,NaN]}_GetLayerToDrawSurfaceScale(B,A){B*=this.GetRenderScale()*this.GetDevicePixelRatio();0!==A&&(B*=this.Get2DScaleFactorToZ(A));return B}_GetViewFrustum(){this._isViewFrustumChanged&&(this._UpdateViewFrustum(),this._isViewFrustumChanged=!1);return this._viewFrustum}_UpdateViewFrustum(){var B=this._runtime.GetRenderer();const A=this._GetProjectionMatrix(B);B=this._GetModelViewMatrix(B); this._viewFrustum.CalculatePlanes(B,A)}_SaveToJson(){return{s:this.GetOwnScale(),a:this.GetOwnAngle(),vl:this._viewport.getLeft(),vt:this._viewport.getTop(),vr:this._viewport.getRight(),vb:this._viewport.getBottom(),v:this.IsVisible(),bc:this._backgroundColor.toJSON(),t:this.IsTransparent(),sx:this._scrollX,sy:this._scrollY,hosp:this._hasOwnScrollPosition,px:this.GetParallaxX(),py:this.GetParallaxY(),c:this._color.toJSON(),sr:this.GetScaleRate(),fx:this._effectList.SaveToJson(),cg:this._createdGlobalUids}}_LoadFromJson(B){this._scale= B.s;this._angle=B.a;this._viewport.set(B.vl,B.vt,B.vr,B.vb);this._isVisible=!!B.v;this._backgroundColor.setFromJSON(B.bc);this._isTransparent=!!B.t;B.hasOwnProperty("sx")&&(this._scrollX=B.sx);B.hasOwnProperty("sy")&&(this._scrollY=B.sy);B.hasOwnProperty("hosp")&&(this._hasOwnScrollPosition=!!B.hosp);this._parallaxX=B.px;this._parallaxY=B.py;this._color.setFromJSON(B.c);this._scaleRate=B.sr;e.shallowAssignArray(this._createdGlobalUids,B.cg);e.shallowAssignArray(this._initialInstances,this._startupInitialInstances); const A=new Set(this._createdGlobalUids);let F=0;for(let J=0,L=this._initialInstances.length;J<L;++J)A.has(this._initialInstances[J][2])||(this._initialInstances[F]=this._initialInstances[J],++F);e.truncateArray(this._initialInstances,F);this._effectList.LoadFromJson(B.fx);this._SortInstancesByLastCachedZIndex(!1);this.SetZIndicesChanged()}GetILayer(){return this._iLayer}SortAndAddInstancesByZIndex(B){B.GetWorldInfo();if(!this._instances.includes(B))if(B.HasChildren()){var A=[...B.allChildren()]; A.push(B);A.sort((J,L)=>{J=J.GetWorldInfo().GetSceneGraphZIndex();L=L.GetWorldInfo().GetSceneGraphZIndex();return J-L});for(var F of A)if(F.IsInContainer())for(const J of F.siblings())A.includes(J)||(B=[...J.allChildren()],B.push(J),B.sort((L,Q)=>{L=L.GetWorldInfo().GetSceneGraphZIndex();Q=Q.GetWorldInfo().GetSceneGraphZIndex();return L-Q}),B&&B.length&&A.splice(A.length,0,...B));for(const J of A)this._AddInstance(J,!0)}else if(this._AddInstance(B,!0),B.IsInContainer())for(A of B.siblings())if(F= [...A.allChildren()],F.push(A),F.sort((J,L)=>{J=J.GetWorldInfo().GetSceneGraphZIndex();L=L.GetWorldInfo().GetSceneGraphZIndex();return J-L}),F&&F.length)for(const J of F)this._AddInstance(J,!0)}}} {"use strict";const e=self.C3,b=self.C3Debugger,a=e.New(e.Rect),d=e.New(e.Rect),c=e.New(e.Rect),f=e.New(e.Color),l=self.glMatrix.vec3,g=[],k=[],m=[],u=[],x=[];function n(r,w,y,C){return r[0]===Math.fround(w)&&r[1]===Math.fround(y)&&r[2]===Math.fround(C)}let q=null;function t(r,w){q!==r&&(r.PrepareForDraw(w),q=r)}e.Layout=class extends e.DefendedBase{constructor(r,w,y){super();this._layoutManager=r;this._runtime=r.GetRuntime();this._name=y[0];this._originalWidth=y[1];this._originalHeight=y[2];this._width= y[1];this._height=y[2];this._isUnboundedScrolling=!!y[3];this._isOrthographicProjection=!!y[4];this._vanishingPointX=y[5];this._vanishingPointY=y[6];this._eventSheetName=y[7];this._eventSheet=null;this._sid=y[8];this._index=w;this._scrollY=this._scrollX=0;this._scale=1;this._angle=0;this._initialObjectClasses=new Set;this._textureLoadedTypes=new Set;this._textureLoadPendingPromises=new Set;this._createdInstances=[];this._initialNonWorld=[];this._is3dCameraEnabled=!1;this._cam3dposition=l.create(); this._cam3dlook=l.create();this._cam3dup=l.create();this._layers=[];this._layersByName=new Map;this._layersBySid=new Map;this._effectList=e.New(e.EffectList,this,y[11]);this._curRenderTarget=null;this._persistData={};this._isFirstVisit=!0;this._iLayout=new self.ILayout(this);this._userScriptDispatcher=e.New(e.Event.Dispatcher);for(const C of y[9])r=e.Layer.Create(this,this._layers.length,C),this._layers.push(r),this._layersByName.set(r.GetName().toLowerCase(),r),this._layersBySid.set(r.GetSID(),r); for(const C of y[10]){y=this._runtime.GetObjectClassByIndex(C[1]);if(!y)throw Error("missing nonworld object class");y.GetDefaultInstanceData()||y.SetDefaultInstanceData(C);this._initialNonWorld.push(C);this._AddInitialObjectClass(y)}}Release(){for(const r of this._layers)r.Release();e.clearArray(this._layers);this._textureLoadPendingPromises.clear();this._runtime=this._layoutManager=this._eventSheet=null}GetRuntime(){return this._runtime}GetName(){return this._name}GetSID(){return this._sid}GetIndex(){return this._index}GetEffectList(){return this._effectList}GetMinLayerScale(){let r= this._layers[0].GetNormalScale();for(let w=1,y=this._layers.length;w<y;++w){const C=this._layers[w];if(0!==C.GetParallaxX()||0!==C.GetParallaxY())r=Math.min(r,C.GetNormalScale())}return r}_GetScrollBoundMarginHorizontal(){return.5*this._runtime.GetViewportWidth()/this.GetMinLayerScale()}_GetScrollBoundMarginVertical(){return.5*this._runtime.GetViewportHeight()/this.GetMinLayerScale()}GetScrollLeftBound(){return this.IsUnboundedScrolling()?-Infinity:this._GetScrollBoundMarginHorizontal()}GetScrollRightBound(){return this.IsUnboundedScrolling()? Infinity:this.GetWidth()-this._GetScrollBoundMarginHorizontal()}GetScrollTopBound(){return this.IsUnboundedScrolling()?-Infinity:this._GetScrollBoundMarginVertical()}GetScrollBottomBound(){return this.IsUnboundedScrolling()?Infinity:this.GetHeight()-this._GetScrollBoundMarginVertical()}SetScrollX(r){const w=this.GetScrollLeftBound(),y=this.GetScrollRightBound();r>y&&(r=y);r<w&&(r=w);this._scrollX!==r&&(this._scrollX=r,this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}GetScrollX(){return this._scrollX}SetScrollY(r){const w= this.GetScrollTopBound(),y=this.GetScrollBottomBound();r>y&&(r=y);r<w&&(r=w);this._scrollY!==r&&(this._scrollY=r,this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}GetScrollY(){return this._scrollY}IsUnboundedScrolling(){return this._isUnboundedScrolling}BoundScrolling(){this.SetScrollX(this.GetScrollX());this.SetScrollY(this.GetScrollY());for(const r of this._layers)r.IsOwnScrollPositionEnabled()&&(r.SetScrollX(r.GetScrollX()),r.SetScrollY(r.GetScrollY()))}SetVanishingPointXY(r,w){if(this._vanishingPointX!== r||this._vanishingPointY!==w)this._vanishingPointX=r,this._vanishingPointY=w,this.IsPerspectiveProjection()&&(this._SetAllLayersProjectionChanged(),this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}GetVanishingPointX(){return this.IsOrthographicProjection()?.5:this._vanishingPointX}GetVanishingPointY(){return this.IsOrthographicProjection()?.5:this._vanishingPointY}HasVanishingPointOutsideViewport(){const r=this.GetVanishingPointX(),w=this.GetVanishingPointY();return 0>r||1<r||0>w||1<w}SetPerspectiveProjection(){this._isOrthographicProjection&& (this._isOrthographicProjection=!1,this._SetAllLayersProjectionChanged(),this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}SetOrthographicProjection(){this._isOrthographicProjection||(this._isOrthographicProjection=!0,this._SetAllLayersProjectionChanged(),this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}IsOrthographicProjection(){return this._isOrthographicProjection}IsPerspectiveProjection(){return!this.IsOrthographicProjection()}Set3DCameraEnabled(r){r=!!r;this._is3dCameraEnabled!== r&&(this._is3dCameraEnabled=r,this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}Is3DCameraEnabled(){return this._is3dCameraEnabled}Set3DCameraOrientation(r,w,y,C,D,G,K,B,A){n(this._cam3dposition,r,w,y)&&n(this._cam3dlook,C,D,G)&&n(this._cam3dup,K,B,A)||(l.set(this._cam3dposition,r,w,y),l.set(this._cam3dlook,C,D,G),l.set(this._cam3dup,K,B,A),this.Set3DCameraChanged())}Set3DCameraChanged(){this._SetAllLayersMVChanged();this._runtime.UpdateRender()}Get3DCameraPosition(){return this._cam3dposition}Get3DCameraLookAt(){return this._cam3dlook}Get3DCameraUpVector(){return this._cam3dup}GetScale(){return this._scale}SetScale(r){this._scale!== r&&(this._scale=r,this._SetAllLayersMVChanged(),this.BoundScrolling(),this._runtime.UpdateRender())}SetAngle(r){r=e.clampAngle(r);this._angle!==r&&(this._angle=r,this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}GetAngle(){return this._angle}GetWidth(){return this._width}SetWidth(r){!isFinite(r)||1>r||(this._width=r)}GetHeight(){return this._height}SetHeight(r){!isFinite(r)||1>r||(this._height=r)}GetEventSheet(){return this._eventSheet}GetLayers(){return this._layers}GetLayerCount(){return this._layers.length}GetLayer(r){return"number"=== typeof r?this.GetLayerByIndex(r):this.GetLayerByName(r.toString())}GetLayerByIndex(r){r=e.clamp(Math.floor(r),0,this._layers.length-1);return this._layers[r]}GetLayerByName(r){return this._layersByName.get(r.toLowerCase())||null}GetLayerBySID(r){return this._layersBySid.get(r)||null}_SetAllLayersProjectionChanged(){for(const r of this._layers)r._SetProjectionMatrixChanged()}_SetAllLayersMVChanged(){for(const r of this._layers)r._SetMVMatrixChanged()}SaveTransform(){return{scrollX:this.GetScrollX(), scrollY:this.GetScrollY(),scale:this.GetScale(),angle:this.GetAngle(),vpX:this.GetVanishingPointX(),vpY:this.GetVanishingPointY()}}RestoreTransform(r){this.SetScrollX(r.scrollX);this.SetScrollY(r.scrollY);this.SetScale(r.scale);this.SetAngle(r.angle);this.SetVanishingPointXY(r.vpX,r.vpY)}HasOpaqueBottomLayer(){for(const r of this._layers)if(r.ShouldDraw())return r._IsOpaque();return!1}GetLayoutBackgroundColor(){for(const r of this._layers)if(r.ShouldDraw()&&r._IsOpaque())return f.copyRgb(r.GetBackgroundColor()), f.setA(1),f;f.setRgba(0,0,0,0);return f}IsFirstVisit(){return this._isFirstVisit}_GetInitialObjectClasses(){return[...this._initialObjectClasses]}_AddInitialObjectClass(r){if(r.IsInContainer())for(const w of r.GetContainer().GetObjectTypes())this._initialObjectClasses.add(w);else this._initialObjectClasses.add(r)}_GetTextureLoadedObjectTypes(){return[...this._textureLoadedTypes]}_Load(r,w){if(r===this||!w)return Promise.resolve();r&&(e.CopySet(this._textureLoadedTypes,r._textureLoadedTypes),r._textureLoadedTypes.clear()); r=[];for(const y of this._initialObjectClasses)this._textureLoadedTypes.has(y)||(r.push(y.LoadTextures(w)),this._textureLoadedTypes.add(y));return Promise.all(r)}async MaybeLoadTexturesFor(r){if(r.IsFamily())throw Error("cannot load textures for family");var w=this._runtime.GetRenderer();!w||w.IsContextLost()||this._textureLoadedTypes.has(r)||(this._textureLoadedTypes.add(r),w=r.LoadTextures(w),this._AddPendingTextureLoadPromise(w),await w,r.OnDynamicTextureLoadComplete(),this._runtime.UpdateRender())}_AddPendingTextureLoadPromise(r){this._textureLoadPendingPromises.add(r); r.then(()=>this._textureLoadPendingPromises.delete(r)).catch(()=>this._textureLoadPendingPromises.delete(r))}WaitForPendingTextureLoadsToComplete(){return Promise.all([...this._textureLoadPendingPromises])}MaybeUnloadTexturesFor(r){if(r.IsFamily()||0<r.GetInstanceCount())throw Error("cannot unload textures");const w=this._runtime.GetRenderer();w&&this._textureLoadedTypes.has(r)&&(this._textureLoadedTypes.delete(r),r.ReleaseTextures(w))}_Unload(r,w){if(r!==this&&w)for(const y of this._textureLoadedTypes)y.IsGlobal()|| r._initialObjectClasses.has(y)||(y.ReleaseTextures(),this._textureLoadedTypes.delete(y))}_OnWebGLContextLost(){this._textureLoadedTypes.clear()}async _StartRunning(r){const w=this._runtime,y=this._layoutManager,C=w.GetEventSheetManager();this._eventSheetName&&(this._eventSheet=C.GetEventSheetByName(this._eventSheetName),this._eventSheet._UpdateDeepIncludes());y._SetMainRunningLayout(this);this._width=this._originalWidth;this._height=this._originalHeight;this._scrollX=w.GetOriginalViewportWidth()/ 2;this._scrollY=w.GetOriginalViewportHeight()/2;this.BoundScrolling();this._MoveGlobalObjectsToThisLayout(r);this._runtime.SetUsingCreatePromises(!0);this._CreateInitialInstances();this._isFirstVisit||this._CreatePersistedInstances();this._CreateAndLinkContainerInstances(this._createdInstances);this._CreateInitialNonWorldInstances();y.ClearPendingChangeLayout();w.FlushPendingInstances();this._runtime.SetUsingCreatePromises(!1);const D=this._runtime.GetCreatePromises();await Promise.all(D);e.clearArray(D); if(!w.IsLoadingState()){for(const G of this._createdInstances)G.SetupInitialSceneGraphConnections();for(const G of this._createdInstances)G._TriggerOnCreated()}e.clearArray(this._createdInstances);await Promise.all([...this._initialObjectClasses].map(G=>G.PreloadTexturesWithInstances(this._runtime.GetRenderer())));r&&(w.Dispatcher().dispatchEvent(new e.Event("beforefirstlayoutstart")),await w.DispatchUserScriptEventAsyncWait(new e.Event("beforeprojectstart")));await this.DispatchUserScriptEventAsyncWait(new e.Event("beforelayoutstart")); w.IsLoadingState()||await w.TriggerAsync(e.Plugins.System.Cnds.OnLayoutStart,null,null);await this.DispatchUserScriptEventAsyncWait(new e.Event("afterlayoutstart"));r&&(w.Dispatcher().dispatchEvent(new e.Event("afterfirstlayoutstart")),await w.DispatchUserScriptEventAsyncWait(new e.Event("afterprojectstart")));C._RunQueuedTriggers(y);await this.WaitForPendingTextureLoadsToComplete();this._SetAllLayersProjectionChanged();this._SetAllLayersMVChanged();this._isFirstVisit=!1}_MoveGlobalObjectsToThisLayout(r){for(const y of this._runtime.GetAllObjectClasses())if(!y.IsFamily()&& y.IsWorldType())for(const C of y.GetInstances()){const D=C.GetWorldInfo();var w=D.GetLayer();w=e.clamp(w.GetIndex(),0,this._layers.length-1);w=this._layers[w];D._SetLayer(w);w._MaybeAddInstance(C)}if(!r)for(const y of this._layers)y._SortInstancesByLastCachedZIndex(!1)}_CreateInitialInstances(){for(const r of this._layers)r.CreateInitialInstances(this._createdInstances),r.UpdateViewport(),r._Start()}_CreatePersistedInstances(){let r=!1;for(const [y,C]of Object.entries(this._persistData)){const D= this._runtime.GetObjectClassBySID(parseInt(y,10));if(D&&!D.IsFamily()&&D.HasPersistBehavior()){for(const G of C){var w=null;if(D.IsWorldType()&&(w=this.GetLayerBySID(G.w.l),!w))continue;w=this._runtime.CreateInstanceFromData(D,w,!1,0,0,!0);w.LoadFromJson(G);r=!0;this._createdInstances.push(w)}e.clearArray(C)}}for(const y of this._layers)y._SortInstancesByLastCachedZIndex(!0),y.SetZIndicesChanged();r&&(this._runtime.FlushPendingInstances(),this._runtime._RefreshUidMap())}_CreateAndLinkContainerInstances(r){for(const y of r){if(!y.IsInContainer())continue; const C=y.GetWorldInfo(),D=y.GetIID();for(const G of y.GetObjectClass().GetContainer().objectTypes())if(G!==y.GetObjectClass()){var w=G.GetInstances();w.length>D?y._AddSibling(w[D]):(w=C?this._runtime.CreateInstanceFromData(G,C.GetLayer(),!0,C.GetX(),C.GetY(),!0):this._runtime.CreateInstanceFromData(G,null,!0,0,0,!0),this._runtime.FlushPendingInstances(),G._UpdateIIDs(),y._AddSibling(w),r.push(w))}}}_CreateInitialNonWorldInstances(){for(const r of this._initialNonWorld)this._runtime.GetObjectClassByIndex(r[1]).IsInContainer()|| this._runtime.CreateInstanceFromData(r,null,!0)}_CreateGlobalNonWorlds(){const r=[],w=this._initialNonWorld;let y=0;for(let C=0,D=w.length;C<D;++C){const G=w[C],K=this._runtime.GetObjectClassByIndex(G[1]);K.IsGlobal()?K.IsInContainer()&&K.GetContainer().HasAnyWorldType()||r.push(this._runtime.CreateInstanceFromData(G,null,!0)):(w[y]=G,++y)}e.truncateArray(w,y);this._runtime.FlushPendingInstances();this._CreateAndLinkContainerInstances(r)}RecreateInitialObjects(r,w,y,C,D,G){if(y)return y.RecreateInitialObjects(r, w,C,D,G);y=[];for(const K of this._layers)y.push(K.RecreateInitialObjects(r,w,C,D,G));return y.flat()}async _StopRunning(){const r=this._layoutManager;this._runtime.IsLoadingState()||await this._runtime.TriggerAsync(e.Plugins.System.Cnds.OnLayoutEnd,null,null);r.SetIsEndingLayout(!0);this._runtime.GetEventSheetManager().ClearAllScheduledWaits();this._isFirstVisit||this._SavePersistData();for(const w of this._layers)w._End();for(const w of this._runtime.GetAllObjectClasses())if(!(w.IsGlobal()||w.IsWorldType()|| w.GetPlugin().IsSingleGlobal()||w.IsFamily())){for(const y of w.GetInstances())this._runtime.DestroyInstance(y);this._runtime.FlushPendingInstances()}r.SetIsEndingLayout(!1);r.GetMainRunningLayout()===this&&r._SetMainRunningLayout(null)}_SaveInstanceToPersist(r){const w=r.GetObjectClass().GetSID().toString();this._persistData.hasOwnProperty(w)||(this._persistData[w]=[]);this._persistData[w].push(r.SaveToJson())}_SavePersistData(){for(const r of this._layers){r._UpdateZIndices();for(const w of r._GetInstances()){const y= w.GetObjectClass();!y.IsGlobal()&&y.HasPersistBehavior()&&this._SaveInstanceToPersist(w)}}}ResetPersistData(){this._persistData={};this._isFirstVisit=!0}GetRenderTarget(){return this._curRenderTarget}UsesOwnTexture(){return"low"===this._runtime.GetCanvasManager().GetCurrentFullscreenScalingQuality()||this._runtime.UsesAnyBackgroundBlending()||"low-latency"===this._runtime.GetCompositingMode()||this._effectList.HasAnyActiveEffect()||this._runtime.GetRenderer().IsWebGL()&&this._runtime.Uses3DFeatures()}_CanFastPathDrawLayout(r){return 0=== r.length?!0:2<=r.length?!1:!r[0].GetShaderProgram().MustPreDraw()}Draw(r){var w=this._runtime.GetCanvasManager();const y=this.UsesOwnTexture();var C=null;y?("low-latency"!==this._runtime.GetCompositingMode()&&(r.SetRenderTarget(null),r.ClearRgba(0,0,0,0)),C={sampling:this._runtime.GetSampling(),isSampled:r.IsWebGPU()||this._runtime.UsesAnyBackgroundBlending()||this._effectList.HasAnyActiveEffect()},"low"===w.GetCurrentFullscreenScalingQuality()&&(C.width=w.GetDrawWidth(),C.height=w.GetDrawHeight()), C=this._runtime.GetAdditionalRenderTarget(C),r.SetRenderTarget(C)):r.SetRenderTarget(null);r.Clear(this.GetLayoutBackgroundColor());this._runtime.Uses3DFeatures()&&r.ClearDepth();this._curRenderTarget=C;for(var D of this._layers)D.UpdateViewport(),D.ShouldDraw()&&g.push(D);for(let G=0,K=g.length;G<K;){w=g[G];if(w.Has3DCamera()&&!w.UsesOwnTexture()){k.push(w);for(D=G+1;D<K;++D){const B=g[D];if(B.Has3DCamera()&&!B.UsesOwnTexture())k.push(g[D]);else break}if(2<=k.length){this._Draw3DLayers(r,C,k);G+= k.length;e.clearArray(k);continue}e.clearArray(k)}w.Draw(r,C,0===G);++G}e.clearArray(g);y&&(r.SetDepthEnabled(!1),this._DrawLayoutOwnTextureToRenderTarget(r,C));this._curRenderTarget=null}_DrawLayoutOwnTextureToRenderTarget(r,w){const y=this._effectList.GetActiveEffectTypes(),C=this._runtime;if(this._CanFastPathDrawLayout(y)){r.SetRenderTarget(null);if(1===y.length){var D=y[0];const G=D.GetShaderProgram();r.SetProgram(G);d.set(0,0,1,1);c.set(0,0,C.GetViewportWidth(),C.GetViewportHeight());D=this._effectList.GetEffectParametersForIndex(D.GetIndex()); r.SetProgramParameters(null,a,d,d,c,1/C.GetDrawWidth(),1/C.GetDrawHeight(),this.GetScale(),this.GetAngle(),C.GetGameTime(),D);G.IsAnimated()&&C.UpdateRender()}else r.SetTextureFillMode();0===y.length?r.CopyRenderTarget(w):(r.SetAlphaBlend(),r.ResetColor(),r.DrawRenderTarget(w));r.InvalidateRenderTarget(w);C.ReleaseAdditionalRenderTarget(w)}else e.RenderEffectChain(r,C,this,null,y)}_Draw3DLayers(r,w,y){var C=this._runtime.GetCanvasManager();r.SetDepthEnabled(!0);for(var D of y)D._UpdateZIndices(), e.appendArray(m,D._GetInstancesInDrawOrder());y=y[0];D=null;if(this._runtime.IsGPUProfiling())if(r.IsWebGL()){if(C=C.GetLayerTimingsBuffer(y))D=C.AddTimeElapsedQuery(),r.StartQuery(D)}else r.IsWebGPU()&&r.WriteTimestamp(2*(y.GetIndex()+1));for(let F=0,J=m.length;F<J;){var G=m[F],K=G.GetWorldInfo(),B=K.GetLayer();if(K.IsVisible()&&K.IsInViewport3D(B._GetViewFrustum())){(!G.RendersToOwnZPlane()||0<K.GetDepth())&&x.push(G);var A=G.GetWorldInfo().GetTotalZElevation();u.push(G);for(C=F+1;C<J;++C){const L= m[C],Q=L.GetWorldInfo();if(Q.IsVisible()&&Q.IsInViewport3D(Q.GetLayer()._GetViewFrustum())){if(Q.GetTotalZElevation()!==A)break;L.RendersToOwnZPlane()?(0<Q.GetDepth()&&x.push(L),u.push(L)):x.push(L)}}if(1!==u.length||u[0].MustMitigateZFighting()){this._Draw3DLayersCoplanarInstances(r,w,u);for(let L=0,Q=x.length;L<Q;++L)G=x[L],K=G.GetWorldInfo(),B=K.GetLayer(),K._SetDrawNonBackFacesOnly(!0),t(B,r),B._DrawInstanceMaybeWithEffects(G,K,r,w),K._SetDrawNonBackFacesOnly(!1)}else{t(B,r);B._DrawInstanceMaybeWithEffects(G, K,r,w);for(let L=0,Q=x.length;L<Q;++L)K=x[L],K!==G&&(B=K.GetWorldInfo(),A=B.GetLayer(),t(A,r),A._DrawInstanceMaybeWithEffects(K,B,r,w))}F=C;e.clearArray(u);e.clearArray(x)}else++F}D&&r.EndQuery(D);this._runtime.IsGPUProfiling()&&r.IsWebGPU()&&r.WriteTimestamp(2*(y.GetIndex()+1)+1);e.clearArray(m);q=null}_Draw3DLayersCoplanarInstances(r,w,y){r.CoplanarStartStencilPass();for(let K=0,B=y.length;K<B;++K){var C=y[K],D=C.GetWorldInfo(),G=D.GetLayer();D._SetDrawBackFaceOnly(!0);t(G,r);G._DrawInstance(C, D,r)}r.CoplanarStartColorPass();for(let K=0,B=y.length;K<B;++K)C=y[K],D=C.GetWorldInfo(),G=D.GetLayer(),t(G,r),G._DrawInstanceMaybeWithEffects(C,D,r,w),D._SetDrawBackFaceOnly(!1);r.CoplanarRestoreStandardRendering()}_SaveToJson(){const r={sx:this.GetScrollX(),sy:this.GetScrollY(),s:this.GetScale(),a:this.GetAngle(),w:this.GetWidth(),h:this.GetHeight(),ortho:this.IsOrthographicProjection(),vpX:this.GetVanishingPointX(),vpY:this.GetVanishingPointY(),fv:this._isFirstVisit,persist:this._persistData,fx:this._effectList.SaveToJson(), layers:{}};for(const w of this._layers)r.layers[w.GetSID().toString()]=w._SaveToJson();return r}_LoadFromJson(r){this._scrollX=r.sx;this._scrollY=r.sy;this._scale=r.s;this._angle=r.a;this._width=r.w;this._height=r.h;this._isOrthographicProjection=!!r.ortho;r.hasOwnProperty("vpX")&&(this._vanishingPointX=r.vpX);r.hasOwnProperty("vpY")&&(this._vanishingPointY=r.vpY);this._isFirstVisit=!!r.fv;this._persistData=r.persist;this._effectList.LoadFromJson(r.fx);for(const [w,y]of Object.entries(r.layers))r= parseInt(w,10),(r=this.GetLayerBySID(r))&&r._LoadFromJson(y);this._SetAllLayersProjectionChanged();this._SetAllLayersMVChanged()}GetILayout(){return this._iLayout}UserScriptDispatcher(){return this._userScriptDispatcher}DispatchUserScriptEvent(r){r.layout=this.GetILayout();var w=this._runtime;(w=w.IsDebug()&&!w.GetEventSheetManager().IsInEventEngine())&&b.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(r);w&&b.AddScriptTime()}DispatchUserScriptEventAsyncWait(r){r.layout=this.GetILayout(); return this._userScriptDispatcher.dispatchEventAndWaitAsync(r)}}} {"use strict";const e=self.C3;e.LayoutManager=class extends e.DefendedBase{constructor(b){super();this._runtime=b;this._allLayouts=[];this._layoutsByName=new Map;this._layoutsBySid=new Map;this._mainRunningLayout=null;this._runningSubLayouts=[];this._firstLayout=null;this._isEndingLayout=0;this._pendingChangeLayout=null}Release(){this._pendingChangeLayout=this._firstLayout=this._mainRunningLayout=this._runtime=null;e.clearArray(this._allLayouts);this._layoutsByName.clear();this._layoutsBySid.clear(); e.clearArray(this._runningSubLayouts)}Create(b){b=e.New(e.Layout,this,this._allLayouts.length,b);this._allLayouts.push(b);this._layoutsByName.set(b.GetName().toLowerCase(),b);this._layoutsBySid.set(b.GetSID(),b)}GetRuntime(){return this._runtime}SetFirstLayout(b){this._firstLayout=b}GetFirstLayout(){if(this._firstLayout)return this._firstLayout;if(this._allLayouts.length)return this._allLayouts[0];throw Error("no first layout");}GetLayoutByName(b){return this._layoutsByName.get(b.toLowerCase())|| null}GetLayoutBySID(b){return this._layoutsBySid.get(b)||null}GetLayoutByIndex(b){b=e.clamp(Math.floor(b),0,this._allLayouts.length-1);return this._allLayouts[b]}GetLayout(b){return"number"===typeof b?this.GetLayoutByIndex(b):this.GetLayoutByName(b.toString())}GetAllLayouts(){return this._allLayouts}_SetMainRunningLayout(b){this._mainRunningLayout=b}GetMainRunningLayout(){return this._mainRunningLayout}_AddRunningSubLayout(b){if(this._runningSubLayouts.includes(b))throw Error("layout already running"); this._runningSubLayouts.push(b)}_RemoveRunningSubLayout(b){b=this._runningSubLayouts.indexOf(b);if(-1===b)throw Error("layout not running");this._runningSubLayouts.splice(b,1)}*runningLayouts(){this._mainRunningLayout&&(yield this._mainRunningLayout);this._runningSubLayouts.length&&(yield*this._runningSubLayouts)}IsLayoutRunning(b){return this._mainRunningLayout===b||this._runningSubLayouts.includes(b)}SetIsEndingLayout(b){if(b)this._isEndingLayout++;else{if(0>=this._isEndingLayout)throw Error("already unset"); this._isEndingLayout--}}IsEndingLayout(){return 0<this._isEndingLayout}ChangeMainLayout(b){this._pendingChangeLayout=b}ClearPendingChangeLayout(){this._pendingChangeLayout=null}IsPendingChangeMainLayout(){return!!this._pendingChangeLayout}GetPendingChangeMainLayout(){return this._pendingChangeLayout}SetAllLayerProjectionChanged(){const b=this.GetMainRunningLayout();b&&b._SetAllLayersProjectionChanged()}SetAllLayerMVChanged(){const b=this.GetMainRunningLayout();b&&b._SetAllLayersMVChanged()}}} {"use strict";const e=self.C3;class b{constructor(){this.runtime=this.renderer=null;this.surfaceHeight=this.surfaceWidth=this.drawHeight=this.drawWidth=0;this.layoutRect=new e.Rect;this.rcTexBounce=new e.Rect;this.rcTexDest=new e.Rect;this.rcTexOrigin=new e.Rect;this.screenRect=new e.Rect;this.clearRect=new e.Rect;this.srcRect=new e.Rect;this.fxTex=[null,null];this.fxIndex=0;this.otherFxIndex=1;this.layerAngle=this.layerScale=this.boxExtendVertical=this.boxExtendHorizontal=0;this.renderTarget=this.wi= this.inst=this.layer=this.layout=null;this.didChangeTransform=this.postDraw=this.preDraw=!1;this.opts=null}Clear(){this.opts=this.renderTarget=this.wi=this.inst=this.layer=this.layout=this.runtime=this.renderer=null}ShouldPreDraw(t){t=t.GetShaderProgram();if(t.MustPreDraw())return!0;if(this.inst)return t.UsesDest()&&(0!==this.wi.GetAngle()||0>this.wi.GetWidth()||0>this.wi.GetHeight())||0!==this.boxExtendHorizontal||0!==this.boxExtendVertical||!this.wi.HasDefaultColor()||this.inst.MustPreDraw();if(this.layer)return!this.layer.HasDefaultColor()}ShouldPostDraw(t){t= t.GetShaderProgram();return t.UsesDest()||t.UsesCrossSampling()||this.layout&&"low"===this.runtime.GetCanvasManager().GetCurrentFullscreenScalingQuality()}GetEffectRenderTarget(t){if(0!==t&&1!==t)throw Error("invalid effect target");const r=this.fxTex;if(!r[t]){var w=this.runtime;const y=w.GetCanvasManager();w={sampling:w.GetSampling()};"low"===y.GetCurrentFullscreenScalingQuality()&&(w.width=y.GetDrawWidth(),w.height=y.GetDrawHeight());r[t]=y.GetAdditionalRenderTarget(w)}return r[t]}ReleaseEffectRenderTargets(){const t= this.fxTex,r=this.runtime.GetCanvasManager();t[0]&&(r.ReleaseAdditionalRenderTarget(t[0]),t[0]=null);t[1]&&(r.ReleaseAdditionalRenderTarget(t[1]),t[1]=null)}}const a=[];let d=0;function c(){d===a.length&&a.push(new b);return a[d++]}function f(t){t.ReleaseEffectRenderTargets();t.Clear();d--}const l=new e.Quad;let g=!1;async function k(t,r,w){r=await e.Gfx.WebGLRenderTarget.DebugReadPixelsToBlob(r,w);r=URL.createObjectURL(r);console.log("[FX] "+t+" "+(w?"":" [to display]")+": ",r)}e.RenderEffectChain= function(t,r,w,y,C,D){const G=c();G.renderer=t;G.runtime=r;if(w instanceof e.Instance)G.inst=w,G.wi=G.inst.GetWorldInfo();else if(w instanceof e.Layer)G.layer=w;else if(w instanceof e.Layout)G.layout=w;else throw Error("invalid effects object");w=r.GetCanvasManager();G.renderTarget=y;G.drawWidth=w.GetDrawWidth();G.drawHeight=w.GetDrawHeight();G.surfaceWidth=G.drawWidth;G.surfaceHeight=G.drawHeight;G.fxIndex=0;G.otherFxIndex=1;G.boxExtendHorizontal=0;G.boxExtendVertical=0;G.screenRect.set(0,0,G.drawWidth, G.drawHeight);G.clearRect.set(0,0,G.drawWidth,G.drawHeight);G.didChangeTransform=!1;G.opts=D;G.inst?(y=G.wi,G.layerScale=y.GetLayer().GetRenderScale(),G.layerAngle=y.GetLayer().GetAngle(),G.layoutRect.copy(y.GetBoundingBox())):G.layer?(y=G.layer,G.layerScale=y.GetRenderScale(),G.layerAngle=y.GetAngle(),G.layoutRect.copy(y.GetViewport())):(y=G.layout,G.layerScale=y.GetScale(),G.layerAngle=y.GetAngle(),G.layoutRect.set(0,0,G.drawWidth,G.drawHeight));G.inst?m(G,C):(G.rcTexBounce.set(0,0,G.drawWidth/ G.surfaceWidth,G.drawHeight/G.surfaceHeight),G.rcTexDest.copy(G.rcTexBounce),G.rcTexOrigin.copy(G.rcTexBounce),G.rcTexBounce.swapTopBottom(),G.rcTexDest.swapTopBottom(),G.rcTexOrigin.swapTopBottom());t.SetAlphaBlend();t.ResetColor();t.SetBaseZ(0);t.SetCurrentZ(0);G.preDraw=G.ShouldPreDraw(C[0]);G.preDraw&&u(G);t.ResetColor();y=C.length-1;G.postDraw=G.ShouldPostDraw(C[y]);for(let K=0,B=C.length;K<B;++K)D=C[K],w=D.GetShaderProgram(),t.SetProgram(w),w.IsAnimated()&&r.UpdateRender(),0!==K||G.preDraw? (t.SetCopyBlend(),n(G,D,K===y&&!G.postDraw,K)):x(G,D),0===G.fxIndex?(G.fxIndex=1,G.otherFxIndex=0):(G.fxIndex=0,G.otherFxIndex=1);G.postDraw&&q(G,C);t=G.didChangeTransform;f(G);g=!1;return t};function m(t,r){for(let F=0,J=r.length;F<J;++F){var w=r[F].GetShaderProgram();t.boxExtendHorizontal+=w.GetBoxExtendHorizontal();t.boxExtendVertical+=w.GetBoxExtendVertical()}var y=t.wi;r=y.GetLayer();var C=r.GetAngle();w=y.GetBoundingBox();var D=y.GetTotalZElevation();y=y.GetDepth();let [G,K]=r.LayerToDrawSurface(w.getLeft(), w.getTop(),D),[B,A]=r.LayerToDrawSurface(w.getRight(),w.getBottom(),D);if(0!==C||0<y){const [F,J]=r.LayerToDrawSurface(w.getRight(),w.getTop(),D),[L,Q]=r.LayerToDrawSurface(w.getLeft(),w.getBottom(),D);if(0<y){C=D+y;const [T,V]=r.LayerToDrawSurface(w.getLeft(),w.getTop(),C),[aa,ha]=r.LayerToDrawSurface(w.getRight(),w.getTop(),C),[ja,oa]=r.LayerToDrawSurface(w.getRight(),w.getBottom(),C),[ya,Ba]=r.LayerToDrawSurface(w.getLeft(),w.getBottom(),C);r=Math.min(G,B,F,L,T,aa,ja,ya);B=Math.max(G,B,F,L,T,aa, ja,ya);G=r;r=Math.min(K,A,J,Q,V,ha,oa,Ba);A=Math.max(K,A,J,Q,V,ha,oa,Ba);K=r}else r=Math.min(G,B,F,L),B=Math.max(G,B,F,L),G=r,r=Math.min(K,A,J,Q),A=Math.max(K,A,J,Q),K=r}r=t.screenRect;w=t.rcTexOrigin;C=t.rcTexDest;D=t.clearRect;y=t.rcTexBounce;r.set(G,K,B,A);r.shuntY(t.drawHeight);w.copy(r);w.divide(t.surfaceWidth,t.surfaceHeight);w.swapTopBottom();r.inflate(t.boxExtendHorizontal,t.boxExtendVertical);C.copy(r);C.divide(t.surfaceWidth,t.surfaceHeight);C.swapTopBottom();D.copy(r);D.roundOuter();D.inflate(t.boxExtendHorizontal+ 1,t.boxExtendVertical+1);r.clamp(0,0,t.drawWidth,t.drawHeight);D.clamp(0,0,t.drawWidth,t.drawHeight);y.copy(r);y.divide(t.surfaceWidth,t.surfaceHeight);y.swapTopBottom()}function u(t){const r=t.renderer;r.SetTextureFillMode();const w=t.GetEffectRenderTarget(t.fxIndex);r.SetRenderTarget(w);var y=t.opts;y&&y.preTransform&&y.preTransform();r.ClearRect2(t.clearRect);t.inst?(r.SetColor(t.wi.GetPremultipliedColor()),r.SetCurrentZ(t.wi.GetTotalZElevation()),t.inst.Draw(r),r.SetCurrentZ(0)):(y=(t.layer|| t.layout).GetRenderTarget(),t.layer?r.SetColor(t.layer.GetPremultipliedColor()):r.ResetColor(),r.DrawRenderTarget(y),r.InvalidateRenderTarget(y),t.runtime.GetCanvasManager().ReleaseAdditionalRenderTarget(y));t.rcTexDest.clampFlipped(0,1,1,0);t.fxIndex=1;t.otherFxIndex=0;g&&k("Pre-draw",r,w)}function x(t,r){const w=t.renderer,y=t.runtime,C=t.GetEffectRenderTarget(t.fxIndex);w.SetRenderTarget(C);var D=t.opts;D&&D.preTransform&&D.preTransform();w.ClearRect2(t.clearRect);if(t.inst){const [G,K]=t.inst.GetCurrentSurfaceSize(); (D=t.inst.GetCurrentTexRect())?t.srcRect.copy(D):t.srcRect.set(0,0,0,0);r=t.wi.GetInstanceEffectList().GetEffectParametersForIndex(r.GetIndex());w.SetProgramParameters(t.renderTarget,t.rcTexDest,t.srcRect,t.srcRect,t.layoutRect,1/G,1/K,t.layerScale,t.layerAngle,y.GetGameTime(),r);w.SetCurrentZ(t.wi.GetTotalZElevation());t.inst.Draw(w);w.SetCurrentZ(0);t.rcTexDest.clampFlipped(0,1,1,0);t.screenRect.shuntY(t.drawHeight)}else r=(t.layer||t.layout).GetEffectList().GetEffectParametersForIndex(r.GetIndex()), w.SetProgramParameters(t.renderTarget,t.rcTexDest,t.rcTexBounce,t.rcTexOrigin,t.layoutRect,1/t.drawWidth,1/t.drawHeight,t.layerScale,t.layerAngle,y.GetGameTime(),r),t=(t.layer||t.layout).GetRenderTarget(),g&&k("Layer target",w,t),w.DrawRenderTarget(t),w.InvalidateRenderTarget(t),y.GetCanvasManager().ReleaseAdditionalRenderTarget(t);g&&k("First bounce",w,C)}function n(t,r,w,y){const C=t.renderer,D=t.runtime;0===y&&t.preDraw&&t.inst&&t.screenRect.shuntY(t.drawHeight);w?(t.inst?C.SetBlendMode(t.wi.GetBlendMode()): t.layer&&C.SetBlendMode(t.layer.GetBlendMode()),w=t.renderTarget,C.SetRenderTarget(w)):(w=t.GetEffectRenderTarget(t.fxIndex),C.SetRenderTarget(w),C.ClearRect2(t.clearRect));r=t.inst?t.wi.GetInstanceEffectList().GetEffectParametersForIndex(r.GetIndex()):(t.layer||t.layout).GetEffectList().GetEffectParametersForIndex(r.GetIndex());C.SetProgramParameters(t.renderTarget,t.rcTexDest,t.rcTexBounce,t.rcTexOrigin,t.layoutRect,1/t.surfaceWidth,1/t.surfaceHeight,t.layerScale,t.layerAngle,D.GetGameTime(),r); r=t.GetEffectRenderTarget(t.otherFxIndex);C.SetTexture(r.GetTexture());D.GetCanvasManager().SetDeviceTransform(C);t.didChangeTransform=!0;l.setFromRect(t.screenRect);C.Quad3(l,t.rcTexBounce);t.inst||C.InvalidateRenderTarget(r);g&&k("Bounce "+y,C,w)}function q(t,r){r=t.renderer;if(t.layout)r.SetTextureFillMode(),r.SetRenderTarget(t.renderTarget),t=t.GetEffectRenderTarget(t.otherFxIndex),r.CopyRenderTarget(t),r.InvalidateRenderTarget(t);else{var w=t.runtime.GetCanvasManager();"low"===w.GetCurrentFullscreenScalingQuality()? (r.SetTextureFillMode(),w.SetDeviceTransform(r,w.GetDrawWidth(),w.GetDrawHeight()),t.didChangeTransform=!0):r.SetDeviceTransformTextureFillMode();t.inst?r.SetBlendMode(t.wi.GetBlendMode()):t.layer&&r.SetBlendMode(t.layer.GetBlendMode());r.SetRenderTarget(t.renderTarget);w=t.GetEffectRenderTarget(t.otherFxIndex);r.SetTexture(w.GetTexture());l.setFromRect(t.screenRect);r.Quad3(l,t.rcTexBounce);t.inst||r.InvalidateRenderTarget(w);g&&k("Post-draw",r,t.renderTarget)}}} {"use strict";const e=self.C3,b=/<(.+?)>/g;e.TimelineManager=class extends e.DefendedBase{constructor(a){super();this._runtime=a;this._timelineDataManager=e.New(e.TimelineDataManager);this._pluginInstance=null;this._timelines=[];this._timelinesByName=new Map;this._objectClassToTimelineMap=new Map;this._timelinesCreatedByTemplate=new Map;this._scheduledTimelines=[];this._playingTimelines=[];this._isTickingTimelines=this._changingLayout=this._hasRuntimeListeners=!1;this._tickFunc=()=>this._OnTick(); this._tick2Func=()=>this._OnTick2();this._beforeLayoutChange=()=>this._OnBeforeChangeLayout();this._layoutChange=()=>this._OnAfterChangeLayout();this._instanceDestroy=d=>this._OnInstanceDestroy(d.instance);this._afterLoad=d=>this._OnAfterLoad();this._destroyedWhileLoadingState=[]}Release(){this.RemoveRuntimeListeners();this._afterLoad=this._instanceDestroy=this._layoutChange=this._beforeLayoutChange=this._tick2Func=this._tickFunc=null;for(const a of this._timelines)a.Stop(),a.Release();e.clearArray(this._timelines); this._timelines=null;this._timelineDataManager.Release();this._timelineDataManager=null;e.clearArray(this._scheduledTimelines);this._scheduledTimelines=null;e.clearArray(this._playingTimelines);this._playingTimelines=null;this._timelinesByName.clear();this._timelinesByName=null;this._objectClassToTimelineMap.clear();this._objectClassToTimelineMap=null;this._timelinesCreatedByTemplate.clear();this._timelinesCreatedByTemplate=null;e.clearArray(this._destroyedWhileLoadingState);this._runtime=this._destroyedWhileLoadingState= null}AddRuntimeListeners(){const 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=e.TimelineState.CreateInitial(a,this);this.Add(a);this.SetTimelineObjectClassesToMap(a);this._timelinesCreatedByTemplate.set(a.GetName(),0)}CreateFromTemplate(a){var d=this.GetTimelineDataManager();a= a.GetTemplateName();d=d.Get(a);d=e.TimelineState.CreateFromTemplate(`${a}:${this._timelinesCreatedByTemplate.get(a)}`,d,this);this._IncreaseTemplateTimelinesCount(a);this.Add(d);return d}_IncreaseTemplateTimelinesCount(a){this._timelinesCreatedByTemplate.set(a,this._timelinesCreatedByTemplate.get(a)+1)}_SetCreatedTemplateTimelinesCount(){for(const a of this._timelines){if(a.IsTemplate())continue;const d=a.GetTemplateName();this._IncreaseTemplateTimelinesCount(d)}}_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.IsTemplate()||(e.arrayFindRemove(this._timelines,a),e.arrayFindRemove(this._scheduledTimelines,a),e.arrayFindRemove(this._playingTimelines,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,d){this._objectClassToTimelineMap.has(a)||this._objectClassToTimelineMap.set(a,new Set);this._objectClassToTimelineMap.get(a).add(d)}SetTimelineObjectClassesToMap(a){for(const d of a.GetObjectClasses())this.SetTimelineObjectClassToMap(d,a)}RemoveTimelineFromObjectClassMap(a){for(const [d,c]of this._objectClassToTimelineMap.entries())c.has(a)&&(c.delete(a),0===c.size&& this._objectClassToTimelineMap.delete(d))}GetTimelinesForObjectClass(a){if(this._objectClassToTimelineMap.has(a))return this._objectClassToTimelineMap.get(a)}GetTimelineOfTemplateForInstances(a,d){if(d)for(const c of this._timelines)if(d.every(f=>c.HasTrackInstance(f.instance,f.trackId))&&c.GetName().includes(a.GetName()))return c}GetTimelineByName(a){return this._timelinesByName.get(a.toLowerCase())||null}GetScheduledOrPlayingTimelineByName(a){for(const d of this._scheduledTimelines)if(d.GetName()=== a)return d;for(const d of this._playingTimelines)if(d.GetName()===a)return d;return null}*GetTimelinesByName(a){if(b.test(a)){b.lastIndex=0;let c;var d=new Set;do if(c=b.exec(a)){const f=c[1].split(",");for(const l of f)d.add(l)}while(c);for(const f of d.values())(a=this.GetTimelineByName(f))&&(yield a);d.clear()}else(d=this.GetTimelineByName(a))&&(yield d)}*GetTimelinesByTags(a){for(const d of this._timelines)d.HasTags(a)&&(yield d)}AddScheduledTimeline(a){this._scheduledTimelines.includes(a)||this._scheduledTimelines.push(a); this._MaybeEnableRuntimeListeners()}RemovePlayingTimeline(a){e.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(); e.arrayFindRemove(this._scheduledTimelines,a);this._MaybeDisableRuntimeListeners()}CompleteTimeline(a){a.SetPlaying(!1);a.SetScheduled(!1);a.SetMarkedForRemoval(!0)}CompleteTimelineAndResolve(a){this.CompleteTimeline(a);a.ResolvePlayPromise()}_OnTick(){if(!this.GetRuntime().IsLoadingState()&&this._hasRuntimeListeners&&!this._changingLayout){var a=!1;for(this._isTickingTimelines=!0;this._scheduledTimelines.length;){var d=this._scheduledTimelines.pop();d.SetInitialState();this._playingTimelines.push(d)}d= this._runtime.GetDt();var c=this._runtime.GetTimeScale();for(const f of this._playingTimelines){if(f.IsMarkedForRemoval())continue;const l=f.Tick(d,c);!a&&l&&(a=!0)}this._isTickingTimelines=!1;a&&this.GetRuntime().UpdateRender()}}_OnTick2(){if(!this.GetRuntime().IsLoadingState()&&this._hasRuntimeListeners&&!this._changingLayout){var a;for(const d of this._playingTimelines)d.IsMarkedForRemoval()&&(a||(a=new Set),this._MaybeExecuteTimelineFinishTriggers(d),a.add(d));a&&e.arrayRemoveAllInSet(this._playingTimelines, a);this._MaybeDisableRuntimeListeners()}}_MaybeExecuteTimelineFinishTriggers(a){a.IsReleased()||a.HasValidTracks()&&a.IsComplete()&&a.InitialStateSet()&&a.FinishTriggers()}_MaybeEnableRuntimeListeners(){this._hasRuntimeListeners||(this._hasRuntimeListeners=!0)}_MaybeDisableRuntimeListeners(){this._playingTimelines.length||this._scheduledTimelines.length||this._isTickingTimelines||(this._hasRuntimeListeners=!1)}_OnBeforeChangeLayout(){for(this._changingLayout=!0;this._scheduledTimelines.length;)this.DeScheduleTimeline(this._scheduledTimelines.pop()); const a=new Set;for(const d of this._playingTimelines)d._OnBeforeChangeLayout()&&a.add(d);e.arrayRemoveAllInSet(this._playingTimelines,a);this._MaybeDisableRuntimeListeners();for(const d of this._timelines)d.CleanCaches()}_OnAfterChangeLayout(){this._changingLayout=!1}_OnInstanceDestroy(a){var d=a.GetObjectClass();if(d=this.GetTimelinesForObjectClass(d))if(this._runtime.IsLoadingState())this._destroyedWhileLoadingState.push(a);else for(const c of d)c.IsTemplate()||(c.IsReleased()?this.Remove(c):c.HasValidTracks()|| (this._MaybeExecuteTimelineFinishTriggers(c),this.Remove(c)))}_OnAfterLoad(){for(const a of this._destroyedWhileLoadingState)this._OnInstanceDestroy(a);e.clearArray(this._destroyedWhileLoadingState)}_SaveToJson(){return{timelinesJson:this._SaveTimelinesToJson(),scheduledTimelinesJson:this._SaveScheduledTimelinesToJson(),playingTimelinesJson:this._SavePlayingTimelinesToJson(),hasRuntimeListeners:this._hasRuntimeListeners,changingLayout:this._changingLayout,isTickingTimelines:this._isTickingTimelines}}_LoadFromJson(a){a&& (this._ClearCreatedTemplateTimelinesCount(),this._LoadTimelinesFromJson(a.timelinesJson),this._LoadScheduledTimelinesFromJson(a.scheduledTimelinesJson),this._LoadPlayingTimelinesFromJson(a.playingTimelinesJson),this._hasRuntimeListeners=!a.hasRuntimeListeners,this._changingLayout=!!a.changingLayout,this._isTickingTimelines=!!a.isTickingTimelines,this._SetCreatedTemplateTimelinesCount(),this._MaybeEnableRuntimeListeners(),this._MaybeDisableRuntimeListeners())}_SaveTimelinesToJson(){return this._timelines.map(a=> a._SaveToJson())}_LoadTimelinesFromJson(a){for(const d of a){a=this.GetTimelineByName(d.name);if(!a){a=this._GetTemplateNameFromJson(d);if(!a)continue;a=this.GetTimelineByName(a);a=this.CreateFromTemplate(a)}a._LoadFromJson(d);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)}_IsTimelineInJson(a,d){for(const c of d)if(c===a.GetName())return!0;return!1}_SaveTimelines(a){return a.map(d=>d.GetName())}_LoadTimelines(a,d){var c=new Set;for(const f of d)this._IsTimelineInJson(f,a)||c.add(f);e.arrayRemoveAllInSet(d,c);c=f=>l=>l.GetName()===f;for(const f of a)(a=this.GetTimelineByName(f))&&(d.find(c(f))||d.push(a))}}} {"use strict";const e=self.C3;e.TimelineState=class extends e.DefendedBase{constructor(b,a,d){super();this._runtime=d.GetRuntime();this._timelineManager=d;this._timelineDataItem=a;this._name=b;this._tracks=[];for(const c of this._timelineDataItem.GetTrackData().trackDataItems())this._tracks.push(e.TrackState.Create(this,c));this._playResolve=this._playPromise=null;this._playheadTime=e.New(e.KahanSum);this._playheadTime.Set(0);this._playbackRate=1;this._pingPongState=0;this._currentRepeatCount=1;this._initialStateSet= this._isScheduled=this._isPlaying=!1;this._complete=!0;this._markedForRemoval=this._released=!1;this._completedTick=-1;this._firstTick=this._finishedTriggers=this._isTemplate=this._implicitPause=!1;this._lastDelta=NaN;this._tags=[""];this._stringTags="";this._tagsChanged=!1}static CreateInitial(b,a){var d=a.GetTimelineDataManager();const c=d.GetNameId();d=d.Get(b[c]);b=e.New(e.TimelineState,b[c],d,a);b.SetIsTemplate(!0);return b}static CreateFromTemplate(b,a,d){return e.New(e.TimelineState,b,a,d)}static get WORLD_INSTANCE_BOX_CHANGE(){return 1}static get LAYOUT_RENDER_CHANGE(){return e.nextHighestPowerOfTwo(1)}Release(){if(!this.IsReleased()){this._timelineManager.DeScheduleTimeline(this); this._timelineManager.CompleteTimelineAndResolve(this);for(const b of this._tracks)b.Release();e.clearArray(this._tracks);this._tracks=null;this._playheadTime.Release();this._timelineDataItem=this._timelineManager=this._runtime=this._playheadTime=null;this._released=!0;this._playResolve=this._playPromise=null}}GetTimelineManager(){return this._timelineManager}GetRuntime(){return this._runtime}GetTracks(){return this._tracks}GetSimilarPropertyTracks(b,a,d){const c=[];for(const f of this._tracks){if(b!== f.GetInstance())continue;const l=f.GetPropertyTrack(d);l&&a.constructor===l.GetSourceAdapter().constructor&&c.push(l)}return c}HasTracks(){return!!this._tracks.length}GetTrackById(b){for(const a of this._tracks)if(e.equalsNoCase(a.GetId(),b))return a;return null}GetTrackByName(b){for(const a of this._tracks)if(!a.IsInstanceTrack()&&e.equalsNoCase(a.GetName(),b))return a;return null}SetName(b){this._name=b}GetName(){return this._name}GetTimelineDataItem(){return this._timelineDataItem}GetTemplateName(){return this._timelineDataItem.GetName()}GetTotalTime(){return this._timelineDataItem.GetTotalTime()}SetTotalTime(b){this._timelineDataItem.SetTotalTime(b)}GetStep(){return this._timelineDataItem.GetStep()}SetStep(b){this._timelineDataItem.SetStep(b)}GetInterpolationMode(){return this._timelineDataItem.GetInterpolationMode()}SetInterpolationMode(b){this._timelineDataItem.SetInterpolationMode(b)}GetResultMode(){return this._timelineDataItem.GetResultMode()}SetResultMode(b){this._timelineDataItem.GetResultMode(b)}SetEase(b){for(const a of this.GetTracks())a.SetEase(b)}GetLoop(){return this._timelineDataItem.GetLoop()}SetLoop(b){return this._timelineDataItem.SetLoop(b)}GetPingPong(){return this._timelineDataItem.GetPingPong()}SetPingPong(b){return this._timelineDataItem.SetPingPong(b)}GetRepeatCount(){return this._timelineDataItem.GetRepeatCount()}SetPlaybackRate(b){return this._playbackRate= b}GetPlaybackRate(){return this._playbackRate}IsForwardPlayBack(){return this.IsPlaying()?0<this._playbackRate:!0}GetPlayPromise(){return this._playPromise?this._playPromise:this._playPromise=new Promise(b=>{this._playResolve=b})}ResolvePlayPromise(){this._playPromise&&(this._playResolve(),this._playResolve=this._playPromise=null)}SetTags(b){this._tags=e.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=e.TimelineState._GetTagArray(b))&&b.length?b.every(e.TimelineState._HasTag,this):!1:!1}OnStarted(){e.Plugins.Timeline.Cnds.SetTriggerTimeline(this);this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimelineStarted);this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimelineStartedByName);this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimelineStartedByTags);this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnAnyTimelineStarted); e.Plugins.Timeline.Cnds.SetTriggerTimeline(null)}OnCompleted(){this._completedTick=this._runtime.GetTickCount()}FinishTriggers(){this._finishedTriggers||(this._finishedTriggers=!0,e.Plugins.Timeline.Cnds.SetTriggerTimeline(this),this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimelineFinished),this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimelineFinishedByName),this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimelineFinishedByTags),this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnAnyTimelineFinished), e.Plugins.Timeline.Cnds.SetTriggerTimeline(null))}SetPlaying(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.Get()}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._Interpolate(b,!1,!0,!0,a)&&this.GetRuntime().UpdateRender();this._OnSetTime()}_SetTime(b){0>b?this._playheadTime.Set(0): b>=this.GetTotalTime()?this._playheadTime.Set(this.GetTotalTime()):this._playheadTime.Set(b)}_OnSetTime(){e.Plugins.Timeline&&this.constructor===e.TimelineState&&(e.Plugins.Timeline.Cnds.SetTriggerTimeline(this),this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimeSet),this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimeSetByName),this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimeSetByTags),e.Plugins.Timeline.Cnds.SetTriggerTimeline(null))}_CanResume(){if(!this.GetLoop())if(this.GetPingPong()&& 1===this._pingPongState)if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())return!1}else{if(0>=this.GetTime())return!1}else if(!this.GetLoop()&&!this.GetPingPong())if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())return!1}else if(0>=this.GetTime())return!1;return!0}Resume(){this.IsReleased()||this._CanResume()&&this.Play(!0)}Play(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 d=this.GetTime();a=a?this._InterpolateBeforeChangeLayout(d):this._Interpolate(d,!1,!1,!0);b&&this._OnSetTime();a&&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.CompleteTimeline(this);this.ResetBeforeChangeLayout();return!0}SetInitialStateFromSetTime(){this.SetInitialState(!0)}SetInitialState(b){if(!this.IsMarkedForRemoval())if(b){this._firstTick=this._initialStateSet=!0;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());for(const a of this._tracks)a.SetInitialState()}else{this._firstTick=!0;for(const a of this._tracks)a.SetResumeState()}}Tick(b,a){if(0!==b||0!==this._lastDelta){this._lastDelta=b;var d=this.GetTime();this._SetTime(d+b*a*this._playbackRate);var c;this.GetLoop()||this.GetPingPong()?this.GetLoop()&& !this.GetPingPong()?c=this._LoopCompleteCheck():!this.GetLoop()&&this.GetPingPong()?c=this._PingPongCompleteCheck():this.GetLoop()&&this.GetPingPong()&&(c=this._LoopPingPongCompleteCheck()):c=this._SimpleCompleteCheck();if(c){for(const f of this._tracks)f.SetEndState();this.Stop(!0);this.OnCompleted();return!0}return this._Interpolate(this.GetTime(),!0,!1,!1,d,!0)}}_Interpolate(b,a=!1,d=!1,c=!1,f=NaN,l=!1,g=!1){let k=!1;for(var m of this._tracks)m.BeforeInterpolate();for(const u of this._tracks){m= b;if("number"===typeof f){const x=this.GetTime()-u.GetStartOffset(),n=f-u.GetStartOffset();0>x&&0<n&&(m=u.GetStartOffset(),this._SetTime(m))}m=u.Interpolate(m,a,d,c,this._firstTick,g);!k&&m&&(k=!0)}for(const u of this._tracks)u.AfterInterpolate();this._firstTick&&l&&(this._firstTick=!1);return k}_SimpleCompleteCheck(){if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())if(this._currentRepeatCount<this.GetRepeatCount())this._currentRepeatCount++,this._SetTime(0);else return this._SetTime(this.GetTotalTime()), !0}else if(0>=this.GetTime())if(this._currentRepeatCount<this.GetRepeatCount())this._currentRepeatCount++,this._SetTime(this.GetTotalTime());else return this._SetTime(0),!0;return!1}_LoopCompleteCheck(){this.IsForwardPlayBack()?this.GetTime()>=this.GetTotalTime()&&this._SetTime(0):0>=this.GetTime()&&this._SetTime(this.GetTotalTime());return!1}_PingPongCompleteCheck(){if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())if(this._SetTime(this.GetTotalTime()),this.SetPlaybackRate(-1*this.GetPlaybackRate()), 1===this._pingPongState)if(this._currentRepeatCount<this.GetRepeatCount())this._currentRepeatCount++,this._pingPongState=0;else return!0;else 0===this._pingPongState&&(this._pingPongState=1)}else if(0>=this.GetTime())if(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate()),1===this._pingPongState)if(this._currentRepeatCount<this.GetRepeatCount())this._currentRepeatCount++,this._pingPongState=0;else return!0;else 0===this._pingPongState&&(this._pingPongState=1);return!1}_LoopPingPongCompleteCheck(){this.IsForwardPlayBack()? this.GetTime()>=this.GetTotalTime()&&(this._SetTime(this.GetTotalTime()),this.SetPlaybackRate(-1*this.GetPlaybackRate())):0>=this.GetTime()&&(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate()));return!1}AddTrack(){var b=this._timelineDataItem.GetTrackData().AddEmptyTrackDataItem();b=e.TrackState.Create(this,b);this._tracks.push(b);return b}CleanCaches(){for(const b of this._tracks)b.CleanCaches()}ClearTrackInstances(){for(const b of this._tracks)b.ClearInstance()}SetTrackInstance(b, a){if(a)for(const d of this._tracks)if(d.IsInstanceTrack()){if(b){if(d.GetId()!==b)continue}else if(d.HasInstance())continue;d.SetInstance(a);this._timelineManager.SetTimelineObjectClassToMap(a.GetObjectClass(),this);break}}HasTrackInstance(b,a){for(const d of this._tracks)if(d.IsInstanceTrack())if(a){if(a===d.GetId()&&b===d.GetInstance())return!0}else if(b===d.GetInstance())return!0;return!1}HasValidTracks(){return this._tracks.some(b=>b.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 d of a.GetPropertyTracks())if(d.GetPropertyName()===b)return d}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 d of a.GetKeyframeDataItems())if(b.every(c=>d.HasTag(c)))return d}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.Set(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,d)=>{this._tracks[d]._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(e.IsArray(b))return b.slice(0);if(e.IsString(b))return b.split(" ")}}} {"use strict";const e=self.C3;e.TrackState=class extends e.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=0<a.GetStartOffset();this._endStateOfNestedSet=this._initialStateOfNestedSet=!1;this._lastKeyframeDataItem=null;this._keyframeDataItems=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemArray();this._propertyTracks=[];for(const d of this._trackDataItem.GetPropertyTrackData().propertyTrackDataItems())this._propertyTracks.push(e.PropertyTrackState.Create(this, d))}static Create(b,a){return e.New(e.TrackState,b,a)}Release(){this._keyframeDataItems=null;for(const b of this._propertyTracks)b.Release();e.clearArray(this._propertyTracks);this._lastKeyframeDataItem=this._trackDataItem=this._worldInfo=this._instance=this._timeline=this._propertyTracks=null}CleanCaches(){for(const b of this._propertyTracks)b.CleanCaches();this._worldInfo=this._instance=null}GetTimeline(){return this._timeline}GetRuntime(){return this._timeline.GetRuntime()}GetKeyframeDataItems(){return this._keyframeDataItems? this._keyframeDataItems:this._keyframeDataItems=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemArray()}GetPropertyTracks(){return this._propertyTracks}GetPropertyTrack(b){for(const a of this._propertyTracks)if(a.GetPropertyName()===b)return a}MaybeGetInstance(){this._instance||this.GetInstance()}IsInstanceValid(){return this._instance?!this._instance.IsDestroyed():!1}CanInstanceBeValid(){if(!this.IsInstanceTrack())return!1;var b=this.GetInstanceUID();return(b=this.GetRuntime().GetInstanceByUID(b))? !b.IsDestroyed():!1}GetObjectClass(){if(this.IsInstanceTrack()){var b=this.GetObjectClassIndex();if(-1!==b)return this.GetRuntime().GetObjectClassByIndex(b)}}ClearInstance(){this._instance=null;this._instanceUid=-1;this._worldInfo=null;this._objectClassIndex=-1}HasInstance(){return!!this._instance}GetInstance(){if(this._instance&&this.IsInstanceValid())return this._instance;const b=this.GetInstanceUID();return this._instance=this.GetRuntime().GetInstanceByUID(b)}SetInstance(b){if(this._instance!== b){this.CleanCaches();this._instance=b;this._objectClassIndex=b.GetObjectClass().GetIndex();this._instanceUid=b.GetUID();this._worldInfo=b.GetWorldInfo();for(const l of this.propertyTrackItems()){const g=l.sourceAdapter;switch(l.propertyTrack.GetSourceAdapterId()){case "instance-variable":g.GetEditorIndex();var a=b.GetObjectClass(),d=a.GetInstanceVariableIndexByName(l.name),c=a.GetInstanceVariableName(d);a=a.GetInstanceVariableType(d);c===l.name&&a===l.type&&g.UpdateInstanceVariableIndex(d);break; case "behavior":var f=l.behaviorType;d=this.GetObjectClass();c=b.GetObjectClass();a=g.GetBehaviorType(c);f&&a&&(f=f.GetName(),d.GetBehaviorIndexByName(f),c.GetBehaviorIndexByName(f),g.GetEditorIndex(),g.UpdateBehaviorTypeSid(a.GetSID()))}}}}*propertyTrackItems(){for(const d of this._propertyTracks){var b=d.GetSourceAdapter(),a=this.GetObjectClass();const c={propertyTrack:d,sourceAdapter:b};switch(d.GetSourceAdapterId()){case "world-instance":c.property=d.GetPropertyName();break;case "instance-variable":b= b.GetEditorIndex();c.name=a.GetInstanceVariableName(b);c.type=a.GetInstanceVariableType(b);break;case "effect":a=a.GetEffectList();b=b.GetEffectType(a);c.effectType=b;break;case "behavior":b=b.GetBehaviorType(a);c.behaviorType=b;break;case "plugin":c.plugin=a.GetPlugin()}yield c}}GetWorldInfo(){if(this._worldInfo&&this.IsInstanceValid())return this._worldInfo;const b=this.GetInstance();b&&(this._worldInfo=b.GetWorldInfo());return this._worldInfo}GetTrackDataItem(){return this._trackDataItem}GetInstanceUID(){return this._instanceUid? this._instanceUid:this._trackDataItem.GetInstanceUID()}SetInstanceUID(b){this._trackDataItem.SetInstanceUID(b)}GetInterpolationMode(){return this._trackDataItem.GetInterpolationMode()}SetInterpolationMode(b){this._trackDataItem.SetInterpolationMode(b)}GetResultMode(){return this._trackDataItem.GetResultMode()}GetId(){return this._trackDataItem.GetId()}GetStartOffset(){return this._trackDataItem.GetStartOffset()}GetLocalTotalTime(){return this._trackDataItem.GetLocalTotalTime()}SetLocalTotalTime(b){this._trackDataItem.SetLocalTotalTime(b)}SetResultMode(b){this._trackDataItem.SetResultMode(b)}SetEase(b){for(const a of this.GetKeyframeDataItems())a.SetEase(b); for(const a of this.GetPropertyTracks())a.SetEase(b)}GetEnable(){return this._trackDataItem.GetEnable()}SetEnable(b){this._trackDataItem.SetEnable(b)}GetObjectClassIndex(){return isNaN(this._objectClassIndex)?this._trackDataItem.GetObjectClassIndex():this._objectClassIndex}SetObjectClassIndex(b){this._trackDataItem.SetObjectClassIndex(b)}SetOriginalWidth(b){this._trackDataItem.SetOriginalWidth(b)}GetOriginalWidth(){const b=this.GetInstance();return b&&b.GetSdkInstance().IsOriginalSizeKnown()?b.GetSdkInstance().GetOriginalWidth(): this._trackDataItem.GetOriginalWidth()}SetOriginalHeight(b){this._trackDataItem.SetOriginalHeight(b)}GetOriginalHeight(){const b=this.GetInstance();return b&&b.GetSdkInstance().IsOriginalSizeKnown()?b.GetSdkInstance().GetOriginalHeight():this._trackDataItem.GetOriginalHeight()}GetType(){return this._trackDataItem.GetType()}GetName(){return this._trackDataItem.GetName()}IsInstanceTrack(){return 0===this.GetType()}IsValueTrack(){return 1===this.GetType()}SetInitialState(){this.MaybeGetInstance();if(this.IsInstanceValid()|| !this.IsInstanceTrack()){for(var b of this._propertyTracks)b.SetInitialState();b=this.GetTimeline().IsForwardPlayBack()?0:this.GetLocalTotalTime();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()}}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)}}BeforeInterpolate(){for(const b of this._propertyTracks)b.BeforeInterpolate()}Interpolate(b,a=!1,d=!1,c=!1,f=!1,l=!1){this.MaybeGetInstance(); if(!this.IsInstanceValid()&&this.IsInstanceTrack()||l&&this.IsInstanceTrack()&&this.GetObjectClass().IsGlobal())return!1;b-=this.GetStartOffset();if(0>b)return!1;this.MaybeSetInitialStateOfNestedTrack(b,a);this.MaybeTriggerKeyframeReachedConditions(b,a,f);f=l=!1;for(const g of this._propertyTracks){const k=g.Interpolate(b,d,!1,c);l||0===(k&e.TimelineState.WORLD_INSTANCE_BOX_CHANGE)||(l=!0);f||0===(k&e.TimelineState.LAYOUT_RENDER_CHANGE)||(f=!0)}this.MaybeSetEndStateOfNestedTrack(b,a);l&&(b=this.GetWorldInfo())&& b.SetBboxChanged();return f}AfterInterpolate(){for(const b of this._propertyTracks)b.AfterInterpolate()}MaybeSetInitialStateOfNestedTrack(b,a){if(a&&this._isNested&&!this._initialStateOfNestedSet){if(this.GetTimeline().IsForwardPlayBack()){if(0>b)return;for(const d of this._propertyTracks)d.Interpolate(0,!1,!1,!0)}else{if(b>this.GetLocalTotalTime())return;for(const d of this._propertyTracks)d.Interpolate(this.GetLocalTotalTime(),!1,!1,!0)}for(const d of this._propertyTracks)d.SetInitialState();this._initialStateOfNestedSet= !0}}MaybeSetEndStateOfNestedTrack(b,a){if(a&&this._isNested&&!this._endStateOfNestedSet)if(this.GetTimeline().IsForwardPlayBack()){if(b>=this.GetLocalTotalTime()){for(const d of this._propertyTracks)d.Interpolate(this.GetLocalTotalTime(),!1,!1,!0);this._endStateOfNestedSet=!0}}else if(0>=b){for(const d of this._propertyTracks)d.Interpolate(0,!1,!1,!0);this._endStateOfNestedSet=!0}}MaybeTriggerKeyframeReachedConditions(b,a,d){if(!d&&a)return b=this.GetLastKeyFrameBeforeTime(b),b!==this._lastKeyframeDataItem&& this.OnKeyframeReached(b),this._lastKeyframeDataItem=b}GetLastKeyFrameBeforeTime(b){const a=this.GetTimeline();let d=this._trackData.GetKeyFrameDataItemAtTime(b,this._trackDataItem);return d?d:a.IsForwardPlayBack()?this._trackData.GetFirstKeyFrameDataItemLowerOrEqualThan(b,this._trackDataItem):this._trackData.GetFirstKeyFrameDataItemHigherOrEqualThan(b,this._trackDataItem)}OnKeyframeReached(b){if(e.Plugins.Timeline&&this.GetTimeline().constructor===e.TimelineState){var a=this.GetTimeline();e.Plugins.Timeline.Cnds.SetTriggerTimeline(a); e.Plugins.Timeline.Cnds.SetTriggerKeyframe(b);b=a.GetTimelineManager();b.Trigger(e.Plugins.Timeline.Cnds.OnAnyKeyframeReached);b.Trigger(e.Plugins.Timeline.Cnds.OnKeyframeReached);e.Plugins.Timeline.Cnds.SetTriggerTimeline(null);e.Plugins.Timeline.Cnds.SetTriggerKeyframe(null)}}AddKeyframe(){return this._trackDataItem.GetKeyframeData().AddEmptyKeyframeDataItem()}AddPropertyTrack(){var b=this._trackDataItem.GetPropertyTrackData().AddEmptyPropertyTrackDataItem();b=e.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 d=a.CompareSaveStateWithCurrent();!b&&d&&(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,d)=>{this._propertyTracks[d]._LoadFromJson(a)})}_LoadInstanceFromJson(b){if(e.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 e=self.C3;e.PropertyTrackState=class extends e.DefendedBase{constructor(b,a){super();this._track=b;this._propertyTrackDataItem=a;this._propertyTrackData=a.GetPropertyTrackData();this._sourceAdapter=this.GetSourceAdapter();this._propertyKeyframeDataItems=this._propertyTrackDataItem.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray()}static Create(b,a){return e.New(e.PropertyTrackState,b,a)}Release(){this._track=null;this._sourceAdapter&&(this._sourceAdapter.Release(),this._sourceAdapter= null);this._propertyTrackData=this._propertyTrackDataItem=this._propertyKeyframeDataItems=null}GetTrack(){return this._track}GetPropertyTrackDataItem(){return this._propertyTrackDataItem}GetPropertyTrackData(){return this._propertyTrackData}GetTimeline(){return this._track.GetTimeline()}GetRuntime(){return this._track.GetRuntime()}GetInstance(){return this._track.GetInstance()}GetSourceAdapter(){if(this._sourceAdapter)return this._sourceAdapter;let b;switch(this._propertyTrackDataItem.GetSourceAdapterId()){case "behavior":b= new e.PropertyTrackState.BehaviorSourceAdapter(this);break;case "effect":b=new e.PropertyTrackState.EffectSourceAdapter(this);break;case "instance-variable":b=new e.PropertyTrackState.InstanceVariableSourceAdapter(this);break;case "plugin":b=new e.PropertyTrackState.PluginSourceAdapter(this);break;case "world-instance":b=new e.PropertyTrackState.WorldInstanceSourceAdapter(this);break;case "value":b=new e.PropertyTrackState.ValueSourceAdapter(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)}GetPropertyKeyframeDataItems(){return this._propertyKeyframeDataItems? this._propertyKeyframeDataItems:this._propertyKeyframeDataItems=this._propertyTrackDataItem.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray()}*GetPropertyKeyframeValues(){for(const b of this.GetPropertyKeyframeDataItems())yield b.GetValueWithResultMode()}CleanCaches(){this.GetSourceAdapter().CleanCaches()}GetCurrentState(){return this.GetSourceAdapter().GetCurrentState()}SetInitialState(){this.GetSourceAdapter().SetInitialState()}SetResumeState(){this.GetSourceAdapter().SetResumeState()}BeforeInterpolate(){this.GetSourceAdapter().BeforeInterpolate()}Interpolate(b, a=!1,d=!1,c=!1){var f=this._propertyTrackDataItem;let l=this._propertyTrackData.GetPropertyKeyFrameDataItemAtTime(b,f);l?f=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherThan(b,f):(l=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,f),f=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(b,f));return this.GetSourceAdapter().Interpolate(b,l,f,a,d,c)}AfterInterpolate(){this.GetSourceAdapter().AfterInterpolate()}static GetStartPropertyKeyframeForTime(b, a){const d=a.GetPropertyTrackDataItem();a=a._propertyTrackData;let c=a.GetPropertyKeyFrameDataItemAtTime(b,d);c||(c=a.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,d));return c}static GetEndPropertyKeyframeForTime(b,a){const d=a.GetPropertyTrackDataItem();a=a._propertyTrackData;return a.GetPropertyKeyFrameDataItemAtTime(b,d)?a.GetFirstPropertyKeyFrameDataItemHigherThan(b,d):a.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(b,d)}AddPropertyKeyframe(){return this._propertyTrackDataItem.GetPropertyKeyframeData().AddEmptyPropertyKeyframeDataItem()}DeletePropertyKeyframes(b){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(),d=e.PropertyTrackState.GetStartPropertyKeyframeForTime(b,this),c= this.AddPropertyKeyframe();c.SetType(d.GetType());c.SetTime(b);c.SetEase(d.GetEase());c.SetEnable(!0);c.SetValue(a.GetValueAtTime());c.SetAbsoluteValue(a.GetCurrentState())}_SaveToJson(){return{sourceAdapterJson:this.GetSourceAdapter()._SaveToJson()}}_LoadFromJson(b){b&&this.GetSourceAdapter()._LoadFromJson(b.sourceAdapterJson)}}} {"use strict";const e=self.C3.PropertyTrackState;e.PropertySourceAdapter=class{constructor(b){this._propertyTrack=b;this._propertyAdapter=null}Release(){this._propertyAdapter&&(this._propertyAdapter.Release(),this._propertyAdapter=null);this._propertyTrack=null}GetPropertyTrack(){return this._propertyTrack}CleanCaches(){this._propertyAdapter&&this._propertyAdapter.CleanCaches()}GetPropertyAdapter(){return this._propertyAdapter?this._propertyAdapter:this._propertyAdapter=this._CreatePropertyAdapter()}GetEditorIndex(){}GetIndex(){return this.GetEditorIndex()}GetTarget(){}SetInitialState(){this.GetPropertyAdapter().SetInitialState()}SetResumeState(){this.GetPropertyAdapter().SetResumeState()}BeforeInterpolate(){this.GetPropertyAdapter().BeforeChangeProperty()}Interpolate(b, a,d,c,f,l){const g=e.PropertySourceAdapter.GetInterpolateFunc(this._propertyTrack)(b,a,d,this._propertyTrack);return f?g:this.GetPropertyAdapter().ChangeProperty(b,g,a,d,c,l)}AfterInterpolate(){this.GetPropertyAdapter().AfterChangeProperty()}SaveState(){this.GetPropertyAdapter().SetSaveState()}ClearSaveState(){this.GetPropertyAdapter().ClearSaveState()}GetCurrentState(){return this.GetPropertyAdapter().GetCurrentState()}CompareInitialStateWithCurrent(){return this.GetPropertyAdapter().CompareInitialStateWithCurrent()}CompareSaveStateWithCurrent(){return this.GetPropertyAdapter().CompareSaveStateWithCurrent()}GetValueAtTime(){return e.PropertySourceAdapter.GetValueAtTime(this._propertyTrack)}_CreatePropertyAdapter(){const b= this._propertyTrack.GetPropertyType();switch(this._propertyTrack.GetPropertyKeyframeType()){case "combo":case "boolean":case "text":case "string":return new e.PropertyInterpolationAdapter.NoInterpolationAdapter(this);case "numeric":case "number":case "angle":return"combo"===b?new e.PropertyInterpolationAdapter.NoInterpolationAdapter(this):new e.PropertyInterpolationAdapter.NumericInterpolationAdapter(this);case "color":case "offsetColor":return new e.PropertyInterpolationAdapter.ColorInterpolationAdapter(this)}}_SaveToJson(){return{propertyAdapterJson:this.GetPropertyAdapter()._SaveToJson()}}_LoadFromJson(b){b&& this.GetPropertyAdapter()._LoadFromJson(b.propertyAdapterJson)}static GetValueAtTime(b){const a=b.GetTrack().GetTimeline().GetTime(),d=e.GetStartPropertyKeyframeForTime(a,b),c=e.GetEndPropertyKeyframeForTime(a,b);return e.PropertySourceAdapter.GetInterpolateFunc(b)(a,d,c,b)}static GetValue(b,a,d){let c=b.GetResultMode();"combo"===b.GetPropertyType()&&(c="absolute");switch(c){case "relative":return a+d;case "absolute":return d}}static GetInterpolateFunc(b){switch(b.GetPropertyKeyframeType()){case "numeric":return e.NumericTypeAdapter.Interpolate; case "angle":return e.AngleTypeAdapter.Interpolate;case "boolean":return e.BooleanTypeAdapter.Interpolate;case "color":return e.ColorTypeAdapter.Interpolate;case "text":return e.TextTypeAdapter.Interpolate}}static GetWillChangeFunc(b){switch(b.GetPropertyKeyframeType()){case "numeric":return e.NumericTypeAdapter.WillChange;case "angle":return e.AngleTypeAdapter.WillChange;case "boolean":return e.BooleanTypeAdapter.WillChange;case "color":return e.ColorTypeAdapter.WillChange;case "text":return e.TextTypeAdapter.WillChange}}}} {"use strict";const e=self.C3;class b extends e.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a)}}e.PropertyTrackState.WorldInstanceSourceAdapter=b} {"use strict";const e=self.C3;class b extends e.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,d,c,f,l,g){if(this.GetPropertyAdapter().CanChange(d.GetValue()))return super.Interpolate(a,d,c,f,l,g)}_SaveToJson(){return Object.assign(super._SaveToJson(),{index:this._updatedIndex})}_LoadFromJson(a){a&&(super._LoadFromJson(a),this._updatedIndex=a.index)}}e.PropertyTrackState.InstanceVariableSourceAdapter=b} {"use strict";const e=self.C3;class b extends e.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a);this._sid=NaN}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[1]}GetTarget(){var a=this._propertyTrack.GetPropertyTrackDataItem(),d=this._propertyTrack.GetTrack();a=this._sid?this._sid:a.GetSourceAdapterArguments()[0];d=d.GetInstance();a=d.GetBehaviorIndexBySID(a);return d.GetBehaviorInstances()[a].GetSdkInstance()}GetBehaviorType(a){const d= this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[2];return a.GetBehaviorTypeByName(d)}UpdateBehaviorTypeSid(a){this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]!==a&&(this._sid=a)}Interpolate(a,d,c,f,l,g){const k=this._propertyTrack.GetTrack().GetInstance();if(this.GetBehaviorType(k.GetObjectClass()))return super.Interpolate(a,d,c,f,l,g)}_SaveToJson(){return Object.assign(super._SaveToJson(),{sid:this._sid})}_LoadFromJson(a){a&&(super._LoadFromJson(a), this._sid=a.sid)}}e.PropertyTrackState.BehaviorSourceAdapter=b} {"use strict";const e=self.C3;class b extends e.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a)}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[1]}GetTarget(){const a=this._propertyTrack.GetTrack().GetWorldInfo().GetInstanceEffectList();var d=a.GetEffectList();d=this.GetEffectType(d).GetIndex();return a.IsEffectIndexActive(d)?a.GetEffectParametersForIndex(d):null}GetEffectType(a){const d=this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]; return a.GetEffectTypeByName(d)}Interpolate(a,d,c,f,l,g){if(this._IsEffectActive())return super.Interpolate(a,d,c,f,l,g)}_IsEffectActive(){const a=this._propertyTrack.GetTrack().GetWorldInfo().GetInstanceEffectList();var d=a.GetEffectList();if(d=this.GetEffectType(d))return d=d.GetIndex(),a.IsEffectIndexActive(d)}}e.PropertyTrackState.EffectSourceAdapter=b} {"use strict";const e=self.C3;class b extends e.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a)}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]}GetTarget(){return this._propertyTrack.GetTrack().GetInstance().GetSdkInstance()}Interpolate(a,d,c,f,l,g){var k=this._propertyTrack.GetTrack();const m=k.GetObjectClass().GetPlugin();k=k.GetInstance().GetObjectClass().GetPlugin();if(m===k)return super.Interpolate(a,d,c,f,l,g)}}e.PropertyTrackState.PluginSourceAdapter= b} {"use strict";const e=self.C3;class b extends e.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a);this._value=0;this._init=!1}SetInitialState(){const a=this._propertyTrack.GetPropertyTrackData();let d=this._propertyTrack.GetPropertyTrackDataItem();d=a.GetFirstPropertyKeyframeDataItem(d);this._value=d.GetValueWithResultMode()}SetResumeState(){}GetValue(){this._init||this._propertyTrack.Interpolate(0);return this._value}Interpolate(a,d,c,f,l,g){f=e.PropertyTrackState.NumericTypeAdapter.Interpolate;this._value= f(a,d,c,this._propertyTrack);this._init=!0}SaveState(){}ClearSaveState(){}GetCurrentState(){return this._value}CompareInitialStateWithCurrent(){return!1}CompareSaveStateWithCurrent(){return!1}_SaveToJson(){return{value:this._value,init:this._init}}_LoadFromJson(a){a&&(this._value=a.value,this._init=a.hasOwnProperty("init")?a.init:!0)}}e.PropertyTrackState.ValueSourceAdapter=b}"use strict"; self.C3.PropertyTrackState.PropertyInterpolationAdapter=class{constructor(e){this._sourceAdapter=e;this._propertyTrack=e.GetPropertyTrack();this._worldInfo=this._propertyTrack.GetTrack().GetWorldInfo();this._property=this._propertyTrack.GetPropertyName();this._firstAbsoluteUpdate=!1;this._target=this._saveState=null}Release(){this._target=this._saveState=this._worldInfo=this._propertyTrack=this._sourceAdapter=null}CleanCaches(){this._target=this._saveState=this._worldInfo=null}GetPropertyTrack(){return this._propertyTrack}GetWorldInfo(){return this._worldInfo? this._worldInfo:this._worldInfo=this._propertyTrack.GetTrack().GetWorldInfo()}SetFirstAbsoluteUpdate(e){this._firstAbsoluteUpdate=!!e}GetFirstAbsoluteUpdate(){return this._firstAbsoluteUpdate}SetInitialState(){}SetResumeState(){}SetSaveState(){this._saveState=this.GetCurrentState()}ClearSaveState(){this._saveState=null}GetCurrentState(){}CompareInitialStateWithCurrent(){}CompareSaveStateWithCurrent(){}CanChange(e){return typeof this._Getter()===typeof e}BeforeChangeProperty(){}ChangeProperty(e,b, a,d,c){}AfterChangeProperty(){}_FirstKeyframeGetter(){return this._PickTimelinePlaybackMode(()=>{const e=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetFirstPropertyKeyframeDataItem(e)},()=>{const e=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(e)}).GetAbsoluteValue()}_CurrentKeyframeGetter(){const e=this._propertyTrack.GetTimeline().GetTime()-this._propertyTrack.GetTrack().GetStartOffset(); return this._PickTimelinePlaybackMode(()=>{const b=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(e,b)},()=>{const b=this._propertyTrack.GetPropertyTrackDataItem(),a=this._propertyTrack.GetPropertyTrackData(),d=a.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(e,b);return d?d:a.GetLastPropertyKeyframeDataItem(b)}).GetAbsoluteValue()}_PickTimelinePlaybackMode(e,b){return this._propertyTrack.GetTimeline().IsForwardPlayBack()? e():b()}_PickResultMode(e,b){return"relative"===this._propertyTrack.GetResultMode()?e():b()}_PickFirstAbsoluteUpdate(e,b){return this.GetFirstAbsoluteUpdate()?(this.SetFirstAbsoluteUpdate(!1),e()):b()}_GetAbsoluteInitialValue(e){}_GetIndex(){return this._sourceAdapter.GetIndex()}_GetTarget(){return this._target?this._target:this._target=this._sourceAdapter.GetTarget()}_PickSource(e,b,a,d,c){switch(this._propertyTrack.GetSourceAdapterId()){case "behavior":return e();case "effect":return b();case "instance-variable":return a(); case "plugin":return d();case "world-instance":return c()}}_SaveToJson(){return{firstAbsoluteUpdate:this._firstAbsoluteUpdate,saveState:this._saveState}}_LoadFromJson(e){e&&(this._firstAbsoluteUpdate=e.firstAbsoluteUpdate,this._saveState=e.saveState)}_GetPropertyKeyframeStubs(e,b=!1){const a=[];for(const d of e){e=d.GetTrack().GetStartOffset();for(const c of d.GetPropertyKeyframeDataItems())b&&0===c.GetTime()?a.push({time:e+c.GetTime(),value:c.GetAbsoluteValue()}):b||a.push({time:e+c.GetTime(),value:c.GetAbsoluteValue()})}return a.sort((d, c)=>d.time-c.time)}_GetLastPropertyKeyframeStub(e,b,a){return this._GetPropertyKeyframeStubLowerThanPlayhead(b,a)}_GetPropertyKeyframeStubLowerThanPlayhead(e,b){for(let a=b.length-1;0<=a;a--)if(b[a].time<=e)return b[a];return null}}; {"use strict";const e=self.C3,b=new Map,a=[0,0,0];class d extends e.PropertyTrackState.PropertyInterpolationAdapter{constructor(c){super(c)}SetInitialState(){}SetResumeState(){}GetCurrentState(){const c=this._propertyTrack.GetSourceAdapterId(),f=this._GetTarget(),l=this._GetIndex();switch(c){case "behavior":return this._ToColorArray(f.GetPropertyValueByIndex(l));case "effect":return this._ToColorArray(f[l]);case "plugin":return this._ToColorArray(f.GetPropertyValueByIndex(l));case "world-instance":return this._ToColorArray(this._Getter())}}CompareInitialStateWithCurrent(){const c= this._FirstKeyframeGetter();return!this._CompareColors(c,this._Getter())}CompareSaveStateWithCurrent(){return e.IsNullOrUndefined(this._saveState)?!1:!this._CompareColors(this._saveState,this._Getter())}_CompareColors(c,f){return c.equalsIgnoringAlpha(f)}_FirstKeyframeGetter(){const c=super._FirstKeyframeGetter();return this._GetColorFromArray(c)}_CurrentKeyframeGetter(){const c=super._CurrentKeyframeGetter();return this._GetColorFromArray(c)}_GetAbsoluteInitialValue(c){}_ToColorArray(c){return e.IsInstanceOf(c, e.Color)?c.toArray().slice(0,3):c.slice(0,3)}_GetColorFromArray(c){return e.IsInstanceOf(c,e.Color)?c:new e.Color(c[0],c[1],c[2],1)}CanChange(c){return!0}BeforeChangeProperty(){var c=this._propertyTrack.GetInstance();b.has(c)||b.set(c,new Map);c=b.get(c);const f=this._propertyTrack.GetSourceAdapterId();c.has(f)||c.set(f,new Map);c=c.get(f);c.has(this._property)||c.set(this._property,{used:!1,color:new e.Color(0,0,0,1)})}_GetTmpColor(c,f,l){c=b.get(c).get(f).get(l);c.used=!0;return c.color}ChangeProperty(c, f,l,g,k){k=this._propertyTrack.GetTimeline();g=this._propertyTrack.GetTrack();c=this._propertyTrack.GetInstance();var m=this._propertyTrack.GetSourceAdapter();l=this._propertyTrack.GetSourceAdapterId();m=k.GetSimilarPropertyTracks(c,m,this._property);if(1<m.length){if(m=this._GetPropertyKeyframeStubs(m,!0),k=this._GetLastPropertyKeyframeStub(k,k.GetTime(),m))if(g=g.GetStartOffset(),m=k.time-g,0===m)this._GetTmpColor(c,l,this._property).addRgb(f[0],f[1],f[2]);else{if(0>m)return;k=f[0];g=f[1];f=f[2]; m=this._propertyTrack.Interpolate(m,!1,!0);k=e.Color.DiffChannel(k,m[0]);g=e.Color.DiffChannel(g,m[1]);f=e.Color.DiffChannel(f,m[2]);this._GetTmpColor(c,l,this._property).addRgb(k,g,f)}}else this._Setter(f[0],f[1],f[2]);return e.TimelineState.LAYOUT_RENDER_CHANGE}AfterChangeProperty(){const c=this._propertyTrack.GetInstance();if(b.has(c)){var f=b.get(c),l=this._propertyTrack.GetSourceAdapterId();if(f.has(l)){var g=f.get(l);if(g.has(this._property)){var k=g.get(this._property),m=k.color;k.used&&this._Setter(m.getR(), m.getG(),m.getB());0===g.size&&f.delete(l);0===f.size&&b.delete(c)}}}}_Getter(){const c=this._propertyTrack.GetSourceAdapterId(),f=this._GetTarget(),l=this._GetIndex();switch(c){case "behavior":return this._GetColorFromArray(f.GetPropertyValueByIndex(l));case "effect":return f[l].clone();case "plugin":return this._GetColorFromArray(f.GetPropertyValueByIndex(l));case "world-instance":return this.GetWorldInfo().GetUnpremultipliedColor().clone()}}_Setter(c,f,l){const g=this._propertyTrack.GetSourceAdapterId(), k=this._GetTarget(),m=this._GetIndex();switch(g){case "behavior":a[0]=c;a[1]=f;a[2]=l;k.SetPropertyValueByIndex(m,a);break;case "effect":k[m].setRgb(c,f,l);break;case "plugin":a[0]=c;a[1]=f;a[2]=l;k.SetPropertyValueByIndex(m,a);break;case "world-instance":this.GetWorldInfo().SetUnpremultipliedColorRGB(c,f,l)}}_SaveToJson(){}_LoadFromJson(c){}}e.PropertyTrackState.PropertyInterpolationAdapter.ColorInterpolationAdapter=d} {"use strict";const e=self.C3;class b extends e.PropertyTrackState.PropertyInterpolationAdapter{constructor(a){super(a)}SetInitialState(){}SetResumeState(){}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){return this._FirstKeyframeGetter()!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return e.IsNullOrUndefined(this._saveState)?!1:this._saveState!==this.GetCurrentState()}ChangeProperty(a,d,c,f,l){c=e.PropertyTrackState.PropertySourceAdapter.GetWillChangeFunc(this._propertyTrack); var g=this._propertyTrack;const k=g.GetTrack();f=g.GetSourceAdapterId();l=g.GetTimeline();var m=k.GetInstance();g=g.GetSourceAdapter();m=l.GetSimilarPropertyTracks(m,g,this._property);1<m.length&&(m=this._GetPropertyKeyframeStubs(m),a+=k.GetStartOffset(),a=this._GetLastPropertyKeyframeStub(l,a,m))&&(d=a.value);if(c(this._GetIndex(),this._GetTarget(),d,f))switch(this._Setter(d),f){case "plugin":return e.TimelineState.LAYOUT_RENDER_CHANGE}}_Getter(){const a=this._propertyTrack.GetSourceAdapterId(), d=this._GetTarget(),c=this._GetIndex();switch(a){case "behavior":return d.GetPropertyValueByIndex(c);case "effect":return d[c];case "instance-variable":return d.GetInstanceVariableValue(c);case "plugin":return d.GetPropertyValueByIndex(c)}}_Setter(a){const d=this._propertyTrack.GetSourceAdapterId(),c=this._GetTarget(),f=this._GetIndex();switch(d){case "behavior":c.SetPropertyValueByIndex(f,a);break;case "effect":c[f]=a;break;case "instance-variable":c.SetInstanceVariableValue(f,a);break;case "plugin":c.SetPropertyValueByIndex(f, a)}}}e.PropertyTrackState.PropertyInterpolationAdapter.NoInterpolationAdapter=b} {"use strict";const e=self.C3,b=new Map,a=(c,f,l,g,k)=>b.set(c,{setter:f,absolute_setter:l,getter:g,round:k});a("offsetX",(c,f)=>c.OffsetX(f),(c,f)=>c.SetX(f),c=>c.GetX(),!0);a("offsetY",(c,f)=>c.OffsetY(f),(c,f)=>c.SetY(f),c=>c.GetY(),!0);a("offsetWidth",(c,f)=>c.OffsetWidth(f),(c,f)=>c.SetWidth(f),c=>c.GetWidth(),!0);a("offsetHeight",(c,f)=>c.OffsetHeight(f),(c,f)=>c.SetHeight(f),c=>c.GetHeight(),!0);a("offsetAngle",(c,f)=>c.OffsetAngle(f),(c,f)=>c.SetAngle(f),c=>c.GetAngle(),!1);a("offsetOpacity", (c,f,l,g)=>{l=c.GetOpacity()+f;0===g._clampAccumulator?(1<l?g._clampAccumulator+=l-1:0>l&&(g._clampAccumulator+=l),c.OffsetOpacity(f)):(c=c.GetOpacity()+f,0<f&&0<g._clampAccumulator?1<c&&(g._clampAccumulator+=c-1):0<f&&0>g._clampAccumulator?(g._clampAccumulator+=f,0<g._clampAccumulator&&(g._clampAccumulator=0)):0>f&&0<g._clampAccumulator?(g._clampAccumulator+=f,0>g._clampAccumulator&&(g._clampAccumulator=0)):0>f&&0>g._clampAccumulator&&0>c&&(g._clampAccumulator+=c))},(c,f)=>{c.SetOpacity(f)},c=>c.GetOpacity(), !1);a("offsetOriginX",(c,f)=>c.OffsetOriginX(f),(c,f)=>c.SetOriginX(f),c=>c.GetOriginX(),!1);a("offsetOriginY",(c,f)=>c.OffsetOriginY(f),(c,f)=>c.SetOriginY(f),c=>c.GetOriginY(),!1);a("offsetZElevation",(c,f)=>c.OffsetZElevation(f),(c,f)=>c.SetZElevation(f),c=>c.GetZElevation(),!0);a("offsetScaleX",(c,f,l,g)=>{g=0>c.GetWidth()?-1:1;c.GetTransformWithParentWidth();c.OffsetWidth(l.GetOriginalWidth()*g*f)},(c,f,l)=>{c.SetWidth(l.GetOriginalWidth()*f)},(c,f)=>{const l=0>c.GetWidth()?-1:1;if(c.GetTransformWithParentWidth()){var g= c.GetParent(),k=f.GetTimeline().GetTrackFromInstance(g.GetInstance());k?g=g.GetWidth()/k.GetOriginalWidth():(k=g.GetInstance().GetSdkInstance(),g=k.IsOriginalSizeKnown()?g.GetWidth()/k.GetOriginalWidth():1);return c.GetWidth()*l/(f.GetOriginalWidth()*g)}return c.GetWidth()*l/f.GetOriginalWidth()},!1);a("offsetScaleY",(c,f,l,g)=>{g=0>c.GetHeight()?-1:1;c.GetTransformWithParentHeight();c.OffsetHeight(l.GetOriginalHeight()*g*f)},(c,f,l)=>{c.SetHeight(l.GetOriginalHeight()*f)},(c,f)=>{const l=0>c.GetHeight()? -1:1;if(c.GetTransformWithParentHeight()){var g=c.GetParent(),k=f.GetTimeline().GetTrackFromInstance(g.GetInstance());k?g=g.GetHeight()/k.GetOriginalHeight():(k=g.GetInstance().GetSdkInstance(),g=k.IsOriginalSizeKnown()?g.GetHeight()/k.GetOriginalHeight():1);return c.GetHeight()*l/(f.GetOriginalHeight()*g)}return c.GetHeight()*l/f.GetOriginalHeight()},!1);class d extends e.PropertyTrackState.PropertyInterpolationAdapter{constructor(c){super(c);this._clampAccumulator=this._lastValue=0;this._instance_absolute_setter= this._instance_setter=this._instance_getter=null;this._round=!1;e.IsInstanceOf(this._propertyTrack.GetTimeline(),e.Tween)?this._typeAdapter=new e.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTween(this):this._typeAdapter=new e.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTimeline(this);c=this._propertyTrack.GetPropertyName();"world-instance"===this._propertyTrack.GetSourceAdapterId()&&(c=b.get(c),this._instance_getter=c.getter,this._instance_setter= c.setter,this._instance_absolute_setter=c.absolute_setter,this._round=c.round)}Release(){this._instance_absolute_setter=this._instance_setter=this._instance_getter=this._typeAdapter=null;super.Release()}GetLastValue(){return this._lastValue}SetLastValue(c){this._lastValue=c}SetInitialState(){const c=this._typeAdapter.SetInitialState();"number"===typeof c&&(this._lastValue=c);this._clampAccumulator=0}SetResumeState(){const c=this._typeAdapter.SetResumeState();"number"===typeof c&&(this._lastValue= c)}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){return this._FirstKeyframeGetter()!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return e.IsNullOrUndefined(this._saveState)?!1:this._saveState!==this.GetCurrentState()}BeforeChangeProperty(){this._typeAdapter.BeforeChangeProperty()}ChangeProperty(c,f,l,g,k,m,u){return this._typeAdapter.ChangeProperty(c,f,l,g,k,m,u)}AfterChangeProperty(){this._typeAdapter.AfterChangeProperty()}_Getter(){const c=this._GetTarget(), f=this._GetIndex(),l=this._propertyTrack.GetTrack(),g=this.GetWorldInfo();return this._PickSource(()=>c.GetPropertyValueByIndex(f),()=>c[f],()=>c.GetInstanceVariableValue(f),()=>c.GetPropertyValueByIndex(f),()=>this._instance_getter(g,l))}_Setter(c,f,l){const g=this._GetTarget(),k=this._GetIndex(),m=this._propertyTrack.GetTrack(),u=this.GetWorldInfo();this._PickSource(()=>g.OffsetPropertyValueByIndex(k,c),()=>g[k]+=c,()=>g.SetInstanceVariableOffset(k,c),()=>g.OffsetPropertyValueByIndex(k,c),()=>this._instance_setter(u, c,m,this))}_SetterAbsolute(c,f,l){const g=this._GetTarget(),k=this._GetIndex(),m=this._propertyTrack.GetTrack(),u=this.GetWorldInfo();this._PickSource(()=>g.SetPropertyValueByIndex(k,c),()=>g[k]=c,()=>g.SetInstanceVariableValue(k,c),()=>g.SetPropertyValueByIndex(k,c),()=>this._instance_absolute_setter(u,c,m))}_MaybeEnsureValue(c,f,l,g,k,m){this._typeAdapter._MaybeEnsureValue(c,f,l,g,k,m)}_AddDelta(c,f,l){var g=(c.toString().split(".")[1]||"").length;c=this._Getter();g=0===g?this._round?Math.round(c): c:e.toFixed(c,g);this._Setter(g-c,f,l)}_SaveToJson(){return Object.assign(super._SaveToJson(),{v:this._lastValue,a:this._clampAccumulator})}_LoadFromJson(c){c&&(super._LoadFromJson(c),this._lastValue=c.v,this._clampAccumulator=c.a)}}e.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapter=d} {"use strict";const e=self.C3,b=new Map;class a{constructor(d){this._numericInterpolationAdapter=d}Release(){this._numericInterpolationAdapter=null}SetInitialState(){const d=this._numericInterpolationAdapter,c=this._numericInterpolationAdapter.GetPropertyTrack();return d._PickResultMode(()=>d._PickTimelinePlaybackMode(()=>0,()=>e.PropertyTrackState.PropertySourceAdapter.GetValueAtTime(c)),()=>{})}SetResumeState(){}BeforeChangeProperty(){const d=this._numericInterpolationAdapter,c=this._numericInterpolationAdapter.GetPropertyTrack(), f=c.GetPropertyName();d._PickResultMode(()=>{},()=>{var l=c.GetInstance();b.has(l)||b.set(l,new Map);l=b.get(l);const g=c.GetSourceAdapterId();l.has(g)||l.set(g,new Map);l=l.get(g);l.has(f)||l.set(f,{used:!1,value:0})})}_GetTmpAbsoluteValueObject(d,c,f){d=b.get(d).get(c).get(f);d.used=!0;return d}ChangeProperty(d,c,f,l,g,k){const m=this._numericInterpolationAdapter,u=this._numericInterpolationAdapter.GetPropertyTrack(),x=u.GetPropertyName();m._PickResultMode(()=>{const n=m.GetLastValue();m._Setter(c- n,f,l);k&&this._MaybeEnsureValue(d,f,l,g,n,c);m.SetLastValue(c)},()=>{var n=u.GetTimeline(),q=u.GetTrack();const t=u.GetInstance();var r=u.GetSourceAdapter();const w=u.GetSourceAdapterId();r=n.GetSimilarPropertyTracks(t,r,x);if(1<r.length){if(r=m._GetPropertyKeyframeStubs(r,!0),n=m._GetLastPropertyKeyframeStub(n,n.GetTime(),r))q=q.GetStartOffset(),q=n.time-q,0===q?this._GetTmpAbsoluteValueObject(t,w,x).value+=c:0>q||(q=u.Interpolate(q,!1,!0),this._GetTmpAbsoluteValueObject(t,w,x).value+=c-q)}else m._SetterAbsolute(c)}); return m._PickSource(()=>{},()=>e.TimelineState.LAYOUT_RENDER_CHANGE,()=>{},()=>e.TimelineState.LAYOUT_RENDER_CHANGE,()=>e.TimelineState.LAYOUT_RENDER_CHANGE)}AfterChangeProperty(){const d=this._numericInterpolationAdapter,c=this._numericInterpolationAdapter.GetPropertyTrack(),f=c.GetPropertyName();d._PickResultMode(()=>{},()=>{const l=c.GetInstance();if(b.has(l)){var g=b.get(l),k=c.GetSourceAdapterId();if(g.has(k)){var m=g.get(k);if(m.has(f)){var u=m.get(f),x=u.value;u.used&&d._SetterAbsolute(x); m.delete(f);0===m.size&&g.delete(k);0===g.size&&b.delete(l)}}}})}_MaybeEnsureValue(d,c,f,l,g,k){const m=this._numericInterpolationAdapter;l||(c&&d===c.GetTime()?m._AddDelta(c.GetValueWithResultMode(),c,f):f&&d===f.GetTime()?m._AddDelta(f.GetValueWithResultMode(),c,f):0===k-g&&m._AddDelta(c.GetValueWithResultMode(),c,f))}}e.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTimeline=a} {"use strict";const e=self.C3;new Map;class b{constructor(a){this._numericInterpolationAdapter=a}Release(){this._numericInterpolationAdapter=null}SetInitialState(){const a=this._numericInterpolationAdapter;a.SetFirstAbsoluteUpdate(!0);return this._GetAbsoluteInitialValue(a._FirstKeyframeGetter())}SetResumeState(){const a=this._numericInterpolationAdapter;if(a._FirstKeyframeGetter()!==a._CurrentKeyframeGetter())return a.SetFirstAbsoluteUpdate(!0),this._GetAbsoluteInitialValue(a._CurrentKeyframeGetter())}BeforeChangeProperty(){}ChangeProperty(a, d,c,f,l,g){const k=this._numericInterpolationAdapter,m=k.GetLastValue();k._PickResultMode(()=>{k._Setter(d-m,c,f);g&&this._MaybeEnsureValue(a,c,f,l,m,d)},()=>{k._PickFirstAbsoluteUpdate(()=>{k._Setter(m,c,f)},()=>{k._Setter(d-m,c,f);g&&this._MaybeEnsureValue(a,c,f,l,m,d)})});k.SetLastValue(d);return k._PickSource(()=>{},()=>e.TimelineState.LAYOUT_RENDER_CHANGE,()=>{},()=>e.TimelineState.LAYOUT_RENDER_CHANGE,()=>e.TimelineState.LAYOUT_RENDER_CHANGE)}AfterChangeProperty(){}_GetAbsoluteInitialValue(a){return a- this._numericInterpolationAdapter.GetCurrentState()}_MaybeEnsureValue(a,d,c,f,l,g){const k=this._numericInterpolationAdapter;f?d&&a===d.GetTime()?k._AddDelta(d.GetValueWithResultMode(),d,c):c&&a===c.GetTime()?k._AddDelta(c.GetValueWithResultMode(),d,c):c||k._AddDelta(d.GetValueWithResultMode(),d,c):d&&a===d.GetTime()?k._AddDelta(d.GetValueWithResultMode(),d,c):c&&a===c.GetTime()?k._AddDelta(c.GetValueWithResultMode(),d,c):0===g-l&&k._AddDelta(d.GetValueWithResultMode(),d,c)}}e.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTween= b} {"use strict";const e=self.C3,b=self.Ease;e.PropertyTrackState.NumericTypeAdapter=class{constructor(){}static WillChange(a,d,c,f){let l;switch(f){case "behavior":l=d.GetPropertyValueByIndex(a);break;case "effect":l=d[a];break;case "instance-variable":l=d.GetInstanceVariableValue(a);break;case "plugin":l=d.GetPropertyValueByIndex(a)}return l===c?!1:!0}static Interpolate(a,d,c,f){if(!c)return c=f.GetPropertyTrackDataItem(),c=f.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(c),c.GetValueWithResultMode();var l= f.GetInterpolationMode();"default"===l&&(l="continuous");"combo"===f.GetPropertyType()&&(l="discrete");if("discrete"===l)return d.GetValueWithResultMode();if("continuous"===l||"step"===l){"step"===l&&(l=f.GetTimeline().GetStep(),0!==l&&(l=1/l,a=Math.floor(a*l)/l));var g=d.GetTime();const k=c.GetTime();l=d.GetValueWithResultMode();const m=c.GetValueWithResultMode();if(l===m)return l;a=e.normalize(a,g,k);const u=d.GetEase();d=d.GetAddOn("cubic-bezier");c=c.GetAddOn("cubic-bezier");d&&d.GetStartEnable()&& c&&c.GetEndEnable()?(g=k-g,g=b.GetRuntimeEase(u)(g*a,0,1,g),g=b.GetRuntimeEase("cubicbezier")(g,l,l+d.GetStartAnchor(),m+c.GetEndAnchor(),m)):g=b.GetRuntimeEase(u)((k-g)*a,l,m-l,k-g);return"integer"===f.GetPropertyType()?Math.floor(g):g}}}} {"use strict";const e=self.C3;e.PropertyTrackState.AngleTypeAdapter=class{constructor(){}static WillChange(b,a,d,c){let f;switch(c){case "behavior":f=a.GetPropertyValueByIndex(b);break;case "effect":f=a[b];break;case "instance-variable":f=a.GetInstanceVariableValue(b);break;case "plugin":f=a.GetPropertyValueByIndex(b)}return f===d?!1:!0}static Interpolate(b,a,d,c){if(!d)return a=c.GetPropertyTrackDataItem(),a=c.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(a),a.GetValueWithResultMode();var f= c.GetInterpolationMode();"default"===f&&(f="continuous");"combo"===c.GetPropertyType()&&(f="discrete");if("discrete"===f)return a.GetValueWithResultMode();if("continuous"===f||"step"===f){"step"===f&&(c=c.GetTimeline().GetStep(),0!==c&&(c=1/c,b=Math.floor(b*c)/c));const l=a.GetTime(),g=d.GetTime();c=a.GetValueWithResultMode();d=d.GetValueWithResultMode();if(f=a.GetAddOn("angle")){const k=f.GetRevolutions();if(c===d&&0===k)return c;b=e.normalize(b,l,g);a=self.Ease.GetRuntimeEase(a.GetEase())(b,0,1, 1);switch(f.GetDirection()){case "closest":return e.angleLerp(c,d,a,k);case "clockwise":return e.angleLerpClockwise(c,d,a,k);case "anti-clockwise":return e.angleLerpAntiClockwise(c,d,a,k)}}else{if(c===d)return c;b=e.normalize(b,l,g);a=self.Ease.GetRuntimeEase(a.GetEase());return e.angleLerp(c,d,a(b,0,1,1))}}}}}"use strict"; self.C3.PropertyTrackState.BooleanTypeAdapter=class{constructor(){}static WillChange(e,b,a,d){let c;switch(d){case "behavior":c=b.GetPropertyValueByIndex(e);break;case "effect":c=b[e];break;case "instance-variable":c=b.GetInstanceVariableValue(e);break;case "plugin":c=b.GetPropertyValueByIndex(e)}return!!c===!!a?!1:!0}static Interpolate(e,b,a,d){return a?b.GetValueWithResultMode()?1:0:(e=d.GetPropertyTrackDataItem(),e=d.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(e),e.GetValueWithResultMode()? 1:0)}}; {"use strict";const e=self.C3,b=[0,0,0],a=[0,0,0],d=[0,0,0];e.PropertyTrackState.ColorTypeAdapter=class{constructor(){}static WillChange(c,f,l,g){let k;switch(g){case "behavior":k=f.GetPropertyValueByIndex(c);break;case "effect":k=f[c];break;case "instance-variable":k=f.GetInstanceVariableValue(c);break;case "plugin":k=f.GetPropertyValueByIndex(c)}Array.isArray(l)?(b[0]=l[0],b[1]=l[1],b[2]=l[2]):(d.parseCommaSeparatedRgb(l),b[0]=Math.floor(255*d.getR()),b[1]=Math.floor(255*d.getG()),b[2]=Math.floor(255*d.getB())); Array.isArray(k)?(a[0]=k[0],a[1]=k[1],a[2]=k[2]):(d.parseCommaSeparatedRgb(k),a[0]=Math.floor(255*d.getR()),a[1]=Math.floor(255*d.getG()),a[2]=Math.floor(255*d.getB()));return b[0]!==a[0]||b[1]!==a[1]||b[2]!==a[2]?!0:!1}static Interpolate(c,f,l,g){if(!l){var k=g.GetPropertyTrackDataItem();k=g.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(k);g=k.GetValueWithResultMode();b[0]=g[0];b[1]=g[1];b[2]=g[2];return b}k=g.GetInterpolationMode();"default"===k&&(k="continuous");if("discrete"===k)return g= f.GetValueWithResultMode(),b[0]=g[0],b[1]=g[1],b[2]=g[2],b;if("continuous"===k||"step"===k){"step"===k&&(g=g.GetTimeline().GetStep(),0!==g&&(g=1/g,c=Math.floor(c*g)/g));g=f.GetTime();k=l.GetTime();var m=f.GetValueWithResultMode(),u=l.GetValueWithResultMode();c=e.normalize(c,g,k);var x=f.GetEase();f=m[0];l=m[1];m=m[2];const n=u[0],q=u[1];u=u[2];x=self.Ease.GetRuntimeEase(x);g=k-g;k=g*c;b[0]=f===n?f:x(k,f,n-f,g);b[1]=l===q?l:x(k,l,q-l,g);b[2]=m===u?m:x(k,m,u-m,g);return b}}}}"use strict"; self.C3.PropertyTrackState.TextTypeAdapter=class{constructor(){}static WillChange(e,b,a,d){let c;switch(d){case "behavior":c=b.GetPropertyValueByIndex(e);break;case "effect":c=b[e];break;case "instance-variable":c=b.GetInstanceVariableValue(e);break;case "plugin":c=b.GetPropertyValueByIndex(e)}return c===a?!1:!0}static Interpolate(e,b,a,d){return a?b.GetValueWithResultMode():(e=d.GetPropertyTrackDataItem(),e=d.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(e),e.GetValueWithResultMode())}}; {"use strict";const e=self.C3;e.TimelineDataManager=class{constructor(){this._timelineDataItems=new Map}Release(){for(const b of this._timelineDataItems.values())b.Release();this._timelineDataItems.clear();this._timelineDataItems=null}Add(b){b=new e.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,d,c){if(a)for(const f of a)e.TimelineDataManager._CreateDataItem("create",f,b,d,c)}static _LoadDataItemsFromJson(b, a,d,c){b.length?a.forEach((f,l)=>{b[l]._LoadFromJson(f)}):a.forEach(f=>{e.TimelineDataManager._CreateDataItem("load",f,b,d,c)})}static _CreateDataItem(b,a,d,c,f){let l;if("function"===typeof c)switch(b){case "load":l=new c(null,f);break;case "create":l=new c(a,f)}else if("object"===typeof c)switch(c=c.map.get(a[c.prop]),b){case "load":l=new c(null,f);break;case "create":l=new c(a,f)}switch(b){case "load":l._LoadFromJson(a);d.push(l);break;case "create":if("function"===typeof l.GetEnable&&!l.GetEnable())return l.Release(); d.push(l)}}}} {"use strict";const e=self.C3;e.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 e.TrackData(b[5],this))}Release(){this._trackData.Release();this._trackData= null}GetTrackData(){this._trackData||(this._trackData=new e.TrackData(null,this));return this._trackData}GetName(){return this._name}SetName(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 e=self.C3;class b{constructor(a,d){this._trackData=d;this._additionalInstanceData=this._instanceData=null;this._objectClassIndex=this._instanceUid=NaN;this._resultMode=this._interpolationMode="default";this._enabled=!1;this._propertyTrackData=this._keyframeData=null;this._id="";this._nestedData=null;this._startOffset=0;this._localTotalTime=this._trackData.GetTimelineDataItem().GetTotalTime();this._type=0;this._name="";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 e.KeyframeData(a[4],this),this._propertyTrackData=new e.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 e.KeyframeData(null,this));return this._keyframeData}GetPropertyTrackData(){this._propertyTrackData||(this._propertyTrackData=new e.PropertyTrackData(null,this));return this._propertyTrackData}GetInstanceData(){return this._instanceData}GetObjectClassIndex(){return this._objectClassIndex}SetObjectClassIndex(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._type=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))}}e.TrackData=class{constructor(a, d){this._timelineDataItem=d;this._trackDataItems=[];this._keyframeTimeMap=new Map;e.TimelineDataManager._CreateDataItems(this._trackDataItems,a,b,this)}Release(){this._timelineDataItem=null;for(const a of this._trackDataItems)a.Release();e.clearArray(this._trackDataItems);this._trackDataItems=null;this._keyframeTimeMap.clear();this._keyframeTimeMap=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, d){const c=this._keyframeTimeMap.get(d);if(c&&c.has(a))return c.get(a);for(const f of d.GetKeyframeData().keyframeDataItems())if(f.GetTime()===a)return c||this._keyframeTimeMap.set(d,new Map),this._keyframeTimeMap.get(d).set(a,f),f}GetFirstKeyFrameDataItemHigherThan(a,d){for(const c of d.GetKeyframeData().keyframeDataItems())if(c.GetTime()>a)return c}GetFirstKeyFrameDataItemHigherOrEqualThan(a,d){for(const c of d.GetKeyframeData().keyframeDataItems())if(c.GetTime()>=a)return c}GetFirstKeyFrameDataItemLowerOrEqualThan(a, d){for(const c of d.GetKeyframeData().keyframeDataItemsReverse())if(c.GetTime()<=a)return c}*trackDataItems(){for(const a of this._trackDataItems)yield a}_SaveToJson(){return{trackDataItemsJson:this._trackDataItems.map(a=>a._SaveToJson())}}_LoadFromJson(a){a&&e.TimelineDataManager._LoadDataItemsFromJson(this._trackDataItems,a.trackDataItemsJson,b,this)}}} {"use strict";const e=self.C3;class b{constructor(a,d){this._propertyTrackData=d;this._sourceAdapterId="";this._type=this._property=this._sourceAdapterArguments=null;this._max=this._min=NaN;this._resultMode=this._interpolationMode="default";this._enabled=!1;this._propertyKeyframeData=null;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 e.PropertyKeyframeData(a[8],this))}Release(){this._propertyKeyframeData.Release();this._sourceAdapterArguments=this._propertyTrackData=this._propertyKeyframeData=null}GetPropertyTrackData(){return this._propertyTrackData}GetPropertyKeyframeData(){this._propertyKeyframeData||(this._propertyKeyframeData=new e.PropertyKeyframeData(null,this));return this._propertyKeyframeData}GetSourceAdapterId(){return this._sourceAdapterId}SetSourceAdapterId(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}_SaveToJson(){return{propertyKeyframeDataJson:this._propertyKeyframeData._SaveToJson(),sourceAdapterId:this._sourceAdapterId,sourceAdapterArguments:this._sourceAdapterArguments,property:this._property,type:this._type,min:this._min,max:this._max,interpolationMode:this._interpolationMode,resultMode:this._resultMode,enabled:this._enabled}}_LoadFromJson(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.GetPropertyKeyframeData()._LoadFromJson(a.propertyKeyframeDataJson))}}e.PropertyTrackData=class{constructor(a,d){this._trackDataItem=d;this._propertyTrackDataItems=[];this._propertyKeyframeTimeMap=new Map;e.TimelineDataManager._CreateDataItems(this._propertyTrackDataItems,a,b,this)}Release(){this._trackDataItem=null;for(const a of this._propertyTrackDataItems)a.Release(); e.clearArray(this._propertyTrackDataItems);this._propertyTrackDataItems=null;this._propertyKeyframeTimeMap.clear();this._propertyKeyframeTimeMap=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, d){const c=this._propertyKeyframeTimeMap.get(d);if(c&&c.has(a))return c.get(a);const f=d.GetPropertyKeyframeData();for(const l of f.propertyKeyframeDataItems())if(l.GetTime()===a)return c||this._propertyKeyframeTimeMap.set(d,new Map),this._propertyKeyframeTimeMap.get(d).set(a,l),l}GetFirstPropertyKeyFrameDataItemHigherThan(a,d){d=d.GetPropertyKeyframeData();for(const c of d.propertyKeyframeDataItems())if(c.GetTime()>a)return c}GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(a,d){d=d.GetPropertyKeyframeData(); for(const c of d.propertyKeyframeDataItems())if(c.GetTime()>=a)return c}GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(a,d){d=d.GetPropertyKeyframeData();for(const c of d.propertyKeyframeDataItemsReverse())if(c.GetTime()<=a)return c}*propertyTrackDataItems(){for(const a of this._propertyTrackDataItems)yield a}_SaveToJson(){return{propertyTrackDataItemsJson:this._propertyTrackDataItems.map(a=>a._SaveToJson())}}_LoadFromJson(a){a&&e.TimelineDataManager._LoadDataItemsFromJson(this._propertyTrackDataItems, a.propertyTrackDataItemsJson,b,this)}}} {"use strict";const e=self.C3;class b{constructor(a,d){this._keyframeData=d;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(c=>c.toLowerCase())))}Release(){this._keyframeData=null;e.clearArray(this._tags);this._tags=null;this._lowerTags.clear();this._lowerTags=null}GetKeyframeData(){return this._keyframeData}GetTime(){return this._time}SetTime(a){this._time=a}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(d=>d.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(d=> d.toLowerCase())))}}e.KeyframeData=class{constructor(a,d){this._trackDataItem=d;this._keyframeDataItems=[];e.TimelineDataManager._CreateDataItems(this._keyframeDataItems,a,b,this)}Release(){this._trackDataItem=null;for(const a of this._keyframeDataItems)a.Release();e.clearArray(this._keyframeDataItems);this._keyframeDataItems=null}GetTrackDataItem(){return this._trackDataItem}GetKeyframeDataItemCount(){return this._keyframeDataItems.length}GetKeyframeDataItemArray(){return this._keyframeDataItems}AddEmptyKeyframeDataItem(){const a= new b(null,this);this._keyframeDataItems.push(a);return a}DeleteKeyframeDataItems(a){for(const d of this._keyframeDataItems){if(!a(d))continue;const c=this._keyframeDataItems.indexOf(d);-1!==c&&(d.Release(),this._keyframeDataItems.splice(c,1))}this.SortKeyframeDataItems()}SortKeyframeDataItems(){this._keyframeDataItems.sort((a,d)=>a.GetTime()-d.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&&e.TimelineDataManager._LoadDataItemsFromJson(this._keyframeDataItems,a.keyframeDataItemsJson,b,this)}}} {"use strict";const e=self.C3;class b{constructor(a,d){this._propertyKeyframeData=d;this._aValue=this._value=null;this._type="";this._time=NaN;this._ease="noease";this._enable=!1;this._addonData=null;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 e.AddonData(a[4],this)))}Release(){this._propertyKeyframeData=null;this._addonData&&(this._addonData.Release(),this._addonData=null)}GetAddonData(){return this._addonData}GetValue(){return this._value}SetValue(a){"color"=== this._type&&e.IsFiniteNumber(a)?(this._value[0]=e.GetRValue(a),this._value[1]=e.GetGValue(a),this._value[2]=e.GetBValue(a)):this._value=a}GetAbsoluteValue(){return this._aValue}SetAbsoluteValue(a){"color"===this._type&&e.IsFiniteNumber(a)?(this._aValue[0]=e.GetRValue(a),this._aValue[1]=e.GetGValue(a),this._aValue[2]=e.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}GetEase(){return this._ease}SetEase(a){this._ease=a}GetEnable(){return this._enable}SetEnable(a){this._enable=!!a}GetAddOn(a){if(this.GetAddonData())for(const d of this.GetAddonData().addonDataItems())if(d.GetId()===a)return d}_SaveToJson(){const a=this._addonData;return{addonDataJson:a?a._SaveToJson():a,value:this._value,aValue:this._aValue,type:this._type,time:this._time, ease:this._ease,enable:this._enable}}_LoadFromJson(a){a&&(a.addonDataJson&&this._addonData._SetFromJson(a.addonDataJson),this._value=a.value,this._aValue=a.aValue,this._type=a.type,this._time=a.time,this._ease=a.ease,this._enable=a.enable)}}e.PropertyKeyframeData=class{constructor(a,d){this._propertyTrackDataItem=d;this._propertyKeyframeDataItems=[];e.TimelineDataManager._CreateDataItems(this._propertyKeyframeDataItems,a,b,this)}Release(){this._propertyTrackDataItem=null;for(const a of this._propertyKeyframeDataItems)a.Release(); e.clearArray(this._propertyKeyframeDataItems);this._propertyKeyframeDataItems=null}AddEmptyPropertyKeyframeDataItem(){const a=new b(null,this);this._propertyKeyframeDataItems.push(a);return a}DeletePropertyKeyframeDataItems(a){for(const d of this._propertyKeyframeDataItems){if(!a(d))continue;const c=this._propertyKeyframeDataItems.indexOf(d);-1!==c&&(d.Release(),this._propertyKeyframeDataItems.splice(c,1))}this.SortPropertyKeyFrameDataItems()}SortPropertyKeyFrameDataItems(){this._propertyKeyframeDataItems.sort((a, d)=>a.GetTime()-d.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&&e.TimelineDataManager._LoadDataItemsFromJson(this._propertyKeyframeDataItems,a.propertyKeyframeDataItemsJson,b,this)}}} {"use strict";const e=self.C3;class b{constructor(c,f){this._addonData=f;this._id=c[0];this._data=c[1]}Release(){this._data=this._addonData=null}GetAddonData(){return this._addonData}GetId(){return this._id}_SaveToJson(){return{id:this._id,data:this._data}}_LoadFromJson(c){c&&(this._id=c.id,this._data=c.data)}}class a extends b{constructor(c,f){super(c,f);this._startAnchor=this._data[0];this._startEnable=!!this._data[1];this._endAnchor=this._data[2];this._endEnable=!!this._data[3]}Release(){super.Release()}GetStartAnchor(){return this._startAnchor}GetStartEnable(){return this._startEnable}GetEndAnchor(){return this._endAnchor}GetEndEnable(){return this._endEnable}_SaveToJson(){return Object.assign(super._SaveToJson(), {startAnchor:this._startAnchor,startEnable:!!this._startEnable,endAnchor:this._endAnchor,endEnable:!!this._endEnable})}_LoadFromJson(c){c&&(super._LoadFromJson(c),this._startAnchor=c.startAnchor,this._startEnable=!!c.startEnable,this._endAnchor=c.endAnchor,this._endEnable=!!c.endEnable)}}class d extends b{constructor(c,f){super(c,f);this._direction=this._data[0];this._revolutions=this._data[1]}Release(){super.Release()}GetDirection(){return this._direction}GetRevolutions(){return this._revolutions}_SaveToJson(){return Object.assign(super._SaveToJson(), {direction:this._direction,revolutions:this._revolutions})}_LoadFromJson(c){c&&(super._LoadFromJson(c),this._direction=c.direction,this._revolutions=c.revolutions)}}e.AddonData=class{constructor(c,f){this._propertyKeyframeDataItem=f;this._addonDataItems=[];e.TimelineDataManager._CreateDataItems(this._addonDataItems,c,{prop:0,map:new Map([["cubic-bezier",a],["angle",d]])},this)}Release(){this._propertyKeyframeDataItem=null;for(const c of this._addonDataItems)c.Release();e.clearArray(this._addonDataItems); this._addonDataItems=null}GetPropertyKeyframeDataItem(){return this._propertyKeyframeDataItem}*addonDataItems(){for(const c of this._addonDataItems)yield c}_SaveToJson(){return{addonDataItemsJson:this._addonDataItems.map(c=>c._SaveToJson())}}_LoadFromJson(c){c&&e.TimelineDataManager._LoadDataItemsFromJson(this._addonDataItems,c.addonDataItemsJson,{prop:"id",map:new Map([["cubic-bezier",a],["angle",d]])},this)}}} {"use strict";const e=self.C3;let b=0;e.Tween=class extends e.TimelineState{constructor(a,d){super(`tween-${b++}`,a,d);this._id="";this._destroyInstanceOnComplete=!1;this._initialValueMode="start-value";this._on_started_callbacks=this._on_completed_callbacks=null}GetInstance(){var a=this.GetTracks();if(a&&a.length&&(a=a[0])){var d=a.GetInstance();return a.IsInstanceValid()?d:null}}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,d){for(const f of this._tracks)for(const l of f._propertyTracks){if(l.GetPropertyName()!==d)continue;var c=l.GetPropertyTrackData(); const g=l.GetPropertyTrackDataItem();c=c.GetFirstPropertyKeyframeDataItem(g);c.SetValue(a);c.SetAbsoluteValue(a)}}_GetPropertyTrackState(a){for(const d of this._tracks)for(const c of d._propertyTracks)if(c.GetPropertyName()===a)return c}BeforeSetEndValues(a){for(const f of a)a=this._GetPropertyTrackState(f),this.SetStartValue(a.GetCurrentState(),f);if(this.IsForwardPlayBack()){var d=this.GetTotalTime()-this.GetTime();this.SetTotalTime(d);for(var c of this._tracks)c.SetLocalTotalTime(d);this._SetTime(0)}else{c= this.GetTime();this.SetTotalTime(c);for(d of this._tracks)d.SetLocalTotalTime(c);this._SetTime(c)}this.SetInitialStateFromSetTime()}SetEndValue(a,d){var c=this._GetPropertyTrackState(d);d=c.GetPropertyTrackData();c=c.GetPropertyTrackDataItem();d=d.GetLastPropertyKeyframeDataItem(c);d.SetTime(this.GetTotalTime());d.SetValue(a);d.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 d of this._tracks)d.CompareInitialStateWithCurrent();super.SetInitialState(a)}Stop(a=!1){super.Stop(a);if(!this.IsComplete())for(const d of this._tracks)d.SaveState()}Reset(a=!0,d=!1){this._DeleteIntermediateKeyframes();super.Reset(a,d)}_DeleteIntermediateKeyframes(){for(const a of this._tracks){const d=c=>{c=c.GetTime();const f=this.GetTotalTime();return 0!==c&&c!==f};a.DeleteKeyframes(d); a.DeletePropertyKeyframes(d)}}_OnBeforeChangeLayout(){if(this.IsReleased())return!0;const a=this.GetInstance();if(a&&a.GetObjectClass().IsGlobal())return!1;this._timelineManager.CompleteTimeline(this);this.ResetBeforeChangeLayout();return!0}MaybeTriggerKeyframeReachedConditions(){}Tick(a,d){a=this.GetInstance();a=this.GetRuntime().GetDt(a);super.Tick(a,1)}_SaveToJson(){const a=super._SaveToJson(),d=this.GetTimelineDataItem();return Object.assign(a,{tweenDataItemJson:d._SaveToJson(),id:this._id,destroyInstanceOnComplete:this._destroyInstanceOnComplete, initialValueMode:this._initialValueMode})}_LoadFromJson(a){a&&(this.GetTimelineDataItem()._LoadFromJson(a.tweenDataItemJson),super._LoadFromJson(a),this._id=a.id,this._destroyInstanceOnComplete=a.destroyInstanceOnComplete,this._initialValueMode=a.initialValueMode)}static IsPlaying(a){return a.IsPlaying()}static IsPaused(a){return a.IsPaused()}static Build(a){var d=a.runtime.GetTimelineManager(),c=new e.TimelineDataItem;if(a.json){c._LoadFromJson(a.json.tweenDataItemJson);var f=new e.Tween(c,d);f._LoadFromJson(a.json); return f}d=new e.Tween(c,d);e.IsArray(a.propertyTracksConfig)||(a.propertyTracksConfig=[a.propertyTracksConfig]);d.SetId(a.id);d.SetTags(a.tags);d.SetInitialValueMode(a.initialValueMode);d.SetDestroyInstanceOnComplete(a.releaseOnComplete);d.SetLoop(a.loop);d.SetPingPong(a.pingPong);d.SetTotalTime(a.time);d.SetStep(0);d.SetInterpolationMode("default");d.SetResultMode(a.propertyTracksConfig[0].resultMode);c=d.AddTrack();c.SetInstanceUID(a.instance.GetUID());c.SetInterpolationMode("default");c.SetResultMode(a.propertyTracksConfig[0].resultMode); c.SetEnable(!0);c.SetObjectClassIndex(a.instance.GetObjectClass().GetIndex());var l=a.instance.GetSdkInstance(),g=l.IsOriginalSizeKnown()?l.GetOriginalWidth():a.instance.GetWorldInfo().GetWidth();l=l.IsOriginalSizeKnown()?l.GetOriginalHeight():a.instance.GetWorldInfo().GetHeight();c.SetOriginalWidth(g);c.SetOriginalHeight(l);g=c.AddKeyframe();g.SetTime(0);g.SetEase("noease");g.SetEnable(!0);g.SetTags("");g=c.AddKeyframe();g.SetTime(a.time);g.SetEase("noease");g.SetEnable(!0);g.SetTags("");for(f of a.propertyTracksConfig)g= c.AddPropertyTrack(),g.SetSourceAdapterId(f.sourceId),g.SetSourceAdapterArgs(f.sourceArgs),g.SetPropertyName(f.property),g.SetPropertyType(f.type),g.SetMin(NaN),g.SetMax(NaN),g.SetInterpolationMode("default"),g.SetResultMode(f.resultMode),g.SetEnable(!0),l=g.AddPropertyKeyframe(),l.SetType(f.valueType),l.SetTime(0),l.SetEase(f.ease),l.SetEnable(!0),l.SetValue(f.startValue),l.SetAbsoluteValue(f.startValue),g=g.AddPropertyKeyframe(),g.SetType(f.valueType),g.SetTime(a.time),g.SetEase(f.ease),g.SetEnable(!0), g.SetValue(f.endValue),g.SetAbsoluteValue(f.endValue);return d}}} {"use strict";const e=self.C3,b=self.Ease;e.Transition=class extends e.DefendedBase{constructor(a){super();this._name=a[0];this._transitionKeyframes=[];for(const d of a[1])a=e.TransitionKeyframe.Create(this,d),this._transitionKeyframes.push(a);this._precalculatedSamples=new Map;this._transitionKeyframeCache=new Map;this._PreCalcSamples();b.AddCustomEase(this._name,(d,c,f,l)=>this.Interpolate(d,c,f,l))}static Create(a){return e.New(e.Transition,a)}Release(){for(const a of this._transitionKeyframes)a.Release(); e.clearArray(this._transitionKeyframes);this._transitionKeyframes=null;this._precalculatedSamples.clear();this._precalculatedSamples=null;this._transitionKeyframeCache.clear();this._transitionKeyframeCache=null}GetTransitionKeyFrameAt(a){const d=this._transitionKeyframeCache.get(a);if(d)return d;for(const c of this._transitionKeyframes)if(c.GetValueX()===a)return this._transitionKeyframeCache.set(a,c),c}GetFirstTransitionKeyFrameHigherThan(a){for(const d of this._transitionKeyframes)if(d.GetValueX()> a)return d}GetFirstTransitionKeyFrameHigherOrEqualThan(a){for(const d of this._transitionKeyframes)if(d.GetValueX()>=a)return d}GetFirstTransitionKeyFrameLowerOrEqualThan(a){for(let d=this._transitionKeyframes.length-1;0<=d;d--){const c=this._transitionKeyframes[d];if(c.GetValueX()<=a)return c}}Interpolate(a,d,c,f){var l=a/f;(a=this.GetTransitionKeyFrameAt(l))?f=this.GetFirstTransitionKeyFrameHigherThan(l):(a=this.GetFirstTransitionKeyFrameLowerOrEqualThan(l),f=this.GetFirstTransitionKeyFrameHigherOrEqualThan(l)); var g=f.GetValueX()-a.GetValueX();l=e.mapToRange(l,a.GetValueX(),f.GetValueX(),0,g);g=a.GetValueX();const k=a.GetValueY(),m=a.GetValueX()+a.GetStartAnchorX(),u=a.GetValueY()+a.GetStartAnchorY(),x=f.GetValueX()+f.GetEndAnchorX(),n=f.GetValueY()+f.GetEndAnchorY(),q=f.GetValueX();f=f.GetValueY();f=b.GetRuntimeEase("spline")(l,g,k,m,u,x,n,q,f,this._precalculatedSamples.get(a));f+=a.GetValueY();return(1-f)*d+f*(d+c)}_PreCalcSamples(){this._precalculatedSamples.clear();for(let c=0;c<this._transitionKeyframes.length- 1;c++){var a=this._transitionKeyframes[c];if(!a.GetStartEnable())continue;var d=this._transitionKeyframes[c+1];const f=a.GetValueX(),l=a.GetValueX()+a.GetStartAnchorX(),g=d.GetValueX()+d.GetEndAnchorX();d=d.GetValueX();this._precalculatedSamples.set(a,b.GetBezierSamples(f,l,g,d))}}}} {"use strict";const e=self.C3;e.TransitionKeyframe=class extends e.DefendedBase{constructor(b,a){super();this._transition=b;this._valueX=a[0];this._valueY=a[1];this._startAnchorX=a[2];this._startAnchorY=a[3];this._endAnchorX=a[4];this._endAnchorY=a[5];this._startEnable=a[6];this._endEnable=a[7]}Release(){this._transition=null}static Create(b,a){return e.New(e.TransitionKeyframe,b,a)}GetValueX(){return this._valueX}GetValueY(){return this._valueY}GetStartAnchorX(){return this._startAnchorX}GetStartAnchorY(){return this._startAnchorY}GetEndAnchorX(){return this._endAnchorX}GetEndAnchorY(){return this._endAnchorY}GetStartEnable(){return this._startEnable}GetEndEnable(){return this._endEnable}}} {"use strict";const e=self.C3;e.TransitionManager=class extends e.DefendedBase{constructor(b){super();this._runtime=b;this._transitions=[]}Release(){for(const b of this._transitions)b.Release();e.clearArray(this._transitions);this._transitions=null}Create(b){this._transitions.push(e.Transition.Create(b))}}} {"use strict";const e=self.C3;e.SolStack=class extends e.DefendedBase{constructor(b){super();this._objectClass=b;this._stack=[];this._stack.push(e.New(e.Sol,this));this._index=0;this._current=this._stack[0]}Release(){for(const b of this._stack)b.Release();e.clearArray(this._stack);this._objectClass=this._current=null}GetObjectClass(){return this._objectClass}GetCurrentSol(){return this._current}Clear(){this.GetCurrentSol().Clear()}PushClean(){var b=this._stack,a=++this._index;a===b.length?(a=e.New(e.Sol, this),b.push(a),this._current=a):(b=b[a],b.Reset(),this._current=b)}PushCopy(){const b=this._stack,a=++this._index;a===b.length&&b.push(e.New(e.Sol,this));const d=b[a];d.Copy(b[a-1]);this._current=d}Pop(){this._current=this._stack[--this._index]}RemoveInstances(b){const a=this._stack;for(let d=0,c=a.length;d<c;++d)a[d].RemoveInstances(b)}}} {"use strict";const e=self.C3;e.Sol=class extends e.DefendedBase{constructor(b){super();this._stack=b;this._objectClass=this._stack.GetObjectClass();this._eventStack=this._objectClass.GetRuntime().GetEventStack();this._selectAll=!0;this._instances=[];this._elseInstances=[]}Release(){this.ClearArrays();this._eventStack=this._objectClass=this._stack=null}ClearArrays(){e.clearArray(this._instances);e.clearArray(this._elseInstances)}GetObjectClass(){return this._objectClass}IsSelectAll(){return this._selectAll}HasAnyInstances(){return this._selectAll? !!this._objectClass.GetInstanceCount():!!this._instances.length}GetInstances(){return this._selectAll?this._objectClass.GetInstances():this._instances}HasAnyElseInstances(){return!!this._elseInstances.length}GetElseInstances(){return this._elseInstances}GetExpressionInstances(){const b=this.GetInstances();return b.length?b:this._elseInstances}Reset(){this._selectAll=!0;e.clearArray(this._elseInstances)}Clear(){this._selectAll=!0}Copy(b){b.IsSelectAll()?this.Reset():(this._selectAll=!1,e.shallowAssignArray(this._instances, b._instances),e.clearArray(this._elseInstances))}_PushInstance(b){this._instances.push(b)}_PushElseInstance(b){this._elseInstances.push(b)}_SetSelectAll(b){this._selectAll=!!b}_GetOwnInstances(){return this._instances}_GetOwnElseInstances(){return this._elseInstances}SetSinglePicked(b){this._selectAll=!1;e.clearArray(this._instances);this._instances.push(b)}SetArrayPicked(b){this._selectAll=!1;e.shallowAssignArray(this._instances,b)}SetSetPicked(b){this._selectAll=!1;e.clearArray(this._instances); for(const a of b)this._instances.push(a)}AddElseInstances(b,a){for(const d of a)b.has(d)||this._elseInstances.push(d)}TransferElseInstancesToOwn(b){for(const a of b)this._instances.push(a);e.arrayRemoveAllInSet(this._elseInstances,b)}PickOne(b){b&&(this._eventStack.GetCurrentStackFrame().GetCurrentEvent().IsOrBlock()?(this.IsSelectAll()&&(e.clearArray(this._instances),e.shallowAssignArray(this._elseInstances,b.GetObjectClass().GetInstances()),this._selectAll=!1),b=this._elseInstances.indexOf(b),-1!== b&&(this._instances.push(this._elseInstances[b]),this._elseInstances.splice(b,1))):this.SetSinglePicked(b))}RemoveInstances(b){e.arrayRemoveAllInSet(this._instances,b);e.arrayRemoveAllInSet(this._elseInstances,b)}}} {"use strict";const e=self.C3;e.EventStack=class extends e.DefendedBase{constructor(b){super();this._eventSheetManager=b;this._runtime=this._eventSheetManager.GetRuntime();this._stack=[];this._stack.push(e.New(e.EventStackFrame,this,null));this._index=0;this._expFuncStack=[]}Release(){for(const b of this._stack)b.Release();e.clearArray(this._stack);e.clearArray(this._expFuncStack);this._runtime=this._eventSheetManager=null}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}GetCurrentStackFrame(){return this._stack[this._index]}Push(b){var a= this._stack;const d=++this._index;if(d===a.length)return b=e.New(e.EventStackFrame,this,b),a.push(b),b;a=a[d];a.Reset(b);return a}Pop(){--this._index}PushExpFunc(b){this._expFuncStack.push(b)}PopExpFunc(){this._expFuncStack.pop()}GetCurrentExpFuncStackFrame(){const b=this._expFuncStack;return 0===b.length?null:b.at(-1)}}} {"use strict";const e=self.C3;e.EventStackFrame=class extends e.DefendedBase{constructor(b,a){super();this._stack=b;this._runtime=this._stack.GetRuntime();this._currentEvent=a;this._actIndex=this._cndIndex=0;this._elseBranchRan=this._lastEventTrue=!1;this._expressionObjectClass=null;this._functionReturnValue=this._functionReturnType=0}Release(){this.Reset(null);this._runtime=this._stack=null}Reset(b){this._currentEvent=b;this._actIndex=this._cndIndex=0;this._elseBranchRan=this._lastEventTrue=!1}_Restore(b, a){this._currentEvent=b;this._cndIndex=0;this._actIndex=a}ResetQuick(){this._actIndex=this._cndIndex=0}GetCurrentEvent(){return this._currentEvent}SetCurrentEvent(b){this._currentEvent=b}GetConditionIndex(){return this._cndIndex}SetConditionIndex(b){this._cndIndex=b}GetActionIndex(){return this._actIndex}SetActionIndex(b){this._actIndex=b}SetLastEventTrue(b){this._lastEventTrue=!!b}GetLastEventTrue(){return this._lastEventTrue}SetElseBranchRan(b){this._elseBranchRan=!!b}GetElseBranchRan(){return this._elseBranchRan}SetExpressionObjectClass(b){this._expressionObjectClass= b}GetExpressionObjectClass(){return this._expressionObjectClass}InitCallFunctionExpression(b,a){this._functionReturnType=b;this._functionReturnValue=a}GetFunctionReturnType(){return this._functionReturnType}SetFunctionReturnValue(b){this._functionReturnValue=b}GetFunctionReturnValue(){return this._functionReturnValue}IsSolModifierAfterCnds(){const b=this._currentEvent;return b.IsSolWriterAfterCnds()?!0:this._cndIndex<b.GetConditionCount()-1?!!b.GetSolModifiers().length:!1}}} {"use strict";const e=self.C3;e.LocalVarStack=class extends e.DefendedBase{constructor(b){super();this._eventSheetManager=b;this._runtime=this._eventSheetManager.GetRuntime();this._stack=[];this._index=-1;this._current=null;this._initialValues=[]}Release(){e.clearArray(this._stack);this._runtime=this._eventSheetManager=null}_SetInitialValues(b){this._initialValues=b;b=this._initialValues.slice(0);this._stack.push(b);this._index=0;this._current=b}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}GetCurrent(){return this._current}Push(){const b= ++this._index,a=this._stack;b===a.length?a.push(this._initialValues.slice(0)):e.shallowAssignArray(a[b],this._initialValues);this._current=a[b]}Pop(){this._current=this._stack[--this._index]}}} {"use strict";const e=self.C3;e.LoopStack=class extends e.DefendedBase{constructor(b){super();this._eventSheetManager=b;this._runtime=this._eventSheetManager.GetRuntime();this._stack=[];this._index=-1}Release(){e.clearArray(this._stack);this._runtime=this._eventSheetManager=null}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}IsInLoop(){return 0<=this._index}GetCurrent(){return this._stack[this._index]}Push(){++this._index;if(this._index===this._stack.length){var b= e.New(e.Loop,this);this._stack.push(b);return b}b=this._stack[this._index];b.Reset();return b}Pop(){--this._index}FindByName(b){const a=this._stack;for(let d=this._index;0<=d;--d){const c=a[d];if(c.GetName()===b)return c}return null}_GetStack(){return this._stack.slice(0,this._index+1)}}} {"use strict";const e=self.C3;e.Loop=class extends e.DefendedBase{constructor(b){super();this._loopStack=b;this._name="";this._index=0;this._isStopped=!1;this._end=NaN}Reset(){this._name="";this._index=0;this._isStopped=!1;this._end=NaN}SetName(b){this._name=b}GetName(){return this._name}SetIndex(b){this._index=b}GetIndex(){return this._index}Stop(){this._isStopped=!0}IsStopped(){return this._isStopped}SetEnd(b){this._end=b}GetEnd(){return this._end}}} {"use strict";const e=self.C3;e.ArrayStack=class extends e.DefendedBase{constructor(){super();this._stack=[];this._index=-1}Release(){e.clearArray(this._stack)}GetCurrent(){return this._stack[this._index]}Push(){++this._index;if(this._index===this._stack.length){const b=[];this._stack.push(b);return b}return this._stack[this._index]}Pop(){--this._index}}} {"use strict";const e=self.C3;function b(d,c){return d.GetIndex()-c.GetIndex()}function a(d,c){for(let f=0,l=d.length;f<l;++f)if(d[f]!==c[f])return!1;return!0}e.EventSheetManager=class extends e.DefendedBase{constructor(d){super();this._runtime=d;this._allSheets=[];this._sheetsByName=new Map;this._allGroups=[];this._groupsByName=new Map;this._blocksBySid=new Map;this._cndsBySid=new Map;this._actsBySid=new Map;this._allUniqueSolModifiers=new Map;this._eventVarsBySid=new Map;this._nextLocalVarIndex= 0;this._allGlobalVars=[];this._allLocalVars=[];this._localVarInitialValues=[];this._functionBlocksByName=new Map;this._eventStack=e.New(e.EventStack,this);this._localVarStack=e.New(e.LocalVarStack,this);this._loopStack=e.New(e.LoopStack,this);this._triggersToPostInit=[];this._queuedTriggers=[];this._queuedDebugTriggers=[];this._blockFlushingDepth=this._executingTriggerDepth=this._runningEventsDepth=0;this._scheduledWaits=[];this._asyncActionPromises=[];self.c3_callFunction=(c,f)=>this._InvokeFunctionFromJS(c, f)}Release(){this.ClearAllScheduledWaits();this._eventStack.Release();this._eventStack=null;this._localVarStack.Release();this._localVarStack=null;e.clearArray(this._queuedTriggers);e.clearArray(this._queuedDebugTriggers);this._runtime=null;e.clearArray(this._allSheets);this._sheetsByName.clear()}Create(d){d=e.New(e.EventSheet,this,d);this._allSheets.push(d);this._sheetsByName.set(d.GetName().toLowerCase(),d)}_AddTriggerToPostInit(d){this._triggersToPostInit.push(d)}_PostInit(){for(const d of this._functionBlocksByName.values())d._PostInit(!1); for(const d of this._allSheets)d._PostInit();for(const d of this._allSheets)d._UpdateDeepIncludes();for(const d of this._triggersToPostInit)d._PostInit(!1);e.clearArray(this._triggersToPostInit);this._localVarStack._SetInitialValues(this._localVarInitialValues)}GetRuntime(){return this._runtime}GetEventSheetByName(d){return this._sheetsByName.get(d.toLowerCase())||null}_RegisterGroup(d){this._allGroups.push(d);this._groupsByName.set(d.GetGroupName(),d)}_RegisterEventBlock(d){this._blocksBySid.set(d.GetSID(), d)}_RegisterCondition(d){this._cndsBySid.set(d.GetSID(),d)}_RegisterAction(d){this._actsBySid.set(d.GetSID(),d)}_RegisterFunctionBlock(d){this._functionBlocksByName.set(d.GetFunctionName().toLowerCase(),d)}_RegisterEventVariable(d){this._eventVarsBySid.set(d.GetSID(),d);d.IsGlobal()?this._allGlobalVars.push(d):this._allLocalVars.push(d)}_DeduplicateSolModifierList(d){2<=d.length&&d.sort(b);let c=this._allUniqueSolModifiers.get(d.length);c||(c=[],this._allUniqueSolModifiers.set(d.length,c));for(let f= 0,l=c.length;f<l;++f){const g=c[f];if(a(d,g))return g}c.push(d);return d}_GetNextLocalVarIndex(d){this._localVarInitialValues.push(d.GetInitialValue());return this._nextLocalVarIndex++}GetEventStack(){return this._eventStack}GetCurrentEventStackFrame(){return this.GetEventStack().GetCurrentStackFrame()}GetCurrentEvent(){return this.GetCurrentEventStackFrame().GetCurrentEvent()}GetCurrentCondition(){const d=this.GetCurrentEventStackFrame();return d.GetCurrentEvent().GetConditionAt(d.GetConditionIndex())}GetCurrentAction(){const d= this.GetCurrentEventStackFrame();return d.GetCurrentEvent().GetActionAt(d.GetActionIndex())}GetLocalVarStack(){return this._localVarStack}GetLoopStack(){return this._loopStack}GetAllLocalVariablesInScope(d){const c=[];for(d=d.GetScopeParent();d;)e.appendArray(c,d._GetAllLocalVariablesInScope()),d=d.GetScopeParent();return c}_GetLocalVariablesScriptInterface(d){const c={};for(const f of this.GetAllLocalVariablesInScope(d))c[f.GetJsPropName()]=f._GetScriptInterfaceDescriptor();return Object.create(Object.prototype, c)}GetEventVariableBySID(d){return this._eventVarsBySid.get(d)||null}GetEventBlockBySID(d){return this._blocksBySid.get(d)||null}GetConditionBySID(d){return this._cndsBySid.get(d)||null}GetActionBySID(d){return this._actsBySid.get(d)||null}GetFunctionBlockByName(d){return this._functionBlocksByName.get(d.toLowerCase())||null}GetAllGlobalVariables(){return this._allGlobalVars}GetAllLocalVariables(){return this._allLocalVars}ResetAllGlobalsToInitialValue(){for(const d of this._allGlobalVars)d.ResetToInitialValue()}GetEventGroupByName(d){return this._groupsByName.get(d.toLowerCase())|| null}GetEventGroupBySID(d){return(d=this._blocksBySid.get(d))&&d.IsGroup()?d:null}GetAllGroups(){return this._allGroups}ResetAllGroupsInitialActivation(){for(const d of this._allGroups)d.ResetInitialActivation()}_ResetAllHasRunFlags(){for(const d of this._allSheets)d._ResetHasRunFlag()}RunEvents(d){this._ResetAllHasRunFlags();this._runningEventsDepth++;for(const c of d.runningLayouts())if(d=c.GetEventSheet())this._runtime.PushCurrentLayout(c),d.Run(),this._runtime.PopCurrentLayout();this._runningEventsDepth--}async DebugRunEvents(d){this._ResetAllHasRunFlags(); this._runningEventsDepth++;for(const c of this._DebugRunEventsGen(d))await this._runtime.DebugBreak(c);this._runningEventsDepth--}*_DebugRunEventsGen(d){for(const c of d.runningLayouts())if(d=c.GetEventSheet())this._runtime.PushCurrentLayout(c),yield*d.DebugRun(),this._runtime.PopCurrentLayout()}_Trigger(d,c,f,l){let g=!1;if(!d.GetMainRunningLayout())return this.QueueTrigger(c,f,l);this._executingTriggerDepth++;for(const k of d.runningLayouts())if(d=k.GetEventSheet()){this._runtime.PushCurrentLayout(k); for(const m of d.deepIncludes()){const u=m._Trigger(c,f,l);g=g||u}d=d._Trigger(c,f,l);g=g||d;this._runtime.PopCurrentLayout()}this._executingTriggerDepth--;return g}*_DebugTrigger(d,c,f,l){let g=!1;if(!d.GetMainRunningLayout())return this.QueueTrigger(c,f,l);this._executingTriggerDepth++;for(const k of d.runningLayouts())if(d=k.GetEventSheet()){this._runtime.PushCurrentLayout(k);for(const m of d.deepIncludes()){const u=yield*m._DebugTrigger(c,f,l);g=g||u}d=yield*d._DebugTrigger(c,f,l);g=g||d;this._runtime.PopCurrentLayout()}this._executingTriggerDepth--; return g}QueueTrigger(d,c,f){this._queuedTriggers.push([d,c,f]);return!1}QueueDebugTrigger(d,c,f){let l=null;const g=new Promise(k=>l=k);this._queuedDebugTriggers.push([d,c,f,l]);return g}*_RunQueuedDebugTriggersGen(){if(this._runtime.HitBreakpoint())throw Error("should not be in breakpoint");const d=this._runtime.GetLayoutManager();for(;this._queuedDebugTriggers.length;){const [c,f,l,g]=this._queuedDebugTriggers.shift(),k=yield*this._DebugTrigger(d,c,f,l);g(k)}}async RunQueuedDebugTriggersAsync(){for(const d of this._RunQueuedDebugTriggersGen())await this._runtime.DebugBreak(d)}_FastTrigger(d, c,f,l){let g=!1;var k=d.GetMainRunningLayout();if(d=k.GetEventSheet()){this._executingTriggerDepth++;this._runtime.PushCurrentLayout(k);k=d.deepIncludes();for(let m=0,u=k.length;m<u;++m){const x=k[m]._FastTrigger(c,f,l);g=g||x}c=d._FastTrigger(c,f,l);g=g||c;this._runtime.PopCurrentLayout();this._executingTriggerDepth--;return g}}*_DebugFastTrigger(d,c,f,l){let g=!1;var k=d.GetMainRunningLayout();if(d=k.GetEventSheet()){this._executingTriggerDepth++;this._runtime.PushCurrentLayout(k);k=d.deepIncludes(); for(let m=0,u=k.length;m<u;++m){const x=yield*k[m]._DebugFastTrigger(c,f,l);g=g||x}c=yield*d._DebugFastTrigger(c,f,l);g=g||c;this._runtime.PopCurrentLayout();this._executingTriggerDepth--;return g}}GetTriggerDepth(){return this._executingTriggerDepth}IsInTrigger(){return 0<this.GetTriggerDepth()}_IncTriggerDepth(){return++this._executingTriggerDepth}_DecTriggerDepth(){--this._executingTriggerDepth}IsRunningEvents(){return 0<this._runningEventsDepth}IsInEventEngine(){return this.IsRunningEvents()|| this.IsInTrigger()}_RunQueuedTriggers(d){for(const [c,f,l]of this._queuedTriggers)this._Trigger(d,c,f,l);e.clearArray(this._queuedTriggers)}BlockFlushingInstances(d){d?this._blockFlushingDepth++:this._blockFlushingDepth--}IsFlushingBlocked(){return 0<this._blockFlushingDepth}ClearSol(d){for(let c=0,f=d.length;c<f;++c)d[c].GetSolStack().Clear()}PushCleanSol(d){for(let c=0,f=d.length;c<f;++c)d[c].GetSolStack().PushClean()}PushCopySol(d){for(let c=0,f=d.length;c<f;++c)d[c].GetSolStack().PushCopy()}PopSol(d){for(let c= 0,f=d.length;c<f;++c)d[c].GetSolStack().Pop()}AddScheduledWait(){const d=e.New(e.ScheduledWait,this);this._scheduledWaits.push(d);return d}scheduledWaits(){return this._scheduledWaits}RunScheduledWaits(){if(this._scheduledWaits.length){var d=this.GetCurrentEventStackFrame(),c=!1;this._runningEventsDepth++;for(let f=0,l=this._scheduledWaits.length;f<l;++f){const g=this._scheduledWaits[f];g._ShouldRun()&&g._Run(d);g.ShouldRelease()&&(c=!0)}c&&this._FilterScheduledWaitsToRelease();this._runningEventsDepth--}}async DebugRunScheduledWaits(){if(this._scheduledWaits.length){var d= this.GetCurrentEventStackFrame(),c=!1;this._runningEventsDepth++;for(let f=0,l=this._scheduledWaits.length;f<l;++f){const g=this._scheduledWaits[f];g._ShouldRun()&&await g._DebugRun(d);g.ShouldRelease()&&(c=!0)}c&&this._FilterScheduledWaitsToRelease();this._runningEventsDepth--}}_FilterScheduledWaitsToRelease(){const d=e.arrayFilterOut(this._scheduledWaits,c=>c.ShouldRelease());for(const c of d)c.Release()}ClearAllScheduledWaits(){for(const d of this._scheduledWaits)d.Release();e.clearArray(this._scheduledWaits)}RemoveInstancesFromScheduledWaits(d){for(const c of this._scheduledWaits)c.RemoveInstances(d)}AddAsyncActionPromise(d){this._asyncActionPromises.push(d)}ClearAsyncActionPromises(){e.clearArray(this._asyncActionPromises)}GetPromiseForAllAsyncActions(){const d= Promise.all(this._asyncActionPromises);this._asyncActionPromises=[];return d}_SaveToJson(){return{groups:this._SaveGroupsToJson(),cnds:this._SaveCndsToJson(),acts:this._SaveActsToJson(),vars:this._SaveVarsToJson(),waits:this._SaveScheduledWaitsToJson()}}_LoadFromJson(d){this._LoadGroupsFromJson(d.groups);this._LoadCndsFromJson(d.cnds);this._LoadActsFromJson(d.acts);this._LoadVarsFromJson(d.vars);this._LoadScheduledWaitsFromJson(d.waits)}_SaveGroupsToJson(){const d={};for(const c of this.GetAllGroups())d[c.GetSID().toString()]= c.IsGroupActive();return d}_LoadGroupsFromJson(d){for(const [c,f]of Object.entries(d))d=parseInt(c,10),(d=this.GetEventGroupBySID(d))&&d.SetGroupActive(f)}_SaveCndsToJson(){const d={};for(const [c,f]of this._cndsBySid){const l=f._SaveToJson();l&&(d[c.toString()]=l)}return d}_LoadCndsFromJson(d){const c=new Map;for(const [f,l]of Object.entries(d))c.set(parseInt(f,10),l);for(const [f,l]of this._cndsBySid)l._LoadFromJson(c.get(f)||null)}_SaveActsToJson(){const d={};for(const [c,f]of this._actsBySid){const l= f._SaveToJson();l&&(d[c.toString()]=l)}return d}_LoadActsFromJson(d){const c=new Map;for(const [f,l]of Object.entries(d))c.set(parseInt(f,10),l);for(const [f,l]of this._actsBySid)l._LoadFromJson(c.get(f)||null)}_SaveVarsToJson(){const d={};for(const [c,f]of this._eventVarsBySid)f.IsConstant()||!f.IsGlobal()&&!f.IsStatic()||(d[c.toString()]=f.GetValue());return d}_LoadVarsFromJson(d){for(const [c,f]of Object.entries(d))d=parseInt(c,10),(d=this.GetEventVariableBySID(d))&&d.SetValue(f)}_SaveScheduledWaitsToJson(){return this._scheduledWaits.filter(d=> !d.IsPromise()).map(d=>d._SaveToJson())}_LoadScheduledWaitsFromJson(d){this.ClearAllScheduledWaits();for(const c of d)(d=e.ScheduledWait._CreateFromJson(this,c))&&this._scheduledWaits.push(d)}_GetPerfRecords(){return[...this._runtime.GetLayoutManager().runningLayouts()].map(d=>d.GetEventSheet()).filter(d=>d).map(d=>d._GetPerfRecord())}FindFirstFunctionBlockParent(d){for(;d;)if(d=d.GetScopeParent(),d instanceof e.FunctionBlock)return d;return null}_InvokeFunctionFromJS(d,c){Array.isArray(c)||(c=[]); d=this.GetFunctionBlockByName(d.toLowerCase());if(!d)return null;if(!d.IsEnabled())return d.GetDefaultReturnValue();var f=d.GetFunctionParameters();if(c.length<f.length){c=c.slice(0);do c.push(f[c.length].GetInitialValue());while(c.length<f.length)}f=d.GetEventBlock();return f.RunAsExpressionFunctionCall(f.GetSolModifiersIncludingParents(),d.GetReturnType(),d.GetDefaultReturnValue(),...c)}}} {"use strict";const e=self.C3;e.EventSheet=class extends e.DefendedBase{constructor(b,a){super();this._eventSheetManager=b;this._runtime=b.GetRuntime();this._name=a[0];this._events=[];this._triggers=new Map;this._fastTriggers=new Map;this._eventsByDisplayNumber=new Map;this._hasRun=!1;this._shallowIncludes=[];this._deepIncludes=[];this._alreadyIncludedSheets=new Set;for(const d of a[1])this._CreateEvent(d,null,this._events);this._perfRecord=this._runtime.IsDebug()?{type:"sheet",name:this._name,totalTimeCounter:0, children:[]}:null}Release(){this._runtime=this._eventSheetManager=null}_CreateEvent(b,a,d){switch(b[0]){case 0:case 3:this._CreateEventBlock(b,a,d);break;case 1:this._CreateEventVariable(b,a,d);break;case 2:this._CreateInclude(b,a,d);break;case 4:this._CreateFunctionBlock(b,a);break;case 5:this._CreateScriptBlock(b,a,d);break;default:throw Error("invalid event type");}}_CreateEventBlock(b,a,d){b=e.EventBlock.Create(this,a,b);if(b.IsOrBlock()){d.push(b);d=b.GetConditions();for(let c=0,f=d.length;c< f;++c)d[c].IsTrigger()&&this._InitTrigger(b,c)}else b.IsTrigger()?this._InitTrigger(b,0):d.push(b)}_CreateFunctionBlock(b,a){b=e.FunctionBlock.Create(this,a,b);this._eventSheetManager._RegisterFunctionBlock(b)}_CreateEventVariable(b,a,d){b=e.EventVariable.Create(this,a,b);d.push(b)}_CreateInclude(b,a,d){b=e.EventInclude.Create(this,a,b);d.push(b)}_CreateScriptBlock(b,a,d){b=e.EventScript.Create(this,a,b);d.push(b)}_InitTrigger(b,a){b.IsOrBlock()||this._eventSheetManager._AddTriggerToPostInit(b);var d= b.GetConditionAt(a),c=d._GetFunc(),f=d.GetObjectClass();if(d.IsFastTrigger()){var l=this._fastTriggers.get(f);l||(l=new Map,this._fastTriggers.set(f,l));d=d.GetFastTriggerValue().toLowerCase();f=l.get(c);f||(f=new Map,l.set(c,f));c=f.get(d);c||(c=[],f.set(d,c));c.push([b,a])}else l=this._triggers.get(f),l||(l={methodMap:new Map,behaviors:new Map},this._triggers.set(f,l)),(f=d.GetBehaviorType())?(d=l.behaviors.get(f),d||(d=new Map,l.behaviors.set(f,d))):d=l.methodMap,l=d.get(c),l||(l=[],d.set(c,l)), l.push([b,a])}_PostInit(){const b=this._events;for(let a=0,d=b.length;a<d;++a){const c=a<d-1&&b[a+1]instanceof e.EventBlock&&b[a+1].IsElseBlock();b[a]._PostInit(c)}}_AddShallowInclude(b){this._shallowIncludes.push(b)}_UpdateDeepIncludes(){e.clearArray(this._deepIncludes);this._AddDeepIncludes(this);this._alreadyIncludedSheets.clear()}_AddDeepIncludes(b){const a=b._deepIncludes,d=b._alreadyIncludedSheets;for(const c of this._shallowIncludes){const f=c.GetIncludeSheet();c.IsActive()&&b!==f&&!d.has(f)&& (d.add(f),f._AddDeepIncludes(b),a.push(f))}}deepIncludes(){return this._deepIncludes}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}GetName(){return this._name}_RegisterEventByDisplayNumber(b,a){this._eventsByDisplayNumber.set(a,b)}_GetEventByDisplayNumber(b){return this._eventsByDisplayNumber.get(b)||null}_ResetHasRunFlag(){this._hasRun=!1}Run(){if(!this._hasRun){var b=this._runtime,a=b.IsCPUProfiling(),d=a?performance.now():0;this._hasRun=!0;var c=this.GetEventSheetManager(), f=c.GetCurrentEventStackFrame();for(const l of this._events)l.Run(f),c.ClearSol(l.GetSolModifiers()),c.ClearAsyncActionPromises(),b.FlushPendingInstances();f.Reset(null);a&&(this._perfRecord.totalTimeCounter+=performance.now()-d)}}*DebugRun(){if(!this._hasRun){this._hasRun=!0;var b=this._runtime,a=this.GetEventSheetManager(),d=a.GetCurrentEventStackFrame();for(const c of this._events)yield*c.DebugRun(d),a.ClearSol(c.GetSolModifiers()),a.ClearAsyncActionPromises(),b.FlushPendingInstances();d.Reset(null)}}_Trigger(b, a,d){if(a){const c=a.GetObjectClass();this._TriggerForClass(b,a,c,d);for(const f of c.GetFamilies())this._TriggerForClass(b,a,f,d)}else return this._TriggerForClass(b,a,null,null)}_TriggerForClass(b,a,d,c){d=this._triggers.get(d);if(!d)return!1;c=c?d.behaviors.get(c):d.methodMap;if(!c)return!1;c=c.get(b);if(!c)return!1;b=!1;for(const [f,l]of c)c=this._ExecuteTrigger(a,f,l),b=b||c;return b}*_DebugTrigger(b,a,d){if(a){const c=a.GetObjectClass();yield*this._DebugTriggerForClass(b,a,c,d);for(const f of c.GetFamilies())yield*this._DebugTriggerForClass(b, a,f,d)}else return yield*this._DebugTriggerForClass(b,a,null,null)}*_DebugTriggerForClass(b,a,d,c){d=this._triggers.get(d);if(!d)return!1;c=c?d.behaviors.get(c):d.methodMap;if(!c)return!1;c=c.get(b);if(!c)return!1;b=!1;for(const [f,l]of c)c=f.DebugCanRunFast()?this._ExecuteTrigger(a,f,l):yield*this._DebugExecuteTrigger(a,f,l),b=b||c;return b}_FastTrigger(b,a,d){a=a.GetObjectClass();a=this._fastTriggers.get(a);if(!a)return!1;b=a.get(b);if(!b)return!1;d=b.get(d);if(!d)return!1;b=!1;for(let c=0,f=d.length;c< f;++c)a=d[c],a=this._ExecuteTrigger(null,a[0],a[1]),b=b||a;return b}*_DebugFastTrigger(b,a,d){a=a.GetObjectClass();a=this._fastTriggers.get(a);if(!a)return!1;b=a.get(b);if(!b)return!1;d=b.get(d);if(!d)return!1;b=!1;for(let f=0,l=d.length;f<l;++f){var c=d[f];a=c[0];c=c[1];a=a.DebugCanRunFast()?this._ExecuteTrigger(null,a,c):yield*this._DebugExecuteTrigger(null,a,c);b=b||a}return b}_ExecuteTrigger(b,a,d){const c=this._runtime,f=this._eventSheetManager,l=f.GetCurrentEvent(),g=f.GetEventStack(),k=f.GetTriggerDepth(); let m=!1;l&&f.PushCleanSol(l.GetSolModifiersIncludingParents());f.PushCleanSol(a.GetSolModifiersIncludingParents());const u=1<k;u&&f.GetLocalVarStack().Push();const x=g.Push(a);b&&(a.GetConditions()[d].GetObjectClass().GetCurrentSol().SetSinglePicked(b),b.IsInContainer()&&b.SetSiblingsSinglePicked());b=!0;if(a.GetParent()){const n=a.GetTriggerParents();for(let q=0,t=n.length;q<t;++q)if(!n[q].RunPreTrigger(x)){b=!1;break}}b&&(c.IncrementExecCount(),a.IsOrBlock()?a.RunOrBlockTrigger(x,d):a.Run(x),m= x.GetLastEventTrue());g.Pop();u&&f.GetLocalVarStack().Pop();f.PopSol(a.GetSolModifiersIncludingParents());l&&f.PopSol(l.GetSolModifiersIncludingParents());l||1!==k||(f.ClearAsyncActionPromises(),f.IsFlushingBlocked()||c.FlushPendingInstances());return m}*_DebugExecuteTrigger(b,a,d){const c=this._runtime,f=this._eventSheetManager,l=f.GetCurrentEvent(),g=f.GetEventStack(),k=f.GetTriggerDepth();let m=!1;l&&f.PushCleanSol(l.GetSolModifiersIncludingParents());f.PushCleanSol(a.GetSolModifiersIncludingParents()); const u=1<k;u&&f.GetLocalVarStack().Push();const x=g.Push(a);b&&(a.GetConditions()[d].GetObjectClass().GetCurrentSol().SetSinglePicked(b),b.IsInContainer()&&b.SetSiblingsSinglePicked());b=!0;if(a.GetParent()){const n=a.GetTriggerParents();for(let q=0,t=n.length;q<t;++q)if(!(yield*n[q].DebugRunPreTrigger(x))){b=!1;break}}b&&(c.IncrementExecCount(),a.IsOrBlock()?yield*a.DebugRunOrBlockTrigger(x,d):yield*a.DebugRun(x),m=x.GetLastEventTrue());g.Pop();u&&f.GetLocalVarStack().Pop();f.PopSol(a.GetSolModifiersIncludingParents()); l&&f.PopSol(l.GetSolModifiersIncludingParents());l||1!==k||(f.ClearAsyncActionPromises(),f.IsFlushingBlocked()||c.FlushPendingInstances());return m}_GetPerfRecord(){return this._perfRecord}}} {"use strict";const e=self.C3,b=[];function a(c,f){return!0}function*d(c,f){return!0}e.EventBlock=class extends e.DefendedBase{constructor(c,f,l){super();this._eventSheet=c;this._runtime=c.GetRuntime();this._parent=f;this._scopeParent=null;this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._solModifiers=[];this._solModifiersIncludingParents=[];this._hasElseBlock=this._isTopLevelGroup=this._isSolWriterAfterCnds=this._hasGotSolModifiersIncludingParents=!1;this._isOrBlock=!!l[2]; this._isElseBlock=!1;this._triggerParents=null;this._conditions=[];this._actions=[];this._subEvents=[];this._RunActions=a;this._DebugRunActions=d;this._isInitiallyActive=this._isGroup=!1;this._groupName="";this._isGroupActive=!1;this._perfRecord=this._containedIncludes=null;this._sid=l[4];this._displayNumber=l[5];this._eventSheet._RegisterEventByDisplayNumber(this,this._displayNumber);this._debugData=this._runtime.IsDebug()?{isBreakpoint:l[3][0],isBreakable:l[3][1],canRunAllConditionsFast:!1,canRunAllActionsFast:!1, canRunAllSubEventsFast:!1,canRunSelfFast:!1}:null;this.GetEventSheetManager()._RegisterEventBlock(this);3===l[0]&&this._InitGroup(l[1]);c=0;for(var g of l[6])f=e.Condition.Create(this,g,c++),this._conditions.push(f),this._AddSolModifier(f.GetObjectClass());c=0;for(const k of l[7])g=e.Action.Create(this,k,c++),this._actions.push(g);if(9===l.length){l=l[8];for(const k of l)this._eventSheet._CreateEvent(k,this,this._subEvents)}this._conditions.length&&(this._isElseBlock=null===this._conditions[0].GetObjectClass()&& this._conditions[0]._GetFunc()===e.Plugins.System.Cnds.Else);0===this._conditions.length&&(this._conditions=b);0===this._actions.length&&(this._actions=b);0===this._subEvents.length&&(this._subEvents=b)}static Create(c,f,l){return e.New(e.EventBlock,c,f,l)}_InitGroup(c){this._isGroup=!0;this._isGroupActive=this._isInitiallyActive=!!c[0];this._groupName=c[1].toLowerCase();this._containedIncludes=[];this.GetEventSheetManager()._RegisterGroup(this);this._runtime.IsDebug()&&(this._perfRecord={type:"group", name:c[1],totalTimeCounter:0,children:[]})}_AddContainedInclude(c){this._containedIncludes.push(c)}_AddContainerSolModifierToList(c,f){for(const l of c.GetContainer().objectTypes())f.includes(l)||f.push(l)}_AddSolModifierToList(c,f){if(c)if(f.includes(c)||f.push(c),c.IsFamily())for(const l of c.GetFamilyMembers())l.IsInContainer()&&this._AddContainerSolModifierToList(l,f);else c.IsInContainer()&&this._AddContainerSolModifierToList(c,f)}_AddSolModifier(c){this._AddSolModifierToList(c,this._solModifiers)}_AddParentSolModifier(c){this._AddSolModifierToList(c, this._solModifiersIncludingParents)}SetAllSolModifiers(){this._solModifiers=this._runtime.GetAllObjectClasses()}_PostInit(c){this._hasElseBlock=!!c;this._IdentifyTopLevelGroup();this._IdentifyTriggerParents();for(const l of this._conditions)l._PostInit();if(0<this._actions.length){c=!1;for(var f of this._actions)f._PostInit(),f.HasReturnType()&&(c=!0);c?(this._RunActions=this._RunActions_ReturnValue,this._DebugRunActions=this._DebugRunActions_ReturnValue):(this._RunActions=this._RunActions_Fast,this._DebugRunActions= this._DebugRunActions_Fast)}f=this._subEvents;for(let l=0,g=f.length;l<g;++l)c=l<g-1&&f[l+1]instanceof e.EventBlock&&f[l+1].IsElseBlock(),f[l]._PostInit(c);this._debugData&&this._UpdateCanRunFast();this._perfRecord&&this._GetPerfRecordParent()._GetPerfRecord().children.push(this._perfRecord)}_GetPerfRecord(){return this._perfRecord}_GetPerfRecordParent(){let c=this.GetParent();for(;c;){if(c.IsGroup())return c;c=c.GetParent()}return this._eventSheet}_UpdateCanRunFast(){const c=this._debugData;c.canRunAllConditionsFast= this._conditions.every(f=>f.DebugCanRunFast());c.canRunAllActionsFast=this._actions.every(f=>f.DebugCanRunFast());c.canRunAllSubEventsFast=this._subEvents.every(f=>f.DebugCanRunFast());c.canRunSelfFast=c.canRunAllConditionsFast&&c.canRunAllActionsFast&&c.canRunAllSubEventsFast}_UpdateCanRunFastRecursive(){let c=this;do c._UpdateCanRunFast(),c=c.GetParent();while(c)}_IdentifyTopLevelGroup(){if(this.IsGroup()){var c=this.GetParent();for(this._isTopLevelGroup=!0;c;){if(!c.IsGroup()){this._isTopLevelGroup= !1;break}c=c.GetParent()}}}_IdentifySolModifiersIncludingParents(){var c=this._runtime.GetAllObjectClasses();if(this._solModifiers===c)this._solModifiersIncludingParents=c;else{this._solModifiersIncludingParents=e.cloneArray(this._solModifiers);for(c=this.GetParent();c;){for(var f of c._solModifiers)this._AddParentSolModifier(f);c=c.GetParent()}f=this.GetEventSheetManager();this._solModifiers=f._DeduplicateSolModifierList(this._solModifiers);this._solModifiersIncludingParents=f._DeduplicateSolModifierList(this._solModifiersIncludingParents)}}_IdentifyTriggerParents(){if(this.HasAnyTriggeredCondition()){this._triggerParents= [];for(var c=this.GetParent();c;)this._triggerParents.push(c),c=c.GetParent();this._triggerParents.reverse()}}SetSolWriterAfterCnds(){this._isSolWriterAfterCnds=!0;this._parent&&this._parent.SetSolWriterAfterCnds()}IsSolWriterAfterCnds(){return this._isSolWriterAfterCnds}GetSolModifiers(){return this._solModifiers}GetSolModifiersIncludingParents(){this._hasGotSolModifiersIncludingParents||(this._hasGotSolModifiersIncludingParents=!0,this._IdentifySolModifiersIncludingParents());return this._solModifiersIncludingParents}HasSolModifier(c){return this._solModifiers.includes(c)}GetTriggerParents(){return this._triggerParents}GetEventSheet(){return this._eventSheet}GetEventSheetManager(){return this._eventSheet.GetEventSheetManager()}GetRuntime(){return this._runtime}GetParent(){return this._parent}_SetScopeParent(c){this._scopeParent= c}GetScopeParent(){return this._scopeParent||this._parent}GetDisplayNumber(){return this._displayNumber}IsDebugBreakable(){return this._debugData&&this._debugData.isBreakable}IsDebugBreakpoint(){return this.IsDebugBreakable()&&this._debugData.isBreakpoint}_SetDebugBreakpoint(c){this._debugData.isBreakpoint=!!c;this._UpdateCanRunFastRecursive()}IsGroup(){return this._isGroup}IsTopLevelGroup(){return this._isTopLevelGroup}IsElseBlock(){return this._isElseBlock}HasElseBlock(){return this._hasElseBlock}GetGroupName(){return this._groupName}IsGroupActive(){return this._isGroupActive}ResetInitialActivation(){this.SetGroupActive(this._isInitiallyActive)}SetGroupActive(c){c= !!c;if(!this._isGroup)throw Error("not a group");if(this._isGroupActive!==c){this._isGroupActive=c;for(const f of this._containedIncludes)f.UpdateActive();this._containedIncludes.length&&(c=this._runtime.GetCurrentLayout().GetEventSheet())&&c._UpdateDeepIncludes()}}GetSID(){return this._sid}IsOrBlock(){return this._isOrBlock}IsTrigger(){return this._conditions.length&&this._conditions[0].IsTrigger()}IsForFunctionBlock(){return this._scopeParent&&this._scopeParent instanceof e.FunctionBlock}HasAnyTriggeredCondition(){return this.IsForFunctionBlock()|| this._conditions.some(c=>c.IsTrigger())}GetConditions(){return this._conditions}GetConditionCount(){return this._conditions.length}GetConditionAt(c){c=Math.floor(c);if(0>c||c>=this._conditions.length)throw new RangeError("invalid condition index");return this._conditions[c]}GetConditionByDebugIndex(c){return this.GetConditionAt(c)}IsFirstConditionOfType(c){let f=c.GetIndex();if(0===f)return!0;for(--f;0<=f;--f)if(this._conditions[f].GetObjectClass()===c.GetObjectClass())return!1;return!0}GetActions(){return this._actions}GetActionCount(){return this._actions.length}GetActionAt(c){c= Math.floor(c);if(0>c||c>=this._actions.length)throw new RangeError("invalid action index");return this._actions[c]}GetActionByDebugIndex(c){c=Math.floor(c);const f=this._actions.find(l=>l.GetDebugIndex()===c);if(!f)throw new RangeError("invalid action debug index");return f}_HasActionIndex(c){c=Math.floor(c);return 0<=c&&c<this._actions.length}GetSubEvents(){return this._subEvents}_GetAllLocalVariablesInScope(){return this._subEvents.filter(c=>c instanceof e.EventVariable)}RunPreTrigger(c){c.SetCurrentEvent(this); let f=!1;const l=this._conditions;for(let g=0,k=l.length;g<k;++g){const m=l[g];c.SetConditionIndex(g);if(m.IsLooping())throw Error("trigger cannot be used as sub-event to a loop");if(m.Run())f=!0;else if(!this._isOrBlock)return!1}return this._isOrBlock?f:!0}RunOrBlockTrigger(c,f){c.SetCurrentEvent(this);this._conditions[f].Run()&&(this._RunActions(c,0)&&this._RunSubEvents(c),c.SetLastEventTrue(!0))}*DebugRunPreTrigger(c){c.SetCurrentEvent(this);let f=!1;const l=this._conditions;for(let g=0,k=l.length;g< k;++g){const m=l[g];c.SetConditionIndex(g);if(m.IsLooping())throw Error("trigger cannot be used as sub-event to a loop");if(m.DebugCanRunFast()?m.Run():yield*m.DebugRun())f=!0;else if(!this._isOrBlock)return!1}return this._isOrBlock?f:!0}*DebugRunOrBlockTrigger(c,f){c.SetCurrentEvent(this);f=this._conditions[f];if(f.DebugCanRunFast()?f.Run():yield*f.DebugRun())(this.DebugCanRunActionsFast()?this._RunActions(c,0):yield*this._DebugRunActions(c,0))&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents(): yield*this._DebugRunSubEvents()),c.SetLastEventTrue(!0)}Run(c){c.SetCurrentEvent(this);this._isElseBlock||c.SetElseBranchRan(!1);this._isOrBlock?this._RunOrBlock(c):this._RunAndBlock(c)}*DebugRun(c){if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;c.SetCurrentEvent(this);this._isElseBlock||c.SetElseBranchRan(!1);this._isOrBlock?yield*this._DebugRunOrBlock(c):yield*this._DebugRunAndBlock(c)}_RunOrBlock(c){const f=this._conditions;let l=0===f.length;for(let k=0,m=f.length;k<m;++k){var g= f[k];g.IsTrigger()||(c.SetConditionIndex(k),g=g.Run(),l=l||g)}c.SetLastEventTrue(l);l&&(this._RunActions(c,0)&&this._RunSubEvents(c),this._hasElseBlock&&c.SetElseBranchRan(!0))}*_DebugRunOrBlock(c){const f=this._conditions;let l=0===f.length;for(let k=0,m=f.length;k<m;++k){var g=f[k];g.IsTrigger()||(c.SetConditionIndex(k),g=g.DebugCanRunFast()?g.Run():yield*g.DebugRun(),l=l||g)}c.SetLastEventTrue(l);l&&((this.DebugCanRunActionsFast()?this._RunActions(c,0):yield*this._DebugRunActions(c,0))&&(this.DebugCanRunSubEventsFast()? this._RunSubEvents():yield*this._DebugRunSubEvents()),this._hasElseBlock&&c.SetElseBranchRan(!0))}_RunAndBlock(c){const f=this._conditions;for(let l=0,g=f.length;l<g;++l){const k=f[l];c.SetConditionIndex(l);if(!k.Run()){c.SetLastEventTrue(!1);return}}c.SetLastEventTrue(!0);this._RunActions(c,0)&&this._RunSubEvents(c);c.GetLastEventTrue()&&this._hasElseBlock&&c.SetElseBranchRan(!0)}*_DebugRunAndBlock(c){const f=this._conditions;for(let l=0,g=f.length;l<g;++l){const k=f[l];c.SetConditionIndex(l);if(k.DebugCanRunFast()? !k.Run():!(yield*k.DebugRun())){c.SetLastEventTrue(!1);return}}c.SetLastEventTrue(!0);(this.DebugCanRunActionsFast()?this._RunActions(c,0):yield*this._DebugRunActions(c,0))&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():yield*this._DebugRunSubEvents());c.GetLastEventTrue()&&this._hasElseBlock&&c.SetElseBranchRan(!0)}_RunActions_Fast(c,f){const l=this._actions;for(let g=f,k=l.length;g<k;++g)f=l[g],c.SetActionIndex(g),f.Run();return!0}*_DebugRunActions_Fast(c,f){const l=this._actions;for(let g= f,k=l.length;g<k;++g)f=l[g],c.SetActionIndex(g),f.DebugCanRunFast()?f.Run():yield*f.DebugRun();return!0}_RunActions_ReturnValue(c,f){const l=this.GetEventSheetManager(),g=this._actions;for(let k=f,m=g.length;k<m;++k){f=g[k];c.SetActionIndex(k);const u=f.Run();if(f.CanBailOut()&&!0===u)return!1;f.IsAsync()&&u instanceof Promise&&l.AddAsyncActionPromise(u)}return!0}*_DebugRunActions_ReturnValue(c,f){const l=this.GetEventSheetManager(),g=this._actions;for(let k=f,m=g.length;k<m;++k){f=g[k];c.SetActionIndex(k); let u;u=f.DebugCanRunFast()?f.Run():yield*f.DebugRun();if(f.CanBailOut()&&!0===u)return!1;f.IsAsync()&&u instanceof Promise&&l.AddAsyncActionPromise(u)}return!0}_ResumeActionsAndSubEvents(c){this._RunActions(c,c.GetActionIndex())&&this._RunSubEvents()}*_DebugResumeActionsAndSubEvents(c){if(yield*this._DebugRunActions(c,c.GetActionIndex()))yield*this._DebugRunSubEvents()}_RunSubEvents(){if(this._subEvents.length){var c=this.IsGroup()&&this._runtime.IsCPUProfiling(),f=c?performance.now():0,l=this._eventStack, g=l.Push(this);this._isSolWriterAfterCnds?this._RunSubEvents_SolWriterAfterCnds(g):this._RunSubEvents_Fast(g);l.Pop();c&&(this._perfRecord.totalTimeCounter+=performance.now()-f)}}_RunSubEvents_SolWriterAfterCnds(c){const f=this._isGroup,l=this._isTopLevelGroup,g=this.GetEventSheetManager(),k=this._subEvents;for(let m=0,u=k.length,x=u-1;m<u;++m){const n=k[m],q=n.GetSolModifiers(),t=!l||!f&&m<x;t&&g.PushCopySol(q);n.Run(c);t?g.PopSol(q):g.ClearSol(q)}}_RunSubEvents_Fast(c){const f=this._subEvents;for(let l= 0,g=f.length;l<g;++l)f[l].Run(c)}*_DebugRunSubEvents(){if(this._subEvents.length){var c=this._eventStack,f=c.Push(this);this._isSolWriterAfterCnds?yield*this._DebugRunSubEvents_SolWriterAfterCnds(f):yield*this._DebugRunSubEvents_Fast(f);c.Pop()}}*_DebugRunSubEvents_SolWriterAfterCnds(c){const f=this._isGroup,l=this._isTopLevelGroup,g=this.GetEventSheetManager(),k=this._subEvents;for(let m=0,u=k.length,x=u-1;m<u;++m){const n=k[m],q=n.GetSolModifiers(),t=!l||!f&&m<x;t&&g.PushCopySol(q);yield*n.DebugRun(c); t?g.PopSol(q):g.ClearSol(q)}}*_DebugRunSubEvents_Fast(c){const f=this._subEvents;for(let l=0,g=f.length;l<g;++l)yield*f[l].DebugRun(c)}Retrigger(c,f){this._runtime.IncrementExecCount();f.ResetQuick();const l=this._conditions;if(!this.IsOrBlock())for(let g=c.GetConditionIndex()+1,k=l.length;g<k;++g)if(c=l[g],f.SetConditionIndex(g),!c.Run())return!1;this._RunActions(f,0)&&this._RunSubEvents(f);return!0}*DebugRetrigger(c,f){this._runtime.IncrementExecCount();f.ResetQuick();const l=this._conditions;if(!this.IsOrBlock())for(let g= c.GetConditionIndex()+1,k=l.length;g<k;++g)if(c=l[g],f.SetConditionIndex(g),c.DebugCanRunFast()?!c.Run():!(yield*c.DebugRun()))return!1;(this.DebugCanRunActionsFast()?this._RunActions(f,0):yield*this._DebugRunActions(f,0))&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():yield*this._DebugRunSubEvents());return!0}DebugCanRunFast(){return!this.IsDebugBreakpoint()&&!this._runtime.DebugBreakNext()&&this._debugData.canRunSelfFast}DebugCanRunActionsFast(){return!this._runtime.DebugBreakNext()&&this._debugData.canRunAllActionsFast}DebugCanRunSubEventsFast(){return!this._runtime.DebugBreakNext()&& this._debugData.canRunAllSubEventsFast}_CheckParentsOKToRun(c){if(this.GetParent()){const f=this.GetTriggerParents();for(let l=0,g=f.length;l<g;++l)if(!f[l].RunPreTrigger(c))return!1}return!0}*_DebugCheckParentsOKToRun(c){if(this.GetParent()){const f=this.GetTriggerParents();for(let l=0,g=f.length;l<g;++l)if(!(yield*f[l].DebugRunPreTrigger(c)))return!1}return!0}_EvaluateFunctionCallParameters(c,f,l){0<f.length?l?(f=f.map(g=>g.Get(0)),c.GetLocalVarStack().Push(),this._scopeParent.SetFunctionParameters(f)): this._scopeParent.EvaluateFunctionParameters(f):l&&c.GetLocalVarStack().Push()}RunAsFunctionCall(c,f){let l,g;const k=0<c.length;var m=this._runtime;const u=this._eventStack,x=m.GetEventSheetManager(),n=1<x._IncTriggerDepth();this._EvaluateFunctionCallParameters(x,f,n);k&&x.PushCleanSol(c);f=u.Push(this);this._CheckParentsOKToRun(f)&&(m.IncrementExecCount(),f.SetCurrentEvent(this),(m=this._scopeParent.IsAsync())&&([g,l]=this._scopeParent.StartAsyncFunctionCall()),this._RunAndBlock(f),m&&this._scopeParent.MaybeFinishAsyncFunctionCall(g)); u.Pop();n&&x.GetLocalVarStack().Pop();k&&x.PopSol(c);x._DecTriggerDepth();return l}*DebugRunAsFunctionCall(c,f){let l,g;if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;const k=0<c.length;var m=this._runtime;const u=this._eventStack,x=m.GetEventSheetManager(),n=1<x._IncTriggerDepth();this._EvaluateFunctionCallParameters(x,f,n);k&&x.PushCleanSol(c);f=u.Push(this);if(yield*this._DebugCheckParentsOKToRun(f))m.IncrementExecCount(),f.SetCurrentEvent(this),(m=this._scopeParent.IsAsync())&& ([g,l]=this._scopeParent.StartAsyncFunctionCall()),yield*this._DebugRunAndBlock(f),m&&this._scopeParent.MaybeFinishAsyncFunctionCall(g);u.Pop();n&&x.GetLocalVarStack().Pop();k&&x.PopSol(c);x._DecTriggerDepth();return l}RunAsMappedFunctionCall(c){const f=this.GetSolModifiersIncludingParents(),l=0<f.length,g=this._runtime,k=this._eventStack,m=g.GetEventSheetManager(),u=1<m._IncTriggerDepth();u&&m.GetLocalVarStack().Push();this._scopeParent.SetFunctionParameters(c);l&&m.PushCleanSol(f);c=k.Push(this); this._CheckParentsOKToRun(c)&&(g.IncrementExecCount(),c.SetCurrentEvent(this),this._RunAndBlock(c));k.Pop();u&&m.GetLocalVarStack().Pop();l&&m.PopSol(f);m._DecTriggerDepth()}*DebugRunAsMappedFunctionCall(c){if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;const f=this.GetSolModifiersIncludingParents(),l=0<f.length,g=this._runtime,k=this._eventStack,m=g.GetEventSheetManager(),u=1<m._IncTriggerDepth();u&&m.GetLocalVarStack().Push();this._scopeParent.SetFunctionParameters(c);l&& m.PushCleanSol(f);c=k.Push(this);if(yield*this._DebugCheckParentsOKToRun(c))g.IncrementExecCount(),c.SetCurrentEvent(this),yield*this._DebugRunAndBlock(c);k.Pop();u&&m.GetLocalVarStack().Pop();l&&m.PopSol(f);m._DecTriggerDepth()}RunAsExpressionFunctionCall(c,f,l,...g){let k,m;const u=0<c.length,x=this._runtime,n=this._eventStack,q=x.GetEventSheetManager(),t=1<q._IncTriggerDepth();t&&q.GetLocalVarStack().Push();0<g.length&&this._scopeParent.SetFunctionParameters(g);u&&q.PushCleanSol(c);g=n.Push(this); g.InitCallFunctionExpression(f,l);n.PushExpFunc(g);x.SetDebuggingEnabled(!1);this._CheckParentsOKToRun(g)&&(x.IncrementExecCount(),g.SetCurrentEvent(this),(f=this._scopeParent.IsAsync())&&([m,k]=this._scopeParent.StartAsyncFunctionCall()),this._RunAndBlock(g),f&&this._scopeParent.MaybeFinishAsyncFunctionCall(m));x.SetDebuggingEnabled(!0);n.Pop();n.PopExpFunc();t&&q.GetLocalVarStack().Pop();u&&q.PopSol(c);q._DecTriggerDepth();return k||g.GetFunctionReturnValue()}}} {"use strict";const e=self.C3,b=[];let a=!1;e.EventScript=class extends e.DefendedBase{constructor(d,c,f){super();const l=d.GetRuntime(),g=d.GetEventSheetManager();this._eventSheet=d;this._eventSheetManager=g;this._runtime=d.GetRuntime();this._parent=c;this._func=l.GetObjectReference(f[1]);this._displayNumber=f[2];this._eventSheet._RegisterEventByDisplayNumber(this,this._displayNumber);this._debugData=l.IsDebug()?{isBreakpoint:f[3][0],isBreakable:f[3][1]}:null}static Create(d,c,f){return e.New(e.EventScript, d,c,f)}_PostInit(){const d=this._func,c=this._runtime.GetEventSheetManager()._GetLocalVariablesScriptInterface(this);this._func=d.bind(null,this._runtime.GetIRuntime(),c)}GetParent(){return this._parent}GetScopeParent(){return this._parent}GetEventSheet(){return this._eventSheet}GetDisplayNumber(){return this._displayNumber}IsDebugBreakable(){return this._debugData&&this._debugData.isBreakable}IsDebugBreakpoint(){return this.IsDebugBreakable()&&this._debugData.isBreakpoint}_SetDebugBreakpoint(d){this._debugData.isBreakpoint= !!d}IsElseBlock(){return!1}GetSolModifiers(){return b}GetSolModifiersIncludingParents(){return this._parent?this._parent.GetSolModifiersIncludingParents():b}Run(d){d.SetCurrentEvent(this);this._eventSheetManager.AddAsyncActionPromise(this._RunUserScript())}async _RunUserScript(){try{await this._func()}catch(d){console.error(`Unhandled exception running script %c${this.GetEventSheet().GetName()}, event ${this.GetDisplayNumber()}:`,"font-size: 1.2em; font-weight: bold;",d),self.C3Debugger&&self.C3Debugger._SetLastErrorScript(this), a||(console.info("%cTip:%c run this to highlight in Construct the last script that had an error: %cgoToLastErrorScript()","font-weight: bold; text-decoration: underline","","font-weight: bold"),a=!0)}}*DebugRun(d){d.SetCurrentEvent(this);if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;this.Run(d)}DebugCanRunFast(){return!this.IsDebugBreakpoint()&&!this._runtime.DebugBreakNext()}static HadUserScriptException(){return a}static SetHadUserScriptException(){a=!0}}} {"use strict";const e=self.C3;e.FunctionBlock=class extends e.DefendedBase{constructor(b,a,d){super();this._eventSheet=b;this._runtime=b.GetRuntime();this._parent=a;const c=d[1];this._functionName=c[0];this._returnType=c[1];this._functionParameters=c[2].map(f=>e.EventVariable.Create(b,this,f));this._isEnabled=c[3];this._innerLocalVariables=[];this._isAsync=c[4];this._nextAsyncId=0;this._currentAsyncId=-1;this._asyncMap=new Map;this._eventBlock=e.EventBlock.Create(b,a,d);this._eventBlock._SetScopeParent(this)}static Create(b, a,d){return e.New(e.FunctionBlock,b,a,d)}_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 d=0,c=a.length;d<c;++d)a[d].SetValue(b[d].Get(0))}SetFunctionParameters(b){const a=this._functionParameters;for(let d=0,c=a.length;d<c;++d)a[d].SetValue(b[d])}CaptureFunctionParameters(){return this._functionParameters.map(b=>b.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 d=new Promise(c=>a=c);this._asyncMap.set(b,{resolve:a,pauseCount:0});return[b,d]}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 e=self.C3,b=[];e.EventVariable=class extends e.DefendedBase{constructor(a,d,c){super();const f=a.GetEventSheetManager();this._eventSheet=a;this._eventSheetManager=f;this._runtime=a.GetRuntime();this._parent=d;this._localVarStack=f.GetLocalVarStack();this._name=c[1];this._type=c[2];this._initialValue=c[3];this._isStatic=!!c[4];this._isConstant=!!c[5];this._isFunctionParameter=d instanceof e.FunctionBlock;this._sid=c[6];this._jsPropName=this._runtime.GetJsPropName(c[8]);this._scriptSetter= l=>this.SetValue(l);this._scriptGetter=()=>this.GetValue();this._hasSingleValue=!this._parent||this._isStatic||this._isConstant;this._value=this._initialValue;this._localIndex=-1;this.IsBoolean()&&(this._value=this._value?1:0);!this.IsLocal()||this.IsStatic()||this.IsConstant()||(this._localIndex=f._GetNextLocalVarIndex(this));f._RegisterEventVariable(this)}static Create(a,d,c){return e.New(e.EventVariable,a,d,c)}_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 e=self.C3,b=[];e.EventInclude=class extends e.DefendedBase{constructor(a,d,c){super();const f=a.GetEventSheetManager();this._eventSheet=a;this._eventSheetManager=f;this._runtime=a.GetRuntime();this._parent=d;this._includeSheet=null;this._includeSheetName=c[1];this._isActive=!0}static Create(a,d,c){return e.New(e.EventInclude,a,d,c)}_PostInit(){this._includeSheet=this._eventSheetManager.GetEventSheetByName(this._includeSheetName);this._eventSheet._AddShallowInclude(this);let a= this.GetParent();for(;a;)a instanceof e.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 d=this._runtime.GetAllObjectClasses();a&&this._eventSheetManager.PushCleanSol(d);this._includeSheet.Run();a&&this._eventSheetManager.PopSol(d)}*DebugRun(a){a= !!this.GetParent();const d=this._runtime.GetAllObjectClasses();a&&this._eventSheetManager.PushCleanSol(d);yield*this._includeSheet.DebugRun();a&&this._eventSheetManager.PopSol(d)}DebugCanRunFast(){return!1}IsActive(){return this._isActive}UpdateActive(){let a=this.GetParent();for(;a;){if(a instanceof e.EventBlock&&a.IsGroup()&&!a.IsGroupActive()){this._isActive=!1;return}a=a.GetParent()}this._isActive=!0}}} {"use strict";const e=self.C3;e.ExpNode=class extends e.DefendedBase{constructor(k){super();this._owner=k;this._runtime=k.GetRuntime()}_PostInit(){}static CreateNode(k,m){return e.New([l,c,f,g,b,a][m[0]],k,m)}};class b extends e.ExpNode{constructor(k,m){super(k);this._systemPlugin=this._runtime.GetSystemPlugin();this._func=this._runtime.GetObjectReference(m[1]);this._func!==e.Plugins.System.Exps.random&&this._func!==e.Plugins.System.Exps.choose||this._owner.SetVariesPerInstance()}GetBoundMethod(){return this._systemPlugin._GetBoundACEMethod(this._func, this._systemPlugin)}}class a extends e.ExpNode{constructor(k,m){super(k);this._functionBlock=null;this._functionName=m[1];this._owner.SetVariesPerInstance()}_PostInit(){const k=this._runtime.GetEventSheetManager();this._functionBlock=k.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= k._DeduplicateSolModifierList(this._combinedSolModifiers)}GetBoundMethod(){const k=this._functionBlock;if(k.IsEnabled()){const m=k.GetEventBlock();return e.EventBlock.prototype.RunAsExpressionFunctionCall.bind(m,this._combinedSolModifiers,k.GetReturnType(),k.GetDefaultReturnValue())}{const m=k.GetDefaultReturnValue();return()=>m}}}function d(k,m){if(k>=m)return k%m;0>k&&(k<=-m&&(k%=m),0>k&&(k+=m));return k}class c extends e.ExpNode{constructor(k,m){super(k);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(...k){const m=this._objectClass,u=m.GetCurrentSol().GetExpressionInstances();var x=u.length;if(0===x)return this._returnsString?"":0;x=d(this._owner.GetSolIndex(), x);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(m);return this._func.apply(u[x].GetSdkInstance(),k)}ExpObject_InstExpr(k,...m){const u=this._objectClass,x=u.GetInstances(),n=x.length;if(0===n)return this._returnsString?"":0;k=d(k,n);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(u);return this._func.apply(x[k].GetSdkInstance(),m)}}class f extends e.ExpNode{constructor(k,m){super(k);this._objectClass=this._runtime.GetObjectClassByIndex(m[1]);this._varIndex=m[3]; this._returnsString=!!m[2];this._owner._MaybeVaryFor(this._objectClass)}ExpInstVar(){const k=this._objectClass.GetCurrentSol().GetExpressionInstances();var m=k.length;if(0===m)return this._returnsString?"":0;m=d(this._owner.GetSolIndex(),m);return k[m]._GetInstanceVariableValueUnchecked(this._varIndex)}ExpInstVar_Family(){var k=this._objectClass,m=k.GetCurrentSol().GetExpressionInstances(),u=m.length;if(0===u)return this._returnsString?"":0;u=d(this._owner.GetSolIndex(),u);m=m[u];k=m.GetObjectClass().GetFamilyInstanceVariableOffset(k.GetFamilyIndex()); return m._GetInstanceVariableValueUnchecked(this._varIndex+k)}ExpInstVar_InstExpr(k){const m=this._objectClass;var u=m.GetInstances();const x=u.length;if(0===x)return this._returnsString?"":0;k=d(k,x);u=u[k];k=0;m.IsFamily()&&(k=u.GetObjectClass().GetFamilyInstanceVariableOffset(m.GetFamilyIndex()));return u._GetInstanceVariableValueUnchecked(this._varIndex+k)}}class l extends e.ExpNode{constructor(k,m){super(k);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(...k){const m=this._objectClass;var u=m.GetCurrentSol().GetExpressionInstances(),x=u.length;if(0===x)return this._returnsString?"":0;x=d(this._owner.GetSolIndex(),x);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(m); u=u[x];x=0;m.IsFamily()&&(x=u.GetObjectClass().GetFamilyBehaviorOffset(m.GetFamilyIndex()));return this._func.apply(u.GetBehaviorInstances()[this._behaviorIndex+x].GetSdkInstance(),k)}ExpBehavior_InstExpr(k,...m){const u=this._objectClass;var x=u.GetInstances();const n=x.length;if(0===n)return this._returnsString?"":0;k=d(k,n);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(u);x=x[k];k=0;u.IsFamily()&&(k=x.GetObjectClass().GetFamilyBehaviorOffset(u.GetFamilyIndex()));return this._func.apply(x.GetBehaviorInstances()[this._behaviorIndex+ k].GetSdkInstance(),m)}}class g extends e.ExpNode{constructor(k,m){super(k);this._eventVar=null;this._eventVarSid=m[1]}_PostInit(){this._eventVar=this._runtime.GetEventSheetManager().GetEventVariableBySID(this._eventVarSid)}GetVar(){return this._eventVar}}} {"use strict";const e=self.C3;e.Parameter=class extends e.DefendedBase{constructor(y,C,D){super();this._owner=y;this._index=D;this._type=C;this.Get=null;this._isConstant=this._variesPerInstance=!1}static Create(y,C,D){const G=C[0];return e.New([a,d,u,f,g,c,k,a,f,f,x,n,u,t,d,m,l,q,r,w][G],y,G,D,C)}_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 e.Parameter{constructor(y,C,D,G){super(y,C,D);this._solIndex=0;y=G[1];this._expressionNumber=y[0];this._numberedNodes=[];this._expressionFunc=null;for(let K=1,B=y.length;K<B;++K)this._numberedNodes.push(e.ExpNode.CreateNode(this,y[K]));this._numberedNodes.length?this.Get=this.GetExpression:(this.Get=b(this._expressionNumber),this._isConstant=!0)}_GetNode(y){if(0>y||y>=this._numberedNodes.length)throw new RangeError("invalid numbered node"); return this._numberedNodes[y]}_PostInit(){for(var y of this._numberedNodes)y._PostInit();y=b(this._expressionNumber);this._expressionFunc=this._numberedNodes.length?y(this):y}GetSolIndex(){return this._solIndex}GetExpression(y){this._solIndex=y;return this._expressionFunc()}}class d extends a{constructor(y,C,D,G){super(y,C,D,G);this.Get=this.GetStringExpression;14===C&&(this.GetEventBlock().SetAllSolModifiers(),this._owner instanceof e.Action&&this.GetEventBlock().SetSolWriterAfterCnds())}GetStringExpression(y){this._solIndex= y;y=this._expressionFunc();return"string"===typeof y?y:""}_GetFastTriggerValue(){return b(this._expressionNumber)()}}class c extends a{constructor(y,C,D,G){super(y,C,D,G);this.Get=this.GetLayer;this._isConstant=!1}GetLayer(y){this._solIndex=y;y=this._expressionFunc();return this.GetRuntime().GetCurrentLayout().GetLayer(y)}}class f extends e.Parameter{constructor(y,C,D,G){super(y,C,D);this._combo=G[1];this.Get=this.GetCombo;this._isConstant=!0}GetCombo(){return this._combo}}class l extends e.Parameter{constructor(y, C,D,G){super(y,C,D);this._bool=G[1];this.Get=this.GetBoolean;this._isConstant=!0}GetBoolean(){return this._bool}}class g extends e.Parameter{constructor(y,C,D,G){super(y,C,D);this._objectClass=this.GetRuntime().GetObjectClassByIndex(G[1]);this.Get=this.GetObjectClass;y=this.GetEventBlock();y._AddSolModifier(this._objectClass);this._owner instanceof e.Action?y.SetSolWriterAfterCnds():y.GetParent()&&y.GetParent().SetSolWriterAfterCnds();this._isConstant=!0}GetObjectClass(){return this._objectClass}} class k extends e.Parameter{constructor(y,C,D,G){super(y,C,D);this._layout=this.GetRuntime().GetLayoutManager().GetLayoutByName(G[1]);this.Get=this.GetLayout;this._isConstant=!0}GetLayout(){return this._layout}}class m extends e.Parameter{constructor(y,C,D,G){super(y,C,D);this._timeline=this.GetRuntime().GetTimelineManager().GetTimelineByName(G[1]);this.Get=this.GetTimeline;this._isConstant=!0}GetTimeline(){return this._timeline}}class u extends e.Parameter{constructor(y,C,D,G){super(y,C,D);this._fileInfo= G[1];this.Get=this.GetFile;this._isConstant=!0}GetFile(){return this._fileInfo}}class x extends e.Parameter{constructor(y,C,D,G){super(y,C,D);this._instVarIndex=G[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 C=this._owner.GetObjectClass();var D=C.GetCurrentSol();const G=D.GetInstances(); if(G.length)y=G[y%G.length].GetObjectClass();else if(D.HasAnyElseInstances())D=D.GetElseInstances(),y=D[y%D.length].GetObjectClass();else if(0<C.GetInstanceCount())D=C.GetInstances(),y=D[y%D.length].GetObjectClass();else return 0;return this._instVarIndex+y.GetFamilyInstanceVariableOffset(C.GetFamilyIndex())}}class n extends e.Parameter{constructor(y,C,D,G){super(y,C,D);this._eventVarSid=G[1];this._eventVar=null;this.Get=this.GetEventVariable;this._isConstant=!0}_PostInit(){this._eventVar=this.GetRuntime().GetEventSheetManager().GetEventVariableBySID(this._eventVarSid)}GetEventVariable(){return this._eventVar}} class q extends e.Parameter{constructor(y,C,D,G){super(y,C,D);this._functionBlockName=G[1];this._functionBlock=null;this.Get=this.GetFunction;this._isConstant=!0}_PostInit(){this._functionBlock=this.GetRuntime().GetEventSheetManager().GetFunctionBlockByName(this._functionBlockName);this._functionBlockName=null}GetFunction(){return this._functionBlock}}class t extends e.Parameter{constructor(y,C,D,G){super(y,C,D);this._subParams=[];this._variadicRet=[];this._isConstant=!0;for(let K=1,B=G.length;K< B;++K)y=e.Parameter.Create(this._owner,G[K],0),this._subParams.push(y),this._variadicRet.push(0),y.IsConstant()||(this._isConstant=!1);this.Get=this.GetVariadic}_PostInit(){for(const y of this._subParams)y._PostInit()}GetVariadic(){const y=this._subParams,C=this._variadicRet;for(let D=0,G=y.length;D<G;++D)C[D]=y[D].Get(0);return C}}class r extends e.Parameter{constructor(y,C,D,G){super(y,C,D);this._easeIndex=G[1];this.Get=this.GetEase;this._isConstant=!0}GetEase(){return this._easeIndex}}class w extends e.Parameter{constructor(y, C,D,G){super(y,C,D);this._brushIndex=G[1];this.Get=this.GetTilemapBrush;this._isConstant=!0}GetTilemapBrush(){return this._brushIndex}}} {"use strict";const e=self.C3;function b(c,f){for(let l=0,g=c.length;l<g;++l)f[l]=c[l].Get(0)}const a=[],d=function(){};e.Condition=class extends e.DefendedBase{constructor(c,f,l){super();this._eventBlock=c;this._runtime=c.GetRuntime();this._index=l;this._func=this._runtime.GetObjectReference(f[1]);this._isTrigger=0<f[3];this._isFastTrigger=2===f[3];this._isLooping=!!f[4];this._isInverted=!!f[5];this._isStatic=!!f[6];this._sid=f[7];this._isInOrBlock=this._eventBlock.IsOrBlock();this._behaviorType= this._objectClass=null;this._behaviorIndex=-1;this._systemPlugin=null;this.DebugRun=this.Run=d;this._parameters=[];this._results=[];this._anyParamVariesPerInstance=!1;this._unsavedData=this._savedData=null;this._debugData=this._runtime.IsDebug()?{isBreakpoint:f[8][0],canDebug:f[8][1]}:null;-1===f[0]?this._systemPlugin=this._runtime.GetSystemPlugin():(this._objectClass=this._runtime.GetObjectClassByIndex(f[0]),f[2]&&(this._behaviorType=this._objectClass.GetBehaviorTypeByName(f[2]),this._behaviorIndex= this._objectClass.GetBehaviorIndexByName(f[2])),this._eventBlock.GetParent()&&this._eventBlock.GetParent().SetSolWriterAfterCnds());if(10===f.length){c=f[9];for(let g of c)this._parameters.push(e.Parameter.Create(this,g,this._parameters.length)),this._results.push(0)}0===this._parameters.length&&(this._results=this._parameters=a);this._eventBlock.GetEventSheetManager()._RegisterCondition(this)}static Create(c,f,l){return e.New(e.Condition,c,f,l)}_PostInit(){for(const c of this._parameters)c._PostInit(), c.VariesPerInstance()&&(this._anyParamVariesPerInstance=!0);this._isFastTrigger?(this.Run=this._RunFastTrigger,this.DebugRun=this._DebugRunFastTrigger):this._systemPlugin?(this._SetSystemRunMethod(),this.DebugRun=this._DebugRunSystem):this._objectClass.GetPlugin().IsSingleGlobal()?(this._SetSingleGlobalRunMethod(),this.DebugRun=this._DebugRunSingleGlobal):this._isStatic?(this.Run=this._RunStatic,this.DebugRun=this._DebugRunStatic):(this.Run=this._RunObject,this.DebugRun=this._DebugRunObject)}_SetSystemRunMethod(){this._SetRunMethodForBoundFunc(this._systemPlugin, this._systemPlugin,this._RunSystem)}_SetSingleGlobalRunMethod(){const c=this._objectClass.GetPlugin(),f=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();this._SetRunMethodForBoundFunc(c,f,this._RunSingleGlobal)}_SetRunMethodForBoundFunc(c,f,l){const g=this._func,k=this._isInverted,m=this._parameters;if(0===m.length){const u=c._GetBoundACEMethod(g,f);this.Run=k?function(){return e.xor(u(),k)}:u}else if(1===m.length){const u=m[0];if(!k&&u.IsConstant())this.Run=c._GetBoundACEMethod_1param(g, f,u.Get(0));else{const x=c._GetBoundACEMethod(g,f);this.Run=function(){return e.xor(x(u.Get(0)),k)}}}else if(2===m.length){const u=m[0],x=m[1];if(!k&&u.IsConstant()&&x.IsConstant())this.Run=c._GetBoundACEMethod_2params(g,f,u.Get(0),x.Get(0));else{const n=c._GetBoundACEMethod(g,f);this.Run=function(){return e.xor(n(u.Get(0),x.Get(0)),k)}}}else if(3===m.length){const u=m[0],x=m[1],n=m[2];if(!k&&u.IsConstant()&&x.IsConstant()&&n.IsConstant())this.Run=c._GetBoundACEMethod_3params(g,f,u.Get(0),x.Get(0), n.Get(0));else{const q=c._GetBoundACEMethod(g,f);this.Run=function(){return e.xor(q(u.Get(0),x.Get(0),n.Get(0)),k)}}}else this.Run=l}GetSID(){return this._sid}_GetFunc(){return this._func}GetObjectClass(){return this._objectClass}GetBehaviorType(){return this._behaviorType}GetEventBlock(){return this._eventBlock}GetRuntime(){return this._runtime}GetIndex(){return this._index}GetDebugIndex(){return this.GetIndex()}IsTrigger(){return this._isTrigger}IsFastTrigger(){return this._isFastTrigger}IsInverted(){return this._isInverted}IsLooping(){return this._isLooping}IsBreakpoint(){return this._debugData.isBreakpoint}_SetBreakpoint(c){this._debugData.isBreakpoint= !!c;this._eventBlock._UpdateCanRunFastRecursive()}_DebugReturnsGenerator(){return this._debugData.canDebug}DebugCanRunFast(){return!this.IsBreakpoint()&&!this._runtime.DebugBreakNext()&&!this._DebugReturnsGenerator()}GetSavedDataMap(){this._savedData||(this._savedData=new Map);return this._savedData}GetUnsavedDataMap(){this._unsavedData||(this._unsavedData=new Map);return this._unsavedData}_RunSystem(){const c=this._results;b(this._parameters,c);return e.xor(this._func.apply(this._systemPlugin,c), this._isInverted)}*_DebugRunSystem(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var c=this._results;b(this._parameters,c);c=this._func.apply(this._systemPlugin,c);e.IsIterator(c)&&(c=yield*c);return e.xor(c,this._isInverted)}return this.Run()}_RunSingleGlobal(){const c=this._results;b(this._parameters,c);const f=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();return e.xor(this._func.apply(f,c),this._isInverted)}*_DebugRunSingleGlobal(){if(this.IsBreakpoint()|| this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var c=this._results;b(this._parameters,c);const f=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();c=this._func.apply(f,c);e.IsIterator(c)&&(c=yield*c);return e.xor(c,this._isInverted)}return this.Run()}_RunFastTrigger(){return!0}*_DebugRunFastTrigger(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return!0}_RunStatic(){var c=this._results;b(this._parameters,c);c=this._func.apply(this._behaviorType|| this._objectClass,c);this._objectClass.ApplySolToContainer();return c}*_DebugRunStatic(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var c=this._results;b(this._parameters,c);c=this._func.apply(this._behaviorType||this._objectClass,c);e.IsIterator(c)&&(c=yield*c);this._objectClass.ApplySolToContainer();return c}return this.Run()}_RunObject(){const c=this._parameters,f=this._results,l=this._objectClass.GetCurrentSol();for(let g=0,k=c.length;g< k;++g){const m=c[g];m.VariesPerInstance()||(f[g]=m.Get(0))}return l.IsSelectAll()?this._RunObject_FirstFilter(l):this._RunObject_NextFilter(l)}*_DebugRunObject(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return this._RunObject()}_EvaluateVaryingParameters(c){const f=this._parameters,l=this._results;for(let g=0,k=f.length;g<k;++g){const m=f[g];m.VariesPerInstance()&&(l[g]=m.Get(c))}}_RunObject_FirstFilter(c){const f=this._objectClass,l=f.IsFamily(),g=f.GetFamilyIndex(),k=this._behaviorIndex, m=0<=k,u=f.GetInstances(),x=this._anyParamVariesPerInstance,n=this._results,q=this._func,t=this._isInverted,r=this._isInOrBlock&&!this._isTrigger;c.ClearArrays();for(let y=0,C=u.length;y<C;++y){const D=u[y];x&&this._EvaluateVaryingParameters(y);var w=void 0;m?(w=l?D.GetObjectClass().GetFamilyBehaviorOffset(g):0,w=q.apply(D.GetBehaviorInstances()[k+w].GetSdkInstance(),n)):w=q.apply(D.GetSdkInstance(),n);e.xor(w,t)?c._PushInstance(D):r&&c._PushElseInstance(D)}f.FinishCondition(!0);c._SetSelectAll(!1); f.ApplySolToContainer();return c.HasAnyInstances()}_RunObject_NextFilter(c){const f=this._objectClass;var l=f.IsFamily();const g=f.GetFamilyIndex(),k=f.IsInContainer(),m=this._behaviorIndex,u=0<=m,x=this._anyParamVariesPerInstance,n=this._results,q=this._func,t=this._isInverted,r=this._isInOrBlock&&!this._isTrigger,w=c._GetOwnInstances(),y=c._GetOwnElseInstances(),C=r&&!this._eventBlock.IsFirstConditionOfType(this),D=C?y:w;let G=0,K=!1;for(let A=0,F=D.length;A<F;++A){const J=D[A];x&&this._EvaluateVaryingParameters(A); var B=void 0;u?(B=l?J.GetObjectClass().GetFamilyBehaviorOffset(g):0,B=q.apply(J.GetBehaviorInstances()[m+B].GetSdkInstance(),n)):B=q.apply(J.GetSdkInstance(),n);e.xor(B,t)?(K=!0,C?(w.push(J),k&&J._PushSiblingsToSolInstances()):(D[G]=J,k&&J._SetSiblingsToSolInstancesIndex(G),++G)):C?(D[G]=J,k&&J._SetSiblingsToSolElseInstancesIndex(G),++G):r&&(y.push(J),k&&J._PushSiblingsToSolElseInstances())}e.truncateArray(D,G);k&&f._TruncateContainerSols(C,G);l=K;C&&!K&&(K=this._OrBlockCheckInstances(w));f.FinishCondition(l|| r);return r?K:c.HasAnyInstances()}_OrBlockCheckInstances(c){var f=this._objectClass;const l=f.IsFamily();f=f.GetFamilyIndex();const g=this._anyParamVariesPerInstance,k=this._behaviorIndex,m=0<=k,u=this._results,x=this._func,n=this._isInverted;for(let t=0,r=c.length;t<r;++t){var q=c[t];g&&this._EvaluateVaryingParameters(t);if(m){const w=l?q.GetObjectClass().GetFamilyBehaviorOffset(f):0;q=x.apply(q.GetBehaviorInstances()[k+w].GetSdkInstance(),u)}else q=x.apply(q.GetSdkInstance(),u);if(e.xor(q,n))return!0}return!1}ReevaluateParameter(c, f){return this._parameters[c].Get(f)}GetFastTriggerValue(){const c=this._parameters;if(!c.length)throw Error("no parameters");return c[0]._GetFastTriggerValue()}_SaveToJson(){if(!this._savedData||!this._savedData.size)return null;const c={};for(const [f,l]of this._savedData.entries()){let g=l;"collmemory"===f&&(g=[...l.entries()].map(k=>[k[0].GetUID(),k[1].GetUID(),k[2]]));c[f]=g}return{ex:c}}_LoadFromJson(c){this._savedData&&(this._savedData.clear(),this._savedData=null);if(c){var f=this._runtime, l=c.ex;if(l){c=this.GetSavedDataMap();c.clear();for(const [g,k]of Object.entries(l))l=k,"collmemory"===g&&(l=e.New(e.PairMap,k.map(m=>[f.GetInstanceByUID(m[0]),f.GetInstanceByUID(m[1]),m[2]]).filter(m=>m[0]&&m[1]))),c.set(g,l)}}}}} {"use strict";const e=self.C3;function b(f,l){for(let g=0,k=f.length;g<k;++g)l[g]=f[g].Get(0)}const a=[],d=function(){},c=function*(){};e.Action=class extends e.DefendedBase{constructor(f,l,g){super();this._eventBlock=f;this._runtime=f=f.GetRuntime();this._index=g;this._sid=4<=l.length?l[3]:-1;this._actionReturnType=5<=l.length?l[4]:0;this._behaviorType=this._objectClass=this._func=null;this._behaviorIndex=-1;this._systemPlugin=null;this._callFunctionName="";this._combinedSolModifiers=this._callEventBlock= null;this.DebugRun=this.Run=d;this._parameters=[];this._results=[];this._anyParamVariesPerInstance=!1;this._unsavedData=this._savedData=null;const k=(g=-3===l[0])?l[2]:l[5];this._debugData=f.IsDebug()||g?{isBreakpoint:k[0],canDebug:k[1],index:k[2]}:null;-1===l[0]?(this._systemPlugin=f.GetSystemPlugin(),this._func=f.GetObjectReference(l[1])):-2===l[0]?this._callFunctionName=l[1]:g?(this._func=f.GetObjectReference(l[1]),this.Run=this.RunUserScript,this.DebugRun=this.DebugRunUserScript,this._actionReturnType= 1):(this._func=f.GetObjectReference(l[1]),this._objectClass=f.GetObjectClassByIndex(l[0]),l[2]&&(this._behaviorType=this._objectClass.GetBehaviorTypeByName(l[2]),this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(l[2])));if(7===l.length){l=l[6];for(const m of l)this._parameters.push(e.Parameter.Create(this,m,this._parameters.length)),this._results.push(0)}0===this._parameters.length&&(this._results=this._parameters=a);this._eventBlock.GetEventSheetManager()._RegisterAction(this)}static Create(f, l,g){return e.New(e.Action,f,l,g)}_PostInit(){for(var f of this._parameters)f._PostInit(),f.VariesPerInstance()&&(this._anyParamVariesPerInstance=!0);if(this._systemPlugin)this._SetSystemRunMethod(),this.DebugRun=this._DebugRunSystem;else if(this._callFunctionName)this._SetCallFunctionRunMethod(),this._callFunctionName="";else if(this.Run===this.RunUserScript){f=this._func;const l=this._runtime.GetEventSheetManager()._GetLocalVariablesScriptInterface(this._eventBlock);this._func=f.bind(null,this._runtime.GetIRuntime(), l)}else this._behaviorType?this.IsAsync()?(this.Run=this._RunBehavior_Async,this.DebugRun=this._DebugRunBehavior_Async):(this.Run=this._RunBehavior,this.DebugRun=this._DebugRunBehavior):this._objectClass.GetPlugin().IsSingleGlobal()?(this._SetSingleGlobalRunMethod(),this.DebugRun=this._DebugRunSingleGlobal):this.IsAsync()?(this.Run=this._RunObject_Async,this.DebugRun=this._DebugRunObject_Async):this._parameters.length?this._parameters.every(l=>l.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(l=>l.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 f=this._objectClass.GetPlugin(),l=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();this._SetRunMethodForBoundFunc(f,l,this._RunSingleGlobal)}_SetCallFunctionRunMethod(){const f=this._eventBlock.GetEventSheetManager(),l=f.GetFunctionBlockByName(this._callFunctionName);l.IsEnabled()?(this._callEventBlock=l.GetEventBlock(),this._combinedSolModifiers=[...new Set([...this._eventBlock.GetSolModifiersIncludingParents(),...this._callEventBlock.GetSolModifiersIncludingParents()])], this._combinedSolModifiers=f._DeduplicateSolModifierList(this._combinedSolModifiers),this.Run=e.EventBlock.prototype.RunAsFunctionCall.bind(this._callEventBlock,this._combinedSolModifiers,this._parameters),this.DebugRun=this._DebugRunCallFunction):(this.Run=d,this.DebugRun=c)}_SetRunMethodForBoundFunc(f,l,g){const k=this._func,m=this._parameters;if(0===m.length)this.Run=f._GetBoundACEMethod(k,l);else if(1===m.length){const u=m[0];if(u.IsConstant())this.Run=f._GetBoundACEMethod_1param(k,l,u.Get(0)); else{const x=f._GetBoundACEMethod(k,l);this.Run=function(){return x(u.Get(0))}}}else if(2===m.length){const u=m[0],x=m[1];if(u.IsConstant()&&x.IsConstant())this.Run=f._GetBoundACEMethod_2params(k,l,u.Get(0),x.Get(0));else{const n=f._GetBoundACEMethod(k,l);this.Run=function(){return n(u.Get(0),x.Get(0))}}}else if(3===m.length){const u=m[0],x=m[1],n=m[2];if(u.IsConstant()&&x.IsConstant()&&n.IsConstant())this.Run=f._GetBoundACEMethod_3params(k,l,u.Get(0),x.Get(0),n.Get(0));else{const q=f._GetBoundACEMethod(k, l);this.Run=function(){return q(u.Get(0),x.Get(0),n.Get(0))}}}else this.Run=g}GetSID(){return this._sid}IsAsync(){return 1===this._actionReturnType}CanBailOut(){return 2===this._actionReturnType}HasReturnType(){return 0!==this._actionReturnType}GetObjectClass(){return this._objectClass}GetEventBlock(){return this._eventBlock}GetRuntime(){return this._runtime}GetIndex(){return this._index}GetDebugIndex(){return this._debugData.index}GetCombinedSolModifiers(){return this._combinedSolModifiers}IsBreakpoint(){return this._debugData.isBreakpoint}_SetBreakpoint(f){this._debugData.isBreakpoint= !!f;this._eventBlock._UpdateCanRunFastRecursive()}_DebugReturnsGenerator(){return this._debugData.canDebug}DebugCanRunFast(){return!this.IsBreakpoint()&&!this._runtime.DebugBreakNext()&&!this._DebugReturnsGenerator()}GetSavedDataMap(){this._savedData||(this._savedData=new Map);return this._savedData}GetUnsavedDataMap(){this._unsavedData||(this._unsavedData=new Map);return this._unsavedData}_RunSystem(){const f=this._results;b(this._parameters,f);return this._func.apply(this._systemPlugin,f)}*_DebugRunSystem(){if(this.IsBreakpoint()|| this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._results;b(this._parameters,f);return yield*this._func.apply(this._systemPlugin,f)}return this.Run()}*_DebugRunCallFunction(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return yield*this._callEventBlock.DebugRunAsFunctionCall(this._combinedSolModifiers,this._parameters)}_RunSingleGlobal(){const f=this._results;b(this._parameters,f);return this._func.apply(this._objectClass.GetSingleGlobalInstance().GetSdkInstance(), f)}*_DebugRunSingleGlobal(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._results;b(this._parameters,f);return yield*this._func.apply(this._objectClass.GetSingleGlobalInstance().GetSdkInstance(),f)}return this.Run()}_RunObject_ParamsConst(){const f=this._results,l=this._objectClass.GetCurrentSol().GetInstances();for(let g=0,k=l.length;g<k;++g)this._func.apply(l[g].GetSdkInstance(),f)}*_DebugRunObject_ParamsConst(){if(this.IsBreakpoint()|| this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._results,l=this._objectClass.GetCurrentSol().GetInstances();for(let g=0,k=l.length;g<k;++g)yield*this._func.apply(l[g].GetSdkInstance(),f)}else this._RunObject_ParamsConst()}_RunObject_ParamsDontVary(){const f=this._results;b(this._parameters,f);const l=this._objectClass.GetCurrentSol().GetInstances();for(let g=0,k=l.length;g<k;++g)this._func.apply(l[g].GetSdkInstance(),f)}*_DebugRunObject_ParamsDontVary(){if(this.IsBreakpoint()|| this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._results;b(this._parameters,f);const l=this._objectClass.GetCurrentSol().GetInstances();for(let g=0,k=l.length;g<k;++g)yield*this._func.apply(l[g].GetSdkInstance(),f)}else this._RunObject_ParamsDontVary()}_RunObject_AllParamsVary(){const f=this._parameters,l=this._results,g=this._func,k=this._objectClass.GetCurrentSol().GetInstances();for(let m=0,u=k.length;m<u;++m){const x=k[m];for(let n=0,q=f.length;n<q;++n)l[n]= f[n].Get(m);g.apply(x.GetSdkInstance(),l)}}*_DebugRunObject_AllParamsVary(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._parameters,l=this._results,g=this._func,k=this._objectClass.GetCurrentSol().GetInstances();for(let m=0,u=k.length;m<u;++m){const x=k[m];for(let n=0,q=f.length;n<q;++n)l[n]=f[n].Get(m);yield*g.apply(x.GetSdkInstance(),l)}}else this._RunObject_AllParamsVary()}_RunObject_SomeParamsVary(){const f=this._parameters, l=this._results,g=this._func,k=this._objectClass.GetCurrentSol().GetInstances();for(let u=0,x=f.length;u<x;++u){var m=f[u];m.VariesPerInstance()||(l[u]=m.Get(0))}for(let u=0,x=k.length;u<x;++u){m=k[u];for(let n=0,q=f.length;n<q;++n){const t=f[n];t.VariesPerInstance()&&(l[n]=t.Get(u))}g.apply(m.GetSdkInstance(),l)}}*_DebugRunObject_SomeParamsVary(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const l=this._parameters,g=this._results,k=this._func, m=this._objectClass.GetCurrentSol().GetInstances();for(let u=0,x=l.length;u<x;++u){var f=l[u];f.VariesPerInstance()||(g[u]=f.Get(0))}for(let u=0,x=m.length;u<x;++u){f=m[u];for(let n=0,q=l.length;n<q;++n){const t=l[n];t.VariesPerInstance()&&(g[n]=t.Get(u))}yield*k.apply(f.GetSdkInstance(),g)}}else this._RunObject_SomeParamsVary()}_RunBehavior(){var f=this._objectClass;const l=f.IsFamily(),g=f.GetFamilyIndex(),k=this._parameters,m=this._anyParamVariesPerInstance,u=this._results,x=this._func,n=this._behaviorIndex; f=f.GetCurrentSol().GetInstances();for(let r=0,w=k.length;r<w;++r){var q=k[r];q.VariesPerInstance()||(u[r]=q.Get(0))}for(let r=0,w=f.length;r<w;++r){q=f[r];if(m)for(let y=0,C=k.length;y<C;++y){var t=k[y];t.VariesPerInstance()&&(u[y]=t.Get(r))}t=l?q.GetObjectClass().GetFamilyBehaviorOffset(g):0;x.apply(q.GetBehaviorInstances()[n+t].GetSdkInstance(),u)}}*_DebugRunBehavior(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var f=this._objectClass;const k= f.IsFamily(),m=f.GetFamilyIndex(),u=this._parameters,x=this._anyParamVariesPerInstance,n=this._results,q=this._func,t=this._behaviorIndex;f=f.GetCurrentSol().GetInstances();for(let r=0,w=u.length;r<w;++r){var l=u[r];l.VariesPerInstance()||(n[r]=l.Get(0))}for(let r=0,w=f.length;r<w;++r){l=f[r];if(x)for(let y=0,C=u.length;y<C;++y){var g=u[y];g.VariesPerInstance()&&(n[y]=g.Get(r))}g=k?l.GetObjectClass().GetFamilyBehaviorOffset(m):0;yield*q.apply(l.GetBehaviorInstances()[t+g].GetSdkInstance(),n)}}else this._RunBehavior()}_RunObject_Async(){const f= this._parameters,l=this._results,g=this._func,k=this._objectClass.GetCurrentSol().GetInstances(),m=[];for(let u=0,x=k.length;u<x;++u){const n=k[u];for(let q=0,t=f.length;q<t;++q)l[q]=f[q].Get(u);m.push(g.apply(n.GetSdkInstance(),l))}return Promise.all(m)}*_DebugRunObject_Async(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._parameters,l=this._results,g=this._func,k=this._objectClass.GetCurrentSol().GetInstances(),m=[];for(let u=0, x=k.length;u<x;++u){const n=k[u];for(let q=0,t=f.length;q<t;++q)l[q]=f[q].Get(u);m.push(yield*g.apply(n.GetSdkInstance(),l))}return Promise.all(m)}return this._RunObject_Async()}_RunBehavior_Async(){var f=this._objectClass;const l=f.IsFamily(),g=f.GetFamilyIndex(),k=this._parameters,m=this._results,u=this._func,x=this._behaviorIndex;f=f.GetCurrentSol().GetInstances();const n=[];for(let q=0,t=f.length;q<t;++q){const r=f[q];for(let y=0,C=k.length;y<C;++y)m[y]=k[y].Get(q);const w=l?r.GetObjectClass().GetFamilyBehaviorOffset(g): 0;n.push(u.apply(r.GetBehaviorInstances()[x+w].GetSdkInstance(),m))}return Promise.all(n)}*_DebugRunBehavior_Async(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var f=this._objectClass;const l=f.IsFamily(),g=f.GetFamilyIndex(),k=this._parameters,m=this._results,u=this._func,x=this._behaviorIndex;f=f.GetCurrentSol().GetInstances();const n=[];for(let q=0,t=f.length;q<t;++q){const r=f[q];for(let y=0,C=k.length;y<C;++y)m[y]=k[y].Get(q);const w=l? r.GetObjectClass().GetFamilyBehaviorOffset(g):0;n.push(yield*u.apply(r.GetBehaviorInstances()[x+w].GetSdkInstance(),m))}return Promise.all(n)}return this._RunBehavior_Async()}async RunUserScript(){try{await this._func()}catch(f){console.error(`Unhandled exception running script %c${this._eventBlock.GetEventSheet().GetName()}, event ${this._eventBlock.GetDisplayNumber()}, action ${this.GetDebugIndex()+1}:`,"font-size: 1.2em; font-weight: bold;",f),self.C3Debugger&&self.C3Debugger._SetLastErrorScript(this), e.EventScript.HadUserScriptException()||(console.info("%cTip:%c run this to highlight in Construct the last script that had an error: %cgoToLastErrorScript()","font-weight: bold; text-decoration: underline","","font-weight: bold"),e.EventScript.SetHadUserScriptException())}}*DebugRunUserScript(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return this.RunUserScript()}_SaveToJson(){return this._savedData&&this._savedData.size?{ex:e.ToSuperJSON(this._savedData)}:null}_LoadFromJson(f){this._savedData&& (this._savedData.clear(),this._savedData=null);f&&(f=f.ex)&&(this._savedData=e.FromSuperJSON(f))}}} {"use strict";const e=self.C3,b=new e.Color;function a(N,P){return e.compare(this.GetWorldInfo().GetX(),N,P)}function d(N,P){return e.compare(this.GetWorldInfo().GetY(),N,P)}function c(){const N=this.GetWorldInfo(),P=N.GetLayer();return P.Has3DCamera()?N.IsInViewport3D(P._GetViewFrustum()):N.IsInViewport(P.GetViewport(),N.GetLayout().HasVanishingPointOutsideViewport(),N.GetLayout().IsOrthographicProjection())}function f(){var N=this.GetWorldInfo();const P=N.GetLayout();N=N.GetBoundingBox();return 0> N.getRight()||0>N.getBottom()||N.getLeft()>P.GetWidth()||N.getTop()>P.GetHeight()}function l(N,P,W){const Z=this.GetCurrentSol(),fa=Z.GetInstances();if(!fa.length)return!1;let ia=fa[0];var ka=ia.GetWorldInfo();let sa=ia,na=e.distanceSquared(ka.GetX(),ka.GetY(),P,W);for(let xa=1,za=fa.length;xa<za;++xa)if(ia=fa[xa],ka=ia.GetWorldInfo(),ka=e.distanceSquared(ka.GetX(),ka.GetY(),P,W),0===N&&ka<na||1===N&&ka>na)na=ka,sa=ia;Z.PickOne(sa);return!0}function g(N){const P=this.GetWorldInfo();P.GetX()!==N&& (P.SetX(N),P.SetBboxChanged())}function k(N){const P=this.GetWorldInfo();P.GetY()!==N&&(P.SetY(N),P.SetBboxChanged())}function m(N,P){const W=this.GetWorldInfo();W.EqualsXY(N,P)||(W.SetXY(N,P),W.SetBboxChanged())}function u(N,P){if(N&&(N=N.GetPairedInstance(this._inst))){var [W,Z]=N.GetImagePoint(P);P=this.GetWorldInfo();if(P.GetX()!==W||P.GetY()!==Z)P.SetXY(W,Z),P.SetBboxChanged()}}function x(N){if(0!==N){var P=this.GetWorldInfo();P.OffsetXY(P.GetCosAngle()*N,P.GetSinAngle()*N);P.SetBboxChanged()}} function n(N,P){if(0!==P){var W=this.GetWorldInfo();N=e.toRadians(N);W.OffsetXY(Math.cos(N)*P,Math.sin(N)*P);W.SetBboxChanged()}}function q(){return this.GetWorldInfo().GetX()}function t(){return this.GetWorldInfo().GetY()}function r(){return this._runtime.GetDt(this._inst)}function w(N,P){return e.compare(this.GetWorldInfo().GetWidth(),N,P)}function y(N,P){return e.compare(this.GetWorldInfo().GetHeight(),N,P)}function C(N){const P=this.GetWorldInfo();P.GetWidth()!==N&&(P.SetWidth(N),P.SetBboxChanged())} function D(N){const P=this.GetWorldInfo();P.GetHeight()!==N&&(P.SetHeight(N),P.SetBboxChanged())}function G(N,P){const W=this.GetWorldInfo();if(W.GetWidth()!==N||W.GetHeight()!==P)W.SetSize(N,P),W.SetBboxChanged()}function K(){return this.GetWorldInfo().GetWidth()}function B(){return this.GetWorldInfo().GetHeight()}function A(){return this.GetWorldInfo().GetBoundingBox().getLeft()}function F(){return this.GetWorldInfo().GetBoundingBox().getTop()}function J(){return this.GetWorldInfo().GetBoundingBox().getRight()} function L(){return this.GetWorldInfo().GetBoundingBox().getBottom()}function Q(N,P){return e.angleDiff(this.GetWorldInfo().GetAngle(),e.toRadians(P))<=e.toRadians(N)}function T(N){return e.angleClockwise(this.GetWorldInfo().GetAngle(),e.toRadians(N))}function V(N,P){N=e.toRadians(N);P=e.toRadians(P);const W=this.GetWorldInfo().GetAngle();return e.angleClockwise(P,N)?e.angleClockwise(W,N)&&!e.angleClockwise(W,P):!(!e.angleClockwise(W,N)&&e.angleClockwise(W,P))}function aa(N){const P=this.GetWorldInfo(); N=e.clampAngle(e.toRadians(N));isNaN(N)||P.GetAngle()===N||(P.SetAngle(N),P.SetBboxChanged())}function ha(N){if(!isNaN(N)&&0!==N){var P=this.GetWorldInfo();P.SetAngle(P.GetAngle()+e.toRadians(N));P.SetBboxChanged()}}function ja(N){if(!isNaN(N)&&0!==N){var P=this.GetWorldInfo();P.SetAngle(P.GetAngle()-e.toRadians(N));P.SetBboxChanged()}}function oa(N,P){const W=this.GetWorldInfo(),Z=W.GetAngle();N=e.angleRotate(Z,e.toRadians(P),e.toRadians(N));isNaN(N)||Z===N||(W.SetAngle(N),W.SetBboxChanged())}function ya(N, P,W){const Z=this.GetWorldInfo(),fa=Z.GetAngle();P-=Z.GetX();W-=Z.GetY();N=e.angleRotate(fa,Math.atan2(W,P),e.toRadians(N));isNaN(N)||fa===N||(Z.SetAngle(N),Z.SetBboxChanged())}function Ba(N,P){const W=this.GetWorldInfo(),Z=W.GetAngle();N-=W.GetX();P-=W.GetY();P=Math.atan2(P,N);isNaN(P)||Z===P||(W.SetAngle(P),W.SetBboxChanged())}function La(){return e.toDegrees(this.GetWorldInfo().GetAngle())}function Da(N,P){return e.compare(e.round6dp(100*this.GetWorldInfo().GetOpacity()),N,P)}function Ga(){return this.GetWorldInfo().IsVisible()} function ma(N){const P=this.GetWorldInfo();N=2===N?!P.IsVisible():0!==N;P.IsVisible()!==N&&(P.SetVisible(N),this._runtime.UpdateRender())}function Oa(N){N=e.clamp(N/100,0,1);const P=this.GetWorldInfo();P.GetOpacity()!==N&&(P.SetOpacity(N),this._runtime.UpdateRender())}function Aa(N){b.setFromRgbValue(N);N=this.GetWorldInfo();N.GetUnpremultipliedColor().equalsIgnoringAlpha(b)||(N.SetUnpremultipliedColor(b),this._runtime.UpdateRender())}function Ma(){const N=this.GetWorldInfo().GetUnpremultipliedColor(); return e.PackRGBAEx(N.getR(),N.getG(),N.getB(),N.getA())}function bb(){return e.round6dp(100*this.GetWorldInfo().GetOpacity())}function cb(N){return N?this.GetWorldInfo().GetLayer()===N:!1}function db(N){const P=this.GetCurrentSol(),W=P.GetInstances();if(!W.length)return!1;let Z=W[0];for(let fa=1,ia=W.length;fa<ia;++fa){const ka=W[fa],sa=ka.GetWorldInfo(),na=Z.GetWorldInfo(),xa=sa.GetLayer().GetIndex(),za=na.GetLayer().GetIndex();if(0===N){if(xa>za||xa===za&&sa.GetZIndex()>na.GetZIndex())Z=ka}else if(xa< za||xa===za&&sa.GetZIndex()<na.GetZIndex())Z=ka}P.PickOne(Z);return!0}function Ya(N,P,W){const Z=this.GetWorldInfo();N=0===N?Z.GetZElevation():Z.GetTotalZElevation();return e.compare(N,P,W)}function ob(){this.GetWorldInfo().ZOrderMoveToTop()}function pb(){this.GetWorldInfo().ZOrderMoveToBottom()}function qb(N){N&&this.GetWorldInfo().ZOrderMoveToLayer(N)}function rb(N,P){N=0===N;P&&(P=P.GetFirstPicked(this.GetInstance()))&&this.GetWorldInfo().ZOrderMoveAdjacentToInstance(P,N)}function sb(N){const P= this.GetWorldInfo();P.GetZElevation()!==N&&(P.SetZElevation(N),this._runtime.UpdateRender())}function tb(){return this.GetWorldInfo().GetLayer().GetIndex()}function ub(){return this.GetWorldInfo().GetLayer().GetName()}function eb(){return this.GetWorldInfo().GetZIndex()}function vb(){return this.GetWorldInfo().GetZElevation()}function wb(){return this.GetWorldInfo().GetTotalZElevation()}function xb(N,P){if(P=this.GetObjectClass().GetEffectList().GetEffectTypeByName(P)){P=P.GetIndex();N=1===N;var W= this.GetWorldInfo().GetInstanceEffectList();W.IsEffectIndexActive(P)!==N&&(W.SetEffectIndexActive(P,N),W.UpdateActiveEffects(),this._runtime.UpdateRender())}}function yb(N,P,W){var Z=this.GetObjectClass().GetEffectList().GetEffectTypeByName(N);if(Z){N=Z.GetIndex();var fa=this.GetWorldInfo().GetInstanceEffectList(),ia=fa.GetEffectParametersForIndex(N);P=Math.floor(P);if(!(0>P||P>=ia.length)){Z=Z.GetShaderProgram().GetParameterType(P);if("color"===Z){b.setFromRgbValue(W);P=ia[P];if(b.equalsIgnoringAlpha(P))return; P.copyRgb(b)}else{"percent"===Z&&(W/=100);if(ia[P]===W)return;ia[P]=W}fa.IsEffectIndexActive(N)&&this._runtime.UpdateRender()}}}const fb=e.New(e.Rect),Xa=[],gb=[];let hb=!1,Za=null,ib=!1;const Ta=new Set;function jb(N,P,W,Z){const fa=P.GetUID(),ia=W.GetUID();fa<ia?N.Set(P,W,Z):N.Set(W,P,Z)}function ra(N,P,W){const Z=P.GetUID(),fa=W.GetUID();Z<fa?N.Delete(P,W):N.Delete(W,P)}function Ra(N,P){N.DeleteEither(P)}function zb(N,P,W){const Z=P.GetUID(),fa=W.GetUID();return Z<fa?N.Get(P,W):N.Get(W,P)}function Ab(N, P,W,Z){if(!P)return!1;N=N.GetInstance();const fa=0!==W||0!==Z,ia=N.GetWorldInfo(),ka=N.GetRuntime(),sa=ka.GetCollisionEngine();var na=ka.GetCurrentCondition();const xa=na.GetEventBlock().IsOrBlock();var za=na.GetObjectClass();na=na.IsInverted();const Na=P.GetCurrentSol();za=za!==P;Za=P;hb=za&&!na;ib=!1;let Sa=0,Fa=0,la=!1;Na.IsSelectAll()?(fb.copy(ia.GetBoundingBox()),fb.offset(W,Z),sa.GetCollisionCandidates(ia.GetLayer(),P,fb,gb),P=gb):xa?ka.IsCurrentConditionFirst()&&!Na._GetOwnElseInstances().length&& Na._GetOwnInstances().length?P=Na._GetOwnInstances():(P=Na._GetOwnElseInstances(),ib=!0):P=Na._GetOwnInstances();fa&&(Sa=ia.GetX(),Fa=ia.GetY(),ia.OffsetXY(W,Z),ia.SetBboxChanged());for(const da of P)if(sa.TestOverlap(N,da)){la=!0;if(na)break;za&&Ta.add(da)}fa&&(ia.SetXY(Sa,Fa),ia.SetBboxChanged());e.clearArray(gb);return la}function Db(N){N=N.GetRuntime().GetCurrentEvent().IsOrBlock();const P=Za.GetCurrentSol(),W=P._GetOwnInstances(),Z=P._GetOwnElseInstances();P.IsSelectAll()?(P.SetSetPicked(Ta), N&&(e.clearArray(Z),P.AddElseInstances(Ta,Za.GetInstances()))):N?ib?P.TransferElseInstancesToOwn(Ta):(P.AddElseInstances(Ta,W),P.SetSetPicked(Ta)):P.SetSetPicked(Ta);Za.ApplySolToContainer()}function Eb(N,P){hb&&(P&&Db(N),Ta.clear(),Za=null,hb=!1)}function Fb(N){if(this._runtime.IsDebugging())return Gb.call(this,N);if(!N)return!1;var P=this._runtime;const W=P.GetCollisionEngine(),Z=P.GetEventSheetManager(),fa=Z.GetEventStack();var ia=Z.GetCurrentCondition();const ka=ia.GetObjectClass();var sa=ia.GetSavedDataMap(), na=ia.GetUnsavedDataMap();ia=fa.GetCurrentStackFrame();const xa=P.GetTickCount(),za=xa-1,Na=ia.GetCurrentEvent(),Sa=fa.Push(Na);let Fa=sa.get("collmemory");Fa||(Fa=e.New(e.PairMap),sa.set("collmemory",Fa));na.get("collisionCreatedDestroyCallback")||(na.set("collisionCreatedDestroyCallback",!0),P.Dispatcher().addEventListener("instancedestroy",Ua=>Ra(Fa,Ua.instance)));sa=ka.GetCurrentSol();P=N.GetCurrentSol();sa=sa.GetInstances();na=null;for(let Ua=0;Ua<sa.length;++Ua){const Ea=sa[Ua];P.IsSelectAll()? (W.GetCollisionCandidates(Ea.GetWorldInfo().GetLayer(),N,Ea.GetWorldInfo().GetBoundingBox(),Xa),na=Xa,W.AddRegisteredCollisionCandidates(Ea,N,na)):na=P.GetInstances();for(let ab=0;ab<na.length;++ab){const Qa=na[ab];if(W.TestOverlap(Ea,Qa)||W.CheckRegisteredCollision(Ea,Qa)){var la=zb(Fa,Ea,Qa),da=!1,pa=-2;"number"===typeof la&&(da=!0,pa=la);la=!da||pa<za;jb(Fa,Ea,Qa,xa);la&&(la=Na.GetSolModifiers(),Z.PushCopySol(la),pa=ka.GetCurrentSol(),da=N.GetCurrentSol(),pa._SetSelectAll(!1),da._SetSelectAll(!1), ka===N?(da=pa._GetOwnInstances(),e.clearArray(da),da.push(Ea),da.push(Qa),ka.ApplySolToContainer()):(pa=pa._GetOwnInstances(),da=da._GetOwnInstances(),e.clearArray(pa),e.clearArray(da),pa.push(Ea),da.push(Qa),ka.ApplySolToContainer(),N.ApplySolToContainer()),Na.Retrigger(ia,Sa),Z.PopSol(la))}else ra(Fa,Ea,Qa)}e.clearArray(Xa)}fa.Pop();return!1}function*Gb(N){if(!N)return!1;var P=this._runtime;const W=P.GetCollisionEngine(),Z=P.GetEventSheetManager(),fa=Z.GetEventStack(),ia=fa.GetCurrentStackFrame(), ka=P.GetTickCount(),sa=ka-1,na=ia.GetCurrentEvent(),xa=fa.Push(na);var za=Z.GetCurrentCondition();const Na=za.GetObjectClass();var Sa=za.GetSavedDataMap();za=za.GetUnsavedDataMap();let Fa=Sa.get("collmemory");Fa||(Fa=e.New(e.PairMap),Sa.set("collmemory",Fa));za.get("collisionCreatedDestroyCallback")||(za.set("collisionCreatedDestroyCallback",!0),P.Dispatcher().addEventListener("instancedestroy",Ua=>Ra(Fa,Ua.instance)));Sa=Na.GetCurrentSol();P=N.GetCurrentSol();Sa=Sa.GetInstances();za=null;for(let Ua= 0;Ua<Sa.length;++Ua){const Ea=Sa[Ua];P.IsSelectAll()?(W.GetCollisionCandidates(Ea.GetWorldInfo().GetLayer(),N,Ea.GetWorldInfo().GetBoundingBox(),Xa),za=Xa,W.AddRegisteredCollisionCandidates(Ea,N,za)):za=P.GetInstances();for(let ab=0;ab<za.length;++ab){const Qa=za[ab];if(W.TestOverlap(Ea,Qa)||W.CheckRegisteredCollision(Ea,Qa)){var la=zb(Fa,Ea,Qa),da=!1,pa=-2;"number"===typeof la&&(da=!0,pa=la);la=!da||pa<sa;jb(Fa,Ea,Qa,ka);la&&(la=na.GetSolModifiers(),Z.PushCopySol(la),pa=Na.GetCurrentSol(),da=N.GetCurrentSol(), pa._SetSelectAll(!1),da._SetSelectAll(!1),Na===N?(da=pa._GetOwnInstances(),e.clearArray(da),da.push(Ea),da.push(Qa),Na.ApplySolToContainer()):(pa=pa._GetOwnInstances(),da=da._GetOwnInstances(),e.clearArray(pa),e.clearArray(da),pa.push(Ea),da.push(Qa),Na.ApplySolToContainer(),N.ApplySolToContainer()),yield*na.DebugRetrigger(ia,xa),Z.PopSol(la))}else ra(Fa,Ea,Qa)}e.clearArray(Xa)}fa.Pop();return!1}function kb(N){return Ab(this,N,0,0)}function lb(N,P,W){return Ab(this,N,P,W)}function mb(){return this.GetWorldInfo().HasParent()} function nb(){return this.GetWorldInfo().HasChildren()}function $a(N,P){const W=this.GetCurrentSol().GetInstances();if(0===W.length)return!1;const Z=N.GetCurrentSol();var fa=Z.GetInstances();if(0===fa.length)return!1;fa=new Set(fa);const ia=new Set;for(let sa=0,na=W.length;sa<na;++sa){var ka=W[sa];if(1===P)for(const xa of ka.parents())xa.BelongsToObjectClass(N)&&fa.has(xa)&&ia.add(xa);else{if(0===P){if(ka=ka.GetParent(),null===ka)continue}else ka=ka.GetTopParent();ka.BelongsToObjectClass(N)&&fa.has(ka)&& ia.add(ka)}}if(0===ia.size)return!1;Z.SetSetPicked(ia);N.ApplySolToContainer();return!0}function h(N,P){const W=this.GetCurrentSol().GetInstances();if(0===W.length)return!1;const Z=N.GetCurrentSol();var fa=Z.GetInstances();if(Z.IsSelectAll()){var ia=[...this._runtime.instancesPendingCreateForObjectClass(N)];0<ia.length&&(fa=fa.concat(ia))}if(0===fa.length)return!1;fa=new Set(fa);ia=new Set;for(let ka=0,sa=W.length;ka<sa;++ka){const na=W[ka];2===P&&!na.HasChildren()&&na.BelongsToObjectClass(N)&&fa.has(na)&& ia.add(na);for(const xa of 0===P?na.children():na.allChildren())2===P&&xa.HasChildren()||xa.BelongsToObjectClass(N)&&fa.has(xa)&&ia.add(xa)}if(0===ia.size)return!1;Z.SetSetPicked(ia);N.ApplySolToContainer();return!0}function p(N,P){const W=this.GetCurrentSol().GetInstances();if(0===W.length)return!1;const Z=N.GetCurrentSol();var fa=Z.GetInstances();if(Z.IsSelectAll()){var ia=[...this._runtime.instancesPendingCreateForObjectClass(N)];0<ia.length&&(fa=fa.concat(ia))}if(0===fa.length)return!1;fa=new Set(fa); ia=[];for(let ka=0,sa=W.length;ka<sa;++ka){const na=W[ka].GetChildAt(P);null!==na&&na.BelongsToObjectClass(N)&&fa.has(na)&&ia.push(na)}if(0===ia.length)return!1;Z.SetArrayPicked(ia);N.ApplySolToContainer();return!0}function v(N,P){return e.compare(this._inst.GetChildCount(),N,P)}function z(N,P,W,Z,fa,ia,ka,sa){const na=this._inst,xa=this._runtime.GetCurrentAction().GetObjectClass();for(const za of N.allCorrespondingInstances(na,xa)){if(!za.GetPlugin().SupportsSceneGraph())break;na.AddChild(za,{transformX:P, transformY:W,transformWidth:Z,transformHeight:fa,transformAngle:ia,transformZElevation:ka,destroyWithParent:sa})}}function E(N){const P=this._inst,W=this._runtime.GetCurrentAction().GetObjectClass();for(const Z of N.allCorrespondingInstances(P,W))P.RemoveChild(Z)}function H(){this._inst.HasParent()&&this._inst.GetParent().RemoveChild(this._inst)}function I(){return this._inst.GetChildCount()}function M(N,P){N=Math.floor(N);P=Math.floor(P);const W=this.GetWorldInfo();2>N||2>P||!isFinite(N)||!isFinite(P)? (W.ReleaseMesh(),W.SetBboxChanged()):W.CreateMesh(N,P)}function O(N,P,W,Z,fa,ia,ka,sa){const na=this.GetWorldInfo();na.SetMeshPoint(N,P,{mode:0===W?"absolute":"relative",x:Z,y:fa,zElevation:ia,u:ka,v:sa})&&na.SetBboxChanged()}function R(){const N=this.GetWorldInfo();return N.HasMesh()?N.GetSourceMesh().GetHSize():0}function S(){const N=this.GetWorldInfo();return N.HasMesh()?N.GetSourceMesh().GetVSize():0}function U(N){const P=this.GetWorldInfo();N=2===N?!P.IsVisible():0!==N;P.IsVisible()!==N&&P.SetVisible(N)} function Y(N,P){this.SetElementCSSStyle(N,P)}function X(N,P){this.SetElementAttribute(N,""+P)}function ea(N){this.RemoveElementAttribute(N)}function ca(){this.FocusElement()}function ba(){this.BlurElement()}function wa(){return this.IsElementFocused()}function qa(N){this._SetEnabled(0!==N)}function ua(){return this._IsEnabled()}function va(N,P,W){return e.compare(this.GetInstance().GetInstanceVariableValue(N),P,W)}function ta(N){return!!this.GetInstance().GetInstanceVariableValue(N)}function Ha(N, P){const W=this.GetCurrentSol(),Z=W.GetInstances();if(!Z.length)return!1;let fa=Z[0],ia=fa,ka=fa.GetInstanceVariableValue(P);for(let sa=1,na=Z.length;sa<na;++sa){fa=Z[sa];const xa=fa.GetInstanceVariableValue(P);if(0===N&&xa<ka||1===N&&xa>ka)ka=xa,ia=fa}W.PickOne(ia);return!0}function Ia(N){return this._runtime.GetCurrentCondition().IsInverted()?Ka(this,N):Ja(this,N)}function Ja(N,P){P=N.GetRuntime().GetInstanceByUID(P);if(!P)return!1;const W=N.GetCurrentSol();if(!W.IsSelectAll()&&!W._GetOwnInstances().includes(P))return!1; if(N.IsFamily()){if(P.GetObjectClass().BelongsToFamily(N))return W.PickOne(P),N.ApplySolToContainer(),!0}else if(P.GetObjectClass()===N)return W.PickOne(P),N.ApplySolToContainer(),!0;return!1}function Ka(N,P){const W=N.GetCurrentSol();if(W.IsSelectAll()){W._SetSelectAll(!1);W.ClearArrays();var Z=N.GetInstances();for(let ia=0,ka=Z.length;ia<ka;++ia){var fa=Z[ia];fa.GetUID()===P?W._PushElseInstance(fa):W._PushInstance(fa)}N.ApplySolToContainer();return!!W._GetOwnInstances().length}Z=W._GetOwnInstances(); fa=0;for(let ia=0,ka=Z.length;ia<ka;++ia){const sa=Z[ia];Z[fa]=sa;sa.GetUID()===P?W._PushElseInstance(sa):++fa}e.truncateArray(Z,fa);N.ApplySolToContainer();return!!Z.length}function Pa(){this._runtime.DestroyInstance(this._inst)}function Va(){return!0}function Wa(){return!0}function Ca(N,P){this.GetInstance().SetInstanceVariableValue(N,P)}function Bb(N,P){const W=this.GetInstance(),Z=W.GetInstanceVariableValue(N);"number"===typeof Z&&"number"!==typeof P?P=parseFloat(P):"string"===typeof Z&&"string"!== typeof P&&(P=P.toString());W.SetInstanceVariableValue(N,Z+P)}function Cb(N,P){const W=this.GetInstance(),Z=W.GetInstanceVariableValue(N);"number"===typeof Z&&("number"!==typeof P&&(P=parseFloat(P)),W.SetInstanceVariableValue(N,Z-P))}function Hb(N,P){this.GetInstance().SetInstanceVariableValue(N,P?1:0)}function Ib(N){const P=this.GetInstance();P.SetInstanceVariableValue(N,0===P.GetInstanceVariableValue(N)?1:0)}function Jb(N){let P;try{P=JSON.parse(N)}catch(W){console.error("Failed to load from JSON string: ", W);return}N=this.GetInstance();N._OnBeforeLoad("state");N.LoadFromJson(P,"state")}function Kb(){return JSON.stringify(this.GetInstance().SaveToJson("state"))}function Lb(){return this.GetInstance().GetObjectClass().GetName()}function Mb(){const N=this._runtime.GetCurrentEventStackFrame().GetExpressionObjectClass();let P=N.GetInstanceCount();for(const W of this._runtime.instancesPendingCreateForObjectClass(N))++P;return P}function Nb(){return this._runtime.GetCurrentEventStackFrame().GetExpressionObjectClass().GetCurrentSol().GetInstances().length} function Ob(){return this._inst.GetIID()}function Pb(){return this._inst.GetUID()}e.AddCommonACEs=function(N,P){const W=N[1],Z=N[4],fa=N[5],ia=N[6],ka=N[7],sa=N[8],na=N[10],xa=N[11],za=N[12],Na=N[13],Sa=N[14],Fa=N[15],la=P.Cnds,da=P.Acts,pa=P.Exps;N[3]&&(la.CompareX=a,la.CompareY=d,la.IsOnScreen=c,la.IsOutsideLayout=f,la.PickDistance=l,da.SetX=g,da.SetY=k,da.SetPos=m,da.SetPosToObject=u,da.MoveForward=x,da.MoveAtAngle=n,pa.X=q,pa.Y=t,pa.dt=r);Z&&(la.CompareWidth=w,la.CompareHeight=y,da.SetWidth=C, da.SetHeight=D,da.SetSize=G,pa.Width=K,pa.Height=B,pa.BBoxLeft=A,pa.BBoxTop=F,pa.BBoxRight=J,pa.BBoxBottom=L);fa&&(la.AngleWithin=Q,la.IsClockwiseFrom=T,la.IsBetweenAngles=V,da.SetAngle=aa,da.RotateClockwise=ha,da.RotateCounterclockwise=ja,da.RotateTowardAngle=oa,da.RotateTowardPosition=ya,da.SetTowardPosition=Ba,pa.Angle=La);ia&&(la.IsVisible=Ga,la.CompareOpacity=Da,da.SetVisible=ma,da.SetOpacity=Oa,da.SetDefaultColor=Aa,pa.Opacity=bb,pa.ColorValue=Ma);ka&&(la.IsOnLayer=cb,la.PickTopBottom=db,la.CompareZElevation= Ya,da.MoveToTop=ob,da.MoveToBottom=pb,da.MoveToLayer=qb,da.ZMoveToObject=rb,da.SetZElevation=sb,pa.LayerNumber=tb,pa.LayerName=ub,pa.ZIndex=eb,pa.ZElevation=vb,pa.TotalZElevation=wb);sa&&(da.SetEffectEnabled=xb,da.SetEffectParam=yb);Na&&(la.HasParent=mb,la.HasChildren=nb,la.PickParent=$a,la.PickChildren=h,la.PickNthChild=p,la.CompareChildCount=v,da.AddChild=z,da.RemoveChild=E,da.RemoveFromParent=H,pa.ChildCount=I);Sa&&(da.SetMeshSize=M,da.SetMeshPoint=O,pa.MeshColumns=R,pa.MeshRows=S);na&&(la.IsVisible= Ga,da.SetVisible=U,da.SetCSSStyle=Y,da.SetElemAttribute=X,da.RemoveElemAttribute=ea);xa&&(la.IsFocused=wa,da.SetFocus=ca,da.SetBlur=ba);za&&(la.IsEnabled=ua,da.SetEnabled=qa);Fa&&(la.OnCollision=Fb,la.IsOverlapping=kb,la.IsOverlappingOffset=lb,P.FinishCollisionCondition=Eb);W||(la.CompareInstanceVar=va,la.IsBoolInstanceVarSet=ta,la.PickInstVarHiLow=Ha,la.PickByUID=Ia,da.SetInstanceVar=Ca,da.AddInstanceVar=Bb,da.SubInstanceVar=Cb,da.SetBoolInstanceVar=Hb,da.ToggleBoolInstanceVar=Ib,la.OnCreated=Va, la.OnDestroyed=Wa,da.Destroy=Pa,da.LoadFromJsonString||(da.LoadFromJsonString=Jb),pa.AsJSON||(pa.AsJSON=Kb),pa.Count=Mb,pa.PickedCount=Nb,pa.IID=Ob,pa.UID=Pb,pa.ObjectTypeName=Lb)}} {"use strict";const e=self.C3;e.ScheduledWait=class extends e.DefendedBase{constructor(b){super();this._eventSheetManager=b;this._type="";this._time=-1;this._signalTag="";this._isSignalled=!1;this._event=null;this._actIndex=0;this._solModifiers=[];this._sols=new Map;this._callingFunctionBlock=null;this._asyncId=-1;this._functionInnerLocalVars=this._functionParameters=null;this._shouldRelease=!1}Release(){this._type="";this._time=-1;this._signalTag="";this._functionInnerLocalVars=this._functionParameters= this._callingFunctionBlock=this._event=null;this._asyncId=-1;e.clearArray(this._solModifiers);for(const b of this._sols.values())b.Release();this._sols.clear()}_Init(){var b=this._eventSheetManager,a=b.GetRuntime().GetAllObjectClasses();const d=b.GetCurrentEventStackFrame();this._event=d.GetCurrentEvent();this._actIndex=d.GetActionIndex()+1;if(b=b.FindFirstFunctionBlockParent(this._event))this._callingFunctionBlock=b,this._functionParameters=b.CaptureFunctionParameters(),this._functionInnerLocalVars= b._GetAllInnerLocalVariables().map(c=>c.GetValue()),b.IsAsync()&&(this._asyncId=b.PauseCurrentAsyncFunction());for(const c of a)if(a=c.GetCurrentSol(),!a.IsSelectAll()||this._event.HasSolModifier(c))this._solModifiers.push(c),this._sols.set(c,e.New(e.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,d]of this._sols.entries())b=a.GetCurrentSol(),d._Restore(b);if(b=this._callingFunctionBlock)b.SetFunctionParameters(this._functionParameters),b._GetAllInnerLocalVariables().map((a,d)=>a.SetValue(this._functionInnerLocalVars[d])),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(d=>d.GetSID()),sols:b};this._event._HasActionIndex(this._actIndex)&&(a.act=this._event.GetActionAt(this._actIndex).GetSID());for(const [d,c]of this._sols)b[d.GetSID().toString()]=c._SaveToJson();return a}static _CreateFromJson(b,a){const d=b.GetRuntime();var c=b.GetEventBlockBySID(a.ev);if(!c)return null;let f=0;if(a.hasOwnProperty("act")){var l=b.GetActionBySID(a.act);if(!l)return null;f=l.GetIndex()}l= e.New(e.ScheduledWait,b);l._time=a.t;l._type=-1===l._time?"signal":"timer";l._signalTag=a.st;l._isSignalled=a.s;l._event=c;l._actIndex=f;for(var g of a.sm)(c=d.GetObjectClassBySID(g))&&l._solModifiers.push(c);for(const [k,m]of Object.entries(a.sols))if(a=parseInt(k,10),a=d.GetObjectClassBySID(a))g=e.New(e.SolState,null),g._LoadFromJson(b,m),l._sols.set(a,g);return l}}} {"use strict";const e=self.C3;e.SolState=class extends e.DefendedBase{constructor(b){super();this._objectClass=null;this._isSelectAll=!0;this._instances=[];b&&(this._objectClass=b.GetObjectClass(),this._isSelectAll=b.IsSelectAll(),e.shallowAssignArray(this._instances,b._GetOwnInstances()))}Release(){this._objectClass=null;e.clearArray(this._instances)}_Restore(b){b._SetSelectAll(this._isSelectAll);e.shallowAssignArray(b._GetOwnInstances(),this._instances)}RemoveInstances(b){e.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;e.clearArray(this._instances);for(const d of a.insts)(a=b.GetInstanceByUID(d))&&this._instances.push(a)}}} {"use strict";const e=self.C3;function b(a,d){let c=a.get(d);c||(c=new Map,a.set(d,c));return c}e.SDKPluginBase=class extends e.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, d){if(!d)throw Error("missing 'this' binding");let c=this._boundACEMethodCache.get(a);if(c)return c;c=a.bind(d);this._boundACEMethodCache.set(a,c);return c}_GetBoundACEMethod_1param(a,d,c){if(!d)throw Error("missing 'this' binding");const f=b(this._boundACEMethodCache_1param,a);let l=f.get(c);if(l)return l;l=a.bind(d,c);f.set(c,l);return l}_GetBoundACEMethod_2params(a,d,c,f){if(!d)throw Error("missing 'this' binding");var l=b(this._boundACEMethodCache_2params,a);l=b(l,c);let g=l.get(f);if(g)return g; g=a.bind(d,c,f);l.set(f,g);return g}_GetBoundACEMethod_3params(a,d,c,f,l){if(!d)throw Error("missing 'this' binding");var g=b(this._boundACEMethodCache_3params,a);g=b(g,c);g=b(g,f);let k=g.get(l);if(k)return k;k=a.bind(d,c,f,l);g.set(l,k);return k}_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 e=self.C3;e.SDKDOMPluginBase=class extends e.SDKPluginBase{constructor(b,a){super(b);this._domComponentId=a;this._nextElementId=0;this._instMap=new Map;this.AddElementMessageHandler("elem-focused",d=>d._OnElemFocused());this.AddElementMessageHandler("elem-blurred",d=>{d&&d._OnElemBlurred()})}Release(){super.Release()}_AddElement(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,d=>{const c=this._instMap.get(d.elementId);a(c,d)})}}}{"use strict";const e=self.C3;e.SDKTypeBase=class extends e.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 e=self.C3;e.SDKInstanceBase=class extends e.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,d]of b)this.AddDOMMessageHandler(a,d)}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 d=this.GetPropertyValueByIndex(b);if("number"!==typeof d)throw Error("expected number");this.SetPropertyValueByIndex(b,d+a)}}SetPropertyColorOffsetValueByIndex(b,a,d,c){}CallAction(b,...a){b.call(this,...a)}CallExpression(b,...a){return b.call(this,...a)}GetScriptInterfaceClass(){return null}}} {"use strict";const e=self.C3;e.SDKWorldInstanceBase=class extends e.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}GetImagePoint(b){b=this._inst.GetWorldInfo();return[b.GetX(),b.GetY()]}LoadTilemapData(b,a,d){}TestPointOverlapTile(b,a){}RendersToOwnZPlane(){return!0}}} {"use strict";const e=self.C3,b=e.New(e.Rect);e.SDKDOMInstanceBase=class extends e.SDKWorldInstanceBase{constructor(a,d){super(a,d);this._elementId=this.GetPlugin()._AddElement(this);this._isElementShowing=!0;this._autoFontSize=this._elemHasFocus=!1;this._lastRect=e.New(e.Rect,0,0,-1,-1);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,d){d||(d={});d.elementId=this._elementId;this.PostToDOM(a,d)}_PostToDOMElementMaybeSync(a,d){d||(d={});d.elementId=this._elementId;return this._PostToDOMMaybeSync(a,d)}PostToDOMElementAsync(a,d){d||(d={});d.elementId=this._elementId;return this.PostToDOMAsync(a,d)}CreateElement(a){a|| (a={});const d=this.GetWorldInfo().IsVisible();a.elementId=this._elementId;a.isVisible=d;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"===e.Platform.OS&& ("scale-inner"===a||"scale-outer"===a||"crop"===a)}_UpdatePosition(a){var d=this.GetWorldInfo();const c=d.GetLayer();var f=d.GetX(),l=d.GetY();let [g,k]=c.LayerToCanvasCss(f,l),[m,u]=c.LayerToCanvasCss(f+d.GetWidth(),l+d.GetHeight());f=this._runtime.GetCanvasManager();l=f.GetCssWidth();const x=f.GetCssHeight();if(d.IsVisible()&&c.IsVisible()){if(!this._ShouldPreserveElement()){if(0>=m||0>=u||g>=l||k>=x){this.SetElementVisible(!1);return}1>g&&(g=1);1>k&&(k=1);m>=l&&(m=l-1);u>=x&&(u=x-1)}b.set(g,k, m,u);d=f.GetLastWidth();l=f.GetLastHeight();!a&&b.equals(this._lastRect)&&this._lastWindowWidth===d&&this._lastWindowHeight===l?this.SetElementVisible(!0):(this._lastRect.copy(b),this._lastWindowWidth=d,this._lastWindowHeight=l,this.SetElementVisible(!0),a=null,this._autoFontSize&&(a=c.GetDisplayScale()-.2),this.PostToDOMElement("update-position",{left:Math.round(this._lastRect.getLeft())+f.GetCanvasClientX(),top:Math.round(this._lastRect.getTop())+f.GetCanvasClientY(),width:Math.round(this._lastRect.width()), height:Math.round(this._lastRect.height()),fontSize: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,d){this.PostToDOMElement("set-css-style",{prop:e.CSSToCamelCase(a),val:d})}SetElementAttribute(a,d){this.PostToDOMElement("set-attribute", {name:a,val:d})}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 e=self.C3,b=self.IBehavior;e.SDKBehaviorBase=class extends e.DefendedBase{constructor(a){super();this._runtime=a.runtime;this._myObjectClasses=e.New(e.ArraySet);this._myInstances=e.New(e.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 e=self.C3;e.SDKBehaviorTypeBase=class extends e.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 e=self.C3;e.SDKBehaviorInstanceBase=class extends e.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 d=this.GetPropertyValueByIndex(b);if("number"!==typeof d)throw Error("expected number");this.SetPropertyValueByIndex(b,d+a)}}SetPropertyColorOffsetValueByIndex(b,a,d,c){}CallAction(b,...a){b.call(this,...a)}CallExpression(b,...a){return b.call(this,...a)}GetScriptInterfaceClass(){return null}}} {"use strict";const e=self.C3;e.Plugins={};e.Behaviors={};e.PluginManager=class extends e.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");e.AddCommonACEs(b,a);b=e.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=e.New(e.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=e.New(b,{runtime:this._runtime});a.OnCreate();this._allBehaviors.push(a);this._behaviorsByCtor.set(b,a);!this._solidBehavior&& e.Behaviors.solid&&a instanceof e.Behaviors.solid?this._solidBehavior=a:!this._jumpthruBehavior&&e.Behaviors.jumpthru&&a instanceof e.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 e=self.C3,b=new Set;e.ImageInfo=class extends e.DefendedBase{constructor(){super();this._url="";this._height=this._width=this._offsetY=this._offsetX=this._size=0;this._hasMetaData=this._isRotated=!1;this._imageAsset=null;this._textureState="";this._rcTex=e.New(e.Rect);this._quadTex=e.New(e.Quad);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,d){if(this._imageAsset)throw Error("already loaded asset");this._url=d;const c={};e.IsAbsoluteURL(d)&&(c.loadPolicy="remote");this.LoadAsset(a,c);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._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}GetWidth(){return this._width}GetHeight(){return this._height}GetSheetWidth(){return this._imageAsset.GetWidth()}GetSheetHeight(){return this._imageAsset.GetHeight()}LoadAsset(a,d){if(this._imageAsset)throw Error("already got asset"); d=Object.assign({},d,{url:this.GetURL(),size:this.GetSize()});this._imageAsset=a.LoadImage(d)}IsLoaded(){return this._imageAsset&&this._imageAsset.IsLoaded()}async LoadStaticTexture(a,d){if(!this._imageAsset)throw Error("no asset");if(this._textureState)throw Error("already loaded texture");this._textureState="loading";a=await this._imageAsset.LoadStaticTexture(a,d);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(),d=e.CreateCanvas(this._width,this._height);d.getContext("2d").drawImage(a,this._offsetX,this._offsetY,this._width,this._height,0,0,this._width,this._height);return d}}} {"use strict";const e=self.C3;e.AnimationInfo=class extends e.DefendedBase{constructor(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=>e.New(e.AnimationFrameInfo,a))}Release(){for(const b of this._frames)b.Release();e.clearArray(this._frames)}LoadAllAssets(b){for(const a of this._frames)a.GetImageInfo().LoadAsset(b)}LoadAllTextures(b,a){return Promise.all(this._frames.map(d=> d.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 e=self.C3;e.AnimationFrameInfo=class extends e.DefendedBase{constructor(b){super();this._imageInfo=e.New(e.ImageInfo);this._imageInfo.LoadData(b);this._duration=b[7];this._origin=e.New(e.Vector2,b[8],b[9]);this._imagePoints=b[10].map(a=>e.New(e.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=e.New(e.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 e=self.C3;e.ImagePoint=class extends e.DefendedBase{constructor(b,a){super();this._afi=b;this._name=a[0];this._pos=e.New(e.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 e=self.C3,b=self.C3Debugger,a=self.IObjectClass;e.ObjectClass=class extends e.DefendedBase{constructor(d,c,f){super();const l=d.GetObjectReference(f[1]);this._runtime=d;this._plugin=d.GetPluginManager().GetPluginByConstructorFunction(l);this._sdkType=null;this._instSdkCtor=l.Instance;this._index=c;this._sid=f[11];this._name=f[0];this._jsPropName=this._runtime.GetJsPropName(f[14]);this._isGlobal=!!f[9];this._isFamily=!!f[2];this._isOnLoaderLayout=!!f[10];this._instVars=f[3].map(g=> ({sid:g[0],type:g[1],name:g[2],jsPropName:d.GetJsPropName(g[3])}));this._behaviorsCount=f[4];this._effectsCount=f[5];this._isWorldType=this._plugin.IsWorldType();this._effectList=null;this._collisionGrid=e.New(e.SparseGrid,d.GetOriginalViewportWidth(),d.GetOriginalViewportHeight());this._anyCollisionCellChanged=!0;this._anyInstanceParallaxed=!1;this._familyMembersSet=this._familyMembers=null;this._familyIndex=-1;this._familyEffectMap=this._familyBehaviorMap=this._familyInstVarMap=this._familiesSet= this._families=null;this._isInContainer=!1;this._container=null;this._behaviorTypes=f[8].map(g=>e.BehaviorType.Create(this,g));this._behaviorTypesIncludingInherited=[];this._behaviorsByName=new Map;this._behaviorNameToIndex=new Map;this._usedBehaviorCtors=new Set;this._solStack=e.New(e.SolStack,this);this._defaultInstanceData=null;this._defaultLayerIndex=0;this._isContained=!1;this._animationsBySid=this._animationsByName=this._animations=this._imageInfo=this._container=null;this._textureRefCount= 0;this._savedData=new Map;this._unsavedData=new Map;this._instances=[];this._iidsStale=!0;this._plugin.HasEffects()&&(this._effectList=e.New(e.EffectList,this,f[12]));f[6]&&(this._imageInfo=e.New(e.ImageInfo),this._imageInfo.LoadData(f[6]));if(f[7]){this._animations=f[7].map(g=>e.New(e.AnimationInfo,g));this._animationsByName=new Map;this._animationsBySid=new Map;for(const g of this._animations)this._animationsByName.set(g.GetName().toLowerCase(),g),this._animationsBySid.set(g.GetSID(),g)}this._isFamily? (this._familyMembers=[],this._familyMembersSet=new Set,this._familyIndex=this._runtime._GetNextFamilyIndex()):(this._families=[],this._familiesSet=new Set,this._familyInstVarMap=[],this._familyBehaviorMap=[],this._familyEffectMap=[]);this._sdkType=e.New(l.Type,this,f[15]);this._instanceUserScriptClass=this._iObjectClass=null;this._userScriptDispatcher=e.New(e.Event.Dispatcher);if(c=this._sdkType.GetScriptInterfaceClass()){if(this._iObjectClass=new c(this),!(this._iObjectClass instanceof a))throw new TypeError("script interface class must derive from IObjectClass"); }else this._iObjectClass=new a(this);f[13]&&(c=f[13])&&this._sdkType.LoadTilemapData(c[0],c[1],c[2]);this._runtime.UsesLoaderLayout()&&!this._isFamily&&!this._isOnLoaderLayout&&this._isWorldType||this.OnCreate();this._plugin.IsSingleGlobal()&&(this._plugin._SetSingleGlobalObjectClass(this),this._CreateSingleGlobalInstance(f))}static Create(d,c,f){return e.New(e.ObjectClass,d,c,f)}Release(){this._imageInfo&&(this._imageInfo.Release(),this._imageInfo=null);if(this._animations){for(const d of this._animations)d.Release(); e.clearArray(this._animations);this._animationsByName.clear();this._animationsBySid.clear()}this._solStack.Release();this._solStack=null;this._savedData.clear();this._unsavedData.clear();this._runtime=this._container=null}_LoadFamily(d){for(let c=1,f=d.length;c<f;++c){const l=this._runtime.GetObjectClassByIndex(d[c]);this._familyMembers.push(l);this._familyMembersSet.add(l);l._families.push(this);l._familiesSet.add(this)}}_SetContainer(d){this._isInContainer=!0;this._container=d}IsInContainer(){return this._isInContainer}GetContainer(){return this._container}_OnAfterCreate(){var d= 0;if(!this._isFamily)for(var c of this._families)for(var f of c.GetBehaviorTypes()){const k=f.GetName().toLowerCase();this._behaviorsByName.set(k,f);this._behaviorNameToIndex.set(k,d);this._behaviorTypesIncludingInherited.push(f);++d}for(var l of this.GetBehaviorTypes())c=l.GetName().toLowerCase(),this._behaviorsByName.set(c,l),this._behaviorNameToIndex.set(c,d),this._behaviorTypesIncludingInherited.push(l),++d;for(var g of this._behaviorTypesIncludingInherited)this._usedBehaviorCtors.add(g.GetBehavior().constructor); if(!this._isFamily&&this._families.length){d=this._runtime.GetFamilyCount();e.extendArray(this._familyInstVarMap,d,0);e.extendArray(this._familyBehaviorMap,d,0);e.extendArray(this._familyEffectMap,d,0);d=[];c=g=l=0;for(const k of this._families)if(f=k.GetFamilyIndex(),this._familyInstVarMap[f]=l,l+=k.GetInstanceVariablesCount(),this._familyBehaviorMap[f]=g,g+=k.GetBehaviorTypesCount(),this._familyEffectMap[f]=c,c+=k.GetEffectTypesCount(),(f=k.GetEffectList())&&this._effectList)for(const m of f.GetAllEffectTypes())d.push(m.Clone(this._effectList)); this._effectList&&this._effectList.PrependEffectTypes(d)}}_CreateSingleGlobalInstance(d){const c=this._runtime._GetNewUID(),f=e.New(e.Instance,{runtime:this._runtime,objectType:this,uid:c});f._CreateSdkInstance(d[16],[]);this._runtime._MapInstanceByUID(c,f);this._instances.push(f)}GetSdkType(){return this._sdkType}IsOnLoaderLayout(){return this._isOnLoaderLayout}OnCreate(){this._isFamily||this._sdkType.OnCreate()}HasLoadedTextures(){return 0<this._textureRefCount}LoadTextures(d){if(this._isFamily)return Promise.resolve(); this._textureRefCount++;return 1===this._textureRefCount?this._sdkType.LoadTextures(d)||Promise.resolve():Promise.resolve()}ReleaseTextures(){if(!this._isFamily){this._textureRefCount--;if(0>this._textureRefCount)throw Error("released textures too many times");0===this._textureRefCount&&this._sdkType.ReleaseTextures()}}OnDynamicTextureLoadComplete(){if(this._isFamily)throw Error("not applicable to family");this._sdkType.OnDynamicTextureLoadComplete()}PreloadTexturesWithInstances(d){return this._isFamily? Promise.resolve():this._sdkType.PreloadTexturesWithInstances(d)}GetRuntime(){return this._runtime}GetPlugin(){return this._plugin}GetInstanceSdkCtor(){return this._instSdkCtor}GetName(){return this._name}GetJsPropName(){return this._jsPropName}GetIndex(){return this._index}GetSID(){return this._sid}IsFamily(){return this._isFamily}IsGlobal(){return this._isGlobal}IsWorldType(){return this._isWorldType}GetFamilyIndex(){return this._familyIndex}GetBehaviorTypes(){return this._behaviorTypes}GetBehaviorTypesCount(){return this._behaviorsCount}UsesBehaviorByCtor(d){return d&& this._usedBehaviorCtors.has(d)}GetInstanceVariablesCount(){return this._instVars.length}GetInstanceVariableSIDs(){return this._instVars.map(d=>d.sid)}GetInstanceVariableIndexBySID(d){return this._instVars.findIndex(c=>c.sid===d)}GetInstanceVariableIndexByName(d){return this._instVars.findIndex(c=>c.name===d)}_GetAllInstanceVariableNames(){return this._instVars.map(d=>d.name)}_GetAllInstanceVariableJsPropNames(){return this._instVars.map(d=>d.jsPropName)}GetInstanceVariableType(d){d=Math.floor(d); if(0>d||d>=this._instVars.length)throw new RangeError("invalid instance variable index");return this._instVars[d].type}GetInstanceVariableName(d){d=Math.floor(d);if(0>d||d>=this._instVars.length)throw new RangeError("invalid instance variable index");return this._instVars[d].name}GetEffectTypesCount(){return this._effectsCount}GetBehaviorTypesIncludingInherited(){return this._behaviorTypesIncludingInherited}GetBehaviorTypeByName(d){return this._behaviorsByName.get(d.toLowerCase())||null}GetBehaviorIndexByName(d){d= this._behaviorNameToIndex.get(d.toLowerCase());return"undefined"===typeof d?-1:d}GetEffectList(){return this._effectList}HasEffects(){return this._plugin.HasEffects()}UsesEffects(){return this._effectList&&this._effectList.HasAnyEffectType()}GetSolStack(){return this._solStack}GetCurrentSol(){return this._solStack.GetCurrentSol()}GetImageInfo(){return this._imageInfo}SetDefaultInstanceData(d){this._defaultInstanceData=d}GetDefaultInstanceData(){return this._defaultInstanceData}_SetDefaultLayerIndex(d){this._defaultLayerIndex= d}GetDefaultLayerIndex(){return this._defaultLayerIndex}GetAnimations(){return this._animations}GetAnimationCount(){return this._animations.length}GetFamilies(){return this._families}BelongsToFamily(d){return this._familiesSet.has(d)}GetFamilyMembers(){return this._familyMembers}FamilyHasMember(d){return this._familyMembersSet.has(d)}GetFamilyBehaviorOffset(d){return this._familyBehaviorMap[d]}GetFamilyInstanceVariableOffset(d){return this._familyInstVarMap[d]}GetAnimationByName(d){if(!this._animations)throw Error("no animations"); return this._animationsByName.get(d.toLowerCase())||null}GetAnimationBySID(d){if(!this._animations)throw Error("no animations");return this._animationsBySid.get(d)||null}GetFirstAnimationFrame(){if(!this._animations)throw Error("no animations");return this._animations[0].GetFrameAt(0)}GetDefaultInstanceSize(){if(this._animations){const d=this.GetFirstAnimationFrame().GetImageInfo();return[d.GetWidth(),d.GetHeight()]}return this._imageInfo?[this._imageInfo.GetWidth(),this._imageInfo.GetHeight()]:[100, 100]}GetSingleGlobalInstance(){if(!this._plugin.IsSingleGlobal())throw Error("not a single-global plugin");return this._instances[0]}GetInstances(){return this._instances}*instances(){yield*this._instances}*instancesIncludingPendingCreate(){yield*this._instances;for(const d of this._runtime._GetInstancesPendingCreate())d.GetObjectClass()===this&&(yield d)}GetInstanceCount(){return this._instances.length}_AddInstance(d){this._instances.push(d)}_SetIIDsStale(){this._iidsStale=!0}_UpdateIIDs(){if(this._iidsStale&& !this._isFamily){var d=this._instances,c=0;for(let f=d.length;c<f;++c)d[c]._SetIID(c);d=this._runtime._GetInstancesPendingCreate();for(const f of d)f.GetObjectClass()===this&&f._SetIID(c++);this._iidsStale=!1}}GetInstanceByIID(d){var c=this._instances;if(d<c.length)return c[d];d-=c.length;c=this._runtime._GetInstancesPendingCreate();for(const f of c)if(f.GetObjectClass()===this){if(0===d)return f;--d}return null}GetFirstPicked(d){if(d&&d.IsInContainer()&&d.GetObjectClass()!==this)for(const c of d.siblings())if(c.GetObjectClass()=== this)return c;d=this.GetCurrentSol().GetInstances();return d.length?d[0]:null}GetPairedInstance(d){const c=this.GetCurrentSol().GetInstances();return 0<c.length?c[d.GetIID()%c.length]:null}*allCorrespondingInstances(d,c){const f=this.GetCurrentSol().GetInstances();var l=f.length;const g=c.GetCurrentSol(),k=c.GetCurrentSol().GetInstances(),m=k.length;var u=d.GetIID();if(c.IsFamily()||!g.IsSelectAll())u=k.indexOf(d);d=Math.ceil(l/m);l%=m;0===l||u<l?(u*=d,l=d):(u=l*d+(u-l)*(d-1),l=d-1);for(let x=u,n= u+l;x<n;++x)yield f[x]}FinishCondition(d){this._sdkType.FinishCondition(d)}ApplySolToContainer(){if(this._isInContainer&&!this._isFamily){this._UpdateIIDs();var d=this.GetCurrentSol(),c=d._GetOwnInstances(),f=d.IsSelectAll(),l=this._runtime.GetCurrentEventStackFrame();l=l&&l.GetCurrentEvent()&&l.GetCurrentEvent().IsOrBlock();for(const m of this._container.objectTypes())if(m!==this){m._UpdateIIDs();var g=m.GetCurrentSol();g._SetSelectAll(f);if(!f){var k=g._GetOwnInstances();e.clearArray(k);for(const u of c)k.push(m.GetInstanceByIID(u.GetIID())); if(l){k=d._GetOwnElseInstances();g=g._GetOwnElseInstances();e.clearArray(g);for(const u of k)g.push(m.GetInstanceByIID(u.GetIID()))}}}}}_TruncateContainerSols(d,c){for(const f of this.GetContainer().objectTypes()){const l=f.GetCurrentSol();d?e.truncateArray(l._GetOwnElseInstances(),c):e.truncateArray(l._GetOwnInstances(),c)}}_GetCollisionCellGrid(){return this._collisionGrid}_SetAnyCollisionCellChanged(d){this._anyCollisionCellChanged=!!d}_SetAnyInstanceParallaxed(d){this._anyInstanceParallaxed=!!d}IsAnyInstanceParallaxed(){return this._anyInstanceParallaxed}_UpdateAllCollisionCells(){if(this._anyCollisionCellChanged&& this._isWorldType){for(const d of this._instances)d.GetWorldInfo()._UpdateCollisionCell();for(const d of this._runtime._GetInstancesPendingCreate())d.GetObjectClass()===this&&d.GetWorldInfo()._UpdateCollisionCell();this._anyCollisionCellChanged=!1}}GetSavedDataMap(){this._savedData||(this._savedData=new Map);return this._savedData}GetUnsavedDataMap(){this._unsavedData||(this._unsavedData=new Map);return this._unsavedData}HasSolidBehavior(){return this.UsesBehaviorByCtor(e.Behaviors.solid)}HasNoSaveBehavior(){return this.UsesBehaviorByCtor(e.Behaviors.NoSave)}HasPersistBehavior(){return this.UsesBehaviorByCtor(e.Behaviors.Persist)}_SaveToJson(){const d= {instances:this._instances.map(c=>c.SaveToJson())};this._savedData&&this._savedData.size&&(d.ex=e.ToSuperJSON(this._savedData));return d}_LoadFromJson(d){this._savedData&&(this._savedData.clear(),this._savedData=null);var c=d.ex;c&&(this._savedData=e.FromSuperJSON(c));c=this._instances;d=d.instances;for(let f=0,l=Math.min(c.length,d.length);f<l;++f)c[f].LoadFromJson(d[f]);for(let f=d.length,l=c.length;f<l;++f)this._runtime.DestroyInstance(c[f]);for(let f=c.length,l=d.length;f<l;++f){c=d[f];let g= null;if(this.IsWorldType()&&(g=this._runtime.GetMainRunningLayout().GetLayerBySID(c.w.l),!g))continue;this._runtime.CreateInstanceFromData(this._defaultInstanceData||this,g,!1,0,0,!0).LoadFromJson(c)}this._SetIIDsStale()}GetIObjectClass(){return this._iObjectClass}UserScriptDispatcher(){return this._userScriptDispatcher}_GetUserScriptInstanceClass(){return this._instanceUserScriptClass}_SetUserScriptInstanceClass(d){this._instanceUserScriptClass=d}DispatchUserScriptEvent(d){var c=this._runtime;(c= c.IsDebug()&&!c.GetEventSheetManager().IsInEventEngine())&&b.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(d);c&&b.AddScriptTime()}}} {"use strict";const e=self.C3;e.Container=class extends e.DefendedBase{constructor(b,a){super();this._runtime=b;this._objectTypes=a;for(const d of this._objectTypes)d._SetContainer(this)}Release(){this._runtime=null}GetRuntime(){return this._runtime}GetObjectTypes(){return this._objectTypes}objectTypes(){return this._objectTypes}HasAnyWorldType(){return this._objectTypes.some(b=>b.IsWorldType())}}} {"use strict";const e=self.C3,b=self.C3Debugger,a=self.IInstance,d=[];let c=0;const f=new WeakMap,l=new WeakMap;e.Instance=class extends e.DefendedBase{constructor(g){super();this._runtime=g.runtime;this._objectType=g.objectType;this._iScriptInterface=this._sdkInst=this._worldInfo=null;this._iid=0;this._uid=g.uid;this._puid=c++;this._flags=0;this._behaviorInstances=this._instVarValues=d;var k=this._objectType.GetBehaviorTypesIncludingInherited();0<k.length&&(this._behaviorInstances=k.map((m,u)=>e.New(e.BehaviorInstance, {runtime:this._runtime,behaviorType:m,instance:this,index:u})));this._siblings=this._objectType.IsInContainer()?[]:null;this._timeScale=-1;this._dispatcher=null;k=this.GetPlugin();k.MustPreDraw()&&(this._flags|=4);if(k.IsWorldType())if(this._worldInfo=e.New(e.WorldInfo,this,g.layer),g.worldData)this._worldInfo.Init(g.worldData);else{this._worldInfo.InitNoData();const [m,u]=this._objectType.GetDefaultInstanceSize();this._worldInfo.SetSize(m,u);this.GetObjectClass().UsesEffects()&&this._worldInfo.GetInstanceEffectList().LoadDefaultEffectParameters()}g.instVarData? this._LoadInstanceVariableData(g.instVarData):this._LoadDefaultInstanceVariables()}Release(){this._iScriptInterface&&(this._iScriptInterface._Release(),this._iScriptInterface=null);if(0<this._behaviorInstances.length){for(var g of this._behaviorInstances)g.Release();e.clearArray(this._behaviorInstances)}this._sdkInst.Release();this._sdkInst=null;if(g=f.get(this))g.clear(),f.delete(this);if(g=l.get(this))g.clear(),l.delete(this);this._siblings&&e.clearArray(this._siblings);this._dispatcher&&(this._dispatcher.Release(), this._dispatcher=null);this._objectType=this._runtime=null;0<this._instVarValues.length&&e.clearArray(this._instVarValues);this._worldInfo&&(this._worldInfo.Release(),this._worldInfo=null)}_LoadInstanceVariableData(g){0<g.length&&(this._instVarValues=[],e.shallowAssignArray(this._instVarValues,g))}_LoadDefaultInstanceVariables(){const g=this._objectType.GetInstanceVariablesCount();if(0!==g){this._instVarValues=[];var k=[0,0,""];for(let m=0;m<g;++m)this._instVarValues.push(k[this._objectType.GetInstanceVariableType(m)])}}_CreateSdkInstance(g, k){if(this._sdkInst)throw Error("already got sdk instance");for(let m=0,u=this._behaviorInstances.length;m<u;++m)this._behaviorInstances[m]._CreateSdkInstance(k?k[m]:null);this._sdkInst=e.New(this._objectType.GetInstanceSdkCtor(),this,g);if(!(this._sdkInst instanceof e.SDKInstanceBase))throw Error("sdk type must derive from SDKInstanceBase");for(let m=0,u=this._behaviorInstances.length;m<u;++m)this._behaviorInstances[m].PostCreate();this._objectType._GetUserScriptInstanceClass()&&this._InitUserScriptInterface()}GetSdkInstance(){return this._sdkInst}GetWorldInfo(){return this._worldInfo}GetRuntime(){return this._runtime}GetTimeScale(){return this._timeScale}GetActiveTimeScale(){const g= this._timeScale;return-1===g?this.GetRuntime().GetTimeScale():g}SetTimeScale(g){g=+g;if(0>g||!isFinite(g))g=0;this._timeScale=g}RestoreTimeScale(){this._timeScale=-1}Dispatcher(){this._dispatcher||(this._dispatcher=e.New(e.Event.Dispatcher));return this._dispatcher}Draw(g){this._sdkInst.Draw(g)}OnCreate(g){this._sdkInst.OnCreate(g)}_SetHasTilemap(){this._flags|=2}HasTilemap(){return 0!==(this._flags&2)}_MarkDestroyed(){this._flags|=1}IsDestroyed(){return 0!==(this._flags&1)}MustPreDraw(){return 0!== (this._flags&4)}SetMustMitigateZFighting(){this._flags|=32}MustMitigateZFighting(){return 0!==(this._flags&32)}_IsSolidEnabled(){return 0!==(this._flags&8)}_SetSolidEnabled(g){this._flags=g?this._flags|8:this._flags&-9}_IsJumpthruEnabled(){return 0!==(this._flags&16)}_SetJumpthruEnabled(g){this._flags=g?this._flags|16:this._flags&-17}SetFlag(g,k){g<<=16;this._flags=k?this._flags|g:this._flags&~g}GetFlag(g){return 0!==(this._flags&g<<16)}GetCurrentImageInfo(){return this._sdkInst.GetCurrentImageInfo()}GetCurrentSurfaceSize(){return this._sdkInst.GetCurrentSurfaceSize()}GetCurrentTexRect(){return this._sdkInst.GetCurrentTexRect()}GetCurrentTexQuad(){return this._sdkInst.GetCurrentTexQuad()}GetImagePoint(g){return this._sdkInst.GetImagePoint(g)}GetObjectClass(){return this._objectType}RendersToOwnZPlane(){return this._sdkInst.RendersToOwnZPlane()}BelongsToObjectClass(g){return g.IsFamily()? g.FamilyHasMember(this.GetObjectClass()):this.GetObjectClass()===g}VerifySupportsSceneGraph(){if(!this.GetPlugin().SupportsSceneGraph())throw Error("object does not support scene graph");}HasParent(){return null!==this.GetParent()}GetParent(){var g=this.GetWorldInfo();return g?(g=g.GetParent())?g.GetInstance():null:null}GetTopParent(){var g=this.GetWorldInfo();return g?(g=g.GetTopParent())?g.GetInstance():null:null}*parents(){const g=this.GetWorldInfo();if(g)for(const k of g.parents())yield k.GetInstance()}HasChildren(){const g= this.GetWorldInfo();return g?g.HasChildren():!1}GetChildren(){const g=this.GetWorldInfo();return g?g.GetChildren().map(k=>k.GetInstance()):[]}*children(){const g=this.GetWorldInfo();if(g)for(const k of g.children())yield k.GetInstance()}*allChildren(){const g=this.GetWorldInfo();if(g)for(const k of g.allChildren())yield k.GetInstance()}GetChildCount(){const g=this.GetWorldInfo();return g?g.GetChildCount():0}GetChildAt(g){const k=this.GetWorldInfo();return k?(g=k.GetChildAt(g))?g.GetInstance():null: null}AddChild(g,k){this.VerifySupportsSceneGraph();g.VerifySupportsSceneGraph();this.GetWorldInfo().AddChild(g.GetWorldInfo(),k||{})}RemoveChild(g){const k=this.GetWorldInfo();k&&k.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 k of g)if(g=this._runtime.GetInstanceByUID(k[2])){const m=k[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 k=this.siblings();if(null===k||0===k.length)return!1;for(const m of k)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 k of this.siblings())k.GetObjectClass().GetCurrentSol()._GetOwnInstances()[g]= k}_PushSiblingsToSolElseInstances(){for(const g of this.siblings())g.GetObjectClass().GetCurrentSol()._PushElseInstance(g)}_SetSiblingsToSolElseInstancesIndex(g){for(const k of this.siblings())k.GetObjectClass().GetCurrentSol()._GetOwnElseInstances()[g]=k}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 k of this._behaviorInstances)if(k.GetBehavior()instanceof g)return k;return null}GetBehaviorSdkInstanceFromCtor(g){return g?(g=this.GetBehaviorInstanceFromCtor(g))?g.GetSdkInstance():null:null}GetBehaviorIndexBySID(g){const k=this._behaviorInstances;for(let m=0,u=k.length;m<u;++m)if(k[m].GetBehaviorType().GetSID()===g)return m;return-1}GetAllInstanceVariableValues(){return this._instVarValues}_GetAllInstanceVariableNames(){return this._objectType._GetAllInstanceVariableNames()}GetInstanceVariableCount(){return this._instVarValues.length}GetInstanceVariableValue(g){g|= 0;const k=this._instVarValues;if(0>g||g>=k.length)throw new RangeError("invalid instance variable");return k[g]}_GetInstanceVariableValueUnchecked(g){return this._instVarValues[g]}_GetInstanceVariableTypedValue(g){const k=this._instVarValues[g];return 0===this._objectType.GetInstanceVariableType(g)?!!k:k}SetInstanceVariableValue(g,k){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]= k?1:0;break;case 1:m[g]="number"===typeof k?k:parseFloat(k);break;case 2:m[g]="string"===typeof k?k:k.toString();break;default:throw Error("unknown instance variable type");}}SetInstanceVariableOffset(g,k){if(0!==k){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 k?m[g]+k:m[g]+parseFloat(k);else{if("boolean"===typeof u)throw Error("can not set offset of boolean variable");if("string"===typeof u)throw Error("can not set offset of string variable"); throw Error("unknown instance variable type");}}}GetSavedDataMap(){let g=f.get(this);if(g)return g;g=new Map;f.set(this,g);return g}GetUnsavedDataMap(){let g=l.get(this);if(g)return g;g=new Map;l.set(this,g);return g}_HasAnyCreateDestroyHandler(g){const k=this.GetObjectClass();if(k.UserScriptDispatcher().HasAnyHandlerFor(g))return!0;for(const m of k.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 k=this.GetWorldInfo();if(k&&k.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(),k=new e.Event("instancecreate");k.instance=this.GetInterfaceClass();g.DispatchUserScriptEvent(k);for(const m of g.GetFamilies())m.DispatchUserScriptEvent(k); this._runtime.DispatchUserScriptEvent(k)}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 k=new e.Event("destroy");k.isEndingLayout=g;this.DispatchUserScriptEvent(k)}if(this._HasAnyCreateDestroyHandler("instancedestroy")){k=this.GetObjectClass();var m=new e.Event("instancedestroy");m.instance=this.GetInterfaceClass(); m.isEndingLayout=g;k.DispatchUserScriptEvent(m);for(const u of k.GetFamilies())u.DispatchUserScriptEvent(m);this._runtime.DispatchUserScriptEvent(m)}}_GetDebuggerProperties(){return this._sdkInst.GetDebuggerProperties()}SaveToJson(g="full"){const k={};"full"===g?k.uid=this.GetUID():k.c3=!0;if("visual-state"!==g){var m=f.get(this);m&&m.size&&(k.ex=e.ToSuperJSON(m));-1!==this.GetTimeScale()&&(k.mts=this.GetTimeScale());if(0<this._objectType.GetInstanceVariablesCount()){m={};var u=this._objectType.GetInstanceVariableSIDs(); for(let x=0,n=this._instVarValues.length;x<n;++x)m[u[x].toString()]=this._instVarValues[x];k.ivs=m}if(this._behaviorInstances.length){m={};for(const x of this._behaviorInstances)(u=x.SaveToJson())&&(m[x.GetBehaviorType().GetSID().toString()]=u);k.behs=m}}this._worldInfo&&(k.w=this._worldInfo._SaveToJson(g));(g=this._sdkInst.SaveToJson())&&(k.data=g);return k}_OnBeforeLoad(g="full"){this._worldInfo&&this._worldInfo._OnBeforeLoad(g)}LoadFromJson(g,k="full"){if("full"===k)this._uid=g.uid;else if(!g.c3)return; if("visual-state"!==k){var m=f.get(this);m&&(m.clear(),f.delete(this));if(m=g.ex)m=e.FromSuperJSON(m),f.set(this,m);this._timeScale=g.hasOwnProperty("mts")?g.mts:-1;if(m=g.ivs)for(const [n,q]of Object.entries(m))if(m=parseInt(n,10),m=this._objectType.GetInstanceVariableIndexBySID(m),!(0>m||m>=this._instVarValues.length)){var u=q;null===u&&(u=NaN);this._instVarValues[m]=u}}if(this.GetPlugin().IsWorldType()){m=g.w;var x=m.l;this._worldInfo.GetLayer().GetSID()!==x&&(u=this._worldInfo.GetLayer(),(x=u.GetLayout().GetLayerBySID(x))? (this._worldInfo._SetLayer(x),u._RemoveInstance(this,!0),x._AddInstance(this,!0),x.SetZIndicesChanged(),this._worldInfo.SetBboxChanged()):"full"===k&&this._runtime.DestroyInstance(this));this._worldInfo._LoadFromJson(m,k)}if("visual-state"!==k&&(k=g.behs))for(const [n,q]of Object.entries(k))k=parseInt(n,10),k=this.GetBehaviorIndexBySID(k),0>k||k>=this._behaviorInstances.length||this._behaviorInstances[k].LoadFromJson(q);(g=g.data)&&this._sdkInst.LoadFromJson(g)}GetInterfaceClass(){return this._iScriptInterface|| this._InitUserScriptInterface()}_InitUserScriptInterface(){var g=this._worldInfo?self.IWorldInstance:a;const k=this._sdkInst.GetScriptInterfaceClass(),m=this._objectType._GetUserScriptInstanceClass(),u=m||k||g;a._Init(this);this._iScriptInterface=new u;a._Init(null);if(k&&!(this._iScriptInterface instanceof g))throw new TypeError(`script interface class '${k.name}' does not extend the right base class '${g.name}'`);if(m&&(g=k||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 k={},m=this._objectType._GetAllInstanceVariableJsPropNames();for(let u=0,x=m.length;u<x;++u)k[m[u]]={configurable:!1,enumerable:!0,get:e.Instance.prototype._GetInstanceVariableTypedValue.bind(this,u),set:e.Instance.prototype.SetInstanceVariableValue.bind(this,u)};k=Object.create(Object.prototype,k);g.instVars={value:k,writable:!1}}}_GetBehaviorsScriptDescriptor(g){var k=this._behaviorInstances;if(0!== k.length){var m={};for(const u of k)m[u.GetBehaviorType().GetJsPropName()]={value:u.GetScriptInterface(),writable:!1};k=Object.create(Object.prototype,m);g.behaviors={value:k,writable:!1}}}DispatchUserScriptEvent(g){g.instance=this.GetInterfaceClass();var k=this._runtime;(k=k.IsDebug()&&!k.GetEventSheetManager().IsInEventEngine())&&b.StartMeasuringScriptTime();this.GetInterfaceClass().dispatchEvent(g);k&&b.AddScriptTime()}}} {"use strict";const e=self.C3;e.SceneGraphInfo=class extends e.DefendedBase{constructor(b){super();this._owner=b;this._parent=null;this._children=[];this._startWidth=b.GetWidth();this._startHeight=b.GetHeight();this._startScaleY=this._startScaleX=1;this._parentStartAngle=0}Release(){this._parent=null;e.clearArray(this._children)}SetParent(b){this._parentStartAngle=(this._parent=b)?b.GetAngle():0}GetParent(){return this._parent}HasChildren(){return 0<this._children.length}GetChildren(){return this._children}GetStartScaleX(){return this._startScaleX}SetStartScaleX(b){this._startScaleX= b}GetStartScaleY(){return this._startScaleY}SetStartScaleY(b){this._startScaleY=b}_GetStartWidth(){return this._startWidth}_GetStartHeight(){return this._startHeight}GetParentScaleX(){return this._owner.GetTransformWithParentWidth()?this._parent.GetWidth()/this._parent._GetSceneGraphInfo()._GetStartWidth():1}GetParentScaleY(){return this._owner.GetTransformWithParentHeight()?this._parent.GetHeight()/this._parent._GetSceneGraphInfo()._GetStartHeight():1}GetParentStartAngle(){return this._parentStartAngle}_SaveToJson(){return{sw:this._startWidth, sh:this._startHeight,sx:this._startScaleX,sy:this._startScaleY,psa:this._parentStartAngle,c:this._children.map(b=>{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,d=a.GetRuntime();for(const c of b.c){b=d.GetInstanceByUID(c.uid).GetWorldInfo();const f=c.f,l={};l.transformX=f.includes("x");l.transformY=f.includes("y");l.transformWidth=f.includes("w");l.transformHeight=f.includes("h");l.transformAngle=f.includes("a");l.transformZElevation=f.includes("z");l.destroyWithParent=f.includes("d");a.AddChild(b,l)}}}} {"use strict";const e=self.C3,b=e.New(e.Rect),a=e.New(e.Quad),d=e.New(e.Event,"bboxchange",!1),c=e.New(e.Color,0,0,0,0),f=e.New(e.CollisionPoly),l=e.New(e.Color,1,1,1,1),g=e.New(e.Rect,0,0,-1,-1),k=e.New(e.Rect,0,0,-1,-1),m=new Set(["absolute","relative"]),u=[];let x=!0;e.WorldInfo=class extends e.DefendedBase{constructor(n,q){super();this._inst=n;this._objectClass=n.GetObjectClass();this._runtime=n.GetRuntime();this._layer=q;this._zIndex=-1;this._flags=196635;this._objectClass.GetPlugin().IsRotatable()&& (this._flags|=128);this._oy=this._ox=this._cosA=this._sinA=this._a=this._depth=this._h=this._w=this._zElevation=this._y=this._x=NaN;this._boundingBox=e.New(e.Rect);this._boundingQuad=e.New(e.Quad);this._collisionCells=k;this._renderCells=g;this._solidFilterTags=this._transformedPolyInfo=this._sourceCollisionPoly=null;this._colorPremultiplied=this._color=l;this._instanceEffectList=this._stateGroup=null;this._inst.GetObjectClass().UsesEffects()&&(this._instanceEffectList=e.New(e.InstanceEffectList, this._inst,this));this._sceneGraphInfo=null;this._sceneGraphFlagsExportData=NaN;this._sceneGraphChildrenExportData=null;this._sceneGraphZIndex=this._sceneGraphZIndexExportData=NaN;this._meshInfo=null}_MarkDestroyed(){this._flags|=256}Release(){this._stateGroup&&(this._runtime.GetRenderer().ReleaseStateGroup(this._stateGroup),this._stateGroup=null);this._sourceCollisionPoly=null;this._transformedPolyInfo&&(this._transformedPolyInfo.poly.Release(),this._transformedPolyInfo=null);this._solidFilterTags&& (this._solidFilterTags.clear(),this._solidFilterTags=null);this.ReleaseMesh();this.HasParent()&&this.GetParent().RemoveChild(this);if(this.HasChildren()){const n=[...this.GetChildren()];for(const q of n)this.RemoveChild(q)}this._ReleaseSceneGraphInfo();this._layer=this._runtime=this._objectClass=this._inst=null}Init(n){x=!1;this.SetXY(n[0],n[1]);this.SetZElevation(n[2]);this.SetSize(n[3],n[4]);this._depth=0;this.IsRotatable()?this.SetAngle(n[6]):this._a=0;c.setFromJSON(n[7]);this._SetColor(c);this.SetOriginX(n[8]); this.SetOriginY(n[9]);this.SetBlendMode(n[10]);this._instanceEffectList&&this._instanceEffectList._LoadEffectParameters(n[12]);n[14]&&(this._sceneGraphFlagsExportData=n[14][0],this._sceneGraphChildrenExportData=n[14][1],this._sceneGraphZIndexExportData=n[14][2]);if(n[15]){var q=n[15];this.CreateMesh(q[0],q[1]);n=this.GetSourceMesh();q=q[2];for(let t=0,r=q.length;t<r;++t){const w=q[t];for(let y=0,C=w.length;y<C;++y){const D=w[y],G=n.GetMeshPointAt(y,t);G.SetX(D[0]);G.SetY(D[1]);G.SetZElevation(D[2]); G.SetU(D[3]);G.SetV(D[4])}}}x=!0;this._UpdateRendererStateGroup()}InitNoData(){this._sinA=this._a=this._depth=this._h=this._w=this._zElevation=this._y=this._x=0;this._cosA=1;this._oy=this._ox=0;this._UpdateRendererStateGroup()}GetRuntime(){return this._runtime}GetObjectClass(){return this._objectClass}GetInstance(){return this._inst}_GetParentOffsetAngle(){return this.GetTransformWithParentAngle()?this.GetParent().GetAngle()-this._sceneGraphInfo.GetParentStartAngle():0}SetX(n){n=+n;if(this.GetTransformWithParentX()){const q= this._sceneGraphInfo;n-=this.GetX();const t=-this._GetParentOffsetAngle();0===t?this._x+=n/q.GetParentScaleX():(this._x+=Math.cos(t)*n/q.GetParentScaleX(),this.GetTransformWithParentY()&&(this._y+=Math.sin(t)*n/q.GetParentScaleY()))}else this._x=n}OffsetX(n){n=+n;this.GetTransformWithParentX()?this.SetX(this.GetX()+n):this._x+=n}GetX(){if(this.GetTransformWithParentX()){let n=this._x;const q=this._sceneGraphInfo,t=this.GetParent(),r=this._GetParentOffsetAngle();0===r?n*=q.GetParentScaleX():(n=n*q.GetParentScaleX()* Math.cos(r),this.GetTransformWithParentY()&&(n-=this._y*q.GetParentScaleY()*Math.sin(r)));return t.GetX()+n}return this._x}SetY(n){n=+n;if(this.GetTransformWithParentY()){const q=this._sceneGraphInfo;n-=this.GetY();const t=-this._GetParentOffsetAngle();0===t?this._y+=n/q.GetParentScaleY():(this.GetTransformWithParentX()&&(this._x-=Math.sin(t)*n/q.GetParentScaleX()),this._y+=Math.cos(t)*n/q.GetParentScaleY())}else this._y=n}OffsetY(n){n=+n;this.GetTransformWithParentY()?this.SetY(this.GetY()+n):this._y+= n}GetY(){if(this.GetTransformWithParentY()){let n=this._y;const q=this._sceneGraphInfo,t=this.GetParent(),r=this._GetParentOffsetAngle();0===r?n*=q.GetParentScaleY():(n=n*q.GetParentScaleY()*Math.cos(r),this.GetTransformWithParentX()&&(n+=this._x*q.GetParentScaleX()*Math.sin(r)));return t.GetY()+n}return this._y}SetXY(n,q){n=+n;q=+q;if(this.GetTransformWithParentXOrY()){const r=this.GetTransformWithParentX(),w=this.GetTransformWithParentY(),y=this._sceneGraphInfo,C=n-this.GetX(),D=q-this.GetY();var t= -this._GetParentOffsetAngle();if(0===t)this._x=r?this._x+C/y.GetParentScaleX():n,this._y=w?this._y+D/y.GetParentScaleY():q;else{const G=Math.sin(t);t=Math.cos(t);this._x=r?w?this._x+(t*C-G*D)/y.GetParentScaleX():this._x+t*C/y.GetParentScaleX():n;this._y=w?r?this._y+(G*C+t*D)/y.GetParentScaleY():this._y+t*D/y.GetParentScaleY():q}}else this._x=n,this._y=q}OffsetXY(n,q){n=+n;q=+q;this.GetTransformWithParentXOrY()?this.SetXY(this.GetX()+n,this.GetY()+q):(this._x+=n,this._y+=q)}EqualsXY(n,q){return this.GetX()=== n&&this.GetY()===q}SetZElevation(n){n=+n;this.GetTransformWithParentZElevation()&&(n-=this.GetParent().GetZElevation());this._zElevation!==n&&(this._zElevation=n,this._UpdateZElevation(),n=this.GetLayer(),0!==this._zElevation&&n._SetAnyInstanceZElevated(),n.SetZIndicesChanged())}_UpdateZElevation(){this._UpdateRendererStateGroup();if(this.HasChildren()){const n=this.GetChildren();for(let q=0,t=n.length;q<t;q++){const r=n[q];r.GetTransformWithParentZElevation()&&r._UpdateZElevation()}}}OffsetZElevation(n){this.SetZElevation(this.GetZElevation()+ n)}GetZElevation(){return this.GetTransformWithParentZElevation()?this.GetParent().GetZElevation()+this._zElevation:this._zElevation}GetTotalZElevation(){return this.GetLayer().GetZElevation()+this.GetZElevation()}SetWidth(n){n=+n;this.GetTransformWithParentWidth()?this._w*=n/this.GetWidth():this._w=n}OffsetWidth(n){n=+n;this.GetTransformWithParentWidth()?this.SetWidth(this.GetWidth()+n):this._w+=n}GetWidth(){return this.GetTransformWithParentWidth()?this.GetParent().GetWidth()*this._w:this._w}SetHeight(n){n= +n;this.GetTransformWithParentHeight()?this._h*=n/this.GetHeight():this._h=n}OffsetHeight(n){n=+n;this.GetTransformWithParentHeight()?this.SetHeight(this.GetHeight()+n):this._h+=n}GetHeight(){return this.GetTransformWithParentHeight()?this.GetParent().GetHeight()*this._h:this._h}SetSize(n,q){n=+n;q=+q;this.GetTransformWithParentWidth()?this._w*=n/this.GetWidth():this._w=n;this.GetTransformWithParentHeight()?this._h*=q/this.GetHeight():this._h=q}GetDepth(){return this._depth}SetDepth(n){if(0>n)throw new RangeError("invalid depth"); this._depth=n}GetSceneGraphScale(){if(this.HasParent()){const n=this._sceneGraphInfo;return Math.min(n.GetParentScaleX(),n.GetParentScaleY())}return 1}IsRotatable(){return 0!==(this._flags&128)}SetAngle(n){n=+n;this.IsRotatable()&&(this.GetTransformWithParentAngle()&&(n-=this.GetParent().GetAngle()),n=e.clampAngle(n),this._a!==n&&(this._a=n,this._MarkSinCosAngleChanged()))}OffsetAngle(n){n=+n;0!==n&&this.IsRotatable()&&(this._a=e.clampAngle(this._a+n),this._MarkSinCosAngleChanged())}_MarkSinCosAngleChanged(){this._flags|= 262144;if(this.HasChildren()){const n=this.GetChildren();for(let q=0,t=n.length;q<t;q++)n[q]._MarkSinCosAngleChanged()}}GetAngle(){return this.GetTransformWithParentAngle()?e.clampAngle(this.GetParent().GetAngle()+this._a):this._a}_MaybeUpdateSinCosAngle(){const n=this._flags;if(0!==(n&262144)){var q=this.GetAngle();this._sinA=Math.sin(q);this._cosA=Math.cos(q);this._flags=n&-262145}}GetSinAngle(){this._MaybeUpdateSinCosAngle();return this._sinA}GetCosAngle(){this._MaybeUpdateSinCosAngle();return this._cosA}SetOriginX(n){this._ox= +n}OffsetOriginX(n){this._ox+=+n}GetOriginX(){return this._ox}SetOriginY(n){this._oy=+n}OffsetOriginY(n){this._oy+=+n}GetOriginY(){return this._oy}_SetColor(n){this._color.equals(n)||(this._color===l?(this._color=e.New(e.Color,n),this._colorPremultiplied=e.New(e.Color,n),this._colorPremultiplied.premultiply()):n.equalsRgba(1,1,1,1)?this._colorPremultiplied=this._color=l:(this._color.set(n),this._colorPremultiplied.set(n),this._colorPremultiplied.premultiply()),this._UpdateRendererStateGroup())}SetOpacity(n){n= e.clamp(+n,0,1);this._color.a!==n&&(c.copyRgb(this._color),c.a=n,this._SetColor(c))}OffsetOpacity(n){this.SetOpacity(this.GetOpacity()+n)}GetOpacity(){return this._color.a}SetUnpremultipliedColor(n){this._color.equalsIgnoringAlpha(n)||(c.copyRgb(n),c.a=this._color.a,this._SetColor(c))}SetUnpremultipliedColorRGB(n,q,t){c.setRgb(n,q,t);this.SetUnpremultipliedColor(c)}OffsetUnpremultipliedColorRGB(n,q,t){if(0!==n||0!==q||0!==t)c.copyRgb(this._color),c.r+=n,c.g+=q,c.b+=t,this.SetUnpremultipliedColor(c)}GetUnpremultipliedColor(){return this._color}GetPremultipliedColor(){return this._colorPremultiplied}GetDestroyWithParent(){return 0!== (this._flags&512)}SetDestroyWithParent(n){this._SetFlag(512,n)}GetTransformWithParentX(){return 0!==(this._flags&1024)}SetTransformWithParentX(n){this._SetFlag(1024,n)}GetTransformWithParentY(){return 0!==(this._flags&2048)}GetTransformWithParentXOrY(){return 0!==(this._flags&3072)}SetTransformWithParentY(n){this._SetFlag(2048,n)}GetTransformWithParentWidth(){return 0!==(this._flags&4096)}SetTransformWithParentWidth(n){this._SetFlag(4096,n)}GetTransformWithParentHeight(){return 0!==(this._flags&8192)}SetTransformWithParentHeight(n){this._SetFlag(8192, n)}GetTransformWithParentAngle(){return 0!==(this._flags&16384)}SetTransformWithParentAngle(n){this._SetFlag(16384,n)}GetTransformWithParentZElevation(){return 0!==(this._flags&32768)}SetTransformWithParentZElevation(n){this._SetFlag(32768,n)}_ClearAllSceneGraphFlags(){this._flags&=-65025}AddChild(n,q){if(n!==this&&!n.HasParent()&&!this._HasChildRecursive(n)&&!this._HasAnyParent(n)){var t=n.GetX(),r=n.GetY(),w=n.GetWidth(),y=n.GetHeight(),C=n.GetAngle(),D=n.GetZElevation();n._SetParent(this);n.SetTransformWithParentX(q.transformX); n.SetTransformWithParentY(q.transformY);n.SetTransformWithParentWidth(q.transformWidth);n.SetTransformWithParentHeight(q.transformHeight);n.SetTransformWithParentAngle(q.transformAngle);n.SetTransformWithParentZElevation(q.transformZElevation);n.SetDestroyWithParent(q.destroyWithParent);q.transformX&&(n._x=t-this.GetX(),q.transformWidth&&(n._x/=this.GetWidth()/this._sceneGraphInfo._GetStartWidth()));q.transformY&&(n._y=r-this.GetY(),q.transformHeight&&(n._y/=this.GetHeight()/this._sceneGraphInfo._GetStartHeight())); q.transformWidth&&(n._w=w/this.GetWidth(),n._sceneGraphInfo.SetStartScaleX(n._w));q.transformHeight&&(n._h=y/this.GetHeight(),n._sceneGraphInfo.SetStartScaleY(n._h));q.transformAngle&&(n._a=C-this.GetAngle());q.transformZElevation&&(n._zElevation=D-this.GetZElevation());this._AddChildToSceneGraphInfo(n);this.SetBboxChanged()}}RemoveChild(n){if(n.GetParent()===this){var q=n.GetX(),t=n.GetY(),r=n.GetWidth(),w=n.GetHeight(),y=n.GetAngle(),C=n.GetZElevation();n._SetParent(null);n._ClearAllSceneGraphFlags(); n.SetXY(q,t);n.SetSize(r,w);n.SetAngle(y);n.SetZElevation(C);this._RemoveChildFromSceneGraphInfo(n);this.SetBboxChanged()}}_ResetAllSceneGraphState(){for(var n of this.children())this.RemoveChild(n);(n=this.GetParent())&&n.RemoveChild(this);this._ClearAllSceneGraphFlags()}HasParent(){return null!==this.GetParent()}GetParent(){const n=this._sceneGraphInfo;return null!==n?n.GetParent():null}GetTopParent(){let n=this;for(;n.HasParent();)n=n.GetParent();return n}*parents(){let n=this.GetParent();for(;n;)yield n, n=n.GetParent()}HasChild(n){return this.GetChildren().includes(n)}HasChildren(){const n=this._sceneGraphInfo;return null!==n?n.HasChildren():!1}GetChildren(){const n=this._sceneGraphInfo;return null!==n?n.GetChildren():u}children(){return this.GetChildren()}*allChildren(){for(const n of this.children())yield n,yield*n.allChildren()}GetChildCount(){return this.GetChildren().length}GetChildAt(n){const q=this.GetChildren();n=Math.floor(+n);return 0>n||n>=q.length?null:q[n]}_CreateSceneGraphInfo(n){this._sceneGraphInfo|| (this._sceneGraphInfo=e.New(e.SceneGraphInfo,this));n&&this._sceneGraphInfo.SetParent(n)}_GetSceneGraphInfo(){return this._sceneGraphInfo}_ReleaseSceneGraphInfo(){this._sceneGraphInfo&&(this._sceneGraphInfo.Release(),this._sceneGraphInfo=null)}_SetParent(n){n?(n._CreateSceneGraphInfo(null),this._CreateSceneGraphInfo(n)):(this._sceneGraphInfo&&this._sceneGraphInfo.SetParent(null),this.HasChildren()||this._ReleaseSceneGraphInfo())}_HasAnyParent(n){if(!this.HasParent())return!1;const q=this.GetParent(); return q===n?!0:q._HasAnyParent(n)}_HasChildRecursive(n){if(this.HasChild(n))return!0;for(const q of this.GetChildren())if(q._HasChildRecursive(n))return!0;return!1}_AddChildToSceneGraphInfo(n){this._sceneGraphInfo.GetChildren().push(n)}_RemoveChildFromSceneGraphInfo(n){const q=this._sceneGraphInfo.GetChildren(),t=q.indexOf(n);-1!==t&&q.splice(t,1);0!==q.length||this.HasParent()||this._ReleaseSceneGraphInfo();n.HasChildren()||n._ReleaseSceneGraphInfo()}GetSceneGraphChildrenExportData(){return this._sceneGraphChildrenExportData}GetSceneGraphZIndexExportData(){return this._sceneGraphZIndexExportData}GetSceneGraphZIndex(){return this._sceneGraphZIndex}SetSceneGraphZIndex(n){this._sceneGraphZIndex= n}SetUsePointsShaderProgram(){this._SetFlag(524288,!0);this._UpdateRendererStateGroup()}_UpdateRendererStateGroup(){if(x){var n=this._runtime.GetRenderer();this._stateGroup&&n.ReleaseStateGroup(this._stateGroup);var q=0!==(this._flags&524288)?n.GetPointsRenderingProgram()||"<point>":n.GetTextureFillShaderProgram()||"<default>";this._stateGroup=n.AcquireStateGroup(q,this.GetBlendMode(),this._colorPremultiplied,this.GetZElevation())}}GetRendererStateGroup(){return this._stateGroup}HasDefaultColor(){return this._color=== l}SetBlendMode(n){n|=0;if(0>n||31<n)throw new RangeError("invalid blend mode");this.GetBlendMode()!==n&&(this._flags=this._flags&-2080374785|n<<26,this._UpdateRendererStateGroup())}GetBlendMode(){return(this._flags&2080374784)>>26}_SetLayer(n){this._layer=n;0!==this.GetZElevation()&&this._layer._SetAnyInstanceZElevated()}GetLayer(){return this._layer}GetLayout(){return this.GetLayer().GetLayout()}_SetZIndex(n){this._zIndex=n|0}GetZIndex(){this._layer._UpdateZIndices();return this._zIndex}_GetLastCachedZIndex(){return this._zIndex}_SetFlag(n, q){this._flags=q?this._flags|n:this._flags&~n}IsVisible(){return 0!==(this._flags&1)}SetVisible(n){this._SetFlag(1,n)}IsCollisionEnabled(){return 0!==(this._flags&8)}SetCollisionEnabled(n){n=!!n;this.IsCollisionEnabled()!==n&&(this._SetFlag(8,n),n?this.SetBboxChanged():this._RemoveFromCollisionCells())}SetSolidCollisionFilter(n,q){this._SetFlag(32,n);this._solidFilterTags&&this._solidFilterTags.clear();if(q.trim()){this._solidFilterTags||(this._solidFilterTags=new Set);for(const t of q.split(" "))t&& this._solidFilterTags.add(t.toLowerCase())}else this._solidFilterTags=null}IsSolidCollisionAllowed(n){const q=0!==(this._flags&32),t=this._solidFilterTags;if(!n||!t)return!q;for(const r of t)if(n.has(r))return q;return!q}SetBboxChanged(){this._flags|=65554;this._objectClass._SetAnyCollisionCellChanged(!0);this._runtime.UpdateRender();this._layer.UsesRenderCells()&&(this.CalculateBbox(this._boundingBox,this._boundingQuad,!0),this._flags&=-3,this._UpdateRenderCell());0!==(this._flags&4)&&this._inst.Dispatcher().dispatchEvent(d); if(null!==this._sceneGraphInfo){const n=this._sceneGraphInfo.GetChildren();for(let q=0,t=n.length;q<t;++q)n[q].SetBboxChanged()}}CalculateBbox(n,q,t){const r=this.GetX(),w=this.GetY(),y=this.GetWidth(),C=this.GetHeight(),D=this.GetAngle();n.setWH(r-this._ox*y,w-this._oy*C,y,C);t&&this.HasMesh()&&this._ExpandBboxForMesh(n);0===D?q.setFromRect(n):(n.offset(-r,-w),q.setFromRotatedRectPrecalc(n,this.GetSinAngle(),this.GetCosAngle()),q.offset(r,w),q.getBoundingBox(n));n.normalize()}_UpdateBbox(){const n= this._flags;0!==(n&2)&&(this.CalculateBbox(this._boundingBox,this._boundingQuad,!0),this._flags=n&-3)}GetBoundingBox(){this._UpdateBbox();return this._boundingBox}GetBoundingQuad(){this._UpdateBbox();return this._boundingQuad}PixelRoundQuad(n){var q=this.GetX(),t=this.GetY();q=Math.round(q)-q;t=Math.round(t)-t;if(0===q&&0===t)return n;a.copy(n);a.offset(q,t);return a}OverwriteBoundingBox(n){this._boundingBox.copy(n);this._boundingQuad.setFromRect(this._boundingBox);this._flags&=-3;this._UpdateCollisionCell(); this._UpdateRenderCell()}SetBboxChangeEventEnabled(n){this._SetFlag(4,n)}IsBboxChangeEventEnabled(){return 0!==(this._flags&4)}IsInViewport(n,q,t){return q&&0!==this.GetDepth()?this.IsInViewport3D(this.GetLayer()._GetViewFrustum()):0===this.GetZElevation()||t?n.intersectsRect(this.GetBoundingBox()):this._IsInViewport_ZElevated()}_IsInViewport_ZElevated(){const n=this.GetLayer(),q=this.GetTotalZElevation();if(q>=n.GetCameraZ())return!1;n.GetViewportForZ(q,b);return b.intersectsRect(this.GetBoundingBox())}IsInViewport3D(n){var q= this.GetBoundingBox();const t=q.getLeft(),r=q.getRight(),w=q.getTop();q=q.getBottom();const y=this.GetTotalZElevation(),C=y+this.GetDepth();return n.ContainsAABB(t,w,y,r,q,C)}_SetDrawBackFaceOnly(n){this._SetFlag(1048576,n)}_SetDrawNonBackFacesOnly(n){this._SetFlag(2097152,n)}IsDrawBackFaceOnly(){return 0!==(this._flags&1048576)}IsDrawNonBackFacesOnly(){return 0!==(this._flags&2097152)}SetSourceCollisionPoly(n){this._sourceCollisionPoly=n;this._DiscardTransformedCollisionPoly();this.HasMesh()&&(this._meshInfo.meshPoly= null)}GetSourceCollisionPoly(){return this._sourceCollisionPoly}HasOwnCollisionPoly(){return null!==this._sourceCollisionPoly||this.HasMesh()}GetTransformedCollisionPoly(){return this._GetCustomTransformedCollisionPolyPrecalc(this.GetWidth(),this.GetHeight(),this.GetAngle(),this.GetSinAngle(),this.GetCosAngle())}GetCustomTransformedCollisionPoly(n,q,t){let r=0,w=1;0!==t&&(r=Math.sin(t),w=Math.cos(t));return this._GetCustomTransformedCollisionPolyPrecalc(n,q,t,r,w)}_GetCustomTransformedCollisionPolyPrecalc(n, q,t,r,w){let y=this._transformedPolyInfo;null===y&&(this._transformedPolyInfo=y={poly:e.New(e.CollisionPoly),width:NaN,height:NaN,angle:NaN});const C=y.poly;if(y.width===n&&y.height===q&&y.angle===t)return C;const D=this._sourceCollisionPoly;if(this.HasMesh()){const G=this.GetOriginX(),K=this.GetOriginY(),B=this.GetSourceMesh();let A=this._meshInfo.meshPoly;A||(D?(f.copy(D),f.offset(G,K)):f.setDefaultPoints(),A=B.InsertPolyMeshVertices(f),this._meshInfo.meshPoly=A);B.TransformCollisionPoly(A,C);C.offset(-G, -K);C.transformPrecalc(n,q,r,w)}else D?(C.copy(D),C.transformPrecalc(n,q,r,w)):C.setFromQuad(this.GetBoundingQuad(),-this.GetX(),-this.GetY());y.width=n;y.height=q;y.angle=t;return C}_DiscardTransformedCollisionPoly(){this.SetPhysicsBodyChanged(!0);const n=this._transformedPolyInfo;null!==n&&(n.width=NaN)}CreateMesh(n,q){n=Math.floor(n);q=Math.floor(q);if(!this.GetInstance().GetPlugin().SupportsMesh())throw Error("object does not support mesh");this.ReleaseMesh();this._meshInfo={sourceMesh:e.New(e.Gfx.Mesh, n,q),transformedMesh:e.New(e.Gfx.Mesh,n,q),meshPoly:null}}HasMesh(){return null!==this._meshInfo}GetSourceMesh(){if(!this.HasMesh())throw Error("no mesh");return this._meshInfo.sourceMesh}GetTransformedMesh(){if(!this.HasMesh())throw Error("no mesh");return this._meshInfo.transformedMesh}SetMeshChanged(n){this._SetFlag(65536,n)}IsMeshChanged(){return 0!==(this._flags&65536)}SetPhysicsBodyChanged(n){this._SetFlag(131072,n)}IsPhysicsBodyChanged(){return 0!==(this._flags&131072)}_ExpandBboxForMesh(n){const q= this._meshInfo.sourceMesh,t=Math.min(q.GetMinX(),0),r=Math.min(q.GetMinY(),0),w=Math.max(q.GetMaxX(),1),y=Math.max(q.GetMaxY(),1),C=n.width(),D=n.height();n.offsetLeft(t*C);n.offsetTop(r*D);n.offsetRight((w-1)*C);n.offsetBottom((y-1)*D);this._depth=q.GetMaxZ()}ReleaseMesh(){this._meshInfo&&(this._meshInfo.sourceMesh.Release(),this._meshInfo.transformedMesh.Release(),this._meshInfo=null,this._DiscardTransformedCollisionPoly())}SetMeshPoint(n,q,t){n=Math.floor(n);q=Math.floor(q);var r=t.mode||"absolute"; if(!m.has(r))throw Error("invalid mode");r="relative"===r;let w=t.x,y=t.y;const C=t.zElevation;let D="number"===typeof t.u?t.u:r?0:-1;t="number"===typeof t.v?t.v:r?0:-1;if(!this.HasMesh())return!1;const G=this.GetSourceMesh(),K=G.GetMeshPointAt(n,q);if(null===K)return!1;let B=!1;"number"===typeof C&&K.GetZElevation()!==C&&(K.SetZElevation(C),B=!0);r&&(w+=n/(G.GetHSize()-1),y+=q/(G.GetVSize()-1));-1!==D||r?(r&&(D+=n/(G.GetHSize()-1)),D=e.clamp(D,0,1)):D=K.GetU();-1!==t||r?(r&&(t+=q/(G.GetVSize()-1)), t=e.clamp(t,0,1)):t=K.GetV();if(K.GetX()===w&&K.GetY()===y&&K.GetU()===D&&K.GetV()===t)return B;K.SetX(w);K.SetY(y);K.SetU(D);K.SetV(t);this._DiscardTransformedCollisionPoly();return!0}HasTilemap(){return this._inst.HasTilemap()}ContainsPoint(n,q){return this.GetBoundingBox().containsPoint(n,q)&&this.GetBoundingQuad().containsPoint(n,q)?this.HasTilemap()?this._inst.GetSdkInstance().TestPointOverlapTile(n,q):this.HasOwnCollisionPoly()?this.GetTransformedCollisionPoly().containsPoint(n-this.GetX(), q-this.GetY()):!0:!1}_IsCollisionCellChanged(){return 0!==(this._flags&16)}_UpdateCollisionCell(){if(this._IsCollisionCellChanged()&&this.IsCollisionEnabled()&&0===(this._flags&256)){var n=this.GetBoundingBox(),q=this._objectClass._GetCollisionCellGrid(),t=this._collisionCells;b.set(q.XToCell(n.getLeft()),q.YToCell(n.getTop()),q.XToCell(n.getRight()),q.YToCell(n.getBottom()));t.equals(b)||(n=this._inst,t===k?(q.Update(n,null,b),this._collisionCells=e.New(e.Rect,b)):(q.Update(n,t,b),t.copy(b)),this._flags&= -17)}}_RemoveFromCollisionCells(){const n=this._collisionCells;n!==k&&(this._objectClass._GetCollisionCellGrid().Update(this._inst,n,null),this._collisionCells=k)}_UpdateRenderCell(){const n=this.GetLayer();if(n.UsesRenderCells()&&0===(this._flags&256)){var q=n.GetRenderGrid(),t=this.GetBoundingBox(),r=this._renderCells;b.set(q.XToCell(t.getLeft()),q.YToCell(t.getTop()),q.XToCell(t.getRight()),q.YToCell(t.getBottom()));r.equals(b)||(t=this._inst,r===g?(q.Update(t,null,b),this._renderCells=e.New(e.Rect, b)):(q.Update(t,r,b),r.copy(b)),n.SetRenderListStale())}}_RemoveFromRenderCells(){const n=this._renderCells;n!==g&&(this.GetLayer().GetRenderGrid().Update(this._inst,n,null),this._renderCells=g)}GetRenderCellRange(){return this._renderCells}ZOrderMoveToTop(){const n=this._inst,q=this._layer,t=q._GetInstances();t.length&&t.at(-1)===n||(q._RemoveInstance(n,!1),q._AddInstance(n,!1),this._runtime.UpdateRender())}ZOrderMoveToBottom(){const n=this._inst,q=this._layer,t=q._GetInstances();t.length&&t[0]=== n||(q._RemoveInstance(n,!1),q._PrependInstance(n,!1),this._runtime.UpdateRender())}ZOrderMoveToLayer(n){const q=this._inst,t=this._layer;if(t.GetLayout()!==n.GetLayout())throw Error("layer from different layout");n!==t&&(t._RemoveInstance(q,!0),this._SetLayer(n),n._AddInstance(q,!0),this._runtime.UpdateRender())}ZOrderMoveAdjacentToInstance(n,q){const t=this._inst;let r=!1;const w=this._layer;if(n.GetUID()!==t.GetUID()){var y=n.GetWorldInfo();if(!y)throw Error("expected world instance");y=y.GetLayer(); w.GetIndex()!==y.GetIndex()&&(w._RemoveInstance(t,!0),this._SetLayer(y),y._AddInstance(t,!0),r=!0);n=y.MoveInstanceAdjacent(t,n,!!q);(r||n)&&this._runtime.UpdateRender()}}GetInstanceEffectList(){return this._instanceEffectList}_SetHasAnyActiveEffect(n){this._SetFlag(64,n)}HasAnyActiveEffect(){return 0!==(this._flags&64)}_SaveToJson(n){const q={x:this.GetX(),y:this.GetY(),w:this.GetWidth(),h:this.GetHeight(),l:this.GetLayer().GetSID(),zi:this.GetZIndex()};0!==this.GetZElevation()&&(q.ze=this.GetZElevation()); 0!==this.GetAngle()&&(q.a=this.GetAngle());this.HasDefaultColor()||(q.c=this._color.toJSON());.5!==this.GetOriginX()&&(q.oX=this.GetOriginX());.5!==this.GetOriginY()&&(q.oY=this.GetOriginY());0!==this.GetBlendMode()&&(q.bm=this.GetBlendMode());this.IsVisible()||(q.v=this.IsVisible());this.IsCollisionEnabled()||(q.ce=this.IsCollisionEnabled());this.IsBboxChangeEventEnabled()&&(q.be=this.IsBboxChangeEventEnabled());this._instanceEffectList&&(q.fx=this._instanceEffectList._SaveToJson());const t=0!== (this._flags&32);t&&(q.sfi=t);this._solidFilterTags&&(q.sft=[...this._solidFilterTags].join(" "));this._sceneGraphInfo&&"visual-state"!==n&&(q.sgi=this._sceneGraphInfo._SaveToJson());this.HasMesh()&&(q.mesh=this.GetSourceMesh().SaveToJson());return q}_OnBeforeLoad(n){"visual-state"!==n&&this._ResetAllSceneGraphState()}_LoadFromJson(n,q){x=!1;this.SetX(n.x);this.SetY(n.y);this.SetWidth(n.w);this.SetHeight(n.h);this._SetZIndex(n.zi);this.SetZElevation(n.hasOwnProperty("ze")?n.ze:0);this.SetAngle(n.hasOwnProperty("a")? n.a:0);n.hasOwnProperty("c")?c.setFromJSON(n.c):n.hasOwnProperty("o")?(c.copyRgb(this._color),c.a=n.o):c.setRgba(1,1,1,1);this._SetColor(c);this.SetOriginX(n.hasOwnProperty("oX")?n.oX:.5);this.SetOriginY(n.hasOwnProperty("oY")?n.oY:.5);this.SetBlendMode(n.hasOwnProperty("bm")?n.bm:0);this.SetVisible(n.hasOwnProperty("v")?n.v:!0);this.SetCollisionEnabled(n.hasOwnProperty("ce")?n.ce:!0);this.SetBboxChangeEventEnabled(n.hasOwnProperty("be")?n.be:!1);this.SetSolidCollisionFilter(n.hasOwnProperty("sfi")? n.sfi:!1,n.hasOwnProperty("sft")?n.sft:"");this._instanceEffectList&&n.hasOwnProperty("fx")&&this._instanceEffectList._LoadFromJson(n.fx);if(n.hasOwnProperty("sgi")&&"visual-state"!==q){this._CreateSceneGraphInfo(null);const t=this._sceneGraphInfo,r=n.sgi;t._LoadFromJson(r);const w=this.GetRuntime().Dispatcher(),y=()=>{w.removeEventListener("afterload",y);0===(this._flags&256)&&t._OnAfterLoad(r)};w.addEventListener("afterload",y)}n.hasOwnProperty("mesh")?(n=n.mesh,this.CreateMesh(n.cols,n.rows),this.GetSourceMesh().LoadFromJson(n)): this.ReleaseMesh();this.SetBboxChanged();x=!0;this._UpdateRendererStateGroup()}}} {"use strict";const e=self.C3;e.BehaviorType=class extends e.DefendedBase{constructor(b,a){super();const d=b.GetRuntime(),c=d.GetPluginManager(),f=d.GetObjectReference(a[1]);c.HasBehaviorByConstructorFunction(f)||c.CreateBehavior(a);this._runtime=d;this._objectClass=b;this._behavior=c.GetBehaviorByConstructorFunction(f);this._sdkType=null;this._instSdkCtor=f.Instance;this._sid=a[2];this._name=a[0];this._jsPropName=this._runtime.GetJsPropName(a[3]);this._sdkType=e.New(f.Type,this);this.OnCreate()}static Create(b, a){return e.New(e.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 e=self.C3,b=self.IBehaviorInstance;e.BehaviorInstance=class extends e.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=e.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, d){this._sdkInst.OnSpriteFrameChanged(a,d)}_GetDebuggerProperties(){return this._sdkInst.GetDebuggerProperties()}SaveToJson(){return this._sdkInst.SaveToJson()}LoadFromJson(a){return this._sdkInst.LoadFromJson(a)}static SortByTickSequence(a,d){var c=a.GetObjectInstance(),f=d.GetObjectInstance();const l=c.GetObjectClass().GetIndex(),g=f.GetObjectClass().GetIndex();if(l!==g)return l-g;c=c.GetPUID();f=f.GetPUID();return c!==f?c-f:a.GetBehaviorInstance()._GetIndex()-d.GetBehaviorInstance()._GetIndex()}_InitScriptInterface(){const a= this._sdkInst.GetScriptInterfaceClass(),d=a||b;b._Init(this);this._iScriptInterface=new d;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 e=self.C3;e.EffectList=class extends e.DefendedBase{constructor(b,a){super();this._owner=b;this._allEffectTypes=[];this._activeEffectTypes=[];this._effectTypesByName=new Map;this._effectParams=[];this._preservesOpaqueness=!0;for(const d of a)b=e.New(e.EffectType,this,d,this._allEffectTypes.length),this._allEffectTypes.push(b),this._effectTypesByName.set(b.GetName().toLowerCase(),b),3<=d.length&&this._effectParams.push(this._LoadSingleEffectParameters(d[2]));this.GetRuntime()._AddEffectList(this)}Release(){e.clearArray(this._allEffectTypes); e.clearArray(this._activeEffectTypes);this._effectTypesByName.clear();e.clearArray(this._effectParams);this._owner=null}PrependEffectTypes(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,d=this._allEffectTypes.length;a<d;++a)this._allEffectTypes[a]._SetIndex(a)}}_LoadSingleEffectParameters(b){b=b.slice(0);for(let a=0,d=b.length;a<d;++a){const c=b[a];if(Array.isArray(c)){const f=e.New(e.Color); f.setFromJSON(c);b[a]=f}}return b}GetOwner(){return this._owner}GetRuntime(){return this._owner.GetRuntime()}UpdateActiveEffects(){e.clearArray(this._activeEffectTypes);let b=!0;for(const a of this._allEffectTypes)a.IsActive()&&(this._activeEffectTypes.push(a),a.GetShaderProgram().PreservesOpaqueness()||(b=!1));this._preservesOpaqueness=b}GetAllEffectTypes(){return this._allEffectTypes}HasAnyEffectType(){return 0<this._allEffectTypes.length}GetEffectTypeByName(b){return this._effectTypesByName.get(b.toLowerCase())|| null}GetEffectTypeByIndex(b){b=Math.floor(+b);if(0>b||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<this._activeEffectTypes.length}PreservesOpaqueness(){return this._preservesOpaqueness}GetEffectParametersForIndex(b){return this._effectParams[b]}static SaveFxParamToJson(b){return b&& b instanceof e.Color?{t:"color",v:b.toJSON()}:b}static LoadFxParamFromJson(b){if("object"===typeof b){if("color"===b.t){const a=e.New(e.Color);a.setFromJSON(b.v);return a}throw Error("invalid effect parameter type");}return b}static SaveFxParamsToJson(b){return b.map(e.EffectList.SaveFxParamToJson)}static LoadFxParamsFromJson(b){return b.map(e.EffectList.LoadFxParamFromJson)}SaveToJson(){return this._allEffectTypes.map(b=>({name:b.GetName(),active:b.IsActive(),params:e.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()]=e.EffectList.LoadFxParamsFromJson(a.params);this.UpdateActiveEffects()}}} {"use strict";const e=self.C3;e.EffectType=class extends e.DefendedBase{constructor(b,a,d){super();this._effectList=b;this._id=a[0];this._name=a[1];this._index=d;this._shaderProgram=null;this._isActive=!0}Release(){this._shaderProgram=this._effectList=null}Clone(b){b=e.New(e.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,d=this._shaderProgram.GetParameterCount();a<d;++a){const c=this._shaderProgram.GetParameterType(a); if("float"===c||"percent"===c)b.push(0);else if("color"===c)b.push(e.New(e.Color,1,1,1,1));else throw new TypeError("unknown effect parameter type");}return b}}} {"use strict";const e=self.C3;e.InstanceEffectList=class extends e.DefendedBase{constructor(b,a,d){super();this._inst=b;this._wi=a;this._effectList=b.GetObjectClass().GetEffectList();this._activeEffectFlags=[];this._activeEffectTypes=[];this._preservesOpaqueness=!0;this._effectParams=[];for(const c of this._effectList.GetAllEffectTypes())this._activeEffectFlags.push(!0);this.UpdateActiveEffects()}Release(){e.clearArray(this._activeEffectFlags);e.clearArray(this._activeEffectTypes);e.clearArray(this._effectParams); this._effectList=this._inst=null}_LoadEffectParameters(b){for(const a of b)this._effectParams.push(this._LoadSingleEffectParameters(a))}_LoadSingleEffectParameters(b){b=b.slice(0);for(let a=0,d=b.length;a<d;++a){const c=b[a];if(Array.isArray(c)){const f=e.New(e.Color);f.setFromJSON(c);b[a]=f}}return b}LoadDefaultEffectParameters(){for(const b of this._effectList.GetAllEffectTypes())this._effectParams.push(b.GetDefaultParameterValues())}GetOwner(){return this._owner}GetEffectList(){return this._effectList}GetRuntime(){return this._inst.GetRuntime()}UpdateActiveEffects(){e.clearArray(this._activeEffectTypes); const b=this._effectList.GetAllEffectTypes(),a=this._activeEffectTypes,d=this._activeEffectFlags;let c=!0;for(let f=0,l=b.length;f<l;++f)if(d[f]){const g=b[f];a.push(g);g.GetShaderProgram().PreservesOpaqueness()||(c=!1)}this._preservesOpaqueness=c;this._wi._SetHasAnyActiveEffect(!!a.length)}GetActiveEffectTypes(){return this._activeEffectTypes}GetEffectParametersForIndex(b){return this._effectParams[b]}PreservesOpaqueness(){return this._preservesOpaqueness}HasAnyActiveBackgroundBlendingEffect(){return this._activeEffectTypes.some(b=> b.GetShaderProgram().UsesDest())}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:e.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()]=e.EffectList.LoadFxParamsFromJson(a.params);this.UpdateActiveEffects()}}} {"use strict";const e=self.C3,b=[],a=[],d=[],c=e.New(e.CollisionPoly),f=e.New(e.CollisionPoly),l=e.New(e.Quad),g=e.New(e.Rect),k=e.New(e.Rect);let m=null,u=null,x=null;e.CollisionEngine=class extends e.DefendedBase{constructor(n){super();this._runtime=n;this._registeredCollisions=[];this._polyCheckSec=this._polyCheckCount=this._collisionCheckSec=this._collisionCheckCount=0}Release(){this._runtime=null}_Update1sStats(){this._collisionCheckSec=this._collisionCheckCount;this._collisionCheckCount=0;this._polyCheckSec= this._polyCheckCount;this._polyCheckCount=0}Get1secCollisionChecks(){return this._collisionCheckSec}Get1secPolyChecks(){return this._polyCheckSec}RegisterCollision(n,q){const t=n.GetWorldInfo(),r=q.GetWorldInfo();t&&r&&t.IsCollisionEnabled()&&r.IsCollisionEnabled()&&this._registeredCollisions.push([n,q])}AddRegisteredCollisionCandidates(n,q,t){for(const [r,w]of this._registeredCollisions){let y;if(n===r)y=w;else if(n===w)y=r;else continue;y.BelongsToObjectClass(q)&&(t.includes(y)||t.push(y))}}CheckRegisteredCollision(n, q){if(!this._registeredCollisions.length)return!1;for(const [t,r]of this._registeredCollisions)if(n===t&&q===r||n===r&&q===t)return!0;return!1}ClearRegisteredCollisions(){e.clearArray(this._registeredCollisions)}TestOverlap(n,q){if(!n||!q||n===q)return!1;n=n.GetWorldInfo();q=q.GetWorldInfo();if(!n.IsCollisionEnabled()||!q.IsCollisionEnabled())return!1;this._collisionCheckCount++;const t=n.GetLayer(),r=q.GetLayer();return t.IsTransformCompatibleWith(r)?this._TestOverlap_SameLayers(n,q):this._TestOverlap_DifferentLayers(n, q)}_TestOverlap_SameLayers(n,q){if(!n.GetBoundingBox().intersectsRect(q.GetBoundingBox()))return!1;this._polyCheckCount++;if(!n.GetBoundingQuad().intersectsQuad(q.GetBoundingQuad())||n.HasTilemap()&&q.HasTilemap())return!1;if(n.HasTilemap())return this.TestTilemapOverlap(n,q);if(q.HasTilemap())return this.TestTilemapOverlap(q,n);if(!n.HasOwnCollisionPoly()&&!q.HasOwnCollisionPoly())return!0;const t=n.GetTransformedCollisionPoly(),r=q.GetTransformedCollisionPoly();return t.intersectsPoly(r,q.GetX()- n.GetX(),q.GetY()-n.GetY())}_TestOverlap_DifferentLayers(n,q){var t=n.HasTilemap(),r=q.HasTilemap();if(t&&!r)return this.TestTilemapOverlapDifferentLayers(n,q);if(r&&!t)return this.TestTilemapOverlapDifferentLayers(q,n);if(r||t)return!1;r=n.GetLayer();t=q.GetLayer();c.copy(n.GetTransformedCollisionPoly());f.copy(q.GetTransformedCollisionPoly());var w=c.pointsArr();for(let y=0,C=w.length;y<C;y+=2){const D=y+1,G=w[D],[K,B]=r.LayerToCanvasCss(w[y]+n.GetX(),G+n.GetY());w[y]=K;w[D]=B}n=f.pointsArr();for(let y= 0,C=n.length;y<C;y+=2){r=y+1;w=n[r];const [D,G]=t.LayerToCanvasCss(n[y]+q.GetX(),w+q.GetY());n[y]=D;n[r]=G}c.setBboxChanged();f.setBboxChanged();this._polyCheckCount++;return c.intersectsPoly(f,0,0)}TestTilemapOverlapDifferentLayers(n,q){var t=n.GetLayer(),r=q.GetLayer();m||(m=e.New(e.CollisionPoly));u||(u=e.New(e.Rect));x||(x=e.New(e.Quad));var w=q.GetX(),y=q.GetY();const [C,D]=r.LayerToCanvasCss(w,y),[G,K]=t.CanvasCssToLayer(C,D);t=G-w;y=K-y;u.copy(q.GetBoundingBox());u.offset(t,y);if(!n.GetBoundingBox().intersectsRect(u))return!1; x.copy(q.GetBoundingQuad());x.offset(t,y);this._polyCheckCount++;if(!n.GetBoundingQuad().intersectsQuad(x))return!1;m.copy(q.GetTransformedCollisionPoly());r=m.pointsArr();for(let B=0,A=r.length;B<A;B+=2)w=B+1,r[B]+=t,r[w]+=y;m.setBboxChanged();return this.TestTilemapOverlap(n,q,G,K,m,u,x)}TestTilemapOverlap(n,q,t,r,w,y,C){y=void 0!==y?y:q.GetBoundingBox();const D=n.GetX(),G=n.GetY();var K=n.GetInstance().GetSdkInstance();t=void 0!==t?t:q.GetX();r=void 0!==r?r:q.GetY();n=q.HasOwnCollisionPoly();C= void 0!==C?C:q.GetBoundingQuad();K.GetCollisionRectCandidates(y,a);for(let F=0,J=a.length;F<J;++F){var B=a[F];K=B.GetRect();this._collisionCheckCount++;if(y.intersectsRectOffset(K,D,G)&&(l.setFromRect(K),l.offset(D,G),l.intersectsQuad(C)))if(n){var A=void 0!==w?w:q.GetTransformedCollisionPoly();if(B=B.GetPoly()){if(this._polyCheckCount++,B.intersectsPoly(A,t-(D+K.getLeft()),r-(G+K.getTop())))return e.clearArray(a),!0}else if(c.setFromQuad(l,0,0),c.intersectsPoly(A,t,r))return e.clearArray(a),!0}else if(A= B.GetPoly()){if(c.setFromQuad(C,0,0),A.intersectsPoly(c,-(D+K.getLeft()),-(G+K.getTop())))return e.clearArray(a),!0}else return e.clearArray(a),!0}e.clearArray(a);return!1}TestAndSelectCanvasPointOverlap(n,q,t,r){const w=n.GetCurrentSol();var y=this._runtime.GetCurrentEvent();if(!y)throw Error("cannot call outside event");y=y.IsOrBlock();if(w.IsSelectAll()){r||(w._SetSelectAll(!1),e.clearArray(w._GetOwnInstances()));for(var C of n.GetInstances()){var D=C.GetWorldInfo(),G=D.GetLayer();const [K,B]= G.CanvasCssToLayer(q,t,D.GetTotalZElevation());if(D.ContainsPoint(K,B)){if(r)return!1;w._PushInstance(C)}else y&&w._PushElseInstance(C)}}else{C=y?w._GetOwnElseInstances():w._GetOwnInstances();D=0;for(let K=0,B=C.length;K<B;++K){G=C[K];const A=G.GetWorldInfo(),F=A.GetLayer(),[J,L]=F.CanvasCssToLayer(q,t,A.GetTotalZElevation());if(A.ContainsPoint(J,L)){if(r)return!1;y?w._PushInstance(G):C[D++]=G}else y&&(C[D++]=G)}r||(C.length=D)}n.ApplySolToContainer();return r?!0:w.HasAnyInstances()}GetCollisionCandidates(n, q,t,r){n=n?1!==n.GetParallaxX()||1!==n.GetParallaxY():!1;if(q.IsFamily())for(const w of q.GetFamilyMembers())n||w.IsAnyInstanceParallaxed()?e.appendArray(r,w.GetInstances()):(w._UpdateAllCollisionCells(),w._GetCollisionCellGrid().QueryRange(t,r));else n||q.IsAnyInstanceParallaxed()?e.appendArray(r,q.GetInstances()):(q._UpdateAllCollisionCells(),q._GetCollisionCellGrid().QueryRange(t,r))}GetObjectClassesCollisionCandidates(n,q,t,r){for(const w of q)this.GetCollisionCandidates(n,w,t,r)}GetSolidCollisionCandidates(n, q,t){const r=this._runtime.GetSolidBehavior();r&&this.GetObjectClassesCollisionCandidates(n,r.GetObjectClasses(),q,t)}GetJumpthruCollisionCandidates(n,q,t){const r=this._runtime.GetJumpthruBehavior();r&&this.GetObjectClassesCollisionCandidates(n,r.GetObjectClasses(),q,t)}IsSolidCollisionAllowed(n,q){return n._IsSolidEnabled()&&(!q||q.GetWorldInfo().IsSolidCollisionAllowed(n.GetSavedDataMap().get("solidTags")))}TestOverlapSolid(n){const q=n.GetWorldInfo();this.GetSolidCollisionCandidates(q.GetLayer(), q.GetBoundingBox(),b);for(const t of b)if(this.IsSolidCollisionAllowed(t,n)&&this.TestOverlap(n,t))return e.clearArray(b),t;e.clearArray(b);return null}TestRectOverlapSolid(n,q){this.GetSolidCollisionCandidates(null,n,b);for(const t of b)if(this.IsSolidCollisionAllowed(t,q)&&this.TestRectOverlap(n,t))return e.clearArray(b),t;e.clearArray(b);return null}TestOverlapJumpthru(n,q){let t=null;q&&(t=d,e.clearArray(t));const r=n.GetWorldInfo();this.GetJumpthruCollisionCandidates(r.GetLayer(),r.GetBoundingBox(), b);for(const w of b)if(w._IsJumpthruEnabled()&&this.TestOverlap(n,w))if(q)t.push(w);else return e.clearArray(b),w;e.clearArray(b);return t}PushOut(n,q,t,r,w){r=r||50;const y=n.GetWorldInfo(),C=y.GetX(),D=y.GetY();for(let G=0;G<r;++G)if(y.SetXY(C+q*G,D+t*G),y.SetBboxChanged(),!this.TestOverlap(n,w))return!0;y.SetXY(C,D);y.SetBboxChanged();return!1}PushOutSolid(n,q,t,r,w,y){r=r||50;const C=n.GetWorldInfo(),D=C.GetX(),G=C.GetY();let K=null,B=null;for(let A=0;A<r;++A)if(C.SetXY(D+q*A,G+t*A),C.SetBboxChanged(), !this.TestOverlap(n,K))if(K=this.TestOverlapSolid(n))B=K;else if(w&&(K=y?this.TestOverlap(n,y)?y:null:this.TestOverlapJumpthru(n))&&(B=K),!K)return B&&this.PushInFractional(n,q,t,B,16,!0),!0;C.SetXY(D,G);C.SetBboxChanged();return!1}PushOutSolidAxis(n,q,t,r){r=r||50;const w=n.GetWorldInfo(),y=w.GetX(),C=w.GetY();let D=null,G=null;for(let K=0;K<r;++K)for(let B=0;2>B;++B){const A=2*B-1;w.SetXY(y+q*K*A,C+t*K*A);w.SetBboxChanged();if(!this.TestOverlap(n,D))if(D=this.TestOverlapSolid(n))G=D;else return G&& this.PushInFractional(n,q*A,t*A,G,16,!0),!0}w.SetXY(y,C);w.SetBboxChanged();return!1}PushInFractional(n,q,t,r,w,y){let C=2,D=!1;var G=!1;const K=n.GetWorldInfo();let B=K.GetX(),A=K.GetY();for(;C<=w;)G=1/C,C*=2,K.OffsetXY(q*G*(D?1:-1),t*G*(D?1:-1)),K.SetBboxChanged(),this.TestOverlap(n,r)||y&&this.TestOverlapSolid(n)?G=D=!0:(G=D=!1,B=K.GetX(),A=K.GetY());G&&(K.SetXY(B,A),K.SetBboxChanged())}PushOutSolidNearest(n,q=100){let t=0;const r=n.GetWorldInfo(),w=r.GetX(),y=r.GetY();let C=0,D=this.TestOverlapSolid(n); if(!D)return!0;for(;t<=q;){let G=0,K=0;switch(C){case 0:G=0;K=-1;t++;break;case 1:G=1;K=-1;break;case 2:G=1;K=0;break;case 3:K=G=1;break;case 4:G=0;K=1;break;case 5:G=-1;K=1;break;case 6:G=-1;K=0;break;case 7:K=G=-1}C=(C+1)%8;r.SetXY(Math.floor(w+G*t),Math.floor(y+K*t));r.SetBboxChanged();if(!this.TestOverlap(n,D)&&(D=this.TestOverlapSolid(n),!D))return!0}r.SetXY(w,y);r.SetBboxChanged();return!1}CalculateBounceAngle(n,q,t,r){const w=n.GetWorldInfo(),y=w.GetX(),C=w.GetY(),D=Math.max(10,e.distanceTo(q, t,y,C));var G=e.angleTo(q,t,y,C),K=r||this.TestOverlapSolid(n);if(!K)return e.clampAngle(G+Math.PI);let B=K;var A=0,F=0;const J=e.toRadians(5);let L;for(L=1;36>L;++L){const Q=G-L*J;w.SetXY(q+Math.cos(Q)*D,t+Math.sin(Q)*D);w.SetBboxChanged();if(!this.TestOverlap(n,B)&&(B=r?null:this.TestOverlapSolid(n),!B)){A=Q;break}}36===L&&(A=e.clampAngle(G+Math.PI));B=K;for(L=1;36>L;++L)if(K=G+L*J,w.SetXY(q+Math.cos(K)*D,t+Math.sin(K)*D),w.SetBboxChanged(),!this.TestOverlap(n,B)&&(B=r?null:this.TestOverlapSolid(n), !B)){F=K;break}36===L&&(F=e.clampAngle(G+Math.PI));w.SetXY(y,C);w.SetBboxChanged();if(F===A)return F;n=e.angleDiff(F,A)/2;n=e.angleClockwise(F,A)?e.clampAngle(A+n+Math.PI):e.clampAngle(F+n);A=Math.cos(G);G=Math.sin(G);F=Math.cos(n);n=Math.sin(n);q=A*F+G*n;return e.angleTo(0,0,A-2*q*F,G-2*q*n)}TestSegmentOverlap(n,q,t,r,w){if(!w)return!1;const y=w.GetWorldInfo();if(!y.IsCollisionEnabled())return!1;this._collisionCheckCount++;g.set(Math.min(n,t),Math.min(q,r),Math.max(n,t),Math.max(q,r));if(!y.GetBoundingBox().intersectsRect(g))return!1; if(w.HasTilemap())return this._TestSegmentOverlapTilemap(n,q,t,r,w,y);this._polyCheckCount++;return y.GetBoundingQuad().intersectsSegment(n,q,t,r)?y.HasOwnCollisionPoly()?y.GetTransformedCollisionPoly().intersectsSegment(y.GetX(),y.GetY(),n,q,t,r):!0:!1}_TestSegmentOverlapTilemap(n,q,t,r,w,y){const C=y.GetX();y=y.GetY();w=w.GetSdkInstance();k.set(n,q,t,r);k.normalize();w.GetCollisionRectCandidates(k,a);for(let G=0,K=a.length;G<K;++G){var D=a[G];w=D.GetRect();this._collisionCheckCount++;if(g.intersectsRectOffset(w, C,y)&&(l.setFromRect(w),l.offset(C,y),l.intersectsSegment(n,q,t,r)))if(D=D.GetPoly()){if(this._polyCheckCount++,D.intersectsSegment(C+w.getLeft(),y+w.getTop(),n,q,t,r))return e.clearArray(a),!0}else return e.clearArray(a),!0}e.clearArray(a);return!1}TestRectOverlap(n,q){if(!q)return!1;const t=q.GetWorldInfo();if(!t.IsCollisionEnabled())return!1;this._collisionCheckCount++;if(!t.GetBoundingBox().intersectsRect(n))return!1;if(q.HasTilemap())return this._TestRectOverlapTilemap(n,q,t);this._polyCheckCount++; l.setFromRect(n);if(!t.GetBoundingQuad().intersectsQuad(l))return!1;if(!t.HasOwnCollisionPoly())return!0;c.setFromRect(n,t.GetX(),t.GetY());n=t.GetTransformedCollisionPoly();return c.intersectsPoly(n,0,0)}_TestRectOverlapTilemap(n,q,t){const r=t.GetX();t=t.GetY();q.GetSdkInstance().GetCollisionRectCandidates(n,a);for(let y=0,C=a.length;y<C;++y){var w=a[y];q=w.GetRect();this._collisionCheckCount++;if(n.intersectsRectOffset(q,r,t))if(w=w.GetPoly()){if(this._polyCheckCount++,c.setFromRect(n,0,0),w.intersectsPoly(c, -(r+q.getLeft()),-(t+q.getTop())))return e.clearArray(a),!0}else return e.clearArray(a),!0}e.clearArray(a);return!1}TestRayIntersectsInstance(n,q){if(n){var t=n.GetWorldInfo();t.IsCollisionEnabled()&&(this._collisionCheckCount++,t.GetBoundingBox().intersectsRect(q.rect)&&(n.HasTilemap()?this._TestRayIntersectsTilemap(n,t,q):(this._polyCheckCount++,t.HasOwnCollisionPoly()?q.TestInstancePoly(n,t.GetX(),t.GetY(),t.GetTransformedCollisionPoly()):q.TestInstanceQuad(n,t.GetBoundingQuad()))))}}_TestRayIntersectsTilemap(n, q,t){const r=q.GetX(),w=q.GetY();n.GetSdkInstance().GetCollisionRectCandidates(t.rect,a);for(let C=0,D=a.length;C<D;C++){var y=a[C];const G=y.GetRect();this._collisionCheckCount++;t.rect.intersectsRectOffset(G,r,w)&&(y=y.GetPoly(),this._polyCheckCount++,y?t.TestInstancePoly(n,r+G.getLeft(),w+G.getTop(),y):t.TestInstanceRect(n,q.GetX(),q.GetY(),G))}e.clearArray(a)}}} {"use strict";const e=self.C3;e.SparseGrid=class extends e.DefendedBase{constructor(b,a){super();this._cellWidth=b;this._cellHeight=a;this._cells=e.New(e.PairMap)}Release(){this._cells.Release();this._cells=null}GetCell(b,a,d){let c=this._cells.Get(b,a);return c?c:d?(c=e.New(e.GridCell,this,b,a),this._cells.Set(b,a,c),c):null}XToCell(b){b=Math.floor(b/this._cellWidth);return isFinite(b)?b:0}YToCell(b){b=Math.floor(b/this._cellHeight);return isFinite(b)?b:0}Update(b,a,d){if(a)for(let c=a.getLeft(), f=a.getRight();c<=f;++c)for(let l=a.getTop(),g=a.getBottom();l<=g;++l){if(d&&d.containsPoint(c,l))continue;const k=this.GetCell(c,l,!1);k&&(k.Remove(b),k.IsEmpty()&&this._cells.Delete(c,l))}if(d)for(let c=d.getLeft(),f=d.getRight();c<=f;++c)for(let l=d.getTop(),g=d.getBottom();l<=g;++l)a&&a.containsPoint(c,l)||this.GetCell(c,l,!0).Insert(b)}QueryRange(b,a){let d=this.XToCell(b.getLeft());const c=this.YToCell(b.getTop()),f=this.XToCell(b.getRight());b=this.YToCell(b.getBottom());if(isFinite(f)&&isFinite(b))for(;d<= f;++d)for(let l=c;l<=b;++l){const g=this.GetCell(d,l,!1);g&&g.Dump(a)}}}}{"use strict";const e=self.C3;e.GridCell=class extends e.DefendedBase{constructor(b,a,d){super();this._grid=b;this._x=a;this._y=d;this._instances=e.New(e.ArraySet)}Release(){this._instances.Release();this._grid=this._instances=null}IsEmpty(){return this._instances.IsEmpty()}Insert(b){this._instances.Add(b)}Remove(b){this._instances.Delete(b)}Dump(b){e.appendArray(b,this._instances.GetArray())}}} {"use strict";const e=self.C3;e.Ray=class{constructor(){this.dy=this.dx=this.y2=this.x2=this.y1=this.x1=0;this.rect=new e.Rect;this.hitFraction=2;this.hitUid=null;this.distance=this.hitY=this.hitX=this.hitNormalDy=this.hitNormalDx=this.hitNormal=0;this.normalX=1;this.normalY=0;this.reflectionX=1;this.reflectionY=0}DidCollide(){return 1.000001>this.hitFraction}Set(b,a,d,c){this.x1=b;this.y1=a;this.x2=d;this.y2=c;this.dx=d-b;this.dy=c-a;this.rect.set(b,a,d,c);this.rect.normalize();this.hitFraction= 2;this.hitUid=null;this.distance=this.hitY=this.hitX=this.hitNormalDy=this.hitNormalDx=this.hitNormal=0;this.normalX=1;this.normalY=0;this.reflectionX=1;this.reflectionY=0;return this}Complete(){if(!1!==this.DidCollide()){var b=this.dx*this.hitFraction,a=this.dy*this.hitFraction,d=Math.sqrt(b*b+a*a);b/=d;a/=d;this.distance=d-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);d=b*this.normalX+a*this.normalY;this.reflectionX=b-2*this.normalX*d;this.reflectionY=a-2*this.normalY*d;0<d&&(this.hitNormal=e.clampAngle(this.hitNormal+Math.PI),this.normalX=-this.normalX,this.normalY=-this.normalY)}}TestInstanceSegment(b,a,d,c,f){const l=e.rayIntersect(this.x1,this.y1,this.x2,this.y2,a,d,c,f);0<=l&&l<this.hitFraction&&(this.hitFraction=l,this.hitUid=b.GetUID(),this.hitNormalDx=a-c,this.hitNormalDy=d-f)}TestInstanceRect(b,a,d,c){const f=a+c.getLeft(); a+=c.getRight();const l=d+c.getTop();d+=c.getBottom();this.TestInstanceSegment(b,f,l,a,l);this.TestInstanceSegment(b,a,l,a,d);this.TestInstanceSegment(b,a,d,f,d);this.TestInstanceSegment(b,f,d,f,l)}TestInstanceQuad(b,a){const d=a.getTlx(),c=a.getTly(),f=a.getTrx(),l=a.getTry(),g=a.getBrx(),k=a.getBry(),m=a.getBlx();a=a.getBly();this.TestInstanceSegment(b,d,c,f,l);this.TestInstanceSegment(b,f,l,g,k);this.TestInstanceSegment(b,g,k,m,a);this.TestInstanceSegment(b,m,a,d,c)}TestInstancePoly(b,a,d,c){c= c.pointsArr();for(let f=0,l=c.length;f<l;f+=2){const g=(f+2)%l;this.TestInstanceSegment(b,c[f]+a,c[f+1]+d,c[g]+a,c[g+1]+d)}}}} {"use strict";const e=self.C3,b=new Set("off crop scale-inner scale-outer letterbox-scale letterbox-integer-scale".split(" ")),a=new Set(["high","low"]),d=self.glMatrix.mat4,c=d.create(),f=e.New(e.Quad),l=e.New(e.Rect);e.CanvasManager=class extends e.DefendedBase{constructor(g){super();this._runtime=g;this._canvas=null;this._isWebGPUEnabled=!1;this._webgpuRenderer=this._webglRenderer=null;this._gpuPreference="high-performance";this._canvasCssOffsetY=this._canvasCssOffsetX=this._canvasDeviceHeight= this._canvasDeviceWidth=this._canvasCssHeight=this._canvasCssWidth=this._windowInnerHeight=this._windowInnerWidth=0;this._enableMipmaps=!0;this._drawHeight=this._drawWidth=this._textureAnisotropy=0;this._documentFullscreenMode=this._fullscreenMode="letterbox-scale";this._deviceTransformOffY=this._deviceTransformOffX=0;this._defaultProjectionMatrix=d.create();this._fullscreenScalingQuality=this._wantFullscreenScalingQuality="high";this._isDocumentFullscreen=!1;this._availableAdditionalRenderTargets= [];this._usedAdditionalRenderTargets=new Set;this._shaderData=self.C3_Shaders;this._gpuTimeEndFrame=this._gpuTimeStartFrame=0;this._gpuLastUtilisation=NaN;this._gpuFrameTimingsBuffer=null;this._layersGpuProfile=new Map;this._gpuCurUtilisation=NaN;this._webgpuFrameTimings=new Map;this._snapshotFormat="";this._snapshotQuality=1;this._snapshotArea=e.New(e.Rect);this._snapshotUrl="";this._snapshotResolve=this._snapshotPromise=null;this._loaderStartTime=this._isPastingToDrawingCanvas=0;this._rafId=-1; this._loadingProgress=0;this._loadingprogress_handler=k=>this._loadingProgress=k.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(k=>this._splashDoneResolve=k)}_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 k=navigator.gpu&&this._isWebGPUEnabled;let m=!1;if(k)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()&&k)try{await this._InitWebGPUContext(!1)}catch(u){this._webgpuRenderer=null}if(!this.GetRenderer())try{await this._InitWebGLContext(!1)}catch(u){this._webglRenderer=null}k=this.GetRenderer();if(!k)throw Error("failed to acquire a renderer - check WebGL or WebGPU is supported"); k.SetHasMajorPerformanceCaveat(m);this.SetSize(g.windowInnerWidth,g.windowInnerHeight,!0);this._webgpuRenderer?await this._InitWebGPU():this._webglRenderer&&await this._InitWebGL();k.SetMipmapsEnabled(this._enableMipmaps);k.SupportsGPUProfiling()&&(this._gpuLastUtilisation=0);g=!1;for(const u of this._runtime._GetAllEffectLists()){for(const x of u.GetAllEffectTypes())x._InitRenderer(k),x.GetShaderProgram().UsesDest()&&(g=!0);u.UpdateActiveEffects()}this._runtime._SetUsesAnyBackgroundBlending(g)}async _InitWebGPUContext(g){g= {powerPreference:this._gpuPreference,depth:this._runtime.Uses3DFeatures(),failIfMajorPerformanceCaveat:g};this._webgpuRenderer=e.New(e.Gfx.WebGPURenderer);await this._webgpuRenderer.Create(this._canvas,g)}async _InitWebGLContext(g){g={powerPreference:this._gpuPreference,enableGpuProfiling:!0,depth:this._runtime.Uses3DFeatures(),failIfMajorPerformanceCaveat:g};"Android"===e.Platform.OS&&"Chromium"===e.Platform.BrowserEngine&&75>e.Platform.BrowserVersionNumber&&(console.warn("[Construct 3] Disabling WebGL 2 because this device appears to be affected by crbug.com/934823. Install software updates to avoid this."), g.maxWebGLVersion=1);"standard"===this._runtime.GetCompositingMode()?g.alpha=!0:(g.alpha=!1,g.lowLatency=!0);this._webglRenderer=e.New(e.Gfx.WebGLRenderer,this._canvas,g);await this._webglRenderer.InitState()}async _InitWebGPU(){if(this._shaderData){const g=[];for(const [k,m]of Object.entries(this._shaderData)){const u=e.Gfx.WebGPUShaderProgram.GetDefaultVertexShaderSource();g.push(this._webgpuRenderer.CreateShaderProgram(k,m.wgsl,u))}await Promise.all(g)}}async _InitWebGL(){if(this._shaderData){const g= [];for(const [k,m]of Object.entries(this._shaderData)){m.src=m.glsl;const u=e.Gfx.WebGLShaderProgram.GetDefaultVertexShaderSource();g.push(this._webglRenderer.CreateShaderProgram(m,u,k))}await Promise.all(g);this._webglRenderer.ResetLastProgram();this._webglRenderer.SetTextureFillMode()}this._webglRenderer.SupportsGPUProfiling()&&(this._gpuFrameTimingsBuffer=e.New(e.Gfx.WebGLQueryResultBuffer,this._webglRenderer))}Release(){this._canvas=this._webglRenderer=this._runtime=null}_OnWindowResize(g){const k= this._runtime,m=g.devicePixelRatio;k.IsInWorker()&&(self.devicePixelRatio=m);k._SetDevicePixelRatio(m);this._isDocumentFullscreen=!!g.isFullscreen;this.SetSize(g.innerWidth,g.innerHeight);k.UpdateRender();k.IsDebug()&&(k.HitBreakpoint()||self.C3Debugger.IsDebuggerPaused())&&k.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,k,m=!1){g=Math.floor(g);k=Math.floor(k);if(0>=g||0>=k)throw Error("invalid size");if(this._windowInnerWidth!==g||this._windowInnerHeight!==k||m){this._windowInnerWidth=g;this._windowInnerHeight=k;m=this.GetCurrentFullscreenMode();"letterbox-scale"===m?this._CalculateLetterboxScale(g,k):"letterbox-integer-scale"===m?this._CalculateLetterboxIntegerScale(g,k):"off"===m?this._CalculateFixedSizeCanvas(g,k):this._CalculateFullsizeCanvas(g,k);this._UpdateFullscreenScalingQuality(m); this._canvas.width=this._canvasDeviceWidth;this._canvas.height=this._canvasDeviceHeight;this._runtime.PostComponentMessageToDOM("canvas","update-size",{marginLeft:this._canvasCssOffsetX,marginTop:this._canvasCssOffsetY,styleWidth:this._canvasCssWidth,styleHeight:this._canvasCssHeight});g=this.GetRenderer();g.SetSize(this._canvasDeviceWidth,this._canvasDeviceHeight,!0);for(var u of this._availableAdditionalRenderTargets)g.DeleteRenderTarget(u);e.clearArray(this._availableAdditionalRenderTargets);g.CalculatePerspectiveMatrix(this._defaultProjectionMatrix, this.GetDrawWidth()/this.GetDrawHeight());u=this._runtime.GetLayoutManager();u.SetAllLayerProjectionChanged();u.SetAllLayerMVChanged()}}GetDefaultProjectionMatrix(){return this._defaultProjectionMatrix}_CalculateLetterboxScale(g,k){const m=this._runtime.GetDevicePixelRatio(),u=this._runtime.GetOriginalViewportWidth(),x=this._runtime.GetOriginalViewportHeight(),n=u/x;g/k>n?(this._canvasCssWidth=Math.round(k*n),this._canvasCssHeight=k,this._canvasCssOffsetX=Math.floor((g-this._canvasCssWidth)/2),this._canvasCssOffsetY= 0):(this._canvasCssWidth=g,this._canvasCssHeight=Math.round(g/n),this._canvasCssOffsetX=0,this._canvasCssOffsetY=Math.floor((k-this._canvasCssHeight)/2));this._canvasDeviceWidth=Math.round(this._canvasCssWidth*m);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*m);this._runtime.SetViewportSize(u,x)}_CalculateLetterboxIntegerScale(g,k){const m=this._runtime.GetDevicePixelRatio();1!==m&&(g+=1,k+=1);const u=this._runtime.GetOriginalViewportWidth(),x=this._runtime.GetOriginalViewportHeight(); var n=u/x;n=g/k>n?k*n*m/u:g/n*m/x;1<n?n=Math.floor(n):1>n&&(n=1/Math.ceil(1/n));this._canvasDeviceWidth=Math.round(u*n);this._canvasDeviceHeight=Math.round(x*n);this._canvasCssWidth=this._canvasDeviceWidth/m;this._canvasCssHeight=this._canvasDeviceHeight/m;this._canvasCssOffsetX=Math.max(Math.floor((g-this._canvasCssWidth)/2),0);this._canvasCssOffsetY=Math.max(Math.floor((k-this._canvasCssHeight)/2),0);this._runtime.SetViewportSize(u,x)}_CalculateFullsizeCanvas(g,k){const m=this._runtime.GetDevicePixelRatio(); this._canvasCssWidth=g;this._canvasCssHeight=k;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,k){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((k-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 k=this._runtime.GetViewportWidth();m=this._runtime.GetViewportHeight()}else k=this._runtime.GetOriginalViewportWidth(),m=this._runtime.GetOriginalViewportHeight();this._canvasDeviceWidth<k&&this._canvasDeviceHeight<m?(this._drawWidth=this._canvasDeviceWidth,this._drawHeight=this._canvasDeviceHeight,this._fullscreenScalingQuality="high"): (this._drawWidth=k,this._drawHeight=m,this._fullscreenScalingQuality="low","scale-inner"===g?(g=k/m,k=this._windowInnerWidth/this._windowInnerHeight,k<g?this._drawWidth=this._drawHeight*k:k>g&&(this._drawHeight=this._drawWidth/k)):"scale-outer"===g&&(g=k/m,k=this._windowInnerWidth/this._windowInnerHeight,k>g?this._drawWidth=this._drawHeight*k:k<g&&(this._drawHeight=this._drawWidth/k)))}}IsDocumentFullscreen(){return this._isDocumentFullscreen}SetFullscreenMode(g){if(!b.has(g))throw Error("invalid fullscreen mode"); this._fullscreenMode=g;g=this._runtime.GetLayoutManager();g.SetAllLayerProjectionChanged();g.SetAllLayerMVChanged()}GetFullscreenMode(){return this._fullscreenMode}SetDocumentFullscreenMode(g){if(!b.has(g))throw Error("invalid fullscreen mode");this._documentFullscreenMode=g;g=this._runtime.GetLayoutManager();g.SetAllLayerProjectionChanged();g.SetAllLayerMVChanged()}GetDocumentFullscreenMode(){return this._documentFullscreenMode}GetCurrentFullscreenMode(){return this.IsDocumentFullscreen()?this.GetDocumentFullscreenMode(): this.GetFullscreenMode()}SetFullscreenScalingQuality(g){if(!a.has(g))throw Error("invalid fullscreen scaling quality");this._wantFullscreenScalingQuality=g;this._runtime.GetLayoutManager().SetAllLayerProjectionChanged()}GetSetFullscreenScalingQuality(){return this._wantFullscreenScalingQuality}GetCurrentFullscreenScalingQuality(){return this._fullscreenScalingQuality}static _FullscreenModeNumberToString(g){switch(g){case 0:return"off";case 1:return"crop";case 2:return"scale-inner";case 3:return"scale-outer"; case 4:return"letterbox-scale";case 5:return"letterbox-integer-scale";default:throw Error("invalid fullscreen mode");}}GetLastWidth(){return this._windowInnerWidth}GetLastHeight(){return this._windowInnerHeight}GetDrawWidth(){return this._drawWidth}GetDrawHeight(){return this._drawHeight}SetMipmapsEnabled(g){this._enableMipmaps=!!g}_SetTextureAnisotropy(g){this._textureAnisotropy=g}GetTextureAnisotropy(){return this._textureAnisotropy}IsRendererContextLost(){return this.GetRenderer().IsContextLost()}_OnWebGLContextLost(g){console.log("[Construct 3] WebGL context lost"); g.preventDefault();this._availableAdditionalRenderTargets=[];this._usedAdditionalRenderTargets.clear();this._webglRenderer.OnContextLost();this._runtime._OnWebGLContextLost()}async _OnWebGLContextRestored(g){await this._webglRenderer.OnContextRestored();await this._LoadWebGLShaderPrograms();for(const k of this._runtime._GetAllEffectLists())for(const m of k.GetAllEffectTypes())m._InitRenderer(this._webglRenderer);await this._runtime._OnWebGLContextRestored();console.log("[Construct 3] WebGL context restored")}GetWebGLRenderer(){return this._webglRenderer}GetWebGPURenderer(){return this._webgpuRenderer}GetRenderer(){return this._webgpuRenderer|| this._webglRenderer}GetRenderScale(){return"low"===this._fullscreenScalingQuality?1/this._runtime.GetDevicePixelRatio():this.GetDisplayScale()}GetDisplayScale(){const g=this.GetCurrentFullscreenMode();if("off"===g||"crop"===g)return 1;const k=this._runtime.GetOriginalViewportWidth(),m=this._runtime.GetOriginalViewportHeight(),u=k/m,x=this._canvasDeviceWidth/this._canvasDeviceHeight;return"scale-inner"!==g&&x>u||"scale-inner"===g&&x<u?this._canvasCssHeight/m:this._canvasCssWidth/k}SetDeviceTransformOffset(g, k){this._deviceTransformOffX=g;this._deviceTransformOffY=k}SetDeviceTransform(g,k,m,u=!0){k=k||this._drawWidth;m=m||this._drawHeight;const x=k/2+this._deviceTransformOffX,n=m/2+this._deviceTransformOffY;if(u){u=this.GetDefaultProjectionMatrix();if(k!==this._drawWidth||m!==this._drawHeight)g.CalculatePerspectiveMatrix(c,k/m),u=c;g.SetProjectionMatrix(u)}k=g.CalculateLookAtModelView2(x,n,g.GetDefaultCameraZ()*this._runtime.GetDevicePixelRatio(),x,n,0,m||this._drawHeight);g.SetModelViewMatrix(k)}SetCssTransform(g, k=!0){const m=this._canvasCssWidth/2,u=this._canvasCssHeight/2;k&&g.SetProjectionMatrix(this.GetDefaultProjectionMatrix());k=g.CalculateLookAtModelView2(m,u,g.GetDefaultCameraZ(),m,u,0);g.SetModelViewMatrix(k)}GetDeviceWidth(){return this._canvasDeviceWidth}GetDeviceHeight(){return this._canvasDeviceHeight}GetCssWidth(){return this._canvasCssWidth}GetCssHeight(){return this._canvasCssHeight}GetCanvasClientX(){return this._canvasCssOffsetX}GetCanvasClientY(){return this._canvasCssOffsetY}GetAdditionalRenderTarget(g){g.depth= this._runtime.Uses3DFeatures();const k=this._availableAdditionalRenderTargets,m=k.findIndex(x=>x.IsCompatibleWithOptions(g));let u;-1!==m?(u=k[m],k.splice(m,1)):u=this.GetRenderer().CreateRenderTarget(g);this._usedAdditionalRenderTargets.add(u);return u}ReleaseAdditionalRenderTarget(g){if(!this._usedAdditionalRenderTargets.has(g))throw Error("render target not in use");this._usedAdditionalRenderTargets.delete(g);this._availableAdditionalRenderTargets.push(g)}*activeLayersGpuProfiles(){for(const g of this._runtime.GetLayoutManager().runningLayouts())for(const k of g.GetLayers()){const m= this._layersGpuProfile.get(k);m&&(yield m)}}GetLayerTimingsBuffer(g){if(!this.GetRenderer().SupportsGPUProfiling())return null;let k=this._layersGpuProfile.get(g);k||(k={name:g.GetName(),timingsBuffer:e.New(e.Gfx.WebGLQueryResultBuffer,this._webglRenderer),curUtilisation:0,lastUtilisation:0},this._layersGpuProfile.set(g,k));return k.timingsBuffer}_Update1sFrameRange(){const g=this.GetRenderer();if(g.SupportsGPUProfiling()&&0===this._gpuTimeEndFrame){this._gpuTimeEndFrame=g.GetFrameNumber();this._gpuCurUtilisation= NaN;for(const k of this.activeLayersGpuProfiles())k.curUtilisation=NaN}}_UpdateTick(){this._webglRenderer&&this._webglRenderer.SupportsGPUProfiling()&&this._UpdateTick_WebGL();this._webgpuRenderer&&this._webgpuRenderer.SupportsGPUProfiling()&&this._UpdateTick_WebGPU()}_UpdateTick_WebGL(){if(isNaN(this._gpuCurUtilisation)&&(this._gpuCurUtilisation=this._gpuFrameTimingsBuffer.GetFrameRangeResultSum(this._gpuTimeStartFrame,this._gpuTimeEndFrame),!isNaN(this._gpuCurUtilisation))){if(this._runtime.IsDebug())for(const g of this.activeLayersGpuProfiles())if(g.curUtilisation= g.timingsBuffer.GetFrameRangeResultSum(this._gpuTimeStartFrame,this._gpuTimeEndFrame),isNaN(g.curUtilisation))return;this._gpuFrameTimingsBuffer.DeleteAllBeforeFrameNumber(this._gpuTimeEndFrame);this._gpuLastUtilisation=Math.min(this._gpuCurUtilisation,1);if(this._runtime.IsDebug()){for(const g of this.activeLayersGpuProfiles())g.timingsBuffer.DeleteAllBeforeFrameNumber(this._gpuTimeEndFrame),g.lastUtilisation=Math.min(g.curUtilisation,1);self.C3Debugger.UpdateGPUProfile(this._gpuLastUtilisation, [...this.activeLayersGpuProfiles()])}this._gpuTimeStartFrame=this._gpuTimeEndFrame;this._gpuTimeEndFrame=0}}GetGPUFrameTimingsBuffer(){return this._gpuFrameTimingsBuffer}_UpdateTick_WebGPU(){if(0!==this._gpuTimeEndFrame){for(var g=this._gpuTimeStartFrame;g<this._gpuTimeEndFrame;++g){var k=this._webgpuFrameTimings.get(g);if(k&&!k.HasResult())return}k=this._runtime.GetMainRunningLayout();g=e.MakeFilledArray(k.GetLayerCount()+1,0);for(var m=this._gpuTimeStartFrame;m<this._gpuTimeEndFrame;++m){var u= this._webgpuFrameTimings.get(m);if(u){u=u.GetResult();for(let x=0,n=Math.min(g.length,u.length/2);x<n;++x){const q=u[2*x],t=u[2*x+1];g[x]=0===Number(q)||0===Number(t)?NaN:g[x]+Number(t-q)/1E9}}}this._gpuLastUtilisation=e.clamp(g[0],0,1);if(this._runtime.IsDebug()){m=[];k=k.GetLayers();for(let x=0,n=Math.min(k.length,g.length-1);x<n;++x)m.push({name:k[x].GetName(),lastUtilisation:e.clamp(g[x+1],0,1)});self.C3Debugger.UpdateGPUProfile(this._gpuLastUtilisation,m)}for(g=this._gpuTimeStartFrame;g<this._gpuTimeEndFrame;++g)this._webgpuFrameTimings.delete(g); this._gpuTimeStartFrame=this._gpuTimeEndFrame;this._gpuTimeEndFrame=0}}_AddWebGPUFrameTiming(g){this._webgpuFrameTimings.set(this._webgpuRenderer.GetFrameNumber(),g)}GetGPUUtilisation(){return this._gpuLastUtilisation}SnapshotCanvas(g,k,m,u,x,n){this._snapshotFormat=g;this._snapshotQuality=k;this._snapshotArea.setWH(m,u,x,n);return this._snapshotPromise?this._snapshotPromise:this._snapshotPromise=new Promise(q=>{this._snapshotResolve=q})}_MaybeTakeSnapshot(){if(this._snapshotFormat){var g=this._canvas, k=this._snapshotArea,m=e.clamp(Math.floor(k.getLeft()),0,g.width),u=e.clamp(Math.floor(k.getTop()),0,g.height),x=k.width();x=0===x?g.width-m:e.clamp(Math.floor(x),0,g.width-m);k=k.height();k=0===k?g.height-u:e.clamp(Math.floor(k),0,g.height-u);(0!==m||0!==u||x!==g.width||k!==g.height)&&0<x&&0<k&&(g=e.CreateCanvas(x,k),g.getContext("2d").drawImage(this._canvas,m,u,x,k,0,0,x,k));e.CanvasToBlob(g,this._snapshotFormat,this._snapshotQuality).then(n=>{this._snapshotUrl=URL.createObjectURL(n);this._snapshotPromise= null;this._snapshotResolve(this._snapshotUrl)});this._snapshotFormat="";this._snapshotQuality=1}}GetCanvasSnapshotUrl(){return this._snapshotUrl}SetIsPastingToDrawingCanvas(g){g?this._isPastingToDrawingCanvas++:this._isPastingToDrawingCanvas--}IsPastingToDrawingCanvas(){return 0<this._isPastingToDrawingCanvas}InitLoadingScreen(g){this._webglRenderer&&(2===g?(this._percentText=e.New(e.Gfx.RendererText,this.GetRenderer()),this._percentText.SetIsAsync(!1),this._percentText.SetFontName("Arial"),this._percentText.SetFontSize(16), this._percentText.SetHorizontalAlignment("center"),this._percentText.SetVerticalAlignment("center"),this._percentText.SetSize(300,200)):0===g?(g=this._runtime.GetLoadingLogoAsset())&&g.LoadStaticTexture(this._webglRenderer).catch(k=>console.warn("[C3 runtime] Failed to create texture for loading logo: ",k)):4===g&&(this._LoadSvgSplashImage("splash-images/splash-logo.svg").then(k=>{"done"===this._splashState?this._webglRenderer.DeleteTexture(k):this._splashTextures.logo=k}).catch(k=>console.warn("Failed to load splash image: ", k)),this._LoadBitmapSplashImage("splash-images/splash-poweredby-512.png").then(k=>{"done"===this._splashState?this._webglRenderer.DeleteTexture(k):this._splashTextures.powered=k}).catch(k=>console.warn("Failed to load splash image: ",k)),this._LoadBitmapSplashImage("splash-images/splash-website-512.png").then(k=>{"done"===this._splashState?this._webglRenderer.DeleteTexture(k):this._splashTextures.website=k}).catch(k=>console.warn("Failed to load splash image: ",k))))}async _LoadSvgSplashImage(g){g= (new URL(g,this._runtime.GetBaseURL())).toString();g=await e.FetchBlob(g);g=await this._runtime.RasterSvgImage(g,2048,2048);return await this._webglRenderer.CreateStaticTextureAsync(g,{mipMapQuality:"high"})}async _LoadBitmapSplashImage(g){g=(new URL(g,this._runtime.GetBaseURL())).toString();g=await e.FetchBlob(g);return await this._webglRenderer.CreateStaticTextureAsync(g,{mipMapQuality:"high"})}HideCordovaSplashScreen(){this._runtime.PostComponentMessageToDOM("runtime","hide-cordova-splash")}StartLoadingScreen(){this._loaderStartTime= Date.now();this._runtime.Dispatcher().addEventListener("loadingprogress",this._loadingprogress_handler);this._rafId=requestAnimationFrame(()=>this._DrawLoadingScreen());3!==this._runtime.GetLoaderStyle()&&this.HideCordovaSplashScreen()}async EndLoadingScreen(){if(this._webglRenderer){this._loadingProgress=1;var g=this._runtime.GetLoaderStyle();4===g&&await this._splashDonePromise;this._splashDonePromise=this._splashDoneResolve=null;-1!==this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId= -1);this._runtime.Dispatcher().removeEventListener("loadingprogress",this._loadingprogress_handler);this._loadingprogress_handler=null;this._percentText&&(this._percentText.Release(),this._percentText=null);this._runtime.ReleaseLoadingLogoAsset();this._webglRenderer.Start();this._splashTextures.logo&&(this._webglRenderer.DeleteTexture(this._splashTextures.logo),this._splashTextures.logo=null);this._splashTextures.powered&&(this._webglRenderer.DeleteTexture(this._splashTextures.powered),this._splashTextures.powered= null);this._splashTextures.website&&(this._webglRenderer.DeleteTexture(this._splashTextures.website),this._splashTextures.website=null);this._webglRenderer.ClearRgba(0,0,0,0);this._webglRenderer.Finish();this._splashState="done";this._gpuTimeStartFrame=this._webglRenderer.GetFrameNumber();3===g&&this.HideCordovaSplashScreen()}}_DrawLoadingScreen(){if(-1!==this._rafId){var g=this._webglRenderer;if(g){g.Start();this._rafId=-1;var k=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(k);else if(1===m)this._DrawProgressBarLoadingScreen(k,120,0);else if(2===m)this._DrawPercentTextLoadingScreen(k);else if(3===m)e.noop();else if(4===m)this._DrawSplashLoadingScreen(k);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 k=this._canvasCssHeight/2;f.setRect(g-150,k-100,g+150,k+100);this._webglRenderer.SetTexture(this._percentText.GetTexture());this._webglRenderer.Quad3(f,this._percentText.GetTexRect())}_DrawProgressBarLoadingScreen(g,k,m){const u=this._webglRenderer;u.SetColorFillMode();g?u.SetColorRgba(1,0,0,1):u.SetColorRgba(.118,.565,1,1);g=this._canvasCssWidth/2;const x= this._canvasCssHeight/2,n=k/2;l.setWH(g-n,x-4+m,Math.floor(k*this._loadingProgress),8);u.Rect(l);l.setWH(g-n,x-4+m,k,8);l.offset(-.5,-.5);l.inflate(.5,.5);u.SetColorRgba(0,0,0,1);u.LineRect2(l);l.inflate(1,1);u.SetColorRgba(1,1,1,1);u.LineRect2(l)}_DrawProgressBarAndLogoLoadingScreen(g){var k=this._runtime.GetLoadingLogoAsset();if(k)if(k=k.GetTexture()){var m=k.GetWidth(),u=k.GetHeight(),x=this._canvasCssWidth/2,n=this._canvasCssHeight/2,q=m/2;u/=2;f.setRect(x-q,n-u,x+q,n+u);this._webglRenderer.SetTexture(k); this._webglRenderer.Quad(f);this._DrawProgressBarLoadingScreen(g,m,u+16)}else this._DrawProgressBarLoadingScreen(g,120,0);else this._DrawProgressBarLoadingScreen(g,120,0)}_DrawSplashLoadingScreen(g){const k=this._webglRenderer,m=this._splashTextures.logo,u=this._splashTextures.powered,x=this._splashTextures.website,n=Date.now();0===this._splashFrameNumber&&(this._loaderStartTime=n);const q=this._runtime.IsPreview()||this._runtime.IsFBInstantAvailable()&&!this._runtime.IsCordova(),t=q?0:200,r=q?0: 3E3;let w=1;"fade-in"===this._splashState?w=Math.min((n-this._loaderStartTime)/300,1):"fade-out"===this._splashState&&(w=Math.max(1-(n-this._splashFadeOutStartTime)/300,0));k.SetColorFillMode();k.SetColorRgba(.231*w,.251*w,.271*w,w);l.set(0,0,this._canvasCssWidth,this._canvasCssHeight);k.Rect(l);const y=Math.ceil(this._canvasCssWidth),C=Math.ceil(this._canvasCssHeight);let D;256<this._canvasCssHeight?(k.SetColorRgba(.302*w,.334*w,.365*w,w),D=Math.max(.005*C,2),l.setWH(0,.8*C-D/2,y,D),k.Rect(l),g? k.SetColorRgba(w,0,0,w):k.SetColorRgba(.161*w,.953*w,.816*w,w),g=y*this._loadingProgress,l.setWH(.5*y-g/2,.8*C-D/2,g,D),k.Rect(l),k.SetColorRgba(w,w,w,w),k.SetTextureFillMode(),u&&(g=1.5*e.clamp(.22*C,105,.6*y),D=g/8,l.setWH(.5*y-g/2,.2*C-D/2,g,D),k.SetTexture(u),k.Rect(l)),m&&(D=g=Math.min(.395*C,.95*y),l.setWH(.5*y-g/2,.485*C-D/2,g,D),k.SetTexture(m),k.Rect(l)),x&&(g=1.5*e.clamp(.22*C,105,.6*y),D=g/8,l.setWH(.5*y-g/2,.868*C-D/2,g,D),k.SetTexture(x),k.Rect(l))):(k.SetColorRgba(.302*w,.334*w,.365* w,w),D=Math.max(.005*C,2),l.setWH(0,.85*C-D/2,y,D),k.Rect(l),g?k.SetColorRgba(w,0,0,w):k.SetColorRgba(.161*w,.953*w,.816*w,w),g=y*this._loadingProgress,l.setWH(.5*y-g/2,.85*C-D/2,g,D),k.Rect(l),k.SetColorRgba(w,w,w,w),k.SetTextureFillMode(),m&&(D=g=.55*C,l.setWH(.5*y-g/2,.45*C-D/2,g,D),k.SetTexture(m),k.Rect(l)));this._splashFrameNumber++;"fade-in"===this._splashState&&300<=n-this._loaderStartTime&&2<=this._splashFrameNumber&&(this._splashState="wait",this._splashFadeInFinishTime=n);"wait"===this._splashState&& n-this._splashFadeInFinishTime>=r&&1<=this._loadingProgress&&(this._splashState="fade-out",this._splashFadeOutStartTime=n);("fade-out"===this._splashState&&n-this._splashFadeOutStartTime>=300+t||q&&1<=this._loadingProgress&&500>n-this._loaderStartTime)&&this._splashDoneResolve()}}} {"use strict";const e=self.C3,b=self.C3Debugger,a={messagePort:null,baseUrl:"",headless:!1,hasDom:!0,isInWorker:!1,useAudio:!0,projectData:"",exportType:""};let d=!0;e.Runtime=class extends e.DefendedBase{constructor(c){c=Object.assign({},a,c);super();this._messagePort=c.messagePort;this._baseUrl=c.baseUrl;this._isHeadless=!!c.headless;this._hasDom=!!c.hasDom;this._isInWorker=!!c.isInWorker;d=c.ife;this._useAudio=!!c.useAudio;this._exportType=c.exportType;this._isiOSCordova=!!c.isiOSCordova;this._isiOSWebView= !!c.isiOSWebView;this._isFBInstantAvailable=!!c.isFBInstantAvailable;this._opusWasmScriptUrl=c.opusWasmScriptUrl;this._opusWasmBinaryUrl=c.opusWasmBinaryUrl;this._isDebugging=this._breakpointsEnabled=this._isDebug=!("preview"!==this._exportType||!c.isDebug);this._debuggingDisabled=0;this._additionalLoadPromises=[];this._additionalCreatePromises=[];this._isUsingCreatePromises=!1;this._appId=this._projectUniqueId=this._projectVersion=this._projectName="";this._originalViewportHeight=this._originalViewportWidth= 0;this._devicePixelRatio=self.devicePixelRatio;this._loaderStyle=this._viewportHeight=this._viewportWidth=this._parallaxYorigin=this._parallaxXorigin=0;this._usesLoaderLayout=!1;this._isLoading=!0;this._usesAnyBackgroundBlending=!1;this._loadingLogoAsset=null;this._assetManager=e.New(e.AssetManager,this,c);this._layoutManager=e.New(e.LayoutManager,this);this._eventSheetManager=e.New(e.EventSheetManager,this);this._pluginManager=e.New(e.PluginManager,this);this._collisionEngine=e.New(e.CollisionEngine, this);this._timelineManager=e.New(e.TimelineManager,this);this._transitionManager=e.New(e.TransitionManager,this);this._allObjectClasses=[];this._objectClassesByName=new Map;this._objectClassesBySid=new Map;this._familyCount=0;this._allContainers=[];this._allEffectLists=[];this._currentLayoutStack=[];this._instancesPendingCreate=[];this._instancesPendingDestroy=new Map;this._isFlushingPendingInstances=this._hasPendingInstances=!1;this._nextUid=this._objectCount=0;this._instancesByUid=new Map;this._instancesToReleaseAtEndOfTick= new Set;this._instancesToReleaseAffectedObjectClasses=new Set;this._objectReferenceTable=[];this._jsPropNameTable=[];this._canvasManager=null;this._uses3dFeatures=!1;this._framerateMode="vsync";this._compositingMode="standard";this._sampling="trilinear";this._isPixelRoundingEnabled=!1;this._needRender=!0;this._isPausedOnBlur=this._pauseOnBlur=!1;this._tickCallbacks={normal:f=>{this._ruafId=this._rafId=-1;this.Tick(f)},tickOnly:f=>{this._ruafId=-1;this.Tick(f,!1,"skip-render")},renderOnly:()=>{this._rafId= -1;this.Render()}};this._ruafId=this._rafId=-1;this._execCount=this._tickCountNoSave=this._tickCount=0;this._hasStartedTicking=this._isInTick=this._hasStarted=!1;this._isLayoutFirstTick=!0;this._suspendCount=0;this._scheduleTriggersThrottle=new e.PromiseThrottle(1);this._randomNumberCallback=()=>Math.random();this._dt=this._dt1=this._lastTickTime=this._startTime=0;this._timeScale=1;this._minimumFramerate=30;this._gameTime=e.New(e.KahanSum);this._gameTimeRaw=e.New(e.KahanSum);this._wallTime=e.New(e.KahanSum); this._fpsFrameCount=-1;this._mainThreadTime=this._mainThreadTimeCounter=this._fps=this._fpsLastTime=0;this._isLoadingState=!1;this._loadFromSlotName=this._saveToSlotName="";this._loadFromJson=null;this._lastSaveJson="";this._savegamesStorage=this._projectStorage=null;this._dispatcher=e.New(e.Event.Dispatcher);this._domEventHandlers=new Map;this._pendingResponsePromises=new Map;this._nextDomResponseId=0;this._isReadyToHandleEvents=this._didRequestDeviceMotionEvent=this._didRequestDeviceOrientationEvent= !1;this._waitingToHandleEvents=[];this._eventObjects={pretick:e.New(e.Event,"pretick",!1),tick:e.New(e.Event,"tick",!1),tick2:e.New(e.Event,"tick2",!1),instancedestroy:e.New(e.Event,"instancedestroy",!1),beforelayoutchange:e.New(e.Event,"beforelayoutchange",!1),layoutchange:e.New(e.Event,"layoutchange",!1)};this._eventObjects.instancedestroy.instance=null;this._userScriptDispatcher=e.New(e.Event.Dispatcher);this._userScriptEventObjects=null;this._behInstsToTick=e.New(e.RedBlackSet,e.BehaviorInstance.SortByTickSequence); this._behInstsToPostTick=e.New(e.RedBlackSet,e.BehaviorInstance.SortByTickSequence);this._behInstsToTick2=e.New(e.RedBlackSet,e.BehaviorInstance.SortByTickSequence);this._jobScheduler=e.New(e.JobSchedulerRuntime,this,c.jobScheduler);c.canvas&&(this._canvasManager=e.New(e.CanvasManager,this));this._messagePort.onmessage=f=>this._OnMessageFromDOM(f.data);this.AddDOMComponentMessageHandler("runtime","visibilitychange",f=>this._OnVisibilityChange(f));this.AddDOMComponentMessageHandler("runtime","opus-decode", f=>this._WasmDecodeWebMOpus(f.arrayBuffer));this.AddDOMComponentMessageHandler("runtime","get-remote-preview-status-info",()=>this._GetRemotePreviewStatusInfo());this.AddDOMComponentMessageHandler("runtime","js-invoke-function",f=>this._InvokeFunctionFromJS(f));this.AddDOMComponentMessageHandler("runtime","go-to-last-error-script",self.goToLastErrorScript);this._dispatcher.addEventListener("window-blur",f=>this._OnWindowBlur(f));this._dispatcher.addEventListener("window-focus",()=>this._OnWindowFocus()); this._timelineManager.AddRuntimeListeners();this._iRuntime=null;this._interfaceMap=new WeakMap;this._commonScriptInterfaces={keyboard:null,mouse:null,touch:null}}static Create(c){return e.New(e.Runtime,c)}Release(){e.clearArray(this._allObjectClasses);this._objectClassesByName.clear();this._objectClassesBySid.clear();this._layoutManager.Release();this._layoutManager=null;this._eventSheetManager.Release();this._eventSheetManager=null;this._pluginManager.Release();this._pluginManager=null;this._assetManager.Release(); this._assetManager=null;this._collisionEngine.Release();this._collisionEngine=null;this._timelineManager.Release();this._timelineManager=null;this._transitionManager.Release();this._transitionManager=null;this._canvasManager&&(this._canvasManager.Release(),this._canvasManager=null);this._dispatcher.Release();this._tickEvent=this._dispatcher=null}["_OnMessageFromDOM"](c){const f=c.type;if("event"===f)this._OnEventFromDOM(c);else if("result"===f)this._OnResultFromDOM(c);else throw Error(`unknown message '${f}'`); }_OnEventFromDOM(c){if(this._isReadyToHandleEvents){var f=c.component,l=c.handler,g=c.data,k=c.dispatchOpts,m=!(!k||!k.dispatchRuntimeEvent);k=!(!k||!k.dispatchUserScriptEvent);var u=c.responseId;if("runtime"===f&&(m&&(c=new e.Event(l),c.data=g,this._dispatcher.dispatchEventAndWaitAsyncSequential(c)),k)){c=new e.Event(l,!0);for(const [x,n]of Object.entries(g))c[x]=n;this.DispatchUserScriptEvent(c)}if(c=this._domEventHandlers.get(f))if(c=c.get(l)){m=null;try{m=c(g)}catch(x){console.error(`Exception in '${f}' handler '${l}':`, x);null!==u&&this._PostResultToDOM(u,!1,""+x);return}null!==u&&(m&&m.then?m.then(x=>this._PostResultToDOM(u,!0,x)).catch(x=>{console.error(`Rejection from '${f}' handler '${l}':`,x);this._PostResultToDOM(u,!1,""+x)}):this._PostResultToDOM(u,!0,m))}else m||k||console.warn(`[Runtime] No DOM handler '${l}' for component '${f}'`);else m||k||console.warn(`[Runtime] No DOM event handlers for component '${f}'`)}else this._waitingToHandleEvents.push(c)}_PostResultToDOM(c,f,l){this._messagePort.postMessage({type:"result", responseId:c,isOk:f,result:l})}_OnResultFromDOM(c){const f=c.responseId,l=c.isOk;c=c.result;const g=this._pendingResponsePromises.get(f);l?g.resolve(c):g.reject(c);this._pendingResponsePromises.delete(f)}AddDOMComponentMessageHandler(c,f,l){let g=this._domEventHandlers.get(c);g||(g=new Map,this._domEventHandlers.set(c,g));if(g.has(f))throw Error(`[Runtime] Component '${c}' already has handler '${f}'`);g.set(f,l)}PostComponentMessageToDOM(c,f,l){this._messagePort.postMessage({type:"event",component:c, handler:f,data:l,responseId:null})}PostComponentMessageToDOMAsync(c,f,l){const g=this._nextDomResponseId++,k=new Promise((m,u)=>{this._pendingResponsePromises.set(g,{resolve:m,reject:u})});this._messagePort.postMessage({type:"event",component:c,handler:f,data:l,responseId:g});return k}PostToDebugger(c){if(!this.IsDebug())throw Error("not in debug mode");this.PostComponentMessageToDOM("runtime","post-to-debugger",c)}async Init(c){this.IsDebug()?await b.Init(this):self.C3Debugger&&self.C3Debugger.InitPreview(this); var [f]=await Promise.all([this._assetManager.FetchJson("data.json"),this._MaybeLoadOpusDecoder(),this._jobScheduler.Init()]);this._LoadDataJson(f);await this._InitialiseCanvas(c);this.IsPreview()||console.info("Made with Construct 3, the game and app creator :: https://www.construct.net");this.GetWebGLRenderer()?(f=this.GetWebGLRenderer(),console.info(`[C3 runtime] Hosted in ${this.IsInWorker()?"worker":"DOM"}, rendering with WebGL ${f.GetWebGLVersionNumber()} [${f.GetUnmaskedRenderer()}] (${f.IsDesynchronized()? "desynchronized":"standard"} compositing)`)):this.GetWebGPURenderer()&&console.info(`[C3 runtime] Hosted in ${this.IsInWorker()?"worker":"DOM"}, rendering with experimental WebGPU`);this.GetRenderer().HasMajorPerformanceCaveat()&&console.warn("[C3 runtime] The renderer indicates a major performance caveat. Software rendering may be in use. This can result in significantly degraded performance.");this._isReadyToHandleEvents=!0;for(const l of this._waitingToHandleEvents)this._OnEventFromDOM(l);e.clearArray(this._waitingToHandleEvents); this._canvasManager&&this._canvasManager.StartLoadingScreen();for(const l of c.runOnStartupFunctions)this._additionalLoadPromises.push(this._RunOnStartupFunction(l));await Promise.all([this._assetManager.WaitForAllToLoad(),...this._additionalLoadPromises]);e.clearArray(this._additionalLoadPromises);if(this._assetManager.HasHadErrorLoading())this._canvasManager&&this._canvasManager.HideCordovaSplashScreen();else return this._canvasManager&&await this._canvasManager.EndLoadingScreen(),await this._dispatcher.dispatchEventAndWaitAsync(new e.Event("beforeruntimestart")), await this.Start(),this._messagePort.postMessage({type:"runtime-ready"}),this}async _RunOnStartupFunction(c){try{await c(this._iRuntime)}catch(f){console.error("[C3 runtime] Error in runOnStartup function: ",f)}}_LoadDataJson(c){c=c.project;this._projectName=c[0];this._projectVersion=c[16];this._projectUniqueId=c[31];this._appId=c[38];const f=c[39]||"loading-logo.png";this._isPixelRoundingEnabled=!!c[9];this._originalViewportWidth=this._viewportWidth=c[10];this._originalViewportHeight=this._viewportHeight= c[11];this._parallaxXorigin=this._originalViewportWidth/2;this._parallaxYorigin=this._originalViewportHeight/2;this._compositingMode=c[36];this._framerateMode=c[37];"low-latency"===this._compositingMode&&this.IsAndroidWebView()&&77>=e.Platform.BrowserVersionNumber&&(console.warn("[C3 runtime] Desynchronized (low-latency) compositing is enabled, but is disabled in the Android WebView <=77 due to crbug.com/1008842. Reverting to synchronized (standard) compositing."),this._compositingMode="standard"); this._uses3dFeatures=!!c[40];this._sampling=c[14];this._usesLoaderLayout=!!c[18];this._loaderStyle=c[19];this._nextUid=c[21];this._pauseOnBlur=c[22];const l=this._assetManager;l._SetAudioFiles(c[7],c[25]);l._SetMediaSubfolder(c[8]);l._SetFontsSubfolder(c[32]);l._SetIconsSubfolder(c[28]);l._SetWebFonts(c[29]);if(0===this._loaderStyle){let x="";this.IsPreview()?l._HasLocalUrlBlob(f)&&(x=l.GetLocalUrlAsBlobUrl(f)):x=l.GetIconsSubfolder()+f;x&&(this._loadingLogoAsset=l.LoadImage({url:x}))}this._canvasManager&& (this._canvasManager.SetFullscreenMode(e.CanvasManager._FullscreenModeNumberToString(c[12])),this._canvasManager.SetFullscreenScalingQuality(c[23]?"high":"low"),this._canvasManager.SetMipmapsEnabled(0!==c[24]),this._canvasManager._SetGPUPowerPreference(c[34]),this._canvasManager._SetTextureAnisotropy(c[41]),this._canvasManager._SetWebGPUEnabled(c[13]));this._pluginManager.CreateSystemPlugin();this._objectReferenceTable=self.C3_GetObjectRefTable();for(var g of c[2])this._pluginManager.CreatePlugin(g); this._objectReferenceTable=self.C3_GetObjectRefTable();this._LoadJsPropNameTable();for(var k of c[3])g=e.ObjectClass.Create(this,this._allObjectClasses.length,k),this._allObjectClasses.push(g),this._objectClassesByName.set(g.GetName().toLowerCase(),g),this._objectClassesBySid.set(g.GetSID(),g);for(const x of c[4])this._allObjectClasses[x[0]]._LoadFamily(x);for(var m of c[27])k=m.map(x=>this._allObjectClasses[x]),this._allContainers.push(e.New(e.Container,this,k));for(const x of this._allObjectClasses)x._OnAfterCreate(); for(const x of c[5])this._layoutManager.Create(x);(m=c[1])&&(m=this._layoutManager.GetLayoutByName(m))&&this._layoutManager.SetFirstLayout(m);for(var u of c[33])this._timelineManager.Create(u);for(const x of c[35])this._transitionManager.Create(x);this._InitScriptInterfaces();for(const x of c[6])this._eventSheetManager.Create(x);this._eventSheetManager._PostInit();this._InitGlobalVariableScriptInterface();e.clearArray(this._objectReferenceTable);this.FlushPendingInstances();u="any";c=c[20];1===c? u="portrait":2===c&&(u="landscape");this.PostComponentMessageToDOM("runtime","set-target-orientation",{targetOrientation:u})}GetLoaderStyle(){return this._loaderStyle}IsFBInstantAvailable(){return this._isFBInstantAvailable}IsLoading(){return this._isLoading}AddLoadPromise(c){this._additionalLoadPromises.push(c)}SetUsingCreatePromises(c){this._isUsingCreatePromises=!!c}AddCreatePromise(c){this._isUsingCreatePromises&&this._additionalCreatePromises.push(c)}GetCreatePromises(){return this._additionalCreatePromises}_GetNextFamilyIndex(){return this._familyCount++}GetFamilyCount(){return this._familyCount}_AddEffectList(c){this._allEffectLists.push(c)}_GetAllEffectLists(){return this._allEffectLists}async _InitialiseCanvas(c){this._canvasManager&& (await this._canvasManager.CreateCanvas(c),this._canvasManager.InitLoadingScreen(this._loaderStyle))}async _MaybeLoadOpusDecoder(){if(!this._assetManager.IsAudioFormatSupported("audio/webm; codecs=opus")){var c=null;try{c=this.IsiOSCordova()&&this._assetManager.IsFileProtocol()?await this._assetManager.CordovaFetchLocalFileAsArrayBuffer(this._opusWasmBinaryUrl):await this._assetManager.FetchArrayBuffer(this._opusWasmBinaryUrl)}catch(f){console.info("Failed to fetch Opus decoder WASM; assuming project has no Opus audio.", f);return}c?this.AddJobWorkerBuffer(c,"opus-decoder-wasm"):this.AddJobWorkerBlob(null,"opus-decoder-wasm");await this.AddJobWorkerScripts([this._opusWasmScriptUrl])}}async _WasmDecodeWebMOpus(c){return await this.AddJob("OpusDecode",{arrayBuffer:c},[c])}async Start(){this._hasStarted=!0;this._startTime=Date.now();if(this._usesLoaderLayout){for(var c of this._allObjectClasses)c.IsFamily()||c.IsOnLoaderLayout()||!c.IsWorldType()||c.OnCreate();this._assetManager.WaitForAllToLoad().then(()=>{this._isLoading= !1;this._OnLoadFinished()})}else this._isLoading=!1;this._assetManager.SetInitialLoadFinished();this.IsDebug()&&b.RuntimeInit(d);for(const f of this._layoutManager.GetAllLayouts())f._CreateGlobalNonWorlds();c=this._layoutManager.GetFirstLayout();await c._Load(null,this.GetRenderer());await c._StartRunning(!0);this._fpsLastTime=performance.now();this._usesLoaderLayout||this._OnLoadFinished();(await this.PostComponentMessageToDOMAsync("runtime","before-start-ticking")).isSuspended?this._suspendCount++: this.Tick()}_OnLoadFinished(){this.Trigger(e.Plugins.System.Cnds.OnLoadFinished,null,null);this.PostComponentMessageToDOM("runtime","register-sw")}GetObjectReference(c){c=Math.floor(c);const f=this._objectReferenceTable;if(0>c||c>=f.length)throw Error("invalid object reference");return f[c]}_LoadJsPropNameTable(){for(const c of self.C3_JsPropNameTable){const f=e.first(Object.keys(c));this._jsPropNameTable.push(f)}}GetJsPropName(c){c=Math.floor(c);const f=this._jsPropNameTable;if(0>c||c>=f.length)throw Error("invalid prop reference"); return f[c]}HasDOM(){return this._hasDom}IsHeadless(){return this._isHeadless}IsInWorker(){return this._isInWorker}GetBaseURL(){return this._baseUrl}GetEventSheetManager(){return this._eventSheetManager}GetEventStack(){return this._eventSheetManager.GetEventStack()}GetCurrentEventStackFrame(){return this._eventSheetManager.GetCurrentEventStackFrame()}GetCurrentEvent(){return this._eventSheetManager.GetCurrentEvent()}GetCurrentCondition(){return this._eventSheetManager.GetCurrentCondition()}IsCurrentConditionFirst(){return 0=== this.GetCurrentEventStackFrame().GetConditionIndex()}GetCurrentAction(){return this._eventSheetManager.GetCurrentAction()}GetPluginManager(){return this._pluginManager}GetSystemPlugin(){return this._pluginManager.GetSystemPlugin()}GetObjectClassByIndex(c){c=Math.floor(c);if(0>c||c>=this._allObjectClasses.length)throw new RangeError("invalid index");return this._allObjectClasses[c]}GetObjectClassByName(c){return this._objectClassesByName.get(c.toLowerCase())||null}GetObjectClassBySID(c){return this._objectClassesBySid.get(c)|| null}GetSingleGlobalObjectClassByCtor(c){return(c=this._pluginManager.GetPluginByConstructorFunction(c))?c.GetSingleGlobalObjectClass():null}GetAllObjectClasses(){return this._allObjectClasses}*allInstances(){for(const c of this._allObjectClasses)c.IsFamily()||(yield*c.instances())}Dispatcher(){return this._dispatcher}UserScriptDispatcher(){return this._userScriptDispatcher}DispatchUserScriptEvent(c){c.runtime=this.GetIRuntime();const f=this.IsDebug()&&!this._eventSheetManager.IsInEventEngine();f&& b.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(c);f&&b.AddScriptTime()}DispatchUserScriptEventAsyncWait(c){c.runtime=this.GetIRuntime();return this._userScriptDispatcher.dispatchEventAndWaitAsync(c)}GetOriginalViewportWidth(){return this._originalViewportWidth}GetOriginalViewportHeight(){return this._originalViewportHeight}SetOriginalViewportSize(c,f){if(this._originalViewportWidth!==c||this._originalViewportHeight!==f)this._originalViewportWidth=c,this._originalViewportHeight= f,c=this.GetLayoutManager(),c.SetAllLayerProjectionChanged(),c.SetAllLayerMVChanged()}GetViewportWidth(){return this._viewportWidth}GetViewportHeight(){return this._viewportHeight}SetViewportSize(c,f){if(this._viewportWidth!==c||this._viewportHeight!==f)this._viewportWidth=c,this._viewportHeight=f,c=this.GetLayoutManager(),c.SetAllLayerProjectionChanged(),c.SetAllLayerMVChanged()}_SetDevicePixelRatio(c){this._devicePixelRatio=c}GetDevicePixelRatio(){return this._devicePixelRatio}GetParallaxXOrigin(){return this._parallaxXorigin}GetParallaxYOrigin(){return this._parallaxYorigin}GetCanvasManager(){return this._canvasManager}GetDrawWidth(){return this._canvasManager? this._canvasManager.GetDrawWidth():this._viewportWidth}GetDrawHeight(){return this._canvasManager?this._canvasManager.GetDrawHeight():this._viewportHeight}GetRenderScale(){return this._canvasManager?this._canvasManager.GetRenderScale():1}GetDisplayScale(){return this._canvasManager?this._canvasManager.GetDisplayScale():1}GetCanvasClientX(){return this._canvasManager?this._canvasManager.GetCanvasClientX():0}GetCanvasClientY(){return this._canvasManager?this._canvasManager.GetCanvasClientY():0}GetCanvasCssWidth(){return this._canvasManager? this._canvasManager.GetCssWidth():0}GetCanvasCssHeight(){return this._canvasManager?this._canvasManager.GetCssHeight():0}GetFullscreenMode(){return this._canvasManager?this._canvasManager.GetFullscreenMode():"off"}GetAdditionalRenderTarget(c){return this._canvasManager?this._canvasManager.GetAdditionalRenderTarget(c):null}ReleaseAdditionalRenderTarget(c){this._canvasManager&&this._canvasManager.ReleaseAdditionalRenderTarget(c)}_SetUsesAnyBackgroundBlending(c){this._usesAnyBackgroundBlending=!!c}UsesAnyBackgroundBlending(){return this._usesAnyBackgroundBlending}GetGPUUtilisation(){return this._canvasManager? this._canvasManager.GetGPUUtilisation():NaN}IsLinearSampling(){return"nearest"!==this.GetSampling()}GetFramerateMode(){return this._framerateMode}GetCompositingMode(){return this._compositingMode}GetSampling(){return this._sampling}UsesLoaderLayout(){return this._usesLoaderLayout}GetLoadingLogoAsset(){return this._loadingLogoAsset}ReleaseLoadingLogoAsset(){this._loadingLogoAsset&&(this._loadingLogoAsset.Release(),this._loadingLogoAsset=null)}GetLayoutManager(){return this._layoutManager}GetMainRunningLayout(){return this._layoutManager.GetMainRunningLayout()}GetTimelineManager(){return this._timelineManager}GetTransitionManager(){return this._transitionManager}GetAssetManager(){return this._assetManager}LoadImage(c){return this._assetManager.LoadImage(c)}CreateInstance(c, f,l,g,k){return this.CreateInstanceFromData(c,f,!1,l,g,!1,k,void 0,k)}CreateInstanceFromData(c,f,l,g,k,m,u,x,n){var q=null;let t=null;if(c instanceof e.ObjectClass){t=c;if(t.IsFamily()){c=t.GetFamilyMembers();var r=Math.floor(this.Random()*c.length);t=c[r]}q=t.GetDefaultInstanceData()}else q=c,t=this.GetObjectClassByIndex(q[1]);var w=t.GetPlugin().IsWorldType();if(this._isLoading&&w&&!t.IsOnLoaderLayout())return null;const y=f;w||(f=null);var C=l&&!m&&q&&!this._instancesByUid.has(q[2])?q[2]:this._nextUid++; r=q?q[0]:null;c=e.New(e.Instance,{runtime:this,objectType:t,layer:f,worldData:r,instVarData:q?q[3]:null,uid:C});this._instancesByUid.set(C,c);C=null;w&&(C=c.GetWorldInfo(),"undefined"!==typeof g&&"undefined"!==typeof k&&(C.SetX(g),C.SetY(k)),t._SetAnyCollisionCellChanged(!0));f&&(n||f._AddInstance(c,!0),1===f.GetParallaxX()&&1===f.GetParallaxY()||t._SetAnyInstanceParallaxed(!0),f.GetLayout().MaybeLoadTexturesFor(t));this._objectCount++;let D=!0;if(x){var G=x.GetObjectClass();G.IsInContainer()&&t.IsInContainer()&& (x=t.GetContainer(),G=G.GetContainer(),x===G&&(D=!1))}if(t.IsInContainer()&&!l&&!m&&D){for(var K of t.GetContainer().objectTypes())K!==t&&(x=this.CreateInstanceFromData(K,y,!1,C?C.GetX():g,C?C.GetY():k,!0,!1,void 0,n),c._AddSibling(x));for(var B of c.siblings()){B._AddSibling(c);for(const A of c.siblings())B!==A&&B._AddSibling(A)}}w&&!l&&u&&this._CreateChildInstancesFromData(c,r,C,f,g,k,n);if(t.IsInContainer()&&!l&&!m&&u)for(const A of c.siblings())if(l=A.GetWorldInfo())K=A.GetPlugin(),B=A.GetObjectClass().GetDefaultInstanceData()[0], K.IsWorldType()?this._CreateChildInstancesFromData(A,B,l,f,l.GetX(),l.GetY(),n):this._CreateChildInstancesFromData(A,B,l,f,void 0,void 0,n);!m&&u&&("undefined"===typeof g&&(g=r[0]),"undefined"===typeof k&&(k=r[1]),f=C.GetTopParent(),g=g-C.GetX()+f.GetX(),k=k-C.GetY()+f.GetY(),f.SetXY(g,k));t._SetIIDsStale();k=q?e.cloneArray(q[5]):null;q=q?q[4].map(A=>e.cloneArray(A)):null;(w=w&&r&&r[13])&&c._SetHasTilemap();c._CreateSdkInstance(k,q);w&&(r=r[13],c.GetSdkInstance().LoadTilemapData(r[2],r[0],r[1])); this._instancesPendingCreate.push(c);this._hasPendingInstances=!0;this.IsDebug()&&b.InstanceCreated(c);return c}_CreateChildInstancesFromData(c,f,l,g,k,m,u){var x=l.GetSceneGraphZIndexExportData(),n=l.GetSceneGraphChildrenExportData();c.GetWorldInfo().SetSceneGraphZIndex(x);if(n){"undefined"===typeof k&&(k=f[0]);"undefined"===typeof m&&(m=f[1]);x=new Set;l=f[0];f=f[1];for(const y of n){var q=y[1],t=y[2];n=y[3];var r=!!y[4];const C=y[5];t=this._layoutManager.GetLayoutBySID(y[0]).GetLayer(q).GetInitialInstanceData(t); q=this.GetObjectClassByIndex(t[1]);var w=c.HasSibling(q);const D=x.has(q);w&&!D&&r?(r=c.GetSibling(q),w=k+t[0][0]-l,t=m+t[0][1]-f,r.GetWorldInfo().SetXY(w,t),r.GetWorldInfo().SetSceneGraphZIndex(C),c.AddChild(r,{transformX:!!(n>>0&1),transformY:!!(n>>1&1),transformWidth:!!(n>>2&1),transformHeight:!!(n>>3&1),transformAngle:!!(n>>4&1),destroyWithParent:!!(n>>5&1),transformZElevation:!!(n>>6&1)}),x.add(q)):(q=this.CreateInstanceFromData(t,g,!1,k+t[0][0]-l,m+t[0][1]-f,!1,!0,c,u),q.GetWorldInfo().SetSceneGraphZIndex(C), c.AddChild(q,{transformX:!!(n>>0&1),transformY:!!(n>>1&1),transformWidth:!!(n>>2&1),transformHeight:!!(n>>3&1),transformAngle:!!(n>>4&1),destroyWithParent:!!(n>>5&1),transformZElevation:!!(n>>6&1)}))}}}DestroyInstance(c){if(!this._instancesToReleaseAtEndOfTick.has(c)){var f=c.GetObjectClass(),l=this._instancesPendingDestroy.get(f);if(l){if(l.has(c))return;l.add(c)}else l=new Set,l.add(c),this._instancesPendingDestroy.set(f,l);this.IsDebug()&&b.InstanceDestroyed(c);c._MarkDestroyed();this._hasPendingInstances= !0;if(c.IsInContainer())for(const g of c.siblings())this.DestroyInstance(g);for(const g of c.children())g.GetDestroyWithParent()&&this.DestroyInstance(g);this._layoutManager.IsEndingLayout()||this._isLoadingState||(f=this.GetEventSheetManager(),f.BlockFlushingInstances(!0),c._TriggerOnDestroyed(),f.BlockFlushingInstances(!1));c._FireDestroyedScriptEvents(this._layoutManager.IsEndingLayout())}}FlushPendingInstances(){this._hasPendingInstances&&(this._isFlushingPendingInstances=!0,this._FlushInstancesPendingCreate(), this._FlushInstancesPendingDestroy(),this._hasPendingInstances=this._isFlushingPendingInstances=!1,this.UpdateRender())}_FlushInstancesPendingCreate(){for(const c of this._instancesPendingCreate){const f=c.GetObjectClass();f._AddInstance(c);for(const l of f.GetFamilies())l._AddInstance(c),l._SetIIDsStale()}e.clearArray(this._instancesPendingCreate)}_FlushInstancesPendingDestroy(){this._dispatcher.SetDelayRemoveEventsEnabled(!0);for(const [c,f]of this._instancesPendingDestroy.entries())this._FlushInstancesPendingDestroyForObjectClass(c, f),f.clear();this._instancesPendingDestroy.clear();this._dispatcher.SetDelayRemoveEventsEnabled(!1)}_FlushInstancesPendingDestroyForObjectClass(c,f){for(const g of f){var l=this._eventObjects.instancedestroy;l.instance=g;this._dispatcher.dispatchEvent(l);this._instancesByUid.delete(g.GetUID());if(l=g.GetWorldInfo())l._RemoveFromCollisionCells(),l._RemoveFromRenderCells(),l._MarkDestroyed();this._instancesToReleaseAtEndOfTick.add(g);this._objectCount--}e.arrayRemoveAllInSet(c.GetInstances(),f);c._SetIIDsStale(); this._instancesToReleaseAffectedObjectClasses.add(c);0===c.GetInstances().length&&c._SetAnyInstanceParallaxed(!1);for(const g of c.GetFamilies())e.arrayRemoveAllInSet(g.GetInstances(),f),g._SetIIDsStale(),this._instancesToReleaseAffectedObjectClasses.add(g);if(c.GetPlugin().IsWorldType()){c=new Set([...f].map(g=>g.GetWorldInfo().GetLayer()));for(const g of c)g._RemoveAllInstancesInSet(f)}}_GetInstancesPendingCreate(){return this._instancesPendingCreate}*instancesPendingCreateForObjectClass(c){for(const f of this._GetInstancesPendingCreate())c.IsFamily()? f.GetObjectClass().BelongsToFamily(c)&&(yield f):f.GetObjectClass()===c&&(yield f)}_GetNewUID(){return this._nextUid++}_MapInstanceByUID(c,f){this._instancesByUid.set(c,f)}_OnWebGLContextLost(){this._dispatcher.dispatchEvent(e.New(e.Event,"webglcontextlost"));this.SetSuspended(!0);for(var c of this._allObjectClasses)!c.IsFamily()&&c.HasLoadedTextures()&&c.ReleaseTextures();(c=this.GetMainRunningLayout())&&c._OnWebGLContextLost();e.ImageInfo.OnWebGLContextLost();e.ImageAsset.OnWebGLContextLost()}async _OnWebGLContextRestored(){await this.GetMainRunningLayout()._Load(null, this.GetWebGLRenderer());this._dispatcher.dispatchEvent(e.New(e.Event,"webglcontextrestored"));this.SetSuspended(!1);this.UpdateRender()}_OnVisibilityChange(c){this.SetSuspended(c.hidden)}_OnWindowBlur(c){this.IsPreview()&&this._pauseOnBlur&&!e.Platform.IsMobile&&!c.data.parentHasFocus&&(this.SetSuspended(!0),this._isPausedOnBlur=!0)}_OnWindowFocus(){this._isPausedOnBlur&&(this.SetSuspended(!1),this._isPausedOnBlur=!1)}_RequestAnimationFrame(){const c=this._tickCallbacks;"vsync"===this._framerateMode? -1===this._rafId&&(this._rafId=self.requestAnimationFrame(c.normal)):"unlimited-tick"===this._framerateMode?(-1===this._ruafId&&(this._ruafId=e.RequestUnlimitedAnimationFrame(c.tickOnly)),-1===this._rafId&&(this._rafId=self.requestAnimationFrame(c.renderOnly))):-1===this._ruafId&&(this._ruafId=e.RequestUnlimitedAnimationFrame(c.normal))}_CancelAnimationFrame(){-1!==this._rafId&&(self.cancelAnimationFrame(this._rafId),this._rafId=-1);-1!==this._ruafId&&(e.CancelUnlimitedAnimationFrame(this._ruafId), this._ruafId=-1)}IsSuspended(){return 0<this._suspendCount}SetSuspended(c){var f=this.IsSuspended();this._suspendCount+=c?1:-1;0>this._suspendCount&&(this._suspendCount=0);c=this.IsSuspended();!f&&c?(console.log("[Construct 3] Suspending"),this._CancelAnimationFrame(),this._dispatcher.dispatchEvent(e.New(e.Event,"suspend")),this.Trigger(e.Plugins.System.Cnds.OnSuspend,null,null)):f&&!c&&(console.log("[Construct 3] Resuming"),this._fpsLastTime=this._lastTickTime=f=performance.now(),this._mainThreadTimeCounter= this._mainThreadTime=this._fps=this._fpsFrameCount=0,this._dispatcher.dispatchEvent(e.New(e.Event,"resume")),this.Trigger(e.Plugins.System.Cnds.OnResume,null,null),this.HitBreakpoint()||this.Tick(f))}_AddBehInstToTick(c){this._behInstsToTick.Add(c)}_AddBehInstToPostTick(c){this._behInstsToPostTick.Add(c)}_AddBehInstToTick2(c){this._behInstsToTick2.Add(c)}_RemoveBehInstToTick(c){this._behInstsToTick.Remove(c)}_RemoveBehInstToPostTick(c){this._behInstsToPostTick.Remove(c)}_RemoveBehInstToTick2(c){this._behInstsToTick2.Remove(c)}_BehaviorTick(){this._behInstsToTick.SetQueueingEnabled(!0); for(const c of this._behInstsToTick)c.Tick();this._behInstsToTick.SetQueueingEnabled(!1)}_BehaviorPostTick(){this._behInstsToPostTick.SetQueueingEnabled(!0);for(const c of this._behInstsToPostTick)c.PostTick();this._behInstsToPostTick.SetQueueingEnabled(!1)}_BehaviorTick2(){this._behInstsToTick2.SetQueueingEnabled(!0);for(const c of this._behInstsToTick2)c.Tick2();this._behInstsToTick2.SetQueueingEnabled(!1)}*_DebugBehaviorTick(){this._behInstsToTick.SetQueueingEnabled(!0);for(const c of this._behInstsToTick){const f= c.Tick();e.IsIterator(f)&&(yield*f)}this._behInstsToTick.SetQueueingEnabled(!1)}*_DebugBehaviorPostTick(){this._behInstsToPostTick.SetQueueingEnabled(!0);for(const c of this._behInstsToPostTick){const f=c.PostTick();e.IsIterator(f)&&(yield*f)}this._behInstsToPostTick.SetQueueingEnabled(!1)}*_DebugBehaviorTick2(){this._behInstsToTick2.SetQueueingEnabled(!0);for(const c of this._behInstsToTick2){const f=c.Tick2();e.IsIterator(f)&&(yield*f)}this._behInstsToTick2.SetQueueingEnabled(!1)}async Tick(c,f, l){this._hasStartedTicking=!0;const g="background-wake"===l;l="background-wake"!==l&&"skip-render"!==l;this._hasStarted&&(!this.IsSuspended()||f||g)&&(f=performance.now(),this._isInTick=!0,this._MeasureDt(c||0),c=this.Step_BeforePreTick(),this.IsDebugging()&&await c,c=this._dispatcher.dispatchEventAndWait_AsyncOptional(this._eventObjects.pretick),c instanceof Promise&&await c,c=this.Step_AfterPreTick(),this.IsDebugging()&&await c,this._NeedsHandleSaveOrLoad()&&await this._HandleSaveOrLoad(),this.GetLayoutManager().IsPendingChangeMainLayout()&& await this._MaybeChangeLayout(),c=this.Step_RunEventsEtc(),this.IsDebugging()&&await c,l&&this.Render(),this.IsSuspended()||g||this._RequestAnimationFrame(),this._tickCount++,this._tickCountNoSave++,this._execCount++,this._isInTick=!1,this._mainThreadTimeCounter+=performance.now()-f)}async Step_BeforePreTick(){const c=this._eventSheetManager,f=this.IsDebug();this.FlushPendingInstances();c.BlockFlushingInstances(!0);this.PushCurrentLayout(this.GetMainRunningLayout());f&&b.StartMeasuringTime();this.IsDebugging()? await c.DebugRunScheduledWaits():c.RunScheduledWaits();f&&b.AddEventsTime();this.PopCurrentLayout();c.BlockFlushingInstances(!1);this.FlushPendingInstances();c.BlockFlushingInstances(!0)}async Step_AfterPreTick(){const c=this.IsDebug(),f=this.IsDebugging(),l=this._dispatcher,g=this._eventObjects,k=this._userScriptEventObjects;c&&b.StartMeasuringTime();f?await this.DebugIterateAndBreak(this._DebugBehaviorTick()):this._BehaviorTick();f?await this.DebugIterateAndBreak(this._DebugBehaviorPostTick()): this._BehaviorPostTick();c&&b.AddBehaviorTickTime();c&&b.StartMeasuringTime();f?await this.DebugFireGeneratorEventAndBreak(g.tick):l.dispatchEvent(g.tick);c&&b.AddPluginTickTime();this._eventSheetManager.BlockFlushingInstances(!1);this.DispatchUserScriptEvent(k.tick)}async Step_RunEventsEtc(){const c=this._eventSheetManager,f=this._dispatcher,l=this._eventObjects,g=this.IsDebug(),k=this.IsDebugging();g&&b.StartMeasuringTime();k?await c.DebugRunEvents(this._layoutManager):c.RunEvents(this._layoutManager); g&&b.AddEventsTime();this._collisionEngine.ClearRegisteredCollisions();this._ReleaseInstancesAtEndOfTick();this._isLayoutFirstTick=!1;c.BlockFlushingInstances(!0);g&&b.StartMeasuringTime();k?await this.DebugIterateAndBreak(this._DebugBehaviorTick2()):this._BehaviorTick2();g&&b.AddBehaviorTickTime();g&&b.StartMeasuringTime();k?await this.DebugFireGeneratorEventAndBreak(l.tick2):f.dispatchEvent(l.tick2);g&&b.AddPluginTickTime();c.BlockFlushingInstances(!1);k&&await c.RunQueuedDebugTriggersAsync()}_ReleaseInstancesAtEndOfTick(){if(0!== this._instancesToReleaseAtEndOfTick.size){var c=this._dispatcher;c.SetDelayRemoveEventsEnabled(!0);for(const f of this._instancesToReleaseAffectedObjectClasses)f.GetSolStack().RemoveInstances(this._instancesToReleaseAtEndOfTick);this._instancesToReleaseAffectedObjectClasses.clear();this._eventSheetManager.RemoveInstancesFromScheduledWaits(this._instancesToReleaseAtEndOfTick);for(const f of this._instancesToReleaseAtEndOfTick)f.Release();this._instancesToReleaseAtEndOfTick.clear();c.SetDelayRemoveEventsEnabled(!1)}}async _MaybeChangeLayout(){const c= this.GetLayoutManager();let f=0;for(;c.IsPendingChangeMainLayout()&&10>f++;)await this._DoChangeLayout(c.GetPendingChangeMainLayout())}_MeasureDt(c){let f=0;0!==this._lastTickTime&&(f=Math.max(c-this._lastTickTime,0)/1E3,.5<f&&(f=0),this._dt1=Math.min(f,1/this._minimumFramerate));this._lastTickTime=c;this._dt=this._dt1*this._timeScale;this._gameTime.Add(this._dt);this._gameTimeRaw.Add(f*this._timeScale);this._wallTime.Add(this._dt1);this._canvasManager&&this._canvasManager._UpdateTick();1E3<=c-this._fpsLastTime&& (this._fpsLastTime+=1E3,1E3<=c-this._fpsLastTime&&(this._fpsLastTime=c),this._fps=this._fpsFrameCount,this._fpsFrameCount=0,this._mainThreadTime=Math.min(this._mainThreadTimeCounter/1E3,1),this._mainThreadTimeCounter=0,this._canvasManager&&this._canvasManager._Update1sFrameRange(),this._collisionEngine._Update1sStats(),this.IsDebug()&&b.Update1sPerfStats());this._fpsFrameCount++}async _DoChangeLayout(c){const f=this._dispatcher,l=this.GetLayoutManager().GetMainRunningLayout();await l._StopRunning(); l._Unload(c,this.GetRenderer());l===c&&this._eventSheetManager.ClearAllScheduledWaits();this._collisionEngine.ClearRegisteredCollisions();this._ReleaseInstancesAtEndOfTick();f.dispatchEvent(this._eventObjects.beforelayoutchange);e.Asyncify.SetHighThroughputMode(!0);await c._Load(l,this.GetRenderer());e.Asyncify.SetHighThroughputMode(!1);await c._StartRunning(!1);f.dispatchEvent(this._eventObjects.layoutchange);this.UpdateRender();this._isLayoutFirstTick=!0;this.FlushPendingInstances()}UpdateRender(){this._needRender= !0}GetWebGLRenderer(){return this._canvasManager?this._canvasManager.GetWebGLRenderer():null}GetWebGPURenderer(){return this._canvasManager?this._canvasManager.GetWebGPURenderer():null}GetRenderer(){return this._canvasManager?this._canvasManager.GetRenderer():null}Render(){const c=this._canvasManager;if(c&&!c.IsRendererContextLost()){var f=this.GetRenderer(),l=f.SupportsGPUProfiling(),g=l&&f.IsWebGL();l=l&&f.IsWebGPU();g&&f.CheckForQueryResults();if(this._needRender){var k=this._layoutManager.GetMainRunningLayout(); f.Start();var m=this.IsDebug();m&&b.StartMeasuringTime();this._needRender=!1;var u=null;g&&(u=c.GetGPUFrameTimingsBuffer().AddTimeElapsedQuery(),f.StartQuery(u));g=null;l&&(g=f.StartFrameTiming(2*(1+k.GetLayerCount())),f.WriteTimestamp(0));this.Uses3DFeatures()&&"low"===c.GetCurrentFullscreenScalingQuality()?f.SetFixedSizeDepthBuffer(c.GetDrawWidth(),c.GetDrawHeight()):f.SetAutoSizeDepthBuffer();this._Render(this.GetRenderer(),k);u&&f.EndQuery(u);l&&(f.WriteTimestamp(1),this._canvasManager._AddWebGPUFrameTiming(g)); f.Finish();m&&(b.AddDrawCallsTime(),b.UpdateInspectHighlight());c&&c._MaybeTakeSnapshot()}else f.IncrementFrameNumber()}}_Render(c,f){c.SetTextureFillMode();c.SetAlphaBlend();c.SetColorRgba(1,1,1,1);c.SetRenderTarget(null);c.SetTexture(null);c.SetDepthEnabled(this.Uses3DFeatures());f.Draw(c)}Trigger(c,f,l){if(!this._hasStarted)return!1;var g=!this._isInTick&&!this._eventSheetManager.IsInTrigger();let k=0;g&&(k=performance.now());const m=this.IsDebug();m&&this.SetDebuggingEnabled(!1);c=this._eventSheetManager._Trigger(this._layoutManager, c,f,l);g&&(g=performance.now()-k,this._mainThreadTimeCounter+=g,m&&b.AddTriggersTime(g));m&&this.SetDebuggingEnabled(!0);return c}DebugTrigger(c,f,l){if(!this.IsDebug())return this.Trigger(c,f,l);if(this.HitBreakpoint())throw Error("called DebugTrigger() while stopped on breakpoint");if(!this._isInTick&&!this._eventSheetManager.IsInTrigger())throw Error("called DebugTrigger() outside of event code - use TriggerAsync() instead");return this._eventSheetManager._DebugTrigger(this._layoutManager,c,f, l)}async TriggerAsync(c,f,l){if(!this.IsDebugging())return this.Trigger(c,f,l);if(!this._hasStarted)return!1;if(this.HitBreakpoint())return this._eventSheetManager.QueueDebugTrigger(c,f,l);if(!this.GetMainRunningLayout())return this._eventSheetManager.QueueTrigger(c,f,l);const g=performance.now();c=this._eventSheetManager._DebugTrigger(this._layoutManager,c,f,l);for(f=c.next();!f.done;)await this.DebugBreak(f.value),f=c.next();this.IsSuspended()||this._eventSheetManager.IsInTrigger()||(await this._eventSheetManager.RunQueuedDebugTriggersAsync(), this._hasStartedTicking&&!this._isInTick&&this._RequestAnimationFrame());this._mainThreadTimeCounter+=performance.now()-g;return f.value}FastTrigger(c,f,l){const g=this.IsDebug();g&&this.SetDebuggingEnabled(!1);c=this._eventSheetManager._FastTrigger(this._layoutManager,c,f,l);g&&this.SetDebuggingEnabled(!0);return c}DebugFastTrigger(c,f,l){return this._eventSheetManager._DebugFastTrigger(this._layoutManager,c,f,l)}ScheduleTriggers(c){return this._scheduleTriggersThrottle.Add(c)}PushCurrentLayout(c){this._currentLayoutStack.push(c)}PopCurrentLayout(){if(!this._currentLayoutStack.length)throw Error("layout stack empty"); this._currentLayoutStack.pop()}GetCurrentLayout(){return this._currentLayoutStack.length?this._currentLayoutStack.at(-1):this.GetMainRunningLayout()}GetDt(c){return c&&-1!==c.GetTimeScale()?this._dt1*c.GetTimeScale():this._dt}_GetDtFast(){return this._dt}GetDt1(){return this._dt1}GetTimeScale(){return this._timeScale}SetTimeScale(c){if(isNaN(c)||0>c)c=0;this._timeScale=c}SetMinimumFramerate(c){this._minimumFramerate=e.clamp(c,1,120)}GetMinimumFramerate(){return this._minimumFramerate}GetFPS(){return this._fps}GetMainThreadTime(){return this._mainThreadTime}GetStartTime(){return this._startTime}GetGameTime(){return this._gameTime.Get()}GetGameTimeRaw(){return this._gameTimeRaw.Get()}GetWallTime(){return this._wallTime.Get()}GetTickCount(){return this._tickCount}GetTickCountNoSave(){return this._tickCountNoSave}IncrementExecCount(){++this._execCount}GetExecCount(){return this._execCount}GetObjectCount(){return this._objectCount}GetProjectName(){return this._projectName}GetProjectVersion(){return this._projectVersion}GetProjectUniqueId(){return this._projectUniqueId}GetAppId(){return this._appId}GetInstanceByUID(c){if(this._isLoadingState)throw Error("cannot call while loading state - wait until afterload event"); return this._instancesByUid.get(c)||null}_RefreshUidMap(){this._instancesByUid.clear();for(const c of this._allObjectClasses)if(!c.IsFamily())for(const f of c.GetInstances())this._instancesByUid.set(f.GetUID(),f)}IsPreview(){return"preview"===this._exportType}IsDebug(){return this._isDebug}GetExportType(){return this._exportType}IsCordova(){return"cordova"===this._exportType}IsAndroidWebView(){return"Android"===e.Platform.OS&&("cordova"===this._exportType||"playable-ad"===this._exportType||"instant-games"=== this._exportType)}IsiOSCordova(){return this._isiOSCordova}IsiOSWebView(){return this._isiOSWebView}GetCollisionEngine(){return this._collisionEngine}GetSolidBehavior(){return this._pluginManager.GetSolidBehavior()}GetJumpthruBehavior(){return this._pluginManager.GetJumpthruBehavior()}Uses3DFeatures(){return this._uses3dFeatures}GetZScaleFactor(){const c=this.GetRenderer();return this.GetViewportHeight()/2/Math.tan(c.GetFovY()/2)/c.GetDefaultCameraZ()}IsLayoutFirstTick(){return this._isLayoutFirstTick}SetPixelRoundingEnabled(c){c= !!c;this._isPixelRoundingEnabled!==c&&(this._isPixelRoundingEnabled=c,this.GetLayoutManager().SetAllLayerMVChanged(),this.UpdateRender())}IsPixelRoundingEnabled(){return this._isPixelRoundingEnabled}SaveToSlot(c){this._saveToSlotName=c}LoadFromSlot(c){this._loadFromSlotName=c}LoadFromJsonString(c){this._loadFromJson=c}GetLastSaveJsonString(){return this._lastSaveJson}_NeedsHandleSaveOrLoad(){return!(!this._saveToSlotName&&!this._loadFromSlotName&&null===this._loadFromJson)}async _HandleSaveOrLoad(){this._saveToSlotName&& (this.FlushPendingInstances(),await this._DoSaveToSlot(this._saveToSlotName),this._ClearSaveOrLoad());this._loadFromSlotName&&(await this._DoLoadFromSlot(this._loadFromSlotName),this._ClearSaveOrLoad(),this.IsDebug()&&b.StepIfPausedInDebugger());if(null!==this._loadFromJson){this.FlushPendingInstances();try{await this._DoLoadFromJsonString(this._loadFromJson),this._lastSaveJson=this._loadFromJson,await this.TriggerAsync(e.Plugins.System.Cnds.OnLoadComplete,null),this._lastSaveJson=""}catch(c){console.error("[Construct 3] Failed to load state from JSON string: ", c),await this.TriggerAsync(e.Plugins.System.Cnds.OnLoadFailed,null)}this._ClearSaveOrLoad()}}_ClearSaveOrLoad(){this._loadFromSlotName=this._saveToSlotName="";this._loadFromJson=null}_GetProjectStorage(){this._projectStorage||(this._projectStorage=localforage.createInstance({name:"c3-localstorage-"+this.GetProjectUniqueId(),description:this.GetProjectName()}));return this._projectStorage}_GetSavegamesStorage(){this._savegamesStorage||(this._savegamesStorage=localforage.createInstance({name:"c3-savegames-"+ this.GetProjectUniqueId(),description:this.GetProjectName()}));return this._savegamesStorage}async _DoSaveToSlot(c){const f=await this._SaveToJsonString();try{await this._GetSavegamesStorage().setItem(c,f),console.log("[Construct 3] Saved state to storage ("+f.length+" chars)"),this._lastSaveJson=f,await this.TriggerAsync(e.Plugins.System.Cnds.OnSaveComplete,null),this._lastSaveJson=""}catch(l){console.error("[Construct 3] Failed to save state to storage: ",l),await this.TriggerAsync(e.Plugins.System.Cnds.OnSaveFailed, null)}}async _DoLoadFromSlot(c){try{const f=await this._GetSavegamesStorage().getItem(c);if(!f)throw Error("empty slot");console.log("[Construct 3] Loaded state from storage ("+f.length+" chars)");await this._DoLoadFromJsonString(f);this._lastSaveJson=f;await this.TriggerAsync(e.Plugins.System.Cnds.OnLoadComplete,null);this._lastSaveJson=""}catch(f){console.error("[Construct 3] Failed to load state from storage: ",f),await this.TriggerAsync(e.Plugins.System.Cnds.OnLoadFailed,null)}}async _SaveToJsonString(){const c= {c3save:!0,version:1,rt:{time:this.GetGameTime(),timeRaw:this.GetGameTimeRaw(),walltime:this.GetWallTime(),timescale:this.GetTimeScale(),tickcount:this.GetTickCount(),execcount:this.GetExecCount(),next_uid:this._nextUid,running_layout:this.GetMainRunningLayout().GetSID(),start_time_offset:Date.now()-this._startTime},types:{},layouts:{},events:this._eventSheetManager._SaveToJson(),timelines:this._timelineManager._SaveToJson(),user_script_data:null};for(var f of this._allObjectClasses)f.IsFamily()|| f.HasNoSaveBehavior()||(c.types[f.GetSID().toString()]=f._SaveToJson());for(const l of this._layoutManager.GetAllLayouts())c.layouts[l.GetSID().toString()]=l._SaveToJson();f=this._CreateUserScriptEvent("save");f.saveData=null;await this.DispatchUserScriptEventAsyncWait(f);c.user_script_data=f.saveData;return JSON.stringify(c)}IsLoadingState(){return this._isLoadingState}async _DoLoadFromJsonString(c){var f=this.GetLayoutManager();c=JSON.parse(c);if(c.c2save)throw Error("C2 saves are incompatible with C3 runtime"); if(!c.c3save)throw Error("not valid C3 save data");if(1<c.version)throw Error("C3 save data from future version");this._dispatcher.dispatchEvent(e.New(e.Event,"beforeload"));for(var l of this.allInstances())l._OnBeforeLoad();this._isLoadingState=!0;l=c.rt;this._gameTime.Set(l.time);l.hasOwnProperty("timeRaw")&&this._gameTimeRaw.Set(l.timeRaw);this._wallTime.Set(l.walltime);this._timeScale=l.timescale;this._tickCount=l.tickcount;this._execCount=l.execcount;this._startTime=Date.now()-l.start_time_offset; var g=l.running_layout;if(g!==this.GetMainRunningLayout().GetSID())if(g=f.GetLayoutBySID(g))await this._DoChangeLayout(g);else return;for(const [k,m]of Object.entries(c.types))g=parseInt(k,10),g=this.GetObjectClassBySID(g),!g||g.IsFamily()||g.HasNoSaveBehavior()||g._LoadFromJson(m);this.FlushPendingInstances();this._RefreshUidMap();this._isLoadingState=!1;this._nextUid=l.next_uid;for(const [k,m]of Object.entries(c.layouts))l=parseInt(k,10),(l=f.GetLayoutBySID(l))&&l._LoadFromJson(m);this._eventSheetManager._LoadFromJson(c.events); for(const k of this._allObjectClasses)if(!k.IsFamily()&&k.IsInContainer())for(const m of k.GetInstances()){l=m.GetIID();for(const u of k.GetContainer().objectTypes())if(u!==k){g=u.GetInstances();if(0>l||l>=g.length)throw Error("missing sibling instance");m._AddSibling(g[l])}}this._timelineManager._LoadFromJson(c.timelines);f.SetAllLayerProjectionChanged();f.SetAllLayerMVChanged();this._dispatcher.dispatchEvent(e.New(e.Event,"afterload"));f=this._CreateUserScriptEvent("load");f.saveData=c.user_script_data; await this.DispatchUserScriptEventAsyncWait(f);this.UpdateRender()}async AddJobWorkerScripts(c){c=(await Promise.all(c.map(f=>this._assetManager.FetchBlob(f)))).map(f=>URL.createObjectURL(f));this._jobScheduler.ImportScriptsToJobWorkers(c)}AddJobWorkerBlob(c,f){this._jobScheduler.SendBlobToJobWorkers(c,f)}AddJobWorkerBuffer(c,f){this._jobScheduler.SendBufferToJobWorkers(c,f)}AddJob(c,f,l){return this._jobScheduler.AddJob(c,f,l)}BroadcastJob(c,f,l){return this._jobScheduler.BroadcastJob(c,f,l)}InvokeDownload(c, f){this.PostComponentMessageToDOM("runtime","invoke-download",{url:c,filename:f})}async RasterSvgImage(c,f,l,g,k,m){g=g||f;k=k||l;if(this.IsInWorker())return(await this.PostComponentMessageToDOMAsync("runtime","raster-svg-image",{blob:c,imageWidth:f,imageHeight:l,surfaceWidth:g,surfaceHeight:k,imageBitmapOpts:m})).imageBitmap;c=await self.C3_RasterSvgImageBlob(c,f,l,g,k);return m?await self.createImageBitmap(c,m):c}async GetSvgImageSize(c){return this.IsInWorker()?await this.PostComponentMessageToDOMAsync("runtime", "get-svg-image-size",{blob:c}):await self.C3_GetSvgImageSize(c)}RequestDeviceOrientationEvent(){this._didRequestDeviceOrientationEvent||(this._didRequestDeviceOrientationEvent=!0,this.PostComponentMessageToDOM("runtime","enable-device-orientation"))}RequestDeviceMotionEvent(){this._didRequestDeviceMotionEvent||(this._didRequestDeviceMotionEvent=!0,this.PostComponentMessageToDOM("runtime","enable-device-motion"))}Random(){return this._randomNumberCallback()}SetRandomNumberGeneratorCallback(c){this._randomNumberCallback= c}_GetRemotePreviewStatusInfo(){const c=this.GetWebGLRenderer();return{fps:this.GetFPS(),cpu:this.GetMainThreadTime(),gpu:this.GetGPUUtilisation(),layout:this.GetMainRunningLayout()?this.GetMainRunningLayout().GetName():"",renderer:c?c.GetUnmaskedRenderer():"<unavailable>"}}HitBreakpoint(){return this.IsDebug()?b.HitBreakpoint():!1}DebugBreak(c){return this.IsDebugging()?b.DebugBreak(c):Promise.resolve()}DebugBreakNext(){return this.IsDebugging()?b.BreakNext():!1}SetDebugBreakpointsEnabled(c){this._breakpointsEnabled= !!c;this._UpdateDebuggingFlag()}AreDebugBreakpointsEnabled(){return this._breakpointsEnabled}IsDebugging(){return this._isDebugging}SetDebuggingEnabled(c){c?this._debuggingDisabled--:this._debuggingDisabled++;this._UpdateDebuggingFlag()}_UpdateDebuggingFlag(){this._isDebugging=this.IsDebug()&&this._breakpointsEnabled&&0===this._debuggingDisabled}IsCPUProfiling(){return this.IsDebug()&&b.IsCPUProfiling()}IsGPUProfiling(){return this.IsDebug()&&this.GetRenderer().SupportsGPUProfiling()&&b.IsGPUProfiling()}async DebugIterateAndBreak(c){if(c)for(const f of c)await this.DebugBreak(f)}DebugFireGeneratorEventAndBreak(c){return this.DebugIterateAndBreak(this._dispatcher.dispatchGeneratorEvent(c))}_InvokeFunctionFromJS(c){return this._eventSheetManager._InvokeFunctionFromJS(c.name, c.params)}GetIRuntime(){return this._iRuntime}_CreateUserScriptEvent(c){c=e.New(e.Event,c,!1);c.runtime=this._iRuntime;return c}_InitScriptInterfaces(){var c={};for(const f of this._allObjectClasses)c[f.GetJsPropName()]={value:f.GetIObjectClass(),enumerable:!0,writable:!1};c=Object.create(Object.prototype,c);this._iRuntime=new self.IRuntime(this,c);this._userScriptEventObjects={tick:this._CreateUserScriptEvent("tick")}}_InitGlobalVariableScriptInterface(){const c={};for(const f of this.GetEventSheetManager().GetAllGlobalVariables())c[f.GetJsPropName()]= f._GetScriptInterfaceDescriptor();this._iRuntime._InitGlobalVars(c)}_GetCommonScriptInterfaces(){return this._commonScriptInterfaces}_MapScriptInterface(c,f){this._interfaceMap.set(c,f)}_UnwrapScriptInterface(c){return this._interfaceMap.get(c)}_UnwrapIObjectClass(c){if(!(c instanceof self.IObjectClass))throw new TypeError("expected IObjectClass");c=this._UnwrapScriptInterface(c);if(!(c&&c instanceof e.ObjectClass))throw Error("invalid IObjectClass");return c}_UnwrapIWorldInstance(c){if(!(c instanceof self.IWorldInstance))throw new TypeError("expected IWorldInstance");c=this._UnwrapScriptInterface(c);if(!(c&&c instanceof e.Instance))throw Error("invalid IInstance");return c}};self.C3_CreateRuntime=e.Runtime.Create;self.C3_InitRuntime=(c,f)=>c.Init(f)} {"use strict";const e=self.C3;e.JobSchedulerRuntime=class extends e.DefendedBase{constructor(b,a){super();this._runtime=b;this._jobPromises=new Map;this._nextJobId=0;this._inputPort=a.inputPort;a.outputPort.onmessage=d=>this._OnJobWorkerMessage(d);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,d,c,f){d||(d=[]);const l=this._nextJobId++;b={type:b,isBroadcast:!1,jobId:l,params:a,transferables:d};a=new Promise((g,k)=>{this._jobPromises.set(l,{resolve:g,progress:c,reject:k,cancelled:!1})});f&&f.SetAction(()=>this._CancelJob(l));this._inputPort.postMessage(b,d);this._MaybeCreateExtraWorker();return a}BroadcastJob(b,a,d){d||(d=[]);const c=this._nextJobId++;this._inputPort.postMessage({type:b, isBroadcast:!0,jobId:c,params:a,transferables:d},d)}_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,d=b.jobId;switch(a){case "result":this._OnJobResult(d,b.result);break;case "progress":this._OnJobProgress(d,b.progress);break;case "error":this._OnJobError(d,b.error);break;case "ready":this._OnJobWorkerReady();break;default:throw Error(`unknown message from worker '${a}'`); }}_OnJobResult(b,a){const d=this._jobPromises.get(b);if(!d)throw Error("invalid job ID");d.cancelled||d.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 d=this._jobPromises.get(b);if(!d)throw Error("invalid job ID");d.cancelled||d.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={}; {"use strict";const e=self.C3;let b=null,a="",d="",c=[],f="",l="",g="";const k=e.New(e.ArrayStack);function m(u,x){u=u[1];x=x[1];if("number"===typeof u&&"number"===typeof x)return u-x;u=""+u;x=""+x;return u<x?-1:u>x?1:0}e.Plugins.System=class extends e.SDKPluginBase{constructor(u){super(u);this._loopStack=this._runtime.GetEventSheetManager().GetLoopStack();this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._imagesLoadingComplete=this._imagesLoadingTotal=0;this._functionMaps= new Map}Release(){super.Release()}UpdateRender(){this._runtime.UpdateRender()}Trigger(u){this._runtime.Trigger(u,null,null)}GetRegex(u,x){b&&u===a&&x===d||(b=new RegExp(u,x),a=u,d=x);b.lastIndex=0;return b}GetRegexMatches(u,x,n){if(u===f&&x===l&&n===g)return c;const q=this.GetRegex(x,n);c=u.match(q);f=u;l=x;g=n;return c}async _LoadTexturesForObjectClasses(u,x){if(x.length){this._imagesLoadingTotal+=x.length;var n=[];for(const q of x)n.push(u.MaybeLoadTexturesFor(q));await e.PromiseAllWithProgress(n, ()=>{this._imagesLoadingComplete++});this._imagesLoadingComplete++;this._imagesLoadingComplete===this._imagesLoadingTotal&&(this._runtime.Trigger(e.Plugins.System.Cnds.OnImageLoadingComplete,null,null),this._imagesLoadingTotal=this._imagesLoadingComplete=0)}}_UnloadTexturesForObjectClasses(u,x){for(const n of x)0===n.GetInstanceCount()&&u.MaybeUnloadTexturesFor(n)}_GetForEachStack(){return k}_Repeat(u){var x=this._runtime.GetEventSheetManager();const n=x.GetEventStack(),q=n.GetCurrentStackFrame(), t=q.GetCurrentEvent(),r=t.GetSolModifiers();var w=q.IsSolModifierAfterCnds();const y=n.Push(t),C=x.GetLoopStack(),D=C.Push();D.SetEnd(u);if(w)for(w=0;w<u&&!D.IsStopped();++w)x.PushCopySol(r),D.SetIndex(w),t.Retrigger(q,y),x.PopSol(r);else for(x=0;x<u&&!D.IsStopped();++x)D.SetIndex(x),t.Retrigger(q,y);n.Pop();C.Pop();return!1}*_DebugRepeat(u){var x=this._runtime.GetEventSheetManager();const n=x.GetEventStack(),q=n.GetCurrentStackFrame(),t=q.GetCurrentEvent(),r=t.GetSolModifiers();var w=q.IsSolModifierAfterCnds(); const y=n.Push(t),C=x.GetLoopStack(),D=C.Push();D.SetEnd(u);if(w)for(w=0;w<u&&!D.IsStopped();++w)x.PushCopySol(r),D.SetIndex(w),yield*t.DebugRetrigger(q,y),x.PopSol(r);else for(x=0;x<u&&!D.IsStopped();++x)D.SetIndex(x),yield*t.DebugRetrigger(q,y);n.Pop();C.Pop();return!1}_While(){var u=this._runtime.GetEventSheetManager();const x=u.GetEventStack(),n=x.GetCurrentStackFrame(),q=n.GetCurrentEvent(),t=q.GetSolModifiers();var r=n.IsSolModifierAfterCnds();const w=x.Push(q),y=u.GetLoopStack(),C=y.Push(); if(r)for(r=0;!C.IsStopped();++r)u.PushCopySol(t),C.SetIndex(r),q.Retrigger(n,w)||C.Stop(),u.PopSol(t);else for(u=0;!C.IsStopped();++u)C.SetIndex(u),q.Retrigger(n,w)||C.Stop();x.Pop();y.Pop();return!1}*_DebugWhile(){var u=this._runtime.GetEventSheetManager();const x=u.GetEventStack(),n=x.GetCurrentStackFrame(),q=n.GetCurrentEvent(),t=q.GetSolModifiers();var r=n.IsSolModifierAfterCnds();const w=x.Push(q),y=u.GetLoopStack(),C=y.Push();if(r)for(r=0;!C.IsStopped();++r)u.PushCopySol(t),C.SetIndex(r),(yield*q.DebugRetrigger(n, w))||C.Stop(),u.PopSol(t);else for(u=0;!C.IsStopped();++u)C.SetIndex(u),(yield*q.DebugRetrigger(n,w))||C.Stop();x.Pop();y.Pop();return!1}_For(u,x,n){var q=this._runtime.GetEventSheetManager();const t=q.GetEventStack(),r=t.GetCurrentStackFrame(),w=r.GetCurrentEvent(),y=w.GetSolModifiers(),C=r.IsSolModifierAfterCnds(),D=t.Push(w),G=q.GetLoopStack(),K=G.Push();K.SetName(u);K.SetEnd(n);if(n<x)if(C)for(u=x;u>=n&&!K.IsStopped();--u)q.PushCopySol(y),K.SetIndex(u),w.Retrigger(r,D),q.PopSol(y);else for(q= x;q>=n&&!K.IsStopped();--q)K.SetIndex(q),w.Retrigger(r,D);else if(C)for(u=x;u<=n&&!K.IsStopped();++u)q.PushCopySol(y),K.SetIndex(u),w.Retrigger(r,D),q.PopSol(y);else for(q=x;q<=n&&!K.IsStopped();++q)K.SetIndex(q),w.Retrigger(r,D);t.Pop();G.Pop();return!1}*_DebugFor(u,x,n){var q=this._runtime.GetEventSheetManager();const t=q.GetEventStack(),r=t.GetCurrentStackFrame(),w=r.GetCurrentEvent(),y=w.GetSolModifiers(),C=r.IsSolModifierAfterCnds(),D=t.Push(w),G=q.GetLoopStack(),K=G.Push();K.SetName(u);K.SetEnd(n); if(n<x)if(C)for(u=x;u>=n&&!K.IsStopped();--u)q.PushCopySol(y),K.SetIndex(u),yield*w.DebugRetrigger(r,D),q.PopSol(y);else for(q=x;q>=n&&!K.IsStopped();--q)K.SetIndex(q),yield*w.DebugRetrigger(r,D);else if(C)for(u=x;u<=n&&!K.IsStopped();++u)q.PushCopySol(y),K.SetIndex(u),yield*w.DebugRetrigger(r,D),q.PopSol(y);else for(q=x;q<=n&&!K.IsStopped();++q)K.SetIndex(q),yield*w.DebugRetrigger(r,D);t.Pop();G.Pop();return!1}_ForEach(u){var x=this._runtime.GetEventSheetManager();const n=x.GetEventStack(),q=n.GetCurrentStackFrame(), t=q.GetCurrentEvent(),r=t.GetSolModifiers();var w=q.IsSolModifierAfterCnds();const y=n.Push(t),C=x.GetLoopStack(),D=C.Push(),G=u.IsInContainer(),K=u.GetCurrentSol(),B=k.Push();e.shallowAssignArray(B,K.GetInstances());D.SetEnd(B.length);if(w)for(let A=0,F=B.length;A<F&&!D.IsStopped();++A)x.PushCopySol(r),w=B[A],u.GetCurrentSol().SetSinglePicked(w),G&&w.SetSiblingsSinglePicked(),D.SetIndex(A),t.Retrigger(q,y),x.PopSol(r);else{K._SetSelectAll(!1);u=K._GetOwnInstances();e.clearArray(u);u.push(null);for(let A= 0,F=B.length;A<F&&!D.IsStopped();++A)x=B[A],u[0]=x,G&&x.SetSiblingsSinglePicked(),D.SetIndex(A),t.Retrigger(q,y)}n.Pop();C.Pop();e.clearArray(B);k.Pop();return!1}*_DebugForEach(u){var x=this._runtime.GetEventSheetManager();const n=x.GetEventStack(),q=n.GetCurrentStackFrame(),t=q.GetCurrentEvent(),r=t.GetSolModifiers();var w=q.IsSolModifierAfterCnds();const y=n.Push(t),C=x.GetLoopStack(),D=C.Push(),G=u.IsInContainer(),K=u.GetCurrentSol(),B=k.Push();e.shallowAssignArray(B,K.GetInstances());D.SetEnd(B.length); if(w)for(let A=0,F=B.length;A<F&&!D.IsStopped();++A)x.PushCopySol(r),w=B[A],u.GetCurrentSol().SetSinglePicked(w),G&&w.SetSiblingsSinglePicked(),D.SetIndex(A),yield*t.DebugRetrigger(q,y),x.PopSol(r);else{K._SetSelectAll(!1);u=K._GetOwnInstances();e.clearArray(u);u.push(null);for(let A=0,F=B.length;A<F&&!D.IsStopped();++A)x=B[A],u[0]=x,G&&x.SetSiblingsSinglePicked(),D.SetIndex(A),yield*t.DebugRetrigger(q,y)}n.Pop();C.Pop();e.clearArray(B);k.Pop();return!1}_ForEachOrdered(u,x){var n=this._runtime.GetEventSheetManager(); const q=n.GetEventStack(),t=n.GetCurrentCondition(),r=q.GetCurrentStackFrame(),w=r.GetCurrentEvent(),y=w.GetSolModifiers(),C=r.IsSolModifierAfterCnds(),D=q.Push(w),G=n.GetLoopStack(),K=G.Push(),B=u.IsInContainer(),A=u.GetCurrentSol(),F=k.Push();e.clearArray(F);const J=A.GetInstances();K.SetEnd(J.length);for(let L=0,Q=J.length;L<Q;++L)F.push([J[L],t.ReevaluateParameter(1,L)]);F.sort(m);1===x&&F.reverse();if(C)for(let L=0,Q=F.length;L<Q&&!K.IsStopped();++L)n.PushCopySol(y),x=F[L][0],u.GetCurrentSol().SetSinglePicked(x), B&&x.SetSiblingsSinglePicked(),K.SetIndex(L),w.Retrigger(r,D),n.PopSol(y);else{A._SetSelectAll(!1);u=A._GetOwnInstances();e.clearArray(u);u.push(null);for(let L=0,Q=F.length;L<Q&&!K.IsStopped();++L)n=F[L][0],u[0]=n,B&&n.SetSiblingsSinglePicked(),K.SetIndex(L),w.Retrigger(r,D)}q.Pop();G.Pop();e.clearArray(F);k.Pop();return!1}*_DebugForEachOrdered(u,x){var n=this._runtime.GetEventSheetManager();const q=n.GetEventStack(),t=n.GetCurrentCondition(),r=q.GetCurrentStackFrame(),w=r.GetCurrentEvent(),y=w.GetSolModifiers(), C=r.IsSolModifierAfterCnds(),D=q.Push(w),G=n.GetLoopStack(),K=G.Push(),B=u.IsInContainer(),A=u.GetCurrentSol(),F=k.Push();e.clearArray(F);const J=A.GetInstances();K.SetEnd(J.length);for(let L=0,Q=J.length;L<Q;++L)F.push([J[L],t.ReevaluateParameter(1,L)]);F.sort(m);1===x&&F.reverse();if(C)for(let L=0,Q=F.length;L<Q&&!K.IsStopped();++L)n.PushCopySol(y),x=F[L][0],u.GetCurrentSol().SetSinglePicked(x),B&&x.SetSiblingsSinglePicked(),K.SetIndex(L),yield*w.DebugRetrigger(r,D),n.PopSol(y);else{A._SetSelectAll(!1); u=A._GetOwnInstances();e.clearArray(u);u.push(null);for(let L=0,Q=F.length;L<Q&&!K.IsStopped();++L)n=F[L][0],u[0]=n,B&&n.SetSiblingsSinglePicked(),K.SetIndex(L),yield*w.DebugRetrigger(r,D)}q.Pop();G.Pop();e.clearArray(F);k.Pop();return!1}_GetFunctionMap(u,x){let n=this._functionMaps.get(u);if(n)return n;if(!x)return null;n={defaultFunc:null,strMap:new Map};this._functionMaps.set(u,n);return n}_DoCallMappedFunction(u,x,n,q,t){x.GetEventBlock().RunAsMappedFunctionCall(n);q&&u.PopSol(t)}*_DebugDoCallMappedFunction(u, x,n,q,t){yield*x.GetEventBlock().DebugRunAsMappedFunctionCall(n);q&&u.PopSol(t)}}}{"use strict";const e=self.C3;e.Plugins.System.Type=class extends e.DefendedBase{constructor(b){super();this._objectClass=b;this._runtime=b.GetRuntime();this._plugin=b.GetPlugin()}OnCreate(){}Release(){this._plugin=this._runtime=this._objectClass=null}}} {"use strict";const e=self.C3;e.Plugins.System.Instance=class extends e.DefendedBase{constructor(b,a){super();this._inst=b;this._objectClass=this._inst.GetObjectClass();this._sdkType=this._objectClass.GetSdkType();this._runtime=this._inst.GetRuntime()}Release(){this._runtime=this._sdkType=this._objectClass=this._inst=null}}} {"use strict";const e=self.C3,b=[];e.Plugins.System.Cnds={EveryTick(){return!0},OnLayoutStart(){return!0},OnLayoutEnd(){return!0},OnSuspend(){return!0},OnResume(){return!0},IsSuspended(){return this._runtime.IsSuspended()},Else(){const a=this._runtime.GetCurrentEventStackFrame();return a.GetElseBranchRan()?!1:!a.GetLastEventTrue()},TriggerOnce(){const a=this._runtime.GetCurrentCondition().GetSavedDataMap();let d=a.get("TriggerOnce_lastTick");"undefined"===typeof d&&(d=-1,a.set("TriggerOnce_lastTick", -1));const c=this._runtime.GetTickCount();a.set("TriggerOnce_lastTick",c);return this._runtime.IsLayoutFirstTick()||d!==c-1},Every(a){const d=this._runtime.GetCurrentCondition().GetSavedDataMap(),c=d.get("Every_lastTime")||0,f=this._runtime.GetGameTime();d.has("Every_seconds")||d.set("Every_seconds",a);const l=d.get("Every_seconds");if(f>=c+l)return d.set("Every_lastTime",c+l),f>=d.get("Every_lastTime")+.04&&d.set("Every_lastTime",f),d.set("Every_seconds",a),!0;f<c-.1&&d.set("Every_lastTime",f);return!1}, IsGroupActive(a){return(a=this._runtime.GetEventSheetManager().GetEventGroupByName(a))&&a.IsGroupActive()},IsPreview(){return this._runtime.IsPreview()},IsMobile(){return e.Platform.IsMobile},OnLoadFinished(){return!0},OnCanvasSnapshot(){return!0},EffectsSupported(){return!0},OnSaveComplete(){return!0},OnSaveFailed(){return!0},OnLoadComplete(){return!0},OnLoadFailed(){return!0},ObjectUIDExists(a){return!!this._runtime.GetInstanceByUID(a)},IsOnPlatform(a){switch(a){case 0:return"browser"===e.Platform.Context; case 1:return"iOS"===e.Platform.OS;case 2:return"Android"===e.Platform.OS;case 8:return"cordova"===e.Platform.Context;case 9:return"scirra-arcade"===this._runtime.GetExportType();case 10:return"nwjs"===e.Platform.Context;case 13:return"windows-uwp"===this._runtime.GetExportType();default:return!1}},RegexTest(a,d,c){return this.GetRegex(d,c).test(a)},Compare(a,d,c){return e.compare(a,d,c)},CompareBetween(a,d,c){return a>=d&&a<=c},CompareVar(a,d,c){return e.compare(a.GetValue(),d,c)},CompareBoolVar(a){return!!a.GetValue()}, CompareTime(a,d){const c=this._runtime.GetGameTime();return 0===a?(a=this._runtime.GetCurrentCondition().GetSavedDataMap(),!a.get("CompareTime_executed")&&c>=d?(a.set("CompareTime_executed",!0),!0):!1):e.compare(c,a,d)},IsNaN(a){return isNaN(a)},AngleWithin(a,d,c){return e.angleDiff(e.toRadians(a),e.toRadians(c))<=e.toRadians(d)},IsClockwiseFrom(a,d){return e.angleClockwise(e.toRadians(a),e.toRadians(d))},IsBetweenAngles(a,d,c){a=e.toRadians(a);d=e.toRadians(d);c=e.toRadians(c);return e.angleClockwise(c, d)?e.angleClockwise(a,d)&&!e.angleClockwise(a,c):!(!e.angleClockwise(a,d)&&e.angleClockwise(a,c))},IsValueType(a,d){return"number"===typeof a?0===d:1===d},EvaluateExpression(a){return!!a},PickByComparison(a,d,c,f){if(!a)return!1;const l=this._GetForEachStack(),g=l.Push(),k=a.GetCurrentSol();e.shallowAssignArray(g,k.GetInstances());k.IsSelectAll()&&e.clearArray(k._GetOwnElseInstances());const m=this._runtime.GetCurrentCondition();let u=0;for(let x=0,n=g.length;x<n;++x){const q=g[x];g[u]=q;d=m.ReevaluateParameter(1, x);f=m.ReevaluateParameter(3,x);e.compare(d,c,f)?++u:k._PushElseInstance(q)}e.truncateArray(g,u);k.SetArrayPicked(g);d=!!g.length;e.clearArray(g);l.Pop();a.ApplySolToContainer();return d},PickByEvaluate(a,d){if(!a)return!1;const c=this._GetForEachStack(),f=c.Push(),l=a.GetCurrentSol();e.shallowAssignArray(f,l.GetInstances());l.IsSelectAll()&&e.clearArray(l._GetOwnElseInstances());const g=this._runtime.GetCurrentCondition();let k=0;for(let m=0,u=f.length;m<u;++m){const x=f[m];f[k]=x;(d=g.ReevaluateParameter(1, m))?++k:l._PushElseInstance(x)}e.truncateArray(f,k);l.SetArrayPicked(f);d=!!f.length;e.clearArray(f);c.Pop();a.ApplySolToContainer();return d},PickNth(a,d){if(!a)return!1;const c=a.GetCurrentSol(),f=c.GetInstances();d=Math.floor(d);if(d>=f.length)return!1;c.PickOne(f[d]);a.ApplySolToContainer();return!0},PickRandom(a){if(!a)return!1;const d=a.GetCurrentSol(),c=d.GetInstances(),f=Math.floor(this._runtime.Random()*c.length);if(f>=c.length)return!1;d.PickOne(c[f]);a.ApplySolToContainer();return!0},PickAll(a){if(!a|| !a.GetInstanceCount())return!1;a.GetCurrentSol()._SetSelectAll(!0);a.ApplySolToContainer();return!0},PickOverlappingPoint(a,d,c){if(!a)return!1;const f=a.GetCurrentSol();var l=f.GetInstances();const g=this._runtime.GetCurrentEvent().IsOrBlock(),k=this._runtime.GetCurrentCondition().IsInverted();f.IsSelectAll()?(e.shallowAssignArray(b,l),f.ClearArrays(),f._SetSelectAll(!1)):g?(e.shallowAssignArray(b,f._GetOwnElseInstances()),e.clearArray(f._GetOwnElseInstances())):(e.shallowAssignArray(b,f._GetOwnInstances()), e.clearArray(f._GetOwnInstances()));for(let m=0,u=b.length;m<u;++m)l=b[m],e.xor(l.GetWorldInfo().ContainsPoint(d,c),k)?f._PushInstance(l):f._PushElseInstance(l);a.ApplySolToContainer();return e.xor(!!f._GetOwnInstances().length,k)},PickLastCreated(a){if(!a)return!1;var d=a.IsFamily();let c=null;const f=this._runtime._GetInstancesPendingCreate();for(let l=f.length-1;0<=l;--l){const g=f[l];if(d){if(g.GetObjectClass().BelongsToFamily(a)){c=g;break}}else if(g.GetObjectClass()===a){c=g;break}}c||(d=a.GetInstances(), d.length&&(c=d.at(-1)));if(!c)return!1;a.GetCurrentSol().PickOne(c);a.ApplySolToContainer();return!0},Repeat(a){return this._runtime.IsDebugging()?this._DebugRepeat(a):this._Repeat(a)},While(){return this._runtime.IsDebugging()?this._DebugWhile():this._While()},For(a,d,c){return this._runtime.IsDebugging()?this._DebugFor(a,d,c):this._For(a,d,c)},ForEach(a){return this._runtime.IsDebugging()?this._DebugForEach(a):this._ForEach(a)},ForEachOrdered(a,d,c){return this._runtime.IsDebugging()?this._DebugForEachOrdered(a, c):this._ForEachOrdered(a,c)},LayerVisible(a){return a?a.IsVisible():!1},LayerEmpty(a){return a?!a.GetInstanceCount():!1},LayerCmpOpacity(a,d,c){return a?e.compare(100*a.GetOpacity(),d,c):!1},OnImageLoadingComplete(){return!0},IsLoadingImages(){return 0<this._imagesLoadingTotal}}} {"use strict";const e=self.C3;function b(g,k){const m=g[0]-k[0];return 0!==m?m:g[1]-k[1]}function a(g,k){return g[1]-k[1]}const d=[],c=[],f=e.New(e.Rect),l=e.New(e.Color);e.Plugins.System.Acts={SetVar(g,k){g.SetValue(k)},AddVar(g,k){g.IsNumber()&&"number"!==typeof k&&(k=parseFloat(k));g.SetValue(g.GetValue()+k)},SubVar(g,k){g.IsNumber()&&g.SetValue(g.GetValue()-k)},SetBoolVar(g,k){g.SetValue(!!k)},ToggleBoolVar(g){g.SetValue(!g.GetValue())},ResetGlobals(){this._runtime.GetEventSheetManager().ResetAllGlobalsToInitialValue()}, CreateObject(g,k,m,u,x){g&&k&&(m=this._runtime.CreateInstance(g,k,m,u,x))&&(x&&k.SortAndAddInstancesByZIndex(m),k=this._runtime.GetEventSheetManager(),k.BlockFlushingInstances(!0),m._TriggerOnCreatedOnSelfAndRelated(),k.BlockFlushingInstances(!1),g.GetCurrentSol().SetSinglePicked(m),m.IsInContainer()&&m.SetSiblingsSinglePicked())},CreateObjectByName(g,k,m,u,x){g&&k&&(g=this._runtime.GetObjectClassByName(g))&&e.Plugins.System.Acts.CreateObject.call(this,g,k,m,u,x)},RecreateInitialObjects(g,k,m,u,x, n,q,t,r,w){if(g){var y=this._runtime.GetCurrentLayout();if(n&&(y=this._runtime.GetLayoutManager().GetLayoutByName(n),!y))return;n=null;if("number"!==typeof q||0<=q)if(n=y.GetLayer(q),!n)return;f.set(k,m,u,x);k=y.RecreateInitialObjects(g,f,n,t,r,w);g.GetCurrentSol().SetArrayPicked(k);g.ApplySolToContainer()}},StopLoop(){const g=this._loopStack;g.IsInLoop()&&g.GetCurrent().Stop()},SetGroupActive(g,k){(g=this._runtime.GetEventSheetManager().GetEventGroupByName(g))&&(0===k?g.SetGroupActive(!1):1===k? g.SetGroupActive(!0):g.SetGroupActive(!g.IsGroupActive()))},SetTimescale(g){this._runtime.SetTimeScale(g)},SetObjectTimescale(g,k){0>k&&(k=0);if(g){g=g.GetCurrentSol().GetInstances();for(const m of g)m.SetTimeScale(k)}},RestoreObjectTimescale(g){if(g){g=g.GetCurrentSol().GetInstances();for(const k of g)k.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 k of this._runtime.GetEventSheetManager().scheduledWaits())k.IsSignal()&&k.GetSignalTag()===g&&k.SetSignalled()},async SnapshotCanvas(g,k,m,u,x,n){const q=this._runtime.GetCanvasManager();q&&(this.UpdateRender(),await q.SnapshotCanvas(0===g?"image/png":"image/jpeg",k/100,m,u,x,n),await this._runtime.TriggerAsync(e.Plugins.System.Cnds.OnCanvasSnapshot, null))},SetCanvasSize(g,k){if(!(0>=g||0>=k)){this._runtime.SetViewportSize(g,k);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,k),m.SetSize(m.GetLastWidth(),m.GetLastHeight(),!0),this._runtime.UpdateRender()}},SetFullscreenQuality(g){const k=this._runtime.GetCanvasManager();k&&"off"!==k.GetCurrentFullscreenMode()&&(k.SetFullscreenScalingQuality(0!== g?"high":"low"),k.SetSize(k.GetLastWidth(),k.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,k){if(g){var m=g.GetCurrentSol().GetInstances(), u=this._runtime.GetCurrentLayout(),x=g.IsFamily();g=g.GetFamilyIndex();for(let q=0,t=m.length;q<t;++q){var n=m[q];const r=n.GetWorldInfo();if(!r)continue;let w;w=x?n.GetInstanceVariableValue(k+n.GetObjectClass().GetFamilyInstanceVariableOffset(g)):n.GetInstanceVariableValue(k);d.push([r.GetLayer().GetIndex(),r.GetZIndex()]);c.push([n,w])}if(d.length){d.sort(b);c.sort(a);k=!1;for(let q=0,t=d.length;q<t;++q)m=c[q][0],x=u.GetLayerByIndex(d[q][0]),g=d[q][1],n=x._GetInstances(),n[g]!==m&&(n[g]=m,m.GetWorldInfo()._SetLayer(x), x.SetZIndicesChanged(),k=!0);k&&this._runtime.UpdateRender();e.clearArray(d);e.clearArray(c)}}},GoToLayout(g){if(!this._runtime.IsLoading()){var k=this._runtime.GetLayoutManager();k.IsPendingChangeMainLayout()||k.ChangeMainLayout(g)}},GoToLayoutByName(g){if(!this._runtime.IsLoading()){var k=this._runtime.GetLayoutManager();k.IsPendingChangeMainLayout()||(g=k.GetLayoutByName(g))&&k.ChangeMainLayout(g)}},NextPrevLayout(g){if(!this._runtime.IsLoading()){var k=this._runtime.GetLayoutManager();if(!k.IsPendingChangeMainLayout()){var m= k.GetAllLayouts(),u=m.indexOf(k.GetMainRunningLayout());g&&0===u||(g||u!==m.length-1)&&k.ChangeMainLayout(m[u+(g?-1:1)])}}},RestartLayout(){if(!this._runtime.IsLoading()){var g=this._runtime.GetLayoutManager();g.IsPendingChangeMainLayout()||(g.ChangeMainLayout(g.GetMainRunningLayout()),this._runtime.GetEventSheetManager().ResetAllGroupsInitialActivation())}},SetLayerVisible(g,k){g&&g.SetVisible(k)},SetLayerOpacity(g,k){g&&g.SetOpacity(k/100)},SetLayerScale(g,k){g&&g.SetOwnScale(k)},SetLayerScaleRate(g, k){g&&g.SetScaleRate(k)},SetLayerAngle(g,k){g&&g.SetAngle(e.toRadians(+k))},SetLayerScroll(g,k,m){g&&(g.SetOwnScrollPositionEnabled(!0),g.SetScrollX(k),g.SetScrollY(m))},RestoreLayerScroll(g){g&&g.SetOwnScrollPositionEnabled(!1)},SetLayerParallax(g,k,m){g&&g.SetParallax(k/100,m/100)},SetLayerZElevation(g,k){g&&g.SetZElevation(+k)},SetLayerBackground(g,k){g&&(l.setFromRgbValue(k),l.clamp(),g=g.GetBackgroundColor(),g.equalsIgnoringAlpha(l)||(g.copyRgb(l),this.UpdateRender()))},SetLayerTransparent(g, k){g&&g.SetTransparent(k)},SetLayerBlendMode(g,k){g&&g.SetBlendMode(k)},SetLayerEffectEnabled(g,k,m){g&&(g=g.GetEffectList(),m=g.GetEffectTypeByName(m))&&(k=1===k,m.IsActive()!==k&&(m.SetActive(k),g.UpdateActiveEffects(),this._runtime.UpdateRender()))},SetLayerEffectParam(g,k,m,u){if(g&&(g=g.GetEffectList(),k=g.GetEffectTypeByName(k))){var x=k.GetIndex();g=g.GetEffectParametersForIndex(x);m=Math.floor(m);if(!(0>m||m>=g.length)){x=k.GetShaderProgram().GetParameterType(m);if("color"===x){l.setFromRgbValue(u); m=g[m];if(l.equalsIgnoringAlpha(m))return;m.copyRgb(l)}else{"percent"===x&&(u/=100);if(g[m]===u)return;g[m]=u}k.IsActive()&&this._runtime.UpdateRender()}}},SetLayerForceOwnTexture(g,k){g&&g.SetForceOwnTexture(k)},SetLayoutScale(g){this._runtime.GetCurrentLayout().SetScale(+g)},SetLayoutAngle(g){this._runtime.GetCurrentLayout().SetAngle(e.toRadians(+g))},SetLayoutEffectEnabled(g,k){const m=this._runtime.GetCurrentLayout().GetEffectList();if(k=m.GetEffectTypeByName(k))g=1===g,k.IsActive()!==g&&(k.SetActive(g), m.UpdateActiveEffects(),this._runtime.UpdateRender())},SetLayoutEffectParam(g,k,m){var u=this._runtime.GetCurrentLayout().GetEffectList();if(g=u.GetEffectTypeByName(g)){var x=g.GetIndex();u=u.GetEffectParametersForIndex(x);k=Math.floor(k);if(!(0>k||k>=u.length)){x=g.GetShaderProgram().GetParameterType(k);if("color"===x){l.setFromRgbValue(m);k=u[k];if(l.equalsIgnoringAlpha(k))return;k.copyRgb(l)}else{"percent"===x&&(m/=100);if(u[k]===m)return;u[k]=m}g.IsActive()&&this._runtime.UpdateRender()}}},SetLayoutVanishingPoint(g, k){this._runtime.GetCurrentLayout().SetVanishingPointXY(g/100,k/100)},SetLayoutProjection(g){const k=this._runtime.GetCurrentLayout();0===g?k.SetPerspectiveProjection():k.SetOrthographicProjection()},ScrollX(g){this._runtime.GetCurrentLayout().SetScrollX(g)},ScrollY(g){this._runtime.GetCurrentLayout().SetScrollY(g)},Scroll(g,k){const m=this._runtime.GetCurrentLayout();m.SetScrollX(g);m.SetScrollY(k)},ScrollToObject(g){if(g&&(g=g.GetFirstPicked())&&(g=g.GetWorldInfo())){var k=this._runtime.GetCurrentLayout(); k.SetScrollX(g.GetX());k.SetScrollY(g.GetY())}},async LoadObjectTextures(g){const k=this._runtime.GetMainRunningLayout();k&&g&&!this._runtime.IsLoading()&&(g=g.IsFamily()?g.GetFamilyMembers():[g],await this._LoadTexturesForObjectClasses(k,g))},async LoadObjectTexturesByName(g){await e.Plugins.System.Acts.LoadObjectTextures.call(this,this._runtime.GetObjectClassByName(g))},UnloadObjectTextures(g){const k=this._runtime.GetMainRunningLayout();k&&g&&(g=g.IsFamily()?g.GetFamilyMembers():[g],this._UnloadTexturesForObjectClasses(k, g))},UnloadObjectTexturesByName(g){e.Plugins.System.Acts.UnloadObjectTexturesByName.call(this,this._runtime.GetObjectClassByName(g))},UnloadUnusedTextures(){const g=this._runtime.GetMainRunningLayout();if(g){var k=g._GetTextureLoadedObjectTypes();this._UnloadTexturesForObjectClasses(g,k)}},async LoadLayoutTextures(g){const k=this._runtime.GetMainRunningLayout();g&&k&&!this._runtime.IsLoading()&&await this._LoadTexturesForObjectClasses(k,g._GetInitialObjectClasses())},async LoadLayoutTexturesByName(g){const k= this._runtime.GetMainRunningLayout();(g=this._runtime.GetLayoutManager().GetLayoutByName(g))&&k&&!this._runtime.IsLoading()&&await this._LoadTexturesForObjectClasses(k,g._GetInitialObjectClasses())},SetFunctionReturnValue(g){const k=this._eventStack.GetCurrentExpFuncStackFrame();if(k)switch(k.GetFunctionReturnType()){case 1:"number"===typeof g&&k.SetFunctionReturnValue(g);break;case 2:"string"===typeof g&&k.SetFunctionReturnValue(g);break;case 3:k.SetFunctionReturnValue(g)}},MapFunction(g,k,m){var u= this._GetFunctionMap(g.toLowerCase(),!0);const x=u.strMap,n=k.toLowerCase();x.has(n)&&console.warn(`[Construct 3] Function map '${g}' string '${k}' already in map; overwriting entry`);if(u=e.first(x.values())||u.defaultFunc){u=0!==u.GetReturnType();const q=0!==m.GetReturnType();if(u!==q){console.error(`[Construct 3] Function map '${g}' string '${k}' function return type not compatible with other functions in the map; entry ignored`);return}}x.set(n,m)},MapFunctionDefault(g,k){const m=this._GetFunctionMap(g.toLowerCase(), !0);m.defaultFunc&&console.warn(`[Construct 3] Function map '${g}' already has a default; overwriting entry`);var u=e.first(m.strMap.values())||m.defaultFunc;if(u){u=0!==u.GetReturnType();const x=0!==k.GetReturnType();if(u!==x){console.error(`[Construct 3] Function map '${g}' default: function return type not compatible with other functions in the map; entry ignored`);return}}m.defaultFunc=k},CallMappedFunction(g,k,m){m=Math.floor(m);var u=this._GetFunctionMap(g.toLowerCase(),!1);if(u){var x=u.strMap.get(k.toLowerCase()); if(!x)if(u.defaultFunc)x=u.defaultFunc,m=0;else{console.warn(`[Construct 3] Call mapped function: no function associated with map '${g}' string '${k}'; call ignored (consider setting a default)`);return}if(x.IsEnabled())if(0!==x.GetReturnType())console.warn(`[Construct 3] Call mapped function: map '${g}' string '${k}' has a return type so cannot be called`);else{g=this._runtime;k=g.GetEventSheetManager();var n=k.GetCurrentEvent();u=n.GetSolModifiersIncludingParents();var q=0<u.length;q&&k.PushCleanSol(u); var t=[];if(n=k.FindFirstFunctionBlockParent(n)){n=n.GetFunctionParameters();for(let r=m,w=n.length;r<w;++r)t.push(n[r].GetValue())}m=x.GetFunctionParameters();for(let r=t.length,w=m.length;r<w;++r)t.push(m[r].GetInitialValue());return g.IsDebugging()?this._DebugDoCallMappedFunction(k,x,t,q,u):this._DoCallMappedFunction(k,x,t,q,u)}}else console.warn(`[Construct 3] Call mapped function: map name '${g}' not found; call ignored`)}}} {"use strict";const e=self.C3;e.Plugins.System.Exps={int:function(b){"string"===typeof b&&(b=parseInt(b,10),isNaN(b)&&(b=0));return Math.floor(b)},float:function(b){"string"===typeof b&&(b=parseFloat(b),isNaN(b)&&(b=0));return b},str(b){return b.toString()},len(b){return"string"===typeof b?b.length:0},random(b,a){return"undefined"===typeof a?this._runtime.Random()*b:this._runtime.Random()*(a-b)+b},choose(...b){const a=Math.floor(this._runtime.Random()*b.length);return b[a]},pi(){return Math.PI},infinity(){return Infinity}, sqrt(b){return Math.sqrt(b)},abs(b){return Math.abs(b)},round(b){return Math.round(b)},roundtodp(b,a){a=Math.max(Math.floor(a),0);a=Math.pow(10,a);return Math.round((b+Number.EPSILON)*a)/a},floor(b){return Math.floor(b)},ceil(b){return Math.ceil(b)},sign(b){return Math.sign(b)},sin(b){return Math.sin(e.toRadians(b))},cos(b){return Math.cos(e.toRadians(b))},tan(b){return Math.tan(e.toRadians(b))},asin(b){return e.toDegrees(Math.asin(b))},acos(b){return e.toDegrees(Math.acos(b))},atan(b){return e.toDegrees(Math.atan(b))}, exp(b){return Math.exp(b)},ln(b){return Math.log(b)},log10(b){return Math.log(b)/Math.LN10},max(...b){let a=b[0];"number"!==typeof a&&(a=0);for(let d=1,c=b.length;d<c;++d){let f=b[d];"number"===typeof f&&a<f&&(a=f)}return a},min(...b){let a=b[0];"number"!==typeof a&&(a=0);for(let d=1,c=b.length;d<c;++d){let f=b[d];"number"===typeof f&&a>f&&(a=f)}return a},clamp(b,a,d){return e.clamp(b,a,d)},distance(b,a,d,c){return e.distanceTo(b,a,d,c)},angle(b,a,d,c){return e.toDegrees(e.angleTo(b,a,d,c))},lerp(b, a,d){return e.lerp(b,a,d)},unlerp(b,a,d){return e.unlerp(b,a,d)},qarp(b,a,d,c){return e.qarp(b,a,d,c)},cubic(b,a,d,c,f){return e.cubic(b,a,d,c,f)},cosp(b,a,d){return e.cosp(b,a,d)},anglediff(b,a){return e.toDegrees(e.angleDiff(e.toRadians(b),e.toRadians(a)))},anglelerp(b,a,d){return e.toDegrees(e.angleLerp(e.toRadians(b),e.toRadians(a),d))},anglerotate(b,a,d){return e.toDegrees(e.angleRotate(e.toRadians(b),e.toRadians(a),e.toRadians(d)))},setbit(b,a,d){a|=0;return(b|0)&~(1<<a)|(0!==d?1:0)<<a},togglebit(b, a){return(b|0)^1<<(a|0)},getbit(b,a){return(b|0)&1<<(a|0)?1:0},newline(){return"\n"},uppercase(b){return"string"===typeof b?b.toUpperCase():""},lowercase(b){return"string"===typeof b?b.toLowerCase():""},left(b,a){return"string"===typeof b?b.substr(0,a):""},mid(b,a,d){return"string"!==typeof b?"":0>d?b.substr(a):b.substr(a,d)},right(b,a){return"string"===typeof b?b.substr(b.length-a):""},trim(b){return"string"===typeof b?b.trim():""},tokenat(b,a,d){if("string"!==typeof b||"string"!==typeof d)return""; b=b.split(d);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(e.EscapeRegex(a),"i")):-1},findcase(b,a){return"string"===typeof b&&"string"===typeof a?b.search(new RegExp(e.EscapeRegex(a),"")):-1},replace(b,a,d){return"string"===typeof b&&"string"===typeof a&&"string"===typeof d?b.replace(new RegExp(e.EscapeRegex(a),"gi"),d):"string"=== typeof b?b:""},regexsearch(b,a,d){a=this.GetRegex(a,d);return b?b.search(a):-1},regexreplace(b,a,d,c){a=this.GetRegex(a,d);return b?b.replace(a,c):""},regexmatchcount(b,a,d){return(b=this.GetRegexMatches(b.toString(),a,d))?b.length:0},regexmatchat(b,a,d,c){c=Math.floor(c);b=this.GetRegexMatches(b.toString(),a,d);return!b||0>c||c>=b.length?"":b[c]},zeropad(b,a){let d=0>b?"-":"";0>b&&(b=-b);d+="0".repeat(Math.max(a-b.toString().length,0));return d+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 e.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,d){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.CanvasCssToLayer(a,d)[0]:0},canvastolayery(b,a,d){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.CanvasCssToLayer(a,d)[1]:0},layertocanvasx(b,a,d){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.LayerToCanvasCss(a,d)[0]:0},layertocanvasy(b,a,d){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.LayerToCanvasCss(a,d)[1]:0},layerscale(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetOwnScale(): 0},layerangle(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?e.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,...d){var c=this._GetFunctionMap(b.toLowerCase(),!1);if(!c)return console.warn(`[Construct 3] Call mapped function: map name '${b}' not found; returning 0`),0;var f=c.strMap.get(a.toLowerCase());if(!f)if(c.defaultFunc)f=c.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;c=f.GetReturnType();const l= f.GetDefaultReturnValue();if(0===c)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(!f.IsEnabled())return l;b=this._runtime.GetEventSheetManager();a=b.GetCurrentEvent().GetSolModifiersIncludingParents();const g=0<a.length;g&&b.PushCleanSol(a);const k=f.GetFunctionParameters();for(let m=d.length,u=k.length;m<u;++m)d.push(k[m].GetInitialValue());f=f.GetEventBlock();d=f.RunAsExpressionFunctionCall(f.GetSolModifiersIncludingParents(), c,l,...d);g&&b.PopSol(a);return d},loadingprogress(){return this._runtime.GetAssetManager().GetLoadProgress()},imageloadingprogress(){return 0===this._imagesLoadingTotal?1:this._imagesLoadingComplete/this._imagesLoadingTotal},renderer(){return this._runtime.GetWebGPURenderer()?"webgpu":"webgl"},rendererdetail(){return this._runtime.GetWebGPURenderer()?"<unavailable>":this._runtime.GetWebGLRenderer().GetUnmaskedRenderer()},imagememoryusage(){let b=this._runtime.GetRenderer().GetEstimatedTextureMemoryUsage(); return Math.round(100*b/1048576)/100},rgb(b,a,d){return e.PackRGB(b,a,d)},rgbex(b,a,d){return e.PackRGBEx(b/100,a/100,d/100)},rgba(b,a,d,c){return e.PackRGBAEx(b/100,a/100,d/100,c/100)},rgbex255(b,a,d){return e.PackRGBEx(b/255,a/255,d/255)},rgba255(b,a,d,c){return e.PackRGBAEx(b/255,a/255,d/255,c/255)},projectname(){return this._runtime.GetProjectName()},projectversion(){return this._runtime.GetProjectVersion()},currenteventsheetname(){return this._runtime.GetCurrentEvent().GetEventSheet().GetName()}, currenteventnumber(){return this._runtime.GetCurrentEvent().GetDisplayNumber()}}}{"use strict";const e=self.C3;e.Plugins.Sprite=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}} {"use strict";const e=self.C3;e.Plugins.Sprite.Type=class extends e.SDKTypeBase{constructor(b){super(b);this._animations=b.GetAnimations()}Release(){e.clearArray(this._animations);super.Release()}OnCreate(){for(const b of this._animations)b.LoadAllAssets(this._runtime)}LoadTextures(b){const a={sampling:this._runtime.GetSampling()};return Promise.all(this._animations.map(d=>d.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){e.Plugins.Sprite.FinishCollisionCondition(this, b)}}} {"use strict";const e=self.C3,b=self.C3X,a=e.New(e.Rect),d=e.New(e.Quad),c=e.New(e.Vector2);e.Plugins.Sprite.Instance=class extends e.SDKWorldInstanceBase{constructor(g,k){super(g);let m=!0,u="",x=0,n=!0;k&&(m=!!k[0],u=k[1],x=k[2],n=k[3]);this._currentAnimation=this._objectClass.GetAnimationByName(u)||this._objectClass.GetAnimations()[0];this._currentFrameIndex=e.clamp(x,0,this._currentAnimation.GetFrameCount()-1);this._currentAnimationFrame=this._currentAnimation.GetFrameAt(this._currentFrameIndex);k= this._currentAnimationFrame.GetImageInfo();this._currentTexture=k.GetTexture();this._currentRcTex=k.GetTexRect();this._currentQuadTex=k.GetTexQuad();this.HandleWebGLContextLoss();g.SetFlag(2,!0);g.SetFlag(1,0<=this._currentAnimation.GetSpeed());this._currentAnimationSpeed=Math.abs(this._currentAnimation.GetSpeed());this._currentAnimationRepeatTo=this._currentAnimation.GetRepeatTo();this._animationTimer=e.New(e.KahanSum);this._animationRepeats=this._frameStartTime=0;this._animTriggerName="";this._changeAnimFrameIndex= -1;this._changeAnimationName="";this._changeAnimationFrom=0;g=this.GetWorldInfo();this._bquadRef=g.GetBoundingQuad();g.SetVisible(m);g.SetCollisionEnabled(n);g.SetOriginX(this._currentAnimationFrame.GetOriginX());g.SetOriginY(this._currentAnimationFrame.GetOriginY());g.SetSourceCollisionPoly(this._currentAnimationFrame.GetCollisionPoly());g.SetBboxChanged();1===this._objectClass.GetAnimationCount()&&1===this._objectClass.GetAnimations()[0].GetFrameCount()||0===this._currentAnimationSpeed||this._StartTicking()}Release(){this._animationTimer= this._currentTexture=this._currentAnimationFrame=this._currentAnimation=null;super.Release()}GetCurrentImageInfo(){return this._currentAnimationFrame.GetImageInfo()}IsOriginalSizeKnown(){return!0}OnWebGLContextLost(){this._currentTexture=null}OnWebGLContextRestored(){this._UpdateCurrentTexture()}Draw(g){var k=this._currentTexture;null!==k&&(g.SetTexture(k),k=this.GetWorldInfo(),k.HasMesh()?this._DrawMesh(k,g):this._DrawStandard(k,g))}_DrawStandard(g,k){let m=this._bquadRef;this._runtime.IsPixelRoundingEnabled()&& (m=g.PixelRoundQuad(m));k.Quad4(m,this._currentQuadTex)}_DrawMesh(g,k){const m=g.GetTransformedMesh();if(g.IsMeshChanged()){g.CalculateBbox(a,d,!1);let u=d;this._runtime.IsPixelRoundingEnabled()&&(u=g.PixelRoundQuad(u));m.CalculateTransformedMesh(g.GetSourceMesh(),u,this._currentQuadTex);g.SetMeshChanged(!1)}m.Draw(k)}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 k=this._runtime.GetDt(this._inst);this._animationTimer.Add(k);k=this.GetAnimationTime();var m=this._currentAnimationFrame,u=m.GetDuration()/g;if(!(k<this._frameStartTime+u)){var x=this._currentAnimation, n=this._currentAnimationRepeatTo,q=x.GetFrameCount(),t=x.GetRepeatCount(),r=x.IsLooping(),w=x.IsPingPong();this.IsPlayingForwards()?this._currentFrameIndex++:this._currentFrameIndex--;this._frameStartTime+=u;this._currentFrameIndex>=q&&(w?(this.SetPlayingForwards(!1),this._currentFrameIndex=q-2):r?this._currentFrameIndex=n:(this._animationRepeats++,this._animationRepeats>=t?this._FinishAnimation(!1):this._currentFrameIndex=n));0>this._currentFrameIndex&&(w?(this._currentFrameIndex=1,this.SetPlayingForwards(!0), r||(this._animationRepeats++,this._animationRepeats>=t&&this._FinishAnimation(!0))):r?this._currentFrameIndex=n:(this._animationRepeats++,this._animationRepeats>=t?this._FinishAnimation(!0):this._currentFrameIndex=n));this._currentFrameIndex=e.clamp(this._currentFrameIndex,0,q-1);u=x.GetFrameAt(this._currentFrameIndex);k>this._frameStartTime+u.GetDuration()/g&&(this._frameStartTime=k);this._OnFrameChanged(m,u)}}else this._StopTicking()}_FinishAnimation(g){this._currentFrameIndex=g?0:this._currentAnimation.GetFrameCount()- 1;this.SetAnimationPlaying(!1);this._animTriggerName=this._currentAnimation.GetName();this.SetInAnimationTrigger(!0);this.Trigger(e.Plugins.Sprite.Cnds.OnAnyAnimFinished);this.Trigger(e.Plugins.Sprite.Cnds.OnAnimFinished);this.SetInAnimationTrigger(!1);this._animationRepeats=0}_OnFrameChanged(g,k){if(g!==k){var m=this.GetWorldInfo(),u=g.GetImageInfo(),x=k.GetImageInfo(),n=u.GetWidth();u=u.GetHeight();var q=x.GetWidth(),t=x.GetHeight();n!==q&&m.SetWidth(m.GetWidth()*(q/n));u!==t&&m.SetHeight(m.GetHeight()* (t/u));m.SetOriginX(k.GetOriginX());m.SetOriginY(k.GetOriginY());m.SetSourceCollisionPoly(k.GetCollisionPoly());m.SetBboxChanged();this._currentAnimationFrame=k;this._currentTexture=x.GetTexture();this._currentRcTex=x.GetTexRect();this._currentQuadTex=x.GetTexQuad();m=this.GetInstance().GetBehaviorInstances();for(let r=0,w=m.length;r<w;++r)m[r].OnSpriteFrameChanged(g,k);this.Trigger(e.Plugins.Sprite.Cnds.OnFrameChanged);this._runtime.UpdateRender()}}_StartAnim(g){this.SetAnimationPlaying(!0);this._frameStartTime= this.GetAnimationTime();1===g&&0!==this._currentFrameIndex&&(this._changeAnimFrameIndex=0,this.IsInAnimationTrigger()||this._DoChangeAnimFrame());this._StartTicking()}_SetAnim(g,k){this._changeAnimationName=g;this._changeAnimationFrom=k;this._StartTicking();this.IsInAnimationTrigger()||this._DoChangeAnimation()}_GetCurrentAnimationName(){return this._changeAnimationName?this._changeAnimationName:this._currentAnimation.GetName()}_SetAnimFrame(g){isFinite(g)&&(this._changeAnimFrameIndex=g,this.IsInAnimationTrigger()|| this._DoChangeAnimFrame())}_GetAnimFrame(){return this._currentFrameIndex}_SetAnimSpeed(g){this._currentAnimationSpeed=Math.abs(g);this.SetPlayingForwards(0<=g);0<this._currentAnimationSpeed&&this._StartTicking()}_GetAnimSpeed(){return this.IsPlayingForwards()?this._currentAnimationSpeed:-this._currentAnimationSpeed}_SetAnimRepeatToFrame(g){this._currentAnimationRepeatTo=g=e.clamp(Math.floor(g),0,this._currentAnimation.GetFrameCount()-1)}_GetAnimRepeatToFrame(){return this._currentAnimationRepeatTo}_DoChangeAnimation(){const g= this._currentAnimationFrame;var k=this._objectClass.GetAnimationByName(this._changeAnimationName);this._changeAnimationName="";!k||k===this._currentAnimation&&this.IsAnimationPlaying()||(this._currentAnimation=k,this.SetPlayingForwards(0<=k.GetSpeed()),this._currentAnimationSpeed=Math.abs(k.GetSpeed()),this._currentAnimationRepeatTo=k.GetRepeatTo(),this._currentFrameIndex=e.clamp(this._currentFrameIndex,0,this._currentAnimation.GetFrameCount()-1),1===this._changeAnimationFrom&&(this._currentFrameIndex= 0),this.SetAnimationPlaying(!0),this._frameStartTime=this.GetAnimationTime(),k=this._currentAnimation.GetFrameAt(this._currentFrameIndex),this._OnFrameChanged(g,k))}_DoChangeAnimFrame(){const g=this._currentAnimationFrame;var k=this._currentFrameIndex;this._currentFrameIndex=e.clamp(Math.floor(this._changeAnimFrameIndex),0,this._currentAnimation.GetFrameCount()-1);this._changeAnimFrameIndex=-1;k!==this._currentFrameIndex&&(k=this._currentAnimation.GetFrameAt(this._currentFrameIndex),this._OnFrameChanged(g, k),this._frameStartTime=this.GetAnimationTime())}_UpdateCurrentTexture(){const g=this._currentAnimationFrame.GetImageInfo();this._currentTexture=g.GetTexture();this._currentRcTex=g.GetTexRect();this._currentQuadTex=g.GetTexQuad();this.GetWorldInfo().SetMeshChanged(!0)}GetTexture(){return this._currentTexture}GetTexRect(){return this._currentRcTex}GetTexQuad(){return this._currentQuadTex}GetImagePointCount(){return this._currentAnimationFrame.GetImagePointCount()}GetImagePoint(g){const k=this._currentAnimationFrame, m=this.GetWorldInfo();if("string"===typeof g)g=k.GetImagePointByName(g);else if("number"===typeof g)g=k.GetImagePointByIndex(g-1);else throw new TypeError("expected string or number");if(!g)return[m.GetX(),m.GetY()];c.copy(g.GetVec2());if(m.HasMesh()){const [u,x]=m.GetSourceMesh().TransformPoint(c.getX(),c.getY());c.set(u,x)}c.offset(-k.GetOriginX(),-k.GetOriginY());c.scale(m.GetWidth(),m.GetHeight());c.rotate(m.GetAngle());c.offset(m.GetX(),m.GetY());return[c.getX(),c.getY()]}GetCollisionPolyPointCount(){return this.GetWorldInfo().GetTransformedCollisionPoly().pointCount()}GetCollisionPolyPoint(g){g= Math.floor(g);const k=this.GetWorldInfo();var m=k.GetTransformedCollisionPoly();const u=m.pointCount();g===u&&(g=0);if(0>g||g>=u)return[0,0];m=m.pointsArr();return[m[2*g]+k.GetX(),m[2*g+1]+k.GetY()]}GetDebuggerProperties(){const g=e.Plugins.Sprite.Acts;return[{title:"plugins.sprite.debugger.animation-properties.title",properties:[{name:"plugins.sprite.debugger.animation-properties.current-animation",value:this._currentAnimation.GetName(),onedit:k=>this.CallAction(g.SetAnim,k,0)},{name:"plugins.sprite.debugger.animation-properties.current-frame", value:this._currentFrameIndex,onedit:k=>this.CallAction(g.SetAnimFrame,k)},{name:"plugins.sprite.debugger.animation-properties.is-playing",value:this.IsAnimationPlaying(),onedit:k=>k?this.CallAction(g.StartAnim,0):this.CallAction(g.StopAnim)},{name:"plugins.sprite.debugger.animation-properties.speed",value:this._currentAnimationSpeed,onedit:k=>this.CallAction(g.SetAnimSpeed,k)},{name:"plugins.sprite.debugger.animation-properties.repeats",value:this._animationRepeats,onedit:k=>this._animationRepeats= k}]}]}SaveToJson(){const g={a:this._currentAnimation.GetSID()};0!==this._frameStartTime&&(g.fs=this._frameStartTime);var k=this.GetAnimationTime();0!==k&&(g.at=k);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());k=this.GetWorldInfo();k.IsCollisionEnabled()&&(g.ce=k.IsCollisionEnabled());return g}LoadFromJson(g){var k=this.GetObjectClass().GetAnimationBySID(g.a);k&&(this._currentAnimation=k);this._frameStartTime=g.hasOwnProperty("fs")?g.fs:0;this._animationTimer.Set(g.hasOwnProperty("at")?g.at:0);k=g.hasOwnProperty("f")?g.f:0;this._currentFrameIndex=e.clamp(k,0,this._currentAnimation.GetFrameCount()-1);this._currentAnimationSpeed=g.hasOwnProperty("cas")?g.cas:0;this._animationRepeats= g.hasOwnProperty("ar")?g.ar:1;k=g.hasOwnProperty("rt")?g.rt:0;this._currentAnimationRepeatTo=e.clamp(k,0,this._currentAnimation.GetFrameCount()-1);this.SetAnimationPlaying(g.hasOwnProperty("ap")?!!g.ap:!0);this.SetPlayingForwards(g.hasOwnProperty("af")?!!g.af:!0);this._currentAnimationFrame=k=this._currentAnimation.GetFrameAt(this._currentFrameIndex);this._UpdateCurrentTexture();const m=this.GetWorldInfo();m.SetOriginX(k.GetOriginX());m.SetOriginY(k.GetOriginY());m.SetSourceCollisionPoly(k.GetCollisionPoly()); m.SetCollisionEnabled(!!g.ce)}GetPropertyValueByIndex(g){const k=this.GetWorldInfo();switch(g){case 3:return k.IsCollisionEnabled();case 2:return e.clamp(this._currentFrameIndex,0,this._currentAnimation.GetFrameCount()-1)}}SetPropertyValueByIndex(g,k){var m=this.GetWorldInfo();switch(g){case 3:m.SetCollisionEnabled(!!k);break;case 2:this.SetAnimationPlaying(!1);g=this._currentAnimation.GetFrameCount()-1;m=k=e.clamp(k,0,g);k=this._currentAnimation.GetFrameAt(this._currentFrameIndex);const u=this._currentAnimation.GetFrameAt(m); this._OnFrameChanged(k,u);this._currentFrameIndex=e.clamp(m,0,g)}}GetScriptInterfaceClass(){return self.ISpriteInstance}};const f=new WeakMap,l=new Map([["current-frame",0],["beginning",1]]);self.ISpriteInstance=class extends self.IWorldInstance{constructor(){super();f.set(this,self.IInstance._GetInitInst().GetSdkInstance())}getImagePointCount(){return f.get(this).GetImagePointCount()}getImagePointX(g){if("string"!==typeof g&&"number"!==typeof g)throw new TypeError("expected string or number");return f.get(this).GetImagePoint(g)[0]}getImagePointY(g){if("string"!== typeof g&&"number"!==typeof g)throw new TypeError("expected string or number");return f.get(this).GetImagePoint(g)[1]}getImagePoint(g){if("string"!==typeof g&&"number"!==typeof g)throw new TypeError("expected string or number");return f.get(this).GetImagePoint(g)}getPolyPointCount(){return f.get(this).GetCollisionPolyPointCount()}getPolyPointX(g){b.RequireFiniteNumber(g);return f.get(this).GetCollisionPolyPoint(g)[0]}getPolyPointY(g){b.RequireFiniteNumber(g);return f.get(this).GetCollisionPolyPoint(g)[1]}getPolyPoint(g){b.RequireFiniteNumber(g); return f.get(this).GetCollisionPolyPoint(g)}stopAnimation(){f.get(this).SetAnimationPlaying(!1)}startAnimation(g="current-frame"){b.RequireString(g);g=l.get(g);if("undefined"===typeof g)throw Error("invalid mode");f.get(this)._StartAnim(g)}setAnimation(g,k="beginning"){b.RequireString(g);b.RequireString(k);k=l.get(k);if("undefined"===typeof k)throw Error("invalid mode");f.get(this)._SetAnim(g,k)}get animationName(){return f.get(this)._GetCurrentAnimationName()}set animationFrame(g){b.RequireFiniteNumber(g); f.get(this)._SetAnimFrame(g)}get animationFrame(){return f.get(this)._GetAnimFrame()}set animationSpeed(g){b.RequireFiniteNumber(g);f.get(this)._SetAnimSpeed(g)}get animationSpeed(){return f.get(this)._GetAnimSpeed()}set animationRepeatToFrame(g){b.RequireFiniteNumber(g);f.get(this)._SetAnimRepeatToFrame(g)}get animationRepeatToFrame(){return f.get(this)._GetAnimRepeatToFrame()}get imageWidth(){return f.get(this).GetCurrentImageInfo().GetWidth()}get imageHeight(){return f.get(this).GetCurrentImageInfo().GetHeight()}}} {"use strict";const e=self.C3;e.Plugins.Sprite.Cnds={IsAnimPlaying(b){return e.equalsNoCase(this._GetCurrentAnimationName(),b)},CompareFrame(b,a){return e.compare(this._currentFrameIndex,b,a)},CompareAnimSpeed(b,a){return e.compare(this._GetAnimSpeed(),b,a)},OnAnimFinished(b){return e.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 e=self.C3;e.Plugins.Sprite.Acts={Spawn(b,a,d,c){if(b&&a){var [f,l]=this.GetImagePoint(d);if(d=this._runtime.CreateInstance(b,a,f,l,c)){c&&a.SortAndAddInstancesByZIndex(d);b.GetPlugin().IsRotatable()&&(a=d.GetWorldInfo(),a.SetAngle(this.GetWorldInfo().GetAngle()),a.SetBboxChanged());a=this._runtime.GetEventSheetManager();a.BlockFlushingInstances(!0);d._TriggerOnCreatedOnSelfAndRelated();a.BlockFlushingInstances(!1);c=this._runtime.GetCurrentAction().GetSavedDataMap();a=!1;if(!c.has("Spawn_LastExec")|| c.get("Spawn_LastExec")<this._runtime.GetExecCount())a=!0,c.set("Spawn_LastExec",this._runtime.GetExecCount());if(b!==this.GetObjectClass()&&(b=b.GetCurrentSol(),b._SetSelectAll(!1),b=b._GetOwnInstances(),a&&e.clearArray(b),b.push(d),d.IsInContainer()))for(const g of d.siblings())d=g.GetObjectClass().GetCurrentSol(),a?d.SetSinglePicked(g):(d._SetSelectAll(!1),d._PushInstance(g))}}},StopAnim(){this.SetAnimationPlaying(!1)},StartAnim(b){this._StartAnim(b)},SetAnim(b,a){this._SetAnim(b,a)},SetAnimFrame(b){this._SetAnimFrame(b)}, SetAnimSpeed(b){this._SetAnimSpeed(b)},SetAnimRepeatToFrame(b){this._SetAnimRepeatToFrame(b)},SetMirrored(b){const a=this.GetWorldInfo(),d=a.GetWidth();b=Math.abs(d)*(0===b?-1:1);d!==b&&(a.SetWidth(b),a.SetBboxChanged())},SetFlipped(b){const a=this.GetWorldInfo(),d=a.GetHeight();b=Math.abs(d)*(0===b?-1:1);d!==b&&(a.SetHeight(b),a.SetBboxChanged())},SetScale(b){const a=this._currentAnimationFrame.GetImageInfo(),d=this.GetWorldInfo();var c=0>d.GetWidth()?-1:1;const f=0>d.GetHeight()?-1:1;c*=a.GetWidth()* b;b=a.GetHeight()*b*f;if(d.GetWidth()!==c||d.GetHeight()!==b)d.SetSize(c,b),d.SetBboxChanged()},async LoadURL(b,a,d){d=this._currentAnimationFrame.GetImageInfo();const c=this.GetWorldInfo(),f=this._runtime;if(d.GetURL()===b)0===a&&(c.SetSize(d.GetWidth(),d.GetHeight()),c.SetBboxChanged()),this.Trigger(e.Plugins.Sprite.Cnds.OnURLLoaded);else{var l=e.New(e.ImageInfo);try{await l.LoadDynamicAsset(f,b);if(!l.IsLoaded())throw Error("image failed to load");await l.LoadStaticTexture(f.GetRenderer(),{sampling:this._runtime.GetSampling()})}catch(g){console.error("Load image from URL failed: ", g);this.Trigger(e.Plugins.Sprite.Cnds.OnURLFailed);return}d.ReplaceWith(l);this._sdkType._UpdateAllCurrentTexture();this.WasReleased()||0!==a||(c.SetSize(d.GetWidth(),d.GetHeight()),c.SetBboxChanged());f.UpdateRender();this.WasReleased()||await this.TriggerAsync(e.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(e){return this.GetImagePoint(e)[0]},ImagePointY(e){return this.GetImagePoint(e)[1]},ImagePointCount(){return this.GetImagePointCount()},ImageWidth(){return this.GetCurrentImageInfo().GetWidth()}, ImageHeight(){return this.GetCurrentImageInfo().GetHeight()},PolyPointXAt(e){return this.GetCollisionPolyPoint(e)[0]},PolyPointYAt(e){return this.GetCollisionPolyPoint(e)[1]},PolyPointCount(){return this.GetCollisionPolyPointCount()}};{"use strict";const e=self.C3;e.Plugins.TiledBg=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}} {"use strict";const e=self.C3;function b(a){switch(a){case 0:return"clamp-to-edge";case 2:return"mirror-repeat"}return"repeat"}e.Plugins.TiledBg.Type=class extends e.SDKTypeBase{constructor(a,d){super(a);this._wrapY=this._wrapX="repeat";d&&(this._wrapX=b(d[0]),this._wrapY=b(d[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 e=self.C3,b=self.C3X,a=e.New(e.Rect),d=e.New(e.Quad),c=e.New(e.Rect),f=e.New(e.Quad);e.Plugins.TiledBg.Instance=class extends e.SDKWorldInstanceBase{constructor(g,k){super(g);this._imageOffsetY=this._imageOffsetX=0;this._imageScaleY=this._imageScaleX=1;this._imageAngle=0;this._ownImageInfo=null;k&&(this.GetWorldInfo().SetVisible(!!k[0]),this._imageOffsetX=k[4],this._imageOffsetY=k[5],this._imageScaleX=k[6],this._imageScaleY=k[7],this._imageAngle=e.toRadians(k[8]))}Release(){this._ReleaseOwnImage(); super.Release()}_ReleaseOwnImage(){this._ownImageInfo&&(this._ownImageInfo.Release(),this._ownImageInfo=null)}CalculateTextureCoordsFor3DFace(g,k,m){var u=this.GetCurrentImageInfo();const x=u.GetWidth();u=u.GetHeight();const n=this._imageOffsetX/x,q=this._imageOffsetY/u,t=this._imageAngle;c.set(0,0,g/(x*this._imageScaleX),k/(u*this._imageScaleY));c.offset(-n,-q);0===t?m.setFromRect(c):m.setFromRotatedRect(c,-t)}Draw(g){var k=this.GetCurrentImageInfo(),m=k.GetTexture();if(null!==m){g.SetTexture(m); m=k.GetWidth();k=k.GetHeight();var u=this._imageOffsetX/m,x=this._imageOffsetY/k,n=this.GetWorldInfo();c.set(0,0,n.GetWidth()/(m*this._imageScaleX),n.GetHeight()/(k*this._imageScaleY));c.offset(-u,-x);n.HasMesh()?this._DrawMesh(n,g):this._DrawStandard(n,g)}}_DrawStandard(g,k){let m=g.GetBoundingQuad();this._runtime.IsPixelRoundingEnabled()&&(m=g.PixelRoundQuad(m));0===this._imageAngle?k.Quad3(m,c):(f.setFromRotatedRect(c,-this._imageAngle),k.Quad4(m,f))}_DrawMesh(g,k){const m=g.GetTransformedMesh(); if(g.IsMeshChanged()){g.CalculateBbox(a,d,!1);let u=d;this._runtime.IsPixelRoundingEnabled()&&(u=g.PixelRoundQuad(u));let x=c;0!==this._imageAngle&&(f.setFromRotatedRect(c,-this._imageAngle),x=f);m.CalculateTransformedMesh(g.GetSourceMesh(),u,x);g.SetMeshChanged(!1)}m.Draw(k)}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, k){switch(g){case 4:this._SetImageOffsetX(k);break;case 5:this._SetImageOffsetY(k);break;case 6:this._SetImageScaleX(k);break;case 7:this._SetImageScaleY(k);break;case 8:this._SetImageAngle(k)}}GetScriptInterfaceClass(){return self.ITiledBackgroundInstance}};const l=new WeakMap;self.ITiledBackgroundInstance=class extends self.IWorldInstance{constructor(){super();l.set(this,self.IInstance._GetInitInst().GetSdkInstance())}set imageOffsetX(g){b.RequireFiniteNumber(g);l.get(this)._SetImageOffsetX(g)}get imageOffsetX(){return l.get(this)._GetImageOffsetX()}set imageOffsetY(g){b.RequireFiniteNumber(g); l.get(this)._SetImageOffsetY(g)}get imageOffsetY(){return l.get(this)._GetImageOffsetY()}set imageScaleX(g){b.RequireFiniteNumber(g);l.get(this)._SetImageScaleX(g)}get imageScaleX(){return l.get(this)._GetImageScaleX()}set imageScaleY(g){b.RequireFiniteNumber(g);l.get(this)._SetImageScaleY(g)}get imageScaleY(){return l.get(this)._GetImageScaleY()}set imageAngle(g){b.RequireFiniteNumber(g);l.get(this)._SetImageAngle(g)}get imageAngle(){return l.get(this)._GetImageAngle()}set imageAngleDegrees(g){b.RequireFiniteNumber(g); l.get(this)._SetImageAngle(e.toRadians(g))}get imageAngleDegrees(){return e.toDegrees(l.get(this)._GetImageAngle())}get imageWidth(){return l.get(this).GetCurrentImageInfo().GetWidth()}get imageHeight(){return l.get(this).GetCurrentImageInfo().GetHeight()}}}"use strict";self.C3.Plugins.TiledBg.Cnds={OnURLLoaded(){return!0},OnURLFailed(){return!0}}; {"use strict";const e=self.C3;e.Plugins.TiledBg.Acts={SetImageOffsetX(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(e.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 d=e.New(e.ImageInfo);try{await d.LoadDynamicAsset(a, b);if(!d.IsLoaded())throw Error("image failed to load");if(this.WasReleased())return d.Release(),null;if(!await d.LoadStaticTexture(a.GetRenderer(),{sampling:this._runtime.GetSampling(),wrapX:"repeat",wrapY:"repeat"}))return}catch(c){console.error("Load image from URL failed: ",c);this.Trigger(e.Plugins.TiledBg.Cnds.OnURLFailed);return}this.WasReleased()?d.Release():(this._ReleaseOwnImage(),this._ownImageInfo=d,a.UpdateRender(),await this.TriggerAsync(e.Plugins.TiledBg.Cnds.OnURLLoaded))}}}} {"use strict";const e=self.C3;e.Plugins.TiledBg.Exps={ImageWidth(){return this.GetCurrentImageInfo().GetWidth()},ImageHeight(){return this.GetCurrentImageInfo().GetHeight()},ImageOffsetX(){return this._imageOffsetX},ImageOffsetY(){return this._imageOffsetY},ImageScaleX(){return 100*this._imageScaleX},ImageScaleY(){return 100*this._imageScaleY},ImageAngle(){return e.toDegrees(this._imageAngle)}}}{"use strict";const e=self.C3;e.Plugins.Spritefont2=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}} {"use strict";const e=self.C3;e.Plugins.Spritefont2.Type=class extends e.SDKTypeBase{constructor(b){super(b);this._spriteFont=e.New(self.SpriteFont)}Release(){super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}LoadTextures(b){return this.GetImageInfo().LoadStaticTexture(b,{sampling:this._runtime.GetSampling()})}ReleaseTextures(){this.GetImageInfo().ReleaseTexture()}GetSpriteFont(){return this._spriteFont}UpdateSettings(b,a,d,c){const f=this.GetImageInfo(),l=this._spriteFont;l.SetWidth(f.GetWidth()); l.SetHeight(f.GetHeight());l.SetCharacterWidth(b);l.SetCharacterHeight(a);l.SetCharacterSet(d);l.SetSpacingData(c);l.UpdateCharacterMap()}}} {"use strict";const e=self.C3,b=self.C3X,a=["left","center","right"],d=["top","center","bottom"];e.Plugins.Spritefont2.Instance=class extends e.SDKWorldInstanceBase{constructor(k,m){super(k);this._text="";this._enableBBcode=!0;this._characterHeight=this._characterWidth=16;this._characterSet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,;:?!-_~#\"'&()[]|`\\/@\u00b0+=*$\u00a3\u20ac<>";k="";this._characterScale=1;this._verticalAlign=this._horizontalAlign=this._lineHeight=this._characterSpacing= 0;this._wrapByWord=!0;this._spriteFontText=null;this._typewriterEndTime=this._typewriterStartTime=-1;this._typewriterLength=0;m&&(this._text=m[0],this._enableBBcode=m[1],this._characterWidth=m[2],this._characterHeight=m[3],this._characterSet=m[4],k=m[5],this._characterScale=m[6],this._characterSpacing=m[7],this._lineHeight=m[8],this._horizontalAlign=m[9],this._verticalAlign=m[10],this._wrapByWord=0===m[11],this.GetWorldInfo().SetVisible(m[12]));this._sdkType.UpdateSettings(this._characterWidth,this._characterHeight, this._characterSet,k);this._spriteFontText=e.New(self.SpriteFontText,this._sdkType.GetSpriteFont());m=this.GetWorldInfo();this._spriteFontText.SetSize(m.GetWidth(),m.GetHeight());this._UpdateSettings();this._inst.SetMustMitigateZFighting()}Release(){this._CancelTypewriter();this._spriteFontText.Release();this._spriteFontText=null;super.Release()}_UpdateSettings(){const k=this._spriteFontText;k&&(k.SetBBCodeEnabled(this._enableBBcode),k.SetText(this._text),k.SetWordWrapMode(this._wrapByWord?"word": "character"),k.SetHorizontalAlign(a[this._horizontalAlign]),k.SetVerticalAlign(d[this._verticalAlign]),k.SetSpacing(this._characterSpacing),k.SetLineHeight(this._lineHeight))}Draw(k){const m=this._objectClass.GetImageInfo();var u=m.GetTexture();if(u){k.SetTexture(u);u=this.GetWorldInfo();var x=u.GetBoundingQuad(),n=this._spriteFontText;n.SetScale(this._characterScale);n.SetSceneGraphScale(u.GetSceneGraphScale());this._runtime.IsPixelRoundingEnabled()&&(x=u.PixelRoundQuad(x));n.SetSize(u.GetWidth(), u.GetHeight());n.GetSpriteFont().SetTexRect(m.GetTexRect());n.SetColor(u.GetUnpremultipliedColor());n.Draw(k,x.getTlx(),x.getTly(),u.GetAngle())}}SaveToJson(){const k={t:this._text,ebbc:this._enableBBcode,csc:this._characterScale,csp:this._characterSpacing,lh:this._lineHeight,ha:this._horizontalAlign,va:this._verticalAlign,w:this._wrapByWord,cw:this._sdkType.GetSpriteFont().GetCharacterWidth(),ch:this._sdkType.GetSpriteFont().GetCharacterHeight(),cs:this._sdkType.GetSpriteFont().GetCharacterSet(), sd:this._sdkType.GetSpriteFont().GetSpacingData()};-1!==this._typewriterEndTime&&(k.tw={st:this._typewriterStartTime,en:this._typewriterEndTime,l:this._typewriterLength});return k}LoadFromJson(k){this._CancelTypewriter();this._text=k.t;this._enableBBcode=k.ebbc;this._characterScale=k.csc;this._characterSpacing=k.csp;this._lineHeight=k.lh;this._horizontalAlign=k.ha;this._verticalAlign=k.va;this._wrapByWord=k.w;if(k.hasOwnProperty("tw")){var m=k.tw;this._typewriterStartTime=m.st;this._typewriterEndTime= m.en;this._typewriterLength=k.l}m=this._sdkType.GetSpriteFont();m.SetCharacterWidth(k.cw);m.SetCharacterHeight(k.ch);m.SetCharacterSet(k.cs);m.SetSpacingData(k.sd);this._UpdateSettings();-1!==this._typewriterEndTime&&this._StartTicking()}GetPropertyValueByIndex(k){switch(k){case 0:return this._text;case 1:return this._enableBBcode;case 2:return this._sdkType.GetSpriteFont().GetCharacterWidth();case 3:return this._sdkType.GetSpriteFont().GetCharacterHeight();case 4:return this._sdkType.GetSpriteFont().GetCharacterSet(); case 5:return this._sdkType.GetSpriteFont().GetSpacingData();case 6:return this._characterScale;case 7:return this._characterSpacing;case 8:return this._lineHeight;case 9:return this._horizontalAlign;case 10:return this._verticalAlign;case 11:return this._wrapByWord?1:0}}SetPropertyValueByIndex(k,m){switch(k){case 0:if(this._text===m)break;this._text=m;this._UpdateSettings();break;case 1:if(this._enableBBcode===!!m)break;this._enableBBcode=!!m;this._UpdateSettings();break;case 2:this._sdkType.GetSpriteFont().SetCharacterWidth(m); break;case 3:this._sdkType.GetSpriteFont().SetCharacterHeight(m);break;case 4:this._sdkType.GetSpriteFont().SetCharacterSet(m);break;case 5:this._sdkType.GetSpriteFont().SetSpacingData(m);break;case 6:if(this._characterScale===m)break;this._characterScale=m;this._UpdateSettings();break;case 7:if(this._characterSpacing===m)break;this._characterSpacing=m;this._UpdateSettings();break;case 8:if(this._lineHeight===m)break;this._lineHeight=m;this._UpdateSettings();break;case 9:if(this._horizontalAlign=== m)break;this._horizontalAlign=m;this._UpdateSettings();break;case 10:if(this._verticalAlign===m)break;this._verticalAlign=m;this._UpdateSettings();break;case 11:this._wrapByWord!==(0===m)&&(this._wrapByWord=0===m,this._UpdateSettings())}}_SetText(k){this._text!==k&&(this._text=k,this._spriteFontText.SetText(k),this._runtime.UpdateRender())}GetText(){return this._text}_StartTypewriter(k,m){this._SetText(k);this._typewriterStartTime=this._runtime.GetWallTime();this._typewriterEndTime=this._typewriterStartTime+ m/this.GetInstance().GetActiveTimeScale();this._typewriterLength=e.BBString.StripAnyTags(k).length;this._spriteFontText.SetDrawMaxCharacterCount(0);this._StartTicking()}_CancelTypewriter(){this._typewriterEndTime=this._typewriterStartTime=-1;this._typewriterLength=0;this._spriteFontText.SetDrawMaxCharacterCount(-1);this._StopTicking()}_FinishTypewriter(){-1!==this._typewriterEndTime&&(this._CancelTypewriter(),this.Trigger(e.Plugins.Spritefont2.Cnds.OnTypewriterTextFinished),this._runtime.UpdateRender())}_SetScale(k){this._characterScale!== k&&(this._characterScale=k,this._spriteFontText.SetScale(this._characterScale),this._runtime.UpdateRender())}_GetScale(){return this._characterScale}_SetCharacterSpacing(k){this._characterSpacing!==k&&(this._characterSpacing=k,this._spriteFontText.SetSpacing(this._characterSpacing),this._runtime.UpdateRender())}_GetCharacterSpacing(){return this._characterSpacing}_SetLineHeight(k){this._lineHeight!==k&&(this._lineHeight=k,this._spriteFontText.SetLineHeight(this._lineHeight),this._runtime.UpdateRender())}_GetLineHeight(){return this._lineHeight}_SetHAlign(k){this._horizontalAlign!== k&&(this._horizontalAlign=k,this._UpdateSettings(),this._runtime.UpdateRender())}_GetHAlign(){return this._horizontalAlign}_SetVAlign(k){this._verticalAlign!==k&&(this._verticalAlign=k,this._UpdateSettings(),this._runtime.UpdateRender())}_GetVAlign(){return this._verticalAlign}_SetWrapByWord(k){k=!!k;this._wrapByWord!==k&&(this._wrapByWord=k,this._UpdateSettings(),this._runtime.UpdateRender())}_IsWrapByWord(){return this._wrapByWord}Tick(){var k=this._runtime.GetWallTime();k>=this._typewriterEndTime? (this._CancelTypewriter(),this.Trigger(e.Plugins.Spritefont2.Cnds.OnTypewriterTextFinished),this._runtime.UpdateRender()):(k=e.relerp(this._typewriterStartTime,this._typewriterEndTime,k,0,this._typewriterLength),k=Math.floor(k),k!==this._spriteFontText.GetDrawMaxCharacterCount()&&(this._spriteFontText.SetDrawMaxCharacterCount(k),this._runtime.UpdateRender()))}GetDebuggerProperties(){return[{title:"plugins.spritefont2.name",properties:[{name:"plugins.spritefont2.properties.text.name",value:this._text, onedit:k=>this._SetText(k)}]}]}GetScriptInterfaceClass(){return self.ISpriteFontInstance}};const c=new WeakMap,f=new Map([["left",0],["center",1],["right",2]]),l=new Map([["top",0],["center",1],["bottom",2]]),g=new Map([["word",!0],["character",!1]]);self.ISpriteFontInstance=class extends self.IWorldInstance{constructor(){super();c.set(this,self.IInstance._GetInitInst().GetSdkInstance())}get text(){return c.get(this).GetText()}set text(k){b.RequireString(k);const m=c.get(this);m._CancelTypewriter(); m._SetText(k)}typewriterText(k,m){b.RequireString(k);b.RequireFiniteNumber(m);const u=c.get(this);u._CancelTypewriter();u._StartTypewriter(k,m)}typewriterFinish(){c.get(this)._FinishTypewriter()}set characterScale(k){b.RequireFiniteNumber(k);c.get(this)._SetScale(k)}get characterScale(){return c.get(this)._GetScale()}set characterSpacing(k){b.RequireFiniteNumber(k);c.get(this)._SetCharacterSpacing(k)}get characterSpacing(){return c.get(this)._GetCharacterSpacing()}set lineHeight(k){b.RequireFiniteNumber(k); c.get(this)._SetLineHeight(k)}get lineHeight(){return c.get(this)._GetLineHeight()}set horizontalAlign(k){b.RequireString(k);k=f.get(k);if("undefined"===typeof k)throw Error("invalid mode");c.get(this)._SetHAlign(k)}get horizontalAlign(){return a[c.get(this)._GetHAlign()]}set verticalAlign(k){b.RequireString(k);k=l.get(k);if("undefined"===typeof k)throw Error("invalid mode");c.get(this)._SetVAlign(k)}get verticalAlign(){return d[c.get(this)._GetVAlign()]}set wordWrapMode(k){b.RequireString(k);k=g.get(k); if("undefined"===typeof k)throw Error("invalid mode");c.get(this)._SetWrapByWord(k)}get wordWrapMode(){return c.get(this)._IsWrapByWord()?"word":"character"}}}{"use strict";const e=self.C3;e.Plugins.Spritefont2.Cnds={CompareText(b,a){return a?this._text===b:e.equalsNoCase(this._text,b)},IsRunningTypewriterText(){return-1!==this._typewriterEndTime},OnTypewriterTextFinished(){return!0}}}"use strict"; self.C3.Plugins.Spritefont2.Acts={SetText(e){this._CancelTypewriter();"number"===typeof e&&1E9>e&&(e=Math.round(1E10*e)/1E10);this._SetText(e.toString())},AppendText(e){this._CancelTypewriter();"number"===typeof e&&1E9>e&&(e=Math.round(1E10*e)/1E10);(e=e.toString())&&this._SetText(this._text+e)},TypewriterText(e,b){this._CancelTypewriter();"number"===typeof e&&1E9>e&&(e=Math.round(1E10*e)/1E10);this._StartTypewriter(e.toString(),b)},TypewriterFinish(){this._FinishTypewriter()},SetScale(e){this._SetScale(e)}, SetCharacterSpacing(e){this._SetCharacterSpacing(e)},SetLineHeight(e){this._SetLineHeight(e)},SetCharacterWidth(e,b){let a=!1;const d=this._sdkType.GetSpriteFont();for(const c of e)if(" "===c)d.SetSpaceWidth(b),a=!0;else if(e=d.GetCharacter(c))e.SetDisplayWidth(b),a=!0;a&&d.SetCharacterWidthsChanged();this._runtime.UpdateRender()},SetEffect(e){this.GetWorldInfo().SetBlendMode(e);this._runtime.UpdateRender()},SetHAlign(e){this._SetHAlign(e)},SetVAlign(e){this._SetVAlign(e)},SetWrapping(e){this._SetWrapByWord(0=== e)}}; {"use strict";const e=self.C3;e.Plugins.Spritefont2.Exps={CharacterWidth(b){return(b=this._sdkType.GetSpriteFont().GetCharacter(b))?b.GetDisplayWidth():this._sdkType.GetSpriteFont().GetCharacterWidth()},CharacterHeight(){return this._characterHeight},CharacterScale(){return this._characterScale},CharacterSpacing(){return this._characterSpacing},LineHeight(){return this._lineHeight},Text(){return this._text},PlainText(){return this._enableBBcode?e.BBString.StripAnyTags(this._text):this._text},TextWidth(){const b= this.GetWorldInfo();this._spriteFontText.SetSize(b.GetWidth(),b.GetHeight());return this._spriteFontText.GetTextWidth()},TextHeight(){const b=this.GetWorldInfo();this._spriteFontText.SetSize(b.GetWidth(),b.GetHeight());return this._spriteFontText.GetTextHeight()}}} {"use strict";const e=self.C3;self.SpriteFontCharacter=class{constructor(b,a,d,c){let f=b.GetCharacterWidth(),l=b.GetCharacterHeight();this._spriteFont=b;this._char=a;this._pxRect=new e.Rect(d,c,d+f,c+l);this._texRect=new e.Rect;this._displayWidth=-1;this._UpdateTexRect()}Release(){this._texRect=this._pxRect=this._spriteFont=null}_UpdateTexRect(){let b=this._spriteFont.GetWidth(),a=this._spriteFont.GetHeight();this._texRect.copy(this._pxRect);this._texRect.divide(b,a);this._texRect.lerpInto(this._spriteFont.GetTexRect())}GetSpriteFont(){return this._spriteFont}GetChar(){return this._char}GetTexRect(){return this._texRect}SetDisplayWidth(b){this._displayWidth= b}GetDisplayWidth(){return 0>this._displayWidth?this._spriteFont.GetCharacterWidth():this._displayWidth}}} {"use strict";const e=self.C3,b=new e.Rect,a=new e.Quad,d=new e.Color,c=new Set(["left","center","right"]),f=new Set(["top","center","bottom"]),l=new Set(["word","character"]);self.SpriteFontText=class{constructor(g){this._spriteFont=g;this._cssHeight=this._cssWidth=0;this._text="";this._isBBcodeEnabled=!1;this._bbString=null;this._wrappedText=e.New(e.WordWrap);this._wrapMode="word";this._wrapChanged=!1;this._horizontalAlign="left";this._verticalAlign="top";this._sceneGraphScale=this._scale=1;this._lineHeight= this._spacing=0;this._color=e.New(e.Color);this._drawMaxCharCount=-1;this._drawCharCount=0;this._measureTextCallback=(k,m)=>this._MeasureText(k,m);this._spriteFont._AddSpriteFontText(this)}Release(){this._spriteFont._RemoveSpriteFontText(this);this._measureTextCallback=this._color=null;this._wrappedText.Clear();this._bbString=this._spriteFont=this._wrappedText=null}_MeasureText(g,k){var m=this._GetStyleTag(k,"scale"),u=(m?parseFloat(m.param):this._scale)*this._sceneGraphScale;m=this._GetStyleTag(k, "scalex");m=(m?parseFloat(m.param):1)*u;k=this._GetStyleTag(k,"scaley");k=(k?parseFloat(k.param):1)*u;k=this._spriteFont.GetCharacterHeight()*k+this._lineHeight;const x=this.GetSpriteFont();u=x.GetCharacterWidth()*m;const n=this.GetSpacing();if(x.HasAnyCustomWidths()){let t=0,r=0;for(var q of g){g=u;const w=x.GetCharacter(q);w?g=w.GetDisplayWidth()*m:" "===q&&(g=x.GetSpaceWidth()*m);r+=g;++t}return{width:r+t*n,height:k}}q=[...g].length;return{width:u*q+Math.max(q,0)*n,height:k}}_SetWrapChanged(){this._wrapChanged= !0;this._wrappedText.Clear()}SetSize(g,k){0>=g||0>=k||this._cssWidth===g&&this._cssHeight===k||(this._cssWidth!==g&&this._SetWrapChanged(),this._cssWidth=g,this._cssHeight=k)}SetDrawMaxCharacterCount(g){this._drawMaxCharCount=Math.floor(g)}GetDrawMaxCharacterCount(){return this._drawMaxCharCount}_GetStyleTag(g,k){for(let m=g.length-1;0<=m;--m){const u=g[m];if(u.tag===k)return u}return null}_HasStyleTag(g,k){return!!this._GetStyleTag(g,k)}_MaybeWrapText(){if(this._wrapChanged){!this._isBBcodeEnabled|| this._bbString&&this._bbString.toString()===this._text||(this._bbString=new e.BBString(this._text,{noEscape:!0}));var g=-this.GetSpacing();this._wrappedText.WordWrap(this._isBBcodeEnabled?this._bbString.toFragmentList():this._text,this._measureTextCallback,this._cssWidth,this._wrapMode,g);this._wrapChanged=!1}}Draw(g,k,m,u){this._MaybeWrapText();let x=this._drawCharCount=0;const n=this._lineHeight,q=e.cloneArray(this._wrappedText.GetLines()),t=Math.sin(u);u=Math.cos(u);var r=q.reduce((w,y)=>w+y.height, 0)-n;"center"===this._verticalAlign?x=Math.max(Math.floor(this._cssHeight/2-r/2),0):"bottom"===this._verticalAlign&&(x=Math.floor(this._cssHeight-r));for(let w=0,y=q.length;w<y;++w){r=q[w];const C=r.height;if(0<w&&x>this._cssHeight-(C-n))break;0<=x&&this._DrawLine(g,r,k,m,x,t,u);x+=C}}_DrawLine(g,k,m,u,x,n,q){const t=k.height;let r=0;"center"===this._horizontalAlign?r=Math.max(Math.floor((this._cssWidth-k.width)/2),0):"right"===this._horizontalAlign&&(r=Math.max(Math.floor(this._cssWidth-k.width), 0));for(const w of k.fragments)this._DrawFragment(g,w,m,u,r,x,n,q,t),r+=w.width}_DrawFragment(g,k,m,u,x,n,q,t,r){var w=k.text,y=k.width,C=k.styles;if(-1!==this._drawMaxCharCount){if(this._drawCharCount>=this._drawMaxCharCount)return;this._drawCharCount+w.length>this._drawMaxCharCount&&(w=w.substr(0,this._drawMaxCharCount-this._drawCharCount),y=this._MeasureText(w,C).width);this._drawCharCount+=w.length}var D=this._GetStyleTag(C,"background");if(!(e.IsStringAllWhitespace(w)&&!D||this._HasStyleTag(C, "hide"))){k=this._GetStyleTag(C,"scale");var G=(k?parseFloat(k.param):this._scale)*this._sceneGraphScale;k=this._GetStyleTag(C,"scalex");k=(k?parseFloat(k.param):1)*G;var K=this._GetStyleTag(C,"scaley");G*=K?parseFloat(K.param):1;G*=this._spriteFont.GetCharacterHeight();n+=r-this._lineHeight-G;r=this._GetStyleTag(C,"offsetx");x+=r?parseFloat(r.param):0;r=this._GetStyleTag(C,"offsety");n+=r?parseFloat(r.param):0;D&&(g.SetColorFillMode(),d.parseString(D.param),d.setA(1),g.SetColor(d),b.set(x,n,x+y, n+G),b.getRight()>this._cssWidth&&b.setRight(this._cssWidth),a.setFromRotatedRectPrecalc(b,q,t),a.offset(m,u),g.Quad(a),g.SetTextureFillMode());(y=this._GetStyleTag(C,"color"))?(d.parseString(y.param),d.setA(this._color.getA())):d.copy(this._color);(y=this._GetStyleTag(C,"opacity"))&&d.setA(d.getA()*parseFloat(y.param)/100);d.premultiply();g.SetColor(d);y=this._spriteFont.GetCharacterWidth()*k;C=Math.abs(this.GetSpacing());for(const B of w)if(w=this._spriteFont.GetCharacter(B)){D=w.GetDisplayWidth()* k;if(x+D>this._cssWidth+C+1E-5)break;b.set(x,n,x+y,n+G);a.setFromRotatedRectPrecalc(b,q,t);a.offset(m,u);g.Quad3(a,w.GetTexRect());x+=D+this._spacing}else x+=this._spriteFont.GetSpaceWidth()*k+this._spacing}}GetSpriteFont(){return this._spriteFont}SetBBCodeEnabled(g){g=!!g;this._isBBcodeEnabled!==g&&(this._isBBcodeEnabled=g,this._SetWrapChanged())}IsBBCodeEnabled(){return this._isBBcodeEnabled}SetText(g){this._text!==g&&(this._text=g,this._SetWrapChanged())}SetWordWrapMode(g){if(!l.has(g))throw Error("invalid word wrap mode"); this._wrapMode!==g&&(this._wrapMode=g,this._SetWrapChanged())}SetHorizontalAlign(g){if(!c.has(g))throw Error("invalid alignment");this._horizontalAlign=g}SetVerticalAlign(g){if(!f.has(g))throw Error("invalid alignment");this._verticalAlign=g}SetScale(g){this._scale!==g&&(this._scale=g,this._SetWrapChanged())}GetScale(){return this._scale}SetSceneGraphScale(g){this._sceneGraphScale!==g&&(this._sceneGraphScale=g,this._SetWrapChanged())}GetSceneGraphScale(){return this._sceneGraphScale}SetSpacing(g){this._spacing!== g&&(this._spacing=g,this._SetWrapChanged())}GetSpacing(){return this._spacing}SetLineHeight(g){this._lineHeight=g;this._SetWrapChanged()}GetLineHeight(){return this._lineHeight}SetOpacity(g){g=e.clamp(g,0,1);this._color.a=g}SetColor(g){this._color.equals(g)||this._color.copy(g)}GetColor(){return this._color}GetTextWidth(){this._MaybeWrapText();return this._wrappedText.GetMaxLineWidth()}GetTextHeight(){this._MaybeWrapText();var g=this._spriteFont.GetCharacterHeight()*this._scale;const k=this._lineHeight; g+=k;return this._wrappedText.GetLineCount()*g-k}}} {"use strict";const e=self.C3,b={width:256,height:256,characterWidth:16,characterHeight:16,characterSet:""};self.SpriteFont=class{constructor(a){a=Object.assign({},b,a);if(0>=a.width||0>=a.height||0>=a.characterWidth||0>=a.characterHeight)throw Error("invalid size");this._width=a.width;this._height=a.height;this._characterWidth=a.characterWidth;this._characterHeight=a.characterHeight;this._characterSet=a.characterSet;this._spacingData="";this._spacingParsed=null;this._hasAnyCustomWidths=!1;this._spaceWidth= -1;this._texRect=new e.Rect(0,0,1,1);this._characterMap=new Map;this._mapChanged=!0;this._allTexts=new Set}Release(){this._texRect=null;this._ReleaseCharacters();this._characterMap=null;this._allTexts&&this._allTexts.clear();this._allTexts=null}_ReleaseCharacters(){for(let a of this._characterMap.values())a.Release();this._characterMap.clear()}_AddSpriteFontText(a){this._allTexts.add(a)}_RemoveSpriteFontText(a){this._allTexts.delete(a)}UpdateCharacterMap(){if(this._mapChanged){this._ReleaseCharacters(); var a=[...this._characterSet],d=Math.floor(this._width/this._characterWidth),c=d*Math.floor(this._height/this._characterHeight);for(let f=0,l=a.length;f<l&&!(f>=c);++f){let g=a[f];this._characterMap.set(g,e.New(self.SpriteFontCharacter,this,g,f%d*this._characterWidth,Math.floor(f/d)*this._characterHeight))}this._hasAnyCustomWidths=!1;this._spaceWidth=-1;if(Array.isArray(this._spacingParsed))for(let f of this._spacingParsed)if(Array.isArray(f)&&2===f.length&&(a=f[0],d=f[1],"number"===typeof a&&isFinite(a)&& "string"===typeof d&&a!==this._characterWidth))for(let l of d)(d=this._characterMap.get(l))?(d.SetDisplayWidth(a),this._hasAnyCustomWidths=!0):" "===l&&(this._spaceWidth=a,this._hasAnyCustomWidths=!0);this._mapChanged=!1;for(let f of this._allTexts)f._SetWrapChanged()}}SetCharacterWidthsChanged(){this._hasAnyCustomWidths=!0;for(const a of this._allTexts)a._SetWrapChanged()}GetCharacter(a){this.UpdateCharacterMap();return this._characterMap.get(a)||null}HasAnyCustomWidths(){return this._hasAnyCustomWidths}SetWidth(a){a= Math.floor(a);if(0>=a)throw Error("invalid size");this._width!==a&&(this._width=a,this._mapChanged=!0)}GetWidth(){return this._width}SetHeight(a){a=Math.floor(a);if(0>=a)throw Error("invalid size");this._height!==a&&(this._height=a,this._mapChanged=!0)}GetHeight(){return this._height}SetTexRect(a){if(!this._texRect.equals(a)){this._texRect.copy(a);for(const d of this._characterMap.values())d._UpdateTexRect()}}GetTexRect(){return this._texRect}SetCharacterWidth(a){a=Math.floor(a);if(0>=a)throw Error("invalid size"); this._characterWidth!==a&&(this._characterWidth=a,this._mapChanged=!0)}GetCharacterWidth(){return this._characterWidth}SetCharacterHeight(a){a=Math.floor(a);if(0>=a)throw Error("invalid size");this._characterHeight!==a&&(this._characterHeight=a,this._mapChanged=!0)}GetCharacterHeight(){return this._characterHeight}SetCharacterSet(a){this._characterSet!==a&&(this._characterSet=a,this._mapChanged=!0)}GetCharacterSet(){return this._characterSet}SetSpacingData(a){if(this._spacingData!==a&&(this._spacingData= a,this._mapChanged=!0,this._spacingParsed=null,this._spacingData.length))try{this._spacingParsed=JSON.parse(this._spacingData)}catch(d){this._spacingParsed=null}}GetSpacingData(){return this._spacingData}SetSpaceWidth(a){0>a&&(a=-1);this._spaceWidth!==a&&(this._spaceWidth=a,0<=this._spaceWidth&&(this._hasAnyCustomWidths=!0))}GetSpaceWidth(){return 0>this._spaceWidth?this._characterWidth:this._spaceWidth}}}{"use strict";const e=self.C3;e.Plugins.Particles=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}} {"use strict";const e=self.C3;e.Plugins.Particles.Type=class extends e.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 e=self.C3,b=e.New(e.Rect);e.Plugins.Particles.Instance=class extends e.SDKWorldInstanceBase{constructor(a,d){super(a);this._isFirstTick=!0;this._particleEngine=a=e.New(self.ParticleEngine);a.ononeshotfinish=()=>this._OnOneShotFinish();this._spawnObjectClass=null;this._particleUpdateCallback=(f,l,g,k,m,u)=>this._OnParticleUpdate(f,l,g,k,m,u);this._particleDestroyCallback=f=>this._OnParticleDestroy(f);this._hasAnyDefaultParticle=!0;d&&(a.SetRate(d[0]),a.SetSprayCone(e.toRadians(d[1])), a.SetSprayType(d[2]?"one-shot":"continuous-spray"),this._SetParticleObjectClass(this._runtime.GetObjectClassBySID(d[3])),a.SetInitSpeed(d[4]),a.SetInitSize(d[5]),a.SetInitOpacity(d[6]/100),a.SetGrowRate(d[7]),a.SetInitXRandom(d[8]),a.SetInitYRandom(d[9]),a.SetInitSpeedRandom(d[10]),a.SetInitSizeRandom(d[11]),a.SetGrowRandom(d[12]),a.SetAcceleration(d[13]),a.SetGravity(d[14]),a.SetLifeAngleRandom(d[15]),a.SetLifeSpeedRandom(d[16]),a.SetLifeOpacityRandom(d[17]),a.SetDestroyModeIndex(d[18]),a.SetTimeout(d[19])); this._UpdateEngineParameters();this._spawnObjectClass&&(this._hasAnyDefaultParticle=!1);"one-shot"===a.GetSprayType()?a.CreateOneShotSpray():a.SetSpraying(!0);const c=this.GetWorldInfo();c.SetBboxChangeEventEnabled(!0);this._inst.Dispatcher().addEventListener("bboxchange",()=>{c.OverwriteBoundingBox(this._particleEngine.GetBoundingBox())});this.GetRuntime().GetRenderer().IsWebGPU()&&c.SetUsePointsShaderProgram();this._StartTicking()}Release(){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?d=>this._OnParticleCreate(d):null;this._spawnObjectClass||(this._hasAnyDefaultParticle=!0)}_UpdateEngineParameters(){const a=this._particleEngine,d=this.GetWorldInfo();a.SetMasterOpacity(d.GetOpacity());a.SetPixelRounding(this._runtime.IsPixelRoundingEnabled());a.SetSpawnX(d.GetX());a.SetSpawnY(d.GetY()); a.SetSpawnAngle(d.GetAngle());a.SetInitSizeScale(d.GetSceneGraphScale())}_OnOneShotFinish(){this._runtime.DestroyInstance(this._inst)}Draw(a){if(this._hasAnyDefaultParticle){var d=this._objectClass.GetImageInfo(),c=d.GetTexture();if(c){var f=this.GetWorldInfo(),l=f.GetLayer();this._runtime.GetCanvasManager().IsPastingToDrawingCanvas()?b.set(-Infinity,-Infinity,Infinity,Infinity):l.Has3DCamera()?l.CalculateViewport3D(f.GetTotalZElevation(),b):l.GetViewportForZ(f.GetTotalZElevation(),b);a.SetTexture(c); c=l.Get2DScaleFactorToZ(f.GetTotalZElevation());this._particleEngine.SetParticleScale(l.GetRenderScale()*c);this._particleEngine.Draw(a,d.GetTexRect(),b,l.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(d=>d.toJSON())}}LoadFromJson(a){var d=this._particleEngine;d.SetRate(a.r);d.SetSprayCone(a.sc);d.SetSprayType(a.st);d.SetInitSpeed(a.isp);d.SetInitSize(a.isz);d.SetInitOpacity(a.io);d.SetGrowRate(a.gr);d.SetInitXRandom(a.xr);d.SetInitYRandom(a.yr);d.SetInitSpeedRandom(a.spr); d.SetInitSizeRandom(a.szr);d.SetGrowRandom(a.grnd);d.SetAcceleration(a.acc);d.SetGravity(a.g);d.SetLifeAngleRandom(a.lar);d.SetLifeSpeedRandom(a.lsr);d.SetLifeOpacityRandom(a.lor);d.SetDestroyModeIndex(a.dm);d.SetTimeout(a.to);d.SetSpraying(a.s);d._SetCreateCounter(a.pcc);this._isFirstTick=a.ft;a=a.p;d.SetParticleCount(a.length);d=d.GetParticles();for(let c=0,f=d.length;c<f;++c)d[c].setFromJSON(a[c])}Tick(){const a=this._runtime.GetDt(this._inst);this._UpdateEngineParameters();this._isFirstTick&& "one-shot"===this._particleEngine.GetSprayType()&&this._particleEngine.ReInitAllParticles();this._particleEngine.Tick(a);this._particleEngine.IsSpraying()&&this._runtime.UpdateRender();this.GetWorldInfo().SetBboxChanged();this._isFirstTick=!1}_OnParticleCreate(a){const d=this._runtime.CreateInstance(this._spawnObjectClass,this.GetWorldInfo().GetLayer(),a.GetX(),a.GetY()),c=d.GetWorldInfo();c.SetSize(a.GetSize(),a.GetSize());c.SetAngle(a.GetAngle());c.SetOpacity(a.GetOpacity());c.SetUnpremultipliedColor(this.GetWorldInfo().GetUnpremultipliedColor()); c.SetBboxChanged();c.ZOrderMoveAdjacentToInstance(this.GetInstance(),!0);d._TriggerOnCreated();a.SetUpdateCallback(this._particleUpdateCallback);a.SetDestroyCallback(this._particleDestroyCallback);return d}_OnParticleUpdate(a,d,c,f,l,g){a.IsDestroyed()||(a=a.GetWorldInfo(),a.OffsetXY(d,c),a.SetSize(a.GetWidth()+f,a.GetHeight()+f),a.SetAngle(a.GetAngle()+l),a.SetOpacity(a.GetOpacity()+g),a.SetBboxChanged())}_OnParticleDestroy(a){a.IsDestroyed()||this._runtime.DestroyInstance(a)}GetPropertyValueByIndex(a){const d= this._particleEngine;switch(a){case 0:return d.GetRate();case 1:return e.toDegrees(d.GetSprayCone());case 2:return"one-shot"===d.GetSprayType()?1:0;case 4:return d.GetInitSpeed();case 5:return d.GetInitSize();case 6:return 100*d.GetInitOpacity();case 7:return d.GetGrowRate();case 8:return d.GetInitXRandom();case 9:return d.GetInitYRandom();case 10:return d.GetInitSpeedRandom();case 11:return d.GetInitSizeRandom();case 12:return d.GetGrowRandom();case 13:return d.GetAcceleration();case 14:return d.GetGravity(); case 15:return d.GetLifeAngleRandom();case 16:return d.GetLifeSpeedRandom();case 17:return d.GetLifeOpacityRandom();case 18:return d.GetDestroyModeIndex();case 19:return d.GetTimeout()}}SetPropertyValueByIndex(a,d){const c=this._particleEngine;switch(a){case 0:c.SetRate(d);break;case 1:c.SetSprayCone(e.toRadians(d));break;case 2:c.SetSprayType(d?"one-shot":"continuous-spray");break;case 4:c.SetInitSpeed(d);break;case 5:c.SetInitSize(d);break;case 6:c.SetInitOpacity(d/100);break;case 7:c.SetGrowRate(d); break;case 8:c.SetInitXRandom(d);break;case 9:c.SetInitYRandom(d);break;case 10:c.SetInitSpeedRandom(d);break;case 11:c.SetInitSizeRandom(d);break;case 12:c.SetGrowRandom(d);break;case 13:c.SetAcceleration(d);break;case 14:c.SetGravity(d);break;case 15:c.SetLifeAngleRandom(d);break;case 16:c.SetLifeSpeedRandom(d);break;case 17:c.SetLifeOpacityRandom(d);break;case 18:c.SetDestroyModeIndex(d);break;case 19:c.SetTimeout(d)}}GetDebuggerProperties(){const a=this._particleEngine;return[{title:"plugins.particles.name", properties:[{name:"plugins.particles.debugger.particle-count",value:a.GetParticleCount()},{name:"plugins.particles.properties.type.name",value:["plugins.particles.properties.type.items."+a.GetSprayType()]},{name:"plugins.particles.debugger.is-spraying",value:a.IsSpraying(),onedit:d=>a.SetSpraying(d)},{name:"plugins.particles.properties.rate.name",value:a.GetRate(),onedit:d=>a.SetRate(d)},{name:"plugins.particles.properties.spray-cone.name",value:e.toDegrees(a.GetSprayCone()),onedit:d=>a.SetSprayCone(e.toRadians(d))}, {name:"plugins.particles.properties.speed.name",value:a.GetInitSpeed(),onedit:d=>a.SetInitSpeed(d)},{name:"plugins.particles.properties.size.name",value:a.GetInitSize(),onedit:d=>a.SetInitSize(d)},{name:"plugins.particles.properties.opacity.name",value:a.GetInitOpacity(),onedit:d=>a.SetInitOpacity(d)},{name:"plugins.particles.properties.grow-rate.name",value:a.GetGrowRate(),onedit:d=>a.SetGrowRate(d)},{name:"plugins.particles.properties.x-randomiser.name",value:a.GetInitXRandom(),onedit:d=>a.SetInitXRandom(d)}, {name:"plugins.particles.properties.y-randomiser.name",value:a.GetInitYRandom(),onedit:d=>a.SetInitYRandom(d)},{name:"plugins.particles.properties.initial-speed-randomiser.name",value:a.GetInitSpeedRandom(),onedit:d=>a.SetInitSpeedRandom(d)},{name:"plugins.particles.properties.size-randomiser.name",value:a.GetInitSizeRandom(),onedit:d=>a.SetInitSizeRandom(d)},{name:"plugins.particles.properties.grow-rate-randomiser.name",value:a.GetGrowRandom(),onedit:d=>a.SetGrowRandom(d)},{name:"plugins.particles.properties.acceleration.name", value:a.GetAcceleration(),onedit:d=>a.SetAcceleration(d)},{name:"plugins.particles.properties.gravity.name",value:a.GetGravity(),onedit:d=>a.SetGravity(d)},{name:"plugins.particles.properties.angle-randomiser.name",value:a.GetLifeAngleRandom(),onedit:d=>a.SetLifeAngleRandom(d)},{name:"plugins.particles.properties.life-speed-randomiser.name",value:a.GetLifeSpeedRandom(),onedit:d=>a.SetLifeSpeedRandom(d)},{name:"plugins.particles.properties.opacity-randomiser.name",value:a.GetLifeOpacityRandom(),onedit:d=> a.SetLifeOpacityRandom(d)},{name:"plugins.particles.properties.timeout.name",value:a.GetTimeout(),onedit:d=>a.SetTimeout(d)}]}]}}}"use strict";self.C3.Plugins.Particles.Cnds={IsSpraying(){return this._particleEngine.IsSpraying()}}; {"use strict";const e=self.C3;e.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(e.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 e=self.C3;e.Plugins.Particles.Exps={ParticleCount(){return this._particleEngine.GetParticleCount()},Rate(){return this._particleEngine.GetRate()},SprayCone(){return e.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 e=self.C3,b=[],a=new Set(["continuous-spray","one-shot"]),d=["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 e.Rect;this._color=new e.Color}Release(){this.Cancel();e.clearArray(this._particles);this._color=this._boundingBox=this.onparticlecreate=this.ononeshotfinish=this._particles=null}Cancel(){const c=this._particles; for(let f=0,l=c.length;f<l;++f)c[f].Destroy();e.appendArray(b,c);e.clearArray(c);1E3<b.length&&e.truncateArray(b,1E3);this._isSpraying=!1}CreateOneShotSpray(){for(let c=0,f=this._rate;c<f;++c)this._CreateParticle();this._particles.length&&(this._isSpraying=!0)}_CreateParticle(){let c;b.length?(c=b.pop(),c.SetEngine(this)):c=e.New(self.Particle,this);this._particles.push(c);c.Init(this.onparticlecreate);return c}ReInitAllParticles(){const c=this._particles,f=this.onparticlecreate;for(let l=0,g=c.length;l< g;++l)c[l].Init(f)}SetParticleCount(c){var f=this._particles;if(c<f.length){c=f.length-c;for(let l=0;l<c;++l){const g=f.pop();g.Destroy();b.push(g)}1E3<b.length&&e.truncateArray(b,1E3)}else if(c>f.length)for(f=c-f.length,c=0;c<f;++c)this._CreateParticle()}GetParticles(){return this._particles}GetParticleCount(){return this._particles.length}Tick(c){this._SpawnContinuous(c);this._TickParticles(c);this._MaybeFinishOneShot()}_SpawnContinuous(c){if("continuous-spray"===this._sprayType&&this._isSpraying){this._createCounter+= c*this._rate;c=Math.floor(this._createCounter);this._createCounter-=c;for(let f=0;f<c;++f)this._CreateParticle()}}_SetCreateCounter(c){this._createCounter=c}_GetCreateCounter(){return this._createCounter}_TickParticles(c){const f=this._boundingBox;f.set(this._spawnX,this._spawnY,this._spawnX,this._spawnY);const l=this._particles;let g=0;for(let k=0,m=l.length;k<m;++k){const u=l[k];l[g]=u;u.Tick(c);u.IsActive()?(++g,f.expandToContain(u.GetBoundingBox())):(u.Destroy(),b.push(u))}e.truncateArray(l,g); 1E3<b.length&&e.truncateArray(b,1E3)}_MaybeFinishOneShot(){if("one-shot"===this._sprayType&&0===this._particles.length&&this._isSpraying){if(this.ononeshotfinish)this.ononeshotfinish();this._isSpraying=!1}}Draw(c,f,l,g){c.StartRenderingPoints(f);this._color.copy(c.GetColor());const k=this._particles;for(let m=0,u=k.length;m<u;++m){const x=k[m];l.intersectsRect(x.GetBoundingBox())&&x.Draw(c,f,g)}c.FinishRenderingPoints()}GetColor(){return this._color}SetRate(c){this._rate=+c}GetRate(){return this._rate}SetSprayCone(c){this._sprayCone= +c}GetSprayCone(){return this._sprayCone}SetSprayType(c){if(!a.has(c))throw Error("invalid spray type");this._sprayType=c}GetSprayType(){return this._sprayType}SetSpraying(c){this._isSpraying=!!c}IsSpraying(){return this._isSpraying}SetMasterOpacity(c){this._masterOpacity=+c}GetMasterOpacity(){return this._masterOpacity}SetPixelRounding(c){this._isPixelRounding=!!c}IsPixelRounding(){return this._isPixelRounding}SetSpawnX(c){this._spawnX=+c}GetSpawnX(){return this._spawnX}SetSpawnY(c){this._spawnY= +c}GetSpawnY(){return this._spawnY}SetSpawnAngle(c){this._spawnAngle=+c}GetInitAngle(){return this._spawnAngle}SetInitSpeed(c){this._initSpeed=+c}GetInitSpeed(){return this._initSpeed}SetInitSize(c){this._initSize=+c}GetInitSize(){return this._initSize}SetInitSizeScale(c){this._initSizeScale=+c}GetInitSizeScale(){return this._initSizeScale}SetInitOpacity(c){this._initOpacity=+c}GetInitOpacity(){return this._initOpacity}SetGrowRate(c){this._growRate=+c}GetGrowRate(){return this._growRate}SetInitXRandom(c){this._xRandom= +c}GetInitXRandom(){return this._xRandom}SetInitYRandom(c){this._yRandom=+c}GetInitYRandom(){return this._yRandom}SetInitSpeedRandom(c){this._initSpeedRandom=+c}GetInitSpeedRandom(){return this._initSpeedRandom}SetInitSizeRandom(c){this._initSizeRandom=+c}GetInitSizeRandom(){return this._initSizeRandom}SetGrowRandom(c){this._growRandom=+c}GetGrowRandom(){return this._growRandom}SetAcceleration(c){this._acceleration=+c}GetAcceleration(){return this._acceleration}SetGravity(c){this._gravity=+c}GetGravity(){return this._gravity}SetLifeAngleRandom(c){this._lifeAngleRandom= +c}GetLifeAngleRandom(){return this._lifeAngleRandom}SetLifeSpeedRandom(c){this._lifeSpeedRandom=+c}GetLifeSpeedRandom(){return this._lifeSpeedRandom}SetLifeOpacityRandom(c){this._lifeOpacityRandom=+c}GetLifeOpacityRandom(){return this._lifeOpacityRandom}SetDestroyMode(c){c=d.indexOf(c);if(-1===c)throw Error("invalid destroy mode");this._destroyMode=c}SetDestroyModeIndex(c){this.SetDestroyMode(d[c])}GetDestroyMode(){return d[this._destroyMode]}GetDestroyModeIndex(){return this._destroyMode}SetTimeout(c){this._timeout= +c}GetTimeout(){return this._timeout}SetParticleScale(c){this._particleScale=+c}GetParticleScale(){return this._particleScale}GetBoundingBox(){return this._boundingBox}}} {"use strict";const e=self.C3;function b(l){return Math.random()*l-l/2}const a=new e.Quad,d=new e.Color,c=self.devicePixelRatio||1;let f=!1;self.Particle=class{constructor(l){this._engine=l;this._isActive=!1;this._angle=this._speed=this._y=this._x=0;this._opacity=1;this._age=this._gs=this._halfSize=this._size=this._grow=this._lastOpacity=0;this._bbox=new e.Rect;this._destroyCallback=this._updateCallback=this._userData=null}SetEngine(l){this._engine=l}Init(l){const g=this._engine;this._isActive=!0; this._x=g.GetSpawnX()+b(g.GetInitXRandom());this._y=g.GetSpawnY()+b(g.GetInitYRandom());this._speed=g.GetInitSpeed()+b(g.GetInitSpeedRandom());this._angle=g.GetInitAngle()+b(g.GetSprayCone());this._lastOpacity=this._opacity=g.GetInitOpacity();this._size=(g.GetInitSize()+b(g.GetInitSizeRandom()))*g.GetInitSizeScale();this._halfSize=this._size/2;this._grow=g.GetGrowRate()+b(g.GetGrowRandom());this._age=this._gs=0;this._UpdateBoundingBox();l?this._userData||(this._userData=l(this)):this._destroyCallback= this._updateCallback=this._userData=null}SetUpdateCallback(l){this._updateCallback=l}SetDestroyCallback(l){this._destroyCallback=l}Destroy(){const l=this._destroyCallback;l&&l(this._userData);this._destroyCallback=this._updateCallback=this._userData=null}toJSON(){return[this._x,this._y,this._speed,this._angle,this._opacity,this._grow,this._size,this._gs,this._age]}setFromJSON(l){this._x=l[0];this._y=l[1];this._speed=l[2];this._angle=l[3];this._opacity=l[4];this._grow=l[5];this._size=l[6];this._gs= l[7];this._age=l[8];this._halfSize=this._size/2;this._UpdateBoundingBox()}Tick(l){var g=this._engine,k=this._speed*l,m=this._angle;const u=Math.cos(m)*k;k=Math.sin(m)*k+this._gs*l;this._x+=u;this._y+=k;m=this._grow*l;this._size+=m;this._halfSize=this._size/2;this._speed+=g.GetAcceleration()*l;this._gs+=g.GetGravity()*l;this._age+=l;this._UpdateBoundingBox();var x=g.GetLifeAngleRandom(),n=g.GetLifeSpeedRandom();const q=g.GetLifeOpacityRandom();let t=0;0!==x&&(t=b(x*l),this._angle+=t);0!==n&&(this._speed+= b(n*l));0!==q&&(this._opacity=e.clamp(this._opacity+b(q*l),0,1));l=1<=this._size&&(2===g.GetDestroyModeIndex()?0<this._speed:this._age<g.GetTimeout());(x=this._updateCallback)&&l&&(n=g.GetMasterOpacity()*this._opacity,0===g.GetDestroyModeIndex()&&(n*=1-this._age/g.GetTimeout()),g=n-this._lastOpacity,this._lastOpacity=n,x(this._userData,u,k,m,t,g));this._isActive=l}IsActive(){return this._isActive}GetBoundingBox(){return this._bbox}_UpdateBoundingBox(){const l=this._x,g=this._y,k=this._halfSize;this._bbox.set(l- k,g-k,l+k,g+k)}Draw(l,g,k){if(!this._userData){var m=this._engine,u=m.GetMasterOpacity()*this._opacity;0===m.GetDestroyModeIndex()&&(u*=1-this._age/m.GetTimeout());if(!(0>=u)){var x=this._size,n=x*m.GetParticleScale()*c;if(!(1>n)){var q=this._x,t=this._y;m.IsPixelRounding()&&(q=q+.5|0,t=t+.5|0);l.IsWebGPU()?l.Point(q,t,x,u):k||n>l.GetMaxPointSize()||n<l.GetMinPointSize()?(d.copy(m.GetColor()),d.multiplyAlpha(u),l.SetColor(d),f=!0,a.setFromRect(this._bbox),l.Quad3(a,g)):(f&&(l.SetColor(m.GetColor()), f=!1),l.Point(q,t,n,u))}}}}GetUserData(){return this._userData}GetX(){return this._x}GetY(){return this._y}GetSize(){return this._size}GetAngle(){return this._angle}GetOpacity(){return this._opacity}}}{"use strict";const e=self.C3;e.Plugins.Shape3D=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}} {"use strict";const e=self.C3;e.Plugins.Shape3D.Type=class extends e.SDKTypeBase{constructor(b){super(b);this._animations=b.GetAnimations()}Release(){e.clearArray(this._animations);super.Release()}OnCreate(){for(const b of this._animations)b.LoadAllAssets(this._runtime)}LoadTextures(b){const a={sampling:this._runtime.GetSampling()};return Promise.all(this._animations.map(d=>d.LoadAllTextures(b,a)))}ReleaseTextures(){for(const b of this._animations)b.ReleaseAllTextures()}}} {"use strict";const e=self.C3,b=self.C3X,a=e.New(e.Quad),d=e.New(e.Vector2);function c(u,x,n,q,t,r,w){return Math.hypot(q-u,t-x,(r-n)*w)}function f(u,x,n,q,t,r,w){return[e.lerp(u,q,w),e.lerp(x,t,w),e.lerp(n,r,w)]}function l(u,x,n,q,t,r,w,y,C,D,G){const [K,B,A]=f(u,x,n,q,t,r,D);return f(K,B,A,K+(w-u),B+(y-x),A+(C-n),G)}e.Plugins.Shape3D.Instance=class extends e.SDKWorldInstanceBase{constructor(u,x){super(u);this._shape=0;this._zHeight=15;u=!0;this._showBackFace=!1;this._showBottomFace=this._showTopFace= this._showRightFace=this._showLeftFace=this._showFrontFace=!0;this._animation=this._objectClass.GetAnimations()[0];this._faceVisibility=[!1,!0,!0,!0,!0,!0];this._faceImages=[0,1,2,3,4,5];this._zTilingFactor=8;this._faceObjects=[null,null,null,null,null,null];x&&(this._shape=x[0],this._zHeight=x[1],u=!!x[2],this._faceVisibility[0]=!!x[3],this._faceVisibility[1]=!!x[4],this._faceVisibility[2]=!!x[5],this._faceVisibility[3]=!!x[6],this._faceVisibility[4]=!!x[7],this._faceVisibility[5]=!!x[8],this._zTilingFactor= x[9],this._SetFaceObjectClass(0,this._runtime.GetObjectClassBySID(x[10])),this._SetFaceObjectClass(1,this._runtime.GetObjectClassBySID(x[11])),this._SetFaceObjectClass(2,this._runtime.GetObjectClassBySID(x[12])),this._SetFaceObjectClass(3,this._runtime.GetObjectClassBySID(x[13])),this._SetFaceObjectClass(4,this._runtime.GetObjectClassBySID(x[14])),this._SetFaceObjectClass(5,this._runtime.GetObjectClassBySID(x[15])));x=this.GetWorldInfo();x.SetDepth(this._zHeight);this._bquadRef=x.GetBoundingQuad(); x.SetVisible(u);u=this.GetBaseAnimationFrame();x.SetOriginX(u.GetOriginX());x.SetOriginY(u.GetOriginY());x.SetBboxChanged()}Release(){super.Release()}GetBaseAnimationFrame(){return this._animation.GetFrameAt(0)}GetCurrentImageInfo(){return this.GetBaseAnimationFrame().GetImageInfo()}IsOriginalSizeKnown(){return!0}Draw(u){var x=this.GetWorldInfo(),n=this._bquadRef;this._runtime.IsPixelRoundingEnabled()&&(n=x.PixelRoundQuad(n));const q=n.getTlx(),t=n.getTly(),r=n.getTrx(),w=n.getTry(),y=n.getBrx(), C=n.getBry(),D=n.getBlx(),G=n.getBly();var K=this._shape;const B=this._zHeight;var A=this._faceVisibility,F=A[0];let J=A[1],L=A[2],Q=A[3],T=A[4];A=A[5];x.IsDrawBackFaceOnly()?A=T=Q=L=J=!1:x.IsDrawNonBackFacesOnly()&&(F=!1);F&&this._DrawFace(u,0,q,t,0,r,w,0,y,C,0,D,G,0,0);0===K?(L&&this._DrawFace(u,2,q,t,B,D,G,B,D,G,0,q,t,0,0),Q&&this._DrawFace(u,3,y,C,B,r,w,B,r,w,0,y,C,0,0),T&&this._DrawFace(u,4,r,w,B,q,t,B,q,t,0,r,w,0,0),A&&this._DrawFace(u,5,D,G,B,y,C,B,y,C,0,D,G,0,0),J&&this._DrawFace(u,1,q,t, B,r,w,B,y,C,B,D,G,B,0)):1===K?(n=(q+D)/2,x=(t+G)/2,K=(r+y)/2,F=(w+C)/2,L&&this._DrawFace(u,2,n,x,B,n,x,B,D,G,0,q,t,0,4),Q&&this._DrawFace(u,3,K,F,B,K,F,B,r,w,0,y,C,0,4),T&&this._DrawFace(u,4,K,F,B,n,x,B,q,t,0,r,w,0,0),A&&this._DrawFace(u,5,n,x,B,K,F,B,y,C,0,D,G,0,0)):2===K?(L&&this._DrawFace(u,2,r,w,B,y,C,B,D,G,0,q,t,0,0),Q&&this._DrawFace(u,3,y,C,B,r,w,B,r,w,0,y,C,0,0),T&&this._DrawFace(u,4,r,w,B,r,w,B,q,t,0,r,w,0,2),A&&this._DrawFace(u,5,y,C,B,y,C,B,y,C,0,D,G,0,3)):3===K?(x=n.midX(),n=n.midY(), L&&this._DrawFace(u,2,x,n,B,x,n,B,D,G,0,q,t,0,4),Q&&this._DrawFace(u,3,x,n,B,x,n,B,r,w,0,y,C,0,4),T&&this._DrawFace(u,4,x,n,B,x,n,B,q,t,0,r,w,0,4),A&&this._DrawFace(u,5,x,n,B,x,n,B,y,C,0,D,G,0,4)):4===K?(L&&this._DrawFace(u,2,r,w,B,r,w,B,D,G,0,q,t,0,2),Q&&this._DrawFace(u,3,r,w,B,r,w,B,r,w,0,y,C,0,3),T&&this._DrawFace(u,4,r,w,B,r,w,B,q,t,0,r,w,0,2),A&&this._DrawFace(u,5,r,w,B,r,w,B,y,C,0,D,G,0,3)):5===K&&(L&&this._DrawFace(u,2,q,t,B,q,t,B,D,G,0,q,t,0,2),Q&&this._DrawFace(u,3,y,C,B,r,w,B,r,w,0,y,C, 0,0),T&&this._DrawFace(u,4,r,w,B,q,t,B,q,t,0,r,w,0,0),A&&this._DrawFace(u,5,y,C,B,y,C,B,y,C,0,D,G,0,3),J&&this._DrawFace(u,1,q,t,B,r,w,B,y,C,B,D,G,0,1))}_DrawFace(u,x,n,q,t,r,w,y,C,D,G,K,B,A,F){var J=null,L=null,Q=!1;J=this._faceObjects[x];if(null!==J){J=J.GetPairedInstance(this.GetInstance());if(!J)return;x=J.GetSdkInstance();if(e.Plugins.Sprite&&x instanceof e.Plugins.Sprite.Instance){J=x.GetTexture();if(null===J)return;L=x.GetTexQuad()}else if(e.Plugins.TiledBg&&x instanceof e.Plugins.TiledBg.Instance|| e.Plugins.NinePatch&&x instanceof e.Plugins.NinePatch.Instance){let T=0,V=0;Q=this._zTilingFactor;switch(F){case 0:case 1:T=c(n,q,t,r,w,y,Q);V=c(r,w,y,C,D,G,Q);break;case 2:T=c(K,B,A,C,D,G,Q);V=c(n,q,t,K,B,A,Q);break;case 3:T=c(K,B,A,C,D,G,Q);V=c(r,w,y,C,D,G,Q);break;case 4:T=c(K,B,A,C,D,G,Q),V=c(n,q,t,(K+C)/2,(B+D)/2,(A+G)/2,Q)}if(e.Plugins.TiledBg&&x instanceof e.Plugins.TiledBg.Instance){J=x.GetTexture();if(null===J)return;x.CalculateTextureCoordsFor3DFace(T,V,a);Q=!0}else{if(0!==F)return;x._Set3DCallback((aa, ha)=>{aa.divide(T,V);const ja=aa.getLeft(),oa=aa.getTop(),ya=aa.getRight();aa=aa.getBottom();const [Ba,La,Da]=l(n,q,t,r,w,y,K,B,A,ja,oa),[Ga,ma,Oa]=l(n,q,t,r,w,y,K,B,A,ya,oa),[Aa,Ma,bb]=l(n,q,t,r,w,y,K,B,A,ya,aa),[cb,db,Ya]=l(n,q,t,r,w,y,K,B,A,ja,aa);u.Quad3D(Ba,La,Da,Ga,ma,Oa,Aa,Ma,bb,cb,db,Ya,ha)});x._Draw(u,0,0,T,V);x._Set3DCallback(null);return}}else return}else{x=this._faceImages[x];L=this._animation.GetFrameAt(x).GetImageInfo();J=L.GetTexture();if(null===J)return;L=L.GetTexQuad()}u.SetTexture(J); 3<=F||Q?(Q||a.copy(L),3===F?(a.setTlx(a.getTrx()),a.setTly(a.getTly())):4===F&&(a.setTlx((a.getTlx()+a.getTrx())/2),a.setTly((a.getTly()+a.getTry())/2)),u.Quad3D2(n,q,t,r,w,y,C,D,G,K,B,A,a)):u.Quad3D2(n,q,t,r,w,y,C,D,G,K,B,A,L)}RendersToOwnZPlane(){return this._IsFaceVisible(0)}GetImagePointCount(){return this.GetBaseAnimationFrame().GetImagePointCount()}GetImagePoint(u){const x=this.GetBaseAnimationFrame(),n=this.GetWorldInfo();if("string"===typeof u)u=x.GetImagePointByName(u);else if("number"=== typeof u)u=x.GetImagePointByIndex(u-1);else throw new TypeError("expected string or number");if(!u)return[n.GetX(),n.GetY()];d.copy(u.GetVec2());if(n.HasMesh()){const [q,t]=n.GetSourceMesh().TransformPoint(d.getX(),d.getY());d.set(q,t)}d.offset(-x.GetOriginX(),-x.GetOriginY());d.scale(n.GetWidth(),n.GetHeight());d.rotate(n.GetAngle());d.offset(n.GetX(),n.GetY());return[d.getX(),d.getY()]}_SetShape(u){this._shape!==u&&(this._shape=u,this._runtime.UpdateRender())}_GetShape(){return this._shape}_SetZHeight(u){u= Math.max(u,0);this._zHeight!==u&&(this._zHeight=u,this.GetWorldInfo().SetDepth(u),this._runtime.UpdateRender())}_GetZHeight(){return this._zHeight}_SetFaceVisible(u,x){x=!!x;this._faceVisibility[u]!==x&&(this._faceVisibility[u]=x,this._runtime.UpdateRender())}_IsFaceVisible(u){return this._faceVisibility[u]}_SetFaceImage(u,x){const n=this._faceImages,q=this._faceObjects;if(n[u]!==x||null!==q[u])n[u]=x,q[u]=null,this._runtime.UpdateRender()}_SetFaceObjectClass(u,x){null!==x&&x.IsFamily()&&(x=x.GetFamilyMembers()[0]); const n=this._faceObjects;n[u]!==x&&(n[u]=x,this._runtime.UpdateRender())}_SetZTilingFactor(u){this._zTilingFactor!==u&&(this._zTilingFactor=u,this._runtime.UpdateRender())}_GetZTilingFactor(){return this._zTilingFactor}SaveToJson(){return{s:this._shape,zh:this._zHeight,fv:this._faceVisibility,fi:this._faceImages,fo:this._faceObjects.map(u=>u?u.GetSID():-1),zf:this._zTilingFactor}}LoadFromJson(u){this._shape=u.s;this._zHeight=u.zh;this.GetWorldInfo().SetDepth(this._zHeight);this._faceVisibility=u.fv.slice(0); this._faceImages=u.fi.slice(0);u.hasOwnProperty("fo")&&(this._faceObjects=u.fo.map(x=>this._runtime.GetObjectClassBySID(x)));u.hasOwnProperty("zf")&&(this._zTilingFactor=u.zf)}GetPropertyValueByIndex(u){}SetPropertyValueByIndex(u,x){}GetScriptInterfaceClass(){return self.I3DShapeInstance}};const g=new WeakMap,k="box prism wedge pyramid corner-out corner-in".split(" "),m="back front left right top bottom".split(" ");self.I3DShapeInstance=class extends self.IWorldInstance{constructor(){super();g.set(this, self.IInstance._GetInitInst().GetSdkInstance())}getImagePointCount(){return g.get(this).GetImagePointCount()}getImagePointX(u){if("string"!==typeof u&&"number"!==typeof u)throw new TypeError("expected string or number");return g.get(this).GetImagePoint(u)[0]}getImagePointY(u){if("string"!==typeof u&&"number"!==typeof u)throw new TypeError("expected string or number");return g.get(this).GetImagePoint(u)[1]}getImagePoint(u){if("string"!==typeof u&&"number"!==typeof u)throw new TypeError("expected string or number"); return g.get(this).GetImagePoint(u)}set zHeight(u){b.RequireFiniteNumber(u);g.get(this)._SetZHeight(u)}get zHeight(){return g.get(this)._GetZHeight()}set shape(u){b.RequireString(u);u=k.indexOf(u);if(-1===u)throw new TypeError("invalid shape");g.get(this)._SetShape(u)}get shape(){return k[g.get(this)._Getshape()]}setFaceVisible(u,x){u=m.indexOf(u);if(0>u)throw Error("invalid face");g.get(this)._SetFaceVisible(u,!!x)}isFaceVisible(u){u=m.indexOf(u);if(0>u)throw Error("invalid face");return g.get(this)._IsFaceVisible(u)}setFaceImage(u, x){u=m.indexOf(u);x=m.indexOf(x);if(0>u||0>x)throw Error("invalid face");g.get(this)._SetFaceImage(u,x)}get zTilingFactor(){return g.get(this)._GetZTilingFactor()}set zTilingFactor(u){b.RequireFiniteNumber(u);g.get(this)._SetZTilingFactor(u)}setFaceObject(u,x){u=m.indexOf(u);if(0>u)throw Error("invalid face");const n=g.get(this);x=n.GetRuntime()._UnwrapIObjectClass(x);n._SetFaceObjectClass(u,x)}}} {"use strict";const e=self.C3;e.Plugins.Shape3D.Cnds={CompareShape(b){return this._GetShape()===b},CompareZHeight(b,a){return e.compare(this._GetZHeight(),b,a)},IsFaceVisible(b){return this._IsFaceVisible(b)}}}"use strict"; self.C3.Plugins.Shape3D.Acts={SetShape(e){this._SetShape(e)},SetZHeight(e){this._SetZHeight(e)},SetFaceVisible(e,b){this._SetFaceVisible(e,b)},SetFaceImage(e,b){this._SetFaceImage(e,b)},SetZTilingFactor(e){this._SetZTilingFactor(e)},SetFaceObject(e,b){this._SetFaceObjectClass(e,b)}};"use strict";self.C3.Plugins.Shape3D.Exps={ZHeight(){return this._GetZHeight()},ZTilingFactor(){return this._GetZTilingFactor()}};{"use strict";const e=self.C3;e.Plugins.LocalStorage=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}} {"use strict";const e=self.C3;e.Plugins.LocalStorage.Type=class extends e.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}} {"use strict";const e=self.C3;e.Plugins.LocalStorage.Instance=class extends e.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(e.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((d, c)=>{d=d.toLowerCase();c=c.toLowerCase();return d<c?-1:c<d?1:0});const a=await Promise.all(b.map(d=>this._storage.getItem(d)));this._debugCache.clear();for(let d=0,c=b.length;d<c;++d)this._debugCache.set(b[d],a[d])}catch(b){console.warn("[C3 debugger] Error displaying local storage: ",b)}finally{this._isLoadingDebugCache=!1}}}} {"use strict";const e=self.C3;e.Plugins.LocalStorage.Cnds={OnItemSet(b){return this._currentKey===b},OnAnyItemSet(){return!0},OnItemGet(b){return this._currentKey===b},OnAnyItemGet(){return!0},OnItemRemoved(b){return this._currentKey===b},OnAnyItemRemoved(){return!0},OnCleared(){return!0},OnAllKeyNamesLoaded(){return!0},OnError(){return!0},OnItemExists(b){return this._currentKey===b},OnItemMissing(b){return this._currentKey===b},CompareKey(b,a){return e.compare(this._currentKey,b,a)},CompareValue(b, a){return e.compare(this._lastValue,b,a)},IsProcessingSets(){return 0<this._pendingSets},IsProcessingGets(){return 0<this._pendingGets},OnAllSetsComplete(){return!0},OnAllGetsComplete(){return!0}}} {"use strict";const e=self.C3;function b(a){return"string"===typeof a||"number"===typeof a}e.Plugins.LocalStorage.Acts={async SetItem(a,d){this._pendingSets++;try{const c=await this._storage.setItem(a,d);await this.ScheduleTriggers(async()=>{this._currentKey=a;this._lastValue=c;await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAnyItemSet);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnItemSet)})}catch(c){await this._TriggerStorageError(c)}finally{this._pendingSets--,0===this._pendingSets&& await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAllSetsComplete)}},async SetBinaryItem(a,d){if(d&&(d=d.GetFirstPicked(this._inst))&&(d=d.GetSdkInstance())){d=d.GetArrayBufferReadOnly();this._pendingSets++;try{await this._storage.setItem(a,d),await this.ScheduleTriggers(async()=>{this._currentKey=a;this._lastValue="";await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAnyItemSet);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnItemSet)})}catch(c){await this._TriggerStorageError(c)}finally{this._pendingSets--, 0===this._pendingSets&&await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAllSetsComplete)}}},async GetItem(a){this._pendingGets++;try{const d=await this._storage.getItem(a);await this.ScheduleTriggers(async()=>{this._currentKey=a;this._lastValue=b(d)?d:"";await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAnyItemGet);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnItemGet)})}catch(d){await this._TriggerStorageError(d)}finally{this._pendingGets--,0===this._pendingGets&&await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAllGetsComplete)}}, async GetBinaryItem(a,d){if(d&&(d=d.GetFirstPicked(this._inst))){var c=d.GetSdkInstance();this._pendingGets++;try{let f=await this._storage.getItem(a);f=f instanceof ArrayBuffer?f:new ArrayBuffer(0);await this.ScheduleTriggers(async()=>{this._lastValue="";this._currentKey=a;c.SetArrayBufferTransfer(f);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAnyItemGet);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnItemGet)})}catch(f){await this._TriggerStorageError(f)}finally{this._pendingGets--, 0===this._pendingGets&&await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAllGetsComplete)}}},async CheckItemExists(a){try{const d=await this._storage.getItem(a);await this.ScheduleTriggers(async()=>{this._currentKey=a;"undefined"===typeof d||null===d?(this._lastValue="",await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnItemMissing)):(this._lastValue=b(d)?d:"",await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnItemExists))})}catch(d){await this._TriggerStorageError(d)}},async RemoveItem(a){try{await this._storage.removeItem(a), await this.ScheduleTriggers(async()=>{this._currentKey=a;this._lastValue="";await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAnyItemRemoved);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnItemRemoved)})}catch(d){await this._TriggerStorageError(d)}},async ClearStorage(){try{await this._storage.clear(),await this.ScheduleTriggers(async()=>{this._lastValue=this._currentKey="";e.clearArray(this._keyNamesList);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnCleared)})}catch(a){await this._TriggerStorageError(a)}}, async GetAllKeyNames(){try{const a=await this._storage.keys();await this.ScheduleTriggers(async()=>{this._keyNamesList=a;await this.TriggerAsync(e.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(e){e=Math.floor(e);return 0>e||e>=this._keyNamesList.length?"":this._keyNamesList[e]},ErrorMessage(){return this._errorMessage}}; {"use strict";const e=self.C3;e.Plugins.Touch=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}} {"use strict";const e=self.C3,b=self.C3X;e.Plugins.Touch.Type=class extends e.SDKTypeBase{constructor(c){super(c)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.ITouchObjectType}};let a=null;function d(){return a.GetSingleGlobalInstance().GetSdkInstance()}self.ITouchObjectType=class extends self.IObjectClass{constructor(c){super(c);a=c;c.GetRuntime()._GetCommonScriptInterfaces().touch=this}requestPermission(c){b.RequireString(c);const f=d();if("orientation"===c)return f._RequestPermission(0); if("motion"===c)return f._RequestPermission(1);throw Error("invalid type");}}} {"use strict";const e=self.C3;e.Plugins.Touch.Instance=class extends e.SDKInstanceBase{constructor(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",d=>this._OnPermissionResult(d));b=this.GetRuntime().Dispatcher();this._disposables=new e.CompositeDisposable(e.Disposable.From(b,"pointerdown",d=>this._OnPointerDown(d.data)),e.Disposable.From(b,"pointermove",d=>this._OnPointerMove(d.data)),e.Disposable.From(b,"pointerup",d=>this._OnPointerUp(d.data,!1)),e.Disposable.From(b,"pointercancel",d=>this._OnPointerUp(d.data,!0)),e.Disposable.From(b,"deviceorientation",d=>this._OnDeviceOrientation(d.data)), e.Disposable.From(b,"deviceorientationabsolute",d=>this._OnDeviceOrientationAbsolute(d.data)),e.Disposable.From(b,"devicemotion",d=>this._OnDeviceMotion(d.data)),e.Disposable.From(b,"tick2",d=>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 d=b.pageX-this._runtime.GetCanvasClientX();b=b.pageY-this._runtime.GetCanvasClientY();var c= performance.now(),f=this._touches.size;this._triggerIndex=f;this._triggerId=a;var l=e.New(e.Plugins.Touch.TouchInfo);l.Init(c,d,b,a,f);this._touches.set(a,l);this.Trigger(e.Plugins.Touch.Cnds.OnNthTouchStart);this.Trigger(e.Plugins.Touch.Cnds.OnTouchStart);this._curTouchX=d;this._curTouchY=b;this.Trigger(e.Plugins.Touch.Cnds.OnTouchObject)}}_OnPointerMove(b){if("mouse"!==b.pointerType||this._isMouseDown){var a=this._touches.get(b.pointerId);if(a){var d=performance.now();if(!(2>d-a.GetTime())){var c= b.pageX-this._runtime.GetCanvasClientX(),f=b.pageY-this._runtime.GetCanvasClientY();a.Update(d,c,f,b.width,b.height,b.pressure)}}}}_OnPointerUp(b,a){if("mouse"===b.pointerType)if(this._isMouseDown)this._isMouseDown=!1;else return;const d=performance.now();b=b.pointerId;const c=this._touches.get(b);c&&(this._triggerIndex=c.GetStartIndex(),this._triggerId=c.GetId(),this.Trigger(e.Plugins.Touch.Cnds.OnNthTouchEnd),this.Trigger(e.Plugins.Touch.Cnds.OnTouchEnd),a||(a=c.ShouldTriggerTap(d),"single-tap"=== a?(this.Trigger(e.Plugins.Touch.Cnds.OnTapGesture),this._curTouchX=c.GetX(),this._curTouchY=c.GetY(),this.Trigger(e.Plugins.Touch.Cnds.OnTapGestureObject)):"double-tap"===a&&(this.Trigger(e.Plugins.Touch.Cnds.OnDoubleTapGesture),this._curTouchX=c.GetX(),this._curTouchY=c.GetY(),this.Trigger(e.Plugins.Touch.Cnds.OnDoubleTapGestureObject))),c.Release(),this._touches.delete(b))}_RequestPermission(b){this._PostToDOMMaybeSync("request-permission",{type:b});return new Promise((a,d)=>{this._permissionPromises.push({type:b, resolve:a,reject:d})})}_OnPermissionResult(b){const a=b.result,d=b.type;this._triggerPermission=d;b=this._permissionPromises.filter(c=>c.type===d);for(const c of b)c.resolve(a?"granted":"denied");this._permissionPromises=this._permissionPromises.filter(c=>c.type!==d);a?(this.Trigger(e.Plugins.Touch.Cnds.OnPermissionGranted),0===d?this._runtime.RequestDeviceOrientationEvent():this._runtime.RequestDeviceMotionEvent()):this.Trigger(e.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 d of this._touches.values())d.GetTime()<=b-50&&d._SetLastTime(b),d.ShouldTriggerHold(b)&&(this._triggerIndex=d.GetStartIndex(),this._triggerId=d.GetId(),this._getTouchIndex=a,this.Trigger(e.Plugins.Touch.Cnds.OnHoldGesture),this._curTouchX=d.GetX(),this._curTouchY=d.GetY(),this.Trigger(e.Plugins.Touch.Cnds.OnHoldGestureObject),this._getTouchIndex=0),++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<this._runtime.GetCanvasCssWidth()&&a<this._runtime.GetCanvasCssHeight()}GetDebuggerProperties(){return[{title:"plugins.touch.debugger.touches",properties:[...this._touches.values()].map(b=>({name:"$"+b.GetId(),value:b.GetX()+", "+b.GetY()}))}]}}} {"use strict";const e=self.C3,b=[];e.Plugins.Touch.Cnds={OnTouchStart(){return!0},OnTouchEnd(){return!0},IsInTouch(){return 0<this._touches.size},OnTouchObject(a){return a&&this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY)?this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(a,this._curTouchX,this._curTouchY,!1):!1},IsTouchingObject(a){if(!a)return!1;const d=a.GetCurrentSol();var c=d.GetInstances();for(const f of c){c=f.GetWorldInfo();const l=c.GetLayer();for(const g of this._touches.values()){if(!this._IsClientPosOnCanvas(g.GetX(), g.GetY()))continue;const [k,m]=l.CanvasCssToLayer(g.GetX(),g.GetY(),c.GetTotalZElevation());if(c.ContainsPoint(k,m)){b.push(f);break}}}return b.length?(d.SetArrayPicked(b),a.ApplySolToContainer(),e.clearArray(b),!0):!1},CompareTouchSpeed(a,d,c){return(a=this._GetTouchByIndex(a))?e.compare(a.GetSpeed(),d,c):!1},OrientationSupported(){return!0},MotionSupported(){return!0},CompareOrientation(a,d,c){this._runtime.RequestDeviceOrientationEvent();return e.compare(0===a?this._orientAlpha:1===a?this._orientBeta: this._orientGamma,d,c)},CompareAcceleration(a,d,c){this._runtime.RequestDeviceMotionEvent();return e.compare(0===a?this._accWithGX:1===a?this._accWithGY:2===a?this._accWithGZ:3===a?this._accX:4===a?this._accY:this._accZ,d,c)},OnNthTouchStart(a){a=Math.floor(a);return a===this._triggerIndex},OnNthTouchEnd(a){a=Math.floor(a);return a===this._triggerIndex},HasNthTouch(a){a=Math.floor(a);return this._touches.size>=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(e){this._RequestPermission(e)}}; {"use strict";const e=self.C3;e.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))?e.toDegrees(b.GetAngle()):0},AngleForID(b){return(b=this._touches.get(b))?e.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 e=self.C3;let b=-1E3,a=-1E3,d=-1E4;e.Plugins.Touch.TouchInfo=class extends e.DefendedBase{constructor(){super();this._pressure=this._height=this._width=this._lastY=this._lastX=this._y=this._x=this._startY=this._startX=this._lastTime=this._time=this._startTime=this._startIndex=this._pointerId=0;this._isTooFarForHold=this._hasTriggeredHold=!1}Release(){}Init(c,f,l,g,k){this._pointerId=g;this._startIndex=k;this._startTime=this._lastTime=this._time=c;this._startX=f;this._startY=l; this._x=f;this._y=l;this._lastX=f;this._lastY=l}Update(c,f,l,g,k,m){this._lastTime=this._time;this._time=c;this._lastX=this._x;this._lastY=this._y;this._x=f;this._y=l;this._width=g;this._height=k;this._pressure=m;!this._isTooFarForHold&&15<=e.distanceTo(this._startX,this._startY,this._x,this._y)&&(this._isTooFarForHold=!0)}GetId(){return this._pointerId}GetStartIndex(){return this._startIndex}GetTime(){return this._time}_SetLastTime(c){this._lastTime=c}GetX(){return this._x}GetY(){return this._y}GetSpeed(){const c= e.distanceTo(this._x,this._y,this._lastX,this._lastY),f=(this._time-this._lastTime)/1E3;return 0<f?c/f:0}GetAngle(){return e.angleTo(this._lastX,this._lastY,this._x,this._y)}GetWidth(){return this._width}GetHeight(){return this._height}GetPressure(){return this._pressure}ShouldTriggerHold(c){return this._hasTriggeredHold?!1:500<=c-this._startTime&&!this._isTooFarForHold&&15>e.distanceTo(this._startX,this._startY,this._x,this._y)?this._hasTriggeredHold=!0:!1}ShouldTriggerTap(c){if(this._hasTriggeredHold)return""; if(333>=c-this._startTime&&!this._isTooFarForHold&&15>e.distanceTo(this._startX,this._startY,this._x,this._y)){if(666>=c-d&&25>e.distanceTo(b,a,this._x,this._y))return a=b=-1E3,d=-1E4,"double-tap";b=this._x;a=this._y;d=c;return"single-tap"}return""}GetPositionForLayer(c,f,l){return"undefined"===typeof f?c.GetLayerByIndex(0).CanvasCssToLayer_DefaultTransform(this._x,this._y)[l?0:1]:(c=c.GetLayer(f))?c.CanvasCssToLayer(this._x,this._y)[l?0:1]:0}}}{"use strict";const e=self.C3;e.Plugins.Audio=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}} {"use strict";const e=self.C3;e.Plugins.Audio.Type=class extends e.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 e=self.C3,b=["interactive","balanced","playback"];e.Plugins.Audio.Instance=class extends e.SDKInstanceBase{constructor(a,d){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";d&&(this._timeScaleMode=d[0],this._saveLoadMode=d[1],this._playInBackground=d[2],a=b[d[3]],this._panningModel=d[4],this._distanceModel=d[5],this._listenerZ=-d[6],this._referenceDistance=d[7],this._maxDistance=d[8],this._rolloffFactor=d[9]);this._lastAIState=[];this._lastFxState=[];this._lastAnalysersData= [];this.AddDOMMessageHandlers([["state",c=>this._OnUpdateState(c)],["fxstate",c=>this._OnUpdateFxState(c)],["trigger",c=>this._OnTrigger(c)]]);d=this.GetRuntime().Dispatcher();this._disposables=new e.CompositeDisposable(e.Disposable.From(d,"instancedestroy",c=>this._OnInstanceDestroyed(c.instance)),e.Disposable.From(d,"afterload",()=>this._OnAfterLoad()),e.Disposable.From(d,"suspend",()=>this._OnSuspend()),e.Disposable.From(d,"resume",()=>this._OnResume()));this._runtime.AddLoadPromise(this.PostToDOMAsync("create-audio-context", {preloadList:this._runtime.GetAssetManager().GetAudioToPreload().map(c=>({originalUrl:c.originalUrl,url:c.url,type:c.type,fileSize:c.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(c=>{this._sampleRate=c.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 d=a.tickCount,c=this._lastAIState.filter(f=>f.hasOwnProperty("placeholder")&&(f.placeholder>d||-1===f.placeholder));this._lastAIState=a.audioInstances;this._lastAnalysersData=a.analysers;0<c.length&&e.appendArray(this._lastAIState,c)}_OnUpdateFxState(a){this._lastFxState=a.fxstate}_GetFirstAudioStateByTag(a){for(const d of this._lastAIState)if(e.equalsNoCase(d.tag,a))return d;return null}_IsTagPlaying(a){return this._lastAIState.some(d=> e.equalsNoCase(a,d.tag)&&d.isPlaying)}_MaybeMarkAsPlaying(a,d,c,f){if(this._IsTagPlaying(a))return null;a={tag:a,duration:0,volume:f,isPlaying:!0,playbackTime:0,playbackRate:1,uid:-1,bufferOriginalUrl:"",bufferUrl:"",bufferType:"",isMusic:d,isLooping:c,isMuted:!1,resumePosition:0,pan:null,placeholder:-1};this._lastAIState.push(a);return a}async _OnTrigger(a){const d=a.type;this._triggerTag=a.tag;a=a.aiid;if("ended"===d){for(const c of this._lastAIState)if(c.aiid===a){c.isPlaying=!1;break}await this.TriggerAsync(e.Plugins.Audio.Cnds.OnEnded)}else"fade-ended"=== d&&await this.TriggerAsync(e.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 d=this._listenerInst.GetWorldInfo();this._listenerX=d.GetX();this._listenerY=d.GetY();a.listenerPos=[this._listenerX,this._listenerY,this._listenerZ]}this.PostToDOM("tick",a)}rotatePtAround(a,d,c,f,l){if(0===c)return[a,d];const g=Math.sin(c); c=Math.cos(c);a-=f;d-=l;const k=a*g;a=a*c-d*g;return[a+f,d*c+k+l]}GetInstancePans(){return this._lastAIState.filter(a=>-1!==a.uid).map(a=>this._runtime.GetInstanceByUID(a.uid)).filter(a=>a).map(a=>{const d=a.GetWorldInfo(),c=d.GetLayer().GetAngle(),[f,l]=this.rotatePtAround(d.GetX(),d.GetY(),-c,this._listenerX,this._listenerY);return{uid:a.GetUID(),x:f,y:l,angle:d.GetAngle()-c}})}GetAnalyserData(a,d){for(const c of this._lastAnalysersData)if(c.index===d&&e.equalsNoCase(c.tag,a))return c;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 [d,c]of a.remoteUrls)this._remoteUrls.set(d,c);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 d of this._lastAIState)(a=this._runtime.GetAssetManager().GetProjectAudioFileUrl(d.bufferOriginalUrl))?(d.bufferUrl=a.url,d.bufferType=a.type):d.bufferUrl=null;for(const c of Object.values(this._lastFxState))for(const f of c)f.hasOwnProperty("bufferOriginalUrl")&&(d=this._runtime.GetAssetManager().GetProjectAudioFileUrl(f.bufferOriginalUrl))&&(f.bufferUrl=d.url,f.bufferType=d.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(c=>null!==c.bufferUrl),effects:this._lastFxState})}GetDebuggerProperties(){const a=[];for(const [d,c]of Object.entries(this._lastFxState))a.push({name:"$"+d,value:c.map(f=>f.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((d,c)=>({name:"$#"+c,value:`${d.bufferOriginalUrl} ("${d.tag}") ${Math.round(10*d.playbackTime)/10} / ${Math.round(10*d.duration)/10}`}))]}]}}} {"use strict";const e=self.C3;e.Plugins.Audio.Cnds={OnEnded(b){return e.equalsNoCase(this._triggerTag,b)},OnFadeEnded(b){return e.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 e=self.C3,b="lowpass highpass bandpass lowshelf highshelf peaking notch allpass".split(" ");e.Plugins.Audio.Acts={async Play(a,d,c,f){if(!this._isSilent){var l=a[1],g=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);if(g){var k=this._nextPlayTime;this._nextPlayTime=0;var m=this._MaybeMarkAsPlaying(f.toLowerCase(),l,0!==d,this.DbToLinear(c));try{await this.PostToDOMAsync("play",{originalUrl:a[0],url:g.url,type:g.type,isMusic:l,tag:f.toLowerCase(),isLooping:0!==d,vol:this.DbToLinear(c), pos:0,off:k,trueClock:!!self.C3_GetAudioContextCurrentTime})}finally{m&&(m.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtPosition(a,d,c,f,l,g,k,m,u,x){if(!this._isSilent){var n=a[1],q=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);if(q){var t=this._nextPlayTime;this._nextPlayTime=0;var r=this._MaybeMarkAsPlaying(x.toLowerCase(),n,0!==d,this.DbToLinear(c));try{await this.PostToDOMAsync("play",{originalUrl:a[0],url:q.url,type:q.type,isMusic:n,tag:x.toLowerCase(),isLooping:0!== d,vol:this.DbToLinear(c),pos:0,off:t,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:f,y:l,angle:e.toRadians(g),innerAngle:e.toRadians(k),outerAngle:e.toRadians(m),outerGain:this.DbToLinear(u)}})}finally{r&&(r.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtObject(a,d,c,f,l,g,k,m){if(!this._isSilent&&f&&(f=f.GetFirstPicked())&&f.GetWorldInfo()){var u=f.GetWorldInfo(),x=u.GetLayer().GetAngle(),[n,q]=this.rotatePtAround(u.GetX(),u.GetY(),-x,this._listenerX,this._listenerY), t=a[1],r=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);if(r){var w=this._nextPlayTime;this._nextPlayTime=0;var y=this._MaybeMarkAsPlaying(m.toLowerCase(),t,0!==d,this.DbToLinear(c));try{await this.PostToDOMAsync("play",{originalUrl:a[0],url:r.url,type:r.type,isMusic:t,tag:m.toLowerCase(),isLooping:0!==d,vol:this.DbToLinear(c),pos:0,off:w,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:n,y:q,angle:u.GetAngle()-x,innerAngle:e.toRadians(l),outerAngle:e.toRadians(g),outerGain:this.DbToLinear(k), uid:f.GetUID()}})}finally{y&&(y.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayByName(a,d,c,f,l){if(!this._isSilent){a=1===a;var g=this._runtime.GetAssetManager().GetProjectAudioFileUrl(d)||this._remoteUrls.get(d.toLowerCase());if(g){var k=this._nextPlayTime;this._nextPlayTime=0;var m=this._MaybeMarkAsPlaying(l.toLowerCase(),a,0!==c,this.DbToLinear(f));try{await this.PostToDOMAsync("play",{originalUrl:d,url:g.url,type:g.type,isMusic:a,tag:l.toLowerCase(),isLooping:0!==c,vol:this.DbToLinear(f), pos:0,off:k,trueClock:!!self.C3_GetAudioContextCurrentTime})}finally{m&&(m.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtPositionByName(a,d,c,f,l,g,k,m,u,x,n){if(!this._isSilent){a=1===a;var q=this._runtime.GetAssetManager().GetProjectAudioFileUrl(d)||this._remoteUrls.get(d.toLowerCase());if(q){var t=this._nextPlayTime;this._nextPlayTime=0;var r=this._MaybeMarkAsPlaying(n.toLowerCase(),a,0!==c,this.DbToLinear(f));try{await this.PostToDOMAsync("play",{originalUrl:d,url:q.url,type:q.type, isMusic:a,tag:n.toLowerCase(),isLooping:0!==c,vol:this.DbToLinear(f),pos:0,off:t,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:l,y:g,angle:e.toRadians(k),innerAngle:e.toRadians(m),outerAngle:e.toRadians(u),outerGain:this.DbToLinear(x)}})}finally{r&&(r.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtObjectByName(a,d,c,f,l,g,k,m,u){if(!this._isSilent&&!this._isSilent&&l&&(l=l.GetFirstPicked())&&l.GetWorldInfo()){var x=l.GetWorldInfo(),n=x.GetLayer().GetAngle(),[q,t]=this.rotatePtAround(x.GetX(), x.GetY(),-n,this._listenerX,this._listenerY);a=1===a;var r=this._runtime.GetAssetManager().GetProjectAudioFileUrl(d)||this._remoteUrls.get(d.toLowerCase());if(r){var w=this._nextPlayTime;this._nextPlayTime=0;var y=this._MaybeMarkAsPlaying(u.toLowerCase(),a,0!==c,this.DbToLinear(f));try{await this.PostToDOMAsync("play",{originalUrl:d,url:r.url,type:r.type,isMusic:a,tag:u.toLowerCase(),isLooping:0!==c,vol:this.DbToLinear(f),pos:0,off:w,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:q,y:t, angle:x.GetAngle()-n,innerAngle:e.toRadians(g),outerAngle:e.toRadians(k),outerGain:this.DbToLinear(m),uid:l.GetUID()}})}finally{y&&(y.placeholder=this._runtime.GetTickCountNoSave())}}}},SetLooping(a,d){this.PostToDOM("set-looping",{tag:a.toLowerCase(),isLooping:0===d})},SetMuted(a,d){this.PostToDOM("set-muted",{tag:a.toLowerCase(),isMuted:0===d})},SetVolume(a,d){this.PostToDOM("set-volume",{tag:a.toLowerCase(),vol:this.DbToLinear(d)})},FadeVolume(a,d,c,f){this.PostToDOM("fade-volume",{tag:a.toLowerCase(), vol:this.DbToLinear(d),duration:c,stopOnEnd:0===f})},async Preload(a){const d=a[1],c=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);c&&(this._preloadTotal++,await this.PostToDOMAsync("preload",{originalUrl:a[0],url:c.url,type:c.type,isMusic:d}),this._preloadCount++)},async PreloadByName(a,d){a=1===a;const c=this._runtime.GetAssetManager().GetProjectAudioFileUrl(d)||this._remoteUrls.get(d.toLowerCase());c&&(this._preloadTotal++,await this.PostToDOMAsync("preload",{originalUrl:d,url:c.url, type:c.type,isMusic:a}),this._preloadCount++)},SetPlaybackRate(a,d){this.PostToDOM("set-playback-rate",{tag:a.toLowerCase(),rate:Math.max(d,0)})},Stop(a){this.PostToDOM("stop",{tag:a.toLowerCase()})},StopAll(){this.PostToDOM("stop-all")},SetPaused(a,d){this.PostToDOM("set-paused",{tag:a.toLowerCase(),paused:0===d})},Seek(a,d){this.PostToDOM("seek",{tag:a.toLowerCase(),pos:d})},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,d,c,f,l,g,k){a=a.toLowerCase();d=b[d];this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"filter",tag:a,params:[d,c,f,l,g,e.clamp(k/100,0,1)]})},AddDelayEffect(a,d,c,f){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"delay",tag:a,params:[d,this.DbToLinear(c),e.clamp(f/100,0,1)]})},AddFlangerEffect(a,d, c,f,l,g){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"flanger",tag:a,params:[d/1E3,c/1E3,f,l/100,e.clamp(g/100,0,1)]})},AddPhaserEffect(a,d,c,f,l,g,k){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"phaser",tag:a,params:[d,c,f,l,g,e.clamp(k/100,0,1)]})},AddConvolutionEffect(a,d,c,f){a=a.toLowerCase();const l=this._runtime.GetAssetManager().GetProjectAudioFileUrl(d[0]);l&&(this._IncrementEffectCount(a),this.PostToDOM("add-effect", {type:"convolution",tag:a,bufferOriginalUrl:d[0],bufferUrl:l.url,bufferType:l.type,params:[0===c,e.clamp(f/100,0,1)]}))},AddGainEffect(a,d){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"gain",tag:a,params:[this.DbToLinear(d)]})},AddMuteEffect(a){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"gain",tag:a,params:[0]})},AddTremoloEffect(a,d,c){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"tremolo", tag:a,params:[d,e.clamp(c/100,0,1)]})},AddRingModEffect(a,d,c){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"ringmod",tag:a,params:[d,e.clamp(c/100,0,1)]})},AddDistortionEffect(a,d,c,f,l,g){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"distortion",tag:a,params:[this.DbToLinearNoCap(d),this.DbToLinearNoCap(c),f,this.DbToLinearNoCap(l),e.clamp(g/100,0,1)]})},AddCompressorEffect(a,d,c,f,l,g){a=a.toLowerCase();this._IncrementEffectCount(a); this.PostToDOM("add-effect",{type:"compressor",tag:a,params:[d,c,f,l/1E3,g/1E3]})},AddAnalyserEffect(a,d,c){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"analyser",tag:a,params:[d,c]})},RemoveEffects(a){a=a.toLowerCase();this._effectCount.set(a,0);this.PostToDOM("remove-effects",{tag:a});this._lastFxState={}},SetEffectParameter(a,d,c,f,l,g){this.PostToDOM("set-effect-param",{tag:a.toLowerCase(),index:Math.floor(d),param:c,value:f,ramp:l,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 d=a[1];(a=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]))&&this.PostToDOM("unload",{url:a.url,type:a.type,isMusic:d})},UnloadAudioByName(a,d){a=1===a;(d=this._runtime.GetAssetManager().GetProjectAudioFileUrl(d)||this._remoteUrls.get(d.toLowerCase()))&&this.PostToDOM("unload",{url:d.url,type:d.type,isMusic:a})}, UnloadAll(){this.PostToDOM("unload-all")},AddRemoteURL(a,d,c){this._remoteUrls.set(c.toLowerCase(),{url:a,type:d})}}}"use strict"; self.C3.Plugins.Audio.Exps={Duration(e){return(e=this._GetFirstAudioStateByTag(e))?e.duration:0},PlaybackTime(e){return(e=this._GetFirstAudioStateByTag(e))?e.playbackTime:0},PlaybackRate(e){return(e=this._GetFirstAudioStateByTag(e))?e.playbackRate:0},Volume(e){return(e=this._GetFirstAudioStateByTag(e))?this.LinearToDb(e.volume):0},MasterVolume(){return this.LinearToDb(this._masterVolume)},EffectCount(e){return this._effectCount.get(e.toLowerCase())||0},AnalyserFreqBinCount(e,b){return(e=this.GetAnalyserData(e, Math.floor(b)))?e.binCount:0},AnalyserFreqBinAt(e,b,a){e=this.GetAnalyserData(e,Math.floor(b));if(!e)return 0;a=Math.floor(a);return 0>a||a>=e.binCount?0:e.freqBins[a]},AnalyserPeakLevel(e,b){return(e=this.GetAnalyserData(e,Math.floor(b)))?e.peak:0},AnalyserRMSLevel(e,b){return(e=this.GetAnalyserData(e,Math.floor(b)))?e.rms:0},SampleRate(){return this._sampleRate},CurrentTime(){return self.C3_GetAudioContextCurrentTime?self.C3_GetAudioContextCurrentTime():performance.now()/1E3}}; {"use strict";const e=self.C3;e.Plugins.Timeline=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Plugins.Timeline.Type=class extends e.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}{"use strict";const e=self.C3;e.Plugins.Timeline.Instance=class extends e.SDKInstanceBase{constructor(b,a){super(b);this.GetRuntime().GetTimelineManager().SetPluginInstance(b)}Release(){super.Release()}}} {"use strict";const e=self.C3;let b=null,a=null;e.Plugins.Timeline.Cnds={SetTriggerTimeline(d){b=d},GetTriggerTimeline(){return b},SetTriggerKeyframe(d){a=d},GetTriggerKeyframe(){return a},OnTimelineStarted(d){return b===d},OnTimelineStartedByName(d){const c=this._runtime.GetTimelineManager();for(const f of c.GetTimelinesByName(d))if(e.equalsNoCase(b.GetName(),f.GetName()))return!0;return!1},OnTimelineStartedByTags(d){const c=this._runtime.GetTimelineManager();for(const f of c.GetTimelinesByTags(d))if(f.HasTags(b.GetTags()))return!0; return!1},OnAnyTimelineStarted(){return!0},OnTimelineFinished(d){return b===d},OnTimelineFinishedByName(d){const c=this._runtime.GetTimelineManager();for(const f of c.GetTimelinesByName(d))if(e.equalsNoCase(b.GetName(),f.GetName()))return!0;return!1},OnTimelineFinishedByTags(d){const c=this._runtime.GetTimelineManager();for(const f of c.GetTimelinesByTags(d))if(f.HasTags(b.GetTags()))return!0;return!1},OnAnyTimelineFinished(){return!0},IsPlaying(d){return d.IsPlaying()},IsPlayingByName(d){const c= this._runtime.GetTimelineManager();for(const f of c.GetTimelinesByName(d))if(f.IsPlaying())return!0;return!1},IsPlayingByTags(d){const c=this._runtime.GetTimelineManager();for(const f of c.GetTimelinesByTags(d))if(f.IsPlaying())return!0;return!1},IsAnyPlaying(){return[...this._runtime.GetTimelineManager().GetTimelines()].some(d=>d.IsPlaying())},IsPaused(d){return d.IsPaused()},IsPausedByName(d){const c=this._runtime.GetTimelineManager();for(const f of c.GetTimelinesByName(d))if(f.IsPaused())return!0; return!1},IsPausedByTags(d){const c=this._runtime.GetTimelineManager();for(const f of c.GetTimelinesByTags(d))if(f.IsPaused())return!0;return!1},IsAnyPaused(){return[...this._runtime.GetTimelineManager().GetTimelines()].some(d=>d.IsPaused())},OnTimeSet(d){return b===d},OnTimeSetByName(d){const c=this._runtime.GetTimelineManager();for(const f of c.GetTimelinesByName(d))if(b===f)return!0;return!1},OnTimeSetByTags(d){const c=this._runtime.GetTimelineManager();for(const f of c.GetTimelinesByTags(d))if(b=== f)return!0;return!1},OnAnyKeyframeReached(){return!!a},OnKeyframeReached(d,c){if(!a||0===a.GetTags().length||!d)return!1;d=d?d.split(" "):[];if(0===c){for(const f of d)if(a.HasTag(f))return!0;return!1}for(const f of d)if(!a.HasTag(f))return!1;return!0}}} {"use strict";const e=self.C3,b=new Map,a=(c,f)=>{for(const l of c)f.SetTrackInstance(l.trackId,l.instance)},d=()=>{const c=[];for(const [f,l]of b.entries()){const g=f.GetCurrentSol().GetInstances(),k=l.trackIds.length;for(let m=0;m<k;m++)g[l.startIndex+m]&&c.push({trackId:l.trackIds[m],instance:g[l.startIndex+m]});l.startIndex+=k}return c};e.Plugins.Timeline.Acts={async PlayTimeline(c,f,l){if(c){var g=this._runtime.GetTimelineManager(),k=[];if(b.size){let u=d();do if(u.length){var m=g.GetTimelineOfTemplateForInstances(c, u);m||(m=g.CreateFromTemplate(c),m.ClearTrackInstances(),a(u,m));m.SetTags(f);m.Play()&&k.push(m.GetPlayPromise());u=d()}while(u.length)}else c.SetTags(f),c.Play()&&k.push(c.GetPlayPromise());l||b.clear();await Promise.all(k)}else l||b.clear()},async PlayTimelineByName(c,f){const l=this._runtime.GetTimelineManager(),g=[];for(const k of l.GetTimelinesByName(c))g.push(e.Plugins.Timeline.Acts.PlayTimeline.call(this,k,f,!0));b.clear();await Promise.all(g)},async PlayAllTimelines(){const c=this._runtime.GetTimelineManager(), f=[];for(const l of c.GetTimelines())l.Play()&&f.push(l.GetPlayPromise());b.clear();await Promise.all(f)},PauseTimeline(c){c&&c.Stop()},PauseTimelineByName(c){const f=this._runtime.GetTimelineManager();for(const l of f.GetTimelinesByName(c))e.Plugins.Timeline.Acts.PauseTimeline.call(this,l)},PauseTimelineByTags(c){const f=this._runtime.GetTimelineManager();for(const l of f.GetTimelinesByTags(c))e.Plugins.Timeline.Acts.PauseTimeline.call(this,l)},PauseAllTimelines(){const c=this._runtime.GetTimelineManager(); for(const f of c.GetTimelines())f.Stop()},ResumeTimeline(c){c&&c.Resume()},ResumeTimelineByName(c){const f=this._runtime.GetTimelineManager();for(const l of f.GetTimelinesByName(c))e.Plugins.Timeline.Acts.ResumeTimeline.call(this,l)},ResumeTimelineByTags(c){const f=this._runtime.GetTimelineManager();for(const l of f.GetTimelinesByTags(c))e.Plugins.Timeline.Acts.ResumeTimeline.call(this,l)},ResumeAllTimelines(){const c=this._runtime.GetTimelineManager();for(const f of c.GetTimelines())f.Resume()}, StopTimeline(c){c&&c.Reset()},StopTimelineByName(c){const f=this._runtime.GetTimelineManager();for(const l of f.GetTimelinesByName(c))e.Plugins.Timeline.Acts.StopTimeline.call(this,l)},StopTimelineByTags(c){const f=this._runtime.GetTimelineManager();for(const l of f.GetTimelinesByTags(c))e.Plugins.Timeline.Acts.StopTimeline.call(this,l)},StopAllTimelines(){const c=this._runtime.GetTimelineManager();for(const f of c.GetTimelines())f.Reset()},SetTimelineTime(c,f){if(c)if(e.IsFiniteNumber(f))c.SetTime(f); else if(e.IsString(f)){const l=c.GetKeyframeWithTags(f);l?c.SetTime(l.GetTime()):e.Plugins.Timeline.Acts.SetTimelineTime.call(this,c,Number(f))}},SetTimelineTimeByName(c,f){const l=this._runtime.GetTimelineManager();for(const g of l.GetTimelinesByName(c))e.Plugins.Timeline.Acts.SetTimelineTime.call(this,g,f)},SetTimelineTimeByTags(c,f){const l=this._runtime.GetTimelineManager();for(const g of l.GetTimelinesByTags(c))e.Plugins.Timeline.Acts.SetTimelineTime.call(this,g,f)},SetTimelinePlaybackRate(c, f){c&&c.SetPlaybackRate(f)},SetTimelinePlaybackRateByName(c,f){const l=this._runtime.GetTimelineManager();for(const g of l.GetTimelinesByName(c))e.Plugins.Timeline.Acts.SetTimelinePlaybackRate.call(this,g,f)},SetTimelinePlaybackRateByTags(c,f){const l=this._runtime.GetTimelineManager();for(const g of l.GetTimelinesByTags(c))e.Plugins.Timeline.Acts.SetTimelinePlaybackRate.call(this,g,f)},SetInstance(c,f){b.has(c)||b.set(c,{startIndex:0,trackIds:[]});b.get(c).trackIds.push(f)}}} {"use strict";const e=self.C3;e.Plugins.Timeline.Exps={Time(b){const a=this._runtime.GetTimelineManager();for(const d of a.GetTimelinesByName(b))return d.GetTime();for(const d of a.GetTimelinesByTags(b))return d.GetTime();return 0},TotalTime(b){const a=this._runtime.GetTimelineManager();for(const d of a.GetTimelinesByName(b))return d.GetTotalTime();for(const d of a.GetTimelinesByTags(b))return d.GetTotalTime();return 0},Progress(b){const a=this._runtime.GetTimelineManager();for(const d of a.GetTimelinesByName(b))return d.GetTime()/ d.GetTotalTime();for(const d of a.GetTimelinesByTags(b))return d.GetTime()/d.GetTotalTime();return 0},KeyframeTags(){const b=e.Plugins.Timeline.Cnds.GetTriggerKeyframe();return b?b.GetTags().join(" "):""},TimelineName(){const b=e.Plugins.Timeline.Cnds.GetTriggerTimeline();return b?b.GetName():""},TimelineTags(){const b=e.Plugins.Timeline.Cnds.GetTriggerTimeline();return b?b.GetStringTags():""},Value(b,a){const d=this._runtime.GetTimelineManager();for(const f of d.GetTimelinesByName(b)){var c=f.GetTrackByName(a); if(c){if(c=c.GetPropertyTrack("value"))return c.GetSourceAdapterValue()}else if(c=f.GetTrackById(a))if(c=c.GetPropertyTrack("value"))return c.GetSourceAdapterValue()}for(const f of d.GetTimelinesByTags(b))if(b=f.GetTrackByName(a)){if(b=b.GetPropertyTrack("value"))return b.GetSourceAdapterValue()}else if(b=f.GetTrackById(a))if(b=b.GetPropertyTrack("value"))return b.GetSourceAdapterValue();return 0}}}{"use strict";const e=self.C3;e.Plugins.Browser=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}} {"use strict";const e=self.C3;e.Plugins.Browser.Type=class extends e.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}} {"use strict";const e=self.C3;e.Plugins.Browser.Instance=class extends e.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",d=>this._OnOnlineStateChanged(d)],["backbutton",()=>this._OnBackButton()],["sw-message",d=>this._OnSWMessage(d)],["hashchange", d=>this._OnHashChange(d)]]);b=this.GetRuntime().Dispatcher();this._disposables=new e.CompositeDisposable(e.Disposable.From(b,"afterfirstlayoutstart",()=>this._OnAfterFirstLayoutStart()),e.Disposable.From(b,"window-resize",()=>this._OnWindowResize()),e.Disposable.From(b,"suspend",()=>this._OnSuspend()),e.Disposable.From(b,"resume",()=>this._OnResume()));this._runtime.AddLoadPromise(this.PostToDOMAsync("get-initial-state",{exportType:this._runtime.GetExportType()}).then(d=>{this._initLocationStr=d.location; this._isOnline=d.isOnline;this._referrer=d.referrer;this._docTitle=d.title;this._isCookieEnabled=d.isCookieEnabled;this._screenWidth=d.screenWidth;this._screenHeight=d.screenHeight;this._windowOuterWidth=d.windowOuterWidth;this._windowOuterHeight=d.windowOuterHeight;this._isScirraArcade=d.isScirraArcade}))}Release(){super.Release()}_OnAfterFirstLayoutStart(){this.PostToDOM("ready-for-sw-messages")}async _OnOnlineStateChanged(b){b=!!b.isOnline;this._isOnline!==b&&((this._isOnline=b)?await this.TriggerAsync(e.Plugins.Browser.Cnds.OnOnline): await this.TriggerAsync(e.Plugins.Browser.Cnds.OnOffline))}async _OnWindowResize(){await this.TriggerAsync(e.Plugins.Browser.Cnds.OnResize)}_OnSuspend(){this.Trigger(e.Plugins.Browser.Cnds.OnPageHidden)}_OnResume(){this.Trigger(e.Plugins.Browser.Cnds.OnPageVisible)}async _OnBackButton(){await this.TriggerAsync(e.Plugins.Browser.Cnds.OnBackButton)}_OnSWMessage(b){b=b.type;"downloading-update"===b?this.Trigger(e.Plugins.Browser.Cnds.OnUpdateFound):"update-ready"===b||"update-pending"===b?this.Trigger(e.Plugins.Browser.Cnds.OnUpdateReady): "offline-ready"===b&&this.Trigger(e.Plugins.Browser.Cnds.OnOfflineReady)}_OnHashChange(b){this._initLocationStr=b.location;this.Trigger(e.Plugins.Browser.Cnds.OnHashChange)}GetDebuggerProperties(){return[{title:"plugins.browser.name",properties:[{name:"plugins.browser.debugger.user-agent",value:navigator.userAgent},{name:"plugins.browser.debugger.is-online",value:this._isOnline},{name:"plugins.browser.debugger.is-fullscreen",value:this._runtime.GetCanvasManager().IsDocumentFullscreen()}]}]}}}"use strict"; self.C3.Plugins.Browser.Cnds={IsOnline(){return this._isOnline},OnOnline(){return!0},OnOffline(){return!0},OnResize(){return!0},CookiesEnabled(){return this._isCookieEnabled},IsFullscreen(){return this._runtime.GetCanvasManager().IsDocumentFullscreen()},OnBackButton(){return!0},IsPortraitLandscape(e){const b=this._runtime.GetCanvasManager().GetLastWidth(),a=this._runtime.GetCanvasManager().GetLastHeight();return(b<=a?0:1)===e},OnUpdateFound(){return!0},OnUpdateReady(){return!0},OnOfflineReady(){return!0}, OnHashChange(){return!0},PageVisible(){return!this._runtime.IsSuspended()},OnPageHidden(){return!0},OnPageVisible(){return!0},HasJava(){return!1},IsDownloadingUpdate(){return!1},OnMenuButton(){return!1},OnSearchButton(){return!1},IsMetered(){return!1},IsCharging(){return!0},SupportsFullscreen(){return!0}}; {"use strict";const e=self.C3,b="portrait landscape portrait-primary portrait-secondary landscape-primary landscape-secondary".split(" ");e.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,d){this._PostToDOMMaybeSync("navigate",{type:"url",url:a,target:d,exportType:this._runtime.GetExportType()})},GoToURLWindow(a,d){this._PostToDOMMaybeSync("navigate",{type:"new-window",url:a,tag:d,exportType:this._runtime.GetExportType()})},RequestFullScreen(a, d){2<=a&&(a+=1);6===a&&(a=2);1===a&&(a=0);a=e.CanvasManager._FullscreenModeNumberToString(a);this._runtime.GetCanvasManager().SetDocumentFullscreenMode(a);this._PostToDOMMaybeSync("request-fullscreen",{navUI:d})},CancelFullScreen(){this._PostToDOMMaybeSync("exit-fullscreen")},Vibrate(a){a=a.split(",");for(let d=0,c=a.length;d<c;++d)a[d]=parseInt(a[d],10);this._PostToDOMMaybeSync("vibrate",{pattern:a})},async InvokeDownload(a,d){a&&d&&(a=await this._runtime.GetAssetManager().GetProjectFileUrl(a),this._runtime.InvokeDownload(a, d))},InvokeDownloadString(a,d,c){c&&(a=`data:${d},${encodeURIComponent(a)}`,this._runtime.InvokeDownload(a,c))},ConsoleLog(a,d){d=d.toString();0===a?console.log(d):1===a?console.warn(d):2===a&&console.error(d)},ConsoleGroup(a){console.group(a)},ConsoleGroupEnd(){console.groupEnd()},ExecJs(a){try{eval(a)}catch(d){console.error("Error executing JavaScript: ",d)}},LockOrientation(a){a=Math.floor(a);0>a||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(e){const b=this._runtime.IsInWorker()?(new URL(this._initLocationStr)).search:location.search;return(e=RegExp("[?&]"+e+"=([^&]*)").exec(b))?decodeURIComponent(e[1].replace(/\+/g," ")):""},Referrer(){return this._referrer},Title(){return this._docTitle},Language(){return navigator.language}, Platform(){return navigator.platform},UserAgent(){return navigator.userAgent},ExecJS(e){let b=0;try{b=eval(e)}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 e=navigator.connection;return e?e.downlink|| e.downlinkMax||e.bandwidth||Infinity:Infinity},ConnectionType(){const e=navigator.connection;return e?e.type||"unknown":"unknown"},DevicePixelRatio(){return self.devicePixelRatio},ScreenWidth(){return this._screenWidth},ScreenHeight(){return this._screenHeight},WindowInnerWidth(){return this._runtime.GetCanvasManager().GetLastWidth()},WindowInnerHeight(){return this._runtime.GetCanvasManager().GetLastHeight()},WindowOuterWidth(){return this._windowOuterWidth},WindowOuterHeight(){return this._windowOuterWidth}}; {"use strict";const e=self.C3;e.Behaviors.Fade=class extends e.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Behaviors.Fade.Type=class extends e.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}} {"use strict";const e=self.C3;e.Behaviors.Fade.Instance=class extends e.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=e.New(e.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(e.Behaviors.Fade.Cnds.OnFadeInEnd)));1===this._stage&&this._stageTime.Get()>=this._waitTime&&(this._stage=2,this._stageTime.Reset(),this.Trigger(e.Behaviors.Fade.Cnds.OnWaitEnd)); 2===this._stage&&0!==this._fadeOutTime&&(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(e.Behaviors.Fade.Cnds.OnFadeOutEnd),this._destroy&&this._runtime.DestroyInstance(this._inst)))}Start(){this._stage=0;this._stageTime.Reset();0===this._fadeInTime?(this._stage=1,0===this._waitTime&&(this._stage=2)):(this._inst.GetWorldInfo().SetOpacity(0),this._runtime.UpdateRender())}GetPropertyValueByIndex(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(e){0>e&&(e=0);this._fadeInTime=e},SetWaitTime(e){0>e&&(e=0);this._waitTime=e},SetFadeOutTime(e){0>e&&(e=0);this._fadeOutTime=e}};"use strict";self.C3.Behaviors.Fade.Exps={FadeInTime(){return this._fadeInTime},WaitTime(){return this._waitTime},FadeOutTime(){return this._fadeOutTime}}; {"use strict";const e=self.C3;e.Behaviors.Pin=class extends e.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Behaviors.Pin.Type=class extends e.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}} {"use strict";const e=self.C3;e.Behaviors.Pin.Instance=class extends e.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 e.CompositeDisposable(e.Disposable.From(b,"instancedestroy",d=>this._OnInstanceDestroyed(d.instance)), e.Disposable.From(b,"afterload",d=>this._OnAfterLoad()))}Release(){this._pinInst=null;super.Release()}_SetPinInst(b){b?(this._pinInst=b,this._StartTicking2()):(this._pinInst=null,this._StopTicking2())}_Pin(b,a,d){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 c=this._propSet;c.clear();for(const f of d)c.add(f);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();c.has("x")&&c.has("y")&&(this._pinAngle=e.angleTo(b.GetX(),b.GetY(),a.GetX(),a.GetY())-b.GetAngle(),this._pinDist=e.distanceTo(b.GetX(),b.GetY(),a.GetX(),a.GetY()));c.has("width-abs")?this._dWidth=a.GetWidth()-b.GetWidth():c.has("width-scale")&&(this._dWidth=a.GetWidth()/b.GetWidth());c.has("height-abs")?this._dHeight=a.GetHeight()-b.GetHeight():c.has("height-scale")&&(this._dHeight=a.GetHeight()/b.GetHeight())}else this._pinDist= e.distanceTo(b.GetX(),b.GetY(),a.GetX(),a.GetY())}SaveToJson(){const b=this._propSet,a=this._mode,d={uid:this._pinInst?this._pinInst.GetUID():-1,m:a};if("rope"===a||"bar"===a)d.pd=this._pinDist;else if("properties"===a){d.ps=[...this._propSet];b.has("imagepoint")?d.ip=this._pinImagePoint:b.has("x")&&b.has("y")?(d.pa=this._pinAngle,d.pd=this._pinDist):(b.has("x")&&(d.dx=this._dx),b.has("y")&&(d.dy=this._dy));b.has("angle")&&(d.da=this._dAngle,d.lka=this._lastKnownAngle);if(b.has("width-abs")||b.has("width-scale"))d.dw= this._dWidth;if(b.has("height-abs")||b.has("height-scale"))d.dh=this._dHeight;b.has("z")&&(d.dz=this._dz)}return d}LoadFromJson(b){const a=b.m,d=this._propSet;d.clear();this._pinUid=b.uid;if("number"===typeof a)this._LoadFromJson_Legacy(b);else if(this._mode=a,"rope"===a||"bar"===a)this._pinDist=b.pd;else if("properties"===a){for(const c of b.ps)d.add(c);d.has("imagepoint")?this._pinImagePoint=b.ip:d.has("x")&&d.has("y")?(this._pinAngle=b.pa,this._pinDist=b.pd):(d.has("x")&&(this._dx=b.dx),d.has("y")&& (this._dy=b.dy));d.has("angle")&&(this._dAngle=b.da,this._lastKnownAngle=b.lka||0);if(d.has("width-abs")||d.has("width-scale"))this._dWidth=b.dw;if(d.has("height-abs")||d.has("height-scale"))this._dHeight=b.dh;d.has("z")&&(this._dz=b.dz)}}_LoadFromJson_Legacy(b){const a=this._propSet,d=b.msa,c=b.tsa,f=b.pa,l=b.pd;switch(b.m){case 0:this._mode="properties";a.add("x").add("y").add("angle");this._pinAngle=f;this._pinDist=l;this._dAngle=d-c;this._lastKnownAngle=b.lka;break;case 1:this._mode="properties"; a.add("x").add("y");this._pinAngle=f;this._pinDist=l;break;case 2:this._mode="properties";a.add("angle");this._dAngle=d-c;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(),d=this._inst.GetWorldInfo(),c=this._mode,f=!1;if("rope"===c||"bar"===c){if(b=e.distanceTo(d.GetX(),d.GetY(),a.GetX(),a.GetY()),b>this._pinDist||"bar"===c&&b<this._pinDist)f=e.angleTo(a.GetX(),a.GetY(),d.GetX(),d.GetY()),d.SetXY(a.GetX()+Math.cos(f)*this._pinDist,a.GetY()+Math.sin(f)*this._pinDist),f=!0}else{c=this._propSet;if(c.has("imagepoint")){const [l,g]=b.GetImagePoint(this._pinImagePoint);d.EqualsXY(l,g)||(d.SetXY(l,g),f=!0)}else if(c.has("x")&&c.has("y")){b= a.GetX()+Math.cos(a.GetAngle()+this._pinAngle)*this._pinDist;const l=a.GetY()+Math.sin(a.GetAngle()+this._pinAngle)*this._pinDist;d.EqualsXY(b,l)||(d.SetXY(b,l),f=!0)}else b=a.GetX()+this._dx,c.has("x")&&b!==d.GetX()&&(d.SetX(b),f=!0),b=a.GetY()+this._dy,c.has("y")&&b!==d.GetY()&&(d.SetY(b),f=!0);c.has("angle")&&(this._lastKnownAngle!==d.GetAngle()&&(this._dAngle=e.clampAngle(this._dAngle+(d.GetAngle()-this._lastKnownAngle))),b=e.clampAngle(a.GetAngle()+this._dAngle),b!==d.GetAngle()&&(d.SetAngle(b), f=!0),this._lastKnownAngle=d.GetAngle());c.has("width-abs")&&(b=a.GetWidth()+this._dWidth,b!==d.GetWidth()&&(d.SetWidth(b),f=!0));c.has("width-scale")&&(b=a.GetWidth()*this._dWidth,b!==d.GetWidth()&&(d.SetWidth(b),f=!0));c.has("height-abs")&&(b=a.GetHeight()+this._dHeight,b!==d.GetHeight()&&(d.SetHeight(b),f=!0));c.has("height-scale")&&(b=a.GetHeight()*this._dHeight,b!==d.GetHeight()&&(d.SetHeight(b),f=!0));c.has("z")&&(b=a.GetZElevation()+this._dz,b!==d.GetZElevation()&&(d.SetZElevation(b),this._runtime.UpdateRender()))}f&& d.SetBboxChanged()}}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.pin.debugger.is-pinned",value:!!this._pinInst},{name:"behaviors.pin.debugger.pinned-uid",value:this._pinInst?this._pinInst.GetUID():0}]}]}}}"use strict";self.C3.Behaviors.Pin.Cnds={IsPinned(){return!!this._pinInst},WillDestroy(){return this._destroy}};"use strict"; self.C3.Behaviors.Pin.Acts={PinByDistance(e,b){this._Pin(e,0===b?"rope":"bar")},PinByProperties(e,b,a,d,c,f,l){const g=[];b&&g.push("x");a&&g.push("y");d&&g.push("angle");l&&g.push("z");1===c?g.push("width-abs"):2===c&&g.push("width-scale");1===f?g.push("height-abs"):2===f&&g.push("height-scale");0!==g.length&&this._Pin(e,"properties",g)},PinByImagePoint(e,b,a,d,c,f){const l=["imagepoint"];a&&l.push("angle");f&&l.push("z");1===d?l.push("width-abs"):2===d&&l.push("width-scale");1===c?l.push("height-abs"): 2===c&&l.push("height-scale");this._pinImagePoint=b;this._Pin(e,"properties",l)},SetPinDistance(e){if("rope"===this._mode||"bar"===this._mode)this._pinDist=Math.max(e,0)},SetDestroy(e){this._destroy=e},Unpin(){this._SetPinInst(null);this._mode="";this._propSet.clear();this._pinImagePoint=""},Pin(e,b){switch(b){case 0:this._Pin(e,"properties",["x","y","angle"]);break;case 1:this._Pin(e,"properties",["x","y"]);break;case 2:this._Pin(e,"properties",["angle"]);break;case 3:this._Pin(e,"rope");break;case 4:this._Pin(e, "bar")}}};"use strict";self.C3.Behaviors.Pin.Exps={PinnedUID(){return this._pinInst?this._pinInst.GetUID():-1}};{"use strict";const e=self.C3;e.Behaviors.Rotate=class extends e.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Behaviors.Rotate.Type=class extends e.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}} {"use strict";const e=self.C3;e.Behaviors.Rotate.Instance=class extends e.SDKBehaviorInstanceBase{constructor(b,a){super(b);this._acceleration=this._speed=0;this._isEnabled=!0;a&&(this._speed=e.toRadians(a[0]),this._acceleration=e.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 e.toDegrees(this._speed);case 1:return e.toDegrees(this._acceleration);case 2:return this._isEnabled}}SetPropertyValueByIndex(b,a){switch(b){case 0:this._speed=e.toRadians(a);break;case 1:this._acceleration=e.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:e.toDegrees(this._speed),onedit:b=>this._speed=e.toRadians(b)},{name:"behaviors.rotate.properties.acceleration.name",value:e.toDegrees(this._acceleration),onedit:b=>this._acceleration=e.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 e=self.C3;e.Behaviors.Rotate.Acts={SetSpeed(b){this._speed=e.toRadians(b)},SetAcceleration(b){this._acceleration=e.toRadians(b)},SetEnabled(b){this._SetEnabled(b)}}}{"use strict";const e=self.C3;e.Behaviors.Rotate.Exps={Speed(){return e.toDegrees(this._speed)},Acceleration(){return e.toDegrees(this._acceleration)}}} {"use strict";const e=self.C3,b=self.C3X;let a=null,d=null,c=[],f=null,l=null;function g(m,u,x){var n=m.GetSavedDataMap();const q=u.GetSavedDataMap();x?((n=n.get("Physics_DisabledCollisions"))&&n.delete(u.GetSID()),(u=q.get("Physics_DisabledCollisions"))&&u.delete(m.GetSID())):(x=n.get("Physics_DisabledCollisions"),x||(x=new Set,n.set("Physics_DisabledCollisions",x)),n=q.get("Physics_DisabledCollisions"),n||(n=new Set,q.set("Physics_DisabledCollisions",n)),x.add(u.GetSID()),n.add(m.GetSID()))}e.Behaviors.Physics= class extends e.SDKBehaviorBase{constructor(m){m.scriptInterfaceClass=self.IPhysicsBehavior;super(m);this._world=null;this._worldG=10;this._worldScale=.02;this._worldManifold=null;this._lastUpdateTick=-1;this._steppingMode=1;this._velocityIterations=8;this._positionIterations=3;this._allCollisionsEnabled=!0;this._runtime.AddLoadPromise(this._LoadBox2DWasm())}async _LoadBox2DWasm(){const m=await this._runtime.GetAssetManager().GetProjectFileUrl("box2d.wasm");await new Promise(u=>{self.Box2DWasmModule({wasmBinaryFile:m}).then(x=> {f=x;this._InitBox2DWorld();u()})})}_InitBox2DWorld(){const m=this._runtime.GetCollisionEngine();a=e.Behaviors.Physics.GetVec2(0,0);d=e.Behaviors.Physics.GetVec2(0,0);this._world=new f.b2World(e.Behaviors.Physics.GetTempVec2A(0,this._worldG),!0);var u=new f.JSContactListener;u.BeginContact=x=>{var n=f.wrapPointer(x,f.b2Contact);x=e.Behaviors.Physics.Instance.LookupBehInstFromBody(n.GetFixtureA().GetBody());n=e.Behaviors.Physics.Instance.LookupBehInstFromBody(n.GetFixtureB().GetBody());m.RegisterCollision(x.GetObjectInstance(), n.GetObjectInstance())};u.EndContact=()=>{};u.PreSolve=()=>{};u.PostSolve=()=>{};this._world.SetContactListener(u);u=new f.JSContactFilter;u.ShouldCollide=(x,n)=>{if(this._allCollisionsEnabled)return!0;x=f.wrapPointer(x,f.b2Fixture);n=f.wrapPointer(n,f.b2Fixture);x=e.Behaviors.Physics.Instance.LookupBehInstFromBody(x.GetBody());n=e.Behaviors.Physics.Instance.LookupBehInstFromBody(n.GetBody());x=x.GetObjectInstance().GetObjectClass();const q=n.GetObjectInstance().GetObjectClass();n=x.GetSID();const t= q.GetSID();return(x=x.GetSavedDataMap().get("Physics_DisabledCollisions"))&&x.has(t)?!1:(x=q.GetSavedDataMap().get("Physics_DisabledCollisions"))&&x.has(n)?!1:!0};this._world.SetContactFilter(u);this._worldManifold=new f.b2WorldManifold}Release(){super.Release()}GetBox2D(){return f}GetWorld(){return this._world}GetWorldScale(){return this._worldScale}GetSteppingMode(){return this._steppingMode}SetSteppingMode(m){this._steppingMode=m}SetLastUpdateTick(m){this._lastUpdateTick=m}GetLastUpdateTick(){return this._lastUpdateTick}SetVelocityIterations(m){this._velocityIterations= Math.max(m,1)}GetVelocityIterations(){return this._velocityIterations}SetPositionIterations(m){this._positionIterations=Math.max(m,1)}GetPositionIterations(){return this._positionIterations}SetIterations(m,u){this.SetVelocityIterations(m);this.SetPositionIterations(u)}GetGravity(){return this._worldG}SetGravity(m){m!==this._worldG&&(this._world.SetGravity(e.Behaviors.Physics.GetTempVec2A(0,m)),this._worldG=m,this._WakeUpAllPhysicsBodies())}_WakeUpAllPhysicsBodies(){for(const u of this.GetInstances()){var m= e.Behaviors.Physics.Instance.LookupBehInstFromInst(u);m&&(m=m.GetBody())&&m.SetAwake(!0)}}DisableShouldCollideFastPath(){this._allCollisionsEnabled=!1}SetCollisionsEnabled(m,u,x){x=!!x;if(m&&u){if(u.IsFamily())for(const n of u.GetFamilyMembers())g(m,n,x);else g(m,u,x);this.DisableShouldCollideFastPath()}}GetWorldManifold(){return this._worldManifold}static GetPhysicsCollisionKey(){return"Physics_DisabledCollisions"}static GetVec2(m,u){if(c.length){const x=c.pop();x.set_x(m);x.set_y(u);return x}return new f.b2Vec2(m, u)}static FreeVec2(m){c.push(m)}static GetTempVec2A(m,u){a.set_x(m);a.set_y(u);return a}static GetTempVec2B(m,u){d.set_x(m);d.set_y(u);return d}static CreatePolygonShape(m){const u=new f.b2PolygonShape,x=f._malloc(8*m.length);var n=0;for(let q=0;q<m.length;++q)f.HEAPF32[x+n>>2]=m[q].get_x(),f.HEAPF32[x+(n+4)>>2]=m[q].get_y(),n+=8;n=f.wrapPointer(x,f.b2Vec2);u.Set(n,m.length);f._free(x);return u}};const k=["fixed","variable"];self.IPhysicsBehavior=class extends self.IBehavior{constructor(m){super(m); l=m}set worldGravity(m){b.RequireFiniteNumber(m);l.SetGravity(m)}get worldGravity(){return l.GetGravity()}set steppingMode(m){m=k.indexOf(m);if(0>m)throw Error("invalid stepping mode");l.SetSteppingMode(k[m])}get steppingMode(){return k[l.GetSteppingMode()]}set velocityIterations(m){b.RequireFiniteNumber(m);l.SetVelocityIterations(m)}get velocityIterations(){return l.GetVelocityIterations()}set positionIterations(m){b.RequireFiniteNumber(m);l.SetPositionIterations(m)}get positionIterations(){return l.GetPositionIterations()}setCollisionsEnabled(m, u,x){const n=l.GetRuntime();m=n._UnwrapIObjectClass(m);u=n._UnwrapIObjectClass(u);l.SetCollisionsEnabled(m,u,!!x)}}}{"use strict";const e=self.C3;e.Behaviors.Physics.Type=class extends e.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}} {"use strict";const e=self.C3,b=self.C3X,a=self.IBehaviorInstance,d=new WeakMap,c=new WeakMap,f=new WeakMap,l=e.Behaviors.Physics.GetTempVec2A,g=e.Behaviors.Physics.GetTempVec2B,k=e.New(e.Rect),m=e.New(e.Quad);e.Behaviors.Physics.Instance=class extends e.SDKBehaviorInstanceBase{constructor(n,q){super(n);n=this.GetBehavior();const t=this.GetWorldInfo();this._box2d=n.GetBox2D();this._world=n.GetWorld();this._worldScale=n.GetWorldScale();this._isImmovable=!1;this._collisionMask=0;this._preventRotation= !1;this._density=1;this._friction=.5;this._restitution=.2;this._linearDamping=0;this._angularDamping=.01;this._isBullet=!1;this._isEnabled=!0;this._body=null;this._fixtures=[];this._myJoints=[];this._myCreatedJoints=[];this._joiningMe=new Set;this._lastKnownX=t.GetX();this._lastKnownY=t.GetY();this._lastKnownAngle=t.GetAngle();this._lastHeight=this._lastWidth=0;this._lastTickOverride=!1;q&&(this._isImmovable=!!q[0],this._collisionMask=q[1],this._preventRotation=!!q[2],this._density=q[3],this._friction= q[4],this._restitution=q[5],this._linearDamping=q[6],this._angularDamping=q[7],this._isBullet=!!q[8],this._isEnabled=!!q[9]);q=this._runtime.Dispatcher();this._disposables=new e.CompositeDisposable(e.Disposable.From(q,"instancedestroy",r=>this._OnInstanceDestroyed(r.instance)),e.Disposable.From(q,"beforeload",()=>this._OnBeforeLoad()),e.Disposable.From(q,"afterload",()=>this._OnAfterLoad()));c.set(this._inst,this);this._isEnabled&&this._StartTicking()}PostCreate(){this._CreateBody()}Release(){this._DestroyMyJoints(); e.clearArray(this._myCreatedJoints);this._joiningMe.clear();this._body&&(this._DestroyFixtures(),this._world.DestroyBody(this._body),this._body=null);super.Release()}_CreateFixture(n){if(this._body)return n=this._body.CreateFixture(n),this._fixtures.push(n),n}_DestroyFixtures(){if(this._body){for(const n of this._fixtures)this._body.DestroyFixture(n);e.clearArray(this._fixtures)}}_GetBoundingQuadExcludingMesh(){const n=this.GetWorldInfo();return n.HasMesh()?(n.CalculateBbox(k,m,!1),m):n.GetBoundingQuad()}_Destroy(n){this._box2d.destroy(n)}_CreateBody(){if(this._isEnabled){var n= this._box2d.b2FixtureDef,q=this._box2d.b2BodyDef,t=this.GetWorldInfo();if(!this._body){q=new q;q.set_type(this._isImmovable?0:2);var r=this._GetBoundingQuadExcludingMesh();q.set_position(g(r.midX()*this._worldScale,r.midY()*this._worldScale));q.set_angle(t.GetAngle());q.set_fixedRotation(this._preventRotation);q.set_linearDamping(this._linearDamping);q.set_angularDamping(this._angularDamping);q.set_bullet(this._isBullet);this._body=this._world.CreateBody(q);this._Destroy(q);d.set(this._body,this)}this._DestroyFixtures(); n=new n;n.set_density(this._density);n.set_friction(this._friction);n.set_restitution(this._restitution);r=t.HasOwnCollisionPoly();q=this._collisionMask;r||this._inst.HasTilemap()||0!==q||(q=1);r=Math.max(Math.abs(t.GetWidth()),1);var w=Math.max(Math.abs(t.GetHeight()),1);0===q?this._inst.HasTilemap()?this._CreateTilemapFixtures(n):this._CreatePolygonFixture(n,r,w):1===q?this._CreateBoundingBoxFixture(n,r,w):this._CreateCircleFixture(n,r,w);this._lastWidth=t.GetWidth();this._lastHeight=t.GetHeight(); t.SetPhysicsBodyChanged(!1);this._Destroy(n)}}_CreateBoundingBoxFixture(n,q,t){const r=new this._box2d.b2PolygonShape;r.SetAsBox(q*this._worldScale*.5,t*this._worldScale*.5);n.set_shape(r);this._CreateFixture(n);this._Destroy(r)}_CreateCircleFixture(n,q,t){const r=new this._box2d.b2CircleShape;r.set_m_radius(Math.min(q,t)*this._worldScale*.5);n.set_shape(r);this._CreateFixture(n);this._Destroy(r)}_CreatePolygonFixture(n,q,t){var r=this.GetWorldInfo(),w=0>r.GetWidth();const y=0>r.GetHeight(),C=this._worldScale; var D=r.GetAngle();0!==D&&(r.SetAngle(0),r.SetBboxChanged());var G=this._GetBoundingQuadExcludingMesh();const K=G.midX()-r.GetX();G=G.midY()-r.GetY();0!==D&&(r.SetAngle(D),r.SetBboxChanged());D=r.GetCustomTransformedCollisionPoly(w?-q:q,y?-t:t,0).pointsArr();const B=D.length/2;r=[];for(let A=0;A<B;++A)r.push(e.Behaviors.Physics.GetVec2(D[2*A]-K,D[2*A+1]-G));w!==y&&r.reverse();w=e.Behaviors.Physics.Separator.Separate(r,q*t);for(const A of r)e.Behaviors.Physics.FreeVec2(A);if(w.length)for(const A of w){for(const F of A)F.set_x(F.get_x()* C),F.set_y(F.get_y()*C);q=e.Behaviors.Physics.CreatePolygonShape(A);n.set_shape(q);this._CreateFixture(n);this._Destroy(q);for(const F of A)e.Behaviors.Physics.FreeVec2(F)}else this._CreateBoundingBoxFixture(n,q,t)}_CreateTilemapFixtures(n){var q=this.GetWorldInfo(),t=this._GetBoundingQuadExcludingMesh();const r=t.midX()-q.GetX();q=t.midY()-q.GetY();t=this._worldScale;const w=e.Behaviors.Physics.GetVec2,y=e.Behaviors.Physics.FreeVec2,C=[];this._inst.GetSdkInstance().GetAllCollisionRects(C);const D= [];for(let F=0,J=C.length;F<J;++F){var G=C[F],K=G.GetRect(),B=G.GetPoly();if(B){var A=f.get(B);if(!A){A=B.pointsArr();const L=B.pointCount();for(let Q=0;Q<L;++Q)D.push(w(A[2*Q],A[2*Q+1]));G=G.GetTileId()&3758096384;(-2147483648===G||1073741824===G||536870912===G||G&-2147483648&&G&1073741824&&G&536870912)&&D.reverse();A=e.Behaviors.Physics.Separator.Separate(D,K.width()*K.height());f.set(B,A);for(const Q of D)y(Q);e.clearArray(D)}for(let L=0,Q=A.length;L<Q;++L){B=A[L];for(let T=0,V=B.length;T<V;++T)D.push(w((K.getLeft()+ B[T].get_x()-r)*t,(K.getTop()+B[T].get_y()-q)*t));B=e.Behaviors.Physics.CreatePolygonShape(D);n.set_shape(B);this._CreateFixture(n);this._Destroy(B);for(const T of D)y(T);e.clearArray(D)}}else D.push(w((K.getLeft()-r)*t,(K.getTop()-q)*t)),D.push(w((K.getRight()-r)*t,(K.getTop()-q)*t)),D.push(w((K.getRight()-r)*t,(K.getBottom()-q)*t)),D.push(w((K.getLeft()-r)*t,(K.getBottom()-q)*t)),K=e.Behaviors.Physics.CreatePolygonShape(D),n.set_shape(K),this._CreateFixture(n),this._Destroy(K);for(const L of D)y(L); e.clearArray(D)}}_DestroyBody(){this._body&&(this._DestroyMyJoints(),d.delete(this._body),this._DestroyFixtures(),this._world.DestroyBody(this._body),this._body=null)}_DestroyMyJoints(){for(const n of this._myJoints)this._world.DestroyJoint(n);e.clearArray(this._myJoints)}_RecreateMyJoints(){for(const n of this._myCreatedJoints)switch(n.type){case 0:this._DoCreateDistanceJoint(...n.params);break;case 1:this._DoCreateRevoluteJoint(...n.params);break;case 2:this._DoCreateLimitedRevoluteJoint(...n.params); break;case 3:this._DoCreatePrismaticJoint(...n.params)}}_GetInstImagePoint(n){var q=this.GetWorldInfo();return-1===n?[q.GetX(),q.GetY()]:0===n&&this._body?(n=this._body.GetPosition(),q=this._body.GetLocalCenter(),[(n.get_x()+q.get_x())/this._worldScale,(n.get_y()+q.get_y())/this._worldScale]):this._inst.GetImagePoint(n)}_CreateDistanceJoint(n,q,t,r,w){this._isEnabled&&q&&q!==this._inst&&e.Behaviors.Physics.Instance.LookupBehInstFromInst(q)&&(this._myCreatedJoints.push({type:0,params:[n,q.GetUID(), t,r,w]}),this._DoCreateDistanceJoint(n,q.GetUID(),t,r,w))}_DoCreateDistanceJoint(n,q,t,r,w){if(this._isEnabled){var y=this._runtime.GetInstanceByUID(q);if(y&&y!==this._inst&&c.has(y)){q=e.Behaviors.Physics.Instance.LookupBehInstFromInst(y);q._joiningMe.add(this._inst);this._UpdateBodyToMatchInstance(!1);q._UpdateBodyToMatchInstance(!1);var [C,D]=this._GetInstImagePoint(n),[G,K]=y.GetImagePoint(t);n=C-G;t=D-K;y=this._worldScale;var B=new this._box2d.b2DistanceJointDef;B.Initialize(this._body,q.GetBody(), l(C*y,D*y),g(G*y,K*y));B.set_length(Math.hypot(n,t)*y);B.set_dampingRatio(r);B.set_frequencyHz(w);this._myJoints.push(this._world.CreateJoint(B));this._Destroy(B)}}}_CreateRevoluteJoint(n,q){this._isEnabled&&q&&q!==this._inst&&e.Behaviors.Physics.Instance.LookupBehInstFromInst(q)&&(this._myCreatedJoints.push({type:1,params:[n,q.GetUID()]}),this._DoCreateRevoluteJoint(n,q.GetUID()))}_DoCreateRevoluteJoint(n,q){if(this._isEnabled&&(q=this._runtime.GetInstanceByUID(q))&&q!==this._inst&&c.has(q)){q=e.Behaviors.Physics.Instance.LookupBehInstFromInst(q); q._joiningMe.add(this._inst);this._UpdateBodyToMatchInstance(!1);q._UpdateBodyToMatchInstance(!1);var [t,r]=this._GetInstImagePoint(n);n=this._worldScale;var w=new this._box2d.b2RevoluteJointDef;w.Initialize(this._body,q.GetBody(),l(t*n,r*n));this._myJoints.push(this._world.CreateJoint(w));this._Destroy(w)}}_CreateLimitedRevoluteJoint(n,q,t,r){this._isEnabled&&q&&q!==this._inst&&e.Behaviors.Physics.Instance.LookupBehInstFromInst(q)&&(t=e.toDegrees(t),r=e.toDegrees(r),this._myCreatedJoints.push({type:2, params:[n,q.GetUID(),t,r]}),this._DoCreateLimitedRevoluteJoint(n,q.GetUID(),t,r))}_DoCreateLimitedRevoluteJoint(n,q,t,r){if(this._isEnabled&&(q=this._runtime.GetInstanceByUID(q))&&q!==this._inst&&c.has(q)){q=e.Behaviors.Physics.Instance.LookupBehInstFromInst(q);q._joiningMe.add(this._inst);this._UpdateBodyToMatchInstance(!1);q._UpdateBodyToMatchInstance(!1);var [w,y]=this._GetInstImagePoint(n);n=this._worldScale;var C=new this._box2d.b2RevoluteJointDef;C.Initialize(this._body,q.GetBody(),l(w*n,y* n));C.set_enableLimit(!0);C.set_lowerAngle(e.toRadians(t));C.set_upperAngle(e.toRadians(r));this._myJoints.push(this._world.CreateJoint(C));this._Destroy(C)}}_CreatePrismaticJoint(n,q,t,r,w,y,C,D,G){this._isEnabled&&q&&q!==this._inst&&e.Behaviors.Physics.Instance.LookupBehInstFromInst(q)&&(t=e.toDegrees(t),D=e.toDegrees(D),this._myCreatedJoints.push({type:3,params:[n,q.GetUID(),t,r,w,y,C,D,G]}),this._DoCreatePrismaticJoint(n,q.GetUID(),t,r,w,y,C,D,G))}_DoCreatePrismaticJoint(n,q,t,r,w,y,C,D,G){if(this._isEnabled&& (q=this._runtime.GetInstanceByUID(q))&&q!==this._inst&&c.has(q)){q=e.Behaviors.Physics.Instance.LookupBehInstFromInst(q);q._joiningMe.add(this._inst);this._UpdateBodyToMatchInstance(!1);q._UpdateBodyToMatchInstance(!1);var [K,B]=this._GetInstImagePoint(n);t=e.toRadians(t);n=Math.cos(t);t=Math.sin(t);var A=this._worldScale,F=new this._box2d.b2PrismaticJointDef;F.Initialize(this._body,q.GetBody(),l(K*A,B*A),g(n,t));F.set_enableLimit(!!r);F.set_lowerTranslation(w*A);F.set_upperTranslation(y*A);F.set_enableMotor(!!C); F.set_motorSpeed(e.toRadians(D));F.set_maxMotorForce(G);this._myJoints.push(this._world.CreateJoint(F));this._Destroy(F)}}_RemoveJoints(){this._isEnabled&&(this._DestroyMyJoints(),e.clearArray(this._myCreatedJoints),this._joiningMe.clear())}_OnInstanceDestroyed(n){const q=n.GetUID();let t=0;for(let r=0,w=this._myCreatedJoints.length;r<w;++r)this._myCreatedJoints[t]=this._myCreatedJoints[r],t<this._myJoints.length&&(this._myJoints[t]=this._myJoints[r]),this._myCreatedJoints[r].params[1]===q?r<this._myJoints.length&& this._world.DestroyJoint(this._myJoints[r]):++t;e.truncateArray(this._myCreatedJoints,t);t<this._myJoints.length&&e.truncateArray(this._myJoints,t);this._joiningMe.delete(n)}GetBody(){return this._body}static LookupBehInstFromBody(n){return d.get(n)||null}static LookupBehInstFromInst(n){return c.get(n)||null}SaveToJson(){const n={e:this._isEnabled,pr:this._preventRotation,d:this._density,fr:this._friction,re:this._restitution,ld:this._linearDamping,ad:this._angularDamping,b:this._isBullet,mcj:this._myCreatedJoints}; if(this._isEnabled){const q=this._body.GetLinearVelocity();n.vx=q.get_x();n.vy=q.get_y();n.om=this._body.GetAngularVelocity()}return n}_OnBeforeLoad(){this._DestroyMyJoints();e.clearArray(this._myCreatedJoints);this._joiningMe.clear()}LoadFromJson(n){this._DestroyBody();this._isEnabled=n.e;this._preventRotation=n.pr;this._density=n.d;this._friction=n.fr;this._restitution=n.re;this._linearDamping=n.ld;this._angularDamping=n.ad;this._isBullet=n.b;this._myCreatedJoints=n.mcj;const q=this.GetWorldInfo(); this._lastKnownX=q.GetX();this._lastKnownY=q.GetY();this._lastKnownAngle=q.GetAngle();this._lastWidth=q.GetWidth();this._lastHeight=q.GetHeight();this._isEnabled&&(this._CreateBody(),this._body.SetLinearVelocity(l(n.vx,n.vy)),this._body.SetAngularVelocity(n.om),0===n.vx&&0===n.vy&&0===n.om||this._body.SetAwake(!0),this._myCreatedJoints=n.mcj);this._isEnabled?this._StartTicking():this._StopTicking()}_OnAfterLoad(){this._isEnabled&&this._RecreateMyJoints()}Tick(){if(this._isEnabled){var n=this._runtime, q=this.GetBehavior();if(0===q.GetSteppingMode())var t=n.GetTimeScale()/60;else t=n.GetDt(this._inst),t>1/30&&(t=1/30);var r=n.GetTickCountNoSave();if(r>q.GetLastUpdateTick()&&0<n.GetTimeScale()){n=this._runtime.IsDebug();let w=0;n&&(w=performance.now());0!==t&&this._world.Step(t,q.GetVelocityIterations(),q.GetPositionIterations());this._world.ClearForces();n&&self.C3Debugger.AddPhysicsTime(performance.now()-w);q.SetLastUpdateTick(r)}this._UpdateBodyToMatchInstance(!0)}}_UpdateBodyToMatchInstance(n){const q= this._inst.GetWorldInfo();var t=this._worldScale;(q.GetWidth()!==this._lastWidth||q.GetHeight()!==this._lastHeight||q.IsPhysicsBodyChanged())&&this._CreateBody();var r=this._body,w=q.GetX()!==this._lastKnownX||q.GetY()!==this._lastKnownY,y=q.GetAngle()!==this._lastKnownAngle;if(w){var C=this._GetBoundingQuadExcludingMesh();const D=C.midX();C=C.midY();const G=D-this._lastKnownX,K=C-this._lastKnownY;y?r.SetTransform(l(D*t,C*t),q.GetAngle()):r.SetTransform(l(D*t,C*t),r.GetAngle());n&&(r.SetLinearVelocity(l(G, K)),this._lastTickOverride=!0);r.SetAwake(!0)}else n&&this._lastTickOverride&&(n=this._GetBoundingQuadExcludingMesh(),this._lastTickOverride=!1,r.SetLinearVelocity(l(0,0)),r.SetTransform(l(n.midX()*t,n.midY()*t),r.GetAngle()));!w&&y&&(r.SetTransform(r.GetPosition(),q.GetAngle()),r.SetAwake(!0));y=r.GetPosition();w=y.get_x()/t;t=y.get_y()/t;r=r.GetAngle();if(w!==q.GetX()||t!==q.GetY()||r!==q.GetAngle())if(q.SetXY(w,t),q.SetAngle(r),q.SetBboxChanged(),t=this._GetBoundingQuadExcludingMesh(),r=t.midX()- q.GetX(),t=t.midY()-q.GetY(),0!==r||0!==t)q.OffsetXY(-r,-t),q.SetBboxChanged();this._lastKnownX=q.GetX();this._lastKnownY=q.GetY();this._lastKnownAngle=q.GetAngle()}GetPropertyValueByIndex(n){switch(n){case 2:return this._IsPreventRotate();case 3:return this._GetDensity();case 4:return this._GetFriction();case 5:return this._GetElasticity();case 6:return this._GetLinearDamping();case 7:return this._GetAngularDamping();case 8:return this._IsBullet();case 9:return this._IsEnabled()}}SetPropertyValueByIndex(n, q){switch(n){case 2:this._SetPreventRotate(q);break;case 3:this._SetDensity(q);break;case 4:this._SetFriction(q);break;case 5:this._SetElasticity(q);break;case 6:this._SetLinearDamping(q);break;case 7:this._SetAngularDamping(q);break;case 8:this._SetBullet(q);break;case 9:this._SetEnabled(q)}}_SetEnabled(n){n=!!n;this._isEnabled&&!n?(this._DestroyBody(),this._isEnabled=!1,this._StopTicking()):!this._isEnabled&&n&&(this._isEnabled=!0,this._CreateBody(),this._StartTicking())}_IsEnabled(){return this._isEnabled}GetDebuggerProperties(){const n= [{name:"behaviors.physics.properties.enabled.name",value:this._IsEnabled(),onedit:q=>this._SetEnabled(q)},{name:"behaviors.physics.properties.immovable.name",value:this._IsImmovable(),onedit:q=>this._SetImmovable(q)},{name:"behaviors.physics.properties.density.name",value:this._GetDensity(),onedit:q=>this._SetDensity(q)},{name:"behaviors.physics.properties.friction.name",value:this._GetFriction(),onedit:q=>this._SetFriction(q)},{name:"behaviors.physics.properties.elasticity.name",value:this._GetElasticity(), onedit:q=>this._SetElasticity(q)},{name:"behaviors.physics.properties.linear-damping.name",value:this._GetLinearDamping(),onedit:q=>this._SetLinearDamping(q)},{name:"behaviors.physics.properties.angular-damping.name",value:this._GetAngularDamping(),onedit:q=>this._SetAngularDamping(q)}];this._isEnabled&&(n.push({name:"behaviors.physics.debugger.is-sleeping",value:this._IsSleeping()}),n.push({name:"behaviors.physics.debugger.velocity-x",value:this._GetVelocityX(),onedit:q=>this._SetVelocity(q,this._GetVelocityY())}), n.push({name:"behaviors.physics.debugger.velocity-y",value:this._GetVelocityY(),onedit:q=>this._SetVelocity(this._GetVelocityX(),q)}),n.push({name:"behaviors.physics.debugger.angular-velocity",value:e.toDegrees(this._GetAngularVelocity()),onedit:q=>this._SetAngularVelocity(e.toRadians(q))}),n.push({name:"behaviors.physics.debugger.mass",value:this._GetMass()}));return[{title:"$"+this.GetBehaviorType().GetName(),properties:n}]}_ApplyForce(n,q,t){const [r,w]=this._GetInstImagePoint(t);this._DoApplyForce(n, q,r,w)}_ApplyForceToward(n,q,t,r){const [w,y]=this._GetInstImagePoint(r);q=e.angleTo(w,y,q,t);this._DoApplyForce(Math.cos(q)*n,Math.sin(q)*n,w,y)}_ApplyForceAtAngle(n,q,t){const [r,w]=this._GetInstImagePoint(t);this._DoApplyForce(Math.cos(q)*n,Math.sin(q)*n,r,w)}_DoApplyForce(n,q,t,r){if(this._isEnabled){var w=this._worldScale;this._body.ApplyForce(l(n,q),g(t*w,r*w),!0)}}_ApplyImpulse(n,q,t){const [r,w]=this._GetInstImagePoint(t);this._DoApplyImpulse(n,q,r,w)}_ApplyImpulseToward(n,q,t,r){const [w, y]=this._GetInstImagePoint(r);q=e.angleTo(w,y,q,t);this._DoApplyImpulse(Math.cos(q)*n,Math.sin(q)*n,w,y)}_ApplyImpulseAtAngle(n,q,t){const [r,w]=this._GetInstImagePoint(t);this._DoApplyImpulse(Math.cos(q)*n,Math.sin(q)*n,r,w)}_DoApplyImpulse(n,q,t,r){if(this._isEnabled){var w=this._worldScale;this._body.ApplyLinearImpulse(l(n,q),g(t*w,r*w),!0);n=this.GetWorldInfo();this._lastKnownX=n.GetX();this._lastKnownY=n.GetY();this._lastTickOverride=!1}}_ApplyTorque(n){this._isEnabled&&this._body.ApplyTorque(n, !0)}_ApplyTorqueToAngle(n,q){q=e.angleClockwise(this.GetWorldInfo().GetAngle(),q)?-1:1;this._ApplyTorque(n*q)}_ApplyTorqueToPosition(n,q,t){var r=this.GetWorldInfo();q=e.angleTo(r.GetX(),r.GetY(),q,t);r=e.angleClockwise(r.GetAngle(),q)?-1:1;this._ApplyTorque(n*r)}_SetAngularVelocity(n){this._isEnabled&&(this._body.SetAngularVelocity(n),this._body.SetAwake(!0))}_GetAngularVelocity(){return this._isEnabled?this._body.GetAngularVelocity():0}_SetVelocity(n,q){if(this._isEnabled){var t=this._worldScale; this._body.SetLinearVelocity(l(n*t,q*t));this._body.SetAwake(!0);n=this.GetWorldInfo();this._lastKnownX=n.GetX();this._lastKnownY=n.GetY();this._lastTickOverride=!1}}_GetVelocity(){if(!this._isEnabled)return[0,0];const n=this._worldScale,q=this._body.GetLinearVelocity();return[q.get_x()/n,q.get_y()/n]}_GetVelocityX(){return this._isEnabled?this._body.GetLinearVelocity().get_x()/this._worldScale:0}_GetVelocityY(){return this._isEnabled?this._body.GetLinearVelocity().get_y()/this._worldScale:0}_SetDensity(n){if(this._isEnabled&& this._density!==n){this._density=n;for(const q of this._fixtures)q.SetDensity(n);this._body.ResetMassData()}}_GetDensity(){return this._isEnabled?this._density:0}_SetFriction(n){if(this._isEnabled&&this._friction!==n){this._friction=n;for(var q of this._fixtures)q.SetFriction(n);for(n=this._body.GetContactList();this._box2d.getPointer(n);n=n.get_next())(q=n.get_contact())&&q.ResetFriction()}}_GetFriction(){return this._isEnabled?this._friction:0}_SetElasticity(n){if(this._isEnabled&&this._restitution!== n){this._restitution=n;for(const q of this._fixtures)q.SetRestitution(n)}}_GetElasticity(){return this._isEnabled?this._restitution:0}_SetLinearDamping(n){this._isEnabled&&this._linearDamping!==n&&(this._linearDamping=n,this._body.SetLinearDamping(n))}_GetLinearDamping(){return this._isEnabled?this._linearDamping:0}_SetAngularDamping(n){this._isEnabled&&this._angularDamping!==n&&(this._angularDamping=n,this._body.SetAngularDamping(n))}_GetAngularDamping(){return this._isEnabled?this._angularDamping: 0}_SetImmovable(n){this._isEnabled&&(n=!!n,this._isImmovable!==n&&(this._isImmovable=n,this._body.SetType(this._isImmovable?0:2),this._body.SetAwake(!0)))}_IsImmovable(){return this._isImmovable}_SetPreventRotate(n){this._isEnabled&&(n=!!n,this._preventRotation!==n&&(this._preventRotation=n,this._body.SetFixedRotation(this._preventRotation),this._body.SetAngularVelocity(0),this._body.SetAwake(!0)))}_IsPreventRotate(){return this._preventRotation}_SetBullet(n){this._isEnabled&&(n=!!n,this._isBullet!== n&&(this._isBullet=n,this._body.SetBullet(this._isBullet),this._body.SetAwake(!0)))}_IsBullet(){return this._isBullet}_GetMass(){return this._isEnabled?this._body.GetMass()/this._worldScale:0}_GetCenterOfMassX(){return this._isEnabled?(this._body.GetPosition().get_x()+this._body.GetLocalCenter().get_x())/this._worldScale:0}_GetCenterOfMassY(){return this._isEnabled?(this._body.GetPosition().get_y()+this._body.GetLocalCenter().get_y())/this._worldScale:0}_GetCenterOfMass(){if(!this._isEnabled)return[0, 0];const n=this._body.GetPosition(),q=this._body.GetLocalCenter(),t=this._worldScale;return[(n.get_x()+q.get_x())/t,(n.get_y()+q.get_y())/t]}_IsSleeping(){return this._isEnabled?!this._body.IsAwake():!1}_GetContactCount(){if(!this._isEnabled)return 0;let n=0;for(let t=this._body.GetContactList();this._box2d.getPointer(t);t=t.get_next()){var q=t.get_contact();q&&(q=q.GetManifold().get_pointCount(),n+=q)}return n}_GetContactPositionAt(n){n=Math.floor(n);if(!this._isEnabled)return[0,0];var q=0;for(let r= this._body.GetContactList();this._box2d.getPointer(r);r=r.get_next()){var t=r.get_contact();if(!t)continue;const w=t.GetManifold().get_pointCount();if(n>=q&&n<q+w)return n-=q,q=this.GetBehavior().GetWorldManifold(),t.GetWorldManifold(q),t=q.get_points(n),[t.get_x()/this._worldScale,t.get_y()/this._worldScale];q+=w}return[0,0]}GetScriptInterfaceClass(){return self.IPhysicsBehaviorInstance}};const u=new WeakMap;function x(n,q){return u.get(n).GetRuntime()._UnwrapIWorldInstance(q)}self.IPhysicsBehaviorInstance= class extends a{constructor(){super();u.set(this,a._GetInitInst().GetSdkInstance())}get isEnabled(){return u.get(this)._IsEnabled()}set isEnabled(n){u.get(this)._SetEnabled(n)}applyForce(n,q,t=0){b.RequireFiniteNumber(n);b.RequireFiniteNumber(q);u.get(this)._ApplyForce(n,q,t)}applyForceTowardPosition(n,q,t,r=0){b.RequireFiniteNumber(n);b.RequireFiniteNumber(q);b.RequireFiniteNumber(t);u.get(this)._ApplyForceToward(n,q,t,r)}applyForceAtAngle(n,q,t=0){b.RequireFiniteNumber(n);b.RequireFiniteNumber(q); u.get(this)._ApplyForceAtAngle(n,q,t)}applyImpulse(n,q,t=0){b.RequireFiniteNumber(n);b.RequireFiniteNumber(q);u.get(this)._ApplyImpulse(n,q,t)}applyImpulseTowardPosition(n,q,t,r=0){b.RequireFiniteNumber(n);b.RequireFiniteNumber(q);b.RequireFiniteNumber(t);u.get(this)._ApplyImpulseToward(n,q,t,r)}applyImpulseAtAngle(n,q,t=0){b.RequireFiniteNumber(n);b.RequireFiniteNumber(q);u.get(this)._ApplyImpulseAtAngle(n,q,t)}applyTorque(n){b.RequireFiniteNumber(n);u.get(this)._ApplyTorque(n)}applyTorqueToAngle(n, q){b.RequireFiniteNumber(n);b.RequireFiniteNumber(q);u.get(this)._ApplyTorqueToAngle(n,q)}applyTorqueToPosition(n,q,t){b.RequireFiniteNumber(n);b.RequireFiniteNumber(q);b.RequireFiniteNumber(t);u.get(this)._ApplyTorqueToPosition(n,q,t)}set angularVelocity(n){b.RequireFiniteNumber(n);u.get(this)._SetAngularVelocity(n)}get angularVelocity(){return u.get(this)._GetAngularVelocity()}setVelocity(n,q){b.RequireFiniteNumber(n);b.RequireFiniteNumber(q);u.get(this)._SetVelocity(n,q)}getVelocityX(){return u.get(this)._GetVelocityX()}getVelocityY(){return u.get(this)._GetVelocityY()}getVelocity(){return u.get(this)._GetVelocity()}set density(n){b.RequireFiniteNumber(n); u.get(this)._SetDensity(n)}get density(){return u.get(this)._GetDensity()}set friction(n){b.RequireFiniteNumber(n);u.get(this)._SetFriction(n)}get friction(){return u.get(this)._GetFriction()}set elasticity(n){b.RequireFiniteNumber(n);u.get(this)._SetElasticity(n)}get elasticity(){return u.get(this)._GetElasticity()}set linearDamping(n){b.RequireFiniteNumber(n);u.get(this)._SetLinearDamping(n)}get linearDamping(){return u.get(this)._GetLinearDamping()}set angularDamping(n){b.RequireFiniteNumber(n); u.get(this)._SetAngularDamping(n)}get angularDamping(){return u.get(this)._GetAngularDamping()}set isImmovable(n){u.get(this)._SetImmovable(n)}get isImmovable(){return u.get(this)._IsImmovable()}set isPreventRotation(n){u.get(this)._SetPreventRotate(n)}get isPreventRotation(){return u.get(this)._IsPreventRotate()}set isBullet(n){u.get(this)._SetBullet(n)}get isBullet(){return u.get(this)._IsBullet()}get mass(){return u.get(this)._GetMass()}getCenterOfMassX(){return u.get(this)._GetCenterOfMassX()}getCenterOfMassY(){return u.get(this)._GetCenterOfMassY()}getCenterOfMass(){return u.get(this)._GetCenterOfMass()}getContactCount(){return u.get(this)._GetContactCount()}getContactX(n){b.RequireFiniteNumber(n); return u.get(this)._GetContactPositionAt(n)[0]}getContactY(n){b.RequireFiniteNumber(n);return u.get(this)._GetContactPositionAt(n)[1]}getContact(n){b.RequireFiniteNumber(n);return u.get(this)._GetContactPositionAt(n)}get isSleeping(){return u.get(this)._IsSleeping()}createDistanceJoint(n,q,t,r,w){b.RequireFiniteNumber(r);b.RequireFiniteNumber(w);q=x(this,q);u.get(this)._CreateDistanceJoint(n,q,t,r,w)}createRevoluteJoint(n,q){q=x(this,q);u.get(this)._CreateRevoluteJoint(n,q)}createLimitedRevoluteJoint(n, q,t,r){b.RequireFiniteNumber(t);b.RequireFiniteNumber(r);q=x(this,q);u.get(this)._CreateLimitedRevoluteJoint(n,q,t,r)}createPrismaticJoint(n,q,t,r,w,y,C,D,G){q=x(this,q);u.get(this)._CreatePrismaticJoint(n,q,t,r,w,y,C,D,G)}removeAllJoints(){u.get(this)._RemoveJoints()}}} {"use strict";const e=self.C3;e.Behaviors.Physics.Cnds={IsSleeping(){return this._IsSleeping()},CompareVelocity(b,a,d){if(!this._isEnabled)return!1;if(0===b)b=this._GetVelocityX();else if(1===b)b=this._GetVelocityY();else{const [c,f]=this._GetVelocity();b=Math.hypot(c,f)}return e.compare(b,a,d)},CompareAngularVelocity(b,a){if(!this._isEnabled)return!1;const d=e.toDegrees(this._GetAngularVelocity());return e.compare(d,b,a)},CompareMass(b,a){if(!this._isEnabled)return!1;const d=this._GetMass();return e.compare(d, b,a)},IsEnabled(){return this._IsEnabled()}}} {"use strict";const e=self.C3;e.Behaviors.Physics.Acts={ApplyForce(b,a,d){this._ApplyForce(b,a,d)},ApplyForceToward(b,a,d,c){this._ApplyForceToward(b,a,d,c)},ApplyForceAtAngle(b,a,d){this._ApplyForceAtAngle(b,e.toRadians(a),d)},ApplyImpulse(b,a,d){this._ApplyImpulse(b,a,d)},ApplyImpulseToward(b,a,d,c){this._ApplyImpulseToward(b,a,d,c)},ApplyImpulseAtAngle(b,a,d){this._ApplyImpulseAtAngle(b,e.toRadians(a),d)},ApplyTorque(b){this._ApplyTorque(e.toRadians(b))},ApplyTorqueToAngle(b,a){this._ApplyTorqueToAngle(e.toRadians(b), e.toRadians(a))},ApplyTorqueToPosition(b,a,d){this._ApplyTorqueToPosition(e.toRadians(b),a,d)},SetAngularVelocity(b){this._SetAngularVelocity(e.toRadians(b))},CreateDistanceJoint(b,a,d,c,f){a&&(a=a.GetFirstPicked(this._inst),this._CreateDistanceJoint(b,a,d,c,f))},CreateRevoluteJoint(b,a){a&&(a=a.GetFirstPicked(this._inst),this._CreateRevoluteJoint(b,a))},CreateLimitedRevoluteJoint(b,a,d,c){a&&(a=a.GetFirstPicked(this._inst),this._CreateLimitedRevoluteJoint(b,a,e.toRadians(d),e.toRadians(c)))},CreatePrismaticJoint(b, a,d,c,f,l,g,k,m){a&&(a=a.GetFirstPicked(this._inst),this._CreatePrismaticJoint(b,a,e.toRadians(d),c,f,l,g,e.toRadians(k),m))},RemoveJoints(){this._RemoveJoints()},SetWorldGravity(b){this.GetBehavior().SetGravity(b)},SetSteppingMode(b){this.GetBehavior().SetSteppingMode(b)},SetIterations(b,a){this.GetBehavior().SetIterations(b,a)},SetVelocity(b,a){this._SetVelocity(b,a)},SetDensity(b){this._SetDensity(b)},SetFriction(b){this._SetFriction(b)},SetElasticity(b){this._SetElasticity(b)},SetLinearDamping(b){this._SetLinearDamping(b)}, SetAngularDamping(b){this._SetAngularDamping(b)},SetImmovable(b){this._SetImmovable(b)},EnableCollisions(b,a){this.GetBehavior().SetCollisionsEnabled(this.GetObjectClass(),b,0!==a)},SetPreventRotate(b){this._SetPreventRotate(0!==b)},SetBullet(b){this._SetBullet(0!==b)},SetEnabled(b){this._SetEnabled(0!==b)}}} {"use strict";const e=self.C3;e.Behaviors.Physics.Exps={VelocityX(){return this._GetVelocityX()},VelocityY(){return this._GetVelocityY()},AngularVelocity(){return e.toDegrees(this._GetAngularVelocity())},Mass(){return this._GetMass()},CenterOfMassX(){return this._GetCenterOfMassX()},CenterOfMassY(){return this._GetCenterOfMassY()},Density(){return this._GetDensity()},Friction(){return this._GetFriction()},Elasticity(){return this._GetElasticity()},LinearDamping(){return this._GetLinearDamping()}, AngularDamping(){return this._GetAngularDamping()},ContactCount(){return this._GetContactCount()},ContactXAt(b){return this._GetContactPositionAt(b)[0]},ContactYAt(b){return this._GetContactPositionAt(b)[1]}}} {"use strict";const e=self.C3,b={};e.Behaviors.Physics.Separator=b;const a=e.Behaviors.Physics.GetVec2,d=e.Behaviors.Physics.FreeVec2;function c(g){return a(g.get_x(),g.get_y())}b.det=function(g,k,m,u,x,n){return g*u+m*n+x*k-k*m-u*x-n*g};b.hitRay=function(g,k,m,u,x,n,q,t){var r=m-g,w=u-k,y=q-x;const C=t-n;y=(y*(n-k)-C*(x-g))/(w*y-r*C);r=g+y*r;w=k+y*w;g=b.isOnSegment(m,u,g,k,r,w);x=b.isOnSegment(r,w,x,n,q,t);return g&&x?a(r,w):null};b.isOnSegment=function(g,k,m,u,x,n){return(m+.1>=g&&g>=x-.1||m-.1<= g&&g<=x+.1)&&(u+.1>=k&&k>=n-.1||u-.1<=k&&k<=n+.1)&&b.isOnLine(g,k,m,u,x,n)};b.isOnLine=function(g,k,m,u,x,n){return.1<Math.abs(x-m)?.1>Math.abs((n-u)/(x-m)*(g-m)+u-k):.1>Math.abs(g-m)};b.pointsMatch=function(g,k,m,u){return.1>Math.abs(m-g)&&.1>Math.abs(u-k)};b.Separate=function(g,k){g=b.calcShapes(g);let m=[];for(let u=0,x=g.length;u<x;++u){const n=g[u],q=[];let t=0;for(let r=0,w=n.length;r<w;++r){const y=n[r],C=n[(r+1)%w];t+=y.get_x()*C.get_y()-y.get_y()*C.get_x();q.push(a(y.get_x(),y.get_y()))}t= Math.abs(t/2);if(t>=.001*k)m.push(q);else for(let r=0,w=q.length;r<w;r++)d(q[r])}return m=f(m)};b.calcShapes=function(g){var k;let m;var u;let x;let n,q,t,r;let w;var y=0;let C=0,D,G=[],K=[];for(K.push(g);K.length;){g=K[0];m=g.length;D=!0;for(k=0;k<m;k++){n=k;q=k<m-1?k+1:k+1-m;var B=k<m-2?k+2:k+2-m;t=g[n];r=g[q];B=g[B];B=b.det(t.get_x(),t.get_y(),r.get_x(),r.get_y(),B.get_x(),B.get_y());if(0>B){D=!1;var A=1E9;for(u=0;u<m;u++)if(u!==n&&u!==q){k=u;B=u<m-1?u+1:0;var F=g[k];var J=g[B];if(F=b.hitRay(t.get_x(), t.get_y(),r.get_x(),r.get_y(),F.get_x(),F.get_y(),J.get_x(),J.get_y()))J=r.get_x()-F.get_x(),x=r.get_y()-F.get_y(),J=J*J+x*x,J<A?(C=k,y=B,w=F,A=J):d(F)}if(1E9===A)return[];u=[];A=[];k=C;B=y;F=g[k];J=g[B];y=!1;b.pointsMatch(w.get_x(),w.get_y(),J.get_x(),J.get_y())||(u.push(w),y=!0);b.pointsMatch(w.get_x(),w.get_y(),F.get_x(),F.get_y())||(A.push(w),y=!0);y||d(w);C=-1;for(y=n;;){if(y!==B)u.push(g[y]);else{if(0>C||C>=m)return[];b.isOnSegment(J.get_x(),J.get_y(),g[C].get_x(),g[C].get_y(),t.get_x(),t.get_y())|| u.push(g[y]);break}C=y;0>y-1?y=m-1:y--}u.reverse();C=-1;for(y=q;;){if(y!==k)A.push(g[y]);else{if(0>C||C>=m)return[];y!==k||b.isOnSegment(F.get_x(),F.get_y(),g[C].get_x(),g[C].get_y(),r.get_x(),r.get_y())||A.push(g[y]);break}C=y;y+1>m-1?y=0:y++}K.push(u,A);K.shift();break}}D&&G.push(K.shift())}return G};function f(g){const k=[];for(const m of g)8>=m.length?k.push(m):k.push.apply(k,l(m));return k}function l(g){const k=[];k.push(g.splice(0,8));const m=k[0][0];let u=k[0][7];for(;g.length;){const x=g.splice(0, Math.min(g.length,6));let n=x.at(-1);x.push(c(m));x.push(c(u));k.push(x);u=n}return k}}{"use strict";const e=self.C3;e.Behaviors.destroy=class extends e.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Behaviors.destroy.Type=class extends e.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}} {"use strict";const e=self.C3;e.Behaviors.destroy.Instance=class extends e.SDKBehaviorInstanceBase{constructor(b,a){super(b);this._StartTicking()}Release(){super.Release()}Tick(){var b=this._inst.GetWorldInfo();const a=b.GetBoundingBox();b=b.GetLayout();(0>a.getRight()||0>a.getBottom()||a.getLeft()>b.GetWidth()||a.getTop()>b.GetHeight())&&this._runtime.DestroyInstance(this._inst)}}}"use strict";self.C3.Behaviors.destroy.Cnds={};"use strict";self.C3.Behaviors.destroy.Acts={};"use strict"; self.C3.Behaviors.destroy.Exps={}; {const e=self.C3;self.C3_GetObjectRefTable=function(){return[e.Plugins.Sprite,e.Plugins.TiledBg,e.Behaviors.Fade,e.Plugins.Spritefont2,e.Behaviors.Pin,e.Behaviors.Rotate,e.Plugins.Particles,e.Plugins.Shape3D,e.Behaviors.Physics,e.Behaviors.destroy,e.Plugins.LocalStorage,e.Plugins.Touch,e.Plugins.Audio,e.Plugins.Timeline,e.Plugins.Browser,e.Plugins.System.Cnds.IsGroupActive,e.Plugins.System.Cnds.OnLayoutStart,e.Plugins.Audio.Acts.Play,e.Plugins.Particles.Acts.Destroy,e.Plugins.Timeline.Acts.SetInstance, e.Plugins.Timeline.Acts.PlayTimeline,e.Plugins.System.Cnds.EveryTick,e.Plugins.TiledBg.Acts.SetWidth,e.Plugins.TiledBg.Exps.Width,e.Plugins.System.Exps.random,e.Plugins.TiledBg.Cnds.CompareWidth,e.Plugins.System.Acts.Wait,e.Plugins.System.Acts.GoToLayout,e.Plugins.LocalStorage.Acts.CheckItemExists,e.Plugins.LocalStorage.Cnds.OnItemExists,e.Plugins.LocalStorage.Acts.GetItem,e.Plugins.LocalStorage.Cnds.OnItemGet,e.Plugins.System.Acts.SetVar,e.Plugins.LocalStorage.Exps.ItemValue,e.Plugins.Sprite.Acts.SetOpacity, e.Plugins.Sprite.Acts.SetSize,e.Plugins.Spritefont2.Acts.SetOpacity,e.Plugins.Spritefont2.Acts.SetText,e.Plugins.Sprite.Cnds.CompareOpacity,e.Plugins.Timeline.Cnds.OnTimelineFinishedByTags,e.Plugins.Sprite.Cnds.CompareFrame,e.Plugins.Touch.Cnds.OnTouchObject,e.Plugins.Browser.Acts.Close,e.Plugins.Browser.Acts.GoToURLWindow,e.Plugins.Sprite.Acts.Spawn,e.Plugins.Sprite.Acts.SetAnimFrame,e.Plugins.Sprite.Acts.Destroy,e.Plugins.System.Cnds.For,e.Plugins.System.Acts.CreateObject,e.Plugins.System.Exps.loopindex, e.Plugins.Sprite.Acts.SetInstanceVar,e.Plugins.System.Acts.AddVar,e.Plugins.Sprite.Cnds.CompareInstanceVar,e.Plugins.Sprite.Exps.X,e.Plugins.Sprite.Exps.Y,e.Behaviors.Pin.Acts.PinByProperties,e.Plugins.System.Acts.GoToLayoutByName,e.Plugins.System.Acts.SetGroupActive,e.Plugins.System.Acts.RestartLayout,e.Behaviors.Physics.Acts.SetWorldGravity,e.Behaviors.Physics.Cnds.IsSleeping,e.Behaviors.Physics.Acts.ApplyImpulseAtAngle,e.Plugins.Sprite.Exps.Angle,e.Plugins.Sprite.Cnds.OnCollision,e.Plugins.Sprite.Cnds.OnCreated, e.Plugins.Sprite.Exps.AnimationFrameCount,e.Plugins.Sprite.Cnds.OnDestroyed,e.Behaviors.Pin.Cnds.IsPinned,e.Plugins.Sprite.Cnds.IsOverlapping,e.Plugins.Particles.Acts.SetAngle,e.Plugins.Sprite.Cnds.AngleWithin,e.Plugins.Particles.Acts.SetXRandomiser,e.Plugins.Particles.Acts.SetYRandomiser,e.Plugins.Sprite.Acts.SetScale,e.Plugins.Sprite.Acts.SetPos,e.Plugins.System.Exps.layoutwidth,e.Plugins.System.Exps.layoutheight,e.Plugins.Sprite.Acts.ZMoveToObject,e.Plugins.Sprite.Cnds.CompareY,e.Plugins.Sprite.Acts.SetY, e.Plugins.System.Cnds.Compare,e.Plugins.Sprite.Exps.PickedCount,e.Plugins.Sprite.Exps.Count,e.Behaviors.Rotate.Acts.SetSpeed,e.Plugins.System.Exps.choose,e.Plugins.System.Exps.viewportbottom,e.Plugins.Sprite.Exps.LayerNumber,e.Plugins.System.Cnds.CompareVar,e.Plugins.LocalStorage.Acts.SetItem,e.Plugins.Timeline.Cnds.OnTimelineStartedByTags,e.Plugins.Particles.Cnds.OnCreated,e.Plugins.Audio.Acts.SetVolume,e.Plugins.System.Exps.viewportleft,e.Plugins.System.Exps.viewporttop]};self.C3_JsPropNameTable= [{Background:0},{Load:0},{Load_Bar:0},{Fade:0},{Tr:0},{Load_Pin:0},{Option_B:0},{Play_B:0},{Status:0},{Title:0},{Pin:0},{Level_Font:0},{Play_Object:0},{Rotate:0},{Play_Paricle_Object:0},{Play_Paricle:0},{Back_B:0},{Level_T:0},{Id:0},{Select:0},{Home_B:0},{Menu_B:0},{Retry_B:0},{Page:0},{Complete_Popup:0},{Completed_Particle:0},{Completed_Bg:0},{Continue:0},{Failed_Popup:0},{Level_Font2:0},{Physics:0},{"3DShape":0},{Ball1:0},{Ball2:0},{Ball3:0},{Line:0},{Completed_Particle_Object:0},{GlassContainer:0}, {BlackBall_paticle_Object:0},{DestroyOutsideLayout:0},{BomB:0},{BlackBall_paticle:0},{Bomb_Area:0},{Bomb_Effect:0},{BombWick_Particle:0},{GlassContainer_Paricle:0},{GlassContainer_Paricle_Object:0},{Ball4:0},{Windmill:0},{Windmill_Area:0},{Windmill_particle:0},{LocalStorage:0},{Touch:0},{Audio:0},{Timeline:0},{Browser:0},{Physics2:0},{Ball_F:0},{Level:0},{X:0},{Y:0}]} {const e=self.C3;function b(c,f){return"number"===typeof c&&"number"===typeof f}function a(c,f){return b(c,f)?c*f:c}function d(c,f){return"string"===typeof c||"string"===typeof f?("number"===typeof c?(Math.round(1E10*c)/1E10).toString():c)+("number"===typeof f?(Math.round(1E10*f)/1E10).toString():f):c&&f?1:0}self.C3_ExpressionFuncs=[()=>"BallSound_Start",()=>-100,()=>"Ball",()=>"Line",()=>"Logo",()=>"",()=>"Loading",c=>{const f=c._GetNode(0),l=c._GetNode(1).GetBoundMethod();return()=>f.ExpObject()+ l(.1,1)},()=>349,()=>2,()=>"Checking_level",()=>"Lv",c=>{const f=c._GetNode(0).GetBoundMethod();return()=>f()},()=>"Sett_AdMob",()=>"Game_Title",()=>0,()=>62.2,()=>25.6,()=>15.4,()=>61.4,()=>10.4,c=>{const f=c._GetNode(0).GetVar();return()=>f.GetValue()},()=>80,()=>"Title",()=>"T_Loop",()=>"Play",()=>"Play_B",()=>"Op",()=>"2",()=>"0",()=>1,()=>"1",()=>"Un",()=>"Option_B",()=>-5,()=>"B",()=>"Bt",()=>"Exit",()=>"More",()=>"Rate",()=>"https://codecanyon.net/user/depfov/portfolio",()=>"https://codecanyon.net/user/depfov", ()=>"UI",()=>"Show_Banner_Ad",()=>"Back_B",()=>"Back",()=>"Level_T",()=>"Lv_T",()=>"Create_Level",()=>39,c=>{const f=c._GetNode(0).GetVar(),l=c._GetNode(1).GetBoundMethod();return()=>f.GetValue()+180*(l()%5)},c=>{const f=c._GetNode(0).GetVar(),l=c._GetNode(1).GetBoundMethod();return()=>f.GetValue()+180*Math.floor(l()/5)},c=>{const f=c._GetNode(0);return()=>f.ExpObject()},c=>{const f=c._GetNode(0);return()=>f.ExpObject()-20},c=>{const f=c._GetNode(0);return()=>f.ExpInstVar()},()=>"Select",()=>"Sl", c=>{const f=c._GetNode(0).GetVar();return()=>d("Lv",f.GetValue())},()=>"Start",()=>"Ball2",()=>"Ball3",()=>"Ball4",()=>"Failed",()=>"Next",()=>"Completed",()=>"Popup",()=>"Button",()=>"Home",()=>"Menu",()=>"Retry",()=>"Unpin",()=>3,()=>"3",()=>4,()=>"4",()=>5,()=>"5",()=>6,()=>"6",()=>7,()=>"7",()=>8,()=>"8",()=>"Physics_Object",()=>20,()=>"BALL COLOR",()=>"Ball1",c=>{const f=c._GetNode(0).GetBoundMethod();return()=>f(1,17)},()=>.4,()=>"Ball_Color_Particle",c=>{const f=c._GetNode(0).GetBoundMethod(), l=c._GetNode(1);return()=>f(l.ExpObject())},()=>"BomB",()=>"Bomb",()=>"Bomb1",()=>50,c=>{const f=c._GetNode(0),l=c._GetNode(1),g=c._GetNode(2),k=c._GetNode(3);return()=>e.toDegrees(e.angleTo(f.ExpObject(),l.ExpObject(),g.ExpObject(),k.ExpObject()))},()=>"Windmill",()=>"R",()=>150,()=>90,()=>180,()=>270,()=>2.5,()=>"Overflow_Line",()=>.7,c=>{const f=c._GetNode(0).GetBoundMethod();return()=>f(1,15)},()=>1.1,()=>"Black_ball",()=>540,()=>960,c=>{const f=c._GetNode(0).GetBoundMethod();return()=>f()+100}, ()=>277,()=>28.2,()=>800,()=>"Fail",()=>"Ball_Destroy",()=>"Ball_To_Bomb",()=>"Bomb_To_GlassContainer",()=>"TR",()=>-50,()=>"Particle",c=>{const f=c._GetNode(0).GetBoundMethod(),l=c._GetNode(1).GetBoundMethod();return()=>a(f(-1,1),l(10,200))},()=>1200,c=>{const f=c._GetNode(0).GetBoundMethod(),l=c._GetNode(1);return()=>f(l.ExpObject())-220},()=>"Tap",()=>"Restart",()=>40,()=>"Main_Audio",()=>"Failed_Sound",()=>"Button_Sound",()=>"Pin_Sound",()=>"P",()=>"Completed_Sound",()=>"Balls",()=>-10,()=>.9, ()=>"Nex_Tap",()=>300,()=>"Bomb_sound",()=>"Show_Interstitials_Ad",c=>{const f=c._GetNode(0).GetBoundMethod();return()=>f()+50},c=>{const f=c._GetNode(0).GetBoundMethod(),l=c._GetNode(1);return()=>f(l.ExpObject())-500}]}var module$str$c3runtime={};var module$str$__c3root__={};
| ver. 1.4 |
Github
|
.
| PHP 8.2.29 | Генераци� �траницы: 0.02 |
proxy
|
phpinfo
|
�а�тройка