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