text: // Generated by Construct 3, the game and app creator :: https://www.construct.net
  "use strict";
  // ../3rdparty/glmatrix.js
  /*
   @fileoverview gl-matrix - High performance matrix and vector operations
  @author Brandon Jones
  @author Colin MacKenzie IV
  @version 3.3.0
  
  Copyright (c) 2015-2020, Brandon Jones, Colin MacKenzie IV.
  
  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:
  
  The above copyright notice and this permission notice shall be included in
  all copies or substantial portions of the Software.
  
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  THE SOFTWARE.
  
  */
  'use strict';(function(A,G){"object"===typeof exports&&"undefined"!==typeof module?G(exports):"function"===typeof define&&define.amd?define(["exports"],G):(A=A||self,G(A.glMatrix={}))})(this,function(A){function G(a,b,c){var d=b[0],e=b[1],f=b[2];b=b[3];var g=c[0],h=c[1],k=c[2];c=c[3];a[0]=d*g+f*h;a[1]=e*g+b*h;a[2]=d*k+f*c;a[3]=e*k+b*c;return a}function aa(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];a[2]=b[2]-c[2];a[3]=b[3]-c[3];return a}function ba(a,b,c){var d=b[0],e=b[1],f=b[2],g=b[3],h=b[4];b=b[5];var k=
  c[0],l=c[1],m=c[2],n=c[3],q=c[4];c=c[5];a[0]=d*k+f*l;a[1]=e*k+g*l;a[2]=d*m+f*n;a[3]=e*m+g*n;a[4]=d*q+f*c+h;a[5]=e*q+g*c+b;return a}function ca(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];a[2]=b[2]-c[2];a[3]=b[3]-c[3];a[4]=b[4]-c[4];a[5]=b[5]-c[5];return a}function da(){var a=new t(9);t!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[5]=0,a[6]=0,a[7]=0);a[0]=1;a[4]=1;a[8]=1;return a}function ea(a,b,c){var d=b[0],e=b[1],f=b[2],g=b[3],h=b[4],k=b[5],l=b[6],m=b[7];b=b[8];var n=c[0],q=c[1],p=c[2],v=c[3],u=c[4],r=c[5],
  t=c[6],w=c[7];c=c[8];a[0]=n*d+q*g+p*l;a[1]=n*e+q*h+p*m;a[2]=n*f+q*k+p*b;a[3]=v*d+u*g+r*l;a[4]=v*e+u*h+r*m;a[5]=v*f+u*k+r*b;a[6]=t*d+w*g+c*l;a[7]=t*e+w*h+c*m;a[8]=t*f+w*k+c*b;return a}function fa(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];a[2]=b[2]-c[2];a[3]=b[3]-c[3];a[4]=b[4]-c[4];a[5]=b[5]-c[5];a[6]=b[6]-c[6];a[7]=b[7]-c[7];a[8]=b[8]-c[8];return a}function ha(a){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a}function ia(a,
  b,c){var d=b[0],e=b[1],f=b[2],g=b[3],h=b[4],k=b[5],l=b[6],m=b[7],n=b[8],q=b[9],p=b[10],v=b[11],u=b[12],r=b[13],t=b[14];b=b[15];var w=c[0],y=c[1],z=c[2],x=c[3];a[0]=w*d+y*h+z*n+x*u;a[1]=w*e+y*k+z*q+x*r;a[2]=w*f+y*l+z*p+x*t;a[3]=w*g+y*m+z*v+x*b;w=c[4];y=c[5];z=c[6];x=c[7];a[4]=w*d+y*h+z*n+x*u;a[5]=w*e+y*k+z*q+x*r;a[6]=w*f+y*l+z*p+x*t;a[7]=w*g+y*m+z*v+x*b;w=c[8];y=c[9];z=c[10];x=c[11];a[8]=w*d+y*h+z*n+x*u;a[9]=w*e+y*k+z*q+x*r;a[10]=w*f+y*l+z*p+x*t;a[11]=w*g+y*m+z*v+x*b;w=c[12];y=c[13];z=c[14];x=c[15];
  a[12]=w*d+y*h+z*n+x*u;a[13]=w*e+y*k+z*q+x*r;a[14]=w*f+y*l+z*p+x*t;a[15]=w*g+y*m+z*v+x*b;return a}function ja(a,b,c){var d=b[0],e=b[1],f=b[2],g=b[3],h=d+d,k=e+e,l=f+f;b=d*h;var m=d*k;d*=l;var n=e*k;e*=l;f*=l;h*=g;k*=g;g*=l;a[0]=1-(n+f);a[1]=m+g;a[2]=d-k;a[3]=0;a[4]=m-g;a[5]=1-(b+f);a[6]=e+h;a[7]=0;a[8]=d+k;a[9]=e-h;a[10]=1-(b+n);a[11]=0;a[12]=c[0];a[13]=c[1];a[14]=c[2];a[15]=1;return a}function ka(a,b){a[0]=b[12];a[1]=b[13];a[2]=b[14];return a}function la(a,b){var c=b[4],d=b[5],e=b[6],f=b[8],g=b[9],
  h=b[10];a[0]=Math.hypot(b[0],b[1],b[2]);a[1]=Math.hypot(c,d,e);a[2]=Math.hypot(f,g,h);return a}function ma(a,b){var c=new t(3);la(c,b);var d=1/c[0],e=1/c[1],f=1/c[2],g=b[0]*d;c=b[1]*e;var h=b[2]*f,k=b[4]*d,l=b[5]*e,m=b[6]*f;d*=b[8];e*=b[9];b=b[10]*f;f=g+l+b;0<f?(g=2*Math.sqrt(f+1),a[3]=.25*g,a[0]=(m-e)/g,a[1]=(d-h)/g,a[2]=(c-k)/g):g>l&&g>b?(g=2*Math.sqrt(1+g-l-b),a[3]=(m-e)/g,a[0]=.25*g,a[1]=(c+k)/g,a[2]=(d+h)/g):l>b?(g=2*Math.sqrt(1+l-g-b),a[3]=(d-h)/g,a[0]=(c+k)/g,a[1]=.25*g,a[2]=(m+e)/g):(g=2*
  Math.sqrt(1+b-g-l),a[3]=(c-k)/g,a[0]=(d+h)/g,a[1]=(m+e)/g,a[2]=.25*g);return a}function na(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];a[2]=b[2]-c[2];a[3]=b[3]-c[3];a[4]=b[4]-c[4];a[5]=b[5]-c[5];a[6]=b[6]-c[6];a[7]=b[7]-c[7];a[8]=b[8]-c[8];a[9]=b[9]-c[9];a[10]=b[10]-c[10];a[11]=b[11]-c[11];a[12]=b[12]-c[12];a[13]=b[13]-c[13];a[14]=b[14]-c[14];a[15]=b[15]-c[15];return a}function R(){var a=new t(3);t!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0);return a}function S(a){return Math.hypot(a[0],a[1],a[2])}function T(a,
  b,c){var d=new t(3);d[0]=a;d[1]=b;d[2]=c;return d}function oa(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];a[2]=b[2]-c[2];return a}function pa(a,b,c){a[0]=b[0]*c[0];a[1]=b[1]*c[1];a[2]=b[2]*c[2];return a}function qa(a,b,c){a[0]=b[0]/c[0];a[1]=b[1]/c[1];a[2]=b[2]/c[2];return a}function ra(a,b){return Math.hypot(b[0]-a[0],b[1]-a[1],b[2]-a[2])}function sa(a,b){var c=b[0]-a[0],d=b[1]-a[1];a=b[2]-a[2];return c*c+d*d+a*a}function ta(a){var b=a[0],c=a[1];a=a[2];return b*b+c*c+a*a}function ua(a,b){var c=b[0],d=b[1],
  e=b[2];c=c*c+d*d+e*e;0<c&&(c=1/Math.sqrt(c));a[0]=b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c;return a}function U(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]}function M(a,b,c){var d=b[0],e=b[1];b=b[2];var f=c[0],g=c[1];c=c[2];a[0]=e*c-b*g;a[1]=b*f-d*c;a[2]=d*g-e*f;return a}function va(){var a=new t(4);t!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0,a[3]=0);return a}function wa(a){var b=new t(4);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];return b}function xa(a,b,c,d){var e=new t(4);e[0]=a;e[1]=b;e[2]=c;e[3]=d;return e}function N(a,
  b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];return a}function ya(a,b,c,d,e){a[0]=b;a[1]=c;a[2]=d;a[3]=e;return a}function za(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];a[2]=b[2]+c[2];a[3]=b[3]+c[3];return a}function Aa(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];a[2]=b[2]-c[2];a[3]=b[3]-c[3];return a}function Ba(a,b,c){a[0]=b[0]*c[0];a[1]=b[1]*c[1];a[2]=b[2]*c[2];a[3]=b[3]*c[3];return a}function Ca(a,b,c){a[0]=b[0]/c[0];a[1]=b[1]/c[1];a[2]=b[2]/c[2];a[3]=b[3]/c[3];return a}function V(a,b,c){a[0]=b[0]*c;a[1]=b[1]*
  c;a[2]=b[2]*c;a[3]=b[3]*c;return a}function Da(a,b){return Math.hypot(b[0]-a[0],b[1]-a[1],b[2]-a[2],b[3]-a[3])}function Ea(a,b){var c=b[0]-a[0],d=b[1]-a[1],e=b[2]-a[2];a=b[3]-a[3];return c*c+d*d+e*e+a*a}function H(a){return Math.hypot(a[0],a[1],a[2],a[3])}function C(a){var b=a[0],c=a[1],d=a[2];a=a[3];return b*b+c*c+d*d+a*a}function O(a,b){var c=b[0],d=b[1],e=b[2];b=b[3];var f=c*c+d*d+e*e+b*b;0<f&&(f=1/Math.sqrt(f));a[0]=c*f;a[1]=d*f;a[2]=e*f;a[3]=b*f;return a}function K(a,b){return a[0]*b[0]+a[1]*
  b[1]+a[2]*b[2]+a[3]*b[3]}function Fa(a,b,c,d){var e=b[0],f=b[1],g=b[2];b=b[3];a[0]=e+d*(c[0]-e);a[1]=f+d*(c[1]-f);a[2]=g+d*(c[2]-g);a[3]=b+d*(c[3]-b);return a}function Ga(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]}function Ha(a,b){var c=a[0],d=a[1],e=a[2];a=a[3];var f=b[0],g=b[1],h=b[2];b=b[3];return Math.abs(c-f)<=1E-6*Math.max(1,Math.abs(c),Math.abs(f))&&Math.abs(d-g)<=1E-6*Math.max(1,Math.abs(d),Math.abs(g))&&Math.abs(e-h)<=1E-6*Math.max(1,Math.abs(e),Math.abs(h))&&Math.abs(a-
  b)<=1E-6*Math.max(1,Math.abs(a),Math.abs(b))}function P(){var a=new t(4);t!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0);a[3]=1;return a}function Ia(a,b,c){c*=.5;var d=Math.sin(c);a[0]=d*b[0];a[1]=d*b[1];a[2]=d*b[2];a[3]=Math.cos(c);return a}function Ja(a,b,c){var d=b[0],e=b[1],f=b[2];b=b[3];var g=c[0],h=c[1],k=c[2];c=c[3];a[0]=d*c+b*g+e*k-f*h;a[1]=e*c+b*h+f*g-d*k;a[2]=f*c+b*k+d*h-e*g;a[3]=b*c-d*g-e*h-f*k;return a}function Ka(a,b,c){c*=.5;var d=b[0],e=b[1],f=b[2];b=b[3];var g=Math.sin(c);c=Math.cos(c);a[0]=
  d*c+b*g;a[1]=e*c+f*g;a[2]=f*c-e*g;a[3]=b*c-d*g;return a}function La(a,b,c){c*=.5;var d=b[0],e=b[1],f=b[2];b=b[3];var g=Math.sin(c);c=Math.cos(c);a[0]=d*c-f*g;a[1]=e*c+b*g;a[2]=f*c+d*g;a[3]=b*c-e*g;return a}function Ma(a,b,c){c*=.5;var d=b[0],e=b[1],f=b[2];b=b[3];var g=Math.sin(c);c=Math.cos(c);a[0]=d*c+e*g;a[1]=e*c-d*g;a[2]=f*c+b*g;a[3]=b*c-f*g;return a}function Na(a,b){var c=b[0],d=b[1],e=b[2],f=Math.sqrt(c*c+d*d+e*e);b=Math.exp(b[3]);var g=0<f?b*Math.sin(f)/f:0;a[0]=c*g;a[1]=d*g;a[2]=e*g;a[3]=b*
  Math.cos(f);return a}function Oa(a,b){var c=b[0],d=b[1],e=b[2];b=b[3];var f=Math.sqrt(c*c+d*d+e*e);f=0<f?Math.atan2(f,b)/f:0;a[0]=c*f;a[1]=d*f;a[2]=e*f;a[3]=.5*Math.log(c*c+d*d+e*e+b*b);return a}function Q(a,b,c,d){var e=b[0],f=b[1],g=b[2];b=b[3];var h=c[0],k=c[1],l=c[2];c=c[3];var m=e*h+f*k+g*l+b*c;0>m&&(m=-m,h=-h,k=-k,l=-l,c=-c);if(1E-6<1-m){var n=Math.acos(m);var q=Math.sin(n);m=Math.sin((1-d)*n)/q;d=Math.sin(d*n)/q}else m=1-d;a[0]=m*e+d*h;a[1]=m*f+d*k;a[2]=m*g+d*l;a[3]=m*b+d*c;return a}function Pa(a,
  b){var c=b[0]+b[4]+b[8];if(0<c)c=Math.sqrt(c+1),a[3]=.5*c,c=.5/c,a[0]=(b[5]-b[7])*c,a[1]=(b[6]-b[2])*c,a[2]=(b[1]-b[3])*c;else{var d=0;b[4]>b[0]&&(d=1);b[8]>b[3*d+d]&&(d=2);var e=(d+1)%3,f=(d+2)%3;c=Math.sqrt(b[3*d+d]-b[3*e+e]-b[3*f+f]+1);a[d]=.5*c;c=.5/c;a[3]=(b[3*e+f]-b[3*f+e])*c;a[e]=(b[3*e+d]+b[3*d+e])*c;a[f]=(b[3*f+d]+b[3*d+f])*c}return a}function Qa(a,b,c){var d=.5*c[0],e=.5*c[1];c=.5*c[2];var f=b[0],g=b[1],h=b[2];b=b[3];a[0]=f;a[1]=g;a[2]=h;a[3]=b;a[4]=d*b+e*h-c*g;a[5]=e*b+c*f-d*h;a[6]=c*b+
  d*g-e*f;a[7]=-d*f-e*g-c*h;return a}function Ra(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];return a}function Sa(a,b,c){var d=b[0],e=b[1],f=b[2],g=b[3],h=c[4],k=c[5],l=c[6],m=c[7],n=b[4],q=b[5],p=b[6];b=b[7];var v=c[0],u=c[1],r=c[2];c=c[3];a[0]=d*c+g*v+e*r-f*u;a[1]=e*c+g*u+f*v-d*r;a[2]=f*c+g*r+d*u-e*v;a[3]=g*c-d*v-e*u-f*r;a[4]=d*m+g*h+e*l-f*k+n*c+b*v+q*r-p*u;a[5]=e*m+g*k+f*h-d*l+q*c+b*u+p*v-n*r;a[6]=f*m+g*l+d*k-e*h+p*c+b*r+n*u-q*v;a[7]=g*m-d*h-e*k-f*l+b*c-n*
  v-q*u-p*r;return a}function Ta(){var a=new t(2);t!=Float32Array&&(a[0]=0,a[1]=0);return a}function Ua(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];return a}function Va(a,b,c){a[0]=b[0]*c[0];a[1]=b[1]*c[1];return a}function Wa(a,b,c){a[0]=b[0]/c[0];a[1]=b[1]/c[1];return a}function Xa(a,b){return Math.hypot(b[0]-a[0],b[1]-a[1])}function Ya(a,b){var c=b[0]-a[0];a=b[1]-a[1];return c*c+a*a}function Za(a){return Math.hypot(a[0],a[1])}function $a(a){var b=a[0];a=a[1];return b*b+a*a}var t="undefined"!==typeof Float32Array?
  Float32Array:Array,B=Math.random,ab=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var a=0,b=arguments.length;b--;)a+=arguments[b]*arguments[b];return Math.sqrt(a)});var bb=Object.freeze({__proto__:null,EPSILON:1E-6,get ARRAY_TYPE(){return t},RANDOM:B,setMatrixArrayType:function(a){t=a},toRadian:function(a){return a*ab},equals:function(a,b){return Math.abs(a-b)<=1E-6*Math.max(1,Math.abs(a),Math.abs(b))}}),cb=Object.freeze({__proto__:null,create:function(){var a=new t(4);t!=Float32Array&&(a[1]=
  0,a[2]=0);a[0]=1;a[3]=1;return a},clone:function(a){var b=new t(4);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];return b},copy:function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];return a},identity:function(a){a[0]=1;a[1]=0;a[2]=0;a[3]=1;return a},fromValues:function(a,b,c,d){var e=new t(4);e[0]=a;e[1]=b;e[2]=c;e[3]=d;return e},set:function(a,b,c,d,e){a[0]=b;a[1]=c;a[2]=d;a[3]=e;return a},transpose:function(a,b){if(a===b){var c=b[1];a[1]=b[2];a[2]=c}else a[0]=b[0],a[1]=b[2],a[2]=b[1],a[3]=b[3];return a},
  invert:function(a,b){var c=b[0],d=b[1],e=b[2];b=b[3];var f=c*b-e*d;if(!f)return null;f=1/f;a[0]=b*f;a[1]=-d*f;a[2]=-e*f;a[3]=c*f;return a},adjoint:function(a,b){var c=b[0];a[0]=b[3];a[1]=-b[1];a[2]=-b[2];a[3]=c;return a},determinant:function(a){return a[0]*a[3]-a[2]*a[1]},multiply:G,rotate:function(a,b,c){var d=b[0],e=b[1],f=b[2];b=b[3];var g=Math.sin(c);c=Math.cos(c);a[0]=d*c+f*g;a[1]=e*c+b*g;a[2]=d*-g+f*c;a[3]=e*-g+b*c;return a},scale:function(a,b,c){var d=b[1],e=b[2],f=b[3],g=c[0];c=c[1];a[0]=
  b[0]*g;a[1]=d*g;a[2]=e*c;a[3]=f*c;return a},fromRotation:function(a,b){var c=Math.sin(b);b=Math.cos(b);a[0]=b;a[1]=c;a[2]=-c;a[3]=b;return a},fromScaling:function(a,b){a[0]=b[0];a[1]=0;a[2]=0;a[3]=b[1];return a},str:function(a){return"mat2("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"},frob:function(a){return Math.hypot(a[0],a[1],a[2],a[3])},LDU:function(a,b,c,d){a[2]=d[2]/d[0];c[0]=d[0];c[1]=d[1];c[3]=d[3]-a[2]*c[1];return[a,b,c]},add:function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];a[2]=b[2]+c[2];a[3]=
  b[3]+c[3];return a},subtract:aa,exactEquals:function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]},equals:function(a,b){var c=a[0],d=a[1],e=a[2];a=a[3];var f=b[0],g=b[1],h=b[2];b=b[3];return Math.abs(c-f)<=1E-6*Math.max(1,Math.abs(c),Math.abs(f))&&Math.abs(d-g)<=1E-6*Math.max(1,Math.abs(d),Math.abs(g))&&Math.abs(e-h)<=1E-6*Math.max(1,Math.abs(e),Math.abs(h))&&Math.abs(a-b)<=1E-6*Math.max(1,Math.abs(a),Math.abs(b))},multiplyScalar:function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;a[2]=b[2]*
  c;a[3]=b[3]*c;return a},multiplyScalarAndAdd:function(a,b,c,d){a[0]=b[0]+c[0]*d;a[1]=b[1]+c[1]*d;a[2]=b[2]+c[2]*d;a[3]=b[3]+c[3]*d;return a},mul:G,sub:aa}),db=Object.freeze({__proto__:null,create:function(){var a=new t(6);t!=Float32Array&&(a[1]=0,a[2]=0,a[4]=0,a[5]=0);a[0]=1;a[3]=1;return a},clone:function(a){var b=new t(6);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];return b},copy:function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];return a},identity:function(a){a[0]=
  1;a[1]=0;a[2]=0;a[3]=1;a[4]=0;a[5]=0;return a},fromValues:function(a,b,c,d,e,f){var g=new t(6);g[0]=a;g[1]=b;g[2]=c;g[3]=d;g[4]=e;g[5]=f;return g},set:function(a,b,c,d,e,f,g){a[0]=b;a[1]=c;a[2]=d;a[3]=e;a[4]=f;a[5]=g;return a},invert:function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],g=b[4];b=b[5];var h=c*f-d*e;if(!h)return null;h=1/h;a[0]=f*h;a[1]=-d*h;a[2]=-e*h;a[3]=c*h;a[4]=(e*b-f*g)*h;a[5]=(d*g-c*b)*h;return a},determinant:function(a){return a[0]*a[3]-a[1]*a[2]},multiply:ba,rotate:function(a,b,c){var d=
  b[0],e=b[1],f=b[2],g=b[3],h=b[4];b=b[5];var k=Math.sin(c);c=Math.cos(c);a[0]=d*c+f*k;a[1]=e*c+g*k;a[2]=d*-k+f*c;a[3]=e*-k+g*c;a[4]=h;a[5]=b;return a},scale:function(a,b,c){var d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],k=c[0];c=c[1];a[0]=b[0]*k;a[1]=d*k;a[2]=e*c;a[3]=f*c;a[4]=g;a[5]=h;return a},translate:function(a,b,c){var d=b[0],e=b[1],f=b[2],g=b[3],h=b[4];b=b[5];var k=c[0];c=c[1];a[0]=d;a[1]=e;a[2]=f;a[3]=g;a[4]=d*k+f*c+h;a[5]=e*k+g*c+b;return a},fromRotation:function(a,b){var c=Math.sin(b);b=Math.cos(b);
  a[0]=b;a[1]=c;a[2]=-c;a[3]=b;a[4]=0;a[5]=0;return a},fromScaling:function(a,b){a[0]=b[0];a[1]=0;a[2]=0;a[3]=b[1];a[4]=0;a[5]=0;return a},fromTranslation:function(a,b){a[0]=1;a[1]=0;a[2]=0;a[3]=1;a[4]=b[0];a[5]=b[1];return a},str:function(a){return"mat2d("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+")"},frob:function(a){return Math.hypot(a[0],a[1],a[2],a[3],a[4],a[5],1)},add:function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];a[2]=b[2]+c[2];a[3]=b[3]+c[3];a[4]=b[4]+c[4];a[5]=b[5]+c[5];return a},
  subtract:ca,multiplyScalar:function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c;a[3]=b[3]*c;a[4]=b[4]*c;a[5]=b[5]*c;return a},multiplyScalarAndAdd:function(a,b,c,d){a[0]=b[0]+c[0]*d;a[1]=b[1]+c[1]*d;a[2]=b[2]+c[2]*d;a[3]=b[3]+c[3]*d;a[4]=b[4]+c[4]*d;a[5]=b[5]+c[5]*d;return a},exactEquals:function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]},equals:function(a,b){var c=a[0],d=a[1],e=a[2],f=a[3],g=a[4];a=a[5];var h=b[0],k=b[1],l=b[2],m=b[3],n=b[4];b=b[5];return Math.abs(c-
  h)<=1E-6*Math.max(1,Math.abs(c),Math.abs(h))&&Math.abs(d-k)<=1E-6*Math.max(1,Math.abs(d),Math.abs(k))&&Math.abs(e-l)<=1E-6*Math.max(1,Math.abs(e),Math.abs(l))&&Math.abs(f-m)<=1E-6*Math.max(1,Math.abs(f),Math.abs(m))&&Math.abs(g-n)<=1E-6*Math.max(1,Math.abs(g),Math.abs(n))&&Math.abs(a-b)<=1E-6*Math.max(1,Math.abs(a),Math.abs(b))},mul:ba,sub:ca}),eb=Object.freeze({__proto__:null,create:da,fromMat4:function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[4];a[4]=b[5];a[5]=b[6];a[6]=b[8];a[7]=b[9];a[8]=b[10];
  return a},clone:function(a){var b=new t(9);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];return b},copy:function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];return a},fromValues:function(a,b,c,d,e,f,g,h,k){var l=new t(9);l[0]=a;l[1]=b;l[2]=c;l[3]=d;l[4]=e;l[5]=f;l[6]=g;l[7]=h;l[8]=k;return l},set:function(a,b,c,d,e,f,g,h,k,l){a[0]=b;a[1]=c;a[2]=d;a[3]=e;a[4]=f;a[5]=g;a[6]=h;a[7]=k;a[8]=l;return a},identity:function(a){a[0]=
  1;a[1]=0;a[2]=0;a[3]=0;a[4]=1;a[5]=0;a[6]=0;a[7]=0;a[8]=1;return a},transpose:function(a,b){if(a===b){var c=b[1],d=b[2],e=b[5];a[1]=b[3];a[2]=b[6];a[3]=c;a[5]=b[7];a[6]=d;a[7]=e}else a[0]=b[0],a[1]=b[3],a[2]=b[6],a[3]=b[1],a[4]=b[4],a[5]=b[7],a[6]=b[2],a[7]=b[5],a[8]=b[8];return a},invert:function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],k=b[6],l=b[7];b=b[8];var m=b*g-h*l,n=-b*f+h*k,q=l*f-g*k,p=c*m+d*n+e*q;if(!p)return null;p=1/p;a[0]=m*p;a[1]=(-b*d+e*l)*p;a[2]=(h*d-e*g)*p;a[3]=n*p;a[4]=
  (b*c-e*k)*p;a[5]=(-h*c+e*f)*p;a[6]=q*p;a[7]=(-l*c+d*k)*p;a[8]=(g*c-d*f)*p;return a},adjoint:function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],k=b[6],l=b[7];b=b[8];a[0]=g*b-h*l;a[1]=e*l-d*b;a[2]=d*h-e*g;a[3]=h*k-f*b;a[4]=c*b-e*k;a[5]=e*f-c*h;a[6]=f*l-g*k;a[7]=d*k-c*l;a[8]=c*g-d*f;return a},determinant:function(a){var b=a[3],c=a[4],d=a[5],e=a[6],f=a[7],g=a[8];return a[0]*(g*c-d*f)+a[1]*(-g*b+d*e)+a[2]*(f*b-c*e)},multiply:ea,translate:function(a,b,c){var d=b[0],e=b[1],f=b[2],g=b[3],h=b[4],
  k=b[5],l=b[6],m=b[7];b=b[8];var n=c[0];c=c[1];a[0]=d;a[1]=e;a[2]=f;a[3]=g;a[4]=h;a[5]=k;a[6]=n*d+c*g+l;a[7]=n*e+c*h+m;a[8]=n*f+c*k+b;return a},rotate:function(a,b,c){var d=b[0],e=b[1],f=b[2],g=b[3],h=b[4],k=b[5],l=b[6],m=b[7];b=b[8];var n=Math.sin(c);c=Math.cos(c);a[0]=c*d+n*g;a[1]=c*e+n*h;a[2]=c*f+n*k;a[3]=c*g-n*d;a[4]=c*h-n*e;a[5]=c*k-n*f;a[6]=l;a[7]=m;a[8]=b;return a},scale:function(a,b,c){var d=c[0];c=c[1];a[0]=d*b[0];a[1]=d*b[1];a[2]=d*b[2];a[3]=c*b[3];a[4]=c*b[4];a[5]=c*b[5];a[6]=b[6];a[7]=
  b[7];a[8]=b[8];return a},fromTranslation:function(a,b){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=1;a[5]=0;a[6]=b[0];a[7]=b[1];a[8]=1;return a},fromRotation:function(a,b){var c=Math.sin(b);b=Math.cos(b);a[0]=b;a[1]=c;a[2]=0;a[3]=-c;a[4]=b;a[5]=0;a[6]=0;a[7]=0;a[8]=1;return a},fromScaling:function(a,b){a[0]=b[0];a[1]=0;a[2]=0;a[3]=0;a[4]=b[1];a[5]=0;a[6]=0;a[7]=0;a[8]=1;return a},fromMat2d:function(a,b){a[0]=b[0];a[1]=b[1];a[2]=0;a[3]=b[2];a[4]=b[3];a[5]=0;a[6]=b[4];a[7]=b[5];a[8]=1;return a},fromQuat:function(a,
  b){var c=b[0],d=b[1],e=b[2];b=b[3];var f=c+c,g=d+d,h=e+e;c*=f;var k=d*f;d*=g;var l=e*f,m=e*g;e*=h;f*=b;g*=b;b*=h;a[0]=1-d-e;a[3]=k-b;a[6]=l+g;a[1]=k+b;a[4]=1-c-e;a[7]=m-f;a[2]=l-g;a[5]=m+f;a[8]=1-c-d;return a},normalFromMat4:function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],k=b[6],l=b[7],m=b[8],n=b[9],q=b[10],p=b[11],v=b[12],u=b[13],r=b[14];b=b[15];var t=c*h-d*g,w=c*k-e*g,y=c*l-f*g,z=d*k-e*h,x=d*l-f*h,I=e*l-f*k,J=m*u-n*v,E=m*r-q*v;m=m*b-p*v;var F=n*r-q*u;n=n*b-p*u;q=q*b-p*r;p=t*q-w*n+y*
  F+z*m-x*E+I*J;if(!p)return null;p=1/p;a[0]=(h*q-k*n+l*F)*p;a[1]=(k*m-g*q-l*E)*p;a[2]=(g*n-h*m+l*J)*p;a[3]=(e*n-d*q-f*F)*p;a[4]=(c*q-e*m+f*E)*p;a[5]=(d*m-c*n-f*J)*p;a[6]=(u*I-r*x+b*z)*p;a[7]=(r*y-v*I-b*w)*p;a[8]=(v*x-u*y+b*t)*p;return a},projection:function(a,b,c){a[0]=2/b;a[1]=0;a[2]=0;a[3]=0;a[4]=-2/c;a[5]=0;a[6]=-1;a[7]=1;a[8]=1;return a},str:function(a){return"mat3("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+")"},frob:function(a){return Math.hypot(a[0],
  a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])},add:function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];a[2]=b[2]+c[2];a[3]=b[3]+c[3];a[4]=b[4]+c[4];a[5]=b[5]+c[5];a[6]=b[6]+c[6];a[7]=b[7]+c[7];a[8]=b[8]+c[8];return a},subtract:fa,multiplyScalar:function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c;a[3]=b[3]*c;a[4]=b[4]*c;a[5]=b[5]*c;a[6]=b[6]*c;a[7]=b[7]*c;a[8]=b[8]*c;return a},multiplyScalarAndAdd:function(a,b,c,d){a[0]=b[0]+c[0]*d;a[1]=b[1]+c[1]*d;a[2]=b[2]+c[2]*d;a[3]=b[3]+c[3]*d;a[4]=b[4]+c[4]*d;a[5]=b[5]+
  c[5]*d;a[6]=b[6]+c[6]*d;a[7]=b[7]+c[7]*d;a[8]=b[8]+c[8]*d;return a},exactEquals:function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&a[6]===b[6]&&a[7]===b[7]&&a[8]===b[8]},equals:function(a,b){var c=a[0],d=a[1],e=a[2],f=a[3],g=a[4],h=a[5],k=a[6],l=a[7];a=a[8];var m=b[0],n=b[1],q=b[2],p=b[3],v=b[4],u=b[5],r=b[6],t=b[7];b=b[8];return Math.abs(c-m)<=1E-6*Math.max(1,Math.abs(c),Math.abs(m))&&Math.abs(d-n)<=1E-6*Math.max(1,Math.abs(d),Math.abs(n))&&Math.abs(e-
  q)<=1E-6*Math.max(1,Math.abs(e),Math.abs(q))&&Math.abs(f-p)<=1E-6*Math.max(1,Math.abs(f),Math.abs(p))&&Math.abs(g-v)<=1E-6*Math.max(1,Math.abs(g),Math.abs(v))&&Math.abs(h-u)<=1E-6*Math.max(1,Math.abs(h),Math.abs(u))&&Math.abs(k-r)<=1E-6*Math.max(1,Math.abs(k),Math.abs(r))&&Math.abs(l-t)<=1E-6*Math.max(1,Math.abs(l),Math.abs(t))&&Math.abs(a-b)<=1E-6*Math.max(1,Math.abs(a),Math.abs(b))},mul:ea,sub:fa}),fb=Object.freeze({__proto__:null,create:function(){var a=new t(16);t!=Float32Array&&(a[1]=0,a[2]=
  0,a[3]=0,a[4]=0,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=0,a[12]=0,a[13]=0,a[14]=0);a[0]=1;a[5]=1;a[10]=1;a[15]=1;return a},clone:function(a){var b=new t(16);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11];b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];return b},copy:function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=
  b[14];a[15]=b[15];return a},fromValues:function(a,b,c,d,e,f,g,h,k,l,m,n,q,p,v,u){var r=new t(16);r[0]=a;r[1]=b;r[2]=c;r[3]=d;r[4]=e;r[5]=f;r[6]=g;r[7]=h;r[8]=k;r[9]=l;r[10]=m;r[11]=n;r[12]=q;r[13]=p;r[14]=v;r[15]=u;return r},set:function(a,b,c,d,e,f,g,h,k,l,m,n,q,p,v,u,r){a[0]=b;a[1]=c;a[2]=d;a[3]=e;a[4]=f;a[5]=g;a[6]=h;a[7]=k;a[8]=l;a[9]=m;a[10]=n;a[11]=q;a[12]=p;a[13]=v;a[14]=u;a[15]=r;return a},identity:ha,transpose:function(a,b){if(a===b){var c=b[1],d=b[2],e=b[3],f=b[6],g=b[7],h=b[11];a[1]=b[4];
  a[2]=b[8];a[3]=b[12];a[4]=c;a[6]=b[9];a[7]=b[13];a[8]=d;a[9]=f;a[11]=b[14];a[12]=e;a[13]=g;a[14]=h}else a[0]=b[0],a[1]=b[4],a[2]=b[8],a[3]=b[12],a[4]=b[1],a[5]=b[5],a[6]=b[9],a[7]=b[13],a[8]=b[2],a[9]=b[6],a[10]=b[10],a[11]=b[14],a[12]=b[3],a[13]=b[7],a[14]=b[11],a[15]=b[15];return a},invert:function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],k=b[6],l=b[7],m=b[8],n=b[9],q=b[10],p=b[11],v=b[12],u=b[13],r=b[14];b=b[15];var t=c*h-d*g,w=c*k-e*g,y=c*l-f*g,z=d*k-e*h,x=d*l-f*h,I=e*l-f*k,J=m*u-n*
  v,E=m*r-q*v,F=m*b-p*v,A=n*r-q*u,B=n*b-p*u,C=q*b-p*r,D=t*C-w*B+y*A+z*F-x*E+I*J;if(!D)return null;D=1/D;a[0]=(h*C-k*B+l*A)*D;a[1]=(e*B-d*C-f*A)*D;a[2]=(u*I-r*x+b*z)*D;a[3]=(q*x-n*I-p*z)*D;a[4]=(k*F-g*C-l*E)*D;a[5]=(c*C-e*F+f*E)*D;a[6]=(r*y-v*I-b*w)*D;a[7]=(m*I-q*y+p*w)*D;a[8]=(g*B-h*F+l*J)*D;a[9]=(d*F-c*B-f*J)*D;a[10]=(v*x-u*y+b*t)*D;a[11]=(n*y-m*x-p*t)*D;a[12]=(h*E-g*A-k*J)*D;a[13]=(c*A-d*E+e*J)*D;a[14]=(u*w-v*z-r*t)*D;a[15]=(m*z-n*w+q*t)*D;return a},adjoint:function(a,b){var c=b[0],d=b[1],e=b[2],
  f=b[3],g=b[4],h=b[5],k=b[6],l=b[7],m=b[8],n=b[9],q=b[10],p=b[11],v=b[12],u=b[13],r=b[14];b=b[15];a[0]=h*(q*b-p*r)-n*(k*b-l*r)+u*(k*p-l*q);a[1]=-(d*(q*b-p*r)-n*(e*b-f*r)+u*(e*p-f*q));a[2]=d*(k*b-l*r)-h*(e*b-f*r)+u*(e*l-f*k);a[3]=-(d*(k*p-l*q)-h*(e*p-f*q)+n*(e*l-f*k));a[4]=-(g*(q*b-p*r)-m*(k*b-l*r)+v*(k*p-l*q));a[5]=c*(q*b-p*r)-m*(e*b-f*r)+v*(e*p-f*q);a[6]=-(c*(k*b-l*r)-g*(e*b-f*r)+v*(e*l-f*k));a[7]=c*(k*p-l*q)-g*(e*p-f*q)+m*(e*l-f*k);a[8]=g*(n*b-p*u)-m*(h*b-l*u)+v*(h*p-l*n);a[9]=-(c*(n*b-p*u)-m*(d*
  b-f*u)+v*(d*p-f*n));a[10]=c*(h*b-l*u)-g*(d*b-f*u)+v*(d*l-f*h);a[11]=-(c*(h*p-l*n)-g*(d*p-f*n)+m*(d*l-f*h));a[12]=-(g*(n*r-q*u)-m*(h*r-k*u)+v*(h*q-k*n));a[13]=c*(n*r-q*u)-m*(d*r-e*u)+v*(d*q-e*n);a[14]=-(c*(h*r-k*u)-g*(d*r-e*u)+v*(d*k-e*h));a[15]=c*(h*q-k*n)-g*(d*q-e*n)+m*(d*k-e*h);return a},determinant:function(a){var b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],g=a[5],h=a[6],k=a[7],l=a[8],m=a[9],n=a[10],q=a[11],p=a[12],v=a[13],u=a[14];a=a[15];return(b*g-c*f)*(n*a-q*u)-(b*h-d*f)*(m*a-q*v)+(b*k-e*f)*(m*u-n*v)+
  (c*h-d*g)*(l*a-q*p)-(c*k-e*g)*(l*u-n*p)+(d*k-e*h)*(l*v-m*p)},multiply:ia,translate:function(a,b,c){var d=c[0],e=c[1];c=c[2];if(b===a)a[12]=b[0]*d+b[4]*e+b[8]*c+b[12],a[13]=b[1]*d+b[5]*e+b[9]*c+b[13],a[14]=b[2]*d+b[6]*e+b[10]*c+b[14],a[15]=b[3]*d+b[7]*e+b[11]*c+b[15];else{var f=b[0];var g=b[1];var h=b[2];var k=b[3];var l=b[4];var m=b[5];var n=b[6];var q=b[7];var p=b[8];var v=b[9];var u=b[10];var r=b[11];a[0]=f;a[1]=g;a[2]=h;a[3]=k;a[4]=l;a[5]=m;a[6]=n;a[7]=q;a[8]=p;a[9]=v;a[10]=u;a[11]=r;a[12]=f*d+
  l*e+p*c+b[12];a[13]=g*d+m*e+v*c+b[13];a[14]=h*d+n*e+u*c+b[14];a[15]=k*d+q*e+r*c+b[15]}return a},scale:function(a,b,c){var d=c[0],e=c[1];c=c[2];a[0]=b[0]*d;a[1]=b[1]*d;a[2]=b[2]*d;a[3]=b[3]*d;a[4]=b[4]*e;a[5]=b[5]*e;a[6]=b[6]*e;a[7]=b[7]*e;a[8]=b[8]*c;a[9]=b[9]*c;a[10]=b[10]*c;a[11]=b[11]*c;a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},rotate:function(a,b,c,d){var e=d[0],f=d[1];d=d[2];var g=Math.hypot(e,f,d);if(1E-6>g)return null;g=1/g;e*=g;f*=g;d*=g;var h=Math.sin(c);var k=Math.cos(c);
  var l=1-k;c=b[0];g=b[1];var m=b[2];var n=b[3];var q=b[4];var p=b[5];var v=b[6];var u=b[7];var r=b[8];var t=b[9];var w=b[10];var y=b[11];var z=e*e*l+k;var x=f*e*l+d*h;var A=d*e*l-f*h;var B=e*f*l-d*h;var E=f*f*l+k;var F=d*f*l+e*h;var C=e*d*l+f*h;e=f*d*l-e*h;f=d*d*l+k;a[0]=c*z+q*x+r*A;a[1]=g*z+p*x+t*A;a[2]=m*z+v*x+w*A;a[3]=n*z+u*x+y*A;a[4]=c*B+q*E+r*F;a[5]=g*B+p*E+t*F;a[6]=m*B+v*E+w*F;a[7]=n*B+u*E+y*F;a[8]=c*C+q*e+r*f;a[9]=g*C+p*e+t*f;a[10]=m*C+v*e+w*f;a[11]=n*C+u*e+y*f;b!==a&&(a[12]=b[12],a[13]=b[13],
  a[14]=b[14],a[15]=b[15]);return a},rotateX:function(a,b,c){var d=Math.sin(c);c=Math.cos(c);var e=b[4],f=b[5],g=b[6],h=b[7],k=b[8],l=b[9],m=b[10],n=b[11];b!==a&&(a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]);a[4]=e*c+k*d;a[5]=f*c+l*d;a[6]=g*c+m*d;a[7]=h*c+n*d;a[8]=k*c-e*d;a[9]=l*c-f*d;a[10]=m*c-g*d;a[11]=n*c-h*d;return a},rotateY:function(a,b,c){var d=Math.sin(c);c=Math.cos(c);var e=b[0],f=b[1],g=b[2],h=b[3],k=b[8],l=b[9],m=b[10],n=b[11];b!==a&&(a[4]=b[4],
  a[5]=b[5],a[6]=b[6],a[7]=b[7],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]);a[0]=e*c-k*d;a[1]=f*c-l*d;a[2]=g*c-m*d;a[3]=h*c-n*d;a[8]=e*d+k*c;a[9]=f*d+l*c;a[10]=g*d+m*c;a[11]=h*d+n*c;return a},rotateZ:function(a,b,c){var d=Math.sin(c);c=Math.cos(c);var e=b[0],f=b[1],g=b[2],h=b[3],k=b[4],l=b[5],m=b[6],n=b[7];b!==a&&(a[8]=b[8],a[9]=b[9],a[10]=b[10],a[11]=b[11],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]);a[0]=e*c+k*d;a[1]=f*c+l*d;a[2]=g*c+m*d;a[3]=h*c+n*d;a[4]=k*c-e*d;a[5]=l*c-f*d;a[6]=m*c-g*
  d;a[7]=n*c-h*d;return a},fromTranslation:function(a,b){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=b[0];a[13]=b[1];a[14]=b[2];a[15]=1;return a},fromScaling:function(a,b){a[0]=b[0];a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=b[1];a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=b[2];a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a},fromRotation:function(a,b,c){var d=c[0],e=c[1];c=c[2];var f=Math.hypot(d,e,c);if(1E-6>f)return null;f=1/f;d*=f;e*=f;c*=f;f=Math.sin(b);b=Math.cos(b);
  var g=1-b;a[0]=d*d*g+b;a[1]=e*d*g+c*f;a[2]=c*d*g-e*f;a[3]=0;a[4]=d*e*g-c*f;a[5]=e*e*g+b;a[6]=c*e*g+d*f;a[7]=0;a[8]=d*c*g+e*f;a[9]=e*c*g-d*f;a[10]=c*c*g+b;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a},fromXRotation:function(a,b){var c=Math.sin(b);b=Math.cos(b);a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=b;a[6]=c;a[7]=0;a[8]=0;a[9]=-c;a[10]=b;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a},fromYRotation:function(a,b){var c=Math.sin(b);b=Math.cos(b);a[0]=b;a[1]=0;a[2]=-c;a[3]=0;a[4]=0;a[5]=1;a[6]=
  0;a[7]=0;a[8]=c;a[9]=0;a[10]=b;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a},fromZRotation:function(a,b){var c=Math.sin(b);b=Math.cos(b);a[0]=b;a[1]=c;a[2]=0;a[3]=0;a[4]=-c;a[5]=b;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a},fromRotationTranslation:ja,fromQuat2:function(a,b){var c=new t(3),d=-b[0],e=-b[1],f=-b[2],g=b[3],h=b[4],k=b[5],l=b[6],m=b[7],n=d*d+e*e+f*f+g*g;0<n?(c[0]=2*(h*g+m*d+k*f-l*e)/n,c[1]=2*(k*g+m*e+l*d-h*f)/n,c[2]=2*(l*g+m*f+h*e-k*d)/n):(c[0]=
  2*(h*g+m*d+k*f-l*e),c[1]=2*(k*g+m*e+l*d-h*f),c[2]=2*(l*g+m*f+h*e-k*d));ja(a,b,c);return a},getTranslation:ka,getScaling:la,getRotation:ma,fromRotationTranslationScale:function(a,b,c,d){var e=b[0],f=b[1],g=b[2],h=b[3],k=e+e,l=f+f,m=g+g;b=e*k;var n=e*l;e*=m;var q=f*l;f*=m;g*=m;k*=h;l*=h;h*=m;m=d[0];var p=d[1];d=d[2];a[0]=(1-(q+g))*m;a[1]=(n+h)*m;a[2]=(e-l)*m;a[3]=0;a[4]=(n-h)*p;a[5]=(1-(b+g))*p;a[6]=(f+k)*p;a[7]=0;a[8]=(e+l)*d;a[9]=(f-k)*d;a[10]=(1-(b+q))*d;a[11]=0;a[12]=c[0];a[13]=c[1];a[14]=c[2];
  a[15]=1;return a},fromRotationTranslationScaleOrigin:function(a,b,c,d,e){var f=b[0],g=b[1],h=b[2],k=b[3],l=f+f,m=g+g,n=h+h;b=f*l;var q=f*m,p=f*n;f=g*m;g*=n;var v=h*n;h=k*l;m*=k;var u=k*n,r=d[0],t=d[1];n=d[2];d=e[0];k=e[1];e=e[2];l=(1-(f+v))*r;var w=(q+u)*r;r*=p-m;q=(q-u)*t;v=(1-(b+v))*t;t*=g+h;p=(p+m)*n;g=(g-h)*n;b=(1-(b+f))*n;a[0]=l;a[1]=w;a[2]=r;a[3]=0;a[4]=q;a[5]=v;a[6]=t;a[7]=0;a[8]=p;a[9]=g;a[10]=b;a[11]=0;a[12]=c[0]+d-(l*d+q*k+p*e);a[13]=c[1]+k-(w*d+v*k+g*e);a[14]=c[2]+e-(r*d+t*k+b*e);a[15]=
  1;return a},fromQuat:function(a,b){var c=b[0],d=b[1],e=b[2];b=b[3];var f=c+c,g=d+d,h=e+e;c*=f;var k=d*f;d*=g;var l=e*f,m=e*g;e*=h;f*=b;g*=b;b*=h;a[0]=1-d-e;a[1]=k+b;a[2]=l-g;a[3]=0;a[4]=k-b;a[5]=1-c-e;a[6]=m+f;a[7]=0;a[8]=l+g;a[9]=m-f;a[10]=1-c-d;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a},frustum:function(a,b,c,d,e,f,g){var h=1/(c-b),k=1/(e-d),l=1/(f-g);a[0]=2*f*h;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=2*f*k;a[6]=0;a[7]=0;a[8]=(c+b)*h;a[9]=(e+d)*k;a[10]=(g+f)*l;a[11]=-1;a[12]=0;a[13]=0;a[14]=g*f*
  2*l;a[15]=0;return a},perspective:function(a,b,c,d,e){b=1/Math.tan(b/2);a[0]=b/c;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=b;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[11]=-1;a[12]=0;a[13]=0;a[15]=0;null!=e&&Infinity!==e?(c=1/(d-e),a[10]=(e+d)*c,a[14]=2*e*d*c):(a[10]=-1,a[14]=-2*d);return a},perspectiveFromFieldOfView:function(a,b,c,d){var e=Math.tan(b.upDegrees*Math.PI/180),f=Math.tan(b.downDegrees*Math.PI/180),g=Math.tan(b.leftDegrees*Math.PI/180);b=Math.tan(b.rightDegrees*Math.PI/180);var h=2/(g+b),k=2/(e+f);a[0]=h;
  a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=k;a[6]=0;a[7]=0;a[8]=-((g-b)*h*.5);a[9]=(e-f)*k*.5;a[10]=d/(c-d);a[11]=-1;a[12]=0;a[13]=0;a[14]=d*c/(c-d);a[15]=0;return a},ortho:function(a,b,c,d,e,f,g){var h=1/(b-c),k=1/(d-e),l=1/(f-g);a[0]=-2*h;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=-2*k;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=2*l;a[11]=0;a[12]=(b+c)*h;a[13]=(e+d)*k;a[14]=(g+f)*l;a[15]=1;return a},lookAt:function(a,b,c,d){var e=b[0],f=b[1];b=b[2];var g=d[0];var h=d[1];var k=d[2];var l=c[0];d=c[1];var m=c[2];if(1E-6>Math.abs(e-
  l)&&1E-6>Math.abs(f-d)&&1E-6>Math.abs(b-m))return ha(a);c=e-l;d=f-d;l=b-m;var n=1/Math.hypot(c,d,l);c*=n;d*=n;l*=n;m=h*l-k*d;k=k*c-g*l;g=g*d-h*c;(n=Math.hypot(m,k,g))?(n=1/n,m*=n,k*=n,g*=n):g=k=m=0;h=d*g-l*k;var q=l*m-c*g;var p=c*k-d*m;(n=Math.hypot(h,q,p))?(n=1/n,h*=n,q*=n,p*=n):p=q=h=0;a[0]=m;a[1]=h;a[2]=c;a[3]=0;a[4]=k;a[5]=q;a[6]=d;a[7]=0;a[8]=g;a[9]=p;a[10]=l;a[11]=0;a[12]=-(m*e+k*f+g*b);a[13]=-(h*e+q*f+p*b);a[14]=-(c*e+d*f+l*b);a[15]=1;return a},targetTo:function(a,b,c,d){var e=b[0],f=b[1];
  b=b[2];var g=d[0],h=d[1],k=d[2];d=e-c[0];var l=f-c[1];c=b-c[2];var m=d*d+l*l+c*c;0<m&&(m=1/Math.sqrt(m),d*=m,l*=m,c*=m);var n=h*c-k*l;k=k*d-g*c;g=g*l-h*d;m=n*n+k*k+g*g;0<m&&(m=1/Math.sqrt(m),n*=m,k*=m,g*=m);a[0]=n;a[1]=k;a[2]=g;a[3]=0;a[4]=l*g-c*k;a[5]=c*n-d*g;a[6]=d*k-l*n;a[7]=0;a[8]=d;a[9]=l;a[10]=c;a[11]=0;a[12]=e;a[13]=f;a[14]=b;a[15]=1;return a},str:function(a){return"mat4("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+", "+a[9]+", "+a[10]+", "+a[11]+", "+
  a[12]+", "+a[13]+", "+a[14]+", "+a[15]+")"},frob:function(a){return Math.hypot(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])},add:function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];a[2]=b[2]+c[2];a[3]=b[3]+c[3];a[4]=b[4]+c[4];a[5]=b[5]+c[5];a[6]=b[6]+c[6];a[7]=b[7]+c[7];a[8]=b[8]+c[8];a[9]=b[9]+c[9];a[10]=b[10]+c[10];a[11]=b[11]+c[11];a[12]=b[12]+c[12];a[13]=b[13]+c[13];a[14]=b[14]+c[14];a[15]=b[15]+c[15];return a},subtract:na,multiplyScalar:function(a,b,c){a[0]=
  b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c;a[3]=b[3]*c;a[4]=b[4]*c;a[5]=b[5]*c;a[6]=b[6]*c;a[7]=b[7]*c;a[8]=b[8]*c;a[9]=b[9]*c;a[10]=b[10]*c;a[11]=b[11]*c;a[12]=b[12]*c;a[13]=b[13]*c;a[14]=b[14]*c;a[15]=b[15]*c;return a},multiplyScalarAndAdd:function(a,b,c,d){a[0]=b[0]+c[0]*d;a[1]=b[1]+c[1]*d;a[2]=b[2]+c[2]*d;a[3]=b[3]+c[3]*d;a[4]=b[4]+c[4]*d;a[5]=b[5]+c[5]*d;a[6]=b[6]+c[6]*d;a[7]=b[7]+c[7]*d;a[8]=b[8]+c[8]*d;a[9]=b[9]+c[9]*d;a[10]=b[10]+c[10]*d;a[11]=b[11]+c[11]*d;a[12]=b[12]+c[12]*d;a[13]=b[13]+c[13]*d;a[14]=
  b[14]+c[14]*d;a[15]=b[15]+c[15]*d;return a},exactEquals:function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&a[6]===b[6]&&a[7]===b[7]&&a[8]===b[8]&&a[9]===b[9]&&a[10]===b[10]&&a[11]===b[11]&&a[12]===b[12]&&a[13]===b[13]&&a[14]===b[14]&&a[15]===b[15]},equals:function(a,b){var c=a[0],d=a[1],e=a[2],f=a[3],g=a[4],h=a[5],k=a[6],l=a[7],m=a[8],n=a[9],q=a[10],p=a[11],t=a[12],u=a[13],r=a[14];a=a[15];var A=b[0],w=b[1],y=b[2],z=b[3],x=b[4],B=b[5],C=b[6],E=b[7],F=
  b[8],G=b[9],H=b[10],K=b[11],D=b[12],L=b[13],M=b[14];b=b[15];return Math.abs(c-A)<=1E-6*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(d-w)<=1E-6*Math.max(1,Math.abs(d),Math.abs(w))&&Math.abs(e-y)<=1E-6*Math.max(1,Math.abs(e),Math.abs(y))&&Math.abs(f-z)<=1E-6*Math.max(1,Math.abs(f),Math.abs(z))&&Math.abs(g-x)<=1E-6*Math.max(1,Math.abs(g),Math.abs(x))&&Math.abs(h-B)<=1E-6*Math.max(1,Math.abs(h),Math.abs(B))&&Math.abs(k-C)<=1E-6*Math.max(1,Math.abs(k),Math.abs(C))&&Math.abs(l-E)<=1E-6*Math.max(1,Math.abs(l),
  Math.abs(E))&&Math.abs(m-F)<=1E-6*Math.max(1,Math.abs(m),Math.abs(F))&&Math.abs(n-G)<=1E-6*Math.max(1,Math.abs(n),Math.abs(G))&&Math.abs(q-H)<=1E-6*Math.max(1,Math.abs(q),Math.abs(H))&&Math.abs(p-K)<=1E-6*Math.max(1,Math.abs(p),Math.abs(K))&&Math.abs(t-D)<=1E-6*Math.max(1,Math.abs(t),Math.abs(D))&&Math.abs(u-L)<=1E-6*Math.max(1,Math.abs(u),Math.abs(L))&&Math.abs(r-M)<=1E-6*Math.max(1,Math.abs(r),Math.abs(M))&&Math.abs(a-b)<=1E-6*Math.max(1,Math.abs(a),Math.abs(b))},mul:ia,sub:na}),W=function(){var a=
  R();return function(b,c,d,e,f,g){c||(c=3);d||(d=0);for(e=e?Math.min(e*c+d,b.length):b.length;d<e;d+=c)a[0]=b[d],a[1]=b[d+1],a[2]=b[d+2],f(a,a,g),b[d]=a[0],b[d+1]=a[1],b[d+2]=a[2];return b}}();W=Object.freeze({__proto__:null,create:R,clone:function(a){var b=new t(3);b[0]=a[0];b[1]=a[1];b[2]=a[2];return b},length:S,fromValues:T,copy:function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];return a},set:function(a,b,c,d){a[0]=b;a[1]=c;a[2]=d;return a},add:function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];a[2]=b[2]+c[2];
  return a},subtract:oa,multiply:pa,divide:qa,ceil:function(a,b){a[0]=Math.ceil(b[0]);a[1]=Math.ceil(b[1]);a[2]=Math.ceil(b[2]);return a},floor:function(a,b){a[0]=Math.floor(b[0]);a[1]=Math.floor(b[1]);a[2]=Math.floor(b[2]);return a},min:function(a,b,c){a[0]=Math.min(b[0],c[0]);a[1]=Math.min(b[1],c[1]);a[2]=Math.min(b[2],c[2]);return a},max:function(a,b,c){a[0]=Math.max(b[0],c[0]);a[1]=Math.max(b[1],c[1]);a[2]=Math.max(b[2],c[2]);return a},round:function(a,b){a[0]=Math.round(b[0]);a[1]=Math.round(b[1]);
  a[2]=Math.round(b[2]);return a},scale:function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c;return a},scaleAndAdd:function(a,b,c,d){a[0]=b[0]+c[0]*d;a[1]=b[1]+c[1]*d;a[2]=b[2]+c[2]*d;return a},distance:ra,squaredDistance:sa,squaredLength:ta,negate:function(a,b){a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];return a},inverse:function(a,b){a[0]=1/b[0];a[1]=1/b[1];a[2]=1/b[2];return a},normalize:ua,dot:U,cross:M,lerp:function(a,b,c,d){var e=b[0],f=b[1];b=b[2];a[0]=e+d*(c[0]-e);a[1]=f+d*(c[1]-f);a[2]=b+d*(c[2]-b);return a},
  hermite:function(a,b,c,d,e,f){var g=f*f,h=g*(2*f-3)+1,k=g*(f-2)+f,l=g*(f-1);f=g*(3-2*f);a[0]=b[0]*h+c[0]*k+d[0]*l+e[0]*f;a[1]=b[1]*h+c[1]*k+d[1]*l+e[1]*f;a[2]=b[2]*h+c[2]*k+d[2]*l+e[2]*f;return a},bezier:function(a,b,c,d,e,f){var g=1-f,h=g*g,k=f*f,l=h*g;h*=3*f;g*=3*k;f*=k;a[0]=b[0]*l+c[0]*h+d[0]*g+e[0]*f;a[1]=b[1]*l+c[1]*h+d[1]*g+e[1]*f;a[2]=b[2]*l+c[2]*h+d[2]*g+e[2]*f;return a},random:function(a,b){b=b||1;var c=2*B()*Math.PI,d=2*B()-1,e=Math.sqrt(1-d*d)*b;a[0]=Math.cos(c)*e;a[1]=Math.sin(c)*e;a[2]=
  d*b;return a},transformMat4:function(a,b,c){var d=b[0],e=b[1];b=b[2];var f=c[3]*d+c[7]*e+c[11]*b+c[15];f=f||1;a[0]=(c[0]*d+c[4]*e+c[8]*b+c[12])/f;a[1]=(c[1]*d+c[5]*e+c[9]*b+c[13])/f;a[2]=(c[2]*d+c[6]*e+c[10]*b+c[14])/f;return a},transformMat3:function(a,b,c){var d=b[0],e=b[1];b=b[2];a[0]=d*c[0]+e*c[3]+b*c[6];a[1]=d*c[1]+e*c[4]+b*c[7];a[2]=d*c[2]+e*c[5]+b*c[8];return a},transformQuat:function(a,b,c){var d=c[0],e=c[1],f=c[2],g=b[0],h=b[1];b=b[2];var k=e*b-f*h,l=f*g-d*b,m=d*h-e*g;c=2*c[3];a[0]=g+k*c+
  2*(e*m-f*l);a[1]=h+l*c+2*(f*k-d*m);a[2]=b+m*c+2*(d*l-e*k);return a},rotateX:function(a,b,c,d){var e=[],f=[];e[0]=b[0]-c[0];e[1]=b[1]-c[1];e[2]=b[2]-c[2];f[0]=e[0];f[1]=e[1]*Math.cos(d)-e[2]*Math.sin(d);f[2]=e[1]*Math.sin(d)+e[2]*Math.cos(d);a[0]=f[0]+c[0];a[1]=f[1]+c[1];a[2]=f[2]+c[2];return a},rotateY:function(a,b,c,d){var e=[],f=[];e[0]=b[0]-c[0];e[1]=b[1]-c[1];e[2]=b[2]-c[2];f[0]=e[2]*Math.sin(d)+e[0]*Math.cos(d);f[1]=e[1];f[2]=e[2]*Math.cos(d)-e[0]*Math.sin(d);a[0]=f[0]+c[0];a[1]=f[1]+c[1];a[2]=
  f[2]+c[2];return a},rotateZ:function(a,b,c,d){var e=[],f=[];e[0]=b[0]-c[0];e[1]=b[1]-c[1];e[2]=b[2]-c[2];f[0]=e[0]*Math.cos(d)-e[1]*Math.sin(d);f[1]=e[0]*Math.sin(d)+e[1]*Math.cos(d);f[2]=e[2];a[0]=f[0]+c[0];a[1]=f[1]+c[1];a[2]=f[2]+c[2];return a},angle:function(a,b){var c=a[0],d=a[1],e=a[2],f=b[0],g=b[1],h=b[2];a=(c=Math.sqrt(c*c+d*d+e*e)*Math.sqrt(f*f+g*g+h*h))&&U(a,b)/c;return Math.acos(Math.min(Math.max(a,-1),1))},zero:function(a){a[0]=0;a[1]=0;a[2]=0;return a},str:function(a){return"vec3("+a[0]+
  ", "+a[1]+", "+a[2]+")"},exactEquals:function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]},equals:function(a,b){var c=a[0],d=a[1];a=a[2];var e=b[0],f=b[1];b=b[2];return Math.abs(c-e)<=1E-6*Math.max(1,Math.abs(c),Math.abs(e))&&Math.abs(d-f)<=1E-6*Math.max(1,Math.abs(d),Math.abs(f))&&Math.abs(a-b)<=1E-6*Math.max(1,Math.abs(a),Math.abs(b))},sub:oa,mul:pa,div:qa,dist:ra,sqrDist:sa,len:S,sqrLen:ta,forEach:W});var X=function(){var a=va();return function(b,c,d,e,f,g){c||(c=4);d||(d=0);for(e=e?Math.min(e*
  c+d,b.length):b.length;d<e;d+=c)a[0]=b[d],a[1]=b[d+1],a[2]=b[d+2],a[3]=b[d+3],f(a,a,g),b[d]=a[0],b[d+1]=a[1],b[d+2]=a[2],b[d+3]=a[3];return b}}();X=Object.freeze({__proto__:null,create:va,clone:wa,fromValues:xa,copy:N,set:ya,add:za,subtract:Aa,multiply:Ba,divide:Ca,ceil:function(a,b){a[0]=Math.ceil(b[0]);a[1]=Math.ceil(b[1]);a[2]=Math.ceil(b[2]);a[3]=Math.ceil(b[3]);return a},floor:function(a,b){a[0]=Math.floor(b[0]);a[1]=Math.floor(b[1]);a[2]=Math.floor(b[2]);a[3]=Math.floor(b[3]);return a},min:function(a,
  b,c){a[0]=Math.min(b[0],c[0]);a[1]=Math.min(b[1],c[1]);a[2]=Math.min(b[2],c[2]);a[3]=Math.min(b[3],c[3]);return a},max:function(a,b,c){a[0]=Math.max(b[0],c[0]);a[1]=Math.max(b[1],c[1]);a[2]=Math.max(b[2],c[2]);a[3]=Math.max(b[3],c[3]);return a},round:function(a,b){a[0]=Math.round(b[0]);a[1]=Math.round(b[1]);a[2]=Math.round(b[2]);a[3]=Math.round(b[3]);return a},scale:V,scaleAndAdd:function(a,b,c,d){a[0]=b[0]+c[0]*d;a[1]=b[1]+c[1]*d;a[2]=b[2]+c[2]*d;a[3]=b[3]+c[3]*d;return a},distance:Da,squaredDistance:Ea,
  length:H,squaredLength:C,negate:function(a,b){a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];a[3]=-b[3];return a},inverse:function(a,b){a[0]=1/b[0];a[1]=1/b[1];a[2]=1/b[2];a[3]=1/b[3];return a},normalize:O,dot:K,cross:function(a,b,c,d){var e=c[0]*d[1]-c[1]*d[0],f=c[0]*d[2]-c[2]*d[0],g=c[0]*d[3]-c[3]*d[0],h=c[1]*d[2]-c[2]*d[1],k=c[1]*d[3]-c[3]*d[1];c=c[2]*d[3]-c[3]*d[2];d=b[0];var l=b[1],m=b[2];b=b[3];a[0]=l*c-m*k+b*h;a[1]=-(d*c)+m*g-b*f;a[2]=d*k-l*g+b*e;a[3]=-(d*h)+l*f-m*e;return a},lerp:Fa,random:function(a,b){b=
  b||1;do{var c=2*B()-1;var d=2*B()-1;var e=c*c+d*d}while(1<=e);do{var f=2*B()-1;var g=2*B()-1;var h=f*f+g*g}while(1<=h);e=Math.sqrt((1-e)/h);a[0]=b*c;a[1]=b*d;a[2]=b*f*e;a[3]=b*g*e;return a},transformMat4:function(a,b,c){var d=b[0],e=b[1],f=b[2];b=b[3];a[0]=c[0]*d+c[4]*e+c[8]*f+c[12]*b;a[1]=c[1]*d+c[5]*e+c[9]*f+c[13]*b;a[2]=c[2]*d+c[6]*e+c[10]*f+c[14]*b;a[3]=c[3]*d+c[7]*e+c[11]*f+c[15]*b;return a},transformQuat:function(a,b,c){var d=b[0],e=b[1],f=b[2],g=c[0],h=c[1],k=c[2];c=c[3];var l=c*d+h*f-k*e,
  m=c*e+k*d-g*f,n=c*f+g*e-h*d;d=-g*d-h*e-k*f;a[0]=l*c+d*-g+m*-k-n*-h;a[1]=m*c+d*-h+n*-g-l*-k;a[2]=n*c+d*-k+l*-h-m*-g;a[3]=b[3];return a},zero:function(a){a[0]=0;a[1]=0;a[2]=0;a[3]=0;return a},str:function(a){return"vec4("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"},exactEquals:Ga,equals:Ha,sub:Aa,mul:Ba,div:Ca,dist:Da,sqrDist:Ea,len:H,sqrLen:C,forEach:X});var Y=function(){var a=R(),b=T(1,0,0),c=T(0,1,0);return function(d,e,f){var g=U(e,f);if(-.999999>g)return M(a,b,e),1E-6>S(a)&&M(a,c,e),ua(a,a),Ia(d,a,
  Math.PI),d;if(.999999<g)return d[0]=0,d[1]=0,d[2]=0,d[3]=1,d;M(a,e,f);d[0]=a[0];d[1]=a[1];d[2]=a[2];d[3]=1+g;return O(d,d)}}(),Z=function(){var a=P(),b=P();return function(c,d,e,f,g,h){Q(a,d,g,h);Q(b,e,f,h);Q(c,a,b,2*h*(1-h));return c}}(),L=function(){var a=da();return function(b,c,d,e){a[0]=d[0];a[3]=d[1];a[6]=d[2];a[1]=e[0];a[4]=e[1];a[7]=e[2];a[2]=-c[0];a[5]=-c[1];a[8]=-c[2];return O(b,Pa(b,a))}}();Y=Object.freeze({__proto__:null,create:P,identity:function(a){a[0]=0;a[1]=0;a[2]=0;a[3]=1;return a},
  setAxisAngle:Ia,getAxisAngle:function(a,b){var c=2*Math.acos(b[3]),d=Math.sin(c/2);1E-6<d?(a[0]=b[0]/d,a[1]=b[1]/d,a[2]=b[2]/d):(a[0]=1,a[1]=0,a[2]=0);return c},getAngle:function(a,b){a=K(a,b);return Math.acos(2*a*a-1)},multiply:Ja,rotateX:Ka,rotateY:La,rotateZ:Ma,calculateW:function(a,b){var c=b[0],d=b[1];b=b[2];a[0]=c;a[1]=d;a[2]=b;a[3]=Math.sqrt(Math.abs(1-c*c-d*d-b*b));return a},exp:Na,ln:Oa,pow:function(a,b,c){Oa(a,b);V(a,a,c);Na(a,a);return a},slerp:Q,random:function(a){var b=B(),c=B(),d=B(),
  e=Math.sqrt(1-b);b=Math.sqrt(b);a[0]=e*Math.sin(2*Math.PI*c);a[1]=e*Math.cos(2*Math.PI*c);a[2]=b*Math.sin(2*Math.PI*d);a[3]=b*Math.cos(2*Math.PI*d);return a},invert:function(a,b){var c=b[0],d=b[1],e=b[2];b=b[3];var f=c*c+d*d+e*e+b*b;f=f?1/f:0;a[0]=-c*f;a[1]=-d*f;a[2]=-e*f;a[3]=b*f;return a},conjugate:function(a,b){a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];a[3]=b[3];return a},fromMat3:Pa,fromEuler:function(a,b,c,d){var e=.5*Math.PI/180;b*=e;c*=e;d*=e;e=Math.sin(b);b=Math.cos(b);var f=Math.sin(c);c=Math.cos(c);
  var g=Math.sin(d);d=Math.cos(d);a[0]=e*c*d-b*f*g;a[1]=b*f*d+e*c*g;a[2]=b*c*g-e*f*d;a[3]=b*c*d+e*f*g;return a},str:function(a){return"quat("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"},clone:wa,fromValues:xa,copy:N,set:ya,add:za,mul:Ja,scale:V,dot:K,lerp:Fa,length:H,len:H,squaredLength:C,sqrLen:C,normalize:O,exactEquals:Ga,equals:Ha,rotationTo:Y,sqlerp:Z,setAxes:L});Z=Object.freeze({__proto__:null,create:function(){var a=new t(8);t!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0,a[4]=0,a[5]=0,a[6]=0,a[7]=0);a[3]=
  1;return a},clone:function(a){var b=new t(8);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];return b},fromValues:function(a,b,c,d,e,f,g,h){var k=new t(8);k[0]=a;k[1]=b;k[2]=c;k[3]=d;k[4]=e;k[5]=f;k[6]=g;k[7]=h;return k},fromRotationTranslationValues:function(a,b,c,d,e,f,g){var h=new t(8);h[0]=a;h[1]=b;h[2]=c;h[3]=d;e*=.5;f*=.5;g*=.5;h[4]=e*d+f*c-g*b;h[5]=f*d+g*a-e*c;h[6]=g*d+e*b-f*a;h[7]=-e*a-f*b-g*c;return h},fromRotationTranslation:Qa,fromTranslation:function(a,
  b){a[0]=0;a[1]=0;a[2]=0;a[3]=1;a[4]=.5*b[0];a[5]=.5*b[1];a[6]=.5*b[2];a[7]=0;return a},fromRotation:function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=0;a[5]=0;a[6]=0;a[7]=0;return a},fromMat4:function(a,b){var c=P();ma(c,b);var d=new t(3);ka(d,b);Qa(a,c,d);return a},copy:Ra,identity:function(a){a[0]=0;a[1]=0;a[2]=0;a[3]=1;a[4]=0;a[5]=0;a[6]=0;a[7]=0;return a},set:function(a,b,c,d,e,f,g,h,k){a[0]=b;a[1]=c;a[2]=d;a[3]=e;a[4]=f;a[5]=g;a[6]=h;a[7]=k;return a},getReal:N,getDual:function(a,b){a[0]=
  b[4];a[1]=b[5];a[2]=b[6];a[3]=b[7];return a},setReal:N,setDual:function(a,b){a[4]=b[0];a[5]=b[1];a[6]=b[2];a[7]=b[3];return a},getTranslation:function(a,b){var c=b[4],d=b[5],e=b[6],f=b[7],g=-b[0],h=-b[1],k=-b[2];b=b[3];a[0]=2*(c*b+f*g+d*k-e*h);a[1]=2*(d*b+f*h+e*g-c*k);a[2]=2*(e*b+f*k+c*h-d*g);return a},translate:function(a,b,c){var d=b[0],e=b[1],f=b[2],g=b[3],h=.5*c[0],k=.5*c[1];c=.5*c[2];var l=b[4],m=b[5],n=b[6];b=b[7];a[0]=d;a[1]=e;a[2]=f;a[3]=g;a[4]=g*h+e*c-f*k+l;a[5]=g*k+f*h-d*c+m;a[6]=g*c+d*
  k-e*h+n;a[7]=-d*h-e*k-f*c+b;return a},rotateX:function(a,b,c){var d=-b[0],e=-b[1],f=-b[2],g=b[3],h=b[4],k=b[5],l=b[6],m=b[7],n=h*g+m*d+k*f-l*e,q=k*g+m*e+l*d-h*f,p=l*g+m*f+h*e-k*d;h=m*g-h*d-k*e-l*f;Ka(a,b,c);d=a[0];e=a[1];f=a[2];g=a[3];a[4]=n*g+h*d+q*f-p*e;a[5]=q*g+h*e+p*d-n*f;a[6]=p*g+h*f+n*e-q*d;a[7]=h*g-n*d-q*e-p*f;return a},rotateY:function(a,b,c){var d=-b[0],e=-b[1],f=-b[2],g=b[3],h=b[4],k=b[5],l=b[6],m=b[7],n=h*g+m*d+k*f-l*e,q=k*g+m*e+l*d-h*f,p=l*g+m*f+h*e-k*d;h=m*g-h*d-k*e-l*f;La(a,b,c);d=a[0];
  e=a[1];f=a[2];g=a[3];a[4]=n*g+h*d+q*f-p*e;a[5]=q*g+h*e+p*d-n*f;a[6]=p*g+h*f+n*e-q*d;a[7]=h*g-n*d-q*e-p*f;return a},rotateZ:function(a,b,c){var d=-b[0],e=-b[1],f=-b[2],g=b[3],h=b[4],k=b[5],l=b[6],m=b[7],n=h*g+m*d+k*f-l*e,q=k*g+m*e+l*d-h*f,p=l*g+m*f+h*e-k*d;h=m*g-h*d-k*e-l*f;Ma(a,b,c);d=a[0];e=a[1];f=a[2];g=a[3];a[4]=n*g+h*d+q*f-p*e;a[5]=q*g+h*e+p*d-n*f;a[6]=p*g+h*f+n*e-q*d;a[7]=h*g-n*d-q*e-p*f;return a},rotateByQuatAppend:function(a,b,c){var d=c[0],e=c[1],f=c[2];c=c[3];var g=b[0],h=b[1],k=b[2],l=b[3];
  a[0]=g*c+l*d+h*f-k*e;a[1]=h*c+l*e+k*d-g*f;a[2]=k*c+l*f+g*e-h*d;a[3]=l*c-g*d-h*e-k*f;g=b[4];h=b[5];k=b[6];l=b[7];a[4]=g*c+l*d+h*f-k*e;a[5]=h*c+l*e+k*d-g*f;a[6]=k*c+l*f+g*e-h*d;a[7]=l*c-g*d-h*e-k*f;return a},rotateByQuatPrepend:function(a,b,c){var d=b[0],e=b[1],f=b[2];b=b[3];var g=c[0],h=c[1],k=c[2],l=c[3];a[0]=d*l+b*g+e*k-f*h;a[1]=e*l+b*h+f*g-d*k;a[2]=f*l+b*k+d*h-e*g;a[3]=b*l-d*g-e*h-f*k;g=c[4];h=c[5];k=c[6];l=c[7];a[4]=d*l+b*g+e*k-f*h;a[5]=e*l+b*h+f*g-d*k;a[6]=f*l+b*k+d*h-e*g;a[7]=b*l-d*g-e*h-f*k;
  return a},rotateAroundAxis:function(a,b,c,d){if(1E-6>Math.abs(d))return Ra(a,b);var e=Math.hypot(c[0],c[1],c[2]);d*=.5;var f=Math.sin(d),g=f*c[0]/e,h=f*c[1]/e;c=f*c[2]/e;d=Math.cos(d);e=b[0];f=b[1];var k=b[2],l=b[3];a[0]=e*d+l*g+f*c-k*h;a[1]=f*d+l*h+k*g-e*c;a[2]=k*d+l*c+e*h-f*g;a[3]=l*d-e*g-f*h-k*c;e=b[4];f=b[5];k=b[6];b=b[7];a[4]=e*d+b*g+f*c-k*h;a[5]=f*d+b*h+k*g-e*c;a[6]=k*d+b*c+e*h-f*g;a[7]=b*d-e*g-f*h-k*c;return a},add:function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];a[2]=b[2]+c[2];a[3]=b[3]+c[3];
  a[4]=b[4]+c[4];a[5]=b[5]+c[5];a[6]=b[6]+c[6];a[7]=b[7]+c[7];return a},multiply:Sa,mul:Sa,scale:function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c;a[3]=b[3]*c;a[4]=b[4]*c;a[5]=b[5]*c;a[6]=b[6]*c;a[7]=b[7]*c;return a},dot:K,lerp:function(a,b,c,d){var e=1-d;0>K(b,c)&&(d=-d);a[0]=b[0]*e+c[0]*d;a[1]=b[1]*e+c[1]*d;a[2]=b[2]*e+c[2]*d;a[3]=b[3]*e+c[3]*d;a[4]=b[4]*e+c[4]*d;a[5]=b[5]*e+c[5]*d;a[6]=b[6]*e+c[6]*d;a[7]=b[7]*e+c[7]*d;return a},invert:function(a,b){var c=C(b);a[0]=-b[0]/c;a[1]=-b[1]/c;a[2]=-b[2]/
  c;a[3]=b[3]/c;a[4]=-b[4]/c;a[5]=-b[5]/c;a[6]=-b[6]/c;a[7]=b[7]/c;return a},conjugate:function(a,b){a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];a[3]=b[3];a[4]=-b[4];a[5]=-b[5];a[6]=-b[6];a[7]=b[7];return a},length:H,len:H,squaredLength:C,sqrLen:C,normalize:function(a,b){var c=C(b);if(0<c){c=Math.sqrt(c);var d=b[0]/c,e=b[1]/c,f=b[2]/c,g=b[3]/c,h=b[4],k=b[5],l=b[6];b=b[7];var m=d*h+e*k+f*l+g*b;a[0]=d;a[1]=e;a[2]=f;a[3]=g;a[4]=(h-d*m)/c;a[5]=(k-e*m)/c;a[6]=(l-f*m)/c;a[7]=(b-g*m)/c}return a},str:function(a){return"quat2("+
  a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+")"},exactEquals:function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&a[6]===b[6]&&a[7]===b[7]},equals:function(a,b){var c=a[0],d=a[1],e=a[2],f=a[3],g=a[4],h=a[5],k=a[6];a=a[7];var l=b[0],m=b[1],n=b[2],q=b[3],p=b[4],t=b[5],u=b[6];b=b[7];return Math.abs(c-l)<=1E-6*Math.max(1,Math.abs(c),Math.abs(l))&&Math.abs(d-m)<=1E-6*Math.max(1,Math.abs(d),Math.abs(m))&&Math.abs(e-n)<=1E-6*Math.max(1,
  Math.abs(e),Math.abs(n))&&Math.abs(f-q)<=1E-6*Math.max(1,Math.abs(f),Math.abs(q))&&Math.abs(g-p)<=1E-6*Math.max(1,Math.abs(g),Math.abs(p))&&Math.abs(h-t)<=1E-6*Math.max(1,Math.abs(h),Math.abs(t))&&Math.abs(k-u)<=1E-6*Math.max(1,Math.abs(k),Math.abs(u))&&Math.abs(a-b)<=1E-6*Math.max(1,Math.abs(a),Math.abs(b))}});L=function(){var a=Ta();return function(b,c,d,e,f,g){c||(c=2);d||(d=0);for(e=e?Math.min(e*c+d,b.length):b.length;d<e;d+=c)a[0]=b[d],a[1]=b[d+1],f(a,a,g),b[d]=a[0],b[d+1]=a[1];return b}}();
  L=Object.freeze({__proto__:null,create:Ta,clone:function(a){var b=new t(2);b[0]=a[0];b[1]=a[1];return b},fromValues:function(a,b){var c=new t(2);c[0]=a;c[1]=b;return c},copy:function(a,b){a[0]=b[0];a[1]=b[1];return a},set:function(a,b,c){a[0]=b;a[1]=c;return a},add:function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];return a},subtract:Ua,multiply:Va,divide:Wa,ceil:function(a,b){a[0]=Math.ceil(b[0]);a[1]=Math.ceil(b[1]);return a},floor:function(a,b){a[0]=Math.floor(b[0]);a[1]=Math.floor(b[1]);return a},
  min:function(a,b,c){a[0]=Math.min(b[0],c[0]);a[1]=Math.min(b[1],c[1]);return a},max:function(a,b,c){a[0]=Math.max(b[0],c[0]);a[1]=Math.max(b[1],c[1]);return a},round:function(a,b){a[0]=Math.round(b[0]);a[1]=Math.round(b[1]);return a},scale:function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;return a},scaleAndAdd:function(a,b,c,d){a[0]=b[0]+c[0]*d;a[1]=b[1]+c[1]*d;return a},distance:Xa,squaredDistance:Ya,length:Za,squaredLength:$a,negate:function(a,b){a[0]=-b[0];a[1]=-b[1];return a},inverse:function(a,b){a[0]=
  1/b[0];a[1]=1/b[1];return a},normalize:function(a,b){var c=b[0],d=b[1];c=c*c+d*d;0<c&&(c=1/Math.sqrt(c));a[0]=b[0]*c;a[1]=b[1]*c;return a},dot:function(a,b){return a[0]*b[0]+a[1]*b[1]},cross:function(a,b,c){b=b[0]*c[1]-b[1]*c[0];a[0]=a[1]=0;a[2]=b;return a},lerp:function(a,b,c,d){var e=b[0];b=b[1];a[0]=e+d*(c[0]-e);a[1]=b+d*(c[1]-b);return a},random:function(a,b){b=b||1;var c=2*B()*Math.PI;a[0]=Math.cos(c)*b;a[1]=Math.sin(c)*b;return a},transformMat2:function(a,b,c){var d=b[0];b=b[1];a[0]=c[0]*d+
  c[2]*b;a[1]=c[1]*d+c[3]*b;return a},transformMat2d:function(a,b,c){var d=b[0];b=b[1];a[0]=c[0]*d+c[2]*b+c[4];a[1]=c[1]*d+c[3]*b+c[5];return a},transformMat3:function(a,b,c){var d=b[0];b=b[1];a[0]=c[0]*d+c[3]*b+c[6];a[1]=c[1]*d+c[4]*b+c[7];return a},transformMat4:function(a,b,c){var d=b[0];b=b[1];a[0]=c[0]*d+c[4]*b+c[12];a[1]=c[1]*d+c[5]*b+c[13];return a},rotate:function(a,b,c,d){var e=b[0]-c[0];b=b[1]-c[1];var f=Math.sin(d);d=Math.cos(d);a[0]=e*d-b*f+c[0];a[1]=e*f+b*d+c[1];return a},angle:function(a,
  b){var c=a[0];a=a[1];var d=b[0];b=b[1];var e=Math.sqrt(c*c+a*a)*Math.sqrt(d*d+b*b);return Math.acos(Math.min(Math.max(e&&(c*d+a*b)/e,-1),1))},zero:function(a){a[0]=0;a[1]=0;return a},str:function(a){return"vec2("+a[0]+", "+a[1]+")"},exactEquals:function(a,b){return a[0]===b[0]&&a[1]===b[1]},equals:function(a,b){var c=a[0];a=a[1];var d=b[0];b=b[1];return Math.abs(c-d)<=1E-6*Math.max(1,Math.abs(c),Math.abs(d))&&Math.abs(a-b)<=1E-6*Math.max(1,Math.abs(a),Math.abs(b))},len:Za,sub:Ua,mul:Va,div:Wa,dist:Xa,
  sqrDist:Ya,sqrLen:$a,forEach:L});A.glMatrix=bb;A.mat2=cb;A.mat2d=db;A.mat3=eb;A.mat4=fb;A.quat=Y;A.quat2=Z;A.vec2=L;A.vec3=W;A.vec4=X;Object.defineProperty(A,"__esModule",{value:!0})});
  
  
  // c3/3rdparty/poly-decomp.js
  'use strict';var points_eq=function(a,b,c){return scalar_eq(a[0],b[0],c)&&scalar_eq(a[1],b[1],c)},scalar_eq=function(a,b,c){return Math.abs(a-b)<=(c||0)},polygonRemoveDuplicatePoints=function(a,b){for(var c=a.length-1;1<=c;--c)for(var d=a[c],e=c-1;0<=e;--e)points_eq(d,a[e],b)&&a.splice(c,1)},polygonRemoveCollinearPoints=function(a,b){for(var c=0,d=a.length-1;3<a.length&&0<=d;--d)collinear(polygonAt(a,d-1),polygonAt(a,d),polygonAt(a,d+1),b)&&(a.splice(d%a.length,1),c++);return c},polygonQuickDecomp=
  function(a,b,c,d,e,g,h){g=g||100;h=h||0;e=e||25;b="undefined"!==typeof b?b:[];c=c||[];d=d||[];var k=[0,0],n=[0,0],m=[0,0],w,r=0,t=0,v=0,p=[],q=[];if(3>a.length)return b;h++;if(h>g)return console.warn("quickDecomp: max level ("+g+") reached."),b;for(var f=0;f<a.length;++f)if(polygonIsReflex(a,f)){c.push(a[f]);var x=w=Number.MAX_VALUE;for(var l=0;l<a.length;++l){if(isLeft(polygonAt(a,f-1),polygonAt(a,f),polygonAt(a,l))&&isRightOn(polygonAt(a,f-1),polygonAt(a,f),polygonAt(a,l-1))&&(m=getIntersectionPoint(polygonAt(a,
  f-1),polygonAt(a,f),polygonAt(a,l),polygonAt(a,l-1)),isRight(polygonAt(a,f+1),polygonAt(a,f),m))){var u=sqdist(a[f],m);u<w&&(w=u,n=m,t=l)}isLeft(polygonAt(a,f+1),polygonAt(a,f),polygonAt(a,l+1))&&isRightOn(polygonAt(a,f+1),polygonAt(a,f),polygonAt(a,l))&&(m=getIntersectionPoint(polygonAt(a,f+1),polygonAt(a,f),polygonAt(a,l),polygonAt(a,l+1)),isLeft(polygonAt(a,f-1),polygonAt(a,f),m)&&(u=sqdist(a[f],m),u<x&&(x=u,k=m,r=l)))}if(t===(r+1)%a.length)m[0]=(n[0]+k[0])/2,m[1]=(n[1]+k[1])/2,d.push(m),f<r?(polygonAppend(p,
  a,f,r+1),p.push(m),q.push(m),0!==t&&polygonAppend(q,a,t,a.length),polygonAppend(q,a,0,f+1)):(0!==f&&polygonAppend(p,a,f,a.length),polygonAppend(p,a,0,r+1),p.push(m),q.push(m),polygonAppend(q,a,t,f+1));else{t>r&&(r+=a.length);k=Number.MAX_VALUE;if(r<t)return b;for(l=t;l<=r;++l)isLeftOn(polygonAt(a,f-1),polygonAt(a,f),polygonAt(a,l))&&isRightOn(polygonAt(a,f+1),polygonAt(a,f),polygonAt(a,l))&&(u=sqdist(polygonAt(a,f),polygonAt(a,l)),u<k&&polygonCanSee2(a,f,l)&&(k=u,v=l%a.length));f<v?(polygonAppend(p,
  a,f,v+1),0!==v&&polygonAppend(q,a,v,a.length),polygonAppend(q,a,0,f+1)):(0!==f&&polygonAppend(p,a,f,a.length),polygonAppend(p,a,0,v+1),polygonAppend(q,a,v,f+1))}p.length<q.length?(polygonQuickDecomp(p,b,c,d,e,g,h),polygonQuickDecomp(q,b,c,d,e,g,h)):(polygonQuickDecomp(q,b,c,d,e,g,h),polygonQuickDecomp(p,b,c,d,e,g,h));return b}b.push(a);return b},getIntersectionPoint=function(a,b,c,d,e){var g=b[1]-a[1];b=a[0]-b[0];a=g*a[0]+b*a[1];var h=d[1]-c[1];d=c[0]-d[0];c=h*c[0]+d*c[1];var k=g*d-h*b;return scalar_eq(k,
  0,e||0)?[0,0]:[(d*a-b*c)/k,(g*c-h*a)/k]},polygonIsSimple=function(a){var b;for(b=0;b<a.length-1;b++)for(var c=0;c<b-1;c++)if(lineSegmentsIntersect(a[b],a[b+1],a[c],a[c+1]))return!1;for(b=1;b<a.length-2;b++)if(lineSegmentsIntersect(a[0],a[a.length-1],a[b],a[b+1]))return!1;return!0},polygonSlice=function(a,b){if(0===b.length)return[a];if(b instanceof Array&&b.length&&b[0]instanceof Array&&2===b[0].length&&b[0][0]instanceof Array){a=[a];for(var c=0;c<b.length;c++)for(var d=b[c],e=0;e<a.length;e++){var g=
  polygonSlice(a[e],d);if(g){a.splice(e,1);a.push(g[0],g[1]);break}}return a}d=b;c=a.indexOf(d[0]);e=a.indexOf(d[1]);return-1!==c&&-1!==e?[polygonCopy(a,c,e),polygonCopy(a,e,c)]:!1},polygonDecomp=function(a){var b=polygonGetCutEdges(a);return 0<b.length?polygonSlice(a,b):[a]},polygonGetCutEdges=function(a){for(var b=[],c,d,e=[],g=Number.MAX_VALUE,h=0;h<a.length;++h)if(polygonIsReflex(a,h))for(var k=0;k<a.length;++k)if(polygonCanSee(a,h,k)){c=polygonGetCutEdges(polygonCopy(a,h,k,e));d=polygonGetCutEdges(polygonCopy(a,
  k,h,e));for(var n=0;n<d.length;n++)c.push(d[n]);c.length<g&&(b=c,g=c.length,b.push([polygonAt(a,h),polygonAt(a,k)]))}return b},polygonCopy=function(a,b,c,d){d=d||[];polygonClear(d);if(b<c)for(var e=b;e<=c;e++)d.push(a[e]);else{for(e=0;e<=c;e++)d.push(a[e]);for(e=b;e<a.length;e++)d.push(a[e])}return d},polygonCanSee2=function(a,b,c){for(var d=0;d!==a.length;++d)if(d!==b&&d!==c&&(d+1)%a.length!==b&&(d+1)%a.length!==c&&lineSegmentsIntersect(polygonAt(a,b),polygonAt(a,c),polygonAt(a,d),polygonAt(a,d+
  1)))return!1;return!0},polygonCanSee=function(a,b,c){var d=tmpLine1,e=tmpLine2;if(isLeftOn(polygonAt(a,b+1),polygonAt(a,b),polygonAt(a,c))&&isRightOn(polygonAt(a,b-1),polygonAt(a,b),polygonAt(a,c)))return!1;var g=sqdist(polygonAt(a,b),polygonAt(a,c));for(var h=0;h!==a.length;++h)if((h+1)%a.length!==b&&h!==b&&isLeftOn(polygonAt(a,b),polygonAt(a,c),polygonAt(a,h+1))&&isRightOn(polygonAt(a,b),polygonAt(a,c),polygonAt(a,h))){d[0]=polygonAt(a,b);d[1]=polygonAt(a,c);e[0]=polygonAt(a,h);e[1]=polygonAt(a,
  h+1);var k=lineInt(d,e);if(sqdist(polygonAt(a,b),k)<g)return!1}return!0},polygonIsReflex=function(a,b){return isRight(polygonAt(a,b-1),polygonAt(a,b),polygonAt(a,b+1))},polygonReverse=function(a){for(var b=[],c=a.length,d=0;d!==c;d++)b.push(a.pop());for(d=0;d!==c;d++)a[d]=b[d]},polygonMakeCCW=function(a){for(var b=0,c=1;c<a.length;++c)if(a[c][1]<a[b][1]||a[c][1]===a[b][1]&&a[c][0]>a[b][0])b=c;if(isLeft(polygonAt(a,b-1),polygonAt(a,b),polygonAt(a,b+1)))return!1;polygonReverse(a);return!0},polygonAppend=
  function(a,b,c,d){for(;c<d;c++)a.push(b[c])},polygonClear=function(a){a.length=0},polygonAt=function(a,b){var c=a.length;return a[0>b?b%c+c:b%c]},sqdist=function(a,b){var c=b[0]-a[0];a=b[1]-a[1];return c*c+a*a},collinear=function(a,b,c,d){if(d){var e=tmpPoint1,g=tmpPoint2;e[0]=b[0]-a[0];e[1]=b[1]-a[1];g[0]=c[0]-b[0];g[1]=c[1]-b[1];return Math.acos((e[0]*g[0]+e[1]*g[1])/(Math.sqrt(e[0]*e[0]+e[1]*e[1])*Math.sqrt(g[0]*g[0]+g[1]*g[1])))<d}return 0===triangleArea(a,b,c)},isRightOn=function(a,b,c){return 0>=
  triangleArea(a,b,c)},isRight=function(a,b,c){return 0>triangleArea(a,b,c)},isLeftOn=function(a,b,c){return 0<=triangleArea(a,b,c)},isLeft=function(a,b,c){return 0<triangleArea(a,b,c)},triangleArea=function(a,b,c){return(b[0]-a[0])*(c[1]-a[1])-(c[0]-a[0])*(b[1]-a[1])},lineSegmentsIntersect=function(a,b,c,d){var e=b[0]-a[0];b=b[1]-a[1];var g=d[0]-c[0],h=d[1]-c[1];if(0===g*b-h*e)return!1;d=(e*(c[1]-a[1])+b*(a[0]-c[0]))/(g*b-h*e);a=(g*(a[1]-c[1])+h*(c[0]-a[0]))/(h*e-g*b);return 0<=d&&1>=d&&0<=a&&1>=a},
  lineInt=function(a,b,c){var d=[0,0];var e=a[1][1]-a[0][1];var g=a[0][0]-a[1][0];a=e*a[0][0]+g*a[0][1];var h=b[1][1]-b[0][1];var k=b[0][0]-b[1][0];b=h*b[0][0]+k*b[0][1];var n=e*k-h*g;scalar_eq(n,0,c||0)||(d[0]=(k*a-g*b)/n,d[1]=(e*b-h*a)/n);return d},tmpPoint1=[],tmpPoint2=[],tmpLine1=[],tmpLine2=[];self.polyDecomp={decomp:polygonDecomp,quickDecomp:polygonQuickDecomp,isSimple:polygonIsSimple,removeCollinearPoints:polygonRemoveCollinearPoints,removeDuplicatePoints:polygonRemoveDuplicatePoints,makeCCW:polygonMakeCCW};
  
  
  // c3/lib/c3.js
  'use strict';{let c=!1,d=!1,a="dev";const b=self.C3=class{constructor(){throw TypeError("static class can't be instantiated");}static SetReady(){c=!0}static IsReady(){return c}static SetAppStarted(){d=!0}static HasAppStarted(){return d}static SetBuildMode(e){a=e}static GetBuildMode(){return a}static IsReleaseBuild(){return"final"===a}};b.isDebug=!1;b.isDebugDefend=!1;b.hardwareConcurrency=navigator.hardwareConcurrency||2};
  
  
  // ../lib/queryParser.js
  'use strict';{const b=self.C3;b.QueryParser=class{constructor(a){this._queryString=a;this._parameters=new Map;this._Parse()}_Parse(){var a=this._queryString;if(a.startsWith("?")||a.startsWith("#"))a=a.substr(1);a=a.split("&");for(const b of a)this._ParseParameter(b)}_ParseParameter(a){if(a)if(a.includes("=")){var c=a.indexOf("="),d=decodeURIComponent(a.substring(0,c));a=decodeURIComponent(a.substring(c+1));this._parameters.set(d,a)}else this._parameters.set(a,null)}LogAll(){for(const a of this._parameters)console.log("[QueryParser] Parameter '"+
  a[0]+"' = "+(null===a[1]?"null":"'"+a[1]+"'"))}Has(a){return this._parameters.has(a)}Get(a){a=this._parameters.get(a);return"undefined"===typeof a?null:a}ClearHash(){history.replaceState("",document.title,location.pathname+location.search)}Reparse(a){this._queryString=a;this._parameters.clear();this._Parse()}};b.QueryString=new b.QueryParser(location.search);b.LocationHashString=new b.QueryParser(location.hash);"dev"!==b.QueryString.Get("mode")&&b.SetBuildMode("final")};
  
  
  // ../lib/detect/detect.js
  'use strict';{var runTest=function(a,l,m){!0===l?(m(),t.set(a,!0)):l&&l.length&&(m(l[0]),t.set(a,!0))};const v=self.C3,b=navigator.userAgent;let d={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 c="(unknown)",e="(unknown)",n="(unknown)",f="(unknown)",g="(unknown)",q="(unknown)",h="(unknown)",k="browser",p=!1,r=!1,t=new Map;runTest("isWindows",JSCompiler_object_inline_windows_0,a=>{c="Windows";if(a=a.split(" ")[2])switch(a){case "5.0":e=
  "2000";break;case "5.1":e="XP";break;case "5.2":e="XP";break;case "6.0":e="Vista";break;case "6.1":e="7";break;case "6.2":e="8";break;case "6.3":e="8.1";break;case "10.0":e="10"}});runTest("isOSX",JSCompiler_object_inline_OSX_1,a=>{c="Mac OS X";(a=a.split(" ")[3])&&(e=a.replace("_","."))});runTest("isLinux",d.linux,()=>{c="Linux"});runTest("isChromeOS",d.chromeOS,()=>{c="Chrome OS"});runTest("isAndroid",!d.windowsTizen&&JSCompiler_object_inline_android_2,a=>{c="Android";(a=a.split(" ")[1])&&(e=a)});
  runTest("isTizen",JSCompiler_object_inline_tizen_4,a=>{c="Tizen";(a=a.split(" ")[1])&&(e=a)});runTest("isIPhone",!d.windowsTizen&&JSCompiler_object_inline_iphone_5,a=>{c="iOS";(a=a.split(" ")[2])&&(e=a.replace("_","."))});runTest("isIPad",!d.windowsTizen&&JSCompiler_object_inline_ipad_6,a=>{c="iOS";(a=a.split(" ")[3])&&(e=a.replace("_","."))});runTest("isWindowsPhone",JSCompiler_object_inline_winPhone_7,a=>{c="Windows Phone";(a=a.split(" ")[2])&&(e=a)});runTest("isWindowsPhoneOS",JSCompiler_object_inline_winPhoneOS_8,
  a=>{c="Windows Phone";(a=a.split(" ")[3])&&(e=a)});runTest("isBlackberry",d.blackberry,()=>{c="Blackberry";e="10";f="stock";h="webkit"});runTest("isChrome",!d.edge&&!d.opera&&JSCompiler_object_inline_chrome_9,a=>{f="Chrome";h="Chromium";(a=a.split("/")[1])&&(g=a)});runTest("isOpera",JSCompiler_object_inline_opera_3,a=>{f="Opera";h="Chromium";(a=a.split("/")[1])&&(g=a)});runTest("isChromium",JSCompiler_object_inline_chromium_10,a=>{h=f="Chromium";(a=a.split("/")[1])&&(g=a)});runTest("isFirefox",JSCompiler_object_inline_firefox_12,
  a=>{f="Firefox";h="Gecko";(a=a.split("/")[1])&&(g=a)});runTest("isInternetExplorer",JSCompiler_object_inline_ie_13,a=>{f="Internet Explorer";h="Trident";(a=a.split(" ")[1])&&(g=a)});runTest("isTrident","Internet Explorer"!==f&&d.trident,()=>{h="Trident";var a=/rv:[0-9.]+/i.exec(b);a&&a.length&&(f="Internet Explorer",(a=a[0].split(":")[1])&&(g=a))});runTest("isEdge",JSCompiler_object_inline_edge_14,a=>{h=f="Edge";(a=a.split("/")[1])&&(g=a)});runTest("isEdgeChromium",JSCompiler_object_inline_edgeChromium_15,
  a=>{f="Edge";h="Chromium";(a=a.split("/")[1])&&(g=a)});runTest("isSafari",d.safari&&!d.nokia&&!d.chrome&&!d.chromium&&!d.genericIE&&!d.blackberry,()=>{f="Safari";h="WebKit";var a=/version\/[0-9.]+/i.exec(b),l=/crios\/[0-9.]+/i.exec(b),m=/fxios\/[0-9.]+/i.exec(b);a&&a.length&&(a=a[0].split("/")[1])&&(g=a);l&&l.length&&(f="Chrome for iOS",(l=l[0].split("/")[1])&&(g=l));m&&m.length&&(f="Firefox for iOS",(m=m[0].split("/")[1])&&(g=m))});runTest("isSilk",JSCompiler_object_inline_silk_16,a=>{f="Silk";(a=
  a.split("/")[1])&&(g=a)});runTest("isCrosswalk",d.crosswalk,()=>k="crosswalk");runTest("isCordova",self.device&&(self.device.cordova||self.device.phonegap),()=>k="cordova");runTest("isNWJS",JSCompiler_object_inline_nwjs_11,a=>{k="nwjs";f="NW.js";h="Chromium";(a=a.split("/")[1])&&(g=a)});runTest("isAmazonWebApp",d.amazonwebapp,()=>k="webapp");runTest("isHomeScreenWebApp","nwjs"!==k&&"undefined"!==typeof window&&(window.matchMedia&&window.matchMedia("(display-mode: standalone)").matches||navigator.standalone),
  ()=>k="webapp");runTest("isFalseSafari","Safari"===f&&("Android"===c||"Tizen"===c||"Blackberry"===c),()=>f="stock");runTest("isAndroidWebview","Chrome"===f&&"browser"===k&&d.webview,()=>k="webview");runTest("isFirefoxOS","Firefox"===f&&"(unknown)"===c,()=>c="Firefox OS");runTest("isAndroidFallback","(unknown)"===c&&!d.windowsTizen&&d.android,()=>c="Android");runTest("isTridentFallback","(unknown)"===c&&d.trident,()=>h="Trident");runTest("isWebkitFallback","(unknown)"===c&&d.webkit,()=>h="WebKit");
  runTest("is64Bit",(a=>a.test(b)||a.test(navigator.platform)||"x64"===navigator.cpuClass)(/x86_64|x86-64|win64|x64;|x64\)|x64_|amd64|wow64|ia64|arm64|arch64|sparc64|ppc64|irix64/i),()=>n="64-bit");runTest("is32Bit",(a=>a.test(b)||a.test(navigator.platform)||"x86"===navigator.cpuClass)(/x86;|x86\)|i86|i386|i486|i586|i686|armv1|armv2|armv3|armv4|armv5|armv6|armv7/i),()=>n="32-bit");runTest("is64BitFallback","(unknown)"===n&&"Mac OS X"===c&&10.7<=parseFloat(e),()=>n="64-bit");runTest("is32BitFallback",
  "(unknown)"===n&&"Windows"===c||"Android"===c&&5>parseFloat(e),()=>n="32-bit");runTest("is32BitBrowser","32-bit"===n||/wow64/i.test(b),()=>q="32-bit");runTest("is64BitBrowser",/win64/i.test(b),()=>q="64-bit");runTest("isDesktop",(()=>"Windows"===c||"Mac OS X"===c||"Linux"===c||"Chrome OS"===c||"nwjs"===k)(),()=>p=!0);"Edge"===h&&"undefined"!==typeof Windows&&"undefined"!==typeof Windows.System&&(k="windows-store");r="nwjs"===k;const u="Mac OS X"===c&&navigator.maxTouchPoints&&2<navigator.maxTouchPoints;
  u&&(c="iOS",e=g,r=p=!1);v.Platform={OS:c,OSVersion:e,OSArchitecture:n,Browser:f,BrowserVersion:g,BrowserVersionNumber:parseFloat(g),BrowserArchitecture:q,BrowserEngine:h,Context:k,IsDesktop:p,IsMobile:!p,IsDesktopApp:r,IsChromeWebStore:!!(self.chrome&&self.chrome.runtime&&self.chrome.runtime.id),IsAppleOS:"Mac OS X"===c||"iOS"===c,IsIpadOS:u}};
  
  
  // ../lib/storage/kvStorage.js
  'use strict';{var getEntriesFromCursor=function(a,b){const c=a.objectStore("keyvaluepairs").openCursor();return new Promise(a=>{const d=[];c.onsuccess=c=>{if(c=c.target.result){switch(b){case "entries":d.push([c.key,c.value]);break;case "keys":d.push(c.key);break;case "values":d.push(c.value)}c.continue()}else a(d)}})},RequireString=function(a){if("string"!==typeof a)throw new TypeError("expected string");},openDatabase$jscomp$1=async function(a){RequireString(a);const b=indexedDB.open(a,2);b.addEventListener("upgradeneeded",
  b=>{try{b.target.result.createObjectStore("keyvaluepairs")}catch(d){console.error(`Failed to create objectstore for database ${a}`,d)}});return asyncifyRequest(b)},lazyOpenDatabase=function(a){RequireString(a);let b=e.get(a);b instanceof Promise||(b=openDatabase$jscomp$1(a),e.set(a,b),b.catch(b=>e.delete(a)));return b},openTransaction=async function(a,b,c=!1,d=!0){const g=await lazyOpenDatabase(a);try{const a=g.transaction(["keyvaluepairs"],c?"readwrite":"readonly");return b(a)}catch(f){if(d&&"InvalidStateError"===
  f.name)return e.delete(a),openTransaction(a,b,c,!1);throw f;}},openWriteTransaction=function(a,b){return openTransaction(a,b,!0)},openReadOnlyTransaction=function(a,b){return openTransaction(a,b)},asyncifyTransaction=function(a){return new Promise((b,c)=>{a.oncomplete=()=>b();a.onerror=()=>c(a.error);a.onabort=()=>c(a.error)})},asyncifyRequest=function(a){return new Promise((b,c)=>{a.onsuccess=()=>b(a.result);a.onerror=()=>c(a.error)})};const e=new Map,h="undefined"!==typeof IDBObjectStore&&"function"===
  typeof IDBObjectStore.prototype.getAll,k="undefined"!==typeof IDBObjectStore&&"function"===typeof IDBObjectStore.prototype.getAllKeys;class l{constructor(a){RequireString(a);this.name=a}async ready(){await lazyOpenDatabase(this.name)}set(a,b){RequireString(a);return openWriteTransaction(this.name,async c=>{var d=c.objectStore("keyvaluepairs").put(b,a);d=asyncifyRequest(d);c=asyncifyTransaction(c);await Promise.all([c,d])})}get(a){RequireString(a);return openReadOnlyTransaction(this.name,async b=>
  {var c=b.objectStore("keyvaluepairs").get(a);c=asyncifyRequest(c);b=asyncifyTransaction(b);[,b]=await Promise.all([b,c]);return b})}delete(a){RequireString(a);return openWriteTransaction(this.name,async b=>{var c=b.objectStore("keyvaluepairs").delete(a);c=asyncifyRequest(c);b=asyncifyTransaction(b);await Promise.all([b,c])})}clear(){return openWriteTransaction(this.name,async a=>{var b=a.objectStore("keyvaluepairs").clear();b=asyncifyRequest(b);a=asyncifyTransaction(a);await Promise.all([a,b])})}keys(){return openReadOnlyTransaction(this.name,
  async a=>{if(k){var b=a.objectStore("keyvaluepairs").getAllKeys();b=asyncifyRequest(b)}else b=getEntriesFromCursor(a,"keys");a=asyncifyTransaction(a);[,a]=await Promise.all([a,b]);return a})}values(){return openReadOnlyTransaction(this.name,async a=>{if(h){var b=a.objectStore("keyvaluepairs").getAll();b=asyncifyRequest(b)}else b=getEntriesFromCursor(a,"values");a=asyncifyTransaction(a);[,a]=await Promise.all([a,b]);return a})}entries(){return openReadOnlyTransaction(this.name,async a=>{var b=getEntriesFromCursor(a,
  "entries");a=asyncifyTransaction(a);[,b]=await Promise.all([a,b]);return b})}}self.KVStorageContainer=l};
  
  
  // ../lib/storage/localForageAdaptor.js
  'use strict';{var StructuredClone=function(a){return"object"===typeof a?new Promise(b=>{const {port1:c,port2:e}=new MessageChannel;e.onmessage=a=>b(a.data);c.postMessage(a)}):Promise.resolve(a)},DISALLOW_CALLBACK=function(a){if("function"===typeof a)throw Error("localforage callback API is not implemented; please use the promise API instead");},NOT_IMPLEMENTED=function(a){throw Error(`"${a}" is not implemented`);};const g=self.KVStorageContainer,k=[/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],f=new WeakMap;let c=!1;"undefined"===typeof indexedDB&&(c=!0,console.warn("Unable to use local storage because indexedDB is not defined"));class h{constructor(a){this._inst=a;f.set(this,new Map)}_MaybeSwitchToMemoryFallback(a){if(!c)for(const b of k)if(a&&b.test(a.message)){console.error("Unable to use local storage, reverting to in-memory store: ",
  a,a.message);c=!0;break}}async _getItemFallback(a){a=f.get(this).get(a);a=await StructuredClone(a);return"undefined"===typeof a?null:a}async _setItemFallback(a,b){b=await StructuredClone(b);f.get(this).set(a,b)}_removeItemFallback(a){f.get(this).delete(a)}_clearFallback(){f.get(this).clear()}_keysFallback(){return Array.from(f.get(this).keys())}IsUsingFallback(){return c}async getItem(a,b){DISALLOW_CALLBACK(b);if(c)return await this._getItemFallback(a);let d;try{d=await this._inst.get(a)}catch(e){this._MaybeSwitchToMemoryFallback(e);
  if(c)return await this._getItemFallback(a);console.error(`Error reading '${a}' from storage, returning null: `,e);return null}return"undefined"===typeof d?null:d}async setItem(a,b,d){DISALLOW_CALLBACK(d);"undefined"===typeof b&&(b=null);if(c)await this._setItemFallback(a,b);else try{await this._inst.set(a,b)}catch(e){if(this._MaybeSwitchToMemoryFallback(e),c)await this._setItemFallback(a,b);else throw e;}}async removeItem(a,b){DISALLOW_CALLBACK(b);if(c)this._removeItemFallback(a);else try{await this._inst.delete(a)}catch(d){this._MaybeSwitchToMemoryFallback(d),
  c?this._removeItemFallback(a):console.error(`Error removing '${a}' from storage: `,d)}}async clear(a){DISALLOW_CALLBACK(a);if(c)this._clearFallback();else try{await this._inst.clear()}catch(b){this._MaybeSwitchToMemoryFallback(b),c?this._clearFallback():console.error("Error clearing storage: ",b)}}async keys(a){DISALLOW_CALLBACK(a);if(c)return this._keysFallback();a=[];try{a=await this._inst.keys()}catch(b){this._MaybeSwitchToMemoryFallback(b);if(c)return this._keysFallback();console.error("Error getting storage keys: ",
  b)}return a}ready(a){DISALLOW_CALLBACK(a);return c?Promise.resolve(!0):this._inst.ready()}createInstance(a){if("object"!==typeof a)throw new TypeError("invalid options object");a=a.name;if("string"!==typeof a)throw new TypeError("invalid store name");a=new g(a);return new h(a)}length(a){NOT_IMPLEMENTED("localforage.length()")}key(a,b){NOT_IMPLEMENTED("localforage.key()")}iterate(a,b){NOT_IMPLEMENTED("localforage.iterate()")}setDriver(a){NOT_IMPLEMENTED("localforage.setDriver()")}config(a){NOT_IMPLEMENTED("localforage.config()")}defineDriver(a){NOT_IMPLEMENTED("localforage.defineDriver()")}driver(){NOT_IMPLEMENTED("localforage.driver()")}supports(a){NOT_IMPLEMENTED("localforage.supports()")}dropInstance(){NOT_IMPLEMENTED("localforage.dropInstance()")}disableMemoryMode(){c=
  !1}}self.localforage=new h(new g("localforage"))};
  
  
  // ../lib/misc/supports.js
  'use strict';{const a=self.C3;a.Supports={};a.Supports.WebAnimations=(()=>{try{if("Safari"===a.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}})();a.Supports.DialogElement="undefined"!==typeof HTMLDialogElement;a.Supports.RequestIdleCallback=!!self.requestIdleCallback;a.Supports.ImageBitmap=!!self.createImageBitmap;a.Supports.ImageBitmapOptions=
  !1;if(a.Supports.ImageBitmap)try{self.createImageBitmap(new ImageData(32,32),{premultiplyAlpha:"none"}).then(b=>{a.Supports.ImageBitmapOptions=!0}).catch(b=>{a.Supports.ImageBitmapOptions=!1})}catch(b){a.Supports.ImageBitmapOptions=!1}a.Supports.ClipboardReadText=!(!navigator.clipboard||!navigator.clipboard.readText||"Firefox"===a.Platform.Browser);a.Supports.PermissionsQuery=!(!navigator.permissions||!navigator.permissions.query);a.Supports.Proxies="undefined"!==typeof Proxy;a.Supports.DownloadAttribute=
  (()=>"undefined"===typeof document?!1:"undefined"!==typeof document.createElement("a").download)();a.Supports.CanvasToBlob=(()=>"undefined"!==typeof HTMLCanvasElement&&HTMLCanvasElement.prototype.toBlob)();a.Supports.CSSElement="undefined"!==typeof CSS&&CSS.supports("background","element(#test)");a.Supports.Fetch="function"===typeof fetch;a.Supports.PersistentStorage=!!(self.isSecureContext&&"Opera"!==a.Platform.Browser&&navigator.storage&&navigator.storage.persist);a.Supports.StorageQuotaEstimate=
  !!(self.isSecureContext&&navigator.storage&&navigator.storage.estimate);a.Supports.Fullscreen=(()=>{if("undefined"===typeof document||"iOS"===a.Platform.OS)return!1;const b=document.documentElement;return!!(b.requestFullscreen||b.msRequestFullscreen||b.mozRequestFullScreen||b.webkitRequestFullscreen)})();const e=[{name:"A",value:12},{name:"B",value:13},{name:"C",value:13},{name:"D",value:13},{name:"E",value:13},{name:"F",value:13},{name:"G",value:14},{name:"H",value:12},{name:"I",value:12},{name:"J",
  value:13},{name:"K",value:14}],f=Math.ceil(496/e.length),g=String(f).length,d=[];for(const a of e)for(let b=0;b<=f;b++)d.push({name:a.name+String(b).padStart(g,"0"),value:a.value});d.sort((b,c)=>c.value-b.value);const h=d.reduce((b,c)=>{c=c.name.slice(0,1);return b.slice(-1)===c?b:b+c},"");a.Supports.ArraySortProbablyStable="GKBCDEFJAHI"===h};
  
  
  // ../lib/misc/polyfills.js
  'use strict';{const h=self.C3;if(!String.prototype.trimStart){const a=/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]*/;String.prototype.trimStart=function(){return this.replace(a,"")}}if(!String.prototype.trimEnd){const a=/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]*$/;String.prototype.trimEnd=function(){return this.replace(a,
  "")}}String.prototype.replaceAll||(String.prototype.replaceAll=function(a,b){return this.replace(new RegExp(h.EscapeRegex(a),"g"),()=>b)});Array.prototype.values||(Array.prototype.values=function*(){for(const a of this)yield a});if(!Array.prototype.flat){var arrayFlat=function(a,b){return a.reduce((a,c)=>{0<b&&Array.isArray(c)?Array.prototype.push.apply(a,arrayFlat(c,b-1)):a.push(c);return a},[])};Array.prototype.flat=function(a=1){return arrayFlat(this,a)}}RegExp.escape||(RegExp.escape=function(a){return String(a).replace(/[\\^$*+?.()|[\]{}]/g,
  "\\$&")});navigator.storage&&!navigator.storage.estimate&&navigator.webkitTemporaryStorage&&navigator.webkitTemporaryStorage.queryUsageAndQuota&&(navigator.storage.estimate=function(){return new Promise((a,b)=>navigator.webkitTemporaryStorage.queryUsageAndQuota((b,c)=>a({usage:b,quota:c}),b))});"undefined"===typeof HTMLCollection||HTMLCollection.prototype[Symbol.iterator]||(HTMLCollection.prototype[Symbol.iterator]=function(){let a=0;return{next:()=>a>=this.length?{done:!0}:{value:this.item(a++),
  done:!1}}});"undefined"===typeof NodeList||NodeList.prototype[Symbol.iterator]||(NodeList.prototype[Symbol.iterator]=function(){let a=0;return{next:()=>a>=this.length?{done:!0}:{value:this.item(a++),done:!1}}});"undefined"===typeof DOMTokenList||DOMTokenList.prototype[Symbol.iterator]||(DOMTokenList.prototype[Symbol.iterator]=function(){let a=0;return{next:()=>a>=this.length?{done:!0}:{value:this.item(a++),done:!1}}});"undefined"===typeof FileList||FileList.prototype[Symbol.iterator]||(FileList.prototype[Symbol.iterator]=
  function(){let a=0;return{next:()=>a>=this.length?{done:!0}:{value:this.item(a++),done:!1}}});"undefined"===typeof TextEncoder&&(self.TextEncoder=class{constructor(){Object.defineProperty(this,"encoding",{value:"utf-8",writable:!1})}encode(a){for(var b=a.length,d=-1,c=new Uint8Array(3*b),e,g,f=0;f!==b;){e=a.charCodeAt(f);f+=1;if(55296<=e&&56319>=e){if(f===b){c[d+=1]=239;c[d+=1]=191;c[d+=1]=189;break}g=a.charCodeAt(f);if(56320<=g&&57343>=g){if(e=1024*(e-55296)+g-56320+65536,f+=1,65535<e){c[d+=1]=240|
  e>>>18;c[d+=1]=128|e>>>12&63;c[d+=1]=128|e>>>6&63;c[d+=1]=128|e&63;continue}}else{c[d+=1]=239;c[d+=1]=191;c[d+=1]=189;continue}}127>=e?c[d+=1]=0|e:(2047>=e?c[d+=1]=192|e>>>6:(c[d+=1]=224|e>>>12,c[d+=1]=128|e>>>6&63),c[d+=1]=128|e&63)}return new Uint8Array(c.buffer.slice(0,d+1))}toString(){return"[object TextEncoder]"}},TextEncoder[Symbol.toStringTag]="TextEncoder");if("undefined"===typeof TextDecoder){var readNext=function(b){b=b.next();if(b.done)throw Error("unexpected end of input");if(0!=(b.value&
  192^128))throw Error("invalid byte");return b.value&63},persist=function(b){const d=b[Symbol.iterator]();return{next:a=>d.next(),[Symbol.iterator](){return this}}};const a=new Map;a.set("utf-8",(b,d)=>{if(b.buffer)var c=new Uint8Array(b.buffer,b.byteOffset,b.byteLength);else if(c instanceof ArrayBuffer)c=new Uint8Array(b);else throw Error("Invalid parameter");b=persist(c);c=[];try{for(const a of b){let d;if(127>a)d=a&127;else if(223>a)d=(a&31)<<6|readNext(b);else if(239>a)d=(a&15)<<12|readNext(b)<<
  6|readNext(b);else if(247>a)d=(a&7)<<18|readNext(b)<<12|readNext(b)<<6|readNext(b);else throw Error("Invalid character");c.push(String.fromCodePoint(d))}}catch(e){if(d)throw e;c.push("\ufffd")}return c.join("")});a.set("utf8",a.get("utf-8"));a.set("utf-16le",(b,d)=>{throw Error("utf-16le decoder not implemented");});self.TextDecoder=class{constructor(b="utf-8",d={}){const c=a.get(b);if(!c)throw Error(`TextDecoder polyfill does not support "${b}"`);Object.defineProperty(this,"fatal",{value:!0===d.fatal,
  writable:!1});Object.defineProperty(this,"_decoder",{value:c,writable:!1});Object.defineProperty(this,"encoding",{value:b,writable:!1})}decode(b){return this._decoder(b,this.fatal)}toString(){return"[object TextDecoder]"}};TextDecoder[Symbol.toStringTag]="TextDecoder"}"undefined"===typeof self.isSecureContext&&(self.isSecureContext="https:"===location.protocol);"undefined"===typeof self.globalThis&&(self.globalThis=self)};
  
  
  // c3/lib/misc/assert.js
  'use strict';{var assertFail=function(a){let b=c.GetCallStack();console.error("Assertion failure: "+a+"\n\nStack trace:\n"+b)};const c=self.C3;self.assert=function(a,b){a||assertFail(b)}};
  
  
  // ../lib/misc/typeChecks.js
  'use strict';{const b=self.C3;b.IsNumber=function(a){return"number"===typeof a};b.IsFiniteNumber=function(a){return b.IsNumber(a)&&isFinite(a)};b.RequireNumber=function(a){if(!b.IsNumber(a))throw new TypeError("expected number");};b.RequireOptionalNumber=function(a){b.IsNullOrUndefined(a)};b.RequireNumberInRange=function(a,c,d){if(!b.IsNumber(a)||isNaN(a)||c>a||d<a)throw new RangeError("number outside of range");};b.RequireAllNumber=function(...a){for(let b of a);};b.RequireFiniteNumber=function(a){if(!b.IsFiniteNumber(a))throw new TypeError("expected finite number");
  };b.RequireOptionalFiniteNumber=function(a){b.IsNullOrUndefined(a)};b.RequireAllFiniteNumber=function(...a){for(let b of a);};b.IsString=function(a){return"string"===typeof a};b.RequireString=function(a){if(!b.IsString(a))throw new TypeError("expected string");};b.RequireOptionalString=function(a){b.IsNullOrUndefined(a)};b.RequireAllString=function(...a){for(let b of a);};b.IsSimpleObject=function(a){return"object"!==typeof a||null===a?!1:(a=Object.getPrototypeOf(a))?a.constructor===Object:null===
  a};b.RequireSimpleObject=function(a){if(!b.IsSimpleObject(a))throw new TypeError("expected simple object");};b.RequireOptionalSimpleObject=function(a){if(!b.IsNullOrUndefined(a)&&!b.IsSimpleObject(a))throw new TypeError("expected simple object");};b.IsObject=function(a){return"object"===typeof a&&null!==a&&!Array.isArray(a)};b.RequireObject=function(a){if(!b.IsObject(a))throw new TypeError("expected object");};b.RequireOptionalObject=function(a){b.IsNullOrUndefined(a)};b.RequireAllObject=function(...a){for(let b of a);
  };b.IsFileLike=function(a){return b.IsInstanceOf(a,Blob)&&"string"===typeof a.name};b.RequireFileLike=function(a){if(!b.IsFileLike(a))throw new TypeError("expected file");};b.RequireOptionalFileLike=function(a){b.IsNullOrUndefined(a)};b.IsArray=function(a){return Array.isArray(a)};b.RequireArray=function(a){if(!b.IsArray(a))throw new TypeError("expected array");};b.RequireOptionalArray=function(a){b.IsNullOrUndefined(a)};b.RequireAllArray=function(...a){for(let b of a);};b.Is2DArray=function(a){return b.IsArray(a)?
  a.length?b.IsArray(a[0])?!0:!1:!0:!1};b.Require2DArray=function(a){if(!b.Is2DArray(a))throw new TypeError("expected 2d array");for(let c of a)if(!b.IsArray(c))throw new TypeError("expected 2d array");};b.RequireOptional2DArray=function(a){b.IsNullOrUndefined(a)};b.IsFunction=function(a){return"function"===typeof a};b.RequireFunction=function(a,c){if(!b.IsFunction(a))throw new TypeError("expected function");if(!b.IsNullOrUndefined(c)&&a!==c)throw new TypeError("expected same function reference");};
  b.RequireOptionalFunction=function(a){b.IsNullOrUndefined(a)};b.RequireAllFunction=function(...a){for(let b of a);};b.RequireAnyFunction=function(a,...c){if(!b.IsFunction(a))throw new TypeError("expected function");if(!c.length)throw Error("missing comparison functions");for(let d of c)if(!b.IsNullOrUndefined(d)&&a===d)return;throw new TypeError("expected same function reference");};b.RequireOptionalAllFunction=function(...a){if(!b.IsNullOrUndefined(a))for(let b of a);};b.IsInstanceOf=function(a,
  c){return a instanceof c};b.IsInstanceOfAny=function(a,...c){for(let d of c)if(b.IsInstanceOf(a,d))return!0;return!1};b.RequireInstanceOf=function(a,c){if(!b.IsInstanceOf(a,c))throw new TypeError("unexpected type");};b.RequireOptionalInstanceOf=function(a,c){b.IsNullOrUndefined(a)};b.RequireAllInstanceOf=function(a,...c){for(let a of c);};b.RequireAnyInstanceOf=function(a,...c){if(!b.IsInstanceOfAny(a,...c))throw new TypeError("unexpected type");};b.RequireAnyOptionalInstanceOf=function(a,...c){if(!b.IsNullOrUndefined(a)&&
  !b.IsInstanceOfAny(a,...c))throw new TypeError("unexpected type");};b.IsArrayOf=function(a,c){for(let d of a)if(!b.IsInstanceOf(d,c))return!1;return!0};b.IsArrayOfFiniteNumbers=function(a){for(let c of a)if(!b.IsFiniteNumber(c))return!1;return!0};b.RequireArrayOf=function(a,c){for(let b of a);};b.RequireOptionalArrayOf=function(a,c){if(!b.IsNullOrUndefined(a))for(let b of a);};b.RequireArrayOfAny=function(a,...c){for(let b of a);};b.RequireOptionalArrayOfAny=function(a,...c){if(!b.IsNullOrUndefined(a))for(let b of a);
  };b.IsDOMNode=function(a,c){return b.IsNullOrUndefined(a)||!b.IsString(a.nodeName)?!1:!c||b.equalsNoCase(a.nodeName,c)};b.RequireDOMNode=function(a,c){if(b.IsNullOrUndefined(a)||!b.IsString(a.nodeName))throw new TypeError("expected DOM node");if(c&&!b.equalsNoCase(a.nodeName,c))throw new TypeError(`expected DOM '${c}' node`);};b.RequireOptionalDOMNode=function(a,c){b.IsNullOrUndefined(a)};b.IsHTMLElement=function(a,c){return b.IsNullOrUndefined(a)||!b.IsString(a.tagName)?!1:!c||b.equalsNoCase(a.tagName,
  c)};b.RequireHTMLElement=function(a,c){if(b.IsNullOrUndefined(a)||!b.IsString(a.tagName))throw new TypeError("expected HTML element");if(c&&!b.equalsNoCase(a.tagName,c))throw new TypeError(`expected HTML '${c}' element`);};b.RequireOptionalHTMLElement=function(a,c){b.IsNullOrUndefined(a)};b.IsDrawable=function(a){return b.IsHTMLElement(a,"img")||b.IsHTMLElement(a,"canvas")||b.IsHTMLElement(a,"video")||"undefined"!==typeof OffscreenCanvas&&a instanceof OffscreenCanvas||"undefined"!==typeof ImageBitmap&&
  a instanceof ImageBitmap};b.RequireDrawable=function(a){if(!b.IsDrawable(a))throw new TypeError("expected drawable");};b.RequireOptionalDrawable=function(a){b.IsNullOrUndefined(a)};b.IsDrawableOrImageData=function(a){return a instanceof ImageData?!0:b.IsDrawable(a)};b.RequireDrawableOrImageData=function(a){if(!b.IsDrawableOrImageData(a))throw new TypeError("expected drawable or image data");};b.RequireOptionalDrawableOrImageData=function(a){if(!b.IsNullOrUndefined(a)&&!b.IsDrawableOrImageData(a))throw new TypeError("expected drawable or image data");
  };b.IsStringLike=function(a){return"string"===typeof a||a instanceof b.HtmlString||a instanceof b.BBString};b.RequireStringLike=function(a){if(!b.IsStringLike(a))throw new TypeError("expected string-like");};b.RequireOptionalStringLike=function(a){b.IsNullOrUndefined(a)};b.RequireAllStringLike=function(...a){for(let b of a);};b.RequireOverride=function(){throw Error("must be overridden");};b.NotYetImplemented=function(){throw Error("not yet implemented");};b.IsDefined=function(a,...c){if("undefined"===
  typeof a)return!1;for(let b of c){if("undefined"===typeof a[b])return!1;a=a[b]}return!0};b.IsNullOrUndefined=function(a){return"undefined"===typeof a||null===a};b.AreArrayElementsOfSameType=function(a){let c=a[0].constructor;for(let b of a)if(b.constructor!==c)return!1;return c};b.AreArrayElementsOfType=function(a,c){for(let b of a)if(!(b instanceof c))return!1;return!0};const e=Object.getPrototypeOf(Uint8Array);b.IsTypedArray=function(a){return b.IsInstanceOf(a,e)};b.RequireTypedArray=function(a){};
  b.WeakRequireTypedArray=function(a){b.WeakRequireInstanceOf(a,e)};b.WeakRequireAnyInstanceOf=function(a,...c){if(!b.WeakIsAnyInstanceOf(a,...c))throw new TypeError("unexpected type");};b.WeakIsAnyInstanceOf=function(a,...c){for(const d of c)if(b.WeakIsInstanceOf(a,d))return!0;return!1};b.WeakRequireInstanceOf=function(a,c){if(!b.WeakIsInstanceOf(a,c))throw new TypeError("unexpected type");};b.WeakIsInstanceOf=function(a,c){for(;a=Object.getPrototypeOf(a);)if(a.constructor.name===c.name)return!0;return!1}};
  
  
  // ../lib/misc/jsutil.js
  'use strict';{var VerifyObjectPropertiesConsistent=function(a,b){b=getObjectPropertySet(b);let e=l.get(a);if(e){let d=[];for(let a of e.values())b.has(a)?b.delete(a):d.push(a);c.appendArray(d,[...b]);d.length&&console.warn(`[Defence] '${c.getName(a)}' constructor creates inconsistent properties: ${d.join(", ")}`)}else l.set(a,b)},getObjectPropertySet=function(a){let b=new Set;for(let c in a)b.add(c);return b},CheckDefendedObjectsUsedCorrectly=function(){h=-1;if(0<d.size||0<f.size){let a=[...new Set([...d.keys()].map(a=>
  c.getName(a)))].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: ${a}`);d.clear();f.clear()}},logDefendedObjectWarning=function(a){console.warn("[Defence] "+a+" @",c.GetCallStack())},isValidTypeChange=function(a,b){a=c.getType(a);b=c.getType(b);return"null"===a||"null"===b?!0:"undefined"===a||"undefined"===b?!1:a===b};const c=self.C3;c.GetCallStack=function(){return Error().stack};
  c.Debugger=function(){debugger};c.cast=function(a,b){return a&&a instanceof b?a:null};c.getName=function(a){return"undefined"===typeof a?"undefined":null===a?"null":"boolean"===typeof a?"<boolean>":c.IsNumber(a)?"<number>":c.IsString(a)?"<string>":c.IsArray(a)?"<array>":"symbol"===typeof a?"<"+a.toString()+">":c.IsFunction(a)?a.name&&"Function"!==a.name?a.name:"<anonymous function>":"object"===typeof a?a.constructor&&a.constructor.name&&"Object"!==a.constructor.name?a.constructor.name:"<anonymous object>":
  "<unknown>"};c.getType=function(a){return null===a?"null":Array.isArray(a)?"array":typeof a};c.range=function*(a,b){if(!isFinite(Math.abs(a-b)))throw Error("Invalid parameters");if(a>b)for(--a;a>=b;a--)yield a;else for(;a<b;a++)yield a};let d=new Map,f=new Map,k=new WeakMap,g=new WeakMap;c.DefendHandler={};const m=new Set(["then","splice"]);c.DefendHandler.get=function(a,b){b in a||"symbol"===typeof b||m.has(b)||logDefendedObjectWarning(`Accessed missing property '${b}' from defended object '${c.getName(a)}', returning undefined`);
  g.has(a)&&"symbol"!==typeof b&&!m.has(b)&&logDefendedObjectWarning(`Accessed property '${b}' on a released object '${c.getName(a)}'\nObject was originally released at: ${g.get(a)})\nCall stack at access: `);return a[b]};c.DefendHandler.set=function(a,b,e){b in a||d.has(a)||logDefendedObjectWarning(`Set non-existent property '${b}' to '${e}' on defended object '${c.getName(a)}'`);isValidTypeChange(a[b],e)||d.has(a)||logDefendedObjectWarning(`Set '${c.getType(a[b])}' property '${b}' to type '${c.getType(e)}' on defended object '${c.getName(a)}'`);
  g.has(a)&&logDefendedObjectWarning(`Set property '${b}' on a released object '${c.getName(a)}'\nObject was originally released at: ${g.get(a)})\nCall stack at access: `);a[b]=e;return!0};c.DefendHandler.deleteProperty=function(a,b){throw new ReferenceError(`Cannot delete property '${b}' from defended object '${c.getName(a)}'`);};c.DefendHandler.defineProperty=function(a,b,e){throw new ReferenceError(`Cannot define property '${b}' on defended object '${c.getName(a)}'`);};c.DefendHandler.enumerate=
  function(a){throw new ReferenceError(`Cannot enumerate defended object '${c.getName(a)}'`);};let h=-1;c.DefendedBase=class{constructor(){if(c.isDebugDefend&&c.Supports.Proxies){var a=Object.create(null.prototype),b=new Proxy(a,c.DefendHandler);d.set(a,b);f.set(b,a);k.set(b,a);-1===h&&(h=requestAnimationFrame(CheckDefendedObjectsUsedCorrectly));return b}}};c.debugDefend=function(a){if(c.isDebugDefend&&c.Supports.Proxies&&a instanceof c.DefendedBase){if(!f.has(a))return a;let b=f.get(a);f.delete(a);
  d.delete(b);return a}return c.isDebug?Object.seal(a):a};c.New=function(a,...b){let e;try{e=new a(...b)}catch(n){throw f.clear(),d.clear(),n;}c.isDebugDefend&&VerifyObjectPropertiesConsistent(a,e);return c.debugDefend(e)};c.Release=function(a){(a=k.get(a))&&g.set(a,c.GetCallStack())};c.WasReleased=function(a){return(a=k.get(a))?!!g.get(a):!1};let l=new Map;c.PerfMark=class{constructor(a){this._name="";a&&this.start(a)}start(a){this._name=a;performance.mark(this._name+"-Start")}end(){performance.mark(this._name+
  "-End");performance.measure(this._name,this._name+"-Start",this._name+"-End")}next(a){this.end();this._name=a;performance.mark(this._name+"-Start")}}};
  
  
  // ../lib/misc/mathutil.js
  'use strict';{var isNegativeZero=function(a){return 0===a&&0>1/a};const d=self.C3,t=2*Math.PI,w=Math.PI/180,x=180/Math.PI;d.wrap=function(a,b,c){a=Math.floor(a);b=Math.floor(b);c=Math.floor(c);return a<b?(a=c-(b-a)%(c-b),a===c?0:a):b+(a-b)%(c-b)};d.mapToRange=function(a,b,c,e,f){return(a-b)*(f-e)/(c-b)+e};d.normalize=function(a,b,c){return(a-b)/(c-b)};d.clamp=function(a,b,c){return a<b?b:a>c?c:a};d.clampAngle=function(a){a%=t;0>a&&(a+=t);return a};d.toRadians=function(a){return a*w};d.toDegrees=function(a){return a*
  x};d.distanceTo=function(a,b,c,e){return Math.hypot(c-a,e-b)};d.distanceSquared=function(a,b,c,e){a=c-a;b=e-b;return a*a+b*b};d.angleTo=function(a,b,c,e){return Math.atan2(e-b,c-a)};d.angleDiff=function(a,b){if(a===b)return 0;a=Math.sin(a)*Math.sin(b)+Math.cos(a)*Math.cos(b);return 1<=a?0:-1>=a?Math.PI:Math.acos(a)};d.angleRotate=function(a,b,c){let e=Math.sin(a),f=Math.cos(a),g=Math.sin(b),k=Math.cos(b);return Math.acos(e*g+f*k)>c?0<f*g-e*k?d.clampAngle(a+c):d.clampAngle(a-c):d.clampAngle(b)};d.angleClockwise=
  function(a,b){return 0>=Math.cos(a)*Math.sin(b)-Math.sin(a)*Math.cos(b)};d.angleLerp=function(a,b,c){let e=d.angleDiff(a,b);return d.angleClockwise(b,a)?d.clampAngle(a+e*c):d.clampAngle(a-e*c)};d.lerp=function(a,b,c){return a+c*(b-a)};d.unlerp=function(a,b,c){return a===b?0:(c-a)/(b-a)};d.relerp=function(a,b,c,e,f){return d.lerp(e,f,d.unlerp(a,b,c))};d.qarp=function(a,b,c,e){return d.lerp(d.lerp(a,b,e),d.lerp(b,c,e),e)};d.cubic=function(a,b,c,e,f){return d.lerp(d.qarp(a,b,c,f),d.qarp(b,c,e,f),f)};
  d.cosp=function(a,b,c){return(a+b+(a-b)*Math.cos(c*Math.PI))/2};d.isPOT=function(a){return 0<a&&0===(a-1&a)};d.nextHighestPowerOfTwo=function(a){--a;for(let b=1;32>b;b<<=1)a|=a>>b;return a+1};d.roundToNearestFraction=function(a,b){return Math.round(a*b)/b};d.floorToNearestFraction=function(a,b){return Math.floor(a*b)/b};d.round6dp=function(a){return Math.round(1E6*a)/1E6};d.toFixed=function(a,b){a=a.toFixed(b);for(b=a.length-1;0<=b&&"0"===a.charAt(b);--b);0<=b&&"."===a.charAt(b)&&--b;return 0>b?a:
  a.substr(0,b+1)};d.PackRGB=function(a,b,c){return d.clamp(a,0,255)|d.clamp(b,0,255)<<8|d.clamp(c,0,255)<<16};d.PackRGBAEx=function(a,b,c,e){a=d.clamp(Math.floor(1024*a),-8192,8191);b=d.clamp(Math.floor(1024*b),-8192,8191);c=d.clamp(Math.floor(1024*c),-8192,8191);e=d.clamp(Math.floor(1023*e),0,1023);0>a&&(a+=16384);0>b&&(b+=16384);0>c&&(c+=16384);return-(274877906944*a+16777216*b+1024*c+e)};d.PackRGBEx=function(a,b,c){return d.PackRGBAEx(a,b,c,1)};d.GetRValue=function(a){if(0<=a)return(a&255)/255;
  a=Math.floor(-a/274877906944);8191<a&&(a-=16384);return a/1024};d.GetGValue=function(a){if(0<=a)return((a&65280)>>8)/255;a=Math.floor(-a%274877906944/16777216);8191<a&&(a-=16384);return a/1024};d.GetBValue=function(a){if(0<=a)return((a&16711680)>>16)/255;a=Math.floor(-a%16777216/1024);8191<a&&(a-=16384);return a/1024};d.GetAValue=function(a){return isNegativeZero(a)?0:0<=a?1:Math.floor(-a%1024)/1023};d.greatestCommonDivisor=function(a,b){a=Math.floor(a);for(b=Math.floor(b);0!==b;){let c=b;b=a%b;a=
  c}return a};const y=[[3,2],[4,3],[5,4],[5,3],[6,5],[14,9],[16,9],[16,10],[21,9]];d.getAspectRatio=function(a,b){a=Math.floor(a);b=Math.floor(b);if(a===b)return[1,1];for(var c of y){let d=a/c[0]*c[1];if(1>Math.abs(b-d))return c.slice(0);d=a/c[1]*c[0];if(1>Math.abs(b-d))return[c[1],c[0]]}c=d.greatestCommonDivisor(a,b);return[a/c,b/c]};d.segmentsIntersect=function(a,b,c,e,f,g,k,l){if(a<c){var h=a;var m=c}else h=c,m=a;if(f<k){var p=f;var n=k}else p=k,n=f;if(m<p||h>n)return!1;b<e?(h=b,m=e):(h=e,m=b);g<
  l?(p=g,n=l):(p=l,n=g);if(m<p||h>n)return!1;m=f-a+k-c;h=g-b+l-e;a=c-a;b=e-b;f=k-f;g=l-g;l=Math.abs(b*f-g*a);return Math.abs(f*h-g*m)>l?!1:Math.abs(a*h-b*m)<=l};d.segmentsIntersectPreCalc=function(a,b,c,e,f,g,k,l,h,m,p,n){let q,r;h<p?(r=h,q=p):(r=p,q=h);if(g<r||f>q)return!1;m<n?(g=m,f=n):(g=n,f=m);if(l<g||k>f)return!1;k=h-a+p-c;l=m-b+n-e;a=c-a;b=e-b;h=p-h;m=n-m;n=Math.abs(b*h-m*a);return Math.abs(h*l-m*k)>n?!1:Math.abs(a*l-b*k)<=n};d.segmentIntersectsQuad=function(a,b,c,e,f){let g,k,l,h;a<c?(g=a,k=
  c):(g=c,k=a);b<e?(l=b,h=e):(l=e,h=b);const m=f.getTlx(),p=f.getTly(),n=f.getTrx(),q=f.getTry(),r=f.getBrx(),u=f.getBry(),v=f.getBlx();f=f.getBly();return d.segmentsIntersectPreCalc(a,b,c,e,g,k,l,h,m,p,n,q)||d.segmentsIntersectPreCalc(a,b,c,e,g,k,l,h,n,q,r,u)||d.segmentsIntersectPreCalc(a,b,c,e,g,k,l,h,r,u,v,f)||d.segmentsIntersectPreCalc(a,b,c,e,g,k,l,h,v,f,m,p)};d.segmentIntersectsAnyN=function(a,b,c,e,f){let g,k,l,h;a<c?(g=a,k=c):(g=c,k=a);b<e?(l=b,h=e):(l=e,h=b);let m=0;for(let p=f.length-4;m<=
  p;m+=2)if(d.segmentsIntersectPreCalc(a,b,c,e,g,k,l,h,f[m],f[m+1],f[m+2],f[m+3]))return!0;return d.segmentsIntersectPreCalc(a,b,c,e,g,k,l,h,f[m],f[m+1],f[0],f[1])};d.rayIntersect=function(a,b,c,e,f,g,k,l){c-=a;g=l-g;const h=c*g-(e-b)*(k-f);if(0===h)return 2;e=((b-e)*(k-a)+c*(l-b))/h;return 0<e&&1.000001>e?(g*(k-a)+(f-k)*(l-b))/h:2}};
  
  
  // ../lib/misc/miscutil.js
  'use strict';{const c=self.C3;let m=null,g="";if("undefined"!==typeof document){m=document;const a=document.querySelector("base");if(g=a&&a.hasAttribute("href")?a.getAttribute("href"):"")g.startsWith("/")&&(g=g.substr(1)),g.endsWith("/")||(g+="/")}c.GetBaseURL=function(){if(!m)return"";const a=m.location;return c.GetPathFromURL(a.origin+a.pathname)+g};c.GetPathFromURL=function(a){if(!a.length||a.endsWith("/")||a.endsWith("\\"))return a;const b=Math.max(a.lastIndexOf("/"),a.lastIndexOf("\\"));return-1===
  b?"":a.substr(0,b+1)};c.GetFilenameFromURL=function(a){if(!a.length)return a;if(a.endsWith("/")||a.endsWith("\\"))return"";const b=Math.max(a.lastIndexOf("/"),a.lastIndexOf("\\"));return-1===b?a:a.substr(b+1)};c.DataTransferHasFiles=function(a){if(a.types)for(let b=0;b<a.types.length;b++)if("Files"===a.types[b]||"application/x-c3-file"===a.types[b])return!0;return!1};c.DataTransferFilterFiles=async function(a,b){a=Array.from(a.files).filter(a=>0!==a.size).filter(a=>b(a)).map(async a=>{try{return await c.CloneFile(a)}catch(e){return null}});
  return(await Promise.all(a)).filter(a=>a)};c.IsFileAnImage=function(a){return-1!==a.type.search(/image\/.*/)};c.IsFileAnSVG=function(a){return"image/svg+xml"===a.type};c.GetFileExtension=function(a){let b=a.lastIndexOf(".");return 1>b?"":a.substr(b)};c.GetFileNamePart=function(a){let b=a.lastIndexOf(".");return 1>b?a:a.substr(0,b)};c.NormalizeFileSeparator=function(a){return a.replace(/\\/g,"/")};c.ParseFilePath=function(a){a=c.NormalizeFileSeparator(a);let b=/^\w:\//.exec(a);b?(b=b[0],a=a.slice(3),
  "/"!==a[0]&&(a="/"+a)):b="";a=a.replace(/\/{2,}/g,"/");1<a.length&&"/"===a.slice(-1)&&(a=a.slice(0,-1));var d=a.lastIndexOf("/")+1;let e="",f=a,h="";0<d&&(e=a.slice(0,d),f=a.slice(d));a=f;d=f.lastIndexOf(".");0<d&&(h=f.slice(d),a=f.slice(0,-h.length));return{dir:e,base:f,name:a,root:b,ext:h,full:b+e+f}};c.Wait=function(a,b){return new Promise((c,e)=>{self.setTimeout(c,a,b)})};c.swallowException=function(a){try{a()}catch(b){c.isDebug&&console.warn("Swallowed exception: ",b)}};c.noop=function(){};c.equalsNoCase=
  function(a,b){if("string"!==typeof a||"string"!==typeof b)return!1;if(a===b)return!0;a=a.normalize();b=b.normalize();return a.length!==b.length?!1:a.toLowerCase()===b.toLowerCase()};c.equalsCase=function(a,b){return"string"!==typeof a||"string"!==typeof b?!1:a===b?!0:a.normalize()===b.normalize()};c.stableSort=function(a,b){if(c.Supports.ArraySortProbablyStable)a.sort(b);else{var d=a.map((a,b)=>[a,b]);d.sort((a,c)=>{const d=b(a[0],c[0]);return 0!==d?d:a[1]-c[1]});for(let b=0,c=a.length;b<c;++b)a[b]=
  d[b][0]}};c.typedArraySet16=function(a,b,d){a[d++]=b[0];a[d++]=b[1];a[d++]=b[2];a[d++]=b[3];a[d++]=b[4];a[d++]=b[5];a[d++]=b[6];a[d++]=b[7];a[d++]=b[8];a[d++]=b[9];a[d++]=b[10];a[d++]=b[11];a[d++]=b[12];a[d++]=b[13];a[d++]=b[14];a[d]=b[15]};c.truncateArray=function(a,b){a.length=b};c.clearArray=function(a){a&&0!==a.length&&c.truncateArray(a,0)};c.clear2DArray=function(a){if(a){for(let b=0;b<a.length;b++)c.truncateArray(a[b],0);c.truncateArray(a,0)}};c.extendArray=function(a,b,d){b|=0;var e=a.length;
  if(!(b<=e))for(;e<b;++e)a.push(d)};c.resizeArray=function(a,b,d){b|=0;const e=a.length;b<e?c.truncateArray(a,b):b>e&&c.extendArray(a,b,d)};c.shallowAssignArray=function(a,b){c.clearArray(a);c.appendArray(a,b)};c.appendArray=function(a,b){if(1E4>b.length)a.push(...b);else for(let c=0,e=b.length;c<e;++c)a.push(b[c])};c.arrayRemove=function(a,b){b=Math.floor(b);if(!(0>b||b>=a.length)){for(var d=a.length-1;b<d;++b)a[b]=a[b+1];c.truncateArray(a,d)}};c.arrayFindRemove=function(a,b){b=a.indexOf(b);0<=b&&
  a.splice(b,1)};c.arraysEqual=function(a,b){let d=a.length;if(b.length!==d)return!1;for(let c=0;c<d;++c)if(a[c]!==b[c])return!1;return!0};c.arrayFilterOut=function(a,b){let d=[],e=0;for(let c=0,h=a.length;c<h;++c){let f=a[c];b(f)?d.push(f):(a[e]=f,++e)}c.truncateArray(a,e);return d};c.arrayRemoveAllInSet=function(a,b){const d=a.length;let e=0;for(let c=0,d=a.length;c<d;++c){let d=a[c];b.has(d)||(a[e++]=d)}c.truncateArray(a,e);return d-e};c.isArrayIndexInBounds=function(a,b){return a!==Math.floor(a)?
  !1:0<=a&&a<b.length};c.validateArrayIndex=function(a,b){if(!c.isArrayIndexInBounds(a,b))throw new RangeError("array index out of bounds");};c.cloneArray=function(a){return a.slice()};c.deepCloneArray=function(a,b){let d=[];for(let e of a)if(c.IsObject(e)){a=b(e);if(!a)throw Error("missing clone");if(a.constructor!==e.constructor)throw Error("object is not a clone");d.push(a)}else c.IsArray(e)?d.push(c.deepCloneArray(e,b)):d.push(e);return d};c.clone2DArray=function(a){let b=[];for(let c of a)b.push(c.slice());
  return b};c.mergeSets=function(a,b){return new Set([...a,...b])};c.first=function(a){for(let b of a)return b;return null};c.xor=function(a,b){return!a!==!b};c.compare=function(a,b,d){switch(b){case 0:return a===d;case 1:return a!==d;case 2:return a<d;case 3:return a<=d;case 4:return a>d;case 5:return a>=d;default:return!1}};c.hasAnyOwnProperty=function(a){for(let b in a)if(a.hasOwnProperty(b))return!0;return!1};c.PromiseAllWithProgress=function(a,b){return a.length?new Promise((c,e)=>{const d=[];
  let h=0,g=!1;for(let f=0,k=a.length;f<k;++f)d.push(void 0),a[f].then(e=>{g||(d[f]=e,++h,h===a.length?c(d):b(h,a.length))}).catch(a=>{g=!0;e(a)})}):Promise.resolve([])};let n=[];c.AddLibraryMemoryCallback=function(a){n.push(a)};c.GetEstimatedLibraryMemoryUsage=function(){let a=0;for(let b of n){let c=b();a+=c}return Math.floor(a)};let q=1;const l=new Map,p=new MessageChannel;p.port2.onmessage=function(a){const b=a.data,d=l.get(b);l.delete(b);d&&d(a.timeStamp)};c.RequestUnlimitedAnimationFrame=function(a){const b=
  q++;l.set(b,a);p.port1.postMessage(b);return b};c.CancelUnlimitedAnimationFrame=function(a){l.delete(a)};c.PostTask=c.RequestUnlimitedAnimationFrame;c.WaitForNextTask=function(){return new Promise(a=>c.PostTask(a))};const k=new Set;c.RequestPostAnimationFrame=function(a){const b=self.requestAnimationFrame(async d=>{await c.WaitForNextTask();k.has(b)&&(k.delete(b),a(d))});k.add(b);return b};c.CancelPostAnimationFrame=function(a){k.has(a)&&(self.cancelAnimationFrame(a),k.delete(a))}};
  
  
  // c3/lib/misc/runtimeutil.js
  'use strict';{const c=self.C3;c.IsAbsoluteURL=function(a){return/^(?:[a-z]+:)?\/\//.test(a)||"data:"===a.substr(0,5)||"blob:"===a.substr(0,5)};c.IsRelativeURL=function(a){return!c.IsAbsoluteURL(a)};c.ThrowIfNotOk=function(a){if(!a.ok)throw Error(`fetch '${a.url}' response returned ${a.status} ${a.statusText}`);};c.FetchOk=function(a,d){return fetch(a,d).then(a=>{c.ThrowIfNotOk(a);return a})};c.FetchText=function(a){return c.FetchOk(a).then(a=>a.text())};c.FetchJson=function(a){return c.FetchOk(a).then(a=>
  a.json())};c.FetchBlob=function(a){return c.FetchOk(a).then(a=>a.blob())};c.FetchArrayBuffer=function(a){return c.FetchOk(a).then(a=>a.arrayBuffer())};c.FetchImage=function(a){return new Promise((d,b)=>{const e=new Image;e.onload=()=>d(e);e.onerror=a=>b(a);e.src=a})};c.BlobToArrayBuffer=function(a){return new Promise((d,b)=>{const e=new FileReader;e.onload=()=>d(e.result);e.onerror=()=>b(e.error);e.readAsArrayBuffer(a)})};c.BlobToString=function(a){return new Promise((d,b)=>{const e=new FileReader;
  e.onload=()=>d(e.result);e.onerror=()=>b(e.error);e.readAsText(a)})};c.BlobToJson=function(a){return c.BlobToString(a).then(a=>JSON.parse(a))};c.BlobToImage=async function(a,d){a=URL.createObjectURL(a);try{const b=await c.FetchImage(a);URL.revokeObjectURL(a);a="";d&&"function"===typeof b.decode&&await b.decode();return b}finally{a&&URL.revokeObjectURL(a)}};c.CreateCanvas=function(a,d){if("undefined"!==typeof document&&"function"===typeof document.createElement){const b=document.createElement("canvas");
  b.width=a;b.height=d;return b}return new OffscreenCanvas(a,d)};c.CanvasToBlob=function(a,d,b){"number"!==typeof b&&(b=1);d=d||"image/png";b=c.clamp(b,0,1);return a.toBlob?new Promise(e=>a.toBlob(e,d,b)):a.convertToBlob?a.convertToBlob({type:d,quality:b}):c.Asyncify(()=>c.CanvasToBlobSync(a,d,b))};c.CanvasToBlobSync=function(a,d,b){"number"!==typeof b&&(b=1);d=d||"image/png";b=c.clamp(b,0,1);return c.DataURIToBinaryBlobSync(a.toDataURL(d,b))};c.DataURIToBinaryBlobSync=function(a){a=c.ParseDataURI(a);
  return c.BinaryStringToBlob(a.data,a.mime_type)};c.ParseDataURI=function(a){if("data:"!==a.substr(0,5))throw new URIError("expected data: uri");var d=a.indexOf(",");if(0>d)throw new URIError("expected comma in data: uri");var b=a.substring(5,d);a=a.substring(d+1);d=b.split(";");b=d[0]||"";let e=d[2];a="base64"===d[1]||"base64"===e?atob(a):decodeURIComponent(a);return{mime_type:b,data:a}};c.BinaryStringToBlob=function(a,d){var b=a.length;let e=b>>2,f=new Uint8Array(b),g=new Uint32Array(f.buffer,0,
  e),k,h;for(h=k=0;k<e;++k)g[k]=a.charCodeAt(h++)|a.charCodeAt(h++)<<8|a.charCodeAt(h++)<<16|a.charCodeAt(h++)<<24;for(b&=3;b--;)f[h]=a.charCodeAt(h),++h;return d?new Blob([f],{type:d}):new Blob([f])};c.DrawableToBlob=function(a,d,b){const e=c.CreateCanvas(a.width,a.height);e.getContext("2d").drawImage(a,0,0);return c.CanvasToBlob(e,d,b)};c.ImageDataToBlobSync=function(a,d,b){const e=c.CreateCanvas(a.width,a.height);e.getContext("2d").putImageData(a,0,0);return c.CanvasToBlobSync(e,d,b)};c.ImageDataToBlob=
  function(a,d,b){if(c.Supports.ImageBitmapOptions)return createImageBitmap(a,{premultiplyAlpha:"none"}).then(a=>c.DrawableToBlob(a,d,b));if(c.Supports.ImageBitmap)return createImageBitmap(a).then(a=>c.DrawableToBlob(a,d,b));{const e=c.CreateCanvas(a.width,a.height);e.getContext("2d").putImageData(a,0,0);return c.CanvasToBlob(e,d,b)}};c.CopySet=function(a,d){a.clear();for(const b of d)a.add(b)};c.MapToObject=function(a){const d=Object.create(null);for(const [b,e]of a.entries())d[b]=e;return d};c.ObjectToMap=
  function(a,d){d.clear();for(const [b,e]of Object.entries(a))d.set(b,e)};c.ToSuperJSON=function b(d){if("object"===typeof d&&null!==d){if(d instanceof Set)return{_c3type_:"set",data:[...d].map(d=>b(d))};if(d instanceof Map)return{_c3type_:"map",data:[...d].map(d=>[d[0],b(d[1])])};{const c=Object.create(null);for(const [e,g]of Object.entries(d))c[e]=b(g);return c}}return d};c.FromSuperJSON=function e(b){if("object"===typeof b&null!==b){if("set"===b._c3type_)return new Set(b.data.map(b=>e(b)));if("map"===
  b._c3type_)return new Map(b.data.map(b=>[b[0],e(b[1])]));{const c=Object.create(null);for(const [g,f]of Object.entries(b))c[g]=e(f);return c}}return b};c.CSSToCamelCase=function(b){let e="",f=!1;for(const c of b)"-"===c?f=!0:f?(e+=c.toUpperCase(),f=!1):e+=c;return e};c.IsIterator=function(b){return"object"===typeof b&&"function"===typeof b.next};c.MakeFilledArray=function(b,e){const f=[];if("function"===typeof e)for(var g=0;g<b;++g)f.push(e());else for(g=0;g<b;++g)f.push(e);return f}};
  
  
  // ../lib/misc/color.js
  'use strict';{var hueToRGB=function(a,b,c){0>c&&(c+=1);1<c&&--c;return c<1/6?a+6*(b-a)*c:.5>c?b:c<2/3?a+(b-a)*(2/3-c)*6:a},padTwoDigits=function(a){return 0===a.length?"00":1===a.length?"0"+a:a};const d=self.C3,h=/([0-9.]+),([0-9.]+)%?,([0-9.]+)%?/i,k=/([0-9.]+),([0-9.]+)%?,([0-9.]+)%?,([0-9.])/i;d.Color=class{constructor(a,b,c,e){this._a=this._b=this._g=this._r=0;a instanceof d.Color?this.set(a):this.setRgba(a||0,b||0,c||0,e||0)}setRgb(a,b,c){this._r=+a;this._g=+b;this._b=+c;this.clamp();return this}setRgba(a,
  b,c,e){this._r=+a;this._g=+b;this._b=+c;this._a=+e;this.clamp();return this}set(a){this._r=a._r;this._g=a._g;this._b=a._b;this._a=a._a;return this}copy(a){return this.set(a)}add(a){this._r+=a._r;this._g+=a._g;this._b+=a._b;this._a+=a._a;this.clamp()}addRgb(a,b,c,e=0){this._r+=+a;this._g+=+b;this._b+=+c;this._a+=+e;this.clamp()}diff(a){this.setR(Math.max(this._r,a._r)-Math.min(this._r,a._r));this.setG(Math.max(this._g,a._g)-Math.min(this._g,a._g));this.setB(Math.max(this._b,a._b)-Math.min(this._b,
  a._b));this.setA(Math.max(this._a,a._a)-Math.min(this._a,a._a));this.clamp()}copyRgb(a){this._r=a._r;this._g=a._g;this._b=a._b}setR(a){this._r=d.clamp(+a,0,1)}getR(){return this._r}setG(a){this._g=d.clamp(+a,0,1)}getG(){return this._g}setB(a){this._b=d.clamp(+a,0,1)}getB(){return this._b}setA(a){this._a=d.clamp(+a,0,1)}getA(){return this._a}clone(){return d.New(d.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(a,
  b){a[b++]=this._r;a[b++]=this._g;a[b++]=this._b;a[b]=this._a}equals(a){return this._r===a._r&&this._g===a._g&&this._b===a._b&&this._a===a._a}equalsIgnoringAlpha(a){return this._r===a._r&&this._g===a._g&&this._b===a._b}equalsRgb(a,b,c){return this._r===a&&this._g===b&&this._b===c}equalsRgba(a,b,c,e){return this._r===a&&this._g===b&&this._b===c&&this._a===e}multiply(a){this._r*=a._r;this._g*=a._g;this._b*=a._b;this._a*=a._a}multiplyAlpha(a){this._r*=a;this._g*=a;this._b*=a;this._a*=a}premultiply(){this._r*=
  this._a;this._g*=this._a;this._b*=this._a;return this}unpremultiply(){this._r/=this._a;this._g/=this._a;this._b/=this._a;return this}clamp(){this._r=d.clamp(this._r,0,1);this._g=d.clamp(this._g,0,1);this._b=d.clamp(this._b,0,1);this._a=d.clamp(this._a,0,1);return this}setFromRgbValue(a){this._r=d.GetRValue(a);this._g=d.GetGValue(a);this._b=d.GetBValue(a);this._a=d.GetAValue(a)}getCssRgb(a,b,c){a=d.IsFiniteNumber(a)?a:this.getR();b=d.IsFiniteNumber(b)?b:this.getG();c=d.IsFiniteNumber(c)?c:this.getB();
  return`rgb(${100*a}%, ${100*b}%, ${100*c}%)`}getCssRgba(a,b,c,e){a=d.IsFiniteNumber(a)?a:this.getR();b=d.IsFiniteNumber(b)?b:this.getG();c=d.IsFiniteNumber(c)?c:this.getB();e=d.IsFiniteNumber(e)?e:this.getA();return`rgba(${100*a}%, ${100*b}%, ${100*c}%, ${e})`}toHexString(){const a=Math.round(255*this.getR()),b=Math.round(255*this.getG()),c=Math.round(255*this.getB());return"#"+padTwoDigits(a.toString(16))+padTwoDigits(b.toString(16))+padTwoDigits(c.toString(16))}parseHexString(a){if("string"!==typeof a)return!1;
  a=a.trim();"#"===a.charAt(0)&&(a=a.substr(1));let b,c;if(3===a.length)b=parseInt(a[0],16)/15,c=parseInt(a[1],16)/15,a=parseInt(a[2],16)/15;else if(6===a.length)b=parseInt(a.substr(0,2),16)/255,c=parseInt(a.substr(2,2),16)/255,a=parseInt(a.substr(4,2),16)/255;else return!1;isFinite(b)&&this.setR(b);isFinite(c)&&this.setG(c);isFinite(a)&&this.setB(a);this.setA(1);return!0}toCommaSeparatedRgb(){const a=Math.round(255*this.getR()),b=Math.round(255*this.getG()),c=Math.round(255*this.getB());return`${a}, ${b}, ${c}`}toRgbArray(){const a=
  Math.round(255*this.getR()),b=Math.round(255*this.getG()),c=Math.round(255*this.getB());return[a,b,c]}parseCommaSeparatedRgb(a){if("string"!==typeof a)return!1;a=a.replace(/^rgb\(|\)|%/,"");var b=a.split(",");if(3>b.length)return!1;a=parseInt(b[0].trim(),10)/255;const c=parseInt(b[1].trim(),10)/255;b=parseInt(b[2].trim(),10)/255;isFinite(a)&&this.setR(a);isFinite(c)&&this.setG(c);isFinite(b)&&this.setB(b);this.setA(1);return!0}parseCommaSeparatedPercentageRgb(a){if("string"!==typeof a)return!1;a=
  a.replace(/^rgb\(|\)|%/,"");var b=a.split(",");if(3>b.length)return!1;a=parseInt(b[0].trim(),10)/100;const c=parseInt(b[1].trim(),10)/100;b=parseInt(b[2].trim(),10)/100;isFinite(a)&&this.setR(a);isFinite(c)&&this.setG(c);isFinite(b)&&this.setB(b);this.setA(1);return!0}parseCommaSeparatedRgba(a){if("string"!==typeof a)return!1;a=a.replace(/^rgba\(|\)|%/,"");var b=a.split(",");if(4>b.length)return!1;a=parseInt(b[0].trim(),10)/255;const c=parseInt(b[1].trim(),10)/255,e=parseInt(b[2].trim(),10)/255;b=
  parseFloat(b[3].trim());isFinite(a)&&this.setR(a);isFinite(c)&&this.setG(c);isFinite(e)&&this.setB(e);isFinite(b)&&this.setA(b);return!0}parseCommaSeparatedPercentageRgba(a){if("string"!==typeof a)return!1;a=a.replace(/^rgba\(|\)|%/,"");var b=a.split(",");if(4>b.length)return!1;a=parseInt(b[0].trim(),10)/100;const c=parseInt(b[1].trim(),10)/100,e=parseInt(b[2].trim(),10)/100;b=parseFloat(b[3].trim());isFinite(a)&&this.setR(a);isFinite(c)&&this.setG(c);isFinite(e)&&this.setB(e);isFinite(b)&&this.setA(b);
  return!0}parseString(a){if("string"!==typeof a)return!1;a=a.replace(/\s+/,"");if(a.includes(",")){if(a.startsWith("rgb("))return a.includes("%")?this.parseCommaSeparatedPercentageRgb(a):this.parseCommaSeparatedRgb(a);if(a.startsWith("rgba("))return a.includes("%")?this.parseCommaSeparatedPercentageRgba(a):this.parseCommaSeparatedRgba(a);if(a.startsWith("hsl(")||a.startsWith("hsla("))return this.parseHSLString(a);{const b=a.split(",");if(a.includes("%")){if(3===b.length)return this.parseCommaSeparatedPercentageRgb(a);
  if(4===b.length)return this.parseCommaSeparatedPercentageRgba(a)}else{if(3===b.length)return this.parseCommaSeparatedRgb(a);if(4===b.length)return this.parseCommaSeparatedRgba(a)}return!1}}return this.parseHexString(a)}toJSON(){return[this._r,this._g,this._b,this._a]}setFromHSLA(a,b,c,e){a%=360;b=d.clamp(b,0,100);c=d.clamp(c,0,100);e=d.clamp(e,0,1);a/=360;b/=100;c/=100;if(0===b)c=b=a=c;else{const d=.5>c?c*(1+b):c+b-c*b,e=2*c-d;c=hueToRGB(e,d,a+1/3);b=hueToRGB(e,d,a);a=hueToRGB(e,d,a-1/3)}this.setR(c);
  this.setG(b);this.setB(a);this.setA(e);return this}parseHSLString(a){var b=a.replace(/ |hsl|hsla|\(|\)|;/gi,"");a=h.exec(b);b=k.exec(b);return a&&4===a.length?(this.setFromHSLA(+a[1],+a[2],+a[3],1),!0):b&&5===b.length?(this.setFromHSLA(+a[1],+a[2],+a[3],+a[4]),!0):!1}toHSLAString(){var a=this._r;const b=this._g,c=this._b,e=this._a,f=d.Color.GetHue(a,b,c),g=d.Color.GetSaturation(a,b,c);a=d.Color.GetLuminosity(a,b,c);return`hsla(${f}, ${g}%, ${a}%, ${e})`}toHSLAArray(){const a=this._r,b=this._g,c=this._b;
  return[d.Color.GetHue(a,b,c),d.Color.GetSaturation(a,b,c),d.Color.GetLuminosity(a,b,c),this._a]}setFromJSON(a){!Array.isArray(a)||3>a.length||(this._r=a[0],this._g=a[1],this._b=a[2],this._a=4<=a.length?a[3]:1)}set r(a){this.setR(a)}get r(){return this.getR()}set g(a){this.setG(a)}get g(){return this.getG()}set b(a){this.setB(a)}get b(){return this.getB()}set a(a){this.setA(a)}get a(){return this.getA()}setAtIndex(a,b){switch(a){case 0:this.setR(b);break;case 1:this.setG(b);break;case 2:this.setB(b);
  break;case 3:this.setA(b);break;default:throw new RangeError("invalid color index");}}getAtIndex(a){switch(a){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 DiffChannel(a,b){return d.clamp(Math.max(a,b)-Math.min(a,b),0,1)}static Diff(a,b){const c=new d.Color;c.setR(Math.max(a._r,b._r)-Math.min(a._r,b._r));c.setG(Math.max(a._g,b._g)-Math.min(a._g,b._g));c.setB(Math.max(a._b,b._b)-Math.min(a._b,
  b._b));c.setA(Math.max(a._a,b._a)-Math.min(a._a,b._a));return c}static DiffNoAlpha(a,b){const c=new d.Color(0,0,0,1);c.setR(Math.max(a._r,b._r)-Math.min(a._r,b._r));c.setG(Math.max(a._g,b._g)-Math.min(a._g,b._g));c.setB(Math.max(a._b,b._b)-Math.min(a._b,b._b));return c}static GetHue(a,b,c){const e=Math.max(a,b,c),f=Math.min(a,b,c);if(e===f)return 0;let g=0;switch(e){case a:g=(b-c)/(e-f)+(b<c?6:0);break;case b:g=(c-a)/(e-f)+2;break;case c:g=(a-b)/(e-f)+4}return Math.round(g/6*360)}static GetSaturation(a,
  b,c){const e=Math.max(a,b,c);a=Math.min(a,b,c);if(e===a)return 0;b=e-a;return Math.round(100*(.5<(e+a)/2?b/(2-e-a):b/(e+a)))}static GetLuminosity(a,b,c){const e=Math.max(a,b,c);return e?Math.round((e+Math.min(a,b,c))/2*100):0}};d.Color.White=Object.freeze(d.New(d.Color,1,1,1,1));d.Color.Black=Object.freeze(d.New(d.Color,0,0,0,1));d.Color.TransparentBlack=Object.freeze(d.New(d.Color,0,0,0,0))};
  
  
  // ../lib/misc/vector2.js
  'use strict';{const c=self.C3;c.Vector2=class{constructor(a,b){this._y=this._x=0;a instanceof c.Vector2?this.copy(a):this.set(a||0,b||0)}set(a,b){this._x=+a;this._y=+b}copy(a){this._x=a._x;this._y=a._y}equals(a){return this._x===a._x&&this._y===a._y}setX(a){this._x=+a}getX(){return this._x}setY(a){this._y=+a}getY(){return this._y}toArray(){return[this._x,this._y]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(a,b){a[b++]=this._x;a[b]=this._y}offset(a,b){this._x+=+a;this._y+=
  +b}scale(a,b){this._x*=a;this._y*=b}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 c.angleTo(0,0,this._x,this._y)}lengthSquared(){return this._x*this._x+this._y*this._y}length(){return Math.sqrt(this.lengthSquared())}rotatePrecalc(a,b){const d=this._x*b-this._y*a;this._y=this._y*b+this._x*a;this._x=d}rotate(a){0!==a&&this.rotatePrecalc(Math.sin(a),
  Math.cos(a))}rotateAbout(a,b,d){0===a||b===this._x&&d===this._y||(this._x-=b,this._y-=d,this.rotatePrecalc(Math.sin(a),Math.cos(a)),this._x+=+b,this._y+=+d)}move(a,b){0!==b&&(this._x+=Math.cos(a)*b,this._y+=Math.sin(a)*b)}normalize(){const a=this.length();0!==a&&1!==a&&(this._x/=a,this._y/=a)}clamp(a,b){this._x=c.clamp(this._x,a,b);this._y=c.clamp(this._y,a,b)}}};
  
  
  // ../lib/misc/rect.js
  'use strict';{const e=self.C3;e.Rect=class{constructor(a,b,c,d){this._bottom=this._right=this._top=this._left=0;a instanceof e.Rect?this.copy(a):this.set(a||0,b||0,c||0,d||0)}set(a,b,c,d){this._left=+a;this._top=+b;this._right=+c;this._bottom=+d}setWH(a,b,c,d){a=+a;b=+b;this._left=a;this._top=b;this._right=a+ +c;this._bottom=b+ +d}copy(a){this._left=+a._left;this._top=+a._top;this._right=+a._right;this._bottom=+a._bottom}clone(){return new e.Rect(this._left,this._top,this._right,this._bottom)}static Merge(a,
  b){const c=new e.Rect;c.setLeft(Math.min(a._left,b._left));c.setTop(Math.min(a._top,b._top));c.setRight(Math.max(a._right,b._right));c.setBottom(Math.max(a._bottom,b._bottom));return c}static FromObject(a){return new e.Rect(a.left,a.top,a.right,a.bottom)}equals(a){return this._left===a._left&&this._top===a._top&&this._right===a._right&&this._bottom===a._bottom}setLeft(a){this._left=+a}getLeft(){return this._left}setTop(a){this._top=+a}getTop(){return this._top}setRight(a){this._right=+a}getRight(){return this._right}setBottom(a){this._bottom=
  +a}getBottom(){return this._bottom}toArray(){return[this._left,this._top,this._right,this._bottom]}toTypedArray(){return new Float64Array(this.toArray())}toDOMRect(){return new DOMRect(this._left,this._top,this.width(),this.height())}writeToTypedArray(a,b){a[b++]=this._left;a[b++]=this._top;a[b++]=this._right;a[b]=this._bottom}writeAsQuadToTypedArray(a,b){a[b++]=this._left;a[b++]=this._top;a[b++]=this._right;a[b++]=this._top;a[b++]=this._right;a[b++]=this._bottom;a[b++]=this._left;a[b]=this._bottom}width(){return this._right-
  this._left}height(){return this._bottom-this._top}midX(){return(this._left+this._right)/2}midY(){return(this._top+this._bottom)/2}offset(a,b){this._left+=+a;this._top+=+b;this._right+=+a;this._bottom+=+b}offsetLeft(a){this._left+=+a}offsetTop(a){this._top+=+a}offsetRight(a){this._right+=+a}offsetBottom(a){this._bottom+=+a}toSquare(a){if("x"!==a)throw Error("invalid axis, only 'x' supported");this._bottom=this._top<this._bottom?this._left<this._right?this._top+this.width():this._top-this.width():this._left<
  this._right?this._top-this.width():this._top+this.width()}inflate(a,b){this._left-=a;this._top-=b;this._right+=+a;this._bottom+=+b}deflate(a,b){this._left+=+a;this._top+=+b;this._right-=a;this._bottom-=b}multiply(a,b){this._left*=a;this._top*=b;this._right*=a;this._bottom*=b}divide(a,b){this._left/=a;this._top/=b;this._right/=a;this._bottom/=b}mirrorAround(a){this._left=+a-this._left;this._right=+a-this._right}flipAround(a){this._top=+a-this._top;this._bottom=+a-this._bottom}swapLeftRight(){const a=
  this._left;this._left=this._right;this._right=a}swapTopBottom(){const a=this._top;this._top=this._bottom;this._bottom=a}shuntY(a){const b=this._top;this._top=+a-this._bottom;this._bottom=+a-b}round(){this._left=Math.round(this._left);this._top=Math.round(this._top);this._right=Math.round(this._right);this._bottom=Math.round(this._bottom)}roundInner(){this._left=Math.ceil(this._left);this._top=Math.ceil(this._top);this._right=Math.floor(this._right);this._bottom=Math.floor(this._bottom)}roundOuter(){this._left=
  Math.floor(this._left);this._top=Math.floor(this._top);this._right=Math.ceil(this._right);this._bottom=Math.ceil(this._bottom)}floor(){this._left=Math.floor(this._left);this._top=Math.floor(this._top);this._right=Math.floor(this._right);this._bottom=Math.floor(this._bottom)}ceil(){this._left=Math.ceil(this._left);this._top=Math.ceil(this._top);this._right=Math.ceil(this._right);this._bottom=Math.ceil(this._bottom)}clamp(a,b,c,d){this._left<a&&(this._left=+a);this._top<b&&(this._top=+b);this._right>
  c&&(this._right=+c);this._bottom>d&&(this._bottom=+d)}clampFlipped(a,b,c,d){this._left<a&&(this._left=+a);this._top>b&&(this._top=+b);this._right>c&&(this._right=+c);this._bottom<d&&(this._bottom=+d)}normalize(){this._left>this._right&&this.swapLeftRight();this._top>this._bottom&&this.swapTopBottom()}intersectsRect(a){return!(a._right<this._left||a._bottom<this._top||a._left>this._right||a._top>this._bottom)}intersectsRectOffset(a,b,c){return!(a._right+b<this._left||a._bottom+c<this._top||a._left+
  b>this._right||a._top+c>this._bottom)}containsPoint(a,b){return a>=this._left&&a<=this._right&&b>=this._top&&b<=this._bottom}containsRect(a){return a._left>=this._left&&a._top>=this._top&&a._right<=this._right&&a._bottom<=this._bottom}expandToContain(a){a._left<this._left&&(this._left=+a._left);a._top<this._top&&(this._top=+a._top);a._right>this._right&&(this._right=+a._right);a._bottom>this._bottom&&(this._bottom=+a._bottom)}lerpInto(a){this._left=e.lerp(a._left,a._right,this._left);this._top=e.lerp(a._top,
  a._bottom,this._top);this._right=e.lerp(a._left,a._right,this._right);this._bottom=e.lerp(a._top,a._bottom,this._bottom)}}};
  
  
  // ../lib/misc/quad.js
  'use strict';{var minmax4=function(a,b,c,d){a<b?c<d?(m=a<c?a:c,n=b>d?b:d):(m=a<d?a:d,n=b>c?b:c):c<d?(m=b<c?b:c,n=a>d?a:d):(m=b<d?b:d,n=a>c?a:c)};const l=self.C3;let m=0,n=0;l.Quad=class{constructor(a,b,c,d,g,h,e,f){this._bly=this._blx=this._bry=this._brx=this._try=this._trx=this._tly=this._tlx=0;a instanceof l.Quad?this.copy(a):this.set(a||0,b||0,c||0,d||0,g||0,h||0,e||0,f||0)}set(a,b,c,d,g,h,e,f){this._tlx=+a;this._tly=+b;this._trx=+c;this._try=+d;this._brx=+g;this._bry=+h;this._blx=+e;this._bly=
  +f}setRect(a,b,c,d){this.set(a,b,c,b,c,d,a,d)}copy(a){this._tlx=a._tlx;this._tly=a._tly;this._trx=a._trx;this._try=a._try;this._brx=a._brx;this._bry=a._bry;this._blx=a._blx;this._bly=a._bly}equals(a){return this._tlx===a._tlx&&this._tly===a._tly&&this._trx===a._trx&&this._try===a._try&&this._brx===a._brx&&this._bry===a._bry&&this._blx===a._blx&&this._bly===a._bly}setTlx(a){this._tlx=+a}getTlx(){return this._tlx}setTly(a){this._tly=+a}getTly(){return this._tly}setTrx(a){this._trx=+a}getTrx(){return this._trx}setTry(a){this._try=
  +a}getTry(){return this._try}setBrx(a){this._brx=+a}getBrx(){return this._brx}setBry(a){this._bry=+a}getBry(){return this._bry}setBlx(a){this._blx=+a}getBlx(){return this._blx}setBly(a){this._bly=+a}getBly(){return this._bly}toDOMQuad(){return new DOMQuad(new DOMPoint(this._tlx,this._tly),new DOMPoint(this._trx,this._try),new DOMPoint(this._brx,this._bry),new DOMPoint(this._blx,this._bly))}toArray(){return[this._tlx,this._tly,this._trx,this._try,this._brx,this._bry,this._blx,this._bly]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(a,
  b){a[b++]=this._tlx;a[b++]=this._tly;a[b++]=this._trx;a[b++]=this._try;a[b++]=this._brx;a[b++]=this._bry;a[b++]=this._blx;a[b]=this._bly}writeToTypedArray3D(a,b,c){a[b++]=this._tlx;a[b++]=this._tly;a[b++]=c;a[b++]=this._trx;a[b++]=this._try;a[b++]=c;a[b++]=this._brx;a[b++]=this._bry;a[b++]=c;a[b++]=this._blx;a[b++]=this._bly;a[b]=c}offset(a,b){this._tlx+=+a;this._tly+=+b;this._trx+=+a;this._try+=+b;this._brx+=+a;this._bry+=+b;this._blx+=+a;this._bly+=+b}round(){this._tlx=Math.round(this._tlx);this._tly=
  Math.round(this._tly);this._trx=Math.round(this._trx);this._try=Math.round(this._try);this._brx=Math.round(this._brx);this._bry=Math.round(this._bry);this._blx=Math.round(this._blx);this._bly=Math.round(this._bly)}floor(){this._tlx=Math.floor(this._tlx);this._tly=Math.floor(this._tly);this._trx=Math.floor(this._trx);this._try=Math.floor(this._try);this._brx=Math.floor(this._brx);this._bry=Math.floor(this._bry);this._blx=Math.floor(this._blx);this._bly=Math.floor(this._bly)}ceil(){this._tlx=Math.ceil(this._tlx);
  this._tly=Math.ceil(this._tly);this._trx=Math.ceil(this._trx);this._try=Math.ceil(this._try);this._brx=Math.ceil(this._brx);this._bry=Math.ceil(this._bry);this._blx=Math.ceil(this._blx);this._bly=Math.ceil(this._bly)}setFromRect(a){this._tlx=a._left;this._tly=a._top;this._trx=a._right;this._try=a._top;this._brx=a._right;this._bry=a._bottom;this._blx=a._left;this._bly=a._bottom}setFromRotatedRect(a,b){0===b?this.setFromRect(a):this.setFromRotatedRectPrecalc(a,Math.sin(b),Math.cos(b))}setFromRotatedRectPrecalc(a,
  b,c){const d=a._left*b,g=a._top*b,h=a._right*b;b*=a._bottom;const e=a._left*c,f=a._top*c,k=a._right*c;a=a._bottom*c;this._tlx=e-g;this._tly=f+d;this._trx=k-g;this._try=f+h;this._brx=k-b;this._bry=a+h;this._blx=e-b;this._bly=a+d}getBoundingBox(a){minmax4(this._tlx,this._trx,this._brx,this._blx);a._left=m;a._right=n;minmax4(this._tly,this._try,this._bry,this._bly);a._top=m;a._bottom=n}containsPoint(a,b){var c=this._trx-this._tlx,d=this._try-this._tly;const g=this._brx-this._tlx,h=this._bry-this._tly;
  a-=this._tlx;b-=this._tly;var e=c*c+d*d;let f=c*g+d*h;d=c*a+d*b;const k=g*g+h*h,q=g*a+h*b;let p=1/(e*k-f*f);c=(k*d-f*q)*p;e=(e*q-f*d)*p;if(0<=c&&0<e&&1>c+e)return!0;c=this._blx-this._tlx;d=this._bly-this._tly;e=c*c+d*d;f=c*g+d*h;d=c*a+d*b;p=1/(e*k-f*f);c=(k*d-f*q)*p;e=(e*q-f*d)*p;return 0<=c&&0<e&&1>c+e}midX(){return(this._tlx+this._trx+this._brx+this._blx)/4}midY(){return(this._tly+this._try+this._bry+this._bly)/4}intersectsSegment(a,b,c,d){return this.containsPoint(a,b)||this.containsPoint(c,d)?
  !0:l.segmentIntersectsQuad(a,b,c,d,this)}intersectsQuad(a){var b=a.midX(),c=a.midY();if(this.containsPoint(b,c))return!0;b=this.midX();c=this.midY();if(a.containsPoint(b,c))return!0;b=this._tlx;c=this._tly;const d=this._trx,g=this._try,h=this._brx,e=this._bry,f=this._blx,k=this._bly;return l.segmentIntersectsQuad(b,c,d,g,a)||l.segmentIntersectsQuad(d,g,h,e,a)||l.segmentIntersectsQuad(h,e,f,k,a)||l.segmentIntersectsQuad(f,k,b,c,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(a,b){const c=this._getAtIndex(a);this._setAtIndex(a,this._getAtIndex(b));this._setAtIndex(b,c)}_getAtIndex(a){switch(a){case 0:return this._tlx;case 1:return this._tly;case 2:return this._trx;case 3:return this._try;case 4:return this._brx;case 5:return this._bry;case 6:return this._blx;case 7:return this._bly;default:throw new RangeError("invalid quad point index");}}_setAtIndex(a,
  b){b=+b;switch(a){case 0:this._tlx=b;break;case 1:this._tly=b;break;case 2:this._trx=b;break;case 3:this._try=b;break;case 4:this._brx=b;break;case 5:this._bry=b;break;case 6:this._blx=b;break;case 7:this._bly=b;break;default:throw new RangeError("invalid quad point index");}}}};
  
  
  // c3/lib/misc/collisionPoly.js
  'use strict';{const r=self.C3,C=[0,0,1,0,1,1,0,1],t=r.New(r.Quad);r.CollisionPoly=class extends r.DefendedBase{constructor(a,d=!0){super();a||(a=C);this._ptsArr=Float64Array.from(a);this._bbox=new r.Rect;this._isBboxChanged=!0;this._enabled=d}Release(){}pointsArr(){return this._ptsArr}pointCount(){return this._ptsArr.length/2}setPoints(a){this._ptsArr.length===a.length?this._ptsArr.set(a):this._ptsArr=Float64Array.from(a);this._isBboxChanged=!0}copy(a){this.setPoints(a._ptsArr)}setBboxChanged(){this._isBboxChanged=
  !0}_updateBbox(){if(this._isBboxChanged){var a=this._ptsArr,d=a[0],b=a[1],c=d,e=b;for(let f=0,g=a.length;f<g;f+=2){const g=a[f],h=a[f+1];g<d&&(d=g);g>c&&(c=g);h<b&&(b=h);h>e&&(e=h)}this._bbox.set(d,b,c,e);this._isBboxChanged=!1}}setFromRect(a,d,b){let c=this._ptsArr;8!==c.length&&(this._ptsArr=c=new Float64Array(8));c[0]=a.getLeft()-d;c[1]=a.getTop()-b;c[2]=a.getRight()-d;c[3]=a.getTop()-b;c[4]=a.getRight()-d;c[5]=a.getBottom()-b;c[6]=a.getLeft()-d;c[7]=a.getBottom()-b;this._bbox.copy(a);0===d&&0===
  b||this._bbox.offset(-d,-b);this._isBboxChanged=!1}setFromQuad(a,d,b){t.copy(a);t.offset(d,b);this.setPoints(t.toArray());this._isBboxChanged=!0}transform(a,d,b){let c=0,e=1;0!==b&&(c=Math.sin(b),e=Math.cos(b));this.transformPrecalc(a,d,c,e)}transformPrecalc(a,d,b,c){const e=this._ptsArr;for(let f=0,g=e.length;f<g;f+=2){const g=f+1,h=e[f]*a,k=e[g]*d;e[f]=h*c-k*b;e[g]=k*c+h*b}this._isBboxChanged=!0}offset(a,d){const b=this._ptsArr;for(let c=0,e=b.length;c<e;c+=2)b[c]+=a,b[c+1]+=d}containsPoint(a,d){const b=
  this._ptsArr;if(a===b[0]&&d===b[1])return!0;this._updateBbox();var c=this._bbox;const e=c.getLeft()-110,f=c.getTop()-101,g=c.getRight()+131;c=c.getBottom()+120;let l,h,k,m,n,p,q,w;e<a?(l=e,k=a):(l=a,k=e);f<d?(h=f,m=d):(h=d,m=f);g<a?(n=g,q=a):(n=a,q=g);c<d?(p=c,w=d):(p=d,w=c);let x=0,y=0;for(let u=0,t=b.length;u<t;u+=2){var v=(u+2)%t;const z=b[u],A=b[u+1],B=b[v];v=b[v+1];r.segmentsIntersectPreCalc(e,f,a,d,l,k,h,m,z,A,B,v)&&++x;r.segmentsIntersectPreCalc(g,c,a,d,n,q,p,w,z,A,B,v)&&++y}return 1===x%2||
  1===y%2}intersectsPoly(a,d,b){const c=a._ptsArr,e=this._ptsArr;if(this.containsPoint(c[0]+d,c[1]+b)||a.containsPoint(e[0]-d,e[1]-b))return!0;for(let g=0,l=e.length;g<l;g+=2){var f=(g+2)%l;a=e[g];const h=e[g+1],k=e[f];f=e[f+1];let m,n,p,q;a<k?(m=a,p=k):(m=k,p=a);h<f?(n=h,q=f):(n=f,q=h);for(let e=0,g=c.length;e<g;e+=2){const l=(e+2)%g;if(r.segmentsIntersectPreCalc(a,h,k,f,m,p,n,q,c[e]+d,c[e+1]+b,c[l]+d,c[l+1]+b))return!0}}return!1}intersectsSegment(a,d,b,c,e,f){if(this.containsPoint(b-a,c-d)||this.containsPoint(e-
  a,f-d))return!0;let g,l,h,k;b<e?(g=b,h=e):(g=e,h=b);c<f?(l=c,k=f):(l=f,k=c);const m=this._ptsArr;for(let n=0,p=m.length;n<p;n+=2){const q=(n+2)%p;if(r.segmentsIntersectPreCalc(b,c,e,f,g,h,l,k,m[n]+a,m[n+1]+d,m[q]+a,m[q+1]+d))return!0}return!1}mirror(a){const d=this._ptsArr;for(let b=0,c=d.length;b<c;b+=2)d[b]=2*a-d[b];this._isBboxChanged=!0}flip(a){const d=this._ptsArr;for(let b=0,c=d.length;b<c;b+=2){const c=b+1;d[c]=2*a-d[c]}this._isBboxChanged=!0}diag(){const a=this._ptsArr;for(let d=0,b=a.length;d<
  b;d+=2){const c=d+1,b=a[d];a[d]=a[c];a[c]=b}this._isBboxChanged=!0}GetMidX(){const a=this._ptsArr;let d=0;for(let b=0,c=a.length;b<c;b+=2)d+=a[b];return d/this.pointCount()}GetMidY(){const a=this._ptsArr;let d=0;for(let b=0,c=a.length;b<c;b+=2)d+=a[b+1];return d/this.pointCount()}GetPointsArray(){return this._ptsArr}GetPointCount(){return this.pointCount()}IsEnabled(){return this._enabled}}};
  
  
  // c3/lib/misc/pairMap.js
  'use strict';{const f=self.C3;f.PairMap=class extends f.DefendedBase{constructor(a){super();this._firstMap=new Map;if(a)for(const [b,c,d]of a)this.Set(b,c,d)}Release(){this.Clear();this._firstMap=null}Clear(){const a=this._firstMap;for(const b of a.values())b.clear();a.clear()}Set(a,b,c){const d=this._firstMap;let e=d.get(a);e||(e=new Map,d.set(a,e));e.set(b,c)}Get(a,b){return(a=this._firstMap.get(a))?a.get(b):a}Has(a,b){return(a=this._firstMap.get(a))?a.has(b):!1}Delete(a,b){const c=this._firstMap,
  d=c.get(a);if(!d)return!1;(b=d.delete(b))&&0===d.size&&c.delete(a);return b}DeleteEither(a){const b=this._firstMap,c=b.get(a);c&&(c.clear(),b.delete(a));for(const [c,e]of b.entries())e.delete(a)&&0===e.size&&b.delete(c)}GetSize(){let a=0;for(const b of this._firstMap.values())a+=b.size;return a}*values(){for(const a of this._firstMap.values())yield*a.values()}*keyPairs(){for(const [a,b]of this._firstMap.entries())for(const c of b.keys())yield[a,c]}*entries(){for(const [a,b]of this._firstMap.entries())for(const [c,
  d]of b.entries())yield[a,c,d]}}};
  
  
  // c3/lib/misc/arraySet.js
  'use strict';{const b=self.C3;b.ArraySet=class extends b.DefendedBase{constructor(){super();this._set=new Set;this._arr=[];this._needToRebuildArray=!1}Release(){this.Clear()}Clear(){this._set.clear();b.clearArray(this._arr);this._needToRebuildArray=!1}Add(a){this._set.has(a)||(this._set.add(a),this._needToRebuildArray||this._arr.push(a))}Has(a){return this._set.has(a)}Delete(a){this._set.delete(a)&&(this._needToRebuildArray=!0)}GetSize(){return this._set.size}IsEmpty(){return 0===this._set.size}GetArray(){this._needToRebuildArray&&
  (this._RebuildArray(),this._needToRebuildArray=!1);return this._arr}_RebuildArray(){const a=this._arr;b.clearArray(a);for(const b of this._set)a.push(b)}}};
  
  
  // ../lib/misc/ease.js
  'use strict';{const m=new Map,n=new Map,l=new Map,r=new Map,p=new Map,t=new Map;t.set("linear","noease");t.set("default","noease");self.Ease=class h{constructor(){}static InheritEase(){return"default"}static DefaultEase(){return"noease"}static GetEditorEaseNames(a,...b){this._CreateEaseMap();l.has(a)||l.set(a,new Map);a=l.get(a);return[...n.keys()].concat([...a.keys()]).filter(a=>!b.includes(a))}static GetRuntimeEaseNames(){this._CreateEaseMap();return[...n.keys()].concat([...r.keys()])}static IsNamePredefined(a){this._CreateEaseMap();
  return[...n.keys()].includes(a)}static _GetEase(a){const b=t.get(a);if(b)return m.get(b);if(h.IsNamePredefined(a))return m.get(a);if(p.has(a))return p.get(a)}static GetEditorEase(a,b){this._CreateEaseMap();const c=h._GetEase(a);return c?c:l.get(b).get(a)}static GetRuntimeEase(a){this._CreateEaseMap();const b=h._GetEase(a);return b?b:r.get(a)}static GetEaseFromIndex(a){this._CreateEaseMap();return this.GetRuntimeEaseNames()[a]}static GetIndexForEase(a,b){this._CreateEaseMap();return this.GetEditorEaseNames(b).indexOf(a)}static _CreateEaseMap(){0===
  m.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(a,b){h._AddEase(a,b,"predefined")}static _AddPrivateCustomEase(a,
  b){h._AddEase(a,b,"private")}static AddCustomEase(a,b,c){this._CreateEaseMap();h._AddEase(a,b,"custom",c)}static RemoveCustomEase(a,b){this.IsNamePredefined(a)||[...p.keys()].includes(a)||(b=l.get(b))&&b.delete(a)}static _AddEase(a,b,c,d){switch(c){case "predefined":m.set(a,b);n.set(a,b);break;case "custom":d?(l.has(d)||l.set(d,new Map),l.get(d).set(a,b)):r.set(a,b);break;case "private":m.set(a,b);p.set(a,b);break;default:throw Error("unexpected ease mode");}}static NoEase(a,b,c,d){return c*a/d+b}static EaseInQuad(a,
  b,c,d){return c*(a/=d)*a+b}static EaseOutQuad(a,b,c,d){return-c*(a/=d)*(a-2)+b}static EaseInOutQuad(a,b,c,d){return 1>(a/=d/2)?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b}static EaseInCubic(a,b,c,d){return c*(a/=d)*a*a+b}static EaseOutCubic(a,b,c,d){return c*((a=a/d-1)*a*a+1)+b}static EaseInOutCubic(a,b,c,d){return 1>(a/=d/2)?c/2*a*a*a+b:c/2*((a-=2)*a*a+2)+b}static EaseInQuart(a,b,c,d){return c*(a/=d)*a*a*a+b}static EaseOutQuart(a,b,c,d){return-c*((a=a/d-1)*a*a*a-1)+b}static EaseInOutQuart(a,b,c,d){return 1>(a/=
  d/2)?c/2*a*a*a*a+b:-c/2*((a-=2)*a*a*a-2)+b}static EaseInQuint(a,b,c,d){return c*(a/=d)*a*a*a*a+b}static EaseOutQuint(a,b,c,d){return c*((a=a/d-1)*a*a*a*a+1)+b}static EaseInOutQuint(a,b,c,d){return 1>(a/=d/2)?c/2*a*a*a*a*a+b:c/2*((a-=2)*a*a*a*a+2)+b}static EaseInSine(a,b,c,d){return-c*Math.cos(a/d*(Math.PI/2))+c+b}static EaseOutSine(a,b,c,d){return c*Math.sin(a/d*(Math.PI/2))+b}static EaseInOutSine(a,b,c,d){return-c/2*(Math.cos(Math.PI*a/d)-1)+b}static EaseInExpo(a,b,c,d){return 0===a?b:c*Math.pow(2,
  10*(a/d-1))+b}static EaseOutExpo(a,b,c,d){return a===d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b}static EaseInOutExpo(a,b,c,d){return 0===a?b:a===d?b+c:1>(a/=d/2)?c/2*Math.pow(2,10*(a-1))+b:c/2*(-Math.pow(2,-10*--a)+2)+b}static EaseInCirc(a,b,c,d){return-c*(Math.sqrt(1-(a/=d)*a)-1)+b}static EaseOutCirc(a,b,c,d){return c*Math.sqrt(1-(a=a/d-1)*a)+b}static EaseInOutCirc(a,b,c,d){return 1>(a/=d/2)?-c/2*(Math.sqrt(1-a*a)-1)+b:c/2*(Math.sqrt(1-(a-=2)*a)+1)+b}static EaseInElastic(a,b,c,d){let e=0,f=c;if(0===a)return b;
  if(1===(a/=d))return b+c;e||(e=.3*d);f<Math.abs(c)?(f=c,c=e/4):c=e/(2*Math.PI)*Math.asin(c/f);return-(f*Math.pow(2,10*--a)*Math.sin(2*(a*d-c)*Math.PI/e))+b}static EaseOutElastic(a,b,c,d){let e,f=0,g=c;if(0===a)return b;if(1===(a/=d))return b+c;f||(f=.3*d);g<Math.abs(c)?(g=c,e=f/4):e=f/(2*Math.PI)*Math.asin(c/g);return g*Math.pow(2,-10*a)*Math.sin(2*(a*d-e)*Math.PI/f)+c+b}static EaseInOutElastic(a,b,c,d){let e,f=0,g=c;if(0===a)return b;if(2===(a/=d/2))return b+c;f||(f=.3*d*1.5);g<Math.abs(c)?(g=c,
  e=f/4):e=f/(2*Math.PI)*Math.asin(c/g);return 1>a?-.5*g*Math.pow(2,10*--a)*Math.sin(2*(a*d-e)*Math.PI/f)+b:g*Math.pow(2,-10*--a)*Math.sin(2*(a*d-e)*Math.PI/f)*.5+c+b}static EaseInBack(a,b,c,d,e){void 0===e&&(e=1.70158);return c*(a/=d)*a*((e+1)*a-e)+b}static EaseOutBack(a,b,c,d,e){void 0===e&&(e=1.70158);return c*((a=a/d-1)*a*((e+1)*a+e)+1)+b}static EaseInOutBack(a,b,c,d,e){void 0===e&&(e=1.70158);return 1>(a/=d/2)?c/2*a*a*(((e*=1.525)+1)*a-e)+b:c/2*((a-=2)*a*(((e*=1.525)+1)*a+e)+2)+b}static EaseInBounce(a,
  b,c,d){return c-h.EaseOutBounce(d-a,0,c,d)+b}static EaseOutBounce(a,b,c,d){return(a/=d)<1/2.75?7.5625*c*a*a+b:a<2/2.75?c*(7.5625*(a-=1.5/2.75)*a+.75)+b:a<2.5/2.75?c*(7.5625*(a-=2.25/2.75)*a+.9375)+b:c*(7.5625*(a-=2.625/2.75)*a+.984375)+b}static EaseInOutBounce(a,b,c,d){return a<d/2?.5*h.EaseInBounce(2*a,0,c,d)+b:.5*h.EaseOutBounce(2*a-d,0,c,d)+.5*c+b}static EaseCubicBezier(a,b,c,d,e){return b+3*a*(c-b)+3*a**2*(b+d-2*c)+a**3*(e-b+3*c-3*d)}static EaseSpline(a,b,c,d,e,f,g,k,u,z){if(d===e&&f===g)return a;
  a=A(a,b,d,f,k,z);b=v(c,e,g,u);d=w(c,e,g,u);c=x(c,e,g,u);return q(a,b,d,c)}static GetBezierSamples(a,b,c,d){const e=[],f=v(a,b,c,d),g=w(a,b,c,d);a=x(a,b,c,d);for(b=0;11>b;++b)c=q(.1*b,f,g,a),e.push(c);return e}};const v=(h,a,b,c)=>c-3*b+3*a-h,w=(h,a,b,c)=>3*b-6*a+3*h,x=(h,a,b,c)=>3*(a-h),q=(h,a,b,c)=>((a*h+b)*h+c)*h,y=(h,a,b,c)=>3*a*h*h+2*b*h+c,A=(h,a,b,c,d,e)=>{if(1==h)return 1;for(var f=0,g=1,k=e[g];10!=g&&k<=h;)g++,k=e[g],f+=.1;g--;k=e[g];e=f+(h-k)/(e[g+1]-k)*.1;g=v(a,b,c,d);k=w(a,b,c,d);a=x(a,
  b,c,d);b=y(e,g,k,a);if(0!==b)if(.02<=b)for(f=0;4>f;++f)b=q(e,g,k,a)-h,c=y(e,g,k,a),e-=b/c;else{b=f;f+=.1;c=0;let l;do e=b+(f-b)/2,d=q(e,g,k,a)-h,0<d?f=e:b=e,d=1E-7<Math.abs(d),l=10>++c;while(d&&l)}return e}};
  
  
  // ../lib/misc/probability.js
  'use strict';{var RequireStringOrNumber=function(a){b.IsString(a)};const b=self.C3;b.ProbabilityTable=class{constructor(){this._items=[];this._totalWeight=0}Release(){this.Clear();this._items=null}Clear(){b.clear2DArray(this._items);this._totalWeight=0}GetTotalWeight(){return this._totalWeight}Sample(a=Math.random()*this.GetTotalWeight()){let c=0;for(const [e,d]of this._items)if(c+=e,a<c)return d;return 0}AddItem(a,c){RequireStringOrNumber(c);this._totalWeight+=a;this._items.push([a,c])}RemoveItem(a,
  c){RequireStringOrNumber(c);const e=0===a;for(let d=0;d<this._items.length;d++){const b=this._items[d],f=b[1]===c;if((e||b[0]===a)&&f){this._items.splice(d,1);this._totalWeight-=b[0];break}}}asJSON(){return JSON.stringify(this._items)}static fromJSON(a){const c=new b.ProbabilityTable;a=JSON.parse(a);for(const b of a)c.AddItem(b[0],b[1]);return c}}};
  
  
  // ../lib/events/event.js
  'use strict';self.C3.Event=class{constructor(a,b){this.type=a;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}};
  
  
  // ../lib/events/handler.js
  'use strict';{const e=self.C3;e.Event.Handler=class extends e.DefendedBase{constructor(a){super();this._type=a;this._captureListeners=[];this._captureListenersSet=new Set;this._listeners=[];this._listenersSet=new Set;this._fireDepth=0;this._queueAddListeners=[];this._queueRemoveCaptureListeners=[];this._queueRemoveListeners=[]}Release(){0<this._fireDepth||(e.clearArray(this._captureListeners),this._captureListenersSet.clear(),e.clearArray(this._listeners),this._listenersSet.clear(),e.clearArray(this._queueAddListeners),
  e.clearArray(this._queueRemoveCaptureListeners),e.clearArray(this._queueRemoveListeners),e.Release(this))}_AddListener(a,b){this._IsFiring()?this._queueAddListeners.push([a,b]):b?this._captureListenersSet.has(a)||(this._captureListeners.push(a),this._captureListenersSet.add(a)):this._listenersSet.has(a)||(this._listeners.push(a),this._listenersSet.add(a))}_RemoveListener(a,b){this._IsFiring()?b?this._queueRemoveCaptureListeners.push(a):this._queueRemoveListeners.push(a):b?this._captureListenersSet.has(a)&&
  (this._captureListenersSet.delete(a),e.arrayFindRemove(this._captureListeners,a)):this._listenersSet.has(a)&&(this._listenersSet.delete(a),e.arrayFindRemove(this._listeners,a))}_IsEmpty(){return!this._captureListeners.length&&!this._listeners.length}_IsFiring(){return 0<this._fireDepth}_ProcessQueuedListeners(){for(var a of this._queueAddListeners)this._AddListener(...a);e.clearArray(this._queueAddListeners);for(var b of this._queueRemoveListeners)this._listenersSet.delete(b);for(const a of this._queueRemoveCaptureListeners)this._captureListenersSet.delete(a);
  a=new Set(this._queueRemoveListeners);b=new Set(this._queueRemoveCaptureListeners);e.arrayRemoveAllInSet(this._listeners,a);e.arrayRemoveAllInSet(this._captureListeners,b);e.clearArray(this._queueRemoveCaptureListeners);e.clearArray(this._queueRemoveListeners)}_FireCancellable(a){this._IncreaseFireDepth();let b=!1;for(let c=0,d=this._captureListeners.length;c<d;++c)if(this._captureListeners[c](a),a.propagationStopped){b=!0;break}if(!b)for(let b=0,d=this._listeners.length;b<d&&(this._listeners[b](a),
  !a.propagationStopped);++b);this._DecreaseFireDepth();return!a.defaultPrevented}_FireNonCancellable(a){this._IncreaseFireDepth();for(let b=0,c=this._captureListeners.length;b<c;++b)this._captureListeners[b](a);for(let b=0,c=this._listeners.length;b<c;++b)this._listeners[b](a);this._DecreaseFireDepth();return!0}_IncreaseFireDepth(){this._fireDepth++}_DecreaseFireDepth(){this._fireDepth--;0===this._fireDepth&&(this._queueAddListeners.length||this._queueRemoveCaptureListeners.length||this._queueRemoveListeners.length)&&
  this._ProcessQueuedListeners()}SetDelayRemoveEventsEnabled(a){a?this._IncreaseFireDepth():this._DecreaseFireDepth()}_FireAsync(a){let b=[];for(let c=0,d=this._captureListeners.length;c<d;++c){let d=this._captureListeners[c];b.push(e.Asyncify(()=>d(a)))}for(let c=0,d=this._listeners.length;c<d;++c){let d=this._listeners[c];b.push(e.Asyncify(()=>d(a)))}return Promise.all(b).then(()=>!a.defaultPrevented)}_FireAndWait_AsyncOptional(a){const b=[];this._IncreaseFireDepth();for(let d=0,e=this._captureListeners.length;d<
  e;++d){var c=this._captureListeners[d](a);c instanceof Promise&&b.push(c)}for(let d=0,e=this._listeners.length;d<e;++d)c=this._listeners[d](a),c instanceof Promise&&b.push(c);this._DecreaseFireDepth();return b.length?Promise.all(b).then(()=>!a.defaultPrevented):!a.defaultPrevented}async _FireAndWaitAsync(a){return await this._FireAndWait_AsyncOptional(a)}async _FireAndWaitAsyncSequential(a){this._IncreaseFireDepth();for(let c=0,d=this._captureListeners.length;c<d;++c){var b=this._captureListeners[c](a);
  b instanceof Promise&&await b}for(let c=0,d=this._listeners.length;c<d;++c)b=this._listeners[c](a),b instanceof Promise&&await b;this._DecreaseFireDepth();return!a.defaultPrevented}*_FireAsGenerator(a){this._IncreaseFireDepth();for(let c=0,d=this._captureListeners.length;c<d;++c){var b=this._captureListeners[c](a);e.IsIterator(b)&&(yield*b)}for(let c=0,d=this._listeners.length;c<d;++c)b=this._listeners[c](a),e.IsIterator(b)&&(yield*b);this._DecreaseFireDepth()}}};
  
  
  // ../lib/events/dispatcher.js
  'use strict';{const d=self.C3;d.Event.Dispatcher=class extends d.DefendedBase{constructor(){super();this._eventHandlers=new Map;this._dispatcherWasReleased=!1}Release(){if(this._dispatcherWasReleased)throw Error("already released");this.ClearEvents();this._dispatcherWasReleased=!0;d.Release(this)}WasReleased(){return this._dispatcherWasReleased}ClearEvents(){for(let a of this._eventHandlers.values())a.Release();this._eventHandlers.clear()}_GetHandlerByType(a,b){let c=this._eventHandlers.get(a);return c?
  c:b?(c=d.New(d.Event.Handler,a),this._eventHandlers.set(a,c),c):null}HasAnyHandlerFor(a){return this._eventHandlers.has(a)}addEventListener(a,b,c){this._GetHandlerByType(a,!0)._AddListener(b,!!c)}removeEventListener(a,b,c){let e=this._GetHandlerByType(a,!1);e&&(e._RemoveListener(b,!!c),e._IsEmpty()&&this._eventHandlers.delete(a))}dispatchEvent(a){const b=this._GetHandlerByType(a.type,!1);return b?a.cancelable?b._FireCancellable(a):b._FireNonCancellable(a):!0}dispatchEventAsync(a){const b=this._GetHandlerByType(a.type,
  !1);if(!b)return Promise.resolve(!0);a.isAsync=!0;return b._FireAsync(a)}async dispatchEventAndClearAsync(a){const b=this._GetHandlerByType(a.type,!1);if(!b)return!0;this._eventHandlers.delete(a.type);a.isAsync=!0;a=await b._FireAsync(a);b.Release();return a}async dispatchEventAndWaitAsync(a){const b=this._GetHandlerByType(a.type,!1);return b?await b._FireAndWaitAsync(a):!0}dispatchEventAndWait_AsyncOptional(a){const b=this._GetHandlerByType(a.type,!1);return b?b._FireAndWait_AsyncOptional(a):!0}async dispatchEventAndWaitAsyncSequential(a){const b=
  this._GetHandlerByType(a.type,!1);return b?await b._FireAndWaitAsyncSequential(a):!0}dispatchGeneratorEvent(a){const b=this._GetHandlerByType(a.type,!1);if(!b)return null;if(a.cancelable)throw Error("not supported");return b._FireAsGenerator(a)}SetDelayRemoveEventsEnabled(a){for(const b of this._eventHandlers.values())b.SetDelayRemoveEventsEnabled(a)}}};
  
  
  // ../lib/util/asyncify.js
  'use strict';{var DoNextAsyncifiedJob=function(a){let b;try{b=a.func()}catch(f){a.reject(f);return}a.resolve(b)},DoAsyncifiedWork=function(a){g=-1;if(e.length){var b=performance.now(),f=0;do{DoNextAsyncifiedJob(e.shift());var h=performance.now();++f;var k=(h-b)/f*1.1}while(e.length&&(l&&0===c&&"undefined"!==typeof a?k<a.timeRemaining():12>h-b+k));-1===g&&e.length&&SetNewCallback(Math.max(16-(h-b),4))}},SetNewCallback=function(a){g=l&&0===c?requestIdleCallback(DoAsyncifiedWork,{timeout:35}):setTimeout(DoAsyncifiedWork,
  0<c?1:a)};const d=self.C3,l="undefined"!==typeof requestIdleCallback;let e=[],g=-1,c=0,m=d.QueryString.Has("disable-asyncify");m&&console.warn("[Asyncify] Asyncify has been disabled due to disable-asyncify in the query string. Some work will now be done synchronously.");d.Asyncify=function(a){let b=null;d.isDebug&&(b=d.GetCallStack());return new Promise((c,d)=>{e.push({func:a,resolve:c,reject:d,stack:b});m?DoNextAsyncifiedJob(e.pop()):-1===g&&SetNewCallback(16)})};d.Asyncify.SetHighThroughputMode=
  function(a){if(a)++c;else if(--c,0>c)throw Error("already turned off high throughput mode");}};
  
  
  // ../lib/util/idleTimeout.js
  'use strict';{var CheckActiveIdleTimeouts=function(){c=a=-1;let b=Date.now();for(let a of d)if(a._CheckTimeout(b)){let b=a._GetDeadline();if(-1===c||b<c)c=b}else d.delete(a);-1!==c&&(a=self.setTimeout(CheckActiveIdleTimeouts,Math.max(c-b+100,1E3)))},ClearTimeCache=function(){e=-1};const f=self.C3;let e=-1;f.FastGetDateNow=function(){-1===e&&(e=Date.now(),self.setTimeout(ClearTimeCache,16));return e};let a=-1,c=-1,d=new Set;f.IdleTimeout=class{constructor(b,g){this._callback=b;this._timeout=1E3*g;
  this._deadline=0;this._isActive=!1}Reset(){let b=f.FastGetDateNow();this._deadline=b+this._timeout;this._isActive||(d.add(this),this._isActive=!0);-1===a?(c=this._deadline,a=self.setTimeout(CheckActiveIdleTimeouts,this._timeout+100)):this._deadline<c&&c>b+1E3&&(self.clearTimeout(a),c=this._deadline,a=self.setTimeout(CheckActiveIdleTimeouts,this._timeout+100))}_CheckTimeout(b){return b>=this._deadline?this._callback()?(this._deadline=b+this._timeout,!0):this._isActive=!1:!0}_GetDeadline(){return this._deadline}Cancel(){this._isActive&&
  (d.delete(this),this._isActive=!1,0===d.size&&-1!==a&&(self.clearTimeout(a),c=a=-1))}Release(){this.Cancel();this._callback=null}}};
  
  
  // ../lib/util/disposable.js
  'use strict';{const c=self.C3;c.Disposable=class a{constructor(b){this._disposed=!1;this._disposeAction=b}Dispose(){this._disposed||(this._disposed=!0,this._disposeAction&&(this._disposeAction(),this._disposeAction=null))}IsDisposed(){return this._disposed}Release(){this.Dispose()}static Release(b){return new a(()=>b.Release())}static From(b,e,f,d,g){if("undefined"===typeof d||null===d)d=!1;else if("boolean"!==typeof d&&"object"!==typeof d)throw new TypeError("invalid event listener options");g&&
  (f=f.bind(g));if(e.includes(" ")){e=e.split(" ");g=new c.CompositeDisposable;for(let a of e)b.addEventListener(a,f,d),g.Add(c.New(c.Disposable,()=>b.removeEventListener(a,f,d)));return g}b.addEventListener(e,f,d);return c.New(c.Disposable,()=>b.removeEventListener(e,f,d))}};c.StubDisposable=class extends c.Disposable{SetAction(a){this._disposeAction=a}};c.CompositeDisposable=class extends c.Disposable{constructor(...a){super();this._disposables=new Set;for(let b of a)this.Add(b)}Add(...a){if(this._disposed)throw Error("already disposed");
  for(let b of a)this._disposables.add(b)}Remove(a){if(this._disposed)throw Error("already disposed");this._disposables.delete(a)}RemoveAll(){if(this._disposed)throw Error("already disposed");if(this._disposables){for(let a of this._disposables)a.Dispose();this._disposables.clear()}}IsDisposed(){return this._disposed}Dispose(){if(this._disposed)throw Error("already disposed");this._disposed=!0;for(let a of this._disposables)a.Dispose();this._disposables.clear();this._disposables=null}Release(){this.Dispose()}}};
  
  
  // c3/lib/util/kahanSum.js
  'use strict';{const b=self.C3;b.KahanSum=class extends b.DefendedBase{constructor(){super();this._sum=this._t=this._y=this._c=0}Add(a){this._y=+a-this._c;this._t=this._sum+this._y;this._c=this._t-this._sum-this._y;this._sum=this._t}Subtract(a){this._sum-=+a}Get(){return this._sum}Reset(){this._sum=this._t=this._y=this._c=0}Set(a){this._t=this._y=this._c=0;this._sum=+a}Release(){}}};
  
  
  // c3/lib/util/redblackset.js
  'use strict';{const f=self.C3,d={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 d.RBnode(this);this.sentinel.color=!1;this.root=this.sentinel;this.root.parent=this.sentinel;this.compare=a||this.default_compare}};d.RedBlackSet.prototype.default_compare=function(a,b){return a<b?-1:b<a?1:0};d.RedBlackSet.prototype.clone=function(){var a=new d.RedBlackSet(this.compare);a.insertAll(this);
  return a};d.RedBlackSet.prototype.clear=function(){this.size=0;this.sentinel=new d.RBnode(this);this.sentinel.color=!1;this.root=this.sentinel;this.root.parent=this.sentinel};d.RedBlackSet.prototype.leftRotate=function(a){var b=a.right;a.right=b.left;b.left!=this.sentinel&&(b.left.parent=a);b.parent=a.parent;a.parent==this.sentinel?this.root=b:a==a.parent.left?a.parent.left=b:a.parent.right=b;b.left=a;a.parent=b};d.RedBlackSet.prototype.rightRotate=function(a){var b=a.left;a.left=b.right;b.right!=
  this.sentinel&&(b.right.parent=a);b.parent=a.parent;a.parent==this.sentinel?this.root=b:a==a.parent.right?a.parent.right=b:a.parent.left=b;b.right=a;a.parent=b};d.RedBlackSet.prototype.insert=function(a){if(this.contains(a))this.get_(a).key=a;else{var b=new d.RBnode(this);b.key=a;a=this.sentinel;for(var c=this.root;c!=this.sentinel;)a=c,c=0>this.compare(b.key,c.key)?c.left:c.right;b.parent=a;a==this.sentinel?this.root=b:0>this.compare(b.key,a.key)?a.left=b:a.right=b;b.left=this.sentinel;b.right=this.sentinel;
  b.color=!0;this.insertFixup(b);this.size++}};d.RedBlackSet.prototype.insertFixup=function(a){for(;a!=this.sentinel&&a!=this.root&&1==a.parent.color;)if(a.parent==a.parent.parent.left){var b=a.parent.parent.right;1==b.color?(a.parent.color=!1,b.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 b=a.parent.parent.left,1==b.color?(a.parent.color=
  !1,b.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};d.RedBlackSet.prototype.delete_=function(a){var b=a.left==this.sentinel||a.right==this.sentinel?a:this.successor_(a);var c=b.left!=this.sentinel?b.left:b.right;c.parent=b.parent;b.parent==this.sentinel?this.root=c:b==b.parent.left?b.parent.left=c:b.parent.right=
  c;b!=a&&(a.key=b.key);0==b.color&&this.deleteFixup(c);this.size--};d.RedBlackSet.prototype.deleteFixup=function(a){for(;a!=this.root&&0==a.color;)if(a==a.parent.left){var b=a.parent.right;1==b.color&&(b.color=!1,a.parent.color=!0,this.leftRotate(a.parent),b=a.parent.right);0==b.left.color&&0==b.right.color?(b.color=!0,a=a.parent):(0==b.right.color&&(b.left.color=!1,b.color=!0,this.rightRotate(b),b=a.parent.right),b.color=a.parent.color,a.parent.color=!1,b.right.color=!1,this.leftRotate(a.parent),
  a=this.root)}else b=a.parent.left,1==b.color&&(b.color=!1,a.parent.color=!0,this.rightRotate(a.parent),b=a.parent.left),0==b.right.color&&0==b.left.color?(b.color=!0,a=a.parent):(0==b.left.color&&(b.right.color=!1,b.color=!0,this.leftRotate(b),b=a.parent.left),b.color=a.parent.color,a.parent.color=!1,b.left.color=!1,this.rightRotate(a.parent),a=this.root);a.color=!1};d.RedBlackSet.prototype.remove=function(a){a=this.get_(a);if(a!=this.sentinel){var b=a.key;this.delete_(a);return b}return null};d.RedBlackSet.prototype.removeSwapped=
  function(a,b){this.remove(b)};d.RedBlackSet.prototype.min=function(a){for(;a.left!=this.sentinel;)a=a.left;return a};d.RedBlackSet.prototype.max=function(a){for(;a.right!=this.sentinel;)a=a.right;return a};d.RedBlackSet.prototype.successor_=function(a){if(a.right!=this.sentinel)return this.min(a.right);for(var b=a.parent;b!=this.sentinel&&a==b.right;)a=b,b=b.parent;return b};d.RedBlackSet.prototype.predeccessor_=function(a){if(a.left!=this.sentinel)return this.max(a.left);for(var b=a.parent;b!=this.sentinel&&
  a==b.left;)a=b,b=b.parent;return b};d.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 b=a.parent;b!=this.sentinel&&a==b.right;)a=b,b=b.parent;return b!=this.sentinel?b.key:null}return null};d.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 b=a.parent;b!=this.sentinel&&
  a==b.left;)a=b,b=b.parent;return b!=this.sentinel?b.key:null}return null};d.RedBlackSet.prototype.getMin=function(){return this.min(this.root).key};d.RedBlackSet.prototype.getMax=function(){return this.max(this.root).key};d.RedBlackSet.prototype.get_=function(a){for(var b=this.root;b!=this.sentinel&&0!=this.compare(b.key,a);)b=0>this.compare(a,b.key)?b.left:b.right;return b};d.RedBlackSet.prototype.contains=function(a){return null!=this.get_(a).key};d.RedBlackSet.prototype.getValues=function(){var a=
  [];this.forEach(function(b){a.push(b)});return a};d.RedBlackSet.prototype.insertAll=function(a){if("array"==d.typeOf(a))for(var b=0;b<a.length;b++)this.insert(a[b]);else if("function"==d.typeOf(a.forEach))a.forEach(this.insert,this);else if("function"==d.typeOf(a.getValues))for(a=a.getValues(),b=0;b<a.length;b++)this.insert(a[b]);else if("object"==d.typeOf(a))for(b in a)this.insert(a[b])};d.RedBlackSet.prototype.removeAll=function(a){if("array"==d.typeOf(a))for(var b=0;b<a.length;b++)this.remove(a[b]);
  else if("function"==d.typeOf(a.forEach))a.forEach(this.removeSwapped,this);else if("function"==d.typeOf(a.getValues))for(a=a.getValues(),b=0;b<a.length;b++)this.remove(a[b]);else if("object"==d.typeOf(a))for(b in a)this.remove(a[b])};d.RedBlackSet.prototype.containsAll=function(a){if("array"==d.typeOf(a)){for(var b=0;b<a.length;b++)if(!this.contains(a[b]))return!1;return!0}if("function"==d.typeOf(a.forEach))return a.every(this.contains,this);if("function"==d.typeOf(a.getValues)){a=a.getValues();for(b=
  0;b<a.length;b++)if(!this.contains(a[b]))return!1;return!0}if("object"==d.typeOf(a)){for(b in a)if(!this.contains(a[b]))return!1;return!0}};d.RedBlackSet.prototype.range=function(a,b){var c=[];this.traverseFromTo(function(a){c.push(a)},a,b);return c};d.RedBlackSet.prototype.traverse=function(a,b){if(!this.isEmpty())for(var c=this.min(this.root);c!=this.sentinel&&!a.call(b,c.key,this);)c=this.successor_(c)};d.RedBlackSet.prototype.traverseFrom=function(a,b,c){if(!this.isEmpty())for(b=this.get_(b);b!=
  this.sentinel&&!a.call(c,b.key,this);)b=this.successor_(b)};d.RedBlackSet.prototype.traverseTo=function(a,b,c){if(!this.isEmpty()){var e=this.min(this.root);for(b=this.get_(b);e!=b&&!a.call(c,e.key,this);)e=this.successor_(e)}};d.RedBlackSet.prototype.traverseFromTo=function(a,b,c,e){if(!this.isEmpty())for(b=this.get_(b),c=this.get_(c);b!=c&&!a.call(e,b.key,this);)b=this.successor_(b)};d.RedBlackSet.prototype.traverseBackwards=function(a,b){if(!this.isEmpty())for(var c=this.max(this.root);c!=this.sentinel&&
  !a.call(b,c.key,this);)c=this.predeccessor_(c)};d.RedBlackSet.prototype.forEach=function(a,b){if(!this.isEmpty())for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))a.call(b,c.key,c.key,this)};d.RedBlackSet.prototype.some=function(a,b){if(this.isEmpty())return!1;for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))if(a.call(b,c.key,c.key,this))return!0;return!1};d.RedBlackSet.prototype.every=function(a,b){if(this.isEmpty())return!1;for(var c=this.min(this.root);c!=this.sentinel;c=
  this.successor_(c))if(!a.call(b,c.key,c.key,this))return!1;return!0};d.RedBlackSet.prototype.map=function(a,b){var c=[];if(this.isEmpty())return c;for(var e=this.min(this.root);e!=this.sentinel;e=this.successor_(e))c.push(a.call(b,e.key,e.key,this));return c};d.RedBlackSet.prototype.filter=function(a,b){var c=[];if(this.isEmpty())return c;for(var e=this.min(this.root);e!=this.sentinel;e=this.successor_(e))a.call(b,e.key,e.key,this)&&c.push(e.key);return c};d.RedBlackSet.prototype.getCount=function(){return this.size};
  d.RedBlackSet.prototype.isEmpty=function(){return 0==this.size};d.RedBlackSet.prototype.isSubsetOf=function(a){var b=d.getCount(a);if(this.getCount()>b)return!1;b=0;if(this.isEmpty())return!0;for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))d.contains.call(a,a,c.key)&&b++;return b==this.getCount()};d.RedBlackSet.prototype.intersection=function(a){var b=new d.RedBlackSet(this.compare);if(this.isEmpty())return b;for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))a.contains.call(a,
  c.key,c.key,this)&&b.insert(c.key);return b};f.RedBlackSet=class extends f.DefendedBase{constructor(a){super();this._rbSet=new d.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 a of this._queueRemove)this._rbSet.remove(a);this._queueRemove.clear();for(const a of this._queueInsert)this._rbSet.insert(a);this._queueInsert.clear()}}ForEach(a){this._rbSet.forEach(a)}*values(){if(!this.IsEmpty()){var a=
  this._rbSet;for(let b=a.min(a.root);b!=a.sentinel;b=a.successor_(b))yield b.key}}[Symbol.iterator](){return this.values()}}};
  
  
  // ../lib/util/promiseThrottle.js
  'use strict';{const d=self.C3;d.PromiseThrottle=class{constructor(a=d.hardwareConcurrency){this._maxParallel=a;this._queue=[];this._activeCount=0}Add(a){return new Promise((b,c)=>{this._queue.push({func:a,resolve:b,reject:c});this._MaybeStartNext()})}_FindInQueue(a){for(let b=0,c=this._queue.length;b<c;++b)if(this._queue[b].func===a)return b;return-1}RemoveAndResolve(a,b){a=this._FindInQueue(a);if(-1===a)throw Error("cannot find promise to resolve");this._queue[a].resolve(b);this._queue.splice(a,
  1)}RemoveAndReject(a,b){a=this._FindInQueue(a);if(-1===a)throw Error("cannot find promise to reject");this._queue[a].reject(b);this._queue.splice(a,1)}async _MaybeStartNext(){if(this._queue.length&&!(this._activeCount>=this._maxParallel)){this._activeCount++;var a=this._queue.shift();try{const b=await a.func();a.resolve(b)}catch(b){a.reject(b)}this._activeCount--;this._MaybeStartNext()}}static async Batch(a,b){const c=[];let e=!1;const h=async a=>{for(;(a=b.pop())&&!e;)try{c.push(await a())}catch(g){throw e=
  !0,g;}},f=[];for(;a--;)f.push(h());await Promise.all(f);return c}}};
  
  
  // ../lib/util/rateLimiter.js
  'use strict';{const b=self.C3;b.RateLimiter=class{constructor(a,c,d){this._callback=a;this._interval=c;this._intervalOnBattery=d||2*c;this._timerId=-1;this._lastCallTime=-Infinity;this._timerCallFunc=()=>this._OnTimer();this._canRunImmediate=this._ignoreReset=!1;this._callbackArguments=null}SetCanRunImmediate(a){this._canRunImmediate=!!a}_GetInterval(){return"undefined"!==typeof b.Battery&&b.Battery.IsOnBatteryPower()?this._intervalOnBattery:this._interval}Call(...a){if(-1===this._timerId){this._callbackArguments=
  a;a=b.FastGetDateNow();var c=a-this._lastCallTime,d=this._GetInterval();c>=d&&this._canRunImmediate?(this._lastCallTime=a,this._RunCallback()):this._timerId=self.setTimeout(this._timerCallFunc,Math.max(d-c,4))}}_RunCallback(){this._ignoreReset=!0;const a=this._callbackArguments;this._callbackArguments=null;a?this._callback(...a):this._callback();this._ignoreReset=!1}Reset(){this._ignoreReset||(this._CancelTimer(),this._callbackArguments=null,this._lastCallTime=b.FastGetDateNow())}_OnTimer(){this._timerId=
  -1;this._lastCallTime=b.FastGetDateNow();this._RunCallback()}_CancelTimer(){-1!==this._timerId&&(self.clearTimeout(this._timerId),this._timerId=-1)}Release(){this._CancelTimer();this._timerCallFunc=this._callbackArguments=this._callback=null}}};
  
  
  // ../lib/util/svgRaster/svgRasterManager.js
  'use strict';{const c=self.C3;c.SVGRasterManager=class{constructor(){this._images=new Map;this._allowNpotSurfaces=!1;this._redrawCallback=this._releaseResultCallback=this._rasterAtSizeCallback=this._getBaseSizeCallback=null}SetNpotSurfaceAllowed(a){this._allowNpotSurfaces=!!a}IsNpotSurfaceAllowed(){return this._allowNpotSurfaces}SetGetBaseSizeCallback(a){this._getBaseSizeCallback=a}GetBaseSize(a){if(!this._getBaseSizeCallback)throw Error("no get base size callback set");return this._getBaseSizeCallback(a)}SetRasterAtSizeCallback(a){this._rasterAtSizeCallback=
  a}RasterAtSize(a,b,d,e,f,g){if(!this._rasterAtSizeCallback)throw Error("no raster at size callback set");return this._rasterAtSizeCallback(a,b,d,e,f,g)}SetReleaseResultCallback(a){this._releaseResultCallback=a}ReleaseResult(a){if(!this._releaseResultCallback)throw Error("no release result callback set");this._releaseResultCallback(a)}SetRedrawCallback(a){this._redrawCallback=a}Redraw(){if(!this._redrawCallback)throw Error("no redraw callback set");this._redrawCallback()}AddImage(a){let b=this._images.get(a);
  b||(b=c.New(c.SVGRasterImage,this,a),this._images.set(a,b));b.IncReference();return b}_RemoveImage(a){this._images.delete(a.GetDataSource())}}};
  
  
  // ../lib/util/svgRaster/svgRasterImage.js
  'use strict';{const g=self.C3;g.SVGRasterImage=class{constructor(f,b){this._manager=f;this._dataSource=b;this._baseHeight=this._baseWidth=this._refCount=0;this._getBaseSizePromise=this._manager.GetBaseSize(b).then(a=>{this._baseWidth=a[0];this._baseHeight=a[1];this._manager.Redraw()}).catch(a=>{console.error("[SVG] Error loading SVG: ",a);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()}_Release(){this._rasterizedResult&&(this._manager.ReleaseResult(this._rasterizedResult),this._rasterizedResult=null);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(f,b,a){if(0!==b&&0!==a&&!this._hadError&&!this._isRasterizing){var c=g.nextHighestPowerOfTwo(Math.ceil(b)),d=g.nextHighestPowerOfTwo(Math.ceil(a)),e=Math.max(c,d);2048<e&&(e=2048/e,b*=e,a*=e,c=Math.min(Math.ceil(c*e),2048),d=Math.min(Math.ceil(d*e),2048));b<c&&a<d&&(a=b/a,c/d>a?(b=d*a,a=d):(b=c,a=c/a));this._manager.IsNpotSurfaceAllowed()&&(c=Math.ceil(b),d=Math.ceil(a));c<=this._rasterSurfaceWidth&&d<=this._rasterSurfaceHeight&&!this._forceRaster||(this._isRasterizing=
  !0,this._rasterSurfaceWidth=c,this._rasterSurfaceHeight=d,f=await this._manager.RasterAtSize(this._dataSource,f,this._rasterSurfaceWidth,this._rasterSurfaceHeight,b,a),this._rasterizedResult&&this._manager.ReleaseResult(this._rasterizedResult),this._rasterizedResult=f,this._rasterImageWidth=b,this._rasterImageHeight=a,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}}};
  
  
  // ../lib/str/str.js
  'use strict';{var lookupHtmlEntity=function(a){return l.get(a)};const c=self.C3;c.UTF8_BOM="\ufeff";const k=new Set([..."0123456789"]);c.IsNumericChar=function(a){return k.has(a)};const m=new Set([..." \t\n\r\u00a0\u0085\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u202f\u205f\u3000"]);c.IsWhitespaceChar=function(a){return m.has(a)};c.FilterWhitespace=function(a){return[...a].filter(a=>!c.IsWhitespaceChar(a)).join("")};c.IsStringAllWhitespace=function(a){for(const b of a)if(!c.IsWhitespaceChar(b))return!1;
  return!0};c.IsUnprintableChar=function(a){return 1===a.length&&32>a.charCodeAt(0)};c.FilterUnprintableChars=function(a){return[...a].filter(a=>!c.IsUnprintableChar(a)).join("")};const n=new Set([..."0123456789.+-e"]);c.IsStringNumber=function(a){a=a.trim();if(!a.length)return!1;let b=a.charAt(0);if("-"!==b&&!k.has(b))return!1;for(let b of a)if(!n.has(b))return!1;return!0};c.RemoveTrailingDigits=function(a){let b=a.length;for(;0<b;){let d=a.charAt(b-1);if(!c.IsNumericChar(d))break;--b}return a.substr(0,
  b)};c.IncrementNumberAtEndOf=function(a){let b=c.RemoveTrailingDigits(a);a=(a=a.substr(b.length))?(parseInt(a,10)+1).toString():"2";return b+a};const l=new Map([["&","&amp;"],["<","&lt;"],[">","&gt;"],['"',"&quot;"],["'","&#39;"]]),p=/[&<>"']/g;c.EscapeHTML=function(a){return a.replace(p,lookupHtmlEntity)};c.EscapeJS=function(a){a=a.replaceAll("\\","\\\\");a=a.replaceAll('"','\\"');a=a.replaceAll("\t","\\t");a=a.replaceAll("\r","");return a.replaceAll("\n","\\n")};c.EscapeXML=function(a){a=a.replaceAll("&",
  "&amp;");a=a.replaceAll("<","&lt;");a=a.replaceAll(">","&gt;");return a.replaceAll('"',"&quot;")};const q=/[-[\]{}()*+?.,\\^$|#\s]/g;c.EscapeRegex=function(a){return a.replace(q,"\\$&")};c.FindAll=function(a,b,d=!1){if(!b)return[];d||(a=a.toLowerCase(),b=b.toLowerCase());d=b.length;var e=0;let g=[];for(;-1<(e=a.indexOf(b,e));)g.push(e),e+=d;return g};c.ReplaceAllCaseInsensitive=function(a,b,d){return a.replace(new RegExp(c.EscapeRegex(b),"gi"),()=>d)};c.SetElementContent=function(a,b){"string"===
  typeof b?a.textContent=b:b.isPlainText()?a.textContent=b.toString():(a.innerHTML=b.toHTML(),b instanceof c.BBString&&b.attachLinkHandlers(a))};c.StringLikeEquals=function(a,b){return a instanceof c.HtmlString||a instanceof c.BBString?a.equals(b):b instanceof c.HtmlString||b instanceof c.BBString?b.equals(a):a===b};c.StringSubstitute=function(a,...b){let d=a;for(let c=0,g=b.length;c<g;++c){const e=`{${c}}`;if(!a.includes(e))throw Error(`missing placeholder '${e}' in string substitution`);d=d.replace(e,
  b[c].toString())}return d};c.StringSubstituteAllowMissing=function(a,...b){let d=a,e=-1,g=-1;for(let c=0,h=b.length;c<h;++c){const f=`{${c}}`;a.includes(f)?(g=c,d=d.replace(f,b[c].toString())):-1===e&&(e=c)}if(0<=e&&0<=g&&e<g)throw Error(`missing placeholder '${e}' in string substitution`);return d};c.StringSubstituteMap=function(a,b){for(let [d,c]of Object.entries(b))a=a.replaceAll(d,c.toString());return a};c.SortAZCaseInsensitive=function(a,b){a=a.toLowerCase();b=b.toLowerCase();return a>b?1:a<
  b?-1:0};c.FormatDataSize=function(a,b){b="common."+(b?"dataRates":"dataSizes")+".";const d=self.langSub;if(1024>a)return d(b+"bytes",a);if(1048576>a)return a/=1024,a=10>a?Math.round(10*a)/10:Math.round(a),d(b+"kilobytes",a);if(1073741824>a)return a/=1048576,a=10>a?Math.round(10*a)/10:Math.round(a),d(b+"megabytes",a);if(1099511627776>a)return a/=1073741824,a=10>a?Math.round(10*a)/10:Math.round(a),d(b+"gigabytes",a);a/=1099511627776;a=10>a?Math.round(10*a)/10:Math.round(a);return d(b+"terabytes",a)};
  const r={approximate:!1,days:!0,hours:!0,minutes:!0,seconds:!0};c.FormatTime=function(a,b){b=Object.assign({},r,b);c.Lang.PushContext("common.time");const d=[],e=self.lang,g=self.langPluralSub;if(b.days){var f=Math.floor(a/86400);0<f&&(a-=86400*f,d.push(g(".days",null,f)))}b.hours&&(f=Math.floor(a/3600),0<f||d.length)&&(a-=3600*f,d.push(g(".hours",null,f)));b.minutes&&(f=Math.floor(a/60),0<f||d.length||!b.seconds)&&(a-=60*f,d.push(g(".minutes",null,f)));b.seconds&&d.push(g(".seconds",null,Math.floor(a%
  60)));a=(b.approximate?e(".approx-prefix"):"")+d.join(e(".separator"));c.Lang.PopContext();return a};c.ZeroPad=function(a,b){let d=0>a?"-":"";a=Math.abs(a);a=a.toString();b-=a.length;for(let a=0;a<b;++a)d+="0";return d+a};c.StringToTitleCase=function(a){return a.toLowerCase().replace(/\b\w/g,a=>a.toUpperCase())};c.CompareVersionStrings=function(a,b){a=a.split(".").map(a=>a.trim());b=b.split(".").map(a=>a.trim());c.resizeArray(a,4,"0");c.resizeArray(b,4,"0");a=a.map(a=>parseInt(a,10));b=b.map(a=>parseInt(a,
  10));for(let c=0;4>c;++c){const d=a[c]-b[c];if(0!==d)return 0>d?-1:1}return 0};c.CreateGUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{const b=Math.floor(16*Math.random());return("x"===a?b:b&3|8).toString(16)})};c.StringHammingDistance=function(a,b){if(a.length!==b.length)throw Error("strings must be same length");let d=0;for(let c=0,g=a.length;c<g;++c)a.charAt(c)!==b.charAt(c)&&++d;return d};c.StringLevenshteinDistance=function(a,b){if(0===a.length)return b.length;
  if(0===b.length)return a.length;let d,e,g,f;if(a.length>b.length){var h=a;a=b;b=h}f=Array(a.length+1);for(h=0;h<=a.length;h++)f[h]=h;for(h=1;h<=b.length;h++){e=h;for(d=1;d<=a.length;d++)g=b[h-1]===a[d-1]?f[d-1]:Math.min(f[d-1]+1,Math.min(e+1,f[d]+1)),f[d-1]=e,e=g;f[a.length]=e}return f[a.length]}};
  
  
  // ../lib/str/bbstring.js
  'use strict';{var bbToHtmlReplacerFunc=function(a,b,e){var c=p.get(e);if(c){if("string"===typeof c){if("a"!==c||b)return"<"+b+c+">";b=parseInt(e.substring(1),10)-1;if(0>b||b>=g.length)throw Error("invalid bbcode link substitution");c=g[b];if("string"===typeof c)return`<a href="${g[b]}">`;if("function"===typeof c)return`<a class="bblink${b}">`;throw new TypeError("invalid bbcode link action");}if(Array.isArray(c))return a=c[0],c=c[1],b?"</"+a+">":`<${a} class="${c}">`}else return"class"===e?b?"</span>":
  `<span class="bbclass${m++}">`:a};const f=self.C3,p=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"]]]),n=
  /\[(\/?)([a-zA-Z0-9]+)\]/g,l=/\[(\/?)(.*?)\]/g;let g=null,m=0;const q=/\n/g;f.BBString=class{constructor(a,b){this._bbstr=b&&b.noEscape?a:f.EscapeHTML(a);this._htmlstr="";this._convertLineBreaks=!1;this._linkActions=[];if(b&&(this._convertLineBreaks=!!b.convertLineBreaks,b.links)){if(9<b.links.length)throw Error("too many links");this._linkActions=b.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(n,""):this._bbstr}toHTML(){if(this._isPlain)return this._bbstr;if(!this._htmlstr&&this._bbstr){let a=this._bbstr;this._hasAnyBBtags&&(m=0,g=this._linkActions,a=a.replace(n,bbToHtmlReplacerFunc),g=null);this._needsLineBreakConversion&&(a=a.replace(q,
  "<br>"));this._htmlstr=a}return this._htmlstr}attachLinkHandlers(a){if(this._linkActions.length)for(let b=0,e=this._linkActions.length;b<e;++b){const c=this._linkActions[b];if("function"!==typeof c)continue;const d=a.querySelector(".bblink"+b);if(!d)throw Error("unable to attach BBString link handler");d.onclick=c}}equals(a){return a instanceof f.HtmlString?this.toHTML()===a.toHTML():a instanceof f.BBString?this._bbstr===a._bbstr:this._bbstr===a}toFragmentList(){if(this._hasParsedFragments)return this._fragments;
  const a=this._bbstr,b=[];let e=l.lastIndex=0;for(var c;null!==(c=l.exec(a));){var d=c.index;if(0<d&&"\\"===a.charAt(d-1))continue;var k=c[0],h=c[1];c=c[2];const f=a.substring(e,d);e=d+k.length;f&&this._fragments.push({text:f,styles:b.slice(0)});if(c)if(h)for(c=c.toLowerCase(),d=b.length-1;0<=d;--d){if(b[d].tag===c){b.splice(d,1);break}}else d=c,k=null,h=c.indexOf("="),-1!==h?(d=c.substring(0,h).toLowerCase(),k=c.substring(h+1)):d=d.toLowerCase(),b.push({tag:d,param:k})}e<a.length&&this._fragments.push({text:a.substring(e),
  styles:b.slice(0)});for(const a of this._fragments)a.text=this._ProcessBBCodeEscapeSequences(a.text);this._hasParsedFragments=!0;return this._fragments}_ProcessBBCodeEscapeSequences(a){a=a.replaceAll("\\[","[");return a.replaceAll("\\\\","\\")}static StripTags(a){return f.New(f.BBString,a,{noEscape:!0}).toPlainText()}static StripAnyTags(a){return a.replace(l,"")}}};
  
  
  // ../lib/str/wordWrap.js
  'use strict';{const h=self.C3;h.WordWrap=class{constructor(){this._lines=[]}GetLines(){return this._lines}GetLineCount(){return this._lines.length}_MeasureLine(a,f){let b=0,d=0;for(const c of a)-1===c.width&&(a=f(c.text,c.styles),c.width=a.width,c.height=a.height),b+=c.width,d=Math.max(d,c.height);return{width:b,height:d}}_AddLine(a,f,b){this._lines.push({fragments:a,width:f,height:b})}WordWrap(a,f,b,d,c){"string"===typeof a&&(a=[{text:a,styles:[]}]);h.clearArray(this._lines);if(!(!a.length||1===
  a.length&&!a[0].text.length||2>b)){if(1===a.length){var g=a[0];const e=g.text;g=g.styles;if(100>=e.length&&!e.includes("\n")){let {width:a,height:d}=f(e,g);a+=c;if(a<=b){this._AddLine([{text:e,styles:g,width:a,height:d}],a,d);return}}}if("word"===d)d=this._TokeniseWords(a);else{d=[];for(const b of a)h.appendArray(d,[...b.text].map(a=>[{text:a,styles:b.styles}]))}this._WrapText(d,f,b,c)}}_TokeniseWords(a){const f=[];let b=[],d=!1;for(const g of a){var c=g.text;a=g.styles;for(const e of c)"\n"===e?
  (0<b.length&&f.push(b),f.push([{text:"\n",styles:a}]),b=[]):0===b.length?(b.push({text:e,styles:a}),d=h.IsWhitespaceChar(e)):(c=h.IsWhitespaceChar(e),c===d?(c=b[b.length-1],c.styles===a?c.text+=e:b.push({text:e,styles:a})):(f.push(b),b=[],b.push({text:e,styles:a}),d=c))}0<b.length&&f.push(b);return f}_CopyLine(a){return a.map(a=>({text:a.text,styles:a.styles,width:a.width,height:a.height}))}_AddWordToLine(a,f){var b=a.length?a[a.length-1]:null;let d=0;b&&f[0].styles===b.styles&&(b.text+=f[0].text,
  b.width=-1,b.height=-1,d=1);for(b=f.length;d<b;++d){const b=f[d];a.push({text:b.text,styles:b.styles,width:-1,height:-1})}}_WrapText(a,f,b,d){let c=[],g=0;var e=0;for(const d of a){if(1===d.length&&"\n"===d[0].text){0===e&&(e=f(" ",d[0].styles).height);this._AddLine(c,g,e);c=[];e=g=0;continue}a=this._CopyLine(c);this._AddWordToLine(a,d);var k=this._MeasureLine(a,f);const l=k.width;k=k.height;l>=b?(0<c.length&&this._AddLine(c,g,e),c=[],h.IsStringAllWhitespace(d[0].text)?e=g=0:(this._AddWordToLine(c,
  d),e=this._MeasureLine(c,f),g=e.width,e=e.height)):(c=a,g=l,e=k)}0<c.length&&this._AddLine(c,g,e);this._TrimLinesTrailingWhitespace(f,d)}_TrimLinesTrailingWhitespace(a,f){for(const d of this._lines){const c=d.fragments;if(!c.length)continue;let g=c[c.length-1];var b=g.text;const e=b.trimEnd();if(!e)d.width-=g.width,c.pop();else if(e.length<b.length){b=a(e,g.styles).width;const c=g.width-b;g.width=b;g.text=e;d.width-=c}0!==f&&0<c.length&&(g=c[c.length-1],g.width+=f,d.width+=f)}}Clear(){h.clearArray(this._lines)}GetMaxLineWidth(){let a=
  0;for(const f of this._lines){const b=f.width;a<b&&(a=b)}return a}}};
  
  
  // ../lib/gfx/gfx.js
  'use strict';self.C3.Gfx={};
  
  
  // ../lib/gfx/rendererBase.js
  'use strict';{const l=self.C3,b=[0,0,0,0,0,0,0,0],p=self.glMatrix,m=p.vec3,h=p.mat4,k=m.fromValues(0,0,0);l.Gfx.RendererBase=class{constructor(){this._height=this._width=0;this._cam=m.fromValues(0,0,100);this._look=m.fromValues(0,0,0);this._up=m.fromValues(0,1,0);this._worldScale=m.fromValues(1,1,1);this._matP=h.create();this._matMV=h.create();this._lastMV=h.create();this._allShaderPrograms=[];this._shaderProgramsByName=new Map;this._spTextureFill=null;this._stateGroups=new Map;this._currentStateGroup=
  null;this._blendModeTable=[];this._namedBlendModeMap=new Map;this._frameNumber=0;this._enableMipmaps=!0}FillIndexBufferData(a){let c=0,g=a.length,e=0;for(;c<g;)a[c++]=e,a[c++]=e+1,a[c++]=e+2,a[c++]=e,a[c++]=e+2,a[c++]=e+3,e+=4}Project(a,c,g,e,n){const d=this._matMV,f=this._matP;for(let a=0,c=b.length;a<c;++a)b[a]=0;b[0]=d[0]*a+d[4]*c+d[12];b[1]=d[1]*a+d[5]*c+d[13];b[2]=d[2]*a+d[6]*c+d[14];b[3]=d[3]*a+d[7]*c+d[15];b[4]=f[0]*b[0]+f[4]*b[1]+f[8]*b[2]+f[12]*b[3];b[5]=f[1]*b[0]+f[5]*b[1]+f[9]*b[2]+f[13]*
  b[3];b[6]=f[2]*b[0]+f[6]*b[1]+f[10]*b[2]+f[14]*b[3];b[7]=-b[2];0!==b[7]&&(b[7]=1/b[7],b[4]*=b[7],b[5]*=b[7],b[6]*=b[7],n[0]=(.5*b[4]+.5)*g,n[1]=(.5*b[5]+.5)*e)}GetWidth(){return this._width}GetHeight(){return this._height}GetNearZ(){return 1}GetFarZ(){return 1E4}SetCameraXYZ(a,c,g){this._cam[0]=a*this._worldScale[0];this._cam[1]=c*this._worldScale[1];this._cam[2]=g}SetLookXYZ(a,c,g){this._look[0]=a*this._worldScale[0];this._look[1]=c*this._worldScale[1];this._look[2]=g}ResetModelView(a){h.lookAt(this._matMV,
  this._cam,this._look,a||this._up);h.scale(this._matMV,this._matMV,this._worldScale)}Translate(a,c){if(0!==a||0!==c)k[0]=a,k[1]=c,k[2]=0,h.translate(this._matMV,this._matMV,k)}Scale(a,c){if(1!==a||1!==c)k[0]=a,k[1]=c,k[2]=1,h.scale(this._matMV,this._matMV,k)}RotateZ(a){0!==a&&h.rotateZ(this._matMV,this._matMV,a)}_AddShaderProgram(a){this._allShaderPrograms.push(a);this._shaderProgramsByName.set(a.GetName(),a)}_RemoveShaderProgram(a){const c=this._allShaderPrograms.indexOf(a);-1!==c&&this._allShaderPrograms.splice(c,
  1);this._shaderProgramsByName.delete(a.GetName())}_ClearAllShaderPrograms(){l.clearArray(this._allShaderPrograms);this._shaderProgramsByName.clear()}GetShaderProgramByName(a){return this._shaderProgramsByName.get(a)||null}GetTextureFillShaderProgram(){return this._spTextureFill}_SetCurrentStateGroup(a){this._currentStateGroup=a}GetCurrentStateGroup(){return this._currentStateGroup}AcquireStateGroup(a,c,g,e){const n=l.Gfx.StateGroup.MakeKey(a,c,g,e);let d=this._stateGroups.get(n);d||(d=l.New(l.Gfx.StateGroup,
  this,a,c,g,e),this._stateGroups.set(n,d));d.AddRef();return d}ReleaseStateGroup(a){a.DecRef();0===a._GetRefCount()&&(this._currentStateGroup===a&&(this._currentStateGroup=null),this._stateGroups.delete(a.GetKey()),a.Release())}_InitBlendModeData(a){l.clearArray(this._blendModeTable);this._namedBlendModeMap.clear();for(const b of a){a=b[0];const c=b[1],e=b[2];this._blendModeTable.push([c,e]);this._namedBlendModeMap.set(a,{srcBlend:c,destBlend:e})}}_GetBlendByIndex(a){return this._blendModeTable[a]}GetSrcBlendByIndex(a){return this._GetBlendByIndex(a)[0]}GetDestBlendByIndex(a){return this._GetBlendByIndex(a)[1]}GetNamedBlend(a){a=
  this._namedBlendModeMap.get(a);if("undefined"===typeof a)throw Error("invalid blend name");return a}Finish(){this.EndBatch();this._frameNumber++}GetFrameNumber(){return this._frameNumber}IncrementFrameNumber(){this._frameNumber++}SetMipmapsEnabled(a){this._enableMipmaps=!!a}AreMipmapsEnabled(){return this._enableMipmaps}}};
  
  
  // ../lib/gfx/stateGroup.js
  'use strict';{const d=self.C3;d.Gfx.StateGroup=class{constructor(a,c,b,e,f){this._renderer=a;this._refCount=0;this._shaderProgram=null;this._shaderProgramName="";this._blendMode=b;this._color=d.New(d.Color);this._color.set(e);this._zElevation=f;"string"===typeof c?this._shaderProgramName=c:(this._shaderProgram=c,this._shaderProgramName=this._shaderProgram.GetName())}Release(){if(0<this._refCount)throw Error("releasing state group still in use");this._shaderProgram=this._renderer=null;this._shaderProgramName=
  ""}Apply(){const a=this._renderer;a.SetProgram(this._shaderProgram);a.SetBlendMode(this._blendMode);a.SetColor(this._color);a.SetCurrentZ(this._zElevation);a._SetCurrentStateGroup(this)}GetKey(){return d.Gfx.StateGroup.MakeKey(this._shaderProgramName,this._blendMode,this._color,this._zElevation)}AddRef(){++this._refCount}DecRef(){--this._refCount}_GetRefCount(){return this._refCount}OnContextLost(){this._shaderProgram=null}OnContextRestored(a){this._shaderProgram=a.GetShaderProgramByName(this._shaderProgramName);
  if(!this._shaderProgram)throw Error("failed to restore shader program");}static MakeKey(a,c,b,e){return("string"===typeof a?a:a.GetName())+","+c+","+b.getR()+","+b.getG()+","+b.getB()+","+b.getA()+","+e}}};
  
  
  // ../lib/gfx/webgl/texture.js
  'use strict';{var GetFormatSpecifiers=function(a,b){let c,e;switch(a){case "rgba8":a=b.RGBA8;e=c=b.RGBA;b=b.UNSIGNED_BYTE;break;case "rgb8":a=b.RGB8;e=c=b.RGB;b=b.UNSIGNED_BYTE;break;case "rgba4":a=b.RGBA4;e=c=b.RGBA;b=b.UNSIGNED_SHORT_4_4_4_4;break;case "rgb5_a1":a=b.RGB5_A1;e=c=b.RGBA;b=b.UNSIGNED_SHORT_5_5_5_1;break;case "rgb565":a=b.RGB565;e=c=b.RGB;b=b.UNSIGNED_SHORT_5_6_5;break;default:throw Error("invalid pixel format");}return{sizedinternalformat:a,internalformat:c,format:e,type:b}};const f=
  self.C3,l=new Set(["rgba8","rgb8","rgba4","rgb5_a1","rgb565"]),m=new Set(["nearest","bilinear","trilinear"]),n=new Set(["default","low","high"]),k=new Set(["clamp-to-edge","repeat","mirror-repeat"]),p={wrapX:"clamp-to-edge",wrapY:"clamp-to-edge",sampling:"trilinear",pixelFormat:"rgba8",mipMap:!0,mipMapQuality:"default",premultiplyAlpha:!0,isSvg:!1,width:-1,height:-1},q={premultiplyAlpha:!0,flipY:!1},g=new Set;f.Gfx.WebGLRendererTexture=class{constructor(a){this._renderer=a;this._texture=null;this._height=
  this._width=0;this._isStatic=!0;this._wrapY=this._wrapX="clamp-to-edge";this._sampling="trilinear";this._pixelFormat="rgba8";this._isMipMapped=!1;this._mipMapQuality="default";this._refCount=0}_CreateStatic(a,b){if(!("undefined"!==typeof HTMLImageElement&&a instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&a instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&a instanceof ImageBitmap||"undefined"!==typeof OffscreenCanvas&&a instanceof OffscreenCanvas||a instanceof ImageData||
  a instanceof ArrayBuffer)&&null!==a)throw Error("invalid texture source");b=Object.assign({},p,b);if(this._texture)throw Error("already created texture");this._wrapX=b.wrapX;this._wrapY=b.wrapY;this._sampling=b.sampling;this._pixelFormat=b.pixelFormat;this._isMipMapped=!!b.mipMap&&this._renderer.AreMipmapsEnabled();this._mipMapQuality=b.mipMapQuality;if(!k.has(this._wrapX)||!k.has(this._wrapY))throw Error("invalid wrap mode");if(!m.has(this._sampling))throw Error("invalid sampling");if(!l.has(this._pixelFormat))throw Error("invalid pixel format");
  if(!n.has(this._mipMapQuality))throw Error("invalid mipmap quality");this._isStatic=!0;if(a instanceof ArrayBuffer||null===a||b.isSvg){if(this._width=b.width,this._height=b.height,a instanceof ArrayBuffer&&a.byteLength!==this._width*this._height*4)throw Error("ArrayBuffer wrong size");}else this._width=a.width,this._height=a.height;if(0>=this._width||0>=this._height)throw Error("invalid texture data size");if(b.isSvg){var c=f.CreateCanvas(this._width,this._height);c.getContext("2d").drawImage(a,0,
  0,this._width,this._height);a=c}var e=f.isPOT(this._width)&&f.isPOT(this._height);c=this._renderer.GetMaxTextureSize();if(this._width>c||this._height>c)throw Error("texture data exceeds maximum texture size");c=this._renderer.GetContext();var h=this._renderer.GetWebGLVersionNumber();this._texture=c.createTexture();c.bindTexture(c.TEXTURE_2D,this._texture);c.pixelStorei(c.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b.premultiplyAlpha);b=GetFormatSpecifiers(this._pixelFormat,c);if(this._renderer.SupportsNPOTTextures()||
  e||!this._IsTiled())2<=h?(c.texStorage2D(c.TEXTURE_2D,this._isMipMapped?Math.floor(Math.log2(Math.max(this._width,this._height))+1):1,b.sizedinternalformat,this._width,this._height),a instanceof ArrayBuffer?c.texSubImage2D(c.TEXTURE_2D,0,0,0,this._width,this._height,b.format,b.type,new Uint8Array(a)):null!==a&&c.texSubImage2D(c.TEXTURE_2D,0,0,0,b.format,b.type,a)):a instanceof ArrayBuffer?c.texImage2D(c.TEXTURE_2D,0,b.internalformat,this._width,this._height,0,b.format,b.type,new Uint8Array(a)):null===
  a?c.texImage2D(c.TEXTURE_2D,0,b.internalformat,this._width,this._height,0,b.format,b.type,null):c.texImage2D(c.TEXTURE_2D,0,b.internalformat,b.format,b.type,a);else{if(null===a)throw Error("cannot pass null data when creating a NPOT tiled texture without NPOT support");a instanceof ArrayBuffer&&(a=new ImageData(new Uint8ClampedArray(a),this._width,this._height));a instanceof ImageData&&(e=f.CreateCanvas(this._width,this._height),e.getContext("2d").putImageData(a,0,0),a=e);e=f.CreateCanvas(f.nextHighestPowerOfTwo(this._width),
  f.nextHighestPowerOfTwo(this._height));h=e.getContext("2d");h.imageSmoothingEnabled="nearest"!==this._sampling;h.drawImage(a,0,0,this._width,this._height,0,0,e.width,e.height);c.texImage2D(c.TEXTURE_2D,0,b.internalformat,b.format,b.type,e)}null!==a&&this._SetTextureParameters(c);c.bindTexture(c.TEXTURE_2D,null);this._renderer._ResetLastTexture();this._refCount=1;g.add(this)}_CreateDynamic(a,b,c){c=Object.assign({},p,c);if(this._texture)throw Error("already created texture");this._wrapX=c.wrapX;this._wrapY=
  c.wrapY;this._sampling=c.sampling;this._pixelFormat=c.pixelFormat;this._isMipMapped=!!c.mipMap&&this._renderer.AreMipmapsEnabled();this._mipMapQuality=c.mipMapQuality;if(!k.has(this._wrapX)||!k.has(this._wrapY))throw Error("invalid wrap mode");if(!m.has(this._sampling))throw Error("invalid sampling");if(!l.has(this._pixelFormat))throw Error("invalid pixel format");if(!n.has(this._mipMapQuality))throw Error("invalid mipmap quality");this._isStatic=!1;this._width=Math.floor(a);this._height=Math.floor(b);
  a=f.isPOT(this._width)&&f.isPOT(this._height);b=this._renderer.GetMaxTextureSize();if(0>=this._width||0>=this._height)throw Error("invalid texture size");if(this._width>b||this._height>b)throw Error("texture exceeds maximum texture size");if(!this._renderer.SupportsNPOTTextures()&&this._IsTiled()&&!a)throw Error("non-power-of-two tiled textures not supported");a=this._renderer.GetContext();b=this._renderer.GetWebGLVersionNumber();this._texture=a.createTexture();a.bindTexture(a.TEXTURE_2D,this._texture);
  a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,c.premultiplyAlpha);c=GetFormatSpecifiers(this._pixelFormat,a);a.texImage2D(a.TEXTURE_2D,0,2<=b?c.sizedinternalformat:c.internalformat,this._width,this._height,0,c.format,c.type,null);this._SetTextureParameters(a);a.bindTexture(a.TEXTURE_2D,null);this._renderer._ResetLastTexture();this._refCount=1;g.add(this)}_GetMipMapHint(a){if("default"===this._mipMapQuality)return this._isStatic?a.NICEST:a.FASTEST;if("low"===this._mipMapQuality)return a.FASTEST;if("high"===
  this._mipMapQuality)return a.NICEST;throw Error("invalid mipmap quality");}_IsTiled(){return"clamp-to-edge"!==this._wrapX||"clamp-to-edge"!==this._wrapY}_GetTextureWrapMode(a,b){if("clamp-to-edge"===b)return a.CLAMP_TO_EDGE;if("repeat"===b)return a.REPEAT;if("mirror-repeat"===b)return a.MIRRORED_REPEAT;throw Error("invalid wrap mode");}_SetTextureParameters(a){var b=f.isPOT(this._width)&&f.isPOT(this._height);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,this._GetTextureWrapMode(a,this._wrapX));a.texParameteri(a.TEXTURE_2D,
  a.TEXTURE_WRAP_T,this._GetTextureWrapMode(a,this._wrapY));"nearest"===this._sampling?(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),this._isMipMapped=!1):(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),(b||this._renderer.SupportsNPOTTextures())&&this._isMipMapped?(a.hint(a.GENERATE_MIPMAP_HINT,this._GetMipMapHint(a)),a.generateMipmap(a.TEXTURE_2D),b="trilinear"===this._sampling&&!this._renderer.HasMajorPerformanceCaveat(),
  a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,b?a.LINEAR_MIPMAP_LINEAR:a.LINEAR_MIPMAP_NEAREST)):(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),this._isMipMapped=!1))}_Update(a,b){if(!("undefined"!==typeof HTMLImageElement&&a instanceof HTMLImageElement||"undefined"!==typeof HTMLVideoElement&&a instanceof HTMLVideoElement||"undefined"!==typeof HTMLCanvasElement&&a instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&a instanceof ImageBitmap||"undefined"!==typeof OffscreenCanvas&&
  a instanceof OffscreenCanvas||a 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");b=Object.assign({},q,b);const c=a.width||a.videoWidth,e=a.height||a.videoHeight;var h=this._renderer.GetWebGLVersionNumber();const d=this._renderer.GetContext();d.bindTexture(d.TEXTURE_2D,this._texture);d.pixelStorei(d.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b.premultiplyAlpha);d.pixelStorei(d.UNPACK_FLIP_Y_WEBGL,
  !!b.flipY);b=GetFormatSpecifiers(this._pixelFormat,d);h=2<=h?b.sizedinternalformat:b.internalformat;try{if(this._width===c&&this._height===e){const c=f.isPOT(this._width)&&f.isPOT(this._height);d.texSubImage2D(d.TEXTURE_2D,0,0,0,b.format,b.type,a);(c||this._renderer.SupportsNPOTTextures())&&this._isMipMapped&&(d.hint(d.GENERATE_MIPMAP_HINT,this._GetMipMapHint(d)),d.generateMipmap(d.TEXTURE_2D))}else{this._width=c;this._height=e;const g=f.isPOT(this._width)&&f.isPOT(this._height);if(!this._renderer.SupportsNPOTTextures()&&
  this._IsTiled()&&!g)throw Error("non-power-of-two tiled textures not supported");d.texImage2D(d.TEXTURE_2D,0,h,b.format,b.type,a);(g||this._renderer.SupportsNPOTTextures())&&this._isMipMapped&&(d.hint(d.GENERATE_MIPMAP_HINT,this._GetMipMapHint(d)),d.generateMipmap(d.TEXTURE_2D))}}catch(r){console.error("Error updating WebGL texture: ",r)}d.bindTexture(d.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");
  g.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 a=this._width*this._height;
  switch(this._pixelFormat){case "rgba8":a*=4;break;case "rgb8":a*=3;break;case "rgba4":case "rgb5_a1":case "rgb565":a*=2}this._isMipMapped&&(a+=Math.floor(a/3));return a}static OnContextLost(){g.clear()}static allTextures(){return g.values()}}};
  
  
  // ../lib/gfx/webgl/renderTarget.js
  'use strict';{const e=self.C3,h=new Set(["nearest","bilinear","trilinear"]),f={sampling:"trilinear",alpha:!0,readback:!0,isDefaultSize:!0,multisampling:0},d=new Set;e.Gfx.WebGLRenderTarget=class{constructor(a){this._renderer=a;this._renderBuffer=this._texture=this._frameBuffer=null;this._height=this._width=0;this._isDefaultSize=!0;this._sampling="trilinear";this._readback=this._alpha=!0;this._multisampling=0}_Create(a,c,b){b=Object.assign({},f,b);const g=this._renderer.GetWebGLVersionNumber();if(this._texture||
  this._renderBuffer)throw Error("already created render target");this._sampling=b.sampling;this._alpha=!!b.alpha;this._readback=!!b.readback;this._isDefaultSize=!!b.isDefaultSize;this._multisampling=b.multisampling;if(!h.has(this._sampling))throw Error("invalid sampling");if(0<this._multisampling&&(2>g||this._readback))throw Error("invalid use of multisampling");2>g&&(this._readback=!0);this._width=a;this._height=c;if(0>=this._width||0>=this._height)throw Error("invalid render target size");a=this._renderer.GetContext();
  this._frameBuffer=a.createFramebuffer();a.bindFramebuffer(a.FRAMEBUFFER,this._frameBuffer);this._readback?(this._texture=this._renderer.CreateDynamicTexture(this._width,this._height,{sampling:this._sampling,pixelFormat:this._alpha?"rgba8":"rgb8",mipMap:!1}),c=this._texture._GetTexture(),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,c,0)):(this._renderBuffer=a.createRenderbuffer(),a.bindRenderbuffer(a.RENDERBUFFER,this._renderBuffer),c=this._alpha?a.RGBA8:a.RGB8,0<this._multisampling&&
  ((b=a.getInternalformatParameter(a.RENDERBUFFER,c,a.SAMPLES))&&b[0]?(b=b[0],this._multisampling>b&&(this._multisampling=b)):this._multisampling=0),0===this._multisampling?a.renderbufferStorage(a.RENDERBUFFER,c,this._width,this._height):a.renderbufferStorageMultisample(a.RENDERBUFFER,this._multisampling,c,this._width,this._height),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.RENDERBUFFER,this._renderBuffer),a.bindRenderbuffer(a.RENDERBUFFER,null));a.bindFramebuffer(a.FRAMEBUFFER,null);
  d.add(this)}_Resize(a,c){if(this._width!==a||this._height!==c)this._width=a,this._height=c,a=this._renderer.GetContext(),a.bindFramebuffer(a.FRAMEBUFFER,this._frameBuffer),this._texture?this._texture._Update(new ImageData(this._width,this._height)):(a.bindRenderbuffer(a.RENDERBUFFER,this._renderBuffer),a.renderbufferStorage(a.RENDERBUFFER,this._alpha?a.RGBA8:a.RGB8,this._width,this._height),a.bindRenderbuffer(a.RENDERBUFFER,null)),a.bindFramebuffer(a.FRAMEBUFFER,null)}_Delete(){if(!this._texture&&
  !this._renderBuffer)throw Error("already deleted render target");d.delete(this);const a=this._renderer.GetContext();a.bindFramebuffer(a.FRAMEBUFFER,this._frameBuffer);this._texture?(a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,null,0),this._renderer.DeleteTexture(this._texture),this._texture=null):this._renderBuffer&&(a.framebufferRenderbuffer(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.RENDERBUFFER,null),a.deleteRenderbuffer(this._renderBuffer),this._renderBuffer=null);a.bindFramebuffer(a.FRAMEBUFFER,
  null);2<=this._renderer.GetWebGLVersionNumber()&&(a.bindFramebuffer(a.READ_FRAMEBUFFER,null),a.bindFramebuffer(a.DRAW_FRAMEBUFFER,null));a.deleteFramebuffer(this._frameBuffer);this._frameBuffer=this._renderer.GetBatchState().currentFramebuffer=null}_GetFramebuffer(){return this._frameBuffer}GetWebGLRenderer(){return this._renderer}GetTexture(){return this._texture}IsLinearSampling(){return"nearest"!==this._sampling}HasAlpha(){return this._alpha}IsReadback(){return this._readback}GetWidth(){return this._width}GetHeight(){return this._height}IsDefaultSize(){return this._isDefaultSize}GetMultisampling(){return this._multisampling}GetOptions(){const a=
  {sampling:this._sampling,alpha:this._alpha,readback:this._readback};this._isDefaultSize||(a.width=this._width,a.height=this._height);return a}IsCompatibleWithOptions(a){a=Object.assign({},f,a);return"nearest"!==a.sampling!==this.IsLinearSampling()||!!a.alpha!==this.HasAlpha()||2<=this._renderer.GetWebGLVersionNumber()&&!!a.readback!==this.IsReadback()?!1:"number"===typeof a.width||"number"===typeof a.height?!this.IsDefaultSize()&&this.GetWidth()===a.width&&this.GetHeight()===a.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(a,c){a=await a.ReadBackRenderTargetToImageData(c,!0);return await e.ImageDataToBlob(a)}static OnContextLost(){d.clear()}static allRenderTargets(){return d.values()}static ResizeAll(a,c){for(const b of d)b.IsDefaultSize()&&b._Resize(a,c)}}};
  
  
  // ../lib/gfx/webgl/shaderProgram.js
  'use strict';{const f=self.C3,n=self.glMatrix,p=n.vec3,l=n.mat4,q=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(" "));f.Gfx.WebGLShaderProgram=class{static async Compile(b,c,d,e){const a=b.GetContext(),h=a.createShader(a.FRAGMENT_SHADER);a.shaderSource(h,c);a.compileShader(h);
  c=a.createShader(a.VERTEX_SHADER);a.shaderSource(c,d);a.compileShader(c);const g=a.createProgram();a.attachShader(g,h);a.attachShader(g,c);a.bindAttribLocation(g,0,"aPos");a.bindAttribLocation(g,1,"aTex");a.bindAttribLocation(g,2,"aPoints");a.linkProgram(g);const k=b._GetParallelShaderCompileExtension();k?await b._WaitForObjectReady(()=>a.getProgramParameter(g,k.COMPLETION_STATUS_KHR)):await f.Wait(5);if(!a.getShaderParameter(h,a.COMPILE_STATUS))throw e=a.getShaderInfoLog(h),a.deleteShader(h),a.deleteShader(c),
  a.deleteProgram(g),Error("Error compiling fragment shader: "+e);if(!a.getShaderParameter(c,a.COMPILE_STATUS))throw e=a.getShaderInfoLog(c),a.deleteShader(h),a.deleteShader(c),a.deleteProgram(g),Error("Error compiling vertex shader: "+e);if(!a.getProgramParameter(g,a.LINK_STATUS))throw e=a.getProgramInfoLog(g),a.deleteShader(h),a.deleteShader(c),a.deleteProgram(g),Error("Error linking shader program: "+e);(b=f.FilterUnprintableChars(a.getProgramInfoLog(g)||"").trim())&&!f.IsStringAllWhitespace(b)&&
  console.info(`[WebGL] Shader program '${e}' compilation log: `,b);a.deleteShader(h);a.deleteShader(c);return g}static async Create(b,c,d,e){d=await f.Gfx.WebGLShaderProgram.Compile(b,c.src,d,e);return new f.Gfx.WebGLShaderProgram(b,d,c,e)}constructor(b,c,d,e){const a=b.GetContext();var h=b.GetBatchState();b.EndBatch();a.useProgram(c);this._gl=a;this._renderer=b;this._name=e;this._shaderProgram=c;this._isDeviceTransform="<default-device-transform>"===e;e=a.getAttribLocation(c,"aPos");const g=a.getAttribLocation(c,
  "aTex");c=a.getAttribLocation(c,"aPoints");-1!==e&&(a.bindBuffer(a.ARRAY_BUFFER,b._vertexBuffer),a.vertexAttribPointer(e,b.GetNumVertexComponents(),a.FLOAT,!1,0,0),a.enableVertexAttribArray(e));-1!==g&&(a.bindBuffer(a.ARRAY_BUFFER,b._texcoordBuffer),a.vertexAttribPointer(g,2,a.FLOAT,!1,0,0),a.enableVertexAttribArray(g));-1!==c&&(a.bindBuffer(a.ARRAY_BUFFER,b._pointBuffer),a.vertexAttribPointer(c,4,a.FLOAT,!1,0,0),a.enableVertexAttribArray(c));a.bindBuffer(a.ARRAY_BUFFER,null);this._uMatP=new f.Gfx.WebGLShaderUniform(this,
  "matP","mat4");this._uMatMV=new f.Gfx.WebGLShaderUniform(this,"matMV","mat4");this._uColor=new f.Gfx.WebGLShaderUniform(this,"color","vec4");this._uSamplerFront=new f.Gfx.WebGLShaderUniform(this,"samplerFront","sampler");this._uPointTexStart=new f.Gfx.WebGLShaderUniform(this,"pointTexStart","vec2");this._uPointTexEnd=new f.Gfx.WebGLShaderUniform(this,"pointTexEnd","vec2");this._uZElevation=new f.Gfx.WebGLShaderUniform(this,"zElevation","float");this._uTileSize=new f.Gfx.WebGLShaderUniform(this,"tileSize",
  "vec2");this._uTileSpacing=new f.Gfx.WebGLShaderUniform(this,"tileSpacing","vec2");this._uColor2=new f.Gfx.WebGLShaderUniform(this,"color2_","vec4");this._uOutlineThickness=new f.Gfx.WebGLShaderUniform(this,"outlineThickness","float");this._uSamplerBack=new f.Gfx.WebGLShaderUniform(this,"samplerBack","sampler");this._uDestStart=new f.Gfx.WebGLShaderUniform(this,"destStart","vec2");this._uDestEnd=new f.Gfx.WebGLShaderUniform(this,"destEnd","vec2");this._uSrcStart=new f.Gfx.WebGLShaderUniform(this,
  "srcStart","vec2");this._uSrcEnd=new f.Gfx.WebGLShaderUniform(this,"srcEnd","vec2");this._uSrcOriginStart=new f.Gfx.WebGLShaderUniform(this,"srcOriginStart","vec2");this._uSrcOriginEnd=new f.Gfx.WebGLShaderUniform(this,"srcOriginEnd","vec2");this._uPixelSize=new f.Gfx.WebGLShaderUniform(this,"pixelSize","vec2");this._uSeconds=new f.Gfx.WebGLShaderUniform(this,"seconds","float");this._uLayerScale=new f.Gfx.WebGLShaderUniform(this,"layerScale","float");this._uLayerAngle=new f.Gfx.WebGLShaderUniform(this,
  "layerAngle","float");this._uLayoutStart=new f.Gfx.WebGLShaderUniform(this,"layoutStart","vec2");this._uLayoutEnd=new f.Gfx.WebGLShaderUniform(this,"layoutEnd","vec2");this._hasAnyOptionalUniforms=!!(this._uPixelSize.IsUsed()||this._uSeconds.IsUsed()||this._uSamplerBack.IsUsed()||this._uDestStart.IsUsed()||this._uDestEnd.IsUsed()||this._uSrcStart.IsUsed()||this._uSrcEnd.IsUsed()||this._uSrcOriginStart.IsUsed()||this._uSrcOriginEnd.IsUsed()||this._uLayerScale.IsUsed()||this._uLayerAngle.IsUsed()||
  this._uLayoutStart.IsUsed()||this._uLayoutEnd.IsUsed());this._extendBoxHorizontal=d.extendBoxHorizontal||0;this._extendBoxVertical=d.extendBoxVertical||0;this._crossSampling=!!d.crossSampling;this._mustPreDraw=!!d.mustPreDraw;this._preservesOpaqueness=!!d.preservesOpaqueness;this._animated=!!d.animated;b=d.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 a of b)b=a[2],d=new f.Gfx.WebGLShaderUniform(this,a[0],b),"color"===b?d.Init3f(0,0,0):d.Init1f(0),this._uCustomParameters.push(d);
  this._isDeviceTransform?this._UpdateDeviceTransformUniforms(h.currentMatP):(this.UpdateMatP(h.currentMatP,!0),this.UpdateMatMV(h.currentMV,!0));h=h.currentShader;a.useProgram(h?h._shaderProgram:null)}Release(){this._gl.deleteProgram(this._shaderProgram);this._shaderProgram=null;this._renderer._RemoveShaderProgram(this);this._renderer=this._gl=null}GetName(){return this._name}GetWebGLContext(){return this._gl}GetShaderProgram(){return this._shaderProgram}UsesDest(){return this._usesDest}UsesCrossSampling(){return this._crossSampling}MustPreDraw(){return this._mustPreDraw}PreservesOpaqueness(){return this._preservesOpaqueness}ExtendsBox(){return 0!==
  this._extendBoxHorizontal||0!==this._extendBoxVertical}GetBoxExtendHorizontal(){return this._extendBoxHorizontal}GetBoxExtendVertical(){return this._extendBoxVertical}UsesAnySrcRectOrPixelSize(){return this._usesAnySrcRectOrPixelSize}NeedsPostDrawOrExtendsBox(){return this._needsPostDrawOrExtendBox}GetParameterCount(){return this._uCustomParameters.length}GetParameterType(b){return this._uCustomParameters[b].GetType()}AreCustomParametersAlreadySetInBatch(b){for(let c=0,d=b.length;c<d;++c)if(!this._uCustomParameters[c].IsSetToCustomInBatch(b[c]))return!1;
  return!0}SetCustomParametersInBatch(b){for(let c=0,d=b.length;c<d;++c)this._uCustomParameters[c].SetBatchValueCustom(b[c])}AreOptionalUniformsAlreadySetInBatch(b,c,d,e,a,h,g,k,m){return this._uSamplerBack.IsUsed()||this._uPixelSize.IsUsed()&&!this._uPixelSize.IsSetTo2InBatch(a,h)||this._uDestStart.IsUsed()&&!this._uDestStart.IsSetTo2InBatch(b.getLeft(),b.getTop())||this._uDestEnd.IsUsed()&&!this._uDestEnd.IsSetTo2InBatch(b.getRight(),b.getBottom())||this._uLayerScale.IsUsed()&&!this._uLayerScale.IsSetTo1InBatch(g)||
  this._uLayerAngle.IsUsed()&&!this._uLayerAngle.IsSetTo1InBatch(k)||this._uSrcStart.IsUsed()&&!this._uSrcStart.IsSetTo2InBatch(c.getLeft(),c.getTop())||this._uSrcEnd.IsUsed()&&!this._uSrcEnd.IsSetTo2InBatch(c.getRight(),c.getBottom())||this._uSrcOriginStart.IsUsed()&&!this._uSrcOriginStart.IsSetTo2InBatch(d.getLeft(),d.getTop())||this._uSrcOriginEnd.IsUsed()&&!this._uSrcOriginEnd.IsSetTo2InBatch(d.getRight(),d.getBottom())||this._uLayoutStart.IsUsed()&&!this._uLayoutStart.IsSetTo2InBatch(e.getLeft(),
  e.getTop())||this._uLayoutEnd.IsUsed()&&!this._uLayoutEnd.IsSetTo2InBatch(e.getTop(),e.getBottom())||this._uSeconds.IsUsed()&&!this._uSeconds.IsSetTo1InBatch(m)?!1:!0}SetOptionalUniformsInBatch(b,c,d,e,a,h,g,k,m){this._uSamplerBack.IsUsed()||(this._uPixelSize.IsUsed()&&this._uPixelSize.SetBatch2(a,h),this._uDestStart.IsUsed()&&this._uDestStart.SetBatch2(b.getLeft(),b.getTop()),this._uDestEnd.IsUsed()&&this._uDestEnd.SetBatch2(b.getRight(),b.getBottom()),this._uLayerScale.IsUsed()&&this._uLayerScale.SetBatch1(g),
  this._uLayerAngle.IsUsed()&&this._uLayerAngle.SetBatch1(k),this._uSrcStart.IsUsed()&&this._uSrcStart.SetBatch2(c.getLeft(),c.getTop()),this._uSrcEnd.IsUsed()&&this._uSrcEnd.SetBatch2(c.getRight(),c.getBottom()),this._uSrcOriginStart.IsUsed()&&this._uSrcOriginStart.SetBatch2(d.getLeft(),d.getTop()),this._uSrcOriginEnd.IsUsed()&&this._uSrcOriginEnd.SetBatch2(d.getRight(),d.getBottom()),this._uLayoutStart.IsUsed()&&this._uLayoutStart.SetBatch2(e.getLeft(),e.getTop()),this._uLayoutEnd.IsUsed()&&this._uLayoutEnd.SetBatch2(e.getTop(),
  e.getBottom()),this._uSeconds.IsUsed()&&this._uSeconds.SetBatch1(m))}IsAnimated(){return this._animated}UpdateMatP(b,c){this._hasCurrentMatP&&!c||this._isDeviceTransform||(this._uMatP.IsUsed()&&this._uMatP.UpdateMatrix4fv(b),this._hasCurrentMatP=!0)}SetMatPStale(){this._hasCurrentMatP=!1}UpdateMatMV(b,c){this._hasCurrentMatMV&&!c||this._isDeviceTransform||(this._uMatMV.IsUsed()&&this._uMatMV.UpdateMatrix4fv(b),this._hasCurrentMatMV=!0)}SetMatMVStale(){this._hasCurrentMatMV=!1}_UpdateDeviceTransformUniforms(b){if(!this._isDeviceTransform)throw Error("not device transform shader");
  this._uMatP.UpdateMatrix4fv(b);b=this._renderer;var c=b.GetWidth()/2,d=b.GetHeight()/2;const e=b._worldScale,a=p.fromValues(c*e[0],d*e[1],100*self.devicePixelRatio);c=p.fromValues(c*e[0],d*e[1],0);d=l.create();l.lookAt(d,a,c,b._up);l.scale(d,d,e);this._uMatMV.UpdateMatrix4fv(d)}UpdateColor(b){this._uColor.IsUsed()&&this._uColor.Update4f(b[0],b[1],b[2],b[3])}static GetReservedUniformNames(){return q}static GetDefaultVertexShaderSource(b,c){c=c?"highmedp":"mediump";return["#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif",
  `attribute highp ${b?"vec3":"vec2"} aPos;`,`attribute ${c} vec2 aTex;`,`varying ${c} vec2 vTex;`,"uniform highp mat4 matP;\nuniform highp mat4 matMV;\nvoid main(void) {",`	gl_Position = matP * matMV * vec4(aPos, ${b?"":"0.0,"} 1.0);`,"\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(){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(){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}"}}};
  
  
  // ../lib/gfx/webgl/shaderUniform.js
  'use strict';{var areMat4sEqual=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&a[6]===b[6]&&a[7]===b[7]&&a[8]===b[8]&&a[9]===b[9]&&a[10]===b[10]&&a[11]===b[11]&&a[12]===b[12]&&a[13]===b[13]&&a[14]===b[14]&&a[15]===b[15]};const f=self.C3,g=new Map([["float",1],["percent",1],["sampler",1],["vec2",2],["vec3",3],["color",3],["vec4",4],["mat4",16]]);f.Gfx.WebGLShaderUniform=class{constructor(a,b,c){if(!g.has(c))throw Error("invalid uniform type");this._owner=
  a;this._gl=this._owner.GetWebGLContext();this._name=b;this._type=c;this._isColorType="color"===this._type;this._location=this._gl.getUniformLocation(this._owner.GetShaderProgram(),b);this._isUsed=!!this._location;a=g.get(c);this._lastValue=new Float32Array(a);this._lastBatchValue=new Float32Array(a)}Release(){this._location=this._gl=this._owner=null}IsUsed(){return this._isUsed}GetType(){return this._type}IsColorType(){return this._isColorType}Init1f(a){this.IsUsed()&&(this._lastValue[0]=a,this._lastBatchValue.set(this._lastValue),
  this._gl.uniform1f(this._location,a))}Init1i(a){this.IsUsed()&&(this._lastValue[0]=a,this._lastBatchValue.set(this._lastValue),this._gl.uniform1i(this._location,a))}Init2f(a,b){this.IsUsed()&&(this._lastValue[0]=a,this._lastValue[1]=b,this._lastBatchValue.set(this._lastValue),this._gl.uniform2f(this._location,a,b))}Init3f(a,b,c){this.IsUsed()&&(this._lastValue[0]=a,this._lastValue[1]=b,this._lastValue[2]=c,this._lastBatchValue.set(this._lastValue),this._gl.uniform3f(this._location,a,b,c))}Init4f(a,
  b,c,d){this.IsUsed()&&(this._lastValue[0]=a,this._lastValue[1]=b,this._lastValue[2]=c,this._lastValue[3]=d,this._lastBatchValue.set(this._lastValue),this._gl.uniform4f(this._location,a,b,c,d))}Update1f(a){a=Math.fround(a);const b=this._lastValue;b[0]!==a&&(b[0]=a,this._gl.uniform1f(this._location,a))}Update1i(a){const b=this._lastValue;b[0]!==a&&(b[0]=a,this._gl.uniform1i(this._location,a))}Update2f(a,b){a=Math.fround(a);b=Math.fround(b);const c=this._lastValue;if(c[0]!==a||c[1]!==b)c[0]=a,c[1]=b,
  this._gl.uniform2f(this._location,a,b)}Update3f(a,b,c){a=Math.fround(a);b=Math.fround(b);c=Math.fround(c);const d=this._lastValue;if(d[0]!==a||d[1]!==b||d[2]!==c)d[0]=a,d[1]=b,d[2]=c,this._gl.uniform3f(this._location,a,b,c)}Update4f(a,b,c,d){a=Math.fround(a);b=Math.fround(b);c=Math.fround(c);d=Math.fround(d);const e=this._lastValue;if(e[0]!==a||e[1]!==b||e[2]!==c||e[3]!==d)e[0]=a,e[1]=b,e[2]=c,e[3]=d,this._gl.uniform4f(this._location,a,b,c,d)}UpdateMatrix4fv(a){const b=this._lastValue;areMat4sEqual(b,
  a)||(f.typedArraySet16(b,a,0),this._gl.uniformMatrix4fv(this._location,!1,a))}IsSetToCustomInBatch(a){const b=this._lastBatchValue;return this.IsColorType()?b[0]===Math.fround(a.getR())&&b[1]===Math.fround(a.getG())&&b[2]===Math.fround(a.getB()):b[0]===Math.fround(a)}SetBatchValueCustom(a){const b=this._lastBatchValue;this.IsColorType()?(b[0]=a.getR(),b[1]=a.getG(),b[2]=a.getB()):b[0]=a}IsSetTo1InBatch(a){return this._lastBatchValue[0]===Math.fround(a)}IsSetTo2InBatch(a,b){const c=this._lastBatchValue;
  return c[0]===Math.fround(a)&&c[1]===Math.fround(b)}SetBatch1(a){this._lastBatchValue[0]=a}SetBatch2(a,b){const c=this._lastBatchValue;c[0]=a;c[1]=b}}};
  
  
  // ../lib/gfx/webgl/batchJob.js
  'use strict';{const l=self.C3,n=self.glMatrix,p=n.vec4,m=n.mat4;l.Gfx.BatchState=class{constructor(a){this.renderer=a;this.currentMV=m.create();this.currentMatP=m.create();this.currentFramebuffer=null;this.currentColor=p.fromValues(1,1,1,1);this.currentShader=null;this.pointTexCoords=new l.Rect;this.clearColor=l.New(l.Color,0,0,0,0)}};l.Gfx.WebGLBatchJob=class{constructor(a){const b=new ArrayBuffer(96);this._type=0;this._batchState=a;this._gl=a.renderer.GetContext();this._indexCount=this._startIndex=
  0;this._texParam=null;this._mat4param=new Float32Array(b,0,16);this._colorParam=new Float32Array(b,64,4);this._srcOriginRect=new Float32Array(b,80,4);this._shaderParams=[]}InitQuad(a,b){this._type=1;this._startIndex=a;this._indexCount=b}DoQuad(){const a=this._gl;a.drawElements(a.TRIANGLES,this._indexCount,a.UNSIGNED_SHORT,this._startIndex)}InitSetTexture(a){this._type=2;this._texParam=a}DoSetTexture(){const a=this._gl,b=this._texParam;a.bindTexture(a.TEXTURE_2D,b?b._GetTexture():null)}InitSetColor(a){this._type=
  3;a.writeToTypedArray(this._colorParam,0)}DoSetColor(){const a=this._colorParam,b=this._batchState;p.copy(b.currentColor,a);b.currentShader.UpdateColor(a)}InitSetGradientColor(a){this._type=19;a.writeToTypedArray(this._colorParam,0)}DoSetGradientColor(){const a=this._colorParam,b=this._batchState.currentShader;b._uColor2.IsUsed()&&b._uColor2.Update4f(a[0],a[1],a[2],a[3])}InitSetBlend(a,b){this._type=4;this._startIndex=a;this._indexCount=b}DoSetBlend(){this._gl.blendFunc(this._startIndex,this._indexCount)}InitUpdateModelView(a){this._type=
  5;m.copy(this._mat4param,a)}DoUpdateModelView(){const a=this._batchState,b=a.renderer._allShaderPrograms,c=a.currentShader,d=this._mat4param;for(let a=0,f=b.length;a<f;++a){const e=b[a];e===c?e.UpdateMatMV(d,!0):e.SetMatMVStale()}m.copy(a.currentMV,d)}InitSetRenderTarget(a,b,c){this._type=6;this._texParam=a;this._startIndex=b?1:0;b&&m.copy(this._mat4param,c)}DoSetRenderTarget(){var a=this._gl,b=this._texParam;const c=0!==this._startIndex,d=this._mat4param,e=this._batchState,f=e.renderer;if(b){const c=
  b._GetFramebuffer();e.currentFramebuffer=c;a.bindFramebuffer(a.FRAMEBUFFER,c);a=b.GetWidth();b=b.GetHeight()}else e.currentFramebuffer=null,a.bindFramebuffer(a.FRAMEBUFFER,null),a=f.GetScissoredViewportWidth(),b=f.GetScissoredViewportHeight();c&&f._UpdateViewportBatch(a,b,d)}InitClearSurface(a){this._type=7;a.writeToTypedArray(this._mat4param,0)}InitClearSurface2(a,b,c,d){this._type=7;const e=this._mat4param;e[0]=a;e[1]=b;e[2]=c;e[3]=d}DoClearSurface(){const a=this._gl;var b=this._mat4param,c=this._batchState;
  const d=c.clearColor;(c=c.renderer._isScissorViewport&&l.isDebug)&&a.disable(a.SCISSOR_TEST);const e=b[0],f=b[1],g=b[2];b=b[3];d.equalsRgba(e,f,g,b)||(a.clearColor(e,f,g,b),d.setRgba(e,f,g,b));a.clear(a.COLOR_BUFFER_BIT);c&&a.enable(a.SCISSOR_TEST)}InitClearRect(a,b,c,d,e,f,g,h){this._type=8;const k=this._mat4param;k[0]=a;k[1]=b;k[2]=c;k[3]=d;k[4]=e;k[5]=f;k[6]=g;k[7]=h}DoClearRectangle(){const a=this._gl;var b=this._mat4param,c=this._batchState;const d=c.renderer;c=c.clearColor;d._isScissorViewport||
  a.enable(a.SCISSOR_TEST);a.scissor(b[0],b[1],b[2],b[3]);const e=b[4],f=b[5],g=b[6];b=b[7];c.equalsRgba(e,f,g,b)||(a.clearColor(e,f,g,b),c.setRgba(e,f,g,b));a.clear(a.COLOR_BUFFER_BIT);d._isScissorViewport?a.scissor(0,0,d._viewportScissorWidth,d._viewportScissorHeight):a.disable(a.SCISSOR_TEST)}InitSetPointTexCoords(a){this._type=13;a.writeToTypedArray(this._mat4param,0)}DoSetPointTextureCoords(){const a=this._mat4param;this._batchState.pointTexCoords.set(a[0],a[1],a[2],a[3])}InitPoints(a,b){this._type=
  9;this._startIndex=a;this._indexCount=1;this._mat4param[0]=b}DoPoints(){const a=this._gl,b=this._batchState,c=b.renderer._spPoints;a.useProgram(c._shaderProgram);c.UpdateMatP(b.currentMatP,!1);c.UpdateMatMV(b.currentMV,!1);var d=b.pointTexCoords;c._uPointTexStart.IsUsed()&&c._uPointTexStart.Update2f(d.getLeft(),d.getTop());c._uPointTexEnd.IsUsed()&&c._uPointTexEnd.Update2f(d.getRight(),d.getBottom());d=this._mat4param[0];c._uZElevation.IsUsed()&&c._uZElevation.Update1f(d);c._uColor.IsUsed()&&(d=b.currentColor,
  c._uColor.Update4f(d[0],d[1],d[2],d[3]));a.drawArrays(a.POINTS,this._startIndex/4,this._indexCount);a.useProgram(b.currentShader._shaderProgram)}InitSetProgram(a){this._type=10;this._texParam=a}DoSetProgram(){var a=this._gl;const b=this._batchState,c=this._texParam;b.currentShader=c;a.useProgram(c._shaderProgram);c.UpdateMatP(b.currentMatP,!1);c.UpdateMatMV(b.currentMV,!1);c._uColor.IsUsed()&&(a=b.currentColor,c._uColor.Update4f(a[0],a[1],a[2],a[3]))}InitSetProgramParameters(){this._type=11}DoSetProgramParameters(){const a=
  this._batchState.currentShader;a._hasAnyOptionalUniforms&&this._DoSetOptionalUniformProgramParameters(a);a._uCustomParameters.length&&this._DoUpdateCustomProgramParameters(a)}_DoSetOptionalUniformProgramParameters(a){const b=this._gl,c=this._mat4param,d=this._colorParam,e=this._srcOriginRect;if(a._uSamplerBack.IsUsed()){const a=this._batchState.renderer,c=this._texParam;a._lastTexture1!==c&&(b.activeTexture(b.TEXTURE1),b.bindTexture(b.TEXTURE_2D,c?c._GetTexture():null),a._lastTexture1=c,b.activeTexture(b.TEXTURE0))}a._uPixelSize.IsUsed()&&
  a._uPixelSize.Update2f(c[0],c[1]);a._uDestStart.IsUsed()&&a._uDestStart.Update2f(c[2],c[3]);a._uDestEnd.IsUsed()&&a._uDestEnd.Update2f(c[4],c[5]);a._uLayerScale.IsUsed()&&a._uLayerScale.Update1f(c[6]);a._uLayerAngle.IsUsed()&&a._uLayerAngle.Update1f(c[7]);a._uSrcStart.IsUsed()&&a._uSrcStart.Update2f(c[12],c[13]);a._uSrcEnd.IsUsed()&&a._uSrcEnd.Update2f(c[14],c[15]);a._uSrcOriginStart.IsUsed()&&a._uSrcOriginStart.Update2f(e[0],e[1]);a._uSrcOriginEnd.IsUsed()&&a._uSrcOriginEnd.Update2f(e[2],e[3]);a._uLayoutStart.IsUsed()&&
  a._uLayoutStart.Update2f(d[0],d[1]);a._uLayoutEnd.IsUsed()&&a._uLayoutEnd.Update2f(d[2],d[3]);a._uSeconds.IsUsed()&&a._uSeconds.Update1f(this._startIndex)}_DoUpdateCustomProgramParameters(a){a=a._uCustomParameters;const b=this._shaderParams;for(let c=0,d=a.length;c<d;++c){const d=a[c],f=b[c];d.IsColorType()?d.Update3f(f.getR(),f.getG(),f.getB()):d.Update1f(f)}}InitInvalidateFramebuffer(a){this._type=12;this._texParam=a}DoInvalidateFramebuffer(){const a=this._gl,b=this._texParam,c=this._batchState.currentFramebuffer;
  b!==c&&a.bindFramebuffer(a.FRAMEBUFFER,b);a.invalidateFramebuffer(a.FRAMEBUFFER,[a.COLOR_ATTACHMENT0]);b!==c&&a.bindFramebuffer(a.FRAMEBUFFER,c)}InitBlitFramebuffer(a,b,c){this._type=15;const d=this._mat4param,e=this._batchState.renderer;d[0]=a.GetWidth();d[1]=a.GetHeight();d[2]=b?b.GetWidth():e.GetWidth();d[3]=b?b.GetHeight():e.GetHeight();d[4]=a.IsLinearSampling()?1:0;d[5]="stretch"===c;c=this._shaderParams;l.clearArray(c);c.push(a._GetFramebuffer());c.push(b?b._GetFramebuffer():null)}DoBlitFramebuffer(){var a=
  this._mat4param,b=this._shaderParams;const c=this._gl;var d=a[0],e=a[1],f=a[2];const g=a[3],h=0!==a[4];a=0!==a[5];const k=b[1];c.bindFramebuffer(c.READ_FRAMEBUFFER,b[0]);c.bindFramebuffer(c.DRAW_FRAMEBUFFER,k);a?c.blitFramebuffer(0,0,d,e,0,0,f,g,c.COLOR_BUFFER_BIT,h?c.LINEAR:c.NEAREST):(b=Math.min(d,f),d=Math.min(e,g),f=Math.max(e-g,0),e=Math.max(g-e,0),c.blitFramebuffer(0,f,b,d+f,0,e,b,d+e,c.COLOR_BUFFER_BIT,c.NEAREST))}InitStartQuery(a){this._type=16;this._texParam=a}DoStartQuery(){this._texParam.BeginTimeElapsed();
  this._texParam=null}InitEndQuery(a){this._type=17;this._texParam=a}DoEndQuery(){this._texParam.EndTimeElapsed();this._texParam=null}InitSetEllipseParams(a,b,c){this._type=18;const d=this._mat4param;d[0]=a;d[1]=b;d[2]=c}DoSetEllipseParams(){const a=this._batchState.currentShader,b=this._mat4param;a._uPixelSize.IsUsed()&&a._uPixelSize.Update2f(b[0],b[1]);a._uOutlineThickness.IsUsed()&&a._uOutlineThickness.Update1f(b[2])}InitSetTilemapInfo(a,b,c,d,e,f,g){this._type=14;const h=this._mat4param;a.writeToTypedArray(h,
  0);h[4]=1/b;h[5]=1/c;h[6]=d/b;h[7]=e/c;h[8]=f/b;h[9]=g/c}DoSetTilemapInfo(){const a=this._batchState.currentShader,b=this._mat4param;a._uSrcStart.IsUsed()&&a._uSrcStart.Update2f(b[0],b[1]);a._uPixelSize.IsUsed()&&a._uPixelSize.Update2f(b[4],b[5]);a._uTileSize.IsUsed()&&a._uTileSize.Update2f(b[6],b[7]);a._uTileSpacing.IsUsed()&&a._uTileSpacing.Update2f(b[8],b[9])}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.DoUpdateModelView();break;case 6:this.DoSetRenderTarget();break;case 7:this.DoClearSurface();break;case 8:this.DoClearRectangle();break;case 9:this.DoPoints();break;case 10:this.DoSetProgram();break;case 11:this.DoSetProgramParameters();break;case 12:this.DoInvalidateFramebuffer();break;case 13:this.DoSetPointTextureCoords();break;case 14:this.DoSetTilemapInfo();break;case 15:this.DoBlitFramebuffer();break;case 16:this.DoStartQuery();break;case 17:this.DoEndQuery();break;case 18:this.DoSetEllipseParams();
  break;case 19:this.DoSetGradientColor()}}}};
  
  
  // ../lib/gfx/text.js
  'use strict';{var ptToPx=function(a){return 4/3*a},fillOrStrokeRect=function(a,c,b,d,e,g){c?a.strokeRect(b,d,e,g):a.fillRect(b,d,e,g)},fillOrStrokeText=function(a,c,b,d,e,g){c?"Gecko"===f.Platform.BrowserEngine?a.strokeText(b,d,e,g):a.strokeText(b,d,e):"Gecko"===f.Platform.BrowserEngine?a.fillText(b,d,e,g):a.fillText(b,d,e)};const f=self.C3,w={timeout:60},r=new f.Color(0,0,0,1),x=new Set(["left","center","right"]),y=new Set(["top","center","bottom"]),z=new Set(["word","character"]),l=new Set;f.FontManager&&
  f.FontManager.addEventListener("fontload",a=>{a=a.font.GetName();for(const c of l)(c.IsBBCodeEnabled()||f.equalsNoCase(c.GetFontName(),a))&&c._SetTextChanged()});f.Gfx.RendererText=class{constructor(a,c){c=Object.assign({},w,c);this._renderer=a;this._fontName="Arial";this._fontSize=16;this._lineHeight=0;this._isItalic=this._isBold=!1;this._colorStr="black";this._isBBcodeEnabled=!1;this.onloadfont=null;this._alreadyLoadedFonts=new Set;this._horizontalAlign="left";this._verticalAlign="top";this._text=
  "";this._bbString=null;this._wrappedText=f.New(f.WordWrap);this._wrapMode="word";this._isUpdating=this._textChanged=!1;this._isAsync=!0;this._drawMaxCharCount=-1;this._height=this._width=this._cssHeight=this._cssWidth=this._drawCharCount=0;this._zoom=1;this._changed=!1;this._measureContext=this._textContext=this._textCanvas=null;this._lastCanvasHeight=this._lastCanvasWidth=-1;this._lastTextCanvasFillStyle=this._lastMeasureCanvasFont=this._lastTextCanvasFont="";this._lastTextCanvasLineWidth=this._lastTextCanvasOpacity=
  1;this._measureTextCallback=(a,c)=>this._MeasureText(a,c);this._texture=null;this._textureHeight=this._textureWidth=0;this._rcTex=new f.Rect;this._scaleFactor=1;this._needToRecreateTexture=!1;this._textureTimeout=new f.IdleTimeout(()=>{this.ReleaseTexture();this._SetTextCanvasSize(8,8)},c.timeout);this.ontextureupdate=null;this._wasReleased=!1;l.add(this)}Release(){this.onloadfont=null;this._alreadyLoadedFonts.clear();this._measureTextCallback=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(a){this._isAsync=!!a}IsAsync(){return this._isAsync}SetBBCodeEnabled(a){a=!!a;this._isBBcodeEnabled!==a&&(this._isBBcodeEnabled=a,this._textContext&&(this._textContext.textBaseline=
  this._isBBcodeEnabled?"alphabetic":"top"),this._SetTextChanged())}IsBBCodeEnabled(){return this._isBBcodeEnabled}SetFontName(a){a||(a="serif");this._fontName!==a&&(this._fontName=a,this._SetTextChanged())}GetFontName(){return this._fontName}SetFontSize(a){.1>a&&(a=.1);this._fontSize!==a&&(this._fontSize=a,this._SetTextChanged())}SetLineHeight(a){this._lineHeight!==a&&(this._lineHeight=a,this._SetChanged())}SetBold(a){a=!!a;this._isBold!==a&&(this._isBold=a,this._SetTextChanged())}SetItalic(a){a=!!a;
  this._isItalic!==a&&(this._isItalic=a,this._SetTextChanged())}SetDrawMaxCharacterCount(a){a=Math.floor(a);this._drawMaxCharCount!==a&&(this._drawMaxCharCount=a,this._SetChanged())}GetDrawMaxCharacterCount(){return this._drawMaxCharCount}_GetStyleTag(a,c){for(let b=a.length-1;0<=b;--b){const d=a[b];if(d.tag===c)return d}return null}_HasStyleTag(a,c){return!!this._GetStyleTag(a,c)}_GetFontString(a,c){let b="";if(this._isBold||this._HasStyleTag(c,"b"))b+="bold";if(this._isItalic||this._HasStyleTag(c,
  "i"))b+=" italic";var d=this._GetStyleTag(c,"size");d=d?parseFloat(d.param):this._fontSize;b=a?b+(" "+d+"pt"):b+(" "+d*this._scaleFactor*this._zoom*self.devicePixelRatio+"pt");a=this._fontName;(c=this._GetStyleTag(c,"font"))&&c.param&&(a=c.param,this.onloadfont&&!this._alreadyLoadedFonts.has(a)&&(this.onloadfont(a),this._alreadyLoadedFonts.add(a)));a&&(b+=' "'+a+'"');return b}SetColor(a){a instanceof f.Color&&(a=a.getCssRgb());this._colorStr!==a&&(this._colorStr=a,this._SetChanged())}SetColorRgb(a,
  c,b){r.setRgb(a,c,b);this.SetColor(r)}SetHorizontalAlignment(a){if(!x.has(a))throw Error("invalid horizontal alignment");this._horizontalAlign!==a&&(this._horizontalAlign=a,this._SetChanged())}SetVerticalAlignment(a){if(!y.has(a))throw Error("invalid vertical alignment");this._verticalAlign!==a&&(this._verticalAlign=a,this._SetChanged())}SetWordWrapMode(a){if(!z.has(a))throw Error("invalid word wrap mode");this._wrapMode!==a&&(this._wrapMode=a,this._SetTextChanged())}SetText(a){this._text!==a&&(this._text=
  a,this._SetTextChanged())}SetSize(a,c,b){"undefined"===typeof b&&(b=1);if(!(0>=a||0>=a||this._cssWidth===a&&this._cssHeight===c&&this._zoom===b)){1===this._zoom!==(1===b)&&(this._needToRecreateTexture=!0);var d=this._cssWidth,e=this._zoom;this._cssWidth=a;this._cssHeight=c;this._zoom=b;a=self.devicePixelRatio;this._width=this._cssWidth*this._zoom*a;this._height=this._cssHeight*this._zoom*a;a=Math.max(this._width,this._height);c=Math.min(this._renderer.GetMaxTextureSize(),2048);b=1;a>c&&(b=c/a,this._width=
  Math.min(this._width*b,c),this._height=Math.min(this._height*b,c));this._scaleFactor=b;0<this._textureWidth&&0<this._textureHeight&&this._zoom===e&&this._rcTex.set(0,0,this._width/this._textureWidth,this._height/this._textureHeight);this._cssWidth!==d?this._SetTextChanged():this._SetChanged()}}GetWidth(){return this._width}GetHeight(){return this._height}GetTextWidth(){this._MaybeWrapText();return this._wrappedText.GetMaxLineWidth()}GetTextHeight(){this._MaybeWrapText();const a=ptToPx(this._fontSize)+
  4;return this._wrappedText.GetLineCount()*(a+this._lineHeight)-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?f.Asyncify(()=>this._DoUpdate()):this._DoUpdate())}_DoUpdate(){this._wasReleased||(this._SetTextCanvasSize(Math.ceil(this._width),Math.ceil(this._height)),this._MaybeWrapText(),
  this._DrawTextToCanvas(),this._UpdateTexture(),this._textureTimeout.Reset(),this._isUpdating=!1)}_SetTextCanvasSize(a,c){this._textCanvas||(this._textCanvas=f.CreateCanvas(16,16));let b=!1;if(this._lastCanvasWidth!==a||this._lastCanvasHeight!==c)this._lastCanvasWidth=a,this._lastCanvasHeight=c,this._textCanvas.width=a,this._textCanvas.height=c,b=!0;this._textContext||(this._textContext=this._textCanvas.getContext("2d"),b=!0);b?(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,a,c)}_MaybeCreateMeasureContext(){this._measureContext||(this._measureContext=f.CreateCanvas(16,16).getContext("2d"))}_SetMeasureFontString(a){this._lastMeasureCanvasFont!==a&&(this._lastMeasureCanvasFont=
  a,this._measureContext.font=a)}_MaybeWrapText(){this._textChanged&&(this._MaybeCreateMeasureContext(),!this._isBBcodeEnabled||this._bbString&&this._bbString.toString()===this._text||(this._bbString=new f.BBString(this._text,{noEscape:!0})),this._wrappedText.WordWrap(this._isBBcodeEnabled?this._bbString.toFragmentList():this._text,this._measureTextCallback,this._cssWidth,this._wrapMode,0),this._textChanged=!1)}_MeasureText(a,c){this._SetMeasureFontString(this._GetFontString(!0,c));c=(c=this._GetStyleTag(c,
  "size"))?parseFloat(c.param):this._fontSize;return{width:this._measureContext.measureText(a).width,height:ptToPx(c)}}_SetDrawFontString(a){this._lastTextCanvasFont!==a&&(this._lastTextCanvasFont=a,this._textContext.font=a)}_SetDrawCanvasColor(a){this._lastTextCanvasFillStyle!==a&&(this._lastTextCanvasFillStyle=a,this._textContext.fillStyle=a,this._textContext.strokeStyle=a)}_SetDrawCanvasOpacity(a){this._lastTextCanvasOpacity!==a&&(this._lastTextCanvasOpacity=a,this._textContext.globalAlpha=a)}_SetDrawCanvasLineWith(a){this._lastTextCanvasLineWidth!==
  a&&(this._lastTextCanvasLineWidth=a,this._textContext.lineWidth=a)}_DrawTextToCanvas(){this._drawCharCount=0;const a=this._scaleFactor*this._zoom*self.devicePixelRatio,c=(4+this._lineHeight)*a;let b=0;const d=this._wrappedText.GetLines();var e=d.reduce((b,d)=>b+d.height*a+c,0)-this._lineHeight*a;"center"===this._verticalAlign?b=Math.max(this._height/2-e/2,0):"bottom"===this._verticalAlign&&(b=this._height-e-2);for(let f=0,l=d.length;f<l;++f){e=d[f];const g=e.height*a,l=b;if(this._isBBcodeEnabled){if(b+=
  g,0<f&&b>this._height-4*a)break}else if(0<f&&b>=this._height-g)break;0<=l&&this._DrawTextLine(e,b,a);this._isBBcodeEnabled||(b+=g);b+=c}}_DrawTextLine(a,c,b){let d=0;"center"===this._horizontalAlign?d=(this._width-a.width*b)/2:"right"===this._horizontalAlign&&(d=this._width-a.width*b);for(const e of a.fragments)this._DrawTextFragment(e,d,c,b,a.height),d+=e.width*b}_DrawTextFragment(a,c,b,d,e){const g=this._textContext,t=e/16;e=a.width*d;const n=a.height*d,p=a.height/16;var h=(4+this._lineHeight)*
  d;const k=a.styles;a=a.text;if(-1!==this._drawMaxCharCount){if(this._drawCharCount>=this._drawMaxCharCount)return;this._drawCharCount+a.length>this._drawMaxCharCount&&(a=a.substr(0,this._drawMaxCharCount-this._drawCharCount),e=this._MeasureText(a,k).width*d);this._drawCharCount+=a.length}const q=this._GetStyleTag(k,"background"),u=this._HasStyleTag(k,"u"),v=this._HasStyleTag(k,"s");if((!f.IsStringAllWhitespace(a)||q||u||v)&&!this._HasStyleTag(k,"hide")){var m=this._GetStyleTag(k,"offsetx");c+=m?parseFloat(m.param)*
  d:0;m=this._GetStyleTag(k,"offsety");b+=m?parseFloat(m.param)*d:0;q&&(this._SetDrawCanvasColor(q.param),g.fillRect(c,b-n,e,n+h));h=this._GetStyleTag(k,"color");this._SetDrawCanvasColor(h?h.param:this._colorStr);h=this._GetStyleTag(k,"opacity");this._SetDrawCanvasOpacity(h?parseFloat(h.param)/100:1);(h=this._HasStyleTag(k,"stroke"))&&this._SetDrawCanvasLineWith(p*this._scaleFactor*this._zoom);u&&fillOrStrokeRect(g,h,c,b+d*t,e,d*t);v&&fillOrStrokeRect(g,h,c,b-n/4,e,d*p);this._SetDrawFontString(this._GetFontString(!1,
  k));fillOrStrokeText(g,h,a,c,b,e);!h&&(this._SetDrawCanvasLineWith(p*this._scaleFactor*this._zoom),d=this._GetStyleTag(k,"outline"))&&(this._SetDrawCanvasColor(d.param),fillOrStrokeText(g,!0,a,c,b,e))}}_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 a of l)a.ReleaseTexture()}static GetAll(){return l.values()}}};
  
  
  // ../lib/gfx/webgl/query.js
  'use strict';{const c=self.C3;class d{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 b=this._gl.getParameter(this._timerExt.GPU_DISJOINT_EXT);a&&!b&&(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||
  b)&&this._DeleteQueryObject()}}HasResult(){return this._hasResult}GetResult(){if(!this._hasResult)throw Error("no result available");return this._result}}c.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 d&&a.Release();c.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[a.length-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=c.New(d,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,b)=>a+b.GetResult(),0)}GetFrameNumber(){return this._frameNumber}}};
  
  
  // ../lib/gfx/webgl/queryResultBuffer.js
  '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}}}}};
  
  
  // ../lib/gfx/webgl/webglRenderer.js
  'use strict';{var GetWebGLContext=function(a,b,c){let d;if(2.1<=c&&(d=a.getContext("webgl2-compute",b)))return{gl:d,version:2.1};if(2<=c&&(d=a.getContext("webgl2",b)))return{gl:d,version:2};d=a.getContext("webgl",b);if(!d)try{d=a.getContext("experimental-webgl",b)}catch(e){console.warn("Error requesting 'experimental-webgl' context: ",e)}return{gl:d,version:1}},CheckPendingPolls=function(){y=-1;for(const a of z)a.checkFunc()&&(a.resolve(),z.delete(a));0<z.size&&(y=self.requestAnimationFrame(CheckPendingPolls))},
  areMat4sEqual=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&a[6]===b[6]&&a[7]===b[7]&&a[8]===b[8]&&a[9]===b[9]&&a[10]===b[10]&&a[11]===b[11]&&a[12]===b[12]&&a[13]===b[13]&&a[14]===b[14]&&a[15]===b[15]};const k=self.C3,A=self.glMatrix,v=A.vec3,G=A.vec4,u=A.mat4,H={powerPreference:"default",enableGpuProfiling:!0,alpha:!1,lowLatency:!1,maxWebGLVersion:2},I=new Set(["default","low-power","high-performance"]),B=new k.Quad(0,0,1,0,1,1,0,1),C=v.fromValues(0,
  0,0),D=v.fromValues(0,0,0),E=u.create(),p=new k.Quad,n=new k.Rect;let x=null;k.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 z=new Set;let y=-1;k.Gfx.WebGLRenderer=class extends k.Gfx.RendererBase{constructor(a,b){super();b=Object.assign({},H,b);if(!I.has(b.powerPreference))throw Error("invalid power preference");let c=
  !1;const d={alpha:!!b.alpha,depth:!1,antialias:!1,powerPreference:b.powerPreference,failIfMajorPerformanceCaveat:!0};b.lowLatency&&(d.desynchronized=!0,d.preserveDrawingBuffer=!0);let e=GetWebGLContext(a,d,b.maxWebGLVersion);e.gl||(c=!0,d.failIfMajorPerformanceCaveat=!1,e=GetWebGLContext(a,d,b.maxWebGLVersion));if(!e.gl)throw Error("failed to initialise WebGL context");this._gl=a=e.gl;this._attribs=a.getContextAttributes();b.lowLatency&&!this._attribs.desynchronized&&console.info("[WebGLRenderer] Low-latency mode specified but is not supported here");
  this._versionString=a.getParameter(a.VERSION);this._version=e.version;this._is3d=!0;this._lastBackbufferHeight=this._lastBackbufferWidth=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._spTilemapFill=this._spPoints=
  this._spSmoothLineFill=this._spSmoothEllipseOutline=this._spSmoothEllipseFill=this._spHardEllipseOutline=this._spHardEllipseFill=this._spLinearGradientFill=this._spColorFill=this._spDeviceTransformTextureFill=this._lastProgram=null;this._batch=[];this._topOfBatch=this._batchPtr=0;this._currentRenderTarget=null;this._lastPointZ=this._currentZ=this._baseZ=0;this._batchState=k.New(k.Gfx.BatchState,this);this._lastColor=k.New(k.Color,1,1,1,1);this._lastTexture1=this._lastTexture0=null;this._lastDestBlend=
  this._lastSrcBlend=0;this._lineWidth=1;this._lineWidthStack=[this._lineWidth];this._lineCap=1;this._lineCapStack=[this._lineCap];this._lineOffset=.5;this._lineOffsetStack=[this._lineOffset];this._isScissorViewport=!1;this._viewportScissorHeight=this._viewportScissorWidth=-1;this._lastPointTexCoords=new k.Rect;this._maxTextureSize=-1;this._highpPrecision=this._maxPointSize=this._minPointSize=0;this._unmaskedRenderer=this._unmaskedVendor="(unavailable)";this._extensions=[];this._hasMajorPerformanceCaveat=
  c;this._isInitialisingAfterContextRestored=!1;this._parallelShaderCompileExt=null;this._isGpuProfilingEnabled=!!b.enableGpuProfiling;this._timerExt=null;this._allQueryResultBuffers=new Set;this._timeQueryStack=[];this.FillIndexBufferData(this._indexData)}async InitState(){var a=this._gl,b=this.GetNumVertexComponents();this._lastColor.setRgba(1,1,1,1);this._lastTexture1=this._lastTexture0=null;this._pointPtr=this._vertexPtr=0;this._lastVertexPtr=8E3*b-4*b;k.clearArray(this._batch);this._topOfBatch=
  this._batchPtr=0;this._currentRenderTarget=this._lastProgram=null;this._lastPointTexCoords.set(0,0,1,1);this._lastPointZ=this._currentZ=this._baseZ=0;b=this._batchState;b.currentShader=null;b.currentFramebuffer=null;G.set(b.currentColor,1,1,1,1);b.clearColor.setRgba(0,0,0,0);b.pointTexCoords.set(0,0,1,1);a.clearColor(0,0,0,0);a.clear(a.COLOR_BUFFER_BIT);a.enable(a.BLEND);a.blendFunc(a.ONE,a.ONE_MINUS_SRC_ALPHA);this._lastSrcBlend=a.ONE;this._lastDestBlend=a.ONE_MINUS_SRC_ALPHA;this._InitBlendModes(a);
  a.disable(a.CULL_FACE);a.disable(a.STENCIL_TEST);a.disable(a.DITHER);a.disable(a.DEPTH_TEST);this._pointBuffer=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,this._pointBuffer);a.bufferData(a.ARRAY_BUFFER,this._pointData.byteLength,a.DYNAMIC_DRAW);this._vertexBuffer=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,this._vertexBuffer);a.bufferData(a.ARRAY_BUFFER,this._vertexData.byteLength,a.DYNAMIC_DRAW);this._texcoordBuffer=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,this._texcoordBuffer);a.bufferData(a.ARRAY_BUFFER,
  this._texcoordData.byteLength,a.DYNAMIC_DRAW);this._indexBuffer=a.createBuffer();a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this._indexBuffer);a.bufferData(a.ELEMENT_ARRAY_BUFFER,this._indexData,a.STATIC_DRAW);a.activeTexture(a.TEXTURE0);a.bindTexture(a.TEXTURE_2D,null);this._maxTextureSize=a.getParameter(a.MAX_TEXTURE_SIZE);b=a.getParameter(a.ALIASED_POINT_SIZE_RANGE);this._minPointSize=b[0];this._maxPointSize=b[1];b=a.getShaderPrecisionFormat(a.VERTEX_SHADER,a.HIGH_FLOAT);const c=a.getShaderPrecisionFormat(a.FRAGMENT_SHADER,
  a.HIGH_FLOAT);this._highpPrecision=b&&c?Math.min(b.precision,c.precision):0;2048<this._maxPointSize&&(this._maxPointSize=2048);this._extensions=a.getSupportedExtensions();if(b=a.getExtension("WEBGL_debug_renderer_info"))this._unmaskedVendor=a.getParameter(b.UNMASKED_VENDOR_WEBGL),this._unmaskedRenderer=a.getParameter(b.UNMASKED_RENDERER_WEBGL);this._parallelShaderCompileExt=a.getExtension("KHR_parallel_shader_compile");k.isDebug&&(x=a.getExtension("WEBGL_lose_context"));if(this._isGpuProfilingEnabled)if(1===
  this.GetWebGLVersionNumber()){if("Chromium"!==k.Platform.BrowserEngine||81<=k.Platform.BrowserVersionNumber||"undefined"!==typeof document)this._timerExt=a.getExtension("EXT_disjoint_timer_query")}else this._timerExt=a.getExtension("EXT_disjoint_timer_query_webgl2")||a.getExtension("EXT_disjoint_timer_query");this._ClearAllShaderPrograms();a=k.Gfx.WebGLShaderProgram;b=a.GetDefaultVertexShaderSource(this._is3d,!1);a=[[a.GetTextureFillFragmentShaderSource(),b,"<default>"],[a.GetTextureFillFragmentShaderSource(),
  b,"<default-device-transform>"],[a.GetPointFragmentShaderSource(),a.GetPointVertexShaderSource(),"<point>"],[a.GetColorFillFragmentShaderSource(),b,"<fill>"],[a.GetLinearGradientFillFragmentShaderSource(),b,"<lineargradient>"],[a.GetHardEllipseFillFragmentShaderSource(),b,"<hardellipse>"],[a.GetHardEllipseOutlineFragmentShaderSource(),b,"<hardellipseoutline>"],[a.GetSmoothEllipseFillFragmentShaderSource(),b,"<smoothellipse>"],[a.GetSmoothEllipseOutlineFragmentShaderSource(),b,"<smoothellipseoutline>"],
  [a.GetSmoothLineFillFragmentShaderSource(),b,"<smoothline>"],[a.GetTilemapFragmentShaderSource(),a.GetDefaultVertexShaderSource(this._is3d,!0),"<tilemap>"]];a=await Promise.all(a.map(a=>this.CreateShaderProgram({src:a[0]},a[1],a[2])));this._spTextureFill=a[0];this._spDeviceTransformTextureFill=a[1];this._spPoints=a[2];this._spColorFill=a[3];this._spLinearGradientFill=a[4];this._spHardEllipseFill=a[5];this._spHardEllipseOutline=a[6];this._spSmoothEllipseFill=a[7];this._spSmoothEllipseOutline=a[8];
  this._spSmoothLineFill=a[9];this._spTilemapFill=a[10];this._currentStateGroup=null;this.SetTextureFillMode()}Is3D(){return this._is3d}GetNumVertexComponents(){return this._is3d?3:2}SetBaseZ(a){this._baseZ=a}GetBaseZ(){return this._baseZ}SetCurrentZ(a){this._currentZ=a;this._currentStateGroup=null}GetCurrentZ(){return this._currentZ}async CreateShaderProgram(a,b,c){a=await k.Gfx.WebGLShaderProgram.Create(this,a,b,c);this._AddShaderProgram(a);return a}ResetLastProgram(){this._lastProgram=null}SetSize(a,
  b,c){if(this._width!==a||this._height!==b||c){this.EndBatch();c=this._gl;var d=this._batchState;this._width=a;this._height=b;a=this.GetScissoredViewportWidth();b=this.GetScissoredViewportHeight();this._UpdateViewportRenderer(a,b,this._width,this._height);this._UpdateViewportBatch(a,b,this._matP);this._spDeviceTransformTextureFill&&(c.useProgram(this._spDeviceTransformTextureFill.GetShaderProgram()),this._spDeviceTransformTextureFill._UpdateDeviceTransformUniforms(this._matP),this._lastProgram=this._spDeviceTransformTextureFill,
  this._batchState.currentShader=this._spDeviceTransformTextureFill);c.bindTexture(c.TEXTURE_2D,null);c.activeTexture(c.TEXTURE1);c.bindTexture(c.TEXTURE_2D,null);c.activeTexture(c.TEXTURE0);this._lastTexture1=this._lastTexture0=null;this._currentRenderTarget&&this._currentRenderTarget._Resize(this._width,this._height);c.bindFramebuffer(c.FRAMEBUFFER,null);this._currentRenderTarget=null;d.currentFramebuffer=null}}_UpdateViewportRenderer(a,b,c,d){this._cam[2]=100;u.lookAt(this._matMV,this._cam,this._look,
  this._up);u.perspective(this._matP,45,a/b,this.GetNearZ(),this.GetFarZ());const e=[0,0],f=[0,0],g=self.devicePixelRatio;this.Project(0,0,a,b,e);this.Project(1,1,a,b,f);this._worldScale[0]=g/(f[0]-e[0]);this._worldScale[1]=-g/(f[1]-e[1]);this._lastBackbufferWidth=c;this._lastBackbufferHeight=d}_UpdateViewportBatch(a,b,c){const d=this._batchState;this._gl.viewport(0,0,a,b);a=this._allShaderPrograms;b=d.currentShader;for(let d=0,f=a.length;d<f;++d){const e=a[d];e===b?e.UpdateMatP(c,!0):e.SetMatPStale()}u.copy(d.currentMatP,
  c)}SetViewportScissor(a,b){const c=this._gl;if(this._width===a&&this._height===b)this._isScissorViewport&&(this.EndBatch(),c.disable(c.SCISSOR_TEST),this._isScissorViewport=!1,this._viewportScissorHeight=this._viewportScissorWidth=-1,this.SetSize(this._width,this._height,!0));else if(this._isScissorViewport||(this.EndBatch(),c.enable(c.SCISSOR_TEST),this._isScissorViewport=!0),this._viewportScissorWidth!==a||this._viewportScissorHeight!==b)this.EndBatch(),c.scissor(0,0,a,b),this._viewportScissorWidth=
  a,this._viewportScissorHeight=b,this.SetSize(this._width,this._height,!0)}RemoveViewportScissor(){const a=this._gl;this._isScissorViewport&&(this.EndBatch(),a.disable(a.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()}UpdateModelView(){areMat4sEqual(this._lastMV,
  this._matMV)||(this.PushBatch().InitUpdateModelView(this._matMV),u.copy(this._lastMV,this._matMV),this._topOfBatch=0)}GetBatchState(){return this._batchState}PushBatch(){const a=this._batch;this._batchPtr===a.length&&a.push(new k.Gfx.WebGLBatchJob(this._batchState));return a[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 a=this._gl;
  0<this._pointPtr&&(a.bindBuffer(a.ARRAY_BUFFER,this._pointBuffer),a.bufferSubData(a.ARRAY_BUFFER,0,this._pointData.subarray(0,this._pointPtr)));0<this._vertexPtr&&(a.bindBuffer(a.ARRAY_BUFFER,this._vertexBuffer),a.bufferSubData(a.ARRAY_BUFFER,0,this._vertexData.subarray(0,this._vertexPtr)),a.bindBuffer(a.ARRAY_BUFFER,this._texcoordBuffer),a.bufferSubData(a.ARRAY_BUFFER,0,this._texcoordData.subarray(0,this._texPtr)))}_ExecuteBatch(){const a=this._batch;for(let b=0,c=this._batchPtr;b<c;++b)a[b].Run()}GetOpacity(){return this._lastColor.getA()}SetColorRgba(a,
  b,c,d){const e=this._lastColor;e.equalsRgba(a,b,c,d)||(e.setRgba(a,b,c,d),this.PushBatch().InitSetColor(e),this._topOfBatch=0,this._currentStateGroup=null)}SetOpacity(a){const b=this._lastColor;b.getA()!==a&&(b.setA(a),this.PushBatch().InitSetColor(b),this._topOfBatch=0,this._currentStateGroup=null)}SetColor(a){const b=this._lastColor;b.equals(a)||(b.set(a),this.PushBatch().InitSetColor(b),this._topOfBatch=0,this._currentStateGroup=null)}ResetColor(){this.SetColorRgba(1,1,1,1)}GetColor(){return this._lastColor}SetTexture(a){a!==
  this._lastTexture0&&(this.PushBatch().InitSetTexture(a),this._lastTexture0=a,this._topOfBatch=0)}_ResetLastTexture(){this._lastTexture0=null}SetBlendMode(a){a=this._GetBlendByIndex(a);this._SetBlend(a[0],a[1])}SetNamedBlendMode(a){a=this.GetNamedBlend(a);this._SetBlend(a.srcBlend,a.destBlend)}_SetBlend(a,b){if(a!==this._lastSrcBlend||b!==this._lastDestBlend)this.PushBatch().InitSetBlend(a,b),this._lastSrcBlend=a,this._lastDestBlend=b,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(a){this.Rect2(a.getLeft(),a.getTop(),a.getRight(),a.getBottom())}Rect2(a,b,c,d){this.Quad2(a,b,c,b,c,d,a,d)}_ExtendQuadBatch(){let a=this._vertexPtr;a>=this._lastVertexPtr&&(this.EndBatch(),a=0);1===this._topOfBatch?
  this._batch[this._batchPtr-1]._indexCount+=6:(this.PushBatch().InitQuad(this._is3d?a:a/2*3,6),this._topOfBatch=1)}_WriteQuadToVertexBuffer(a){a.writeToTypedArray3D(this._vertexData,this._vertexPtr,this._baseZ+this._currentZ);this._vertexPtr+=12}Quad(a){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(a);B.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad2(a,b,c,d,e,f,g,m){this._ExtendQuadBatch();const h=this._vertexData;let l=this._vertexPtr;const q=this._baseZ+this._currentZ;
  this._is3d?(h[l++]=a,h[l++]=b,h[l++]=q,h[l++]=c,h[l++]=d,h[l++]=q,h[l++]=e,h[l++]=f,h[l++]=q,h[l++]=g,h[l++]=m,h[l++]=q):(h[l++]=a,h[l++]=b,h[l++]=c,h[l++]=d,h[l++]=e,h[l++]=f,h[l++]=g,h[l++]=m);this._vertexPtr=l;B.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad3(a,b){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(a);b.writeAsQuadToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad4(a,b){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(a);b.writeToTypedArray(this._texcoordData,
  this._texPtr);this._texPtr+=8}FullscreenQuad(a,b){u.copy(E,this._lastMV);v.copy(C,this._cam);v.copy(D,this._look);this._cam[0]=0;this._cam[1]=0;this._cam[2]=100*self.devicePixelRatio;this._look[0]=0;this._look[1]=0;this._look[2]=0;this.ResetModelView();this.UpdateModelView();if(this._isScissorViewport){a=this._viewportScissorWidth/2;var c=this._viewportScissorHeight/2;n.set(-a,c,-a+this._viewportScissorWidth,c-this._viewportScissorHeight);p.setFromRect(n);n.set(0,0,this._viewportScissorWidth/this._width,
  this._viewportScissorHeight/this._height);this.Quad3(p,n)}else if("crop"===a&&this._currentRenderTarget&&b){a=this._width/2;c=this._height/2;const f=b.GetWidth();b=b.GetHeight();var d=this._currentRenderTarget.GetWidth(),e=this._currentRenderTarget.GetHeight();d=Math.min(d,f);const g=Math.min(e,b),k=Math.max(b-e,0);e=Math.max(e-b,0);n.set(-a,c-e,-a+d,c-g-e);p.setFromRect(n);n.set(0,k,d,g+k);n.divide(f,b);this.Quad3(p,n)}else{let [b,d]=this.GetRenderTargetSize(this._currentRenderTarget);a=b/2;c=d/
  2;this.Rect2(-a,c,a,-c)}u.copy(this._matMV,E);v.copy(this._cam,C);v.copy(this._look,D);this.UpdateModelView()}ConvexPoly(a){var b=a.length/2;if(3>b)throw Error("need at least 3 points");b-=2;const c=b-1,d=a[0],e=a[1];for(let f=0;f<b;f+=2){const b=2*f,k=a[b+2],h=a[b+3],l=a[b+4],n=a[b+5];f===c?this.Quad2(d,e,k,h,l,n,l,n):this.Quad2(d,e,k,h,l,n,a[b+6],a[b+7])}}Line(a,b,c,d){var e=k.angleTo(a,b,c,d),f=.5*this._lineWidth;const g=Math.sin(e)*f;e=Math.cos(e)*f;f=this._lineCap;2===f?this.LinePreCalc_LineCap2(a,
  b,c,d,g,e):1===f?this.LinePreCalc_LineCap1(a,b,c,d,g,e):this.LinePreCalc_LineCap0(a,b,c,d,g,e)}LinePreCalc_LineCap2(a,b,c,d,e,f){var g=this._lineOffset;a=a+g-f;b=b+g-e;c=c+g+f;d=d+g+e;g=2*f;const m=2*e;this.Quad2(a+e,b-f,c+e,d-f,c-e-g,d+f-m,a-e+g,b+f+m)}LinePreCalc_LineCap1(a,b,c,d,e,f){const g=this._lineOffset;a=a+g-f;b=b+g-e;c=c+g+f;d=d+g+e;this.Quad2(a+e,b-f,c+e,d-f,c-e,d+f,a-e,b+f)}LinePreCalc_LineCap0(a,b,c,d,e,f){const g=this._lineOffset;a+=g;b+=g;c+=g;d+=g;this.Quad2(a+e,b-f,c+e,d-f,c-e,d+
  f,a-e,b+f)}TexturedLine(a,b,c,d,e,f){var g=k.angleTo(a,b,c,d),m=.5*this._lineWidth;const h=Math.sin(g)*m;g=Math.cos(g)*m;m=this._lineCap;2===m?this.TexturedLinePreCalc_LineCap2(a,b,c,d,h,g,e,f):1===m?this.TexturedLinePreCalc_LineCap1(a,b,c,d,h,g,e,f):this.TexturedLinePreCalc_LineCap0(a,b,c,d,h,g,e,f)}TexturedLinePreCalc_LineCap2(a,b,c,d,e,f,g,m){var h=this._lineOffset;a=a+h-f;b=b+h-e;c=c+h+f;d=d+h+e;h=2*f;const l=2*e;p.set(a+e,b-f,c+e,d-f,c-e-h,d+f-l,a-e+h,b+f+l);n.set(g,0,m,0);this.Quad3(p,n)}TexturedLinePreCalc_LineCap1(a,
  b,c,d,e,f,g,m){const h=this._lineOffset;a=a+h-f;b=b+h-e;c=c+h+f;d=d+h+e;p.set(a+e,b-f,c+e,d-f,c-e,d+f,a-e,b+f);n.set(g,0,m,0);this.Quad3(p,n)}TexturedLinePreCalc_LineCap0(a,b,c,d,e,f,g,m){const h=this._lineOffset;a+=h;b+=h;c+=h;d+=h;p.set(a+e,b-f,c+e,d-f,c-e,d+f,a-e,b+f);n.set(g,0,m,0);this.Quad3(p,n)}LineRect(a,b,c,d){const e=.5*this._lineWidth,f=this._lineCap;2===f?this._LineRectPreCalc_LineCap2(a,b,c,d,e):1===f?this._LineRectPreCalc_LineCap1(a,b,c,d,e):this._LineRectPreCalc_LineCap0(a,b,c,d,e)}_LineRectPreCalc_LineCap2(a,
  b,c,d,e){this.LinePreCalc_LineCap2(a,b,c,b,0,e);this.LinePreCalc_LineCap2(c,b,c,d,e,0);this.LinePreCalc_LineCap2(c,d,a,d,0,-e);this.LinePreCalc_LineCap2(a,d,a,b,-e,0)}_LineRectPreCalc_LineCap1(a,b,c,d,e){this.LinePreCalc_LineCap1(a,b,c,b,0,e);this.LinePreCalc_LineCap1(c,b,c,d,e,0);this.LinePreCalc_LineCap1(c,d,a,d,0,-e);this.LinePreCalc_LineCap1(a,d,a,b,-e,0)}_LineRectPreCalc_LineCap0(a,b,c,d,e){this.LinePreCalc_LineCap0(a,b,c,b,0,e);this.LinePreCalc_LineCap0(c,b,c,d,e,0);this.LinePreCalc_LineCap0(c,
  d,a,d,0,-e);this.LinePreCalc_LineCap0(a,d,a,b,-e,0)}LineRect2(a){this.LineRect(a.getLeft(),a.getTop(),a.getRight(),a.getBottom())}LineQuad(a){var b=k.angleTo(a.getTlx(),a.getTly(),a.getTrx(),a.getTry()),c=.5*this._lineWidth;const d=Math.sin(b)*c;b=Math.cos(b)*c;c=this._lineCap;2===c?this._LineQuadPreCalc_LineCap2(a,d,b):1===c?this._LineQuadPreCalc_LineCap1(a,d,b):this._LineQuadPreCalc_LineCap0(a,d,b)}_LineQuadPreCalc_LineCap2(a,b,c){this.LinePreCalc_LineCap2(a.getTlx(),a.getTly(),a.getTrx(),a.getTry(),
  b,c);this.LinePreCalc_LineCap2(a.getTrx(),a.getTry(),a.getBrx(),a.getBry(),c,-b);this.LinePreCalc_LineCap2(a.getBrx(),a.getBry(),a.getBlx(),a.getBly(),-b,-c);this.LinePreCalc_LineCap2(a.getBlx(),a.getBly(),a.getTlx(),a.getTly(),-c,b)}_LineQuadPreCalc_LineCap1(a,b,c){this.LinePreCalc_LineCap1(a.getTlx(),a.getTly(),a.getTrx(),a.getTry(),b,c);this.LinePreCalc_LineCap1(a.getTrx(),a.getTry(),a.getBrx(),a.getBry(),c,-b);this.LinePreCalc_LineCap1(a.getBrx(),a.getBry(),a.getBlx(),a.getBly(),-b,-c);this.LinePreCalc_LineCap1(a.getBlx(),
  a.getBly(),a.getTlx(),a.getTly(),-c,b)}_LineQuadPreCalc_LineCap0(a,b,c){this.LinePreCalc_LineCap0(a.getTlx(),a.getTly(),a.getTrx(),a.getTry(),b,c);this.LinePreCalc_LineCap0(a.getTrx(),a.getTry(),a.getBrx(),a.getBry(),c,-b);this.LinePreCalc_LineCap0(a.getBrx(),a.getBry(),a.getBlx(),a.getBly(),-b,-c);this.LinePreCalc_LineCap0(a.getBlx(),a.getBly(),a.getTlx(),a.getTly(),-c,b)}SetLineWidth(a){this._lineWidth=a;this._lineWidthStack[this._lineWidthStack.length-1]=a}GetLineWidth(){return this._lineWidth}PushLineWidth(a){if(100<=
  this._lineWidthStack.length)throw Error("pushed too many line widths - check push/pop pairs");this._lineWidthStack.push(a);this._lineWidth=a}PopLineWidth(){if(1>=this._lineWidthStack.length)throw Error("cannot pop last line width - check push/pop pairs");this._lineWidthStack.pop();this._lineWidth=this._lineWidthStack[this._lineWidthStack.length-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(a){if("butt"===a)this.PushLineCapButt();else if("square"===a)this.PushLineCapSquare();else if("zag"===a)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[this._lineCapStack.length-1]}SetLineOffset(a){this._lineOffset=a;this._lineOffsetStack[this._lineOffsetStack.length-1]=a}GetLineOffset(){return this._lineOffset}PushLineOffset(a){if(100<=
  this._lineOffsetStack.length)throw Error("pushed too many line offsets - check push/pop pairs");this._lineOffsetStack.push(a);this._lineOffset=a}PopLineOffset(){if(1>=this._lineOffsetStack.length)throw Error("cannot pop last line offset - check push/pop pairs");this._lineOffsetStack.pop();this._lineOffset=this._lineOffsetStack[this._lineOffsetStack.length-1]}SetPointTextureCoords(a){this._lastPointTexCoords.equals(a)||(this._lastPointTexCoords.copy(a),this.PushBatch().InitSetPointTexCoords(a),this._topOfBatch=
  0)}Point(a,b,c,d){7996<=this._pointPtr&&this.EndBatch();let e=this._pointPtr;var f=this._baseZ+this._currentZ;2===this._topOfBatch&&this._lastPointZ===f?this._batch[this._batchPtr-1]._indexCount++:(this.PushBatch().InitPoints(e,f),this._topOfBatch=2,this._lastPointZ=f);f=this._pointData;f[e++]=a;f[e++]=b;f[e++]=c;f[e++]=d;this._pointPtr=e}SetProgram(a){this._lastProgram!==a&&(this.PushBatch().InitSetProgram(a),this._lastProgram=a,this._topOfBatch=0,this._currentStateGroup=null)}SetTextureFillMode(){this.SetProgram(this._spTextureFill)}SetDeviceTransformTextureFillMode(){this.SetProgram(this._spDeviceTransformTextureFill)}SetColorFillMode(){this.SetProgram(this._spColorFill)}SetLinearGradientFillMode(){this.SetProgram(this._spLinearGradientFill)}SetGradientColor(a){this.PushBatch().InitSetGradientColor(a);
  this._topOfBatch=0}SetHardEllipseFillMode(){this.SetProgram(this._spHardEllipseFill)}SetHardEllipseOutlineMode(){this.SetProgram(this._spHardEllipseOutline)}SetSmoothEllipseFillMode(){this.SetProgram(this._spSmoothEllipseFill)}SetSmoothEllipseOutlineMode(){this.SetProgram(this._spSmoothEllipseOutline)}SetEllipseParams(a,b,c=1){this.PushBatch().InitSetEllipseParams(a,b,c);this._topOfBatch=0}SetSmoothLineFillMode(){this.SetProgram(this._spSmoothLineFill)}SetTilemapFillMode(){this.SetProgram(this._spTilemapFill)}SetTilemapInfo(a,
  b,c,d,e,f,g){if(this._lastProgram!==this._spTilemapFill)throw Error("must set tilemap fill mode first");this.PushBatch().InitSetTilemapInfo(a,b,c,d,e,f,g);this._topOfBatch=0}SetProgramParameters(a,b,c,d,e,f,g,m,h,l,q){const w=this._lastProgram;var r=w._hasAnyOptionalUniforms;const F=!!q.length;if(r&&!w.AreOptionalUniformsAlreadySetInBatch(b,c,d,e,f,g,m,h,l)||F&&!w.AreCustomParametersAlreadySetInBatch(q)){var t=this.PushBatch();t.InitSetProgramParameters();r&&(w.SetOptionalUniformsInBatch(b,c,d,e,
  f,g,m,h,l),r=t._mat4param,r[0]=f,r[1]=g,b.writeToTypedArray(r,2),r[6]=m,r[7]=h,c.writeToTypedArray(r,12),b=t._colorParam,e.writeToTypedArray(b,0),e=b[1],b[1]=b[3],b[3]=e,d.writeToTypedArray(t._srcOriginRect,0),t._startIndex=l,w._uSamplerBack.IsUsed()?t._texParam=a?a.GetTexture():null:t._texParam=null);F&&(w.SetCustomParametersInBatch(q),k.shallowAssignArray(t._shaderParams,q));this._topOfBatch=0}}ClearRgba(a,b,c,d){this.PushBatch().InitClearSurface2(a,b,c,d);this._topOfBatch=0}Clear(a){this.PushBatch().InitClearSurface(a);
  this._topOfBatch=0}ClearRect(a,b,c,d){this.ClearRect4(a,b,c,d,0,0,0,0)}ClearRect2(a){this.ClearRect4(a.getLeft(),a.getTop(),a.width(),a.height(),0,0,0,0)}ClearRect3(a,b){this.ClearRect4(a.getLeft(),a.getTop(),a.width(),a.height(),b.getR(),b.getG(),b.getB(),b.getA())}ClearRect4(a,b,c,d,e,f,g,m){0>c||0>d||(this.PushBatch().InitClearRect(a,b,c,d,e,f,g,m),this._topOfBatch=0)}Start(){}Finish(){super.Finish();this._gl.flush()}CheckForQueryResults(){for(const a of this._allQueryResultBuffers)a.CheckForResults(this._frameNumber)}IsContextLost(){return!this._gl||
  this._gl.isContextLost()||this._isInitialisingAfterContextRestored}OnContextLost(){k.Gfx.WebGLRendererTexture.OnContextLost();k.Gfx.WebGLRenderTarget.OnContextLost();k.Gfx.RendererText.OnContextLost();for(const a of this._allQueryResultBuffers)a.Clear();this._extensions=[];this._parallelShaderCompileExt=this._timerExt=null;this._unmaskedRenderer=this._unmaskedVendor="(unavailable)";this._spTilemapFill=this._spPoints=this._spSmoothLineFill=this._spSmoothEllipseOutline=this._spSmoothEllipseFill=this._spHardEllipseOutline=
  this._spHardEllipseFill=this._spLinearGradientFill=this._spColorFill=this._spDeviceTransformTextureFill=this._spTextureFill=this._lastProgram=null;for(const a of this._stateGroups.values())a.OnContextLost();for(const a of this._allShaderPrograms)a.Release();this._ClearAllShaderPrograms()}async OnContextRestored(){this._isInitialisingAfterContextRestored=!0;await this.InitState();this._isInitialisingAfterContextRestored=!1;for(const a of this._stateGroups.values())a.OnContextRestored(this);this.SetSize(this._width,
  this._height,!0)}CreateStaticTexture(a,b){if(this.IsContextLost())throw Error("context lost");this.EndBatch();const c=k.New(k.Gfx.WebGLRendererTexture,this);c._CreateStatic(a,b);return c}CreateStaticTextureAsync(a,b){if(this.IsContextLost())return Promise.reject("context lost");b=Object.assign({},b);const c=b.wrapX&&"clamp-to-edge"!==b.wrapX||b.wrapY&&"clamp-to-edge"!==b.wrapY;if(!k.Supports.ImageBitmapOptions||!this.SupportsNPOTTextures()&&c)return k.Supports.ImageBitmap?createImageBitmap(a).then(a=>
  k.Asyncify(()=>this.CreateStaticTexture(a,b))):a instanceof Blob?k.BlobToImage(a,!0).then(a=>this.CreateStaticTextureAsync(a,b)):"undefined"!==typeof HTMLImageElement&&a instanceof HTMLImageElement&&"function"===typeof a.decode?a.decode().then(()=>k.Asyncify(()=>this.CreateStaticTexture(a,b))):k.Asyncify(()=>this.CreateStaticTexture(a,b));b.premultiplyAlpha=!1;return createImageBitmap(a,{premultiplyAlpha:"premultiply"}).then(a=>k.Asyncify(()=>this.CreateStaticTexture(a,b)))}CreateDynamicTexture(a,
  b,c){this.EndBatch();const d=k.New(k.Gfx.WebGLRendererTexture,this);d._CreateDynamic(a,b,c);return d}UpdateTexture(a,b,c){this.EndBatch();b._Update(a,c)}DeleteTexture(a){a&&(a.SubtractReference(),0<a.GetReferenceCount()||(this.EndBatch(),a===this._lastTexture0&&(this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._lastTexture0=null),a===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),a._Delete()))}CreateRenderTarget(a){let b=this._width,c=this._height,d=!0;a&&("number"===typeof a.width&&(b=a.width,d=!1),"number"===typeof a.height&&(c=a.height,d=!1));if(0>=b||0>=c)throw Error("invalid size");this.EndBatch();const e=k.New(k.Gfx.WebGLRenderTarget,this);e._Create(b,c,Object.assign({isDefaultSize:d},a));this._currentRenderTarget=null;this._batchState.currentFramebuffer=null;return e}SetRenderTarget(a){if(a!==this._currentRenderTarget){if(a){a.IsDefaultSize()&&a._Resize(this._width,
  this._height);var b=a.GetWidth();var c=a.GetHeight();var d=b;var e=c}else b=this._width,c=this._height,d=this.GetScissoredViewportWidth(),e=this.GetScissoredViewportHeight();var f=this._lastBackbufferWidth!==b||this._lastBackbufferHeight!==c;f&&this._UpdateViewportRenderer(d,e,b,c);this.PushBatch().InitSetRenderTarget(a,f,this._matP);this._currentRenderTarget=a;this._topOfBatch=0}}GetRenderTarget(){return this._currentRenderTarget}GetRenderTargetSize(a){return a?[a.GetWidth(),a.GetHeight()]:[this._width,
  this._height]}CopyRenderTarget(a,b="stretch"){2>this._version||this._currentRenderTarget&&0<this._currentRenderTarget.GetMultisampling()?(this.SetCopyBlend(),this.ResetColor(),this.DrawRenderTarget(a,b)):(this.PushBatch().InitBlitFramebuffer(a,this._currentRenderTarget,b),this._topOfBatch=0)}DrawRenderTarget(a,b="stretch"){a=a.GetTexture();if(!a)throw Error("not a texture-backed render target");this.SetTexture(a);this.FullscreenQuad(b,a)}InvalidateRenderTarget(a){2>this._version||(this.PushBatch().InitInvalidateFramebuffer(a._GetFramebuffer()),
  this._topOfBatch=0)}DeleteRenderTarget(a){this.SetRenderTarget(null);this.EndBatch();const b=a.GetTexture();b===this._lastTexture0&&(this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._lastTexture0=null);b===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);a._Delete()}async ReadBackRenderTargetToImageData(a,b){this.EndBatch();const c=this._currentRenderTarget;let d,e;if(a){d=
  a.GetWidth();e=a.GetHeight();var f=a._GetFramebuffer()}else d=this.GetWidth(),e=this.GetHeight(),f=null;const g=this._gl;g.bindFramebuffer(g.FRAMEBUFFER,f);a=()=>{g.bindFramebuffer(g.FRAMEBUFFER,null);this._currentRenderTarget=null;this._batchState.currentFramebuffer=null;this.SetRenderTarget(c)};if(!b&&2<=this.GetWebGLVersionNumber()){g.bindFramebuffer(g.READ_FRAMEBUFFER,f);f=g.createBuffer();const c=d*e*4,h=g.PIXEL_PACK_BUFFER;g.bindBuffer(h,f);g.bufferData(h,c,g.STREAM_READ);g.readPixels(0,0,d,
  e,g.RGBA,g.UNSIGNED_BYTE,0);g.bindFramebuffer(g.READ_FRAMEBUFFER,null);g.bindBuffer(h,null);a();const k=g.fenceSync(g.SYNC_GPU_COMMANDS_COMPLETE,0);await this._WaitForObjectReady(()=>g.getSyncParameter(k,g.SYNC_STATUS)===g.SIGNALED);g.deleteSync(k);b=new ImageData(d,e);g.bindBuffer(h,f);g.getBufferSubData(h,0,new Uint8Array(b.data.buffer),0,c);g.bindBuffer(h,null);g.deleteBuffer(f)}else b=new ImageData(d,e),g.readPixels(0,0,d,e,g.RGBA,g.UNSIGNED_BYTE,new Uint8Array(b.data.buffer)),a();return b}StartQuery(a){this.SupportsGPUProfiling()&&
  (this.PushBatch().InitStartQuery(a),this._topOfBatch=0)}EndQuery(a){this.SupportsGPUProfiling()&&(this.PushBatch().InitEndQuery(a),this._topOfBatch=0)}_WaitForObjectReady(a){const b=new Promise(b=>z.add({resolve:b,checkFunc:a}));-1===y&&(y=self.requestAnimationFrame(CheckPendingPolls));return b}IsDesynchronized(){return!!this._attribs.desynchronized}GetEstimatedBackBufferMemoryUsage(){return this._width*this._height*(this._attribs.alpha?4:3)}GetEstimatedRenderBufferMemoryUsage(){let a=0;for(const b of k.Gfx.WebGLRenderTarget.allRenderTargets())b.GetTexture()||
  (a+=b.GetEstimatedMemoryUsage());return a}GetEstimatedTextureMemoryUsage(){let a=0;for(const b of k.Gfx.WebGLRendererTexture.allTextures())a+=b.GetEstimatedMemoryUsage();return a}GetEstimatedTotalMemoryUsage(){return this.GetEstimatedBackBufferMemoryUsage()+this.GetEstimatedRenderBufferMemoryUsage()+this.GetEstimatedTextureMemoryUsage()}GetWebGLVersionString(){return this._versionString}GetWebGLVersionNumber(){return this._version}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}HasMajorPerformanceCaveat(){return this._hasMajorPerformanceCaveat}SupportsGPUProfiling(){return!!this._timerExt}_GetDisjointTimerQueryExtension(){return this._timerExt}_GetParallelShaderCompileExtension(){return this._parallelShaderCompileExt}_AddQueryResultBuffer(a){this._allQueryResultBuffers.add(a)}_RemoveQueryResultBuffer(a){this._allQueryResultBuffers.delete(a)}_GetTimeQueryStack(){return this._timeQueryStack}GetContext(){return this._gl}_InitBlendModes(a){this._InitBlendModeData([["normal",
  a.ONE,a.ONE_MINUS_SRC_ALPHA],["additive",a.ONE,a.ONE],["xor",a.ONE,a.ONE_MINUS_SRC_ALPHA],["copy",a.ONE,a.ZERO],["destination-over",a.ONE_MINUS_DST_ALPHA,a.ONE],["source-in",a.DST_ALPHA,a.ZERO],["destination-in",a.ZERO,a.SRC_ALPHA],["source-out",a.ONE_MINUS_DST_ALPHA,a.ZERO],["destination-out",a.ZERO,a.ONE_MINUS_SRC_ALPHA],["source-atop",a.DST_ALPHA,a.ONE_MINUS_SRC_ALPHA],["destination-atop",a.ONE_MINUS_DST_ALPHA,a.SRC_ALPHA]])}CreateRendererText(){return k.New(k.Gfx.RendererText,this)}}};
  
  
  // c3/interfaces/IRuntime.js
  'use strict';{var SortZOrderList=function(a,c){const e=a[0]-c[0];return 0!==e?e:a[1]-c[1]};const m=self.C3;let b=null;const k=new Set,h=[],l=[];let n=!1;self.IRuntime=class{constructor(a,c){b=a;Object.defineProperties(this,{assets:{value:b.GetAssetManager().GetIAssetManager(),writable:!1},objects:{value:c,writable:!1},globalVars:{value:{},writable:!1},projectName:{value:b.GetProjectName(),writable:!1},projectVersion:{value:b.GetProjectVersion(),writable:!1},storage:{value:new self.IStorage(b),writable:!1},
  isInWorker:{value:b.IsInWorker(),writable:!1}});b.UserScriptDispatcher().addEventListener("keydown",a=>{k.has(a.key)?a.stopPropagation():k.add(a.key)});b.UserScriptDispatcher().addEventListener("keyup",a=>k.delete(a.key));b.Dispatcher().addEventListener("window-blur",()=>k.clear());b.IsInWorker()&&(self.alert=a=>{n||(n=!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(a)})}_InitGlobalVars(a){Object.defineProperties(this.globalVars,a)}addEventListener(a,c){b.UserScriptDispatcher().addEventListener(a,c)}removeEventListener(a,c){b.UserScriptDispatcher().removeEventListener(a,c)}callFunction(a,...c){const e=b.GetEventSheetManager(),d=e.GetFunctionBlockByName(a);if(!d)throw Error(`cannot find function name '${a}'`);if(!d.IsEnabled())return d.GetDefaultReturnValue();if(c.length<d.GetFunctionParameterCount())throw Error(`not enough function parameters passed for '${a}' (${c.length} passed, ${d.GetFunctionParameterCount()} expected)`);
  const f=d.GetEventBlock();a=null;var g=e.GetCurrentEvent();g&&(g=g.GetSolModifiersIncludingParents(),0<g.length&&(a=g,e.PushCleanSol(g)));c=f.RunAsExpressionFunctionCall(f.GetSolModifiersIncludingParents(),d.GetReturnType(),d.GetDefaultReturnValue(),...c);a&&e.PopSol(a);return c}setReturnValue(a){const c=b.GetEventStack().GetCurrentExpFuncStackFrame();if(!c)throw Error("not in a function which returns a value");switch(c.GetFunctionReturnType()){case 1:"number"===typeof a&&c.SetFunctionReturnValue(a);
  break;case 2:"string"===typeof a&&c.SetFunctionReturnValue(a);break;case 3:"number"!==typeof a&&"string"!==typeof a||c.SetFunctionReturnValue(a)}}get dt(){return b.GetDt()}get gameTime(){return b.GetGameTime()}get wallTime(){return b.GetWallTime()}random(){return b.Random()}get layout(){return b.GetMainRunningLayout().GetILayout()}getLayout(a){const c=b.GetLayoutManager();if("number"===typeof a||"string"===typeof a)a=c.GetLayout(a);else throw new TypeError("expected string or number");if(!a)throw Error("invalid layout");
  return a.GetILayout()}getAllLayouts(){return b.GetLayoutManager().GetAllLayouts().map(a=>a.GetILayout())}goToLayout(a){const c=b.GetLayoutManager();if("number"===typeof a||"string"===typeof a)a=c.GetLayout(a);else throw new TypeError("expected string or number");if(!a)throw Error("invalid layout");c.IsPendingChangeMainLayout()||c.ChangeMainLayout(a)}get keyboard(){const a=b._GetCommonScriptInterfaces().keyboard;if(!a)throw Error("runtime.keyboard used but Keyboard object missing - add it to your project first");
  return a}get mouse(){const a=b._GetCommonScriptInterfaces().mouse;if(!a)throw Error("runtime.mouse used but Mouse object missing - add it to your project first");return a}get touch(){const a=b._GetCommonScriptInterfaces().touch;if(!a)throw Error("runtime.touch used but Touch object missing - add it to your project first");return a}invokeDownload(a,c){b.InvokeDownload(a,c)}getInstanceByUid(a){return(a=b.GetInstanceByUID(a))?a.GetInterfaceClass():null}sortZOrder(a,c){const e=b.GetCurrentLayout();for(var d of a){a=
  b._UnwrapScriptInterface(d);if(!a||!a.GetWorldInfo())throw Error("invalid instance");var f=a.GetWorldInfo();h.push([f.GetLayer().GetIndex(),f.GetZIndex()]);l.push(a)}if(0!==h.length){h.sort(SortZOrderList);l.sort((a,b)=>c(a.GetInterfaceClass(),b.GetInterfaceClass()));d=!1;for(let b=0,c=h.length;b<c;++b){a=l[b];f=e.GetLayerByIndex(h[b][0]);const c=h[b][1],g=f._GetInstances();g[c]!==a&&(g[c]=a,a.GetWorldInfo()._SetLayer(f),f.SetZIndicesChanged(),d=!0)}d&&b.UpdateRender();m.clearArray(h);m.clearArray(l)}}alert(a){return b.PostComponentMessageToDOMAsync("runtime",
  "alert",{message:a+(b.IsInWorker()?" [via Web Worker]":"")})}}};
  
  
  // c3/interfaces/IAssetManager.js
  'use strict';{const d=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){d.IsRelativeURL(a)&&(a=a.toLowerCase());return b.GetMediaFileUrl(a,b.GetMediaSubfolder())}get mediaFolder(){return b.GetMediaSubfolder()}async decodeWebMOpus(a,
  c){if(this.isWebMOpusSupported)throw Error("decodeWebMOpus(): not supported because WebM Opus is supported by the platform");c=await b.GetRuntime()._WasmDecodeWebMOpus(c);c=new Float32Array(c);a=a.createBuffer(1,c.length,48E3);a.getChannelData(0).set(c);return a}loadScripts(...a){return b.LoadScripts(...a)}compileWebAssembly(a){return b.CompileWebAssembly(a)}loadStyleSheet(a){return b.LoadStyleSheet(a)}}};
  
  
  // c3/interfaces/IStorage.js
  'use strict';self.IStorage=class{constructor(a){this._storage=a._GetProjectStorage()}getItem(a){return this._storage.getItem(a)}setItem(a,b){return this._storage.setItem(a,b)}removeItem(a){return this._storage.removeItem(a)}clear(){return this._storage.clear()}keys(){return this._storage.keys()}};
  
  
  // c3/interfaces/IObjectClass.js
  'use strict';{const 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,c){b.get(this).UserScriptDispatcher().addEventListener(a,c)}removeEventListener(a,c){b.get(this).UserScriptDispatcher().removeEventListener(a,c)}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){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,c,f){if("number"!==typeof a&&"string"!==typeof a)throw new TypeError("invalid layer parameter");const e=b.get(this);var d=e.GetRuntime();a=d.GetMainRunningLayout().GetLayer(a);if(!a)throw Error("invalid layer");c=d.CreateInstance(e,a,c,f);d=d.GetEventSheetManager();d.BlockFlushingInstances(!0);c._TriggerOnCreated();if(c.IsInContainer())for(const a of c.siblings())a._TriggerOnCreated();d.BlockFlushingInstances(!1);return c.GetInterfaceClass()}}};
  
  
  // c3/interfaces/ILayout.js
  'use strict';{const b=new WeakMap;self.ILayout=class{constructor(a){b.set(this,a);const c=[],d=a.GetEffectList(),e=d.GetAllEffectTypes().length;for(let a=0;a<e;++a)c.push(new self.IEffectInstance(d,a));Object.defineProperties(this,{name:{value:a.GetName(),writable:!1},index:{value:a.GetIndex(),writable:!1},effects:{value:c,writable:!1}})}addEventListener(a,c){b.get(this).UserScriptDispatcher().addEventListener(a,c)}removeEventListener(a,c){b.get(this).UserScriptDispatcher().removeEventListener(a,
  c)}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)}scrollTo(a,c){const d=b.get(this);d.SetScrollX(a);d.SetScrollY(c)}getLayer(a){const c=b.get(this);if("number"===typeof a||"string"===typeof a)a=c.GetLayer(a);else throw new TypeError("expected string or number");if(!a)throw Error("invalid layer");return a.GetILayer()}getAllLayers(){return b.get(this).GetLayers().map(a=>a.GetILayer())}}};
  
  
  // c3/interfaces/ILayer.js
  'use strict';{const g=self.C3,b=new WeakMap;self.ILayer=class{constructor(a){b.set(this,a);const d=[],e=a.GetEffectList(),c=e.GetAllEffectTypes().length;for(let a=0;a<c;++a)d.push(new self.IEffectInstance(e,a));Object.defineProperties(this,{name:{value:a.GetName(),writable:!1},index:{value:a.GetIndex(),writable:!1},layout:{value:a.GetLayout().GetILayout(),writable:!1},effects:{value:d,writable:!1}})}static _Unwrap(a){return b.get(a)}get isVisible(){return b.get(this).IsVisible()}set isVisible(a){b.get(this).SetVisible(a)}get opacity(){return b.get(this).GetOpacity()}set opacity(a){a=
  g.clamp(+a,0,1);isNaN(a)||b.get(this).SetOpacity(a)}getViewport(){return b.get(this).GetViewport().toDOMRect()}cssPxToLayer(a,d,e=0){const c=b.get(this),f=c.GetRuntime();return c.CanvasCssToLayer(a-f.GetCanvasClientX(),d-f.GetCanvasClientY(),e)}layerToCssPx(a,d,e=0){const c=b.get(this),f=c.GetRuntime(),[h,k]=c.LayerToCanvasCss(a,d,e);return[h+f.GetCanvasClientX(),k+f.GetCanvasClientY()]}}};
  
  
  // c3/interfaces/IInstance.js
  'use strict';{var GetDispatcher=function(a){let c=d.get(a);if(c)return c;c=g.New(g.Event.Dispatcher);d.set(a,c);return c};const g=self.C3,e=new WeakMap,d=new WeakMap;let b=null;self.IInstance=class{constructor(){e.set(this,b);const a={runtime:{value:b.GetRuntime().GetIRuntime(),writable:!1},objectType:{value:b.GetObjectClass().GetIObjectClass(),writable:!1},uid:{value:b.GetUID(),writable:!1}};b._GetInstVarsScriptDescriptor(a);b._GetBehaviorsScriptDescriptor(a);Object.defineProperties(this,a);b.GetRuntime()._MapScriptInterface(this,
  b)}static _Init(a){b=a}static _GetInitInst(){return b}_Release(){const a=d.get(this);a&&(a.Release(),d.delete(this));e.delete(this)}addEventListener(a,c,f){GetDispatcher(this).addEventListener(a,c,f)}removeEventListener(a,c,f){GetDispatcher(this).removeEventListener(a,c,f)}dispatchEvent(a){GetDispatcher(this).dispatchEvent(a)}destroy(){const a=e.get(this);a.GetRuntime().DestroyInstance(a)}}};
  
  
  // c3/interfaces/IWorldInstance.js
  'use strict';{const e=self.C3,g=self.IInstance,k=self.ILayer,c=new WeakMap,h=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([...h.entries()].map(a=>[a[1],a[0]])),f=e.New(e.Color);self.IWorldInstance=class extends g{constructor(){super();var a=g._GetInitInst();c.set(this,a);const b=[];var d=a.GetWorldInfo();if(a=d.GetInstanceEffectList()){d=d.GetObjectClass().GetEffectList().GetAllEffectTypes().length;
  for(let c=0;c<d;++c)b.push(new self.IEffectInstance(a,c))}Object.defineProperties(this,{effects:{value:b,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(a){a=+a;const b=c.get(this).GetWorldInfo();isNaN(a)||b.GetX()===a||(b.SetX(a),b.SetBboxChanged())}get y(){return c.get(this).GetWorldInfo().GetY()}set y(a){a=+a;const b=c.get(this).GetWorldInfo();
  isNaN(a)||b.GetY()===a||(b.SetY(a),b.SetBboxChanged())}get zElevation(){return c.get(this).GetWorldInfo().GetZElevation()}set zElevation(a){a=+a;const b=c.get(this),d=b.GetWorldInfo();d.GetZElevation()!==a&&(d.SetZElevation(a),b.GetRuntime().UpdateRender())}get totalZElevation(){return c.get(this).GetWorldInfo().GetTotalZElevation()}get width(){return c.get(this).GetWorldInfo().GetWidth()}set width(a){a=+a;const b=c.get(this).GetWorldInfo();isNaN(a)||b.GetWidth()===a||(b.SetWidth(a),b.SetBboxChanged())}get height(){return c.get(this).GetWorldInfo().GetHeight()}set height(a){a=
  +a;const b=c.get(this).GetWorldInfo();isNaN(a)||b.GetHeight()===a||(b.SetHeight(a),b.SetBboxChanged())}get angle(){return c.get(this).GetWorldInfo().GetAngle()}set angle(a){a=e.clampAngle(+a);const b=c.get(this).GetWorldInfo();isNaN(a)||b.GetAngle()===a||(b.SetAngle(a),b.SetBboxChanged())}get angleDegrees(){return e.toDegrees(this.angle)}set angleDegrees(a){this.angle=e.toRadians(a)}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(a){a=
  !!a;const b=c.get(this),d=b.GetWorldInfo();d.IsVisible()!==a&&(d.SetVisible(a),b.GetRuntime().UpdateRender())}get opacity(){return c.get(this).GetWorldInfo().GetOpacity()}set opacity(a){a=e.clamp(+a,0,1);const b=c.get(this),d=b.GetWorldInfo();isNaN(a)||d.GetOpacity()===a||(d.SetOpacity(a),b.GetRuntime().UpdateRender())}set colorRgb(a){if(3>a.length)throw Error("expected 3 elements");f.setRgb(a[0],a[1],a[2]);a=c.get(this);const b=a.GetWorldInfo();b.GetUnpremultipliedColor().equalsIgnoringAlpha(f)||
  (b.SetUnpremultipliedColor(f),a.GetRuntime().UpdateRender())}get colorRgb(){const a=c.get(this).GetWorldInfo().GetUnpremultipliedColor();return[a.getR(),a.getG(),a.getB()]}set blendMode(a){a=h.get(a);if("number"!==typeof a)throw Error("invalid blend mode");const b=c.get(this);b.GetWorldInfo().SetBlendMode(a);b.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(a){a=
  k._Unwrap(a);if(!a)throw Error("invalid layer");c.get(this).GetWorldInfo().ZOrderMoveToLayer(a)}moveAdjacentToInstance(a,b){c.get(this).GetWorldInfo().ZOrderMoveAdjacentToInstance(c.get(a),b)}containsPoint(a,b){return c.get(this).GetWorldInfo().ContainsPoint(+a,+b)}testOverlap(a){const b=c.get(this);a=c.get(a);return b.GetRuntime().GetCollisionEngine().TestOverlap(b,a)}testOverlapSolid(){var a=c.get(this);return(a=a.GetRuntime().GetCollisionEngine().TestOverlapSolid(a))?a.GetInterfaceClass():null}}};
  
  
  // c3/interfaces/IDOMInstance.js
  'use strict';{const a=new WeakMap;self.IDOMInstance=class extends self.IWorldInstance{constructor(){super();a.set(this,self.IInstance._GetInitInst())}getElement(){return a.get(this).GetSdkInstance()._GetElementInDOMMode()}focus(){a.get(this).GetSdkInstance().FocusElement()}blur(){a.get(this).GetSdkInstance().BlurElement()}setCssStyle(b,c){a.get(this).GetSdkInstance().SetElementCSSStyle(b,c)}}};
  
  
  // c3/interfaces/IBehaviorInstance.js
  'use strict';{const c=new WeakMap;let a=null;self.IBehaviorInstance=class{constructor(){c.set(this,a);const b={runtime:{value:a.GetRuntime().GetIRuntime(),writable:!1},behavior:{value:a.GetBehavior().GetIBehavior(),writable:!1}};Object.defineProperties(this,b)}static _Init(b){a=b}static _GetInitInst(){return a}get instance(){return c.get(this).GetObjectInstance().GetInterfaceClass()}}};
  
  
  // c3/interfaces/IBehavior.js
  'use strict';{const b=new WeakMap;self.IBehavior=class{constructor(a){b.set(this,a);a={runtime:{value:a.GetRuntime().GetIRuntime(),writable:!1}};Object.defineProperties(this,a)}getAllInstances(){return b.get(this).GetInstances().map(a=>a.GetInterfaceClass())}}};
  
  
  // c3/interfaces/IEffectInstance.js
  'use strict';{const g=self.C3,c=new WeakMap;self.IEffectInstance=class{constructor(a,b){c.set(this,a);Object.defineProperties(this,{index:{value:b,writable:!1}})}get name(){return c.get(this).GetAllEffectTypes()[this.index].GetName()}get isActive(){return c.get(this).IsEffectIndexActive(this.index)}set isActive(a){a=!!a;const b=c.get(this);b.IsEffectIndexActive(this.index)!==a&&(b.SetEffectIndexActive(this.index,a),b.UpdateActiveEffects(),b.GetRuntime().UpdateRender())}setParameter(a,b){a=Math.floor(+a);
  const f=c.get(this);var d=f.GetEffectParametersForIndex(this.index);if(0>a||a>=d.length)throw new RangeError("invalid effect parameter index");const e=d[a];if(e instanceof g.Color){if(!Array.isArray(b)||3>b.length)throw new TypeError("expected array with 3 elements");a=b[0];d=b[1];b=b[2];if(e.equalsRgb(a,d,b))return;e.setRgb(a,d,b)}else{if("number"!==typeof b)throw new TypeError("expected number");if(e===b)return;d[a]=b}f.IsEffectIndexActive(this.index)&&f.GetRuntime().UpdateRender()}getParameter(a){a=
  Math.floor(+a);const b=c.get(this).GetEffectParametersForIndex(this.index);if(0>a||a>=b.length)throw new RangeError("invalid effect parameter index");a=b[a];return a instanceof g.Color?[a.getR(),a.getG(),a.getB()]:a}}};
  
  
  // c3/assets/assetManager.js
  'use strict';{var AddScript=function(a){return new Promise((b,d)=>{const c=document.createElement("script");c.onload=b;c.onerror=d;c.async=!1;c.src=a;document.head.appendChild(c)})},GetTypeFromFileExtension=function(a){if(!a)return"";a=a.split(".");if(2>a.length)return"";a=a[a.length-1].toLowerCase();return g.get(a)||""};const c=self.C3,f=new Set(["local","remote"]),g=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"]]);c.AssetManager=class extends c.DefendedBase{constructor(a,b){super();if(!f.has(b.defaultLoadPolicy))throw Error("invalid load policy");this._runtime=a;this._localUrlBlobs=new Map;this._localBlobUrlCache=new Map;this._isCordova=!!b.isCordova;this._isiOSCordova=!!b.isiOSCordova;this._isFileProtocol="file:"===location.protocol;this._supportedAudioFormats=b.supportedAudioFormats||{};this._audioFiles=new Map;this._preloadSounds=!1;this._iconsSubfolder=
  this._fontsSubfolder=this._mediaSubfolder="";this._defaultLoadPolicy=b.defaultLoadPolicy;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=c.New(c.RateLimiter,()=>this._FireLoadingProgressEvent(),50);this._promiseThrottle=new c.PromiseThrottle(Math.max(c.hardwareConcurrency,8));if(b.localUrlBlobs)for(const [a,
  c]of Object.entries(b.localUrlBlobs))this._localUrlBlobs.set(a.toLowerCase(),c);this._iAssetManager=new self.IAssetManager(this)}Release(){this._localUrlBlobs.clear();for(const a of this._localBlobUrlCache.values())URL.revokeObjectURL(a);this._localBlobUrlCache.clear();for(const a of this._allAssets)a.Release();c.clearArray(this._allAssets);this._assetsByUrl.clear();c.clearArray(this._loadPromises);this._runtime=null}GetRuntime(){return this._runtime}_SetMediaSubfolder(a){this._mediaSubfolder=a}GetMediaSubfolder(){return this._mediaSubfolder}_SetFontsSubfolder(a){this._fontsSubfolder=
  a}GetFontsSubfolder(){return this._fontsSubfolder}_SetIconsSubfolder(a){this._iconsSubfolder=a}GetIconsSubfolder(){return this._iconsSubfolder}_HasLocalUrlBlob(a){return this._localUrlBlobs.has(a.toLowerCase())}_GetLocalUrlBlob(a){return this._localUrlBlobs.get(a.toLowerCase())||null}GetLocalUrlAsBlobUrl(a){const b=this._GetLocalUrlBlob(a);if(!b)return a;a=this._localBlobUrlCache.get(b);a||(a=URL.createObjectURL(b),this._localBlobUrlCache.set(b,a));return a}FetchBlob(a,b){b=b||this._defaultLoadPolicy;
  const d=this._GetLocalUrlBlob(a);if(d)return Promise.resolve(d);if(c.IsRelativeURL(a)){const d=a.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsBlob(d):"local"===b?this._promiseThrottle.Add(()=>c.FetchBlob(d)):c.FetchBlob(d)}return c.FetchBlob(a)}FetchArrayBuffer(a){const b=this._GetLocalUrlBlob(a);if(b)return c.BlobToArrayBuffer(b);if(c.IsRelativeURL(a)){const b=a.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsArrayBuffer(b):
  "local"===this._defaultLoadPolicy?this._promiseThrottle.Add(()=>c.FetchArrayBuffer(b)):c.FetchArrayBuffer(b)}return c.FetchArrayBuffer(a)}FetchText(a){const b=this._GetLocalUrlBlob(a);if(b)return c.BlobToString(b);if(c.IsRelativeURL(a)){const b=a.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsText(b):"local"===this._defaultLoadPolicy?this._promiseThrottle.Add(()=>c.FetchText(b)):c.FetchText(b)}return c.FetchText(a)}async FetchJson(a){a=await this.FetchText(a);
  return JSON.parse(a)}_CordovaFetchLocalFileAs(a,b){return this._runtime.PostComponentMessageToDOMAsync("runtime","cordova-fetch-local-file",{filename:a,as:b})}CordovaFetchLocalFileAsText(a){return this._CordovaFetchLocalFileAs(a,"text")}async CordovaFetchLocalFileAsBlob(a){const b=await this._CordovaFetchLocalFileAs(a,"buffer");a=GetTypeFromFileExtension(a);return new Blob([b],{type:a})}async CordovaFetchLocalFileAsBlobURL(a){a=a.toLowerCase();var b=this._localBlobUrlCache.get(a);if(b)return b;b=
  await this.CordovaFetchLocalFileAsBlob(a);b=URL.createObjectURL(b);this._localBlobUrlCache.set(a,b);return b}CordovaFetchLocalFileAsArrayBuffer(a){return this._CordovaFetchLocalFileAs(a,"buffer")}GetMediaFileUrl(a){return this._HasLocalUrlBlob(a)?this.GetLocalUrlAsBlobUrl(a):this._mediaSubfolder+a.toLowerCase()}GetProjectFileUrl(a,b=""){if(c.IsAbsoluteURL(a)){if(b)throw Error("cannot specify subfolder with remote URL");return Promise.resolve(a)}return this._HasLocalUrlBlob(a)?Promise.resolve(this.GetLocalUrlAsBlobUrl(a)):
  this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsBlobURL(b+a):Promise.resolve(b+a.toLowerCase())}LoadProjectFileUrl(a){return this.GetProjectFileUrl(a)}LoadImage(a){if(a.loadPolicy&&!f.has(a.loadPolicy))throw Error("invalid load policy");let b=this._assetsByUrl.get(a.url);if(b)return b;b=c.New(c.ImageAsset,this,{url:a.url,size:a.size||0,loadPolicy:a.loadPolicy||this._defaultLoadPolicy});this._allAssets.push(b);this._assetsByUrl.set(b.GetURL(),b);this._hasFinishedInitialLoad||(this._totalAssetSizeToLoad+=
  b.GetSize(),this._loadPromises.push(b.Load().then(()=>this._AddLoadedSize(b.GetSize()))));return b}async WaitForAllToLoad(){try{await Promise.all(this._loadPromises),this._lastLoadProgress=1}catch(a){console.error("Error loading: ",a),this._hasHadErrorLoading=!0,this._FireLoadingProgressEvent()}}SetInitialLoadFinished(){this._hasFinishedInitialLoad=!0}HasHadErrorLoading(){return this._hasHadErrorLoading}_AddLoadedSize(a){this._assetSizeLoaded+=a;this._loadingRateLimiter.Call()}_FireLoadingProgressEvent(){const a=
  c.New(c.Event,"loadingprogress");this._lastLoadProgress=c.clamp(this._assetSizeLoaded/this._totalAssetSizeToLoad,0,1);a.progress=this._lastLoadProgress;this._runtime.Dispatcher().dispatchEvent(a)}GetLoadProgress(){return this._lastLoadProgress}_SetWebFonts(a){c.shallowAssignArray(this._webFonts,a);this._webFonts.length&&this._loadPromises.push(this._LoadWebFonts())}_LoadWebFonts(){if("undefined"===typeof FontFace)return Promise.resolve();const a=[];for(const [b,c,e]of this._webFonts)this._totalAssetSizeToLoad+=
  e,a.push(this._LoadWebFont(b,c).then(()=>this._AddLoadedSize(e)));return Promise.all(a)}async _LoadWebFont(a,b){try{const c=await this.GetProjectFileUrl(b,this._fontsSubfolder),e=new FontFace(a,`url('${c}')`);this._runtime.IsInWorker()?self.fonts.add(e):document.fonts.add(e);await e.load()}catch(d){console.warn(`[C3 runtime] Failed to load web font '${a}': `,d)}}IsAudioFormatSupported(a){return!!this._supportedAudioFormats[a]}_SetAudioFiles(a,b){this._preloadSounds=!!b;for(const [b,c,f]of a)this._audioFiles.set(b,
  {fileName:b,formats:c.map(a=>({type:a[0],fileExtension:a[1],fullName:b+a[1],fileSize:a[2]})),isMusic:f})}GetPreferredAudioFile(a){a=this._audioFiles.get(a.toLowerCase());if(!a)return null;let b=null;for(const c of a.formats)if(b||"audio/webm; codecs=opus"!==c.type||(b=c),this.IsAudioFormatSupported(c.type))return c;return b}GetProjectAudioFileUrl(a){return(a=this.GetPreferredAudioFile(a))?{url:this.GetMediaFileUrl(a.fullName),type:a.type}:null}GetAudioToPreload(){if(this._preloadSounds){const a=[];
  for(const b of this._audioFiles.values()){if(b.isMusic)continue;const c=this.GetPreferredAudioFile(b.fileName);c&&a.push({originalUrl:b.fileName,url:this.GetMediaFileUrl(c.fullName),type:c.type,fileSize:c.fileSize})}return a}return[]}GetIAssetManager(){return this._iAssetManager}async LoadScripts(...a){a=await Promise.all(a.map(a=>this.GetProjectFileUrl(a)));this._runtime.IsInWorker()?importScripts(...a):await Promise.all(a.map(a=>AddScript(a)))}async CompileWebAssembly(a){if(WebAssembly.compileStreaming)return a=
  await this.GetProjectFileUrl(a),await WebAssembly.compileStreaming(fetch(a));a=await c.FetchArrayBuffer(a);return await WebAssembly.compile(a)}async LoadStyleSheet(a){a=await this.GetProjectFileUrl(a);return await this._runtime.PostComponentMessageToDOMAsync("runtime","add-stylesheet",{url:a})}}};
  
  
  // c3/assets/asset.js
  'use strict';{const c=self.C3;c.Asset=class extends c.DefendedBase{constructor(a,b){super();this._assetManager=a;this._runtime=a.GetRuntime();this._url=b.url;this._size=b.size;this._loadPolicy=b.loadPolicy;this._blob=null;this._isLoaded=!1;this._loadPromise=null}Release(){this._blob=this._runtime=this._assetManager=this._loadPromise=null}GetURL(){return this._url}GetSize(){return this._size}Load(){return"local"===this._loadPolicy||this._blob?(this._isLoaded=!0,Promise.resolve()):this._loadPromise?
  this._loadPromise:this._loadPromise=this._assetManager.FetchBlob(this._url,this._loadPolicy).then(a=>{this._isLoaded=!0;this._loadPromise=null;this._blob=a}).catch(a=>console.error("Error loading resource: ",a))}IsLoaded(){return this._isLoaded}GetBlob(){return this._blob?Promise.resolve(this._blob):this._assetManager.FetchBlob(this._url,this._loadPolicy)}}};
  
  
  // c3/assets/imageAsset.js
  'use strict';{const a=self.C3,e=new a.PromiseThrottle,c=new Set;a.ImageAsset=class extends a.Asset{constructor(b,d){super(b,d);this._webglTexture=this._texturePromise=null;this._refCount=0;this._imageHeight=this._imageWidth=-1;c.add(this)}Release(){this.ReleaseTexture();if(0!==this._refCount)throw Error("released image asset which still has texture references");this._texturePromise=null;c.delete(this);super.Release()}static OnWebGLContextLost(){for(const b of c)b._texturePromise=null,b._webglTexture=
  null,b._refCount=0}LoadStaticTexture(b,d){this._refCount++;return this._webglTexture?Promise.resolve(this._webglTexture):this._texturePromise?this._texturePromise:this._texturePromise=this.GetBlob().then(a=>e.Add(()=>b.CreateStaticTextureAsync(a,d).then(a=>{this._texturePromise=null;if(0===this._refCount)return b.DeleteTexture(a),null;this._webglTexture=a;this._imageWidth=a.GetWidth();this._imageHeight=a.GetHeight();return this._webglTexture}))).catch(a=>{console.error("Failed to load texture: ",
  a);throw a;})}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 b=await this.GetBlob();return a.Supports.ImageBitmapOptions?await createImageBitmap(b,{premultiplyAlpha:"none"}):
  a.Supports.ImageBitmap?await createImageBitmap(b):await a.BlobToImage(b)}}};
  
  
  // c3/layouts/renderCell.js
  'use strict';{var SortByInstLastCachedZIndex=function(a,c){return a.GetWorldInfo()._GetLastCachedZIndex()-c.GetWorldInfo()._GetLastCachedZIndex()};const b=self.C3;b.RenderCell=class extends b.DefendedBase{constructor(a,c,d){super();this._grid=a;this._x=c;this._y=d;this._instances=[];this._isSorted=!0;this._pendingRemoval=new Set;this._isAnyPendingRemoval=!1}Release(){b.clearArray(this._instances);this._pendingRemoval.clear();this._grid=null}Reset(){b.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():(b.arrayRemoveAllInSet(this._instances,this._pendingRemoval),this._pendingRemoval.clear(),this._isAnyPendingRemoval=!1))}_EnsureSorted(){this._isSorted||(this._instances.sort(SortByInstLastCachedZIndex),this._isSorted=!0)}Dump(a){this._FlushPending();this._EnsureSorted();this._instances.length&&a.push(this._instances)}}};
  
  
  // c3/layouts/renderGrid.js
  'use strict';{const g=self.C3;g.RenderGrid=class extends g.DefendedBase{constructor(a,c){super();this._cellWidth=a;this._cellHeight=c;this._cells=g.New(g.PairMap)}Release(){this._cells.Release();this._cells=null}GetCell(a,c,d){let b=this._cells.Get(a,c);return b?b:d?(b=g.New(g.RenderCell,this,a,c),this._cells.Set(a,c,b),b):null}XToCell(a){return Math.floor(a/this._cellWidth)}YToCell(a){return Math.floor(a/this._cellHeight)}Update(a,c,d){if(c)for(let b=c.getLeft(),f=c.getRight();b<=f;++b)for(let e=
  c.getTop(),f=c.getBottom();e<=f;++e){if(d&&d.containsPoint(b,e))continue;const c=this.GetCell(b,e,!1);c&&(c.Remove(a),c.IsEmpty()&&this._cells.Delete(b,e))}if(d)for(let b=d.getLeft(),f=d.getRight();b<=f;++b)for(let e=d.getTop(),f=d.getBottom();e<=f;++e)c&&c.containsPoint(b,e)||this.GetCell(b,e,!0).Insert(a)}QueryRange(a,c){let d=this.XToCell(a.getLeft());const b=this.YToCell(a.getTop()),f=this.XToCell(a.getRight());for(a=this.YToCell(a.getBottom());d<=f;++d)for(let e=b;e<=a;++e){const a=this.GetCell(d,
  e,!1);a&&a.Dump(c)}}MarkRangeChanged(a){let c=a.getLeft();const d=a.getTop(),b=a.getRight();for(a=a.getBottom();c<=b;++c)for(let b=d;b<=a;++b){const a=this.GetCell(c,b,!1);a&&a.SetChanged()}}}};
  
  
  // c3/layouts/layer.js
  'use strict';{var SortByInstZElevation=function(a,b){return a.GetWorldInfo().GetZElevation()-b.GetWorldInfo().GetZElevation()},SortByInstLastCachedZIndex=function(a,b){return a.GetWorldInfo()._GetLastCachedZIndex()-b.GetWorldInfo()._GetLastCachedZIndex()};const h=self.C3,m=new h.Rect,r=new h.Quad,n=[],t=new h.Rect,l=new h.Rect,p=self.glMatrix.vec3,q=p.fromValues(0,1,0);h.Layer=class extends h.DefendedBase{constructor(a,b,c){super();this._layout=a;this._runtime=a.GetRuntime();this._name=c[0];this._index=
  b;this._sid=c[2];this._isVisible=!!c[3];this._backgroundColor=h.New(h.Color);this._backgroundColor.setFromJSON(c[4].map(a=>a/255));this._isTransparent=!!c[5];this._parallaxX=c[6];this._parallaxY=c[7];this._color=h.New(h.Color,1,1,1,c[8]);this._premultipliedColor=h.New(h.Color);this._isForceOwnTexture=c[9];this._useRenderCells=c[10];this._scaleRate=c[11];this._blendMode=c[12];this._curRenderTarget=null;this._scale=1;this._zElevation=c[16];this._angle=0;this._isAngleEnabled=!0;this._viewport=h.New(h.Rect);
  this._viewportZ0=h.New(h.Rect);this._startupInitialInstances=[];this._initialInstances=[];this._createdGlobalUids=[];this._instances=[];this._anyInstanceZElevated=this._zIndicesUpToDate=!1;this._effectList=h.New(h.EffectList,this,c[15]);this._renderGrid=null;this._lastRenderList=[];this._isRenderListUpToDate=!1;this._lastRenderCells=h.New(h.Rect,0,0,-1,-1);this._curRenderCells=h.New(h.Rect,0,0,-1,-1);this._iLayer=new self.ILayer(this);this._UpdatePremultipliedColor();this._useRenderCells&&(this._renderGrid=
  h.New(h.RenderGrid,this._runtime.GetOriginalViewportWidth(),this._runtime.GetOriginalViewportHeight()));for(const b of c[14])a=this._runtime.GetObjectClassByIndex(b[1]),this._layout._AddInitialObjectClass(a),a.GetDefaultInstanceData()||(a.SetDefaultInstanceData(b),a._SetDefaultLayerIndex(this._index)),this._initialInstances.push(b);h.shallowAssignArray(this._startupInitialInstances,this._initialInstances)}static Create(a,b,c){return h.New(h.Layer,a,b,c)}Release(){this._runtime=this._layout=null}CreateInitialInstances(a){const b=
  this._layout.IsFirstVisit();let c=0;const d=this._initialInstances;for(let e=0,g=d.length;e<g;++e){var f=d[e];const g=this._runtime.GetObjectClassByIndex(f[1]);let h=!0;if(!g.HasPersistBehavior()||b)f=this._runtime.CreateInstanceFromData(f,this,!0),a.push(f),g.IsGlobal()&&(h=!1,this._createdGlobalUids.push(f.GetUID()));h&&(d[c]=d[e],++c)}h.truncateArray(d,c);this._runtime.FlushPendingInstances();this.SetZIndicesChanged()}_AddInstance(a,b){const c=a.GetWorldInfo();if(c.GetLayer()!==this)throw Error("instance added to wrong layer");
  this._instances.push(a);0!==c.GetZElevation()&&(this._anyInstanceZElevated=!0);b&&this._useRenderCells&&a.GetWorldInfo().SetBboxChanged();this.SetZIndicesChanged()}_MaybeAddInstance(a){this._instances.includes(a)||(this._instances.push(a),0!==a.GetWorldInfo().GetZElevation()&&(this._anyInstanceZElevated=!0),this.SetZIndicesChanged())}_PrependInstance(a,b){const c=a.GetWorldInfo();if(c.GetLayer()!==this)throw Error("instance added to wrong layer");this._instances.unshift(a);0!==c.GetZElevation()&&
  (this._anyInstanceZElevated=!0);this.SetZIndicesChanged();b&&this._useRenderCells&&a.GetWorldInfo().SetBboxChanged()}_RemoveInstance(a,b){const c=this._instances.indexOf(a);0>c||(b&&this._useRenderCells&&a.GetWorldInfo()._RemoveFromRenderCells(),this._instances.splice(c,1),this.SetZIndicesChanged(),this._MaybeResetAnyInstanceZElevatedFlag())}_SetAnyInstanceZElevated(){this._anyInstanceZElevated=!0}_MaybeResetAnyInstanceZElevatedFlag(){0===this._instances.length&&(this._anyInstanceZElevated=!1)}_SortInstancesByLastCachedZIndex(a){if(a){a=
  new Set;for(var b of this._instances){var c=b.GetWorldInfo()._GetLastCachedZIndex();0<=c&&a.add(c)}b=-1;for(const d of this._instances)if(c=d.GetWorldInfo(),!(0<=c._GetLastCachedZIndex())){for(++b;a.has(b);)++b;c._SetZIndex(b)}}this._instances.sort(SortByInstLastCachedZIndex)}_Start(){}_End(){for(const a of this._instances)a.GetObjectClass().IsGlobal()||this._runtime.DestroyInstance(a);this._runtime.FlushPendingInstances();h.clearArray(this._instances);this._anyInstanceZElevated=!1;this.SetZIndicesChanged()}RecreateInitialObjects(a,
  b){const c=this._runtime.GetEventSheetManager(),d=this._runtime.GetAllObjectClasses(),f=a.IsFamily();for(const g of this._initialInstances){var e=g[0];if(b.containsPoint(e[0],e[1])){e=d[g[1]];if(e!==a)if(f){if(!a.FamilyHasMember(e))continue}else continue;e=this._runtime.CreateInstanceFromData(g,this,!1);c.BlockFlushingInstances(!0);e._TriggerOnCreated();if(e.IsInContainer())for(const a of e.siblings())a._TriggerOnCreated();c.BlockFlushingInstances(!1)}}}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}GetRenderGrid(){return this._renderGrid}SetRenderListStale(){this._isRenderListUpToDate=
  !1}IsVisible(){return this._isVisible}SetVisible(a){a=!!a;this._isVisible!==a&&(this._isVisible=a,this._runtime.UpdateRender())}GetViewport(){return this._viewport}GetViewportForZ(a,b){var c=this._viewportZ0;if(0===a)b.copy(c);else{const d=this.Get2DScaleFactorToZ(a);a=c.midX();const f=c.midY(),e=.5*c.width()/d;c=.5*c.height()/d;b.set(a-e,f-c,a+e,f+c)}}GetOpacity(){return this._color.getA()}SetOpacity(a){a=h.clamp(a,0,1);this._color.getA()!==a&&(this._color.setA(a),this._UpdatePremultipliedColor(),
  this._runtime.UpdateRender())}_UpdatePremultipliedColor(){this._premultipliedColor.copy(this._color);this._premultipliedColor.premultiply()}GetPremultipliedColor(){return this._premultipliedColor}HasDefaultColor(){return this._color.equalsRgba(1,1,1,1)}GetScaleRate(){return this._scaleRate}SetScaleRate(a){this._scaleRate!==a&&(this._scaleRate=a,this._runtime.UpdateRender())}GetParallaxX(){return this._parallaxX}GetParallaxY(){return this._parallaxY}SetParallax(a,b){if(this._parallaxX!==a||this._parallaxY!==
  b)if(this._parallaxX=a,this._parallaxY=b,this._runtime.UpdateRender(),1!==this._parallaxX||1!==this._parallaxY)for(const a of this._instances)a.GetObjectClass()._SetAnyInstanceParallaxed(!0)}SetParallaxX(a){this.SetParallax(a,this.GetParallaxY())}SetParallaxY(a){this.SetParallax(this.GetParallaxX(),a)}SetZElevation(a){this._zElevation=+a}GetZElevation(){return this._zElevation}SetAngle(a){this._angle=h.clampAngle(a)}GetAngle(){return this._isAngleEnabled?h.clampAngle(this._layout.GetAngle()+this._angle):
  0}GetOwnAngle(){return this._angle}HasInstances(){return 0<this._instances.length}_GetInstances(){return this._instances}GetBackgroundColor(){return this._backgroundColor}IsTransparent(){return this._isTransparent}SetTransparent(a){this._isTransparent=!!a}IsForceOwnTexture(){return this._isForceOwnTexture}SetForceOwnTexture(a){this._isForceOwnTexture=!!a}SetBlendMode(a){this._blendMode!==a&&(this._blendMode=a,this._runtime.UpdateRender())}GetBlendMode(){return this._blendMode}_IsCollisionCompatibleWith(a){return this._parallaxX===
  a._parallaxX&&this._parallaxY===a._parallaxY&&this._scale===a._scale&&this._scaleRate===a._scaleRate&&this._angle===a._angle}_RemoveAllInstancesInSet(a){0!==a.size&&0<h.arrayRemoveAllInSet(this._instances,a)&&(this._MaybeResetAnyInstanceZElevatedFlag(),this.SetZIndicesChanged())}SetZIndicesChanged(){this._isRenderListUpToDate=this._zIndicesUpToDate=!1}_UpdateZIndices(){if(!this._zIndicesUpToDate){h.stableSort(this._instances,SortByInstZElevation);if(this._useRenderCells)for(let a=0,b=this._instances.length;a<
  b;++a){const b=this._instances[a].GetWorldInfo();b._SetZIndex(a);this._renderGrid.MarkRangeChanged(b.GetRenderCellRange())}else for(let a=0,b=this._instances.length;a<b;++a)this._instances[a].GetWorldInfo()._SetZIndex(a);this._zIndicesUpToDate=!0}}MoveInstanceAdjacent(a,b,c){var d=a.GetWorldInfo();b=b.GetWorldInfo();if(d.GetLayer()!==this||b.GetLayer()!==this)throw Error("can't arrange Z order unless both objects on this layer");d=d.GetZIndex();b=b.GetZIndex();h.arrayRemove(this._instances,d);d<b&&
  b--;c&&b++;b===this._instances.length?this._instances.push(a):this._instances.splice(b,0,a);this.SetZIndicesChanged()}_MergeSortedZArrays(a,b){const c=[];let d=0,f=0,e=a.length,g=b.length;for(;d<e&&f<g;){const e=a[d],g=b[f];e.GetWorldInfo()._GetLastCachedZIndex()<g.GetWorldInfo()._GetLastCachedZIndex()?(c.push(e),++d):(c.push(g),++f)}for(;d<e;++d)c.push(a[d]);for(;f<g;++f)c.push(b[f]);return c}_MergeAllSortedZArrays_pass(a){const b=[],c=a.length;for(let d=0;d<c-1;d+=2)b.push(this._MergeSortedZArrays(a[d],
  a[d+1]));1===c%2&&b.push(a[c-1]);return b}_MergeAllSortedZArrays(a){for(;1<a.length;)a=this._MergeAllSortedZArrays_pass(a);return a[0]}_GetRenderCellInstancesToDraw(){this._UpdateZIndices();h.clearArray(n);this._renderGrid.QueryRange(this._viewport,n);return n.length?1===n.length?n[0]:this._MergeAllSortedZArrays(n):[]}_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(a){if(0===a.length)return!0;if(2<=a.length)return!1;a=a[0].GetShaderProgram();return!a.MustPreDraw()&&!a.UsesDest()&&!a.UsesCrossSampling()&&this.HasDefaultColor()}Get2DScaleFactorToZ(a){const b=this.GetCameraZ();return b/(b-a)}GetCameraZ(){return 100/this.GetNormalScale()}_SetTransform(a,b=0,c=0){const d=this._runtime.GetRenderScale();b=(this._viewport.midX()+
  b)*d;c=(this._viewport.midY()+c)*d;const f=this.GetCameraZ();a.SetCameraXYZ(b,c,f);a.SetLookXYZ(b,c,f-100);b=this.GetAngle();0===b?p.set(q,0,1,0):p.set(q,Math.sin(b),Math.cos(b),0);a.ResetModelView(q);a.Scale(d,d);a.UpdateModelView()}Draw(a,b,c){const d=this._runtime.GetCanvasManager(),f=this.UsesOwnTexture();var e=null;let g=null;if(this._runtime.IsGPUProfiling()&&a.SupportsGPUProfiling()){const b=d.GetLayerTimingsBuffer(this);b&&(g=b.AddTimeElapsedQuery(),a.StartQuery(g))}f?(e={sampling:this._runtime.GetSampling()},
  "low"===d.GetCurrentFullscreenScalingQuality()&&(e.width=d.GetDrawWidth(),e.height=d.GetDrawHeight()),e=this._runtime.GetAdditionalRenderTarget(e),a.SetRenderTarget(e),this.IsTransparent()&&a.ClearRgba(0,0,0,0)):a.SetRenderTarget(b);this.IsTransparent()||a.Clear(this._backgroundColor);this._curRenderTarget=e||b;this._SetTransform(a);a.SetBaseZ(this.GetZElevation());this.GetNormalScale()>Number.EPSILON&&(this._UpdateZIndices(),this._useRenderCells&&0===this.GetZElevation()&&!this._anyInstanceZElevated?
  this._DrawInstances_RenderCells(a):this._DrawInstances(a,this._instances));a.SetBaseZ(0);a.SetCurrentZ(0);a.SetCameraXYZ(0,0,100);a.SetLookXYZ(0,0,0);f&&this._DrawLayerOwnTextureToRenderTarget(a,e,b,c);g&&a.EndQuery(g);this._curRenderTarget=null}_DrawInstances(a,b){const c=this._viewport,d=this._curRenderTarget;let f=null;for(let e=0,g=b.length;e<g;++e){const g=b[e];if(g===f)continue;f=g;const h=g.GetWorldInfo();h.IsVisible()&&h.IsInViewport(c)&&(h.HasAnyActiveEffect()?this._DrawInstanceWithEffectsAndRestore(g,
  h,a,d):this._DrawInstance(g,h,a))}}_DrawInstances_RenderCells(a){var b=this._renderGrid;const c=this._curRenderCells,d=this._lastRenderCells,f=this._viewport;c.set(b.XToCell(f.getLeft()),b.YToCell(f.getTop()),b.XToCell(f.getRight()),b.YToCell(f.getBottom()));this._isRenderListUpToDate&&c.equals(d)?b=this._lastRenderList:(b=this._GetRenderCellInstancesToDraw(),this._isRenderListUpToDate=!0,d.copy(c));this._DrawInstances(a,b);b!==this._lastRenderList&&h.shallowAssignArray(this._lastRenderList,b)}_DrawInstance(a,
  b,c){b=b.GetWebGLStateGroup();c.GetCurrentStateGroup()!==b&&b.Apply();a.Draw(c)}_DrawInstanceWithEffectsAndRestore(a,b,c,d){this._DrawInstanceWithEffects(a,b,c,d,null)&&this._SetTransform(c)}_DrawInstanceWithEffects(a,b,c,d,f){const e=b.GetInstanceEffectList().GetActiveEffectTypes();if(1===e.length){const d=e[0],f=d.GetShaderProgram();if(!f.NeedsPostDrawOrExtendsBox()&&b.HasDefaultColor()&&!a.MustPreDraw())return this._DrawInstanceWithEffects_FastPath(a,b,d,f,c),!1}a=h.RenderEffectChain(c,this._runtime,
  a,d,e,f);c.SetBaseZ(this.GetZElevation());return a}_DrawInstanceWithEffects_FastPath(a,b,c,d,f){f.SetProgram(d);f.SetBlendMode(b.GetBlendMode());d.IsAnimated()&&this._runtime.UpdateRender();let e=0,g=0;if(d.UsesAnySrcRectOrPixelSize()){const [b,c]=a.GetCurrentSurfaceSize();e=1/b;g=1/c;(d=a.GetCurrentTexRect())?l.copy(d):l.set(0,0,0,0)}c=b.GetInstanceEffectList().GetEffectParametersForIndex(c.GetIndex());f.SetCurrentZ(b.GetZElevation());f.SetProgramParameters(null,t,l,l,b.GetBoundingBox(),e,g,this.GetOwnScale(),
  this.GetAngle(),this._runtime.GetGameTime(),c);a.Draw(f)}_DrawLayerOwnTextureToRenderTarget(a,b,c,d){const f=this._effectList.GetActiveEffectTypes(),e=this._runtime;if(this._CanFastPathDrawLayer(f)){a.SetRenderTarget(c);if(1===f.length){var g=f[0];c=g.GetShaderProgram();a.SetProgram(c);l.set(0,0,1,1);g=this._effectList.GetEffectParametersForIndex(g.GetIndex());a.SetProgramParameters(null,t,l,l,this._viewport,1/e.GetDrawWidth(),1/e.GetDrawHeight(),this.GetNormalScale(),this.GetAngle(),e.GetGameTime(),
  g);c.IsAnimated()&&e.UpdateRender()}else a.SetTextureFillMode();d&&0===this._blendMode&&this.HasDefaultColor()&&0===f.length?a.CopyRenderTarget(b):(a.SetBlendMode(this._blendMode),a.SetColor(this._premultipliedColor),a.DrawRenderTarget(b));a.InvalidateRenderTarget(b);e.ReleaseAdditionalRenderTarget(b)}else h.RenderEffectChain(a,e,this,c,f)}GetOwnScale(){return this._scale}SetOwnScale(a){this._scale!==a&&(this._scale=a,this._layout.BoundScrolling(),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(){this._isAngleEnabled=!1;let [a,b]=this.CanvasCssToLayer(0,0);this._isAngleEnabled=!0;this._runtime.IsPixelRoundingEnabled()&&(a=Math.round(a),b=Math.round(b));var c=1/this.GetNormalScale();const d=this._viewportZ0;d.set(a,b,a+this._runtime.GetViewportWidth()*c,b+this._runtime.GetViewportHeight()*
  c);c=this.GetAngle();0!==c&&(m.copy(d),m.offset(-d.midX(),-d.midY()),r.setFromRotatedRect(m,c),r.getBoundingBox(m),m.offset(d.midX(),d.midY()),d.copy(m));this.GetViewportForZ(this._zElevation,this._viewport)}CanvasCssToLayer(a,b,c=0){return this._CanvasToLayer(a,b,c,this.GetDisplayScale())}DrawSurfaceToLayer(a,b,c=0){return this._CanvasToLayer(a,b,c,this.GetRenderScale()*this.GetDevicePixelRatio())}_CanvasToLayer(a,b,c,d){var f=this._runtime.GetParallaxXOrigin(),e=this._runtime.GetParallaxYOrigin();
  f=(this._layout.GetScrollX()-f)*this._parallaxX+f;e=(this._layout.GetScrollY()-e)*this._parallaxY+e;var g=this.GetNormalScale(),k=this._runtime.GetViewportWidth()/g;g=this._runtime.GetViewportHeight()/g;a=f-k/2+a/d;b=e-g/2+b/d;k=this.GetAngle();0!==k&&(a-=f,b-=e,d=Math.cos(k),k=Math.sin(k),g=a*d-b*k,b=b*d+a*k,a=g,a+=f,b+=e);0!==c&&(f=this._viewportZ0.midX(),e=this._viewportZ0.midY(),c=this.Get2DScaleFactorToZ(c),a=(a-f)/c+f,b=(b-e)/c+e);return[a,b]}CanvasCssToLayer_DefaultTransform(a,b){const c=this._scale,
  d=this._scaleRate,f=this._parallaxX,e=this._parallaxY,g=this._angle;this._parallaxY=this._parallaxX=this._scaleRate=this._scale=1;this._angle=0;a=this.CanvasCssToLayer(a,b);this._scale=c;this._scaleRate=d;this._parallaxX=f;this._parallaxY=e;this._angle=g;return a}LayerToCanvasCss(a,b,c=0){return this._LayerToCanvas(a,b,c,this.GetDisplayScale())}LayerToDrawSurface(a,b,c=0){return this._LayerToCanvas(a,b,c,this.GetRenderScale()*this.GetDevicePixelRatio())}_LayerToCanvas(a,b,c,d){var f=this._runtime,
  e=this._layout;if(0!==c){var g=this._viewportZ0.midX(),k=this._viewportZ0.midY();c=this.Get2DScaleFactorToZ(c);a=(a-g)*c+g;b=(b-k)*c+k}g=f.GetParallaxXOrigin();k=f.GetParallaxYOrigin();g=(e.GetScrollX()-g)*this._parallaxX+g;e=(e.GetScrollY()-k)*this._parallaxY+k;c=this.GetAngle();if(0!==c){a-=g;b-=e;k=Math.cos(-c);c=Math.sin(-c);const d=a*k-b*c;b=b*k+a*c;a=d;a+=g;b+=e}c=this.GetNormalScale();k=f.GetViewportWidth()/c;f=f.GetViewportHeight()/c;return[(a-(g-k/2))*d,(b-(e-f/2))*d]}_GetLayerToDrawSurfaceScale(a,
  b){a*=this.GetRenderScale()*this.GetDevicePixelRatio();0!==b&&(a*=this.Get2DScaleFactorToZ(b));return 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(),px:this.GetParallaxX(),py:this.GetParallaxY(),c:this._color.toJSON(),sr:this.GetScaleRate(),fx:this._effectList.SaveToJson(),cg:this._createdGlobalUids}}_LoadFromJson(a){this._scale=
  a.s;this._angle=a.a;this._viewport.set(a.vl,a.vt,a.vr,a.vb);this._isVisible=!!a.v;this._backgroundColor.setFromJSON(a.bc);this._isTransparent=!!a.t;this._parallaxX=a.px;this._parallaxY=a.py;this._color.setFromJSON(a.c);this._scaleRate=a.sr;h.shallowAssignArray(this._createdGlobalUids,a.cg);h.shallowAssignArray(this._initialInstances,this._startupInitialInstances);const b=new Set(this._createdGlobalUids);let c=0;for(let a=0,f=this._initialInstances.length;a<f;++a)b.has(this._initialInstances[a][2])||
  (this._initialInstances[c]=this._initialInstances[a],++c);h.truncateArray(this._initialInstances,c);this._effectList.LoadFromJson(a.fx);this._SortInstancesByLastCachedZIndex(!1);this.SetZIndicesChanged()}GetILayer(){return this._iLayer}}};
  
  
  // c3/layouts/layout.js
  'use strict';{const d=self.C3,h=self.C3Debugger,k=d.New(d.Rect),m=d.New(d.Rect),g=d.New(d.Rect),l=d.New(d.Rect);d.Layout=class extends d.DefendedBase{constructor(a,b,c){super();this._layoutManager=a;this._runtime=a.GetRuntime();this._name=c[0];this._originalWidth=c[1];this._originalHeight=c[2];this._width=c[1];this._height=c[2];this._isUnboundedScrolling=!!c[3];this._eventSheetName=c[4];this._eventSheet=null;this._sid=c[5];this._index=b;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._layers=[];this._layersByName=new Map;this._layersBySid=new Map;this._effectList=d.New(d.EffectList,this,c[8]);this._curRenderTarget=null;this._persistData={};this._isFirstVisit=!0;this._iLayout=new self.ILayout(this);this._userScriptDispatcher=d.New(d.Event.Dispatcher);for(const b of c[6])a=d.Layer.Create(this,this._layers.length,b),this._layers.push(a),this._layersByName.set(a.GetName().toLowerCase(),
  a),this._layersBySid.set(a.GetSID(),a);for(const a of c[7]){c=this._runtime.GetObjectClassByIndex(a[1]);if(!c)throw Error("missing nonworld object class");c.GetDefaultInstanceData()||c.SetDefaultInstanceData(a);this._initialNonWorld.push(a);this._AddInitialObjectClass(c)}}Release(){for(const a of this._layers)a.Release();d.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 a=
  this._layers[0].GetNormalScale();for(let b=1,c=this._layers.length;b<c;++b){const c=this._layers[b];if(0!==c.GetParallaxX()||0!==c.GetParallaxY())a=Math.min(a,c.GetNormalScale())}return a}SetScrollX(a){if(!this._isUnboundedScrolling){const b=this._runtime.GetViewportWidth()*(1/this.GetMinLayerScale())/2;a>this._width-b&&(a=this._width-b);a<b&&(a=b)}this._scrollX!==a&&(this._scrollX=a,this._runtime.UpdateRender())}GetScrollX(){return this._scrollX}SetScrollY(a){if(!this._isUnboundedScrolling){const b=
  this._runtime.GetViewportHeight()*(1/this.GetMinLayerScale())/2;a>this._height-b&&(a=this._height-b);a<b&&(a=b)}this._scrollY!==a&&(this._scrollY=a,this._runtime.UpdateRender())}GetScrollY(){return this._scrollY}BoundScrolling(){this.SetScrollX(this.GetScrollX());this.SetScrollY(this.GetScrollY())}GetScale(){return this._scale}SetScale(a){a=+a;this._scale!==a&&(this._scale=a,this.BoundScrolling())}SetAngle(a){this._angle=d.clampAngle(a)}GetAngle(){return this._angle}GetWidth(){return this._width}SetWidth(a){!isFinite(a)||
  1>a||(this._width=a)}GetHeight(){return this._height}SetHeight(a){!isFinite(a)||1>a||(this._height=a)}GetEventSheet(){return this._eventSheet}GetLayers(){return this._layers}GetLayerCount(){return this._layers.length}GetLayer(a){return"number"===typeof a?this.GetLayerByIndex(a):this.GetLayerByName(a.toString())}GetLayerByIndex(a){a=d.clamp(Math.floor(a),0,this._layers.length-1);return this._layers[a]}GetLayerByName(a){return this._layersByName.get(a.toLowerCase())||null}GetLayerBySID(a){return this._layersBySid.get(a)||
  null}HasOpaqueBottomLayer(){for(const a of this._layers)if(a.ShouldDraw())return a._IsOpaque();return!1}IsFirstVisit(){return this._isFirstVisit}_GetInitialObjectClasses(){return[...this._initialObjectClasses]}_AddInitialObjectClass(a){if(a.IsInContainer())for(const b of a.GetContainer().GetObjectTypes())this._initialObjectClasses.add(b);else this._initialObjectClasses.add(a)}_GetTextureLoadedObjectTypes(){return[...this._textureLoadedTypes]}_Load(a,b){if(a===this||!b)return Promise.resolve();a&&
  (d.CopySet(this._textureLoadedTypes,a._textureLoadedTypes),a._textureLoadedTypes.clear());a=[];for(const c of this._initialObjectClasses)this._textureLoadedTypes.has(c)||(a.push(c.LoadTextures(b)),this._textureLoadedTypes.add(c));return Promise.all(a)}async MaybeLoadTexturesFor(a){if(a.IsFamily())throw Error("cannot load textures for family");var b=this._runtime.GetWebGLRenderer();!b||b.IsContextLost()||this._textureLoadedTypes.has(a)||(this._textureLoadedTypes.add(a),b=a.LoadTextures(b),this._AddPendingTextureLoadPromise(b),
  await b,a.OnDynamicTextureLoadComplete(),this._runtime.UpdateRender())}_AddPendingTextureLoadPromise(a){this._textureLoadPendingPromises.add(a);a.then(()=>this._textureLoadPendingPromises.delete(a)).catch(()=>this._textureLoadPendingPromises.delete(a))}WaitForPendingTextureLoadsToComplete(){return Promise.all([...this._textureLoadPendingPromises])}MaybeUnloadTexturesFor(a){if(a.IsFamily()||0<a.GetInstanceCount())throw Error("cannot unload textures");const b=this._runtime.GetWebGLRenderer();b&&this._textureLoadedTypes.has(a)&&
  (this._textureLoadedTypes.delete(a),a.ReleaseTextures(b))}_Unload(a,b){if(a!==this&&b)for(const b of this._textureLoadedTypes)b.IsGlobal()||a._initialObjectClasses.has(b)||(b.ReleaseTextures(),this._textureLoadedTypes.delete(b))}_OnWebGLContextLost(){this._textureLoadedTypes.clear()}async _StartRunning(a){const b=this._runtime,c=this._layoutManager,e=b.GetEventSheetManager();this._eventSheetName&&(this._eventSheet=e.GetEventSheetByName(this._eventSheetName),this._eventSheet._UpdateDeepIncludes());
  c._SetMainRunningLayout(this);this._width=this._originalWidth;this._height=this._originalHeight;this._scrollX=b.GetOriginalViewportWidth()/2;this._scrollY=b.GetOriginalViewportHeight()/2;this.BoundScrolling();this._MoveGlobalObjectsToThisLayout(a);this._runtime.SetUsingCreatePromises(!0);this._CreateInitialInstances();this._isFirstVisit||this._CreatePersistedInstances();this._CreateAndLinkContainerInstances(this._createdInstances);this._CreateInitialNonWorldInstances();c.ClearPendingChangeLayout();
  b.FlushPendingInstances();this._runtime.SetUsingCreatePromises(!1);const f=this._runtime.GetCreatePromises();await Promise.all(f);d.clearArray(f);if(b.IsLoadingState())b._TriggerOnCreateAfterLoad(this._createdInstances);else for(const a of this._createdInstances)a._TriggerOnCreated();d.clearArray(this._createdInstances);await Promise.all([...this._initialObjectClasses].map(a=>a.PreloadTexturesWithInstances(this._runtime.GetWebGLRenderer())));a&&(b.Dispatcher().dispatchEvent(new d.Event("beforefirstlayoutstart")),
  await b.DispatchUserScriptEventAsyncWait(new d.Event("beforeprojectstart")));await this.DispatchUserScriptEventAsyncWait(new d.Event("beforelayoutstart"));b.IsLoadingState()||await b.TriggerAsync(d.Plugins.System.Cnds.OnLayoutStart,null,null);await this.DispatchUserScriptEventAsyncWait(new d.Event("afterlayoutstart"));a&&(b.Dispatcher().dispatchEvent(new d.Event("afterfirstlayoutstart")),await b.DispatchUserScriptEventAsyncWait(new d.Event("afterprojectstart")));e._RunQueuedTriggers(c);await this.WaitForPendingTextureLoadsToComplete();
  this._isFirstVisit=!1}_MoveGlobalObjectsToThisLayout(a){for(const a of this._runtime.GetAllObjectClasses())if(!a.IsFamily()&&a.IsWorldType())for(const c of a.GetInstances()){const a=c.GetWorldInfo();var b=a.GetLayer();b=d.clamp(b.GetIndex(),0,this._layers.length-1);b=this._layers[b];a._SetLayer(b);b._MaybeAddInstance(c)}if(!a)for(const a of this._layers)a._SortInstancesByLastCachedZIndex(!1)}_CreateInitialInstances(){for(const a of this._layers)a.CreateInitialInstances(this._createdInstances),a.UpdateViewport(),
  a._Start()}_CreatePersistedInstances(){let a=!1;for(const [c,e]of Object.entries(this._persistData)){const f=this._runtime.GetObjectClassBySID(parseInt(c,10));if(f&&!f.IsFamily()&&f.HasPersistBehavior()){for(const c of e){var b=null;if(f.IsWorldType()&&(b=this.GetLayerBySID(c.w.l),!b))continue;b=this._runtime.CreateInstanceFromData(f,b,!1,0,0,!0);b.LoadFromJson(c);a=!0;this._createdInstances.push(b)}d.clearArray(e)}}for(const a of this._layers)a._SortInstancesByLastCachedZIndex(!0),a.SetZIndicesChanged();
  a&&(this._runtime.FlushPendingInstances(),this._runtime._RefreshUidMap())}_CreateAndLinkContainerInstances(a){for(const c of a){if(!c.IsInContainer())continue;const e=c.GetWorldInfo(),d=c.GetIID();for(const f of c.GetObjectClass().GetContainer().objectTypes())if(f!==c.GetObjectClass()){var b=f.GetInstances();b.length>d?c._AddSibling(b[d]):(b=e?this._runtime.CreateInstanceFromData(f,e.GetLayer(),!0,e.GetX(),e.GetY(),!0):this._runtime.CreateInstanceFromData(f,null,!0,0,0,!0),this._runtime.FlushPendingInstances(),
  f._UpdateIIDs(),c._AddSibling(b),a.push(b))}}}_CreateInitialNonWorldInstances(){for(const a of this._initialNonWorld)this._runtime.GetObjectClassByIndex(a[1]).IsInContainer()||this._runtime.CreateInstanceFromData(a,null,!0)}_CreateGlobalNonWorlds(){const a=[],b=this._initialNonWorld;let c=0;for(let d=0,f=b.length;d<f;++d){const e=b[d],f=this._runtime.GetObjectClassByIndex(e[1]);f.IsGlobal()?f.IsInContainer()&&f.GetContainer().HasAnyWorldType()||a.push(this._runtime.CreateInstanceFromData(e,null,!0)):
  (b[c]=e,++c)}d.truncateArray(b,c);this._runtime.FlushPendingInstances();this._CreateAndLinkContainerInstances(a)}RecreateInitialObjects(a,b,c,e,f){k.set(b,c,e,f);for(const b of this._layers)b.RecreateInitialObjects(a,k)}async _StopRunning(){const a=this._layoutManager;this._runtime.IsLoadingState()||await this._runtime.TriggerAsync(d.Plugins.System.Cnds.OnLayoutEnd,null,null);a.SetIsEndingLayout(!0);this._runtime.GetEventSheetManager().ClearAllScheduledWaits();this._isFirstVisit||this._SavePersistData();
  for(const a of this._layers)a._End();for(const a of this._runtime.GetAllObjectClasses())if(!(a.IsGlobal()||a.IsWorldType()||a.GetPlugin().IsSingleGlobal()||a.IsFamily())){for(const b of a.GetInstances())this._runtime.DestroyInstance(b);this._runtime.FlushPendingInstances()}a.SetIsEndingLayout(!1);a.GetMainRunningLayout()===this&&a._SetMainRunningLayout(null)}_SaveInstanceToPersist(a){const b=a.GetObjectClass().GetSID().toString();this._persistData.hasOwnProperty(b)||(this._persistData[b]=[]);this._persistData[b].push(a.SaveToJson())}_SavePersistData(){for(const a of this._layers){a._UpdateZIndices();
  for(const b of a._GetInstances()){const a=b.GetObjectClass();!a.IsGlobal()&&a.HasPersistBehavior()&&this._SaveInstanceToPersist(b)}}}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()}_CanFastPathDrawLayout(a){return 0===
  a.length?!0:2<=a.length?!1:!a[0].GetShaderProgram().MustPreDraw()}Draw(a){var b=this._runtime.GetCanvasManager();const c=this.UsesOwnTexture();var e=null;c?("low-latency"!==this._runtime.GetCompositingMode()&&(a.SetRenderTarget(null),a.ClearRgba(0,0,0,0)),e={sampling:this._runtime.GetSampling(),readback:this._runtime.UsesAnyBackgroundBlending()||this._effectList.HasAnyActiveEffect()},"low"===b.GetCurrentFullscreenScalingQuality()&&(e.width=b.GetDrawWidth(),e.height=b.GetDrawHeight()),e=this._runtime.GetAdditionalRenderTarget(e),
  a.SetRenderTarget(e)):a.SetRenderTarget(null);this.HasOpaqueBottomLayer()||a.ClearRgba(0,0,0,0);this._curRenderTarget=e;b=!0;for(const c of this._layers)c.UpdateViewport(),c.ShouldDraw()&&(c.Draw(a,e,b),b=!1);c&&this._DrawLayoutOwnTextureToRenderTarget(a,e);this._curRenderTarget=null}_DrawLayoutOwnTextureToRenderTarget(a,b){const c=this._effectList.GetActiveEffectTypes(),e=this._runtime;if(this._CanFastPathDrawLayout(c)){a.SetRenderTarget(null);if(1===c.length){var f=c[0];const b=f.GetShaderProgram();
  a.SetProgram(b);g.set(0,0,1,1);l.set(0,0,e.GetViewportWidth(),e.GetViewportHeight());f=this._effectList.GetEffectParametersForIndex(f.GetIndex());a.SetProgramParameters(null,m,g,g,l,1/e.GetDrawWidth(),1/e.GetDrawHeight(),this.GetScale(),this.GetAngle(),e.GetGameTime(),f);b.IsAnimated()&&e.UpdateRender()}else a.SetTextureFillMode();0===c.length?a.CopyRenderTarget(b):(a.SetAlphaBlend(),a.ResetColor(),a.DrawRenderTarget(b));a.InvalidateRenderTarget(b);e.ReleaseAdditionalRenderTarget(b)}else d.RenderEffectChain(a,
  e,this,null,c)}_SaveToJson(){const a={sx:this.GetScrollX(),sy:this.GetScrollY(),s:this.GetScale(),a:this.GetAngle(),w:this.GetWidth(),h:this.GetHeight(),fv:this._isFirstVisit,persist:this._persistData,fx:this._effectList.SaveToJson(),layers:{}};for(const b of this._layers)a.layers[b.GetSID().toString()]=b._SaveToJson();return a}_LoadFromJson(a){this._scrollX=a.sx;this._scrollY=a.sy;this._scale=a.s;this._angle=a.a;this._width=a.w;this._height=a.h;this._isFirstVisit=!!a.fv;this._persistData=a.persist;
  this._effectList.LoadFromJson(a.fx);for(const [b,c]of Object.entries(a.layers))a=parseInt(b,10),(a=this.GetLayerBySID(a))&&a._LoadFromJson(c)}GetILayout(){return this._iLayout}UserScriptDispatcher(){return this._userScriptDispatcher}DispatchUserScriptEvent(a){a.layout=this.GetILayout();var b=this._runtime;(b=b.IsDebug()&&!b.GetEventSheetManager().IsInEventEngine())&&h.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(a);b&&h.AddScriptTime()}DispatchUserScriptEventAsyncWait(a){a.layout=
  this.GetILayout();return this._userScriptDispatcher.dispatchEventAndWaitAsync(a)}}};
  
  
  // c3/layouts/layoutManager.js
  'use strict';{const b=self.C3;b.LayoutManager=class extends b.DefendedBase{constructor(a){super();this._runtime=a;this._allLayouts=[];this._layoutsByName=new Map;this._layoutsBySid=new Map;this._mainRunningLayout=null;this._runningSubLayouts=[];this._firstLayout=null;this._isEndingLayout=0;this._pendingChangeLayout=null}Release(){this._pendingChangeLayout=this._firstLayout=this._mainRunningLayout=this._runtime=null;b.clearArray(this._allLayouts);this._layoutsByName.clear();this._layoutsBySid.clear();
  b.clearArray(this._runningSubLayouts)}Create(a){a=b.New(b.Layout,this,this._allLayouts.length,a);this._allLayouts.push(a);this._layoutsByName.set(a.GetName().toLowerCase(),a);this._layoutsBySid.set(a.GetSID(),a)}GetRuntime(){return this._runtime}SetFirstLayout(a){this._firstLayout=a}GetFirstLayout(){if(this._firstLayout)return this._firstLayout;if(this._allLayouts.length)return this._allLayouts[0];throw Error("no first layout");}GetLayoutByName(a){return this._layoutsByName.get(a.toLowerCase())||
  null}GetLayoutBySID(a){return this._layoutsBySid.get(a)||null}GetLayoutByIndex(a){a=b.clamp(Math.floor(a),0,this._allLayouts.length-1);return this._allLayouts[a]}GetLayout(a){return"number"===typeof a?this.GetLayoutByIndex(a):this.GetLayoutByName(a.toString())}GetAllLayouts(){return this._allLayouts}_SetMainRunningLayout(a){this._mainRunningLayout=a}GetMainRunningLayout(){return this._mainRunningLayout}_AddRunningSubLayout(a){if(this._runningSubLayouts.includes(a))throw Error("layout already running");
  this._runningSubLayouts.push(a)}_RemoveRunningSubLayout(a){a=this._runningSubLayouts.indexOf(a);if(-1===a)throw Error("layout not running");this._runningSubLayouts.splice(a,1)}*runningLayouts(){this._mainRunningLayout&&(yield this._mainRunningLayout);this._runningSubLayouts.length&&(yield*this._runningSubLayouts)}IsLayoutRunning(a){return this._mainRunningLayout===a||this._runningSubLayouts.includes(a)}SetIsEndingLayout(a){if(a)this._isEndingLayout++;else{if(0>=this._isEndingLayout)throw Error("already unset");
  this._isEndingLayout--}}IsEndingLayout(){return 0<this._isEndingLayout}ChangeMainLayout(a){this._pendingChangeLayout=a}ClearPendingChangeLayout(){this._pendingChangeLayout=null}IsPendingChangeMainLayout(){return!!this._pendingChangeLayout}GetPendingChangeMainLayout(){return this._pendingChangeLayout}}};
  
  
  // c3/layouts/renderEffectChain.js
  'use strict';{var PostDraw=function(a,c){c=a.renderer;if(a.layout)c.SetTextureFillMode(),c.SetRenderTarget(a.renderTarget),a=a.GetEffectRenderTarget(a.otherFxIndex),c.CopyRenderTarget(a),c.InvalidateRenderTarget(a);else{var d=a.runtime.GetCanvasManager();"low"===d.GetCurrentFullscreenScalingQuality()?(c.SetTextureFillMode(),d.SetDeviceTransform(c,d.GetDrawWidth(),d.GetDrawHeight()),a.didChangeTransform=!0):c.SetDeviceTransformTextureFillMode();a.inst?c.SetBlendMode(a.wi.GetBlendMode()):a.layer&&c.SetBlendMode(a.layer.GetBlendMode());
  c.SetRenderTarget(a.renderTarget);d=a.GetEffectRenderTarget(a.otherFxIndex);c.SetTexture(d.GetTexture());l.setFromRect(a.screenRect);c.Quad3(l,a.rcTexBounce);a.inst||c.InvalidateRenderTarget(d);k&&DebugLogRenderTargetContents("Post-draw",c,a.renderTarget)}},RenderBounce=function(a,c,d,e){const f=a.renderer,h=a.runtime;0===e&&a.preDraw&&a.inst&&a.screenRect.shuntY(a.drawHeight);d?(a.inst?f.SetBlendMode(a.wi.GetBlendMode()):a.layer&&f.SetBlendMode(a.layer.GetBlendMode()),d=a.renderTarget,f.SetRenderTarget(d)):
  (d=a.GetEffectRenderTarget(a.fxIndex),f.SetRenderTarget(d),f.ClearRect2(a.clearRect));c=a.inst?a.wi.GetInstanceEffectList().GetEffectParametersForIndex(c.GetIndex()):(a.layer||a.layout).GetEffectList().GetEffectParametersForIndex(c.GetIndex());f.SetProgramParameters(a.renderTarget,a.rcTexDest,a.rcTexBounce,a.rcTexOrigin,a.layoutRect,1/a.surfaceWidth,1/a.surfaceHeight,a.layerScale,a.layerAngle,h.GetGameTime(),c);c=a.GetEffectRenderTarget(a.otherFxIndex);f.SetTexture(c.GetTexture());h.GetCanvasManager().SetDeviceTransform(f);
  a.didChangeTransform=!0;l.setFromRect(a.screenRect);f.Quad3(l,a.rcTexBounce);a.inst||f.InvalidateRenderTarget(c);k&&DebugLogRenderTargetContents("Bounce "+e,f,d)},RenderFirstBounce=function(a,c){const d=a.renderer,e=a.runtime,f=a.GetEffectRenderTarget(a.fxIndex);d.SetRenderTarget(f);var h=a.opts;h&&h.preTransform&&h.preTransform();d.ClearRect2(a.clearRect);if(a.inst){const [b,f]=a.inst.GetCurrentSurfaceSize();(h=a.inst.GetCurrentTexRect())?a.srcRect.copy(h):a.srcRect.set(0,0,0,0);c=a.wi.GetInstanceEffectList().GetEffectParametersForIndex(c.GetIndex());
  d.SetProgramParameters(a.renderTarget,a.rcTexDest,a.srcRect,a.srcRect,a.layoutRect,1/b,1/f,a.layerScale,a.layerAngle,e.GetGameTime(),c);d.SetCurrentZ(a.wi.GetTotalZElevation());a.inst.Draw(d);d.SetCurrentZ(0);a.rcTexDest.clampFlipped(0,1,1,0);a.screenRect.shuntY(a.drawHeight)}else c=(a.layer||a.layout).GetEffectList().GetEffectParametersForIndex(c.GetIndex()),d.SetProgramParameters(a.renderTarget,a.rcTexDest,a.rcTexBounce,a.rcTexOrigin,a.layoutRect,1/a.drawWidth,1/a.drawHeight,a.layerScale,a.layerAngle,
  e.GetGameTime(),c),a=(a.layer||a.layout).GetRenderTarget(),k&&DebugLogRenderTargetContents("Layer target",d,a),d.DrawRenderTarget(a),d.InvalidateRenderTarget(a),e.GetCanvasManager().ReleaseAdditionalRenderTarget(a);k&&DebugLogRenderTargetContents("First bounce",d,f)},PreDraw=function(a){const c=a.renderer;c.SetTextureFillMode();const d=a.GetEffectRenderTarget(a.fxIndex);c.SetRenderTarget(d);var e=a.opts;e&&e.preTransform&&e.preTransform();c.ClearRect2(a.clearRect);a.inst?(c.SetColor(a.wi.GetPremultipliedColor()),
  c.SetCurrentZ(a.wi.GetTotalZElevation()),a.inst.Draw(c),c.SetCurrentZ(0)):(e=(a.layer||a.layout).GetRenderTarget(),a.layer?c.SetColor(a.layer.GetPremultipliedColor()):c.ResetColor(),c.DrawRenderTarget(e),c.InvalidateRenderTarget(e),a.runtime.GetCanvasManager().ReleaseAdditionalRenderTarget(e));a.rcTexDest.clampFlipped(0,1,1,0);a.fxIndex=1;a.otherFxIndex=0;k&&DebugLogRenderTargetContents("Pre-draw",c,d)},GetInstanceBox=function(a,c){for(let b=0,e=c.length;b<e;++b){var d=c[b].GetShaderProgram();a.boxExtendHorizontal+=
  d.GetBoxExtendHorizontal();a.boxExtendVertical+=d.GetBoxExtendVertical()}var e=a.wi;c=e.GetLayer();d=c.GetAngle();var f=e.GetBoundingBox();e=e.GetTotalZElevation();let [h,b]=c.LayerToDrawSurface(f.getLeft(),f.getTop(),e),[m,n]=c.LayerToDrawSurface(f.getRight(),f.getBottom(),e);if(0!==d){const [a,d]=c.LayerToDrawSurface(f.getRight(),f.getTop(),e),[g,k]=c.LayerToDrawSurface(f.getLeft(),f.getBottom(),e);c=Math.min(h,m,a,g);m=Math.max(h,m,a,g);h=c;c=Math.min(b,n,d,k);n=Math.max(b,n,d,k);b=c}c=a.screenRect;
  d=a.rcTexOrigin;f=a.rcTexDest;e=a.clearRect;const p=a.rcTexBounce;c.set(h,b,m,n);c.shuntY(a.drawHeight);d.copy(c);d.divide(a.surfaceWidth,a.surfaceHeight);d.swapTopBottom();c.inflate(a.boxExtendHorizontal,a.boxExtendVertical);f.copy(c);f.divide(a.surfaceWidth,a.surfaceHeight);f.swapTopBottom();e.copy(c);e.roundOuter();e.inflate(a.boxExtendHorizontal+1,a.boxExtendVertical+1);c.clamp(0,0,a.drawWidth,a.drawHeight);e.clamp(0,0,a.drawWidth,a.drawHeight);p.copy(c);p.divide(a.surfaceWidth,a.surfaceHeight);
  p.swapTopBottom()},DebugLogRenderTargetContents=async function(a,c,d){c=await g.Gfx.WebGLRenderTarget.DebugReadPixelsToBlob(c,d);c=URL.createObjectURL(c);console.log("[FX] "+a+" "+(d?"":" [to display]")+": ",c)},ReleaseRenderEffectChainState=function(a){a.ReleaseEffectRenderTargets();a.Clear();q--},AllocRenderEffectChainState=function(){q===r.length&&r.push(new t);return r[q++]};const g=self.C3;class t{constructor(){this.runtime=this.renderer=null;this.surfaceHeight=this.surfaceWidth=this.drawHeight=
  this.drawWidth=0;this.layoutRect=new g.Rect;this.rcTexBounce=new g.Rect;this.rcTexDest=new g.Rect;this.rcTexOrigin=new g.Rect;this.screenRect=new g.Rect;this.clearRect=new g.Rect;this.srcRect=new g.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(a){a=a.GetShaderProgram();if(a.MustPreDraw())return!0;if(this.inst)return a.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(a){a=a.GetShaderProgram();return a.UsesDest()||a.UsesCrossSampling()||this.layout&&
  "low"===this.runtime.GetCanvasManager().GetCurrentFullscreenScalingQuality()}GetEffectRenderTarget(a){if(0!==a&&1!==a)throw Error("invalid effect target");const c=this.fxTex;if(!c[a]){var d=this.runtime;const e=d.GetCanvasManager();d={sampling:d.GetSampling()};"low"===e.GetCurrentFullscreenScalingQuality()&&(d.width=e.GetDrawWidth(),d.height=e.GetDrawHeight());c[a]=e.GetAdditionalRenderTarget(d)}return c[a]}ReleaseEffectRenderTargets(){const a=this.fxTex,c=this.runtime.GetCanvasManager();a[0]&&(c.ReleaseAdditionalRenderTarget(a[0]),
  a[0]=null);a[1]&&(c.ReleaseAdditionalRenderTarget(a[1]),a[1]=null)}}const r=[];let q=0;const l=new g.Quad;let k=!1;g.RenderEffectChain=function(a,c,d,e,f,h){const b=AllocRenderEffectChainState();b.renderer=a;b.runtime=c;if(d instanceof g.Instance)b.inst=d,b.wi=b.inst.GetWorldInfo();else if(d instanceof g.Layer)b.layer=d;else if(d instanceof g.Layout)b.layout=d;else throw Error("invalid effects object");d=c.GetCanvasManager();b.renderTarget=e;b.drawWidth=d.GetDrawWidth();b.drawHeight=d.GetDrawHeight();
  b.surfaceWidth=b.drawWidth;b.surfaceHeight=b.drawHeight;b.fxIndex=0;b.otherFxIndex=1;b.boxExtendHorizontal=0;b.boxExtendVertical=0;b.screenRect.set(0,0,b.drawWidth,b.drawHeight);b.clearRect.set(0,0,b.drawWidth,b.drawHeight);b.didChangeTransform=!1;b.opts=h;b.inst?(e=b.wi,b.layerScale=e.GetLayer().GetRenderScale(),b.layerAngle=e.GetLayer().GetAngle(),b.layoutRect.copy(e.GetBoundingBox())):b.layer?(e=b.layer,b.layerScale=e.GetRenderScale(),b.layerAngle=e.GetAngle(),b.layoutRect.copy(e.GetViewport())):
  (e=b.layout,b.layerScale=e.GetScale(),b.layerAngle=e.GetAngle(),b.layoutRect.set(0,0,b.drawWidth,b.drawHeight));b.inst?GetInstanceBox(b,f):(b.rcTexBounce.set(0,0,b.drawWidth/b.surfaceWidth,b.drawHeight/b.surfaceHeight),b.rcTexDest.copy(b.rcTexBounce),b.rcTexOrigin.copy(b.rcTexBounce),b.rcTexBounce.swapTopBottom(),b.rcTexDest.swapTopBottom(),b.rcTexOrigin.swapTopBottom());a.SetAlphaBlend();a.ResetColor();a.SetBaseZ(0);a.SetCurrentZ(0);b.preDraw=b.ShouldPreDraw(f[0]);b.preDraw&&PreDraw(b);a.ResetColor();
  e=f.length-1;b.postDraw=b.ShouldPostDraw(f[e]);for(let g=0,k=f.length;g<k;++g)h=f[g],d=h.GetShaderProgram(),a.SetProgram(d),d.IsAnimated()&&c.UpdateRender(),0!==g||b.preDraw?(a.SetCopyBlend(),RenderBounce(b,h,g===e&&!b.postDraw,g)):RenderFirstBounce(b,h),0===b.fxIndex?(b.fxIndex=1,b.otherFxIndex=0):(b.fxIndex=0,b.otherFxIndex=1);b.postDraw&&PostDraw(b,f);a=b.didChangeTransform;ReleaseRenderEffectChainState(b);k=!1;return a}};
  
  
  // c3/timelines/timelineManager.js
  'use strict';{const c=self.C3,e=/<(.+?)>/g;c.TimelineManager=class extends c.DefendedBase{constructor(a){super();this._runtime=a;this._timelineDataManager=c.New(c.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=a=>this._OnInstanceDestroy(a.instance)}Release(){this.RemoveRuntimeListeners();this._instanceDestroy=this._layoutChange=this._beforeLayoutChange=this._tick2Func=this._tickFunc=null;for(const a of this._timelines)a.Stop(),a.Release();c.clearArray(this._timelines);this._timelines=null;this._timelineDataManager.Release();this._timelineDataManager=
  null;c.clearArray(this._scheduledTimelines);this._scheduledTimelines=null;c.clearArray(this._playingTimelines);this._playingTimelines=null;this._timelinesByName.clear();this._timelinesByName=null;this._objectClassToTimelineMap.clear();this._objectClassToTimelineMap=null;this._timelinesCreatedByTemplate.clear();this._runtime=this._timelinesCreatedByTemplate=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)}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)}Create(a){this._timelineDataManager.Add(a);a=c.TimelineState.CreateInitial(a,this);this.Add(a);this.SetTimelineObjectClassesToMap(a);this._timelinesCreatedByTemplate.set(a.GetName(),0)}CreateFromTemplate(a){var b=this.GetTimelineDataManager();a=a.GetTemplateName();b=b.Get(a);b=c.TimelineState.CreateFromTemplate(`${a}:${this._timelinesCreatedByTemplate.get(a)}`,b,this);this._IncreaseTemplateTimelinesCount(a);this.Add(b);return b}_IncreaseTemplateTimelinesCount(a){this._timelinesCreatedByTemplate.set(a,
  this._timelinesCreatedByTemplate.get(a)+1)}_SetCreatedTemplateTimelinesCount(){for(const a of this._timelines){if(a.IsTemplate())continue;const b=a.GetTemplateName();this._IncreaseTemplateTimelinesCount(b)}}_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()||(c.arrayFindRemove(this._timelines,a),c.arrayFindRemove(this._scheduledTimelines,
  a),c.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,
  b){this._objectClassToTimelineMap.has(a)||this._objectClassToTimelineMap.set(a,new Set);this._objectClassToTimelineMap.get(a).add(b)}SetTimelineObjectClassesToMap(a){for(const b of a.GetObjectClasses())this.SetTimelineObjectClassToMap(b,a)}RemoveTimelineFromObjectClassMap(a){for(const [b,d]of this._objectClassToTimelineMap.entries())d.has(a)&&(d.delete(a),0===d.size&&this._objectClassToTimelineMap.delete(b))}GetTimelinesForObjectClass(a){if(this._objectClassToTimelineMap.has(a))return this._objectClassToTimelineMap.get(a)}GetTimelineOfTemplateForInstances(a,
  b){if(b)for(const d of this._timelines)if(b.every(a=>d.HasTrackInstance(a.instance,a.trackId))&&d.GetName().includes(a.GetName()))return d}GetTimelineByName(a){return this._timelinesByName.get(a.toLowerCase())||null}GetScheduledOrPlayingTimelineByName(a){for(const b of this._scheduledTimelines)if(b.GetName()===a)return b;for(const b of this._playingTimelines)if(b.GetName()===a)return b;return null}*GetTimelinesByName(a){if(e.test(a)){e.lastIndex=0;let d;var b=new Set;do if(d=e.exec(a)){const a=d[1].split(",");
  for(const d of a)b.add(d)}while(d);for(const d of b.values())(a=this.GetTimelineByName(d))&&(yield a);b.clear()}else(b=this.GetTimelineByName(a))&&(yield b)}*GetTimelinesByTags(a){for(const b of this._timelines)b.HasTags(a)&&(yield b)}AddScheduledTimeline(a){this._scheduledTimelines.includes(a)||this._scheduledTimelines.push(a);this._MaybeEnableRuntimeListeners()}RemovePlayingTimeline(a){c.arrayFindRemove(this._playingTimelines,a);this._MaybeDisableRuntimeListeners()}ScheduleTimeline(a){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();c.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 b=this._scheduledTimelines.pop();b.SetInitialState();this._playingTimelines.push(b)}b=this._runtime.GetDt();var d=this._runtime.GetTimeScale();for(const c of this._playingTimelines){if(c.IsMarkedForRemoval())continue;const f=c.Tick(b,d);!a&&f&&(a=!0)}this._isTickingTimelines=!1;a&&this.GetRuntime().UpdateRender()}}_OnTick2(){if(!this.GetRuntime().IsLoadingState()&&this._hasRuntimeListeners&&
  !this._changingLayout){var a;for(const b of this._playingTimelines)b.IsMarkedForRemoval()&&(a||(a=new Set),this._MaybeExecuteTimelineFinishTriggers(b),a.add(b));a&&c.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 b of this._playingTimelines)b._OnBeforeChangeLayout()&&a.add(b);c.arrayRemoveAllInSet(this._playingTimelines,a);this._MaybeDisableRuntimeListeners();for(const a of this._timelines)a.CleanCaches()}_OnAfterChangeLayout(){this._changingLayout=!1}_OnInstanceDestroy(a){a=
  a.GetObjectClass();if(a=this.GetTimelinesForObjectClass(a))for(const b of a)b.IsTemplate()||(b.IsReleased()?this.Remove(b):b.HasValidTracks()||(this._MaybeExecuteTimelineFinishTriggers(b),this.Remove(b)))}_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 b of a){a=this.GetTimelineByName(b.name);if(!a){a=this._GetTemplateNameFromJson(b);if(!a)continue;a=this.GetTimelineByName(a);a=this.CreateFromTemplate(a)}a._LoadFromJson(b);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,b){for(const d of b)if(d===a.GetName())return!0;return!1}_SaveTimelines(a){return a.map(a=>a.GetName())}_LoadTimelines(a,b){var d=new Set;for(const c of b)this._IsTimelineInJson(c,a)||d.add(c);c.arrayRemoveAllInSet(b,d);d=a=>b=>b.GetName()===a;for(const c of a)(a=this.GetTimelineByName(c))&&(b.find(d(c))||b.push(a))}}};
  
  
  // c3/timelines/state/timelineState.js
  'use strict';{const b=self.C3;b.TimelineState=class extends b.DefendedBase{constructor(a,c,d){super();this._runtime=d.GetRuntime();this._timelineManager=d;this._timelineDataItem=c;this._name=a;this._tracks=[];for(const a of this._timelineDataItem.GetTrackData().trackDataItems())this._tracks.push(b.TrackState.Create(this,a));this._playResolve=this._playPromise=null;this._playheadTime=b.New(b.KahanSum);this._playheadTime.Set(0);this._playbackRate=1;this._pingPongState=0;this._currentRepeatCount=1;this._initialStateSet=
  this._isScheduled=this._isPlaying=!1;this._complete=!0;this._markedForRemoval=this._released=!1;this._completedTick=-1;this._firstTick=this._finishedTriggers=this._isTemplate=this._implicitPause=!1;this._lastDelta=NaN;this._tags=[""];this._stringTags="";this._tagsChanged=!1}static CreateInitial(a,c){var d=c.GetTimelineDataManager();const e=d.GetNameId();d=d.Get(a[e]);a=b.New(b.TimelineState,a[e],d,c);a.SetIsTemplate(!0);return a}static CreateFromTemplate(a,c,d){return b.New(b.TimelineState,a,c,d)}static get WORLD_INSTANCE_BOX_CHANGE(){return 1}static get LAYOUT_RENDER_CHANGE(){return b.nextHighestPowerOfTwo(1)}Release(){if(!this.IsReleased()){this._timelineManager.DeScheduleTimeline(this);
  this._timelineManager.CompleteTimelineAndResolve(this);for(const a of this._tracks)a.Release();b.clearArray(this._tracks);this._tracks=null;this._playheadTime.Release();this._timelineDataItem=this._timelineManager=this._runtime=this._playheadTime=null;this._released=!0;this._playResolve=this._playPromise=null}}GetTimelineManager(){return this._timelineManager}GetRuntime(){return this._runtime}GetTracks(){return this._tracks}GetSimilarPropertyTracks(a,c,d){const e=[];for(const b of this._tracks){if(a!==
  b.GetInstance())continue;const g=b.GetPropertyTrack(d);g&&c.constructor===g.GetSourceAdapter().constructor&&e.push(g)}return e}HasTracks(){return!!this._tracks.length}GetTrackById(a){for(const c of this._tracks)if(b.equalsNoCase(c.GetId(),a))return c;return null}SetName(a){this._name=a}GetName(){return this._name}GetTimelineDataItem(){return this._timelineDataItem}GetTemplateName(){return this._timelineDataItem.GetName()}GetTotalTime(){return this._timelineDataItem.GetTotalTime()}SetTotalTime(a){this._timelineDataItem.SetTotalTime(a)}GetStep(){return this._timelineDataItem.GetStep()}SetStep(a){this._timelineDataItem.SetStep(a)}GetInterpolationMode(){return this._timelineDataItem.GetInterpolationMode()}SetInterpolationMode(a){this._timelineDataItem.SetInterpolationMode(a)}GetResultMode(){return this._timelineDataItem.GetResultMode()}SetResultMode(a){this._timelineDataItem.GetResultMode(a)}SetEase(a){for(const c of this.GetTracks())c.SetEase(a)}GetLoop(){return this._timelineDataItem.GetLoop()}SetLoop(a){return this._timelineDataItem.SetLoop(a)}GetPingPong(){return this._timelineDataItem.GetPingPong()}SetPingPong(a){return this._timelineDataItem.SetPingPong(a)}GetRepeatCount(){return this._timelineDataItem.GetRepeatCount()}SetPlaybackRate(a){return this._playbackRate=
  a}GetPlaybackRate(){return this._playbackRate}IsForwardPlayBack(){return this.IsPlaying()?0<this._playbackRate:!0}GetPlayPromise(){return this._playPromise?this._playPromise:this._playPromise=new Promise(a=>{this._playResolve=a})}ResolvePlayPromise(){this._playPromise&&(this._playResolve(),this._playResolve=this._playPromise=null)}SetTags(a){this._tags=b.TimelineState._GetTagArray(a);this._tagsChanged=!0}GetTags(){return this._tags}GetStringTags(){this._tagsChanged&&(this._stringTags=this._tags.join(" "));
  this._tagsChanged=!1;return this._stringTags}HasTags(a){return this._tags&&this._tags.length?(a=b.TimelineState._GetTagArray(a))&&a.length?a.every(b.TimelineState._HasTag,this):!1:!1}OnStarted(){b.Plugins.Timeline.Cnds.SetTriggerTimeline(this);this._timelineManager.Trigger(b.Plugins.Timeline.Cnds.OnTimelineStarted);this._timelineManager.Trigger(b.Plugins.Timeline.Cnds.OnTimelineStartedByName);this._timelineManager.Trigger(b.Plugins.Timeline.Cnds.OnTimelineStartedByTags);this._timelineManager.Trigger(b.Plugins.Timeline.Cnds.OnAnyTimelineStarted);
  b.Plugins.Timeline.Cnds.SetTriggerTimeline(null)}OnCompleted(){this._completedTick=this._runtime.GetTickCount()}FinishTriggers(){this._finishedTriggers||(this._finishedTriggers=!0,b.Plugins.Timeline.Cnds.SetTriggerTimeline(this),this._timelineManager.Trigger(b.Plugins.Timeline.Cnds.OnTimelineFinished),this._timelineManager.Trigger(b.Plugins.Timeline.Cnds.OnTimelineFinishedByName),this._timelineManager.Trigger(b.Plugins.Timeline.Cnds.OnTimelineFinishedByTags),this._timelineManager.Trigger(b.Plugins.Timeline.Cnds.OnAnyTimelineFinished),
  b.Plugins.Timeline.Cnds.SetTriggerTimeline(null))}SetPlaying(a){this._isPlaying=a}IsCompletedTick(){return this._completedTick===this._runtime.GetTickCount()}IsPlaying(a=!1){return this.IsCompletedTick()||this.IsScheduled()&&!a?!0:this._isPlaying}_IsPlaying(){return this.IsPlaying(!0)}IsPaused(){return this._IsPaused()}_IsPaused(){return this.IsReleased()||this.IsScheduled()||this._IsPlaying()||this.IsComplete()?!1:!0}SetScheduled(a){this._isScheduled=a}IsScheduled(){return this._isScheduled}SetComplete(a){this._complete=
  a;a=this.GetTime();if(0>=a||a>=this.GetTotalTime())this._complete=!0}IsComplete(){return this._complete}IsReleased(){return this._released}SetMarkedForRemoval(a){this._markedForRemoval=a}IsMarkedForRemoval(){return this._markedForRemoval}SetImplicitPause(a){this._implicitPause=a}IsImplicitPause(){return this._implicitPause}SetIsTemplate(a){this._isTemplate=!!a}IsTemplate(){return this._isTemplate}InitialStateSet(){return this._initialStateSet}GetTime(){return this._playheadTime.Get()}SetTime(a){const c=
  this.GetTime();this._SetTime(a);this.SetComplete(!1);this.IsComplete()||this.SetImplicitPause(!0);if(this._IsPlaying()||this.IsScheduled()||!this._initialStateSet)this._IsPlaying()||this.IsScheduled()||this._initialStateSet?this._IsPlaying()?this.Stop():this.IsScheduled()&&(this._timelineManager.DeScheduleTimeline(this),this.SetInitialStateFromSetTime()):this.SetInitialStateFromSetTime();this._Interpolate(a,!1,!0,!0,c)&&this.GetRuntime().UpdateRender();this._OnSetTime()}_SetTime(a){0>a?this._playheadTime.Set(0):
  a>=this.GetTotalTime()?this._playheadTime.Set(this.GetTotalTime()):this._playheadTime.Set(a)}_OnSetTime(){b.Plugins.Timeline&&this.constructor===b.TimelineState&&(b.Plugins.Timeline.Cnds.SetTriggerTimeline(this),this._timelineManager.Trigger(b.Plugins.Timeline.Cnds.OnTimeSet),this._timelineManager.Trigger(b.Plugins.Timeline.Cnds.OnTimeSetByName),this._timelineManager.Trigger(b.Plugins.Timeline.Cnds.OnTimeSetByTags),b.Plugins.Timeline.Cnds.SetTriggerTimeline(null))}_CanResume(){if(!this.GetLoop())if(this.GetPingPong()&&
  1===this._pingPongState)if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())return!1}else{if(0>=this.GetTime())return!1}else if(!this.GetLoop()&&!this.GetPingPong())if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())return!1}else if(0>=this.GetTime())return!1;return!0}Resume(){this.IsReleased()||this._CanResume()&&this.Play(!0)}Play(a=!1){return this.IsReleased()||this.IsScheduled()?!1:this._IsPlaying()&&this.IsCompletedTick()?this._SchedulePlayingTimeline():this._IsPlaying()||
  !this.IsComplete()&&!a&&!this.IsImplicitPause()?!1:this._ScheduleStoppedTimeline()}_SchedulePlayingTimeline(){this.SetImplicitPause(!1);this._timelineManager.RemovePlayingTimeline(this);this._timelineManager.ScheduleTimeline(this);this.GetPlayPromise();return!0}_ScheduleStoppedTimeline(){this.SetImplicitPause(!1);this._timelineManager.ScheduleTimeline(this);this.GetPlayPromise();return!0}Stop(a=!1){this.IsReleased()||(this.SetComplete(a),this._timelineManager.CompleteTimeline(this),this.IsComplete()&&
  this.ResolvePlayPromise())}Reset(a=!0,c=!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();c=c?this._InterpolateBeforeChangeLayout(d):this._Interpolate(d,!1,!1,!0);a&&this._OnSetTime();c&&a&&this.GetRuntime().UpdateRender()}}}ResetBeforeChangeLayout(){this.Reset(!1,!0)}_InterpolateBeforeChangeLayout(a){this._Interpolate(a,
  !1,!1,!0,NaN,!1,!0)}_OnBeforeChangeLayout(){if(this.IsReleased())return!0;if(this.HasValidGlobalTracks())return!1;this._timelineManager.CompleteTimeline(this);this.ResetBeforeChangeLayout();return!0}SetInitialStateFromSetTime(){this.SetInitialState(!0)}SetInitialState(a){if(!this.IsMarkedForRemoval())if(a){this._firstTick=this._initialStateSet=!0;for(const 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(a,c){if(0!==a||0!==this._lastDelta){this._lastDelta=a;var d=this.GetTime();this._SetTime(d+a*c*this._playbackRate);var e;this.GetLoop()||this.GetPingPong()?this.GetLoop()&&
  !this.GetPingPong()?e=this._LoopCompleteCheck():!this.GetLoop()&&this.GetPingPong()?e=this._PingPongCompleteCheck():this.GetLoop()&&this.GetPingPong()&&(e=this._LoopPingPongCompleteCheck()):e=this._SimpleCompleteCheck();if(e){for(const a of this._tracks)a.SetEndState();this.Stop(!0);this.OnCompleted();return!0}return this._Interpolate(this.GetTime(),!0,!1,!1,d,!0)}}_Interpolate(a,c=!1,d=!1,e=!1,k=NaN,g=!1,l=!1){let h=!1;for(var f of this._tracks)f.BeforeInterpolate();for(const b of this._tracks){f=
  a;if("number"===typeof k){const a=this.GetTime()-b.GetStartOffset(),c=k-b.GetStartOffset();0>a&&0<c&&(f=b.GetStartOffset(),this._SetTime(f))}f=b.Interpolate(f,c,d,e,this._firstTick,l);!h&&f&&(h=!0)}for(const a of this._tracks)a.AfterInterpolate();this._firstTick&&g&&(this._firstTick=!1);return h}_SimpleCompleteCheck(){if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())if(this._currentRepeatCount<this.GetRepeatCount())this._currentRepeatCount++,this._SetTime(0);else return this._SetTime(this.GetTotalTime()),
  !0}else if(0>=this.GetTime())if(this._currentRepeatCount<this.GetRepeatCount())this._currentRepeatCount++,this._SetTime(this.GetTotalTime());else return this._SetTime(0),!0;return!1}_LoopCompleteCheck(){this.IsForwardPlayBack()?this.GetTime()>=this.GetTotalTime()&&this._SetTime(0):0>=this.GetTime()&&this._SetTime(this.GetTotalTime());return!1}_PingPongCompleteCheck(){if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())if(this._SetTime(this.GetTotalTime()),this.SetPlaybackRate(-1*this.GetPlaybackRate()),
  1===this._pingPongState)if(this._currentRepeatCount<this.GetRepeatCount())this._currentRepeatCount++,this._pingPongState=0;else return!0;else 0===this._pingPongState&&(this._pingPongState=1)}else if(0>=this.GetTime())if(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate()),1===this._pingPongState)if(this._currentRepeatCount<this.GetRepeatCount())this._currentRepeatCount++,this._pingPongState=0;else return!0;else 0===this._pingPongState&&(this._pingPongState=1);return!1}_LoopPingPongCompleteCheck(){this.IsForwardPlayBack()?
  this.GetTime()>=this.GetTotalTime()&&(this._SetTime(this.GetTotalTime()),this.SetPlaybackRate(-1*this.GetPlaybackRate())):0>=this.GetTime()&&(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate()));return!1}AddTrack(){var a=this._timelineDataItem.GetTrackData().AddEmptyTrackDataItem();a=b.TrackState.Create(this,a);this._tracks.push(a);return a}CleanCaches(){for(const a of this._tracks)a.CleanCaches()}ClearTrackInstances(){for(const a of this._tracks)a.ClearInstance()}SetTrackInstance(a,
  c){if(c)for(const b of this._tracks){if(a){if(b.GetId()!==a)continue}else if(b.HasInstance())continue;b.SetInstance(c);this._timelineManager.SetTimelineObjectClassToMap(c.GetObjectClass(),this);break}}HasTrackInstance(a,c){for(const b of this._tracks)if(c){if(c===b.GetId()&&a===b.GetInstance())return!0}else if(a===b.GetInstance())return!0;return!1}HasValidTracks(){return this._tracks.some(a=>a.CanInstanceBeValid())}HasValidGlobalTracks(){return this._tracks.some(a=>a.CanInstanceBeValid()&&a.GetObjectClass().IsGlobal())}GetPropertyTrack(a){for(const b of this.GetTracks())for(const c of b.GetPropertyTracks())if(c.GetPropertyName()===
  a)return c}GetKeyframeWithTags(a){a=a?a.split(" "):[];a=[...(new Set(a.map(a=>a.toLowerCase().trim()))).values()];for(const b of this.GetTracks())for(const c of b.GetKeyframeDataItems())if(a.every(a=>c.HasTag(a)))return c}GetObjectClasses(){const a=[];for(const b of this.GetTracks())a.push(b.GetObjectClass());return a.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(a){a&&(this._LoadTracksFromJson(a.tracksJson),this._name=a.name,
  this._playheadTime.Set(a.playheadTime),this._playbackRate=a.playbackRate,this._pingPongState=a.pingPongState,this._currentRepeatCount=a.currentRepeatCount,this._isPlaying=!!a.isPlaying,this._isScheduled=!!a.isScheduled,this._initialStateSet=!!a.initialStateSet,this._finishedTriggers=a.hasOwnProperty("finishedTriggers")?!!a.finishedTriggers:!1,this._complete=!!a.complete,this._released=!!a.released,this._markedForRemoval=!!a.markedForRemoval,this._completedTick=a.completedTick,this._implicitPause=
  !!a.implicitPause,this._isTemplate=!!a.isTemplate,this._tags=a.tags.split(" "),this._stringTags=a.stringTags,this._tagsChanged=!!a.tagsChanged,this._firstTick=!!a.firstTick)}_SaveTracksToJson(){return this._tracks.map(a=>a._SaveToJson())}_LoadTracksFromJson(a){a.forEach((a,b)=>{this._tracks[b]._LoadFromJson(a)});this._tracks.filter(a=>a.CanInstanceBeValid())}static _HasTag(a){const c=this.GetTags();return""===a?1===c.length&&""===c[0]:c.includes(a)}static _GetTagArray(a){if(b.IsArray(a))return a.slice(0);
  if(b.IsString(a))return a.split(" ")}}};
  
  
  // c3/timelines/state/trackState.js
  'use strict';{const c=self.C3;c.TrackState=class extends c.DefendedBase{constructor(a,b){super();this._timeline=a;this._trackDataItem=b;this._trackData=b.GetTrackData();this._objectClassIndex=this._instanceUid=NaN;this._worldInfo=this._instance=null;this._isNested=0<b.GetStartOffset();this._endStateOfNestedSet=this._initialStateOfNestedSet=!1;this._lastKeyframeDataItem=null;this._keyframeDataItems=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemArray();this._propertyTracks=[];for(const a of this._trackDataItem.GetPropertyTrackData().propertyTrackDataItems())this._propertyTracks.push(c.PropertyTrackState.Create(this,
  a))}static Create(a,b){return c.New(c.TrackState,a,b)}Release(){this._keyframeDataItems=null;for(const a of this._propertyTracks)a.Release();c.clearArray(this._propertyTracks);this._lastKeyframeDataItem=this._trackDataItem=this._worldInfo=this._instance=this._timeline=this._propertyTracks=null}CleanCaches(){for(const a of this._propertyTracks)a.CleanCaches();this._worldInfo=this._instance=null}GetTimeline(){return this._timeline}GetRuntime(){return this._timeline.GetRuntime()}GetKeyframeDataItems(){return this._keyframeDataItems?
  this._keyframeDataItems:this._keyframeDataItems=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemArray()}GetPropertyTracks(){return this._propertyTracks}GetPropertyTrack(a){for(const b of this._propertyTracks)if(b.GetPropertyName()===a)return b}MaybeGetInstance(){this._instance||this.GetInstance()}IsInstanceValid(){return this._instance?!this._instance.IsDestroyed():!1}CanInstanceBeValid(){var a=this.GetInstanceUID();return(a=this.GetRuntime().GetInstanceByUID(a))?!a.IsDestroyed():!1}GetObjectClass(){const a=
  this.GetObjectClassIndex();if(-1!==a)return this.GetRuntime().GetObjectClassByIndex(a)}ClearInstance(){this._instance=null;this._instanceUid=-1;this._worldInfo=null;this._objectClassIndex=-1}HasInstance(){return!!this._instance}GetInstance(){if(this._instance&&this.IsInstanceValid())return this._instance;const a=this.GetInstanceUID();return this._instance=this.GetRuntime().GetInstanceByUID(a)}SetInstance(a){if(this._instance!==a){this.CleanCaches();this._instance=a;this._objectClassIndex=a.GetObjectClass().GetIndex();
  this._instanceUid=a.GetUID();this._worldInfo=a.GetWorldInfo();for(const c of this.propertyTrackItems()){const f=c.sourceAdapter;switch(c.propertyTrack.GetSourceAdapterId()){case "instance-variable":f.GetEditorIndex();var b=a.GetObjectClass(),d=b.GetInstanceVariableIndexByName(c.name),g=b.GetInstanceVariableName(d);b=b.GetInstanceVariableType(d);g===c.name&&b===c.type&&f.UpdateInstanceVariableIndex(d);break;case "behavior":var e=c.behaviorType;d=this.GetObjectClass();g=a.GetObjectClass();b=f.GetBehaviorType(g);
  e&&b&&(e=e.GetName(),d.GetBehaviorIndexByName(e),g.GetBehaviorIndexByName(e),f.GetEditorIndex(),f.UpdateBehaviorTypeSid(b.GetSID()))}}}}*propertyTrackItems(){for(const d of this._propertyTracks){var a=d.GetSourceAdapter(),b=this.GetObjectClass();const c={propertyTrack:d,sourceAdapter:a};switch(d.GetSourceAdapterId()){case "world-instance":c.property=d.GetPropertyName();break;case "instance-variable":a=a.GetEditorIndex();c.name=b.GetInstanceVariableName(a);c.type=b.GetInstanceVariableType(a);break;
  case "effect":b=b.GetEffectList();a=a.GetEffectType(b);c.effectType=a;break;case "behavior":a=a.GetBehaviorType(b);c.behaviorType=a;break;case "plugin":c.plugin=b.GetPlugin()}yield c}}GetWorldInfo(){if(this._worldInfo&&this.IsInstanceValid())return this._worldInfo;const a=this.GetInstance();a&&(this._worldInfo=a.GetWorldInfo());return this._worldInfo}GetTrackDataItem(){return this._trackDataItem}GetInstanceUID(){return this._instanceUid?this._instanceUid:this._trackDataItem.GetInstanceUID()}SetInstanceUID(a){this._trackDataItem.SetInstanceUID(a)}GetInterpolationMode(){return this._trackDataItem.GetInterpolationMode()}SetInterpolationMode(a){this._trackDataItem.SetInterpolationMode(a)}GetResultMode(){return this._trackDataItem.GetResultMode()}GetId(){return this._trackDataItem.GetId()}GetStartOffset(){return this._trackDataItem.GetStartOffset()}GetLocalTotalTime(){return this._trackDataItem.GetLocalTotalTime()}SetResultMode(a){this._trackDataItem.SetResultMode(a)}SetEase(a){for(const b of this.GetKeyframeDataItems())b.SetEase(a);
  for(const b of this.GetPropertyTracks())b.SetEase(a)}GetEnable(){return this._trackDataItem.GetEnable()}SetEnable(a){this._trackDataItem.SetEnable(a)}GetObjectClassIndex(){return isNaN(this._objectClassIndex)?this._trackDataItem.GetObjectClassIndex():this._objectClassIndex}SetObjectClassIndex(a){this._trackDataItem.SetObjectClassIndex(a)}SetOriginalWidth(a){this._trackDataItem.SetOriginalWidth(a)}GetOriginalWidth(){return this._trackDataItem.GetOriginalWidth()}SetOriginalHeight(a){this._trackDataItem.SetOriginalHeight(a)}GetOriginalHeight(){return this._trackDataItem.GetOriginalHeight()}SetInitialState(){this.MaybeGetInstance();
  if(this.IsInstanceValid()){for(var a of this._propertyTracks)a.SetInitialState();a=this.GetTimeline().IsForwardPlayBack()?0:this.GetLocalTotalTime();this._lastKeyframeDataItem=this.GetLastKeyFrameBeforeTime(a);this._endStateOfNestedSet=this._initialStateOfNestedSet=!1;this.Interpolate(a)}}SetResumeState(){this.MaybeGetInstance();if(this.IsInstanceValid()){this._timeline.IsForwardPlayBack();var a=this._timeline.GetTime()-this.GetStartOffset();this._lastKeyframeDataItem=this.GetLastKeyFrameBeforeTime(a);
  for(const a of this._propertyTracks)a.SetResumeState()}}SetEndState(){if(!this.GetTimeline().IsComplete()&&(this.MaybeGetInstance(),this.IsInstanceValid()&&!this._isNested)){const a=this._timeline.GetTime(),b=this.GetStartOffset()+this.GetLocalTotalTime();a>=b?this.Interpolate(this.GetLocalTotalTime(),!0,!1,!0):0>=a&&this.Interpolate(0,!0,!1,!0)}}BeforeInterpolate(){for(const a of this._propertyTracks)a.BeforeInterpolate()}Interpolate(a,b=!1,d=!1,g=!1,e=!1,h=!1){this.MaybeGetInstance();if(!this.IsInstanceValid()||
  h&&this.GetObjectClass().IsGlobal())return!1;a-=this.GetStartOffset();if(0>a)return!1;this.MaybeSetInitialStateOfNestedTrack(a,b);this.MaybeTriggerKeyframeReachedConditions(a,b,e);e=h=!1;for(const b of this._propertyTracks){const f=b.Interpolate(a,d,!1,g);h||0===(f&c.TimelineState.WORLD_INSTANCE_BOX_CHANGE)||(h=!0);e||0===(f&c.TimelineState.LAYOUT_RENDER_CHANGE)||(e=!0)}this.MaybeSetEndStateOfNestedTrack(a,b);h&&(a=this.GetWorldInfo())&&a.SetBboxChanged();return e}AfterInterpolate(){for(const a of this._propertyTracks)a.AfterInterpolate()}MaybeSetInitialStateOfNestedTrack(a,
  b){if(b&&this._isNested&&!this._initialStateOfNestedSet){if(this.GetTimeline().IsForwardPlayBack()){if(0>a)return;for(const a of this._propertyTracks)a.Interpolate(0,!1,!1,!0)}else{if(a>this.GetLocalTotalTime())return;for(const a of this._propertyTracks)a.Interpolate(this.GetLocalTotalTime(),!1,!1,!0)}for(const a of this._propertyTracks)a.SetInitialState();this._initialStateOfNestedSet=!0}}MaybeSetEndStateOfNestedTrack(a,b){if(b&&this._isNested&&!this._endStateOfNestedSet)if(this.GetTimeline().IsForwardPlayBack()){if(a>=
  this.GetLocalTotalTime()){for(const a of this._propertyTracks)a.Interpolate(this.GetLocalTotalTime(),!1,!1,!0);this._endStateOfNestedSet=!0}}else if(0>=a){for(const a of this._propertyTracks)a.Interpolate(0,!1,!1,!0);this._endStateOfNestedSet=!0}}MaybeTriggerKeyframeReachedConditions(a,b,d){if(!d&&b)return a=this.GetLastKeyFrameBeforeTime(a),a!==this._lastKeyframeDataItem&&this.OnKeyframeReached(a),this._lastKeyframeDataItem=a}GetLastKeyFrameBeforeTime(a){const b=this.GetTimeline();let d=this._trackData.GetKeyFrameDataItemAtTime(a,
  this._trackDataItem);return d?d:b.IsForwardPlayBack()?this._trackData.GetFirstKeyFrameDataItemLowerOrEqualThan(a,this._trackDataItem):this._trackData.GetFirstKeyFrameDataItemHigherOrEqualThan(a,this._trackDataItem)}OnKeyframeReached(a){if(c.Plugins.Timeline&&this.GetTimeline().constructor===c.TimelineState){var b=this.GetTimeline();c.Plugins.Timeline.Cnds.SetTriggerTimeline(b);c.Plugins.Timeline.Cnds.SetTriggerKeyframe(a);a=b.GetTimelineManager();a.Trigger(c.Plugins.Timeline.Cnds.OnAnyKeyframeReached);
  a.Trigger(c.Plugins.Timeline.Cnds.OnKeyframeReached);c.Plugins.Timeline.Cnds.SetTriggerTimeline(null);c.Plugins.Timeline.Cnds.SetTriggerKeyframe(null)}}AddKeyframe(){return this._trackDataItem.GetKeyframeData().AddEmptyKeyframeDataItem()}AddPropertyTrack(){var a=this._trackDataItem.GetPropertyTrackData().AddEmptyPropertyTrackDataItem();a=c.PropertyTrackState.Create(this,a);this._propertyTracks.push(a);return a}DeleteKeyframes(a){this._trackDataItem.GetKeyframeData().DeleteKeyframeDataItems(a)}DeletePropertyKeyframes(a){for(const b of this._propertyTracks)b.DeletePropertyKeyframes(a)}SaveState(){for(const a of this._propertyTracks)a.SaveState()}CompareInitialStateWithCurrent(){this.MaybeGetInstance();
  if(this.IsInstanceValid())for(const a of this._propertyTracks)a.CompareInitialStateWithCurrent()}CompareSaveStateWithCurrent(){this.MaybeGetInstance();if(this.IsInstanceValid()){var a=!1;for(const b of this._propertyTracks){const c=b.CompareSaveStateWithCurrent();!a&&c&&(a=!0)}a&&(a=this.AddKeyframe(),a.SetTime(this.GetTimeline().GetTime()),a.SetEase("noease"),a.SetEnable(!0),a.SetTags(""))}}_SaveToJson(){var a=this.GetInstance();a=a?a.GetUID():this.GetInstanceUID();return{propertyTracksJson:this._SavePropertyTracksToJson(),
  lastKeyframeDataItemJson:this._SaveLastKeyframeDataItemToJson(),initialStateOfNestedSet:this._initialStateOfNestedSet,endStateOfNestedSet:this._endStateOfNestedSet,instanceUid:a}}_LoadFromJson(a){a&&(this._LoadPropertyTracksFromJson(a.propertyTracksJson),this._LoadLastKeyframeDataItemFromJson(a.lastKeyframeDataItemJson),this._LoadInstanceFromJson(a.instanceUid),this._initialStateOfNestedSet=!1,a.hasOwnProperty.initialStateOfNestedSet&&(this._initialStateOfNestedSet=a.initialStateOfNestedSet),this._endStateOfNestedSet=
  !1,a.hasOwnProperty.endStateOfNestedSet&&(this._endStateOfNestedSet=a.endStateOfNestedSet))}_SaveLastKeyframeDataItemToJson(){return this._trackDataItem.GetKeyframeData().GetKeyframeDataItemIndex(this._lastKeyframeDataItem)}_SavePropertyTracksToJson(){return this._propertyTracks.map(a=>a._SaveToJson())}_LoadPropertyTracksFromJson(a){a.forEach((a,c)=>{this._propertyTracks[c]._LoadFromJson(a)})}_LoadInstanceFromJson(a){if(c.IsFiniteNumber(a)&&(a=this.GetRuntime().GetInstanceByUID(a))){var b=this.GetTimeline();
  b.ClearTrackInstances();b.SetTrackInstance(this._trackDataItem.GetId(),a)}}_LoadLastKeyframeDataItemFromJson(a){this._lastKeyframeDataItem=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemFromIndex(a)}}};
  
  
  // c3/timelines/state/propertyTrackState.js
  'use strict';{const d=self.C3;d.PropertyTrackState=class extends d.DefendedBase{constructor(a,b){super();this._track=a;this._propertyTrackDataItem=b;this._propertyTrackData=b.GetPropertyTrackData();this._sourceAdapter=this.GetSourceAdapter();this._propertyKeyframeDataItems=this._propertyTrackDataItem.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray()}static Create(a,b){return d.New(d.PropertyTrackState,a,b)}Release(){this._track=null;this._sourceAdapter&&(this._sourceAdapter.Release(),this._sourceAdapter=
  null);this._propertyTrackData=this._propertyTrackDataItem=this._propertyKeyframeDataItems=null}GetTrack(){return this._track}GetPropertyTrackDataItem(){return this._propertyTrackDataItem}GetPropertyTrackData(){return this._propertyTrackData}GetTimeline(){return this._track.GetTimeline()}GetRuntime(){return this._track.GetRuntime()}GetInstance(){return this._track.GetInstance()}GetSourceAdapter(){if(this._sourceAdapter)return this._sourceAdapter;let a;switch(this._propertyTrackDataItem.GetSourceAdapterId()){case "behavior":a=
  new d.PropertyTrackState.BehaviorSourceAdapter(this);break;case "effect":a=new d.PropertyTrackState.EffectSourceAdapter(this);break;case "instance-variable":a=new d.PropertyTrackState.InstanceVariableSourceAdapter(this);break;case "plugin":a=new d.PropertyTrackState.PluginSourceAdapter(this);break;case "world-instance":a=new d.PropertyTrackState.WorldInstanceSourceAdapter(this);break;case "value":a=new d.PropertyTrackState.ValueSourceAdapter(this)}return this._sourceAdapter=a}GetSourceAdapterId(){return this._propertyTrackDataItem.GetSourceAdapterId()}SetSourceAdapterId(a){this._propertyTrackDataItem.SetSourceAdapterId(a)}GetSourceAdapterArgs(){return this._propertyTrackDataItem.GetSourceAdapterArguments()}SetSourceAdapterArgs(a){this._propertyTrackDataItem.SetSourceAdapterArguments(a)}GetSourceAdapterValue(){return this.GetSourceAdapter().GetValue()}GetPropertyName(){return this._propertyTrackDataItem.GetProperty()}SetPropertyName(a){this._propertyTrackDataItem.SetProperty(a)}GetPropertyType(){return this._propertyTrackDataItem.GetType()}SetPropertyType(a){this._propertyTrackDataItem.SetType(a)}GetPropertyKeyframeType(){return this.GetPropertyTrackData().GetFirstPropertyKeyframeDataItem(this._propertyTrackDataItem).GetType()}GetMin(){return this._propertyTrackDataItem.GetMin()}SetMin(a){this._propertyTrackDataItem.SetMin(a)}GetMax(){return this._propertyTrackDataItem.GetMax()}SetMax(a){this._propertyTrackDataItem.SetMax(a)}GetEnable(){return this._propertyTrackDataItem.GetEnable()}SetEnable(a){this._propertyTrackDataItem.SetEnable(a)}GetInterpolationMode(){return this._propertyTrackDataItem.GetInterpolationMode()}SetInterpolationMode(a){this._propertyTrackDataItem.SetInterpolationMode(a)}GetResultMode(){return this._propertyTrackDataItem.GetResultMode()}SetResultMode(a){this._propertyTrackDataItem.SetResultMode(a)}SetEase(a){for(const b of this.GetPropertyKeyframeDataItems())b.SetEase(a)}GetPropertyKeyframeDataItems(){return this._propertyKeyframeDataItems?
  this._propertyKeyframeDataItems:this._propertyKeyframeDataItems=this._propertyTrackDataItem.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray()}*GetPropertyKeyframeValues(){for(const a of this.GetPropertyKeyframeDataItems())yield a.GetValueWithResultMode()}CleanCaches(){this.GetSourceAdapter().CleanCaches()}GetCurrentState(){return this.GetSourceAdapter().GetCurrentState()}SetInitialState(){this.GetSourceAdapter().SetInitialState()}SetResumeState(){this.GetSourceAdapter().SetResumeState()}BeforeInterpolate(){this.GetSourceAdapter().BeforeInterpolate()}Interpolate(a,
  b=!1,e=!1,c=!1){var f=this._propertyTrackDataItem;let g=this._propertyTrackData.GetPropertyKeyFrameDataItemAtTime(a,f);g?f=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherThan(a,f):(g=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(a,f),f=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(a,f));return this.GetSourceAdapter().Interpolate(a,g,f,b,e,c)}AfterInterpolate(){this.GetSourceAdapter().AfterInterpolate()}static GetStartPropertyKeyframeForTime(a,
  b){const e=b.GetPropertyTrackDataItem();b=b._propertyTrackData;let c=b.GetPropertyKeyFrameDataItemAtTime(a,e);c||(c=b.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(a,e));return c}static GetEndPropertyKeyframeForTime(a,b){const e=b.GetPropertyTrackDataItem();b=b._propertyTrackData;return b.GetPropertyKeyFrameDataItemAtTime(a,e)?b.GetFirstPropertyKeyFrameDataItemHigherThan(a,e):b.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(a,e)}AddPropertyKeyframe(){return this._propertyTrackDataItem.GetPropertyKeyframeData().AddEmptyPropertyKeyframeDataItem()}DeletePropertyKeyframes(a){this._propertyTrackDataItem.GetPropertyKeyframeData().DeletePropertyKeyframeDataItems(a)}SaveState(){this.GetSourceAdapter().SaveState()}CompareInitialStateWithCurrent(){if(this.GetSourceAdapter().CompareInitialStateWithCurrent()){const a=
  this._propertyTrackData.GetFirstPropertyKeyframeDataItem(this._propertyTrackDataItem),b=this.GetSourceAdapter().GetCurrentState();a.SetAbsoluteValue(b)}}CompareSaveStateWithCurrent(){const a=this.GetSourceAdapter().CompareSaveStateWithCurrent();a&&this.AddPropertyKeyframeAtCurrentTime();this.GetSourceAdapter().ClearSaveState();return a}AddPropertyKeyframeAtCurrentTime(){const a=this.GetTimeline().GetTime(),b=this.GetSourceAdapter(),e=d.PropertyTrackState.GetStartPropertyKeyframeForTime(a,this),c=
  this.AddPropertyKeyframe();c.SetType(e.GetType());c.SetTime(a);c.SetEase(e.GetEase());c.SetEnable(!0);c.SetValue(b.GetValueAtTime());c.SetAbsoluteValue(b.GetCurrentState())}_SaveToJson(){return{sourceAdapterJson:this.GetSourceAdapter()._SaveToJson()}}_LoadFromJson(a){a&&this.GetSourceAdapter()._LoadFromJson(a.sourceAdapterJson)}}};
  
  
  // c3/timelines/state/propertySourceAdapters/propertySourceAdapter.js
  'use strict';{const b=self.C3.PropertyTrackState;b.PropertySourceAdapter=class{constructor(a){this._propertyTrack=a;this._propertyAdapter=null}Release(){this._propertyAdapter&&(this._propertyAdapter.Release(),this._propertyAdapter=null);this._propertyTrack=null}GetPropertyTrack(){return this._propertyTrack}CleanCaches(){this._propertyAdapter&&this._propertyAdapter.CleanCaches()}GetPropertyAdapter(){return this._propertyAdapter?this._propertyAdapter:this._propertyAdapter=this._CreatePropertyAdapter()}GetEditorIndex(){}GetIndex(){return this.GetEditorIndex()}GetTarget(){}SetInitialState(){this.GetPropertyAdapter().SetInitialState()}SetResumeState(){this.GetPropertyAdapter().SetResumeState()}BeforeInterpolate(){this.GetPropertyAdapter().BeforeChangeProperty()}Interpolate(a,
  c,d,e,g,h){const f=b.PropertySourceAdapter.GetInterpolateFunc(this._propertyTrack)(a,c,d,this._propertyTrack);return g?f:this.GetPropertyAdapter().ChangeProperty(a,f,c,d,e,h)}AfterInterpolate(){this.GetPropertyAdapter().AfterChangeProperty()}SaveState(){this.GetPropertyAdapter().SetSaveState()}ClearSaveState(){this.GetPropertyAdapter().ClearSaveState()}GetCurrentState(){return this.GetPropertyAdapter().GetCurrentState()}CompareInitialStateWithCurrent(){return this.GetPropertyAdapter().CompareInitialStateWithCurrent()}CompareSaveStateWithCurrent(){return this.GetPropertyAdapter().CompareSaveStateWithCurrent()}GetValueAtTime(){return b.PropertySourceAdapter.GetValueAtTime(this._propertyTrack)}_CreatePropertyAdapter(){const a=
  this._propertyTrack.GetPropertyType();switch(this._propertyTrack.GetPropertyKeyframeType()){case "combo":case "boolean":case "text":case "string":return new b.PropertyInterpolationAdapter.NoInterpolationAdapter(this);case "numeric":case "number":case "angle":return"combo"===a?new b.PropertyInterpolationAdapter.NoInterpolationAdapter(this):new b.PropertyInterpolationAdapter.NumericInterpolationAdapter(this);case "color":case "offsetColor":return new b.PropertyInterpolationAdapter.ColorInterpolationAdapter(this)}}_SaveToJson(){return{propertyAdapterJson:this.GetPropertyAdapter()._SaveToJson()}}_LoadFromJson(a){a&&
  this.GetPropertyAdapter()._LoadFromJson(a.propertyAdapterJson)}static GetValueAtTime(a){const c=a.GetTrack().GetTimeline().GetTime(),d=b.GetStartPropertyKeyframeForTime(c,a),e=b.GetEndPropertyKeyframeForTime(c,a);return b.PropertySourceAdapter.GetInterpolateFunc(a)(c,d,e,a)}static GetValue(a,c,d){let e=a.GetResultMode();"combo"===a.GetPropertyType()&&(e="absolute");switch(e){case "relative":return c+d;case "absolute":return d}}static GetInterpolateFunc(a){switch(a.GetPropertyKeyframeType()){case "numeric":return b.NumericTypeAdapter.Interpolate;
  case "angle":return b.AngleTypeAdapter.Interpolate;case "boolean":return b.BooleanTypeAdapter.Interpolate;case "color":return b.ColorTypeAdapter.Interpolate;case "text":return b.TextTypeAdapter.Interpolate}}static GetWillChangeFunc(a){switch(a.GetPropertyKeyframeType()){case "numeric":return b.NumericTypeAdapter.WillChange;case "angle":return b.AngleTypeAdapter.WillChange;case "boolean":return b.BooleanTypeAdapter.WillChange;case "color":return b.ColorTypeAdapter.WillChange;case "text":return b.TextTypeAdapter.WillChange}}}};
  
  
  // c3/timelines/state/propertySourceAdapters/worldInstanceSourceAdapter.js
  'use strict';{const a=self.C3;class b extends a.PropertyTrackState.PropertySourceAdapter{constructor(c){super(c)}}a.PropertyTrackState.WorldInstanceSourceAdapter=b};
  
  
  // c3/timelines/state/propertySourceAdapters/instanceVariableSourceAdapter.js
  'use strict';{const b=self.C3;class d extends b.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a);this._updatedIndex=NaN}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]}GetIndex(){return this._updatedIndex?this._updatedIndex:super.GetIndex()}GetTarget(){return this._propertyTrack.GetTrack().GetInstance()}UpdateInstanceVariableIndex(a){this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]!==a&&(this._updatedIndex=
  a)}Interpolate(a,c,e,f,g,h){if(this.GetPropertyAdapter().CanChange(c.GetValue()))return super.Interpolate(a,c,e,f,g,h)}_SaveToJson(){return Object.assign(super._SaveToJson(),{index:this._updatedIndex})}_LoadFromJson(a){a&&(super._LoadFromJson(a),this._updatedIndex=a.index)}}b.PropertyTrackState.InstanceVariableSourceAdapter=d};
  
  
  // c3/timelines/state/propertySourceAdapters/behaviorSourceAdapter.js
  'use strict';{const c=self.C3;class d extends c.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a);this._sid=NaN}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[1]}GetTarget(){var a=this._propertyTrack.GetPropertyTrackDataItem(),b=this._propertyTrack.GetTrack();a=this._sid?this._sid:a.GetSourceAdapterArguments()[0];b=b.GetInstance();a=b.GetBehaviorIndexBySID(a);return b.GetBehaviorInstances()[a].GetSdkInstance()}GetBehaviorType(a){const b=
  this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[2];return a.GetBehaviorTypeByName(b)}UpdateBehaviorTypeSid(a){this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]!==a&&(this._sid=a)}Interpolate(a,b,e,f,g,h){const k=this._propertyTrack.GetTrack().GetInstance();if(this.GetBehaviorType(k.GetObjectClass()))return super.Interpolate(a,b,e,f,g,h)}_SaveToJson(){return Object.assign(super._SaveToJson(),{sid:this._sid})}_LoadFromJson(a){a&&(super._LoadFromJson(a),
  this._sid=a.sid)}}c.PropertyTrackState.BehaviorSourceAdapter=d};
  
  
  // c3/timelines/state/propertySourceAdapters/effectSourceAdapter.js
  'use strict';{const c=self.C3;class d extends c.PropertyTrackState.PropertySourceAdapter{constructor(b){super(b)}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[1]}GetTarget(){const b=this._propertyTrack.GetTrack().GetWorldInfo().GetInstanceEffectList();var a=b.GetEffectList();a=this.GetEffectType(a).GetIndex();return b.IsEffectIndexActive(a)?b.GetEffectParametersForIndex(a):null}GetEffectType(b){const a=this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0];
  return b.GetEffectTypeByName(a)}Interpolate(b,a,e,f,g,h){if(this._IsEffectActive())return super.Interpolate(b,a,e,f,g,h)}_IsEffectActive(){const b=this._propertyTrack.GetTrack().GetWorldInfo().GetInstanceEffectList();var a=b.GetEffectList();if(a=this.GetEffectType(a))return a=a.GetIndex(),b.IsEffectIndexActive(a)}}c.PropertyTrackState.EffectSourceAdapter=d};
  
  
  // c3/timelines/state/propertySourceAdapters/pluginSourceAdapter.js
  'use strict';{const c=self.C3;class d extends c.PropertyTrackState.PropertySourceAdapter{constructor(b){super(b)}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]}GetTarget(){return this._propertyTrack.GetTrack().GetInstance().GetSdkInstance()}Interpolate(b,e,f,g,h,k){var a=this._propertyTrack.GetTrack();const l=a.GetObjectClass().GetPlugin();a=a.GetInstance().GetObjectClass().GetPlugin();if(l===a)return super.Interpolate(b,e,f,g,h,k)}}c.PropertyTrackState.PluginSourceAdapter=
  d};
  
  
  // c3/timelines/state/propertySourceAdapters/valueSourceAdapter.js
  'use strict';{const c=self.C3;class e extends c.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a);this._value=0;this._init=!1}SetInitialState(){const a=this._propertyTrack.GetPropertyTrackData();let b=this._propertyTrack.GetPropertyTrackDataItem();b=a.GetFirstPropertyKeyframeDataItem(b);this._value=b.GetValueWithResultMode()}SetResumeState(){}GetValue(){this._init||this._propertyTrack.Interpolate(0);return this._value}Interpolate(a,b,f,d,g,h){d=c.PropertyTrackState.NumericTypeAdapter.Interpolate;
  this._value=d(a,b,f,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)}}c.PropertyTrackState.ValueSourceAdapter=e};
  
  
  // c3/timelines/state/propertyInterpolationAdapters/propertyInterpolationAdapter.js
  'use strict';self.C3.PropertyTrackState.PropertyInterpolationAdapter=class{constructor(a){this._sourceAdapter=a;this._propertyTrack=a.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(a){this._firstAbsoluteUpdate=!!a}GetFirstAbsoluteUpdate(){return this._firstAbsoluteUpdate}SetInitialState(){}SetResumeState(){}SetSaveState(){this._saveState=this.GetCurrentState()}ClearSaveState(){this._saveState=null}GetCurrentState(){}CompareInitialStateWithCurrent(){}CompareSaveStateWithCurrent(){}CanChange(a){return typeof this._Getter()===typeof a}BeforeChangeProperty(){}ChangeProperty(a,b,
  c,d,e){}AfterChangeProperty(){}_FirstKeyframeGetter(){return this._PickTimelinePlaybackMode(()=>{const a=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetFirstPropertyKeyframeDataItem(a)},()=>{const a=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(a)}).GetAbsoluteValue()}_CurrentKeyframeGetter(){const a=this._propertyTrack.GetTimeline().GetTime()-this._propertyTrack.GetTrack().GetStartOffset();
  return this._PickTimelinePlaybackMode(()=>{const b=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(a,b)},()=>{const b=this._propertyTrack.GetPropertyTrackDataItem(),c=this._propertyTrack.GetPropertyTrackData(),d=c.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(a,b);return d?d:c.GetLastPropertyKeyframeDataItem(b)}).GetAbsoluteValue()}_PickTimelinePlaybackMode(a,b){return this._propertyTrack.GetTimeline().IsForwardPlayBack()?
  a():b()}_PickResultMode(a,b){return"relative"===this._propertyTrack.GetResultMode()?a():b()}_PickFirstAbsoluteUpdate(a,b){return this.GetFirstAbsoluteUpdate()?(this.SetFirstAbsoluteUpdate(!1),a()):b()}_GetAbsoluteInitialValue(a){}_GetIndex(){return this._sourceAdapter.GetIndex()}_GetTarget(){return this._target?this._target:this._target=this._sourceAdapter.GetTarget()}_PickSource(a,b,c,d,e){switch(this._propertyTrack.GetSourceAdapterId()){case "behavior":return a();case "effect":return b();case "instance-variable":return c();
  case "plugin":return d();case "world-instance":return e()}}_SaveToJson(){return{firstAbsoluteUpdate:this._firstAbsoluteUpdate,saveState:this._saveState}}_LoadFromJson(a){a&&(this._firstAbsoluteUpdate=a.firstAbsoluteUpdate,this._saveState=a.saveState)}_GetPropertyKeyframeStubs(a,b=!1){const c=[];for(const d of a){a=d.GetTrack().GetStartOffset();for(const e of d.GetPropertyKeyframeDataItems())b&&0===e.GetTime()?c.push({time:a+e.GetTime(),value:e.GetAbsoluteValue()}):b||c.push({time:a+e.GetTime(),value:e.GetAbsoluteValue()})}return c.sort((a,
  b)=>a.time-b.time)}_GetLastPropertyKeyframeStub(a,b,c){return this._GetPropertyKeyframeStubLowerThanPlayhead(b,c)}_GetPropertyKeyframeStubLowerThanPlayhead(a,b){for(let c=b.length-1;0<=c;c--)if(b[c].time<=a)return b[c];return null}};
  
  
  // c3/timelines/state/propertyInterpolationAdapters/colorInterpolationAdapter.js
  'use strict';{const g=self.C3,k=new Map,h=[0,0,0];class l extends g.PropertyTrackState.PropertyInterpolationAdapter{constructor(a){super(a)}SetInitialState(){}SetResumeState(){}GetCurrentState(){const a=this._propertyTrack.GetSourceAdapterId(),b=this._GetTarget(),c=this._GetIndex();switch(a){case "behavior":return this._ToColorArray(b.GetPropertyValueByIndex(c));case "effect":return this._ToColorArray(b[c]);case "plugin":return this._ToColorArray(b.GetPropertyValueByIndex(c));case "world-instance":return this._ToColorArray(this._Getter())}}CompareInitialStateWithCurrent(){const a=
  this._FirstKeyframeGetter();return!this._CompareColors(a,this._Getter())}CompareSaveStateWithCurrent(){return g.IsNullOrUndefined(this._saveState)?!1:!this._CompareColors(this._saveState,this._Getter())}_CompareColors(a,b){return a.equalsIgnoringAlpha(b)}_FirstKeyframeGetter(){const a=super._FirstKeyframeGetter();return this._GetColorFromArray(a)}_CurrentKeyframeGetter(){const a=super._CurrentKeyframeGetter();return this._GetColorFromArray(a)}_GetAbsoluteInitialValue(a){}_ToColorArray(a){return g.IsInstanceOf(a,
  g.Color)?a.toArray().slice(0,3):a.slice(0,3)}_GetColorFromArray(a){return g.IsInstanceOf(a,g.Color)?a:new g.Color(a[0],a[1],a[2],1)}CanChange(a){return!0}BeforeChangeProperty(){var a=this._propertyTrack.GetInstance();k.has(a)||k.set(a,new Map);a=k.get(a);const b=this._propertyTrack.GetSourceAdapterId();a.has(b)||a.set(b,new Map);a=a.get(b);a.has(this._property)||a.set(this._property,{used:!1,color:new g.Color(0,0,0,1)})}_GetTmpColor(a,b,c){a=k.get(a).get(b).get(c);a.used=!0;return a.color}ChangeProperty(a,
  b,c,f,e){e=this._propertyTrack.GetTimeline();f=this._propertyTrack.GetTrack();a=this._propertyTrack.GetInstance();var d=this._propertyTrack.GetSourceAdapter();c=this._propertyTrack.GetSourceAdapterId();d=e.GetSimilarPropertyTracks(a,d,this._property);if(1<d.length){if(d=this._GetPropertyKeyframeStubs(d,!0),e=this._GetLastPropertyKeyframeStub(e,e.GetTime(),d))if(f=f.GetStartOffset(),d=e.time-f,0===d)this._GetTmpColor(a,c,this._property).addRgb(b[0],b[1],b[2]);else{if(0>d)return;e=b[0];f=b[1];b=b[2];
  d=this._propertyTrack.Interpolate(d,!1,!0);e=g.Color.DiffChannel(e,d[0]);f=g.Color.DiffChannel(f,d[1]);b=g.Color.DiffChannel(b,d[2]);this._GetTmpColor(a,c,this._property).addRgb(e,f,b)}}else this._Setter(b[0],b[1],b[2]);return g.TimelineState.LAYOUT_RENDER_CHANGE}AfterChangeProperty(){const a=this._propertyTrack.GetInstance();if(k.has(a)){var b=k.get(a),c=this._propertyTrack.GetSourceAdapterId();if(b.has(c)){var f=b.get(c);if(f.has(this._property)){var e=f.get(this._property),d=e.color;e.used&&this._Setter(d.getR(),
  d.getG(),d.getB());0===f.size&&b.delete(c);0===b.size&&k.delete(a)}}}}_Getter(){const a=this._propertyTrack.GetSourceAdapterId(),b=this._GetTarget(),c=this._GetIndex();switch(a){case "behavior":return this._GetColorFromArray(b.GetPropertyValueByIndex(c));case "effect":return b[c].clone();case "plugin":return this._GetColorFromArray(b.GetPropertyValueByIndex(c));case "world-instance":return this.GetWorldInfo().GetUnpremultipliedColor().clone()}}_Setter(a,b,c){const f=this._propertyTrack.GetSourceAdapterId(),
  e=this._GetTarget(),d=this._GetIndex();switch(f){case "behavior":h[0]=a;h[1]=b;h[2]=c;e.SetPropertyValueByIndex(d,h);break;case "effect":e[d].setRgb(a,b,c);break;case "plugin":h[0]=a;h[1]=b;h[2]=c;e.SetPropertyValueByIndex(d,h);break;case "world-instance":this.GetWorldInfo().SetUnpremultipliedColorRGB(a,b,c)}}_SaveToJson(){}_LoadFromJson(a){}}g.PropertyTrackState.PropertyInterpolationAdapter.ColorInterpolationAdapter=l};
  
  
  // c3/timelines/state/propertyInterpolationAdapters/noInterpolationAdapter.js
  'use strict';{const g=self.C3;class l extends g.PropertyTrackState.PropertyInterpolationAdapter{constructor(a){super(a)}SetInitialState(){}SetResumeState(){}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){return this._FirstKeyframeGetter()!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return g.IsNullOrUndefined(this._saveState)?!1:this._saveState!==this.GetCurrentState()}ChangeProperty(a,c,b,d,h){b=g.PropertyTrackState.PropertySourceAdapter.GetWillChangeFunc(this._propertyTrack);
  var e=this._propertyTrack;const k=e.GetTrack();d=e.GetSourceAdapterId();h=e.GetTimeline();var f=k.GetInstance();e=e.GetSourceAdapter();f=h.GetSimilarPropertyTracks(f,e,this._property);1<f.length&&(f=this._GetPropertyKeyframeStubs(f),a+=k.GetStartOffset(),a=this._GetLastPropertyKeyframeStub(h,a,f))&&(c=a.value);if(b(this._GetIndex(),this._GetTarget(),c,d))switch(this._Setter(c),d){case "plugin":return g.TimelineState.LAYOUT_RENDER_CHANGE}}_Getter(){const a=this._propertyTrack.GetSourceAdapterId(),
  c=this._GetTarget(),b=this._GetIndex();switch(a){case "behavior":return c.GetPropertyValueByIndex(b);case "effect":return c[b];case "instance-variable":return c.GetInstanceVariableValue(b);case "plugin":return c.GetPropertyValueByIndex(b)}}_Setter(a){const c=this._propertyTrack.GetSourceAdapterId(),b=this._GetTarget(),d=this._GetIndex();switch(c){case "behavior":b.SetPropertyValueByIndex(d,a);break;case "effect":b[d]=a;break;case "instance-variable":b.SetInstanceVariableValue(d,a);break;case "plugin":b.SetPropertyValueByIndex(d,
  a)}}}g.PropertyTrackState.PropertyInterpolationAdapter.NoInterpolationAdapter=l};
  
  
  // c3/timelines/state/propertyInterpolationAdapters/numericInterpolationAdapter.js
  'use strict';{const g=self.C3,l=new Map,f=(a,b,d,c,e)=>l.set(a,{setter:b,absolute_setter:d,getter:c,round:e});f("offsetX",(a,b)=>a.OffsetX(b),(a,b)=>a.SetX(b),a=>a.GetX(),!0);f("offsetY",(a,b)=>a.OffsetY(b),(a,b)=>a.SetY(b),a=>a.GetY(),!0);f("offsetWidth",(a,b)=>a.OffsetWidth(b),(a,b)=>a.SetWidth(b),a=>a.GetWidth(),!0);f("offsetHeight",(a,b)=>a.OffsetHeight(b),(a,b)=>a.SetHeight(b),a=>a.GetHeight(),!0);f("offsetAngle",(a,b)=>a.OffsetAngle(b),(a,b)=>a.SetAngle(b),a=>a.GetAngle(),!1);f("offsetOpacity",
  (a,b)=>a.OffsetOpacity(b),(a,b)=>a.SetOpacity(b),a=>a.GetOpacity(),!1);f("offsetOriginX",(a,b)=>a.OffsetOriginX(b),(a,b)=>a.SetOriginX(b),a=>a.GetOriginX(),!1);f("offsetOriginY",(a,b)=>a.OffsetOriginY(b),(a,b)=>a.SetOriginY(b),a=>a.GetOriginY(),!1);f("offsetZElevation",(a,b)=>a.OffsetZElevation(b),(a,b)=>a.SetZElevation(b),a=>a.GetZElevation(),!0);f("offsetScaleX",(a,b,d)=>{a.OffsetWidth(d.GetOriginalWidth()*b)},(a,b,d)=>{a.SetWidth(d.GetOriginalWidth()*b)},(a,b)=>a.GetWidth()/b.GetOriginalWidth(),
  !1);f("offsetScaleY",(a,b,d)=>{a.OffsetHeight(d.GetOriginalHeight()*b)},(a,b,d)=>{a.SetHeight(d.GetOriginalHeight()*b)},(a,b)=>a.GetHeight()/b.GetOriginalHeight(),!1);class m extends g.PropertyTrackState.PropertyInterpolationAdapter{constructor(a){super(a);this._lastValue=0;this._instance_absolute_setter=this._instance_setter=this._instance_getter=null;this._round=!1;g.IsInstanceOf(this._propertyTrack.GetTimeline(),g.Tween)?this._typeAdapter=new g.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTween(this):
  this._typeAdapter=new g.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTimeline(this);a=this._propertyTrack.GetPropertyName();"world-instance"===this._propertyTrack.GetSourceAdapterId()&&(a=l.get(a),this._instance_getter=a.getter,this._instance_setter=a.setter,this._instance_absolute_setter=a.absolute_setter,this._round=a.round)}Release(){this._instance_absolute_setter=this._instance_setter=this._instance_getter=this._typeAdapter=null;super.Release()}GetLastValue(){return this._lastValue}SetLastValue(a){this._lastValue=
  a}SetInitialState(){const a=this._typeAdapter.SetInitialState();"number"===typeof a&&(this._lastValue=a)}SetResumeState(){const a=this._typeAdapter.SetResumeState();"number"===typeof a&&(this._lastValue=a)}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){return this._FirstKeyframeGetter()!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return g.IsNullOrUndefined(this._saveState)?!1:this._saveState!==this.GetCurrentState()}BeforeChangeProperty(){this._typeAdapter.BeforeChangeProperty()}ChangeProperty(a,
  b,d,c,e,h){return this._typeAdapter.ChangeProperty(a,b,d,c,e,h)}AfterChangeProperty(){this._typeAdapter.AfterChangeProperty()}_Getter(){const a=this._GetTarget(),b=this._GetIndex(),d=this._propertyTrack.GetTrack(),c=this.GetWorldInfo();return this._PickSource(()=>a.GetPropertyValueByIndex(b),()=>a[b],()=>a.GetInstanceVariableValue(b),()=>a.GetPropertyValueByIndex(b),()=>this._instance_getter(c,d))}_Setter(a,b,d){const c=this._GetTarget(),e=this._GetIndex(),h=this._propertyTrack.GetTrack(),k=this.GetWorldInfo();
  this._PickSource(()=>c.OffsetPropertyValueByIndex(e,a),()=>c[e]+=a,()=>c.SetInstanceVariableOffset(e,a),()=>c.OffsetPropertyValueByIndex(e,a),()=>this._instance_setter(k,a,h))}_SetterAbsolute(a,b,d){const c=this._GetTarget(),e=this._GetIndex(),h=this._propertyTrack.GetTrack(),k=this.GetWorldInfo();this._PickSource(()=>c.SetPropertyValueByIndex(e,a),()=>c[e]=a,()=>c.SetInstanceVariableValue(e,a),()=>c.SetPropertyValueByIndex(e,a),()=>this._instance_absolute_setter(k,a,h))}_MaybeEnsureValue(a,b,d,c,
  e,h){this._typeAdapter._MaybeEnsureValue(a,b,d,c,e,h)}_AddDelta(a,b,d){var c=(a.toString().split(".")[1]||"").length;a=this._Getter();c=0===c?this._round?Math.round(a):a:g.toFixed(a,c);this._Setter(c-a,b,d)}_SaveToJson(){return Object.assign(super._SaveToJson(),{v:this._lastValue})}_LoadFromJson(a){a&&(super._LoadFromJson(a),this._lastValue=a.v)}}g.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapter=m};
  
  
  // c3/timelines/state/propertyInterpolationAdapters/numericInterpolationAdapterForTimeline.js
  'use strict';{const k=self.C3,h=new Map;class n{constructor(a){this._numericInterpolationAdapter=a}Release(){this._numericInterpolationAdapter=null}SetInitialState(){const a=this._numericInterpolationAdapter,c=this._numericInterpolationAdapter.GetPropertyTrack();return a._PickResultMode(()=>a._PickTimelinePlaybackMode(()=>0,()=>k.PropertyTrackState.PropertySourceAdapter.GetValueAtTime(c)),()=>{})}SetResumeState(){}BeforeChangeProperty(){const a=this._numericInterpolationAdapter,c=this._numericInterpolationAdapter.GetPropertyTrack(),
  b=c.GetPropertyName();a._PickResultMode(()=>{},()=>{var a=c.GetInstance();h.has(a)||h.set(a,new Map);a=h.get(a);const e=c.GetSourceAdapterId();a.has(e)||a.set(e,new Map);a=a.get(e);a.has(b)||a.set(b,{used:!1,value:0})})}_GetTmpAbsoluteValueObject(a,c,b){a=h.get(a).get(c).get(b);a.used=!0;return a}ChangeProperty(a,c,b,f,e,l){const d=this._numericInterpolationAdapter,g=this._numericInterpolationAdapter.GetPropertyTrack(),m=g.GetPropertyName();d._PickResultMode(()=>{const g=d.GetLastValue();d._Setter(c-
  g,b,f);l&&this._MaybeEnsureValue(a,b,f,e,g,c);d.SetLastValue(c)},()=>{var a=g.GetTimeline(),b=g.GetTrack();const e=g.GetInstance();var f=g.GetSourceAdapter();const h=g.GetSourceAdapterId();f=a.GetSimilarPropertyTracks(e,f,m);if(1<f.length){if(f=d._GetPropertyKeyframeStubs(f,!0),a=d._GetLastPropertyKeyframeStub(a,a.GetTime(),f))b=b.GetStartOffset(),b=a.time-b,0===b?this._GetTmpAbsoluteValueObject(e,h,m).value+=c:0>b||(b=g.Interpolate(b,!1,!0),this._GetTmpAbsoluteValueObject(e,h,m).value+=c-b)}else d._SetterAbsolute(c)});
  return d._PickSource(()=>{},()=>k.TimelineState.LAYOUT_RENDER_CHANGE,()=>{},()=>k.TimelineState.LAYOUT_RENDER_CHANGE,()=>k.TimelineState.LAYOUT_RENDER_CHANGE)}AfterChangeProperty(){const a=this._numericInterpolationAdapter,c=this._numericInterpolationAdapter.GetPropertyTrack(),b=c.GetPropertyName();a._PickResultMode(()=>{},()=>{const f=c.GetInstance();if(h.has(f)){var e=h.get(f),l=c.GetSourceAdapterId();if(e.has(l)){var d=e.get(l);if(d.has(b)){var g=d.get(b),k=g.value;g.used&&a._SetterAbsolute(k);
  d.delete(b);0===d.size&&e.delete(l);0===e.size&&h.delete(f)}}}})}_MaybeEnsureValue(a,c,b,f,e,l){const d=this._numericInterpolationAdapter;f||(c&&a===c.GetTime()?d._AddDelta(c.GetValueWithResultMode(),c,b):b&&a===b.GetTime()?d._AddDelta(b.GetValueWithResultMode(),c,b):0===l-e&&d._AddDelta(c.GetValueWithResultMode(),c,b))}}k.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTimeline=n};
  
  
  // c3/timelines/state/propertyInterpolationAdapters/numericInterpolationAdapterForTween.js
  'use strict';{const g=self.C3;new Map;class l{constructor(b){this._numericInterpolationAdapter=b}Release(){this._numericInterpolationAdapter=null}SetInitialState(){const b=this._numericInterpolationAdapter;b.SetFirstAbsoluteUpdate(!0);return this._GetAbsoluteInitialValue(b._FirstKeyframeGetter())}SetResumeState(){const b=this._numericInterpolationAdapter;if(b._FirstKeyframeGetter()!==b._CurrentKeyframeGetter())return b.SetFirstAbsoluteUpdate(!0),this._GetAbsoluteInitialValue(b._CurrentKeyframeGetter())}BeforeChangeProperty(){}ChangeProperty(b,
  a,c,e,h,k){const d=this._numericInterpolationAdapter,f=d.GetLastValue();d._PickResultMode(()=>{d._Setter(a-f,c,e);k&&this._MaybeEnsureValue(b,c,e,h,f,a)},()=>{d._PickFirstAbsoluteUpdate(()=>{d._Setter(f,c,e)},()=>{d._Setter(a-f,c,e);k&&this._MaybeEnsureValue(b,c,e,h,f,a)})});d.SetLastValue(a);return d._PickSource(()=>{},()=>g.TimelineState.LAYOUT_RENDER_CHANGE,()=>{},()=>g.TimelineState.LAYOUT_RENDER_CHANGE,()=>g.TimelineState.LAYOUT_RENDER_CHANGE)}AfterChangeProperty(){}_GetAbsoluteInitialValue(b){return b-
  this._numericInterpolationAdapter.GetCurrentState()}_MaybeEnsureValue(b,a,c,e,h,k){const d=this._numericInterpolationAdapter;e?a&&b===a.GetTime()?d._AddDelta(a.GetValueWithResultMode(),a,c):c&&b===c.GetTime()?d._AddDelta(c.GetValueWithResultMode(),a,c):c||d._AddDelta(a.GetValueWithResultMode(),a,c):a&&b===a.GetTime()?d._AddDelta(a.GetValueWithResultMode(),a,c):c&&b===c.GetTime()?d._AddDelta(c.GetValueWithResultMode(),a,c):0===k-h&&d._AddDelta(a.GetValueWithResultMode(),a,c)}}g.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTween=
  l};
  
  
  // c3/timelines/state/propertyTypeAdapters/numericTypeAdapter.js
  'use strict';{const l=self.C3,k=self.Ease;l.PropertyTrackState.NumericTypeAdapter=class{constructor(){}static WillChange(e,b,c,f){let a;switch(f){case "behavior":a=b.GetPropertyValueByIndex(e);break;case "effect":a=b[e];break;case "instance-variable":a=b.GetInstanceVariableValue(e);break;case "plugin":a=b.GetPropertyValueByIndex(e)}return a===c?!1:!0}static Interpolate(e,b,c,f){if(!c)return c=f.GetPropertyTrackDataItem(),c=f.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(c),c.GetValueWithResultMode();
  var a=f.GetInterpolationMode();"default"===a&&(a="continuous");"combo"===f.GetPropertyType()&&(a="discrete");if("discrete"===a)return b.GetValueWithResultMode();if("continuous"===a||"step"===a){"step"===a&&(a=f.GetTimeline().GetStep(),0!==a&&(a=1/a,e=Math.floor(e*a)/a));var d=b.GetTime();const g=c.GetTime();a=b.GetValueWithResultMode();const h=c.GetValueWithResultMode();if(a===h)return a;e=l.normalize(e,d,g);const m=b.GetEase();b=b.GetAddOn("cubic-bezier");c=c.GetAddOn("cubic-bezier");b&&b.GetStartEnable()&&
  c&&c.GetEndEnable()?(d=g-d,d=k.GetRuntimeEase(m)(d*e,0,1,d),d=k.GetRuntimeEase("cubicbezier")(d,a,a+b.GetStartAnchor(),h+c.GetEndAnchor(),h)):d=k.GetRuntimeEase(m)((g-d)*e,a,h-a,g-d);return"integer"===f.GetPropertyType()?Math.floor(d):d}}}};
  
  
  // c3/timelines/state/propertyTypeAdapters/angleTypeAdapter.js
  'use strict';{const f=self.C3;f.PropertyTrackState.AngleTypeAdapter=class{constructor(){}static WillChange(d,b,e,a){let c;switch(a){case "behavior":c=b.GetPropertyValueByIndex(d);break;case "effect":c=b[d];break;case "instance-variable":c=b.GetInstanceVariableValue(d);break;case "plugin":c=b.GetPropertyValueByIndex(d)}return c===e?!1:!0}static Interpolate(d,b,e,a){if(!e)return b=a.GetPropertyTrackDataItem(),b=a.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(b),b.GetValueWithResultMode();var c=
  a.GetInterpolationMode();"default"===c&&(c="continuous");"combo"===a.GetPropertyType()&&(c="discrete");if("discrete"===c)return b.GetValueWithResultMode();if("continuous"===c||"step"===c){"step"===c&&(a=a.GetTimeline().GetStep(),0!==a&&(a=1/a,d=Math.floor(d*a)/a));c=b.GetTime();const g=e.GetTime();a=b.GetValueWithResultMode();e=e.GetValueWithResultMode();if(a===e)return a;d=f.normalize(d,c,g);b=self.Ease.GetRuntimeEase(b.GetEase());return f.angleLerp(a,e,b(d,0,1,1))}}}};
  
  
  // c3/timelines/state/propertyTypeAdapters/booleanTypeAdapter.js
  'use strict';self.C3.PropertyTrackState.BooleanTypeAdapter=class{constructor(){}static WillChange(a,b,e,d){let c;switch(d){case "behavior":c=b.GetPropertyValueByIndex(a);break;case "effect":c=b[a];break;case "instance-variable":c=b.GetInstanceVariableValue(a);break;case "plugin":c=b.GetPropertyValueByIndex(a)}return!!c===!!e?!1:!0}static Interpolate(a,b,e,d){return e?b.GetValueWithResultMode()?1:0:(a=d.GetPropertyTrackDataItem(),a=d.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(a),a.GetValueWithResultMode()?
  1:0)}};
  
  
  // c3/timelines/state/propertyTypeAdapters/colorTypeAdapter.js
  'use strict';{const n=self.C3,c=[0,0,0],f=[0,0,0],g=[0,0,0];n.PropertyTrackState.ColorTypeAdapter=class{constructor(){}static WillChange(h,d,e,a){let b;switch(a){case "behavior":b=d.GetPropertyValueByIndex(h);break;case "effect":b=d[h];break;case "instance-variable":b=d.GetInstanceVariableValue(h);break;case "plugin":b=d.GetPropertyValueByIndex(h)}Array.isArray(e)?(c[0]=e[0],c[1]=e[1],c[2]=e[2]):(g.parseCommaSeparatedRgb(e),c[0]=Math.floor(255*g.getR()),c[1]=Math.floor(255*g.getG()),c[2]=Math.floor(255*
  g.getB()));Array.isArray(b)?(f[0]=b[0],f[1]=b[1],f[2]=b[2]):(g.parseCommaSeparatedRgb(b),f[0]=Math.floor(255*g.getR()),f[1]=Math.floor(255*g.getG()),f[2]=Math.floor(255*g.getB()));return c[0]!==f[0]||c[1]!==f[1]||c[2]!==f[2]?!0:!1}static Interpolate(h,d,e,a){if(!e){var b=a.GetPropertyTrackDataItem();b=a.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(b);a=b.GetValueWithResultMode();c[0]=a[0];c[1]=a[1];c[2]=a[2];return c}b=a.GetInterpolationMode();"default"===b&&(b="continuous");if("discrete"===
  b)return a=d.GetValueWithResultMode(),c[0]=a[0],c[1]=a[1],c[2]=a[2],c;if("continuous"===b||"step"===b){"step"===b&&(a=a.GetTimeline().GetStep(),0!==a&&(a=1/a,h=Math.floor(h*a)/a));a=d.GetTime();b=e.GetTime();var k=d.GetValueWithResultMode(),l=e.GetValueWithResultMode();h=n.normalize(h,a,b);var m=d.GetEase();d=k[0];e=k[1];k=k[2];const f=l[0],g=l[1];l=l[2];m=self.Ease.GetRuntimeEase(m);a=b-a;b=a*h;c[0]=d===f?d:m(b,d,f-d,a);c[1]=e===g?e:m(b,e,g-e,a);c[2]=k===l?k:m(b,k,l-k,a);return c}}}};
  
  
  // c3/timelines/state/propertyTypeAdapters/textTypeAdapter.js
  'use strict';self.C3.PropertyTrackState.TextTypeAdapter=class{constructor(){}static WillChange(a,b,e,d){let c;switch(d){case "behavior":c=b.GetPropertyValueByIndex(a);break;case "effect":c=b[a];break;case "instance-variable":c=b.GetInstanceVariableValue(a);break;case "plugin":c=b.GetPropertyValueByIndex(a)}return c===e?!1:!0}static Interpolate(a,b,e,d){return e?b.GetValueWithResultMode():(a=d.GetPropertyTrackDataItem(),a=d.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(a),a.GetValueWithResultMode())}};
  
  
  // c3/timelines/data/timelineDataManager.js
  'use strict';{const g=self.C3;g.TimelineDataManager=class{constructor(){this._timelineDataItems=new Map}Release(){for(const a of this._timelineDataItems.values())a.Release();this._timelineDataItems.clear();this._timelineDataItems=null}Add(a){a=new g.TimelineDataItem(a);const b=a.GetName();this._timelineDataItems.set(b,a)}Get(a){return this._timelineDataItems.get(a)}GetNameId(){return 0}static _CreateDataItems(a,b,e,c){if(b)for(const f of b)g.TimelineDataManager._CreateDataItem("create",f,a,e,c)}static _LoadDataItemsFromJson(a,
  b,e,c){a.length?b.forEach((c,b)=>{a[b]._LoadFromJson(c)}):b.forEach(b=>{g.TimelineDataManager._CreateDataItem("load",b,a,e,c)})}static _CreateDataItem(a,b,e,c,f){let d;if("function"===typeof c)switch(a){case "load":d=new c(null,f);break;case "create":d=new c(b,f)}else if("object"===typeof c)switch(c=c.map.get(b[c.prop]),a){case "load":d=new c(null,f);break;case "create":d=new c(b,f)}switch(a){case "load":d._LoadFromJson(b);e.push(d);break;case "create":if("function"===typeof d.GetEnable&&!d.GetEnable())return d.Release();
  e.push(d)}}}};
  
  
  // c3/timelines/data/timelineData.js
  'use strict';{const b=self.C3;b.TimelineDataItem=class{constructor(a){this._name="";this._totalTime=NaN;this._step=0;this._resultMode=this._interpolationMode="default";this._pingPong=this._loop=!1;this._repeatCount=1;this._trackData=null;a&&(this._name=a[0],this._totalTime=a[1],this._step=a[2],this._interpolationMode=a[3],this._resultMode=a[4],this._loop=!!a[6],this._pingPong=!!a[7],this._repeatCount=a[8],this._trackData=new b.TrackData(a[5],this))}Release(){this._trackData.Release();this._trackData=
  null}GetTrackData(){this._trackData||(this._trackData=new b.TrackData(null,this));return this._trackData}GetName(){return this._name}SetName(a){this._name=a}GetTotalTime(){return this._totalTime}SetTotalTime(a){this._totalTime=a}GetStep(){return this._step}SetStep(a){this._step=a}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(a){this._interpolationMode=a}GetResultMode(){return this._resultMode}SetResultMode(a){this._resultMode=a}GetLoop(){return this._loop}SetLoop(a){this._loop=
  a}GetPingPong(){return this._pingPong}SetPingPong(a){this._pingPong=a}GetRepeatCount(){return this._repeatCount}_SaveToJson(){return{trackDataJson:this._trackData._SaveToJson(),name:this._name,totalTime:this._totalTime,step:this._step,interpolationMode:this._interpolationMode,resultMode:this._resultMode,loop:this._loop,pingPong:this._pingPong,repeatCount:this._repeatCount}}_LoadFromJson(a){a&&(this.GetTrackData()._LoadFromJson(a.trackDataJson),this._name=a.name,this._totalTime=a.totalTime,this._step=
  a.step,this._interpolationMode=a.interpolationMode,this._resultMode=a.resultMode,this._loop=a.loop,this._pingPong=a.pingPong,this._repeatCount=a.repeatCount)}}};
  
  
  // c3/timelines/data/trackData.js
  'use strict';{const d=self.C3;class e{constructor(a,b){this._trackData=b;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();a&&(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]),this._keyframeData=new d.KeyframeData(a[4],this),this._propertyTrackData=new d.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 d.KeyframeData(null,this));return this._keyframeData}GetPropertyTrackData(){this._propertyTrackData||(this._propertyTrackData=new d.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}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}_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}}_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._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))}}d.TrackData=class{constructor(a,b){this._timelineDataItem=b;this._trackDataItems=[];this._keyframeTimeMap=new Map;d.TimelineDataManager._CreateDataItems(this._trackDataItems,a,e,this)}Release(){this._timelineDataItem=
  null;for(const a of this._trackDataItems)a.Release();d.clearArray(this._trackDataItems);this._trackDataItems=null;this._keyframeTimeMap.clear();this._keyframeTimeMap=null}GetTimelineDataItem(){return this._timelineDataItem}AddEmptyTrackDataItem(){const a=new e(null,this);this._trackDataItems.push(a);return a}GetFirstKeyframeDataItem(a){return a.GetKeyframeData().GetKeyframeDataItemArray()[0]}GetLastKeyframeDataItem(a){a=a.GetKeyframeData().GetKeyframeDataItemArray();return a[a.length-1]}GetKeyFrameDataItemAtTime(a,
  b){const c=this._keyframeTimeMap.get(b);if(c&&c.has(a))return c.get(a);for(const d of b.GetKeyframeData().keyframeDataItems())if(d.GetTime()===a)return c||this._keyframeTimeMap.set(b,new Map),this._keyframeTimeMap.get(b).set(a,d),d}GetFirstKeyFrameDataItemHigherThan(a,b){for(const c of b.GetKeyframeData().keyframeDataItems())if(c.GetTime()>a)return c}GetFirstKeyFrameDataItemHigherOrEqualThan(a,b){for(const c of b.GetKeyframeData().keyframeDataItems())if(c.GetTime()>=a)return c}GetFirstKeyFrameDataItemLowerOrEqualThan(a,
  b){for(const c of b.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&&d.TimelineDataManager._LoadDataItemsFromJson(this._trackDataItems,a.trackDataItemsJson,e,this)}}};
  
  
  // c3/timelines/data/propertyTrackData.js
  'use strict';{const d=self.C3;class e{constructor(a,b){this._propertyTrackData=b;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 d.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 d.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))}}d.PropertyTrackData=class{constructor(a,b){this._trackDataItem=b;this._propertyTrackDataItems=[];this._propertyKeyframeTimeMap=new Map;d.TimelineDataManager._CreateDataItems(this._propertyTrackDataItems,a,e,this)}Release(){this._trackDataItem=null;for(const a of this._propertyTrackDataItems)a.Release();
  d.clearArray(this._propertyTrackDataItems);this._propertyTrackDataItems=null;this._propertyKeyframeTimeMap.clear();this._propertyKeyframeTimeMap=null}GetTrackDataItem(){return this._trackDataItem}AddEmptyPropertyTrackDataItem(){const a=new e(null,this);this._propertyTrackDataItems.push(a);return a}GetFirstPropertyKeyframeDataItem(a){return a.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray()[0]}GetLastPropertyKeyframeDataItem(a){a=a.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();
  return a[a.length-1]}GetPropertyKeyFrameDataItemAtTime(a,b){const c=this._propertyKeyframeTimeMap.get(b);if(c&&c.has(a))return c.get(a);const f=b.GetPropertyKeyframeData();for(const d of f.propertyKeyframeDataItems())if(d.GetTime()===a)return c||this._propertyKeyframeTimeMap.set(b,new Map),this._propertyKeyframeTimeMap.get(b).set(a,d),d}GetFirstPropertyKeyFrameDataItemHigherThan(a,b){b=b.GetPropertyKeyframeData();for(const c of b.propertyKeyframeDataItems())if(c.GetTime()>a)return c}GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(a,
  b){b=b.GetPropertyKeyframeData();for(const c of b.propertyKeyframeDataItems())if(c.GetTime()>=a)return c}GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(a,b){b=b.GetPropertyKeyframeData();for(const c of b.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&&d.TimelineDataManager._LoadDataItemsFromJson(this._propertyTrackDataItems,
  a.propertyTrackDataItemsJson,e,this)}}};
  
  
  // c3/timelines/data/keyframeData.js
  'use strict';{const c=self.C3;class d{constructor(a,b){this._keyframeData=b;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(a=>a.toLowerCase())))}Release(){this._keyframeData=null;c.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(a=>a.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(a=>a.toLowerCase())))}}c.KeyframeData=class{constructor(a,b){this._trackDataItem=b;this._keyframeDataItems=[];c.TimelineDataManager._CreateDataItems(this._keyframeDataItems,a,d,this)}Release(){this._trackDataItem=null;for(const a of this._keyframeDataItems)a.Release();c.clearArray(this._keyframeDataItems);this._keyframeDataItems=null}GetTrackDataItem(){return this._trackDataItem}GetKeyframeDataItemCount(){return this._keyframeDataItems.length}GetKeyframeDataItemArray(){return this._keyframeDataItems}AddEmptyKeyframeDataItem(){const a=
  new d(null,this);this._keyframeDataItems.push(a);return a}DeleteKeyframeDataItems(a){for(const b of this._keyframeDataItems){if(!a(b))continue;const c=this._keyframeDataItems.indexOf(b);-1!==c&&(b.Release(),this._keyframeDataItems.splice(c,1))}this.SortKeyframeDataItems()}SortKeyframeDataItems(){this._keyframeDataItems.sort((a,b)=>a.GetTime()-b.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&&c.TimelineDataManager._LoadDataItemsFromJson(this._keyframeDataItems,a.keyframeDataItemsJson,d,this)}}};
  
  
  // c3/timelines/data/propertyKeyframeData.js
  'use strict';{const b=self.C3;class d{constructor(a,c){this._propertyKeyframeData=c;this._aValue=this._value=null;this._type="";this._time=NaN;this._ease="noease";this._enable=!1;this._addonData=null;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 b.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&&b.IsFiniteNumber(a)?(this._value[0]=b.GetRValue(a),this._value[1]=b.GetGValue(a),this._value[2]=b.GetBValue(a)):this._value=a}GetAbsoluteValue(){return this._aValue}SetAbsoluteValue(a){"color"===this._type&&b.IsFiniteNumber(a)?(this._aValue[0]=b.GetRValue(a),this._aValue[1]=b.GetGValue(a),this._aValue[2]=b.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 b of this.GetAddonData().addonDataItems())if(b.GetId()===a)return b}_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)}}b.PropertyKeyframeData=class{constructor(a,c){this._propertyTrackDataItem=c;this._propertyKeyframeDataItems=[];b.TimelineDataManager._CreateDataItems(this._propertyKeyframeDataItems,a,d,this)}Release(){this._propertyTrackDataItem=null;for(const a of this._propertyKeyframeDataItems)a.Release();
  b.clearArray(this._propertyKeyframeDataItems);this._propertyKeyframeDataItems=null}AddEmptyPropertyKeyframeDataItem(){const a=new d(null,this);this._propertyKeyframeDataItems.push(a);return a}DeletePropertyKeyframeDataItems(a){for(const b of this._propertyKeyframeDataItems){if(!a(b))continue;const c=this._propertyKeyframeDataItems.indexOf(b);-1!==c&&(b.Release(),this._propertyKeyframeDataItems.splice(c,1))}this.SortPropertyKeyFrameDataItems()}SortPropertyKeyFrameDataItems(){this._propertyKeyframeDataItems.sort((a,
  b)=>a.GetTime()-b.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&&b.TimelineDataManager._LoadDataItemsFromJson(this._propertyKeyframeDataItems,a.propertyKeyframeDataItemsJson,d,this)}}};
  
  
  // c3/timelines/data/propertyKeyframeAddonData.js
  'use strict';{const c=self.C3;class e{constructor(a,b){this._addonData=b;this._id=a[0];this._data=a[1]}Release(){this._data=this._addonData=null}GetAddonData(){return this._addonData}GetId(){return this._id}_SaveToJson(){return{id:this._id,data:this._data}}_LoadFromJson(a){a&&(this._id=a.id,this._data=a.data)}}class d extends e{constructor(a,b){super(a,b);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(a){a&&(super._LoadFromJson(a),this._startAnchor=a.startAnchor,this._startEnable=!!a.startEnable,this._endAnchor=a.endAnchor,this._endEnable=!!a.endEnable)}}c.AddonData=class{constructor(a,b){this._propertyKeyframeDataItem=b;this._addonDataItems=[];c.TimelineDataManager._CreateDataItems(this._addonDataItems,a,{prop:0,map:new Map([["cubic-bezier",d]])},this)}Release(){this._propertyKeyframeDataItem=
  null;for(const a of this._addonDataItems)a.Release();c.clearArray(this._addonDataItems);this._addonDataItems=null}GetPropertyKeyframeDataItem(){return this._propertyKeyframeDataItem}*addonDataItems(){for(const a of this._addonDataItems)yield a}_SaveToJson(){return{addonDataItemsJson:this._addonDataItems.map(a=>a._SaveToJson())}}_LoadFromJson(a){a&&c.TimelineDataManager._LoadDataItemsFromJson(this._addonDataItems,a.addonDataItemsJson,{prop:"id",map:new Map([["cubic-bezier",d]])},this)}}};
  
  
  // c3/timelines/tweens/tween.js
  'use strict';{const f=self.C3;let g=0;f.Tween=class extends f.TimelineState{constructor(a,b){super(`tween-${g++}`,a,b);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 b=a.GetInstance();return a.IsInstanceValid()?b: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,b){for(const e of this._tracks)for(const c of e._propertyTracks){if(c.GetPropertyName()!==b)continue;var d=c.GetPropertyTrackData();
  const e=c.GetPropertyTrackDataItem();d=d.GetFirstPropertyKeyframeDataItem(e);d.SetValue(a);d.SetAbsoluteValue(a)}}_GetPropertyTrackState(a){for(const b of this._tracks)for(const d of b._propertyTracks)if(d.GetPropertyName()===a)return d}BeforeSetEndValues(a){for(const b of a)a=this._GetPropertyTrackState(b),this.SetStartValue(a.GetCurrentState(),b);this.IsForwardPlayBack()?(this.SetTotalTime(this.GetTotalTime()-this.GetTime()),this._SetTime(0)):(this.SetTotalTime(this.GetTime()),this._SetTime(this.GetTotalTime()));
  this.SetInitialStateFromSetTime()}SetEndValue(a,b){var d=this._GetPropertyTrackState(b);b=d.GetPropertyTrackData();d=d.GetPropertyTrackDataItem();b=b.GetLastPropertyKeyframeDataItem(d);b.SetTime(this.GetTotalTime());b.SetValue(a);b.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 a of this._tracks)a.CompareInitialStateWithCurrent();
  super.SetInitialState(a)}Stop(a=!1){super.Stop(a);if(!this.IsComplete())for(const a of this._tracks)a.SaveState()}Reset(a=!0,b=!1){this._DeleteIntermediateKeyframes();super.Reset(a,b)}_DeleteIntermediateKeyframes(){for(const a of this._tracks){const b=a=>{a=a.GetTime();const b=this.GetTotalTime();return 0!==a&&a!==b};a.DeleteKeyframes(b);a.DeletePropertyKeyframes(b)}}_OnBeforeChangeLayout(){if(this.IsReleased())return!0;if(this.GetInstance().GetObjectClass().IsGlobal())return!1;this._timelineManager.CompleteTimeline(this);
  this.ResetBeforeChangeLayout();return!0}MaybeTriggerKeyframeReachedConditions(){}Tick(a,b){a=this.GetInstance();a=this.GetRuntime().GetDt(a);super.Tick(a,1)}_SaveToJson(){const a=super._SaveToJson(),b=this.GetTimelineDataItem();return Object.assign(a,{tweenDataItemJson:b._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 b=a.runtime.GetTimelineManager(),d=new f.TimelineDataItem;if(a.json){d._LoadFromJson(a.json.tweenDataItemJson);var e=new f.Tween(d,b);e._LoadFromJson(a.json);return e}b=new f.Tween(d,b);f.IsArray(a.propertyTracksConfig)||(a.propertyTracksConfig=[a.propertyTracksConfig]);b.SetId(a.id);
  b.SetTags(a.tags);b.SetInitialValueMode(a.initialValueMode);b.SetDestroyInstanceOnComplete(a.releaseOnComplete);b.SetLoop(a.loop);b.SetPingPong(a.pingPong);b.SetTotalTime(a.time);b.SetStep(0);b.SetInterpolationMode("default");b.SetResultMode(a.propertyTracksConfig[0].resultMode);d=b.AddTrack();d.SetInstanceUID(a.instance.GetUID());d.SetInterpolationMode("default");d.SetResultMode(a.propertyTracksConfig[0].resultMode);d.SetEnable(!0);d.SetObjectClassIndex(a.instance.GetObjectClass().GetIndex());d.SetOriginalWidth(a.instance.GetWorldInfo().GetWidth());
  d.SetOriginalHeight(a.instance.GetWorldInfo().GetHeight());var c=d.AddKeyframe();c.SetTime(0);c.SetEase("noease");c.SetEnable(!0);c.SetTags("");c=d.AddKeyframe();c.SetTime(a.time);c.SetEase("noease");c.SetEnable(!0);c.SetTags("");for(e of a.propertyTracksConfig){c=d.AddPropertyTrack();c.SetSourceAdapterId(e.sourceId);c.SetSourceAdapterArgs(e.sourceArgs);c.SetPropertyName(e.property);c.SetPropertyType(e.type);c.SetMin(NaN);c.SetMax(NaN);c.SetInterpolationMode("default");c.SetResultMode(e.resultMode);
  c.SetEnable(!0);const b=c.AddPropertyKeyframe();b.SetType(e.valueType);b.SetTime(0);b.SetEase(e.ease);b.SetEnable(!0);b.SetValue(e.startValue);b.SetAbsoluteValue(e.startValue);c=c.AddPropertyKeyframe();c.SetType(e.valueType);c.SetTime(a.time);c.SetEase(e.ease);c.SetEnable(!0);c.SetValue(e.endValue);c.SetAbsoluteValue(e.endValue)}return b}}};
  
  
  // c3/timelines/transitions/transition.js
  'use strict';{const f=self.C3,g=self.Ease;f.Transition=class extends f.DefendedBase{constructor(a){super();this._name=a[0];this._transitionKeyframes=[];for(const b of a[1])a=f.TransitionKeyframe.Create(this,b),this._transitionKeyframes.push(a);this._precalculatedSamples=new Map;this._transitionKeyframeCache=new Map;this._PreCalcSamples();g.AddCustomEase(this._name,(a,d,c,e)=>this.Interpolate(a,d,c,e))}static Create(a){return f.New(f.Transition,a)}Release(){for(const a of this._transitionKeyframes)a.Release();
  f.clearArray(this._transitionKeyframes);this._transitionKeyframes=null;this._precalculatedSamples.clear();this._precalculatedSamples=null;this._transitionKeyframeCache.clear();this._transitionKeyframeCache=null}GetTransitionKeyFrameAt(a){const b=this._transitionKeyframeCache.get(a);if(b)return b;for(const b of this._transitionKeyframes)if(b.GetValueX()===a)return this._transitionKeyframeCache.set(a,b),b}GetFirstTransitionKeyFrameHigherThan(a){for(const b of this._transitionKeyframes)if(b.GetValueX()>
  a)return b}GetFirstTransitionKeyFrameHigherOrEqualThan(a){for(const b of this._transitionKeyframes)if(b.GetValueX()>=a)return b}GetFirstTransitionKeyFrameLowerOrEqualThan(a){for(let b=this._transitionKeyframes.length-1;0<=b;b--){const d=this._transitionKeyframes[b];if(d.GetValueX()<=a)return d}}Interpolate(a,b,d,c){var e=a/c;(a=this.GetTransitionKeyFrameAt(e))?c=this.GetFirstTransitionKeyFrameHigherThan(e):(a=this.GetFirstTransitionKeyFrameLowerOrEqualThan(e),c=this.GetFirstTransitionKeyFrameHigherOrEqualThan(e));
  var h=c.GetValueX()-a.GetValueX();e=f.mapToRange(e,a.GetValueX(),c.GetValueX(),0,h);h=a.GetValueX();const k=a.GetValueY(),l=a.GetValueX()+a.GetStartAnchorX(),m=a.GetValueY()+a.GetStartAnchorY(),n=c.GetValueX()+c.GetEndAnchorX(),p=c.GetValueY()+c.GetEndAnchorY(),q=c.GetValueX();c=c.GetValueY();c=g.GetRuntimeEase("spline")(e,h,k,l,m,n,p,q,c,this._precalculatedSamples.get(a));c+=a.GetValueY();return(1-c)*b+c*(b+d)}_PreCalcSamples(){this._precalculatedSamples.clear();for(let d=0;d<this._transitionKeyframes.length-
  1;d++){var a=this._transitionKeyframes[d];if(!a.GetStartEnable())continue;var b=this._transitionKeyframes[d+1];const c=a.GetValueX(),e=a.GetValueX()+a.GetStartAnchorX(),f=b.GetValueX()+b.GetEndAnchorX();b=b.GetValueX();this._precalculatedSamples.set(a,g.GetBezierSamples(c,e,f,b))}}}};
  
  
  // c3/timelines/transitions/transitionKeyframe.js
  'use strict';{const b=self.C3;b.TransitionKeyframe=class extends b.DefendedBase{constructor(c,a){super();this._transition=c;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(c,a){return b.New(b.TransitionKeyframe,c,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}}};
  
  
  // c3/timelines/transitions/transitionManager.js
  'use strict';{const b=self.C3;b.TransitionManager=class extends b.DefendedBase{constructor(a){super();this._runtime=a;this._transitions=[]}Release(){for(const a of this._transitions)a.Release();b.clearArray(this._transitions);this._transitions=null}Create(a){this._transitions.push(b.Transition.Create(a))}}};
  
  
  // c3/events/stacks/solStack.js
  'use strict';{const b=self.C3;b.SolStack=class extends b.DefendedBase{constructor(a){super();this._objectClass=a;this._stack=[];this._stack.push(b.New(b.Sol,this));this._index=0;this._current=this._stack[0]}Release(){for(const a of this._stack)a.Release();b.clearArray(this._stack);this._objectClass=this._current=null}GetObjectClass(){return this._objectClass}GetCurrentSol(){return this._current}Clear(){this.GetCurrentSol().Clear()}PushClean(){var a=this._stack,c=++this._index;c===a.length?(c=b.New(b.Sol,
  this),a.push(c),this._current=c):(a=a[c],a.Reset(),this._current=a)}PushCopy(){const a=this._stack,c=++this._index;c===a.length&&a.push(b.New(b.Sol,this));const d=a[c];d.Copy(a[c-1]);this._current=d}Pop(){this._current=this._stack[--this._index]}RemoveInstances(a){const c=this._stack;for(let b=0,e=c.length;b<e;++b)c[b].RemoveInstances(a)}}};
  
  
  // c3/events/stacks/sol.js
  'use strict';{const b=self.C3;b.Sol=class extends b.DefendedBase{constructor(a){super();this._stack=a;this._objectClass=this._stack.GetObjectClass();this._eventStack=this._objectClass.GetRuntime().GetEventStack();this._selectAll=!0;this._instances=[];this._elseInstances=[]}Release(){this.ClearArrays();this._eventStack=this._objectClass=this._stack=null}ClearArrays(){b.clearArray(this._instances);b.clearArray(this._elseInstances)}GetObjectClass(){return this._objectClass}IsSelectAll(){return this._selectAll}HasAnyInstances(){return this._selectAll?
  !!this._objectClass.GetInstanceCount():!!this._instances.length}GetInstances(){return this._selectAll?this._objectClass.GetInstances():this._instances}HasAnyElseInstances(){return!!this._elseInstances.length}GetElseInstances(){return this._elseInstances}GetExpressionInstances(){const a=this.GetInstances();return a.length?a:this._elseInstances}Reset(){this._selectAll=!0;b.clearArray(this._elseInstances)}Clear(){this._selectAll=!0}Copy(a){a.IsSelectAll()?this.Reset():(this._selectAll=!1,b.shallowAssignArray(this._instances,
  a._instances),b.clearArray(this._elseInstances))}_PushInstance(a){this._instances.push(a)}_PushElseInstance(a){this._elseInstances.push(a)}_SetSelectAll(a){this._selectAll=!!a}_GetOwnInstances(){return this._instances}_GetOwnElseInstances(){return this._elseInstances}SetSinglePicked(a){this._selectAll=!1;b.clearArray(this._instances);this._instances.push(a)}SetArrayPicked(a){this._selectAll=!1;b.shallowAssignArray(this._instances,a)}PickOne(a){a&&(this._eventStack.GetCurrentStackFrame().GetCurrentEvent().IsOrBlock()?
  (this.IsSelectAll()&&(b.clearArray(this._instances),b.shallowAssignArray(this._elseInstances,a.GetObjectClass().GetInstances()),this._selectAll=!1),a=this._elseInstances.indexOf(a),-1!==a&&(this._instances.push(this._elseInstances[a]),this._elseInstances.splice(a,1))):this.SetSinglePicked(a))}RemoveInstances(a){b.arrayRemoveAllInSet(this._instances,a);b.arrayRemoveAllInSet(this._elseInstances,a)}}};
  
  
  // c3/events/stacks/eventStack.js
  'use strict';{const b=self.C3;b.EventStack=class extends b.DefendedBase{constructor(a){super();this._eventSheetManager=a;this._runtime=this._eventSheetManager.GetRuntime();this._stack=[];this._stack.push(b.New(b.EventStackFrame,this,null));this._index=0;this._expFuncStack=[]}Release(){for(const a of this._stack)a.Release();b.clearArray(this._stack);b.clearArray(this._expFuncStack);this._runtime=this._eventSheetManager=null}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}GetCurrentStackFrame(){return this._stack[this._index]}Push(a){var c=
  this._stack;const d=++this._index;if(d===c.length)return a=b.New(b.EventStackFrame,this,a),c.push(a),a;c=c[d];c.Reset(a);return c}Pop(){--this._index}PushExpFunc(a){this._expFuncStack.push(a)}PopExpFunc(){this._expFuncStack.pop()}GetCurrentExpFuncStackFrame(){const a=this._expFuncStack;return 0===a.length?null:a[a.length-1]}}};
  
  
  // c3/events/stacks/eventStackFrame.js
  'use strict';{const c=self.C3;c.EventStackFrame=class extends c.DefendedBase{constructor(a,b){super();this._stack=a;this._runtime=this._stack.GetRuntime();this._currentEvent=b;this._actIndex=this._cndIndex=0;this._elseBranchRan=this._lastEventTrue=!1;this._expressionObjectClass=null;this._functionReturnValue=this._functionReturnType=0}Release(){this.Reset(null);this._runtime=this._stack=null}Reset(a){this._currentEvent=a;this._actIndex=this._cndIndex=0;this._elseBranchRan=this._lastEventTrue=!1}_Restore(a,
  b){this._currentEvent=a;this._cndIndex=0;this._actIndex=b}ResetQuick(){this._actIndex=this._cndIndex=0}GetCurrentEvent(){return this._currentEvent}SetCurrentEvent(a){this._currentEvent=a}GetConditionIndex(){return this._cndIndex}SetConditionIndex(a){this._cndIndex=a}GetActionIndex(){return this._actIndex}SetActionIndex(a){this._actIndex=a}SetLastEventTrue(a){this._lastEventTrue=!!a}GetLastEventTrue(){return this._lastEventTrue}SetElseBranchRan(a){this._elseBranchRan=!!a}GetElseBranchRan(){return this._elseBranchRan}SetExpressionObjectClass(a){this._expressionObjectClass=
  a}GetExpressionObjectClass(){return this._expressionObjectClass}InitCallFunctionExpression(a,b){this._functionReturnType=a;this._functionReturnValue=b}GetFunctionReturnType(){return this._functionReturnType}SetFunctionReturnValue(a){this._functionReturnValue=a}GetFunctionReturnValue(){return this._functionReturnValue}IsSolModifierAfterCnds(){const a=this._currentEvent;return a.IsSolWriterAfterCnds()?!0:this._cndIndex<a.GetConditionCount()-1?!!a.GetSolModifiers().length:!1}}};
  
  
  // c3/events/stacks/localVarStack.js
  'use strict';{const b=self.C3;b.LocalVarStack=class extends b.DefendedBase{constructor(a){super();this._eventSheetManager=a;this._runtime=this._eventSheetManager.GetRuntime();this._stack=[];this._index=-1;this._current=null;this._initialValues=[]}Release(){b.clearArray(this._stack);this._runtime=this._eventSheetManager=null}_SetInitialValues(a){this._initialValues=a;a=this._initialValues.slice(0);this._stack.push(a);this._index=0;this._current=a}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}GetCurrent(){return this._current}Push(){const a=
  ++this._index,c=this._stack;a===c.length?c.push(this._initialValues.slice(0)):b.shallowAssignArray(c[a],this._initialValues);this._current=c[a]}Pop(){this._current=this._stack[--this._index]}}};
  
  
  // c3/events/stacks/loopStack.js
  'use strict';{const a=self.C3;a.LoopStack=class extends a.DefendedBase{constructor(b){super();this._eventSheetManager=b;this._runtime=this._eventSheetManager.GetRuntime();this._stack=[];this._index=-1}Release(){a.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=
  a.New(a.Loop,this);this._stack.push(b);return b}b=this._stack[this._index];b.Reset();return b}Pop(){--this._index}FindByName(b){const d=this._stack;for(let a=this._index;0<=a;--a){const c=d[a];if(c.GetName()===b)return c}return null}_GetStack(){return this._stack.slice(0,this._index+1)}}};
  
  
  // c3/events/stacks/loop.js
  'use strict';{const b=self.C3;b.Loop=class extends b.DefendedBase{constructor(a){super();this._loopStack=a;this._name="";this._index=0;this._isStopped=!1;this._end=NaN}Reset(){this._name="";this._index=0;this._isStopped=!1;this._end=NaN}SetName(a){this._name=a}GetName(){return this._name}SetIndex(a){this._index=a}GetIndex(){return this._index}Stop(){this._isStopped=!0}IsStopped(){return this._isStopped}SetEnd(a){this._end=a}GetEnd(){return this._end}}};
  
  
  // c3/events/stacks/arrayStack.js
  'use strict';{const a=self.C3;a.ArrayStack=class extends a.DefendedBase{constructor(){super();this._stack=[];this._index=-1}Release(){a.clearArray(this._stack)}GetCurrent(){return this._stack[this._index]}Push(){++this._index;if(this._index===this._stack.length){const a=[];this._stack.push(a);return a}return this._stack[this._index]}Pop(){--this._index}}};
  
  
  // c3/events/eventSheetManager.js
  'use strict';{var IsSolArrayIdentical=function(a,b){for(let c=0,f=a.length;c<f;++c)if(a[c]!==b[c])return!1;return!0},SortSolArray=function(a,b){return a.GetIndex()-b.GetIndex()};const d=self.C3;d.EventSheetManager=class extends d.DefendedBase{constructor(a){super();this._runtime=a;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=d.New(d.EventStack,this);this._localVarStack=d.New(d.LocalVarStack,this);this._loopStack=d.New(d.LoopStack,this);this._triggersToPostInit=[];this._queuedTriggers=[];this._queuedDebugTriggers=[];this._blockFlushingDepth=this._executingTriggerDepth=this._runningEventsDepth=0;this._scheduledWaits=[];this._asyncActionPromises=[];self.c3_callFunction=
  (a,c)=>this._InvokeFunctionFromJS(a,c)}Release(){this.ClearAllScheduledWaits();this._eventStack.Release();this._eventStack=null;this._localVarStack.Release();this._localVarStack=null;d.clearArray(this._queuedTriggers);d.clearArray(this._queuedDebugTriggers);this._runtime=null;d.clearArray(this._allSheets);this._sheetsByName.clear()}Create(a){a=d.New(d.EventSheet,this,a);this._allSheets.push(a);this._sheetsByName.set(a.GetName().toLowerCase(),a)}_AddTriggerToPostInit(a){this._triggersToPostInit.push(a)}_PostInit(){for(const a of this._functionBlocksByName.values())a._PostInit(!1);
  for(const a of this._allSheets)a._PostInit();for(const a of this._allSheets)a._UpdateDeepIncludes();for(const a of this._triggersToPostInit)a._PostInit(!1);d.clearArray(this._triggersToPostInit);this._localVarStack._SetInitialValues(this._localVarInitialValues)}GetRuntime(){return this._runtime}GetEventSheetByName(a){return this._sheetsByName.get(a.toLowerCase())||null}_RegisterGroup(a){this._allGroups.push(a);this._groupsByName.set(a.GetGroupName(),a)}_RegisterEventBlock(a){this._blocksBySid.set(a.GetSID(),
  a)}_RegisterCondition(a){this._cndsBySid.set(a.GetSID(),a)}_RegisterAction(a){this._actsBySid.set(a.GetSID(),a)}_RegisterFunctionBlock(a){this._functionBlocksByName.set(a.GetFunctionName().toLowerCase(),a)}_RegisterEventVariable(a){this._eventVarsBySid.set(a.GetSID(),a);a.IsGlobal()?this._allGlobalVars.push(a):this._allLocalVars.push(a)}_DeduplicateSolModifierList(a){2<=a.length&&a.sort(SortSolArray);let b=this._allUniqueSolModifiers.get(a.length);b||(b=[],this._allUniqueSolModifiers.set(a.length,
  b));for(let c=0,f=b.length;c<f;++c){const e=b[c];if(IsSolArrayIdentical(a,e))return e}b.push(a);return a}_GetNextLocalVarIndex(a){this._localVarInitialValues.push(a.GetInitialValue());return this._nextLocalVarIndex++}GetEventStack(){return this._eventStack}GetCurrentEventStackFrame(){return this.GetEventStack().GetCurrentStackFrame()}GetCurrentEvent(){return this.GetCurrentEventStackFrame().GetCurrentEvent()}GetCurrentCondition(){const a=this.GetCurrentEventStackFrame();return a.GetCurrentEvent().GetConditionAt(a.GetConditionIndex())}GetCurrentAction(){const a=
  this.GetCurrentEventStackFrame();return a.GetCurrentEvent().GetActionAt(a.GetActionIndex())}GetLocalVarStack(){return this._localVarStack}GetLoopStack(){return this._loopStack}GetEventVariableByName(a,b){for(b=b.GetScopeParent();b;){const c=b._GetEventVariableNameInScope(a);if(c)return c;b=b.GetScopeParent()}for(const b of this._allGlobalVars)if(d.equalsNoCase(a,b.GetName()))return b;return null}GetAllLocalVariablesInScope(a){const b=[];for(a=a.GetScopeParent();a;)d.appendArray(b,a._GetAllLocalVariablesInScope()),
  a=a.GetScopeParent();return b}_GetLocalVariablesScriptInterface(a){const b={};for(const c of this.GetAllLocalVariablesInScope(a))b[c.GetJsPropName()]=c._GetScriptInterfaceDescriptor();return Object.create(Object.prototype,b)}GetEventVariableBySID(a){return this._eventVarsBySid.get(a)||null}GetEventBlockBySID(a){return this._blocksBySid.get(a)||null}GetConditionBySID(a){return this._cndsBySid.get(a)||null}GetActionBySID(a){return this._actsBySid.get(a)||null}GetFunctionBlockByName(a){return this._functionBlocksByName.get(a.toLowerCase())||
  null}GetAllGlobalVariables(){return this._allGlobalVars}GetAllLocalVariables(){return this._allLocalVars}ResetAllGlobalsToInitialValue(){for(const a of this._allGlobalVars)a.ResetToInitialValue()}GetEventGroupByName(a){return this._groupsByName.get(a.toLowerCase())||null}GetEventGroupBySID(a){return(a=this._blocksBySid.get(a))&&a.IsGroup()?a:null}GetAllGroups(){return this._allGroups}ResetAllGroupsInitialActivation(){for(const a of this._allGroups)a.ResetInitialActivation()}_ResetAllHasRunFlags(){for(const a of this._allSheets)a._ResetHasRunFlag()}RunEvents(a){this._ResetAllHasRunFlags();
  this._runningEventsDepth++;for(const b of a.runningLayouts())if(a=b.GetEventSheet())this._runtime.PushCurrentLayout(b),a.Run(),this._runtime.PopCurrentLayout();this._runningEventsDepth--}async DebugRunEvents(a){this._ResetAllHasRunFlags();this._runningEventsDepth++;for(const b of this._DebugRunEventsGen(a))await this._runtime.DebugBreak(b);this._runningEventsDepth--}*_DebugRunEventsGen(a){for(const b of a.runningLayouts())if(a=b.GetEventSheet())this._runtime.PushCurrentLayout(b),yield*a.DebugRun(),
  this._runtime.PopCurrentLayout()}_Trigger(a,b,c,f){let e=!1;if(!a.GetMainRunningLayout())return this.QueueTrigger(b,c,f);this._executingTriggerDepth++;for(const d of a.runningLayouts())if(a=d.GetEventSheet()){this._runtime.PushCurrentLayout(d);for(const d of a.deepIncludes()){const a=d._Trigger(b,c,f);e=e||a}a=a._Trigger(b,c,f);e=e||a;this._runtime.PopCurrentLayout()}this._executingTriggerDepth--;return e}*_DebugTrigger(a,b,c,f){let e=!1;if(!a.GetMainRunningLayout())return this.QueueTrigger(b,c,f);
  this._executingTriggerDepth++;for(const d of a.runningLayouts())if(a=d.GetEventSheet()){this._runtime.PushCurrentLayout(d);for(const d of a.deepIncludes()){const a=yield*d._DebugTrigger(b,c,f);e=e||a}a=yield*a._DebugTrigger(b,c,f);e=e||a;this._runtime.PopCurrentLayout()}this._executingTriggerDepth--;return e}QueueTrigger(a,b,c){this._queuedTriggers.push([a,b,c]);return!1}QueueDebugTrigger(a,b,c){let f=null;const e=new Promise(a=>f=a);this._queuedDebugTriggers.push([a,b,c,f]);return e}*_RunQueuedDebugTriggersGen(){if(this._runtime.HitBreakpoint())throw Error("should not be in breakpoint");
  const a=this._runtime.GetLayoutManager();for(;this._queuedDebugTriggers.length;){const [b,c,d,e]=this._queuedDebugTriggers.shift(),g=yield*this._DebugTrigger(a,b,c,d);e(g)}}async RunQueuedDebugTriggersAsync(){for(const a of this._RunQueuedDebugTriggersGen())await this._runtime.DebugBreak(a)}_FastTrigger(a,b,c,f){let e=!1;var g=a.GetMainRunningLayout();if(a=g.GetEventSheet()){this._executingTriggerDepth++;this._runtime.PushCurrentLayout(g);g=a.deepIncludes();for(let a=0,d=g.length;a<d;++a){const d=
  g[a]._FastTrigger(b,c,f);e=e||d}b=a._FastTrigger(b,c,f);e=e||b;this._runtime.PopCurrentLayout();this._executingTriggerDepth--;return e}}*_DebugFastTrigger(a,b,c,f){let e=!1;var g=a.GetMainRunningLayout();if(a=g.GetEventSheet()){this._executingTriggerDepth++;this._runtime.PushCurrentLayout(g);g=a.deepIncludes();for(let a=0,d=g.length;a<d;++a){const d=yield*g[a]._DebugFastTrigger(b,c,f);e=e||d}b=yield*a._DebugFastTrigger(b,c,f);e=e||b;this._runtime.PopCurrentLayout();this._executingTriggerDepth--;return e}}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(a){for(const [b,c,d]of this._queuedTriggers)this._Trigger(a,b,c,d);d.clearArray(this._queuedTriggers)}BlockFlushingInstances(a){a?this._blockFlushingDepth++:this._blockFlushingDepth--}IsFlushingBlocked(){return 0<this._blockFlushingDepth}ClearSol(a){for(let b=
  0,c=a.length;b<c;++b)a[b].GetSolStack().Clear()}PushCleanSol(a){for(let b=0,c=a.length;b<c;++b)a[b].GetSolStack().PushClean()}PushCopySol(a){for(let b=0,c=a.length;b<c;++b)a[b].GetSolStack().PushCopy()}PopSol(a){for(let b=0,c=a.length;b<c;++b)a[b].GetSolStack().Pop()}AddScheduledWait(){const a=d.New(d.ScheduledWait,this);this._scheduledWaits.push(a);return a}scheduledWaits(){return this._scheduledWaits}RunScheduledWaits(){if(this._scheduledWaits.length){var a=this.GetCurrentEventStackFrame(),b=!1;
  this._runningEventsDepth++;for(let c=0,d=this._scheduledWaits.length;c<d;++c){const d=this._scheduledWaits[c];d._ShouldRun()&&d._Run(a);d.ShouldRelease()&&(b=!0)}b&&this._FilterScheduledWaitsToRelease();this._runningEventsDepth--}}async DebugRunScheduledWaits(){if(this._scheduledWaits.length){var a=this.GetCurrentEventStackFrame(),b=!1;this._runningEventsDepth++;for(let c=0,d=this._scheduledWaits.length;c<d;++c){const d=this._scheduledWaits[c];d._ShouldRun()&&await d._DebugRun(a);d.ShouldRelease()&&
  (b=!0)}b&&this._FilterScheduledWaitsToRelease();this._runningEventsDepth--}}_FilterScheduledWaitsToRelease(){const a=d.arrayFilterOut(this._scheduledWaits,a=>a.ShouldRelease());for(const b of a)b.Release()}ClearAllScheduledWaits(){for(const a of this._scheduledWaits)a.Release();d.clearArray(this._scheduledWaits)}RemoveInstancesFromScheduledWaits(a){for(const b of this._scheduledWaits)b.RemoveInstances(a)}AddAsyncActionPromise(a){this._asyncActionPromises.push(a)}ClearAsyncActionPromises(){d.clearArray(this._asyncActionPromises)}GetPromiseForAllAsyncActions(){const a=
  Promise.all(this._asyncActionPromises);this._asyncActionPromises=[];return a}_SaveToJson(){return{groups:this._SaveGroupsToJson(),cnds:this._SaveCndsToJson(),acts:this._SaveActsToJson(),vars:this._SaveVarsToJson(),waits:this._SaveScheduledWaitsToJson()}}_LoadFromJson(a){this._LoadGroupsFromJson(a.groups);this._LoadCndsFromJson(a.cnds);this._LoadActsFromJson(a.acts);this._LoadVarsFromJson(a.vars);this._LoadScheduledWaitsFromJson(a.waits)}_SaveGroupsToJson(){const a={};for(const b of this.GetAllGroups())a[b.GetSID().toString()]=
  b.IsGroupActive();return a}_LoadGroupsFromJson(a){for(const [b,c]of Object.entries(a))a=parseInt(b,10),(a=this.GetEventGroupBySID(a))&&a.SetGroupActive(c)}_SaveCndsToJson(){const a={};for(const [b,c]of this._cndsBySid){const d=c._SaveToJson();d&&(a[b.toString()]=d)}return a}_LoadCndsFromJson(a){for(const [b,c]of Object.entries(a))a=parseInt(b,10),(a=this.GetConditionBySID(a))&&a._LoadFromJson(c)}_SaveActsToJson(){const a={};for(const [b,c]of this._actsBySid){const d=c._SaveToJson();d&&(a[b.toString()]=
  d)}return a}_LoadActsFromJson(a){for(const [b,c]of Object.entries(a))a=parseInt(b,10),(a=this.GetActionBySID(a))&&a._LoadFromJson(c)}_SaveVarsToJson(){const a={};for(const [b,c]of this._eventVarsBySid)c.IsConstant()||!c.IsGlobal()&&!c.IsStatic()||(a[b.toString()]=c.GetValue());return a}_LoadVarsFromJson(a){for(const [b,c]of Object.entries(a))a=parseInt(b,10),(a=this.GetEventVariableBySID(a))&&a.SetValue(c)}_SaveScheduledWaitsToJson(){return this._scheduledWaits.filter(a=>!a.IsPromise()).map(a=>a._SaveToJson())}_LoadScheduledWaitsFromJson(a){this.ClearAllScheduledWaits();
  for(const b of a)(a=d.ScheduledWait._CreateFromJson(this,b))&&this._scheduledWaits.push(a)}_GetPerfRecords(){return[...this._runtime.GetLayoutManager().runningLayouts()].map(a=>a.GetEventSheet()).filter(a=>a).map(a=>a._GetPerfRecord())}FindFirstFunctionBlockParent(a){for(;a;){const b=a.GetScopeParent();if(b instanceof d.FunctionBlock)return b;a=a.GetParent()}return null}_InvokeFunctionFromJS(a,b){Array.isArray(b)||(b=[]);a=this.GetFunctionBlockByName(a.toLowerCase());if(!a)return null;if(!a.IsEnabled())return a.GetDefaultReturnValue();
  var c=a.GetFunctionParameters();if(b.length<c.length){b=b.slice(0);do b.push(c[b.length].GetInitialValue());while(b.length<c.length)}c=a.GetEventBlock();return c.RunAsExpressionFunctionCall(c.GetSolModifiersIncludingParents(),a.GetReturnType(),a.GetDefaultReturnValue(),...b)}}};
  
  
  // c3/events/eventSheet.js
  'use strict';{const g=self.C3;g.EventSheet=class extends g.DefendedBase{constructor(a,b){super();this._eventSheetManager=a;this._runtime=a.GetRuntime();this._name=b[0];this._events=[];this._triggers=new Map;this._fastTriggers=new Map;this._eventsByDisplayNumber=new Map;this._hasRun=!1;this._shallowIncludes=[];this._deepIncludes=[];this._alreadyIncludedSheets=new Set;for(const a of b[1])this._CreateEvent(a,null,this._events);this._perfRecord=this._runtime.IsDebug()?{type:"sheet",name:this._name,totalTimeCounter:0,
  children:[]}:null}Release(){this._runtime=this._eventSheetManager=null}_CreateEvent(a,b,c){switch(a[0]){case 0:case 3:this._CreateEventBlock(a,b,c);break;case 1:this._CreateEventVariable(a,b,c);break;case 2:this._CreateInclude(a,b,c);break;case 4:this._CreateFunctionBlock(a,b);break;case 5:this._CreateScriptBlock(a,b,c);break;default:throw Error("invalid event type");}}_CreateEventBlock(a,b,c){a=g.EventBlock.Create(this,b,a);if(a.IsOrBlock()){c.push(a);c=a.GetConditions();for(let b=0,e=c.length;b<
  e;++b)c[b].IsTrigger()&&this._InitTrigger(a,b)}else a.IsTrigger()?this._InitTrigger(a,0):c.push(a)}_CreateFunctionBlock(a,b){a=g.FunctionBlock.Create(this,b,a);this._eventSheetManager._RegisterFunctionBlock(a)}_CreateEventVariable(a,b,c){a=g.EventVariable.Create(this,b,a);c.push(a)}_CreateInclude(a,b,c){a=g.EventInclude.Create(this,b,a);c.push(a)}_CreateScriptBlock(a,b,c){a=g.EventScript.Create(this,b,a);c.push(a)}_InitTrigger(a,b){a.IsOrBlock()||this._eventSheetManager._AddTriggerToPostInit(a);var c=
  a.GetConditionAt(b),d=c._GetFunc(),e=c.GetObjectClass();if(c.IsFastTrigger()){var f=this._fastTriggers.get(e);f||(f=new Map,this._fastTriggers.set(e,f));c=c.GetFastTriggerValue().toLowerCase();e=f.get(d);e||(e=new Map,f.set(d,e));d=e.get(c);d||(d=[],e.set(c,d));d.push([a,b])}else f=this._triggers.get(e),f||(f={methodMap:new Map,behaviors:new Map},this._triggers.set(e,f)),(e=c.GetBehaviorType())?(c=f.behaviors.get(e),c||(c=new Map,f.behaviors.set(e,c))):c=f.methodMap,f=c.get(d),f||(f=[],c.set(d,f)),
  f.push([a,b])}_PostInit(){const a=this._events;for(let b=0,c=a.length;b<c;++b){const d=b<c-1&&a[b+1]instanceof g.EventBlock&&a[b+1].IsElseBlock();a[b]._PostInit(d)}}_AddShallowInclude(a){this._shallowIncludes.push(a)}_UpdateDeepIncludes(){g.clearArray(this._deepIncludes);this._AddDeepIncludes(this);this._alreadyIncludedSheets.clear()}_AddDeepIncludes(a){const b=a._deepIncludes,c=a._alreadyIncludedSheets;for(const d of this._shallowIncludes){const e=d.GetIncludeSheet();d.IsActive()&&a!==e&&!c.has(e)&&
  (c.add(e),e._AddDeepIncludes(a),b.push(e))}}deepIncludes(){return this._deepIncludes}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}GetName(){return this._name}_RegisterEventByDisplayNumber(a,b){this._eventsByDisplayNumber.set(b,a)}_GetEventByDisplayNumber(a){return this._eventsByDisplayNumber.get(a)||null}_ResetHasRunFlag(){this._hasRun=!1}Run(){if(!this._hasRun){var a=this._runtime,b=a.IsCPUProfiling(),c=b?performance.now():0;this._hasRun=!0;var d=this.GetEventSheetManager(),
  e=d.GetCurrentEventStackFrame();for(const b of this._events)b.Run(e),d.ClearSol(b.GetSolModifiers()),d.ClearAsyncActionPromises(),a.FlushPendingInstances();e.Reset(null);b&&(this._perfRecord.totalTimeCounter+=performance.now()-c)}}*DebugRun(){if(!this._hasRun){this._hasRun=!0;var a=this._runtime,b=this.GetEventSheetManager(),c=b.GetCurrentEventStackFrame();for(const d of this._events)yield*d.DebugRun(c),b.ClearSol(d.GetSolModifiers()),b.ClearAsyncActionPromises(),a.FlushPendingInstances();c.Reset(null)}}_Trigger(a,
  b,c){if(b){const d=b.GetObjectClass();this._TriggerForClass(a,b,d,c);for(const e of d.GetFamilies())this._TriggerForClass(a,b,e,c)}else return this._TriggerForClass(a,b,null,null)}_TriggerForClass(a,b,c,d){c=this._triggers.get(c);if(!c)return!1;d=d?c.behaviors.get(d):c.methodMap;if(!d)return!1;d=d.get(a);if(!d)return!1;a=!1;for(const [c,f]of d)d=this._ExecuteTrigger(b,c,f),a=a||d;return a}*_DebugTrigger(a,b,c){if(b){const d=b.GetObjectClass();yield*this._DebugTriggerForClass(a,b,d,c);for(const e of d.GetFamilies())yield*this._DebugTriggerForClass(a,
  b,e,c)}else return yield*this._DebugTriggerForClass(a,b,null,null)}*_DebugTriggerForClass(a,b,c,d){c=this._triggers.get(c);if(!c)return!1;d=d?c.behaviors.get(d):c.methodMap;if(!d)return!1;d=d.get(a);if(!d)return!1;a=!1;for(const [c,f]of d)d=c.DebugCanRunFast()?this._ExecuteTrigger(b,c,f):yield*this._DebugExecuteTrigger(b,c,f),a=a||d;return a}_FastTrigger(a,b,c){b=b.GetObjectClass();b=this._fastTriggers.get(b);if(!b)return!1;a=b.get(a);if(!a)return!1;c=a.get(c);if(!c)return!1;a=!1;for(let d=0,e=c.length;d<
  e;++d)b=c[d],b=this._ExecuteTrigger(null,b[0],b[1]),a=a||b;return a}*_DebugFastTrigger(a,b,c){b=b.GetObjectClass();b=this._fastTriggers.get(b);if(!b)return!1;a=b.get(a);if(!a)return!1;c=a.get(c);if(!c)return!1;a=!1;for(let e=0,f=c.length;e<f;++e){var d=c[e];b=d[0];d=d[1];b=b.DebugCanRunFast()?this._ExecuteTrigger(null,b,d):yield*this._DebugExecuteTrigger(null,b,d);a=a||b}return a}_ExecuteTrigger(a,b,c){const d=this._runtime,e=this._eventSheetManager,f=e.GetCurrentEvent(),k=e.GetEventStack(),l=e.GetTriggerDepth();
  let m=!1;f&&e.PushCleanSol(f.GetSolModifiersIncludingParents());e.PushCleanSol(b.GetSolModifiersIncludingParents());const n=1<l;n&&e.GetLocalVarStack().Push();const h=k.Push(b);a&&(b.GetConditions()[c].GetObjectClass().GetCurrentSol().SetSinglePicked(a),a.IsInContainer()&&a.SetSiblingsSinglePicked());a=!0;if(b.GetParent()){const c=b.GetTriggerParents();for(let b=0,d=c.length;b<d;++b)if(!c[b].RunPreTrigger(h)){a=!1;break}}a&&(d.IncrementExecCount(),b.IsOrBlock()?b.RunOrBlockTrigger(h,c):b.Run(h),m=
  h.GetLastEventTrue());k.Pop();n&&e.GetLocalVarStack().Pop();e.PopSol(b.GetSolModifiersIncludingParents());f&&e.PopSol(f.GetSolModifiersIncludingParents());f||1!==l||e.IsFlushingBlocked()||d.FlushPendingInstances();return m}*_DebugExecuteTrigger(a,b,c){const d=this._runtime,e=this._eventSheetManager,f=e.GetCurrentEvent(),k=e.GetEventStack(),l=e.GetTriggerDepth();let m=!1;f&&e.PushCleanSol(f.GetSolModifiersIncludingParents());e.PushCleanSol(b.GetSolModifiersIncludingParents());const n=1<l;n&&e.GetLocalVarStack().Push();
  const h=k.Push(b);a&&(b.GetConditions()[c].GetObjectClass().GetCurrentSol().SetSinglePicked(a),a.IsInContainer()&&a.SetSiblingsSinglePicked());a=!0;if(b.GetParent()){const c=b.GetTriggerParents();for(let b=0,d=c.length;b<d;++b)if(!(yield*c[b].DebugRunPreTrigger(h))){a=!1;break}}a&&(d.IncrementExecCount(),b.IsOrBlock()?yield*b.DebugRunOrBlockTrigger(h,c):yield*b.DebugRun(h),m=h.GetLastEventTrue());k.Pop();n&&e.GetLocalVarStack().Pop();e.PopSol(b.GetSolModifiersIncludingParents());f&&e.PopSol(f.GetSolModifiersIncludingParents());
  f||1!==l||e.IsFlushingBlocked()||d.FlushPendingInstances();return m}_GetPerfRecord(){return this._perfRecord}}};
  
  
  // c3/events/eventBlock.js
  'use strict';{var DebugNoActions=function*(a,b){return!0},NoActions=function(a,b){return!0};const k=self.C3,p=[];k.EventBlock=class extends k.DefendedBase{constructor(a,b,c){super();this._eventSheet=a;this._runtime=a.GetRuntime();this._parent=b;this._scopeParent=null;this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._solModifiers=[];this._solModifiersIncludingParents=[];this._hasElseBlock=this._isTopLevelGroup=this._isSolWriterAfterCnds=this._hasGotSolModifiersIncludingParents=
  !1;this._isOrBlock=!!c[2];this._isElseBlock=!1;this._triggerParents=null;this._conditions=[];this._actions=[];this._subEvents=[];this._RunActions=NoActions;this._DebugRunActions=DebugNoActions;this._isInitiallyActive=this._isGroup=!1;this._groupName="";this._isGroupActive=!1;this._perfRecord=this._containedIncludes=null;this._sid=c[4];this._displayNumber=c[5];this._eventSheet._RegisterEventByDisplayNumber(this,this._displayNumber);this._debugData=this._runtime.IsDebug()?{isBreakpoint:c[3][0],isBreakable:c[3][1],
  canRunAllConditionsFast:!1,canRunAllActionsFast:!1,canRunAllSubEventsFast:!1,canRunSelfFast:!1}:null;this.GetEventSheetManager()._RegisterEventBlock(this);3===c[0]&&this._InitGroup(c[1]);a=0;for(var d of c[6])b=k.Condition.Create(this,d,a++),this._conditions.push(b),this._AddSolModifier(b.GetObjectClass());a=0;for(const b of c[7])d=k.Action.Create(this,b,a++),this._actions.push(d);if(9===c.length){c=c[8];for(const a of c)this._eventSheet._CreateEvent(a,this,this._subEvents)}this._conditions.length&&
  (this._isElseBlock=null===this._conditions[0].GetObjectClass()&&this._conditions[0]._GetFunc()===k.Plugins.System.Cnds.Else);0===this._conditions.length&&(this._conditions=p);0===this._actions.length&&(this._actions=p);0===this._subEvents.length&&(this._subEvents=p)}static Create(a,b,c){return k.New(k.EventBlock,a,b,c)}_InitGroup(a){this._isGroup=!0;this._isGroupActive=this._isInitiallyActive=!!a[0];this._groupName=a[1].toLowerCase();this._containedIncludes=[];this.GetEventSheetManager()._RegisterGroup(this);
  this._runtime.IsDebug()&&(this._perfRecord={type:"group",name:a[1],totalTimeCounter:0,children:[]})}_AddContainedInclude(a){this._containedIncludes.push(a)}_AddContainerSolModifierToList(a,b){for(const c of a.GetContainer().objectTypes())b.includes(c)||b.push(c)}_AddSolModifierToList(a,b){if(a)if(b.includes(a)||b.push(a),a.IsFamily())for(const c of a.GetFamilyMembers())c.IsInContainer()&&this._AddContainerSolModifierToList(c,b);else a.IsInContainer()&&this._AddContainerSolModifierToList(a,b)}_AddSolModifier(a){this._AddSolModifierToList(a,
  this._solModifiers)}_AddParentSolModifier(a){this._AddSolModifierToList(a,this._solModifiersIncludingParents)}SetAllSolModifiers(){this._solModifiers=this._runtime.GetAllObjectClasses()}_PostInit(a){this._hasElseBlock=!!a;this._IdentifyTopLevelGroup();this._IdentifyTriggerParents();for(const a of this._conditions)a._PostInit();if(0<this._actions.length){a=!1;for(var b of this._actions)b._PostInit(),b.HasReturnType()&&(a=!0);a?(this._RunActions=this._RunActions_ReturnValue,this._DebugRunActions=this._DebugRunActions_ReturnValue):
  (this._RunActions=this._RunActions_Fast,this._DebugRunActions=this._DebugRunActions_Fast)}b=this._subEvents;for(let c=0,d=b.length;c<d;++c)a=c<d-1&&b[c+1]instanceof k.EventBlock&&b[c+1].IsElseBlock(),b[c]._PostInit(a);this._debugData&&this._UpdateCanRunFast();this._perfRecord&&this._GetPerfRecordParent()._GetPerfRecord().children.push(this._perfRecord)}_GetPerfRecord(){return this._perfRecord}_GetPerfRecordParent(){let a=this.GetParent();for(;a;){if(a.IsGroup())return a;a=a.GetParent()}return this._eventSheet}_UpdateCanRunFast(){const a=
  this._debugData;a.canRunAllConditionsFast=this._conditions.every(a=>a.DebugCanRunFast());a.canRunAllActionsFast=this._actions.every(a=>a.DebugCanRunFast());a.canRunAllSubEventsFast=this._subEvents.every(a=>a.DebugCanRunFast());a.canRunSelfFast=a.canRunAllConditionsFast&&a.canRunAllActionsFast&&a.canRunAllSubEventsFast}_UpdateCanRunFastRecursive(){let a=this;do a._UpdateCanRunFast(),a=a.GetParent();while(a)}_IdentifyTopLevelGroup(){if(this.IsGroup()){var a=this.GetParent();for(this._isTopLevelGroup=
  !0;a;){if(!a.IsGroup()){this._isTopLevelGroup=!1;break}a=a.GetParent()}}}_IdentifySolModifiersIncludingParents(){var a=this._runtime.GetAllObjectClasses();if(this._solModifiers===a)this._solModifiersIncludingParents=a;else{this._solModifiersIncludingParents=k.cloneArray(this._solModifiers);for(a=this.GetParent();a;){for(var b of a._solModifiers)this._AddParentSolModifier(b);a=a.GetParent()}b=this.GetEventSheetManager();this._solModifiers=b._DeduplicateSolModifierList(this._solModifiers);this._solModifiersIncludingParents=
  b._DeduplicateSolModifierList(this._solModifiersIncludingParents)}}_IdentifyTriggerParents(){if(this.HasAnyTriggeredCondition()){this._triggerParents=[];for(var a=this.GetParent();a;)this._triggerParents.push(a),a=a.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(a){return this._solModifiers.includes(a)}GetTriggerParents(){return this._triggerParents}GetEventSheet(){return this._eventSheet}GetEventSheetManager(){return this._eventSheet.GetEventSheetManager()}GetRuntime(){return this._runtime}GetParent(){return this._parent}_SetScopeParent(a){this._scopeParent=a}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(a){this._debugData.isBreakpoint=!!a;this._UpdateCanRunFastRecursive()}IsGroup(){return this._isGroup}IsTopLevelGroup(){return this._isTopLevelGroup}IsElseBlock(){return this._isElseBlock}HasElseBlock(){return this._hasElseBlock}GetGroupName(){return this._groupName}IsGroupActive(){return this._isGroupActive}ResetInitialActivation(){this.SetGroupActive(this._isInitiallyActive)}SetGroupActive(a){a=
  !!a;if(!this._isGroup)throw Error("not a group");if(this._isGroupActive!==a){this._isGroupActive=a;for(const a of this._containedIncludes)a.UpdateActive();this._containedIncludes.length&&(a=this._runtime.GetCurrentLayout().GetEventSheet())&&a._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 k.FunctionBlock}HasAnyTriggeredCondition(){return this.IsForFunctionBlock()||
  this._conditions.some(a=>a.IsTrigger())}GetConditions(){return this._conditions}GetConditionCount(){return this._conditions.length}GetConditionAt(a){a=Math.floor(a);if(0>a||a>=this._conditions.length)throw new RangeError("invalid condition index");return this._conditions[a]}GetConditionByDebugIndex(a){return this.GetConditionAt(a)}IsFirstConditionOfType(a){let b=a.GetIndex();if(0===b)return!0;for(--b;0<=b;--b)if(this._conditions[b].GetObjectClass()===a.GetObjectClass())return!1;return!0}GetActions(){return this._actions}GetActionCount(){return this._actions.length}GetActionAt(a){a=
  Math.floor(a);if(0>a||a>=this._actions.length)throw new RangeError("invalid action index");return this._actions[a]}GetActionByDebugIndex(a){a=Math.floor(a);const b=this._actions.find(b=>b.GetDebugIndex()===a);if(!b)throw new RangeError("invalid action debug index");return b}_HasActionIndex(a){a=Math.floor(a);return 0<=a&&a<this._actions.length}GetSubEvents(){return this._subEvents}_GetEventVariableNameInScope(a){for(const b of this._subEvents)if(b instanceof k.EventVariable&&k.equalsNoCase(a,b.GetName()))return b;
  return null}_GetAllLocalVariablesInScope(){return this._subEvents.filter(a=>a instanceof k.EventVariable)}RunPreTrigger(a){a.SetCurrentEvent(this);let b=!1;const c=this._conditions;for(let d=0,e=c.length;d<e;++d){const e=c[d];a.SetConditionIndex(d);if(e.IsLooping())throw Error("trigger cannot be used as sub-event to a loop");if(e.Run())b=!0;else if(!this._isOrBlock)return!1}return this._isOrBlock?b:!0}RunOrBlockTrigger(a,b){a.SetCurrentEvent(this);this._conditions[b].Run()&&(this._RunActions(a,0)&&
  this._RunSubEvents(a),a.SetLastEventTrue(!0))}*DebugRunPreTrigger(a){a.SetCurrentEvent(this);let b=!1;const c=this._conditions;for(let d=0,e=c.length;d<e;++d){const e=c[d];a.SetConditionIndex(d);if(e.IsLooping())throw Error("trigger cannot be used as sub-event to a loop");if(e.DebugCanRunFast()?e.Run():yield*e.DebugRun())b=!0;else if(!this._isOrBlock)return!1}return this._isOrBlock?b:!0}*DebugRunOrBlockTrigger(a,b){a.SetCurrentEvent(this);b=this._conditions[b];if(b.DebugCanRunFast()?b.Run():yield*b.DebugRun())(this.DebugCanRunActionsFast()?
  this._RunActions(a,0):yield*this._DebugRunActions(a,0))&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():yield*this._DebugRunSubEvents()),a.SetLastEventTrue(!0)}Run(a){a.SetCurrentEvent(this);this._isElseBlock||a.SetElseBranchRan(!1);this._isOrBlock?this._RunOrBlock(a):this._RunAndBlock(a)}*DebugRun(a){if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;a.SetCurrentEvent(this);this._isElseBlock||a.SetElseBranchRan(!1);this._isOrBlock?yield*this._DebugRunOrBlock(a):yield*this._DebugRunAndBlock(a)}_RunOrBlock(a){const b=
  this._conditions;let c=0===b.length;for(let e=0,f=b.length;e<f;++e){var d=b[e];d.IsTrigger()||(a.SetConditionIndex(e),d=d.Run(),c=c||d)}a.SetLastEventTrue(c);c&&(this._RunActions(a,0)&&this._RunSubEvents(a),this._hasElseBlock&&a.SetElseBranchRan(!0))}*_DebugRunOrBlock(a){const b=this._conditions;let c=0===b.length;for(let e=0,f=b.length;e<f;++e){var d=b[e];d.IsTrigger()||(a.SetConditionIndex(e),d=d.DebugCanRunFast()?d.Run():yield*d.DebugRun(),c=c||d)}a.SetLastEventTrue(c);c&&((this.DebugCanRunActionsFast()?
  this._RunActions(a,0):yield*this._DebugRunActions(a,0))&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():yield*this._DebugRunSubEvents()),this._hasElseBlock&&a.SetElseBranchRan(!0))}_RunAndBlock(a){const b=this._conditions;for(let c=0,d=b.length;c<d;++c){const d=b[c];a.SetConditionIndex(c);if(!d.Run()){a.SetLastEventTrue(!1);return}}a.SetLastEventTrue(!0);this._RunActions(a,0)&&this._RunSubEvents(a);a.GetLastEventTrue()&&this._hasElseBlock&&a.SetElseBranchRan(!0)}*_DebugRunAndBlock(a){const b=
  this._conditions;for(let c=0,d=b.length;c<d;++c){const d=b[c];a.SetConditionIndex(c);if(d.DebugCanRunFast()?!d.Run():!(yield*d.DebugRun())){a.SetLastEventTrue(!1);return}}a.SetLastEventTrue(!0);(this.DebugCanRunActionsFast()?this._RunActions(a,0):yield*this._DebugRunActions(a,0))&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():yield*this._DebugRunSubEvents());a.GetLastEventTrue()&&this._hasElseBlock&&a.SetElseBranchRan(!0)}_RunActions_Fast(a,b){const c=this._actions;for(let d=b,e=c.length;d<
  e;++d)b=c[d],a.SetActionIndex(d),b.Run();return!0}*_DebugRunActions_Fast(a,b){const c=this._actions;for(let d=b,e=c.length;d<e;++d)b=c[d],a.SetActionIndex(d),b.DebugCanRunFast()?b.Run():yield*b.DebugRun();return!0}_RunActions_ReturnValue(a,b){const c=this.GetEventSheetManager(),d=this._actions;for(let e=b,f=d.length;e<f;++e){b=d[e];a.SetActionIndex(e);const f=b.Run();if(b.CanBailOut()&&!0===f)return!1;b.IsAsync()&&f instanceof Promise&&c.AddAsyncActionPromise(f)}return!0}*_DebugRunActions_ReturnValue(a,
  b){const c=this.GetEventSheetManager(),d=this._actions;for(let e=b,f=d.length;e<f;++e){b=d[e];a.SetActionIndex(e);let f;f=b.DebugCanRunFast()?b.Run():yield*b.DebugRun();if(b.CanBailOut()&&!0===f)return!1;b.IsAsync()&&f instanceof Promise&&c.AddAsyncActionPromise(f)}return!0}_ResumeActionsAndSubEvents(a){this._RunActions(a,a.GetActionIndex())&&this._RunSubEvents()}*_DebugResumeActionsAndSubEvents(a){if(yield*this._DebugRunActions(a,a.GetActionIndex()))yield*this._DebugRunSubEvents()}_RunSubEvents(){if(this._subEvents.length){var a=
  this.IsGroup()&&this._runtime.IsCPUProfiling(),b=a?performance.now():0,c=this._eventStack,d=c.Push(this);this._isSolWriterAfterCnds?this._RunSubEvents_SolWriterAfterCnds(d):this._RunSubEvents_Fast(d);c.Pop();a&&(this._perfRecord.totalTimeCounter+=performance.now()-b)}}_RunSubEvents_SolWriterAfterCnds(a){const b=this._isGroup,c=this._isTopLevelGroup,d=this.GetEventSheetManager(),e=this._subEvents;for(let f=0,g=e.length,h=g-1;f<g;++f){const g=e[f],m=g.GetSolModifiers(),k=!c||!b&&f<h;k&&d.PushCopySol(m);
  g.Run(a);k?d.PopSol(m):d.ClearSol(m)}}_RunSubEvents_Fast(a){const b=this._subEvents;for(let c=0,d=b.length;c<d;++c)b[c].Run(a)}*_DebugRunSubEvents(){if(this._subEvents.length){var a=this._eventStack,b=a.Push(this);this._isSolWriterAfterCnds?yield*this._DebugRunSubEvents_SolWriterAfterCnds(b):yield*this._DebugRunSubEvents_Fast(b);a.Pop()}}*_DebugRunSubEvents_SolWriterAfterCnds(a){const b=this._isGroup,c=this._isTopLevelGroup,d=this.GetEventSheetManager(),e=this._subEvents;for(let f=0,g=e.length,h=
  g-1;f<g;++f){const g=e[f],k=g.GetSolModifiers(),n=!c||!b&&f<h;n&&d.PushCopySol(k);yield*g.DebugRun(a);n?d.PopSol(k):d.ClearSol(k)}}*_DebugRunSubEvents_Fast(a){const b=this._subEvents;for(let c=0,d=b.length;c<d;++c)yield*b[c].DebugRun(a)}Retrigger(a,b){this._runtime.IncrementExecCount();b.ResetQuick();const c=this._conditions;if(!this.IsOrBlock())for(let d=a.GetConditionIndex()+1,e=c.length;d<e;++d)if(a=c[d],b.SetConditionIndex(d),!a.Run())return!1;this._RunActions(b,0)&&this._RunSubEvents(b);return!0}*DebugRetrigger(a,
  b){this._runtime.IncrementExecCount();b.ResetQuick();const c=this._conditions;if(!this.IsOrBlock())for(let d=a.GetConditionIndex()+1,e=c.length;d<e;++d)if(a=c[d],b.SetConditionIndex(d),a.DebugCanRunFast()?!a.Run():!(yield*a.DebugRun()))return!1;(this.DebugCanRunActionsFast()?this._RunActions(b,0):yield*this._DebugRunActions(b,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(a){if(this.GetParent()){const b=this.GetTriggerParents();for(let c=0,d=b.length;c<d;++c)if(!b[c].RunPreTrigger(a))return!1}return!0}*_DebugCheckParentsOKToRun(a){if(this.GetParent()){const b=this.GetTriggerParents();for(let c=0,d=b.length;c<d;++c)if(!(yield*b[c].DebugRunPreTrigger(a)))return!1}return!0}_EvaluateFunctionCallParameters(a,
  b,c){0<b.length?c?(b=b.map(a=>a.Get(0)),a.GetLocalVarStack().Push(),this._scopeParent.SetFunctionParameters(b)):this._scopeParent.EvaluateFunctionParameters(b):c&&a.GetLocalVarStack().Push()}RunAsFunctionCall(a,b){let c,d;const e=0<a.length;var f=this._runtime;const g=this._eventStack,h=f.GetEventSheetManager(),l=1<h._IncTriggerDepth();this._EvaluateFunctionCallParameters(h,b,l);e&&h.PushCleanSol(a);b=g.Push(this);this._CheckParentsOKToRun(b)&&(f.IncrementExecCount(),b.SetCurrentEvent(this),(f=this._scopeParent.IsAsync())&&
  ([d,c]=this._scopeParent.StartAsyncFunctionCall()),this._RunAndBlock(b),f&&this._scopeParent.MaybeFinishAsyncFunctionCall(d));g.Pop();l&&h.GetLocalVarStack().Pop();e&&h.PopSol(a);h._DecTriggerDepth();return c}*DebugRunAsFunctionCall(a,b){let c,d;if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;const e=0<a.length;var f=this._runtime;const g=this._eventStack,h=f.GetEventSheetManager(),l=1<h._IncTriggerDepth();this._EvaluateFunctionCallParameters(h,b,l);e&&h.PushCleanSol(a);b=g.Push(this);
  if(yield*this._DebugCheckParentsOKToRun(b))f.IncrementExecCount(),b.SetCurrentEvent(this),(f=this._scopeParent.IsAsync())&&([d,c]=this._scopeParent.StartAsyncFunctionCall()),yield*this._DebugRunAndBlock(b),f&&this._scopeParent.MaybeFinishAsyncFunctionCall(d);g.Pop();l&&h.GetLocalVarStack().Pop();e&&h.PopSol(a);h._DecTriggerDepth();return c}RunAsMappedFunctionCall(a){const b=this.GetSolModifiersIncludingParents(),c=0<b.length,d=this._runtime,e=this._eventStack,f=d.GetEventSheetManager(),g=1<f._IncTriggerDepth();
  g&&f.GetLocalVarStack().Push();this._scopeParent.SetFunctionParameters(a);c&&f.PushCleanSol(b);a=e.Push(this);this._CheckParentsOKToRun(a)&&(d.IncrementExecCount(),a.SetCurrentEvent(this),this._RunAndBlock(a));e.Pop();g&&f.GetLocalVarStack().Pop();c&&f.PopSol(b);f._DecTriggerDepth()}*DebugRunAsMappedFunctionCall(a){if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;const b=this.GetSolModifiersIncludingParents(),c=0<b.length,d=this._runtime,e=this._eventStack,f=d.GetEventSheetManager(),
  g=1<f._IncTriggerDepth();g&&f.GetLocalVarStack().Push();this._scopeParent.SetFunctionParameters(a);c&&f.PushCleanSol(b);a=e.Push(this);if(yield*this._DebugCheckParentsOKToRun(a))d.IncrementExecCount(),a.SetCurrentEvent(this),yield*this._DebugRunAndBlock(a);e.Pop();g&&f.GetLocalVarStack().Pop();c&&f.PopSol(b);f._DecTriggerDepth()}RunAsExpressionFunctionCall(a,b,c,...d){let e,f;const g=0<a.length,h=this._runtime,l=this._eventStack,m=h.GetEventSheetManager(),n=1<m._IncTriggerDepth();n&&m.GetLocalVarStack().Push();
  0<d.length&&this._scopeParent.SetFunctionParameters(d);g&&m.PushCleanSol(a);d=l.Push(this);d.InitCallFunctionExpression(b,c);l.PushExpFunc(d);h.SetDebuggingEnabled(!1);this._CheckParentsOKToRun(d)&&(h.IncrementExecCount(),d.SetCurrentEvent(this),(b=this._scopeParent.IsAsync())&&([f,e]=this._scopeParent.StartAsyncFunctionCall()),this._RunAndBlock(d),b&&this._scopeParent.MaybeFinishAsyncFunctionCall(f));h.SetDebuggingEnabled(!0);l.Pop();l.PopExpFunc();n&&m.GetLocalVarStack().Pop();g&&m.PopSol(a);m._DecTriggerDepth();
  return e||d.GetFunctionReturnValue()}}};
  
  
  // c3/events/eventScript.js
  'use strict';{const d=self.C3,f=[];let e=!1;d.EventScript=class extends d.DefendedBase{constructor(a,c,b){super();const g=a.GetRuntime(),h=a.GetEventSheetManager();this._eventSheet=a;this._eventSheetManager=h;this._runtime=a.GetRuntime();this._parent=c;this._func=g.GetObjectReference(b[1]);this._displayNumber=b[2];this._eventSheet._RegisterEventByDisplayNumber(this,this._displayNumber);this._debugData=g.IsDebug()?{isBreakpoint:b[3][0],isBreakable:b[3][1]}:null}static Create(a,c,b){return d.New(d.EventScript,
  a,c,b)}_PostInit(){const a=this._func,c=this._runtime.GetEventSheetManager()._GetLocalVariablesScriptInterface(this);this._func=a.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(a){this._debugData.isBreakpoint=
  !!a}IsElseBlock(){return!1}GetSolModifiers(){return f}GetSolModifiersIncludingParents(){return this._parent?this._parent.GetSolModifiersIncludingParents():f}Run(a){a.SetCurrentEvent(this);this._eventSheetManager.AddAsyncActionPromise(this._RunUserScript())}async _RunUserScript(){try{await this._func()}catch(a){console.error(`Unhandled exception running script %c${this.GetEventSheet().GetName()}, event ${this.GetDisplayNumber()}:`,"font-size: 1.2em; font-weight: bold;",a),self.C3Debugger&&self.C3Debugger._SetLastErrorScript(this),
  e||(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=!0)}}*DebugRun(a){a.SetCurrentEvent(this);if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;this.Run(a)}DebugCanRunFast(){return!this.IsDebugBreakpoint()&&!this._runtime.DebugBreakNext()}static HadUserScriptException(){return e}static SetHadUserScriptException(){e=!0}}};
  
  
  // c3/events/functionBlock.js
  'use strict';{const e=self.C3;e.FunctionBlock=class extends e.DefendedBase{constructor(a,b,c){super();this._eventSheet=a;this._runtime=a.GetRuntime();this._parent=b;const d=c[1];this._functionName=d[0];this._returnType=d[1];this._functionParameters=d[2].map(b=>e.EventVariable.Create(a,this,b));this._isEnabled=d[3];this._isAsync=d[4];this._nextAsyncId=0;this._currentAsyncId=-1;this._asyncMap=new Map;this._eventBlock=e.EventBlock.Create(a,b,c);this._eventBlock._SetScopeParent(this)}static Create(a,
  b,c){return e.New(e.FunctionBlock,a,b,c)}_PostInit(){for(const a of this._functionParameters)a._PostInit();this._eventBlock._PostInit(!1)}_GetEventVariableNameInScope(a){for(const b of this._functionParameters)if(e.equalsNoCase(a,b.GetName()))return b;return null}_GetAllLocalVariablesInScope(){return this._functionParameters}GetFunctionParameters(){return this._functionParameters}GetFunctionParameterCount(){return this._functionParameters.length}EvaluateFunctionParameters(a){const b=this._functionParameters;
  for(let c=0,d=b.length;c<d;++c)b[c].SetValue(a[c].Get(0))}SetFunctionParameters(a){const b=this._functionParameters;for(let c=0,d=b.length;c<d;++c)b[c].SetValue(a[c])}CaptureFunctionParameters(){return this._functionParameters.map(a=>a.GetValue())}GetParent(){return this._parent}GetScopeParent(){return this._parent}GetFunctionName(){return this._functionName}GetReturnType(){return this._returnType}IsEnabled(){return this._isEnabled}GetDefaultReturnValue(){switch(this._returnType){case 0:return null;
  case 2:return"";default:return 0}}GetEventBlock(){return this._eventBlock}IsAsync(){return this._isAsync}StartAsyncFunctionCall(){const a=this._nextAsyncId++;this._currentAsyncId=a;let b;const c=new Promise(a=>b=a);this._asyncMap.set(a,{resolve:b,pauseCount:0});return[a,c]}MaybeFinishAsyncFunctionCall(a){const b=this._asyncMap.get(a);0===b.pauseCount&&(b.resolve(),this._asyncMap.delete(a));this._currentAsyncId=-1}PauseCurrentAsyncFunction(){this._asyncMap.get(this._currentAsyncId).pauseCount++;return this._currentAsyncId}ResumeAsyncFunction(a){this._currentAsyncId=
  a;this._asyncMap.get(a).pauseCount--}}};
  
  
  // c3/events/eventVariable.js
  'use strict';{const c=self.C3,f=[];c.EventVariable=class extends c.DefendedBase{constructor(a,d,b){super();const e=a.GetEventSheetManager();this._eventSheet=a;this._eventSheetManager=e;this._runtime=a.GetRuntime();this._parent=d;this._localVarStack=e.GetLocalVarStack();this._name=b[1];this._type=b[2];this._initialValue=b[3];this._isStatic=!!b[4];this._isConstant=!!b[5];this._isFunctionParameter=d instanceof c.FunctionBlock;this._sid=b[6];this._jsPropName=this._runtime.GetJsPropName(b[8]);this._scriptSetter=
  a=>this.SetValue(a);this._scriptGetter=()=>this.GetValue();this._hasSingleValue=!this._parent||this._isStatic||this._isConstant;this._value=this._initialValue;this._localIndex=-1;this.IsBoolean()&&(this._value=this._value?1:0);!this.IsLocal()||this.IsStatic()||this.IsConstant()||(this._localIndex=e._GetNextLocalVarIndex(this));e._RegisterEventVariable(this)}static Create(a,d,b){return c.New(c.EventVariable,a,d,b)}_PostInit(){}GetName(){return this._name}GetJsPropName(){return this._jsPropName}GetParent(){return this._parent}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 f}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}}}};
  
  
  // c3/events/eventInclude.js
  'use strict';{const c=self.C3,e=[];c.EventInclude=class extends c.DefendedBase{constructor(a,b,d){super();const f=a.GetEventSheetManager();this._eventSheet=a;this._eventSheetManager=f;this._runtime=a.GetRuntime();this._parent=b;this._includeSheet=null;this._includeSheetName=d[1];this._isActive=!0}static Create(a,b,d){return c.New(c.EventInclude,a,b,d)}_PostInit(){this._includeSheet=this._eventSheetManager.GetEventSheetByName(this._includeSheetName);this._eventSheet._AddShallowInclude(this);let a=
  this.GetParent();for(;a;)a instanceof c.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 e}GetIncludeSheet(){return this._includeSheet}Run(a){a=!!this.GetParent();const b=this._runtime.GetAllObjectClasses();a&&this._eventSheetManager.PushCleanSol(b);this._includeSheet.Run();a&&this._eventSheetManager.PopSol(b)}*DebugRun(a){a=
  !!this.GetParent();const b=this._runtime.GetAllObjectClasses();a&&this._eventSheetManager.PushCleanSol(b);yield*this._includeSheet.DebugRun();a&&this._eventSheetManager.PopSol(b)}DebugCanRunFast(){return!1}IsActive(){return this._isActive}UpdateActive(){let a=this.GetParent();for(;a;){if(a instanceof c.EventBlock&&a.IsGroup()&&!a.IsGroupActive()){this._isActive=!1;return}a=a.GetParent()}this._isActive=!0}}};
  
  
  // c3/events/expNode.js
  'use strict';{var WrapIndex=function(a,b){if(a>=b)return a%b;0>a&&(a<=-b&&(a%=b),0>a&&(a+=b));return a};const e=self.C3;e.ExpNode=class extends e.DefendedBase{constructor(a){super();this._owner=a;this._runtime=a.GetRuntime()}_PostInit(){}static CreateNode(a,b){return e.New([g,h,k,l,m,n][b[0]],a,b)}};class m extends e.ExpNode{constructor(a,b){super(a);this._systemPlugin=this._runtime.GetSystemPlugin();this._func=this._runtime.GetObjectReference(b[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 n extends e.ExpNode{constructor(a,b){super(a);this._functionBlock=null;this._functionName=b[1];this._owner.SetVariesPerInstance()}_PostInit(){const a=this._runtime.GetEventSheetManager();this._functionBlock=a.GetFunctionBlockByName(this._functionName);this._functionName=null;const b=this._owner.GetEventBlock(),c=this._functionBlock.GetEventBlock();
  this._combinedSolModifiers=[...new Set([...b.GetSolModifiersIncludingParents(),...c.GetSolModifiersIncludingParents()])];this._combinedSolModifiers=a._DeduplicateSolModifierList(this._combinedSolModifiers)}GetBoundMethod(){const a=this._functionBlock;if(a.IsEnabled()){const b=a.GetEventBlock();return e.EventBlock.prototype.RunAsExpressionFunctionCall.bind(b,this._combinedSolModifiers,a.GetReturnType(),a.GetDefaultReturnValue())}{const b=a.GetDefaultReturnValue();return()=>b}}}class h extends e.ExpNode{constructor(a,
  b){super(a);this._objectClass=this._runtime.GetObjectClassByIndex(b[1]);this._func=this._runtime.GetObjectReference(b[2]);this._returnsString=!!b[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(...a){const b=this._objectClass,c=b.GetCurrentSol().GetExpressionInstances();var d=
  c.length;if(0===d)return this._returnsString?"":0;d=WrapIndex(this._owner.GetSolIndex(),d);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(b);return this._func.apply(c[d].GetSdkInstance(),a)}ExpObject_InstExpr(a,...b){const c=this._objectClass,d=c.GetInstances(),f=d.length;if(0===f)return this._returnsString?"":0;a=WrapIndex(a,f);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(c);return this._func.apply(d[a].GetSdkInstance(),b)}}class k extends e.ExpNode{constructor(a,
  b){super(a);this._objectClass=this._runtime.GetObjectClassByIndex(b[1]);this._varIndex=b[3];this._returnsString=!!b[2];this._owner._MaybeVaryFor(this._objectClass)}ExpInstVar(){const a=this._objectClass.GetCurrentSol().GetExpressionInstances();var b=a.length;if(0===b)return this._returnsString?"":0;b=WrapIndex(this._owner.GetSolIndex(),b);return a[b]._GetInstanceVariableValueUnchecked(this._varIndex)}ExpInstVar_Family(){var a=this._objectClass,b=a.GetCurrentSol().GetExpressionInstances(),c=b.length;
  if(0===c)return this._returnsString?"":0;c=WrapIndex(this._owner.GetSolIndex(),c);b=b[c];a=b.GetObjectClass().GetFamilyInstanceVariableOffset(a.GetFamilyIndex());return b._GetInstanceVariableValueUnchecked(this._varIndex+a)}ExpInstVar_InstExpr(a){const b=this._objectClass;var c=b.GetInstances();const d=c.length;if(0===d)return this._returnsString?"":0;a=WrapIndex(a,d);c=c[a];a=0;b.IsFamily()&&(a=c.GetObjectClass().GetFamilyInstanceVariableOffset(b.GetFamilyIndex()));return c._GetInstanceVariableValueUnchecked(this._varIndex+
  a)}}class g extends e.ExpNode{constructor(a,b){super(a);this._objectClass=this._runtime.GetObjectClassByIndex(b[1]);this._behaviorType=this._objectClass.GetBehaviorTypeByName(b[2]);this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(b[2]);this._func=this._runtime.GetObjectReference(b[3]);this._returnsString=!!b[4];this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._owner._MaybeVaryFor(this._objectClass)}ExpBehavior(...a){const b=this._objectClass;var c=b.GetCurrentSol().GetExpressionInstances(),
  d=c.length;if(0===d)return this._returnsString?"":0;d=WrapIndex(this._owner.GetSolIndex(),d);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(b);c=c[d];d=0;b.IsFamily()&&(d=c.GetObjectClass().GetFamilyBehaviorOffset(b.GetFamilyIndex()));return this._func.apply(c.GetBehaviorInstances()[this._behaviorIndex+d].GetSdkInstance(),a)}ExpBehavior_InstExpr(a,...b){const c=this._objectClass;var d=c.GetInstances();const f=d.length;if(0===f)return this._returnsString?"":0;a=WrapIndex(a,f);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(c);
  d=d[a];a=0;c.IsFamily()&&(a=d.GetObjectClass().GetFamilyBehaviorOffset(c.GetFamilyIndex()));return this._func.apply(d.GetBehaviorInstances()[this._behaviorIndex+a].GetSdkInstance(),b)}}class l extends e.ExpNode{constructor(a,b){super(a);this._eventVar=null;this._eventVarName=b[1]}_PostInit(){this._eventVar=this._runtime.GetEventSheetManager().GetEventVariableByName(this._eventVarName,this._owner.GetEventBlock());this._eventVarName=null}GetVar(){return this._eventVar}}};
  
  
  // c3/events/parameter.js
  'use strict';{var GetExpressionFunc=function(a){a=self.C3_ExpressionFuncs[a];if(!a)throw Error("invalid expression number");return a};const e=self.C3;e.Parameter=class extends e.DefendedBase{constructor(a,c,b){super();this._owner=a;this._index=b;this._type=c;this.Get=null;this._isConstant=this._variesPerInstance=!1}static Create(a,c,b){const d=c[0];return e.New([f,h,k,g,l,m,n,f,g,g,p,q,k,r,h,t,u,v,w][d],a,d,b,c)}_PostInit(){}SetVariesPerInstance(){this._variesPerInstance=!0}_MaybeVaryFor(a){this._variesPerInstance||
  !a||a.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}};class f extends e.Parameter{constructor(a,c,b,d){super(a,c,b);this._solIndex=0;a=d[1];this._expressionNumber=a[0];this._numberedNodes=[];this._expressionFunc=null;for(let b=1,c=a.length;b<c;++b)this._numberedNodes.push(e.ExpNode.CreateNode(this,
  a[b]));this._numberedNodes.length?this.Get=this.GetExpression:(this.Get=GetExpressionFunc(this._expressionNumber),this._isConstant=!0)}_GetNode(a){if(0>a||a>=this._numberedNodes.length)throw new RangeError("invalid numbered node");return this._numberedNodes[a]}_PostInit(){for(var a of this._numberedNodes)a._PostInit();a=GetExpressionFunc(this._expressionNumber);this._expressionFunc=this._numberedNodes.length?a(this):a}GetSolIndex(){return this._solIndex}GetExpression(a){this._solIndex=a;return this._expressionFunc()}}
  class h extends f{constructor(a,c,b,d){super(a,c,b,d);this.Get=this.GetStringExpression;14===c&&(this.GetEventBlock().SetAllSolModifiers(),this._owner instanceof e.Action&&this.GetEventBlock().SetSolWriterAfterCnds())}GetStringExpression(a){this._solIndex=a;a=this._expressionFunc();return"string"===typeof a?a:""}_GetFastTriggerValue(){return GetExpressionFunc(this._expressionNumber)()}}class m extends f{constructor(a,c,b,d){super(a,c,b,d);this.Get=this.GetLayer;this._isConstant=!1}GetLayer(a){this._solIndex=
  a;a=this._expressionFunc();return this.GetRuntime().GetCurrentLayout().GetLayer(a)}}class g extends e.Parameter{constructor(a,c,b,d){super(a,c,b);this._combo=d[1];this.Get=this.GetCombo;this._isConstant=!0}GetCombo(){return this._combo}}class u extends e.Parameter{constructor(a,c,b,d){super(a,c,b);this._bool=d[1];this.Get=this.GetBoolean;this._isConstant=!0}GetBoolean(){return this._bool}}class l extends e.Parameter{constructor(a,c,b,d){super(a,c,b);this._objectClass=this.GetRuntime().GetObjectClassByIndex(d[1]);
  this.Get=this.GetObjectClass;a=this.GetEventBlock();a._AddSolModifier(this._objectClass);this._owner instanceof e.Action?a.SetSolWriterAfterCnds():a.GetParent()&&a.GetParent().SetSolWriterAfterCnds();this._isConstant=!0}GetObjectClass(){return this._objectClass}}class n extends e.Parameter{constructor(a,c,b,d){super(a,c,b);this._layout=this.GetRuntime().GetLayoutManager().GetLayoutByName(d[1]);this.Get=this.GetLayout;this._isConstant=!0}GetLayout(){return this._layout}}class t extends e.Parameter{constructor(a,
  c,b,d){super(a,c,b);this._timeline=this.GetRuntime().GetTimelineManager().GetTimelineByName(d[1]);this.Get=this.GetTimeline;this._isConstant=!0}GetTimeline(){return this._timeline}}class k extends e.Parameter{constructor(a,c,b,d){super(a,c,b);this._fileInfo=d[1];this.Get=this.GetFile;this._isConstant=!0}GetFile(){return this._fileInfo}}class p extends e.Parameter{constructor(a,c,b,d){super(a,c,b);this._instVarIndex=d[1];(a=this._owner.GetObjectClass())&&a.IsFamily()?(this.Get=this.GetFamilyInstanceVariable,
  this.SetVariesPerInstance()):(this.Get=this.GetInstanceVariable,this._isConstant=!0)}GetInstanceVariable(){return this._instVarIndex}GetFamilyInstanceVariable(a){a=a||0;const c=this._owner.GetObjectClass();var b=c.GetCurrentSol();const d=b.GetInstances();if(d.length)a=d[a%d.length].GetObjectClass();else if(b.HasAnyElseInstances())b=b.GetElseInstances(),a=b[a%b.length].GetObjectClass();else if(0<c.GetInstanceCount())b=c.GetInstances(),a=b[a%b.length].GetObjectClass();else return 0;return this._instVarIndex+
  a.GetFamilyInstanceVariableOffset(c.GetFamilyIndex())}}class q extends e.Parameter{constructor(a,c,b,d){super(a,c,b);this._eventVarName=d[1];this._eventVar=null;this.Get=this.GetEventVariable;this._isConstant=!0}_PostInit(){this._eventVar=this.GetRuntime().GetEventSheetManager().GetEventVariableByName(this._eventVarName,this.GetEventBlock());this._eventVarName=null}GetEventVariable(){return this._eventVar}}class v extends e.Parameter{constructor(a,c,b,d){super(a,c,b);this._functionBlockName=d[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 r extends e.Parameter{constructor(a,c,b,d){super(a,c,b);this._subParams=[];this._variadicRet=[];this._isConstant=!0;for(let b=1,c=d.length;b<c;++b)a=e.Parameter.Create(this._owner,d[b],0),this._subParams.push(a),this._variadicRet.push(0),
  a.IsConstant()||(this._isConstant=!1);this.Get=this.GetVariadic}_PostInit(){for(const a of this._subParams)a._PostInit()}GetVariadic(){const a=this._subParams,c=this._variadicRet;for(let b=0,d=a.length;b<d;++b)c[b]=a[b].Get(0);return c}}class w extends e.Parameter{constructor(a,c,b,d){super(a,c,b);this._easeIndex=d[1];this.Get=this.GetEase;this._isConstant=!0}GetEase(){return this._easeIndex}}};
  
  
  // c3/events/condition.js
  'use strict';{var EvalParams=function(a,b){for(let c=0,f=a.length;c<f;++c)b[c]=a[c].Get(0)};const g=self.C3,y=[],z=function(){};g.Condition=class extends g.DefendedBase{constructor(a,b,c){super();this._eventBlock=a;this._runtime=a.GetRuntime();this._index=c;this._func=this._runtime.GetObjectReference(b[1]);this._isTrigger=0<b[3];this._isFastTrigger=2===b[3];this._isLooping=!!b[4];this._isInverted=!!b[5];this._isStatic=!!b[6];this._sid=b[7];this._isInOrBlock=this._eventBlock.IsOrBlock();this._behaviorType=
  this._objectClass=null;this._behaviorIndex=-1;this._systemPlugin=null;this.DebugRun=this.Run=z;this._parameters=[];this._results=[];this._anyParamVariesPerInstance=!1;this._unsavedData=this._savedData=null;this._debugData=this._runtime.IsDebug()?{isBreakpoint:b[8][0],canDebug:b[8][1]}:null;-1===b[0]?this._systemPlugin=this._runtime.GetSystemPlugin():(this._objectClass=this._runtime.GetObjectClassByIndex(b[0]),b[2]&&(this._behaviorType=this._objectClass.GetBehaviorTypeByName(b[2]),this._behaviorIndex=
  this._objectClass.GetBehaviorIndexByName(b[2])),this._eventBlock.GetParent()&&this._eventBlock.GetParent().SetSolWriterAfterCnds());if(10===b.length){a=b[9];for(let b of a)this._parameters.push(g.Parameter.Create(this,b,this._parameters.length)),this._results.push(0)}0===this._parameters.length&&(this._results=this._parameters=y);this._eventBlock.GetEventSheetManager()._RegisterCondition(this)}static Create(a,b,c){return g.New(g.Condition,a,b,c)}_PostInit(){for(const a of this._parameters)a._PostInit(),
  a.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 a=this._objectClass.GetPlugin(),b=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();this._SetRunMethodForBoundFunc(a,b,this._RunSingleGlobal)}_SetRunMethodForBoundFunc(a,b,c){const f=this._func,e=this._isInverted,d=this._parameters;if(0===d.length){const c=a._GetBoundACEMethod(f,b);this.Run=e?function(){return g.xor(c(),e)}:c}else if(1===d.length){const c=d[0];if(!e&&c.IsConstant())this.Run=a._GetBoundACEMethod_1param(f,
  b,c.Get(0));else{const d=a._GetBoundACEMethod(f,b);this.Run=function(){return g.xor(d(c.Get(0)),e)}}}else if(2===d.length){const c=d[0],h=d[1];if(!e&&c.IsConstant()&&h.IsConstant())this.Run=a._GetBoundACEMethod_2params(f,b,c.Get(0),h.Get(0));else{const d=a._GetBoundACEMethod(f,b);this.Run=function(){return g.xor(d(c.Get(0),h.Get(0)),e)}}}else if(3===d.length){const c=d[0],h=d[1],l=d[2];if(!e&&c.IsConstant()&&h.IsConstant()&&l.IsConstant())this.Run=a._GetBoundACEMethod_3params(f,b,c.Get(0),h.Get(0),
  l.Get(0));else{const d=a._GetBoundACEMethod(f,b);this.Run=function(){return g.xor(d(c.Get(0),h.Get(0),l.Get(0)),e)}}}else this.Run=c}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(a){this._debugData.isBreakpoint=
  !!a;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 a=this._results;EvalParams(this._parameters,a);return g.xor(this._func.apply(this._systemPlugin,
  a),this._isInverted)}*_DebugRunSystem(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var a=this._results;EvalParams(this._parameters,a);a=this._func.apply(this._systemPlugin,a);g.IsIterator(a)&&(a=yield*a);return g.xor(a,this._isInverted)}return this.Run()}_RunSingleGlobal(){const a=this._results;EvalParams(this._parameters,a);const b=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();return g.xor(this._func.apply(b,a),this._isInverted)}*_DebugRunSingleGlobal(){if(this.IsBreakpoint()||
  this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var a=this._results;EvalParams(this._parameters,a);const b=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();a=this._func.apply(b,a);g.IsIterator(a)&&(a=yield*a);return g.xor(a,this._isInverted)}return this.Run()}_RunFastTrigger(){return!0}*_DebugRunFastTrigger(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return!0}_RunStatic(){var a=this._results;EvalParams(this._parameters,a);a=this._func.apply(this._behaviorType||
  this._objectClass,a);this._objectClass.ApplySolToContainer();return a}*_DebugRunStatic(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var a=this._results;EvalParams(this._parameters,a);a=this._func.apply(this._behaviorType||this._objectClass,a);g.IsIterator(a)&&(a=yield*a);this._objectClass.ApplySolToContainer();return a}return this.Run()}_RunObject(){const a=this._parameters,b=this._results,c=this._objectClass.GetCurrentSol();for(let c=0,e=a.length;c<
  e;++c){const d=a[c];d.VariesPerInstance()||(b[c]=d.Get(0))}return c.IsSelectAll()?this._RunObject_FirstFilter(c):this._RunObject_NextFilter(c)}*_DebugRunObject(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return this._RunObject()}_EvaluateVaryingParameters(a){const b=this._parameters,c=this._results;for(let f=0,e=b.length;f<e;++f){const d=b[f];d.VariesPerInstance()&&(c[f]=d.Get(a))}}_RunObject_FirstFilter(a){const b=this._objectClass,c=b.IsFamily(),f=b.GetFamilyIndex(),e=this._behaviorIndex,
  d=0<=e,t=b.GetInstances(),h=this._anyParamVariesPerInstance,l=this._results,k=this._func,p=this._isInverted,q=this._isInOrBlock&&!this._isTrigger;a.ClearArrays();for(let b=0,u=t.length;b<u;++b){const m=t[b];h&&this._EvaluateVaryingParameters(b);var n=void 0;d?(n=c?m.GetObjectClass().GetFamilyBehaviorOffset(f):0,n=k.apply(m.GetBehaviorInstances()[e+n].GetSdkInstance(),l)):n=k.apply(m.GetSdkInstance(),l);g.xor(n,p)?a._PushInstance(m):q&&a._PushElseInstance(m)}b.FinishCondition(!0);a._SetSelectAll(!1);
  b.ApplySolToContainer();return a.HasAnyInstances()}_RunObject_NextFilter(a){const b=this._objectClass;var c=b.IsFamily();const f=b.GetFamilyIndex(),e=b.IsInContainer(),d=this._behaviorIndex,t=0<=d,h=this._anyParamVariesPerInstance,l=this._results,k=this._func,p=this._isInverted,q=this._isInOrBlock&&!this._isTrigger,n=a._GetOwnInstances(),x=a._GetOwnElseInstances(),u=q&&!this._eventBlock.IsFirstConditionOfType(this),m=u?x:n;let r=0,v=!1;for(let a=0,b=m.length;a<b;++a){const b=m[a];h&&this._EvaluateVaryingParameters(a);
  var w=void 0;t?(w=c?b.GetObjectClass().GetFamilyBehaviorOffset(f):0,w=k.apply(b.GetBehaviorInstances()[d+w].GetSdkInstance(),l)):w=k.apply(b.GetSdkInstance(),l);g.xor(w,p)?(v=!0,u?(n.push(b),e&&b._PushSiblingsToSolInstances()):(m[r]=b,e&&b._SetSiblingsToSolInstancesIndex(r),++r)):u?(m[r]=b,e&&b._SetSiblingsToSolElseInstancesIndex(r),++r):q&&(x.push(b),e&&b._PushSiblingsToSolElseInstances())}g.truncateArray(m,r);e&&b._TruncateContainerSols(u,r);c=v;u&&!v&&(v=this._OrBlockCheckInstances(n));b.FinishCondition(c||
  q);return q?v:a.HasAnyInstances()}_OrBlockCheckInstances(a){var b=this._objectClass;const c=b.IsFamily();b=b.GetFamilyIndex();const f=this._anyParamVariesPerInstance,e=this._behaviorIndex,d=0<=e,t=this._results,h=this._func,l=this._isInverted;for(let p=0,q=a.length;p<q;++p){var k=a[p];f&&this._EvaluateVaryingParameters(p);if(d){const a=c?k.GetObjectClass().GetFamilyBehaviorOffset(b):0;k=h.apply(k.GetBehaviorInstances()[e+a].GetSdkInstance(),t)}else k=h.apply(k.GetSdkInstance(),t);if(g.xor(k,l))return!0}return!1}ReevaluateParameter(a,
  b){return this._parameters[a].Get(b)}GetFastTriggerValue(){const a=this._parameters;if(!a.length)throw Error("no parameters");return a[0]._GetFastTriggerValue()}_SaveToJson(){if(!this._savedData||!this._savedData.size)return null;const a={};for(const [b,c]of this._savedData.entries()){let f=c;"collmemory"===b&&(f=[...c.entries()].map(a=>[a[0].GetUID(),a[1].GetUID(),a[2]]));a[b]=f}return{ex:a}}_LoadFromJson(a){const b=this._runtime;var c=a.ex;if(c){a=this.GetSavedDataMap();a.clear();for(const [f,e]of Object.entries(c))c=
  e,"collmemory"===f&&(c=g.New(g.PairMap,e.map(a=>[b.GetInstanceByUID(a[0]),b.GetInstanceByUID(a[1]),a[2]]).filter(a=>a[0]&&a[1]))),a.set(f,c)}else this._savedData&&(this._savedData.clear(),this._savedData=null)}}};
  
  
  // c3/events/action.js
  'use strict';{var EvalParams=function(a,c){for(let b=0,d=a.length;b<d;++b)c[b]=a[b].Get(0)};const h=self.C3,q=[],p=function(){},r=function*(){};h.Action=class extends h.DefendedBase{constructor(a,c,b){super();this._eventBlock=a;this._runtime=a=a.GetRuntime();this._index=b;this._sid=4<=c.length?c[3]:-1;this._actionReturnType=5<=c.length?c[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=p;this._parameters=[];this._results=[];this._anyParamVariesPerInstance=!1;this._unsavedData=this._savedData=null;const d=(b=-3===c[0])?c[2]:c[5];this._debugData=a.IsDebug()||b?{isBreakpoint:d[0],canDebug:d[1],index:d[2]}:null;-1===c[0]?(this._systemPlugin=a.GetSystemPlugin(),this._func=a.GetObjectReference(c[1])):-2===c[0]?this._callFunctionName=c[1]:b?(this._func=a.GetObjectReference(c[1]),this.Run=this.RunUserScript,this.DebugRun=this.DebugRunUserScript,this._actionReturnType=
  1):(this._func=a.GetObjectReference(c[1]),this._objectClass=a.GetObjectClassByIndex(c[0]),c[2]&&(this._behaviorType=this._objectClass.GetBehaviorTypeByName(c[2]),this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(c[2])));if(7===c.length){c=c[6];for(const a of c)this._parameters.push(h.Parameter.Create(this,a,this._parameters.length)),this._results.push(0)}0===this._parameters.length&&(this._results=this._parameters=q);this._eventBlock.GetEventSheetManager()._RegisterAction(this)}static Create(a,
  c,b){return h.New(h.Action,a,c,b)}_PostInit(){for(var a of this._parameters)a._PostInit(),a.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){a=this._func;const c=this._runtime.GetEventSheetManager()._GetLocalVariablesScriptInterface(this._eventBlock);this._func=a.bind(null,this._runtime.GetIRuntime(),
  c)}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(a=>a.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(a=>a.IsConstant())?(EvalParams(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 a=this._objectClass.GetPlugin(),c=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();this._SetRunMethodForBoundFunc(a,c,this._RunSingleGlobal)}_SetCallFunctionRunMethod(){const a=this._eventBlock.GetEventSheetManager(),c=a.GetFunctionBlockByName(this._callFunctionName);c.IsEnabled()?(this._callEventBlock=c.GetEventBlock(),this._combinedSolModifiers=[...new Set([...this._eventBlock.GetSolModifiersIncludingParents(),...this._callEventBlock.GetSolModifiersIncludingParents()])],
  this._combinedSolModifiers=a._DeduplicateSolModifierList(this._combinedSolModifiers),this.Run=h.EventBlock.prototype.RunAsFunctionCall.bind(this._callEventBlock,this._combinedSolModifiers,this._parameters),this.DebugRun=this._DebugRunCallFunction):(this.Run=p,this.DebugRun=r)}_SetRunMethodForBoundFunc(a,c,b){const d=this._func,f=this._parameters;if(0===f.length)this.Run=a._GetBoundACEMethod(d,c);else if(1===f.length){const e=f[0];if(e.IsConstant())this.Run=a._GetBoundACEMethod_1param(d,c,e.Get(0));
  else{const b=a._GetBoundACEMethod(d,c);this.Run=function(){return b(e.Get(0))}}}else if(2===f.length){const e=f[0],b=f[1];if(e.IsConstant()&&b.IsConstant())this.Run=a._GetBoundACEMethod_2params(d,c,e.Get(0),b.Get(0));else{const f=a._GetBoundACEMethod(d,c);this.Run=function(){return f(e.Get(0),b.Get(0))}}}else if(3===f.length){const b=f[0],g=f[1],k=f[2];if(b.IsConstant()&&g.IsConstant()&&k.IsConstant())this.Run=a._GetBoundACEMethod_3params(d,c,b.Get(0),g.Get(0),k.Get(0));else{const e=a._GetBoundACEMethod(d,
  c);this.Run=function(){return e(b.Get(0),g.Get(0),k.Get(0))}}}else this.Run=b}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(a){this._debugData.isBreakpoint=
  !!a;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 a=this._results;EvalParams(this._parameters,a);return this._func.apply(this._systemPlugin,
  a)}*_DebugRunSystem(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const a=this._results;EvalParams(this._parameters,a);return yield*this._func.apply(this._systemPlugin,a)}return this.Run()}*_DebugRunCallFunction(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return yield*this._callEventBlock.DebugRunAsFunctionCall(this._combinedSolModifiers,this._parameters)}_RunSingleGlobal(){const a=this._results;EvalParams(this._parameters,
  a);return this._func.apply(this._objectClass.GetSingleGlobalInstance().GetSdkInstance(),a)}*_DebugRunSingleGlobal(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const a=this._results;EvalParams(this._parameters,a);return yield*this._func.apply(this._objectClass.GetSingleGlobalInstance().GetSdkInstance(),a)}return this.Run()}_RunObject_ParamsConst(){const a=this._results,c=this._objectClass.GetCurrentSol().GetInstances();for(let b=0,d=c.length;b<
  d;++b)this._func.apply(c[b].GetSdkInstance(),a)}*_DebugRunObject_ParamsConst(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const a=this._results,c=this._objectClass.GetCurrentSol().GetInstances();for(let b=0,d=c.length;b<d;++b)yield*this._func.apply(c[b].GetSdkInstance(),a)}else this._RunObject_ParamsConst()}_RunObject_ParamsDontVary(){const a=this._results;EvalParams(this._parameters,a);const c=this._objectClass.GetCurrentSol().GetInstances();
  for(let b=0,d=c.length;b<d;++b)this._func.apply(c[b].GetSdkInstance(),a)}*_DebugRunObject_ParamsDontVary(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const a=this._results;EvalParams(this._parameters,a);const c=this._objectClass.GetCurrentSol().GetInstances();for(let b=0,d=c.length;b<d;++b)yield*this._func.apply(c[b].GetSdkInstance(),a)}else this._RunObject_ParamsDontVary()}_RunObject_AllParamsVary(){const a=this._parameters,c=this._results,
  b=this._func,d=this._objectClass.GetCurrentSol().GetInstances();for(let f=0,e=d.length;f<e;++f){const e=d[f];for(let b=0,e=a.length;b<e;++b)c[b]=a[b].Get(f);b.apply(e.GetSdkInstance(),c)}}*_DebugRunObject_AllParamsVary(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const a=this._parameters,c=this._results,b=this._func,d=this._objectClass.GetCurrentSol().GetInstances();for(let f=0,e=d.length;f<e;++f){const e=d[f];for(let b=0,e=a.length;b<e;++b)c[b]=
  a[b].Get(f);yield*b.apply(e.GetSdkInstance(),c)}}else this._RunObject_AllParamsVary()}_RunObject_SomeParamsVary(){const a=this._parameters,c=this._results,b=this._func,d=this._objectClass.GetCurrentSol().GetInstances();for(let b=0,d=a.length;b<d;++b){var f=a[b];f.VariesPerInstance()||(c[b]=f.Get(0))}for(let e=0,g=d.length;e<g;++e){f=d[e];for(let b=0,d=a.length;b<d;++b){const d=a[b];d.VariesPerInstance()&&(c[b]=d.Get(e))}b.apply(f.GetSdkInstance(),c)}}*_DebugRunObject_SomeParamsVary(){if(this.IsBreakpoint()||
  this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const c=this._parameters,b=this._results,d=this._func,f=this._objectClass.GetCurrentSol().GetInstances();for(let e=0,d=c.length;e<d;++e){var a=c[e];a.VariesPerInstance()||(b[e]=a.Get(0))}for(let e=0,g=f.length;e<g;++e){a=f[e];for(let a=0,d=c.length;a<d;++a){const d=c[a];d.VariesPerInstance()&&(b[a]=d.Get(e))}yield*d.apply(a.GetSdkInstance(),b)}}else this._RunObject_SomeParamsVary()}_RunBehavior(){var a=this._objectClass;const c=
  a.IsFamily(),b=a.GetFamilyIndex(),d=this._parameters,f=this._anyParamVariesPerInstance,e=this._results,g=this._func,k=this._behaviorIndex;a=a.GetCurrentSol().GetInstances();for(let a=0,c=d.length;a<c;++a){var l=d[a];l.VariesPerInstance()||(e[a]=l.Get(0))}for(let n=0,h=a.length;n<h;++n){l=a[n];if(f)for(let a=0,c=d.length;a<c;++a){var m=d[a];m.VariesPerInstance()&&(e[a]=m.Get(n))}m=c?l.GetObjectClass().GetFamilyBehaviorOffset(b):0;g.apply(l.GetBehaviorInstances()[k+m].GetSdkInstance(),e)}}*_DebugRunBehavior(){if(this.IsBreakpoint()||
  this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var a=this._objectClass;const d=a.IsFamily(),f=a.GetFamilyIndex(),e=this._parameters,g=this._anyParamVariesPerInstance,k=this._results,l=this._func,m=this._behaviorIndex;a=a.GetCurrentSol().GetInstances();for(let a=0,b=e.length;a<b;++a){var c=e[a];c.VariesPerInstance()||(k[a]=c.Get(0))}for(let n=0,h=a.length;n<h;++n){c=a[n];if(g)for(let a=0,c=e.length;a<c;++a){var b=e[a];b.VariesPerInstance()&&(k[a]=b.Get(n))}b=d?c.GetObjectClass().GetFamilyBehaviorOffset(f):
  0;yield*l.apply(c.GetBehaviorInstances()[m+b].GetSdkInstance(),k)}}else this._RunBehavior()}_RunObject_Async(){const a=this._parameters,c=this._results,b=this._func,d=this._objectClass.GetCurrentSol().GetInstances(),f=[];for(let e=0,g=d.length;e<g;++e){const g=d[e];for(let b=0,d=a.length;b<d;++b)c[b]=a[b].Get(e);f.push(b.apply(g.GetSdkInstance(),c))}return Promise.all(f)}*_DebugRunObject_Async(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const a=
  this._parameters,c=this._results,b=this._func,d=this._objectClass.GetCurrentSol().GetInstances(),f=[];for(let e=0,g=d.length;e<g;++e){const g=d[e];for(let b=0,d=a.length;b<d;++b)c[b]=a[b].Get(e);f.push(yield*b.apply(g.GetSdkInstance(),c))}return Promise.all(f)}return this._RunObject_Async()}_RunBehavior_Async(){var a=this._objectClass;const c=a.IsFamily(),b=a.GetFamilyIndex(),d=this._parameters,f=this._results,e=this._func,g=this._behaviorIndex;a=a.GetCurrentSol().GetInstances();const k=[];for(let l=
  0,h=a.length;l<h;++l){const h=a[l];for(let a=0,b=d.length;a<b;++a)f[a]=d[a].Get(l);const m=c?h.GetObjectClass().GetFamilyBehaviorOffset(b):0;k.push(e.apply(h.GetBehaviorInstances()[g+m].GetSdkInstance(),f))}return Promise.all(k)}*_DebugRunBehavior_Async(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var a=this._objectClass;const c=a.IsFamily(),b=a.GetFamilyIndex(),d=this._parameters,f=this._results,e=this._func,g=this._behaviorIndex;a=a.GetCurrentSol().GetInstances();
  const h=[];for(let l=0,k=a.length;l<k;++l){const k=a[l];for(let a=0,b=d.length;a<b;++a)f[a]=d[a].Get(l);const m=c?k.GetObjectClass().GetFamilyBehaviorOffset(b):0;h.push(yield*e.apply(k.GetBehaviorInstances()[g+m].GetSdkInstance(),f))}return Promise.all(h)}return this._RunBehavior_Async()}async RunUserScript(){try{await this._func()}catch(a){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;",a),self.C3Debugger&&self.C3Debugger._SetLastErrorScript(this),h.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"),h.EventScript.SetHadUserScriptException())}}*DebugRunUserScript(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return this.RunUserScript()}_SaveToJson(){return this._savedData&&
  this._savedData.size?{ex:h.ToSuperJSON(this._savedData)}:null}_LoadFromJson(a){this._savedData&&(this._savedData.clear(),this._savedData=null);if(a=a.ex)this._savedData=h.FromSuperJSON(a)}}};
  
  
  // c3/events/commonACEs.js
  'use strict';{var GetUID=function(){return this._inst.GetUID()},GetIID=function(){return this._inst.GetIID()},PickedCount=function(){return this._runtime.GetCurrentEventStackFrame().GetExpressionObjectClass().GetCurrentSol().GetInstances().length},Count=function(){const a=this._runtime.GetCurrentEventStackFrame().GetExpressionObjectClass();let b=a.GetInstanceCount();const c=this._runtime._GetInstancesPendingCreate();for(const d of c)a.IsFamily()?d.GetObjectClass().BelongsToFamily(a)&&++b:d.GetObjectClass()===
  a&&++b;return b},ObjectTypeName=function(){return this.GetInstance().GetObjectClass().GetName()},AsJSON=function(){return JSON.stringify(this.GetInstance().SaveToJson("state"))},LoadFromJsonString=function(a){let b;try{b=JSON.parse(a)}catch(c){console.error("Failed to load from JSON string: ",c);return}this.GetInstance().LoadFromJson(b,"state")},ToggleBoolInstanceVar=function(a){const b=this.GetInstance();b.SetInstanceVariableValue(a,0===b.GetInstanceVariableValue(a)?1:0)},SetBoolInstanceVar=function(a,
  b){this.GetInstance().SetInstanceVariableValue(a,b?1:0)},SubInstanceVar=function(a,b){const c=this.GetInstance(),d=c.GetInstanceVariableValue(a);"number"===typeof d&&("number"!==typeof b&&(b=parseFloat(b)),c.SetInstanceVariableValue(a,d-b))},AddInstanceVar=function(a,b){const c=this.GetInstance(),d=c.GetInstanceVariableValue(a);"number"===typeof d&&"number"!==typeof b?b=parseFloat(b):"string"===typeof d&&"string"!==typeof b&&(b=b.toString());c.SetInstanceVariableValue(a,d+b)},SetInstanceVar=function(a,
  b){this.GetInstance().SetInstanceVariableValue(a,b)},OnDestroyed=function(){return!0},OnCreated=function(){return!0},Destroy=function(){this._runtime.DestroyInstance(this._inst)},PickByUID_Inverted=function(a,b){const c=a.GetCurrentSol();if(c.IsSelectAll()){c._SetSelectAll(!1);c.ClearArrays();var d=a.GetInstances();for(let a=0,e=d.length;a<e;++a){var g=d[a];g.GetUID()===b?c._PushElseInstance(g):c._PushInstance(g)}a.ApplySolToContainer();return!!c._GetOwnInstances().length}d=c._GetOwnInstances();g=
  0;for(let a=0,e=d.length;a<e;++a){const e=d[a];d[g]=e;e.GetUID()===b?c._PushElseInstance(e):++g}e.truncateArray(d,g);a.ApplySolToContainer();return!!d.length},PickByUID_Normal=function(a,b){b=a.GetRuntime().GetInstanceByUID(b);if(!b)return!1;const c=a.GetCurrentSol();if(!c.IsSelectAll()&&!c._GetOwnInstances().includes(b))return!1;if(a.IsFamily()){if(b.GetObjectClass().BelongsToFamily(a))return c.PickOne(b),a.ApplySolToContainer(),!0}else if(b.GetObjectClass()===a)return c.PickOne(b),a.ApplySolToContainer(),
  !0;return!1},PickByUID=function(a){return this._runtime.GetCurrentCondition().IsInverted()?PickByUID_Inverted(this,a):PickByUID_Normal(this,a)},PickInstVarHiLow=function(a,b){const c=this.GetCurrentSol(),d=c.GetInstances();if(!d.length)return!1;let g=d[0],k=g,l=g.GetInstanceVariableValue(b);for(let c=1,e=d.length;c<e;++c){g=d[c];const e=g.GetInstanceVariableValue(b);if(0===a&&e<l||1===a&&e>l)l=e,k=g}c.PickOne(k);return!0},IsBoolInstanceVarSet=function(a){return!!this.GetInstance().GetInstanceVariableValue(a)},
  CompareInstanceVar=function(a,b,c){return e.compare(this.GetInstance().GetInstanceVariableValue(a),b,c)},SetEffectParam=function(a,b,c){var d=this.GetObjectClass().GetEffectList().GetEffectTypeByName(a);if(d){a=d.GetIndex();var g=this.GetWorldInfo().GetInstanceEffectList(),k=g.GetEffectParametersForIndex(a);b=Math.floor(b);if(!(0>b||b>=k.length)){d=d.GetShaderProgram().GetParameterType(b);if("color"===d){m.setFromRgbValue(c);b=k[b];if(m.equalsIgnoringAlpha(b))return;b.copyRgb(m)}else{"percent"===
  d&&(c/=100);if(k[b]===c)return;k[b]=c}g.IsEffectIndexActive(a)&&this._runtime.UpdateRender()}}},SetEffectEnabled=function(a,b){if(b=this.GetObjectClass().GetEffectList().GetEffectTypeByName(b)){b=b.GetIndex();a=1===a;var c=this.GetWorldInfo().GetInstanceEffectList();c.IsEffectIndexActive(b)!==a&&(c.SetEffectIndexActive(b,a),c.UpdateActiveEffects(),this._runtime.UpdateRender())}},TotalZElevation=function(){return this.GetWorldInfo().GetTotalZElevation()},ZElevation=function(){return this.GetWorldInfo().GetZElevation()},
  ZIndex=function(){return this.GetWorldInfo().GetZIndex()},LayerName=function(){return this.GetWorldInfo().GetLayer().GetName()},LayerNumber=function(){return this.GetWorldInfo().GetLayer().GetIndex()},SetZElevation=function(a){const b=this.GetWorldInfo();b.GetZElevation()!==a&&(b.SetZElevation(a),this._runtime.UpdateRender())},ZMoveToObject=function(a,b){a=0===a;b&&(b=b.GetFirstPicked(this.GetInstance()))&&this.GetWorldInfo().ZOrderMoveAdjacentToInstance(b,a)},MoveToLayer=function(a){a&&this.GetWorldInfo().ZOrderMoveToLayer(a)},
  MoveToBottom=function(){this.GetWorldInfo().ZOrderMoveToBottom()},MoveToTop=function(){this.GetWorldInfo().ZOrderMoveToTop()},CompareZElevation=function(a,b,c){const d=this.GetWorldInfo();a=0===a?d.GetZElevation():d.GetTotalZElevation();return e.compare(a,b,c)},PickTopBottom=function(a){const b=this.GetCurrentSol(),c=b.GetInstances();if(!c.length)return!1;let d=c[0];for(let b=1,e=c.length;b<e;++b){const e=c[b],g=e.GetWorldInfo(),h=d.GetWorldInfo(),f=g.GetLayer().GetIndex(),k=h.GetLayer().GetIndex();
  if(0===a){if(f>k||f===k&&g.GetZIndex()>h.GetZIndex())d=e}else if(f<k||f===k&&g.GetZIndex()<h.GetZIndex())d=e}b.PickOne(d);return!0},IsOnLayer=function(a){return a?this.GetWorldInfo().GetLayer()===a:!1},GetOpacity=function(){return e.round6dp(100*this.GetWorldInfo().GetOpacity())},GetColor=function(){const a=this.GetWorldInfo().GetUnpremultipliedColor();return e.PackRGBAEx(a.getR(),a.getG(),a.getB(),a.getA())},SetDefaultColor=function(a){m.setFromRgbValue(a);a=this.GetWorldInfo();a.GetUnpremultipliedColor().equalsIgnoringAlpha(m)||
  (a.SetUnpremultipliedColor(m),this._runtime.UpdateRender())},SetOpacity=function(a){a=e.clamp(a/100,0,1);const b=this.GetWorldInfo();b.GetOpacity()!==a&&(b.SetOpacity(a),this._runtime.UpdateRender())},SetVisible=function(a){const b=this.GetWorldInfo();a=2===a?!b.IsVisible():0!==a;b.IsVisible()!==a&&(b.SetVisible(a),this._runtime.UpdateRender())},IsVisible=function(){return this.GetWorldInfo().IsVisible()},CompareOpacity=function(a,b){return e.compare(e.round6dp(100*this.GetWorldInfo().GetOpacity()),
  a,b)},GetAngle=function(){return e.toDegrees(this.GetWorldInfo().GetAngle())},SetTowardPosition=function(a,b){const c=this.GetWorldInfo(),d=c.GetAngle();a-=c.GetX();b-=c.GetY();b=Math.atan2(b,a);isNaN(b)||d===b||(c.SetAngle(b),c.SetBboxChanged())},RotateTowardPosition=function(a,b,c){const d=this.GetWorldInfo(),g=d.GetAngle();b-=d.GetX();c-=d.GetY();a=e.angleRotate(g,Math.atan2(c,b),e.toRadians(a));isNaN(a)||g===a||(d.SetAngle(a),d.SetBboxChanged())},RotateTowardAngle=function(a,b){const c=this.GetWorldInfo(),
  d=c.GetAngle();a=e.angleRotate(d,e.toRadians(b),e.toRadians(a));isNaN(a)||d===a||(c.SetAngle(a),c.SetBboxChanged())},RotateCounterclockwise=function(a){if(!isNaN(a)&&0!==a){var b=this.GetWorldInfo();b.SetAngle(b.GetAngle()-e.toRadians(a));b.SetBboxChanged()}},RotateClockwise=function(a){if(!isNaN(a)&&0!==a){var b=this.GetWorldInfo();b.SetAngle(b.GetAngle()+e.toRadians(a));b.SetBboxChanged()}},SetAngle=function(a){const b=this.GetWorldInfo();a=e.clampAngle(e.toRadians(a));isNaN(a)||b.GetAngle()===
  a||(b.SetAngle(a),b.SetBboxChanged())},IsBetweenAngles=function(a,b){a=e.toRadians(a);b=e.toRadians(b);const c=this.GetWorldInfo().GetAngle();return e.angleClockwise(b,a)?e.angleClockwise(c,a)&&!e.angleClockwise(c,b):!(!e.angleClockwise(c,a)&&e.angleClockwise(c,b))},IsAngleClockwiseFrom=function(a){return e.angleClockwise(this.GetWorldInfo().GetAngle(),e.toRadians(a))},IsAngleWithin=function(a,b){return e.angleDiff(this.GetWorldInfo().GetAngle(),e.toRadians(b))<=e.toRadians(a)},GetBboxBottom=function(){return this.GetWorldInfo().GetBoundingBox().getBottom()},
  GetBboxRight=function(){return this.GetWorldInfo().GetBoundingBox().getRight()},GetBboxTop=function(){return this.GetWorldInfo().GetBoundingBox().getTop()},GetBboxLeft=function(){return this.GetWorldInfo().GetBoundingBox().getLeft()},GetHeight=function(){return this.GetWorldInfo().GetHeight()},GetWidth=function(){return this.GetWorldInfo().GetWidth()},SetSize=function(a,b){const c=this.GetWorldInfo();if(c.GetWidth()!==a||c.GetHeight()!==b)c.SetSize(a,b),c.SetBboxChanged()},SetHeight=function(a){const b=
  this.GetWorldInfo();b.GetHeight()!==a&&(b.SetHeight(a),b.SetBboxChanged())},SetWidth=function(a){const b=this.GetWorldInfo();b.GetWidth()!==a&&(b.SetWidth(a),b.SetBboxChanged())},CompareHeight=function(a,b){return e.compare(this.GetWorldInfo().GetHeight(),a,b)},CompareWidth=function(a,b){return e.compare(this.GetWorldInfo().GetWidth(),a,b)},GetDt=function(){return this._runtime.GetDt(this._inst)},GetY=function(){return this.GetWorldInfo().GetY()},GetX=function(){return this.GetWorldInfo().GetX()},
  MoveAtAngle=function(a,b){if(0!==b){var c=this.GetWorldInfo();a=e.toRadians(a);c.OffsetXY(Math.cos(a)*b,Math.sin(a)*b);c.SetBboxChanged()}},MoveForward=function(a){if(0!==a){var b=this.GetWorldInfo();b.OffsetXY(b.GetCosAngle()*a,b.GetSinAngle()*a);b.SetBboxChanged()}},SetPosToObject=function(a,b){if(a&&(a=a.GetPairedInstance(this._inst))){var [c,d]=a.GetImagePoint(b);b=this.GetWorldInfo();if(b.GetX()!==c||b.GetY()!==d)b.SetXY(c,d),b.SetBboxChanged()}},SetPos=function(a,b){const c=this.GetWorldInfo();
  c.EqualsXY(a,b)||(c.SetXY(a,b),c.SetBboxChanged())},SetY=function(a){const b=this.GetWorldInfo();b.GetY()!==a&&(b.SetY(a),b.SetBboxChanged())},SetX=function(a){const b=this.GetWorldInfo();b.GetX()!==a&&(b.SetX(a),b.SetBboxChanged())},PickDistance=function(a,b,c){const d=this.GetCurrentSol(),g=d.GetInstances();if(!g.length)return!1;let k=g[0];var l=k.GetWorldInfo();let n=k,h=e.distanceSquared(l.GetX(),l.GetY(),b,c);for(let d=1,m=g.length;d<m;++d)if(k=g[d],l=k.GetWorldInfo(),l=e.distanceSquared(l.GetX(),
  l.GetY(),b,c),0===a&&l<h||1===a&&l>h)h=l,n=k;d.PickOne(n);return!0},IsOutsideLayout=function(){var a=this.GetWorldInfo();const b=a.GetLayout();a=a.GetBoundingBox();return 0>a.getRight()||0>a.getBottom()||a.getLeft()>b.GetWidth()||a.getTop()>b.GetHeight()},IsOnScreen=function(){const a=this.GetWorldInfo();return a.IsInViewport(a.GetLayer().GetViewport())},CompareY=function(a,b){return e.compare(this.GetWorldInfo().GetY(),a,b)},CompareX=function(a,b){return e.compare(this.GetWorldInfo().GetX(),a,b)};
  const e=self.C3,m=new e.Color;e.AddCommonACEs=function(a,b){const c=a[1],d=a[4],g=a[5],k=a[6],l=a[7],n=a[8],h=b.Cnds,f=b.Acts;b=b.Exps;a[3]&&(h.CompareX=CompareX,h.CompareY=CompareY,h.IsOnScreen=IsOnScreen,h.IsOutsideLayout=IsOutsideLayout,h.PickDistance=PickDistance,f.SetX=SetX,f.SetY=SetY,f.SetPos=SetPos,f.SetPosToObject=SetPosToObject,f.MoveForward=MoveForward,f.MoveAtAngle=MoveAtAngle,b.X=GetX,b.Y=GetY,b.dt=GetDt);d&&(h.CompareWidth=CompareWidth,h.CompareHeight=CompareHeight,f.SetWidth=SetWidth,
  f.SetHeight=SetHeight,f.SetSize=SetSize,b.Width=GetWidth,b.Height=GetHeight,b.BBoxLeft=GetBboxLeft,b.BBoxTop=GetBboxTop,b.BBoxRight=GetBboxRight,b.BBoxBottom=GetBboxBottom);g&&(h.AngleWithin=IsAngleWithin,h.IsClockwiseFrom=IsAngleClockwiseFrom,h.IsBetweenAngles=IsBetweenAngles,f.SetAngle=SetAngle,f.RotateClockwise=RotateClockwise,f.RotateCounterclockwise=RotateCounterclockwise,f.RotateTowardAngle=RotateTowardAngle,f.RotateTowardPosition=RotateTowardPosition,f.SetTowardPosition=SetTowardPosition,b.Angle=
  GetAngle);k&&(h.IsVisible=IsVisible,h.CompareOpacity=CompareOpacity,f.SetVisible=SetVisible,f.SetOpacity=SetOpacity,f.SetDefaultColor=SetDefaultColor,b.Opacity=GetOpacity,b.ColorValue=GetColor);l&&(h.IsOnLayer=IsOnLayer,h.PickTopBottom=PickTopBottom,h.CompareZElevation=CompareZElevation,f.MoveToTop=MoveToTop,f.MoveToBottom=MoveToBottom,f.MoveToLayer=MoveToLayer,f.ZMoveToObject=ZMoveToObject,f.SetZElevation=SetZElevation,b.LayerNumber=LayerNumber,b.LayerName=LayerName,b.ZIndex=ZIndex,b.ZElevation=
  ZElevation,b.TotalZElevation=TotalZElevation);n&&(f.SetEffectEnabled=SetEffectEnabled,f.SetEffectParam=SetEffectParam);c||(h.CompareInstanceVar=CompareInstanceVar,h.IsBoolInstanceVarSet=IsBoolInstanceVarSet,h.PickInstVarHiLow=PickInstVarHiLow,h.PickByUID=PickByUID,f.SetInstanceVar=SetInstanceVar,f.AddInstanceVar=AddInstanceVar,f.SubInstanceVar=SubInstanceVar,f.SetBoolInstanceVar=SetBoolInstanceVar,f.ToggleBoolInstanceVar=ToggleBoolInstanceVar,h.OnCreated=OnCreated,h.OnDestroyed=OnDestroyed,f.Destroy=
  Destroy,f.LoadFromJsonString||(f.LoadFromJsonString=LoadFromJsonString),b.AsJSON||(b.AsJSON=AsJSON),b.Count=Count,b.PickedCount=PickedCount,b.IID=GetIID,b.UID=GetUID,b.ObjectTypeName=ObjectTypeName)}};
  
  
  // c3/events/scheduledWait.js
  'use strict';{const d=self.C3;d.ScheduledWait=class extends d.DefendedBase{constructor(a){super();this._eventSheetManager=a;this._type="";this._time=-1;this._signalTag="";this._isSignalled=!1;this._event=null;this._actIndex=0;this._solModifiers=[];this._sols=new Map;this._callingFunctionBlock=null;this._asyncId=-1;this._functionParameters=null;this._shouldRelease=!1}Release(){this._type="";this._time=-1;this._signalTag="";this._functionParameters=this._callingFunctionBlock=this._event=null;this._asyncId=
  -1;d.clearArray(this._solModifiers);for(const a of this._sols.values())a.Release();this._sols.clear()}_Init(){var a=this._eventSheetManager,b=a.GetRuntime().GetAllObjectClasses();const e=a.GetCurrentEventStackFrame();this._event=e.GetCurrentEvent();this._actIndex=e.GetActionIndex()+1;if(a=a.FindFirstFunctionBlockParent(this._event))this._callingFunctionBlock=a,this._functionParameters=a.CaptureFunctionParameters(),a.IsAsync()&&(this._asyncId=a.PauseCurrentAsyncFunction());for(const a of b)if(b=a.GetCurrentSol(),
  !b.IsSelectAll()||this._event.HasSolModifier(a))this._solModifiers.push(a),this._sols.set(a,d.New(d.SolState,b))}InitTimer(a){this._type="timer";this._Init();this._time=this._eventSheetManager.GetRuntime().GetGameTime()+a}InitSignal(a){this._type="signal";this._Init();this._signalTag=a.toLowerCase()}InitPromise(a){this._type="promise";this._Init();a.then(()=>this.SetSignalled()).catch(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(a){a._Restore(this._event,this._actIndex);for(const [b,e]of this._sols.entries())a=b.GetCurrentSol(),e._Restore(a);if(a=this._callingFunctionBlock)a.SetFunctionParameters(this._functionParameters),
  a.IsAsync()&&a.ResumeAsyncFunction(this._asyncId)}_Run(a){this._RestoreState(a);this._event._ResumeActionsAndSubEvents(a);this._callingFunctionBlock&&this._callingFunctionBlock.IsAsync()&&this._callingFunctionBlock.MaybeFinishAsyncFunctionCall(this._asyncId);this._eventSheetManager.ClearSol(this._solModifiers);this._shouldRelease=!0}async _DebugRun(a){this._RestoreState(a);for(const b of this._event._DebugResumeActionsAndSubEvents(a))await this._eventSheetManager.GetRuntime().DebugBreak(b);this._callingFunctionBlock&&
  this._callingFunctionBlock.IsAsync()&&this._callingFunctionBlock.MaybeFinishAsyncFunctionCall(this._asyncId);this._eventSheetManager.ClearSol(this._solModifiers);this._shouldRelease=!0}ShouldRelease(){return this._shouldRelease}RemoveInstances(a){for(const b of this._sols.values())b.RemoveInstances(a)}_SaveToJson(){const a={},b={t:this._time,st:this._signalTag,s:this._isSignalled,ev:this._event.GetSID(),sm:this._solModifiers.map(a=>a.GetSID()),sols:a};this._event._HasActionIndex(this._actIndex)&&
  (b.act=this._event.GetActionAt(this._actIndex).GetSID());for(const [b,d]of this._sols)a[b.GetSID().toString()]=d._SaveToJson();return b}static _CreateFromJson(a,b){const e=a.GetRuntime();var f=a.GetEventBlockBySID(b.ev);if(!f)return null;let g=0;if(b.hasOwnProperty("act")){var c=a.GetActionBySID(b.act);if(!c)return null;g=c.GetIndex()}c=d.New(d.ScheduledWait,a);c._time=b.t;c._type=-1===c._time?"signal":"timer";c._signalTag=b.st;c._isSignalled=b.s;c._event=f;c._actIndex=g;for(var h of b.sm)(f=e.GetObjectClassBySID(h))&&
  c._solModifiers.push(f);for(const [f,g]of Object.entries(b.sols))if(b=parseInt(f,10),b=e.GetObjectClassBySID(b))h=d.New(d.SolState,null),h._LoadFromJson(a,g),c._sols.set(b,h);return c}}};
  
  
  // c3/events/solState.js
  'use strict';{const b=self.C3;b.SolState=class extends b.DefendedBase{constructor(a){super();this._objectClass=null;this._isSelectAll=!0;this._instances=[];a&&(this._objectClass=a.GetObjectClass(),this._isSelectAll=a.IsSelectAll(),b.shallowAssignArray(this._instances,a._GetOwnInstances()))}Release(){this._objectClass=null;b.clearArray(this._instances)}_Restore(a){a._SetSelectAll(this._isSelectAll);b.shallowAssignArray(a._GetOwnInstances(),this._instances)}RemoveInstances(a){b.arrayRemoveAllInSet(this._instances,
  a)}_SaveToJson(){return{sa:this._isSelectAll,insts:this._instances.map(a=>a.GetUID())}}_LoadFromJson(a,c){a=a.GetRuntime();this._isSelectAll=!!c.sa;b.clearArray(this._instances);for(const b of c.insts)(c=a.GetInstanceByUID(b))&&this._instances.push(c)}}};
  
  
  // c3/sdk/sdkPluginBase.js
  'use strict';{var GetNextParamMap=function(a,c){let b=a.get(c);b||(b=new Map,a.set(c,b));return b};const h=self.C3;h.SDKPluginBase=class extends h.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._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}_GetBoundACEMethod(a,c){if(!c)throw Error("missing 'this' binding");let b=this._boundACEMethodCache.get(a);if(b)return b;b=a.bind(c);this._boundACEMethodCache.set(a,b);return b}_GetBoundACEMethod_1param(a,
  c,b){if(!c)throw Error("missing 'this' binding");const f=GetNextParamMap(this._boundACEMethodCache_1param,a);let d=f.get(b);if(d)return d;d=a.bind(c,b);f.set(b,d);return d}_GetBoundACEMethod_2params(a,c,b,f){if(!c)throw Error("missing 'this' binding");var d=GetNextParamMap(this._boundACEMethodCache_2params,a);d=GetNextParamMap(d,b);let e=d.get(f);if(e)return e;e=a.bind(c,b,f);d.set(f,e);return e}_GetBoundACEMethod_3params(a,c,b,f,d){if(!c)throw Error("missing 'this' binding");var e=GetNextParamMap(this._boundACEMethodCache_3params,
  a);e=GetNextParamMap(e,b);e=GetNextParamMap(e,f);let g=e.get(d);if(g)return g;g=a.bind(c,b,f,d);e.set(d,g);return g}_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()}}};
  
  
  // c3/sdk/sdkDOMPluginBase.js
  'use strict';{const c=self.C3;c.SDKDOMPluginBase=class extends c.SDKPluginBase{constructor(a,b){super(a);this._domComponentId=b;this._nextElementId=0;this._instMap=new Map}Release(){super.Release()}_AddElement(a){const b=this._nextElementId++;this._instMap.set(b,a);return b}_RemoveElement(a){this._instMap.delete(a)}AddElementMessageHandler(a,b){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,a,a=>{const c=this._instMap.get(a.elementId);b(c,a)})}}};
  
  
  // c3/sdk/sdkTypeBase.js
  'use strict';{const b=self.C3;b.SDKTypeBase=class extends b.DefendedBase{constructor(a){super();this._objectClass=a;this._runtime=a.GetRuntime();this._plugin=a.GetPlugin()}Release(){this._plugin=this._runtime=this._objectClass=null}GetObjectClass(){return this._objectClass}GetRuntime(){return this._runtime}GetPlugin(){return this._plugin}GetImageInfo(){return this._objectClass.GetImageInfo()}FinishCondition(a){}LoadTextures(a){}ReleaseTextures(){}OnDynamicTextureLoadComplete(){}PreloadTexturesWithInstances(a){}LoadTilePolyData(){}GetScriptInterfaceClass(){return null}}};
  
  
  // c3/sdk/sdkInstanceBase.js
  'use strict';{const d=self.C3;d.SDKInstanceBase=class extends d.DefendedBase{constructor(a,b){super();this._inst=a;this._domComponentId=b;this._runtime=a.GetRuntime();this._objectClass=this._inst.GetObjectClass();this._sdkType=this._objectClass.GetSdkType();this._tick2Func=this._tickFunc=null;this._isTicking2=this._isTicking=!1;this._disposables=null;this._wasReleased=!1}Release(){this._wasReleased=!0;this._StopTicking();this._StopTicking2();this._tick2Func=this._tickFunc=null;this._disposables&&
  (this._disposables.Release(),this._disposables=null);this._sdkType=this._objectClass=this._runtime=this._inst=null}WasReleased(){return this._wasReleased}GetInstance(){return this._inst}GetRuntime(){return this._runtime}GetObjectClass(){return this._objectClass}GetPlugin(){return this._sdkType.GetPlugin()}GetSdkType(){return this._sdkType}GetScriptInterface(){return this._inst.GetInterfaceClass()}Trigger(a){return this._runtime.Trigger(a,this._inst,null)}DebugTrigger(a){return this._runtime.DebugTrigger(a,
  this._inst,null)}TriggerAsync(a){return this._runtime.TriggerAsync(a,this._inst,null)}FastTrigger(a,b){return this._runtime.FastTrigger(a,this._inst,b)}DebugFastTrigger(a,b){return this._runtime.DebugFastTrigger(a,this._inst,b)}ScheduleTriggers(a){return this._runtime.ScheduleTriggers(a)}AddDOMMessageHandler(a,b){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,a,b)}AddDOMMessageHandlers(a){for(const [b,c]of a)this.AddDOMMessageHandler(b,c)}PostToDOM(a,b){this._runtime.PostComponentMessageToDOM(this._domComponentId,
  a,b)}PostToDOMAsync(a,b){return this._runtime.PostComponentMessageToDOMAsync(this._domComponentId,a,b)}_PostToDOMMaybeSync(a,b){if(this._runtime.IsInWorker())this.PostToDOM(a,b);else return window.c3_runtimeInterface._OnMessageFromRuntime({type:"event",component:this._domComponentId,handler:a,data:b,responseId:null})}GetCurrentImageInfo(){return null}GetCurrentSurfaceSize(){var a=this.GetCurrentImageInfo();return a&&(a=a.GetTexture())?[a.GetWidth(),a.GetHeight()]:[100,100]}GetCurrentTexRect(){const a=
  this.GetCurrentImageInfo();return a?a.GetTexRect():null}GetImagePoint(a){a=this._inst.GetWorldInfo();return[a.GetX(),a.GetY()]}Tick(){}Tick2(){}_StartTicking(){this._isTicking||(this._tickFunc||(this._tickFunc=()=>this.Tick()),this._runtime.Dispatcher().addEventListener("tick",this._tickFunc),this._isTicking=!0)}_StopTicking(){this._isTicking&&(this._runtime.Dispatcher().removeEventListener("tick",this._tickFunc),this._isTicking=!1)}IsTicking(){return this._isTicking}_StartTicking2(){this._isTicking2||
  (this._tick2Func||(this._tick2Func=()=>this.Tick2()),this._runtime.Dispatcher().addEventListener("tick2",this._tick2Func),this._isTicking2=!0)}_StopTicking2(){this._isTicking2&&(this._runtime.Dispatcher().removeEventListener("tick2",this._tick2Func),this._isTicking2=!1)}IsTicking2(){return this._isTicking2}GetDebuggerProperties(){return[]}SaveToJson(){return null}LoadFromJson(a){}LoadTilemapData(a,b,c){}TestPointOverlapTile(a,b){}GetPropertyValueByIndex(a){}SetPropertyValueByIndex(a,b){}OffsetPropertyValueByIndex(a,
  b){if(0!==b){var c=this.GetPropertyValueByIndex(a);if("number"!==typeof c)throw Error("expected number");this.SetPropertyValueByIndex(a,c+b)}}SetPropertyColorOffsetValueByIndex(a,b,c,e){}CallAction(a,...b){a.call(this,...b)}CallExpression(a,...b){return a.call(this,...b)}GetScriptInterfaceClass(){return null}}};
  
  
  // c3/sdk/sdkWorldInstanceBase.js
  'use strict';{const b=self.C3;b.SDKWorldInstanceBase=class extends b.SDKInstanceBase{constructor(a,c){super(a,c);this._worldInfo=a.GetWorldInfo();this._webglcontextrestored_handler=this._webglcontextlost_handler=null}Release(){if(this._webglcontextlost_handler){const a=this._runtime.Dispatcher();a.removeEventListener("webglcontextlost",this._webglcontextlost_handler);a.removeEventListener("webglcontextrestored",this._webglcontextrestored_handler);this._webglcontextrestored_handler=this._webglcontextlost_handler=
  null}this._worldInfo=null;super.Release()}HandleWebGLContextLoss(){if(!this._webglcontextlost_handler){this._webglcontextlost_handler=()=>this.OnWebGLContextLost();this._webglcontextrestored_handler=()=>this.OnWebGLContextRestored();var a=this._runtime.Dispatcher();a.addEventListener("webglcontextlost",this._webglcontextlost_handler);a.addEventListener("webglcontextrestored",this._webglcontextrestored_handler)}}OnWebGLContextLost(){}OnWebGLContextRestored(){}GetWorldInfo(){return this._worldInfo}}};
  
  
  // c3/sdk/sdkDOMInstanceBase.js
  'use strict';{const e=self.C3,m=e.New(e.Rect);e.SDKDOMInstanceBase=class extends e.SDKWorldInstanceBase{constructor(a,b){super(a,b);this._elementId=this.GetPlugin()._AddElement(this);this._isElementShowing=!0;this._autoFontSize=!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,b){b||(b={});b.elementId=this._elementId;this.PostToDOM(a,b)}_PostToDOMElementMaybeSync(a,b){b||(b={});b.elementId=this._elementId;return this._PostToDOMMaybeSync(a,b)}PostToDOMElementAsync(a,b){b||(b={});b.elementId=this._elementId;return this.PostToDOMAsync(a,b)}CreateElement(a){a||(a={});const b=
  this.GetWorldInfo().IsVisible();a.elementId=this._elementId;a.isVisible=b;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 b=this.GetWorldInfo();const f=b.GetLayer();var c=b.GetX(),d=b.GetY();let [g,h]=f.LayerToCanvasCss(c,d),[k,l]=f.LayerToCanvasCss(c+b.GetWidth(),d+b.GetHeight());c=this._runtime.GetCanvasManager();d=c.GetCssWidth();const n=c.GetCssHeight();if(b.IsVisible()&&f.IsVisible()){if(!this._ShouldPreserveElement()){if(0>=k||0>=l||g>=d||h>=n){this.SetElementVisible(!1);return}1>g&&(g=1);1>h&&(h=1);k>=d&&(k=d-1);l>=n&&(l=n-1)}m.set(g,h,k,l);b=c.GetLastWidth();
  d=c.GetLastHeight();!a&&m.equals(this._lastRect)&&this._lastWindowWidth===b&&this._lastWindowHeight===d?this.SetElementVisible(!0):(this._lastRect.copy(m),this._lastWindowWidth=b,this._lastWindowHeight=d,this.SetElementVisible(!0),a=null,this._autoFontSize&&(a=f.GetDisplayScale()-.2),this.PostToDOMElement("update-position",{left:Math.round(this._lastRect.getLeft())+c.GetCanvasClientX(),top:Math.round(this._lastRect.getTop())+c.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})}SetElementCSSStyle(a,b){this.PostToDOMElement("set-css-style",{prop:e.CSSToCamelCase(a),val:b})}UpdateElementState(){this._isPendingUpdateState||(this._isPendingUpdateState=!0,Promise.resolve().then(()=>{this._isPendingUpdateState=!1;this.PostToDOMElement("update-state",this.GetElementState())}))}GetElementState(){}GetElementId(){return this._elementId}}};
  
  
  // c3/sdk/sdkBehaviorBase.js
  'use strict';{const b=self.C3,c=self.IBehavior;b.SDKBehaviorBase=class extends b.DefendedBase{constructor(a){super();this._runtime=a.runtime;this._myObjectClasses=b.New(b.ArraySet);this._myInstances=b.New(b.ArraySet);this._iBehavior=null;if(a=a.scriptInterfaceClass){if(this._iBehavior=new a(this),!(this._iBehavior instanceof c))throw new TypeError("script interface class must derive from IBehavior");}else this._iBehavior=new c(this)}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(){return this._iBehavior}}};
  
  
  // c3/sdk/sdkBehaviorTypeBase.js
  'use strict';{const b=self.C3;b.SDKBehaviorTypeBase=class extends b.DefendedBase{constructor(a){super();this._runtime=a.GetRuntime();this._behaviorType=a;this._objectClass=a.GetObjectClass();this._behavior=a.GetBehavior();this._behavior._AddObjectClass(this._objectClass)}Release(){this._behavior=this._objectClass=this._behaviorType=this._runtime=null}GetBehaviorType(){return this._behaviorType}GetObjectClass(){return this._objectClass}GetRuntime(){return this._runtime}GetBehavior(){return this._behavior}}};
  
  
  // c3/sdk/sdkBehaviorInstanceBase.js
  'use strict';{const d=self.C3;d.SDKBehaviorInstanceBase=class extends d.DefendedBase{constructor(a,b){super();this._behInst=a;this._domComponentId=b;this._inst=a.GetObjectInstance();this._runtime=a.GetRuntime();this._behaviorType=a.GetBehaviorType();this._sdkType=this._behaviorType.GetSdkType();this._isPostTicking=this._isTicking2=this._isTicking=!1;this._disposables=null}Release(){this._StopTicking();this._StopTicking2();this._StopPostTicking();this._disposables&&(this._disposables.Release(),this._disposables=
  null);this._sdkType=this._behaviorType=this._runtime=this._inst=this._behInst=null}GetBehavior(){return this._behaviorType.GetBehavior()}GetBehaviorInstance(){return this._behInst}GetObjectInstance(){return this._inst}GetObjectClass(){return this._inst.GetObjectClass()}GetWorldInfo(){return this._inst.GetWorldInfo()}GetRuntime(){return this._runtime}GetBehaviorType(){return this._behaviorType}GetSdkType(){return this._sdkType}Trigger(a){return this._runtime.Trigger(a,this._inst,this._behaviorType)}DebugTrigger(a){return this._runtime.DebugTrigger(a,
  this._inst,this._behaviorType)}TriggerAsync(a){return this._runtime.TriggerAsync(a,this._inst,this._behaviorType)}PostCreate(){}Tick(){}Tick2(){}PostTick(){}_StartTicking(){this._isTicking||(this._runtime._AddBehInstToTick(this),this._isTicking=!0)}_StopTicking(){this._isTicking&&(this._runtime._RemoveBehInstToTick(this),this._isTicking=!1)}IsTicking(){return this._isTicking}_StartTicking2(){this._isTicking2||(this._runtime._AddBehInstToTick2(this),this._isTicking2=!0)}_StopTicking2(){this._isTicking2&&
  (this._runtime._RemoveBehInstToTick2(this),this._isTicking2=!1)}IsTicking2(){return this._isTicking2}_StartPostTicking(){this._isPostTicking||(this._runtime._AddBehInstToPostTick(this),this._isPostTicking=!0)}_StopPostTicking(){this._isPostTicking&&(this._runtime._RemoveBehInstToPostTick(this),this._isPostTicking=!1)}IsPostTicking(){return this._isPostTicking}GetDebuggerProperties(){return[]}AddDOMMessageHandler(a,b){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,a,b)}OnSpriteFrameChanged(a,
  b){}SaveToJson(){return null}LoadFromJson(a){}GetPropertyValueByIndex(a){}SetPropertyValueByIndex(a,b){}OffsetPropertyValueByIndex(a,b){if(0!==b){var c=this.GetPropertyValueByIndex(a);if("number"!==typeof c)throw Error("expected number");this.SetPropertyValueByIndex(a,c+b)}}SetPropertyColorOffsetValueByIndex(a,b,c,e){}CallAction(a,...b){a.call(this,...b)}CallExpression(a,...b){return a.call(this,...b)}GetScriptInterfaceClass(){return null}}};
  
  
  // c3/objects/pluginManager.js
  'use strict';{const b=self.C3;b.Plugins={};b.Behaviors={};b.PluginManager=class extends b.DefendedBase{constructor(a){super();this._runtime=a;this._allPlugins=[];this._pluginsByCtor=new Map;this._systemPlugin=null;this._allBehaviors=[];this._behaviorsByCtor=new Map;this._jumpthruBehavior=this._solidBehavior=null}CreatePlugin(a){const c=this._runtime.GetObjectReference(a[0]);if(!c)throw Error("missing plugin");b.AddCommonACEs(a,c);a=b.New(c,{runtime:this._runtime,isSingleGlobal:a[1],isWorld:a[2],isRotatable:a[5],
  hasEffects:a[8],mustPredraw:a[9]});a.OnCreate();this._allPlugins.push(a);this._pluginsByCtor.set(c,a)}CreateSystemPlugin(){this._systemPlugin=b.New(b.Plugins.System,{runtime:this._runtime,isSingleGlobal:!0});this._systemPlugin.OnCreate()}CreateBehavior(a){a=this._runtime.GetObjectReference(a[1]);if(!a)throw Error("missing behavior");const c=b.New(a,{runtime:this._runtime});c.OnCreate();this._allBehaviors.push(c);this._behaviorsByCtor.set(a,c);!this._solidBehavior&&b.Behaviors.solid&&c instanceof b.Behaviors.solid?
  this._solidBehavior=c:!this._jumpthruBehavior&&b.Behaviors.jumpthru&&c instanceof b.Behaviors.jumpthru&&(this._jumpthruBehavior=c)}GetPluginByConstructorFunction(a){return this._pluginsByCtor.get(a)||null}HasBehaviorByConstructorFunction(a){return this._behaviorsByCtor.has(a)}GetBehaviorByConstructorFunction(a){return this._behaviorsByCtor.get(a)||null}GetSystemPlugin(){return this._systemPlugin}GetSolidBehavior(){return this._solidBehavior}GetJumpthruBehavior(){return this._jumpthruBehavior}}};
  
  
  // c3/objects/imageInfo.js
  'use strict';{const c=self.C3,d=new Set;c.ImageInfo=class extends c.DefendedBase{constructor(){super();this._url="";this._height=this._width=this._offsetY=this._offsetX=this._pixelFormat=this._size=0;this._hasMetaData=!1;this._imageAsset=null;this._textureState="";this._rcTex=c.New(c.Rect);d.add(this)}Release(){this.ReleaseTexture();this._imageAsset=null;d.delete(this)}static OnWebGLContextLost(){for(const a of d)a._textureState="",a._rcTex.set(0,0,0,0)}LoadData(a){this._url=a[0];this._size=a[1];
  this._pixelFormat=a[2];this._offsetX=a[3];this._offsetY=a[4];this._width=a[5];this._height=a[6];this._hasMetaData=!0}LoadAnimationFrameData(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._pixelFormat=a[11];this._hasMetaData=!0}LoadDynamicAsset(a,b){if(this._imageAsset)throw Error("already loaded asset");this._url=b;const e={};c.IsAbsoluteURL(b)&&(e.loadPolicy="remote");this.LoadAsset(a,e);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._pixelFormat=a._pixelFormat;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}GetURL(){return this._url}GetSize(){return this._size}GetPixelFormat(){return this._pixelFormat}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,
  b){if(this._imageAsset)throw Error("already got asset");b=Object.assign({},b,{url:this.GetURL(),size:this.GetSize()});this._imageAsset=a.LoadImage(b)}IsLoaded(){return this._imageAsset&&this._imageAsset.IsLoaded()}async LoadStaticTexture(a,b){if(!this._imageAsset)throw Error("no asset");if(this._textureState)throw Error("already loaded texture");this._textureState="loading";a=await this._imageAsset.LoadStaticTexture(a,b);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._width,this._offsetY+this._height);this._rcTex.divide(a.GetWidth(),a.GetHeight());return a}ReleaseTexture(){this._textureState&&(this._imageAsset&&this._imageAsset.ReleaseTexture(),this._textureState="",this._rcTex.set(0,0,0,0))}GetTexture(){return this._imageAsset?this._imageAsset.GetTexture():null}GetTexRect(){return this._rcTex}async ExtractImageToCanvas(){const a=
  await this._imageAsset.LoadToDrawable(),b=c.CreateCanvas(this._width,this._height);b.getContext("2d").drawImage(a,this._offsetX,this._offsetY,this._width,this._height,0,0,this._width,this._height);return b}}};
  
  
  // c3/objects/animationInfo.js
  'use strict';{const b=self.C3;b.AnimationInfo=class extends b.DefendedBase{constructor(a){super();this._name=a[0];this._speed=a[1];this._isLooping=!!a[2];this._repeatCount=a[3];this._repeatTo=a[4];this._isPingPong=!!a[5];this._sid=a[6];this._frames=a[7].map(a=>b.New(b.AnimationFrameInfo,a))}Release(){for(const a of this._frames)a.Release();b.clearArray(this._frames)}LoadAllAssets(a){for(const b of this._frames)b.GetImageInfo().LoadAsset(a)}LoadAllTextures(a,c){return Promise.all(this._frames.map(b=>
  b.GetImageInfo().LoadStaticTexture(a,c)))}ReleaseAllTextures(){for(const a of this._frames)a.GetImageInfo().ReleaseTexture()}GetName(){return this._name}GetSID(){return this._sid}GetFrameCount(){return this._frames.length}GetFrames(){return this._frames}GetFrameAt(a){a=Math.floor(a);if(0>a||a>=this._frames.length)throw new RangeError("invalid frame");return this._frames[a]}GetSpeed(){return this._speed}IsLooping(){return this._isLooping}GetRepeatCount(){return this._repeatCount}GetRepeatTo(){return this._repeatTo}IsPingPong(){return this._isPingPong}}};
  
  
  // c3/objects/animationFrameInfo.js
  'use strict';{const b=self.C3;b.AnimationFrameInfo=class extends b.DefendedBase{constructor(a){super();this._imageInfo=b.New(b.ImageInfo);this._imageInfo.LoadAnimationFrameData(a);this._duration=a[6];this._origin=b.New(b.Vector2,a[7],a[8]);this._imagePoints=a[9].map(a=>b.New(b.ImagePoint,this,a));this._imagePointsByName=new Map;for(const a of this._imagePoints)this._imagePointsByName.set(a.GetName().toLowerCase(),a);this._collisionPoly=null;a=a[10];6<=a.length&&(this._collisionPoly=b.New(b.CollisionPoly,
  a))}Release(){this._collisionPoly&&(this._collisionPoly.Release(),this._collisionPoly=null);this._imageInfo.Release();this._imageInfo=null}GetImageInfo(){return this._imageInfo}GetDuration(){return this._duration}GetOriginX(){return this._origin.getX()}GetOriginY(){return this._origin.getY()}GetCollisionPoly(){return this._collisionPoly}GetImagePointByName(a){return this._imagePointsByName.get(a.toLowerCase())||null}GetImagePointByIndex(a){a=Math.floor(a);return 0>a||a>=this._imagePoints.length?null:
  this._imagePoints[a]}GetImagePointCount(){return this._imagePoints.length}}};
  
  
  // c3/objects/imagePoint.js
  'use strict';{const a=self.C3;a.ImagePoint=class extends a.DefendedBase{constructor(c,b){super();this._afi=c;this._name=b[0];this._pos=a.New(a.Vector2,b[1],b[2])}Release(){}GetName(){return this._name}GetX(){return this._pos.getX()}GetY(){return this._pos.getY()}GetVec2(){return this._pos}}};
  
  
  // c3/objects/objectClass.js
  'use strict';{const d=self.C3,k=self.C3Debugger,l=self.IObjectClass;d.ObjectClass=class extends d.DefendedBase{constructor(a,b,c){super();const e=a.GetObjectReference(c[1]);this._runtime=a;this._plugin=a.GetPluginManager().GetPluginByConstructorFunction(e);this._sdkType=null;this._instSdkCtor=e.Instance;this._index=b;this._sid=c[11];this._name=c[0];this._jsPropName=this._runtime.GetJsPropName(c[14]);this._isGlobal=!!c[9];this._isFamily=!!c[2];this._isOnLoaderLayout=!!c[10];this._instVars=c[3].map(b=>
  ({sid:b[0],type:b[1],name:b[2],jsPropName:a.GetJsPropName(b[3])}));this._behaviorsCount=c[4];this._effectsCount=c[5];this._isWorldType=this._plugin.IsWorldType();this._effectList=null;this._collisionGrid=d.New(d.SparseGrid,a.GetOriginalViewportWidth(),a.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=c[8].map(a=>d.BehaviorType.Create(this,a));this._behaviorTypesIncludingInherited=[];this._behaviorsByName=new Map;this._behaviorNameToIndex=new Map;this._usedBehaviorCtors=new Set;this._solStack=d.New(d.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=d.New(d.EffectList,this,c[12]));c[6]&&(this._imageInfo=d.New(d.ImageInfo),this._imageInfo.LoadData(c[6]));if(c[7]){this._animations=c[7].map(a=>d.New(d.AnimationInfo,a));this._animationsByName=new Map;this._animationsBySid=new Map;for(const a of this._animations)this._animationsByName.set(a.GetName().toLowerCase(),a),this._animationsBySid.set(a.GetSID(),a)}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=d.New(e.Type,this,c[15]);this._instanceUserScriptClass=this._iObjectClass=null;this._userScriptDispatcher=d.New(d.Event.Dispatcher);if(b=this._sdkType.GetScriptInterfaceClass()){if(this._iObjectClass=new b(this),!(this._iObjectClass instanceof l))throw new TypeError("script interface class must derive from IObjectClass");
  }else this._iObjectClass=new l(this);c[13]&&c[13].length&&this._sdkType.LoadTilePolyData(c[13]);this._runtime.UsesLoaderLayout()&&!this._isFamily&&!this._isOnLoaderLayout&&this._isWorldType||this.OnCreate();this._plugin.IsSingleGlobal()&&(this._plugin._SetSingleGlobalObjectClass(this),this._CreateSingleGlobalInstance(c))}static Create(a,b,c){return d.New(d.ObjectClass,a,b,c)}Release(){this._imageInfo&&(this._imageInfo.Release(),this._imageInfo=null);if(this._animations){for(const a of this._animations)a.Release();
  d.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(a){for(let b=1,c=a.length;b<c;++b){const c=this._runtime.GetObjectClassByIndex(a[b]);this._familyMembers.push(c);this._familyMembersSet.add(c);c._families.push(this);c._familiesSet.add(this)}}_SetContainer(a){this._isInContainer=!0;this._container=a}IsInContainer(){return this._isInContainer}GetContainer(){return this._container}_OnAfterCreate(){var a=
  0;if(!this._isFamily)for(var b of this._families)for(var c of b.GetBehaviorTypes()){const b=c.GetName().toLowerCase();this._behaviorsByName.set(b,c);this._behaviorNameToIndex.set(b,a);this._behaviorTypesIncludingInherited.push(c);++a}for(var e of this.GetBehaviorTypes())b=e.GetName().toLowerCase(),this._behaviorsByName.set(b,e),this._behaviorNameToIndex.set(b,a),this._behaviorTypesIncludingInherited.push(e),++a;for(var f of this._behaviorTypesIncludingInherited)this._usedBehaviorCtors.add(f.GetBehavior().constructor);
  if(!this._isFamily&&this._families.length){a=this._runtime.GetFamilyCount();d.extendArray(this._familyInstVarMap,a,0);d.extendArray(this._familyBehaviorMap,a,0);d.extendArray(this._familyEffectMap,a,0);a=[];b=f=e=0;for(const d of this._families)if(c=d.GetFamilyIndex(),this._familyInstVarMap[c]=e,e+=d.GetInstanceVariablesCount(),this._familyBehaviorMap[c]=f,f+=d.GetBehaviorTypesCount(),this._familyEffectMap[c]=b,b+=d.GetEffectTypesCount(),(c=d.GetEffectList())&&this._effectList)for(const b of c.GetAllEffectTypes())a.push(b.Clone(this._effectList));
  this._effectList&&this._effectList.PrependEffectTypes(a)}}_CreateSingleGlobalInstance(a){const b=this._runtime._GetNewUID(),c=d.New(d.Instance,{runtime:this._runtime,objectType:this,uid:b});c._CreateSdkInstance(a[16],[]);this._runtime._MapInstanceByUID(b,c);this._instances.push(c)}GetSdkType(){return this._sdkType}IsOnLoaderLayout(){return this._isOnLoaderLayout}OnCreate(){this._isFamily||this._sdkType.OnCreate()}HasLoadedTextures(){return 0<this._textureRefCount}LoadTextures(a){if(this._isFamily)return Promise.resolve();
  this._textureRefCount++;return 1===this._textureRefCount?this._sdkType.LoadTextures(a)||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(a){return this._isFamily?
  Promise.resolve():this._sdkType.PreloadTexturesWithInstances(a)}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(a){return a&&
  this._usedBehaviorCtors.has(a)}GetInstanceVariablesCount(){return this._instVars.length}GetInstanceVariableSIDs(){return this._instVars.map(a=>a.sid)}GetInstanceVariableIndexBySID(a){return this._instVars.findIndex(b=>b.sid===a)}GetInstanceVariableIndexByName(a){return this._instVars.findIndex(b=>b.name===a)}_GetAllInstanceVariableNames(){return this._instVars.map(a=>a.name)}_GetAllInstanceVariableJsPropNames(){return this._instVars.map(a=>a.jsPropName)}GetInstanceVariableType(a){a=Math.floor(a);
  if(0>a||a>=this._instVars.length)throw new RangeError("invalid instance variable index");return this._instVars[a].type}GetInstanceVariableName(a){a=Math.floor(a);if(0>a||a>=this._instVars.length)throw new RangeError("invalid instance variable index");return this._instVars[a].name}GetEffectTypesCount(){return this._effectsCount}GetBehaviorTypesIncludingInherited(){return this._behaviorTypesIncludingInherited}GetBehaviorTypeByName(a){return this._behaviorsByName.get(a.toLowerCase())||null}GetBehaviorIndexByName(a){a=
  this._behaviorNameToIndex.get(a.toLowerCase());return"undefined"===typeof a?-1:a}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(a){this._defaultInstanceData=a}GetDefaultInstanceData(){return this._defaultInstanceData}_SetDefaultLayerIndex(a){this._defaultLayerIndex=
  a}GetDefaultLayerIndex(){return this._defaultLayerIndex}GetAnimations(){return this._animations}GetAnimationCount(){return this._animations.length}GetFamilies(){return this._families}BelongsToFamily(a){return this._familiesSet.has(a)}GetFamilyMembers(){return this._familyMembers}FamilyHasMember(a){return this._familyMembersSet.has(a)}GetFamilyBehaviorOffset(a){return this._familyBehaviorMap[a]}GetFamilyInstanceVariableOffset(a){return this._familyInstVarMap[a]}GetAnimationByName(a){if(!this._animations)throw Error("no animations");
  return this._animationsByName.get(a.toLowerCase())||null}GetAnimationBySID(a){if(!this._animations)throw Error("no animations");return this._animationsBySid.get(a)||null}GetFirstAnimationFrame(){if(!this._animations)throw Error("no animations");return this._animations[0].GetFrameAt(0)}GetDefaultInstanceSize(){if(this._animations){const a=this.GetFirstAnimationFrame().GetImageInfo();return[a.GetWidth(),a.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 a of this._runtime._GetInstancesPendingCreate())a.GetObjectClass()===this&&(yield a)}GetInstanceCount(){return this._instances.length}_AddInstance(a){this._instances.push(a)}_SetIIDsStale(){this._iidsStale=!0}_UpdateIIDs(){if(this._iidsStale&&
  !this._isFamily){var a=this._instances,b=0;for(let c=a.length;b<c;++b)a[b]._SetIID(b);a=this._runtime._GetInstancesPendingCreate();for(const c of a)c.GetObjectClass()===this&&c._SetIID(b++);this._iidsStale=!1}}GetInstanceByIID(a){var b=this._instances;if(a<b.length)return b[a];a-=b.length;b=this._runtime._GetInstancesPendingCreate();for(const c of b)if(c.GetObjectClass()===this){if(0===a)return c;--a}return null}GetFirstPicked(a){if(a&&a.IsInContainer()&&a.GetObjectClass()!==this)for(const b of a.siblings())if(b.GetObjectClass()===
  this)return b;a=this.GetCurrentSol().GetInstances();return a.length?a[0]:null}GetPairedInstance(a){const b=this.GetCurrentSol().GetInstances();return b.length?b[a.GetIID()%b.length]:null}FinishCondition(a){this._sdkType.FinishCondition(a)}ApplySolToContainer(){if(this._isInContainer&&!this._isFamily){this._UpdateIIDs();var a=this.GetCurrentSol(),b=a._GetOwnInstances(),c=a.IsSelectAll(),e=this._runtime.GetCurrentEventStackFrame();e=e&&e.GetCurrentEvent()&&e.GetCurrentEvent().IsOrBlock();for(const g of this._container.objectTypes())if(g!==
  this){g._UpdateIIDs();var f=g.GetCurrentSol();f._SetSelectAll(c);if(!c){var h=f._GetOwnInstances();d.clearArray(h);for(const a of b)h.push(g.GetInstanceByIID(a.GetIID()));if(e){h=a._GetOwnElseInstances();f=f._GetOwnElseInstances();d.clearArray(f);for(const a of h)f.push(g.GetInstanceByIID(a.GetIID()))}}}}}_TruncateContainerSols(a,b){for(const c of this.GetContainer().objectTypes()){const e=c.GetCurrentSol();a?d.truncateArray(e._GetOwnElseInstances(),b):d.truncateArray(e._GetOwnInstances(),b)}}_GetCollisionCellGrid(){return this._collisionGrid}_SetAnyCollisionCellChanged(a){this._anyCollisionCellChanged=
  !!a}_SetAnyInstanceParallaxed(a){this._anyInstanceParallaxed=!!a}IsAnyInstanceParallaxed(){return this._anyInstanceParallaxed}_UpdateAllCollisionCells(){if(this._anyCollisionCellChanged&&this._isWorldType){for(const a of this._instances)a.GetWorldInfo()._UpdateCollisionCell();for(const a of this._runtime._GetInstancesPendingCreate())a.GetObjectClass()===this&&a.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(d.Behaviors.solid)}HasNoSaveBehavior(){return this.UsesBehaviorByCtor(d.Behaviors.NoSave)}HasPersistBehavior(){return this.UsesBehaviorByCtor(d.Behaviors.Persist)}_SaveToJson(){const a={instances:this._instances.map(a=>a.SaveToJson())};this._savedData&&this._savedData.size&&(a.ex=d.ToSuperJSON(this._savedData));return a}_LoadFromJson(a){this._savedData&&(this._savedData.clear(),this._savedData=null);
  var b=a.ex;b&&(this._savedData=d.FromSuperJSON(b));b=this._instances;a=a.instances;for(let c=0,d=Math.min(b.length,a.length);c<d;++c)b[c].LoadFromJson(a[c]);for(let c=a.length,d=b.length;c<d;++c)this._runtime.DestroyInstance(b[c]);for(let c=b.length,d=a.length;c<d;++c){b=a[c];let d=null;if(this.IsWorldType()&&(d=this._runtime.GetMainRunningLayout().GetLayerBySID(b.w.l),!d))continue;this._runtime.CreateInstanceFromData(this._defaultInstanceData||this,d,!1,0,0,!0).LoadFromJson(b)}this._SetIIDsStale()}GetIObjectClass(){return this._iObjectClass}UserScriptDispatcher(){return this._userScriptDispatcher}_GetUserScriptInstanceClass(){return this._instanceUserScriptClass}_SetUserScriptInstanceClass(a){this._instanceUserScriptClass=
  a}DispatchUserScriptEvent(a){var b=this._runtime;(b=b.IsDebug()&&!b.GetEventSheetManager().IsInEventEngine())&&k.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(a);b&&k.AddScriptTime()}}};
  
  
  // c3/objects/container.js
  'use strict';{const b=self.C3;b.Container=class extends b.DefendedBase{constructor(a,c){super();this._runtime=a;this._objectTypes=c;for(const a of this._objectTypes)a._SetContainer(this)}Release(){this._runtime=null}GetRuntime(){return this._runtime}GetObjectTypes(){return this._objectTypes}objectTypes(){return this._objectTypes}HasAnyWorldType(){return this._objectTypes.some(a=>a.IsWorldType())}}};
  
  
  // c3/objects/instance.js
  'use strict';{const e=self.C3,l=self.C3Debugger,k=self.IInstance,m=[];let n=0;const f=new WeakMap,h=new WeakMap;e.Instance=class extends e.DefendedBase{constructor(a){super();this._runtime=a.runtime;this._objectType=a.objectType;this._iScriptInterface=this._sdkInst=this._worldInfo=null;this._iid=0;this._uid=a.uid;this._puid=n++;this._flags=0;this._behaviorInstances=this._instVarValues=m;var b=this._objectType.GetBehaviorTypesIncludingInherited();0<b.length&&(this._behaviorInstances=b.map((a,b)=>e.New(e.BehaviorInstance,
  {runtime:this._runtime,behaviorType:a,instance:this,index:b})));this._siblings=this._objectType.IsInContainer()?[]:null;this._timeScale=-1;this._dispatcher=null;b=this.GetPlugin();b.MustPreDraw()&&(this._flags|=4);if(b.IsWorldType())if(this._worldInfo=e.New(e.WorldInfo,this,a.layer),a.worldData)this._worldInfo.Init(a.worldData);else{this._worldInfo.InitNoData();const [a,b]=this._objectType.GetDefaultInstanceSize();this._worldInfo.SetSize(a,b);this.GetObjectClass().UsesEffects()&&this._worldInfo.GetInstanceEffectList().LoadDefaultEffectParameters()}a.instVarData?
  this._LoadInstanceVariableData(a.instVarData):this._LoadDefaultInstanceVariables()}Release(){this._iScriptInterface&&(this._iScriptInterface._Release(),this._iScriptInterface=null);if(0<this._behaviorInstances.length){for(var a of this._behaviorInstances)a.Release();e.clearArray(this._behaviorInstances)}this._sdkInst.Release();this._sdkInst=null;if(a=f.get(this))a.clear(),f.delete(this);if(a=h.get(this))a.clear(),h.delete(this);this._siblings&&e.clearArray(this._siblings);this._dispatcher&&(this._dispatcher.Release(),
  this._dispatcher=null);this._objectType=this._runtime=null;0<this._instVarValues.length&&e.clearArray(this._instVarValues);this._worldInfo&&(this._worldInfo.Release(),this._worldInfo=null)}_LoadInstanceVariableData(a){0<a.length&&(this._instVarValues=[],e.shallowAssignArray(this._instVarValues,a))}_LoadDefaultInstanceVariables(){const a=this._objectType.GetInstanceVariablesCount();if(0!==a){this._instVarValues=[];var b=[0,0,""];for(let c=0;c<a;++c)this._instVarValues.push(b[this._objectType.GetInstanceVariableType(c)])}}_CreateSdkInstance(a,
  b){if(this._sdkInst)throw Error("already got sdk instance");for(let a=0,d=this._behaviorInstances.length;a<d;++a)this._behaviorInstances[a]._CreateSdkInstance(b?b[a]:null);this._sdkInst=e.New(this._objectType.GetInstanceSdkCtor(),this,a);if(!(this._sdkInst instanceof e.SDKInstanceBase))throw Error("sdk type must derive from SDKInstanceBase");for(let a=0,b=this._behaviorInstances.length;a<b;++a)this._behaviorInstances[a].PostCreate();this._objectType._GetUserScriptInstanceClass()&&this._InitUserScriptInterface()}GetSdkInstance(){return this._sdkInst}GetWorldInfo(){return this._worldInfo}GetRuntime(){return this._runtime}GetTimeScale(){return this._timeScale}SetTimeScale(a){a=
  +a;if(0>a||!isFinite(a))a=0;this._timeScale=a}RestoreTimeScale(){this._timeScale=-1}Dispatcher(){this._dispatcher||(this._dispatcher=e.New(e.Event.Dispatcher));return this._dispatcher}Draw(a){this._sdkInst.Draw(a)}OnCreate(a){this._sdkInst.OnCreate(a)}_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)}_IsSolidEnabled(){return 0!==(this._flags&8)}_SetSolidEnabled(a){this._flags=
  a?this._flags|8:this._flags&-9}_IsJumpthruEnabled(){return 0!==(this._flags&16)}_SetJumpthruEnabled(a){this._flags=a?this._flags|16:this._flags&-17}SetFlag(a,b){a<<=16;this._flags=b?this._flags|a:this._flags&~a}GetFlag(a){return 0!==(this._flags&a<<16)}GetCurrentImageInfo(){return this._sdkInst.GetCurrentImageInfo()}GetCurrentSurfaceSize(){return this._sdkInst.GetCurrentSurfaceSize()}GetCurrentTexRect(){return this._sdkInst.GetCurrentTexRect()}GetImagePoint(a){return this._sdkInst.GetImagePoint(a)}GetObjectClass(){return this._objectType}BelongsToObjectClass(a){return a.IsFamily()?
  a.FamilyHasMember(this.GetObjectClass()):this.GetObjectClass()===a}IsInContainer(){return null!==this._siblings}_AddSibling(a){this._siblings.push(a)}GetSiblings(){return this._siblings}siblings(){return this._siblings}SetSiblingsSinglePicked(){for(const a of this.siblings())a.GetObjectClass().GetCurrentSol().SetSinglePicked(a)}_PushSiblingsToSolInstances(){for(const a of this.siblings())a.GetObjectClass().GetCurrentSol()._PushInstance(a)}_SetSiblingsToSolInstancesIndex(a){for(const b of this.siblings())b.GetObjectClass().GetCurrentSol()._GetOwnInstances()[a]=
  b}_PushSiblingsToSolElseInstances(){for(const a of this.siblings())a.GetObjectClass().GetCurrentSol()._PushElseInstance(a)}_SetSiblingsToSolElseInstancesIndex(a){for(const b of this.siblings())b.GetObjectClass().GetCurrentSol()._GetOwnElseInstances()[a]=b}GetPlugin(){return this._objectType.GetPlugin()}_SetIID(a){this._iid=a}GetIID(){this._objectType._UpdateIIDs();return this._iid}GetUID(){return this._uid}GetPUID(){return this._puid}GetBehaviorInstances(){return this._behaviorInstances}GetBehaviorInstanceFromCtor(a){if(!a)return null;
  for(const b of this._behaviorInstances)if(b.GetBehavior()instanceof a)return b;return null}GetBehaviorSdkInstanceFromCtor(a){return a?(a=this.GetBehaviorInstanceFromCtor(a))?a.GetSdkInstance():null:null}GetBehaviorIndexBySID(a){const b=this._behaviorInstances;for(let c=0,d=b.length;c<d;++c)if(b[c].GetBehaviorType().GetSID()===a)return c;return-1}GetAllInstanceVariableValues(){return this._instVarValues}_GetAllInstanceVariableNames(){return this._objectType._GetAllInstanceVariableNames()}GetInstanceVariableCount(){return this._instVarValues.length}GetInstanceVariableValue(a){a|=
  0;const b=this._instVarValues;if(0>a||a>=b.length)throw new RangeError("invalid instance variable");return b[a]}_GetInstanceVariableValueUnchecked(a){return this._instVarValues[a]}SetInstanceVariableValue(a,b){a|=0;const c=this._instVarValues;if(0>a||a>=c.length)throw new RangeError("invalid instance variable");const d=c[a];if("number"===typeof d)c[a]="number"===typeof b?b:parseFloat(b);else if("boolean"===typeof d)c[a]="boolean"===typeof b?b:!!b;else if("string"===typeof d)c[a]="string"===typeof b?
  b:b.toString();else throw Error("unknown instance variable type");}SetInstanceVariableOffset(a,b){if(0!==b){a|=0;var c=this._instVarValues;if(0>a||a>=c.length)throw new RangeError("invalid instance variable");var d=c[a];if("number"===typeof d)c[a]="number"===typeof b?c[a]+b:c[a]+parseFloat(b);else{if("boolean"===typeof d)throw Error("can not set offset of boolean variable");if("string"===typeof d)throw Error("can not set offset of string variable");throw Error("unknown instance variable type");}}}GetSavedDataMap(){let a=
  f.get(this);if(a)return a;a=new Map;f.set(this,a);return a}GetUnsavedDataMap(){let a=h.get(this);if(a)return a;a=new Map;h.set(this,a);return a}_HasAnyCreateDestroyHandler(a){const b=this.GetObjectClass();if(b.UserScriptDispatcher().HasAnyHandlerFor(a))return!0;for(const c of b.GetFamilies())if(c.UserScriptDispatcher().HasAnyHandlerFor(a))return!0;return this._runtime.UserScriptDispatcher().HasAnyHandlerFor(a)?!0:!1}_TriggerOnCreated(){if(this._HasAnyCreateDestroyHandler("instancecreate")){const a=
  this.GetObjectClass(),b=new e.Event("instancecreate");b.instance=this.GetInterfaceClass();a.DispatchUserScriptEvent(b);for(const c of a.GetFamilies())c.DispatchUserScriptEvent(b);this._runtime.DispatchUserScriptEvent(b)}this._runtime.Trigger(this.GetPlugin().constructor.Cnds.OnCreated,this,null)}_TriggerOnDestroyed(){this._runtime.Trigger(this.GetPlugin().constructor.Cnds.OnDestroyed,this,null)}_FireDestroyedScriptEvents(a){if(this._iScriptInterface){var b=new e.Event("destroy");b.isEndingLayout=
  a;this.DispatchUserScriptEvent(b)}if(this._HasAnyCreateDestroyHandler("instancedestroy")){b=this.GetObjectClass();var c=new e.Event("instancedestroy");c.instance=this.GetInterfaceClass();c.isEndingLayout=a;b.DispatchUserScriptEvent(c);for(const a of b.GetFamilies())a.DispatchUserScriptEvent(c);this._runtime.DispatchUserScriptEvent(c)}}_GetDebuggerProperties(){return this._sdkInst.GetDebuggerProperties()}SaveToJson(a="full"){const b={};"full"===a?b.uid=this.GetUID():b.c3=!0;if("visual-state"!==a){(a=
  f.get(this))&&a.size&&(b.ex=e.ToSuperJSON(a));-1!==this.GetTimeScale()&&(b.mts=this.GetTimeScale());if(0<this._objectType.GetInstanceVariablesCount()){a={};var c=this._objectType.GetInstanceVariableSIDs();for(let b=0,d=this._instVarValues.length;b<d;++b)a[c[b].toString()]=this._instVarValues[b];b.ivs=a}if(this._behaviorInstances.length){a={};for(var d of this._behaviorInstances)(c=d.SaveToJson())&&(a[d.GetBehaviorType().GetSID().toString()]=c);b.behs=a}}this._worldInfo&&(b.w=this._worldInfo._SaveToJson());
  (d=this._sdkInst.SaveToJson())&&(b.data=d);return b}LoadFromJson(a,b="full"){if("full"===b)this._uid=a.uid;else if(!a.c3)return;if("visual-state"!==b){var c=f.get(this);c&&(c.clear(),f.delete(this));if(c=a.ex)c=e.FromSuperJSON(c),f.set(this,c);this._timeScale=a.hasOwnProperty("mts")?a.mts:-1;if(c=a.ivs)for(const [a,b]of Object.entries(c))if(c=parseInt(a,10),c=this._objectType.GetInstanceVariableIndexBySID(c),!(0>c||c>=this._instVarValues.length)){var d=b;null===d&&(d=NaN);this._instVarValues[c]=d}}if(this.GetPlugin().IsWorldType()){c=
  a.w;var g=c.l;this._worldInfo.GetLayer().GetSID()!==g&&(d=this._worldInfo.GetLayer(),(g=d.GetLayout().GetLayerBySID(g))?(this._worldInfo._SetLayer(g),d._RemoveInstance(this,!0),g._AddInstance(this,!0),g.SetZIndicesChanged(),this._worldInfo.SetBboxChanged()):"full"===b&&this._runtime.DestroyInstance(this));this._worldInfo._LoadFromJson(c)}if("visual-state"!==b&&(b=a.behs))for(const [a,c]of Object.entries(b))b=parseInt(a,10),b=this.GetBehaviorIndexBySID(b),0>b||b>=this._behaviorInstances.length||this._behaviorInstances[b].LoadFromJson(c);
  (a=a.data)&&this._sdkInst.LoadFromJson(a)}GetInterfaceClass(){return this._iScriptInterface||this._InitUserScriptInterface()}_InitUserScriptInterface(){var a=this._worldInfo?self.IWorldInstance:k;const b=this._sdkInst.GetScriptInterfaceClass(),c=this._objectType._GetUserScriptInstanceClass(),d=c||b||a;k._Init(this);this._iScriptInterface=new d;k._Init(null);if(b&&!(this._iScriptInterface instanceof a))throw new TypeError(`script interface class '${b.name}' does not extend the right base class '${a.name}'`);
  if(c&&(a=b||a,!(this._iScriptInterface instanceof a)))throw new TypeError(`setInstanceClass(): class '${c.name}' does not extend the right base class '${a.name}'`);return this._iScriptInterface}_GetInstVarsScriptDescriptor(a){if(0!==this._instVarValues.length){var b={},c=this._objectType._GetAllInstanceVariableJsPropNames();for(let a=0,f=c.length;a<f;++a)b[c[a]]={configurable:!1,enumerable:!0,get:e.Instance.prototype._GetInstanceVariableValueUnchecked.bind(this,a),set:e.Instance.prototype.SetInstanceVariableValue.bind(this,
  a)};b=Object.create(Object.prototype,b);a.instVars={value:b,writable:!1}}}_GetBehaviorsScriptDescriptor(a){var b=this._behaviorInstances;if(0!==b.length){var c={};for(const a of b)c[a.GetBehaviorType().GetJsPropName()]={value:a.GetScriptInterface(),writable:!1};b=Object.create(Object.prototype,c);a.behaviors={value:b,writable:!1}}}DispatchUserScriptEvent(a){a.instance=this.GetInterfaceClass();var b=this._runtime;(b=b.IsDebug()&&!b.GetEventSheetManager().IsInEventEngine())&&l.StartMeasuringScriptTime();
  this.GetInterfaceClass().dispatchEvent(a);b&&l.AddScriptTime()}}};
  
  
  // c3/objects/worldInfo.js
  'use strict';{const d=self.C3,k=d.New(d.Rect),q=d.New(d.Rect),r=d.New(d.Event,"bboxchange",!1),e=d.New(d.Color,0,0,0,0),m=d.New(d.Color,1,1,1,1),n=d.New(d.Rect,0,0,-1,-1),p=d.New(d.Rect,0,0,-1,-1);let l=!0;d.WorldInfo=class extends d.DefendedBase{constructor(a,b){super();this._inst=a;this._objectClass=a.GetObjectClass();this._runtime=a.GetRuntime();this._layer=b;this._zIndex=-1;this._flags=27;this._objectClass.GetPlugin().IsRotatable()&&(this._flags|=128);this._oy=this._ox=this._cosA=this._sinA=this._a=
  this._h=this._w=this._zElevation=this._y=this._x=NaN;this._boundingBox=d.New(d.Rect);this._boundingQuad=d.New(d.Quad);this._collisionCells=p;this._renderCells=n;this._solidFilterTags=this._transformedPolyInfo=this._sourceCollisionPoly=null;this._colorPremultiplied=this._color=m;this._blendMode=-1;this._instanceEffectList=this._stateGroup=null;this._inst.GetObjectClass().UsesEffects()&&(this._instanceEffectList=d.New(d.InstanceEffectList,this._inst,this));l=!1;this.SetBlendMode(0);l=!0}Release(){this._stateGroup&&
  (this._runtime.GetWebGLRenderer().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._layer=this._runtime=this._objectClass=this._inst=null}Init(a){l=!1;this.SetXY(a[0],a[1]);this.SetZElevation(a[2]);this.SetSize(a[3],a[4]);this.IsRotatable()?this.SetAngle(a[6]):this._a=0;e.setFromJSON(a[7]);
  this._SetColor(e);this.SetOriginX(a[8]);this.SetOriginY(a[9]);this.SetBlendMode(a[10]);this._instanceEffectList&&this._instanceEffectList._LoadEffectParameters(a[12]);l=!0;this._UpdateWebGLStateGroup()}InitNoData(){this._sinA=this._a=this._h=this._w=this._zElevation=this._y=this._x=0;this._cosA=1;this._oy=this._ox=0;this._UpdateWebGLStateGroup()}GetRuntime(){return this._runtime}GetObjectClass(){return this._objectClass}GetInstance(){return this._inst}SetX(a){this._x=+a}OffsetX(a){this._x+=+a}GetX(){return this._x}SetY(a){this._y=
  +a}OffsetY(a){this._y+=+a}GetY(){return this._y}SetXY(a,b){this._x=+a;this._y=+b}OffsetXY(a,b){this._x+=+a;this._y+=+b}EqualsXY(a,b){return this._x===a&&this._y===b}SetZElevation(a){a=+a;this._zElevation!==a&&(this._zElevation=a,this._UpdateWebGLStateGroup(),a=this.GetLayer(),0!==this._zElevation&&a._SetAnyInstanceZElevated(),a.SetZIndicesChanged())}OffsetZElevation(a){this.SetZElevation(this.GetZElevation()+a)}GetZElevation(){return this._zElevation}GetTotalZElevation(){return this.GetLayer().GetZElevation()+
  this.GetZElevation()}SetWidth(a){this._w=+a}OffsetWidth(a){this._w+=+a}GetWidth(){return this._w}SetHeight(a){this._h=+a}OffsetHeight(a){this._h+=+a}GetHeight(){return this._h}SetSize(a,b){this._w=+a;this._h=+b}SetOriginalSize(a,b){this._ow=+a;this._oh=+b}IsRotatable(){return 0!==(this._flags&128)}SetAngle(a){a=d.clampAngle(+a);this._a!==a&&this.IsRotatable()&&(this._a=a,this._sinA=Math.sin(a),this._cosA=Math.cos(a))}OffsetAngle(a){a=+a;0!==a&&this.IsRotatable()&&(this._a=d.clampAngle(this._a+a),
  this._sinA=Math.sin(this._a),this._cosA=Math.cos(this._a))}GetAngle(){return this._a}GetSinAngle(){return this._sinA}GetCosAngle(){return this._cosA}SetOriginX(a){this._ox=+a}OffsetOriginX(a){this._ox+=+a}GetOriginX(){return this._ox}SetOriginY(a){this._oy=+a}OffsetOriginY(a){this._oy+=+a}GetOriginY(){return this._oy}_SetColor(a){this._color.equals(a)||(this._color===m?(this._color=d.New(d.Color,a),this._colorPremultiplied=d.New(d.Color,a),this._colorPremultiplied.premultiply()):a.equalsRgba(1,1,
  1,1)?this._colorPremultiplied=this._color=m:(this._color.set(a),this._colorPremultiplied.set(a),this._colorPremultiplied.premultiply()),this._UpdateWebGLStateGroup())}SetOpacity(a){a=d.clamp(+a,0,1);this._color.a!==a&&(e.copyRgb(this._color),e.a=a,this._SetColor(e))}OffsetOpacity(a){this.SetOpacity(this.GetOpacity()+a)}GetOpacity(){return this._color.a}SetUnpremultipliedColor(a){this._color.equalsIgnoringAlpha(a)||(e.copyRgb(a),e.a=this._color.a,this._SetColor(e))}SetUnpremultipliedColorRGB(a,b,c){e.setRgb(a,
  b,c);this.SetUnpremultipliedColor(e)}OffsetUnpremultipliedColorRGB(a,b,c){if(0!==a||0!==b||0!==c)e.copyRgb(this._color),e.r+=a,e.g+=b,e.b+=c,this.SetUnpremultipliedColor(e)}GetUnpremultipliedColor(){return this._color}GetPremultipliedColor(){return this._colorPremultiplied}_UpdateWebGLStateGroup(){if(l){var a=this._runtime.GetWebGLRenderer();this._stateGroup&&a.ReleaseStateGroup(this._stateGroup);this._stateGroup=a.AcquireStateGroup(a.GetTextureFillShaderProgram()||"<default>",this.GetBlendMode(),
  this._colorPremultiplied,this._zElevation)}}GetWebGLStateGroup(){return this._stateGroup}HasDefaultColor(){return this._color===m}SetBlendMode(a){this._blendMode!==a&&(this._blendMode=a,this._UpdateWebGLStateGroup())}GetBlendMode(){return this._blendMode}_SetLayer(a){this._layer=a;0!==this.GetZElevation()&&this._layer._SetAnyInstanceZElevated()}GetLayer(){return this._layer}GetLayout(){return this.GetLayer().GetLayout()}_SetZIndex(a){this._zIndex=a|0}GetZIndex(){this._layer._UpdateZIndices();return this._zIndex}_GetLastCachedZIndex(){return this._zIndex}_SetFlag(a,
  b){this._flags=b?this._flags|a:this._flags&~a}IsVisible(){return 0!==(this._flags&1)}SetVisible(a){this._SetFlag(1,a)}IsCollisionEnabled(){return 0!==(this._flags&8)}SetCollisionEnabled(a){a=!!a;this.IsCollisionEnabled()!==a&&(this._SetFlag(8,a),a?this.SetBboxChanged():this._RemoveFromCollisionCells())}SetSolidCollisionFilter(a,b){this._SetFlag(32,a);this._solidFilterTags&&this._solidFilterTags.clear();if(b.trim()){this._solidFilterTags||(this._solidFilterTags=new Set);for(const a of b.split(" "))a&&
  this._solidFilterTags.add(a.toLowerCase())}else this._solidFilterTags=null}IsSolidCollisionAllowed(a){const b=0!==(this._flags&32),c=this._solidFilterTags;if(!a||!c)return!b;for(const d of c)if(a.has(d))return b;return!b}SetBboxChanged(){this._flags|=18;this._objectClass._SetAnyCollisionCellChanged(!0);this._runtime.UpdateRender();this._layer.UsesRenderCells()&&(this._CalculateBbox(),this._UpdateRenderCell());0!==(this._flags&4)&&this._inst.Dispatcher().dispatchEvent(r)}_CalculateBbox(){const a=this._boundingBox,
  b=this._boundingQuad,c=this._x,f=this._y,h=this.GetWidth(),g=this.GetHeight();a.setWH(c-this._ox*h,f-this._oy*g,h,g);0===this._a?b.setFromRect(a):(a.offset(-c,-f),b.setFromRotatedRectPrecalc(a,this._sinA,this._cosA),b.offset(c,f),b.getBoundingBox(a));a.normalize();this._flags&=-3}_UpdateBbox(){0!==(this._flags&2)&&this._CalculateBbox()}GetBoundingBox(){this._UpdateBbox();return this._boundingBox}GetBoundingQuad(){this._UpdateBbox();return this._boundingQuad}OverwriteBoundingBox(a){this._boundingBox.copy(a);
  this._boundingQuad.setFromRect(this._boundingBox);this._flags&=-3;this._UpdateCollisionCell();this._UpdateRenderCell()}SetBboxChangeEventEnabled(a){this._SetFlag(4,a)}IsBboxChangeEventEnabled(){return 0!==(this._flags&4)}IsInViewport(a){return 0===this._zElevation?a.intersectsRect(this.GetBoundingBox()):this._IsInViewport_ZElevated()}_IsInViewport_ZElevated(){const a=this.GetLayer(),b=this.GetTotalZElevation();if(b>=a.GetCameraZ())return!1;a.GetViewportForZ(b,q);return q.intersectsRect(this.GetBoundingBox())}SetSourceCollisionPoly(a){this._sourceCollisionPoly=
  a;if(a=this._transformedPolyInfo)a.width=-1,a.height=-1,a.angle=0}GetSourceCollisionPoly(){return this._sourceCollisionPoly}HasOwnCollisionPoly(){return!!this._sourceCollisionPoly}GetTransformedCollisionPoly(){return this._GetCustomTransformedCollisionPolyPrecalc(this.GetWidth(),this.GetHeight(),this.GetAngle(),this.GetSinAngle(),this.GetCosAngle())}GetCustomTransformedCollisionPoly(a,b,c){let f=0,h=1;0!==c&&(f=Math.sin(c),h=Math.cos(c));return this._GetCustomTransformedCollisionPolyPrecalc(a,b,c,
  f,h)}_GetCustomTransformedCollisionPolyPrecalc(a,b,c,f,h){let g=this._transformedPolyInfo;null===g&&(this._transformedPolyInfo=g={poly:d.New(d.CollisionPoly),width:-1,height:-1,angle:0});if(g.width===a&&g.height===b&&g.angle===c)return g.poly;this._sourceCollisionPoly?(g.poly.copy(this._sourceCollisionPoly),g.poly.transformPrecalc(a,b,f,h)):g.poly.setFromQuad(this.GetBoundingQuad(),-this.GetX(),-this.GetY());g.width=a;g.height=b;g.angle=c;return g.poly}HasTilemap(){return this._inst.HasTilemap()}ContainsPoint(a,
  b){return this.GetBoundingBox().containsPoint(a,b)&&this.GetBoundingQuad().containsPoint(a,b)?this.HasTilemap()?this._inst.GetSdkInstance().TestPointOverlapTile(a,b):this.HasOwnCollisionPoly()?this.GetTransformedCollisionPoly().containsPoint(a-this.GetX(),b-this.GetY()):!0:!1}_IsCollisionCellChanged(){return 0!==(this._flags&16)}_UpdateCollisionCell(){if(this._IsCollisionCellChanged()&&this.IsCollisionEnabled()){var a=this.GetBoundingBox(),b=this._objectClass._GetCollisionCellGrid(),c=this._collisionCells;
  k.set(b.XToCell(a.getLeft()),b.YToCell(a.getTop()),b.XToCell(a.getRight()),b.YToCell(a.getBottom()));c.equals(k)||(a=this._inst,c===p?(b.Update(a,null,k),this._collisionCells=d.New(d.Rect,k)):(b.Update(a,c,k),c.copy(k)),this._flags&=-17)}}_RemoveFromCollisionCells(){const a=this._collisionCells;a!==p&&(this._objectClass._GetCollisionCellGrid().Update(this._inst,a,null),this._collisionCells=p)}_UpdateRenderCell(){const a=this.GetLayer();if(a.UsesRenderCells()){var b=a.GetRenderGrid(),c=this.GetBoundingBox(),
  f=this._renderCells;k.set(b.XToCell(c.getLeft()),b.YToCell(c.getTop()),b.XToCell(c.getRight()),b.YToCell(c.getBottom()));f.equals(k)||(c=this._inst,f===n?(b.Update(c,null,k),this._renderCells=d.New(d.Rect,k)):(b.Update(c,f,k),f.copy(k)),a.SetRenderListStale())}}_RemoveFromRenderCells(){const a=this._renderCells;a!==n&&(this.GetLayer().GetRenderGrid().Update(this._inst,a,null),this._renderCells=n)}GetRenderCellRange(){return this._renderCells}ZOrderMoveToTop(){const a=this._inst,b=this._layer,c=b._GetInstances();
  c.length&&c[c.length-1]===a||(b._RemoveInstance(a,!1),b._AddInstance(a,!1),this._runtime.UpdateRender())}ZOrderMoveToBottom(){const a=this._inst,b=this._layer,c=b._GetInstances();c.length&&c[0]===a||(b._RemoveInstance(a,!1),b._PrependInstance(a,!1),this._runtime.UpdateRender())}ZOrderMoveToLayer(a){const b=this._inst,c=this._layer;if(c.GetLayout()!==a.GetLayout())throw Error("layer from different layout");a!==c&&(c._RemoveInstance(b,!0),this._SetLayer(a),a._AddInstance(b,!0),this._runtime.UpdateRender())}ZOrderMoveAdjacentToInstance(a,
  b){const c=this._inst,f=this._layer;if(a.GetUID()!==c.GetUID()){var h=a.GetWorldInfo();if(!h)throw Error("expected world instance");h=h.GetLayer();f.GetIndex()!==h.GetIndex()&&(f._RemoveInstance(c,!0),this._SetLayer(h),h._AddInstance(c,!0));h.MoveInstanceAdjacent(c,a,!!b);this._runtime.UpdateRender()}}GetInstanceEffectList(){return this._instanceEffectList}_SetHasAnyActiveEffect(a){this._SetFlag(64,a)}HasAnyActiveEffect(){return 0!==(this._flags&64)}_SaveToJson(){const a={x:this.GetX(),y:this.GetY(),
  w:this.GetWidth(),h:this.GetHeight(),l:this.GetLayer().GetSID(),zi:this.GetZIndex()};0!==this.GetZElevation()&&(a.ze=this.GetZElevation());0!==this.GetAngle()&&(a.a=this.GetAngle());this.HasDefaultColor()||(a.c=this._color.toJSON());.5!==this.GetOriginX()&&(a.oX=this.GetOriginX());.5!==this.GetOriginY()&&(a.oY=this.GetOriginY());0!==this.GetBlendMode()&&(a.bm=this.GetBlendMode());this.IsVisible()||(a.v=this.IsVisible());this.IsCollisionEnabled()||(a.ce=this.IsCollisionEnabled());this.IsBboxChangeEventEnabled()&&
  (a.be=this.IsBboxChangeEventEnabled());this._instanceEffectList&&(a.fx=this._instanceEffectList._SaveToJson());const b=0!==(this._flags&32);b&&(a.sfi=b);this._solidFilterTags&&(a.sft=[...this._solidFilterTags].join(" "));return a}_LoadFromJson(a){l=!1;this.SetX(a.x);this.SetY(a.y);this.SetWidth(a.w);this.SetHeight(a.h);this._SetZIndex(a.zi);this.SetZElevation(a.hasOwnProperty("ze")?a.ze:0);this.SetAngle(a.hasOwnProperty("a")?a.a:0);a.hasOwnProperty("c")?e.setFromJSON(a.c):a.hasOwnProperty("o")?(e.copyRgb(this._color),
  e.a=a.o):e.setRgba(1,1,1,1);this._SetColor(e);this.SetOriginX(a.hasOwnProperty("oX")?a.oX:.5);this.SetOriginY(a.hasOwnProperty("oY")?a.oY:.5);this.SetBlendMode(a.hasOwnProperty("bm")?a.bm:0);this.SetVisible(a.hasOwnProperty("v")?a.v:!0);this.SetCollisionEnabled(a.hasOwnProperty("ce")?a.ce:!0);this.SetBboxChangeEventEnabled(a.hasOwnProperty("be")?a.be:!1);this.SetSolidCollisionFilter(a.hasOwnProperty("sfi")?a.sfi:!1,a.hasOwnProperty("sft")?a.sft:"");this._instanceEffectList&&a.hasOwnProperty("fx")&&
  this._instanceEffectList._LoadFromJson(a.fx);this.SetBboxChanged();l=!0;this._UpdateWebGLStateGroup()}}};
  
  
  // c3/objects/behaviorType.js
  'use strict';{const b=self.C3;b.BehaviorType=class extends b.DefendedBase{constructor(c,a){super();const e=c.GetRuntime(),f=e.GetPluginManager(),d=e.GetObjectReference(a[1]);f.HasBehaviorByConstructorFunction(d)||f.CreateBehavior(a);this._runtime=e;this._objectClass=c;this._behavior=f.GetBehaviorByConstructorFunction(d);this._sdkType=null;this._instSdkCtor=d.Instance;this._sid=a[2];this._name=a[0];this._jsPropName=this._runtime.GetJsPropName(a[3]);this._sdkType=b.New(d.Type,this);this.OnCreate()}static Create(c,
  a){return b.New(b.BehaviorType,c,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}}};
  
  
  // c3/objects/behaviorInstance.js
  'use strict';{const f=self.C3,c=self.IBehaviorInstance;f.BehaviorInstance=class extends f.DefendedBase{constructor(a){super();this._runtime=a.runtime;this._behaviorType=a.behaviorType;this._behavior=this._behaviorType.GetBehavior();this._inst=a.instance;this._index=a.index;this._iScriptInterface=this._sdkInst=null;this._behavior._AddInstance(this._inst)}Release(){this._behavior._RemoveInstance(this._inst);this._sdkInst.Release();this._inst=this._behavior=this._behaviorType=this._runtime=this._iScriptInterface=
  this._sdkInst=null}_CreateSdkInstance(a){if(this._sdkInst)throw Error("already got sdk instance");this._sdkInst=f.New(this._behaviorType.GetInstanceSdkCtor(),this,a);this._InitScriptInterface()}GetSdkInstance(){return this._sdkInst}GetObjectInstance(){return this._inst}GetRuntime(){return this._runtime}GetBehaviorType(){return this._behaviorType}GetBehavior(){return this._behavior}_GetIndex(){return this._index}PostCreate(){this._sdkInst.PostCreate()}OnSpriteFrameChanged(a,b){this._sdkInst.OnSpriteFrameChanged(a,
  b)}_GetDebuggerProperties(){return this._sdkInst.GetDebuggerProperties()}SaveToJson(){return this._sdkInst.SaveToJson()}LoadFromJson(a){return this._sdkInst.LoadFromJson(a)}static SortByTickSequence(a,b){var d=a.GetObjectInstance(),e=b.GetObjectInstance();const g=d.GetObjectClass().GetIndex(),h=e.GetObjectClass().GetIndex();if(g!==h)return g-h;d=d.GetPUID();e=e.GetPUID();return d!==e?d-e:a.GetBehaviorInstance()._GetIndex()-b.GetBehaviorInstance()._GetIndex()}_InitScriptInterface(){const a=this._sdkInst.GetScriptInterfaceClass(),
  b=a||c;c._Init(this);this._iScriptInterface=new b;c._Init(null);if(a&&!(this._iScriptInterface instanceof c))throw new TypeError(`script interface class '${a.name}' does not extend the right base class '${c.name}'`);}GetScriptInterface(){return this._iScriptInterface}}};
  
  
  // c3/objects/effectList.js
  'use strict';{const c=self.C3;c.EffectList=class extends c.DefendedBase{constructor(a,b){super();this._owner=a;this._allEffectTypes=[];this._activeEffectTypes=[];this._effectTypesByName=new Map;this._effectParams=[];this._preservesOpaqueness=!0;for(const d of b)a=c.New(c.EffectType,this,d,this._allEffectTypes.length),this._allEffectTypes.push(a),this._effectTypesByName.set(a.GetName().toLowerCase(),a),3<=d.length&&this._effectParams.push(this._LoadSingleEffectParameters(d[2]));this.GetRuntime()._AddEffectList(this)}Release(){c.clearArray(this._allEffectTypes);
  c.clearArray(this._activeEffectTypes);this._effectTypesByName.clear();c.clearArray(this._effectParams);this._owner=null}PrependEffectTypes(a){if(a.length){this._allEffectTypes=a.concat(this._allEffectTypes);for(const b of a)this._effectTypesByName.set(b.GetName().toLowerCase(),b);for(let a=0,c=this._allEffectTypes.length;a<c;++a)this._allEffectTypes[a]._SetIndex(a)}}_LoadSingleEffectParameters(a){a=a.slice(0);for(let b=0,d=a.length;b<d;++b){const d=a[b];if(Array.isArray(d)){const e=c.New(c.Color);
  e.setFromJSON(d);a[b]=e}}return a}GetOwner(){return this._owner}GetRuntime(){return this._owner.GetRuntime()}UpdateActiveEffects(){c.clearArray(this._activeEffectTypes);let a=!0;for(const b of this._allEffectTypes)b.IsActive()&&(this._activeEffectTypes.push(b),b.GetShaderProgram().PreservesOpaqueness()||(a=!1));this._preservesOpaqueness=a}GetAllEffectTypes(){return this._allEffectTypes}HasAnyEffectType(){return 0<this._allEffectTypes.length}GetEffectTypeByName(a){return this._effectTypesByName.get(a.toLowerCase())||
  null}GetEffectTypeByIndex(a){a=Math.floor(+a);if(0>a||a>=this._allEffectTypes.length)throw new RangeError("invalid effect type index");return this._allEffectTypes[a]}IsEffectIndexActive(a){return this.GetEffectTypeByIndex(a).IsActive()}SetEffectIndexActive(a,b){this.GetEffectTypeByIndex(a).SetActive(b)}GetActiveEffectTypes(){return this._activeEffectTypes}HasAnyActiveEffect(){return 0<this._activeEffectTypes.length}PreservesOpaqueness(){return this._preservesOpaqueness}GetEffectParametersForIndex(a){return this._effectParams[a]}static SaveFxParamToJson(a){return a&&
  a instanceof c.Color?{t:"color",v:a.toJSON()}:a}static LoadFxParamFromJson(a){if("object"===typeof a){if("color"===a.t){const b=c.New(c.Color);b.setFromJSON(a.v);return b}throw Error("invalid effect parameter type");}return a}static SaveFxParamsToJson(a){return a.map(c.EffectList.SaveFxParamToJson)}static LoadFxParamsFromJson(a){return a.map(c.EffectList.LoadFxParamFromJson)}SaveToJson(){return this._allEffectTypes.map(a=>({name:a.GetName(),active:a.IsActive(),params:c.EffectList.SaveFxParamsToJson(this._effectParams[a.GetIndex()])}))}LoadFromJson(a){for(const b of a)if(a=
  this.GetEffectTypeByName(b.name))a.SetActive(b.active),this._effectParams[a.GetIndex()]=c.EffectList.LoadFxParamsFromJson(b.params);this.UpdateActiveEffects()}}};
  
  
  // c3/objects/effectType.js
  'use strict';{const c=self.C3;c.EffectType=class extends c.DefendedBase{constructor(a,d,b){super();this._effectList=a;this._id=d[0];this._name=d[1];this._index=b;this._shaderProgram=null;this._isActive=!0}Release(){this._shaderProgram=this._effectList=null}Clone(a){a=c.New(c.EffectType,a,[this._id,this._name],-1);a._shaderProgram=this._shaderProgram;a._isActive=this._isActive;return a}_InitRenderer(a){a=a.GetShaderProgramByName(this._id);if(!a)throw Error("failed to find shader program '"+this._id+
  "'");this._shaderProgram=a}GetEffectList(){return this._effectList}GetName(){return this._name}_SetIndex(a){this._index=a}GetIndex(){return this._index}GetOwner(){return this._effectList.GetOwner()}GetRuntime(){return this._effectList.GetRuntime()}SetActive(a){this._isActive=!!a}IsActive(){return this._isActive}GetShaderProgram(){return this._shaderProgram}GetDefaultParameterValues(){const a=[];for(let d=0,b=this._shaderProgram.GetParameterCount();d<b;++d){const b=this._shaderProgram.GetParameterType(d);
  if("float"===b||"percent"===b)a.push(0);else if("color"===b)a.push(c.New(c.Color,1,1,1,1));else throw new TypeError("unknown effect parameter type");}return a}}};
  
  
  // c3/objects/instanceEffectList.js
  'use strict';{const c=self.C3;c.InstanceEffectList=class extends c.DefendedBase{constructor(a,b,d){super();this._inst=a;this._wi=b;this._effectList=a.GetObjectClass().GetEffectList();this._activeEffectFlags=[];this._activeEffectTypes=[];this._preservesOpaqueness=!0;this._effectParams=[];for(const a of this._effectList.GetAllEffectTypes())this._activeEffectFlags.push(!0);this.UpdateActiveEffects()}Release(){c.clearArray(this._activeEffectFlags);c.clearArray(this._activeEffectTypes);c.clearArray(this._effectParams);
  this._effectList=this._inst=null}_LoadEffectParameters(a){for(const b of a)this._effectParams.push(this._LoadSingleEffectParameters(b))}_LoadSingleEffectParameters(a){a=a.slice(0);for(let b=0,d=a.length;b<d;++b){const e=a[b];if(Array.isArray(e)){const f=c.New(c.Color);f.setFromJSON(e);a[b]=f}}return a}LoadDefaultEffectParameters(){for(const a of this._effectList.GetAllEffectTypes())this._effectParams.push(a.GetDefaultParameterValues())}GetOwner(){return this._owner}GetEffectList(){return this._effectList}GetRuntime(){return this._inst.GetRuntime()}UpdateActiveEffects(){c.clearArray(this._activeEffectTypes);
  const a=this._effectList.GetAllEffectTypes(),b=this._activeEffectTypes,d=this._activeEffectFlags;let e=!0;for(let c=0,g=a.length;c<g;++c)if(d[c]){const d=a[c];b.push(d);d.GetShaderProgram().PreservesOpaqueness()||(e=!1)}this._preservesOpaqueness=e;this._wi._SetHasAnyActiveEffect(!!b.length)}GetActiveEffectTypes(){return this._activeEffectTypes}GetEffectParametersForIndex(a){return this._effectParams[a]}PreservesOpaqueness(){return this._preservesOpaqueness}HasAnyActiveBackgroundBlendingEffect(){return this._activeEffectTypes.some(a=>
  a.GetShaderProgram().UsesDest())}IsEffectIndexActive(a){return this._activeEffectFlags[a]}SetEffectIndexActive(a,b){this._activeEffectFlags[a]=!!b}GetAllEffectTypes(){return this._effectList.GetAllEffectTypes()}_SaveToJson(){return this._effectList.GetAllEffectTypes().map(a=>({name:a.GetName(),active:this._activeEffectFlags[a.GetIndex()],params:c.EffectList.SaveFxParamsToJson(this._effectParams[a.GetIndex()])}))}_LoadFromJson(a){for(const b of a)if(a=this._effectList.GetEffectTypeByName(b.name))this._activeEffectFlags[a.GetIndex()]=
  b.active,this._effectParams[a.GetIndex()]=c.EffectList.LoadFxParamsFromJson(b.params);this.UpdateActiveEffects()}}};
  
  
  // c3/collisions/collisionEngine.js
  'use strict';{const g=self.C3,r=[],n=[],B=[],t=g.New(g.CollisionPoly),x=g.New(g.CollisionPoly),w=g.New(g.Quad),y=g.New(g.Rect),z=g.New(g.Rect);g.CollisionEngine=class extends g.DefendedBase{constructor(a){super();this._runtime=a;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(a,b){const c=a.GetWorldInfo(),d=b.GetWorldInfo();c&&d&&c.IsCollisionEnabled()&&d.IsCollisionEnabled()&&this._registeredCollisions.push([a,b])}AddRegisteredCollisionCandidates(a,b,c){for(const [d,f]of this._registeredCollisions){let e;if(a===d)e=f;else if(a===f)e=d;else continue;e.BelongsToObjectClass(b)&&(c.includes(e)||c.push(e))}}CheckRegisteredCollision(a,
  b){if(!this._registeredCollisions.length)return!1;for(const [c,d]of this._registeredCollisions)if(a===c&&b===d||a===d&&b===c)return!0;return!1}ClearRegisteredCollisions(){g.clearArray(this._registeredCollisions)}TestOverlap(a,b){if(!a||!b||a===b)return!1;a=a.GetWorldInfo();b=b.GetWorldInfo();if(!a.IsCollisionEnabled()||!b.IsCollisionEnabled())return!1;this._collisionCheckCount++;const c=a.GetLayer(),d=b.GetLayer();return c===d||c._IsCollisionCompatibleWith(d)?this._TestOverlap_SameLayers(a,b):this._TestOverlap_DifferentLayers(a,
  b)}_TestOverlap_SameLayers(a,b){if(!a.GetBoundingBox().intersectsRect(b.GetBoundingBox()))return!1;this._polyCheckCount++;if(!a.GetBoundingQuad().intersectsQuad(b.GetBoundingQuad())||a.HasTilemap()&&b.HasTilemap())return!1;if(a.HasTilemap())return this.TestTilemapOverlap(a,b);if(b.HasTilemap())return this.TestTilemapOverlap(b,a);if(!a.HasOwnCollisionPoly()&&!b.HasOwnCollisionPoly())return!0;const c=a.GetTransformedCollisionPoly(),d=b.GetTransformedCollisionPoly();return c.intersectsPoly(d,b.GetX()-
  a.GetX(),b.GetY()-a.GetY())}_TestOverlap_DifferentLayers(a,b){var c=a.GetLayer();const d=b.GetLayer();t.copy(a.GetTransformedCollisionPoly());x.copy(b.GetTransformedCollisionPoly());var f=t.pointsArr();for(let b=0,d=f.length;b<d;b+=2){const d=b+1,e=f[d],[m,k]=c.LayerToCanvasCss(f[b]+a.GetX(),e+a.GetY());f[b]=m;f[d]=k}a=x.pointsArr();for(let e=0,k=a.length;e<k;e+=2){c=e+1;f=a[c];const [k,h]=d.LayerToCanvasCss(a[e]+b.GetX(),f+b.GetY());a[e]=k;a[c]=h}t.setBboxChanged();x.setBboxChanged();this._polyCheckCount++;
  return t.intersectsPoly(x,0,0)}TestTilemapOverlap(a,b){const c=b.GetBoundingBox(),d=a.GetX(),f=a.GetY();var e=a.GetInstance().GetSdkInstance();a=b.GetX();const k=b.GetY(),l=b.HasOwnCollisionPoly(),h=b.GetBoundingQuad();e.GetCollisionRectCandidates(c,n);for(let q=0,u=n.length;q<u;++q){var m=n[q];e=m.GetRect();this._collisionCheckCount++;if(c.intersectsRectOffset(e,d,f)&&(w.setFromRect(e),w.offset(d,f),w.intersectsQuad(h)))if(l){var p=b.GetTransformedCollisionPoly();if(m=m.GetPoly()){if(this._polyCheckCount++,
  m.intersectsPoly(p,a-(d+e.getLeft()),k-(f+e.getTop())))return g.clearArray(n),!0}else if(t.setFromQuad(w,0,0),t.intersectsPoly(p,a,k))return g.clearArray(n),!0}else if(p=m.GetPoly()){if(t.setFromQuad(h,0,0),p.intersectsPoly(t,-(d+e.getLeft()),-(f+e.getTop())))return g.clearArray(n),!0}else return g.clearArray(n),!0}g.clearArray(n);return!1}TestAndSelectCanvasPointOverlap(a,b,c,d){const f=a.GetCurrentSol();var e=this._runtime.GetCurrentEvent();if(!e)throw Error("cannot call outside event");e=e.IsOrBlock();
  if(f.IsSelectAll()){d||(f._SetSelectAll(!1),g.clearArray(f._GetOwnInstances()));for(var k of a.GetInstances()){var l=k.GetWorldInfo(),h=l.GetLayer();const [a,g]=h.CanvasCssToLayer(b,c,l.GetTotalZElevation());if(l.ContainsPoint(a,g)){if(d)return!1;f._PushInstance(k)}else e&&f._PushElseInstance(k)}}else{k=e?f._GetOwnElseInstances():f._GetOwnInstances();l=0;for(let a=0,g=k.length;a<g;++a){h=k[a];const g=h.GetWorldInfo(),m=g.GetLayer(),[n,p]=m.CanvasCssToLayer(b,c,g.GetTotalZElevation());if(g.ContainsPoint(n,
  p)){if(d)return!1;e?f._PushInstance(h):k[l++]=h}else e&&(k[l++]=h)}d||(k.length=l)}a.ApplySolToContainer();return d?!0:f.HasAnyInstances()}GetCollisionCandidates(a,b,c,d){a=a?1!==a.GetParallaxX()||1!==a.GetParallaxY():!1;if(b.IsFamily())for(const f of b.GetFamilyMembers())a||f.IsAnyInstanceParallaxed()?g.appendArray(d,f.GetInstances()):(f._UpdateAllCollisionCells(),f._GetCollisionCellGrid().QueryRange(c,d));else a||b.IsAnyInstanceParallaxed()?g.appendArray(d,b.GetInstances()):(b._UpdateAllCollisionCells(),
  b._GetCollisionCellGrid().QueryRange(c,d))}GetObjectClassesCollisionCandidates(a,b,c,d){for(const f of b)this.GetCollisionCandidates(a,f,c,d)}GetSolidCollisionCandidates(a,b,c){const d=this._runtime.GetSolidBehavior();d&&this.GetObjectClassesCollisionCandidates(a,d.GetObjectClasses(),b,c)}GetJumpthruCollisionCandidates(a,b,c){const d=this._runtime.GetJumpthruBehavior();d&&this.GetObjectClassesCollisionCandidates(a,d.GetObjectClasses(),b,c)}IsSolidCollisionAllowed(a,b){return a._IsSolidEnabled()&&
  (!b||b.GetWorldInfo().IsSolidCollisionAllowed(a.GetSavedDataMap().get("solidTags")))}TestOverlapSolid(a){const b=a.GetWorldInfo();this.GetSolidCollisionCandidates(b.GetLayer(),b.GetBoundingBox(),r);for(const b of r)if(this.IsSolidCollisionAllowed(b,a)&&this.TestOverlap(a,b))return g.clearArray(r),b;g.clearArray(r);return null}TestRectOverlapSolid(a,b){this.GetSolidCollisionCandidates(null,a,r);for(const c of r)if(this.IsSolidCollisionAllowed(c,b)&&this.TestRectOverlap(a,c))return g.clearArray(r),
  c;g.clearArray(r);return null}TestOverlapJumpthru(a,b){let c=null;b&&(c=B,g.clearArray(c));const d=a.GetWorldInfo();this.GetJumpthruCollisionCandidates(d.GetLayer(),d.GetBoundingBox(),r);for(const d of r)if(d._IsJumpthruEnabled()&&this.TestOverlap(a,d))if(b)c.push(d);else return g.clearArray(r),d;g.clearArray(r);return c}PushOut(a,b,c,d,f){d=d||50;const e=a.GetWorldInfo(),k=e.GetX(),l=e.GetY();for(let h=0;h<d;++h)if(e.SetXY(k+b*h,l+c*h),e.SetBboxChanged(),!this.TestOverlap(a,f))return!0;e.SetXY(k,
  l);e.SetBboxChanged();return!1}PushOutSolid(a,b,c,d,f,e){d=d||50;const k=a.GetWorldInfo(),l=k.GetX(),h=k.GetY();let m=null,p=null;for(let g=0;g<d;++g)if(k.SetXY(l+b*g,h+c*g),k.SetBboxChanged(),!this.TestOverlap(a,m))if(m=this.TestOverlapSolid(a))p=m;else if(f&&(m=e?this.TestOverlap(a,e)?e:null:this.TestOverlapJumpthru(a))&&(p=m),!m)return p&&this.PushInFractional(a,b,c,p,16,!0),!0;k.SetXY(l,h);k.SetBboxChanged();return!1}PushOutSolidAxis(a,b,c,d){d=d||50;const f=a.GetWorldInfo(),e=f.GetX(),k=f.GetY();
  let l=null,h=null;for(let g=0;g<d;++g)for(let d=0;2>d;++d){const m=2*d-1;f.SetXY(e+b*g*m,k+c*g*m);f.SetBboxChanged();if(!this.TestOverlap(a,l))if(l=this.TestOverlapSolid(a))h=l;else return h&&this.PushInFractional(a,b*m,c*m,h,16,!0),!0}f.SetXY(e,k);f.SetBboxChanged();return!1}PushInFractional(a,b,c,d,f,e){let k=2,l=!1;var h=!1;const m=a.GetWorldInfo();let p=m.GetX(),q=m.GetY();for(;k<=f;)h=1/k,k*=2,m.OffsetXY(b*h*(l?1:-1),c*h*(l?1:-1)),m.SetBboxChanged(),this.TestOverlap(a,d)||e&&this.TestOverlapSolid(a)?
  h=l=!0:(h=l=!1,p=m.GetX(),q=m.GetY());h&&(m.SetXY(p,q),m.SetBboxChanged())}PushOutSolidNearest(a,b=100){let c=0;const d=a.GetWorldInfo(),f=d.GetX(),e=d.GetY();let k=0,l=this.TestOverlapSolid(a);if(!l)return!0;for(;c<=b;){let b=0,g=0;switch(k){case 0:b=0;g=-1;c++;break;case 1:b=1;g=-1;break;case 2:b=1;g=0;break;case 3:g=b=1;break;case 4:b=0;g=1;break;case 5:b=-1;g=1;break;case 6:b=-1;g=0;break;case 7:g=b=-1}k=(k+1)%8;d.SetXY(Math.floor(f+b*c),Math.floor(e+g*c));d.SetBboxChanged();if(!this.TestOverlap(a,
  l)&&(l=this.TestOverlapSolid(a),!l))return!0}d.SetXY(f,e);d.SetBboxChanged();return!1}CalculateBounceAngle(a,b,c,d){const f=a.GetWorldInfo(),e=f.GetX(),k=f.GetY(),l=Math.max(10,g.distanceTo(b,c,e,k));var h=g.angleTo(b,c,e,k),m=d||this.TestOverlapSolid(a);if(!m)return g.clampAngle(h+Math.PI);let p=m;var q=0,u=0;const A=g.toRadians(5);let v;for(v=1;36>v;++v){const e=h-v*A;f.SetXY(b+Math.cos(e)*l,c+Math.sin(e)*l);f.SetBboxChanged();if(!this.TestOverlap(a,p)&&(p=d?null:this.TestOverlapSolid(a),!p)){q=
  e;break}}36===v&&(q=g.clampAngle(h+Math.PI));p=m;for(v=1;36>v;++v)if(m=h+v*A,f.SetXY(b+Math.cos(m)*l,c+Math.sin(m)*l),f.SetBboxChanged(),!this.TestOverlap(a,p)&&(p=d?null:this.TestOverlapSolid(a),!p)){u=m;break}36===v&&(u=g.clampAngle(h+Math.PI));f.SetXY(e,k);f.SetBboxChanged();if(u===q)return u;a=g.angleDiff(u,q)/2;a=g.angleClockwise(u,q)?g.clampAngle(q+a+Math.PI):g.clampAngle(u+a);q=Math.cos(h);h=Math.sin(h);u=Math.cos(a);a=Math.sin(a);b=q*u+h*a;return g.angleTo(0,0,q-2*b*u,h-2*b*a)}TestSegmentOverlap(a,
  b,c,d,f){if(!f)return!1;const e=f.GetWorldInfo();if(!e.IsCollisionEnabled())return!1;this._collisionCheckCount++;y.set(Math.min(a,c),Math.min(b,d),Math.max(a,c),Math.max(b,d));if(!e.GetBoundingBox().intersectsRect(y))return!1;if(f.HasTilemap())return this._TestSegmentOverlapTilemap(a,b,c,d,f,e);this._polyCheckCount++;return e.GetBoundingQuad().intersectsSegment(a,b,c,d)?e.HasOwnCollisionPoly()?e.GetTransformedCollisionPoly().intersectsSegment(e.GetX(),e.GetY(),a,b,c,d):!0:!1}_TestSegmentOverlapTilemap(a,
  b,c,d,f,e){const k=e.GetX();e=e.GetY();f=f.GetSdkInstance();z.set(a,b,c,d);z.normalize();f.GetCollisionRectCandidates(z,n);for(let h=0,m=n.length;h<m;++h){var l=n[h];f=l.GetRect();this._collisionCheckCount++;if(y.intersectsRectOffset(f,k,e)&&(w.setFromRect(f),w.offset(k,e),w.intersectsSegment(a,b,c,d)))if(l=l.GetPoly()){if(this._polyCheckCount++,l.intersectsSegment(k+f.getLeft(),e+f.getTop(),a,b,c,d))return g.clearArray(n),!0}else return g.clearArray(n),!0}g.clearArray(n);return!1}TestRectOverlap(a,
  b){if(!b)return!1;const c=b.GetWorldInfo();if(!c.IsCollisionEnabled())return!1;this._collisionCheckCount++;if(!c.GetBoundingBox().intersectsRect(a))return!1;if(b.HasTilemap())return this._TestRectOverlapTilemap(a,b,c);this._polyCheckCount++;w.setFromRect(a);if(!c.GetBoundingQuad().intersectsQuad(w))return!1;if(!c.HasOwnCollisionPoly())return!0;t.setFromRect(a,c.GetX(),c.GetY());a=c.GetTransformedCollisionPoly();return t.intersectsPoly(a,0,0)}_TestRectOverlapTilemap(a,b,c){const d=c.GetX();c=c.GetY();
  b.GetSdkInstance().GetCollisionRectCandidates(a,n);for(let e=0,k=n.length;e<k;++e){var f=n[e];b=f.GetRect();this._collisionCheckCount++;if(a.intersectsRectOffset(b,d,c))if(f=f.GetPoly()){if(this._polyCheckCount++,t.setFromRect(a,0,0),f.intersectsPoly(t,-(d+b.getLeft()),-(c+b.getTop())))return g.clearArray(n),!0}else return g.clearArray(n),!0}g.clearArray(n);return!1}TestRayIntersectsInstance(a,b){if(a){var c=a.GetWorldInfo();c.IsCollisionEnabled()&&(this._collisionCheckCount++,c.GetBoundingBox().intersectsRect(b.rect)&&
  (a.HasTilemap()?this._TestRayIntersectsTilemap(a,c,b):(this._polyCheckCount++,c.HasOwnCollisionPoly()?b.TestInstancePoly(a,c.GetX(),c.GetY(),c.GetTransformedCollisionPoly()):b.TestInstanceQuad(a,c.GetBoundingQuad()))))}}_TestRayIntersectsTilemap(a,b,c){const d=b.GetX(),f=b.GetY();a.GetSdkInstance().GetCollisionRectCandidates(c.rect,n);for(let g=0,l=n.length;g<l;g++){var e=n[g];const h=e.GetRect();this._collisionCheckCount++;c.rect.intersectsRectOffset(h,d,f)&&(e=e.GetPoly(),this._polyCheckCount++,
  e?c.TestInstancePoly(a,d+h.getLeft(),f+h.getTop(),e):c.TestInstanceRect(a,b.GetX(),b.GetY(),h))}g.clearArray(n)}}};
  
  
  // c3/collisions/sparseGrid.js
  'use strict';{const c=self.C3;c.SparseGrid=class extends c.DefendedBase{constructor(a,b){super();this._cellWidth=a;this._cellHeight=b;this._cells=c.New(c.PairMap)}Release(){this._cells.Release();this._cells=null}GetCell(a,b,e){let d=this._cells.Get(a,b);return d?d:e?(d=c.New(c.GridCell,this,a,b),this._cells.Set(a,b,d),d):null}XToCell(a){a=Math.floor(a/this._cellWidth);return isFinite(a)?a:0}YToCell(a){a=Math.floor(a/this._cellHeight);return isFinite(a)?a:0}Update(a,b,e){if(b)for(let d=b.getLeft(),
  c=b.getRight();d<=c;++d)for(let f=b.getTop(),c=b.getBottom();f<=c;++f){if(e&&e.containsPoint(d,f))continue;const b=this.GetCell(d,f,!1);b&&(b.Remove(a),b.IsEmpty()&&this._cells.Delete(d,f))}if(e)for(let d=e.getLeft(),c=e.getRight();d<=c;++d)for(let f=e.getTop(),c=e.getBottom();f<=c;++f)b&&b.containsPoint(d,f)||this.GetCell(d,f,!0).Insert(a)}QueryRange(a,b){let e=this.XToCell(a.getLeft());const d=this.YToCell(a.getTop()),g=this.XToCell(a.getRight());a=this.YToCell(a.getBottom());if(isFinite(g)&&isFinite(a))for(;e<=
  g;++e)for(let c=d;c<=a;++c){const a=this.GetCell(e,c,!1);a&&a.Dump(b)}}}};
  
  
  // c3/collisions/gridCell.js
  'use strict';{const b=self.C3;b.GridCell=class extends b.DefendedBase{constructor(a,c,d){super();this._grid=a;this._x=c;this._y=d;this._instances=b.New(b.ArraySet)}Release(){this._instances.Release();this._grid=this._instances=null}IsEmpty(){return this._instances.IsEmpty()}Insert(a){this._instances.Add(a)}Remove(a){this._instances.Delete(a)}Dump(a){b.appendArray(a,this._instances.GetArray())}}};
  
  
  // c3/collisions/ray.js
  'use strict';{const h=self.C3;h.Ray=class{constructor(){this.dy=this.dx=this.y2=this.x2=this.y1=this.x1=0;this.rect=new h.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(c,a,b,d){this.x1=c;this.y1=a;this.x2=b;this.y2=d;this.dx=b-c;this.dy=d-a;this.rect.set(c,a,b,d);this.rect.normalize();this.hitFraction=
  2;this.hitUid=null;this.distance=this.hitY=this.hitX=this.hitNormalDy=this.hitNormalDx=this.hitNormal=0;this.normalX=1;this.normalY=0;this.reflectionX=1;this.reflectionY=0;return this}Complete(){if(!1!==this.DidCollide()){var c=this.dx*this.hitFraction,a=this.dy*this.hitFraction,b=Math.sqrt(c*c+a*a);c/=b;a/=b;this.distance=b-1E-6;this.hitX=this.x1+c*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);b=c*this.normalX+a*this.normalY;this.reflectionX=c-2*this.normalX*b;this.reflectionY=a-2*this.normalY*b;0<b&&(this.hitNormal=h.clampAngle(this.hitNormal+Math.PI),this.normalX=-this.normalX,this.normalY=-this.normalY)}}TestInstanceSegment(c,a,b,d,e){const f=h.rayIntersect(this.x1,this.y1,this.x2,this.y2,a,b,d,e);0<=f&&f<this.hitFraction&&(this.hitFraction=f,this.hitUid=c.GetUID(),this.hitNormalDx=a-d,this.hitNormalDy=b-e)}TestInstanceRect(c,a,b,d){const e=a+d.getLeft();
  a+=d.getRight();const f=b+d.getTop();b+=d.getBottom();this.TestInstanceSegment(c,e,f,a,f);this.TestInstanceSegment(c,a,f,a,b);this.TestInstanceSegment(c,a,b,e,b);this.TestInstanceSegment(c,e,b,e,f)}TestInstanceQuad(c,a){const b=a.getTlx(),d=a.getTly(),e=a.getTrx(),f=a.getTry(),g=a.getBrx(),k=a.getBry(),l=a.getBlx();a=a.getBly();this.TestInstanceSegment(c,b,d,e,f);this.TestInstanceSegment(c,e,f,g,k);this.TestInstanceSegment(c,g,k,l,a);this.TestInstanceSegment(c,l,a,b,d)}TestInstancePoly(c,a,b,d){d=
  d.pointsArr();for(let e=0,f=d.length;e<f;e+=2){const g=(e+2)%f;this.TestInstanceSegment(c,d[e]+a,d[e+1]+b,d[g]+a,d[g+1]+b)}}}};
  
  
  // c3/canvasManager.js
  'use strict';{const h=self.C3,r=new Set("off crop scale-inner scale-outer letterbox-scale letterbox-integer-scale".split(" ")),t=new Set(["high","low"]),q=h.New(h.Quad),g=h.New(h.Rect);h.CanvasManager=class extends h.DefendedBase{constructor(a){super();this._runtime=a;this._webglRenderer=this._canvas=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=0;this._documentFullscreenMode=this._fullscreenMode="letterbox-scale";this._deviceTransformOffY=this._deviceTransformOffX=0;this._fullscreenScalingQuality=this._wantFullscreenScalingQuality="high";this._isDocumentFullscreen=!1;this._availableAdditionalRenderTargets=[];this._usedAdditionalRenderTargets=new Set;this._gpuFrameTimingsBuffer=this._shaderData=null;this._gpuTimeEndFrame=this._gpuTimeStartFrame=0;this._gpuCurUtilisation=
  NaN;this._gpuLastUtilisation=0;this._layersGpuProfile=new Map;this._snapshotFormat="";this._snapshotQuality=1;this._snapshotUrl="";this._snapshotResolve=this._snapshotPromise=null;this._loaderStartTime=0;this._rafId=-1;this._loadingProgress=0;this._loadingprogress_handler=a=>this._loadingProgress=a.progress;this._loadingLogoAsset=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(a=>this._splashDoneResolve=a)}_SetGPUPowerPreference(a){this._gpuPreference=a}async CreateCanvas(a){this._canvas=a.canvas;this._canvas.addEventListener("webglcontextlost",a=>this._OnWebGLContextLost(a));this._canvas.addEventListener("webglcontextrestored",a=>this._OnWebGLContextRestored(a));const b={powerPreference:this._gpuPreference,enableGpuProfiling:!0};"Android"===h.Platform.OS&&"Chromium"===h.Platform.BrowserEngine&&
  75>h.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."),b.maxWebGLVersion=1);"standard"===this._runtime.GetCompositingMode()?b.alpha=!0:(b.alpha=!1,b.lowLatency=!0);this._webglRenderer=h.New(h.Gfx.WebGLRenderer,this._canvas,b);await this._webglRenderer.InitState();this._webglRenderer.SupportsGPUProfiling()||(this._gpuLastUtilisation=NaN);this._runtime.AddDOMComponentMessageHandler("runtime",
  "window-resize",a=>this._OnWindowResize(a));this._runtime.AddDOMComponentMessageHandler("runtime","fullscreenchange",a=>this._OnFullscreenChange(a));this._runtime.AddDOMComponentMessageHandler("runtime","fullscreenerror",a=>this._OnFullscreenError(a));this._isDocumentFullscreen=!!a.isFullscreen;this.SetSize(a.windowInnerWidth,a.windowInnerHeight,!0);this._shaderData=self.C3_Shaders;await this._LoadShaderPrograms();a=!1;for(const b of this._runtime._GetAllEffectLists()){for(const c of b.GetAllEffectTypes())c._InitRenderer(this._webglRenderer),
  c.GetShaderProgram().UsesDest()&&(a=!0);b.UpdateActiveEffects()}this._runtime._SetUsesAnyBackgroundBlending(a);this._webglRenderer.SupportsGPUProfiling()&&(this._gpuFrameTimingsBuffer=h.New(h.Gfx.WebGLQueryResultBuffer,this._webglRenderer));this._webglRenderer.SetMipmapsEnabled(this._enableMipmaps)}async _LoadShaderPrograms(){if(this._shaderData){var a=[];for(const [b,c]of Object.entries(this._shaderData)){const d=h.Gfx.WebGLShaderProgram.GetDefaultVertexShaderSource(this._webglRenderer.Is3D());a.push(this._webglRenderer.CreateShaderProgram(c,
  d,b))}await Promise.all(a);this._webglRenderer.ResetLastProgram();this._webglRenderer.SetTextureFillMode()}}Release(){this._canvas=this._webglRenderer=this._runtime=null}_OnWindowResize(a){const b=a.devicePixelRatio;this._runtime.IsInWorker()&&(self.devicePixelRatio=b);this._runtime._SetDevicePixelRatio(b);this.SetSize(a.innerWidth,a.innerHeight);this._runtime.UpdateRender()}_OnFullscreenChange(a){this._isDocumentFullscreen=!!a.isFullscreen;this.SetSize(a.innerWidth,a.innerHeight,!0);this._runtime.UpdateRender()}_OnFullscreenError(a){this._isDocumentFullscreen=
  !!a.isFullscreen;this.SetSize(a.innerWidth,a.innerHeight,!0);this._runtime.UpdateRender()}SetSize(a,b,c=!1){a=Math.floor(a);b=Math.floor(b);if(0>=a||0>=b)throw Error("invalid size");if(this._windowInnerWidth!==a||this._windowInnerHeight!==b||c)this._windowInnerWidth=a,this._windowInnerHeight=b,c=this.GetCurrentFullscreenMode(),"letterbox-scale"===c?this._CalculateLetterboxScale(a,b):"letterbox-integer-scale"===c?this._CalculateLetterboxIntegerScale(a,b):"off"===c?this._CalculateFixedSizeCanvas(a,
  b):this._CalculateFullsizeCanvas(a,b),this._UpdateFullscreenScalingQuality(c),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}),this._webglRenderer.SetSize(this._canvasDeviceWidth,this._canvasDeviceHeight,!0)}_CalculateLetterboxScale(a,b){const c=this._runtime.GetDevicePixelRatio(),
  d=this._runtime.GetOriginalViewportWidth(),l=this._runtime.GetOriginalViewportHeight(),f=d/l;a/b>f?(this._canvasCssWidth=Math.round(b*f),this._canvasCssHeight=b,this._canvasCssOffsetX=Math.floor((a-this._canvasCssWidth)/2),this._canvasCssOffsetY=0):(this._canvasCssWidth=a,this._canvasCssHeight=Math.round(a/f),this._canvasCssOffsetX=0,this._canvasCssOffsetY=Math.floor((b-this._canvasCssHeight)/2));this._canvasDeviceWidth=Math.round(this._canvasCssWidth*c);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*
  c);this._runtime.SetViewportSize(d,l)}_CalculateLetterboxIntegerScale(a,b){const c=this._runtime.GetDevicePixelRatio();1!==c&&(a+=1,b+=1);const d=this._runtime.GetOriginalViewportWidth(),l=this._runtime.GetOriginalViewportHeight();var f=d/l;f=a/b>f?b*f*c/d:a/f*c/l;1<f?f=Math.floor(f):1>f&&(f=1/Math.ceil(1/f));this._canvasDeviceWidth=Math.round(d*f);this._canvasDeviceHeight=Math.round(l*f);this._canvasCssWidth=this._canvasDeviceWidth/c;this._canvasCssHeight=this._canvasDeviceHeight/c;this._canvasCssOffsetX=
  Math.max(Math.floor((a-this._canvasCssWidth)/2),0);this._canvasCssOffsetY=Math.max(Math.floor((b-this._canvasCssHeight)/2),0);this._runtime.SetViewportSize(d,l)}_CalculateFullsizeCanvas(a,b){const c=this._runtime.GetDevicePixelRatio();this._canvasCssWidth=a;this._canvasCssHeight=b;this._canvasDeviceWidth=Math.round(this._canvasCssWidth*c);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*c);this._canvasCssOffsetY=this._canvasCssOffsetX=0;a=this.GetDisplayScale();this._runtime.SetViewportSize(this._canvasCssWidth/
  a,this._canvasCssHeight/a)}_CalculateFixedSizeCanvas(a,b){const c=this._runtime.GetDevicePixelRatio();this._canvasCssWidth=this._runtime.GetViewportWidth();this._canvasCssHeight=this._runtime.GetViewportHeight();this._canvasDeviceWidth=Math.round(this._canvasCssWidth*c);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*c);this.IsDocumentFullscreen()?(this._canvasCssOffsetX=Math.floor((a-this._canvasCssWidth)/2),this._canvasCssOffsetY=Math.floor((b-this._canvasCssHeight)/2)):this._canvasCssOffsetY=
  this._canvasCssOffsetX=0;this._runtime.SetViewportSize(this._runtime.GetViewportWidth(),this._runtime.GetViewportHeight())}_UpdateFullscreenScalingQuality(a){if("high"===this._wantFullscreenScalingQuality)this._drawWidth=this._canvasDeviceWidth,this._drawHeight=this._canvasDeviceHeight,this._fullscreenScalingQuality="high";else{let c;if("off"===this.GetCurrentFullscreenMode()){var b=this._runtime.GetViewportWidth();c=this._runtime.GetViewportHeight()}else b=this._runtime.GetOriginalViewportWidth(),
  c=this._runtime.GetOriginalViewportHeight();this._canvasDeviceWidth<b&&this._canvasDeviceHeight<c?(this._drawWidth=this._canvasDeviceWidth,this._drawHeight=this._canvasDeviceHeight,this._fullscreenScalingQuality="high"):(this._drawWidth=b,this._drawHeight=c,this._fullscreenScalingQuality="low","scale-inner"===a?(a=b/c,b=this._windowInnerWidth/this._windowInnerHeight,b<a?this._drawWidth=this._drawHeight*b:b>a&&(this._drawHeight=this._drawWidth/b)):"scale-outer"===a&&(a=b/c,b=this._windowInnerWidth/
  this._windowInnerHeight,b>a?this._drawWidth=this._drawHeight*b:b<a&&(this._drawHeight=this._drawWidth/b)))}}IsDocumentFullscreen(){return this._isDocumentFullscreen}SetFullscreenMode(a){if(!r.has(a))throw Error("invalid fullscreen mode");this._fullscreenMode=a}GetFullscreenMode(){return this._fullscreenMode}SetDocumentFullscreenMode(a){if(!r.has(a))throw Error("invalid fullscreen mode");this._documentFullscreenMode=a}GetDocumentFullscreenMode(){return this._documentFullscreenMode}GetCurrentFullscreenMode(){return this.IsDocumentFullscreen()?
  this.GetDocumentFullscreenMode():this.GetFullscreenMode()}SetFullscreenScalingQuality(a){if(!t.has(a))throw Error("invalid fullscreen scaling quality");this._wantFullscreenScalingQuality=a}GetSetFullscreenScalingQuality(){return this._wantFullscreenScalingQuality}GetCurrentFullscreenScalingQuality(){return this._fullscreenScalingQuality}static _FullscreenModeNumberToString(a){switch(a){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(a){this._enableMipmaps=!!a}IsWebGLContextLost(){return this._webglRenderer.IsContextLost()}_OnWebGLContextLost(a){console.log("[Construct 3] WebGL context lost");a.preventDefault();this._availableAdditionalRenderTargets=[];this._usedAdditionalRenderTargets.clear();
  this._webglRenderer.OnContextLost();this._runtime._OnWebGLContextLost()}async _OnWebGLContextRestored(a){await this._webglRenderer.OnContextRestored();await this._LoadShaderPrograms();for(const a of this._runtime._GetAllEffectLists())for(const b of a.GetAllEffectTypes())b._InitRenderer(this._webglRenderer);await this._runtime._OnWebGLContextRestored();console.log("[Construct 3] WebGL context restored")}GetWebGLRenderer(){return this._webglRenderer}GetRenderScale(){return"low"===this._fullscreenScalingQuality?
  1/this._runtime.GetDevicePixelRatio():this.GetDisplayScale()}GetDisplayScale(){const a=this.GetCurrentFullscreenMode();if("off"===a||"crop"===a)return 1;const b=this._runtime.GetOriginalViewportWidth(),c=this._runtime.GetOriginalViewportHeight(),d=b/c,l=this._canvasDeviceWidth/this._canvasDeviceHeight;return"scale-inner"!==a&&l>d||"scale-inner"===a&&l<d?this._canvasCssHeight/c:this._canvasCssWidth/b}SetDeviceTransformOffset(a,b){this._deviceTransformOffX=a;this._deviceTransformOffY=b}SetDeviceTransform(a,
  b,c){b=(b||this._drawWidth)/2+this._deviceTransformOffX;c=(c||this._drawHeight)/2+this._deviceTransformOffY;a.SetCameraXYZ(b,c,100*this._runtime.GetDevicePixelRatio());a.SetLookXYZ(b,c,0);a.ResetModelView();a.UpdateModelView()}SetCssTransform(a){const b=this._canvasCssWidth/2,c=this._canvasCssHeight/2;a.SetCameraXYZ(b,c,100);a.SetLookXYZ(b,c,0);a.ResetModelView();a.UpdateModelView()}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(a){const b=
  this._availableAdditionalRenderTargets,c=b.findIndex(b=>b.IsCompatibleWithOptions(a));let d;-1!==c?(d=b[c],b.splice(c,1)):d=this._webglRenderer.CreateRenderTarget(a);this._usedAdditionalRenderTargets.add(d);return d}ReleaseAdditionalRenderTarget(a){if(!this._usedAdditionalRenderTargets.has(a))throw Error("render target not in use");this._usedAdditionalRenderTargets.delete(a);this._availableAdditionalRenderTargets.push(a)}*activeLayersGpuProfiles(){for(const a of this._runtime.GetLayoutManager().runningLayouts())for(const b of a.GetLayers()){const a=
  this._layersGpuProfile.get(b);a&&(yield a)}}GetLayerTimingsBuffer(a){if(!this._webglRenderer.SupportsGPUProfiling())return null;let b=this._layersGpuProfile.get(a);b||(b={name:a.GetName(),timingsBuffer:h.New(h.Gfx.WebGLQueryResultBuffer,this._webglRenderer),curUtilisation:0,lastUtilisation:0},this._layersGpuProfile.set(a,b));return b.timingsBuffer}_Update1sFrameRange(){if(this._webglRenderer.SupportsGPUProfiling()&&0===this._gpuTimeEndFrame){this._gpuTimeEndFrame=this._webglRenderer.GetFrameNumber();
  this._gpuCurUtilisation=NaN;for(const a of this.activeLayersGpuProfiles())a.curUtilisation=NaN}}_UpdateTick(){if(this._webglRenderer.SupportsGPUProfiling()&&isNaN(this._gpuCurUtilisation)&&(this._gpuCurUtilisation=this._gpuFrameTimingsBuffer.GetFrameRangeResultSum(this._gpuTimeStartFrame,this._gpuTimeEndFrame),!isNaN(this._gpuCurUtilisation))){if(this._runtime.IsDebug())for(const a of this.activeLayersGpuProfiles())if(a.curUtilisation=a.timingsBuffer.GetFrameRangeResultSum(this._gpuTimeStartFrame,
  this._gpuTimeEndFrame),isNaN(a.curUtilisation))return;this._gpuFrameTimingsBuffer.DeleteAllBeforeFrameNumber(this._gpuTimeEndFrame);this._gpuLastUtilisation=Math.min(this._gpuCurUtilisation,1);if(this._runtime.IsDebug()){for(const a of this.activeLayersGpuProfiles())a.timingsBuffer.DeleteAllBeforeFrameNumber(this._gpuTimeEndFrame),a.lastUtilisation=Math.min(a.curUtilisation,1);self.C3Debugger.UpdateGPUProfile(this._gpuLastUtilisation,[...this.activeLayersGpuProfiles()])}this._gpuTimeStartFrame=this._gpuTimeEndFrame;
  this._gpuTimeEndFrame=0}}GetGPUFrameTimingsBuffer(){return this._gpuFrameTimingsBuffer}GetGPUUtilisation(){return this._gpuLastUtilisation}SnapshotCanvas(a,b){this._snapshotFormat=a;this._snapshotQuality=b;return this._snapshotPromise?this._snapshotPromise:this._snapshotPromise=new Promise(a=>{this._snapshotResolve=a})}_MaybeTakeSnapshot(){this._snapshotFormat&&(h.CanvasToBlob(this._canvas,this._snapshotFormat,this._snapshotQuality).then(a=>{this._snapshotUrl=URL.createObjectURL(a);this._snapshotPromise=
  null;this._snapshotResolve(this._snapshotUrl)}),this._snapshotFormat="",this._snapshotQuality=1)}GetCanvasSnapshotUrl(){return this._snapshotUrl}InitLoadingScreen(a){if(2===a)this._percentText=h.New(h.Gfx.RendererText,this._webglRenderer),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);else if(0===a){const b=
  this._runtime.GetLoadingLogoFilename();a=this._runtime.GetAssetManager();let c;if(this._runtime.IsPreview()){if(!a._HasLocalUrlBlob(b))return;c=a.GetLocalUrlAsBlobUrl(b)}else c=a.GetIconsSubfolder()+b;this._loadingLogoAsset=a.LoadImage({url:c});this._loadingLogoAsset.LoadStaticTexture(this._webglRenderer).catch(a=>console.warn(`[C3 runtime] Failed to load '${b}' for loading screen. Check the project has an icon with that name.`,a))}else 4===a&&(this._LoadSvgSplashImage("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNi4wLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHdpZHRoPSIxNzAwLjc5MDA0cHgiIGhlaWdodD0iMTcwMC43OTAwNHB4IiB2aWV3Qm94PSIyODcgMzE3IDExMjUgMTEyNSINCgkgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMTcwMC43OTAwNCAxNzAwLjc5MDA0IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxnIGlkPSJsb2dvIj4NCgk8Zz4NCgkJPGc+DQoJCQk8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI0ZGRkZGRiIgZD0iTTM1NC45Nzc1NCwxMTk1LjYyMzA1DQoJCQkJYzExLjM4NDc3LDAsMjIuMDEyNywzLjIzNzMsMzEuMDE3NTgsOC44Mzc4OWMxLjk0NjI5LDEuMjEwOTQsMi41ODQ5NiwzLjc0OTAyLDEuNDM4NDgsNS43MzQzOGwtNC45MzI2Miw4LjU0MTk5DQoJCQkJYy0zLjI3ODMyLDUuNjc5NjktMTAuMDMzMiw4LjM3Njk1LTE2LjMxNzM4LDYuNTAwOThjLTIuNzY0NjUtMC44MjUyLTUuNjkzMzYtMS4yNjg1NS04LjcyNjU2LTEuMjY4NTUNCgkJCQljLTE2LjgyOTEsMC0zMC40NzI2NiwxMy42NDM1NS0zMC40NzI2NiwzMC40NzI2NmMwLDE2LjgyODEzLDEzLjY0MzU1LDMwLjQ3MjY2LDMwLjQ3MjY2LDMwLjQ3MjY2DQoJCQkJYzMuMDMzMiwwLDUuOTYxOTEtMC40NDMzNiw4LjcyNjU2LTEuMjY4NTVjNi4yOTQ5Mi0xLjg3OTg4LDEzLjAzMzIsMC44MTE1MiwxNi4zMTczOCw2LjUwMDk4bDQuOTMxNjQsOC41NDE5OQ0KCQkJCWMxLjE0NzQ2LDEuOTg4MjgsMC41MTA3NCw0LjUyMzQ0LTEuNDM4NDgsNS43MzQzOGMtOS4wMDM5MSw1LjYwMTU2LTE5LjYzMTg0LDguODM3ODktMzEuMDE2Niw4LjgzNzg5DQoJCQkJYy0zMi40ODUzNSwwLTU4LjgxOTM0LTI2LjMzNDk2LTU4LjgxOTM0LTU4LjgxOTM0QzI5Ni4xNTgyLDEyMjEuOTU3MDMsMzIyLjQ5MjE5LDExOTUuNjIzMDUsMzU0Ljk3NzU0LDExOTUuNjIzMDUNCgkJCQlMMzU0Ljk3NzU0LDExOTUuNjIzMDV6IE03MDMuMjE0ODQsMTI1OS4xNzU3OGMtMTQuNTU5NTctOS44MTczOC0yMC4yMDMxMy0yMC4wMzIyMy0yMC4yMDMxMy0zMy4wODAwOA0KCQkJCWMwLTE4LjQ4OTI2LDE1LjcxNDg0LTI5Ljc2MzY3LDM4LjI2NjYtMjkuNzYzNjdjOS42NTcyMywwLDE4LjcyMTY4LDIuNTQyOTcsMjYuNTU5NTcsNi45OTQxNA0KCQkJCWMyLjA0OTgsMS4xNjQwNiwyLjc2MTcyLDMuNzgzMiwxLjU4MzAxLDUuODI0MjJsLTMuNDE3OTcsNS45MTk5MmMtMy4yNDcwNyw1LjYyNDAyLTkuOTA4Miw4LjMzMTA1LTE2LjE1MzMyLDYuNTQ4ODMNCgkJCQljLTIuNzIzNjMtMC43NzYzNy01LjU5ODYzLTEuMTkyMzgtOC41NzEyOS0xLjE5MjM4Yy0xMC40OTAyMywwLTExLjU5ODYzLDkuNTc2MTctNC44NTc0MiwxNC4xMjMwNWwyMy42ODY1MiwxNS45NzY1Ng0KCQkJCWM5Ljk5MDIzLDYuNzM4MjgsMTUuODk1NTEsMTcuMDY2NDEsMTUuODk1NTEsMjguNzE4NzVjMCwxOC43ODYxMy0xNS4wMDY4NCwzMy4zMDc2Mi0zOC4yNjc1OCwzMy4zMDc2Mg0KCQkJCWMtOS41MjI0NiwwLTE4LjU4Nzg5LTEuOTU3MDMtMjYuODE1NDMtNS40OTAyM2MtNy43ODEyNS0zLjMzOTg0LTEwLjkzMzU5LTEyLjc4MjIzLTYuNjk3MjctMjAuMTE4MTZsMy40ODczLTYuMDQxOTkNCgkJCQljMS4yMTM4Ny0yLjA5OTYxLDMuOTMxNjQtMi43NTk3Nyw1Ljk3NDYxLTEuNDU2MDVjNi44NTkzOCw0LjM4MjgxLDE2LjQ5MDIzLDcuNTk0NzMsMjQuNzU4NzksNy41OTQ3Mw0KCQkJCWMxMC41NDU5LDAsMTEuMzI4MTMtOS45NTg5OCwzLjc2NzU4LTE1LjA1NzYyTDcwMy4yMTQ4NCwxMjU5LjE3NTc4TDcwMy4yMTQ4NCwxMjU5LjE3NTc4eiBNOTg0LjYzMDg2LDEyMDIuMDAwOTgNCgkJCQljMC0yLjM0NzY2LDEuOTAzMzItNC4yNTE5NSw0LjI1MTk1LTQuMjUxOTVoOS45MjE4OGM3LjgyNzE1LDAsMTQuMTcyODUsNi4zNDU3LDE0LjE3Mjg1LDE0LjE3MzgzdjU3LjQwMTM3DQoJCQkJYzAsOC42MTAzNSw2Ljk4MDQ3LDE1LjU5MDgyLDE1LjU5MDgyLDE1LjU5MDgyczE1LjU5MDgyLTYuOTgwNDcsMTUuNTkwODItMTUuNTkwODJ2LTU3LjQwMTM3DQoJCQkJYzAtNy44MjgxMyw2LjM0NTctMTQuMTczODMsMTQuMTcyODUtMTQuMTczODNoOS45MjA5YzIuMzQ4NjMsMCw0LjI1MTk1LDEuOTA0Myw0LjI1MTk1LDQuMjUxOTV2NjcuMzIzMjQNCgkJCQljMCwyNC4yNjU2My0xOS42NzA5LDQzLjkzNzUtNDMuOTM2NTIsNDMuOTM3NXMtNDMuOTM3NS0xOS42NzE4OC00My45Mzc1LTQzLjkzNzVWMTIwMi4wMDA5OEw5ODQuNjMwODYsMTIwMi4wMDA5OHoNCgkJCQkgTTQ2Ni44NjkxNCwxMTk1LjYyMzA1YzMyLjQ4NDM4LDAsNTguODE4MzYsMjYuMzMzOTgsNTguODE4MzYsNTguODE5MzRjMCwzMi40ODQzOC0yNi4zMzM5OCw1OC44MTkzNC01OC44MTgzNiw1OC44MTkzNA0KCQkJCWMtMzIuNDg2MzMsMC01OC44MTkzNC0yNi4zMzQ5Ni01OC44MTkzNC01OC44MTkzNEM0MDguMDQ5OCwxMjIxLjk1NzAzLDQzNC4zODI4MSwxMTk1LjYyMzA1LDQ2Ni44NjkxNCwxMTk1LjYyMzA1DQoJCQkJTDQ2Ni44NjkxNCwxMTk1LjYyMzA1eiBNNDY2Ljg2OTE0LDEyMjUuMDMzMmMtMTYuMjQzMTYsMC0yOS40MTAxNiwxMy4xNjY5OS0yOS40MTAxNiwyOS40MDkxOA0KCQkJCXMxMy4xNjY5OSwyOS40MDgyLDI5LjQxMDE2LDI5LjQwODJjMTYuMjQxMjEsMCwyOS40MDgyLTEzLjE2NjAyLDI5LjQwODItMjkuNDA4MlM0ODMuMTEwMzUsMTIyNS4wMzMyLDQ2Ni44NjkxNCwxMjI1LjAzMzINCgkJCQlMNDY2Ljg2OTE0LDEyMjUuMDMzMnogTTU1Ni43MzI0MiwxMzExLjEzNDc3Yy0yLjM0NzY2LDAtNC4yNTE5NS0xLjkwMjM0LTQuMjUxOTUtNC4yNXYtOTQuOTYxOTENCgkJCQljMC03LjgyODEzLDYuMzQ1Ny0xNC4xNzM4MywxNC4xNzM4My0xNC4xNzM4M2gzLjk1ODk4YzQuNjI1LDAsOC45NTg5OCwyLjI1Njg0LDExLjYxMTMzLDYuMDQ1OWw0MS4xMjIwNyw1OC43NDcwN3YtNTAuNjE5MTQNCgkJCQljMC03LjgyODEzLDYuMzQ1Ny0xNC4xNzM4MywxNC4xNzI4NS0xNC4xNzM4M2g5LjkyMTg4YzIuMzQ3NjYsMCw0LjI1MTk1LDEuOTA0Myw0LjI1MTk1LDQuMjUxOTV2OTQuOTYwOTQNCgkJCQljMCw3LjgyOTEtNi4zNDU3LDE0LjE3Mjg1LTE0LjE3MzgzLDE0LjE3Mjg1aC0zLjk1ODk4Yy00LjYyNSwwLTguOTU4OTgtMi4yNTU4Ni0xMS42MTEzMy02LjA0NDkybC00MS4xMjIwNy01OC43NDYwOXY1MC42MTgxNg0KCQkJCWMwLDcuODI5MS02LjM0NTcsMTQuMTcyODUtMTQuMTcyODUsMTQuMTcyODVINTU2LjczMjQyTDU1Ni43MzI0MiwxMzExLjEzNDc3eiBNMTIxNS4wMjA1MSwxMjExLjkyMjg1DQoJCQkJYzAtNy44MjgxMyw2LjM0NTctMTQuMTczODMsMTQuMTcyODUtMTQuMTczODNoNTAuMzE1NDNjMi4zNDg2MywwLDQuMjUxOTUsMS45MDQzLDQuMjUxOTUsNC4yNTE5NXY1LjY2OTkyDQoJCQkJYzAsNy44MjcxNS02LjM0NTcsMTQuMTcyODUtMTQuMTcyODUsMTQuMTcyODVoLTYuMDI0NDF2NzUuMTE4MTZjMCw3LjgyOTEtNi4zNDU3LDE0LjE3Mjg1LTE0LjE3Mjg1LDE0LjE3Mjg1aC05LjkyMTg4DQoJCQkJYy0yLjM0ODYzLDAtNC4yNTE5NS0xLjkwMjM0LTQuMjUxOTUtNC4yNXYtODUuMDQxMDJoLTE1Ljk0NDM0Yy0yLjM0ODYzLDAtNC4yNTE5NS0xLjkwMzMyLTQuMjUxOTUtNC4yNTE5NVYxMjExLjkyMjg1DQoJCQkJTDEyMTUuMDIwNTEsMTIxMS45MjI4NXogTTc3Ni40NDkyMiwxMjExLjkyMjg1YzAtNy44MjgxMyw2LjM0NTctMTQuMTczODMsMTQuMTczODMtMTQuMTczODNoNTAuMzE0NDUNCgkJCQljMi4zNDk2MSwwLDQuMjUxOTUsMS45MDQzLDQuMjUxOTUsNC4yNTE5NXY1LjY2OTkyYzAsNy44MjcxNS02LjM0NTcsMTQuMTcyODUtMTQuMTcxODgsMTQuMTcyODVoLTYuMDI1Mzl2NzUuMTE4MTYNCgkJCQljMCw3LjgyOTEtNi4zNDU3LDE0LjE3Mjg1LTE0LjE3Mjg1LDE0LjE3Mjg1aC05LjkyMDljLTIuMzQ5NjEsMC00LjI1MTk1LTEuOTAyMzQtNC4yNTE5NS00LjI1di04NS4wNDEwMmgtMTUuOTQ1MzENCgkJCQljLTIuMzQ3NjYsMC00LjI1MTk1LTEuOTAzMzItNC4yNTE5NS00LjI1MTk1VjEyMTEuOTIyODVMNzc2LjQ0OTIyLDEyMTEuOTIyODV6IE05MjkuNjA0NDksMTI3Mi4wMjI0NmwyNi45NTgwMSwzMi4xMjc5Mw0KCQkJCWMyLjMxNDQ1LDIuNzU3ODEsMC4zNDM3NSw2Ljk4NDM4LTMuMjU2ODQsNi45ODQzOGgtMTkuNzA1MDhjLTQuMTg5NDUsMC04LjE2NTA0LTEuODUxNTYtMTAuODU3NDItNS4wNjA1NWwtMjIuNjgxNjQtMjcuMDMxMjUNCgkJCQl2MjcuODQxOGMwLDIuMzQ3NjYtMS45MDMzMiw0LjI1LTQuMjUxOTUsNC4yNWgtOS45MjA5Yy03LjgyNzE1LDAtMTQuMTcyODUtNi4zNDM3NS0xNC4xNzI4NS0xNC4xNzI4NXYtODUuMDM5MDYNCgkJCQljMC03LjgyODEzLDYuMzQ1Ny0xNC4xNzM4MywxNC4xNzI4NS0xNC4xNzM4M2gyOS43NjM2N2MyMi43MDAyLDAsNDEuMTAyNTQsMTcuMTMzNzksNDEuMTAyNTQsMzguMjY4NTUNCgkJCQlDOTU2Ljc1NDg4LDEyNTIuNTkwODIsOTQ1LjQzNjUyLDEyNjYuNzAyMTUsOTI5LjYwNDQ5LDEyNzIuMDIyNDZMOTI5LjYwNDQ5LDEyNzIuMDIyNDZ6IE05MDAuMDYxNTIsMTIyMS44NDM3NXYzMi41OTg2M2g4LjUwMzkxDQoJCQkJYzEwLjk1ODk4LDAsMTkuODQyNzctNy4yOTc4NSwxOS44NDI3Ny0xNi4yOTg4M2MwLTkuMDAxOTUtOC44ODM3OS0xNi4yOTk4LTE5Ljg0Mjc3LTE2LjI5OThIOTAwLjA2MTUyTDkwMC4wNjE1MiwxMjIxLjg0Mzc1eg0KCQkJCSBNMTE1OC4zNTkzOCwxMTk1LjYyMzA1YzExLjM4NDc3LDAsMjIuMDEyNywzLjIzNzMsMzEuMDE3NTgsOC44Mzc4OWMxLjk0NzI3LDEuMjEwOTQsMi41ODQ5NiwzLjc0OTAyLDEuNDM4NDgsNS43MzQzOA0KCQkJCWwtNC45MzI2Miw4LjU0MTk5Yy0zLjI3ODMyLDUuNjc5NjktMTAuMDMzMiw4LjM3Njk1LTE2LjMxNzM4LDYuNTAwOThjLTIuNzY0NjUtMC44MjUyLTUuNjkzMzYtMS4yNjg1NS04LjcyNTU5LTEuMjY4NTUNCgkJCQljLTE2LjgyOTEsMC0zMC40NzI2NiwxMy42NDM1NS0zMC40NzI2NiwzMC40NzI2NmMwLDE2LjgyODEzLDEzLjY0MzU1LDMwLjQ3MjY2LDMwLjQ3MjY2LDMwLjQ3MjY2DQoJCQkJYzMuMDMyMjMsMCw1Ljk2MDk0LTAuNDQzMzYsOC43MjU1OS0xLjI2ODU1YzYuMjk1OS0xLjg3OTg4LDEzLjAzMzIsMC44MTE1MiwxNi4zMTgzNiw2LjUwMDk4bDQuOTMwNjYsOC41NDE5OQ0KCQkJCWMxLjE0NzQ2LDEuOTg4MjgsMC41MTA3NCw0LjUyMzQ0LTEuNDM3NSw1LjczNDM4Yy05LjAwNDg4LDUuNjAxNTYtMTkuNjMyODEsOC44Mzc4OS0zMS4wMTc1OCw4LjgzNzg5DQoJCQkJYy0zMi40ODUzNSwwLTU4LjgxOTM0LTI2LjMzNDk2LTU4LjgxOTM0LTU4LjgxOTM0QzEwOTkuNTQwMDQsMTIyMS45NTcwMywxMTI1Ljg3NDAyLDExOTUuNjIzMDUsMTE1OC4zNTkzOCwxMTk1LjYyMzA1eiIvPg0KCQkJPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGZpbGw9IiMwMEZGREEiIGQ9Ik0xMzE4LjE5NzI3LDEyMDYuMDMyMjMNCgkJCQljMC03LjgyODEzLDYuMzQ1Ny0xNC4xNzM4MywxNC4xNzI4NS0xNC4xNzM4M2MyMC42NTYyNSwwLDQxLjMxMjUsMCw2MS45Njg3NSwwYzMuNDI5NjksMCw1LjQ1MDIsMy44ODA4NiwzLjQ4MzQsNi42OTA0Mw0KCQkJCWwtMTkuMjk2ODgsMjcuNTY3MzhjMTUuNTQyOTcsOC4zNzU5OCwyNi4xMDY0NSwyNC44MDA3OCwyNi4xMDY0NSw0My42OTUzMWMwLDI3LjM5NzQ2LTIyLjIwODk4LDQ5LjYwNjQ1LTQ5LjYwNjQ1LDQ5LjYwNjQ1DQoJCQkJYy0xNi42ODg0OCwwLTMxLjQ1MTE3LTguMjQwMjMtNDAuNDQzMzYtMjAuODc1OThjLTEuNDUwMi0yLjAzOTA2LTAuODMxMDUtNC44OTk0MSwxLjMzNTk0LTYuMTUyMzRsMTAuOTc3NTQtNi4zMzc4OQ0KCQkJCWM0Ljg4MTg0LTIuODE4MzYsMTAuOTc5NDktMi40NzU1OSwxNS41MTQ2NSwwLjg3MzA1YzMuNTI4MzIsMi42MDU0Nyw3Ljg5MTYsNC4xNDY0OCwxMi42MTUyMyw0LjE0NjQ4DQoJCQkJYzExLjc0MjE5LDAsMjEuMjU5NzctOS41MTg1NSwyMS4yNTk3Ny0yMS4yNTk3N3MtOS41MTc1OC0yMS4yNTk3Ny0yMS4yNTk3Ny0yMS4yNTk3N2gtMTUuMjE3NzcNCgkJCQljLTMuNDI5NjksMC01LjQ1MDItMy44ODA4Ni0zLjQ4NDM4LTYuNjkwNDNsMTguMTM1NzQtMjUuOTA4MmgtMzIuMDA5NzdjLTIuMzQ4NjMsMC00LjI1MTk1LTEuOTAzMzItNC4yNTE5NS00LjI1MTk1VjEyMDYuMDMyMjN6DQoJCQkJIi8+DQoJCTwvZz4NCgkJPGc+DQoJCQk8Zz4NCgkJCQk8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI0RBRThGNyIgZD0iTTg1MC4zOTU1MSw4NTcuNTkxOA0KCQkJCQljLTUwLjM1NjQ1LDAtOTQuMzI1Mi0yNy4zNTY0NS0xMTcuODUyNTQtNjguMDIwNTFsLTgwLjAzMDI3LDQ2LjIwNDFjLTQuNjU1MjcsMi42ODk0NS02LjEzMTg0LDguNzE4NzUtMy4yNDkwMiwxMy4yNTU4Ng0KCQkJCQljNDIuMjM3Myw2Ni40ODYzMywxMTYuNTMzMiwxMTAuNjA3NDIsMjAxLjEzMTg0LDExMC42MDc0MmM4OC4xMjU5OCwwLDE2NS4wNzEyOS00Ny44NzUsMjA2LjI0MzE2LTExOS4wMzYxM2wtODAuNDg3My00Ni40Njk3Mw0KCQkJCQljLTQuMzEzNDgtMi40OTAyMy05LjgwMTc2LTEuMjA1MDgtMTIuNTcwMzEsMi45MzU1NUM5MzkuMTc1NzgsODMzLjU2MjUsODk3LjU5MTgsODU3LjU5MTgsODUwLjM5NTUxLDg1Ny41OTE4DQoJCQkJCUw4NTAuMzk1NTEsODU3LjU5MTh6IE0xMTM2LjcyMTY4LDU1Ni4yMTc3N2M0LjYxNDI2LTIuNjYzMDksNi4xMTAzNS04LjYxOTE0LDMuMzEyNS0xMy4xNTEzNw0KCQkJCQljLTU5LjkxNTA0LTk3LjAzMDI3LTE2Ny4yMjQ2MS0xNjEuNjk0MzQtMjg5LjYzODY3LTE2MS42OTQzNGMtMTI1Ljg5MzU1LDAtMjM1LjgxMzQ4LDY4LjM5MjU4LTI5NC42MzM3OSwxNzAuMDQ5OA0KCQkJCQlsODAuMzc2OTUsNDYuNDA2MjVjNC4zOTc0NiwyLjUzOTA2LDEwLjAwMTk1LDEuMTQ5NDEsMTIuNzEwOTQtMy4xNDU1MQ0KCQkJCQljNDIuMTY0MDYtNjYuODUxNTYsMTE2LjY2ODk1LTExMS4yNjM2NywyMDEuNTQ1OS0xMTEuMjYzNjdjODguMTI1OTgsMCwxNjUuMDcxMjksNDcuODc1OTgsMjA2LjI0MzE2LDExOS4wMzYxMw0KCQkJCQlMMTEzNi43MjE2OCw1NTYuMjE3Nzd6Ii8+DQoJCQkJPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGZpbGw9IiNBNUJBQzgiIGQ9Ik04NTAuMzk1NTEsOTU5LjYzODY3DQoJCQkJCWMtODQuNTk4NjMsMC0xNTguODk0NTMtNDQuMTIxMDktMjAxLjEzMTg0LTExMC42MDc0MmMtMi44NzY5NS00LjUzMDI3LTEuMzk5NDEtMTAuNTcwMzEsMy4yNDkwMi0xMy4yNTU4Nmw4MC4wMzAyNy00Ni4yMDQxDQoJCQkJCWMtMTEuNTgxMDUtMjAuMDE2Ni0xOC4yMDk5Ni00My4yNTQ4OC0xOC4yMDk5Ni02OC4wNDE5OWMwLTc0Ljc4NTE2LDYwLjU1NzYyLTEzNi4wNjI1LDEzNi4wNjI1LTEzNi4wNjI1DQoJCQkJCWM0Ny4xOTYyOSwwLDg4Ljc4MDI3LDI0LjAyOTMsMTEzLjE4NTU1LDYwLjUyMjQ2YzIuNzY0NjUsNC4xMzM3OSw4LjI2MzY3LDUuNDIxODgsMTIuNTcwMzEsMi45MzU1NWw4MC40ODczLTQ2LjQ2OTczDQoJCQkJCWMtNDEuMTcxODgtNzEuMTYwMTYtMTE4LjExNzE5LTExOS4wMzYxMy0yMDYuMjQzMTYtMTE5LjAzNjEzYy04NC44NzY5NSwwLTE1OS4zODE4NCw0NC40MTIxMS0yMDEuNTQ1OSwxMTEuMjYzNjcNCgkJCQkJYy0yLjcwNjA1LDQuMjkxMDItOC4zMTgzNiw1LjY4MTY0LTEyLjcxMDk0LDMuMTQ1NTFsLTgwLjM3Njk1LTQ2LjQwNjI1DQoJCQkJCWMtMjguOTUyMTUsNTAuMDQwMDQtNDUuNTIzNDQsMTA4LjEzOTY1LTQ1LjUyMzQ0LDE3MC4xMDc0MmMwLDE4Ni45NjM4NywxNTEuMzk0NTMsMzQwLjE1NzIzLDM0MC4xNTcyMywzNDAuMTU3MjMNCgkJCQkJYzEyMi40MTQwNiwwLDIyOS43MjM2My02NC42NjQwNiwyODkuNjM4NjctMTYxLjY5NTMxYzIuNzk0OTItNC41MjYzNywxLjI5NDkyLTEwLjQ5MDIzLTMuMzEyNS0xMy4xNTEzN2wtODAuMDgzMDEtNDYuMjM3Mw0KCQkJCQlDMTAxNS40NjY4LDkxMS43NjM2Nyw5MzguNTIxNDgsOTU5LjYzODY3LDg1MC4zOTU1MSw5NTkuNjM4Njd6Ii8+DQoJCQk8L2c+DQoJCQk8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iIzAwRkZEQSIgZD0iTTExMzcuMTg1NTUsNzU4LjExMzI4di03My4xNjc5N2wtNjMuMzY1MjMsMzYuNTgzOTgNCgkJCQlMMTEzNy4xODU1NSw3NTguMTEzMjhMMTEzNy4xODU1NSw3NTguMTEzMjh6IE0xMDI2LjU3NjE3LDcwNS4xNjQwNmwxMjAuMDU4NTktNjkuMzE2NDENCgkJCQljMTIuNTY4MzYtNy4yNTU4NiwyOC4zNDQ3MywxLjg1MjU0LDI4LjM0NTcsMTYuMzY2MjF2MTM4LjYzMDg2Yy0wLjAwMDk4LDE0LjUxMjctMTUuNzc3MzQsMjMuNjIyMDctMjguMzQ1NywxNi4zNjYyMQ0KCQkJCWwtMTIwLjA1ODU5LTY5LjMxNjQxQzEwMTQuMDI4MzIsNzMwLjY0OTQxLDEwMTQuMDI4MzIsNzEyLjQwOTE4LDEwMjYuNTc2MTcsNzA1LjE2NDA2eiIvPg0KCQk8L2c+DQoJPC9nPg0KPC9nPg0KPC9zdmc+DQo=").then(a=>
  {"done"===this._splashState?this._webglRenderer.DeleteTexture(a):this._splashTextures.logo=a}).catch(a=>console.warn("Failed to load splash image: ",a)),this._LoadBitmapSplashImage("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAABABAMAAACekdKMAAAAMFBMVEUAAAByfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYYgo7vbAAAAD3RSTlMAmd137hFVqjO7zCKIRGZ881JRAAAFY0lEQVR42u2aPW/bVhSGn1iiPizZ8D+QgSJBNglFmiboQA0NUKAD1XotYA0BOspAkZnqx24vnTrIQNCpg4QkQMcYKDoW9j9w5y6qLNqWFDlvh3tJUa6ddHBhAuS7SKBIQffhuee851CQKVOmTJkyZcqUKXmqa8O+uyNlABKsFRmdP0o5AOle2gHoWdoBzFrpBHACwPeetJNmAFSlt6kGwGH0LqUAVqRuqgHkpEaqAVRkfvOWr+Dh9Rc4j6VvwnrhPNAbgK2ezj+yx7Z6GjUuASi4Ch4lHQAGwBeRK1rROQAdUx5K0hE4NUkaAdS02ZEuoms2wkCSgvYSgFJfkn6CobkSPG0mEcAOrHnGFOxAToHNjk/MygLgO/PxL0BN9yRdQKlufMQAoCdJGi8BOJYknXTJ269cu9HtdqNb4Ni6oimUbFb0dAZQ1DmULJ+TFtT0qQHwg73mLlCMfFUMQPR5VWrbmttNHICC1KDiSZ+w3pMOwFPDhP4IYFtv4ZX0nIorbUBNmjWAiqdZg5fmNFd6jvPhJQDjAV9LI0r28IpmycsBZalNWfoRWJcuoKY9c7cCkwpOwdcIqNT1BmrSgQkNbQAvpAGOF+aHOIBpCxhKR/TVBNjVOHkAOgrg2N6aoU7sklmVidtD7bNm/fIrjaBmk+Sxea142iBnTyguAfjZZscNXLOdXFM8EgVgXRpDz/6yonTEts6AXdV1APTVoKigFSXEmj3XN0kSV01WFQwAHC8O4Mhagye8NgHS137SALzsS3dxwhtXkQ4oaw64eqomOFKXbc2xJbFLTX8DOHYnsKsJu2Gdu8IIuTqjrMB8eyM5ACIFXQo2S5t7lNMM6AdFTaCgADqahHW8EQIohBk9rzEdE+JXAtjVmHWpDTmplUAA96Ea/bJDnVKSWjgaFTSHqubgmjVDXQchgFy4wBXNcXV6LYC8RjbEypomcCAyBopRShxqAn21yenM8WawqjOoKVbmLYBFndeImsnyVwJY1RR8NW1FTRiA6UNTCsP6fKwLONQBZTXx1WVbT0KbtwygvAxg81oAZU0xe2QYxkmyrDDx2DzWBXTUZFs7dNQwHUEMwN4VAKb47wOQ1wj8Gx0+/Y8A8powVJtt7XOoxn8A8N4IqCrA8cJUmzgAl3JAUWN8tSjqDX0NwI/XbwugGLe178oBK7bBaBesm0gggOUqwLrOHe8c1jV2NAMOw/XFAFRth2dr/burANS1cSc0C8kDsB7zAZvgKCjoLTiaFqwpmvwLQC7e2b3PB4CrZj48KXkAKktOEPr6VqeAr680udzEWACluK0LreJ1ThBe6+w4HkfJAhD1AtbAu3qgPcDVX2oCK9bqxwFQ1+fRsVW7va/uBZpAWaND652TCGBoM1rHHN6VmQlsq6cdE+4mC75oLAC49prKB1zTDd6NukHIKahbIkkEsGrmAQWZbZqXNLClrg04dTP4KnjnCwBfmgkZT7WD45k94C8BmA3MPGBgeqcbfQBxwwDsRMi3N7Iqc3dzsuVhV5ofkevpJOoGKUn6Ax5L92F49USoayZCls08uQDiM0ETCWPb8k7DMmH02SICGC7ayVhnsABwEpsZQkfxUpI4ALGpsFn4xCbHcVjnwgnvAkBh0U6CbzqrXgzA1E6FB9YOJGcacgUAfl36t0Ro/SIDUDEL/D1WBcJr5q0oRoJ2LQZgZJ4LPIu2RCPJAJafDLm2Yr2OHmQ4H0vzBksA2PKl38L3fY0aLAFYejK0ZpJhelVKzkj8dlRNzkj8dpRP0DTkVjTUXroB9PVnqtefS9I05BZU8NOdAyUl5q8RtwUg6KYcwP1Up8CanpMpU6ZMmTLdgP4BRYsi23xEdOAAAAAASUVORK5CYII=").then(a=>{"done"===this._splashState?this._webglRenderer.DeleteTexture(a):this._splashTextures.powered=a}).catch(a=>console.warn("Failed to load splash image: ",a)),this._LoadBitmapSplashImage("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAABABAMAAACekdKMAAAAMFBMVEUAAAByfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYYgo7vbAAAAD3RSTlMAdxHdu4hmVZnuRMwzqiLYE4y2AAAFw0lEQVR42u2Yy+9LQRTHp6Xq0VIkXkFvwkYslAWJiGJj2a6sJJe/oF3YWGElEQmxkYi4ErFWNpatWFmIx9Lm1sJCLKgqraqv82h726l6hOuRzDf53TtnOr+ZOZ+ZOffca5ycnJycnJycnJycnJycnJz+pi7g2G9osxjvzX8qB8ABcAAcgH8XwDa85dspNOiaRDuAR4U0PnHtDuyy7IJRJS6gvVmL6TywVkp4ZxIhulUxFvlaXQTrgEHbnMDH5XRjlXCdb+uAnc2ojWgFFTYBZ8e9tzcaswAk6v/3K4sPfPNRFj87IXj+KXQUS9m2jXoH1lMuLq2DtEcAtNMBT9PjanFq7ySAhbABVEAaeDaAwkk2D7GRqctAMQJIq2sBauLnB/VxCfqKpWrbRhSC1W5SMQ9RTgBUwKpF1ccmAIQ2gCxE+20Au9nSESvDgeIDkJSBMpA9vgyXdsj0H0GORL3n2fbwPOKoSQS4Q2cBOGzSJbQYAHDbZEI+rEuBcyZRlF71fIP/x0wBuIBOw6xH3xu2GQFAP2cegmvSwHkeqBZjECzB46UXD3bg8UKJCT6QYzgDY9uiU7hC11doERq6MAZ2CPJ7ipEulOrteDcB4KOZBpBG7zrV1JGzATzmIdnrl/go3bRiBJBHlZc+6ItjuQQ+yFLz8Gka2LZFRVTFGdoQJQ0LPodHnXkS8AjlRWkBLwKQswAs0PDzGpcsAAMNuG+5WgdqxwjgEcp8qcBjN5oZdPhEvOfhU/hsbJuVloWV6WWgp2IBLxXQNEwLDfKqoMXrEQBjATiFA3qePlgAZJRl+EStdaAQjfgALOC1zfeX8ALV+7S69JdALWjxHGqztmxyMnTD6OOBWvAdGDkn60c6vrI5H4CPnOJsWQDe8G0hIU0MB8ojFx+AFAeqeitLy5FkL3w0yNNcSOx3oDxjjxaH9XxldZluY5NBfwrAQvQbRjQXAO8UqVq5dh6A7HCgWzgdFwBdgOX4lMZbTndkWWkDN07Bk+zItllLdHm1+FkLwBSADNDf8B0AnGOp5gFYgJEexwcgGQx4iyeD9ybFkWsbDZbv0+2Y8XvGtqMpWsUimpMAzA1AUrj5ALjm2wCoONKB+ACYsEeDlU04MMs4imeJQqljslSuD4xl/zgAsx6ku/8DgDwaO9AwFU56qhzOPiXpKCzCpSSdb8v+CQDmXshb99cARAPFCOA1chWaFXlP55yn2FqEgiFvOSzYtmiJzisKB7MxQPS8iO63YsD3AHDv8QPgjR92eKuf9vts1wdZjvZhN4XajD35FNDiR7ln0LYBaILY+OZT4DsA+BkTP4AUrgXkxSJcDFps+72X7EGlx6mBbU/lAbdQjvKA7hSAlSuHxdw0gORsHrAUnXkAUuj+AQAZdHGRp9bShX2ECz1JRSk4zNhRJqj5SZQJfpgCUNS2eRsAP/usTDAxPxFKA834AZgAOM1z6qGgxxpdmUDQNjP25LtAsojxu0AehSkAF6RLXWR/EkAdVYEevQtswVtpMwuAB1JGh2jbxQcgBKrig/qSxTD6o2Nm7fttSY6uUnErV+jb4CJyaArAI5luJkCDOy5HAPISSB5A3wYbhJERahvtPALAAw2EI9Vzsh2TTuk23qEceN9d4vVVv227hNroe0CRi/o9IKTZTQFIAc/M8jwGEiouG2/042u8u25uAuPvAavRH7XhzqcBpICdRpssRa+aNLFoh2JeyBzU08fih/ht20WZXghW34s+/ZQnAKhzojsSH4CC/sjARPKamLXacOfTAIwfNSkCbROLluG9Tm2gdl3PY178tu2SBIpFQ6fHH//2GAvAogCkjtGDEAFQYPsu6DdBqw11bgFIF8dNHsQGIEFRSDOe0RS9YYJk23JMrw+/Cr9bFX0VXmNsACbhA088qXhBrMYAlq8Gjhh//FX4YNSGO7cASO9n9B99AuHk5OTk5OTk5OTk5OTk5OTk5OT0VX0B7+fX+9cwWYYAAAAASUVORK5CYII=").then(a=>{"done"===this._splashState?this._webglRenderer.DeleteTexture(a):
  this._splashTextures.website=a}).catch(a=>console.warn("Failed to load splash image: ",a)))}async _LoadSvgSplashImage(a){a=(new URL(a,this._runtime.GetBaseURL())).toString();a=await h.FetchBlob(a);a=await this._runtime.RasterSvgImage(a,2048,2048);return await this._webglRenderer.CreateStaticTextureAsync(a,{mipMapQuality:"high"})}async _LoadBitmapSplashImage(a){a=(new URL(a,this._runtime.GetBaseURL())).toString();a=await h.FetchBlob(a);return await this._webglRenderer.CreateStaticTextureAsync(a,{mipMapQuality:"high"})}StartLoadingScreen(){this._loaderStartTime=
  Date.now();this._runtime.Dispatcher().addEventListener("loadingprogress",this._loadingprogress_handler);this._rafId=requestAnimationFrame(()=>this._DrawLoadingScreen())}async EndLoadingScreen(){this._loadingProgress=1;4===this._runtime.GetLoaderStyle()&&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._loadingLogoAsset&&(this._loadingLogoAsset.Release(),this._loadingLogoAsset=null);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()}_DrawLoadingScreen(){if(-1!==this._rafId){var a=this._webglRenderer;a.Start();this._rafId=-1;var b=this._runtime.GetAssetManager().HasHadErrorLoading(),c=this._runtime.GetLoaderStyle();3!==c&&(this.SetCssTransform(a),a.ClearRgba(0,0,0,0),a.ResetColor(),
  a.SetTextureFillMode(),a.SetTexture(null));if(0===c)this._DrawProgressBarAndLogoLoadingScreen(b);else if(1===c)this._DrawProgressBarLoadingScreen(b,120,0);else if(2===c)this._DrawPercentTextLoadingScreen(b);else if(3===c)h.noop();else if(4===c)this._DrawSplashLoadingScreen(b);else throw Error("invalid loader style");a.Finish();this._rafId=requestAnimationFrame(()=>this._DrawLoadingScreen())}}_DrawPercentTextLoadingScreen(a){a?this._percentText.SetColorRgb(1,0,0):this._percentText.SetColorRgb(.6,.6,
  .6);this._percentText.SetText(Math.round(100*this._loadingProgress)+"%");a=this._canvasCssWidth/2;const b=this._canvasCssHeight/2;q.setRect(a-150,b-100,a+150,b+100);this._webglRenderer.SetTexture(this._percentText.GetTexture());this._webglRenderer.Quad3(q,this._percentText.GetTexRect())}_DrawProgressBarLoadingScreen(a,b,c){const d=this._webglRenderer;d.SetColorFillMode();a?d.SetColorRgba(1,0,0,1):d.SetColorRgba(.118,.565,1,1);a=this._canvasCssWidth/2;const l=this._canvasCssHeight/2,f=b/2;g.setWH(a-
  f,l-4+c,Math.floor(b*this._loadingProgress),8);d.Rect(g);g.setWH(a-f,l-4+c,b,8);g.offset(-.5,-.5);g.inflate(.5,.5);d.SetColorRgba(0,0,0,1);d.LineRect2(g);g.inflate(1,1);d.SetColorRgba(1,1,1,1);d.LineRect2(g)}_DrawProgressBarAndLogoLoadingScreen(a){if(this._loadingLogoAsset){var b=this._loadingLogoAsset.GetTexture();if(b){var c=b.GetWidth(),d=b.GetHeight(),l=this._canvasCssWidth/2,f=this._canvasCssHeight/2,p=c/2;d/=2;q.setRect(l-p,f-d,l+p,f+d);this._webglRenderer.SetTexture(b);this._webglRenderer.Quad(q);
  this._DrawProgressBarLoadingScreen(a,c,d+16)}else this._DrawProgressBarLoadingScreen(a,120,0)}else this._DrawProgressBarLoadingScreen(a,120,0)}_DrawSplashLoadingScreen(a){const b=this._webglRenderer,c=this._splashTextures.logo,d=this._splashTextures.powered,l=this._splashTextures.website,f=Date.now();0===this._splashFrameNumber&&(this._loaderStartTime=f);const p=this._runtime.IsPreview()||this._runtime.IsFBInstantAvailable()&&!this._runtime.IsCordova(),u=p?0:200,v=p?0:3E3;let e=1;"fade-in"===this._splashState?
  e=Math.min((f-this._loaderStartTime)/300,1):"fade-out"===this._splashState&&(e=Math.max(1-(f-this._splashFadeOutStartTime)/300,0));b.SetColorFillMode();b.SetColorRgba(.231*e,.251*e,.271*e,e);g.set(0,0,this._canvasCssWidth,this._canvasCssHeight);b.Rect(g);const n=Math.ceil(this._canvasCssWidth),m=Math.ceil(this._canvasCssHeight);let k;256<this._canvasCssHeight?(b.SetColorRgba(.302*e,.334*e,.365*e,e),k=Math.max(.005*m,2),g.setWH(0,.8*m-k/2,n,k),b.Rect(g),a?b.SetColorRgba(e,0,0,e):b.SetColorRgba(.161*
  e,.953*e,.816*e,e),a=n*this._loadingProgress,g.setWH(.5*n-a/2,.8*m-k/2,a,k),b.Rect(g),b.SetColorRgba(e,e,e,e),b.SetTextureFillMode(),d&&(a=1.5*h.clamp(.22*m,105,.6*n),k=a/8,g.setWH(.5*n-a/2,.2*m-k/2,a,k),b.SetTexture(d),b.Rect(g)),c&&(k=a=Math.min(.395*m,.95*n),g.setWH(.5*n-a/2,.485*m-k/2,a,k),b.SetTexture(c),b.Rect(g)),l&&(a=1.5*h.clamp(.22*m,105,.6*n),k=a/8,g.setWH(.5*n-a/2,.868*m-k/2,a,k),b.SetTexture(l),b.Rect(g))):(b.SetColorRgba(.302*e,.334*e,.365*e,e),k=Math.max(.005*m,2),g.setWH(0,.85*m-k/
  2,n,k),b.Rect(g),a?b.SetColorRgba(e,0,0,e):b.SetColorRgba(.161*e,.953*e,.816*e,e),a=n*this._loadingProgress,g.setWH(.5*n-a/2,.85*m-k/2,a,k),b.Rect(g),b.SetColorRgba(e,e,e,e),b.SetTextureFillMode(),c&&(k=a=.55*m,g.setWH(.5*n-a/2,.45*m-k/2,a,k),b.SetTexture(c),b.Rect(g)));this._splashFrameNumber++;"fade-in"===this._splashState&&300<=f-this._loaderStartTime&&2<=this._splashFrameNumber&&(this._splashState="wait",this._splashFadeInFinishTime=f);"wait"===this._splashState&&f-this._splashFadeInFinishTime>=
  v&&1<=this._loadingProgress&&(this._splashState="fade-out",this._splashFadeOutStartTime=f);("fade-out"===this._splashState&&f-this._splashFadeOutStartTime>=300+u||p&&1<=this._loadingProgress&&500>f-this._loaderStartTime)&&this._splashDoneResolve()}}};
  
  
  // c3/runtime.js
  'use strict';{const c=self.C3,g=self.C3Debugger,t={messagePort:null,baseUrl:"",headless:!1,hasDom:!0,isInWorker:!1,useAudio:!0,projectData:"",exportType:""};let r=!0;c.Runtime=class extends c.DefendedBase{constructor(a){a=Object.assign({},t,a);super();this._messagePort=a.messagePort;this._baseUrl=a.baseUrl;this._isHeadless=!!a.headless;this._hasDom=!!a.hasDom;this._isInWorker=!!a.isInWorker;r=a.ife;this._useAudio=!!a.useAudio;this._exportType=a.exportType;this._isiOSCordova=!!a.isiOSCordova;this._isiOSWebView=
  !!a.isiOSWebView;this._isFBInstantAvailable=!!a.isFBInstantAvailable;this._opusWasmScriptUrl=a.opusWasmScriptUrl;this._opusWasmBinaryUrl=a.opusWasmBinaryUrl;this._dataJsonFilename="data.json";this._isDebugging=this._breakpointsEnabled=this._isDebug=!("preview"!==this._exportType||!a.isDebug);this._debuggingDisabled=0;const b=a.previewImageBlobs;var d=a.previewProjectFileBlobs;d&&Object.assign(b,d);(d=a.projectData)&&(b[this._dataJsonFilename]=d);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._loadingLogoFilename="loading-logo.png";this._assetManager=c.New(c.AssetManager,this,{defaultLoadPolicy:"html5"===
  this._exportType||"scirra-arcade"===this._exportType||"instant-games"===this._exportType?"remote":"local",localUrlBlobs:b,isCordova:"cordova"===this._exportType,isiOSCordova:this._isiOSCordova,supportedAudioFormats:a.supportedAudioFormats});this._layoutManager=c.New(c.LayoutManager,this);this._eventSheetManager=c.New(c.EventSheetManager,this);this._pluginManager=c.New(c.PluginManager,this);this._collisionEngine=c.New(c.CollisionEngine,this);this._timelineManager=c.New(c.TimelineManager,this);this._transitionManager=
  c.New(c.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._framerateMode="vsync";this._compositingMode="standard";this._sampling="trilinear";this._isPixelRoundingEnabled=!1;this._needRender=!0;this._isPausedOnBlur=this._pauseOnBlur=!1;this._tickCallbacks={normal:a=>{this._ruafId=this._rafId=-1;this.Tick(a)},tickOnly:a=>{this._ruafId=-1;this.Tick(a,!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 c.PromiseThrottle(1);this._randomNumberCallback=()=>Math.random();this._dt=this._dt1=this._lastTickTime=this._startTime=0;this._timeScale=1;this._minimumFramerate=30;this._gameTime=c.New(c.KahanSum);this._wallTime=c.New(c.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._triggerOnCreateAfterLoad=[];this._savegamesStorage=this._projectStorage=null;this._dispatcher=c.New(c.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:c.New(c.Event,"pretick",
  !1),tick:c.New(c.Event,"tick",!1),tick2:c.New(c.Event,"tick2",!1),instancedestroy:c.New(c.Event,"instancedestroy",!1),beforelayoutchange:c.New(c.Event,"beforelayoutchange",!1),layoutchange:c.New(c.Event,"layoutchange",!1)};this._eventObjects.instancedestroy.instance=null;this._userScriptDispatcher=c.New(c.Event.Dispatcher);this._userScriptEventObjects=null;this._behInstsToTick=c.New(c.RedBlackSet,c.BehaviorInstance.SortByTickSequence);this._behInstsToPostTick=c.New(c.RedBlackSet,c.BehaviorInstance.SortByTickSequence);
  this._behInstsToTick2=c.New(c.RedBlackSet,c.BehaviorInstance.SortByTickSequence);this._jobScheduler=c.New(c.JobSchedulerRuntime,this,a.jobScheduler);a.canvas&&(this._canvasManager=c.New(c.CanvasManager,this));this._messagePort.onmessage=a=>this._OnMessageFromDOM(a.data);this.AddDOMComponentMessageHandler("runtime","visibilitychange",a=>this._OnVisibilityChange(a));this.AddDOMComponentMessageHandler("runtime","opus-decode",a=>this._WasmDecodeWebMOpus(a.arrayBuffer));this.AddDOMComponentMessageHandler("runtime",
  "get-remote-preview-status-info",()=>this._GetRemotePreviewStatusInfo());this.AddDOMComponentMessageHandler("runtime","js-invoke-function",a=>this._InvokeFunctionFromJS(a));this.AddDOMComponentMessageHandler("runtime","go-to-last-error-script",self.goToLastErrorScript);this._dispatcher.addEventListener("window-blur",a=>this._OnWindowBlur(a));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(a){return c.New(c.Runtime,a)}Release(){c.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"](a){const b=a.type;if("event"===b)this._OnEventFromDOM(a);else if("result"===b)this._OnResultFromDOM(a);else throw Error(`unknown message '${b}'`);}_OnEventFromDOM(a){if(this._isReadyToHandleEvents){var b=a.component,
  d=a.handler,e=a.data,f=a.dispatchOpts,k=!(!f||!f.dispatchRuntimeEvent);f=!(!f||!f.dispatchUserScriptEvent);var h=a.responseId;if("runtime"===b&&(k&&(a=new c.Event(d),a.data=e,this._dispatcher.dispatchEventAndWaitAsyncSequential(a)),f)){a=new c.Event(d,!0);for(const [b,d]of Object.entries(e))a[b]=d;this.DispatchUserScriptEvent(a)}if(a=this._domEventHandlers.get(b))if(a=a.get(d)){k=null;try{k=a(e)}catch(l){console.error(`Exception in '${b}' handler '${d}':`,l);null!==h&&this._PostResultToDOM(h,!1,""+
  l);return}null!==h&&(k&&k.then?k.then(a=>this._PostResultToDOM(h,!0,a)).catch(a=>{console.error(`Rejection from '${b}' handler '${d}':`,a);this._PostResultToDOM(h,!1,""+a)}):this._PostResultToDOM(h,!0,k))}else k||f||console.warn(`[Runtime] No DOM handler '${d}' for component '${b}'`);else k||f||console.warn(`[Runtime] No DOM event handlers for component '${b}'`)}else this._waitingToHandleEvents.push(a)}_PostResultToDOM(a,b,d){this._messagePort.postMessage({type:"result",responseId:a,isOk:b,result:d})}_OnResultFromDOM(a){const b=
  a.responseId,d=a.isOk;a=a.result;const e=this._pendingResponsePromises.get(b);d?e.resolve(a):e.reject(a);this._pendingResponsePromises.delete(b)}AddDOMComponentMessageHandler(a,b,d){let e=this._domEventHandlers.get(a);e||(e=new Map,this._domEventHandlers.set(a,e));if(e.has(b))throw Error(`[Runtime] Component '${a}' already has handler '${b}'`);e.set(b,d)}PostComponentMessageToDOM(a,b,d){this._messagePort.postMessage({type:"event",component:a,handler:b,data:d,responseId:null})}PostComponentMessageToDOMAsync(a,
  b,d){const e=this._nextDomResponseId++,f=new Promise((a,b)=>{this._pendingResponsePromises.set(e,{resolve:a,reject:b})});this._messagePort.postMessage({type:"event",component:a,handler:b,data:d,responseId:e});return f}PostToDebugger(a){if(!this.IsDebug())throw Error("not in debug mode");this.PostComponentMessageToDOM("runtime","post-to-debugger",a)}async Init(a){this.IsDebug()?await g.Init(this):self.C3Debugger&&self.C3Debugger.InitPreview(this);var [b]=await Promise.all([this._assetManager.FetchJson(this._dataJsonFilename),
  this._MaybeLoadOpusDecoder(),this._jobScheduler.Init()]);this._LoadDataJson(b);await this._InitialiseCanvas(a);this.IsPreview()||console.info("Made with Construct 3, the game and app creator :: https://www.construct.net");(b=this.GetWebGLRenderer())?(console.info(`[C3 runtime] Hosted in ${this.IsInWorker()?"worker":"DOM"}, rendering with WebGL ${b.GetWebGLVersionNumber()} [${b.GetUnmaskedRenderer()}] (${b.IsDesynchronized()?"desynchronized":"standard"} compositing)`),b.HasMajorPerformanceCaveat()&&
  console.warn("[C3 runtime] WebGL indicates a major performance caveat. Software rendering may be in use. This can result in significantly degraded performance.")):console.info(`[C3 runtime] Hosted in ${this.IsInWorker()?"worker":"DOM"}, headless`);this._isReadyToHandleEvents=!0;for(const a of this._waitingToHandleEvents)this._OnEventFromDOM(a);c.clearArray(this._waitingToHandleEvents);this._canvasManager&&this._canvasManager.StartLoadingScreen();for(const b of a.runOnStartupFunctions)this._additionalLoadPromises.push(this._RunOnStartupFunction(b));
  await Promise.all([this._assetManager.WaitForAllToLoad(),...this._additionalLoadPromises]);c.clearArray(this._additionalLoadPromises);if(!this._assetManager.HasHadErrorLoading())return this._canvasManager&&await this._canvasManager.EndLoadingScreen(),await this._dispatcher.dispatchEventAndWaitAsync(new c.Event("beforeruntimestart")),await this.Start(),this._messagePort.postMessage({type:"runtime-ready"}),this}async _RunOnStartupFunction(a){try{await a(this._iRuntime)}catch(b){console.error("[C3 runtime] Error in runOnStartup function: ",
  b)}}_LoadDataJson(a){a=a.project;this._projectName=a[0];this._projectVersion=a[16];this._projectUniqueId=a[31];this._appId=a[38];this._loadingLogoFilename=a[39];this._isPixelRoundingEnabled=!!a[9];this._originalViewportWidth=this._viewportWidth=a[10];this._originalViewportHeight=this._viewportHeight=a[11];this._parallaxXorigin=this._originalViewportWidth/2;this._parallaxYorigin=this._originalViewportHeight/2;this._compositingMode=a[36];this._framerateMode=a[37];"low-latency"===this._compositingMode&&
  this.IsAndroidWebView()&&77>=c.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._sampling=a[14];this._usesLoaderLayout=!!a[18];this._loaderStyle=a[19];this._nextUid=a[21];this._pauseOnBlur=a[22];this._assetManager._SetAudioFiles(a[7],a[25]);this._assetManager._SetMediaSubfolder(a[8]);
  this._assetManager._SetFontsSubfolder(a[32]);this._assetManager._SetIconsSubfolder(a[28]);this._assetManager._SetWebFonts(a[29]);this._canvasManager&&(this._canvasManager.SetFullscreenMode(c.CanvasManager._FullscreenModeNumberToString(a[12])),this._canvasManager.SetFullscreenScalingQuality(a[23]?"high":"low"),this._canvasManager.SetMipmapsEnabled(0!==a[24]),this._canvasManager._SetGPUPowerPreference(a[34]));this._pluginManager.CreateSystemPlugin();this._objectReferenceTable=self.C3_GetObjectRefTable();
  for(var b of a[2])this._pluginManager.CreatePlugin(b);this._objectReferenceTable=self.C3_GetObjectRefTable();this._LoadJsPropNameTable();for(var d of a[3])b=c.ObjectClass.Create(this,this._allObjectClasses.length,d),this._allObjectClasses.push(b),this._objectClassesByName.set(b.GetName().toLowerCase(),b),this._objectClassesBySid.set(b.GetSID(),b);for(const b of a[4])this._allObjectClasses[b[0]]._LoadFamily(b);for(var e of a[27])d=e.map(a=>this._allObjectClasses[a]),this._allContainers.push(c.New(c.Container,
  this,d));for(const a of this._allObjectClasses)a._OnAfterCreate();for(const b of a[5])this._layoutManager.Create(b);(e=a[1])&&(e=this._layoutManager.GetLayoutByName(e))&&this._layoutManager.SetFirstLayout(e);for(var f of a[33])this._timelineManager.Create(f);for(const b of a[35])this._transitionManager.Create(b);this._InitScriptInterfaces();for(const b of a[6])this._eventSheetManager.Create(b);this._eventSheetManager._PostInit();this._InitGlobalVariableScriptInterface();c.clearArray(this._objectReferenceTable);
  this.FlushPendingInstances();f="any";a=a[20];1===a?f="portrait":2===a&&(f="landscape");this.PostComponentMessageToDOM("runtime","set-target-orientation",{targetOrientation:f})}GetLoaderStyle(){return this._loaderStyle}IsFBInstantAvailable(){return this._isFBInstantAvailable}IsLoading(){return this._isLoading}AddLoadPromise(a){this._additionalLoadPromises.push(a)}SetUsingCreatePromises(a){this._isUsingCreatePromises=!!a}AddCreatePromise(a){this._isUsingCreatePromises&&this._additionalCreatePromises.push(a)}GetCreatePromises(){return this._additionalCreatePromises}_GetNextFamilyIndex(){return this._familyCount++}GetFamilyCount(){return this._familyCount}_AddEffectList(a){this._allEffectLists.push(a)}_GetAllEffectLists(){return this._allEffectLists}async _InitialiseCanvas(a){this._canvasManager&&
  (await this._canvasManager.CreateCanvas(a),this._canvasManager.InitLoadingScreen(this._loaderStyle))}async _MaybeLoadOpusDecoder(){if(!this._assetManager.IsAudioFormatSupported("audio/webm; codecs=opus")){var a=null,b=null;try{this.IsiOSCordova()&&"file:"===location.protocol?b=await this._assetManager.CordovaFetchLocalFileAsArrayBuffer(this._opusWasmBinaryUrl):a=await this._assetManager.FetchBlob(this._opusWasmBinaryUrl)}catch(d){console.info("Failed to fetch Opus decoder WASM; assuming project has no Opus audio.",
  d);return}b?this.AddJobWorkerBuffer(b,"opus-decoder-wasm"):this.AddJobWorkerBlob(a,"opus-decoder-wasm");await this.AddJobWorkerScripts([this._opusWasmScriptUrl])}}async _WasmDecodeWebMOpus(a){return await this.AddJob("OpusDecode",{arrayBuffer:a},[a])}async Start(){this._hasStarted=!0;this._startTime=Date.now();if(this._usesLoaderLayout){for(var a of this._allObjectClasses)a.IsFamily()||a.IsOnLoaderLayout()||!a.IsWorldType()||a.OnCreate();this._assetManager.WaitForAllToLoad().then(()=>{this._isLoading=
  !1;this._OnLoadFinished()})}else this._isLoading=!1;this._assetManager.SetInitialLoadFinished();this.IsDebug()&&g.RuntimeInit(r);for(const a of this._layoutManager.GetAllLayouts())a._CreateGlobalNonWorlds();a=this._layoutManager.GetFirstLayout();await a._Load(null,this.GetWebGLRenderer());await a._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(c.Plugins.System.Cnds.OnLoadFinished,null,null);this.PostComponentMessageToDOM("runtime","register-sw")}GetObjectReference(a){a=Math.floor(a);const b=this._objectReferenceTable;if(0>a||a>=b.length)throw Error("invalid object reference");return b[a]}_LoadJsPropNameTable(){for(const a of self.C3_JsPropNameTable){const b=c.first(Object.keys(a));this._jsPropNameTable.push(b)}}GetJsPropName(a){a=Math.floor(a);const b=this._jsPropNameTable;if(0>a||a>=b.length)throw Error("invalid prop reference");
  return b[a]}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(a){a=Math.floor(a);if(0>a||a>=this._allObjectClasses.length)throw new RangeError("invalid index");return this._allObjectClasses[a]}GetObjectClassByName(a){return this._objectClassesByName.get(a.toLowerCase())||null}GetObjectClassBySID(a){return this._objectClassesBySid.get(a)||
  null}GetSingleGlobalObjectClassByCtor(a){return(a=this._pluginManager.GetPluginByConstructorFunction(a))?a.GetSingleGlobalObjectClass():null}GetAllObjectClasses(){return this._allObjectClasses}Dispatcher(){return this._dispatcher}UserScriptDispatcher(){return this._userScriptDispatcher}DispatchUserScriptEvent(a){a.runtime=this.GetIRuntime();const b=this.IsDebug()&&!this._eventSheetManager.IsInEventEngine();b&&g.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(a);b&&g.AddScriptTime()}DispatchUserScriptEventAsyncWait(a){a.runtime=
  this.GetIRuntime();return this._userScriptDispatcher.dispatchEventAndWaitAsync(a)}GetOriginalViewportWidth(){return this._originalViewportWidth}GetOriginalViewportHeight(){return this._originalViewportHeight}SetOriginalViewportSize(a,b){this._originalViewportWidth=a;this._originalViewportHeight=b}GetViewportWidth(){return this._viewportWidth}GetViewportHeight(){return this._viewportHeight}SetViewportSize(a,b){this._viewportWidth=a;this._viewportHeight=b}_SetDevicePixelRatio(a){this._devicePixelRatio=
  a}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(a){return this._canvasManager?
  this._canvasManager.GetAdditionalRenderTarget(a):null}ReleaseAdditionalRenderTarget(a){this._canvasManager&&this._canvasManager.ReleaseAdditionalRenderTarget(a)}_SetUsesAnyBackgroundBlending(a){this._usesAnyBackgroundBlending=!!a}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}GetLoadingLogoFilename(){return this._loadingLogoFilename}GetLayoutManager(){return this._layoutManager}GetMainRunningLayout(){return this._layoutManager.GetMainRunningLayout()}GetTimelineManager(){return this._timelineManager}GetTransitionManager(){return this._transitionManager}GetAssetManager(){return this._assetManager}LoadImage(a){return this._assetManager.LoadImage(a)}CreateInstance(a,
  b,d,e){return this.CreateInstanceFromData(a,b,!1,d,e)}CreateInstanceFromData(a,b,d,e,f,k){let h=null,l=null;if(a instanceof c.ObjectClass){l=a;if(l.IsFamily()){a=l.GetFamilyMembers();var n=Math.floor(this.Random()*a.length);l=a[n]}h=l.GetDefaultInstanceData()}else h=a,l=this.GetObjectClassByIndex(h[1]);const p=l.GetPlugin().IsWorldType();if(this._isLoading&&p&&!l.IsOnLoaderLayout())return null;const u=b;p||(b=null);var m=d&&!k&&h&&!this._instancesByUid.has(h[2])?h[2]:this._nextUid++;n=h?h[0]:null;
  a=c.New(c.Instance,{runtime:this,objectType:l,layer:b,worldData:n,instVarData:h?h[3]:null,uid:m});this._instancesByUid.set(m,a);m=null;p&&(m=a.GetWorldInfo(),"undefined"!==typeof e&&"undefined"!==typeof f&&(m.SetX(e),m.SetY(f)),l._SetAnyCollisionCellChanged(!0));b&&(b._AddInstance(a,!0),1===b.GetParallaxX()&&1===b.GetParallaxY()||l._SetAnyInstanceParallaxed(!0),b.GetLayout().MaybeLoadTexturesFor(l));this._objectCount++;if(l.IsInContainer()&&!d&&!k){for(var q of l.GetContainer().objectTypes())q!==
  l&&(b=this.CreateInstanceFromData(q,u,!1,m?m.GetX():e,m?m.GetY():f,!0),a._AddSibling(b));for(const b of a.siblings()){b._AddSibling(a);for(const c of a.siblings())b!==c&&b._AddSibling(c)}}l._SetIIDsStale();e=h?c.cloneArray(h[5]):null;f=h?h[4].map(a=>c.cloneArray(a)):null;(q=p&&n&&14===n.length)&&a._SetHasTilemap();a._CreateSdkInstance(e,f);q&&(e=n[13],a.GetSdkInstance().LoadTilemapData(e[2],e[0],e[1]));this._instancesPendingCreate.push(a);this._hasPendingInstances=!0;this.IsDebug()&&g.InstanceCreated(a);
  return a}DestroyInstance(a){if(!this._instancesToReleaseAtEndOfTick.has(a)){var b=a.GetObjectClass(),d=this._instancesPendingDestroy.get(b);if(d){if(d.has(a))return;d.add(a)}else d=new Set,d.add(a),this._instancesPendingDestroy.set(b,d);this.IsDebug()&&g.InstanceDestroyed(a);a._MarkDestroyed();this._hasPendingInstances=!0;if(a.IsInContainer())for(const b of a.siblings())this.DestroyInstance(b);this._layoutManager.IsEndingLayout()||this._isLoadingState||(b=this.GetEventSheetManager(),b.BlockFlushingInstances(!0),
  a._TriggerOnDestroyed(),b.BlockFlushingInstances(!1));a._FireDestroyedScriptEvents(this._layoutManager.IsEndingLayout())}}FlushPendingInstances(){this._hasPendingInstances&&(this._isFlushingPendingInstances=!0,this._FlushInstancesPendingCreate(),this._FlushInstancesPendingDestroy(),this._hasPendingInstances=this._isFlushingPendingInstances=!1,this.UpdateRender())}_FlushInstancesPendingCreate(){for(const a of this._instancesPendingCreate){const b=a.GetObjectClass();b._AddInstance(a);for(const c of b.GetFamilies())c._AddInstance(a),
  c._SetIIDsStale()}c.clearArray(this._instancesPendingCreate)}_FlushInstancesPendingDestroy(){this._dispatcher.SetDelayRemoveEventsEnabled(!0);for(const [a,b]of this._instancesPendingDestroy.entries())this._FlushInstancesPendingDestroyForObjectClass(a,b),b.clear();this._instancesPendingDestroy.clear();this._dispatcher.SetDelayRemoveEventsEnabled(!1)}_FlushInstancesPendingDestroyForObjectClass(a,b){for(const a of b){var d=this._eventObjects.instancedestroy;d.instance=a;this._dispatcher.dispatchEvent(d);
  this._instancesByUid.delete(a.GetUID());if(d=a.GetWorldInfo())d._RemoveFromCollisionCells(),d._RemoveFromRenderCells();this._instancesToReleaseAtEndOfTick.add(a);this._objectCount--}c.arrayRemoveAllInSet(a.GetInstances(),b);a._SetIIDsStale();this._instancesToReleaseAffectedObjectClasses.add(a);0===a.GetInstances().length&&a._SetAnyInstanceParallaxed(!1);for(const d of a.GetFamilies())c.arrayRemoveAllInSet(d.GetInstances(),b),d._SetIIDsStale(),this._instancesToReleaseAffectedObjectClasses.add(d);if(a.GetPlugin().IsWorldType()){a=
  new Set([...b].map(a=>a.GetWorldInfo().GetLayer()));for(const c of a)c._RemoveAllInstancesInSet(b)}}_GetInstancesPendingCreate(){return this._instancesPendingCreate}_GetNewUID(){return this._nextUid++}_MapInstanceByUID(a,b){this._instancesByUid.set(a,b)}_OnWebGLContextLost(){this._dispatcher.dispatchEvent(c.New(c.Event,"webglcontextlost"));this.SetSuspended(!0);for(var a of this._allObjectClasses)!a.IsFamily()&&a.HasLoadedTextures()&&a.ReleaseTextures();(a=this.GetMainRunningLayout())&&a._OnWebGLContextLost();
  c.ImageInfo.OnWebGLContextLost();c.ImageAsset.OnWebGLContextLost()}async _OnWebGLContextRestored(){await this.GetMainRunningLayout()._Load(null,this.GetWebGLRenderer());this._dispatcher.dispatchEvent(c.New(c.Event,"webglcontextrestored"));this.SetSuspended(!1);this.UpdateRender()}_OnVisibilityChange(a){this.SetSuspended(a.hidden)}_OnWindowBlur(a){this.IsPreview()&&this._pauseOnBlur&&!c.Platform.IsMobile&&!a.data.parentHasFocus&&(this.SetSuspended(!0),this._isPausedOnBlur=!0)}_OnWindowFocus(){this._isPausedOnBlur&&
  (this.SetSuspended(!1),this._isPausedOnBlur=!1)}_RequestAnimationFrame(){const a=this._tickCallbacks;"vsync"===this._framerateMode?-1===this._rafId&&(this._rafId=self.requestAnimationFrame(a.normal)):"unlimited-tick"===this._framerateMode?(-1===this._ruafId&&(this._ruafId=c.RequestUnlimitedAnimationFrame(a.tickOnly)),-1===this._rafId&&(this._rafId=self.requestAnimationFrame(a.renderOnly))):-1===this._ruafId&&(this._ruafId=c.RequestUnlimitedAnimationFrame(a.normal))}_CancelAnimationFrame(){-1!==this._rafId&&
  (self.cancelAnimationFrame(this._rafId),this._rafId=-1);-1!==this._ruafId&&(c.CancelUnlimitedAnimationFrame(this._ruafId),this._ruafId=-1)}IsSuspended(){return 0<this._suspendCount}SetSuspended(a){var b=this.IsSuspended();this._suspendCount+=a?1:-1;0>this._suspendCount&&(this._suspendCount=0);a=this.IsSuspended();!b&&a?(console.log("[Construct 3] Suspending"),this._CancelAnimationFrame(),this._dispatcher.dispatchEvent(c.New(c.Event,"suspend")),this.Trigger(c.Plugins.System.Cnds.OnSuspend,null,null)):
  b&&!a&&(console.log("[Construct 3] Resuming"),this._fpsLastTime=this._lastTickTime=b=performance.now(),this._mainThreadTimeCounter=this._mainThreadTime=this._fps=this._fpsFrameCount=0,this._dispatcher.dispatchEvent(c.New(c.Event,"resume")),this.Trigger(c.Plugins.System.Cnds.OnResume,null,null),this.HitBreakpoint()||this.Tick(b))}_AddBehInstToTick(a){this._behInstsToTick.Add(a)}_AddBehInstToPostTick(a){this._behInstsToPostTick.Add(a)}_AddBehInstToTick2(a){this._behInstsToTick2.Add(a)}_RemoveBehInstToTick(a){this._behInstsToTick.Remove(a)}_RemoveBehInstToPostTick(a){this._behInstsToPostTick.Remove(a)}_RemoveBehInstToTick2(a){this._behInstsToTick2.Remove(a)}_BehaviorTick(){this._behInstsToTick.SetQueueingEnabled(!0);
  for(const a of this._behInstsToTick)a.Tick();this._behInstsToTick.SetQueueingEnabled(!1)}_BehaviorPostTick(){this._behInstsToPostTick.SetQueueingEnabled(!0);for(const a of this._behInstsToPostTick)a.PostTick();this._behInstsToPostTick.SetQueueingEnabled(!1)}_BehaviorTick2(){this._behInstsToTick2.SetQueueingEnabled(!0);for(const a of this._behInstsToTick2)a.Tick2();this._behInstsToTick2.SetQueueingEnabled(!1)}*_DebugBehaviorTick(){this._behInstsToTick.SetQueueingEnabled(!0);for(const a of this._behInstsToTick){const b=
  a.Tick();c.IsIterator(b)&&(yield*b)}this._behInstsToTick.SetQueueingEnabled(!1)}*_DebugBehaviorPostTick(){this._behInstsToPostTick.SetQueueingEnabled(!0);for(const a of this._behInstsToPostTick){const b=a.PostTick();c.IsIterator(b)&&(yield*b)}this._behInstsToPostTick.SetQueueingEnabled(!1)}*_DebugBehaviorTick2(){this._behInstsToTick2.SetQueueingEnabled(!0);for(const a of this._behInstsToTick2){const b=a.Tick2();c.IsIterator(b)&&(yield*b)}this._behInstsToTick2.SetQueueingEnabled(!1)}async Tick(a,b,
  d){this._hasStartedTicking=!0;const e="background-wake"===d;d="background-wake"!==d&&"skip-render"!==d;this._hasStarted&&(!this.IsSuspended()||b||e)&&(b=performance.now(),this._isInTick=!0,a||(a=b),this._MeasureDt(a),a=this.Step_BeforePreTick(),this.IsDebugging()&&await a,a=this._dispatcher.dispatchEventAndWait_AsyncOptional(this._eventObjects.pretick),a instanceof Promise&&await a,a=this.Step_AfterPreTick(),this.IsDebugging()&&await a,this._NeedsHandleSaveOrLoad()&&await this._HandleSaveOrLoad(),
  this.GetLayoutManager().IsPendingChangeMainLayout()&&await this._MaybeChangeLayout(),a=this.Step_RunEventsEtc(),this.IsDebugging()&&await a,d&&this.Render(),this.IsSuspended()||e||this._RequestAnimationFrame(),this._tickCount++,this._tickCountNoSave++,this._execCount++,this._isInTick=!1,this._mainThreadTimeCounter+=performance.now()-b)}async Step_BeforePreTick(){const a=this._eventSheetManager,b=this.IsDebug();this.FlushPendingInstances();a.BlockFlushingInstances(!0);this.PushCurrentLayout(this.GetMainRunningLayout());
  b&&g.StartMeasuringTime();this.IsDebugging()?await a.DebugRunScheduledWaits():a.RunScheduledWaits();b&&g.AddEventsTime();this.PopCurrentLayout();a.BlockFlushingInstances(!1);this.FlushPendingInstances();a.BlockFlushingInstances(!0)}async Step_AfterPreTick(){const a=this.IsDebug(),b=this.IsDebugging(),d=this._dispatcher,e=this._eventObjects,f=this._userScriptEventObjects;a&&g.StartMeasuringTime();b?await this.DebugIterateAndBreak(this._DebugBehaviorTick()):this._BehaviorTick();b?await this.DebugIterateAndBreak(this._DebugBehaviorPostTick()):
  this._BehaviorPostTick();a&&g.AddBehaviorTickTime();a&&g.StartMeasuringTime();b?await this.DebugFireGeneratorEventAndBreak(e.tick):d.dispatchEvent(e.tick);a&&g.AddPluginTickTime();this._eventSheetManager.BlockFlushingInstances(!1);this.DispatchUserScriptEvent(f.tick)}async Step_RunEventsEtc(){const a=this._eventSheetManager,b=this._dispatcher,d=this._eventObjects,e=this.IsDebug(),f=this.IsDebugging();e&&g.StartMeasuringTime();f?await a.DebugRunEvents(this._layoutManager):a.RunEvents(this._layoutManager);
  e&&g.AddEventsTime();this._collisionEngine.ClearRegisteredCollisions();if(0<this._instancesToReleaseAtEndOfTick.size){b.SetDelayRemoveEventsEnabled(!0);for(const a of this._instancesToReleaseAffectedObjectClasses)a.GetSolStack().RemoveInstances(this._instancesToReleaseAtEndOfTick);this._instancesToReleaseAffectedObjectClasses.clear();this._eventSheetManager.RemoveInstancesFromScheduledWaits(this._instancesToReleaseAtEndOfTick);for(const a of this._instancesToReleaseAtEndOfTick)a.Release();this._instancesToReleaseAtEndOfTick.clear();
  b.SetDelayRemoveEventsEnabled(!1)}this._isLayoutFirstTick=!1;a.BlockFlushingInstances(!0);e&&g.StartMeasuringTime();f?await this.DebugIterateAndBreak(this._DebugBehaviorTick2()):this._BehaviorTick2();e&&g.AddBehaviorTickTime();e&&g.StartMeasuringTime();f?await this.DebugFireGeneratorEventAndBreak(d.tick2):b.dispatchEvent(d.tick2);e&&g.AddPluginTickTime();a.BlockFlushingInstances(!1);f&&await a.RunQueuedDebugTriggersAsync()}async _MaybeChangeLayout(){const a=this.GetLayoutManager();let b=0;for(;a.IsPendingChangeMainLayout()&&
  10>b++;)await this._DoChangeLayout(a.GetPendingChangeMainLayout())}_MeasureDt(a){if(0!==this._lastTickTime){this._dt1=Math.max(a-this._lastTickTime,0)/1E3;const b=1/this._minimumFramerate;.5<this._dt1?this._dt1=0:this._dt1>b&&(this._dt1=b)}this._lastTickTime=a;this._dt=this._dt1*this._timeScale;this._gameTime.Add(this._dt);this._wallTime.Add(this._dt1);this._canvasManager&&this._canvasManager._UpdateTick();1E3<=a-this._fpsLastTime&&(this._fpsLastTime+=1E3,1E3<=a-this._fpsLastTime&&(this._fpsLastTime=
  a),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()&&g.Update1sPerfStats());this._fpsFrameCount++}async _DoChangeLayout(a){const b=this._dispatcher,d=this.GetLayoutManager().GetMainRunningLayout();await d._StopRunning();d._Unload(a,this.GetWebGLRenderer());d===a&&this._eventSheetManager.ClearAllScheduledWaits();
  this._collisionEngine.ClearRegisteredCollisions();b.dispatchEvent(this._eventObjects.beforelayoutchange);c.Asyncify.SetHighThroughputMode(!0);await a._Load(d,this.GetWebGLRenderer());c.Asyncify.SetHighThroughputMode(!1);await a._StartRunning(!1);b.dispatchEvent(this._eventObjects.layoutchange);this.UpdateRender();this._isLayoutFirstTick=!0;this.FlushPendingInstances()}UpdateRender(){this._needRender=!0}GetWebGLRenderer(){return this._canvasManager?this._canvasManager.GetWebGLRenderer():null}Render(){if(this._canvasManager&&
  !this._canvasManager.IsWebGLContextLost()){var a=this.GetWebGLRenderer();a.Start();a.CheckForQueryResults();if(this._needRender){var b=this.IsDebug();b&&g.StartMeasuringTime();this._needRender=!1;var d=null;a.SupportsGPUProfiling()&&(d=this._canvasManager.GetGPUFrameTimingsBuffer().AddTimeElapsedQuery(),a.StartQuery(d));a.SetTextureFillMode();a.SetAlphaBlend();a.SetColorRgba(1,1,1,1);a.SetRenderTarget(null);a.SetTexture(null);this._layoutManager.GetMainRunningLayout().Draw(a);d&&a.EndQuery(d);a.Finish();
  b&&(g.AddDrawCallsTime(),g.UpdateInspectHighlight());this._canvasManager&&this._canvasManager._MaybeTakeSnapshot()}else a.IncrementFrameNumber()}}Trigger(a,b,d){if(!this._hasStarted)return!1;var e=!this._isInTick&&!this._eventSheetManager.IsInTrigger();let f=0;e&&(f=performance.now());const k=this.IsDebug();k&&this.SetDebuggingEnabled(!1);a=this._eventSheetManager._Trigger(this._layoutManager,a,b,d);e&&(e=performance.now()-f,this._mainThreadTimeCounter+=e,k&&g.AddTriggersTime(e));k&&this.SetDebuggingEnabled(!0);
  return a}DebugTrigger(a,b,d){if(!this.IsDebug())return this.Trigger(a,b,d);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,a,b,d)}async TriggerAsync(a,b,d){if(!this.IsDebugging())return this.Trigger(a,b,d);if(!this._hasStarted)return!1;if(this.HitBreakpoint())return this._eventSheetManager.QueueDebugTrigger(a,
  b,d);if(!this.GetMainRunningLayout())return this._eventSheetManager.QueueTrigger(a,b,d);const e=performance.now();a=this._eventSheetManager._DebugTrigger(this._layoutManager,a,b,d);for(b=a.next();!b.done;)await this.DebugBreak(b.value),b=a.next();this.IsSuspended()||this._eventSheetManager.IsInTrigger()||(await this._eventSheetManager.RunQueuedDebugTriggersAsync(),this._hasStartedTicking&&!this._isInTick&&this._RequestAnimationFrame());this._mainThreadTimeCounter+=performance.now()-e;return b.value}FastTrigger(a,
  b,d){const e=this.IsDebug();e&&this.SetDebuggingEnabled(!1);a=this._eventSheetManager._FastTrigger(this._layoutManager,a,b,d);e&&this.SetDebuggingEnabled(!0);return a}DebugFastTrigger(a,b,d){return this._eventSheetManager._DebugFastTrigger(this._layoutManager,a,b,d)}ScheduleTriggers(a){return this._scheduleTriggersThrottle.Add(a)}PushCurrentLayout(a){this._currentLayoutStack.push(a)}PopCurrentLayout(){if(!this._currentLayoutStack.length)throw Error("layout stack empty");this._currentLayoutStack.pop()}GetCurrentLayout(){return this._currentLayoutStack.length?
  this._currentLayoutStack[this._currentLayoutStack.length-1]:this.GetMainRunningLayout()}GetDt(a){return a&&-1!==a.GetTimeScale()?this._dt1*a.GetTimeScale():this._dt}_GetDtFast(){return this._dt}GetDt1(){return this._dt1}GetTimeScale(){return this._timeScale}SetTimeScale(a){if(isNaN(a)||0>a)a=0;this._timeScale=a}SetMinimumFramerate(a){this._minimumFramerate=c.clamp(a,1,120)}GetMinimumFramerate(){return this._minimumFramerate}GetFPS(){return this._fps}GetMainThreadTime(){return this._mainThreadTime}GetStartTime(){return this._startTime}GetGameTime(){return this._gameTime.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(a){if(this._isLoadingState)throw Error("cannot call while loading state - wait until afterload event");
  return this._instancesByUid.get(a)||null}_RefreshUidMap(){this._instancesByUid.clear();for(const a of this._allObjectClasses)if(!a.IsFamily())for(const b of a.GetInstances())this._instancesByUid.set(b.GetUID(),b)}IsPreview(){return"preview"===this._exportType}IsDebug(){return this._isDebug}GetExportType(){return this._exportType}IsCordova(){return"cordova"===this._exportType}IsAndroidWebView(){return"Android"===c.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()}IsLayoutFirstTick(){return this._isLayoutFirstTick}SetPixelRoundingEnabled(a){a=!!a;this._isPixelRoundingEnabled!==a&&(this._isPixelRoundingEnabled=a,this.UpdateRender())}IsPixelRoundingEnabled(){return this._isPixelRoundingEnabled}SaveToSlot(a){this._saveToSlotName=
  a}LoadFromSlot(a){this._loadFromSlotName=a}LoadFromJsonString(a){this._loadFromJson=a}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()&&
  g.StepIfPausedInDebugger());if(null!==this._loadFromJson){this.FlushPendingInstances();try{await this._DoLoadFromJsonString(this._loadFromJson),this._lastSaveJson=this._loadFromJson,await this.TriggerAsync(c.Plugins.System.Cnds.OnLoadComplete,null),this._lastSaveJson=""}catch(a){console.error("[Construct 3] Failed to load state from JSON string: ",a),await this.TriggerAsync(c.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(a){const b=await this._SaveToJsonString();
  try{await this._GetSavegamesStorage().setItem(a,b),console.log("[Construct 3] Saved state to storage ("+b.length+" chars)"),this._lastSaveJson=b,await this.TriggerAsync(c.Plugins.System.Cnds.OnSaveComplete,null),this._lastSaveJson=""}catch(d){console.error("[Construct 3] Failed to save state to storage: ",d),await this.TriggerAsync(c.Plugins.System.Cnds.OnSaveFailed,null)}}async _DoLoadFromSlot(a){try{const b=await this._GetSavegamesStorage().getItem(a);if(!b)throw Error("empty slot");console.log("[Construct 3] Loaded state from storage ("+
  b.length+" chars)");await this._DoLoadFromJsonString(b);this._lastSaveJson=b;await this.TriggerAsync(c.Plugins.System.Cnds.OnLoadComplete,null);this._lastSaveJson=""}catch(b){console.error("[Construct 3] Failed to load state from storage: ",b),await this.TriggerAsync(c.Plugins.System.Cnds.OnLoadFailed,null)}}async _SaveToJsonString(){const a={c3save:!0,version:1,rt:{time:this.GetGameTime(),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 b of this._allObjectClasses)b.IsFamily()||b.HasNoSaveBehavior()||(a.types[b.GetSID().toString()]=b._SaveToJson());for(const b of this._layoutManager.GetAllLayouts())a.layouts[b.GetSID().toString()]=b._SaveToJson();b=this._CreateUserScriptEvent("save");
  b.saveData=null;await this.DispatchUserScriptEventAsyncWait(b);a.user_script_data=b.saveData;return JSON.stringify(a)}IsLoadingState(){return this._isLoadingState}_TriggerOnCreateAfterLoad(a){c.shallowAssignArray(this._triggerOnCreateAfterLoad,a)}async _DoLoadFromJsonString(a){a=JSON.parse(a);if(a.c2save)throw Error("C2 saves are incompatible with C3 runtime");if(!a.c3save)throw Error("not valid C3 save data");if(1<a.version)throw Error("C3 save data from future version");this._isLoadingState=!0;
  var b=a.rt;this._gameTime.Set(b.time);this._wallTime.Set(b.walltime);this._timeScale=b.timescale;this._tickCount=b.tickcount;this._execCount=b.execcount;this._startTime=Date.now()-b.start_time_offset;var d=b.running_layout;if(d!==this.GetMainRunningLayout().GetSID())if(d=this._layoutManager.GetLayoutBySID(d))await this._DoChangeLayout(d);else return;for(const [b,c]of Object.entries(a.types))d=parseInt(b,10),d=this.GetObjectClassBySID(d),!d||d.IsFamily()||d.HasNoSaveBehavior()||d._LoadFromJson(c);
  this.FlushPendingInstances();this._RefreshUidMap();this._isLoadingState=!1;this._nextUid=b.next_uid;for(const [c,d]of Object.entries(a.layouts))b=parseInt(c,10),(b=this._layoutManager.GetLayoutBySID(b))&&b._LoadFromJson(d);this._eventSheetManager._LoadFromJson(a.events);for(var e of this._triggerOnCreateAfterLoad)e._TriggerOnCreated();c.clearArray(this._triggerOnCreateAfterLoad);for(var f of this._allObjectClasses)if(!f.IsFamily()&&f.IsInContainer())for(const a of f.GetInstances()){e=a.GetIID();for(const c of f.GetContainer().objectTypes())if(c!==
  f){b=c.GetInstances();if(0>e||e>=b.length)throw Error("missing sibling instance");a._AddSibling(b[e])}}this._timelineManager._LoadFromJson(a.timelines);this._dispatcher.dispatchEvent(c.New(c.Event,"afterload"));f=this._CreateUserScriptEvent("load");f.saveData=a.user_script_data;await this.DispatchUserScriptEventAsyncWait(f);this.UpdateRender()}async AddJobWorkerScripts(a){a=(await Promise.all(a.map(a=>this._assetManager.FetchBlob(a)))).map(a=>URL.createObjectURL(a));this._jobScheduler.ImportScriptsToJobWorkers(a)}AddJobWorkerBlob(a,
  b){this._jobScheduler.SendBlobToJobWorkers(a,b)}AddJobWorkerBuffer(a,b){this._jobScheduler.SendBufferToJobWorkers(a,b)}AddJob(a,b,d){return this._jobScheduler.AddJob(a,b,d)}BroadcastJob(a,b,d){return this._jobScheduler.BroadcastJob(a,b,d)}InvokeDownload(a,b){this.PostComponentMessageToDOM("runtime","invoke-download",{url:a,filename:b})}async RasterSvgImage(a,b,d,e,f,k){e=e||b;f=f||d;if(this.IsInWorker())return(await this.PostComponentMessageToDOMAsync("runtime","raster-svg-image",{blob:a,imageWidth:b,
  imageHeight:d,surfaceWidth:e,surfaceHeight:f,imageBitmapOpts:k})).imageBitmap;a=await self.C3_RasterSvgImageBlob(a,b,d,e,f);return k?await self.createImageBitmap(a,k):a}async GetSvgImageSize(a){return this.IsInWorker()?await this.PostComponentMessageToDOMAsync("runtime","get-svg-image-size",{blob:a}):await self.C3_GetSvgImageSize(a)}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(a){this._randomNumberCallback=a}_GetRemotePreviewStatusInfo(){return{fps:this.GetFPS(),cpu:this.GetMainThreadTime(),gpu:this.GetGPUUtilisation(),layout:this.GetMainRunningLayout()?this.GetMainRunningLayout().GetName():"",renderer:this.GetWebGLRenderer().GetUnmaskedRenderer()}}HitBreakpoint(){return this.IsDebug()?g.HitBreakpoint():
  !1}DebugBreak(a){return this.IsDebugging()?g.DebugBreak(a):Promise.resolve()}DebugBreakNext(){return this.IsDebugging()?g.BreakNext():!1}SetDebugBreakpointsEnabled(a){this._breakpointsEnabled=!!a;this._UpdateDebuggingFlag()}AreDebugBreakpointsEnabled(){return this._breakpointsEnabled}IsDebugging(){return this._isDebugging}SetDebuggingEnabled(a){a?this._debuggingDisabled--:this._debuggingDisabled++;this._UpdateDebuggingFlag()}_UpdateDebuggingFlag(){this._isDebugging=this.IsDebug()&&this._breakpointsEnabled&&
  0===this._debuggingDisabled}IsCPUProfiling(){return this.IsDebug()&&g.IsCPUProfiling()}IsGPUProfiling(){return this.IsDebug()&&this.GetWebGLRenderer().SupportsGPUProfiling()&&g.IsGPUProfiling()}async DebugIterateAndBreak(a){if(a)for(const b of a)await this.DebugBreak(b)}DebugFireGeneratorEventAndBreak(a){return this.DebugIterateAndBreak(this._dispatcher.dispatchGeneratorEvent(a))}_InvokeFunctionFromJS(a){return this._eventSheetManager._InvokeFunctionFromJS(a.name,a.params)}GetIRuntime(){return this._iRuntime}_CreateUserScriptEvent(a){a=
  c.New(c.Event,a,!1);a.runtime=this._iRuntime;return a}_InitScriptInterfaces(){var a={};for(const b of this._allObjectClasses)a[b.GetJsPropName()]={value:b.GetIObjectClass(),enumerable:!0,writable:!1};a=Object.create(Object.prototype,a);this._iRuntime=new self.IRuntime(this,a);this._userScriptEventObjects={tick:this._CreateUserScriptEvent("tick")}}_InitGlobalVariableScriptInterface(){const a={};for(const b of this.GetEventSheetManager().GetAllGlobalVariables())a[b.GetJsPropName()]=b._GetScriptInterfaceDescriptor();
  this._iRuntime._InitGlobalVars(a)}_GetCommonScriptInterfaces(){return this._commonScriptInterfaces}_MapScriptInterface(a,b){this._interfaceMap.set(a,b)}_UnwrapScriptInterface(a){return this._interfaceMap.get(a)}};self.C3_CreateRuntime=c.Runtime.Create;self.C3_InitRuntime=(a,b)=>a.Init(b)};
  
  
  // c3/workers/jobSchedulerRuntime.js
  'use strict';{const f=self.C3;f.JobSchedulerRuntime=class extends f.DefendedBase{constructor(a,b){super();this._runtime=a;this._jobPromises=new Map;this._nextJobId=0;this._inputPort=b.inputPort;b.outputPort.onmessage=a=>this._OnJobWorkerMessage(a);this._maxNumWorkers=b.maxNumWorkers;this._jobWorkerCount=1;this._isBroken=this._hadErrorCreatingWorker=this._isCreatingWorker=!1;this._testOkResolve=null}async Init(){await this._TestMessageChannelWorks()}ImportScriptsToJobWorkers(a){this._isBroken||this._inputPort.postMessage({type:"_import_scripts",
  scripts:a})}SendBlobToJobWorkers(a,b){this._isBroken||this._inputPort.postMessage({type:"_send_blob",blob:a,id:b})}SendBufferToJobWorkers(a,b){this._isBroken||this._inputPort.postMessage({type:"_send_buffer",buffer:a,id:b},[a])}AddJob(a,b,c,d,g){if(this._isBroken)return Promise.reject("messagechannels broken");c||(c=[]);const e=this._nextJobId++;a={type:a,isBroadcast:!1,jobId:e,params:b,transferables:c};b=new Promise((a,b)=>{this._jobPromises.set(e,{resolve:a,progress:d,reject:b,cancelled:!1})});
  g&&g.SetAction(()=>this._CancelJob(e));this._inputPort.postMessage(a,c);this._MaybeCreateExtraWorker();return b}BroadcastJob(a,b,c){if(!this._isBroken){c||(c=[]);var d=this._nextJobId++;this._inputPort.postMessage({type:a,isBroadcast:!0,jobId:d,params:b,transferables:c},c)}}_CancelJob(a){const b=this._jobPromises.get(a);b&&(b.cancelled=!0,b.resolve=null,b.progress=null,b.reject=null,this._inputPort.postMessage({type:"_cancel",jobId:a}))}_OnJobWorkerMessage(a){a=a.data;const b=a.type,c=a.jobId;switch(b){case "result":this._OnJobResult(c,
  a.result);break;case "progress":this._OnJobProgress(c,a.progress);break;case "error":this._OnJobError(c,a.error);break;case "ready":this._OnJobWorkerReady();break;case "_testMessageChannelOk":this._OnTestMessageChannelOk();break;default:throw Error(`unknown message from worker '${b}'`);}}_OnJobResult(a,b){const c=this._jobPromises.get(a);if(!c)throw Error("invalid job ID");c.cancelled||c.resolve(b);this._jobPromises.delete(a)}_OnJobProgress(a,b){a=this._jobPromises.get(a);if(!a)throw Error("invalid job ID");
  !a.cancelled&&a.progress&&a.progress(b)}_OnJobError(a,b){const c=this._jobPromises.get(a);if(!c)throw Error("invalid job ID");c.cancelled||c.reject(b);this._jobPromises.delete(a)}_OnJobWorkerReady(){this._isCreatingWorker&&(this._isCreatingWorker=!1,this._jobWorkerCount++,this._jobWorkerCount<this._maxNumWorkers?this._MaybeCreateExtraWorker():this._inputPort.postMessage({type:"_no_more_workers"}))}async _MaybeCreateExtraWorker(){if(!(this._jobWorkerCount>=this._maxNumWorkers||this._isCreatingWorker||
  this._hadErrorCreatingWorker||this._jobPromises.size<=this._jobWorkerCount))try{this._isCreatingWorker=!0,(await this._runtime.PostComponentMessageToDOMAsync("runtime","create-job-worker")).outputPort.onmessage=a=>this._OnJobWorkerMessage(a)}catch(a){this._hadErrorCreatingWorker=!0,this._isCreatingWorker=!1,console.error(`[Construct 3] Failed to create job worker; stopping creating any more (created ${this._jobWorkerCount} so far)`,a)}}_TestMessageChannelWorks(){this._inputPort.postMessage({type:"_testMessageChannel"});
  self.setTimeout(()=>this._CheckMessageChannelTestTimedOut(),2E3);return new Promise(a=>this._testOkResolve=a)}_OnTestMessageChannelOk(){this._testOkResolve();this._testOkResolve=null}_CheckMessageChannelTestTimedOut(){this._testOkResolve&&(console.warn("MessageChannel determined to be broken. Job scheduler disabled."),this._isBroken=!0,this._testOkResolve(),this._testOkResolve=null)}}};
  
  
  self["C3_Shaders"] = {};
  
  
  'use strict';{var ForEachOrdered_SortInstances=function(a,b){a=a[1];b=b[1];if("number"===typeof a&&"number"===typeof b)return a-b;a=""+a;b=""+b;return a<b?-1:a>b?1:0};const q=self.C3;let w=null,y="",z="",x=[],A="",B="",C="";const t=q.New(q.ArrayStack);q.Plugins.System=class extends q.SDKPluginBase{constructor(a){super(a);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(a){this._runtime.Trigger(a,null,null)}GetRegex(a,b){w&&a===y&&b===z||(w=new RegExp(a,b),y=a,z=b);w.lastIndex=0;return w}GetRegexMatches(a,b,c){if(a===A&&b===B&&c===C)return x;const d=this.GetRegex(b,c);x=a.match(d);A=a;B=b;C=c;return x}async _LoadTexturesForObjectClasses(a,b){if(b.length){this._imagesLoadingTotal+=b.length;var c=[];for(const d of b)c.push(a.MaybeLoadTexturesFor(d));await q.PromiseAllWithProgress(c,
  ()=>{this._imagesLoadingComplete++});this._imagesLoadingComplete++;this._imagesLoadingComplete===this._imagesLoadingTotal&&(this._runtime.Trigger(q.Plugins.System.Cnds.OnImageLoadingComplete,null,null),this._imagesLoadingTotal=this._imagesLoadingComplete=0)}}_UnloadTexturesForObjectClasses(a,b){for(const c of b)0===c.GetInstanceCount()&&a.MaybeUnloadTexturesFor(c)}_GetForEachStack(){return t}_Repeat(a){var b=this._runtime.GetEventSheetManager();const c=b.GetEventStack(),d=c.GetCurrentStackFrame(),
  f=d.GetCurrentEvent(),g=f.GetSolModifiers();var e=d.IsSolModifierAfterCnds();const m=c.Push(f),l=b.GetLoopStack(),k=l.Push();k.SetEnd(a);if(e)for(e=0;e<a&&!k.IsStopped();++e)b.PushCopySol(g),k.SetIndex(e),f.Retrigger(d,m),b.PopSol(g);else for(b=0;b<a&&!k.IsStopped();++b)k.SetIndex(b),f.Retrigger(d,m);c.Pop();l.Pop();return!1}*_DebugRepeat(a){var b=this._runtime.GetEventSheetManager();const c=b.GetEventStack(),d=c.GetCurrentStackFrame(),f=d.GetCurrentEvent(),g=f.GetSolModifiers();var e=d.IsSolModifierAfterCnds();
  const m=c.Push(f),l=b.GetLoopStack(),k=l.Push();k.SetEnd(a);if(e)for(e=0;e<a&&!k.IsStopped();++e)b.PushCopySol(g),k.SetIndex(e),yield*f.DebugRetrigger(d,m),b.PopSol(g);else for(b=0;b<a&&!k.IsStopped();++b)k.SetIndex(b),yield*f.DebugRetrigger(d,m);c.Pop();l.Pop();return!1}_While(){var a=this._runtime.GetEventSheetManager();const b=a.GetEventStack(),c=b.GetCurrentStackFrame(),d=c.GetCurrentEvent(),f=d.GetSolModifiers();var g=c.IsSolModifierAfterCnds();const e=b.Push(d),m=a.GetLoopStack(),l=m.Push();
  if(g)for(g=0;!l.IsStopped();++g)a.PushCopySol(f),l.SetIndex(g),d.Retrigger(c,e)||l.Stop(),a.PopSol(f);else for(a=0;!l.IsStopped();++a)l.SetIndex(a),d.Retrigger(c,e)||l.Stop();b.Pop();m.Pop();return!1}*_DebugWhile(){var a=this._runtime.GetEventSheetManager();const b=a.GetEventStack(),c=b.GetCurrentStackFrame(),d=c.GetCurrentEvent(),f=d.GetSolModifiers();var g=c.IsSolModifierAfterCnds();const e=b.Push(d),m=a.GetLoopStack(),l=m.Push();if(g)for(g=0;!l.IsStopped();++g)a.PushCopySol(f),l.SetIndex(g),(yield*d.DebugRetrigger(c,
  e))||l.Stop(),a.PopSol(f);else for(a=0;!l.IsStopped();++a)l.SetIndex(a),(yield*d.DebugRetrigger(c,e))||l.Stop();b.Pop();m.Pop();return!1}_For(a,b,c){var d=this._runtime.GetEventSheetManager();const f=d.GetEventStack(),g=f.GetCurrentStackFrame(),e=g.GetCurrentEvent(),m=e.GetSolModifiers(),l=g.IsSolModifierAfterCnds(),k=f.Push(e),r=d.GetLoopStack(),h=r.Push();h.SetName(a);h.SetEnd(c);if(c<b)if(l)for(a=b;a>=c&&!h.IsStopped();--a)d.PushCopySol(m),h.SetIndex(a),e.Retrigger(g,k),d.PopSol(m);else for(d=
  b;d>=c&&!h.IsStopped();--d)h.SetIndex(d),e.Retrigger(g,k);else if(l)for(a=b;a<=c&&!h.IsStopped();++a)d.PushCopySol(m),h.SetIndex(a),e.Retrigger(g,k),d.PopSol(m);else for(d=b;d<=c&&!h.IsStopped();++d)h.SetIndex(d),e.Retrigger(g,k);f.Pop();r.Pop();return!1}*_DebugFor(a,b,c){var d=this._runtime.GetEventSheetManager();const f=d.GetEventStack(),g=f.GetCurrentStackFrame(),e=g.GetCurrentEvent(),m=e.GetSolModifiers(),l=g.IsSolModifierAfterCnds(),k=f.Push(e),r=d.GetLoopStack(),h=r.Push();h.SetName(a);h.SetEnd(c);
  if(c<b)if(l)for(a=b;a>=c&&!h.IsStopped();--a)d.PushCopySol(m),h.SetIndex(a),yield*e.DebugRetrigger(g,k),d.PopSol(m);else for(d=b;d>=c&&!h.IsStopped();--d)h.SetIndex(d),yield*e.DebugRetrigger(g,k);else if(l)for(a=b;a<=c&&!h.IsStopped();++a)d.PushCopySol(m),h.SetIndex(a),yield*e.DebugRetrigger(g,k),d.PopSol(m);else for(d=b;d<=c&&!h.IsStopped();++d)h.SetIndex(d),yield*e.DebugRetrigger(g,k);f.Pop();r.Pop();return!1}_ForEach(a){var b=this._runtime.GetEventSheetManager();const c=b.GetEventStack(),d=c.GetCurrentStackFrame(),
  f=d.GetCurrentEvent(),g=f.GetSolModifiers();var e=d.IsSolModifierAfterCnds();const m=c.Push(f),l=b.GetLoopStack(),k=l.Push(),r=a.IsInContainer(),h=a.GetCurrentSol(),n=t.Push();q.shallowAssignArray(n,h.GetInstances());k.SetEnd(n.length);if(e)for(let c=0,h=n.length;c<h&&!k.IsStopped();++c)b.PushCopySol(g),e=n[c],a.GetCurrentSol().SetSinglePicked(e),r&&e.SetSiblingsSinglePicked(),k.SetIndex(c),f.Retrigger(d,m),b.PopSol(g);else{h._SetSelectAll(!1);a=h._GetOwnInstances();q.clearArray(a);a.push(null);for(let c=
  0,e=n.length;c<e&&!k.IsStopped();++c)b=n[c],a[0]=b,r&&b.SetSiblingsSinglePicked(),k.SetIndex(c),f.Retrigger(d,m)}c.Pop();l.Pop();q.clearArray(n);t.Pop();return!1}*_DebugForEach(a){var b=this._runtime.GetEventSheetManager();const c=b.GetEventStack(),d=c.GetCurrentStackFrame(),f=d.GetCurrentEvent(),g=f.GetSolModifiers();var e=d.IsSolModifierAfterCnds();const m=c.Push(f),l=b.GetLoopStack(),k=l.Push(),r=a.IsInContainer(),h=a.GetCurrentSol(),n=t.Push();q.shallowAssignArray(n,h.GetInstances());k.SetEnd(n.length);
  if(e)for(let c=0,h=n.length;c<h&&!k.IsStopped();++c)b.PushCopySol(g),e=n[c],a.GetCurrentSol().SetSinglePicked(e),r&&e.SetSiblingsSinglePicked(),k.SetIndex(c),yield*f.DebugRetrigger(d,m),b.PopSol(g);else{h._SetSelectAll(!1);a=h._GetOwnInstances();q.clearArray(a);a.push(null);for(let c=0,e=n.length;c<e&&!k.IsStopped();++c)b=n[c],a[0]=b,r&&b.SetSiblingsSinglePicked(),k.SetIndex(c),yield*f.DebugRetrigger(d,m)}c.Pop();l.Pop();q.clearArray(n);t.Pop();return!1}_ForEachOrdered(a,b){var c=this._runtime.GetEventSheetManager();
  const d=c.GetEventStack(),f=c.GetCurrentCondition(),g=d.GetCurrentStackFrame(),e=g.GetCurrentEvent(),m=e.GetSolModifiers(),l=g.IsSolModifierAfterCnds(),k=d.Push(e),r=c.GetLoopStack(),h=r.Push(),n=a.IsInContainer(),u=a.GetCurrentSol(),p=t.Push();q.clearArray(p);const v=u.GetInstances();h.SetEnd(v.length);for(let a=0,c=v.length;a<c;++a)p.push([v[a],f.ReevaluateParameter(1,a)]);p.sort(ForEachOrdered_SortInstances);1===b&&p.reverse();if(l)for(let d=0,f=p.length;d<f&&!h.IsStopped();++d)c.PushCopySol(m),
  b=p[d][0],a.GetCurrentSol().SetSinglePicked(b),n&&b.SetSiblingsSinglePicked(),h.SetIndex(d),e.Retrigger(g,k),c.PopSol(m);else{u._SetSelectAll(!1);a=u._GetOwnInstances();q.clearArray(a);a.push(null);for(let b=0,d=p.length;b<d&&!h.IsStopped();++b)c=p[b][0],a[0]=c,n&&c.SetSiblingsSinglePicked(),h.SetIndex(b),e.Retrigger(g,k)}d.Pop();r.Pop();q.clearArray(p);t.Pop();return!1}*_DebugForEachOrdered(a,b){var c=this._runtime.GetEventSheetManager();const d=c.GetEventStack(),f=c.GetCurrentCondition(),g=d.GetCurrentStackFrame(),
  e=g.GetCurrentEvent(),m=e.GetSolModifiers(),l=g.IsSolModifierAfterCnds(),k=d.Push(e),r=c.GetLoopStack(),h=r.Push(),n=a.IsInContainer(),u=a.GetCurrentSol(),p=t.Push();q.clearArray(p);const v=u.GetInstances();h.SetEnd(v.length);for(let a=0,c=v.length;a<c;++a)p.push([v[a],f.ReevaluateParameter(1,a)]);p.sort(ForEachOrdered_SortInstances);1===b&&p.reverse();if(l)for(let d=0,f=p.length;d<f&&!h.IsStopped();++d)c.PushCopySol(m),b=p[d][0],a.GetCurrentSol().SetSinglePicked(b),n&&b.SetSiblingsSinglePicked(),
  h.SetIndex(d),yield*e.DebugRetrigger(g,k),c.PopSol(m);else{u._SetSelectAll(!1);a=u._GetOwnInstances();q.clearArray(a);a.push(null);for(let b=0,d=p.length;b<d&&!h.IsStopped();++b)c=p[b][0],a[0]=c,n&&c.SetSiblingsSinglePicked(),h.SetIndex(b),yield*e.DebugRetrigger(g,k)}d.Pop();r.Pop();q.clearArray(p);t.Pop();return!1}_GetFunctionMap(a,b){let c=this._functionMaps.get(a);if(c)return c;if(!b)return null;c={defaultFunc:null,strMap:new Map};this._functionMaps.set(a,c);return c}_DoCallMappedFunction(a,b,
  c,d,f){b.GetEventBlock().RunAsMappedFunctionCall(c);d&&a.PopSol(f)}*_DebugDoCallMappedFunction(a,b,c,d,f){yield*b.GetEventBlock().DebugRunAsMappedFunctionCall(c);d&&a.PopSol(f)}}};
  
  
  'use strict';{const b=self.C3;b.Plugins.System.Type=class extends b.DefendedBase{constructor(a){super();this._objectClass=a;this._runtime=a.GetRuntime();this._plugin=a.GetPlugin()}OnCreate(){}Release(){this._plugin=this._runtime=this._objectClass=null}}};
  
  
  'use strict';{const a=self.C3;a.Plugins.System.Instance=class extends a.DefendedBase{constructor(b,c){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 d=self.C3,k=[];d.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 b=a.get("TriggerOnce_lastTick");"undefined"===typeof b&&(b=-1,a.set("TriggerOnce_lastTick",
  -1));const c=this._runtime.GetTickCount();a.set("TriggerOnce_lastTick",c);return this._runtime.IsLayoutFirstTick()||b!==c-1},Every(a){const b=this._runtime.GetCurrentCondition().GetSavedDataMap(),c=b.get("Every_lastTime")||0,e=this._runtime.GetGameTime();b.has("Every_seconds")||b.set("Every_seconds",a);const f=b.get("Every_seconds");if(e>=c+f)return b.set("Every_lastTime",c+f),e>=b.get("Every_lastTime")+.04&&b.set("Every_lastTime",e),b.set("Every_seconds",a),!0;e<c-.1&&b.set("Every_lastTime",e);return!1},
  IsGroupActive(a){return(a=this._runtime.GetEventSheetManager().GetEventGroupByName(a))&&a.IsGroupActive()},IsPreview(){return this._runtime.IsPreview()},IsMobile(){return d.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"===d.Platform.Context;
  case 1:return"iOS"===d.Platform.OS;case 2:return"Android"===d.Platform.OS;case 8:return"cordova"===d.Platform.Context;case 9:return"scirra-arcade"===this._runtime.GetExportType();case 10:return"nwjs"===d.Platform.Context;case 13:return"windows-uwp"===this._runtime.GetExportType();default:return!1}},RegexTest(a,b,c){return this.GetRegex(b,c).test(a)},Compare(a,b,c){return d.compare(a,b,c)},CompareBetween(a,b,c){return a>=b&&a<=c},CompareVar(a,b,c){return d.compare(a.GetValue(),b,c)},CompareBoolVar(a){return!!a.GetValue()},
  CompareTime(a,b){const c=this._runtime.GetGameTime();return 0===a?(a=this._runtime.GetCurrentCondition().GetSavedDataMap(),!a.get("CompareTime_executed")&&c>=b?(a.set("CompareTime_executed",!0),!0):!1):d.compare(c,a,b)},IsNaN(a){return isNaN(a)},AngleWithin(a,b,c){return d.angleDiff(d.toRadians(a),d.toRadians(c))<=d.toRadians(b)},IsClockwiseFrom(a,b){return d.angleClockwise(d.toRadians(a),d.toRadians(b))},IsBetweenAngles(a,b,c){a=d.toRadians(a);b=d.toRadians(b);c=d.toRadians(c);return d.angleClockwise(c,
  b)?d.angleClockwise(a,b)&&!d.angleClockwise(a,c):!(!d.angleClockwise(a,b)&&d.angleClockwise(a,c))},IsValueType(a,b){return"number"===typeof a?0===b:1===b},PickByComparison(a,b,c,e){if(!a)return!1;const f=this._GetForEachStack(),g=f.Push(),h=a.GetCurrentSol();d.shallowAssignArray(g,h.GetInstances());h.IsSelectAll()&&d.clearArray(h._GetOwnElseInstances());const m=this._runtime.GetCurrentCondition();let l=0;for(let a=0,f=g.length;a<f;++a){const f=g[a];g[l]=f;b=m.ReevaluateParameter(1,a);e=m.ReevaluateParameter(3,
  a);d.compare(b,c,e)?++l:h._PushElseInstance(f)}d.truncateArray(g,l);h.SetArrayPicked(g);b=!!g.length;d.clearArray(g);f.Pop();a.ApplySolToContainer();return b},PickByEvaluate(a,b){if(!a)return!1;const c=this._GetForEachStack(),e=c.Push(),f=a.GetCurrentSol();d.shallowAssignArray(e,f.GetInstances());f.IsSelectAll()&&d.clearArray(f._GetOwnElseInstances());const g=this._runtime.GetCurrentCondition();let h=0;for(let a=0,c=e.length;a<c;++a){const c=e[a];e[h]=c;(b=g.ReevaluateParameter(1,a))?++h:f._PushElseInstance(c)}d.truncateArray(e,
  h);f.SetArrayPicked(e);b=!!e.length;d.clearArray(e);c.Pop();a.ApplySolToContainer();return b},PickNth(a,b){if(!a)return!1;const c=a.GetCurrentSol(),e=c.GetInstances();b=Math.floor(b);if(b>=e.length)return!1;c.PickOne(e[b]);a.ApplySolToContainer();return!0},PickRandom(a){if(!a)return!1;const b=a.GetCurrentSol(),c=b.GetInstances(),e=Math.floor(this._runtime.Random()*c.length);if(e>=c.length)return!1;b.PickOne(c[e]);a.ApplySolToContainer();return!0},PickAll(a){if(!a||!a.GetInstanceCount())return!1;a.GetCurrentSol()._SetSelectAll(!0);
  a.ApplySolToContainer();return!0},PickOverlappingPoint(a,b,c){if(!a)return!1;const e=a.GetCurrentSol();var f=e.GetInstances();const g=this._runtime.GetCurrentEvent().IsOrBlock(),h=this._runtime.GetCurrentCondition().IsInverted();e.IsSelectAll()?(d.shallowAssignArray(k,f),e.ClearArrays(),e._SetSelectAll(!1)):g?(d.shallowAssignArray(k,e._GetOwnElseInstances()),d.clearArray(e._GetOwnElseInstances())):(d.shallowAssignArray(k,e._GetOwnInstances()),d.clearArray(e._GetOwnInstances()));for(let a=0,g=k.length;a<
  g;++a)f=k[a],d.xor(f.GetWorldInfo().ContainsPoint(b,c),h)?e._PushInstance(f):e._PushElseInstance(f);a.ApplySolToContainer();return d.xor(!!e._GetOwnInstances().length,h)},PickLastCreated(a){if(!a)return!1;var b=a.IsFamily();let c=null;const e=this._runtime._GetInstancesPendingCreate();for(let d=e.length-1;0<=d;--d){const f=e[d];if(b){if(f.GetObjectClass().BelongsToFamily(a)){c=f;break}}else if(f.GetObjectClass()===a){c=f;break}}c||(b=a.GetInstances(),b.length&&(c=b[b.length-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,b,c){return this._runtime.IsDebugging()?this._DebugFor(a,b,c):this._For(a,b,c)},ForEach(a){return this._runtime.IsDebugging()?this._DebugForEach(a):this._ForEach(a)},ForEachOrdered(a,b,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,b,c){return a?d.compare(100*a.GetOpacity(),b,c):!1},OnImageLoadingComplete(){return!0},IsLoadingImages(){return 0<this._imagesLoadingTotal}}};
  
  
  'use strict';{var SortInstancesByValue=function(a,b){return a[1]-b[1]},SortZOrderList=function(a,b){const c=a[0]-b[0];return 0!==c?c:a[1]-b[1]};const f=self.C3,k=[],n=[],h=f.New(f.Color);f.Plugins.System.Acts={SetVar(a,b){a.SetValue(b)},AddVar(a,b){a.IsNumber()&&"number"!==typeof b&&(b=parseFloat(b));a.SetValue(a.GetValue()+b)},SubVar(a,b){a.IsNumber()&&a.SetValue(a.GetValue()-b)},SetBoolVar(a,b){a.SetValue(!!b)},ToggleBoolVar(a){a.SetValue(!a.GetValue())},ResetGlobals(){this._runtime.GetEventSheetManager().ResetAllGlobalsToInitialValue()},
  CreateObject(a,b,c,d){if(a&&b&&(b=this._runtime.CreateInstance(a,b,c,d))){c=this._runtime.GetEventSheetManager();c.BlockFlushingInstances(!0);b._TriggerOnCreated();if(b.IsInContainer())for(const a of b.siblings())a._TriggerOnCreated();c.BlockFlushingInstances(!1);a.GetCurrentSol().SetSinglePicked(b);b.IsInContainer()&&b.SetSiblingsSinglePicked()}},CreateObjectByName(a,b,c,d){a&&b&&(a=this._runtime.GetObjectClassByName(a))&&f.Plugins.System.Acts.CreateObject.call(this,a,b,c,d)},RecreateInitialObjects(a,
  b,c,d,e){a&&this._runtime.GetCurrentLayout().RecreateInitialObjects(a,b,c,d,e)},StopLoop(){const a=this._loopStack;a.IsInLoop()&&a.GetCurrent().Stop()},SetGroupActive(a,b){(a=this._runtime.GetEventSheetManager().GetEventGroupByName(a))&&(0===b?a.SetGroupActive(!1):1===b?a.SetGroupActive(!0):a.SetGroupActive(!a.IsGroupActive()))},SetTimescale(a){this._runtime.SetTimeScale(a)},SetObjectTimescale(a,b){0>b&&(b=0);if(a){a=a.GetCurrentSol().GetInstances();for(const c of a)c.SetTimeScale(b)}},RestoreObjectTimescale(a){if(a){a=
  a.GetCurrentSol().GetInstances();for(const b of a)b.RestoreTimeScale()}},Wait(a){if(!(0>a))return this._runtime.GetEventSheetManager().AddScheduledWait().InitTimer(a),!0},WaitForSignal(a){this._runtime.GetEventSheetManager().AddScheduledWait().InitSignal(a);return!0},WaitForPreviousActions(){const a=this._runtime.GetEventSheetManager();a.AddScheduledWait().InitPromise(a.GetPromiseForAllAsyncActions());return!0},Signal(a){a=a.toLowerCase();for(const b of this._runtime.GetEventSheetManager().scheduledWaits())b.IsSignal()&&
  b.GetSignalTag()===a&&b.SetSignalled()},async SnapshotCanvas(a,b){const c=this._runtime.GetCanvasManager();c&&(this.UpdateRender(),await c.SnapshotCanvas(0===a?"image/png":"image/jpeg",b/100),await this._runtime.TriggerAsync(f.Plugins.System.Cnds.OnCanvasSnapshot,null))},SetCanvasSize(a,b){if(!(0>=a||0>=b)){this._runtime.SetViewportSize(a,b);var c=this._runtime.GetCurrentLayout();c.BoundScrolling();for(const a of c.GetLayers())a.UpdateViewport();if(c=this._runtime.GetCanvasManager())"off"!==c.GetCurrentFullscreenMode()&&
  this._runtime.SetOriginalViewportSize(a,b),c.SetSize(c.GetLastWidth(),c.GetLastHeight(),!0),this._runtime.UpdateRender()}},SetFullscreenQuality(a){const b=this._runtime.GetCanvasManager();b&&"off"!==b.GetCurrentFullscreenMode()&&(b.SetFullscreenScalingQuality(0!==a?"high":"low"),b.SetSize(b.GetLastWidth(),b.GetLastHeight(),!0))},SaveState(a){this._runtime.SaveToSlot(a)},LoadState(a){this._runtime.LoadFromSlot(a)},LoadStateJSON(a){this._runtime.LoadFromJsonString(a)},SetHalfFramerateMode(a){},ResetPersisted(){for(const a of this._runtime.GetLayoutManager().GetAllLayouts())a.ResetPersistData()},
  SetPixelRounding(a){this._runtime.SetPixelRoundingEnabled(0!==a)},SetMinimumFramerate(a){this._runtime.SetMinimumFramerate(a)},SortZOrderByInstVar(a,b){if(a){var c=a.GetCurrentSol().GetInstances(),d=this._runtime.GetCurrentLayout(),e=a.IsFamily();a=a.GetFamilyIndex();for(let d=0,f=c.length;d<f;++d){var g=c[d];const f=g.GetWorldInfo();if(!f)continue;let l;l=e?g.GetInstanceVariableValue(b+g.GetObjectClass().GetFamilyInstanceVariableOffset(a)):g.GetInstanceVariableValue(b);k.push([f.GetLayer().GetIndex(),
  f.GetZIndex()]);n.push([g,l])}if(k.length){k.sort(SortZOrderList);n.sort(SortInstancesByValue);b=!1;for(let f=0,h=k.length;f<h;++f)c=n[f][0],e=d.GetLayerByIndex(k[f][0]),a=k[f][1],g=e._GetInstances(),g[a]!==c&&(g[a]=c,c.GetWorldInfo()._SetLayer(e),e.SetZIndicesChanged(),b=!0);b&&this._runtime.UpdateRender();f.clearArray(k);f.clearArray(n)}}},GoToLayout(a){if(!this._runtime.IsLoading()){var b=this._runtime.GetLayoutManager();b.IsPendingChangeMainLayout()||b.ChangeMainLayout(a)}},GoToLayoutByName(a){if(!this._runtime.IsLoading()){var b=
  this._runtime.GetLayoutManager();b.IsPendingChangeMainLayout()||(a=b.GetLayoutByName(a))&&b.ChangeMainLayout(a)}},NextPrevLayout(a){if(!this._runtime.IsLoading()){var b=this._runtime.GetLayoutManager();if(!b.IsPendingChangeMainLayout()){var c=b.GetAllLayouts(),d=c.indexOf(b.GetMainRunningLayout());a&&0===d||(a||d!==c.length-1)&&b.ChangeMainLayout(c[d+(a?-1:1)])}}},RestartLayout(){if(!this._runtime.IsLoading()){var a=this._runtime.GetLayoutManager();a.IsPendingChangeMainLayout()||(a.ChangeMainLayout(a.GetMainRunningLayout()),
  this._runtime.GetEventSheetManager().ResetAllGroupsInitialActivation())}},SetLayerVisible(a,b){a&&a.SetVisible(b)},SetLayerOpacity(a,b){a&&a.SetOpacity(b/100)},SetLayerScale(a,b){a&&a.SetOwnScale(b)},SetLayerScaleRate(a,b){a&&a.SetScaleRate(b)},SetLayerAngle(a,b){a&&(b=f.clampAngle(f.toRadians(+b)),a.GetOwnAngle()!==b&&(a.SetAngle(b),this.UpdateRender()))},SetLayerParallax(a,b,c){a&&a.SetParallax(b/100,c/100)},SetLayerZElevation(a,b){a&&a.SetZElevation(b)},SetLayerBackground(a,b){a&&(h.setFromRgbValue(b),
  h.clamp(),a=a.GetBackgroundColor(),a.equalsIgnoringAlpha(h)||(a.copyRgb(h),this.UpdateRender()))},SetLayerTransparent(a,b){a&&(b=!!b,a.IsTransparent()!==b&&(a.SetTransparent(b),this.UpdateRender()))},SetLayerBlendMode(a,b){a&&a.GetBlendMode()!==b&&(a.SetBlendMode(b),this.UpdateRender())},SetLayerEffectEnabled(a,b,c){a&&(a=a.GetEffectList(),c=a.GetEffectTypeByName(c))&&(b=1===b,c.IsActive()!==b&&(c.SetActive(b),a.UpdateActiveEffects(),this._runtime.UpdateRender()))},SetLayerEffectParam(a,b,c,d){if(a&&
  (a=a.GetEffectList(),b=a.GetEffectTypeByName(b))){var e=b.GetIndex();a=a.GetEffectParametersForIndex(e);c=Math.floor(c);if(!(0>c||c>=a.length)){e=b.GetShaderProgram().GetParameterType(c);if("color"===e){h.setFromRgbValue(d);c=a[c];if(h.equalsIgnoringAlpha(c))return;c.copyRgb(h)}else{"percent"===e&&(d/=100);if(a[c]===d)return;a[c]=d}b.IsActive()&&this._runtime.UpdateRender()}}},SetLayerForceOwnTexture(a,b){a&&(b=!!b,a.IsForceOwnTexture()!==b&&(a.SetForceOwnTexture(b),this.UpdateRender()))},SetLayoutScale(a){const b=
  this._runtime.GetCurrentLayout();b.GetScale()!==a&&(b.SetScale(a),this.UpdateRender())},SetLayoutAngle(a){a=f.clampAngle(f.toRadians(+a));const b=this._runtime.GetCurrentLayout();b.GetAngle()!==a&&(b.SetAngle(a),this.UpdateRender())},SetLayoutEffectEnabled(a,b){const c=this._runtime.GetCurrentLayout().GetEffectList();if(b=c.GetEffectTypeByName(b))a=1===a,b.IsActive()!==a&&(b.SetActive(a),c.UpdateActiveEffects(),this._runtime.UpdateRender())},SetLayoutEffectParam(a,b,c){var d=this._runtime.GetCurrentLayout().GetEffectList();
  if(a=d.GetEffectTypeByName(a)){var e=a.GetIndex();d=d.GetEffectParametersForIndex(e);b=Math.floor(b);if(!(0>b||b>=d.length)){e=a.GetShaderProgram().GetParameterType(b);if("color"===e){h.setFromRgbValue(c);b=d[b];if(h.equalsIgnoringAlpha(b))return;b.copyRgb(h)}else{"percent"===e&&(c/=100);if(d[b]===c)return;d[b]=c}a.IsActive()&&this._runtime.UpdateRender()}}},ScrollX(a){this._runtime.GetCurrentLayout().SetScrollX(a)},ScrollY(a){this._runtime.GetCurrentLayout().SetScrollY(a)},Scroll(a,b){const c=this._runtime.GetCurrentLayout();
  c.SetScrollX(a);c.SetScrollY(b)},ScrollToObject(a){if(a&&(a=a.GetFirstPicked())&&(a=a.GetWorldInfo())){var b=this._runtime.GetCurrentLayout();b.SetScrollX(a.GetX());b.SetScrollY(a.GetY())}},async LoadObjectTextures(a){const b=this._runtime.GetMainRunningLayout();b&&a&&!this._runtime.IsLoading()&&(a=a.IsFamily()?a.GetFamilyMembers():[a],await this._LoadTexturesForObjectClasses(b,a))},async LoadObjectTexturesByName(a){await f.Plugins.System.Acts.LoadObjectTextures.call(this,this._runtime.GetObjectClassByName(a))},
  UnloadObjectTextures(a){const b=this._runtime.GetMainRunningLayout();b&&a&&(a=a.IsFamily()?a.GetFamilyMembers():[a],this._UnloadTexturesForObjectClasses(b,a))},UnloadObjectTexturesByName(a){f.Plugins.System.Acts.UnloadObjectTexturesByName.call(this,this._runtime.GetObjectClassByName(a))},UnloadUnusedTextures(){const a=this._runtime.GetMainRunningLayout();if(a){var b=a._GetTextureLoadedObjectTypes();this._UnloadTexturesForObjectClasses(a,b)}},async LoadLayoutTextures(a){const b=this._runtime.GetMainRunningLayout();
  a&&b&&!this._runtime.IsLoading()&&await this._LoadTexturesForObjectClasses(b,a._GetInitialObjectClasses())},async LoadLayoutTexturesByName(a){const b=this._runtime.GetMainRunningLayout();(a=this._runtime.GetLayoutManager().GetLayoutByName(a))&&b&&!this._runtime.IsLoading()&&await this._LoadTexturesForObjectClasses(b,a._GetInitialObjectClasses())},SetFunctionReturnValue(a){const b=this._eventStack.GetCurrentExpFuncStackFrame();if(b)switch(b.GetFunctionReturnType()){case 1:"number"===typeof a&&b.SetFunctionReturnValue(a);
  break;case 2:"string"===typeof a&&b.SetFunctionReturnValue(a);break;case 3:b.SetFunctionReturnValue(a)}},MapFunction(a,b,c){var d=this._GetFunctionMap(a.toLowerCase(),!0);const e=d.strMap,g=b.toLowerCase();e.has(g)&&console.warn(`[Construct 3] Function map '${a}' string '${b}' already in map; overwriting entry`);if(d=f.first(e.values())||d.defaultFunc){d=0!==d.GetReturnType();const e=0!==c.GetReturnType();if(d!==e){console.error(`[Construct 3] Function map '${a}' string '${b}' function return type not compatible with other functions in the map; entry ignored`);
  return}}e.set(g,c)},MapFunctionDefault(a,b){const c=this._GetFunctionMap(a.toLowerCase(),!0);c.defaultFunc&&console.warn(`[Construct 3] Function map '${a}' already has a default; overwriting entry`);var d=f.first(c.strMap.values())||c.defaultFunc;if(d){d=0!==d.GetReturnType();const c=0!==b.GetReturnType();if(d!==c){console.error(`[Construct 3] Function map '${a}' default: function return type not compatible with other functions in the map; entry ignored`);return}}c.defaultFunc=b},CallMappedFunction(a,
  b,c){c=Math.floor(c);var d=this._GetFunctionMap(a.toLowerCase(),!1);if(d){var e=d.strMap.get(b.toLowerCase());if(!e)if(d.defaultFunc)e=d.defaultFunc,c=0;else{console.warn(`[Construct 3] Call mapped function: no function associated with map '${a}' string '${b}'; call ignored (consider setting a default)`);return}if(e.IsEnabled())if(0!==e.GetReturnType())console.warn(`[Construct 3] Call mapped function: map '${a}' string '${b}' has a return type so cannot be called`);else{a=this._runtime;b=a.GetEventSheetManager();
  var g=b.GetCurrentEvent();d=g.GetSolModifiersIncludingParents();var l=0<d.length;l&&b.PushCleanSol(d);var m=[];if(g=b.FindFirstFunctionBlockParent(g)){g=g.GetFunctionParameters();for(let a=c,b=g.length;a<b;++a)m.push(g[a].GetValue())}c=e.GetFunctionParameters();for(let a=m.length,b=c.length;a<b;++a)m.push(c[a].GetInitialValue());return a.IsDebugging()?this._DebugDoCallMappedFunction(b,e,m,l,d):this._DoCallMappedFunction(b,e,m,l,d)}}else console.warn(`[Construct 3] Call mapped function: map name '${a}' not found; call ignored`)}}};
  
  
  'use strict';{const d=self.C3;d.Plugins.System.Exps={int:function(a){"string"===typeof a&&(a=parseInt(a,10),isNaN(a)&&(a=0));return Math.floor(a)},float:function(a){"string"===typeof a&&(a=parseFloat(a),isNaN(a)&&(a=0));return a},str(a){return a.toString()},len(a){return"string"===typeof a?a.length:0},random(a,b){return"undefined"===typeof b?this._runtime.Random()*a:this._runtime.Random()*(b-a)+a},choose(...a){const b=Math.floor(this._runtime.Random()*a.length);return a[b]},pi(){return Math.PI},infinity(){return Infinity},
  sqrt(a){return Math.sqrt(a)},abs(a){return Math.abs(a)},round(a){return Math.round(a)},floor(a){return Math.floor(a)},ceil(a){return Math.ceil(a)},sign(a){return Math.sign(a)},sin(a){return Math.sin(d.toRadians(a))},cos(a){return Math.cos(d.toRadians(a))},tan(a){return Math.tan(d.toRadians(a))},asin(a){return d.toDegrees(Math.asin(a))},acos(a){return d.toDegrees(Math.acos(a))},atan(a){return d.toDegrees(Math.atan(a))},exp(a){return Math.exp(a)},ln(a){return Math.log(a)},log10(a){return Math.log(a)/
  Math.LN10},max(...a){let b=a[0];"number"!==typeof b&&(b=0);for(let c=1,d=a.length;c<d;++c){let d=a[c];"number"===typeof d&&b<d&&(b=d)}return b},min(...a){let b=a[0];"number"!==typeof b&&(b=0);for(let c=1,d=a.length;c<d;++c){let d=a[c];"number"===typeof d&&b>d&&(b=d)}return b},clamp(a,b,c){return d.clamp(a,b,c)},distance(a,b,c,e){return d.distanceTo(a,b,c,e)},angle(a,b,c,e){return d.toDegrees(d.angleTo(a,b,c,e))},lerp(a,b,c){return d.lerp(a,b,c)},unlerp(a,b,c){return d.unlerp(a,b,c)},qarp(a,b,c,e){return d.qarp(a,
  b,c,e)},cubic(a,b,c,e,f){return d.cubic(a,b,c,e,f)},cosp(a,b,c){return d.cosp(a,b,c)},anglediff(a,b){return d.toDegrees(d.angleDiff(d.toRadians(a),d.toRadians(b)))},anglelerp(a,b,c){return d.toDegrees(d.angleLerp(d.toRadians(a),d.toRadians(b),c))},anglerotate(a,b,c){return d.toDegrees(d.angleRotate(d.toRadians(a),d.toRadians(b),d.toRadians(c)))},setbit(a,b,c){b|=0;return(a|0)&~(1<<b)|(0!==c?1:0)<<b},togglebit(a,b){return(a|0)^1<<(b|0)},getbit(a,b){return(a|0)&1<<(b|0)?1:0},newline(){return"\n"},uppercase(a){return"string"===
  typeof a?a.toUpperCase():""},lowercase(a){return"string"===typeof a?a.toLowerCase():""},left(a,b){return"string"===typeof a?a.substr(0,b):""},mid(a,b,c){return"string"!==typeof a?"":0>c?a.substr(b):a.substr(b,c)},right(a,b){return"string"===typeof a?a.substr(a.length-b):""},trim(a){return"string"===typeof a?a.trim():""},tokenat(a,b,c){if("string"!==typeof a||"string"!==typeof c)return"";a=a.split(c);b=Math.floor(b);return 0>b||b>=a.length?"":a[b]},tokencount(a,b){return"string"===typeof a&&"string"===
  typeof b&&a.length?a.split(b).length:0},find(a,b){return"string"===typeof a&&"string"===typeof b?a.search(new RegExp(d.EscapeRegex(b),"i")):-1},findcase(a,b){return"string"===typeof a&&"string"===typeof b?a.search(new RegExp(d.EscapeRegex(b),"")):-1},replace(a,b,c){return"string"===typeof a&&"string"===typeof b&&"string"===typeof c?a.replace(new RegExp(d.EscapeRegex(b),"gi"),c):"string"===typeof a?a:""},regexsearch(a,b,c){b=this.GetRegex(b,c);return a?a.search(b):-1},regexreplace(a,b,c,e){b=this.GetRegex(b,
  c);return a?a.replace(b,e):""},regexmatchcount(a,b,c){return(a=this.GetRegexMatches(a.toString(),b,c))?a.length:0},regexmatchat(a,b,c,e){e=Math.floor(e);a=this.GetRegexMatches(a.toString(),b,c);return!a||0>e||e>=a.length?"":a[e]},zeropad(a,b){let c=0>a?"-":"";0>a&&(a=-a);c+="0".repeat(Math.max(b-a.toString().length,0));return c+a.toString()},urlencode(a){return encodeURIComponent(a)},urldecode(a){return decodeURIComponent(a)},dt(){return this._runtime._GetDtFast()},timescale(){return this._runtime.GetTimeScale()},
  wallclocktime(){return(Date.now()-this._runtime.GetStartTime())/1E3},unixtime(){return Date.now()},time(){return this._runtime.GetGameTime()},tickcount(){return this._runtime.GetTickCount()},objectcount(){return this._runtime.GetObjectCount()},fps(){return this._runtime.GetFPS()},cpuutilisation(){return this._runtime.GetMainThreadTime()},gpuutilisation(){return this._runtime.GetGPUUtilisation()},windowwidth(){return this._runtime.GetCanvasManager().GetDeviceWidth()},windowheight(){return this._runtime.GetCanvasManager().GetDeviceHeight()},
  originalwindowwidth(){return this._runtime.GetOriginalViewportWidth()},originalwindowheight(){return this._runtime.GetOriginalViewportHeight()},originalviewportwidth(){return this._runtime.GetOriginalViewportWidth()},originalviewportheight(){return this._runtime.GetOriginalViewportHeight()},scrollx(){return this._runtime.GetCurrentLayout().GetScrollX()},scrolly(){return this._runtime.GetCurrentLayout().GetScrollY()},layoutname(){return this._runtime.GetCurrentLayout().GetName()},layoutscale(){return this._runtime.GetCurrentLayout().GetScale()},
  layoutangle(){return d.toDegrees(this._runtime.GetCurrentLayout().GetAngle())},layoutwidth(){return this._runtime.GetCurrentLayout().GetWidth()},layoutheight(){return this._runtime.GetCurrentLayout().GetHeight()},viewportleft(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetViewport().getLeft():0},viewporttop(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetViewport().getTop():0},viewportright(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetViewport().getRight():
  0},viewportbottom(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetViewport().getBottom():0},viewportwidth(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetViewport().width():0},viewportheight(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetViewport().height():0},canvastolayerx(a,b,c){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.CanvasCssToLayer(b,c)[0]:0},canvastolayery(a,b,c){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.CanvasCssToLayer(b,
  c)[1]:0},layertocanvasx(a,b,c){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.LayerToCanvasCss(b,c)[0]:0},layertocanvasy(a,b,c){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.LayerToCanvasCss(b,c)[1]:0},layerscale(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetOwnScale():0},layerangle(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?d.toDegrees(a.GetOwnAngle()):0},layeropacity(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?100*a.GetOpacity():
  0},layerscalerate(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetScaleRate():0},layerparallaxx(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?100*a.GetParallaxX():0},layerparallaxy(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?100*a.GetParallaxY():0},layerzelevation(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetZElevation():0},layerindex(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetIndex():-1},canvassnapshot(){const a=this._runtime.GetCanvasManager();
  return a?a.GetCanvasSnapshotUrl():""},loopindex(a){const b=this._loopStack;return b.IsInLoop()?a?(a=b.FindByName(a))?a.GetIndex():0:b.GetCurrent().GetIndex():0},savestatejson(){return this._runtime.GetLastSaveJsonString()},callmapped(a,b,...c){var e=this._GetFunctionMap(a.toLowerCase(),!1);if(!e)return console.warn(`[Construct 3] Call mapped function: map name '${a}' not found; returning 0`),0;var f=e.strMap.get(b.toLowerCase());if(!f)if(e.defaultFunc)f=e.defaultFunc;else return console.warn(`[Construct 3] Call mapped function: no function associated with map '${a}' string '${b}'; returning 0 (consider setting a default)`),
  0;e=f.GetReturnType();const g=f.GetDefaultReturnValue();if(0===e)return console.warn(`[Construct 3] Call mapped function: map '${a}' string '${b}' has no return type so cannot be called from an expression; returning 0`),0;if(!f.IsEnabled())return g;a=this._runtime.GetEventSheetManager();b=a.GetCurrentEvent().GetSolModifiersIncludingParents();const h=0<b.length;h&&a.PushCleanSol(b);const k=f.GetFunctionParameters();for(let a=c.length,b=k.length;a<b;++a)c.push(k[a].GetInitialValue());f=f.GetEventBlock();
  c=f.RunAsExpressionFunctionCall(f.GetSolModifiersIncludingParents(),e,g,...c);h&&a.PopSol(b);return c},loadingprogress(){return this._runtime.GetAssetManager().GetLoadProgress()},imageloadingprogress(){return 0===this._imagesLoadingTotal?1:this._imagesLoadingComplete/this._imagesLoadingTotal},renderer(){return"webgl"},rendererdetail(){return this._runtime.GetWebGLRenderer().GetUnmaskedRenderer()},imagememoryusage(){let a=this._runtime.GetWebGLRenderer().GetEstimatedTextureMemoryUsage();return Math.round(100*
  a/1048576)/100},rgb(a,b,c){return d.PackRGB(a,b,c)},rgbex(a,b,c){return d.PackRGBEx(a/100,b/100,c/100)},rgba(a,b,c,e){return d.PackRGBAEx(a/100,b/100,c/100,e/100)},rgbex255(a,b,c){return d.PackRGBEx(a/255,b/255,c/255)},rgba255(a,b,c,e){return d.PackRGBAEx(a/255,b/255,c/255,e/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 a=self.C3;a.Plugins.Sprite=class extends a.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}};
  
  
  'use strict';{const b=self.C3;b.Plugins.Sprite.Type=class extends b.SDKTypeBase{constructor(a){super(a);this._animations=a.GetAnimations()}Release(){b.clearArray(this._animations);super.Release()}OnCreate(){for(const a of this._animations)a.LoadAllAssets(this._runtime)}LoadTextures(a){const c={sampling:this._runtime.GetSampling()};return Promise.all(this._animations.map(b=>b.LoadAllTextures(a,c)))}ReleaseTextures(){for(const a of this._animations)a.ReleaseAllTextures()}OnDynamicTextureLoadComplete(){this._UpdateAllCurrentTexture()}_UpdateAllCurrentTexture(){for(const a of this._objectClass.instancesIncludingPendingCreate())a.GetSdkInstance()._UpdateCurrentTexture()}FinishCondition(a){b.Plugins.Sprite._FinishCondition(this,
  a)}}};
  
  
  'use strict';{const g=self.C3,n=g.New(g.Quad),k=g.New(g.Vector2);g.Plugins.Sprite.Instance=class extends g.SDKWorldInstanceBase{constructor(a,b){super(a);let c=!0,f="",d=0,h=!0;b&&(c=!!b[0],f=b[1],d=b[2],h=b[3]);this._currentAnimation=this._objectClass.GetAnimationByName(f)||this._objectClass.GetAnimations()[0];this._currentFrameIndex=g.clamp(d,0,this._currentAnimation.GetFrameCount()-1);this._currentAnimationFrame=this._currentAnimation.GetFrameAt(this._currentFrameIndex);b=this._currentAnimationFrame.GetImageInfo();
  this._currentTexture=b.GetTexture();this._currentRcTex=b.GetTexRect();this.HandleWebGLContextLoss();a.SetFlag(2,!0);a.SetFlag(1,0<=this._currentAnimation.GetSpeed());this._currentAnimationSpeed=Math.abs(this._currentAnimation.GetSpeed());this._currentAnimationRepeatTo=this._currentAnimation.GetRepeatTo();this._animationTimer=g.New(g.KahanSum);this._animationRepeats=this._frameStartTime=0;this._animTriggerName="";this._changeAnimFrameIndex=-1;this._changeAnimationName="";this._changeAnimationFrom=
  0;a=this.GetWorldInfo();this._bquadRef=a.GetBoundingQuad();a.SetVisible(c);a.SetCollisionEnabled(h);a.SetOriginX(this._currentAnimationFrame.GetOriginX());a.SetOriginY(this._currentAnimationFrame.GetOriginY());a.SetSourceCollisionPoly(this._currentAnimationFrame.GetCollisionPoly());a.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()}OnWebGLContextLost(){this._currentTexture=null}OnWebGLContextRestored(){this._UpdateCurrentTexture()}Draw(a){var b=this._currentTexture;if(null!==b){var c=this._bquadRef,f=this._currentRcTex;a.SetTexture(b);if(this._runtime.IsPixelRoundingEnabled()){var d=this.GetWorldInfo();b=Math.round(d.GetX())-d.GetX();d=Math.round(d.GetY())-d.GetY();n.copy(c);n.offset(b,
  d);a.Quad3(n,f)}else a.Quad3(c,f)}}_DrawCollisionPoly(a){var b=this.GetWorldInfo(),c=b.GetTransformedCollisionPoly();a.SetColorFillMode();a.SetColorRgba(1,0,0,1);c=c.pointsArr();const f=b.GetX();b=b.GetY();for(let d=0,e=c.length;d<e;d+=2){const g=(d+2)%e;a.Line(c[d]+f,c[d+1]+b,c[g]+f,c[g+1]+b)}a.SetTextureFillMode();a.SetColorRgba(1,1,1,1)}GetAnimationTime(){return this._animationTimer.Get()}IsAnimationPlaying(){return this._inst.GetFlag(2)}SetAnimationPlaying(a){this._inst.SetFlag(2,a)}IsPlayingForwards(){return this._inst.GetFlag(1)}SetPlayingForwards(a){this._inst.SetFlag(1,
  a)}IsInAnimationTrigger(){return this._inst.GetFlag(4)}SetInAnimationTrigger(a){this._inst.SetFlag(4,a)}Tick(){this._changeAnimationName&&this._DoChangeAnimation();0<=this._changeAnimFrameIndex&&this._DoChangeAnimFrame();const a=this._currentAnimationSpeed;if(this.IsAnimationPlaying()&&0!==a){var b=this._runtime.GetDt(this._inst);this._animationTimer.Add(b);b=this.GetAnimationTime();var c=this._currentAnimationFrame,f=c.GetDuration()/a;if(!(b<this._frameStartTime+f)){var d=this._currentAnimation,
  h=this._currentAnimationRepeatTo,l=d.GetFrameCount(),m=d.GetRepeatCount(),p=d.IsLooping(),q=d.IsPingPong();this.IsPlayingForwards()?this._currentFrameIndex++:this._currentFrameIndex--;this._frameStartTime+=f;this._currentFrameIndex>=l&&(q?(this.SetPlayingForwards(!1),this._currentFrameIndex=l-2):p?this._currentFrameIndex=h:(this._animationRepeats++,this._animationRepeats>=m?this._FinishAnimation(!1):this._currentFrameIndex=h));0>this._currentFrameIndex&&(q?(this._currentFrameIndex=1,this.SetPlayingForwards(!0),
  p||(this._animationRepeats++,this._animationRepeats>=m&&this._FinishAnimation(!0))):p?this._currentFrameIndex=h:(this._animationRepeats++,this._animationRepeats>=m?this._FinishAnimation(!0):this._currentFrameIndex=h));this._currentFrameIndex=g.clamp(this._currentFrameIndex,0,l-1);f=d.GetFrameAt(this._currentFrameIndex);b>this._frameStartTime+f.GetDuration()/a&&(this._frameStartTime=b);this._OnFrameChanged(c,f)}}else this._StopTicking()}_FinishAnimation(a){this._currentFrameIndex=a?0:this._currentAnimation.GetFrameCount()-
  1;this.SetAnimationPlaying(!1);this._animTriggerName=this._currentAnimation.GetName();this.SetInAnimationTrigger(!0);this.Trigger(g.Plugins.Sprite.Cnds.OnAnyAnimFinished);this.Trigger(g.Plugins.Sprite.Cnds.OnAnimFinished);this.SetInAnimationTrigger(!1);this._animationRepeats=0}_OnFrameChanged(a,b){if(a!==b){var c=this.GetWorldInfo(),f=a.GetImageInfo(),d=b.GetImageInfo(),h=f.GetWidth();f=f.GetHeight();var l=d.GetWidth(),m=d.GetHeight();h!==l&&c.SetWidth(c.GetWidth()*(l/h));f!==m&&c.SetHeight(c.GetHeight()*
  (m/f));c.SetOriginX(b.GetOriginX());c.SetOriginY(b.GetOriginY());c.SetSourceCollisionPoly(b.GetCollisionPoly());c.SetBboxChanged();this._currentAnimationFrame=b;this._currentTexture=d.GetTexture();this._currentRcTex=d.GetTexRect();c=this.GetInstance().GetBehaviorInstances();for(let d=0,e=c.length;d<e;++d)c[d].OnSpriteFrameChanged(a,b);this.Trigger(g.Plugins.Sprite.Cnds.OnFrameChanged);this._runtime.UpdateRender()}}_StartAnim(a){this.SetAnimationPlaying(!0);this._frameStartTime=this.GetAnimationTime();
  1===a&&0!==this._currentFrameIndex&&(this._changeAnimFrameIndex=0,this.IsInAnimationTrigger()||this._DoChangeAnimFrame());this._StartTicking()}_SetAnim(a,b){this._changeAnimationName=a;this._changeAnimationFrom=b;this._StartTicking();this.IsInAnimationTrigger()||this._DoChangeAnimation()}_GetCurrentAnimationName(){return this._changeAnimationName?this._changeAnimationName:this._currentAnimation.GetName()}_SetAnimFrame(a){isFinite(a)&&(this._changeAnimFrameIndex=a,this.IsInAnimationTrigger()||this._DoChangeAnimFrame())}_GetAnimFrame(){return this._currentFrameIndex}_SetAnimSpeed(a){this._currentAnimationSpeed=
  Math.abs(a);this.SetPlayingForwards(0<=a);0<this._currentAnimationSpeed&&this._StartTicking()}_GetAnimSpeed(){return this.IsPlayingForwards()?this._currentAnimationSpeed:-this._currentAnimationSpeed}_SetAnimRepeatToFrame(a){this._currentAnimationRepeatTo=a=g.clamp(Math.floor(a),0,this._currentAnimation.GetFrameCount()-1)}_GetAnimRepeatToFrame(){return this._currentAnimationRepeatTo}_DoChangeAnimation(){const a=this._currentAnimationFrame;var b=this._objectClass.GetAnimationByName(this._changeAnimationName);
  this._changeAnimationName="";!b||b===this._currentAnimation&&this.IsAnimationPlaying()||(this._currentAnimation=b,this.SetPlayingForwards(0<=b.GetSpeed()),this._currentAnimationSpeed=Math.abs(b.GetSpeed()),this._currentAnimationRepeatTo=b.GetRepeatTo(),this._currentFrameIndex=g.clamp(this._currentFrameIndex,0,this._currentAnimation.GetFrameCount()-1),1===this._changeAnimationFrom&&(this._currentFrameIndex=0),this.SetAnimationPlaying(!0),this._frameStartTime=this.GetAnimationTime(),b=this._currentAnimation.GetFrameAt(this._currentFrameIndex),
  this._OnFrameChanged(a,b))}_DoChangeAnimFrame(){const a=this._currentAnimationFrame;var b=this._currentFrameIndex;this._currentFrameIndex=g.clamp(Math.floor(this._changeAnimFrameIndex),0,this._currentAnimation.GetFrameCount()-1);this._changeAnimFrameIndex=-1;b!==this._currentFrameIndex&&(b=this._currentAnimation.GetFrameAt(this._currentFrameIndex),this._OnFrameChanged(a,b),this._frameStartTime=this.GetAnimationTime())}_UpdateCurrentTexture(){const a=this._currentAnimationFrame.GetImageInfo();this._currentTexture=
  a.GetTexture();this._currentRcTex=a.GetTexRect()}GetImagePointCount(){return this._currentAnimationFrame.GetImagePointCount()}GetImagePoint(a){const b=this._currentAnimationFrame,c=this.GetWorldInfo();if("string"===typeof a)a=b.GetImagePointByName(a);else if("number"===typeof a)a=b.GetImagePointByIndex(a-1);else throw new TypeError("expected string or number");if(!a)return[c.GetX(),c.GetY()];k.copy(a.GetVec2());k.offset(-b.GetOriginX(),-b.GetOriginY());k.scale(c.GetWidth(),c.GetHeight());k.rotate(c.GetAngle());
  k.offset(c.GetX(),c.GetY());return[k.getX(),k.getY()]}GetCollisionPolyPointCount(){return this.GetWorldInfo().GetTransformedCollisionPoly().pointCount()}GetCollisionPolyPoint(a){a=Math.floor(a);const b=this.GetWorldInfo();var c=b.GetTransformedCollisionPoly();const f=c.pointCount();a===f&&(a=0);if(0>a||a>=f)return[0,0];c=c.pointsArr();return[c[2*a]+b.GetX(),c[2*a+1]+b.GetY()]}GetDebuggerProperties(){const a=g.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:b=>this.CallAction(a.SetAnim,b,0)},{name:"plugins.sprite.debugger.animation-properties.current-frame",value:this._currentFrameIndex,onedit:b=>this.CallAction(a.SetAnimFrame,b)},{name:"plugins.sprite.debugger.animation-properties.is-playing",value:this.IsAnimationPlaying(),onedit:b=>b?this.CallAction(a.StartAnim,0):this.CallAction(a.StopAnim)},{name:"plugins.sprite.debugger.animation-properties.speed",value:this._currentAnimationSpeed,onedit:b=>this.CallAction(a.SetAnimSpeed,
  b)},{name:"plugins.sprite.debugger.animation-properties.repeats",value:this._animationRepeats,onedit:a=>this._animationRepeats=a}]}]}SaveToJson(){const a={a:this._currentAnimation.GetSID()};0!==this._frameStartTime&&(a.fs=this._frameStartTime);var b=this.GetAnimationTime();0!==b&&(a.at=b);0!==this._currentFrameIndex&&(a.f=this._currentFrameIndex);0!==this._currentAnimationSpeed&&(a.cas=this._currentAnimationSpeed);1!==this._animationRepeats&&(a.ar=this._animationRepeats);0!==this._currentAnimationRepeatTo&&
  (a.rt=this._currentAnimationRepeatTo);this.IsAnimationPlaying()||(a.ap=this.IsAnimationPlaying());this.IsPlayingForwards()||(a.af=this.IsPlayingForwards());b=this.GetWorldInfo();b.IsCollisionEnabled()&&(a.ce=b.IsCollisionEnabled());return a}LoadFromJson(a){var b=this.GetObjectClass().GetAnimationBySID(a.a);b&&(this._currentAnimation=b);this._frameStartTime=a.hasOwnProperty("fs")?a.fs:0;this._animationTimer.Set(a.hasOwnProperty("at")?a.at:0);b=a.hasOwnProperty("f")?a.f:0;this._currentFrameIndex=g.clamp(b,
  0,this._currentAnimation.GetFrameCount()-1);this._currentAnimationSpeed=a.hasOwnProperty("cas")?a.cas:0;this._animationRepeats=a.hasOwnProperty("ar")?a.ar:1;b=a.hasOwnProperty("rt")?a.rt:0;this._currentAnimationRepeatTo=g.clamp(b,0,this._currentAnimation.GetFrameCount()-1);this.SetAnimationPlaying(a.hasOwnProperty("ap")?!!a.ap:!0);this.SetPlayingForwards(a.hasOwnProperty("af")?!!a.af:!0);b=this._currentAnimation.GetFrameAt(this._currentFrameIndex);var c=b.GetImageInfo();this._currentAnimationFrame=
  b;this._currentTexture=c.GetTexture();this._currentRcTex=c.GetTexRect();c=this.GetWorldInfo();c.SetOriginX(b.GetOriginX());c.SetOriginY(b.GetOriginY());c.SetSourceCollisionPoly(b.GetCollisionPoly());c.SetCollisionEnabled(!!a.ce)}GetPropertyValueByIndex(a){const b=this.GetWorldInfo();switch(a){case 3:return b.IsCollisionEnabled()}}SetPropertyValueByIndex(a,b){const c=this.GetWorldInfo();switch(a){case 3:c.SetCollisionEnabled(!!b)}}GetScriptInterfaceClass(){return self.ISpriteInstance}};const e=new WeakMap,
  r=new Map([["current-frame",0],["beginning",1]]);self.ISpriteInstance=class extends self.IWorldInstance{constructor(){super();e.set(this,self.IInstance._GetInitInst().GetSdkInstance())}getImagePointCount(){return e.get(this).GetImagePointCount()}getImagePointX(a){if("string"!==typeof a&&"number"!==typeof a)throw new TypeError("expected string or number");return e.get(this).GetImagePoint(a)[0]}getImagePointY(a){if("string"!==typeof a&&"number"!==typeof a)throw new TypeError("expected string or number");
  return e.get(this).GetImagePoint(a)[1]}getImagePoint(a){if("string"!==typeof a&&"number"!==typeof a)throw new TypeError("expected string or number");return e.get(this).GetImagePoint(a)}getPolyPointCount(){return e.get(this).GetCollisionPolyPointCount()}getPolyPointX(a){return e.get(this).GetCollisionPolyPoint(a)[0]}getPolyPointY(a){return e.get(this).GetCollisionPolyPoint(a)[1]}getPolyPoint(a){return e.get(this).GetCollisionPolyPoint(a)}stopAnimation(){e.get(this).SetAnimationPlaying(!1)}startAnimation(a=
  "current-frame"){a=r.get(a);if("undefined"===typeof a)throw Error("invalid mode");e.get(this)._StartAnim(a)}setAnimation(a,b="beginning"){b=r.get(b);if("undefined"===typeof b)throw Error("invalid mode");e.get(this)._SetAnim(a,b)}get animationName(){return e.get(this)._GetCurrentAnimationName()}set animationFrame(a){e.get(this)._SetAnimFrame(a)}get animationFrame(){return e.get(this)._GetAnimFrame()}set animationSpeed(a){e.get(this)._SetAnimSpeed(a)}get animationSpeed(){return e.get(this)._GetAnimSpeed()}set animationRepeatToFrame(a){e.get(this)._SetAnimRepeatToFrame(a)}get animationRepeatToFrame(){return e.get(this)._GetAnimRepeatToFrame()}get imageWidth(){return e.get(this).GetCurrentImageInfo().GetWidth()}get imageHeight(){return e.get(this).GetCurrentImageInfo().GetHeight()}}};
  
  
  'use strict';{var FinishCollisionConditionPicking=function(a){a=a.GetRuntime().GetCurrentEvent().IsOrBlock();const b=z.GetCurrentSol(),d=b._GetOwnInstances(),g=b._GetOwnElseInstances();if(b.IsSelectAll()){if(b._SetSelectAll(!1),e.shallowAssignArray(d,[...w]),a){e.clearArray(g);for(const a of z.GetInstances())w.has(a)||b._PushElseInstance(a)}}else if(a)for(const a of w)d.push(a),e.arrayFindRemove(g,a);else e.shallowAssignArray(d,[...w]);z.ApplySolToContainer()},DoOverlapCondition=function(a,b,d,g){if(!b)return!1;
  a=a.GetInstance();const c=0!==d||0!==g,k=a.GetWorldInfo(),t=a.GetRuntime(),u=t.GetCollisionEngine();var l=t.GetCurrentCondition();const x=l.GetEventBlock().IsOrBlock();var m=l.GetObjectClass();l=l.IsInverted();const r=b.GetCurrentSol();m=m!==b;z=b;A=m&&!l;let v=0,p=0,q=!1;r.IsSelectAll()?(B.copy(k.GetBoundingBox()),B.offset(d,g),u.GetCollisionCandidates(k.GetLayer(),b,B,C),b=C):b=x?t.IsCurrentConditionFirst()&&!r._GetOwnElseInstances().length&&r._GetOwnInstances().length?r._GetOwnInstances():r._GetOwnElseInstances():
  r._GetOwnInstances();c&&(v=k.GetX(),p=k.GetY(),k.OffsetXY(d,g),k.SetBboxChanged());for(const d of b)if(u.TestOverlap(a,d)){q=!0;if(l)break;m&&w.add(d)}c&&(k.SetXY(v,p),k.SetBboxChanged());e.clearArray(C);return q},CollMemory_Get=function(a,b,d){const g=b.GetUID(),c=d.GetUID();return g<c?a.Get(b,d):a.Get(d,b)},CollMemory_RemoveInstance=function(a,b){a.DeleteEither(b)},CollMemory_Remove=function(a,b,d){const g=b.GetUID(),c=d.GetUID();g<c?a.Delete(b,d):a.Delete(d,b)},CollMemory_Add=function(a,b,d,g){const c=
  b.GetUID(),k=d.GetUID();c<k?a.Set(b,d,g):a.Set(d,b,g)};const e=self.C3,B=e.New(e.Rect),y=[],C=[];let A=!1,z=null;const w=new Set;e.Plugins.Sprite._FinishCondition=function(a,b){A&&(b&&FinishCollisionConditionPicking(a),w.clear(),z=null,A=!1)};e.Plugins.Sprite.Cnds={OnCollision(a){if(this._runtime.IsDebugging())return e.Plugins.Sprite.Cnds.DebugOnCollision.call(this,a);if(!a)return!1;var b=this._runtime;const d=b.GetCollisionEngine(),g=b.GetEventSheetManager(),c=g.GetEventStack();var k=g.GetCurrentCondition();
  const t=k.GetObjectClass();var u=k.GetSavedDataMap(),l=k.GetUnsavedDataMap();k=c.GetCurrentStackFrame();const x=b.GetTickCount(),m=x-1,r=k.GetCurrentEvent(),v=c.Push(r);let p=u.get("collmemory");p||(p=e.New(e.PairMap),u.set("collmemory",p));l.get("spriteCreatedDestroyCallback")||(l.set("spriteCreatedDestroyCallback",!0),b.Dispatcher().addEventListener("instancedestroy",a=>CollMemory_RemoveInstance(p,a.instance)));u=t.GetCurrentSol();b=a.GetCurrentSol();u=u.GetInstances();l=null;for(let c=0;c<u.length;++c){const h=
  u[c];b.IsSelectAll()?(d.GetCollisionCandidates(h.GetWorldInfo().GetLayer(),a,h.GetWorldInfo().GetBoundingBox(),y),l=y,d.AddRegisteredCollisionCandidates(h,a,l)):l=b.GetInstances();for(let b=0;b<l.length;++b){const c=l[b];if(d.TestOverlap(h,c)||d.CheckRegisteredCollision(h,c)){var q=CollMemory_Get(p,h,c),f=!1,n=-2;"number"===typeof q&&(f=!0,n=q);q=!f||n<m;CollMemory_Add(p,h,c,x);q&&(q=r.GetSolModifiers(),g.PushCopySol(q),n=t.GetCurrentSol(),f=a.GetCurrentSol(),n._SetSelectAll(!1),f._SetSelectAll(!1),
  t===a?(f=n._GetOwnInstances(),e.clearArray(f),f.push(h),f.push(c),t.ApplySolToContainer()):(n=n._GetOwnInstances(),f=f._GetOwnInstances(),e.clearArray(n),e.clearArray(f),n.push(h),f.push(c),t.ApplySolToContainer(),a.ApplySolToContainer()),r.Retrigger(k,v),g.PopSol(q))}else CollMemory_Remove(p,h,c)}e.clearArray(y)}c.Pop();return!1},*DebugOnCollision(a){if(!a)return!1;var b=this._runtime;const d=b.GetCollisionEngine(),g=b.GetEventSheetManager(),c=g.GetEventStack(),k=c.GetCurrentStackFrame(),t=b.GetTickCount(),
  u=t-1,l=k.GetCurrentEvent(),x=c.Push(l);var m=g.GetCurrentCondition();const r=m.GetObjectClass();var v=m.GetSavedDataMap();m=m.GetUnsavedDataMap();let p=v.get("collmemory");p||(p=e.New(e.PairMap),v.set("collmemory",p));m.get("spriteCreatedDestroyCallback")||(m.set("spriteCreatedDestroyCallback",!0),b.Dispatcher().addEventListener("instancedestroy",a=>CollMemory_RemoveInstance(p,a.instance)));v=r.GetCurrentSol();b=a.GetCurrentSol();v=v.GetInstances();m=null;for(let c=0;c<v.length;++c){const h=v[c];
  b.IsSelectAll()?(d.GetCollisionCandidates(h.GetWorldInfo().GetLayer(),a,h.GetWorldInfo().GetBoundingBox(),y),m=y,d.AddRegisteredCollisionCandidates(h,a,m)):m=b.GetInstances();for(let b=0;b<m.length;++b){const c=m[b];if(d.TestOverlap(h,c)||d.CheckRegisteredCollision(h,c)){var q=CollMemory_Get(p,h,c),f=!1,n=-2;"number"===typeof q&&(f=!0,n=q);q=!f||n<u;CollMemory_Add(p,h,c,t);q&&(q=l.GetSolModifiers(),g.PushCopySol(q),n=r.GetCurrentSol(),f=a.GetCurrentSol(),n._SetSelectAll(!1),f._SetSelectAll(!1),r===
  a?(f=n._GetOwnInstances(),e.clearArray(f),f.push(h),f.push(c),r.ApplySolToContainer()):(n=n._GetOwnInstances(),f=f._GetOwnInstances(),e.clearArray(n),e.clearArray(f),n.push(h),f.push(c),r.ApplySolToContainer(),a.ApplySolToContainer()),yield*l.DebugRetrigger(k,x),g.PopSol(q))}else CollMemory_Remove(p,h,c)}e.clearArray(y)}c.Pop();return!1},IsOverlapping(a){return DoOverlapCondition(this,a,0,0)},IsOverlappingOffset(a,b,d){return DoOverlapCondition(this,a,b,d)},IsAnimPlaying(a){return e.equalsNoCase(this._GetCurrentAnimationName(),
  a)},CompareFrame(a,b){return e.compare(this._currentFrameIndex,a,b)},CompareAnimSpeed(a,b){return e.compare(this._GetAnimSpeed(),a,b)},OnAnimFinished(a){return e.equalsNoCase(this._animTriggerName,a)},OnAnyAnimFinished(){return!0},OnFrameChanged(){return!0},IsMirrored(){return 0>this.GetWorldInfo().GetWidth()},IsFlipped(){return 0>this.GetWorldInfo().GetHeight()},OnURLLoaded(){return!0},OnURLFailed(){return!0},IsCollisionEnabled(){return this.GetWorldInfo().IsCollisionEnabled()}}};
  
  
  'use strict';{const f=self.C3;f.Plugins.Sprite.Acts={Spawn(a,c,b){if(a&&c){var [d,g]=this.GetImagePoint(b);if(c=this._runtime.CreateInstance(a,c,d,g)){a.GetPlugin().IsRotatable()&&(b=c.GetWorldInfo(),b.SetAngle(this.GetWorldInfo().GetAngle()),b.SetBboxChanged());b=this._runtime.GetEventSheetManager();b.BlockFlushingInstances(!0);c._TriggerOnCreated();if(c.IsInContainer())for(var e of c.siblings())e._TriggerOnCreated();b.BlockFlushingInstances(!1);b=this._runtime.GetCurrentAction().GetSavedDataMap();
  e=!1;if(!b.has("Spawn_LastExec")||b.get("Spawn_LastExec")<this._runtime.GetExecCount())e=!0,b.set("Spawn_LastExec",this._runtime.GetExecCount());if(a!==this.GetObjectClass()&&(a=a.GetCurrentSol(),a._SetSelectAll(!1),a=a._GetOwnInstances(),e&&f.clearArray(a),a.push(c),c.IsInContainer()))for(const b of c.siblings())a=b.GetObjectClass().GetCurrentSol(),e?a.SetSinglePicked(b):(a._SetSelectAll(!1),a._PushInstance(b))}}},StopAnim(){this.SetAnimationPlaying(!1)},StartAnim(a){this._StartAnim(a)},SetAnim(a,
  c){this._SetAnim(a,c)},SetAnimFrame(a){this._SetAnimFrame(a)},SetAnimSpeed(a){this._SetAnimSpeed(a)},SetAnimRepeatToFrame(a){this._SetAnimRepeatToFrame(a)},SetMirrored(a){const c=this.GetWorldInfo(),b=c.GetWidth();a=Math.abs(b)*(0===a?-1:1);b!==a&&(c.SetWidth(a),c.SetBboxChanged())},SetFlipped(a){const c=this.GetWorldInfo(),b=c.GetHeight();a=Math.abs(b)*(0===a?-1:1);b!==a&&(c.SetHeight(a),c.SetBboxChanged())},SetScale(a){const c=this._currentAnimationFrame.GetImageInfo(),b=this.GetWorldInfo();var d=
  0>b.GetWidth()?-1:1;const g=0>b.GetHeight()?-1:1;d*=c.GetWidth()*a;a=c.GetHeight()*a*g;if(b.GetWidth()!==d||b.GetHeight()!==a)b.SetSize(d,a),b.SetBboxChanged()},async LoadURL(a,c,b){b=this._currentAnimationFrame.GetImageInfo();const d=this.GetWorldInfo(),g=this._runtime;if(b.GetURL()===a)0===c&&(d.SetSize(b.GetWidth(),b.GetHeight()),d.SetBboxChanged()),this.Trigger(f.Plugins.Sprite.Cnds.OnURLLoaded);else{var e=f.New(f.ImageInfo);await e.LoadDynamicAsset(g,a);e.IsLoaded()?(await e.LoadStaticTexture(g.GetWebGLRenderer(),
  {sampling:this._runtime.GetSampling()}),b.ReplaceWith(e),this._sdkType._UpdateAllCurrentTexture(),this.WasReleased()||0!==c||(d.SetSize(b.GetWidth(),b.GetHeight()),d.SetBboxChanged()),g.UpdateRender(),this.WasReleased()||await this.TriggerAsync(f.Plugins.Sprite.Cnds.OnURLLoaded)):this.Trigger(f.Plugins.Sprite.Cnds.OnURLFailed)}},SetCollisions(a){this.GetWorldInfo().SetCollisionEnabled(a)},SetSolidCollisionFilter(a,c){this.GetWorldInfo().SetSolidCollisionFilter(0===a,c)},SetEffect(a){this.GetWorldInfo().SetBlendMode(a);
  this._runtime.UpdateRender()}}};
  
  
  'use strict';self.C3.Plugins.Sprite.Exps={AnimationFrame(){return this._currentFrameIndex},AnimationFrameCount(){return this._currentAnimation.GetFrameCount()},AnimationName(){return this._currentAnimation.GetName()},AnimationSpeed(){return this._GetAnimSpeed()},OriginalAnimationSpeed(){return this._currentAnimation.GetSpeed()},ImagePointX(a){return this.GetImagePoint(a)[0]},ImagePointY(a){return this.GetImagePoint(a)[1]},ImagePointCount(){return this.GetImagePointCount()},ImageWidth(){return this.GetCurrentImageInfo().GetWidth()},
  ImageHeight(){return this.GetCurrentImageInfo().GetHeight()},PolyPointXAt(a){return this.GetCollisionPolyPoint(a)[0]},PolyPointYAt(a){return this.GetCollisionPolyPoint(a)[1]},PolyPointCount(){return this.GetCollisionPolyPointCount()}};
  
  
  'use strict';{const a=self.C3;a.Plugins.Tilemap=class extends a.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}};a.Plugins.Tilemap.TILE_FLIPPED_HORIZONTAL=-2147483648;a.Plugins.Tilemap.TILE_FLIPPED_VERTICAL=1073741824;a.Plugins.Tilemap.TILE_FLIPPED_DIAGONAL=536870912;a.Plugins.Tilemap.TILE_FLAGS_MASK=3758096384;a.Plugins.Tilemap.TILE_ID_MASK=536870911};
  
  
  'use strict';{const d=self.C3,k=d.Plugins.Tilemap.TILE_FLIPPED_HORIZONTAL,l=d.Plugins.Tilemap.TILE_FLIPPED_VERTICAL,m=d.Plugins.Tilemap.TILE_FLIPPED_DIAGONAL,n=d.Plugins.Tilemap.TILE_ID_MASK;d.Plugins.Tilemap.Type=class extends d.SDKTypeBase{constructor(a){super(a);this._tilePolys=[];this._areTilePolysCached=!1}Release(){super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}LoadTextures(a){return this.GetImageInfo().LoadStaticTexture(a,{sampling:this._runtime.GetSampling()})}ReleaseTextures(){this.GetImageInfo().ReleaseTexture()}OnDynamicTextureLoadComplete(){for(const a of this.GetObjectClass().instancesIncludingPendingCreate())a.GetSdkInstance()._OnDynamicTextureLoadComplete()}LoadTilePolyData(a){for(const b of a)b?
  this._tilePolys.push({poly:b[0],use:!!b[1],flipmap:[[[null,null],[null,null]],[[null,null],[null,null]]]}):this._tilePolys.push(null)}_ForceCacheOfTileCollisionPolys(a,b){this._areTilePolysCached=!1;this._MaybeCacheTileCollisionPolys(a,b)}_MaybeCacheTileCollisionPolys(a,b){if(!this._areTilePolysCached){this._areTilePolysCached=!0;for(let c=0,d=this._tilePolys.length;c<d;++c)this._tilePolys[c]&&(this._CacheTilePoly(c,a,b,!1,!1,!1),this._CacheTilePoly(c,a,b,!1,!1,!0),this._CacheTilePoly(c,a,b,!1,!0,
  !1),this._CacheTilePoly(c,a,b,!1,!0,!0),this._CacheTilePoly(c,a,b,!0,!1,!1),this._CacheTilePoly(c,a,b,!0,!1,!0),this._CacheTilePoly(c,a,b,!0,!0,!1),this._CacheTilePoly(c,a,b,!0,!0,!0))}}_CacheTilePoly(a,b,c,f,g,h){if(!(0>a||a>=this._tilePolys.length)&&(a=this._tilePolys[a])){var e=d.New(d.CollisionPoly,a.poly,a.use);e.transform(b,c,0);h&&e.diag();f&&e.mirror(b/2);g&&e.flip(c/2);a.flipmap[f?1:0][g?1:0][h?1:0]=null;a.flipmap[f?1:0][g?1:0][h?1:0]=e}}GetTilePoly(a){if(-1===a)return null;var b=a&n;return 0>
  b||b>=this._tilePolys.length?null:(b=this._tilePolys[b])?b.flipmap[a&k?1:0][a&l?1:0][a&m?1:0]:null}IsTilePolyEnabled(a){return a?a.IsEnabled():!0}}};
  
  
  'use strict';{var RunLengthDecode=function(a){const b=[];a=a.split(",");for(let h=0,f=a.length;h<f;++h){var c=a[h],d=c.indexOf("x");if(-1<d){var e=parseInt(c.substring(0,d),10);c=c.substring(d+1);d=parseInt(c,10);c.includes("h")&&(d|=l);c.includes("v")&&(d|=m);for(c.includes("d")&&(d|=n);0<e;--e)b.push(d)}else e=parseInt(c,10),c.includes("h")&&(e|=l),c.includes("v")&&(e|=m),c.includes("d")&&(e|=n),b.push(e)}return b};const g=self.C3,l=g.Plugins.Tilemap.TILE_FLIPPED_HORIZONTAL,m=g.Plugins.Tilemap.TILE_FLIPPED_VERTICAL,
  n=g.Plugins.Tilemap.TILE_FLIPPED_DIAGONAL,x=g.Plugins.Tilemap.TILE_FLAGS_MASK,v=g.Plugins.Tilemap.TILE_ID_MASK,q=g.New(g.Rect),t=g.New(g.Rect);g.Plugins.Tilemap.Instance=class extends g.SDKWorldInstanceBase{constructor(a,b){super(a);a=this.GetWorldInfo();this._tileHeight=this._tileWidth=32;this._mapHeight=this._mapWidth=this._tileYspacing=this._tileXspacing=this._tileYoffset=this._tileXoffset=0;this._lastWidth=a.GetWidth();this._lastHeight=a.GetHeight();this._cellHeight=this._cellWidth=0;this._tileCells=
  [];this._tileTexQuads=new Map;this._isAnyQuadMapChanged=!0;this._ownImageInfo=null;b&&(a.SetVisible(b[0]),this._tileWidth=Math.max(b[1],1),this._tileHeight=Math.max(b[2],1),this._tileXoffset=b[3],this._tileYoffset=b[4],this._tileXspacing=b[5],this._tileYspacing=b[6]);this._cellWidth=Math.ceil(this._runtime.GetOriginalViewportWidth()/this._tileWidth);this._cellHeight=Math.ceil(this._runtime.GetOriginalViewportHeight()/this._tileHeight);this._sdkType._MaybeCacheTileCollisionPolys(this._tileWidth,this._tileHeight)}Release(){this._ReleaseOwnImage();
  g.clearArray(this._tileCells);this._tileCells=null;this._tileTexQuads.clear();this._tileTexQuads=null;super.Release()}_ReleaseOwnImage(){this._ownImageInfo&&(this._ownImageInfo.Release(),this._ownImageInfo=null)}LoadTilemapData(a,b,c){this._mapWidth=b;this._mapHeight=c;this._MaybeResizeTilemap(!0);this.SetTilesFromRLECSV(a);this._MaybeBuildAllQuadMap()}_MaybeResizeTilemap(a){var b=this.GetWorldInfo(),c=Math.floor(b.GetWidth()/this._tileWidth),d=Math.floor(b.GetHeight()/this._tileHeight);if(!(c<=this._mapWidth&&
  d<=this._mapHeight)||a){a?(a=Math.ceil(this._mapHeight/this._cellHeight),b=Math.ceil(this._mapWidth/this._cellWidth)):(a=this._tileCells.length,b=Math.ceil(this._mapWidth/this._cellWidth),d>this._mapHeight&&(this._mapHeight=d,a=Math.ceil(this._mapHeight/this._cellHeight)),c>this._mapWidth&&(this._mapWidth=c,b=Math.ceil(this._mapWidth/this._cellWidth)),this._SetAllQuadMapChanged(),this._SetPhysicsChanged(),this._runtime.UpdateRender());c=this._tileCells;if(c.length<a)for(d=c.length;d<a;++d)c.push([]);
  for(d=0;d<a;++d){const a=c[d];for(let c=a.length;c<b;++c)a.push(g.New(g.Plugins.Tilemap.TileCell,this,c,d))}}}SetTilesFromRLECSV(a){a=RunLengthDecode(a);let b=0;const c=this._mapWidth,d=this._cellWidth,e=this._cellHeight;for(let h=0,f=this._mapHeight;h<f;++h)for(let f=0;f<c;++f){const c=a[b++],g=this.GetCellAt(f,h);g&&g.SetTileAt(f%d,h%e,c)}}GetTilesAsRLECSV(){let a="";if(0>=this._mapWidth||0>=this._mapHeight)return a;let b=1;var c=this.GetTileAt(0,0),d=this.GetWorldInfo();const e=Math.floor(d.GetWidth()/
  this._tileWidth);d=Math.floor(d.GetHeight()/this._tileHeight);let h,f,k;for(let g=0;g<d;++g)for(let d=0===g?1:0;d<e;++d){const e=this.GetTileAt(d,g);e===c?++b:(-1===c?(h=-1,c=k=f=!1):(h=c&v,f=0!==(c&l),k=0!==(c&m),c=0!==(c&n)),a=1===b?a+(""+h):a+(""+b+"x"+h),f&&(a+="h"),k&&(a+="v"),c&&(a+="d"),a+=",",b=1,c=e)}-1===c?(h=-1,c=k=f=!1):(h=c&v,f=0!==(c&l),k=0!==(c&m),c=0!==(c&n));a=1===b?a+(""+h):a+(""+b+"x"+h);f&&(a+="h");k&&(a+="v");c&&(a+="d");return a}_SetAllQuadMapChanged(){const a=this._tileCells;
  for(let b=0,c=a.length;b<c;++b){const c=a[b];for(let a=0,b=c.length;a<b;++a)c[a]._SetQuadMapChanged()}this._isAnyQuadMapChanged=!0}_MaybeBuildAllQuadMap(){if(this._isAnyQuadMapChanged){this._isAnyQuadMapChanged=!1;var a=this._tileCells;for(let b=0,c=a.length;b<c;++b){const c=a[b];for(let a=0,b=c.length;a<b;++a)c[a].MaybeBuildQuadMap()}}}SetTileChanged(){this._isAnyQuadMapChanged=!0;this._SetPhysicsChanged();this._runtime.UpdateRender()}_SetPhysicsChanged(){this._inst.GetUnsavedDataMap().set("PhysicsChanged",
  !0)}GetCellAt(a,b){if(0>a||0>b)return null;b=Math.floor(b/this._cellHeight);if(b>=this._tileCells.length)return null;b=this._tileCells[b];a=Math.floor(a/this._cellWidth);return a>=b.length?null:b[a]}GetCellAtIndex(a,b){if(0>a||0>b||b>=this._tileCells.length)return null;b=this._tileCells[b];return a>=b.length?null:b[a]}GetTileAt(a,b){a=Math.floor(a);b=Math.floor(b);if(0>a||0>b||a>=this._mapWidth||b>=this._mapHeight)return-1;const c=this.GetCellAt(a,b);return c?c.GetTilesArr()[b%this._cellHeight][a%
  this._cellWidth]:-1}SetTileAt(a,b,c){a=Math.floor(a);b=Math.floor(b);if(!(0>a||0>b||a>=this._mapWidth||b>=this._mapHeight)){var d=this.GetCellAt(a,b);d&&d.SetTileAt(a%this._cellWidth,b%this._cellHeight,c)}}WorldToCellX(a){return Math.floor((a-this.GetWorldInfo().GetX())/(this._cellWidth*this._tileWidth))}WorldToCellY(a){return Math.floor((a-this.GetWorldInfo().GetY())/(this._cellHeight*this._tileHeight))}WorldToTileX(a){return Math.floor((a-this.GetWorldInfo().GetX())/this._tileWidth)}WorldToTileY(a){return Math.floor((a-
  this.GetWorldInfo().GetY())/this._tileHeight)}GetMapWidth(){return this._mapWidth}GetMapHeight(){return this._mapHeight}GetTileWidth(){return this._tileWidth}GetTileHeight(){return this._tileHeight}GetCellWidth(){return this._cellWidth}GetCellHeight(){return this._cellHeight}GetCollisionRectCandidates(a,b){var c=this.WorldToCellX(a.getLeft());const d=this.WorldToCellY(a.getTop()),e=this.WorldToCellX(a.getRight());for(a=this.WorldToCellY(a.getBottom());c<=e;++c)for(let e=d;e<=a;++e){const a=this.GetCellAtIndex(c,
  e);a&&(a.MaybeBuildQuadMap(),g.appendArray(b,a.GetCollisionRects()))}}TestPointOverlapTile(a,b){var c=this.WorldToTileX(a),d=this.WorldToTileY(b);c=this.GetTileAt(c,d);if(-1===c)return!1;c=this._sdkType.GetTilePoly(c);if(!c)return!0;if(!this._sdkType.IsTilePolyEnabled(c))return!1;var e=this.GetWorldInfo();d=Math.floor((a-e.GetX())/this._tileWidth)*this._tileWidth+e.GetX();e=Math.floor((b-e.GetY())/this._tileHeight)*this._tileHeight+e.GetY();return c.containsPoint(a-d,b-e)}GetAllCollisionRects(a){const b=
  this._tileCells;for(let c=0,d=b.length;c<d;++c){const d=b[c];for(let b=0,c=d.length;b<c;++b){const c=d[b];c.MaybeBuildQuadMap();g.appendArray(a,c.GetCollisionRects())}}}GetCurrentImageInfo(){return this._ownImageInfo||this._objectClass.GetImageInfo()}GetTileUvQuad(a){const b=this._tileTexQuads;var c=b.get(a);if(c)return c;var d=a&v;c=0!==(a&l);const e=0!==(a&m),h=0!==(a&n);var f=this.GetCurrentImageInfo(),k=f.GetWidth(),p=this._tileWidth,w=this._tileXspacing;p=Math.floor((Math.floor((k-this._tileXoffset)/
  (p+w)*p)+w)/p);k=d%p;d=Math.floor(d/p);p=f.GetOffsetX()+this._tileXoffset+(this._tileWidth+this._tileXspacing)*k;w=f.GetOffsetY()+this._tileYoffset+(this._tileHeight+this._tileYspacing)*d;q.setWH(p,w,this._tileWidth,this._tileHeight);q.divide(f.GetSheetWidth(),f.GetSheetHeight());f=g.New(g.Quad);f.setFromRect(q);h&&f.diag();c&&f.mirror();e&&f.flip();f.offset(k,d);b.set(a,f);return f}_OnDynamicTextureLoadComplete(){this._tileTexQuads.clear();this._SetAllQuadMapChanged()}Draw(a){var b=this.GetCurrentImageInfo(),
  c=b.GetTexture();if(c){q.copy(b.GetTexRect());q.offsetLeft(this._tileXoffset/c.GetWidth());q.offsetTop(this._tileYoffset/c.GetHeight());a.SetTilemapFillMode();a.SetTilemapInfo(q,c.GetWidth(),c.GetHeight(),this._tileWidth,this._tileHeight,this._tileXspacing,this._tileYspacing);a.SetTexture(c);c=this.GetWorldInfo();if(c.GetWidth()!==this._lastWidth||c.GetHeight()!==this._lastHeight)this._SetPhysicsChanged(),this._SetAllQuadMapChanged(),this._lastWidth=c.GetWidth(),this._lastHeight=c.GetHeight();c.GetLayer().GetViewportForZ(c.GetTotalZElevation(),
  t);b=c.GetX();c=c.GetY();this._runtime.IsPixelRoundingEnabled()&&(b=Math.round(b),c=Math.round(c));var d=this._cellWidth*this._tileWidth,e=this._cellHeight*this._tileHeight,h=Math.floor((t.getLeft()-b)/d);d=Math.floor((t.getRight()-b)/d);var f=Math.floor((t.getTop()-c)/e);for(e=Math.floor((t.getBottom()-c)/e);h<=d;++h)for(let d=f;d<=e;++d){const e=this.GetCellAtIndex(h,d);e&&(e.MaybeBuildQuadMap(),e.Draw(a,t,b,c))}}}SaveToJson(){this._MaybeResizeTilemap();var a=this.GetWorldInfo();const b=Math.floor(a.GetWidth()/
  this._tileWidth);a=Math.floor(a.GetHeight()/this._tileHeight);return{tw:this._tileWidth,th:this._tileHeight,tox:this._tileXoffset,toy:this._tileYoffset,tsx:this._tileXspacing,tsy:this._tileYspacing,w:b,h:a,d:this.GetTilesAsRLECSV()}}LoadFromJson(a){this._tileWidth=a.tw;this._tileHeight=a.th;this._tileXoffset=a.tox;this._tileYoffset=a.toy;this._tileXspacing=a.tsx;this._tileYspacing=a.tsy;this._mapWidth=a.w;this._mapHeight=a.h;this._MaybeResizeTilemap(!0);this.SetTilesFromRLECSV(a.d);this._SetPhysicsChanged();
  this._SetAllQuadMapChanged()}GetAsJsonString(){this._MaybeResizeTilemap();var a=this.GetWorldInfo();const b=Math.floor(a.GetWidth()/this._tileWidth);a=Math.floor(a.GetHeight()/this._tileHeight);return JSON.stringify({c2tilemap:!0,width:b,height:a,data:this.GetTilesAsRLECSV()})}StateComboToFlags(a){switch(a){case 0:return 0;case 1:return l;case 2:return m;case 3:return l|n;case 4:return l|m;case 5:return m|n;case 6:return l|m|n;case 7:return n;default:return 0}}GetPropertyValueByIndex(a){switch(a){case 1:return this._tileWidth;
  case 2:return this._tileHeight;case 3:return this._tileXoffset;case 4:return this._tileYoffset;case 5:return this._tileXspacing;case 6:return this._tileYspacing}}SetPropertyValueByIndex(a,b){switch(a){case 1:if(this._tileWidth===b)break;this._tileWidth=Math.max(b,1);this._cellWidth=Math.ceil(this._runtime.GetOriginalViewportWidth()/this._tileWidth);this._sdkType._ForceCacheOfTileCollisionPolys();this._UpdateQuadMaps();break;case 2:if(this._tileHeight===b)break;this._tileHeight=Math.max(b,1);this._cellHeight=
  Math.ceil(this._runtime.GetOriginalViewportHeight()/this._tileHeight);this._sdkType._ForceCacheOfTileCollisionPolys();this._UpdateQuadMaps();break;case 3:if(this._tileXoffset===b)break;this._tileXoffset=b;this._UpdateQuadMaps();break;case 4:if(this._tileYoffset===b)break;this._tileYoffset=b;this._UpdateQuadMaps();break;case 5:if(this._tileXspacing===b)break;this._tileXspacing=b;this._UpdateQuadMaps();break;case 6:this._tileYspacing!==b&&(this._tileYspacing=b,this._UpdateQuadMaps())}}_UpdateQuadMaps(){this._tileTexQuads.clear();
  this._SetAllQuadMapChanged();this._MaybeBuildAllQuadMap()}GetScriptInterfaceClass(){return u}};const r=new WeakMap,u=self.ITilemapInstance=class extends self.IWorldInstance{constructor(){super();r.set(this,self.IInstance._GetInitInst().GetSdkInstance())}get mapWidth(){return r.get(this).GetMapWidth()}get mapHeight(){return r.get(this).GetMapHeight()}get tileWidth(){return r.get(this).GetTileWidth()}get tileHeight(){return r.get(this).GetTileHeight()}getTileAt(a,b){return r.get(this).GetTileAt(a,b)}setTileAt(a,
  b,c){return r.get(this).SetTileAt(a,b,c)}};u.TILE_FLIPPED_HORIZONTAL=l;u.TILE_FLIPPED_VERTICAL=m;u.TILE_FLIPPED_DIAGONAL=n;u.TILE_FLAGS_MASK=x;u.TILE_ID_MASK=v};
  
  
  'use strict';{const c=self.C3,e=c.Plugins.Tilemap.TILE_FLAGS_MASK,f=c.Plugins.Tilemap.TILE_ID_MASK;c.Plugins.Tilemap.Cnds={CompareTileAt(a,b,d,g){a=this.GetTileAt(a,b);-1!==a&&(a&=f);return c.compare(a,d,g)},CompareTileStateAt(a,b,d){a=this.GetTileAt(a,b);b=0;-1!==a&&(b=a&e);return b===this.StateComboToFlags(d)},OnURLLoaded(){return!0},OnURLFailed(){return!0}}};
  
  
  'use strict';{const g=self.C3,k=g.Plugins.Tilemap.TILE_ID_MASK;g.Plugins.Tilemap.Acts={EraseTile(b,a){this._MaybeResizeTilemap();this.SetTileAt(b,a,-1)},SetTile(b,a,c,d){this._MaybeResizeTilemap();this.SetTileAt(b,a,c&k|this.StateComboToFlags(d))},SetTileState(b,a,c){const d=this.GetTileAt(b,a);-1!==d&&(this._MaybeResizeTilemap(),this.SetTileAt(b,a,d&k|this.StateComboToFlags(c)))},EraseTileRange(b,a,c,d){const f=Math.floor(Math.max(b,0));var e=Math.floor(Math.max(a,0));b=Math.floor(Math.min(b+c,this._mapWidth));
  for(a=Math.floor(Math.min(a+d,this._mapHeight));e<a;++e)for(d=f;d<b;++d)this.SetTileAt(d,e,-1)},SetTileRange(b,a,c,d,f,e){this._MaybeResizeTilemap();const h=Math.floor(Math.max(b,0));var l=Math.floor(Math.max(a,0));b=Math.floor(Math.min(b+c,this._mapWidth));a=Math.floor(Math.min(a+d,this._mapHeight));for(f=f&k|this.StateComboToFlags(e);l<a;++l)for(e=h;e<b;++e)this.SetTileAt(e,l,f)},SetTileStateRange(b,a,c,d,f){this._MaybeResizeTilemap();const e=Math.floor(Math.max(b,0));var h=Math.floor(Math.max(a,
  0));b=Math.floor(Math.min(b+c,this._mapWidth));a=Math.floor(Math.min(a+d,this._mapHeight));for(f=this.StateComboToFlags(f);h<a;++h)for(d=e;d<b;++d)c=this.GetTileAt(d,h),-1!==c&&this.SetTileAt(d,h,c&k|f)},LoadFromJSON(b){let a=null;try{a=JSON.parse(b)}catch(c){console.error("[Construct 3] Failed to parse tilemap JSON: ",c);return}a.c2tilemap?(this._mapWidth=a.width,this._mapHeight=a.height,this._MaybeResizeTilemap(!0),this.SetTilesFromRLECSV(a.data),this._SetAllQuadMapChanged(),this._SetPhysicsChanged()):
  console.error("[Construct 3] Unrecognized JSON data format")},JSONDownload(b){const a=URL.createObjectURL(new Blob([this.GetAsJsonString()],{type:"application/json"}));this._runtime.InvokeDownload(a,b)},async LoadURL(b,a){if(!this._ownImageInfo||this._ownImageInfo.GetURL()!==b){a=this._runtime;var c=g.New(g.ImageInfo);await c.LoadDynamicAsset(a,b);if(c.IsLoaded()){if(this.WasReleased())return c.Release(),null;await c.LoadStaticTexture(a.GetWebGLRenderer(),{sampling:this._runtime.GetSampling()})&&
  (this.WasReleased()?c.Release():(this._ReleaseOwnImage(),this._ownImageInfo=c,a.UpdateRender(),this._tileTexQuads.clear(),this._SetAllQuadMapChanged(),await this.TriggerAsync(g.Plugins.Tilemap.Cnds.OnURLLoaded)))}else this.Trigger(g.Plugins.Tilemap.Cnds.OnURLFailed)}}}};
  
  
  'use strict';{const c=self.C3,d=c.Plugins.Tilemap.TILE_ID_MASK;c.Plugins.Tilemap.Exps={TileAt(a,b){a=this.GetTileAt(a,b);return-1===a?-1:a&d},PositionToTileX(a){return this.WorldToTileX(a)},PositionToTileY(a){return this.WorldToTileY(a)},TileToPositionX(a){return a*this._tileWidth+this.GetWorldInfo().GetX()+this._tileWidth/2},TileToPositionY(a){return a*this._tileHeight+this.GetWorldInfo().GetY()+this._tileHeight/2},SnapX(a){const b=this.GetWorldInfo().GetX();return Math.floor((a-b)/this._tileWidth)*
  this._tileWidth+b+this._tileWidth/2},SnapY(a){const b=this.GetWorldInfo().GetY();return Math.floor((a-b)/this._tileHeight)*this._tileHeight+b+this._tileHeight/2},TilesJSON(){return this.GetAsJsonString()}}};
  
  
  'use strict';{const a=self.C3,k=a.Plugins.Tilemap.TILE_FLIPPED_HORIZONTAL,l=a.Plugins.Tilemap.TILE_FLIPPED_VERTICAL,m=a.Plugins.Tilemap.TILE_FLIPPED_DIAGONAL,n=a.Plugins.Tilemap.TILE_ID_MASK,c=a.New(a.Rect),g=a.New(a.Quad);a.Plugins.Tilemap.TileQuad=class extends a.DefendedBase{constructor(){super();this._tileId=this._id=-1;this._isDiagFlip=this._isVertFlip=this._isHorizFlip=!1;this._rc=a.New(a.Rect);this._uv=null}Update(b,d,e,f,h,p,q,r){this._id=b;this._tileId=b&n;this._isHorizFlip=0!==(b&k);this._isVertFlip=
  0!==(b&l);this._isDiagFlip=0!==(b&m);this._rc.setWH(f*d+p,h*e+q,d,e);this._uv=r.GetTileUvQuad(this._id)}Draw(b,d,e,f,h){c.copy(this._rc);c.offset(e,f);c.intersectsRect(d)&&(g.setFromRect(c),b.Quad4(g,this._uv))}}};
  
  
  'use strict';{const a=self.C3;a.Plugins.Tilemap.TileCollisionRect=class extends a.DefendedBase{constructor(){super();this._id=-1;this._poly=null;this._rc=a.New(a.Rect)}Update(b,e,c,d,f,g,h,k){this._id=b;this._poly=e;this._rc.setWH(f*c+h,g*d+k,c,d)}ExtendRight(b){this._rc.setRight(this._rc.getRight()+b)}GetTileId(){return this._id}HasPoly(){return!!this._poly}GetPoly(){return this._poly}GetRect(){return this._rc}}};
  
  
  'use strict';{const k=self.C3;k.Plugins.Tilemap.TileCell=class extends k.DefendedBase{constructor(a,c,b){super();const e=a.GetCellWidth(),g=a.GetCellHeight();this._sdkInst=a;this._x=c;this._y=b;this._left=this._x*e*a.GetTileWidth();this._top=this._y*g*a.GetTileHeight();this._tiles=[];this._quads=[];this._collisionRects=[];this._isQuadMapValid=!1;for(a=0;a<g;++a)c=new Int32Array(e),c.fill(-1),this._tiles.push(c)}Clear(){const a=this._sdkInst.GetCellWidth();var c=this._sdkInst.GetCellHeight();const b=
  this._tiles;if(b.length<c)for(let e=b.length;e<c;++e)b.push(new Int32Array(a));else b.length>c&&k.truncateArray(b,c);for(let e=0,g=b.length;e<g;++e)c=b[e],c.length!==a&&(c=new Int32Array(a),b[e]=c),c.fill(-1)}_SetQuadMapChanged(){this._isQuadMapValid=!1}MaybeBuildQuadMap(){if(!this._isQuadMapValid){var a=this._sdkInst,c=a.GetSdkType(),b=a.GetWorldInfo(),e=a.GetTileWidth(),g=a.GetTileHeight(),q=a.GetCellWidth(),d=a.GetCellHeight(),f=this._left,l=this._top;if(!(0>=e||0>=g)){var r=Math.min(a.GetMapWidth(),
  Math.floor(b.GetWidth()/e));b=Math.min(a.GetMapHeight(),Math.floor(b.GetHeight()/g));r-=f/e;b-=l/g;r>q&&(r=q);b>d&&(b=d);q=this._tiles;d=this._quads;var h=0;for(var m=0;m<b;++m){var u=q[m];for(var n=0;n<r;++n){var t=u[n];if(-1!==t){var p=void 0;h<d.length?p=d[h]:(p=k.New(k.Plugins.Tilemap.TileQuad),d.push(p));p.Update(t,e,g,n,m,f,l,a);++h}}}h<d.length&&k.truncateArray(d,h);d=null;h=!1;a=this._collisionRects;k.clearArray(a);for(m=0;m<b;++m){u=q[m];for(n=0;n<r;++n){t=u[n];p=c.GetTilePoly(t);const b=
  c.IsTilePolyEnabled(p);-1!==t&&b?!d||p||h?(d&&a.push(d),d=k.New(k.Plugins.Tilemap.TileCollisionRect),d.Update(t,p,e,g,n,m,f,l),h=!!p):d.ExtendRight(e):d&&(a.push(d),d=null,h=!1)}d&&(a.push(d),d=null,h=!1)}c=a.length;for(e=0;e<c;++e)if(f=a[e],!f.HasPoly())for(f=f.GetRect(),l=e+1;l<c;++l)r=a[l],b=r.GetRect(),b.getTop()<f.getBottom()||b.getTop()>f.getBottom()||b.getRight()>f.getRight()||b.getLeft()>f.getLeft()||r.HasPoly()||b.getLeft()!==f.getLeft()||b.getRight()!==f.getRight()||(a.splice(l,1),--c,f.setBottom(f.getBottom()+
  g),--l);this._isQuadMapValid=!0}}}SetTileAt(a,c,b){this._tiles[c][a]!==b&&(this._tiles[c][a]=b,this._isQuadMapValid=!1,this._sdkInst.SetTileChanged())}GetTilesArr(){return this._tiles}GetCollisionRects(){return this._collisionRects}Draw(a,c,b,e){const g=this._sdkInst,q=this._quads;for(let d=0,f=q.length;d<f;++d)q[d].Draw(a,c,b,e,g)}}};
  
  
  'use strict';{const a=self.C3;a.Plugins.TiledBg=class extends a.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}};
  
  
  'use strict';{var WrapModeToStr=function(a){switch(a){case 0:return"clamp-to-edge";case 2:return"mirror-repeat"}return"repeat"};const c=self.C3;c.Plugins.TiledBg.Type=class extends c.SDKTypeBase{constructor(a,b){super(a);this._wrapY=this._wrapX="repeat";b&&(this._wrapX=WrapModeToStr(b[0]),this._wrapY=WrapModeToStr(b[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 d=self.C3,k=d.New(d.Quad),g=d.New(d.Rect),l=d.New(d.Quad);d.Plugins.TiledBg.Instance=class extends d.SDKWorldInstanceBase{constructor(a,b){super(a);this._imageOffsetY=this._imageOffsetX=0;this._imageScaleY=this._imageScaleX=1;this._imageAngle=0;this._ownImageInfo=null;b&&(this.GetWorldInfo().SetVisible(!!b[0]),this._imageOffsetX=b[4],this._imageOffsetY=b[5],this._imageScaleX=b[6],this._imageScaleY=b[7],this._imageAngle=d.toRadians(b[8]))}Release(){this._ReleaseOwnImage();super.Release()}_ReleaseOwnImage(){this._ownImageInfo&&
  (this._ownImageInfo.Release(),this._ownImageInfo=null)}Draw(a){var b=this.GetCurrentImageInfo(),f=b.GetTexture();if(f){var e=this.GetWorldInfo(),h=e.GetBoundingQuad();a.SetTexture(f);f=b.GetWidth();b=b.GetHeight();var m=this._imageOffsetX/f,n=this._imageOffsetY/b;g.set(0,0,e.GetWidth()/(f*this._imageScaleX),e.GetHeight()/(b*this._imageScaleY));g.offset(-m,-n);this._runtime.IsPixelRoundingEnabled()&&(f=Math.round(e.GetX())-e.GetX(),e=Math.round(e.GetY())-e.GetY(),k.copy(h),k.offset(f,e),h=k);0===this._imageAngle?
  a.Quad3(h,g):(l.setFromRotatedRect(g,-this._imageAngle),a.Quad4(h,l))}}GetCurrentImageInfo(){return this._ownImageInfo||this._objectClass.GetImageInfo()}_SetImageOffsetX(a){this._imageOffsetX!==a&&(this._imageOffsetX=a,this._runtime.UpdateRender())}_GetImageOffsetX(){return this._imageOffsetX}_SetImageOffsetY(a){this._imageOffsetY!==a&&(this._imageOffsetY=a,this._runtime.UpdateRender())}_GetImageOffsetY(){return this._imageOffsetY}_SetImageScaleX(a){this._imageScaleX!==a&&(this._imageScaleX=a,this._runtime.UpdateRender())}_GetImageScaleX(){return this._imageScaleX}_SetImageScaleY(a){this._imageScaleY!==
  a&&(this._imageScaleY=a,this._runtime.UpdateRender())}_GetImageScaleY(){return this._imageScaleY}_SetImageAngle(a){this._imageAngle!==a&&(this._imageAngle=a,this._runtime.UpdateRender())}_GetImageAngle(){return this._imageAngle}GetPropertyValueByIndex(a){switch(a){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(a,b){switch(a){case 4:this._SetImageOffsetX(b);
  break;case 5:this._SetImageOffsetY(b);break;case 6:this._SetImageScaleX(b);break;case 7:this._SetImageScaleY(b);break;case 8:this._SetImageAngle(b)}}GetScriptInterfaceClass(){return self.ITiledBackgroundInstance}};const c=new WeakMap;self.ITiledBackgroundInstance=class extends self.IWorldInstance{constructor(){super();c.set(this,self.IInstance._GetInitInst().GetSdkInstance())}set imageOffsetX(a){c.get(this)._SetImageOffsetX(a)}get imageOffsetX(){return c.get(this)._GetImageOffsetX()}set imageOffsetY(a){c.get(this)._SetImageOffsetY(a)}get imageOffsetY(){return c.get(this)._GetImageOffsetY()}set imageScaleX(a){c.get(this)._SetImageScaleX(a)}get imageScaleX(){return c.get(this)._GetImageScaleX()}set imageScaleY(a){c.get(this)._SetImageScaleY(a)}get imageScaleY(){return c.get(this)._GetImageScaleY()}set imageAngle(a){c.get(this)._SetImageAngle(a)}get imageAngle(){return c.get(this)._GetImageAngle()}set imageAngleDegrees(a){c.get(this)._SetImageAngle(d.toRadians(a))}get imageAngleDegrees(){return d.toDegrees(c.get(this)._GetImageAngle())}}};
  
  
  'use strict';self.C3.Plugins.TiledBg.Cnds={OnURLLoaded(){return!0},OnURLFailed(){return!0}};
  
  
  'use strict';{const b=self.C3;b.Plugins.TiledBg.Acts={SetImageOffsetX(a){this._SetImageOffsetX(a)},SetImageOffsetY(a){this._SetImageOffsetY(a)},SetImageScaleX(a){this._SetImageScaleX(a/100)},SetImageScaleY(a){this._SetImageScaleY(a/100)},SetImageAngle(a){this._SetImageAngle(b.toRadians(a))},SetEffect(a){this.GetWorldInfo().SetBlendMode(a);this._runtime.UpdateRender()},async LoadURL(a,d){if(!this._ownImageInfo||this._ownImageInfo.GetURL()!==a){d=this._runtime;var c=b.New(b.ImageInfo);await c.LoadDynamicAsset(d,
  a);if(c.IsLoaded()){if(this.WasReleased())return c.Release(),null;await c.LoadStaticTexture(d.GetWebGLRenderer(),{sampling:this._runtime.GetSampling(),wrapX:"repeat",wrapY:"repeat"})&&(this.WasReleased()?c.Release():(this._ReleaseOwnImage(),this._ownImageInfo=c,d.UpdateRender(),await this.TriggerAsync(b.Plugins.TiledBg.Cnds.OnURLLoaded)))}else this.Trigger(b.Plugins.TiledBg.Cnds.OnURLFailed)}}}};
  
  
  'use strict';{const a=self.C3;a.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 a.toDegrees(this._imageAngle)}}};
  
  
  'use strict';{const a=self.C3;a.Plugins.Text=class extends a.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}};
  
  
  'use strict';{const a=self.C3;a.Plugins.Text.Type=class extends a.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}LoadTextures(b){}ReleaseTextures(){}}};
  
  
  'use strict';{const d=self.C3,h=[0,0,0],l=["left","center","right"],m=["top","center","bottom"],n=new d.Rect,k=new d.Quad;d.Plugins.Text.Instance=class extends d.SDKWorldInstanceBase{constructor(a,b){super(a);this._text="";this._enableBBcode=!0;this._faceName="Arial";this._ptSize=12;this._lineHeightOffset=0;this._isItalic=this._isBold=!1;this._color=d.New(d.Color);this._verticalAlign=this._horizontalAlign=0;this._wrapByWord=!0;this._typewriterEndTime=this._typewriterStartTime=-1;this._typewriterLength=
  0;this._rendererText=d.New(d.Gfx.RendererText,this._runtime.GetWebGLRenderer(),{timeout:5});this._rendererText.ontextureupdate=()=>this._runtime.UpdateRender();this._rendererText.SetIsAsync(!1);b&&(this._text=b[0],this._enableBBcode=!!b[1],this._faceName=b[2],this._ptSize=b[3],this._lineHeightOffset=b[4],this._isBold=!!b[5],this._isItalic=!!b[6],this._horizontalAlign=b[8],this._verticalAlign=b[9],this._wrapByWord=0===b[10],a=b[7],this._color.setRgb(a[0],a[1],a[2]),this.GetWorldInfo().SetVisible(b[11]));
  this._UpdateTextSettings()}Release(){this._CancelTypewriter();this._rendererText.Release();this._rendererText=null;super.Release()}_UpdateTextSettings(){const a=this._rendererText;a.SetText(this._text);a.SetBBCodeEnabled(this._enableBBcode);a.SetFontName(this._faceName);a.SetFontSize(this._ptSize);a.SetLineHeight(this._lineHeightOffset);a.SetBold(this._isBold);a.SetItalic(this._isItalic);a.SetColor(this._color);a.SetHorizontalAlignment(l[this._horizontalAlign]);a.SetVerticalAlignment(m[this._verticalAlign]);
  a.SetWordWrapMode(this._wrapByWord?"word":"character")}_UpdateTextSize(){const a=this.GetWorldInfo();var b=a.GetLayer();b=b.GetRenderScale()*b.Get2DScaleFactorToZ(a.GetTotalZElevation());this._rendererText.SetSize(a.GetWidth(),a.GetHeight(),b)}Draw(a){var b=this.GetWorldInfo();this._UpdateTextSize();const g=this._rendererText.GetTexture();if(g){var f=b.GetLayer(),e=b.GetBoundingQuad();if(0===b.GetAngle()&&0===b.GetLayer().GetAngle()&&0===b.GetTotalZElevation()){const [c,d]=f.LayerToDrawSurface(e.getTlx(),
  e.getTly()),[h,l]=f.LayerToDrawSurface(e.getBrx(),e.getBry());e=c-Math.round(c);b=d-Math.round(d);n.set(c,d,h,l);n.offset(-e,-b);k.setFromRect(n);const [m,p]=a.GetRenderTargetSize(a.GetRenderTarget());this._runtime.GetCanvasManager().SetDeviceTransform(a,m,p);a.SetTexture(g);a.Quad3(k,this._rendererText.GetTexRect());f._SetTransform(a)}else{b=f=0;this._runtime.IsPixelRoundingEnabled()&&(f=e.getTlx()-Math.round(e.getTlx()),b=e.getTly()-Math.round(e.getTly()));if(0!==f||0!==b)k.copy(e),k.offset(-f,
  -b),e=k;a.SetTexture(g);a.Quad3(e,this._rendererText.GetTexRect())}}}SaveToJson(){const a={t:this._text,c:this._color.toJSON(),fn:this._faceName,ps:this._ptSize};this._enableBBcode&&(a.bbc=this._enableBBcode);0!==this._horizontalAlign&&(a.ha=this._horizontalAlign);0!==this._verticalAlign&&(a.va=this._verticalAlign);this._wrapByWord||(a.wr=this._wrapByWord);0!==this._lineHeightOffset&&(a.lho=this._lineHeightOffset);this._isBold&&(a.b=this._isBold);this._isItalic&&(a.i=this._isItalic);-1!==this._typewriterEndTime&&
  (a.tw={st:this._typewriterStartTime,en:this._typewriterEndTime,l:this._typewriterLength});return a}LoadFromJson(a){this._CancelTypewriter();this._text=a.t;this._color.setFromJSON(a.c);this._faceName=a.fn;this._ptSize=a.ps;this._enableBBcode=a.hasOwnProperty("bbc")?a.bbc:!1;this._horizontalAlign=a.hasOwnProperty("ha")?a.ha:0;this._verticalAlign=a.hasOwnProperty("va")?a.va:0;this._wrapByWord=a.hasOwnProperty("wr")?a.wr:!0;this._lineHeightOffset=a.hasOwnProperty("lho")?a.lho:0;this._isBold=a.hasOwnProperty("b")?
  a.b:!1;this._isItalic=a.hasOwnProperty("i")?a.i:!1;a.hasOwnProperty("tw")&&(a=a.tw,this._typewriterStartTime=a.st,this._typewriterEndTime=a.en,this._typewriterLength=a.l);this._UpdateTextSettings();-1!==this._typewriterEndTime&&this._StartTicking()}GetPropertyValueByIndex(a){switch(a){case 0:return this._text;case 1:return this._enableBBcode;case 2:return this._faceName;case 3:return this._ptSize;case 4:return this._lineHeightOffset;case 5:return this._isBold;case 6:return this._isItalic;case 7:return h[0]=
  this._color.getR(),h[1]=this._color.getG(),h[2]=this._color.getB(),h;case 8:return this._horizontalAlign;case 9:return this._verticalAlign;case 10:return this._wrapByWord?1:0}}SetPropertyValueByIndex(a,b){switch(a){case 0:if(this._text===b)break;this._text=b;this._UpdateTextSettings();break;case 1:if(this._enableBBcode===!!b)break;this._enableBBcode=!!b;this._UpdateTextSettings();break;case 2:if(this._faceName===b)break;this._faceName=b;this._UpdateTextSettings();break;case 3:if(this._ptSize===b)break;
  this._ptSize=b;this._UpdateTextSettings();break;case 4:if(this._lineHeightOffset===b)break;this._lineHeightOffset=b;this._UpdateTextSettings();break;case 5:if(this._isBold===!!b)break;this._isBold=!!b;this._UpdateTextSettings();break;case 6:if(this._isItalic===!!b)break;this._isItalic=!!b;this._UpdateTextSettings();break;case 7:a=this._color;if(a.getR()===b[0]&&a.getG()===b[1]&&a.getB()===b[2])break;this._color.setRgb(b[0],b[1],b[2]);this._UpdateTextSettings();break;case 8:if(this._horizontalAlign===
  b)break;this._horizontalAlign=b;this._UpdateTextSettings();break;case 9:if(this._verticalAlign===b)break;this._verticalAlign=b;this._UpdateTextSettings();break;case 10:this._wrapByWord!==(0===b)&&(this._wrapByWord=0===b,this._UpdateTextSettings())}}SetPropertyColorOffsetValueByIndex(a,b,g,f){if(0!==b||0!==g||0!==f)switch(a){case 7:this._color.addRgb(b,g,f),this._UpdateTextSettings()}}_SetText(a){this._text!==a&&(this._text=a,this._rendererText.SetText(a),this._runtime.UpdateRender())}GetText(){return this._text}_StartTypewriter(a,
  b){this._SetText(a);this._typewriterStartTime=this._runtime.GetGameTime();this._typewriterEndTime=this._typewriterStartTime+b;this._typewriterLength=d.BBString.StripAnyTags(a).length;this._rendererText.SetDrawMaxCharacterCount(0);this._StartTicking()}_CancelTypewriter(){this._typewriterEndTime=this._typewriterStartTime=-1;this._typewriterLength=0;this._rendererText.SetDrawMaxCharacterCount(-1);this._StopTicking()}_FinishTypewriter(){-1!==this._typewriterEndTime&&(this._CancelTypewriter(),this.Trigger(d.Plugins.Text.Cnds.OnTypewriterTextFinished),
  this._runtime.UpdateRender())}_SetFontFace(a){this._faceName!==a&&(this._faceName=a,this._rendererText.SetFontName(a),this._runtime.UpdateRender())}_GetFontFace(){return this._faceName}_SetBold(a){a=!!a;this._isBold!==a&&(this._isBold=a,this._rendererText.SetBold(a),this._runtime.UpdateRender())}_IsBold(){return this._isBold}_SetItalic(a){a=!!a;this._isItalic!==a&&(this._isItalic=a,this._rendererText.SetItalic(a),this._runtime.UpdateRender())}_IsItalic(){return this._isItalic}_SetFontSize(a){this._ptSize!==
  a&&(this._ptSize=a,this._rendererText.SetFontSize(this._ptSize),this._runtime.UpdateRender())}_GetFontSize(){return this._ptSize}_SetLineHeight(a){this._lineHeightOffset!==a&&(this._lineHeightOffset=a,this._UpdateTextSettings(),this._runtime.UpdateRender())}_GetLineHeight(){return this._lineHeightOffset}_SetHAlign(a){this._horizontalAlign!==a&&(this._horizontalAlign=a,this._UpdateTextSettings(),this._runtime.UpdateRender())}_GetHAlign(){return this._horizontalAlign}_SetVAlign(a){this._verticalAlign!==
  a&&(this._verticalAlign=a,this._UpdateTextSettings(),this._runtime.UpdateRender())}_GetVAlign(){return this._verticalAlign}_SetWrapByWord(a){a=!!a;this._wrapByWord!==a&&(this._wrapByWord=a,this._UpdateTextSettings(),this._runtime.UpdateRender())}_IsWrapByWord(){return this._wrapByWord}Tick(){var a=this._runtime.GetGameTime();a>=this._typewriterEndTime?(this._CancelTypewriter(),this.Trigger(d.Plugins.Text.Cnds.OnTypewriterTextFinished),this._runtime.UpdateRender()):(a=d.relerp(this._typewriterStartTime,
  this._typewriterEndTime,a,0,this._typewriterLength),a=Math.floor(a),a!==this._rendererText.GetDrawMaxCharacterCount()&&(this._rendererText.SetDrawMaxCharacterCount(a),this._runtime.UpdateRender()))}GetDebuggerProperties(){return[{title:"plugins.text.name",properties:[{name:"plugins.text.properties.text.name",value:this._text,onedit:a=>this._SetText(a)}]}]}GetScriptInterfaceClass(){return self.ITextInstance}};const c=new WeakMap,p=new Map([["left",0],["center",1],["right",2]]),q=new Map([["top",0],
  ["center",1],["bottom",2]]),r=new Map([["word",!0],["character",!1]]);self.ITextInstance=class extends self.IWorldInstance{constructor(){super();c.set(this,self.IInstance._GetInitInst().GetSdkInstance())}get text(){return c.get(this).GetText()}set text(a){const b=c.get(this);b._CancelTypewriter();b._SetText(a)}typewriterText(a,b){const g=c.get(this);g._CancelTypewriter();g._StartTypewriter(a,b)}typewriterFinish(){c.get(this)._FinishTypewriter()}set fontFace(a){c.get(this)._SetFontFace(a)}get fontFace(){return c.get(this)._GetFontFace()}set isBold(a){c.get(this)._SetBold(a)}get isBold(){return c.get(this)._IsBold()}set isItalic(a){c.get(this)._SetItalic(a)}get isItalic(){return c.get(this)._IsItalic()}set sizePt(a){c.get(this)._SetFontSize(a)}get sizePt(){return c.get(this)._GetFontSize()}set lineHeight(a){c.get(this)._SetLineHeight(a)}get lineHeight(){return c.get(this)._GetLineHeight()}set horizontalAlign(a){a=
  p.get(a);if("undefined"===typeof a)throw Error("invalid mode");c.get(this)._SetHAlign(a)}get horizontalAlign(){return l[c.get(this)._GetHAlign()]}set verticalAlign(a){a=q.get(a);if("undefined"===typeof a)throw Error("invalid mode");c.get(this)._SetVAlign(a)}get verticalAlign(){return m[c.get(this)._GetVAlign()]}set wordWrapMode(a){a=r.get(a);if("undefined"===typeof a)throw Error("invalid mode");c.get(this)._SetWrapByWord(a)}get wordWrapMode(){return c.get(this)._IsWrapByWord()?"word":"character"}}};
  
  
  'use strict';{const a=self.C3;a.Plugins.Text.Cnds={CompareText(b,c){return c?this._text===b:a.equalsNoCase(this._text,b)},IsRunningTypewriterText(){return-1!==this._typewriterEndTime},OnTypewriterTextFinished(){return!0}}};
  
  
  'use strict';{const f=self.C3,b=f.New(f.Color);f.Plugins.Text.Acts={SetText(a){this._CancelTypewriter();"number"===typeof a&&1E9>a&&(a=Math.round(1E10*a)/1E10);this._SetText(a.toString())},AppendText(a){this._CancelTypewriter();"number"===typeof a&&1E9>a&&(a=Math.round(1E10*a)/1E10);(a=a.toString())&&this._SetText(this._text+a)},TypewriterText(a,c){this._CancelTypewriter();"number"===typeof a&&1E9>a&&(a=Math.round(1E10*a)/1E10);this._StartTypewriter(a.toString(),c)},SetFontFace(a,c){let d=!1,e=!1;
  switch(c){case 1:d=!0;break;case 2:e=!0;break;case 3:e=d=!0}if(a!==this._faceName||d!==this._isBold||e!==this._isItalic)this._SetFontFace(a),this._SetBold(d),this._SetItalic(e)},SetFontSize(a){this._SetFontSize(a)},SetFontColor(a){b.setFromRgbValue(a);b.clamp();this._color.equalsIgnoringAlpha(b)||(this._color.copyRgb(b),this._rendererText.SetColor(this._color),this._runtime.UpdateRender())},SetWebFont(a,c){console.warn("[Text] 'Set web font' action is deprecated and no longer has any effect")},SetEffect(a){this.GetWorldInfo().SetBlendMode(a);
  this._runtime.UpdateRender()},TypewriterFinish(){this._FinishTypewriter()},SetLineHeight(a){this._SetLineHeight(a)},SetHAlign(a){this._SetHAlign(a)},SetVAlign(a){this._SetVAlign(a)},SetWrapping(a){this._SetWrapByWord(0===a)}}};
  
  
  'use strict';{const a=self.C3;a.Plugins.Text.Exps={Text(){return this._text},PlainText(){return this._enableBBcode?a.BBString.StripAnyTags(this._text):this._text},FaceName(){return this._faceName},FaceSize(){return this._ptSize},TextWidth(){this._UpdateTextSize();return this._rendererText.GetTextWidth()},TextHeight(){this._UpdateTextSize();return this._rendererText.GetTextHeight()},LineHeight(){return this._lineHeightOffset}}};
  
  
  'use strict';{const a=self.C3;a.Plugins.Keyboard=class extends a.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}};
  
  
  'use strict';{var GetKeyboardSdkInstance=function(){return b.GetSingleGlobalInstance().GetSdkInstance()};const c=self.C3;c.Plugins.Keyboard.Type=class extends c.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.IKeyboardObjectType}};let b=null;self.IKeyboardObjectType=class extends self.IObjectClass{constructor(a){super(a);b=a;a.GetRuntime()._GetCommonScriptInterfaces().keyboard=this}isKeyDown(a){const d=GetKeyboardSdkInstance();if("string"===
  typeof a)return d.IsKeyDown(a);if("number"===typeof a)return d.IsKeyCodeDown(a);throw new TypeError("expected string or number");}}};
  
  
  'use strict';{const b=self.C3;b.Plugins.Keyboard.Instance=class extends b.SDKInstanceBase{constructor(a,c){super(a);this._keysDownByString=new Set;this._keysDownByWhich=new Set;this._triggerWhich=0;this._triggerTypedKey=this._triggerString="";a=this.GetRuntime().Dispatcher();this._disposables=new b.CompositeDisposable(b.Disposable.From(a,"keydown",a=>this._OnKeyDown(a.data)),b.Disposable.From(a,"keyup",a=>this._OnKeyUp(a.data)),b.Disposable.From(a,"window-blur",()=>this._OnWindowBlur()))}Release(){super.Release()}_OnKeyDown(a){const c=
  a.which,d=a.code||c.toString();a=a.key;this._keysDownByString.has(d)||(this._keysDownByString.add(d),this._keysDownByWhich.add(c),this._triggerString=d,this._triggerWhich=c,this._triggerTypedKey=a,this.Trigger(b.Plugins.Keyboard.Cnds.OnAnyKey),this.Trigger(b.Plugins.Keyboard.Cnds.OnKey),this.Trigger(b.Plugins.Keyboard.Cnds.OnLeftRightKeyPressed),this.Trigger(b.Plugins.Keyboard.Cnds.OnKeyCode))}_OnKeyUp(a){const c=a.which,d=a.code||c.toString();a=a.key;this._keysDownByString.delete(d);this._keysDownByWhich.delete(c);
  this._triggerString=d;this._triggerWhich=c;this._triggerTypedKey=a;this.Trigger(b.Plugins.Keyboard.Cnds.OnAnyKeyReleased);this.Trigger(b.Plugins.Keyboard.Cnds.OnKeyReleased);this.Trigger(b.Plugins.Keyboard.Cnds.OnLeftRightKeyReleased);this.Trigger(b.Plugins.Keyboard.Cnds.OnKeyCodeReleased)}_OnWindowBlur(){for(const a of this._keysDownByWhich)this._keysDownByWhich.delete(a),this._triggerWhich=a,this.Trigger(b.Plugins.Keyboard.Cnds.OnAnyKeyReleased),this.Trigger(b.Plugins.Keyboard.Cnds.OnKeyReleased),
  this.Trigger(b.Plugins.Keyboard.Cnds.OnKeyCodeReleased);this._keysDownByString.clear()}IsKeyDown(a){return this._keysDownByString.has(a)}IsKeyCodeDown(a){return this._keysDownByWhich.has(a)}SaveToJson(){return{tk:this._triggerWhich,tkk:this._triggerTypedKey}}LoadFromJson(a){this._triggerWhich=a.tk;a.hasOwnProperty("tkk")&&(this._triggerTypedKey=a.tkk)}GetDebuggerProperties(){return[{title:"plugins.keyboard.name",properties:[{name:"plugins.keyboard.debugger.last-key-code",value:this._triggerWhich},
  {name:"plugins.keyboard.debugger.last-key-string",value:b.Plugins.Keyboard.Exps.StringFromKeyCode(this._triggerWhich)},{name:"plugins.keyboard.debugger.last-typed-key",value:this._triggerTypedKey}]}]}}};
  
  
  'use strict';{const b="ShiftLeft ShiftRight ControlLeft ControlRight AltLeft AltRight MetaLeft MetaRight".split(" ");self.C3.Plugins.Keyboard.Cnds={IsKeyDown(a){return this._keysDownByWhich.has(a)},OnKey(a){return this._triggerWhich===a},OnAnyKey(){return!0},OnAnyKeyReleased(){return!0},OnKeyReleased(a){return this._triggerWhich===a},IsKeyCodeDown(a){a=Math.floor(a);return this._keysDownByWhich.has(a)},OnKeyCode(a){return this._triggerWhich===a},OnKeyCodeReleased(a){return this._triggerWhich===a},
  OnLeftRightKeyPressed(a){return this._triggerString===b[a]},OnLeftRightKeyReleased(a){return this._triggerString===b[a]},IsLeftRightKeyDown(a){return this._keysDownByString.has(b[a])}}};
  
  
  'use strict';self.C3.Plugins.Keyboard.Acts={};
  
  
  'use strict';var StringFromCharCode=function(a){a=Math.floor(a);switch(a){case 8:return"backspace";case 9:return"tab";case 13:return"enter";case 16:return"shift";case 17:return"control";case 18:return"alt";case 19:return"pause";case 20:return"capslock";case 27:return"esc";case 33:return"pageup";case 34:return"pagedown";case 35:return"end";case 36:return"home";case 37:return"\u2190";case 38:return"\u2191";case 39:return"\u2192";case 40:return"\u2193";case 45:return"insert";case 46:return"del";case 91:return"left window key";
  case 92:return"right window key";case 93:return"select";case 96:return"numpad 0";case 97:return"numpad 1";case 98:return"numpad 2";case 99:return"numpad 3";case 100:return"numpad 4";case 101:return"numpad 5";case 102:return"numpad 6";case 103:return"numpad 7";case 104:return"numpad 8";case 105:return"numpad 9";case 106:return"numpad *";case 107:return"numpad +";case 109:return"numpad -";case 110:return"numpad .";case 111:return"numpad /";case 112:return"F1";case 113:return"F2";case 114:return"F3";
  case 115:return"F4";case 116:return"F5";case 117:return"F6";case 118:return"F7";case 119:return"F8";case 120:return"F9";case 121:return"F10";case 122:return"F11";case 123:return"F12";case 144:return"numlock";case 145:return"scroll lock";case 186:return";";case 187:return"=";case 188:return",";case 189:return"-";case 190:return".";case 191:return"/";case 192:return"'";case 219:return"[";case 220:return"\\";case 221:return"]";case 222:return"#";case 223:return"`";default:return String.fromCharCode(a)}};
  self.C3.Plugins.Keyboard.Exps={LastKeyCode(){return this._triggerWhich},StringFromKeyCode(a){return StringFromCharCode(a)},TypedKey(){return this._triggerTypedKey}};
  
  
  'use strict';{const a=self.C3;a.Plugins.Particles=class extends a.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}};
  
  
  'use strict';{const b=self.C3;b.Plugins.Particles.Type=class extends b.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}LoadTextures(a){return this.GetImageInfo().LoadStaticTexture(a,{sampling:this._runtime.GetSampling()})}ReleaseTextures(){this.GetImageInfo().ReleaseTexture()}}};
  
  
  'use strict';{const d=self.C3,g=d.New(d.Rect);d.Plugins.Particles.Instance=class extends d.SDKWorldInstanceBase{constructor(a,b){super(a);this._isFirstTick=!0;this._particleEngine=a=d.New(self.ParticleEngine);a.ononeshotfinish=()=>this._OnOneShotFinish();this._spawnObjectClass=null;this._particleUpdateCallback=(a,b,c,d,g,k)=>this._OnParticleUpdate(a,b,c,d,g,k);this._particleDestroyCallback=a=>this._OnParticleDestroy(a);this._hasAnyDefaultParticle=!0;b&&(a.SetRate(b[0]),a.SetSprayCone(d.toRadians(b[1])),
  a.SetSprayType(b[2]?"one-shot":"continuous-spray"),this._SetParticleObjectClass(this._runtime.GetObjectClassBySID(b[3])),a.SetInitSpeed(b[4]),a.SetInitSize(b[5]),a.SetInitOpacity(b[6]/100),a.SetGrowRate(b[7]),a.SetInitXRandom(b[8]),a.SetInitYRandom(b[9]),a.SetInitSpeedRandom(b[10]),a.SetInitSizeRandom(b[11]),a.SetGrowRandom(b[12]),a.SetAcceleration(b[13]),a.SetGravity(b[14]),a.SetLifeAngleRandom(b[15]),a.SetLifeSpeedRandom(b[16]),a.SetLifeOpacityRandom(b[17]),a.SetDestroyModeIndex(b[18]),a.SetTimeout(b[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._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?a=>this._OnParticleCreate(a):null;this._spawnObjectClass||(this._hasAnyDefaultParticle=!0)}_UpdateEngineParameters(){const a=this._particleEngine,b=this.GetWorldInfo();a.SetMasterOpacity(b.GetOpacity());a.SetPixelRounding(this._runtime.IsPixelRoundingEnabled());a.SetSpawnX(b.GetX());a.SetSpawnY(b.GetY());a.SetSpawnAngle(b.GetAngle())}_OnOneShotFinish(){this._runtime.DestroyInstance(this._inst)}Draw(a){if(this._hasAnyDefaultParticle){var b=
  this._objectClass.GetImageInfo(),c=b.GetTexture();if(c){var e=this.GetWorldInfo(),f=e.GetLayer();f.GetViewportForZ(e.GetTotalZElevation(),g);a.SetTexture(c);c=f.Get2DScaleFactorToZ(e.GetTotalZElevation());this._particleEngine.SetParticleScale(f.GetRenderScale()*c);this._particleEngine.Draw(a,b.GetTexRect(),g)}}}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(a=>a.toJSON())}}LoadFromJson(a){var b=this._particleEngine;b.SetRate(a.r);b.SetSprayCone(a.sc);b.SetSprayType(a.st);b.SetInitSpeed(a.isp);b.SetInitSize(a.isz);
  b.SetInitOpacity(a.io);b.SetGrowRate(a.gr);b.SetInitXRandom(a.xr);b.SetInitYRandom(a.yr);b.SetInitSpeedRandom(a.spr);b.SetInitSizeRandom(a.szr);b.SetGrowRandom(a.grnd);b.SetAcceleration(a.acc);b.SetGravity(a.g);b.SetLifeAngleRandom(a.lar);b.SetLifeSpeedRandom(a.lsr);b.SetLifeOpacityRandom(a.lor);b.SetDestroyModeIndex(a.dm);b.SetTimeout(a.to);b.SetSpraying(a.s);b._SetCreateCounter(a.pcc);this._isFirstTick=a.ft;a=a.p;b.SetParticleCount(a.length);b=b.GetParticles();for(let c=0,d=b.length;c<d;++c)b[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 b=this._runtime.CreateInstance(this._spawnObjectClass,this.GetWorldInfo().GetLayer(),a.GetX(),a.GetY()),c=b.GetWorldInfo();c.SetSize(a.GetSize(),a.GetSize());
  c.SetAngle(a.GetAngle());c.SetOpacity(a.GetOpacity());c.SetBboxChanged();c.ZOrderMoveAdjacentToInstance(this.GetInstance(),!0);b._TriggerOnCreated();a.SetUpdateCallback(this._particleUpdateCallback);a.SetDestroyCallback(this._particleDestroyCallback);return b}_OnParticleUpdate(a,b,c,e,f,h){a.IsDestroyed()||(a=a.GetWorldInfo(),a.OffsetXY(b,c),a.SetSize(a.GetWidth()+e,a.GetHeight()+e),a.SetAngle(a.GetAngle()+f),a.SetOpacity(a.GetOpacity()+h),a.SetBboxChanged())}_OnParticleDestroy(a){a.IsDestroyed()||
  this._runtime.DestroyInstance(a)}GetPropertyValueByIndex(a){const b=this._particleEngine;switch(a){case 0:return b.GetRate();case 1:return d.toDegrees(b.GetSprayCone());case 2:return"one-shot"===b.GetSprayType()?1:0;case 4:return b.GetInitSpeed();case 5:return b.GetInitSize();case 6:return 100*b.GetInitOpacity();case 7:return b.GetGrowRate();case 8:return b.GetInitXRandom();case 9:return b.GetInitYRandom();case 10:return b.GetInitSpeedRandom();case 11:return b.GetInitSizeRandom();case 12:return b.GetGrowRandom();
  case 13:return b.GetAcceleration();case 14:return b.GetGravity();case 15:return b.GetLifeAngleRandom();case 16:return b.GetLifeSpeedRandom();case 17:return b.GetLifeOpacityRandom();case 18:return b.GetDestroyModeIndex();case 19:return b.GetTimeout()}}SetPropertyValueByIndex(a,b){const c=this._particleEngine;switch(a){case 0:c.SetRate(b);break;case 1:c.SetSprayCone(d.toRadians(b));break;case 2:c.SetSprayType(b?"one-shot":"continuous-spray");break;case 4:c.SetInitSpeed(b);break;case 5:c.SetInitSize(b);
  break;case 6:c.SetInitOpacity(b/100);break;case 7:c.SetGrowRate(b);break;case 8:c.SetInitXRandom(b);break;case 9:c.SetInitYRandom(b);break;case 10:c.SetInitSpeedRandom(b);break;case 11:c.SetInitSizeRandom(b);break;case 12:c.SetGrowRandom(b);break;case 13:c.SetAcceleration(b);break;case 14:c.SetGravity(b);break;case 15:c.SetLifeAngleRandom(b);break;case 16:c.SetLifeSpeedRandom(b);break;case 17:c.SetLifeOpacityRandom(b);break;case 18:c.SetDestroyModeIndex(b);break;case 19:c.SetTimeout(b)}}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:b=>a.SetSpraying(b)},{name:"plugins.particles.properties.rate.name",value:a.GetRate(),onedit:b=>a.SetRate(b)},{name:"plugins.particles.properties.spray-cone.name",
  value:d.toDegrees(a.GetSprayCone()),onedit:b=>a.SetSprayCone(d.toRadians(b))},{name:"plugins.particles.properties.speed.name",value:a.GetInitSpeed(),onedit:b=>a.SetInitSpeed(b)},{name:"plugins.particles.properties.size.name",value:a.GetInitSize(),onedit:b=>a.SetInitSize(b)},{name:"plugins.particles.properties.opacity.name",value:a.GetInitOpacity(),onedit:b=>a.SetInitOpacity(b)},{name:"plugins.particles.properties.grow-rate.name",value:a.GetGrowRate(),onedit:b=>a.SetGrowRate(b)},{name:"plugins.particles.properties.x-randomiser.name",
  value:a.GetInitXRandom(),onedit:b=>a.SetInitXRandom(b)},{name:"plugins.particles.properties.y-randomiser.name",value:a.GetInitYRandom(),onedit:b=>a.SetInitYRandom(b)},{name:"plugins.particles.properties.initial-speed-randomiser.name",value:a.GetInitSpeedRandom(),onedit:b=>a.SetInitSpeedRandom(b)},{name:"plugins.particles.properties.size-randomiser.name",value:a.GetInitSizeRandom(),onedit:b=>a.SetInitSizeRandom(b)},{name:"plugins.particles.properties.grow-rate-randomiser.name",value:a.GetGrowRandom(),
  onedit:b=>a.SetGrowRandom(b)},{name:"plugins.particles.properties.acceleration.name",value:a.GetAcceleration(),onedit:b=>a.SetAcceleration(b)},{name:"plugins.particles.properties.gravity.name",value:a.GetGravity(),onedit:b=>a.SetGravity(b)},{name:"plugins.particles.properties.angle-randomiser.name",value:a.GetLifeAngleRandom(),onedit:b=>a.SetLifeAngleRandom(b)},{name:"plugins.particles.properties.life-speed-randomiser.name",value:a.GetLifeSpeedRandom(),onedit:b=>a.SetLifeSpeedRandom(b)},{name:"plugins.particles.properties.opacity-randomiser.name",
  value:a.GetLifeOpacityRandom(),onedit:b=>a.SetLifeOpacityRandom(b)},{name:"plugins.particles.properties.timeout.name",value:a.GetTimeout(),onedit:b=>a.SetTimeout(b)}]}]}}};
  
  
  'use strict';self.C3.Plugins.Particles.Cnds={IsSpraying(){return this._particleEngine.IsSpraying()}};
  
  
  'use strict';{const b=self.C3;b.Plugins.Particles.Acts={SetSpraying(a){this._particleEngine.SetSpraying(0!==a)},SetRate(a){this._particleEngine.SetRate(a);"one-shot"===this._particleEngine.GetSprayType()&&this._isFirstTick&&this._particleEngine.SetParticleCount(a)},SetParticleObject(a){this._SetParticleObjectClass(a)},UnsetParticleObject(){this._SetParticleObjectClass(null)},SetSprayCone(a){this._particleEngine.SetSprayCone(b.toRadians(a))},SetInitSpeed(a){this._particleEngine.SetInitSpeed(a)},SetInitSize(a){this._particleEngine.SetInitSize(a)},
  SetInitOpacity(a){this._particleEngine.SetInitOpacity(a/100)},SetGrowRate(a){this._particleEngine.SetGrowRate(a)},SetXRandomiser(a){this._particleEngine.SetInitXRandom(a)},SetYRandomiser(a){this._particleEngine.SetInitYRandom(a)},SetSpeedRandomiser(a){this._particleEngine.SetInitSpeedRandom(a)},SetSizeRandomiser(a){this._particleEngine.SetInitSizeRandom(a)},SetGrowRateRandomiser(a){this._particleEngine.SetGrowRandom(a)},SetParticleAcc(a){this._particleEngine.SetAcceleration(a)},SetGravity(a){this._particleEngine.SetGravity(a)},
  SetAngleRandomiser(a){this._particleEngine.SetLifeAngleRandom(a)},SetLifeSpeedRandomiser(a){this._particleEngine.SetLifeSpeedRandom(a)},SetOpacityRandomiser(a){this._particleEngine.SetLifeOpacityRandom(a)},SetTimeout(a){this._particleEngine.SetTimeout(a)},SetEffect(a){this.GetWorldInfo().SetBlendMode(a);this._runtime.UpdateRender()}}};
  
  
  'use strict';{const a=self.C3;a.Plugins.Particles.Exps={ParticleCount(){return this._particleEngine.GetParticleCount()},Rate(){return this._particleEngine.GetRate()},SprayCone(){return a.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()},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 c=self.C3,d=[],k=new Set(["continuous-spray","one-shot"]),h=["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._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=this._initSize=this._initSpeed=this._spawnAngle=this._spawnY=this._spawnX=0;this._particleScale=1;this.onparticlecreate=this.ononeshotfinish=null;this._particles=[];this._boundingBox=new c.Rect;this._color=new c.Color}Release(){this.Cancel();c.clearArray(this._particles);this._color=this._boundingBox=this.onparticlecreate=this.ononeshotfinish=this._particles=null}Cancel(){const a=this._particles;for(let b=0,e=a.length;b<
  e;++b)a[b].Destroy();c.appendArray(d,a);c.clearArray(a);1E3<d.length&&c.truncateArray(d,1E3);this._isSpraying=!1}CreateOneShotSpray(){for(let a=0,b=this._rate;a<b;++a)this._CreateParticle();this._particles.length&&(this._isSpraying=!0)}_CreateParticle(){let a;d.length?(a=d.pop(),a.SetEngine(this)):a=c.New(self.Particle,this);this._particles.push(a);a.Init(this.onparticlecreate);return a}ReInitAllParticles(){const a=this._particles,b=this.onparticlecreate;for(let e=0,d=a.length;e<d;++e)a[e].Init(b)}SetParticleCount(a){var b=
  this._particles;if(a<b.length){a=b.length-a;for(let e=0;e<a;++e){const a=b.pop();a.Destroy();d.push(a)}1E3<d.length&&c.truncateArray(d,1E3)}else if(a>b.length)for(b=a-b.length,a=0;a<b;++a)this._CreateParticle()}GetParticles(){return this._particles}GetParticleCount(){return this._particles.length}Tick(a){this._SpawnContinuous(a);this._TickParticles(a);this._MaybeFinishOneShot()}_SpawnContinuous(a){if("continuous-spray"===this._sprayType&&this._isSpraying){this._createCounter+=a*this._rate;a=Math.floor(this._createCounter);
  this._createCounter-=a;for(let b=0;b<a;++b)this._CreateParticle()}}_SetCreateCounter(a){this._createCounter=a}_GetCreateCounter(){return this._createCounter}_TickParticles(a){const b=this._boundingBox;b.set(this._spawnX,this._spawnY,this._spawnX,this._spawnY);const e=this._particles;let f=0;for(let c=0,h=e.length;c<h;++c){const g=e[c];e[f]=g;g.Tick(a);g.IsActive()?(++f,b.expandToContain(g.GetBoundingBox())):(g.Destroy(),d.push(g))}c.truncateArray(e,f);1E3<d.length&&c.truncateArray(d,1E3)}_MaybeFinishOneShot(){if("one-shot"===
  this._sprayType&&0===this._particles.length&&this._isSpraying){if(this.ononeshotfinish)this.ononeshotfinish();this._isSpraying=!1}}Draw(a,b,e){a.SetPointTextureCoords(b);this._color.copy(a.GetColor());const f=this._particles;for(let c=0,d=f.length;c<d;++c){const d=f[c];e.intersectsRect(d.GetBoundingBox())&&d.Draw(a,b)}}GetColor(){return this._color}SetRate(a){this._rate=+a}GetRate(){return this._rate}SetSprayCone(a){this._sprayCone=+a}GetSprayCone(){return this._sprayCone}SetSprayType(a){if(!k.has(a))throw Error("invalid spray type");
  this._sprayType=a}GetSprayType(){return this._sprayType}SetSpraying(a){this._isSpraying=!!a}IsSpraying(){return this._isSpraying}SetMasterOpacity(a){this._masterOpacity=+a}GetMasterOpacity(){return this._masterOpacity}SetPixelRounding(a){this._isPixelRounding=!!a}IsPixelRounding(){return this._isPixelRounding}SetSpawnX(a){this._spawnX=+a}GetSpawnX(){return this._spawnX}SetSpawnY(a){this._spawnY=+a}GetSpawnY(){return this._spawnY}SetSpawnAngle(a){this._spawnAngle=+a}GetInitAngle(){return this._spawnAngle}SetInitSpeed(a){this._initSpeed=
  +a}GetInitSpeed(){return this._initSpeed}SetInitSize(a){this._initSize=+a}GetInitSize(){return this._initSize}SetInitOpacity(a){this._initOpacity=+a}GetInitOpacity(){return this._initOpacity}SetGrowRate(a){this._growRate=+a}GetGrowRate(){return this._growRate}SetInitXRandom(a){this._xRandom=+a}GetInitXRandom(){return this._xRandom}SetInitYRandom(a){this._yRandom=+a}GetInitYRandom(){return this._yRandom}SetInitSpeedRandom(a){this._initSpeedRandom=+a}GetInitSpeedRandom(){return this._initSpeedRandom}SetInitSizeRandom(a){this._initSizeRandom=
  +a}GetInitSizeRandom(){return this._initSizeRandom}SetGrowRandom(a){this._growRandom=+a}GetGrowRandom(){return this._growRandom}SetAcceleration(a){this._acceleration=+a}GetAcceleration(){return this._acceleration}SetGravity(a){this._gravity=+a}GetGravity(){return this._gravity}SetLifeAngleRandom(a){this._lifeAngleRandom=+a}GetLifeAngleRandom(){return this._lifeAngleRandom}SetLifeSpeedRandom(a){this._lifeSpeedRandom=+a}GetLifeSpeedRandom(){return this._lifeSpeedRandom}SetLifeOpacityRandom(a){this._lifeOpacityRandom=
  +a}GetLifeOpacityRandom(){return this._lifeOpacityRandom}SetDestroyMode(a){a=h.indexOf(a);if(-1===a)throw Error("invalid destroy mode");this._destroyMode=a}SetDestroyModeIndex(a){this.SetDestroyMode(h[a])}GetDestroyMode(){return h[this._destroyMode]}GetDestroyModeIndex(){return this._destroyMode}SetTimeout(a){this._timeout=+a}GetTimeout(){return this._timeout}SetParticleScale(a){this._particleScale=+a}GetParticleScale(){return this._particleScale}GetBoundingBox(){return this._boundingBox}}};
  
  
  'use strict';{var randomOffset=function(a){return Math.random()*a-a/2};const h=self.C3,n=new h.Quad,k=new h.Color,q=self.devicePixelRatio||1;let l=!1;self.Particle=class{constructor(a){this._engine=a;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 h.Rect;this._destroyCallback=this._updateCallback=this._userData=null}SetEngine(a){this._engine=a}Init(a){this._isActive=!0;this._x=this._engine.GetSpawnX()+
  randomOffset(this._engine.GetInitXRandom());this._y=this._engine.GetSpawnY()+randomOffset(this._engine.GetInitYRandom());this._speed=this._engine.GetInitSpeed()+randomOffset(this._engine.GetInitSpeedRandom());this._angle=this._engine.GetInitAngle()+randomOffset(this._engine.GetSprayCone());this._lastOpacity=this._opacity=this._engine.GetInitOpacity();this._size=this._engine.GetInitSize()+randomOffset(this._engine.GetInitSizeRandom());this._halfSize=this._size/2;this._grow=this._engine.GetGrowRate()+
  randomOffset(this._engine.GetGrowRandom());this._age=this._gs=0;this._UpdateBoundingBox();a?this._userData||(this._userData=a(this)):this._destroyCallback=this._updateCallback=this._userData=null}SetUpdateCallback(a){this._updateCallback=a}SetDestroyCallback(a){this._destroyCallback=a}Destroy(){const a=this._destroyCallback;a&&a(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(a){this._x=a[0];this._y=a[1];this._speed=a[2];this._angle=a[3];this._opacity=a[4];this._grow=a[5];this._size=a[6];this._gs=a[7];this._age=a[8];this._halfSize=this._size/2;this._UpdateBoundingBox()}Tick(a){var c=this._engine,b=this._speed*a,d=this._angle;const g=Math.cos(d)*b;b=Math.sin(d)*b+this._gs*a;this._x+=g;this._y+=b;d=this._grow*a;this._size+=d;this._halfSize=this._size/2;this._speed+=c.GetAcceleration()*a;this._gs+=c.GetGravity()*a;this._age+=a;this._UpdateBoundingBox();
  var f=c.GetLifeAngleRandom(),e=c.GetLifeSpeedRandom();const p=c.GetLifeOpacityRandom();let m=0;0!==f&&(m=randomOffset(f*a),this._angle+=m);0!==e&&(this._speed+=randomOffset(e*a));0!==p&&(this._opacity=h.clamp(this._opacity+randomOffset(p*a),0,1));a=1<=this._size&&(2===c.GetDestroyModeIndex()?0<this._speed:this._age<c.GetTimeout());(f=this._updateCallback)&&a&&(e=c.GetMasterOpacity()*this._opacity,0===c.GetDestroyModeIndex()&&(e*=1-this._age/c.GetTimeout()),c=e-this._lastOpacity,this._lastOpacity=
  e,f(this._userData,g,b,d,m,c));this._isActive=a}IsActive(){return this._isActive}GetBoundingBox(){return this._bbox}_UpdateBoundingBox(){const a=this._x,c=this._y,b=this._halfSize;this._bbox.set(a-b,c-b,a+b,c+b)}Draw(a,c){if(!this._userData){var b=this._engine,d=b.GetMasterOpacity()*this._opacity;0===b.GetDestroyModeIndex()&&(d*=1-this._age/b.GetTimeout());if(!(0>=d)){var g=this._size*b.GetParticleScale()*q;if(!(1>g)){var f=this._x,e=this._y;b.IsPixelRounding()&&(f=f+.5|0,e=e+.5|0);g>a.GetMaxPointSize()||
  g<a.GetMinPointSize()?(k.copy(b.GetColor()),k.multiplyAlpha(d),a.SetColor(k),l=!0,n.setFromRect(this._bbox),a.Quad3(n,c)):(l&&(a.SetColor(b.GetColor()),l=!1),a.Point(f,e,g,d))}}}}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 a=self.C3;a.Plugins.Audio=class extends a.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}};
  
  
  'use strict';{var GetAudioDOMInterface=function(){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");};const b=self.C3;b.Plugins.Audio.Type=class extends b.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.IAudioObjectType}};self.IAudioObjectType=class extends self.IObjectClass{constructor(a){super(a)}get audioContext(){return GetAudioDOMInterface().GetAudioContext()}get destinationNode(){return GetAudioDOMInterface().GetDestinationNode()}}};
  
  
  'use strict';{const d=self.C3,h=["interactive","balanced","playback"];d.Plugins.Audio.Instance=class extends d.SDKInstanceBase{constructor(a,b){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;a="interactive";b&&(this._timeScaleMode=b[0],this._saveLoadMode=b[1],this._playInBackground=b[2],a=h[b[3]],this._panningModel=b[4],this._distanceModel=b[5],this._listenerZ=-b[6],this._referenceDistance=b[7],this._maxDistance=b[8],this._rolloffFactor=b[9]);this._lastAIState=[];this._lastFxState=[];this._lastAnalysersData=[];this.AddDOMMessageHandlers([["state",
  a=>this._OnUpdateState(a)],["fxstate",a=>this._OnUpdateFxState(a)],["trigger",a=>this._OnTrigger(a)]]);b=this.GetRuntime().Dispatcher();this._disposables=new d.CompositeDisposable(d.Disposable.From(b,"instancedestroy",a=>this._OnInstanceDestroyed(a.instance)),d.Disposable.From(b,"afterload",()=>this._OnAfterLoad()),d.Disposable.From(b,"suspend",()=>this._OnSuspend()),d.Disposable.From(b,"resume",()=>this._OnResume()));this._runtime.AddLoadPromise(this.PostToDOMAsync("create-audio-context",{preloadList:this._runtime.GetAssetManager().GetAudioToPreload().map(a=>
  ({originalUrl:a.originalUrl,url:a.url,type:a.type,fileSize:a.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(a=>{this._sampleRate=a.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 b=a.tickCount,c=this._lastAIState.filter(a=>
  a.hasOwnProperty("placeholder")&&(a.placeholder>b||-1===a.placeholder));this._lastAIState=a.audioInstances;this._lastAnalysersData=a.analysers;0<c.length&&d.appendArray(this._lastAIState,c)}_OnUpdateFxState(a){this._lastFxState=a.fxstate}_GetFirstAudioStateByTag(a){for(const b of this._lastAIState)if(d.equalsNoCase(b.tag,a))return b;return null}_IsTagPlaying(a){return this._lastAIState.some(b=>d.equalsNoCase(a,b.tag)&&b.isPlaying)}_MaybeMarkAsPlaying(a,b,c,e){if(this._IsTagPlaying(a))return null;
  a={tag:a,duration:0,volume:e,isPlaying:!0,playbackTime:0,playbackRate:1,uid:-1,bufferOriginalUrl:"",bufferUrl:"",bufferType:"",isMusic:b,isLooping:c,isMuted:!1,resumePosition:0,pan:null,placeholder:-1};this._lastAIState.push(a);return a}async _OnTrigger(a){const b=a.type;this._triggerTag=a.tag;a=a.aiid;if("ended"===b){for(const b of this._lastAIState)if(b.aiid===a){b.isPlaying=!1;break}await this.TriggerAsync(d.Plugins.Audio.Cnds.OnEnded)}else"fade-ended"===b&&await this.TriggerAsync(d.Plugins.Audio.Cnds.OnFadeEnded)}Tick(){const a=
  {timeScale:this._runtime.GetTimeScale(),gameTime:this._runtime.GetGameTime(),instPans:this.GetInstancePans(),tickCount:this._runtime.GetTickCountNoSave()};if(this._listenerInst){const b=this._listenerInst.GetWorldInfo();this._listenerX=b.GetX();this._listenerY=b.GetY();a.listenerPos=[this._listenerX,this._listenerY,this._listenerZ]}this.PostToDOM("tick",a)}rotatePtAround(a,b,c,e,f){if(0===c)return[a,b];const g=Math.sin(c);c=Math.cos(c);a-=e;b-=f;const k=a*g;a=a*c-b*g;return[a+e,b*c+k+f]}GetInstancePans(){return this._lastAIState.filter(a=>
  -1!==a.uid).map(a=>this._runtime.GetInstanceByUID(a.uid)).filter(a=>a).map(a=>{const b=a.GetWorldInfo(),c=b.GetLayer().GetAngle(),[d,f]=this.rotatePtAround(b.GetX(),b.GetY(),-c,this._listenerX,this._listenerY);return{uid:a.GetUID(),x:d,y:f,angle:b.GetAngle()-c}})}GetAnalyserData(a,b){for(const c of this._lastAnalysersData)if(c.index===b&&d.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,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._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 b of this._lastAIState)(a=this._runtime.GetAssetManager().GetProjectAudioFileUrl(b.bufferOriginalUrl))?(b.bufferUrl=
  a.url,b.bufferType=a.type):b.bufferUrl=null;for(const a of Object.values(this._lastFxState))for(const c of a)c.hasOwnProperty("bufferOriginalUrl")&&(b=this._runtime.GetAssetManager().GetProjectAudioFileUrl(c.bufferOriginalUrl))&&(c.bufferUrl=b.url,c.bufferType=b.type);this.PostToDOM("load-state",{saveLoadMode:this._saveLoadMode,timeScale:this._runtime.GetTimeScale(),gameTime:this._runtime.GetGameTime(),listenerPos:[this._listenerX,this._listenerY,this._listenerZ],isSilent:this._isSilent,masterVolume:this._masterVolume,
  playing:this._lastAIState.filter(a=>null!==a.bufferUrl),effects:this._lastFxState})}GetDebuggerProperties(){const a=[];for(const [b,c]of Object.entries(this._lastFxState))a.push({name:"$"+b,value:c.map(a=>a.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((a,c)=>({name:"$#"+c,value:`${a.bufferOriginalUrl} ("${a.tag}") ${Math.round(10*
  a.playbackTime)/10} / ${Math.round(10*a.duration)/10}`}))]}]}}};
  
  
  'use strict';{const b=self.C3;b.Plugins.Audio.Cnds={OnEnded(a){return b.equalsNoCase(this._triggerTag,a)},OnFadeEnded(a){return b.equalsNoCase(this._triggerTag,a)},PreloadsComplete(){return this._preloadCount===this._preloadTotal},AdvancedAudioSupported(){return!0},IsSilent(){return this._isSilent},IsAnyPlaying(){for(const a of this._lastAIState)if(a.isPlaying)return!0;return!1},IsTagPlaying(a){return this._IsTagPlaying(a)}}};
  
  
  'use strict';{const g=self.C3,v="lowpass highpass bandpass lowshelf highshelf peaking notch allpass".split(" ");g.Plugins.Audio.Acts={async Play(a,b,c,d){if(!this._isSilent){var e=a[1],f=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);if(f){var h=this._nextPlayTime;this._nextPlayTime=0;var k=this._MaybeMarkAsPlaying(d.toLowerCase(),e,0!==b,this.DbToLinear(c));try{await this.PostToDOMAsync("play",{originalUrl:a[0],url:f.url,type:f.type,isMusic:e,tag:d.toLowerCase(),isLooping:0!==b,vol:this.DbToLinear(c),
  pos:0,off:h,trueClock:!!self.C3_GetAudioContextCurrentTime})}finally{k&&(k.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtPosition(a,b,c,d,e,f,h,k,n,m){if(!this._isSilent){var q=a[1],p=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);if(p){var r=this._nextPlayTime;this._nextPlayTime=0;var l=this._MaybeMarkAsPlaying(m.toLowerCase(),q,0!==b,this.DbToLinear(c));try{await this.PostToDOMAsync("play",{originalUrl:a[0],url:p.url,type:p.type,isMusic:q,tag:m.toLowerCase(),isLooping:0!==
  b,vol:this.DbToLinear(c),pos:0,off:r,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:d,y:e,angle:g.toRadians(f),innerAngle:g.toRadians(h),outerAngle:g.toRadians(k),outerGain:this.DbToLinear(n)}})}finally{l&&(l.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtObject(a,b,c,d,e,f,h,k){if(!this._isSilent&&d&&(d=d.GetFirstPicked())&&d.GetWorldInfo()){var n=d.GetWorldInfo(),m=n.GetLayer().GetAngle(),[q,p]=this.rotatePtAround(n.GetX(),n.GetY(),-m,this._listenerX,this._listenerY),
  r=a[1],l=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);if(l){var u=this._nextPlayTime;this._nextPlayTime=0;var t=this._MaybeMarkAsPlaying(k.toLowerCase(),r,0!==b,this.DbToLinear(c));try{await this.PostToDOMAsync("play",{originalUrl:a[0],url:l.url,type:l.type,isMusic:r,tag:k.toLowerCase(),isLooping:0!==b,vol:this.DbToLinear(c),pos:0,off:u,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:q,y:p,angle:n.GetAngle()-m,innerAngle:g.toRadians(e),outerAngle:g.toRadians(f),outerGain:this.DbToLinear(h),
  uid:d.GetUID()}})}finally{t&&(t.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayByName(a,b,c,d,e){if(!this._isSilent){a=1===a;var f=this._runtime.GetAssetManager().GetProjectAudioFileUrl(b);if(f){var h=this._nextPlayTime;this._nextPlayTime=0;var k=this._MaybeMarkAsPlaying(e.toLowerCase(),a,0!==c,this.DbToLinear(d));try{await this.PostToDOMAsync("play",{originalUrl:b,url:f.url,type:f.type,isMusic:a,tag:e.toLowerCase(),isLooping:0!==c,vol:this.DbToLinear(d),pos:0,off:h,trueClock:!!self.C3_GetAudioContextCurrentTime})}finally{k&&
  (k.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtPositionByName(a,b,c,d,e,f,h,k,n,m,q){if(!this._isSilent){a=1===a;var p=this._runtime.GetAssetManager().GetProjectAudioFileUrl(b);if(p){var r=this._nextPlayTime;this._nextPlayTime=0;var l=this._MaybeMarkAsPlaying(q.toLowerCase(),a,0!==c,this.DbToLinear(d));try{await this.PostToDOMAsync("play",{originalUrl:b,url:p.url,type:p.type,isMusic:a,tag:q.toLowerCase(),isLooping:0!==c,vol:this.DbToLinear(d),pos:0,off:r,trueClock:!!self.C3_GetAudioContextCurrentTime,
  panning:{x:e,y:f,angle:g.toRadians(h),innerAngle:g.toRadians(k),outerAngle:g.toRadians(n),outerGain:this.DbToLinear(m)}})}finally{l&&(l.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtObjectByName(a,b,c,d,e,f,h,k,n){if(!this._isSilent&&!this._isSilent&&e&&(e=e.GetFirstPicked())&&e.GetWorldInfo()){var m=e.GetWorldInfo(),q=m.GetLayer().GetAngle(),[p,r]=this.rotatePtAround(m.GetX(),m.GetY(),-q,this._listenerX,this._listenerY);a=1===a;var l=this._runtime.GetAssetManager().GetProjectAudioFileUrl(b);
  if(l){var u=this._nextPlayTime;this._nextPlayTime=0;var t=this._MaybeMarkAsPlaying(n.toLowerCase(),a,0!==c,this.DbToLinear(d));try{await this.PostToDOMAsync("play",{originalUrl:b,url:l.url,type:l.type,isMusic:a,tag:n.toLowerCase(),isLooping:0!==c,vol:this.DbToLinear(d),pos:0,off:u,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:p,y:r,angle:m.GetAngle()-q,innerAngle:g.toRadians(f),outerAngle:g.toRadians(h),outerGain:this.DbToLinear(k),uid:e.GetUID()}})}finally{t&&(t.placeholder=this._runtime.GetTickCountNoSave())}}}},
  SetLooping(a,b){this.PostToDOM("set-looping",{tag:a.toLowerCase(),isLooping:0===b})},SetMuted(a,b){this.PostToDOM("set-muted",{tag:a.toLowerCase(),isMuted:0===b})},SetVolume(a,b){this.PostToDOM("set-volume",{tag:a.toLowerCase(),vol:this.DbToLinear(b)})},FadeVolume(a,b,c,d){this.PostToDOM("fade-volume",{tag:a.toLowerCase(),vol:this.DbToLinear(b),duration:c,stopOnEnd:0===d})},async Preload(a){const b=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:b}),this._preloadCount++)},async PreloadByName(a,b){a=1===a;const c=this._runtime.GetAssetManager().GetProjectAudioFileUrl(b);c&&(this._preloadTotal++,await this.PostToDOMAsync("preload",{originalUrl:b,url:c.url,type:c.type,isMusic:a}),this._preloadCount++)},SetPlaybackRate(a,b){this.PostToDOM("set-playback-rate",{tag:a.toLowerCase(),rate:Math.max(b,0)})},Stop(a){this.PostToDOM("stop",{tag:a.toLowerCase()})},StopAll(){this.PostToDOM("stop-all")},SetPaused(a,
  b){this.PostToDOM("set-paused",{tag:a.toLowerCase(),paused:0===b})},Seek(a,b){this.PostToDOM("seek",{tag:a.toLowerCase(),pos:b})},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,b,c,d,e,f,h){a=a.toLowerCase();b=v[b];this._IncrementEffectCount(a);this.PostToDOM("add-effect",
  {type:"filter",tag:a,params:[b,c,d,e,f,g.clamp(h/100,0,1)]})},AddDelayEffect(a,b,c,d){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"delay",tag:a,params:[b,this.DbToLinear(c),g.clamp(d/100,0,1)]})},AddFlangerEffect(a,b,c,d,e,f){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"flanger",tag:a,params:[b/1E3,c/1E3,d,e/100,g.clamp(f/100,0,1)]})},AddPhaserEffect(a,b,c,d,e,f,h){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",
  {type:"phaser",tag:a,params:[b,c,d,e,f,g.clamp(h/100,0,1)]})},AddConvolutionEffect(a,b,c,d){a=a.toLowerCase();const e=this._runtime.GetAssetManager().GetProjectAudioFileUrl(b[0]);e&&(this._IncrementEffectCount(a),this.PostToDOM("add-effect",{type:"convolution",tag:a,bufferOriginalUrl:b[0],bufferUrl:e.url,bufferType:e.type,params:[0===c,g.clamp(d/100,0,1)]}))},AddGainEffect(a,b){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"gain",tag:a,params:[this.DbToLinear(b)]})},
  AddMuteEffect(a){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"gain",tag:a,params:[0]})},AddTremoloEffect(a,b,c){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"tremolo",tag:a,params:[b,g.clamp(c/100,0,1)]})},AddRingModEffect(a,b,c){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"ringmod",tag:a,params:[b,g.clamp(c/100,0,1)]})},AddDistortionEffect(a,b,c,d,e,f){a=a.toLowerCase();this._IncrementEffectCount(a);
  this.PostToDOM("add-effect",{type:"distortion",tag:a,params:[this.DbToLinearNoCap(b),this.DbToLinearNoCap(c),d,this.DbToLinearNoCap(e),g.clamp(f/100,0,1)]})},AddCompressorEffect(a,b,c,d,e,f){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"compressor",tag:a,params:[b,c,d,e/1E3,f/1E3]})},AddAnalyserEffect(a,b,c){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"analyser",tag:a,params:[b,c]})},RemoveEffects(a){a=a.toLowerCase();this._effectCount.set(a,
  0);this.PostToDOM("remove-effects",{tag:a});this._lastFxState={}},SetEffectParameter(a,b,c,d,e,f){this.PostToDOM("set-effect-param",{tag:a.toLowerCase(),index:Math.floor(b),param:c,value:d,ramp:e,time:f})},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 b=a[1];(a=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]))&&this.PostToDOM("unload",
  {url:a.url,type:a.type,isMusic:b})},UnloadAudioByName(a,b){a=1===a;(b=this._runtime.GetAssetManager().GetProjectAudioFileUrl(b))&&this.PostToDOM("unload",{url:b.url,type:b.type,isMusic:a})},UnloadAll(){this.PostToDOM("unload-all")}}};
  
  
  'use strict';self.C3.Plugins.Audio.Exps={Duration(a){return(a=this._GetFirstAudioStateByTag(a))?a.duration:0},PlaybackTime(a){return(a=this._GetFirstAudioStateByTag(a))?a.playbackTime:0},PlaybackRate(a){return(a=this._GetFirstAudioStateByTag(a))?a.playbackRate:0},Volume(a){return(a=this._GetFirstAudioStateByTag(a))?this.LinearToDb(a.volume):0},MasterVolume(){return this.LinearToDb(this._masterVolume)},EffectCount(a){return this._effectCount.get(a.toLowerCase())||0},AnalyserFreqBinCount(a,b){return(a=
  this.GetAnalyserData(a,Math.floor(b)))?a.binCount:0},AnalyserFreqBinAt(a,b,c){a=this.GetAnalyserData(a,Math.floor(b));if(!a)return 0;c=Math.floor(c);return 0>c||c>=a.binCount?0:a.freqBins[c]},AnalyserPeakLevel(a,b){return(a=this.GetAnalyserData(a,Math.floor(b)))?a.peak:0},AnalyserRMSLevel(a,b){return(a=this.GetAnalyserData(a,Math.floor(b)))?a.rms:0},SampleRate(){return this._sampleRate},CurrentTime(){return self.C3_GetAudioContextCurrentTime?self.C3_GetAudioContextCurrentTime():performance.now()/
  1E3}};
  
  
  'use strict';{const a=self.C3;a.Plugins.Mouse=class extends a.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}};
  
  
  'use strict';{var GetMouseSdkInstance=function(){return b.GetSingleGlobalInstance().GetSdkInstance()};const c=self.C3;c.Plugins.Mouse.Type=class extends c.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.IMouseObjectType}};let b=null;self.IMouseObjectType=class extends self.IObjectClass{constructor(a){super(a);b=a;a.GetRuntime()._GetCommonScriptInterfaces().mouse=this}getMouseX(a){return GetMouseSdkInstance().GetMousePositionForLayer(a)[0]}getMouseY(a){return GetMouseSdkInstance().GetMousePositionForLayer(a)[1]}getMousePosition(a){return GetMouseSdkInstance().GetMousePositionForLayer(a)}isMouseButtonDown(a){return GetMouseSdkInstance().IsMouseButtonDown(a)}}};
  
  
  'use strict';{const b=self.C3;b.Plugins.Mouse.Instance=class extends b.SDKInstanceBase{constructor(a,c){super(a,"mouse");this._buttonMap=[!1,!1,!1];this._triggerDir=this._triggerType=this._triggerButton=this._mouseYcanvas=this._mouseXcanvas=0;a=this.GetRuntime().Dispatcher();this._disposables=new b.CompositeDisposable(b.Disposable.From(a,"pointermove",a=>this._OnPointerMove(a.data)),b.Disposable.From(a,"pointerdown",a=>this._OnPointerDown(a.data)),b.Disposable.From(a,"pointerup",a=>this._OnPointerUp(a.data)),
  b.Disposable.From(a,"dblclick",a=>this._OnDoubleClick(a.data)),b.Disposable.From(a,"wheel",a=>this._OnMouseWheel(a.data)),b.Disposable.From(a,"window-blur",()=>this._OnWindowBlur()))}Release(){super.Release()}_OnPointerDown(a){"mouse"===a.pointerType&&(this._mouseXcanvas=a.pageX-this._runtime.GetCanvasClientX(),this._mouseYcanvas=a.pageY-this._runtime.GetCanvasClientY(),this._CheckButtonChanges(a.lastButtons,a.buttons))}_OnPointerMove(a){"mouse"===a.pointerType&&(this._mouseXcanvas=a.pageX-this._runtime.GetCanvasClientX(),
  this._mouseYcanvas=a.pageY-this._runtime.GetCanvasClientY(),this._CheckButtonChanges(a.lastButtons,a.buttons))}_OnPointerUp(a){"mouse"===a.pointerType&&this._CheckButtonChanges(a.lastButtons,a.buttons)}_CheckButtonChanges(a,c){this._CheckButtonChange(a,c,1,0);this._CheckButtonChange(a,c,4,1);this._CheckButtonChange(a,c,2,2)}_CheckButtonChange(a,c,d,e){!(a&d)&&c&d?this._OnMouseDown(e):a&d&&!(c&d)&&this._OnMouseUp(e)}_OnMouseDown(a){this._buttonMap[a]=!0;this.Trigger(b.Plugins.Mouse.Cnds.OnAnyClick);
  this._triggerButton=a;this._triggerType=0;this.Trigger(b.Plugins.Mouse.Cnds.OnClick);this.Trigger(b.Plugins.Mouse.Cnds.OnObjectClicked)}_OnMouseUp(a){this._buttonMap[a]&&(this._buttonMap[a]=!1,this._triggerButton=a,this.Trigger(b.Plugins.Mouse.Cnds.OnRelease))}_OnDoubleClick(a){this._triggerButton=a.button;this._triggerType=1;this.Trigger(b.Plugins.Mouse.Cnds.OnClick);this.Trigger(b.Plugins.Mouse.Cnds.OnObjectClicked)}_OnMouseWheel(a){this._triggerDir=0>a.deltaY?1:0;this.Trigger(b.Plugins.Mouse.Cnds.OnWheel)}_OnWindowBlur(){for(let a=
  0,c=this._buttonMap.length;a<c&&this._buttonMap[a];++a)this._buttonMap[a]=!1,this._triggerButton=a,this.Trigger(b.Plugins.Mouse.Cnds.OnRelease)}GetMousePositionForLayer(a){const c=this._runtime.GetMainRunningLayout(),d=this._mouseXcanvas,e=this._mouseYcanvas;return"undefined"===typeof a?c.GetLayerByIndex(0).CanvasCssToLayer_DefaultTransform(d,e):(a=c.GetLayer(a))?a.CanvasCssToLayer(d,e):[0,0]}IsMouseButtonDown(a){a=Math.floor(a);return!!this._buttonMap[a]}_IsMouseOverCanvas(){return 0<=this._mouseXcanvas&&
  0<=this._mouseYcanvas&&this._mouseXcanvas<this._runtime.GetCanvasCssWidth()&&this._mouseYcanvas<this._runtime.GetCanvasCssHeight()}GetDebuggerProperties(){return[{title:"plugins.mouse.name",properties:[{name:"plugins.mouse.debugger.absolute-position",value:this._mouseXcanvas+","+this._mouseYcanvas},{name:"plugins.mouse.debugger.left-button",value:this._buttonMap[0]},{name:"plugins.mouse.debugger.middle-button",value:this._buttonMap[1]},{name:"plugins.mouse.debugger.right-button",value:this._buttonMap[2]}]},
  {title:"plugins.mouse.debugger.position-on-each-layer",properties:this._runtime.GetMainRunningLayout().GetLayers().map(a=>({name:"$"+a.GetName(),value:a.CanvasCssToLayer(this._mouseXcanvas,this._mouseYcanvas).join(", ")}))}]}}};
  
  
  'use strict';{const d=self.C3;d.Plugins.Mouse.Cnds={OnClick(a,b){return this._triggerButton===a&&this._triggerType===b},OnAnyClick(){return!0},IsButtonDown(a){return this._buttonMap[a]},OnRelease(a){return this._triggerButton===a},IsOverObject(a){if(!this._IsMouseOverCanvas())return!1;const b=this._runtime.GetCurrentCondition().IsInverted(),c=this._mouseXcanvas,e=this._mouseYcanvas;return d.xor(this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(a,c,e,b),b)},OnObjectClicked(a,b,c){if(a!==
  this._triggerButton||b!==this._triggerType||!this._IsMouseOverCanvas())return!1;a=this._mouseXcanvas;b=this._mouseYcanvas;return this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(c,a,b,!1)},OnWheel(a){return this._triggerDir===a}}};
  
  
  'use strict';{const d=self.C3;let c=null;const f="auto pointer text crosshair move help wait none".split(" ");d.Plugins.Mouse.Acts={SetCursor(a){a=f[a];c!==a&&(c=a,this.PostToDOM("cursor",a))},SetCursorSprite(a){if(!d.Platform.IsMobile&&a&&(a=a.GetFirstPicked())){var e=a.GetWorldInfo(),b=a.GetCurrentImageInfo();e&&b&&c!==b&&(c=b,b.ExtractImageToCanvas().then(a=>d.CanvasToBlob(a)).then(a=>{a=`url(${URL.createObjectURL(a)}) ${Math.round(e.GetOriginX()*b.GetWidth())} ${Math.round(e.GetOriginY()*b.GetHeight())}, auto`;
  this.PostToDOM("cursor","");this.PostToDOM("cursor",a)}))}}}};
  
  
  'use strict';self.C3.Plugins.Mouse.Exps={X(a){return this.GetMousePositionForLayer(a)[0]},Y(a){return this.GetMousePositionForLayer(a)[1]},AbsoluteX(){return this._mouseXcanvas},AbsoluteY(){return this._mouseYcanvas}};
  
  
  'use strict';{const a=self.C3;a.Plugins.LocalStorage=class extends a.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}};
  
  
  'use strict';{const a=self.C3;a.Plugins.LocalStorage.Type=class extends a.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}};
  
  
  'use strict';{const e=self.C3;e.Plugins.LocalStorage.Instance=class extends e.SDKInstanceBase{constructor(a,c){super(a);this._lastValue=this._currentKey="";this._keyNamesList=[];this._errorMessage="";this._pendingSets=this._pendingGets=0;this._storage=this._runtime._GetProjectStorage();this._debugCache=new Map;this._isLoadingDebugCache=!1}Release(){super.Release()}async _TriggerStorageError(a){this._errorMessage=this._GetErrorString(a);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnError)}_GetErrorString(a){return a?
  "string"===typeof a?a:"string"===typeof a.message?a.message:"string"===typeof a.name?a.name:"string"===typeof a.data?a.data:"unknown error":"unknown error"}GetDebuggerProperties(){this._isLoadingDebugCache||this._DebugCacheStorage();return[{title:"plugins.localstorage.name",properties:[...this._debugCache.entries()].map(a=>({name:"$"+a[0],value:a[1],onedit:c=>this._storage.setItem(a[0],c)}))}]}async _DebugCacheStorage(){this._isLoadingDebugCache=!0;try{const a=await this._storage.keys();a.sort((a,
  b)=>{a=a.toLowerCase();b=b.toLowerCase();return a<b?-1:b<a?1:0});const c=await Promise.all(a.map(a=>this._storage.getItem(a)));this._debugCache.clear();for(let d=0,b=a.length;d<b;++d)this._debugCache.set(a[d],c[d])}catch(a){console.warn("[C3 debugger] Error displaying local storage: ",a)}finally{this._isLoadingDebugCache=!1}}}};
  
  
  'use strict';{const b=self.C3;b.Plugins.LocalStorage.Cnds={OnItemSet(a){return this._currentKey===a},OnAnyItemSet(){return!0},OnItemGet(a){return this._currentKey===a},OnAnyItemGet(){return!0},OnItemRemoved(a){return this._currentKey===a},OnAnyItemRemoved(){return!0},OnCleared(){return!0},OnAllKeyNamesLoaded(){return!0},OnError(){return!0},OnItemExists(a){return this._currentKey===a},OnItemMissing(a){return this._currentKey===a},CompareKey(a,c){return b.compare(this._currentKey,a,c)},CompareValue(a,
  c){return b.compare(this._lastValue,a,c)},IsProcessingSets(){return 0<this._pendingSets},IsProcessingGets(){return 0<this._pendingGets},OnAllSetsComplete(){return!0},OnAllGetsComplete(){return!0}}};
  
  
  'use strict';{var IsExpressionType=function(b){return"string"===typeof b||"number"===typeof b};const c=self.C3;c.Plugins.LocalStorage.Acts={async SetItem(b,a){this._pendingSets++;try{const d=await this._storage.setItem(b,a);await this.ScheduleTriggers(async()=>{this._currentKey=b;this._lastValue=d;await this.TriggerAsync(c.Plugins.LocalStorage.Cnds.OnAnyItemSet);await this.TriggerAsync(c.Plugins.LocalStorage.Cnds.OnItemSet)})}catch(d){await this._TriggerStorageError(d)}finally{this._pendingSets--,
  0===this._pendingSets&&await this.TriggerAsync(c.Plugins.LocalStorage.Cnds.OnAllSetsComplete)}},async SetBinaryItem(b,a){if(a&&(a=a.GetFirstPicked(this._inst))&&(a=a.GetSdkInstance())){a=a.GetArrayBufferReadOnly();this._pendingSets++;try{await this._storage.setItem(b,a),await this.ScheduleTriggers(async()=>{this._currentKey=b;this._lastValue="";await this.TriggerAsync(c.Plugins.LocalStorage.Cnds.OnAnyItemSet);await this.TriggerAsync(c.Plugins.LocalStorage.Cnds.OnItemSet)})}catch(d){await this._TriggerStorageError(d)}finally{this._pendingSets--,
  0===this._pendingSets&&await this.TriggerAsync(c.Plugins.LocalStorage.Cnds.OnAllSetsComplete)}}},async GetItem(b){this._pendingGets++;try{const a=await this._storage.getItem(b);await this.ScheduleTriggers(async()=>{this._currentKey=b;this._lastValue=IsExpressionType(a)?a:"";await this.TriggerAsync(c.Plugins.LocalStorage.Cnds.OnAnyItemGet);await this.TriggerAsync(c.Plugins.LocalStorage.Cnds.OnItemGet)})}catch(a){await this._TriggerStorageError(a)}finally{this._pendingGets--,0===this._pendingGets&&
  await this.TriggerAsync(c.Plugins.LocalStorage.Cnds.OnAllGetsComplete)}},async GetBinaryItem(b,a){if(a&&(a=a.GetFirstPicked(this._inst))){var d=a.GetSdkInstance();this._pendingGets++;try{let a=await this._storage.getItem(b);a=a instanceof ArrayBuffer?a:new ArrayBuffer(0);await this.ScheduleTriggers(async()=>{this._lastValue="";this._currentKey=b;d.SetArrayBufferTransfer(a);await this.TriggerAsync(c.Plugins.LocalStorage.Cnds.OnAnyItemGet);await this.TriggerAsync(c.Plugins.LocalStorage.Cnds.OnItemGet)})}catch(e){await this._TriggerStorageError(e)}finally{this._pendingGets--,
  0===this._pendingGets&&await this.TriggerAsync(c.Plugins.LocalStorage.Cnds.OnAllGetsComplete)}}},async CheckItemExists(b){try{const a=await this._storage.getItem(b);await this.ScheduleTriggers(async()=>{this._currentKey=b;"undefined"===typeof a||null===a?(this._lastValue="",await this.TriggerAsync(c.Plugins.LocalStorage.Cnds.OnItemMissing)):(this._lastValue=IsExpressionType(a)?a:"",await this.TriggerAsync(c.Plugins.LocalStorage.Cnds.OnItemExists))})}catch(a){await this._TriggerStorageError(a)}},async RemoveItem(b){try{await this._storage.removeItem(b),
  await this.ScheduleTriggers(async()=>{this._currentKey=b;this._lastValue="";await this.TriggerAsync(c.Plugins.LocalStorage.Cnds.OnAnyItemRemoved);await this.TriggerAsync(c.Plugins.LocalStorage.Cnds.OnItemRemoved)})}catch(a){await this._TriggerStorageError(a)}},async ClearStorage(){try{await this._storage.clear(),await this.ScheduleTriggers(async()=>{this._lastValue=this._currentKey="";c.clearArray(this._keyNamesList);await this.TriggerAsync(c.Plugins.LocalStorage.Cnds.OnCleared)})}catch(b){await this._TriggerStorageError(b)}},
  async GetAllKeyNames(){try{const b=await this._storage.keys();await this.ScheduleTriggers(async()=>{this._keyNamesList=b;await this.TriggerAsync(c.Plugins.LocalStorage.Cnds.OnAllKeyNamesLoaded)})}catch(b){await this._TriggerStorageError(b)}}}};
  
  
  'use strict';self.C3.Plugins.LocalStorage.Exps={ItemValue(){return this._lastValue},Key(){return this._currentKey},KeyCount(){return this._keyNamesList.length},KeyAt(a){a=Math.floor(a);return 0>a||a>=this._keyNamesList.length?"":this._keyNamesList[a]},ErrorMessage(){return this._errorMessage}};
  
  
  'use strict';{const a=self.C3;a.Behaviors.TileMovement=class extends a.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}};
  
  
  'use strict';{const a=self.C3;a.Behaviors.TileMovement.Type=class extends a.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}};
  
  
  'use strict';{const m=self.C3,y=self.IBehaviorInstance,t=[];m.Behaviors.TileMovement.Instance=class extends m.SDKBehaviorInstanceBase{constructor(a,b){super(a);this._simRight=this._simLeft=this._simDown=this._simUp=this._ignoreInput=this._rightKey=this._leftKey=this._downKey=this._upKey=!1;this._gridWidth=b[0];this._gridHeight=b[1];this._gridOffsetX=b[2];this._gridOffsetY=b[3];this._speedX=b[4];this._speedY=b[5];this._targetGridY=this._targetGridX=this._targetY=this._targetX=0;this._collisionRect=
  m.New(m.Rect);this._isEnabled=b[6];this._defaultControls=b[7];this._iso=b[8];this._disposables=null;this._isEnabled&&this._StartTicking();this._defaultControls&&this._BindEvents();this._ResetTarget()}Release(){this._UnBindEvents();super.Release()}_BindEvents(){if(!this._disposables){var a=this._runtime.Dispatcher();this._disposables=new m.CompositeDisposable(m.Disposable.From(a,"keydown",a=>this._OnKeyDown(a.data)),m.Disposable.From(a,"keyup",a=>this._OnKeyUp(a.data)),m.Disposable.From(a,"window-blur",
  ()=>this._OnWindowBlur()))}}_UnBindEvents(){this._disposables&&(this._disposables.Release(),this._disposables=null)}_OnKeyDown(a){switch(a.key){case "ArrowLeft":this._leftKey=!0;break;case "ArrowUp":this._upKey=!0;break;case "ArrowRight":this._rightKey=!0;break;case "ArrowDown":this._downKey=!0}}_OnKeyUp(a){switch(a.key){case "ArrowLeft":this._leftKey=!1;break;case "ArrowUp":this._upKey=!1;break;case "ArrowRight":this._rightKey=!1;break;case "ArrowDown":this._downKey=!1}}_OnWindowBlur(){this._rightKey=
  this._leftKey=this._downKey=this._upKey=!1}SaveToJson(){return{gw:this._gridWidth,gh:this._gridHeight,ox:this._gridOffsetX,oy:this._gridOffsetY,sx:this._speedX,sy:this._speedY,x:this._targetX,y:this._targetY,gx:this._targetGridX,gy:this._targetGridY,e:this._isEnabled,i:this._ignoreInput,c:this._defaultControls}}LoadFromJson(a){this._gridWidth=a.gw;this._gridHeight=a.gh;this._gridOffsetX=a.ox;this._gridOffsetY=a.oy;this._speedX=a.sx;this._speedY=a.sy;this._targetX=a.x;this._targetY=a.y;this._targetGridX=
  a.gx;this._targetGridY=a.gy;this._isEnabled=!!a.e;this._ignoreInput=!!a.i;this._defaultControls=!!a.c;this._isEnabled?this._StartTicking():(this._simDown=this._simUp=this._simRight=this._simLeft=!1,this._StopTicking());this._defaultControls?this._BindEvents():this._UnBindEvents()}_GetTargetDelta(){var a=this.GetWorldInfo();const b=this._targetX-a.GetX();a=this._targetY-a.GetY();return[b,a]}IsMoving(){const [a,b]=this._GetTargetDelta();return 0<Math.abs(a)&&0!==this._speedX||0<Math.abs(b)&&0!==this._speedY}IsMovingDirection(a){const [b,
  c]=this._GetTargetDelta();return 2>a&&0!==this._speedX?0===a?0<b:0>b:0!==this._speedY?2===a?0<c:0>c:!1}CanMoveTo(a,b){const c=this.GetWorldInfo(),d=c.GetX(),h=c.GetY();a=this._WorldPosition(a,b);c.SetX(a[0]);c.SetY(a[1]);c.SetBboxChanged();a=this._TestCollision();c.SetX(d);c.SetY(h);c.SetBboxChanged();return!a}CanMoveDirection(a,b){const c=this.GetWorldInfo(),d=c.GetX(),h=c.GetY();let e=0,f=0;switch(a){case 0:e=1;break;case 1:e=-1;break;case 2:f=1;break;case 3:f=-1}b=Math.floor(b);0>b&&(e=-e,f=-f,
  b=-b);a=this._GridX(d,h);let l=this._GridY(d,h);var k=null;for(let d=0;d<b&&!(a+=e,l+=f,k=this._WorldPosition(a,l),c.SetX(k[0]),c.SetY(k[1]),c.SetBboxChanged(),k=this._TestCollision());d++);c.SetX(d);c.SetY(h);c.SetBboxChanged();return!k}SetIgnoreInput(a){this._ignoreInput=!!a}GetDefaultControls(){return this._defaultControls}SimulateControl(a){if(this._isEnabled)switch(a){case 0:this._simLeft=!0;break;case 1:this._simRight=!0;break;case 2:this._simUp=!0;break;case 3:this._simDown=!0}}SetSpeed(a,
  b){this._speedX=a;this._speedY=b}SetGridPosition(a,b,c){c=!!c;!this._UpdateTarget(a,b)&&c&&this._MoveToTarget()}SetGridDimensions(a,b,c,d){this._gridWidth=a;this._gridHeight=b;this._gridOffsetX=c;this._gridOffsetY=d;this._TargetCurrentPositon()}_GridX(a,b){if(this._iso)return this._IsoGridX(a,b);a-=this._gridOffsetX;a/=this._gridWidth;return Math.round(a)}_GridY(a,b){if(this._iso)return this._IsoGridY(a,b);b-=this._gridOffsetY;b/=this._gridHeight;return Math.round(b)}_IsoGridX(a,b){a-=this._gridOffsetX;
  b-=this._gridOffsetY;a/=this._gridWidth/2;b/=this._gridHeight/2;return Math.round((a+b)/2)}_IsoGridY(a,b){a-=this._gridOffsetX;b-=this._gridOffsetY;a/=this._gridWidth/2;b/=this._gridHeight/2;return Math.round((b-a)/2)}_ClampedGridPosition(a,b){const [c,d]=this._GridPosition(a,b);return[Math.round(c),Math.round(d)]}_GridPosition(a,b){if(this._iso)return this._IsoGridPosition(a,b);a-=this._gridOffsetX;b-=this._gridOffsetY;a/=this._gridWidth;b/=this._gridHeight;return[a,b]}_WorldPosition(a,b){if(this._iso)return this._IsoWorldPosition(a,
  b);a*=this._gridWidth;b*=this._gridHeight;a+=this._gridOffsetX;b+=this._gridOffsetY;return[a,b]}_IsoGridPosition(a,b){a-=this._gridOffsetX;b-=this._gridOffsetY;a/=this._gridWidth/2;b/=this._gridHeight/2;return[(a+b)/2,(b-a)/2]}_IsoWorldPosition(a,b){let c;c=this._gridWidth/2*(a-b);a=this._gridHeight/2*(a+b);c+=this._gridOffsetX;a+=this._gridOffsetY;return[c,a]}_UpdateTarget(a,b){const c=this.GetWorldInfo(),d=c.GetX(),h=c.GetY(),e=this._WorldPosition(a,b);c.SetX(e[0]);c.SetY(e[1]);c.SetBboxChanged();
  const f=this._TestCollision();c.SetX(d);c.SetY(h);c.SetBboxChanged();if(f)return!0;this._targetGridX=a;this._targetGridY=b;this._targetX=e[0];this._targetY=e[1];return!1}_MoveToTarget(){const a=this.GetWorldInfo();a.SetXY(this._targetX,this._targetY);a.SetBboxChanged()}_TargetCurrentPositon(){var a=this.GetWorldInfo();a=this._ClampedGridPosition(a.GetX(),a.GetY());const b=this._WorldPosition(a[0],a[1]);this._targetGridX=a[0];this._targetGridY=a[1];this._targetX=b[0];this._targetY=b[1]}_ResetTarget(){this._TargetCurrentPositon();
  this._MoveToTarget()}_UpdateCollisionRect(){const a=this.GetWorldInfo().GetBoundingBox();this._collisionRect.copy(a);let b=.01,c=.01;var d=a.width(),h=a.height();.02>d&&(d=a.midX(),b=0,a.setRight(d),a.setLeft(d));.02>h&&(h=a.midY(),c=0,a.setRight(h),a.setLeft(h));this._collisionRect.deflate(b,c);return this._collisionRect}_TestCollision(){const a=this._runtime.GetCollisionEngine(),b=this._UpdateCollisionRect(),c=this.GetObjectInstance();a.GetSolidCollisionCandidates(null,b,t);for(const d of t)if(d!==
  c&&a.IsSolidCollisionAllowed(d,c)&&a.TestRectOverlap(b,d))return m.clearArray(t),d;m.clearArray(t);return null}_MaybePushOut(){const a=this._runtime.GetCollisionEngine(),b=this._TestCollision();if(!b)return null;const c=this.GetWorldInfo(),d=c.GetX(),h=c.GetY(),e=c.GetBoundingBox(),f=b.GetWorldInfo().GetBoundingBox();var l=Math.max(e.getRight(),f.getRight())-Math.min(e.getLeft(),f.getLeft()),k=Math.max(e.getBottom(),f.getBottom())-Math.min(e.getTop(),f.getTop());l=e.width()+f.width()-l;k=e.height()+
  f.height()-k;let n=!1;l<k?(10<l&&(n=!0),l=Math.min(l,10),e.getLeft()<f.getLeft()?c.OffsetX(-l):c.OffsetX(l)):(10<k&&(n=!0),k=Math.min(k,10),e.getTop()<f.getTop()?c.OffsetY(-k):c.OffsetY(k));c.SetBboxChanged();this._TestCollision()&&(c.SetX(d),c.SetY(h),c.SetBboxChanged());n&&a.RegisterCollision(this._inst,b);this._TargetCurrentPositon();return b}Tick(){var a=this._runtime.GetDt(this._inst);let b=this._leftKey||this._simLeft,c=this._rightKey||this._simRight,d=this._upKey||this._simUp,h=this._downKey||
  this._simDown;this._simDown=this._simUp=this._simRight=this._simLeft=!1;if(this._isEnabled&&(this._ignoreInput&&(b=c=d=h=!1),d&&h&&(d=h=!1),b&&c&&(b=c=!1),!this._MaybePushOut())){var e=this.GetWorldInfo(),f=e.GetX(),l=e.GetY(),k=a*this._speedX;a*=this._speedY;var n=this._targetGridX,p=this._targetGridY,q=this._targetX-f,u=this._targetY-l,v=Math.abs(q),w=Math.abs(u),r=0,x=0;if(0<v){r=Math.sign(q);const a=0>r&&b,d=0<r&&c;if(a||d)for(;!(!(v<k)||d&&this._UpdateTarget(++n,p)||a&&this._UpdateTarget(--n,
  p));)q=this._targetX-f,v=Math.abs(q);r*=m.clamp(v,0,k)}if(0<w){f=Math.sign(u);k=0<f&&h;q=0>f&&d;if(k||q)for(;!(!(w<a)||k&&this._UpdateTarget(n,++p)||q&&this._UpdateTarget(n,--p));)u=this._targetY-l,w=Math.abs(u);x=f*m.clamp(w,0,a)}0!=r||0!=x?(e.OffsetX(r),e.OffsetY(x),e.SetBboxChanged(),this._MaybePushOut()):b?this._UpdateTarget(n-1,p):c?this._UpdateTarget(n+1,p):d?this._UpdateTarget(n,p-1):h&&this._UpdateTarget(n,p+1)}}GetPropertyValueByIndex(a){switch(a){case 0:return this._gridWidth;case 1:return this._gridHeight;
  case 2:return this._gridOffsetX;case 3:return this._gridOffsetY;case 4:return this._speedX;case 5:return this._speedY;case 6:return this._isEnabled;case 7:return this._defaultControls}}SetPropertyValueByIndex(a,b){switch(a){case 0:this._gridWidth=b;this._TargetCurrentPositon();break;case 1:this._gridHeight=b;this._TargetCurrentPositon();break;case 2:this._gridOffsetX=b;this._TargetCurrentPositon();break;case 3:this._gridOffsetY=b;this._TargetCurrentPositon();break;case 4:this._speedX=b;break;case 5:this._speedY=
  b;break;case 6:this.SetEnabled(b);break;case 7:this._SetControls(b)}}SetEnabled(a){(this._isEnabled=!!a)?this._StartTicking():(this._simDown=this._simUp=this._simRight=this._simLeft=!1,this._StopTicking())}_SetControls(a){(this._defaultControls=!!a)?this._BindEvents():this._UnBindEvents()}GetDebuggerProperties(){const a=this.GetWorldInfo(),b=this._GridPosition(a.GetX(),a.GetY());return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.tilemovement.debugger.grid-x",value:b[0],
  onedit:c=>{c=this._WorldPosition(c,b[1]);a.SetX(c[0]);a.SetBboxChanged()}},{name:"behaviors.tilemovement.debugger.grid-y",value:b[1],onedit:c=>{c=this._WorldPosition(b[0],c);a.SetY(c[1]);a.SetBboxChanged()}},{name:"behaviors.tilemovement.properties.grid-width.name",value:this._gridWidth,onedit:a=>{this._gridWidth=a;this._TargetCurrentPositon()}},{name:"behaviors.tilemovement.properties.grid-height.name",value:this._gridHeight,onedit:a=>{this._gridHeight=a;this._TargetCurrentPositon()}},{name:"behaviors.tilemovement.properties.grid-offset-x.name",
  value:this._gridOffsetX,onedit:a=>{this._gridOffsetX=a;this._TargetCurrentPositon()}},{name:"behaviors.tilemovement.properties.grid-offset-y.name",value:this._gridOffsetY,onedit:a=>{this._gridOffsetY=a;this._TargetCurrentPositon()}},{name:"behaviors.tilemovement.properties.speed-x.name",value:this._speedX,onedit:a=>this._speedX=a},{name:"behaviors.tilemovement.properties.speed-y.name",value:this._speedY,onedit:a=>this._speedY=a},{name:"behaviors.tilemovement.debugger.target-x",value:this._targetX,
  onedit:a=>{this._targetX=a;this._targetGridX=this._ClampedGridPosition(this._targetX,this._targetY)[0]}},{name:"behaviors.tilemovement.debugger.target-y",value:this._targetY,onedit:a=>{this._targetY=a;this._targetGridY=this._ClampedGridPosition(this._targetX,this._targetY)[1]}},{name:"behaviors.tilemovement.debugger.grid-target-x",value:this._targetGridX,onedit:a=>{this._targetGridX=a;this._targetX=this._WorldPosition(this._targetGridX,this._targetGridY)[0]}},{name:"behaviors.tilemovement.debugger.grid-target-y",
  value:this._targetGridY,onedit:a=>{this._targetGridY=a;this._targetY=this._WorldPosition(this._targetGridX,this._targetGridY)[1]}},{name:"behaviors.tilemovement.properties.enabled.name",value:this._isEnabled,onedit:a=>this.SetEnabled(a)},{name:"behaviors.tilemovement.properties.default-controls.name",value:this._defaultControls,onedit:a=>this._SetControls(a)}]}]}GetScriptInterfaceClass(){return self.ITileMovementBehaviorInstance}};const g=new WeakMap;self.ITileMovementBehaviorInstance=class extends y{constructor(){super();
  g.set(this,y._GetInitInst().GetSdkInstance())}set isIgnoringInput(a){g.get(this).SetIgnoreInput(!!a)}get isIgnoringInput(){return g.get(this)._ignoreInput}simulateControl(a){switch(a){case "left":a=0;break;case "right":a=1;break;case "up":a=2;break;case "down":a=3;break;default:throw Error(`Invalid direction ${a}`);}g.get(this).SimulateControl(a)}set isEnabled(a){g.get(this).SetEnabled(!!a)}get isEnabled(){return g.get(this)._isEnabled}get isDefaultControls(){return g.get(this).GetDefaultControls()}set isDefaultControls(a){g.get(this)._SetControls(!!a)}setSpeed(a,
  b){g.get(this).SetSpeed(a,b)}getSpeed(){const a=g.get(this);return[a._speedX,a._speedY]}setGridPosition(a,b,c){g.get(this).SetGridPosition(a,b,!!c)}getGridPosition(){const a=g.get(this);var b=a.GetWorldInfo();const c=b.GetX();b=b.GetY();return[a._GridX(c,b),a._GridY(c,b)]}modifyGridDimensions(a,b,c,d){g.get(this).SetGridDimensions(a,b,c,d)}isMoving(){return g.get(this).IsMoving()}isMovingDirection(a){switch(a){case "right":a=0;break;case "left":a=1;break;case "down":a=2;break;case "up":a=3;break;
  default:throw Error(`Invalid direction ${a}`);}return g.get(this).IsMovingDirection(a)}canMoveTo(a,b){return g.get(this).CanMoveTo(a,b)}canMoveDirection(a,b){switch(a){case "right":a=0;break;case "left":a=1;break;case "down":a=2;break;case "up":a=3;break;default:throw Error(`Invalid direction ${a}`);}return g.get(this).CanMoveDirection(a,b)}getTargetPosition(){const a=g.get(this);return[a._targetX,a._targetY]}getGridTargetPosition(){const a=g.get(this);return[a._targetGridX,a._targetGridY]}toGridSpace(a,
  b){return g.get(this)._GridPosition(a,b)}fromGridSpace(a,b){return g.get(this)._WorldPosition(a,b)}}};
  
  
  'use strict';self.C3.Behaviors.TileMovement.Cnds={IsMoving(){return this.IsMoving()},IsMovingDirection(a){return this.IsMovingDirection(a)},IsEnabled(){return this._isEnabled},CanMoveTo(a,b){return this.CanMoveTo(a,b)},CanMoveDirection(a,b){return this.CanMoveDirection(a,b)}};
  
  
  'use strict';self.C3.Behaviors.TileMovement.Acts={SetIgnoreInput(a){this.SetIgnoreInput(a)},SimulateControl(a){this.SimulateControl(a)},SetEnabled(a){this.SetEnabled(a)},SetSpeed(a,b){this.SetSpeed(a,b)},SetGridPosition(a,b,c){this.SetGridPosition(a,b,c)},SetGridDimensions(a,b,c,d){this.SetGridDimensions(a,b,c,d)},SetDefaultControls(a){this._SetControls(!!a)}};
  
  
  'use strict';self.C3.Behaviors.TileMovement.Exps={GridX(){const a=this.GetWorldInfo();return this._GridX(a.GetX(),a.GetY())},GridY(){const a=this.GetWorldInfo();return this._GridY(a.GetX(),a.GetY())},SpeedX(){return this._speedX},SpeedY(){return this._speedY},TargetX(){return this._targetX},TargetY(){return this._targetY},GridTargetX(){return this._targetGridX},GridTargetY(){return this._targetGridY}};
  
  
  'use strict';{const a=self.C3;a.Behaviors.Fade=class extends a.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}};
  
  
  'use strict';{const a=self.C3;a.Behaviors.Fade.Type=class extends a.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}};
  
  
  'use strict';{const c=self.C3;c.Behaviors.Fade.Instance=class extends c.SDKBehaviorInstanceBase{constructor(a,b){super(a);this._fadeOutTime=this._waitTime=this._fadeInTime=0;this._activeAtStart=this._destroy=!0;this._setMaxOpacity=!1;this._stage=0;this._stageTime=c.New(c.KahanSum);this._maxOpacity=this._inst.GetWorldInfo().GetOpacity()||1;b&&(this._fadeInTime=b[0],this._waitTime=b[1],this._fadeOutTime=b[2],this._destroy=!!b[3],this._stage=(this._activeAtStart=!!b[4])?0:3);this._activeAtStart&&(0===
  this._fadeInTime?(this._stage=1,0===this._waitTime&&(this._stage=2)):(this._inst.GetWorldInfo().SetOpacity(0),this._runtime.UpdateRender()));this._StartTicking()}Release(){super.Release()}SaveToJson(){return{fit:this._fadeInTime,wt:this._waitTime,fot:this._fadeOutTime,d:this._destroy,s:this._stage,st:this._stageTime.Get(),mo:this._maxOpacity}}LoadFromJson(a){this._fadeInTime=a.fit;this._waitTime=a.wt;this._fadeOutTime=a.fot;this._destroy=a.d;this._stage=a.s;this._stageTime.Set(a.st);this._maxOpacity=
  a.mo}Tick(){var a=this._runtime.GetDt(this._inst);this._stageTime.Add(a);a=this._inst.GetWorldInfo();0===this._stage&&(a.SetOpacity(this._stageTime.Get()/this._fadeInTime*this._maxOpacity),this._runtime.UpdateRender(),a.GetOpacity()>=this._maxOpacity&&(a.SetOpacity(this._maxOpacity),this._stage=1,this._stageTime.Reset(),this.Trigger(c.Behaviors.Fade.Cnds.OnFadeInEnd)));1===this._stage&&this._stageTime.Get()>=this._waitTime&&(this._stage=2,this._stageTime.Reset(),this.Trigger(c.Behaviors.Fade.Cnds.OnWaitEnd));
  2===this._stage&&0!==this._fadeOutTime&&(a.SetOpacity(this._maxOpacity-this._stageTime.Get()/this._fadeOutTime*this._maxOpacity),this._runtime.UpdateRender(),0>=a.GetOpacity()&&(this._stage=3,this._stageTime.Reset(),this.Trigger(c.Behaviors.Fade.Cnds.OnFadeOutEnd),this._destroy&&this._runtime.DestroyInstance(this._inst)))}Start(){this._stage=0;this._stageTime.Reset();0===this._fadeInTime?(this._stage=1,0===this._waitTime&&(this._stage=2)):(this._inst.GetWorldInfo().SetOpacity(0),this._runtime.UpdateRender())}GetPropertyValueByIndex(a){switch(a){case 0:return this._fadeInTime;
  case 1:return this._waitTime;case 2:return this._fadeOutTime;case 3:return this._destroy}}SetPropertyValueByIndex(a,b){switch(a){case 0:this._fadeInTime=b;break;case 1:this._waitTime=b;break;case 2:this._fadeOutTime=b;break;case 3:this._destroy=!!b}}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.fade.properties.fade-in-time.name",value:this._fadeInTime,onedit:a=>this._fadeInTime=a},{name:"behaviors.fade.properties.wait-time.name",value:this._waitTime,
  onedit:a=>this._waitTime=a},{name:"behaviors.fade.properties.fade-out-time.name",value:this._fadeOutTime,onedit:a=>this._fadeOutTime=a},{name:"behaviors.fade.debugger.stage",value:["behaviors.fade.debugger."+["fade-in","wait","fade-out","done"][this._stage]]}]}]}}};
  
  
  'use strict';self.C3.Behaviors.Fade.Cnds={OnFadeOutEnd(){return!0},OnFadeInEnd(){return!0},OnWaitEnd(){return!0}};
  
  
  'use strict';self.C3.Behaviors.Fade.Acts={StartFade(){this._activeAtStart||this._setMaxOpacity||(this._maxOpacity=this._inst.GetWorldInfo().GetOpacity()||1,this._setMaxOpacity=!0);3===this._stage&&this.Start()},RestartFade(){this.Start()},SetFadeInTime(a){0>a&&(a=0);this._fadeInTime=a},SetWaitTime(a){0>a&&(a=0);this._waitTime=a},SetFadeOutTime(a){0>a&&(a=0);this._fadeOutTime=a}};
  
  
  'use strict';self.C3.Behaviors.Fade.Exps={FadeInTime(){return this._fadeInTime},WaitTime(){return this._waitTime},FadeOutTime(){return this._fadeOutTime}};
  
  
  'use strict';{const a=self.C3;a.Behaviors.Tween=class extends a.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}};
  
  
  'use strict';{const a=self.C3;a.Behaviors.Tween.Type=class extends a.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}};
  
  
  'use strict';{const g=self.C3,d=g.Behaviors.Tween;d.Instance=class extends g.SDKBehaviorInstanceBase{constructor(a,b){super(a);this._allowMultiple=!1;this._enabled=!0;b&&(this._allowMultiple=!1,this._enabled=!!b[0]);this._activeTweens=new Map;this._disabledTweens=[];this._waitingForReleaseTweens=new Map;this._waitingForReleaseTweensJson=this._disabledTweensJson=this._activeTweensJson=this._finishingTween=null;this._finishingTweenName="";this._enabled&&this._StartTicking2();this._afterLoad=a=>this._OnAfterLoad(a);
  this.GetRuntime().Dispatcher().addEventListener("afterload",this._afterLoad)}Release(){this.GetRuntime().Dispatcher().removeEventListener("afterload",this._afterLoad);this._afterLoad=null;this._finishingTween&&(this.ReleaseAndCompleteTween(this._finishingTween),this._finishingTween=null);this.ReleaseAndCompleteTweens();this._tweens=null;this.ClearDisabledList();this._disabledTweens=null;this._ReleaseWaitingTweens();this._waitingForReleaseTweens=null;super.Release()}SetEnabled(a){(this._enabled=a)?
  this._StartTicking2():this._StopTicking2()}GetEnabled(){return this._enabled}AddToDisabledList(a){this._disabledTweens.push(a)}IsInDisabledList(a){return this._disabledTweens.includes(a)}ClearDisabledList(){g.clearArray(this._disabledTweens)}GetFinishingTween(){return this._finishingTween}IsInstanceValid(){const a=this.GetObjectInstance();return a?!a.IsDestroyed():!1}GetTween(a,b,c=!1){if((b=b?this.PropertyTweens(b,c):this.AllTweens(c))&&b.length)for(const c of b)if(c.HasTags(a))return c}GetTweenIncludingWaitingForRelease(a,
  b){return this.GetTween(a,b,!0)}*GetTweens(a,b,c=!1){if((b=b?this.PropertyTweens(b,c):this.AllTweens(c))&&b.length)for(const c of b)c.HasTags(a)&&(yield c)}*GetTweensIncludingWaitingForRelease(a,b){yield*this.GetTweens(a,b,!0)}PropertyTweens(a,b){if(b)return b=this._activeTweens.get(a),a=this._waitingForReleaseTweens.get(a),b||(b=[]),a||(a=[]),b.concat(a).filter(a=>a);(a=this._activeTweens.get(a))||(a=[]);return a.filter(a=>a)}AllTweens(a){if(a){a=[...this._activeTweens.values()].flat();const b=[...this._waitingForReleaseTweens.values()].flat();
  return a.concat(b).filter(a=>a)}return[...this._activeTweens.values()].flat().filter(a=>a)}AllTweensIncludingWaitingForRelease(){return this.AllTweens(!0)}SaveToJson(){return{s:!1,e:!!this._enabled,at:this._SaveActiveTweensToJson(),dt:this._SaveDisabledTweensToJson(),wt:this._SaveWaitingForReleaseTweensToJson(),ft:this._SaveFinishingTweenToJson()}}LoadFromJson(a){a&&(this._activeTweensJson=a.at,this._disabledTweensJson=a.dt,this._waitingForReleaseTweensJson=a.wt,this._finishingTweenName=a.ft,this._allowMultiple=
  !1,this._enabled=!!a.e)}_OnAfterLoad(a){a=this.GetRuntime().GetTimelineManager();this._PopulateTweenMap(this._activeTweensJson,this._activeTweens,a);if(this._disabledTweensJson){g.clearArray(this._disabledTweens);for(const b of this._disabledTweensJson)this._PopulateTweenArray(this._disabledTweens,b,a)}this._PopulateTweenMap(this._waitingForReleaseTweensJson,this._waitingForReleaseTweens,a);this._finishingTween=this._GetTween(this._finishingTweenName,a);this._enabled?this._StartTicking2():this._StopTicking2()}_PopulateTweenMap(a,
  b,c){if(a)for(const d in a){let f=b.get(d);f?g.clearArray(f):f=[];var e=a[d];for(const a of e)this._PopulateTweenArray(f,a.name,c)?this._LoadTweenFromJson(a.name,a,c):(e=g.Tween.Build({runtime:this.GetRuntime(),json:a}),e.AddCompletedCallback(a=>this._FinishTriggers(a)),c.AddScheduledTimeline(e),this._PopulateTweenArray(f,e,c));b.set(d,f)}}_GetTween(a,b){return b.GetScheduledOrPlayingTimelineByName(a)}_PopulateTweenArray(a,b,c){if("string"===typeof b){if(b=this._GetTween(b,c))return!!a.push(b)}else return!!a.push(b);
  return!1}_LoadTweenFromJson(a,b,c){"string"===typeof a?(a=this._GetTween(a,c))&&a._LoadFromJson(b):a._LoadFromJson(b)}_SaveActiveTweensToJson(){const a={};for(const [b,c]of this._activeTweens)a[b]=c.map(a=>a._SaveToJson());return a}_SaveDisabledTweensToJson(){return this._disabledTweens.map(a=>a.GetName())}_SaveWaitingForReleaseTweensToJson(){const a={};for(const [b,c]of this._waitingForReleaseTweens)a[b]=c.map(a=>a._SaveToJson());return a}_SaveFinishingTweenToJson(){return this._finishingTween?this._finishingTween.GetName():
  ""}Tick2(){this._ReleaseWaitingTweens()}CreateTween(a){var b=d.Config.GetPropertyTracksConfig(a.property,a.startValue,a.endValue,a.ease,a.resultMode,this.GetObjectInstance());const c=d.Maps.GetPropertyFromIndex(a.property);d.Maps.IsValueId(c)||this.ReleaseTweens(a.property);b=g.Tween.Build({runtime:this.GetRuntime(),id:c,tags:a.tags,time:a.time,instance:this.GetObjectInstance(),releaseOnComplete:!!a.releaseOnComplete,loop:!!a.loop,pingPong:!!a.pingPong,initialValueMode:a.initialValueMode,propertyTracksConfig:b});
  b.AddCompletedCallback(a=>this._FinishTriggers(a));this._AddTween(b,a.property);return b}ReleaseTween(a,b=!1){var c=a.GetId();if(this._activeTweens.has(c)&&(c=this._activeTweens.get(c))){const b=c.indexOf(a);-1!==b&&c.splice(b,1)}a.IsReleased()||this._IsInWaitingList(a)||(a.Stop(b),this._AddToWaitingList(a))}ReleaseTweens(a,b=!1){if(g.IsFiniteNumber(a)){var c=d.Maps.GetPropertyFromIndex(a);if(this._activeTweens.has(c)){c=this._activeTweens.get(c);var e=this.GetFinishingTween();for(var f of c)f===
  e||f.IsReleased()||this._IsInWaitingList(f)||(f.Stop(b),f.Release());g.clearArray(c)}}else{f=this.GetFinishingTween();for(c of this.AllTweens())c===f||c.IsReleased()||this._IsInWaitingList(c)||(c.Stop(b),c.Release());for(e of this._activeTweens.keys())g.clearArray(this._activeTweens.get(e)),this._activeTweens.delete(e);this._activeTweens.clear()}}ReleaseAndCompleteTween(a){this.ReleaseTween(a,!0)}ReleaseAndCompleteTweens(){this.ReleaseTweens(NaN,!0)}GetPropertyValueByIndex(a){switch(a){case 0:return this._enabled}}SetPropertyValueByIndex(a,
  b){switch(a){case 0:this._enabled=!!b}}_GetBehaviorType(a){a=a.GetInstance().GetBehaviorInstances();for(const b of a)if(a=b.GetBehaviorType(),a.GetInstanceSdkCtor()===this.constructor)return a}Trigger(a,b,c,e){return this._runtime?super.Trigger(a):b.Trigger(a,c,e)}_FinishTriggers(a){this._finishingTween=a;d.Cnds.SetFinishingTween(a);let b,c;if(this.GetRuntime())b=this._inst,c=this._runtime,this.Trigger(d.Cnds.OnTweensFinished),this.Trigger(d.Cnds.OnAnyTweensFinished),this.ReleaseTween(a);else{b=a.GetInstance();
  if(!b||b&&b.IsDestroyed())return;c=b.GetRuntime();const e=this._GetBehaviorType(a);this.Trigger(d.Cnds.OnTweensFinished,c,b,e);this.Trigger(d.Cnds.OnAnyTweensFinished,c,b,e);a.Stop()}this._finishingTween=null;d.Cnds.SetFinishingTween(null);a.GetDestroyInstanceOnComplete()&&c.DestroyInstance(b)}_AddTween(a,b){b=d.Maps.GetPropertyFromIndex(b);this._activeTweens.has(b)||this._activeTweens.set(b,[]);this._activeTweens.get(b).push(a)}_AddToWaitingList(a){const b=a.GetId();this._waitingForReleaseTweens.has(b)||
  this._waitingForReleaseTweens.set(b,[]);this._waitingForReleaseTweens.get(b).push(a)}_IsInWaitingList(a){const b=a.GetId();return this._waitingForReleaseTweens.has(b)?this._waitingForReleaseTweens.get(b).includes(a):!1}_ReleaseWaitingTweens(){if(this._waitingForReleaseTweens.size){for(const a of this._waitingForReleaseTweens.values()){for(const b of a)b.IsReleased()||b.Release();g.clearArray(a)}this._waitingForReleaseTweens.clear()}}}};
  
  
  'use strict';{const b=self.C3;let c=null;b.Behaviors.Tween.Cnds={SetFinishingTween(a){c=a},OnTweensFinished(a){return c.HasTags(a)},OnAnyTweensFinished(){return!0},IsPlaying(a){return(a=[...this.GetTweensIncludingWaitingForRelease(a)],a.length)?a.some(b.Tween.IsPlaying):!1},IsAnyPlaying(){const a=[...this.AllTweensIncludingWaitingForRelease()];return a&&a.length?a.some(b.Tween.IsPlaying):!1},IsPaused(a){return(a=[...this.GetTweensIncludingWaitingForRelease(a)],a.length)?a.some(b.Tween.IsPaused):!1},
  IsAnyPaused(){const a=[...this.AllTweensIncludingWaitingForRelease()];return a&&a.length?a.some(b.Tween.IsPaused):!1}}};
  
  
  'use strict';{const e=self.C3,f=self.Ease,d=e.Behaviors.Tween;d.Acts={SetEnabled(a){this.SetEnabled(!!a);for(const b of this.AllTweens())a?this.IsInDisabledList(b)&&b.Resume():((b.IsPlaying()||b.IsScheduled())&&this.AddToDisabledList(b),b.Stop());a&&this.ClearDisabledList()},async TweenOneProperty(...a){this.GetEnabled()&&this.IsInstanceValid()&&(a=this.CreateTween(d.TweenArguments.OneProperty(this,...a)),a.Play()&&await a.GetPlayPromise())},async TweenTwoProperties(...a){this.GetEnabled()&&this.IsInstanceValid()&&
  (a=this.CreateTween(d.TweenArguments.TwoProperties(this,...a)),a.Play()&&await a.GetPlayPromise())},async TweenValue(...a){this.GetEnabled()&&this.IsInstanceValid()&&(a=this.CreateTween(d.TweenArguments.ValueProperty(this,...a)),a.Play()&&await a.GetPlayPromise())},PauseTweens(a){if(this.GetEnabled()&&this.IsInstanceValid())for(const b of this.GetTweens(a))b.Stop()},PauseAllTweens(){if(this.GetEnabled()&&this.IsInstanceValid())for(const a of this.AllTweens())a.Stop()},ResumeTweens(a){if(this.GetEnabled()&&
  this.IsInstanceValid())for(const b of this.GetTweens(a))b.Resume()},ResumeAllTweens(){if(this.GetEnabled()&&this.IsInstanceValid())for(const a of this.AllTweens())a.Resume()},StopTweens(a){if(this.GetEnabled()&&this.IsInstanceValid())for(const b of this.GetTweens(a))this.ReleaseTween(b)},StopAllTweens(){if(this.GetEnabled()&&this.IsInstanceValid())for(const a of this.AllTweens())this.ReleaseTween(a)},SetOnePropertyTweensEndValue(a,b,c){if(this.GetEnabled()&&this.IsInstanceValid())for(const d of this.GetTweens(a))d.BeforeSetEndValues([c]),
  d.SetEndValue(b,c)},SetTwoPropertiesTweensEndValue(a,b,c,g){if(this.GetEnabled()&&this.IsInstanceValid()){b=e.Behaviors.Tween.Maps.GetRealProperties(b);for(const d of this.GetTweens(a))d.BeforeSetEndValues(b),d.SetEndValue(c,b[0]),d.SetEndValue(g,b[1])}},SetValuePropertyTweensStartValue(a,b){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.GetTweens(a,"value"))c.SetStartValue(b,"value")},SetValuePropertyTweensEndValue(a,b){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.GetTweens(a,
  "value"))c.BeforeSetEndValues(["value"]),c.SetEndValue(b,"value")},SetTweensEase(a,b){if(this.GetEnabled()&&this.IsInstanceValid()){b=f.GetEaseFromIndex(b);for(const c of this.GetTweens(a))c.SetEase(b)}},SetAllTweensEase(a){if(this.GetEnabled()&&this.IsInstanceValid()){a=f.GetEaseFromIndex(a);for(const b of this.AllTweens())b.SetEase(a)}},SetTweensTime(a,b){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.GetTweens(a))c.SetTime(b)},SetAllTweensTime(a){if(this.GetEnabled()&&this.IsInstanceValid())for(const b of this.AllTweens())b.SetTime(a)},
  SetTweensPlaybackRate(a,b){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.GetTweens(a))c.SetPlaybackRate(b)},SetAllTweensPlaybackRate(a){if(this.GetEnabled()&&this.IsInstanceValid())for(const b of this.AllTweens())b.SetPlaybackRate(a)},SetTweensDestroyOnComplete(a,b){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.GetTweens(a))c.SetDestroyInstanceOnComplete(!!b)},SetAllTweensDestroyOnComplete(a){if(this.GetEnabled()&&this.IsInstanceValid())for(const b of this.AllTweens())b.SetDestroyInstanceOnComplete(!!a)}}};
  
  
  'use strict';self.C3.Behaviors.Tween.Exps={Time(a){return(a=this.GetTweenIncludingWaitingForRelease(a))?a.GetTime():0},Progress(a){return(a=this.GetTweenIncludingWaitingForRelease(a))?a.GetTime()/a.GetTotalTime():0},Value(a){return(a=this.GetTweenIncludingWaitingForRelease(a,"value"))?a.GetPropertyTrack("value").GetSourceAdapterValue():0},Tags(){return this.GetFinishingTween()?this.GetFinishingTween().GetStringTags():""}};
  
  
  'use strict';{const d=self.C3,e=self.Ease,f=["position","size","scale"],g="offsetX offsetY offsetWidth offsetHeight offsetAngle offsetOpacity offsetColor offsetZElevation offsetScaleX offsetScaleY".split(" "),h=["value"],b=[].concat(f).concat(g).concat(h),c={position:["offsetX","offsetY"],size:["offsetWidth","offsetHeight"],scale:["offsetScaleX","offsetScaleY"]},l=Object.assign({},b.reduce((a,k)=>Object.assign({},a,{[k]:[k]}),{}),c);d.Behaviors.Tween.Maps=class{constructor(){}static GetEases(){return[...e.GetRuntimeEaseNames()]}static GetEaseFromIndex(a){return[...e.GetRuntimeEaseNames()][a]}static GetPropertyFromIndex(a){return b[a]}static GetPropertyIndexFromName(a){return b.indexOf(a)}static GetPairPropertyFromIndex(a){return f[a]}static GetSinglePropertyFromIndex(a){return g[a]}static GetValuePropertyFromIndex(a){return h[a]}static GetPairProperties(a){return c[a]}static GetRealProperties(a){return d.IsString(a)?
  l[a]:l[b[a]]}static IsPairId(a){return!!c[a]}static IsColorId(a){return"offsetColor"===a}static IsAngleId(a){return"offsetAngle"===a}static IsOpacityId(a){return"offsetOpacity"===a}static IsValueId(a){return"value"===a}}};
  
  
  'use strict';{const h=self.C3,f=h.Behaviors.Tween,l=new Map;f.Config=class{constructor(){}static GetPropertyTracksConfig(a,b,c,d,e,g){0===l.size&&this._CreateConfigObjects();var k=f.PropertyTypes.Pick(a);k=l.get(k);h.IsFiniteNumber(a)&&(a=f.Maps.GetPropertyFromIndex(a));return this._GetConfig(k,a,b,c,d,e,g)}static TransformValue(a,b){return h.Behaviors.Tween.GetPropertyTracksConfig(a).valueGetter(b)}static _CreateConfigObjects(){const a=f.PropertyTypes,b=f.ValueGetters;this._AddConfigObject(a.PAIR,
  this._GetPairConfig,b._GetPropertyValue);this._AddConfigObject(a.COLOR,this._GetColorConfig,b._GetColorPropertyValue);this._AddConfigObject(a.ANGLE,this._GetAngleConfig,b._GetPropertyAngleValue);this._AddConfigObject(a.VALUE,this._GetValueConfig,b._GetPropertyValue);this._AddConfigObject(a.OTHER,this._GetCommonConfig,b._GetPropertyValue)}static _AddConfigObject(a,b,c){l.set(a,this._CreateConfigObject(a,b,c))}static _CreateConfigObject(a,b,c){return{name:a,configFunc:b,valueGetter:c}}static _GetConfig(a,
  b,c,d,e,g,k){return a.configFunc(b,a.valueGetter(c),a.valueGetter(d),e,g,k)}static _GetPairConfig(a,b,c,d,e,g){return f.Maps.GetPairProperties(a).map((a,g)=>({sourceId:"world-instance",property:a,type:"float",valueType:"numeric",startValue:b[g],endValue:c[g],ease:f.Maps.GetEaseFromIndex(d),resultMode:e}))}static _GetColorConfig(a,b,c,d,e,g){return h.Plugins.Text&&g.GetPlugin()instanceof h.Plugins.Text?{sourceId:"plugin",sourceArgs:[7],property:"color",type:"color",valueType:"color",startValue:b,endValue:c,
  ease:f.Maps.GetEaseFromIndex(d),resultMode:e}:{sourceId:"world-instance",property:a,type:"color",valueType:"color",startValue:b,endValue:c,ease:f.Maps.GetEaseFromIndex(d),resultMode:e}}static _GetAngleConfig(a,b,c,d,e,g){return{sourceId:"world-instance",property:a,type:"angle",valueType:"angle",startValue:b,endValue:c,ease:f.Maps.GetEaseFromIndex(d),resultMode:e}}static _GetCommonConfig(a,b,c,d,e,g){return{sourceId:"world-instance",property:a,type:"float",valueType:"numeric",startValue:b,endValue:c,
  ease:f.Maps.GetEaseFromIndex(d),resultMode:e}}static _GetValueConfig(a,b,c,d,e,g){return{sourceId:"value",property:a,type:"float",valueType:"numeric",startValue:b,endValue:c,ease:f.Maps.GetEaseFromIndex(d),resultMode:e}}}};
  
  
  'use strict';{const q=self.C3,d=q.Behaviors.Tween,t=Object.assign({},{resultMode:"absolute"},{tags:"",property:"",time:0,ease:0,releaseOnComplete:0,loop:!1,pingPong:!1}),r=Object.assign({},t,{initialValueMode:"current-state",startValue:0,endValue:0}),k=Object.assign({},t,{initialValueMode:"current-state",startValue:[0,0],endValue:[0,0]}),l=Object.assign({},t,{initialValueMode:"current-state",startValue:[0,0,0],endValue:[0,0,0]}),m=Object.assign({},r,{initialValueMode:"start-value"});d.TweenArguments=
  class{constructor(){}static _SetCommonProperties(a,e,b,c,f,g,h){a.tags=e;a.time=b;a.ease=c;a.releaseOnComplete=f;a.loop=g;a.pingPong=h}static OneProperty(a,e,b,c,f,g,h,n,p){a=d.Maps.GetSinglePropertyFromIndex(b);b=d.Maps.IsColorId(a)?l:r;this._SetCommonProperties(b,e,f,g,h,n,p);d.Maps.IsColorId(a)?(l.endValue[0]=q.GetRValue(c),l.endValue[1]=q.GetGValue(c),l.endValue[2]=q.GetBValue(c),l.property=d.Maps.GetPropertyIndexFromName(a)):d.Maps.IsOpacityId(a)?r.endValue=c/100:r.endValue=c;b.property=d.Maps.GetPropertyIndexFromName(a);
  return b}static TwoProperties(a,e,b,c,f,g,h,n,p,u){this._SetCommonProperties(k,e,g,h,n,p,u);a=d.Maps.GetPairPropertyFromIndex(b);k.endValue[0]=c;k.endValue[1]=f;k.property=d.Maps.GetPropertyIndexFromName(a);return k}static ValueProperty(a,e,b,c,f,g,h,n,p){this._SetCommonProperties(m,e,f,g,h,n,p);m.startValue=b;m.endValue=c;m.property=d.Maps.GetPropertyIndexFromName("value");return m}}};
  
  
  'use strict';{const d=self.C3,a=d.Behaviors.Tween,b=[];a.PropertyTypes=class{constructor(){}static Pick(c){0===b.length&&(b.push({checkFunc:a.Maps.IsPairId,result:this.PAIR}),b.push({checkFunc:a.Maps.IsColorId,result:this.COLOR}),b.push({checkFunc:a.Maps.IsAngleId,result:this.ANGLE}),b.push({checkFunc:a.Maps.IsValueId,result:this.VALUE}),b.push({checkFunc:()=>!0,result:this.OTHER}));d.IsFiniteNumber(c)&&(c=d.Behaviors.Tween.Maps.GetPropertyFromIndex(c));for(const a of b)if(a.checkFunc(c))return a.result}static get PAIR(){return"pair"}static get COLOR(){return"color"}static get ANGLE(){return"angle"}static get VALUE(){return"value"}static get OTHER(){return"other"}}};
  
  
  'use strict';{const b=self.C3;b.Behaviors.Tween.ValueGetters=class{constructor(){}static _GetPropertyAngleValue(a){a=b.toRadians(parseFloat(a));return b.clampAngle(a)}static _GetColorPropertyValue(a){return a.slice(0)}static _GetPropertyValue(a){return a}}};
  
  
  'use strict';{const b=self.C3;b.Behaviors.scrollto=class extends b.SDKBehaviorBase{constructor(a){super(a);this._shakeMode=this._shakeEnd=this._shakeStart=this._shakeMag=0}Release(){super.Release()}SetShakeMagnitude(a){this._shakeMag=a}GetShakeMagnitude(){return this._shakeMag}SetShakeStart(a){this._shakeStart=a}GetShakeStart(){return this._shakeStart}SetShakeEnd(a){this._shakeEnd=a}GetShakeEnd(){return this._shakeEnd}SetShakeMode(a){this._shakeMode=a}GetShakeMode(){return this._shakeMode}}};
  
  
  'use strict';{const a=self.C3;a.Behaviors.scrollto.Type=class extends a.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}};
  
  
  'use strict';{const e=self.C3;e.Behaviors.scrollto.Instance=class extends e.SDKBehaviorInstanceBase{constructor(a,b){super(a);this._isEnabled=!0;b&&(this._isEnabled=b[0]);this._isEnabled&&this._StartTicking2()}Release(){super.Release()}SaveToJson(){const a=this.GetBehavior();return{e:this._isEnabled,smg:a.GetShakeMagnitude(),ss:a.GetShakeStart(),se:a.GetShakeEnd(),smd:a.GetShakeMode()}}LoadFromJson(a){const b=this.GetBehavior();b.SetShakeMagnitude(a.smg);b.SetShakeStart(a.ss);b.SetShakeEnd(a.se);
  b.SetShakeMode(a.smd);(this._isEnabled=a.e)?this._StartTicking2():this._StopTicking2()}IsEnabled(){return this._isEnabled}Tick2(){if(this.IsEnabled()){this._runtime.GetDt(this._inst);var a=this.GetBehavior(),b=a.GetInstances(),g=0,h=0,f=0;for(var d of b)(b=d.GetBehaviorInstanceFromCtor(e.Behaviors.scrollto))&&b.GetSdkInstance().IsEnabled()&&(b=d.GetWorldInfo(),g+=b.GetX(),h+=b.GetY(),++f);d=this._inst.GetWorldInfo().GetLayout();var c=this._runtime.GetGameTime(),k=b=0;c>=a.GetShakeStart()&&c<a.GetShakeEnd()&&
  (b=a.GetShakeMagnitude()*Math.min(this._runtime.GetTimeScale(),1),0===a.GetShakeMode()&&(b*=1-(c-a.GetShakeStart())/(a.GetShakeEnd()-a.GetShakeStart())),a=this._runtime.Random()*Math.PI*2,c=this._runtime.Random()*b,b=Math.cos(a)*c,k=Math.sin(a)*c);d.SetScrollX(g/f+b);d.SetScrollY(h/f+k)}}GetPropertyValueByIndex(a){switch(a){case 0:return this._isEnabled}}SetPropertyValueByIndex(a,b){switch(a){case 0:(this._isEnabled=!!b)?this._StartTicking2():this._StopTicking2()}}}};
  
  
  'use strict';self.C3.Behaviors.scrollto.Cnds={IsEnabled(){return this._isEnabled}};
  
  
  'use strict';self.C3.Behaviors.scrollto.Acts={Shake(b,c,d){const a=this.GetBehavior();a.SetShakeMagnitude(b);a.SetShakeStart(this._runtime.GetGameTime());a.SetShakeEnd(this._runtime.GetGameTime()+c);a.SetShakeMode(d)},SetEnabled(b){(this._isEnabled=0!==b)?this._StartTicking2():this._StopTicking2()}};
  
  
  'use strict';self.C3.Behaviors.scrollto.Exps={};
  
  
  'use strict';{const a=self.C3;a.Behaviors.Pin=class extends a.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}};
  
  
  'use strict';{const a=self.C3;a.Behaviors.Pin.Type=class extends a.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}};
  
  
  'use strict';{const f=self.C3;f.Behaviors.Pin.Instance=class extends f.SDKBehaviorInstanceBase{constructor(a,c){super(a);this._pinInst=null;this._pinUid=-1;this._mode="";this._propSet=new Set;this._lastKnownAngle=this._dz=this._dAngle=this._dHeight=this._dWidth=this._dy=this._dx=this._pinImagePoint=this._pinAngle=this._pinDist=0;this._destroy=!1;c&&(this._destroy=c[0]);a=this._runtime.Dispatcher();this._disposables=new f.CompositeDisposable(f.Disposable.From(a,"instancedestroy",a=>this._OnInstanceDestroyed(a.instance)),
  f.Disposable.From(a,"afterload",a=>this._OnAfterLoad()))}Release(){this._pinInst=null;super.Release()}_SetPinInst(a){a?(this._pinInst=a,this._StartTicking2()):(this._pinInst=null,this._StopTicking2())}_Pin(a,c,b){if(a&&(a=a.GetFirstPicked(this._inst)))if(this._mode=c,this._SetPinInst(a),c=this._inst.GetWorldInfo(),a=a.GetWorldInfo(),"properties"===this._mode){const d=this._propSet;d.clear();for(const a of b)d.add(a);this._dx=c.GetX()-a.GetX();this._dy=c.GetY()-a.GetY();this._dAngle=c.GetAngle()-a.GetAngle();
  this._lastKnownAngle=c.GetAngle();this._dz=c.GetZElevation()-a.GetZElevation();d.has("x")&&d.has("y")&&(this._pinAngle=f.angleTo(a.GetX(),a.GetY(),c.GetX(),c.GetY())-a.GetAngle(),this._pinDist=f.distanceTo(a.GetX(),a.GetY(),c.GetX(),c.GetY()));d.has("width-abs")?this._dWidth=c.GetWidth()-a.GetWidth():d.has("width-scale")&&(this._dWidth=c.GetWidth()/a.GetWidth());d.has("height-abs")?this._dHeight=c.GetHeight()-a.GetHeight():d.has("height-scale")&&(this._dHeight=c.GetHeight()/a.GetHeight())}else this._pinDist=
  f.distanceTo(a.GetX(),a.GetY(),c.GetX(),c.GetY())}SaveToJson(){const a=this._propSet,c=this._mode,b={uid:this._pinInst?this._pinInst.GetUID():-1,m:c};if("rope"===c||"bar"===c)b.pd=this._pinDist;else if("properties"===c){b.ps=[...this._propSet];a.has("imagepoint")?b.ip=this._pinImagePoint:a.has("x")&&a.has("y")?(b.pa=this._pinAngle,b.pd=this._pinDist):(a.has("x")&&(b.dx=this._dx),a.has("y")&&(b.dy=this._dy));a.has("angle")&&(b.da=this._dAngle,b.lka=this._lastKnownAngle);if(a.has("width-abs")||a.has("width-scale"))b.dw=
  this._dWidth;if(a.has("height-abs")||a.has("height-scale"))b.dh=this._dHeight;a.has("z")&&(b.dz=this._dz)}return b}LoadFromJson(a){const c=a.m,b=this._propSet;b.clear();this._pinUid=a.uid;if("number"===typeof c)this._LoadFromJson_Legacy(a);else if(this._mode=c,"rope"===c||"bar"===c)this._pinDist=a.pd;else if("properties"===c){for(const c of a.ps)b.add(c);b.has("imagepoint")?this._pinImagePoint=a.ip:b.has("x")&&b.has("y")?(this._pinAngle=a.pa,this._pinDist=a.pd):(b.has("x")&&(this._dx=a.dx),b.has("y")&&
  (this._dy=a.dy));b.has("angle")&&(this._dAngle=a.da,this._lastKnownAngle=a.lka||0);if(b.has("width-abs")||b.has("width-scale"))this._dWidth=a.dw;if(b.has("height-abs")||b.has("height-scale"))this._dHeight=a.dh;b.has("z")&&(this._dz=a.dz)}}_LoadFromJson_Legacy(a){const c=this._propSet,b=a.msa,d=a.tsa,e=a.pa,g=a.pd;switch(a.m){case 0:this._mode="properties";c.add("x").add("y").add("angle");this._pinAngle=e;this._pinDist=g;this._dAngle=b-d;this._lastKnownAngle=a.lka;break;case 1:this._mode="properties";
  c.add("x").add("y");this._pinAngle=e;this._pinDist=g;break;case 2:this._mode="properties";c.add("angle");this._dAngle=b-d;this._lastKnownAngle=a.lka;break;case 3:this._mode="rope";this._pinDist=a.pd;break;case 4:this._mode="bar",this._pinDist=a.pd}}_OnAfterLoad(){-1===this._pinUid?this._SetPinInst(null):(this._SetPinInst(this._runtime.GetInstanceByUID(this._pinUid)),this._pinUid=-1)}_OnInstanceDestroyed(a){this._pinInst===a&&(this._SetPinInst(null),this._destroy&&this._runtime.DestroyInstance(this._inst))}Tick2(){var a=
  this._pinInst;if(a){var c=a.GetWorldInfo(),b=this._inst.GetWorldInfo(),d=this._mode,e=!1;if("rope"===d||"bar"===d){if(a=f.distanceTo(b.GetX(),b.GetY(),c.GetX(),c.GetY()),a>this._pinDist||"bar"===d&&a<this._pinDist)e=f.angleTo(c.GetX(),c.GetY(),b.GetX(),b.GetY()),b.SetXY(c.GetX()+Math.cos(e)*this._pinDist,c.GetY()+Math.sin(e)*this._pinDist),e=!0}else{d=this._propSet;if(d.has("imagepoint")){const [c,d]=a.GetImagePoint(this._pinImagePoint);b.EqualsXY(c,d)||(b.SetXY(c,d),e=!0)}else if(d.has("x")&&d.has("y")){a=
  c.GetX()+Math.cos(c.GetAngle()+this._pinAngle)*this._pinDist;const d=c.GetY()+Math.sin(c.GetAngle()+this._pinAngle)*this._pinDist;b.EqualsXY(a,d)||(b.SetXY(a,d),e=!0)}else a=c.GetX()+this._dx,d.has("x")&&a!==b.GetX()&&(b.SetX(a),e=!0),a=c.GetY()+this._dy,d.has("y")&&a!==b.GetY()&&(b.SetY(a),e=!0);d.has("angle")&&(this._lastKnownAngle!==b.GetAngle()&&(this._dAngle=f.clampAngle(this._dAngle+(b.GetAngle()-this._lastKnownAngle))),a=f.clampAngle(c.GetAngle()+this._dAngle),a!==b.GetAngle()&&(b.SetAngle(a),
  e=!0),this._lastKnownAngle=b.GetAngle());d.has("width-abs")&&(a=c.GetWidth()+this._dWidth,a!==b.GetWidth()&&(b.SetWidth(a),e=!0));d.has("width-scale")&&(a=c.GetWidth()*this._dWidth,a!==b.GetWidth()&&(b.SetWidth(a),e=!0));d.has("height-abs")&&(a=c.GetHeight()+this._dHeight,a!==b.GetHeight()&&(b.SetHeight(a),e=!0));d.has("height-scale")&&(a=c.GetHeight()*this._dHeight,a!==b.GetHeight()&&(b.SetHeight(a),e=!0));d.has("z")&&(a=c.GetZElevation()+this._dz,a!==b.GetZElevation()&&(b.SetZElevation(a),this._runtime.UpdateRender()))}e&&
  b.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(a,d){this._Pin(a,0===d?"rope":"bar")},PinByProperties(a,d,h,f,e,g,c){const b=[];d&&b.push("x");h&&b.push("y");f&&b.push("angle");c&&b.push("z");1===e?b.push("width-abs"):2===e&&b.push("width-scale");1===g?b.push("height-abs"):2===g&&b.push("height-scale");0!==b.length&&this._Pin(a,"properties",b)},PinByImagePoint(a,d,h,f,e,g){const c=["imagepoint"];h&&c.push("angle");g&&c.push("z");1===f?c.push("width-abs"):2===f&&c.push("width-scale");1===e?
  c.push("height-abs"):2===e&&c.push("height-scale");this._pinImagePoint=d;this._Pin(a,"properties",c)},SetPinDistance(a){if("rope"===this._mode||"bar"===this._mode)this._pinDist=Math.max(a,0)},SetDestroy(a){this._destroy=a},Unpin(){this._SetPinInst(null);this._mode="";this._propSet.clear();this._pinImagePoint=""},Pin(a,d){switch(d){case 0:this._Pin(a,"properties",["x","y","angle"]);break;case 1:this._Pin(a,"properties",["x","y"]);break;case 2:this._Pin(a,"properties",["angle"]);break;case 3:this._Pin(a,
  "rope");break;case 4:this._Pin(a,"bar")}}};
  
  
  'use strict';self.C3.Behaviors.Pin.Exps={PinnedUID(){return this._pinInst?this._pinInst.GetUID():-1}};
  
  
  'use strict';{const a=self.C3;a.Behaviors.Flash=class extends a.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}};
  
  
  'use strict';{const a=self.C3;a.Behaviors.Flash.Type=class extends a.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}};
  
  
  'use strict';{const b=self.C3;b.Behaviors.Flash.Instance=class extends b.SDKBehaviorInstanceBase{constructor(a,c){super(a);this._timeLeft=this._stageTimeLeft=this._stage=this._offTime=this._onTime=0;this._StartTicking()}Release(){super.Release()}SaveToJson(){return{on:this._onTime,off:this._offTime,s:this._stage,stl:this._stageTimeLeft,tl:this._timeLeft}}LoadFromJson(a){this._onTime=a.on;this._offTime=a.off;this._stage=a.s;this._stageTimeLeft=a.stl;this._timeLeft=null===a.tl?Infinity:a.tl}Tick(){if(!(0>=
  this._timeLeft)){var a=this._runtime.GetDt(this._inst);this._timeLeft-=a;if(0>=this._timeLeft)return this._timeLeft=0,this._inst.GetWorldInfo().SetVisible(!0),this._runtime.UpdateRender(),this.DebugTrigger(b.Behaviors.Flash.Cnds.OnFlashEnded);this._stageTimeLeft-=a;0>=this._stageTimeLeft&&(0===this._stage?(this._inst.GetWorldInfo().SetVisible(!1),this._stage=1,this._stageTimeLeft+=this._offTime):(this._inst.GetWorldInfo().SetVisible(!0),this._stage=0,this._stageTimeLeft+=this._onTime),this._runtime.UpdateRender())}}GetDebuggerProperties(){return[{title:"$"+
  this.GetBehaviorType().GetName(),properties:[{name:"behaviors.flash.debugger.on-time",value:this._onTime,onedit:a=>this._onTime=a},{name:"behaviors.flash.debugger.off-time",value:this._offTime,onedit:a=>this._offTime=a},{name:"behaviors.flash.debugger.is-flashing",value:0<this._timeLeft},{name:"behaviors.flash.debugger.time-left",value:this._timeLeft}]}]}}};
  
  
  'use strict';self.C3.Behaviors.Flash.Cnds={IsFlashing(){return 0<this._timeLeft},OnFlashEnded(){return!0}};
  
  
  'use strict';self.C3.Behaviors.Flash.Acts={Flash(b,a,c){this._onTime=b;this._offTime=a;this._stage=1;this._stageTimeLeft=a;this._timeLeft=c;this._inst.GetWorldInfo().SetVisible(!1);this._runtime.UpdateRender()},StopFlashing(){this._timeLeft=0;this._inst.GetWorldInfo().SetVisible(!0);this._runtime.UpdateRender()}};
  
  
  'use strict';self.C3.Behaviors.Flash.Exps={};
  
  
  'use strict';{const a=self.C3;a.Behaviors.destroy=class extends a.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}};
  
  
  'use strict';{const a=self.C3;a.Behaviors.destroy.Type=class extends a.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}};
  
  
  'use strict';{const c=self.C3;c.Behaviors.destroy.Instance=class extends c.SDKBehaviorInstanceBase{constructor(a,b){super(a);this._StartTicking()}Release(){super.Release()}Tick(){var a=this._inst.GetWorldInfo();const b=a.GetBoundingBox();a=a.GetLayout();(0>b.getRight()||0>b.getBottom()||b.getLeft()>a.GetWidth()||b.getTop()>a.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={};
  
  
  "use strict"
  {
  	const C3 = self.C3;
  	self.C3_GetObjectRefTable = function () {
  		return [
  		C3.Plugins.Sprite,
  		C3.Plugins.Tilemap,
  		C3.Plugins.TiledBg,
  		C3.Behaviors.TileMovement,
  		C3.Behaviors.Fade,
  		C3.Plugins.Text,
  		C3.Behaviors.Tween,
  		C3.Plugins.Keyboard,
  		C3.Behaviors.scrollto,
  		C3.Plugins.Particles,
  		C3.Behaviors.Pin,
  		C3.Behaviors.Flash,
  		C3.Plugins.Audio,
  		C3.Plugins.Mouse,
  		C3.Plugins.LocalStorage,
  		C3.Behaviors.destroy,
  		C3.Plugins.System.Cnds.OnLayoutStart,
  		C3.Plugins.System.Cnds.For,
  		C3.Plugins.Text.Acts.SetText,
  		C3.Plugins.System.Cnds.CompareVar,
  		C3.Plugins.System.Cnds.ForEach,
  		C3.Plugins.Sprite.Cnds.IsOverlapping,
  		C3.Behaviors.TileMovement.Acts.SetGridPosition,
  		C3.Behaviors.TileMovement.Exps.GridX,
  		C3.Behaviors.TileMovement.Exps.GridY,
  		C3.Plugins.Sprite.Acts.SetWidth,
  		C3.Plugins.Sprite.Acts.SetHeight,
  		C3.Behaviors.Tween.Acts.TweenTwoProperties,
  		C3.Plugins.Sprite.Exps.ImageWidth,
  		C3.Plugins.Sprite.Exps.ImageHeight,
  		C3.Behaviors.Tween.Cnds.OnTweensFinished,
  		C3.Plugins.System.Cnds.CompareBoolVar,
  		C3.Plugins.System.Cnds.Compare,
  		C3.Behaviors.Tween.Exps.Progress,
  		C3.Plugins.System.Cnds.TriggerOnce,
  		C3.Behaviors.Flash.Cnds.IsFlashing,
  		C3.Behaviors.Flash.Acts.Flash,
  		C3.Behaviors.Tween.Acts.StopAllTweens,
  		C3.Plugins.Sprite.Cnds.OnCreated,
  		C3.Behaviors.TileMovement.Acts.SetEnabled,
  		C3.Plugins.Keyboard.Cnds.OnKeyCode,
  		C3.Plugins.Tilemap.Cnds.CompareTileAt,
  		C3.Plugins.Sprite.Acts.Spawn,
  		C3.Plugins.Sprite.Acts.SetInstanceVar,
  		C3.Plugins.Sprite.Cnds.PickInstVarHiLow,
  		C3.Plugins.Sprite.Exps.ObjectTypeName,
  		C3.Behaviors.Tween.Acts.TweenOneProperty,
  		C3.Plugins.Sprite.Exps.Y,
  		C3.Plugins.Sprite.Cnds.IsBoolInstanceVarSet,
  		C3.Plugins.Sprite.Acts.SetDefaultColor,
  		C3.Plugins.System.Exps.rgbex255,
  		C3.Plugins.Sprite.Acts.MoveToLayer,
  		C3.Plugins.Sprite.Acts.SetPosToObject,
  		C3.Behaviors.Pin.Acts.PinByProperties,
  		C3.Plugins.System.Acts.WaitForPreviousActions,
  		C3.Plugins.System.Cnds.ForEachOrdered,
  		C3.Behaviors.Pin.Acts.Unpin,
  		C3.Plugins.Sprite.Exps.UID,
  		C3.Plugins.Tilemap.Exps.TileToPositionY,
  		C3.Plugins.System.Acts.AddVar,
  		C3.Plugins.System.Acts.CreateObjectByName,
  		C3.Plugins.System.Exps.choose,
  		C3.Plugins.Sprite.Exps.X,
  		C3.Plugins.System.Cnds.PickLastCreated,
  		C3.Plugins.Sprite.Acts.SetSize,
  		C3.Plugins.Sprite.Acts.SetBoolInstanceVar,
  		C3.Behaviors.Tween.Cnds.IsAnyPlaying,
  		C3.Plugins.System.Acts.SetFunctionReturnValue,
  		C3.Plugins.System.Acts.Wait,
  		C3.Plugins.Sprite.Acts.Destroy,
  		C3.Plugins.System.Acts.SetVar,
  		C3.Plugins.Particles.Exps.Count,
  		C3.Plugins.Sprite.Cnds.OnDestroyed,
  		C3.Plugins.System.Acts.SetBoolVar,
  		C3.Plugins.Sprite.Cnds.PickByUID,
  		C3.Plugins.System.Cnds.PickOverlappingPoint,
  		C3.Plugins.Tilemap.Exps.TileToPositionX,
  		C3.Plugins.System.Cnds.PickByComparison,
  		C3.Plugins.Sprite.Exps.PickedCount,
  		C3.Behaviors.scrollto.Acts.Shake,
  		C3.Plugins.LocalStorage.Acts.SetItem,
  		C3.Plugins.System.Acts.SetLayerVisible,
  		C3.Plugins.System.Acts.GoToLayout,
  		C3.Plugins.System.Cnds.LayerVisible,
  		C3.Plugins.System.Cnds.Every,
  		C3.Plugins.System.Exps.int,
  		C3.Plugins.Text.Exps.Text,
  		C3.Plugins.Keyboard.Cnds.OnKey,
  		C3.Plugins.Audio.Acts.StopAll,
  		C3.Plugins.Audio.Acts.Play,
  		C3.Plugins.Keyboard.Exps.StringFromKeyCode,
  		C3.Plugins.Audio.Cnds.IsTagPlaying,
  		C3.Plugins.Audio.Acts.Stop,
  		C3.Plugins.LocalStorage.Acts.CheckItemExists,
  		C3.Plugins.LocalStorage.Cnds.OnItemMissing,
  		C3.Plugins.LocalStorage.Cnds.OnItemExists,
  		C3.Plugins.LocalStorage.Acts.GetItem,
  		C3.Plugins.LocalStorage.Cnds.OnItemGet,
  		C3.Plugins.LocalStorage.Exps.ItemValue,
  		C3.Plugins.System.Cnds.Else,
  		C3.Plugins.System.Acts.SubVar,
  		C3.Plugins.Keyboard.Cnds.OnAnyKey,
  		C3.Plugins.Keyboard.Exps.LastKeyCode
  		];
  	};
  	self.C3_JsPropNameTable = [
  		{Background_White: 0},
  		{Tilemap: 0},
  		{TiledBackground: 0},
  		{TileMovement: 0},
  		{Player: 0},
  		{Fade: 0},
  		{RaggioTraente: 0},
  		{RaggioTraiettoria: 0},
  		{GridX: 0},
  		{GridY: 0},
  		{TargetY: 0},
  		{Mobile: 0},
  		{Destroy: 0},
  		{Object_Square: 0},
  		{Object_Blocco: 0},
  		{Object_Rhombus: 0},
  		{Object_Triangle: 0},
  		{Object_Circle: 0},
  		{Count_Drops: 0},
  		{Count_Level: 0},
  		{Count_Score: 0},
  		{Label: 0},
  		{Tween: 0},
  		{DropTime: 0},
  		{Keyboard: 0},
  		{Controls_Left: 0},
  		{Controls_Right: 0},
  		{Controls_pull: 0},
  		{Controls_shoot: 0},
  		{ScrollTo: 0},
  		{Shake: 0},
  		{Particles: 0},
  		{Pin: 0},
  		{Flash: 0},
  		{evidenzia_oggetto: 0},
  		{death: 0},
  		{GameOver_ContoAllaRovescia: 0},
  		{Audio: 0},
  		{Mouse: 0},
  		{Count_TopScore: 0},
  		{Count_LastScore: 0},
  		{Count_Difficult: 0},
  		{Select_Control: 0},
  		{LocalStorage: 0},
  		{DestroyOutsideLayout: 0},
  		{oggetti_che_scendono: 0},
  		{timer: 0},
  		{TipoOggettoPrecedente: 0},
  		{gridY: 0},
  		{count: 0},
  		{Move_LEFT: 0},
  		{Move_RIGHT: 0},
  		{Pull_DOWN: 0},
  		{Shoot_UP: 0},
  		{TipoA: 0},
  		{TipoB: 0},
  		{TipoC: 0},
  		{UID: 0},
  		{Tipo: 0},
  		{Contatore: 0},
  		{IS_LIVE: 0},
  		{TimerPrimaDellaDiscesa: 0},
  		{TempoPerMuoversiOggetti: 0},
  		{LAYER_OGGETTI: 0},
  		{LAYER_OGGETTI_PRESI: 0},
  		{LAYER_RAGGIO: 0},
  		{LAYER_GAME_OVER: 0},
  		{OBJECT_CIRCLE: 0},
  		{OBJECT_RHOMBUS: 0},
  		{OBJECT_SQUARE: 0},
  		{OBJECT_TRIANGLE: 0},
  		{SCORE_SCORE: 0},
  		{SCORE_LEVEL: 0},
  		{SCORE_DROP_LINE: 0},
  		{SCORE_LAST_SCORE: 0},
  		{SCORE_TOP_SCORE: 0},
  		{TimerPrimaDellaDiscesa_Numero: 0},
  		{TimerPrimaDellaDiscesa_String: 0}
  	];
  }
  
  "use strict";
  
  {
  	const C3 = self.C3;
  	
  	function unaryminus(n)
  	{
  		return (typeof n === "number" ? -n : n);
  	}
  
  	function bothNumbers(a, b)
  	{
  		return typeof a === "number" && typeof b === "number";
  	}
  
  	function add(l, r)
  	{
  		if (bothNumbers(l, r))
  			return l + r;
  		else
  			return l;
  	}
  
  	function subtract(l, r)
  	{
  		if (bothNumbers(l, r))
  			return l - r;
  		else
  			return l;
  	}
  
  	function multiply(l, r)
  	{
  		if (bothNumbers(l, r))
  			return l * r;
  		else
  			return l;
  	}
  
  	function divide(l, r)
  	{
  		if (bothNumbers(l, r))
  			return l / r;
  		else
  			return l;
  	}
  
  	function mod(l, r)
  	{
  		if (bothNumbers(l, r))
  			return l % r;
  		else
  			return l;
  	}
  
  	function pow(l, r)
  	{
  		if (bothNumbers(l, r))
  			return Math.pow(l, r);
  		else
  			return l;
  	}
  
  	function and(l, r)
  	{
  		if (typeof l === "string" || typeof r === "string")
  		{
  			// & with either side string does string concatenation
  			let lstr, rstr;
  
  			if (typeof l === "number")
  				lstr = (Math.round(l * 1e10) / 1e10).toString();
  			else
  				lstr = l;
  			
  			if (typeof r === "number")
  				rstr = (Math.round(r * 1e10) / 1e10).toString();
  			else
  				rstr = r;
  			
  			return lstr + rstr;
  		}
  		else
  		{
  			// & with neither side a string does logical AND
  			return (l && r ? 1 : 0);
  		}
  	}
  
  	function or(l, r)
  	{
  		if (bothNumbers(l, r))
  			return (l || r ? 1 : 0);
  		else
  			return l;
  	}
  
  	self.C3_ExpressionFuncs = [
  		() => "",
  		() => 1,
  		() => 4,
  		p => {
  			const v0 = p._GetNode(0).GetVar();
  			const v1 = p._GetNode(1).GetVar();
  			return () => ((((v0.GetValue()) > (1) ? 1 : 0)) ? (and(v1.GetValue(), " lines")) : ("1 line"));
  		},
  		p => {
  			const v0 = p._GetNode(0).GetVar();
  			return () => v0.GetValue();
  		},
  		() => 0,
  		p => {
  			const n0 = p._GetNode(0);
  			return () => n0.ExpBehavior();
  		},
  		p => {
  			const n0 = p._GetNode(0);
  			return () => (n0.ExpBehavior() + 1);
  		},
  		() => "DropTime",
  		p => {
  			const n0 = p._GetNode(0);
  			return () => n0.ExpObject();
  		},
  		() => 2,
  		p => {
  			const n0 = p._GetNode(0);
  			return () => n0.ExpBehavior("DropTime");
  		},
  		() => 0.9,
  		() => 0.1,
  		p => {
  			const n0 = p._GetNode(0);
  			return () => (n0.ExpBehavior() - 1);
  		},
  		() => "Pull",
  		p => {
  			const f0 = p._GetNode(0).GetBoundMethod();
  			return () => f0();
  		},
  		() => "nessun oggetto",
  		() => "down",
  		() => 16,
  		p => {
  			const f0 = p._GetNode(0).GetBoundMethod();
  			return () => f0(244, 140, 6);
  		},
  		p => {
  			const n0 = p._GetNode(0);
  			return () => n0.ExpInstVar_Family();
  		},
  		p => {
  			const f0 = p._GetNode(0).GetBoundMethod();
  			return () => f0(255, 255, 255);
  		},
  		() => "up",
  		() => 28,
  		p => {
  			const n0 = p._GetNode(0);
  			const v1 = p._GetNode(1).GetVar();
  			return () => n0.ExpObject(v1.GetValue());
  		},
  		p => {
  			const f0 = p._GetNode(0).GetBoundMethod();
  			const v1 = p._GetNode(1).GetVar();
  			const v2 = p._GetNode(2).GetVar();
  			const v3 = p._GetNode(3).GetVar();
  			const v4 = p._GetNode(4).GetVar();
  			return () => f0(v1.GetValue(), v2.GetValue(), v3.GetValue(), v4.GetValue());
  		},
  		() => 0.5,
  		() => 1.5,
  		p => {
  			const v0 = p._GetNode(0).GetVar();
  			return () => (v0.GetValue() * 40);
  		},
  		p => {
  			const v0 = p._GetNode(0).GetVar();
  			return () => (v0.GetValue() + 1);
  		},
  		p => {
  			const v0 = p._GetNode(0).GetVar();
  			return () => (v0.GetValue() * 10);
  		},
  		p => {
  			const n0 = p._GetNode(0);
  			const v1 = p._GetNode(1).GetVar();
  			return () => n0.ExpObject((v1.GetValue() - 1));
  		},
  		p => {
  			const n0 = p._GetNode(0);
  			const v1 = p._GetNode(1).GetVar();
  			return () => n0.ExpObject((v1.GetValue() - 2));
  		},
  		p => {
  			const v0 = p._GetNode(0).GetVar();
  			return () => (v0.GetValue() - 1);
  		},
  		() => "Object_Blocco",
  		() => 0.2,
  		p => {
  			const v0 = p._GetNode(0).GetVar();
  			const v1 = p._GetNode(1).GetVar();
  			const v2 = p._GetNode(2).GetVar();
  			const v3 = p._GetNode(3).GetVar();
  			return () => ((((v0.GetValue()) > (v1.GetValue()) ? 1 : 0)) ? (v2.GetValue()) : (v3.GetValue()));
  		},
  		() => "SCORE_LAST_SCORE",
  		() => "SCORE_TOP_SCORE",
  		() => 6,
  		() => 5,
  		p => {
  			const f0 = p._GetNode(0).GetBoundMethod();
  			const n1 = p._GetNode(1);
  			return () => (f0(n1.ExpObject()) - 1);
  		},
  		() => "Game",
  		p => {
  			const f0 = p._GetNode(0).GetBoundMethod();
  			const v1 = p._GetNode(1).GetVar();
  			return () => f0(v1.GetValue());
  		},
  		() => "Lost",
  		() => "Menu",
  		() => "Impossible",
  		() => 10,
  		() => "Hard",
  		() => 15,
  		() => "Normal",
  		() => 20,
  		() => "Easy",
  		() => "Move_LEFT",
  		() => "Move_RIGHT",
  		() => "Pull_DOWN",
  		() => "Shoot_UP",
  		() => 9,
  		() => 17,
  		() => 32,
  		() => 13,
  		() => 27
  	];
  }
  
  
  "use strict";
  
  {
  	const scriptsInEvents = {
  
  
  
  	};
  	
  	self.C3.ScriptsInEvents = scriptsInEvents;
  }
  
  
  