@esotericsoftware/spine-core 4.1.14 → 4.1.17

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.
Files changed (59) hide show
  1. package/dist/Animation.d.ts +7 -7
  2. package/dist/Animation.js +8 -16
  3. package/dist/AnimationState.d.ts +18 -17
  4. package/dist/AnimationState.js +33 -26
  5. package/dist/AnimationStateData.js +1 -3
  6. package/dist/AssetManagerBase.js +10 -10
  7. package/dist/AtlasAttachmentLoader.js +7 -7
  8. package/dist/Bone.d.ts +2 -2
  9. package/dist/Bone.js +1 -5
  10. package/dist/BoneData.d.ts +2 -2
  11. package/dist/BoneData.js +1 -3
  12. package/dist/Event.d.ts +1 -1
  13. package/dist/Event.js +1 -2
  14. package/dist/EventData.d.ts +2 -2
  15. package/dist/EventData.js +1 -2
  16. package/dist/IkConstraint.js +15 -10
  17. package/dist/IkConstraintData.d.ts +3 -1
  18. package/dist/IkConstraintData.js +9 -2
  19. package/dist/PathConstraint.js +13 -12
  20. package/dist/PathConstraintData.d.ts +3 -1
  21. package/dist/PathConstraintData.js +12 -5
  22. package/dist/Skeleton.d.ts +9 -9
  23. package/dist/Skeleton.js +9 -18
  24. package/dist/SkeletonBinary.d.ts +2 -2
  25. package/dist/SkeletonBinary.js +55 -15
  26. package/dist/SkeletonBounds.d.ts +3 -3
  27. package/dist/SkeletonClipping.js +5 -3
  28. package/dist/SkeletonData.d.ts +14 -14
  29. package/dist/SkeletonData.js +1 -1
  30. package/dist/SkeletonJson.d.ts +2 -2
  31. package/dist/SkeletonJson.js +96 -23
  32. package/dist/Skin.d.ts +2 -2
  33. package/dist/Skin.js +3 -5
  34. package/dist/Slot.d.ts +4 -4
  35. package/dist/Slot.js +4 -8
  36. package/dist/SlotData.d.ts +2 -2
  37. package/dist/SlotData.js +2 -6
  38. package/dist/TextureAtlas.d.ts +6 -4
  39. package/dist/TextureAtlas.js +29 -33
  40. package/dist/TransformConstraint.js +11 -10
  41. package/dist/TransformConstraintData.d.ts +3 -1
  42. package/dist/TransformConstraintData.js +9 -2
  43. package/dist/Utils.d.ts +2 -2
  44. package/dist/Utils.js +1 -1
  45. package/dist/attachments/Attachment.d.ts +1 -1
  46. package/dist/attachments/Attachment.js +2 -4
  47. package/dist/attachments/AttachmentLoader.d.ts +2 -2
  48. package/dist/attachments/ClippingAttachment.d.ts +1 -1
  49. package/dist/attachments/ClippingAttachment.js +1 -1
  50. package/dist/attachments/HasTextureRegion.d.ts +2 -2
  51. package/dist/attachments/MeshAttachment.d.ts +4 -4
  52. package/dist/attachments/MeshAttachment.js +11 -12
  53. package/dist/attachments/PathAttachment.js +2 -2
  54. package/dist/attachments/RegionAttachment.d.ts +3 -3
  55. package/dist/attachments/RegionAttachment.js +6 -6
  56. package/dist/iife/spine-core.js +355 -198
  57. package/dist/iife/spine-core.js.map +2 -2
  58. package/dist/iife/spine-core.min.js +2 -2
  59. package/package.json +1 -1
@@ -511,7 +511,7 @@ var spine = (() => {
511
511
  super(name);
512
512
  this.id = _VertexAttachment.nextID++;
513
513
  this.bones = null;
514
- this.vertices = null;
514
+ this.vertices = [];
515
515
  this.worldVerticesLength = 0;
516
516
  this.timelineAttahment = this;
517
517
  }
@@ -582,8 +582,7 @@ var spine = (() => {
582
582
  if (this.vertices) {
583
583
  attachment.vertices = Utils.newFloatArray(this.vertices.length);
584
584
  Utils.arrayCopy(this.vertices, 0, attachment.vertices, 0, this.vertices.length);
585
- } else
586
- attachment.vertices = null;
585
+ }
587
586
  attachment.worldVerticesLength = this.worldVerticesLength;
588
587
  attachment.timelineAttahment = this.timelineAttahment;
589
588
  }
@@ -657,8 +656,8 @@ var spine = (() => {
657
656
  // spine-core/src/Animation.ts
658
657
  var Animation = class {
659
658
  constructor(name, timelines, duration) {
660
- this.timelines = null;
661
- this.timelineIds = null;
659
+ this.timelines = [];
660
+ this.timelineIds = new StringSet();
662
661
  if (!name)
663
662
  throw new Error("name cannot be null.");
664
663
  this.name = name;
@@ -669,7 +668,7 @@ var spine = (() => {
669
668
  if (!timelines)
670
669
  throw new Error("timelines cannot be null.");
671
670
  this.timelines = timelines;
672
- this.timelineIds = new StringSet();
671
+ this.timelineIds.clear();
673
672
  for (var i = 0; i < timelines.length; i++)
674
673
  this.timelineIds.addAll(timelines[i].getPropertyIds());
675
674
  }
@@ -728,8 +727,6 @@ var spine = (() => {
728
727
  };
729
728
  var Timeline = class {
730
729
  constructor(frameCount, propertyIds) {
731
- this.propertyIds = null;
732
- this.frames = null;
733
730
  this.propertyIds = propertyIds;
734
731
  this.frames = Utils.newFloatArray(frameCount * this.getFrameEntries());
735
732
  }
@@ -763,7 +760,6 @@ var spine = (() => {
763
760
  var CurveTimeline = class extends Timeline {
764
761
  constructor(frameCount, bezierCount, propertyIds) {
765
762
  super(frameCount, propertyIds);
766
- this.curves = null;
767
763
  this.curves = Utils.newFloatArray(frameCount + bezierCount * 18);
768
764
  this.curves[frameCount - 1] = 1;
769
765
  }
@@ -1823,8 +1819,6 @@ var spine = (() => {
1823
1819
  Property.deform + "|" + slotIndex + "|" + attachment.id
1824
1820
  ]);
1825
1821
  this.slotIndex = 0;
1826
- this.attachment = null;
1827
- this.vertices = null;
1828
1822
  this.slotIndex = slotIndex;
1829
1823
  this.attachment = attachment;
1830
1824
  this.vertices = new Array(frameCount);
@@ -1887,6 +1881,8 @@ var spine = (() => {
1887
1881
  if (!slot.bone.active)
1888
1882
  return;
1889
1883
  let slotAttachment = slot.getAttachment();
1884
+ if (!slotAttachment)
1885
+ return;
1890
1886
  if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttahment != this.attachment)
1891
1887
  return;
1892
1888
  let deform = slot.deform;
@@ -2041,7 +2037,6 @@ var spine = (() => {
2041
2037
  var _EventTimeline = class extends Timeline {
2042
2038
  constructor(frameCount) {
2043
2039
  super(frameCount, _EventTimeline.propertyIds);
2044
- this.events = null;
2045
2040
  this.events = new Array(frameCount);
2046
2041
  }
2047
2042
  getFrameCount() {
@@ -2084,7 +2079,6 @@ var spine = (() => {
2084
2079
  var _DrawOrderTimeline = class extends Timeline {
2085
2080
  constructor(frameCount) {
2086
2081
  super(frameCount, _DrawOrderTimeline.propertyIds);
2087
- this.drawOrders = null;
2088
2082
  this.drawOrders = new Array(frameCount);
2089
2083
  }
2090
2084
  getFrameCount() {
@@ -2105,7 +2099,8 @@ var spine = (() => {
2105
2099
  Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
2106
2100
  return;
2107
2101
  }
2108
- let drawOrderToSetupIndex = this.drawOrders[Timeline.search1(this.frames, time)];
2102
+ let idx = Timeline.search1(this.frames, time);
2103
+ let drawOrderToSetupIndex = this.drawOrders[idx];
2109
2104
  if (!drawOrderToSetupIndex)
2110
2105
  Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
2111
2106
  else {
@@ -2521,9 +2516,8 @@ var spine = (() => {
2521
2516
  SequenceTimeline.DELAY = 2;
2522
2517
 
2523
2518
  // spine-core/src/AnimationState.ts
2524
- var AnimationState = class {
2519
+ var _AnimationState = class {
2525
2520
  constructor(data) {
2526
- this.data = null;
2527
2521
  this.tracks = new Array();
2528
2522
  this.timeScale = 1;
2529
2523
  this.unkeyedState = 0;
@@ -2536,9 +2530,7 @@ var spine = (() => {
2536
2530
  this.data = data;
2537
2531
  }
2538
2532
  static emptyAnimation() {
2539
- if (!_emptyAnimation)
2540
- _emptyAnimation = new Animation("<empty>", [], 0);
2541
- return _emptyAnimation;
2533
+ return _AnimationState._emptyAnimation;
2542
2534
  }
2543
2535
  update(delta) {
2544
2536
  delta *= this.timeScale;
@@ -2971,13 +2963,13 @@ var spine = (() => {
2971
2963
  return entry;
2972
2964
  }
2973
2965
  setEmptyAnimation(trackIndex, mixDuration = 0) {
2974
- let entry = this.setAnimationWith(trackIndex, AnimationState.emptyAnimation(), false);
2966
+ let entry = this.setAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false);
2975
2967
  entry.mixDuration = mixDuration;
2976
2968
  entry.trackEnd = mixDuration;
2977
2969
  return entry;
2978
2970
  }
2979
2971
  addEmptyAnimation(trackIndex, mixDuration = 0, delay = 0) {
2980
- let entry = this.addAnimationWith(trackIndex, AnimationState.emptyAnimation(), false, delay);
2972
+ let entry = this.addAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false, delay);
2981
2973
  if (delay <= 0)
2982
2974
  entry.delay += entry.mixDuration - mixDuration;
2983
2975
  entry.mixDuration = mixDuration;
@@ -3116,6 +3108,8 @@ var spine = (() => {
3116
3108
  this.queue.clear();
3117
3109
  }
3118
3110
  };
3111
+ var AnimationState = _AnimationState;
3112
+ AnimationState._emptyAnimation = new Animation("<empty>", [], 0);
3119
3113
  var TrackEntry = class {
3120
3114
  constructor() {
3121
3115
  this.animation = null;
@@ -3197,7 +3191,6 @@ var spine = (() => {
3197
3191
  constructor(animState) {
3198
3192
  this.objects = [];
3199
3193
  this.drainDisabled = false;
3200
- this.animState = null;
3201
3194
  this.animState = animState;
3202
3195
  }
3203
3196
  start(entry) {
@@ -3240,45 +3233,57 @@ var spine = (() => {
3240
3233
  case EventType.start:
3241
3234
  if (entry.listener && entry.listener.start)
3242
3235
  entry.listener.start(entry);
3243
- for (let ii = 0; ii < listeners.length; ii++)
3244
- if (listeners[ii].start)
3245
- listeners[ii].start(entry);
3236
+ for (let ii = 0; ii < listeners.length; ii++) {
3237
+ let listener = listeners[ii];
3238
+ if (listener.start)
3239
+ listener.start(entry);
3240
+ }
3246
3241
  break;
3247
3242
  case EventType.interrupt:
3248
3243
  if (entry.listener && entry.listener.interrupt)
3249
3244
  entry.listener.interrupt(entry);
3250
- for (let ii = 0; ii < listeners.length; ii++)
3251
- if (listeners[ii].interrupt)
3252
- listeners[ii].interrupt(entry);
3245
+ for (let ii = 0; ii < listeners.length; ii++) {
3246
+ let listener = listeners[ii];
3247
+ if (listener.interrupt)
3248
+ listener.interrupt(entry);
3249
+ }
3253
3250
  break;
3254
3251
  case EventType.end:
3255
3252
  if (entry.listener && entry.listener.end)
3256
3253
  entry.listener.end(entry);
3257
- for (let ii = 0; ii < listeners.length; ii++)
3258
- if (listeners[ii].end)
3259
- listeners[ii].end(entry);
3254
+ for (let ii = 0; ii < listeners.length; ii++) {
3255
+ let listener = listeners[ii];
3256
+ if (listener.end)
3257
+ listener.end(entry);
3258
+ }
3260
3259
  case EventType.dispose:
3261
3260
  if (entry.listener && entry.listener.dispose)
3262
3261
  entry.listener.dispose(entry);
3263
- for (let ii = 0; ii < listeners.length; ii++)
3264
- if (listeners[ii].dispose)
3265
- listeners[ii].dispose(entry);
3262
+ for (let ii = 0; ii < listeners.length; ii++) {
3263
+ let listener = listeners[ii];
3264
+ if (listener.dispose)
3265
+ listener.dispose(entry);
3266
+ }
3266
3267
  this.animState.trackEntryPool.free(entry);
3267
3268
  break;
3268
3269
  case EventType.complete:
3269
3270
  if (entry.listener && entry.listener.complete)
3270
3271
  entry.listener.complete(entry);
3271
- for (let ii = 0; ii < listeners.length; ii++)
3272
- if (listeners[ii].complete)
3273
- listeners[ii].complete(entry);
3272
+ for (let ii = 0; ii < listeners.length; ii++) {
3273
+ let listener = listeners[ii];
3274
+ if (listener.complete)
3275
+ listener.complete(entry);
3276
+ }
3274
3277
  break;
3275
3278
  case EventType.event:
3276
3279
  let event = objects[i++ + 2];
3277
3280
  if (entry.listener && entry.listener.event)
3278
3281
  entry.listener.event(entry, event);
3279
- for (let ii = 0; ii < listeners.length; ii++)
3280
- if (listeners[ii].event)
3281
- listeners[ii].event(entry, event);
3282
+ for (let ii = 0; ii < listeners.length; ii++) {
3283
+ let listener = listeners[ii];
3284
+ if (listener.event)
3285
+ listener.event(entry, event);
3286
+ }
3282
3287
  break;
3283
3288
  }
3284
3289
  }
@@ -3319,12 +3324,10 @@ var spine = (() => {
3319
3324
  var HOLD_MIX = 4;
3320
3325
  var SETUP = 1;
3321
3326
  var CURRENT = 2;
3322
- var _emptyAnimation = null;
3323
3327
 
3324
3328
  // spine-core/src/AnimationStateData.ts
3325
3329
  var AnimationStateData = class {
3326
3330
  constructor(skeletonData) {
3327
- this.skeletonData = null;
3328
3331
  this.animationToMixTime = {};
3329
3332
  this.defaultMix = 0;
3330
3333
  if (!skeletonData)
@@ -3441,65 +3444,63 @@ var spine = (() => {
3441
3444
  this.regions = new Array();
3442
3445
  let reader = new TextureAtlasReader(atlasText);
3443
3446
  let entry = new Array(4);
3444
- let page = null;
3445
- let region = null;
3446
3447
  let pageFields = {};
3447
- pageFields["size"] = () => {
3448
- page.width = parseInt(entry[1]);
3449
- page.height = parseInt(entry[2]);
3448
+ pageFields["size"] = (page2) => {
3449
+ page2.width = parseInt(entry[1]);
3450
+ page2.height = parseInt(entry[2]);
3450
3451
  };
3451
3452
  pageFields["format"] = () => {
3452
3453
  };
3453
- pageFields["filter"] = () => {
3454
- page.minFilter = Utils.enumValue(TextureFilter, entry[1]);
3455
- page.magFilter = Utils.enumValue(TextureFilter, entry[2]);
3454
+ pageFields["filter"] = (page2) => {
3455
+ page2.minFilter = Utils.enumValue(TextureFilter, entry[1]);
3456
+ page2.magFilter = Utils.enumValue(TextureFilter, entry[2]);
3456
3457
  };
3457
- pageFields["repeat"] = () => {
3458
+ pageFields["repeat"] = (page2) => {
3458
3459
  if (entry[1].indexOf("x") != -1)
3459
- page.uWrap = TextureWrap.Repeat;
3460
+ page2.uWrap = TextureWrap.Repeat;
3460
3461
  if (entry[1].indexOf("y") != -1)
3461
- page.vWrap = TextureWrap.Repeat;
3462
+ page2.vWrap = TextureWrap.Repeat;
3462
3463
  };
3463
- pageFields["pma"] = () => {
3464
- page.pma = entry[1] == "true";
3464
+ pageFields["pma"] = (page2) => {
3465
+ page2.pma = entry[1] == "true";
3465
3466
  };
3466
3467
  var regionFields = {};
3467
- regionFields["xy"] = () => {
3468
+ regionFields["xy"] = (region) => {
3468
3469
  region.x = parseInt(entry[1]);
3469
3470
  region.y = parseInt(entry[2]);
3470
3471
  };
3471
- regionFields["size"] = () => {
3472
+ regionFields["size"] = (region) => {
3472
3473
  region.width = parseInt(entry[1]);
3473
3474
  region.height = parseInt(entry[2]);
3474
3475
  };
3475
- regionFields["bounds"] = () => {
3476
+ regionFields["bounds"] = (region) => {
3476
3477
  region.x = parseInt(entry[1]);
3477
3478
  region.y = parseInt(entry[2]);
3478
3479
  region.width = parseInt(entry[3]);
3479
3480
  region.height = parseInt(entry[4]);
3480
3481
  };
3481
- regionFields["offset"] = () => {
3482
+ regionFields["offset"] = (region) => {
3482
3483
  region.offsetX = parseInt(entry[1]);
3483
3484
  region.offsetY = parseInt(entry[2]);
3484
3485
  };
3485
- regionFields["orig"] = () => {
3486
+ regionFields["orig"] = (region) => {
3486
3487
  region.originalWidth = parseInt(entry[1]);
3487
3488
  region.originalHeight = parseInt(entry[2]);
3488
3489
  };
3489
- regionFields["offsets"] = () => {
3490
+ regionFields["offsets"] = (region) => {
3490
3491
  region.offsetX = parseInt(entry[1]);
3491
3492
  region.offsetY = parseInt(entry[2]);
3492
3493
  region.originalWidth = parseInt(entry[3]);
3493
3494
  region.originalHeight = parseInt(entry[4]);
3494
3495
  };
3495
- regionFields["rotate"] = () => {
3496
+ regionFields["rotate"] = (region) => {
3496
3497
  let value = entry[1];
3497
3498
  if (value == "true")
3498
3499
  region.degrees = 90;
3499
3500
  else if (value != "false")
3500
3501
  region.degrees = parseInt(value);
3501
3502
  };
3502
- regionFields["index"] = () => {
3503
+ regionFields["index"] = (region) => {
3503
3504
  region.index = parseInt(entry[1]);
3504
3505
  };
3505
3506
  let line = reader.readLine();
@@ -3512,6 +3513,7 @@ var spine = (() => {
3512
3513
  break;
3513
3514
  line = reader.readLine();
3514
3515
  }
3516
+ let page = null;
3515
3517
  let names = null;
3516
3518
  let values = null;
3517
3519
  while (true) {
@@ -3521,32 +3523,29 @@ var spine = (() => {
3521
3523
  page = null;
3522
3524
  line = reader.readLine();
3523
3525
  } else if (!page) {
3524
- page = new TextureAtlasPage();
3525
- page.name = line.trim();
3526
+ page = new TextureAtlasPage(line.trim());
3526
3527
  while (true) {
3527
3528
  if (reader.readEntry(entry, line = reader.readLine()) == 0)
3528
3529
  break;
3529
3530
  let field = pageFields[entry[0]];
3530
3531
  if (field)
3531
- field();
3532
+ field(page);
3532
3533
  }
3533
3534
  this.pages.push(page);
3534
3535
  } else {
3535
- region = new TextureAtlasRegion();
3536
- region.page = page;
3537
- region.name = line;
3536
+ let region = new TextureAtlasRegion(page, line);
3538
3537
  while (true) {
3539
3538
  let count = reader.readEntry(entry, line = reader.readLine());
3540
3539
  if (count == 0)
3541
3540
  break;
3542
3541
  let field = regionFields[entry[0]];
3543
3542
  if (field)
3544
- field();
3543
+ field(region);
3545
3544
  else {
3546
- if (!names) {
3545
+ if (!names)
3547
3546
  names = [];
3547
+ if (!values)
3548
3548
  values = [];
3549
- }
3550
3549
  names.push(entry[0]);
3551
3550
  let entryValues = [];
3552
3551
  for (let i = 0; i < count; i++)
@@ -3558,7 +3557,7 @@ var spine = (() => {
3558
3557
  region.originalWidth = region.width;
3559
3558
  region.originalHeight = region.height;
3560
3559
  }
3561
- if (names && names.length > 0) {
3560
+ if (names && names.length > 0 && values && values.length > 0) {
3562
3561
  region.names = names;
3563
3562
  region.values = values;
3564
3563
  names = null;
@@ -3590,14 +3589,14 @@ var spine = (() => {
3590
3589
  page.setTexture(assetManager.get(pathPrefix + page.name));
3591
3590
  }
3592
3591
  dispose() {
3592
+ var _a;
3593
3593
  for (let i = 0; i < this.pages.length; i++) {
3594
- this.pages[i].texture.dispose();
3594
+ (_a = this.pages[i].texture) == null ? void 0 : _a.dispose();
3595
3595
  }
3596
3596
  }
3597
3597
  };
3598
3598
  var TextureAtlasReader = class {
3599
3599
  constructor(text) {
3600
- this.lines = null;
3601
3600
  this.index = 0;
3602
3601
  this.lines = text.split(/\r\n|\r|\n/);
3603
3602
  }
@@ -3630,8 +3629,7 @@ var spine = (() => {
3630
3629
  }
3631
3630
  };
3632
3631
  var TextureAtlasPage = class {
3633
- constructor() {
3634
- this.name = null;
3632
+ constructor(name) {
3635
3633
  this.minFilter = TextureFilter.Nearest;
3636
3634
  this.magFilter = TextureFilter.Nearest;
3637
3635
  this.uWrap = TextureWrap.ClampToEdge;
@@ -3640,6 +3638,7 @@ var spine = (() => {
3640
3638
  this.width = 0;
3641
3639
  this.height = 0;
3642
3640
  this.pma = false;
3641
+ this.name = name;
3643
3642
  }
3644
3643
  setTexture(texture) {
3645
3644
  this.texture = texture;
@@ -3648,10 +3647,8 @@ var spine = (() => {
3648
3647
  }
3649
3648
  };
3650
3649
  var TextureAtlasRegion = class extends TextureRegion {
3651
- constructor() {
3652
- super(...arguments);
3653
- this.page = null;
3654
- this.name = null;
3650
+ constructor(page, name) {
3651
+ super();
3655
3652
  this.x = 0;
3656
3653
  this.y = 0;
3657
3654
  this.offsetX = 0;
@@ -3662,28 +3659,32 @@ var spine = (() => {
3662
3659
  this.degrees = 0;
3663
3660
  this.names = null;
3664
3661
  this.values = null;
3662
+ this.page = page;
3663
+ this.name = name;
3665
3664
  }
3666
3665
  };
3667
3666
 
3668
3667
  // spine-core/src/attachments/MeshAttachment.ts
3669
3668
  var MeshAttachment = class extends VertexAttachment {
3670
- constructor(name) {
3669
+ constructor(name, path) {
3671
3670
  super(name);
3672
3671
  this.region = null;
3673
- this.path = null;
3674
- this.regionUVs = null;
3675
- this.uvs = null;
3676
- this.triangles = null;
3672
+ this.regionUVs = [];
3673
+ this.uvs = [];
3674
+ this.triangles = [];
3677
3675
  this.color = new Color(1, 1, 1, 1);
3678
3676
  this.width = 0;
3679
3677
  this.height = 0;
3680
3678
  this.hullLength = 0;
3681
- this.edges = null;
3679
+ this.edges = [];
3682
3680
  this.parentMesh = null;
3683
3681
  this.sequence = null;
3684
3682
  this.tempColor = new Color(0, 0, 0, 0);
3683
+ this.path = path;
3685
3684
  }
3686
3685
  updateRegion() {
3686
+ if (!this.region)
3687
+ throw new Error("Region not set.");
3687
3688
  let regionUVs = this.regionUVs;
3688
3689
  if (!this.uvs || this.uvs.length != regionUVs.length)
3689
3690
  this.uvs = Utils.newFloatArray(regionUVs.length);
@@ -3759,9 +3760,8 @@ var spine = (() => {
3759
3760
  copy() {
3760
3761
  if (this.parentMesh)
3761
3762
  return this.newLinkedMesh();
3762
- let copy = new MeshAttachment(this.name);
3763
+ let copy = new MeshAttachment(this.name, this.path);
3763
3764
  copy.region = this.region;
3764
- copy.path = this.path;
3765
3765
  copy.color.setFromColor(this.color);
3766
3766
  this.copyTo(copy);
3767
3767
  copy.regionUVs = new Array(this.regionUVs.length);
@@ -3786,9 +3786,8 @@ var spine = (() => {
3786
3786
  super.computeWorldVertices(slot, start, count, worldVertices, offset, stride);
3787
3787
  }
3788
3788
  newLinkedMesh() {
3789
- let copy = new MeshAttachment(this.name);
3789
+ let copy = new MeshAttachment(this.name, this.path);
3790
3790
  copy.region = this.region;
3791
- copy.path = this.path;
3792
3791
  copy.color.setFromColor(this.color);
3793
3792
  copy.timelineAttahment = this.timelineAttahment;
3794
3793
  copy.setParentMesh(this.parentMesh ? this.parentMesh : this);
@@ -3802,7 +3801,7 @@ var spine = (() => {
3802
3801
  var PathAttachment = class extends VertexAttachment {
3803
3802
  constructor(name) {
3804
3803
  super(name);
3805
- this.lengths = null;
3804
+ this.lengths = [];
3806
3805
  this.closed = false;
3807
3806
  this.constantSpeed = false;
3808
3807
  this.color = new Color(1, 1, 1, 1);
@@ -3851,7 +3850,7 @@ var spine = (() => {
3851
3850
 
3852
3851
  // spine-core/src/attachments/RegionAttachment.ts
3853
3852
  var _RegionAttachment = class extends Attachment {
3854
- constructor(name) {
3853
+ constructor(name, path) {
3855
3854
  super(name);
3856
3855
  this.x = 0;
3857
3856
  this.y = 0;
@@ -3861,15 +3860,17 @@ var spine = (() => {
3861
3860
  this.width = 0;
3862
3861
  this.height = 0;
3863
3862
  this.color = new Color(1, 1, 1, 1);
3864
- this.path = null;
3865
3863
  this.rendererObject = null;
3866
3864
  this.region = null;
3867
3865
  this.sequence = null;
3868
3866
  this.offset = Utils.newFloatArray(8);
3869
3867
  this.uvs = Utils.newFloatArray(8);
3870
3868
  this.tempColor = new Color(1, 1, 1, 1);
3869
+ this.path = path;
3871
3870
  }
3872
3871
  updateRegion() {
3872
+ if (!this.region)
3873
+ throw new Error("Region not set.");
3873
3874
  let region = this.region;
3874
3875
  let regionScaleX = this.width / this.region.originalWidth * this.scaleX;
3875
3876
  let regionScaleY = this.height / this.region.originalHeight * this.scaleY;
@@ -3948,10 +3949,9 @@ var spine = (() => {
3948
3949
  worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
3949
3950
  }
3950
3951
  copy() {
3951
- let copy = new _RegionAttachment(this.name);
3952
+ let copy = new _RegionAttachment(this.name, this.path);
3952
3953
  copy.region = this.region;
3953
3954
  copy.rendererObject = this.rendererObject;
3954
- copy.path = this.path;
3955
3955
  copy.x = this.x;
3956
3956
  copy.y = this.y;
3957
3957
  copy.scaleX = this.scaleX;
@@ -4003,21 +4003,21 @@ var spine = (() => {
4003
4003
  // spine-core/src/AtlasAttachmentLoader.ts
4004
4004
  var AtlasAttachmentLoader = class {
4005
4005
  constructor(atlas) {
4006
- this.atlas = null;
4007
4006
  this.atlas = atlas;
4008
4007
  }
4009
4008
  loadSequence(name, basePath, sequence) {
4010
4009
  let regions = sequence.regions;
4011
4010
  for (let i = 0, n = regions.length; i < n; i++) {
4012
4011
  let path = sequence.getPath(basePath, i);
4013
- regions[i] = this.atlas.findRegion(path);
4014
- regions[i].renderObject = regions[i];
4015
- if (regions[i] == null)
4012
+ let region = this.atlas.findRegion(path);
4013
+ if (region == null)
4016
4014
  throw new Error("Region not found in atlas: " + path + " (sequence: " + name + ")");
4015
+ regions[i] = region;
4016
+ regions[i].renderObject = regions[i];
4017
4017
  }
4018
4018
  }
4019
4019
  newRegionAttachment(skin, name, path, sequence) {
4020
- let attachment = new RegionAttachment(name);
4020
+ let attachment = new RegionAttachment(name, path);
4021
4021
  if (sequence != null) {
4022
4022
  this.loadSequence(name, path, sequence);
4023
4023
  } else {
@@ -4030,7 +4030,7 @@ var spine = (() => {
4030
4030
  return attachment;
4031
4031
  }
4032
4032
  newMeshAttachment(skin, name, path, sequence) {
4033
- let attachment = new MeshAttachment(name);
4033
+ let attachment = new MeshAttachment(name, path);
4034
4034
  if (sequence != null) {
4035
4035
  this.loadSequence(name, path, sequence);
4036
4036
  } else {
@@ -4060,7 +4060,6 @@ var spine = (() => {
4060
4060
  var BoneData = class {
4061
4061
  constructor(index, name, parent) {
4062
4062
  this.index = 0;
4063
- this.name = null;
4064
4063
  this.parent = null;
4065
4064
  this.length = 0;
4066
4065
  this.x = 0;
@@ -4094,8 +4093,6 @@ var spine = (() => {
4094
4093
  // spine-core/src/Bone.ts
4095
4094
  var Bone = class {
4096
4095
  constructor(data, skeleton, parent) {
4097
- this.data = null;
4098
- this.skeleton = null;
4099
4096
  this.parent = null;
4100
4097
  this.children = new Array();
4101
4098
  this.x = 0;
@@ -4348,15 +4345,15 @@ var spine = (() => {
4348
4345
 
4349
4346
  // spine-core/src/AssetManagerBase.ts
4350
4347
  var AssetManagerBase = class {
4351
- constructor(textureLoader, pathPrefix = "", downloader = null) {
4352
- this.pathPrefix = null;
4348
+ constructor(textureLoader, pathPrefix = "", downloader = new Downloader()) {
4349
+ this.pathPrefix = "";
4353
4350
  this.assets = {};
4354
4351
  this.errors = {};
4355
4352
  this.toLoad = 0;
4356
4353
  this.loaded = 0;
4357
4354
  this.textureLoader = textureLoader;
4358
4355
  this.pathPrefix = pathPrefix;
4359
- this.downloader = downloader || new Downloader();
4356
+ this.downloader = downloader;
4360
4357
  }
4361
4358
  start(path) {
4362
4359
  this.toLoad++;
@@ -4395,7 +4392,9 @@ var spine = (() => {
4395
4392
  setRawDataURI(path, data) {
4396
4393
  this.downloader.rawDataUris[this.pathPrefix + path] = data;
4397
4394
  }
4398
- loadBinary(path, success = null, error = null) {
4395
+ loadBinary(path, success = () => {
4396
+ }, error = () => {
4397
+ }) {
4399
4398
  path = this.start(path);
4400
4399
  this.downloader.downloadBinary(path, (data) => {
4401
4400
  this.success(success, path, data);
@@ -4403,7 +4402,9 @@ var spine = (() => {
4403
4402
  this.error(error, path, `Couldn't load binary ${path}: status ${status}, ${responseText}`);
4404
4403
  });
4405
4404
  }
4406
- loadText(path, success = null, error = null) {
4405
+ loadText(path, success = () => {
4406
+ }, error = () => {
4407
+ }) {
4407
4408
  path = this.start(path);
4408
4409
  this.downloader.downloadText(path, (data) => {
4409
4410
  this.success(success, path, data);
@@ -4411,7 +4412,9 @@ var spine = (() => {
4411
4412
  this.error(error, path, `Couldn't load text ${path}: status ${status}, ${responseText}`);
4412
4413
  });
4413
4414
  }
4414
- loadJson(path, success = null, error = null) {
4415
+ loadJson(path, success = () => {
4416
+ }, error = () => {
4417
+ }) {
4415
4418
  path = this.start(path);
4416
4419
  this.downloader.downloadJson(path, (data) => {
4417
4420
  this.success(success, path, data);
@@ -4419,7 +4422,9 @@ var spine = (() => {
4419
4422
  this.error(error, path, `Couldn't load JSON ${path}: status ${status}, ${responseText}`);
4420
4423
  });
4421
4424
  }
4422
- loadTexture(path, success = null, error = null) {
4425
+ loadTexture(path, success = () => {
4426
+ }, error = () => {
4427
+ }) {
4423
4428
  path = this.start(path);
4424
4429
  let isBrowser = !!(typeof window !== "undefined" && typeof navigator !== "undefined" && window.document);
4425
4430
  let isWebWorker = !isBrowser;
@@ -4449,7 +4454,9 @@ var spine = (() => {
4449
4454
  image.src = path;
4450
4455
  }
4451
4456
  }
4452
- loadTextureAtlas(path, success = null, error = null, fileAlias = null) {
4457
+ loadTextureAtlas(path, success = () => {
4458
+ }, error = () => {
4459
+ }, fileAlias) {
4453
4460
  let index = path.lastIndexOf("/");
4454
4461
  let parent = index >= 0 ? path.substring(0, index + 1) : "";
4455
4462
  path = this.start(path);
@@ -4458,7 +4465,7 @@ var spine = (() => {
4458
4465
  let atlas = new TextureAtlas(atlasText);
4459
4466
  let toLoad = atlas.pages.length, abort = false;
4460
4467
  for (let page of atlas.pages) {
4461
- this.loadTexture(fileAlias == null ? parent + page.name : fileAlias[page.name], (imagePath, texture) => {
4468
+ this.loadTexture(!fileAlias ? parent + page.name : fileAlias[page.name], (imagePath, texture) => {
4462
4469
  if (!abort) {
4463
4470
  page.setTexture(texture);
4464
4471
  if (--toLoad == 0)
@@ -4635,7 +4642,6 @@ var spine = (() => {
4635
4642
  // spine-core/src/Event.ts
4636
4643
  var Event = class {
4637
4644
  constructor(time, data) {
4638
- this.data = null;
4639
4645
  this.intValue = 0;
4640
4646
  this.floatValue = 0;
4641
4647
  this.stringValue = null;
@@ -4652,7 +4658,6 @@ var spine = (() => {
4652
4658
  // spine-core/src/EventData.ts
4653
4659
  var EventData = class {
4654
4660
  constructor(name) {
4655
- this.name = null;
4656
4661
  this.intValue = 0;
4657
4662
  this.floatValue = 0;
4658
4663
  this.stringValue = null;
@@ -4666,9 +4671,6 @@ var spine = (() => {
4666
4671
  // spine-core/src/IkConstraint.ts
4667
4672
  var IkConstraint = class {
4668
4673
  constructor(data, skeleton) {
4669
- this.data = null;
4670
- this.bones = null;
4671
- this.target = null;
4672
4674
  this.bendDirection = 0;
4673
4675
  this.compress = false;
4674
4676
  this.stretch = false;
@@ -4686,9 +4688,16 @@ var spine = (() => {
4686
4688
  this.compress = data.compress;
4687
4689
  this.stretch = data.stretch;
4688
4690
  this.bones = new Array();
4689
- for (let i = 0; i < data.bones.length; i++)
4690
- this.bones.push(skeleton.findBone(data.bones[i].name));
4691
- this.target = skeleton.findBone(data.target.name);
4691
+ for (let i = 0; i < data.bones.length; i++) {
4692
+ let bone = skeleton.findBone(data.bones[i].name);
4693
+ if (!bone)
4694
+ throw new Error(`Couldn't find bone ${data.bones[i].name}`);
4695
+ this.bones.push(bone);
4696
+ }
4697
+ let target = skeleton.findBone(data.target.name);
4698
+ if (!target)
4699
+ throw new Error(`Couldn't find bone ${data.target.name}`);
4700
+ this.target = target;
4692
4701
  }
4693
4702
  isActive() {
4694
4703
  return this.active;
@@ -4709,6 +4718,8 @@ var spine = (() => {
4709
4718
  }
4710
4719
  apply1(bone, targetX, targetY, compress, stretch, uniform, alpha) {
4711
4720
  let p = bone.parent;
4721
+ if (!p)
4722
+ throw new Error("IK bone must have parent.");
4712
4723
  let pa = p.a, pb = p.b, pc = p.c, pd = p.d;
4713
4724
  let rotationIK = -bone.ashearX - bone.arotation, tx = 0, ty = 0;
4714
4725
  switch (bone.data.transformMode) {
@@ -4786,6 +4797,8 @@ var spine = (() => {
4786
4797
  cwy = c * cx + d * cy + parent.worldY;
4787
4798
  }
4788
4799
  let pp = parent.parent;
4800
+ if (!pp)
4801
+ throw new Error("IK parent must itself have a parent.");
4789
4802
  a = pp.a;
4790
4803
  b = pp.b;
4791
4804
  c = pp.c;
@@ -4907,7 +4920,7 @@ var spine = (() => {
4907
4920
  constructor(name) {
4908
4921
  super(name, 0, false);
4909
4922
  this.bones = new Array();
4910
- this.target = null;
4923
+ this._target = null;
4911
4924
  this.bendDirection = 1;
4912
4925
  this.compress = false;
4913
4926
  this.stretch = false;
@@ -4915,6 +4928,15 @@ var spine = (() => {
4915
4928
  this.mix = 1;
4916
4929
  this.softness = 0;
4917
4930
  }
4931
+ set target(boneData) {
4932
+ this._target = boneData;
4933
+ }
4934
+ get target() {
4935
+ if (!this._target)
4936
+ throw new Error("BoneData not set.");
4937
+ else
4938
+ return this._target;
4939
+ }
4918
4940
  };
4919
4941
 
4920
4942
  // spine-core/src/PathConstraintData.ts
@@ -4922,10 +4944,10 @@ var spine = (() => {
4922
4944
  constructor(name) {
4923
4945
  super(name, 0, false);
4924
4946
  this.bones = new Array();
4925
- this.target = null;
4926
- this.positionMode = null;
4927
- this.spacingMode = null;
4928
- this.rotateMode = null;
4947
+ this._target = null;
4948
+ this.positionMode = PositionMode.Fixed;
4949
+ this.spacingMode = SpacingMode.Fixed;
4950
+ this.rotateMode = RotateMode.Chain;
4929
4951
  this.offsetRotation = 0;
4930
4952
  this.position = 0;
4931
4953
  this.spacing = 0;
@@ -4933,6 +4955,15 @@ var spine = (() => {
4933
4955
  this.mixX = 0;
4934
4956
  this.mixY = 0;
4935
4957
  }
4958
+ set target(slotData) {
4959
+ this._target = slotData;
4960
+ }
4961
+ get target() {
4962
+ if (!this._target)
4963
+ throw new Error("SlotData not set.");
4964
+ else
4965
+ return this._target;
4966
+ }
4936
4967
  };
4937
4968
  var PositionMode;
4938
4969
  (function(PositionMode2) {
@@ -4956,9 +4987,6 @@ var spine = (() => {
4956
4987
  // spine-core/src/PathConstraint.ts
4957
4988
  var _PathConstraint = class {
4958
4989
  constructor(data, skeleton) {
4959
- this.data = null;
4960
- this.bones = null;
4961
- this.target = null;
4962
4990
  this.position = 0;
4963
4991
  this.spacing = 0;
4964
4992
  this.mixRotate = 0;
@@ -4977,9 +5005,16 @@ var spine = (() => {
4977
5005
  throw new Error("skeleton cannot be null.");
4978
5006
  this.data = data;
4979
5007
  this.bones = new Array();
4980
- for (let i = 0, n = data.bones.length; i < n; i++)
4981
- this.bones.push(skeleton.findBone(data.bones[i].name));
4982
- this.target = skeleton.findSlot(data.target.name);
5008
+ for (let i = 0, n = data.bones.length; i < n; i++) {
5009
+ let bone = skeleton.findBone(data.bones[i].name);
5010
+ if (!bone)
5011
+ throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
5012
+ this.bones.push(bone);
5013
+ }
5014
+ let target = skeleton.findSlot(data.target.name);
5015
+ if (!target)
5016
+ throw new Error(`Couldn't find target bone ${data.target.name}`);
5017
+ this.target = target;
4983
5018
  this.position = data.position;
4984
5019
  this.spacing = data.spacing;
4985
5020
  this.mixRotate = data.mixRotate;
@@ -5000,7 +5035,7 @@ var spine = (() => {
5000
5035
  let tangents = data.rotateMode == RotateMode.Tangent, scale = data.rotateMode == RotateMode.ChainScale;
5001
5036
  let bones = this.bones;
5002
5037
  let boneCount = bones.length, spacesCount = tangents ? boneCount : boneCount + 1;
5003
- let spaces = Utils.setArraySize(this.spaces, spacesCount), lengths = scale ? this.lengths = Utils.setArraySize(this.lengths, boneCount) : null;
5038
+ let spaces = Utils.setArraySize(this.spaces, spacesCount), lengths = scale ? this.lengths = Utils.setArraySize(this.lengths, boneCount) : [];
5004
5039
  let spacing = this.spacing;
5005
5040
  switch (data.spacingMode) {
5006
5041
  case SpacingMode.Percent:
@@ -5121,7 +5156,7 @@ var spine = (() => {
5121
5156
  computeWorldPositions(path, spacesCount, tangents) {
5122
5157
  let target = this.target;
5123
5158
  let position = this.position;
5124
- let spaces = this.spaces, out = Utils.setArraySize(this.positions, spacesCount * 3 + 2), world = null;
5159
+ let spaces = this.spaces, out = Utils.setArraySize(this.positions, spacesCount * 3 + 2), world = this.world;
5125
5160
  let closed2 = path.closed;
5126
5161
  let verticesLength = path.worldVerticesLength, curveCount = verticesLength / 6, prevCurve = _PathConstraint.NONE;
5127
5162
  if (!path.constantSpeed) {
@@ -5378,12 +5413,10 @@ var spine = (() => {
5378
5413
  // spine-core/src/Slot.ts
5379
5414
  var Slot = class {
5380
5415
  constructor(data, bone) {
5381
- this.data = null;
5382
- this.bone = null;
5383
- this.color = null;
5384
5416
  this.darkColor = null;
5385
5417
  this.attachment = null;
5386
5418
  this.attachmentState = 0;
5419
+ this.sequenceIndex = -1;
5387
5420
  this.deform = new Array();
5388
5421
  if (!data)
5389
5422
  throw new Error("data cannot be null.");
@@ -5426,9 +5459,6 @@ var spine = (() => {
5426
5459
  // spine-core/src/TransformConstraint.ts
5427
5460
  var TransformConstraint = class {
5428
5461
  constructor(data, skeleton) {
5429
- this.data = null;
5430
- this.bones = null;
5431
- this.target = null;
5432
5462
  this.mixRotate = 0;
5433
5463
  this.mixX = 0;
5434
5464
  this.mixY = 0;
@@ -5449,9 +5479,16 @@ var spine = (() => {
5449
5479
  this.mixScaleY = data.mixScaleY;
5450
5480
  this.mixShearY = data.mixShearY;
5451
5481
  this.bones = new Array();
5452
- for (let i = 0; i < data.bones.length; i++)
5453
- this.bones.push(skeleton.findBone(data.bones[i].name));
5454
- this.target = skeleton.findBone(data.target.name);
5482
+ for (let i = 0; i < data.bones.length; i++) {
5483
+ let bone = skeleton.findBone(data.bones[i].name);
5484
+ if (!bone)
5485
+ throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
5486
+ this.bones.push(bone);
5487
+ }
5488
+ let target = skeleton.findBone(data.target.name);
5489
+ if (!target)
5490
+ throw new Error(`Couldn't find target bone ${data.target.name}.`);
5491
+ this.target = target;
5455
5492
  }
5456
5493
  isActive() {
5457
5494
  return this.active;
@@ -5636,16 +5673,8 @@ var spine = (() => {
5636
5673
  // spine-core/src/Skeleton.ts
5637
5674
  var Skeleton = class {
5638
5675
  constructor(data) {
5639
- this.data = null;
5640
- this.bones = null;
5641
- this.slots = null;
5642
- this.drawOrder = null;
5643
- this.ikConstraints = null;
5644
- this.transformConstraints = null;
5645
- this.pathConstraints = null;
5646
5676
  this._updateCache = new Array();
5647
5677
  this.skin = null;
5648
- this.color = null;
5649
5678
  this.scaleX = 1;
5650
5679
  this.scaleY = 1;
5651
5680
  this.x = 0;
@@ -5840,6 +5869,8 @@ var spine = (() => {
5840
5869
  }
5841
5870
  }
5842
5871
  sortBone(bone) {
5872
+ if (!bone)
5873
+ return;
5843
5874
  if (bone.sorted)
5844
5875
  return;
5845
5876
  let parent = bone.parent;
@@ -5876,6 +5907,8 @@ var spine = (() => {
5876
5907
  }
5877
5908
  updateWorldTransformWith(parent) {
5878
5909
  let rootBone = this.getRootBone();
5910
+ if (!rootBone)
5911
+ throw new Error("Root bone must not be null.");
5879
5912
  let pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
5880
5913
  rootBone.worldX = pa * this.x + pb * this.y + parent.worldX;
5881
5914
  rootBone.worldY = pc * this.x + pd * this.y + parent.worldY;
@@ -5996,7 +6029,10 @@ var spine = (() => {
5996
6029
  this.updateCache();
5997
6030
  }
5998
6031
  getAttachmentByName(slotName, attachmentName) {
5999
- return this.getAttachment(this.data.findSlot(slotName).index, attachmentName);
6032
+ let slot = this.data.findSlot(slotName);
6033
+ if (!slot)
6034
+ throw new Error(`Can't find slot with name ${slotName}`);
6035
+ return this.getAttachment(slot.index, attachmentName);
6000
6036
  }
6001
6037
  getAttachment(slotIndex, attachmentName) {
6002
6038
  if (!attachmentName)
@@ -6222,7 +6258,7 @@ var spine = (() => {
6222
6258
 
6223
6259
  // spine-core/src/Skin.ts
6224
6260
  var SkinEntry = class {
6225
- constructor(slotIndex = 0, name = null, attachment = null) {
6261
+ constructor(slotIndex = 0, name, attachment) {
6226
6262
  this.slotIndex = slotIndex;
6227
6263
  this.name = name;
6228
6264
  this.attachment = attachment;
@@ -6230,7 +6266,6 @@ var spine = (() => {
6230
6266
  };
6231
6267
  var Skin = class {
6232
6268
  constructor(name) {
6233
- this.name = null;
6234
6269
  this.attachments = new Array();
6235
6270
  this.bones = Array();
6236
6271
  this.constraints = new Array();
@@ -6325,7 +6360,7 @@ var spine = (() => {
6325
6360
  removeAttachment(slotIndex, name) {
6326
6361
  let dictionary = this.attachments[slotIndex];
6327
6362
  if (dictionary)
6328
- dictionary[name] = null;
6363
+ delete dictionary[name];
6329
6364
  }
6330
6365
  getAttachments() {
6331
6366
  let entries = new Array();
@@ -6382,12 +6417,10 @@ var spine = (() => {
6382
6417
  var SlotData = class {
6383
6418
  constructor(index, name, boneData) {
6384
6419
  this.index = 0;
6385
- this.name = null;
6386
- this.boneData = null;
6387
6420
  this.color = new Color(1, 1, 1, 1);
6388
6421
  this.darkColor = null;
6389
6422
  this.attachmentName = null;
6390
- this.blendMode = null;
6423
+ this.blendMode = BlendMode.Normal;
6391
6424
  if (index < 0)
6392
6425
  throw new Error("index must be >= 0.");
6393
6426
  if (!name)
@@ -6412,7 +6445,7 @@ var spine = (() => {
6412
6445
  constructor(name) {
6413
6446
  super(name, 0, false);
6414
6447
  this.bones = new Array();
6415
- this.target = null;
6448
+ this._target = null;
6416
6449
  this.mixRotate = 0;
6417
6450
  this.mixX = 0;
6418
6451
  this.mixY = 0;
@@ -6428,13 +6461,21 @@ var spine = (() => {
6428
6461
  this.relative = false;
6429
6462
  this.local = false;
6430
6463
  }
6464
+ set target(boneData) {
6465
+ this._target = boneData;
6466
+ }
6467
+ get target() {
6468
+ if (!this._target)
6469
+ throw new Error("BoneData not set.");
6470
+ else
6471
+ return this._target;
6472
+ }
6431
6473
  };
6432
6474
 
6433
6475
  // spine-core/src/SkeletonBinary.ts
6434
6476
  var SkeletonBinary = class {
6435
6477
  constructor(attachmentLoader) {
6436
6478
  this.scale = 1;
6437
- this.attachmentLoader = null;
6438
6479
  this.linkedMeshes = new Array();
6439
6480
  this.attachmentLoader = attachmentLoader;
6440
6481
  }
@@ -6459,11 +6500,17 @@ var spine = (() => {
6459
6500
  }
6460
6501
  let n = 0;
6461
6502
  n = input.readInt(true);
6462
- for (let i = 0; i < n; i++)
6463
- input.strings.push(input.readString());
6503
+ for (let i = 0; i < n; i++) {
6504
+ let str = input.readString();
6505
+ if (!str)
6506
+ throw new Error("String in string table must not be null.");
6507
+ input.strings.push(str);
6508
+ }
6464
6509
  n = input.readInt(true);
6465
6510
  for (let i = 0; i < n; i++) {
6466
6511
  let name = input.readString();
6512
+ if (!name)
6513
+ throw new Error("Bone name must not be null.");
6467
6514
  let parent = i == 0 ? null : skeletonData.bones[input.readInt(true)];
6468
6515
  let data = new BoneData(i, name, parent);
6469
6516
  data.rotation = input.readFloat();
@@ -6483,6 +6530,8 @@ var spine = (() => {
6483
6530
  n = input.readInt(true);
6484
6531
  for (let i = 0; i < n; i++) {
6485
6532
  let slotName = input.readString();
6533
+ if (!slotName)
6534
+ throw new Error("Slot name must not be null.");
6486
6535
  let boneData = skeletonData.bones[input.readInt(true)];
6487
6536
  let data = new SlotData(i, slotName, boneData);
6488
6537
  Color.rgba8888ToColor(data.color, input.readInt32());
@@ -6495,7 +6544,10 @@ var spine = (() => {
6495
6544
  }
6496
6545
  n = input.readInt(true);
6497
6546
  for (let i = 0, nn; i < n; i++) {
6498
- let data = new IkConstraintData(input.readString());
6547
+ let name = input.readString();
6548
+ if (!name)
6549
+ throw new Error("IK constraint data name must not be null.");
6550
+ let data = new IkConstraintData(name);
6499
6551
  data.order = input.readInt(true);
6500
6552
  data.skinRequired = input.readBoolean();
6501
6553
  nn = input.readInt(true);
@@ -6512,7 +6564,10 @@ var spine = (() => {
6512
6564
  }
6513
6565
  n = input.readInt(true);
6514
6566
  for (let i = 0, nn; i < n; i++) {
6515
- let data = new TransformConstraintData(input.readString());
6567
+ let name = input.readString();
6568
+ if (!name)
6569
+ throw new Error("Transform constraint data name must not be null.");
6570
+ let data = new TransformConstraintData(name);
6516
6571
  data.order = input.readInt(true);
6517
6572
  data.skinRequired = input.readBoolean();
6518
6573
  nn = input.readInt(true);
@@ -6537,7 +6592,10 @@ var spine = (() => {
6537
6592
  }
6538
6593
  n = input.readInt(true);
6539
6594
  for (let i = 0, nn; i < n; i++) {
6540
- let data = new PathConstraintData(input.readString());
6595
+ let name = input.readString();
6596
+ if (!name)
6597
+ throw new Error("Path constraint data name must not be null.");
6598
+ let data = new PathConstraintData(name);
6541
6599
  data.order = input.readInt(true);
6542
6600
  data.skinRequired = input.readBoolean();
6543
6601
  nn = input.readInt(true);
@@ -6567,14 +6625,24 @@ var spine = (() => {
6567
6625
  {
6568
6626
  let i = skeletonData.skins.length;
6569
6627
  Utils.setArraySize(skeletonData.skins, n = i + input.readInt(true));
6570
- for (; i < n; i++)
6571
- skeletonData.skins[i] = this.readSkin(input, skeletonData, false, nonessential);
6628
+ for (; i < n; i++) {
6629
+ let skin = this.readSkin(input, skeletonData, false, nonessential);
6630
+ if (!skin)
6631
+ throw new Error("readSkin() should not have returned null.");
6632
+ skeletonData.skins[i] = skin;
6633
+ }
6572
6634
  }
6573
6635
  n = this.linkedMeshes.length;
6574
6636
  for (let i = 0; i < n; i++) {
6575
6637
  let linkedMesh = this.linkedMeshes[i];
6576
6638
  let skin = !linkedMesh.skin ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);
6639
+ if (!skin)
6640
+ throw new Error("Not skin found for linked mesh.");
6641
+ if (!linkedMesh.parent)
6642
+ throw new Error("Linked mesh parent must not be null");
6577
6643
  let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
6644
+ if (!parent)
6645
+ throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
6578
6646
  linkedMesh.mesh.timelineAttahment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
6579
6647
  linkedMesh.mesh.setParentMesh(parent);
6580
6648
  if (linkedMesh.mesh.region != null)
@@ -6583,7 +6651,10 @@ var spine = (() => {
6583
6651
  this.linkedMeshes.length = 0;
6584
6652
  n = input.readInt(true);
6585
6653
  for (let i = 0; i < n; i++) {
6586
- let data = new EventData(input.readStringRef());
6654
+ let eventName = input.readStringRef();
6655
+ if (!eventName)
6656
+ throw new Error();
6657
+ let data = new EventData(eventName);
6587
6658
  data.intValue = input.readInt(false);
6588
6659
  data.floatValue = input.readFloat();
6589
6660
  data.stringValue = input.readString();
@@ -6595,8 +6666,12 @@ var spine = (() => {
6595
6666
  skeletonData.events.push(data);
6596
6667
  }
6597
6668
  n = input.readInt(true);
6598
- for (let i = 0; i < n; i++)
6599
- skeletonData.animations.push(this.readAnimation(input, input.readString(), skeletonData));
6669
+ for (let i = 0; i < n; i++) {
6670
+ let animationName = input.readString();
6671
+ if (!animationName)
6672
+ throw new Error("Animatio name must not be null.");
6673
+ skeletonData.animations.push(this.readAnimation(input, animationName, skeletonData));
6674
+ }
6600
6675
  return skeletonData;
6601
6676
  }
6602
6677
  readSkin(input, skeletonData, defaultSkin, nonessential) {
@@ -6608,7 +6683,10 @@ var spine = (() => {
6608
6683
  return null;
6609
6684
  skin = new Skin("default");
6610
6685
  } else {
6611
- skin = new Skin(input.readStringRef());
6686
+ let skinName = input.readStringRef();
6687
+ if (!skinName)
6688
+ throw new Error("Skin name must not be null.");
6689
+ skin = new Skin(skinName);
6612
6690
  skin.bones.length = input.readInt(true);
6613
6691
  for (let i = 0, n = skin.bones.length; i < n; i++)
6614
6692
  skin.bones[i] = skeletonData.bones[input.readInt(true)];
@@ -6624,6 +6702,8 @@ var spine = (() => {
6624
6702
  let slotIndex = input.readInt(true);
6625
6703
  for (let ii = 0, nn = input.readInt(true); ii < nn; ii++) {
6626
6704
  let name = input.readStringRef();
6705
+ if (!name)
6706
+ throw new Error("Attachment name must not be null");
6627
6707
  let attachment = this.readAttachment(input, skeletonData, skin, slotIndex, name, nonessential);
6628
6708
  if (attachment)
6629
6709
  skin.setAttachment(slotIndex, name, attachment);
@@ -6690,7 +6770,7 @@ var spine = (() => {
6690
6770
  let vertices = this.readVertices(input, vertexCount);
6691
6771
  let hullLength = input.readInt(true);
6692
6772
  let sequence = this.readSequence(input);
6693
- let edges = null;
6773
+ let edges = [];
6694
6774
  let width = 0, height = 0;
6695
6775
  if (nonessential) {
6696
6776
  edges = this.readShortArray(input);
@@ -7192,6 +7272,8 @@ var spine = (() => {
7192
7272
  let slotIndex = input.readInt(true);
7193
7273
  for (let iii = 0, nnn = input.readInt(true); iii < nnn; iii++) {
7194
7274
  let attachmentName = input.readStringRef();
7275
+ if (!attachmentName)
7276
+ throw new Error("attachmentName must not be null.");
7195
7277
  let attachment = skin.getAttachment(slotIndex, attachmentName);
7196
7278
  let timelineType = input.readByte();
7197
7279
  let frameCount = input.readInt(true);
@@ -7366,7 +7448,7 @@ var spine = (() => {
7366
7448
  let chars = "";
7367
7449
  let charCount = 0;
7368
7450
  for (let i = 0; i < byteCount; ) {
7369
- let b = this.readByte();
7451
+ let b = this.readUnsignedByte();
7370
7452
  switch (b >> 4) {
7371
7453
  case 12:
7372
7454
  case 13:
@@ -7867,6 +7949,8 @@ var spine = (() => {
7867
7949
  this.clippedVertices = new Array();
7868
7950
  this.clippedTriangles = new Array();
7869
7951
  this.scratch = new Array();
7952
+ this.clipAttachment = null;
7953
+ this.clippingPolygons = null;
7870
7954
  }
7871
7955
  clipStart(slot, clip) {
7872
7956
  if (this.clipAttachment)
@@ -7906,7 +7990,7 @@ var spine = (() => {
7906
7990
  let clipOutput = this.clipOutput, clippedVertices = this.clippedVertices;
7907
7991
  let clippedTriangles = this.clippedTriangles;
7908
7992
  let polygons = this.clippingPolygons;
7909
- let polygonsCount = this.clippingPolygons.length;
7993
+ let polygonsCount = polygons.length;
7910
7994
  let vertexSize = twoColor ? 12 : 8;
7911
7995
  let index = 0;
7912
7996
  clippedVertices.length = 0;
@@ -8038,7 +8122,7 @@ var spine = (() => {
8038
8122
  clip(x1, y1, x2, y2, x3, y3, clippingArea, output) {
8039
8123
  let originalOutput = output;
8040
8124
  let clipped = false;
8041
- let input = null;
8125
+ let input;
8042
8126
  if (clippingArea.length % 4 >= 2) {
8043
8127
  input = output;
8044
8128
  output = this.scratch;
@@ -8146,7 +8230,6 @@ var spine = (() => {
8146
8230
  // spine-core/src/SkeletonJson.ts
8147
8231
  var SkeletonJson = class {
8148
8232
  constructor(attachmentLoader) {
8149
- this.attachmentLoader = null;
8150
8233
  this.scale = 1;
8151
8234
  this.linkedMeshes = new Array();
8152
8235
  this.attachmentLoader = attachmentLoader;
@@ -8194,6 +8277,8 @@ var spine = (() => {
8194
8277
  for (let i = 0; i < root.slots.length; i++) {
8195
8278
  let slotMap = root.slots[i];
8196
8279
  let boneData = skeletonData.findBone(slotMap.bone);
8280
+ if (!boneData)
8281
+ throw new Error(`Couldn't find bone ${slotMap.bone} for slot ${slotMap.name}`);
8197
8282
  let data = new SlotData(skeletonData.slots.length, slotMap.name, boneData);
8198
8283
  let color = getValue(slotMap, "color", null);
8199
8284
  if (color)
@@ -8212,9 +8297,17 @@ var spine = (() => {
8212
8297
  let data = new IkConstraintData(constraintMap.name);
8213
8298
  data.order = getValue(constraintMap, "order", 0);
8214
8299
  data.skinRequired = getValue(constraintMap, "skin", false);
8215
- for (let ii = 0; ii < constraintMap.bones.length; ii++)
8216
- data.bones.push(skeletonData.findBone(constraintMap.bones[ii]));
8217
- data.target = skeletonData.findBone(constraintMap.target);
8300
+ for (let ii = 0; ii < constraintMap.bones.length; ii++) {
8301
+ let bone = skeletonData.findBone(constraintMap.bones[ii]);
8302
+ if (!bone)
8303
+ throw new Error(`Couldn't find bone ${constraintMap.bones[ii]} for IK constraint ${constraintMap.name}.`);
8304
+ data.bones.push(bone);
8305
+ }
8306
+ let target = skeletonData.findBone(constraintMap.target);
8307
+ ;
8308
+ if (!target)
8309
+ throw new Error(`Couldn't find target bone ${constraintMap.target} for IK constraint ${constraintMap.name}.`);
8310
+ data.target = target;
8218
8311
  data.mix = getValue(constraintMap, "mix", 1);
8219
8312
  data.softness = getValue(constraintMap, "softness", 0) * scale;
8220
8313
  data.bendDirection = getValue(constraintMap, "bendPositive", true) ? 1 : -1;
@@ -8230,10 +8323,18 @@ var spine = (() => {
8230
8323
  let data = new TransformConstraintData(constraintMap.name);
8231
8324
  data.order = getValue(constraintMap, "order", 0);
8232
8325
  data.skinRequired = getValue(constraintMap, "skin", false);
8233
- for (let ii = 0; ii < constraintMap.bones.length; ii++)
8234
- data.bones.push(skeletonData.findBone(constraintMap.bones[ii]));
8326
+ for (let ii = 0; ii < constraintMap.bones.length; ii++) {
8327
+ let boneName = constraintMap.bones[ii];
8328
+ let bone = skeletonData.findBone(boneName);
8329
+ if (!bone)
8330
+ throw new Error(`Couldn't find bone ${boneName} for transform constraint ${constraintMap.name}.`);
8331
+ data.bones.push(bone);
8332
+ }
8235
8333
  let targetName = constraintMap.target;
8236
- data.target = skeletonData.findBone(targetName);
8334
+ let target = skeletonData.findBone(targetName);
8335
+ if (!target)
8336
+ throw new Error(`Couldn't find target bone ${targetName} for transform constraint ${constraintMap.name}.`);
8337
+ data.target = target;
8237
8338
  data.local = getValue(constraintMap, "local", false);
8238
8339
  data.relative = getValue(constraintMap, "relative", false);
8239
8340
  data.offsetRotation = getValue(constraintMap, "rotation", 0);
@@ -8257,10 +8358,18 @@ var spine = (() => {
8257
8358
  let data = new PathConstraintData(constraintMap.name);
8258
8359
  data.order = getValue(constraintMap, "order", 0);
8259
8360
  data.skinRequired = getValue(constraintMap, "skin", false);
8260
- for (let ii = 0; ii < constraintMap.bones.length; ii++)
8261
- data.bones.push(skeletonData.findBone(constraintMap.bones[ii]));
8361
+ for (let ii = 0; ii < constraintMap.bones.length; ii++) {
8362
+ let boneName = constraintMap.bones[ii];
8363
+ let bone = skeletonData.findBone(boneName);
8364
+ if (!bone)
8365
+ throw new Error(`Couldn't find bone ${boneName} for path constraint ${constraintMap.name}.`);
8366
+ data.bones.push(bone);
8367
+ }
8262
8368
  let targetName = constraintMap.target;
8263
- data.target = skeletonData.findSlot(targetName);
8369
+ let target = skeletonData.findSlot(targetName);
8370
+ if (!target)
8371
+ throw new Error(`Couldn't find target slot ${targetName} for path constraint ${constraintMap.name}.`);
8372
+ data.target = target;
8264
8373
  data.positionMode = Utils.enumValue(PositionMode, getValue(constraintMap, "positionMode", "Percent"));
8265
8374
  data.spacingMode = Utils.enumValue(SpacingMode, getValue(constraintMap, "spacingMode", "Length"));
8266
8375
  data.rotateMode = Utils.enumValue(RotateMode, getValue(constraintMap, "rotateMode", "Tangent"));
@@ -8282,23 +8391,45 @@ var spine = (() => {
8282
8391
  let skinMap = root.skins[i];
8283
8392
  let skin = new Skin(skinMap.name);
8284
8393
  if (skinMap.bones) {
8285
- for (let ii = 0; ii < skinMap.bones.length; ii++)
8286
- skin.bones.push(skeletonData.findBone(skinMap.bones[ii]));
8394
+ for (let ii = 0; ii < skinMap.bones.length; ii++) {
8395
+ let boneName = skinMap.bones[ii];
8396
+ let bone = skeletonData.findBone(boneName);
8397
+ if (!bone)
8398
+ throw new Error(`Couldn't find bone ${boneName} for skin ${skinMap.name}.`);
8399
+ skin.bones.push(bone);
8400
+ }
8287
8401
  }
8288
8402
  if (skinMap.ik) {
8289
- for (let ii = 0; ii < skinMap.ik.length; ii++)
8290
- skin.constraints.push(skeletonData.findIkConstraint(skinMap.ik[ii]));
8403
+ for (let ii = 0; ii < skinMap.ik.length; ii++) {
8404
+ let constraintName = skinMap.ik[ii];
8405
+ let constraint = skeletonData.findIkConstraint(constraintName);
8406
+ if (!constraint)
8407
+ throw new Error(`Couldn't find IK constraint ${constraintName} for skin ${skinMap.name}.`);
8408
+ skin.constraints.push(constraint);
8409
+ }
8291
8410
  }
8292
8411
  if (skinMap.transform) {
8293
- for (let ii = 0; ii < skinMap.transform.length; ii++)
8294
- skin.constraints.push(skeletonData.findTransformConstraint(skinMap.transform[ii]));
8412
+ for (let ii = 0; ii < skinMap.transform.length; ii++) {
8413
+ let constraintName = skinMap.transform[ii];
8414
+ let constraint = skeletonData.findTransformConstraint(constraintName);
8415
+ if (!constraint)
8416
+ throw new Error(`Couldn't find transform constraint ${constraintName} for skin ${skinMap.name}.`);
8417
+ skin.constraints.push(constraint);
8418
+ }
8295
8419
  }
8296
8420
  if (skinMap.path) {
8297
- for (let ii = 0; ii < skinMap.path.length; ii++)
8298
- skin.constraints.push(skeletonData.findPathConstraint(skinMap.path[ii]));
8421
+ for (let ii = 0; ii < skinMap.path.length; ii++) {
8422
+ let constraintName = skinMap.path[ii];
8423
+ let constraint = skeletonData.findPathConstraint(constraintName);
8424
+ if (!constraint)
8425
+ throw new Error(`Couldn't find path constraint ${constraintName} for skin ${skinMap.name}.`);
8426
+ skin.constraints.push(constraint);
8427
+ }
8299
8428
  }
8300
8429
  for (let slotName in skinMap.attachments) {
8301
8430
  let slot = skeletonData.findSlot(slotName);
8431
+ if (!slot)
8432
+ throw new Error(`Couldn't find slot ${slotName} for skin ${skinMap.name}.`);
8302
8433
  let slotMap = skinMap.attachments[slotName];
8303
8434
  for (let entryName in slotMap) {
8304
8435
  let attachment = this.readAttachment(slotMap[entryName], skin, slot.index, entryName, skeletonData);
@@ -8314,7 +8445,11 @@ var spine = (() => {
8314
8445
  for (let i = 0, n = this.linkedMeshes.length; i < n; i++) {
8315
8446
  let linkedMesh = this.linkedMeshes[i];
8316
8447
  let skin = !linkedMesh.skin ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);
8448
+ if (!skin)
8449
+ throw new Error(`Skin not found: ${linkedMesh.skin}`);
8317
8450
  let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
8451
+ if (!parent)
8452
+ throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
8318
8453
  linkedMesh.mesh.timelineAttahment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
8319
8454
  linkedMesh.mesh.setParentMesh(parent);
8320
8455
  if (linkedMesh.mesh.region != null)
@@ -8498,7 +8633,10 @@ var spine = (() => {
8498
8633
  if (map.slots) {
8499
8634
  for (let slotName in map.slots) {
8500
8635
  let slotMap = map.slots[slotName];
8501
- let slotIndex = skeletonData.findSlot(slotName).index;
8636
+ let slot = skeletonData.findSlot(slotName);
8637
+ if (!slot)
8638
+ throw new Error("Slot not found: " + slotName);
8639
+ let slotIndex = slot.index;
8502
8640
  for (let timelineName in slotMap) {
8503
8641
  let timelineMap = slotMap[timelineName];
8504
8642
  if (!timelineMap)
@@ -8634,7 +8772,10 @@ var spine = (() => {
8634
8772
  if (map.bones) {
8635
8773
  for (let boneName in map.bones) {
8636
8774
  let boneMap = map.bones[boneName];
8637
- let boneIndex = skeletonData.findBone(boneName).index;
8775
+ let bone = skeletonData.findBone(boneName);
8776
+ if (!bone)
8777
+ throw new Error("Bone not found: " + boneName);
8778
+ let boneIndex = bone.index;
8638
8779
  for (let timelineName in boneMap) {
8639
8780
  let timelineMap = boneMap[timelineName];
8640
8781
  let frames = timelineMap.length;
@@ -8680,6 +8821,8 @@ var spine = (() => {
8680
8821
  if (!keyMap)
8681
8822
  continue;
8682
8823
  let constraint = skeletonData.findIkConstraint(constraintName);
8824
+ if (!constraint)
8825
+ throw new Error("IK Constraint not found: " + constraintName);
8683
8826
  let constraintIndex = skeletonData.ikConstraints.indexOf(constraint);
8684
8827
  let timeline = new IkConstraintTimeline(constraintMap.length, constraintMap.length << 1, constraintIndex);
8685
8828
  let time = getValue(keyMap, "time", 0);
@@ -8715,6 +8858,8 @@ var spine = (() => {
8715
8858
  if (!keyMap)
8716
8859
  continue;
8717
8860
  let constraint = skeletonData.findTransformConstraint(constraintName);
8861
+ if (!constraint)
8862
+ throw new Error("Transform constraint not found: " + constraintName);
8718
8863
  let constraintIndex = skeletonData.transformConstraints.indexOf(constraint);
8719
8864
  let timeline = new TransformConstraintTimeline(timelineMap.length, timelineMap.length * 6, constraintIndex);
8720
8865
  let time = getValue(keyMap, "time", 0);
@@ -8763,6 +8908,8 @@ var spine = (() => {
8763
8908
  for (let constraintName in map.path) {
8764
8909
  let constraintMap = map.path[constraintName];
8765
8910
  let constraint = skeletonData.findPathConstraint(constraintName);
8911
+ if (!constraint)
8912
+ throw new Error("Path constraint not found: " + constraintName);
8766
8913
  let constraintIndex = skeletonData.pathConstraints.indexOf(constraint);
8767
8914
  for (let timelineName in constraintMap) {
8768
8915
  let timelineMap = constraintMap[timelineName];
@@ -8814,9 +8961,14 @@ var spine = (() => {
8814
8961
  for (let attachmentsName in map.attachments) {
8815
8962
  let attachmentsMap = map.attachments[attachmentsName];
8816
8963
  let skin = skeletonData.findSkin(attachmentsName);
8964
+ if (!skin)
8965
+ throw new Error("Skin not found: " + attachmentsName);
8817
8966
  for (let slotMapName in attachmentsMap) {
8818
8967
  let slotMap = attachmentsMap[slotMapName];
8819
- let slotIndex = skeletonData.findSlot(slotMapName).index;
8968
+ let slot = skeletonData.findSlot(slotMapName);
8969
+ if (!slot)
8970
+ throw new Error("Slot not found: " + slotMapName);
8971
+ let slotIndex = slot.index;
8820
8972
  for (let attachmentMapName in slotMap) {
8821
8973
  let attachmentMap = slotMap[attachmentMapName];
8822
8974
  let attachment = skin.getAttachment(slotIndex, attachmentMapName);
@@ -8896,7 +9048,10 @@ var spine = (() => {
8896
9048
  let originalIndex = 0, unchangedIndex = 0;
8897
9049
  for (let ii = 0; ii < offsets.length; ii++) {
8898
9050
  let offsetMap = offsets[ii];
8899
- let slotIndex = skeletonData.findSlot(offsetMap.slot).index;
9051
+ let slot = skeletonData.findSlot(offsetMap.slot);
9052
+ if (!slot)
9053
+ throw new Error("Slot not found: " + slot);
9054
+ let slotIndex = slot.index;
8900
9055
  while (originalIndex != slotIndex)
8901
9056
  unchanged[unchangedIndex++] = originalIndex++;
8902
9057
  drawOrder[originalIndex + offsetMap.offset] = originalIndex++;
@@ -8917,6 +9072,8 @@ var spine = (() => {
8917
9072
  for (let i = 0; i < map.events.length; i++, frame++) {
8918
9073
  let eventMap = map.events[i];
8919
9074
  let eventData = skeletonData.findEvent(eventMap.name);
9075
+ if (!eventData)
9076
+ throw new Error("Event not found: " + eventMap.name);
8920
9077
  let event = new Event(Utils.toSinglePrecision(getValue(eventMap, "time", 0)), eventData);
8921
9078
  event.intValue = getValue(eventMap, "int", eventData.intValue);
8922
9079
  event.floatValue = getValue(eventMap, "float", eventData.floatValue);