@esotericsoftware/spine-canvas 4.2.9 → 4.2.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.
@@ -1,11 +1,22 @@
1
+ "use strict";
1
2
  var spine = (() => {
2
3
  var __defProp = Object.defineProperty;
3
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
7
  var __export = (target, all) => {
5
- __markAsModule(target);
6
8
  for (var name in all)
7
9
  __defProp(target, name, { get: all[name], enumerable: true });
8
10
  };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
9
20
 
10
21
  // spine-canvas/src/index.ts
11
22
  var src_exports = {};
@@ -372,6 +383,7 @@ var spine = (() => {
372
383
  static toSinglePrecision(value) {
373
384
  return _Utils.SUPPORTS_TYPED_ARRAYS ? Math.fround(value) : value;
374
385
  }
386
+ // This function is used to fix WebKit 602 specific issue described at http://esotericsoftware.com/forum/iOS-10-disappearing-graphics-10109
375
387
  static webkit602BugfixHelper(alpha, blend) {
376
388
  }
377
389
  static contains(array, element, identity = true) {
@@ -510,12 +522,34 @@ var spine = (() => {
510
522
  var _VertexAttachment = class extends Attachment {
511
523
  constructor(name) {
512
524
  super(name);
525
+ /** The unique ID for this attachment. */
513
526
  this.id = _VertexAttachment.nextID++;
527
+ /** The bones which affect the {@link #getVertices()}. The array entries are, for each vertex, the number of bones affecting
528
+ * the vertex followed by that many bone indices, which is the index of the bone in {@link Skeleton#bones}. Will be null
529
+ * if this attachment has no weights. */
514
530
  this.bones = null;
531
+ /** The vertex positions in the bone's coordinate system. For a non-weighted attachment, the values are `x,y`
532
+ * entries for each vertex. For a weighted attachment, the values are `x,y,weight` entries for each bone affecting
533
+ * each vertex. */
515
534
  this.vertices = [];
535
+ /** The maximum number of world vertex values that can be output by
536
+ * {@link #computeWorldVertices()} using the `count` parameter. */
516
537
  this.worldVerticesLength = 0;
538
+ /** Timelines for the timeline attachment are also applied to this attachment.
539
+ * May be null if no attachment-specific timelines should be applied. */
517
540
  this.timelineAttachment = this;
518
541
  }
542
+ /** Transforms the attachment's local {@link #vertices} to world coordinates. If the slot's {@link Slot#deform} is
543
+ * not empty, it is used to deform the vertices.
544
+ *
545
+ * See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
546
+ * Runtimes Guide.
547
+ * @param start The index of the first {@link #vertices} value to transform. Each vertex has 2 values, x and y.
548
+ * @param count The number of world vertex values to output. Must be <= {@link #worldVerticesLength} - `start`.
549
+ * @param worldVertices The output world vertices. Must have a length >= `offset` + `count` *
550
+ * `stride` / 2.
551
+ * @param offset The `worldVertices` index to begin writing values.
552
+ * @param stride The number of `worldVertices` entries between the value pairs written. */
519
553
  computeWorldVertices(slot, start, count, worldVertices2, offset, stride) {
520
554
  count = offset + (count >> 1) * stride;
521
555
  let skeleton = slot.bone.skeleton;
@@ -574,6 +608,7 @@ var spine = (() => {
574
608
  }
575
609
  }
576
610
  }
611
+ /** Does not copy id (generated) or name (set on construction). **/
577
612
  copyTo(attachment) {
578
613
  if (this.bones) {
579
614
  attachment.bones = new Array(this.bones.length);
@@ -597,6 +632,7 @@ var spine = (() => {
597
632
  this.id = _Sequence.nextID();
598
633
  this.start = 0;
599
634
  this.digits = 0;
635
+ /** The index of the region to show for the setup pose. */
600
636
  this.setupIndex = 0;
601
637
  this.regions = new Array(count);
602
638
  }
@@ -634,8 +670,7 @@ var spine = (() => {
634
670
  };
635
671
  var Sequence = _Sequence;
636
672
  Sequence._nextID = 0;
637
- var SequenceMode;
638
- (function(SequenceMode2) {
673
+ var SequenceMode = /* @__PURE__ */ ((SequenceMode2) => {
639
674
  SequenceMode2[SequenceMode2["hold"] = 0] = "hold";
640
675
  SequenceMode2[SequenceMode2["once"] = 1] = "once";
641
676
  SequenceMode2[SequenceMode2["loop"] = 2] = "loop";
@@ -643,15 +678,16 @@ var spine = (() => {
643
678
  SequenceMode2[SequenceMode2["onceReverse"] = 4] = "onceReverse";
644
679
  SequenceMode2[SequenceMode2["loopReverse"] = 5] = "loopReverse";
645
680
  SequenceMode2[SequenceMode2["pingpongReverse"] = 6] = "pingpongReverse";
646
- })(SequenceMode || (SequenceMode = {}));
681
+ return SequenceMode2;
682
+ })(SequenceMode || {});
647
683
  var SequenceModeValues = [
648
- 0,
649
- 1,
650
- 2,
651
- 3,
652
- 4,
653
- 5,
654
- 6
684
+ 0 /* hold */,
685
+ 1 /* once */,
686
+ 2 /* loop */,
687
+ 3 /* pingpong */,
688
+ 4 /* onceReverse */,
689
+ 5 /* loopReverse */,
690
+ 6 /* pingpongReverse */
655
691
  ];
656
692
 
657
693
  // spine-core/src/Animation.ts
@@ -679,6 +715,11 @@ var spine = (() => {
679
715
  return true;
680
716
  return false;
681
717
  }
718
+ /** Applies all the animation's timelines to the specified skeleton.
719
+ *
720
+ * See Timeline {@link Timeline#apply(Skeleton, float, float, Array, float, MixBlend, MixDirection)}.
721
+ * @param loop If true, the animation repeats after {@link #getDuration()}.
722
+ * @param events May be null to ignore fired events. */
682
723
  apply(skeleton, lastTime, time, loop, events, alpha, blend, direction) {
683
724
  if (!skeleton)
684
725
  throw new Error("skeleton cannot be null.");
@@ -692,18 +733,18 @@ var spine = (() => {
692
733
  timelines[i].apply(skeleton, lastTime, time, events, alpha, blend, direction);
693
734
  }
694
735
  };
695
- var MixBlend;
696
- (function(MixBlend2) {
736
+ var MixBlend = /* @__PURE__ */ ((MixBlend2) => {
697
737
  MixBlend2[MixBlend2["setup"] = 0] = "setup";
698
738
  MixBlend2[MixBlend2["first"] = 1] = "first";
699
739
  MixBlend2[MixBlend2["replace"] = 2] = "replace";
700
740
  MixBlend2[MixBlend2["add"] = 3] = "add";
701
- })(MixBlend || (MixBlend = {}));
702
- var MixDirection;
703
- (function(MixDirection2) {
741
+ return MixBlend2;
742
+ })(MixBlend || {});
743
+ var MixDirection = /* @__PURE__ */ ((MixDirection2) => {
704
744
  MixDirection2[MixDirection2["mixIn"] = 0] = "mixIn";
705
745
  MixDirection2[MixDirection2["mixOut"] = 1] = "mixOut";
706
- })(MixDirection || (MixDirection = {}));
746
+ return MixDirection2;
747
+ })(MixDirection || {});
707
748
  var Property = {
708
749
  rotate: 0,
709
750
  x: 1,
@@ -759,17 +800,25 @@ var spine = (() => {
759
800
  }
760
801
  };
761
802
  var CurveTimeline = class extends Timeline {
803
+ // type, x, y, ...
762
804
  constructor(frameCount, bezierCount, propertyIds) {
763
805
  super(frameCount, propertyIds);
764
- this.curves = Utils.newFloatArray(frameCount + bezierCount * 18);
806
+ this.curves = Utils.newFloatArray(
807
+ frameCount + bezierCount * 18
808
+ /*BEZIER_SIZE*/
809
+ );
765
810
  this.curves[frameCount - 1] = 1;
766
811
  }
812
+ /** Sets the specified key frame to linear interpolation. */
767
813
  setLinear(frame) {
768
814
  this.curves[frame] = 0;
769
815
  }
816
+ /** Sets the specified key frame to stepped interpolation. */
770
817
  setStepped(frame) {
771
818
  this.curves[frame] = 1;
772
819
  }
820
+ /** Shrinks the storage for Bezier curves, for use when <code>bezierCount</code> (specified in the constructor) was larger
821
+ * than the actual number of Bezier curves. */
773
822
  shrink(bezierCount) {
774
823
  let size = this.getFrameCount() + bezierCount * 18;
775
824
  if (this.curves.length > size) {
@@ -778,6 +827,20 @@ var spine = (() => {
778
827
  this.curves = newCurves;
779
828
  }
780
829
  }
830
+ /** Stores the segments for the specified Bezier curve. For timelines that modify multiple values, there may be more than
831
+ * one curve per frame.
832
+ * @param bezier The ordinal of this Bezier curve for this timeline, between 0 and <code>bezierCount - 1</code> (specified
833
+ * in the constructor), inclusive.
834
+ * @param frame Between 0 and <code>frameCount - 1</code>, inclusive.
835
+ * @param value The index of the value for this frame that this curve is used for.
836
+ * @param time1 The time for the first key.
837
+ * @param value1 The value for the first key.
838
+ * @param cx1 The time for the first Bezier handle.
839
+ * @param cy1 The value for the first Bezier handle.
840
+ * @param cx2 The time of the second Bezier handle.
841
+ * @param cy2 The value for the second Bezier handle.
842
+ * @param time2 The time for the second key.
843
+ * @param value2 The value for the second key. */
781
844
  setBezier(bezier, frame, value, time1, value1, cx1, cy1, cx2, cy2, time2, value2) {
782
845
  let curves = this.curves;
783
846
  let i = this.getFrameCount() + bezier * 18;
@@ -799,6 +862,10 @@ var spine = (() => {
799
862
  y += dy;
800
863
  }
801
864
  }
865
+ /** Returns the Bezier interpolated value for the specified time.
866
+ * @param frameIndex The index into {@link #getFrames()} for the values of the frame before <code>time</code>.
867
+ * @param valueOffset The offset from <code>frameIndex</code> to the value this curve is used for.
868
+ * @param i The index of the Bezier segments. See {@link #getCurveType(int)}. */
802
869
  getBezierValue(time, frameIndex, valueOffset, i) {
803
870
  let curves = this.curves;
804
871
  if (curves[i] > time) {
@@ -824,11 +891,18 @@ var spine = (() => {
824
891
  getFrameEntries() {
825
892
  return 2;
826
893
  }
894
+ /** Sets the time and value for the specified frame.
895
+ * @param frame Between 0 and <code>frameCount</code>, inclusive.
896
+ * @param time The frame time in seconds. */
827
897
  setFrame(frame, time, value) {
828
898
  frame <<= 1;
829
899
  this.frames[frame] = time;
830
- this.frames[frame + 1] = value;
900
+ this.frames[
901
+ frame + 1
902
+ /*VALUE*/
903
+ ] = value;
831
904
  }
905
+ /** Returns the interpolated value for the specified time. */
832
906
  getCurveValue(time) {
833
907
  let frames = this.frames;
834
908
  let i = frames.length - 2;
@@ -841,26 +915,55 @@ var spine = (() => {
841
915
  let curveType = this.curves[i >> 1];
842
916
  switch (curveType) {
843
917
  case 0:
844
- let before = frames[i], value = frames[i + 1];
845
- return value + (time - before) / (frames[i + 2] - before) * (frames[i + 2 + 1] - value);
918
+ let before = frames[i], value = frames[
919
+ i + 1
920
+ /*VALUE*/
921
+ ];
922
+ return value + (time - before) / (frames[
923
+ i + 2
924
+ /*ENTRIES*/
925
+ ] - before) * (frames[
926
+ i + 2 + 1
927
+ /*VALUE*/
928
+ ] - value);
846
929
  case 1:
847
- return frames[i + 1];
848
- }
849
- return this.getBezierValue(time, i, 1, curveType - 2);
930
+ return frames[
931
+ i + 1
932
+ /*VALUE*/
933
+ ];
934
+ }
935
+ return this.getBezierValue(
936
+ time,
937
+ i,
938
+ 1,
939
+ curveType - 2
940
+ /*BEZIER*/
941
+ );
850
942
  }
851
943
  };
852
944
  var CurveTimeline2 = class extends CurveTimeline {
945
+ /** @param bezierCount The maximum number of Bezier curves. See {@link #shrink(int)}.
946
+ * @param propertyIds Unique identifiers for the properties the timeline modifies. */
853
947
  constructor(frameCount, bezierCount, propertyId1, propertyId2) {
854
948
  super(frameCount, bezierCount, [propertyId1, propertyId2]);
855
949
  }
856
950
  getFrameEntries() {
857
951
  return 3;
858
952
  }
953
+ /** Sets the time and values for the specified frame.
954
+ * @param frame Between 0 and <code>frameCount</code>, inclusive.
955
+ * @param time The frame time in seconds. */
859
956
  setFrame(frame, time, value1, value2) {
860
957
  frame *= 3;
861
958
  this.frames[frame] = time;
862
- this.frames[frame + 1] = value1;
863
- this.frames[frame + 2] = value2;
959
+ this.frames[
960
+ frame + 1
961
+ /*VALUE1*/
962
+ ] = value1;
963
+ this.frames[
964
+ frame + 2
965
+ /*VALUE2*/
966
+ ] = value2;
864
967
  }
865
968
  };
866
969
  var RotateTimeline = class extends CurveTimeline1 {
@@ -876,30 +979,35 @@ var spine = (() => {
876
979
  let frames = this.frames;
877
980
  if (time < frames[0]) {
878
981
  switch (blend) {
879
- case 0:
982
+ case 0 /* setup */:
880
983
  bone.rotation = bone.data.rotation;
881
984
  return;
882
- case 1:
985
+ case 1 /* first */:
883
986
  bone.rotation += (bone.data.rotation - bone.rotation) * alpha;
884
987
  }
885
988
  return;
886
989
  }
887
990
  let r = this.getCurveValue(time);
888
991
  switch (blend) {
889
- case 0:
992
+ case 0 /* setup */:
890
993
  bone.rotation = bone.data.rotation + r * alpha;
891
994
  break;
892
- case 1:
893
- case 2:
995
+ case 1 /* first */:
996
+ case 2 /* replace */:
894
997
  r += bone.data.rotation - bone.rotation;
895
- case 3:
998
+ case 3 /* add */:
896
999
  bone.rotation += r * alpha;
897
1000
  }
898
1001
  }
899
1002
  };
900
1003
  var TranslateTimeline = class extends CurveTimeline2 {
901
1004
  constructor(frameCount, bezierCount, boneIndex) {
902
- super(frameCount, bezierCount, Property.x + "|" + boneIndex, Property.y + "|" + boneIndex);
1005
+ super(
1006
+ frameCount,
1007
+ bezierCount,
1008
+ Property.x + "|" + boneIndex,
1009
+ Property.y + "|" + boneIndex
1010
+ );
903
1011
  this.boneIndex = 0;
904
1012
  this.boneIndex = boneIndex;
905
1013
  }
@@ -910,47 +1018,88 @@ var spine = (() => {
910
1018
  let frames = this.frames;
911
1019
  if (time < frames[0]) {
912
1020
  switch (blend) {
913
- case 0:
1021
+ case 0 /* setup */:
914
1022
  bone.x = bone.data.x;
915
1023
  bone.y = bone.data.y;
916
1024
  return;
917
- case 1:
1025
+ case 1 /* first */:
918
1026
  bone.x += (bone.data.x - bone.x) * alpha;
919
1027
  bone.y += (bone.data.y - bone.y) * alpha;
920
1028
  }
921
1029
  return;
922
1030
  }
923
1031
  let x = 0, y = 0;
924
- let i = Timeline.search(frames, time, 3);
925
- let curveType = this.curves[i / 3];
1032
+ let i = Timeline.search(
1033
+ frames,
1034
+ time,
1035
+ 3
1036
+ /*ENTRIES*/
1037
+ );
1038
+ let curveType = this.curves[
1039
+ i / 3
1040
+ /*ENTRIES*/
1041
+ ];
926
1042
  switch (curveType) {
927
1043
  case 0:
928
1044
  let before = frames[i];
929
- x = frames[i + 1];
930
- y = frames[i + 2];
931
- let t = (time - before) / (frames[i + 3] - before);
932
- x += (frames[i + 3 + 1] - x) * t;
933
- y += (frames[i + 3 + 2] - y) * t;
1045
+ x = frames[
1046
+ i + 1
1047
+ /*VALUE1*/
1048
+ ];
1049
+ y = frames[
1050
+ i + 2
1051
+ /*VALUE2*/
1052
+ ];
1053
+ let t = (time - before) / (frames[
1054
+ i + 3
1055
+ /*ENTRIES*/
1056
+ ] - before);
1057
+ x += (frames[
1058
+ i + 3 + 1
1059
+ /*VALUE1*/
1060
+ ] - x) * t;
1061
+ y += (frames[
1062
+ i + 3 + 2
1063
+ /*VALUE2*/
1064
+ ] - y) * t;
934
1065
  break;
935
1066
  case 1:
936
- x = frames[i + 1];
937
- y = frames[i + 2];
1067
+ x = frames[
1068
+ i + 1
1069
+ /*VALUE1*/
1070
+ ];
1071
+ y = frames[
1072
+ i + 2
1073
+ /*VALUE2*/
1074
+ ];
938
1075
  break;
939
1076
  default:
940
- x = this.getBezierValue(time, i, 1, curveType - 2);
941
- y = this.getBezierValue(time, i, 2, curveType + 18 - 2);
1077
+ x = this.getBezierValue(
1078
+ time,
1079
+ i,
1080
+ 1,
1081
+ curveType - 2
1082
+ /*BEZIER*/
1083
+ );
1084
+ y = this.getBezierValue(
1085
+ time,
1086
+ i,
1087
+ 2,
1088
+ curveType + 18 - 2
1089
+ /*BEZIER*/
1090
+ );
942
1091
  }
943
1092
  switch (blend) {
944
- case 0:
1093
+ case 0 /* setup */:
945
1094
  bone.x = bone.data.x + x * alpha;
946
1095
  bone.y = bone.data.y + y * alpha;
947
1096
  break;
948
- case 1:
949
- case 2:
1097
+ case 1 /* first */:
1098
+ case 2 /* replace */:
950
1099
  bone.x += (bone.data.x + x - bone.x) * alpha;
951
1100
  bone.y += (bone.data.y + y - bone.y) * alpha;
952
1101
  break;
953
- case 3:
1102
+ case 3 /* add */:
954
1103
  bone.x += x * alpha;
955
1104
  bone.y += y * alpha;
956
1105
  }
@@ -969,24 +1118,24 @@ var spine = (() => {
969
1118
  let frames = this.frames;
970
1119
  if (time < frames[0]) {
971
1120
  switch (blend) {
972
- case 0:
1121
+ case 0 /* setup */:
973
1122
  bone.x = bone.data.x;
974
1123
  return;
975
- case 1:
1124
+ case 1 /* first */:
976
1125
  bone.x += (bone.data.x - bone.x) * alpha;
977
1126
  }
978
1127
  return;
979
1128
  }
980
1129
  let x = this.getCurveValue(time);
981
1130
  switch (blend) {
982
- case 0:
1131
+ case 0 /* setup */:
983
1132
  bone.x = bone.data.x + x * alpha;
984
1133
  break;
985
- case 1:
986
- case 2:
1134
+ case 1 /* first */:
1135
+ case 2 /* replace */:
987
1136
  bone.x += (bone.data.x + x - bone.x) * alpha;
988
1137
  break;
989
- case 3:
1138
+ case 3 /* add */:
990
1139
  bone.x += x * alpha;
991
1140
  }
992
1141
  }
@@ -1004,31 +1153,36 @@ var spine = (() => {
1004
1153
  let frames = this.frames;
1005
1154
  if (time < frames[0]) {
1006
1155
  switch (blend) {
1007
- case 0:
1156
+ case 0 /* setup */:
1008
1157
  bone.y = bone.data.y;
1009
1158
  return;
1010
- case 1:
1159
+ case 1 /* first */:
1011
1160
  bone.y += (bone.data.y - bone.y) * alpha;
1012
1161
  }
1013
1162
  return;
1014
1163
  }
1015
1164
  let y = this.getCurveValue(time);
1016
1165
  switch (blend) {
1017
- case 0:
1166
+ case 0 /* setup */:
1018
1167
  bone.y = bone.data.y + y * alpha;
1019
1168
  break;
1020
- case 1:
1021
- case 2:
1169
+ case 1 /* first */:
1170
+ case 2 /* replace */:
1022
1171
  bone.y += (bone.data.y + y - bone.y) * alpha;
1023
1172
  break;
1024
- case 3:
1173
+ case 3 /* add */:
1025
1174
  bone.y += y * alpha;
1026
1175
  }
1027
1176
  }
1028
1177
  };
1029
1178
  var ScaleTimeline = class extends CurveTimeline2 {
1030
1179
  constructor(frameCount, bezierCount, boneIndex) {
1031
- super(frameCount, bezierCount, Property.scaleX + "|" + boneIndex, Property.scaleY + "|" + boneIndex);
1180
+ super(
1181
+ frameCount,
1182
+ bezierCount,
1183
+ Property.scaleX + "|" + boneIndex,
1184
+ Property.scaleY + "|" + boneIndex
1185
+ );
1032
1186
  this.boneIndex = 0;
1033
1187
  this.boneIndex = boneIndex;
1034
1188
  }
@@ -1039,40 +1193,81 @@ var spine = (() => {
1039
1193
  let frames = this.frames;
1040
1194
  if (time < frames[0]) {
1041
1195
  switch (blend) {
1042
- case 0:
1196
+ case 0 /* setup */:
1043
1197
  bone.scaleX = bone.data.scaleX;
1044
1198
  bone.scaleY = bone.data.scaleY;
1045
1199
  return;
1046
- case 1:
1200
+ case 1 /* first */:
1047
1201
  bone.scaleX += (bone.data.scaleX - bone.scaleX) * alpha;
1048
1202
  bone.scaleY += (bone.data.scaleY - bone.scaleY) * alpha;
1049
1203
  }
1050
1204
  return;
1051
1205
  }
1052
1206
  let x, y;
1053
- let i = Timeline.search(frames, time, 3);
1054
- let curveType = this.curves[i / 3];
1207
+ let i = Timeline.search(
1208
+ frames,
1209
+ time,
1210
+ 3
1211
+ /*ENTRIES*/
1212
+ );
1213
+ let curveType = this.curves[
1214
+ i / 3
1215
+ /*ENTRIES*/
1216
+ ];
1055
1217
  switch (curveType) {
1056
1218
  case 0:
1057
1219
  let before = frames[i];
1058
- x = frames[i + 1];
1059
- y = frames[i + 2];
1060
- let t = (time - before) / (frames[i + 3] - before);
1061
- x += (frames[i + 3 + 1] - x) * t;
1062
- y += (frames[i + 3 + 2] - y) * t;
1220
+ x = frames[
1221
+ i + 1
1222
+ /*VALUE1*/
1223
+ ];
1224
+ y = frames[
1225
+ i + 2
1226
+ /*VALUE2*/
1227
+ ];
1228
+ let t = (time - before) / (frames[
1229
+ i + 3
1230
+ /*ENTRIES*/
1231
+ ] - before);
1232
+ x += (frames[
1233
+ i + 3 + 1
1234
+ /*VALUE1*/
1235
+ ] - x) * t;
1236
+ y += (frames[
1237
+ i + 3 + 2
1238
+ /*VALUE2*/
1239
+ ] - y) * t;
1063
1240
  break;
1064
1241
  case 1:
1065
- x = frames[i + 1];
1066
- y = frames[i + 2];
1242
+ x = frames[
1243
+ i + 1
1244
+ /*VALUE1*/
1245
+ ];
1246
+ y = frames[
1247
+ i + 2
1248
+ /*VALUE2*/
1249
+ ];
1067
1250
  break;
1068
1251
  default:
1069
- x = this.getBezierValue(time, i, 1, curveType - 2);
1070
- y = this.getBezierValue(time, i, 2, curveType + 18 - 2);
1252
+ x = this.getBezierValue(
1253
+ time,
1254
+ i,
1255
+ 1,
1256
+ curveType - 2
1257
+ /*BEZIER*/
1258
+ );
1259
+ y = this.getBezierValue(
1260
+ time,
1261
+ i,
1262
+ 2,
1263
+ curveType + 18 - 2
1264
+ /*BEZIER*/
1265
+ );
1071
1266
  }
1072
1267
  x *= bone.data.scaleX;
1073
1268
  y *= bone.data.scaleY;
1074
1269
  if (alpha == 1) {
1075
- if (blend == 3) {
1270
+ if (blend == 3 /* add */) {
1076
1271
  bone.scaleX += x - bone.data.scaleX;
1077
1272
  bone.scaleY += y - bone.data.scaleY;
1078
1273
  } else {
@@ -1081,41 +1276,41 @@ var spine = (() => {
1081
1276
  }
1082
1277
  } else {
1083
1278
  let bx = 0, by = 0;
1084
- if (direction == 1) {
1279
+ if (direction == 1 /* mixOut */) {
1085
1280
  switch (blend) {
1086
- case 0:
1281
+ case 0 /* setup */:
1087
1282
  bx = bone.data.scaleX;
1088
1283
  by = bone.data.scaleY;
1089
1284
  bone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bx) * alpha;
1090
1285
  bone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - by) * alpha;
1091
1286
  break;
1092
- case 1:
1093
- case 2:
1287
+ case 1 /* first */:
1288
+ case 2 /* replace */:
1094
1289
  bx = bone.scaleX;
1095
1290
  by = bone.scaleY;
1096
1291
  bone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bx) * alpha;
1097
1292
  bone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - by) * alpha;
1098
1293
  break;
1099
- case 3:
1294
+ case 3 /* add */:
1100
1295
  bone.scaleX += (x - bone.data.scaleX) * alpha;
1101
1296
  bone.scaleY += (y - bone.data.scaleY) * alpha;
1102
1297
  }
1103
1298
  } else {
1104
1299
  switch (blend) {
1105
- case 0:
1300
+ case 0 /* setup */:
1106
1301
  bx = Math.abs(bone.data.scaleX) * MathUtils.signum(x);
1107
1302
  by = Math.abs(bone.data.scaleY) * MathUtils.signum(y);
1108
1303
  bone.scaleX = bx + (x - bx) * alpha;
1109
1304
  bone.scaleY = by + (y - by) * alpha;
1110
1305
  break;
1111
- case 1:
1112
- case 2:
1306
+ case 1 /* first */:
1307
+ case 2 /* replace */:
1113
1308
  bx = Math.abs(bone.scaleX) * MathUtils.signum(x);
1114
1309
  by = Math.abs(bone.scaleY) * MathUtils.signum(y);
1115
1310
  bone.scaleX = bx + (x - bx) * alpha;
1116
1311
  bone.scaleY = by + (y - by) * alpha;
1117
1312
  break;
1118
- case 3:
1313
+ case 3 /* add */:
1119
1314
  bone.scaleX += (x - bone.data.scaleX) * alpha;
1120
1315
  bone.scaleY += (y - bone.data.scaleY) * alpha;
1121
1316
  }
@@ -1136,48 +1331,48 @@ var spine = (() => {
1136
1331
  let frames = this.frames;
1137
1332
  if (time < frames[0]) {
1138
1333
  switch (blend) {
1139
- case 0:
1334
+ case 0 /* setup */:
1140
1335
  bone.scaleX = bone.data.scaleX;
1141
1336
  return;
1142
- case 1:
1337
+ case 1 /* first */:
1143
1338
  bone.scaleX += (bone.data.scaleX - bone.scaleX) * alpha;
1144
1339
  }
1145
1340
  return;
1146
1341
  }
1147
1342
  let x = this.getCurveValue(time) * bone.data.scaleX;
1148
1343
  if (alpha == 1) {
1149
- if (blend == 3)
1344
+ if (blend == 3 /* add */)
1150
1345
  bone.scaleX += x - bone.data.scaleX;
1151
1346
  else
1152
1347
  bone.scaleX = x;
1153
1348
  } else {
1154
1349
  let bx = 0;
1155
- if (direction == 1) {
1350
+ if (direction == 1 /* mixOut */) {
1156
1351
  switch (blend) {
1157
- case 0:
1352
+ case 0 /* setup */:
1158
1353
  bx = bone.data.scaleX;
1159
1354
  bone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bx) * alpha;
1160
1355
  break;
1161
- case 1:
1162
- case 2:
1356
+ case 1 /* first */:
1357
+ case 2 /* replace */:
1163
1358
  bx = bone.scaleX;
1164
1359
  bone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bx) * alpha;
1165
1360
  break;
1166
- case 3:
1361
+ case 3 /* add */:
1167
1362
  bone.scaleX += (x - bone.data.scaleX) * alpha;
1168
1363
  }
1169
1364
  } else {
1170
1365
  switch (blend) {
1171
- case 0:
1366
+ case 0 /* setup */:
1172
1367
  bx = Math.abs(bone.data.scaleX) * MathUtils.signum(x);
1173
1368
  bone.scaleX = bx + (x - bx) * alpha;
1174
1369
  break;
1175
- case 1:
1176
- case 2:
1370
+ case 1 /* first */:
1371
+ case 2 /* replace */:
1177
1372
  bx = Math.abs(bone.scaleX) * MathUtils.signum(x);
1178
1373
  bone.scaleX = bx + (x - bx) * alpha;
1179
1374
  break;
1180
- case 3:
1375
+ case 3 /* add */:
1181
1376
  bone.scaleX += (x - bone.data.scaleX) * alpha;
1182
1377
  }
1183
1378
  }
@@ -1197,48 +1392,48 @@ var spine = (() => {
1197
1392
  let frames = this.frames;
1198
1393
  if (time < frames[0]) {
1199
1394
  switch (blend) {
1200
- case 0:
1395
+ case 0 /* setup */:
1201
1396
  bone.scaleY = bone.data.scaleY;
1202
1397
  return;
1203
- case 1:
1398
+ case 1 /* first */:
1204
1399
  bone.scaleY += (bone.data.scaleY - bone.scaleY) * alpha;
1205
1400
  }
1206
1401
  return;
1207
1402
  }
1208
1403
  let y = this.getCurveValue(time) * bone.data.scaleY;
1209
1404
  if (alpha == 1) {
1210
- if (blend == 3)
1405
+ if (blend == 3 /* add */)
1211
1406
  bone.scaleY += y - bone.data.scaleY;
1212
1407
  else
1213
1408
  bone.scaleY = y;
1214
1409
  } else {
1215
1410
  let by = 0;
1216
- if (direction == 1) {
1411
+ if (direction == 1 /* mixOut */) {
1217
1412
  switch (blend) {
1218
- case 0:
1413
+ case 0 /* setup */:
1219
1414
  by = bone.data.scaleY;
1220
1415
  bone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - by) * alpha;
1221
1416
  break;
1222
- case 1:
1223
- case 2:
1417
+ case 1 /* first */:
1418
+ case 2 /* replace */:
1224
1419
  by = bone.scaleY;
1225
1420
  bone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - by) * alpha;
1226
1421
  break;
1227
- case 3:
1422
+ case 3 /* add */:
1228
1423
  bone.scaleY += (y - bone.data.scaleY) * alpha;
1229
1424
  }
1230
1425
  } else {
1231
1426
  switch (blend) {
1232
- case 0:
1427
+ case 0 /* setup */:
1233
1428
  by = Math.abs(bone.data.scaleY) * MathUtils.signum(y);
1234
1429
  bone.scaleY = by + (y - by) * alpha;
1235
1430
  break;
1236
- case 1:
1237
- case 2:
1431
+ case 1 /* first */:
1432
+ case 2 /* replace */:
1238
1433
  by = Math.abs(bone.scaleY) * MathUtils.signum(y);
1239
1434
  bone.scaleY = by + (y - by) * alpha;
1240
1435
  break;
1241
- case 3:
1436
+ case 3 /* add */:
1242
1437
  bone.scaleY += (y - bone.data.scaleY) * alpha;
1243
1438
  }
1244
1439
  }
@@ -1247,7 +1442,12 @@ var spine = (() => {
1247
1442
  };
1248
1443
  var ShearTimeline = class extends CurveTimeline2 {
1249
1444
  constructor(frameCount, bezierCount, boneIndex) {
1250
- super(frameCount, bezierCount, Property.shearX + "|" + boneIndex, Property.shearY + "|" + boneIndex);
1445
+ super(
1446
+ frameCount,
1447
+ bezierCount,
1448
+ Property.shearX + "|" + boneIndex,
1449
+ Property.shearY + "|" + boneIndex
1450
+ );
1251
1451
  this.boneIndex = 0;
1252
1452
  this.boneIndex = boneIndex;
1253
1453
  }
@@ -1258,47 +1458,88 @@ var spine = (() => {
1258
1458
  let frames = this.frames;
1259
1459
  if (time < frames[0]) {
1260
1460
  switch (blend) {
1261
- case 0:
1461
+ case 0 /* setup */:
1262
1462
  bone.shearX = bone.data.shearX;
1263
1463
  bone.shearY = bone.data.shearY;
1264
1464
  return;
1265
- case 1:
1465
+ case 1 /* first */:
1266
1466
  bone.shearX += (bone.data.shearX - bone.shearX) * alpha;
1267
1467
  bone.shearY += (bone.data.shearY - bone.shearY) * alpha;
1268
1468
  }
1269
1469
  return;
1270
1470
  }
1271
1471
  let x = 0, y = 0;
1272
- let i = Timeline.search(frames, time, 3);
1273
- let curveType = this.curves[i / 3];
1472
+ let i = Timeline.search(
1473
+ frames,
1474
+ time,
1475
+ 3
1476
+ /*ENTRIES*/
1477
+ );
1478
+ let curveType = this.curves[
1479
+ i / 3
1480
+ /*ENTRIES*/
1481
+ ];
1274
1482
  switch (curveType) {
1275
1483
  case 0:
1276
1484
  let before = frames[i];
1277
- x = frames[i + 1];
1278
- y = frames[i + 2];
1279
- let t = (time - before) / (frames[i + 3] - before);
1280
- x += (frames[i + 3 + 1] - x) * t;
1281
- y += (frames[i + 3 + 2] - y) * t;
1485
+ x = frames[
1486
+ i + 1
1487
+ /*VALUE1*/
1488
+ ];
1489
+ y = frames[
1490
+ i + 2
1491
+ /*VALUE2*/
1492
+ ];
1493
+ let t = (time - before) / (frames[
1494
+ i + 3
1495
+ /*ENTRIES*/
1496
+ ] - before);
1497
+ x += (frames[
1498
+ i + 3 + 1
1499
+ /*VALUE1*/
1500
+ ] - x) * t;
1501
+ y += (frames[
1502
+ i + 3 + 2
1503
+ /*VALUE2*/
1504
+ ] - y) * t;
1282
1505
  break;
1283
1506
  case 1:
1284
- x = frames[i + 1];
1285
- y = frames[i + 2];
1507
+ x = frames[
1508
+ i + 1
1509
+ /*VALUE1*/
1510
+ ];
1511
+ y = frames[
1512
+ i + 2
1513
+ /*VALUE2*/
1514
+ ];
1286
1515
  break;
1287
1516
  default:
1288
- x = this.getBezierValue(time, i, 1, curveType - 2);
1289
- y = this.getBezierValue(time, i, 2, curveType + 18 - 2);
1517
+ x = this.getBezierValue(
1518
+ time,
1519
+ i,
1520
+ 1,
1521
+ curveType - 2
1522
+ /*BEZIER*/
1523
+ );
1524
+ y = this.getBezierValue(
1525
+ time,
1526
+ i,
1527
+ 2,
1528
+ curveType + 18 - 2
1529
+ /*BEZIER*/
1530
+ );
1290
1531
  }
1291
1532
  switch (blend) {
1292
- case 0:
1533
+ case 0 /* setup */:
1293
1534
  bone.shearX = bone.data.shearX + x * alpha;
1294
1535
  bone.shearY = bone.data.shearY + y * alpha;
1295
1536
  break;
1296
- case 1:
1297
- case 2:
1537
+ case 1 /* first */:
1538
+ case 2 /* replace */:
1298
1539
  bone.shearX += (bone.data.shearX + x - bone.shearX) * alpha;
1299
1540
  bone.shearY += (bone.data.shearY + y - bone.shearY) * alpha;
1300
1541
  break;
1301
- case 3:
1542
+ case 3 /* add */:
1302
1543
  bone.shearX += x * alpha;
1303
1544
  bone.shearY += y * alpha;
1304
1545
  }
@@ -1317,24 +1558,24 @@ var spine = (() => {
1317
1558
  let frames = this.frames;
1318
1559
  if (time < frames[0]) {
1319
1560
  switch (blend) {
1320
- case 0:
1561
+ case 0 /* setup */:
1321
1562
  bone.shearX = bone.data.shearX;
1322
1563
  return;
1323
- case 1:
1564
+ case 1 /* first */:
1324
1565
  bone.shearX += (bone.data.shearX - bone.shearX) * alpha;
1325
1566
  }
1326
1567
  return;
1327
1568
  }
1328
1569
  let x = this.getCurveValue(time);
1329
1570
  switch (blend) {
1330
- case 0:
1571
+ case 0 /* setup */:
1331
1572
  bone.shearX = bone.data.shearX + x * alpha;
1332
1573
  break;
1333
- case 1:
1334
- case 2:
1574
+ case 1 /* first */:
1575
+ case 2 /* replace */:
1335
1576
  bone.shearX += (bone.data.shearX + x - bone.shearX) * alpha;
1336
1577
  break;
1337
- case 3:
1578
+ case 3 /* add */:
1338
1579
  bone.shearX += x * alpha;
1339
1580
  }
1340
1581
  }
@@ -1352,24 +1593,24 @@ var spine = (() => {
1352
1593
  let frames = this.frames;
1353
1594
  if (time < frames[0]) {
1354
1595
  switch (blend) {
1355
- case 0:
1596
+ case 0 /* setup */:
1356
1597
  bone.shearY = bone.data.shearY;
1357
1598
  return;
1358
- case 1:
1599
+ case 1 /* first */:
1359
1600
  bone.shearY += (bone.data.shearY - bone.shearY) * alpha;
1360
1601
  }
1361
1602
  return;
1362
1603
  }
1363
1604
  let y = this.getCurveValue(time);
1364
1605
  switch (blend) {
1365
- case 0:
1606
+ case 0 /* setup */:
1366
1607
  bone.shearY = bone.data.shearY + y * alpha;
1367
1608
  break;
1368
- case 1:
1369
- case 2:
1609
+ case 1 /* first */:
1610
+ case 2 /* replace */:
1370
1611
  bone.shearY += (bone.data.shearY + y - bone.shearY) * alpha;
1371
1612
  break;
1372
- case 3:
1613
+ case 3 /* add */:
1373
1614
  bone.shearY += y * alpha;
1374
1615
  }
1375
1616
  }
@@ -1386,13 +1627,26 @@ var spine = (() => {
1386
1627
  getFrameEntries() {
1387
1628
  return 5;
1388
1629
  }
1630
+ /** Sets the time in seconds, red, green, blue, and alpha for the specified key frame. */
1389
1631
  setFrame(frame, time, r, g, b, a) {
1390
1632
  frame *= 5;
1391
1633
  this.frames[frame] = time;
1392
- this.frames[frame + 1] = r;
1393
- this.frames[frame + 2] = g;
1394
- this.frames[frame + 3] = b;
1395
- this.frames[frame + 4] = a;
1634
+ this.frames[
1635
+ frame + 1
1636
+ /*R*/
1637
+ ] = r;
1638
+ this.frames[
1639
+ frame + 2
1640
+ /*G*/
1641
+ ] = g;
1642
+ this.frames[
1643
+ frame + 3
1644
+ /*B*/
1645
+ ] = b;
1646
+ this.frames[
1647
+ frame + 4
1648
+ /*A*/
1649
+ ] = a;
1396
1650
  }
1397
1651
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1398
1652
  let slot = skeleton.slots[this.slotIndex];
@@ -1403,46 +1657,122 @@ var spine = (() => {
1403
1657
  if (time < frames[0]) {
1404
1658
  let setup = slot.data.color;
1405
1659
  switch (blend) {
1406
- case 0:
1660
+ case 0 /* setup */:
1407
1661
  color.setFromColor(setup);
1408
1662
  return;
1409
- case 1:
1410
- color.add((setup.r - color.r) * alpha, (setup.g - color.g) * alpha, (setup.b - color.b) * alpha, (setup.a - color.a) * alpha);
1663
+ case 1 /* first */:
1664
+ color.add(
1665
+ (setup.r - color.r) * alpha,
1666
+ (setup.g - color.g) * alpha,
1667
+ (setup.b - color.b) * alpha,
1668
+ (setup.a - color.a) * alpha
1669
+ );
1411
1670
  }
1412
1671
  return;
1413
1672
  }
1414
1673
  let r = 0, g = 0, b = 0, a = 0;
1415
- let i = Timeline.search(frames, time, 5);
1416
- let curveType = this.curves[i / 5];
1674
+ let i = Timeline.search(
1675
+ frames,
1676
+ time,
1677
+ 5
1678
+ /*ENTRIES*/
1679
+ );
1680
+ let curveType = this.curves[
1681
+ i / 5
1682
+ /*ENTRIES*/
1683
+ ];
1417
1684
  switch (curveType) {
1418
1685
  case 0:
1419
1686
  let before = frames[i];
1420
- r = frames[i + 1];
1421
- g = frames[i + 2];
1422
- b = frames[i + 3];
1423
- a = frames[i + 4];
1424
- let t = (time - before) / (frames[i + 5] - before);
1425
- r += (frames[i + 5 + 1] - r) * t;
1426
- g += (frames[i + 5 + 2] - g) * t;
1427
- b += (frames[i + 5 + 3] - b) * t;
1428
- a += (frames[i + 5 + 4] - a) * t;
1687
+ r = frames[
1688
+ i + 1
1689
+ /*R*/
1690
+ ];
1691
+ g = frames[
1692
+ i + 2
1693
+ /*G*/
1694
+ ];
1695
+ b = frames[
1696
+ i + 3
1697
+ /*B*/
1698
+ ];
1699
+ a = frames[
1700
+ i + 4
1701
+ /*A*/
1702
+ ];
1703
+ let t = (time - before) / (frames[
1704
+ i + 5
1705
+ /*ENTRIES*/
1706
+ ] - before);
1707
+ r += (frames[
1708
+ i + 5 + 1
1709
+ /*R*/
1710
+ ] - r) * t;
1711
+ g += (frames[
1712
+ i + 5 + 2
1713
+ /*G*/
1714
+ ] - g) * t;
1715
+ b += (frames[
1716
+ i + 5 + 3
1717
+ /*B*/
1718
+ ] - b) * t;
1719
+ a += (frames[
1720
+ i + 5 + 4
1721
+ /*A*/
1722
+ ] - a) * t;
1429
1723
  break;
1430
1724
  case 1:
1431
- r = frames[i + 1];
1432
- g = frames[i + 2];
1433
- b = frames[i + 3];
1434
- a = frames[i + 4];
1725
+ r = frames[
1726
+ i + 1
1727
+ /*R*/
1728
+ ];
1729
+ g = frames[
1730
+ i + 2
1731
+ /*G*/
1732
+ ];
1733
+ b = frames[
1734
+ i + 3
1735
+ /*B*/
1736
+ ];
1737
+ a = frames[
1738
+ i + 4
1739
+ /*A*/
1740
+ ];
1435
1741
  break;
1436
1742
  default:
1437
- r = this.getBezierValue(time, i, 1, curveType - 2);
1438
- g = this.getBezierValue(time, i, 2, curveType + 18 - 2);
1439
- b = this.getBezierValue(time, i, 3, curveType + 18 * 2 - 2);
1440
- a = this.getBezierValue(time, i, 4, curveType + 18 * 3 - 2);
1743
+ r = this.getBezierValue(
1744
+ time,
1745
+ i,
1746
+ 1,
1747
+ curveType - 2
1748
+ /*BEZIER*/
1749
+ );
1750
+ g = this.getBezierValue(
1751
+ time,
1752
+ i,
1753
+ 2,
1754
+ curveType + 18 - 2
1755
+ /*BEZIER*/
1756
+ );
1757
+ b = this.getBezierValue(
1758
+ time,
1759
+ i,
1760
+ 3,
1761
+ curveType + 18 * 2 - 2
1762
+ /*BEZIER*/
1763
+ );
1764
+ a = this.getBezierValue(
1765
+ time,
1766
+ i,
1767
+ 4,
1768
+ curveType + 18 * 3 - 2
1769
+ /*BEZIER*/
1770
+ );
1441
1771
  }
1442
1772
  if (alpha == 1)
1443
1773
  color.set(r, g, b, a);
1444
1774
  else {
1445
- if (blend == 0)
1775
+ if (blend == 0 /* setup */)
1446
1776
  color.setFromColor(slot.data.color);
1447
1777
  color.add((r - color.r) * alpha, (g - color.g) * alpha, (b - color.b) * alpha, (a - color.a) * alpha);
1448
1778
  }
@@ -1459,12 +1789,22 @@ var spine = (() => {
1459
1789
  getFrameEntries() {
1460
1790
  return 4;
1461
1791
  }
1792
+ /** Sets the time in seconds, red, green, blue, and alpha for the specified key frame. */
1462
1793
  setFrame(frame, time, r, g, b) {
1463
1794
  frame <<= 2;
1464
1795
  this.frames[frame] = time;
1465
- this.frames[frame + 1] = r;
1466
- this.frames[frame + 2] = g;
1467
- this.frames[frame + 3] = b;
1796
+ this.frames[
1797
+ frame + 1
1798
+ /*R*/
1799
+ ] = r;
1800
+ this.frames[
1801
+ frame + 2
1802
+ /*G*/
1803
+ ] = g;
1804
+ this.frames[
1805
+ frame + 3
1806
+ /*B*/
1807
+ ] = b;
1468
1808
  }
1469
1809
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1470
1810
  let slot = skeleton.slots[this.slotIndex];
@@ -1475,12 +1815,12 @@ var spine = (() => {
1475
1815
  if (time < frames[0]) {
1476
1816
  let setup = slot.data.color;
1477
1817
  switch (blend) {
1478
- case 0:
1818
+ case 0 /* setup */:
1479
1819
  color.r = setup.r;
1480
1820
  color.g = setup.g;
1481
1821
  color.b = setup.b;
1482
1822
  return;
1483
- case 1:
1823
+ case 1 /* first */:
1484
1824
  color.r += (setup.r - color.r) * alpha;
1485
1825
  color.g += (setup.g - color.g) * alpha;
1486
1826
  color.b += (setup.b - color.b) * alpha;
@@ -1488,35 +1828,88 @@ var spine = (() => {
1488
1828
  return;
1489
1829
  }
1490
1830
  let r = 0, g = 0, b = 0;
1491
- let i = Timeline.search(frames, time, 4);
1831
+ let i = Timeline.search(
1832
+ frames,
1833
+ time,
1834
+ 4
1835
+ /*ENTRIES*/
1836
+ );
1492
1837
  let curveType = this.curves[i >> 2];
1493
1838
  switch (curveType) {
1494
1839
  case 0:
1495
1840
  let before = frames[i];
1496
- r = frames[i + 1];
1497
- g = frames[i + 2];
1498
- b = frames[i + 3];
1499
- let t = (time - before) / (frames[i + 4] - before);
1500
- r += (frames[i + 4 + 1] - r) * t;
1501
- g += (frames[i + 4 + 2] - g) * t;
1502
- b += (frames[i + 4 + 3] - b) * t;
1841
+ r = frames[
1842
+ i + 1
1843
+ /*R*/
1844
+ ];
1845
+ g = frames[
1846
+ i + 2
1847
+ /*G*/
1848
+ ];
1849
+ b = frames[
1850
+ i + 3
1851
+ /*B*/
1852
+ ];
1853
+ let t = (time - before) / (frames[
1854
+ i + 4
1855
+ /*ENTRIES*/
1856
+ ] - before);
1857
+ r += (frames[
1858
+ i + 4 + 1
1859
+ /*R*/
1860
+ ] - r) * t;
1861
+ g += (frames[
1862
+ i + 4 + 2
1863
+ /*G*/
1864
+ ] - g) * t;
1865
+ b += (frames[
1866
+ i + 4 + 3
1867
+ /*B*/
1868
+ ] - b) * t;
1503
1869
  break;
1504
1870
  case 1:
1505
- r = frames[i + 1];
1506
- g = frames[i + 2];
1507
- b = frames[i + 3];
1871
+ r = frames[
1872
+ i + 1
1873
+ /*R*/
1874
+ ];
1875
+ g = frames[
1876
+ i + 2
1877
+ /*G*/
1878
+ ];
1879
+ b = frames[
1880
+ i + 3
1881
+ /*B*/
1882
+ ];
1508
1883
  break;
1509
1884
  default:
1510
- r = this.getBezierValue(time, i, 1, curveType - 2);
1511
- g = this.getBezierValue(time, i, 2, curveType + 18 - 2);
1512
- b = this.getBezierValue(time, i, 3, curveType + 18 * 2 - 2);
1885
+ r = this.getBezierValue(
1886
+ time,
1887
+ i,
1888
+ 1,
1889
+ curveType - 2
1890
+ /*BEZIER*/
1891
+ );
1892
+ g = this.getBezierValue(
1893
+ time,
1894
+ i,
1895
+ 2,
1896
+ curveType + 18 - 2
1897
+ /*BEZIER*/
1898
+ );
1899
+ b = this.getBezierValue(
1900
+ time,
1901
+ i,
1902
+ 3,
1903
+ curveType + 18 * 2 - 2
1904
+ /*BEZIER*/
1905
+ );
1513
1906
  }
1514
1907
  if (alpha == 1) {
1515
1908
  color.r = r;
1516
1909
  color.g = g;
1517
1910
  color.b = b;
1518
1911
  } else {
1519
- if (blend == 0) {
1912
+ if (blend == 0 /* setup */) {
1520
1913
  let setup = slot.data.color;
1521
1914
  color.r = setup.r;
1522
1915
  color.g = setup.g;
@@ -1542,10 +1935,10 @@ var spine = (() => {
1542
1935
  if (time < this.frames[0]) {
1543
1936
  let setup = slot.data.color;
1544
1937
  switch (blend) {
1545
- case 0:
1938
+ case 0 /* setup */:
1546
1939
  color.a = setup.a;
1547
1940
  return;
1548
- case 1:
1941
+ case 1 /* first */:
1549
1942
  color.a += (setup.a - color.a) * alpha;
1550
1943
  }
1551
1944
  return;
@@ -1554,7 +1947,7 @@ var spine = (() => {
1554
1947
  if (alpha == 1)
1555
1948
  color.a = a;
1556
1949
  else {
1557
- if (blend == 0)
1950
+ if (blend == 0 /* setup */)
1558
1951
  color.a = slot.data.color.a;
1559
1952
  color.a += (a - color.a) * alpha;
1560
1953
  }
@@ -1573,16 +1966,38 @@ var spine = (() => {
1573
1966
  getFrameEntries() {
1574
1967
  return 8;
1575
1968
  }
1969
+ /** Sets the time in seconds, light, and dark colors for the specified key frame. */
1576
1970
  setFrame(frame, time, r, g, b, a, r2, g2, b2) {
1577
1971
  frame <<= 3;
1578
1972
  this.frames[frame] = time;
1579
- this.frames[frame + 1] = r;
1580
- this.frames[frame + 2] = g;
1581
- this.frames[frame + 3] = b;
1582
- this.frames[frame + 4] = a;
1583
- this.frames[frame + 5] = r2;
1584
- this.frames[frame + 6] = g2;
1585
- this.frames[frame + 7] = b2;
1973
+ this.frames[
1974
+ frame + 1
1975
+ /*R*/
1976
+ ] = r;
1977
+ this.frames[
1978
+ frame + 2
1979
+ /*G*/
1980
+ ] = g;
1981
+ this.frames[
1982
+ frame + 3
1983
+ /*B*/
1984
+ ] = b;
1985
+ this.frames[
1986
+ frame + 4
1987
+ /*A*/
1988
+ ] = a;
1989
+ this.frames[
1990
+ frame + 5
1991
+ /*R2*/
1992
+ ] = r2;
1993
+ this.frames[
1994
+ frame + 6
1995
+ /*G2*/
1996
+ ] = g2;
1997
+ this.frames[
1998
+ frame + 7
1999
+ /*B2*/
2000
+ ] = b2;
1586
2001
  }
1587
2002
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1588
2003
  let slot = skeleton.slots[this.slotIndex];
@@ -1593,14 +2008,19 @@ var spine = (() => {
1593
2008
  if (time < frames[0]) {
1594
2009
  let setupLight = slot.data.color, setupDark = slot.data.darkColor;
1595
2010
  switch (blend) {
1596
- case 0:
2011
+ case 0 /* setup */:
1597
2012
  light.setFromColor(setupLight);
1598
2013
  dark.r = setupDark.r;
1599
2014
  dark.g = setupDark.g;
1600
2015
  dark.b = setupDark.b;
1601
2016
  return;
1602
- case 1:
1603
- light.add((setupLight.r - light.r) * alpha, (setupLight.g - light.g) * alpha, (setupLight.b - light.b) * alpha, (setupLight.a - light.a) * alpha);
2017
+ case 1 /* first */:
2018
+ light.add(
2019
+ (setupLight.r - light.r) * alpha,
2020
+ (setupLight.g - light.g) * alpha,
2021
+ (setupLight.b - light.b) * alpha,
2022
+ (setupLight.a - light.a) * alpha
2023
+ );
1604
2024
  dark.r += (setupDark.r - dark.r) * alpha;
1605
2025
  dark.g += (setupDark.g - dark.g) * alpha;
1606
2026
  dark.b += (setupDark.b - dark.b) * alpha;
@@ -1608,44 +2028,157 @@ var spine = (() => {
1608
2028
  return;
1609
2029
  }
1610
2030
  let r = 0, g = 0, b = 0, a = 0, r2 = 0, g2 = 0, b2 = 0;
1611
- let i = Timeline.search(frames, time, 8);
2031
+ let i = Timeline.search(
2032
+ frames,
2033
+ time,
2034
+ 8
2035
+ /*ENTRIES*/
2036
+ );
1612
2037
  let curveType = this.curves[i >> 3];
1613
2038
  switch (curveType) {
1614
2039
  case 0:
1615
2040
  let before = frames[i];
1616
- r = frames[i + 1];
1617
- g = frames[i + 2];
1618
- b = frames[i + 3];
1619
- a = frames[i + 4];
1620
- r2 = frames[i + 5];
1621
- g2 = frames[i + 6];
1622
- b2 = frames[i + 7];
1623
- let t = (time - before) / (frames[i + 8] - before);
1624
- r += (frames[i + 8 + 1] - r) * t;
1625
- g += (frames[i + 8 + 2] - g) * t;
1626
- b += (frames[i + 8 + 3] - b) * t;
1627
- a += (frames[i + 8 + 4] - a) * t;
1628
- r2 += (frames[i + 8 + 5] - r2) * t;
1629
- g2 += (frames[i + 8 + 6] - g2) * t;
1630
- b2 += (frames[i + 8 + 7] - b2) * t;
2041
+ r = frames[
2042
+ i + 1
2043
+ /*R*/
2044
+ ];
2045
+ g = frames[
2046
+ i + 2
2047
+ /*G*/
2048
+ ];
2049
+ b = frames[
2050
+ i + 3
2051
+ /*B*/
2052
+ ];
2053
+ a = frames[
2054
+ i + 4
2055
+ /*A*/
2056
+ ];
2057
+ r2 = frames[
2058
+ i + 5
2059
+ /*R2*/
2060
+ ];
2061
+ g2 = frames[
2062
+ i + 6
2063
+ /*G2*/
2064
+ ];
2065
+ b2 = frames[
2066
+ i + 7
2067
+ /*B2*/
2068
+ ];
2069
+ let t = (time - before) / (frames[
2070
+ i + 8
2071
+ /*ENTRIES*/
2072
+ ] - before);
2073
+ r += (frames[
2074
+ i + 8 + 1
2075
+ /*R*/
2076
+ ] - r) * t;
2077
+ g += (frames[
2078
+ i + 8 + 2
2079
+ /*G*/
2080
+ ] - g) * t;
2081
+ b += (frames[
2082
+ i + 8 + 3
2083
+ /*B*/
2084
+ ] - b) * t;
2085
+ a += (frames[
2086
+ i + 8 + 4
2087
+ /*A*/
2088
+ ] - a) * t;
2089
+ r2 += (frames[
2090
+ i + 8 + 5
2091
+ /*R2*/
2092
+ ] - r2) * t;
2093
+ g2 += (frames[
2094
+ i + 8 + 6
2095
+ /*G2*/
2096
+ ] - g2) * t;
2097
+ b2 += (frames[
2098
+ i + 8 + 7
2099
+ /*B2*/
2100
+ ] - b2) * t;
1631
2101
  break;
1632
2102
  case 1:
1633
- r = frames[i + 1];
1634
- g = frames[i + 2];
1635
- b = frames[i + 3];
1636
- a = frames[i + 4];
1637
- r2 = frames[i + 5];
1638
- g2 = frames[i + 6];
1639
- b2 = frames[i + 7];
2103
+ r = frames[
2104
+ i + 1
2105
+ /*R*/
2106
+ ];
2107
+ g = frames[
2108
+ i + 2
2109
+ /*G*/
2110
+ ];
2111
+ b = frames[
2112
+ i + 3
2113
+ /*B*/
2114
+ ];
2115
+ a = frames[
2116
+ i + 4
2117
+ /*A*/
2118
+ ];
2119
+ r2 = frames[
2120
+ i + 5
2121
+ /*R2*/
2122
+ ];
2123
+ g2 = frames[
2124
+ i + 6
2125
+ /*G2*/
2126
+ ];
2127
+ b2 = frames[
2128
+ i + 7
2129
+ /*B2*/
2130
+ ];
1640
2131
  break;
1641
2132
  default:
1642
- r = this.getBezierValue(time, i, 1, curveType - 2);
1643
- g = this.getBezierValue(time, i, 2, curveType + 18 - 2);
1644
- b = this.getBezierValue(time, i, 3, curveType + 18 * 2 - 2);
1645
- a = this.getBezierValue(time, i, 4, curveType + 18 * 3 - 2);
1646
- r2 = this.getBezierValue(time, i, 5, curveType + 18 * 4 - 2);
1647
- g2 = this.getBezierValue(time, i, 6, curveType + 18 * 5 - 2);
1648
- b2 = this.getBezierValue(time, i, 7, curveType + 18 * 6 - 2);
2133
+ r = this.getBezierValue(
2134
+ time,
2135
+ i,
2136
+ 1,
2137
+ curveType - 2
2138
+ /*BEZIER*/
2139
+ );
2140
+ g = this.getBezierValue(
2141
+ time,
2142
+ i,
2143
+ 2,
2144
+ curveType + 18 - 2
2145
+ /*BEZIER*/
2146
+ );
2147
+ b = this.getBezierValue(
2148
+ time,
2149
+ i,
2150
+ 3,
2151
+ curveType + 18 * 2 - 2
2152
+ /*BEZIER*/
2153
+ );
2154
+ a = this.getBezierValue(
2155
+ time,
2156
+ i,
2157
+ 4,
2158
+ curveType + 18 * 3 - 2
2159
+ /*BEZIER*/
2160
+ );
2161
+ r2 = this.getBezierValue(
2162
+ time,
2163
+ i,
2164
+ 5,
2165
+ curveType + 18 * 4 - 2
2166
+ /*BEZIER*/
2167
+ );
2168
+ g2 = this.getBezierValue(
2169
+ time,
2170
+ i,
2171
+ 6,
2172
+ curveType + 18 * 5 - 2
2173
+ /*BEZIER*/
2174
+ );
2175
+ b2 = this.getBezierValue(
2176
+ time,
2177
+ i,
2178
+ 7,
2179
+ curveType + 18 * 6 - 2
2180
+ /*BEZIER*/
2181
+ );
1649
2182
  }
1650
2183
  if (alpha == 1) {
1651
2184
  light.set(r, g, b, a);
@@ -1653,7 +2186,7 @@ var spine = (() => {
1653
2186
  dark.g = g2;
1654
2187
  dark.b = b2;
1655
2188
  } else {
1656
- if (blend == 0) {
2189
+ if (blend == 0 /* setup */) {
1657
2190
  light.setFromColor(slot.data.color);
1658
2191
  let setupDark = slot.data.darkColor;
1659
2192
  dark.r = setupDark.r;
@@ -1679,15 +2212,34 @@ var spine = (() => {
1679
2212
  getFrameEntries() {
1680
2213
  return 7;
1681
2214
  }
2215
+ /** Sets the time in seconds, light, and dark colors for the specified key frame. */
1682
2216
  setFrame(frame, time, r, g, b, r2, g2, b2) {
1683
2217
  frame *= 7;
1684
2218
  this.frames[frame] = time;
1685
- this.frames[frame + 1] = r;
1686
- this.frames[frame + 2] = g;
1687
- this.frames[frame + 3] = b;
1688
- this.frames[frame + 4] = r2;
1689
- this.frames[frame + 5] = g2;
1690
- this.frames[frame + 6] = b2;
2219
+ this.frames[
2220
+ frame + 1
2221
+ /*R*/
2222
+ ] = r;
2223
+ this.frames[
2224
+ frame + 2
2225
+ /*G*/
2226
+ ] = g;
2227
+ this.frames[
2228
+ frame + 3
2229
+ /*B*/
2230
+ ] = b;
2231
+ this.frames[
2232
+ frame + 4
2233
+ /*R2*/
2234
+ ] = r2;
2235
+ this.frames[
2236
+ frame + 5
2237
+ /*G2*/
2238
+ ] = g2;
2239
+ this.frames[
2240
+ frame + 6
2241
+ /*B2*/
2242
+ ] = b2;
1691
2243
  }
1692
2244
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1693
2245
  let slot = skeleton.slots[this.slotIndex];
@@ -1698,7 +2250,7 @@ var spine = (() => {
1698
2250
  if (time < frames[0]) {
1699
2251
  let setupLight = slot.data.color, setupDark = slot.data.darkColor;
1700
2252
  switch (blend) {
1701
- case 0:
2253
+ case 0 /* setup */:
1702
2254
  light.r = setupLight.r;
1703
2255
  light.g = setupLight.g;
1704
2256
  light.b = setupLight.b;
@@ -1706,7 +2258,7 @@ var spine = (() => {
1706
2258
  dark.g = setupDark.g;
1707
2259
  dark.b = setupDark.b;
1708
2260
  return;
1709
- case 1:
2261
+ case 1 /* first */:
1710
2262
  light.r += (setupLight.r - light.r) * alpha;
1711
2263
  light.g += (setupLight.g - light.g) * alpha;
1712
2264
  light.b += (setupLight.b - light.b) * alpha;
@@ -1717,40 +2269,141 @@ var spine = (() => {
1717
2269
  return;
1718
2270
  }
1719
2271
  let r = 0, g = 0, b = 0, a = 0, r2 = 0, g2 = 0, b2 = 0;
1720
- let i = Timeline.search(frames, time, 7);
1721
- let curveType = this.curves[i / 7];
2272
+ let i = Timeline.search(
2273
+ frames,
2274
+ time,
2275
+ 7
2276
+ /*ENTRIES*/
2277
+ );
2278
+ let curveType = this.curves[
2279
+ i / 7
2280
+ /*ENTRIES*/
2281
+ ];
1722
2282
  switch (curveType) {
1723
2283
  case 0:
1724
2284
  let before = frames[i];
1725
- r = frames[i + 1];
1726
- g = frames[i + 2];
1727
- b = frames[i + 3];
1728
- r2 = frames[i + 4];
1729
- g2 = frames[i + 5];
1730
- b2 = frames[i + 6];
1731
- let t = (time - before) / (frames[i + 7] - before);
1732
- r += (frames[i + 7 + 1] - r) * t;
1733
- g += (frames[i + 7 + 2] - g) * t;
1734
- b += (frames[i + 7 + 3] - b) * t;
1735
- r2 += (frames[i + 7 + 4] - r2) * t;
1736
- g2 += (frames[i + 7 + 5] - g2) * t;
1737
- b2 += (frames[i + 7 + 6] - b2) * t;
2285
+ r = frames[
2286
+ i + 1
2287
+ /*R*/
2288
+ ];
2289
+ g = frames[
2290
+ i + 2
2291
+ /*G*/
2292
+ ];
2293
+ b = frames[
2294
+ i + 3
2295
+ /*B*/
2296
+ ];
2297
+ r2 = frames[
2298
+ i + 4
2299
+ /*R2*/
2300
+ ];
2301
+ g2 = frames[
2302
+ i + 5
2303
+ /*G2*/
2304
+ ];
2305
+ b2 = frames[
2306
+ i + 6
2307
+ /*B2*/
2308
+ ];
2309
+ let t = (time - before) / (frames[
2310
+ i + 7
2311
+ /*ENTRIES*/
2312
+ ] - before);
2313
+ r += (frames[
2314
+ i + 7 + 1
2315
+ /*R*/
2316
+ ] - r) * t;
2317
+ g += (frames[
2318
+ i + 7 + 2
2319
+ /*G*/
2320
+ ] - g) * t;
2321
+ b += (frames[
2322
+ i + 7 + 3
2323
+ /*B*/
2324
+ ] - b) * t;
2325
+ r2 += (frames[
2326
+ i + 7 + 4
2327
+ /*R2*/
2328
+ ] - r2) * t;
2329
+ g2 += (frames[
2330
+ i + 7 + 5
2331
+ /*G2*/
2332
+ ] - g2) * t;
2333
+ b2 += (frames[
2334
+ i + 7 + 6
2335
+ /*B2*/
2336
+ ] - b2) * t;
1738
2337
  break;
1739
2338
  case 1:
1740
- r = frames[i + 1];
1741
- g = frames[i + 2];
1742
- b = frames[i + 3];
1743
- r2 = frames[i + 4];
1744
- g2 = frames[i + 5];
1745
- b2 = frames[i + 6];
2339
+ r = frames[
2340
+ i + 1
2341
+ /*R*/
2342
+ ];
2343
+ g = frames[
2344
+ i + 2
2345
+ /*G*/
2346
+ ];
2347
+ b = frames[
2348
+ i + 3
2349
+ /*B*/
2350
+ ];
2351
+ r2 = frames[
2352
+ i + 4
2353
+ /*R2*/
2354
+ ];
2355
+ g2 = frames[
2356
+ i + 5
2357
+ /*G2*/
2358
+ ];
2359
+ b2 = frames[
2360
+ i + 6
2361
+ /*B2*/
2362
+ ];
1746
2363
  break;
1747
2364
  default:
1748
- r = this.getBezierValue(time, i, 1, curveType - 2);
1749
- g = this.getBezierValue(time, i, 2, curveType + 18 - 2);
1750
- b = this.getBezierValue(time, i, 3, curveType + 18 * 2 - 2);
1751
- r2 = this.getBezierValue(time, i, 4, curveType + 18 * 3 - 2);
1752
- g2 = this.getBezierValue(time, i, 5, curveType + 18 * 4 - 2);
1753
- b2 = this.getBezierValue(time, i, 6, curveType + 18 * 5 - 2);
2365
+ r = this.getBezierValue(
2366
+ time,
2367
+ i,
2368
+ 1,
2369
+ curveType - 2
2370
+ /*BEZIER*/
2371
+ );
2372
+ g = this.getBezierValue(
2373
+ time,
2374
+ i,
2375
+ 2,
2376
+ curveType + 18 - 2
2377
+ /*BEZIER*/
2378
+ );
2379
+ b = this.getBezierValue(
2380
+ time,
2381
+ i,
2382
+ 3,
2383
+ curveType + 18 * 2 - 2
2384
+ /*BEZIER*/
2385
+ );
2386
+ r2 = this.getBezierValue(
2387
+ time,
2388
+ i,
2389
+ 4,
2390
+ curveType + 18 * 3 - 2
2391
+ /*BEZIER*/
2392
+ );
2393
+ g2 = this.getBezierValue(
2394
+ time,
2395
+ i,
2396
+ 5,
2397
+ curveType + 18 * 4 - 2
2398
+ /*BEZIER*/
2399
+ );
2400
+ b2 = this.getBezierValue(
2401
+ time,
2402
+ i,
2403
+ 6,
2404
+ curveType + 18 * 5 - 2
2405
+ /*BEZIER*/
2406
+ );
1754
2407
  }
1755
2408
  if (alpha == 1) {
1756
2409
  light.r = r;
@@ -1760,7 +2413,7 @@ var spine = (() => {
1760
2413
  dark.g = g2;
1761
2414
  dark.b = b2;
1762
2415
  } else {
1763
- if (blend == 0) {
2416
+ if (blend == 0 /* setup */) {
1764
2417
  let setupLight = slot.data.color, setupDark = slot.data.darkColor;
1765
2418
  light.r = setupLight.r;
1766
2419
  light.g = setupLight.g;
@@ -1790,6 +2443,7 @@ var spine = (() => {
1790
2443
  getFrameCount() {
1791
2444
  return this.frames.length;
1792
2445
  }
2446
+ /** Sets the time in seconds and the attachment name for the specified key frame. */
1793
2447
  setFrame(frame, time, attachmentName) {
1794
2448
  this.frames[frame] = time;
1795
2449
  this.attachmentNames[frame] = attachmentName;
@@ -1798,13 +2452,13 @@ var spine = (() => {
1798
2452
  let slot = skeleton.slots[this.slotIndex];
1799
2453
  if (!slot.bone.active)
1800
2454
  return;
1801
- if (direction == 1) {
1802
- if (blend == 0)
2455
+ if (direction == 1 /* mixOut */) {
2456
+ if (blend == 0 /* setup */)
1803
2457
  this.setAttachment(skeleton, slot, slot.data.attachmentName);
1804
2458
  return;
1805
2459
  }
1806
2460
  if (time < this.frames[0]) {
1807
- if (blend == 0 || blend == 1)
2461
+ if (blend == 0 /* setup */ || blend == 1 /* first */)
1808
2462
  this.setAttachment(skeleton, slot, slot.data.attachmentName);
1809
2463
  return;
1810
2464
  }
@@ -1827,10 +2481,14 @@ var spine = (() => {
1827
2481
  getFrameCount() {
1828
2482
  return this.frames.length;
1829
2483
  }
2484
+ /** Sets the time in seconds and the vertices for the specified key frame.
2485
+ * @param vertices Vertex positions for an unweighted VertexAttachment, or deform offsets if it has weights. */
1830
2486
  setFrame(frame, time, vertices) {
1831
2487
  this.frames[frame] = time;
1832
2488
  this.vertices[frame] = vertices;
1833
2489
  }
2490
+ /** @param value1 Ignored (0 is used for a deform timeline).
2491
+ * @param value2 Ignored (1 is used for a deform timeline). */
1834
2492
  setBezier(bezier, frame, value, time1, value1, cx1, cy1, cx2, cy2, time2, value2) {
1835
2493
  let curves = this.curves;
1836
2494
  let i = this.getFrameCount() + bezier * 18;
@@ -1888,16 +2546,16 @@ var spine = (() => {
1888
2546
  return;
1889
2547
  let deform = slot.deform;
1890
2548
  if (deform.length == 0)
1891
- blend = 0;
2549
+ blend = 0 /* setup */;
1892
2550
  let vertices = this.vertices;
1893
2551
  let vertexCount = vertices[0].length;
1894
2552
  let frames = this.frames;
1895
2553
  if (time < frames[0]) {
1896
2554
  switch (blend) {
1897
- case 0:
2555
+ case 0 /* setup */:
1898
2556
  deform.length = 0;
1899
2557
  return;
1900
- case 1:
2558
+ case 1 /* first */:
1901
2559
  if (alpha == 1) {
1902
2560
  deform.length = 0;
1903
2561
  return;
@@ -1920,7 +2578,7 @@ var spine = (() => {
1920
2578
  if (time >= frames[frames.length - 1]) {
1921
2579
  let lastVertices = vertices[frames.length - 1];
1922
2580
  if (alpha == 1) {
1923
- if (blend == 3) {
2581
+ if (blend == 3 /* add */) {
1924
2582
  let vertexAttachment = slotAttachment;
1925
2583
  if (!vertexAttachment.bones) {
1926
2584
  let setupVertices = vertexAttachment.vertices;
@@ -1934,7 +2592,7 @@ var spine = (() => {
1934
2592
  Utils.arrayCopy(lastVertices, 0, deform, 0, vertexCount);
1935
2593
  } else {
1936
2594
  switch (blend) {
1937
- case 0: {
2595
+ case 0 /* setup */: {
1938
2596
  let vertexAttachment2 = slotAttachment;
1939
2597
  if (!vertexAttachment2.bones) {
1940
2598
  let setupVertices = vertexAttachment2.vertices;
@@ -1948,12 +2606,12 @@ var spine = (() => {
1948
2606
  }
1949
2607
  break;
1950
2608
  }
1951
- case 1:
1952
- case 2:
2609
+ case 1 /* first */:
2610
+ case 2 /* replace */:
1953
2611
  for (let i2 = 0; i2 < vertexCount; i2++)
1954
2612
  deform[i2] += (lastVertices[i2] - deform[i2]) * alpha;
1955
2613
  break;
1956
- case 3:
2614
+ case 3 /* add */:
1957
2615
  let vertexAttachment = slotAttachment;
1958
2616
  if (!vertexAttachment.bones) {
1959
2617
  let setupVertices = vertexAttachment.vertices;
@@ -1972,7 +2630,7 @@ var spine = (() => {
1972
2630
  let prevVertices = vertices[frame];
1973
2631
  let nextVertices = vertices[frame + 1];
1974
2632
  if (alpha == 1) {
1975
- if (blend == 3) {
2633
+ if (blend == 3 /* add */) {
1976
2634
  let vertexAttachment = slotAttachment;
1977
2635
  if (!vertexAttachment.bones) {
1978
2636
  let setupVertices = vertexAttachment.vertices;
@@ -1994,7 +2652,7 @@ var spine = (() => {
1994
2652
  }
1995
2653
  } else {
1996
2654
  switch (blend) {
1997
- case 0: {
2655
+ case 0 /* setup */: {
1998
2656
  let vertexAttachment2 = slotAttachment;
1999
2657
  if (!vertexAttachment2.bones) {
2000
2658
  let setupVertices = vertexAttachment2.vertices;
@@ -2010,14 +2668,14 @@ var spine = (() => {
2010
2668
  }
2011
2669
  break;
2012
2670
  }
2013
- case 1:
2014
- case 2:
2671
+ case 1 /* first */:
2672
+ case 2 /* replace */:
2015
2673
  for (let i2 = 0; i2 < vertexCount; i2++) {
2016
2674
  let prev = prevVertices[i2];
2017
2675
  deform[i2] += (prev + (nextVertices[i2] - prev) * percent - deform[i2]) * alpha;
2018
2676
  }
2019
2677
  break;
2020
- case 3:
2678
+ case 3 /* add */:
2021
2679
  let vertexAttachment = slotAttachment;
2022
2680
  if (!vertexAttachment.bones) {
2023
2681
  let setupVertices = vertexAttachment.vertices;
@@ -2043,10 +2701,12 @@ var spine = (() => {
2043
2701
  getFrameCount() {
2044
2702
  return this.frames.length;
2045
2703
  }
2704
+ /** Sets the time in seconds and the event for the specified key frame. */
2046
2705
  setFrame(frame, event) {
2047
2706
  this.frames[frame] = event.time;
2048
2707
  this.events[frame] = event;
2049
2708
  }
2709
+ /** Fires events for frames > `lastTime` and <= `time`. */
2050
2710
  apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
2051
2711
  if (!firedEvents)
2052
2712
  return;
@@ -2085,18 +2745,21 @@ var spine = (() => {
2085
2745
  getFrameCount() {
2086
2746
  return this.frames.length;
2087
2747
  }
2748
+ /** Sets the time in seconds and the draw order for the specified key frame.
2749
+ * @param drawOrder For each slot in {@link Skeleton#slots}, the index of the new draw order. May be null to use setup pose
2750
+ * draw order. */
2088
2751
  setFrame(frame, time, drawOrder) {
2089
2752
  this.frames[frame] = time;
2090
2753
  this.drawOrders[frame] = drawOrder;
2091
2754
  }
2092
2755
  apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
2093
- if (direction == 1) {
2094
- if (blend == 0)
2756
+ if (direction == 1 /* mixOut */) {
2757
+ if (blend == 0 /* setup */)
2095
2758
  Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
2096
2759
  return;
2097
2760
  }
2098
2761
  if (time < this.frames[0]) {
2099
- if (blend == 0 || blend == 1)
2762
+ if (blend == 0 /* setup */ || blend == 1 /* first */)
2100
2763
  Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
2101
2764
  return;
2102
2765
  }
@@ -2119,20 +2782,37 @@ var spine = (() => {
2119
2782
  super(frameCount, bezierCount, [
2120
2783
  Property.ikConstraint + "|" + ikConstraintIndex
2121
2784
  ]);
2785
+ /** The index of the IK constraint slot in {@link Skeleton#ikConstraints} that will be changed. */
2122
2786
  this.ikConstraintIndex = 0;
2123
2787
  this.ikConstraintIndex = ikConstraintIndex;
2124
2788
  }
2125
2789
  getFrameEntries() {
2126
2790
  return 6;
2127
2791
  }
2792
+ /** Sets the time in seconds, mix, softness, bend direction, compress, and stretch for the specified key frame. */
2128
2793
  setFrame(frame, time, mix, softness, bendDirection, compress, stretch) {
2129
2794
  frame *= 6;
2130
2795
  this.frames[frame] = time;
2131
- this.frames[frame + 1] = mix;
2132
- this.frames[frame + 2] = softness;
2133
- this.frames[frame + 3] = bendDirection;
2134
- this.frames[frame + 4] = compress ? 1 : 0;
2135
- this.frames[frame + 5] = stretch ? 1 : 0;
2796
+ this.frames[
2797
+ frame + 1
2798
+ /*MIX*/
2799
+ ] = mix;
2800
+ this.frames[
2801
+ frame + 2
2802
+ /*SOFTNESS*/
2803
+ ] = softness;
2804
+ this.frames[
2805
+ frame + 3
2806
+ /*BEND_DIRECTION*/
2807
+ ] = bendDirection;
2808
+ this.frames[
2809
+ frame + 4
2810
+ /*COMPRESS*/
2811
+ ] = compress ? 1 : 0;
2812
+ this.frames[
2813
+ frame + 5
2814
+ /*STRETCH*/
2815
+ ] = stretch ? 1 : 0;
2136
2816
  }
2137
2817
  apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
2138
2818
  let constraint = skeleton.ikConstraints[this.ikConstraintIndex];
@@ -2141,14 +2821,14 @@ var spine = (() => {
2141
2821
  let frames = this.frames;
2142
2822
  if (time < frames[0]) {
2143
2823
  switch (blend) {
2144
- case 0:
2824
+ case 0 /* setup */:
2145
2825
  constraint.mix = constraint.data.mix;
2146
2826
  constraint.softness = constraint.data.softness;
2147
2827
  constraint.bendDirection = constraint.data.bendDirection;
2148
2828
  constraint.compress = constraint.data.compress;
2149
2829
  constraint.stretch = constraint.data.stretch;
2150
2830
  return;
2151
- case 1:
2831
+ case 1 /* first */:
2152
2832
  constraint.mix += (constraint.data.mix - constraint.mix) * alpha;
2153
2833
  constraint.softness += (constraint.data.softness - constraint.softness) * alpha;
2154
2834
  constraint.bendDirection = constraint.data.bendDirection;
@@ -2158,44 +2838,103 @@ var spine = (() => {
2158
2838
  return;
2159
2839
  }
2160
2840
  let mix = 0, softness = 0;
2161
- let i = Timeline.search(frames, time, 6);
2162
- let curveType = this.curves[i / 6];
2841
+ let i = Timeline.search(
2842
+ frames,
2843
+ time,
2844
+ 6
2845
+ /*ENTRIES*/
2846
+ );
2847
+ let curveType = this.curves[
2848
+ i / 6
2849
+ /*ENTRIES*/
2850
+ ];
2163
2851
  switch (curveType) {
2164
2852
  case 0:
2165
2853
  let before = frames[i];
2166
- mix = frames[i + 1];
2167
- softness = frames[i + 2];
2168
- let t = (time - before) / (frames[i + 6] - before);
2169
- mix += (frames[i + 6 + 1] - mix) * t;
2170
- softness += (frames[i + 6 + 2] - softness) * t;
2854
+ mix = frames[
2855
+ i + 1
2856
+ /*MIX*/
2857
+ ];
2858
+ softness = frames[
2859
+ i + 2
2860
+ /*SOFTNESS*/
2861
+ ];
2862
+ let t = (time - before) / (frames[
2863
+ i + 6
2864
+ /*ENTRIES*/
2865
+ ] - before);
2866
+ mix += (frames[
2867
+ i + 6 + 1
2868
+ /*MIX*/
2869
+ ] - mix) * t;
2870
+ softness += (frames[
2871
+ i + 6 + 2
2872
+ /*SOFTNESS*/
2873
+ ] - softness) * t;
2171
2874
  break;
2172
2875
  case 1:
2173
- mix = frames[i + 1];
2174
- softness = frames[i + 2];
2876
+ mix = frames[
2877
+ i + 1
2878
+ /*MIX*/
2879
+ ];
2880
+ softness = frames[
2881
+ i + 2
2882
+ /*SOFTNESS*/
2883
+ ];
2175
2884
  break;
2176
2885
  default:
2177
- mix = this.getBezierValue(time, i, 1, curveType - 2);
2178
- softness = this.getBezierValue(time, i, 2, curveType + 18 - 2);
2179
- }
2180
- if (blend == 0) {
2886
+ mix = this.getBezierValue(
2887
+ time,
2888
+ i,
2889
+ 1,
2890
+ curveType - 2
2891
+ /*BEZIER*/
2892
+ );
2893
+ softness = this.getBezierValue(
2894
+ time,
2895
+ i,
2896
+ 2,
2897
+ curveType + 18 - 2
2898
+ /*BEZIER*/
2899
+ );
2900
+ }
2901
+ if (blend == 0 /* setup */) {
2181
2902
  constraint.mix = constraint.data.mix + (mix - constraint.data.mix) * alpha;
2182
2903
  constraint.softness = constraint.data.softness + (softness - constraint.data.softness) * alpha;
2183
- if (direction == 1) {
2904
+ if (direction == 1 /* mixOut */) {
2184
2905
  constraint.bendDirection = constraint.data.bendDirection;
2185
2906
  constraint.compress = constraint.data.compress;
2186
2907
  constraint.stretch = constraint.data.stretch;
2187
2908
  } else {
2188
- constraint.bendDirection = frames[i + 3];
2189
- constraint.compress = frames[i + 4] != 0;
2190
- constraint.stretch = frames[i + 5] != 0;
2909
+ constraint.bendDirection = frames[
2910
+ i + 3
2911
+ /*BEND_DIRECTION*/
2912
+ ];
2913
+ constraint.compress = frames[
2914
+ i + 4
2915
+ /*COMPRESS*/
2916
+ ] != 0;
2917
+ constraint.stretch = frames[
2918
+ i + 5
2919
+ /*STRETCH*/
2920
+ ] != 0;
2191
2921
  }
2192
2922
  } else {
2193
2923
  constraint.mix += (mix - constraint.mix) * alpha;
2194
2924
  constraint.softness += (softness - constraint.softness) * alpha;
2195
- if (direction == 0) {
2196
- constraint.bendDirection = frames[i + 3];
2197
- constraint.compress = frames[i + 4] != 0;
2198
- constraint.stretch = frames[i + 5] != 0;
2925
+ if (direction == 0 /* mixIn */) {
2926
+ constraint.bendDirection = frames[
2927
+ i + 3
2928
+ /*BEND_DIRECTION*/
2929
+ ];
2930
+ constraint.compress = frames[
2931
+ i + 4
2932
+ /*COMPRESS*/
2933
+ ] != 0;
2934
+ constraint.stretch = frames[
2935
+ i + 5
2936
+ /*STRETCH*/
2937
+ ] != 0;
2199
2938
  }
2200
2939
  }
2201
2940
  }
@@ -2205,22 +2944,42 @@ var spine = (() => {
2205
2944
  super(frameCount, bezierCount, [
2206
2945
  Property.transformConstraint + "|" + transformConstraintIndex
2207
2946
  ]);
2947
+ /** The index of the transform constraint slot in {@link Skeleton#transformConstraints} that will be changed. */
2208
2948
  this.transformConstraintIndex = 0;
2209
2949
  this.transformConstraintIndex = transformConstraintIndex;
2210
2950
  }
2211
2951
  getFrameEntries() {
2212
2952
  return 7;
2213
2953
  }
2954
+ /** The time in seconds, rotate mix, translate mix, scale mix, and shear mix for the specified key frame. */
2214
2955
  setFrame(frame, time, mixRotate, mixX, mixY, mixScaleX, mixScaleY, mixShearY) {
2215
2956
  let frames = this.frames;
2216
2957
  frame *= 7;
2217
2958
  frames[frame] = time;
2218
- frames[frame + 1] = mixRotate;
2219
- frames[frame + 2] = mixX;
2220
- frames[frame + 3] = mixY;
2221
- frames[frame + 4] = mixScaleX;
2222
- frames[frame + 5] = mixScaleY;
2223
- frames[frame + 6] = mixShearY;
2959
+ frames[
2960
+ frame + 1
2961
+ /*ROTATE*/
2962
+ ] = mixRotate;
2963
+ frames[
2964
+ frame + 2
2965
+ /*X*/
2966
+ ] = mixX;
2967
+ frames[
2968
+ frame + 3
2969
+ /*Y*/
2970
+ ] = mixY;
2971
+ frames[
2972
+ frame + 4
2973
+ /*SCALEX*/
2974
+ ] = mixScaleX;
2975
+ frames[
2976
+ frame + 5
2977
+ /*SCALEY*/
2978
+ ] = mixScaleY;
2979
+ frames[
2980
+ frame + 6
2981
+ /*SHEARY*/
2982
+ ] = mixShearY;
2224
2983
  }
2225
2984
  apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
2226
2985
  let constraint = skeleton.transformConstraints[this.transformConstraintIndex];
@@ -2230,7 +2989,7 @@ var spine = (() => {
2230
2989
  if (time < frames[0]) {
2231
2990
  let data = constraint.data;
2232
2991
  switch (blend) {
2233
- case 0:
2992
+ case 0 /* setup */:
2234
2993
  constraint.mixRotate = data.mixRotate;
2235
2994
  constraint.mixX = data.mixX;
2236
2995
  constraint.mixY = data.mixY;
@@ -2238,7 +2997,7 @@ var spine = (() => {
2238
2997
  constraint.mixScaleY = data.mixScaleY;
2239
2998
  constraint.mixShearY = data.mixShearY;
2240
2999
  return;
2241
- case 1:
3000
+ case 1 /* first */:
2242
3001
  constraint.mixRotate += (data.mixRotate - constraint.mixRotate) * alpha;
2243
3002
  constraint.mixX += (data.mixX - constraint.mixX) * alpha;
2244
3003
  constraint.mixY += (data.mixY - constraint.mixY) * alpha;
@@ -2249,42 +3008,143 @@ var spine = (() => {
2249
3008
  return;
2250
3009
  }
2251
3010
  let rotate, x, y, scaleX, scaleY, shearY;
2252
- let i = Timeline.search(frames, time, 7);
2253
- let curveType = this.curves[i / 7];
3011
+ let i = Timeline.search(
3012
+ frames,
3013
+ time,
3014
+ 7
3015
+ /*ENTRIES*/
3016
+ );
3017
+ let curveType = this.curves[
3018
+ i / 7
3019
+ /*ENTRIES*/
3020
+ ];
2254
3021
  switch (curveType) {
2255
3022
  case 0:
2256
3023
  let before = frames[i];
2257
- rotate = frames[i + 1];
2258
- x = frames[i + 2];
2259
- y = frames[i + 3];
2260
- scaleX = frames[i + 4];
2261
- scaleY = frames[i + 5];
2262
- shearY = frames[i + 6];
2263
- let t = (time - before) / (frames[i + 7] - before);
2264
- rotate += (frames[i + 7 + 1] - rotate) * t;
2265
- x += (frames[i + 7 + 2] - x) * t;
2266
- y += (frames[i + 7 + 3] - y) * t;
2267
- scaleX += (frames[i + 7 + 4] - scaleX) * t;
2268
- scaleY += (frames[i + 7 + 5] - scaleY) * t;
2269
- shearY += (frames[i + 7 + 6] - shearY) * t;
3024
+ rotate = frames[
3025
+ i + 1
3026
+ /*ROTATE*/
3027
+ ];
3028
+ x = frames[
3029
+ i + 2
3030
+ /*X*/
3031
+ ];
3032
+ y = frames[
3033
+ i + 3
3034
+ /*Y*/
3035
+ ];
3036
+ scaleX = frames[
3037
+ i + 4
3038
+ /*SCALEX*/
3039
+ ];
3040
+ scaleY = frames[
3041
+ i + 5
3042
+ /*SCALEY*/
3043
+ ];
3044
+ shearY = frames[
3045
+ i + 6
3046
+ /*SHEARY*/
3047
+ ];
3048
+ let t = (time - before) / (frames[
3049
+ i + 7
3050
+ /*ENTRIES*/
3051
+ ] - before);
3052
+ rotate += (frames[
3053
+ i + 7 + 1
3054
+ /*ROTATE*/
3055
+ ] - rotate) * t;
3056
+ x += (frames[
3057
+ i + 7 + 2
3058
+ /*X*/
3059
+ ] - x) * t;
3060
+ y += (frames[
3061
+ i + 7 + 3
3062
+ /*Y*/
3063
+ ] - y) * t;
3064
+ scaleX += (frames[
3065
+ i + 7 + 4
3066
+ /*SCALEX*/
3067
+ ] - scaleX) * t;
3068
+ scaleY += (frames[
3069
+ i + 7 + 5
3070
+ /*SCALEY*/
3071
+ ] - scaleY) * t;
3072
+ shearY += (frames[
3073
+ i + 7 + 6
3074
+ /*SHEARY*/
3075
+ ] - shearY) * t;
2270
3076
  break;
2271
3077
  case 1:
2272
- rotate = frames[i + 1];
2273
- x = frames[i + 2];
2274
- y = frames[i + 3];
2275
- scaleX = frames[i + 4];
2276
- scaleY = frames[i + 5];
2277
- shearY = frames[i + 6];
3078
+ rotate = frames[
3079
+ i + 1
3080
+ /*ROTATE*/
3081
+ ];
3082
+ x = frames[
3083
+ i + 2
3084
+ /*X*/
3085
+ ];
3086
+ y = frames[
3087
+ i + 3
3088
+ /*Y*/
3089
+ ];
3090
+ scaleX = frames[
3091
+ i + 4
3092
+ /*SCALEX*/
3093
+ ];
3094
+ scaleY = frames[
3095
+ i + 5
3096
+ /*SCALEY*/
3097
+ ];
3098
+ shearY = frames[
3099
+ i + 6
3100
+ /*SHEARY*/
3101
+ ];
2278
3102
  break;
2279
3103
  default:
2280
- rotate = this.getBezierValue(time, i, 1, curveType - 2);
2281
- x = this.getBezierValue(time, i, 2, curveType + 18 - 2);
2282
- y = this.getBezierValue(time, i, 3, curveType + 18 * 2 - 2);
2283
- scaleX = this.getBezierValue(time, i, 4, curveType + 18 * 3 - 2);
2284
- scaleY = this.getBezierValue(time, i, 5, curveType + 18 * 4 - 2);
2285
- shearY = this.getBezierValue(time, i, 6, curveType + 18 * 5 - 2);
2286
- }
2287
- if (blend == 0) {
3104
+ rotate = this.getBezierValue(
3105
+ time,
3106
+ i,
3107
+ 1,
3108
+ curveType - 2
3109
+ /*BEZIER*/
3110
+ );
3111
+ x = this.getBezierValue(
3112
+ time,
3113
+ i,
3114
+ 2,
3115
+ curveType + 18 - 2
3116
+ /*BEZIER*/
3117
+ );
3118
+ y = this.getBezierValue(
3119
+ time,
3120
+ i,
3121
+ 3,
3122
+ curveType + 18 * 2 - 2
3123
+ /*BEZIER*/
3124
+ );
3125
+ scaleX = this.getBezierValue(
3126
+ time,
3127
+ i,
3128
+ 4,
3129
+ curveType + 18 * 3 - 2
3130
+ /*BEZIER*/
3131
+ );
3132
+ scaleY = this.getBezierValue(
3133
+ time,
3134
+ i,
3135
+ 5,
3136
+ curveType + 18 * 4 - 2
3137
+ /*BEZIER*/
3138
+ );
3139
+ shearY = this.getBezierValue(
3140
+ time,
3141
+ i,
3142
+ 6,
3143
+ curveType + 18 * 5 - 2
3144
+ /*BEZIER*/
3145
+ );
3146
+ }
3147
+ if (blend == 0 /* setup */) {
2288
3148
  let data = constraint.data;
2289
3149
  constraint.mixRotate = data.mixRotate + (rotate - data.mixRotate) * alpha;
2290
3150
  constraint.mixX = data.mixX + (x - data.mixX) * alpha;
@@ -2305,6 +3165,7 @@ var spine = (() => {
2305
3165
  var PathConstraintPositionTimeline = class extends CurveTimeline1 {
2306
3166
  constructor(frameCount, bezierCount, pathConstraintIndex) {
2307
3167
  super(frameCount, bezierCount, Property.pathConstraintPosition + "|" + pathConstraintIndex);
3168
+ /** The index of the path constraint slot in {@link Skeleton#pathConstraints} that will be changed. */
2308
3169
  this.pathConstraintIndex = 0;
2309
3170
  this.pathConstraintIndex = pathConstraintIndex;
2310
3171
  }
@@ -2315,16 +3176,16 @@ var spine = (() => {
2315
3176
  let frames = this.frames;
2316
3177
  if (time < frames[0]) {
2317
3178
  switch (blend) {
2318
- case 0:
3179
+ case 0 /* setup */:
2319
3180
  constraint.position = constraint.data.position;
2320
3181
  return;
2321
- case 1:
3182
+ case 1 /* first */:
2322
3183
  constraint.position += (constraint.data.position - constraint.position) * alpha;
2323
3184
  }
2324
3185
  return;
2325
3186
  }
2326
3187
  let position = this.getCurveValue(time);
2327
- if (blend == 0)
3188
+ if (blend == 0 /* setup */)
2328
3189
  constraint.position = constraint.data.position + (position - constraint.data.position) * alpha;
2329
3190
  else
2330
3191
  constraint.position += (position - constraint.position) * alpha;
@@ -2333,6 +3194,7 @@ var spine = (() => {
2333
3194
  var PathConstraintSpacingTimeline = class extends CurveTimeline1 {
2334
3195
  constructor(frameCount, bezierCount, pathConstraintIndex) {
2335
3196
  super(frameCount, bezierCount, Property.pathConstraintSpacing + "|" + pathConstraintIndex);
3197
+ /** The index of the path constraint slot in {@link Skeleton#getPathConstraints()} that will be changed. */
2336
3198
  this.pathConstraintIndex = 0;
2337
3199
  this.pathConstraintIndex = pathConstraintIndex;
2338
3200
  }
@@ -2343,16 +3205,16 @@ var spine = (() => {
2343
3205
  let frames = this.frames;
2344
3206
  if (time < frames[0]) {
2345
3207
  switch (blend) {
2346
- case 0:
3208
+ case 0 /* setup */:
2347
3209
  constraint.spacing = constraint.data.spacing;
2348
3210
  return;
2349
- case 1:
3211
+ case 1 /* first */:
2350
3212
  constraint.spacing += (constraint.data.spacing - constraint.spacing) * alpha;
2351
3213
  }
2352
3214
  return;
2353
3215
  }
2354
3216
  let spacing = this.getCurveValue(time);
2355
- if (blend == 0)
3217
+ if (blend == 0 /* setup */)
2356
3218
  constraint.spacing = constraint.data.spacing + (spacing - constraint.data.spacing) * alpha;
2357
3219
  else
2358
3220
  constraint.spacing += (spacing - constraint.spacing) * alpha;
@@ -2363,6 +3225,7 @@ var spine = (() => {
2363
3225
  super(frameCount, bezierCount, [
2364
3226
  Property.pathConstraintMix + "|" + pathConstraintIndex
2365
3227
  ]);
3228
+ /** The index of the path constraint slot in {@link Skeleton#getPathConstraints()} that will be changed. */
2366
3229
  this.pathConstraintIndex = 0;
2367
3230
  this.pathConstraintIndex = pathConstraintIndex;
2368
3231
  }
@@ -2373,9 +3236,18 @@ var spine = (() => {
2373
3236
  let frames = this.frames;
2374
3237
  frame <<= 2;
2375
3238
  frames[frame] = time;
2376
- frames[frame + 1] = mixRotate;
2377
- frames[frame + 2] = mixX;
2378
- frames[frame + 3] = mixY;
3239
+ frames[
3240
+ frame + 1
3241
+ /*ROTATE*/
3242
+ ] = mixRotate;
3243
+ frames[
3244
+ frame + 2
3245
+ /*X*/
3246
+ ] = mixX;
3247
+ frames[
3248
+ frame + 3
3249
+ /*Y*/
3250
+ ] = mixY;
2379
3251
  }
2380
3252
  apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
2381
3253
  let constraint = skeleton.pathConstraints[this.pathConstraintIndex];
@@ -2384,12 +3256,12 @@ var spine = (() => {
2384
3256
  let frames = this.frames;
2385
3257
  if (time < frames[0]) {
2386
3258
  switch (blend) {
2387
- case 0:
3259
+ case 0 /* setup */:
2388
3260
  constraint.mixRotate = constraint.data.mixRotate;
2389
3261
  constraint.mixX = constraint.data.mixX;
2390
3262
  constraint.mixY = constraint.data.mixY;
2391
3263
  return;
2392
- case 1:
3264
+ case 1 /* first */:
2393
3265
  constraint.mixRotate += (constraint.data.mixRotate - constraint.mixRotate) * alpha;
2394
3266
  constraint.mixX += (constraint.data.mixX - constraint.mixX) * alpha;
2395
3267
  constraint.mixY += (constraint.data.mixY - constraint.mixY) * alpha;
@@ -2397,30 +3269,83 @@ var spine = (() => {
2397
3269
  return;
2398
3270
  }
2399
3271
  let rotate, x, y;
2400
- let i = Timeline.search(frames, time, 4);
3272
+ let i = Timeline.search(
3273
+ frames,
3274
+ time,
3275
+ 4
3276
+ /*ENTRIES*/
3277
+ );
2401
3278
  let curveType = this.curves[i >> 2];
2402
3279
  switch (curveType) {
2403
3280
  case 0:
2404
3281
  let before = frames[i];
2405
- rotate = frames[i + 1];
2406
- x = frames[i + 2];
2407
- y = frames[i + 3];
2408
- let t = (time - before) / (frames[i + 4] - before);
2409
- rotate += (frames[i + 4 + 1] - rotate) * t;
2410
- x += (frames[i + 4 + 2] - x) * t;
2411
- y += (frames[i + 4 + 3] - y) * t;
3282
+ rotate = frames[
3283
+ i + 1
3284
+ /*ROTATE*/
3285
+ ];
3286
+ x = frames[
3287
+ i + 2
3288
+ /*X*/
3289
+ ];
3290
+ y = frames[
3291
+ i + 3
3292
+ /*Y*/
3293
+ ];
3294
+ let t = (time - before) / (frames[
3295
+ i + 4
3296
+ /*ENTRIES*/
3297
+ ] - before);
3298
+ rotate += (frames[
3299
+ i + 4 + 1
3300
+ /*ROTATE*/
3301
+ ] - rotate) * t;
3302
+ x += (frames[
3303
+ i + 4 + 2
3304
+ /*X*/
3305
+ ] - x) * t;
3306
+ y += (frames[
3307
+ i + 4 + 3
3308
+ /*Y*/
3309
+ ] - y) * t;
2412
3310
  break;
2413
3311
  case 1:
2414
- rotate = frames[i + 1];
2415
- x = frames[i + 2];
2416
- y = frames[i + 3];
3312
+ rotate = frames[
3313
+ i + 1
3314
+ /*ROTATE*/
3315
+ ];
3316
+ x = frames[
3317
+ i + 2
3318
+ /*X*/
3319
+ ];
3320
+ y = frames[
3321
+ i + 3
3322
+ /*Y*/
3323
+ ];
2417
3324
  break;
2418
3325
  default:
2419
- rotate = this.getBezierValue(time, i, 1, curveType - 2);
2420
- x = this.getBezierValue(time, i, 2, curveType + 18 - 2);
2421
- y = this.getBezierValue(time, i, 3, curveType + 18 * 2 - 2);
2422
- }
2423
- if (blend == 0) {
3326
+ rotate = this.getBezierValue(
3327
+ time,
3328
+ i,
3329
+ 1,
3330
+ curveType - 2
3331
+ /*BEZIER*/
3332
+ );
3333
+ x = this.getBezierValue(
3334
+ time,
3335
+ i,
3336
+ 2,
3337
+ curveType + 18 - 2
3338
+ /*BEZIER*/
3339
+ );
3340
+ y = this.getBezierValue(
3341
+ time,
3342
+ i,
3343
+ 3,
3344
+ curveType + 18 * 2 - 2
3345
+ /*BEZIER*/
3346
+ );
3347
+ }
3348
+ if (blend == 0 /* setup */) {
2424
3349
  let data = constraint.data;
2425
3350
  constraint.mixRotate = data.mixRotate + (rotate - data.mixRotate) * alpha;
2426
3351
  constraint.mixX = data.mixX + (x - data.mixX) * alpha;
@@ -2449,6 +3374,9 @@ var spine = (() => {
2449
3374
  getAttachment() {
2450
3375
  return this.attachment;
2451
3376
  }
3377
+ /** Sets the time, mode, index, and frame time for the specified frame.
3378
+ * @param frame Between 0 and <code>frameCount</code>, inclusive.
3379
+ * @param time Seconds between frames. */
2452
3380
  setFrame(frame, time, mode, index, delay) {
2453
3381
  let frames = this.frames;
2454
3382
  frame *= _SequenceTimeline.ENTRIES;
@@ -2468,7 +3396,7 @@ var spine = (() => {
2468
3396
  }
2469
3397
  let frames = this.frames;
2470
3398
  if (time < frames[0]) {
2471
- if (blend == 0 || blend == 1)
3399
+ if (blend == 0 /* setup */ || blend == 1 /* first */)
2472
3400
  slot.sequenceIndex = -1;
2473
3401
  return;
2474
3402
  }
@@ -2480,29 +3408,29 @@ var spine = (() => {
2480
3408
  return;
2481
3409
  let index = modeAndIndex >> 4, count = this.attachment.sequence.regions.length;
2482
3410
  let mode = SequenceModeValues[modeAndIndex & 15];
2483
- if (mode != SequenceMode.hold) {
3411
+ if (mode != 0 /* hold */) {
2484
3412
  index += (time - before) / delay + 1e-5 | 0;
2485
3413
  switch (mode) {
2486
- case SequenceMode.once:
3414
+ case 1 /* once */:
2487
3415
  index = Math.min(count - 1, index);
2488
3416
  break;
2489
- case SequenceMode.loop:
3417
+ case 2 /* loop */:
2490
3418
  index %= count;
2491
3419
  break;
2492
- case SequenceMode.pingpong: {
3420
+ case 3 /* pingpong */: {
2493
3421
  let n = (count << 1) - 2;
2494
3422
  index = n == 0 ? 0 : index % n;
2495
3423
  if (index >= count)
2496
3424
  index = n - index;
2497
3425
  break;
2498
3426
  }
2499
- case SequenceMode.onceReverse:
3427
+ case 4 /* onceReverse */:
2500
3428
  index = Math.max(count - 1 - index, 0);
2501
3429
  break;
2502
- case SequenceMode.loopReverse:
3430
+ case 5 /* loopReverse */:
2503
3431
  index = count - 1 - index % count;
2504
3432
  break;
2505
- case SequenceMode.pingpongReverse: {
3433
+ case 6 /* pingpongReverse */: {
2506
3434
  let n = (count << 1) - 2;
2507
3435
  index = n == 0 ? 0 : (index + count - 1) % n;
2508
3436
  if (index >= count)
@@ -2521,7 +3449,12 @@ var spine = (() => {
2521
3449
  // spine-core/src/AnimationState.ts
2522
3450
  var _AnimationState = class {
2523
3451
  constructor(data) {
3452
+ /** The list of tracks that currently have animations, which may contain null entries. */
2524
3453
  this.tracks = new Array();
3454
+ /** Multiplier for the delta time when the animation state is updated, causing time for all animations and mixes to play slower
3455
+ * or faster. Defaults to 1.
3456
+ *
3457
+ * See TrackEntry {@link TrackEntry#timeScale} for affecting a single animation. */
2525
3458
  this.timeScale = 1;
2526
3459
  this.unkeyedState = 0;
2527
3460
  this.events = new Array();
@@ -2535,6 +3468,7 @@ var spine = (() => {
2535
3468
  static emptyAnimation() {
2536
3469
  return _AnimationState._emptyAnimation;
2537
3470
  }
3471
+ /** Increments each track entry {@link TrackEntry#trackTime()}, setting queued animations as current if needed. */
2538
3472
  update(delta) {
2539
3473
  delta *= this.timeScale;
2540
3474
  let tracks = this.tracks;
@@ -2586,6 +3520,7 @@ var spine = (() => {
2586
3520
  }
2587
3521
  this.queue.drain();
2588
3522
  }
3523
+ /** Returns true when all mixing from entries are complete. */
2589
3524
  updateMixingFrom(to, delta) {
2590
3525
  let from = to.mixingFrom;
2591
3526
  if (!from)
@@ -2607,6 +3542,9 @@ var spine = (() => {
2607
3542
  to.mixTime += delta;
2608
3543
  return false;
2609
3544
  }
3545
+ /** Poses the skeleton using the track entry animations. There are no side effects other than invoking listeners, so the
3546
+ * animation state can be applied to multiple skeletons to pose them identically.
3547
+ * @returns True if any animations were applied. */
2610
3548
  apply(skeleton) {
2611
3549
  if (!skeleton)
2612
3550
  throw new Error("skeleton cannot be null.");
@@ -2620,7 +3558,7 @@ var spine = (() => {
2620
3558
  if (!current || current.delay > 0)
2621
3559
  continue;
2622
3560
  applied = true;
2623
- let blend = i2 == 0 ? MixBlend.first : current.mixBlend;
3561
+ let blend = i2 == 0 ? 1 /* first */ : current.mixBlend;
2624
3562
  let mix = current.alpha;
2625
3563
  if (current.mixingFrom)
2626
3564
  mix *= this.applyMixingFrom(current, skeleton, blend);
@@ -2634,14 +3572,14 @@ var spine = (() => {
2634
3572
  }
2635
3573
  let timelines = current.animation.timelines;
2636
3574
  let timelineCount = timelines.length;
2637
- if (i2 == 0 && mix == 1 || blend == MixBlend.add) {
3575
+ if (i2 == 0 && mix == 1 || blend == 3 /* add */) {
2638
3576
  for (let ii = 0; ii < timelineCount; ii++) {
2639
3577
  Utils.webkit602BugfixHelper(mix, blend);
2640
3578
  var timeline = timelines[ii];
2641
3579
  if (timeline instanceof AttachmentTimeline)
2642
3580
  this.applyAttachmentTimeline(timeline, skeleton, applyTime, blend, true);
2643
3581
  else
2644
- timeline.apply(skeleton, animationLast, applyTime, applyEvents, mix, blend, MixDirection.mixIn);
3582
+ timeline.apply(skeleton, animationLast, applyTime, applyEvents, mix, blend, 0 /* mixIn */);
2645
3583
  }
2646
3584
  } else {
2647
3585
  let timelineMode = current.timelineMode;
@@ -2651,14 +3589,14 @@ var spine = (() => {
2651
3589
  current.timelinesRotation.length = timelineCount << 1;
2652
3590
  for (let ii = 0; ii < timelineCount; ii++) {
2653
3591
  let timeline2 = timelines[ii];
2654
- let timelineBlend = timelineMode[ii] == SUBSEQUENT ? blend : MixBlend.setup;
3592
+ let timelineBlend = timelineMode[ii] == SUBSEQUENT ? blend : 0 /* setup */;
2655
3593
  if (!shortestRotation && timeline2 instanceof RotateTimeline) {
2656
3594
  this.applyRotateTimeline(timeline2, skeleton, applyTime, mix, timelineBlend, current.timelinesRotation, ii << 1, firstFrame);
2657
3595
  } else if (timeline2 instanceof AttachmentTimeline) {
2658
3596
  this.applyAttachmentTimeline(timeline2, skeleton, applyTime, blend, true);
2659
3597
  } else {
2660
3598
  Utils.webkit602BugfixHelper(mix, blend);
2661
- timeline2.apply(skeleton, animationLast, applyTime, applyEvents, mix, timelineBlend, MixDirection.mixIn);
3599
+ timeline2.apply(skeleton, animationLast, applyTime, applyEvents, mix, timelineBlend, 0 /* mixIn */);
2662
3600
  }
2663
3601
  }
2664
3602
  }
@@ -2687,13 +3625,13 @@ var spine = (() => {
2687
3625
  let mix = 0;
2688
3626
  if (to.mixDuration == 0) {
2689
3627
  mix = 1;
2690
- if (blend == MixBlend.first)
2691
- blend = MixBlend.setup;
3628
+ if (blend == 1 /* first */)
3629
+ blend = 0 /* setup */;
2692
3630
  } else {
2693
3631
  mix = to.mixTime / to.mixDuration;
2694
3632
  if (mix > 1)
2695
3633
  mix = 1;
2696
- if (blend != MixBlend.first)
3634
+ if (blend != 1 /* first */)
2697
3635
  blend = from.mixBlend;
2698
3636
  }
2699
3637
  let attachments = mix < from.attachmentThreshold, drawOrder = mix < from.drawOrderThreshold;
@@ -2706,9 +3644,9 @@ var spine = (() => {
2706
3644
  applyTime = from.animation.duration - applyTime;
2707
3645
  else if (mix < from.eventThreshold)
2708
3646
  events = this.events;
2709
- if (blend == MixBlend.add) {
3647
+ if (blend == 3 /* add */) {
2710
3648
  for (let i = 0; i < timelineCount; i++)
2711
- timelines[i].apply(skeleton, animationLast, applyTime, events, alphaMix, blend, MixDirection.mixOut);
3649
+ timelines[i].apply(skeleton, animationLast, applyTime, events, alphaMix, blend, 1 /* mixOut */);
2712
3650
  } else {
2713
3651
  let timelineMode = from.timelineMode;
2714
3652
  let timelineHoldMix = from.timelineHoldMix;
@@ -2719,7 +3657,7 @@ var spine = (() => {
2719
3657
  from.totalAlpha = 0;
2720
3658
  for (let i = 0; i < timelineCount; i++) {
2721
3659
  let timeline = timelines[i];
2722
- let direction = MixDirection.mixOut;
3660
+ let direction = 1 /* mixOut */;
2723
3661
  let timelineBlend;
2724
3662
  let alpha = 0;
2725
3663
  switch (timelineMode[i]) {
@@ -2730,7 +3668,7 @@ var spine = (() => {
2730
3668
  alpha = alphaMix;
2731
3669
  break;
2732
3670
  case FIRST:
2733
- timelineBlend = MixBlend.setup;
3671
+ timelineBlend = 0 /* setup */;
2734
3672
  alpha = alphaMix;
2735
3673
  break;
2736
3674
  case HOLD_SUBSEQUENT:
@@ -2738,11 +3676,11 @@ var spine = (() => {
2738
3676
  alpha = alphaHold;
2739
3677
  break;
2740
3678
  case HOLD_FIRST:
2741
- timelineBlend = MixBlend.setup;
3679
+ timelineBlend = 0 /* setup */;
2742
3680
  alpha = alphaHold;
2743
3681
  break;
2744
3682
  default:
2745
- timelineBlend = MixBlend.setup;
3683
+ timelineBlend = 0 /* setup */;
2746
3684
  let holdMix = timelineHoldMix[i];
2747
3685
  alpha = alphaHold * Math.max(0, 1 - holdMix.mixTime / holdMix.mixDuration);
2748
3686
  break;
@@ -2754,8 +3692,8 @@ var spine = (() => {
2754
3692
  this.applyAttachmentTimeline(timeline, skeleton, applyTime, timelineBlend, attachments);
2755
3693
  else {
2756
3694
  Utils.webkit602BugfixHelper(alpha, blend);
2757
- if (drawOrder && timeline instanceof DrawOrderTimeline && timelineBlend == MixBlend.setup)
2758
- direction = MixDirection.mixIn;
3695
+ if (drawOrder && timeline instanceof DrawOrderTimeline && timelineBlend == 0 /* setup */)
3696
+ direction = 0 /* mixIn */;
2759
3697
  timeline.apply(skeleton, animationLast, applyTime, events, alpha, timelineBlend, direction);
2760
3698
  }
2761
3699
  }
@@ -2772,7 +3710,7 @@ var spine = (() => {
2772
3710
  if (!slot.bone.active)
2773
3711
  return;
2774
3712
  if (time < timeline.frames[0]) {
2775
- if (blend == MixBlend.setup || blend == MixBlend.first)
3713
+ if (blend == 0 /* setup */ || blend == 1 /* first */)
2776
3714
  this.setAttachment(skeleton, slot, slot.data.attachmentName, attachments);
2777
3715
  } else
2778
3716
  this.setAttachment(skeleton, slot, timeline.attachmentNames[Timeline.search1(timeline.frames, time)], attachments);
@@ -2788,7 +3726,7 @@ var spine = (() => {
2788
3726
  if (firstFrame)
2789
3727
  timelinesRotation[i] = 0;
2790
3728
  if (alpha == 1) {
2791
- timeline.apply(skeleton, 0, time, null, 1, blend, MixDirection.mixIn);
3729
+ timeline.apply(skeleton, 0, time, null, 1, blend, 0 /* mixIn */);
2792
3730
  return;
2793
3731
  }
2794
3732
  let bone = skeleton.bones[timeline.boneIndex];
@@ -2798,16 +3736,16 @@ var spine = (() => {
2798
3736
  let r1 = 0, r2 = 0;
2799
3737
  if (time < frames[0]) {
2800
3738
  switch (blend) {
2801
- case MixBlend.setup:
3739
+ case 0 /* setup */:
2802
3740
  bone.rotation = bone.data.rotation;
2803
3741
  default:
2804
3742
  return;
2805
- case MixBlend.first:
3743
+ case 1 /* first */:
2806
3744
  r1 = bone.rotation;
2807
3745
  r2 = bone.data.rotation;
2808
3746
  }
2809
3747
  } else {
2810
- r1 = blend == MixBlend.setup ? bone.data.rotation : bone.rotation;
3748
+ r1 = blend == 0 /* setup */ ? bone.data.rotation : bone.rotation;
2811
3749
  r2 = bone.data.rotation + timeline.getCurveValue(time);
2812
3750
  }
2813
3751
  let total = 0, diff = r2 - r1;
@@ -2870,6 +3808,10 @@ var spine = (() => {
2870
3808
  this.queue.event(entry, event);
2871
3809
  }
2872
3810
  }
3811
+ /** Removes all animations from all tracks, leaving skeletons in their current pose.
3812
+ *
3813
+ * It may be desired to use {@link AnimationState#setEmptyAnimation()} to mix the skeletons back to the setup pose,
3814
+ * rather than leaving them in their current pose. */
2873
3815
  clearTracks() {
2874
3816
  let oldDrainDisabled = this.queue.drainDisabled;
2875
3817
  this.queue.drainDisabled = true;
@@ -2879,6 +3821,10 @@ var spine = (() => {
2879
3821
  this.queue.drainDisabled = oldDrainDisabled;
2880
3822
  this.queue.drain();
2881
3823
  }
3824
+ /** Removes all animations from the track, leaving skeletons in their current pose.
3825
+ *
3826
+ * It may be desired to use {@link AnimationState#setEmptyAnimation()} to mix the skeletons back to the setup pose,
3827
+ * rather than leaving them in their current pose. */
2882
3828
  clearTrack(trackIndex) {
2883
3829
  if (trackIndex >= this.tracks.length)
2884
3830
  return;
@@ -2916,12 +3862,21 @@ var spine = (() => {
2916
3862
  }
2917
3863
  this.queue.start(current);
2918
3864
  }
3865
+ /** Sets an animation by name.
3866
+ *
3867
+ * See {@link #setAnimationWith()}. */
2919
3868
  setAnimation(trackIndex, animationName, loop = false) {
2920
3869
  let animation = this.data.skeletonData.findAnimation(animationName);
2921
3870
  if (!animation)
2922
3871
  throw new Error("Animation not found: " + animationName);
2923
3872
  return this.setAnimationWith(trackIndex, animation, loop);
2924
3873
  }
3874
+ /** Sets the current animation for a track, discarding any queued animations. If the formerly current track entry was never
3875
+ * applied to a skeleton, it is replaced (not mixed from).
3876
+ * @param loop If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its
3877
+ * duration. In either case {@link TrackEntry#trackEnd} determines when the track is cleared.
3878
+ * @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
3879
+ * after the {@link AnimationStateListener#dispose()} event occurs. */
2925
3880
  setAnimationWith(trackIndex, animation, loop = false) {
2926
3881
  if (!animation)
2927
3882
  throw new Error("animation cannot be null.");
@@ -2943,12 +3898,23 @@ var spine = (() => {
2943
3898
  this.queue.drain();
2944
3899
  return entry;
2945
3900
  }
3901
+ /** Queues an animation by name.
3902
+ *
3903
+ * See {@link #addAnimationWith()}. */
2946
3904
  addAnimation(trackIndex, animationName, loop = false, delay = 0) {
2947
3905
  let animation = this.data.skeletonData.findAnimation(animationName);
2948
3906
  if (!animation)
2949
3907
  throw new Error("Animation not found: " + animationName);
2950
3908
  return this.addAnimationWith(trackIndex, animation, loop, delay);
2951
3909
  }
3910
+ /** Adds an animation to be played after the current or last queued animation for a track. If the track is empty, it is
3911
+ * equivalent to calling {@link #setAnimationWith()}.
3912
+ * @param delay If > 0, sets {@link TrackEntry#delay}. If <= 0, the delay set is the duration of the previous track entry
3913
+ * minus any mix duration (from the {@link AnimationStateData}) plus the specified `delay` (ie the mix
3914
+ * ends at (`delay` = 0) or before (`delay` < 0) the previous track entry duration). If the
3915
+ * previous entry is looping, its next loop completion is used instead of its duration.
3916
+ * @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
3917
+ * after the {@link AnimationStateListener#dispose()} event occurs. */
2952
3918
  addAnimationWith(trackIndex, animation, loop = false, delay = 0) {
2953
3919
  if (!animation)
2954
3920
  throw new Error("animation cannot be null.");
@@ -2970,12 +3936,37 @@ var spine = (() => {
2970
3936
  entry.delay = delay;
2971
3937
  return entry;
2972
3938
  }
3939
+ /** Sets an empty animation for a track, discarding any queued animations, and sets the track entry's
3940
+ * {@link TrackEntry#mixduration}. An empty animation has no timelines and serves as a placeholder for mixing in or out.
3941
+ *
3942
+ * Mixing out is done by setting an empty animation with a mix duration using either {@link #setEmptyAnimation()},
3943
+ * {@link #setEmptyAnimations()}, or {@link #addEmptyAnimation()}. Mixing to an empty animation causes
3944
+ * the previous animation to be applied less and less over the mix duration. Properties keyed in the previous animation
3945
+ * transition to the value from lower tracks or to the setup pose value if no lower tracks key the property. A mix duration of
3946
+ * 0 still mixes out over one frame.
3947
+ *
3948
+ * Mixing in is done by first setting an empty animation, then adding an animation using
3949
+ * {@link #addAnimation()} and on the returned track entry, set the
3950
+ * {@link TrackEntry#setMixDuration()}. Mixing from an empty animation causes the new animation to be applied more and
3951
+ * more over the mix duration. Properties keyed in the new animation transition from the value from lower tracks or from the
3952
+ * setup pose value if no lower tracks key the property to the value keyed in the new animation. */
2973
3953
  setEmptyAnimation(trackIndex, mixDuration = 0) {
2974
3954
  let entry = this.setAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false);
2975
3955
  entry.mixDuration = mixDuration;
2976
3956
  entry.trackEnd = mixDuration;
2977
3957
  return entry;
2978
3958
  }
3959
+ /** Adds an empty animation to be played after the current or last queued animation for a track, and sets the track entry's
3960
+ * {@link TrackEntry#mixDuration}. If the track is empty, it is equivalent to calling
3961
+ * {@link #setEmptyAnimation()}.
3962
+ *
3963
+ * See {@link #setEmptyAnimation()}.
3964
+ * @param delay If > 0, sets {@link TrackEntry#delay}. If <= 0, the delay set is the duration of the previous track entry
3965
+ * minus any mix duration plus the specified `delay` (ie the mix ends at (`delay` = 0) or
3966
+ * before (`delay` < 0) the previous track entry duration). If the previous entry is looping, its next
3967
+ * loop completion is used instead of its duration.
3968
+ * @return A track entry to allow further customization of animation playback. References to the track entry must not be kept
3969
+ * after the {@link AnimationStateListener#dispose()} event occurs. */
2979
3970
  addEmptyAnimation(trackIndex, mixDuration = 0, delay = 0) {
2980
3971
  let entry = this.addAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false, delay);
2981
3972
  if (delay <= 0)
@@ -2984,6 +3975,8 @@ var spine = (() => {
2984
3975
  entry.trackEnd = mixDuration;
2985
3976
  return entry;
2986
3977
  }
3978
+ /** Sets an empty animation for every track, discarding any queued animations, and mixes to it over the specified mix
3979
+ * duration. */
2987
3980
  setEmptyAnimations(mixDuration = 0) {
2988
3981
  let oldDrainDisabled = this.queue.drainDisabled;
2989
3982
  this.queue.drainDisabled = true;
@@ -3002,6 +3995,7 @@ var spine = (() => {
3002
3995
  this.tracks.length = index + 1;
3003
3996
  return null;
3004
3997
  }
3998
+ /** @param last May be null. */
3005
3999
  trackEntry(trackIndex, animation, loop, last) {
3006
4000
  let entry = this.trackEntryPool.obtain();
3007
4001
  entry.reset();
@@ -3029,9 +4023,10 @@ var spine = (() => {
3029
4023
  entry.mixDuration = !last ? 0 : this.data.getMix(last.animation, animation);
3030
4024
  entry.interruptAlpha = 1;
3031
4025
  entry.totalAlpha = 0;
3032
- entry.mixBlend = MixBlend.replace;
4026
+ entry.mixBlend = 2 /* replace */;
3033
4027
  return entry;
3034
4028
  }
4029
+ /** Removes the {@link TrackEntry#getNext() next entry} and all entries after it for the specified entry. */
3035
4030
  clearNext(entry) {
3036
4031
  let next = entry.next;
3037
4032
  while (next) {
@@ -3051,7 +4046,7 @@ var spine = (() => {
3051
4046
  while (entry.mixingFrom)
3052
4047
  entry = entry.mixingFrom;
3053
4048
  do {
3054
- if (!entry.mixingTo || entry.mixBlend != MixBlend.add)
4049
+ if (!entry.mixingTo || entry.mixBlend != 3 /* add */)
3055
4050
  this.computeHold(entry);
3056
4051
  entry = entry.mixingTo;
3057
4052
  } while (entry);
@@ -3094,24 +4089,31 @@ var spine = (() => {
3094
4089
  }
3095
4090
  }
3096
4091
  }
4092
+ /** Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing. */
3097
4093
  getCurrent(trackIndex) {
3098
4094
  if (trackIndex >= this.tracks.length)
3099
4095
  return null;
3100
4096
  return this.tracks[trackIndex];
3101
4097
  }
4098
+ /** Adds a listener to receive events for all track entries. */
3102
4099
  addListener(listener) {
3103
4100
  if (!listener)
3104
4101
  throw new Error("listener cannot be null.");
3105
4102
  this.listeners.push(listener);
3106
4103
  }
4104
+ /** Removes the listener added with {@link #addListener()}. */
3107
4105
  removeListener(listener) {
3108
4106
  let index = this.listeners.indexOf(listener);
3109
4107
  if (index >= 0)
3110
4108
  this.listeners.splice(index, 1);
3111
4109
  }
4110
+ /** Removes all listeners added with {@link #addListener()}. */
3112
4111
  clearListeners() {
3113
4112
  this.listeners.length = 0;
3114
4113
  }
4114
+ /** Discards all listener notifications that have not yet been delivered. This can be useful to call from an
4115
+ * {@link AnimationStateListener} when it is known that further notifications that may have been already queued for delivery
4116
+ * are not wanted because new animations are being set. */
3115
4117
  clearListenerNotifications() {
3116
4118
  this.queue.clear();
3117
4119
  }
@@ -3120,36 +4122,134 @@ var spine = (() => {
3120
4122
  AnimationState._emptyAnimation = new Animation("<empty>", [], 0);
3121
4123
  var TrackEntry = class {
3122
4124
  constructor() {
4125
+ /** The animation to apply for this track entry. */
3123
4126
  this.animation = null;
3124
4127
  this.previous = null;
4128
+ /** The animation queued to start after this animation, or null. `next` makes up a linked list. */
3125
4129
  this.next = null;
4130
+ /** The track entry for the previous animation when mixing from the previous animation to this animation, or null if no
4131
+ * mixing is currently occuring. When mixing from multiple animations, `mixingFrom` makes up a linked list. */
3126
4132
  this.mixingFrom = null;
4133
+ /** The track entry for the next animation when mixing from this animation to the next animation, or null if no mixing is
4134
+ * currently occuring. When mixing to multiple animations, `mixingTo` makes up a linked list. */
3127
4135
  this.mixingTo = null;
4136
+ /** The listener for events generated by this track entry, or null.
4137
+ *
4138
+ * A track entry returned from {@link AnimationState#setAnimation()} is already the current animation
4139
+ * for the track, so the track entry listener {@link AnimationStateListener#start()} will not be called. */
3128
4140
  this.listener = null;
4141
+ /** The index of the track where this track entry is either current or queued.
4142
+ *
4143
+ * See {@link AnimationState#getCurrent()}. */
3129
4144
  this.trackIndex = 0;
4145
+ /** If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its
4146
+ * duration. */
3130
4147
  this.loop = false;
4148
+ /** If true, when mixing from the previous animation to this animation, the previous animation is applied as normal instead
4149
+ * of being mixed out.
4150
+ *
4151
+ * When mixing between animations that key the same property, if a lower track also keys that property then the value will
4152
+ * briefly dip toward the lower track value during the mix. This happens because the first animation mixes from 100% to 0%
4153
+ * while the second animation mixes from 0% to 100%. Setting `holdPrevious` to true applies the first animation
4154
+ * at 100% during the mix so the lower track value is overwritten. Such dipping does not occur on the lowest track which
4155
+ * keys the property, only when a higher track also keys the property.
4156
+ *
4157
+ * Snapping will occur if `holdPrevious` is true and this animation does not key all the same properties as the
4158
+ * previous animation. */
3131
4159
  this.holdPrevious = false;
3132
4160
  this.reverse = false;
3133
4161
  this.shortestRotation = false;
4162
+ /** When the mix percentage ({@link #mixTime} / {@link #mixDuration}) is less than the
4163
+ * `eventThreshold`, event timelines are applied while this animation is being mixed out. Defaults to 0, so event
4164
+ * timelines are not applied while this animation is being mixed out. */
3134
4165
  this.eventThreshold = 0;
4166
+ /** When the mix percentage ({@link #mixtime} / {@link #mixDuration}) is less than the
4167
+ * `attachmentThreshold`, attachment timelines are applied while this animation is being mixed out. Defaults to
4168
+ * 0, so attachment timelines are not applied while this animation is being mixed out. */
3135
4169
  this.attachmentThreshold = 0;
4170
+ /** When the mix percentage ({@link #mixTime} / {@link #mixDuration}) is less than the
4171
+ * `drawOrderThreshold`, draw order timelines are applied while this animation is being mixed out. Defaults to 0,
4172
+ * so draw order timelines are not applied while this animation is being mixed out. */
3136
4173
  this.drawOrderThreshold = 0;
4174
+ /** Seconds when this animation starts, both initially and after looping. Defaults to 0.
4175
+ *
4176
+ * When changing the `animationStart` time, it often makes sense to set {@link #animationLast} to the same
4177
+ * value to prevent timeline keys before the start time from triggering. */
3137
4178
  this.animationStart = 0;
4179
+ /** Seconds for the last frame of this animation. Non-looping animations won't play past this time. Looping animations will
4180
+ * loop back to {@link #animationStart} at this time. Defaults to the animation {@link Animation#duration}. */
3138
4181
  this.animationEnd = 0;
4182
+ /** The time in seconds this animation was last applied. Some timelines use this for one-time triggers. Eg, when this
4183
+ * animation is applied, event timelines will fire all events between the `animationLast` time (exclusive) and
4184
+ * `animationTime` (inclusive). Defaults to -1 to ensure triggers on frame 0 happen the first time this animation
4185
+ * is applied. */
3139
4186
  this.animationLast = 0;
3140
4187
  this.nextAnimationLast = 0;
4188
+ /** Seconds to postpone playing the animation. When this track entry is the current track entry, `delay`
4189
+ * postpones incrementing the {@link #trackTime}. When this track entry is queued, `delay` is the time from
4190
+ * the start of the previous animation to when this track entry will become the current track entry (ie when the previous
4191
+ * track entry {@link TrackEntry#trackTime} >= this track entry's `delay`).
4192
+ *
4193
+ * {@link #timeScale} affects the delay. */
3141
4194
  this.delay = 0;
4195
+ /** Current time in seconds this track entry has been the current track entry. The track time determines
4196
+ * {@link #animationTime}. The track time can be set to start the animation at a time other than 0, without affecting
4197
+ * looping. */
3142
4198
  this.trackTime = 0;
3143
4199
  this.trackLast = 0;
3144
4200
  this.nextTrackLast = 0;
4201
+ /** The track time in seconds when this animation will be removed from the track. Defaults to the highest possible float
4202
+ * value, meaning the animation will be applied until a new animation is set or the track is cleared. If the track end time
4203
+ * is reached, no other animations are queued for playback, and mixing from any previous animations is complete, then the
4204
+ * properties keyed by the animation are set to the setup pose and the track is cleared.
4205
+ *
4206
+ * It may be desired to use {@link AnimationState#addEmptyAnimation()} rather than have the animation
4207
+ * abruptly cease being applied. */
3145
4208
  this.trackEnd = 0;
4209
+ /** Multiplier for the delta time when this track entry is updated, causing time for this animation to pass slower or
4210
+ * faster. Defaults to 1.
4211
+ *
4212
+ * {@link #mixTime} is not affected by track entry time scale, so {@link #mixDuration} may need to be adjusted to
4213
+ * match the animation speed.
4214
+ *
4215
+ * When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the
4216
+ * {@link #delay} is set using the mix duration from the {@link AnimationStateData}, assuming time scale to be 1. If
4217
+ * the time scale is not 1, the delay may need to be adjusted.
4218
+ *
4219
+ * See AnimationState {@link AnimationState#timeScale} for affecting all animations. */
3146
4220
  this.timeScale = 0;
4221
+ /** Values < 1 mix this animation with the skeleton's current pose (usually the pose resulting from lower tracks). Defaults
4222
+ * to 1, which overwrites the skeleton's current pose with this animation.
4223
+ *
4224
+ * Typically track 0 is used to completely pose the skeleton, then alpha is used on higher tracks. It doesn't make sense to
4225
+ * use alpha on track 0 if the skeleton pose is from the last frame render. */
3147
4226
  this.alpha = 0;
4227
+ /** Seconds from 0 to the {@link #getMixDuration()} when mixing from the previous animation to this animation. May be
4228
+ * slightly more than `mixDuration` when the mix is complete. */
3148
4229
  this.mixTime = 0;
4230
+ /** Seconds for mixing from the previous animation to this animation. Defaults to the value provided by AnimationStateData
4231
+ * {@link AnimationStateData#getMix()} based on the animation before this animation (if any).
4232
+ *
4233
+ * A mix duration of 0 still mixes out over one frame to provide the track entry being mixed out a chance to revert the
4234
+ * properties it was animating.
4235
+ *
4236
+ * The `mixDuration` can be set manually rather than use the value from
4237
+ * {@link AnimationStateData#getMix()}. In that case, the `mixDuration` can be set for a new
4238
+ * track entry only before {@link AnimationState#update(float)} is first called.
4239
+ *
4240
+ * When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the
4241
+ * {@link #delay} is set using the mix duration from the {@link AnimationStateData}, not a mix duration set
4242
+ * afterward. */
3149
4243
  this.mixDuration = 0;
3150
4244
  this.interruptAlpha = 0;
3151
4245
  this.totalAlpha = 0;
3152
- this.mixBlend = MixBlend.replace;
4246
+ /** Controls how properties keyed in the animation are mixed with lower tracks. Defaults to {@link MixBlend#replace}, which
4247
+ * replaces the values from the lower tracks with the animation values. {@link MixBlend#add} adds the animation values to
4248
+ * the values from the lower tracks.
4249
+ *
4250
+ * The `mixBlend` can be set for a new track entry only before {@link AnimationState#apply()} is first
4251
+ * called. */
4252
+ this.mixBlend = 2 /* replace */;
3153
4253
  this.timelineMode = new Array();
3154
4254
  this.timelineHoldMix = new Array();
3155
4255
  this.timelinesRotation = new Array();
@@ -3165,6 +4265,9 @@ var spine = (() => {
3165
4265
  this.timelineHoldMix.length = 0;
3166
4266
  this.timelinesRotation.length = 0;
3167
4267
  }
4268
+ /** Uses {@link #trackTime} to compute the `animationTime`, which is between {@link #animationStart}
4269
+ * and {@link #animationEnd}. When the `trackTime` is 0, the `animationTime` is equal to the
4270
+ * `animationStart` time. */
3168
4271
  getAnimationTime() {
3169
4272
  if (this.loop) {
3170
4273
  let duration = this.animationEnd - this.animationStart;
@@ -3178,9 +4281,19 @@ var spine = (() => {
3178
4281
  this.animationLast = animationLast;
3179
4282
  this.nextAnimationLast = animationLast;
3180
4283
  }
4284
+ /** Returns true if at least one loop has been completed.
4285
+ *
4286
+ * See {@link AnimationStateListener#complete()}. */
3181
4287
  isComplete() {
3182
4288
  return this.trackTime >= this.animationEnd - this.animationStart;
3183
4289
  }
4290
+ /** Resets the rotation directions for mixing this entry's rotate timelines. This can be useful to avoid bones rotating the
4291
+ * long way around when using {@link #alpha} and starting animations on other tracks.
4292
+ *
4293
+ * Mixing with {@link MixBlend#replace} involves finding a rotation between two others, which has two possible solutions:
4294
+ * the short way or the long way around. The two rotations likely change over time, so which direction is the short or long
4295
+ * way also changes. If the short way was always chosen, bones would flip to the other side when that direction became the
4296
+ * long way. TrackEntry chooses the short way the first time it is applied and remembers that direction. */
3184
4297
  resetRotationDirections() {
3185
4298
  this.timelinesRotation.length = 0;
3186
4299
  }
@@ -3302,15 +4415,15 @@ var spine = (() => {
3302
4415
  this.objects.length = 0;
3303
4416
  }
3304
4417
  };
3305
- var EventType;
3306
- (function(EventType2) {
4418
+ var EventType = /* @__PURE__ */ ((EventType2) => {
3307
4419
  EventType2[EventType2["start"] = 0] = "start";
3308
4420
  EventType2[EventType2["interrupt"] = 1] = "interrupt";
3309
4421
  EventType2[EventType2["end"] = 2] = "end";
3310
4422
  EventType2[EventType2["dispose"] = 3] = "dispose";
3311
4423
  EventType2[EventType2["complete"] = 4] = "complete";
3312
4424
  EventType2[EventType2["event"] = 5] = "event";
3313
- })(EventType || (EventType = {}));
4425
+ return EventType2;
4426
+ })(EventType || {});
3314
4427
  var AnimationStateAdapter = class {
3315
4428
  start(entry) {
3316
4429
  }
@@ -3337,11 +4450,15 @@ var spine = (() => {
3337
4450
  var AnimationStateData = class {
3338
4451
  constructor(skeletonData) {
3339
4452
  this.animationToMixTime = {};
4453
+ /** The mix duration to use when no mix duration has been defined between two animations. */
3340
4454
  this.defaultMix = 0;
3341
4455
  if (!skeletonData)
3342
4456
  throw new Error("skeletonData cannot be null.");
3343
4457
  this.skeletonData = skeletonData;
3344
4458
  }
4459
+ /** Sets a mix duration by animation name.
4460
+ *
4461
+ * See {@link #setMixWith()}. */
3345
4462
  setMix(fromName, toName, duration) {
3346
4463
  let from = this.skeletonData.findAnimation(fromName);
3347
4464
  if (!from)
@@ -3351,6 +4468,9 @@ var spine = (() => {
3351
4468
  throw new Error("Animation not found: " + toName);
3352
4469
  this.setMixWith(from, to, duration);
3353
4470
  }
4471
+ /** Sets the mix duration when changing from the specified animation to the other.
4472
+ *
4473
+ * See {@link TrackEntry#mixDuration}. */
3354
4474
  setMixWith(from, to, duration) {
3355
4475
  if (!from)
3356
4476
  throw new Error("from cannot be null.");
@@ -3359,6 +4479,8 @@ var spine = (() => {
3359
4479
  let key = from.name + "." + to.name;
3360
4480
  this.animationToMixTime[key] = duration;
3361
4481
  }
4482
+ /** Returns the mix duration to use when changing from the specified animation to the other, or the {@link #defaultMix} if
4483
+ * no mix duration has been set. */
3362
4484
  getMix(from, to) {
3363
4485
  let key = from.name + "." + to.name;
3364
4486
  let value = this.animationToMixTime[key];
@@ -3382,9 +4504,15 @@ var spine = (() => {
3382
4504
 
3383
4505
  // spine-core/src/attachments/ClippingAttachment.ts
3384
4506
  var ClippingAttachment = class extends VertexAttachment {
4507
+ // ce3a3aff
3385
4508
  constructor(name) {
3386
4509
  super(name);
4510
+ /** Clipping is performed between the clipping polygon's slot and the end slot. Returns null if clipping is done until the end of
4511
+ * the skeleton's rendering. */
3387
4512
  this.endSlot = null;
4513
+ // Nonessential.
4514
+ /** The color of the clipping polygon as it was in Spine. Available only when nonessential data was exported. Clipping polygons
4515
+ * are not usually rendered at runtime. */
3388
4516
  this.color = new Color(0.2275, 0.2275, 0.8078, 1);
3389
4517
  }
3390
4518
  copy() {
@@ -3405,8 +4533,7 @@ var spine = (() => {
3405
4533
  return this._image;
3406
4534
  }
3407
4535
  };
3408
- var TextureFilter;
3409
- (function(TextureFilter3) {
4536
+ var TextureFilter = /* @__PURE__ */ ((TextureFilter3) => {
3410
4537
  TextureFilter3[TextureFilter3["Nearest"] = 9728] = "Nearest";
3411
4538
  TextureFilter3[TextureFilter3["Linear"] = 9729] = "Linear";
3412
4539
  TextureFilter3[TextureFilter3["MipMap"] = 9987] = "MipMap";
@@ -3414,13 +4541,14 @@ var spine = (() => {
3414
4541
  TextureFilter3[TextureFilter3["MipMapLinearNearest"] = 9985] = "MipMapLinearNearest";
3415
4542
  TextureFilter3[TextureFilter3["MipMapNearestLinear"] = 9986] = "MipMapNearestLinear";
3416
4543
  TextureFilter3[TextureFilter3["MipMapLinearLinear"] = 9987] = "MipMapLinearLinear";
3417
- })(TextureFilter || (TextureFilter = {}));
3418
- var TextureWrap;
3419
- (function(TextureWrap3) {
4544
+ return TextureFilter3;
4545
+ })(TextureFilter || {});
4546
+ var TextureWrap = /* @__PURE__ */ ((TextureWrap3) => {
3420
4547
  TextureWrap3[TextureWrap3["MirroredRepeat"] = 33648] = "MirroredRepeat";
3421
4548
  TextureWrap3[TextureWrap3["ClampToEdge"] = 33071] = "ClampToEdge";
3422
4549
  TextureWrap3[TextureWrap3["Repeat"] = 10497] = "Repeat";
3423
- })(TextureWrap || (TextureWrap = {}));
4550
+ return TextureWrap3;
4551
+ })(TextureWrap || {});
3424
4552
  var TextureRegion = class {
3425
4553
  constructor() {
3426
4554
  this.u = 0;
@@ -3465,9 +4593,9 @@ var spine = (() => {
3465
4593
  };
3466
4594
  pageFields["repeat"] = (page2) => {
3467
4595
  if (entry[1].indexOf("x") != -1)
3468
- page2.uWrap = TextureWrap.Repeat;
4596
+ page2.uWrap = 10497 /* Repeat */;
3469
4597
  if (entry[1].indexOf("y") != -1)
3470
- page2.vWrap = TextureWrap.Repeat;
4598
+ page2.vWrap = 10497 /* Repeat */;
3471
4599
  };
3472
4600
  pageFields["pma"] = (page2) => {
3473
4601
  page2.pma = entry[1] == "true";
@@ -3638,10 +4766,10 @@ var spine = (() => {
3638
4766
  };
3639
4767
  var TextureAtlasPage = class {
3640
4768
  constructor(name) {
3641
- this.minFilter = TextureFilter.Nearest;
3642
- this.magFilter = TextureFilter.Nearest;
3643
- this.uWrap = TextureWrap.ClampToEdge;
3644
- this.vWrap = TextureWrap.ClampToEdge;
4769
+ this.minFilter = 9728 /* Nearest */;
4770
+ this.magFilter = 9728 /* Nearest */;
4771
+ this.uWrap = 33071 /* ClampToEdge */;
4772
+ this.vWrap = 33071 /* ClampToEdge */;
3645
4773
  this.texture = null;
3646
4774
  this.width = 0;
3647
4775
  this.height = 0;
@@ -3677,19 +4805,32 @@ var spine = (() => {
3677
4805
  constructor(name, path) {
3678
4806
  super(name);
3679
4807
  this.region = null;
4808
+ /** The UV pair for each vertex, normalized within the texture region. */
3680
4809
  this.regionUVs = [];
4810
+ /** The UV pair for each vertex, normalized within the entire texture.
4811
+ *
4812
+ * See {@link #updateUVs}. */
3681
4813
  this.uvs = [];
4814
+ /** Triplets of vertex indices which describe the mesh's triangulation. */
3682
4815
  this.triangles = [];
4816
+ /** The color to tint the mesh. */
3683
4817
  this.color = new Color(1, 1, 1, 1);
4818
+ /** The width of the mesh's image. Available only when nonessential data was exported. */
3684
4819
  this.width = 0;
4820
+ /** The height of the mesh's image. Available only when nonessential data was exported. */
3685
4821
  this.height = 0;
4822
+ /** The number of entries at the beginning of {@link #vertices} that make up the mesh hull. */
3686
4823
  this.hullLength = 0;
4824
+ /** Vertex index pairs describing edges for controling triangulation. Mesh triangles will never cross edges. Only available if
4825
+ * nonessential data was exported. Triangulation is not performed at runtime. */
3687
4826
  this.edges = [];
3688
4827
  this.parentMesh = null;
3689
4828
  this.sequence = null;
3690
4829
  this.tempColor = new Color(0, 0, 0, 0);
3691
4830
  this.path = path;
3692
4831
  }
4832
+ /** Calculates {@link #uvs} using the {@link #regionUVs} and region. Must be called if the region, the region's properties, or
4833
+ * the {@link #regionUVs} are changed. */
3693
4834
  updateRegion() {
3694
4835
  if (!this.region)
3695
4836
  throw new Error("Region not set.");
@@ -3750,9 +4891,13 @@ var spine = (() => {
3750
4891
  uvs[i + 1] = v + regionUVs[i + 1] * height;
3751
4892
  }
3752
4893
  }
4894
+ /** The parent mesh if this is a linked mesh, else null. A linked mesh shares the {@link #bones}, {@link #vertices},
4895
+ * {@link #regionUVs}, {@link #triangles}, {@link #hullLength}, {@link #edges}, {@link #width}, and {@link #height} with the
4896
+ * parent mesh, but may have a different {@link #name} or {@link #path} (and therefore a different texture). */
3753
4897
  getParentMesh() {
3754
4898
  return this.parentMesh;
3755
4899
  }
4900
+ /** @param parentMesh May be null. */
3756
4901
  setParentMesh(parentMesh) {
3757
4902
  this.parentMesh = parentMesh;
3758
4903
  if (parentMesh) {
@@ -3793,6 +4938,7 @@ var spine = (() => {
3793
4938
  this.sequence.apply(slot, this);
3794
4939
  super.computeWorldVertices(slot, start, count, worldVertices2, offset, stride);
3795
4940
  }
4941
+ /** Returns a new mesh with the {@link #parentMesh} set to this mesh's parent mesh, if any, else to this mesh. **/
3796
4942
  newLinkedMesh() {
3797
4943
  let copy = new MeshAttachment(this.name, this.path);
3798
4944
  copy.region = this.region;
@@ -3809,9 +4955,15 @@ var spine = (() => {
3809
4955
  var PathAttachment = class extends VertexAttachment {
3810
4956
  constructor(name) {
3811
4957
  super(name);
4958
+ /** The lengths along the path in the setup pose from the start of the path to the end of each Bezier curve. */
3812
4959
  this.lengths = [];
4960
+ /** If true, the start and end knots are connected. */
3813
4961
  this.closed = false;
4962
+ /** If true, additional calculations are performed to make calculating positions along the path more accurate. If false, fewer
4963
+ * calculations are performed but calculating positions along the path is less accurate. */
3814
4964
  this.constantSpeed = false;
4965
+ /** The color of the path as it was in Spine. Available only when nonessential data was exported. Paths are not usually
4966
+ * rendered at runtime. */
3815
4967
  this.color = new Color(1, 1, 1, 1);
3816
4968
  }
3817
4969
  copy() {
@@ -3833,6 +4985,8 @@ var spine = (() => {
3833
4985
  this.x = 0;
3834
4986
  this.y = 0;
3835
4987
  this.rotation = 0;
4988
+ /** The color of the point attachment as it was in Spine. Available only when nonessential data was exported. Point attachments
4989
+ * are not usually rendered at runtime. */
3836
4990
  this.color = new Color(0.38, 0.94, 0, 1);
3837
4991
  }
3838
4992
  computeWorldPosition(bone, point) {
@@ -3860,22 +5014,34 @@ var spine = (() => {
3860
5014
  var _RegionAttachment = class extends Attachment {
3861
5015
  constructor(name, path) {
3862
5016
  super(name);
5017
+ /** The local x translation. */
3863
5018
  this.x = 0;
5019
+ /** The local y translation. */
3864
5020
  this.y = 0;
5021
+ /** The local scaleX. */
3865
5022
  this.scaleX = 1;
5023
+ /** The local scaleY. */
3866
5024
  this.scaleY = 1;
5025
+ /** The local rotation. */
3867
5026
  this.rotation = 0;
5027
+ /** The width of the region attachment in Spine. */
3868
5028
  this.width = 0;
5029
+ /** The height of the region attachment in Spine. */
3869
5030
  this.height = 0;
5031
+ /** The color to tint the region attachment. */
3870
5032
  this.color = new Color(1, 1, 1, 1);
3871
5033
  this.rendererObject = null;
3872
5034
  this.region = null;
3873
5035
  this.sequence = null;
5036
+ /** For each of the 4 vertices, a pair of <code>x,y</code> values that is the local position of the vertex.
5037
+ *
5038
+ * See {@link #updateOffset()}. */
3874
5039
  this.offset = Utils.newFloatArray(8);
3875
5040
  this.uvs = Utils.newFloatArray(8);
3876
5041
  this.tempColor = new Color(1, 1, 1, 1);
3877
5042
  this.path = path;
3878
5043
  }
5044
+ /** Calculates the {@link #offset} using the region settings. Must be called after changing region settings. */
3879
5045
  updateRegion() {
3880
5046
  if (!this.region)
3881
5047
  throw new Error("Region not set.");
@@ -3939,6 +5105,14 @@ var spine = (() => {
3939
5105
  uvs[7] = region.v2;
3940
5106
  }
3941
5107
  }
5108
+ /** Transforms the attachment's four vertices to world coordinates. If the attachment has a {@link #sequence}, the region may
5109
+ * be changed.
5110
+ * <p>
5111
+ * See <a href="http://esotericsoftware.com/spine-runtime-skeletons#World-transforms">World transforms</a> in the Spine
5112
+ * Runtimes Guide.
5113
+ * @param worldVertices The output world vertices. Must have a length >= <code>offset</code> + 8.
5114
+ * @param offset The <code>worldVertices</code> index to begin writing values.
5115
+ * @param stride The number of <code>worldVertices</code> entries between the value pairs written. */
3942
5116
  computeWorldVertices(slot, worldVertices2, offset, stride) {
3943
5117
  if (this.sequence != null)
3944
5118
  this.sequence.apply(slot, this);
@@ -4078,18 +5252,34 @@ var spine = (() => {
4078
5252
  // spine-core/src/BoneData.ts
4079
5253
  var BoneData = class {
4080
5254
  constructor(index, name, parent) {
5255
+ /** The index of the bone in {@link Skeleton#getBones()}. */
4081
5256
  this.index = 0;
5257
+ /** @returns May be null. */
4082
5258
  this.parent = null;
5259
+ /** The bone's length. */
4083
5260
  this.length = 0;
5261
+ /** The local x translation. */
4084
5262
  this.x = 0;
5263
+ /** The local y translation. */
4085
5264
  this.y = 0;
5265
+ /** The local rotation. */
4086
5266
  this.rotation = 0;
5267
+ /** The local scaleX. */
4087
5268
  this.scaleX = 1;
5269
+ /** The local scaleY. */
4088
5270
  this.scaleY = 1;
5271
+ /** The local shearX. */
4089
5272
  this.shearX = 0;
5273
+ /** The local shearX. */
4090
5274
  this.shearY = 0;
5275
+ /** The transform mode for how parent world transforms affect this bone. */
4091
5276
  this.transformMode = TransformMode.Normal;
5277
+ /** When true, {@link Skeleton#updateWorldTransform()} only updates this bone if the {@link Skeleton#skin} contains this
5278
+ * bone.
5279
+ * @see Skin#bones */
4092
5280
  this.skinRequired = false;
5281
+ /** The color of the bone as it was in Spine. Available only when nonessential data was exported. Bones are not usually
5282
+ * rendered at runtime. */
4093
5283
  this.color = new Color();
4094
5284
  if (index < 0)
4095
5285
  throw new Error("index must be >= 0.");
@@ -4100,39 +5290,62 @@ var spine = (() => {
4100
5290
  this.parent = parent;
4101
5291
  }
4102
5292
  };
4103
- var TransformMode;
4104
- (function(TransformMode2) {
5293
+ var TransformMode = /* @__PURE__ */ ((TransformMode2) => {
4105
5294
  TransformMode2[TransformMode2["Normal"] = 0] = "Normal";
4106
5295
  TransformMode2[TransformMode2["OnlyTranslation"] = 1] = "OnlyTranslation";
4107
5296
  TransformMode2[TransformMode2["NoRotationOrReflection"] = 2] = "NoRotationOrReflection";
4108
5297
  TransformMode2[TransformMode2["NoScale"] = 3] = "NoScale";
4109
5298
  TransformMode2[TransformMode2["NoScaleOrReflection"] = 4] = "NoScaleOrReflection";
4110
- })(TransformMode || (TransformMode = {}));
5299
+ return TransformMode2;
5300
+ })(TransformMode || {});
4111
5301
 
4112
5302
  // spine-core/src/Bone.ts
4113
5303
  var Bone = class {
5304
+ /** @param parent May be null. */
4114
5305
  constructor(data, skeleton, parent) {
5306
+ /** The parent bone, or null if this is the root bone. */
4115
5307
  this.parent = null;
5308
+ /** The immediate children of this bone. */
4116
5309
  this.children = new Array();
5310
+ /** The local x translation. */
4117
5311
  this.x = 0;
5312
+ /** The local y translation. */
4118
5313
  this.y = 0;
5314
+ /** The local rotation in degrees, counter clockwise. */
4119
5315
  this.rotation = 0;
5316
+ /** The local scaleX. */
4120
5317
  this.scaleX = 0;
5318
+ /** The local scaleY. */
4121
5319
  this.scaleY = 0;
5320
+ /** The local shearX. */
4122
5321
  this.shearX = 0;
5322
+ /** The local shearY. */
4123
5323
  this.shearY = 0;
5324
+ /** The applied local x translation. */
4124
5325
  this.ax = 0;
5326
+ /** The applied local y translation. */
4125
5327
  this.ay = 0;
5328
+ /** The applied local rotation in degrees, counter clockwise. */
4126
5329
  this.arotation = 0;
5330
+ /** The applied local scaleX. */
4127
5331
  this.ascaleX = 0;
5332
+ /** The applied local scaleY. */
4128
5333
  this.ascaleY = 0;
5334
+ /** The applied local shearX. */
4129
5335
  this.ashearX = 0;
5336
+ /** The applied local shearY. */
4130
5337
  this.ashearY = 0;
5338
+ /** Part of the world transform matrix for the X axis. If changed, {@link #updateAppliedTransform()} should be called. */
4131
5339
  this.a = 0;
5340
+ /** Part of the world transform matrix for the Y axis. If changed, {@link #updateAppliedTransform()} should be called. */
4132
5341
  this.b = 0;
5342
+ /** Part of the world transform matrix for the X axis. If changed, {@link #updateAppliedTransform()} should be called. */
4133
5343
  this.c = 0;
5344
+ /** Part of the world transform matrix for the Y axis. If changed, {@link #updateAppliedTransform()} should be called. */
4134
5345
  this.d = 0;
5346
+ /** The world X position. If changed, {@link #updateAppliedTransform()} should be called. */
4135
5347
  this.worldY = 0;
5348
+ /** The world Y position. If changed, {@link #updateAppliedTransform()} should be called. */
4136
5349
  this.worldX = 0;
4137
5350
  this.sorted = false;
4138
5351
  this.active = false;
@@ -4145,15 +5358,26 @@ var spine = (() => {
4145
5358
  this.parent = parent;
4146
5359
  this.setToSetupPose();
4147
5360
  }
5361
+ /** Returns false when the bone has not been computed because {@link BoneData#skinRequired} is true and the
5362
+ * {@link Skeleton#skin active skin} does not {@link Skin#bones contain} this bone. */
4148
5363
  isActive() {
4149
5364
  return this.active;
4150
5365
  }
5366
+ /** Computes the world transform using the parent bone and this bone's local applied transform. */
4151
5367
  update() {
4152
5368
  this.updateWorldTransformWith(this.ax, this.ay, this.arotation, this.ascaleX, this.ascaleY, this.ashearX, this.ashearY);
4153
5369
  }
5370
+ /** Computes the world transform using the parent bone and this bone's local transform.
5371
+ *
5372
+ * See {@link #updateWorldTransformWith()}. */
4154
5373
  updateWorldTransform() {
4155
5374
  this.updateWorldTransformWith(this.x, this.y, this.rotation, this.scaleX, this.scaleY, this.shearX, this.shearY);
4156
5375
  }
5376
+ /** Computes the world transform using the parent bone and the specified local transform. The applied transform is set to the
5377
+ * specified local transform. Child bones are not updated.
5378
+ *
5379
+ * See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
5380
+ * Runtimes Guide. */
4157
5381
  updateWorldTransformWith(x, y, rotation, scaleX, scaleY, shearX, shearY) {
4158
5382
  this.ax = x;
4159
5383
  this.ay = y;
@@ -4180,7 +5404,7 @@ var spine = (() => {
4180
5404
  this.worldX = pa * x + pb * y + parent.worldX;
4181
5405
  this.worldY = pc * x + pd * y + parent.worldY;
4182
5406
  switch (this.data.transformMode) {
4183
- case TransformMode.Normal: {
5407
+ case 0 /* Normal */: {
4184
5408
  let rotationY = rotation + 90 + shearY;
4185
5409
  let la = MathUtils.cosDeg(rotation + shearX) * scaleX;
4186
5410
  let lb = MathUtils.cosDeg(rotationY) * scaleY;
@@ -4192,7 +5416,7 @@ var spine = (() => {
4192
5416
  this.d = pc * lb + pd * ld;
4193
5417
  return;
4194
5418
  }
4195
- case TransformMode.OnlyTranslation: {
5419
+ case 1 /* OnlyTranslation */: {
4196
5420
  let rotationY = rotation + 90 + shearY;
4197
5421
  this.a = MathUtils.cosDeg(rotation + shearX) * scaleX;
4198
5422
  this.b = MathUtils.cosDeg(rotationY) * scaleY;
@@ -4200,7 +5424,7 @@ var spine = (() => {
4200
5424
  this.d = MathUtils.sinDeg(rotationY) * scaleY;
4201
5425
  break;
4202
5426
  }
4203
- case TransformMode.NoRotationOrReflection: {
5427
+ case 2 /* NoRotationOrReflection */: {
4204
5428
  let s = pa * pa + pc * pc;
4205
5429
  let prx = 0;
4206
5430
  if (s > 1e-4) {
@@ -4227,8 +5451,8 @@ var spine = (() => {
4227
5451
  this.d = pc * lb + pd * ld;
4228
5452
  break;
4229
5453
  }
4230
- case TransformMode.NoScale:
4231
- case TransformMode.NoScaleOrReflection: {
5454
+ case 3 /* NoScale */:
5455
+ case 4 /* NoScaleOrReflection */: {
4232
5456
  let cos = MathUtils.cosDeg(rotation);
4233
5457
  let sin = MathUtils.sinDeg(rotation);
4234
5458
  let za = (pa * cos + pb * sin) / this.skeleton.scaleX;
@@ -4239,7 +5463,7 @@ var spine = (() => {
4239
5463
  za *= s;
4240
5464
  zc *= s;
4241
5465
  s = Math.sqrt(za * za + zc * zc);
4242
- if (this.data.transformMode == TransformMode.NoScale && pa * pd - pb * pc < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
5466
+ if (this.data.transformMode == 3 /* NoScale */ && pa * pd - pb * pc < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
4243
5467
  s = -s;
4244
5468
  let r = Math.PI / 2 + Math.atan2(zc, za);
4245
5469
  let zb = Math.cos(r) * s;
@@ -4260,6 +5484,7 @@ var spine = (() => {
4260
5484
  this.c *= this.skeleton.scaleY;
4261
5485
  this.d *= this.skeleton.scaleY;
4262
5486
  }
5487
+ /** Sets this bone's local transform to the setup pose. */
4263
5488
  setToSetupPose() {
4264
5489
  let data = this.data;
4265
5490
  this.x = data.x;
@@ -4270,18 +5495,30 @@ var spine = (() => {
4270
5495
  this.shearX = data.shearX;
4271
5496
  this.shearY = data.shearY;
4272
5497
  }
5498
+ /** The world rotation for the X axis, calculated using {@link #a} and {@link #c}. */
4273
5499
  getWorldRotationX() {
4274
5500
  return Math.atan2(this.c, this.a) * MathUtils.radDeg;
4275
5501
  }
5502
+ /** The world rotation for the Y axis, calculated using {@link #b} and {@link #d}. */
4276
5503
  getWorldRotationY() {
4277
5504
  return Math.atan2(this.d, this.b) * MathUtils.radDeg;
4278
5505
  }
5506
+ /** The magnitude (always positive) of the world scale X, calculated using {@link #a} and {@link #c}. */
4279
5507
  getWorldScaleX() {
4280
5508
  return Math.sqrt(this.a * this.a + this.c * this.c);
4281
5509
  }
5510
+ /** The magnitude (always positive) of the world scale Y, calculated using {@link #b} and {@link #d}. */
4282
5511
  getWorldScaleY() {
4283
5512
  return Math.sqrt(this.b * this.b + this.d * this.d);
4284
5513
  }
5514
+ /** Computes the applied transform values from the world transform.
5515
+ *
5516
+ * If the world transform is modified (by a constraint, {@link #rotateWorld(float)}, etc) then this method should be called so
5517
+ * the applied transform matches the world transform. The applied transform may be needed by other code (eg to apply other
5518
+ * constraints).
5519
+ *
5520
+ * Some information is ambiguous in the world transform, such as -1,-1 scale versus 180 rotation. The applied transform after
5521
+ * calling this method is equivalent to the local transform used to compute the world transform, but may not be identical. */
4285
5522
  updateAppliedTransform() {
4286
5523
  let parent = this.parent;
4287
5524
  if (!parent) {
@@ -4301,14 +5538,14 @@ var spine = (() => {
4301
5538
  this.ax = dx * ia - dy * ib;
4302
5539
  this.ay = dy * id - dx * ic;
4303
5540
  let ra, rb, rc, rd;
4304
- if (this.data.transformMode == TransformMode.OnlyTranslation) {
5541
+ if (this.data.transformMode == 1 /* OnlyTranslation */) {
4305
5542
  ra = this.a;
4306
5543
  rb = this.b;
4307
5544
  rc = this.c;
4308
5545
  rd = this.d;
4309
5546
  } else {
4310
5547
  switch (this.data.transformMode) {
4311
- case TransformMode.NoRotationOrReflection: {
5548
+ case 2 /* NoRotationOrReflection */: {
4312
5549
  let s2 = Math.abs(pa * pd - pb * pc) / (pa * pa + pc * pc);
4313
5550
  let sa = pa / this.skeleton.scaleX;
4314
5551
  let sc = pc / this.skeleton.scaleY;
@@ -4319,8 +5556,8 @@ var spine = (() => {
4319
5556
  ib = pb * pid;
4320
5557
  break;
4321
5558
  }
4322
- case TransformMode.NoScale:
4323
- case TransformMode.NoScaleOrReflection:
5559
+ case 3 /* NoScale */:
5560
+ case 4 /* NoScaleOrReflection */:
4324
5561
  let cos = MathUtils.cosDeg(this.rotation), sin = MathUtils.sinDeg(this.rotation);
4325
5562
  pa = (pa * cos + pb * sin) / this.skeleton.scaleX;
4326
5563
  pc = (pc * cos + pd * sin) / this.skeleton.scaleY;
@@ -4330,7 +5567,7 @@ var spine = (() => {
4330
5567
  pa *= s;
4331
5568
  pc *= s;
4332
5569
  s = Math.sqrt(pa * pa + pc * pc);
4333
- if (this.data.transformMode == TransformMode.NoScale && pid < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
5570
+ if (this.data.transformMode == 3 /* NoScale */ && pid < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
4334
5571
  s = -s;
4335
5572
  let r = MathUtils.PI / 2 + Math.atan2(pc, pa);
4336
5573
  pb = Math.cos(r) * s;
@@ -4360,6 +5597,7 @@ var spine = (() => {
4360
5597
  this.arotation = 90 - Math.atan2(rd, rb) * MathUtils.radDeg;
4361
5598
  }
4362
5599
  }
5600
+ /** Transforms a point from world coordinates to the bone's local coordinates. */
4363
5601
  worldToLocal(world) {
4364
5602
  let invDet = 1 / (this.a * this.d - this.b * this.c);
4365
5603
  let x = world.x - this.worldX, y = world.y - this.worldY;
@@ -4367,21 +5605,28 @@ var spine = (() => {
4367
5605
  world.y = y * this.a * invDet - x * this.c * invDet;
4368
5606
  return world;
4369
5607
  }
5608
+ /** Transforms a point from the bone's local coordinates to world coordinates. */
4370
5609
  localToWorld(local) {
4371
5610
  let x = local.x, y = local.y;
4372
5611
  local.x = x * this.a + y * this.b + this.worldX;
4373
5612
  local.y = x * this.c + y * this.d + this.worldY;
4374
5613
  return local;
4375
5614
  }
5615
+ /** Transforms a world rotation to a local rotation. */
4376
5616
  worldToLocalRotation(worldRotation) {
4377
5617
  let sin = MathUtils.sinDeg(worldRotation), cos = MathUtils.cosDeg(worldRotation);
4378
5618
  return Math.atan2(this.a * sin - this.c * cos, this.d * cos - this.b * sin) * MathUtils.radDeg + this.rotation - this.shearX;
4379
5619
  }
5620
+ /** Transforms a local rotation to a world rotation. */
4380
5621
  localToWorldRotation(localRotation) {
4381
5622
  localRotation -= this.rotation - this.shearX;
4382
5623
  let sin = MathUtils.sinDeg(localRotation), cos = MathUtils.cosDeg(localRotation);
4383
5624
  return Math.atan2(cos * this.c + sin * this.d, cos * this.a + sin * this.b) * MathUtils.radDeg;
4384
5625
  }
5626
+ /** Rotates the world transform the specified amount.
5627
+ * <p>
5628
+ * After changes are made to the world transform, {@link #updateAppliedTransform()} should be called and {@link #update()} will
5629
+ * need to be called on any child bones, recursively. */
4385
5630
  rotateWorld(degrees) {
4386
5631
  let a = this.a, b = this.b, c = this.c, d = this.d;
4387
5632
  let cos = MathUtils.cosDeg(degrees), sin = MathUtils.sinDeg(degrees);
@@ -4523,17 +5768,21 @@ var spine = (() => {
4523
5768
  let atlas = new TextureAtlas(atlasText);
4524
5769
  let toLoad = atlas.pages.length, abort = false;
4525
5770
  for (let page of atlas.pages) {
4526
- this.loadTexture(!fileAlias ? parent + page.name : fileAlias[page.name], (imagePath, texture) => {
4527
- if (!abort) {
4528
- page.setTexture(texture);
4529
- if (--toLoad == 0)
4530
- this.success(success, path, atlas);
5771
+ this.loadTexture(
5772
+ !fileAlias ? parent + page.name : fileAlias[page.name],
5773
+ (imagePath, texture) => {
5774
+ if (!abort) {
5775
+ page.setTexture(texture);
5776
+ if (--toLoad == 0)
5777
+ this.success(success, path, atlas);
5778
+ }
5779
+ },
5780
+ (imagePath, message) => {
5781
+ if (!abort)
5782
+ this.error(error, path, `Couldn't load texture atlas ${path} page image: ${imagePath}`);
5783
+ abort = true;
4531
5784
  }
4532
- }, (imagePath, message) => {
4533
- if (!abort)
4534
- this.error(error, path, `Couldn't load texture atlas ${path} page image: ${imagePath}`);
4535
- abort = true;
4536
- });
5785
+ );
4537
5786
  }
4538
5787
  } catch (e) {
4539
5788
  this.error(error, path, `Couldn't parse texture atlas ${path}: ${e.message}`);
@@ -4729,10 +5978,16 @@ var spine = (() => {
4729
5978
  // spine-core/src/IkConstraint.ts
4730
5979
  var IkConstraint = class {
4731
5980
  constructor(data, skeleton) {
5981
+ /** Controls the bend direction of the IK bones, either 1 or -1. */
4732
5982
  this.bendDirection = 0;
5983
+ /** When true and only a single bone is being constrained, if the target is too close, the bone is scaled to reach it. */
4733
5984
  this.compress = false;
5985
+ /** When true, if the target is out of range, the parent bone is scaled to reach it. If more than one bone is being constrained
5986
+ * and the parent bone has local nonuniform scale, stretch is not applied. */
4734
5987
  this.stretch = false;
5988
+ /** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */
4735
5989
  this.mix = 1;
5990
+ /** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */
4736
5991
  this.softness = 0;
4737
5992
  this.active = false;
4738
5993
  if (!data)
@@ -4774,6 +6029,7 @@ var spine = (() => {
4774
6029
  break;
4775
6030
  }
4776
6031
  }
6032
+ /** Applies 1 bone IK. The target is specified in the world coordinate system. */
4777
6033
  apply1(bone, targetX, targetY, compress, stretch, uniform, alpha) {
4778
6034
  let p = bone.parent;
4779
6035
  if (!p)
@@ -4781,11 +6037,11 @@ var spine = (() => {
4781
6037
  let pa = p.a, pb = p.b, pc = p.c, pd = p.d;
4782
6038
  let rotationIK = -bone.ashearX - bone.arotation, tx = 0, ty = 0;
4783
6039
  switch (bone.data.transformMode) {
4784
- case TransformMode.OnlyTranslation:
6040
+ case 1 /* OnlyTranslation */:
4785
6041
  tx = targetX - bone.worldX;
4786
6042
  ty = targetY - bone.worldY;
4787
6043
  break;
4788
- case TransformMode.NoRotationOrReflection:
6044
+ case 2 /* NoRotationOrReflection */:
4789
6045
  let s = Math.abs(pa * pd - pb * pc) / (pa * pa + pc * pc);
4790
6046
  let sa = pa / bone.skeleton.scaleX;
4791
6047
  let sc = pc / bone.skeleton.scaleY;
@@ -4808,8 +6064,8 @@ var spine = (() => {
4808
6064
  let sx = bone.ascaleX, sy = bone.ascaleY;
4809
6065
  if (compress || stretch) {
4810
6066
  switch (bone.data.transformMode) {
4811
- case TransformMode.NoScale:
4812
- case TransformMode.NoScaleOrReflection:
6067
+ case 3 /* NoScale */:
6068
+ case 4 /* NoScaleOrReflection */:
4813
6069
  tx = targetX - bone.worldX;
4814
6070
  ty = targetY - bone.worldY;
4815
6071
  }
@@ -4821,8 +6077,18 @@ var spine = (() => {
4821
6077
  sy *= s;
4822
6078
  }
4823
6079
  }
4824
- bone.updateWorldTransformWith(bone.ax, bone.ay, bone.arotation + rotationIK * alpha, sx, sy, bone.ashearX, bone.ashearY);
6080
+ bone.updateWorldTransformWith(
6081
+ bone.ax,
6082
+ bone.ay,
6083
+ bone.arotation + rotationIK * alpha,
6084
+ sx,
6085
+ sy,
6086
+ bone.ashearX,
6087
+ bone.ashearY
6088
+ );
4825
6089
  }
6090
+ /** Applies 2 bone IK. The target is specified in the world coordinate system.
6091
+ * @param child A direct descendant of the parent bone. */
4826
6092
  apply2(parent, child, targetX, targetY, bendDir, stretch, uniform, softness, alpha) {
4827
6093
  let px = parent.ax, py = parent.ay, psx = parent.ascaleX, psy = parent.ascaleY, sx = psx, sy = psy, csx = child.ascaleX;
4828
6094
  let os1 = 0, os2 = 0, s2 = 0;
@@ -4977,13 +6243,23 @@ var spine = (() => {
4977
6243
  var IkConstraintData = class extends ConstraintData {
4978
6244
  constructor(name) {
4979
6245
  super(name, 0, false);
6246
+ /** The bones that are constrained by this IK constraint. */
4980
6247
  this.bones = new Array();
6248
+ /** The bone that is the IK target. */
4981
6249
  this._target = null;
6250
+ /** Controls the bend direction of the IK bones, either 1 or -1. */
4982
6251
  this.bendDirection = 1;
6252
+ /** When true and only a single bone is being constrained, if the target is too close, the bone is scaled to reach it. */
4983
6253
  this.compress = false;
6254
+ /** When true, if the target is out of range, the parent bone is scaled to reach it. If more than one bone is being constrained
6255
+ * and the parent bone has local nonuniform scale, stretch is not applied. */
4984
6256
  this.stretch = false;
6257
+ /** When true, only a single bone is being constrained, and {@link #getCompress()} or {@link #getStretch()} is used, the bone
6258
+ * is scaled on both the X and Y axes. */
4985
6259
  this.uniform = false;
6260
+ /** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */
4986
6261
  this.mix = 1;
6262
+ /** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */
4987
6263
  this.softness = 0;
4988
6264
  }
4989
6265
  set target(boneData) {
@@ -5001,13 +6277,21 @@ var spine = (() => {
5001
6277
  var PathConstraintData = class extends ConstraintData {
5002
6278
  constructor(name) {
5003
6279
  super(name, 0, false);
6280
+ /** The bones that will be modified by this path constraint. */
5004
6281
  this.bones = new Array();
6282
+ /** The slot whose path attachment will be used to constrained the bones. */
5005
6283
  this._target = null;
6284
+ /** The mode for positioning the first bone on the path. */
5006
6285
  this.positionMode = PositionMode.Fixed;
6286
+ /** The mode for positioning the bones after the first bone on the path. */
5007
6287
  this.spacingMode = SpacingMode.Fixed;
6288
+ /** The mode for adjusting the rotation of the bones. */
5008
6289
  this.rotateMode = RotateMode.Chain;
6290
+ /** An offset added to the constrained bone rotation. */
5009
6291
  this.offsetRotation = 0;
6292
+ /** The position along the path. */
5010
6293
  this.position = 0;
6294
+ /** The spacing between bones. */
5011
6295
  this.spacing = 0;
5012
6296
  this.mixRotate = 0;
5013
6297
  this.mixX = 0;
@@ -5023,29 +6307,31 @@ var spine = (() => {
5023
6307
  return this._target;
5024
6308
  }
5025
6309
  };
5026
- var PositionMode;
5027
- (function(PositionMode2) {
6310
+ var PositionMode = /* @__PURE__ */ ((PositionMode2) => {
5028
6311
  PositionMode2[PositionMode2["Fixed"] = 0] = "Fixed";
5029
6312
  PositionMode2[PositionMode2["Percent"] = 1] = "Percent";
5030
- })(PositionMode || (PositionMode = {}));
5031
- var SpacingMode;
5032
- (function(SpacingMode2) {
6313
+ return PositionMode2;
6314
+ })(PositionMode || {});
6315
+ var SpacingMode = /* @__PURE__ */ ((SpacingMode2) => {
5033
6316
  SpacingMode2[SpacingMode2["Length"] = 0] = "Length";
5034
6317
  SpacingMode2[SpacingMode2["Fixed"] = 1] = "Fixed";
5035
6318
  SpacingMode2[SpacingMode2["Percent"] = 2] = "Percent";
5036
6319
  SpacingMode2[SpacingMode2["Proportional"] = 3] = "Proportional";
5037
- })(SpacingMode || (SpacingMode = {}));
5038
- var RotateMode;
5039
- (function(RotateMode2) {
6320
+ return SpacingMode2;
6321
+ })(SpacingMode || {});
6322
+ var RotateMode = /* @__PURE__ */ ((RotateMode2) => {
5040
6323
  RotateMode2[RotateMode2["Tangent"] = 0] = "Tangent";
5041
6324
  RotateMode2[RotateMode2["Chain"] = 1] = "Chain";
5042
6325
  RotateMode2[RotateMode2["ChainScale"] = 2] = "ChainScale";
5043
- })(RotateMode || (RotateMode = {}));
6326
+ return RotateMode2;
6327
+ })(RotateMode || {});
5044
6328
 
5045
6329
  // spine-core/src/PathConstraint.ts
5046
6330
  var _PathConstraint = class {
5047
6331
  constructor(data, skeleton) {
6332
+ /** The position along the path. */
5048
6333
  this.position = 0;
6334
+ /** The spacing between bones. */
5049
6335
  this.spacing = 0;
5050
6336
  this.mixRotate = 0;
5051
6337
  this.mixX = 0;
@@ -5090,13 +6376,13 @@ var spine = (() => {
5090
6376
  if (mixRotate == 0 && mixX == 0 && mixY == 0)
5091
6377
  return;
5092
6378
  let data = this.data;
5093
- let tangents = data.rotateMode == RotateMode.Tangent, scale = data.rotateMode == RotateMode.ChainScale;
6379
+ let tangents = data.rotateMode == 0 /* Tangent */, scale = data.rotateMode == 2 /* ChainScale */;
5094
6380
  let bones = this.bones;
5095
6381
  let boneCount = bones.length, spacesCount = tangents ? boneCount : boneCount + 1;
5096
6382
  let spaces = Utils.setArraySize(this.spaces, spacesCount), lengths = scale ? this.lengths = Utils.setArraySize(this.lengths, boneCount) : [];
5097
6383
  let spacing = this.spacing;
5098
6384
  switch (data.spacingMode) {
5099
- case SpacingMode.Percent:
6385
+ case 2 /* Percent */:
5100
6386
  if (scale) {
5101
6387
  for (let i = 0, n = spacesCount - 1; i < n; i++) {
5102
6388
  let bone = bones[i];
@@ -5111,7 +6397,7 @@ var spine = (() => {
5111
6397
  }
5112
6398
  Utils.arrayFill(spaces, 1, spacesCount, spacing);
5113
6399
  break;
5114
- case SpacingMode.Proportional:
6400
+ case 3 /* Proportional */:
5115
6401
  let sum = 0;
5116
6402
  for (let i = 0, n = spacesCount - 1; i < n; ) {
5117
6403
  let bone = bones[i];
@@ -5136,7 +6422,7 @@ var spine = (() => {
5136
6422
  }
5137
6423
  break;
5138
6424
  default:
5139
- let lengthSpacing = data.spacingMode == SpacingMode.Length;
6425
+ let lengthSpacing = data.spacingMode == 0 /* Length */;
5140
6426
  for (let i = 0, n = spacesCount - 1; i < n; ) {
5141
6427
  let bone = bones[i];
5142
6428
  let setupLength = bone.data.length;
@@ -5157,7 +6443,7 @@ var spine = (() => {
5157
6443
  let boneX = positions[0], boneY = positions[1], offsetRotation = data.offsetRotation;
5158
6444
  let tip = false;
5159
6445
  if (offsetRotation == 0)
5160
- tip = data.rotateMode == RotateMode.Chain;
6446
+ tip = data.rotateMode == 1 /* Chain */;
5161
6447
  else {
5162
6448
  tip = false;
5163
6449
  let p = this.target.bone;
@@ -5221,14 +6507,14 @@ var spine = (() => {
5221
6507
  let lengths = path.lengths;
5222
6508
  curveCount -= closed2 ? 1 : 2;
5223
6509
  let pathLength2 = lengths[curveCount];
5224
- if (this.data.positionMode == PositionMode.Percent)
6510
+ if (this.data.positionMode == 1 /* Percent */)
5225
6511
  position *= pathLength2;
5226
6512
  let multiplier2;
5227
6513
  switch (this.data.spacingMode) {
5228
- case SpacingMode.Percent:
6514
+ case 2 /* Percent */:
5229
6515
  multiplier2 = pathLength2;
5230
6516
  break;
5231
- case SpacingMode.Proportional:
6517
+ case 3 /* Proportional */:
5232
6518
  multiplier2 = pathLength2 / spacesCount;
5233
6519
  break;
5234
6520
  default:
@@ -5279,7 +6565,20 @@ var spine = (() => {
5279
6565
  } else
5280
6566
  path.computeWorldVertices(target, curve * 6 + 2, 8, world, 0, 2);
5281
6567
  }
5282
- this.addCurvePosition(p, world[0], world[1], world[2], world[3], world[4], world[5], world[6], world[7], out, o, tangents || i > 0 && space == 0);
6568
+ this.addCurvePosition(
6569
+ p,
6570
+ world[0],
6571
+ world[1],
6572
+ world[2],
6573
+ world[3],
6574
+ world[4],
6575
+ world[5],
6576
+ world[6],
6577
+ world[7],
6578
+ out,
6579
+ o,
6580
+ tangents || i > 0 && space == 0
6581
+ );
5283
6582
  }
5284
6583
  return out;
5285
6584
  }
@@ -5331,14 +6630,14 @@ var spine = (() => {
5331
6630
  x1 = x2;
5332
6631
  y1 = y2;
5333
6632
  }
5334
- if (this.data.positionMode == PositionMode.Percent)
6633
+ if (this.data.positionMode == 1 /* Percent */)
5335
6634
  position *= pathLength;
5336
6635
  let multiplier;
5337
6636
  switch (this.data.spacingMode) {
5338
- case SpacingMode.Percent:
6637
+ case 2 /* Percent */:
5339
6638
  multiplier = pathLength;
5340
6639
  break;
5341
- case SpacingMode.Proportional:
6640
+ case 3 /* Proportional */:
5342
6641
  multiplier = pathLength / spacesCount;
5343
6642
  break;
5344
6643
  default:
@@ -5471,10 +6770,18 @@ var spine = (() => {
5471
6770
  // spine-core/src/Slot.ts
5472
6771
  var Slot = class {
5473
6772
  constructor(data, bone) {
6773
+ /** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark
6774
+ * color's alpha is not used. */
5474
6775
  this.darkColor = null;
5475
6776
  this.attachment = null;
5476
6777
  this.attachmentState = 0;
6778
+ /** The index of the texture region to display when the slot's attachment has a {@link Sequence}. -1 represents the
6779
+ * {@link Sequence#getSetupIndex()}. */
5477
6780
  this.sequenceIndex = -1;
6781
+ /** Values to deform the slot's attachment. For an unweighted mesh, the entries are local positions for each vertex. For a
6782
+ * weighted mesh, the entries are an offset for each vertex which will be added to the mesh's local vertex positions.
6783
+ *
6784
+ * See {@link VertexAttachment#computeWorldVertices()} and {@link DeformTimeline}. */
5478
6785
  this.deform = new Array();
5479
6786
  if (!data)
5480
6787
  throw new Error("data cannot be null.");
@@ -5486,12 +6793,17 @@ var spine = (() => {
5486
6793
  this.darkColor = !data.darkColor ? null : new Color();
5487
6794
  this.setToSetupPose();
5488
6795
  }
6796
+ /** The skeleton this slot belongs to. */
5489
6797
  getSkeleton() {
5490
6798
  return this.bone.skeleton;
5491
6799
  }
6800
+ /** The current attachment for the slot, or null if the slot has no attachment. */
5492
6801
  getAttachment() {
5493
6802
  return this.attachment;
5494
6803
  }
6804
+ /** Sets the slot's attachment and, if the attachment changed, resets {@link #sequenceIndex} and clears the {@link #deform}.
6805
+ * The deform is not cleared if the old attachment has the same {@link VertexAttachment#getTimelineAttachment()} as the
6806
+ * specified attachment. */
5495
6807
  setAttachment(attachment) {
5496
6808
  if (this.attachment == attachment)
5497
6809
  return;
@@ -5501,6 +6813,7 @@ var spine = (() => {
5501
6813
  this.attachment = attachment;
5502
6814
  this.sequenceIndex = -1;
5503
6815
  }
6816
+ /** Sets this slot to the setup pose. */
5504
6817
  setToSetupPose() {
5505
6818
  this.color.setFromColor(this.data.color);
5506
6819
  if (this.darkColor)
@@ -5552,7 +6865,7 @@ var spine = (() => {
5552
6865
  return this.active;
5553
6866
  }
5554
6867
  update() {
5555
- if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.mixScaleX == 0 && this.mixShearY == 0)
6868
+ if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.mixScaleY == 0 && this.mixShearY == 0)
5556
6869
  return;
5557
6870
  if (this.data.local) {
5558
6871
  if (this.data.relative)
@@ -5729,13 +7042,21 @@ var spine = (() => {
5729
7042
  };
5730
7043
 
5731
7044
  // spine-core/src/Skeleton.ts
5732
- var Skeleton = class {
7045
+ var _Skeleton = class {
5733
7046
  constructor(data) {
7047
+ /** The list of bones and constraints, sorted in the order they should be updated, as computed by {@link #updateCache()}. */
5734
7048
  this._updateCache = new Array();
7049
+ /** The skeleton's current skin. May be null. */
5735
7050
  this.skin = null;
7051
+ /** Scales the entire skeleton on the X axis. This affects all bones, even if the bone's transform mode disallows scale
7052
+ * inheritance. */
5736
7053
  this.scaleX = 1;
5737
- this.scaleY = 1;
7054
+ /** Scales the entire skeleton on the Y axis. This affects all bones, even if the bone's transform mode disallows scale
7055
+ * inheritance. */
7056
+ this._scaleY = 1;
7057
+ /** Sets the skeleton X position, which is added to the root bone worldX position. */
5738
7058
  this.x = 0;
7059
+ /** Sets the skeleton Y position, which is added to the root bone worldY position. */
5739
7060
  this.y = 0;
5740
7061
  if (!data)
5741
7062
  throw new Error("data cannot be null.");
@@ -5780,6 +7101,14 @@ var spine = (() => {
5780
7101
  this.color = new Color(1, 1, 1, 1);
5781
7102
  this.updateCache();
5782
7103
  }
7104
+ get scaleY() {
7105
+ return _Skeleton.yDown ? -this._scaleY : this._scaleY;
7106
+ }
7107
+ set scaleY(scaleY) {
7108
+ this._scaleY = scaleY;
7109
+ }
7110
+ /** Caches information about bones and constraints. Must be called if the {@link #getSkin()} is modified or if bones,
7111
+ * constraints, or weighted path attachments are added or removed. */
5783
7112
  updateCache() {
5784
7113
  let updateCache = this._updateCache;
5785
7114
  updateCache.length = 0;
@@ -5947,6 +7276,10 @@ var spine = (() => {
5947
7276
  bone.sorted = false;
5948
7277
  }
5949
7278
  }
7279
+ /** Updates the world transform for each bone and applies all constraints.
7280
+ *
7281
+ * See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
7282
+ * Runtimes Guide. */
5950
7283
  updateWorldTransform() {
5951
7284
  let bones = this.bones;
5952
7285
  for (let i = 0, n = bones.length; i < n; i++) {
@@ -5986,10 +7319,12 @@ var spine = (() => {
5986
7319
  updatable.update();
5987
7320
  }
5988
7321
  }
7322
+ /** Sets the bones, constraints, and slots to their setup pose values. */
5989
7323
  setToSetupPose() {
5990
7324
  this.setBonesToSetupPose();
5991
7325
  this.setSlotsToSetupPose();
5992
7326
  }
7327
+ /** Sets the bones and constraints to their setup pose values. */
5993
7328
  setBonesToSetupPose() {
5994
7329
  let bones = this.bones;
5995
7330
  for (let i = 0, n = bones.length; i < n; i++)
@@ -6025,17 +7360,20 @@ var spine = (() => {
6025
7360
  constraint.mixY = data.mixY;
6026
7361
  }
6027
7362
  }
7363
+ /** Sets the slots and draw order to their setup pose values. */
6028
7364
  setSlotsToSetupPose() {
6029
7365
  let slots = this.slots;
6030
7366
  Utils.arrayCopy(slots, 0, this.drawOrder, 0, slots.length);
6031
7367
  for (let i = 0, n = slots.length; i < n; i++)
6032
7368
  slots[i].setToSetupPose();
6033
7369
  }
7370
+ /** @returns May return null. */
6034
7371
  getRootBone() {
6035
7372
  if (this.bones.length == 0)
6036
7373
  return null;
6037
7374
  return this.bones[0];
6038
7375
  }
7376
+ /** @returns May be null. */
6039
7377
  findBone(boneName) {
6040
7378
  if (!boneName)
6041
7379
  throw new Error("boneName cannot be null.");
@@ -6047,6 +7385,9 @@ var spine = (() => {
6047
7385
  }
6048
7386
  return null;
6049
7387
  }
7388
+ /** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it
7389
+ * repeatedly.
7390
+ * @returns May be null. */
6050
7391
  findSlot(slotName) {
6051
7392
  if (!slotName)
6052
7393
  throw new Error("slotName cannot be null.");
@@ -6058,12 +7399,25 @@ var spine = (() => {
6058
7399
  }
6059
7400
  return null;
6060
7401
  }
7402
+ /** Sets a skin by name.
7403
+ *
7404
+ * See {@link #setSkin()}. */
6061
7405
  setSkinByName(skinName) {
6062
7406
  let skin = this.data.findSkin(skinName);
6063
7407
  if (!skin)
6064
7408
  throw new Error("Skin not found: " + skinName);
6065
7409
  this.setSkin(skin);
6066
7410
  }
7411
+ /** Sets the skin used to look up attachments before looking in the {@link SkeletonData#defaultSkin default skin}. If the
7412
+ * skin is changed, {@link #updateCache()} is called.
7413
+ *
7414
+ * Attachments from the new skin are attached if the corresponding attachment from the old skin was attached. If there was no
7415
+ * old skin, each slot's setup mode attachment is attached from the new skin.
7416
+ *
7417
+ * After changing the skin, the visible attachments can be reset to those attached in the setup pose by calling
7418
+ * {@link #setSlotsToSetupPose()}. Also, often {@link AnimationState#apply()} is called before the next time the
7419
+ * skeleton is rendered to allow any attachment keys in the current animation(s) to hide or show attachments from the new skin.
7420
+ * @param newSkin May be null. */
6067
7421
  setSkin(newSkin) {
6068
7422
  if (newSkin == this.skin)
6069
7423
  return;
@@ -6086,12 +7440,22 @@ var spine = (() => {
6086
7440
  this.skin = newSkin;
6087
7441
  this.updateCache();
6088
7442
  }
7443
+ /** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot name and attachment
7444
+ * name.
7445
+ *
7446
+ * See {@link #getAttachment()}.
7447
+ * @returns May be null. */
6089
7448
  getAttachmentByName(slotName, attachmentName) {
6090
7449
  let slot = this.data.findSlot(slotName);
6091
7450
  if (!slot)
6092
7451
  throw new Error(`Can't find slot with name ${slotName}`);
6093
7452
  return this.getAttachment(slot.index, attachmentName);
6094
7453
  }
7454
+ /** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot index and
7455
+ * attachment name. First the skin is checked and if the attachment was not found, the default skin is checked.
7456
+ *
7457
+ * See [Runtime skins](http://esotericsoftware.com/spine-runtime-skins) in the Spine Runtimes Guide.
7458
+ * @returns May be null. */
6095
7459
  getAttachment(slotIndex, attachmentName) {
6096
7460
  if (!attachmentName)
6097
7461
  throw new Error("attachmentName cannot be null.");
@@ -6104,6 +7468,9 @@ var spine = (() => {
6104
7468
  return this.data.defaultSkin.getAttachment(slotIndex, attachmentName);
6105
7469
  return null;
6106
7470
  }
7471
+ /** A convenience method to set an attachment by finding the slot with {@link #findSlot()}, finding the attachment with
7472
+ * {@link #getAttachment()}, then setting the slot's {@link Slot#attachment}.
7473
+ * @param attachmentName May be null to clear the slot's attachment. */
6107
7474
  setAttachment(slotName, attachmentName) {
6108
7475
  if (!slotName)
6109
7476
  throw new Error("slotName cannot be null.");
@@ -6123,6 +7490,9 @@ var spine = (() => {
6123
7490
  }
6124
7491
  throw new Error("Slot not found: " + slotName);
6125
7492
  }
7493
+ /** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method
7494
+ * than to call it repeatedly.
7495
+ * @return May be null. */
6126
7496
  findIkConstraint(constraintName) {
6127
7497
  if (!constraintName)
6128
7498
  throw new Error("constraintName cannot be null.");
@@ -6134,6 +7504,9 @@ var spine = (() => {
6134
7504
  }
6135
7505
  return null;
6136
7506
  }
7507
+ /** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
7508
+ * this method than to call it repeatedly.
7509
+ * @return May be null. */
6137
7510
  findTransformConstraint(constraintName) {
6138
7511
  if (!constraintName)
6139
7512
  throw new Error("constraintName cannot be null.");
@@ -6145,6 +7518,9 @@ var spine = (() => {
6145
7518
  }
6146
7519
  return null;
6147
7520
  }
7521
+ /** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
7522
+ * than to call it repeatedly.
7523
+ * @return May be null. */
6148
7524
  findPathConstraint(constraintName) {
6149
7525
  if (!constraintName)
6150
7526
  throw new Error("constraintName cannot be null.");
@@ -6156,12 +7532,18 @@ var spine = (() => {
6156
7532
  }
6157
7533
  return null;
6158
7534
  }
7535
+ /** Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose as `{ x: number, y: number, width: number, height: number }`.
7536
+ * Note that this method will create temporary objects which can add to garbage collection pressure. Use `getBounds()` if garbage collection is a concern. */
6159
7537
  getBoundsRect() {
6160
7538
  let offset = new Vector2();
6161
7539
  let size = new Vector2();
6162
7540
  this.getBounds(offset, size);
6163
7541
  return { x: offset.x, y: offset.y, width: size.x, height: size.y };
6164
7542
  }
7543
+ /** Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose.
7544
+ * @param offset An output value, the distance from the skeleton origin to the bottom left corner of the AABB.
7545
+ * @param size An output value, the width and height of the AABB.
7546
+ * @param temp Working memory to temporarily store attachments' computed world vertices. */
6165
7547
  getBounds(offset, size, temp = new Array(2)) {
6166
7548
  if (!offset)
6167
7549
  throw new Error("offset cannot be null.");
@@ -6200,30 +7582,59 @@ var spine = (() => {
6200
7582
  size.set(maxX - minX, maxY - minY);
6201
7583
  }
6202
7584
  };
7585
+ var Skeleton = _Skeleton;
7586
+ Skeleton.yDown = false;
6203
7587
 
6204
7588
  // spine-core/src/SkeletonData.ts
6205
7589
  var SkeletonData = class {
6206
7590
  constructor() {
7591
+ /** The skeleton's name, which by default is the name of the skeleton data file, if possible. May be null. */
6207
7592
  this.name = null;
7593
+ /** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
6208
7594
  this.bones = new Array();
7595
+ // Ordered parents first.
7596
+ /** The skeleton's slots. */
6209
7597
  this.slots = new Array();
7598
+ // Setup pose draw order.
6210
7599
  this.skins = new Array();
7600
+ /** The skeleton's default skin. By default this skin contains all attachments that were not in a skin in Spine.
7601
+ *
7602
+ * See {@link Skeleton#getAttachmentByName()}.
7603
+ * May be null. */
6211
7604
  this.defaultSkin = null;
7605
+ /** The skeleton's events. */
6212
7606
  this.events = new Array();
7607
+ /** The skeleton's animations. */
6213
7608
  this.animations = new Array();
7609
+ /** The skeleton's IK constraints. */
6214
7610
  this.ikConstraints = new Array();
7611
+ /** The skeleton's transform constraints. */
6215
7612
  this.transformConstraints = new Array();
7613
+ /** The skeleton's path constraints. */
6216
7614
  this.pathConstraints = new Array();
7615
+ /** The X coordinate of the skeleton's axis aligned bounding box in the setup pose. */
6217
7616
  this.x = 0;
7617
+ /** The Y coordinate of the skeleton's axis aligned bounding box in the setup pose. */
6218
7618
  this.y = 0;
7619
+ /** The width of the skeleton's axis aligned bounding box in the setup pose. */
6219
7620
  this.width = 0;
7621
+ /** The height of the skeleton's axis aligned bounding box in the setup pose. */
6220
7622
  this.height = 0;
7623
+ /** The Spine version used to export the skeleton data, or null. */
6221
7624
  this.version = null;
7625
+ /** The skeleton data hash. This value will change if any of the skeleton data has changed. May be null. */
6222
7626
  this.hash = null;
7627
+ // Nonessential
7628
+ /** The dopesheet FPS in Spine. Available only when nonessential data was exported. */
6223
7629
  this.fps = 0;
7630
+ /** The path to the images directory as defined in Spine. Available only when nonessential data was exported. May be null. */
6224
7631
  this.imagesPath = null;
7632
+ /** The path to the audio directory as defined in Spine. Available only when nonessential data was exported. May be null. */
6225
7633
  this.audioPath = null;
6226
7634
  }
7635
+ /** Finds a bone by comparing each bone's name. It is more efficient to cache the results of this method than to call it
7636
+ * multiple times.
7637
+ * @returns May be null. */
6227
7638
  findBone(boneName) {
6228
7639
  if (!boneName)
6229
7640
  throw new Error("boneName cannot be null.");
@@ -6235,6 +7646,9 @@ var spine = (() => {
6235
7646
  }
6236
7647
  return null;
6237
7648
  }
7649
+ /** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it
7650
+ * multiple times.
7651
+ * @returns May be null. */
6238
7652
  findSlot(slotName) {
6239
7653
  if (!slotName)
6240
7654
  throw new Error("slotName cannot be null.");
@@ -6246,6 +7660,9 @@ var spine = (() => {
6246
7660
  }
6247
7661
  return null;
6248
7662
  }
7663
+ /** Finds a skin by comparing each skin's name. It is more efficient to cache the results of this method than to call it
7664
+ * multiple times.
7665
+ * @returns May be null. */
6249
7666
  findSkin(skinName) {
6250
7667
  if (!skinName)
6251
7668
  throw new Error("skinName cannot be null.");
@@ -6257,6 +7674,9 @@ var spine = (() => {
6257
7674
  }
6258
7675
  return null;
6259
7676
  }
7677
+ /** Finds an event by comparing each events's name. It is more efficient to cache the results of this method than to call it
7678
+ * multiple times.
7679
+ * @returns May be null. */
6260
7680
  findEvent(eventDataName) {
6261
7681
  if (!eventDataName)
6262
7682
  throw new Error("eventDataName cannot be null.");
@@ -6268,6 +7688,9 @@ var spine = (() => {
6268
7688
  }
6269
7689
  return null;
6270
7690
  }
7691
+ /** Finds an animation by comparing each animation's name. It is more efficient to cache the results of this method than to
7692
+ * call it multiple times.
7693
+ * @returns May be null. */
6271
7694
  findAnimation(animationName) {
6272
7695
  if (!animationName)
6273
7696
  throw new Error("animationName cannot be null.");
@@ -6279,6 +7702,9 @@ var spine = (() => {
6279
7702
  }
6280
7703
  return null;
6281
7704
  }
7705
+ /** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method
7706
+ * than to call it multiple times.
7707
+ * @return May be null. */
6282
7708
  findIkConstraint(constraintName) {
6283
7709
  if (!constraintName)
6284
7710
  throw new Error("constraintName cannot be null.");
@@ -6290,6 +7716,9 @@ var spine = (() => {
6290
7716
  }
6291
7717
  return null;
6292
7718
  }
7719
+ /** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
7720
+ * this method than to call it multiple times.
7721
+ * @return May be null. */
6293
7722
  findTransformConstraint(constraintName) {
6294
7723
  if (!constraintName)
6295
7724
  throw new Error("constraintName cannot be null.");
@@ -6301,6 +7730,9 @@ var spine = (() => {
6301
7730
  }
6302
7731
  return null;
6303
7732
  }
7733
+ /** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
7734
+ * than to call it multiple times.
7735
+ * @return May be null. */
6304
7736
  findPathConstraint(constraintName) {
6305
7737
  if (!constraintName)
6306
7738
  throw new Error("constraintName cannot be null.");
@@ -6331,6 +7763,7 @@ var spine = (() => {
6331
7763
  throw new Error("name cannot be null.");
6332
7764
  this.name = name;
6333
7765
  }
7766
+ /** Adds an attachment to the skin for the specified slot index and name. */
6334
7767
  setAttachment(slotIndex, name, attachment) {
6335
7768
  if (!attachment)
6336
7769
  throw new Error("attachment cannot be null.");
@@ -6341,6 +7774,7 @@ var spine = (() => {
6341
7774
  attachments[slotIndex] = {};
6342
7775
  attachments[slotIndex][name] = attachment;
6343
7776
  }
7777
+ /** Adds all attachments, bones, and constraints from the specified skin to this skin. */
6344
7778
  addSkin(skin) {
6345
7779
  for (let i = 0; i < skin.bones.length; i++) {
6346
7780
  let bone = skin.bones[i];
@@ -6372,6 +7806,8 @@ var spine = (() => {
6372
7806
  this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
6373
7807
  }
6374
7808
  }
7809
+ /** Adds all bones and constraints and copies of all attachments from the specified skin to this skin. Mesh attachments are not
7810
+ * copied, instead a new linked mesh is created. The attachment copies can be modified without affecting the originals. */
6375
7811
  copySkin(skin) {
6376
7812
  for (let i = 0; i < skin.bones.length; i++) {
6377
7813
  let bone = skin.bones[i];
@@ -6411,15 +7847,18 @@ var spine = (() => {
6411
7847
  }
6412
7848
  }
6413
7849
  }
7850
+ /** Returns the attachment for the specified slot index and name, or null. */
6414
7851
  getAttachment(slotIndex, name) {
6415
7852
  let dictionary = this.attachments[slotIndex];
6416
7853
  return dictionary ? dictionary[name] : null;
6417
7854
  }
7855
+ /** Removes the attachment in the skin for the specified slot index and name, if any. */
6418
7856
  removeAttachment(slotIndex, name) {
6419
7857
  let dictionary = this.attachments[slotIndex];
6420
7858
  if (dictionary)
6421
7859
  delete dictionary[name];
6422
7860
  }
7861
+ /** Returns all attachments in this skin. */
6423
7862
  getAttachments() {
6424
7863
  let entries = new Array();
6425
7864
  for (var i = 0; i < this.attachments.length; i++) {
@@ -6434,6 +7873,7 @@ var spine = (() => {
6434
7873
  }
6435
7874
  return entries;
6436
7875
  }
7876
+ /** Returns all attachments in this skin for the specified slot index. */
6437
7877
  getAttachmentsForSlot(slotIndex, attachments) {
6438
7878
  let slotAttachments = this.attachments[slotIndex];
6439
7879
  if (slotAttachments) {
@@ -6444,11 +7884,13 @@ var spine = (() => {
6444
7884
  }
6445
7885
  }
6446
7886
  }
7887
+ /** Clears all attachments, bones, and constraints. */
6447
7888
  clear() {
6448
7889
  this.attachments.length = 0;
6449
7890
  this.bones.length = 0;
6450
7891
  this.constraints.length = 0;
6451
7892
  }
7893
+ /** Attach each attachment in this skin if the corresponding attachment in the old skin is currently attached. */
6452
7894
  attachAll(skeleton, oldSkin) {
6453
7895
  let slotIndex = 0;
6454
7896
  for (let i = 0; i < skeleton.slots.length; i++) {
@@ -6474,10 +7916,17 @@ var spine = (() => {
6474
7916
  // spine-core/src/SlotData.ts
6475
7917
  var SlotData = class {
6476
7918
  constructor(index, name, boneData) {
7919
+ /** The index of the slot in {@link Skeleton#getSlots()}. */
6477
7920
  this.index = 0;
7921
+ /** The color used to tint the slot's attachment. If {@link #getDarkColor()} is set, this is used as the light color for two
7922
+ * color tinting. */
6478
7923
  this.color = new Color(1, 1, 1, 1);
7924
+ /** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark
7925
+ * color's alpha is not used. */
6479
7926
  this.darkColor = null;
7927
+ /** The name of the attachment that is visible for this slot in the setup pose, or null if no attachment is visible. */
6480
7928
  this.attachmentName = null;
7929
+ /** The blend mode for drawing the slot's attachment. */
6481
7930
  this.blendMode = BlendMode.Normal;
6482
7931
  if (index < 0)
6483
7932
  throw new Error("index must be >= 0.");
@@ -6490,19 +7939,21 @@ var spine = (() => {
6490
7939
  this.boneData = boneData;
6491
7940
  }
6492
7941
  };
6493
- var BlendMode;
6494
- (function(BlendMode3) {
7942
+ var BlendMode = /* @__PURE__ */ ((BlendMode3) => {
6495
7943
  BlendMode3[BlendMode3["Normal"] = 0] = "Normal";
6496
7944
  BlendMode3[BlendMode3["Additive"] = 1] = "Additive";
6497
7945
  BlendMode3[BlendMode3["Multiply"] = 2] = "Multiply";
6498
7946
  BlendMode3[BlendMode3["Screen"] = 3] = "Screen";
6499
- })(BlendMode || (BlendMode = {}));
7947
+ return BlendMode3;
7948
+ })(BlendMode || {});
6500
7949
 
6501
7950
  // spine-core/src/TransformConstraintData.ts
6502
7951
  var TransformConstraintData = class extends ConstraintData {
6503
7952
  constructor(name) {
6504
7953
  super(name, 0, false);
7954
+ /** The bones that will be modified by this transform constraint. */
6505
7955
  this.bones = new Array();
7956
+ /** The target bone whose world transform will be copied to the constrained bones. */
6506
7957
  this._target = null;
6507
7958
  this.mixRotate = 0;
6508
7959
  this.mixX = 0;
@@ -6510,11 +7961,17 @@ var spine = (() => {
6510
7961
  this.mixScaleX = 0;
6511
7962
  this.mixScaleY = 0;
6512
7963
  this.mixShearY = 0;
7964
+ /** An offset added to the constrained bone rotation. */
6513
7965
  this.offsetRotation = 0;
7966
+ /** An offset added to the constrained bone X translation. */
6514
7967
  this.offsetX = 0;
7968
+ /** An offset added to the constrained bone Y translation. */
6515
7969
  this.offsetY = 0;
7970
+ /** An offset added to the constrained bone scaleX. */
6516
7971
  this.offsetScaleX = 0;
7972
+ /** An offset added to the constrained bone scaleY. */
6517
7973
  this.offsetScaleY = 0;
7974
+ /** An offset added to the constrained bone shearY. */
6518
7975
  this.offsetShearY = 0;
6519
7976
  this.relative = false;
6520
7977
  this.local = false;
@@ -6533,6 +7990,10 @@ var spine = (() => {
6533
7990
  // spine-core/src/SkeletonBinary.ts
6534
7991
  var SkeletonBinary = class {
6535
7992
  constructor(attachmentLoader) {
7993
+ /** Scales bone positions, image sizes, and translations as they are loaded. This allows different size images to be used at
7994
+ * runtime than were used in Spine.
7995
+ *
7996
+ * See [Scaling](http://esotericsoftware.com/spine-loading-skeleton-data#Scaling) in the Spine Runtimes Guide. */
6536
7997
  this.scale = 1;
6537
7998
  this.linkedMeshes = new Array();
6538
7999
  this.attachmentLoader = attachmentLoader;
@@ -6665,10 +8126,10 @@ var spine = (() => {
6665
8126
  data.rotateMode = input.readInt(true);
6666
8127
  data.offsetRotation = input.readFloat();
6667
8128
  data.position = input.readFloat();
6668
- if (data.positionMode == PositionMode.Fixed)
8129
+ if (data.positionMode == 0 /* Fixed */)
6669
8130
  data.position *= scale;
6670
8131
  data.spacing = input.readFloat();
6671
- if (data.spacingMode == SpacingMode.Length || data.spacingMode == SpacingMode.Fixed)
8132
+ if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */)
6672
8133
  data.spacing *= scale;
6673
8134
  data.mixRotate = input.readFloat();
6674
8135
  data.mixX = input.readFloat();
@@ -7293,10 +8754,18 @@ var spine = (() => {
7293
8754
  for (let ii = 0, nn = input.readInt(true); ii < nn; ii++) {
7294
8755
  switch (input.readByte()) {
7295
8756
  case PATH_POSITION:
7296
- timelines.push(readTimeline1(input, new PathConstraintPositionTimeline(input.readInt(true), input.readInt(true), index), data.positionMode == PositionMode.Fixed ? scale : 1));
8757
+ timelines.push(readTimeline1(
8758
+ input,
8759
+ new PathConstraintPositionTimeline(input.readInt(true), input.readInt(true), index),
8760
+ data.positionMode == 0 /* Fixed */ ? scale : 1
8761
+ ));
7297
8762
  break;
7298
8763
  case PATH_SPACING:
7299
- timelines.push(readTimeline1(input, new PathConstraintSpacingTimeline(input.readInt(true), input.readInt(true), index), data.spacingMode == SpacingMode.Length || data.spacingMode == SpacingMode.Fixed ? scale : 1));
8764
+ timelines.push(readTimeline1(
8765
+ input,
8766
+ new PathConstraintSpacingTimeline(input.readInt(true), input.readInt(true), index),
8767
+ data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */ ? scale : 1
8768
+ ));
7300
8769
  break;
7301
8770
  case PATH_MIX:
7302
8771
  let timeline = new PathConstraintMixTimeline(input.readInt(true), input.readInt(true), index);
@@ -7387,7 +8856,13 @@ var spine = (() => {
7387
8856
  for (let frame = 0; frame < frameCount; frame++) {
7388
8857
  let time = input.readFloat();
7389
8858
  let modeAndIndex = input.readInt32();
7390
- timeline.setFrame(frame, time, SequenceModeValues[modeAndIndex & 15], modeAndIndex >> 4, input.readFloat());
8859
+ timeline.setFrame(
8860
+ frame,
8861
+ time,
8862
+ SequenceModeValues[modeAndIndex & 15],
8863
+ modeAndIndex >> 4,
8864
+ input.readFloat()
8865
+ );
7391
8866
  }
7392
8867
  timelines.push(timeline);
7393
8868
  break;
@@ -7548,8 +9023,7 @@ var spine = (() => {
7548
9023
  this.vertices = vertices;
7549
9024
  }
7550
9025
  };
7551
- var AttachmentType;
7552
- (function(AttachmentType2) {
9026
+ var AttachmentType = /* @__PURE__ */ ((AttachmentType2) => {
7553
9027
  AttachmentType2[AttachmentType2["Region"] = 0] = "Region";
7554
9028
  AttachmentType2[AttachmentType2["BoundingBox"] = 1] = "BoundingBox";
7555
9029
  AttachmentType2[AttachmentType2["Mesh"] = 2] = "Mesh";
@@ -7557,7 +9031,8 @@ var spine = (() => {
7557
9031
  AttachmentType2[AttachmentType2["Path"] = 4] = "Path";
7558
9032
  AttachmentType2[AttachmentType2["Point"] = 5] = "Point";
7559
9033
  AttachmentType2[AttachmentType2["Clipping"] = 6] = "Clipping";
7560
- })(AttachmentType || (AttachmentType = {}));
9034
+ return AttachmentType2;
9035
+ })(AttachmentType || {});
7561
9036
  function readTimeline1(input, timeline, scale) {
7562
9037
  let time = input.readFloat(), value = input.readFloat() * scale;
7563
9038
  for (let frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1; ; frame++) {
@@ -7628,16 +9103,26 @@ var spine = (() => {
7628
9103
  // spine-core/src/SkeletonBounds.ts
7629
9104
  var SkeletonBounds = class {
7630
9105
  constructor() {
9106
+ /** The left edge of the axis aligned bounding box. */
7631
9107
  this.minX = 0;
9108
+ /** The bottom edge of the axis aligned bounding box. */
7632
9109
  this.minY = 0;
9110
+ /** The right edge of the axis aligned bounding box. */
7633
9111
  this.maxX = 0;
9112
+ /** The top edge of the axis aligned bounding box. */
7634
9113
  this.maxY = 0;
9114
+ /** The visible bounding boxes. */
7635
9115
  this.boundingBoxes = new Array();
9116
+ /** The world vertices for the bounding box polygons. */
7636
9117
  this.polygons = new Array();
7637
9118
  this.polygonPool = new Pool(() => {
7638
9119
  return Utils.newFloatArray(16);
7639
9120
  });
7640
9121
  }
9122
+ /** Clears any previous polygons, finds all visible bounding box attachments, and computes the world vertices for each bounding
9123
+ * box's polygon.
9124
+ * @param updateAabb If true, the axis aligned bounding box containing all the polygons is computed. If false, the
9125
+ * SkeletonBounds AABB methods will always return true. */
7641
9126
  update(skeleton, updateAabb) {
7642
9127
  if (!skeleton)
7643
9128
  throw new Error("skeleton cannot be null.");
@@ -7694,9 +9179,11 @@ var spine = (() => {
7694
9179
  this.maxX = maxX;
7695
9180
  this.maxY = maxY;
7696
9181
  }
9182
+ /** Returns true if the axis aligned bounding box contains the point. */
7697
9183
  aabbContainsPoint(x, y) {
7698
9184
  return x >= this.minX && x <= this.maxX && y >= this.minY && y <= this.maxY;
7699
9185
  }
9186
+ /** Returns true if the axis aligned bounding box intersects the line segment. */
7700
9187
  aabbIntersectsSegment(x1, y1, x2, y2) {
7701
9188
  let minX = this.minX;
7702
9189
  let minY = this.minY;
@@ -7719,9 +9206,12 @@ var spine = (() => {
7719
9206
  return true;
7720
9207
  return false;
7721
9208
  }
9209
+ /** Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds. */
7722
9210
  aabbIntersectsSkeleton(bounds) {
7723
9211
  return this.minX < bounds.maxX && this.maxX > bounds.minX && this.minY < bounds.maxY && this.maxY > bounds.minY;
7724
9212
  }
9213
+ /** Returns the first bounding box attachment that contains the point, or null. When doing many checks, it is usually more
9214
+ * efficient to only call this method if {@link #aabbContainsPoint(float, float)} returns true. */
7725
9215
  containsPoint(x, y) {
7726
9216
  let polygons = this.polygons;
7727
9217
  for (let i = 0, n = polygons.length; i < n; i++)
@@ -7729,6 +9219,7 @@ var spine = (() => {
7729
9219
  return this.boundingBoxes[i];
7730
9220
  return null;
7731
9221
  }
9222
+ /** Returns true if the polygon contains the point. */
7732
9223
  containsPointPolygon(polygon, x, y) {
7733
9224
  let vertices = polygon;
7734
9225
  let nn = polygon.length;
@@ -7746,6 +9237,9 @@ var spine = (() => {
7746
9237
  }
7747
9238
  return inside;
7748
9239
  }
9240
+ /** Returns the first bounding box attachment that contains any part of the line segment, or null. When doing many checks, it
9241
+ * is usually more efficient to only call this method if {@link #aabbIntersectsSegment()} returns
9242
+ * true. */
7749
9243
  intersectsSegment(x1, y1, x2, y2) {
7750
9244
  let polygons = this.polygons;
7751
9245
  for (let i = 0, n = polygons.length; i < n; i++)
@@ -7753,6 +9247,7 @@ var spine = (() => {
7753
9247
  return this.boundingBoxes[i];
7754
9248
  return null;
7755
9249
  }
9250
+ /** Returns true if the polygon contains any part of the line segment. */
7756
9251
  intersectsSegmentPolygon(polygon, x1, y1, x2, y2) {
7757
9252
  let vertices = polygon;
7758
9253
  let nn = polygon.length;
@@ -7775,15 +9270,18 @@ var spine = (() => {
7775
9270
  }
7776
9271
  return false;
7777
9272
  }
9273
+ /** Returns the polygon for the specified bounding box, or null. */
7778
9274
  getPolygon(boundingBox) {
7779
9275
  if (!boundingBox)
7780
9276
  throw new Error("boundingBox cannot be null.");
7781
9277
  let index = this.boundingBoxes.indexOf(boundingBox);
7782
9278
  return index == -1 ? null : this.polygons[index];
7783
9279
  }
9280
+ /** The width of the axis aligned bounding box. */
7784
9281
  getWidth() {
7785
9282
  return this.maxX - this.minX;
7786
9283
  }
9284
+ /** The height of the axis aligned bounding box. */
7787
9285
  getHeight() {
7788
9286
  return this.maxY - this.minY;
7789
9287
  }
@@ -7987,7 +9485,14 @@ var spine = (() => {
7987
9485
  let previous = indices[(vertexCount + index - 1) % vertexCount] << 1;
7988
9486
  let current = indices[index] << 1;
7989
9487
  let next = indices[(index + 1) % vertexCount] << 1;
7990
- return !this.positiveArea(vertices[previous], vertices[previous + 1], vertices[current], vertices[current + 1], vertices[next], vertices[next + 1]);
9488
+ return !this.positiveArea(
9489
+ vertices[previous],
9490
+ vertices[previous + 1],
9491
+ vertices[current],
9492
+ vertices[current + 1],
9493
+ vertices[next],
9494
+ vertices[next + 1]
9495
+ );
7991
9496
  }
7992
9497
  static positiveArea(p1x, p1y, p2x, p2y, p3x, p3y) {
7993
9498
  return p1x * (p3y - p2y) + p2x * (p1y - p3y) + p3x * (p2y - p1y) >= 0;
@@ -8177,6 +9682,8 @@ var spine = (() => {
8177
9682
  }
8178
9683
  }
8179
9684
  }
9685
+ /** Clips the input triangle against the convex, clockwise clipping area. If the triangle lies entirely within the clipping
9686
+ * area, false is returned. The clipping area must duplicate the first vertex at the end of the vertices list. */
8180
9687
  clip(x1, y1, x2, y2, x3, y3, clippingArea, output) {
8181
9688
  let originalOutput = output;
8182
9689
  let clipped = false;
@@ -8288,6 +9795,10 @@ var spine = (() => {
8288
9795
  // spine-core/src/SkeletonJson.ts
8289
9796
  var SkeletonJson = class {
8290
9797
  constructor(attachmentLoader) {
9798
+ /** Scales bone positions, image sizes, and translations as they are loaded. This allows different size images to be used at
9799
+ * runtime than were used in Spine.
9800
+ *
9801
+ * See [Scaling](http://esotericsoftware.com/spine-loading-skeleton-data#Scaling) in the Spine Runtimes Guide. */
8291
9802
  this.scale = 1;
8292
9803
  this.linkedMeshes = new Array();
8293
9804
  this.attachmentLoader = attachmentLoader;
@@ -8433,10 +9944,10 @@ var spine = (() => {
8433
9944
  data.rotateMode = Utils.enumValue(RotateMode, getValue(constraintMap, "rotateMode", "Tangent"));
8434
9945
  data.offsetRotation = getValue(constraintMap, "rotation", 0);
8435
9946
  data.position = getValue(constraintMap, "position", 0);
8436
- if (data.positionMode == PositionMode.Fixed)
9947
+ if (data.positionMode == 0 /* Fixed */)
8437
9948
  data.position *= scale;
8438
9949
  data.spacing = getValue(constraintMap, "spacing", 0);
8439
- if (data.spacingMode == SpacingMode.Length || data.spacingMode == SpacingMode.Fixed)
9950
+ if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */)
8440
9951
  data.spacing *= scale;
8441
9952
  data.mixRotate = getValue(constraintMap, "mixRotate", 1);
8442
9953
  data.mixX = getValue(constraintMap, "mixX", 1);
@@ -8977,10 +10488,10 @@ var spine = (() => {
8977
10488
  let frames = timelineMap.length;
8978
10489
  if (timelineName === "position") {
8979
10490
  let timeline = new PathConstraintPositionTimeline(frames, frames, constraintIndex);
8980
- timelines.push(readTimeline12(timelineMap, timeline, 0, constraint.positionMode == PositionMode.Fixed ? scale : 1));
10491
+ timelines.push(readTimeline12(timelineMap, timeline, 0, constraint.positionMode == 0 /* Fixed */ ? scale : 1));
8981
10492
  } else if (timelineName === "spacing") {
8982
10493
  let timeline = new PathConstraintSpacingTimeline(frames, frames, constraintIndex);
8983
- timelines.push(readTimeline12(timelineMap, timeline, 0, constraint.spacingMode == SpacingMode.Length || constraint.spacingMode == SpacingMode.Fixed ? scale : 1));
10494
+ timelines.push(readTimeline12(timelineMap, timeline, 0, constraint.spacingMode == 0 /* Length */ || constraint.spacingMode == 1 /* Fixed */ ? scale : 1));
8984
10495
  } else if (timelineName === "mix") {
8985
10496
  let timeline = new PathConstraintMixTimeline(frames, frames * 3, constraintIndex);
8986
10497
  let time = getValue(keyMap, "time", 0);
@@ -9293,7 +10804,12 @@ var spine = (() => {
9293
10804
  let image = region.page.texture.getImage();
9294
10805
  let slotColor = slot.color;
9295
10806
  let regionColor = attachment.color;
9296
- color.set(skeletonColor.r * slotColor.r * regionColor.r, skeletonColor.g * slotColor.g * regionColor.g, skeletonColor.b * slotColor.b * regionColor.b, skeletonColor.a * slotColor.a * regionColor.a);
10807
+ color.set(
10808
+ skeletonColor.r * slotColor.r * regionColor.r,
10809
+ skeletonColor.g * slotColor.g * regionColor.g,
10810
+ skeletonColor.b * slotColor.b * regionColor.b,
10811
+ skeletonColor.a * slotColor.a * regionColor.a
10812
+ );
9297
10813
  ctx.save();
9298
10814
  ctx.transform(bone.a, bone.c, bone.b, bone.d, bone.worldX, bone.worldY);
9299
10815
  ctx.translate(attachment.offset[0], attachment.offset[1]);
@@ -9349,7 +10865,12 @@ var spine = (() => {
9349
10865
  blendMode = slot.data.blendMode;
9350
10866
  let slotColor = slot.color;
9351
10867
  let attachmentColor = attachment.color;
9352
- color.set(skeletonColor.r * slotColor.r * attachmentColor.r, skeletonColor.g * slotColor.g * attachmentColor.g, skeletonColor.b * slotColor.b * attachmentColor.b, skeletonColor.a * slotColor.a * attachmentColor.a);
10868
+ color.set(
10869
+ skeletonColor.r * slotColor.r * attachmentColor.r,
10870
+ skeletonColor.g * slotColor.g * attachmentColor.g,
10871
+ skeletonColor.b * slotColor.b * attachmentColor.b,
10872
+ skeletonColor.a * slotColor.a * attachmentColor.a
10873
+ );
9353
10874
  ctx.globalAlpha = color.a;
9354
10875
  for (var j = 0; j < triangles.length; j += 3) {
9355
10876
  let t1 = triangles[j] * 8, t2 = triangles[j + 1] * 8, t3 = triangles[j + 2] * 8;
@@ -9371,6 +10892,8 @@ var spine = (() => {
9371
10892
  }
9372
10893
  this.ctx.globalAlpha = 1;
9373
10894
  }
10895
+ // Adapted from http://extremelysatisfactorytotalitarianism.com/blog/?p=2120
10896
+ // Apache 2 licensed
9374
10897
  drawTriangle(img, x0, y0, u0, v0, x1, y1, u1, v1, x2, y2, u2, v2) {
9375
10898
  let ctx = this.ctx;
9376
10899
  u0 *= img.width;
@@ -9406,7 +10929,12 @@ var spine = (() => {
9406
10929
  let alpha = skeletonColor.a * slotColor.a * regionColor.a;
9407
10930
  let multiplier = pma ? alpha : 1;
9408
10931
  let color = this.tempColor;
9409
- color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
10932
+ color.set(
10933
+ skeletonColor.r * slotColor.r * regionColor.r * multiplier,
10934
+ skeletonColor.g * slotColor.g * regionColor.g * multiplier,
10935
+ skeletonColor.b * slotColor.b * regionColor.b * multiplier,
10936
+ alpha
10937
+ );
9410
10938
  region.computeWorldVertices(slot, this.vertices, 0, _SkeletonRenderer.VERTEX_SIZE);
9411
10939
  let vertices = this.vertices;
9412
10940
  let uvs = region.uvs;
@@ -9443,7 +10971,12 @@ var spine = (() => {
9443
10971
  let alpha = skeletonColor.a * slotColor.a * regionColor.a;
9444
10972
  let multiplier = pma ? alpha : 1;
9445
10973
  let color = this.tempColor;
9446
- color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
10974
+ color.set(
10975
+ skeletonColor.r * slotColor.r * regionColor.r * multiplier,
10976
+ skeletonColor.g * slotColor.g * regionColor.g * multiplier,
10977
+ skeletonColor.b * slotColor.b * regionColor.b * multiplier,
10978
+ alpha
10979
+ );
9447
10980
  let vertexCount = mesh.worldVerticesLength / 2;
9448
10981
  let vertices = this.vertices;
9449
10982
  if (vertices.length < mesh.worldVerticesLength)
@@ -9465,6 +10998,6 @@ var spine = (() => {
9465
10998
  var SkeletonRenderer = _SkeletonRenderer;
9466
10999
  SkeletonRenderer.QUAD_TRIANGLES = [0, 1, 2, 2, 3, 0];
9467
11000
  SkeletonRenderer.VERTEX_SIZE = 2 + 2 + 4;
9468
- return src_exports;
11001
+ return __toCommonJS(src_exports);
9469
11002
  })();
9470
11003
  //# sourceMappingURL=spine-canvas.js.map