@esotericsoftware/spine-core 4.2.81 → 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,13 +3939,11 @@ var spine = (() => {
4072
3939
  if (!last) {
4073
3940
  this.setCurrent(trackIndex, entry, true);
4074
3941
  this.queue.drain();
4075
- if (delay < 0)
4076
- delay = 0;
3942
+ if (delay < 0) delay = 0;
4077
3943
  } else {
4078
3944
  last.next = entry;
4079
3945
  entry.previous = last;
4080
- if (delay <= 0)
4081
- delay = Math.max(delay + last.getTrackComplete() - entry.mixDuration, 0);
3946
+ if (delay <= 0) delay = Math.max(delay + last.getTrackComplete() - entry.mixDuration, 0);
4082
3947
  }
4083
3948
  entry.delay = delay;
4084
3949
  return entry;
@@ -4116,8 +3981,7 @@ var spine = (() => {
4116
3981
  * after the {@link AnimationStateListener#dispose()} event occurs. */
4117
3982
  addEmptyAnimation(trackIndex, mixDuration = 0, delay = 0) {
4118
3983
  let entry = this.addAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false, delay);
4119
- if (delay <= 0)
4120
- entry.delay = Math.max(entry.delay + entry.mixDuration - mixDuration, 0);
3984
+ if (delay <= 0) entry.delay = Math.max(entry.delay + entry.mixDuration - mixDuration, 0);
4121
3985
  entry.mixDuration = mixDuration;
4122
3986
  entry.trackEnd = mixDuration;
4123
3987
  return entry;
@@ -4129,15 +3993,13 @@ var spine = (() => {
4129
3993
  this.queue.drainDisabled = true;
4130
3994
  for (let i = 0, n = this.tracks.length; i < n; i++) {
4131
3995
  let current = this.tracks[i];
4132
- if (current)
4133
- this.setEmptyAnimation(current.trackIndex, mixDuration);
3996
+ if (current) this.setEmptyAnimation(current.trackIndex, mixDuration);
4134
3997
  }
4135
3998
  this.queue.drainDisabled = oldDrainDisabled;
4136
3999
  this.queue.drain();
4137
4000
  }
4138
4001
  expandToIndex(index) {
4139
- if (index < this.tracks.length)
4140
- return this.tracks[index];
4002
+ if (index < this.tracks.length) return this.tracks[index];
4141
4003
  Utils.ensureArrayCapacity(this.tracks, index + 1, null);
4142
4004
  this.tracks.length = index + 1;
4143
4005
  return null;
@@ -4189,13 +4051,11 @@ var spine = (() => {
4189
4051
  let tracks = this.tracks;
4190
4052
  for (let i = 0, n = tracks.length; i < n; i++) {
4191
4053
  let entry = tracks[i];
4192
- if (!entry)
4193
- continue;
4054
+ if (!entry) continue;
4194
4055
  while (entry.mixingFrom)
4195
4056
  entry = entry.mixingFrom;
4196
4057
  do {
4197
- if (!entry.mixingTo || entry.mixBlend != 3 /* add */)
4198
- this.computeHold(entry);
4058
+ if (!entry.mixingTo || entry.mixBlend != 3 /* add */) this.computeHold(entry);
4199
4059
  entry = entry.mixingTo;
4200
4060
  } while (entry);
4201
4061
  }
@@ -4224,8 +4084,7 @@ var spine = (() => {
4224
4084
  timelineMode[i] = FIRST;
4225
4085
  } else {
4226
4086
  for (let next = to.mixingTo; next; next = next.mixingTo) {
4227
- if (next.animation.hasTimeline(ids))
4228
- continue;
4087
+ if (next.animation.hasTimeline(ids)) continue;
4229
4088
  if (entry.mixDuration > 0) {
4230
4089
  timelineMode[i] = HOLD_MIX;
4231
4090
  timelineHoldMix[i] = next;
@@ -4239,21 +4098,18 @@ var spine = (() => {
4239
4098
  }
4240
4099
  /** Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing. */
4241
4100
  getCurrent(trackIndex) {
4242
- if (trackIndex >= this.tracks.length)
4243
- return null;
4101
+ if (trackIndex >= this.tracks.length) return null;
4244
4102
  return this.tracks[trackIndex];
4245
4103
  }
4246
4104
  /** Adds a listener to receive events for all track entries. */
4247
4105
  addListener(listener) {
4248
- if (!listener)
4249
- throw new Error("listener cannot be null.");
4106
+ if (!listener) throw new Error("listener cannot be null.");
4250
4107
  this.listeners.push(listener);
4251
4108
  }
4252
4109
  /** Removes the listener added with {@link #addListener()}. */
4253
4110
  removeListener(listener) {
4254
4111
  let index = this.listeners.indexOf(listener);
4255
- if (index >= 0)
4256
- this.listeners.splice(index, 1);
4112
+ if (index >= 0) this.listeners.splice(index, 1);
4257
4113
  }
4258
4114
  /** Removes all listeners added with {@link #addListener()}. */
4259
4115
  clearListeners() {
@@ -4266,8 +4122,6 @@ var spine = (() => {
4266
4122
  this.queue.clear();
4267
4123
  }
4268
4124
  };
4269
- var AnimationState = _AnimationState;
4270
- __publicField(AnimationState, "_emptyAnimation", new Animation("<empty>", [], 0));
4271
4125
  var TrackEntry = class {
4272
4126
  /** The animation to apply for this track entry. */
4273
4127
  animation = null;
@@ -4436,8 +4290,7 @@ var spine = (() => {
4436
4290
  getAnimationTime() {
4437
4291
  if (this.loop) {
4438
4292
  let duration = this.animationEnd - this.animationStart;
4439
- if (duration == 0)
4440
- return this.animationStart;
4293
+ if (duration == 0) return this.animationStart;
4441
4294
  return this.trackTime % duration + this.animationStart;
4442
4295
  }
4443
4296
  return Math.min(this.trackTime + this.animationStart, this.animationEnd);
@@ -4465,10 +4318,8 @@ var spine = (() => {
4465
4318
  getTrackComplete() {
4466
4319
  let duration = this.animationEnd - this.animationStart;
4467
4320
  if (duration != 0) {
4468
- if (this.loop)
4469
- return duration * (1 + (this.trackTime / duration | 0));
4470
- if (this.trackTime < duration)
4471
- return duration;
4321
+ if (this.loop) return duration * (1 + (this.trackTime / duration | 0));
4322
+ if (this.trackTime < duration) return duration;
4472
4323
  }
4473
4324
  return this.trackTime;
4474
4325
  }
@@ -4492,35 +4343,34 @@ var spine = (() => {
4492
4343
  this.animState = animState;
4493
4344
  }
4494
4345
  start(entry) {
4495
- this.objects.push(EventType.start);
4346
+ this.objects.push(0 /* start */);
4496
4347
  this.objects.push(entry);
4497
4348
  this.animState.animationsChanged = true;
4498
4349
  }
4499
4350
  interrupt(entry) {
4500
- this.objects.push(EventType.interrupt);
4351
+ this.objects.push(1 /* interrupt */);
4501
4352
  this.objects.push(entry);
4502
4353
  }
4503
4354
  end(entry) {
4504
- this.objects.push(EventType.end);
4355
+ this.objects.push(2 /* end */);
4505
4356
  this.objects.push(entry);
4506
4357
  this.animState.animationsChanged = true;
4507
4358
  }
4508
4359
  dispose(entry) {
4509
- this.objects.push(EventType.dispose);
4360
+ this.objects.push(3 /* dispose */);
4510
4361
  this.objects.push(entry);
4511
4362
  }
4512
4363
  complete(entry) {
4513
- this.objects.push(EventType.complete);
4364
+ this.objects.push(4 /* complete */);
4514
4365
  this.objects.push(entry);
4515
4366
  }
4516
4367
  event(entry, event) {
4517
- this.objects.push(EventType.event);
4368
+ this.objects.push(5 /* event */);
4518
4369
  this.objects.push(entry);
4519
4370
  this.objects.push(event);
4520
4371
  }
4521
4372
  drain() {
4522
- if (this.drainDisabled)
4523
- return;
4373
+ if (this.drainDisabled) return;
4524
4374
  this.drainDisabled = true;
4525
4375
  let objects = this.objects;
4526
4376
  let listeners = this.animState.listeners;
@@ -4528,59 +4378,48 @@ var spine = (() => {
4528
4378
  let type = objects[i];
4529
4379
  let entry = objects[i + 1];
4530
4380
  switch (type) {
4531
- case EventType.start:
4532
- if (entry.listener && entry.listener.start)
4533
- entry.listener.start(entry);
4381
+ case 0 /* start */:
4382
+ if (entry.listener && entry.listener.start) entry.listener.start(entry);
4534
4383
  for (let ii = 0; ii < listeners.length; ii++) {
4535
4384
  let listener = listeners[ii];
4536
- if (listener.start)
4537
- listener.start(entry);
4385
+ if (listener.start) listener.start(entry);
4538
4386
  }
4539
4387
  break;
4540
- case EventType.interrupt:
4541
- if (entry.listener && entry.listener.interrupt)
4542
- entry.listener.interrupt(entry);
4388
+ case 1 /* interrupt */:
4389
+ if (entry.listener && entry.listener.interrupt) entry.listener.interrupt(entry);
4543
4390
  for (let ii = 0; ii < listeners.length; ii++) {
4544
4391
  let listener = listeners[ii];
4545
- if (listener.interrupt)
4546
- listener.interrupt(entry);
4392
+ if (listener.interrupt) listener.interrupt(entry);
4547
4393
  }
4548
4394
  break;
4549
- case EventType.end:
4550
- if (entry.listener && entry.listener.end)
4551
- entry.listener.end(entry);
4395
+ case 2 /* end */:
4396
+ if (entry.listener && entry.listener.end) entry.listener.end(entry);
4552
4397
  for (let ii = 0; ii < listeners.length; ii++) {
4553
4398
  let listener = listeners[ii];
4554
- if (listener.end)
4555
- listener.end(entry);
4399
+ if (listener.end) listener.end(entry);
4556
4400
  }
4557
- case EventType.dispose:
4558
- if (entry.listener && entry.listener.dispose)
4559
- entry.listener.dispose(entry);
4401
+ // Fall through.
4402
+ case 3 /* dispose */:
4403
+ if (entry.listener && entry.listener.dispose) entry.listener.dispose(entry);
4560
4404
  for (let ii = 0; ii < listeners.length; ii++) {
4561
4405
  let listener = listeners[ii];
4562
- if (listener.dispose)
4563
- listener.dispose(entry);
4406
+ if (listener.dispose) listener.dispose(entry);
4564
4407
  }
4565
4408
  this.animState.trackEntryPool.free(entry);
4566
4409
  break;
4567
- case EventType.complete:
4568
- if (entry.listener && entry.listener.complete)
4569
- entry.listener.complete(entry);
4410
+ case 4 /* complete */:
4411
+ if (entry.listener && entry.listener.complete) entry.listener.complete(entry);
4570
4412
  for (let ii = 0; ii < listeners.length; ii++) {
4571
4413
  let listener = listeners[ii];
4572
- if (listener.complete)
4573
- listener.complete(entry);
4414
+ if (listener.complete) listener.complete(entry);
4574
4415
  }
4575
4416
  break;
4576
- case EventType.event:
4417
+ case 5 /* event */:
4577
4418
  let event = objects[i++ + 2];
4578
- if (entry.listener && entry.listener.event)
4579
- entry.listener.event(entry, event);
4419
+ if (entry.listener && entry.listener.event) entry.listener.event(entry, event);
4580
4420
  for (let ii = 0; ii < listeners.length; ii++) {
4581
4421
  let listener = listeners[ii];
4582
- if (listener.event)
4583
- listener.event(entry, event);
4422
+ if (listener.event) listener.event(entry, event);
4584
4423
  }
4585
4424
  break;
4586
4425
  }
@@ -4631,8 +4470,7 @@ var spine = (() => {
4631
4470
  /** The mix duration to use when no mix duration has been defined between two animations. */
4632
4471
  defaultMix = 0;
4633
4472
  constructor(skeletonData) {
4634
- if (!skeletonData)
4635
- throw new Error("skeletonData cannot be null.");
4473
+ if (!skeletonData) throw new Error("skeletonData cannot be null.");
4636
4474
  this.skeletonData = skeletonData;
4637
4475
  }
4638
4476
  /** Sets a mix duration by animation name.
@@ -4640,21 +4478,17 @@ var spine = (() => {
4640
4478
  * See {@link #setMixWith()}. */
4641
4479
  setMix(fromName, toName, duration) {
4642
4480
  let from = this.skeletonData.findAnimation(fromName);
4643
- if (!from)
4644
- throw new Error("Animation not found: " + fromName);
4481
+ if (!from) throw new Error("Animation not found: " + fromName);
4645
4482
  let to = this.skeletonData.findAnimation(toName);
4646
- if (!to)
4647
- throw new Error("Animation not found: " + toName);
4483
+ if (!to) throw new Error("Animation not found: " + toName);
4648
4484
  this.setMixWith(from, to, duration);
4649
4485
  }
4650
4486
  /** Sets the mix duration when changing from the specified animation to the other.
4651
4487
  *
4652
4488
  * See {@link TrackEntry#mixDuration}. */
4653
4489
  setMixWith(from, to, duration) {
4654
- if (!from)
4655
- throw new Error("from cannot be null.");
4656
- if (!to)
4657
- 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.");
4658
4492
  let key = from.name + "." + to.name;
4659
4493
  this.animationToMixTime[key] = duration;
4660
4494
  }
@@ -4668,13 +4502,13 @@ var spine = (() => {
4668
4502
  };
4669
4503
 
4670
4504
  // spine-core/src/attachments/BoundingBoxAttachment.ts
4671
- var BoundingBoxAttachment = class extends VertexAttachment {
4505
+ var BoundingBoxAttachment = class _BoundingBoxAttachment extends VertexAttachment {
4672
4506
  color = new Color(1, 1, 1, 1);
4673
4507
  constructor(name) {
4674
4508
  super(name);
4675
4509
  }
4676
4510
  copy() {
4677
- let copy = new BoundingBoxAttachment(this.name);
4511
+ let copy = new _BoundingBoxAttachment(this.name);
4678
4512
  this.copyTo(copy);
4679
4513
  copy.color.setFromColor(this.color);
4680
4514
  return copy;
@@ -4682,7 +4516,7 @@ var spine = (() => {
4682
4516
  };
4683
4517
 
4684
4518
  // spine-core/src/attachments/ClippingAttachment.ts
4685
- var ClippingAttachment = class extends VertexAttachment {
4519
+ var ClippingAttachment = class _ClippingAttachment extends VertexAttachment {
4686
4520
  /** Clipping is performed between the clipping polygon's slot and the end slot. Returns null if clipping is done until the end of
4687
4521
  * the skeleton's rendering. */
4688
4522
  endSlot = null;
@@ -4695,7 +4529,7 @@ var spine = (() => {
4695
4529
  super(name);
4696
4530
  }
4697
4531
  copy() {
4698
- let copy = new ClippingAttachment(this.name);
4532
+ let copy = new _ClippingAttachment(this.name);
4699
4533
  this.copyTo(copy);
4700
4534
  copy.endSlot = this.endSlot;
4701
4535
  copy.color.setFromColor(this.color);
@@ -4771,10 +4605,8 @@ var spine = (() => {
4771
4605
  page2.magFilter = Utils.enumValue(TextureFilter, entry[2]);
4772
4606
  };
4773
4607
  pageFields["repeat"] = (page2) => {
4774
- if (entry[1].indexOf("x") != -1)
4775
- page2.uWrap = 10497 /* Repeat */;
4776
- if (entry[1].indexOf("y") != -1)
4777
- 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 */;
4778
4610
  };
4779
4611
  pageFields["pma"] = (page2) => {
4780
4612
  page2.pma = entry[1] == "true";
@@ -4822,45 +4654,37 @@ var spine = (() => {
4822
4654
  while (line && line.trim().length == 0)
4823
4655
  line = reader.readLine();
4824
4656
  while (true) {
4825
- if (!line || line.trim().length == 0)
4826
- break;
4827
- if (reader.readEntry(entry, line) == 0)
4828
- break;
4657
+ if (!line || line.trim().length == 0) break;
4658
+ if (reader.readEntry(entry, line) == 0) break;
4829
4659
  line = reader.readLine();
4830
4660
  }
4831
4661
  let page = null;
4832
4662
  let names = null;
4833
4663
  let values = null;
4834
4664
  while (true) {
4835
- if (line === null)
4836
- break;
4665
+ if (line === null) break;
4837
4666
  if (line.trim().length == 0) {
4838
4667
  page = null;
4839
4668
  line = reader.readLine();
4840
4669
  } else if (!page) {
4841
4670
  page = new TextureAtlasPage(line.trim());
4842
4671
  while (true) {
4843
- if (reader.readEntry(entry, line = reader.readLine()) == 0)
4844
- break;
4672
+ if (reader.readEntry(entry, line = reader.readLine()) == 0) break;
4845
4673
  let field = pageFields[entry[0]];
4846
- if (field)
4847
- field(page);
4674
+ if (field) field(page);
4848
4675
  }
4849
4676
  this.pages.push(page);
4850
4677
  } else {
4851
4678
  let region = new TextureAtlasRegion(page, line);
4852
4679
  while (true) {
4853
4680
  let count = reader.readEntry(entry, line = reader.readLine());
4854
- if (count == 0)
4855
- break;
4681
+ if (count == 0) break;
4856
4682
  let field = regionFields[entry[0]];
4857
4683
  if (field)
4858
4684
  field(region);
4859
4685
  else {
4860
- if (!names)
4861
- names = [];
4862
- if (!values)
4863
- values = [];
4686
+ if (!names) names = [];
4687
+ if (!values) values = [];
4864
4688
  names.push(entry[0]);
4865
4689
  let entryValues = [];
4866
4690
  for (let i = 0; i < count; i++)
@@ -4921,14 +4745,11 @@ var spine = (() => {
4921
4745
  return this.lines[this.index++];
4922
4746
  }
4923
4747
  readEntry(entry, line) {
4924
- if (!line)
4925
- return 0;
4748
+ if (!line) return 0;
4926
4749
  line = line.trim();
4927
- if (line.length == 0)
4928
- return 0;
4750
+ if (line.length == 0) return 0;
4929
4751
  let colon = line.indexOf(":");
4930
- if (colon == -1)
4931
- return 0;
4752
+ if (colon == -1) return 0;
4932
4753
  entry[0] = line.substr(0, colon).trim();
4933
4754
  for (let i = 1, lastMatch = colon + 1; ; i++) {
4934
4755
  let comma = line.indexOf(",", lastMatch);
@@ -4938,8 +4759,7 @@ var spine = (() => {
4938
4759
  }
4939
4760
  entry[i] = line.substr(lastMatch, comma - lastMatch).trim();
4940
4761
  lastMatch = comma + 1;
4941
- if (i == 4)
4942
- return 4;
4762
+ if (i == 4) return 4;
4943
4763
  }
4944
4764
  }
4945
4765
  };
@@ -4987,7 +4807,7 @@ var spine = (() => {
4987
4807
  };
4988
4808
 
4989
4809
  // spine-core/src/attachments/MeshAttachment.ts
4990
- var MeshAttachment = class extends VertexAttachment {
4810
+ var MeshAttachment = class _MeshAttachment extends VertexAttachment {
4991
4811
  region = null;
4992
4812
  /** The name of the texture region for this attachment. */
4993
4813
  path;
@@ -5020,11 +4840,9 @@ var spine = (() => {
5020
4840
  /** Calculates {@link #uvs} using the {@link #regionUVs} and region. Must be called if the region, the region's properties, or
5021
4841
  * the {@link #regionUVs} are changed. */
5022
4842
  updateRegion() {
5023
- if (!this.region)
5024
- throw new Error("Region not set.");
4843
+ if (!this.region) throw new Error("Region not set.");
5025
4844
  let regionUVs = this.regionUVs;
5026
- if (!this.uvs || this.uvs.length != regionUVs.length)
5027
- this.uvs = Utils.newFloatArray(regionUVs.length);
4845
+ if (!this.uvs || this.uvs.length != regionUVs.length) this.uvs = Utils.newFloatArray(regionUVs.length);
5028
4846
  let uvs = this.uvs;
5029
4847
  let n = this.uvs.length;
5030
4848
  let u = this.region.u, v = this.region.v, width = 0, height = 0;
@@ -5099,9 +4917,8 @@ var spine = (() => {
5099
4917
  }
5100
4918
  }
5101
4919
  copy() {
5102
- if (this.parentMesh)
5103
- return this.newLinkedMesh();
5104
- let copy = new MeshAttachment(this.name, this.path);
4920
+ if (this.parentMesh) return this.newLinkedMesh();
4921
+ let copy = new _MeshAttachment(this.name, this.path);
5105
4922
  copy.region = this.region;
5106
4923
  copy.color.setFromColor(this.color);
5107
4924
  this.copyTo(copy);
@@ -5122,25 +4939,23 @@ var spine = (() => {
5122
4939
  return copy;
5123
4940
  }
5124
4941
  computeWorldVertices(slot, start, count, worldVertices, offset, stride) {
5125
- if (this.sequence != null)
5126
- this.sequence.apply(slot, this);
4942
+ if (this.sequence != null) this.sequence.apply(slot, this);
5127
4943
  super.computeWorldVertices(slot, start, count, worldVertices, offset, stride);
5128
4944
  }
5129
4945
  /** Returns a new mesh with the {@link #parentMesh} set to this mesh's parent mesh, if any, else to this mesh. **/
5130
4946
  newLinkedMesh() {
5131
- let copy = new MeshAttachment(this.name, this.path);
4947
+ let copy = new _MeshAttachment(this.name, this.path);
5132
4948
  copy.region = this.region;
5133
4949
  copy.color.setFromColor(this.color);
5134
4950
  copy.timelineAttachment = this.timelineAttachment;
5135
4951
  copy.setParentMesh(this.parentMesh ? this.parentMesh : this);
5136
- if (copy.region != null)
5137
- copy.updateRegion();
4952
+ if (copy.region != null) copy.updateRegion();
5138
4953
  return copy;
5139
4954
  }
5140
4955
  };
5141
4956
 
5142
4957
  // spine-core/src/attachments/PathAttachment.ts
5143
- var PathAttachment = class extends VertexAttachment {
4958
+ var PathAttachment = class _PathAttachment extends VertexAttachment {
5144
4959
  /** The lengths along the path in the setup pose from the start of the path to the end of each Bezier curve. */
5145
4960
  lengths = [];
5146
4961
  /** If true, the start and end knots are connected. */
@@ -5155,7 +4970,7 @@ var spine = (() => {
5155
4970
  super(name);
5156
4971
  }
5157
4972
  copy() {
5158
- let copy = new PathAttachment(this.name);
4973
+ let copy = new _PathAttachment(this.name);
5159
4974
  this.copyTo(copy);
5160
4975
  copy.lengths = new Array(this.lengths.length);
5161
4976
  Utils.arrayCopy(this.lengths, 0, copy.lengths, 0, this.lengths.length);
@@ -5167,7 +4982,7 @@ var spine = (() => {
5167
4982
  };
5168
4983
 
5169
4984
  // spine-core/src/attachments/PointAttachment.ts
5170
- var PointAttachment = class extends VertexAttachment {
4985
+ var PointAttachment = class _PointAttachment extends VertexAttachment {
5171
4986
  x = 0;
5172
4987
  y = 0;
5173
4988
  rotation = 0;
@@ -5189,7 +5004,7 @@ var spine = (() => {
5189
5004
  return MathUtils.atan2Deg(y, x);
5190
5005
  }
5191
5006
  copy() {
5192
- let copy = new PointAttachment(this.name);
5007
+ let copy = new _PointAttachment(this.name);
5193
5008
  copy.x = this.x;
5194
5009
  copy.y = this.y;
5195
5010
  copy.rotation = this.rotation;
@@ -5199,7 +5014,7 @@ var spine = (() => {
5199
5014
  };
5200
5015
 
5201
5016
  // spine-core/src/attachments/RegionAttachment.ts
5202
- var _RegionAttachment = class extends Attachment {
5017
+ var RegionAttachment = class _RegionAttachment extends Attachment {
5203
5018
  /** The local x translation. */
5204
5019
  x = 0;
5205
5020
  /** The local y translation. */
@@ -5232,8 +5047,7 @@ var spine = (() => {
5232
5047
  }
5233
5048
  /** Calculates the {@link #offset} using the region settings. Must be called after changing region settings. */
5234
5049
  updateRegion() {
5235
- if (!this.region)
5236
- throw new Error("Region not set.");
5050
+ if (!this.region) throw new Error("Region not set.");
5237
5051
  let region = this.region;
5238
5052
  let uvs = this.uvs;
5239
5053
  if (region == null) {
@@ -5346,40 +5160,39 @@ var spine = (() => {
5346
5160
  copy.sequence = this.sequence != null ? this.sequence.copy() : null;
5347
5161
  return copy;
5348
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;
5349
5195
  };
5350
- var RegionAttachment = _RegionAttachment;
5351
- __publicField(RegionAttachment, "X1", 0);
5352
- __publicField(RegionAttachment, "Y1", 1);
5353
- __publicField(RegionAttachment, "C1R", 2);
5354
- __publicField(RegionAttachment, "C1G", 3);
5355
- __publicField(RegionAttachment, "C1B", 4);
5356
- __publicField(RegionAttachment, "C1A", 5);
5357
- __publicField(RegionAttachment, "U1", 6);
5358
- __publicField(RegionAttachment, "V1", 7);
5359
- __publicField(RegionAttachment, "X2", 8);
5360
- __publicField(RegionAttachment, "Y2", 9);
5361
- __publicField(RegionAttachment, "C2R", 10);
5362
- __publicField(RegionAttachment, "C2G", 11);
5363
- __publicField(RegionAttachment, "C2B", 12);
5364
- __publicField(RegionAttachment, "C2A", 13);
5365
- __publicField(RegionAttachment, "U2", 14);
5366
- __publicField(RegionAttachment, "V2", 15);
5367
- __publicField(RegionAttachment, "X3", 16);
5368
- __publicField(RegionAttachment, "Y3", 17);
5369
- __publicField(RegionAttachment, "C3R", 18);
5370
- __publicField(RegionAttachment, "C3G", 19);
5371
- __publicField(RegionAttachment, "C3B", 20);
5372
- __publicField(RegionAttachment, "C3A", 21);
5373
- __publicField(RegionAttachment, "U3", 22);
5374
- __publicField(RegionAttachment, "V3", 23);
5375
- __publicField(RegionAttachment, "X4", 24);
5376
- __publicField(RegionAttachment, "Y4", 25);
5377
- __publicField(RegionAttachment, "C4R", 26);
5378
- __publicField(RegionAttachment, "C4G", 27);
5379
- __publicField(RegionAttachment, "C4B", 28);
5380
- __publicField(RegionAttachment, "C4A", 29);
5381
- __publicField(RegionAttachment, "U4", 30);
5382
- __publicField(RegionAttachment, "V4", 31);
5383
5196
 
5384
5197
  // spine-core/src/AtlasAttachmentLoader.ts
5385
5198
  var AtlasAttachmentLoader = class {
@@ -5392,8 +5205,7 @@ var spine = (() => {
5392
5205
  for (let i = 0, n = regions.length; i < n; i++) {
5393
5206
  let path = sequence.getPath(basePath, i);
5394
5207
  let region = this.atlas.findRegion(path);
5395
- if (region == null)
5396
- 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 + ")");
5397
5209
  regions[i] = region;
5398
5210
  }
5399
5211
  }
@@ -5403,8 +5215,7 @@ var spine = (() => {
5403
5215
  this.loadSequence(name, path, sequence);
5404
5216
  } else {
5405
5217
  let region = this.atlas.findRegion(path);
5406
- if (!region)
5407
- 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 + ")");
5408
5219
  attachment.region = region;
5409
5220
  }
5410
5221
  return attachment;
@@ -5415,8 +5226,7 @@ var spine = (() => {
5415
5226
  this.loadSequence(name, path, sequence);
5416
5227
  } else {
5417
5228
  let region = this.atlas.findRegion(path);
5418
- if (!region)
5419
- 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 + ")");
5420
5230
  attachment.region = region;
5421
5231
  }
5422
5232
  return attachment;
@@ -5460,7 +5270,7 @@ var spine = (() => {
5460
5270
  /** The local shearX. */
5461
5271
  shearY = 0;
5462
5272
  /** The transform mode for how parent world transforms affect this bone. */
5463
- inherit = Inherit.Normal;
5273
+ inherit = 0 /* Normal */;
5464
5274
  /** When true, {@link Skeleton#updateWorldTransform()} only updates this bone if the {@link Skeleton#skin} contains this
5465
5275
  * bone.
5466
5276
  * @see Skin#bones */
@@ -5473,10 +5283,8 @@ var spine = (() => {
5473
5283
  /** False if the bone was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */
5474
5284
  visible = false;
5475
5285
  constructor(index, name, parent) {
5476
- if (index < 0)
5477
- throw new Error("index must be >= 0.");
5478
- if (!name)
5479
- 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.");
5480
5288
  this.index = index;
5481
5289
  this.name = name;
5482
5290
  this.parent = parent;
@@ -5546,10 +5354,8 @@ var spine = (() => {
5546
5354
  active = false;
5547
5355
  /** @param parent May be null. */
5548
5356
  constructor(data, skeleton, parent) {
5549
- if (!data)
5550
- throw new Error("data cannot be null.");
5551
- if (!skeleton)
5552
- 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.");
5553
5359
  this.data = data;
5554
5360
  this.skeleton = skeleton;
5555
5361
  this.parent = parent;
@@ -5658,13 +5464,11 @@ var spine = (() => {
5658
5464
  let za = (pa * cos + pb * sin) / this.skeleton.scaleX;
5659
5465
  let zc = (pc * cos + pd * sin) / this.skeleton.scaleY;
5660
5466
  let s = Math.sqrt(za * za + zc * zc);
5661
- if (s > 1e-5)
5662
- s = 1 / s;
5467
+ if (s > 1e-5) s = 1 / s;
5663
5468
  za *= s;
5664
5469
  zc *= s;
5665
5470
  s = Math.sqrt(za * za + zc * zc);
5666
- if (this.inherit == 3 /* NoScale */ && pa * pd - pb * pc < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
5667
- s = -s;
5471
+ if (this.inherit == 3 /* NoScale */ && pa * pd - pb * pc < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0)) s = -s;
5668
5472
  rotation = Math.PI / 2 + Math.atan2(zc, za);
5669
5473
  const zb = Math.cos(rotation) * s;
5670
5474
  const zd = Math.sin(rotation) * s;
@@ -5747,13 +5551,11 @@ var spine = (() => {
5747
5551
  pa = (pa * cos + pb * sin) / this.skeleton.scaleX;
5748
5552
  pc = (pc * cos + pd * sin) / this.skeleton.scaleY;
5749
5553
  let s = Math.sqrt(pa * pa + pc * pc);
5750
- if (s > 1e-5)
5751
- s = 1 / s;
5554
+ if (s > 1e-5) s = 1 / s;
5752
5555
  pa *= s;
5753
5556
  pc *= s;
5754
5557
  s = Math.sqrt(pa * pa + pc * pc);
5755
- if (this.inherit == 3 /* NoScale */ && pid < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
5756
- s = -s;
5558
+ if (this.inherit == 3 /* NoScale */ && pid < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0)) s = -s;
5757
5559
  let r = MathUtils.PI / 2 + Math.atan2(pc, pa);
5758
5560
  pb = Math.cos(r) * s;
5759
5561
  pd = Math.sin(r) * s;
@@ -5815,14 +5617,12 @@ var spine = (() => {
5815
5617
  }
5816
5618
  /** Transforms a point from world coordinates to the parent bone's local coordinates. */
5817
5619
  worldToParent(world) {
5818
- if (world == null)
5819
- throw new Error("world cannot be null.");
5620
+ if (world == null) throw new Error("world cannot be null.");
5820
5621
  return this.parent == null ? world : this.parent.worldToLocal(world);
5821
5622
  }
5822
5623
  /** Transforms a point from the parent bone's coordinates to world coordinates. */
5823
5624
  parentToWorld(world) {
5824
- if (world == null)
5825
- throw new Error("world cannot be null.");
5625
+ if (world == null) throw new Error("world cannot be null.");
5826
5626
  return this.parent == null ? world : this.parent.localToWorld(world);
5827
5627
  }
5828
5628
  /** Transforms a world rotation to a local rotation. */
@@ -5866,6 +5666,8 @@ var spine = (() => {
5866
5666
  textureLoader;
5867
5667
  downloader;
5868
5668
  assets = {};
5669
+ assetsRefCount = {};
5670
+ assetsLoaded = {};
5869
5671
  errors = {};
5870
5672
  toLoad = 0;
5871
5673
  loaded = 0;
@@ -5882,24 +5684,21 @@ var spine = (() => {
5882
5684
  this.toLoad--;
5883
5685
  this.loaded++;
5884
5686
  this.assets[path] = asset;
5885
- if (callback)
5886
- callback(path, asset);
5687
+ this.assetsRefCount[path] = (this.assetsRefCount[path] || 0) + 1;
5688
+ if (callback) callback(path, asset);
5887
5689
  }
5888
5690
  error(callback, path, message) {
5889
5691
  this.toLoad--;
5890
5692
  this.loaded++;
5891
5693
  this.errors[path] = message;
5892
- if (callback)
5893
- callback(path, message);
5694
+ if (callback) callback(path, message);
5894
5695
  }
5895
5696
  loadAll() {
5896
5697
  let promise = new Promise((resolve, reject) => {
5897
5698
  let check = () => {
5898
5699
  if (this.isLoadingComplete()) {
5899
- if (this.hasErrors())
5900
- reject(this.errors);
5901
- else
5902
- resolve(this);
5700
+ if (this.hasErrors()) reject(this.errors);
5701
+ else resolve(this);
5903
5702
  return;
5904
5703
  }
5905
5704
  requestAnimationFrame(check);
@@ -5915,10 +5714,16 @@ var spine = (() => {
5915
5714
  }, error = () => {
5916
5715
  }) {
5917
5716
  path = this.start(path);
5918
- this.downloader.downloadBinary(path, (data) => {
5919
- this.success(success, path, data);
5920
- }, (status, responseText) => {
5921
- 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
+ });
5922
5727
  });
5923
5728
  }
5924
5729
  loadText(path, success = () => {
@@ -5935,43 +5740,69 @@ var spine = (() => {
5935
5740
  }, error = () => {
5936
5741
  }) {
5937
5742
  path = this.start(path);
5938
- this.downloader.downloadJson(path, (data) => {
5939
- this.success(success, path, data);
5940
- }, (status, responseText) => {
5941
- 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
+ });
5942
5753
  });
5943
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
+ }
5944
5765
  loadTexture(path, success = () => {
5945
5766
  }, error = () => {
5946
5767
  }) {
5947
5768
  path = this.start(path);
5948
- let isBrowser = !!(typeof window !== "undefined" && typeof navigator !== "undefined" && window.document);
5949
- let isWebWorker = !isBrowser;
5950
- if (isWebWorker) {
5951
- fetch(path, { mode: "cors" }).then((response) => {
5952
- if (response.ok)
5953
- return response.blob();
5954
- this.error(error, path, `Couldn't load image: ${path}`);
5955
- return null;
5956
- }).then((blob) => {
5957
- return blob ? createImageBitmap(blob, { premultiplyAlpha: "none", colorSpaceConversion: "none" }) : null;
5958
- }).then((bitmap) => {
5959
- if (bitmap)
5960
- this.success(success, path, this.textureLoader(bitmap));
5961
- });
5962
- } else {
5963
- let image = new Image();
5964
- image.crossOrigin = "anonymous";
5965
- image.onload = () => {
5966
- this.success(success, path, this.textureLoader(image));
5967
- };
5968
- image.onerror = () => {
5969
- this.error(error, path, `Couldn't load image: ${path}`);
5970
- };
5971
- if (this.downloader.rawDataUris[path])
5972
- path = this.downloader.rawDataUris[path];
5973
- image.src = path;
5974
- }
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
+ });
5975
5806
  }
5976
5807
  loadTextureAtlas(path, success = () => {
5977
5808
  }, error = () => {
@@ -5979,32 +5810,113 @@ var spine = (() => {
5979
5810
  let index = path.lastIndexOf("/");
5980
5811
  let parent = index >= 0 ? path.substring(0, index + 1) : "";
5981
5812
  path = this.start(path);
5982
- this.downloader.downloadText(path, (atlasText) => {
5983
- try {
5984
- let atlas = new TextureAtlas(atlasText);
5985
- let toLoad = atlas.pages.length, abort = false;
5986
- for (let page of atlas.pages) {
5987
- this.loadTexture(
5988
- !fileAlias ? parent + page.name : fileAlias[page.name],
5989
- (imagePath, texture) => {
5990
- if (!abort) {
5991
- page.setTexture(texture);
5992
- if (--toLoad == 0)
5993
- 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;
5994
5838
  }
5995
- },
5996
- (imagePath, message) => {
5997
- if (!abort)
5998
- this.error(error, path, `Couldn't load texture atlas ${path} page image: ${imagePath}`);
5999
- abort = true;
6000
- }
6001
- );
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);
6002
5845
  }
6003
- } catch (e) {
6004
- this.error(error, path, `Couldn't parse texture atlas ${path}: ${e.message}`);
6005
- }
6006
- }, (status, responseText) => {
6007
- 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
+ );
6008
5920
  });
6009
5921
  }
6010
5922
  get(path) {
@@ -6013,26 +5925,27 @@ var spine = (() => {
6013
5925
  require(path) {
6014
5926
  path = this.pathPrefix + path;
6015
5927
  let asset = this.assets[path];
6016
- if (asset)
6017
- return asset;
5928
+ if (asset) return asset;
6018
5929
  let error = this.errors[path];
6019
5930
  throw Error("Asset not found: " + path + (error ? "\n" + error : ""));
6020
5931
  }
6021
5932
  remove(path) {
6022
5933
  path = this.pathPrefix + path;
6023
5934
  let asset = this.assets[path];
6024
- if (asset.dispose)
6025
- asset.dispose();
5935
+ if (asset.dispose) asset.dispose();
6026
5936
  delete this.assets[path];
5937
+ delete this.assetsRefCount[path];
5938
+ delete this.assetsLoaded[path];
6027
5939
  return asset;
6028
5940
  }
6029
5941
  removeAll() {
6030
- for (let key in this.assets) {
6031
- let asset = this.assets[key];
6032
- if (asset.dispose)
6033
- asset.dispose();
5942
+ for (let path in this.assets) {
5943
+ let asset = this.assets[path];
5944
+ if (asset.dispose) asset.dispose();
6034
5945
  }
6035
5946
  this.assets = {};
5947
+ this.assetsLoaded = {};
5948
+ this.assetsRefCount = {};
6036
5949
  }
6037
5950
  isLoadingComplete() {
6038
5951
  return this.toLoad == 0;
@@ -6046,6 +5959,12 @@ var spine = (() => {
6046
5959
  dispose() {
6047
5960
  this.removeAll();
6048
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
+ }
6049
5968
  hasErrors() {
6050
5969
  return Object.keys(this.errors).length > 0;
6051
5970
  }
@@ -6082,18 +6001,16 @@ var spine = (() => {
6082
6001
  throw new Error("Not a data URI.");
6083
6002
  }
6084
6003
  let base64Idx = dataUri.indexOf("base64,");
6085
- if (base64Idx == -1)
6086
- throw new Error("Not a binary data URI.");
6004
+ if (base64Idx == -1) throw new Error("Not a binary data URI.");
6087
6005
  base64Idx += "base64,".length;
6088
6006
  return this.base64ToUint8Array(dataUri.substr(base64Idx));
6089
6007
  }
6090
6008
  downloadText(url, success, error) {
6091
- if (this.start(url, success, error))
6092
- return;
6093
- if (this.rawDataUris[url]) {
6009
+ if (this.start(url, success, error)) return;
6010
+ const rawDataUri = this.rawDataUris[url];
6011
+ if (rawDataUri && !rawDataUri.includes(".")) {
6094
6012
  try {
6095
- let dataUri = this.rawDataUris[url];
6096
- this.finish(url, 200, this.dataUriToString(dataUri));
6013
+ this.finish(url, 200, this.dataUriToString(rawDataUri));
6097
6014
  } catch (e) {
6098
6015
  this.finish(url, 400, JSON.stringify(e));
6099
6016
  }
@@ -6101,7 +6018,7 @@ var spine = (() => {
6101
6018
  }
6102
6019
  let request = new XMLHttpRequest();
6103
6020
  request.overrideMimeType("text/html");
6104
- request.open("GET", url, true);
6021
+ request.open("GET", rawDataUri ? rawDataUri : url, true);
6105
6022
  let done = () => {
6106
6023
  this.finish(url, request.status, request.responseText);
6107
6024
  };
@@ -6115,19 +6032,18 @@ var spine = (() => {
6115
6032
  }, error);
6116
6033
  }
6117
6034
  downloadBinary(url, success, error) {
6118
- if (this.start(url, success, error))
6119
- return;
6120
- if (this.rawDataUris[url]) {
6035
+ if (this.start(url, success, error)) return;
6036
+ const rawDataUri = this.rawDataUris[url];
6037
+ if (rawDataUri && !rawDataUri.includes(".")) {
6121
6038
  try {
6122
- let dataUri = this.rawDataUris[url];
6123
- this.finish(url, 200, this.dataUriToUint8Array(dataUri));
6039
+ this.finish(url, 200, this.dataUriToUint8Array(rawDataUri));
6124
6040
  } catch (e) {
6125
6041
  this.finish(url, 400, JSON.stringify(e));
6126
6042
  }
6127
6043
  return;
6128
6044
  }
6129
6045
  let request = new XMLHttpRequest();
6130
- request.open("GET", url, true);
6046
+ request.open("GET", rawDataUri ? rawDataUri : url, true);
6131
6047
  request.responseType = "arraybuffer";
6132
6048
  let onerror = () => {
6133
6049
  this.finish(url, request.status, request.response);
@@ -6144,8 +6060,7 @@ var spine = (() => {
6144
6060
  start(url, success, error) {
6145
6061
  let callbacks = this.callbacks[url];
6146
6062
  try {
6147
- if (callbacks)
6148
- return true;
6063
+ if (callbacks) return true;
6149
6064
  this.callbacks[url] = callbacks = [];
6150
6065
  } finally {
6151
6066
  callbacks.push(success, error);
@@ -6170,8 +6085,7 @@ var spine = (() => {
6170
6085
  volume = 0;
6171
6086
  balance = 0;
6172
6087
  constructor(time, data) {
6173
- if (!data)
6174
- throw new Error("data cannot be null.");
6088
+ if (!data) throw new Error("data cannot be null.");
6175
6089
  this.time = time;
6176
6090
  this.data = data;
6177
6091
  }
@@ -6212,21 +6126,17 @@ var spine = (() => {
6212
6126
  softness = 0;
6213
6127
  active = false;
6214
6128
  constructor(data, skeleton) {
6215
- if (!data)
6216
- throw new Error("data cannot be null.");
6217
- if (!skeleton)
6218
- 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.");
6219
6131
  this.data = data;
6220
6132
  this.bones = new Array();
6221
6133
  for (let i = 0; i < data.bones.length; i++) {
6222
6134
  let bone = skeleton.findBone(data.bones[i].name);
6223
- if (!bone)
6224
- 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}`);
6225
6136
  this.bones.push(bone);
6226
6137
  }
6227
6138
  let target = skeleton.findBone(data.target.name);
6228
- if (!target)
6229
- throw new Error(`Couldn't find bone ${data.target.name}`);
6139
+ if (!target) throw new Error(`Couldn't find bone ${data.target.name}`);
6230
6140
  this.target = target;
6231
6141
  this.mix = data.mix;
6232
6142
  this.softness = data.softness;
@@ -6246,8 +6156,7 @@ var spine = (() => {
6246
6156
  this.stretch = data.stretch;
6247
6157
  }
6248
6158
  update(physics) {
6249
- if (this.mix == 0)
6250
- return;
6159
+ if (this.mix == 0) return;
6251
6160
  let target = this.target;
6252
6161
  let bones = this.bones;
6253
6162
  switch (bones.length) {
@@ -6262,8 +6171,7 @@ var spine = (() => {
6262
6171
  /** Applies 1 bone IK. The target is specified in the world coordinate system. */
6263
6172
  apply1(bone, targetX, targetY, compress, stretch, uniform, alpha) {
6264
6173
  let p = bone.parent;
6265
- if (!p)
6266
- throw new Error("IK bone must have parent.");
6174
+ if (!p) throw new Error("IK bone must have parent.");
6267
6175
  let pa = p.a, pb = p.b, pc = p.c, pd = p.d;
6268
6176
  let rotationIK = -bone.ashearX - bone.arotation, tx = 0, ty = 0;
6269
6177
  switch (bone.inherit) {
@@ -6278,6 +6186,7 @@ var spine = (() => {
6278
6186
  pb = -sc * s * bone.skeleton.scaleX;
6279
6187
  pd = sa * s * bone.skeleton.scaleY;
6280
6188
  rotationIK += Math.atan2(sc, sa) * MathUtils.radDeg;
6189
+ // Fall through
6281
6190
  default:
6282
6191
  let x = targetX - p.worldX, y = targetY - p.worldY;
6283
6192
  let d = pa * pd - pb * pc;
@@ -6290,8 +6199,7 @@ var spine = (() => {
6290
6199
  }
6291
6200
  }
6292
6201
  rotationIK += Math.atan2(ty, tx) * MathUtils.radDeg;
6293
- if (bone.ascaleX < 0)
6294
- rotationIK += 180;
6202
+ if (bone.ascaleX < 0) rotationIK += 180;
6295
6203
  if (rotationIK > 180)
6296
6204
  rotationIK -= 360;
6297
6205
  else if (rotationIK < -180)
@@ -6310,8 +6218,7 @@ var spine = (() => {
6310
6218
  if (compress && dd < b * b || stretch && dd > b * b) {
6311
6219
  const s = (Math.sqrt(dd) / b - 1) * alpha + 1;
6312
6220
  sx *= s;
6313
- if (uniform)
6314
- sy *= s;
6221
+ if (uniform) sy *= s;
6315
6222
  }
6316
6223
  }
6317
6224
  }
@@ -6328,8 +6235,7 @@ var spine = (() => {
6328
6235
  /** Applies 2 bone IK. The target is specified in the world coordinate system.
6329
6236
  * @param child A direct descendant of the parent bone. */
6330
6237
  apply2(parent, child, targetX, targetY, bendDir, stretch, uniform, softness, alpha) {
6331
- if (parent.inherit != 0 /* Normal */ || child.inherit != 0 /* Normal */)
6332
- return;
6238
+ if (parent.inherit != 0 /* Normal */ || child.inherit != 0 /* Normal */) return;
6333
6239
  let px = parent.ax, py = parent.ay, psx = parent.ascaleX, psy = parent.ascaleY, sx = psx, sy = psy, csx = child.ascaleX;
6334
6240
  let os1 = 0, os2 = 0, s2 = 0;
6335
6241
  if (psx < 0) {
@@ -6361,8 +6267,7 @@ var spine = (() => {
6361
6267
  cwy = c * cx + d * cy + parent.worldY;
6362
6268
  }
6363
6269
  let pp = parent.parent;
6364
- if (!pp)
6365
- throw new Error("IK parent must itself have a parent.");
6270
+ if (!pp) throw new Error("IK parent must itself have a parent.");
6366
6271
  a = pp.a;
6367
6272
  b = pp.b;
6368
6273
  c = pp.c;
@@ -6404,8 +6309,7 @@ var spine = (() => {
6404
6309
  if (stretch) {
6405
6310
  a = (Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1;
6406
6311
  sx *= a;
6407
- if (uniform)
6408
- sy *= a;
6312
+ if (uniform) sy *= a;
6409
6313
  }
6410
6314
  } else
6411
6315
  a2 = Math.acos(cos) * bendDir;
@@ -6421,8 +6325,7 @@ var spine = (() => {
6421
6325
  d = c1 * c1 - 4 * c2 * c;
6422
6326
  if (d >= 0) {
6423
6327
  let q = Math.sqrt(d);
6424
- if (c1 < 0)
6425
- q = -q;
6328
+ if (c1 < 0) q = -q;
6426
6329
  q = -(c1 + q) * 0.5;
6427
6330
  let r0 = q / c2, r1 = c / q;
6428
6331
  let r = Math.abs(r0) < Math.abs(r1) ? r0 : r1;
@@ -6491,10 +6394,8 @@ var spine = (() => {
6491
6394
  this._target = boneData;
6492
6395
  }
6493
6396
  get target() {
6494
- if (!this._target)
6495
- throw new Error("BoneData not set.");
6496
- else
6497
- return this._target;
6397
+ if (!this._target) throw new Error("BoneData not set.");
6398
+ else return this._target;
6498
6399
  }
6499
6400
  /** Controls the bend direction of the IK bones, either 1 or -1. */
6500
6401
  bendDirection = 0;
@@ -6525,17 +6426,15 @@ var spine = (() => {
6525
6426
  this._target = slotData;
6526
6427
  }
6527
6428
  get target() {
6528
- if (!this._target)
6529
- throw new Error("SlotData not set.");
6530
- else
6531
- return this._target;
6429
+ if (!this._target) throw new Error("SlotData not set.");
6430
+ else return this._target;
6532
6431
  }
6533
6432
  /** The mode for positioning the first bone on the path. */
6534
- positionMode = PositionMode.Fixed;
6433
+ positionMode = 0 /* Fixed */;
6535
6434
  /** The mode for positioning the bones after the first bone on the path. */
6536
- spacingMode = SpacingMode.Fixed;
6435
+ spacingMode = 1 /* Fixed */;
6537
6436
  /** The mode for adjusting the rotation of the bones. */
6538
- rotateMode = RotateMode.Chain;
6437
+ rotateMode = 1 /* Chain */;
6539
6438
  /** An offset added to the constrained bone rotation. */
6540
6439
  offsetRotation = 0;
6541
6440
  /** The position along the path. */
@@ -6569,7 +6468,11 @@ var spine = (() => {
6569
6468
  })(RotateMode || {});
6570
6469
 
6571
6470
  // spine-core/src/PathConstraint.ts
6572
- 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;
6573
6476
  /** The path constraint's setup pose data. */
6574
6477
  data;
6575
6478
  /** The bones that will be modified by this path constraint. */
@@ -6591,21 +6494,17 @@ var spine = (() => {
6591
6494
  segments = new Array();
6592
6495
  active = false;
6593
6496
  constructor(data, skeleton) {
6594
- if (!data)
6595
- throw new Error("data cannot be null.");
6596
- if (!skeleton)
6597
- 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.");
6598
6499
  this.data = data;
6599
6500
  this.bones = new Array();
6600
6501
  for (let i = 0, n = data.bones.length; i < n; i++) {
6601
6502
  let bone = skeleton.findBone(data.bones[i].name);
6602
- if (!bone)
6603
- 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}.`);
6604
6504
  this.bones.push(bone);
6605
6505
  }
6606
6506
  let target = skeleton.findSlot(data.target.name);
6607
- if (!target)
6608
- 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}`);
6609
6508
  this.target = target;
6610
6509
  this.position = data.position;
6611
6510
  this.spacing = data.spacing;
@@ -6626,11 +6525,9 @@ var spine = (() => {
6626
6525
  }
6627
6526
  update(physics) {
6628
6527
  let attachment = this.target.getAttachment();
6629
- if (!(attachment instanceof PathAttachment))
6630
- return;
6528
+ if (!(attachment instanceof PathAttachment)) return;
6631
6529
  let mixRotate = this.mixRotate, mixX = this.mixX, mixY = this.mixY;
6632
- if (mixRotate == 0 && mixX == 0 && mixY == 0)
6633
- return;
6530
+ if (mixRotate == 0 && mixX == 0 && mixY == 0) return;
6634
6531
  let data = this.data;
6635
6532
  let tangents = data.rotateMode == 0 /* Tangent */, scale = data.rotateMode == 2 /* ChainScale */;
6636
6533
  let bones = this.bones;
@@ -6655,14 +6552,12 @@ var spine = (() => {
6655
6552
  let bone = bones[i];
6656
6553
  let setupLength = bone.data.length;
6657
6554
  if (setupLength < _PathConstraint.epsilon) {
6658
- if (scale)
6659
- lengths[i] = 0;
6555
+ if (scale) lengths[i] = 0;
6660
6556
  spaces[++i] = spacing;
6661
6557
  } else {
6662
6558
  let x = setupLength * bone.a, y = setupLength * bone.c;
6663
6559
  let length = Math.sqrt(x * x + y * y);
6664
- if (scale)
6665
- lengths[i] = length;
6560
+ if (scale) lengths[i] = length;
6666
6561
  spaces[++i] = length;
6667
6562
  sum += length;
6668
6563
  }
@@ -6679,14 +6574,12 @@ var spine = (() => {
6679
6574
  let bone = bones[i];
6680
6575
  let setupLength = bone.data.length;
6681
6576
  if (setupLength < _PathConstraint.epsilon) {
6682
- if (scale)
6683
- lengths[i] = 0;
6577
+ if (scale) lengths[i] = 0;
6684
6578
  spaces[++i] = spacing;
6685
6579
  } else {
6686
6580
  let x = setupLength * bone.a, y = setupLength * bone.c;
6687
6581
  let length = Math.sqrt(x * x + y * y);
6688
- if (scale)
6689
- lengths[i] = length;
6582
+ if (scale) lengths[i] = length;
6690
6583
  spaces[++i] = (lengthSpacing ? setupLength + spacing : spacing) * length / setupLength;
6691
6584
  }
6692
6585
  }
@@ -6759,8 +6652,7 @@ var spine = (() => {
6759
6652
  let lengths = path.lengths;
6760
6653
  curveCount -= closed2 ? 1 : 2;
6761
6654
  let pathLength2 = lengths[curveCount];
6762
- if (this.data.positionMode == 1 /* Percent */)
6763
- position *= pathLength2;
6655
+ if (this.data.positionMode == 1 /* Percent */) position *= pathLength2;
6764
6656
  let multiplier2;
6765
6657
  switch (this.data.spacingMode) {
6766
6658
  case 2 /* Percent */:
@@ -6779,8 +6671,7 @@ var spine = (() => {
6779
6671
  let p = position;
6780
6672
  if (closed2) {
6781
6673
  p %= pathLength2;
6782
- if (p < 0)
6783
- p += pathLength2;
6674
+ if (p < 0) p += pathLength2;
6784
6675
  curve = 0;
6785
6676
  } else if (p < 0) {
6786
6677
  if (prevCurve != _PathConstraint.BEFORE) {
@@ -6799,8 +6690,7 @@ var spine = (() => {
6799
6690
  }
6800
6691
  for (; ; curve++) {
6801
6692
  let length = lengths[curve];
6802
- if (p > length)
6803
- continue;
6693
+ if (p > length) continue;
6804
6694
  if (curve == 0)
6805
6695
  p /= length;
6806
6696
  else {
@@ -6882,8 +6772,7 @@ var spine = (() => {
6882
6772
  x1 = x2;
6883
6773
  y1 = y2;
6884
6774
  }
6885
- if (this.data.positionMode == 1 /* Percent */)
6886
- position *= pathLength;
6775
+ if (this.data.positionMode == 1 /* Percent */) position *= pathLength;
6887
6776
  let multiplier;
6888
6777
  switch (this.data.spacingMode) {
6889
6778
  case 2 /* Percent */:
@@ -6903,8 +6792,7 @@ var spine = (() => {
6903
6792
  let p = position;
6904
6793
  if (closed2) {
6905
6794
  p %= pathLength;
6906
- if (p < 0)
6907
- p += pathLength;
6795
+ if (p < 0) p += pathLength;
6908
6796
  curve = 0;
6909
6797
  } else if (p < 0) {
6910
6798
  this.addBeforePosition(p, world, 0, out, o);
@@ -6915,8 +6803,7 @@ var spine = (() => {
6915
6803
  }
6916
6804
  for (; ; curve++) {
6917
6805
  let length = curves[curve];
6918
- if (p > length)
6919
- continue;
6806
+ if (p > length) continue;
6920
6807
  if (curve == 0)
6921
6808
  p /= length;
6922
6809
  else {
@@ -6967,8 +6854,7 @@ var spine = (() => {
6967
6854
  p *= curveLength;
6968
6855
  for (; ; segment++) {
6969
6856
  let length = segments[segment];
6970
- if (p > length)
6971
- continue;
6857
+ if (p > length) continue;
6972
6858
  if (segment == 0)
6973
6859
  p /= length;
6974
6860
  else {
@@ -7013,11 +6899,6 @@ var spine = (() => {
7013
6899
  }
7014
6900
  }
7015
6901
  };
7016
- var PathConstraint = _PathConstraint;
7017
- __publicField(PathConstraint, "NONE", -1);
7018
- __publicField(PathConstraint, "BEFORE", -2);
7019
- __publicField(PathConstraint, "AFTER", -3);
7020
- __publicField(PathConstraint, "epsilon", 1e-5);
7021
6902
 
7022
6903
  // spine-core/src/PhysicsConstraint.ts
7023
6904
  var PhysicsConstraint = class {
@@ -7028,10 +6909,8 @@ var spine = (() => {
7028
6909
  this._bone = bone;
7029
6910
  }
7030
6911
  get bone() {
7031
- if (!this._bone)
7032
- throw new Error("Bone not set.");
7033
- else
7034
- return this._bone;
6912
+ if (!this._bone) throw new Error("Bone not set.");
6913
+ else return this._bone;
7035
6914
  }
7036
6915
  inertia = 0;
7037
6916
  strength = 0;
@@ -7100,8 +6979,7 @@ var spine = (() => {
7100
6979
  /** Applies the constraint to the constrained bones. */
7101
6980
  update(physics) {
7102
6981
  const mix = this.mix;
7103
- if (mix == 0)
7104
- return;
6982
+ if (mix == 0) return;
7105
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;
7106
6984
  const bone = this.bone;
7107
6985
  const l = bone.data.length;
@@ -7110,6 +6988,7 @@ var spine = (() => {
7110
6988
  return;
7111
6989
  case 1 /* reset */:
7112
6990
  this.reset();
6991
+ // Fall through.
7113
6992
  case 2 /* update */:
7114
6993
  const skeleton = this.skeleton;
7115
6994
  const delta = Math.max(this.skeleton.time - this.lastTime, 0);
@@ -7152,10 +7031,8 @@ var spine = (() => {
7152
7031
  a -= t;
7153
7032
  } while (a >= t);
7154
7033
  }
7155
- if (x)
7156
- bone.worldX += this.xOffset * mix * this.data.x;
7157
- if (y)
7158
- 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;
7159
7036
  }
7160
7037
  if (rotateOrShearX || scaleX) {
7161
7038
  let ca = Math.atan2(bone.c, bone.a), c = 0, s = 0, mr = 0;
@@ -7177,20 +7054,17 @@ var spine = (() => {
7177
7054
  s = Math.sin(r);
7178
7055
  if (scaleX) {
7179
7056
  r = l * bone.getWorldScaleX();
7180
- if (r > 0)
7181
- this.scaleOffset += (dx * c + dy * s) * i / r;
7057
+ if (r > 0) this.scaleOffset += (dx * c + dy * s) * i / r;
7182
7058
  }
7183
7059
  } else {
7184
7060
  c = Math.cos(ca);
7185
7061
  s = Math.sin(ca);
7186
7062
  const r = l * bone.getWorldScaleX();
7187
- if (r > 0)
7188
- this.scaleOffset += (dx * c + dy * s) * i / r;
7063
+ if (r > 0) this.scaleOffset += (dx * c + dy * s) * i / r;
7189
7064
  }
7190
7065
  a = this.remaining;
7191
7066
  if (a >= t) {
7192
- if (d == -1)
7193
- d = Math.pow(this.damping, 60 * t);
7067
+ if (d == -1) d = Math.pow(this.damping, 60 * t);
7194
7068
  const m = this.massInverse * t, e = this.strength, w = this.wind, g = Skeleton.yDown ? -this.gravity : this.gravity, h = l / f;
7195
7069
  while (true) {
7196
7070
  a -= t;
@@ -7203,8 +7077,7 @@ var spine = (() => {
7203
7077
  this.rotateVelocity -= ((w * s + g * c) * h + this.rotateOffset * e) * m;
7204
7078
  this.rotateOffset += this.rotateVelocity * t;
7205
7079
  this.rotateVelocity *= d;
7206
- if (a < t)
7207
- break;
7080
+ if (a < t) break;
7208
7081
  const r = this.rotateOffset * mr + ca;
7209
7082
  c = Math.cos(r);
7210
7083
  s = Math.sin(r);
@@ -7219,10 +7092,8 @@ var spine = (() => {
7219
7092
  this.cy = bone.worldY;
7220
7093
  break;
7221
7094
  case 3 /* pose */:
7222
- if (x)
7223
- bone.worldX += this.xOffset * mix * this.data.x;
7224
- if (y)
7225
- 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;
7226
7097
  }
7227
7098
  if (rotateOrShearX) {
7228
7099
  let o = this.rotateOffset * mix, s = 0, c = 0, a = 0;
@@ -7305,10 +7176,8 @@ var spine = (() => {
7305
7176
  * See {@link VertexAttachment#computeWorldVertices()} and {@link DeformTimeline}. */
7306
7177
  deform = new Array();
7307
7178
  constructor(data, bone) {
7308
- if (!data)
7309
- throw new Error("data cannot be null.");
7310
- if (!bone)
7311
- 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.");
7312
7181
  this.data = data;
7313
7182
  this.bone = bone;
7314
7183
  this.color = new Color();
@@ -7327,8 +7196,7 @@ var spine = (() => {
7327
7196
  * The deform is not cleared if the old attachment has the same {@link VertexAttachment#getTimelineAttachment()} as the
7328
7197
  * specified attachment. */
7329
7198
  setAttachment(attachment) {
7330
- if (this.attachment == attachment)
7331
- return;
7199
+ if (this.attachment == attachment) return;
7332
7200
  if (!(attachment instanceof VertexAttachment) || !(this.attachment instanceof VertexAttachment) || attachment.timelineAttachment != this.attachment.timelineAttachment) {
7333
7201
  this.deform.length = 0;
7334
7202
  }
@@ -7338,8 +7206,7 @@ var spine = (() => {
7338
7206
  /** Sets this slot to the setup pose. */
7339
7207
  setToSetupPose() {
7340
7208
  this.color.setFromColor(this.data.color);
7341
- if (this.darkColor)
7342
- this.darkColor.setFromColor(this.data.darkColor);
7209
+ if (this.darkColor) this.darkColor.setFromColor(this.data.darkColor);
7343
7210
  if (!this.data.attachmentName)
7344
7211
  this.attachment = null;
7345
7212
  else {
@@ -7366,21 +7233,17 @@ var spine = (() => {
7366
7233
  temp = new Vector2();
7367
7234
  active = false;
7368
7235
  constructor(data, skeleton) {
7369
- if (!data)
7370
- throw new Error("data cannot be null.");
7371
- if (!skeleton)
7372
- 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.");
7373
7238
  this.data = data;
7374
7239
  this.bones = new Array();
7375
7240
  for (let i = 0; i < data.bones.length; i++) {
7376
7241
  let bone = skeleton.findBone(data.bones[i].name);
7377
- if (!bone)
7378
- 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}.`);
7379
7243
  this.bones.push(bone);
7380
7244
  }
7381
7245
  let target = skeleton.findBone(data.target.name);
7382
- if (!target)
7383
- 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}.`);
7384
7247
  this.target = target;
7385
7248
  this.mixRotate = data.mixRotate;
7386
7249
  this.mixX = data.mixX;
@@ -7402,8 +7265,7 @@ var spine = (() => {
7402
7265
  this.mixShearY = data.mixShearY;
7403
7266
  }
7404
7267
  update(physics) {
7405
- if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.mixScaleY == 0 && this.mixShearY == 0)
7406
- return;
7268
+ if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.mixScaleY == 0 && this.mixShearY == 0) return;
7407
7269
  if (this.data.local) {
7408
7270
  if (this.data.relative)
7409
7271
  this.applyRelativeLocal();
@@ -7449,15 +7311,13 @@ var spine = (() => {
7449
7311
  }
7450
7312
  if (mixScaleX != 0) {
7451
7313
  let s = Math.sqrt(bone.a * bone.a + bone.c * bone.c);
7452
- if (s != 0)
7453
- 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;
7454
7315
  bone.a *= s;
7455
7316
  bone.c *= s;
7456
7317
  }
7457
7318
  if (mixScaleY != 0) {
7458
7319
  let s = Math.sqrt(bone.b * bone.b + bone.d * bone.d);
7459
- if (s != 0)
7460
- 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;
7461
7321
  bone.b *= s;
7462
7322
  bone.d *= s;
7463
7323
  }
@@ -7539,8 +7399,7 @@ var spine = (() => {
7539
7399
  for (let i = 0, n = bones.length; i < n; i++) {
7540
7400
  let bone = bones[i];
7541
7401
  let rotation = bone.arotation;
7542
- if (mixRotate != 0)
7543
- rotation += (target.arotation - rotation + this.data.offsetRotation) * mixRotate;
7402
+ if (mixRotate != 0) rotation += (target.arotation - rotation + this.data.offsetRotation) * mixRotate;
7544
7403
  let x = bone.ax, y = bone.ay;
7545
7404
  x += (target.ax - x + this.data.offsetX) * mixX;
7546
7405
  y += (target.ay - y + this.data.offsetY) * mixY;
@@ -7550,8 +7409,7 @@ var spine = (() => {
7550
7409
  if (mixScaleY != 0 && scaleY != 0)
7551
7410
  scaleY = (scaleY + (target.ascaleY - scaleY + this.data.offsetScaleY) * mixScaleY) / scaleY;
7552
7411
  let shearY = bone.ashearY;
7553
- if (mixShearY != 0)
7554
- shearY += (target.ashearY - shearY + this.data.offsetShearY) * mixShearY;
7412
+ if (mixShearY != 0) shearY += (target.ashearY - shearY + this.data.offsetShearY) * mixShearY;
7555
7413
  bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
7556
7414
  }
7557
7415
  }
@@ -7573,7 +7431,9 @@ var spine = (() => {
7573
7431
  };
7574
7432
 
7575
7433
  // spine-core/src/Skeleton.ts
7576
- var _Skeleton = class {
7434
+ var Skeleton = class _Skeleton {
7435
+ static quadTriangles = [0, 1, 2, 2, 3, 0];
7436
+ static yDown = false;
7577
7437
  /** The skeleton's setup pose data. */
7578
7438
  data;
7579
7439
  /** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
@@ -7617,8 +7477,7 @@ var spine = (() => {
7617
7477
  * See {@link #update(float)}. */
7618
7478
  time = 0;
7619
7479
  constructor(data) {
7620
- if (!data)
7621
- throw new Error("data cannot be null.");
7480
+ if (!data) throw new Error("data cannot be null.");
7622
7481
  this.data = data;
7623
7482
  this.bones = new Array();
7624
7483
  for (let i = 0; i < data.bones.length; i++) {
@@ -7729,8 +7588,7 @@ var spine = (() => {
7729
7588
  }
7730
7589
  sortIkConstraint(constraint) {
7731
7590
  constraint.active = constraint.target.isActive() && (!constraint.data.skinRequired || this.skin && Utils.contains(this.skin.constraints, constraint.data, true));
7732
- if (!constraint.active)
7733
- return;
7591
+ if (!constraint.active) return;
7734
7592
  let target = constraint.target;
7735
7593
  this.sortBone(target);
7736
7594
  let constrained = constraint.bones;
@@ -7749,20 +7607,17 @@ var spine = (() => {
7749
7607
  }
7750
7608
  sortPathConstraint(constraint) {
7751
7609
  constraint.active = constraint.target.bone.isActive() && (!constraint.data.skinRequired || this.skin && Utils.contains(this.skin.constraints, constraint.data, true));
7752
- if (!constraint.active)
7753
- return;
7610
+ if (!constraint.active) return;
7754
7611
  let slot = constraint.target;
7755
7612
  let slotIndex = slot.data.index;
7756
7613
  let slotBone = slot.bone;
7757
- if (this.skin)
7758
- this.sortPathConstraintAttachment(this.skin, slotIndex, slotBone);
7614
+ if (this.skin) this.sortPathConstraintAttachment(this.skin, slotIndex, slotBone);
7759
7615
  if (this.data.defaultSkin && this.data.defaultSkin != this.skin)
7760
7616
  this.sortPathConstraintAttachment(this.data.defaultSkin, slotIndex, slotBone);
7761
7617
  for (let i = 0, n = this.data.skins.length; i < n; i++)
7762
7618
  this.sortPathConstraintAttachment(this.data.skins[i], slotIndex, slotBone);
7763
7619
  let attachment = slot.getAttachment();
7764
- if (attachment instanceof PathAttachment)
7765
- this.sortPathConstraintAttachmentWith(attachment, slotBone);
7620
+ if (attachment instanceof PathAttachment) this.sortPathConstraintAttachmentWith(attachment, slotBone);
7766
7621
  let constrained = constraint.bones;
7767
7622
  let boneCount = constrained.length;
7768
7623
  for (let i = 0; i < boneCount; i++)
@@ -7775,8 +7630,7 @@ var spine = (() => {
7775
7630
  }
7776
7631
  sortTransformConstraint(constraint) {
7777
7632
  constraint.active = constraint.target.isActive() && (!constraint.data.skinRequired || this.skin && Utils.contains(this.skin.constraints, constraint.data, true));
7778
- if (!constraint.active)
7779
- return;
7633
+ if (!constraint.active) return;
7780
7634
  this.sortBone(constraint.target);
7781
7635
  let constrained = constraint.bones;
7782
7636
  let boneCount = constrained.length;
@@ -7799,15 +7653,13 @@ var spine = (() => {
7799
7653
  }
7800
7654
  sortPathConstraintAttachment(skin, slotIndex, slotBone) {
7801
7655
  let attachments = skin.attachments[slotIndex];
7802
- if (!attachments)
7803
- return;
7656
+ if (!attachments) return;
7804
7657
  for (let key in attachments) {
7805
7658
  this.sortPathConstraintAttachmentWith(attachments[key], slotBone);
7806
7659
  }
7807
7660
  }
7808
7661
  sortPathConstraintAttachmentWith(attachment, slotBone) {
7809
- if (!(attachment instanceof PathAttachment))
7810
- return;
7662
+ if (!(attachment instanceof PathAttachment)) return;
7811
7663
  let pathBones = attachment.bones;
7812
7664
  if (!pathBones)
7813
7665
  this.sortBone(slotBone);
@@ -7824,31 +7676,25 @@ var spine = (() => {
7824
7676
  sortPhysicsConstraint(constraint) {
7825
7677
  const bone = constraint.bone;
7826
7678
  constraint.active = bone.active && (!constraint.data.skinRequired || this.skin != null && Utils.contains(this.skin.constraints, constraint.data, true));
7827
- if (!constraint.active)
7828
- return;
7679
+ if (!constraint.active) return;
7829
7680
  this.sortBone(bone);
7830
7681
  this._updateCache.push(constraint);
7831
7682
  this.sortReset(bone.children);
7832
7683
  bone.sorted = true;
7833
7684
  }
7834
7685
  sortBone(bone) {
7835
- if (!bone)
7836
- return;
7837
- if (bone.sorted)
7838
- return;
7686
+ if (!bone) return;
7687
+ if (bone.sorted) return;
7839
7688
  let parent = bone.parent;
7840
- if (parent)
7841
- this.sortBone(parent);
7689
+ if (parent) this.sortBone(parent);
7842
7690
  bone.sorted = true;
7843
7691
  this._updateCache.push(bone);
7844
7692
  }
7845
7693
  sortReset(bones) {
7846
7694
  for (let i = 0, n = bones.length; i < n; i++) {
7847
7695
  let bone = bones[i];
7848
- if (!bone.active)
7849
- continue;
7850
- if (bone.sorted)
7851
- this.sortReset(bone.children);
7696
+ if (!bone.active) continue;
7697
+ if (bone.sorted) this.sortReset(bone.children);
7852
7698
  bone.sorted = false;
7853
7699
  }
7854
7700
  }
@@ -7857,8 +7703,7 @@ var spine = (() => {
7857
7703
  * See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
7858
7704
  * Runtimes Guide. */
7859
7705
  updateWorldTransform(physics) {
7860
- if (physics === void 0 || physics === null)
7861
- throw new Error("physics is undefined");
7706
+ if (physics === void 0 || physics === null) throw new Error("physics is undefined");
7862
7707
  let bones = this.bones;
7863
7708
  for (let i = 0, n = bones.length; i < n; i++) {
7864
7709
  let bone = bones[i];
@@ -7875,8 +7720,7 @@ var spine = (() => {
7875
7720
  updateCache[i].update(physics);
7876
7721
  }
7877
7722
  updateWorldTransformWith(physics, parent) {
7878
- if (!parent)
7879
- throw new Error("parent cannot be null.");
7723
+ if (!parent) throw new Error("parent cannot be null.");
7880
7724
  let bones = this.bones;
7881
7725
  for (let i = 1, n = bones.length; i < n; i++) {
7882
7726
  let bone = bones[i];
@@ -7889,8 +7733,7 @@ var spine = (() => {
7889
7733
  bone.ashearY = bone.shearY;
7890
7734
  }
7891
7735
  let rootBone = this.getRootBone();
7892
- if (!rootBone)
7893
- throw new Error("Root bone must not be null.");
7736
+ if (!rootBone) throw new Error("Root bone must not be null.");
7894
7737
  let pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
7895
7738
  rootBone.worldX = pa * this.x + pb * this.y + parent.worldX;
7896
7739
  rootBone.worldY = pc * this.x + pd * this.y + parent.worldY;
@@ -7907,8 +7750,7 @@ var spine = (() => {
7907
7750
  let updateCache = this._updateCache;
7908
7751
  for (let i = 0, n = updateCache.length; i < n; i++) {
7909
7752
  let updatable = updateCache[i];
7910
- if (updatable != rootBone)
7911
- updatable.update(physics);
7753
+ if (updatable != rootBone) updatable.update(physics);
7912
7754
  }
7913
7755
  }
7914
7756
  /** Sets the bones, constraints, and slots to their setup pose values. */
@@ -7918,16 +7760,11 @@ var spine = (() => {
7918
7760
  }
7919
7761
  /** Sets the bones and constraints to their setup pose values. */
7920
7762
  setBonesToSetupPose() {
7921
- for (const bone of this.bones)
7922
- bone.setToSetupPose();
7923
- for (const constraint of this.ikConstraints)
7924
- constraint.setToSetupPose();
7925
- for (const constraint of this.transformConstraints)
7926
- constraint.setToSetupPose();
7927
- for (const constraint of this.pathConstraints)
7928
- constraint.setToSetupPose();
7929
- for (const constraint of this.physicsConstraints)
7930
- 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();
7931
7768
  }
7932
7769
  /** Sets the slots and draw order to their setup pose values. */
7933
7770
  setSlotsToSetupPose() {
@@ -7938,19 +7775,16 @@ var spine = (() => {
7938
7775
  }
7939
7776
  /** @returns May return null. */
7940
7777
  getRootBone() {
7941
- if (this.bones.length == 0)
7942
- return null;
7778
+ if (this.bones.length == 0) return null;
7943
7779
  return this.bones[0];
7944
7780
  }
7945
7781
  /** @returns May be null. */
7946
7782
  findBone(boneName) {
7947
- if (!boneName)
7948
- throw new Error("boneName cannot be null.");
7783
+ if (!boneName) throw new Error("boneName cannot be null.");
7949
7784
  let bones = this.bones;
7950
7785
  for (let i = 0, n = bones.length; i < n; i++) {
7951
7786
  let bone = bones[i];
7952
- if (bone.data.name == boneName)
7953
- return bone;
7787
+ if (bone.data.name == boneName) return bone;
7954
7788
  }
7955
7789
  return null;
7956
7790
  }
@@ -7958,13 +7792,11 @@ var spine = (() => {
7958
7792
  * repeatedly.
7959
7793
  * @returns May be null. */
7960
7794
  findSlot(slotName) {
7961
- if (!slotName)
7962
- throw new Error("slotName cannot be null.");
7795
+ if (!slotName) throw new Error("slotName cannot be null.");
7963
7796
  let slots = this.slots;
7964
7797
  for (let i = 0, n = slots.length; i < n; i++) {
7965
7798
  let slot = slots[i];
7966
- if (slot.data.name == slotName)
7967
- return slot;
7799
+ if (slot.data.name == slotName) return slot;
7968
7800
  }
7969
7801
  return null;
7970
7802
  }
@@ -7973,8 +7805,7 @@ var spine = (() => {
7973
7805
  * See {@link #setSkin()}. */
7974
7806
  setSkinByName(skinName) {
7975
7807
  let skin = this.data.findSkin(skinName);
7976
- if (!skin)
7977
- throw new Error("Skin not found: " + skinName);
7808
+ if (!skin) throw new Error("Skin not found: " + skinName);
7978
7809
  this.setSkin(skin);
7979
7810
  }
7980
7811
  /** Sets the skin used to look up attachments before looking in the {@link SkeletonData#defaultSkin default skin}. If the
@@ -7988,8 +7819,7 @@ var spine = (() => {
7988
7819
  * skeleton is rendered to allow any attachment keys in the current animation(s) to hide or show attachments from the new skin.
7989
7820
  * @param newSkin May be null. */
7990
7821
  setSkin(newSkin) {
7991
- if (newSkin == this.skin)
7992
- return;
7822
+ if (newSkin == this.skin) return;
7993
7823
  if (newSkin) {
7994
7824
  if (this.skin)
7995
7825
  newSkin.attachAll(this, this.skin);
@@ -8000,8 +7830,7 @@ var spine = (() => {
8000
7830
  let name = slot.data.attachmentName;
8001
7831
  if (name) {
8002
7832
  let attachment = newSkin.getAttachment(i, name);
8003
- if (attachment)
8004
- slot.setAttachment(attachment);
7833
+ if (attachment) slot.setAttachment(attachment);
8005
7834
  }
8006
7835
  }
8007
7836
  }
@@ -8016,8 +7845,7 @@ var spine = (() => {
8016
7845
  * @returns May be null. */
8017
7846
  getAttachmentByName(slotName, attachmentName) {
8018
7847
  let slot = this.data.findSlot(slotName);
8019
- if (!slot)
8020
- throw new Error(`Can't find slot with name ${slotName}`);
7848
+ if (!slot) throw new Error(`Can't find slot with name ${slotName}`);
8021
7849
  return this.getAttachment(slot.index, attachmentName);
8022
7850
  }
8023
7851
  /** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot index and
@@ -8026,23 +7854,19 @@ var spine = (() => {
8026
7854
  * See [Runtime skins](http://esotericsoftware.com/spine-runtime-skins) in the Spine Runtimes Guide.
8027
7855
  * @returns May be null. */
8028
7856
  getAttachment(slotIndex, attachmentName) {
8029
- if (!attachmentName)
8030
- throw new Error("attachmentName cannot be null.");
7857
+ if (!attachmentName) throw new Error("attachmentName cannot be null.");
8031
7858
  if (this.skin) {
8032
7859
  let attachment = this.skin.getAttachment(slotIndex, attachmentName);
8033
- if (attachment)
8034
- return attachment;
7860
+ if (attachment) return attachment;
8035
7861
  }
8036
- if (this.data.defaultSkin)
8037
- return this.data.defaultSkin.getAttachment(slotIndex, attachmentName);
7862
+ if (this.data.defaultSkin) return this.data.defaultSkin.getAttachment(slotIndex, attachmentName);
8038
7863
  return null;
8039
7864
  }
8040
7865
  /** A convenience method to set an attachment by finding the slot with {@link #findSlot()}, finding the attachment with
8041
7866
  * {@link #getAttachment()}, then setting the slot's {@link Slot#attachment}.
8042
7867
  * @param attachmentName May be null to clear the slot's attachment. */
8043
7868
  setAttachment(slotName, attachmentName) {
8044
- if (!slotName)
8045
- throw new Error("slotName cannot be null.");
7869
+ if (!slotName) throw new Error("slotName cannot be null.");
8046
7870
  let slots = this.slots;
8047
7871
  for (let i = 0, n = slots.length; i < n; i++) {
8048
7872
  let slot = slots[i];
@@ -8050,8 +7874,7 @@ var spine = (() => {
8050
7874
  let attachment = null;
8051
7875
  if (attachmentName) {
8052
7876
  attachment = this.getAttachment(i, attachmentName);
8053
- if (!attachment)
8054
- throw new Error("Attachment not found: " + attachmentName + ", for slot: " + slotName);
7877
+ if (!attachment) throw new Error("Attachment not found: " + attachmentName + ", for slot: " + slotName);
8055
7878
  }
8056
7879
  slot.setAttachment(attachment);
8057
7880
  return;
@@ -8063,31 +7886,27 @@ var spine = (() => {
8063
7886
  * than to call it repeatedly.
8064
7887
  * @return May be null. */
8065
7888
  findIkConstraint(constraintName) {
8066
- if (!constraintName)
8067
- throw new Error("constraintName cannot be null.");
7889
+ if (!constraintName) throw new Error("constraintName cannot be null.");
8068
7890
  return this.ikConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
8069
7891
  }
8070
7892
  /** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
8071
7893
  * this method than to call it repeatedly.
8072
7894
  * @return May be null. */
8073
7895
  findTransformConstraint(constraintName) {
8074
- if (!constraintName)
8075
- throw new Error("constraintName cannot be null.");
7896
+ if (!constraintName) throw new Error("constraintName cannot be null.");
8076
7897
  return this.transformConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
8077
7898
  }
8078
7899
  /** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
8079
7900
  * than to call it repeatedly.
8080
7901
  * @return May be null. */
8081
7902
  findPathConstraint(constraintName) {
8082
- if (!constraintName)
8083
- throw new Error("constraintName cannot be null.");
7903
+ if (!constraintName) throw new Error("constraintName cannot be null.");
8084
7904
  return this.pathConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
8085
7905
  }
8086
7906
  /** Finds a physics constraint by comparing each physics constraint's name. It is more efficient to cache the results of this
8087
7907
  * method than to call it repeatedly. */
8088
7908
  findPhysicsConstraint(constraintName) {
8089
- if (constraintName == null)
8090
- throw new Error("constraintName cannot be null.");
7909
+ if (constraintName == null) throw new Error("constraintName cannot be null.");
8091
7910
  return this.physicsConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
8092
7911
  }
8093
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 }`.
@@ -8104,16 +7923,13 @@ var spine = (() => {
8104
7923
  * @param temp Working memory to temporarily store attachments' computed world vertices.
8105
7924
  * @param clipper {@link SkeletonClipping} to use. If <code>null</code>, no clipping is applied. */
8106
7925
  getBounds(offset, size, temp = new Array(2), clipper = null) {
8107
- if (!offset)
8108
- throw new Error("offset cannot be null.");
8109
- if (!size)
8110
- 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.");
8111
7928
  let drawOrder = this.drawOrder;
8112
7929
  let minX = Number.POSITIVE_INFINITY, minY = Number.POSITIVE_INFINITY, maxX = Number.NEGATIVE_INFINITY, maxY = Number.NEGATIVE_INFINITY;
8113
7930
  for (let i = 0, n = drawOrder.length; i < n; i++) {
8114
7931
  let slot = drawOrder[i];
8115
- if (!slot.bone.active)
8116
- continue;
7932
+ if (!slot.bone.active) continue;
8117
7933
  let verticesLength = 0;
8118
7934
  let vertices = null;
8119
7935
  let triangles = null;
@@ -8147,11 +7963,9 @@ var spine = (() => {
8147
7963
  maxY = Math.max(maxY, y);
8148
7964
  }
8149
7965
  }
8150
- if (clipper != null)
8151
- clipper.clipEndWithSlot(slot);
7966
+ if (clipper != null) clipper.clipEndWithSlot(slot);
8152
7967
  }
8153
- if (clipper != null)
8154
- clipper.clipEnd();
7968
+ if (clipper != null) clipper.clipEnd();
8155
7969
  offset.set(minX, minY);
8156
7970
  size.set(maxX - minX, maxY - minY);
8157
7971
  }
@@ -8171,9 +7985,6 @@ var spine = (() => {
8171
7985
  physicsConstraints[i].rotate(x, y, degrees);
8172
7986
  }
8173
7987
  };
8174
- var Skeleton = _Skeleton;
8175
- __publicField(Skeleton, "quadTriangles", [0, 1, 2, 2, 3, 0]);
8176
- __publicField(Skeleton, "yDown", false);
8177
7988
  var Physics = /* @__PURE__ */ ((Physics2) => {
8178
7989
  Physics2[Physics2["none"] = 0] = "none";
8179
7990
  Physics2[Physics2["reset"] = 1] = "reset";
@@ -8190,10 +8001,8 @@ var spine = (() => {
8190
8001
  this._bone = boneData;
8191
8002
  }
8192
8003
  get bone() {
8193
- if (!this._bone)
8194
- throw new Error("BoneData not set.");
8195
- else
8196
- return this._bone;
8004
+ if (!this._bone) throw new Error("BoneData not set.");
8005
+ else return this._bone;
8197
8006
  }
8198
8007
  x = 0;
8199
8008
  y = 0;
@@ -8276,13 +8085,11 @@ var spine = (() => {
8276
8085
  * multiple times.
8277
8086
  * @returns May be null. */
8278
8087
  findBone(boneName) {
8279
- if (!boneName)
8280
- throw new Error("boneName cannot be null.");
8088
+ if (!boneName) throw new Error("boneName cannot be null.");
8281
8089
  let bones = this.bones;
8282
8090
  for (let i = 0, n = bones.length; i < n; i++) {
8283
8091
  let bone = bones[i];
8284
- if (bone.name == boneName)
8285
- return bone;
8092
+ if (bone.name == boneName) return bone;
8286
8093
  }
8287
8094
  return null;
8288
8095
  }
@@ -8290,13 +8097,11 @@ var spine = (() => {
8290
8097
  * multiple times.
8291
8098
  * @returns May be null. */
8292
8099
  findSlot(slotName) {
8293
- if (!slotName)
8294
- throw new Error("slotName cannot be null.");
8100
+ if (!slotName) throw new Error("slotName cannot be null.");
8295
8101
  let slots = this.slots;
8296
8102
  for (let i = 0, n = slots.length; i < n; i++) {
8297
8103
  let slot = slots[i];
8298
- if (slot.name == slotName)
8299
- return slot;
8104
+ if (slot.name == slotName) return slot;
8300
8105
  }
8301
8106
  return null;
8302
8107
  }
@@ -8304,13 +8109,11 @@ var spine = (() => {
8304
8109
  * multiple times.
8305
8110
  * @returns May be null. */
8306
8111
  findSkin(skinName) {
8307
- if (!skinName)
8308
- throw new Error("skinName cannot be null.");
8112
+ if (!skinName) throw new Error("skinName cannot be null.");
8309
8113
  let skins = this.skins;
8310
8114
  for (let i = 0, n = skins.length; i < n; i++) {
8311
8115
  let skin = skins[i];
8312
- if (skin.name == skinName)
8313
- return skin;
8116
+ if (skin.name == skinName) return skin;
8314
8117
  }
8315
8118
  return null;
8316
8119
  }
@@ -8318,13 +8121,11 @@ var spine = (() => {
8318
8121
  * multiple times.
8319
8122
  * @returns May be null. */
8320
8123
  findEvent(eventDataName) {
8321
- if (!eventDataName)
8322
- throw new Error("eventDataName cannot be null.");
8124
+ if (!eventDataName) throw new Error("eventDataName cannot be null.");
8323
8125
  let events = this.events;
8324
8126
  for (let i = 0, n = events.length; i < n; i++) {
8325
8127
  let event = events[i];
8326
- if (event.name == eventDataName)
8327
- return event;
8128
+ if (event.name == eventDataName) return event;
8328
8129
  }
8329
8130
  return null;
8330
8131
  }
@@ -8332,13 +8133,11 @@ var spine = (() => {
8332
8133
  * call it multiple times.
8333
8134
  * @returns May be null. */
8334
8135
  findAnimation(animationName) {
8335
- if (!animationName)
8336
- throw new Error("animationName cannot be null.");
8136
+ if (!animationName) throw new Error("animationName cannot be null.");
8337
8137
  let animations = this.animations;
8338
8138
  for (let i = 0, n = animations.length; i < n; i++) {
8339
8139
  let animation = animations[i];
8340
- if (animation.name == animationName)
8341
- return animation;
8140
+ if (animation.name == animationName) return animation;
8342
8141
  }
8343
8142
  return null;
8344
8143
  }
@@ -8346,13 +8145,11 @@ var spine = (() => {
8346
8145
  * than to call it multiple times.
8347
8146
  * @return May be null. */
8348
8147
  findIkConstraint(constraintName) {
8349
- if (!constraintName)
8350
- throw new Error("constraintName cannot be null.");
8148
+ if (!constraintName) throw new Error("constraintName cannot be null.");
8351
8149
  const ikConstraints = this.ikConstraints;
8352
8150
  for (let i = 0, n = ikConstraints.length; i < n; i++) {
8353
8151
  const constraint = ikConstraints[i];
8354
- if (constraint.name == constraintName)
8355
- return constraint;
8152
+ if (constraint.name == constraintName) return constraint;
8356
8153
  }
8357
8154
  return null;
8358
8155
  }
@@ -8360,13 +8157,11 @@ var spine = (() => {
8360
8157
  * this method than to call it multiple times.
8361
8158
  * @return May be null. */
8362
8159
  findTransformConstraint(constraintName) {
8363
- if (!constraintName)
8364
- throw new Error("constraintName cannot be null.");
8160
+ if (!constraintName) throw new Error("constraintName cannot be null.");
8365
8161
  const transformConstraints = this.transformConstraints;
8366
8162
  for (let i = 0, n = transformConstraints.length; i < n; i++) {
8367
8163
  const constraint = transformConstraints[i];
8368
- if (constraint.name == constraintName)
8369
- return constraint;
8164
+ if (constraint.name == constraintName) return constraint;
8370
8165
  }
8371
8166
  return null;
8372
8167
  }
@@ -8374,13 +8169,11 @@ var spine = (() => {
8374
8169
  * than to call it multiple times.
8375
8170
  * @return May be null. */
8376
8171
  findPathConstraint(constraintName) {
8377
- if (!constraintName)
8378
- throw new Error("constraintName cannot be null.");
8172
+ if (!constraintName) throw new Error("constraintName cannot be null.");
8379
8173
  const pathConstraints = this.pathConstraints;
8380
8174
  for (let i = 0, n = pathConstraints.length; i < n; i++) {
8381
8175
  const constraint = pathConstraints[i];
8382
- if (constraint.name == constraintName)
8383
- return constraint;
8176
+ if (constraint.name == constraintName) return constraint;
8384
8177
  }
8385
8178
  return null;
8386
8179
  }
@@ -8388,13 +8181,11 @@ var spine = (() => {
8388
8181
  * than to call it multiple times.
8389
8182
  * @return May be null. */
8390
8183
  findPhysicsConstraint(constraintName) {
8391
- if (!constraintName)
8392
- throw new Error("constraintName cannot be null.");
8184
+ if (!constraintName) throw new Error("constraintName cannot be null.");
8393
8185
  const physicsConstraints = this.physicsConstraints;
8394
8186
  for (let i = 0, n = physicsConstraints.length; i < n; i++) {
8395
8187
  const constraint = physicsConstraints[i];
8396
- if (constraint.name == constraintName)
8397
- return constraint;
8188
+ if (constraint.name == constraintName) return constraint;
8398
8189
  }
8399
8190
  return null;
8400
8191
  }
@@ -8418,19 +8209,15 @@ var spine = (() => {
8418
8209
  color = new Color(0.99607843, 0.61960787, 0.30980393, 1);
8419
8210
  // fe9e4fff
8420
8211
  constructor(name) {
8421
- if (!name)
8422
- throw new Error("name cannot be null.");
8212
+ if (!name) throw new Error("name cannot be null.");
8423
8213
  this.name = name;
8424
8214
  }
8425
8215
  /** Adds an attachment to the skin for the specified slot index and name. */
8426
8216
  setAttachment(slotIndex, name, attachment) {
8427
- if (!attachment)
8428
- throw new Error("attachment cannot be null.");
8217
+ if (!attachment) throw new Error("attachment cannot be null.");
8429
8218
  let attachments = this.attachments;
8430
- if (slotIndex >= attachments.length)
8431
- attachments.length = slotIndex + 1;
8432
- if (!attachments[slotIndex])
8433
- attachments[slotIndex] = {};
8219
+ if (slotIndex >= attachments.length) attachments.length = slotIndex + 1;
8220
+ if (!attachments[slotIndex]) attachments[slotIndex] = {};
8434
8221
  attachments[slotIndex][name] = attachment;
8435
8222
  }
8436
8223
  /** Adds all attachments, bones, and constraints from the specified skin to this skin. */
@@ -8444,8 +8231,7 @@ var spine = (() => {
8444
8231
  break;
8445
8232
  }
8446
8233
  }
8447
- if (!contained)
8448
- this.bones.push(bone);
8234
+ if (!contained) this.bones.push(bone);
8449
8235
  }
8450
8236
  for (let i = 0; i < skin.constraints.length; i++) {
8451
8237
  let constraint = skin.constraints[i];
@@ -8456,8 +8242,7 @@ var spine = (() => {
8456
8242
  break;
8457
8243
  }
8458
8244
  }
8459
- if (!contained)
8460
- this.constraints.push(constraint);
8245
+ if (!contained) this.constraints.push(constraint);
8461
8246
  }
8462
8247
  let attachments = skin.getAttachments();
8463
8248
  for (let i = 0; i < attachments.length; i++) {
@@ -8477,8 +8262,7 @@ var spine = (() => {
8477
8262
  break;
8478
8263
  }
8479
8264
  }
8480
- if (!contained)
8481
- this.bones.push(bone);
8265
+ if (!contained) this.bones.push(bone);
8482
8266
  }
8483
8267
  for (let i = 0; i < skin.constraints.length; i++) {
8484
8268
  let constraint = skin.constraints[i];
@@ -8489,14 +8273,12 @@ var spine = (() => {
8489
8273
  break;
8490
8274
  }
8491
8275
  }
8492
- if (!contained)
8493
- this.constraints.push(constraint);
8276
+ if (!contained) this.constraints.push(constraint);
8494
8277
  }
8495
8278
  let attachments = skin.getAttachments();
8496
8279
  for (let i = 0; i < attachments.length; i++) {
8497
8280
  var attachment = attachments[i];
8498
- if (!attachment.attachment)
8499
- continue;
8281
+ if (!attachment.attachment) continue;
8500
8282
  if (attachment.attachment instanceof MeshAttachment) {
8501
8283
  attachment.attachment = attachment.attachment.newLinkedMesh();
8502
8284
  this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
@@ -8514,8 +8296,7 @@ var spine = (() => {
8514
8296
  /** Removes the attachment in the skin for the specified slot index and name, if any. */
8515
8297
  removeAttachment(slotIndex, name) {
8516
8298
  let dictionary = this.attachments[slotIndex];
8517
- if (dictionary)
8518
- delete dictionary[name];
8299
+ if (dictionary) delete dictionary[name];
8519
8300
  }
8520
8301
  /** Returns all attachments in this skin. */
8521
8302
  getAttachments() {
@@ -8525,8 +8306,7 @@ var spine = (() => {
8525
8306
  if (slotAttachments) {
8526
8307
  for (let name in slotAttachments) {
8527
8308
  let attachment = slotAttachments[name];
8528
- if (attachment)
8529
- entries.push(new SkinEntry(i, name, attachment));
8309
+ if (attachment) entries.push(new SkinEntry(i, name, attachment));
8530
8310
  }
8531
8311
  }
8532
8312
  }
@@ -8538,8 +8318,7 @@ var spine = (() => {
8538
8318
  if (slotAttachments) {
8539
8319
  for (let name in slotAttachments) {
8540
8320
  let attachment = slotAttachments[name];
8541
- if (attachment)
8542
- attachments.push(new SkinEntry(slotIndex, name, attachment));
8321
+ if (attachment) attachments.push(new SkinEntry(slotIndex, name, attachment));
8543
8322
  }
8544
8323
  }
8545
8324
  }
@@ -8561,8 +8340,7 @@ var spine = (() => {
8561
8340
  let skinAttachment = dictionary[key];
8562
8341
  if (slotAttachment == skinAttachment) {
8563
8342
  let attachment = this.getAttachment(slotIndex, key);
8564
- if (attachment)
8565
- slot.setAttachment(attachment);
8343
+ if (attachment) slot.setAttachment(attachment);
8566
8344
  break;
8567
8345
  }
8568
8346
  }
@@ -8589,16 +8367,13 @@ var spine = (() => {
8589
8367
  /** The name of the attachment that is visible for this slot in the setup pose, or null if no attachment is visible. */
8590
8368
  attachmentName = null;
8591
8369
  /** The blend mode for drawing the slot's attachment. */
8592
- blendMode = BlendMode.Normal;
8370
+ blendMode = 0 /* Normal */;
8593
8371
  /** False if the slot was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */
8594
8372
  visible = true;
8595
8373
  constructor(index, name, boneData) {
8596
- if (index < 0)
8597
- throw new Error("index must be >= 0.");
8598
- if (!name)
8599
- throw new Error("name cannot be null.");
8600
- if (!boneData)
8601
- 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.");
8602
8377
  this.index = index;
8603
8378
  this.name = name;
8604
8379
  this.boneData = boneData;
@@ -8622,10 +8397,8 @@ var spine = (() => {
8622
8397
  this._target = boneData;
8623
8398
  }
8624
8399
  get target() {
8625
- if (!this._target)
8626
- throw new Error("BoneData not set.");
8627
- else
8628
- return this._target;
8400
+ if (!this._target) throw new Error("BoneData not set.");
8401
+ else return this._target;
8629
8402
  }
8630
8403
  mixRotate = 0;
8631
8404
  mixX = 0;
@@ -8688,15 +8461,13 @@ var spine = (() => {
8688
8461
  n = input.readInt(true);
8689
8462
  for (let i = 0; i < n; i++) {
8690
8463
  let str = input.readString();
8691
- if (!str)
8692
- 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.");
8693
8465
  input.strings.push(str);
8694
8466
  }
8695
8467
  n = input.readInt(true);
8696
8468
  for (let i = 0; i < n; i++) {
8697
8469
  let name = input.readString();
8698
- if (!name)
8699
- throw new Error("Bone name must not be null.");
8470
+ if (!name) throw new Error("Bone name must not be null.");
8700
8471
  let parent = i == 0 ? null : skeletonData.bones[input.readInt(true)];
8701
8472
  let data = new BoneData(i, name, parent);
8702
8473
  data.rotation = input.readFloat();
@@ -8719,25 +8490,21 @@ var spine = (() => {
8719
8490
  n = input.readInt(true);
8720
8491
  for (let i = 0; i < n; i++) {
8721
8492
  let slotName = input.readString();
8722
- if (!slotName)
8723
- throw new Error("Slot name must not be null.");
8493
+ if (!slotName) throw new Error("Slot name must not be null.");
8724
8494
  let boneData = skeletonData.bones[input.readInt(true)];
8725
8495
  let data = new SlotData(i, slotName, boneData);
8726
8496
  Color.rgba8888ToColor(data.color, input.readInt32());
8727
8497
  let darkColor = input.readInt32();
8728
- if (darkColor != -1)
8729
- Color.rgb888ToColor(data.darkColor = new Color(), darkColor);
8498
+ if (darkColor != -1) Color.rgb888ToColor(data.darkColor = new Color(), darkColor);
8730
8499
  data.attachmentName = input.readStringRef();
8731
8500
  data.blendMode = input.readInt(true);
8732
- if (nonessential)
8733
- data.visible = input.readBoolean();
8501
+ if (nonessential) data.visible = input.readBoolean();
8734
8502
  skeletonData.slots.push(data);
8735
8503
  }
8736
8504
  n = input.readInt(true);
8737
8505
  for (let i = 0, nn; i < n; i++) {
8738
8506
  let name = input.readString();
8739
- if (!name)
8740
- 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.");
8741
8508
  let data = new IkConstraintData(name);
8742
8509
  data.order = input.readInt(true);
8743
8510
  nn = input.readInt(true);
@@ -8750,17 +8517,14 @@ var spine = (() => {
8750
8517
  data.compress = (flags & 4) != 0;
8751
8518
  data.stretch = (flags & 8) != 0;
8752
8519
  data.uniform = (flags & 16) != 0;
8753
- if ((flags & 32) != 0)
8754
- data.mix = (flags & 64) != 0 ? input.readFloat() : 1;
8755
- if ((flags & 128) != 0)
8756
- 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;
8757
8522
  skeletonData.ikConstraints.push(data);
8758
8523
  }
8759
8524
  n = input.readInt(true);
8760
8525
  for (let i = 0, nn; i < n; i++) {
8761
8526
  let name = input.readString();
8762
- if (!name)
8763
- 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.");
8764
8528
  let data = new TransformConstraintData(name);
8765
8529
  data.order = input.readInt(true);
8766
8530
  nn = input.readInt(true);
@@ -8771,38 +8535,25 @@ var spine = (() => {
8771
8535
  data.skinRequired = (flags & 1) != 0;
8772
8536
  data.local = (flags & 2) != 0;
8773
8537
  data.relative = (flags & 4) != 0;
8774
- if ((flags & 8) != 0)
8775
- data.offsetRotation = input.readFloat();
8776
- if ((flags & 16) != 0)
8777
- data.offsetX = input.readFloat() * scale;
8778
- if ((flags & 32) != 0)
8779
- data.offsetY = input.readFloat() * scale;
8780
- if ((flags & 64) != 0)
8781
- data.offsetScaleX = input.readFloat();
8782
- if ((flags & 128) != 0)
8783
- 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();
8784
8543
  flags = input.readByte();
8785
- if ((flags & 1) != 0)
8786
- data.offsetShearY = input.readFloat();
8787
- if ((flags & 2) != 0)
8788
- data.mixRotate = input.readFloat();
8789
- if ((flags & 4) != 0)
8790
- data.mixX = input.readFloat();
8791
- if ((flags & 8) != 0)
8792
- data.mixY = input.readFloat();
8793
- if ((flags & 16) != 0)
8794
- data.mixScaleX = input.readFloat();
8795
- if ((flags & 32) != 0)
8796
- data.mixScaleY = input.readFloat();
8797
- if ((flags & 64) != 0)
8798
- 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();
8799
8551
  skeletonData.transformConstraints.push(data);
8800
8552
  }
8801
8553
  n = input.readInt(true);
8802
8554
  for (let i = 0, nn; i < n; i++) {
8803
8555
  let name = input.readString();
8804
- if (!name)
8805
- 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.");
8806
8557
  let data = new PathConstraintData(name);
8807
8558
  data.order = input.readInt(true);
8808
8559
  data.skinRequired = input.readBoolean();
@@ -8814,14 +8565,11 @@ var spine = (() => {
8814
8565
  data.positionMode = flags & 1;
8815
8566
  data.spacingMode = flags >> 1 & 3;
8816
8567
  data.rotateMode = flags >> 3 & 3;
8817
- if ((flags & 128) != 0)
8818
- data.offsetRotation = input.readFloat();
8568
+ if ((flags & 128) != 0) data.offsetRotation = input.readFloat();
8819
8569
  data.position = input.readFloat();
8820
- if (data.positionMode == 0 /* Fixed */)
8821
- data.position *= scale;
8570
+ if (data.positionMode == 0 /* Fixed */) data.position *= scale;
8822
8571
  data.spacing = input.readFloat();
8823
- if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */)
8824
- data.spacing *= scale;
8572
+ if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */) data.spacing *= scale;
8825
8573
  data.mixRotate = input.readFloat();
8826
8574
  data.mixX = input.readFloat();
8827
8575
  data.mixY = input.readFloat();
@@ -8830,23 +8578,17 @@ var spine = (() => {
8830
8578
  n = input.readInt(true);
8831
8579
  for (let i = 0, nn; i < n; i++) {
8832
8580
  const name = input.readString();
8833
- if (!name)
8834
- 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.");
8835
8582
  const data = new PhysicsConstraintData(name);
8836
8583
  data.order = input.readInt(true);
8837
8584
  data.bone = skeletonData.bones[input.readInt(true)];
8838
8585
  let flags = input.readByte();
8839
8586
  data.skinRequired = (flags & 1) != 0;
8840
- if ((flags & 2) != 0)
8841
- data.x = input.readFloat();
8842
- if ((flags & 4) != 0)
8843
- data.y = input.readFloat();
8844
- if ((flags & 8) != 0)
8845
- data.rotate = input.readFloat();
8846
- if ((flags & 16) != 0)
8847
- data.scaleX = input.readFloat();
8848
- if ((flags & 32) != 0)
8849
- 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();
8850
8592
  data.limit = ((flags & 64) != 0 ? input.readFloat() : 5e3) * scale;
8851
8593
  data.step = 1 / input.readUnsignedByte();
8852
8594
  data.inertia = input.readFloat();
@@ -8856,20 +8598,13 @@ var spine = (() => {
8856
8598
  data.wind = input.readFloat();
8857
8599
  data.gravity = input.readFloat();
8858
8600
  flags = input.readByte();
8859
- if ((flags & 1) != 0)
8860
- data.inertiaGlobal = true;
8861
- if ((flags & 2) != 0)
8862
- data.strengthGlobal = true;
8863
- if ((flags & 4) != 0)
8864
- data.dampingGlobal = true;
8865
- if ((flags & 8) != 0)
8866
- data.massGlobal = true;
8867
- if ((flags & 16) != 0)
8868
- data.windGlobal = true;
8869
- if ((flags & 32) != 0)
8870
- data.gravityGlobal = true;
8871
- if ((flags & 64) != 0)
8872
- 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;
8873
8608
  data.mix = (flags & 128) != 0 ? input.readFloat() : 1;
8874
8609
  skeletonData.physicsConstraints.push(data);
8875
8610
  }
@@ -8883,8 +8618,7 @@ var spine = (() => {
8883
8618
  Utils.setArraySize(skeletonData.skins, n = i + input.readInt(true));
8884
8619
  for (; i < n; i++) {
8885
8620
  let skin = this.readSkin(input, skeletonData, false, nonessential);
8886
- if (!skin)
8887
- throw new Error("readSkin() should not have returned null.");
8621
+ if (!skin) throw new Error("readSkin() should not have returned null.");
8888
8622
  skeletonData.skins[i] = skin;
8889
8623
  }
8890
8624
  }
@@ -8892,22 +8626,18 @@ var spine = (() => {
8892
8626
  for (let i = 0; i < n; i++) {
8893
8627
  let linkedMesh = this.linkedMeshes[i];
8894
8628
  const skin = skeletonData.skins[linkedMesh.skinIndex];
8895
- if (!linkedMesh.parent)
8896
- throw new Error("Linked mesh parent must not be null");
8629
+ if (!linkedMesh.parent) throw new Error("Linked mesh parent must not be null");
8897
8630
  let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
8898
- if (!parent)
8899
- throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
8631
+ if (!parent) throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
8900
8632
  linkedMesh.mesh.timelineAttachment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
8901
8633
  linkedMesh.mesh.setParentMesh(parent);
8902
- if (linkedMesh.mesh.region != null)
8903
- linkedMesh.mesh.updateRegion();
8634
+ if (linkedMesh.mesh.region != null) linkedMesh.mesh.updateRegion();
8904
8635
  }
8905
8636
  this.linkedMeshes.length = 0;
8906
8637
  n = input.readInt(true);
8907
8638
  for (let i = 0; i < n; i++) {
8908
8639
  let eventName = input.readString();
8909
- if (!eventName)
8910
- throw new Error("Event data name must not be null");
8640
+ if (!eventName) throw new Error("Event data name must not be null");
8911
8641
  let data = new EventData(eventName);
8912
8642
  data.intValue = input.readInt(false);
8913
8643
  data.floatValue = input.readFloat();
@@ -8922,8 +8652,7 @@ var spine = (() => {
8922
8652
  n = input.readInt(true);
8923
8653
  for (let i = 0; i < n; i++) {
8924
8654
  let animationName = input.readString();
8925
- if (!animationName)
8926
- throw new Error("Animatio name must not be null.");
8655
+ if (!animationName) throw new Error("Animatio name must not be null.");
8927
8656
  skeletonData.animations.push(this.readAnimation(input, animationName, skeletonData));
8928
8657
  }
8929
8658
  return skeletonData;
@@ -8933,16 +8662,13 @@ var spine = (() => {
8933
8662
  let slotCount = 0;
8934
8663
  if (defaultSkin) {
8935
8664
  slotCount = input.readInt(true);
8936
- if (slotCount == 0)
8937
- return null;
8665
+ if (slotCount == 0) return null;
8938
8666
  skin = new Skin("default");
8939
8667
  } else {
8940
8668
  let skinName = input.readString();
8941
- if (!skinName)
8942
- throw new Error("Skin name must not be null.");
8669
+ if (!skinName) throw new Error("Skin name must not be null.");
8943
8670
  skin = new Skin(skinName);
8944
- if (nonessential)
8945
- Color.rgba8888ToColor(skin.color, input.readInt32());
8671
+ if (nonessential) Color.rgba8888ToColor(skin.color, input.readInt32());
8946
8672
  skin.bones.length = input.readInt(true);
8947
8673
  for (let i = 0, n = skin.bones.length; i < n; i++)
8948
8674
  skin.bones[i] = skeletonData.bones[input.readInt(true)];
@@ -8963,8 +8689,7 @@ var spine = (() => {
8963
8689
  if (!name)
8964
8690
  throw new Error("Attachment name must not be null");
8965
8691
  let attachment = this.readAttachment(input, skeletonData, skin, slotIndex, name, nonessential);
8966
- if (attachment)
8967
- skin.setAttachment(slotIndex, name, attachment);
8692
+ if (attachment) skin.setAttachment(slotIndex, name, attachment);
8968
8693
  }
8969
8694
  }
8970
8695
  return skin;
@@ -8973,10 +8698,10 @@ var spine = (() => {
8973
8698
  let scale = this.scale;
8974
8699
  let flags = input.readByte();
8975
8700
  const name = (flags & 8) != 0 ? input.readStringRef() : attachmentName;
8976
- if (!name)
8977
- throw new Error("Attachment name must not be null");
8701
+ if (!name) throw new Error("Attachment name must not be null");
8978
8702
  switch (flags & 7) {
8979
- case AttachmentType.Region: {
8703
+ // BUG?
8704
+ case 0 /* Region */: {
8980
8705
  let path = (flags & 16) != 0 ? input.readStringRef() : null;
8981
8706
  const color = (flags & 32) != 0 ? input.readInt32() : 4294967295;
8982
8707
  const sequence = (flags & 64) != 0 ? this.readSequence(input) : null;
@@ -8987,11 +8712,9 @@ var spine = (() => {
8987
8712
  let scaleY = input.readFloat();
8988
8713
  let width = input.readFloat();
8989
8714
  let height = input.readFloat();
8990
- if (!path)
8991
- path = name;
8715
+ if (!path) path = name;
8992
8716
  let region = this.attachmentLoader.newRegionAttachment(skin, name, path, sequence);
8993
- if (!region)
8994
- return null;
8717
+ if (!region) return null;
8995
8718
  region.path = path;
8996
8719
  region.x = x * scale;
8997
8720
  region.y = y * scale;
@@ -9002,24 +8725,21 @@ var spine = (() => {
9002
8725
  region.height = height * scale;
9003
8726
  Color.rgba8888ToColor(region.color, color);
9004
8727
  region.sequence = sequence;
9005
- if (sequence == null)
9006
- region.updateRegion();
8728
+ if (sequence == null) region.updateRegion();
9007
8729
  return region;
9008
8730
  }
9009
- case AttachmentType.BoundingBox: {
8731
+ case 1 /* BoundingBox */: {
9010
8732
  let vertices = this.readVertices(input, (flags & 16) != 0);
9011
8733
  let color = nonessential ? input.readInt32() : 0;
9012
8734
  let box = this.attachmentLoader.newBoundingBoxAttachment(skin, name);
9013
- if (!box)
9014
- return null;
8735
+ if (!box) return null;
9015
8736
  box.worldVerticesLength = vertices.length;
9016
8737
  box.vertices = vertices.vertices;
9017
8738
  box.bones = vertices.bones;
9018
- if (nonessential)
9019
- Color.rgba8888ToColor(box.color, color);
8739
+ if (nonessential) Color.rgba8888ToColor(box.color, color);
9020
8740
  return box;
9021
8741
  }
9022
- case AttachmentType.Mesh: {
8742
+ case 2 /* Mesh */: {
9023
8743
  let path = (flags & 16) != 0 ? input.readStringRef() : name;
9024
8744
  const color = (flags & 32) != 0 ? input.readInt32() : 4294967295;
9025
8745
  const sequence = (flags & 64) != 0 ? this.readSequence(input) : null;
@@ -9034,11 +8754,9 @@ var spine = (() => {
9034
8754
  width = input.readFloat();
9035
8755
  height = input.readFloat();
9036
8756
  }
9037
- if (!path)
9038
- path = name;
8757
+ if (!path) path = name;
9039
8758
  let mesh = this.attachmentLoader.newMeshAttachment(skin, name, path, sequence);
9040
- if (!mesh)
9041
- return null;
8759
+ if (!mesh) return null;
9042
8760
  mesh.path = path;
9043
8761
  Color.rgba8888ToColor(mesh.color, color);
9044
8762
  mesh.bones = vertices.bones;
@@ -9046,8 +8764,7 @@ var spine = (() => {
9046
8764
  mesh.worldVerticesLength = vertices.length;
9047
8765
  mesh.triangles = triangles;
9048
8766
  mesh.regionUVs = uvs;
9049
- if (sequence == null)
9050
- mesh.updateRegion();
8767
+ if (sequence == null) mesh.updateRegion();
9051
8768
  mesh.hullLength = hullLength << 1;
9052
8769
  mesh.sequence = sequence;
9053
8770
  if (nonessential) {
@@ -9057,10 +8774,9 @@ var spine = (() => {
9057
8774
  }
9058
8775
  return mesh;
9059
8776
  }
9060
- case AttachmentType.LinkedMesh: {
8777
+ case 3 /* LinkedMesh */: {
9061
8778
  const path = (flags & 16) != 0 ? input.readStringRef() : name;
9062
- if (path == null)
9063
- 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");
9064
8780
  const color = (flags & 32) != 0 ? input.readInt32() : 4294967295;
9065
8781
  const sequence = (flags & 64) != 0 ? this.readSequence(input) : null;
9066
8782
  const inheritTimelines = (flags & 128) != 0;
@@ -9072,8 +8788,7 @@ var spine = (() => {
9072
8788
  height = input.readFloat();
9073
8789
  }
9074
8790
  let mesh = this.attachmentLoader.newMeshAttachment(skin, name, path, sequence);
9075
- if (!mesh)
9076
- return null;
8791
+ if (!mesh) return null;
9077
8792
  mesh.path = path;
9078
8793
  Color.rgba8888ToColor(mesh.color, color);
9079
8794
  mesh.sequence = sequence;
@@ -9084,7 +8799,7 @@ var spine = (() => {
9084
8799
  this.linkedMeshes.push(new LinkedMesh(mesh, skinIndex, slotIndex, parent, inheritTimelines));
9085
8800
  return mesh;
9086
8801
  }
9087
- case AttachmentType.Path: {
8802
+ case 4 /* Path */: {
9088
8803
  const closed2 = (flags & 16) != 0;
9089
8804
  const constantSpeed = (flags & 32) != 0;
9090
8805
  const vertices = this.readVertices(input, (flags & 64) != 0);
@@ -9093,46 +8808,40 @@ var spine = (() => {
9093
8808
  lengths[i] = input.readFloat() * scale;
9094
8809
  const color = nonessential ? input.readInt32() : 0;
9095
8810
  const path = this.attachmentLoader.newPathAttachment(skin, name);
9096
- if (!path)
9097
- return null;
8811
+ if (!path) return null;
9098
8812
  path.closed = closed2;
9099
8813
  path.constantSpeed = constantSpeed;
9100
8814
  path.worldVerticesLength = vertices.length;
9101
8815
  path.vertices = vertices.vertices;
9102
8816
  path.bones = vertices.bones;
9103
8817
  path.lengths = lengths;
9104
- if (nonessential)
9105
- Color.rgba8888ToColor(path.color, color);
8818
+ if (nonessential) Color.rgba8888ToColor(path.color, color);
9106
8819
  return path;
9107
8820
  }
9108
- case AttachmentType.Point: {
8821
+ case 5 /* Point */: {
9109
8822
  const rotation = input.readFloat();
9110
8823
  const x = input.readFloat();
9111
8824
  const y = input.readFloat();
9112
8825
  const color = nonessential ? input.readInt32() : 0;
9113
8826
  const point = this.attachmentLoader.newPointAttachment(skin, name);
9114
- if (!point)
9115
- return null;
8827
+ if (!point) return null;
9116
8828
  point.x = x * scale;
9117
8829
  point.y = y * scale;
9118
8830
  point.rotation = rotation;
9119
- if (nonessential)
9120
- Color.rgba8888ToColor(point.color, color);
8831
+ if (nonessential) Color.rgba8888ToColor(point.color, color);
9121
8832
  return point;
9122
8833
  }
9123
- case AttachmentType.Clipping: {
8834
+ case 6 /* Clipping */: {
9124
8835
  const endSlotIndex = input.readInt(true);
9125
8836
  const vertices = this.readVertices(input, (flags & 16) != 0);
9126
8837
  let color = nonessential ? input.readInt32() : 0;
9127
8838
  let clip = this.attachmentLoader.newClippingAttachment(skin, name);
9128
- if (!clip)
9129
- return null;
8839
+ if (!clip) return null;
9130
8840
  clip.endSlot = skeletonData.slots[endSlotIndex];
9131
8841
  clip.worldVerticesLength = vertices.length;
9132
8842
  clip.vertices = vertices.vertices;
9133
8843
  clip.bones = vertices.bones;
9134
- if (nonessential)
9135
- Color.rgba8888ToColor(clip.color, color);
8844
+ if (nonessential) Color.rgba8888ToColor(clip.color, color);
9136
8845
  return clip;
9137
8846
  }
9138
8847
  }
@@ -9215,8 +8924,7 @@ var spine = (() => {
9215
8924
  let a = input.readUnsignedByte() / 255;
9216
8925
  for (let frame = 0, bezier = 0; ; frame++) {
9217
8926
  timeline.setFrame(frame, time, r, g, b, a);
9218
- if (frame == frameLast)
9219
- break;
8927
+ if (frame == frameLast) break;
9220
8928
  let time2 = input.readFloat();
9221
8929
  let r2 = input.readUnsignedByte() / 255;
9222
8930
  let g2 = input.readUnsignedByte() / 255;
@@ -9250,8 +8958,7 @@ var spine = (() => {
9250
8958
  let b = input.readUnsignedByte() / 255;
9251
8959
  for (let frame = 0, bezier = 0; ; frame++) {
9252
8960
  timeline.setFrame(frame, time, r, g, b);
9253
- if (frame == frameLast)
9254
- break;
8961
+ if (frame == frameLast) break;
9255
8962
  let time2 = input.readFloat();
9256
8963
  let r2 = input.readUnsignedByte() / 255;
9257
8964
  let g2 = input.readUnsignedByte() / 255;
@@ -9286,8 +8993,7 @@ var spine = (() => {
9286
8993
  let b2 = input.readUnsignedByte() / 255;
9287
8994
  for (let frame = 0, bezier = 0; ; frame++) {
9288
8995
  timeline.setFrame(frame, time, r, g, b, a, r2, g2, b2);
9289
- if (frame == frameLast)
9290
- break;
8996
+ if (frame == frameLast) break;
9291
8997
  let time2 = input.readFloat();
9292
8998
  let nr = input.readUnsignedByte() / 255;
9293
8999
  let ng = input.readUnsignedByte() / 255;
@@ -9333,8 +9039,7 @@ var spine = (() => {
9333
9039
  let b2 = input.readUnsignedByte() / 255;
9334
9040
  for (let frame = 0, bezier = 0; ; frame++) {
9335
9041
  timeline.setFrame(frame, time, r, g, b, r2, g2, b2);
9336
- if (frame == frameLast)
9337
- break;
9042
+ if (frame == frameLast) break;
9338
9043
  let time2 = input.readFloat();
9339
9044
  let nr = input.readUnsignedByte() / 255;
9340
9045
  let ng = input.readUnsignedByte() / 255;
@@ -9370,8 +9075,7 @@ var spine = (() => {
9370
9075
  let time = input.readFloat(), a = input.readUnsignedByte() / 255;
9371
9076
  for (let frame = 0, bezier = 0; ; frame++) {
9372
9077
  timeline.setFrame(frame, time, a);
9373
- if (frame == frameLast)
9374
- break;
9078
+ if (frame == frameLast) break;
9375
9079
  let time2 = input.readFloat();
9376
9080
  let a2 = input.readUnsignedByte() / 255;
9377
9081
  switch (input.readByte()) {
@@ -9443,8 +9147,7 @@ var spine = (() => {
9443
9147
  let softness = (flags & 4) != 0 ? input.readFloat() * scale : 0;
9444
9148
  for (let frame = 0, bezier = 0; ; frame++) {
9445
9149
  timeline.setFrame(frame, time, mix, softness, (flags & 8) != 0 ? 1 : -1, (flags & 16) != 0, (flags & 32) != 0);
9446
- if (frame == frameLast)
9447
- break;
9150
+ if (frame == frameLast) break;
9448
9151
  flags = input.readByte();
9449
9152
  const time2 = input.readFloat(), mix2 = (flags & 1) != 0 ? (flags & 2) != 0 ? input.readFloat() : 1 : 0;
9450
9153
  const softness2 = (flags & 4) != 0 ? input.readFloat() * scale : 0;
@@ -9466,8 +9169,7 @@ var spine = (() => {
9466
9169
  let time = input.readFloat(), mixRotate = input.readFloat(), mixX = input.readFloat(), mixY = input.readFloat(), mixScaleX = input.readFloat(), mixScaleY = input.readFloat(), mixShearY = input.readFloat();
9467
9170
  for (let frame = 0, bezier = 0; ; frame++) {
9468
9171
  timeline.setFrame(frame, time, mixRotate, mixX, mixY, mixScaleX, mixScaleY, mixShearY);
9469
- if (frame == frameLast)
9470
- break;
9172
+ if (frame == frameLast) break;
9471
9173
  let time2 = input.readFloat(), mixRotate2 = input.readFloat(), mixX2 = input.readFloat(), mixY2 = input.readFloat(), mixScaleX2 = input.readFloat(), mixScaleY2 = input.readFloat(), mixShearY2 = input.readFloat();
9472
9174
  switch (input.readByte()) {
9473
9175
  case CURVE_STEPPED:
@@ -9516,8 +9218,7 @@ var spine = (() => {
9516
9218
  let time = input.readFloat(), mixRotate = input.readFloat(), mixX = input.readFloat(), mixY = input.readFloat();
9517
9219
  for (let frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1; ; frame++) {
9518
9220
  timeline.setFrame(frame, time, mixRotate, mixX, mixY);
9519
- if (frame == frameLast)
9520
- break;
9221
+ if (frame == frameLast) break;
9521
9222
  let time2 = input.readFloat(), mixRotate2 = input.readFloat(), mixX2 = input.readFloat(), mixY2 = input.readFloat();
9522
9223
  switch (input.readByte()) {
9523
9224
  case CURVE_STEPPED:
@@ -9579,8 +9280,7 @@ var spine = (() => {
9579
9280
  let slotIndex = input.readInt(true);
9580
9281
  for (let iii = 0, nnn = input.readInt(true); iii < nnn; iii++) {
9581
9282
  let attachmentName = input.readStringRef();
9582
- if (!attachmentName)
9583
- throw new Error("attachmentName must not be null.");
9283
+ if (!attachmentName) throw new Error("attachmentName must not be null.");
9584
9284
  let attachment = skin.getAttachment(slotIndex, attachmentName);
9585
9285
  let timelineType = input.readByte();
9586
9286
  let frameCount = input.readInt(true);
@@ -9616,8 +9316,7 @@ var spine = (() => {
9616
9316
  }
9617
9317
  }
9618
9318
  timeline.setFrame(frame, time, deform);
9619
- if (frame == frameLast)
9620
- break;
9319
+ if (frame == frameLast) break;
9621
9320
  let time2 = input.readFloat();
9622
9321
  switch (input.readByte()) {
9623
9322
  case CURVE_STEPPED:
@@ -9672,8 +9371,7 @@ var spine = (() => {
9672
9371
  while (originalIndex < slotCount)
9673
9372
  unchanged[unchangedIndex++] = originalIndex++;
9674
9373
  for (let ii = slotCount - 1; ii >= 0; ii--)
9675
- if (drawOrder[ii] == -1)
9676
- drawOrder[ii] = unchanged[--unchangedIndex];
9374
+ if (drawOrder[ii] == -1) drawOrder[ii] = unchanged[--unchangedIndex];
9677
9375
  timeline.setFrame(i, time, drawOrder);
9678
9376
  }
9679
9377
  timelines.push(timeline);
@@ -9688,8 +9386,7 @@ var spine = (() => {
9688
9386
  event.intValue = input.readInt(false);
9689
9387
  event.floatValue = input.readFloat();
9690
9388
  event.stringValue = input.readString();
9691
- if (event.stringValue == null)
9692
- event.stringValue = eventData.stringValue;
9389
+ if (event.stringValue == null) event.stringValue = eventData.stringValue;
9693
9390
  if (event.data.audioPath) {
9694
9391
  event.volume = input.readFloat();
9695
9392
  event.balance = input.readFloat();
@@ -9811,22 +9508,11 @@ var spine = (() => {
9811
9508
  this.length = length;
9812
9509
  }
9813
9510
  };
9814
- var AttachmentType = /* @__PURE__ */ ((AttachmentType2) => {
9815
- AttachmentType2[AttachmentType2["Region"] = 0] = "Region";
9816
- AttachmentType2[AttachmentType2["BoundingBox"] = 1] = "BoundingBox";
9817
- AttachmentType2[AttachmentType2["Mesh"] = 2] = "Mesh";
9818
- AttachmentType2[AttachmentType2["LinkedMesh"] = 3] = "LinkedMesh";
9819
- AttachmentType2[AttachmentType2["Path"] = 4] = "Path";
9820
- AttachmentType2[AttachmentType2["Point"] = 5] = "Point";
9821
- AttachmentType2[AttachmentType2["Clipping"] = 6] = "Clipping";
9822
- return AttachmentType2;
9823
- })(AttachmentType || {});
9824
9511
  function readTimeline1(input, timeline, scale) {
9825
9512
  let time = input.readFloat(), value = input.readFloat() * scale;
9826
9513
  for (let frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1; ; frame++) {
9827
9514
  timeline.setFrame(frame, time, value);
9828
- if (frame == frameLast)
9829
- break;
9515
+ if (frame == frameLast) break;
9830
9516
  let time2 = input.readFloat(), value2 = input.readFloat() * scale;
9831
9517
  switch (input.readByte()) {
9832
9518
  case CURVE_STEPPED:
@@ -9844,8 +9530,7 @@ var spine = (() => {
9844
9530
  let time = input.readFloat(), value1 = input.readFloat() * scale, value2 = input.readFloat() * scale;
9845
9531
  for (let frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1; ; frame++) {
9846
9532
  timeline.setFrame(frame, time, value1, value2);
9847
- if (frame == frameLast)
9848
- break;
9533
+ if (frame == frameLast) break;
9849
9534
  let time2 = input.readFloat(), nvalue1 = input.readFloat() * scale, nvalue2 = input.readFloat() * scale;
9850
9535
  switch (input.readByte()) {
9851
9536
  case CURVE_STEPPED:
@@ -9919,8 +9604,7 @@ var spine = (() => {
9919
9604
  * @param updateAabb If true, the axis aligned bounding box containing all the polygons is computed. If false, the
9920
9605
  * SkeletonBounds AABB methods will always return true. */
9921
9606
  update(skeleton, updateAabb) {
9922
- if (!skeleton)
9923
- throw new Error("skeleton cannot be null.");
9607
+ if (!skeleton) throw new Error("skeleton cannot be null.");
9924
9608
  let boundingBoxes = this.boundingBoxes;
9925
9609
  let polygons = this.polygons;
9926
9610
  let polygonPool = this.polygonPool;
@@ -9931,8 +9615,7 @@ var spine = (() => {
9931
9615
  polygons.length = 0;
9932
9616
  for (let i = 0; i < slotCount; i++) {
9933
9617
  let slot = slots[i];
9934
- if (!slot.bone.active)
9935
- continue;
9618
+ if (!slot.bone.active) continue;
9936
9619
  let attachment = slot.getAttachment();
9937
9620
  if (attachment instanceof BoundingBoxAttachment) {
9938
9621
  let boundingBox = attachment;
@@ -9988,17 +9671,13 @@ var spine = (() => {
9988
9671
  return false;
9989
9672
  let m = (y2 - y1) / (x2 - x1);
9990
9673
  let y = m * (minX - x1) + y1;
9991
- if (y > minY && y < maxY)
9992
- return true;
9674
+ if (y > minY && y < maxY) return true;
9993
9675
  y = m * (maxX - x1) + y1;
9994
- if (y > minY && y < maxY)
9995
- return true;
9676
+ if (y > minY && y < maxY) return true;
9996
9677
  let x = (minY - y1) / m + x1;
9997
- if (x > minX && x < maxX)
9998
- return true;
9678
+ if (x > minX && x < maxX) return true;
9999
9679
  x = (maxY - y1) / m + x1;
10000
- if (x > minX && x < maxX)
10001
- return true;
9680
+ if (x > minX && x < maxX) return true;
10002
9681
  return false;
10003
9682
  }
10004
9683
  /** Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds. */
@@ -10010,8 +9689,7 @@ var spine = (() => {
10010
9689
  containsPoint(x, y) {
10011
9690
  let polygons = this.polygons;
10012
9691
  for (let i = 0, n = polygons.length; i < n; i++)
10013
- if (this.containsPointPolygon(polygons[i], x, y))
10014
- return this.boundingBoxes[i];
9692
+ if (this.containsPointPolygon(polygons[i], x, y)) return this.boundingBoxes[i];
10015
9693
  return null;
10016
9694
  }
10017
9695
  /** Returns true if the polygon contains the point. */
@@ -10025,8 +9703,7 @@ var spine = (() => {
10025
9703
  let prevY = vertices[prevIndex + 1];
10026
9704
  if (vertexY < y && prevY >= y || prevY < y && vertexY >= y) {
10027
9705
  let vertexX = vertices[ii];
10028
- if (vertexX + (y - vertexY) / (prevY - vertexY) * (vertices[prevIndex] - vertexX) < x)
10029
- inside = !inside;
9706
+ if (vertexX + (y - vertexY) / (prevY - vertexY) * (vertices[prevIndex] - vertexX) < x) inside = !inside;
10030
9707
  }
10031
9708
  prevIndex = ii;
10032
9709
  }
@@ -10038,8 +9715,7 @@ var spine = (() => {
10038
9715
  intersectsSegment(x1, y1, x2, y2) {
10039
9716
  let polygons = this.polygons;
10040
9717
  for (let i = 0, n = polygons.length; i < n; i++)
10041
- if (this.intersectsSegmentPolygon(polygons[i], x1, y1, x2, y2))
10042
- return this.boundingBoxes[i];
9718
+ if (this.intersectsSegmentPolygon(polygons[i], x1, y1, x2, y2)) return this.boundingBoxes[i];
10043
9719
  return null;
10044
9720
  }
10045
9721
  /** Returns true if the polygon contains any part of the line segment. */
@@ -10057,8 +9733,7 @@ var spine = (() => {
10057
9733
  let x = (det1 * width34 - width12 * det2) / det3;
10058
9734
  if ((x >= x3 && x <= x4 || x >= x4 && x <= x3) && (x >= x1 && x <= x2 || x >= x2 && x <= x1)) {
10059
9735
  let y = (det1 * height34 - height12 * det2) / det3;
10060
- if ((y >= y3 && y <= y4 || y >= y4 && y <= y3) && (y >= y1 && y <= y2 || y >= y2 && y <= y1))
10061
- return true;
9736
+ if ((y >= y3 && y <= y4 || y >= y4 && y <= y3) && (y >= y1 && y <= y2 || y >= y2 && y <= y1)) return true;
10062
9737
  }
10063
9738
  x3 = x4;
10064
9739
  y3 = y4;
@@ -10067,8 +9742,7 @@ var spine = (() => {
10067
9742
  }
10068
9743
  /** Returns the polygon for the specified bounding box, or null. */
10069
9744
  getPolygon(boundingBox) {
10070
- if (!boundingBox)
10071
- throw new Error("boundingBox cannot be null.");
9745
+ if (!boundingBox) throw new Error("boundingBox cannot be null.");
10072
9746
  let index = this.boundingBoxes.indexOf(boundingBox);
10073
9747
  return index == -1 ? null : this.polygons[index];
10074
9748
  }
@@ -10083,7 +9757,7 @@ var spine = (() => {
10083
9757
  };
10084
9758
 
10085
9759
  // spine-core/src/Triangulator.ts
10086
- var Triangulator = class {
9760
+ var Triangulator = class _Triangulator {
10087
9761
  convexPolygons = new Array();
10088
9762
  convexPolygonsIndices = new Array();
10089
9763
  indicesArray = new Array();
@@ -10105,7 +9779,7 @@ var spine = (() => {
10105
9779
  let isConcave = this.isConcaveArray;
10106
9780
  isConcave.length = 0;
10107
9781
  for (let i = 0, n = vertexCount; i < n; ++i)
10108
- isConcave[i] = Triangulator.isConcave(i, vertexCount, vertices, indices);
9782
+ isConcave[i] = _Triangulator.isConcave(i, vertexCount, vertices, indices);
10109
9783
  let triangles = this.triangles;
10110
9784
  triangles.length = 0;
10111
9785
  while (vertexCount > 3) {
@@ -10118,14 +9792,12 @@ var spine = (() => {
10118
9792
  let p2x = vertices[p2], p2y = vertices[p2 + 1];
10119
9793
  let p3x = vertices[p3], p3y = vertices[p3 + 1];
10120
9794
  for (let ii = (next + 1) % vertexCount; ii != previous; ii = (ii + 1) % vertexCount) {
10121
- if (!isConcave[ii])
10122
- continue;
9795
+ if (!isConcave[ii]) continue;
10123
9796
  let v = indices[ii] << 1;
10124
9797
  let vx = vertices[v], vy = vertices[v + 1];
10125
- if (Triangulator.positiveArea(p3x, p3y, p1x, p1y, vx, vy)) {
10126
- if (Triangulator.positiveArea(p1x, p1y, p2x, p2y, vx, vy)) {
10127
- if (Triangulator.positiveArea(p2x, p2y, p3x, p3y, vx, vy))
10128
- 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;
10129
9801
  }
10130
9802
  }
10131
9803
  }
@@ -10133,8 +9805,7 @@ var spine = (() => {
10133
9805
  }
10134
9806
  if (next == 0) {
10135
9807
  do {
10136
- if (!isConcave[i])
10137
- break;
9808
+ if (!isConcave[i]) break;
10138
9809
  i--;
10139
9810
  } while (i > 0);
10140
9811
  break;
@@ -10151,8 +9822,8 @@ var spine = (() => {
10151
9822
  vertexCount--;
10152
9823
  let previousIndex = (vertexCount + i - 1) % vertexCount;
10153
9824
  let nextIndex = i == vertexCount ? 0 : i;
10154
- isConcave[previousIndex] = Triangulator.isConcave(previousIndex, vertexCount, vertices, indices);
10155
- 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);
10156
9827
  }
10157
9828
  if (vertexCount == 3) {
10158
9829
  triangles.push(indices[2]);
@@ -10182,8 +9853,8 @@ var spine = (() => {
10182
9853
  let merged = false;
10183
9854
  if (fanBaseIndex == t1) {
10184
9855
  let o = polygon.length - 4;
10185
- let winding1 = Triangulator.winding(polygon[o], polygon[o + 1], polygon[o + 2], polygon[o + 3], x3, y3);
10186
- 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]);
10187
9858
  if (winding1 == lastWinding && winding2 == lastWinding) {
10188
9859
  polygon.push(x3);
10189
9860
  polygon.push(y3);
@@ -10212,7 +9883,7 @@ var spine = (() => {
10212
9883
  polygonIndices.push(t1);
10213
9884
  polygonIndices.push(t2);
10214
9885
  polygonIndices.push(t3);
10215
- lastWinding = Triangulator.winding(x1, y1, x2, y2, x3, y3);
9886
+ lastWinding = _Triangulator.winding(x1, y1, x2, y2, x3, y3);
10216
9887
  fanBaseIndex = t1;
10217
9888
  }
10218
9889
  }
@@ -10222,8 +9893,7 @@ var spine = (() => {
10222
9893
  }
10223
9894
  for (let i = 0, n = convexPolygons.length; i < n; i++) {
10224
9895
  polygonIndices = convexPolygonsIndices[i];
10225
- if (polygonIndices.length == 0)
10226
- continue;
9896
+ if (polygonIndices.length == 0) continue;
10227
9897
  let firstIndex = polygonIndices[0];
10228
9898
  let lastIndex = polygonIndices[polygonIndices.length - 1];
10229
9899
  polygon = convexPolygons[i];
@@ -10232,22 +9902,19 @@ var spine = (() => {
10232
9902
  let prevX = polygon[o + 2], prevY = polygon[o + 3];
10233
9903
  let firstX = polygon[0], firstY = polygon[1];
10234
9904
  let secondX = polygon[2], secondY = polygon[3];
10235
- let winding = Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, firstX, firstY);
9905
+ let winding = _Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, firstX, firstY);
10236
9906
  for (let ii = 0; ii < n; ii++) {
10237
- if (ii == i)
10238
- continue;
9907
+ if (ii == i) continue;
10239
9908
  let otherIndices = convexPolygonsIndices[ii];
10240
- if (otherIndices.length != 3)
10241
- continue;
9909
+ if (otherIndices.length != 3) continue;
10242
9910
  let otherFirstIndex = otherIndices[0];
10243
9911
  let otherSecondIndex = otherIndices[1];
10244
9912
  let otherLastIndex = otherIndices[2];
10245
9913
  let otherPoly = convexPolygons[ii];
10246
9914
  let x3 = otherPoly[otherPoly.length - 2], y3 = otherPoly[otherPoly.length - 1];
10247
- if (otherFirstIndex != firstIndex || otherSecondIndex != lastIndex)
10248
- continue;
10249
- let winding1 = Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, x3, y3);
10250
- 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);
10251
9918
  if (winding1 == winding && winding2 == winding) {
10252
9919
  otherPoly.length = 0;
10253
9920
  otherIndices.length = 0;
@@ -10297,7 +9964,7 @@ var spine = (() => {
10297
9964
  };
10298
9965
 
10299
9966
  // spine-core/src/SkeletonClipping.ts
10300
- var SkeletonClipping = class {
9967
+ var SkeletonClipping = class _SkeletonClipping {
10301
9968
  triangulator = new Triangulator();
10302
9969
  clippingPolygon = new Array();
10303
9970
  clipOutput = new Array();
@@ -10308,30 +9975,27 @@ var spine = (() => {
10308
9975
  clipAttachment = null;
10309
9976
  clippingPolygons = null;
10310
9977
  clipStart(slot, clip) {
10311
- if (this.clipAttachment)
10312
- return 0;
9978
+ if (this.clipAttachment) return 0;
10313
9979
  this.clipAttachment = clip;
10314
9980
  let n = clip.worldVerticesLength;
10315
9981
  let vertices = Utils.setArraySize(this.clippingPolygon, n);
10316
9982
  clip.computeWorldVertices(slot, 0, n, vertices, 0, 2);
10317
9983
  let clippingPolygon = this.clippingPolygon;
10318
- SkeletonClipping.makeClockwise(clippingPolygon);
9984
+ _SkeletonClipping.makeClockwise(clippingPolygon);
10319
9985
  let clippingPolygons = this.clippingPolygons = this.triangulator.decompose(clippingPolygon, this.triangulator.triangulate(clippingPolygon));
10320
9986
  for (let i = 0, n2 = clippingPolygons.length; i < n2; i++) {
10321
9987
  let polygon = clippingPolygons[i];
10322
- SkeletonClipping.makeClockwise(polygon);
9988
+ _SkeletonClipping.makeClockwise(polygon);
10323
9989
  polygon.push(polygon[0]);
10324
9990
  polygon.push(polygon[1]);
10325
9991
  }
10326
9992
  return clippingPolygons.length;
10327
9993
  }
10328
9994
  clipEndWithSlot(slot) {
10329
- if (this.clipAttachment && this.clipAttachment.endSlot == slot.data)
10330
- this.clipEnd();
9995
+ if (this.clipAttachment && this.clipAttachment.endSlot == slot.data) this.clipEnd();
10331
9996
  }
10332
9997
  clipEnd() {
10333
- if (!this.clipAttachment)
10334
- return;
9998
+ if (!this.clipAttachment) return;
10335
9999
  this.clipAttachment = null;
10336
10000
  this.clippingPolygons = null;
10337
10001
  this.clippedVertices.length = 0;
@@ -10387,8 +10051,7 @@ var spine = (() => {
10387
10051
  let s = clippedVertices.length;
10388
10052
  if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {
10389
10053
  let clipOutputLength = clipOutput.length;
10390
- if (clipOutputLength == 0)
10391
- continue;
10054
+ if (clipOutputLength == 0) continue;
10392
10055
  let clipOutputCount = clipOutputLength >> 1;
10393
10056
  let clipOutputItems = this.clipOutput;
10394
10057
  let clippedVerticesItems = Utils.setArraySize(clippedVertices, s + clipOutputCount * 2);
@@ -10448,8 +10111,7 @@ var spine = (() => {
10448
10111
  let s = clippedVertices.length;
10449
10112
  if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {
10450
10113
  let clipOutputLength = clipOutput.length;
10451
- if (clipOutputLength == 0)
10452
- continue;
10114
+ if (clipOutputLength == 0) continue;
10453
10115
  let d0 = y2 - y3, d1 = x3 - x2, d2 = x1 - x3, d4 = y3 - y1;
10454
10116
  let d = 1 / (d0 * d2 + d1 * (y1 - y3));
10455
10117
  let clipOutputCount = clipOutputLength >> 1;
@@ -10578,8 +10240,7 @@ var spine = (() => {
10578
10240
  let s = clippedVertices.length;
10579
10241
  if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {
10580
10242
  let clipOutputLength = clipOutput.length;
10581
- if (clipOutputLength == 0)
10582
- continue;
10243
+ if (clipOutputLength == 0) continue;
10583
10244
  let d0 = y2 - y3, d1 = x3 - x2, d2 = x1 - x3, d4 = y3 - y1;
10584
10245
  let d = 1 / (d0 * d2 + d1 * (y1 - y3));
10585
10246
  let clipOutputCount = clipOutputLength >> 1;
@@ -10702,8 +10363,7 @@ var spine = (() => {
10702
10363
  }
10703
10364
  output.push(output[0]);
10704
10365
  output.push(output[1]);
10705
- if (i == clippingVerticesLast)
10706
- break;
10366
+ if (i == clippingVerticesLast) break;
10707
10367
  let temp = output;
10708
10368
  output = input;
10709
10369
  output.length = 0;
@@ -10728,8 +10388,7 @@ var spine = (() => {
10728
10388
  p2y = vertices[i + 3];
10729
10389
  area += p1x * p2y - p2x * p1y;
10730
10390
  }
10731
- if (area < 0)
10732
- return;
10391
+ if (area < 0) return;
10733
10392
  for (let i = 0, lastX = verticeslength - 2, n = verticeslength >> 1; i < n; i += 2) {
10734
10393
  let x = vertices[i], y = vertices[i + 1];
10735
10394
  let other = lastX - i;
@@ -10775,8 +10434,7 @@ var spine = (() => {
10775
10434
  let boneMap = root.bones[i];
10776
10435
  let parent = null;
10777
10436
  let parentName = getValue(boneMap, "parent", null);
10778
- if (parentName)
10779
- parent = skeletonData.findBone(parentName);
10437
+ if (parentName) parent = skeletonData.findBone(parentName);
10780
10438
  let data = new BoneData(skeletonData.bones.length, boneMap.name, parent);
10781
10439
  data.length = getValue(boneMap, "length", 0) * scale;
10782
10440
  data.x = getValue(boneMap, "x", 0) * scale;
@@ -10789,8 +10447,7 @@ var spine = (() => {
10789
10447
  data.inherit = Utils.enumValue(Inherit, getValue(boneMap, "inherit", "Normal"));
10790
10448
  data.skinRequired = getValue(boneMap, "skin", false);
10791
10449
  let color = getValue(boneMap, "color", null);
10792
- if (color)
10793
- data.color.setFromString(color);
10450
+ if (color) data.color.setFromString(color);
10794
10451
  skeletonData.bones.push(data);
10795
10452
  }
10796
10453
  }
@@ -10799,15 +10456,12 @@ var spine = (() => {
10799
10456
  let slotMap = root.slots[i];
10800
10457
  let slotName = slotMap.name;
10801
10458
  let boneData = skeletonData.findBone(slotMap.bone);
10802
- if (!boneData)
10803
- 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}`);
10804
10460
  let data = new SlotData(skeletonData.slots.length, slotName, boneData);
10805
10461
  let color = getValue(slotMap, "color", null);
10806
- if (color)
10807
- data.color.setFromString(color);
10462
+ if (color) data.color.setFromString(color);
10808
10463
  let dark = getValue(slotMap, "dark", null);
10809
- if (dark)
10810
- data.darkColor = Color.fromString(dark);
10464
+ if (dark) data.darkColor = Color.fromString(dark);
10811
10465
  data.attachmentName = getValue(slotMap, "attachment", null);
10812
10466
  data.blendMode = Utils.enumValue(BlendMode, getValue(slotMap, "blend", "normal"));
10813
10467
  data.visible = getValue(slotMap, "visible", true);
@@ -10822,14 +10476,12 @@ var spine = (() => {
10822
10476
  data.skinRequired = getValue(constraintMap, "skin", false);
10823
10477
  for (let ii = 0; ii < constraintMap.bones.length; ii++) {
10824
10478
  let bone = skeletonData.findBone(constraintMap.bones[ii]);
10825
- if (!bone)
10826
- 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}.`);
10827
10480
  data.bones.push(bone);
10828
10481
  }
10829
10482
  let target = skeletonData.findBone(constraintMap.target);
10830
10483
  ;
10831
- if (!target)
10832
- 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}.`);
10833
10485
  data.target = target;
10834
10486
  data.mix = getValue(constraintMap, "mix", 1);
10835
10487
  data.softness = getValue(constraintMap, "softness", 0) * scale;
@@ -10849,14 +10501,12 @@ var spine = (() => {
10849
10501
  for (let ii = 0; ii < constraintMap.bones.length; ii++) {
10850
10502
  let boneName = constraintMap.bones[ii];
10851
10503
  let bone = skeletonData.findBone(boneName);
10852
- if (!bone)
10853
- 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}.`);
10854
10505
  data.bones.push(bone);
10855
10506
  }
10856
10507
  let targetName = constraintMap.target;
10857
10508
  let target = skeletonData.findBone(targetName);
10858
- if (!target)
10859
- 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}.`);
10860
10510
  data.target = target;
10861
10511
  data.local = getValue(constraintMap, "local", false);
10862
10512
  data.relative = getValue(constraintMap, "relative", false);
@@ -10884,25 +10534,21 @@ var spine = (() => {
10884
10534
  for (let ii = 0; ii < constraintMap.bones.length; ii++) {
10885
10535
  let boneName = constraintMap.bones[ii];
10886
10536
  let bone = skeletonData.findBone(boneName);
10887
- if (!bone)
10888
- 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}.`);
10889
10538
  data.bones.push(bone);
10890
10539
  }
10891
10540
  let targetName = constraintMap.target;
10892
10541
  let target = skeletonData.findSlot(targetName);
10893
- if (!target)
10894
- 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}.`);
10895
10543
  data.target = target;
10896
10544
  data.positionMode = Utils.enumValue(PositionMode, getValue(constraintMap, "positionMode", "Percent"));
10897
10545
  data.spacingMode = Utils.enumValue(SpacingMode, getValue(constraintMap, "spacingMode", "Length"));
10898
10546
  data.rotateMode = Utils.enumValue(RotateMode, getValue(constraintMap, "rotateMode", "Tangent"));
10899
10547
  data.offsetRotation = getValue(constraintMap, "rotation", 0);
10900
10548
  data.position = getValue(constraintMap, "position", 0);
10901
- if (data.positionMode == 0 /* Fixed */)
10902
- data.position *= scale;
10549
+ if (data.positionMode == 0 /* Fixed */) data.position *= scale;
10903
10550
  data.spacing = getValue(constraintMap, "spacing", 0);
10904
- if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */)
10905
- data.spacing *= scale;
10551
+ if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */) data.spacing *= scale;
10906
10552
  data.mixRotate = getValue(constraintMap, "mixRotate", 1);
10907
10553
  data.mixX = getValue(constraintMap, "mixX", 1);
10908
10554
  data.mixY = getValue(constraintMap, "mixY", data.mixX);
@@ -10917,8 +10563,7 @@ var spine = (() => {
10917
10563
  data.skinRequired = getValue(constraintMap, "skin", false);
10918
10564
  const boneName = constraintMap.bone;
10919
10565
  const bone = skeletonData.findBone(boneName);
10920
- if (bone == null)
10921
- throw new Error("Physics bone not found: " + boneName);
10566
+ if (bone == null) throw new Error("Physics bone not found: " + boneName);
10922
10567
  data.bone = bone;
10923
10568
  data.x = getValue(constraintMap, "x", 0);
10924
10569
  data.y = getValue(constraintMap, "y", 0);
@@ -10952,8 +10597,7 @@ var spine = (() => {
10952
10597
  for (let ii = 0; ii < skinMap.bones.length; ii++) {
10953
10598
  let boneName = skinMap.bones[ii];
10954
10599
  let bone = skeletonData.findBone(boneName);
10955
- if (!bone)
10956
- 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}.`);
10957
10601
  skin.bones.push(bone);
10958
10602
  }
10959
10603
  }
@@ -10961,8 +10605,7 @@ var spine = (() => {
10961
10605
  for (let ii = 0; ii < skinMap.ik.length; ii++) {
10962
10606
  let constraintName = skinMap.ik[ii];
10963
10607
  let constraint = skeletonData.findIkConstraint(constraintName);
10964
- if (!constraint)
10965
- 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}.`);
10966
10609
  skin.constraints.push(constraint);
10967
10610
  }
10968
10611
  }
@@ -10970,8 +10613,7 @@ var spine = (() => {
10970
10613
  for (let ii = 0; ii < skinMap.transform.length; ii++) {
10971
10614
  let constraintName = skinMap.transform[ii];
10972
10615
  let constraint = skeletonData.findTransformConstraint(constraintName);
10973
- if (!constraint)
10974
- 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}.`);
10975
10617
  skin.constraints.push(constraint);
10976
10618
  }
10977
10619
  }
@@ -10979,8 +10621,7 @@ var spine = (() => {
10979
10621
  for (let ii = 0; ii < skinMap.path.length; ii++) {
10980
10622
  let constraintName = skinMap.path[ii];
10981
10623
  let constraint = skeletonData.findPathConstraint(constraintName);
10982
- if (!constraint)
10983
- 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}.`);
10984
10625
  skin.constraints.push(constraint);
10985
10626
  }
10986
10627
  }
@@ -10988,39 +10629,32 @@ var spine = (() => {
10988
10629
  for (let ii = 0; ii < skinMap.physics.length; ii++) {
10989
10630
  let constraintName = skinMap.physics[ii];
10990
10631
  let constraint = skeletonData.findPhysicsConstraint(constraintName);
10991
- if (!constraint)
10992
- 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}.`);
10993
10633
  skin.constraints.push(constraint);
10994
10634
  }
10995
10635
  }
10996
10636
  for (let slotName in skinMap.attachments) {
10997
10637
  let slot = skeletonData.findSlot(slotName);
10998
- if (!slot)
10999
- 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}.`);
11000
10639
  let slotMap = skinMap.attachments[slotName];
11001
10640
  for (let entryName in slotMap) {
11002
10641
  let attachment = this.readAttachment(slotMap[entryName], skin, slot.index, entryName, skeletonData);
11003
- if (attachment)
11004
- skin.setAttachment(slot.index, entryName, attachment);
10642
+ if (attachment) skin.setAttachment(slot.index, entryName, attachment);
11005
10643
  }
11006
10644
  }
11007
10645
  skeletonData.skins.push(skin);
11008
- if (skin.name == "default")
11009
- skeletonData.defaultSkin = skin;
10646
+ if (skin.name == "default") skeletonData.defaultSkin = skin;
11010
10647
  }
11011
10648
  }
11012
10649
  for (let i = 0, n = this.linkedMeshes.length; i < n; i++) {
11013
10650
  let linkedMesh = this.linkedMeshes[i];
11014
10651
  let skin = !linkedMesh.skin ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);
11015
- if (!skin)
11016
- throw new Error(`Skin not found: ${linkedMesh.skin}`);
10652
+ if (!skin) throw new Error(`Skin not found: ${linkedMesh.skin}`);
11017
10653
  let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
11018
- if (!parent)
11019
- throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
10654
+ if (!parent) throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
11020
10655
  linkedMesh.mesh.timelineAttachment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
11021
10656
  linkedMesh.mesh.setParentMesh(parent);
11022
- if (linkedMesh.mesh.region != null)
11023
- linkedMesh.mesh.updateRegion();
10657
+ if (linkedMesh.mesh.region != null) linkedMesh.mesh.updateRegion();
11024
10658
  }
11025
10659
  this.linkedMeshes.length = 0;
11026
10660
  if (root.events) {
@@ -11054,8 +10688,7 @@ var spine = (() => {
11054
10688
  let path = getValue(map, "path", name);
11055
10689
  let sequence = this.readSequence(getValue(map, "sequence", null));
11056
10690
  let region = this.attachmentLoader.newRegionAttachment(skin, name, path, sequence);
11057
- if (!region)
11058
- return null;
10691
+ if (!region) return null;
11059
10692
  region.path = path;
11060
10693
  region.x = getValue(map, "x", 0) * scale;
11061
10694
  region.y = getValue(map, "y", 0) * scale;
@@ -11066,20 +10699,16 @@ var spine = (() => {
11066
10699
  region.height = map.height * scale;
11067
10700
  region.sequence = sequence;
11068
10701
  let color = getValue(map, "color", null);
11069
- if (color)
11070
- region.color.setFromString(color);
11071
- if (region.region != null)
11072
- region.updateRegion();
10702
+ if (color) region.color.setFromString(color);
10703
+ if (region.region != null) region.updateRegion();
11073
10704
  return region;
11074
10705
  }
11075
10706
  case "boundingbox": {
11076
10707
  let box = this.attachmentLoader.newBoundingBoxAttachment(skin, name);
11077
- if (!box)
11078
- return null;
10708
+ if (!box) return null;
11079
10709
  this.readVertices(map, box, map.vertexCount << 1);
11080
10710
  let color = getValue(map, "color", null);
11081
- if (color)
11082
- box.color.setFromString(color);
10711
+ if (color) box.color.setFromString(color);
11083
10712
  return box;
11084
10713
  }
11085
10714
  case "mesh":
@@ -11087,12 +10716,10 @@ var spine = (() => {
11087
10716
  let path = getValue(map, "path", name);
11088
10717
  let sequence = this.readSequence(getValue(map, "sequence", null));
11089
10718
  let mesh = this.attachmentLoader.newMeshAttachment(skin, name, path, sequence);
11090
- if (!mesh)
11091
- return null;
10719
+ if (!mesh) return null;
11092
10720
  mesh.path = path;
11093
10721
  let color = getValue(map, "color", null);
11094
- if (color)
11095
- mesh.color.setFromString(color);
10722
+ if (color) mesh.color.setFromString(color);
11096
10723
  mesh.width = getValue(map, "width", 0) * scale;
11097
10724
  mesh.height = getValue(map, "height", 0) * scale;
11098
10725
  mesh.sequence = sequence;
@@ -11105,16 +10732,14 @@ var spine = (() => {
11105
10732
  this.readVertices(map, mesh, uvs.length);
11106
10733
  mesh.triangles = map.triangles;
11107
10734
  mesh.regionUVs = uvs;
11108
- if (mesh.region != null)
11109
- mesh.updateRegion();
10735
+ if (mesh.region != null) mesh.updateRegion();
11110
10736
  mesh.edges = getValue(map, "edges", null);
11111
10737
  mesh.hullLength = getValue(map, "hull", 0) * 2;
11112
10738
  return mesh;
11113
10739
  }
11114
10740
  case "path": {
11115
10741
  let path = this.attachmentLoader.newPathAttachment(skin, name);
11116
- if (!path)
11117
- return null;
10742
+ if (!path) return null;
11118
10743
  path.closed = getValue(map, "closed", false);
11119
10744
  path.constantSpeed = getValue(map, "constantSpeed", true);
11120
10745
  let vertexCount = map.vertexCount;
@@ -11124,42 +10749,35 @@ var spine = (() => {
11124
10749
  lengths[i] = map.lengths[i] * scale;
11125
10750
  path.lengths = lengths;
11126
10751
  let color = getValue(map, "color", null);
11127
- if (color)
11128
- path.color.setFromString(color);
10752
+ if (color) path.color.setFromString(color);
11129
10753
  return path;
11130
10754
  }
11131
10755
  case "point": {
11132
10756
  let point = this.attachmentLoader.newPointAttachment(skin, name);
11133
- if (!point)
11134
- return null;
10757
+ if (!point) return null;
11135
10758
  point.x = getValue(map, "x", 0) * scale;
11136
10759
  point.y = getValue(map, "y", 0) * scale;
11137
10760
  point.rotation = getValue(map, "rotation", 0);
11138
10761
  let color = getValue(map, "color", null);
11139
- if (color)
11140
- point.color.setFromString(color);
10762
+ if (color) point.color.setFromString(color);
11141
10763
  return point;
11142
10764
  }
11143
10765
  case "clipping": {
11144
10766
  let clip = this.attachmentLoader.newClippingAttachment(skin, name);
11145
- if (!clip)
11146
- return null;
10767
+ if (!clip) return null;
11147
10768
  let end = getValue(map, "end", null);
11148
- if (end)
11149
- clip.endSlot = skeletonData.findSlot(end);
10769
+ if (end) clip.endSlot = skeletonData.findSlot(end);
11150
10770
  let vertexCount = map.vertexCount;
11151
10771
  this.readVertices(map, clip, vertexCount << 1);
11152
10772
  let color = getValue(map, "color", null);
11153
- if (color)
11154
- clip.color.setFromString(color);
10773
+ if (color) clip.color.setFromString(color);
11155
10774
  return clip;
11156
10775
  }
11157
10776
  }
11158
10777
  return null;
11159
10778
  }
11160
10779
  readSequence(map) {
11161
- if (map == null)
11162
- return null;
10780
+ if (map == null) return null;
11163
10781
  let sequence = new Sequence(getValue(map, "count", 0));
11164
10782
  sequence.start = getValue(map, "start", 1);
11165
10783
  sequence.digits = getValue(map, "digits", 0);
@@ -11201,13 +10819,11 @@ var spine = (() => {
11201
10819
  for (let slotName in map.slots) {
11202
10820
  let slotMap = map.slots[slotName];
11203
10821
  let slot = skeletonData.findSlot(slotName);
11204
- if (!slot)
11205
- throw new Error("Slot not found: " + slotName);
10822
+ if (!slot) throw new Error("Slot not found: " + slotName);
11206
10823
  let slotIndex = slot.index;
11207
10824
  for (let timelineName in slotMap) {
11208
10825
  let timelineMap = slotMap[timelineName];
11209
- if (!timelineMap)
11210
- continue;
10826
+ if (!timelineMap) continue;
11211
10827
  let frames = timelineMap.length;
11212
10828
  if (timelineName == "attachment") {
11213
10829
  let timeline = new AttachmentTimeline(frames, slotIndex);
@@ -11340,14 +10956,12 @@ var spine = (() => {
11340
10956
  for (let boneName in map.bones) {
11341
10957
  let boneMap = map.bones[boneName];
11342
10958
  let bone = skeletonData.findBone(boneName);
11343
- if (!bone)
11344
- throw new Error("Bone not found: " + boneName);
10959
+ if (!bone) throw new Error("Bone not found: " + boneName);
11345
10960
  let boneIndex = bone.index;
11346
10961
  for (let timelineName in boneMap) {
11347
10962
  let timelineMap = boneMap[timelineName];
11348
10963
  let frames = timelineMap.length;
11349
- if (frames == 0)
11350
- continue;
10964
+ if (frames == 0) continue;
11351
10965
  if (timelineName === "rotate") {
11352
10966
  timelines.push(readTimeline12(timelineMap, new RotateTimeline(frames, frames, boneIndex), 0, 1));
11353
10967
  } else if (timelineName === "translate") {
@@ -11392,11 +11006,9 @@ var spine = (() => {
11392
11006
  for (let constraintName in map.ik) {
11393
11007
  let constraintMap = map.ik[constraintName];
11394
11008
  let keyMap = constraintMap[0];
11395
- if (!keyMap)
11396
- continue;
11009
+ if (!keyMap) continue;
11397
11010
  let constraint = skeletonData.findIkConstraint(constraintName);
11398
- if (!constraint)
11399
- throw new Error("IK Constraint not found: " + constraintName);
11011
+ if (!constraint) throw new Error("IK Constraint not found: " + constraintName);
11400
11012
  let constraintIndex = skeletonData.ikConstraints.indexOf(constraint);
11401
11013
  let timeline = new IkConstraintTimeline(constraintMap.length, constraintMap.length << 1, constraintIndex);
11402
11014
  let time = getValue(keyMap, "time", 0);
@@ -11429,11 +11041,9 @@ var spine = (() => {
11429
11041
  for (let constraintName in map.transform) {
11430
11042
  let timelineMap = map.transform[constraintName];
11431
11043
  let keyMap = timelineMap[0];
11432
- if (!keyMap)
11433
- continue;
11044
+ if (!keyMap) continue;
11434
11045
  let constraint = skeletonData.findTransformConstraint(constraintName);
11435
- if (!constraint)
11436
- throw new Error("Transform constraint not found: " + constraintName);
11046
+ if (!constraint) throw new Error("Transform constraint not found: " + constraintName);
11437
11047
  let constraintIndex = skeletonData.transformConstraints.indexOf(constraint);
11438
11048
  let timeline = new TransformConstraintTimeline(timelineMap.length, timelineMap.length * 6, constraintIndex);
11439
11049
  let time = getValue(keyMap, "time", 0);
@@ -11482,14 +11092,12 @@ var spine = (() => {
11482
11092
  for (let constraintName in map.path) {
11483
11093
  let constraintMap = map.path[constraintName];
11484
11094
  let constraint = skeletonData.findPathConstraint(constraintName);
11485
- if (!constraint)
11486
- throw new Error("Path constraint not found: " + constraintName);
11095
+ if (!constraint) throw new Error("Path constraint not found: " + constraintName);
11487
11096
  let constraintIndex = skeletonData.pathConstraints.indexOf(constraint);
11488
11097
  for (let timelineName in constraintMap) {
11489
11098
  let timelineMap = constraintMap[timelineName];
11490
11099
  let keyMap = timelineMap[0];
11491
- if (!keyMap)
11492
- continue;
11100
+ if (!keyMap) continue;
11493
11101
  let frames = timelineMap.length;
11494
11102
  if (timelineName === "position") {
11495
11103
  let timeline = new PathConstraintPositionTimeline(frames, frames, constraintIndex);
@@ -11537,15 +11145,13 @@ var spine = (() => {
11537
11145
  let constraintIndex = -1;
11538
11146
  if (constraintName.length > 0) {
11539
11147
  let constraint = skeletonData.findPhysicsConstraint(constraintName);
11540
- if (!constraint)
11541
- throw new Error("Physics constraint not found: " + constraintName);
11148
+ if (!constraint) throw new Error("Physics constraint not found: " + constraintName);
11542
11149
  constraintIndex = skeletonData.physicsConstraints.indexOf(constraint);
11543
11150
  }
11544
11151
  for (let timelineName in constraintMap) {
11545
11152
  let timelineMap = constraintMap[timelineName];
11546
11153
  let keyMap = timelineMap[0];
11547
- if (!keyMap)
11548
- continue;
11154
+ if (!keyMap) continue;
11549
11155
  let frames = timelineMap.length;
11550
11156
  if (timelineName == "reset") {
11551
11157
  const timeline2 = new PhysicsConstraintResetTimeline(frames, constraintIndex);
@@ -11579,13 +11185,11 @@ var spine = (() => {
11579
11185
  for (let attachmentsName in map.attachments) {
11580
11186
  let attachmentsMap = map.attachments[attachmentsName];
11581
11187
  let skin = skeletonData.findSkin(attachmentsName);
11582
- if (!skin)
11583
- throw new Error("Skin not found: " + attachmentsName);
11188
+ if (!skin) throw new Error("Skin not found: " + attachmentsName);
11584
11189
  for (let slotMapName in attachmentsMap) {
11585
11190
  let slotMap = attachmentsMap[slotMapName];
11586
11191
  let slot = skeletonData.findSlot(slotMapName);
11587
- if (!slot)
11588
- throw new Error("Slot not found: " + slotMapName);
11192
+ if (!slot) throw new Error("Slot not found: " + slotMapName);
11589
11193
  let slotIndex = slot.index;
11590
11194
  for (let attachmentMapName in slotMap) {
11591
11195
  let attachmentMap = slotMap[attachmentMapName];
@@ -11593,8 +11197,7 @@ var spine = (() => {
11593
11197
  for (let timelineMapName in attachmentMap) {
11594
11198
  let timelineMap = attachmentMap[timelineMapName];
11595
11199
  let keyMap = timelineMap[0];
11596
- if (!keyMap)
11597
- continue;
11200
+ if (!keyMap) continue;
11598
11201
  if (timelineMapName == "deform") {
11599
11202
  let weighted = attachment.bones;
11600
11203
  let vertices = attachment.vertices;
@@ -11627,8 +11230,7 @@ var spine = (() => {
11627
11230
  }
11628
11231
  let time2 = getValue(nextMap, "time", 0);
11629
11232
  let curve = keyMap.curve;
11630
- if (curve)
11631
- 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);
11632
11234
  time = time2;
11633
11235
  keyMap = nextMap;
11634
11236
  }
@@ -11667,8 +11269,7 @@ var spine = (() => {
11667
11269
  for (let ii = 0; ii < offsets.length; ii++) {
11668
11270
  let offsetMap = offsets[ii];
11669
11271
  let slot = skeletonData.findSlot(offsetMap.slot);
11670
- if (!slot)
11671
- throw new Error("Slot not found: " + slot);
11272
+ if (!slot) throw new Error("Slot not found: " + slot);
11672
11273
  let slotIndex = slot.index;
11673
11274
  while (originalIndex != slotIndex)
11674
11275
  unchanged[unchangedIndex++] = originalIndex++;
@@ -11677,8 +11278,7 @@ var spine = (() => {
11677
11278
  while (originalIndex < slotCount)
11678
11279
  unchanged[unchangedIndex++] = originalIndex++;
11679
11280
  for (let ii = slotCount - 1; ii >= 0; ii--)
11680
- if (drawOrder[ii] == -1)
11681
- drawOrder[ii] = unchanged[--unchangedIndex];
11281
+ if (drawOrder[ii] == -1) drawOrder[ii] = unchanged[--unchangedIndex];
11682
11282
  }
11683
11283
  timeline.setFrame(frame, getValue(drawOrderMap, "time", 0), drawOrder);
11684
11284
  }
@@ -11690,8 +11290,7 @@ var spine = (() => {
11690
11290
  for (let i = 0; i < map.events.length; i++, frame++) {
11691
11291
  let eventMap = map.events[i];
11692
11292
  let eventData = skeletonData.findEvent(eventMap.name);
11693
- if (!eventData)
11694
- throw new Error("Event not found: " + eventMap.name);
11293
+ if (!eventData) throw new Error("Event not found: " + eventMap.name);
11695
11294
  let event = new Event(Utils.toSinglePrecision(getValue(eventMap, "time", 0)), eventData);
11696
11295
  event.intValue = getValue(eventMap, "int", eventData.intValue);
11697
11296
  event.floatValue = getValue(eventMap, "float", eventData.floatValue);
@@ -11738,8 +11337,7 @@ var spine = (() => {
11738
11337
  }
11739
11338
  let time2 = getValue(nextMap, "time", 0);
11740
11339
  let value2 = getValue(nextMap, "value", defaultValue) * scale;
11741
- if (keyMap.curve)
11742
- 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);
11743
11341
  time = time2;
11744
11342
  value = value2;
11745
11343
  keyMap = nextMap;
@@ -11792,13 +11390,13 @@ var spine = (() => {
11792
11390
  // spine-core/src/polyfills.ts
11793
11391
  (() => {
11794
11392
  if (typeof Math.fround === "undefined") {
11795
- Math.fround = function(array) {
11393
+ Math.fround = /* @__PURE__ */ function(array) {
11796
11394
  return function(x) {
11797
11395
  return array[0] = x, array[0];
11798
11396
  };
11799
11397
  }(new Float32Array(1));
11800
11398
  }
11801
11399
  })();
11802
- return __toCommonJS(src_exports);
11400
+ return __toCommonJS(index_exports);
11803
11401
  })();
11804
11402
  //# sourceMappingURL=spine-core.js.map