@esotericsoftware/spine-canvas 4.2.81 → 4.2.83

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-canvas/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,
@@ -191,13 +186,18 @@ var spine = (() => {
191
186
  this.size = 0;
192
187
  }
193
188
  };
194
- var _Color = class {
189
+ var Color = class _Color {
195
190
  constructor(r = 0, g = 0, b = 0, a = 0) {
196
191
  this.r = r;
197
192
  this.g = g;
198
193
  this.b = b;
199
194
  this.a = a;
200
195
  }
196
+ static WHITE = new _Color(1, 1, 1, 1);
197
+ static RED = new _Color(1, 0, 0, 1);
198
+ static GREEN = new _Color(0, 1, 0, 1);
199
+ static BLUE = new _Color(0, 0, 1, 1);
200
+ static MAGENTA = new _Color(1, 0, 1, 1);
201
201
  set(r, g, b, a) {
202
202
  this.r = r;
203
203
  this.g = g;
@@ -228,22 +228,14 @@ var spine = (() => {
228
228
  return this.clamp();
229
229
  }
230
230
  clamp() {
231
- if (this.r < 0)
232
- this.r = 0;
233
- else if (this.r > 1)
234
- this.r = 1;
235
- if (this.g < 0)
236
- this.g = 0;
237
- else if (this.g > 1)
238
- this.g = 1;
239
- if (this.b < 0)
240
- this.b = 0;
241
- else if (this.b > 1)
242
- this.b = 1;
243
- if (this.a < 0)
244
- this.a = 0;
245
- else if (this.a > 1)
246
- this.a = 1;
231
+ if (this.r < 0) this.r = 0;
232
+ else if (this.r > 1) this.r = 1;
233
+ if (this.g < 0) this.g = 0;
234
+ else if (this.g > 1) this.g = 1;
235
+ if (this.b < 0) this.b = 0;
236
+ else if (this.b > 1) this.b = 1;
237
+ if (this.a < 0) this.a = 0;
238
+ else if (this.a > 1) this.a = 1;
247
239
  return this;
248
240
  }
249
241
  static rgba8888ToColor(color, value) {
@@ -261,22 +253,21 @@ var spine = (() => {
261
253
  const hex = (x) => ("0" + (x * 255).toString(16)).slice(-2);
262
254
  return Number("0x" + hex(this.r) + hex(this.g) + hex(this.b));
263
255
  }
264
- static fromString(hex) {
265
- return new _Color().setFromString(hex);
256
+ static fromString(hex, color = new _Color()) {
257
+ return color.setFromString(hex);
266
258
  }
267
259
  };
268
- var Color = _Color;
269
- __publicField(Color, "WHITE", new _Color(1, 1, 1, 1));
270
- __publicField(Color, "RED", new _Color(1, 0, 0, 1));
271
- __publicField(Color, "GREEN", new _Color(0, 1, 0, 1));
272
- __publicField(Color, "BLUE", new _Color(0, 0, 1, 1));
273
- __publicField(Color, "MAGENTA", new _Color(1, 0, 1, 1));
274
- var _MathUtils = class {
260
+ var MathUtils = class _MathUtils {
261
+ static PI = 3.1415927;
262
+ static PI2 = _MathUtils.PI * 2;
263
+ static invPI2 = 1 / _MathUtils.PI2;
264
+ static radiansToDegrees = 180 / _MathUtils.PI;
265
+ static radDeg = _MathUtils.radiansToDegrees;
266
+ static degreesToRadians = _MathUtils.PI / 180;
267
+ static degRad = _MathUtils.degreesToRadians;
275
268
  static clamp(value, min, max) {
276
- if (value < min)
277
- return min;
278
- if (value > max)
279
- return max;
269
+ if (value < min) return min;
270
+ if (value > max) return max;
280
271
  return value;
281
272
  }
282
273
  static cosDeg(degrees) {
@@ -304,22 +295,13 @@ var spine = (() => {
304
295
  static randomTriangularWith(min, max, mode) {
305
296
  let u = Math.random();
306
297
  let d = max - min;
307
- if (u <= (mode - min) / d)
308
- return min + Math.sqrt(u * d * (mode - min));
298
+ if (u <= (mode - min) / d) return min + Math.sqrt(u * d * (mode - min));
309
299
  return max - Math.sqrt((1 - u) * d * (max - mode));
310
300
  }
311
301
  static isPowerOfTwo(value) {
312
302
  return value && (value & value - 1) === 0;
313
303
  }
314
304
  };
315
- var MathUtils = _MathUtils;
316
- __publicField(MathUtils, "PI", 3.1415927);
317
- __publicField(MathUtils, "PI2", _MathUtils.PI * 2);
318
- __publicField(MathUtils, "invPI2", 1 / _MathUtils.PI2);
319
- __publicField(MathUtils, "radiansToDegrees", 180 / _MathUtils.PI);
320
- __publicField(MathUtils, "radDeg", _MathUtils.radiansToDegrees);
321
- __publicField(MathUtils, "degreesToRadians", _MathUtils.PI / 180);
322
- __publicField(MathUtils, "degRad", _MathUtils.degreesToRadians);
323
305
  var Interpolation = class {
324
306
  apply(start, end, a) {
325
307
  return start + (end - start) * this.applyInternal(a);
@@ -332,8 +314,7 @@ var spine = (() => {
332
314
  this.power = power;
333
315
  }
334
316
  applyInternal(a) {
335
- if (a <= 0.5)
336
- return Math.pow(a * 2, this.power) / 2;
317
+ if (a <= 0.5) return Math.pow(a * 2, this.power) / 2;
337
318
  return Math.pow((a - 1) * 2, this.power) / (this.power % 2 == 0 ? -2 : 2) + 1;
338
319
  }
339
320
  };
@@ -345,7 +326,8 @@ var spine = (() => {
345
326
  return Math.pow(a - 1, this.power) * (this.power % 2 == 0 ? -1 : 1) + 1;
346
327
  }
347
328
  };
348
- var _Utils = class {
329
+ var Utils = class _Utils {
330
+ static SUPPORTS_TYPED_ARRAYS = typeof Float32Array !== "undefined";
349
331
  static arrayCopy(source, sourceStart, dest, destStart, numElements) {
350
332
  for (let i = sourceStart, j = destStart; i < sourceStart + numElements; i++, j++) {
351
333
  dest[j] = source[i];
@@ -357,24 +339,20 @@ var spine = (() => {
357
339
  }
358
340
  static setArraySize(array, size, value = 0) {
359
341
  let oldSize = array.length;
360
- if (oldSize == size)
361
- return array;
342
+ if (oldSize == size) return array;
362
343
  array.length = size;
363
344
  if (oldSize < size) {
364
- for (let i = oldSize; i < size; i++)
365
- array[i] = value;
345
+ for (let i = oldSize; i < size; i++) array[i] = value;
366
346
  }
367
347
  return array;
368
348
  }
369
349
  static ensureArrayCapacity(array, size, value = 0) {
370
- if (array.length >= size)
371
- return array;
350
+ if (array.length >= size) return array;
372
351
  return _Utils.setArraySize(array, size, value);
373
352
  }
374
353
  static newArray(size, defaultValue) {
375
354
  let array = new Array(size);
376
- for (let i = 0; i < size; i++)
377
- array[i] = defaultValue;
355
+ for (let i = 0; i < size; i++) array[i] = defaultValue;
378
356
  return array;
379
357
  }
380
358
  static newFloatArray(size) {
@@ -382,8 +360,7 @@ var spine = (() => {
382
360
  return new Float32Array(size);
383
361
  else {
384
362
  let array = new Array(size);
385
- for (let i = 0; i < array.length; i++)
386
- array[i] = 0;
363
+ for (let i = 0; i < array.length; i++) array[i] = 0;
387
364
  return array;
388
365
  }
389
366
  }
@@ -392,8 +369,7 @@ var spine = (() => {
392
369
  return new Int16Array(size);
393
370
  else {
394
371
  let array = new Array(size);
395
- for (let i = 0; i < array.length; i++)
396
- array[i] = 0;
372
+ for (let i = 0; i < array.length; i++) array[i] = 0;
397
373
  return array;
398
374
  }
399
375
  }
@@ -408,16 +384,13 @@ var spine = (() => {
408
384
  }
409
385
  static contains(array, element, identity = true) {
410
386
  for (var i = 0; i < array.length; i++)
411
- if (array[i] == element)
412
- return true;
387
+ if (array[i] == element) return true;
413
388
  return false;
414
389
  }
415
390
  static enumValue(type, name) {
416
391
  return type[name[0].toUpperCase() + name.slice(1)];
417
392
  }
418
393
  };
419
- var Utils = _Utils;
420
- __publicField(Utils, "SUPPORTS_TYPED_ARRAYS", typeof Float32Array !== "undefined");
421
394
  var DebugUtils = class {
422
395
  static logBones(skeleton) {
423
396
  for (let i = 0; i < skeleton.bones.length; i++) {
@@ -436,8 +409,7 @@ var spine = (() => {
436
409
  return this.items.length > 0 ? this.items.pop() : this.instantiator();
437
410
  }
438
411
  free(item) {
439
- if (item.reset)
440
- item.reset();
412
+ if (item.reset) item.reset();
441
413
  this.items.push(item);
442
414
  }
443
415
  freeAll(items) {
@@ -485,8 +457,7 @@ var spine = (() => {
485
457
  this.delta = now - this.lastTime;
486
458
  this.frameTime += this.delta;
487
459
  this.totalTime += this.delta;
488
- if (this.delta > this.maxDelta)
489
- this.delta = this.maxDelta;
460
+ if (this.delta > this.maxDelta) this.delta = this.maxDelta;
490
461
  this.lastTime = now;
491
462
  this.frameCount++;
492
463
  if (this.frameTime > 1) {
@@ -509,11 +480,9 @@ var spine = (() => {
509
480
  return this.addedValues >= this.values.length;
510
481
  }
511
482
  addValue(value) {
512
- if (this.addedValues < this.values.length)
513
- this.addedValues++;
483
+ if (this.addedValues < this.values.length) this.addedValues++;
514
484
  this.values[this.lastValue++] = value;
515
- if (this.lastValue > this.values.length - 1)
516
- this.lastValue = 0;
485
+ if (this.lastValue > this.values.length - 1) this.lastValue = 0;
517
486
  this.dirty = true;
518
487
  }
519
488
  getMean() {
@@ -535,12 +504,12 @@ var spine = (() => {
535
504
  var Attachment = class {
536
505
  name;
537
506
  constructor(name) {
538
- if (!name)
539
- throw new Error("name cannot be null.");
507
+ if (!name) throw new Error("name cannot be null.");
540
508
  this.name = name;
541
509
  }
542
510
  };
543
- var _VertexAttachment = class extends Attachment {
511
+ var VertexAttachment = class _VertexAttachment extends Attachment {
512
+ static nextID = 0;
544
513
  /** The unique ID for this attachment. */
545
514
  id = _VertexAttachment.nextID++;
546
515
  /** The bones which affect the {@link #getVertices()}. The array entries are, for each vertex, the number of bones affecting
@@ -578,8 +547,7 @@ var spine = (() => {
578
547
  let vertices = this.vertices;
579
548
  let bones = this.bones;
580
549
  if (!bones) {
581
- if (deformArray.length > 0)
582
- vertices = deformArray;
550
+ if (deformArray.length > 0) vertices = deformArray;
583
551
  let bone = slot.bone;
584
552
  let x = bone.worldX;
585
553
  let y = bone.worldY;
@@ -644,11 +612,10 @@ var spine = (() => {
644
612
  attachment.timelineAttachment = this.timelineAttachment;
645
613
  }
646
614
  };
647
- var VertexAttachment = _VertexAttachment;
648
- __publicField(VertexAttachment, "nextID", 0);
649
615
 
650
616
  // spine-core/src/attachments/Sequence.ts
651
- var _Sequence = class {
617
+ var Sequence = class _Sequence {
618
+ static _nextID = 0;
652
619
  id = _Sequence.nextID();
653
620
  regions;
654
621
  start = 0;
@@ -668,10 +635,8 @@ var spine = (() => {
668
635
  }
669
636
  apply(slot, attachment) {
670
637
  let index = slot.sequenceIndex;
671
- if (index == -1)
672
- index = this.setupIndex;
673
- if (index >= this.regions.length)
674
- index = this.regions.length - 1;
638
+ if (index == -1) index = this.setupIndex;
639
+ if (index >= this.regions.length) index = this.regions.length - 1;
675
640
  let region = this.regions[index];
676
641
  if (attachment.region != region) {
677
642
  attachment.region = region;
@@ -690,8 +655,6 @@ var spine = (() => {
690
655
  return _Sequence._nextID++;
691
656
  }
692
657
  };
693
- var Sequence = _Sequence;
694
- __publicField(Sequence, "_nextID", 0);
695
658
  var SequenceMode = /* @__PURE__ */ ((SequenceMode2) => {
696
659
  SequenceMode2[SequenceMode2["hold"] = 0] = "hold";
697
660
  SequenceMode2[SequenceMode2["once"] = 1] = "once";
@@ -721,15 +684,13 @@ var spine = (() => {
721
684
  /** The duration of the animation in seconds, which is the highest time of all keys in the timeline. */
722
685
  duration;
723
686
  constructor(name, timelines, duration) {
724
- if (!name)
725
- throw new Error("name cannot be null.");
687
+ if (!name) throw new Error("name cannot be null.");
726
688
  this.name = name;
727
689
  this.setTimelines(timelines);
728
690
  this.duration = duration;
729
691
  }
730
692
  setTimelines(timelines) {
731
- if (!timelines)
732
- throw new Error("timelines cannot be null.");
693
+ if (!timelines) throw new Error("timelines cannot be null.");
733
694
  this.timelines = timelines;
734
695
  this.timelineIds.clear();
735
696
  for (var i = 0; i < timelines.length; i++)
@@ -737,8 +698,7 @@ var spine = (() => {
737
698
  }
738
699
  hasTimeline(ids) {
739
700
  for (let i = 0; i < ids.length; i++)
740
- if (this.timelineIds.contains(ids[i]))
741
- return true;
701
+ if (this.timelineIds.contains(ids[i])) return true;
742
702
  return false;
743
703
  }
744
704
  /** Applies all the animation's timelines to the specified skeleton.
@@ -747,12 +707,10 @@ var spine = (() => {
747
707
  * @param loop If true, the animation repeats after {@link #getDuration()}.
748
708
  * @param events May be null to ignore fired events. */
749
709
  apply(skeleton, lastTime, time, loop, events, alpha, blend, direction) {
750
- if (!skeleton)
751
- throw new Error("skeleton cannot be null.");
710
+ if (!skeleton) throw new Error("skeleton cannot be null.");
752
711
  if (loop && this.duration != 0) {
753
712
  time %= this.duration;
754
- if (lastTime > 0)
755
- lastTime %= this.duration;
713
+ if (lastTime > 0) lastTime %= this.duration;
756
714
  }
757
715
  let timelines = this.timelines;
758
716
  for (let i = 0, n = timelines.length; i < n; i++)
@@ -824,15 +782,13 @@ var spine = (() => {
824
782
  static search1(frames, time) {
825
783
  let n = frames.length;
826
784
  for (let i = 1; i < n; i++)
827
- if (frames[i] > time)
828
- return i - 1;
785
+ if (frames[i] > time) return i - 1;
829
786
  return n - 1;
830
787
  }
831
788
  static search(frames, time, step) {
832
789
  let n = frames.length;
833
790
  for (let i = step; i < n; i += step)
834
- if (frames[i] > time)
835
- return i - step;
791
+ if (frames[i] > time) return i - step;
836
792
  return n - step;
837
793
  }
838
794
  };
@@ -882,8 +838,7 @@ var spine = (() => {
882
838
  setBezier(bezier, frame, value, time1, value1, cx1, cy1, cx2, cy2, time2, value2) {
883
839
  let curves = this.curves;
884
840
  let i = this.getFrameCount() + bezier * 18;
885
- if (value == 0)
886
- curves[frame] = 2 + i;
841
+ if (value == 0) curves[frame] = 2 + i;
887
842
  let tmpx = (time1 - cx1 * 2 + cx2) * 0.03, tmpy = (value1 - cy1 * 2 + cy2) * 0.03;
888
843
  let dddx = ((cx1 - cx2) * 3 - time1 + time2) * 6e-3, dddy = ((cy1 - cy2) * 3 - value1 + value2) * 6e-3;
889
844
  let ddx = tmpx * 2 + dddx, ddy = tmpy * 2 + dddy;
@@ -1009,8 +964,7 @@ var spine = (() => {
1009
964
  return current;
1010
965
  }
1011
966
  let value = this.getCurveValue(time);
1012
- if (blend == 0 /* setup */)
1013
- return setup + (value - setup) * alpha;
967
+ if (blend == 0 /* setup */) return setup + (value - setup) * alpha;
1014
968
  return current + (value - current) * alpha;
1015
969
  }
1016
970
  getAbsoluteValue2(time, alpha, blend, current, setup, value) {
@@ -1023,8 +977,7 @@ var spine = (() => {
1023
977
  }
1024
978
  return current;
1025
979
  }
1026
- if (blend == 0 /* setup */)
1027
- return setup + (value - setup) * alpha;
980
+ if (blend == 0 /* setup */) return setup + (value - setup) * alpha;
1028
981
  return current + (value - current) * alpha;
1029
982
  }
1030
983
  getScaleValue(time, alpha, blend, direction, current, setup) {
@@ -1040,8 +993,7 @@ var spine = (() => {
1040
993
  }
1041
994
  let value = this.getCurveValue(time) * setup;
1042
995
  if (alpha == 1) {
1043
- if (blend == 3 /* add */)
1044
- return current + value - setup;
996
+ if (blend == 3 /* add */) return current + value - setup;
1045
997
  return value;
1046
998
  }
1047
999
  if (direction == 1 /* mixOut */) {
@@ -1100,8 +1052,7 @@ var spine = (() => {
1100
1052
  }
1101
1053
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1102
1054
  let bone = skeleton.bones[this.boneIndex];
1103
- if (bone.active)
1104
- bone.rotation = this.getRelativeValue(time, alpha, blend, bone.rotation, bone.data.rotation);
1055
+ if (bone.active) bone.rotation = this.getRelativeValue(time, alpha, blend, bone.rotation, bone.data.rotation);
1105
1056
  }
1106
1057
  };
1107
1058
  var TranslateTimeline = class extends CurveTimeline2 {
@@ -1117,8 +1068,7 @@ var spine = (() => {
1117
1068
  }
1118
1069
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1119
1070
  let bone = skeleton.bones[this.boneIndex];
1120
- if (!bone.active)
1121
- return;
1071
+ if (!bone.active) return;
1122
1072
  let frames = this.frames;
1123
1073
  if (time < frames[0]) {
1124
1074
  switch (blend) {
@@ -1217,8 +1167,7 @@ var spine = (() => {
1217
1167
  }
1218
1168
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1219
1169
  let bone = skeleton.bones[this.boneIndex];
1220
- if (bone.active)
1221
- bone.x = this.getRelativeValue(time, alpha, blend, bone.x, bone.data.x);
1170
+ if (bone.active) bone.x = this.getRelativeValue(time, alpha, blend, bone.x, bone.data.x);
1222
1171
  }
1223
1172
  };
1224
1173
  var TranslateYTimeline = class extends CurveTimeline1 {
@@ -1229,8 +1178,7 @@ var spine = (() => {
1229
1178
  }
1230
1179
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1231
1180
  let bone = skeleton.bones[this.boneIndex];
1232
- if (bone.active)
1233
- bone.y = this.getRelativeValue(time, alpha, blend, bone.y, bone.data.y);
1181
+ if (bone.active) bone.y = this.getRelativeValue(time, alpha, blend, bone.y, bone.data.y);
1234
1182
  }
1235
1183
  };
1236
1184
  var ScaleTimeline = class extends CurveTimeline2 {
@@ -1246,8 +1194,7 @@ var spine = (() => {
1246
1194
  }
1247
1195
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1248
1196
  let bone = skeleton.bones[this.boneIndex];
1249
- if (!bone.active)
1250
- return;
1197
+ if (!bone.active) return;
1251
1198
  let frames = this.frames;
1252
1199
  if (time < frames[0]) {
1253
1200
  switch (blend) {
@@ -1384,8 +1331,7 @@ var spine = (() => {
1384
1331
  }
1385
1332
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1386
1333
  let bone = skeleton.bones[this.boneIndex];
1387
- if (bone.active)
1388
- bone.scaleX = this.getScaleValue(time, alpha, blend, direction, bone.scaleX, bone.data.scaleX);
1334
+ if (bone.active) bone.scaleX = this.getScaleValue(time, alpha, blend, direction, bone.scaleX, bone.data.scaleX);
1389
1335
  }
1390
1336
  };
1391
1337
  var ScaleYTimeline = class extends CurveTimeline1 {
@@ -1396,8 +1342,7 @@ var spine = (() => {
1396
1342
  }
1397
1343
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1398
1344
  let bone = skeleton.bones[this.boneIndex];
1399
- if (bone.active)
1400
- bone.scaleY = this.getScaleValue(time, alpha, blend, direction, bone.scaleY, bone.data.scaleY);
1345
+ if (bone.active) bone.scaleY = this.getScaleValue(time, alpha, blend, direction, bone.scaleY, bone.data.scaleY);
1401
1346
  }
1402
1347
  };
1403
1348
  var ShearTimeline = class extends CurveTimeline2 {
@@ -1413,8 +1358,7 @@ var spine = (() => {
1413
1358
  }
1414
1359
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1415
1360
  let bone = skeleton.bones[this.boneIndex];
1416
- if (!bone.active)
1417
- return;
1361
+ if (!bone.active) return;
1418
1362
  let frames = this.frames;
1419
1363
  if (time < frames[0]) {
1420
1364
  switch (blend) {
@@ -1513,8 +1457,7 @@ var spine = (() => {
1513
1457
  }
1514
1458
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1515
1459
  let bone = skeleton.bones[this.boneIndex];
1516
- if (bone.active)
1517
- bone.shearX = this.getRelativeValue(time, alpha, blend, bone.shearX, bone.data.shearX);
1460
+ if (bone.active) bone.shearX = this.getRelativeValue(time, alpha, blend, bone.shearX, bone.data.shearX);
1518
1461
  }
1519
1462
  };
1520
1463
  var ShearYTimeline = class extends CurveTimeline1 {
@@ -1525,8 +1468,7 @@ var spine = (() => {
1525
1468
  }
1526
1469
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1527
1470
  let bone = skeleton.bones[this.boneIndex];
1528
- if (bone.active)
1529
- bone.shearY = this.getRelativeValue(time, alpha, blend, bone.shearY, bone.data.shearY);
1471
+ if (bone.active) bone.shearY = this.getRelativeValue(time, alpha, blend, bone.shearY, bone.data.shearY);
1530
1472
  }
1531
1473
  };
1532
1474
  var InheritTimeline = class extends Timeline {
@@ -1551,17 +1493,14 @@ var spine = (() => {
1551
1493
  }
1552
1494
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1553
1495
  let bone = skeleton.bones[this.boneIndex];
1554
- if (!bone.active)
1555
- return;
1496
+ if (!bone.active) return;
1556
1497
  if (direction == 1 /* mixOut */) {
1557
- if (blend == 0 /* setup */)
1558
- bone.inherit = bone.data.inherit;
1498
+ if (blend == 0 /* setup */) bone.inherit = bone.data.inherit;
1559
1499
  return;
1560
1500
  }
1561
1501
  let frames = this.frames;
1562
1502
  if (time < frames[0]) {
1563
- if (blend == 0 /* setup */ || blend == 1 /* first */)
1564
- bone.inherit = bone.data.inherit;
1503
+ if (blend == 0 /* setup */ || blend == 1 /* first */) bone.inherit = bone.data.inherit;
1565
1504
  return;
1566
1505
  }
1567
1506
  bone.inherit = this.frames[
@@ -1610,8 +1549,7 @@ var spine = (() => {
1610
1549
  }
1611
1550
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1612
1551
  let slot = skeleton.slots[this.slotIndex];
1613
- if (!slot.bone.active)
1614
- return;
1552
+ if (!slot.bone.active) return;
1615
1553
  let frames = this.frames;
1616
1554
  let color = slot.color;
1617
1555
  if (time < frames[0]) {
@@ -1732,8 +1670,7 @@ var spine = (() => {
1732
1670
  if (alpha == 1)
1733
1671
  color.set(r, g, b, a);
1734
1672
  else {
1735
- if (blend == 0 /* setup */)
1736
- color.setFromColor(slot.data.color);
1673
+ if (blend == 0 /* setup */) color.setFromColor(slot.data.color);
1737
1674
  color.add((r - color.r) * alpha, (g - color.g) * alpha, (b - color.b) * alpha, (a - color.a) * alpha);
1738
1675
  }
1739
1676
  }
@@ -1768,8 +1705,7 @@ var spine = (() => {
1768
1705
  }
1769
1706
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1770
1707
  let slot = skeleton.slots[this.slotIndex];
1771
- if (!slot.bone.active)
1772
- return;
1708
+ if (!slot.bone.active) return;
1773
1709
  let frames = this.frames;
1774
1710
  let color = slot.color;
1775
1711
  if (time < frames[0]) {
@@ -1889,8 +1825,7 @@ var spine = (() => {
1889
1825
  }
1890
1826
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1891
1827
  let slot = skeleton.slots[this.slotIndex];
1892
- if (!slot.bone.active)
1893
- return;
1828
+ if (!slot.bone.active) return;
1894
1829
  let color = slot.color;
1895
1830
  if (time < this.frames[0]) {
1896
1831
  let setup = slot.data.color;
@@ -1907,8 +1842,7 @@ var spine = (() => {
1907
1842
  if (alpha == 1)
1908
1843
  color.a = a;
1909
1844
  else {
1910
- if (blend == 0 /* setup */)
1911
- color.a = slot.data.color.a;
1845
+ if (blend == 0 /* setup */) color.a = slot.data.color.a;
1912
1846
  color.a += (a - color.a) * alpha;
1913
1847
  }
1914
1848
  }
@@ -1961,8 +1895,7 @@ var spine = (() => {
1961
1895
  }
1962
1896
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1963
1897
  let slot = skeleton.slots[this.slotIndex];
1964
- if (!slot.bone.active)
1965
- return;
1898
+ if (!slot.bone.active) return;
1966
1899
  let frames = this.frames;
1967
1900
  let light = slot.color, dark = slot.darkColor;
1968
1901
  if (time < frames[0]) {
@@ -2203,8 +2136,7 @@ var spine = (() => {
2203
2136
  }
2204
2137
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
2205
2138
  let slot = skeleton.slots[this.slotIndex];
2206
- if (!slot.bone.active)
2207
- return;
2139
+ if (!slot.bone.active) return;
2208
2140
  let frames = this.frames;
2209
2141
  let light = slot.color, dark = slot.darkColor;
2210
2142
  if (time < frames[0]) {
@@ -2412,16 +2344,13 @@ var spine = (() => {
2412
2344
  }
2413
2345
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
2414
2346
  let slot = skeleton.slots[this.slotIndex];
2415
- if (!slot.bone.active)
2416
- return;
2347
+ if (!slot.bone.active) return;
2417
2348
  if (direction == 1 /* mixOut */) {
2418
- if (blend == 0 /* setup */)
2419
- this.setAttachment(skeleton, slot, slot.data.attachmentName);
2349
+ if (blend == 0 /* setup */) this.setAttachment(skeleton, slot, slot.data.attachmentName);
2420
2350
  return;
2421
2351
  }
2422
2352
  if (time < this.frames[0]) {
2423
- if (blend == 0 /* setup */ || blend == 1 /* first */)
2424
- this.setAttachment(skeleton, slot, slot.data.attachmentName);
2353
+ if (blend == 0 /* setup */ || blend == 1 /* first */) this.setAttachment(skeleton, slot, slot.data.attachmentName);
2425
2354
  return;
2426
2355
  }
2427
2356
  this.setAttachment(skeleton, slot, this.attachmentNames[Timeline.search1(this.frames, time)]);
@@ -2458,8 +2387,7 @@ var spine = (() => {
2458
2387
  setBezier(bezier, frame, value, time1, value1, cx1, cy1, cx2, cy2, time2, value2) {
2459
2388
  let curves = this.curves;
2460
2389
  let i = this.getFrameCount() + bezier * 18;
2461
- if (value == 0)
2462
- curves[frame] = 2 + i;
2390
+ if (value == 0) curves[frame] = 2 + i;
2463
2391
  let tmpx = (time1 - cx1 * 2 + cx2) * 0.03, tmpy = cy2 * 0.03 - cy1 * 0.06;
2464
2392
  let dddx = ((cx1 - cx2) * 3 - time1 + time2) * 6e-3, dddy = (cy1 - cy2 + 0.33333333) * 0.018;
2465
2393
  let ddx = tmpx * 2 + dddx, ddy = tmpy * 2 + dddy;
@@ -2503,16 +2431,12 @@ var spine = (() => {
2503
2431
  }
2504
2432
  apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
2505
2433
  let slot = skeleton.slots[this.slotIndex];
2506
- if (!slot.bone.active)
2507
- return;
2434
+ if (!slot.bone.active) return;
2508
2435
  let slotAttachment = slot.getAttachment();
2509
- if (!slotAttachment)
2510
- return;
2511
- if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttachment != this.attachment)
2512
- return;
2436
+ if (!slotAttachment) return;
2437
+ if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttachment != this.attachment) return;
2513
2438
  let deform = slot.deform;
2514
- if (deform.length == 0)
2515
- blend = 0 /* setup */;
2439
+ if (deform.length == 0) blend = 0 /* setup */;
2516
2440
  let vertices = this.vertices;
2517
2441
  let vertexCount = vertices[0].length;
2518
2442
  let frames = this.frames;
@@ -2659,7 +2583,8 @@ var spine = (() => {
2659
2583
  }
2660
2584
  }
2661
2585
  };
2662
- var _EventTimeline = class extends Timeline {
2586
+ var EventTimeline = class _EventTimeline extends Timeline {
2587
+ static propertyIds = ["" + Property.event];
2663
2588
  /** The event for each key frame. */
2664
2589
  events;
2665
2590
  constructor(frameCount) {
@@ -2676,8 +2601,7 @@ var spine = (() => {
2676
2601
  }
2677
2602
  /** Fires events for frames > `lastTime` and <= `time`. */
2678
2603
  apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
2679
- if (!firedEvents)
2680
- return;
2604
+ if (!firedEvents) return;
2681
2605
  let frames = this.frames;
2682
2606
  let frameCount = this.frames.length;
2683
2607
  if (lastTime > time) {
@@ -2685,8 +2609,7 @@ var spine = (() => {
2685
2609
  lastTime = -1;
2686
2610
  } else if (lastTime >= frames[frameCount - 1])
2687
2611
  return;
2688
- if (time < frames[0])
2689
- return;
2612
+ if (time < frames[0]) return;
2690
2613
  let i = 0;
2691
2614
  if (lastTime < frames[0])
2692
2615
  i = 0;
@@ -2694,8 +2617,7 @@ var spine = (() => {
2694
2617
  i = Timeline.search1(frames, lastTime) + 1;
2695
2618
  let frameTime = frames[i];
2696
2619
  while (i > 0) {
2697
- if (frames[i - 1] != frameTime)
2698
- break;
2620
+ if (frames[i - 1] != frameTime) break;
2699
2621
  i--;
2700
2622
  }
2701
2623
  }
@@ -2703,9 +2625,8 @@ var spine = (() => {
2703
2625
  firedEvents.push(this.events[i]);
2704
2626
  }
2705
2627
  };
2706
- var EventTimeline = _EventTimeline;
2707
- __publicField(EventTimeline, "propertyIds", ["" + Property.event]);
2708
- var _DrawOrderTimeline = class extends Timeline {
2628
+ var DrawOrderTimeline = class _DrawOrderTimeline extends Timeline {
2629
+ static propertyIds = ["" + Property.drawOrder];
2709
2630
  /** The draw order for each key frame. See {@link #setFrame(int, float, int[])}. */
2710
2631
  drawOrders;
2711
2632
  constructor(frameCount) {
@@ -2724,13 +2645,11 @@ var spine = (() => {
2724
2645
  }
2725
2646
  apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
2726
2647
  if (direction == 1 /* mixOut */) {
2727
- if (blend == 0 /* setup */)
2728
- Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
2648
+ if (blend == 0 /* setup */) Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
2729
2649
  return;
2730
2650
  }
2731
2651
  if (time < this.frames[0]) {
2732
- if (blend == 0 /* setup */ || blend == 1 /* first */)
2733
- Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
2652
+ if (blend == 0 /* setup */ || blend == 1 /* first */) Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
2734
2653
  return;
2735
2654
  }
2736
2655
  let idx = Timeline.search1(this.frames, time);
@@ -2745,8 +2664,6 @@ var spine = (() => {
2745
2664
  }
2746
2665
  }
2747
2666
  };
2748
- var DrawOrderTimeline = _DrawOrderTimeline;
2749
- __publicField(DrawOrderTimeline, "propertyIds", ["" + Property.drawOrder]);
2750
2667
  var IkConstraintTimeline = class extends CurveTimeline {
2751
2668
  /** The index of the IK constraint in {@link Skeleton#getIkConstraints()} that will be changed when this timeline is applied */
2752
2669
  constraintIndex = 0;
@@ -2786,8 +2703,7 @@ var spine = (() => {
2786
2703
  }
2787
2704
  apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
2788
2705
  let constraint = skeleton.ikConstraints[this.constraintIndex];
2789
- if (!constraint.active)
2790
- return;
2706
+ if (!constraint.active) return;
2791
2707
  let frames = this.frames;
2792
2708
  if (time < frames[0]) {
2793
2709
  switch (blend) {
@@ -2953,8 +2869,7 @@ var spine = (() => {
2953
2869
  }
2954
2870
  apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
2955
2871
  let constraint = skeleton.transformConstraints[this.constraintIndex];
2956
- if (!constraint.active)
2957
- return;
2872
+ if (!constraint.active) return;
2958
2873
  let frames = this.frames;
2959
2874
  if (time < frames[0]) {
2960
2875
  let data = constraint.data;
@@ -3192,8 +3107,7 @@ var spine = (() => {
3192
3107
  }
3193
3108
  apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
3194
3109
  let constraint = skeleton.pathConstraints[this.constraintIndex];
3195
- if (!constraint.active)
3196
- return;
3110
+ if (!constraint.active) return;
3197
3111
  let frames = this.frames;
3198
3112
  if (time < frames[0]) {
3199
3113
  switch (blend) {
@@ -3317,8 +3231,7 @@ var spine = (() => {
3317
3231
  }
3318
3232
  } else {
3319
3233
  constraint = skeleton.physicsConstraints[this.constraintIndex];
3320
- if (constraint.active)
3321
- this.set(constraint, this.getAbsoluteValue(time, alpha, blend, this.get(constraint), this.setup(constraint)));
3234
+ if (constraint.active) this.set(constraint, this.getAbsoluteValue(time, alpha, blend, this.get(constraint), this.setup(constraint)));
3322
3235
  }
3323
3236
  }
3324
3237
  };
@@ -3441,7 +3354,8 @@ var spine = (() => {
3441
3354
  return constraint.mixGlobal;
3442
3355
  }
3443
3356
  };
3444
- var _PhysicsConstraintResetTimeline = class extends Timeline {
3357
+ var PhysicsConstraintResetTimeline = class _PhysicsConstraintResetTimeline extends Timeline {
3358
+ static propertyIds = [Property.physicsConstraintReset.toString()];
3445
3359
  /** The index of the physics constraint in {@link Skeleton#getPhysicsConstraints()} that will be reset when this timeline is
3446
3360
  * applied, or -1 if all physics constraints in the skeleton will be reset. */
3447
3361
  constraintIndex;
@@ -3463,8 +3377,7 @@ var spine = (() => {
3463
3377
  let constraint;
3464
3378
  if (this.constraintIndex != -1) {
3465
3379
  constraint = skeleton.physicsConstraints[this.constraintIndex];
3466
- if (!constraint.active)
3467
- return;
3380
+ if (!constraint.active) return;
3468
3381
  }
3469
3382
  const frames = this.frames;
3470
3383
  if (lastTime > time) {
@@ -3472,23 +3385,22 @@ var spine = (() => {
3472
3385
  lastTime = -1;
3473
3386
  } else if (lastTime >= frames[frames.length - 1])
3474
3387
  return;
3475
- if (time < frames[0])
3476
- return;
3388
+ if (time < frames[0]) return;
3477
3389
  if (lastTime < frames[0] || time >= frames[Timeline.search1(frames, lastTime) + 1]) {
3478
3390
  if (constraint != null)
3479
3391
  constraint.reset();
3480
3392
  else {
3481
3393
  for (const constraint2 of skeleton.physicsConstraints) {
3482
- if (constraint2.active)
3483
- constraint2.reset();
3394
+ if (constraint2.active) constraint2.reset();
3484
3395
  }
3485
3396
  }
3486
3397
  }
3487
3398
  }
3488
3399
  };
3489
- var PhysicsConstraintResetTimeline = _PhysicsConstraintResetTimeline;
3490
- __publicField(PhysicsConstraintResetTimeline, "propertyIds", [Property.physicsConstraintReset.toString()]);
3491
- var _SequenceTimeline = class extends Timeline {
3400
+ var SequenceTimeline = class _SequenceTimeline extends Timeline {
3401
+ static ENTRIES = 3;
3402
+ static MODE = 1;
3403
+ static DELAY = 2;
3492
3404
  slotIndex;
3493
3405
  attachment;
3494
3406
  constructor(frameCount, slotIndex, attachment) {
@@ -3519,31 +3431,26 @@ var spine = (() => {
3519
3431
  }
3520
3432
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
3521
3433
  let slot = skeleton.slots[this.slotIndex];
3522
- if (!slot.bone.active)
3523
- return;
3434
+ if (!slot.bone.active) return;
3524
3435
  let slotAttachment = slot.attachment;
3525
3436
  let attachment = this.attachment;
3526
3437
  if (slotAttachment != attachment) {
3527
- if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttachment != attachment)
3528
- return;
3438
+ if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttachment != attachment) return;
3529
3439
  }
3530
3440
  if (direction == 1 /* mixOut */) {
3531
- if (blend == 0 /* setup */)
3532
- slot.sequenceIndex = -1;
3441
+ if (blend == 0 /* setup */) slot.sequenceIndex = -1;
3533
3442
  return;
3534
3443
  }
3535
3444
  let frames = this.frames;
3536
3445
  if (time < frames[0]) {
3537
- if (blend == 0 /* setup */ || blend == 1 /* first */)
3538
- slot.sequenceIndex = -1;
3446
+ if (blend == 0 /* setup */ || blend == 1 /* first */) slot.sequenceIndex = -1;
3539
3447
  return;
3540
3448
  }
3541
3449
  let i = Timeline.search(frames, time, _SequenceTimeline.ENTRIES);
3542
3450
  let before = frames[i];
3543
3451
  let modeAndIndex = frames[i + _SequenceTimeline.MODE];
3544
3452
  let delay = frames[i + _SequenceTimeline.DELAY];
3545
- if (!this.attachment.sequence)
3546
- return;
3453
+ if (!this.attachment.sequence) return;
3547
3454
  let index = modeAndIndex >> 4, count = this.attachment.sequence.regions.length;
3548
3455
  let mode = SequenceModeValues[modeAndIndex & 15];
3549
3456
  if (mode != 0 /* hold */) {
@@ -3558,8 +3465,7 @@ var spine = (() => {
3558
3465
  case 3 /* pingpong */: {
3559
3466
  let n = (count << 1) - 2;
3560
3467
  index = n == 0 ? 0 : index % n;
3561
- if (index >= count)
3562
- index = n - index;
3468
+ if (index >= count) index = n - index;
3563
3469
  break;
3564
3470
  }
3565
3471
  case 4 /* onceReverse */:
@@ -3571,21 +3477,17 @@ var spine = (() => {
3571
3477
  case 6 /* pingpongReverse */: {
3572
3478
  let n = (count << 1) - 2;
3573
3479
  index = n == 0 ? 0 : (index + count - 1) % n;
3574
- if (index >= count)
3575
- index = n - index;
3480
+ if (index >= count) index = n - index;
3576
3481
  }
3577
3482
  }
3578
3483
  }
3579
3484
  slot.sequenceIndex = index;
3580
3485
  }
3581
3486
  };
3582
- var SequenceTimeline = _SequenceTimeline;
3583
- __publicField(SequenceTimeline, "ENTRIES", 3);
3584
- __publicField(SequenceTimeline, "MODE", 1);
3585
- __publicField(SequenceTimeline, "DELAY", 2);
3586
3487
 
3587
3488
  // spine-core/src/AnimationState.ts
3588
- var _AnimationState = class {
3489
+ var AnimationState = class _AnimationState {
3490
+ static _emptyAnimation = new Animation("<empty>", [], 0);
3589
3491
  static emptyAnimation() {
3590
3492
  return _AnimationState._emptyAnimation;
3591
3493
  }
@@ -3614,15 +3516,13 @@ var spine = (() => {
3614
3516
  let tracks = this.tracks;
3615
3517
  for (let i = 0, n = tracks.length; i < n; i++) {
3616
3518
  let current = tracks[i];
3617
- if (!current)
3618
- continue;
3519
+ if (!current) continue;
3619
3520
  current.animationLast = current.nextAnimationLast;
3620
3521
  current.trackLast = current.nextTrackLast;
3621
3522
  let currentDelta = delta * current.timeScale;
3622
3523
  if (current.delay > 0) {
3623
3524
  current.delay -= currentDelta;
3624
- if (current.delay > 0)
3625
- continue;
3525
+ if (current.delay > 0) continue;
3626
3526
  currentDelta = -current.delay;
3627
3527
  current.delay = 0;
3628
3528
  }
@@ -3649,8 +3549,7 @@ var spine = (() => {
3649
3549
  if (current.mixingFrom && this.updateMixingFrom(current, delta)) {
3650
3550
  let from = current.mixingFrom;
3651
3551
  current.mixingFrom = null;
3652
- if (from)
3653
- from.mixingTo = null;
3552
+ if (from) from.mixingTo = null;
3654
3553
  while (from) {
3655
3554
  this.queue.end(from);
3656
3555
  from = from.mixingFrom;
@@ -3663,16 +3562,14 @@ var spine = (() => {
3663
3562
  /** Returns true when all mixing from entries are complete. */
3664
3563
  updateMixingFrom(to, delta) {
3665
3564
  let from = to.mixingFrom;
3666
- if (!from)
3667
- return true;
3565
+ if (!from) return true;
3668
3566
  let finished = this.updateMixingFrom(from, delta);
3669
3567
  from.animationLast = from.nextAnimationLast;
3670
3568
  from.trackLast = from.nextTrackLast;
3671
3569
  if (to.nextTrackLast != -1 && to.mixTime >= to.mixDuration) {
3672
3570
  if (from.totalAlpha == 0 || to.mixDuration == 0) {
3673
3571
  to.mixingFrom = from.mixingFrom;
3674
- if (from.mixingFrom != null)
3675
- from.mixingFrom.mixingTo = to;
3572
+ if (from.mixingFrom != null) from.mixingFrom.mixingTo = to;
3676
3573
  to.interruptAlpha = from.interruptAlpha;
3677
3574
  this.queue.end(from);
3678
3575
  }
@@ -3686,17 +3583,14 @@ var spine = (() => {
3686
3583
  * animation state can be applied to multiple skeletons to pose them identically.
3687
3584
  * @returns True if any animations were applied. */
3688
3585
  apply(skeleton) {
3689
- if (!skeleton)
3690
- throw new Error("skeleton cannot be null.");
3691
- if (this.animationsChanged)
3692
- this._animationsChanged();
3586
+ if (!skeleton) throw new Error("skeleton cannot be null.");
3587
+ if (this.animationsChanged) this._animationsChanged();
3693
3588
  let events = this.events;
3694
3589
  let tracks = this.tracks;
3695
3590
  let applied = false;
3696
3591
  for (let i2 = 0, n2 = tracks.length; i2 < n2; i2++) {
3697
3592
  let current = tracks[i2];
3698
- if (!current || current.delay > 0)
3699
- continue;
3593
+ if (!current || current.delay > 0) continue;
3700
3594
  applied = true;
3701
3595
  let blend = i2 == 0 ? 1 /* first */ : current.mixBlend;
3702
3596
  let alpha = current.alpha;
@@ -3714,8 +3608,7 @@ var spine = (() => {
3714
3608
  let timelines = current.animation.timelines;
3715
3609
  let timelineCount = timelines.length;
3716
3610
  if (i2 == 0 && alpha == 1 || blend == 3 /* add */) {
3717
- if (i2 == 0)
3718
- attachments = true;
3611
+ if (i2 == 0) attachments = true;
3719
3612
  for (let ii = 0; ii < timelineCount; ii++) {
3720
3613
  Utils.webkit602BugfixHelper(alpha, blend);
3721
3614
  var timeline = timelines[ii];
@@ -3728,8 +3621,7 @@ var spine = (() => {
3728
3621
  let timelineMode = current.timelineMode;
3729
3622
  let shortestRotation = current.shortestRotation;
3730
3623
  let firstFrame = !shortestRotation && current.timelinesRotation.length != timelineCount << 1;
3731
- if (firstFrame)
3732
- current.timelinesRotation.length = timelineCount << 1;
3624
+ if (firstFrame) current.timelinesRotation.length = timelineCount << 1;
3733
3625
  for (let ii = 0; ii < timelineCount; ii++) {
3734
3626
  let timeline2 = timelines[ii];
3735
3627
  let timelineBlend = timelineMode[ii] == SUBSEQUENT ? blend : 0 /* setup */;
@@ -3763,19 +3655,15 @@ var spine = (() => {
3763
3655
  }
3764
3656
  applyMixingFrom(to, skeleton, blend) {
3765
3657
  let from = to.mixingFrom;
3766
- if (from.mixingFrom)
3767
- this.applyMixingFrom(from, skeleton, blend);
3658
+ if (from.mixingFrom) this.applyMixingFrom(from, skeleton, blend);
3768
3659
  let mix = 0;
3769
3660
  if (to.mixDuration == 0) {
3770
3661
  mix = 1;
3771
- if (blend == 1 /* first */)
3772
- blend = 0 /* setup */;
3662
+ if (blend == 1 /* first */) blend = 0 /* setup */;
3773
3663
  } else {
3774
3664
  mix = to.mixTime / to.mixDuration;
3775
- if (mix > 1)
3776
- mix = 1;
3777
- if (blend != 1 /* first */)
3778
- blend = from.mixBlend;
3665
+ if (mix > 1) mix = 1;
3666
+ if (blend != 1 /* first */) blend = from.mixBlend;
3779
3667
  }
3780
3668
  let attachments = mix < from.mixAttachmentThreshold, drawOrder = mix < from.mixDrawOrderThreshold;
3781
3669
  let timelines = from.animation.timelines;
@@ -3795,8 +3683,7 @@ var spine = (() => {
3795
3683
  let timelineHoldMix = from.timelineHoldMix;
3796
3684
  let shortestRotation = from.shortestRotation;
3797
3685
  let firstFrame = !shortestRotation && from.timelinesRotation.length != timelineCount << 1;
3798
- if (firstFrame)
3799
- from.timelinesRotation.length = timelineCount << 1;
3686
+ if (firstFrame) from.timelinesRotation.length = timelineCount << 1;
3800
3687
  from.totalAlpha = 0;
3801
3688
  for (let i = 0; i < timelineCount; i++) {
3802
3689
  let timeline = timelines[i];
@@ -3805,8 +3692,7 @@ var spine = (() => {
3805
3692
  let alpha = 0;
3806
3693
  switch (timelineMode[i]) {
3807
3694
  case SUBSEQUENT:
3808
- if (!drawOrder && timeline instanceof DrawOrderTimeline)
3809
- continue;
3695
+ if (!drawOrder && timeline instanceof DrawOrderTimeline) continue;
3810
3696
  timelineBlend = blend;
3811
3697
  alpha = alphaMix;
3812
3698
  break;
@@ -3841,8 +3727,7 @@ var spine = (() => {
3841
3727
  }
3842
3728
  }
3843
3729
  }
3844
- if (to.mixDuration > 0)
3845
- this.queueEvents(from, animationTime);
3730
+ if (to.mixDuration > 0) this.queueEvents(from, animationTime);
3846
3731
  this.events.length = 0;
3847
3732
  from.nextAnimationLast = animationTime;
3848
3733
  from.nextTrackLast = from.trackTime;
@@ -3850,31 +3735,26 @@ var spine = (() => {
3850
3735
  }
3851
3736
  applyAttachmentTimeline(timeline, skeleton, time, blend, attachments) {
3852
3737
  var slot = skeleton.slots[timeline.slotIndex];
3853
- if (!slot.bone.active)
3854
- return;
3738
+ if (!slot.bone.active) return;
3855
3739
  if (time < timeline.frames[0]) {
3856
3740
  if (blend == 0 /* setup */ || blend == 1 /* first */)
3857
3741
  this.setAttachment(skeleton, slot, slot.data.attachmentName, attachments);
3858
3742
  } else
3859
3743
  this.setAttachment(skeleton, slot, timeline.attachmentNames[Timeline.search1(timeline.frames, time)], attachments);
3860
- if (slot.attachmentState <= this.unkeyedState)
3861
- slot.attachmentState = this.unkeyedState + SETUP;
3744
+ if (slot.attachmentState <= this.unkeyedState) slot.attachmentState = this.unkeyedState + SETUP;
3862
3745
  }
3863
3746
  setAttachment(skeleton, slot, attachmentName, attachments) {
3864
3747
  slot.setAttachment(!attachmentName ? null : skeleton.getAttachment(slot.data.index, attachmentName));
3865
- if (attachments)
3866
- slot.attachmentState = this.unkeyedState + CURRENT;
3748
+ if (attachments) slot.attachmentState = this.unkeyedState + CURRENT;
3867
3749
  }
3868
3750
  applyRotateTimeline(timeline, skeleton, time, alpha, blend, timelinesRotation, i, firstFrame) {
3869
- if (firstFrame)
3870
- timelinesRotation[i] = 0;
3751
+ if (firstFrame) timelinesRotation[i] = 0;
3871
3752
  if (alpha == 1) {
3872
3753
  timeline.apply(skeleton, 0, time, null, 1, blend, 0 /* mixIn */);
3873
3754
  return;
3874
3755
  }
3875
3756
  let bone = skeleton.bones[timeline.boneIndex];
3876
- if (!bone.active)
3877
- return;
3757
+ if (!bone.active) return;
3878
3758
  let frames = timeline.frames;
3879
3759
  let r1 = 0, r2 = 0;
3880
3760
  if (time < frames[0]) {
@@ -3916,8 +3796,7 @@ var spine = (() => {
3916
3796
  else
3917
3797
  dir = current;
3918
3798
  }
3919
- if (dir != current)
3920
- total += 360 * MathUtils.signum(lastTotal);
3799
+ if (dir != current) total += 360 * MathUtils.signum(lastTotal);
3921
3800
  timelinesRotation[i] = total;
3922
3801
  }
3923
3802
  timelinesRotation[i + 1] = diff;
@@ -3931,10 +3810,8 @@ var spine = (() => {
3931
3810
  let i = 0, n = events.length;
3932
3811
  for (; i < n; i++) {
3933
3812
  let event = events[i];
3934
- if (event.time < trackLastWrapped)
3935
- break;
3936
- if (event.time > animationEnd)
3937
- continue;
3813
+ if (event.time < trackLastWrapped) break;
3814
+ if (event.time > animationEnd) continue;
3938
3815
  this.queue.event(entry, event);
3939
3816
  }
3940
3817
  let complete = false;
@@ -3947,12 +3824,10 @@ var spine = (() => {
3947
3824
  }
3948
3825
  } else
3949
3826
  complete = animationTime >= animationEnd && entry.animationLast < animationEnd;
3950
- if (complete)
3951
- this.queue.complete(entry);
3827
+ if (complete) this.queue.complete(entry);
3952
3828
  for (; i < n; i++) {
3953
3829
  let event = events[i];
3954
- if (event.time < animationStart)
3955
- continue;
3830
+ if (event.time < animationStart) continue;
3956
3831
  this.queue.event(entry, event);
3957
3832
  }
3958
3833
  }
@@ -3974,18 +3849,15 @@ var spine = (() => {
3974
3849
  * It may be desired to use {@link AnimationState#setEmptyAnimation()} to mix the skeletons back to the setup pose,
3975
3850
  * rather than leaving them in their current pose. */
3976
3851
  clearTrack(trackIndex) {
3977
- if (trackIndex >= this.tracks.length)
3978
- return;
3852
+ if (trackIndex >= this.tracks.length) return;
3979
3853
  let current = this.tracks[trackIndex];
3980
- if (!current)
3981
- return;
3854
+ if (!current) return;
3982
3855
  this.queue.end(current);
3983
3856
  this.clearNext(current);
3984
3857
  let entry = current;
3985
3858
  while (true) {
3986
3859
  let from = entry.mixingFrom;
3987
- if (!from)
3988
- break;
3860
+ if (!from) break;
3989
3861
  this.queue.end(from);
3990
3862
  entry.mixingFrom = null;
3991
3863
  entry.mixingTo = null;
@@ -3999,8 +3871,7 @@ var spine = (() => {
3999
3871
  this.tracks[index] = current;
4000
3872
  current.previous = null;
4001
3873
  if (from) {
4002
- if (interrupt)
4003
- this.queue.interrupt(from);
3874
+ if (interrupt) this.queue.interrupt(from);
4004
3875
  current.mixingFrom = from;
4005
3876
  from.mixingTo = current;
4006
3877
  current.mixTime = 0;
@@ -4015,8 +3886,7 @@ var spine = (() => {
4015
3886
  * See {@link #setAnimationWith()}. */
4016
3887
  setAnimation(trackIndex, animationName, loop = false) {
4017
3888
  let animation = this.data.skeletonData.findAnimation(animationName);
4018
- if (!animation)
4019
- throw new Error("Animation not found: " + animationName);
3889
+ if (!animation) throw new Error("Animation not found: " + animationName);
4020
3890
  return this.setAnimationWith(trackIndex, animation, loop);
4021
3891
  }
4022
3892
  /** Sets the current animation for a track, discarding any queued animations. If the formerly current track entry was never
@@ -4026,8 +3896,7 @@ var spine = (() => {
4026
3896
  * @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
4027
3897
  * after the {@link AnimationStateListener#dispose()} event occurs. */
4028
3898
  setAnimationWith(trackIndex, animation, loop = false) {
4029
- if (!animation)
4030
- throw new Error("animation cannot be null.");
3899
+ if (!animation) throw new Error("animation cannot be null.");
4031
3900
  let interrupt = true;
4032
3901
  let current = this.expandToIndex(trackIndex);
4033
3902
  if (current) {
@@ -4051,8 +3920,7 @@ var spine = (() => {
4051
3920
  * See {@link #addAnimationWith()}. */
4052
3921
  addAnimation(trackIndex, animationName, loop = false, delay = 0) {
4053
3922
  let animation = this.data.skeletonData.findAnimation(animationName);
4054
- if (!animation)
4055
- throw new Error("Animation not found: " + animationName);
3923
+ if (!animation) throw new Error("Animation not found: " + animationName);
4056
3924
  return this.addAnimationWith(trackIndex, animation, loop, delay);
4057
3925
  }
4058
3926
  /** Adds an animation to be played after the current or last queued animation for a track. If the track is empty, it is
@@ -4064,8 +3932,7 @@ var spine = (() => {
4064
3932
  * @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
4065
3933
  * after the {@link AnimationStateListener#dispose()} event occurs. */
4066
3934
  addAnimationWith(trackIndex, animation, loop = false, delay = 0) {
4067
- if (!animation)
4068
- throw new Error("animation cannot be null.");
3935
+ if (!animation) throw new Error("animation cannot be null.");
4069
3936
  let last = this.expandToIndex(trackIndex);
4070
3937
  if (last) {
4071
3938
  while (last.next)
@@ -4075,13 +3942,11 @@ var spine = (() => {
4075
3942
  if (!last) {
4076
3943
  this.setCurrent(trackIndex, entry, true);
4077
3944
  this.queue.drain();
4078
- if (delay < 0)
4079
- delay = 0;
3945
+ if (delay < 0) delay = 0;
4080
3946
  } else {
4081
3947
  last.next = entry;
4082
3948
  entry.previous = last;
4083
- if (delay <= 0)
4084
- delay = Math.max(delay + last.getTrackComplete() - entry.mixDuration, 0);
3949
+ if (delay <= 0) delay = Math.max(delay + last.getTrackComplete() - entry.mixDuration, 0);
4085
3950
  }
4086
3951
  entry.delay = delay;
4087
3952
  return entry;
@@ -4119,8 +3984,7 @@ var spine = (() => {
4119
3984
  * after the {@link AnimationStateListener#dispose()} event occurs. */
4120
3985
  addEmptyAnimation(trackIndex, mixDuration = 0, delay = 0) {
4121
3986
  let entry = this.addAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false, delay);
4122
- if (delay <= 0)
4123
- entry.delay = Math.max(entry.delay + entry.mixDuration - mixDuration, 0);
3987
+ if (delay <= 0) entry.delay = Math.max(entry.delay + entry.mixDuration - mixDuration, 0);
4124
3988
  entry.mixDuration = mixDuration;
4125
3989
  entry.trackEnd = mixDuration;
4126
3990
  return entry;
@@ -4132,15 +3996,13 @@ var spine = (() => {
4132
3996
  this.queue.drainDisabled = true;
4133
3997
  for (let i = 0, n = this.tracks.length; i < n; i++) {
4134
3998
  let current = this.tracks[i];
4135
- if (current)
4136
- this.setEmptyAnimation(current.trackIndex, mixDuration);
3999
+ if (current) this.setEmptyAnimation(current.trackIndex, mixDuration);
4137
4000
  }
4138
4001
  this.queue.drainDisabled = oldDrainDisabled;
4139
4002
  this.queue.drain();
4140
4003
  }
4141
4004
  expandToIndex(index) {
4142
- if (index < this.tracks.length)
4143
- return this.tracks[index];
4005
+ if (index < this.tracks.length) return this.tracks[index];
4144
4006
  Utils.ensureArrayCapacity(this.tracks, index + 1, null);
4145
4007
  this.tracks.length = index + 1;
4146
4008
  return null;
@@ -4192,13 +4054,11 @@ var spine = (() => {
4192
4054
  let tracks = this.tracks;
4193
4055
  for (let i = 0, n = tracks.length; i < n; i++) {
4194
4056
  let entry = tracks[i];
4195
- if (!entry)
4196
- continue;
4057
+ if (!entry) continue;
4197
4058
  while (entry.mixingFrom)
4198
4059
  entry = entry.mixingFrom;
4199
4060
  do {
4200
- if (!entry.mixingTo || entry.mixBlend != 3 /* add */)
4201
- this.computeHold(entry);
4061
+ if (!entry.mixingTo || entry.mixBlend != 3 /* add */) this.computeHold(entry);
4202
4062
  entry = entry.mixingTo;
4203
4063
  } while (entry);
4204
4064
  }
@@ -4227,8 +4087,7 @@ var spine = (() => {
4227
4087
  timelineMode[i] = FIRST;
4228
4088
  } else {
4229
4089
  for (let next = to.mixingTo; next; next = next.mixingTo) {
4230
- if (next.animation.hasTimeline(ids))
4231
- continue;
4090
+ if (next.animation.hasTimeline(ids)) continue;
4232
4091
  if (entry.mixDuration > 0) {
4233
4092
  timelineMode[i] = HOLD_MIX;
4234
4093
  timelineHoldMix[i] = next;
@@ -4242,21 +4101,18 @@ var spine = (() => {
4242
4101
  }
4243
4102
  /** Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing. */
4244
4103
  getCurrent(trackIndex) {
4245
- if (trackIndex >= this.tracks.length)
4246
- return null;
4104
+ if (trackIndex >= this.tracks.length) return null;
4247
4105
  return this.tracks[trackIndex];
4248
4106
  }
4249
4107
  /** Adds a listener to receive events for all track entries. */
4250
4108
  addListener(listener) {
4251
- if (!listener)
4252
- throw new Error("listener cannot be null.");
4109
+ if (!listener) throw new Error("listener cannot be null.");
4253
4110
  this.listeners.push(listener);
4254
4111
  }
4255
4112
  /** Removes the listener added with {@link #addListener()}. */
4256
4113
  removeListener(listener) {
4257
4114
  let index = this.listeners.indexOf(listener);
4258
- if (index >= 0)
4259
- this.listeners.splice(index, 1);
4115
+ if (index >= 0) this.listeners.splice(index, 1);
4260
4116
  }
4261
4117
  /** Removes all listeners added with {@link #addListener()}. */
4262
4118
  clearListeners() {
@@ -4269,8 +4125,6 @@ var spine = (() => {
4269
4125
  this.queue.clear();
4270
4126
  }
4271
4127
  };
4272
- var AnimationState = _AnimationState;
4273
- __publicField(AnimationState, "_emptyAnimation", new Animation("<empty>", [], 0));
4274
4128
  var TrackEntry = class {
4275
4129
  /** The animation to apply for this track entry. */
4276
4130
  animation = null;
@@ -4439,8 +4293,7 @@ var spine = (() => {
4439
4293
  getAnimationTime() {
4440
4294
  if (this.loop) {
4441
4295
  let duration = this.animationEnd - this.animationStart;
4442
- if (duration == 0)
4443
- return this.animationStart;
4296
+ if (duration == 0) return this.animationStart;
4444
4297
  return this.trackTime % duration + this.animationStart;
4445
4298
  }
4446
4299
  return Math.min(this.trackTime + this.animationStart, this.animationEnd);
@@ -4468,10 +4321,8 @@ var spine = (() => {
4468
4321
  getTrackComplete() {
4469
4322
  let duration = this.animationEnd - this.animationStart;
4470
4323
  if (duration != 0) {
4471
- if (this.loop)
4472
- return duration * (1 + (this.trackTime / duration | 0));
4473
- if (this.trackTime < duration)
4474
- return duration;
4324
+ if (this.loop) return duration * (1 + (this.trackTime / duration | 0));
4325
+ if (this.trackTime < duration) return duration;
4475
4326
  }
4476
4327
  return this.trackTime;
4477
4328
  }
@@ -4495,35 +4346,34 @@ var spine = (() => {
4495
4346
  this.animState = animState;
4496
4347
  }
4497
4348
  start(entry) {
4498
- this.objects.push(EventType.start);
4349
+ this.objects.push(0 /* start */);
4499
4350
  this.objects.push(entry);
4500
4351
  this.animState.animationsChanged = true;
4501
4352
  }
4502
4353
  interrupt(entry) {
4503
- this.objects.push(EventType.interrupt);
4354
+ this.objects.push(1 /* interrupt */);
4504
4355
  this.objects.push(entry);
4505
4356
  }
4506
4357
  end(entry) {
4507
- this.objects.push(EventType.end);
4358
+ this.objects.push(2 /* end */);
4508
4359
  this.objects.push(entry);
4509
4360
  this.animState.animationsChanged = true;
4510
4361
  }
4511
4362
  dispose(entry) {
4512
- this.objects.push(EventType.dispose);
4363
+ this.objects.push(3 /* dispose */);
4513
4364
  this.objects.push(entry);
4514
4365
  }
4515
4366
  complete(entry) {
4516
- this.objects.push(EventType.complete);
4367
+ this.objects.push(4 /* complete */);
4517
4368
  this.objects.push(entry);
4518
4369
  }
4519
4370
  event(entry, event) {
4520
- this.objects.push(EventType.event);
4371
+ this.objects.push(5 /* event */);
4521
4372
  this.objects.push(entry);
4522
4373
  this.objects.push(event);
4523
4374
  }
4524
4375
  drain() {
4525
- if (this.drainDisabled)
4526
- return;
4376
+ if (this.drainDisabled) return;
4527
4377
  this.drainDisabled = true;
4528
4378
  let objects = this.objects;
4529
4379
  let listeners = this.animState.listeners;
@@ -4531,59 +4381,48 @@ var spine = (() => {
4531
4381
  let type = objects[i];
4532
4382
  let entry = objects[i + 1];
4533
4383
  switch (type) {
4534
- case EventType.start:
4535
- if (entry.listener && entry.listener.start)
4536
- entry.listener.start(entry);
4384
+ case 0 /* start */:
4385
+ if (entry.listener && entry.listener.start) entry.listener.start(entry);
4537
4386
  for (let ii = 0; ii < listeners.length; ii++) {
4538
4387
  let listener = listeners[ii];
4539
- if (listener.start)
4540
- listener.start(entry);
4388
+ if (listener.start) listener.start(entry);
4541
4389
  }
4542
4390
  break;
4543
- case EventType.interrupt:
4544
- if (entry.listener && entry.listener.interrupt)
4545
- entry.listener.interrupt(entry);
4391
+ case 1 /* interrupt */:
4392
+ if (entry.listener && entry.listener.interrupt) entry.listener.interrupt(entry);
4546
4393
  for (let ii = 0; ii < listeners.length; ii++) {
4547
4394
  let listener = listeners[ii];
4548
- if (listener.interrupt)
4549
- listener.interrupt(entry);
4395
+ if (listener.interrupt) listener.interrupt(entry);
4550
4396
  }
4551
4397
  break;
4552
- case EventType.end:
4553
- if (entry.listener && entry.listener.end)
4554
- entry.listener.end(entry);
4398
+ case 2 /* end */:
4399
+ if (entry.listener && entry.listener.end) entry.listener.end(entry);
4555
4400
  for (let ii = 0; ii < listeners.length; ii++) {
4556
4401
  let listener = listeners[ii];
4557
- if (listener.end)
4558
- listener.end(entry);
4402
+ if (listener.end) listener.end(entry);
4559
4403
  }
4560
- case EventType.dispose:
4561
- if (entry.listener && entry.listener.dispose)
4562
- entry.listener.dispose(entry);
4404
+ // Fall through.
4405
+ case 3 /* dispose */:
4406
+ if (entry.listener && entry.listener.dispose) entry.listener.dispose(entry);
4563
4407
  for (let ii = 0; ii < listeners.length; ii++) {
4564
4408
  let listener = listeners[ii];
4565
- if (listener.dispose)
4566
- listener.dispose(entry);
4409
+ if (listener.dispose) listener.dispose(entry);
4567
4410
  }
4568
4411
  this.animState.trackEntryPool.free(entry);
4569
4412
  break;
4570
- case EventType.complete:
4571
- if (entry.listener && entry.listener.complete)
4572
- entry.listener.complete(entry);
4413
+ case 4 /* complete */:
4414
+ if (entry.listener && entry.listener.complete) entry.listener.complete(entry);
4573
4415
  for (let ii = 0; ii < listeners.length; ii++) {
4574
4416
  let listener = listeners[ii];
4575
- if (listener.complete)
4576
- listener.complete(entry);
4417
+ if (listener.complete) listener.complete(entry);
4577
4418
  }
4578
4419
  break;
4579
- case EventType.event:
4420
+ case 5 /* event */:
4580
4421
  let event = objects[i++ + 2];
4581
- if (entry.listener && entry.listener.event)
4582
- entry.listener.event(entry, event);
4422
+ if (entry.listener && entry.listener.event) entry.listener.event(entry, event);
4583
4423
  for (let ii = 0; ii < listeners.length; ii++) {
4584
4424
  let listener = listeners[ii];
4585
- if (listener.event)
4586
- listener.event(entry, event);
4425
+ if (listener.event) listener.event(entry, event);
4587
4426
  }
4588
4427
  break;
4589
4428
  }
@@ -4634,8 +4473,7 @@ var spine = (() => {
4634
4473
  /** The mix duration to use when no mix duration has been defined between two animations. */
4635
4474
  defaultMix = 0;
4636
4475
  constructor(skeletonData) {
4637
- if (!skeletonData)
4638
- throw new Error("skeletonData cannot be null.");
4476
+ if (!skeletonData) throw new Error("skeletonData cannot be null.");
4639
4477
  this.skeletonData = skeletonData;
4640
4478
  }
4641
4479
  /** Sets a mix duration by animation name.
@@ -4643,21 +4481,17 @@ var spine = (() => {
4643
4481
  * See {@link #setMixWith()}. */
4644
4482
  setMix(fromName, toName, duration) {
4645
4483
  let from = this.skeletonData.findAnimation(fromName);
4646
- if (!from)
4647
- throw new Error("Animation not found: " + fromName);
4484
+ if (!from) throw new Error("Animation not found: " + fromName);
4648
4485
  let to = this.skeletonData.findAnimation(toName);
4649
- if (!to)
4650
- throw new Error("Animation not found: " + toName);
4486
+ if (!to) throw new Error("Animation not found: " + toName);
4651
4487
  this.setMixWith(from, to, duration);
4652
4488
  }
4653
4489
  /** Sets the mix duration when changing from the specified animation to the other.
4654
4490
  *
4655
4491
  * See {@link TrackEntry#mixDuration}. */
4656
4492
  setMixWith(from, to, duration) {
4657
- if (!from)
4658
- throw new Error("from cannot be null.");
4659
- if (!to)
4660
- throw new Error("to cannot be null.");
4493
+ if (!from) throw new Error("from cannot be null.");
4494
+ if (!to) throw new Error("to cannot be null.");
4661
4495
  let key = from.name + "." + to.name;
4662
4496
  this.animationToMixTime[key] = duration;
4663
4497
  }
@@ -4671,13 +4505,13 @@ var spine = (() => {
4671
4505
  };
4672
4506
 
4673
4507
  // spine-core/src/attachments/BoundingBoxAttachment.ts
4674
- var BoundingBoxAttachment = class extends VertexAttachment {
4508
+ var BoundingBoxAttachment = class _BoundingBoxAttachment extends VertexAttachment {
4675
4509
  color = new Color(1, 1, 1, 1);
4676
4510
  constructor(name) {
4677
4511
  super(name);
4678
4512
  }
4679
4513
  copy() {
4680
- let copy = new BoundingBoxAttachment(this.name);
4514
+ let copy = new _BoundingBoxAttachment(this.name);
4681
4515
  this.copyTo(copy);
4682
4516
  copy.color.setFromColor(this.color);
4683
4517
  return copy;
@@ -4685,7 +4519,7 @@ var spine = (() => {
4685
4519
  };
4686
4520
 
4687
4521
  // spine-core/src/attachments/ClippingAttachment.ts
4688
- var ClippingAttachment = class extends VertexAttachment {
4522
+ var ClippingAttachment = class _ClippingAttachment extends VertexAttachment {
4689
4523
  /** Clipping is performed between the clipping polygon's slot and the end slot. Returns null if clipping is done until the end of
4690
4524
  * the skeleton's rendering. */
4691
4525
  endSlot = null;
@@ -4698,7 +4532,7 @@ var spine = (() => {
4698
4532
  super(name);
4699
4533
  }
4700
4534
  copy() {
4701
- let copy = new ClippingAttachment(this.name);
4535
+ let copy = new _ClippingAttachment(this.name);
4702
4536
  this.copyTo(copy);
4703
4537
  copy.endSlot = this.endSlot;
4704
4538
  copy.color.setFromColor(this.color);
@@ -4774,10 +4608,8 @@ var spine = (() => {
4774
4608
  page2.magFilter = Utils.enumValue(TextureFilter, entry[2]);
4775
4609
  };
4776
4610
  pageFields["repeat"] = (page2) => {
4777
- if (entry[1].indexOf("x") != -1)
4778
- page2.uWrap = 10497 /* Repeat */;
4779
- if (entry[1].indexOf("y") != -1)
4780
- page2.vWrap = 10497 /* Repeat */;
4611
+ if (entry[1].indexOf("x") != -1) page2.uWrap = 10497 /* Repeat */;
4612
+ if (entry[1].indexOf("y") != -1) page2.vWrap = 10497 /* Repeat */;
4781
4613
  };
4782
4614
  pageFields["pma"] = (page2) => {
4783
4615
  page2.pma = entry[1] == "true";
@@ -4825,45 +4657,37 @@ var spine = (() => {
4825
4657
  while (line && line.trim().length == 0)
4826
4658
  line = reader.readLine();
4827
4659
  while (true) {
4828
- if (!line || line.trim().length == 0)
4829
- break;
4830
- if (reader.readEntry(entry, line) == 0)
4831
- break;
4660
+ if (!line || line.trim().length == 0) break;
4661
+ if (reader.readEntry(entry, line) == 0) break;
4832
4662
  line = reader.readLine();
4833
4663
  }
4834
4664
  let page = null;
4835
4665
  let names = null;
4836
4666
  let values = null;
4837
4667
  while (true) {
4838
- if (line === null)
4839
- break;
4668
+ if (line === null) break;
4840
4669
  if (line.trim().length == 0) {
4841
4670
  page = null;
4842
4671
  line = reader.readLine();
4843
4672
  } else if (!page) {
4844
4673
  page = new TextureAtlasPage(line.trim());
4845
4674
  while (true) {
4846
- if (reader.readEntry(entry, line = reader.readLine()) == 0)
4847
- break;
4675
+ if (reader.readEntry(entry, line = reader.readLine()) == 0) break;
4848
4676
  let field = pageFields[entry[0]];
4849
- if (field)
4850
- field(page);
4677
+ if (field) field(page);
4851
4678
  }
4852
4679
  this.pages.push(page);
4853
4680
  } else {
4854
4681
  let region = new TextureAtlasRegion(page, line);
4855
4682
  while (true) {
4856
4683
  let count = reader.readEntry(entry, line = reader.readLine());
4857
- if (count == 0)
4858
- break;
4684
+ if (count == 0) break;
4859
4685
  let field = regionFields[entry[0]];
4860
4686
  if (field)
4861
4687
  field(region);
4862
4688
  else {
4863
- if (!names)
4864
- names = [];
4865
- if (!values)
4866
- values = [];
4689
+ if (!names) names = [];
4690
+ if (!values) values = [];
4867
4691
  names.push(entry[0]);
4868
4692
  let entryValues = [];
4869
4693
  for (let i = 0; i < count; i++)
@@ -4924,14 +4748,11 @@ var spine = (() => {
4924
4748
  return this.lines[this.index++];
4925
4749
  }
4926
4750
  readEntry(entry, line) {
4927
- if (!line)
4928
- return 0;
4751
+ if (!line) return 0;
4929
4752
  line = line.trim();
4930
- if (line.length == 0)
4931
- return 0;
4753
+ if (line.length == 0) return 0;
4932
4754
  let colon = line.indexOf(":");
4933
- if (colon == -1)
4934
- return 0;
4755
+ if (colon == -1) return 0;
4935
4756
  entry[0] = line.substr(0, colon).trim();
4936
4757
  for (let i = 1, lastMatch = colon + 1; ; i++) {
4937
4758
  let comma = line.indexOf(",", lastMatch);
@@ -4941,8 +4762,7 @@ var spine = (() => {
4941
4762
  }
4942
4763
  entry[i] = line.substr(lastMatch, comma - lastMatch).trim();
4943
4764
  lastMatch = comma + 1;
4944
- if (i == 4)
4945
- return 4;
4765
+ if (i == 4) return 4;
4946
4766
  }
4947
4767
  }
4948
4768
  };
@@ -4990,7 +4810,7 @@ var spine = (() => {
4990
4810
  };
4991
4811
 
4992
4812
  // spine-core/src/attachments/MeshAttachment.ts
4993
- var MeshAttachment = class extends VertexAttachment {
4813
+ var MeshAttachment = class _MeshAttachment extends VertexAttachment {
4994
4814
  region = null;
4995
4815
  /** The name of the texture region for this attachment. */
4996
4816
  path;
@@ -5023,11 +4843,9 @@ var spine = (() => {
5023
4843
  /** Calculates {@link #uvs} using the {@link #regionUVs} and region. Must be called if the region, the region's properties, or
5024
4844
  * the {@link #regionUVs} are changed. */
5025
4845
  updateRegion() {
5026
- if (!this.region)
5027
- throw new Error("Region not set.");
4846
+ if (!this.region) throw new Error("Region not set.");
5028
4847
  let regionUVs = this.regionUVs;
5029
- if (!this.uvs || this.uvs.length != regionUVs.length)
5030
- this.uvs = Utils.newFloatArray(regionUVs.length);
4848
+ if (!this.uvs || this.uvs.length != regionUVs.length) this.uvs = Utils.newFloatArray(regionUVs.length);
5031
4849
  let uvs = this.uvs;
5032
4850
  let n = this.uvs.length;
5033
4851
  let u = this.region.u, v = this.region.v, width = 0, height = 0;
@@ -5102,9 +4920,8 @@ var spine = (() => {
5102
4920
  }
5103
4921
  }
5104
4922
  copy() {
5105
- if (this.parentMesh)
5106
- return this.newLinkedMesh();
5107
- let copy = new MeshAttachment(this.name, this.path);
4923
+ if (this.parentMesh) return this.newLinkedMesh();
4924
+ let copy = new _MeshAttachment(this.name, this.path);
5108
4925
  copy.region = this.region;
5109
4926
  copy.color.setFromColor(this.color);
5110
4927
  this.copyTo(copy);
@@ -5125,25 +4942,23 @@ var spine = (() => {
5125
4942
  return copy;
5126
4943
  }
5127
4944
  computeWorldVertices(slot, start, count, worldVertices2, offset, stride) {
5128
- if (this.sequence != null)
5129
- this.sequence.apply(slot, this);
4945
+ if (this.sequence != null) this.sequence.apply(slot, this);
5130
4946
  super.computeWorldVertices(slot, start, count, worldVertices2, offset, stride);
5131
4947
  }
5132
4948
  /** Returns a new mesh with the {@link #parentMesh} set to this mesh's parent mesh, if any, else to this mesh. **/
5133
4949
  newLinkedMesh() {
5134
- let copy = new MeshAttachment(this.name, this.path);
4950
+ let copy = new _MeshAttachment(this.name, this.path);
5135
4951
  copy.region = this.region;
5136
4952
  copy.color.setFromColor(this.color);
5137
4953
  copy.timelineAttachment = this.timelineAttachment;
5138
4954
  copy.setParentMesh(this.parentMesh ? this.parentMesh : this);
5139
- if (copy.region != null)
5140
- copy.updateRegion();
4955
+ if (copy.region != null) copy.updateRegion();
5141
4956
  return copy;
5142
4957
  }
5143
4958
  };
5144
4959
 
5145
4960
  // spine-core/src/attachments/PathAttachment.ts
5146
- var PathAttachment = class extends VertexAttachment {
4961
+ var PathAttachment = class _PathAttachment extends VertexAttachment {
5147
4962
  /** The lengths along the path in the setup pose from the start of the path to the end of each Bezier curve. */
5148
4963
  lengths = [];
5149
4964
  /** If true, the start and end knots are connected. */
@@ -5158,7 +4973,7 @@ var spine = (() => {
5158
4973
  super(name);
5159
4974
  }
5160
4975
  copy() {
5161
- let copy = new PathAttachment(this.name);
4976
+ let copy = new _PathAttachment(this.name);
5162
4977
  this.copyTo(copy);
5163
4978
  copy.lengths = new Array(this.lengths.length);
5164
4979
  Utils.arrayCopy(this.lengths, 0, copy.lengths, 0, this.lengths.length);
@@ -5170,7 +4985,7 @@ var spine = (() => {
5170
4985
  };
5171
4986
 
5172
4987
  // spine-core/src/attachments/PointAttachment.ts
5173
- var PointAttachment = class extends VertexAttachment {
4988
+ var PointAttachment = class _PointAttachment extends VertexAttachment {
5174
4989
  x = 0;
5175
4990
  y = 0;
5176
4991
  rotation = 0;
@@ -5192,7 +5007,7 @@ var spine = (() => {
5192
5007
  return MathUtils.atan2Deg(y, x);
5193
5008
  }
5194
5009
  copy() {
5195
- let copy = new PointAttachment(this.name);
5010
+ let copy = new _PointAttachment(this.name);
5196
5011
  copy.x = this.x;
5197
5012
  copy.y = this.y;
5198
5013
  copy.rotation = this.rotation;
@@ -5202,7 +5017,7 @@ var spine = (() => {
5202
5017
  };
5203
5018
 
5204
5019
  // spine-core/src/attachments/RegionAttachment.ts
5205
- var _RegionAttachment = class extends Attachment {
5020
+ var RegionAttachment = class _RegionAttachment extends Attachment {
5206
5021
  /** The local x translation. */
5207
5022
  x = 0;
5208
5023
  /** The local y translation. */
@@ -5235,8 +5050,7 @@ var spine = (() => {
5235
5050
  }
5236
5051
  /** Calculates the {@link #offset} using the region settings. Must be called after changing region settings. */
5237
5052
  updateRegion() {
5238
- if (!this.region)
5239
- throw new Error("Region not set.");
5053
+ if (!this.region) throw new Error("Region not set.");
5240
5054
  let region = this.region;
5241
5055
  let uvs = this.uvs;
5242
5056
  if (region == null) {
@@ -5349,40 +5163,39 @@ var spine = (() => {
5349
5163
  copy.sequence = this.sequence != null ? this.sequence.copy() : null;
5350
5164
  return copy;
5351
5165
  }
5166
+ static X1 = 0;
5167
+ static Y1 = 1;
5168
+ static C1R = 2;
5169
+ static C1G = 3;
5170
+ static C1B = 4;
5171
+ static C1A = 5;
5172
+ static U1 = 6;
5173
+ static V1 = 7;
5174
+ static X2 = 8;
5175
+ static Y2 = 9;
5176
+ static C2R = 10;
5177
+ static C2G = 11;
5178
+ static C2B = 12;
5179
+ static C2A = 13;
5180
+ static U2 = 14;
5181
+ static V2 = 15;
5182
+ static X3 = 16;
5183
+ static Y3 = 17;
5184
+ static C3R = 18;
5185
+ static C3G = 19;
5186
+ static C3B = 20;
5187
+ static C3A = 21;
5188
+ static U3 = 22;
5189
+ static V3 = 23;
5190
+ static X4 = 24;
5191
+ static Y4 = 25;
5192
+ static C4R = 26;
5193
+ static C4G = 27;
5194
+ static C4B = 28;
5195
+ static C4A = 29;
5196
+ static U4 = 30;
5197
+ static V4 = 31;
5352
5198
  };
5353
- var RegionAttachment = _RegionAttachment;
5354
- __publicField(RegionAttachment, "X1", 0);
5355
- __publicField(RegionAttachment, "Y1", 1);
5356
- __publicField(RegionAttachment, "C1R", 2);
5357
- __publicField(RegionAttachment, "C1G", 3);
5358
- __publicField(RegionAttachment, "C1B", 4);
5359
- __publicField(RegionAttachment, "C1A", 5);
5360
- __publicField(RegionAttachment, "U1", 6);
5361
- __publicField(RegionAttachment, "V1", 7);
5362
- __publicField(RegionAttachment, "X2", 8);
5363
- __publicField(RegionAttachment, "Y2", 9);
5364
- __publicField(RegionAttachment, "C2R", 10);
5365
- __publicField(RegionAttachment, "C2G", 11);
5366
- __publicField(RegionAttachment, "C2B", 12);
5367
- __publicField(RegionAttachment, "C2A", 13);
5368
- __publicField(RegionAttachment, "U2", 14);
5369
- __publicField(RegionAttachment, "V2", 15);
5370
- __publicField(RegionAttachment, "X3", 16);
5371
- __publicField(RegionAttachment, "Y3", 17);
5372
- __publicField(RegionAttachment, "C3R", 18);
5373
- __publicField(RegionAttachment, "C3G", 19);
5374
- __publicField(RegionAttachment, "C3B", 20);
5375
- __publicField(RegionAttachment, "C3A", 21);
5376
- __publicField(RegionAttachment, "U3", 22);
5377
- __publicField(RegionAttachment, "V3", 23);
5378
- __publicField(RegionAttachment, "X4", 24);
5379
- __publicField(RegionAttachment, "Y4", 25);
5380
- __publicField(RegionAttachment, "C4R", 26);
5381
- __publicField(RegionAttachment, "C4G", 27);
5382
- __publicField(RegionAttachment, "C4B", 28);
5383
- __publicField(RegionAttachment, "C4A", 29);
5384
- __publicField(RegionAttachment, "U4", 30);
5385
- __publicField(RegionAttachment, "V4", 31);
5386
5199
 
5387
5200
  // spine-core/src/AtlasAttachmentLoader.ts
5388
5201
  var AtlasAttachmentLoader = class {
@@ -5395,8 +5208,7 @@ var spine = (() => {
5395
5208
  for (let i = 0, n = regions.length; i < n; i++) {
5396
5209
  let path = sequence.getPath(basePath, i);
5397
5210
  let region = this.atlas.findRegion(path);
5398
- if (region == null)
5399
- throw new Error("Region not found in atlas: " + path + " (sequence: " + name + ")");
5211
+ if (region == null) throw new Error("Region not found in atlas: " + path + " (sequence: " + name + ")");
5400
5212
  regions[i] = region;
5401
5213
  }
5402
5214
  }
@@ -5406,8 +5218,7 @@ var spine = (() => {
5406
5218
  this.loadSequence(name, path, sequence);
5407
5219
  } else {
5408
5220
  let region = this.atlas.findRegion(path);
5409
- if (!region)
5410
- throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
5221
+ if (!region) throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
5411
5222
  attachment.region = region;
5412
5223
  }
5413
5224
  return attachment;
@@ -5418,8 +5229,7 @@ var spine = (() => {
5418
5229
  this.loadSequence(name, path, sequence);
5419
5230
  } else {
5420
5231
  let region = this.atlas.findRegion(path);
5421
- if (!region)
5422
- throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
5232
+ if (!region) throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
5423
5233
  attachment.region = region;
5424
5234
  }
5425
5235
  return attachment;
@@ -5463,7 +5273,7 @@ var spine = (() => {
5463
5273
  /** The local shearX. */
5464
5274
  shearY = 0;
5465
5275
  /** The transform mode for how parent world transforms affect this bone. */
5466
- inherit = Inherit.Normal;
5276
+ inherit = 0 /* Normal */;
5467
5277
  /** When true, {@link Skeleton#updateWorldTransform()} only updates this bone if the {@link Skeleton#skin} contains this
5468
5278
  * bone.
5469
5279
  * @see Skin#bones */
@@ -5476,10 +5286,8 @@ var spine = (() => {
5476
5286
  /** False if the bone was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */
5477
5287
  visible = false;
5478
5288
  constructor(index, name, parent) {
5479
- if (index < 0)
5480
- throw new Error("index must be >= 0.");
5481
- if (!name)
5482
- throw new Error("name cannot be null.");
5289
+ if (index < 0) throw new Error("index must be >= 0.");
5290
+ if (!name) throw new Error("name cannot be null.");
5483
5291
  this.index = index;
5484
5292
  this.name = name;
5485
5293
  this.parent = parent;
@@ -5549,10 +5357,8 @@ var spine = (() => {
5549
5357
  active = false;
5550
5358
  /** @param parent May be null. */
5551
5359
  constructor(data, skeleton, parent) {
5552
- if (!data)
5553
- throw new Error("data cannot be null.");
5554
- if (!skeleton)
5555
- throw new Error("skeleton cannot be null.");
5360
+ if (!data) throw new Error("data cannot be null.");
5361
+ if (!skeleton) throw new Error("skeleton cannot be null.");
5556
5362
  this.data = data;
5557
5363
  this.skeleton = skeleton;
5558
5364
  this.parent = parent;
@@ -5661,13 +5467,11 @@ var spine = (() => {
5661
5467
  let za = (pa * cos + pb * sin) / this.skeleton.scaleX;
5662
5468
  let zc = (pc * cos + pd * sin) / this.skeleton.scaleY;
5663
5469
  let s = Math.sqrt(za * za + zc * zc);
5664
- if (s > 1e-5)
5665
- s = 1 / s;
5470
+ if (s > 1e-5) s = 1 / s;
5666
5471
  za *= s;
5667
5472
  zc *= s;
5668
5473
  s = Math.sqrt(za * za + zc * zc);
5669
- if (this.inherit == 3 /* NoScale */ && pa * pd - pb * pc < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
5670
- s = -s;
5474
+ if (this.inherit == 3 /* NoScale */ && pa * pd - pb * pc < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0)) s = -s;
5671
5475
  rotation = Math.PI / 2 + Math.atan2(zc, za);
5672
5476
  const zb = Math.cos(rotation) * s;
5673
5477
  const zd = Math.sin(rotation) * s;
@@ -5750,13 +5554,11 @@ var spine = (() => {
5750
5554
  pa = (pa * cos + pb * sin) / this.skeleton.scaleX;
5751
5555
  pc = (pc * cos + pd * sin) / this.skeleton.scaleY;
5752
5556
  let s = Math.sqrt(pa * pa + pc * pc);
5753
- if (s > 1e-5)
5754
- s = 1 / s;
5557
+ if (s > 1e-5) s = 1 / s;
5755
5558
  pa *= s;
5756
5559
  pc *= s;
5757
5560
  s = Math.sqrt(pa * pa + pc * pc);
5758
- if (this.inherit == 3 /* NoScale */ && pid < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
5759
- s = -s;
5561
+ if (this.inherit == 3 /* NoScale */ && pid < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0)) s = -s;
5760
5562
  let r = MathUtils.PI / 2 + Math.atan2(pc, pa);
5761
5563
  pb = Math.cos(r) * s;
5762
5564
  pd = Math.sin(r) * s;
@@ -5818,14 +5620,12 @@ var spine = (() => {
5818
5620
  }
5819
5621
  /** Transforms a point from world coordinates to the parent bone's local coordinates. */
5820
5622
  worldToParent(world) {
5821
- if (world == null)
5822
- throw new Error("world cannot be null.");
5623
+ if (world == null) throw new Error("world cannot be null.");
5823
5624
  return this.parent == null ? world : this.parent.worldToLocal(world);
5824
5625
  }
5825
5626
  /** Transforms a point from the parent bone's coordinates to world coordinates. */
5826
5627
  parentToWorld(world) {
5827
- if (world == null)
5828
- throw new Error("world cannot be null.");
5628
+ if (world == null) throw new Error("world cannot be null.");
5829
5629
  return this.parent == null ? world : this.parent.localToWorld(world);
5830
5630
  }
5831
5631
  /** Transforms a world rotation to a local rotation. */
@@ -5869,6 +5669,8 @@ var spine = (() => {
5869
5669
  textureLoader;
5870
5670
  downloader;
5871
5671
  assets = {};
5672
+ assetsRefCount = {};
5673
+ assetsLoaded = {};
5872
5674
  errors = {};
5873
5675
  toLoad = 0;
5874
5676
  loaded = 0;
@@ -5885,24 +5687,21 @@ var spine = (() => {
5885
5687
  this.toLoad--;
5886
5688
  this.loaded++;
5887
5689
  this.assets[path] = asset;
5888
- if (callback)
5889
- callback(path, asset);
5690
+ this.assetsRefCount[path] = (this.assetsRefCount[path] || 0) + 1;
5691
+ if (callback) callback(path, asset);
5890
5692
  }
5891
5693
  error(callback, path, message) {
5892
5694
  this.toLoad--;
5893
5695
  this.loaded++;
5894
5696
  this.errors[path] = message;
5895
- if (callback)
5896
- callback(path, message);
5697
+ if (callback) callback(path, message);
5897
5698
  }
5898
5699
  loadAll() {
5899
5700
  let promise = new Promise((resolve, reject) => {
5900
5701
  let check = () => {
5901
5702
  if (this.isLoadingComplete()) {
5902
- if (this.hasErrors())
5903
- reject(this.errors);
5904
- else
5905
- resolve(this);
5703
+ if (this.hasErrors()) reject(this.errors);
5704
+ else resolve(this);
5906
5705
  return;
5907
5706
  }
5908
5707
  requestAnimationFrame(check);
@@ -5918,10 +5717,16 @@ var spine = (() => {
5918
5717
  }, error = () => {
5919
5718
  }) {
5920
5719
  path = this.start(path);
5921
- this.downloader.downloadBinary(path, (data) => {
5922
- this.success(success, path, data);
5923
- }, (status, responseText) => {
5924
- this.error(error, path, `Couldn't load binary ${path}: status ${status}, ${responseText}`);
5720
+ if (this.reuseAssets(path, success, error)) return;
5721
+ this.assetsLoaded[path] = new Promise((resolve, reject) => {
5722
+ this.downloader.downloadBinary(path, (data) => {
5723
+ this.success(success, path, data);
5724
+ resolve(data);
5725
+ }, (status, responseText) => {
5726
+ const errorMsg = `Couldn't load binary ${path}: status ${status}, ${responseText}`;
5727
+ this.error(error, path, errorMsg);
5728
+ reject(errorMsg);
5729
+ });
5925
5730
  });
5926
5731
  }
5927
5732
  loadText(path, success = () => {
@@ -5938,43 +5743,69 @@ var spine = (() => {
5938
5743
  }, error = () => {
5939
5744
  }) {
5940
5745
  path = this.start(path);
5941
- this.downloader.downloadJson(path, (data) => {
5942
- this.success(success, path, data);
5943
- }, (status, responseText) => {
5944
- this.error(error, path, `Couldn't load JSON ${path}: status ${status}, ${responseText}`);
5746
+ if (this.reuseAssets(path, success, error)) return;
5747
+ this.assetsLoaded[path] = new Promise((resolve, reject) => {
5748
+ this.downloader.downloadJson(path, (data) => {
5749
+ this.success(success, path, data);
5750
+ resolve(data);
5751
+ }, (status, responseText) => {
5752
+ const errorMsg = `Couldn't load JSON ${path}: status ${status}, ${responseText}`;
5753
+ this.error(error, path, errorMsg);
5754
+ reject(errorMsg);
5755
+ });
5945
5756
  });
5946
5757
  }
5758
+ reuseAssets(path, success = () => {
5759
+ }, error = () => {
5760
+ }) {
5761
+ const loadedStatus = this.assetsLoaded[path];
5762
+ const alreadyExistsOrLoading = loadedStatus !== void 0;
5763
+ if (alreadyExistsOrLoading) {
5764
+ loadedStatus.then((data) => this.success(success, path, data)).catch((errorMsg) => this.error(error, path, errorMsg));
5765
+ }
5766
+ return alreadyExistsOrLoading;
5767
+ }
5947
5768
  loadTexture(path, success = () => {
5948
5769
  }, error = () => {
5949
5770
  }) {
5950
5771
  path = this.start(path);
5951
- let isBrowser = !!(typeof window !== "undefined" && typeof navigator !== "undefined" && window.document);
5952
- let isWebWorker = !isBrowser;
5953
- if (isWebWorker) {
5954
- fetch(path, { mode: "cors" }).then((response) => {
5955
- if (response.ok)
5956
- return response.blob();
5957
- this.error(error, path, `Couldn't load image: ${path}`);
5958
- return null;
5959
- }).then((blob) => {
5960
- return blob ? createImageBitmap(blob, { premultiplyAlpha: "none", colorSpaceConversion: "none" }) : null;
5961
- }).then((bitmap) => {
5962
- if (bitmap)
5963
- this.success(success, path, this.textureLoader(bitmap));
5964
- });
5965
- } else {
5966
- let image = new Image();
5967
- image.crossOrigin = "anonymous";
5968
- image.onload = () => {
5969
- this.success(success, path, this.textureLoader(image));
5970
- };
5971
- image.onerror = () => {
5972
- this.error(error, path, `Couldn't load image: ${path}`);
5973
- };
5974
- if (this.downloader.rawDataUris[path])
5975
- path = this.downloader.rawDataUris[path];
5976
- image.src = path;
5977
- }
5772
+ if (this.reuseAssets(path, success, error)) return;
5773
+ this.assetsLoaded[path] = new Promise((resolve, reject) => {
5774
+ let isBrowser = !!(typeof window !== "undefined" && typeof navigator !== "undefined" && window.document);
5775
+ let isWebWorker = !isBrowser;
5776
+ if (isWebWorker) {
5777
+ fetch(path, { mode: "cors" }).then((response) => {
5778
+ if (response.ok) return response.blob();
5779
+ const errorMsg = `Couldn't load image: ${path}`;
5780
+ this.error(error, path, `Couldn't load image: ${path}`);
5781
+ reject(errorMsg);
5782
+ }).then((blob) => {
5783
+ return blob ? createImageBitmap(blob, { premultiplyAlpha: "none", colorSpaceConversion: "none" }) : null;
5784
+ }).then((bitmap) => {
5785
+ if (bitmap) {
5786
+ const texture = this.textureLoader(bitmap);
5787
+ this.success(success, path, texture);
5788
+ resolve(texture);
5789
+ }
5790
+ ;
5791
+ });
5792
+ } else {
5793
+ let image = new Image();
5794
+ image.crossOrigin = "anonymous";
5795
+ image.onload = () => {
5796
+ const texture = this.textureLoader(image);
5797
+ this.success(success, path, texture);
5798
+ resolve(texture);
5799
+ };
5800
+ image.onerror = () => {
5801
+ const errorMsg = `Couldn't load image: ${path}`;
5802
+ this.error(error, path, errorMsg);
5803
+ reject(errorMsg);
5804
+ };
5805
+ if (this.downloader.rawDataUris[path]) path = this.downloader.rawDataUris[path];
5806
+ image.src = path;
5807
+ }
5808
+ });
5978
5809
  }
5979
5810
  loadTextureAtlas(path, success = () => {
5980
5811
  }, error = () => {
@@ -5982,32 +5813,113 @@ var spine = (() => {
5982
5813
  let index = path.lastIndexOf("/");
5983
5814
  let parent = index >= 0 ? path.substring(0, index + 1) : "";
5984
5815
  path = this.start(path);
5985
- this.downloader.downloadText(path, (atlasText) => {
5986
- try {
5987
- let atlas = new TextureAtlas(atlasText);
5988
- let toLoad = atlas.pages.length, abort = false;
5989
- for (let page of atlas.pages) {
5990
- this.loadTexture(
5991
- !fileAlias ? parent + page.name : fileAlias[page.name],
5992
- (imagePath, texture) => {
5993
- if (!abort) {
5994
- page.setTexture(texture);
5995
- if (--toLoad == 0)
5996
- this.success(success, path, atlas);
5816
+ if (this.reuseAssets(path, success, error)) return;
5817
+ this.assetsLoaded[path] = new Promise((resolve, reject) => {
5818
+ this.downloader.downloadText(path, (atlasText) => {
5819
+ try {
5820
+ let atlas = new TextureAtlas(atlasText);
5821
+ let toLoad = atlas.pages.length, abort = false;
5822
+ for (let page of atlas.pages) {
5823
+ this.loadTexture(
5824
+ !fileAlias ? parent + page.name : fileAlias[page.name],
5825
+ (imagePath, texture) => {
5826
+ if (!abort) {
5827
+ page.setTexture(texture);
5828
+ if (--toLoad == 0) {
5829
+ this.success(success, path, atlas);
5830
+ resolve(atlas);
5831
+ }
5832
+ }
5833
+ },
5834
+ (imagePath, message) => {
5835
+ if (!abort) {
5836
+ const errorMsg = `Couldn't load texture atlas ${path} page image: ${imagePath}`;
5837
+ this.error(error, path, errorMsg);
5838
+ reject(errorMsg);
5839
+ }
5840
+ abort = true;
5997
5841
  }
5998
- },
5999
- (imagePath, message) => {
6000
- if (!abort)
6001
- this.error(error, path, `Couldn't load texture atlas ${path} page image: ${imagePath}`);
6002
- abort = true;
6003
- }
6004
- );
5842
+ );
5843
+ }
5844
+ } catch (e) {
5845
+ const errorMsg = `Couldn't parse texture atlas ${path}: ${e.message}`;
5846
+ this.error(error, path, errorMsg);
5847
+ reject(errorMsg);
6005
5848
  }
6006
- } catch (e) {
6007
- this.error(error, path, `Couldn't parse texture atlas ${path}: ${e.message}`);
6008
- }
6009
- }, (status, responseText) => {
6010
- this.error(error, path, `Couldn't load texture atlas ${path}: status ${status}, ${responseText}`);
5849
+ }, (status, responseText) => {
5850
+ const errorMsg = `Couldn't load texture atlas ${path}: status ${status}, ${responseText}`;
5851
+ this.error(error, path, errorMsg);
5852
+ reject(errorMsg);
5853
+ });
5854
+ });
5855
+ }
5856
+ loadTextureAtlasButNoTextures(path, success = () => {
5857
+ }, error = () => {
5858
+ }, fileAlias) {
5859
+ path = this.start(path);
5860
+ if (this.reuseAssets(path, success, error)) return;
5861
+ this.assetsLoaded[path] = new Promise((resolve, reject) => {
5862
+ this.downloader.downloadText(path, (atlasText) => {
5863
+ try {
5864
+ const atlas = new TextureAtlas(atlasText);
5865
+ this.success(success, path, atlas);
5866
+ resolve(atlas);
5867
+ } catch (e) {
5868
+ const errorMsg = `Couldn't parse texture atlas ${path}: ${e.message}`;
5869
+ this.error(error, path, errorMsg);
5870
+ reject(errorMsg);
5871
+ }
5872
+ }, (status, responseText) => {
5873
+ const errorMsg = `Couldn't load texture atlas ${path}: status ${status}, ${responseText}`;
5874
+ this.error(error, path, errorMsg);
5875
+ reject(errorMsg);
5876
+ });
5877
+ });
5878
+ }
5879
+ // Promisified versions of load function
5880
+ async loadBinaryAsync(path) {
5881
+ return new Promise((resolve, reject) => {
5882
+ this.loadBinary(
5883
+ path,
5884
+ (_, binary) => resolve(binary),
5885
+ (_, message) => reject(message)
5886
+ );
5887
+ });
5888
+ }
5889
+ async loadJsonAsync(path) {
5890
+ return new Promise((resolve, reject) => {
5891
+ this.loadJson(
5892
+ path,
5893
+ (_, object) => resolve(object),
5894
+ (_, message) => reject(message)
5895
+ );
5896
+ });
5897
+ }
5898
+ async loadTextureAsync(path) {
5899
+ return new Promise((resolve, reject) => {
5900
+ this.loadTexture(
5901
+ path,
5902
+ (_, texture) => resolve(texture),
5903
+ (_, message) => reject(message)
5904
+ );
5905
+ });
5906
+ }
5907
+ async loadTextureAtlasAsync(path) {
5908
+ return new Promise((resolve, reject) => {
5909
+ this.loadTextureAtlas(
5910
+ path,
5911
+ (_, atlas) => resolve(atlas),
5912
+ (_, message) => reject(message)
5913
+ );
5914
+ });
5915
+ }
5916
+ async loadTextureAtlasButNoTexturesAsync(path) {
5917
+ return new Promise((resolve, reject) => {
5918
+ this.loadTextureAtlasButNoTextures(
5919
+ path,
5920
+ (_, atlas) => resolve(atlas),
5921
+ (_, message) => reject(message)
5922
+ );
6011
5923
  });
6012
5924
  }
6013
5925
  get(path) {
@@ -6016,26 +5928,27 @@ var spine = (() => {
6016
5928
  require(path) {
6017
5929
  path = this.pathPrefix + path;
6018
5930
  let asset = this.assets[path];
6019
- if (asset)
6020
- return asset;
5931
+ if (asset) return asset;
6021
5932
  let error = this.errors[path];
6022
5933
  throw Error("Asset not found: " + path + (error ? "\n" + error : ""));
6023
5934
  }
6024
5935
  remove(path) {
6025
5936
  path = this.pathPrefix + path;
6026
5937
  let asset = this.assets[path];
6027
- if (asset.dispose)
6028
- asset.dispose();
5938
+ if (asset.dispose) asset.dispose();
6029
5939
  delete this.assets[path];
5940
+ delete this.assetsRefCount[path];
5941
+ delete this.assetsLoaded[path];
6030
5942
  return asset;
6031
5943
  }
6032
5944
  removeAll() {
6033
- for (let key in this.assets) {
6034
- let asset = this.assets[key];
6035
- if (asset.dispose)
6036
- asset.dispose();
5945
+ for (let path in this.assets) {
5946
+ let asset = this.assets[path];
5947
+ if (asset.dispose) asset.dispose();
6037
5948
  }
6038
5949
  this.assets = {};
5950
+ this.assetsLoaded = {};
5951
+ this.assetsRefCount = {};
6039
5952
  }
6040
5953
  isLoadingComplete() {
6041
5954
  return this.toLoad == 0;
@@ -6049,6 +5962,12 @@ var spine = (() => {
6049
5962
  dispose() {
6050
5963
  this.removeAll();
6051
5964
  }
5965
+ // dispose asset only if it's not used by others
5966
+ disposeAsset(path) {
5967
+ if (--this.assetsRefCount[path] === 0) {
5968
+ this.remove(path);
5969
+ }
5970
+ }
6052
5971
  hasErrors() {
6053
5972
  return Object.keys(this.errors).length > 0;
6054
5973
  }
@@ -6085,18 +6004,16 @@ var spine = (() => {
6085
6004
  throw new Error("Not a data URI.");
6086
6005
  }
6087
6006
  let base64Idx = dataUri.indexOf("base64,");
6088
- if (base64Idx == -1)
6089
- throw new Error("Not a binary data URI.");
6007
+ if (base64Idx == -1) throw new Error("Not a binary data URI.");
6090
6008
  base64Idx += "base64,".length;
6091
6009
  return this.base64ToUint8Array(dataUri.substr(base64Idx));
6092
6010
  }
6093
6011
  downloadText(url, success, error) {
6094
- if (this.start(url, success, error))
6095
- return;
6096
- if (this.rawDataUris[url]) {
6012
+ if (this.start(url, success, error)) return;
6013
+ const rawDataUri = this.rawDataUris[url];
6014
+ if (rawDataUri && !rawDataUri.includes(".")) {
6097
6015
  try {
6098
- let dataUri = this.rawDataUris[url];
6099
- this.finish(url, 200, this.dataUriToString(dataUri));
6016
+ this.finish(url, 200, this.dataUriToString(rawDataUri));
6100
6017
  } catch (e) {
6101
6018
  this.finish(url, 400, JSON.stringify(e));
6102
6019
  }
@@ -6104,7 +6021,7 @@ var spine = (() => {
6104
6021
  }
6105
6022
  let request = new XMLHttpRequest();
6106
6023
  request.overrideMimeType("text/html");
6107
- request.open("GET", url, true);
6024
+ request.open("GET", rawDataUri ? rawDataUri : url, true);
6108
6025
  let done = () => {
6109
6026
  this.finish(url, request.status, request.responseText);
6110
6027
  };
@@ -6118,19 +6035,18 @@ var spine = (() => {
6118
6035
  }, error);
6119
6036
  }
6120
6037
  downloadBinary(url, success, error) {
6121
- if (this.start(url, success, error))
6122
- return;
6123
- if (this.rawDataUris[url]) {
6038
+ if (this.start(url, success, error)) return;
6039
+ const rawDataUri = this.rawDataUris[url];
6040
+ if (rawDataUri && !rawDataUri.includes(".")) {
6124
6041
  try {
6125
- let dataUri = this.rawDataUris[url];
6126
- this.finish(url, 200, this.dataUriToUint8Array(dataUri));
6042
+ this.finish(url, 200, this.dataUriToUint8Array(rawDataUri));
6127
6043
  } catch (e) {
6128
6044
  this.finish(url, 400, JSON.stringify(e));
6129
6045
  }
6130
6046
  return;
6131
6047
  }
6132
6048
  let request = new XMLHttpRequest();
6133
- request.open("GET", url, true);
6049
+ request.open("GET", rawDataUri ? rawDataUri : url, true);
6134
6050
  request.responseType = "arraybuffer";
6135
6051
  let onerror = () => {
6136
6052
  this.finish(url, request.status, request.response);
@@ -6147,8 +6063,7 @@ var spine = (() => {
6147
6063
  start(url, success, error) {
6148
6064
  let callbacks = this.callbacks[url];
6149
6065
  try {
6150
- if (callbacks)
6151
- return true;
6066
+ if (callbacks) return true;
6152
6067
  this.callbacks[url] = callbacks = [];
6153
6068
  } finally {
6154
6069
  callbacks.push(success, error);
@@ -6173,8 +6088,7 @@ var spine = (() => {
6173
6088
  volume = 0;
6174
6089
  balance = 0;
6175
6090
  constructor(time, data) {
6176
- if (!data)
6177
- throw new Error("data cannot be null.");
6091
+ if (!data) throw new Error("data cannot be null.");
6178
6092
  this.time = time;
6179
6093
  this.data = data;
6180
6094
  }
@@ -6215,21 +6129,17 @@ var spine = (() => {
6215
6129
  softness = 0;
6216
6130
  active = false;
6217
6131
  constructor(data, skeleton) {
6218
- if (!data)
6219
- throw new Error("data cannot be null.");
6220
- if (!skeleton)
6221
- throw new Error("skeleton cannot be null.");
6132
+ if (!data) throw new Error("data cannot be null.");
6133
+ if (!skeleton) throw new Error("skeleton cannot be null.");
6222
6134
  this.data = data;
6223
6135
  this.bones = new Array();
6224
6136
  for (let i = 0; i < data.bones.length; i++) {
6225
6137
  let bone = skeleton.findBone(data.bones[i].name);
6226
- if (!bone)
6227
- throw new Error(`Couldn't find bone ${data.bones[i].name}`);
6138
+ if (!bone) throw new Error(`Couldn't find bone ${data.bones[i].name}`);
6228
6139
  this.bones.push(bone);
6229
6140
  }
6230
6141
  let target = skeleton.findBone(data.target.name);
6231
- if (!target)
6232
- throw new Error(`Couldn't find bone ${data.target.name}`);
6142
+ if (!target) throw new Error(`Couldn't find bone ${data.target.name}`);
6233
6143
  this.target = target;
6234
6144
  this.mix = data.mix;
6235
6145
  this.softness = data.softness;
@@ -6249,8 +6159,7 @@ var spine = (() => {
6249
6159
  this.stretch = data.stretch;
6250
6160
  }
6251
6161
  update(physics) {
6252
- if (this.mix == 0)
6253
- return;
6162
+ if (this.mix == 0) return;
6254
6163
  let target = this.target;
6255
6164
  let bones = this.bones;
6256
6165
  switch (bones.length) {
@@ -6265,8 +6174,7 @@ var spine = (() => {
6265
6174
  /** Applies 1 bone IK. The target is specified in the world coordinate system. */
6266
6175
  apply1(bone, targetX, targetY, compress, stretch, uniform, alpha) {
6267
6176
  let p = bone.parent;
6268
- if (!p)
6269
- throw new Error("IK bone must have parent.");
6177
+ if (!p) throw new Error("IK bone must have parent.");
6270
6178
  let pa = p.a, pb = p.b, pc = p.c, pd = p.d;
6271
6179
  let rotationIK = -bone.ashearX - bone.arotation, tx = 0, ty = 0;
6272
6180
  switch (bone.inherit) {
@@ -6281,6 +6189,7 @@ var spine = (() => {
6281
6189
  pb = -sc * s * bone.skeleton.scaleX;
6282
6190
  pd = sa * s * bone.skeleton.scaleY;
6283
6191
  rotationIK += Math.atan2(sc, sa) * MathUtils.radDeg;
6192
+ // Fall through
6284
6193
  default:
6285
6194
  let x = targetX - p.worldX, y = targetY - p.worldY;
6286
6195
  let d = pa * pd - pb * pc;
@@ -6293,8 +6202,7 @@ var spine = (() => {
6293
6202
  }
6294
6203
  }
6295
6204
  rotationIK += Math.atan2(ty, tx) * MathUtils.radDeg;
6296
- if (bone.ascaleX < 0)
6297
- rotationIK += 180;
6205
+ if (bone.ascaleX < 0) rotationIK += 180;
6298
6206
  if (rotationIK > 180)
6299
6207
  rotationIK -= 360;
6300
6208
  else if (rotationIK < -180)
@@ -6313,8 +6221,7 @@ var spine = (() => {
6313
6221
  if (compress && dd < b * b || stretch && dd > b * b) {
6314
6222
  const s = (Math.sqrt(dd) / b - 1) * alpha + 1;
6315
6223
  sx *= s;
6316
- if (uniform)
6317
- sy *= s;
6224
+ if (uniform) sy *= s;
6318
6225
  }
6319
6226
  }
6320
6227
  }
@@ -6331,8 +6238,7 @@ var spine = (() => {
6331
6238
  /** Applies 2 bone IK. The target is specified in the world coordinate system.
6332
6239
  * @param child A direct descendant of the parent bone. */
6333
6240
  apply2(parent, child, targetX, targetY, bendDir, stretch, uniform, softness, alpha) {
6334
- if (parent.inherit != 0 /* Normal */ || child.inherit != 0 /* Normal */)
6335
- return;
6241
+ if (parent.inherit != 0 /* Normal */ || child.inherit != 0 /* Normal */) return;
6336
6242
  let px = parent.ax, py = parent.ay, psx = parent.ascaleX, psy = parent.ascaleY, sx = psx, sy = psy, csx = child.ascaleX;
6337
6243
  let os1 = 0, os2 = 0, s2 = 0;
6338
6244
  if (psx < 0) {
@@ -6364,8 +6270,7 @@ var spine = (() => {
6364
6270
  cwy = c * cx + d * cy + parent.worldY;
6365
6271
  }
6366
6272
  let pp = parent.parent;
6367
- if (!pp)
6368
- throw new Error("IK parent must itself have a parent.");
6273
+ if (!pp) throw new Error("IK parent must itself have a parent.");
6369
6274
  a = pp.a;
6370
6275
  b = pp.b;
6371
6276
  c = pp.c;
@@ -6407,8 +6312,7 @@ var spine = (() => {
6407
6312
  if (stretch) {
6408
6313
  a = (Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1;
6409
6314
  sx *= a;
6410
- if (uniform)
6411
- sy *= a;
6315
+ if (uniform) sy *= a;
6412
6316
  }
6413
6317
  } else
6414
6318
  a2 = Math.acos(cos) * bendDir;
@@ -6424,8 +6328,7 @@ var spine = (() => {
6424
6328
  d = c1 * c1 - 4 * c2 * c;
6425
6329
  if (d >= 0) {
6426
6330
  let q = Math.sqrt(d);
6427
- if (c1 < 0)
6428
- q = -q;
6331
+ if (c1 < 0) q = -q;
6429
6332
  q = -(c1 + q) * 0.5;
6430
6333
  let r0 = q / c2, r1 = c / q;
6431
6334
  let r = Math.abs(r0) < Math.abs(r1) ? r0 : r1;
@@ -6494,10 +6397,8 @@ var spine = (() => {
6494
6397
  this._target = boneData;
6495
6398
  }
6496
6399
  get target() {
6497
- if (!this._target)
6498
- throw new Error("BoneData not set.");
6499
- else
6500
- return this._target;
6400
+ if (!this._target) throw new Error("BoneData not set.");
6401
+ else return this._target;
6501
6402
  }
6502
6403
  /** Controls the bend direction of the IK bones, either 1 or -1. */
6503
6404
  bendDirection = 0;
@@ -6528,17 +6429,15 @@ var spine = (() => {
6528
6429
  this._target = slotData;
6529
6430
  }
6530
6431
  get target() {
6531
- if (!this._target)
6532
- throw new Error("SlotData not set.");
6533
- else
6534
- return this._target;
6432
+ if (!this._target) throw new Error("SlotData not set.");
6433
+ else return this._target;
6535
6434
  }
6536
6435
  /** The mode for positioning the first bone on the path. */
6537
- positionMode = PositionMode.Fixed;
6436
+ positionMode = 0 /* Fixed */;
6538
6437
  /** The mode for positioning the bones after the first bone on the path. */
6539
- spacingMode = SpacingMode.Fixed;
6438
+ spacingMode = 1 /* Fixed */;
6540
6439
  /** The mode for adjusting the rotation of the bones. */
6541
- rotateMode = RotateMode.Chain;
6440
+ rotateMode = 1 /* Chain */;
6542
6441
  /** An offset added to the constrained bone rotation. */
6543
6442
  offsetRotation = 0;
6544
6443
  /** The position along the path. */
@@ -6572,7 +6471,11 @@ var spine = (() => {
6572
6471
  })(RotateMode || {});
6573
6472
 
6574
6473
  // spine-core/src/PathConstraint.ts
6575
- var _PathConstraint = class {
6474
+ var PathConstraint = class _PathConstraint {
6475
+ static NONE = -1;
6476
+ static BEFORE = -2;
6477
+ static AFTER = -3;
6478
+ static epsilon = 1e-5;
6576
6479
  /** The path constraint's setup pose data. */
6577
6480
  data;
6578
6481
  /** The bones that will be modified by this path constraint. */
@@ -6594,21 +6497,17 @@ var spine = (() => {
6594
6497
  segments = new Array();
6595
6498
  active = false;
6596
6499
  constructor(data, skeleton) {
6597
- if (!data)
6598
- throw new Error("data cannot be null.");
6599
- if (!skeleton)
6600
- throw new Error("skeleton cannot be null.");
6500
+ if (!data) throw new Error("data cannot be null.");
6501
+ if (!skeleton) throw new Error("skeleton cannot be null.");
6601
6502
  this.data = data;
6602
6503
  this.bones = new Array();
6603
6504
  for (let i = 0, n = data.bones.length; i < n; i++) {
6604
6505
  let bone = skeleton.findBone(data.bones[i].name);
6605
- if (!bone)
6606
- throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
6506
+ if (!bone) throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
6607
6507
  this.bones.push(bone);
6608
6508
  }
6609
6509
  let target = skeleton.findSlot(data.target.name);
6610
- if (!target)
6611
- throw new Error(`Couldn't find target bone ${data.target.name}`);
6510
+ if (!target) throw new Error(`Couldn't find target bone ${data.target.name}`);
6612
6511
  this.target = target;
6613
6512
  this.position = data.position;
6614
6513
  this.spacing = data.spacing;
@@ -6629,11 +6528,9 @@ var spine = (() => {
6629
6528
  }
6630
6529
  update(physics) {
6631
6530
  let attachment = this.target.getAttachment();
6632
- if (!(attachment instanceof PathAttachment))
6633
- return;
6531
+ if (!(attachment instanceof PathAttachment)) return;
6634
6532
  let mixRotate = this.mixRotate, mixX = this.mixX, mixY = this.mixY;
6635
- if (mixRotate == 0 && mixX == 0 && mixY == 0)
6636
- return;
6533
+ if (mixRotate == 0 && mixX == 0 && mixY == 0) return;
6637
6534
  let data = this.data;
6638
6535
  let tangents = data.rotateMode == 0 /* Tangent */, scale = data.rotateMode == 2 /* ChainScale */;
6639
6536
  let bones = this.bones;
@@ -6658,14 +6555,12 @@ var spine = (() => {
6658
6555
  let bone = bones[i];
6659
6556
  let setupLength = bone.data.length;
6660
6557
  if (setupLength < _PathConstraint.epsilon) {
6661
- if (scale)
6662
- lengths[i] = 0;
6558
+ if (scale) lengths[i] = 0;
6663
6559
  spaces[++i] = spacing;
6664
6560
  } else {
6665
6561
  let x = setupLength * bone.a, y = setupLength * bone.c;
6666
6562
  let length = Math.sqrt(x * x + y * y);
6667
- if (scale)
6668
- lengths[i] = length;
6563
+ if (scale) lengths[i] = length;
6669
6564
  spaces[++i] = length;
6670
6565
  sum += length;
6671
6566
  }
@@ -6682,14 +6577,12 @@ var spine = (() => {
6682
6577
  let bone = bones[i];
6683
6578
  let setupLength = bone.data.length;
6684
6579
  if (setupLength < _PathConstraint.epsilon) {
6685
- if (scale)
6686
- lengths[i] = 0;
6580
+ if (scale) lengths[i] = 0;
6687
6581
  spaces[++i] = spacing;
6688
6582
  } else {
6689
6583
  let x = setupLength * bone.a, y = setupLength * bone.c;
6690
6584
  let length = Math.sqrt(x * x + y * y);
6691
- if (scale)
6692
- lengths[i] = length;
6585
+ if (scale) lengths[i] = length;
6693
6586
  spaces[++i] = (lengthSpacing ? setupLength + spacing : spacing) * length / setupLength;
6694
6587
  }
6695
6588
  }
@@ -6762,8 +6655,7 @@ var spine = (() => {
6762
6655
  let lengths = path.lengths;
6763
6656
  curveCount -= closed2 ? 1 : 2;
6764
6657
  let pathLength2 = lengths[curveCount];
6765
- if (this.data.positionMode == 1 /* Percent */)
6766
- position *= pathLength2;
6658
+ if (this.data.positionMode == 1 /* Percent */) position *= pathLength2;
6767
6659
  let multiplier2;
6768
6660
  switch (this.data.spacingMode) {
6769
6661
  case 2 /* Percent */:
@@ -6782,8 +6674,7 @@ var spine = (() => {
6782
6674
  let p = position;
6783
6675
  if (closed2) {
6784
6676
  p %= pathLength2;
6785
- if (p < 0)
6786
- p += pathLength2;
6677
+ if (p < 0) p += pathLength2;
6787
6678
  curve = 0;
6788
6679
  } else if (p < 0) {
6789
6680
  if (prevCurve != _PathConstraint.BEFORE) {
@@ -6802,8 +6693,7 @@ var spine = (() => {
6802
6693
  }
6803
6694
  for (; ; curve++) {
6804
6695
  let length = lengths[curve];
6805
- if (p > length)
6806
- continue;
6696
+ if (p > length) continue;
6807
6697
  if (curve == 0)
6808
6698
  p /= length;
6809
6699
  else {
@@ -6885,8 +6775,7 @@ var spine = (() => {
6885
6775
  x1 = x2;
6886
6776
  y1 = y2;
6887
6777
  }
6888
- if (this.data.positionMode == 1 /* Percent */)
6889
- position *= pathLength;
6778
+ if (this.data.positionMode == 1 /* Percent */) position *= pathLength;
6890
6779
  let multiplier;
6891
6780
  switch (this.data.spacingMode) {
6892
6781
  case 2 /* Percent */:
@@ -6906,8 +6795,7 @@ var spine = (() => {
6906
6795
  let p = position;
6907
6796
  if (closed2) {
6908
6797
  p %= pathLength;
6909
- if (p < 0)
6910
- p += pathLength;
6798
+ if (p < 0) p += pathLength;
6911
6799
  curve = 0;
6912
6800
  } else if (p < 0) {
6913
6801
  this.addBeforePosition(p, world, 0, out, o);
@@ -6918,8 +6806,7 @@ var spine = (() => {
6918
6806
  }
6919
6807
  for (; ; curve++) {
6920
6808
  let length = curves[curve];
6921
- if (p > length)
6922
- continue;
6809
+ if (p > length) continue;
6923
6810
  if (curve == 0)
6924
6811
  p /= length;
6925
6812
  else {
@@ -6970,8 +6857,7 @@ var spine = (() => {
6970
6857
  p *= curveLength;
6971
6858
  for (; ; segment++) {
6972
6859
  let length = segments[segment];
6973
- if (p > length)
6974
- continue;
6860
+ if (p > length) continue;
6975
6861
  if (segment == 0)
6976
6862
  p /= length;
6977
6863
  else {
@@ -7016,11 +6902,6 @@ var spine = (() => {
7016
6902
  }
7017
6903
  }
7018
6904
  };
7019
- var PathConstraint = _PathConstraint;
7020
- __publicField(PathConstraint, "NONE", -1);
7021
- __publicField(PathConstraint, "BEFORE", -2);
7022
- __publicField(PathConstraint, "AFTER", -3);
7023
- __publicField(PathConstraint, "epsilon", 1e-5);
7024
6905
 
7025
6906
  // spine-core/src/PhysicsConstraint.ts
7026
6907
  var PhysicsConstraint = class {
@@ -7031,10 +6912,8 @@ var spine = (() => {
7031
6912
  this._bone = bone;
7032
6913
  }
7033
6914
  get bone() {
7034
- if (!this._bone)
7035
- throw new Error("Bone not set.");
7036
- else
7037
- return this._bone;
6915
+ if (!this._bone) throw new Error("Bone not set.");
6916
+ else return this._bone;
7038
6917
  }
7039
6918
  inertia = 0;
7040
6919
  strength = 0;
@@ -7103,8 +6982,7 @@ var spine = (() => {
7103
6982
  /** Applies the constraint to the constrained bones. */
7104
6983
  update(physics) {
7105
6984
  const mix = this.mix;
7106
- if (mix == 0)
7107
- return;
6985
+ if (mix == 0) return;
7108
6986
  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;
7109
6987
  const bone = this.bone;
7110
6988
  const l = bone.data.length;
@@ -7113,6 +6991,7 @@ var spine = (() => {
7113
6991
  return;
7114
6992
  case 1 /* reset */:
7115
6993
  this.reset();
6994
+ // Fall through.
7116
6995
  case 2 /* update */:
7117
6996
  const skeleton = this.skeleton;
7118
6997
  const delta = Math.max(this.skeleton.time - this.lastTime, 0);
@@ -7155,10 +7034,8 @@ var spine = (() => {
7155
7034
  a -= t;
7156
7035
  } while (a >= t);
7157
7036
  }
7158
- if (x)
7159
- bone.worldX += this.xOffset * mix * this.data.x;
7160
- if (y)
7161
- bone.worldY += this.yOffset * mix * this.data.y;
7037
+ if (x) bone.worldX += this.xOffset * mix * this.data.x;
7038
+ if (y) bone.worldY += this.yOffset * mix * this.data.y;
7162
7039
  }
7163
7040
  if (rotateOrShearX || scaleX) {
7164
7041
  let ca = Math.atan2(bone.c, bone.a), c = 0, s = 0, mr = 0;
@@ -7180,20 +7057,17 @@ var spine = (() => {
7180
7057
  s = Math.sin(r);
7181
7058
  if (scaleX) {
7182
7059
  r = l * bone.getWorldScaleX();
7183
- if (r > 0)
7184
- this.scaleOffset += (dx * c + dy * s) * i / r;
7060
+ if (r > 0) this.scaleOffset += (dx * c + dy * s) * i / r;
7185
7061
  }
7186
7062
  } else {
7187
7063
  c = Math.cos(ca);
7188
7064
  s = Math.sin(ca);
7189
7065
  const r = l * bone.getWorldScaleX();
7190
- if (r > 0)
7191
- this.scaleOffset += (dx * c + dy * s) * i / r;
7066
+ if (r > 0) this.scaleOffset += (dx * c + dy * s) * i / r;
7192
7067
  }
7193
7068
  a = this.remaining;
7194
7069
  if (a >= t) {
7195
- if (d == -1)
7196
- d = Math.pow(this.damping, 60 * t);
7070
+ if (d == -1) d = Math.pow(this.damping, 60 * t);
7197
7071
  const m = this.massInverse * t, e = this.strength, w = this.wind, g = Skeleton.yDown ? -this.gravity : this.gravity, h = l / f;
7198
7072
  while (true) {
7199
7073
  a -= t;
@@ -7206,8 +7080,7 @@ var spine = (() => {
7206
7080
  this.rotateVelocity -= ((w * s + g * c) * h + this.rotateOffset * e) * m;
7207
7081
  this.rotateOffset += this.rotateVelocity * t;
7208
7082
  this.rotateVelocity *= d;
7209
- if (a < t)
7210
- break;
7083
+ if (a < t) break;
7211
7084
  const r = this.rotateOffset * mr + ca;
7212
7085
  c = Math.cos(r);
7213
7086
  s = Math.sin(r);
@@ -7222,10 +7095,8 @@ var spine = (() => {
7222
7095
  this.cy = bone.worldY;
7223
7096
  break;
7224
7097
  case 3 /* pose */:
7225
- if (x)
7226
- bone.worldX += this.xOffset * mix * this.data.x;
7227
- if (y)
7228
- bone.worldY += this.yOffset * mix * this.data.y;
7098
+ if (x) bone.worldX += this.xOffset * mix * this.data.x;
7099
+ if (y) bone.worldY += this.yOffset * mix * this.data.y;
7229
7100
  }
7230
7101
  if (rotateOrShearX) {
7231
7102
  let o = this.rotateOffset * mix, s = 0, c = 0, a = 0;
@@ -7308,10 +7179,8 @@ var spine = (() => {
7308
7179
  * See {@link VertexAttachment#computeWorldVertices()} and {@link DeformTimeline}. */
7309
7180
  deform = new Array();
7310
7181
  constructor(data, bone) {
7311
- if (!data)
7312
- throw new Error("data cannot be null.");
7313
- if (!bone)
7314
- throw new Error("bone cannot be null.");
7182
+ if (!data) throw new Error("data cannot be null.");
7183
+ if (!bone) throw new Error("bone cannot be null.");
7315
7184
  this.data = data;
7316
7185
  this.bone = bone;
7317
7186
  this.color = new Color();
@@ -7330,8 +7199,7 @@ var spine = (() => {
7330
7199
  * The deform is not cleared if the old attachment has the same {@link VertexAttachment#getTimelineAttachment()} as the
7331
7200
  * specified attachment. */
7332
7201
  setAttachment(attachment) {
7333
- if (this.attachment == attachment)
7334
- return;
7202
+ if (this.attachment == attachment) return;
7335
7203
  if (!(attachment instanceof VertexAttachment) || !(this.attachment instanceof VertexAttachment) || attachment.timelineAttachment != this.attachment.timelineAttachment) {
7336
7204
  this.deform.length = 0;
7337
7205
  }
@@ -7341,8 +7209,7 @@ var spine = (() => {
7341
7209
  /** Sets this slot to the setup pose. */
7342
7210
  setToSetupPose() {
7343
7211
  this.color.setFromColor(this.data.color);
7344
- if (this.darkColor)
7345
- this.darkColor.setFromColor(this.data.darkColor);
7212
+ if (this.darkColor) this.darkColor.setFromColor(this.data.darkColor);
7346
7213
  if (!this.data.attachmentName)
7347
7214
  this.attachment = null;
7348
7215
  else {
@@ -7369,21 +7236,17 @@ var spine = (() => {
7369
7236
  temp = new Vector2();
7370
7237
  active = false;
7371
7238
  constructor(data, skeleton) {
7372
- if (!data)
7373
- throw new Error("data cannot be null.");
7374
- if (!skeleton)
7375
- throw new Error("skeleton cannot be null.");
7239
+ if (!data) throw new Error("data cannot be null.");
7240
+ if (!skeleton) throw new Error("skeleton cannot be null.");
7376
7241
  this.data = data;
7377
7242
  this.bones = new Array();
7378
7243
  for (let i = 0; i < data.bones.length; i++) {
7379
7244
  let bone = skeleton.findBone(data.bones[i].name);
7380
- if (!bone)
7381
- throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
7245
+ if (!bone) throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
7382
7246
  this.bones.push(bone);
7383
7247
  }
7384
7248
  let target = skeleton.findBone(data.target.name);
7385
- if (!target)
7386
- throw new Error(`Couldn't find target bone ${data.target.name}.`);
7249
+ if (!target) throw new Error(`Couldn't find target bone ${data.target.name}.`);
7387
7250
  this.target = target;
7388
7251
  this.mixRotate = data.mixRotate;
7389
7252
  this.mixX = data.mixX;
@@ -7405,8 +7268,7 @@ var spine = (() => {
7405
7268
  this.mixShearY = data.mixShearY;
7406
7269
  }
7407
7270
  update(physics) {
7408
- if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.mixScaleY == 0 && this.mixShearY == 0)
7409
- return;
7271
+ if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.mixScaleY == 0 && this.mixShearY == 0) return;
7410
7272
  if (this.data.local) {
7411
7273
  if (this.data.relative)
7412
7274
  this.applyRelativeLocal();
@@ -7452,15 +7314,13 @@ var spine = (() => {
7452
7314
  }
7453
7315
  if (mixScaleX != 0) {
7454
7316
  let s = Math.sqrt(bone.a * bone.a + bone.c * bone.c);
7455
- if (s != 0)
7456
- s = (s + (Math.sqrt(ta * ta + tc * tc) - s + this.data.offsetScaleX) * mixScaleX) / s;
7317
+ if (s != 0) s = (s + (Math.sqrt(ta * ta + tc * tc) - s + this.data.offsetScaleX) * mixScaleX) / s;
7457
7318
  bone.a *= s;
7458
7319
  bone.c *= s;
7459
7320
  }
7460
7321
  if (mixScaleY != 0) {
7461
7322
  let s = Math.sqrt(bone.b * bone.b + bone.d * bone.d);
7462
- if (s != 0)
7463
- s = (s + (Math.sqrt(tb * tb + td * td) - s + this.data.offsetScaleY) * mixScaleY) / s;
7323
+ if (s != 0) s = (s + (Math.sqrt(tb * tb + td * td) - s + this.data.offsetScaleY) * mixScaleY) / s;
7464
7324
  bone.b *= s;
7465
7325
  bone.d *= s;
7466
7326
  }
@@ -7542,8 +7402,7 @@ var spine = (() => {
7542
7402
  for (let i = 0, n = bones.length; i < n; i++) {
7543
7403
  let bone = bones[i];
7544
7404
  let rotation = bone.arotation;
7545
- if (mixRotate != 0)
7546
- rotation += (target.arotation - rotation + this.data.offsetRotation) * mixRotate;
7405
+ if (mixRotate != 0) rotation += (target.arotation - rotation + this.data.offsetRotation) * mixRotate;
7547
7406
  let x = bone.ax, y = bone.ay;
7548
7407
  x += (target.ax - x + this.data.offsetX) * mixX;
7549
7408
  y += (target.ay - y + this.data.offsetY) * mixY;
@@ -7553,8 +7412,7 @@ var spine = (() => {
7553
7412
  if (mixScaleY != 0 && scaleY != 0)
7554
7413
  scaleY = (scaleY + (target.ascaleY - scaleY + this.data.offsetScaleY) * mixScaleY) / scaleY;
7555
7414
  let shearY = bone.ashearY;
7556
- if (mixShearY != 0)
7557
- shearY += (target.ashearY - shearY + this.data.offsetShearY) * mixShearY;
7415
+ if (mixShearY != 0) shearY += (target.ashearY - shearY + this.data.offsetShearY) * mixShearY;
7558
7416
  bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
7559
7417
  }
7560
7418
  }
@@ -7576,7 +7434,9 @@ var spine = (() => {
7576
7434
  };
7577
7435
 
7578
7436
  // spine-core/src/Skeleton.ts
7579
- var _Skeleton = class {
7437
+ var Skeleton = class _Skeleton {
7438
+ static quadTriangles = [0, 1, 2, 2, 3, 0];
7439
+ static yDown = false;
7580
7440
  /** The skeleton's setup pose data. */
7581
7441
  data;
7582
7442
  /** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
@@ -7620,8 +7480,7 @@ var spine = (() => {
7620
7480
  * See {@link #update(float)}. */
7621
7481
  time = 0;
7622
7482
  constructor(data) {
7623
- if (!data)
7624
- throw new Error("data cannot be null.");
7483
+ if (!data) throw new Error("data cannot be null.");
7625
7484
  this.data = data;
7626
7485
  this.bones = new Array();
7627
7486
  for (let i = 0; i < data.bones.length; i++) {
@@ -7732,8 +7591,7 @@ var spine = (() => {
7732
7591
  }
7733
7592
  sortIkConstraint(constraint) {
7734
7593
  constraint.active = constraint.target.isActive() && (!constraint.data.skinRequired || this.skin && Utils.contains(this.skin.constraints, constraint.data, true));
7735
- if (!constraint.active)
7736
- return;
7594
+ if (!constraint.active) return;
7737
7595
  let target = constraint.target;
7738
7596
  this.sortBone(target);
7739
7597
  let constrained = constraint.bones;
@@ -7752,20 +7610,17 @@ var spine = (() => {
7752
7610
  }
7753
7611
  sortPathConstraint(constraint) {
7754
7612
  constraint.active = constraint.target.bone.isActive() && (!constraint.data.skinRequired || this.skin && Utils.contains(this.skin.constraints, constraint.data, true));
7755
- if (!constraint.active)
7756
- return;
7613
+ if (!constraint.active) return;
7757
7614
  let slot = constraint.target;
7758
7615
  let slotIndex = slot.data.index;
7759
7616
  let slotBone = slot.bone;
7760
- if (this.skin)
7761
- this.sortPathConstraintAttachment(this.skin, slotIndex, slotBone);
7617
+ if (this.skin) this.sortPathConstraintAttachment(this.skin, slotIndex, slotBone);
7762
7618
  if (this.data.defaultSkin && this.data.defaultSkin != this.skin)
7763
7619
  this.sortPathConstraintAttachment(this.data.defaultSkin, slotIndex, slotBone);
7764
7620
  for (let i = 0, n = this.data.skins.length; i < n; i++)
7765
7621
  this.sortPathConstraintAttachment(this.data.skins[i], slotIndex, slotBone);
7766
7622
  let attachment = slot.getAttachment();
7767
- if (attachment instanceof PathAttachment)
7768
- this.sortPathConstraintAttachmentWith(attachment, slotBone);
7623
+ if (attachment instanceof PathAttachment) this.sortPathConstraintAttachmentWith(attachment, slotBone);
7769
7624
  let constrained = constraint.bones;
7770
7625
  let boneCount = constrained.length;
7771
7626
  for (let i = 0; i < boneCount; i++)
@@ -7778,8 +7633,7 @@ var spine = (() => {
7778
7633
  }
7779
7634
  sortTransformConstraint(constraint) {
7780
7635
  constraint.active = constraint.target.isActive() && (!constraint.data.skinRequired || this.skin && Utils.contains(this.skin.constraints, constraint.data, true));
7781
- if (!constraint.active)
7782
- return;
7636
+ if (!constraint.active) return;
7783
7637
  this.sortBone(constraint.target);
7784
7638
  let constrained = constraint.bones;
7785
7639
  let boneCount = constrained.length;
@@ -7802,15 +7656,13 @@ var spine = (() => {
7802
7656
  }
7803
7657
  sortPathConstraintAttachment(skin, slotIndex, slotBone) {
7804
7658
  let attachments = skin.attachments[slotIndex];
7805
- if (!attachments)
7806
- return;
7659
+ if (!attachments) return;
7807
7660
  for (let key in attachments) {
7808
7661
  this.sortPathConstraintAttachmentWith(attachments[key], slotBone);
7809
7662
  }
7810
7663
  }
7811
7664
  sortPathConstraintAttachmentWith(attachment, slotBone) {
7812
- if (!(attachment instanceof PathAttachment))
7813
- return;
7665
+ if (!(attachment instanceof PathAttachment)) return;
7814
7666
  let pathBones = attachment.bones;
7815
7667
  if (!pathBones)
7816
7668
  this.sortBone(slotBone);
@@ -7827,31 +7679,25 @@ var spine = (() => {
7827
7679
  sortPhysicsConstraint(constraint) {
7828
7680
  const bone = constraint.bone;
7829
7681
  constraint.active = bone.active && (!constraint.data.skinRequired || this.skin != null && Utils.contains(this.skin.constraints, constraint.data, true));
7830
- if (!constraint.active)
7831
- return;
7682
+ if (!constraint.active) return;
7832
7683
  this.sortBone(bone);
7833
7684
  this._updateCache.push(constraint);
7834
7685
  this.sortReset(bone.children);
7835
7686
  bone.sorted = true;
7836
7687
  }
7837
7688
  sortBone(bone) {
7838
- if (!bone)
7839
- return;
7840
- if (bone.sorted)
7841
- return;
7689
+ if (!bone) return;
7690
+ if (bone.sorted) return;
7842
7691
  let parent = bone.parent;
7843
- if (parent)
7844
- this.sortBone(parent);
7692
+ if (parent) this.sortBone(parent);
7845
7693
  bone.sorted = true;
7846
7694
  this._updateCache.push(bone);
7847
7695
  }
7848
7696
  sortReset(bones) {
7849
7697
  for (let i = 0, n = bones.length; i < n; i++) {
7850
7698
  let bone = bones[i];
7851
- if (!bone.active)
7852
- continue;
7853
- if (bone.sorted)
7854
- this.sortReset(bone.children);
7699
+ if (!bone.active) continue;
7700
+ if (bone.sorted) this.sortReset(bone.children);
7855
7701
  bone.sorted = false;
7856
7702
  }
7857
7703
  }
@@ -7860,8 +7706,7 @@ var spine = (() => {
7860
7706
  * See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
7861
7707
  * Runtimes Guide. */
7862
7708
  updateWorldTransform(physics) {
7863
- if (physics === void 0 || physics === null)
7864
- throw new Error("physics is undefined");
7709
+ if (physics === void 0 || physics === null) throw new Error("physics is undefined");
7865
7710
  let bones = this.bones;
7866
7711
  for (let i = 0, n = bones.length; i < n; i++) {
7867
7712
  let bone = bones[i];
@@ -7878,8 +7723,7 @@ var spine = (() => {
7878
7723
  updateCache[i].update(physics);
7879
7724
  }
7880
7725
  updateWorldTransformWith(physics, parent) {
7881
- if (!parent)
7882
- throw new Error("parent cannot be null.");
7726
+ if (!parent) throw new Error("parent cannot be null.");
7883
7727
  let bones = this.bones;
7884
7728
  for (let i = 1, n = bones.length; i < n; i++) {
7885
7729
  let bone = bones[i];
@@ -7892,8 +7736,7 @@ var spine = (() => {
7892
7736
  bone.ashearY = bone.shearY;
7893
7737
  }
7894
7738
  let rootBone = this.getRootBone();
7895
- if (!rootBone)
7896
- throw new Error("Root bone must not be null.");
7739
+ if (!rootBone) throw new Error("Root bone must not be null.");
7897
7740
  let pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
7898
7741
  rootBone.worldX = pa * this.x + pb * this.y + parent.worldX;
7899
7742
  rootBone.worldY = pc * this.x + pd * this.y + parent.worldY;
@@ -7910,8 +7753,7 @@ var spine = (() => {
7910
7753
  let updateCache = this._updateCache;
7911
7754
  for (let i = 0, n = updateCache.length; i < n; i++) {
7912
7755
  let updatable = updateCache[i];
7913
- if (updatable != rootBone)
7914
- updatable.update(physics);
7756
+ if (updatable != rootBone) updatable.update(physics);
7915
7757
  }
7916
7758
  }
7917
7759
  /** Sets the bones, constraints, and slots to their setup pose values. */
@@ -7921,16 +7763,11 @@ var spine = (() => {
7921
7763
  }
7922
7764
  /** Sets the bones and constraints to their setup pose values. */
7923
7765
  setBonesToSetupPose() {
7924
- for (const bone of this.bones)
7925
- bone.setToSetupPose();
7926
- for (const constraint of this.ikConstraints)
7927
- constraint.setToSetupPose();
7928
- for (const constraint of this.transformConstraints)
7929
- constraint.setToSetupPose();
7930
- for (const constraint of this.pathConstraints)
7931
- constraint.setToSetupPose();
7932
- for (const constraint of this.physicsConstraints)
7933
- constraint.setToSetupPose();
7766
+ for (const bone of this.bones) bone.setToSetupPose();
7767
+ for (const constraint of this.ikConstraints) constraint.setToSetupPose();
7768
+ for (const constraint of this.transformConstraints) constraint.setToSetupPose();
7769
+ for (const constraint of this.pathConstraints) constraint.setToSetupPose();
7770
+ for (const constraint of this.physicsConstraints) constraint.setToSetupPose();
7934
7771
  }
7935
7772
  /** Sets the slots and draw order to their setup pose values. */
7936
7773
  setSlotsToSetupPose() {
@@ -7941,19 +7778,16 @@ var spine = (() => {
7941
7778
  }
7942
7779
  /** @returns May return null. */
7943
7780
  getRootBone() {
7944
- if (this.bones.length == 0)
7945
- return null;
7781
+ if (this.bones.length == 0) return null;
7946
7782
  return this.bones[0];
7947
7783
  }
7948
7784
  /** @returns May be null. */
7949
7785
  findBone(boneName) {
7950
- if (!boneName)
7951
- throw new Error("boneName cannot be null.");
7786
+ if (!boneName) throw new Error("boneName cannot be null.");
7952
7787
  let bones = this.bones;
7953
7788
  for (let i = 0, n = bones.length; i < n; i++) {
7954
7789
  let bone = bones[i];
7955
- if (bone.data.name == boneName)
7956
- return bone;
7790
+ if (bone.data.name == boneName) return bone;
7957
7791
  }
7958
7792
  return null;
7959
7793
  }
@@ -7961,13 +7795,11 @@ var spine = (() => {
7961
7795
  * repeatedly.
7962
7796
  * @returns May be null. */
7963
7797
  findSlot(slotName) {
7964
- if (!slotName)
7965
- throw new Error("slotName cannot be null.");
7798
+ if (!slotName) throw new Error("slotName cannot be null.");
7966
7799
  let slots = this.slots;
7967
7800
  for (let i = 0, n = slots.length; i < n; i++) {
7968
7801
  let slot = slots[i];
7969
- if (slot.data.name == slotName)
7970
- return slot;
7802
+ if (slot.data.name == slotName) return slot;
7971
7803
  }
7972
7804
  return null;
7973
7805
  }
@@ -7976,8 +7808,7 @@ var spine = (() => {
7976
7808
  * See {@link #setSkin()}. */
7977
7809
  setSkinByName(skinName) {
7978
7810
  let skin = this.data.findSkin(skinName);
7979
- if (!skin)
7980
- throw new Error("Skin not found: " + skinName);
7811
+ if (!skin) throw new Error("Skin not found: " + skinName);
7981
7812
  this.setSkin(skin);
7982
7813
  }
7983
7814
  /** Sets the skin used to look up attachments before looking in the {@link SkeletonData#defaultSkin default skin}. If the
@@ -7991,8 +7822,7 @@ var spine = (() => {
7991
7822
  * skeleton is rendered to allow any attachment keys in the current animation(s) to hide or show attachments from the new skin.
7992
7823
  * @param newSkin May be null. */
7993
7824
  setSkin(newSkin) {
7994
- if (newSkin == this.skin)
7995
- return;
7825
+ if (newSkin == this.skin) return;
7996
7826
  if (newSkin) {
7997
7827
  if (this.skin)
7998
7828
  newSkin.attachAll(this, this.skin);
@@ -8003,8 +7833,7 @@ var spine = (() => {
8003
7833
  let name = slot.data.attachmentName;
8004
7834
  if (name) {
8005
7835
  let attachment = newSkin.getAttachment(i, name);
8006
- if (attachment)
8007
- slot.setAttachment(attachment);
7836
+ if (attachment) slot.setAttachment(attachment);
8008
7837
  }
8009
7838
  }
8010
7839
  }
@@ -8019,8 +7848,7 @@ var spine = (() => {
8019
7848
  * @returns May be null. */
8020
7849
  getAttachmentByName(slotName, attachmentName) {
8021
7850
  let slot = this.data.findSlot(slotName);
8022
- if (!slot)
8023
- throw new Error(`Can't find slot with name ${slotName}`);
7851
+ if (!slot) throw new Error(`Can't find slot with name ${slotName}`);
8024
7852
  return this.getAttachment(slot.index, attachmentName);
8025
7853
  }
8026
7854
  /** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot index and
@@ -8029,23 +7857,19 @@ var spine = (() => {
8029
7857
  * See [Runtime skins](http://esotericsoftware.com/spine-runtime-skins) in the Spine Runtimes Guide.
8030
7858
  * @returns May be null. */
8031
7859
  getAttachment(slotIndex, attachmentName) {
8032
- if (!attachmentName)
8033
- throw new Error("attachmentName cannot be null.");
7860
+ if (!attachmentName) throw new Error("attachmentName cannot be null.");
8034
7861
  if (this.skin) {
8035
7862
  let attachment = this.skin.getAttachment(slotIndex, attachmentName);
8036
- if (attachment)
8037
- return attachment;
7863
+ if (attachment) return attachment;
8038
7864
  }
8039
- if (this.data.defaultSkin)
8040
- return this.data.defaultSkin.getAttachment(slotIndex, attachmentName);
7865
+ if (this.data.defaultSkin) return this.data.defaultSkin.getAttachment(slotIndex, attachmentName);
8041
7866
  return null;
8042
7867
  }
8043
7868
  /** A convenience method to set an attachment by finding the slot with {@link #findSlot()}, finding the attachment with
8044
7869
  * {@link #getAttachment()}, then setting the slot's {@link Slot#attachment}.
8045
7870
  * @param attachmentName May be null to clear the slot's attachment. */
8046
7871
  setAttachment(slotName, attachmentName) {
8047
- if (!slotName)
8048
- throw new Error("slotName cannot be null.");
7872
+ if (!slotName) throw new Error("slotName cannot be null.");
8049
7873
  let slots = this.slots;
8050
7874
  for (let i = 0, n = slots.length; i < n; i++) {
8051
7875
  let slot = slots[i];
@@ -8053,8 +7877,7 @@ var spine = (() => {
8053
7877
  let attachment = null;
8054
7878
  if (attachmentName) {
8055
7879
  attachment = this.getAttachment(i, attachmentName);
8056
- if (!attachment)
8057
- throw new Error("Attachment not found: " + attachmentName + ", for slot: " + slotName);
7880
+ if (!attachment) throw new Error("Attachment not found: " + attachmentName + ", for slot: " + slotName);
8058
7881
  }
8059
7882
  slot.setAttachment(attachment);
8060
7883
  return;
@@ -8066,31 +7889,27 @@ var spine = (() => {
8066
7889
  * than to call it repeatedly.
8067
7890
  * @return May be null. */
8068
7891
  findIkConstraint(constraintName) {
8069
- if (!constraintName)
8070
- throw new Error("constraintName cannot be null.");
7892
+ if (!constraintName) throw new Error("constraintName cannot be null.");
8071
7893
  return this.ikConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
8072
7894
  }
8073
7895
  /** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
8074
7896
  * this method than to call it repeatedly.
8075
7897
  * @return May be null. */
8076
7898
  findTransformConstraint(constraintName) {
8077
- if (!constraintName)
8078
- throw new Error("constraintName cannot be null.");
7899
+ if (!constraintName) throw new Error("constraintName cannot be null.");
8079
7900
  return this.transformConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
8080
7901
  }
8081
7902
  /** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
8082
7903
  * than to call it repeatedly.
8083
7904
  * @return May be null. */
8084
7905
  findPathConstraint(constraintName) {
8085
- if (!constraintName)
8086
- throw new Error("constraintName cannot be null.");
7906
+ if (!constraintName) throw new Error("constraintName cannot be null.");
8087
7907
  return this.pathConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
8088
7908
  }
8089
7909
  /** Finds a physics constraint by comparing each physics constraint's name. It is more efficient to cache the results of this
8090
7910
  * method than to call it repeatedly. */
8091
7911
  findPhysicsConstraint(constraintName) {
8092
- if (constraintName == null)
8093
- throw new Error("constraintName cannot be null.");
7912
+ if (constraintName == null) throw new Error("constraintName cannot be null.");
8094
7913
  return this.physicsConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
8095
7914
  }
8096
7915
  /** 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 }`.
@@ -8107,16 +7926,13 @@ var spine = (() => {
8107
7926
  * @param temp Working memory to temporarily store attachments' computed world vertices.
8108
7927
  * @param clipper {@link SkeletonClipping} to use. If <code>null</code>, no clipping is applied. */
8109
7928
  getBounds(offset, size, temp = new Array(2), clipper = null) {
8110
- if (!offset)
8111
- throw new Error("offset cannot be null.");
8112
- if (!size)
8113
- throw new Error("size cannot be null.");
7929
+ if (!offset) throw new Error("offset cannot be null.");
7930
+ if (!size) throw new Error("size cannot be null.");
8114
7931
  let drawOrder = this.drawOrder;
8115
7932
  let minX = Number.POSITIVE_INFINITY, minY = Number.POSITIVE_INFINITY, maxX = Number.NEGATIVE_INFINITY, maxY = Number.NEGATIVE_INFINITY;
8116
7933
  for (let i = 0, n = drawOrder.length; i < n; i++) {
8117
7934
  let slot = drawOrder[i];
8118
- if (!slot.bone.active)
8119
- continue;
7935
+ if (!slot.bone.active) continue;
8120
7936
  let verticesLength = 0;
8121
7937
  let vertices = null;
8122
7938
  let triangles = null;
@@ -8150,11 +7966,9 @@ var spine = (() => {
8150
7966
  maxY = Math.max(maxY, y);
8151
7967
  }
8152
7968
  }
8153
- if (clipper != null)
8154
- clipper.clipEndWithSlot(slot);
7969
+ if (clipper != null) clipper.clipEndWithSlot(slot);
8155
7970
  }
8156
- if (clipper != null)
8157
- clipper.clipEnd();
7971
+ if (clipper != null) clipper.clipEnd();
8158
7972
  offset.set(minX, minY);
8159
7973
  size.set(maxX - minX, maxY - minY);
8160
7974
  }
@@ -8174,9 +7988,6 @@ var spine = (() => {
8174
7988
  physicsConstraints[i].rotate(x, y, degrees);
8175
7989
  }
8176
7990
  };
8177
- var Skeleton = _Skeleton;
8178
- __publicField(Skeleton, "quadTriangles", [0, 1, 2, 2, 3, 0]);
8179
- __publicField(Skeleton, "yDown", false);
8180
7991
  var Physics = /* @__PURE__ */ ((Physics2) => {
8181
7992
  Physics2[Physics2["none"] = 0] = "none";
8182
7993
  Physics2[Physics2["reset"] = 1] = "reset";
@@ -8193,10 +8004,8 @@ var spine = (() => {
8193
8004
  this._bone = boneData;
8194
8005
  }
8195
8006
  get bone() {
8196
- if (!this._bone)
8197
- throw new Error("BoneData not set.");
8198
- else
8199
- return this._bone;
8007
+ if (!this._bone) throw new Error("BoneData not set.");
8008
+ else return this._bone;
8200
8009
  }
8201
8010
  x = 0;
8202
8011
  y = 0;
@@ -8279,13 +8088,11 @@ var spine = (() => {
8279
8088
  * multiple times.
8280
8089
  * @returns May be null. */
8281
8090
  findBone(boneName) {
8282
- if (!boneName)
8283
- throw new Error("boneName cannot be null.");
8091
+ if (!boneName) throw new Error("boneName cannot be null.");
8284
8092
  let bones = this.bones;
8285
8093
  for (let i = 0, n = bones.length; i < n; i++) {
8286
8094
  let bone = bones[i];
8287
- if (bone.name == boneName)
8288
- return bone;
8095
+ if (bone.name == boneName) return bone;
8289
8096
  }
8290
8097
  return null;
8291
8098
  }
@@ -8293,13 +8100,11 @@ var spine = (() => {
8293
8100
  * multiple times.
8294
8101
  * @returns May be null. */
8295
8102
  findSlot(slotName) {
8296
- if (!slotName)
8297
- throw new Error("slotName cannot be null.");
8103
+ if (!slotName) throw new Error("slotName cannot be null.");
8298
8104
  let slots = this.slots;
8299
8105
  for (let i = 0, n = slots.length; i < n; i++) {
8300
8106
  let slot = slots[i];
8301
- if (slot.name == slotName)
8302
- return slot;
8107
+ if (slot.name == slotName) return slot;
8303
8108
  }
8304
8109
  return null;
8305
8110
  }
@@ -8307,13 +8112,11 @@ var spine = (() => {
8307
8112
  * multiple times.
8308
8113
  * @returns May be null. */
8309
8114
  findSkin(skinName) {
8310
- if (!skinName)
8311
- throw new Error("skinName cannot be null.");
8115
+ if (!skinName) throw new Error("skinName cannot be null.");
8312
8116
  let skins = this.skins;
8313
8117
  for (let i = 0, n = skins.length; i < n; i++) {
8314
8118
  let skin = skins[i];
8315
- if (skin.name == skinName)
8316
- return skin;
8119
+ if (skin.name == skinName) return skin;
8317
8120
  }
8318
8121
  return null;
8319
8122
  }
@@ -8321,13 +8124,11 @@ var spine = (() => {
8321
8124
  * multiple times.
8322
8125
  * @returns May be null. */
8323
8126
  findEvent(eventDataName) {
8324
- if (!eventDataName)
8325
- throw new Error("eventDataName cannot be null.");
8127
+ if (!eventDataName) throw new Error("eventDataName cannot be null.");
8326
8128
  let events = this.events;
8327
8129
  for (let i = 0, n = events.length; i < n; i++) {
8328
8130
  let event = events[i];
8329
- if (event.name == eventDataName)
8330
- return event;
8131
+ if (event.name == eventDataName) return event;
8331
8132
  }
8332
8133
  return null;
8333
8134
  }
@@ -8335,13 +8136,11 @@ var spine = (() => {
8335
8136
  * call it multiple times.
8336
8137
  * @returns May be null. */
8337
8138
  findAnimation(animationName) {
8338
- if (!animationName)
8339
- throw new Error("animationName cannot be null.");
8139
+ if (!animationName) throw new Error("animationName cannot be null.");
8340
8140
  let animations = this.animations;
8341
8141
  for (let i = 0, n = animations.length; i < n; i++) {
8342
8142
  let animation = animations[i];
8343
- if (animation.name == animationName)
8344
- return animation;
8143
+ if (animation.name == animationName) return animation;
8345
8144
  }
8346
8145
  return null;
8347
8146
  }
@@ -8349,13 +8148,11 @@ var spine = (() => {
8349
8148
  * than to call it multiple times.
8350
8149
  * @return May be null. */
8351
8150
  findIkConstraint(constraintName) {
8352
- if (!constraintName)
8353
- throw new Error("constraintName cannot be null.");
8151
+ if (!constraintName) throw new Error("constraintName cannot be null.");
8354
8152
  const ikConstraints = this.ikConstraints;
8355
8153
  for (let i = 0, n = ikConstraints.length; i < n; i++) {
8356
8154
  const constraint = ikConstraints[i];
8357
- if (constraint.name == constraintName)
8358
- return constraint;
8155
+ if (constraint.name == constraintName) return constraint;
8359
8156
  }
8360
8157
  return null;
8361
8158
  }
@@ -8363,13 +8160,11 @@ var spine = (() => {
8363
8160
  * this method than to call it multiple times.
8364
8161
  * @return May be null. */
8365
8162
  findTransformConstraint(constraintName) {
8366
- if (!constraintName)
8367
- throw new Error("constraintName cannot be null.");
8163
+ if (!constraintName) throw new Error("constraintName cannot be null.");
8368
8164
  const transformConstraints = this.transformConstraints;
8369
8165
  for (let i = 0, n = transformConstraints.length; i < n; i++) {
8370
8166
  const constraint = transformConstraints[i];
8371
- if (constraint.name == constraintName)
8372
- return constraint;
8167
+ if (constraint.name == constraintName) return constraint;
8373
8168
  }
8374
8169
  return null;
8375
8170
  }
@@ -8377,13 +8172,11 @@ var spine = (() => {
8377
8172
  * than to call it multiple times.
8378
8173
  * @return May be null. */
8379
8174
  findPathConstraint(constraintName) {
8380
- if (!constraintName)
8381
- throw new Error("constraintName cannot be null.");
8175
+ if (!constraintName) throw new Error("constraintName cannot be null.");
8382
8176
  const pathConstraints = this.pathConstraints;
8383
8177
  for (let i = 0, n = pathConstraints.length; i < n; i++) {
8384
8178
  const constraint = pathConstraints[i];
8385
- if (constraint.name == constraintName)
8386
- return constraint;
8179
+ if (constraint.name == constraintName) return constraint;
8387
8180
  }
8388
8181
  return null;
8389
8182
  }
@@ -8391,13 +8184,11 @@ var spine = (() => {
8391
8184
  * than to call it multiple times.
8392
8185
  * @return May be null. */
8393
8186
  findPhysicsConstraint(constraintName) {
8394
- if (!constraintName)
8395
- throw new Error("constraintName cannot be null.");
8187
+ if (!constraintName) throw new Error("constraintName cannot be null.");
8396
8188
  const physicsConstraints = this.physicsConstraints;
8397
8189
  for (let i = 0, n = physicsConstraints.length; i < n; i++) {
8398
8190
  const constraint = physicsConstraints[i];
8399
- if (constraint.name == constraintName)
8400
- return constraint;
8191
+ if (constraint.name == constraintName) return constraint;
8401
8192
  }
8402
8193
  return null;
8403
8194
  }
@@ -8421,19 +8212,15 @@ var spine = (() => {
8421
8212
  color = new Color(0.99607843, 0.61960787, 0.30980393, 1);
8422
8213
  // fe9e4fff
8423
8214
  constructor(name) {
8424
- if (!name)
8425
- throw new Error("name cannot be null.");
8215
+ if (!name) throw new Error("name cannot be null.");
8426
8216
  this.name = name;
8427
8217
  }
8428
8218
  /** Adds an attachment to the skin for the specified slot index and name. */
8429
8219
  setAttachment(slotIndex, name, attachment) {
8430
- if (!attachment)
8431
- throw new Error("attachment cannot be null.");
8220
+ if (!attachment) throw new Error("attachment cannot be null.");
8432
8221
  let attachments = this.attachments;
8433
- if (slotIndex >= attachments.length)
8434
- attachments.length = slotIndex + 1;
8435
- if (!attachments[slotIndex])
8436
- attachments[slotIndex] = {};
8222
+ if (slotIndex >= attachments.length) attachments.length = slotIndex + 1;
8223
+ if (!attachments[slotIndex]) attachments[slotIndex] = {};
8437
8224
  attachments[slotIndex][name] = attachment;
8438
8225
  }
8439
8226
  /** Adds all attachments, bones, and constraints from the specified skin to this skin. */
@@ -8447,8 +8234,7 @@ var spine = (() => {
8447
8234
  break;
8448
8235
  }
8449
8236
  }
8450
- if (!contained)
8451
- this.bones.push(bone);
8237
+ if (!contained) this.bones.push(bone);
8452
8238
  }
8453
8239
  for (let i = 0; i < skin.constraints.length; i++) {
8454
8240
  let constraint = skin.constraints[i];
@@ -8459,8 +8245,7 @@ var spine = (() => {
8459
8245
  break;
8460
8246
  }
8461
8247
  }
8462
- if (!contained)
8463
- this.constraints.push(constraint);
8248
+ if (!contained) this.constraints.push(constraint);
8464
8249
  }
8465
8250
  let attachments = skin.getAttachments();
8466
8251
  for (let i = 0; i < attachments.length; i++) {
@@ -8480,8 +8265,7 @@ var spine = (() => {
8480
8265
  break;
8481
8266
  }
8482
8267
  }
8483
- if (!contained)
8484
- this.bones.push(bone);
8268
+ if (!contained) this.bones.push(bone);
8485
8269
  }
8486
8270
  for (let i = 0; i < skin.constraints.length; i++) {
8487
8271
  let constraint = skin.constraints[i];
@@ -8492,14 +8276,12 @@ var spine = (() => {
8492
8276
  break;
8493
8277
  }
8494
8278
  }
8495
- if (!contained)
8496
- this.constraints.push(constraint);
8279
+ if (!contained) this.constraints.push(constraint);
8497
8280
  }
8498
8281
  let attachments = skin.getAttachments();
8499
8282
  for (let i = 0; i < attachments.length; i++) {
8500
8283
  var attachment = attachments[i];
8501
- if (!attachment.attachment)
8502
- continue;
8284
+ if (!attachment.attachment) continue;
8503
8285
  if (attachment.attachment instanceof MeshAttachment) {
8504
8286
  attachment.attachment = attachment.attachment.newLinkedMesh();
8505
8287
  this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
@@ -8517,8 +8299,7 @@ var spine = (() => {
8517
8299
  /** Removes the attachment in the skin for the specified slot index and name, if any. */
8518
8300
  removeAttachment(slotIndex, name) {
8519
8301
  let dictionary = this.attachments[slotIndex];
8520
- if (dictionary)
8521
- delete dictionary[name];
8302
+ if (dictionary) delete dictionary[name];
8522
8303
  }
8523
8304
  /** Returns all attachments in this skin. */
8524
8305
  getAttachments() {
@@ -8528,8 +8309,7 @@ var spine = (() => {
8528
8309
  if (slotAttachments) {
8529
8310
  for (let name in slotAttachments) {
8530
8311
  let attachment = slotAttachments[name];
8531
- if (attachment)
8532
- entries.push(new SkinEntry(i, name, attachment));
8312
+ if (attachment) entries.push(new SkinEntry(i, name, attachment));
8533
8313
  }
8534
8314
  }
8535
8315
  }
@@ -8541,8 +8321,7 @@ var spine = (() => {
8541
8321
  if (slotAttachments) {
8542
8322
  for (let name in slotAttachments) {
8543
8323
  let attachment = slotAttachments[name];
8544
- if (attachment)
8545
- attachments.push(new SkinEntry(slotIndex, name, attachment));
8324
+ if (attachment) attachments.push(new SkinEntry(slotIndex, name, attachment));
8546
8325
  }
8547
8326
  }
8548
8327
  }
@@ -8564,8 +8343,7 @@ var spine = (() => {
8564
8343
  let skinAttachment = dictionary[key];
8565
8344
  if (slotAttachment == skinAttachment) {
8566
8345
  let attachment = this.getAttachment(slotIndex, key);
8567
- if (attachment)
8568
- slot.setAttachment(attachment);
8346
+ if (attachment) slot.setAttachment(attachment);
8569
8347
  break;
8570
8348
  }
8571
8349
  }
@@ -8592,16 +8370,13 @@ var spine = (() => {
8592
8370
  /** The name of the attachment that is visible for this slot in the setup pose, or null if no attachment is visible. */
8593
8371
  attachmentName = null;
8594
8372
  /** The blend mode for drawing the slot's attachment. */
8595
- blendMode = BlendMode.Normal;
8373
+ blendMode = 0 /* Normal */;
8596
8374
  /** False if the slot was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */
8597
8375
  visible = true;
8598
8376
  constructor(index, name, boneData) {
8599
- if (index < 0)
8600
- throw new Error("index must be >= 0.");
8601
- if (!name)
8602
- throw new Error("name cannot be null.");
8603
- if (!boneData)
8604
- throw new Error("boneData cannot be null.");
8377
+ if (index < 0) throw new Error("index must be >= 0.");
8378
+ if (!name) throw new Error("name cannot be null.");
8379
+ if (!boneData) throw new Error("boneData cannot be null.");
8605
8380
  this.index = index;
8606
8381
  this.name = name;
8607
8382
  this.boneData = boneData;
@@ -8625,10 +8400,8 @@ var spine = (() => {
8625
8400
  this._target = boneData;
8626
8401
  }
8627
8402
  get target() {
8628
- if (!this._target)
8629
- throw new Error("BoneData not set.");
8630
- else
8631
- return this._target;
8403
+ if (!this._target) throw new Error("BoneData not set.");
8404
+ else return this._target;
8632
8405
  }
8633
8406
  mixRotate = 0;
8634
8407
  mixX = 0;
@@ -8691,15 +8464,13 @@ var spine = (() => {
8691
8464
  n = input.readInt(true);
8692
8465
  for (let i = 0; i < n; i++) {
8693
8466
  let str = input.readString();
8694
- if (!str)
8695
- throw new Error("String in string table must not be null.");
8467
+ if (!str) throw new Error("String in string table must not be null.");
8696
8468
  input.strings.push(str);
8697
8469
  }
8698
8470
  n = input.readInt(true);
8699
8471
  for (let i = 0; i < n; i++) {
8700
8472
  let name = input.readString();
8701
- if (!name)
8702
- throw new Error("Bone name must not be null.");
8473
+ if (!name) throw new Error("Bone name must not be null.");
8703
8474
  let parent = i == 0 ? null : skeletonData.bones[input.readInt(true)];
8704
8475
  let data = new BoneData(i, name, parent);
8705
8476
  data.rotation = input.readFloat();
@@ -8722,25 +8493,21 @@ var spine = (() => {
8722
8493
  n = input.readInt(true);
8723
8494
  for (let i = 0; i < n; i++) {
8724
8495
  let slotName = input.readString();
8725
- if (!slotName)
8726
- throw new Error("Slot name must not be null.");
8496
+ if (!slotName) throw new Error("Slot name must not be null.");
8727
8497
  let boneData = skeletonData.bones[input.readInt(true)];
8728
8498
  let data = new SlotData(i, slotName, boneData);
8729
8499
  Color.rgba8888ToColor(data.color, input.readInt32());
8730
8500
  let darkColor = input.readInt32();
8731
- if (darkColor != -1)
8732
- Color.rgb888ToColor(data.darkColor = new Color(), darkColor);
8501
+ if (darkColor != -1) Color.rgb888ToColor(data.darkColor = new Color(), darkColor);
8733
8502
  data.attachmentName = input.readStringRef();
8734
8503
  data.blendMode = input.readInt(true);
8735
- if (nonessential)
8736
- data.visible = input.readBoolean();
8504
+ if (nonessential) data.visible = input.readBoolean();
8737
8505
  skeletonData.slots.push(data);
8738
8506
  }
8739
8507
  n = input.readInt(true);
8740
8508
  for (let i = 0, nn; i < n; i++) {
8741
8509
  let name = input.readString();
8742
- if (!name)
8743
- throw new Error("IK constraint data name must not be null.");
8510
+ if (!name) throw new Error("IK constraint data name must not be null.");
8744
8511
  let data = new IkConstraintData(name);
8745
8512
  data.order = input.readInt(true);
8746
8513
  nn = input.readInt(true);
@@ -8753,17 +8520,14 @@ var spine = (() => {
8753
8520
  data.compress = (flags & 4) != 0;
8754
8521
  data.stretch = (flags & 8) != 0;
8755
8522
  data.uniform = (flags & 16) != 0;
8756
- if ((flags & 32) != 0)
8757
- data.mix = (flags & 64) != 0 ? input.readFloat() : 1;
8758
- if ((flags & 128) != 0)
8759
- data.softness = input.readFloat() * scale;
8523
+ if ((flags & 32) != 0) data.mix = (flags & 64) != 0 ? input.readFloat() : 1;
8524
+ if ((flags & 128) != 0) data.softness = input.readFloat() * scale;
8760
8525
  skeletonData.ikConstraints.push(data);
8761
8526
  }
8762
8527
  n = input.readInt(true);
8763
8528
  for (let i = 0, nn; i < n; i++) {
8764
8529
  let name = input.readString();
8765
- if (!name)
8766
- throw new Error("Transform constraint data name must not be null.");
8530
+ if (!name) throw new Error("Transform constraint data name must not be null.");
8767
8531
  let data = new TransformConstraintData(name);
8768
8532
  data.order = input.readInt(true);
8769
8533
  nn = input.readInt(true);
@@ -8774,38 +8538,25 @@ var spine = (() => {
8774
8538
  data.skinRequired = (flags & 1) != 0;
8775
8539
  data.local = (flags & 2) != 0;
8776
8540
  data.relative = (flags & 4) != 0;
8777
- if ((flags & 8) != 0)
8778
- data.offsetRotation = input.readFloat();
8779
- if ((flags & 16) != 0)
8780
- data.offsetX = input.readFloat() * scale;
8781
- if ((flags & 32) != 0)
8782
- data.offsetY = input.readFloat() * scale;
8783
- if ((flags & 64) != 0)
8784
- data.offsetScaleX = input.readFloat();
8785
- if ((flags & 128) != 0)
8786
- data.offsetScaleY = input.readFloat();
8541
+ if ((flags & 8) != 0) data.offsetRotation = input.readFloat();
8542
+ if ((flags & 16) != 0) data.offsetX = input.readFloat() * scale;
8543
+ if ((flags & 32) != 0) data.offsetY = input.readFloat() * scale;
8544
+ if ((flags & 64) != 0) data.offsetScaleX = input.readFloat();
8545
+ if ((flags & 128) != 0) data.offsetScaleY = input.readFloat();
8787
8546
  flags = input.readByte();
8788
- if ((flags & 1) != 0)
8789
- data.offsetShearY = input.readFloat();
8790
- if ((flags & 2) != 0)
8791
- data.mixRotate = input.readFloat();
8792
- if ((flags & 4) != 0)
8793
- data.mixX = input.readFloat();
8794
- if ((flags & 8) != 0)
8795
- data.mixY = input.readFloat();
8796
- if ((flags & 16) != 0)
8797
- data.mixScaleX = input.readFloat();
8798
- if ((flags & 32) != 0)
8799
- data.mixScaleY = input.readFloat();
8800
- if ((flags & 64) != 0)
8801
- data.mixShearY = input.readFloat();
8547
+ if ((flags & 1) != 0) data.offsetShearY = input.readFloat();
8548
+ if ((flags & 2) != 0) data.mixRotate = input.readFloat();
8549
+ if ((flags & 4) != 0) data.mixX = input.readFloat();
8550
+ if ((flags & 8) != 0) data.mixY = input.readFloat();
8551
+ if ((flags & 16) != 0) data.mixScaleX = input.readFloat();
8552
+ if ((flags & 32) != 0) data.mixScaleY = input.readFloat();
8553
+ if ((flags & 64) != 0) data.mixShearY = input.readFloat();
8802
8554
  skeletonData.transformConstraints.push(data);
8803
8555
  }
8804
8556
  n = input.readInt(true);
8805
8557
  for (let i = 0, nn; i < n; i++) {
8806
8558
  let name = input.readString();
8807
- if (!name)
8808
- throw new Error("Path constraint data name must not be null.");
8559
+ if (!name) throw new Error("Path constraint data name must not be null.");
8809
8560
  let data = new PathConstraintData(name);
8810
8561
  data.order = input.readInt(true);
8811
8562
  data.skinRequired = input.readBoolean();
@@ -8817,14 +8568,11 @@ var spine = (() => {
8817
8568
  data.positionMode = flags & 1;
8818
8569
  data.spacingMode = flags >> 1 & 3;
8819
8570
  data.rotateMode = flags >> 3 & 3;
8820
- if ((flags & 128) != 0)
8821
- data.offsetRotation = input.readFloat();
8571
+ if ((flags & 128) != 0) data.offsetRotation = input.readFloat();
8822
8572
  data.position = input.readFloat();
8823
- if (data.positionMode == 0 /* Fixed */)
8824
- data.position *= scale;
8573
+ if (data.positionMode == 0 /* Fixed */) data.position *= scale;
8825
8574
  data.spacing = input.readFloat();
8826
- if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */)
8827
- data.spacing *= scale;
8575
+ if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */) data.spacing *= scale;
8828
8576
  data.mixRotate = input.readFloat();
8829
8577
  data.mixX = input.readFloat();
8830
8578
  data.mixY = input.readFloat();
@@ -8833,23 +8581,17 @@ var spine = (() => {
8833
8581
  n = input.readInt(true);
8834
8582
  for (let i = 0, nn; i < n; i++) {
8835
8583
  const name = input.readString();
8836
- if (!name)
8837
- throw new Error("Physics constraint data name must not be null.");
8584
+ if (!name) throw new Error("Physics constraint data name must not be null.");
8838
8585
  const data = new PhysicsConstraintData(name);
8839
8586
  data.order = input.readInt(true);
8840
8587
  data.bone = skeletonData.bones[input.readInt(true)];
8841
8588
  let flags = input.readByte();
8842
8589
  data.skinRequired = (flags & 1) != 0;
8843
- if ((flags & 2) != 0)
8844
- data.x = input.readFloat();
8845
- if ((flags & 4) != 0)
8846
- data.y = input.readFloat();
8847
- if ((flags & 8) != 0)
8848
- data.rotate = input.readFloat();
8849
- if ((flags & 16) != 0)
8850
- data.scaleX = input.readFloat();
8851
- if ((flags & 32) != 0)
8852
- data.shearX = input.readFloat();
8590
+ if ((flags & 2) != 0) data.x = input.readFloat();
8591
+ if ((flags & 4) != 0) data.y = input.readFloat();
8592
+ if ((flags & 8) != 0) data.rotate = input.readFloat();
8593
+ if ((flags & 16) != 0) data.scaleX = input.readFloat();
8594
+ if ((flags & 32) != 0) data.shearX = input.readFloat();
8853
8595
  data.limit = ((flags & 64) != 0 ? input.readFloat() : 5e3) * scale;
8854
8596
  data.step = 1 / input.readUnsignedByte();
8855
8597
  data.inertia = input.readFloat();
@@ -8859,20 +8601,13 @@ var spine = (() => {
8859
8601
  data.wind = input.readFloat();
8860
8602
  data.gravity = input.readFloat();
8861
8603
  flags = input.readByte();
8862
- if ((flags & 1) != 0)
8863
- data.inertiaGlobal = true;
8864
- if ((flags & 2) != 0)
8865
- data.strengthGlobal = true;
8866
- if ((flags & 4) != 0)
8867
- data.dampingGlobal = true;
8868
- if ((flags & 8) != 0)
8869
- data.massGlobal = true;
8870
- if ((flags & 16) != 0)
8871
- data.windGlobal = true;
8872
- if ((flags & 32) != 0)
8873
- data.gravityGlobal = true;
8874
- if ((flags & 64) != 0)
8875
- data.mixGlobal = true;
8604
+ if ((flags & 1) != 0) data.inertiaGlobal = true;
8605
+ if ((flags & 2) != 0) data.strengthGlobal = true;
8606
+ if ((flags & 4) != 0) data.dampingGlobal = true;
8607
+ if ((flags & 8) != 0) data.massGlobal = true;
8608
+ if ((flags & 16) != 0) data.windGlobal = true;
8609
+ if ((flags & 32) != 0) data.gravityGlobal = true;
8610
+ if ((flags & 64) != 0) data.mixGlobal = true;
8876
8611
  data.mix = (flags & 128) != 0 ? input.readFloat() : 1;
8877
8612
  skeletonData.physicsConstraints.push(data);
8878
8613
  }
@@ -8886,8 +8621,7 @@ var spine = (() => {
8886
8621
  Utils.setArraySize(skeletonData.skins, n = i + input.readInt(true));
8887
8622
  for (; i < n; i++) {
8888
8623
  let skin = this.readSkin(input, skeletonData, false, nonessential);
8889
- if (!skin)
8890
- throw new Error("readSkin() should not have returned null.");
8624
+ if (!skin) throw new Error("readSkin() should not have returned null.");
8891
8625
  skeletonData.skins[i] = skin;
8892
8626
  }
8893
8627
  }
@@ -8895,22 +8629,18 @@ var spine = (() => {
8895
8629
  for (let i = 0; i < n; i++) {
8896
8630
  let linkedMesh = this.linkedMeshes[i];
8897
8631
  const skin = skeletonData.skins[linkedMesh.skinIndex];
8898
- if (!linkedMesh.parent)
8899
- throw new Error("Linked mesh parent must not be null");
8632
+ if (!linkedMesh.parent) throw new Error("Linked mesh parent must not be null");
8900
8633
  let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
8901
- if (!parent)
8902
- throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
8634
+ if (!parent) throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
8903
8635
  linkedMesh.mesh.timelineAttachment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
8904
8636
  linkedMesh.mesh.setParentMesh(parent);
8905
- if (linkedMesh.mesh.region != null)
8906
- linkedMesh.mesh.updateRegion();
8637
+ if (linkedMesh.mesh.region != null) linkedMesh.mesh.updateRegion();
8907
8638
  }
8908
8639
  this.linkedMeshes.length = 0;
8909
8640
  n = input.readInt(true);
8910
8641
  for (let i = 0; i < n; i++) {
8911
8642
  let eventName = input.readString();
8912
- if (!eventName)
8913
- throw new Error("Event data name must not be null");
8643
+ if (!eventName) throw new Error("Event data name must not be null");
8914
8644
  let data = new EventData(eventName);
8915
8645
  data.intValue = input.readInt(false);
8916
8646
  data.floatValue = input.readFloat();
@@ -8925,8 +8655,7 @@ var spine = (() => {
8925
8655
  n = input.readInt(true);
8926
8656
  for (let i = 0; i < n; i++) {
8927
8657
  let animationName = input.readString();
8928
- if (!animationName)
8929
- throw new Error("Animatio name must not be null.");
8658
+ if (!animationName) throw new Error("Animatio name must not be null.");
8930
8659
  skeletonData.animations.push(this.readAnimation(input, animationName, skeletonData));
8931
8660
  }
8932
8661
  return skeletonData;
@@ -8936,16 +8665,13 @@ var spine = (() => {
8936
8665
  let slotCount = 0;
8937
8666
  if (defaultSkin) {
8938
8667
  slotCount = input.readInt(true);
8939
- if (slotCount == 0)
8940
- return null;
8668
+ if (slotCount == 0) return null;
8941
8669
  skin = new Skin("default");
8942
8670
  } else {
8943
8671
  let skinName = input.readString();
8944
- if (!skinName)
8945
- throw new Error("Skin name must not be null.");
8672
+ if (!skinName) throw new Error("Skin name must not be null.");
8946
8673
  skin = new Skin(skinName);
8947
- if (nonessential)
8948
- Color.rgba8888ToColor(skin.color, input.readInt32());
8674
+ if (nonessential) Color.rgba8888ToColor(skin.color, input.readInt32());
8949
8675
  skin.bones.length = input.readInt(true);
8950
8676
  for (let i = 0, n = skin.bones.length; i < n; i++)
8951
8677
  skin.bones[i] = skeletonData.bones[input.readInt(true)];
@@ -8966,8 +8692,7 @@ var spine = (() => {
8966
8692
  if (!name)
8967
8693
  throw new Error("Attachment name must not be null");
8968
8694
  let attachment = this.readAttachment(input, skeletonData, skin, slotIndex, name, nonessential);
8969
- if (attachment)
8970
- skin.setAttachment(slotIndex, name, attachment);
8695
+ if (attachment) skin.setAttachment(slotIndex, name, attachment);
8971
8696
  }
8972
8697
  }
8973
8698
  return skin;
@@ -8976,10 +8701,10 @@ var spine = (() => {
8976
8701
  let scale = this.scale;
8977
8702
  let flags = input.readByte();
8978
8703
  const name = (flags & 8) != 0 ? input.readStringRef() : attachmentName;
8979
- if (!name)
8980
- throw new Error("Attachment name must not be null");
8704
+ if (!name) throw new Error("Attachment name must not be null");
8981
8705
  switch (flags & 7) {
8982
- case AttachmentType.Region: {
8706
+ // BUG?
8707
+ case 0 /* Region */: {
8983
8708
  let path = (flags & 16) != 0 ? input.readStringRef() : null;
8984
8709
  const color = (flags & 32) != 0 ? input.readInt32() : 4294967295;
8985
8710
  const sequence = (flags & 64) != 0 ? this.readSequence(input) : null;
@@ -8990,11 +8715,9 @@ var spine = (() => {
8990
8715
  let scaleY = input.readFloat();
8991
8716
  let width = input.readFloat();
8992
8717
  let height = input.readFloat();
8993
- if (!path)
8994
- path = name;
8718
+ if (!path) path = name;
8995
8719
  let region = this.attachmentLoader.newRegionAttachment(skin, name, path, sequence);
8996
- if (!region)
8997
- return null;
8720
+ if (!region) return null;
8998
8721
  region.path = path;
8999
8722
  region.x = x * scale;
9000
8723
  region.y = y * scale;
@@ -9005,24 +8728,21 @@ var spine = (() => {
9005
8728
  region.height = height * scale;
9006
8729
  Color.rgba8888ToColor(region.color, color);
9007
8730
  region.sequence = sequence;
9008
- if (sequence == null)
9009
- region.updateRegion();
8731
+ if (sequence == null) region.updateRegion();
9010
8732
  return region;
9011
8733
  }
9012
- case AttachmentType.BoundingBox: {
8734
+ case 1 /* BoundingBox */: {
9013
8735
  let vertices = this.readVertices(input, (flags & 16) != 0);
9014
8736
  let color = nonessential ? input.readInt32() : 0;
9015
8737
  let box = this.attachmentLoader.newBoundingBoxAttachment(skin, name);
9016
- if (!box)
9017
- return null;
8738
+ if (!box) return null;
9018
8739
  box.worldVerticesLength = vertices.length;
9019
8740
  box.vertices = vertices.vertices;
9020
8741
  box.bones = vertices.bones;
9021
- if (nonessential)
9022
- Color.rgba8888ToColor(box.color, color);
8742
+ if (nonessential) Color.rgba8888ToColor(box.color, color);
9023
8743
  return box;
9024
8744
  }
9025
- case AttachmentType.Mesh: {
8745
+ case 2 /* Mesh */: {
9026
8746
  let path = (flags & 16) != 0 ? input.readStringRef() : name;
9027
8747
  const color = (flags & 32) != 0 ? input.readInt32() : 4294967295;
9028
8748
  const sequence = (flags & 64) != 0 ? this.readSequence(input) : null;
@@ -9037,11 +8757,9 @@ var spine = (() => {
9037
8757
  width = input.readFloat();
9038
8758
  height = input.readFloat();
9039
8759
  }
9040
- if (!path)
9041
- path = name;
8760
+ if (!path) path = name;
9042
8761
  let mesh = this.attachmentLoader.newMeshAttachment(skin, name, path, sequence);
9043
- if (!mesh)
9044
- return null;
8762
+ if (!mesh) return null;
9045
8763
  mesh.path = path;
9046
8764
  Color.rgba8888ToColor(mesh.color, color);
9047
8765
  mesh.bones = vertices.bones;
@@ -9049,8 +8767,7 @@ var spine = (() => {
9049
8767
  mesh.worldVerticesLength = vertices.length;
9050
8768
  mesh.triangles = triangles;
9051
8769
  mesh.regionUVs = uvs;
9052
- if (sequence == null)
9053
- mesh.updateRegion();
8770
+ if (sequence == null) mesh.updateRegion();
9054
8771
  mesh.hullLength = hullLength << 1;
9055
8772
  mesh.sequence = sequence;
9056
8773
  if (nonessential) {
@@ -9060,10 +8777,9 @@ var spine = (() => {
9060
8777
  }
9061
8778
  return mesh;
9062
8779
  }
9063
- case AttachmentType.LinkedMesh: {
8780
+ case 3 /* LinkedMesh */: {
9064
8781
  const path = (flags & 16) != 0 ? input.readStringRef() : name;
9065
- if (path == null)
9066
- throw new Error("Path of linked mesh must not be null");
8782
+ if (path == null) throw new Error("Path of linked mesh must not be null");
9067
8783
  const color = (flags & 32) != 0 ? input.readInt32() : 4294967295;
9068
8784
  const sequence = (flags & 64) != 0 ? this.readSequence(input) : null;
9069
8785
  const inheritTimelines = (flags & 128) != 0;
@@ -9075,8 +8791,7 @@ var spine = (() => {
9075
8791
  height = input.readFloat();
9076
8792
  }
9077
8793
  let mesh = this.attachmentLoader.newMeshAttachment(skin, name, path, sequence);
9078
- if (!mesh)
9079
- return null;
8794
+ if (!mesh) return null;
9080
8795
  mesh.path = path;
9081
8796
  Color.rgba8888ToColor(mesh.color, color);
9082
8797
  mesh.sequence = sequence;
@@ -9087,7 +8802,7 @@ var spine = (() => {
9087
8802
  this.linkedMeshes.push(new LinkedMesh(mesh, skinIndex, slotIndex, parent, inheritTimelines));
9088
8803
  return mesh;
9089
8804
  }
9090
- case AttachmentType.Path: {
8805
+ case 4 /* Path */: {
9091
8806
  const closed2 = (flags & 16) != 0;
9092
8807
  const constantSpeed = (flags & 32) != 0;
9093
8808
  const vertices = this.readVertices(input, (flags & 64) != 0);
@@ -9096,46 +8811,40 @@ var spine = (() => {
9096
8811
  lengths[i] = input.readFloat() * scale;
9097
8812
  const color = nonessential ? input.readInt32() : 0;
9098
8813
  const path = this.attachmentLoader.newPathAttachment(skin, name);
9099
- if (!path)
9100
- return null;
8814
+ if (!path) return null;
9101
8815
  path.closed = closed2;
9102
8816
  path.constantSpeed = constantSpeed;
9103
8817
  path.worldVerticesLength = vertices.length;
9104
8818
  path.vertices = vertices.vertices;
9105
8819
  path.bones = vertices.bones;
9106
8820
  path.lengths = lengths;
9107
- if (nonessential)
9108
- Color.rgba8888ToColor(path.color, color);
8821
+ if (nonessential) Color.rgba8888ToColor(path.color, color);
9109
8822
  return path;
9110
8823
  }
9111
- case AttachmentType.Point: {
8824
+ case 5 /* Point */: {
9112
8825
  const rotation = input.readFloat();
9113
8826
  const x = input.readFloat();
9114
8827
  const y = input.readFloat();
9115
8828
  const color = nonessential ? input.readInt32() : 0;
9116
8829
  const point = this.attachmentLoader.newPointAttachment(skin, name);
9117
- if (!point)
9118
- return null;
8830
+ if (!point) return null;
9119
8831
  point.x = x * scale;
9120
8832
  point.y = y * scale;
9121
8833
  point.rotation = rotation;
9122
- if (nonessential)
9123
- Color.rgba8888ToColor(point.color, color);
8834
+ if (nonessential) Color.rgba8888ToColor(point.color, color);
9124
8835
  return point;
9125
8836
  }
9126
- case AttachmentType.Clipping: {
8837
+ case 6 /* Clipping */: {
9127
8838
  const endSlotIndex = input.readInt(true);
9128
8839
  const vertices = this.readVertices(input, (flags & 16) != 0);
9129
8840
  let color = nonessential ? input.readInt32() : 0;
9130
8841
  let clip = this.attachmentLoader.newClippingAttachment(skin, name);
9131
- if (!clip)
9132
- return null;
8842
+ if (!clip) return null;
9133
8843
  clip.endSlot = skeletonData.slots[endSlotIndex];
9134
8844
  clip.worldVerticesLength = vertices.length;
9135
8845
  clip.vertices = vertices.vertices;
9136
8846
  clip.bones = vertices.bones;
9137
- if (nonessential)
9138
- Color.rgba8888ToColor(clip.color, color);
8847
+ if (nonessential) Color.rgba8888ToColor(clip.color, color);
9139
8848
  return clip;
9140
8849
  }
9141
8850
  }
@@ -9218,8 +8927,7 @@ var spine = (() => {
9218
8927
  let a = input.readUnsignedByte() / 255;
9219
8928
  for (let frame = 0, bezier = 0; ; frame++) {
9220
8929
  timeline.setFrame(frame, time, r, g, b, a);
9221
- if (frame == frameLast)
9222
- break;
8930
+ if (frame == frameLast) break;
9223
8931
  let time2 = input.readFloat();
9224
8932
  let r2 = input.readUnsignedByte() / 255;
9225
8933
  let g2 = input.readUnsignedByte() / 255;
@@ -9253,8 +8961,7 @@ var spine = (() => {
9253
8961
  let b = input.readUnsignedByte() / 255;
9254
8962
  for (let frame = 0, bezier = 0; ; frame++) {
9255
8963
  timeline.setFrame(frame, time, r, g, b);
9256
- if (frame == frameLast)
9257
- break;
8964
+ if (frame == frameLast) break;
9258
8965
  let time2 = input.readFloat();
9259
8966
  let r2 = input.readUnsignedByte() / 255;
9260
8967
  let g2 = input.readUnsignedByte() / 255;
@@ -9289,8 +8996,7 @@ var spine = (() => {
9289
8996
  let b2 = input.readUnsignedByte() / 255;
9290
8997
  for (let frame = 0, bezier = 0; ; frame++) {
9291
8998
  timeline.setFrame(frame, time, r, g, b, a, r2, g2, b2);
9292
- if (frame == frameLast)
9293
- break;
8999
+ if (frame == frameLast) break;
9294
9000
  let time2 = input.readFloat();
9295
9001
  let nr = input.readUnsignedByte() / 255;
9296
9002
  let ng = input.readUnsignedByte() / 255;
@@ -9336,8 +9042,7 @@ var spine = (() => {
9336
9042
  let b2 = input.readUnsignedByte() / 255;
9337
9043
  for (let frame = 0, bezier = 0; ; frame++) {
9338
9044
  timeline.setFrame(frame, time, r, g, b, r2, g2, b2);
9339
- if (frame == frameLast)
9340
- break;
9045
+ if (frame == frameLast) break;
9341
9046
  let time2 = input.readFloat();
9342
9047
  let nr = input.readUnsignedByte() / 255;
9343
9048
  let ng = input.readUnsignedByte() / 255;
@@ -9373,8 +9078,7 @@ var spine = (() => {
9373
9078
  let time = input.readFloat(), a = input.readUnsignedByte() / 255;
9374
9079
  for (let frame = 0, bezier = 0; ; frame++) {
9375
9080
  timeline.setFrame(frame, time, a);
9376
- if (frame == frameLast)
9377
- break;
9081
+ if (frame == frameLast) break;
9378
9082
  let time2 = input.readFloat();
9379
9083
  let a2 = input.readUnsignedByte() / 255;
9380
9084
  switch (input.readByte()) {
@@ -9446,8 +9150,7 @@ var spine = (() => {
9446
9150
  let softness = (flags & 4) != 0 ? input.readFloat() * scale : 0;
9447
9151
  for (let frame = 0, bezier = 0; ; frame++) {
9448
9152
  timeline.setFrame(frame, time, mix, softness, (flags & 8) != 0 ? 1 : -1, (flags & 16) != 0, (flags & 32) != 0);
9449
- if (frame == frameLast)
9450
- break;
9153
+ if (frame == frameLast) break;
9451
9154
  flags = input.readByte();
9452
9155
  const time2 = input.readFloat(), mix2 = (flags & 1) != 0 ? (flags & 2) != 0 ? input.readFloat() : 1 : 0;
9453
9156
  const softness2 = (flags & 4) != 0 ? input.readFloat() * scale : 0;
@@ -9469,8 +9172,7 @@ var spine = (() => {
9469
9172
  let time = input.readFloat(), mixRotate = input.readFloat(), mixX = input.readFloat(), mixY = input.readFloat(), mixScaleX = input.readFloat(), mixScaleY = input.readFloat(), mixShearY = input.readFloat();
9470
9173
  for (let frame = 0, bezier = 0; ; frame++) {
9471
9174
  timeline.setFrame(frame, time, mixRotate, mixX, mixY, mixScaleX, mixScaleY, mixShearY);
9472
- if (frame == frameLast)
9473
- break;
9175
+ if (frame == frameLast) break;
9474
9176
  let time2 = input.readFloat(), mixRotate2 = input.readFloat(), mixX2 = input.readFloat(), mixY2 = input.readFloat(), mixScaleX2 = input.readFloat(), mixScaleY2 = input.readFloat(), mixShearY2 = input.readFloat();
9475
9177
  switch (input.readByte()) {
9476
9178
  case CURVE_STEPPED:
@@ -9519,8 +9221,7 @@ var spine = (() => {
9519
9221
  let time = input.readFloat(), mixRotate = input.readFloat(), mixX = input.readFloat(), mixY = input.readFloat();
9520
9222
  for (let frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1; ; frame++) {
9521
9223
  timeline.setFrame(frame, time, mixRotate, mixX, mixY);
9522
- if (frame == frameLast)
9523
- break;
9224
+ if (frame == frameLast) break;
9524
9225
  let time2 = input.readFloat(), mixRotate2 = input.readFloat(), mixX2 = input.readFloat(), mixY2 = input.readFloat();
9525
9226
  switch (input.readByte()) {
9526
9227
  case CURVE_STEPPED:
@@ -9582,8 +9283,7 @@ var spine = (() => {
9582
9283
  let slotIndex = input.readInt(true);
9583
9284
  for (let iii = 0, nnn = input.readInt(true); iii < nnn; iii++) {
9584
9285
  let attachmentName = input.readStringRef();
9585
- if (!attachmentName)
9586
- throw new Error("attachmentName must not be null.");
9286
+ if (!attachmentName) throw new Error("attachmentName must not be null.");
9587
9287
  let attachment = skin.getAttachment(slotIndex, attachmentName);
9588
9288
  let timelineType = input.readByte();
9589
9289
  let frameCount = input.readInt(true);
@@ -9619,8 +9319,7 @@ var spine = (() => {
9619
9319
  }
9620
9320
  }
9621
9321
  timeline.setFrame(frame, time, deform);
9622
- if (frame == frameLast)
9623
- break;
9322
+ if (frame == frameLast) break;
9624
9323
  let time2 = input.readFloat();
9625
9324
  switch (input.readByte()) {
9626
9325
  case CURVE_STEPPED:
@@ -9675,8 +9374,7 @@ var spine = (() => {
9675
9374
  while (originalIndex < slotCount)
9676
9375
  unchanged[unchangedIndex++] = originalIndex++;
9677
9376
  for (let ii = slotCount - 1; ii >= 0; ii--)
9678
- if (drawOrder[ii] == -1)
9679
- drawOrder[ii] = unchanged[--unchangedIndex];
9377
+ if (drawOrder[ii] == -1) drawOrder[ii] = unchanged[--unchangedIndex];
9680
9378
  timeline.setFrame(i, time, drawOrder);
9681
9379
  }
9682
9380
  timelines.push(timeline);
@@ -9691,8 +9389,7 @@ var spine = (() => {
9691
9389
  event.intValue = input.readInt(false);
9692
9390
  event.floatValue = input.readFloat();
9693
9391
  event.stringValue = input.readString();
9694
- if (event.stringValue == null)
9695
- event.stringValue = eventData.stringValue;
9392
+ if (event.stringValue == null) event.stringValue = eventData.stringValue;
9696
9393
  if (event.data.audioPath) {
9697
9394
  event.volume = input.readFloat();
9698
9395
  event.balance = input.readFloat();
@@ -9814,22 +9511,11 @@ var spine = (() => {
9814
9511
  this.length = length;
9815
9512
  }
9816
9513
  };
9817
- var AttachmentType = /* @__PURE__ */ ((AttachmentType2) => {
9818
- AttachmentType2[AttachmentType2["Region"] = 0] = "Region";
9819
- AttachmentType2[AttachmentType2["BoundingBox"] = 1] = "BoundingBox";
9820
- AttachmentType2[AttachmentType2["Mesh"] = 2] = "Mesh";
9821
- AttachmentType2[AttachmentType2["LinkedMesh"] = 3] = "LinkedMesh";
9822
- AttachmentType2[AttachmentType2["Path"] = 4] = "Path";
9823
- AttachmentType2[AttachmentType2["Point"] = 5] = "Point";
9824
- AttachmentType2[AttachmentType2["Clipping"] = 6] = "Clipping";
9825
- return AttachmentType2;
9826
- })(AttachmentType || {});
9827
9514
  function readTimeline1(input, timeline, scale) {
9828
9515
  let time = input.readFloat(), value = input.readFloat() * scale;
9829
9516
  for (let frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1; ; frame++) {
9830
9517
  timeline.setFrame(frame, time, value);
9831
- if (frame == frameLast)
9832
- break;
9518
+ if (frame == frameLast) break;
9833
9519
  let time2 = input.readFloat(), value2 = input.readFloat() * scale;
9834
9520
  switch (input.readByte()) {
9835
9521
  case CURVE_STEPPED:
@@ -9847,8 +9533,7 @@ var spine = (() => {
9847
9533
  let time = input.readFloat(), value1 = input.readFloat() * scale, value2 = input.readFloat() * scale;
9848
9534
  for (let frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1; ; frame++) {
9849
9535
  timeline.setFrame(frame, time, value1, value2);
9850
- if (frame == frameLast)
9851
- break;
9536
+ if (frame == frameLast) break;
9852
9537
  let time2 = input.readFloat(), nvalue1 = input.readFloat() * scale, nvalue2 = input.readFloat() * scale;
9853
9538
  switch (input.readByte()) {
9854
9539
  case CURVE_STEPPED:
@@ -9922,8 +9607,7 @@ var spine = (() => {
9922
9607
  * @param updateAabb If true, the axis aligned bounding box containing all the polygons is computed. If false, the
9923
9608
  * SkeletonBounds AABB methods will always return true. */
9924
9609
  update(skeleton, updateAabb) {
9925
- if (!skeleton)
9926
- throw new Error("skeleton cannot be null.");
9610
+ if (!skeleton) throw new Error("skeleton cannot be null.");
9927
9611
  let boundingBoxes = this.boundingBoxes;
9928
9612
  let polygons = this.polygons;
9929
9613
  let polygonPool = this.polygonPool;
@@ -9934,8 +9618,7 @@ var spine = (() => {
9934
9618
  polygons.length = 0;
9935
9619
  for (let i = 0; i < slotCount; i++) {
9936
9620
  let slot = slots[i];
9937
- if (!slot.bone.active)
9938
- continue;
9621
+ if (!slot.bone.active) continue;
9939
9622
  let attachment = slot.getAttachment();
9940
9623
  if (attachment instanceof BoundingBoxAttachment) {
9941
9624
  let boundingBox = attachment;
@@ -9991,17 +9674,13 @@ var spine = (() => {
9991
9674
  return false;
9992
9675
  let m = (y2 - y1) / (x2 - x1);
9993
9676
  let y = m * (minX - x1) + y1;
9994
- if (y > minY && y < maxY)
9995
- return true;
9677
+ if (y > minY && y < maxY) return true;
9996
9678
  y = m * (maxX - x1) + y1;
9997
- if (y > minY && y < maxY)
9998
- return true;
9679
+ if (y > minY && y < maxY) return true;
9999
9680
  let x = (minY - y1) / m + x1;
10000
- if (x > minX && x < maxX)
10001
- return true;
9681
+ if (x > minX && x < maxX) return true;
10002
9682
  x = (maxY - y1) / m + x1;
10003
- if (x > minX && x < maxX)
10004
- return true;
9683
+ if (x > minX && x < maxX) return true;
10005
9684
  return false;
10006
9685
  }
10007
9686
  /** Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds. */
@@ -10013,8 +9692,7 @@ var spine = (() => {
10013
9692
  containsPoint(x, y) {
10014
9693
  let polygons = this.polygons;
10015
9694
  for (let i = 0, n = polygons.length; i < n; i++)
10016
- if (this.containsPointPolygon(polygons[i], x, y))
10017
- return this.boundingBoxes[i];
9695
+ if (this.containsPointPolygon(polygons[i], x, y)) return this.boundingBoxes[i];
10018
9696
  return null;
10019
9697
  }
10020
9698
  /** Returns true if the polygon contains the point. */
@@ -10028,8 +9706,7 @@ var spine = (() => {
10028
9706
  let prevY = vertices[prevIndex + 1];
10029
9707
  if (vertexY < y && prevY >= y || prevY < y && vertexY >= y) {
10030
9708
  let vertexX = vertices[ii];
10031
- if (vertexX + (y - vertexY) / (prevY - vertexY) * (vertices[prevIndex] - vertexX) < x)
10032
- inside = !inside;
9709
+ if (vertexX + (y - vertexY) / (prevY - vertexY) * (vertices[prevIndex] - vertexX) < x) inside = !inside;
10033
9710
  }
10034
9711
  prevIndex = ii;
10035
9712
  }
@@ -10041,8 +9718,7 @@ var spine = (() => {
10041
9718
  intersectsSegment(x1, y1, x2, y2) {
10042
9719
  let polygons = this.polygons;
10043
9720
  for (let i = 0, n = polygons.length; i < n; i++)
10044
- if (this.intersectsSegmentPolygon(polygons[i], x1, y1, x2, y2))
10045
- return this.boundingBoxes[i];
9721
+ if (this.intersectsSegmentPolygon(polygons[i], x1, y1, x2, y2)) return this.boundingBoxes[i];
10046
9722
  return null;
10047
9723
  }
10048
9724
  /** Returns true if the polygon contains any part of the line segment. */
@@ -10060,8 +9736,7 @@ var spine = (() => {
10060
9736
  let x = (det1 * width34 - width12 * det2) / det3;
10061
9737
  if ((x >= x3 && x <= x4 || x >= x4 && x <= x3) && (x >= x1 && x <= x2 || x >= x2 && x <= x1)) {
10062
9738
  let y = (det1 * height34 - height12 * det2) / det3;
10063
- if ((y >= y3 && y <= y4 || y >= y4 && y <= y3) && (y >= y1 && y <= y2 || y >= y2 && y <= y1))
10064
- return true;
9739
+ if ((y >= y3 && y <= y4 || y >= y4 && y <= y3) && (y >= y1 && y <= y2 || y >= y2 && y <= y1)) return true;
10065
9740
  }
10066
9741
  x3 = x4;
10067
9742
  y3 = y4;
@@ -10070,8 +9745,7 @@ var spine = (() => {
10070
9745
  }
10071
9746
  /** Returns the polygon for the specified bounding box, or null. */
10072
9747
  getPolygon(boundingBox) {
10073
- if (!boundingBox)
10074
- throw new Error("boundingBox cannot be null.");
9748
+ if (!boundingBox) throw new Error("boundingBox cannot be null.");
10075
9749
  let index = this.boundingBoxes.indexOf(boundingBox);
10076
9750
  return index == -1 ? null : this.polygons[index];
10077
9751
  }
@@ -10086,7 +9760,7 @@ var spine = (() => {
10086
9760
  };
10087
9761
 
10088
9762
  // spine-core/src/Triangulator.ts
10089
- var Triangulator = class {
9763
+ var Triangulator = class _Triangulator {
10090
9764
  convexPolygons = new Array();
10091
9765
  convexPolygonsIndices = new Array();
10092
9766
  indicesArray = new Array();
@@ -10108,7 +9782,7 @@ var spine = (() => {
10108
9782
  let isConcave = this.isConcaveArray;
10109
9783
  isConcave.length = 0;
10110
9784
  for (let i = 0, n = vertexCount; i < n; ++i)
10111
- isConcave[i] = Triangulator.isConcave(i, vertexCount, vertices, indices);
9785
+ isConcave[i] = _Triangulator.isConcave(i, vertexCount, vertices, indices);
10112
9786
  let triangles = this.triangles;
10113
9787
  triangles.length = 0;
10114
9788
  while (vertexCount > 3) {
@@ -10121,14 +9795,12 @@ var spine = (() => {
10121
9795
  let p2x = vertices[p2], p2y = vertices[p2 + 1];
10122
9796
  let p3x = vertices[p3], p3y = vertices[p3 + 1];
10123
9797
  for (let ii = (next + 1) % vertexCount; ii != previous; ii = (ii + 1) % vertexCount) {
10124
- if (!isConcave[ii])
10125
- continue;
9798
+ if (!isConcave[ii]) continue;
10126
9799
  let v = indices[ii] << 1;
10127
9800
  let vx = vertices[v], vy = vertices[v + 1];
10128
- if (Triangulator.positiveArea(p3x, p3y, p1x, p1y, vx, vy)) {
10129
- if (Triangulator.positiveArea(p1x, p1y, p2x, p2y, vx, vy)) {
10130
- if (Triangulator.positiveArea(p2x, p2y, p3x, p3y, vx, vy))
10131
- break outer;
9801
+ if (_Triangulator.positiveArea(p3x, p3y, p1x, p1y, vx, vy)) {
9802
+ if (_Triangulator.positiveArea(p1x, p1y, p2x, p2y, vx, vy)) {
9803
+ if (_Triangulator.positiveArea(p2x, p2y, p3x, p3y, vx, vy)) break outer;
10132
9804
  }
10133
9805
  }
10134
9806
  }
@@ -10136,8 +9808,7 @@ var spine = (() => {
10136
9808
  }
10137
9809
  if (next == 0) {
10138
9810
  do {
10139
- if (!isConcave[i])
10140
- break;
9811
+ if (!isConcave[i]) break;
10141
9812
  i--;
10142
9813
  } while (i > 0);
10143
9814
  break;
@@ -10154,8 +9825,8 @@ var spine = (() => {
10154
9825
  vertexCount--;
10155
9826
  let previousIndex = (vertexCount + i - 1) % vertexCount;
10156
9827
  let nextIndex = i == vertexCount ? 0 : i;
10157
- isConcave[previousIndex] = Triangulator.isConcave(previousIndex, vertexCount, vertices, indices);
10158
- isConcave[nextIndex] = Triangulator.isConcave(nextIndex, vertexCount, vertices, indices);
9828
+ isConcave[previousIndex] = _Triangulator.isConcave(previousIndex, vertexCount, vertices, indices);
9829
+ isConcave[nextIndex] = _Triangulator.isConcave(nextIndex, vertexCount, vertices, indices);
10159
9830
  }
10160
9831
  if (vertexCount == 3) {
10161
9832
  triangles.push(indices[2]);
@@ -10185,8 +9856,8 @@ var spine = (() => {
10185
9856
  let merged = false;
10186
9857
  if (fanBaseIndex == t1) {
10187
9858
  let o = polygon.length - 4;
10188
- let winding1 = Triangulator.winding(polygon[o], polygon[o + 1], polygon[o + 2], polygon[o + 3], x3, y3);
10189
- let winding2 = Triangulator.winding(x3, y3, polygon[0], polygon[1], polygon[2], polygon[3]);
9859
+ let winding1 = _Triangulator.winding(polygon[o], polygon[o + 1], polygon[o + 2], polygon[o + 3], x3, y3);
9860
+ let winding2 = _Triangulator.winding(x3, y3, polygon[0], polygon[1], polygon[2], polygon[3]);
10190
9861
  if (winding1 == lastWinding && winding2 == lastWinding) {
10191
9862
  polygon.push(x3);
10192
9863
  polygon.push(y3);
@@ -10215,7 +9886,7 @@ var spine = (() => {
10215
9886
  polygonIndices.push(t1);
10216
9887
  polygonIndices.push(t2);
10217
9888
  polygonIndices.push(t3);
10218
- lastWinding = Triangulator.winding(x1, y1, x2, y2, x3, y3);
9889
+ lastWinding = _Triangulator.winding(x1, y1, x2, y2, x3, y3);
10219
9890
  fanBaseIndex = t1;
10220
9891
  }
10221
9892
  }
@@ -10225,8 +9896,7 @@ var spine = (() => {
10225
9896
  }
10226
9897
  for (let i = 0, n = convexPolygons.length; i < n; i++) {
10227
9898
  polygonIndices = convexPolygonsIndices[i];
10228
- if (polygonIndices.length == 0)
10229
- continue;
9899
+ if (polygonIndices.length == 0) continue;
10230
9900
  let firstIndex = polygonIndices[0];
10231
9901
  let lastIndex = polygonIndices[polygonIndices.length - 1];
10232
9902
  polygon = convexPolygons[i];
@@ -10235,22 +9905,19 @@ var spine = (() => {
10235
9905
  let prevX = polygon[o + 2], prevY = polygon[o + 3];
10236
9906
  let firstX = polygon[0], firstY = polygon[1];
10237
9907
  let secondX = polygon[2], secondY = polygon[3];
10238
- let winding = Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, firstX, firstY);
9908
+ let winding = _Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, firstX, firstY);
10239
9909
  for (let ii = 0; ii < n; ii++) {
10240
- if (ii == i)
10241
- continue;
9910
+ if (ii == i) continue;
10242
9911
  let otherIndices = convexPolygonsIndices[ii];
10243
- if (otherIndices.length != 3)
10244
- continue;
9912
+ if (otherIndices.length != 3) continue;
10245
9913
  let otherFirstIndex = otherIndices[0];
10246
9914
  let otherSecondIndex = otherIndices[1];
10247
9915
  let otherLastIndex = otherIndices[2];
10248
9916
  let otherPoly = convexPolygons[ii];
10249
9917
  let x3 = otherPoly[otherPoly.length - 2], y3 = otherPoly[otherPoly.length - 1];
10250
- if (otherFirstIndex != firstIndex || otherSecondIndex != lastIndex)
10251
- continue;
10252
- let winding1 = Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, x3, y3);
10253
- let winding2 = Triangulator.winding(x3, y3, firstX, firstY, secondX, secondY);
9918
+ if (otherFirstIndex != firstIndex || otherSecondIndex != lastIndex) continue;
9919
+ let winding1 = _Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, x3, y3);
9920
+ let winding2 = _Triangulator.winding(x3, y3, firstX, firstY, secondX, secondY);
10254
9921
  if (winding1 == winding && winding2 == winding) {
10255
9922
  otherPoly.length = 0;
10256
9923
  otherIndices.length = 0;
@@ -10300,7 +9967,7 @@ var spine = (() => {
10300
9967
  };
10301
9968
 
10302
9969
  // spine-core/src/SkeletonClipping.ts
10303
- var SkeletonClipping = class {
9970
+ var SkeletonClipping = class _SkeletonClipping {
10304
9971
  triangulator = new Triangulator();
10305
9972
  clippingPolygon = new Array();
10306
9973
  clipOutput = new Array();
@@ -10311,30 +9978,27 @@ var spine = (() => {
10311
9978
  clipAttachment = null;
10312
9979
  clippingPolygons = null;
10313
9980
  clipStart(slot, clip) {
10314
- if (this.clipAttachment)
10315
- return 0;
9981
+ if (this.clipAttachment) return 0;
10316
9982
  this.clipAttachment = clip;
10317
9983
  let n = clip.worldVerticesLength;
10318
9984
  let vertices = Utils.setArraySize(this.clippingPolygon, n);
10319
9985
  clip.computeWorldVertices(slot, 0, n, vertices, 0, 2);
10320
9986
  let clippingPolygon = this.clippingPolygon;
10321
- SkeletonClipping.makeClockwise(clippingPolygon);
9987
+ _SkeletonClipping.makeClockwise(clippingPolygon);
10322
9988
  let clippingPolygons = this.clippingPolygons = this.triangulator.decompose(clippingPolygon, this.triangulator.triangulate(clippingPolygon));
10323
9989
  for (let i = 0, n2 = clippingPolygons.length; i < n2; i++) {
10324
9990
  let polygon = clippingPolygons[i];
10325
- SkeletonClipping.makeClockwise(polygon);
9991
+ _SkeletonClipping.makeClockwise(polygon);
10326
9992
  polygon.push(polygon[0]);
10327
9993
  polygon.push(polygon[1]);
10328
9994
  }
10329
9995
  return clippingPolygons.length;
10330
9996
  }
10331
9997
  clipEndWithSlot(slot) {
10332
- if (this.clipAttachment && this.clipAttachment.endSlot == slot.data)
10333
- this.clipEnd();
9998
+ if (this.clipAttachment && this.clipAttachment.endSlot == slot.data) this.clipEnd();
10334
9999
  }
10335
10000
  clipEnd() {
10336
- if (!this.clipAttachment)
10337
- return;
10001
+ if (!this.clipAttachment) return;
10338
10002
  this.clipAttachment = null;
10339
10003
  this.clippingPolygons = null;
10340
10004
  this.clippedVertices.length = 0;
@@ -10390,8 +10054,7 @@ var spine = (() => {
10390
10054
  let s = clippedVertices.length;
10391
10055
  if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {
10392
10056
  let clipOutputLength = clipOutput.length;
10393
- if (clipOutputLength == 0)
10394
- continue;
10057
+ if (clipOutputLength == 0) continue;
10395
10058
  let clipOutputCount = clipOutputLength >> 1;
10396
10059
  let clipOutputItems = this.clipOutput;
10397
10060
  let clippedVerticesItems = Utils.setArraySize(clippedVertices, s + clipOutputCount * 2);
@@ -10451,8 +10114,7 @@ var spine = (() => {
10451
10114
  let s = clippedVertices.length;
10452
10115
  if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {
10453
10116
  let clipOutputLength = clipOutput.length;
10454
- if (clipOutputLength == 0)
10455
- continue;
10117
+ if (clipOutputLength == 0) continue;
10456
10118
  let d0 = y2 - y3, d1 = x3 - x2, d2 = x1 - x3, d4 = y3 - y1;
10457
10119
  let d = 1 / (d0 * d2 + d1 * (y1 - y3));
10458
10120
  let clipOutputCount = clipOutputLength >> 1;
@@ -10581,8 +10243,7 @@ var spine = (() => {
10581
10243
  let s = clippedVertices.length;
10582
10244
  if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {
10583
10245
  let clipOutputLength = clipOutput.length;
10584
- if (clipOutputLength == 0)
10585
- continue;
10246
+ if (clipOutputLength == 0) continue;
10586
10247
  let d0 = y2 - y3, d1 = x3 - x2, d2 = x1 - x3, d4 = y3 - y1;
10587
10248
  let d = 1 / (d0 * d2 + d1 * (y1 - y3));
10588
10249
  let clipOutputCount = clipOutputLength >> 1;
@@ -10705,8 +10366,7 @@ var spine = (() => {
10705
10366
  }
10706
10367
  output.push(output[0]);
10707
10368
  output.push(output[1]);
10708
- if (i == clippingVerticesLast)
10709
- break;
10369
+ if (i == clippingVerticesLast) break;
10710
10370
  let temp = output;
10711
10371
  output = input;
10712
10372
  output.length = 0;
@@ -10731,8 +10391,7 @@ var spine = (() => {
10731
10391
  p2y = vertices[i + 3];
10732
10392
  area += p1x * p2y - p2x * p1y;
10733
10393
  }
10734
- if (area < 0)
10735
- return;
10394
+ if (area < 0) return;
10736
10395
  for (let i = 0, lastX = verticeslength - 2, n = verticeslength >> 1; i < n; i += 2) {
10737
10396
  let x = vertices[i], y = vertices[i + 1];
10738
10397
  let other = lastX - i;
@@ -10778,8 +10437,7 @@ var spine = (() => {
10778
10437
  let boneMap = root.bones[i];
10779
10438
  let parent = null;
10780
10439
  let parentName = getValue(boneMap, "parent", null);
10781
- if (parentName)
10782
- parent = skeletonData.findBone(parentName);
10440
+ if (parentName) parent = skeletonData.findBone(parentName);
10783
10441
  let data = new BoneData(skeletonData.bones.length, boneMap.name, parent);
10784
10442
  data.length = getValue(boneMap, "length", 0) * scale;
10785
10443
  data.x = getValue(boneMap, "x", 0) * scale;
@@ -10792,8 +10450,7 @@ var spine = (() => {
10792
10450
  data.inherit = Utils.enumValue(Inherit, getValue(boneMap, "inherit", "Normal"));
10793
10451
  data.skinRequired = getValue(boneMap, "skin", false);
10794
10452
  let color = getValue(boneMap, "color", null);
10795
- if (color)
10796
- data.color.setFromString(color);
10453
+ if (color) data.color.setFromString(color);
10797
10454
  skeletonData.bones.push(data);
10798
10455
  }
10799
10456
  }
@@ -10802,15 +10459,12 @@ var spine = (() => {
10802
10459
  let slotMap = root.slots[i];
10803
10460
  let slotName = slotMap.name;
10804
10461
  let boneData = skeletonData.findBone(slotMap.bone);
10805
- if (!boneData)
10806
- throw new Error(`Couldn't find bone ${slotMap.bone} for slot ${slotName}`);
10462
+ if (!boneData) throw new Error(`Couldn't find bone ${slotMap.bone} for slot ${slotName}`);
10807
10463
  let data = new SlotData(skeletonData.slots.length, slotName, boneData);
10808
10464
  let color = getValue(slotMap, "color", null);
10809
- if (color)
10810
- data.color.setFromString(color);
10465
+ if (color) data.color.setFromString(color);
10811
10466
  let dark = getValue(slotMap, "dark", null);
10812
- if (dark)
10813
- data.darkColor = Color.fromString(dark);
10467
+ if (dark) data.darkColor = Color.fromString(dark);
10814
10468
  data.attachmentName = getValue(slotMap, "attachment", null);
10815
10469
  data.blendMode = Utils.enumValue(BlendMode, getValue(slotMap, "blend", "normal"));
10816
10470
  data.visible = getValue(slotMap, "visible", true);
@@ -10825,14 +10479,12 @@ var spine = (() => {
10825
10479
  data.skinRequired = getValue(constraintMap, "skin", false);
10826
10480
  for (let ii = 0; ii < constraintMap.bones.length; ii++) {
10827
10481
  let bone = skeletonData.findBone(constraintMap.bones[ii]);
10828
- if (!bone)
10829
- throw new Error(`Couldn't find bone ${constraintMap.bones[ii]} for IK constraint ${constraintMap.name}.`);
10482
+ if (!bone) throw new Error(`Couldn't find bone ${constraintMap.bones[ii]} for IK constraint ${constraintMap.name}.`);
10830
10483
  data.bones.push(bone);
10831
10484
  }
10832
10485
  let target = skeletonData.findBone(constraintMap.target);
10833
10486
  ;
10834
- if (!target)
10835
- throw new Error(`Couldn't find target bone ${constraintMap.target} for IK constraint ${constraintMap.name}.`);
10487
+ if (!target) throw new Error(`Couldn't find target bone ${constraintMap.target} for IK constraint ${constraintMap.name}.`);
10836
10488
  data.target = target;
10837
10489
  data.mix = getValue(constraintMap, "mix", 1);
10838
10490
  data.softness = getValue(constraintMap, "softness", 0) * scale;
@@ -10852,14 +10504,12 @@ var spine = (() => {
10852
10504
  for (let ii = 0; ii < constraintMap.bones.length; ii++) {
10853
10505
  let boneName = constraintMap.bones[ii];
10854
10506
  let bone = skeletonData.findBone(boneName);
10855
- if (!bone)
10856
- throw new Error(`Couldn't find bone ${boneName} for transform constraint ${constraintMap.name}.`);
10507
+ if (!bone) throw new Error(`Couldn't find bone ${boneName} for transform constraint ${constraintMap.name}.`);
10857
10508
  data.bones.push(bone);
10858
10509
  }
10859
10510
  let targetName = constraintMap.target;
10860
10511
  let target = skeletonData.findBone(targetName);
10861
- if (!target)
10862
- throw new Error(`Couldn't find target bone ${targetName} for transform constraint ${constraintMap.name}.`);
10512
+ if (!target) throw new Error(`Couldn't find target bone ${targetName} for transform constraint ${constraintMap.name}.`);
10863
10513
  data.target = target;
10864
10514
  data.local = getValue(constraintMap, "local", false);
10865
10515
  data.relative = getValue(constraintMap, "relative", false);
@@ -10887,25 +10537,21 @@ var spine = (() => {
10887
10537
  for (let ii = 0; ii < constraintMap.bones.length; ii++) {
10888
10538
  let boneName = constraintMap.bones[ii];
10889
10539
  let bone = skeletonData.findBone(boneName);
10890
- if (!bone)
10891
- throw new Error(`Couldn't find bone ${boneName} for path constraint ${constraintMap.name}.`);
10540
+ if (!bone) throw new Error(`Couldn't find bone ${boneName} for path constraint ${constraintMap.name}.`);
10892
10541
  data.bones.push(bone);
10893
10542
  }
10894
10543
  let targetName = constraintMap.target;
10895
10544
  let target = skeletonData.findSlot(targetName);
10896
- if (!target)
10897
- throw new Error(`Couldn't find target slot ${targetName} for path constraint ${constraintMap.name}.`);
10545
+ if (!target) throw new Error(`Couldn't find target slot ${targetName} for path constraint ${constraintMap.name}.`);
10898
10546
  data.target = target;
10899
10547
  data.positionMode = Utils.enumValue(PositionMode, getValue(constraintMap, "positionMode", "Percent"));
10900
10548
  data.spacingMode = Utils.enumValue(SpacingMode, getValue(constraintMap, "spacingMode", "Length"));
10901
10549
  data.rotateMode = Utils.enumValue(RotateMode, getValue(constraintMap, "rotateMode", "Tangent"));
10902
10550
  data.offsetRotation = getValue(constraintMap, "rotation", 0);
10903
10551
  data.position = getValue(constraintMap, "position", 0);
10904
- if (data.positionMode == 0 /* Fixed */)
10905
- data.position *= scale;
10552
+ if (data.positionMode == 0 /* Fixed */) data.position *= scale;
10906
10553
  data.spacing = getValue(constraintMap, "spacing", 0);
10907
- if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */)
10908
- data.spacing *= scale;
10554
+ if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */) data.spacing *= scale;
10909
10555
  data.mixRotate = getValue(constraintMap, "mixRotate", 1);
10910
10556
  data.mixX = getValue(constraintMap, "mixX", 1);
10911
10557
  data.mixY = getValue(constraintMap, "mixY", data.mixX);
@@ -10920,8 +10566,7 @@ var spine = (() => {
10920
10566
  data.skinRequired = getValue(constraintMap, "skin", false);
10921
10567
  const boneName = constraintMap.bone;
10922
10568
  const bone = skeletonData.findBone(boneName);
10923
- if (bone == null)
10924
- throw new Error("Physics bone not found: " + boneName);
10569
+ if (bone == null) throw new Error("Physics bone not found: " + boneName);
10925
10570
  data.bone = bone;
10926
10571
  data.x = getValue(constraintMap, "x", 0);
10927
10572
  data.y = getValue(constraintMap, "y", 0);
@@ -10955,8 +10600,7 @@ var spine = (() => {
10955
10600
  for (let ii = 0; ii < skinMap.bones.length; ii++) {
10956
10601
  let boneName = skinMap.bones[ii];
10957
10602
  let bone = skeletonData.findBone(boneName);
10958
- if (!bone)
10959
- throw new Error(`Couldn't find bone ${boneName} for skin ${skinMap.name}.`);
10603
+ if (!bone) throw new Error(`Couldn't find bone ${boneName} for skin ${skinMap.name}.`);
10960
10604
  skin.bones.push(bone);
10961
10605
  }
10962
10606
  }
@@ -10964,8 +10608,7 @@ var spine = (() => {
10964
10608
  for (let ii = 0; ii < skinMap.ik.length; ii++) {
10965
10609
  let constraintName = skinMap.ik[ii];
10966
10610
  let constraint = skeletonData.findIkConstraint(constraintName);
10967
- if (!constraint)
10968
- throw new Error(`Couldn't find IK constraint ${constraintName} for skin ${skinMap.name}.`);
10611
+ if (!constraint) throw new Error(`Couldn't find IK constraint ${constraintName} for skin ${skinMap.name}.`);
10969
10612
  skin.constraints.push(constraint);
10970
10613
  }
10971
10614
  }
@@ -10973,8 +10616,7 @@ var spine = (() => {
10973
10616
  for (let ii = 0; ii < skinMap.transform.length; ii++) {
10974
10617
  let constraintName = skinMap.transform[ii];
10975
10618
  let constraint = skeletonData.findTransformConstraint(constraintName);
10976
- if (!constraint)
10977
- throw new Error(`Couldn't find transform constraint ${constraintName} for skin ${skinMap.name}.`);
10619
+ if (!constraint) throw new Error(`Couldn't find transform constraint ${constraintName} for skin ${skinMap.name}.`);
10978
10620
  skin.constraints.push(constraint);
10979
10621
  }
10980
10622
  }
@@ -10982,8 +10624,7 @@ var spine = (() => {
10982
10624
  for (let ii = 0; ii < skinMap.path.length; ii++) {
10983
10625
  let constraintName = skinMap.path[ii];
10984
10626
  let constraint = skeletonData.findPathConstraint(constraintName);
10985
- if (!constraint)
10986
- throw new Error(`Couldn't find path constraint ${constraintName} for skin ${skinMap.name}.`);
10627
+ if (!constraint) throw new Error(`Couldn't find path constraint ${constraintName} for skin ${skinMap.name}.`);
10987
10628
  skin.constraints.push(constraint);
10988
10629
  }
10989
10630
  }
@@ -10991,39 +10632,32 @@ var spine = (() => {
10991
10632
  for (let ii = 0; ii < skinMap.physics.length; ii++) {
10992
10633
  let constraintName = skinMap.physics[ii];
10993
10634
  let constraint = skeletonData.findPhysicsConstraint(constraintName);
10994
- if (!constraint)
10995
- throw new Error(`Couldn't find physics constraint ${constraintName} for skin ${skinMap.name}.`);
10635
+ if (!constraint) throw new Error(`Couldn't find physics constraint ${constraintName} for skin ${skinMap.name}.`);
10996
10636
  skin.constraints.push(constraint);
10997
10637
  }
10998
10638
  }
10999
10639
  for (let slotName in skinMap.attachments) {
11000
10640
  let slot = skeletonData.findSlot(slotName);
11001
- if (!slot)
11002
- throw new Error(`Couldn't find slot ${slotName} for skin ${skinMap.name}.`);
10641
+ if (!slot) throw new Error(`Couldn't find slot ${slotName} for skin ${skinMap.name}.`);
11003
10642
  let slotMap = skinMap.attachments[slotName];
11004
10643
  for (let entryName in slotMap) {
11005
10644
  let attachment = this.readAttachment(slotMap[entryName], skin, slot.index, entryName, skeletonData);
11006
- if (attachment)
11007
- skin.setAttachment(slot.index, entryName, attachment);
10645
+ if (attachment) skin.setAttachment(slot.index, entryName, attachment);
11008
10646
  }
11009
10647
  }
11010
10648
  skeletonData.skins.push(skin);
11011
- if (skin.name == "default")
11012
- skeletonData.defaultSkin = skin;
10649
+ if (skin.name == "default") skeletonData.defaultSkin = skin;
11013
10650
  }
11014
10651
  }
11015
10652
  for (let i = 0, n = this.linkedMeshes.length; i < n; i++) {
11016
10653
  let linkedMesh = this.linkedMeshes[i];
11017
10654
  let skin = !linkedMesh.skin ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);
11018
- if (!skin)
11019
- throw new Error(`Skin not found: ${linkedMesh.skin}`);
10655
+ if (!skin) throw new Error(`Skin not found: ${linkedMesh.skin}`);
11020
10656
  let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
11021
- if (!parent)
11022
- throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
10657
+ if (!parent) throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
11023
10658
  linkedMesh.mesh.timelineAttachment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
11024
10659
  linkedMesh.mesh.setParentMesh(parent);
11025
- if (linkedMesh.mesh.region != null)
11026
- linkedMesh.mesh.updateRegion();
10660
+ if (linkedMesh.mesh.region != null) linkedMesh.mesh.updateRegion();
11027
10661
  }
11028
10662
  this.linkedMeshes.length = 0;
11029
10663
  if (root.events) {
@@ -11057,8 +10691,7 @@ var spine = (() => {
11057
10691
  let path = getValue(map, "path", name);
11058
10692
  let sequence = this.readSequence(getValue(map, "sequence", null));
11059
10693
  let region = this.attachmentLoader.newRegionAttachment(skin, name, path, sequence);
11060
- if (!region)
11061
- return null;
10694
+ if (!region) return null;
11062
10695
  region.path = path;
11063
10696
  region.x = getValue(map, "x", 0) * scale;
11064
10697
  region.y = getValue(map, "y", 0) * scale;
@@ -11069,20 +10702,16 @@ var spine = (() => {
11069
10702
  region.height = map.height * scale;
11070
10703
  region.sequence = sequence;
11071
10704
  let color = getValue(map, "color", null);
11072
- if (color)
11073
- region.color.setFromString(color);
11074
- if (region.region != null)
11075
- region.updateRegion();
10705
+ if (color) region.color.setFromString(color);
10706
+ if (region.region != null) region.updateRegion();
11076
10707
  return region;
11077
10708
  }
11078
10709
  case "boundingbox": {
11079
10710
  let box = this.attachmentLoader.newBoundingBoxAttachment(skin, name);
11080
- if (!box)
11081
- return null;
10711
+ if (!box) return null;
11082
10712
  this.readVertices(map, box, map.vertexCount << 1);
11083
10713
  let color = getValue(map, "color", null);
11084
- if (color)
11085
- box.color.setFromString(color);
10714
+ if (color) box.color.setFromString(color);
11086
10715
  return box;
11087
10716
  }
11088
10717
  case "mesh":
@@ -11090,12 +10719,10 @@ var spine = (() => {
11090
10719
  let path = getValue(map, "path", name);
11091
10720
  let sequence = this.readSequence(getValue(map, "sequence", null));
11092
10721
  let mesh = this.attachmentLoader.newMeshAttachment(skin, name, path, sequence);
11093
- if (!mesh)
11094
- return null;
10722
+ if (!mesh) return null;
11095
10723
  mesh.path = path;
11096
10724
  let color = getValue(map, "color", null);
11097
- if (color)
11098
- mesh.color.setFromString(color);
10725
+ if (color) mesh.color.setFromString(color);
11099
10726
  mesh.width = getValue(map, "width", 0) * scale;
11100
10727
  mesh.height = getValue(map, "height", 0) * scale;
11101
10728
  mesh.sequence = sequence;
@@ -11108,16 +10735,14 @@ var spine = (() => {
11108
10735
  this.readVertices(map, mesh, uvs.length);
11109
10736
  mesh.triangles = map.triangles;
11110
10737
  mesh.regionUVs = uvs;
11111
- if (mesh.region != null)
11112
- mesh.updateRegion();
10738
+ if (mesh.region != null) mesh.updateRegion();
11113
10739
  mesh.edges = getValue(map, "edges", null);
11114
10740
  mesh.hullLength = getValue(map, "hull", 0) * 2;
11115
10741
  return mesh;
11116
10742
  }
11117
10743
  case "path": {
11118
10744
  let path = this.attachmentLoader.newPathAttachment(skin, name);
11119
- if (!path)
11120
- return null;
10745
+ if (!path) return null;
11121
10746
  path.closed = getValue(map, "closed", false);
11122
10747
  path.constantSpeed = getValue(map, "constantSpeed", true);
11123
10748
  let vertexCount = map.vertexCount;
@@ -11127,42 +10752,35 @@ var spine = (() => {
11127
10752
  lengths[i] = map.lengths[i] * scale;
11128
10753
  path.lengths = lengths;
11129
10754
  let color = getValue(map, "color", null);
11130
- if (color)
11131
- path.color.setFromString(color);
10755
+ if (color) path.color.setFromString(color);
11132
10756
  return path;
11133
10757
  }
11134
10758
  case "point": {
11135
10759
  let point = this.attachmentLoader.newPointAttachment(skin, name);
11136
- if (!point)
11137
- return null;
10760
+ if (!point) return null;
11138
10761
  point.x = getValue(map, "x", 0) * scale;
11139
10762
  point.y = getValue(map, "y", 0) * scale;
11140
10763
  point.rotation = getValue(map, "rotation", 0);
11141
10764
  let color = getValue(map, "color", null);
11142
- if (color)
11143
- point.color.setFromString(color);
10765
+ if (color) point.color.setFromString(color);
11144
10766
  return point;
11145
10767
  }
11146
10768
  case "clipping": {
11147
10769
  let clip = this.attachmentLoader.newClippingAttachment(skin, name);
11148
- if (!clip)
11149
- return null;
10770
+ if (!clip) return null;
11150
10771
  let end = getValue(map, "end", null);
11151
- if (end)
11152
- clip.endSlot = skeletonData.findSlot(end);
10772
+ if (end) clip.endSlot = skeletonData.findSlot(end);
11153
10773
  let vertexCount = map.vertexCount;
11154
10774
  this.readVertices(map, clip, vertexCount << 1);
11155
10775
  let color = getValue(map, "color", null);
11156
- if (color)
11157
- clip.color.setFromString(color);
10776
+ if (color) clip.color.setFromString(color);
11158
10777
  return clip;
11159
10778
  }
11160
10779
  }
11161
10780
  return null;
11162
10781
  }
11163
10782
  readSequence(map) {
11164
- if (map == null)
11165
- return null;
10783
+ if (map == null) return null;
11166
10784
  let sequence = new Sequence(getValue(map, "count", 0));
11167
10785
  sequence.start = getValue(map, "start", 1);
11168
10786
  sequence.digits = getValue(map, "digits", 0);
@@ -11204,13 +10822,11 @@ var spine = (() => {
11204
10822
  for (let slotName in map.slots) {
11205
10823
  let slotMap = map.slots[slotName];
11206
10824
  let slot = skeletonData.findSlot(slotName);
11207
- if (!slot)
11208
- throw new Error("Slot not found: " + slotName);
10825
+ if (!slot) throw new Error("Slot not found: " + slotName);
11209
10826
  let slotIndex = slot.index;
11210
10827
  for (let timelineName in slotMap) {
11211
10828
  let timelineMap = slotMap[timelineName];
11212
- if (!timelineMap)
11213
- continue;
10829
+ if (!timelineMap) continue;
11214
10830
  let frames = timelineMap.length;
11215
10831
  if (timelineName == "attachment") {
11216
10832
  let timeline = new AttachmentTimeline(frames, slotIndex);
@@ -11343,14 +10959,12 @@ var spine = (() => {
11343
10959
  for (let boneName in map.bones) {
11344
10960
  let boneMap = map.bones[boneName];
11345
10961
  let bone = skeletonData.findBone(boneName);
11346
- if (!bone)
11347
- throw new Error("Bone not found: " + boneName);
10962
+ if (!bone) throw new Error("Bone not found: " + boneName);
11348
10963
  let boneIndex = bone.index;
11349
10964
  for (let timelineName in boneMap) {
11350
10965
  let timelineMap = boneMap[timelineName];
11351
10966
  let frames = timelineMap.length;
11352
- if (frames == 0)
11353
- continue;
10967
+ if (frames == 0) continue;
11354
10968
  if (timelineName === "rotate") {
11355
10969
  timelines.push(readTimeline12(timelineMap, new RotateTimeline(frames, frames, boneIndex), 0, 1));
11356
10970
  } else if (timelineName === "translate") {
@@ -11395,11 +11009,9 @@ var spine = (() => {
11395
11009
  for (let constraintName in map.ik) {
11396
11010
  let constraintMap = map.ik[constraintName];
11397
11011
  let keyMap = constraintMap[0];
11398
- if (!keyMap)
11399
- continue;
11012
+ if (!keyMap) continue;
11400
11013
  let constraint = skeletonData.findIkConstraint(constraintName);
11401
- if (!constraint)
11402
- throw new Error("IK Constraint not found: " + constraintName);
11014
+ if (!constraint) throw new Error("IK Constraint not found: " + constraintName);
11403
11015
  let constraintIndex = skeletonData.ikConstraints.indexOf(constraint);
11404
11016
  let timeline = new IkConstraintTimeline(constraintMap.length, constraintMap.length << 1, constraintIndex);
11405
11017
  let time = getValue(keyMap, "time", 0);
@@ -11432,11 +11044,9 @@ var spine = (() => {
11432
11044
  for (let constraintName in map.transform) {
11433
11045
  let timelineMap = map.transform[constraintName];
11434
11046
  let keyMap = timelineMap[0];
11435
- if (!keyMap)
11436
- continue;
11047
+ if (!keyMap) continue;
11437
11048
  let constraint = skeletonData.findTransformConstraint(constraintName);
11438
- if (!constraint)
11439
- throw new Error("Transform constraint not found: " + constraintName);
11049
+ if (!constraint) throw new Error("Transform constraint not found: " + constraintName);
11440
11050
  let constraintIndex = skeletonData.transformConstraints.indexOf(constraint);
11441
11051
  let timeline = new TransformConstraintTimeline(timelineMap.length, timelineMap.length * 6, constraintIndex);
11442
11052
  let time = getValue(keyMap, "time", 0);
@@ -11485,14 +11095,12 @@ var spine = (() => {
11485
11095
  for (let constraintName in map.path) {
11486
11096
  let constraintMap = map.path[constraintName];
11487
11097
  let constraint = skeletonData.findPathConstraint(constraintName);
11488
- if (!constraint)
11489
- throw new Error("Path constraint not found: " + constraintName);
11098
+ if (!constraint) throw new Error("Path constraint not found: " + constraintName);
11490
11099
  let constraintIndex = skeletonData.pathConstraints.indexOf(constraint);
11491
11100
  for (let timelineName in constraintMap) {
11492
11101
  let timelineMap = constraintMap[timelineName];
11493
11102
  let keyMap = timelineMap[0];
11494
- if (!keyMap)
11495
- continue;
11103
+ if (!keyMap) continue;
11496
11104
  let frames = timelineMap.length;
11497
11105
  if (timelineName === "position") {
11498
11106
  let timeline = new PathConstraintPositionTimeline(frames, frames, constraintIndex);
@@ -11540,15 +11148,13 @@ var spine = (() => {
11540
11148
  let constraintIndex = -1;
11541
11149
  if (constraintName.length > 0) {
11542
11150
  let constraint = skeletonData.findPhysicsConstraint(constraintName);
11543
- if (!constraint)
11544
- throw new Error("Physics constraint not found: " + constraintName);
11151
+ if (!constraint) throw new Error("Physics constraint not found: " + constraintName);
11545
11152
  constraintIndex = skeletonData.physicsConstraints.indexOf(constraint);
11546
11153
  }
11547
11154
  for (let timelineName in constraintMap) {
11548
11155
  let timelineMap = constraintMap[timelineName];
11549
11156
  let keyMap = timelineMap[0];
11550
- if (!keyMap)
11551
- continue;
11157
+ if (!keyMap) continue;
11552
11158
  let frames = timelineMap.length;
11553
11159
  if (timelineName == "reset") {
11554
11160
  const timeline2 = new PhysicsConstraintResetTimeline(frames, constraintIndex);
@@ -11582,13 +11188,11 @@ var spine = (() => {
11582
11188
  for (let attachmentsName in map.attachments) {
11583
11189
  let attachmentsMap = map.attachments[attachmentsName];
11584
11190
  let skin = skeletonData.findSkin(attachmentsName);
11585
- if (!skin)
11586
- throw new Error("Skin not found: " + attachmentsName);
11191
+ if (!skin) throw new Error("Skin not found: " + attachmentsName);
11587
11192
  for (let slotMapName in attachmentsMap) {
11588
11193
  let slotMap = attachmentsMap[slotMapName];
11589
11194
  let slot = skeletonData.findSlot(slotMapName);
11590
- if (!slot)
11591
- throw new Error("Slot not found: " + slotMapName);
11195
+ if (!slot) throw new Error("Slot not found: " + slotMapName);
11592
11196
  let slotIndex = slot.index;
11593
11197
  for (let attachmentMapName in slotMap) {
11594
11198
  let attachmentMap = slotMap[attachmentMapName];
@@ -11596,8 +11200,7 @@ var spine = (() => {
11596
11200
  for (let timelineMapName in attachmentMap) {
11597
11201
  let timelineMap = attachmentMap[timelineMapName];
11598
11202
  let keyMap = timelineMap[0];
11599
- if (!keyMap)
11600
- continue;
11203
+ if (!keyMap) continue;
11601
11204
  if (timelineMapName == "deform") {
11602
11205
  let weighted = attachment.bones;
11603
11206
  let vertices = attachment.vertices;
@@ -11630,8 +11233,7 @@ var spine = (() => {
11630
11233
  }
11631
11234
  let time2 = getValue(nextMap, "time", 0);
11632
11235
  let curve = keyMap.curve;
11633
- if (curve)
11634
- bezier = readCurve(curve, timeline, bezier, frame, 0, time, time2, 0, 1, 1);
11236
+ if (curve) bezier = readCurve(curve, timeline, bezier, frame, 0, time, time2, 0, 1, 1);
11635
11237
  time = time2;
11636
11238
  keyMap = nextMap;
11637
11239
  }
@@ -11670,8 +11272,7 @@ var spine = (() => {
11670
11272
  for (let ii = 0; ii < offsets.length; ii++) {
11671
11273
  let offsetMap = offsets[ii];
11672
11274
  let slot = skeletonData.findSlot(offsetMap.slot);
11673
- if (!slot)
11674
- throw new Error("Slot not found: " + slot);
11275
+ if (!slot) throw new Error("Slot not found: " + slot);
11675
11276
  let slotIndex = slot.index;
11676
11277
  while (originalIndex != slotIndex)
11677
11278
  unchanged[unchangedIndex++] = originalIndex++;
@@ -11680,8 +11281,7 @@ var spine = (() => {
11680
11281
  while (originalIndex < slotCount)
11681
11282
  unchanged[unchangedIndex++] = originalIndex++;
11682
11283
  for (let ii = slotCount - 1; ii >= 0; ii--)
11683
- if (drawOrder[ii] == -1)
11684
- drawOrder[ii] = unchanged[--unchangedIndex];
11284
+ if (drawOrder[ii] == -1) drawOrder[ii] = unchanged[--unchangedIndex];
11685
11285
  }
11686
11286
  timeline.setFrame(frame, getValue(drawOrderMap, "time", 0), drawOrder);
11687
11287
  }
@@ -11693,8 +11293,7 @@ var spine = (() => {
11693
11293
  for (let i = 0; i < map.events.length; i++, frame++) {
11694
11294
  let eventMap = map.events[i];
11695
11295
  let eventData = skeletonData.findEvent(eventMap.name);
11696
- if (!eventData)
11697
- throw new Error("Event not found: " + eventMap.name);
11296
+ if (!eventData) throw new Error("Event not found: " + eventMap.name);
11698
11297
  let event = new Event(Utils.toSinglePrecision(getValue(eventMap, "time", 0)), eventData);
11699
11298
  event.intValue = getValue(eventMap, "int", eventData.intValue);
11700
11299
  event.floatValue = getValue(eventMap, "float", eventData.floatValue);
@@ -11741,8 +11340,7 @@ var spine = (() => {
11741
11340
  }
11742
11341
  let time2 = getValue(nextMap, "time", 0);
11743
11342
  let value2 = getValue(nextMap, "value", defaultValue) * scale;
11744
- if (keyMap.curve)
11745
- bezier = readCurve(keyMap.curve, timeline, bezier, frame, 0, time, time2, value, value2, scale);
11343
+ if (keyMap.curve) bezier = readCurve(keyMap.curve, timeline, bezier, frame, 0, time, time2, value, value2, scale);
11746
11344
  time = time2;
11747
11345
  value = value2;
11748
11346
  keyMap = nextMap;
@@ -11795,7 +11393,7 @@ var spine = (() => {
11795
11393
  // spine-core/src/polyfills.ts
11796
11394
  (() => {
11797
11395
  if (typeof Math.fround === "undefined") {
11798
- Math.fround = function(array) {
11396
+ Math.fround = /* @__PURE__ */ function(array) {
11799
11397
  return function(x) {
11800
11398
  return array[0] = x, array[0];
11801
11399
  };
@@ -11827,7 +11425,9 @@ var spine = (() => {
11827
11425
 
11828
11426
  // spine-canvas/src/SkeletonRenderer.ts
11829
11427
  var worldVertices = Utils.newFloatArray(8);
11830
- var _SkeletonRenderer = class {
11428
+ var SkeletonRenderer = class _SkeletonRenderer {
11429
+ static QUAD_TRIANGLES = [0, 1, 2, 2, 3, 0];
11430
+ static VERTEX_SIZE = 2 + 2 + 4;
11831
11431
  ctx;
11832
11432
  triangleRendering = false;
11833
11433
  debugRendering = false;
@@ -11837,26 +11437,21 @@ var spine = (() => {
11837
11437
  this.ctx = context;
11838
11438
  }
11839
11439
  draw(skeleton) {
11840
- if (this.triangleRendering)
11841
- this.drawTriangles(skeleton);
11842
- else
11843
- this.drawImages(skeleton);
11440
+ if (this.triangleRendering) this.drawTriangles(skeleton);
11441
+ else this.drawImages(skeleton);
11844
11442
  }
11845
11443
  drawImages(skeleton) {
11846
11444
  let ctx = this.ctx;
11847
11445
  let color = this.tempColor;
11848
11446
  let skeletonColor = skeleton.color;
11849
11447
  let drawOrder = skeleton.drawOrder;
11850
- if (this.debugRendering)
11851
- ctx.strokeStyle = "green";
11448
+ if (this.debugRendering) ctx.strokeStyle = "green";
11852
11449
  for (let i = 0, n = drawOrder.length; i < n; i++) {
11853
11450
  let slot = drawOrder[i];
11854
11451
  let bone = slot.bone;
11855
- if (!bone.active)
11856
- continue;
11452
+ if (!bone.active) continue;
11857
11453
  let attachment = slot.getAttachment();
11858
- if (!(attachment instanceof RegionAttachment))
11859
- continue;
11454
+ if (!(attachment instanceof RegionAttachment)) continue;
11860
11455
  attachment.computeWorldVertices(slot, worldVertices, 0, 2);
11861
11456
  let region = attachment.region;
11862
11457
  let image = region.texture.getImage();
@@ -11886,8 +11481,7 @@ var spine = (() => {
11886
11481
  ctx.translate(-w / 2, -h / 2);
11887
11482
  ctx.globalAlpha = color.a;
11888
11483
  ctx.drawImage(image, image.width * region.u, image.height * region.v, w, h, 0, 0, w, h);
11889
- if (this.debugRendering)
11890
- ctx.strokeRect(0, 0, w, h);
11484
+ if (this.debugRendering) ctx.strokeRect(0, 0, w, h);
11891
11485
  ctx.restore();
11892
11486
  }
11893
11487
  }
@@ -11917,8 +11511,7 @@ var spine = (() => {
11917
11511
  } else
11918
11512
  continue;
11919
11513
  if (texture) {
11920
- if (slot.data.blendMode != blendMode)
11921
- blendMode = slot.data.blendMode;
11514
+ if (slot.data.blendMode != blendMode) blendMode = slot.data.blendMode;
11922
11515
  let slotColor = slot.color;
11923
11516
  let attachmentColor = attachment.color;
11924
11517
  color.set(
@@ -11974,8 +11567,7 @@ var spine = (() => {
11974
11567
  u2 -= u0;
11975
11568
  v2 -= v0;
11976
11569
  let det = u1 * v2 - u2 * v1;
11977
- if (det == 0)
11978
- return;
11570
+ if (det == 0) return;
11979
11571
  det = 1 / det;
11980
11572
  const a = (v2 * x1 - v1 * x2) * det;
11981
11573
  const b = (v2 * y1 - v1 * y2) * det;
@@ -12046,8 +11638,7 @@ var spine = (() => {
12046
11638
  );
12047
11639
  let vertexCount = mesh.worldVerticesLength / 2;
12048
11640
  let vertices = this.vertices;
12049
- if (vertices.length < mesh.worldVerticesLength)
12050
- this.vertices = vertices = Utils.newFloatArray(mesh.worldVerticesLength);
11641
+ if (vertices.length < mesh.worldVerticesLength) this.vertices = vertices = Utils.newFloatArray(mesh.worldVerticesLength);
12051
11642
  mesh.computeWorldVertices(slot, 0, mesh.worldVerticesLength, vertices, 0, _SkeletonRenderer.VERTEX_SIZE);
12052
11643
  let uvs = mesh.uvs;
12053
11644
  for (let i = 0, u = 0, v = 2; i < vertexCount; i++) {
@@ -12062,9 +11653,6 @@ var spine = (() => {
12062
11653
  return vertices;
12063
11654
  }
12064
11655
  };
12065
- var SkeletonRenderer = _SkeletonRenderer;
12066
- __publicField(SkeletonRenderer, "QUAD_TRIANGLES", [0, 1, 2, 2, 3, 0]);
12067
- __publicField(SkeletonRenderer, "VERTEX_SIZE", 2 + 2 + 4);
12068
- return __toCommonJS(src_exports);
11656
+ return __toCommonJS(index_exports);
12069
11657
  })();
12070
11658
  //# sourceMappingURL=spine-canvas.js.map