@esotericsoftware/spine-core 4.2.80 → 4.2.82

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.
@@ -4,7 +4,6 @@ var spine = (() => {
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
7
  var __export = (target, all) => {
9
8
  for (var name in all)
10
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -18,14 +17,10 @@ var spine = (() => {
18
17
  return to;
19
18
  };
20
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
- var __publicField = (obj, key, value) => {
22
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
23
- return value;
24
- };
25
20
 
26
21
  // spine-core/src/index.ts
27
- var src_exports = {};
28
- __export(src_exports, {
22
+ var index_exports = {};
23
+ __export(index_exports, {
29
24
  AlphaTimeline: () => AlphaTimeline,
30
25
  Animation: () => Animation,
31
26
  AnimationState: () => AnimationState,
@@ -188,13 +183,18 @@ var spine = (() => {
188
183
  this.size = 0;
189
184
  }
190
185
  };
191
- var _Color = class {
186
+ var Color = class _Color {
192
187
  constructor(r = 0, g = 0, b = 0, a = 0) {
193
188
  this.r = r;
194
189
  this.g = g;
195
190
  this.b = b;
196
191
  this.a = a;
197
192
  }
193
+ static WHITE = new _Color(1, 1, 1, 1);
194
+ static RED = new _Color(1, 0, 0, 1);
195
+ static GREEN = new _Color(0, 1, 0, 1);
196
+ static BLUE = new _Color(0, 0, 1, 1);
197
+ static MAGENTA = new _Color(1, 0, 1, 1);
198
198
  set(r, g, b, a) {
199
199
  this.r = r;
200
200
  this.g = g;
@@ -225,22 +225,14 @@ var spine = (() => {
225
225
  return this.clamp();
226
226
  }
227
227
  clamp() {
228
- if (this.r < 0)
229
- this.r = 0;
230
- else if (this.r > 1)
231
- this.r = 1;
232
- if (this.g < 0)
233
- this.g = 0;
234
- else if (this.g > 1)
235
- this.g = 1;
236
- if (this.b < 0)
237
- this.b = 0;
238
- else if (this.b > 1)
239
- this.b = 1;
240
- if (this.a < 0)
241
- this.a = 0;
242
- else if (this.a > 1)
243
- this.a = 1;
228
+ if (this.r < 0) this.r = 0;
229
+ else if (this.r > 1) this.r = 1;
230
+ if (this.g < 0) this.g = 0;
231
+ else if (this.g > 1) this.g = 1;
232
+ if (this.b < 0) this.b = 0;
233
+ else if (this.b > 1) this.b = 1;
234
+ if (this.a < 0) this.a = 0;
235
+ else if (this.a > 1) this.a = 1;
244
236
  return this;
245
237
  }
246
238
  static rgba8888ToColor(color, value) {
@@ -258,22 +250,21 @@ var spine = (() => {
258
250
  const hex = (x) => ("0" + (x * 255).toString(16)).slice(-2);
259
251
  return Number("0x" + hex(this.r) + hex(this.g) + hex(this.b));
260
252
  }
261
- static fromString(hex) {
262
- return new _Color().setFromString(hex);
253
+ static fromString(hex, color = new _Color()) {
254
+ return color.setFromString(hex);
263
255
  }
264
256
  };
265
- var Color = _Color;
266
- __publicField(Color, "WHITE", new _Color(1, 1, 1, 1));
267
- __publicField(Color, "RED", new _Color(1, 0, 0, 1));
268
- __publicField(Color, "GREEN", new _Color(0, 1, 0, 1));
269
- __publicField(Color, "BLUE", new _Color(0, 0, 1, 1));
270
- __publicField(Color, "MAGENTA", new _Color(1, 0, 1, 1));
271
- var _MathUtils = class {
257
+ var MathUtils = class _MathUtils {
258
+ static PI = 3.1415927;
259
+ static PI2 = _MathUtils.PI * 2;
260
+ static invPI2 = 1 / _MathUtils.PI2;
261
+ static radiansToDegrees = 180 / _MathUtils.PI;
262
+ static radDeg = _MathUtils.radiansToDegrees;
263
+ static degreesToRadians = _MathUtils.PI / 180;
264
+ static degRad = _MathUtils.degreesToRadians;
272
265
  static clamp(value, min, max) {
273
- if (value < min)
274
- return min;
275
- if (value > max)
276
- return max;
266
+ if (value < min) return min;
267
+ if (value > max) return max;
277
268
  return value;
278
269
  }
279
270
  static cosDeg(degrees) {
@@ -301,22 +292,13 @@ var spine = (() => {
301
292
  static randomTriangularWith(min, max, mode) {
302
293
  let u = Math.random();
303
294
  let d = max - min;
304
- if (u <= (mode - min) / d)
305
- return min + Math.sqrt(u * d * (mode - min));
295
+ if (u <= (mode - min) / d) return min + Math.sqrt(u * d * (mode - min));
306
296
  return max - Math.sqrt((1 - u) * d * (max - mode));
307
297
  }
308
298
  static isPowerOfTwo(value) {
309
299
  return value && (value & value - 1) === 0;
310
300
  }
311
301
  };
312
- var MathUtils = _MathUtils;
313
- __publicField(MathUtils, "PI", 3.1415927);
314
- __publicField(MathUtils, "PI2", _MathUtils.PI * 2);
315
- __publicField(MathUtils, "invPI2", 1 / _MathUtils.PI2);
316
- __publicField(MathUtils, "radiansToDegrees", 180 / _MathUtils.PI);
317
- __publicField(MathUtils, "radDeg", _MathUtils.radiansToDegrees);
318
- __publicField(MathUtils, "degreesToRadians", _MathUtils.PI / 180);
319
- __publicField(MathUtils, "degRad", _MathUtils.degreesToRadians);
320
302
  var Interpolation = class {
321
303
  apply(start, end, a) {
322
304
  return start + (end - start) * this.applyInternal(a);
@@ -329,8 +311,7 @@ var spine = (() => {
329
311
  this.power = power;
330
312
  }
331
313
  applyInternal(a) {
332
- if (a <= 0.5)
333
- return Math.pow(a * 2, this.power) / 2;
314
+ if (a <= 0.5) return Math.pow(a * 2, this.power) / 2;
334
315
  return Math.pow((a - 1) * 2, this.power) / (this.power % 2 == 0 ? -2 : 2) + 1;
335
316
  }
336
317
  };
@@ -342,7 +323,8 @@ var spine = (() => {
342
323
  return Math.pow(a - 1, this.power) * (this.power % 2 == 0 ? -1 : 1) + 1;
343
324
  }
344
325
  };
345
- var _Utils = class {
326
+ var Utils = class _Utils {
327
+ static SUPPORTS_TYPED_ARRAYS = typeof Float32Array !== "undefined";
346
328
  static arrayCopy(source, sourceStart, dest, destStart, numElements) {
347
329
  for (let i = sourceStart, j = destStart; i < sourceStart + numElements; i++, j++) {
348
330
  dest[j] = source[i];
@@ -354,24 +336,20 @@ var spine = (() => {
354
336
  }
355
337
  static setArraySize(array, size, value = 0) {
356
338
  let oldSize = array.length;
357
- if (oldSize == size)
358
- return array;
339
+ if (oldSize == size) return array;
359
340
  array.length = size;
360
341
  if (oldSize < size) {
361
- for (let i = oldSize; i < size; i++)
362
- array[i] = value;
342
+ for (let i = oldSize; i < size; i++) array[i] = value;
363
343
  }
364
344
  return array;
365
345
  }
366
346
  static ensureArrayCapacity(array, size, value = 0) {
367
- if (array.length >= size)
368
- return array;
347
+ if (array.length >= size) return array;
369
348
  return _Utils.setArraySize(array, size, value);
370
349
  }
371
350
  static newArray(size, defaultValue) {
372
351
  let array = new Array(size);
373
- for (let i = 0; i < size; i++)
374
- array[i] = defaultValue;
352
+ for (let i = 0; i < size; i++) array[i] = defaultValue;
375
353
  return array;
376
354
  }
377
355
  static newFloatArray(size) {
@@ -379,8 +357,7 @@ var spine = (() => {
379
357
  return new Float32Array(size);
380
358
  else {
381
359
  let array = new Array(size);
382
- for (let i = 0; i < array.length; i++)
383
- array[i] = 0;
360
+ for (let i = 0; i < array.length; i++) array[i] = 0;
384
361
  return array;
385
362
  }
386
363
  }
@@ -389,8 +366,7 @@ var spine = (() => {
389
366
  return new Int16Array(size);
390
367
  else {
391
368
  let array = new Array(size);
392
- for (let i = 0; i < array.length; i++)
393
- array[i] = 0;
369
+ for (let i = 0; i < array.length; i++) array[i] = 0;
394
370
  return array;
395
371
  }
396
372
  }
@@ -405,16 +381,13 @@ var spine = (() => {
405
381
  }
406
382
  static contains(array, element, identity = true) {
407
383
  for (var i = 0; i < array.length; i++)
408
- if (array[i] == element)
409
- return true;
384
+ if (array[i] == element) return true;
410
385
  return false;
411
386
  }
412
387
  static enumValue(type, name) {
413
388
  return type[name[0].toUpperCase() + name.slice(1)];
414
389
  }
415
390
  };
416
- var Utils = _Utils;
417
- __publicField(Utils, "SUPPORTS_TYPED_ARRAYS", typeof Float32Array !== "undefined");
418
391
  var DebugUtils = class {
419
392
  static logBones(skeleton) {
420
393
  for (let i = 0; i < skeleton.bones.length; i++) {
@@ -433,8 +406,7 @@ var spine = (() => {
433
406
  return this.items.length > 0 ? this.items.pop() : this.instantiator();
434
407
  }
435
408
  free(item) {
436
- if (item.reset)
437
- item.reset();
409
+ if (item.reset) item.reset();
438
410
  this.items.push(item);
439
411
  }
440
412
  freeAll(items) {
@@ -482,8 +454,7 @@ var spine = (() => {
482
454
  this.delta = now - this.lastTime;
483
455
  this.frameTime += this.delta;
484
456
  this.totalTime += this.delta;
485
- if (this.delta > this.maxDelta)
486
- this.delta = this.maxDelta;
457
+ if (this.delta > this.maxDelta) this.delta = this.maxDelta;
487
458
  this.lastTime = now;
488
459
  this.frameCount++;
489
460
  if (this.frameTime > 1) {
@@ -506,11 +477,9 @@ var spine = (() => {
506
477
  return this.addedValues >= this.values.length;
507
478
  }
508
479
  addValue(value) {
509
- if (this.addedValues < this.values.length)
510
- this.addedValues++;
480
+ if (this.addedValues < this.values.length) this.addedValues++;
511
481
  this.values[this.lastValue++] = value;
512
- if (this.lastValue > this.values.length - 1)
513
- this.lastValue = 0;
482
+ if (this.lastValue > this.values.length - 1) this.lastValue = 0;
514
483
  this.dirty = true;
515
484
  }
516
485
  getMean() {
@@ -532,12 +501,12 @@ var spine = (() => {
532
501
  var Attachment = class {
533
502
  name;
534
503
  constructor(name) {
535
- if (!name)
536
- throw new Error("name cannot be null.");
504
+ if (!name) throw new Error("name cannot be null.");
537
505
  this.name = name;
538
506
  }
539
507
  };
540
- var _VertexAttachment = class extends Attachment {
508
+ var VertexAttachment = class _VertexAttachment extends Attachment {
509
+ static nextID = 0;
541
510
  /** The unique ID for this attachment. */
542
511
  id = _VertexAttachment.nextID++;
543
512
  /** The bones which affect the {@link #getVertices()}. The array entries are, for each vertex, the number of bones affecting
@@ -575,8 +544,7 @@ var spine = (() => {
575
544
  let vertices = this.vertices;
576
545
  let bones = this.bones;
577
546
  if (!bones) {
578
- if (deformArray.length > 0)
579
- vertices = deformArray;
547
+ if (deformArray.length > 0) vertices = deformArray;
580
548
  let bone = slot.bone;
581
549
  let x = bone.worldX;
582
550
  let y = bone.worldY;
@@ -641,11 +609,10 @@ var spine = (() => {
641
609
  attachment.timelineAttachment = this.timelineAttachment;
642
610
  }
643
611
  };
644
- var VertexAttachment = _VertexAttachment;
645
- __publicField(VertexAttachment, "nextID", 0);
646
612
 
647
613
  // spine-core/src/attachments/Sequence.ts
648
- var _Sequence = class {
614
+ var Sequence = class _Sequence {
615
+ static _nextID = 0;
649
616
  id = _Sequence.nextID();
650
617
  regions;
651
618
  start = 0;
@@ -665,10 +632,8 @@ var spine = (() => {
665
632
  }
666
633
  apply(slot, attachment) {
667
634
  let index = slot.sequenceIndex;
668
- if (index == -1)
669
- index = this.setupIndex;
670
- if (index >= this.regions.length)
671
- index = this.regions.length - 1;
635
+ if (index == -1) index = this.setupIndex;
636
+ if (index >= this.regions.length) index = this.regions.length - 1;
672
637
  let region = this.regions[index];
673
638
  if (attachment.region != region) {
674
639
  attachment.region = region;
@@ -687,8 +652,6 @@ var spine = (() => {
687
652
  return _Sequence._nextID++;
688
653
  }
689
654
  };
690
- var Sequence = _Sequence;
691
- __publicField(Sequence, "_nextID", 0);
692
655
  var SequenceMode = /* @__PURE__ */ ((SequenceMode2) => {
693
656
  SequenceMode2[SequenceMode2["hold"] = 0] = "hold";
694
657
  SequenceMode2[SequenceMode2["once"] = 1] = "once";
@@ -718,15 +681,13 @@ var spine = (() => {
718
681
  /** The duration of the animation in seconds, which is the highest time of all keys in the timeline. */
719
682
  duration;
720
683
  constructor(name, timelines, duration) {
721
- if (!name)
722
- throw new Error("name cannot be null.");
684
+ if (!name) throw new Error("name cannot be null.");
723
685
  this.name = name;
724
686
  this.setTimelines(timelines);
725
687
  this.duration = duration;
726
688
  }
727
689
  setTimelines(timelines) {
728
- if (!timelines)
729
- throw new Error("timelines cannot be null.");
690
+ if (!timelines) throw new Error("timelines cannot be null.");
730
691
  this.timelines = timelines;
731
692
  this.timelineIds.clear();
732
693
  for (var i = 0; i < timelines.length; i++)
@@ -734,8 +695,7 @@ var spine = (() => {
734
695
  }
735
696
  hasTimeline(ids) {
736
697
  for (let i = 0; i < ids.length; i++)
737
- if (this.timelineIds.contains(ids[i]))
738
- return true;
698
+ if (this.timelineIds.contains(ids[i])) return true;
739
699
  return false;
740
700
  }
741
701
  /** Applies all the animation's timelines to the specified skeleton.
@@ -744,12 +704,10 @@ var spine = (() => {
744
704
  * @param loop If true, the animation repeats after {@link #getDuration()}.
745
705
  * @param events May be null to ignore fired events. */
746
706
  apply(skeleton, lastTime, time, loop, events, alpha, blend, direction) {
747
- if (!skeleton)
748
- throw new Error("skeleton cannot be null.");
707
+ if (!skeleton) throw new Error("skeleton cannot be null.");
749
708
  if (loop && this.duration != 0) {
750
709
  time %= this.duration;
751
- if (lastTime > 0)
752
- lastTime %= this.duration;
710
+ if (lastTime > 0) lastTime %= this.duration;
753
711
  }
754
712
  let timelines = this.timelines;
755
713
  for (let i = 0, n = timelines.length; i < n; i++)
@@ -821,15 +779,13 @@ var spine = (() => {
821
779
  static search1(frames, time) {
822
780
  let n = frames.length;
823
781
  for (let i = 1; i < n; i++)
824
- if (frames[i] > time)
825
- return i - 1;
782
+ if (frames[i] > time) return i - 1;
826
783
  return n - 1;
827
784
  }
828
785
  static search(frames, time, step) {
829
786
  let n = frames.length;
830
787
  for (let i = step; i < n; i += step)
831
- if (frames[i] > time)
832
- return i - step;
788
+ if (frames[i] > time) return i - step;
833
789
  return n - step;
834
790
  }
835
791
  };
@@ -879,8 +835,7 @@ var spine = (() => {
879
835
  setBezier(bezier, frame, value, time1, value1, cx1, cy1, cx2, cy2, time2, value2) {
880
836
  let curves = this.curves;
881
837
  let i = this.getFrameCount() + bezier * 18;
882
- if (value == 0)
883
- curves[frame] = 2 + i;
838
+ if (value == 0) curves[frame] = 2 + i;
884
839
  let tmpx = (time1 - cx1 * 2 + cx2) * 0.03, tmpy = (value1 - cy1 * 2 + cy2) * 0.03;
885
840
  let dddx = ((cx1 - cx2) * 3 - time1 + time2) * 6e-3, dddy = ((cy1 - cy2) * 3 - value1 + value2) * 6e-3;
886
841
  let ddx = tmpx * 2 + dddx, ddy = tmpy * 2 + dddy;
@@ -1006,8 +961,7 @@ var spine = (() => {
1006
961
  return current;
1007
962
  }
1008
963
  let value = this.getCurveValue(time);
1009
- if (blend == 0 /* setup */)
1010
- return setup + (value - setup) * alpha;
964
+ if (blend == 0 /* setup */) return setup + (value - setup) * alpha;
1011
965
  return current + (value - current) * alpha;
1012
966
  }
1013
967
  getAbsoluteValue2(time, alpha, blend, current, setup, value) {
@@ -1020,8 +974,7 @@ var spine = (() => {
1020
974
  }
1021
975
  return current;
1022
976
  }
1023
- if (blend == 0 /* setup */)
1024
- return setup + (value - setup) * alpha;
977
+ if (blend == 0 /* setup */) return setup + (value - setup) * alpha;
1025
978
  return current + (value - current) * alpha;
1026
979
  }
1027
980
  getScaleValue(time, alpha, blend, direction, current, setup) {
@@ -1037,8 +990,7 @@ var spine = (() => {
1037
990
  }
1038
991
  let value = this.getCurveValue(time) * setup;
1039
992
  if (alpha == 1) {
1040
- if (blend == 3 /* add */)
1041
- return current + value - setup;
993
+ if (blend == 3 /* add */) return current + value - setup;
1042
994
  return value;
1043
995
  }
1044
996
  if (direction == 1 /* mixOut */) {
@@ -1097,8 +1049,7 @@ var spine = (() => {
1097
1049
  }
1098
1050
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1099
1051
  let bone = skeleton.bones[this.boneIndex];
1100
- if (bone.active)
1101
- bone.rotation = this.getRelativeValue(time, alpha, blend, bone.rotation, bone.data.rotation);
1052
+ if (bone.active) bone.rotation = this.getRelativeValue(time, alpha, blend, bone.rotation, bone.data.rotation);
1102
1053
  }
1103
1054
  };
1104
1055
  var TranslateTimeline = class extends CurveTimeline2 {
@@ -1114,8 +1065,7 @@ var spine = (() => {
1114
1065
  }
1115
1066
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1116
1067
  let bone = skeleton.bones[this.boneIndex];
1117
- if (!bone.active)
1118
- return;
1068
+ if (!bone.active) return;
1119
1069
  let frames = this.frames;
1120
1070
  if (time < frames[0]) {
1121
1071
  switch (blend) {
@@ -1214,8 +1164,7 @@ var spine = (() => {
1214
1164
  }
1215
1165
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1216
1166
  let bone = skeleton.bones[this.boneIndex];
1217
- if (bone.active)
1218
- bone.x = this.getRelativeValue(time, alpha, blend, bone.x, bone.data.x);
1167
+ if (bone.active) bone.x = this.getRelativeValue(time, alpha, blend, bone.x, bone.data.x);
1219
1168
  }
1220
1169
  };
1221
1170
  var TranslateYTimeline = class extends CurveTimeline1 {
@@ -1226,8 +1175,7 @@ var spine = (() => {
1226
1175
  }
1227
1176
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1228
1177
  let bone = skeleton.bones[this.boneIndex];
1229
- if (bone.active)
1230
- bone.y = this.getRelativeValue(time, alpha, blend, bone.y, bone.data.y);
1178
+ if (bone.active) bone.y = this.getRelativeValue(time, alpha, blend, bone.y, bone.data.y);
1231
1179
  }
1232
1180
  };
1233
1181
  var ScaleTimeline = class extends CurveTimeline2 {
@@ -1243,8 +1191,7 @@ var spine = (() => {
1243
1191
  }
1244
1192
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1245
1193
  let bone = skeleton.bones[this.boneIndex];
1246
- if (!bone.active)
1247
- return;
1194
+ if (!bone.active) return;
1248
1195
  let frames = this.frames;
1249
1196
  if (time < frames[0]) {
1250
1197
  switch (blend) {
@@ -1381,8 +1328,7 @@ var spine = (() => {
1381
1328
  }
1382
1329
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1383
1330
  let bone = skeleton.bones[this.boneIndex];
1384
- if (bone.active)
1385
- bone.scaleX = this.getScaleValue(time, alpha, blend, direction, bone.scaleX, bone.data.scaleX);
1331
+ if (bone.active) bone.scaleX = this.getScaleValue(time, alpha, blend, direction, bone.scaleX, bone.data.scaleX);
1386
1332
  }
1387
1333
  };
1388
1334
  var ScaleYTimeline = class extends CurveTimeline1 {
@@ -1393,8 +1339,7 @@ var spine = (() => {
1393
1339
  }
1394
1340
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1395
1341
  let bone = skeleton.bones[this.boneIndex];
1396
- if (bone.active)
1397
- bone.scaleY = this.getScaleValue(time, alpha, blend, direction, bone.scaleY, bone.data.scaleY);
1342
+ if (bone.active) bone.scaleY = this.getScaleValue(time, alpha, blend, direction, bone.scaleY, bone.data.scaleY);
1398
1343
  }
1399
1344
  };
1400
1345
  var ShearTimeline = class extends CurveTimeline2 {
@@ -1410,8 +1355,7 @@ var spine = (() => {
1410
1355
  }
1411
1356
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1412
1357
  let bone = skeleton.bones[this.boneIndex];
1413
- if (!bone.active)
1414
- return;
1358
+ if (!bone.active) return;
1415
1359
  let frames = this.frames;
1416
1360
  if (time < frames[0]) {
1417
1361
  switch (blend) {
@@ -1510,8 +1454,7 @@ var spine = (() => {
1510
1454
  }
1511
1455
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1512
1456
  let bone = skeleton.bones[this.boneIndex];
1513
- if (bone.active)
1514
- bone.shearX = this.getRelativeValue(time, alpha, blend, bone.shearX, bone.data.shearX);
1457
+ if (bone.active) bone.shearX = this.getRelativeValue(time, alpha, blend, bone.shearX, bone.data.shearX);
1515
1458
  }
1516
1459
  };
1517
1460
  var ShearYTimeline = class extends CurveTimeline1 {
@@ -1522,8 +1465,7 @@ var spine = (() => {
1522
1465
  }
1523
1466
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1524
1467
  let bone = skeleton.bones[this.boneIndex];
1525
- if (bone.active)
1526
- bone.shearY = this.getRelativeValue(time, alpha, blend, bone.shearY, bone.data.shearY);
1468
+ if (bone.active) bone.shearY = this.getRelativeValue(time, alpha, blend, bone.shearY, bone.data.shearY);
1527
1469
  }
1528
1470
  };
1529
1471
  var InheritTimeline = class extends Timeline {
@@ -1548,17 +1490,14 @@ var spine = (() => {
1548
1490
  }
1549
1491
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1550
1492
  let bone = skeleton.bones[this.boneIndex];
1551
- if (!bone.active)
1552
- return;
1493
+ if (!bone.active) return;
1553
1494
  if (direction == 1 /* mixOut */) {
1554
- if (blend == 0 /* setup */)
1555
- bone.inherit = bone.data.inherit;
1495
+ if (blend == 0 /* setup */) bone.inherit = bone.data.inherit;
1556
1496
  return;
1557
1497
  }
1558
1498
  let frames = this.frames;
1559
1499
  if (time < frames[0]) {
1560
- if (blend == 0 /* setup */ || blend == 1 /* first */)
1561
- bone.inherit = bone.data.inherit;
1500
+ if (blend == 0 /* setup */ || blend == 1 /* first */) bone.inherit = bone.data.inherit;
1562
1501
  return;
1563
1502
  }
1564
1503
  bone.inherit = this.frames[
@@ -1607,8 +1546,7 @@ var spine = (() => {
1607
1546
  }
1608
1547
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1609
1548
  let slot = skeleton.slots[this.slotIndex];
1610
- if (!slot.bone.active)
1611
- return;
1549
+ if (!slot.bone.active) return;
1612
1550
  let frames = this.frames;
1613
1551
  let color = slot.color;
1614
1552
  if (time < frames[0]) {
@@ -1729,8 +1667,7 @@ var spine = (() => {
1729
1667
  if (alpha == 1)
1730
1668
  color.set(r, g, b, a);
1731
1669
  else {
1732
- if (blend == 0 /* setup */)
1733
- color.setFromColor(slot.data.color);
1670
+ if (blend == 0 /* setup */) color.setFromColor(slot.data.color);
1734
1671
  color.add((r - color.r) * alpha, (g - color.g) * alpha, (b - color.b) * alpha, (a - color.a) * alpha);
1735
1672
  }
1736
1673
  }
@@ -1765,8 +1702,7 @@ var spine = (() => {
1765
1702
  }
1766
1703
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1767
1704
  let slot = skeleton.slots[this.slotIndex];
1768
- if (!slot.bone.active)
1769
- return;
1705
+ if (!slot.bone.active) return;
1770
1706
  let frames = this.frames;
1771
1707
  let color = slot.color;
1772
1708
  if (time < frames[0]) {
@@ -1886,8 +1822,7 @@ var spine = (() => {
1886
1822
  }
1887
1823
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1888
1824
  let slot = skeleton.slots[this.slotIndex];
1889
- if (!slot.bone.active)
1890
- return;
1825
+ if (!slot.bone.active) return;
1891
1826
  let color = slot.color;
1892
1827
  if (time < this.frames[0]) {
1893
1828
  let setup = slot.data.color;
@@ -1904,8 +1839,7 @@ var spine = (() => {
1904
1839
  if (alpha == 1)
1905
1840
  color.a = a;
1906
1841
  else {
1907
- if (blend == 0 /* setup */)
1908
- color.a = slot.data.color.a;
1842
+ if (blend == 0 /* setup */) color.a = slot.data.color.a;
1909
1843
  color.a += (a - color.a) * alpha;
1910
1844
  }
1911
1845
  }
@@ -1958,8 +1892,7 @@ var spine = (() => {
1958
1892
  }
1959
1893
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1960
1894
  let slot = skeleton.slots[this.slotIndex];
1961
- if (!slot.bone.active)
1962
- return;
1895
+ if (!slot.bone.active) return;
1963
1896
  let frames = this.frames;
1964
1897
  let light = slot.color, dark = slot.darkColor;
1965
1898
  if (time < frames[0]) {
@@ -2200,8 +2133,7 @@ var spine = (() => {
2200
2133
  }
2201
2134
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
2202
2135
  let slot = skeleton.slots[this.slotIndex];
2203
- if (!slot.bone.active)
2204
- return;
2136
+ if (!slot.bone.active) return;
2205
2137
  let frames = this.frames;
2206
2138
  let light = slot.color, dark = slot.darkColor;
2207
2139
  if (time < frames[0]) {
@@ -2409,16 +2341,13 @@ var spine = (() => {
2409
2341
  }
2410
2342
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
2411
2343
  let slot = skeleton.slots[this.slotIndex];
2412
- if (!slot.bone.active)
2413
- return;
2344
+ if (!slot.bone.active) return;
2414
2345
  if (direction == 1 /* mixOut */) {
2415
- if (blend == 0 /* setup */)
2416
- this.setAttachment(skeleton, slot, slot.data.attachmentName);
2346
+ if (blend == 0 /* setup */) this.setAttachment(skeleton, slot, slot.data.attachmentName);
2417
2347
  return;
2418
2348
  }
2419
2349
  if (time < this.frames[0]) {
2420
- if (blend == 0 /* setup */ || blend == 1 /* first */)
2421
- this.setAttachment(skeleton, slot, slot.data.attachmentName);
2350
+ if (blend == 0 /* setup */ || blend == 1 /* first */) this.setAttachment(skeleton, slot, slot.data.attachmentName);
2422
2351
  return;
2423
2352
  }
2424
2353
  this.setAttachment(skeleton, slot, this.attachmentNames[Timeline.search1(this.frames, time)]);
@@ -2455,8 +2384,7 @@ var spine = (() => {
2455
2384
  setBezier(bezier, frame, value, time1, value1, cx1, cy1, cx2, cy2, time2, value2) {
2456
2385
  let curves = this.curves;
2457
2386
  let i = this.getFrameCount() + bezier * 18;
2458
- if (value == 0)
2459
- curves[frame] = 2 + i;
2387
+ if (value == 0) curves[frame] = 2 + i;
2460
2388
  let tmpx = (time1 - cx1 * 2 + cx2) * 0.03, tmpy = cy2 * 0.03 - cy1 * 0.06;
2461
2389
  let dddx = ((cx1 - cx2) * 3 - time1 + time2) * 6e-3, dddy = (cy1 - cy2 + 0.33333333) * 0.018;
2462
2390
  let ddx = tmpx * 2 + dddx, ddy = tmpy * 2 + dddy;
@@ -2500,16 +2428,12 @@ var spine = (() => {
2500
2428
  }
2501
2429
  apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
2502
2430
  let slot = skeleton.slots[this.slotIndex];
2503
- if (!slot.bone.active)
2504
- return;
2431
+ if (!slot.bone.active) return;
2505
2432
  let slotAttachment = slot.getAttachment();
2506
- if (!slotAttachment)
2507
- return;
2508
- if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttachment != this.attachment)
2509
- return;
2433
+ if (!slotAttachment) return;
2434
+ if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttachment != this.attachment) return;
2510
2435
  let deform = slot.deform;
2511
- if (deform.length == 0)
2512
- blend = 0 /* setup */;
2436
+ if (deform.length == 0) blend = 0 /* setup */;
2513
2437
  let vertices = this.vertices;
2514
2438
  let vertexCount = vertices[0].length;
2515
2439
  let frames = this.frames;
@@ -2656,7 +2580,8 @@ var spine = (() => {
2656
2580
  }
2657
2581
  }
2658
2582
  };
2659
- var _EventTimeline = class extends Timeline {
2583
+ var EventTimeline = class _EventTimeline extends Timeline {
2584
+ static propertyIds = ["" + Property.event];
2660
2585
  /** The event for each key frame. */
2661
2586
  events;
2662
2587
  constructor(frameCount) {
@@ -2673,8 +2598,7 @@ var spine = (() => {
2673
2598
  }
2674
2599
  /** Fires events for frames > `lastTime` and <= `time`. */
2675
2600
  apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
2676
- if (!firedEvents)
2677
- return;
2601
+ if (!firedEvents) return;
2678
2602
  let frames = this.frames;
2679
2603
  let frameCount = this.frames.length;
2680
2604
  if (lastTime > time) {
@@ -2682,8 +2606,7 @@ var spine = (() => {
2682
2606
  lastTime = -1;
2683
2607
  } else if (lastTime >= frames[frameCount - 1])
2684
2608
  return;
2685
- if (time < frames[0])
2686
- return;
2609
+ if (time < frames[0]) return;
2687
2610
  let i = 0;
2688
2611
  if (lastTime < frames[0])
2689
2612
  i = 0;
@@ -2691,8 +2614,7 @@ var spine = (() => {
2691
2614
  i = Timeline.search1(frames, lastTime) + 1;
2692
2615
  let frameTime = frames[i];
2693
2616
  while (i > 0) {
2694
- if (frames[i - 1] != frameTime)
2695
- break;
2617
+ if (frames[i - 1] != frameTime) break;
2696
2618
  i--;
2697
2619
  }
2698
2620
  }
@@ -2700,9 +2622,8 @@ var spine = (() => {
2700
2622
  firedEvents.push(this.events[i]);
2701
2623
  }
2702
2624
  };
2703
- var EventTimeline = _EventTimeline;
2704
- __publicField(EventTimeline, "propertyIds", ["" + Property.event]);
2705
- var _DrawOrderTimeline = class extends Timeline {
2625
+ var DrawOrderTimeline = class _DrawOrderTimeline extends Timeline {
2626
+ static propertyIds = ["" + Property.drawOrder];
2706
2627
  /** The draw order for each key frame. See {@link #setFrame(int, float, int[])}. */
2707
2628
  drawOrders;
2708
2629
  constructor(frameCount) {
@@ -2721,13 +2642,11 @@ var spine = (() => {
2721
2642
  }
2722
2643
  apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
2723
2644
  if (direction == 1 /* mixOut */) {
2724
- if (blend == 0 /* setup */)
2725
- Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
2645
+ if (blend == 0 /* setup */) Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
2726
2646
  return;
2727
2647
  }
2728
2648
  if (time < this.frames[0]) {
2729
- if (blend == 0 /* setup */ || blend == 1 /* first */)
2730
- Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
2649
+ if (blend == 0 /* setup */ || blend == 1 /* first */) Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
2731
2650
  return;
2732
2651
  }
2733
2652
  let idx = Timeline.search1(this.frames, time);
@@ -2742,8 +2661,6 @@ var spine = (() => {
2742
2661
  }
2743
2662
  }
2744
2663
  };
2745
- var DrawOrderTimeline = _DrawOrderTimeline;
2746
- __publicField(DrawOrderTimeline, "propertyIds", ["" + Property.drawOrder]);
2747
2664
  var IkConstraintTimeline = class extends CurveTimeline {
2748
2665
  /** The index of the IK constraint in {@link Skeleton#getIkConstraints()} that will be changed when this timeline is applied */
2749
2666
  constraintIndex = 0;
@@ -2783,8 +2700,7 @@ var spine = (() => {
2783
2700
  }
2784
2701
  apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
2785
2702
  let constraint = skeleton.ikConstraints[this.constraintIndex];
2786
- if (!constraint.active)
2787
- return;
2703
+ if (!constraint.active) return;
2788
2704
  let frames = this.frames;
2789
2705
  if (time < frames[0]) {
2790
2706
  switch (blend) {
@@ -2950,8 +2866,7 @@ var spine = (() => {
2950
2866
  }
2951
2867
  apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
2952
2868
  let constraint = skeleton.transformConstraints[this.constraintIndex];
2953
- if (!constraint.active)
2954
- return;
2869
+ if (!constraint.active) return;
2955
2870
  let frames = this.frames;
2956
2871
  if (time < frames[0]) {
2957
2872
  let data = constraint.data;
@@ -3189,8 +3104,7 @@ var spine = (() => {
3189
3104
  }
3190
3105
  apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
3191
3106
  let constraint = skeleton.pathConstraints[this.constraintIndex];
3192
- if (!constraint.active)
3193
- return;
3107
+ if (!constraint.active) return;
3194
3108
  let frames = this.frames;
3195
3109
  if (time < frames[0]) {
3196
3110
  switch (blend) {
@@ -3314,8 +3228,7 @@ var spine = (() => {
3314
3228
  }
3315
3229
  } else {
3316
3230
  constraint = skeleton.physicsConstraints[this.constraintIndex];
3317
- if (constraint.active)
3318
- this.set(constraint, this.getAbsoluteValue(time, alpha, blend, this.get(constraint), this.setup(constraint)));
3231
+ if (constraint.active) this.set(constraint, this.getAbsoluteValue(time, alpha, blend, this.get(constraint), this.setup(constraint)));
3319
3232
  }
3320
3233
  }
3321
3234
  };
@@ -3438,7 +3351,8 @@ var spine = (() => {
3438
3351
  return constraint.mixGlobal;
3439
3352
  }
3440
3353
  };
3441
- var _PhysicsConstraintResetTimeline = class extends Timeline {
3354
+ var PhysicsConstraintResetTimeline = class _PhysicsConstraintResetTimeline extends Timeline {
3355
+ static propertyIds = [Property.physicsConstraintReset.toString()];
3442
3356
  /** The index of the physics constraint in {@link Skeleton#getPhysicsConstraints()} that will be reset when this timeline is
3443
3357
  * applied, or -1 if all physics constraints in the skeleton will be reset. */
3444
3358
  constraintIndex;
@@ -3460,8 +3374,7 @@ var spine = (() => {
3460
3374
  let constraint;
3461
3375
  if (this.constraintIndex != -1) {
3462
3376
  constraint = skeleton.physicsConstraints[this.constraintIndex];
3463
- if (!constraint.active)
3464
- return;
3377
+ if (!constraint.active) return;
3465
3378
  }
3466
3379
  const frames = this.frames;
3467
3380
  if (lastTime > time) {
@@ -3469,23 +3382,22 @@ var spine = (() => {
3469
3382
  lastTime = -1;
3470
3383
  } else if (lastTime >= frames[frames.length - 1])
3471
3384
  return;
3472
- if (time < frames[0])
3473
- return;
3385
+ if (time < frames[0]) return;
3474
3386
  if (lastTime < frames[0] || time >= frames[Timeline.search1(frames, lastTime) + 1]) {
3475
3387
  if (constraint != null)
3476
3388
  constraint.reset();
3477
3389
  else {
3478
3390
  for (const constraint2 of skeleton.physicsConstraints) {
3479
- if (constraint2.active)
3480
- constraint2.reset();
3391
+ if (constraint2.active) constraint2.reset();
3481
3392
  }
3482
3393
  }
3483
3394
  }
3484
3395
  }
3485
3396
  };
3486
- var PhysicsConstraintResetTimeline = _PhysicsConstraintResetTimeline;
3487
- __publicField(PhysicsConstraintResetTimeline, "propertyIds", [Property.physicsConstraintReset.toString()]);
3488
- var _SequenceTimeline = class extends Timeline {
3397
+ var SequenceTimeline = class _SequenceTimeline extends Timeline {
3398
+ static ENTRIES = 3;
3399
+ static MODE = 1;
3400
+ static DELAY = 2;
3489
3401
  slotIndex;
3490
3402
  attachment;
3491
3403
  constructor(frameCount, slotIndex, attachment) {
@@ -3516,31 +3428,26 @@ var spine = (() => {
3516
3428
  }
3517
3429
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
3518
3430
  let slot = skeleton.slots[this.slotIndex];
3519
- if (!slot.bone.active)
3520
- return;
3431
+ if (!slot.bone.active) return;
3521
3432
  let slotAttachment = slot.attachment;
3522
3433
  let attachment = this.attachment;
3523
3434
  if (slotAttachment != attachment) {
3524
- if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttachment != attachment)
3525
- return;
3435
+ if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttachment != attachment) return;
3526
3436
  }
3527
3437
  if (direction == 1 /* mixOut */) {
3528
- if (blend == 0 /* setup */)
3529
- slot.sequenceIndex = -1;
3438
+ if (blend == 0 /* setup */) slot.sequenceIndex = -1;
3530
3439
  return;
3531
3440
  }
3532
3441
  let frames = this.frames;
3533
3442
  if (time < frames[0]) {
3534
- if (blend == 0 /* setup */ || blend == 1 /* first */)
3535
- slot.sequenceIndex = -1;
3443
+ if (blend == 0 /* setup */ || blend == 1 /* first */) slot.sequenceIndex = -1;
3536
3444
  return;
3537
3445
  }
3538
3446
  let i = Timeline.search(frames, time, _SequenceTimeline.ENTRIES);
3539
3447
  let before = frames[i];
3540
3448
  let modeAndIndex = frames[i + _SequenceTimeline.MODE];
3541
3449
  let delay = frames[i + _SequenceTimeline.DELAY];
3542
- if (!this.attachment.sequence)
3543
- return;
3450
+ if (!this.attachment.sequence) return;
3544
3451
  let index = modeAndIndex >> 4, count = this.attachment.sequence.regions.length;
3545
3452
  let mode = SequenceModeValues[modeAndIndex & 15];
3546
3453
  if (mode != 0 /* hold */) {
@@ -3555,8 +3462,7 @@ var spine = (() => {
3555
3462
  case 3 /* pingpong */: {
3556
3463
  let n = (count << 1) - 2;
3557
3464
  index = n == 0 ? 0 : index % n;
3558
- if (index >= count)
3559
- index = n - index;
3465
+ if (index >= count) index = n - index;
3560
3466
  break;
3561
3467
  }
3562
3468
  case 4 /* onceReverse */:
@@ -3568,21 +3474,17 @@ var spine = (() => {
3568
3474
  case 6 /* pingpongReverse */: {
3569
3475
  let n = (count << 1) - 2;
3570
3476
  index = n == 0 ? 0 : (index + count - 1) % n;
3571
- if (index >= count)
3572
- index = n - index;
3477
+ if (index >= count) index = n - index;
3573
3478
  }
3574
3479
  }
3575
3480
  }
3576
3481
  slot.sequenceIndex = index;
3577
3482
  }
3578
3483
  };
3579
- var SequenceTimeline = _SequenceTimeline;
3580
- __publicField(SequenceTimeline, "ENTRIES", 3);
3581
- __publicField(SequenceTimeline, "MODE", 1);
3582
- __publicField(SequenceTimeline, "DELAY", 2);
3583
3484
 
3584
3485
  // spine-core/src/AnimationState.ts
3585
- var _AnimationState = class {
3486
+ var AnimationState = class _AnimationState {
3487
+ static _emptyAnimation = new Animation("<empty>", [], 0);
3586
3488
  static emptyAnimation() {
3587
3489
  return _AnimationState._emptyAnimation;
3588
3490
  }
@@ -3611,15 +3513,13 @@ var spine = (() => {
3611
3513
  let tracks = this.tracks;
3612
3514
  for (let i = 0, n = tracks.length; i < n; i++) {
3613
3515
  let current = tracks[i];
3614
- if (!current)
3615
- continue;
3516
+ if (!current) continue;
3616
3517
  current.animationLast = current.nextAnimationLast;
3617
3518
  current.trackLast = current.nextTrackLast;
3618
3519
  let currentDelta = delta * current.timeScale;
3619
3520
  if (current.delay > 0) {
3620
3521
  current.delay -= currentDelta;
3621
- if (current.delay > 0)
3622
- continue;
3522
+ if (current.delay > 0) continue;
3623
3523
  currentDelta = -current.delay;
3624
3524
  current.delay = 0;
3625
3525
  }
@@ -3646,8 +3546,7 @@ var spine = (() => {
3646
3546
  if (current.mixingFrom && this.updateMixingFrom(current, delta)) {
3647
3547
  let from = current.mixingFrom;
3648
3548
  current.mixingFrom = null;
3649
- if (from)
3650
- from.mixingTo = null;
3549
+ if (from) from.mixingTo = null;
3651
3550
  while (from) {
3652
3551
  this.queue.end(from);
3653
3552
  from = from.mixingFrom;
@@ -3660,16 +3559,14 @@ var spine = (() => {
3660
3559
  /** Returns true when all mixing from entries are complete. */
3661
3560
  updateMixingFrom(to, delta) {
3662
3561
  let from = to.mixingFrom;
3663
- if (!from)
3664
- return true;
3562
+ if (!from) return true;
3665
3563
  let finished = this.updateMixingFrom(from, delta);
3666
3564
  from.animationLast = from.nextAnimationLast;
3667
3565
  from.trackLast = from.nextTrackLast;
3668
3566
  if (to.nextTrackLast != -1 && to.mixTime >= to.mixDuration) {
3669
3567
  if (from.totalAlpha == 0 || to.mixDuration == 0) {
3670
3568
  to.mixingFrom = from.mixingFrom;
3671
- if (from.mixingFrom != null)
3672
- from.mixingFrom.mixingTo = to;
3569
+ if (from.mixingFrom != null) from.mixingFrom.mixingTo = to;
3673
3570
  to.interruptAlpha = from.interruptAlpha;
3674
3571
  this.queue.end(from);
3675
3572
  }
@@ -3683,17 +3580,14 @@ var spine = (() => {
3683
3580
  * animation state can be applied to multiple skeletons to pose them identically.
3684
3581
  * @returns True if any animations were applied. */
3685
3582
  apply(skeleton) {
3686
- if (!skeleton)
3687
- throw new Error("skeleton cannot be null.");
3688
- if (this.animationsChanged)
3689
- this._animationsChanged();
3583
+ if (!skeleton) throw new Error("skeleton cannot be null.");
3584
+ if (this.animationsChanged) this._animationsChanged();
3690
3585
  let events = this.events;
3691
3586
  let tracks = this.tracks;
3692
3587
  let applied = false;
3693
3588
  for (let i2 = 0, n2 = tracks.length; i2 < n2; i2++) {
3694
3589
  let current = tracks[i2];
3695
- if (!current || current.delay > 0)
3696
- continue;
3590
+ if (!current || current.delay > 0) continue;
3697
3591
  applied = true;
3698
3592
  let blend = i2 == 0 ? 1 /* first */ : current.mixBlend;
3699
3593
  let alpha = current.alpha;
@@ -3711,8 +3605,7 @@ var spine = (() => {
3711
3605
  let timelines = current.animation.timelines;
3712
3606
  let timelineCount = timelines.length;
3713
3607
  if (i2 == 0 && alpha == 1 || blend == 3 /* add */) {
3714
- if (i2 == 0)
3715
- attachments = true;
3608
+ if (i2 == 0) attachments = true;
3716
3609
  for (let ii = 0; ii < timelineCount; ii++) {
3717
3610
  Utils.webkit602BugfixHelper(alpha, blend);
3718
3611
  var timeline = timelines[ii];
@@ -3725,8 +3618,7 @@ var spine = (() => {
3725
3618
  let timelineMode = current.timelineMode;
3726
3619
  let shortestRotation = current.shortestRotation;
3727
3620
  let firstFrame = !shortestRotation && current.timelinesRotation.length != timelineCount << 1;
3728
- if (firstFrame)
3729
- current.timelinesRotation.length = timelineCount << 1;
3621
+ if (firstFrame) current.timelinesRotation.length = timelineCount << 1;
3730
3622
  for (let ii = 0; ii < timelineCount; ii++) {
3731
3623
  let timeline2 = timelines[ii];
3732
3624
  let timelineBlend = timelineMode[ii] == SUBSEQUENT ? blend : 0 /* setup */;
@@ -3760,19 +3652,15 @@ var spine = (() => {
3760
3652
  }
3761
3653
  applyMixingFrom(to, skeleton, blend) {
3762
3654
  let from = to.mixingFrom;
3763
- if (from.mixingFrom)
3764
- this.applyMixingFrom(from, skeleton, blend);
3655
+ if (from.mixingFrom) this.applyMixingFrom(from, skeleton, blend);
3765
3656
  let mix = 0;
3766
3657
  if (to.mixDuration == 0) {
3767
3658
  mix = 1;
3768
- if (blend == 1 /* first */)
3769
- blend = 0 /* setup */;
3659
+ if (blend == 1 /* first */) blend = 0 /* setup */;
3770
3660
  } else {
3771
3661
  mix = to.mixTime / to.mixDuration;
3772
- if (mix > 1)
3773
- mix = 1;
3774
- if (blend != 1 /* first */)
3775
- blend = from.mixBlend;
3662
+ if (mix > 1) mix = 1;
3663
+ if (blend != 1 /* first */) blend = from.mixBlend;
3776
3664
  }
3777
3665
  let attachments = mix < from.mixAttachmentThreshold, drawOrder = mix < from.mixDrawOrderThreshold;
3778
3666
  let timelines = from.animation.timelines;
@@ -3792,8 +3680,7 @@ var spine = (() => {
3792
3680
  let timelineHoldMix = from.timelineHoldMix;
3793
3681
  let shortestRotation = from.shortestRotation;
3794
3682
  let firstFrame = !shortestRotation && from.timelinesRotation.length != timelineCount << 1;
3795
- if (firstFrame)
3796
- from.timelinesRotation.length = timelineCount << 1;
3683
+ if (firstFrame) from.timelinesRotation.length = timelineCount << 1;
3797
3684
  from.totalAlpha = 0;
3798
3685
  for (let i = 0; i < timelineCount; i++) {
3799
3686
  let timeline = timelines[i];
@@ -3802,8 +3689,7 @@ var spine = (() => {
3802
3689
  let alpha = 0;
3803
3690
  switch (timelineMode[i]) {
3804
3691
  case SUBSEQUENT:
3805
- if (!drawOrder && timeline instanceof DrawOrderTimeline)
3806
- continue;
3692
+ if (!drawOrder && timeline instanceof DrawOrderTimeline) continue;
3807
3693
  timelineBlend = blend;
3808
3694
  alpha = alphaMix;
3809
3695
  break;
@@ -3838,8 +3724,7 @@ var spine = (() => {
3838
3724
  }
3839
3725
  }
3840
3726
  }
3841
- if (to.mixDuration > 0)
3842
- this.queueEvents(from, animationTime);
3727
+ if (to.mixDuration > 0) this.queueEvents(from, animationTime);
3843
3728
  this.events.length = 0;
3844
3729
  from.nextAnimationLast = animationTime;
3845
3730
  from.nextTrackLast = from.trackTime;
@@ -3847,31 +3732,26 @@ var spine = (() => {
3847
3732
  }
3848
3733
  applyAttachmentTimeline(timeline, skeleton, time, blend, attachments) {
3849
3734
  var slot = skeleton.slots[timeline.slotIndex];
3850
- if (!slot.bone.active)
3851
- return;
3735
+ if (!slot.bone.active) return;
3852
3736
  if (time < timeline.frames[0]) {
3853
3737
  if (blend == 0 /* setup */ || blend == 1 /* first */)
3854
3738
  this.setAttachment(skeleton, slot, slot.data.attachmentName, attachments);
3855
3739
  } else
3856
3740
  this.setAttachment(skeleton, slot, timeline.attachmentNames[Timeline.search1(timeline.frames, time)], attachments);
3857
- if (slot.attachmentState <= this.unkeyedState)
3858
- slot.attachmentState = this.unkeyedState + SETUP;
3741
+ if (slot.attachmentState <= this.unkeyedState) slot.attachmentState = this.unkeyedState + SETUP;
3859
3742
  }
3860
3743
  setAttachment(skeleton, slot, attachmentName, attachments) {
3861
3744
  slot.setAttachment(!attachmentName ? null : skeleton.getAttachment(slot.data.index, attachmentName));
3862
- if (attachments)
3863
- slot.attachmentState = this.unkeyedState + CURRENT;
3745
+ if (attachments) slot.attachmentState = this.unkeyedState + CURRENT;
3864
3746
  }
3865
3747
  applyRotateTimeline(timeline, skeleton, time, alpha, blend, timelinesRotation, i, firstFrame) {
3866
- if (firstFrame)
3867
- timelinesRotation[i] = 0;
3748
+ if (firstFrame) timelinesRotation[i] = 0;
3868
3749
  if (alpha == 1) {
3869
3750
  timeline.apply(skeleton, 0, time, null, 1, blend, 0 /* mixIn */);
3870
3751
  return;
3871
3752
  }
3872
3753
  let bone = skeleton.bones[timeline.boneIndex];
3873
- if (!bone.active)
3874
- return;
3754
+ if (!bone.active) return;
3875
3755
  let frames = timeline.frames;
3876
3756
  let r1 = 0, r2 = 0;
3877
3757
  if (time < frames[0]) {
@@ -3913,8 +3793,7 @@ var spine = (() => {
3913
3793
  else
3914
3794
  dir = current;
3915
3795
  }
3916
- if (dir != current)
3917
- total += 360 * MathUtils.signum(lastTotal);
3796
+ if (dir != current) total += 360 * MathUtils.signum(lastTotal);
3918
3797
  timelinesRotation[i] = total;
3919
3798
  }
3920
3799
  timelinesRotation[i + 1] = diff;
@@ -3928,10 +3807,8 @@ var spine = (() => {
3928
3807
  let i = 0, n = events.length;
3929
3808
  for (; i < n; i++) {
3930
3809
  let event = events[i];
3931
- if (event.time < trackLastWrapped)
3932
- break;
3933
- if (event.time > animationEnd)
3934
- continue;
3810
+ if (event.time < trackLastWrapped) break;
3811
+ if (event.time > animationEnd) continue;
3935
3812
  this.queue.event(entry, event);
3936
3813
  }
3937
3814
  let complete = false;
@@ -3944,12 +3821,10 @@ var spine = (() => {
3944
3821
  }
3945
3822
  } else
3946
3823
  complete = animationTime >= animationEnd && entry.animationLast < animationEnd;
3947
- if (complete)
3948
- this.queue.complete(entry);
3824
+ if (complete) this.queue.complete(entry);
3949
3825
  for (; i < n; i++) {
3950
3826
  let event = events[i];
3951
- if (event.time < animationStart)
3952
- continue;
3827
+ if (event.time < animationStart) continue;
3953
3828
  this.queue.event(entry, event);
3954
3829
  }
3955
3830
  }
@@ -3971,18 +3846,15 @@ var spine = (() => {
3971
3846
  * It may be desired to use {@link AnimationState#setEmptyAnimation()} to mix the skeletons back to the setup pose,
3972
3847
  * rather than leaving them in their current pose. */
3973
3848
  clearTrack(trackIndex) {
3974
- if (trackIndex >= this.tracks.length)
3975
- return;
3849
+ if (trackIndex >= this.tracks.length) return;
3976
3850
  let current = this.tracks[trackIndex];
3977
- if (!current)
3978
- return;
3851
+ if (!current) return;
3979
3852
  this.queue.end(current);
3980
3853
  this.clearNext(current);
3981
3854
  let entry = current;
3982
3855
  while (true) {
3983
3856
  let from = entry.mixingFrom;
3984
- if (!from)
3985
- break;
3857
+ if (!from) break;
3986
3858
  this.queue.end(from);
3987
3859
  entry.mixingFrom = null;
3988
3860
  entry.mixingTo = null;
@@ -3996,8 +3868,7 @@ var spine = (() => {
3996
3868
  this.tracks[index] = current;
3997
3869
  current.previous = null;
3998
3870
  if (from) {
3999
- if (interrupt)
4000
- this.queue.interrupt(from);
3871
+ if (interrupt) this.queue.interrupt(from);
4001
3872
  current.mixingFrom = from;
4002
3873
  from.mixingTo = current;
4003
3874
  current.mixTime = 0;
@@ -4012,8 +3883,7 @@ var spine = (() => {
4012
3883
  * See {@link #setAnimationWith()}. */
4013
3884
  setAnimation(trackIndex, animationName, loop = false) {
4014
3885
  let animation = this.data.skeletonData.findAnimation(animationName);
4015
- if (!animation)
4016
- throw new Error("Animation not found: " + animationName);
3886
+ if (!animation) throw new Error("Animation not found: " + animationName);
4017
3887
  return this.setAnimationWith(trackIndex, animation, loop);
4018
3888
  }
4019
3889
  /** Sets the current animation for a track, discarding any queued animations. If the formerly current track entry was never
@@ -4023,8 +3893,7 @@ var spine = (() => {
4023
3893
  * @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
4024
3894
  * after the {@link AnimationStateListener#dispose()} event occurs. */
4025
3895
  setAnimationWith(trackIndex, animation, loop = false) {
4026
- if (!animation)
4027
- throw new Error("animation cannot be null.");
3896
+ if (!animation) throw new Error("animation cannot be null.");
4028
3897
  let interrupt = true;
4029
3898
  let current = this.expandToIndex(trackIndex);
4030
3899
  if (current) {
@@ -4048,8 +3917,7 @@ var spine = (() => {
4048
3917
  * See {@link #addAnimationWith()}. */
4049
3918
  addAnimation(trackIndex, animationName, loop = false, delay = 0) {
4050
3919
  let animation = this.data.skeletonData.findAnimation(animationName);
4051
- if (!animation)
4052
- throw new Error("Animation not found: " + animationName);
3920
+ if (!animation) throw new Error("Animation not found: " + animationName);
4053
3921
  return this.addAnimationWith(trackIndex, animation, loop, delay);
4054
3922
  }
4055
3923
  /** Adds an animation to be played after the current or last queued animation for a track. If the track is empty, it is
@@ -4061,8 +3929,7 @@ var spine = (() => {
4061
3929
  * @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
4062
3930
  * after the {@link AnimationStateListener#dispose()} event occurs. */
4063
3931
  addAnimationWith(trackIndex, animation, loop = false, delay = 0) {
4064
- if (!animation)
4065
- throw new Error("animation cannot be null.");
3932
+ if (!animation) throw new Error("animation cannot be null.");
4066
3933
  let last = this.expandToIndex(trackIndex);
4067
3934
  if (last) {
4068
3935
  while (last.next)
@@ -4072,11 +3939,11 @@ var spine = (() => {
4072
3939
  if (!last) {
4073
3940
  this.setCurrent(trackIndex, entry, true);
4074
3941
  this.queue.drain();
3942
+ if (delay < 0) delay = 0;
4075
3943
  } else {
4076
3944
  last.next = entry;
4077
3945
  entry.previous = last;
4078
- if (delay <= 0)
4079
- delay += last.getTrackComplete() - entry.mixDuration;
3946
+ if (delay <= 0) delay = Math.max(delay + last.getTrackComplete() - entry.mixDuration, 0);
4080
3947
  }
4081
3948
  entry.delay = delay;
4082
3949
  return entry;
@@ -4114,8 +3981,7 @@ var spine = (() => {
4114
3981
  * after the {@link AnimationStateListener#dispose()} event occurs. */
4115
3982
  addEmptyAnimation(trackIndex, mixDuration = 0, delay = 0) {
4116
3983
  let entry = this.addAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false, delay);
4117
- if (delay <= 0)
4118
- entry.delay += entry.mixDuration - mixDuration;
3984
+ if (delay <= 0) entry.delay = Math.max(entry.delay + entry.mixDuration - mixDuration, 0);
4119
3985
  entry.mixDuration = mixDuration;
4120
3986
  entry.trackEnd = mixDuration;
4121
3987
  return entry;
@@ -4127,15 +3993,13 @@ var spine = (() => {
4127
3993
  this.queue.drainDisabled = true;
4128
3994
  for (let i = 0, n = this.tracks.length; i < n; i++) {
4129
3995
  let current = this.tracks[i];
4130
- if (current)
4131
- this.setEmptyAnimation(current.trackIndex, mixDuration);
3996
+ if (current) this.setEmptyAnimation(current.trackIndex, mixDuration);
4132
3997
  }
4133
3998
  this.queue.drainDisabled = oldDrainDisabled;
4134
3999
  this.queue.drain();
4135
4000
  }
4136
4001
  expandToIndex(index) {
4137
- if (index < this.tracks.length)
4138
- return this.tracks[index];
4002
+ if (index < this.tracks.length) return this.tracks[index];
4139
4003
  Utils.ensureArrayCapacity(this.tracks, index + 1, null);
4140
4004
  this.tracks.length = index + 1;
4141
4005
  return null;
@@ -4187,13 +4051,11 @@ var spine = (() => {
4187
4051
  let tracks = this.tracks;
4188
4052
  for (let i = 0, n = tracks.length; i < n; i++) {
4189
4053
  let entry = tracks[i];
4190
- if (!entry)
4191
- continue;
4054
+ if (!entry) continue;
4192
4055
  while (entry.mixingFrom)
4193
4056
  entry = entry.mixingFrom;
4194
4057
  do {
4195
- if (!entry.mixingTo || entry.mixBlend != 3 /* add */)
4196
- this.computeHold(entry);
4058
+ if (!entry.mixingTo || entry.mixBlend != 3 /* add */) this.computeHold(entry);
4197
4059
  entry = entry.mixingTo;
4198
4060
  } while (entry);
4199
4061
  }
@@ -4222,8 +4084,7 @@ var spine = (() => {
4222
4084
  timelineMode[i] = FIRST;
4223
4085
  } else {
4224
4086
  for (let next = to.mixingTo; next; next = next.mixingTo) {
4225
- if (next.animation.hasTimeline(ids))
4226
- continue;
4087
+ if (next.animation.hasTimeline(ids)) continue;
4227
4088
  if (entry.mixDuration > 0) {
4228
4089
  timelineMode[i] = HOLD_MIX;
4229
4090
  timelineHoldMix[i] = next;
@@ -4237,21 +4098,18 @@ var spine = (() => {
4237
4098
  }
4238
4099
  /** Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing. */
4239
4100
  getCurrent(trackIndex) {
4240
- if (trackIndex >= this.tracks.length)
4241
- return null;
4101
+ if (trackIndex >= this.tracks.length) return null;
4242
4102
  return this.tracks[trackIndex];
4243
4103
  }
4244
4104
  /** Adds a listener to receive events for all track entries. */
4245
4105
  addListener(listener) {
4246
- if (!listener)
4247
- throw new Error("listener cannot be null.");
4106
+ if (!listener) throw new Error("listener cannot be null.");
4248
4107
  this.listeners.push(listener);
4249
4108
  }
4250
4109
  /** Removes the listener added with {@link #addListener()}. */
4251
4110
  removeListener(listener) {
4252
4111
  let index = this.listeners.indexOf(listener);
4253
- if (index >= 0)
4254
- this.listeners.splice(index, 1);
4112
+ if (index >= 0) this.listeners.splice(index, 1);
4255
4113
  }
4256
4114
  /** Removes all listeners added with {@link #addListener()}. */
4257
4115
  clearListeners() {
@@ -4264,8 +4122,6 @@ var spine = (() => {
4264
4122
  this.queue.clear();
4265
4123
  }
4266
4124
  };
4267
- var AnimationState = _AnimationState;
4268
- __publicField(AnimationState, "_emptyAnimation", new Animation("<empty>", [], 0));
4269
4125
  var TrackEntry = class {
4270
4126
  /** The animation to apply for this track entry. */
4271
4127
  animation = null;
@@ -4399,8 +4255,12 @@ var spine = (() => {
4399
4255
  }
4400
4256
  setMixDurationWithDelay(mixDuration, delay) {
4401
4257
  this._mixDuration = mixDuration;
4402
- if (this.previous != null && delay <= 0)
4403
- delay += this.previous.getTrackComplete() - mixDuration;
4258
+ if (delay <= 0) {
4259
+ if (this.previous != null)
4260
+ delay = Math.max(delay + this.previous.getTrackComplete() - mixDuration, 0);
4261
+ else
4262
+ delay = 0;
4263
+ }
4404
4264
  this.delay = delay;
4405
4265
  }
4406
4266
  /** Controls how properties keyed in the animation are mixed with lower tracks. Defaults to {@link MixBlend#replace}, which
@@ -4430,8 +4290,7 @@ var spine = (() => {
4430
4290
  getAnimationTime() {
4431
4291
  if (this.loop) {
4432
4292
  let duration = this.animationEnd - this.animationStart;
4433
- if (duration == 0)
4434
- return this.animationStart;
4293
+ if (duration == 0) return this.animationStart;
4435
4294
  return this.trackTime % duration + this.animationStart;
4436
4295
  }
4437
4296
  return Math.min(this.trackTime + this.animationStart, this.animationEnd);
@@ -4459,10 +4318,8 @@ var spine = (() => {
4459
4318
  getTrackComplete() {
4460
4319
  let duration = this.animationEnd - this.animationStart;
4461
4320
  if (duration != 0) {
4462
- if (this.loop)
4463
- return duration * (1 + (this.trackTime / duration | 0));
4464
- if (this.trackTime < duration)
4465
- return duration;
4321
+ if (this.loop) return duration * (1 + (this.trackTime / duration | 0));
4322
+ if (this.trackTime < duration) return duration;
4466
4323
  }
4467
4324
  return this.trackTime;
4468
4325
  }
@@ -4486,35 +4343,34 @@ var spine = (() => {
4486
4343
  this.animState = animState;
4487
4344
  }
4488
4345
  start(entry) {
4489
- this.objects.push(EventType.start);
4346
+ this.objects.push(0 /* start */);
4490
4347
  this.objects.push(entry);
4491
4348
  this.animState.animationsChanged = true;
4492
4349
  }
4493
4350
  interrupt(entry) {
4494
- this.objects.push(EventType.interrupt);
4351
+ this.objects.push(1 /* interrupt */);
4495
4352
  this.objects.push(entry);
4496
4353
  }
4497
4354
  end(entry) {
4498
- this.objects.push(EventType.end);
4355
+ this.objects.push(2 /* end */);
4499
4356
  this.objects.push(entry);
4500
4357
  this.animState.animationsChanged = true;
4501
4358
  }
4502
4359
  dispose(entry) {
4503
- this.objects.push(EventType.dispose);
4360
+ this.objects.push(3 /* dispose */);
4504
4361
  this.objects.push(entry);
4505
4362
  }
4506
4363
  complete(entry) {
4507
- this.objects.push(EventType.complete);
4364
+ this.objects.push(4 /* complete */);
4508
4365
  this.objects.push(entry);
4509
4366
  }
4510
4367
  event(entry, event) {
4511
- this.objects.push(EventType.event);
4368
+ this.objects.push(5 /* event */);
4512
4369
  this.objects.push(entry);
4513
4370
  this.objects.push(event);
4514
4371
  }
4515
4372
  drain() {
4516
- if (this.drainDisabled)
4517
- return;
4373
+ if (this.drainDisabled) return;
4518
4374
  this.drainDisabled = true;
4519
4375
  let objects = this.objects;
4520
4376
  let listeners = this.animState.listeners;
@@ -4522,59 +4378,48 @@ var spine = (() => {
4522
4378
  let type = objects[i];
4523
4379
  let entry = objects[i + 1];
4524
4380
  switch (type) {
4525
- case EventType.start:
4526
- if (entry.listener && entry.listener.start)
4527
- entry.listener.start(entry);
4381
+ case 0 /* start */:
4382
+ if (entry.listener && entry.listener.start) entry.listener.start(entry);
4528
4383
  for (let ii = 0; ii < listeners.length; ii++) {
4529
4384
  let listener = listeners[ii];
4530
- if (listener.start)
4531
- listener.start(entry);
4385
+ if (listener.start) listener.start(entry);
4532
4386
  }
4533
4387
  break;
4534
- case EventType.interrupt:
4535
- if (entry.listener && entry.listener.interrupt)
4536
- entry.listener.interrupt(entry);
4388
+ case 1 /* interrupt */:
4389
+ if (entry.listener && entry.listener.interrupt) entry.listener.interrupt(entry);
4537
4390
  for (let ii = 0; ii < listeners.length; ii++) {
4538
4391
  let listener = listeners[ii];
4539
- if (listener.interrupt)
4540
- listener.interrupt(entry);
4392
+ if (listener.interrupt) listener.interrupt(entry);
4541
4393
  }
4542
4394
  break;
4543
- case EventType.end:
4544
- if (entry.listener && entry.listener.end)
4545
- entry.listener.end(entry);
4395
+ case 2 /* end */:
4396
+ if (entry.listener && entry.listener.end) entry.listener.end(entry);
4546
4397
  for (let ii = 0; ii < listeners.length; ii++) {
4547
4398
  let listener = listeners[ii];
4548
- if (listener.end)
4549
- listener.end(entry);
4399
+ if (listener.end) listener.end(entry);
4550
4400
  }
4551
- case EventType.dispose:
4552
- if (entry.listener && entry.listener.dispose)
4553
- entry.listener.dispose(entry);
4401
+ // Fall through.
4402
+ case 3 /* dispose */:
4403
+ if (entry.listener && entry.listener.dispose) entry.listener.dispose(entry);
4554
4404
  for (let ii = 0; ii < listeners.length; ii++) {
4555
4405
  let listener = listeners[ii];
4556
- if (listener.dispose)
4557
- listener.dispose(entry);
4406
+ if (listener.dispose) listener.dispose(entry);
4558
4407
  }
4559
4408
  this.animState.trackEntryPool.free(entry);
4560
4409
  break;
4561
- case EventType.complete:
4562
- if (entry.listener && entry.listener.complete)
4563
- entry.listener.complete(entry);
4410
+ case 4 /* complete */:
4411
+ if (entry.listener && entry.listener.complete) entry.listener.complete(entry);
4564
4412
  for (let ii = 0; ii < listeners.length; ii++) {
4565
4413
  let listener = listeners[ii];
4566
- if (listener.complete)
4567
- listener.complete(entry);
4414
+ if (listener.complete) listener.complete(entry);
4568
4415
  }
4569
4416
  break;
4570
- case EventType.event:
4417
+ case 5 /* event */:
4571
4418
  let event = objects[i++ + 2];
4572
- if (entry.listener && entry.listener.event)
4573
- entry.listener.event(entry, event);
4419
+ if (entry.listener && entry.listener.event) entry.listener.event(entry, event);
4574
4420
  for (let ii = 0; ii < listeners.length; ii++) {
4575
4421
  let listener = listeners[ii];
4576
- if (listener.event)
4577
- listener.event(entry, event);
4422
+ if (listener.event) listener.event(entry, event);
4578
4423
  }
4579
4424
  break;
4580
4425
  }
@@ -4625,8 +4470,7 @@ var spine = (() => {
4625
4470
  /** The mix duration to use when no mix duration has been defined between two animations. */
4626
4471
  defaultMix = 0;
4627
4472
  constructor(skeletonData) {
4628
- if (!skeletonData)
4629
- throw new Error("skeletonData cannot be null.");
4473
+ if (!skeletonData) throw new Error("skeletonData cannot be null.");
4630
4474
  this.skeletonData = skeletonData;
4631
4475
  }
4632
4476
  /** Sets a mix duration by animation name.
@@ -4634,21 +4478,17 @@ var spine = (() => {
4634
4478
  * See {@link #setMixWith()}. */
4635
4479
  setMix(fromName, toName, duration) {
4636
4480
  let from = this.skeletonData.findAnimation(fromName);
4637
- if (!from)
4638
- throw new Error("Animation not found: " + fromName);
4481
+ if (!from) throw new Error("Animation not found: " + fromName);
4639
4482
  let to = this.skeletonData.findAnimation(toName);
4640
- if (!to)
4641
- throw new Error("Animation not found: " + toName);
4483
+ if (!to) throw new Error("Animation not found: " + toName);
4642
4484
  this.setMixWith(from, to, duration);
4643
4485
  }
4644
4486
  /** Sets the mix duration when changing from the specified animation to the other.
4645
4487
  *
4646
4488
  * See {@link TrackEntry#mixDuration}. */
4647
4489
  setMixWith(from, to, duration) {
4648
- if (!from)
4649
- throw new Error("from cannot be null.");
4650
- if (!to)
4651
- throw new Error("to cannot be null.");
4490
+ if (!from) throw new Error("from cannot be null.");
4491
+ if (!to) throw new Error("to cannot be null.");
4652
4492
  let key = from.name + "." + to.name;
4653
4493
  this.animationToMixTime[key] = duration;
4654
4494
  }
@@ -4662,13 +4502,13 @@ var spine = (() => {
4662
4502
  };
4663
4503
 
4664
4504
  // spine-core/src/attachments/BoundingBoxAttachment.ts
4665
- var BoundingBoxAttachment = class extends VertexAttachment {
4505
+ var BoundingBoxAttachment = class _BoundingBoxAttachment extends VertexAttachment {
4666
4506
  color = new Color(1, 1, 1, 1);
4667
4507
  constructor(name) {
4668
4508
  super(name);
4669
4509
  }
4670
4510
  copy() {
4671
- let copy = new BoundingBoxAttachment(this.name);
4511
+ let copy = new _BoundingBoxAttachment(this.name);
4672
4512
  this.copyTo(copy);
4673
4513
  copy.color.setFromColor(this.color);
4674
4514
  return copy;
@@ -4676,7 +4516,7 @@ var spine = (() => {
4676
4516
  };
4677
4517
 
4678
4518
  // spine-core/src/attachments/ClippingAttachment.ts
4679
- var ClippingAttachment = class extends VertexAttachment {
4519
+ var ClippingAttachment = class _ClippingAttachment extends VertexAttachment {
4680
4520
  /** Clipping is performed between the clipping polygon's slot and the end slot. Returns null if clipping is done until the end of
4681
4521
  * the skeleton's rendering. */
4682
4522
  endSlot = null;
@@ -4689,7 +4529,7 @@ var spine = (() => {
4689
4529
  super(name);
4690
4530
  }
4691
4531
  copy() {
4692
- let copy = new ClippingAttachment(this.name);
4532
+ let copy = new _ClippingAttachment(this.name);
4693
4533
  this.copyTo(copy);
4694
4534
  copy.endSlot = this.endSlot;
4695
4535
  copy.color.setFromColor(this.color);
@@ -4765,10 +4605,8 @@ var spine = (() => {
4765
4605
  page2.magFilter = Utils.enumValue(TextureFilter, entry[2]);
4766
4606
  };
4767
4607
  pageFields["repeat"] = (page2) => {
4768
- if (entry[1].indexOf("x") != -1)
4769
- page2.uWrap = 10497 /* Repeat */;
4770
- if (entry[1].indexOf("y") != -1)
4771
- page2.vWrap = 10497 /* Repeat */;
4608
+ if (entry[1].indexOf("x") != -1) page2.uWrap = 10497 /* Repeat */;
4609
+ if (entry[1].indexOf("y") != -1) page2.vWrap = 10497 /* Repeat */;
4772
4610
  };
4773
4611
  pageFields["pma"] = (page2) => {
4774
4612
  page2.pma = entry[1] == "true";
@@ -4816,45 +4654,37 @@ var spine = (() => {
4816
4654
  while (line && line.trim().length == 0)
4817
4655
  line = reader.readLine();
4818
4656
  while (true) {
4819
- if (!line || line.trim().length == 0)
4820
- break;
4821
- if (reader.readEntry(entry, line) == 0)
4822
- break;
4657
+ if (!line || line.trim().length == 0) break;
4658
+ if (reader.readEntry(entry, line) == 0) break;
4823
4659
  line = reader.readLine();
4824
4660
  }
4825
4661
  let page = null;
4826
4662
  let names = null;
4827
4663
  let values = null;
4828
4664
  while (true) {
4829
- if (line === null)
4830
- break;
4665
+ if (line === null) break;
4831
4666
  if (line.trim().length == 0) {
4832
4667
  page = null;
4833
4668
  line = reader.readLine();
4834
4669
  } else if (!page) {
4835
4670
  page = new TextureAtlasPage(line.trim());
4836
4671
  while (true) {
4837
- if (reader.readEntry(entry, line = reader.readLine()) == 0)
4838
- break;
4672
+ if (reader.readEntry(entry, line = reader.readLine()) == 0) break;
4839
4673
  let field = pageFields[entry[0]];
4840
- if (field)
4841
- field(page);
4674
+ if (field) field(page);
4842
4675
  }
4843
4676
  this.pages.push(page);
4844
4677
  } else {
4845
4678
  let region = new TextureAtlasRegion(page, line);
4846
4679
  while (true) {
4847
4680
  let count = reader.readEntry(entry, line = reader.readLine());
4848
- if (count == 0)
4849
- break;
4681
+ if (count == 0) break;
4850
4682
  let field = regionFields[entry[0]];
4851
4683
  if (field)
4852
4684
  field(region);
4853
4685
  else {
4854
- if (!names)
4855
- names = [];
4856
- if (!values)
4857
- values = [];
4686
+ if (!names) names = [];
4687
+ if (!values) values = [];
4858
4688
  names.push(entry[0]);
4859
4689
  let entryValues = [];
4860
4690
  for (let i = 0; i < count; i++)
@@ -4915,14 +4745,11 @@ var spine = (() => {
4915
4745
  return this.lines[this.index++];
4916
4746
  }
4917
4747
  readEntry(entry, line) {
4918
- if (!line)
4919
- return 0;
4748
+ if (!line) return 0;
4920
4749
  line = line.trim();
4921
- if (line.length == 0)
4922
- return 0;
4750
+ if (line.length == 0) return 0;
4923
4751
  let colon = line.indexOf(":");
4924
- if (colon == -1)
4925
- return 0;
4752
+ if (colon == -1) return 0;
4926
4753
  entry[0] = line.substr(0, colon).trim();
4927
4754
  for (let i = 1, lastMatch = colon + 1; ; i++) {
4928
4755
  let comma = line.indexOf(",", lastMatch);
@@ -4932,8 +4759,7 @@ var spine = (() => {
4932
4759
  }
4933
4760
  entry[i] = line.substr(lastMatch, comma - lastMatch).trim();
4934
4761
  lastMatch = comma + 1;
4935
- if (i == 4)
4936
- return 4;
4762
+ if (i == 4) return 4;
4937
4763
  }
4938
4764
  }
4939
4765
  };
@@ -4981,7 +4807,7 @@ var spine = (() => {
4981
4807
  };
4982
4808
 
4983
4809
  // spine-core/src/attachments/MeshAttachment.ts
4984
- var MeshAttachment = class extends VertexAttachment {
4810
+ var MeshAttachment = class _MeshAttachment extends VertexAttachment {
4985
4811
  region = null;
4986
4812
  /** The name of the texture region for this attachment. */
4987
4813
  path;
@@ -5014,11 +4840,9 @@ var spine = (() => {
5014
4840
  /** Calculates {@link #uvs} using the {@link #regionUVs} and region. Must be called if the region, the region's properties, or
5015
4841
  * the {@link #regionUVs} are changed. */
5016
4842
  updateRegion() {
5017
- if (!this.region)
5018
- throw new Error("Region not set.");
4843
+ if (!this.region) throw new Error("Region not set.");
5019
4844
  let regionUVs = this.regionUVs;
5020
- if (!this.uvs || this.uvs.length != regionUVs.length)
5021
- this.uvs = Utils.newFloatArray(regionUVs.length);
4845
+ if (!this.uvs || this.uvs.length != regionUVs.length) this.uvs = Utils.newFloatArray(regionUVs.length);
5022
4846
  let uvs = this.uvs;
5023
4847
  let n = this.uvs.length;
5024
4848
  let u = this.region.u, v = this.region.v, width = 0, height = 0;
@@ -5093,9 +4917,8 @@ var spine = (() => {
5093
4917
  }
5094
4918
  }
5095
4919
  copy() {
5096
- if (this.parentMesh)
5097
- return this.newLinkedMesh();
5098
- let copy = new MeshAttachment(this.name, this.path);
4920
+ if (this.parentMesh) return this.newLinkedMesh();
4921
+ let copy = new _MeshAttachment(this.name, this.path);
5099
4922
  copy.region = this.region;
5100
4923
  copy.color.setFromColor(this.color);
5101
4924
  this.copyTo(copy);
@@ -5116,25 +4939,23 @@ var spine = (() => {
5116
4939
  return copy;
5117
4940
  }
5118
4941
  computeWorldVertices(slot, start, count, worldVertices, offset, stride) {
5119
- if (this.sequence != null)
5120
- this.sequence.apply(slot, this);
4942
+ if (this.sequence != null) this.sequence.apply(slot, this);
5121
4943
  super.computeWorldVertices(slot, start, count, worldVertices, offset, stride);
5122
4944
  }
5123
4945
  /** Returns a new mesh with the {@link #parentMesh} set to this mesh's parent mesh, if any, else to this mesh. **/
5124
4946
  newLinkedMesh() {
5125
- let copy = new MeshAttachment(this.name, this.path);
4947
+ let copy = new _MeshAttachment(this.name, this.path);
5126
4948
  copy.region = this.region;
5127
4949
  copy.color.setFromColor(this.color);
5128
4950
  copy.timelineAttachment = this.timelineAttachment;
5129
4951
  copy.setParentMesh(this.parentMesh ? this.parentMesh : this);
5130
- if (copy.region != null)
5131
- copy.updateRegion();
4952
+ if (copy.region != null) copy.updateRegion();
5132
4953
  return copy;
5133
4954
  }
5134
4955
  };
5135
4956
 
5136
4957
  // spine-core/src/attachments/PathAttachment.ts
5137
- var PathAttachment = class extends VertexAttachment {
4958
+ var PathAttachment = class _PathAttachment extends VertexAttachment {
5138
4959
  /** The lengths along the path in the setup pose from the start of the path to the end of each Bezier curve. */
5139
4960
  lengths = [];
5140
4961
  /** If true, the start and end knots are connected. */
@@ -5149,7 +4970,7 @@ var spine = (() => {
5149
4970
  super(name);
5150
4971
  }
5151
4972
  copy() {
5152
- let copy = new PathAttachment(this.name);
4973
+ let copy = new _PathAttachment(this.name);
5153
4974
  this.copyTo(copy);
5154
4975
  copy.lengths = new Array(this.lengths.length);
5155
4976
  Utils.arrayCopy(this.lengths, 0, copy.lengths, 0, this.lengths.length);
@@ -5161,7 +4982,7 @@ var spine = (() => {
5161
4982
  };
5162
4983
 
5163
4984
  // spine-core/src/attachments/PointAttachment.ts
5164
- var PointAttachment = class extends VertexAttachment {
4985
+ var PointAttachment = class _PointAttachment extends VertexAttachment {
5165
4986
  x = 0;
5166
4987
  y = 0;
5167
4988
  rotation = 0;
@@ -5183,7 +5004,7 @@ var spine = (() => {
5183
5004
  return MathUtils.atan2Deg(y, x);
5184
5005
  }
5185
5006
  copy() {
5186
- let copy = new PointAttachment(this.name);
5007
+ let copy = new _PointAttachment(this.name);
5187
5008
  copy.x = this.x;
5188
5009
  copy.y = this.y;
5189
5010
  copy.rotation = this.rotation;
@@ -5193,7 +5014,7 @@ var spine = (() => {
5193
5014
  };
5194
5015
 
5195
5016
  // spine-core/src/attachments/RegionAttachment.ts
5196
- var _RegionAttachment = class extends Attachment {
5017
+ var RegionAttachment = class _RegionAttachment extends Attachment {
5197
5018
  /** The local x translation. */
5198
5019
  x = 0;
5199
5020
  /** The local y translation. */
@@ -5226,8 +5047,7 @@ var spine = (() => {
5226
5047
  }
5227
5048
  /** Calculates the {@link #offset} using the region settings. Must be called after changing region settings. */
5228
5049
  updateRegion() {
5229
- if (!this.region)
5230
- throw new Error("Region not set.");
5050
+ if (!this.region) throw new Error("Region not set.");
5231
5051
  let region = this.region;
5232
5052
  let uvs = this.uvs;
5233
5053
  if (region == null) {
@@ -5340,40 +5160,39 @@ var spine = (() => {
5340
5160
  copy.sequence = this.sequence != null ? this.sequence.copy() : null;
5341
5161
  return copy;
5342
5162
  }
5163
+ static X1 = 0;
5164
+ static Y1 = 1;
5165
+ static C1R = 2;
5166
+ static C1G = 3;
5167
+ static C1B = 4;
5168
+ static C1A = 5;
5169
+ static U1 = 6;
5170
+ static V1 = 7;
5171
+ static X2 = 8;
5172
+ static Y2 = 9;
5173
+ static C2R = 10;
5174
+ static C2G = 11;
5175
+ static C2B = 12;
5176
+ static C2A = 13;
5177
+ static U2 = 14;
5178
+ static V2 = 15;
5179
+ static X3 = 16;
5180
+ static Y3 = 17;
5181
+ static C3R = 18;
5182
+ static C3G = 19;
5183
+ static C3B = 20;
5184
+ static C3A = 21;
5185
+ static U3 = 22;
5186
+ static V3 = 23;
5187
+ static X4 = 24;
5188
+ static Y4 = 25;
5189
+ static C4R = 26;
5190
+ static C4G = 27;
5191
+ static C4B = 28;
5192
+ static C4A = 29;
5193
+ static U4 = 30;
5194
+ static V4 = 31;
5343
5195
  };
5344
- var RegionAttachment = _RegionAttachment;
5345
- __publicField(RegionAttachment, "X1", 0);
5346
- __publicField(RegionAttachment, "Y1", 1);
5347
- __publicField(RegionAttachment, "C1R", 2);
5348
- __publicField(RegionAttachment, "C1G", 3);
5349
- __publicField(RegionAttachment, "C1B", 4);
5350
- __publicField(RegionAttachment, "C1A", 5);
5351
- __publicField(RegionAttachment, "U1", 6);
5352
- __publicField(RegionAttachment, "V1", 7);
5353
- __publicField(RegionAttachment, "X2", 8);
5354
- __publicField(RegionAttachment, "Y2", 9);
5355
- __publicField(RegionAttachment, "C2R", 10);
5356
- __publicField(RegionAttachment, "C2G", 11);
5357
- __publicField(RegionAttachment, "C2B", 12);
5358
- __publicField(RegionAttachment, "C2A", 13);
5359
- __publicField(RegionAttachment, "U2", 14);
5360
- __publicField(RegionAttachment, "V2", 15);
5361
- __publicField(RegionAttachment, "X3", 16);
5362
- __publicField(RegionAttachment, "Y3", 17);
5363
- __publicField(RegionAttachment, "C3R", 18);
5364
- __publicField(RegionAttachment, "C3G", 19);
5365
- __publicField(RegionAttachment, "C3B", 20);
5366
- __publicField(RegionAttachment, "C3A", 21);
5367
- __publicField(RegionAttachment, "U3", 22);
5368
- __publicField(RegionAttachment, "V3", 23);
5369
- __publicField(RegionAttachment, "X4", 24);
5370
- __publicField(RegionAttachment, "Y4", 25);
5371
- __publicField(RegionAttachment, "C4R", 26);
5372
- __publicField(RegionAttachment, "C4G", 27);
5373
- __publicField(RegionAttachment, "C4B", 28);
5374
- __publicField(RegionAttachment, "C4A", 29);
5375
- __publicField(RegionAttachment, "U4", 30);
5376
- __publicField(RegionAttachment, "V4", 31);
5377
5196
 
5378
5197
  // spine-core/src/AtlasAttachmentLoader.ts
5379
5198
  var AtlasAttachmentLoader = class {
@@ -5386,8 +5205,7 @@ var spine = (() => {
5386
5205
  for (let i = 0, n = regions.length; i < n; i++) {
5387
5206
  let path = sequence.getPath(basePath, i);
5388
5207
  let region = this.atlas.findRegion(path);
5389
- if (region == null)
5390
- throw new Error("Region not found in atlas: " + path + " (sequence: " + name + ")");
5208
+ if (region == null) throw new Error("Region not found in atlas: " + path + " (sequence: " + name + ")");
5391
5209
  regions[i] = region;
5392
5210
  }
5393
5211
  }
@@ -5397,8 +5215,7 @@ var spine = (() => {
5397
5215
  this.loadSequence(name, path, sequence);
5398
5216
  } else {
5399
5217
  let region = this.atlas.findRegion(path);
5400
- if (!region)
5401
- throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
5218
+ if (!region) throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
5402
5219
  attachment.region = region;
5403
5220
  }
5404
5221
  return attachment;
@@ -5409,8 +5226,7 @@ var spine = (() => {
5409
5226
  this.loadSequence(name, path, sequence);
5410
5227
  } else {
5411
5228
  let region = this.atlas.findRegion(path);
5412
- if (!region)
5413
- throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
5229
+ if (!region) throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
5414
5230
  attachment.region = region;
5415
5231
  }
5416
5232
  return attachment;
@@ -5454,7 +5270,7 @@ var spine = (() => {
5454
5270
  /** The local shearX. */
5455
5271
  shearY = 0;
5456
5272
  /** The transform mode for how parent world transforms affect this bone. */
5457
- inherit = Inherit.Normal;
5273
+ inherit = 0 /* Normal */;
5458
5274
  /** When true, {@link Skeleton#updateWorldTransform()} only updates this bone if the {@link Skeleton#skin} contains this
5459
5275
  * bone.
5460
5276
  * @see Skin#bones */
@@ -5467,10 +5283,8 @@ var spine = (() => {
5467
5283
  /** False if the bone was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */
5468
5284
  visible = false;
5469
5285
  constructor(index, name, parent) {
5470
- if (index < 0)
5471
- throw new Error("index must be >= 0.");
5472
- if (!name)
5473
- throw new Error("name cannot be null.");
5286
+ if (index < 0) throw new Error("index must be >= 0.");
5287
+ if (!name) throw new Error("name cannot be null.");
5474
5288
  this.index = index;
5475
5289
  this.name = name;
5476
5290
  this.parent = parent;
@@ -5540,10 +5354,8 @@ var spine = (() => {
5540
5354
  active = false;
5541
5355
  /** @param parent May be null. */
5542
5356
  constructor(data, skeleton, parent) {
5543
- if (!data)
5544
- throw new Error("data cannot be null.");
5545
- if (!skeleton)
5546
- throw new Error("skeleton cannot be null.");
5357
+ if (!data) throw new Error("data cannot be null.");
5358
+ if (!skeleton) throw new Error("skeleton cannot be null.");
5547
5359
  this.data = data;
5548
5360
  this.skeleton = skeleton;
5549
5361
  this.parent = parent;
@@ -5652,13 +5464,11 @@ var spine = (() => {
5652
5464
  let za = (pa * cos + pb * sin) / this.skeleton.scaleX;
5653
5465
  let zc = (pc * cos + pd * sin) / this.skeleton.scaleY;
5654
5466
  let s = Math.sqrt(za * za + zc * zc);
5655
- if (s > 1e-5)
5656
- s = 1 / s;
5467
+ if (s > 1e-5) s = 1 / s;
5657
5468
  za *= s;
5658
5469
  zc *= s;
5659
5470
  s = Math.sqrt(za * za + zc * zc);
5660
- if (this.inherit == 3 /* NoScale */ && pa * pd - pb * pc < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
5661
- s = -s;
5471
+ if (this.inherit == 3 /* NoScale */ && pa * pd - pb * pc < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0)) s = -s;
5662
5472
  rotation = Math.PI / 2 + Math.atan2(zc, za);
5663
5473
  const zb = Math.cos(rotation) * s;
5664
5474
  const zd = Math.sin(rotation) * s;
@@ -5741,13 +5551,11 @@ var spine = (() => {
5741
5551
  pa = (pa * cos + pb * sin) / this.skeleton.scaleX;
5742
5552
  pc = (pc * cos + pd * sin) / this.skeleton.scaleY;
5743
5553
  let s = Math.sqrt(pa * pa + pc * pc);
5744
- if (s > 1e-5)
5745
- s = 1 / s;
5554
+ if (s > 1e-5) s = 1 / s;
5746
5555
  pa *= s;
5747
5556
  pc *= s;
5748
5557
  s = Math.sqrt(pa * pa + pc * pc);
5749
- if (this.inherit == 3 /* NoScale */ && pid < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
5750
- s = -s;
5558
+ if (this.inherit == 3 /* NoScale */ && pid < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0)) s = -s;
5751
5559
  let r = MathUtils.PI / 2 + Math.atan2(pc, pa);
5752
5560
  pb = Math.cos(r) * s;
5753
5561
  pd = Math.sin(r) * s;
@@ -5809,14 +5617,12 @@ var spine = (() => {
5809
5617
  }
5810
5618
  /** Transforms a point from world coordinates to the parent bone's local coordinates. */
5811
5619
  worldToParent(world) {
5812
- if (world == null)
5813
- throw new Error("world cannot be null.");
5620
+ if (world == null) throw new Error("world cannot be null.");
5814
5621
  return this.parent == null ? world : this.parent.worldToLocal(world);
5815
5622
  }
5816
5623
  /** Transforms a point from the parent bone's coordinates to world coordinates. */
5817
5624
  parentToWorld(world) {
5818
- if (world == null)
5819
- throw new Error("world cannot be null.");
5625
+ if (world == null) throw new Error("world cannot be null.");
5820
5626
  return this.parent == null ? world : this.parent.localToWorld(world);
5821
5627
  }
5822
5628
  /** Transforms a world rotation to a local rotation. */
@@ -5860,6 +5666,8 @@ var spine = (() => {
5860
5666
  textureLoader;
5861
5667
  downloader;
5862
5668
  assets = {};
5669
+ assetsRefCount = {};
5670
+ assetsLoaded = {};
5863
5671
  errors = {};
5864
5672
  toLoad = 0;
5865
5673
  loaded = 0;
@@ -5876,24 +5684,21 @@ var spine = (() => {
5876
5684
  this.toLoad--;
5877
5685
  this.loaded++;
5878
5686
  this.assets[path] = asset;
5879
- if (callback)
5880
- callback(path, asset);
5687
+ this.assetsRefCount[path] = (this.assetsRefCount[path] || 0) + 1;
5688
+ if (callback) callback(path, asset);
5881
5689
  }
5882
5690
  error(callback, path, message) {
5883
5691
  this.toLoad--;
5884
5692
  this.loaded++;
5885
5693
  this.errors[path] = message;
5886
- if (callback)
5887
- callback(path, message);
5694
+ if (callback) callback(path, message);
5888
5695
  }
5889
5696
  loadAll() {
5890
5697
  let promise = new Promise((resolve, reject) => {
5891
5698
  let check = () => {
5892
5699
  if (this.isLoadingComplete()) {
5893
- if (this.hasErrors())
5894
- reject(this.errors);
5895
- else
5896
- resolve(this);
5700
+ if (this.hasErrors()) reject(this.errors);
5701
+ else resolve(this);
5897
5702
  return;
5898
5703
  }
5899
5704
  requestAnimationFrame(check);
@@ -5909,10 +5714,16 @@ var spine = (() => {
5909
5714
  }, error = () => {
5910
5715
  }) {
5911
5716
  path = this.start(path);
5912
- this.downloader.downloadBinary(path, (data) => {
5913
- this.success(success, path, data);
5914
- }, (status, responseText) => {
5915
- this.error(error, path, `Couldn't load binary ${path}: status ${status}, ${responseText}`);
5717
+ if (this.reuseAssets(path, success, error)) return;
5718
+ this.assetsLoaded[path] = new Promise((resolve, reject) => {
5719
+ this.downloader.downloadBinary(path, (data) => {
5720
+ this.success(success, path, data);
5721
+ resolve(data);
5722
+ }, (status, responseText) => {
5723
+ const errorMsg = `Couldn't load binary ${path}: status ${status}, ${responseText}`;
5724
+ this.error(error, path, errorMsg);
5725
+ reject(errorMsg);
5726
+ });
5916
5727
  });
5917
5728
  }
5918
5729
  loadText(path, success = () => {
@@ -5929,43 +5740,69 @@ var spine = (() => {
5929
5740
  }, error = () => {
5930
5741
  }) {
5931
5742
  path = this.start(path);
5932
- this.downloader.downloadJson(path, (data) => {
5933
- this.success(success, path, data);
5934
- }, (status, responseText) => {
5935
- this.error(error, path, `Couldn't load JSON ${path}: status ${status}, ${responseText}`);
5743
+ if (this.reuseAssets(path, success, error)) return;
5744
+ this.assetsLoaded[path] = new Promise((resolve, reject) => {
5745
+ this.downloader.downloadJson(path, (data) => {
5746
+ this.success(success, path, data);
5747
+ resolve(data);
5748
+ }, (status, responseText) => {
5749
+ const errorMsg = `Couldn't load JSON ${path}: status ${status}, ${responseText}`;
5750
+ this.error(error, path, errorMsg);
5751
+ reject(errorMsg);
5752
+ });
5936
5753
  });
5937
5754
  }
5755
+ reuseAssets(path, success = () => {
5756
+ }, error = () => {
5757
+ }) {
5758
+ const loadedStatus = this.assetsLoaded[path];
5759
+ const alreadyExistsOrLoading = loadedStatus !== void 0;
5760
+ if (alreadyExistsOrLoading) {
5761
+ loadedStatus.then((data) => this.success(success, path, data)).catch((errorMsg) => this.error(error, path, errorMsg));
5762
+ }
5763
+ return alreadyExistsOrLoading;
5764
+ }
5938
5765
  loadTexture(path, success = () => {
5939
5766
  }, error = () => {
5940
5767
  }) {
5941
5768
  path = this.start(path);
5942
- let isBrowser = !!(typeof window !== "undefined" && typeof navigator !== "undefined" && window.document);
5943
- let isWebWorker = !isBrowser;
5944
- if (isWebWorker) {
5945
- fetch(path, { mode: "cors" }).then((response) => {
5946
- if (response.ok)
5947
- return response.blob();
5948
- this.error(error, path, `Couldn't load image: ${path}`);
5949
- return null;
5950
- }).then((blob) => {
5951
- return blob ? createImageBitmap(blob, { premultiplyAlpha: "none", colorSpaceConversion: "none" }) : null;
5952
- }).then((bitmap) => {
5953
- if (bitmap)
5954
- this.success(success, path, this.textureLoader(bitmap));
5955
- });
5956
- } else {
5957
- let image = new Image();
5958
- image.crossOrigin = "anonymous";
5959
- image.onload = () => {
5960
- this.success(success, path, this.textureLoader(image));
5961
- };
5962
- image.onerror = () => {
5963
- this.error(error, path, `Couldn't load image: ${path}`);
5964
- };
5965
- if (this.downloader.rawDataUris[path])
5966
- path = this.downloader.rawDataUris[path];
5967
- image.src = path;
5968
- }
5769
+ if (this.reuseAssets(path, success, error)) return;
5770
+ this.assetsLoaded[path] = new Promise((resolve, reject) => {
5771
+ let isBrowser = !!(typeof window !== "undefined" && typeof navigator !== "undefined" && window.document);
5772
+ let isWebWorker = !isBrowser;
5773
+ if (isWebWorker) {
5774
+ fetch(path, { mode: "cors" }).then((response) => {
5775
+ if (response.ok) return response.blob();
5776
+ const errorMsg = `Couldn't load image: ${path}`;
5777
+ this.error(error, path, `Couldn't load image: ${path}`);
5778
+ reject(errorMsg);
5779
+ }).then((blob) => {
5780
+ return blob ? createImageBitmap(blob, { premultiplyAlpha: "none", colorSpaceConversion: "none" }) : null;
5781
+ }).then((bitmap) => {
5782
+ if (bitmap) {
5783
+ const texture = this.textureLoader(bitmap);
5784
+ this.success(success, path, texture);
5785
+ resolve(texture);
5786
+ }
5787
+ ;
5788
+ });
5789
+ } else {
5790
+ let image = new Image();
5791
+ image.crossOrigin = "anonymous";
5792
+ image.onload = () => {
5793
+ const texture = this.textureLoader(image);
5794
+ this.success(success, path, texture);
5795
+ resolve(texture);
5796
+ };
5797
+ image.onerror = () => {
5798
+ const errorMsg = `Couldn't load image: ${path}`;
5799
+ this.error(error, path, errorMsg);
5800
+ reject(errorMsg);
5801
+ };
5802
+ if (this.downloader.rawDataUris[path]) path = this.downloader.rawDataUris[path];
5803
+ image.src = path;
5804
+ }
5805
+ });
5969
5806
  }
5970
5807
  loadTextureAtlas(path, success = () => {
5971
5808
  }, error = () => {
@@ -5973,32 +5810,113 @@ var spine = (() => {
5973
5810
  let index = path.lastIndexOf("/");
5974
5811
  let parent = index >= 0 ? path.substring(0, index + 1) : "";
5975
5812
  path = this.start(path);
5976
- this.downloader.downloadText(path, (atlasText) => {
5977
- try {
5978
- let atlas = new TextureAtlas(atlasText);
5979
- let toLoad = atlas.pages.length, abort = false;
5980
- for (let page of atlas.pages) {
5981
- this.loadTexture(
5982
- !fileAlias ? parent + page.name : fileAlias[page.name],
5983
- (imagePath, texture) => {
5984
- if (!abort) {
5985
- page.setTexture(texture);
5986
- if (--toLoad == 0)
5987
- this.success(success, path, atlas);
5813
+ if (this.reuseAssets(path, success, error)) return;
5814
+ this.assetsLoaded[path] = new Promise((resolve, reject) => {
5815
+ this.downloader.downloadText(path, (atlasText) => {
5816
+ try {
5817
+ let atlas = new TextureAtlas(atlasText);
5818
+ let toLoad = atlas.pages.length, abort = false;
5819
+ for (let page of atlas.pages) {
5820
+ this.loadTexture(
5821
+ !fileAlias ? parent + page.name : fileAlias[page.name],
5822
+ (imagePath, texture) => {
5823
+ if (!abort) {
5824
+ page.setTexture(texture);
5825
+ if (--toLoad == 0) {
5826
+ this.success(success, path, atlas);
5827
+ resolve(atlas);
5828
+ }
5829
+ }
5830
+ },
5831
+ (imagePath, message) => {
5832
+ if (!abort) {
5833
+ const errorMsg = `Couldn't load texture atlas ${path} page image: ${imagePath}`;
5834
+ this.error(error, path, errorMsg);
5835
+ reject(errorMsg);
5836
+ }
5837
+ abort = true;
5988
5838
  }
5989
- },
5990
- (imagePath, message) => {
5991
- if (!abort)
5992
- this.error(error, path, `Couldn't load texture atlas ${path} page image: ${imagePath}`);
5993
- abort = true;
5994
- }
5995
- );
5839
+ );
5840
+ }
5841
+ } catch (e) {
5842
+ const errorMsg = `Couldn't parse texture atlas ${path}: ${e.message}`;
5843
+ this.error(error, path, errorMsg);
5844
+ reject(errorMsg);
5996
5845
  }
5997
- } catch (e) {
5998
- this.error(error, path, `Couldn't parse texture atlas ${path}: ${e.message}`);
5999
- }
6000
- }, (status, responseText) => {
6001
- this.error(error, path, `Couldn't load texture atlas ${path}: status ${status}, ${responseText}`);
5846
+ }, (status, responseText) => {
5847
+ const errorMsg = `Couldn't load texture atlas ${path}: status ${status}, ${responseText}`;
5848
+ this.error(error, path, errorMsg);
5849
+ reject(errorMsg);
5850
+ });
5851
+ });
5852
+ }
5853
+ loadTextureAtlasButNoTextures(path, success = () => {
5854
+ }, error = () => {
5855
+ }, fileAlias) {
5856
+ path = this.start(path);
5857
+ if (this.reuseAssets(path, success, error)) return;
5858
+ this.assetsLoaded[path] = new Promise((resolve, reject) => {
5859
+ this.downloader.downloadText(path, (atlasText) => {
5860
+ try {
5861
+ const atlas = new TextureAtlas(atlasText);
5862
+ this.success(success, path, atlas);
5863
+ resolve(atlas);
5864
+ } catch (e) {
5865
+ const errorMsg = `Couldn't parse texture atlas ${path}: ${e.message}`;
5866
+ this.error(error, path, errorMsg);
5867
+ reject(errorMsg);
5868
+ }
5869
+ }, (status, responseText) => {
5870
+ const errorMsg = `Couldn't load texture atlas ${path}: status ${status}, ${responseText}`;
5871
+ this.error(error, path, errorMsg);
5872
+ reject(errorMsg);
5873
+ });
5874
+ });
5875
+ }
5876
+ // Promisified versions of load function
5877
+ async loadBinaryAsync(path) {
5878
+ return new Promise((resolve, reject) => {
5879
+ this.loadBinary(
5880
+ path,
5881
+ (_, binary) => resolve(binary),
5882
+ (_, message) => reject(message)
5883
+ );
5884
+ });
5885
+ }
5886
+ async loadJsonAsync(path) {
5887
+ return new Promise((resolve, reject) => {
5888
+ this.loadJson(
5889
+ path,
5890
+ (_, object) => resolve(object),
5891
+ (_, message) => reject(message)
5892
+ );
5893
+ });
5894
+ }
5895
+ async loadTextureAsync(path) {
5896
+ return new Promise((resolve, reject) => {
5897
+ this.loadTexture(
5898
+ path,
5899
+ (_, texture) => resolve(texture),
5900
+ (_, message) => reject(message)
5901
+ );
5902
+ });
5903
+ }
5904
+ async loadTextureAtlasAsync(path) {
5905
+ return new Promise((resolve, reject) => {
5906
+ this.loadTextureAtlas(
5907
+ path,
5908
+ (_, atlas) => resolve(atlas),
5909
+ (_, message) => reject(message)
5910
+ );
5911
+ });
5912
+ }
5913
+ async loadTextureAtlasButNoTexturesAsync(path) {
5914
+ return new Promise((resolve, reject) => {
5915
+ this.loadTextureAtlasButNoTextures(
5916
+ path,
5917
+ (_, atlas) => resolve(atlas),
5918
+ (_, message) => reject(message)
5919
+ );
6002
5920
  });
6003
5921
  }
6004
5922
  get(path) {
@@ -6007,26 +5925,27 @@ var spine = (() => {
6007
5925
  require(path) {
6008
5926
  path = this.pathPrefix + path;
6009
5927
  let asset = this.assets[path];
6010
- if (asset)
6011
- return asset;
5928
+ if (asset) return asset;
6012
5929
  let error = this.errors[path];
6013
5930
  throw Error("Asset not found: " + path + (error ? "\n" + error : ""));
6014
5931
  }
6015
5932
  remove(path) {
6016
5933
  path = this.pathPrefix + path;
6017
5934
  let asset = this.assets[path];
6018
- if (asset.dispose)
6019
- asset.dispose();
5935
+ if (asset.dispose) asset.dispose();
6020
5936
  delete this.assets[path];
5937
+ delete this.assetsRefCount[path];
5938
+ delete this.assetsLoaded[path];
6021
5939
  return asset;
6022
5940
  }
6023
5941
  removeAll() {
6024
- for (let key in this.assets) {
6025
- let asset = this.assets[key];
6026
- if (asset.dispose)
6027
- asset.dispose();
5942
+ for (let path in this.assets) {
5943
+ let asset = this.assets[path];
5944
+ if (asset.dispose) asset.dispose();
6028
5945
  }
6029
5946
  this.assets = {};
5947
+ this.assetsLoaded = {};
5948
+ this.assetsRefCount = {};
6030
5949
  }
6031
5950
  isLoadingComplete() {
6032
5951
  return this.toLoad == 0;
@@ -6040,6 +5959,12 @@ var spine = (() => {
6040
5959
  dispose() {
6041
5960
  this.removeAll();
6042
5961
  }
5962
+ // dispose asset only if it's not used by others
5963
+ disposeAsset(path) {
5964
+ if (--this.assetsRefCount[path] === 0) {
5965
+ this.remove(path);
5966
+ }
5967
+ }
6043
5968
  hasErrors() {
6044
5969
  return Object.keys(this.errors).length > 0;
6045
5970
  }
@@ -6076,18 +6001,16 @@ var spine = (() => {
6076
6001
  throw new Error("Not a data URI.");
6077
6002
  }
6078
6003
  let base64Idx = dataUri.indexOf("base64,");
6079
- if (base64Idx == -1)
6080
- throw new Error("Not a binary data URI.");
6004
+ if (base64Idx == -1) throw new Error("Not a binary data URI.");
6081
6005
  base64Idx += "base64,".length;
6082
6006
  return this.base64ToUint8Array(dataUri.substr(base64Idx));
6083
6007
  }
6084
6008
  downloadText(url, success, error) {
6085
- if (this.start(url, success, error))
6086
- return;
6087
- if (this.rawDataUris[url]) {
6009
+ if (this.start(url, success, error)) return;
6010
+ const rawDataUri = this.rawDataUris[url];
6011
+ if (rawDataUri && !rawDataUri.includes(".")) {
6088
6012
  try {
6089
- let dataUri = this.rawDataUris[url];
6090
- this.finish(url, 200, this.dataUriToString(dataUri));
6013
+ this.finish(url, 200, this.dataUriToString(rawDataUri));
6091
6014
  } catch (e) {
6092
6015
  this.finish(url, 400, JSON.stringify(e));
6093
6016
  }
@@ -6095,7 +6018,7 @@ var spine = (() => {
6095
6018
  }
6096
6019
  let request = new XMLHttpRequest();
6097
6020
  request.overrideMimeType("text/html");
6098
- request.open("GET", url, true);
6021
+ request.open("GET", rawDataUri ? rawDataUri : url, true);
6099
6022
  let done = () => {
6100
6023
  this.finish(url, request.status, request.responseText);
6101
6024
  };
@@ -6109,19 +6032,18 @@ var spine = (() => {
6109
6032
  }, error);
6110
6033
  }
6111
6034
  downloadBinary(url, success, error) {
6112
- if (this.start(url, success, error))
6113
- return;
6114
- if (this.rawDataUris[url]) {
6035
+ if (this.start(url, success, error)) return;
6036
+ const rawDataUri = this.rawDataUris[url];
6037
+ if (rawDataUri && !rawDataUri.includes(".")) {
6115
6038
  try {
6116
- let dataUri = this.rawDataUris[url];
6117
- this.finish(url, 200, this.dataUriToUint8Array(dataUri));
6039
+ this.finish(url, 200, this.dataUriToUint8Array(rawDataUri));
6118
6040
  } catch (e) {
6119
6041
  this.finish(url, 400, JSON.stringify(e));
6120
6042
  }
6121
6043
  return;
6122
6044
  }
6123
6045
  let request = new XMLHttpRequest();
6124
- request.open("GET", url, true);
6046
+ request.open("GET", rawDataUri ? rawDataUri : url, true);
6125
6047
  request.responseType = "arraybuffer";
6126
6048
  let onerror = () => {
6127
6049
  this.finish(url, request.status, request.response);
@@ -6138,8 +6060,7 @@ var spine = (() => {
6138
6060
  start(url, success, error) {
6139
6061
  let callbacks = this.callbacks[url];
6140
6062
  try {
6141
- if (callbacks)
6142
- return true;
6063
+ if (callbacks) return true;
6143
6064
  this.callbacks[url] = callbacks = [];
6144
6065
  } finally {
6145
6066
  callbacks.push(success, error);
@@ -6164,8 +6085,7 @@ var spine = (() => {
6164
6085
  volume = 0;
6165
6086
  balance = 0;
6166
6087
  constructor(time, data) {
6167
- if (!data)
6168
- throw new Error("data cannot be null.");
6088
+ if (!data) throw new Error("data cannot be null.");
6169
6089
  this.time = time;
6170
6090
  this.data = data;
6171
6091
  }
@@ -6206,21 +6126,17 @@ var spine = (() => {
6206
6126
  softness = 0;
6207
6127
  active = false;
6208
6128
  constructor(data, skeleton) {
6209
- if (!data)
6210
- throw new Error("data cannot be null.");
6211
- if (!skeleton)
6212
- throw new Error("skeleton cannot be null.");
6129
+ if (!data) throw new Error("data cannot be null.");
6130
+ if (!skeleton) throw new Error("skeleton cannot be null.");
6213
6131
  this.data = data;
6214
6132
  this.bones = new Array();
6215
6133
  for (let i = 0; i < data.bones.length; i++) {
6216
6134
  let bone = skeleton.findBone(data.bones[i].name);
6217
- if (!bone)
6218
- throw new Error(`Couldn't find bone ${data.bones[i].name}`);
6135
+ if (!bone) throw new Error(`Couldn't find bone ${data.bones[i].name}`);
6219
6136
  this.bones.push(bone);
6220
6137
  }
6221
6138
  let target = skeleton.findBone(data.target.name);
6222
- if (!target)
6223
- throw new Error(`Couldn't find bone ${data.target.name}`);
6139
+ if (!target) throw new Error(`Couldn't find bone ${data.target.name}`);
6224
6140
  this.target = target;
6225
6141
  this.mix = data.mix;
6226
6142
  this.softness = data.softness;
@@ -6240,8 +6156,7 @@ var spine = (() => {
6240
6156
  this.stretch = data.stretch;
6241
6157
  }
6242
6158
  update(physics) {
6243
- if (this.mix == 0)
6244
- return;
6159
+ if (this.mix == 0) return;
6245
6160
  let target = this.target;
6246
6161
  let bones = this.bones;
6247
6162
  switch (bones.length) {
@@ -6256,8 +6171,7 @@ var spine = (() => {
6256
6171
  /** Applies 1 bone IK. The target is specified in the world coordinate system. */
6257
6172
  apply1(bone, targetX, targetY, compress, stretch, uniform, alpha) {
6258
6173
  let p = bone.parent;
6259
- if (!p)
6260
- throw new Error("IK bone must have parent.");
6174
+ if (!p) throw new Error("IK bone must have parent.");
6261
6175
  let pa = p.a, pb = p.b, pc = p.c, pd = p.d;
6262
6176
  let rotationIK = -bone.ashearX - bone.arotation, tx = 0, ty = 0;
6263
6177
  switch (bone.inherit) {
@@ -6272,6 +6186,7 @@ var spine = (() => {
6272
6186
  pb = -sc * s * bone.skeleton.scaleX;
6273
6187
  pd = sa * s * bone.skeleton.scaleY;
6274
6188
  rotationIK += Math.atan2(sc, sa) * MathUtils.radDeg;
6189
+ // Fall through
6275
6190
  default:
6276
6191
  let x = targetX - p.worldX, y = targetY - p.worldY;
6277
6192
  let d = pa * pd - pb * pc;
@@ -6284,8 +6199,7 @@ var spine = (() => {
6284
6199
  }
6285
6200
  }
6286
6201
  rotationIK += Math.atan2(ty, tx) * MathUtils.radDeg;
6287
- if (bone.ascaleX < 0)
6288
- rotationIK += 180;
6202
+ if (bone.ascaleX < 0) rotationIK += 180;
6289
6203
  if (rotationIK > 180)
6290
6204
  rotationIK -= 360;
6291
6205
  else if (rotationIK < -180)
@@ -6304,8 +6218,7 @@ var spine = (() => {
6304
6218
  if (compress && dd < b * b || stretch && dd > b * b) {
6305
6219
  const s = (Math.sqrt(dd) / b - 1) * alpha + 1;
6306
6220
  sx *= s;
6307
- if (uniform)
6308
- sy *= s;
6221
+ if (uniform) sy *= s;
6309
6222
  }
6310
6223
  }
6311
6224
  }
@@ -6322,8 +6235,7 @@ var spine = (() => {
6322
6235
  /** Applies 2 bone IK. The target is specified in the world coordinate system.
6323
6236
  * @param child A direct descendant of the parent bone. */
6324
6237
  apply2(parent, child, targetX, targetY, bendDir, stretch, uniform, softness, alpha) {
6325
- if (parent.inherit != 0 /* Normal */ || child.inherit != 0 /* Normal */)
6326
- return;
6238
+ if (parent.inherit != 0 /* Normal */ || child.inherit != 0 /* Normal */) return;
6327
6239
  let px = parent.ax, py = parent.ay, psx = parent.ascaleX, psy = parent.ascaleY, sx = psx, sy = psy, csx = child.ascaleX;
6328
6240
  let os1 = 0, os2 = 0, s2 = 0;
6329
6241
  if (psx < 0) {
@@ -6355,8 +6267,7 @@ var spine = (() => {
6355
6267
  cwy = c * cx + d * cy + parent.worldY;
6356
6268
  }
6357
6269
  let pp = parent.parent;
6358
- if (!pp)
6359
- throw new Error("IK parent must itself have a parent.");
6270
+ if (!pp) throw new Error("IK parent must itself have a parent.");
6360
6271
  a = pp.a;
6361
6272
  b = pp.b;
6362
6273
  c = pp.c;
@@ -6398,8 +6309,7 @@ var spine = (() => {
6398
6309
  if (stretch) {
6399
6310
  a = (Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1;
6400
6311
  sx *= a;
6401
- if (uniform)
6402
- sy *= a;
6312
+ if (uniform) sy *= a;
6403
6313
  }
6404
6314
  } else
6405
6315
  a2 = Math.acos(cos) * bendDir;
@@ -6415,8 +6325,7 @@ var spine = (() => {
6415
6325
  d = c1 * c1 - 4 * c2 * c;
6416
6326
  if (d >= 0) {
6417
6327
  let q = Math.sqrt(d);
6418
- if (c1 < 0)
6419
- q = -q;
6328
+ if (c1 < 0) q = -q;
6420
6329
  q = -(c1 + q) * 0.5;
6421
6330
  let r0 = q / c2, r1 = c / q;
6422
6331
  let r = Math.abs(r0) < Math.abs(r1) ? r0 : r1;
@@ -6485,10 +6394,8 @@ var spine = (() => {
6485
6394
  this._target = boneData;
6486
6395
  }
6487
6396
  get target() {
6488
- if (!this._target)
6489
- throw new Error("BoneData not set.");
6490
- else
6491
- return this._target;
6397
+ if (!this._target) throw new Error("BoneData not set.");
6398
+ else return this._target;
6492
6399
  }
6493
6400
  /** Controls the bend direction of the IK bones, either 1 or -1. */
6494
6401
  bendDirection = 0;
@@ -6519,17 +6426,15 @@ var spine = (() => {
6519
6426
  this._target = slotData;
6520
6427
  }
6521
6428
  get target() {
6522
- if (!this._target)
6523
- throw new Error("SlotData not set.");
6524
- else
6525
- return this._target;
6429
+ if (!this._target) throw new Error("SlotData not set.");
6430
+ else return this._target;
6526
6431
  }
6527
6432
  /** The mode for positioning the first bone on the path. */
6528
- positionMode = PositionMode.Fixed;
6433
+ positionMode = 0 /* Fixed */;
6529
6434
  /** The mode for positioning the bones after the first bone on the path. */
6530
- spacingMode = SpacingMode.Fixed;
6435
+ spacingMode = 1 /* Fixed */;
6531
6436
  /** The mode for adjusting the rotation of the bones. */
6532
- rotateMode = RotateMode.Chain;
6437
+ rotateMode = 1 /* Chain */;
6533
6438
  /** An offset added to the constrained bone rotation. */
6534
6439
  offsetRotation = 0;
6535
6440
  /** The position along the path. */
@@ -6563,7 +6468,11 @@ var spine = (() => {
6563
6468
  })(RotateMode || {});
6564
6469
 
6565
6470
  // spine-core/src/PathConstraint.ts
6566
- var _PathConstraint = class {
6471
+ var PathConstraint = class _PathConstraint {
6472
+ static NONE = -1;
6473
+ static BEFORE = -2;
6474
+ static AFTER = -3;
6475
+ static epsilon = 1e-5;
6567
6476
  /** The path constraint's setup pose data. */
6568
6477
  data;
6569
6478
  /** The bones that will be modified by this path constraint. */
@@ -6585,21 +6494,17 @@ var spine = (() => {
6585
6494
  segments = new Array();
6586
6495
  active = false;
6587
6496
  constructor(data, skeleton) {
6588
- if (!data)
6589
- throw new Error("data cannot be null.");
6590
- if (!skeleton)
6591
- throw new Error("skeleton cannot be null.");
6497
+ if (!data) throw new Error("data cannot be null.");
6498
+ if (!skeleton) throw new Error("skeleton cannot be null.");
6592
6499
  this.data = data;
6593
6500
  this.bones = new Array();
6594
6501
  for (let i = 0, n = data.bones.length; i < n; i++) {
6595
6502
  let bone = skeleton.findBone(data.bones[i].name);
6596
- if (!bone)
6597
- throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
6503
+ if (!bone) throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
6598
6504
  this.bones.push(bone);
6599
6505
  }
6600
6506
  let target = skeleton.findSlot(data.target.name);
6601
- if (!target)
6602
- throw new Error(`Couldn't find target bone ${data.target.name}`);
6507
+ if (!target) throw new Error(`Couldn't find target bone ${data.target.name}`);
6603
6508
  this.target = target;
6604
6509
  this.position = data.position;
6605
6510
  this.spacing = data.spacing;
@@ -6620,11 +6525,9 @@ var spine = (() => {
6620
6525
  }
6621
6526
  update(physics) {
6622
6527
  let attachment = this.target.getAttachment();
6623
- if (!(attachment instanceof PathAttachment))
6624
- return;
6528
+ if (!(attachment instanceof PathAttachment)) return;
6625
6529
  let mixRotate = this.mixRotate, mixX = this.mixX, mixY = this.mixY;
6626
- if (mixRotate == 0 && mixX == 0 && mixY == 0)
6627
- return;
6530
+ if (mixRotate == 0 && mixX == 0 && mixY == 0) return;
6628
6531
  let data = this.data;
6629
6532
  let tangents = data.rotateMode == 0 /* Tangent */, scale = data.rotateMode == 2 /* ChainScale */;
6630
6533
  let bones = this.bones;
@@ -6649,14 +6552,12 @@ var spine = (() => {
6649
6552
  let bone = bones[i];
6650
6553
  let setupLength = bone.data.length;
6651
6554
  if (setupLength < _PathConstraint.epsilon) {
6652
- if (scale)
6653
- lengths[i] = 0;
6555
+ if (scale) lengths[i] = 0;
6654
6556
  spaces[++i] = spacing;
6655
6557
  } else {
6656
6558
  let x = setupLength * bone.a, y = setupLength * bone.c;
6657
6559
  let length = Math.sqrt(x * x + y * y);
6658
- if (scale)
6659
- lengths[i] = length;
6560
+ if (scale) lengths[i] = length;
6660
6561
  spaces[++i] = length;
6661
6562
  sum += length;
6662
6563
  }
@@ -6673,14 +6574,12 @@ var spine = (() => {
6673
6574
  let bone = bones[i];
6674
6575
  let setupLength = bone.data.length;
6675
6576
  if (setupLength < _PathConstraint.epsilon) {
6676
- if (scale)
6677
- lengths[i] = 0;
6577
+ if (scale) lengths[i] = 0;
6678
6578
  spaces[++i] = spacing;
6679
6579
  } else {
6680
6580
  let x = setupLength * bone.a, y = setupLength * bone.c;
6681
6581
  let length = Math.sqrt(x * x + y * y);
6682
- if (scale)
6683
- lengths[i] = length;
6582
+ if (scale) lengths[i] = length;
6684
6583
  spaces[++i] = (lengthSpacing ? setupLength + spacing : spacing) * length / setupLength;
6685
6584
  }
6686
6585
  }
@@ -6753,8 +6652,7 @@ var spine = (() => {
6753
6652
  let lengths = path.lengths;
6754
6653
  curveCount -= closed2 ? 1 : 2;
6755
6654
  let pathLength2 = lengths[curveCount];
6756
- if (this.data.positionMode == 1 /* Percent */)
6757
- position *= pathLength2;
6655
+ if (this.data.positionMode == 1 /* Percent */) position *= pathLength2;
6758
6656
  let multiplier2;
6759
6657
  switch (this.data.spacingMode) {
6760
6658
  case 2 /* Percent */:
@@ -6773,8 +6671,7 @@ var spine = (() => {
6773
6671
  let p = position;
6774
6672
  if (closed2) {
6775
6673
  p %= pathLength2;
6776
- if (p < 0)
6777
- p += pathLength2;
6674
+ if (p < 0) p += pathLength2;
6778
6675
  curve = 0;
6779
6676
  } else if (p < 0) {
6780
6677
  if (prevCurve != _PathConstraint.BEFORE) {
@@ -6793,8 +6690,7 @@ var spine = (() => {
6793
6690
  }
6794
6691
  for (; ; curve++) {
6795
6692
  let length = lengths[curve];
6796
- if (p > length)
6797
- continue;
6693
+ if (p > length) continue;
6798
6694
  if (curve == 0)
6799
6695
  p /= length;
6800
6696
  else {
@@ -6876,8 +6772,7 @@ var spine = (() => {
6876
6772
  x1 = x2;
6877
6773
  y1 = y2;
6878
6774
  }
6879
- if (this.data.positionMode == 1 /* Percent */)
6880
- position *= pathLength;
6775
+ if (this.data.positionMode == 1 /* Percent */) position *= pathLength;
6881
6776
  let multiplier;
6882
6777
  switch (this.data.spacingMode) {
6883
6778
  case 2 /* Percent */:
@@ -6897,8 +6792,7 @@ var spine = (() => {
6897
6792
  let p = position;
6898
6793
  if (closed2) {
6899
6794
  p %= pathLength;
6900
- if (p < 0)
6901
- p += pathLength;
6795
+ if (p < 0) p += pathLength;
6902
6796
  curve = 0;
6903
6797
  } else if (p < 0) {
6904
6798
  this.addBeforePosition(p, world, 0, out, o);
@@ -6909,8 +6803,7 @@ var spine = (() => {
6909
6803
  }
6910
6804
  for (; ; curve++) {
6911
6805
  let length = curves[curve];
6912
- if (p > length)
6913
- continue;
6806
+ if (p > length) continue;
6914
6807
  if (curve == 0)
6915
6808
  p /= length;
6916
6809
  else {
@@ -6961,8 +6854,7 @@ var spine = (() => {
6961
6854
  p *= curveLength;
6962
6855
  for (; ; segment++) {
6963
6856
  let length = segments[segment];
6964
- if (p > length)
6965
- continue;
6857
+ if (p > length) continue;
6966
6858
  if (segment == 0)
6967
6859
  p /= length;
6968
6860
  else {
@@ -7007,11 +6899,6 @@ var spine = (() => {
7007
6899
  }
7008
6900
  }
7009
6901
  };
7010
- var PathConstraint = _PathConstraint;
7011
- __publicField(PathConstraint, "NONE", -1);
7012
- __publicField(PathConstraint, "BEFORE", -2);
7013
- __publicField(PathConstraint, "AFTER", -3);
7014
- __publicField(PathConstraint, "epsilon", 1e-5);
7015
6902
 
7016
6903
  // spine-core/src/PhysicsConstraint.ts
7017
6904
  var PhysicsConstraint = class {
@@ -7022,10 +6909,8 @@ var spine = (() => {
7022
6909
  this._bone = bone;
7023
6910
  }
7024
6911
  get bone() {
7025
- if (!this._bone)
7026
- throw new Error("Bone not set.");
7027
- else
7028
- return this._bone;
6912
+ if (!this._bone) throw new Error("Bone not set.");
6913
+ else return this._bone;
7029
6914
  }
7030
6915
  inertia = 0;
7031
6916
  strength = 0;
@@ -7094,8 +6979,7 @@ var spine = (() => {
7094
6979
  /** Applies the constraint to the constrained bones. */
7095
6980
  update(physics) {
7096
6981
  const mix = this.mix;
7097
- if (mix == 0)
7098
- return;
6982
+ if (mix == 0) return;
7099
6983
  const x = this.data.x > 0, y = this.data.y > 0, rotateOrShearX = this.data.rotate > 0 || this.data.shearX > 0, scaleX = this.data.scaleX > 0;
7100
6984
  const bone = this.bone;
7101
6985
  const l = bone.data.length;
@@ -7104,6 +6988,7 @@ var spine = (() => {
7104
6988
  return;
7105
6989
  case 1 /* reset */:
7106
6990
  this.reset();
6991
+ // Fall through.
7107
6992
  case 2 /* update */:
7108
6993
  const skeleton = this.skeleton;
7109
6994
  const delta = Math.max(this.skeleton.time - this.lastTime, 0);
@@ -7146,10 +7031,8 @@ var spine = (() => {
7146
7031
  a -= t;
7147
7032
  } while (a >= t);
7148
7033
  }
7149
- if (x)
7150
- bone.worldX += this.xOffset * mix * this.data.x;
7151
- if (y)
7152
- bone.worldY += this.yOffset * mix * this.data.y;
7034
+ if (x) bone.worldX += this.xOffset * mix * this.data.x;
7035
+ if (y) bone.worldY += this.yOffset * mix * this.data.y;
7153
7036
  }
7154
7037
  if (rotateOrShearX || scaleX) {
7155
7038
  let ca = Math.atan2(bone.c, bone.a), c = 0, s = 0, mr = 0;
@@ -7171,20 +7054,17 @@ var spine = (() => {
7171
7054
  s = Math.sin(r);
7172
7055
  if (scaleX) {
7173
7056
  r = l * bone.getWorldScaleX();
7174
- if (r > 0)
7175
- this.scaleOffset += (dx * c + dy * s) * i / r;
7057
+ if (r > 0) this.scaleOffset += (dx * c + dy * s) * i / r;
7176
7058
  }
7177
7059
  } else {
7178
7060
  c = Math.cos(ca);
7179
7061
  s = Math.sin(ca);
7180
7062
  const r = l * bone.getWorldScaleX();
7181
- if (r > 0)
7182
- this.scaleOffset += (dx * c + dy * s) * i / r;
7063
+ if (r > 0) this.scaleOffset += (dx * c + dy * s) * i / r;
7183
7064
  }
7184
7065
  a = this.remaining;
7185
7066
  if (a >= t) {
7186
- if (d == -1)
7187
- d = Math.pow(this.damping, 60 * t);
7067
+ if (d == -1) d = Math.pow(this.damping, 60 * t);
7188
7068
  const m = this.massInverse * t, e = this.strength, w = this.wind, g = Skeleton.yDown ? -this.gravity : this.gravity, h = l / f;
7189
7069
  while (true) {
7190
7070
  a -= t;
@@ -7197,8 +7077,7 @@ var spine = (() => {
7197
7077
  this.rotateVelocity -= ((w * s + g * c) * h + this.rotateOffset * e) * m;
7198
7078
  this.rotateOffset += this.rotateVelocity * t;
7199
7079
  this.rotateVelocity *= d;
7200
- if (a < t)
7201
- break;
7080
+ if (a < t) break;
7202
7081
  const r = this.rotateOffset * mr + ca;
7203
7082
  c = Math.cos(r);
7204
7083
  s = Math.sin(r);
@@ -7213,10 +7092,8 @@ var spine = (() => {
7213
7092
  this.cy = bone.worldY;
7214
7093
  break;
7215
7094
  case 3 /* pose */:
7216
- if (x)
7217
- bone.worldX += this.xOffset * mix * this.data.x;
7218
- if (y)
7219
- bone.worldY += this.yOffset * mix * this.data.y;
7095
+ if (x) bone.worldX += this.xOffset * mix * this.data.x;
7096
+ if (y) bone.worldY += this.yOffset * mix * this.data.y;
7220
7097
  }
7221
7098
  if (rotateOrShearX) {
7222
7099
  let o = this.rotateOffset * mix, s = 0, c = 0, a = 0;
@@ -7299,10 +7176,8 @@ var spine = (() => {
7299
7176
  * See {@link VertexAttachment#computeWorldVertices()} and {@link DeformTimeline}. */
7300
7177
  deform = new Array();
7301
7178
  constructor(data, bone) {
7302
- if (!data)
7303
- throw new Error("data cannot be null.");
7304
- if (!bone)
7305
- throw new Error("bone cannot be null.");
7179
+ if (!data) throw new Error("data cannot be null.");
7180
+ if (!bone) throw new Error("bone cannot be null.");
7306
7181
  this.data = data;
7307
7182
  this.bone = bone;
7308
7183
  this.color = new Color();
@@ -7321,8 +7196,7 @@ var spine = (() => {
7321
7196
  * The deform is not cleared if the old attachment has the same {@link VertexAttachment#getTimelineAttachment()} as the
7322
7197
  * specified attachment. */
7323
7198
  setAttachment(attachment) {
7324
- if (this.attachment == attachment)
7325
- return;
7199
+ if (this.attachment == attachment) return;
7326
7200
  if (!(attachment instanceof VertexAttachment) || !(this.attachment instanceof VertexAttachment) || attachment.timelineAttachment != this.attachment.timelineAttachment) {
7327
7201
  this.deform.length = 0;
7328
7202
  }
@@ -7332,8 +7206,7 @@ var spine = (() => {
7332
7206
  /** Sets this slot to the setup pose. */
7333
7207
  setToSetupPose() {
7334
7208
  this.color.setFromColor(this.data.color);
7335
- if (this.darkColor)
7336
- this.darkColor.setFromColor(this.data.darkColor);
7209
+ if (this.darkColor) this.darkColor.setFromColor(this.data.darkColor);
7337
7210
  if (!this.data.attachmentName)
7338
7211
  this.attachment = null;
7339
7212
  else {
@@ -7360,21 +7233,17 @@ var spine = (() => {
7360
7233
  temp = new Vector2();
7361
7234
  active = false;
7362
7235
  constructor(data, skeleton) {
7363
- if (!data)
7364
- throw new Error("data cannot be null.");
7365
- if (!skeleton)
7366
- throw new Error("skeleton cannot be null.");
7236
+ if (!data) throw new Error("data cannot be null.");
7237
+ if (!skeleton) throw new Error("skeleton cannot be null.");
7367
7238
  this.data = data;
7368
7239
  this.bones = new Array();
7369
7240
  for (let i = 0; i < data.bones.length; i++) {
7370
7241
  let bone = skeleton.findBone(data.bones[i].name);
7371
- if (!bone)
7372
- throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
7242
+ if (!bone) throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
7373
7243
  this.bones.push(bone);
7374
7244
  }
7375
7245
  let target = skeleton.findBone(data.target.name);
7376
- if (!target)
7377
- throw new Error(`Couldn't find target bone ${data.target.name}.`);
7246
+ if (!target) throw new Error(`Couldn't find target bone ${data.target.name}.`);
7378
7247
  this.target = target;
7379
7248
  this.mixRotate = data.mixRotate;
7380
7249
  this.mixX = data.mixX;
@@ -7396,8 +7265,7 @@ var spine = (() => {
7396
7265
  this.mixShearY = data.mixShearY;
7397
7266
  }
7398
7267
  update(physics) {
7399
- if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.mixScaleY == 0 && this.mixShearY == 0)
7400
- return;
7268
+ if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.mixScaleY == 0 && this.mixShearY == 0) return;
7401
7269
  if (this.data.local) {
7402
7270
  if (this.data.relative)
7403
7271
  this.applyRelativeLocal();
@@ -7443,15 +7311,13 @@ var spine = (() => {
7443
7311
  }
7444
7312
  if (mixScaleX != 0) {
7445
7313
  let s = Math.sqrt(bone.a * bone.a + bone.c * bone.c);
7446
- if (s != 0)
7447
- s = (s + (Math.sqrt(ta * ta + tc * tc) - s + this.data.offsetScaleX) * mixScaleX) / s;
7314
+ if (s != 0) s = (s + (Math.sqrt(ta * ta + tc * tc) - s + this.data.offsetScaleX) * mixScaleX) / s;
7448
7315
  bone.a *= s;
7449
7316
  bone.c *= s;
7450
7317
  }
7451
7318
  if (mixScaleY != 0) {
7452
7319
  let s = Math.sqrt(bone.b * bone.b + bone.d * bone.d);
7453
- if (s != 0)
7454
- s = (s + (Math.sqrt(tb * tb + td * td) - s + this.data.offsetScaleY) * mixScaleY) / s;
7320
+ if (s != 0) s = (s + (Math.sqrt(tb * tb + td * td) - s + this.data.offsetScaleY) * mixScaleY) / s;
7455
7321
  bone.b *= s;
7456
7322
  bone.d *= s;
7457
7323
  }
@@ -7533,8 +7399,7 @@ var spine = (() => {
7533
7399
  for (let i = 0, n = bones.length; i < n; i++) {
7534
7400
  let bone = bones[i];
7535
7401
  let rotation = bone.arotation;
7536
- if (mixRotate != 0)
7537
- rotation += (target.arotation - rotation + this.data.offsetRotation) * mixRotate;
7402
+ if (mixRotate != 0) rotation += (target.arotation - rotation + this.data.offsetRotation) * mixRotate;
7538
7403
  let x = bone.ax, y = bone.ay;
7539
7404
  x += (target.ax - x + this.data.offsetX) * mixX;
7540
7405
  y += (target.ay - y + this.data.offsetY) * mixY;
@@ -7544,8 +7409,7 @@ var spine = (() => {
7544
7409
  if (mixScaleY != 0 && scaleY != 0)
7545
7410
  scaleY = (scaleY + (target.ascaleY - scaleY + this.data.offsetScaleY) * mixScaleY) / scaleY;
7546
7411
  let shearY = bone.ashearY;
7547
- if (mixShearY != 0)
7548
- shearY += (target.ashearY - shearY + this.data.offsetShearY) * mixShearY;
7412
+ if (mixShearY != 0) shearY += (target.ashearY - shearY + this.data.offsetShearY) * mixShearY;
7549
7413
  bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
7550
7414
  }
7551
7415
  }
@@ -7567,7 +7431,9 @@ var spine = (() => {
7567
7431
  };
7568
7432
 
7569
7433
  // spine-core/src/Skeleton.ts
7570
- var _Skeleton = class {
7434
+ var Skeleton = class _Skeleton {
7435
+ static quadTriangles = [0, 1, 2, 2, 3, 0];
7436
+ static yDown = false;
7571
7437
  /** The skeleton's setup pose data. */
7572
7438
  data;
7573
7439
  /** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
@@ -7611,8 +7477,7 @@ var spine = (() => {
7611
7477
  * See {@link #update(float)}. */
7612
7478
  time = 0;
7613
7479
  constructor(data) {
7614
- if (!data)
7615
- throw new Error("data cannot be null.");
7480
+ if (!data) throw new Error("data cannot be null.");
7616
7481
  this.data = data;
7617
7482
  this.bones = new Array();
7618
7483
  for (let i = 0; i < data.bones.length; i++) {
@@ -7723,8 +7588,7 @@ var spine = (() => {
7723
7588
  }
7724
7589
  sortIkConstraint(constraint) {
7725
7590
  constraint.active = constraint.target.isActive() && (!constraint.data.skinRequired || this.skin && Utils.contains(this.skin.constraints, constraint.data, true));
7726
- if (!constraint.active)
7727
- return;
7591
+ if (!constraint.active) return;
7728
7592
  let target = constraint.target;
7729
7593
  this.sortBone(target);
7730
7594
  let constrained = constraint.bones;
@@ -7743,20 +7607,17 @@ var spine = (() => {
7743
7607
  }
7744
7608
  sortPathConstraint(constraint) {
7745
7609
  constraint.active = constraint.target.bone.isActive() && (!constraint.data.skinRequired || this.skin && Utils.contains(this.skin.constraints, constraint.data, true));
7746
- if (!constraint.active)
7747
- return;
7610
+ if (!constraint.active) return;
7748
7611
  let slot = constraint.target;
7749
7612
  let slotIndex = slot.data.index;
7750
7613
  let slotBone = slot.bone;
7751
- if (this.skin)
7752
- this.sortPathConstraintAttachment(this.skin, slotIndex, slotBone);
7614
+ if (this.skin) this.sortPathConstraintAttachment(this.skin, slotIndex, slotBone);
7753
7615
  if (this.data.defaultSkin && this.data.defaultSkin != this.skin)
7754
7616
  this.sortPathConstraintAttachment(this.data.defaultSkin, slotIndex, slotBone);
7755
7617
  for (let i = 0, n = this.data.skins.length; i < n; i++)
7756
7618
  this.sortPathConstraintAttachment(this.data.skins[i], slotIndex, slotBone);
7757
7619
  let attachment = slot.getAttachment();
7758
- if (attachment instanceof PathAttachment)
7759
- this.sortPathConstraintAttachmentWith(attachment, slotBone);
7620
+ if (attachment instanceof PathAttachment) this.sortPathConstraintAttachmentWith(attachment, slotBone);
7760
7621
  let constrained = constraint.bones;
7761
7622
  let boneCount = constrained.length;
7762
7623
  for (let i = 0; i < boneCount; i++)
@@ -7769,8 +7630,7 @@ var spine = (() => {
7769
7630
  }
7770
7631
  sortTransformConstraint(constraint) {
7771
7632
  constraint.active = constraint.target.isActive() && (!constraint.data.skinRequired || this.skin && Utils.contains(this.skin.constraints, constraint.data, true));
7772
- if (!constraint.active)
7773
- return;
7633
+ if (!constraint.active) return;
7774
7634
  this.sortBone(constraint.target);
7775
7635
  let constrained = constraint.bones;
7776
7636
  let boneCount = constrained.length;
@@ -7793,15 +7653,13 @@ var spine = (() => {
7793
7653
  }
7794
7654
  sortPathConstraintAttachment(skin, slotIndex, slotBone) {
7795
7655
  let attachments = skin.attachments[slotIndex];
7796
- if (!attachments)
7797
- return;
7656
+ if (!attachments) return;
7798
7657
  for (let key in attachments) {
7799
7658
  this.sortPathConstraintAttachmentWith(attachments[key], slotBone);
7800
7659
  }
7801
7660
  }
7802
7661
  sortPathConstraintAttachmentWith(attachment, slotBone) {
7803
- if (!(attachment instanceof PathAttachment))
7804
- return;
7662
+ if (!(attachment instanceof PathAttachment)) return;
7805
7663
  let pathBones = attachment.bones;
7806
7664
  if (!pathBones)
7807
7665
  this.sortBone(slotBone);
@@ -7818,31 +7676,25 @@ var spine = (() => {
7818
7676
  sortPhysicsConstraint(constraint) {
7819
7677
  const bone = constraint.bone;
7820
7678
  constraint.active = bone.active && (!constraint.data.skinRequired || this.skin != null && Utils.contains(this.skin.constraints, constraint.data, true));
7821
- if (!constraint.active)
7822
- return;
7679
+ if (!constraint.active) return;
7823
7680
  this.sortBone(bone);
7824
7681
  this._updateCache.push(constraint);
7825
7682
  this.sortReset(bone.children);
7826
7683
  bone.sorted = true;
7827
7684
  }
7828
7685
  sortBone(bone) {
7829
- if (!bone)
7830
- return;
7831
- if (bone.sorted)
7832
- return;
7686
+ if (!bone) return;
7687
+ if (bone.sorted) return;
7833
7688
  let parent = bone.parent;
7834
- if (parent)
7835
- this.sortBone(parent);
7689
+ if (parent) this.sortBone(parent);
7836
7690
  bone.sorted = true;
7837
7691
  this._updateCache.push(bone);
7838
7692
  }
7839
7693
  sortReset(bones) {
7840
7694
  for (let i = 0, n = bones.length; i < n; i++) {
7841
7695
  let bone = bones[i];
7842
- if (!bone.active)
7843
- continue;
7844
- if (bone.sorted)
7845
- this.sortReset(bone.children);
7696
+ if (!bone.active) continue;
7697
+ if (bone.sorted) this.sortReset(bone.children);
7846
7698
  bone.sorted = false;
7847
7699
  }
7848
7700
  }
@@ -7851,8 +7703,7 @@ var spine = (() => {
7851
7703
  * See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
7852
7704
  * Runtimes Guide. */
7853
7705
  updateWorldTransform(physics) {
7854
- if (physics === void 0 || physics === null)
7855
- throw new Error("physics is undefined");
7706
+ if (physics === void 0 || physics === null) throw new Error("physics is undefined");
7856
7707
  let bones = this.bones;
7857
7708
  for (let i = 0, n = bones.length; i < n; i++) {
7858
7709
  let bone = bones[i];
@@ -7869,8 +7720,7 @@ var spine = (() => {
7869
7720
  updateCache[i].update(physics);
7870
7721
  }
7871
7722
  updateWorldTransformWith(physics, parent) {
7872
- if (!parent)
7873
- throw new Error("parent cannot be null.");
7723
+ if (!parent) throw new Error("parent cannot be null.");
7874
7724
  let bones = this.bones;
7875
7725
  for (let i = 1, n = bones.length; i < n; i++) {
7876
7726
  let bone = bones[i];
@@ -7883,8 +7733,7 @@ var spine = (() => {
7883
7733
  bone.ashearY = bone.shearY;
7884
7734
  }
7885
7735
  let rootBone = this.getRootBone();
7886
- if (!rootBone)
7887
- throw new Error("Root bone must not be null.");
7736
+ if (!rootBone) throw new Error("Root bone must not be null.");
7888
7737
  let pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
7889
7738
  rootBone.worldX = pa * this.x + pb * this.y + parent.worldX;
7890
7739
  rootBone.worldY = pc * this.x + pd * this.y + parent.worldY;
@@ -7901,8 +7750,7 @@ var spine = (() => {
7901
7750
  let updateCache = this._updateCache;
7902
7751
  for (let i = 0, n = updateCache.length; i < n; i++) {
7903
7752
  let updatable = updateCache[i];
7904
- if (updatable != rootBone)
7905
- updatable.update(physics);
7753
+ if (updatable != rootBone) updatable.update(physics);
7906
7754
  }
7907
7755
  }
7908
7756
  /** Sets the bones, constraints, and slots to their setup pose values. */
@@ -7912,16 +7760,11 @@ var spine = (() => {
7912
7760
  }
7913
7761
  /** Sets the bones and constraints to their setup pose values. */
7914
7762
  setBonesToSetupPose() {
7915
- for (const bone of this.bones)
7916
- bone.setToSetupPose();
7917
- for (const constraint of this.ikConstraints)
7918
- constraint.setToSetupPose();
7919
- for (const constraint of this.transformConstraints)
7920
- constraint.setToSetupPose();
7921
- for (const constraint of this.pathConstraints)
7922
- constraint.setToSetupPose();
7923
- for (const constraint of this.physicsConstraints)
7924
- constraint.setToSetupPose();
7763
+ for (const bone of this.bones) bone.setToSetupPose();
7764
+ for (const constraint of this.ikConstraints) constraint.setToSetupPose();
7765
+ for (const constraint of this.transformConstraints) constraint.setToSetupPose();
7766
+ for (const constraint of this.pathConstraints) constraint.setToSetupPose();
7767
+ for (const constraint of this.physicsConstraints) constraint.setToSetupPose();
7925
7768
  }
7926
7769
  /** Sets the slots and draw order to their setup pose values. */
7927
7770
  setSlotsToSetupPose() {
@@ -7932,19 +7775,16 @@ var spine = (() => {
7932
7775
  }
7933
7776
  /** @returns May return null. */
7934
7777
  getRootBone() {
7935
- if (this.bones.length == 0)
7936
- return null;
7778
+ if (this.bones.length == 0) return null;
7937
7779
  return this.bones[0];
7938
7780
  }
7939
7781
  /** @returns May be null. */
7940
7782
  findBone(boneName) {
7941
- if (!boneName)
7942
- throw new Error("boneName cannot be null.");
7783
+ if (!boneName) throw new Error("boneName cannot be null.");
7943
7784
  let bones = this.bones;
7944
7785
  for (let i = 0, n = bones.length; i < n; i++) {
7945
7786
  let bone = bones[i];
7946
- if (bone.data.name == boneName)
7947
- return bone;
7787
+ if (bone.data.name == boneName) return bone;
7948
7788
  }
7949
7789
  return null;
7950
7790
  }
@@ -7952,13 +7792,11 @@ var spine = (() => {
7952
7792
  * repeatedly.
7953
7793
  * @returns May be null. */
7954
7794
  findSlot(slotName) {
7955
- if (!slotName)
7956
- throw new Error("slotName cannot be null.");
7795
+ if (!slotName) throw new Error("slotName cannot be null.");
7957
7796
  let slots = this.slots;
7958
7797
  for (let i = 0, n = slots.length; i < n; i++) {
7959
7798
  let slot = slots[i];
7960
- if (slot.data.name == slotName)
7961
- return slot;
7799
+ if (slot.data.name == slotName) return slot;
7962
7800
  }
7963
7801
  return null;
7964
7802
  }
@@ -7967,8 +7805,7 @@ var spine = (() => {
7967
7805
  * See {@link #setSkin()}. */
7968
7806
  setSkinByName(skinName) {
7969
7807
  let skin = this.data.findSkin(skinName);
7970
- if (!skin)
7971
- throw new Error("Skin not found: " + skinName);
7808
+ if (!skin) throw new Error("Skin not found: " + skinName);
7972
7809
  this.setSkin(skin);
7973
7810
  }
7974
7811
  /** Sets the skin used to look up attachments before looking in the {@link SkeletonData#defaultSkin default skin}. If the
@@ -7982,8 +7819,7 @@ var spine = (() => {
7982
7819
  * skeleton is rendered to allow any attachment keys in the current animation(s) to hide or show attachments from the new skin.
7983
7820
  * @param newSkin May be null. */
7984
7821
  setSkin(newSkin) {
7985
- if (newSkin == this.skin)
7986
- return;
7822
+ if (newSkin == this.skin) return;
7987
7823
  if (newSkin) {
7988
7824
  if (this.skin)
7989
7825
  newSkin.attachAll(this, this.skin);
@@ -7994,8 +7830,7 @@ var spine = (() => {
7994
7830
  let name = slot.data.attachmentName;
7995
7831
  if (name) {
7996
7832
  let attachment = newSkin.getAttachment(i, name);
7997
- if (attachment)
7998
- slot.setAttachment(attachment);
7833
+ if (attachment) slot.setAttachment(attachment);
7999
7834
  }
8000
7835
  }
8001
7836
  }
@@ -8010,8 +7845,7 @@ var spine = (() => {
8010
7845
  * @returns May be null. */
8011
7846
  getAttachmentByName(slotName, attachmentName) {
8012
7847
  let slot = this.data.findSlot(slotName);
8013
- if (!slot)
8014
- throw new Error(`Can't find slot with name ${slotName}`);
7848
+ if (!slot) throw new Error(`Can't find slot with name ${slotName}`);
8015
7849
  return this.getAttachment(slot.index, attachmentName);
8016
7850
  }
8017
7851
  /** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot index and
@@ -8020,23 +7854,19 @@ var spine = (() => {
8020
7854
  * See [Runtime skins](http://esotericsoftware.com/spine-runtime-skins) in the Spine Runtimes Guide.
8021
7855
  * @returns May be null. */
8022
7856
  getAttachment(slotIndex, attachmentName) {
8023
- if (!attachmentName)
8024
- throw new Error("attachmentName cannot be null.");
7857
+ if (!attachmentName) throw new Error("attachmentName cannot be null.");
8025
7858
  if (this.skin) {
8026
7859
  let attachment = this.skin.getAttachment(slotIndex, attachmentName);
8027
- if (attachment)
8028
- return attachment;
7860
+ if (attachment) return attachment;
8029
7861
  }
8030
- if (this.data.defaultSkin)
8031
- return this.data.defaultSkin.getAttachment(slotIndex, attachmentName);
7862
+ if (this.data.defaultSkin) return this.data.defaultSkin.getAttachment(slotIndex, attachmentName);
8032
7863
  return null;
8033
7864
  }
8034
7865
  /** A convenience method to set an attachment by finding the slot with {@link #findSlot()}, finding the attachment with
8035
7866
  * {@link #getAttachment()}, then setting the slot's {@link Slot#attachment}.
8036
7867
  * @param attachmentName May be null to clear the slot's attachment. */
8037
7868
  setAttachment(slotName, attachmentName) {
8038
- if (!slotName)
8039
- throw new Error("slotName cannot be null.");
7869
+ if (!slotName) throw new Error("slotName cannot be null.");
8040
7870
  let slots = this.slots;
8041
7871
  for (let i = 0, n = slots.length; i < n; i++) {
8042
7872
  let slot = slots[i];
@@ -8044,8 +7874,7 @@ var spine = (() => {
8044
7874
  let attachment = null;
8045
7875
  if (attachmentName) {
8046
7876
  attachment = this.getAttachment(i, attachmentName);
8047
- if (!attachment)
8048
- throw new Error("Attachment not found: " + attachmentName + ", for slot: " + slotName);
7877
+ if (!attachment) throw new Error("Attachment not found: " + attachmentName + ", for slot: " + slotName);
8049
7878
  }
8050
7879
  slot.setAttachment(attachment);
8051
7880
  return;
@@ -8057,31 +7886,27 @@ var spine = (() => {
8057
7886
  * than to call it repeatedly.
8058
7887
  * @return May be null. */
8059
7888
  findIkConstraint(constraintName) {
8060
- if (!constraintName)
8061
- throw new Error("constraintName cannot be null.");
7889
+ if (!constraintName) throw new Error("constraintName cannot be null.");
8062
7890
  return this.ikConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
8063
7891
  }
8064
7892
  /** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
8065
7893
  * this method than to call it repeatedly.
8066
7894
  * @return May be null. */
8067
7895
  findTransformConstraint(constraintName) {
8068
- if (!constraintName)
8069
- throw new Error("constraintName cannot be null.");
7896
+ if (!constraintName) throw new Error("constraintName cannot be null.");
8070
7897
  return this.transformConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
8071
7898
  }
8072
7899
  /** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
8073
7900
  * than to call it repeatedly.
8074
7901
  * @return May be null. */
8075
7902
  findPathConstraint(constraintName) {
8076
- if (!constraintName)
8077
- throw new Error("constraintName cannot be null.");
7903
+ if (!constraintName) throw new Error("constraintName cannot be null.");
8078
7904
  return this.pathConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
8079
7905
  }
8080
7906
  /** Finds a physics constraint by comparing each physics constraint's name. It is more efficient to cache the results of this
8081
7907
  * method than to call it repeatedly. */
8082
7908
  findPhysicsConstraint(constraintName) {
8083
- if (constraintName == null)
8084
- throw new Error("constraintName cannot be null.");
7909
+ if (constraintName == null) throw new Error("constraintName cannot be null.");
8085
7910
  return this.physicsConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
8086
7911
  }
8087
7912
  /** 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 }`.
@@ -8098,16 +7923,13 @@ var spine = (() => {
8098
7923
  * @param temp Working memory to temporarily store attachments' computed world vertices.
8099
7924
  * @param clipper {@link SkeletonClipping} to use. If <code>null</code>, no clipping is applied. */
8100
7925
  getBounds(offset, size, temp = new Array(2), clipper = null) {
8101
- if (!offset)
8102
- throw new Error("offset cannot be null.");
8103
- if (!size)
8104
- throw new Error("size cannot be null.");
7926
+ if (!offset) throw new Error("offset cannot be null.");
7927
+ if (!size) throw new Error("size cannot be null.");
8105
7928
  let drawOrder = this.drawOrder;
8106
7929
  let minX = Number.POSITIVE_INFINITY, minY = Number.POSITIVE_INFINITY, maxX = Number.NEGATIVE_INFINITY, maxY = Number.NEGATIVE_INFINITY;
8107
7930
  for (let i = 0, n = drawOrder.length; i < n; i++) {
8108
7931
  let slot = drawOrder[i];
8109
- if (!slot.bone.active)
8110
- continue;
7932
+ if (!slot.bone.active) continue;
8111
7933
  let verticesLength = 0;
8112
7934
  let vertices = null;
8113
7935
  let triangles = null;
@@ -8141,11 +7963,9 @@ var spine = (() => {
8141
7963
  maxY = Math.max(maxY, y);
8142
7964
  }
8143
7965
  }
8144
- if (clipper != null)
8145
- clipper.clipEndWithSlot(slot);
7966
+ if (clipper != null) clipper.clipEndWithSlot(slot);
8146
7967
  }
8147
- if (clipper != null)
8148
- clipper.clipEnd();
7968
+ if (clipper != null) clipper.clipEnd();
8149
7969
  offset.set(minX, minY);
8150
7970
  size.set(maxX - minX, maxY - minY);
8151
7971
  }
@@ -8165,9 +7985,6 @@ var spine = (() => {
8165
7985
  physicsConstraints[i].rotate(x, y, degrees);
8166
7986
  }
8167
7987
  };
8168
- var Skeleton = _Skeleton;
8169
- __publicField(Skeleton, "quadTriangles", [0, 1, 2, 2, 3, 0]);
8170
- __publicField(Skeleton, "yDown", false);
8171
7988
  var Physics = /* @__PURE__ */ ((Physics2) => {
8172
7989
  Physics2[Physics2["none"] = 0] = "none";
8173
7990
  Physics2[Physics2["reset"] = 1] = "reset";
@@ -8184,10 +8001,8 @@ var spine = (() => {
8184
8001
  this._bone = boneData;
8185
8002
  }
8186
8003
  get bone() {
8187
- if (!this._bone)
8188
- throw new Error("BoneData not set.");
8189
- else
8190
- return this._bone;
8004
+ if (!this._bone) throw new Error("BoneData not set.");
8005
+ else return this._bone;
8191
8006
  }
8192
8007
  x = 0;
8193
8008
  y = 0;
@@ -8270,13 +8085,11 @@ var spine = (() => {
8270
8085
  * multiple times.
8271
8086
  * @returns May be null. */
8272
8087
  findBone(boneName) {
8273
- if (!boneName)
8274
- throw new Error("boneName cannot be null.");
8088
+ if (!boneName) throw new Error("boneName cannot be null.");
8275
8089
  let bones = this.bones;
8276
8090
  for (let i = 0, n = bones.length; i < n; i++) {
8277
8091
  let bone = bones[i];
8278
- if (bone.name == boneName)
8279
- return bone;
8092
+ if (bone.name == boneName) return bone;
8280
8093
  }
8281
8094
  return null;
8282
8095
  }
@@ -8284,13 +8097,11 @@ var spine = (() => {
8284
8097
  * multiple times.
8285
8098
  * @returns May be null. */
8286
8099
  findSlot(slotName) {
8287
- if (!slotName)
8288
- throw new Error("slotName cannot be null.");
8100
+ if (!slotName) throw new Error("slotName cannot be null.");
8289
8101
  let slots = this.slots;
8290
8102
  for (let i = 0, n = slots.length; i < n; i++) {
8291
8103
  let slot = slots[i];
8292
- if (slot.name == slotName)
8293
- return slot;
8104
+ if (slot.name == slotName) return slot;
8294
8105
  }
8295
8106
  return null;
8296
8107
  }
@@ -8298,13 +8109,11 @@ var spine = (() => {
8298
8109
  * multiple times.
8299
8110
  * @returns May be null. */
8300
8111
  findSkin(skinName) {
8301
- if (!skinName)
8302
- throw new Error("skinName cannot be null.");
8112
+ if (!skinName) throw new Error("skinName cannot be null.");
8303
8113
  let skins = this.skins;
8304
8114
  for (let i = 0, n = skins.length; i < n; i++) {
8305
8115
  let skin = skins[i];
8306
- if (skin.name == skinName)
8307
- return skin;
8116
+ if (skin.name == skinName) return skin;
8308
8117
  }
8309
8118
  return null;
8310
8119
  }
@@ -8312,13 +8121,11 @@ var spine = (() => {
8312
8121
  * multiple times.
8313
8122
  * @returns May be null. */
8314
8123
  findEvent(eventDataName) {
8315
- if (!eventDataName)
8316
- throw new Error("eventDataName cannot be null.");
8124
+ if (!eventDataName) throw new Error("eventDataName cannot be null.");
8317
8125
  let events = this.events;
8318
8126
  for (let i = 0, n = events.length; i < n; i++) {
8319
8127
  let event = events[i];
8320
- if (event.name == eventDataName)
8321
- return event;
8128
+ if (event.name == eventDataName) return event;
8322
8129
  }
8323
8130
  return null;
8324
8131
  }
@@ -8326,13 +8133,11 @@ var spine = (() => {
8326
8133
  * call it multiple times.
8327
8134
  * @returns May be null. */
8328
8135
  findAnimation(animationName) {
8329
- if (!animationName)
8330
- throw new Error("animationName cannot be null.");
8136
+ if (!animationName) throw new Error("animationName cannot be null.");
8331
8137
  let animations = this.animations;
8332
8138
  for (let i = 0, n = animations.length; i < n; i++) {
8333
8139
  let animation = animations[i];
8334
- if (animation.name == animationName)
8335
- return animation;
8140
+ if (animation.name == animationName) return animation;
8336
8141
  }
8337
8142
  return null;
8338
8143
  }
@@ -8340,13 +8145,11 @@ var spine = (() => {
8340
8145
  * than to call it multiple times.
8341
8146
  * @return May be null. */
8342
8147
  findIkConstraint(constraintName) {
8343
- if (!constraintName)
8344
- throw new Error("constraintName cannot be null.");
8148
+ if (!constraintName) throw new Error("constraintName cannot be null.");
8345
8149
  const ikConstraints = this.ikConstraints;
8346
8150
  for (let i = 0, n = ikConstraints.length; i < n; i++) {
8347
8151
  const constraint = ikConstraints[i];
8348
- if (constraint.name == constraintName)
8349
- return constraint;
8152
+ if (constraint.name == constraintName) return constraint;
8350
8153
  }
8351
8154
  return null;
8352
8155
  }
@@ -8354,13 +8157,11 @@ var spine = (() => {
8354
8157
  * this method than to call it multiple times.
8355
8158
  * @return May be null. */
8356
8159
  findTransformConstraint(constraintName) {
8357
- if (!constraintName)
8358
- throw new Error("constraintName cannot be null.");
8160
+ if (!constraintName) throw new Error("constraintName cannot be null.");
8359
8161
  const transformConstraints = this.transformConstraints;
8360
8162
  for (let i = 0, n = transformConstraints.length; i < n; i++) {
8361
8163
  const constraint = transformConstraints[i];
8362
- if (constraint.name == constraintName)
8363
- return constraint;
8164
+ if (constraint.name == constraintName) return constraint;
8364
8165
  }
8365
8166
  return null;
8366
8167
  }
@@ -8368,13 +8169,11 @@ var spine = (() => {
8368
8169
  * than to call it multiple times.
8369
8170
  * @return May be null. */
8370
8171
  findPathConstraint(constraintName) {
8371
- if (!constraintName)
8372
- throw new Error("constraintName cannot be null.");
8172
+ if (!constraintName) throw new Error("constraintName cannot be null.");
8373
8173
  const pathConstraints = this.pathConstraints;
8374
8174
  for (let i = 0, n = pathConstraints.length; i < n; i++) {
8375
8175
  const constraint = pathConstraints[i];
8376
- if (constraint.name == constraintName)
8377
- return constraint;
8176
+ if (constraint.name == constraintName) return constraint;
8378
8177
  }
8379
8178
  return null;
8380
8179
  }
@@ -8382,13 +8181,11 @@ var spine = (() => {
8382
8181
  * than to call it multiple times.
8383
8182
  * @return May be null. */
8384
8183
  findPhysicsConstraint(constraintName) {
8385
- if (!constraintName)
8386
- throw new Error("constraintName cannot be null.");
8184
+ if (!constraintName) throw new Error("constraintName cannot be null.");
8387
8185
  const physicsConstraints = this.physicsConstraints;
8388
8186
  for (let i = 0, n = physicsConstraints.length; i < n; i++) {
8389
8187
  const constraint = physicsConstraints[i];
8390
- if (constraint.name == constraintName)
8391
- return constraint;
8188
+ if (constraint.name == constraintName) return constraint;
8392
8189
  }
8393
8190
  return null;
8394
8191
  }
@@ -8412,19 +8209,15 @@ var spine = (() => {
8412
8209
  color = new Color(0.99607843, 0.61960787, 0.30980393, 1);
8413
8210
  // fe9e4fff
8414
8211
  constructor(name) {
8415
- if (!name)
8416
- throw new Error("name cannot be null.");
8212
+ if (!name) throw new Error("name cannot be null.");
8417
8213
  this.name = name;
8418
8214
  }
8419
8215
  /** Adds an attachment to the skin for the specified slot index and name. */
8420
8216
  setAttachment(slotIndex, name, attachment) {
8421
- if (!attachment)
8422
- throw new Error("attachment cannot be null.");
8217
+ if (!attachment) throw new Error("attachment cannot be null.");
8423
8218
  let attachments = this.attachments;
8424
- if (slotIndex >= attachments.length)
8425
- attachments.length = slotIndex + 1;
8426
- if (!attachments[slotIndex])
8427
- attachments[slotIndex] = {};
8219
+ if (slotIndex >= attachments.length) attachments.length = slotIndex + 1;
8220
+ if (!attachments[slotIndex]) attachments[slotIndex] = {};
8428
8221
  attachments[slotIndex][name] = attachment;
8429
8222
  }
8430
8223
  /** Adds all attachments, bones, and constraints from the specified skin to this skin. */
@@ -8438,8 +8231,7 @@ var spine = (() => {
8438
8231
  break;
8439
8232
  }
8440
8233
  }
8441
- if (!contained)
8442
- this.bones.push(bone);
8234
+ if (!contained) this.bones.push(bone);
8443
8235
  }
8444
8236
  for (let i = 0; i < skin.constraints.length; i++) {
8445
8237
  let constraint = skin.constraints[i];
@@ -8450,8 +8242,7 @@ var spine = (() => {
8450
8242
  break;
8451
8243
  }
8452
8244
  }
8453
- if (!contained)
8454
- this.constraints.push(constraint);
8245
+ if (!contained) this.constraints.push(constraint);
8455
8246
  }
8456
8247
  let attachments = skin.getAttachments();
8457
8248
  for (let i = 0; i < attachments.length; i++) {
@@ -8471,8 +8262,7 @@ var spine = (() => {
8471
8262
  break;
8472
8263
  }
8473
8264
  }
8474
- if (!contained)
8475
- this.bones.push(bone);
8265
+ if (!contained) this.bones.push(bone);
8476
8266
  }
8477
8267
  for (let i = 0; i < skin.constraints.length; i++) {
8478
8268
  let constraint = skin.constraints[i];
@@ -8483,14 +8273,12 @@ var spine = (() => {
8483
8273
  break;
8484
8274
  }
8485
8275
  }
8486
- if (!contained)
8487
- this.constraints.push(constraint);
8276
+ if (!contained) this.constraints.push(constraint);
8488
8277
  }
8489
8278
  let attachments = skin.getAttachments();
8490
8279
  for (let i = 0; i < attachments.length; i++) {
8491
8280
  var attachment = attachments[i];
8492
- if (!attachment.attachment)
8493
- continue;
8281
+ if (!attachment.attachment) continue;
8494
8282
  if (attachment.attachment instanceof MeshAttachment) {
8495
8283
  attachment.attachment = attachment.attachment.newLinkedMesh();
8496
8284
  this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
@@ -8508,8 +8296,7 @@ var spine = (() => {
8508
8296
  /** Removes the attachment in the skin for the specified slot index and name, if any. */
8509
8297
  removeAttachment(slotIndex, name) {
8510
8298
  let dictionary = this.attachments[slotIndex];
8511
- if (dictionary)
8512
- delete dictionary[name];
8299
+ if (dictionary) delete dictionary[name];
8513
8300
  }
8514
8301
  /** Returns all attachments in this skin. */
8515
8302
  getAttachments() {
@@ -8519,8 +8306,7 @@ var spine = (() => {
8519
8306
  if (slotAttachments) {
8520
8307
  for (let name in slotAttachments) {
8521
8308
  let attachment = slotAttachments[name];
8522
- if (attachment)
8523
- entries.push(new SkinEntry(i, name, attachment));
8309
+ if (attachment) entries.push(new SkinEntry(i, name, attachment));
8524
8310
  }
8525
8311
  }
8526
8312
  }
@@ -8532,8 +8318,7 @@ var spine = (() => {
8532
8318
  if (slotAttachments) {
8533
8319
  for (let name in slotAttachments) {
8534
8320
  let attachment = slotAttachments[name];
8535
- if (attachment)
8536
- attachments.push(new SkinEntry(slotIndex, name, attachment));
8321
+ if (attachment) attachments.push(new SkinEntry(slotIndex, name, attachment));
8537
8322
  }
8538
8323
  }
8539
8324
  }
@@ -8555,8 +8340,7 @@ var spine = (() => {
8555
8340
  let skinAttachment = dictionary[key];
8556
8341
  if (slotAttachment == skinAttachment) {
8557
8342
  let attachment = this.getAttachment(slotIndex, key);
8558
- if (attachment)
8559
- slot.setAttachment(attachment);
8343
+ if (attachment) slot.setAttachment(attachment);
8560
8344
  break;
8561
8345
  }
8562
8346
  }
@@ -8583,16 +8367,13 @@ var spine = (() => {
8583
8367
  /** The name of the attachment that is visible for this slot in the setup pose, or null if no attachment is visible. */
8584
8368
  attachmentName = null;
8585
8369
  /** The blend mode for drawing the slot's attachment. */
8586
- blendMode = BlendMode.Normal;
8370
+ blendMode = 0 /* Normal */;
8587
8371
  /** False if the slot was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */
8588
8372
  visible = true;
8589
8373
  constructor(index, name, boneData) {
8590
- if (index < 0)
8591
- throw new Error("index must be >= 0.");
8592
- if (!name)
8593
- throw new Error("name cannot be null.");
8594
- if (!boneData)
8595
- throw new Error("boneData cannot be null.");
8374
+ if (index < 0) throw new Error("index must be >= 0.");
8375
+ if (!name) throw new Error("name cannot be null.");
8376
+ if (!boneData) throw new Error("boneData cannot be null.");
8596
8377
  this.index = index;
8597
8378
  this.name = name;
8598
8379
  this.boneData = boneData;
@@ -8616,10 +8397,8 @@ var spine = (() => {
8616
8397
  this._target = boneData;
8617
8398
  }
8618
8399
  get target() {
8619
- if (!this._target)
8620
- throw new Error("BoneData not set.");
8621
- else
8622
- return this._target;
8400
+ if (!this._target) throw new Error("BoneData not set.");
8401
+ else return this._target;
8623
8402
  }
8624
8403
  mixRotate = 0;
8625
8404
  mixX = 0;
@@ -8682,15 +8461,13 @@ var spine = (() => {
8682
8461
  n = input.readInt(true);
8683
8462
  for (let i = 0; i < n; i++) {
8684
8463
  let str = input.readString();
8685
- if (!str)
8686
- throw new Error("String in string table must not be null.");
8464
+ if (!str) throw new Error("String in string table must not be null.");
8687
8465
  input.strings.push(str);
8688
8466
  }
8689
8467
  n = input.readInt(true);
8690
8468
  for (let i = 0; i < n; i++) {
8691
8469
  let name = input.readString();
8692
- if (!name)
8693
- throw new Error("Bone name must not be null.");
8470
+ if (!name) throw new Error("Bone name must not be null.");
8694
8471
  let parent = i == 0 ? null : skeletonData.bones[input.readInt(true)];
8695
8472
  let data = new BoneData(i, name, parent);
8696
8473
  data.rotation = input.readFloat();
@@ -8713,25 +8490,21 @@ var spine = (() => {
8713
8490
  n = input.readInt(true);
8714
8491
  for (let i = 0; i < n; i++) {
8715
8492
  let slotName = input.readString();
8716
- if (!slotName)
8717
- throw new Error("Slot name must not be null.");
8493
+ if (!slotName) throw new Error("Slot name must not be null.");
8718
8494
  let boneData = skeletonData.bones[input.readInt(true)];
8719
8495
  let data = new SlotData(i, slotName, boneData);
8720
8496
  Color.rgba8888ToColor(data.color, input.readInt32());
8721
8497
  let darkColor = input.readInt32();
8722
- if (darkColor != -1)
8723
- Color.rgb888ToColor(data.darkColor = new Color(), darkColor);
8498
+ if (darkColor != -1) Color.rgb888ToColor(data.darkColor = new Color(), darkColor);
8724
8499
  data.attachmentName = input.readStringRef();
8725
8500
  data.blendMode = input.readInt(true);
8726
- if (nonessential)
8727
- data.visible = input.readBoolean();
8501
+ if (nonessential) data.visible = input.readBoolean();
8728
8502
  skeletonData.slots.push(data);
8729
8503
  }
8730
8504
  n = input.readInt(true);
8731
8505
  for (let i = 0, nn; i < n; i++) {
8732
8506
  let name = input.readString();
8733
- if (!name)
8734
- throw new Error("IK constraint data name must not be null.");
8507
+ if (!name) throw new Error("IK constraint data name must not be null.");
8735
8508
  let data = new IkConstraintData(name);
8736
8509
  data.order = input.readInt(true);
8737
8510
  nn = input.readInt(true);
@@ -8744,17 +8517,14 @@ var spine = (() => {
8744
8517
  data.compress = (flags & 4) != 0;
8745
8518
  data.stretch = (flags & 8) != 0;
8746
8519
  data.uniform = (flags & 16) != 0;
8747
- if ((flags & 32) != 0)
8748
- data.mix = (flags & 64) != 0 ? input.readFloat() : 1;
8749
- if ((flags & 128) != 0)
8750
- data.softness = input.readFloat() * scale;
8520
+ if ((flags & 32) != 0) data.mix = (flags & 64) != 0 ? input.readFloat() : 1;
8521
+ if ((flags & 128) != 0) data.softness = input.readFloat() * scale;
8751
8522
  skeletonData.ikConstraints.push(data);
8752
8523
  }
8753
8524
  n = input.readInt(true);
8754
8525
  for (let i = 0, nn; i < n; i++) {
8755
8526
  let name = input.readString();
8756
- if (!name)
8757
- throw new Error("Transform constraint data name must not be null.");
8527
+ if (!name) throw new Error("Transform constraint data name must not be null.");
8758
8528
  let data = new TransformConstraintData(name);
8759
8529
  data.order = input.readInt(true);
8760
8530
  nn = input.readInt(true);
@@ -8765,38 +8535,25 @@ var spine = (() => {
8765
8535
  data.skinRequired = (flags & 1) != 0;
8766
8536
  data.local = (flags & 2) != 0;
8767
8537
  data.relative = (flags & 4) != 0;
8768
- if ((flags & 8) != 0)
8769
- data.offsetRotation = input.readFloat();
8770
- if ((flags & 16) != 0)
8771
- data.offsetX = input.readFloat() * scale;
8772
- if ((flags & 32) != 0)
8773
- data.offsetY = input.readFloat() * scale;
8774
- if ((flags & 64) != 0)
8775
- data.offsetScaleX = input.readFloat();
8776
- if ((flags & 128) != 0)
8777
- data.offsetScaleY = input.readFloat();
8538
+ if ((flags & 8) != 0) data.offsetRotation = input.readFloat();
8539
+ if ((flags & 16) != 0) data.offsetX = input.readFloat() * scale;
8540
+ if ((flags & 32) != 0) data.offsetY = input.readFloat() * scale;
8541
+ if ((flags & 64) != 0) data.offsetScaleX = input.readFloat();
8542
+ if ((flags & 128) != 0) data.offsetScaleY = input.readFloat();
8778
8543
  flags = input.readByte();
8779
- if ((flags & 1) != 0)
8780
- data.offsetShearY = input.readFloat();
8781
- if ((flags & 2) != 0)
8782
- data.mixRotate = input.readFloat();
8783
- if ((flags & 4) != 0)
8784
- data.mixX = input.readFloat();
8785
- if ((flags & 8) != 0)
8786
- data.mixY = input.readFloat();
8787
- if ((flags & 16) != 0)
8788
- data.mixScaleX = input.readFloat();
8789
- if ((flags & 32) != 0)
8790
- data.mixScaleY = input.readFloat();
8791
- if ((flags & 64) != 0)
8792
- data.mixShearY = input.readFloat();
8544
+ if ((flags & 1) != 0) data.offsetShearY = input.readFloat();
8545
+ if ((flags & 2) != 0) data.mixRotate = input.readFloat();
8546
+ if ((flags & 4) != 0) data.mixX = input.readFloat();
8547
+ if ((flags & 8) != 0) data.mixY = input.readFloat();
8548
+ if ((flags & 16) != 0) data.mixScaleX = input.readFloat();
8549
+ if ((flags & 32) != 0) data.mixScaleY = input.readFloat();
8550
+ if ((flags & 64) != 0) data.mixShearY = input.readFloat();
8793
8551
  skeletonData.transformConstraints.push(data);
8794
8552
  }
8795
8553
  n = input.readInt(true);
8796
8554
  for (let i = 0, nn; i < n; i++) {
8797
8555
  let name = input.readString();
8798
- if (!name)
8799
- throw new Error("Path constraint data name must not be null.");
8556
+ if (!name) throw new Error("Path constraint data name must not be null.");
8800
8557
  let data = new PathConstraintData(name);
8801
8558
  data.order = input.readInt(true);
8802
8559
  data.skinRequired = input.readBoolean();
@@ -8808,14 +8565,11 @@ var spine = (() => {
8808
8565
  data.positionMode = flags & 1;
8809
8566
  data.spacingMode = flags >> 1 & 3;
8810
8567
  data.rotateMode = flags >> 3 & 3;
8811
- if ((flags & 128) != 0)
8812
- data.offsetRotation = input.readFloat();
8568
+ if ((flags & 128) != 0) data.offsetRotation = input.readFloat();
8813
8569
  data.position = input.readFloat();
8814
- if (data.positionMode == 0 /* Fixed */)
8815
- data.position *= scale;
8570
+ if (data.positionMode == 0 /* Fixed */) data.position *= scale;
8816
8571
  data.spacing = input.readFloat();
8817
- if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */)
8818
- data.spacing *= scale;
8572
+ if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */) data.spacing *= scale;
8819
8573
  data.mixRotate = input.readFloat();
8820
8574
  data.mixX = input.readFloat();
8821
8575
  data.mixY = input.readFloat();
@@ -8824,23 +8578,17 @@ var spine = (() => {
8824
8578
  n = input.readInt(true);
8825
8579
  for (let i = 0, nn; i < n; i++) {
8826
8580
  const name = input.readString();
8827
- if (!name)
8828
- throw new Error("Physics constraint data name must not be null.");
8581
+ if (!name) throw new Error("Physics constraint data name must not be null.");
8829
8582
  const data = new PhysicsConstraintData(name);
8830
8583
  data.order = input.readInt(true);
8831
8584
  data.bone = skeletonData.bones[input.readInt(true)];
8832
8585
  let flags = input.readByte();
8833
8586
  data.skinRequired = (flags & 1) != 0;
8834
- if ((flags & 2) != 0)
8835
- data.x = input.readFloat();
8836
- if ((flags & 4) != 0)
8837
- data.y = input.readFloat();
8838
- if ((flags & 8) != 0)
8839
- data.rotate = input.readFloat();
8840
- if ((flags & 16) != 0)
8841
- data.scaleX = input.readFloat();
8842
- if ((flags & 32) != 0)
8843
- data.shearX = input.readFloat();
8587
+ if ((flags & 2) != 0) data.x = input.readFloat();
8588
+ if ((flags & 4) != 0) data.y = input.readFloat();
8589
+ if ((flags & 8) != 0) data.rotate = input.readFloat();
8590
+ if ((flags & 16) != 0) data.scaleX = input.readFloat();
8591
+ if ((flags & 32) != 0) data.shearX = input.readFloat();
8844
8592
  data.limit = ((flags & 64) != 0 ? input.readFloat() : 5e3) * scale;
8845
8593
  data.step = 1 / input.readUnsignedByte();
8846
8594
  data.inertia = input.readFloat();
@@ -8850,20 +8598,13 @@ var spine = (() => {
8850
8598
  data.wind = input.readFloat();
8851
8599
  data.gravity = input.readFloat();
8852
8600
  flags = input.readByte();
8853
- if ((flags & 1) != 0)
8854
- data.inertiaGlobal = true;
8855
- if ((flags & 2) != 0)
8856
- data.strengthGlobal = true;
8857
- if ((flags & 4) != 0)
8858
- data.dampingGlobal = true;
8859
- if ((flags & 8) != 0)
8860
- data.massGlobal = true;
8861
- if ((flags & 16) != 0)
8862
- data.windGlobal = true;
8863
- if ((flags & 32) != 0)
8864
- data.gravityGlobal = true;
8865
- if ((flags & 64) != 0)
8866
- data.mixGlobal = true;
8601
+ if ((flags & 1) != 0) data.inertiaGlobal = true;
8602
+ if ((flags & 2) != 0) data.strengthGlobal = true;
8603
+ if ((flags & 4) != 0) data.dampingGlobal = true;
8604
+ if ((flags & 8) != 0) data.massGlobal = true;
8605
+ if ((flags & 16) != 0) data.windGlobal = true;
8606
+ if ((flags & 32) != 0) data.gravityGlobal = true;
8607
+ if ((flags & 64) != 0) data.mixGlobal = true;
8867
8608
  data.mix = (flags & 128) != 0 ? input.readFloat() : 1;
8868
8609
  skeletonData.physicsConstraints.push(data);
8869
8610
  }
@@ -8877,8 +8618,7 @@ var spine = (() => {
8877
8618
  Utils.setArraySize(skeletonData.skins, n = i + input.readInt(true));
8878
8619
  for (; i < n; i++) {
8879
8620
  let skin = this.readSkin(input, skeletonData, false, nonessential);
8880
- if (!skin)
8881
- throw new Error("readSkin() should not have returned null.");
8621
+ if (!skin) throw new Error("readSkin() should not have returned null.");
8882
8622
  skeletonData.skins[i] = skin;
8883
8623
  }
8884
8624
  }
@@ -8886,22 +8626,18 @@ var spine = (() => {
8886
8626
  for (let i = 0; i < n; i++) {
8887
8627
  let linkedMesh = this.linkedMeshes[i];
8888
8628
  const skin = skeletonData.skins[linkedMesh.skinIndex];
8889
- if (!linkedMesh.parent)
8890
- throw new Error("Linked mesh parent must not be null");
8629
+ if (!linkedMesh.parent) throw new Error("Linked mesh parent must not be null");
8891
8630
  let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
8892
- if (!parent)
8893
- throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
8631
+ if (!parent) throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
8894
8632
  linkedMesh.mesh.timelineAttachment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
8895
8633
  linkedMesh.mesh.setParentMesh(parent);
8896
- if (linkedMesh.mesh.region != null)
8897
- linkedMesh.mesh.updateRegion();
8634
+ if (linkedMesh.mesh.region != null) linkedMesh.mesh.updateRegion();
8898
8635
  }
8899
8636
  this.linkedMeshes.length = 0;
8900
8637
  n = input.readInt(true);
8901
8638
  for (let i = 0; i < n; i++) {
8902
8639
  let eventName = input.readString();
8903
- if (!eventName)
8904
- throw new Error("Event data name must not be null");
8640
+ if (!eventName) throw new Error("Event data name must not be null");
8905
8641
  let data = new EventData(eventName);
8906
8642
  data.intValue = input.readInt(false);
8907
8643
  data.floatValue = input.readFloat();
@@ -8916,8 +8652,7 @@ var spine = (() => {
8916
8652
  n = input.readInt(true);
8917
8653
  for (let i = 0; i < n; i++) {
8918
8654
  let animationName = input.readString();
8919
- if (!animationName)
8920
- throw new Error("Animatio name must not be null.");
8655
+ if (!animationName) throw new Error("Animatio name must not be null.");
8921
8656
  skeletonData.animations.push(this.readAnimation(input, animationName, skeletonData));
8922
8657
  }
8923
8658
  return skeletonData;
@@ -8927,16 +8662,13 @@ var spine = (() => {
8927
8662
  let slotCount = 0;
8928
8663
  if (defaultSkin) {
8929
8664
  slotCount = input.readInt(true);
8930
- if (slotCount == 0)
8931
- return null;
8665
+ if (slotCount == 0) return null;
8932
8666
  skin = new Skin("default");
8933
8667
  } else {
8934
8668
  let skinName = input.readString();
8935
- if (!skinName)
8936
- throw new Error("Skin name must not be null.");
8669
+ if (!skinName) throw new Error("Skin name must not be null.");
8937
8670
  skin = new Skin(skinName);
8938
- if (nonessential)
8939
- Color.rgba8888ToColor(skin.color, input.readInt32());
8671
+ if (nonessential) Color.rgba8888ToColor(skin.color, input.readInt32());
8940
8672
  skin.bones.length = input.readInt(true);
8941
8673
  for (let i = 0, n = skin.bones.length; i < n; i++)
8942
8674
  skin.bones[i] = skeletonData.bones[input.readInt(true)];
@@ -8957,8 +8689,7 @@ var spine = (() => {
8957
8689
  if (!name)
8958
8690
  throw new Error("Attachment name must not be null");
8959
8691
  let attachment = this.readAttachment(input, skeletonData, skin, slotIndex, name, nonessential);
8960
- if (attachment)
8961
- skin.setAttachment(slotIndex, name, attachment);
8692
+ if (attachment) skin.setAttachment(slotIndex, name, attachment);
8962
8693
  }
8963
8694
  }
8964
8695
  return skin;
@@ -8967,10 +8698,10 @@ var spine = (() => {
8967
8698
  let scale = this.scale;
8968
8699
  let flags = input.readByte();
8969
8700
  const name = (flags & 8) != 0 ? input.readStringRef() : attachmentName;
8970
- if (!name)
8971
- throw new Error("Attachment name must not be null");
8701
+ if (!name) throw new Error("Attachment name must not be null");
8972
8702
  switch (flags & 7) {
8973
- case AttachmentType.Region: {
8703
+ // BUG?
8704
+ case 0 /* Region */: {
8974
8705
  let path = (flags & 16) != 0 ? input.readStringRef() : null;
8975
8706
  const color = (flags & 32) != 0 ? input.readInt32() : 4294967295;
8976
8707
  const sequence = (flags & 64) != 0 ? this.readSequence(input) : null;
@@ -8981,11 +8712,9 @@ var spine = (() => {
8981
8712
  let scaleY = input.readFloat();
8982
8713
  let width = input.readFloat();
8983
8714
  let height = input.readFloat();
8984
- if (!path)
8985
- path = name;
8715
+ if (!path) path = name;
8986
8716
  let region = this.attachmentLoader.newRegionAttachment(skin, name, path, sequence);
8987
- if (!region)
8988
- return null;
8717
+ if (!region) return null;
8989
8718
  region.path = path;
8990
8719
  region.x = x * scale;
8991
8720
  region.y = y * scale;
@@ -8996,24 +8725,21 @@ var spine = (() => {
8996
8725
  region.height = height * scale;
8997
8726
  Color.rgba8888ToColor(region.color, color);
8998
8727
  region.sequence = sequence;
8999
- if (sequence == null)
9000
- region.updateRegion();
8728
+ if (sequence == null) region.updateRegion();
9001
8729
  return region;
9002
8730
  }
9003
- case AttachmentType.BoundingBox: {
8731
+ case 1 /* BoundingBox */: {
9004
8732
  let vertices = this.readVertices(input, (flags & 16) != 0);
9005
8733
  let color = nonessential ? input.readInt32() : 0;
9006
8734
  let box = this.attachmentLoader.newBoundingBoxAttachment(skin, name);
9007
- if (!box)
9008
- return null;
8735
+ if (!box) return null;
9009
8736
  box.worldVerticesLength = vertices.length;
9010
8737
  box.vertices = vertices.vertices;
9011
8738
  box.bones = vertices.bones;
9012
- if (nonessential)
9013
- Color.rgba8888ToColor(box.color, color);
8739
+ if (nonessential) Color.rgba8888ToColor(box.color, color);
9014
8740
  return box;
9015
8741
  }
9016
- case AttachmentType.Mesh: {
8742
+ case 2 /* Mesh */: {
9017
8743
  let path = (flags & 16) != 0 ? input.readStringRef() : name;
9018
8744
  const color = (flags & 32) != 0 ? input.readInt32() : 4294967295;
9019
8745
  const sequence = (flags & 64) != 0 ? this.readSequence(input) : null;
@@ -9028,11 +8754,9 @@ var spine = (() => {
9028
8754
  width = input.readFloat();
9029
8755
  height = input.readFloat();
9030
8756
  }
9031
- if (!path)
9032
- path = name;
8757
+ if (!path) path = name;
9033
8758
  let mesh = this.attachmentLoader.newMeshAttachment(skin, name, path, sequence);
9034
- if (!mesh)
9035
- return null;
8759
+ if (!mesh) return null;
9036
8760
  mesh.path = path;
9037
8761
  Color.rgba8888ToColor(mesh.color, color);
9038
8762
  mesh.bones = vertices.bones;
@@ -9040,8 +8764,7 @@ var spine = (() => {
9040
8764
  mesh.worldVerticesLength = vertices.length;
9041
8765
  mesh.triangles = triangles;
9042
8766
  mesh.regionUVs = uvs;
9043
- if (sequence == null)
9044
- mesh.updateRegion();
8767
+ if (sequence == null) mesh.updateRegion();
9045
8768
  mesh.hullLength = hullLength << 1;
9046
8769
  mesh.sequence = sequence;
9047
8770
  if (nonessential) {
@@ -9051,10 +8774,9 @@ var spine = (() => {
9051
8774
  }
9052
8775
  return mesh;
9053
8776
  }
9054
- case AttachmentType.LinkedMesh: {
8777
+ case 3 /* LinkedMesh */: {
9055
8778
  const path = (flags & 16) != 0 ? input.readStringRef() : name;
9056
- if (path == null)
9057
- throw new Error("Path of linked mesh must not be null");
8779
+ if (path == null) throw new Error("Path of linked mesh must not be null");
9058
8780
  const color = (flags & 32) != 0 ? input.readInt32() : 4294967295;
9059
8781
  const sequence = (flags & 64) != 0 ? this.readSequence(input) : null;
9060
8782
  const inheritTimelines = (flags & 128) != 0;
@@ -9066,8 +8788,7 @@ var spine = (() => {
9066
8788
  height = input.readFloat();
9067
8789
  }
9068
8790
  let mesh = this.attachmentLoader.newMeshAttachment(skin, name, path, sequence);
9069
- if (!mesh)
9070
- return null;
8791
+ if (!mesh) return null;
9071
8792
  mesh.path = path;
9072
8793
  Color.rgba8888ToColor(mesh.color, color);
9073
8794
  mesh.sequence = sequence;
@@ -9078,7 +8799,7 @@ var spine = (() => {
9078
8799
  this.linkedMeshes.push(new LinkedMesh(mesh, skinIndex, slotIndex, parent, inheritTimelines));
9079
8800
  return mesh;
9080
8801
  }
9081
- case AttachmentType.Path: {
8802
+ case 4 /* Path */: {
9082
8803
  const closed2 = (flags & 16) != 0;
9083
8804
  const constantSpeed = (flags & 32) != 0;
9084
8805
  const vertices = this.readVertices(input, (flags & 64) != 0);
@@ -9087,46 +8808,40 @@ var spine = (() => {
9087
8808
  lengths[i] = input.readFloat() * scale;
9088
8809
  const color = nonessential ? input.readInt32() : 0;
9089
8810
  const path = this.attachmentLoader.newPathAttachment(skin, name);
9090
- if (!path)
9091
- return null;
8811
+ if (!path) return null;
9092
8812
  path.closed = closed2;
9093
8813
  path.constantSpeed = constantSpeed;
9094
8814
  path.worldVerticesLength = vertices.length;
9095
8815
  path.vertices = vertices.vertices;
9096
8816
  path.bones = vertices.bones;
9097
8817
  path.lengths = lengths;
9098
- if (nonessential)
9099
- Color.rgba8888ToColor(path.color, color);
8818
+ if (nonessential) Color.rgba8888ToColor(path.color, color);
9100
8819
  return path;
9101
8820
  }
9102
- case AttachmentType.Point: {
8821
+ case 5 /* Point */: {
9103
8822
  const rotation = input.readFloat();
9104
8823
  const x = input.readFloat();
9105
8824
  const y = input.readFloat();
9106
8825
  const color = nonessential ? input.readInt32() : 0;
9107
8826
  const point = this.attachmentLoader.newPointAttachment(skin, name);
9108
- if (!point)
9109
- return null;
8827
+ if (!point) return null;
9110
8828
  point.x = x * scale;
9111
8829
  point.y = y * scale;
9112
8830
  point.rotation = rotation;
9113
- if (nonessential)
9114
- Color.rgba8888ToColor(point.color, color);
8831
+ if (nonessential) Color.rgba8888ToColor(point.color, color);
9115
8832
  return point;
9116
8833
  }
9117
- case AttachmentType.Clipping: {
8834
+ case 6 /* Clipping */: {
9118
8835
  const endSlotIndex = input.readInt(true);
9119
8836
  const vertices = this.readVertices(input, (flags & 16) != 0);
9120
8837
  let color = nonessential ? input.readInt32() : 0;
9121
8838
  let clip = this.attachmentLoader.newClippingAttachment(skin, name);
9122
- if (!clip)
9123
- return null;
8839
+ if (!clip) return null;
9124
8840
  clip.endSlot = skeletonData.slots[endSlotIndex];
9125
8841
  clip.worldVerticesLength = vertices.length;
9126
8842
  clip.vertices = vertices.vertices;
9127
8843
  clip.bones = vertices.bones;
9128
- if (nonessential)
9129
- Color.rgba8888ToColor(clip.color, color);
8844
+ if (nonessential) Color.rgba8888ToColor(clip.color, color);
9130
8845
  return clip;
9131
8846
  }
9132
8847
  }
@@ -9209,8 +8924,7 @@ var spine = (() => {
9209
8924
  let a = input.readUnsignedByte() / 255;
9210
8925
  for (let frame = 0, bezier = 0; ; frame++) {
9211
8926
  timeline.setFrame(frame, time, r, g, b, a);
9212
- if (frame == frameLast)
9213
- break;
8927
+ if (frame == frameLast) break;
9214
8928
  let time2 = input.readFloat();
9215
8929
  let r2 = input.readUnsignedByte() / 255;
9216
8930
  let g2 = input.readUnsignedByte() / 255;
@@ -9244,8 +8958,7 @@ var spine = (() => {
9244
8958
  let b = input.readUnsignedByte() / 255;
9245
8959
  for (let frame = 0, bezier = 0; ; frame++) {
9246
8960
  timeline.setFrame(frame, time, r, g, b);
9247
- if (frame == frameLast)
9248
- break;
8961
+ if (frame == frameLast) break;
9249
8962
  let time2 = input.readFloat();
9250
8963
  let r2 = input.readUnsignedByte() / 255;
9251
8964
  let g2 = input.readUnsignedByte() / 255;
@@ -9280,8 +8993,7 @@ var spine = (() => {
9280
8993
  let b2 = input.readUnsignedByte() / 255;
9281
8994
  for (let frame = 0, bezier = 0; ; frame++) {
9282
8995
  timeline.setFrame(frame, time, r, g, b, a, r2, g2, b2);
9283
- if (frame == frameLast)
9284
- break;
8996
+ if (frame == frameLast) break;
9285
8997
  let time2 = input.readFloat();
9286
8998
  let nr = input.readUnsignedByte() / 255;
9287
8999
  let ng = input.readUnsignedByte() / 255;
@@ -9327,8 +9039,7 @@ var spine = (() => {
9327
9039
  let b2 = input.readUnsignedByte() / 255;
9328
9040
  for (let frame = 0, bezier = 0; ; frame++) {
9329
9041
  timeline.setFrame(frame, time, r, g, b, r2, g2, b2);
9330
- if (frame == frameLast)
9331
- break;
9042
+ if (frame == frameLast) break;
9332
9043
  let time2 = input.readFloat();
9333
9044
  let nr = input.readUnsignedByte() / 255;
9334
9045
  let ng = input.readUnsignedByte() / 255;
@@ -9364,8 +9075,7 @@ var spine = (() => {
9364
9075
  let time = input.readFloat(), a = input.readUnsignedByte() / 255;
9365
9076
  for (let frame = 0, bezier = 0; ; frame++) {
9366
9077
  timeline.setFrame(frame, time, a);
9367
- if (frame == frameLast)
9368
- break;
9078
+ if (frame == frameLast) break;
9369
9079
  let time2 = input.readFloat();
9370
9080
  let a2 = input.readUnsignedByte() / 255;
9371
9081
  switch (input.readByte()) {
@@ -9437,8 +9147,7 @@ var spine = (() => {
9437
9147
  let softness = (flags & 4) != 0 ? input.readFloat() * scale : 0;
9438
9148
  for (let frame = 0, bezier = 0; ; frame++) {
9439
9149
  timeline.setFrame(frame, time, mix, softness, (flags & 8) != 0 ? 1 : -1, (flags & 16) != 0, (flags & 32) != 0);
9440
- if (frame == frameLast)
9441
- break;
9150
+ if (frame == frameLast) break;
9442
9151
  flags = input.readByte();
9443
9152
  const time2 = input.readFloat(), mix2 = (flags & 1) != 0 ? (flags & 2) != 0 ? input.readFloat() : 1 : 0;
9444
9153
  const softness2 = (flags & 4) != 0 ? input.readFloat() * scale : 0;
@@ -9460,8 +9169,7 @@ var spine = (() => {
9460
9169
  let time = input.readFloat(), mixRotate = input.readFloat(), mixX = input.readFloat(), mixY = input.readFloat(), mixScaleX = input.readFloat(), mixScaleY = input.readFloat(), mixShearY = input.readFloat();
9461
9170
  for (let frame = 0, bezier = 0; ; frame++) {
9462
9171
  timeline.setFrame(frame, time, mixRotate, mixX, mixY, mixScaleX, mixScaleY, mixShearY);
9463
- if (frame == frameLast)
9464
- break;
9172
+ if (frame == frameLast) break;
9465
9173
  let time2 = input.readFloat(), mixRotate2 = input.readFloat(), mixX2 = input.readFloat(), mixY2 = input.readFloat(), mixScaleX2 = input.readFloat(), mixScaleY2 = input.readFloat(), mixShearY2 = input.readFloat();
9466
9174
  switch (input.readByte()) {
9467
9175
  case CURVE_STEPPED:
@@ -9510,8 +9218,7 @@ var spine = (() => {
9510
9218
  let time = input.readFloat(), mixRotate = input.readFloat(), mixX = input.readFloat(), mixY = input.readFloat();
9511
9219
  for (let frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1; ; frame++) {
9512
9220
  timeline.setFrame(frame, time, mixRotate, mixX, mixY);
9513
- if (frame == frameLast)
9514
- break;
9221
+ if (frame == frameLast) break;
9515
9222
  let time2 = input.readFloat(), mixRotate2 = input.readFloat(), mixX2 = input.readFloat(), mixY2 = input.readFloat();
9516
9223
  switch (input.readByte()) {
9517
9224
  case CURVE_STEPPED:
@@ -9573,8 +9280,7 @@ var spine = (() => {
9573
9280
  let slotIndex = input.readInt(true);
9574
9281
  for (let iii = 0, nnn = input.readInt(true); iii < nnn; iii++) {
9575
9282
  let attachmentName = input.readStringRef();
9576
- if (!attachmentName)
9577
- throw new Error("attachmentName must not be null.");
9283
+ if (!attachmentName) throw new Error("attachmentName must not be null.");
9578
9284
  let attachment = skin.getAttachment(slotIndex, attachmentName);
9579
9285
  let timelineType = input.readByte();
9580
9286
  let frameCount = input.readInt(true);
@@ -9610,8 +9316,7 @@ var spine = (() => {
9610
9316
  }
9611
9317
  }
9612
9318
  timeline.setFrame(frame, time, deform);
9613
- if (frame == frameLast)
9614
- break;
9319
+ if (frame == frameLast) break;
9615
9320
  let time2 = input.readFloat();
9616
9321
  switch (input.readByte()) {
9617
9322
  case CURVE_STEPPED:
@@ -9666,8 +9371,7 @@ var spine = (() => {
9666
9371
  while (originalIndex < slotCount)
9667
9372
  unchanged[unchangedIndex++] = originalIndex++;
9668
9373
  for (let ii = slotCount - 1; ii >= 0; ii--)
9669
- if (drawOrder[ii] == -1)
9670
- drawOrder[ii] = unchanged[--unchangedIndex];
9374
+ if (drawOrder[ii] == -1) drawOrder[ii] = unchanged[--unchangedIndex];
9671
9375
  timeline.setFrame(i, time, drawOrder);
9672
9376
  }
9673
9377
  timelines.push(timeline);
@@ -9682,8 +9386,7 @@ var spine = (() => {
9682
9386
  event.intValue = input.readInt(false);
9683
9387
  event.floatValue = input.readFloat();
9684
9388
  event.stringValue = input.readString();
9685
- if (event.stringValue == null)
9686
- event.stringValue = eventData.stringValue;
9389
+ if (event.stringValue == null) event.stringValue = eventData.stringValue;
9687
9390
  if (event.data.audioPath) {
9688
9391
  event.volume = input.readFloat();
9689
9392
  event.balance = input.readFloat();
@@ -9805,22 +9508,11 @@ var spine = (() => {
9805
9508
  this.length = length;
9806
9509
  }
9807
9510
  };
9808
- var AttachmentType = /* @__PURE__ */ ((AttachmentType2) => {
9809
- AttachmentType2[AttachmentType2["Region"] = 0] = "Region";
9810
- AttachmentType2[AttachmentType2["BoundingBox"] = 1] = "BoundingBox";
9811
- AttachmentType2[AttachmentType2["Mesh"] = 2] = "Mesh";
9812
- AttachmentType2[AttachmentType2["LinkedMesh"] = 3] = "LinkedMesh";
9813
- AttachmentType2[AttachmentType2["Path"] = 4] = "Path";
9814
- AttachmentType2[AttachmentType2["Point"] = 5] = "Point";
9815
- AttachmentType2[AttachmentType2["Clipping"] = 6] = "Clipping";
9816
- return AttachmentType2;
9817
- })(AttachmentType || {});
9818
9511
  function readTimeline1(input, timeline, scale) {
9819
9512
  let time = input.readFloat(), value = input.readFloat() * scale;
9820
9513
  for (let frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1; ; frame++) {
9821
9514
  timeline.setFrame(frame, time, value);
9822
- if (frame == frameLast)
9823
- break;
9515
+ if (frame == frameLast) break;
9824
9516
  let time2 = input.readFloat(), value2 = input.readFloat() * scale;
9825
9517
  switch (input.readByte()) {
9826
9518
  case CURVE_STEPPED:
@@ -9838,8 +9530,7 @@ var spine = (() => {
9838
9530
  let time = input.readFloat(), value1 = input.readFloat() * scale, value2 = input.readFloat() * scale;
9839
9531
  for (let frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1; ; frame++) {
9840
9532
  timeline.setFrame(frame, time, value1, value2);
9841
- if (frame == frameLast)
9842
- break;
9533
+ if (frame == frameLast) break;
9843
9534
  let time2 = input.readFloat(), nvalue1 = input.readFloat() * scale, nvalue2 = input.readFloat() * scale;
9844
9535
  switch (input.readByte()) {
9845
9536
  case CURVE_STEPPED:
@@ -9913,8 +9604,7 @@ var spine = (() => {
9913
9604
  * @param updateAabb If true, the axis aligned bounding box containing all the polygons is computed. If false, the
9914
9605
  * SkeletonBounds AABB methods will always return true. */
9915
9606
  update(skeleton, updateAabb) {
9916
- if (!skeleton)
9917
- throw new Error("skeleton cannot be null.");
9607
+ if (!skeleton) throw new Error("skeleton cannot be null.");
9918
9608
  let boundingBoxes = this.boundingBoxes;
9919
9609
  let polygons = this.polygons;
9920
9610
  let polygonPool = this.polygonPool;
@@ -9925,8 +9615,7 @@ var spine = (() => {
9925
9615
  polygons.length = 0;
9926
9616
  for (let i = 0; i < slotCount; i++) {
9927
9617
  let slot = slots[i];
9928
- if (!slot.bone.active)
9929
- continue;
9618
+ if (!slot.bone.active) continue;
9930
9619
  let attachment = slot.getAttachment();
9931
9620
  if (attachment instanceof BoundingBoxAttachment) {
9932
9621
  let boundingBox = attachment;
@@ -9982,17 +9671,13 @@ var spine = (() => {
9982
9671
  return false;
9983
9672
  let m = (y2 - y1) / (x2 - x1);
9984
9673
  let y = m * (minX - x1) + y1;
9985
- if (y > minY && y < maxY)
9986
- return true;
9674
+ if (y > minY && y < maxY) return true;
9987
9675
  y = m * (maxX - x1) + y1;
9988
- if (y > minY && y < maxY)
9989
- return true;
9676
+ if (y > minY && y < maxY) return true;
9990
9677
  let x = (minY - y1) / m + x1;
9991
- if (x > minX && x < maxX)
9992
- return true;
9678
+ if (x > minX && x < maxX) return true;
9993
9679
  x = (maxY - y1) / m + x1;
9994
- if (x > minX && x < maxX)
9995
- return true;
9680
+ if (x > minX && x < maxX) return true;
9996
9681
  return false;
9997
9682
  }
9998
9683
  /** Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds. */
@@ -10004,8 +9689,7 @@ var spine = (() => {
10004
9689
  containsPoint(x, y) {
10005
9690
  let polygons = this.polygons;
10006
9691
  for (let i = 0, n = polygons.length; i < n; i++)
10007
- if (this.containsPointPolygon(polygons[i], x, y))
10008
- return this.boundingBoxes[i];
9692
+ if (this.containsPointPolygon(polygons[i], x, y)) return this.boundingBoxes[i];
10009
9693
  return null;
10010
9694
  }
10011
9695
  /** Returns true if the polygon contains the point. */
@@ -10019,8 +9703,7 @@ var spine = (() => {
10019
9703
  let prevY = vertices[prevIndex + 1];
10020
9704
  if (vertexY < y && prevY >= y || prevY < y && vertexY >= y) {
10021
9705
  let vertexX = vertices[ii];
10022
- if (vertexX + (y - vertexY) / (prevY - vertexY) * (vertices[prevIndex] - vertexX) < x)
10023
- inside = !inside;
9706
+ if (vertexX + (y - vertexY) / (prevY - vertexY) * (vertices[prevIndex] - vertexX) < x) inside = !inside;
10024
9707
  }
10025
9708
  prevIndex = ii;
10026
9709
  }
@@ -10032,8 +9715,7 @@ var spine = (() => {
10032
9715
  intersectsSegment(x1, y1, x2, y2) {
10033
9716
  let polygons = this.polygons;
10034
9717
  for (let i = 0, n = polygons.length; i < n; i++)
10035
- if (this.intersectsSegmentPolygon(polygons[i], x1, y1, x2, y2))
10036
- return this.boundingBoxes[i];
9718
+ if (this.intersectsSegmentPolygon(polygons[i], x1, y1, x2, y2)) return this.boundingBoxes[i];
10037
9719
  return null;
10038
9720
  }
10039
9721
  /** Returns true if the polygon contains any part of the line segment. */
@@ -10051,8 +9733,7 @@ var spine = (() => {
10051
9733
  let x = (det1 * width34 - width12 * det2) / det3;
10052
9734
  if ((x >= x3 && x <= x4 || x >= x4 && x <= x3) && (x >= x1 && x <= x2 || x >= x2 && x <= x1)) {
10053
9735
  let y = (det1 * height34 - height12 * det2) / det3;
10054
- if ((y >= y3 && y <= y4 || y >= y4 && y <= y3) && (y >= y1 && y <= y2 || y >= y2 && y <= y1))
10055
- return true;
9736
+ if ((y >= y3 && y <= y4 || y >= y4 && y <= y3) && (y >= y1 && y <= y2 || y >= y2 && y <= y1)) return true;
10056
9737
  }
10057
9738
  x3 = x4;
10058
9739
  y3 = y4;
@@ -10061,8 +9742,7 @@ var spine = (() => {
10061
9742
  }
10062
9743
  /** Returns the polygon for the specified bounding box, or null. */
10063
9744
  getPolygon(boundingBox) {
10064
- if (!boundingBox)
10065
- throw new Error("boundingBox cannot be null.");
9745
+ if (!boundingBox) throw new Error("boundingBox cannot be null.");
10066
9746
  let index = this.boundingBoxes.indexOf(boundingBox);
10067
9747
  return index == -1 ? null : this.polygons[index];
10068
9748
  }
@@ -10077,7 +9757,7 @@ var spine = (() => {
10077
9757
  };
10078
9758
 
10079
9759
  // spine-core/src/Triangulator.ts
10080
- var Triangulator = class {
9760
+ var Triangulator = class _Triangulator {
10081
9761
  convexPolygons = new Array();
10082
9762
  convexPolygonsIndices = new Array();
10083
9763
  indicesArray = new Array();
@@ -10099,7 +9779,7 @@ var spine = (() => {
10099
9779
  let isConcave = this.isConcaveArray;
10100
9780
  isConcave.length = 0;
10101
9781
  for (let i = 0, n = vertexCount; i < n; ++i)
10102
- isConcave[i] = Triangulator.isConcave(i, vertexCount, vertices, indices);
9782
+ isConcave[i] = _Triangulator.isConcave(i, vertexCount, vertices, indices);
10103
9783
  let triangles = this.triangles;
10104
9784
  triangles.length = 0;
10105
9785
  while (vertexCount > 3) {
@@ -10112,14 +9792,12 @@ var spine = (() => {
10112
9792
  let p2x = vertices[p2], p2y = vertices[p2 + 1];
10113
9793
  let p3x = vertices[p3], p3y = vertices[p3 + 1];
10114
9794
  for (let ii = (next + 1) % vertexCount; ii != previous; ii = (ii + 1) % vertexCount) {
10115
- if (!isConcave[ii])
10116
- continue;
9795
+ if (!isConcave[ii]) continue;
10117
9796
  let v = indices[ii] << 1;
10118
9797
  let vx = vertices[v], vy = vertices[v + 1];
10119
- if (Triangulator.positiveArea(p3x, p3y, p1x, p1y, vx, vy)) {
10120
- if (Triangulator.positiveArea(p1x, p1y, p2x, p2y, vx, vy)) {
10121
- if (Triangulator.positiveArea(p2x, p2y, p3x, p3y, vx, vy))
10122
- break outer;
9798
+ if (_Triangulator.positiveArea(p3x, p3y, p1x, p1y, vx, vy)) {
9799
+ if (_Triangulator.positiveArea(p1x, p1y, p2x, p2y, vx, vy)) {
9800
+ if (_Triangulator.positiveArea(p2x, p2y, p3x, p3y, vx, vy)) break outer;
10123
9801
  }
10124
9802
  }
10125
9803
  }
@@ -10127,8 +9805,7 @@ var spine = (() => {
10127
9805
  }
10128
9806
  if (next == 0) {
10129
9807
  do {
10130
- if (!isConcave[i])
10131
- break;
9808
+ if (!isConcave[i]) break;
10132
9809
  i--;
10133
9810
  } while (i > 0);
10134
9811
  break;
@@ -10145,8 +9822,8 @@ var spine = (() => {
10145
9822
  vertexCount--;
10146
9823
  let previousIndex = (vertexCount + i - 1) % vertexCount;
10147
9824
  let nextIndex = i == vertexCount ? 0 : i;
10148
- isConcave[previousIndex] = Triangulator.isConcave(previousIndex, vertexCount, vertices, indices);
10149
- isConcave[nextIndex] = Triangulator.isConcave(nextIndex, vertexCount, vertices, indices);
9825
+ isConcave[previousIndex] = _Triangulator.isConcave(previousIndex, vertexCount, vertices, indices);
9826
+ isConcave[nextIndex] = _Triangulator.isConcave(nextIndex, vertexCount, vertices, indices);
10150
9827
  }
10151
9828
  if (vertexCount == 3) {
10152
9829
  triangles.push(indices[2]);
@@ -10176,8 +9853,8 @@ var spine = (() => {
10176
9853
  let merged = false;
10177
9854
  if (fanBaseIndex == t1) {
10178
9855
  let o = polygon.length - 4;
10179
- let winding1 = Triangulator.winding(polygon[o], polygon[o + 1], polygon[o + 2], polygon[o + 3], x3, y3);
10180
- let winding2 = Triangulator.winding(x3, y3, polygon[0], polygon[1], polygon[2], polygon[3]);
9856
+ let winding1 = _Triangulator.winding(polygon[o], polygon[o + 1], polygon[o + 2], polygon[o + 3], x3, y3);
9857
+ let winding2 = _Triangulator.winding(x3, y3, polygon[0], polygon[1], polygon[2], polygon[3]);
10181
9858
  if (winding1 == lastWinding && winding2 == lastWinding) {
10182
9859
  polygon.push(x3);
10183
9860
  polygon.push(y3);
@@ -10206,7 +9883,7 @@ var spine = (() => {
10206
9883
  polygonIndices.push(t1);
10207
9884
  polygonIndices.push(t2);
10208
9885
  polygonIndices.push(t3);
10209
- lastWinding = Triangulator.winding(x1, y1, x2, y2, x3, y3);
9886
+ lastWinding = _Triangulator.winding(x1, y1, x2, y2, x3, y3);
10210
9887
  fanBaseIndex = t1;
10211
9888
  }
10212
9889
  }
@@ -10216,8 +9893,7 @@ var spine = (() => {
10216
9893
  }
10217
9894
  for (let i = 0, n = convexPolygons.length; i < n; i++) {
10218
9895
  polygonIndices = convexPolygonsIndices[i];
10219
- if (polygonIndices.length == 0)
10220
- continue;
9896
+ if (polygonIndices.length == 0) continue;
10221
9897
  let firstIndex = polygonIndices[0];
10222
9898
  let lastIndex = polygonIndices[polygonIndices.length - 1];
10223
9899
  polygon = convexPolygons[i];
@@ -10226,22 +9902,19 @@ var spine = (() => {
10226
9902
  let prevX = polygon[o + 2], prevY = polygon[o + 3];
10227
9903
  let firstX = polygon[0], firstY = polygon[1];
10228
9904
  let secondX = polygon[2], secondY = polygon[3];
10229
- let winding = Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, firstX, firstY);
9905
+ let winding = _Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, firstX, firstY);
10230
9906
  for (let ii = 0; ii < n; ii++) {
10231
- if (ii == i)
10232
- continue;
9907
+ if (ii == i) continue;
10233
9908
  let otherIndices = convexPolygonsIndices[ii];
10234
- if (otherIndices.length != 3)
10235
- continue;
9909
+ if (otherIndices.length != 3) continue;
10236
9910
  let otherFirstIndex = otherIndices[0];
10237
9911
  let otherSecondIndex = otherIndices[1];
10238
9912
  let otherLastIndex = otherIndices[2];
10239
9913
  let otherPoly = convexPolygons[ii];
10240
9914
  let x3 = otherPoly[otherPoly.length - 2], y3 = otherPoly[otherPoly.length - 1];
10241
- if (otherFirstIndex != firstIndex || otherSecondIndex != lastIndex)
10242
- continue;
10243
- let winding1 = Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, x3, y3);
10244
- let winding2 = Triangulator.winding(x3, y3, firstX, firstY, secondX, secondY);
9915
+ if (otherFirstIndex != firstIndex || otherSecondIndex != lastIndex) continue;
9916
+ let winding1 = _Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, x3, y3);
9917
+ let winding2 = _Triangulator.winding(x3, y3, firstX, firstY, secondX, secondY);
10245
9918
  if (winding1 == winding && winding2 == winding) {
10246
9919
  otherPoly.length = 0;
10247
9920
  otherIndices.length = 0;
@@ -10291,7 +9964,7 @@ var spine = (() => {
10291
9964
  };
10292
9965
 
10293
9966
  // spine-core/src/SkeletonClipping.ts
10294
- var SkeletonClipping = class {
9967
+ var SkeletonClipping = class _SkeletonClipping {
10295
9968
  triangulator = new Triangulator();
10296
9969
  clippingPolygon = new Array();
10297
9970
  clipOutput = new Array();
@@ -10302,30 +9975,27 @@ var spine = (() => {
10302
9975
  clipAttachment = null;
10303
9976
  clippingPolygons = null;
10304
9977
  clipStart(slot, clip) {
10305
- if (this.clipAttachment)
10306
- return 0;
9978
+ if (this.clipAttachment) return 0;
10307
9979
  this.clipAttachment = clip;
10308
9980
  let n = clip.worldVerticesLength;
10309
9981
  let vertices = Utils.setArraySize(this.clippingPolygon, n);
10310
9982
  clip.computeWorldVertices(slot, 0, n, vertices, 0, 2);
10311
9983
  let clippingPolygon = this.clippingPolygon;
10312
- SkeletonClipping.makeClockwise(clippingPolygon);
9984
+ _SkeletonClipping.makeClockwise(clippingPolygon);
10313
9985
  let clippingPolygons = this.clippingPolygons = this.triangulator.decompose(clippingPolygon, this.triangulator.triangulate(clippingPolygon));
10314
9986
  for (let i = 0, n2 = clippingPolygons.length; i < n2; i++) {
10315
9987
  let polygon = clippingPolygons[i];
10316
- SkeletonClipping.makeClockwise(polygon);
9988
+ _SkeletonClipping.makeClockwise(polygon);
10317
9989
  polygon.push(polygon[0]);
10318
9990
  polygon.push(polygon[1]);
10319
9991
  }
10320
9992
  return clippingPolygons.length;
10321
9993
  }
10322
9994
  clipEndWithSlot(slot) {
10323
- if (this.clipAttachment && this.clipAttachment.endSlot == slot.data)
10324
- this.clipEnd();
9995
+ if (this.clipAttachment && this.clipAttachment.endSlot == slot.data) this.clipEnd();
10325
9996
  }
10326
9997
  clipEnd() {
10327
- if (!this.clipAttachment)
10328
- return;
9998
+ if (!this.clipAttachment) return;
10329
9999
  this.clipAttachment = null;
10330
10000
  this.clippingPolygons = null;
10331
10001
  this.clippedVertices.length = 0;
@@ -10381,8 +10051,7 @@ var spine = (() => {
10381
10051
  let s = clippedVertices.length;
10382
10052
  if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {
10383
10053
  let clipOutputLength = clipOutput.length;
10384
- if (clipOutputLength == 0)
10385
- continue;
10054
+ if (clipOutputLength == 0) continue;
10386
10055
  let clipOutputCount = clipOutputLength >> 1;
10387
10056
  let clipOutputItems = this.clipOutput;
10388
10057
  let clippedVerticesItems = Utils.setArraySize(clippedVertices, s + clipOutputCount * 2);
@@ -10442,8 +10111,7 @@ var spine = (() => {
10442
10111
  let s = clippedVertices.length;
10443
10112
  if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {
10444
10113
  let clipOutputLength = clipOutput.length;
10445
- if (clipOutputLength == 0)
10446
- continue;
10114
+ if (clipOutputLength == 0) continue;
10447
10115
  let d0 = y2 - y3, d1 = x3 - x2, d2 = x1 - x3, d4 = y3 - y1;
10448
10116
  let d = 1 / (d0 * d2 + d1 * (y1 - y3));
10449
10117
  let clipOutputCount = clipOutputLength >> 1;
@@ -10572,8 +10240,7 @@ var spine = (() => {
10572
10240
  let s = clippedVertices.length;
10573
10241
  if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {
10574
10242
  let clipOutputLength = clipOutput.length;
10575
- if (clipOutputLength == 0)
10576
- continue;
10243
+ if (clipOutputLength == 0) continue;
10577
10244
  let d0 = y2 - y3, d1 = x3 - x2, d2 = x1 - x3, d4 = y3 - y1;
10578
10245
  let d = 1 / (d0 * d2 + d1 * (y1 - y3));
10579
10246
  let clipOutputCount = clipOutputLength >> 1;
@@ -10696,8 +10363,7 @@ var spine = (() => {
10696
10363
  }
10697
10364
  output.push(output[0]);
10698
10365
  output.push(output[1]);
10699
- if (i == clippingVerticesLast)
10700
- break;
10366
+ if (i == clippingVerticesLast) break;
10701
10367
  let temp = output;
10702
10368
  output = input;
10703
10369
  output.length = 0;
@@ -10722,8 +10388,7 @@ var spine = (() => {
10722
10388
  p2y = vertices[i + 3];
10723
10389
  area += p1x * p2y - p2x * p1y;
10724
10390
  }
10725
- if (area < 0)
10726
- return;
10391
+ if (area < 0) return;
10727
10392
  for (let i = 0, lastX = verticeslength - 2, n = verticeslength >> 1; i < n; i += 2) {
10728
10393
  let x = vertices[i], y = vertices[i + 1];
10729
10394
  let other = lastX - i;
@@ -10769,8 +10434,7 @@ var spine = (() => {
10769
10434
  let boneMap = root.bones[i];
10770
10435
  let parent = null;
10771
10436
  let parentName = getValue(boneMap, "parent", null);
10772
- if (parentName)
10773
- parent = skeletonData.findBone(parentName);
10437
+ if (parentName) parent = skeletonData.findBone(parentName);
10774
10438
  let data = new BoneData(skeletonData.bones.length, boneMap.name, parent);
10775
10439
  data.length = getValue(boneMap, "length", 0) * scale;
10776
10440
  data.x = getValue(boneMap, "x", 0) * scale;
@@ -10783,8 +10447,7 @@ var spine = (() => {
10783
10447
  data.inherit = Utils.enumValue(Inherit, getValue(boneMap, "inherit", "Normal"));
10784
10448
  data.skinRequired = getValue(boneMap, "skin", false);
10785
10449
  let color = getValue(boneMap, "color", null);
10786
- if (color)
10787
- data.color.setFromString(color);
10450
+ if (color) data.color.setFromString(color);
10788
10451
  skeletonData.bones.push(data);
10789
10452
  }
10790
10453
  }
@@ -10793,15 +10456,12 @@ var spine = (() => {
10793
10456
  let slotMap = root.slots[i];
10794
10457
  let slotName = slotMap.name;
10795
10458
  let boneData = skeletonData.findBone(slotMap.bone);
10796
- if (!boneData)
10797
- throw new Error(`Couldn't find bone ${slotMap.bone} for slot ${slotName}`);
10459
+ if (!boneData) throw new Error(`Couldn't find bone ${slotMap.bone} for slot ${slotName}`);
10798
10460
  let data = new SlotData(skeletonData.slots.length, slotName, boneData);
10799
10461
  let color = getValue(slotMap, "color", null);
10800
- if (color)
10801
- data.color.setFromString(color);
10462
+ if (color) data.color.setFromString(color);
10802
10463
  let dark = getValue(slotMap, "dark", null);
10803
- if (dark)
10804
- data.darkColor = Color.fromString(dark);
10464
+ if (dark) data.darkColor = Color.fromString(dark);
10805
10465
  data.attachmentName = getValue(slotMap, "attachment", null);
10806
10466
  data.blendMode = Utils.enumValue(BlendMode, getValue(slotMap, "blend", "normal"));
10807
10467
  data.visible = getValue(slotMap, "visible", true);
@@ -10816,14 +10476,12 @@ var spine = (() => {
10816
10476
  data.skinRequired = getValue(constraintMap, "skin", false);
10817
10477
  for (let ii = 0; ii < constraintMap.bones.length; ii++) {
10818
10478
  let bone = skeletonData.findBone(constraintMap.bones[ii]);
10819
- if (!bone)
10820
- throw new Error(`Couldn't find bone ${constraintMap.bones[ii]} for IK constraint ${constraintMap.name}.`);
10479
+ if (!bone) throw new Error(`Couldn't find bone ${constraintMap.bones[ii]} for IK constraint ${constraintMap.name}.`);
10821
10480
  data.bones.push(bone);
10822
10481
  }
10823
10482
  let target = skeletonData.findBone(constraintMap.target);
10824
10483
  ;
10825
- if (!target)
10826
- throw new Error(`Couldn't find target bone ${constraintMap.target} for IK constraint ${constraintMap.name}.`);
10484
+ if (!target) throw new Error(`Couldn't find target bone ${constraintMap.target} for IK constraint ${constraintMap.name}.`);
10827
10485
  data.target = target;
10828
10486
  data.mix = getValue(constraintMap, "mix", 1);
10829
10487
  data.softness = getValue(constraintMap, "softness", 0) * scale;
@@ -10843,14 +10501,12 @@ var spine = (() => {
10843
10501
  for (let ii = 0; ii < constraintMap.bones.length; ii++) {
10844
10502
  let boneName = constraintMap.bones[ii];
10845
10503
  let bone = skeletonData.findBone(boneName);
10846
- if (!bone)
10847
- throw new Error(`Couldn't find bone ${boneName} for transform constraint ${constraintMap.name}.`);
10504
+ if (!bone) throw new Error(`Couldn't find bone ${boneName} for transform constraint ${constraintMap.name}.`);
10848
10505
  data.bones.push(bone);
10849
10506
  }
10850
10507
  let targetName = constraintMap.target;
10851
10508
  let target = skeletonData.findBone(targetName);
10852
- if (!target)
10853
- throw new Error(`Couldn't find target bone ${targetName} for transform constraint ${constraintMap.name}.`);
10509
+ if (!target) throw new Error(`Couldn't find target bone ${targetName} for transform constraint ${constraintMap.name}.`);
10854
10510
  data.target = target;
10855
10511
  data.local = getValue(constraintMap, "local", false);
10856
10512
  data.relative = getValue(constraintMap, "relative", false);
@@ -10878,25 +10534,21 @@ var spine = (() => {
10878
10534
  for (let ii = 0; ii < constraintMap.bones.length; ii++) {
10879
10535
  let boneName = constraintMap.bones[ii];
10880
10536
  let bone = skeletonData.findBone(boneName);
10881
- if (!bone)
10882
- throw new Error(`Couldn't find bone ${boneName} for path constraint ${constraintMap.name}.`);
10537
+ if (!bone) throw new Error(`Couldn't find bone ${boneName} for path constraint ${constraintMap.name}.`);
10883
10538
  data.bones.push(bone);
10884
10539
  }
10885
10540
  let targetName = constraintMap.target;
10886
10541
  let target = skeletonData.findSlot(targetName);
10887
- if (!target)
10888
- throw new Error(`Couldn't find target slot ${targetName} for path constraint ${constraintMap.name}.`);
10542
+ if (!target) throw new Error(`Couldn't find target slot ${targetName} for path constraint ${constraintMap.name}.`);
10889
10543
  data.target = target;
10890
10544
  data.positionMode = Utils.enumValue(PositionMode, getValue(constraintMap, "positionMode", "Percent"));
10891
10545
  data.spacingMode = Utils.enumValue(SpacingMode, getValue(constraintMap, "spacingMode", "Length"));
10892
10546
  data.rotateMode = Utils.enumValue(RotateMode, getValue(constraintMap, "rotateMode", "Tangent"));
10893
10547
  data.offsetRotation = getValue(constraintMap, "rotation", 0);
10894
10548
  data.position = getValue(constraintMap, "position", 0);
10895
- if (data.positionMode == 0 /* Fixed */)
10896
- data.position *= scale;
10549
+ if (data.positionMode == 0 /* Fixed */) data.position *= scale;
10897
10550
  data.spacing = getValue(constraintMap, "spacing", 0);
10898
- if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */)
10899
- data.spacing *= scale;
10551
+ if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */) data.spacing *= scale;
10900
10552
  data.mixRotate = getValue(constraintMap, "mixRotate", 1);
10901
10553
  data.mixX = getValue(constraintMap, "mixX", 1);
10902
10554
  data.mixY = getValue(constraintMap, "mixY", data.mixX);
@@ -10911,8 +10563,7 @@ var spine = (() => {
10911
10563
  data.skinRequired = getValue(constraintMap, "skin", false);
10912
10564
  const boneName = constraintMap.bone;
10913
10565
  const bone = skeletonData.findBone(boneName);
10914
- if (bone == null)
10915
- throw new Error("Physics bone not found: " + boneName);
10566
+ if (bone == null) throw new Error("Physics bone not found: " + boneName);
10916
10567
  data.bone = bone;
10917
10568
  data.x = getValue(constraintMap, "x", 0);
10918
10569
  data.y = getValue(constraintMap, "y", 0);
@@ -10946,8 +10597,7 @@ var spine = (() => {
10946
10597
  for (let ii = 0; ii < skinMap.bones.length; ii++) {
10947
10598
  let boneName = skinMap.bones[ii];
10948
10599
  let bone = skeletonData.findBone(boneName);
10949
- if (!bone)
10950
- throw new Error(`Couldn't find bone ${boneName} for skin ${skinMap.name}.`);
10600
+ if (!bone) throw new Error(`Couldn't find bone ${boneName} for skin ${skinMap.name}.`);
10951
10601
  skin.bones.push(bone);
10952
10602
  }
10953
10603
  }
@@ -10955,8 +10605,7 @@ var spine = (() => {
10955
10605
  for (let ii = 0; ii < skinMap.ik.length; ii++) {
10956
10606
  let constraintName = skinMap.ik[ii];
10957
10607
  let constraint = skeletonData.findIkConstraint(constraintName);
10958
- if (!constraint)
10959
- throw new Error(`Couldn't find IK constraint ${constraintName} for skin ${skinMap.name}.`);
10608
+ if (!constraint) throw new Error(`Couldn't find IK constraint ${constraintName} for skin ${skinMap.name}.`);
10960
10609
  skin.constraints.push(constraint);
10961
10610
  }
10962
10611
  }
@@ -10964,8 +10613,7 @@ var spine = (() => {
10964
10613
  for (let ii = 0; ii < skinMap.transform.length; ii++) {
10965
10614
  let constraintName = skinMap.transform[ii];
10966
10615
  let constraint = skeletonData.findTransformConstraint(constraintName);
10967
- if (!constraint)
10968
- throw new Error(`Couldn't find transform constraint ${constraintName} for skin ${skinMap.name}.`);
10616
+ if (!constraint) throw new Error(`Couldn't find transform constraint ${constraintName} for skin ${skinMap.name}.`);
10969
10617
  skin.constraints.push(constraint);
10970
10618
  }
10971
10619
  }
@@ -10973,8 +10621,7 @@ var spine = (() => {
10973
10621
  for (let ii = 0; ii < skinMap.path.length; ii++) {
10974
10622
  let constraintName = skinMap.path[ii];
10975
10623
  let constraint = skeletonData.findPathConstraint(constraintName);
10976
- if (!constraint)
10977
- throw new Error(`Couldn't find path constraint ${constraintName} for skin ${skinMap.name}.`);
10624
+ if (!constraint) throw new Error(`Couldn't find path constraint ${constraintName} for skin ${skinMap.name}.`);
10978
10625
  skin.constraints.push(constraint);
10979
10626
  }
10980
10627
  }
@@ -10982,39 +10629,32 @@ var spine = (() => {
10982
10629
  for (let ii = 0; ii < skinMap.physics.length; ii++) {
10983
10630
  let constraintName = skinMap.physics[ii];
10984
10631
  let constraint = skeletonData.findPhysicsConstraint(constraintName);
10985
- if (!constraint)
10986
- throw new Error(`Couldn't find physics constraint ${constraintName} for skin ${skinMap.name}.`);
10632
+ if (!constraint) throw new Error(`Couldn't find physics constraint ${constraintName} for skin ${skinMap.name}.`);
10987
10633
  skin.constraints.push(constraint);
10988
10634
  }
10989
10635
  }
10990
10636
  for (let slotName in skinMap.attachments) {
10991
10637
  let slot = skeletonData.findSlot(slotName);
10992
- if (!slot)
10993
- throw new Error(`Couldn't find slot ${slotName} for skin ${skinMap.name}.`);
10638
+ if (!slot) throw new Error(`Couldn't find slot ${slotName} for skin ${skinMap.name}.`);
10994
10639
  let slotMap = skinMap.attachments[slotName];
10995
10640
  for (let entryName in slotMap) {
10996
10641
  let attachment = this.readAttachment(slotMap[entryName], skin, slot.index, entryName, skeletonData);
10997
- if (attachment)
10998
- skin.setAttachment(slot.index, entryName, attachment);
10642
+ if (attachment) skin.setAttachment(slot.index, entryName, attachment);
10999
10643
  }
11000
10644
  }
11001
10645
  skeletonData.skins.push(skin);
11002
- if (skin.name == "default")
11003
- skeletonData.defaultSkin = skin;
10646
+ if (skin.name == "default") skeletonData.defaultSkin = skin;
11004
10647
  }
11005
10648
  }
11006
10649
  for (let i = 0, n = this.linkedMeshes.length; i < n; i++) {
11007
10650
  let linkedMesh = this.linkedMeshes[i];
11008
10651
  let skin = !linkedMesh.skin ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);
11009
- if (!skin)
11010
- throw new Error(`Skin not found: ${linkedMesh.skin}`);
10652
+ if (!skin) throw new Error(`Skin not found: ${linkedMesh.skin}`);
11011
10653
  let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
11012
- if (!parent)
11013
- throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
10654
+ if (!parent) throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
11014
10655
  linkedMesh.mesh.timelineAttachment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
11015
10656
  linkedMesh.mesh.setParentMesh(parent);
11016
- if (linkedMesh.mesh.region != null)
11017
- linkedMesh.mesh.updateRegion();
10657
+ if (linkedMesh.mesh.region != null) linkedMesh.mesh.updateRegion();
11018
10658
  }
11019
10659
  this.linkedMeshes.length = 0;
11020
10660
  if (root.events) {
@@ -11048,8 +10688,7 @@ var spine = (() => {
11048
10688
  let path = getValue(map, "path", name);
11049
10689
  let sequence = this.readSequence(getValue(map, "sequence", null));
11050
10690
  let region = this.attachmentLoader.newRegionAttachment(skin, name, path, sequence);
11051
- if (!region)
11052
- return null;
10691
+ if (!region) return null;
11053
10692
  region.path = path;
11054
10693
  region.x = getValue(map, "x", 0) * scale;
11055
10694
  region.y = getValue(map, "y", 0) * scale;
@@ -11060,20 +10699,16 @@ var spine = (() => {
11060
10699
  region.height = map.height * scale;
11061
10700
  region.sequence = sequence;
11062
10701
  let color = getValue(map, "color", null);
11063
- if (color)
11064
- region.color.setFromString(color);
11065
- if (region.region != null)
11066
- region.updateRegion();
10702
+ if (color) region.color.setFromString(color);
10703
+ if (region.region != null) region.updateRegion();
11067
10704
  return region;
11068
10705
  }
11069
10706
  case "boundingbox": {
11070
10707
  let box = this.attachmentLoader.newBoundingBoxAttachment(skin, name);
11071
- if (!box)
11072
- return null;
10708
+ if (!box) return null;
11073
10709
  this.readVertices(map, box, map.vertexCount << 1);
11074
10710
  let color = getValue(map, "color", null);
11075
- if (color)
11076
- box.color.setFromString(color);
10711
+ if (color) box.color.setFromString(color);
11077
10712
  return box;
11078
10713
  }
11079
10714
  case "mesh":
@@ -11081,12 +10716,10 @@ var spine = (() => {
11081
10716
  let path = getValue(map, "path", name);
11082
10717
  let sequence = this.readSequence(getValue(map, "sequence", null));
11083
10718
  let mesh = this.attachmentLoader.newMeshAttachment(skin, name, path, sequence);
11084
- if (!mesh)
11085
- return null;
10719
+ if (!mesh) return null;
11086
10720
  mesh.path = path;
11087
10721
  let color = getValue(map, "color", null);
11088
- if (color)
11089
- mesh.color.setFromString(color);
10722
+ if (color) mesh.color.setFromString(color);
11090
10723
  mesh.width = getValue(map, "width", 0) * scale;
11091
10724
  mesh.height = getValue(map, "height", 0) * scale;
11092
10725
  mesh.sequence = sequence;
@@ -11099,16 +10732,14 @@ var spine = (() => {
11099
10732
  this.readVertices(map, mesh, uvs.length);
11100
10733
  mesh.triangles = map.triangles;
11101
10734
  mesh.regionUVs = uvs;
11102
- if (mesh.region != null)
11103
- mesh.updateRegion();
10735
+ if (mesh.region != null) mesh.updateRegion();
11104
10736
  mesh.edges = getValue(map, "edges", null);
11105
10737
  mesh.hullLength = getValue(map, "hull", 0) * 2;
11106
10738
  return mesh;
11107
10739
  }
11108
10740
  case "path": {
11109
10741
  let path = this.attachmentLoader.newPathAttachment(skin, name);
11110
- if (!path)
11111
- return null;
10742
+ if (!path) return null;
11112
10743
  path.closed = getValue(map, "closed", false);
11113
10744
  path.constantSpeed = getValue(map, "constantSpeed", true);
11114
10745
  let vertexCount = map.vertexCount;
@@ -11118,42 +10749,35 @@ var spine = (() => {
11118
10749
  lengths[i] = map.lengths[i] * scale;
11119
10750
  path.lengths = lengths;
11120
10751
  let color = getValue(map, "color", null);
11121
- if (color)
11122
- path.color.setFromString(color);
10752
+ if (color) path.color.setFromString(color);
11123
10753
  return path;
11124
10754
  }
11125
10755
  case "point": {
11126
10756
  let point = this.attachmentLoader.newPointAttachment(skin, name);
11127
- if (!point)
11128
- return null;
10757
+ if (!point) return null;
11129
10758
  point.x = getValue(map, "x", 0) * scale;
11130
10759
  point.y = getValue(map, "y", 0) * scale;
11131
10760
  point.rotation = getValue(map, "rotation", 0);
11132
10761
  let color = getValue(map, "color", null);
11133
- if (color)
11134
- point.color.setFromString(color);
10762
+ if (color) point.color.setFromString(color);
11135
10763
  return point;
11136
10764
  }
11137
10765
  case "clipping": {
11138
10766
  let clip = this.attachmentLoader.newClippingAttachment(skin, name);
11139
- if (!clip)
11140
- return null;
10767
+ if (!clip) return null;
11141
10768
  let end = getValue(map, "end", null);
11142
- if (end)
11143
- clip.endSlot = skeletonData.findSlot(end);
10769
+ if (end) clip.endSlot = skeletonData.findSlot(end);
11144
10770
  let vertexCount = map.vertexCount;
11145
10771
  this.readVertices(map, clip, vertexCount << 1);
11146
10772
  let color = getValue(map, "color", null);
11147
- if (color)
11148
- clip.color.setFromString(color);
10773
+ if (color) clip.color.setFromString(color);
11149
10774
  return clip;
11150
10775
  }
11151
10776
  }
11152
10777
  return null;
11153
10778
  }
11154
10779
  readSequence(map) {
11155
- if (map == null)
11156
- return null;
10780
+ if (map == null) return null;
11157
10781
  let sequence = new Sequence(getValue(map, "count", 0));
11158
10782
  sequence.start = getValue(map, "start", 1);
11159
10783
  sequence.digits = getValue(map, "digits", 0);
@@ -11195,13 +10819,11 @@ var spine = (() => {
11195
10819
  for (let slotName in map.slots) {
11196
10820
  let slotMap = map.slots[slotName];
11197
10821
  let slot = skeletonData.findSlot(slotName);
11198
- if (!slot)
11199
- throw new Error("Slot not found: " + slotName);
10822
+ if (!slot) throw new Error("Slot not found: " + slotName);
11200
10823
  let slotIndex = slot.index;
11201
10824
  for (let timelineName in slotMap) {
11202
10825
  let timelineMap = slotMap[timelineName];
11203
- if (!timelineMap)
11204
- continue;
10826
+ if (!timelineMap) continue;
11205
10827
  let frames = timelineMap.length;
11206
10828
  if (timelineName == "attachment") {
11207
10829
  let timeline = new AttachmentTimeline(frames, slotIndex);
@@ -11334,14 +10956,12 @@ var spine = (() => {
11334
10956
  for (let boneName in map.bones) {
11335
10957
  let boneMap = map.bones[boneName];
11336
10958
  let bone = skeletonData.findBone(boneName);
11337
- if (!bone)
11338
- throw new Error("Bone not found: " + boneName);
10959
+ if (!bone) throw new Error("Bone not found: " + boneName);
11339
10960
  let boneIndex = bone.index;
11340
10961
  for (let timelineName in boneMap) {
11341
10962
  let timelineMap = boneMap[timelineName];
11342
10963
  let frames = timelineMap.length;
11343
- if (frames == 0)
11344
- continue;
10964
+ if (frames == 0) continue;
11345
10965
  if (timelineName === "rotate") {
11346
10966
  timelines.push(readTimeline12(timelineMap, new RotateTimeline(frames, frames, boneIndex), 0, 1));
11347
10967
  } else if (timelineName === "translate") {
@@ -11386,11 +11006,9 @@ var spine = (() => {
11386
11006
  for (let constraintName in map.ik) {
11387
11007
  let constraintMap = map.ik[constraintName];
11388
11008
  let keyMap = constraintMap[0];
11389
- if (!keyMap)
11390
- continue;
11009
+ if (!keyMap) continue;
11391
11010
  let constraint = skeletonData.findIkConstraint(constraintName);
11392
- if (!constraint)
11393
- throw new Error("IK Constraint not found: " + constraintName);
11011
+ if (!constraint) throw new Error("IK Constraint not found: " + constraintName);
11394
11012
  let constraintIndex = skeletonData.ikConstraints.indexOf(constraint);
11395
11013
  let timeline = new IkConstraintTimeline(constraintMap.length, constraintMap.length << 1, constraintIndex);
11396
11014
  let time = getValue(keyMap, "time", 0);
@@ -11423,11 +11041,9 @@ var spine = (() => {
11423
11041
  for (let constraintName in map.transform) {
11424
11042
  let timelineMap = map.transform[constraintName];
11425
11043
  let keyMap = timelineMap[0];
11426
- if (!keyMap)
11427
- continue;
11044
+ if (!keyMap) continue;
11428
11045
  let constraint = skeletonData.findTransformConstraint(constraintName);
11429
- if (!constraint)
11430
- throw new Error("Transform constraint not found: " + constraintName);
11046
+ if (!constraint) throw new Error("Transform constraint not found: " + constraintName);
11431
11047
  let constraintIndex = skeletonData.transformConstraints.indexOf(constraint);
11432
11048
  let timeline = new TransformConstraintTimeline(timelineMap.length, timelineMap.length * 6, constraintIndex);
11433
11049
  let time = getValue(keyMap, "time", 0);
@@ -11476,14 +11092,12 @@ var spine = (() => {
11476
11092
  for (let constraintName in map.path) {
11477
11093
  let constraintMap = map.path[constraintName];
11478
11094
  let constraint = skeletonData.findPathConstraint(constraintName);
11479
- if (!constraint)
11480
- throw new Error("Path constraint not found: " + constraintName);
11095
+ if (!constraint) throw new Error("Path constraint not found: " + constraintName);
11481
11096
  let constraintIndex = skeletonData.pathConstraints.indexOf(constraint);
11482
11097
  for (let timelineName in constraintMap) {
11483
11098
  let timelineMap = constraintMap[timelineName];
11484
11099
  let keyMap = timelineMap[0];
11485
- if (!keyMap)
11486
- continue;
11100
+ if (!keyMap) continue;
11487
11101
  let frames = timelineMap.length;
11488
11102
  if (timelineName === "position") {
11489
11103
  let timeline = new PathConstraintPositionTimeline(frames, frames, constraintIndex);
@@ -11531,15 +11145,13 @@ var spine = (() => {
11531
11145
  let constraintIndex = -1;
11532
11146
  if (constraintName.length > 0) {
11533
11147
  let constraint = skeletonData.findPhysicsConstraint(constraintName);
11534
- if (!constraint)
11535
- throw new Error("Physics constraint not found: " + constraintName);
11148
+ if (!constraint) throw new Error("Physics constraint not found: " + constraintName);
11536
11149
  constraintIndex = skeletonData.physicsConstraints.indexOf(constraint);
11537
11150
  }
11538
11151
  for (let timelineName in constraintMap) {
11539
11152
  let timelineMap = constraintMap[timelineName];
11540
11153
  let keyMap = timelineMap[0];
11541
- if (!keyMap)
11542
- continue;
11154
+ if (!keyMap) continue;
11543
11155
  let frames = timelineMap.length;
11544
11156
  if (timelineName == "reset") {
11545
11157
  const timeline2 = new PhysicsConstraintResetTimeline(frames, constraintIndex);
@@ -11573,13 +11185,11 @@ var spine = (() => {
11573
11185
  for (let attachmentsName in map.attachments) {
11574
11186
  let attachmentsMap = map.attachments[attachmentsName];
11575
11187
  let skin = skeletonData.findSkin(attachmentsName);
11576
- if (!skin)
11577
- throw new Error("Skin not found: " + attachmentsName);
11188
+ if (!skin) throw new Error("Skin not found: " + attachmentsName);
11578
11189
  for (let slotMapName in attachmentsMap) {
11579
11190
  let slotMap = attachmentsMap[slotMapName];
11580
11191
  let slot = skeletonData.findSlot(slotMapName);
11581
- if (!slot)
11582
- throw new Error("Slot not found: " + slotMapName);
11192
+ if (!slot) throw new Error("Slot not found: " + slotMapName);
11583
11193
  let slotIndex = slot.index;
11584
11194
  for (let attachmentMapName in slotMap) {
11585
11195
  let attachmentMap = slotMap[attachmentMapName];
@@ -11587,8 +11197,7 @@ var spine = (() => {
11587
11197
  for (let timelineMapName in attachmentMap) {
11588
11198
  let timelineMap = attachmentMap[timelineMapName];
11589
11199
  let keyMap = timelineMap[0];
11590
- if (!keyMap)
11591
- continue;
11200
+ if (!keyMap) continue;
11592
11201
  if (timelineMapName == "deform") {
11593
11202
  let weighted = attachment.bones;
11594
11203
  let vertices = attachment.vertices;
@@ -11621,8 +11230,7 @@ var spine = (() => {
11621
11230
  }
11622
11231
  let time2 = getValue(nextMap, "time", 0);
11623
11232
  let curve = keyMap.curve;
11624
- if (curve)
11625
- bezier = readCurve(curve, timeline, bezier, frame, 0, time, time2, 0, 1, 1);
11233
+ if (curve) bezier = readCurve(curve, timeline, bezier, frame, 0, time, time2, 0, 1, 1);
11626
11234
  time = time2;
11627
11235
  keyMap = nextMap;
11628
11236
  }
@@ -11661,8 +11269,7 @@ var spine = (() => {
11661
11269
  for (let ii = 0; ii < offsets.length; ii++) {
11662
11270
  let offsetMap = offsets[ii];
11663
11271
  let slot = skeletonData.findSlot(offsetMap.slot);
11664
- if (!slot)
11665
- throw new Error("Slot not found: " + slot);
11272
+ if (!slot) throw new Error("Slot not found: " + slot);
11666
11273
  let slotIndex = slot.index;
11667
11274
  while (originalIndex != slotIndex)
11668
11275
  unchanged[unchangedIndex++] = originalIndex++;
@@ -11671,8 +11278,7 @@ var spine = (() => {
11671
11278
  while (originalIndex < slotCount)
11672
11279
  unchanged[unchangedIndex++] = originalIndex++;
11673
11280
  for (let ii = slotCount - 1; ii >= 0; ii--)
11674
- if (drawOrder[ii] == -1)
11675
- drawOrder[ii] = unchanged[--unchangedIndex];
11281
+ if (drawOrder[ii] == -1) drawOrder[ii] = unchanged[--unchangedIndex];
11676
11282
  }
11677
11283
  timeline.setFrame(frame, getValue(drawOrderMap, "time", 0), drawOrder);
11678
11284
  }
@@ -11684,8 +11290,7 @@ var spine = (() => {
11684
11290
  for (let i = 0; i < map.events.length; i++, frame++) {
11685
11291
  let eventMap = map.events[i];
11686
11292
  let eventData = skeletonData.findEvent(eventMap.name);
11687
- if (!eventData)
11688
- throw new Error("Event not found: " + eventMap.name);
11293
+ if (!eventData) throw new Error("Event not found: " + eventMap.name);
11689
11294
  let event = new Event(Utils.toSinglePrecision(getValue(eventMap, "time", 0)), eventData);
11690
11295
  event.intValue = getValue(eventMap, "int", eventData.intValue);
11691
11296
  event.floatValue = getValue(eventMap, "float", eventData.floatValue);
@@ -11732,8 +11337,7 @@ var spine = (() => {
11732
11337
  }
11733
11338
  let time2 = getValue(nextMap, "time", 0);
11734
11339
  let value2 = getValue(nextMap, "value", defaultValue) * scale;
11735
- if (keyMap.curve)
11736
- bezier = readCurve(keyMap.curve, timeline, bezier, frame, 0, time, time2, value, value2, scale);
11340
+ if (keyMap.curve) bezier = readCurve(keyMap.curve, timeline, bezier, frame, 0, time, time2, value, value2, scale);
11737
11341
  time = time2;
11738
11342
  value = value2;
11739
11343
  keyMap = nextMap;
@@ -11786,13 +11390,13 @@ var spine = (() => {
11786
11390
  // spine-core/src/polyfills.ts
11787
11391
  (() => {
11788
11392
  if (typeof Math.fround === "undefined") {
11789
- Math.fround = function(array) {
11393
+ Math.fround = /* @__PURE__ */ function(array) {
11790
11394
  return function(x) {
11791
11395
  return array[0] = x, array[0];
11792
11396
  };
11793
11397
  }(new Float32Array(1));
11794
11398
  }
11795
11399
  })();
11796
- return __toCommonJS(src_exports);
11400
+ return __toCommonJS(index_exports);
11797
11401
  })();
11798
11402
  //# sourceMappingURL=spine-core.js.map