@crockery/fellowship-components 0.3.0 → 0.4.1

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 (108) hide show
  1. package/README.md +12 -10
  2. package/RELEASING.md +15 -14
  3. package/dist/chunks/data-source-XbksqUrw.js +7 -0
  4. package/dist/chunks/decorate-B_ZTN9li.js +0 -2
  5. package/dist/chunks/{dungeon-cast-browser-Cyh519NI.js → dungeon-cast-browser-CSnu3gC5.js} +54 -56
  6. package/dist/chunks/{dungeon-map-xFaPasVr.js → dungeon-map-CutIcCVP.js} +89 -92
  7. package/dist/chunks/{talent-calculator-CIPNbqK5.js → talent-calculator-Dxuc2dZ8.js} +88 -90
  8. package/dist/chunks/tooltip-DoQVSnOn.js +0 -2
  9. package/dist/data/cast-data-source.d.ts +0 -1
  10. package/dist/data/data-source.d.ts +3 -2
  11. package/dist/data/package-cast-data-source.d.ts +0 -1
  12. package/dist/data/package-data-source.d.ts +0 -1
  13. package/dist/data/package-talent-data-source.d.ts +0 -1
  14. package/dist/data/talent-data-source.d.ts +0 -1
  15. package/dist/dungeon-cast-browser/dungeon-cast-browser.d.ts +0 -1
  16. package/dist/dungeon-cast-browser/dungeon-cast-browser.styles.d.ts +0 -1
  17. package/dist/dungeon-cast-browser/index.d.ts +0 -1
  18. package/dist/dungeon-cast-browser/render-model.d.ts +0 -1
  19. package/dist/dungeon-cast-browser/types.d.ts +0 -1
  20. package/dist/dungeon-cast-browser.js +1 -3
  21. package/dist/dungeon-map/dungeon-map.d.ts +0 -1
  22. package/dist/dungeon-map/dungeon-map.styles.d.ts +0 -1
  23. package/dist/dungeon-map/index.d.ts +0 -1
  24. package/dist/dungeon-map/layout.d.ts +0 -1
  25. package/dist/dungeon-map/render-model.d.ts +0 -1
  26. package/dist/dungeon-map/types.d.ts +0 -1
  27. package/dist/dungeon-map/viewport-controller.d.ts +0 -1
  28. package/dist/dungeon-map.js +1 -3
  29. package/dist/index.d.ts +0 -1
  30. package/dist/index.js +4 -4
  31. package/dist/react/dungeon-cast-browser.d.ts +0 -1
  32. package/dist/react/dungeon-cast-browser.js +1 -3
  33. package/dist/react/dungeon-map.d.ts +0 -1
  34. package/dist/react/dungeon-map.js +1 -3
  35. package/dist/react/index.d.ts +0 -1
  36. package/dist/react/talent-calculator.d.ts +0 -1
  37. package/dist/react/talent-calculator.js +1 -3
  38. package/dist/react/tooltip.d.ts +0 -1
  39. package/dist/react/tooltip.js +0 -2
  40. package/dist/styles/field-manual-fonts.d.ts +0 -1
  41. package/dist/styles/field-manual.styles.d.ts +0 -1
  42. package/dist/talent-calculator/index.d.ts +0 -1
  43. package/dist/talent-calculator/render-model.d.ts +0 -1
  44. package/dist/talent-calculator/selection-state.d.ts +0 -1
  45. package/dist/talent-calculator/talent-calculator.d.ts +0 -1
  46. package/dist/talent-calculator/talent-calculator.styles.d.ts +0 -1
  47. package/dist/talent-calculator/types.d.ts +0 -1
  48. package/dist/talent-calculator.js +1 -3
  49. package/dist/tooltip/index.d.ts +0 -1
  50. package/dist/tooltip/positioning.d.ts +0 -1
  51. package/dist/tooltip/rich-text.d.ts +0 -1
  52. package/dist/tooltip/tooltip.d.ts +0 -1
  53. package/dist/tooltip/tooltip.styles.d.ts +0 -1
  54. package/dist/tooltip/types.d.ts +0 -1
  55. package/dist/tooltip.js +0 -2
  56. package/package.json +8 -15
  57. package/dist/chunks/data-source-C-Gs7kRl.js +0 -2
  58. package/dist/chunks/decorate-B_ZTN9li.js.map +0 -1
  59. package/dist/chunks/dungeon-cast-browser-Cyh519NI.js.map +0 -1
  60. package/dist/chunks/dungeon-map-xFaPasVr.js.map +0 -1
  61. package/dist/chunks/talent-calculator-CIPNbqK5.js.map +0 -1
  62. package/dist/chunks/tooltip-DoQVSnOn.js.map +0 -1
  63. package/dist/data/cast-data-source.d.ts.map +0 -1
  64. package/dist/data/data-source.d.ts.map +0 -1
  65. package/dist/data/package-cast-data-source.d.ts.map +0 -1
  66. package/dist/data/package-data-source.d.ts.map +0 -1
  67. package/dist/data/package-talent-data-source.d.ts.map +0 -1
  68. package/dist/data/talent-data-source.d.ts.map +0 -1
  69. package/dist/dungeon-cast-browser/dungeon-cast-browser.d.ts.map +0 -1
  70. package/dist/dungeon-cast-browser/dungeon-cast-browser.styles.d.ts.map +0 -1
  71. package/dist/dungeon-cast-browser/index.d.ts.map +0 -1
  72. package/dist/dungeon-cast-browser/render-model.d.ts.map +0 -1
  73. package/dist/dungeon-cast-browser/types.d.ts.map +0 -1
  74. package/dist/dungeon-cast-browser.js.map +0 -1
  75. package/dist/dungeon-map/dungeon-map.d.ts.map +0 -1
  76. package/dist/dungeon-map/dungeon-map.styles.d.ts.map +0 -1
  77. package/dist/dungeon-map/index.d.ts.map +0 -1
  78. package/dist/dungeon-map/layout.d.ts.map +0 -1
  79. package/dist/dungeon-map/render-model.d.ts.map +0 -1
  80. package/dist/dungeon-map/types.d.ts.map +0 -1
  81. package/dist/dungeon-map/viewport-controller.d.ts.map +0 -1
  82. package/dist/dungeon-map.js.map +0 -1
  83. package/dist/index.d.ts.map +0 -1
  84. package/dist/react/dungeon-cast-browser.d.ts.map +0 -1
  85. package/dist/react/dungeon-cast-browser.js.map +0 -1
  86. package/dist/react/dungeon-map.d.ts.map +0 -1
  87. package/dist/react/dungeon-map.js.map +0 -1
  88. package/dist/react/index.d.ts.map +0 -1
  89. package/dist/react/talent-calculator.d.ts.map +0 -1
  90. package/dist/react/talent-calculator.js.map +0 -1
  91. package/dist/react/tooltip.d.ts.map +0 -1
  92. package/dist/react/tooltip.js.map +0 -1
  93. package/dist/styles/field-manual-fonts.d.ts.map +0 -1
  94. package/dist/styles/field-manual.styles.d.ts.map +0 -1
  95. package/dist/talent-calculator/index.d.ts.map +0 -1
  96. package/dist/talent-calculator/render-model.d.ts.map +0 -1
  97. package/dist/talent-calculator/selection-state.d.ts.map +0 -1
  98. package/dist/talent-calculator/talent-calculator.d.ts.map +0 -1
  99. package/dist/talent-calculator/talent-calculator.styles.d.ts.map +0 -1
  100. package/dist/talent-calculator/types.d.ts.map +0 -1
  101. package/dist/talent-calculator.js.map +0 -1
  102. package/dist/tooltip/index.d.ts.map +0 -1
  103. package/dist/tooltip/positioning.d.ts.map +0 -1
  104. package/dist/tooltip/rich-text.d.ts.map +0 -1
  105. package/dist/tooltip/tooltip.d.ts.map +0 -1
  106. package/dist/tooltip/tooltip.styles.d.ts.map +0 -1
  107. package/dist/tooltip/types.d.ts.map +0 -1
  108. package/dist/tooltip.js.map +0 -1
@@ -1,19 +1,19 @@
1
- import { t as e } from "./data-source-C-Gs7kRl.js";
2
- import { n as t, r as n, t as r } from "./decorate-B_ZTN9li.js";
3
- import { createPackageFellowshipDataClient as i } from "@crockery/fellowship-data/client";
4
- import { LitElement as a, css as o, html as s, nothing as c } from "lit";
5
- import { customElement as l, property as u, query as d, state as f } from "lit/decorators.js";
6
- import { repeat as p } from "lit/directives/repeat.js";
7
- import { styleMap as m } from "lit/directives/style-map.js";
8
- import { findImage as h } from "@crockery/fellowship-data";
1
+ import { n as e, t } from "./data-source-XbksqUrw.js";
2
+ import { n, r, t as i } from "./decorate-B_ZTN9li.js";
3
+ import { createPackageFellowshipDataClient as a } from "@crockery/fellowship-data/client";
4
+ import { LitElement as o, css as s, html as c, nothing as l } from "lit";
5
+ import { customElement as u, property as d, query as f, state as p } from "lit/decorators.js";
6
+ import { repeat as m } from "lit/directives/repeat.js";
7
+ import { styleMap as h } from "lit/directives/style-map.js";
8
+ import { findImage as g } from "@crockery/fellowship-data";
9
9
  //#region src/data/package-data-source.ts
10
- var g = (e = {}) => {
11
- let t = i(e);
10
+ var _ = (e = {}) => {
11
+ let t = a(e);
12
12
  return {
13
13
  loadDungeon: (e, n) => t.loadDungeon(e, n),
14
14
  resolveAssetUrl: (e) => t.resolveAssetUrl(e)
15
15
  };
16
- }, _ = o`
16
+ }, v = s`
17
17
  :host {
18
18
  --fellowship-map-soot: var(--_fellowship-field-canvas);
19
19
  --fellowship-map-ink: var(--_fellowship-field-ink);
@@ -459,7 +459,7 @@ var g = (e = {}) => {
459
459
  transform: none;
460
460
  }
461
461
  }
462
- `, v = .018, y = .036, b = .06, x = .12, S = (e, t, n) => Math.min(n, Math.max(t, e)), C = (e) => {
462
+ `, y = .018, b = .036, x = .06, S = .12, C = (e, t, n) => Math.min(n, Math.max(t, e)), w = (e) => {
463
463
  let t = e.map(({ position: e }) => e.x), n = e.map(({ position: e }) => e.y), r = Math.min(...t), i = Math.max(...t), a = Math.min(...n), o = Math.max(...n);
464
464
  return {
465
465
  x: r,
@@ -467,35 +467,35 @@ var g = (e = {}) => {
467
467
  width: i - r,
468
468
  height: o - a
469
469
  };
470
- }, w = (e) => {
471
- let t = e.x + e.width / 2, n = e.y + e.height / 2, r = Math.max(b, e.width + v * 2), i = Math.max(x, e.height + y * 2);
470
+ }, T = (e) => {
471
+ let t = e.x + e.width / 2, n = e.y + e.height / 2, r = Math.max(x, e.width + y * 2), i = Math.max(S, e.height + b * 2);
472
472
  return {
473
- x: S(t - r / 2, 0, Math.max(0, 1 - r)),
474
- y: S(n - i / 2, 0, Math.max(0, 1 - i)),
473
+ x: C(t - r / 2, 0, Math.max(0, 1 - r)),
474
+ y: C(n - i / 2, 0, Math.max(0, 1 - i)),
475
475
  width: Math.min(r, 1),
476
476
  height: Math.min(i, 1)
477
477
  };
478
- }, T = (e) => ({
478
+ }, E = (e) => ({
479
479
  x: e.reduce((e, t) => e + t.position.x, 0) / e.length,
480
480
  y: e.reduce((e, t) => e + t.position.y, 0) / e.length
481
- }), E = (e) => {
481
+ }), D = (e) => {
482
482
  let t = e.map(({ enemy: e }) => e?.dungeonScore).filter((e) => typeof e == "number");
483
483
  return t.length > 0 ? t.reduce((e, t) => e + t, 0) : null;
484
- }, D = (e, t) => {
485
- let n = C(t);
484
+ }, O = (e, t) => {
485
+ let n = w(t);
486
486
  return {
487
487
  id: e,
488
488
  enemies: t,
489
489
  enemyBounds: n,
490
- visualBounds: w(n),
491
- center: T(t),
492
- dungeonScore: E(t)
490
+ visualBounds: T(n),
491
+ center: E(t),
492
+ dungeonScore: D(t)
493
493
  };
494
- }, O = (e) => e !== null && Number.isFinite(e.x) && Number.isFinite(e.y) && e.x >= 0 && e.x <= 1 && e.y >= 0 && e.y <= 1, k = (e, t, n) => {
494
+ }, k = (e) => e !== null && Number.isFinite(e.x) && Number.isFinite(e.y) && e.x >= 0 && e.x <= 1 && e.y >= 0 && e.y <= 1, A = (e, t, n) => {
495
495
  let r = [], i = /* @__PURE__ */ new Map();
496
496
  return e.dungeon.enemies.forEach((a, o) => {
497
497
  if (a.mapImageId !== t.id) return;
498
- if (!O(a.mapPosition)) {
498
+ if (!k(a.mapPosition)) {
499
499
  r.push({
500
500
  code: "invalid-map-position",
501
501
  message: `Skipped ${a.id}: its map position is missing or outside the map.`,
@@ -511,7 +511,7 @@ var g = (e = {}) => {
511
511
  placementIndex: o,
512
512
  enemyId: a.id
513
513
  });
514
- let c = s ? h(s.images, {
514
+ let c = s ? g(s.images, {
515
515
  type: "enemy",
516
516
  size: "200"
517
517
  }) : null, l = null;
@@ -545,13 +545,13 @@ var g = (e = {}) => {
545
545
  }), {
546
546
  dungeon: e.dungeon,
547
547
  mapImage: t,
548
- groups: [...i.values()].map(({ id: e, enemies: t }) => D(e, t)),
548
+ groups: [...i.values()].map(({ id: e, enemies: t }) => O(e, t)),
549
549
  warnings: r
550
550
  };
551
- }, A = (e, t) => {
551
+ }, j = (e, t) => {
552
552
  let n = (e.id.split(":").at(-1) ?? e.id).replace(/^T_(?:Map_)?/i, "").replace(/^map[-_]/i, "").replaceAll(/[_-]+/g, " ").replace(/([a-z\d])([A-Z])/g, "$1 $2").trim(), r = t.id.split(".").at(-1)?.toLowerCase();
553
553
  return (n.split(/\s+/).filter((e) => e.toLowerCase() !== r).join(" ") || n || "Map").replace(/\b[a-z]/g, (e) => e.toUpperCase());
554
- }, j = (e, t, n) => Math.min(n, Math.max(t, e)), M = class {
554
+ }, M = (e, t, n) => Math.min(n, Math.max(t, e)), N = class {
555
555
  constructor() {
556
556
  this.#e = 0, this.#t = 0, this.#n = 0, this.#r = 0, this.#i = 1, this.#a = 0, this.#o = 0, this.maxZoom = 8;
557
557
  }
@@ -585,26 +585,26 @@ var g = (e = {}) => {
585
585
  }
586
586
  zoomAt(e, t = this.#e / 2, n = this.#t / 2) {
587
587
  let r = this.scale, i = (t - this.#a) / r, a = (n - this.#o) / r;
588
- return this.#i = j(this.#i * e, 1, Math.max(1, this.maxZoom)), this.#a = t - i * this.scale, this.#o = n - a * this.scale, this.#s(), this.state;
588
+ return this.#i = M(this.#i * e, 1, Math.max(1, this.maxZoom)), this.#a = t - i * this.scale, this.#o = n - a * this.scale, this.#s(), this.state;
589
589
  }
590
590
  panBy(e, t) {
591
591
  return this.#a += e, this.#o += t, this.#s(), this.state;
592
592
  }
593
593
  #s() {
594
594
  let e = this.#n * this.scale, t = this.#r * this.scale;
595
- this.#a = e <= this.#e ? (this.#e - e) / 2 : j(this.#a, this.#e - e, 0), this.#o = t <= this.#t ? (this.#t - t) / 2 : j(this.#o, this.#t - t, 0);
595
+ this.#a = e <= this.#e ? (this.#e - e) / 2 : M(this.#a, this.#e - e, 0), this.#o = t <= this.#t ? (this.#t - t) / 2 : M(this.#o, this.#t - t, 0);
596
596
  }
597
- }, N = {
597
+ }, P = {
598
598
  bubbles: !0,
599
599
  composed: !0
600
- }, P = class extends a {
600
+ }, F = class extends o {
601
601
  constructor(...e) {
602
602
  super(...e), this.dungeonId = "", this.mapImageId = null, this.assetBaseUrl = null, this.dataSource = null, this.renderEnemy = null, this.renderGroup = null, this.mapLabelFormatter = null, this.showControls = !0, this.showMapSelector = !0, this.maxZoom = 8, this.externalOverlay = !1, this._status = "empty", this._error = null, this._data = null, this._model = null, this._selectedMap = null, this._viewportState = {
603
603
  zoom: 1,
604
604
  scale: 1,
605
605
  x: 0,
606
606
  y: 0
607
- }, this._isPanning = !1, this._enemyRenderContent = /* @__PURE__ */ new Map(), this._groupRenderContent = /* @__PURE__ */ new Map(), this._mapLabels = /* @__PURE__ */ new Map(), this.#e = null, this.#t = null, this.#n = 0, this.#r = 0, this.#i = null, this.#a = new M(), this.#o = /* @__PURE__ */ new Map(), this.#s = null, this.#c = 0, this.#l = null, this.#u = /* @__PURE__ */ new Set(), this.#d = [], this.#j = (e) => {
607
+ }, this._isPanning = !1, this._enemyRenderContent = /* @__PURE__ */ new Map(), this._groupRenderContent = /* @__PURE__ */ new Map(), this._mapLabels = /* @__PURE__ */ new Map(), this.#e = null, this.#t = null, this.#n = 0, this.#r = 0, this.#i = null, this.#a = new N(), this.#o = /* @__PURE__ */ new Map(), this.#s = null, this.#c = 0, this.#l = null, this.#u = /* @__PURE__ */ new Set(), this.#d = [], this.#j = (e) => {
608
608
  if (![
609
609
  "ArrowLeft",
610
610
  "ArrowRight",
@@ -677,7 +677,7 @@ var g = (e = {}) => {
677
677
  };
678
678
  }
679
679
  static {
680
- this.styles = [n, _];
680
+ this.styles = [r, v];
681
681
  }
682
682
  #e;
683
683
  #t;
@@ -692,7 +692,7 @@ var g = (e = {}) => {
692
692
  #u;
693
693
  #d;
694
694
  connectedCallback() {
695
- super.connectedCallback(), t(this.ownerDocument), this.#i ??= new ResizeObserver(() => this.#R());
695
+ super.connectedCallback(), n(this.ownerDocument), this.#i ??= new ResizeObserver(() => this.#R());
696
696
  }
697
697
  disconnectedCallback() {
698
698
  this.#t?.abort(), this.#i?.disconnect(), super.disconnectedCallback();
@@ -738,7 +738,7 @@ var g = (e = {}) => {
738
738
  transform: `translate3d(${t.x}px, ${t.y}px, 0) scale(${t.scale})`,
739
739
  "--fellowship-map-inverse-scale": String(1 / t.scale)
740
740
  } : {};
741
- return s`
741
+ return c`
742
742
  <section class="viewer" aria-label=${this.#f}>
743
743
  <div
744
744
  class="viewport"
@@ -755,13 +755,13 @@ var g = (e = {}) => {
755
755
  @pointerup=${this.#I}
756
756
  @pointercancel=${this.#I}
757
757
  >
758
- ${e ? s`
758
+ ${e ? c`
759
759
  <div
760
760
  class="stage"
761
761
  id="map-stage"
762
- role=${n === c ? c : "tabpanel"}
762
+ role=${n === l ? l : "tabpanel"}
763
763
  aria-labelledby=${n}
764
- style=${m(r)}
764
+ style=${h(r)}
765
765
  >
766
766
  <canvas
767
767
  class="map-canvas"
@@ -772,12 +772,12 @@ var g = (e = {}) => {
772
772
  .height=${e.mapImage.height}
773
773
  ></canvas>
774
774
  <div class="overlay" part="overlay">
775
- ${this.externalOverlay ? s`<slot name="overlay"></slot>` : this.#b(e)}
775
+ ${this.externalOverlay ? c`<slot name="overlay"></slot>` : this.#b(e)}
776
776
  </div>
777
777
  </div>
778
778
  ${this.#E(e)} ${this.#D()}
779
- ${e.groups.length === 0 && this._status === "ready" ? s`<div class="empty-badge">No enemy placements on this map</div>` : c}
780
- ` : c}
779
+ ${e.groups.length === 0 && this._status === "ready" ? c`<div class="empty-badge">No enemy placements on this map</div>` : l}
780
+ ` : l}
781
781
  ${this.#O()}
782
782
  <p class="visually-hidden" id="map-instructions">
783
783
  Drag to pan. Use the mouse wheel, plus and minus keys, or zoom controls to zoom. Press
@@ -791,9 +791,9 @@ var g = (e = {}) => {
791
791
  return this._data ? `${this._data.dungeon.name ?? this._data.dungeon.id} dungeon map` : "Fellowship dungeon map";
792
792
  }
793
793
  get #p() {
794
- if (!this.showMapSelector || !this._model || this._model.dungeon.mapImages.length <= 1 || !this._selectedMap) return c;
794
+ if (!this.showMapSelector || !this._model || this._model.dungeon.mapImages.length <= 1 || !this._selectedMap) return l;
795
795
  let e = this._model.dungeon.mapImages.findIndex((e) => e.id === this._selectedMap?.id);
796
- return e >= 0 ? `map-tab-${e}` : c;
796
+ return e >= 0 ? `map-tab-${e}` : l;
797
797
  }
798
798
  async #m() {
799
799
  let t = this.dungeonId.trim(), n = ++this.#n;
@@ -802,13 +802,12 @@ var g = (e = {}) => {
802
802
  return;
803
803
  }
804
804
  this._status = "loading";
805
- let r = this.dataSource ?? g(this.assetBaseUrl ? { assetBaseUrl: this.assetBaseUrl } : {});
805
+ let r = this.dataSource ?? _(this.assetBaseUrl ? { assetBaseUrl: this.assetBaseUrl } : {});
806
806
  this.#e = r;
807
807
  try {
808
808
  let i = await r.loadDungeon(t, this.#t.signal);
809
809
  if (n !== this.#n || this.#t.signal.aborted) return;
810
- if (i.manifest.schemaVersion !== 1) throw new e("unsupported-schema", `Unsupported fellowship-data schema version: ${String(i.manifest.schemaVersion)}.`);
811
- this._data = i, await this.#h(!0);
810
+ e(i.manifest.schemaVersion), this._data = i, await this.#h(!0);
812
811
  } catch (e) {
813
812
  if (n !== this.#n || this.#t.signal.aborted) return;
814
813
  this.#_(e);
@@ -825,20 +824,20 @@ var g = (e = {}) => {
825
824
  });
826
825
  return;
827
826
  }
828
- let i = ++this.#r, a = k(t, r, n);
827
+ let i = ++this.#r, a = A(t, r, n);
829
828
  this._model = a, this._selectedMap = r, this._status = "loading", this._error = null, await this.updateComplete;
830
829
  let o = this._viewportElement;
831
830
  o && (this.#a.maxZoom = Math.max(1, this.maxZoom), this.#a.setDimensions(o.clientWidth, o.clientHeight, r.width, r.height), e && this.#a.fit(), this._viewportState = this.#a.state, await this.updateComplete);
832
831
  try {
833
832
  if (await this.#g(r, n, i), i !== this.#r) return;
834
833
  this._status = "ready", this.dispatchEvent(new CustomEvent("fellowship-map-ready", {
835
- ...N,
834
+ ...P,
836
835
  detail: {
837
836
  model: a,
838
837
  data: t
839
838
  }
840
839
  })), a.warnings.length > 0 && this.dispatchEvent(new CustomEvent("fellowship-map-warning", {
841
- ...N,
840
+ ...P,
842
841
  detail: {
843
842
  warnings: a.warnings,
844
843
  model: a
@@ -859,17 +858,17 @@ var g = (e = {}) => {
859
858
  if (!i || !a) throw Error("A 2D canvas context is unavailable.");
860
859
  a.clearRect(0, 0, i.width, i.height), a.drawImage(r, 0, 0, e.width, e.height);
861
860
  }
862
- #_(t) {
863
- let n = typeof t == "object" && t && "code" in t && "message" in t ? {
864
- code: String(t.code),
865
- message: String(t.message),
866
- ...t instanceof e && t.cause !== void 0 ? { cause: t.cause } : {}
861
+ #_(e) {
862
+ let n = typeof e == "object" && e && "code" in e && "message" in e ? {
863
+ code: String(e.code),
864
+ message: String(e.message),
865
+ ...e instanceof t && e.cause !== void 0 ? { cause: e.cause } : {}
867
866
  } : {
868
867
  code: "unknown",
869
- message: t instanceof Error ? t.message : String(t)
868
+ message: e instanceof Error ? e.message : String(e)
870
869
  };
871
870
  this._error = n, this._status = "error", this.dispatchEvent(new CustomEvent("fellowship-map-error", {
872
- ...N,
871
+ ...P,
873
872
  detail: n
874
873
  }));
875
874
  }
@@ -907,14 +906,14 @@ var g = (e = {}) => {
907
906
  #y() {
908
907
  let e = /* @__PURE__ */ new Map(), t = this._data?.dungeon;
909
908
  if (t) for (let n of t.mapImages) try {
910
- e.set(n.id, this.mapLabelFormatter?.(n, t) ?? A(n, t));
909
+ e.set(n.id, this.mapLabelFormatter?.(n, t) ?? j(n, t));
911
910
  } catch (r) {
912
- this.#B(`map-label:${n.id}`, "map-label-formatter-error", r), e.set(n.id, A(n, t));
911
+ this.#B(`map-label:${n.id}`, "map-label-formatter-error", r), e.set(n.id, j(n, t));
913
912
  }
914
913
  this._mapLabels = e;
915
914
  }
916
915
  #b(e) {
917
- return p(e.groups, (t) => this.#x(e, t), (t) => this.#S(e, t));
916
+ return m(e.groups, (t) => this.#x(e, t), (t) => this.#S(e, t));
918
917
  }
919
918
  #x(e, t) {
920
919
  return `${e.mapImage.id}:${String(t.id)}:${t.enemies[0]?.instanceId ?? "empty"}`;
@@ -925,15 +924,15 @@ var g = (e = {}) => {
925
924
  top: `${n.y * 100}%`,
926
925
  width: `${n.width * 100}%`,
927
926
  height: `${n.height * 100}%`
928
- }, i = this.#x(e, t), a = this.renderGroup && this._groupRenderContent.has(i) ? this._groupRenderContent.get(i) ?? c : this.#C(t);
929
- return s` <div class="group-anchor" part="group" style=${m(r)}>${a}</div> `;
927
+ }, i = this.#x(e, t), a = this.renderGroup && this._groupRenderContent.has(i) ? this._groupRenderContent.get(i) ?? l : this.#C(t);
928
+ return c` <div class="group-anchor" part="group" style=${h(r)}>${a}</div> `;
930
929
  }
931
930
  #C(e) {
932
- return s`
931
+ return c`
933
932
  <div class="default-group">
934
933
  <div class="group-ring" aria-hidden="true"></div>
935
934
  <span class="group-label">${`G${e.id ?? "–"}${e.dungeonScore === null ? "" : ` · ${e.dungeonScore}`}`}</span>
936
- ${p(e.enemies, (e) => e.instanceId, (t) => this.#w(e, t))}
935
+ ${m(e.enemies, (e) => e.instanceId, (t) => this.#w(e, t))}
937
936
  </div>
938
937
  `;
939
938
  }
@@ -941,12 +940,12 @@ var g = (e = {}) => {
941
940
  let n = e.visualBounds, r = {
942
941
  left: `${(t.position.x - n.x) / n.width * 100}%`,
943
942
  top: `${(t.position.y - n.y) / n.height * 100}%`
944
- }, i = this.renderEnemy && this._enemyRenderContent.has(t.instanceId) ? this._enemyRenderContent.get(t.instanceId) ?? c : this.#T(t), a = t.enemy?.name ?? t.placement.id;
945
- return s`
943
+ }, i = this.renderEnemy && this._enemyRenderContent.has(t.instanceId) ? this._enemyRenderContent.get(t.instanceId) ?? l : this.#T(t), a = t.enemy?.name ?? t.placement.id;
944
+ return c`
946
945
  <div
947
946
  class="enemy-anchor"
948
947
  part="enemy"
949
- style=${m(r)}
948
+ style=${h(r)}
950
949
  role="img"
951
950
  aria-label=${a}
952
951
  title=${a}
@@ -957,17 +956,17 @@ var g = (e = {}) => {
957
956
  }
958
957
  #T(e) {
959
958
  let t = (e.enemy?.name ?? e.placement.id).split(/\s+/).map((e) => e[0]).join("").slice(0, 2).toUpperCase();
960
- return s`
959
+ return c`
961
960
  <span class="enemy-marker" data-boss=${String(e.enemy?.isBoss === !0)}>
962
- ${e.imageUrl ? s`<img class="enemy-image" src=${e.imageUrl} alt="" draggable="false" />` : t}
961
+ ${e.imageUrl ? c`<img class="enemy-image" src=${e.imageUrl} alt="" draggable="false" />` : t}
963
962
  </span>
964
963
  `;
965
964
  }
966
965
  #E(e) {
967
966
  let t = e.dungeon.mapImages;
968
- return !this.showMapSelector || t.length <= 1 ? c : s`
967
+ return !this.showMapSelector || t.length <= 1 ? l : c`
969
968
  <div class="map-selector" part="map-selector" role="tablist" aria-label="Dungeon maps">
970
- ${p(t, (e) => e.id, (e, t) => s`
969
+ ${m(t, (e) => e.id, (e, t) => c`
971
970
  <button
972
971
  class="map-selector-button"
973
972
  id=${`map-tab-${t}`}
@@ -988,7 +987,7 @@ var g = (e = {}) => {
988
987
  `;
989
988
  }
990
989
  #D() {
991
- return !this.showControls || !this._model ? c : s`
990
+ return !this.showControls || !this._model ? l : c`
992
991
  <div class="controls" part="controls" role="group" aria-label="Map zoom controls">
993
992
  <button
994
993
  class="control-button"
@@ -1024,15 +1023,15 @@ var g = (e = {}) => {
1024
1023
  `;
1025
1024
  }
1026
1025
  #O() {
1027
- if (this._status === "ready") return c;
1026
+ if (this._status === "ready") return l;
1028
1027
  let e = this._status === "loading", t = this._status === "empty", n = e ? "Charting dungeon" : t ? "Choose a dungeon" : "Map unavailable", r = e ? "Loading Fellowship data and preparing the tactical layer." : t ? "Set the dungeon-id attribute or dungeonId property to render a map." : this._error?.message ?? "An unexpected map error occurred.";
1029
- return s`
1028
+ return c`
1030
1029
  <div class="status" part="status" role=${this._status === "error" ? "alert" : "status"}>
1031
1030
  <div class="status-card">
1032
1031
  <div class="status-mark" aria-hidden="true"><span>${e ? "…" : "✦"}</span></div>
1033
1032
  <p class="status-title">${n}</p>
1034
1033
  <p class="status-copy">${r}</p>
1035
- ${this._status === "error" ? s`<button class="retry-button" type="button" @click=${this.retry}>Retry</button>` : c}
1034
+ ${this._status === "error" ? c`<button class="retry-button" type="button" @click=${this.retry}>Retry</button>` : l}
1036
1035
  </div>
1037
1036
  </div>
1038
1037
  `;
@@ -1042,7 +1041,7 @@ var g = (e = {}) => {
1042
1041
  }
1043
1042
  #A(e) {
1044
1043
  e.id !== this._selectedMap?.id && (this.mapImageId = e.id, this.dispatchEvent(new CustomEvent("fellowship-map-image-change", {
1045
- ...N,
1044
+ ...P,
1046
1045
  detail: {
1047
1046
  mapImageId: e.id,
1048
1047
  mapImage: e
@@ -1064,7 +1063,7 @@ var g = (e = {}) => {
1064
1063
  }
1065
1064
  #z(e) {
1066
1065
  this._viewportState = this.#a.state, this.dispatchEvent(new CustomEvent("fellowship-map-viewport-change", {
1067
- ...N,
1066
+ ...P,
1068
1067
  detail: {
1069
1068
  viewport: this.#a.state,
1070
1069
  source: e
@@ -1083,37 +1082,35 @@ var g = (e = {}) => {
1083
1082
  let e = this.#d;
1084
1083
  this.#d = [];
1085
1084
  for (let t of e) this.dispatchEvent(new CustomEvent("fellowship-map-error", {
1086
- ...N,
1085
+ ...P,
1087
1086
  detail: t
1088
1087
  }));
1089
1088
  }
1090
1089
  };
1091
- r([u({
1090
+ i([d({
1092
1091
  type: String,
1093
1092
  attribute: "dungeon-id"
1094
- })], P.prototype, "dungeonId", void 0), r([u({
1093
+ })], F.prototype, "dungeonId", void 0), i([d({
1095
1094
  type: String,
1096
1095
  attribute: "map-image-id"
1097
- })], P.prototype, "mapImageId", void 0), r([u({
1096
+ })], F.prototype, "mapImageId", void 0), i([d({
1098
1097
  type: String,
1099
1098
  attribute: "asset-base-url"
1100
- })], P.prototype, "assetBaseUrl", void 0), r([u({ attribute: !1 })], P.prototype, "dataSource", void 0), r([u({ attribute: !1 })], P.prototype, "renderEnemy", void 0), r([u({ attribute: !1 })], P.prototype, "renderGroup", void 0), r([u({ attribute: !1 })], P.prototype, "mapLabelFormatter", void 0), r([u({
1099
+ })], F.prototype, "assetBaseUrl", void 0), i([d({ attribute: !1 })], F.prototype, "dataSource", void 0), i([d({ attribute: !1 })], F.prototype, "renderEnemy", void 0), i([d({ attribute: !1 })], F.prototype, "renderGroup", void 0), i([d({ attribute: !1 })], F.prototype, "mapLabelFormatter", void 0), i([d({
1101
1100
  type: Boolean,
1102
1101
  attribute: "show-controls"
1103
- })], P.prototype, "showControls", void 0), r([u({
1102
+ })], F.prototype, "showControls", void 0), i([d({
1104
1103
  type: Boolean,
1105
1104
  attribute: "show-map-selector"
1106
- })], P.prototype, "showMapSelector", void 0), r([u({
1105
+ })], F.prototype, "showMapSelector", void 0), i([d({
1107
1106
  type: Number,
1108
1107
  attribute: "max-zoom"
1109
- })], P.prototype, "maxZoom", void 0), r([u({
1108
+ })], F.prototype, "maxZoom", void 0), i([d({
1110
1109
  type: Boolean,
1111
1110
  attribute: !1
1112
- })], P.prototype, "externalOverlay", void 0), r([f()], P.prototype, "_status", void 0), r([f()], P.prototype, "_error", void 0), r([f()], P.prototype, "_data", void 0), r([f()], P.prototype, "_model", void 0), r([f()], P.prototype, "_selectedMap", void 0), r([f()], P.prototype, "_viewportState", void 0), r([f()], P.prototype, "_isPanning", void 0), r([f()], P.prototype, "_enemyRenderContent", void 0), r([f()], P.prototype, "_groupRenderContent", void 0), r([f()], P.prototype, "_mapLabels", void 0), r([d(".viewport")], P.prototype, "_viewportElement", void 0), r([d("canvas")], P.prototype, "_canvasElement", void 0), P = r([l("fellowship-dungeon-map")], P);
1113
- var F = () => {
1114
- globalThis.customElements !== void 0 && !globalThis.customElements.get("fellowship-dungeon-map") && globalThis.customElements.define("fellowship-dungeon-map", P);
1111
+ })], F.prototype, "externalOverlay", void 0), i([p()], F.prototype, "_status", void 0), i([p()], F.prototype, "_error", void 0), i([p()], F.prototype, "_data", void 0), i([p()], F.prototype, "_model", void 0), i([p()], F.prototype, "_selectedMap", void 0), i([p()], F.prototype, "_viewportState", void 0), i([p()], F.prototype, "_isPanning", void 0), i([p()], F.prototype, "_enemyRenderContent", void 0), i([p()], F.prototype, "_groupRenderContent", void 0), i([p()], F.prototype, "_mapLabels", void 0), i([f(".viewport")], F.prototype, "_viewportElement", void 0), i([f("canvas")], F.prototype, "_canvasElement", void 0), F = i([u("fellowship-dungeon-map")], F);
1112
+ var I = () => {
1113
+ globalThis.customElements !== void 0 && !globalThis.customElements.get("fellowship-dungeon-map") && globalThis.customElements.define("fellowship-dungeon-map", F);
1115
1114
  };
1116
1115
  //#endregion
1117
- export { A as a, k as i, F as n, g as o, M as r, P as t };
1118
-
1119
- //# sourceMappingURL=dungeon-map-xFaPasVr.js.map
1116
+ export { j as a, A as i, I as n, _ as o, N as r, F as t };