@esotericsoftware/spine-canvas 4.1.24 → 4.1.26

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;
@@ -2865,6 +3803,10 @@ var spine = (() => {
2865
3803
  this.queue.event(entry, event);
2866
3804
  }
2867
3805
  }
3806
+ /** Removes all animations from all tracks, leaving skeletons in their current pose.
3807
+ *
3808
+ * It may be desired to use {@link AnimationState#setEmptyAnimation()} to mix the skeletons back to the setup pose,
3809
+ * rather than leaving them in their current pose. */
2868
3810
  clearTracks() {
2869
3811
  let oldDrainDisabled = this.queue.drainDisabled;
2870
3812
  this.queue.drainDisabled = true;
@@ -2874,6 +3816,10 @@ var spine = (() => {
2874
3816
  this.queue.drainDisabled = oldDrainDisabled;
2875
3817
  this.queue.drain();
2876
3818
  }
3819
+ /** Removes all animations from the track, leaving skeletons in their current pose.
3820
+ *
3821
+ * It may be desired to use {@link AnimationState#setEmptyAnimation()} to mix the skeletons back to the setup pose,
3822
+ * rather than leaving them in their current pose. */
2877
3823
  clearTrack(trackIndex) {
2878
3824
  if (trackIndex >= this.tracks.length)
2879
3825
  return;
@@ -2911,12 +3857,21 @@ var spine = (() => {
2911
3857
  }
2912
3858
  this.queue.start(current);
2913
3859
  }
3860
+ /** Sets an animation by name.
3861
+ *
3862
+ * See {@link #setAnimationWith()}. */
2914
3863
  setAnimation(trackIndex, animationName, loop = false) {
2915
3864
  let animation = this.data.skeletonData.findAnimation(animationName);
2916
3865
  if (!animation)
2917
3866
  throw new Error("Animation not found: " + animationName);
2918
3867
  return this.setAnimationWith(trackIndex, animation, loop);
2919
3868
  }
3869
+ /** Sets the current animation for a track, discarding any queued animations. If the formerly current track entry was never
3870
+ * applied to a skeleton, it is replaced (not mixed from).
3871
+ * @param loop If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its
3872
+ * duration. In either case {@link TrackEntry#trackEnd} determines when the track is cleared.
3873
+ * @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
3874
+ * after the {@link AnimationStateListener#dispose()} event occurs. */
2920
3875
  setAnimationWith(trackIndex, animation, loop = false) {
2921
3876
  if (!animation)
2922
3877
  throw new Error("animation cannot be null.");
@@ -2938,12 +3893,23 @@ var spine = (() => {
2938
3893
  this.queue.drain();
2939
3894
  return entry;
2940
3895
  }
3896
+ /** Queues an animation by name.
3897
+ *
3898
+ * See {@link #addAnimationWith()}. */
2941
3899
  addAnimation(trackIndex, animationName, loop = false, delay = 0) {
2942
3900
  let animation = this.data.skeletonData.findAnimation(animationName);
2943
3901
  if (!animation)
2944
3902
  throw new Error("Animation not found: " + animationName);
2945
3903
  return this.addAnimationWith(trackIndex, animation, loop, delay);
2946
3904
  }
3905
+ /** Adds an animation to be played after the current or last queued animation for a track. If the track is empty, it is
3906
+ * equivalent to calling {@link #setAnimationWith()}.
3907
+ * @param delay If > 0, sets {@link TrackEntry#delay}. If <= 0, the delay set is the duration of the previous track entry
3908
+ * minus any mix duration (from the {@link AnimationStateData}) plus the specified `delay` (ie the mix
3909
+ * ends at (`delay` = 0) or before (`delay` < 0) the previous track entry duration). If the
3910
+ * previous entry is looping, its next loop completion is used instead of its duration.
3911
+ * @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
3912
+ * after the {@link AnimationStateListener#dispose()} event occurs. */
2947
3913
  addAnimationWith(trackIndex, animation, loop = false, delay = 0) {
2948
3914
  if (!animation)
2949
3915
  throw new Error("animation cannot be null.");
@@ -2965,12 +3931,37 @@ var spine = (() => {
2965
3931
  entry.delay = delay;
2966
3932
  return entry;
2967
3933
  }
3934
+ /** Sets an empty animation for a track, discarding any queued animations, and sets the track entry's
3935
+ * {@link TrackEntry#mixduration}. An empty animation has no timelines and serves as a placeholder for mixing in or out.
3936
+ *
3937
+ * Mixing out is done by setting an empty animation with a mix duration using either {@link #setEmptyAnimation()},
3938
+ * {@link #setEmptyAnimations()}, or {@link #addEmptyAnimation()}. Mixing to an empty animation causes
3939
+ * the previous animation to be applied less and less over the mix duration. Properties keyed in the previous animation
3940
+ * transition to the value from lower tracks or to the setup pose value if no lower tracks key the property. A mix duration of
3941
+ * 0 still mixes out over one frame.
3942
+ *
3943
+ * Mixing in is done by first setting an empty animation, then adding an animation using
3944
+ * {@link #addAnimation()} and on the returned track entry, set the
3945
+ * {@link TrackEntry#setMixDuration()}. Mixing from an empty animation causes the new animation to be applied more and
3946
+ * more over the mix duration. Properties keyed in the new animation transition from the value from lower tracks or from the
3947
+ * setup pose value if no lower tracks key the property to the value keyed in the new animation. */
2968
3948
  setEmptyAnimation(trackIndex, mixDuration = 0) {
2969
3949
  let entry = this.setAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false);
2970
3950
  entry.mixDuration = mixDuration;
2971
3951
  entry.trackEnd = mixDuration;
2972
3952
  return entry;
2973
3953
  }
3954
+ /** Adds an empty animation to be played after the current or last queued animation for a track, and sets the track entry's
3955
+ * {@link TrackEntry#mixDuration}. If the track is empty, it is equivalent to calling
3956
+ * {@link #setEmptyAnimation()}.
3957
+ *
3958
+ * See {@link #setEmptyAnimation()}.
3959
+ * @param delay If > 0, sets {@link TrackEntry#delay}. If <= 0, the delay set is the duration of the previous track entry
3960
+ * minus any mix duration plus the specified `delay` (ie the mix ends at (`delay` = 0) or
3961
+ * before (`delay` < 0) the previous track entry duration). If the previous entry is looping, its next
3962
+ * loop completion is used instead of its duration.
3963
+ * @return A track entry to allow further customization of animation playback. References to the track entry must not be kept
3964
+ * after the {@link AnimationStateListener#dispose()} event occurs. */
2974
3965
  addEmptyAnimation(trackIndex, mixDuration = 0, delay = 0) {
2975
3966
  let entry = this.addAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false, delay);
2976
3967
  if (delay <= 0)
@@ -2979,6 +3970,8 @@ var spine = (() => {
2979
3970
  entry.trackEnd = mixDuration;
2980
3971
  return entry;
2981
3972
  }
3973
+ /** Sets an empty animation for every track, discarding any queued animations, and mixes to it over the specified mix
3974
+ * duration. */
2982
3975
  setEmptyAnimations(mixDuration = 0) {
2983
3976
  let oldDrainDisabled = this.queue.drainDisabled;
2984
3977
  this.queue.drainDisabled = true;
@@ -2997,6 +3990,7 @@ var spine = (() => {
2997
3990
  this.tracks.length = index + 1;
2998
3991
  return null;
2999
3992
  }
3993
+ /** @param last May be null. */
3000
3994
  trackEntry(trackIndex, animation, loop, last) {
3001
3995
  let entry = this.trackEntryPool.obtain();
3002
3996
  entry.reset();
@@ -3024,9 +4018,10 @@ var spine = (() => {
3024
4018
  entry.mixDuration = !last ? 0 : this.data.getMix(last.animation, animation);
3025
4019
  entry.interruptAlpha = 1;
3026
4020
  entry.totalAlpha = 0;
3027
- entry.mixBlend = MixBlend.replace;
4021
+ entry.mixBlend = 2 /* replace */;
3028
4022
  return entry;
3029
4023
  }
4024
+ /** Removes the {@link TrackEntry#getNext() next entry} and all entries after it for the specified entry. */
3030
4025
  clearNext(entry) {
3031
4026
  let next = entry.next;
3032
4027
  while (next) {
@@ -3046,7 +4041,7 @@ var spine = (() => {
3046
4041
  while (entry.mixingFrom)
3047
4042
  entry = entry.mixingFrom;
3048
4043
  do {
3049
- if (!entry.mixingTo || entry.mixBlend != MixBlend.add)
4044
+ if (!entry.mixingTo || entry.mixBlend != 3 /* add */)
3050
4045
  this.computeHold(entry);
3051
4046
  entry = entry.mixingTo;
3052
4047
  } while (entry);
@@ -3089,24 +4084,31 @@ var spine = (() => {
3089
4084
  }
3090
4085
  }
3091
4086
  }
4087
+ /** Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing. */
3092
4088
  getCurrent(trackIndex) {
3093
4089
  if (trackIndex >= this.tracks.length)
3094
4090
  return null;
3095
4091
  return this.tracks[trackIndex];
3096
4092
  }
4093
+ /** Adds a listener to receive events for all track entries. */
3097
4094
  addListener(listener) {
3098
4095
  if (!listener)
3099
4096
  throw new Error("listener cannot be null.");
3100
4097
  this.listeners.push(listener);
3101
4098
  }
4099
+ /** Removes the listener added with {@link #addListener()}. */
3102
4100
  removeListener(listener) {
3103
4101
  let index = this.listeners.indexOf(listener);
3104
4102
  if (index >= 0)
3105
4103
  this.listeners.splice(index, 1);
3106
4104
  }
4105
+ /** Removes all listeners added with {@link #addListener()}. */
3107
4106
  clearListeners() {
3108
4107
  this.listeners.length = 0;
3109
4108
  }
4109
+ /** Discards all listener notifications that have not yet been delivered. This can be useful to call from an
4110
+ * {@link AnimationStateListener} when it is known that further notifications that may have been already queued for delivery
4111
+ * are not wanted because new animations are being set. */
3110
4112
  clearListenerNotifications() {
3111
4113
  this.queue.clear();
3112
4114
  }
@@ -3115,36 +4117,134 @@ var spine = (() => {
3115
4117
  AnimationState._emptyAnimation = new Animation("<empty>", [], 0);
3116
4118
  var TrackEntry = class {
3117
4119
  constructor() {
4120
+ /** The animation to apply for this track entry. */
3118
4121
  this.animation = null;
3119
4122
  this.previous = null;
4123
+ /** The animation queued to start after this animation, or null. `next` makes up a linked list. */
3120
4124
  this.next = null;
4125
+ /** The track entry for the previous animation when mixing from the previous animation to this animation, or null if no
4126
+ * mixing is currently occuring. When mixing from multiple animations, `mixingFrom` makes up a linked list. */
3121
4127
  this.mixingFrom = null;
4128
+ /** The track entry for the next animation when mixing from this animation to the next animation, or null if no mixing is
4129
+ * currently occuring. When mixing to multiple animations, `mixingTo` makes up a linked list. */
3122
4130
  this.mixingTo = null;
4131
+ /** The listener for events generated by this track entry, or null.
4132
+ *
4133
+ * A track entry returned from {@link AnimationState#setAnimation()} is already the current animation
4134
+ * for the track, so the track entry listener {@link AnimationStateListener#start()} will not be called. */
3123
4135
  this.listener = null;
4136
+ /** The index of the track where this track entry is either current or queued.
4137
+ *
4138
+ * See {@link AnimationState#getCurrent()}. */
3124
4139
  this.trackIndex = 0;
4140
+ /** If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its
4141
+ * duration. */
3125
4142
  this.loop = false;
4143
+ /** If true, when mixing from the previous animation to this animation, the previous animation is applied as normal instead
4144
+ * of being mixed out.
4145
+ *
4146
+ * When mixing between animations that key the same property, if a lower track also keys that property then the value will
4147
+ * briefly dip toward the lower track value during the mix. This happens because the first animation mixes from 100% to 0%
4148
+ * while the second animation mixes from 0% to 100%. Setting `holdPrevious` to true applies the first animation
4149
+ * at 100% during the mix so the lower track value is overwritten. Such dipping does not occur on the lowest track which
4150
+ * keys the property, only when a higher track also keys the property.
4151
+ *
4152
+ * Snapping will occur if `holdPrevious` is true and this animation does not key all the same properties as the
4153
+ * previous animation. */
3126
4154
  this.holdPrevious = false;
3127
4155
  this.reverse = false;
3128
4156
  this.shortestRotation = false;
4157
+ /** When the mix percentage ({@link #mixTime} / {@link #mixDuration}) is less than the
4158
+ * `eventThreshold`, event timelines are applied while this animation is being mixed out. Defaults to 0, so event
4159
+ * timelines are not applied while this animation is being mixed out. */
3129
4160
  this.eventThreshold = 0;
4161
+ /** When the mix percentage ({@link #mixtime} / {@link #mixDuration}) is less than the
4162
+ * `attachmentThreshold`, attachment timelines are applied while this animation is being mixed out. Defaults to
4163
+ * 0, so attachment timelines are not applied while this animation is being mixed out. */
3130
4164
  this.attachmentThreshold = 0;
4165
+ /** When the mix percentage ({@link #mixTime} / {@link #mixDuration}) is less than the
4166
+ * `drawOrderThreshold`, draw order timelines are applied while this animation is being mixed out. Defaults to 0,
4167
+ * so draw order timelines are not applied while this animation is being mixed out. */
3131
4168
  this.drawOrderThreshold = 0;
4169
+ /** Seconds when this animation starts, both initially and after looping. Defaults to 0.
4170
+ *
4171
+ * When changing the `animationStart` time, it often makes sense to set {@link #animationLast} to the same
4172
+ * value to prevent timeline keys before the start time from triggering. */
3132
4173
  this.animationStart = 0;
4174
+ /** Seconds for the last frame of this animation. Non-looping animations won't play past this time. Looping animations will
4175
+ * loop back to {@link #animationStart} at this time. Defaults to the animation {@link Animation#duration}. */
3133
4176
  this.animationEnd = 0;
4177
+ /** The time in seconds this animation was last applied. Some timelines use this for one-time triggers. Eg, when this
4178
+ * animation is applied, event timelines will fire all events between the `animationLast` time (exclusive) and
4179
+ * `animationTime` (inclusive). Defaults to -1 to ensure triggers on frame 0 happen the first time this animation
4180
+ * is applied. */
3134
4181
  this.animationLast = 0;
3135
4182
  this.nextAnimationLast = 0;
4183
+ /** Seconds to postpone playing the animation. When this track entry is the current track entry, `delay`
4184
+ * postpones incrementing the {@link #trackTime}. When this track entry is queued, `delay` is the time from
4185
+ * the start of the previous animation to when this track entry will become the current track entry (ie when the previous
4186
+ * track entry {@link TrackEntry#trackTime} >= this track entry's `delay`).
4187
+ *
4188
+ * {@link #timeScale} affects the delay. */
3136
4189
  this.delay = 0;
4190
+ /** Current time in seconds this track entry has been the current track entry. The track time determines
4191
+ * {@link #animationTime}. The track time can be set to start the animation at a time other than 0, without affecting
4192
+ * looping. */
3137
4193
  this.trackTime = 0;
3138
4194
  this.trackLast = 0;
3139
4195
  this.nextTrackLast = 0;
4196
+ /** The track time in seconds when this animation will be removed from the track. Defaults to the highest possible float
4197
+ * value, meaning the animation will be applied until a new animation is set or the track is cleared. If the track end time
4198
+ * is reached, no other animations are queued for playback, and mixing from any previous animations is complete, then the
4199
+ * properties keyed by the animation are set to the setup pose and the track is cleared.
4200
+ *
4201
+ * It may be desired to use {@link AnimationState#addEmptyAnimation()} rather than have the animation
4202
+ * abruptly cease being applied. */
3140
4203
  this.trackEnd = 0;
4204
+ /** Multiplier for the delta time when this track entry is updated, causing time for this animation to pass slower or
4205
+ * faster. Defaults to 1.
4206
+ *
4207
+ * {@link #mixTime} is not affected by track entry time scale, so {@link #mixDuration} may need to be adjusted to
4208
+ * match the animation speed.
4209
+ *
4210
+ * When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the
4211
+ * {@link #delay} is set using the mix duration from the {@link AnimationStateData}, assuming time scale to be 1. If
4212
+ * the time scale is not 1, the delay may need to be adjusted.
4213
+ *
4214
+ * See AnimationState {@link AnimationState#timeScale} for affecting all animations. */
3141
4215
  this.timeScale = 0;
4216
+ /** Values < 1 mix this animation with the skeleton's current pose (usually the pose resulting from lower tracks). Defaults
4217
+ * to 1, which overwrites the skeleton's current pose with this animation.
4218
+ *
4219
+ * Typically track 0 is used to completely pose the skeleton, then alpha is used on higher tracks. It doesn't make sense to
4220
+ * use alpha on track 0 if the skeleton pose is from the last frame render. */
3142
4221
  this.alpha = 0;
4222
+ /** Seconds from 0 to the {@link #getMixDuration()} when mixing from the previous animation to this animation. May be
4223
+ * slightly more than `mixDuration` when the mix is complete. */
3143
4224
  this.mixTime = 0;
4225
+ /** Seconds for mixing from the previous animation to this animation. Defaults to the value provided by AnimationStateData
4226
+ * {@link AnimationStateData#getMix()} based on the animation before this animation (if any).
4227
+ *
4228
+ * A mix duration of 0 still mixes out over one frame to provide the track entry being mixed out a chance to revert the
4229
+ * properties it was animating.
4230
+ *
4231
+ * The `mixDuration` can be set manually rather than use the value from
4232
+ * {@link AnimationStateData#getMix()}. In that case, the `mixDuration` can be set for a new
4233
+ * track entry only before {@link AnimationState#update(float)} is first called.
4234
+ *
4235
+ * When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the
4236
+ * {@link #delay} is set using the mix duration from the {@link AnimationStateData}, not a mix duration set
4237
+ * afterward. */
3144
4238
  this.mixDuration = 0;
3145
4239
  this.interruptAlpha = 0;
3146
4240
  this.totalAlpha = 0;
3147
- this.mixBlend = MixBlend.replace;
4241
+ /** Controls how properties keyed in the animation are mixed with lower tracks. Defaults to {@link MixBlend#replace}, which
4242
+ * replaces the values from the lower tracks with the animation values. {@link MixBlend#add} adds the animation values to
4243
+ * the values from the lower tracks.
4244
+ *
4245
+ * The `mixBlend` can be set for a new track entry only before {@link AnimationState#apply()} is first
4246
+ * called. */
4247
+ this.mixBlend = 2 /* replace */;
3148
4248
  this.timelineMode = new Array();
3149
4249
  this.timelineHoldMix = new Array();
3150
4250
  this.timelinesRotation = new Array();
@@ -3160,6 +4260,9 @@ var spine = (() => {
3160
4260
  this.timelineHoldMix.length = 0;
3161
4261
  this.timelinesRotation.length = 0;
3162
4262
  }
4263
+ /** Uses {@link #trackTime} to compute the `animationTime`, which is between {@link #animationStart}
4264
+ * and {@link #animationEnd}. When the `trackTime` is 0, the `animationTime` is equal to the
4265
+ * `animationStart` time. */
3163
4266
  getAnimationTime() {
3164
4267
  if (this.loop) {
3165
4268
  let duration = this.animationEnd - this.animationStart;
@@ -3173,9 +4276,19 @@ var spine = (() => {
3173
4276
  this.animationLast = animationLast;
3174
4277
  this.nextAnimationLast = animationLast;
3175
4278
  }
4279
+ /** Returns true if at least one loop has been completed.
4280
+ *
4281
+ * See {@link AnimationStateListener#complete()}. */
3176
4282
  isComplete() {
3177
4283
  return this.trackTime >= this.animationEnd - this.animationStart;
3178
4284
  }
4285
+ /** Resets the rotation directions for mixing this entry's rotate timelines. This can be useful to avoid bones rotating the
4286
+ * long way around when using {@link #alpha} and starting animations on other tracks.
4287
+ *
4288
+ * Mixing with {@link MixBlend#replace} involves finding a rotation between two others, which has two possible solutions:
4289
+ * the short way or the long way around. The two rotations likely change over time, so which direction is the short or long
4290
+ * way also changes. If the short way was always chosen, bones would flip to the other side when that direction became the
4291
+ * long way. TrackEntry chooses the short way the first time it is applied and remembers that direction. */
3179
4292
  resetRotationDirections() {
3180
4293
  this.timelinesRotation.length = 0;
3181
4294
  }
@@ -3297,15 +4410,15 @@ var spine = (() => {
3297
4410
  this.objects.length = 0;
3298
4411
  }
3299
4412
  };
3300
- var EventType;
3301
- (function(EventType2) {
4413
+ var EventType = /* @__PURE__ */ ((EventType2) => {
3302
4414
  EventType2[EventType2["start"] = 0] = "start";
3303
4415
  EventType2[EventType2["interrupt"] = 1] = "interrupt";
3304
4416
  EventType2[EventType2["end"] = 2] = "end";
3305
4417
  EventType2[EventType2["dispose"] = 3] = "dispose";
3306
4418
  EventType2[EventType2["complete"] = 4] = "complete";
3307
4419
  EventType2[EventType2["event"] = 5] = "event";
3308
- })(EventType || (EventType = {}));
4420
+ return EventType2;
4421
+ })(EventType || {});
3309
4422
  var AnimationStateAdapter = class {
3310
4423
  start(entry) {
3311
4424
  }
@@ -3332,11 +4445,15 @@ var spine = (() => {
3332
4445
  var AnimationStateData = class {
3333
4446
  constructor(skeletonData) {
3334
4447
  this.animationToMixTime = {};
4448
+ /** The mix duration to use when no mix duration has been defined between two animations. */
3335
4449
  this.defaultMix = 0;
3336
4450
  if (!skeletonData)
3337
4451
  throw new Error("skeletonData cannot be null.");
3338
4452
  this.skeletonData = skeletonData;
3339
4453
  }
4454
+ /** Sets a mix duration by animation name.
4455
+ *
4456
+ * See {@link #setMixWith()}. */
3340
4457
  setMix(fromName, toName, duration) {
3341
4458
  let from = this.skeletonData.findAnimation(fromName);
3342
4459
  if (!from)
@@ -3346,6 +4463,9 @@ var spine = (() => {
3346
4463
  throw new Error("Animation not found: " + toName);
3347
4464
  this.setMixWith(from, to, duration);
3348
4465
  }
4466
+ /** Sets the mix duration when changing from the specified animation to the other.
4467
+ *
4468
+ * See {@link TrackEntry#mixDuration}. */
3349
4469
  setMixWith(from, to, duration) {
3350
4470
  if (!from)
3351
4471
  throw new Error("from cannot be null.");
@@ -3354,6 +4474,8 @@ var spine = (() => {
3354
4474
  let key = from.name + "." + to.name;
3355
4475
  this.animationToMixTime[key] = duration;
3356
4476
  }
4477
+ /** Returns the mix duration to use when changing from the specified animation to the other, or the {@link #defaultMix} if
4478
+ * no mix duration has been set. */
3357
4479
  getMix(from, to) {
3358
4480
  let key = from.name + "." + to.name;
3359
4481
  let value = this.animationToMixTime[key];
@@ -3377,9 +4499,15 @@ var spine = (() => {
3377
4499
 
3378
4500
  // spine-core/src/attachments/ClippingAttachment.ts
3379
4501
  var ClippingAttachment = class extends VertexAttachment {
4502
+ // ce3a3aff
3380
4503
  constructor(name) {
3381
4504
  super(name);
4505
+ /** Clipping is performed between the clipping polygon's slot and the end slot. Returns null if clipping is done until the end of
4506
+ * the skeleton's rendering. */
3382
4507
  this.endSlot = null;
4508
+ // Nonessential.
4509
+ /** The color of the clipping polygon as it was in Spine. Available only when nonessential data was exported. Clipping polygons
4510
+ * are not usually rendered at runtime. */
3383
4511
  this.color = new Color(0.2275, 0.2275, 0.8078, 1);
3384
4512
  }
3385
4513
  copy() {
@@ -3400,8 +4528,7 @@ var spine = (() => {
3400
4528
  return this._image;
3401
4529
  }
3402
4530
  };
3403
- var TextureFilter;
3404
- (function(TextureFilter3) {
4531
+ var TextureFilter = /* @__PURE__ */ ((TextureFilter3) => {
3405
4532
  TextureFilter3[TextureFilter3["Nearest"] = 9728] = "Nearest";
3406
4533
  TextureFilter3[TextureFilter3["Linear"] = 9729] = "Linear";
3407
4534
  TextureFilter3[TextureFilter3["MipMap"] = 9987] = "MipMap";
@@ -3409,13 +4536,14 @@ var spine = (() => {
3409
4536
  TextureFilter3[TextureFilter3["MipMapLinearNearest"] = 9985] = "MipMapLinearNearest";
3410
4537
  TextureFilter3[TextureFilter3["MipMapNearestLinear"] = 9986] = "MipMapNearestLinear";
3411
4538
  TextureFilter3[TextureFilter3["MipMapLinearLinear"] = 9987] = "MipMapLinearLinear";
3412
- })(TextureFilter || (TextureFilter = {}));
3413
- var TextureWrap;
3414
- (function(TextureWrap3) {
4539
+ return TextureFilter3;
4540
+ })(TextureFilter || {});
4541
+ var TextureWrap = /* @__PURE__ */ ((TextureWrap3) => {
3415
4542
  TextureWrap3[TextureWrap3["MirroredRepeat"] = 33648] = "MirroredRepeat";
3416
4543
  TextureWrap3[TextureWrap3["ClampToEdge"] = 33071] = "ClampToEdge";
3417
4544
  TextureWrap3[TextureWrap3["Repeat"] = 10497] = "Repeat";
3418
- })(TextureWrap || (TextureWrap = {}));
4545
+ return TextureWrap3;
4546
+ })(TextureWrap || {});
3419
4547
  var TextureRegion = class {
3420
4548
  constructor() {
3421
4549
  this.u = 0;
@@ -3460,9 +4588,9 @@ var spine = (() => {
3460
4588
  };
3461
4589
  pageFields["repeat"] = (page2) => {
3462
4590
  if (entry[1].indexOf("x") != -1)
3463
- page2.uWrap = TextureWrap.Repeat;
4591
+ page2.uWrap = 10497 /* Repeat */;
3464
4592
  if (entry[1].indexOf("y") != -1)
3465
- page2.vWrap = TextureWrap.Repeat;
4593
+ page2.vWrap = 10497 /* Repeat */;
3466
4594
  };
3467
4595
  pageFields["pma"] = (page2) => {
3468
4596
  page2.pma = entry[1] == "true";
@@ -3633,10 +4761,10 @@ var spine = (() => {
3633
4761
  };
3634
4762
  var TextureAtlasPage = class {
3635
4763
  constructor(name) {
3636
- this.minFilter = TextureFilter.Nearest;
3637
- this.magFilter = TextureFilter.Nearest;
3638
- this.uWrap = TextureWrap.ClampToEdge;
3639
- this.vWrap = TextureWrap.ClampToEdge;
4764
+ this.minFilter = 9728 /* Nearest */;
4765
+ this.magFilter = 9728 /* Nearest */;
4766
+ this.uWrap = 33071 /* ClampToEdge */;
4767
+ this.vWrap = 33071 /* ClampToEdge */;
3640
4768
  this.texture = null;
3641
4769
  this.width = 0;
3642
4770
  this.height = 0;
@@ -3672,19 +4800,32 @@ var spine = (() => {
3672
4800
  constructor(name, path) {
3673
4801
  super(name);
3674
4802
  this.region = null;
4803
+ /** The UV pair for each vertex, normalized within the texture region. */
3675
4804
  this.regionUVs = [];
4805
+ /** The UV pair for each vertex, normalized within the entire texture.
4806
+ *
4807
+ * See {@link #updateUVs}. */
3676
4808
  this.uvs = [];
4809
+ /** Triplets of vertex indices which describe the mesh's triangulation. */
3677
4810
  this.triangles = [];
4811
+ /** The color to tint the mesh. */
3678
4812
  this.color = new Color(1, 1, 1, 1);
4813
+ /** The width of the mesh's image. Available only when nonessential data was exported. */
3679
4814
  this.width = 0;
4815
+ /** The height of the mesh's image. Available only when nonessential data was exported. */
3680
4816
  this.height = 0;
4817
+ /** The number of entries at the beginning of {@link #vertices} that make up the mesh hull. */
3681
4818
  this.hullLength = 0;
4819
+ /** Vertex index pairs describing edges for controling triangulation. Mesh triangles will never cross edges. Only available if
4820
+ * nonessential data was exported. Triangulation is not performed at runtime. */
3682
4821
  this.edges = [];
3683
4822
  this.parentMesh = null;
3684
4823
  this.sequence = null;
3685
4824
  this.tempColor = new Color(0, 0, 0, 0);
3686
4825
  this.path = path;
3687
4826
  }
4827
+ /** Calculates {@link #uvs} using the {@link #regionUVs} and region. Must be called if the region, the region's properties, or
4828
+ * the {@link #regionUVs} are changed. */
3688
4829
  updateRegion() {
3689
4830
  if (!this.region)
3690
4831
  throw new Error("Region not set.");
@@ -3745,9 +4886,13 @@ var spine = (() => {
3745
4886
  uvs[i + 1] = v + regionUVs[i + 1] * height;
3746
4887
  }
3747
4888
  }
4889
+ /** The parent mesh if this is a linked mesh, else null. A linked mesh shares the {@link #bones}, {@link #vertices},
4890
+ * {@link #regionUVs}, {@link #triangles}, {@link #hullLength}, {@link #edges}, {@link #width}, and {@link #height} with the
4891
+ * parent mesh, but may have a different {@link #name} or {@link #path} (and therefore a different texture). */
3748
4892
  getParentMesh() {
3749
4893
  return this.parentMesh;
3750
4894
  }
4895
+ /** @param parentMesh May be null. */
3751
4896
  setParentMesh(parentMesh) {
3752
4897
  this.parentMesh = parentMesh;
3753
4898
  if (parentMesh) {
@@ -3788,6 +4933,7 @@ var spine = (() => {
3788
4933
  this.sequence.apply(slot, this);
3789
4934
  super.computeWorldVertices(slot, start, count, worldVertices2, offset, stride);
3790
4935
  }
4936
+ /** Returns a new mesh with the {@link #parentMesh} set to this mesh's parent mesh, if any, else to this mesh. **/
3791
4937
  newLinkedMesh() {
3792
4938
  let copy = new MeshAttachment(this.name, this.path);
3793
4939
  copy.region = this.region;
@@ -3804,9 +4950,15 @@ var spine = (() => {
3804
4950
  var PathAttachment = class extends VertexAttachment {
3805
4951
  constructor(name) {
3806
4952
  super(name);
4953
+ /** The lengths along the path in the setup pose from the start of the path to the end of each Bezier curve. */
3807
4954
  this.lengths = [];
4955
+ /** If true, the start and end knots are connected. */
3808
4956
  this.closed = false;
4957
+ /** If true, additional calculations are performed to make calculating positions along the path more accurate. If false, fewer
4958
+ * calculations are performed but calculating positions along the path is less accurate. */
3809
4959
  this.constantSpeed = false;
4960
+ /** The color of the path as it was in Spine. Available only when nonessential data was exported. Paths are not usually
4961
+ * rendered at runtime. */
3810
4962
  this.color = new Color(1, 1, 1, 1);
3811
4963
  }
3812
4964
  copy() {
@@ -3828,6 +4980,8 @@ var spine = (() => {
3828
4980
  this.x = 0;
3829
4981
  this.y = 0;
3830
4982
  this.rotation = 0;
4983
+ /** The color of the point attachment as it was in Spine. Available only when nonessential data was exported. Point attachments
4984
+ * are not usually rendered at runtime. */
3831
4985
  this.color = new Color(0.38, 0.94, 0, 1);
3832
4986
  }
3833
4987
  computeWorldPosition(bone, point) {
@@ -3855,22 +5009,34 @@ var spine = (() => {
3855
5009
  var _RegionAttachment = class extends Attachment {
3856
5010
  constructor(name, path) {
3857
5011
  super(name);
5012
+ /** The local x translation. */
3858
5013
  this.x = 0;
5014
+ /** The local y translation. */
3859
5015
  this.y = 0;
5016
+ /** The local scaleX. */
3860
5017
  this.scaleX = 1;
5018
+ /** The local scaleY. */
3861
5019
  this.scaleY = 1;
5020
+ /** The local rotation. */
3862
5021
  this.rotation = 0;
5022
+ /** The width of the region attachment in Spine. */
3863
5023
  this.width = 0;
5024
+ /** The height of the region attachment in Spine. */
3864
5025
  this.height = 0;
5026
+ /** The color to tint the region attachment. */
3865
5027
  this.color = new Color(1, 1, 1, 1);
3866
5028
  this.rendererObject = null;
3867
5029
  this.region = null;
3868
5030
  this.sequence = null;
5031
+ /** For each of the 4 vertices, a pair of <code>x,y</code> values that is the local position of the vertex.
5032
+ *
5033
+ * See {@link #updateOffset()}. */
3869
5034
  this.offset = Utils.newFloatArray(8);
3870
5035
  this.uvs = Utils.newFloatArray(8);
3871
5036
  this.tempColor = new Color(1, 1, 1, 1);
3872
5037
  this.path = path;
3873
5038
  }
5039
+ /** Calculates the {@link #offset} using the region settings. Must be called after changing region settings. */
3874
5040
  updateRegion() {
3875
5041
  if (!this.region)
3876
5042
  throw new Error("Region not set.");
@@ -3934,6 +5100,14 @@ var spine = (() => {
3934
5100
  uvs[7] = region.v2;
3935
5101
  }
3936
5102
  }
5103
+ /** Transforms the attachment's four vertices to world coordinates. If the attachment has a {@link #sequence}, the region may
5104
+ * be changed.
5105
+ * <p>
5106
+ * See <a href="http://esotericsoftware.com/spine-runtime-skeletons#World-transforms">World transforms</a> in the Spine
5107
+ * Runtimes Guide.
5108
+ * @param worldVertices The output world vertices. Must have a length >= <code>offset</code> + 8.
5109
+ * @param offset The <code>worldVertices</code> index to begin writing values.
5110
+ * @param stride The number of <code>worldVertices</code> entries between the value pairs written. */
3937
5111
  computeWorldVertices(slot, worldVertices2, offset, stride) {
3938
5112
  if (this.sequence != null)
3939
5113
  this.sequence.apply(slot, this);
@@ -4073,18 +5247,34 @@ var spine = (() => {
4073
5247
  // spine-core/src/BoneData.ts
4074
5248
  var BoneData = class {
4075
5249
  constructor(index, name, parent) {
5250
+ /** The index of the bone in {@link Skeleton#getBones()}. */
4076
5251
  this.index = 0;
5252
+ /** @returns May be null. */
4077
5253
  this.parent = null;
5254
+ /** The bone's length. */
4078
5255
  this.length = 0;
5256
+ /** The local x translation. */
4079
5257
  this.x = 0;
5258
+ /** The local y translation. */
4080
5259
  this.y = 0;
5260
+ /** The local rotation. */
4081
5261
  this.rotation = 0;
5262
+ /** The local scaleX. */
4082
5263
  this.scaleX = 1;
5264
+ /** The local scaleY. */
4083
5265
  this.scaleY = 1;
5266
+ /** The local shearX. */
4084
5267
  this.shearX = 0;
5268
+ /** The local shearX. */
4085
5269
  this.shearY = 0;
5270
+ /** The transform mode for how parent world transforms affect this bone. */
4086
5271
  this.transformMode = TransformMode.Normal;
5272
+ /** When true, {@link Skeleton#updateWorldTransform()} only updates this bone if the {@link Skeleton#skin} contains this
5273
+ * bone.
5274
+ * @see Skin#bones */
4087
5275
  this.skinRequired = false;
5276
+ /** The color of the bone as it was in Spine. Available only when nonessential data was exported. Bones are not usually
5277
+ * rendered at runtime. */
4088
5278
  this.color = new Color();
4089
5279
  if (index < 0)
4090
5280
  throw new Error("index must be >= 0.");
@@ -4095,39 +5285,62 @@ var spine = (() => {
4095
5285
  this.parent = parent;
4096
5286
  }
4097
5287
  };
4098
- var TransformMode;
4099
- (function(TransformMode2) {
5288
+ var TransformMode = /* @__PURE__ */ ((TransformMode2) => {
4100
5289
  TransformMode2[TransformMode2["Normal"] = 0] = "Normal";
4101
5290
  TransformMode2[TransformMode2["OnlyTranslation"] = 1] = "OnlyTranslation";
4102
5291
  TransformMode2[TransformMode2["NoRotationOrReflection"] = 2] = "NoRotationOrReflection";
4103
5292
  TransformMode2[TransformMode2["NoScale"] = 3] = "NoScale";
4104
5293
  TransformMode2[TransformMode2["NoScaleOrReflection"] = 4] = "NoScaleOrReflection";
4105
- })(TransformMode || (TransformMode = {}));
5294
+ return TransformMode2;
5295
+ })(TransformMode || {});
4106
5296
 
4107
5297
  // spine-core/src/Bone.ts
4108
5298
  var Bone = class {
5299
+ /** @param parent May be null. */
4109
5300
  constructor(data, skeleton, parent) {
5301
+ /** The parent bone, or null if this is the root bone. */
4110
5302
  this.parent = null;
5303
+ /** The immediate children of this bone. */
4111
5304
  this.children = new Array();
5305
+ /** The local x translation. */
4112
5306
  this.x = 0;
5307
+ /** The local y translation. */
4113
5308
  this.y = 0;
5309
+ /** The local rotation in degrees, counter clockwise. */
4114
5310
  this.rotation = 0;
5311
+ /** The local scaleX. */
4115
5312
  this.scaleX = 0;
5313
+ /** The local scaleY. */
4116
5314
  this.scaleY = 0;
5315
+ /** The local shearX. */
4117
5316
  this.shearX = 0;
5317
+ /** The local shearY. */
4118
5318
  this.shearY = 0;
5319
+ /** The applied local x translation. */
4119
5320
  this.ax = 0;
5321
+ /** The applied local y translation. */
4120
5322
  this.ay = 0;
5323
+ /** The applied local rotation in degrees, counter clockwise. */
4121
5324
  this.arotation = 0;
5325
+ /** The applied local scaleX. */
4122
5326
  this.ascaleX = 0;
5327
+ /** The applied local scaleY. */
4123
5328
  this.ascaleY = 0;
5329
+ /** The applied local shearX. */
4124
5330
  this.ashearX = 0;
5331
+ /** The applied local shearY. */
4125
5332
  this.ashearY = 0;
5333
+ /** Part of the world transform matrix for the X axis. If changed, {@link #updateAppliedTransform()} should be called. */
4126
5334
  this.a = 0;
5335
+ /** Part of the world transform matrix for the Y axis. If changed, {@link #updateAppliedTransform()} should be called. */
4127
5336
  this.b = 0;
5337
+ /** Part of the world transform matrix for the X axis. If changed, {@link #updateAppliedTransform()} should be called. */
4128
5338
  this.c = 0;
5339
+ /** Part of the world transform matrix for the Y axis. If changed, {@link #updateAppliedTransform()} should be called. */
4129
5340
  this.d = 0;
5341
+ /** The world X position. If changed, {@link #updateAppliedTransform()} should be called. */
4130
5342
  this.worldY = 0;
5343
+ /** The world Y position. If changed, {@link #updateAppliedTransform()} should be called. */
4131
5344
  this.worldX = 0;
4132
5345
  this.sorted = false;
4133
5346
  this.active = false;
@@ -4140,15 +5353,26 @@ var spine = (() => {
4140
5353
  this.parent = parent;
4141
5354
  this.setToSetupPose();
4142
5355
  }
5356
+ /** Returns false when the bone has not been computed because {@link BoneData#skinRequired} is true and the
5357
+ * {@link Skeleton#skin active skin} does not {@link Skin#bones contain} this bone. */
4143
5358
  isActive() {
4144
5359
  return this.active;
4145
5360
  }
5361
+ /** Computes the world transform using the parent bone and this bone's local applied transform. */
4146
5362
  update() {
4147
5363
  this.updateWorldTransformWith(this.ax, this.ay, this.arotation, this.ascaleX, this.ascaleY, this.ashearX, this.ashearY);
4148
5364
  }
5365
+ /** Computes the world transform using the parent bone and this bone's local transform.
5366
+ *
5367
+ * See {@link #updateWorldTransformWith()}. */
4149
5368
  updateWorldTransform() {
4150
5369
  this.updateWorldTransformWith(this.x, this.y, this.rotation, this.scaleX, this.scaleY, this.shearX, this.shearY);
4151
5370
  }
5371
+ /** Computes the world transform using the parent bone and the specified local transform. The applied transform is set to the
5372
+ * specified local transform. Child bones are not updated.
5373
+ *
5374
+ * See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
5375
+ * Runtimes Guide. */
4152
5376
  updateWorldTransformWith(x, y, rotation, scaleX, scaleY, shearX, shearY) {
4153
5377
  this.ax = x;
4154
5378
  this.ay = y;
@@ -4175,7 +5399,7 @@ var spine = (() => {
4175
5399
  this.worldX = pa * x + pb * y + parent.worldX;
4176
5400
  this.worldY = pc * x + pd * y + parent.worldY;
4177
5401
  switch (this.data.transformMode) {
4178
- case TransformMode.Normal: {
5402
+ case 0 /* Normal */: {
4179
5403
  let rotationY = rotation + 90 + shearY;
4180
5404
  let la = MathUtils.cosDeg(rotation + shearX) * scaleX;
4181
5405
  let lb = MathUtils.cosDeg(rotationY) * scaleY;
@@ -4187,7 +5411,7 @@ var spine = (() => {
4187
5411
  this.d = pc * lb + pd * ld;
4188
5412
  return;
4189
5413
  }
4190
- case TransformMode.OnlyTranslation: {
5414
+ case 1 /* OnlyTranslation */: {
4191
5415
  let rotationY = rotation + 90 + shearY;
4192
5416
  this.a = MathUtils.cosDeg(rotation + shearX) * scaleX;
4193
5417
  this.b = MathUtils.cosDeg(rotationY) * scaleY;
@@ -4195,7 +5419,7 @@ var spine = (() => {
4195
5419
  this.d = MathUtils.sinDeg(rotationY) * scaleY;
4196
5420
  break;
4197
5421
  }
4198
- case TransformMode.NoRotationOrReflection: {
5422
+ case 2 /* NoRotationOrReflection */: {
4199
5423
  let s = pa * pa + pc * pc;
4200
5424
  let prx = 0;
4201
5425
  if (s > 1e-4) {
@@ -4222,8 +5446,8 @@ var spine = (() => {
4222
5446
  this.d = pc * lb + pd * ld;
4223
5447
  break;
4224
5448
  }
4225
- case TransformMode.NoScale:
4226
- case TransformMode.NoScaleOrReflection: {
5449
+ case 3 /* NoScale */:
5450
+ case 4 /* NoScaleOrReflection */: {
4227
5451
  let cos = MathUtils.cosDeg(rotation);
4228
5452
  let sin = MathUtils.sinDeg(rotation);
4229
5453
  let za = (pa * cos + pb * sin) / this.skeleton.scaleX;
@@ -4234,7 +5458,7 @@ var spine = (() => {
4234
5458
  za *= s;
4235
5459
  zc *= s;
4236
5460
  s = Math.sqrt(za * za + zc * zc);
4237
- if (this.data.transformMode == TransformMode.NoScale && pa * pd - pb * pc < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
5461
+ if (this.data.transformMode == 3 /* NoScale */ && pa * pd - pb * pc < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
4238
5462
  s = -s;
4239
5463
  let r = Math.PI / 2 + Math.atan2(zc, za);
4240
5464
  let zb = Math.cos(r) * s;
@@ -4255,6 +5479,7 @@ var spine = (() => {
4255
5479
  this.c *= this.skeleton.scaleY;
4256
5480
  this.d *= this.skeleton.scaleY;
4257
5481
  }
5482
+ /** Sets this bone's local transform to the setup pose. */
4258
5483
  setToSetupPose() {
4259
5484
  let data = this.data;
4260
5485
  this.x = data.x;
@@ -4265,18 +5490,30 @@ var spine = (() => {
4265
5490
  this.shearX = data.shearX;
4266
5491
  this.shearY = data.shearY;
4267
5492
  }
5493
+ /** The world rotation for the X axis, calculated using {@link #a} and {@link #c}. */
4268
5494
  getWorldRotationX() {
4269
5495
  return Math.atan2(this.c, this.a) * MathUtils.radDeg;
4270
5496
  }
5497
+ /** The world rotation for the Y axis, calculated using {@link #b} and {@link #d}. */
4271
5498
  getWorldRotationY() {
4272
5499
  return Math.atan2(this.d, this.b) * MathUtils.radDeg;
4273
5500
  }
5501
+ /** The magnitude (always positive) of the world scale X, calculated using {@link #a} and {@link #c}. */
4274
5502
  getWorldScaleX() {
4275
5503
  return Math.sqrt(this.a * this.a + this.c * this.c);
4276
5504
  }
5505
+ /** The magnitude (always positive) of the world scale Y, calculated using {@link #b} and {@link #d}. */
4277
5506
  getWorldScaleY() {
4278
5507
  return Math.sqrt(this.b * this.b + this.d * this.d);
4279
5508
  }
5509
+ /** Computes the applied transform values from the world transform.
5510
+ *
5511
+ * If the world transform is modified (by a constraint, {@link #rotateWorld(float)}, etc) then this method should be called so
5512
+ * the applied transform matches the world transform. The applied transform may be needed by other code (eg to apply other
5513
+ * constraints).
5514
+ *
5515
+ * Some information is ambiguous in the world transform, such as -1,-1 scale versus 180 rotation. The applied transform after
5516
+ * calling this method is equivalent to the local transform used to compute the world transform, but may not be identical. */
4280
5517
  updateAppliedTransform() {
4281
5518
  let parent = this.parent;
4282
5519
  if (!parent) {
@@ -4316,6 +5553,7 @@ var spine = (() => {
4316
5553
  this.arotation = 90 - Math.atan2(rd, rb) * MathUtils.radDeg;
4317
5554
  }
4318
5555
  }
5556
+ /** Transforms a point from world coordinates to the bone's local coordinates. */
4319
5557
  worldToLocal(world) {
4320
5558
  let invDet = 1 / (this.a * this.d - this.b * this.c);
4321
5559
  let x = world.x - this.worldX, y = world.y - this.worldY;
@@ -4323,21 +5561,28 @@ var spine = (() => {
4323
5561
  world.y = y * this.a * invDet - x * this.c * invDet;
4324
5562
  return world;
4325
5563
  }
5564
+ /** Transforms a point from the bone's local coordinates to world coordinates. */
4326
5565
  localToWorld(local) {
4327
5566
  let x = local.x, y = local.y;
4328
5567
  local.x = x * this.a + y * this.b + this.worldX;
4329
5568
  local.y = x * this.c + y * this.d + this.worldY;
4330
5569
  return local;
4331
5570
  }
5571
+ /** Transforms a world rotation to a local rotation. */
4332
5572
  worldToLocalRotation(worldRotation) {
4333
5573
  let sin = MathUtils.sinDeg(worldRotation), cos = MathUtils.cosDeg(worldRotation);
4334
5574
  return Math.atan2(this.a * sin - this.c * cos, this.d * cos - this.b * sin) * MathUtils.radDeg + this.rotation - this.shearX;
4335
5575
  }
5576
+ /** Transforms a local rotation to a world rotation. */
4336
5577
  localToWorldRotation(localRotation) {
4337
5578
  localRotation -= this.rotation - this.shearX;
4338
5579
  let sin = MathUtils.sinDeg(localRotation), cos = MathUtils.cosDeg(localRotation);
4339
5580
  return Math.atan2(cos * this.c + sin * this.d, cos * this.a + sin * this.b) * MathUtils.radDeg;
4340
5581
  }
5582
+ /** Rotates the world transform the specified amount.
5583
+ * <p>
5584
+ * After changes are made to the world transform, {@link #updateAppliedTransform()} should be called and {@link #update()} will
5585
+ * need to be called on any child bones, recursively. */
4341
5586
  rotateWorld(degrees) {
4342
5587
  let a = this.a, b = this.b, c = this.c, d = this.d;
4343
5588
  let cos = MathUtils.cosDeg(degrees), sin = MathUtils.sinDeg(degrees);
@@ -4479,17 +5724,21 @@ var spine = (() => {
4479
5724
  let atlas = new TextureAtlas(atlasText);
4480
5725
  let toLoad = atlas.pages.length, abort = false;
4481
5726
  for (let page of atlas.pages) {
4482
- this.loadTexture(!fileAlias ? parent + page.name : fileAlias[page.name], (imagePath, texture) => {
4483
- if (!abort) {
4484
- page.setTexture(texture);
4485
- if (--toLoad == 0)
4486
- this.success(success, path, atlas);
5727
+ this.loadTexture(
5728
+ !fileAlias ? parent + page.name : fileAlias[page.name],
5729
+ (imagePath, texture) => {
5730
+ if (!abort) {
5731
+ page.setTexture(texture);
5732
+ if (--toLoad == 0)
5733
+ this.success(success, path, atlas);
5734
+ }
5735
+ },
5736
+ (imagePath, message) => {
5737
+ if (!abort)
5738
+ this.error(error, path, `Couldn't load texture atlas ${path} page image: ${imagePath}`);
5739
+ abort = true;
4487
5740
  }
4488
- }, (imagePath, message) => {
4489
- if (!abort)
4490
- this.error(error, path, `Couldn't load texture atlas ${path} page image: ${imagePath}`);
4491
- abort = true;
4492
- });
5741
+ );
4493
5742
  }
4494
5743
  } catch (e) {
4495
5744
  this.error(error, path, `Couldn't parse texture atlas ${path}: ${e.message}`);
@@ -4685,10 +5934,16 @@ var spine = (() => {
4685
5934
  // spine-core/src/IkConstraint.ts
4686
5935
  var IkConstraint = class {
4687
5936
  constructor(data, skeleton) {
5937
+ /** Controls the bend direction of the IK bones, either 1 or -1. */
4688
5938
  this.bendDirection = 0;
5939
+ /** When true and only a single bone is being constrained, if the target is too close, the bone is scaled to reach it. */
4689
5940
  this.compress = false;
5941
+ /** 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
5942
+ * and the parent bone has local nonuniform scale, stretch is not applied. */
4690
5943
  this.stretch = false;
5944
+ /** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */
4691
5945
  this.mix = 1;
5946
+ /** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */
4692
5947
  this.softness = 0;
4693
5948
  this.active = false;
4694
5949
  if (!data)
@@ -4730,6 +5985,7 @@ var spine = (() => {
4730
5985
  break;
4731
5986
  }
4732
5987
  }
5988
+ /** Applies 1 bone IK. The target is specified in the world coordinate system. */
4733
5989
  apply1(bone, targetX, targetY, compress, stretch, uniform, alpha) {
4734
5990
  let p = bone.parent;
4735
5991
  if (!p)
@@ -4737,11 +5993,11 @@ var spine = (() => {
4737
5993
  let pa = p.a, pb = p.b, pc = p.c, pd = p.d;
4738
5994
  let rotationIK = -bone.ashearX - bone.arotation, tx = 0, ty = 0;
4739
5995
  switch (bone.data.transformMode) {
4740
- case TransformMode.OnlyTranslation:
5996
+ case 1 /* OnlyTranslation */:
4741
5997
  tx = targetX - bone.worldX;
4742
5998
  ty = targetY - bone.worldY;
4743
5999
  break;
4744
- case TransformMode.NoRotationOrReflection:
6000
+ case 2 /* NoRotationOrReflection */:
4745
6001
  let s = Math.abs(pa * pd - pb * pc) / (pa * pa + pc * pc);
4746
6002
  let sa = pa / bone.skeleton.scaleX;
4747
6003
  let sc = pc / bone.skeleton.scaleY;
@@ -4764,8 +6020,8 @@ var spine = (() => {
4764
6020
  let sx = bone.ascaleX, sy = bone.ascaleY;
4765
6021
  if (compress || stretch) {
4766
6022
  switch (bone.data.transformMode) {
4767
- case TransformMode.NoScale:
4768
- case TransformMode.NoScaleOrReflection:
6023
+ case 3 /* NoScale */:
6024
+ case 4 /* NoScaleOrReflection */:
4769
6025
  tx = targetX - bone.worldX;
4770
6026
  ty = targetY - bone.worldY;
4771
6027
  }
@@ -4777,8 +6033,18 @@ var spine = (() => {
4777
6033
  sy *= s;
4778
6034
  }
4779
6035
  }
4780
- bone.updateWorldTransformWith(bone.ax, bone.ay, bone.arotation + rotationIK * alpha, sx, sy, bone.ashearX, bone.ashearY);
6036
+ bone.updateWorldTransformWith(
6037
+ bone.ax,
6038
+ bone.ay,
6039
+ bone.arotation + rotationIK * alpha,
6040
+ sx,
6041
+ sy,
6042
+ bone.ashearX,
6043
+ bone.ashearY
6044
+ );
4781
6045
  }
6046
+ /** Applies 2 bone IK. The target is specified in the world coordinate system.
6047
+ * @param child A direct descendant of the parent bone. */
4782
6048
  apply2(parent, child, targetX, targetY, bendDir, stretch, uniform, softness, alpha) {
4783
6049
  let px = parent.ax, py = parent.ay, psx = parent.ascaleX, psy = parent.ascaleY, sx = psx, sy = psy, csx = child.ascaleX;
4784
6050
  let os1 = 0, os2 = 0, s2 = 0;
@@ -4933,13 +6199,23 @@ var spine = (() => {
4933
6199
  var IkConstraintData = class extends ConstraintData {
4934
6200
  constructor(name) {
4935
6201
  super(name, 0, false);
6202
+ /** The bones that are constrained by this IK constraint. */
4936
6203
  this.bones = new Array();
6204
+ /** The bone that is the IK target. */
4937
6205
  this._target = null;
6206
+ /** Controls the bend direction of the IK bones, either 1 or -1. */
4938
6207
  this.bendDirection = 1;
6208
+ /** When true and only a single bone is being constrained, if the target is too close, the bone is scaled to reach it. */
4939
6209
  this.compress = false;
6210
+ /** 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
6211
+ * and the parent bone has local nonuniform scale, stretch is not applied. */
4940
6212
  this.stretch = false;
6213
+ /** When true, only a single bone is being constrained, and {@link #getCompress()} or {@link #getStretch()} is used, the bone
6214
+ * is scaled on both the X and Y axes. */
4941
6215
  this.uniform = false;
6216
+ /** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */
4942
6217
  this.mix = 1;
6218
+ /** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */
4943
6219
  this.softness = 0;
4944
6220
  }
4945
6221
  set target(boneData) {
@@ -4957,13 +6233,21 @@ var spine = (() => {
4957
6233
  var PathConstraintData = class extends ConstraintData {
4958
6234
  constructor(name) {
4959
6235
  super(name, 0, false);
6236
+ /** The bones that will be modified by this path constraint. */
4960
6237
  this.bones = new Array();
6238
+ /** The slot whose path attachment will be used to constrained the bones. */
4961
6239
  this._target = null;
6240
+ /** The mode for positioning the first bone on the path. */
4962
6241
  this.positionMode = PositionMode.Fixed;
6242
+ /** The mode for positioning the bones after the first bone on the path. */
4963
6243
  this.spacingMode = SpacingMode.Fixed;
6244
+ /** The mode for adjusting the rotation of the bones. */
4964
6245
  this.rotateMode = RotateMode.Chain;
6246
+ /** An offset added to the constrained bone rotation. */
4965
6247
  this.offsetRotation = 0;
6248
+ /** The position along the path. */
4966
6249
  this.position = 0;
6250
+ /** The spacing between bones. */
4967
6251
  this.spacing = 0;
4968
6252
  this.mixRotate = 0;
4969
6253
  this.mixX = 0;
@@ -4979,29 +6263,31 @@ var spine = (() => {
4979
6263
  return this._target;
4980
6264
  }
4981
6265
  };
4982
- var PositionMode;
4983
- (function(PositionMode2) {
6266
+ var PositionMode = /* @__PURE__ */ ((PositionMode2) => {
4984
6267
  PositionMode2[PositionMode2["Fixed"] = 0] = "Fixed";
4985
6268
  PositionMode2[PositionMode2["Percent"] = 1] = "Percent";
4986
- })(PositionMode || (PositionMode = {}));
4987
- var SpacingMode;
4988
- (function(SpacingMode2) {
6269
+ return PositionMode2;
6270
+ })(PositionMode || {});
6271
+ var SpacingMode = /* @__PURE__ */ ((SpacingMode2) => {
4989
6272
  SpacingMode2[SpacingMode2["Length"] = 0] = "Length";
4990
6273
  SpacingMode2[SpacingMode2["Fixed"] = 1] = "Fixed";
4991
6274
  SpacingMode2[SpacingMode2["Percent"] = 2] = "Percent";
4992
6275
  SpacingMode2[SpacingMode2["Proportional"] = 3] = "Proportional";
4993
- })(SpacingMode || (SpacingMode = {}));
4994
- var RotateMode;
4995
- (function(RotateMode2) {
6276
+ return SpacingMode2;
6277
+ })(SpacingMode || {});
6278
+ var RotateMode = /* @__PURE__ */ ((RotateMode2) => {
4996
6279
  RotateMode2[RotateMode2["Tangent"] = 0] = "Tangent";
4997
6280
  RotateMode2[RotateMode2["Chain"] = 1] = "Chain";
4998
6281
  RotateMode2[RotateMode2["ChainScale"] = 2] = "ChainScale";
4999
- })(RotateMode || (RotateMode = {}));
6282
+ return RotateMode2;
6283
+ })(RotateMode || {});
5000
6284
 
5001
6285
  // spine-core/src/PathConstraint.ts
5002
6286
  var _PathConstraint = class {
5003
6287
  constructor(data, skeleton) {
6288
+ /** The position along the path. */
5004
6289
  this.position = 0;
6290
+ /** The spacing between bones. */
5005
6291
  this.spacing = 0;
5006
6292
  this.mixRotate = 0;
5007
6293
  this.mixX = 0;
@@ -5046,13 +6332,13 @@ var spine = (() => {
5046
6332
  if (mixRotate == 0 && mixX == 0 && mixY == 0)
5047
6333
  return;
5048
6334
  let data = this.data;
5049
- let tangents = data.rotateMode == RotateMode.Tangent, scale = data.rotateMode == RotateMode.ChainScale;
6335
+ let tangents = data.rotateMode == 0 /* Tangent */, scale = data.rotateMode == 2 /* ChainScale */;
5050
6336
  let bones = this.bones;
5051
6337
  let boneCount = bones.length, spacesCount = tangents ? boneCount : boneCount + 1;
5052
6338
  let spaces = Utils.setArraySize(this.spaces, spacesCount), lengths = scale ? this.lengths = Utils.setArraySize(this.lengths, boneCount) : [];
5053
6339
  let spacing = this.spacing;
5054
6340
  switch (data.spacingMode) {
5055
- case SpacingMode.Percent:
6341
+ case 2 /* Percent */:
5056
6342
  if (scale) {
5057
6343
  for (let i = 0, n = spacesCount - 1; i < n; i++) {
5058
6344
  let bone = bones[i];
@@ -5067,7 +6353,7 @@ var spine = (() => {
5067
6353
  }
5068
6354
  Utils.arrayFill(spaces, 1, spacesCount, spacing);
5069
6355
  break;
5070
- case SpacingMode.Proportional:
6356
+ case 3 /* Proportional */:
5071
6357
  let sum = 0;
5072
6358
  for (let i = 0, n = spacesCount - 1; i < n; ) {
5073
6359
  let bone = bones[i];
@@ -5092,7 +6378,7 @@ var spine = (() => {
5092
6378
  }
5093
6379
  break;
5094
6380
  default:
5095
- let lengthSpacing = data.spacingMode == SpacingMode.Length;
6381
+ let lengthSpacing = data.spacingMode == 0 /* Length */;
5096
6382
  for (let i = 0, n = spacesCount - 1; i < n; ) {
5097
6383
  let bone = bones[i];
5098
6384
  let setupLength = bone.data.length;
@@ -5113,7 +6399,7 @@ var spine = (() => {
5113
6399
  let boneX = positions[0], boneY = positions[1], offsetRotation = data.offsetRotation;
5114
6400
  let tip = false;
5115
6401
  if (offsetRotation == 0)
5116
- tip = data.rotateMode == RotateMode.Chain;
6402
+ tip = data.rotateMode == 1 /* Chain */;
5117
6403
  else {
5118
6404
  tip = false;
5119
6405
  let p = this.target.bone;
@@ -5177,14 +6463,14 @@ var spine = (() => {
5177
6463
  let lengths = path.lengths;
5178
6464
  curveCount -= closed2 ? 1 : 2;
5179
6465
  let pathLength2 = lengths[curveCount];
5180
- if (this.data.positionMode == PositionMode.Percent)
6466
+ if (this.data.positionMode == 1 /* Percent */)
5181
6467
  position *= pathLength2;
5182
6468
  let multiplier2;
5183
6469
  switch (this.data.spacingMode) {
5184
- case SpacingMode.Percent:
6470
+ case 2 /* Percent */:
5185
6471
  multiplier2 = pathLength2;
5186
6472
  break;
5187
- case SpacingMode.Proportional:
6473
+ case 3 /* Proportional */:
5188
6474
  multiplier2 = pathLength2 / spacesCount;
5189
6475
  break;
5190
6476
  default:
@@ -5235,7 +6521,20 @@ var spine = (() => {
5235
6521
  } else
5236
6522
  path.computeWorldVertices(target, curve * 6 + 2, 8, world, 0, 2);
5237
6523
  }
5238
- 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);
6524
+ this.addCurvePosition(
6525
+ p,
6526
+ world[0],
6527
+ world[1],
6528
+ world[2],
6529
+ world[3],
6530
+ world[4],
6531
+ world[5],
6532
+ world[6],
6533
+ world[7],
6534
+ out,
6535
+ o,
6536
+ tangents || i > 0 && space == 0
6537
+ );
5239
6538
  }
5240
6539
  return out;
5241
6540
  }
@@ -5287,14 +6586,14 @@ var spine = (() => {
5287
6586
  x1 = x2;
5288
6587
  y1 = y2;
5289
6588
  }
5290
- if (this.data.positionMode == PositionMode.Percent)
6589
+ if (this.data.positionMode == 1 /* Percent */)
5291
6590
  position *= pathLength;
5292
6591
  let multiplier;
5293
6592
  switch (this.data.spacingMode) {
5294
- case SpacingMode.Percent:
6593
+ case 2 /* Percent */:
5295
6594
  multiplier = pathLength;
5296
6595
  break;
5297
- case SpacingMode.Proportional:
6596
+ case 3 /* Proportional */:
5298
6597
  multiplier = pathLength / spacesCount;
5299
6598
  break;
5300
6599
  default:
@@ -5427,10 +6726,18 @@ var spine = (() => {
5427
6726
  // spine-core/src/Slot.ts
5428
6727
  var Slot = class {
5429
6728
  constructor(data, bone) {
6729
+ /** 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
6730
+ * color's alpha is not used. */
5430
6731
  this.darkColor = null;
5431
6732
  this.attachment = null;
5432
6733
  this.attachmentState = 0;
6734
+ /** The index of the texture region to display when the slot's attachment has a {@link Sequence}. -1 represents the
6735
+ * {@link Sequence#getSetupIndex()}. */
5433
6736
  this.sequenceIndex = -1;
6737
+ /** Values to deform the slot's attachment. For an unweighted mesh, the entries are local positions for each vertex. For a
6738
+ * weighted mesh, the entries are an offset for each vertex which will be added to the mesh's local vertex positions.
6739
+ *
6740
+ * See {@link VertexAttachment#computeWorldVertices()} and {@link DeformTimeline}. */
5434
6741
  this.deform = new Array();
5435
6742
  if (!data)
5436
6743
  throw new Error("data cannot be null.");
@@ -5442,12 +6749,17 @@ var spine = (() => {
5442
6749
  this.darkColor = !data.darkColor ? null : new Color();
5443
6750
  this.setToSetupPose();
5444
6751
  }
6752
+ /** The skeleton this slot belongs to. */
5445
6753
  getSkeleton() {
5446
6754
  return this.bone.skeleton;
5447
6755
  }
6756
+ /** The current attachment for the slot, or null if the slot has no attachment. */
5448
6757
  getAttachment() {
5449
6758
  return this.attachment;
5450
6759
  }
6760
+ /** Sets the slot's attachment and, if the attachment changed, resets {@link #sequenceIndex} and clears the {@link #deform}.
6761
+ * The deform is not cleared if the old attachment has the same {@link VertexAttachment#getTimelineAttachment()} as the
6762
+ * specified attachment. */
5451
6763
  setAttachment(attachment) {
5452
6764
  if (this.attachment == attachment)
5453
6765
  return;
@@ -5457,6 +6769,7 @@ var spine = (() => {
5457
6769
  this.attachment = attachment;
5458
6770
  this.sequenceIndex = -1;
5459
6771
  }
6772
+ /** Sets this slot to the setup pose. */
5460
6773
  setToSetupPose() {
5461
6774
  this.color.setFromColor(this.data.color);
5462
6775
  if (this.darkColor)
@@ -5508,7 +6821,7 @@ var spine = (() => {
5508
6821
  return this.active;
5509
6822
  }
5510
6823
  update() {
5511
- if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.mixScaleX == 0 && this.mixShearY == 0)
6824
+ if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.mixScaleY == 0 && this.mixShearY == 0)
5512
6825
  return;
5513
6826
  if (this.data.local) {
5514
6827
  if (this.data.relative)
@@ -5685,13 +6998,21 @@ var spine = (() => {
5685
6998
  };
5686
6999
 
5687
7000
  // spine-core/src/Skeleton.ts
5688
- var Skeleton = class {
7001
+ var _Skeleton = class {
5689
7002
  constructor(data) {
7003
+ /** The list of bones and constraints, sorted in the order they should be updated, as computed by {@link #updateCache()}. */
5690
7004
  this._updateCache = new Array();
7005
+ /** The skeleton's current skin. May be null. */
5691
7006
  this.skin = null;
7007
+ /** Scales the entire skeleton on the X axis. This affects all bones, even if the bone's transform mode disallows scale
7008
+ * inheritance. */
5692
7009
  this.scaleX = 1;
5693
- this.scaleY = 1;
7010
+ /** Scales the entire skeleton on the Y axis. This affects all bones, even if the bone's transform mode disallows scale
7011
+ * inheritance. */
7012
+ this._scaleY = 1;
7013
+ /** Sets the skeleton X position, which is added to the root bone worldX position. */
5694
7014
  this.x = 0;
7015
+ /** Sets the skeleton Y position, which is added to the root bone worldY position. */
5695
7016
  this.y = 0;
5696
7017
  if (!data)
5697
7018
  throw new Error("data cannot be null.");
@@ -5736,6 +7057,14 @@ var spine = (() => {
5736
7057
  this.color = new Color(1, 1, 1, 1);
5737
7058
  this.updateCache();
5738
7059
  }
7060
+ get scaleY() {
7061
+ return _Skeleton.yDown ? -this._scaleY : this._scaleY;
7062
+ }
7063
+ set scaleY(scaleY) {
7064
+ this._scaleY = scaleY;
7065
+ }
7066
+ /** Caches information about bones and constraints. Must be called if the {@link #getSkin()} is modified or if bones,
7067
+ * constraints, or weighted path attachments are added or removed. */
5739
7068
  updateCache() {
5740
7069
  let updateCache = this._updateCache;
5741
7070
  updateCache.length = 0;
@@ -5903,6 +7232,10 @@ var spine = (() => {
5903
7232
  bone.sorted = false;
5904
7233
  }
5905
7234
  }
7235
+ /** Updates the world transform for each bone and applies all constraints.
7236
+ *
7237
+ * See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
7238
+ * Runtimes Guide. */
5906
7239
  updateWorldTransform() {
5907
7240
  let bones = this.bones;
5908
7241
  for (let i = 0, n = bones.length; i < n; i++) {
@@ -5942,10 +7275,12 @@ var spine = (() => {
5942
7275
  updatable.update();
5943
7276
  }
5944
7277
  }
7278
+ /** Sets the bones, constraints, and slots to their setup pose values. */
5945
7279
  setToSetupPose() {
5946
7280
  this.setBonesToSetupPose();
5947
7281
  this.setSlotsToSetupPose();
5948
7282
  }
7283
+ /** Sets the bones and constraints to their setup pose values. */
5949
7284
  setBonesToSetupPose() {
5950
7285
  let bones = this.bones;
5951
7286
  for (let i = 0, n = bones.length; i < n; i++)
@@ -5981,17 +7316,20 @@ var spine = (() => {
5981
7316
  constraint.mixY = data.mixY;
5982
7317
  }
5983
7318
  }
7319
+ /** Sets the slots and draw order to their setup pose values. */
5984
7320
  setSlotsToSetupPose() {
5985
7321
  let slots = this.slots;
5986
7322
  Utils.arrayCopy(slots, 0, this.drawOrder, 0, slots.length);
5987
7323
  for (let i = 0, n = slots.length; i < n; i++)
5988
7324
  slots[i].setToSetupPose();
5989
7325
  }
7326
+ /** @returns May return null. */
5990
7327
  getRootBone() {
5991
7328
  if (this.bones.length == 0)
5992
7329
  return null;
5993
7330
  return this.bones[0];
5994
7331
  }
7332
+ /** @returns May be null. */
5995
7333
  findBone(boneName) {
5996
7334
  if (!boneName)
5997
7335
  throw new Error("boneName cannot be null.");
@@ -6003,6 +7341,9 @@ var spine = (() => {
6003
7341
  }
6004
7342
  return null;
6005
7343
  }
7344
+ /** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it
7345
+ * repeatedly.
7346
+ * @returns May be null. */
6006
7347
  findSlot(slotName) {
6007
7348
  if (!slotName)
6008
7349
  throw new Error("slotName cannot be null.");
@@ -6014,12 +7355,25 @@ var spine = (() => {
6014
7355
  }
6015
7356
  return null;
6016
7357
  }
7358
+ /** Sets a skin by name.
7359
+ *
7360
+ * See {@link #setSkin()}. */
6017
7361
  setSkinByName(skinName) {
6018
7362
  let skin = this.data.findSkin(skinName);
6019
7363
  if (!skin)
6020
7364
  throw new Error("Skin not found: " + skinName);
6021
7365
  this.setSkin(skin);
6022
7366
  }
7367
+ /** Sets the skin used to look up attachments before looking in the {@link SkeletonData#defaultSkin default skin}. If the
7368
+ * skin is changed, {@link #updateCache()} is called.
7369
+ *
7370
+ * Attachments from the new skin are attached if the corresponding attachment from the old skin was attached. If there was no
7371
+ * old skin, each slot's setup mode attachment is attached from the new skin.
7372
+ *
7373
+ * After changing the skin, the visible attachments can be reset to those attached in the setup pose by calling
7374
+ * {@link #setSlotsToSetupPose()}. Also, often {@link AnimationState#apply()} is called before the next time the
7375
+ * skeleton is rendered to allow any attachment keys in the current animation(s) to hide or show attachments from the new skin.
7376
+ * @param newSkin May be null. */
6023
7377
  setSkin(newSkin) {
6024
7378
  if (newSkin == this.skin)
6025
7379
  return;
@@ -6042,12 +7396,22 @@ var spine = (() => {
6042
7396
  this.skin = newSkin;
6043
7397
  this.updateCache();
6044
7398
  }
7399
+ /** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot name and attachment
7400
+ * name.
7401
+ *
7402
+ * See {@link #getAttachment()}.
7403
+ * @returns May be null. */
6045
7404
  getAttachmentByName(slotName, attachmentName) {
6046
7405
  let slot = this.data.findSlot(slotName);
6047
7406
  if (!slot)
6048
7407
  throw new Error(`Can't find slot with name ${slotName}`);
6049
7408
  return this.getAttachment(slot.index, attachmentName);
6050
7409
  }
7410
+ /** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot index and
7411
+ * attachment name. First the skin is checked and if the attachment was not found, the default skin is checked.
7412
+ *
7413
+ * See [Runtime skins](http://esotericsoftware.com/spine-runtime-skins) in the Spine Runtimes Guide.
7414
+ * @returns May be null. */
6051
7415
  getAttachment(slotIndex, attachmentName) {
6052
7416
  if (!attachmentName)
6053
7417
  throw new Error("attachmentName cannot be null.");
@@ -6060,6 +7424,9 @@ var spine = (() => {
6060
7424
  return this.data.defaultSkin.getAttachment(slotIndex, attachmentName);
6061
7425
  return null;
6062
7426
  }
7427
+ /** A convenience method to set an attachment by finding the slot with {@link #findSlot()}, finding the attachment with
7428
+ * {@link #getAttachment()}, then setting the slot's {@link Slot#attachment}.
7429
+ * @param attachmentName May be null to clear the slot's attachment. */
6063
7430
  setAttachment(slotName, attachmentName) {
6064
7431
  if (!slotName)
6065
7432
  throw new Error("slotName cannot be null.");
@@ -6079,6 +7446,9 @@ var spine = (() => {
6079
7446
  }
6080
7447
  throw new Error("Slot not found: " + slotName);
6081
7448
  }
7449
+ /** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method
7450
+ * than to call it repeatedly.
7451
+ * @return May be null. */
6082
7452
  findIkConstraint(constraintName) {
6083
7453
  if (!constraintName)
6084
7454
  throw new Error("constraintName cannot be null.");
@@ -6090,6 +7460,9 @@ var spine = (() => {
6090
7460
  }
6091
7461
  return null;
6092
7462
  }
7463
+ /** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
7464
+ * this method than to call it repeatedly.
7465
+ * @return May be null. */
6093
7466
  findTransformConstraint(constraintName) {
6094
7467
  if (!constraintName)
6095
7468
  throw new Error("constraintName cannot be null.");
@@ -6101,6 +7474,9 @@ var spine = (() => {
6101
7474
  }
6102
7475
  return null;
6103
7476
  }
7477
+ /** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
7478
+ * than to call it repeatedly.
7479
+ * @return May be null. */
6104
7480
  findPathConstraint(constraintName) {
6105
7481
  if (!constraintName)
6106
7482
  throw new Error("constraintName cannot be null.");
@@ -6112,12 +7488,18 @@ var spine = (() => {
6112
7488
  }
6113
7489
  return null;
6114
7490
  }
7491
+ /** 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 }`.
7492
+ * Note that this method will create temporary objects which can add to garbage collection pressure. Use `getBounds()` if garbage collection is a concern. */
6115
7493
  getBoundsRect() {
6116
7494
  let offset = new Vector2();
6117
7495
  let size = new Vector2();
6118
7496
  this.getBounds(offset, size);
6119
7497
  return { x: offset.x, y: offset.y, width: size.x, height: size.y };
6120
7498
  }
7499
+ /** Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose.
7500
+ * @param offset An output value, the distance from the skeleton origin to the bottom left corner of the AABB.
7501
+ * @param size An output value, the width and height of the AABB.
7502
+ * @param temp Working memory to temporarily store attachments' computed world vertices. */
6121
7503
  getBounds(offset, size, temp = new Array(2)) {
6122
7504
  if (!offset)
6123
7505
  throw new Error("offset cannot be null.");
@@ -6156,30 +7538,59 @@ var spine = (() => {
6156
7538
  size.set(maxX - minX, maxY - minY);
6157
7539
  }
6158
7540
  };
7541
+ var Skeleton = _Skeleton;
7542
+ Skeleton.yDown = false;
6159
7543
 
6160
7544
  // spine-core/src/SkeletonData.ts
6161
7545
  var SkeletonData = class {
6162
7546
  constructor() {
7547
+ /** The skeleton's name, which by default is the name of the skeleton data file, if possible. May be null. */
6163
7548
  this.name = null;
7549
+ /** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
6164
7550
  this.bones = new Array();
7551
+ // Ordered parents first.
7552
+ /** The skeleton's slots. */
6165
7553
  this.slots = new Array();
7554
+ // Setup pose draw order.
6166
7555
  this.skins = new Array();
7556
+ /** The skeleton's default skin. By default this skin contains all attachments that were not in a skin in Spine.
7557
+ *
7558
+ * See {@link Skeleton#getAttachmentByName()}.
7559
+ * May be null. */
6167
7560
  this.defaultSkin = null;
7561
+ /** The skeleton's events. */
6168
7562
  this.events = new Array();
7563
+ /** The skeleton's animations. */
6169
7564
  this.animations = new Array();
7565
+ /** The skeleton's IK constraints. */
6170
7566
  this.ikConstraints = new Array();
7567
+ /** The skeleton's transform constraints. */
6171
7568
  this.transformConstraints = new Array();
7569
+ /** The skeleton's path constraints. */
6172
7570
  this.pathConstraints = new Array();
7571
+ /** The X coordinate of the skeleton's axis aligned bounding box in the setup pose. */
6173
7572
  this.x = 0;
7573
+ /** The Y coordinate of the skeleton's axis aligned bounding box in the setup pose. */
6174
7574
  this.y = 0;
7575
+ /** The width of the skeleton's axis aligned bounding box in the setup pose. */
6175
7576
  this.width = 0;
7577
+ /** The height of the skeleton's axis aligned bounding box in the setup pose. */
6176
7578
  this.height = 0;
7579
+ /** The Spine version used to export the skeleton data, or null. */
6177
7580
  this.version = null;
7581
+ /** The skeleton data hash. This value will change if any of the skeleton data has changed. May be null. */
6178
7582
  this.hash = null;
7583
+ // Nonessential
7584
+ /** The dopesheet FPS in Spine. Available only when nonessential data was exported. */
6179
7585
  this.fps = 0;
7586
+ /** The path to the images directory as defined in Spine. Available only when nonessential data was exported. May be null. */
6180
7587
  this.imagesPath = null;
7588
+ /** The path to the audio directory as defined in Spine. Available only when nonessential data was exported. May be null. */
6181
7589
  this.audioPath = null;
6182
7590
  }
7591
+ /** Finds a bone by comparing each bone's name. It is more efficient to cache the results of this method than to call it
7592
+ * multiple times.
7593
+ * @returns May be null. */
6183
7594
  findBone(boneName) {
6184
7595
  if (!boneName)
6185
7596
  throw new Error("boneName cannot be null.");
@@ -6191,6 +7602,9 @@ var spine = (() => {
6191
7602
  }
6192
7603
  return null;
6193
7604
  }
7605
+ /** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it
7606
+ * multiple times.
7607
+ * @returns May be null. */
6194
7608
  findSlot(slotName) {
6195
7609
  if (!slotName)
6196
7610
  throw new Error("slotName cannot be null.");
@@ -6202,6 +7616,9 @@ var spine = (() => {
6202
7616
  }
6203
7617
  return null;
6204
7618
  }
7619
+ /** Finds a skin by comparing each skin's name. It is more efficient to cache the results of this method than to call it
7620
+ * multiple times.
7621
+ * @returns May be null. */
6205
7622
  findSkin(skinName) {
6206
7623
  if (!skinName)
6207
7624
  throw new Error("skinName cannot be null.");
@@ -6213,6 +7630,9 @@ var spine = (() => {
6213
7630
  }
6214
7631
  return null;
6215
7632
  }
7633
+ /** Finds an event by comparing each events's name. It is more efficient to cache the results of this method than to call it
7634
+ * multiple times.
7635
+ * @returns May be null. */
6216
7636
  findEvent(eventDataName) {
6217
7637
  if (!eventDataName)
6218
7638
  throw new Error("eventDataName cannot be null.");
@@ -6224,6 +7644,9 @@ var spine = (() => {
6224
7644
  }
6225
7645
  return null;
6226
7646
  }
7647
+ /** Finds an animation by comparing each animation's name. It is more efficient to cache the results of this method than to
7648
+ * call it multiple times.
7649
+ * @returns May be null. */
6227
7650
  findAnimation(animationName) {
6228
7651
  if (!animationName)
6229
7652
  throw new Error("animationName cannot be null.");
@@ -6235,6 +7658,9 @@ var spine = (() => {
6235
7658
  }
6236
7659
  return null;
6237
7660
  }
7661
+ /** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method
7662
+ * than to call it multiple times.
7663
+ * @return May be null. */
6238
7664
  findIkConstraint(constraintName) {
6239
7665
  if (!constraintName)
6240
7666
  throw new Error("constraintName cannot be null.");
@@ -6246,6 +7672,9 @@ var spine = (() => {
6246
7672
  }
6247
7673
  return null;
6248
7674
  }
7675
+ /** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
7676
+ * this method than to call it multiple times.
7677
+ * @return May be null. */
6249
7678
  findTransformConstraint(constraintName) {
6250
7679
  if (!constraintName)
6251
7680
  throw new Error("constraintName cannot be null.");
@@ -6257,6 +7686,9 @@ var spine = (() => {
6257
7686
  }
6258
7687
  return null;
6259
7688
  }
7689
+ /** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
7690
+ * than to call it multiple times.
7691
+ * @return May be null. */
6260
7692
  findPathConstraint(constraintName) {
6261
7693
  if (!constraintName)
6262
7694
  throw new Error("constraintName cannot be null.");
@@ -6287,6 +7719,7 @@ var spine = (() => {
6287
7719
  throw new Error("name cannot be null.");
6288
7720
  this.name = name;
6289
7721
  }
7722
+ /** Adds an attachment to the skin for the specified slot index and name. */
6290
7723
  setAttachment(slotIndex, name, attachment) {
6291
7724
  if (!attachment)
6292
7725
  throw new Error("attachment cannot be null.");
@@ -6297,6 +7730,7 @@ var spine = (() => {
6297
7730
  attachments[slotIndex] = {};
6298
7731
  attachments[slotIndex][name] = attachment;
6299
7732
  }
7733
+ /** Adds all attachments, bones, and constraints from the specified skin to this skin. */
6300
7734
  addSkin(skin) {
6301
7735
  for (let i = 0; i < skin.bones.length; i++) {
6302
7736
  let bone = skin.bones[i];
@@ -6328,6 +7762,8 @@ var spine = (() => {
6328
7762
  this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
6329
7763
  }
6330
7764
  }
7765
+ /** Adds all bones and constraints and copies of all attachments from the specified skin to this skin. Mesh attachments are not
7766
+ * copied, instead a new linked mesh is created. The attachment copies can be modified without affecting the originals. */
6331
7767
  copySkin(skin) {
6332
7768
  for (let i = 0; i < skin.bones.length; i++) {
6333
7769
  let bone = skin.bones[i];
@@ -6367,15 +7803,18 @@ var spine = (() => {
6367
7803
  }
6368
7804
  }
6369
7805
  }
7806
+ /** Returns the attachment for the specified slot index and name, or null. */
6370
7807
  getAttachment(slotIndex, name) {
6371
7808
  let dictionary = this.attachments[slotIndex];
6372
7809
  return dictionary ? dictionary[name] : null;
6373
7810
  }
7811
+ /** Removes the attachment in the skin for the specified slot index and name, if any. */
6374
7812
  removeAttachment(slotIndex, name) {
6375
7813
  let dictionary = this.attachments[slotIndex];
6376
7814
  if (dictionary)
6377
7815
  delete dictionary[name];
6378
7816
  }
7817
+ /** Returns all attachments in this skin. */
6379
7818
  getAttachments() {
6380
7819
  let entries = new Array();
6381
7820
  for (var i = 0; i < this.attachments.length; i++) {
@@ -6390,6 +7829,7 @@ var spine = (() => {
6390
7829
  }
6391
7830
  return entries;
6392
7831
  }
7832
+ /** Returns all attachments in this skin for the specified slot index. */
6393
7833
  getAttachmentsForSlot(slotIndex, attachments) {
6394
7834
  let slotAttachments = this.attachments[slotIndex];
6395
7835
  if (slotAttachments) {
@@ -6400,11 +7840,13 @@ var spine = (() => {
6400
7840
  }
6401
7841
  }
6402
7842
  }
7843
+ /** Clears all attachments, bones, and constraints. */
6403
7844
  clear() {
6404
7845
  this.attachments.length = 0;
6405
7846
  this.bones.length = 0;
6406
7847
  this.constraints.length = 0;
6407
7848
  }
7849
+ /** Attach each attachment in this skin if the corresponding attachment in the old skin is currently attached. */
6408
7850
  attachAll(skeleton, oldSkin) {
6409
7851
  let slotIndex = 0;
6410
7852
  for (let i = 0; i < skeleton.slots.length; i++) {
@@ -6430,10 +7872,17 @@ var spine = (() => {
6430
7872
  // spine-core/src/SlotData.ts
6431
7873
  var SlotData = class {
6432
7874
  constructor(index, name, boneData) {
7875
+ /** The index of the slot in {@link Skeleton#getSlots()}. */
6433
7876
  this.index = 0;
7877
+ /** The color used to tint the slot's attachment. If {@link #getDarkColor()} is set, this is used as the light color for two
7878
+ * color tinting. */
6434
7879
  this.color = new Color(1, 1, 1, 1);
7880
+ /** 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
7881
+ * color's alpha is not used. */
6435
7882
  this.darkColor = null;
7883
+ /** The name of the attachment that is visible for this slot in the setup pose, or null if no attachment is visible. */
6436
7884
  this.attachmentName = null;
7885
+ /** The blend mode for drawing the slot's attachment. */
6437
7886
  this.blendMode = BlendMode.Normal;
6438
7887
  if (index < 0)
6439
7888
  throw new Error("index must be >= 0.");
@@ -6446,19 +7895,21 @@ var spine = (() => {
6446
7895
  this.boneData = boneData;
6447
7896
  }
6448
7897
  };
6449
- var BlendMode;
6450
- (function(BlendMode3) {
7898
+ var BlendMode = /* @__PURE__ */ ((BlendMode3) => {
6451
7899
  BlendMode3[BlendMode3["Normal"] = 0] = "Normal";
6452
7900
  BlendMode3[BlendMode3["Additive"] = 1] = "Additive";
6453
7901
  BlendMode3[BlendMode3["Multiply"] = 2] = "Multiply";
6454
7902
  BlendMode3[BlendMode3["Screen"] = 3] = "Screen";
6455
- })(BlendMode || (BlendMode = {}));
7903
+ return BlendMode3;
7904
+ })(BlendMode || {});
6456
7905
 
6457
7906
  // spine-core/src/TransformConstraintData.ts
6458
7907
  var TransformConstraintData = class extends ConstraintData {
6459
7908
  constructor(name) {
6460
7909
  super(name, 0, false);
7910
+ /** The bones that will be modified by this transform constraint. */
6461
7911
  this.bones = new Array();
7912
+ /** The target bone whose world transform will be copied to the constrained bones. */
6462
7913
  this._target = null;
6463
7914
  this.mixRotate = 0;
6464
7915
  this.mixX = 0;
@@ -6466,11 +7917,17 @@ var spine = (() => {
6466
7917
  this.mixScaleX = 0;
6467
7918
  this.mixScaleY = 0;
6468
7919
  this.mixShearY = 0;
7920
+ /** An offset added to the constrained bone rotation. */
6469
7921
  this.offsetRotation = 0;
7922
+ /** An offset added to the constrained bone X translation. */
6470
7923
  this.offsetX = 0;
7924
+ /** An offset added to the constrained bone Y translation. */
6471
7925
  this.offsetY = 0;
7926
+ /** An offset added to the constrained bone scaleX. */
6472
7927
  this.offsetScaleX = 0;
7928
+ /** An offset added to the constrained bone scaleY. */
6473
7929
  this.offsetScaleY = 0;
7930
+ /** An offset added to the constrained bone shearY. */
6474
7931
  this.offsetShearY = 0;
6475
7932
  this.relative = false;
6476
7933
  this.local = false;
@@ -6489,6 +7946,10 @@ var spine = (() => {
6489
7946
  // spine-core/src/SkeletonBinary.ts
6490
7947
  var SkeletonBinary = class {
6491
7948
  constructor(attachmentLoader) {
7949
+ /** Scales bone positions, image sizes, and translations as they are loaded. This allows different size images to be used at
7950
+ * runtime than were used in Spine.
7951
+ *
7952
+ * See [Scaling](http://esotericsoftware.com/spine-loading-skeleton-data#Scaling) in the Spine Runtimes Guide. */
6492
7953
  this.scale = 1;
6493
7954
  this.linkedMeshes = new Array();
6494
7955
  this.attachmentLoader = attachmentLoader;
@@ -6621,10 +8082,10 @@ var spine = (() => {
6621
8082
  data.rotateMode = input.readInt(true);
6622
8083
  data.offsetRotation = input.readFloat();
6623
8084
  data.position = input.readFloat();
6624
- if (data.positionMode == PositionMode.Fixed)
8085
+ if (data.positionMode == 0 /* Fixed */)
6625
8086
  data.position *= scale;
6626
8087
  data.spacing = input.readFloat();
6627
- if (data.spacingMode == SpacingMode.Length || data.spacingMode == SpacingMode.Fixed)
8088
+ if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */)
6628
8089
  data.spacing *= scale;
6629
8090
  data.mixRotate = input.readFloat();
6630
8091
  data.mixX = input.readFloat();
@@ -7249,10 +8710,18 @@ var spine = (() => {
7249
8710
  for (let ii = 0, nn = input.readInt(true); ii < nn; ii++) {
7250
8711
  switch (input.readByte()) {
7251
8712
  case PATH_POSITION:
7252
- timelines.push(readTimeline1(input, new PathConstraintPositionTimeline(input.readInt(true), input.readInt(true), index), data.positionMode == PositionMode.Fixed ? scale : 1));
8713
+ timelines.push(readTimeline1(
8714
+ input,
8715
+ new PathConstraintPositionTimeline(input.readInt(true), input.readInt(true), index),
8716
+ data.positionMode == 0 /* Fixed */ ? scale : 1
8717
+ ));
7253
8718
  break;
7254
8719
  case PATH_SPACING:
7255
- timelines.push(readTimeline1(input, new PathConstraintSpacingTimeline(input.readInt(true), input.readInt(true), index), data.spacingMode == SpacingMode.Length || data.spacingMode == SpacingMode.Fixed ? scale : 1));
8720
+ timelines.push(readTimeline1(
8721
+ input,
8722
+ new PathConstraintSpacingTimeline(input.readInt(true), input.readInt(true), index),
8723
+ data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */ ? scale : 1
8724
+ ));
7256
8725
  break;
7257
8726
  case PATH_MIX:
7258
8727
  let timeline = new PathConstraintMixTimeline(input.readInt(true), input.readInt(true), index);
@@ -7343,7 +8812,13 @@ var spine = (() => {
7343
8812
  for (let frame = 0; frame < frameCount; frame++) {
7344
8813
  let time = input.readFloat();
7345
8814
  let modeAndIndex = input.readInt32();
7346
- timeline.setFrame(frame, time, SequenceModeValues[modeAndIndex & 15], modeAndIndex >> 4, input.readFloat());
8815
+ timeline.setFrame(
8816
+ frame,
8817
+ time,
8818
+ SequenceModeValues[modeAndIndex & 15],
8819
+ modeAndIndex >> 4,
8820
+ input.readFloat()
8821
+ );
7347
8822
  }
7348
8823
  timelines.push(timeline);
7349
8824
  break;
@@ -7504,8 +8979,7 @@ var spine = (() => {
7504
8979
  this.vertices = vertices;
7505
8980
  }
7506
8981
  };
7507
- var AttachmentType;
7508
- (function(AttachmentType2) {
8982
+ var AttachmentType = /* @__PURE__ */ ((AttachmentType2) => {
7509
8983
  AttachmentType2[AttachmentType2["Region"] = 0] = "Region";
7510
8984
  AttachmentType2[AttachmentType2["BoundingBox"] = 1] = "BoundingBox";
7511
8985
  AttachmentType2[AttachmentType2["Mesh"] = 2] = "Mesh";
@@ -7513,7 +8987,8 @@ var spine = (() => {
7513
8987
  AttachmentType2[AttachmentType2["Path"] = 4] = "Path";
7514
8988
  AttachmentType2[AttachmentType2["Point"] = 5] = "Point";
7515
8989
  AttachmentType2[AttachmentType2["Clipping"] = 6] = "Clipping";
7516
- })(AttachmentType || (AttachmentType = {}));
8990
+ return AttachmentType2;
8991
+ })(AttachmentType || {});
7517
8992
  function readTimeline1(input, timeline, scale) {
7518
8993
  let time = input.readFloat(), value = input.readFloat() * scale;
7519
8994
  for (let frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1; ; frame++) {
@@ -7584,16 +9059,26 @@ var spine = (() => {
7584
9059
  // spine-core/src/SkeletonBounds.ts
7585
9060
  var SkeletonBounds = class {
7586
9061
  constructor() {
9062
+ /** The left edge of the axis aligned bounding box. */
7587
9063
  this.minX = 0;
9064
+ /** The bottom edge of the axis aligned bounding box. */
7588
9065
  this.minY = 0;
9066
+ /** The right edge of the axis aligned bounding box. */
7589
9067
  this.maxX = 0;
9068
+ /** The top edge of the axis aligned bounding box. */
7590
9069
  this.maxY = 0;
9070
+ /** The visible bounding boxes. */
7591
9071
  this.boundingBoxes = new Array();
9072
+ /** The world vertices for the bounding box polygons. */
7592
9073
  this.polygons = new Array();
7593
9074
  this.polygonPool = new Pool(() => {
7594
9075
  return Utils.newFloatArray(16);
7595
9076
  });
7596
9077
  }
9078
+ /** Clears any previous polygons, finds all visible bounding box attachments, and computes the world vertices for each bounding
9079
+ * box's polygon.
9080
+ * @param updateAabb If true, the axis aligned bounding box containing all the polygons is computed. If false, the
9081
+ * SkeletonBounds AABB methods will always return true. */
7597
9082
  update(skeleton, updateAabb) {
7598
9083
  if (!skeleton)
7599
9084
  throw new Error("skeleton cannot be null.");
@@ -7650,9 +9135,11 @@ var spine = (() => {
7650
9135
  this.maxX = maxX;
7651
9136
  this.maxY = maxY;
7652
9137
  }
9138
+ /** Returns true if the axis aligned bounding box contains the point. */
7653
9139
  aabbContainsPoint(x, y) {
7654
9140
  return x >= this.minX && x <= this.maxX && y >= this.minY && y <= this.maxY;
7655
9141
  }
9142
+ /** Returns true if the axis aligned bounding box intersects the line segment. */
7656
9143
  aabbIntersectsSegment(x1, y1, x2, y2) {
7657
9144
  let minX = this.minX;
7658
9145
  let minY = this.minY;
@@ -7675,9 +9162,12 @@ var spine = (() => {
7675
9162
  return true;
7676
9163
  return false;
7677
9164
  }
9165
+ /** Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds. */
7678
9166
  aabbIntersectsSkeleton(bounds) {
7679
9167
  return this.minX < bounds.maxX && this.maxX > bounds.minX && this.minY < bounds.maxY && this.maxY > bounds.minY;
7680
9168
  }
9169
+ /** Returns the first bounding box attachment that contains the point, or null. When doing many checks, it is usually more
9170
+ * efficient to only call this method if {@link #aabbContainsPoint(float, float)} returns true. */
7681
9171
  containsPoint(x, y) {
7682
9172
  let polygons = this.polygons;
7683
9173
  for (let i = 0, n = polygons.length; i < n; i++)
@@ -7685,6 +9175,7 @@ var spine = (() => {
7685
9175
  return this.boundingBoxes[i];
7686
9176
  return null;
7687
9177
  }
9178
+ /** Returns true if the polygon contains the point. */
7688
9179
  containsPointPolygon(polygon, x, y) {
7689
9180
  let vertices = polygon;
7690
9181
  let nn = polygon.length;
@@ -7702,6 +9193,9 @@ var spine = (() => {
7702
9193
  }
7703
9194
  return inside;
7704
9195
  }
9196
+ /** Returns the first bounding box attachment that contains any part of the line segment, or null. When doing many checks, it
9197
+ * is usually more efficient to only call this method if {@link #aabbIntersectsSegment()} returns
9198
+ * true. */
7705
9199
  intersectsSegment(x1, y1, x2, y2) {
7706
9200
  let polygons = this.polygons;
7707
9201
  for (let i = 0, n = polygons.length; i < n; i++)
@@ -7709,6 +9203,7 @@ var spine = (() => {
7709
9203
  return this.boundingBoxes[i];
7710
9204
  return null;
7711
9205
  }
9206
+ /** Returns true if the polygon contains any part of the line segment. */
7712
9207
  intersectsSegmentPolygon(polygon, x1, y1, x2, y2) {
7713
9208
  let vertices = polygon;
7714
9209
  let nn = polygon.length;
@@ -7731,15 +9226,18 @@ var spine = (() => {
7731
9226
  }
7732
9227
  return false;
7733
9228
  }
9229
+ /** Returns the polygon for the specified bounding box, or null. */
7734
9230
  getPolygon(boundingBox) {
7735
9231
  if (!boundingBox)
7736
9232
  throw new Error("boundingBox cannot be null.");
7737
9233
  let index = this.boundingBoxes.indexOf(boundingBox);
7738
9234
  return index == -1 ? null : this.polygons[index];
7739
9235
  }
9236
+ /** The width of the axis aligned bounding box. */
7740
9237
  getWidth() {
7741
9238
  return this.maxX - this.minX;
7742
9239
  }
9240
+ /** The height of the axis aligned bounding box. */
7743
9241
  getHeight() {
7744
9242
  return this.maxY - this.minY;
7745
9243
  }
@@ -7943,7 +9441,14 @@ var spine = (() => {
7943
9441
  let previous = indices[(vertexCount + index - 1) % vertexCount] << 1;
7944
9442
  let current = indices[index] << 1;
7945
9443
  let next = indices[(index + 1) % vertexCount] << 1;
7946
- return !this.positiveArea(vertices[previous], vertices[previous + 1], vertices[current], vertices[current + 1], vertices[next], vertices[next + 1]);
9444
+ return !this.positiveArea(
9445
+ vertices[previous],
9446
+ vertices[previous + 1],
9447
+ vertices[current],
9448
+ vertices[current + 1],
9449
+ vertices[next],
9450
+ vertices[next + 1]
9451
+ );
7947
9452
  }
7948
9453
  static positiveArea(p1x, p1y, p2x, p2y, p3x, p3y) {
7949
9454
  return p1x * (p3y - p2y) + p2x * (p1y - p3y) + p3x * (p2y - p1y) >= 0;
@@ -8133,6 +9638,8 @@ var spine = (() => {
8133
9638
  }
8134
9639
  }
8135
9640
  }
9641
+ /** Clips the input triangle against the convex, clockwise clipping area. If the triangle lies entirely within the clipping
9642
+ * area, false is returned. The clipping area must duplicate the first vertex at the end of the vertices list. */
8136
9643
  clip(x1, y1, x2, y2, x3, y3, clippingArea, output) {
8137
9644
  let originalOutput = output;
8138
9645
  let clipped = false;
@@ -8244,6 +9751,10 @@ var spine = (() => {
8244
9751
  // spine-core/src/SkeletonJson.ts
8245
9752
  var SkeletonJson = class {
8246
9753
  constructor(attachmentLoader) {
9754
+ /** Scales bone positions, image sizes, and translations as they are loaded. This allows different size images to be used at
9755
+ * runtime than were used in Spine.
9756
+ *
9757
+ * See [Scaling](http://esotericsoftware.com/spine-loading-skeleton-data#Scaling) in the Spine Runtimes Guide. */
8247
9758
  this.scale = 1;
8248
9759
  this.linkedMeshes = new Array();
8249
9760
  this.attachmentLoader = attachmentLoader;
@@ -8389,10 +9900,10 @@ var spine = (() => {
8389
9900
  data.rotateMode = Utils.enumValue(RotateMode, getValue(constraintMap, "rotateMode", "Tangent"));
8390
9901
  data.offsetRotation = getValue(constraintMap, "rotation", 0);
8391
9902
  data.position = getValue(constraintMap, "position", 0);
8392
- if (data.positionMode == PositionMode.Fixed)
9903
+ if (data.positionMode == 0 /* Fixed */)
8393
9904
  data.position *= scale;
8394
9905
  data.spacing = getValue(constraintMap, "spacing", 0);
8395
- if (data.spacingMode == SpacingMode.Length || data.spacingMode == SpacingMode.Fixed)
9906
+ if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */)
8396
9907
  data.spacing *= scale;
8397
9908
  data.mixRotate = getValue(constraintMap, "mixRotate", 1);
8398
9909
  data.mixX = getValue(constraintMap, "mixX", 1);
@@ -8933,10 +10444,10 @@ var spine = (() => {
8933
10444
  let frames = timelineMap.length;
8934
10445
  if (timelineName === "position") {
8935
10446
  let timeline = new PathConstraintPositionTimeline(frames, frames, constraintIndex);
8936
- timelines.push(readTimeline12(timelineMap, timeline, 0, constraint.positionMode == PositionMode.Fixed ? scale : 1));
10447
+ timelines.push(readTimeline12(timelineMap, timeline, 0, constraint.positionMode == 0 /* Fixed */ ? scale : 1));
8937
10448
  } else if (timelineName === "spacing") {
8938
10449
  let timeline = new PathConstraintSpacingTimeline(frames, frames, constraintIndex);
8939
- timelines.push(readTimeline12(timelineMap, timeline, 0, constraint.spacingMode == SpacingMode.Length || constraint.spacingMode == SpacingMode.Fixed ? scale : 1));
10450
+ timelines.push(readTimeline12(timelineMap, timeline, 0, constraint.spacingMode == 0 /* Length */ || constraint.spacingMode == 1 /* Fixed */ ? scale : 1));
8940
10451
  } else if (timelineName === "mix") {
8941
10452
  let timeline = new PathConstraintMixTimeline(frames, frames * 3, constraintIndex);
8942
10453
  let time = getValue(keyMap, "time", 0);
@@ -9249,7 +10760,12 @@ var spine = (() => {
9249
10760
  let image = region.page.texture.getImage();
9250
10761
  let slotColor = slot.color;
9251
10762
  let regionColor = attachment.color;
9252
- 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);
10763
+ color.set(
10764
+ skeletonColor.r * slotColor.r * regionColor.r,
10765
+ skeletonColor.g * slotColor.g * regionColor.g,
10766
+ skeletonColor.b * slotColor.b * regionColor.b,
10767
+ skeletonColor.a * slotColor.a * regionColor.a
10768
+ );
9253
10769
  ctx.save();
9254
10770
  ctx.transform(bone.a, bone.c, bone.b, bone.d, bone.worldX, bone.worldY);
9255
10771
  ctx.translate(attachment.offset[0], attachment.offset[1]);
@@ -9305,7 +10821,12 @@ var spine = (() => {
9305
10821
  blendMode = slot.data.blendMode;
9306
10822
  let slotColor = slot.color;
9307
10823
  let attachmentColor = attachment.color;
9308
- 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);
10824
+ color.set(
10825
+ skeletonColor.r * slotColor.r * attachmentColor.r,
10826
+ skeletonColor.g * slotColor.g * attachmentColor.g,
10827
+ skeletonColor.b * slotColor.b * attachmentColor.b,
10828
+ skeletonColor.a * slotColor.a * attachmentColor.a
10829
+ );
9309
10830
  ctx.globalAlpha = color.a;
9310
10831
  for (var j = 0; j < triangles.length; j += 3) {
9311
10832
  let t1 = triangles[j] * 8, t2 = triangles[j + 1] * 8, t3 = triangles[j + 2] * 8;
@@ -9327,6 +10848,8 @@ var spine = (() => {
9327
10848
  }
9328
10849
  this.ctx.globalAlpha = 1;
9329
10850
  }
10851
+ // Adapted from http://extremelysatisfactorytotalitarianism.com/blog/?p=2120
10852
+ // Apache 2 licensed
9330
10853
  drawTriangle(img, x0, y0, u0, v0, x1, y1, u1, v1, x2, y2, u2, v2) {
9331
10854
  let ctx = this.ctx;
9332
10855
  u0 *= img.width;
@@ -9362,7 +10885,12 @@ var spine = (() => {
9362
10885
  let alpha = skeletonColor.a * slotColor.a * regionColor.a;
9363
10886
  let multiplier = pma ? alpha : 1;
9364
10887
  let color = this.tempColor;
9365
- color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
10888
+ color.set(
10889
+ skeletonColor.r * slotColor.r * regionColor.r * multiplier,
10890
+ skeletonColor.g * slotColor.g * regionColor.g * multiplier,
10891
+ skeletonColor.b * slotColor.b * regionColor.b * multiplier,
10892
+ alpha
10893
+ );
9366
10894
  region.computeWorldVertices(slot, this.vertices, 0, _SkeletonRenderer.VERTEX_SIZE);
9367
10895
  let vertices = this.vertices;
9368
10896
  let uvs = region.uvs;
@@ -9399,7 +10927,12 @@ var spine = (() => {
9399
10927
  let alpha = skeletonColor.a * slotColor.a * regionColor.a;
9400
10928
  let multiplier = pma ? alpha : 1;
9401
10929
  let color = this.tempColor;
9402
- color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
10930
+ color.set(
10931
+ skeletonColor.r * slotColor.r * regionColor.r * multiplier,
10932
+ skeletonColor.g * slotColor.g * regionColor.g * multiplier,
10933
+ skeletonColor.b * slotColor.b * regionColor.b * multiplier,
10934
+ alpha
10935
+ );
9403
10936
  let vertexCount = mesh.worldVerticesLength / 2;
9404
10937
  let vertices = this.vertices;
9405
10938
  if (vertices.length < mesh.worldVerticesLength)
@@ -9421,6 +10954,6 @@ var spine = (() => {
9421
10954
  var SkeletonRenderer = _SkeletonRenderer;
9422
10955
  SkeletonRenderer.QUAD_TRIANGLES = [0, 1, 2, 2, 3, 0];
9423
10956
  SkeletonRenderer.VERTEX_SIZE = 2 + 2 + 4;
9424
- return src_exports;
10957
+ return __toCommonJS(src_exports);
9425
10958
  })();
9426
10959
  //# sourceMappingURL=spine-canvas.js.map