@m2c2kit/core 0.3.9 → 0.3.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -8,6 +8,12 @@ var ActionType = /* @__PURE__ */ ((ActionType2) => {
8
8
  return ActionType2;
9
9
  })(ActionType || {});
10
10
 
11
+ var __defProp$k = Object.defineProperty;
12
+ var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
+ var __publicField$k = (obj, key, value) => {
14
+ __defNormalProp$k(obj, typeof key !== "symbol" ? key + "" : key, value);
15
+ return value;
16
+ };
11
17
  class Easings {
12
18
  }
13
19
  // These easing functions are adapted from work by Robert Penner
@@ -26,125 +32,134 @@ class Easings {
26
32
  // Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
27
33
  // Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.
28
34
  // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
- Easings.none = (t, b, c, d) => {
35
+ __publicField$k(Easings, "none", (t, b, c, d) => {
30
36
  return c + b;
31
- };
32
- Easings.linear = (t, b, c, d) => {
37
+ });
38
+ __publicField$k(Easings, "linear", (t, b, c, d) => {
33
39
  return c * t / d + b;
34
- };
35
- Easings.quadraticIn = (t, b, c, d) => {
40
+ });
41
+ __publicField$k(Easings, "quadraticIn", (t, b, c, d) => {
36
42
  t /= d;
37
43
  return c * t * t + b;
38
- };
39
- Easings.quadraticOut = (t, b, c, d) => {
44
+ });
45
+ __publicField$k(Easings, "quadraticOut", (t, b, c, d) => {
40
46
  t /= d;
41
47
  return -c * t * (t - 2) + b;
42
- };
43
- Easings.quadraticInOut = (t, b, c, d) => {
48
+ });
49
+ __publicField$k(Easings, "quadraticInOut", (t, b, c, d) => {
44
50
  t /= d / 2;
45
51
  if (t < 1)
46
52
  return c / 2 * t * t + b;
47
53
  t--;
48
54
  return -c / 2 * (t * (t - 2) - 1) + b;
49
- };
50
- Easings.cubicIn = (t, b, c, d) => {
55
+ });
56
+ __publicField$k(Easings, "cubicIn", (t, b, c, d) => {
51
57
  t /= d;
52
58
  return c * t * t * t + b;
53
- };
54
- Easings.cubicOut = (t, b, c, d) => {
59
+ });
60
+ __publicField$k(Easings, "cubicOut", (t, b, c, d) => {
55
61
  t /= d;
56
62
  t--;
57
63
  return c * (t * t * t + 1) + b;
58
- };
59
- Easings.cubicInOut = (t, b, c, d) => {
64
+ });
65
+ __publicField$k(Easings, "cubicInOut", (t, b, c, d) => {
60
66
  t /= d / 2;
61
67
  if (t < 1)
62
68
  return c / 2 * t * t * t + b;
63
69
  t -= 2;
64
70
  return c / 2 * (t * t * t + 2) + b;
65
- };
66
- Easings.quarticIn = (t, b, c, d) => {
71
+ });
72
+ __publicField$k(Easings, "quarticIn", (t, b, c, d) => {
67
73
  t /= d;
68
74
  return c * t * t * t * t + b;
69
- };
70
- Easings.quarticOut = (t, b, c, d) => {
75
+ });
76
+ __publicField$k(Easings, "quarticOut", (t, b, c, d) => {
71
77
  t /= d;
72
78
  t--;
73
79
  return -c * (t * t * t * t - 1) + b;
74
- };
75
- Easings.quarticInOut = (t, b, c, d) => {
80
+ });
81
+ __publicField$k(Easings, "quarticInOut", (t, b, c, d) => {
76
82
  t /= d / 2;
77
83
  if (t < 1)
78
84
  return c / 2 * t * t * t * t + b;
79
85
  t -= 2;
80
86
  return -c / 2 * (t * t * t * t - 2) + b;
81
- };
82
- Easings.quinticIn = (t, b, c, d) => {
87
+ });
88
+ __publicField$k(Easings, "quinticIn", (t, b, c, d) => {
83
89
  t /= d;
84
90
  return c * t * t * t * t * t + b;
85
- };
86
- Easings.quinticOut = (t, b, c, d) => {
91
+ });
92
+ __publicField$k(Easings, "quinticOut", (t, b, c, d) => {
87
93
  t /= d;
88
94
  t--;
89
95
  return c * (t * t * t * t * t + 1) + b;
90
- };
91
- Easings.quinticInOut = (t, b, c, d) => {
96
+ });
97
+ __publicField$k(Easings, "quinticInOut", (t, b, c, d) => {
92
98
  t /= d / 2;
93
99
  if (t < 1)
94
100
  return c / 2 * t * t * t * t * t + b;
95
101
  t -= 2;
96
102
  return c / 2 * (t * t * t * t * t + 2) + b;
97
- };
98
- Easings.sinusoidalIn = (t, b, c, d) => {
103
+ });
104
+ __publicField$k(Easings, "sinusoidalIn", (t, b, c, d) => {
99
105
  return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;
100
- };
101
- Easings.sinusoidalOut = (t, b, c, d) => {
106
+ });
107
+ __publicField$k(Easings, "sinusoidalOut", (t, b, c, d) => {
102
108
  return c * Math.sin(t / d * (Math.PI / 2)) + b;
103
- };
104
- Easings.sinusoidalInOut = (t, b, c, d) => {
109
+ });
110
+ __publicField$k(Easings, "sinusoidalInOut", (t, b, c, d) => {
105
111
  return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;
106
- };
107
- Easings.exponentialIn = (t, b, c, d) => {
112
+ });
113
+ __publicField$k(Easings, "exponentialIn", (t, b, c, d) => {
108
114
  return c * Math.pow(2, 10 * (t / d - 1)) + b;
109
- };
110
- Easings.exponentialOut = (t, b, c, d) => {
115
+ });
116
+ __publicField$k(Easings, "exponentialOut", (t, b, c, d) => {
111
117
  return c * (-Math.pow(2, -10 * t / d) + 1) + b;
112
- };
113
- Easings.exponentialInOut = (t, b, c, d) => {
118
+ });
119
+ __publicField$k(Easings, "exponentialInOut", (t, b, c, d) => {
114
120
  t /= d / 2;
115
121
  if (t < 1)
116
122
  return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
117
123
  t--;
118
124
  return c / 2 * (-Math.pow(2, -10 * t) + 2) + b;
119
- };
120
- Easings.circularIn = (t, b, c, d) => {
125
+ });
126
+ __publicField$k(Easings, "circularIn", (t, b, c, d) => {
121
127
  t /= d;
122
128
  return -c * (Math.sqrt(1 - t * t) - 1) + b;
123
- };
124
- Easings.circularOut = (t, b, c, d) => {
129
+ });
130
+ __publicField$k(Easings, "circularOut", (t, b, c, d) => {
125
131
  t /= d;
126
132
  t--;
127
133
  return c * Math.sqrt(1 - t * t) + b;
128
- };
129
- Easings.circularInOut = (t, b, c, d) => {
134
+ });
135
+ __publicField$k(Easings, "circularInOut", (t, b, c, d) => {
130
136
  t /= d / 2;
131
137
  if (t < 1)
132
138
  return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;
133
139
  t -= 2;
134
140
  return c / 2 * (Math.sqrt(1 - t * t) + 1) + b;
135
- };
141
+ });
136
142
 
143
+ var __defProp$j = Object.defineProperty;
144
+ var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
145
+ var __publicField$j = (obj, key, value) => {
146
+ __defNormalProp$j(obj, typeof key !== "symbol" ? key + "" : key, value);
147
+ return value;
148
+ };
137
149
  class Action {
138
150
  constructor(runDuringTransition = false) {
139
- this.startOffset = -1;
140
- this.endOffset = -1;
141
- this.started = false;
142
- this.running = false;
143
- this.completed = false;
144
- this.runStartTime = -1;
145
- this.duration = 0;
146
- this.isParent = false;
147
- this.isChild = false;
151
+ __publicField$j(this, "startOffset", -1);
152
+ __publicField$j(this, "endOffset", -1);
153
+ __publicField$j(this, "started", false);
154
+ __publicField$j(this, "running", false);
155
+ __publicField$j(this, "completed", false);
156
+ __publicField$j(this, "runStartTime", -1);
157
+ __publicField$j(this, "duration", 0);
158
+ __publicField$j(this, "runDuringTransition");
159
+ __publicField$j(this, "parent");
160
+ __publicField$j(this, "isParent", false);
161
+ __publicField$j(this, "isChild", false);
162
+ __publicField$j(this, "key");
148
163
  this.runDuringTransition = runDuringTransition;
149
164
  }
150
165
  /**
@@ -497,7 +512,8 @@ class Action {
497
512
  class SequenceAction extends Action {
498
513
  constructor(actions) {
499
514
  super();
500
- this.type = ActionType.Sequence;
515
+ __publicField$j(this, "type", ActionType.Sequence);
516
+ __publicField$j(this, "children");
501
517
  this.children = actions;
502
518
  this.isParent = true;
503
519
  }
@@ -505,8 +521,8 @@ class SequenceAction extends Action {
505
521
  class GroupAction extends Action {
506
522
  constructor(actions) {
507
523
  super();
508
- this.type = ActionType.Group;
509
- this.children = new Array();
524
+ __publicField$j(this, "type", ActionType.Group);
525
+ __publicField$j(this, "children", new Array());
510
526
  this.children = actions;
511
527
  this.isParent = true;
512
528
  }
@@ -514,7 +530,8 @@ class GroupAction extends Action {
514
530
  class CustomAction extends Action {
515
531
  constructor(callback, runDuringTransition = false) {
516
532
  super(runDuringTransition);
517
- this.type = ActionType.Custom;
533
+ __publicField$j(this, "type", ActionType.Custom);
534
+ __publicField$j(this, "callback");
518
535
  this.callback = callback;
519
536
  this.isParent = false;
520
537
  this.duration = 0;
@@ -523,7 +540,7 @@ class CustomAction extends Action {
523
540
  class WaitAction extends Action {
524
541
  constructor(duration, runDuringTransition) {
525
542
  super(runDuringTransition);
526
- this.type = ActionType.Wait;
543
+ __publicField$j(this, "type", ActionType.Wait);
527
544
  this.duration = duration;
528
545
  this.isParent = false;
529
546
  }
@@ -531,9 +548,12 @@ class WaitAction extends Action {
531
548
  class MoveAction extends Action {
532
549
  constructor(point, duration, easing, runDuringTransition) {
533
550
  super(runDuringTransition);
534
- this.type = ActionType.Move;
535
- this.dx = 0;
536
- this.dy = 0;
551
+ __publicField$j(this, "type", ActionType.Move);
552
+ __publicField$j(this, "point");
553
+ __publicField$j(this, "startPoint");
554
+ __publicField$j(this, "dx", 0);
555
+ __publicField$j(this, "dy", 0);
556
+ __publicField$j(this, "easing");
537
557
  this.duration = duration;
538
558
  this.point = point;
539
559
  this.isParent = false;
@@ -544,8 +564,9 @@ class MoveAction extends Action {
544
564
  class ScaleAction extends Action {
545
565
  constructor(scale, duration, runDuringTransition = false) {
546
566
  super(runDuringTransition);
547
- this.type = ActionType.Scale;
548
- this.delta = 0;
567
+ __publicField$j(this, "type", ActionType.Scale);
568
+ __publicField$j(this, "scale");
569
+ __publicField$j(this, "delta", 0);
549
570
  this.duration = duration;
550
571
  this.scale = scale;
551
572
  this.isParent = false;
@@ -578,17 +599,23 @@ class CanvasKitHelpers {
578
599
  }
579
600
  }
580
601
 
602
+ var __defProp$i = Object.defineProperty;
603
+ var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
604
+ var __publicField$i = (obj, key, value) => {
605
+ __defNormalProp$i(obj, typeof key !== "symbol" ? key + "" : key, value);
606
+ return value;
607
+ };
581
608
  class GlobalVariables {
582
609
  constructor() {
583
- this.now = NaN;
584
- this.deltaTime = NaN;
585
- this.canvasScale = NaN;
610
+ __publicField$i(this, "now", NaN);
611
+ __publicField$i(this, "deltaTime", NaN);
612
+ __publicField$i(this, "canvasScale", NaN);
586
613
  // _rootScale is the scaling factor to be applied to scenes to scale up or
587
614
  // down to fit the device's window while preserving the aspect ratio the
588
615
  // game was designed for
589
- this.rootScale = 1;
590
- this.canvasCssWidth = NaN;
591
- this.canvasCssHeight = NaN;
616
+ __publicField$i(this, "rootScale", 1);
617
+ __publicField$i(this, "canvasCssWidth", NaN);
618
+ __publicField$i(this, "canvasCssHeight", NaN);
592
619
  }
593
620
  }
594
621
 
@@ -610,8 +637,20 @@ var ConstraintType = /* @__PURE__ */ ((ConstraintType2) => {
610
637
  return ConstraintType2;
611
638
  })(ConstraintType || {});
612
639
 
640
+ var __defProp$h = Object.defineProperty;
641
+ var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
642
+ var __publicField$h = (obj, key, value) => {
643
+ __defNormalProp$h(obj, typeof key !== "symbol" ? key + "" : key, value);
644
+ return value;
645
+ };
613
646
  class LayoutConstraint {
614
647
  constructor(type, alterEntity) {
648
+ // the constraint, e.g., bottomToTopOf
649
+ __publicField$h(this, "type");
650
+ // alter is the other entity that the focal entity is constrained to.
651
+ // in the example above, A is the focal entity, B is the alter
652
+ // thus the alter entity property is B
653
+ __publicField$h(this, "alterEntity");
615
654
  // the below 3 properties are calculated from the constraint type
616
655
  // (we set them to false by default to avoid undefined warnings, but
617
656
  // they will be definitely assigned in the constructor logic)
@@ -619,37 +658,37 @@ class LayoutConstraint {
619
658
  //
620
659
  // does the constraint affect the Y or X axis? If not, then it's
621
660
  // a horizontal constraint
622
- this.verticalConstraint = false;
661
+ __publicField$h(this, "verticalConstraint", false);
623
662
  // does the constraint apply to the focal entity's "minimum" position
624
663
  // along its axis? That is, does the constraint reference the focal
625
664
  // entity's "top" or "start"? Top and start are considered minimums because
626
665
  // our origin (0, 0) in the upper left.
627
666
  // If not, then the constraint applies to the focal entity's "maximum"
628
667
  // position, e.g., its "bottom" or "end".
629
- this.focalEntityMinimum = false;
668
+ __publicField$h(this, "focalEntityMinimum", false);
630
669
  // does the constraint apply to the alter entity's "minimum" position
631
670
  // along its axis?
632
- this.alterEntityMinimum = false;
633
- this.verticalTypes = [
671
+ __publicField$h(this, "alterEntityMinimum", false);
672
+ __publicField$h(this, "verticalTypes", [
634
673
  ConstraintType.topToTopOf,
635
674
  ConstraintType.topToBottomOf,
636
675
  ConstraintType.bottomToTopOf,
637
676
  ConstraintType.bottomToBottomOf
638
- ];
677
+ ]);
639
678
  // e.g., entity A
640
- this.focalEntityMinimumTypes = [
679
+ __publicField$h(this, "focalEntityMinimumTypes", [
641
680
  ConstraintType.topToTopOf,
642
681
  ConstraintType.topToBottomOf,
643
682
  ConstraintType.startToStartOf,
644
683
  ConstraintType.startToEndOf
645
- ];
684
+ ]);
646
685
  // e.g., entity B
647
- this.alterEntityMinimumTypes = [
686
+ __publicField$h(this, "alterEntityMinimumTypes", [
648
687
  ConstraintType.topToTopOf,
649
688
  ConstraintType.bottomToTopOf,
650
689
  ConstraintType.startToStartOf,
651
690
  ConstraintType.endToStartOf
652
- ];
691
+ ]);
653
692
  this.type = type;
654
693
  this.alterEntity = alterEntity;
655
694
  if (this.verticalTypes.includes(type)) {
@@ -729,9 +768,16 @@ var EventType = /* @__PURE__ */ ((EventType2) => {
729
768
  EventType2["DragStart"] = "DragStart";
730
769
  EventType2["DragEnd"] = "DragEnd";
731
770
  EventType2["CompositeCustom"] = "CompositeCustom";
771
+ EventType2["FrameDidSimulatePhysics"] = "FrameDidSimulatePhysics";
732
772
  return EventType2;
733
773
  })(EventType || {});
734
774
 
775
+ var __defProp$g = Object.defineProperty;
776
+ var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
777
+ var __publicField$g = (obj, key, value) => {
778
+ __defNormalProp$g(obj, typeof key !== "symbol" ? key + "" : key, value);
779
+ return value;
780
+ };
735
781
  function handleDrawableOptions(drawable, options) {
736
782
  if (options.anchorPoint) {
737
783
  drawable.anchorPoint = options.anchorPoint;
@@ -767,64 +813,69 @@ function handleInterfaceOptions(entity, options) {
767
813
  }
768
814
  class Entity {
769
815
  constructor(options = {}) {
770
- this.type = EntityType.Entity;
771
- this.isDrawable = false;
772
- this.isShape = false;
773
- this.isText = false;
774
- this.position = { x: 0, y: 0 };
816
+ __publicField$g(this, "type", EntityType.Entity);
817
+ __publicField$g(this, "isDrawable", false);
818
+ __publicField$g(this, "isShape", false);
819
+ __publicField$g(this, "isText", false);
820
+ // Entity Options
821
+ __publicField$g(this, "name");
822
+ __publicField$g(this, "position", { x: 0, y: 0 });
775
823
  // position of the entity in the parent coordinate system
776
- this.scale = 1;
777
- this.isUserInteractionEnabled = false;
778
- this.draggable = false;
779
- this.hidden = false;
780
- this.layout = {};
781
- this.children = new Array();
782
- this.absolutePosition = { x: 0, y: 0 };
824
+ __publicField$g(this, "scale", 1);
825
+ __publicField$g(this, "isUserInteractionEnabled", false);
826
+ __publicField$g(this, "draggable", false);
827
+ __publicField$g(this, "hidden", false);
828
+ __publicField$g(this, "layout", {});
829
+ __publicField$g(this, "_game");
830
+ __publicField$g(this, "parent");
831
+ __publicField$g(this, "children", new Array());
832
+ __publicField$g(this, "absolutePosition", { x: 0, y: 0 });
783
833
  // position within the root coordinate system
784
- this.size = { width: 0, height: 0 };
785
- this.absoluteScale = 1;
786
- this.actions = new Array();
787
- this.originalActions = new Array();
788
- this.eventListeners = new Array();
789
- this.uuid = Uuid.generate();
790
- this.needsInitialization = true;
834
+ __publicField$g(this, "size", { width: 0, height: 0 });
835
+ __publicField$g(this, "absoluteScale", 1);
836
+ __publicField$g(this, "actions", new Array());
837
+ __publicField$g(this, "queuedAction");
838
+ __publicField$g(this, "originalActions", new Array());
839
+ __publicField$g(this, "eventListeners", new Array());
840
+ __publicField$g(this, "uuid", Uuid.generate());
841
+ __publicField$g(this, "needsInitialization", true);
791
842
  // library users might put anything in userData property
792
843
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
793
- this.userData = {};
794
- this.loopMessages = /* @__PURE__ */ new Set();
844
+ __publicField$g(this, "userData", {});
845
+ __publicField$g(this, "loopMessages", /* @__PURE__ */ new Set());
795
846
  /** Is the entity in a pressed state? E.g., did the user put the pointer
796
847
  * down on the entity and not yet release it? */
797
- this.pressed = false;
848
+ __publicField$g(this, "pressed", false);
798
849
  /** Is the entity in a pressed state AND is the pointer within the entity's
799
850
  * hit area? For example, a user may put the pointer down on the entity, but
800
851
  * then move the pointer, while still down, beyond the entity's hit area. In
801
852
  * this case, pressed = true, but pressedAndWithinHitArea = false. */
802
- this.pressedAndWithinHitArea = false;
853
+ __publicField$g(this, "pressedAndWithinHitArea", false);
803
854
  /** When the entity initially enters the pressed state, what is the pointer
804
855
  * offset? (offset from the canvas's origin to the pointer position). We
805
856
  * save this because it will be needed if this press then led to a drag. */
806
- this.pressedInitialPointerOffset = { x: NaN, y: NaN };
857
+ __publicField$g(this, "pressedInitialPointerOffset", { x: NaN, y: NaN });
807
858
  /** What was the previous pointer offset when the entity was in a dragging
808
859
  * state? */
809
- this.draggingLastPointerOffset = { x: NaN, y: NaN };
860
+ __publicField$g(this, "draggingLastPointerOffset", { x: NaN, y: NaN });
810
861
  /** Is the entity in a dragging state? */
811
- this.dragging = false;
862
+ __publicField$g(this, "dragging", false);
812
863
  /**
813
864
  * Overrides toString() and returns a human-friendly description of the entity.
814
865
  *
815
866
  * @remarks Inspiration from https://stackoverflow.com/a/35361695
816
867
  */
817
- this.toString = () => {
868
+ __publicField$g(this, "toString", () => {
818
869
  let type = this.type.toString();
819
870
  if (this.type == EntityType.Composite) {
820
871
  type = this.compositeType;
821
872
  }
822
873
  if (this.name !== this.uuid) {
823
- return `"${this.name}" (${type}, ${this.uuid})`;
874
+ return `${this.name} (${type}, ${this.uuid})`;
824
875
  } else {
825
- return `"${type} (${this.uuid})`;
876
+ return `${type} (${this.uuid})`;
826
877
  }
827
- };
878
+ });
828
879
  if (options.name === void 0) {
829
880
  this.name = this.uuid;
830
881
  } else {
@@ -870,32 +921,91 @@ class Entity {
870
921
  };
871
922
  return findParentScene(this).game;
872
923
  }
924
+ /**
925
+ * Determines if the entity has been added to the game object.
926
+ *
927
+ * @returns true if entity has been added
928
+ */
929
+ isPartOfGame() {
930
+ var _a;
931
+ if (this.type === EntityType.Scene && this._game === void 0) {
932
+ return false;
933
+ }
934
+ if (this.type === EntityType.Scene && this._game !== void 0) {
935
+ return true;
936
+ }
937
+ const findParentScene = (entity) => {
938
+ if (!entity.parent) {
939
+ return void 0;
940
+ } else if (entity.parent.type === EntityType.Scene) {
941
+ return entity.parent;
942
+ } else {
943
+ return findParentScene(entity.parent);
944
+ }
945
+ };
946
+ return ((_a = findParentScene(this)) == null ? void 0 : _a._game) !== void 0;
947
+ }
873
948
  /**
874
949
  * Adds a child to this parent entity. Throws exception if the child's name
875
- * is not unique with respect to other children of this parent.
950
+ * is not unique with respect to other children of this parent, or if the
951
+ * child has already been added to another parent.
876
952
  *
877
953
  * @param child - The child entity to add
878
954
  */
879
955
  addChild(child) {
956
+ if (child === this) {
957
+ throw new Error(
958
+ `Cannot add entity ${child.toString()} as a child to itself.`
959
+ );
960
+ }
880
961
  if (child.type == EntityType.Scene) {
881
962
  throw new Error(
882
- "A scene cannot be the child of an entity. A scene can only be added to a game object"
963
+ `Cannot add scene ${child.toString()} as a child to entity ${this.toString()}. A scene cannot be the child of an entity. A scene can only be added to a game object.`
883
964
  );
884
965
  }
885
- child.parent = this;
886
- if (this.children.map((c) => c.name).includes(child.name)) {
966
+ if (this.children.filter((c) => c !== child).map((c) => c.name).includes(child.name)) {
967
+ throw new Error(
968
+ `Cannot add child entity ${child.toString()} to parent entity ${this.toString()}. A child with name "${child.name}" already exists on this parent.`
969
+ );
970
+ }
971
+ let otherParents = new Array();
972
+ if (this.isPartOfGame()) {
973
+ otherParents = this.game.entities.filter(
974
+ (e) => e.children.includes(child)
975
+ );
976
+ } else {
977
+ const descendants = this.descendants;
978
+ if (descendants.includes(child)) {
979
+ otherParents = descendants.filter((d) => d.children.includes(child)).map((d) => {
980
+ var _a;
981
+ return (_a = d.parent) != null ? _a : void 0;
982
+ });
983
+ }
984
+ }
985
+ if (otherParents.length === 0) {
986
+ child.parent = this;
987
+ this.children.push(child);
988
+ return;
989
+ }
990
+ const firstOtherParent = otherParents.find(Boolean);
991
+ if (firstOtherParent === this) {
887
992
  throw new Error(
888
- `Cannot add child entity ${child.toString()} to parent entity ${this.toString()}. A child with name "${child.name}" already exists on parent.`
993
+ `Cannot add child entity ${child.toString()} to parent entity ${this.toString()}. This child already exists on this parent. The child cannot be added again.`
889
994
  );
890
995
  }
891
- this.children.push(child);
996
+ throw new Error(
997
+ `Cannot add child entity ${child.toString()} to parent entity ${this.toString()}. This child already exists on other parent entity: ${firstOtherParent == null ? void 0 : firstOtherParent.toString()}}. Remove the child from the other parent first.`
998
+ );
892
999
  }
893
1000
  /**
894
1001
  * Removes all children from the entity.
895
1002
  */
896
1003
  removeAllChildren() {
897
1004
  while (this.children.length) {
898
- this.children.pop();
1005
+ const child = this.children.pop();
1006
+ if (child) {
1007
+ child.parent = void 0;
1008
+ }
899
1009
  }
900
1010
  }
901
1011
  /**
@@ -906,6 +1016,7 @@ class Entity {
906
1016
  */
907
1017
  removeChild(child) {
908
1018
  if (this.children.includes(child)) {
1019
+ child.parent = void 0;
909
1020
  this.children = this.children.filter((c) => c !== child);
910
1021
  } else {
911
1022
  throw new Error(
@@ -926,6 +1037,7 @@ class Entity {
926
1037
  `cannot remove entity ${child} from parent ${this} because the entity is not currently a child of the parent`
927
1038
  );
928
1039
  }
1040
+ child.parent = void 0;
929
1041
  });
930
1042
  this.children = this.children.filter((child) => !children.includes(child));
931
1043
  }
@@ -1599,6 +1711,12 @@ class Entity {
1599
1711
  }
1600
1712
  }
1601
1713
 
1714
+ var __defProp$f = Object.defineProperty;
1715
+ var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1716
+ var __publicField$f = (obj, key, value) => {
1717
+ __defNormalProp$f(obj, typeof key !== "symbol" ? key + "" : key, value);
1718
+ return value;
1719
+ };
1602
1720
  class Composite extends Entity {
1603
1721
  /**
1604
1722
  * Base Drawable object for creating custom entities ("composites") composed of primitive entities.
@@ -1607,12 +1725,12 @@ class Composite extends Entity {
1607
1725
  */
1608
1726
  constructor(options = {}) {
1609
1727
  super(options);
1610
- this.type = EntityType.Composite;
1611
- this.compositeType = "<compositeType>";
1612
- this.isDrawable = true;
1728
+ __publicField$f(this, "type", EntityType.Composite);
1729
+ __publicField$f(this, "compositeType", "<compositeType>");
1730
+ __publicField$f(this, "isDrawable", true);
1613
1731
  // Drawable options
1614
- this.anchorPoint = { x: 0.5, y: 0.5 };
1615
- this.zPosition = 0;
1732
+ __publicField$f(this, "anchorPoint", { x: 0.5, y: 0.5 });
1733
+ __publicField$f(this, "zPosition", 0);
1616
1734
  handleInterfaceOptions(this, options);
1617
1735
  }
1618
1736
  // eslint-disable-next-line @typescript-eslint/no-empty-function
@@ -1629,181 +1747,193 @@ class Composite extends Entity {
1629
1747
  }
1630
1748
  }
1631
1749
 
1750
+ var __defProp$e = Object.defineProperty;
1751
+ var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1752
+ var __publicField$e = (obj, key, value) => {
1753
+ __defNormalProp$e(obj, typeof key !== "symbol" ? key + "" : key, value);
1754
+ return value;
1755
+ };
1632
1756
  class WebColors {
1633
1757
  }
1634
- WebColors.Transparent = [0, 0, 0, 0];
1635
- WebColors.MediumVioletRed = [199, 21, 133, 1];
1636
- WebColors.DeepPink = [255, 20, 147, 1];
1637
- WebColors.PaleVioletRed = [219, 112, 147, 1];
1638
- WebColors.HotPink = [255, 105, 180, 1];
1639
- WebColors.LightPink = [255, 182, 193, 1];
1640
- WebColors.Pink = [255, 192, 203, 1];
1641
- WebColors.DarkRed = [139, 0, 0, 1];
1642
- WebColors.Red = [255, 0, 0, 1];
1643
- WebColors.Firebrick = [178, 34, 34, 1];
1644
- WebColors.Crimson = [220, 20, 60, 1];
1645
- WebColors.IndianRed = [205, 92, 92, 1];
1646
- WebColors.LightCoral = [240, 128, 128, 1];
1647
- WebColors.Salmon = [250, 128, 114, 1];
1648
- WebColors.DarkSalmon = [233, 150, 122, 1];
1649
- WebColors.LightSalmon = [255, 160, 122, 1];
1650
- WebColors.OrangeRed = [255, 69, 0, 1];
1651
- WebColors.Tomato = [255, 99, 71, 1];
1652
- WebColors.DarkOrange = [255, 140, 0, 1];
1653
- WebColors.Coral = [255, 127, 80, 1];
1654
- WebColors.Orange = [255, 165, 0, 1];
1655
- WebColors.DarkKhaki = [189, 183, 107, 1];
1656
- WebColors.Gold = [255, 215, 0, 1];
1657
- WebColors.Khaki = [240, 230, 140, 1];
1658
- WebColors.PeachPuff = [255, 218, 185, 1];
1659
- WebColors.Yellow = [255, 255, 0, 1];
1660
- WebColors.PaleGoldenrod = [238, 232, 170, 1];
1661
- WebColors.Moccasin = [255, 228, 181, 1];
1662
- WebColors.PapayaWhip = [255, 239, 213, 1];
1663
- WebColors.LightGoldenrodYellow = [250, 250, 210, 1];
1664
- WebColors.LemonChiffon = [255, 250, 205, 1];
1665
- WebColors.LightYellow = [255, 255, 224, 1];
1666
- WebColors.Maroon = [128, 0, 0, 1];
1667
- WebColors.Brown = [165, 42, 42, 1];
1668
- WebColors.SaddleBrown = [139, 69, 19, 1];
1669
- WebColors.Sienna = [160, 82, 45, 1];
1670
- WebColors.Chocolate = [210, 105, 30, 1];
1671
- WebColors.DarkGoldenrod = [184, 134, 11, 1];
1672
- WebColors.Peru = [205, 133, 63, 1];
1673
- WebColors.RosyBrown = [188, 143, 143, 1];
1674
- WebColors.Goldenrod = [218, 165, 32, 1];
1675
- WebColors.SandyBrown = [244, 164, 96, 1];
1676
- WebColors.Tan = [210, 180, 140, 1];
1677
- WebColors.Burlywood = [222, 184, 135, 1];
1678
- WebColors.Wheat = [245, 222, 179, 1];
1679
- WebColors.NavajoWhite = [255, 222, 173, 1];
1680
- WebColors.Bisque = [255, 228, 196, 1];
1681
- WebColors.BlanchedAlmond = [255, 235, 205, 1];
1682
- WebColors.Cornsilk = [255, 248, 220, 1];
1683
- WebColors.DarkGreen = [0, 100, 0, 1];
1684
- WebColors.Green = [0, 128, 0, 1];
1685
- WebColors.DarkOliveGreen = [85, 107, 47, 1];
1686
- WebColors.ForestGreen = [34, 139, 34, 1];
1687
- WebColors.SeaGreen = [46, 139, 87, 1];
1688
- WebColors.Olive = [128, 128, 0, 1];
1689
- WebColors.OliveDrab = [107, 142, 35, 1];
1690
- WebColors.MediumSeaGreen = [60, 179, 113, 1];
1691
- WebColors.LimeGreen = [50, 205, 50, 1];
1692
- WebColors.Lime = [0, 255, 0, 1];
1693
- WebColors.SpringGreen = [0, 255, 127, 1];
1694
- WebColors.MediumSpringGreen = [0, 250, 154, 1];
1695
- WebColors.DarkSeaGreen = [143, 188, 143, 1];
1696
- WebColors.MediumAquamarine = [102, 205, 170, 1];
1697
- WebColors.YellowGreen = [154, 205, 50, 1];
1698
- WebColors.LawnGreen = [124, 252, 0, 1];
1699
- WebColors.Chartreuse = [127, 255, 0, 1];
1700
- WebColors.LightGreen = [144, 238, 144, 1];
1701
- WebColors.GreenYellow = [173, 255, 47, 1];
1702
- WebColors.PaleGreen = [152, 251, 152, 1];
1703
- WebColors.Teal = [0, 128, 128, 1];
1704
- WebColors.DarkCyan = [0, 139, 139, 1];
1705
- WebColors.LightSeaGreen = [32, 178, 170, 1];
1706
- WebColors.CadetBlue = [95, 158, 160, 1];
1707
- WebColors.DarkTurquoise = [0, 206, 209, 1];
1708
- WebColors.MediumTurquoise = [72, 209, 204, 1];
1709
- WebColors.Turquoise = [64, 224, 208, 1];
1710
- WebColors.Aqua = [0, 255, 255, 1];
1711
- WebColors.Cyan = [0, 255, 255, 1];
1712
- WebColors.Aquamarine = [127, 255, 212, 1];
1713
- WebColors.PaleTurquoise = [175, 238, 238, 1];
1714
- WebColors.LightCyan = [224, 255, 255, 1];
1715
- WebColors.Navy = [0, 0, 128, 1];
1716
- WebColors.DarkBlue = [0, 0, 139, 1];
1717
- WebColors.MediumBlue = [0, 0, 205, 1];
1718
- WebColors.Blue = [0, 0, 255, 1];
1719
- WebColors.MidnightBlue = [25, 25, 112, 1];
1720
- WebColors.RoyalBlue = [65, 105, 225, 1];
1721
- WebColors.SteelBlue = [70, 130, 180, 1];
1722
- WebColors.DodgerBlue = [30, 144, 255, 1];
1723
- WebColors.DeepSkyBlue = [0, 191, 255, 1];
1724
- WebColors.CornflowerBlue = [100, 149, 237, 1];
1725
- WebColors.SkyBlue = [135, 206, 235, 1];
1726
- WebColors.LightSkyBlue = [135, 206, 250, 1];
1727
- WebColors.LightSteelBlue = [176, 196, 222, 1];
1728
- WebColors.LightBlue = [173, 216, 230, 1];
1729
- WebColors.PowderBlue = [176, 224, 230, 1];
1730
- WebColors.Indigo = [75, 0, 130, 1];
1731
- WebColors.Purple = [128, 0, 128, 1];
1732
- WebColors.DarkMagenta = [139, 0, 139, 1];
1733
- WebColors.DarkViolet = [148, 0, 211, 1];
1734
- WebColors.DarkSlateBlue = [72, 61, 139, 1];
1735
- WebColors.BlueViolet = [138, 43, 226, 1];
1736
- WebColors.DarkOrchid = [153, 50, 204, 1];
1737
- WebColors.Fuchsia = [255, 0, 255, 1];
1738
- WebColors.Magenta = [255, 0, 255, 1];
1739
- WebColors.SlateBlue = [106, 90, 205, 1];
1740
- WebColors.MediumSlateBlue = [123, 104, 238, 1];
1741
- WebColors.MediumOrchid = [186, 85, 211, 1];
1742
- WebColors.MediumPurple = [147, 112, 219, 1];
1743
- WebColors.Orchid = [218, 112, 214, 1];
1744
- WebColors.Violet = [238, 130, 238, 1];
1745
- WebColors.Plum = [221, 160, 221, 1];
1746
- WebColors.Thistle = [216, 191, 216, 1];
1747
- WebColors.Lavender = [230, 230, 250, 1];
1748
- WebColors.MistyRose = [255, 228, 225, 1];
1749
- WebColors.AntiqueWhite = [250, 235, 215, 1];
1750
- WebColors.Linen = [250, 240, 230, 1];
1751
- WebColors.Beige = [245, 245, 220, 1];
1752
- WebColors.WhiteSmoke = [245, 245, 245, 1];
1753
- WebColors.LavenderBlush = [255, 240, 245, 1];
1754
- WebColors.OldLace = [253, 245, 230, 1];
1755
- WebColors.AliceBlue = [240, 248, 255, 1];
1756
- WebColors.Seashell = [255, 245, 238, 1];
1757
- WebColors.GhostWhite = [248, 248, 255, 1];
1758
- WebColors.Honeydew = [240, 255, 240, 1];
1759
- WebColors.FloralWhite = [255, 250, 240, 1];
1760
- WebColors.Azure = [240, 255, 255, 1];
1761
- WebColors.MintCream = [245, 255, 250, 1];
1762
- WebColors.Snow = [255, 250, 250, 1];
1763
- WebColors.Ivory = [255, 255, 240, 1];
1764
- WebColors.White = [255, 255, 255, 1];
1765
- WebColors.Black = [0, 0, 0, 1];
1766
- WebColors.DarkSlateGray = [47, 79, 79, 1];
1767
- WebColors.DimGray = [105, 105, 105, 1];
1768
- WebColors.SlateGray = [112, 128, 144, 1];
1769
- WebColors.Gray = [128, 128, 128, 1];
1770
- WebColors.LightSlateGray = [119, 136, 153, 1];
1771
- WebColors.DarkGray = [169, 169, 169, 1];
1772
- WebColors.Silver = [192, 192, 192, 1];
1773
- WebColors.LightGray = [211, 211, 211, 1];
1774
- WebColors.Gainsboro = [220, 220, 220, 1];
1775
- WebColors.RebeccaPurple = [102, 51, 153, 1];
1758
+ __publicField$e(WebColors, "Transparent", [0, 0, 0, 0]);
1759
+ __publicField$e(WebColors, "MediumVioletRed", [199, 21, 133, 1]);
1760
+ __publicField$e(WebColors, "DeepPink", [255, 20, 147, 1]);
1761
+ __publicField$e(WebColors, "PaleVioletRed", [219, 112, 147, 1]);
1762
+ __publicField$e(WebColors, "HotPink", [255, 105, 180, 1]);
1763
+ __publicField$e(WebColors, "LightPink", [255, 182, 193, 1]);
1764
+ __publicField$e(WebColors, "Pink", [255, 192, 203, 1]);
1765
+ __publicField$e(WebColors, "DarkRed", [139, 0, 0, 1]);
1766
+ __publicField$e(WebColors, "Red", [255, 0, 0, 1]);
1767
+ __publicField$e(WebColors, "Firebrick", [178, 34, 34, 1]);
1768
+ __publicField$e(WebColors, "Crimson", [220, 20, 60, 1]);
1769
+ __publicField$e(WebColors, "IndianRed", [205, 92, 92, 1]);
1770
+ __publicField$e(WebColors, "LightCoral", [240, 128, 128, 1]);
1771
+ __publicField$e(WebColors, "Salmon", [250, 128, 114, 1]);
1772
+ __publicField$e(WebColors, "DarkSalmon", [233, 150, 122, 1]);
1773
+ __publicField$e(WebColors, "LightSalmon", [255, 160, 122, 1]);
1774
+ __publicField$e(WebColors, "OrangeRed", [255, 69, 0, 1]);
1775
+ __publicField$e(WebColors, "Tomato", [255, 99, 71, 1]);
1776
+ __publicField$e(WebColors, "DarkOrange", [255, 140, 0, 1]);
1777
+ __publicField$e(WebColors, "Coral", [255, 127, 80, 1]);
1778
+ __publicField$e(WebColors, "Orange", [255, 165, 0, 1]);
1779
+ __publicField$e(WebColors, "DarkKhaki", [189, 183, 107, 1]);
1780
+ __publicField$e(WebColors, "Gold", [255, 215, 0, 1]);
1781
+ __publicField$e(WebColors, "Khaki", [240, 230, 140, 1]);
1782
+ __publicField$e(WebColors, "PeachPuff", [255, 218, 185, 1]);
1783
+ __publicField$e(WebColors, "Yellow", [255, 255, 0, 1]);
1784
+ __publicField$e(WebColors, "PaleGoldenrod", [238, 232, 170, 1]);
1785
+ __publicField$e(WebColors, "Moccasin", [255, 228, 181, 1]);
1786
+ __publicField$e(WebColors, "PapayaWhip", [255, 239, 213, 1]);
1787
+ __publicField$e(WebColors, "LightGoldenrodYellow", [250, 250, 210, 1]);
1788
+ __publicField$e(WebColors, "LemonChiffon", [255, 250, 205, 1]);
1789
+ __publicField$e(WebColors, "LightYellow", [255, 255, 224, 1]);
1790
+ __publicField$e(WebColors, "Maroon", [128, 0, 0, 1]);
1791
+ __publicField$e(WebColors, "Brown", [165, 42, 42, 1]);
1792
+ __publicField$e(WebColors, "SaddleBrown", [139, 69, 19, 1]);
1793
+ __publicField$e(WebColors, "Sienna", [160, 82, 45, 1]);
1794
+ __publicField$e(WebColors, "Chocolate", [210, 105, 30, 1]);
1795
+ __publicField$e(WebColors, "DarkGoldenrod", [184, 134, 11, 1]);
1796
+ __publicField$e(WebColors, "Peru", [205, 133, 63, 1]);
1797
+ __publicField$e(WebColors, "RosyBrown", [188, 143, 143, 1]);
1798
+ __publicField$e(WebColors, "Goldenrod", [218, 165, 32, 1]);
1799
+ __publicField$e(WebColors, "SandyBrown", [244, 164, 96, 1]);
1800
+ __publicField$e(WebColors, "Tan", [210, 180, 140, 1]);
1801
+ __publicField$e(WebColors, "Burlywood", [222, 184, 135, 1]);
1802
+ __publicField$e(WebColors, "Wheat", [245, 222, 179, 1]);
1803
+ __publicField$e(WebColors, "NavajoWhite", [255, 222, 173, 1]);
1804
+ __publicField$e(WebColors, "Bisque", [255, 228, 196, 1]);
1805
+ __publicField$e(WebColors, "BlanchedAlmond", [255, 235, 205, 1]);
1806
+ __publicField$e(WebColors, "Cornsilk", [255, 248, 220, 1]);
1807
+ __publicField$e(WebColors, "DarkGreen", [0, 100, 0, 1]);
1808
+ __publicField$e(WebColors, "Green", [0, 128, 0, 1]);
1809
+ __publicField$e(WebColors, "DarkOliveGreen", [85, 107, 47, 1]);
1810
+ __publicField$e(WebColors, "ForestGreen", [34, 139, 34, 1]);
1811
+ __publicField$e(WebColors, "SeaGreen", [46, 139, 87, 1]);
1812
+ __publicField$e(WebColors, "Olive", [128, 128, 0, 1]);
1813
+ __publicField$e(WebColors, "OliveDrab", [107, 142, 35, 1]);
1814
+ __publicField$e(WebColors, "MediumSeaGreen", [60, 179, 113, 1]);
1815
+ __publicField$e(WebColors, "LimeGreen", [50, 205, 50, 1]);
1816
+ __publicField$e(WebColors, "Lime", [0, 255, 0, 1]);
1817
+ __publicField$e(WebColors, "SpringGreen", [0, 255, 127, 1]);
1818
+ __publicField$e(WebColors, "MediumSpringGreen", [0, 250, 154, 1]);
1819
+ __publicField$e(WebColors, "DarkSeaGreen", [143, 188, 143, 1]);
1820
+ __publicField$e(WebColors, "MediumAquamarine", [102, 205, 170, 1]);
1821
+ __publicField$e(WebColors, "YellowGreen", [154, 205, 50, 1]);
1822
+ __publicField$e(WebColors, "LawnGreen", [124, 252, 0, 1]);
1823
+ __publicField$e(WebColors, "Chartreuse", [127, 255, 0, 1]);
1824
+ __publicField$e(WebColors, "LightGreen", [144, 238, 144, 1]);
1825
+ __publicField$e(WebColors, "GreenYellow", [173, 255, 47, 1]);
1826
+ __publicField$e(WebColors, "PaleGreen", [152, 251, 152, 1]);
1827
+ __publicField$e(WebColors, "Teal", [0, 128, 128, 1]);
1828
+ __publicField$e(WebColors, "DarkCyan", [0, 139, 139, 1]);
1829
+ __publicField$e(WebColors, "LightSeaGreen", [32, 178, 170, 1]);
1830
+ __publicField$e(WebColors, "CadetBlue", [95, 158, 160, 1]);
1831
+ __publicField$e(WebColors, "DarkTurquoise", [0, 206, 209, 1]);
1832
+ __publicField$e(WebColors, "MediumTurquoise", [72, 209, 204, 1]);
1833
+ __publicField$e(WebColors, "Turquoise", [64, 224, 208, 1]);
1834
+ __publicField$e(WebColors, "Aqua", [0, 255, 255, 1]);
1835
+ __publicField$e(WebColors, "Cyan", [0, 255, 255, 1]);
1836
+ __publicField$e(WebColors, "Aquamarine", [127, 255, 212, 1]);
1837
+ __publicField$e(WebColors, "PaleTurquoise", [175, 238, 238, 1]);
1838
+ __publicField$e(WebColors, "LightCyan", [224, 255, 255, 1]);
1839
+ __publicField$e(WebColors, "Navy", [0, 0, 128, 1]);
1840
+ __publicField$e(WebColors, "DarkBlue", [0, 0, 139, 1]);
1841
+ __publicField$e(WebColors, "MediumBlue", [0, 0, 205, 1]);
1842
+ __publicField$e(WebColors, "Blue", [0, 0, 255, 1]);
1843
+ __publicField$e(WebColors, "MidnightBlue", [25, 25, 112, 1]);
1844
+ __publicField$e(WebColors, "RoyalBlue", [65, 105, 225, 1]);
1845
+ __publicField$e(WebColors, "SteelBlue", [70, 130, 180, 1]);
1846
+ __publicField$e(WebColors, "DodgerBlue", [30, 144, 255, 1]);
1847
+ __publicField$e(WebColors, "DeepSkyBlue", [0, 191, 255, 1]);
1848
+ __publicField$e(WebColors, "CornflowerBlue", [100, 149, 237, 1]);
1849
+ __publicField$e(WebColors, "SkyBlue", [135, 206, 235, 1]);
1850
+ __publicField$e(WebColors, "LightSkyBlue", [135, 206, 250, 1]);
1851
+ __publicField$e(WebColors, "LightSteelBlue", [176, 196, 222, 1]);
1852
+ __publicField$e(WebColors, "LightBlue", [173, 216, 230, 1]);
1853
+ __publicField$e(WebColors, "PowderBlue", [176, 224, 230, 1]);
1854
+ __publicField$e(WebColors, "Indigo", [75, 0, 130, 1]);
1855
+ __publicField$e(WebColors, "Purple", [128, 0, 128, 1]);
1856
+ __publicField$e(WebColors, "DarkMagenta", [139, 0, 139, 1]);
1857
+ __publicField$e(WebColors, "DarkViolet", [148, 0, 211, 1]);
1858
+ __publicField$e(WebColors, "DarkSlateBlue", [72, 61, 139, 1]);
1859
+ __publicField$e(WebColors, "BlueViolet", [138, 43, 226, 1]);
1860
+ __publicField$e(WebColors, "DarkOrchid", [153, 50, 204, 1]);
1861
+ __publicField$e(WebColors, "Fuchsia", [255, 0, 255, 1]);
1862
+ __publicField$e(WebColors, "Magenta", [255, 0, 255, 1]);
1863
+ __publicField$e(WebColors, "SlateBlue", [106, 90, 205, 1]);
1864
+ __publicField$e(WebColors, "MediumSlateBlue", [123, 104, 238, 1]);
1865
+ __publicField$e(WebColors, "MediumOrchid", [186, 85, 211, 1]);
1866
+ __publicField$e(WebColors, "MediumPurple", [147, 112, 219, 1]);
1867
+ __publicField$e(WebColors, "Orchid", [218, 112, 214, 1]);
1868
+ __publicField$e(WebColors, "Violet", [238, 130, 238, 1]);
1869
+ __publicField$e(WebColors, "Plum", [221, 160, 221, 1]);
1870
+ __publicField$e(WebColors, "Thistle", [216, 191, 216, 1]);
1871
+ __publicField$e(WebColors, "Lavender", [230, 230, 250, 1]);
1872
+ __publicField$e(WebColors, "MistyRose", [255, 228, 225, 1]);
1873
+ __publicField$e(WebColors, "AntiqueWhite", [250, 235, 215, 1]);
1874
+ __publicField$e(WebColors, "Linen", [250, 240, 230, 1]);
1875
+ __publicField$e(WebColors, "Beige", [245, 245, 220, 1]);
1876
+ __publicField$e(WebColors, "WhiteSmoke", [245, 245, 245, 1]);
1877
+ __publicField$e(WebColors, "LavenderBlush", [255, 240, 245, 1]);
1878
+ __publicField$e(WebColors, "OldLace", [253, 245, 230, 1]);
1879
+ __publicField$e(WebColors, "AliceBlue", [240, 248, 255, 1]);
1880
+ __publicField$e(WebColors, "Seashell", [255, 245, 238, 1]);
1881
+ __publicField$e(WebColors, "GhostWhite", [248, 248, 255, 1]);
1882
+ __publicField$e(WebColors, "Honeydew", [240, 255, 240, 1]);
1883
+ __publicField$e(WebColors, "FloralWhite", [255, 250, 240, 1]);
1884
+ __publicField$e(WebColors, "Azure", [240, 255, 255, 1]);
1885
+ __publicField$e(WebColors, "MintCream", [245, 255, 250, 1]);
1886
+ __publicField$e(WebColors, "Snow", [255, 250, 250, 1]);
1887
+ __publicField$e(WebColors, "Ivory", [255, 255, 240, 1]);
1888
+ __publicField$e(WebColors, "White", [255, 255, 255, 1]);
1889
+ __publicField$e(WebColors, "Black", [0, 0, 0, 1]);
1890
+ __publicField$e(WebColors, "DarkSlateGray", [47, 79, 79, 1]);
1891
+ __publicField$e(WebColors, "DimGray", [105, 105, 105, 1]);
1892
+ __publicField$e(WebColors, "SlateGray", [112, 128, 144, 1]);
1893
+ __publicField$e(WebColors, "Gray", [128, 128, 128, 1]);
1894
+ __publicField$e(WebColors, "LightSlateGray", [119, 136, 153, 1]);
1895
+ __publicField$e(WebColors, "DarkGray", [169, 169, 169, 1]);
1896
+ __publicField$e(WebColors, "Silver", [192, 192, 192, 1]);
1897
+ __publicField$e(WebColors, "LightGray", [211, 211, 211, 1]);
1898
+ __publicField$e(WebColors, "Gainsboro", [220, 220, 220, 1]);
1899
+ __publicField$e(WebColors, "RebeccaPurple", [102, 51, 153, 1]);
1776
1900
 
1901
+ var __defProp$d = Object.defineProperty;
1902
+ var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1903
+ var __publicField$d = (obj, key, value) => {
1904
+ __defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
1905
+ return value;
1906
+ };
1777
1907
  class Constants {
1778
1908
  }
1779
1909
  /** Size of the font showing frames per second */
1780
- Constants.FPS_DISPLAY_TEXT_FONT_SIZE = 12;
1910
+ __publicField$d(Constants, "FPS_DISPLAY_TEXT_FONT_SIZE", 12);
1781
1911
  /** Color of the font showing frames per second */
1782
- Constants.FPS_DISPLAY_TEXT_COLOR = [0, 0, 0, 0.5];
1912
+ __publicField$d(Constants, "FPS_DISPLAY_TEXT_COLOR", [0, 0, 0, 0.5]);
1783
1913
  /** Frequency, in milliseconds, at which to update frames per second metric shown on the screen */
1784
- Constants.FPS_DISPLAY_UPDATE_INTERVAL = 1e3;
1914
+ __publicField$d(Constants, "FPS_DISPLAY_UPDATE_INTERVAL", 1e3);
1785
1915
  /** Maximum number of activity metrics to log. */
1786
- Constants.MAXIMUM_RECORDED_ACTIVITY_METRICS = 32;
1916
+ __publicField$d(Constants, "MAXIMUM_RECORDED_ACTIVITY_METRICS", 32);
1787
1917
  /** The frames per second will be logged in game metrics if the FPS is lower than this value */
1788
- Constants.FPS_METRIC_REPORT_THRESHOLD = 59;
1918
+ __publicField$d(Constants, "FPS_METRIC_REPORT_THRESHOLD", 59);
1789
1919
  /** Scene color, if none is specified. */
1790
- Constants.DEFAULT_SCENE_BACKGROUND_COLOR = WebColors.White;
1920
+ __publicField$d(Constants, "DEFAULT_SCENE_BACKGROUND_COLOR", WebColors.White);
1791
1921
  /** Shape fill color, if none is specified. */
1792
- Constants.DEFAULT_SHAPE_FILL_COLOR = WebColors.Red;
1922
+ __publicField$d(Constants, "DEFAULT_SHAPE_FILL_COLOR", WebColors.Red);
1793
1923
  /** Color of paths in a shape, if none is specified. */
1794
- Constants.DEFAULT_PATH_STROKE_COLOR = WebColors.Red;
1924
+ __publicField$d(Constants, "DEFAULT_PATH_STROKE_COLOR", WebColors.Red);
1795
1925
  /** Line width of paths in a shape, if none is specified. */
1796
- Constants.DEFAULT_PATH_LINE_WIDTH = 2;
1926
+ __publicField$d(Constants, "DEFAULT_PATH_LINE_WIDTH", 2);
1797
1927
  /** Color of text in Label and TextLine, if none is specified. */
1798
- Constants.DEFAULT_FONT_COLOR = WebColors.Black;
1928
+ __publicField$d(Constants, "DEFAULT_FONT_COLOR", WebColors.Black);
1799
1929
  /** Font size in Label and TextLine, if none is specified. */
1800
- Constants.DEFAULT_FONT_SIZE = 16;
1801
- Constants.LIMITED_FPS_RATE = 5;
1802
- Constants.FREE_ENTITIES_SCENE_NAME = "__freeEntitiesScene";
1803
- Constants.OUTGOING_SCENE_NAME = "__outgoingScene";
1804
- Constants.OUTGOING_SCENE_SPRITE_NAME = "__outgoingSceneSprite";
1805
- Constants.OUTGOING_SCENE_IMAGE_NAME = "__outgoingSceneSnapshot";
1806
- Constants.SESSION_INITIALIZATION_POLLING_INTERVAL_MS = 50;
1930
+ __publicField$d(Constants, "DEFAULT_FONT_SIZE", 16);
1931
+ __publicField$d(Constants, "LIMITED_FPS_RATE", 5);
1932
+ __publicField$d(Constants, "FREE_ENTITIES_SCENE_NAME", "__freeEntitiesScene");
1933
+ __publicField$d(Constants, "OUTGOING_SCENE_NAME", "__outgoingScene");
1934
+ __publicField$d(Constants, "OUTGOING_SCENE_SPRITE_NAME", "__outgoingSceneSprite");
1935
+ __publicField$d(Constants, "OUTGOING_SCENE_IMAGE_NAME", "__outgoingSceneSnapshot");
1936
+ __publicField$d(Constants, "SESSION_INITIALIZATION_POLLING_INTERVAL_MS", 50);
1807
1937
 
1808
1938
  var Dimensions = /* @__PURE__ */ ((Dimensions2) => {
1809
1939
  Dimensions2[Dimensions2["MatchConstraint"] = 0] = "MatchConstraint";
@@ -2049,12 +2179,22 @@ function property(e) {
2049
2179
  return meta;
2050
2180
  }
2051
2181
 
2182
+ var __defProp$c = Object.defineProperty;
2183
+ var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2184
+ var __publicField$c = (obj, key, value) => {
2185
+ __defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
2186
+ return value;
2187
+ };
2052
2188
  class GameTypefaces {
2053
2189
  }
2054
2190
  class FontManager {
2055
2191
  constructor(session) {
2056
- this.gameTypefaces = new GameTypefaces();
2057
- this.fontData = new Array();
2192
+ __publicField$c(this, "canvasKit");
2193
+ __publicField$c(this, "fontMgr");
2194
+ __publicField$c(this, "gameTypefaces", new GameTypefaces());
2195
+ __publicField$c(this, "fontData", new Array());
2196
+ __publicField$c(this, "session");
2197
+ __publicField$c(this, "games");
2058
2198
  this.session = session;
2059
2199
  }
2060
2200
  /**
@@ -2186,25 +2326,29 @@ class FontManager {
2186
2326
  }
2187
2327
  }
2188
2328
 
2189
- var __defProp$7 = Object.defineProperty;
2329
+ var __defProp$b = Object.defineProperty;
2190
2330
  var __defProps$5 = Object.defineProperties;
2191
2331
  var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
2192
2332
  var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
2193
2333
  var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
2194
2334
  var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
2195
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2335
+ var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2196
2336
  var __spreadValues$7 = (a, b) => {
2197
2337
  for (var prop in b || (b = {}))
2198
2338
  if (__hasOwnProp$7.call(b, prop))
2199
- __defNormalProp$7(a, prop, b[prop]);
2339
+ __defNormalProp$b(a, prop, b[prop]);
2200
2340
  if (__getOwnPropSymbols$7)
2201
2341
  for (var prop of __getOwnPropSymbols$7(b)) {
2202
2342
  if (__propIsEnum$7.call(b, prop))
2203
- __defNormalProp$7(a, prop, b[prop]);
2343
+ __defNormalProp$b(a, prop, b[prop]);
2204
2344
  }
2205
2345
  return a;
2206
2346
  };
2207
2347
  var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
2348
+ var __publicField$b = (obj, key, value) => {
2349
+ __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
2350
+ return value;
2351
+ };
2208
2352
  class Sprite extends Entity {
2209
2353
  /**
2210
2354
  * Visual image displayed on the screen.
@@ -2215,13 +2359,15 @@ class Sprite extends Entity {
2215
2359
  */
2216
2360
  constructor(options = {}) {
2217
2361
  super(options);
2218
- this.type = EntityType.Sprite;
2219
- this.isDrawable = true;
2362
+ __publicField$b(this, "type", EntityType.Sprite);
2363
+ __publicField$b(this, "isDrawable", true);
2220
2364
  // Drawable options
2221
- this.anchorPoint = { x: 0.5, y: 0.5 };
2222
- this.zPosition = 0;
2365
+ __publicField$b(this, "anchorPoint", { x: 0.5, y: 0.5 });
2366
+ __publicField$b(this, "zPosition", 0);
2223
2367
  // Sprite options
2224
- this._imageName = "";
2368
+ __publicField$b(this, "_imageName", "");
2369
+ // public getter/setter is below
2370
+ __publicField$b(this, "loadedImage");
2225
2371
  handleInterfaceOptions(this, options);
2226
2372
  if (options.imageName) {
2227
2373
  this.imageName = options.imageName;
@@ -2321,25 +2467,29 @@ class LoadedImage {
2321
2467
  }
2322
2468
  }
2323
2469
 
2324
- var __defProp$6 = Object.defineProperty;
2470
+ var __defProp$a = Object.defineProperty;
2325
2471
  var __defProps$4 = Object.defineProperties;
2326
2472
  var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
2327
2473
  var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
2328
2474
  var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
2329
2475
  var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
2330
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2476
+ var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2331
2477
  var __spreadValues$6 = (a, b) => {
2332
2478
  for (var prop in b || (b = {}))
2333
2479
  if (__hasOwnProp$6.call(b, prop))
2334
- __defNormalProp$6(a, prop, b[prop]);
2480
+ __defNormalProp$a(a, prop, b[prop]);
2335
2481
  if (__getOwnPropSymbols$6)
2336
2482
  for (var prop of __getOwnPropSymbols$6(b)) {
2337
2483
  if (__propIsEnum$6.call(b, prop))
2338
- __defNormalProp$6(a, prop, b[prop]);
2484
+ __defNormalProp$a(a, prop, b[prop]);
2339
2485
  }
2340
2486
  return a;
2341
2487
  };
2342
2488
  var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
2489
+ var __publicField$a = (obj, key, value) => {
2490
+ __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
2491
+ return value;
2492
+ };
2343
2493
  class Scene extends Entity {
2344
2494
  /**
2345
2495
  * Top-level entity that holds all other entities, such as sprites, rectangles, or labels, that will be displayed on the screen
@@ -2350,15 +2500,18 @@ class Scene extends Entity {
2350
2500
  */
2351
2501
  constructor(options = {}) {
2352
2502
  super(options);
2353
- this.type = EntityType.Scene;
2354
- this.isDrawable = true;
2503
+ __publicField$a(this, "type", EntityType.Scene);
2504
+ __publicField$a(this, "isDrawable", true);
2355
2505
  // Drawable options
2356
- this.anchorPoint = { x: 0, y: 0 };
2357
- this.zPosition = 0;
2506
+ __publicField$a(this, "anchorPoint", { x: 0, y: 0 });
2507
+ __publicField$a(this, "zPosition", 0);
2358
2508
  // Scene options
2359
- this._backgroundColor = Constants.DEFAULT_SCENE_BACKGROUND_COLOR;
2360
- this._active = false;
2361
- this._transitioning = false;
2509
+ __publicField$a(this, "_backgroundColor", Constants.DEFAULT_SCENE_BACKGROUND_COLOR);
2510
+ __publicField$a(this, "_active", false);
2511
+ __publicField$a(this, "_transitioning", false);
2512
+ __publicField$a(this, "_setupCallback");
2513
+ __publicField$a(this, "_appearCallback");
2514
+ __publicField$a(this, "backgroundPaint");
2362
2515
  handleInterfaceOptions(this, options);
2363
2516
  if (options.backgroundColor) {
2364
2517
  this.backgroundColor = options.backgroundColor;
@@ -2499,6 +2652,12 @@ class Scene extends Entity {
2499
2652
  }
2500
2653
  }
2501
2654
 
2655
+ var __defProp$9 = Object.defineProperty;
2656
+ var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2657
+ var __publicField$9 = (obj, key, value) => {
2658
+ __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
2659
+ return value;
2660
+ };
2502
2661
  class Transition {
2503
2662
  /**
2504
2663
  * Creates a scene transition in which the outgoing scene slides out and the incoming scene slides in, as if the incoming scene pushes it.
@@ -2524,7 +2683,9 @@ class Transition {
2524
2683
  class NoneTransition extends Transition {
2525
2684
  constructor() {
2526
2685
  super();
2527
- this.type = "None" /* None */;
2686
+ __publicField$9(this, "type", "None" /* None */);
2687
+ __publicField$9(this, "easing");
2688
+ __publicField$9(this, "duration");
2528
2689
  this.duration = NaN;
2529
2690
  this.easing = Easings.none;
2530
2691
  }
@@ -2532,7 +2693,10 @@ class NoneTransition extends Transition {
2532
2693
  class SlideTransition extends Transition {
2533
2694
  constructor(direction, duration, easing) {
2534
2695
  super();
2535
- this.type = "Slide" /* Slide */;
2696
+ __publicField$9(this, "type", "Slide" /* Slide */);
2697
+ __publicField$9(this, "easing");
2698
+ __publicField$9(this, "duration");
2699
+ __publicField$9(this, "direction");
2536
2700
  this.direction = direction;
2537
2701
  this.duration = duration;
2538
2702
  this.easing = easing;
@@ -2557,18 +2721,25 @@ class SceneTransition {
2557
2721
  }
2558
2722
  }
2559
2723
 
2560
- const _Timer = class {
2724
+ var __defProp$8 = Object.defineProperty;
2725
+ var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2726
+ var __publicField$8 = (obj, key, value) => {
2727
+ __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
2728
+ return value;
2729
+ };
2730
+ const _Timer = class _Timer {
2561
2731
  constructor(name) {
2562
2732
  // startTime is the timestamp of the current active run
2563
- this.startTime = NaN;
2564
- this.stopTime = NaN;
2565
- this.stopped = true;
2733
+ __publicField$8(this, "startTime", NaN);
2734
+ __publicField$8(this, "stopTime", NaN);
2735
+ __publicField$8(this, "stopped", true);
2566
2736
  /**
2567
2737
  * cumulativeElapsed is a cumulative total of elapsed time while the timer
2568
2738
  * was in previous started (running) states, NOT INCLUDING the possibly
2569
2739
  * active run's duration
2570
2740
  */
2571
- this.cumulativeElapsed = NaN;
2741
+ __publicField$8(this, "cumulativeElapsed", NaN);
2742
+ __publicField$8(this, "name");
2572
2743
  this.name = name;
2573
2744
  }
2574
2745
  /**
@@ -2720,8 +2891,8 @@ const _Timer = class {
2720
2891
  return this._timers.some((t) => t.name === name);
2721
2892
  }
2722
2893
  };
2894
+ __publicField$8(_Timer, "_timers", new Array());
2723
2895
  let Timer = _Timer;
2724
- Timer._timers = new Array();
2725
2896
 
2726
2897
  const deviceMetadataSchema = {
2727
2898
  type: "object",
@@ -2830,27 +3001,33 @@ class WebGlInfo {
2830
3001
  }
2831
3002
  }
2832
3003
 
2833
- var __defProp$5 = Object.defineProperty;
3004
+ var __defProp$7 = Object.defineProperty;
2834
3005
  var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
2835
3006
  var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
2836
3007
  var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
2837
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3008
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2838
3009
  var __spreadValues$5 = (a, b) => {
2839
3010
  for (var prop in b || (b = {}))
2840
3011
  if (__hasOwnProp$5.call(b, prop))
2841
- __defNormalProp$5(a, prop, b[prop]);
3012
+ __defNormalProp$7(a, prop, b[prop]);
2842
3013
  if (__getOwnPropSymbols$5)
2843
3014
  for (var prop of __getOwnPropSymbols$5(b)) {
2844
3015
  if (__propIsEnum$5.call(b, prop))
2845
- __defNormalProp$5(a, prop, b[prop]);
3016
+ __defNormalProp$7(a, prop, b[prop]);
2846
3017
  }
2847
3018
  return a;
2848
3019
  };
3020
+ var __publicField$7 = (obj, key, value) => {
3021
+ __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
3022
+ return value;
3023
+ };
2849
3024
  class I18n {
2850
3025
  constructor(options) {
2851
- this.locale = "";
2852
- this.fallbackLocale = "en";
2853
- this.environmentLocale = this.getEnvironmentLocale();
3026
+ __publicField$7(this, "_translations");
3027
+ __publicField$7(this, "locale", "");
3028
+ __publicField$7(this, "fallbackLocale", "en");
3029
+ __publicField$7(this, "environmentLocale", this.getEnvironmentLocale());
3030
+ __publicField$7(this, "options");
2854
3031
  var _a;
2855
3032
  this.options = options;
2856
3033
  this._translations = (_a = this.mergeAdditionalTranslations(
@@ -3068,21 +3245,21 @@ var ShapeType = /* @__PURE__ */ ((ShapeType2) => {
3068
3245
  return ShapeType2;
3069
3246
  })(ShapeType || {});
3070
3247
 
3071
- var __defProp$4 = Object.defineProperty;
3248
+ var __defProp$6 = Object.defineProperty;
3072
3249
  var __defProps$3 = Object.defineProperties;
3073
3250
  var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
3074
3251
  var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
3075
3252
  var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
3076
3253
  var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
3077
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3254
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3078
3255
  var __spreadValues$4 = (a, b) => {
3079
3256
  for (var prop in b || (b = {}))
3080
3257
  if (__hasOwnProp$4.call(b, prop))
3081
- __defNormalProp$4(a, prop, b[prop]);
3258
+ __defNormalProp$6(a, prop, b[prop]);
3082
3259
  if (__getOwnPropSymbols$4)
3083
3260
  for (var prop of __getOwnPropSymbols$4(b)) {
3084
3261
  if (__propIsEnum$4.call(b, prop))
3085
- __defNormalProp$4(a, prop, b[prop]);
3262
+ __defNormalProp$6(a, prop, b[prop]);
3086
3263
  }
3087
3264
  return a;
3088
3265
  };
@@ -3099,6 +3276,10 @@ var __objRest = (source, exclude) => {
3099
3276
  }
3100
3277
  return target;
3101
3278
  };
3279
+ var __publicField$6 = (obj, key, value) => {
3280
+ __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
3281
+ return value;
3282
+ };
3102
3283
  class Game {
3103
3284
  /**
3104
3285
  * The base class for all games. New games should extend this class.
@@ -3106,44 +3287,66 @@ class Game {
3106
3287
  * @param options - {@link GameOptions}
3107
3288
  */
3108
3289
  constructor(options) {
3109
- this.type = ActivityType.Game;
3110
- this.uuid = Uuid.generate();
3111
- this.beginTimestamp = NaN;
3112
- this.beginIso8601Timestamp = "";
3113
- this.eventListeners = new Array();
3114
- this.gameMetrics = new Array();
3115
- this.stepCount = 0;
3116
- this.steppingNow = 0;
3117
- this.warmupFunctionQueue = new Array();
3118
- this.loaderElementsRemoved = false;
3119
- this.staticTrialSchema = {};
3120
- this.data = {
3290
+ __publicField$6(this, "type", ActivityType.Game);
3291
+ __publicField$6(this, "_canvasKit");
3292
+ __publicField$6(this, "_session");
3293
+ __publicField$6(this, "uuid", Uuid.generate());
3294
+ __publicField$6(this, "name");
3295
+ __publicField$6(this, "id");
3296
+ __publicField$6(this, "options");
3297
+ __publicField$6(this, "beginTimestamp", NaN);
3298
+ __publicField$6(this, "beginIso8601Timestamp", "");
3299
+ __publicField$6(this, "eventListeners", new Array());
3300
+ __publicField$6(this, "gameMetrics", new Array());
3301
+ __publicField$6(this, "fpsMetricReportThreshold");
3302
+ __publicField$6(this, "maximumRecordedActivityMetrics");
3303
+ __publicField$6(this, "stepCount", 0);
3304
+ __publicField$6(this, "steppingNow", 0);
3305
+ __publicField$6(this, "i18n");
3306
+ __publicField$6(this, "warmupFunctionQueue", new Array());
3307
+ __publicField$6(this, "loaderElementsRemoved", false);
3308
+ __publicField$6(this, "_dataStores");
3309
+ __publicField$6(this, "additionalParameters");
3310
+ __publicField$6(this, "staticTrialSchema", {});
3311
+ /** The scene, or its name as a string, to be presented when the game is started. If this is undefined, the game will start with the first scene that has been added */
3312
+ __publicField$6(this, "entryScene");
3313
+ __publicField$6(this, "data", {
3121
3314
  trials: new Array()
3122
- };
3315
+ });
3123
3316
  /** The 0-based index of the current trial */
3124
- this.trialIndex = 0;
3125
- this.drawnFrames = 0;
3126
- this.lastFpsUpdate = 0;
3127
- this.nextFpsUpdate = 0;
3128
- this.fpsRate = 0;
3129
- this.animationFramesRequested = 0;
3130
- this.limitFps = false;
3131
- this.unitTesting = false;
3132
- this.gameStopRequested = false;
3133
- this.webGlRendererInfo = "";
3134
- this.canvasCssWidth = 0;
3135
- this.canvasCssHeight = 0;
3136
- this.scenes = new Array();
3137
- this.freeEntitiesScene = new Scene({
3317
+ __publicField$6(this, "trialIndex", 0);
3318
+ __publicField$6(this, "htmlCanvas");
3319
+ __publicField$6(this, "surface");
3320
+ __publicField$6(this, "showFps");
3321
+ __publicField$6(this, "bodyBackgroundColor");
3322
+ __publicField$6(this, "currentScene");
3323
+ __publicField$6(this, "priorUpdateTime");
3324
+ __publicField$6(this, "fpsTextFont");
3325
+ __publicField$6(this, "fpsTextPaint");
3326
+ __publicField$6(this, "drawnFrames", 0);
3327
+ __publicField$6(this, "lastFpsUpdate", 0);
3328
+ __publicField$6(this, "nextFpsUpdate", 0);
3329
+ __publicField$6(this, "fpsRate", 0);
3330
+ __publicField$6(this, "animationFramesRequested", 0);
3331
+ __publicField$6(this, "limitFps", false);
3332
+ __publicField$6(this, "unitTesting", false);
3333
+ __publicField$6(this, "gameStopRequested", false);
3334
+ __publicField$6(this, "webGlRendererInfo", "");
3335
+ __publicField$6(this, "canvasCssWidth", 0);
3336
+ __publicField$6(this, "canvasCssHeight", 0);
3337
+ __publicField$6(this, "scenes", new Array());
3338
+ __publicField$6(this, "freeEntitiesScene", new Scene({
3138
3339
  name: Constants.FREE_ENTITIES_SCENE_NAME,
3139
3340
  backgroundColor: [255, 255, 255, 0]
3140
- });
3141
- this.incomingSceneTransitions = new Array();
3341
+ }));
3342
+ __publicField$6(this, "incomingSceneTransitions", new Array());
3343
+ __publicField$6(this, "currentSceneSnapshot");
3344
+ __publicField$6(this, "pendingScreenshot");
3142
3345
  /**
3143
3346
  * The m2c2kit engine will automatically include these schema and their
3144
3347
  * values in the trial data.
3145
3348
  */
3146
- this.automaticTrialSchema = {
3349
+ __publicField$6(this, "automaticTrialSchema", {
3147
3350
  document_uuid: {
3148
3351
  type: "string",
3149
3352
  format: "uuid",
@@ -3161,7 +3364,7 @@ class Game {
3161
3364
  },
3162
3365
  activity_id: {
3163
3366
  type: "string",
3164
- description: "Identifier of the activity."
3367
+ description: "Human-readable identifier of the activity."
3165
3368
  },
3166
3369
  activity_version: {
3167
3370
  type: "string",
@@ -3175,8 +3378,8 @@ class Game {
3175
3378
  type: "integer",
3176
3379
  description: "Difference in minutes between UTC and device timezone. Calculated from Date.getTimezoneOffset()."
3177
3380
  }
3178
- };
3179
- this.snapshots = new Array();
3381
+ });
3382
+ __publicField$6(this, "snapshots", new Array());
3180
3383
  var _a, _b;
3181
3384
  if (!options.id || options.id.trim() === "") {
3182
3385
  throw new Error("id is required in GameOptions");
@@ -3218,12 +3421,13 @@ class Game {
3218
3421
  * Saves an item to the activity's key-value store.
3219
3422
  *
3220
3423
  * @remarks The underlying persistence provider of the key-value store must
3221
- * be previously set in the activity's `Session` before use:
3222
- * ```
3223
- * const db: IDataStore = new LocalDatabase();
3224
- * session.dataStore = db;
3225
- * session.initialize();
3226
- * ```
3424
+ * have been previously provided in `SessionOptions`.
3425
+ * @example
3426
+ * import { LocalDatabase } from "@m2c2kit/db";
3427
+ * const session = new Session({
3428
+ * dataStores: [new LocalDatabase()]
3429
+ * ...
3430
+ * });
3227
3431
  * @param key - item key
3228
3432
  * @param value - item value
3229
3433
  * @param globalStore - if true, treat the item as "global" and not
@@ -3234,18 +3438,19 @@ class Game {
3234
3438
  storeSetItem(key, value, globalStore = false) {
3235
3439
  const k = globalStore ? key : this.id.concat(":", key);
3236
3440
  const activityId = globalStore ? "" : this.id;
3237
- return this.dataStore.setItem(k, value, activityId);
3441
+ return this.dataStores[0].setItem(k, value, activityId);
3238
3442
  }
3239
3443
  /**
3240
3444
  * Gets an item value from the activity's key-value store.
3241
3445
  *
3242
3446
  * @remarks The underlying persistence provider of the key-value store must
3243
- * be previously set in the activity's `Session` before use:
3244
- * ```
3245
- * const db: IDataStore = new LocalDatabase();
3246
- * session.dataStore = db;
3247
- * session.initialize();
3248
- * ```
3447
+ * have been previously provided in `SessionOptions`.
3448
+ * @example
3449
+ * import { LocalDatabase } from "@m2c2kit/db";
3450
+ * const session = new Session({
3451
+ * dataStores: [new LocalDatabase()]
3452
+ * ...
3453
+ * });
3249
3454
  * @param key - item key
3250
3455
  * @param globalStore - if true, treat the item as "global" and not
3251
3456
  * associated with a specific activity; global items can be accessed
@@ -3254,18 +3459,19 @@ class Game {
3254
3459
  */
3255
3460
  storeGetItem(key, globalStore = false) {
3256
3461
  const k = globalStore ? key : this.id.concat(":", key);
3257
- return this.dataStore.getItem(k);
3462
+ return this.dataStores[0].getItem(k);
3258
3463
  }
3259
3464
  /**
3260
3465
  * Deletes an item value from the activity's key-value store.
3261
3466
  *
3262
3467
  * @remarks The underlying persistence provider of the key-value store must
3263
- * be previously set in the activity's `Session` before use:
3264
- * ```
3265
- * const db: IDataStore = new LocalDatabase();
3266
- * session.dataStore = db;
3267
- * session.initialize();
3268
- * ```
3468
+ * have been previously provided in `SessionOptions`.
3469
+ * @example
3470
+ * import { LocalDatabase } from "@m2c2kit/db";
3471
+ * const session = new Session({
3472
+ * dataStores: [new LocalDatabase()]
3473
+ * ...
3474
+ * });
3269
3475
  * @param key - item key
3270
3476
  * @param globalStore - if true, treat the item as "global" and not
3271
3477
  * associated with a specific activity; global items can be accessed
@@ -3273,49 +3479,52 @@ class Game {
3273
3479
  */
3274
3480
  storeDeleteItem(key, globalStore = false) {
3275
3481
  const k = globalStore ? key : this.id.concat(":", key);
3276
- return this.dataStore.deleteItem(k);
3482
+ return this.dataStores[0].deleteItem(k);
3277
3483
  }
3278
3484
  /**
3279
3485
  * Deletes all items from the activity's key-value store.
3280
3486
  *
3281
3487
  * @remarks The underlying persistence provider of the key-value store must
3282
- * be previously set in the activity's `Session` before use:
3283
- * ```
3284
- * const db: IDataStore = new LocalDatabase();
3285
- * session.dataStore = db;
3286
- * session.initialize();
3287
- * ```
3488
+ * have been previously provided in `SessionOptions`.
3489
+ * @example
3490
+ * import { LocalDatabase } from "@m2c2kit/db";
3491
+ * const session = new Session({
3492
+ * dataStores: [new LocalDatabase()]
3493
+ * ...
3494
+ * });
3288
3495
  */
3289
3496
  storeClearItems() {
3290
- return this.dataStore.clearItemsByActivityId(this.id);
3497
+ return this.dataStores[0].clearItemsByActivityId(this.id);
3291
3498
  }
3292
3499
  /**
3293
3500
  * Returns keys of all items in the activity's key-value store.
3294
3501
  *
3295
3502
  * @remarks The underlying persistence provider of the key-value store must
3296
- * be previously set in the activity's `Session` before use:
3297
- * ```
3298
- * const db: IDataStore = new LocalDatabase();
3299
- * session.dataStore = db;
3300
- * session.initialize();
3301
- * ```
3503
+ * have been previously provided in `SessionOptions`.
3504
+ * @example
3505
+ * import { LocalDatabase } from "@m2c2kit/db";
3506
+ * const session = new Session({
3507
+ * dataStores: [new LocalDatabase()]
3508
+ * ...
3509
+ * });
3302
3510
  * @param globalStore - if true, treat the item as "global" and not
3303
3511
  * associated with a specific activity; global items can be accessed
3304
3512
  * by any activity. Default is false.
3305
3513
  */
3306
3514
  storeItemsKeys(globalStore = false) {
3307
- return this.dataStore.itemsKeysByActivityId(globalStore ? "" : this.id);
3515
+ return this.dataStores[0].itemsKeysByActivityId(globalStore ? "" : this.id);
3308
3516
  }
3309
3517
  /**
3310
3518
  * Determines if a key exists in the activity's key-value store.
3311
3519
  *
3312
3520
  * @remarks The underlying persistence provider of the key-value store must
3313
- * be previously set in the activity's `Session` before use:
3314
- * ```
3315
- * const db: IDataStore = new LocalDatabase();
3316
- * session.dataStore = db;
3317
- * session.initialize();
3318
- * ```
3521
+ * have been previously provided in `SessionOptions`.
3522
+ * @example
3523
+ * import { LocalDatabase } from "@m2c2kit/db";
3524
+ * const session = new Session({
3525
+ * dataStores: [new LocalDatabase()]
3526
+ * ...
3527
+ * });
3319
3528
  * @param key - item key
3320
3529
  * @param globalStore - if true, treat the item as "global" and not
3321
3530
  * associated with a specific activity; global items can be accessed
@@ -3324,16 +3533,16 @@ class Game {
3324
3533
  */
3325
3534
  storeItemExists(key, globalStore = false) {
3326
3535
  const k = globalStore ? key : this.id.concat(":", key);
3327
- return this.dataStore.itemExists(k);
3536
+ return this.dataStores[0].itemExists(k);
3328
3537
  }
3329
- get dataStore() {
3330
- if (!this._dataStore) {
3331
- throw new Error("dataStore is undefined");
3538
+ get dataStores() {
3539
+ if (!this._dataStores) {
3540
+ throw new Error("dataStores is undefined");
3332
3541
  }
3333
- return this._dataStore;
3542
+ return this._dataStores;
3334
3543
  }
3335
- set dataStore(dataStore) {
3336
- this._dataStore = dataStore;
3544
+ set dataStores(dataStores) {
3545
+ this._dataStores = dataStores;
3337
3546
  }
3338
3547
  getLocalizationOptionsFromGameParameters() {
3339
3548
  const locale = this.getParameter("locale");
@@ -4547,9 +4756,28 @@ class Game {
4547
4756
  outgoingScene.addChild(spr);
4548
4757
  return outgoingScene;
4549
4758
  }
4759
+ /**
4760
+ * Executes a callback when the frame has finished simulating physics.
4761
+ *
4762
+ * @param callback - function to execute.
4763
+ * @param options - options for the callback.
4764
+ */
4765
+ onFrameDidSimulatePhysics(callback, options) {
4766
+ this.addEventListener(
4767
+ EventType.FrameDidSimulatePhysics,
4768
+ callback,
4769
+ options
4770
+ );
4771
+ }
4550
4772
  update() {
4551
4773
  this.scenes.filter((scene) => scene._active).forEach((scene) => scene.update());
4552
4774
  this.freeEntitiesScene.update();
4775
+ const frameDidSimulatePhysicsEvent = {
4776
+ target: this,
4777
+ type: EventType.FrameDidSimulatePhysics,
4778
+ deltaTime: Globals.deltaTime
4779
+ };
4780
+ this.raiseActivityEventOnListeners(frameDidSimulatePhysicsEvent);
4553
4781
  }
4554
4782
  draw(canvas) {
4555
4783
  this.scenes.filter((scene) => scene._active).forEach((scene) => scene.draw(canvas));
@@ -5414,14 +5642,25 @@ class RenderedDataUrlImage {
5414
5642
  }
5415
5643
  }
5416
5644
 
5645
+ var __defProp$5 = Object.defineProperty;
5646
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5647
+ var __publicField$5 = (obj, key, value) => {
5648
+ __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
5649
+ return value;
5650
+ };
5417
5651
  class RenderedImages {
5418
5652
  }
5419
5653
  class LoadedImages {
5420
5654
  }
5421
5655
  class ImageManager {
5422
5656
  constructor(session) {
5423
- this.renderedImages = new RenderedImages();
5424
- this.loadedImages = new LoadedImages();
5657
+ __publicField$5(this, "canvasKit");
5658
+ __publicField$5(this, "renderedImages", new RenderedImages());
5659
+ __publicField$5(this, "loadedImages", new LoadedImages());
5660
+ __publicField$5(this, "_scratchCanvas");
5661
+ __publicField$5(this, "ctx");
5662
+ __publicField$5(this, "scale");
5663
+ __publicField$5(this, "session");
5425
5664
  this.session = session;
5426
5665
  }
5427
5666
  /**
@@ -5782,25 +6021,29 @@ var LabelHorizontalAlignmentMode = /* @__PURE__ */ ((LabelHorizontalAlignmentMod
5782
6021
  return LabelHorizontalAlignmentMode2;
5783
6022
  })(LabelHorizontalAlignmentMode || {});
5784
6023
 
5785
- var __defProp$3 = Object.defineProperty;
6024
+ var __defProp$4 = Object.defineProperty;
5786
6025
  var __defProps$2 = Object.defineProperties;
5787
6026
  var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
5788
6027
  var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
5789
6028
  var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
5790
6029
  var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
5791
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6030
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5792
6031
  var __spreadValues$3 = (a, b) => {
5793
6032
  for (var prop in b || (b = {}))
5794
6033
  if (__hasOwnProp$3.call(b, prop))
5795
- __defNormalProp$3(a, prop, b[prop]);
6034
+ __defNormalProp$4(a, prop, b[prop]);
5796
6035
  if (__getOwnPropSymbols$3)
5797
6036
  for (var prop of __getOwnPropSymbols$3(b)) {
5798
6037
  if (__propIsEnum$3.call(b, prop))
5799
- __defNormalProp$3(a, prop, b[prop]);
6038
+ __defNormalProp$4(a, prop, b[prop]);
5800
6039
  }
5801
6040
  return a;
5802
6041
  };
5803
6042
  var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
6043
+ var __publicField$4 = (obj, key, value) => {
6044
+ __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
6045
+ return value;
6046
+ };
5804
6047
  class Label extends Entity {
5805
6048
  /**
5806
6049
  * Single or multi-line text formatted and rendered on the screen.
@@ -5811,22 +6054,34 @@ class Label extends Entity {
5811
6054
  */
5812
6055
  constructor(options = {}) {
5813
6056
  super(options);
5814
- this.type = EntityType.Label;
5815
- this.isDrawable = true;
5816
- this.isText = true;
6057
+ __publicField$4(this, "type", EntityType.Label);
6058
+ __publicField$4(this, "isDrawable", true);
6059
+ __publicField$4(this, "isText", true);
5817
6060
  // Drawable options
5818
- this.anchorPoint = { x: 0.5, y: 0.5 };
5819
- this.zPosition = 0;
6061
+ __publicField$4(this, "anchorPoint", { x: 0.5, y: 0.5 });
6062
+ __publicField$4(this, "zPosition", 0);
5820
6063
  // Text options
5821
- this._text = "";
6064
+ __publicField$4(this, "_text", "");
5822
6065
  // public getter/setter is below
5823
- this._fontColor = Constants.DEFAULT_FONT_COLOR;
6066
+ __publicField$4(this, "_fontName");
5824
6067
  // public getter/setter is below
5825
- this._fontSize = Constants.DEFAULT_FONT_SIZE;
6068
+ __publicField$4(this, "_fontNames");
6069
+ // public getter/setter is below
6070
+ __publicField$4(this, "_fontColor", Constants.DEFAULT_FONT_COLOR);
6071
+ // public getter/setter is below
6072
+ __publicField$4(this, "_fontSize", Constants.DEFAULT_FONT_SIZE);
5826
6073
  // public getter/setter is below
5827
6074
  // Label options
5828
- this._horizontalAlignmentMode = LabelHorizontalAlignmentMode.Center;
5829
- this._translatedText = "";
6075
+ __publicField$4(this, "_horizontalAlignmentMode", LabelHorizontalAlignmentMode.Center);
6076
+ // public getter/setter is below
6077
+ __publicField$4(this, "_preferredMaxLayoutWidth");
6078
+ // public getter/setter is below
6079
+ __publicField$4(this, "_backgroundColor");
6080
+ // public getter/setter is below
6081
+ __publicField$4(this, "paragraph");
6082
+ __publicField$4(this, "paraStyle");
6083
+ __publicField$4(this, "builder");
6084
+ __publicField$4(this, "_translatedText", "");
5830
6085
  handleInterfaceOptions(this, options);
5831
6086
  if (options.horizontalAlignmentMode) {
5832
6087
  this.horizontalAlignmentMode = options.horizontalAlignmentMode;
@@ -6097,11 +6352,17 @@ class Label extends Entity {
6097
6352
  }
6098
6353
  }
6099
6354
 
6355
+ var __defProp$3 = Object.defineProperty;
6356
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6357
+ var __publicField$3 = (obj, key, value) => {
6358
+ __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
6359
+ return value;
6360
+ };
6100
6361
  class MutablePath {
6101
6362
  constructor() {
6102
- this.size = { width: 0, height: 0 };
6103
- this._subpaths = new Array();
6104
- this.currentPath = new Array();
6363
+ __publicField$3(this, "size", { width: 0, height: 0 });
6364
+ __publicField$3(this, "_subpaths", new Array());
6365
+ __publicField$3(this, "currentPath", new Array());
6105
6366
  }
6106
6367
  get subpaths() {
6107
6368
  if (this.currentPath.length > 0) {
@@ -6736,20 +6997,20 @@ var w;w||(w=typeof CanvasKitInit !== 'undefined' ? CanvasKitInit : {});var da,ea
6736
6997
  function Vd(a){var b=Array(oa(a)+1);ra(a,b,0,b.length);return b}
6737
6998
  var pe={U:function(){return 0},Bb:function(){},Db:function(){return 0},yb:function(){},zb:function(){},V:function(){},Ab:function(){},C:function(a){var b=Fb[a];delete Fb[a];var d=b.gf,f=b.le,h=b.sf,m=h.map(u=>u.Tf).concat(h.map(u=>u.fg));Qb([a],m,u=>{var n={};h.forEach((q,v)=>{var E=u[v],G=q.Rf,L=q.Sf,z=u[v+h.length],N=q.eg,T=q.gg;n[q.Lf]={read:U=>E.fromWireType(G(L,U)),write:(U,pa)=>{var ta=[];N(T,U,z.toWireType(ta,pa));Gb(ta);}};});return [{name:b.name,fromWireType:function(q){var v={},E;for(E in n)v[E]=
6738
6999
  n[E].read(q);f(q);return v},toWireType:function(q,v){for(var E in n)if(!(E in v))throw new TypeError('Missing field: "'+E+'"');var G=d();for(E in n)n[E].write(G,v[E]);null!==q&&q.push(f,G);return G},argPackAdvance:8,readValueFromPointer:Hb,ee:f}]});},qb:function(){},Hb:function(a,b,d,f,h){var m=Sb(d);b=ac(b);Rb(a,{name:b,fromWireType:function(u){return !!u},toWireType:function(u,n){return n?f:h},argPackAdvance:8,readValueFromPointer:function(u){if(1===d)var n=lb;else if(2===d)n=$a;else if(4===d)n=
6739
- Q;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(n[u>>m])},ee:null});},p:function(a,b,d,f,h,m,u,n,q,v,E,G,L){E=ac(E);m=Ic(h,m);n&&(n=Ic(u,n));v&&(v=Ic(q,v));L=Ic(G,L);var z=Lb(E);rc(z,function(){Nc("Cannot construct "+E+" due to unbound types",[f]);});Qb([a,b,d],f?[f]:[],function(N){N=N[0];if(f){var T=N.Rd;var U=T.Ge;}else U=pc.prototype;N=Mb(z,function(){if(Object.getPrototypeOf(this)!==pa)throw new bc("Use 'new' to construct "+E);if(void 0===ta.oe)throw new bc(E+
7000
+ Q;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(n[u>>m])},ee:null});},q:function(a,b,d,f,h,m,u,n,q,v,E,G,L){E=ac(E);m=Ic(h,m);n&&(n=Ic(u,n));v&&(v=Ic(q,v));L=Ic(G,L);var z=Lb(E);rc(z,function(){Nc("Cannot construct "+E+" due to unbound types",[f]);});Qb([a,b,d],f?[f]:[],function(N){N=N[0];if(f){var T=N.Rd;var U=T.Ge;}else U=pc.prototype;N=Mb(z,function(){if(Object.getPrototypeOf(this)!==pa)throw new bc("Use 'new' to construct "+E);if(void 0===ta.oe)throw new bc(E+
6740
7001
  " has no accessible constructor");var hb=ta.oe[arguments.length];if(void 0===hb)throw new bc("Tried to invoke ctor of "+E+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(ta.oe).toString()+") parameters instead!");return hb.apply(this,arguments)});var pa=Object.create(U,{constructor:{value:N}});N.prototype=pa;var ta=new sc(E,N,pa,L,T,m,n,v);T=new zc(E,ta,!0,!1,!1);U=new zc(E+"*",ta,!1,!1,!1);var gb=new zc(E+" const*",ta,!1,!0,!1);hc[a]={pointerType:U,Ff:gb};Ac(z,
6741
- N);return [T,U,gb]});},h:function(a,b,d,f,h,m,u){var n=Pc(d,f);b=ac(b);m=Ic(h,m);Qb([],[a],function(q){function v(){Nc("Cannot call "+E+" due to unbound types",n);}q=q[0];var E=q.name+"."+b;b.startsWith("@@")&&(b=Symbol[b.substring(2)]);var G=q.Rd.constructor;void 0===G[b]?(v.De=d-1,G[b]=v):(qc(G,b,E),G[b].Zd[d-1]=v);Qb([],n,function(L){L=[L[0],null].concat(L.slice(1));L=Oc(E,L,null,m,u);void 0===G[b].Zd?(L.De=d-1,G[b]=L):G[b].Zd[d-1]=L;return []});return []});},A:function(a,b,d,f,h,m){0<b||Qa();var u=
7002
+ N);return [T,U,gb]});},h:function(a,b,d,f,h,m,u){var n=Pc(d,f);b=ac(b);m=Ic(h,m);Qb([],[a],function(q){function v(){Nc("Cannot call "+E+" due to unbound types",n);}q=q[0];var E=q.name+"."+b;b.startsWith("@@")&&(b=Symbol[b.substring(2)]);var G=q.Rd.constructor;void 0===G[b]?(v.De=d-1,G[b]=v):(qc(G,b,E),G[b].Zd[d-1]=v);Qb([],n,function(L){L=[L[0],null].concat(L.slice(1));L=Oc(E,L,null,m,u);void 0===G[b].Zd?(L.De=d-1,G[b]=L):G[b].Zd[d-1]=L;return []});return []});},B:function(a,b,d,f,h,m){0<b||Qa();var u=
6742
7003
  Pc(b,d);h=Ic(f,h);Qb([],[a],function(n){n=n[0];var q="constructor "+n.name;void 0===n.Rd.oe&&(n.Rd.oe=[]);if(void 0!==n.Rd.oe[b-1])throw new bc("Cannot register multiple constructors with identical number of parameters ("+(b-1)+") for class '"+n.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");n.Rd.oe[b-1]=()=>{Nc("Cannot construct "+n.name+" due to unbound types",u);};Qb([],u,function(v){v.splice(1,0,null);n.Rd.oe[b-1]=Oc(q,v,null,h,m);return []});
6743
7004
  return []});},b:function(a,b,d,f,h,m,u,n){var q=Pc(d,f);b=ac(b);m=Ic(h,m);Qb([],[a],function(v){function E(){Nc("Cannot call "+G+" due to unbound types",q);}v=v[0];var G=v.name+"."+b;b.startsWith("@@")&&(b=Symbol[b.substring(2)]);n&&v.Rd.bg.push(b);var L=v.Rd.Ge,z=L[b];void 0===z||void 0===z.Zd&&z.className!==v.name&&z.De===d-2?(E.De=d-2,E.className=v.name,L[b]=E):(qc(L,b,G),L[b].Zd[d-2]=E);Qb([],q,function(N){N=Oc(G,N,v,m,u);void 0===L[b].Zd?(N.De=d-2,L[b]=N):L[b].Zd[d-2]=N;return []});return []});},u:function(a,
6744
7005
  b,d){a=ac(a);Qb([],[b],function(f){f=f[0];w[a]=f.fromWireType(d);return []});},Gb:function(a,b){b=ac(b);Rb(a,{name:b,fromWireType:function(d){var f=Tc(d);Sc(d);return f},toWireType:function(d,f){return xc(f)},argPackAdvance:8,readValueFromPointer:Hb,ee:null});},n:function(a,b,d,f){function h(){}d=Sb(d);b=ac(b);h.values={};Rb(a,{name:b,constructor:h,fromWireType:function(m){return this.constructor.values[m]},toWireType:function(m,u){return u.value},argPackAdvance:8,readValueFromPointer:Uc(b,d,f),ee:null});
6745
7006
  rc(b,h);},e:function(a,b,d){var f=Vc(a,"enum");b=ac(b);a=f.constructor;f=Object.create(f.constructor.prototype,{value:{value:d},constructor:{value:Mb(f.name+"_"+b,function(){})}});a.values[d]=f;a[b]=f;},Y:function(a,b,d){d=Sb(d);b=ac(b);Rb(a,{name:b,fromWireType:function(f){return f},toWireType:function(f,h){return h},argPackAdvance:8,readValueFromPointer:Wc(b,d),ee:null});},y:function(a,b,d,f,h,m){var u=Pc(b,d);a=ac(a);h=Ic(f,h);rc(a,function(){Nc("Cannot call "+a+" due to unbound types",u);},b-1);Qb([],
6746
7007
  u,function(n){n=[n[0],null].concat(n.slice(1));Ac(a,Oc(a,n,null,h,m),b-1);return []});},E:function(a,b,d,f,h){b=ac(b);-1===h&&(h=4294967295);h=Sb(d);var m=n=>n;if(0===f){var u=32-8*d;m=n=>n<<u>>>u;}d=b.includes("unsigned")?function(n,q){return q>>>0}:function(n,q){return q};Rb(a,{name:b,fromWireType:m,toWireType:d,argPackAdvance:8,readValueFromPointer:Xc(b,h,0!==f),ee:null});},v:function(a,b,d){function f(m){m>>=2;var u=mb;return new h(kb,u[m+1],u[m])}var h=[Int8Array,Uint8Array,Int16Array,Uint16Array,
6747
- Int32Array,Uint32Array,Float32Array,Float64Array][b];d=ac(d);Rb(a,{name:d,fromWireType:f,argPackAdvance:8,readValueFromPointer:f},{Vf:!0});},s:function(a,b,d,f,h,m,u,n,q,v,E,G){d=ac(d);m=Ic(h,m);n=Ic(u,n);v=Ic(q,v);G=Ic(E,G);Qb([a],[b],function(L){L=L[0];return [new zc(d,L.Rd,!1,!1,!0,L,f,m,n,v,G)]});},X:function(a,b){b=ac(b);var d="std::string"===b;Rb(a,{name:b,fromWireType:function(f){var h=mb[f>>2],m=f+4;if(d)for(var u=m,n=0;n<=h;++n){var q=m+n;if(n==h||0==K[q]){u=Wa(u,q-u);if(void 0===v)var v=u;
7008
+ Int32Array,Uint32Array,Float32Array,Float64Array][b];d=ac(d);Rb(a,{name:d,fromWireType:f,argPackAdvance:8,readValueFromPointer:f},{Vf:!0});},t:function(a,b,d,f,h,m,u,n,q,v,E,G){d=ac(d);m=Ic(h,m);n=Ic(u,n);v=Ic(q,v);G=Ic(E,G);Qb([a],[b],function(L){L=L[0];return [new zc(d,L.Rd,!1,!1,!0,L,f,m,n,v,G)]});},X:function(a,b){b=ac(b);var d="std::string"===b;Rb(a,{name:b,fromWireType:function(f){var h=mb[f>>2],m=f+4;if(d)for(var u=m,n=0;n<=h;++n){var q=m+n;if(n==h||0==K[q]){u=Wa(u,q-u);if(void 0===v)var v=u;
6748
7009
  else v+=String.fromCharCode(0),v+=u;u=q+1;}}else {v=Array(h);for(n=0;n<h;++n)v[n]=String.fromCharCode(K[m+n]);v=v.join("");}Mc(f);return v},toWireType:function(f,h){h instanceof ArrayBuffer&&(h=new Uint8Array(h));var m="string"==typeof h;m||h instanceof Uint8Array||h instanceof Uint8ClampedArray||h instanceof Int8Array||X("Cannot pass non-string to std::string");var u=d&&m?oa(h):h.length;var n=Hd(4+u+1),q=n+4;mb[n>>2]=u;if(d&&m)ra(h,K,q,u+1);else if(m)for(m=0;m<u;++m){var v=h.charCodeAt(m);255<v&&(Mc(q),
6749
7010
  X("String has UTF-16 code units that do not fit in 8 bits"));K[q+m]=v;}else for(m=0;m<u;++m)K[q+m]=h[m];null!==f&&f.push(Mc,n);return n},argPackAdvance:8,readValueFromPointer:Hb,ee:function(f){Mc(f);}});},P:function(a,b,d){d=ac(d);if(2===b){var f=Ya;var h=cb;var m=db;var u=()=>Za;var n=1;}else 4===b&&(f=eb,h=fb,m=jb,u=()=>mb,n=2);Rb(a,{name:d,fromWireType:function(q){for(var v=mb[q>>2],E=u(),G,L=q+4,z=0;z<=v;++z){var N=q+4+z*b;if(z==v||0==E[N>>n])L=f(L,N-L),void 0===G?G=L:(G+=String.fromCharCode(0),G+=
6750
7011
  L),L=N+b;}Mc(q);return G},toWireType:function(q,v){"string"!=typeof v&&X("Cannot pass non-string to C++ string type "+d);var E=m(v),G=Hd(4+E+b);mb[G>>2]=E>>n;h(v,G+4,E+b);null!==q&&q.push(Mc,G);return G},argPackAdvance:8,readValueFromPointer:Hb,ee:function(q){Mc(q);}});},D:function(a,b,d,f,h,m){Fb[a]={name:ac(b),gf:Ic(d,f),le:Ic(h,m),sf:[]};},g:function(a,b,d,f,h,m,u,n,q,v){Fb[a].sf.push({Lf:ac(b),Tf:d,Rf:Ic(f,h),Sf:m,fg:u,eg:Ic(n,q),gg:v});},Ib:function(a,b){b=ac(b);Rb(a,{Xf:!0,name:b,argPackAdvance:0,
6751
- fromWireType:function(){},toWireType:function(){}});},Fb:function(){return !0},sb:function(){throw Infinity;},I:function(a,b,d){a=Tc(a);b=Vc(b,"emval::as");var f=[],h=xc(f);mb[d>>2]=h;return b.toWireType(f,a)},$:function(a,b,d,f,h){a=$c[a];b=Tc(b);d=Zc(d);var m=[];mb[f>>2]=xc(m);return a(b,d,m,h)},B:function(a,b,d,f){a=$c[a];b=Tc(b);d=Zc(d);a(b,d,null,f);},f:Sc,L:function(a){if(0===a)return xc(ad());a=Zc(a);return xc(ad()[a])},z:function(a,b){var d=cd(a,b),f=d[0];b=f.name+"_$"+d.slice(1).map(function(u){return u.name}).join("_")+
6752
- "$";var h=dd[b];if(void 0!==h)return h;var m=Array(a-1);h=bd((u,n,q,v)=>{for(var E=0,G=0;G<a-1;++G)m[G]=d[G+1].readValueFromPointer(v+E),E+=d[G+1].argPackAdvance;u=u[n].apply(u,m);for(G=0;G<a-1;++G)d[G+1].If&&d[G+1].If(m[G]);if(!f.Xf)return f.toWireType(q,u)});return dd[b]=h},H:function(a,b){a=Tc(a);b=Tc(b);return xc(a[b])},r:function(a){4<a&&(Rc[a].hf+=1);},K:function(a,b,d,f){a=Tc(a);var h=fd[b];h||(h=ed(b),fd[b]=h);return h(a,d,f)},N:function(){return xc([])},i:function(a){return xc(Zc(a))},G:function(){return xc({})},
7012
+ fromWireType:function(){},toWireType:function(){}});},Fb:function(){return !0},sb:function(){throw Infinity;},I:function(a,b,d){a=Tc(a);b=Vc(b,"emval::as");var f=[],h=xc(f);mb[d>>2]=h;return b.toWireType(f,a)},$:function(a,b,d,f,h){a=$c[a];b=Tc(b);d=Zc(d);var m=[];mb[f>>2]=xc(m);return a(b,d,m,h)},A:function(a,b,d,f){a=$c[a];b=Tc(b);d=Zc(d);a(b,d,null,f);},f:Sc,M:function(a){if(0===a)return xc(ad());a=Zc(a);return xc(ad()[a])},z:function(a,b){var d=cd(a,b),f=d[0];b=f.name+"_$"+d.slice(1).map(function(u){return u.name}).join("_")+
7013
+ "$";var h=dd[b];if(void 0!==h)return h;var m=Array(a-1);h=bd((u,n,q,v)=>{for(var E=0,G=0;G<a-1;++G)m[G]=d[G+1].readValueFromPointer(v+E),E+=d[G+1].argPackAdvance;u=u[n].apply(u,m);for(G=0;G<a-1;++G)d[G+1].If&&d[G+1].If(m[G]);if(!f.Xf)return f.toWireType(q,u)});return dd[b]=h},H:function(a,b){a=Tc(a);b=Tc(b);return xc(a[b])},r:function(a){4<a&&(Rc[a].hf+=1);},L:function(a,b,d,f){a=Tc(a);var h=fd[b];h||(h=ed(b),fd[b]=h);return h(a,d,f)},J:function(){return xc([])},i:function(a){return xc(Zc(a))},G:function(){return xc({})},
6753
7014
  mb:function(a){a=Tc(a);return !a},F:function(a){var b=Tc(a);Gb(b);Sc(a);},m:function(a,b,d){a=Tc(a);b=Tc(b);d=Tc(d);a[b]=d;},j:function(a,b){a=Vc(a,"_emval_take_value");a=a.readValueFromPointer(b);return xc(a)},ub:function(){return -52},vb:function(){},a:function(){Qa("");},Eb:gd,bd:function(a){Y.activeTexture(a);},cd:function(a,b){Y.attachShader(nd[a],qd[b]);},ca:function(a,b,d){Y.bindAttribLocation(nd[a],b,Wa(d));},da:function(a,b){35051==a?Y.df=b:35052==a&&(Y.Ee=b);Y.bindBuffer(a,md[b]);},ba:function(a,
6754
7015
  b){Y.bindFramebuffer(a,od[b]);},fc:function(a,b){Y.bindRenderbuffer(a,pd[b]);},Rb:function(a,b){Y.bindSampler(a,sd[b]);},ea:function(a,b){Y.bindTexture(a,ka[b]);},Cc:function(a){Y.bindVertexArray(rd[a]);},xc:function(a){Y.bindVertexArray(rd[a]);},fa:function(a,b,d,f){Y.blendColor(a,b,d,f);},ga:function(a){Y.blendEquation(a);},ha:function(a,b){Y.blendFunc(a,b);},$b:function(a,b,d,f,h,m,u,n,q,v){Y.blitFramebuffer(a,b,d,f,h,m,u,n,q,v);},ia:function(a,b,d,f){2<=x.version?d&&b?Y.bufferData(a,K,f,d,b):Y.bufferData(a,
6755
7016
  b,f):Y.bufferData(a,d?K.subarray(d,d+b):b,f);},ja:function(a,b,d,f){2<=x.version?d&&Y.bufferSubData(a,b,K,f,d):Y.bufferSubData(a,b,K.subarray(f,f+d));},gc:function(a){return Y.checkFramebufferStatus(a)},S:function(a){Y.clear(a);},aa:function(a,b,d,f){Y.clearColor(a,b,d,f);},W:function(a){Y.clearStencil(a);},kb:function(a,b,d,f){return Y.clientWaitSync(td[a],b,(d>>>0)+4294967296*f)},ka:function(a,b,d,f){Y.colorMask(!!a,!!b,!!d,!!f);},la:function(a){Y.compileShader(qd[a]);},ma:function(a,b,d,f,h,m,u,n){2<=
@@ -6759,7 +7020,7 @@ var w;w||(w=typeof CanvasKitInit !== 'undefined' ? CanvasKitInit : {});var da,ea
6759
7020
  Dc:function(a,b){for(var d=0;d<a;d++){var f=Q[b+4*d>>2];Y.deleteVertexArray(rd[f]);rd[f]=null;}},yc:function(a,b){for(var d=0;d<a;d++){var f=Q[b+4*d>>2];Y.deleteVertexArray(rd[f]);rd[f]=null;}},wa:function(a){Y.depthMask(!!a);},xa:function(a){Y.disable(a);},ya:function(a){Y.disableVertexAttribArray(a);},za:function(a,b,d){Y.drawArrays(a,b,d);},Ac:function(a,b,d,f){Y.drawArraysInstanced(a,b,d,f);},vc:function(a,b,d,f,h){Y.qf.drawArraysInstancedBaseInstanceWEBGL(a,b,d,f,h);},tc:function(a,b){for(var d=Dd[a],
6760
7021
  f=0;f<a;f++)d[f]=Q[b+4*f>>2];Y.drawBuffers(d);},Aa:function(a,b,d,f){Y.drawElements(a,b,d,f);},Bc:function(a,b,d,f,h){Y.drawElementsInstanced(a,b,d,f,h);},wc:function(a,b,d,f,h,m,u){Y.qf.drawElementsInstancedBaseVertexBaseInstanceWEBGL(a,b,d,f,h,m,u);},nc:function(a,b,d,f,h,m){Y.drawElements(a,f,h,m);},Ba:function(a){Y.enable(a);},Ca:function(a){Y.enableVertexAttribArray(a);},Xb:function(a,b){return (a=Y.fenceSync(a,b))?(b=ha(td),a.name=b,td[b]=a,b):0},Da:function(){Y.finish();},Ea:function(){Y.flush();},jc:function(a,
6761
7022
  b,d,f){Y.framebufferRenderbuffer(a,b,d,pd[f]);},kc:function(a,b,d,f,h){Y.framebufferTexture2D(a,b,d,ka[f],h);},Fa:function(a){Y.frontFace(a);},Ga:function(a,b){Ed(a,b,"createBuffer",md);},lc:function(a,b){Ed(a,b,"createFramebuffer",od);},mc:function(a,b){Ed(a,b,"createRenderbuffer",pd);},Tb:function(a,b){Ed(a,b,"createSampler",sd);},Ha:function(a,b){Ed(a,b,"createTexture",ka);},Ec:function(a,b){Ed(a,b,"createVertexArray",rd);},zc:function(a,b){Ed(a,b,"createVertexArray",rd);},bc:function(a){Y.generateMipmap(a);},
6762
- Ia:function(a,b,d){d?Q[d>>2]=Y.getBufferParameter(a,b):xd(1281);},Ja:function(){var a=Y.getError()||Ad;Ad=0;return a},Ka:function(a,b){Fd(a,b,2);},cc:function(a,b,d,f){a=Y.getFramebufferAttachmentParameter(a,b,d);if(a instanceof WebGLRenderbuffer||a instanceof WebGLTexture)a=a.name|0;Q[f>>2]=a;},M:function(a,b){Fd(a,b,0);},La:function(a,b,d,f){a=Y.getProgramInfoLog(nd[a]);null===a&&(a="(unknown error)");b=0<b&&f?ra(a,K,f,b):0;d&&(Q[d>>2]=b);},Ma:function(a,b,d){if(d)if(a>=ld)xd(1281);else if(a=nd[a],35716==
7023
+ Ia:function(a,b,d){d?Q[d>>2]=Y.getBufferParameter(a,b):xd(1281);},Ja:function(){var a=Y.getError()||Ad;Ad=0;return a},Ka:function(a,b){Fd(a,b,2);},cc:function(a,b,d,f){a=Y.getFramebufferAttachmentParameter(a,b,d);if(a instanceof WebGLRenderbuffer||a instanceof WebGLTexture)a=a.name|0;Q[f>>2]=a;},N:function(a,b){Fd(a,b,0);},La:function(a,b,d,f){a=Y.getProgramInfoLog(nd[a]);null===a&&(a="(unknown error)");b=0<b&&f?ra(a,K,f,b):0;d&&(Q[d>>2]=b);},Ma:function(a,b,d){if(d)if(a>=ld)xd(1281);else if(a=nd[a],35716==
6763
7024
  b)a=Y.getProgramInfoLog(a),null===a&&(a="(unknown error)"),Q[d>>2]=a.length+1;else if(35719==b){if(!a.Xe)for(b=0;b<Y.getProgramParameter(a,35718);++b)a.Xe=Math.max(a.Xe,Y.getActiveUniform(a,b).name.length+1);Q[d>>2]=a.Xe;}else if(35722==b){if(!a.Ve)for(b=0;b<Y.getProgramParameter(a,35721);++b)a.Ve=Math.max(a.Ve,Y.getActiveAttrib(a,b).name.length+1);Q[d>>2]=a.Ve;}else if(35381==b){if(!a.We)for(b=0;b<Y.getProgramParameter(a,35382);++b)a.We=Math.max(a.We,Y.getActiveUniformBlockName(a,b).length+1);Q[d>>
6764
7025
  2]=a.We;}else Q[d>>2]=Y.getProgramParameter(a,b);else xd(1281);},dc:function(a,b,d){d?Q[d>>2]=Y.getRenderbufferParameter(a,b):xd(1281);},Na:function(a,b,d,f){a=Y.getShaderInfoLog(qd[a]);null===a&&(a="(unknown error)");b=0<b&&f?ra(a,K,f,b):0;d&&(Q[d>>2]=b);},Ob:function(a,b,d,f){a=Y.getShaderPrecisionFormat(a,b);Q[d>>2]=a.rangeMin;Q[d+4>>2]=a.rangeMax;Q[f>>2]=a.precision;},Oa:function(a,b,d){d?35716==b?(a=Y.getShaderInfoLog(qd[a]),null===a&&(a="(unknown error)"),Q[d>>2]=a?a.length+1:0):35720==b?(a=Y.getShaderSource(qd[a]),
6765
7026
  Q[d>>2]=a?a.length+1:0):Q[d>>2]=Y.getShaderParameter(qd[a],b):xd(1281);},R:function(a){var b=ud[a];if(!b){switch(a){case 7939:b=Y.getSupportedExtensions()||[];b=b.concat(b.map(function(f){return "GL_"+f}));b=Gd(b.join(" "));break;case 7936:case 7937:case 37445:case 37446:(b=Y.getParameter(a))||xd(1280);b=b&&Gd(b);break;case 7938:b=Y.getParameter(7938);b=2<=x.version?"OpenGL ES 3.0 ("+b+")":"OpenGL ES 2.0 ("+b+")";b=Gd(b);break;case 35724:b=Y.getParameter(35724);var d=b.match(/^WebGL GLSL ES ([0-9]\.[0-9][0-9]?)(?:$| .*)/);
@@ -6779,7 +7040,7 @@ var w;w||(w=typeof CanvasKitInit !== 'undefined' ? CanvasKitInit : {});var da,ea
6779
7040
  m[n+15];}}else h=S.subarray(f>>2,f+64*b>>2);Y.uniformMatrix4fv(Z(a),!!d,h);}},Kc:function(a){a=nd[a];Y.useProgram(a);Y.Hf=a;},Lc:function(a,b){Y.vertexAttrib1f(a,b);},Mc:function(a,b){Y.vertexAttrib2f(a,S[b>>2],S[b+4>>2]);},Nc:function(a,b){Y.vertexAttrib3f(a,S[b>>2],S[b+4>>2],S[b+8>>2]);},Oc:function(a,b){Y.vertexAttrib4f(a,S[b>>2],S[b+4>>2],S[b+8>>2],S[b+12>>2]);},pc:function(a,b){Y.vertexAttribDivisor(a,b);},qc:function(a,b,d,f,h){Y.vertexAttribIPointer(a,b,d,f,h);},Pc:function(a,b,d,f,h,m){Y.vertexAttribPointer(a,
6780
7041
  b,d,!!f,h,m);},Qc:function(a,b,d,f){Y.viewport(a,b,d,f);},lb:function(a,b,d,f){Y.waitSync(td[a],b,(d>>>0)+4294967296*f);},tb:function(a){var b=K.length;a>>>=0;if(2147483648<a)return !1;for(var d=1;4>=d;d*=2){var f=b*(1+.2/d);f=Math.min(f,a+100663296);var h=Math;f=Math.max(a,f);h=h.min.call(h,2147483648,f+(65536-f%65536)%65536);a:{try{Ra.grow(h-kb.byteLength+65535>>>16);ob();var m=1;break a}catch(u){}m=void 0;}if(m)return !0}return !1},nb:function(){return x?x.Uf:0},wb:function(a,b){var d=0;Od().forEach(function(f,
6781
7042
  h){var m=b+d;h=mb[a+4*h>>2]=m;for(m=0;m<f.length;++m)lb[h++>>0]=f.charCodeAt(m);lb[h>>0]=0;d+=f.length+1;});return 0},xb:function(a,b){var d=Od();mb[a>>2]=d.length;var f=0;d.forEach(function(h){f+=h.length+1;});mb[b>>2]=f;return 0},Jb:function(a){if(!noExitRuntime){if(w.onExit)w.onExit(a);Sa=!0;}wa(a,new Ja(a));},O:function(){return 52},ob:function(){return 52},Cb:function(){return 52},pb:function(){return 70},T:function(a,b,d,f){for(var h=0,m=0;m<d;m++){var u=mb[b>>2],n=mb[b+4>>2];b+=8;for(var q=0;q<
6782
- n;q++){var v=K[u+q],E=Qd[a];0===v||10===v?((1===a?La:Ka)(Va(E,0)),E.length=0):E.push(v);}h+=n;}mb[f>>2]=h;return 0},c:function(){return Ma},k:ae,q:be,l:ce,J:de,Lb:ee,_:fe,Z:ge,Q:he,o:ie,x:je,t:ke,w:le,Kb:me,Mb:ne,Nb:oe,d:function(a){Ma=a;},rb:function(a,b,d,f){return Ud(a,b,d,f)}};
7043
+ n;q++){var v=K[u+q],E=Qd[a];0===v||10===v?((1===a?La:Ka)(Va(E,0)),E.length=0):E.push(v);}h+=n;}mb[f>>2]=h;return 0},c:function(){return Ma},k:ae,o:be,l:ce,K:de,Lb:ee,_:fe,Z:ge,Q:he,p:ie,x:je,s:ke,w:le,Kb:me,Mb:ne,Nb:oe,d:function(a){Ma=a;},rb:function(a,b,d,f){return Ud(a,b,d,f)}};
6783
7044
  (function(){function a(h){w.asm=h.exports;Ra=w.asm.dd;ob();pb=w.asm.fd;rb.unshift(w.asm.ed);ub--;w.monitorRunDependencies&&w.monitorRunDependencies(ub);0==ub&&(wb&&(h=wb,wb=null,h()));}function b(h){a(h.instance);}function d(h){return Cb().then(function(m){return WebAssembly.instantiate(m,f)}).then(function(m){return m}).then(h,function(m){Ka("failed to asynchronously prepare wasm: "+m);Qa(m);})}var f={a:pe};ub++;w.monitorRunDependencies&&w.monitorRunDependencies(ub);
6784
7045
  if(w.instantiateWasm)try{return w.instantiateWasm(f,a)}catch(h){return Ka("Module.instantiateWasm callback failed with error: "+h),!1}(function(){return Na||"function"!=typeof WebAssembly.instantiateStreaming||yb()||zb.startsWith("file://")||za||"function"!=typeof fetch?d(b):fetch(zb,{credentials:"same-origin"}).then(function(h){return WebAssembly.instantiateStreaming(h,f).then(b,function(m){Ka("wasm streaming compile failed: "+m);Ka("falling back to ArrayBuffer instantiation");return d(b)})})})().catch(ea);
6785
7046
  return {}})();w.___wasm_call_ctors=function(){return (w.___wasm_call_ctors=w.asm.ed).apply(null,arguments)};var Mc=w._free=function(){return (Mc=w._free=w.asm.gd).apply(null,arguments)},Hd=w._malloc=function(){return (Hd=w._malloc=w.asm.hd).apply(null,arguments)},Lc=w.___getTypeName=function(){return (Lc=w.___getTypeName=w.asm.id).apply(null,arguments)};w.___embind_register_native_and_builtin_types=function(){return (w.___embind_register_native_and_builtin_types=w.asm.jd).apply(null,arguments)};
@@ -6821,6 +7082,10 @@ var __spreadValues$2 = (a, b) => {
6821
7082
  }
6822
7083
  return a;
6823
7084
  };
7085
+ var __publicField$2 = (obj, key, value) => {
7086
+ __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
7087
+ return value;
7088
+ };
6824
7089
  class Session {
6825
7090
  /**
6826
7091
  * A Session contains one or more activities. The session manages the start
@@ -6829,10 +7094,17 @@ class Session {
6829
7094
  * @param options
6830
7095
  */
6831
7096
  constructor(options) {
6832
- this.eventListeners = new Array();
6833
- this.sessionDictionary = /* @__PURE__ */ new Map();
6834
- this.initialized = false;
6835
- this.version = "0.3.9 (ae8a7530)";
7097
+ __publicField$2(this, "options");
7098
+ __publicField$2(this, "fontManager");
7099
+ __publicField$2(this, "imageManager");
7100
+ __publicField$2(this, "currentActivity");
7101
+ __publicField$2(this, "uuid");
7102
+ __publicField$2(this, "dataStores");
7103
+ __publicField$2(this, "eventListeners", new Array());
7104
+ __publicField$2(this, "sessionDictionary", /* @__PURE__ */ new Map());
7105
+ __publicField$2(this, "canvasKit");
7106
+ __publicField$2(this, "initialized", false);
7107
+ __publicField$2(this, "version", "0.3.11 (25099410)");
6836
7108
  this.options = options;
6837
7109
  for (const activity of this.options.activities) {
6838
7110
  if (this.options.activities.filter((a) => a === activity).length > 1) {
@@ -6999,6 +7271,7 @@ class Session {
6999
7271
  * Asynchronously initializes the m2c2kit engine and loads assets
7000
7272
  */
7001
7273
  async initialize() {
7274
+ var _a;
7002
7275
  console.log(`\u26AA @m2c2kit/core version ${this.version}`);
7003
7276
  Timer.start("sessionInitialize");
7004
7277
  const sessionInitializeEvent = {
@@ -7009,9 +7282,15 @@ class Session {
7009
7282
  DomHelpers.addLoadingElements();
7010
7283
  DomHelpers.setSpinnerVisibility(true);
7011
7284
  DomHelpers.setCanvasOverlayVisibility(true);
7285
+ this.dataStores = this.options.dataStores;
7286
+ if (((_a = this.dataStores) == null ? void 0 : _a.length) === 0) {
7287
+ throw new Error(
7288
+ "Session.initialize(): dataStores must be undefined or a non-zero array of datastores."
7289
+ );
7290
+ }
7012
7291
  await Promise.all(
7013
7292
  this.options.activities.map((activity) => {
7014
- activity.dataStore = this.dataStore;
7293
+ activity.dataStores = this.dataStores;
7015
7294
  activity.onStart(this.sessionActivityLifecycleHandler.bind(this));
7016
7295
  activity.onCancel(this.sessionActivityLifecycleHandler.bind(this));
7017
7296
  activity.onEnd(this.sessionActivityLifecycleHandler.bind(this));
@@ -7137,7 +7416,7 @@ class Session {
7137
7416
  this.options.activities[indexOfCurrentActivity] = this.currentActivity;
7138
7417
  DomHelpers.configureDomForActivity(this.currentActivity);
7139
7418
  this.currentActivity.session = this;
7140
- this.currentActivity.dataStore = this.dataStore;
7419
+ this.currentActivity.dataStores = this.dataStores;
7141
7420
  if (this.currentActivity.type === ActivityType.Game && this.canvasKit) {
7142
7421
  this.currentActivity.canvasKit = this.canvasKit;
7143
7422
  }
@@ -7331,6 +7610,10 @@ var __spreadValues$1 = (a, b) => {
7331
7610
  return a;
7332
7611
  };
7333
7612
  var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
7613
+ var __publicField$1 = (obj, key, value) => {
7614
+ __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
7615
+ return value;
7616
+ };
7334
7617
  class Shape extends Entity {
7335
7618
  /**
7336
7619
  * Rectangular, circular, or path-based shape
@@ -7340,31 +7623,45 @@ class Shape extends Entity {
7340
7623
  constructor(options = {}) {
7341
7624
  var _a;
7342
7625
  super(options);
7343
- this.type = EntityType.Shape;
7344
- this.isDrawable = true;
7345
- this.isShape = true;
7626
+ __publicField$1(this, "type", EntityType.Shape);
7627
+ __publicField$1(this, "isDrawable", true);
7628
+ __publicField$1(this, "isShape", true);
7346
7629
  // Drawable options
7347
- this.anchorPoint = { x: 0.5, y: 0.5 };
7348
- this.zPosition = 0;
7630
+ __publicField$1(this, "anchorPoint", { x: 0.5, y: 0.5 });
7631
+ __publicField$1(this, "zPosition", 0);
7349
7632
  // Shape options
7350
7633
  // TODO: fix the Size issue; should be readonly (calculated value) in all entities, but Rectangle
7351
- this.shapeType = ShapeType.Undefined;
7352
- this.ckPath = null;
7353
- this.cornerRadius = 0;
7354
- this._fillColor = Constants.DEFAULT_SHAPE_FILL_COLOR;
7355
- this._isAntialiased = true;
7356
- this.svgPathScaleForResizing = 1;
7357
- this.svgPathWidth = 0;
7358
- this.svgPathHeight = 0;
7359
- this.svgPreviousAbsoluteScale = NaN;
7360
- this.svgPreviousAbsoluteX = NaN;
7361
- this.svgPreviousAbsoluteY = NaN;
7362
- this.pathIsSvgStringPath = false;
7634
+ __publicField$1(this, "shapeType", ShapeType.Undefined);
7635
+ __publicField$1(this, "circleOfRadius");
7636
+ __publicField$1(this, "rect");
7637
+ __publicField$1(this, "path");
7638
+ __publicField$1(this, "ckPath", null);
7639
+ __publicField$1(this, "ckPathWidth");
7640
+ __publicField$1(this, "ckPathHeight");
7641
+ __publicField$1(this, "pathSvgString");
7642
+ __publicField$1(this, "cornerRadius", 0);
7643
+ __publicField$1(this, "_fillColor", Constants.DEFAULT_SHAPE_FILL_COLOR);
7644
+ __publicField$1(this, "_strokeColor");
7645
+ __publicField$1(this, "lineWidth");
7646
+ __publicField$1(this, "_isAntialiased", true);
7647
+ __publicField$1(this, "_fillColorPaintAntialiased");
7648
+ __publicField$1(this, "_strokeColorPaintAntialiased");
7649
+ __publicField$1(this, "_fillColorPaintNotAntialiased");
7650
+ __publicField$1(this, "_strokeColorPaintNotAntialiased");
7651
+ __publicField$1(this, "svgPathRequestedWidth");
7652
+ __publicField$1(this, "svgPathRequestedHeight");
7653
+ __publicField$1(this, "svgPathScaleForResizing", 1);
7654
+ __publicField$1(this, "svgPathWidth", 0);
7655
+ __publicField$1(this, "svgPathHeight", 0);
7656
+ __publicField$1(this, "svgPreviousAbsoluteScale", NaN);
7657
+ __publicField$1(this, "svgPreviousAbsoluteX", NaN);
7658
+ __publicField$1(this, "svgPreviousAbsoluteY", NaN);
7659
+ __publicField$1(this, "pathIsSvgStringPath", false);
7363
7660
  handleInterfaceOptions(this, options);
7364
- if (((_a = options == null ? void 0 : options.path) == null ? void 0 : _a.svgString) !== void 0) {
7661
+ if (((_a = options == null ? void 0 : options.path) == null ? void 0 : _a.svgPathString) !== void 0) {
7365
7662
  this.shapeType = ShapeType.Path;
7366
7663
  this.pathIsSvgStringPath = true;
7367
- this.pathSvgString = options.path.svgString;
7664
+ this.pathSvgString = options.path.svgPathString;
7368
7665
  this.svgPathRequestedWidth = options.path.width;
7369
7666
  this.svgPathRequestedHeight = options.path.height;
7370
7667
  if (this.svgPathRequestedHeight !== void 0 && this.svgPathRequestedWidth !== void 0) {
@@ -7842,6 +8139,10 @@ var __spreadValues = (a, b) => {
7842
8139
  return a;
7843
8140
  };
7844
8141
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8142
+ var __publicField = (obj, key, value) => {
8143
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
8144
+ return value;
8145
+ };
7845
8146
  class TextLine extends Entity {
7846
8147
  /**
7847
8148
  * Single-line text rendered on the screen.
@@ -7853,22 +8154,28 @@ class TextLine extends Entity {
7853
8154
  constructor(options = {}) {
7854
8155
  var _a;
7855
8156
  super(options);
7856
- this.type = EntityType.TextLine;
7857
- this.isDrawable = true;
7858
- this.isText = true;
8157
+ __publicField(this, "type", EntityType.TextLine);
8158
+ __publicField(this, "isDrawable", true);
8159
+ __publicField(this, "isText", true);
7859
8160
  // Drawable options
7860
- this.zPosition = 0;
8161
+ __publicField(this, "zPosition", 0);
7861
8162
  // We don't know TextLine width in advance, so we must text align left,
7862
8163
  // and so anchorPoint is (0, .5). (we do know height, which is fontSize)
7863
- this.anchorPoint = { x: 0, y: 0.5 };
8164
+ __publicField(this, "anchorPoint", { x: 0, y: 0.5 });
7864
8165
  // Text options
7865
- this._text = "";
8166
+ __publicField(this, "_text", "");
8167
+ // public getter/setter is below
8168
+ __publicField(this, "_fontName");
8169
+ // public getter/setter is below
8170
+ __publicField(this, "_fontColor", Constants.DEFAULT_FONT_COLOR);
7866
8171
  // public getter/setter is below
7867
- this._fontColor = Constants.DEFAULT_FONT_COLOR;
8172
+ __publicField(this, "_fontSize", Constants.DEFAULT_FONT_SIZE);
7868
8173
  // public getter/setter is below
7869
- this._fontSize = Constants.DEFAULT_FONT_SIZE;
7870
- this.typeface = null;
7871
- this._translatedText = "";
8174
+ __publicField(this, "paint");
8175
+ __publicField(this, "font");
8176
+ __publicField(this, "typeface", null);
8177
+ __publicField(this, "_translatedText", "");
8178
+ __publicField(this, "missingTranslationPaint");
7872
8179
  handleInterfaceOptions(this, options);
7873
8180
  this.size.height = this.fontSize;
7874
8181
  this.size.width = (_a = options.width) != null ? _a : NaN;