@crockery/fellowship-components 0.4.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 (107) hide show
  1. package/README.md +12 -12
  2. package/RELEASING.md +15 -14
  3. package/dist/chunks/data-source-XbksqUrw.js +0 -2
  4. package/dist/chunks/decorate-B_ZTN9li.js +0 -2
  5. package/dist/chunks/dungeon-cast-browser-CSnu3gC5.js +0 -2
  6. package/dist/chunks/dungeon-map-CutIcCVP.js +0 -2
  7. package/dist/chunks/talent-calculator-Dxuc2dZ8.js +0 -2
  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 +0 -1
  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 +0 -2
  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 +0 -2
  29. package/dist/index.d.ts +0 -1
  30. package/dist/react/dungeon-cast-browser.d.ts +0 -1
  31. package/dist/react/dungeon-cast-browser.js +0 -2
  32. package/dist/react/dungeon-map.d.ts +0 -1
  33. package/dist/react/dungeon-map.js +0 -2
  34. package/dist/react/index.d.ts +0 -1
  35. package/dist/react/talent-calculator.d.ts +0 -1
  36. package/dist/react/talent-calculator.js +0 -2
  37. package/dist/react/tooltip.d.ts +0 -1
  38. package/dist/react/tooltip.js +0 -2
  39. package/dist/styles/field-manual-fonts.d.ts +0 -1
  40. package/dist/styles/field-manual.styles.d.ts +0 -1
  41. package/dist/talent-calculator/index.d.ts +0 -1
  42. package/dist/talent-calculator/render-model.d.ts +0 -1
  43. package/dist/talent-calculator/selection-state.d.ts +0 -1
  44. package/dist/talent-calculator/talent-calculator.d.ts +0 -1
  45. package/dist/talent-calculator/talent-calculator.styles.d.ts +0 -1
  46. package/dist/talent-calculator/types.d.ts +0 -1
  47. package/dist/talent-calculator.js +0 -2
  48. package/dist/tooltip/index.d.ts +0 -1
  49. package/dist/tooltip/positioning.d.ts +0 -1
  50. package/dist/tooltip/rich-text.d.ts +0 -1
  51. package/dist/tooltip/tooltip.d.ts +0 -1
  52. package/dist/tooltip/tooltip.styles.d.ts +0 -1
  53. package/dist/tooltip/types.d.ts +0 -1
  54. package/dist/tooltip.js +0 -2
  55. package/package.json +8 -15
  56. package/dist/chunks/data-source-XbksqUrw.js.map +0 -1
  57. package/dist/chunks/decorate-B_ZTN9li.js.map +0 -1
  58. package/dist/chunks/dungeon-cast-browser-CSnu3gC5.js.map +0 -1
  59. package/dist/chunks/dungeon-map-CutIcCVP.js.map +0 -1
  60. package/dist/chunks/talent-calculator-Dxuc2dZ8.js.map +0 -1
  61. package/dist/chunks/tooltip-DoQVSnOn.js.map +0 -1
  62. package/dist/data/cast-data-source.d.ts.map +0 -1
  63. package/dist/data/data-source.d.ts.map +0 -1
  64. package/dist/data/package-cast-data-source.d.ts.map +0 -1
  65. package/dist/data/package-data-source.d.ts.map +0 -1
  66. package/dist/data/package-talent-data-source.d.ts.map +0 -1
  67. package/dist/data/talent-data-source.d.ts.map +0 -1
  68. package/dist/dungeon-cast-browser/dungeon-cast-browser.d.ts.map +0 -1
  69. package/dist/dungeon-cast-browser/dungeon-cast-browser.styles.d.ts.map +0 -1
  70. package/dist/dungeon-cast-browser/index.d.ts.map +0 -1
  71. package/dist/dungeon-cast-browser/render-model.d.ts.map +0 -1
  72. package/dist/dungeon-cast-browser/types.d.ts.map +0 -1
  73. package/dist/dungeon-cast-browser.js.map +0 -1
  74. package/dist/dungeon-map/dungeon-map.d.ts.map +0 -1
  75. package/dist/dungeon-map/dungeon-map.styles.d.ts.map +0 -1
  76. package/dist/dungeon-map/index.d.ts.map +0 -1
  77. package/dist/dungeon-map/layout.d.ts.map +0 -1
  78. package/dist/dungeon-map/render-model.d.ts.map +0 -1
  79. package/dist/dungeon-map/types.d.ts.map +0 -1
  80. package/dist/dungeon-map/viewport-controller.d.ts.map +0 -1
  81. package/dist/dungeon-map.js.map +0 -1
  82. package/dist/index.d.ts.map +0 -1
  83. package/dist/react/dungeon-cast-browser.d.ts.map +0 -1
  84. package/dist/react/dungeon-cast-browser.js.map +0 -1
  85. package/dist/react/dungeon-map.d.ts.map +0 -1
  86. package/dist/react/dungeon-map.js.map +0 -1
  87. package/dist/react/index.d.ts.map +0 -1
  88. package/dist/react/talent-calculator.d.ts.map +0 -1
  89. package/dist/react/talent-calculator.js.map +0 -1
  90. package/dist/react/tooltip.d.ts.map +0 -1
  91. package/dist/react/tooltip.js.map +0 -1
  92. package/dist/styles/field-manual-fonts.d.ts.map +0 -1
  93. package/dist/styles/field-manual.styles.d.ts.map +0 -1
  94. package/dist/talent-calculator/index.d.ts.map +0 -1
  95. package/dist/talent-calculator/render-model.d.ts.map +0 -1
  96. package/dist/talent-calculator/selection-state.d.ts.map +0 -1
  97. package/dist/talent-calculator/talent-calculator.d.ts.map +0 -1
  98. package/dist/talent-calculator/talent-calculator.styles.d.ts.map +0 -1
  99. package/dist/talent-calculator/types.d.ts.map +0 -1
  100. package/dist/talent-calculator.js.map +0 -1
  101. package/dist/tooltip/index.d.ts.map +0 -1
  102. package/dist/tooltip/positioning.d.ts.map +0 -1
  103. package/dist/tooltip/rich-text.d.ts.map +0 -1
  104. package/dist/tooltip/tooltip.d.ts.map +0 -1
  105. package/dist/tooltip/tooltip.styles.d.ts.map +0 -1
  106. package/dist/tooltip/types.d.ts.map +0 -1
  107. package/dist/tooltip.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"dungeon-map-CutIcCVP.js","names":["#zoom","#x","#y","#viewportWidth","#viewportHeight","#mapWidth","#mapHeight","#clampPan","#selectMap","#viewport","#commitViewport","#isInteractiveEvent","#pointers","#lastPointer","#lastPinchDistance","#lastPinchCenter","#resizeObserver","#handleResize","#abortController","#flushRendererErrors","#loadDungeon","#prepareSelectedMap","#rendererFailures","#prepareRendererContent","#prepareMapLabels","#selectedMapTabId","#viewerLabel","#handleWheel","#handleViewportKeydown","#handlePointerDown","#handlePointerMove","#handlePointerEnd","#mapLabel","#renderGroups","#renderMapSelector","#renderControls","#renderStatus","#loadToken","#renderToken","#activeSource","#setError","#drawMap","#queueRendererError","#renderEnemyAnchor","#groupKey","#renderGroup","#renderDefaultGroup","#renderDefaultEnemy","#handleMapSelectorKeydown","#pendingRendererErrors"],"sources":["../../src/data/package-data-source.ts","../../src/dungeon-map/dungeon-map.styles.ts","../../src/dungeon-map/layout.ts","../../src/dungeon-map/render-model.ts","../../src/dungeon-map/viewport-controller.ts","../../src/dungeon-map/dungeon-map.ts"],"sourcesContent":["import { createPackageFellowshipDataClient } from \"@crockery/fellowship-data/client\";\n\nimport type { FellowshipDataSource } from \"./data-source.js\";\n\n/** @deprecated Create a package Fellowship data client instead. */\nexport interface PackageFellowshipDataSourceOptions {\n readonly assetBaseUrl?: string;\n}\n\n/** @deprecated Use `createPackageFellowshipDataClient` from `@crockery/fellowship-data/client`. */\nexport const createPackageFellowshipDataSource = (\n options: PackageFellowshipDataSourceOptions = {},\n): FellowshipDataSource => {\n const client = createPackageFellowshipDataClient(options);\n return {\n loadDungeon: (dungeonId, signal) => client.loadDungeon(dungeonId, signal),\n resolveAssetUrl: (asset) => client.resolveAssetUrl(asset),\n };\n};\n","import { css } from \"lit\";\n\nexport const dungeonMapStyles = css`\n :host {\n --fellowship-map-soot: var(--_fellowship-field-canvas);\n --fellowship-map-ink: var(--_fellowship-field-ink);\n --fellowship-map-muted-ink: var(--_fellowship-field-muted);\n --fellowship-map-border: var(--_fellowship-field-border);\n --fellowship-map-focus: var(--_fellowship-field-focus);\n --fellowship-map-rune: var(--_fellowship-field-accent);\n --fellowship-map-ember: var(--_fellowship-field-ember);\n --fellowship-map-control-surface: color-mix(\n in srgb,\n var(--_fellowship-field-surface-raised) 92%,\n transparent\n );\n --fellowship-map-enemy-size: 32px;\n --fellowship-map-radius: var(--_fellowship-field-radius);\n --fellowship-map-font-family: var(--_fellowship-field-font-family);\n --fellowship-map-tactical-font-family: var(--_fellowship-field-mono-font-family);\n\n display: block;\n inline-size: 100%;\n min-block-size: 240px;\n aspect-ratio: 2 / 1;\n container-type: inline-size;\n color: var(--fellowship-map-ink);\n font-family: var(--fellowship-map-font-family);\n -webkit-font-smoothing: antialiased;\n }\n\n :host([hidden]) {\n display: none;\n }\n\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n .viewer,\n .viewport {\n inline-size: 100%;\n block-size: 100%;\n min-block-size: inherit;\n }\n\n .viewer {\n position: relative;\n overflow: hidden;\n border: 1px solid var(--fellowship-map-border);\n border-radius: calc(var(--fellowship-map-radius) + 2px);\n background: var(--fellowship-map-soot);\n }\n\n .viewport {\n position: relative;\n overflow: hidden;\n outline: none;\n cursor: grab;\n touch-action: none;\n }\n\n .viewport[data-panning=\"true\"] {\n cursor: grabbing;\n }\n\n .viewport:focus-visible {\n box-shadow: inset 0 0 0 2px var(--fellowship-map-focus);\n }\n\n .stage {\n position: absolute;\n inset: 0 auto auto 0;\n transform-origin: 0 0;\n will-change: transform;\n }\n\n .map-canvas,\n .overlay {\n position: absolute;\n inset: 0;\n inline-size: 100%;\n block-size: 100%;\n }\n\n .map-canvas {\n display: block;\n background: #d5ceb1;\n box-shadow: inset 0 0 0 1px rgb(0 0 0 / 10%);\n }\n\n .overlay {\n pointer-events: none;\n }\n\n .group-anchor {\n position: absolute;\n pointer-events: none;\n }\n\n .default-group,\n .custom-group-host {\n position: absolute;\n inset: 0;\n }\n\n .group-ring {\n position: absolute;\n inset: 0;\n border: calc(1px * var(--fellowship-map-inverse-scale, 1)) solid transparent;\n border-radius: 50%;\n background: transparent;\n transition:\n border-color 140ms cubic-bezier(0.23, 1, 0.32, 1),\n background-color 140ms cubic-bezier(0.23, 1, 0.32, 1);\n }\n\n .group-anchor:has(.enemy-anchor:hover) .group-ring,\n .group-anchor:focus-within .group-ring {\n border-color: var(--fellowship-map-rune);\n background: color-mix(in srgb, var(--fellowship-map-rune) 8%, transparent);\n }\n\n .group-label {\n position: absolute;\n inset: 0 auto auto 50%;\n z-index: 1;\n display: inline-flex;\n align-items: center;\n min-block-size: 22px;\n padding: 0 8px 0 12px;\n border-radius: 4px;\n background: var(--fellowship-map-control-surface);\n color: var(--fellowship-map-ink);\n box-shadow: inset 0 0 0 1px var(--fellowship-map-border);\n font-family: var(--fellowship-map-tactical-font-family);\n font-size: 10px;\n font-weight: 600;\n font-variant-numeric: tabular-nums;\n letter-spacing: 0.04em;\n line-height: 1;\n white-space: nowrap;\n transform: translate(-50%, -45%) scale(var(--fellowship-map-inverse-scale, 1));\n transform-origin: center;\n }\n\n .group-label::before {\n position: absolute;\n inset: 5px auto 5px 0;\n width: 2px;\n background: var(--fellowship-map-rune);\n content: \"\";\n }\n\n .enemy-anchor {\n position: absolute;\n z-index: 2;\n inline-size: 0;\n block-size: 0;\n pointer-events: auto;\n }\n\n .enemy-visual {\n position: absolute;\n inset: 0 auto auto 0;\n transform: translate(-50%, -50%) scale(var(--fellowship-map-inverse-scale, 1));\n transform-origin: center;\n }\n\n .enemy-marker {\n position: relative;\n display: grid;\n inline-size: var(--fellowship-map-enemy-size);\n block-size: var(--fellowship-map-enemy-size);\n place-items: center;\n overflow: hidden;\n border: 2px solid var(--fellowship-map-rune);\n border-radius: 50%;\n background: var(--_fellowship-field-surface-raised);\n color: var(--fellowship-map-ink);\n font-family: var(--fellowship-map-tactical-font-family);\n font-size: 10px;\n font-weight: 600;\n box-shadow: 0 0 0 1px rgb(0 0 0 / 68%);\n transition:\n border-color 140ms cubic-bezier(0.23, 1, 0.32, 1),\n transform 140ms cubic-bezier(0.23, 1, 0.32, 1);\n }\n\n .enemy-marker[data-boss=\"true\"] {\n inline-size: calc(var(--fellowship-map-enemy-size) + 4px);\n block-size: calc(var(--fellowship-map-enemy-size) + 4px);\n border-color: var(--fellowship-map-ember);\n }\n\n .enemy-anchor:hover .enemy-marker {\n transform: scale(1.08);\n }\n\n .enemy-image {\n inline-size: 100%;\n block-size: 100%;\n object-fit: cover;\n }\n\n .controls,\n .map-selector {\n position: absolute;\n z-index: 20;\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 4px;\n border-radius: calc(var(--fellowship-map-radius) + 2px);\n background: var(--fellowship-map-control-surface);\n box-shadow: inset 0 0 0 1px var(--fellowship-map-border);\n backdrop-filter: blur(12px);\n }\n\n .map-selector {\n inset: 12px auto auto 12px;\n max-inline-size: calc(100% - 172px);\n overflow-x: auto;\n scrollbar-width: none;\n }\n\n .map-selector::-webkit-scrollbar {\n display: none;\n }\n\n .controls {\n inset: 12px 12px auto auto;\n }\n\n .control-button,\n .map-selector-button {\n position: relative;\n min-inline-size: 44px;\n min-block-size: 44px;\n border: 0;\n border-radius: 4px;\n background: transparent;\n color: var(--fellowship-map-muted-ink);\n font: inherit;\n font-size: 13px;\n font-weight: 600;\n line-height: 1;\n cursor: pointer;\n transition:\n color 140ms cubic-bezier(0.23, 1, 0.32, 1),\n background-color 140ms cubic-bezier(0.23, 1, 0.32, 1),\n transform 120ms cubic-bezier(0.23, 1, 0.32, 1);\n }\n\n .control-button {\n font-family: var(--fellowship-map-tactical-font-family);\n font-size: 16px;\n font-weight: 500;\n }\n\n .map-selector-button {\n padding-inline: 12px;\n letter-spacing: 0.02em;\n white-space: nowrap;\n }\n\n .map-selector-button[aria-selected=\"true\"] {\n background: rgb(255 255 255 / 6%);\n color: var(--fellowship-map-ink);\n }\n\n .map-selector-button[aria-selected=\"true\"]::after {\n position: absolute;\n inset: auto 12px 0;\n height: 2px;\n background: var(--fellowship-map-rune);\n content: \"\";\n }\n\n .control-button:focus-visible,\n .map-selector-button:focus-visible,\n .retry-button:focus-visible {\n outline: 2px solid var(--fellowship-map-focus);\n outline-offset: 2px;\n }\n\n .control-button:active,\n .map-selector-button:active,\n .retry-button:active {\n transform: scale(0.97);\n }\n\n .status {\n position: absolute;\n z-index: 30;\n inset: 0;\n display: grid;\n padding: 24px;\n place-items: center;\n background: color-mix(in srgb, var(--fellowship-map-soot) 84%, transparent);\n text-align: center;\n }\n\n .status-card {\n display: grid;\n max-inline-size: 376px;\n gap: 8px;\n justify-items: center;\n padding: 24px;\n border-radius: calc(var(--fellowship-map-radius) + 2px);\n background: var(--fellowship-map-control-surface);\n box-shadow: inset 0 0 0 1px var(--fellowship-map-border);\n }\n\n .status-mark {\n position: relative;\n display: grid;\n inline-size: 40px;\n block-size: 24px;\n place-items: center;\n color: var(--fellowship-map-rune);\n font-family: var(--fellowship-map-tactical-font-family);\n font-size: 12px;\n }\n\n .status-mark::before,\n .status-mark::after {\n position: absolute;\n width: 8px;\n height: 1px;\n background: var(--fellowship-map-border);\n content: \"\";\n }\n\n .status-mark::before {\n left: 0;\n }\n\n .status-mark::after {\n right: 0;\n }\n\n .status-title {\n margin: 4px 0 0;\n color: var(--fellowship-map-ink);\n font-size: 18px;\n font-weight: 600;\n line-height: 24px;\n text-wrap: balance;\n }\n\n .status-copy {\n margin: 0;\n color: var(--fellowship-map-muted-ink);\n font-size: 14px;\n line-height: 1.5;\n text-wrap: pretty;\n }\n\n .retry-button {\n min-block-size: 44px;\n margin-block-start: 8px;\n padding-inline: 16px;\n border: 1px solid var(--fellowship-map-border);\n border-radius: 4px;\n background: var(--_fellowship-field-inset);\n color: var(--fellowship-map-ink);\n font: inherit;\n font-weight: 600;\n cursor: pointer;\n }\n\n .empty-badge {\n position: absolute;\n z-index: 20;\n inset: auto auto 12px 12px;\n padding: 8px;\n border-radius: 4px;\n background: var(--fellowship-map-control-surface);\n color: var(--fellowship-map-muted-ink);\n box-shadow: inset 0 0 0 1px var(--fellowship-map-border);\n font-size: 12px;\n }\n\n .visually-hidden {\n position: absolute;\n inline-size: 1px;\n block-size: 1px;\n overflow: hidden;\n clip: rect(0 0 0 0);\n clip-path: inset(50%);\n white-space: nowrap;\n }\n\n @media (hover: hover) {\n .control-button:hover,\n .map-selector-button:hover {\n background: rgb(255 255 255 / 6%);\n color: var(--fellowship-map-ink);\n }\n\n .retry-button:hover {\n border-color: color-mix(in srgb, var(--fellowship-map-rune) 48%, transparent);\n color: var(--fellowship-map-focus);\n }\n }\n\n @container (max-width: 560px) {\n .map-selector,\n .controls {\n inset-block-start: 8px;\n }\n\n .map-selector {\n inset-inline-start: 8px;\n max-inline-size: calc(100% - 164px);\n }\n\n .controls {\n inset-inline-end: 8px;\n }\n\n .map-selector-button {\n padding-inline: 8px;\n }\n\n .map-selector-button[aria-selected=\"true\"]::after {\n inset-inline: 8px;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .group-ring,\n .enemy-marker,\n .control-button,\n .map-selector-button,\n .retry-button {\n transition: none;\n }\n\n .control-button:active,\n .map-selector-button:active,\n .retry-button:active {\n transform: none;\n }\n }\n`;\n","import type { Position2D } from \"@crockery/fellowship-data\";\n\nimport type { DungeonMapEnemyModel, DungeonMapGroupModel, NormalizedRect } from \"./types.js\";\n\nconst VISUAL_PADDING_X = 0.018;\nconst VISUAL_PADDING_Y = 0.036;\nconst MIN_VISUAL_WIDTH = 0.06;\nconst MIN_VISUAL_HEIGHT = 0.12;\n\nconst clamp = (value: number, minimum: number, maximum: number): number =>\n Math.min(maximum, Math.max(minimum, value));\n\nconst calculateBounds = (enemies: readonly DungeonMapEnemyModel[]): NormalizedRect => {\n const xs = enemies.map(({ position }) => position.x);\n const ys = enemies.map(({ position }) => position.y);\n const minimumX = Math.min(...xs);\n const maximumX = Math.max(...xs);\n const minimumY = Math.min(...ys);\n const maximumY = Math.max(...ys);\n\n return {\n x: minimumX,\n y: minimumY,\n width: maximumX - minimumX,\n height: maximumY - minimumY,\n };\n};\n\nconst expandBounds = (bounds: NormalizedRect): NormalizedRect => {\n const centerX = bounds.x + bounds.width / 2;\n const centerY = bounds.y + bounds.height / 2;\n const width = Math.max(MIN_VISUAL_WIDTH, bounds.width + VISUAL_PADDING_X * 2);\n const height = Math.max(MIN_VISUAL_HEIGHT, bounds.height + VISUAL_PADDING_Y * 2);\n const x = clamp(centerX - width / 2, 0, Math.max(0, 1 - width));\n const y = clamp(centerY - height / 2, 0, Math.max(0, 1 - height));\n\n return { x, y, width: Math.min(width, 1), height: Math.min(height, 1) };\n};\n\nconst groupCenter = (enemies: readonly DungeonMapEnemyModel[]): Position2D => ({\n x: enemies.reduce((sum, enemy) => sum + enemy.position.x, 0) / enemies.length,\n y: enemies.reduce((sum, enemy) => sum + enemy.position.y, 0) / enemies.length,\n});\n\nconst groupScore = (enemies: readonly DungeonMapEnemyModel[]): number | null => {\n const scores = enemies\n .map(({ enemy }) => enemy?.dungeonScore)\n .filter((score): score is number => typeof score === \"number\");\n return scores.length > 0 ? scores.reduce((sum, score) => sum + score, 0) : null;\n};\n\nexport const createDungeonMapGroupModel = (\n id: number | null,\n enemies: readonly DungeonMapEnemyModel[],\n): DungeonMapGroupModel => {\n const enemyBounds = calculateBounds(enemies);\n return {\n id,\n enemies,\n enemyBounds,\n visualBounds: expandBounds(enemyBounds),\n center: groupCenter(enemies),\n dungeonScore: groupScore(enemies),\n };\n};\n","import { findImage } from \"@crockery/fellowship-data\";\nimport type { Dungeon, ImageAssetRef, Position2D } from \"@crockery/fellowship-data\";\n\nimport type { DungeonMapData, FellowshipDataSource } from \"../data/data-source.js\";\nimport { createDungeonMapGroupModel } from \"./layout.js\";\nimport type { DungeonMapEnemyModel, DungeonMapRenderModel, DungeonMapWarning } from \"./types.js\";\n\nexport const isValidMapPosition = (position: Position2D | null): position is Position2D =>\n position !== null &&\n Number.isFinite(position.x) &&\n Number.isFinite(position.y) &&\n position.x >= 0 &&\n position.x <= 1 &&\n position.y >= 0 &&\n position.y <= 1;\n\nexport const createDungeonMapRenderModel = (\n data: DungeonMapData,\n mapImage: ImageAssetRef,\n source: FellowshipDataSource,\n): DungeonMapRenderModel => {\n const warnings: DungeonMapWarning[] = [];\n const groups = new Map<string, { id: number | null; enemies: DungeonMapEnemyModel[] }>();\n\n data.dungeon.enemies.forEach((placement, placementIndex) => {\n if (placement.mapImageId !== mapImage.id) {\n return;\n }\n\n if (!isValidMapPosition(placement.mapPosition)) {\n warnings.push({\n code: \"invalid-map-position\",\n message: `Skipped ${placement.id}: its map position is missing or outside the map.`,\n placementIndex,\n enemyId: placement.id,\n });\n return;\n }\n\n const enemy = data.enemies.get(placement.id) ?? null;\n if (!enemy) {\n warnings.push({\n code: \"missing-enemy\",\n message: `No enemy metadata exists for ${placement.id}.`,\n placementIndex,\n enemyId: placement.id,\n });\n }\n\n const image = enemy ? findImage(enemy.images, { type: \"enemy\", size: \"200\" }) : null;\n let imageUrl: string | null = null;\n if (image) {\n try {\n imageUrl = source.resolveAssetUrl(image);\n } catch (error: unknown) {\n warnings.push({\n code: \"asset-url-error\",\n message: `Could not resolve the image URL for ${placement.id}: ${String(error)}.`,\n placementIndex,\n enemyId: placement.id,\n });\n }\n } else if (enemy) {\n warnings.push({\n code: \"missing-enemy-image\",\n message: `No 200px enemy image exists for ${placement.id}.`,\n placementIndex,\n enemyId: placement.id,\n });\n }\n\n const model: DungeonMapEnemyModel = {\n instanceId: `${data.dungeon.id}:${mapImage.id}:${placementIndex}`,\n enemy,\n placement,\n position: placement.mapPosition,\n imageUrl,\n };\n const key =\n placement.groupId === null ? `singleton:${placementIndex}` : `group:${placement.groupId}`;\n const group = groups.get(key) ?? { id: placement.groupId, enemies: [] };\n group.enemies.push(model);\n groups.set(key, group);\n });\n\n return {\n dungeon: data.dungeon,\n mapImage,\n groups: [...groups.values()].map(({ id, enemies }) => createDungeonMapGroupModel(id, enemies)),\n warnings,\n };\n};\n\nexport const humanizeMapLabel = (mapImage: ImageAssetRef, dungeon: Dungeon): string => {\n const rawName = mapImage.id.split(\":\").at(-1) ?? mapImage.id;\n const withoutPrefix = rawName.replace(/^T_(?:Map_)?/i, \"\").replace(/^map[-_]/i, \"\");\n const words = withoutPrefix\n .replaceAll(/[_-]+/g, \" \")\n .replace(/([a-z\\d])([A-Z])/g, \"$1 $2\")\n .trim();\n const dungeonName = dungeon.id.split(\".\").at(-1)?.toLowerCase();\n const parts = words.split(/\\s+/).filter((part) => part.toLowerCase() !== dungeonName);\n const label = parts.join(\" \") || words || \"Map\";\n return label.replace(/\\b[a-z]/g, (letter) => letter.toUpperCase());\n};\n","import type { ViewportState } from \"./types.js\";\n\nconst clamp = (value: number, minimum: number, maximum: number): number =>\n Math.min(maximum, Math.max(minimum, value));\n\nexport class ViewportController {\n #viewportWidth = 0;\n #viewportHeight = 0;\n #mapWidth = 0;\n #mapHeight = 0;\n #zoom = 1;\n #x = 0;\n #y = 0;\n\n maxZoom = 8;\n\n get state(): ViewportState {\n return { zoom: this.#zoom, scale: this.scale, x: this.#x, y: this.#y };\n }\n\n get scale(): number {\n return this.fitScale * this.#zoom;\n }\n\n get fitScale(): number {\n if (!this.#viewportWidth || !this.#viewportHeight || !this.#mapWidth || !this.#mapHeight) {\n return 1;\n }\n return Math.min(this.#viewportWidth / this.#mapWidth, this.#viewportHeight / this.#mapHeight);\n }\n\n setDimensions(\n viewportWidth: number,\n viewportHeight: number,\n mapWidth: number,\n mapHeight: number,\n ): ViewportState {\n const previousScale = this.scale;\n const previousCenterX = this.#mapWidth\n ? (this.#viewportWidth / 2 - this.#x) / previousScale / this.#mapWidth\n : 0.5;\n const previousCenterY = this.#mapHeight\n ? (this.#viewportHeight / 2 - this.#y) / previousScale / this.#mapHeight\n : 0.5;\n\n this.#viewportWidth = Math.max(0, viewportWidth);\n this.#viewportHeight = Math.max(0, viewportHeight);\n this.#mapWidth = Math.max(0, mapWidth);\n this.#mapHeight = Math.max(0, mapHeight);\n\n this.#x = this.#viewportWidth / 2 - previousCenterX * this.#mapWidth * this.scale;\n this.#y = this.#viewportHeight / 2 - previousCenterY * this.#mapHeight * this.scale;\n this.#clampPan();\n return this.state;\n }\n\n fit(): ViewportState {\n this.#zoom = 1;\n this.#x = (this.#viewportWidth - this.#mapWidth * this.scale) / 2;\n this.#y = (this.#viewportHeight - this.#mapHeight * this.scale) / 2;\n return this.state;\n }\n\n zoomAt(\n factor: number,\n pointX = this.#viewportWidth / 2,\n pointY = this.#viewportHeight / 2,\n ): ViewportState {\n const previousScale = this.scale;\n const mapX = (pointX - this.#x) / previousScale;\n const mapY = (pointY - this.#y) / previousScale;\n this.#zoom = clamp(this.#zoom * factor, 1, Math.max(1, this.maxZoom));\n this.#x = pointX - mapX * this.scale;\n this.#y = pointY - mapY * this.scale;\n this.#clampPan();\n return this.state;\n }\n\n panBy(deltaX: number, deltaY: number): ViewportState {\n this.#x += deltaX;\n this.#y += deltaY;\n this.#clampPan();\n return this.state;\n }\n\n #clampPan(): void {\n const scaledWidth = this.#mapWidth * this.scale;\n const scaledHeight = this.#mapHeight * this.scale;\n\n this.#x =\n scaledWidth <= this.#viewportWidth\n ? (this.#viewportWidth - scaledWidth) / 2\n : clamp(this.#x, this.#viewportWidth - scaledWidth, 0);\n this.#y =\n scaledHeight <= this.#viewportHeight\n ? (this.#viewportHeight - scaledHeight) / 2\n : clamp(this.#y, this.#viewportHeight - scaledHeight, 0);\n }\n}\n","import type { ImageAssetRef } from \"@crockery/fellowship-data\";\nimport { html, LitElement, nothing, type PropertyValues, type TemplateResult } from \"lit\";\nimport { customElement, property, query, state } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { styleMap } from \"lit/directives/style-map.js\";\n\nimport {\n assertSupportedFellowshipDataSchema,\n FellowshipDataError,\n type DungeonMapData,\n type FellowshipDataSource,\n} from \"../data/data-source.js\";\nimport { createPackageFellowshipDataSource } from \"../data/package-data-source.js\";\nimport { fieldManualStyles } from \"../styles/field-manual.styles.js\";\nimport { installFieldManualFonts } from \"../styles/field-manual-fonts.js\";\nimport { dungeonMapStyles } from \"./dungeon-map.styles.js\";\nimport { createDungeonMapRenderModel, humanizeMapLabel } from \"./render-model.js\";\nimport type {\n DungeonMapEnemyModel,\n DungeonMapGroupModel,\n DungeonMapRenderModel,\n FellowshipMapErrorDetail,\n FellowshipMapImageChangeDetail,\n FellowshipMapReadyDetail,\n FellowshipMapViewportChangeDetail,\n FellowshipMapWarningDetail,\n LitEnemyRenderer,\n LitGroupRenderer,\n MapLabelFormatter,\n ViewportChangeSource,\n ViewportState,\n} from \"./types.js\";\nimport { ViewportController } from \"./viewport-controller.js\";\n\ntype ComponentStatus = \"empty\" | \"loading\" | \"ready\" | \"error\";\n\ninterface PointerPosition {\n readonly x: number;\n readonly y: number;\n}\n\nconst eventOptions = { bubbles: true, composed: true } as const;\n\n/**\n * @fires fellowship-map-ready - Fired after dungeon data and the map image are ready.\n * @fires fellowship-map-error - Fired when map data, imagery, or a renderer fails.\n * @fires fellowship-map-warning - Fired for recoverable dungeon data issues.\n * @fires fellowship-map-image-change - Fired when the selected map changes.\n * @fires fellowship-map-viewport-change - Fired when zoom or pan state changes.\n */\n@customElement(\"fellowship-dungeon-map\")\nexport class FellowshipDungeonMapElement extends LitElement {\n static override styles = [fieldManualStyles, dungeonMapStyles];\n\n @property({ type: String, attribute: \"dungeon-id\" }) dungeonId = \"\";\n @property({ type: String, attribute: \"map-image-id\" }) mapImageId: string | null = null;\n @property({ type: String, attribute: \"asset-base-url\" }) assetBaseUrl: string | null = null;\n @property({ attribute: false }) dataSource: FellowshipDataSource | null = null;\n @property({ attribute: false }) renderEnemy: LitEnemyRenderer | null = null;\n @property({ attribute: false }) renderGroup: LitGroupRenderer | null = null;\n @property({ attribute: false }) mapLabelFormatter: MapLabelFormatter | null = null;\n @property({ type: Boolean, attribute: \"show-controls\" }) showControls = true;\n @property({ type: Boolean, attribute: \"show-map-selector\" }) showMapSelector = true;\n @property({ type: Number, attribute: \"max-zoom\" }) maxZoom = 8;\n\n /** Internal bridge used by the React wrapper. */\n @property({ type: Boolean, attribute: false }) externalOverlay = false;\n\n @state() private _status: ComponentStatus = \"empty\";\n @state() private _error: FellowshipMapErrorDetail | null = null;\n @state() private _data: DungeonMapData | null = null;\n @state() private _model: DungeonMapRenderModel | null = null;\n @state() private _selectedMap: ImageAssetRef | null = null;\n @state() private _viewportState: ViewportState = { zoom: 1, scale: 1, x: 0, y: 0 };\n @state() private _isPanning = false;\n @state() private _enemyRenderContent = new Map<string, TemplateResult | typeof nothing>();\n @state() private _groupRenderContent = new Map<string, TemplateResult | typeof nothing>();\n @state() private _mapLabels = new Map<string, string>();\n\n @query(\".viewport\") private _viewportElement?: HTMLElement;\n @query(\"canvas\") private _canvasElement?: HTMLCanvasElement;\n\n #activeSource: FellowshipDataSource | null = null;\n #abortController: AbortController | null = null;\n #loadToken = 0;\n #renderToken = 0;\n #resizeObserver: ResizeObserver | null = null;\n #viewport = new ViewportController();\n #pointers = new Map<number, PointerPosition>();\n #lastPointer: PointerPosition | null = null;\n #lastPinchDistance = 0;\n #lastPinchCenter: PointerPosition | null = null;\n #rendererFailures = new Set<string>();\n #pendingRendererErrors: FellowshipMapErrorDetail[] = [];\n\n override connectedCallback(): void {\n super.connectedCallback();\n installFieldManualFonts(this.ownerDocument);\n this.#resizeObserver ??= new ResizeObserver(() => this.#handleResize());\n }\n\n override disconnectedCallback(): void {\n this.#abortController?.abort();\n this.#resizeObserver?.disconnect();\n super.disconnectedCallback();\n }\n\n protected override firstUpdated(changed: PropertyValues<this>): void {\n super.firstUpdated(changed);\n const viewport = this._viewportElement;\n if (viewport) {\n this.#resizeObserver?.observe(viewport);\n }\n }\n\n protected override updated(changed: PropertyValues<this>): void {\n super.updated(changed);\n this.#flushRendererErrors();\n\n if (changed.has(\"dungeonId\") || changed.has(\"dataSource\") || changed.has(\"assetBaseUrl\")) {\n queueMicrotask(() => {\n if (this.isConnected) {\n void this.#loadDungeon();\n }\n });\n return;\n }\n\n if (changed.has(\"mapImageId\") && this._data) {\n queueMicrotask(() => {\n if (this.isConnected) {\n void this.#prepareSelectedMap(true);\n }\n });\n }\n\n if (changed.has(\"maxZoom\") && changed.get(\"maxZoom\") !== undefined) {\n this.#viewport.maxZoom = Math.max(1, this.maxZoom);\n this.#viewport.zoomAt(1);\n queueMicrotask(() => this.#commitViewport(\"button\"));\n }\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n\n if (\n changed.has(\"renderEnemy\") ||\n changed.has(\"renderGroup\") ||\n changed.has(\"mapLabelFormatter\")\n ) {\n this.#rendererFailures.clear();\n }\n if (changed.has(\"_model\") || changed.has(\"renderEnemy\") || changed.has(\"renderGroup\")) {\n this.#prepareRendererContent();\n }\n if (changed.has(\"_data\") || changed.has(\"mapLabelFormatter\")) {\n this.#prepareMapLabels();\n }\n }\n\n fitToView(): void {\n this.#viewport.fit();\n this.#commitViewport(\"fit\");\n }\n\n zoomIn(): void {\n this.#viewport.zoomAt(1.35);\n this.#commitViewport(\"button\");\n }\n\n zoomOut(): void {\n this.#viewport.zoomAt(1 / 1.35);\n this.#commitViewport(\"button\");\n }\n\n retry(): void {\n void this.#loadDungeon();\n }\n\n get renderModel(): DungeonMapRenderModel | null {\n return this._model;\n }\n\n override render(): TemplateResult {\n const model = this._model;\n const viewport = this._viewportState;\n const selectedMapTabId = this.#selectedMapTabId;\n const stageStyle = model\n ? {\n width: `${model.mapImage.width}px`,\n height: `${model.mapImage.height}px`,\n transform: `translate3d(${viewport.x}px, ${viewport.y}px, 0) scale(${viewport.scale})`,\n \"--fellowship-map-inverse-scale\": String(1 / viewport.scale),\n }\n : {};\n\n return html`\n <section class=\"viewer\" aria-label=${this.#viewerLabel}>\n <div\n class=\"viewport\"\n part=\"viewport\"\n role=\"region\"\n aria-label=\"Interactive dungeon map\"\n tabindex=\"0\"\n aria-describedby=\"map-instructions\"\n data-panning=${String(this._isPanning)}\n @wheel=${this.#handleWheel}\n @keydown=${this.#handleViewportKeydown}\n @pointerdown=${this.#handlePointerDown}\n @pointermove=${this.#handlePointerMove}\n @pointerup=${this.#handlePointerEnd}\n @pointercancel=${this.#handlePointerEnd}\n >\n ${\n model\n ? html`\n <div\n class=\"stage\"\n id=\"map-stage\"\n role=${selectedMapTabId === nothing ? nothing : \"tabpanel\"}\n aria-labelledby=${selectedMapTabId}\n style=${styleMap(stageStyle)}\n >\n <canvas\n class=\"map-canvas\"\n part=\"map-canvas\"\n role=\"img\"\n aria-label=${`${model.dungeon.name ?? model.dungeon.id}, ${this.#mapLabel(model.mapImage)}`}\n .width=${model.mapImage.width}\n .height=${model.mapImage.height}\n ></canvas>\n <div class=\"overlay\" part=\"overlay\">\n ${\n this.externalOverlay\n ? html`<slot name=\"overlay\"></slot>`\n : this.#renderGroups(model)\n }\n </div>\n </div>\n ${this.#renderMapSelector(model)} ${this.#renderControls()}\n ${\n model.groups.length === 0 && this._status === \"ready\"\n ? html`<div class=\"empty-badge\">No enemy placements on this map</div>`\n : nothing\n }\n `\n : nothing\n }\n ${this.#renderStatus()}\n <p class=\"visually-hidden\" id=\"map-instructions\">\n Drag to pan. Use the mouse wheel, plus and minus keys, or zoom controls to zoom. Press\n zero to fit the full map.\n </p>\n </div>\n </section>\n `;\n }\n\n get #viewerLabel(): string {\n if (this._data) {\n return `${this._data.dungeon.name ?? this._data.dungeon.id} dungeon map`;\n }\n return \"Fellowship dungeon map\";\n }\n\n get #selectedMapTabId(): string | typeof nothing {\n if (\n !this.showMapSelector ||\n !this._model ||\n this._model.dungeon.mapImages.length <= 1 ||\n !this._selectedMap\n ) {\n return nothing;\n }\n const index = this._model.dungeon.mapImages.findIndex(\n (mapImage) => mapImage.id === this._selectedMap?.id,\n );\n return index >= 0 ? `map-tab-${index}` : nothing;\n }\n\n async #loadDungeon(): Promise<void> {\n const dungeonId = this.dungeonId.trim();\n const token = ++this.#loadToken;\n this.#renderToken += 1;\n this.#abortController?.abort();\n this.#abortController = new AbortController();\n this._data = null;\n this._model = null;\n this._selectedMap = null;\n this._error = null;\n this.#rendererFailures.clear();\n\n if (!dungeonId) {\n this._status = \"empty\";\n return;\n }\n\n this._status = \"loading\";\n const source =\n this.dataSource ??\n createPackageFellowshipDataSource(\n this.assetBaseUrl ? { assetBaseUrl: this.assetBaseUrl } : {},\n );\n this.#activeSource = source;\n\n try {\n const data = await source.loadDungeon(dungeonId, this.#abortController.signal);\n if (token !== this.#loadToken || this.#abortController.signal.aborted) {\n return;\n }\n assertSupportedFellowshipDataSchema(data.manifest.schemaVersion);\n this._data = data;\n await this.#prepareSelectedMap(true);\n } catch (error: unknown) {\n if (token !== this.#loadToken || this.#abortController.signal.aborted) {\n return;\n }\n this.#setError(error);\n }\n }\n\n async #prepareSelectedMap(resetView: boolean): Promise<void> {\n const data = this._data;\n const source = this.#activeSource;\n if (!data || !source) {\n return;\n }\n\n const mapImage = this.mapImageId\n ? data.dungeon.mapImages.find(({ id }) => id === this.mapImageId)\n : data.dungeon.mapImages[0];\n\n if (!mapImage) {\n this.#setError({\n code: \"map-not-found\",\n message: this.mapImageId\n ? `No map image with ID “${this.mapImageId}” exists for this dungeon.`\n : \"This dungeon does not include a map image.\",\n });\n return;\n }\n\n const renderToken = ++this.#renderToken;\n const model = createDungeonMapRenderModel(data, mapImage, source);\n this._model = model;\n this._selectedMap = mapImage;\n this._status = \"loading\";\n this._error = null;\n await this.updateComplete;\n\n const viewport = this._viewportElement;\n if (viewport) {\n this.#viewport.maxZoom = Math.max(1, this.maxZoom);\n this.#viewport.setDimensions(\n viewport.clientWidth,\n viewport.clientHeight,\n mapImage.width,\n mapImage.height,\n );\n if (resetView) {\n this.#viewport.fit();\n }\n this._viewportState = this.#viewport.state;\n await this.updateComplete;\n }\n\n try {\n await this.#drawMap(mapImage, source, renderToken);\n if (renderToken !== this.#renderToken) {\n return;\n }\n this._status = \"ready\";\n this.dispatchEvent(\n new CustomEvent<FellowshipMapReadyDetail>(\"fellowship-map-ready\", {\n ...eventOptions,\n detail: { model, data },\n }),\n );\n if (model.warnings.length > 0) {\n this.dispatchEvent(\n new CustomEvent<FellowshipMapWarningDetail>(\"fellowship-map-warning\", {\n ...eventOptions,\n detail: { warnings: model.warnings, model },\n }),\n );\n }\n } catch (error: unknown) {\n if (renderToken === this.#renderToken) {\n this.#setError({\n code: \"map-image-error\",\n message: `Unable to load the dungeon map image: ${String(error)}.`,\n cause: error,\n });\n }\n }\n }\n\n async #drawMap(\n mapImage: ImageAssetRef,\n source: FellowshipDataSource,\n renderToken: number,\n ): Promise<void> {\n const image = new Image();\n image.crossOrigin = \"anonymous\";\n image.src = source.resolveAssetUrl(mapImage);\n await image.decode();\n if (renderToken !== this.#renderToken) {\n return;\n }\n const canvas = this._canvasElement;\n const context = canvas?.getContext(\"2d\");\n if (!canvas || !context) {\n throw new Error(\"A 2D canvas context is unavailable.\");\n }\n context.clearRect(0, 0, canvas.width, canvas.height);\n context.drawImage(image, 0, 0, mapImage.width, mapImage.height);\n }\n\n #setError(error: unknown): void {\n const detail: FellowshipMapErrorDetail =\n typeof error === \"object\" && error !== null && \"code\" in error && \"message\" in error\n ? {\n code: String(error.code),\n message: String(error.message),\n ...(error instanceof FellowshipDataError && error.cause !== undefined\n ? { cause: error.cause }\n : {}),\n }\n : { code: \"unknown\", message: error instanceof Error ? error.message : String(error) };\n this._error = detail;\n this._status = \"error\";\n this.dispatchEvent(\n new CustomEvent<FellowshipMapErrorDetail>(\"fellowship-map-error\", {\n ...eventOptions,\n detail,\n }),\n );\n }\n\n #prepareRendererContent(): void {\n const model = this._model;\n const enemyContent = new Map<string, TemplateResult | typeof nothing>();\n const groupContent = new Map<string, TemplateResult | typeof nothing>();\n\n if (!model) {\n this._enemyRenderContent = enemyContent;\n this._groupRenderContent = groupContent;\n return;\n }\n\n if (this.renderEnemy) {\n for (const group of model.groups) {\n for (const enemy of group.enemies) {\n try {\n enemyContent.set(\n enemy.instanceId,\n this.renderEnemy({\n model: enemy,\n group,\n dungeon: model.dungeon,\n mapImage: model.mapImage,\n }),\n );\n } catch (error: unknown) {\n this.#queueRendererError(`enemy:${enemy.instanceId}`, \"enemy-renderer-error\", error);\n }\n }\n }\n }\n this._enemyRenderContent = enemyContent;\n\n if (this.renderGroup) {\n for (const group of model.groups) {\n const children = group.enemies.map((enemy) => this.#renderEnemyAnchor(group, enemy));\n const key = this.#groupKey(model, group);\n try {\n groupContent.set(\n key,\n this.renderGroup({\n group,\n children,\n dungeon: model.dungeon,\n mapImage: model.mapImage,\n }),\n );\n } catch (error: unknown) {\n this.#queueRendererError(`group:${key}`, \"group-renderer-error\", error);\n }\n }\n }\n this._groupRenderContent = groupContent;\n }\n\n #prepareMapLabels(): void {\n const labels = new Map<string, string>();\n const dungeon = this._data?.dungeon;\n if (dungeon) {\n for (const mapImage of dungeon.mapImages) {\n try {\n labels.set(\n mapImage.id,\n this.mapLabelFormatter?.(mapImage, dungeon) ?? humanizeMapLabel(mapImage, dungeon),\n );\n } catch (error: unknown) {\n this.#queueRendererError(`map-label:${mapImage.id}`, \"map-label-formatter-error\", error);\n labels.set(mapImage.id, humanizeMapLabel(mapImage, dungeon));\n }\n }\n }\n this._mapLabels = labels;\n }\n\n #renderGroups(model: DungeonMapRenderModel): unknown {\n return repeat(\n model.groups,\n (group) => this.#groupKey(model, group),\n (group) => this.#renderGroup(model, group),\n );\n }\n\n #groupKey(model: DungeonMapRenderModel, group: DungeonMapGroupModel): string {\n return `${model.mapImage.id}:${String(group.id)}:${group.enemies[0]?.instanceId ?? \"empty\"}`;\n }\n\n #renderGroup(model: DungeonMapRenderModel, group: DungeonMapGroupModel): TemplateResult {\n const bounds = group.visualBounds;\n const style = {\n left: `${bounds.x * 100}%`,\n top: `${bounds.y * 100}%`,\n width: `${bounds.width * 100}%`,\n height: `${bounds.height * 100}%`,\n };\n const key = this.#groupKey(model, group);\n const content =\n this.renderGroup && this._groupRenderContent.has(key)\n ? (this._groupRenderContent.get(key) ?? nothing)\n : this.#renderDefaultGroup(group);\n\n return html` <div class=\"group-anchor\" part=\"group\" style=${styleMap(style)}>${content}</div> `;\n }\n\n #renderDefaultGroup(group: DungeonMapGroupModel): TemplateResult {\n const label = `G${group.id ?? \"–\"}${group.dungeonScore === null ? \"\" : ` · ${group.dungeonScore}`}`;\n return html`\n <div class=\"default-group\">\n <div class=\"group-ring\" aria-hidden=\"true\"></div>\n <span class=\"group-label\">${label}</span>\n ${repeat(\n group.enemies,\n (enemy) => enemy.instanceId,\n (enemy) => this.#renderEnemyAnchor(group, enemy),\n )}\n </div>\n `;\n }\n\n #renderEnemyAnchor(group: DungeonMapGroupModel, enemy: DungeonMapEnemyModel): TemplateResult {\n const bounds = group.visualBounds;\n const style = {\n left: `${((enemy.position.x - bounds.x) / bounds.width) * 100}%`,\n top: `${((enemy.position.y - bounds.y) / bounds.height) * 100}%`,\n };\n const content =\n this.renderEnemy && this._enemyRenderContent.has(enemy.instanceId)\n ? (this._enemyRenderContent.get(enemy.instanceId) ?? nothing)\n : this.#renderDefaultEnemy(enemy);\n const name = enemy.enemy?.name ?? enemy.placement.id;\n\n return html`\n <div\n class=\"enemy-anchor\"\n part=\"enemy\"\n style=${styleMap(style)}\n role=\"img\"\n aria-label=${name}\n title=${name}\n >\n <div class=\"enemy-visual\">${content}</div>\n </div>\n `;\n }\n\n #renderDefaultEnemy(enemy: DungeonMapEnemyModel): TemplateResult {\n const name = enemy.enemy?.name ?? enemy.placement.id;\n const fallback = name\n .split(/\\s+/)\n .map((part) => part[0])\n .join(\"\")\n .slice(0, 2)\n .toUpperCase();\n return html`\n <span class=\"enemy-marker\" data-boss=${String(enemy.enemy?.isBoss === true)}>\n ${\n enemy.imageUrl\n ? html`<img class=\"enemy-image\" src=${enemy.imageUrl} alt=\"\" draggable=\"false\" />`\n : fallback\n }\n </span>\n `;\n }\n\n #renderMapSelector(model: DungeonMapRenderModel): TemplateResult | typeof nothing {\n const maps = model.dungeon.mapImages;\n if (!this.showMapSelector || maps.length <= 1) {\n return nothing;\n }\n\n return html`\n <div class=\"map-selector\" part=\"map-selector\" role=\"tablist\" aria-label=\"Dungeon maps\">\n ${repeat(\n maps,\n (mapImage) => mapImage.id,\n (mapImage, index) => html`\n <button\n class=\"map-selector-button\"\n id=${`map-tab-${index}`}\n part=\"map-selector-button\"\n type=\"button\"\n role=\"tab\"\n aria-controls=\"map-stage\"\n aria-selected=${String(mapImage.id === this._selectedMap?.id)}\n tabindex=${mapImage.id === this._selectedMap?.id ? \"0\" : \"-1\"}\n data-map-index=${String(index)}\n @click=${() => this.#selectMap(mapImage)}\n @keydown=${this.#handleMapSelectorKeydown}\n >\n ${this.#mapLabel(mapImage)}\n </button>\n `,\n )}\n </div>\n `;\n }\n\n #renderControls(): TemplateResult | typeof nothing {\n if (!this.showControls || !this._model) {\n return nothing;\n }\n return html`\n <div class=\"controls\" part=\"controls\" role=\"group\" aria-label=\"Map zoom controls\">\n <button\n class=\"control-button\"\n part=\"control-button\"\n type=\"button\"\n aria-label=\"Zoom out\"\n title=\"Zoom out\"\n @click=${this.zoomOut}\n >\n −\n </button>\n <button\n class=\"control-button\"\n part=\"control-button\"\n type=\"button\"\n aria-label=\"Fit map\"\n title=\"Fit map\"\n @click=${this.fitToView}\n >\n ◇\n </button>\n <button\n class=\"control-button\"\n part=\"control-button\"\n type=\"button\"\n aria-label=\"Zoom in\"\n title=\"Zoom in\"\n @click=${this.zoomIn}\n >\n +\n </button>\n </div>\n `;\n }\n\n #renderStatus(): TemplateResult | typeof nothing {\n if (this._status === \"ready\") {\n return nothing;\n }\n\n const loading = this._status === \"loading\";\n const empty = this._status === \"empty\";\n const title = loading ? \"Charting dungeon\" : empty ? \"Choose a dungeon\" : \"Map unavailable\";\n const copy = loading\n ? \"Loading Fellowship data and preparing the tactical layer.\"\n : empty\n ? \"Set the dungeon-id attribute or dungeonId property to render a map.\"\n : (this._error?.message ?? \"An unexpected map error occurred.\");\n\n return html`\n <div class=\"status\" part=\"status\" role=${this._status === \"error\" ? \"alert\" : \"status\"}>\n <div class=\"status-card\">\n <div class=\"status-mark\" aria-hidden=\"true\"><span>${loading ? \"…\" : \"✦\"}</span></div>\n <p class=\"status-title\">${title}</p>\n <p class=\"status-copy\">${copy}</p>\n ${\n this._status === \"error\"\n ? html`<button class=\"retry-button\" type=\"button\" @click=${this.retry}>Retry</button>`\n : nothing\n }\n </div>\n </div>\n `;\n }\n\n #mapLabel(mapImage: ImageAssetRef): string {\n return this._mapLabels.get(mapImage.id) ?? \"Map\";\n }\n\n #selectMap(mapImage: ImageAssetRef): void {\n if (mapImage.id === this._selectedMap?.id) {\n return;\n }\n this.mapImageId = mapImage.id;\n this.dispatchEvent(\n new CustomEvent<FellowshipMapImageChangeDetail>(\"fellowship-map-image-change\", {\n ...eventOptions,\n detail: { mapImageId: mapImage.id, mapImage },\n }),\n );\n }\n\n #handleMapSelectorKeydown = (event: KeyboardEvent): void => {\n if (![\"ArrowLeft\", \"ArrowRight\", \"Home\", \"End\"].includes(event.key)) {\n return;\n }\n const maps = this._data?.dungeon.mapImages ?? [];\n const currentIndex = maps.findIndex(({ id }) => id === this._selectedMap?.id);\n const nextIndex =\n event.key === \"Home\"\n ? 0\n : event.key === \"End\"\n ? maps.length - 1\n : event.key === \"ArrowRight\"\n ? (currentIndex + 1) % maps.length\n : (currentIndex - 1 + maps.length) % maps.length;\n const nextMap = maps[nextIndex];\n if (nextMap) {\n event.preventDefault();\n this.#selectMap(nextMap);\n void this.updateComplete.then(() => {\n this.renderRoot\n .querySelector<HTMLButtonElement>(`[data-map-index=\"${nextIndex}\"]`)\n ?.focus();\n });\n }\n };\n\n #handleWheel = (event: WheelEvent): void => {\n if (!this._model || this._status !== \"ready\") {\n return;\n }\n event.preventDefault();\n const rect = this._viewportElement?.getBoundingClientRect();\n if (!rect) {\n return;\n }\n const factor = Math.exp(-event.deltaY * 0.0015);\n this.#viewport.zoomAt(factor, event.clientX - rect.left, event.clientY - rect.top);\n this.#commitViewport(\"wheel\");\n };\n\n #handleViewportKeydown = (event: KeyboardEvent): void => {\n if (event.target !== this._viewportElement || !this._model) {\n return;\n }\n const panAmount = 56;\n if (event.key === \"+\" || event.key === \"=\") {\n event.preventDefault();\n this.#viewport.zoomAt(1.35);\n } else if (event.key === \"-\") {\n event.preventDefault();\n this.#viewport.zoomAt(1 / 1.35);\n } else if (event.key === \"0\") {\n event.preventDefault();\n this.#viewport.fit();\n } else if (event.key === \"ArrowLeft\") {\n event.preventDefault();\n this.#viewport.panBy(panAmount, 0);\n } else if (event.key === \"ArrowRight\") {\n event.preventDefault();\n this.#viewport.panBy(-panAmount, 0);\n } else if (event.key === \"ArrowUp\") {\n event.preventDefault();\n this.#viewport.panBy(0, panAmount);\n } else if (event.key === \"ArrowDown\") {\n event.preventDefault();\n this.#viewport.panBy(0, -panAmount);\n } else {\n return;\n }\n this.#commitViewport(\"keyboard\");\n };\n\n #handlePointerDown = (event: PointerEvent): void => {\n if (!this._model || this.#isInteractiveEvent(event)) {\n return;\n }\n const viewport = this._viewportElement;\n const rect = viewport?.getBoundingClientRect();\n if (!viewport || !rect) {\n return;\n }\n viewport.setPointerCapture(event.pointerId);\n const point = { x: event.clientX - rect.left, y: event.clientY - rect.top };\n this.#pointers.set(event.pointerId, point);\n this._isPanning = true;\n if (this.#pointers.size === 1) {\n this.#lastPointer = point;\n } else if (this.#pointers.size === 2) {\n const [first, second] = [...this.#pointers.values()];\n if (first && second) {\n this.#lastPinchDistance = Math.hypot(second.x - first.x, second.y - first.y);\n this.#lastPinchCenter = { x: (first.x + second.x) / 2, y: (first.y + second.y) / 2 };\n }\n }\n };\n\n #handlePointerMove = (event: PointerEvent): void => {\n if (!this.#pointers.has(event.pointerId)) {\n return;\n }\n const rect = this._viewportElement?.getBoundingClientRect();\n if (!rect) {\n return;\n }\n const point = { x: event.clientX - rect.left, y: event.clientY - rect.top };\n this.#pointers.set(event.pointerId, point);\n\n if (this.#pointers.size === 1 && this.#lastPointer) {\n this.#viewport.panBy(point.x - this.#lastPointer.x, point.y - this.#lastPointer.y);\n this.#lastPointer = point;\n this.#commitViewport(\"pan\");\n return;\n }\n\n if (this.#pointers.size === 2) {\n const [first, second] = [...this.#pointers.values()];\n if (!first || !second) {\n return;\n }\n const distance = Math.hypot(second.x - first.x, second.y - first.y);\n const center = { x: (first.x + second.x) / 2, y: (first.y + second.y) / 2 };\n if (this.#lastPinchDistance > 0) {\n this.#viewport.zoomAt(distance / this.#lastPinchDistance, center.x, center.y);\n }\n if (this.#lastPinchCenter) {\n this.#viewport.panBy(\n center.x - this.#lastPinchCenter.x,\n center.y - this.#lastPinchCenter.y,\n );\n }\n this.#lastPinchDistance = distance;\n this.#lastPinchCenter = center;\n this.#commitViewport(\"pinch\");\n }\n };\n\n #handlePointerEnd = (event: PointerEvent): void => {\n this.#pointers.delete(event.pointerId);\n if (this.#pointers.size === 1) {\n this.#lastPointer = [...this.#pointers.values()][0] ?? null;\n } else if (this.#pointers.size === 0) {\n this.#lastPointer = null;\n this.#lastPinchCenter = null;\n this.#lastPinchDistance = 0;\n this._isPanning = false;\n }\n };\n\n #isInteractiveEvent(event: PointerEvent): boolean {\n return event\n .composedPath()\n .some(\n (node) =>\n node instanceof HTMLElement &&\n node.matches(\"button, a, input, select, textarea, [contenteditable='true']\"),\n );\n }\n\n #handleResize(): void {\n const viewport = this._viewportElement;\n const mapImage = this._selectedMap;\n if (!viewport || !mapImage) {\n return;\n }\n this.#viewport.setDimensions(\n viewport.clientWidth,\n viewport.clientHeight,\n mapImage.width,\n mapImage.height,\n );\n this.#commitViewport(\"resize\");\n }\n\n #commitViewport(source: ViewportChangeSource): void {\n this._viewportState = this.#viewport.state;\n this.dispatchEvent(\n new CustomEvent<FellowshipMapViewportChangeDetail>(\"fellowship-map-viewport-change\", {\n ...eventOptions,\n detail: { viewport: this.#viewport.state, source },\n }),\n );\n }\n\n #queueRendererError(key: string, code: string, error: unknown): void {\n if (this.#rendererFailures.has(key)) {\n return;\n }\n this.#rendererFailures.add(key);\n this.#pendingRendererErrors.push({\n code,\n message: error instanceof Error ? error.message : String(error),\n cause: error,\n });\n }\n\n #flushRendererErrors(): void {\n if (this.#pendingRendererErrors.length === 0) {\n return;\n }\n const errors = this.#pendingRendererErrors;\n this.#pendingRendererErrors = [];\n for (const detail of errors) {\n this.dispatchEvent(\n new CustomEvent<FellowshipMapErrorDetail>(\"fellowship-map-error\", {\n ...eventOptions,\n detail,\n }),\n );\n }\n }\n}\n\nexport const defineFellowshipDungeonMap = (): void => {\n if (\n typeof globalThis.customElements !== \"undefined\" &&\n !globalThis.customElements.get(\"fellowship-dungeon-map\")\n ) {\n globalThis.customElements.define(\"fellowship-dungeon-map\", FellowshipDungeonMapElement);\n }\n};\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"fellowship-dungeon-map\": FellowshipDungeonMapElement;\n }\n}\n"],"mappings":";;;;;;;;;AAUA,IAAa,KACX,IAA8C,CAAC,MACtB;CACzB,IAAM,IAAS,EAAkC,CAAO;CACxD,OAAO;EACL,cAAc,GAAW,MAAW,EAAO,YAAY,GAAW,CAAM;EACxE,kBAAkB,MAAU,EAAO,gBAAgB,CAAK;CAC1D;AACF,GChBa,IAAmB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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N,EAAM,CAAA,GAAA,EAAA,WAAA,kBAAA,KAAA,CAAA,MACN,EAAM,CAAA,GAAA,EAAA,WAAA,cAAA,KAAA,CAAA,MACN,EAAM,CAAA,GAAA,EAAA,WAAA,uBAAA,KAAA,CAAA,MACN,EAAM,CAAA,GAAA,EAAA,WAAA,uBAAA,KAAA,CAAA,MACN,EAAM,CAAA,GAAA,EAAA,WAAA,cAAA,KAAA,CAAA,MAEN,EAAM,WAAW,CAAA,GAAA,EAAA,WAAA,oBAAA,KAAA,CAAA,MACjB,EAAM,QAAQ,CAAA,GAAA,EAAA,WAAA,kBAAA,KAAA,CAAA,UA9BhB,EAAc,wBAAwB,CAAA,GAAA,CAAA;AAo3BvC,IAAa,UAAyC;CACpD,AACS,WAAW,mBAAmB,UACrC,CAAC,WAAW,eAAe,IAAI,wBAAwB,KAEvD,WAAW,eAAe,OAAO,0BAA0B,CAA2B;AAE1F"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"talent-calculator-Dxuc2dZ8.js","names":["#abortController","#flushRendererWarnings","#loadHeroTalents","#skipNextPropertyPointEvent","#emitPointsChange","#normalizeSelections","#reportOverBudget","#rendererFailures","#prepareTalentRenderContent","#emitSelectionChange","#renderHeader","#renderGrid","#renderStatus","#setTalentPoints","#renderTalent","#handleTalentActivation","#renderTalentContent","#pendingRendererWarnings","#renderDefaultTalentIcon","#handleImageError","#loadToken","#lastOverBudgetSignature","#reportWarnings","#setError"],"sources":["../../src/data/package-talent-data-source.ts","../../src/talent-calculator/render-model.ts","../../src/talent-calculator/selection-state.ts","../../src/talent-calculator/talent-calculator.styles.ts","../../src/talent-calculator/talent-calculator.ts"],"sourcesContent":["import { createPackageFellowshipDataClient } from \"@crockery/fellowship-data/client\";\n\nimport type { FellowshipTalentDataSource } from \"./talent-data-source.js\";\n\n/** @deprecated Create a package Fellowship data client instead. */\nexport interface PackageFellowshipTalentDataSourceOptions {\n readonly assetBaseUrl?: string;\n}\n\n/** @deprecated Use `createPackageFellowshipDataClient` from `@crockery/fellowship-data/client`. */\nexport const createPackageFellowshipTalentDataSource = (\n options: PackageFellowshipTalentDataSourceOptions = {},\n): FellowshipTalentDataSource => {\n const client = createPackageFellowshipDataClient(options);\n return {\n loadHeroTalents: (heroId, signal) => client.loadHeroTalents(heroId, signal),\n resolveAssetUrl: (asset) => client.resolveAssetUrl(asset),\n };\n};\n","import { findImage } from \"@crockery/fellowship-data\";\nimport type { Talent } from \"@crockery/fellowship-data\";\n\nimport type {\n FellowshipTalentDataSource,\n TalentCalculatorData,\n} from \"../data/talent-data-source.js\";\nimport type {\n TalentCalculatorRenderModel,\n TalentCalculatorTalentModel,\n TalentCalculatorWarning,\n} from \"./types.js\";\n\nconst romanNumerals = [\"I\", \"II\", \"III\", \"IV\", \"V\", \"VI\"] as const;\n\nexport const talentRowLabel = (row: number): string => romanNumerals[row - 1] ?? String(row);\n\nconst warning = (\n code: TalentCalculatorWarning[\"code\"],\n talent: Talent,\n message: string,\n): TalentCalculatorWarning => ({ code, message, talentId: talent.id });\n\nexport const createTalentCalculatorRenderModel = (\n data: TalentCalculatorData,\n source: FellowshipTalentDataSource,\n): TalentCalculatorRenderModel => {\n const warnings: TalentCalculatorWarning[] = [];\n const occupied = new Set<string>();\n const models: TalentCalculatorTalentModel[] = [];\n\n for (const talent of data.talents) {\n if (talent.row === null && talent.column === null) {\n continue;\n }\n if (\n !Number.isInteger(talent.row) ||\n !Number.isInteger(talent.column) ||\n talent.row === null ||\n talent.column === null ||\n talent.row < 1 ||\n talent.row > 6 ||\n talent.column < 1 ||\n talent.column > 3\n ) {\n warnings.push(\n warning(\n \"invalid-position\",\n talent,\n `Talent “${talent.id}” has an invalid row or column and was skipped.`,\n ),\n );\n continue;\n }\n\n const cell = `${talent.row}:${talent.column}`;\n if (occupied.has(cell)) {\n warnings.push(\n warning(\n \"duplicate-position\",\n talent,\n `Talent “${talent.id}” duplicates row ${talent.row}, column ${talent.column} and was skipped.`,\n ),\n );\n continue;\n }\n occupied.add(cell);\n\n const pointCost =\n Number.isInteger(talent.pointCost) && (talent.pointCost ?? 0) > 0 ? talent.pointCost : null;\n if (pointCost === null) {\n warnings.push(\n warning(\"invalid-cost\", talent, `Talent “${talent.id}” has an invalid point cost.`),\n );\n }\n if (!talent.name) {\n warnings.push(warning(\"missing-name\", talent, `Talent “${talent.id}” has no display name.`));\n }\n if (!talent.description) {\n warnings.push(\n warning(\"missing-description\", talent, `Talent “${talent.id}” has no description.`),\n );\n }\n\n const image =\n findImage(talent.images, { type: \"talent\", size: \"200\" }) ??\n findImage(talent.images, { type: \"talent\", size: \"full\" });\n let imageUrl: string | null = null;\n if (!image) {\n warnings.push(warning(\"missing-image\", talent, `Talent “${talent.id}” has no icon.`));\n } else {\n try {\n imageUrl = source.resolveAssetUrl(image);\n } catch (error: unknown) {\n warnings.push(\n warning(\n \"asset-url-error\",\n talent,\n `The icon URL for talent “${talent.id}” could not be resolved: ${String(error)}.`,\n ),\n );\n }\n }\n\n models.push({\n talent,\n row: talent.row,\n column: talent.column,\n pointCost,\n imageUrl,\n });\n }\n\n models.sort((a, b) => a.row - b.row || a.column - b.column);\n const talentById = new Map(models.map((model) => [model.talent.id, model]));\n const rows = [...new Set(models.map(({ row }) => row))].map((row) => ({\n row,\n label: talentRowLabel(row),\n talents: models.filter((talent) => talent.row === row),\n }));\n\n return { hero: data.hero, rows, talentById, warnings };\n};\n","import type { TalentCalculatorRenderModel, TalentCalculatorSelectionState } from \"./types.js\";\n\nexport const MAX_TALENT_POINTS = 14;\n\nexport const normalizeTalentPoints = (value: number): number =>\n Math.min(\n MAX_TALENT_POINTS,\n Math.max(0, Math.round(Number.isFinite(value) ? value : MAX_TALENT_POINTS)),\n );\n\nexport const normalizeSelectedTalentIds = (\n model: TalentCalculatorRenderModel,\n selectedTalentIds: readonly string[],\n): {\n readonly selectedTalentIds: readonly string[];\n readonly removedTalentIds: readonly string[];\n} => {\n const requested = new Set(selectedTalentIds);\n const selected = [...model.talentById.values()]\n .filter(({ talent }) => requested.has(talent.id))\n .map(({ talent }) => talent.id);\n const selectedSet = new Set(selected);\n const removed = [...new Set(selectedTalentIds)].filter((id) => !selectedSet.has(id));\n return { selectedTalentIds: selected, removedTalentIds: removed };\n};\n\nexport const createTalentCalculatorSelectionState = (\n model: TalentCalculatorRenderModel,\n selectedTalentIds: readonly string[],\n talentPoints: number,\n): TalentCalculatorSelectionState => {\n const selected = new Set(selectedTalentIds);\n const spentPoints = [...model.talentById.values()].reduce(\n (total, talent) =>\n selected.has(talent.talent.id) && talent.pointCost !== null\n ? total + talent.pointCost\n : total,\n 0,\n );\n const remainingPoints = talentPoints - spentPoints;\n return {\n selectedTalentIds: [...model.talentById.values()]\n .filter(({ talent }) => selected.has(talent.id))\n .map(({ talent }) => talent.id),\n spentPoints,\n remainingPoints,\n overBudget: remainingPoints < 0,\n };\n};\n\nexport const canSelectTalent = (\n pointCost: number | null,\n state: TalentCalculatorSelectionState,\n): boolean => pointCost !== null && !state.overBudget && pointCost <= state.remainingPoints;\n","import { css } from \"lit\";\n\nexport const talentCalculatorStyles = css`\n :host {\n --fellowship-talent-background: var(--_fellowship-field-canvas);\n --fellowship-talent-surface: var(--_fellowship-field-surface);\n --fellowship-talent-card-background: var(--_fellowship-field-surface);\n --fellowship-talent-card-selected-background: color-mix(\n in srgb,\n var(--_fellowship-field-surface-raised) 88%,\n var(--_fellowship-field-accent)\n );\n --fellowship-talent-foreground: var(--_fellowship-field-ink);\n --fellowship-talent-muted: var(--_fellowship-field-muted);\n --fellowship-talent-disabled: var(--_fellowship-field-tertiary);\n --fellowship-talent-border: var(--_fellowship-field-border);\n --fellowship-talent-selection: var(--_fellowship-field-accent);\n --fellowship-talent-focus: var(--_fellowship-field-focus);\n --fellowship-talent-points: var(--_fellowship-field-brass);\n --fellowship-talent-danger: var(--_fellowship-field-ember);\n --fellowship-talent-control-surface: var(--_fellowship-field-inset);\n --fellowship-talent-icon-size: 56px;\n --fellowship-talent-font-family: var(--_fellowship-field-font-family);\n --fellowship-talent-tactical-font-family: var(--_fellowship-field-mono-font-family);\n --fellowship-talent-radius: var(--_fellowship-field-radius);\n\n display: block;\n min-width: 0;\n container-type: inline-size;\n color: var(--fellowship-talent-foreground);\n font-family: var(--fellowship-talent-font-family);\n -webkit-font-smoothing: antialiased;\n }\n\n :host([hidden]) {\n display: none;\n }\n\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n button {\n font: inherit;\n }\n\n .container {\n min-width: 0;\n padding: 16px;\n border-radius: calc(var(--fellowship-talent-radius) + 2px);\n background: var(--fellowship-talent-background);\n }\n\n .header {\n min-height: 72px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 24px;\n padding: 8px 8px 24px;\n }\n\n .heading {\n margin: 0;\n color: var(--fellowship-talent-muted);\n font-size: 12px;\n font-weight: 600;\n line-height: 16px;\n letter-spacing: 0.12em;\n text-transform: uppercase;\n }\n\n .points-cluster,\n .point-controls {\n display: flex;\n align-items: center;\n }\n\n .points-cluster {\n gap: 16px;\n }\n\n .points {\n display: flex;\n align-items: baseline;\n gap: 4px;\n color: var(--fellowship-talent-foreground);\n font-family: var(--fellowship-talent-tactical-font-family);\n font-size: 32px;\n font-weight: 600;\n line-height: 40px;\n letter-spacing: -0.04em;\n font-variant-numeric: tabular-nums;\n }\n\n .points-spent {\n color: var(--fellowship-talent-points);\n }\n\n .points-separator,\n .points-total {\n color: var(--_fellowship-field-tertiary);\n }\n\n .points-separator {\n font-size: 18px;\n font-weight: 500;\n }\n\n .points[data-invalid=\"true\"],\n .points[data-invalid=\"true\"] .points-spent {\n color: var(--fellowship-talent-danger);\n }\n\n .point-controls {\n gap: 4px;\n padding: 2px;\n border-radius: calc(var(--fellowship-talent-radius) + 2px);\n background: var(--fellowship-talent-control-surface);\n box-shadow: inset 0 0 0 1px var(--fellowship-talent-border);\n }\n\n .point-control {\n width: 40px;\n height: 40px;\n display: inline-grid;\n place-items: center;\n padding: 0;\n border: 0;\n border-radius: 4px;\n background: transparent;\n color: var(--fellowship-talent-muted);\n font-family: var(--fellowship-talent-tactical-font-family);\n font-size: 18px;\n font-weight: 500;\n line-height: 1;\n cursor: pointer;\n transition:\n background-color 120ms cubic-bezier(0.23, 1, 0.32, 1),\n color 120ms cubic-bezier(0.23, 1, 0.32, 1),\n transform 120ms cubic-bezier(0.23, 1, 0.32, 1);\n }\n\n .point-control:active:not(:disabled) {\n transform: scale(0.97);\n }\n\n .point-control:focus-visible,\n .clear-all:focus-visible,\n .talent:focus-visible,\n .retry-button:focus-visible {\n outline: 2px solid var(--fellowship-talent-focus);\n outline-offset: 2px;\n }\n\n .point-control:disabled {\n color: var(--fellowship-talent-disabled);\n cursor: not-allowed;\n opacity: 0.48;\n }\n\n .clear-all {\n min-height: 44px;\n padding: 0 8px;\n border: 0;\n border-radius: 4px;\n background: transparent;\n color: var(--fellowship-talent-muted);\n font-size: 12px;\n font-weight: 600;\n line-height: 1;\n letter-spacing: 0.04em;\n white-space: nowrap;\n cursor: pointer;\n transition:\n background-color 120ms cubic-bezier(0.23, 1, 0.32, 1),\n color 120ms cubic-bezier(0.23, 1, 0.32, 1),\n transform 120ms cubic-bezier(0.23, 1, 0.32, 1);\n }\n\n .clear-all:active:not(:disabled) {\n transform: scale(0.97);\n }\n\n .clear-all:disabled {\n color: var(--fellowship-talent-disabled);\n cursor: not-allowed;\n opacity: 0.42;\n }\n\n .grid {\n display: grid;\n gap: 16px;\n padding: 8px 0 0;\n }\n\n .row {\n min-width: 0;\n min-inline-size: 0;\n width: 100%;\n display: grid;\n grid-template-columns: 48px minmax(0, 1fr);\n align-items: stretch;\n gap: 8px;\n margin: 0;\n padding: 0;\n border: 0;\n }\n\n .row-label {\n position: relative;\n display: flex;\n align-items: flex-start;\n justify-content: center;\n padding-top: 16px;\n color: var(--fellowship-talent-disabled);\n font-family: var(--fellowship-talent-tactical-font-family);\n font-size: 11px;\n font-weight: 600;\n line-height: 16px;\n text-align: center;\n letter-spacing: 0.08em;\n }\n\n .row-label::before {\n position: absolute;\n inset: 0 0 0 auto;\n width: 1px;\n background: var(--fellowship-talent-border);\n content: \"\";\n }\n\n .row-label::after {\n position: absolute;\n top: 23px;\n right: -3px;\n width: 7px;\n height: 1px;\n background: var(--fellowship-talent-selection);\n content: \"\";\n }\n\n .row-talents {\n min-width: 0;\n display: grid;\n grid-template-columns: repeat(3, minmax(0, 1fr));\n gap: 8px;\n }\n\n fellowship-tooltip {\n display: block;\n min-width: 0;\n }\n\n .talent {\n position: relative;\n width: 100%;\n min-width: 0;\n min-height: 88px;\n display: grid;\n grid-template-columns: var(--fellowship-talent-icon-size) minmax(0, 1fr);\n align-items: center;\n gap: 16px;\n padding: 16px 36px 16px 16px;\n overflow: hidden;\n border: 1px solid transparent;\n border-radius: var(--fellowship-talent-radius);\n background: var(--fellowship-talent-card-background);\n color: var(--fellowship-talent-foreground);\n box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fellowship-talent-border) 64%, transparent);\n text-align: left;\n cursor: pointer;\n transition:\n background-color 140ms cubic-bezier(0.23, 1, 0.32, 1),\n box-shadow 140ms cubic-bezier(0.23, 1, 0.32, 1),\n transform 120ms cubic-bezier(0.23, 1, 0.32, 1),\n opacity 140ms linear;\n }\n\n .talent::before {\n position: absolute;\n top: 16px;\n left: 0;\n width: 2px;\n height: 24px;\n background: transparent;\n content: \"\";\n }\n\n .talent:active:not([aria-disabled=\"true\"]) {\n transform: scale(0.99);\n }\n\n .talent[aria-pressed=\"true\"] {\n background: var(--fellowship-talent-card-selected-background);\n box-shadow: inset 0 0 0 1px\n color-mix(in srgb, var(--fellowship-talent-selection) 32%, transparent);\n }\n\n .talent[aria-pressed=\"true\"]::before {\n background: var(--fellowship-talent-selection);\n }\n\n .talent[aria-disabled=\"true\"] {\n color: var(--fellowship-talent-disabled);\n cursor: not-allowed;\n opacity: 0.46;\n }\n\n .talent-icon,\n .talent-icon-fallback {\n width: var(--fellowship-talent-icon-size);\n height: var(--fellowship-talent-icon-size);\n border-radius: calc(var(--fellowship-talent-radius) - 2px);\n box-shadow: inset 0 0 0 1px var(--fellowship-talent-border);\n }\n\n .talent-icon {\n display: block;\n object-fit: cover;\n }\n\n .talent-icon-fallback {\n display: grid;\n place-items: center;\n background: var(--fellowship-talent-control-surface);\n color: var(--fellowship-talent-muted);\n font-family: var(--fellowship-talent-tactical-font-family);\n font-size: 13px;\n font-weight: 600;\n letter-spacing: 0.08em;\n }\n\n .talent[aria-pressed=\"true\"] .talent-icon,\n .talent[aria-pressed=\"true\"] .talent-icon-fallback {\n box-shadow:\n inset 0 0 0 1px var(--fellowship-talent-border),\n 0 0 0 1px color-mix(in srgb, var(--fellowship-talent-selection) 60%, transparent);\n }\n\n .talent-name {\n min-width: 0;\n overflow: hidden;\n color: currentColor;\n font-size: 16px;\n font-weight: 600;\n line-height: 24px;\n text-overflow: ellipsis;\n text-wrap: balance;\n white-space: nowrap;\n }\n\n .talent-cost {\n position: absolute;\n top: 12px;\n right: 12px;\n color: var(--fellowship-talent-muted);\n font-family: var(--fellowship-talent-tactical-font-family);\n font-size: 11px;\n font-weight: 600;\n line-height: 16px;\n font-variant-numeric: tabular-nums;\n }\n\n .talent[aria-pressed=\"true\"] .talent-cost {\n color: var(--fellowship-talent-focus);\n }\n\n .status {\n min-height: 256px;\n display: grid;\n place-items: center;\n padding: 32px;\n color: var(--fellowship-talent-muted);\n text-align: center;\n }\n\n .status-card {\n max-width: 480px;\n }\n\n .status-mark {\n display: flex;\n width: 40px;\n height: 24px;\n align-items: center;\n justify-content: space-between;\n margin: 0 auto 16px;\n color: var(--fellowship-talent-points);\n font-family: var(--fellowship-talent-tactical-font-family);\n font-size: 16px;\n }\n\n .status-mark::before,\n .status-mark::after {\n width: 8px;\n height: 1px;\n background: var(--fellowship-talent-border);\n content: \"\";\n }\n\n .status-title {\n margin: 0;\n color: var(--fellowship-talent-foreground);\n font-size: 18px;\n font-weight: 600;\n line-height: 24px;\n text-wrap: balance;\n }\n\n .status-copy {\n margin: 8px 0 0;\n font-size: 14px;\n line-height: 24px;\n text-wrap: pretty;\n }\n\n .retry-button {\n min-height: 44px;\n margin-top: 24px;\n padding: 0 16px;\n border: 1px solid var(--fellowship-talent-border);\n border-radius: 4px;\n background: var(--fellowship-talent-control-surface);\n color: var(--fellowship-talent-foreground);\n font-weight: 600;\n cursor: pointer;\n }\n\n .visually-hidden {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n\n @media (hover: hover) {\n .point-control:hover:not(:disabled) {\n background: var(--fellowship-talent-surface);\n color: var(--fellowship-talent-foreground);\n }\n\n .clear-all:hover:not(:disabled) {\n background: color-mix(in srgb, var(--fellowship-talent-danger) 8%, transparent);\n color: var(--fellowship-talent-danger);\n }\n\n .talent:hover:not([aria-disabled=\"true\"]) {\n background: var(--_fellowship-field-surface-raised);\n box-shadow: inset 0 0 0 1px var(--fellowship-talent-border);\n }\n }\n\n @container (max-width: 719px) {\n .container {\n padding: 16px 12px;\n }\n\n .header {\n min-height: 80px;\n grid-template-columns: 1fr;\n display: grid;\n gap: 8px;\n padding: 4px 4px 20px;\n }\n\n .heading {\n font-size: 11px;\n }\n\n .points-cluster {\n width: 100%;\n flex-wrap: wrap;\n justify-content: flex-start;\n gap: 8px;\n }\n\n .points {\n font-size: 28px;\n line-height: 36px;\n }\n\n .grid {\n gap: 24px;\n }\n\n .row {\n grid-template-columns: 1fr;\n gap: 8px;\n }\n\n .row-label {\n min-height: 24px;\n align-items: center;\n justify-content: flex-start;\n padding: 0 0 0 16px;\n text-align: left;\n }\n\n .row-label::before {\n inset: 12px auto auto 0;\n width: 8px;\n height: 1px;\n }\n\n .row-label::after {\n top: 9px;\n right: auto;\n left: 0;\n width: 1px;\n height: 7px;\n }\n\n .row-talents {\n grid-template-columns: 1fr;\n gap: 8px;\n }\n\n .talent {\n --fellowship-talent-icon-size: 52px;\n\n min-height: 80px;\n padding-block: 12px;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .point-control,\n .clear-all,\n .talent {\n transition:\n background-color 100ms linear,\n box-shadow 100ms linear,\n color 100ms linear,\n opacity 100ms linear;\n }\n\n .point-control:active:not(:disabled),\n .clear-all:active:not(:disabled),\n .talent:active:not([aria-disabled=\"true\"]) {\n transform: none;\n }\n }\n`;\n","import { html, LitElement, nothing, type PropertyValues, type TemplateResult } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\n\nimport { assertSupportedFellowshipDataSchema, FellowshipDataError } from \"../data/data-source.js\";\nimport { createPackageFellowshipTalentDataSource } from \"../data/package-talent-data-source.js\";\nimport type { FellowshipTalentDataSource } from \"../data/talent-data-source.js\";\nimport { fieldManualStyles } from \"../styles/field-manual.styles.js\";\nimport { installFieldManualFonts } from \"../styles/field-manual-fonts.js\";\nimport { stripFellowshipRichText } from \"../tooltip/rich-text.js\";\nimport { defineFellowshipTooltip } from \"../tooltip/tooltip.js\";\nimport { createTalentCalculatorRenderModel } from \"./render-model.js\";\nimport {\n canSelectTalent,\n createTalentCalculatorSelectionState,\n MAX_TALENT_POINTS,\n normalizeSelectedTalentIds,\n normalizeTalentPoints,\n} from \"./selection-state.js\";\nimport { talentCalculatorStyles } from \"./talent-calculator.styles.js\";\nimport type {\n FellowshipTalentsErrorDetail,\n FellowshipTalentsReadyDetail,\n FellowshipTalentsWarningDetail,\n LitTalentRenderer,\n TalentCalculatorRenderModel,\n TalentCalculatorSelectionState,\n TalentCalculatorTalentModel,\n TalentCalculatorTalentRenderContext,\n TalentCalculatorWarning,\n TalentPointsChangeDetail,\n TalentPointsChangeSource,\n TalentSelectionChangeDetail,\n TalentSelectionChangeSource,\n} from \"./types.js\";\n\ntype ComponentStatus = \"empty\" | \"loading\" | \"ready\" | \"error\";\n\ninterface TalentPresentation {\n readonly context: TalentCalculatorTalentRenderContext;\n readonly name: string;\n readonly descriptionId: string;\n readonly affordability: string;\n readonly description: string;\n}\n\nconst eventOptions = { bubbles: true, composed: true } as const;\n\nconst stringArrayChanged = (\n value: readonly string[],\n previous: readonly string[] | undefined,\n): boolean =>\n value.length !== previous?.length || value.some((item, index) => item !== previous[index]);\n\nexport const talentSlotName = (talentId: string): string => `talent:${talentId}`;\n\nconst fallbackSelectionState = (talentPoints: number): TalentCalculatorSelectionState => ({\n selectedTalentIds: [],\n spentPoints: 0,\n remainingPoints: talentPoints,\n overBudget: false,\n});\n\nexport { MAX_TALENT_POINTS };\n\n/**\n * @fires fellowship-talents-ready - Fired after talent data is loaded and rendered.\n * @fires fellowship-talents-error - Fired when talent data cannot be loaded.\n * @fires fellowship-talents-warning - Fired for recoverable data and renderer issues.\n * @fires fellowship-talent-selection-change - Fired when selected talents change.\n * @fires fellowship-talent-points-change - Fired when the point budget changes.\n */\n@customElement(\"fellowship-talent-calculator\")\nexport class FellowshipTalentCalculatorElement extends LitElement {\n static override styles = [fieldManualStyles, talentCalculatorStyles];\n\n @property({ type: String, attribute: \"hero-id\" }) heroId = \"\";\n @property({ type: Number, attribute: \"talent-points\" }) talentPoints = MAX_TALENT_POINTS;\n @property({ attribute: false, hasChanged: stringArrayChanged })\n selectedTalentIds: readonly string[] = [];\n @property({ type: String, attribute: \"asset-base-url\" }) assetBaseUrl: string | null = null;\n @property({ attribute: false }) dataSource: FellowshipTalentDataSource | null = null;\n @property({ attribute: false }) renderTalent: LitTalentRenderer | null = null;\n @property({ type: Boolean, attribute: \"show-point-controls\" }) showPointControls = true;\n @property({ type: Boolean, attribute: \"show-tooltips\" }) showTooltips = true;\n\n @state() private _status: ComponentStatus = \"empty\";\n @state() private _error: FellowshipTalentsErrorDetail | null = null;\n @state() private _model: TalentCalculatorRenderModel | null = null;\n @state() private _failedImages = new Set<string>();\n @state() private _announcement = \"\";\n @state() private _renderSelectionState = fallbackSelectionState(MAX_TALENT_POINTS);\n @state() private _talentPresentation = new Map<string, TalentPresentation>();\n @state() private _talentRenderContent = new Map<string, unknown>();\n\n #abortController: AbortController | null = null;\n #loadToken = 0;\n #lastOverBudgetSignature: string | null = null;\n #skipNextPropertyPointEvent = false;\n #rendererFailures = new Set<string>();\n #pendingRendererWarnings: TalentCalculatorWarning[] = [];\n\n override connectedCallback(): void {\n super.connectedCallback();\n installFieldManualFonts(this.ownerDocument);\n }\n\n override disconnectedCallback(): void {\n this.#abortController?.abort();\n super.disconnectedCallback();\n }\n\n protected override updated(changed: PropertyValues<this>): void {\n super.updated(changed);\n this.#flushRendererWarnings();\n\n if (changed.has(\"heroId\") || changed.has(\"dataSource\") || changed.has(\"assetBaseUrl\")) {\n queueMicrotask(() => {\n if (this.isConnected) {\n void this.#loadHeroTalents();\n }\n });\n return;\n }\n\n if (changed.has(\"talentPoints\")) {\n const normalized = normalizeTalentPoints(this.talentPoints);\n if (normalized !== this.talentPoints) {\n this.#skipNextPropertyPointEvent = true;\n this.talentPoints = normalized;\n this.#emitPointsChange(\"normalization\");\n return;\n }\n if (this.#skipNextPropertyPointEvent) {\n this.#skipNextPropertyPointEvent = false;\n } else if (changed.get(\"talentPoints\") !== undefined) {\n this.#emitPointsChange(\"property\");\n }\n }\n\n if (changed.has(\"selectedTalentIds\") && this._model) {\n this.#normalizeSelections(true);\n }\n\n this.#reportOverBudget();\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n\n const selectionChanged =\n changed.has(\"_model\") || changed.has(\"selectedTalentIds\") || changed.has(\"talentPoints\");\n if (selectionChanged) {\n this._renderSelectionState = this._model\n ? createTalentCalculatorSelectionState(\n this._model,\n this.selectedTalentIds,\n this.talentPoints,\n )\n : fallbackSelectionState(this.talentPoints);\n }\n\n if (changed.has(\"renderTalent\")) {\n this.#rendererFailures.clear();\n }\n if (selectionChanged || changed.has(\"renderTalent\")) {\n this.#prepareTalentRenderContent(this._renderSelectionState);\n }\n }\n\n get renderModel(): TalentCalculatorRenderModel | null {\n return this._model;\n }\n\n get selectionState(): TalentCalculatorSelectionState {\n return this._model\n ? createTalentCalculatorSelectionState(this._model, this.selectedTalentIds, this.talentPoints)\n : fallbackSelectionState(this.talentPoints);\n }\n\n reset(): void {\n if (this.selectedTalentIds.length === 0) {\n return;\n }\n this.selectedTalentIds = [];\n this.#emitSelectionChange(\"reset\");\n }\n\n selectTalent(talentId: string): boolean {\n const model = this._model?.talentById.get(talentId);\n const state = this.selectionState;\n if (\n !model ||\n state.selectedTalentIds.includes(talentId) ||\n !canSelectTalent(model.pointCost, state)\n ) {\n return false;\n }\n this.selectedTalentIds = [...state.selectedTalentIds, talentId];\n this.#emitSelectionChange(\"api\");\n return true;\n }\n\n deselectTalent(talentId: string): boolean {\n if (!this.selectionState.selectedTalentIds.includes(talentId)) {\n return false;\n }\n this.selectedTalentIds = this.selectionState.selectedTalentIds.filter((id) => id !== talentId);\n this.#emitSelectionChange(\"api\");\n return true;\n }\n\n retry(): void {\n void this.#loadHeroTalents();\n }\n\n override render(): TemplateResult {\n const state = this._renderSelectionState;\n const label = this._model?.hero.name ?? this._model?.hero.id ?? \"Fellowship hero\";\n return html`\n <section\n class=\"container\"\n part=\"container\"\n aria-label=${`${label} talent calculator`}\n aria-invalid=${String(state.overBudget)}\n >\n ${this.#renderHeader(state)}\n ${\n this._status === \"ready\" && this._model\n ? this.#renderGrid(this._model)\n : this.#renderStatus()\n }\n <p class=\"visually-hidden\" role=\"status\" aria-live=\"polite\">${this._announcement}</p>\n </section>\n `;\n }\n\n #renderHeader(state: TalentCalculatorSelectionState): TemplateResult {\n return html`\n <header class=\"header\" part=\"header\">\n <h2 class=\"heading\" part=\"heading\">Talent points</h2>\n <div class=\"points-cluster\">\n <div\n class=\"points\"\n part=\"points\"\n data-invalid=${String(state.overBudget)}\n aria-label=${`${state.spentPoints} of ${this.talentPoints} talent points spent`}\n aria-live=\"polite\"\n >\n <span class=\"points-spent\" part=\"points-spent\">${state.spentPoints}</span>\n <span class=\"points-separator\" aria-hidden=\"true\">/</span>\n <span class=\"points-total\" part=\"points-total\">${this.talentPoints}</span>\n </div>\n ${\n this.showPointControls\n ? html`\n <div\n class=\"point-controls\"\n part=\"point-controls\"\n role=\"group\"\n aria-label=\"Talent points\"\n >\n <button\n class=\"point-control\"\n part=\"point-control\"\n type=\"button\"\n aria-label=\"Decrease available talent points\"\n title=\"Decrease available talent points\"\n ?disabled=${this.talentPoints <= state.spentPoints}\n @click=${() => this.#setTalentPoints(this.talentPoints - 1, \"decrement\")}\n >\n −\n </button>\n <button\n class=\"point-control\"\n part=\"point-control\"\n type=\"button\"\n aria-label=\"Increase available talent points\"\n title=\"Increase available talent points\"\n ?disabled=${this.talentPoints >= MAX_TALENT_POINTS}\n @click=${() => this.#setTalentPoints(this.talentPoints + 1, \"increment\")}\n >\n +\n </button>\n </div>\n `\n : nothing\n }\n <button\n class=\"clear-all\"\n part=\"clear-all\"\n type=\"button\"\n ?disabled=${state.selectedTalentIds.length === 0}\n @click=${this.reset}\n >\n Clear All\n </button>\n </div>\n </header>\n `;\n }\n\n #renderGrid(model: TalentCalculatorRenderModel): TemplateResult {\n if (model.rows.length === 0) {\n return html`\n <div class=\"status\" part=\"empty-state\" role=\"status\">\n <div class=\"status-card\">\n <div class=\"status-mark\" aria-hidden=\"true\">◇</div>\n <p class=\"status-title\">No active talents</p>\n <p class=\"status-copy\">\n ${model.hero.name ?? model.hero.id} has no positioned talents.\n </p>\n </div>\n </div>\n `;\n }\n\n return html`\n <div class=\"grid\" part=\"grid\" role=\"group\" aria-label=\"Talent tiers\">\n ${repeat(\n model.rows,\n (row) => row.row,\n (row) => html`\n <fieldset class=\"row\" part=\"row\">\n <legend class=\"visually-hidden\">Talent tier ${row.label}</legend>\n <span class=\"row-label\" part=\"row-label\" aria-hidden=\"true\">${row.label}</span>\n <div class=\"row-talents\">\n ${repeat(\n row.talents,\n (talent) => talent.talent.id,\n (talent) => this.#renderTalent(talent),\n )}\n </div>\n </fieldset>\n `,\n )}\n </div>\n `;\n }\n\n #renderTalent(talent: TalentCalculatorTalentModel): TemplateResult | typeof nothing {\n const presentation = this._talentPresentation.get(talent.talent.id);\n if (!presentation) {\n return nothing;\n }\n const { context, name, descriptionId, affordability, description } = presentation;\n const { selected, disabled } = context;\n const card = html`\n <button\n class=\"talent\"\n part=\"talent\"\n type=\"button\"\n aria-label=${`${name}, ${affordability}`}\n aria-describedby=${descriptionId}\n aria-pressed=${String(selected)}\n aria-disabled=${String(disabled)}\n @click=${() => this.#handleTalentActivation(talent, selected, disabled)}\n >\n ${this.#renderTalentContent(context)}\n <span class=\"talent-cost\" part=\"talent-cost\">${talent.pointCost ?? \"–\"}</span>\n </button>\n `;\n\n return html`\n ${\n this.showTooltips && (talent.talent.description || disabled)\n ? html`\n <fellowship-tooltip\n .heading=${name}\n .text=${talent.talent.description ?? affordability}\n >\n ${card}\n </fellowship-tooltip>\n `\n : card\n }\n <span class=\"visually-hidden\" id=${descriptionId}>${description}</span>\n `;\n }\n\n #prepareTalentRenderContent(state: TalentCalculatorSelectionState): void {\n const renderer = this.renderTalent;\n const model = this._model;\n const content = new Map<string, unknown>();\n const presentations = new Map<string, TalentPresentation>();\n\n if (model) {\n for (const talent of model.talentById.values()) {\n const selected = state.selectedTalentIds.includes(talent.talent.id);\n const affordable = canSelectTalent(talent.pointCost, state);\n const disabled = !selected && !affordable;\n const name = talent.talent.name ?? talent.talent.id;\n const affordability =\n talent.pointCost === null\n ? \"This talent has no valid point cost.\"\n : disabled\n ? `Requires ${talent.pointCost} talent points; ${Math.max(0, state.remainingPoints)} remaining.`\n : `${talent.pointCost} talent ${talent.pointCost === 1 ? \"point\" : \"points\"}.`;\n const context: TalentCalculatorTalentRenderContext = {\n talent,\n hero: model.hero,\n selected,\n affordable,\n disabled,\n spentPoints: state.spentPoints,\n remainingPoints: state.remainingPoints,\n talentPoints: this.talentPoints,\n };\n presentations.set(talent.talent.id, {\n context,\n name,\n descriptionId: `talent-description-${talent.row}-${talent.column}`,\n affordability,\n description: [stripFellowshipRichText(talent.talent.description ?? \"\"), affordability]\n .filter(Boolean)\n .join(\" \"),\n });\n if (!renderer) {\n continue;\n }\n try {\n content.set(talent.talent.id, renderer(context));\n } catch (error: unknown) {\n if (!this.#rendererFailures.has(talent.talent.id)) {\n this.#rendererFailures.add(talent.talent.id);\n this.#pendingRendererWarnings.push({\n code: \"renderer-error\",\n message: `The talent renderer failed for “${talent.talent.id}”: ${String(error)}.`,\n talentId: talent.talent.id,\n });\n }\n }\n }\n }\n\n this._talentPresentation = presentations;\n this._talentRenderContent = content;\n }\n\n #renderTalentContent(context: TalentCalculatorTalentRenderContext): unknown {\n const talent = context.talent;\n const name = talent.talent.name ?? talent.talent.id;\n const content =\n this.renderTalent && this._talentRenderContent.has(talent.talent.id)\n ? this._talentRenderContent.get(talent.talent.id)\n : html`\n <slot name=${talentSlotName(talent.talent.id)}>\n <span class=\"talent-name\" part=\"talent-name\" title=${name}>${name}</span>\n </slot>\n `;\n\n return html`\n ${this.#renderDefaultTalentIcon(talent, name)} ${content}\n `;\n }\n\n #renderDefaultTalentIcon(talent: TalentCalculatorTalentModel, name: string): TemplateResult {\n if (talent.imageUrl && !this._failedImages.has(talent.talent.id)) {\n return html`\n <img\n class=\"talent-icon\"\n part=\"talent-icon\"\n src=${talent.imageUrl}\n alt=\"\"\n draggable=\"false\"\n @error=${() => this.#handleImageError(talent)}\n />\n `;\n }\n const rune = name\n .split(/\\s+/)\n .map((part) => part[0])\n .join(\"\")\n .slice(0, 2)\n .toUpperCase();\n return html`<span class=\"talent-icon-fallback\" part=\"talent-icon-fallback\">${rune}</span>`;\n }\n\n #renderStatus(): TemplateResult {\n const loading = this._status === \"loading\";\n const empty = this._status === \"empty\";\n const title = loading\n ? \"Reading talent codex\"\n : empty\n ? \"Choose a hero\"\n : \"Talents unavailable\";\n const copy = loading\n ? \"Loading the hero and their available talents.\"\n : empty\n ? \"Set the hero-id attribute or heroId property to build a talent loadout.\"\n : (this._error?.message ?? \"An unexpected talent data error occurred.\");\n return html`\n <div\n class=\"status\"\n part=${this._status === \"error\" ? \"error-state\" : \"status\"}\n role=${this._status === \"error\" ? \"alert\" : \"status\"}\n >\n <div class=\"status-card\">\n <div class=\"status-mark\" aria-hidden=\"true\">${loading ? \"…\" : \"✦\"}</div>\n <p class=\"status-title\">${title}</p>\n <p class=\"status-copy\">${copy}</p>\n ${\n this._status === \"error\"\n ? html`<button class=\"retry-button\" type=\"button\" @click=${this.retry}>Retry</button>`\n : nothing\n }\n </div>\n </div>\n `;\n }\n\n async #loadHeroTalents(): Promise<void> {\n const heroId = this.heroId.trim();\n const token = ++this.#loadToken;\n this.#abortController?.abort();\n this.#abortController = new AbortController();\n this._model = null;\n this._error = null;\n this._failedImages = new Set();\n this.#rendererFailures.clear();\n this.#lastOverBudgetSignature = null;\n\n if (!heroId) {\n this._status = \"empty\";\n return;\n }\n\n this._status = \"loading\";\n const source =\n this.dataSource ??\n createPackageFellowshipTalentDataSource(\n this.assetBaseUrl ? { assetBaseUrl: this.assetBaseUrl } : {},\n );\n\n try {\n const data = await source.loadHeroTalents(heroId, this.#abortController.signal);\n if (token !== this.#loadToken || this.#abortController.signal.aborted) {\n return;\n }\n assertSupportedFellowshipDataSchema(data.manifest.schemaVersion);\n const model = createTalentCalculatorRenderModel(data, source);\n this._model = model;\n this._status = \"ready\";\n const normalized = this.#normalizeSelections(false);\n await this.updateComplete;\n const selection = this.selectionState;\n this.dispatchEvent(\n new CustomEvent<FellowshipTalentsReadyDetail>(\"fellowship-talents-ready\", {\n ...eventOptions,\n detail: { data, model, selection },\n }),\n );\n if (model.warnings.length > 0) {\n this.#reportWarnings(model.warnings);\n }\n if (normalized) {\n this.#emitSelectionChange(\"normalization\");\n }\n this.#reportOverBudget();\n } catch (error: unknown) {\n if (token !== this.#loadToken || this.#abortController.signal.aborted) {\n return;\n }\n this.#setError(error);\n }\n }\n\n #normalizeSelections(emit: boolean): boolean {\n if (!this._model) {\n return false;\n }\n const normalized = normalizeSelectedTalentIds(this._model, this.selectedTalentIds);\n const changed =\n normalized.selectedTalentIds.length !== this.selectedTalentIds.length ||\n normalized.selectedTalentIds.some((id, index) => id !== this.selectedTalentIds[index]);\n if (!changed) {\n return false;\n }\n this.selectedTalentIds = normalized.selectedTalentIds;\n if (normalized.removedTalentIds.length > 0) {\n this.#reportWarnings([\n {\n code: \"invalid-selection\",\n message: `Removed unavailable talent selections: ${normalized.removedTalentIds.join(\", \")}.`,\n talentId: null,\n },\n ]);\n }\n if (emit) {\n this.#emitSelectionChange(\"normalization\");\n }\n return true;\n }\n\n #handleTalentActivation(\n talent: TalentCalculatorTalentModel,\n selected: boolean,\n disabled: boolean,\n ): void {\n if (selected) {\n this.selectedTalentIds = this.selectionState.selectedTalentIds.filter(\n (id) => id !== talent.talent.id,\n );\n this.#emitSelectionChange(\"user\");\n return;\n }\n if (disabled) {\n this._announcement = this.selectionState.overBudget\n ? \"The current build exceeds the available talent points. Deselect a talent first.\"\n : `Not enough points for ${talent.talent.name ?? talent.talent.id}.`;\n return;\n }\n this.selectedTalentIds = [...this.selectionState.selectedTalentIds, talent.talent.id];\n this.#emitSelectionChange(\"user\");\n }\n\n #setTalentPoints(value: number, source: TalentPointsChangeSource): void {\n const normalized = normalizeTalentPoints(value);\n const state = this.selectionState;\n if (normalized === this.talentPoints || normalized < state.spentPoints) {\n return;\n }\n this.talentPoints = normalized;\n this.#skipNextPropertyPointEvent = true;\n this.#emitPointsChange(source);\n }\n\n #emitSelectionChange(source: TalentSelectionChangeSource): void {\n const state = this._model\n ? createTalentCalculatorSelectionState(this._model, this.selectedTalentIds, this.talentPoints)\n : fallbackSelectionState(this.talentPoints);\n this.dispatchEvent(\n new CustomEvent<TalentSelectionChangeDetail>(\"fellowship-talent-selection-change\", {\n ...eventOptions,\n detail: { ...state, source },\n }),\n );\n }\n\n #emitPointsChange(source: TalentPointsChangeSource): void {\n const state = this.selectionState;\n this.dispatchEvent(\n new CustomEvent<TalentPointsChangeDetail>(\"fellowship-talent-points-change\", {\n ...eventOptions,\n detail: { ...state, talentPoints: this.talentPoints, source },\n }),\n );\n }\n\n #reportOverBudget(): void {\n const state = this.selectionState;\n if (!state.overBudget) {\n this.#lastOverBudgetSignature = null;\n this.removeAttribute(\"aria-invalid\");\n return;\n }\n this.setAttribute(\"aria-invalid\", \"true\");\n const signature = `${this.talentPoints}:${state.selectedTalentIds.join(\",\")}`;\n if (signature === this.#lastOverBudgetSignature) {\n return;\n }\n this.#lastOverBudgetSignature = signature;\n this.#reportWarnings([\n {\n code: \"over-budget\",\n message: `The selected talents cost ${state.spentPoints} points, exceeding the ${this.talentPoints}-point budget.`,\n talentId: null,\n },\n ]);\n }\n\n #handleImageError(talent: TalentCalculatorTalentModel): void {\n if (this._failedImages.has(talent.talent.id)) {\n return;\n }\n this._failedImages = new Set(this._failedImages).add(talent.talent.id);\n this.#reportWarnings([\n {\n code: \"asset-image-error\",\n message: `The icon for talent “${talent.talent.id}” could not be loaded.`,\n talentId: talent.talent.id,\n },\n ]);\n }\n\n #reportWarnings(warnings: readonly TalentCalculatorWarning[]): void {\n this.dispatchEvent(\n new CustomEvent<FellowshipTalentsWarningDetail>(\"fellowship-talents-warning\", {\n ...eventOptions,\n detail: { warnings, model: this._model },\n }),\n );\n }\n\n #flushRendererWarnings(): void {\n if (this.#pendingRendererWarnings.length === 0) {\n return;\n }\n const warnings = this.#pendingRendererWarnings;\n this.#pendingRendererWarnings = [];\n this.#reportWarnings(warnings);\n }\n\n #setError(error: unknown): void {\n const detail: FellowshipTalentsErrorDetail =\n typeof error === \"object\" && error !== null && \"code\" in error && \"message\" in error\n ? {\n code: String(error.code),\n message: String(error.message),\n ...(error instanceof FellowshipDataError && error.cause !== undefined\n ? { cause: error.cause }\n : {}),\n }\n : { code: \"unknown\", message: error instanceof Error ? error.message : String(error) };\n this._error = detail;\n this._status = \"error\";\n this.dispatchEvent(\n new CustomEvent<FellowshipTalentsErrorDetail>(\"fellowship-talents-error\", {\n ...eventOptions,\n detail,\n }),\n );\n }\n}\n\nexport const defineFellowshipTalentCalculator = (): void => {\n defineFellowshipTooltip();\n if (!customElements.get(\"fellowship-talent-calculator\")) {\n customElements.define(\"fellowship-talent-calculator\", FellowshipTalentCalculatorElement);\n }\n};\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"fellowship-talent-calculator\": FellowshipTalentCalculatorElement;\n }\n}\n"],"mappings":";;;;;;;;;AAUA,IAAa,KACX,IAAoD,CAAC,MACtB;CAC/B,IAAM,IAAS,EAAkC,CAAO;CACxD,OAAO;EACL,kBAAkB,GAAQ,MAAW,EAAO,gBAAgB,GAAQ,CAAM;EAC1E,kBAAkB,MAAU,EAAO,gBAAgB,CAAK;CAC1D;AACF,GCLM,IAAgB;CAAC;CAAK;CAAM;CAAO;CAAM;CAAK;AAAI,GAE3C,KAAkB,MAAwB,EAAc,IAAM,MAAM,OAAO,CAAG,GAErF,KACJ,GACA,GACA,OAC6B;CAAE;CAAM;CAAS,UAAU,EAAO;AAAG,IAEvD,KACX,GACA,MACgC;CAChC,IAAM,IAAsC,CAAC,GACvC,oBAAW,IAAI,IAAY,GAC3B,IAAwC,CAAC;CAE/C,KAAK,IAAM,KAAU,EAAK,SAAS;EACjC,IAAI,EAAO,QAAQ,QAAQ,EAAO,WAAW,MAC3C;EAEF,IACE,CAAC,OAAO,UAAU,EAAO,GAAG,KAC5B,CAAC,OAAO,UAAU,EAAO,MAAM,KAC/B,EAAO,QAAQ,QACf,EAAO,WAAW,QAClB,EAAO,MAAM,KACb,EAAO,MAAM,KACb,EAAO,SAAS,KAChB,EAAO,SAAS,GAChB;GACA,EAAS,KACP,EACE,oBACA,GACA,WAAW,EAAO,GAAG,gDACvB,CACF;GACA;EACF;EAEA,IAAM,IAAO,GAAG,EAAO,IAAI,GAAG,EAAO;EACrC,IAAI,EAAS,IAAI,CAAI,GAAG;GACtB,EAAS,KACP,EACE,sBACA,GACA,WAAW,EAAO,GAAG,mBAAmB,EAAO,IAAI,WAAW,EAAO,OAAO,kBAC9E,CACF;GACA;EACF;EACA,EAAS,IAAI,CAAI;EAEjB,IAAM,IACJ,OAAO,UAAU,EAAO,SAAS,MAAM,EAAO,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,YAAY;AAAmB,CAAC,CAAA,GAAA,EAAA,WAAA,qBAAA,KAAA,CAAA,MAE7D,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAiB,CAAC,CAAA,GAAA,EAAA,WAAA,gBAAA,KAAA,CAAA,MACtD,EAAS,EAAE,WAAW,GAAM,CAAC,CAAA,GAAA,EAAA,WAAA,cAAA,KAAA,CAAA,MAC7B,EAAS,EAAE,WAAW,GAAM,CAAC,CAAA,GAAA,EAAA,WAAA,gBAAA,KAAA,CAAA,MAC7B,EAAS;CAAE,MAAM;CAAS,WAAW;AAAsB,CAAC,CAAA,GAAA,EAAA,WAAA,qBAAA,KAAA,CAAA,MAC5D,EAAS;CAAE,MAAM;CAAS,WAAW;AAAgB,CAAC,CAAA,GAAA,EAAA,WAAA,gBAAA,KAAA,CAAA,MAEtD,EAAM,CAAA,GAAA,EAAA,WAAA,WAAA,KAAA,CAAA,MACN,EAAM,CAAA,GAAA,EAAA,WAAA,UAAA,KAAA,CAAA,MACN,EAAM,CAAA,GAAA,EAAA,WAAA,UAAA,KAAA,CAAA,MACN,EAAM,CAAA,GAAA,EAAA,WAAA,iBAAA,KAAA,CAAA,MACN,EAAM,CAAA,GAAA,EAAA,WAAA,iBAAA,KAAA,CAAA,MACN,EAAM,CAAA,GAAA,EAAA,WAAA,yBAAA,KAAA,CAAA,MACN,EAAM,CAAA,GAAA,EAAA,WAAA,uBAAA,KAAA,CAAA,MACN,EAAM,CAAA,GAAA,EAAA,WAAA,wBAAA,KAAA,CAAA,UArBR,EAAc,8BAA8B,CAAA,GAAA,CAAA;AA6oB7C,IAAa,UAA+C;CAE1D,AADA,EAAwB,GACnB,eAAe,IAAI,8BAA8B,KACpD,eAAe,OAAO,gCAAgC,CAAiC;AAE3F"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tooltip-DoQVSnOn.js","names":["#trigger","#clearTimer","#timer","#setOpen","#restoreTriggerDescription","#syncTriggerDescription","#resizeObserver","#positionSurface","#stopPositionTracking","#handlePointerEnter","#handlePointerLeave","#handleFocusIn","#handleFocusOut","#handleKeydown","#handleTriggerSlotChange","#startPositionTracking","#hasStoredAriaDescription","#previousAriaDescription"],"sources":["../../src/tooltip/rich-text.ts","../../src/tooltip/positioning.ts","../../src/tooltip/tooltip.styles.ts","../../src/tooltip/tooltip.ts"],"sourcesContent":["import type {\n FellowshipRichTextDocument,\n FellowshipRichTextSegment,\n FellowshipTextTone,\n} from \"./types.js\";\n\nconst toneByTag: Readonly<Record<string, FellowshipTextTone>> = {\n bold: \"strong\",\n \"rt.bold\": \"strong\",\n \"rt.absorb\": \"ability\",\n \"rt.warning\": \"warning\",\n \"rt.effect\": \"effect\",\n \"rt.mana\": \"resource\",\n \"rt.heal\": \"healing\",\n \"rt.meikoability1\": \"meiko-primary\",\n \"rt.meikoability2\": \"meiko-secondary\",\n};\n\nconst appendText = (\n paragraphs: FellowshipRichTextSegment[][],\n text: string,\n tone: FellowshipTextTone,\n): void => {\n const normalized = text.replace(/\\r\\n?/g, \"\\n\");\n const parts = normalized.split(/\\n{2,}/);\n parts.forEach((part, index) => {\n const paragraph = paragraphs.at(-1)!;\n if (part.length > 0) {\n const previous = paragraph.at(-1);\n if (previous?.tone === tone) {\n paragraph[paragraph.length - 1] = { text: `${previous.text}${part}`, tone };\n } else {\n paragraph.push({ text: part, tone });\n }\n }\n if (index < parts.length - 1) {\n paragraphs.push([]);\n }\n });\n};\n\nexport const resolveFellowshipRichText = (value: string): FellowshipRichTextDocument => {\n const paragraphs: FellowshipRichTextSegment[][] = [[]];\n const tones: FellowshipTextTone[] = [\"default\"];\n const tokens = value.split(/(<\\/?[^>]+>|<\\/>)/g);\n\n for (const token of tokens) {\n if (!token) {\n continue;\n }\n if (token === \"</>\") {\n if (tones.length > 1) {\n tones.pop();\n }\n continue;\n }\n const closing = token.match(/^<\\/\\s*([^>\\s]+)\\s*>$/);\n if (closing) {\n if (tones.length > 1) {\n tones.pop();\n }\n continue;\n }\n const opening = token.match(/^<\\s*([^/][^>\\s]*)\\s*>$/);\n if (opening) {\n const tag = opening[1]?.toLowerCase() ?? \"\";\n tones.push(toneByTag[tag] ?? \"default\");\n continue;\n }\n appendText(paragraphs, token, tones.at(-1) ?? \"default\");\n }\n\n return paragraphs;\n};\n\nexport const stripFellowshipRichText = (value: string): string =>\n resolveFellowshipRichText(value)\n .map((paragraph) => paragraph.map(({ text }) => text).join(\"\"))\n .join(\"\\n\\n\")\n .trim();\n","import type { FellowshipTooltipPlacement, ResolvedTooltipPlacement } from \"./types.js\";\n\nexport interface TooltipRect {\n readonly top: number;\n readonly right: number;\n readonly bottom: number;\n readonly left: number;\n readonly width: number;\n readonly height: number;\n}\n\nexport interface TooltipPosition {\n readonly x: number;\n readonly y: number;\n readonly placement: ResolvedTooltipPlacement;\n}\n\nexport interface TooltipPositionOptions {\n readonly placement?: FellowshipTooltipPlacement;\n readonly viewportWidth: number;\n readonly viewportHeight: number;\n readonly gap?: number;\n readonly margin?: number;\n}\n\nconst clamp = (value: number, minimum: number, maximum: number): number =>\n Math.min(Math.max(value, minimum), Math.max(minimum, maximum));\n\nexport const calculateTooltipPosition = (\n trigger: TooltipRect,\n tooltip: Pick<TooltipRect, \"width\" | \"height\">,\n options: TooltipPositionOptions,\n): TooltipPosition => {\n const gap = options.gap ?? 8;\n const margin = options.margin ?? 8;\n const available: Record<ResolvedTooltipPlacement, number> = {\n top: trigger.top - margin,\n bottom: options.viewportHeight - trigger.bottom - margin,\n right: options.viewportWidth - trigger.right - margin,\n left: trigger.left - margin,\n };\n const required: Record<ResolvedTooltipPlacement, number> = {\n top: tooltip.height + gap,\n bottom: tooltip.height + gap,\n right: tooltip.width + gap,\n left: tooltip.width + gap,\n };\n const order: readonly ResolvedTooltipPlacement[] = [\"top\", \"bottom\", \"right\", \"left\"];\n const preferred = options.placement ?? \"auto\";\n const placement =\n preferred === \"auto\"\n ? (order.find((candidate) => available[candidate] >= required[candidate]) ??\n [...order].sort((a, b) => available[b] - available[a])[0]!)\n : preferred;\n\n const centeredX = trigger.left + trigger.width / 2 - tooltip.width / 2;\n const centeredY = trigger.top + trigger.height / 2 - tooltip.height / 2;\n const x =\n placement === \"left\"\n ? trigger.left - tooltip.width - gap\n : placement === \"right\"\n ? trigger.right + gap\n : centeredX;\n const y =\n placement === \"top\"\n ? trigger.top - tooltip.height - gap\n : placement === \"bottom\"\n ? trigger.bottom + gap\n : centeredY;\n\n return {\n placement,\n x: Math.round(clamp(x, margin, options.viewportWidth - tooltip.width - margin)),\n y: Math.round(clamp(y, margin, options.viewportHeight - tooltip.height - margin)),\n };\n};\n","import { css } from \"lit\";\n\nexport const tooltipStyles = css`\n :host {\n --fellowship-tooltip-void: var(--_fellowship-field-surface-raised);\n --fellowship-tooltip-ink: var(--_fellowship-field-ink);\n --fellowship-tooltip-muted-ink: var(--_fellowship-field-muted);\n --fellowship-tooltip-border: var(--_fellowship-field-border-strong);\n --fellowship-tooltip-focus: var(--_fellowship-field-focus);\n --fellowship-tooltip-ability: #76c5d2;\n --fellowship-tooltip-warning: #d4a761;\n --fellowship-tooltip-effect: #afa1ca;\n --fellowship-tooltip-resource: #7cb2c2;\n --fellowship-tooltip-healing: #82b997;\n --fellowship-tooltip-meiko-primary: #c892a0;\n --fellowship-tooltip-meiko-secondary: #8dbab7;\n --fellowship-tooltip-font-family: var(--_fellowship-field-font-family);\n --fellowship-tooltip-radius: var(--_fellowship-field-radius);\n --fellowship-tooltip-max-width: 360px;\n\n display: inline-block;\n min-width: 0;\n color: var(--fellowship-tooltip-ink);\n font-family: var(--fellowship-tooltip-font-family);\n -webkit-font-smoothing: antialiased;\n }\n\n :host([hidden]) {\n display: none;\n }\n\n .trigger {\n display: contents;\n }\n\n .surface {\n position: fixed;\n z-index: 2147483647;\n box-sizing: border-box;\n display: none;\n overflow: visible;\n width: max-content;\n max-width: min(var(--fellowship-tooltip-max-width), calc(100vw - 16px));\n margin: 0;\n padding: 12px 14px 14px;\n border: 1px solid var(--fellowship-tooltip-border);\n border-radius: var(--fellowship-tooltip-radius);\n background: var(--fellowship-tooltip-void);\n color: var(--fellowship-tooltip-ink);\n box-shadow: 0 8px 24px rgb(0 0 0 / 34%);\n opacity: 0;\n transform: translateY(4px) scale(0.98);\n transform-origin: bottom center;\n transition:\n opacity 140ms cubic-bezier(0.23, 1, 0.32, 1),\n transform 140ms cubic-bezier(0.23, 1, 0.32, 1);\n pointer-events: none;\n }\n\n .surface[data-open=\"true\"] {\n display: block;\n opacity: 1;\n transform: translateY(0) scale(1);\n }\n\n .surface[data-placement=\"bottom\"] {\n transform-origin: top center;\n }\n\n .surface[data-placement=\"left\"] {\n transform-origin: center right;\n }\n\n .surface[data-placement=\"right\"] {\n transform-origin: center left;\n }\n\n .heading {\n position: relative;\n margin: 0 0 6px;\n padding-left: 12px;\n color: var(--fellowship-tooltip-ink);\n font-size: 14px;\n font-weight: 600;\n line-height: 20px;\n text-wrap: balance;\n }\n\n .heading::before {\n position: absolute;\n inset: 4px auto 4px 0;\n width: 2px;\n background: var(--_fellowship-field-accent);\n content: \"\";\n }\n\n .content {\n color: var(--fellowship-tooltip-muted-ink);\n font-size: 13px;\n font-weight: 400;\n line-height: 20px;\n text-wrap: pretty;\n }\n\n .paragraph {\n margin: 0;\n white-space: pre-line;\n }\n\n .paragraph + .paragraph {\n margin-top: 8px;\n }\n\n [data-tone=\"strong\"] {\n color: var(--fellowship-tooltip-ink);\n font-weight: 600;\n }\n\n [data-tone=\"ability\"] {\n color: var(--fellowship-tooltip-ability);\n }\n\n [data-tone=\"warning\"] {\n color: var(--fellowship-tooltip-warning);\n }\n\n [data-tone=\"effect\"] {\n color: var(--fellowship-tooltip-effect);\n }\n\n [data-tone=\"resource\"] {\n color: var(--fellowship-tooltip-resource);\n }\n\n [data-tone=\"healing\"] {\n color: var(--fellowship-tooltip-healing);\n }\n\n [data-tone=\"meiko-primary\"] {\n color: var(--fellowship-tooltip-meiko-primary);\n }\n\n [data-tone=\"meiko-secondary\"] {\n color: var(--fellowship-tooltip-meiko-secondary);\n }\n\n .arrow {\n position: absolute;\n width: 8px;\n height: 8px;\n border: solid var(--fellowship-tooltip-border);\n background: var(--fellowship-tooltip-void);\n transform: rotate(45deg);\n }\n\n .surface[data-placement=\"top\"] .arrow {\n bottom: -5px;\n left: calc(50% - 4px);\n border-width: 0 1px 1px 0;\n }\n\n .surface[data-placement=\"bottom\"] .arrow {\n top: -5px;\n left: calc(50% - 4px);\n border-width: 1px 0 0 1px;\n }\n\n .surface[data-placement=\"left\"] .arrow {\n top: calc(50% - 4px);\n right: -5px;\n border-width: 1px 1px 0 0;\n }\n\n .surface[data-placement=\"right\"] .arrow {\n top: calc(50% - 4px);\n left: -5px;\n border-width: 0 0 1px 1px;\n }\n\n @media (prefers-reduced-motion: reduce) {\n .surface {\n transition: opacity 100ms linear;\n transform: none;\n }\n }\n`;\n","import { html, LitElement, nothing, type PropertyValues, type TemplateResult } from \"lit\";\nimport { customElement, property, query, state } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { styleMap } from \"lit/directives/style-map.js\";\n\nimport { fieldManualStyles } from \"../styles/field-manual.styles.js\";\nimport { installFieldManualFonts } from \"../styles/field-manual-fonts.js\";\nimport { calculateTooltipPosition } from \"./positioning.js\";\nimport { resolveFellowshipRichText, stripFellowshipRichText } from \"./rich-text.js\";\nimport { tooltipStyles } from \"./tooltip.styles.js\";\nimport type {\n FellowshipTooltipPlacement,\n FellowshipRichTextDocument,\n FellowshipTooltipToggleDetail,\n ResolvedTooltipPlacement,\n} from \"./types.js\";\n\nconst eventOptions = { bubbles: true, composed: true } as const;\n\n/**\n * @fires fellowship-tooltip-toggle - Fired when the tooltip opens or closes.\n */\n@customElement(\"fellowship-tooltip\")\nexport class FellowshipTooltipElement extends LitElement {\n static override styles = [fieldManualStyles, tooltipStyles];\n\n @property({ type: String }) heading: string | null = null;\n @property({ type: String }) text: string | null = null;\n @property({ type: String }) placement: FellowshipTooltipPlacement = \"auto\";\n @property({ type: Number, attribute: \"open-delay\" }) openDelay = 250;\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n @state() private _open = false;\n @state() private _position = { x: 0, y: 0 };\n @state() private _resolvedPlacement: ResolvedTooltipPlacement = \"top\";\n @state() private _paragraphs: FellowshipRichTextDocument = [];\n\n @query(\".surface\") private _surface?: HTMLElement;\n\n #timer: number | null = null;\n #trigger: HTMLElement | null = null;\n #previousAriaDescription: string | null = null;\n #hasStoredAriaDescription = false;\n #resizeObserver: ResizeObserver | null = null;\n\n override connectedCallback(): void {\n super.connectedCallback();\n installFieldManualFonts(this.ownerDocument);\n this.#resizeObserver ??= new ResizeObserver(() => this.#positionSurface());\n }\n\n override disconnectedCallback(): void {\n this.#clearTimer();\n this.#stopPositionTracking();\n this.#restoreTriggerDescription();\n super.disconnectedCallback();\n }\n\n protected override updated(changed: PropertyValues<this>): void {\n super.updated(changed);\n if (changed.has(\"text\") || changed.has(\"heading\")) {\n this.#syncTriggerDescription();\n }\n if (changed.has(\"disabled\") && this.disabled && this._open) {\n this.#setOpen(false, \"disabled\");\n }\n if (changed.has(\"placement\") && this._open) {\n this.#positionSurface();\n }\n }\n\n protected override willUpdate(changed: PropertyValues<this>): void {\n super.willUpdate(changed);\n if (changed.has(\"text\")) {\n this._paragraphs = resolveFellowshipRichText(this.text ?? \"\");\n }\n }\n\n show(): void {\n if (this.disabled || this._open) {\n return;\n }\n this.#setOpen(true, \"programmatic\");\n }\n\n hide(): void {\n this.#clearTimer();\n if (this._open) {\n this.#setOpen(false, \"programmatic\");\n }\n }\n\n override render(): TemplateResult {\n const surfaceStyle = {\n left: `${this._position.x}px`,\n top: `${this._position.y}px`,\n };\n\n return html`\n <span\n class=\"trigger\"\n part=\"trigger\"\n @pointerenter=${this.#handlePointerEnter}\n @pointerleave=${this.#handlePointerLeave}\n @focusin=${this.#handleFocusIn}\n @focusout=${this.#handleFocusOut}\n @keydown=${this.#handleKeydown}\n >\n <slot @slotchange=${this.#handleTriggerSlotChange}></slot>\n </span>\n <div\n class=\"surface\"\n part=\"surface\"\n role=\"tooltip\"\n popover=\"manual\"\n data-open=${String(this._open)}\n data-placement=${this._resolvedPlacement}\n style=${styleMap(surfaceStyle)}\n >\n <span class=\"arrow\" part=\"arrow\" aria-hidden=\"true\"></span>\n <slot name=\"content\">\n ${this.heading ? html`<p class=\"heading\" part=\"heading\">${this.heading}</p>` : nothing}\n <div class=\"content\" part=\"content\">\n ${repeat(\n this._paragraphs,\n (_paragraph, paragraphIndex) => paragraphIndex,\n (paragraph, paragraphIndex) => html`\n <p class=\"paragraph\" part=\"paragraph\">\n ${repeat(\n paragraph,\n (segment, segmentIndex) =>\n `${paragraphIndex}:${segmentIndex}:${segment.tone}:${segment.text}`,\n (segment) => html`<span data-tone=${segment.tone}>${segment.text}</span>`,\n )}\n </p>\n `,\n )}\n </div>\n </slot>\n </div>\n `;\n }\n\n #setOpen(open: boolean, reason: FellowshipTooltipToggleDetail[\"reason\"]): void {\n if (open === this._open) {\n return;\n }\n this._open = open;\n void this.updateComplete.then(() => {\n const surface = this._surface;\n if (!surface) {\n return;\n }\n if (open) {\n if (\"showPopover\" in surface && !surface.matches(\":popover-open\")) {\n surface.showPopover();\n }\n this.#startPositionTracking();\n this.#positionSurface();\n } else {\n if (\"hidePopover\" in surface && surface.matches(\":popover-open\")) {\n surface.hidePopover();\n }\n this.#stopPositionTracking();\n }\n });\n this.dispatchEvent(\n new CustomEvent<FellowshipTooltipToggleDetail>(\"fellowship-tooltip-toggle\", {\n ...eventOptions,\n detail: { open, reason },\n }),\n );\n }\n\n #positionSurface = (): void => {\n if (!this._open || !this.#trigger || !this._surface) {\n return;\n }\n const trigger = this.#trigger.getBoundingClientRect();\n const surface = this._surface.getBoundingClientRect();\n const next = calculateTooltipPosition(trigger, surface, {\n placement: this.placement,\n viewportWidth: window.innerWidth,\n viewportHeight: window.innerHeight,\n });\n if (\n next.x === this._position.x &&\n next.y === this._position.y &&\n next.placement === this._resolvedPlacement\n ) {\n return;\n }\n this._position = { x: next.x, y: next.y };\n this._resolvedPlacement = next.placement;\n };\n\n #startPositionTracking(): void {\n window.addEventListener(\"resize\", this.#positionSurface);\n window.addEventListener(\"scroll\", this.#positionSurface, true);\n if (this.#trigger) {\n this.#resizeObserver?.observe(this.#trigger);\n }\n if (this._surface) {\n this.#resizeObserver?.observe(this._surface);\n }\n }\n\n #stopPositionTracking(): void {\n window.removeEventListener(\"resize\", this.#positionSurface);\n window.removeEventListener(\"scroll\", this.#positionSurface, true);\n this.#resizeObserver?.disconnect();\n }\n\n #handlePointerEnter = (): void => {\n if (this.disabled || this._open) {\n return;\n }\n this.#clearTimer();\n this.#timer = window.setTimeout(\n () => {\n this.#timer = null;\n this.#setOpen(true, \"pointer\");\n },\n Math.max(0, this.openDelay),\n );\n };\n\n #handlePointerLeave = (): void => {\n this.#clearTimer();\n if (this._open) {\n this.#setOpen(false, \"pointer\");\n }\n };\n\n #handleFocusIn = (): void => {\n this.#clearTimer();\n if (!this.disabled && !this._open) {\n this.#setOpen(true, \"focus\");\n }\n };\n\n #handleFocusOut = (event: FocusEvent): void => {\n if (!this.contains(event.relatedTarget as Node | null) && this._open) {\n this.#setOpen(false, \"focus\");\n }\n };\n\n #handleKeydown = (event: KeyboardEvent): void => {\n if (event.key === \"Escape\" && this._open) {\n event.stopPropagation();\n this.#setOpen(false, \"escape\");\n }\n };\n\n #handleTriggerSlotChange = (event: Event): void => {\n const slot = event.currentTarget as HTMLSlotElement;\n const nextTrigger = slot.assignedElements({ flatten: true })[0];\n this.#restoreTriggerDescription();\n this.#trigger = nextTrigger instanceof HTMLElement ? nextTrigger : null;\n this.#syncTriggerDescription();\n };\n\n #syncTriggerDescription(): void {\n if (!this.#trigger) {\n return;\n }\n if (!this.#hasStoredAriaDescription) {\n this.#previousAriaDescription = this.#trigger.getAttribute(\"aria-description\");\n this.#hasStoredAriaDescription = true;\n }\n const description = [this.heading, stripFellowshipRichText(this.text ?? \"\")]\n .filter(Boolean)\n .join(\". \");\n if (description) {\n this.#trigger.setAttribute(\"aria-description\", description);\n } else if (this.#previousAriaDescription === null) {\n this.#trigger.removeAttribute(\"aria-description\");\n }\n }\n\n #restoreTriggerDescription(): void {\n if (!this.#trigger) {\n return;\n }\n if (this.#previousAriaDescription === null) {\n this.#trigger.removeAttribute(\"aria-description\");\n } else {\n this.#trigger.setAttribute(\"aria-description\", this.#previousAriaDescription);\n }\n this.#trigger = null;\n this.#previousAriaDescription = null;\n this.#hasStoredAriaDescription = false;\n }\n\n #clearTimer(): void {\n if (this.#timer !== null) {\n window.clearTimeout(this.#timer);\n this.#timer = null;\n }\n }\n}\n\nexport const defineFellowshipTooltip = (): void => {\n if (!customElements.get(\"fellowship-tooltip\")) {\n customElements.define(\"fellowship-tooltip\", FellowshipTooltipElement);\n }\n};\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"fellowship-tooltip\": FellowshipTooltipElement;\n }\n}\n"],"mappings":";;;;;;AAMA,IAAM,IAA0D;CAC9D,MAAM;CACN,WAAW;CACX,aAAa;CACb,cAAc;CACd,aAAa;CACb,WAAW;CACX,WAAW;CACX,oBAAoB;CACpB,oBAAoB;AACtB,GAEM,KACJ,GACA,GACA,MACS;CAET,IAAM,IADa,EAAK,QAAQ,UAAU,IAC5B,CAAA,CAAW,MAAM,QAAQ;CACvC,EAAM,SAAS,GAAM,MAAU;EAC7B,IAAM,IAAY,EAAW,GAAG,EAAE;EAClC,IAAI,EAAK,SAAS,GAAG;GACnB,IAAM,IAAW,EAAU,GAAG,EAAE;GAChC,AAAI,GAAU,SAAS,IACrB,EAAU,EAAU,SAAS,KAAK;IAAE,MAAM,GAAG,EAAS,OAAO;IAAQ;GAAK,IAE1E,EAAU,KAAK;IAAE,MAAM;IAAM;GAAK,CAAC;EAEvC;EACA,AAAI,IAAQ,EAAM,SAAS,KACzB,EAAW,KAAK,CAAC,CAAC;CAEtB,CAAC;AACH,GAEa,KAA6B,MAA8C;CACtF,IAAM,IAA4C,CAAC,CAAC,CAAC,GAC/C,IAA8B,CAAC,SAAS,GACxC,IAAS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.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAExE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAE7E,wEAAwE;AACxE,MAAM,MAAM,wBAAwB,GAAG,IAAI,CACzC,oBAAoB,EACpB,kBAAkB,GAAG,iBAAiB,CACvC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"data-source.d.ts","sourceRoot":"","sources":["../../src/data/data-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAC/B,YAAY,EACV,cAAc,EACd,uBAAuB,GACxB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAI7E,eAAO,MAAM,mCAAmC,GAAI,eAAe,MAAM,KAAG,IAO3E,CAAC;AAEF,wEAAwE;AACxE,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,oBAAoB,EAAE,aAAa,GAAG,iBAAiB,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"package-cast-data-source.d.ts","sourceRoot":"","sources":["../../src/data/package-cast-data-source.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEtE,mEAAmE;AACnE,MAAM,WAAW,sCAAsC;IACrD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,mGAAmG;AACnG,eAAO,MAAM,qCAAqC,GAChD,UAAS,sCAA2C,KACnD,wBAMF,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"package-data-source.d.ts","sourceRoot":"","sources":["../../src/data/package-data-source.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,mEAAmE;AACnE,MAAM,WAAW,kCAAkC;IACjD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,mGAAmG;AACnG,eAAO,MAAM,iCAAiC,GAC5C,UAAS,kCAAuC,KAC/C,oBAMF,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"package-talent-data-source.d.ts","sourceRoot":"","sources":["../../src/data/package-talent-data-source.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAE1E,mEAAmE;AACnE,MAAM,WAAW,wCAAwC;IACvD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,mGAAmG;AACnG,eAAO,MAAM,uCAAuC,GAClD,UAAS,wCAA6C,KACrD,0BAMF,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"talent-data-source.d.ts","sourceRoot":"","sources":["../../src/data/talent-data-source.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAE7E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAE7E,wEAAwE;AACxE,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAC3C,oBAAoB,EACpB,iBAAiB,GAAG,iBAAiB,CACtC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"dungeon-cast-browser.d.ts","sourceRoot":"","sources":["../../src/dungeon-cast-browser/dungeon-cast-browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAW,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAI1F,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAO5E,OAAO,KAAK,EACV,oBAAoB,EACpB,uBAAuB,EAKvB,sBAAsB,EAEvB,MAAM,YAAY,CAAC;AAMpB;;;;GAIG;AACH,qBACa,mCAAoC,SAAQ,UAAU;;IACjE,OAAgB,MAAM,4BAAiD;IAElB,SAAS,SAAM;IACpC,YAAY,EAAE,sBAAsB,GAAG,IAAI,CAAQ;IACnD,eAAe,EAAE,SAAS,sBAAsB,EAAE,CAAM;IAExF,gBAAgB,EAAE,oBAAoB,CAAS;IACH,IAAI,UAAS;IACA,YAAY,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC5D,UAAU,EAAE,wBAAwB,GAAG,IAAI,CAAQ;IAE1E,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,MAAM,CAAiD;IAC/D,OAAO,CAAC,MAAM,CAAwC;IACtD,OAAO,CAAC,MAAM,CAAM;IAKpB,iBAAiB,IAAI,IAAI;IAKzB,oBAAoB,IAAI,IAAI;cAKlB,OAAO,CAAC,OAAO,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;IAS/D,KAAK,IAAI,IAAI;IAIb,IAAI,WAAW,IAAI,uBAAuB,GAAG,IAAI,CAEhD;IAEQ,MAAM,IAAI,cAAc;CAySlC;AAED,eAAO,MAAM,kCAAkC,QAAO,IAUrD,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,iCAAiC,EAAE,mCAAmC,CAAC;KACxE;CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"dungeon-cast-browser.styles.d.ts","sourceRoot":"","sources":["../../src/dungeon-cast-browser/dungeon-cast-browser.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,wBAAwB,yBAwapC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dungeon-cast-browser/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kCAAkC,EAClC,mCAAmC,GACpC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AACnF,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,EAChB,gCAAgC,EAChC,+BAA+B,EAC/B,gCAAgC,EAChC,+BAA+B,EAC/B,sBAAsB,EACtB,4BAA4B,EAC5B,2BAA2B,EAC3B,sCAAsC,GACvC,MAAM,YAAY,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"render-model.d.ts","sourceRoot":"","sources":["../../src/dungeon-cast-browser/render-model.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAC7F,OAAO,KAAK,EAEV,uBAAuB,EAGvB,sBAAsB,EACvB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,eAAe,GAAI,wBAAwB,sBAAsB,KAAG,MACjD,CAAC;AAgBjC,eAAO,MAAM,6BAA6B,GACxC,MAAM,eAAe,EACrB,QAAQ,wBAAwB,KAC/B,uBA+CF,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/dungeon-cast-browser/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAEzE,OAAO,KAAK,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAE7F,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,YAAY,GAAG,cAAc,CAAC;AAEzE,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG,kBAAkB,GAAG,MAAM,GAAG,aAAa,CAAC;AAE5F,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,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,CAAC;IAClB,YAAY,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAC5C,eAAe,EAAE,SAAS,sBAAsB,EAAE,CAAC;IACnD,gBAAgB,EAAE,oBAAoB,CAAC;IACvC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,wBAAwB,GAAG,IAAI,CAAC;CAC7C;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,mBAAmB;QAC3B,+BAA+B,EAAE,+BAA+B,CAAC;QACjE,+BAA+B,EAAE,+BAA+B,CAAC;QACjE,0BAA0B,EAAE,2BAA2B,CAAC;KACzD;CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"dungeon-cast-browser.js","names":[],"sources":["../src/dungeon-cast-browser/index.ts"],"sourcesContent":["export {\n defineFellowshipDungeonCastBrowser,\n FellowshipDungeonCastBrowserElement,\n} from \"./dungeon-cast-browser.js\";\nexport { castIdentityKey, createDungeonCastBrowserModel } from \"./render-model.js\";\nexport type {\n CastCapabilityLabel,\n ConfiguredCastFilter,\n DungeonCastBrowserModel,\n DungeonCastEnemyModel,\n DungeonCastModel,\n FellowshipCastBrowserErrorDetail,\n FellowshipCastBrowserErrorEvent,\n FellowshipCastBrowserReadyDetail,\n FellowshipCastBrowserReadyEvent,\n FellowshipCastIdentity,\n FellowshipCastSelectedDetail,\n FellowshipCastSelectedEvent,\n FellowshipDungeonCastBrowserProperties,\n} from \"./types.js\";\n\nimport { defineFellowshipDungeonCastBrowser } from \"./dungeon-cast-browser.js\";\n\ndefineFellowshipDungeonCastBrowser();\n"],"mappings":";;AAuBA,EAAmC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"dungeon-map.d.ts","sourceRoot":"","sources":["../../src/dungeon-map/dungeon-map.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,UAAU,EAAW,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAK1F,OAAO,E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EAAE,cAAc,GAAG,IAAI;IAkB5D,SAAS,IAAI,IAAI;IAKjB,MAAM,IAAI,IAAI;IAKd,OAAO,IAAI,IAAI;IAKf,KAAK,IAAI,IAAI;IAIb,IAAI,WAAW,IAAI,qBAAqB,GAAG,IAAI,CAE9C;IAEQ,MAAM,IAAI,cAAc;CA4uBlC;AAED,eAAO,MAAM,0BAA0B,QAAO,IAO7C,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,wBAAwB,EAAE,2BAA2B,CAAC;KACvD;CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"dungeon-map.styles.d.ts","sourceRoot":"","sources":["../../src/dungeon-map/dungeon-map.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,yBA8b5B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dungeon-map/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,YAAY,EACV,oBAAoB,EACpB,4BAA4B,EAC5B,oBAAoB,EACpB,4BAA4B,EAC5B,qBAAqB,EACrB,iBAAiB,EACjB,8BAA8B,EAC9B,wBAAwB,EACxB,8BAA8B,EAC9B,wBAAwB,EACxB,iCAAiC,EACjC,0BAA0B,EAC1B,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,aAAa,GACd,MAAM,YAAY,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/dungeon-map/layout.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAkB,MAAM,YAAY,CAAC;AAiD7F,eAAO,MAAM,0BAA0B,GACrC,IAAI,MAAM,GAAG,IAAI,EACjB,SAAS,SAAS,oBAAoB,EAAE,KACvC,oBAUF,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"render-model.d.ts","sourceRoot":"","sources":["../../src/dungeon-map/render-model.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEpF,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEnF,OAAO,KAAK,EAAwB,qBAAqB,EAAqB,MAAM,YAAY,CAAC;AAEjG,eAAO,MAAM,kBAAkB,GAAI,UAAU,UAAU,GAAG,IAAI,KAAG,QAAQ,IAAI,UAO5D,CAAC;AAElB,eAAO,MAAM,2BAA2B,GACtC,MAAM,cAAc,EACpB,UAAU,aAAa,EACvB,QAAQ,oBAAoB,KAC3B,qBAuEF,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,UAAU,aAAa,EAAE,SAAS,OAAO,KAAG,MAW5E,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/dungeon-map/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,YAAY,EACZ,KAAK,EACL,aAAa,EACb,UAAU,EACX,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEnF,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CAC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B,sBAAsB,EAAE,uBAAuB,CAAC;QAChD,sBAAsB,EAAE,uBAAuB,CAAC;QAChD,wBAAwB,EAAE,yBAAyB,CAAC;QACpD,6BAA6B,EAAE,6BAA6B,CAAC;QAC7D,gCAAgC,EAAE,gCAAgC,CAAC;KACpE;CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"viewport-controller.d.ts","sourceRoot":"","sources":["../../src/dungeon-map/viewport-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAKhD,qBAAa,kBAAkB;;IAS7B,OAAO,SAAK;IAEZ,IAAI,KAAK,IAAI,aAAa,CAEzB;IAED,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,IAAI,QAAQ,IAAI,MAAM,CAKrB;IAED,aAAa,CACX,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAChB,aAAa;IAoBhB,GAAG,IAAI,aAAa;IAOpB,MAAM,CACJ,MAAM,EAAE,MAAM,EACd,MAAM,SAA0B,EAChC,MAAM,SAA2B,GAChC,aAAa;IAWhB,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa;CAoBrD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"dungeon-map.js","names":[],"sources":["../src/dungeon-map/index.ts"],"sourcesContent":["export { FellowshipDungeonMapElement, defineFellowshipDungeonMap } from \"./dungeon-map.js\";\nexport { createDungeonMapRenderModel, humanizeMapLabel } from \"./render-model.js\";\nexport { ViewportController } from \"./viewport-controller.js\";\nexport type {\n DungeonMapEnemyModel,\n DungeonMapEnemyRenderContext,\n DungeonMapGroupModel,\n DungeonMapGroupRenderContext,\n DungeonMapRenderModel,\n DungeonMapWarning,\n FellowshipDungeonMapProperties,\n FellowshipMapErrorDetail,\n FellowshipMapImageChangeDetail,\n FellowshipMapReadyDetail,\n FellowshipMapViewportChangeDetail,\n FellowshipMapWarningDetail,\n LitEnemyRenderer,\n LitGroupRenderer,\n MapLabelFormatter,\n NormalizedRect,\n ViewportState,\n} from \"./types.js\";\n\nimport { defineFellowshipDungeonMap } from \"./dungeon-map.js\";\n\ndefineFellowshipDungeonMap();\n"],"mappings":";;AAyBA,EAA2B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,OAAO,EACP,OAAO,EACP,oBAAoB,EACpB,YAAY,EACZ,0BAA0B,EAC1B,SAAS,EACT,KAAK,EACL,OAAO,EACP,sBAAsB,EACtB,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,aAAa,EACb,UAAU,EACV,UAAU,EACV,MAAM,GACP,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,iCAAiC,EAAE,MAAM,kCAAkC,CAAC;AACrF,YAAY,EACV,oBAAoB,EACpB,kCAAkC,GACnC,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACL,mBAAmB,EACnB,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,iCAAiC,EACjC,KAAK,kCAAkC,GACxC,MAAM,+BAA+B,CAAC;AACvC,YAAY,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAC5F,OAAO,EACL,qCAAqC,EACrC,KAAK,sCAAsC,GAC5C,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,uCAAuC,EACvC,KAAK,wCAAwC,GAC9C,MAAM,sCAAsC,CAAC;AAC9C,YAAY,EACV,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,8BAA8B,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"dungeon-cast-browser.d.ts","sourceRoot":"","sources":["../../src/react/dungeon-cast-browser.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAc,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,EAEL,mCAAmC,EACpC,MAAM,iDAAiD,CAAC;AACzD,OAAO,KAAK,EACV,+BAA+B,EAC/B,+BAA+B,EAC/B,2BAA2B,EAC5B,MAAM,kCAAkC,CAAC;AAI1C,eAAO,MAAM,kBAAkB;aAKiB,SAAS,CAAC,+BAA+B,CAAC;aAC1C,SAAS,CAAC,+BAA+B,CAAC;oBACxC,SAAS,CAAC,2BAA2B,CAAC;EAEtF,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEhF,eAAe,kBAAkB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"dungeon-cast-browser.js","names":[],"sources":["../../src/react/dungeon-cast-browser.tsx"],"sourcesContent":["import { createComponent, type EventName } from \"@lit/react\";\nimport React, { type ComponentProps } from \"react\";\n\nimport {\n defineFellowshipDungeonCastBrowser,\n FellowshipDungeonCastBrowserElement,\n} from \"../dungeon-cast-browser/dungeon-cast-browser.js\";\nimport type {\n FellowshipCastBrowserErrorEvent,\n FellowshipCastBrowserReadyEvent,\n FellowshipCastSelectedEvent,\n} from \"../dungeon-cast-browser/types.js\";\n\ndefineFellowshipDungeonCastBrowser();\n\nexport const DungeonCastBrowser = createComponent({\n react: React,\n tagName: \"fellowship-dungeon-cast-browser\",\n elementClass: FellowshipDungeonCastBrowserElement,\n events: {\n onReady: \"fellowship-cast-browser-ready\" as EventName<FellowshipCastBrowserReadyEvent>,\n onError: \"fellowship-cast-browser-error\" as EventName<FellowshipCastBrowserErrorEvent>,\n onCastSelected: \"fellowship-cast-selected\" as EventName<FellowshipCastSelectedEvent>,\n },\n});\n\nexport type DungeonCastBrowserProps = ComponentProps<typeof DungeonCastBrowser>;\n\nexport default DungeonCastBrowser;\n"],"mappings":";;;;AAaA,EAAmC;AAEnC,IAAa,IAAqB,EAAgB;CAChD,OAAO;CACP,SAAS;CACT,cAAc;CACd,QAAQ;EACN,SAAS;EACT,SAAS;EACT,gBAAgB;CAClB;AACF,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"dungeon-map.d.ts","sourceRoot":"","sources":["../../src/react/dungeon-map.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,EAAE,EAKZ,KAAK,cAAc,EAEnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,2BAA2B,EAE5B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAEV,4BAA4B,EAE5B,4BAA4B,EAE5B,uBAAuB,EACvB,6BAA6B,EAC7B,uBAAuB,EACvB,gCAAgC,EAChC,yBAAyB,EAC1B,MAAM,yBAAyB,CAAC;AAIjC,QAAA,MAAM,gBAAgB;aAKiB,SAAS,CAAC,uBAAuB,CAAC;aAClC,SAAS,CAAC,uBAAuB,CAAC;eAC9B,SAAS,CAAC,yBAAyB,CAAC;sBACxB,SAAS,CAAC,6BAA6B,CAAC;sBAErD,SAAS,CAAC,gCAAgC,CAAC;EAEnF,CAAC;AAEH,KAAK,qBAAqB,GAAG,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAErE,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,4BAA4B,KAAK,SAAS,CAAC;AACtF,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,4BAA4B,CAAC,SAAS,CAAC,KAAK,SAAS,CAAC;AAEjG,MAAM,WAAW,qBACf,SAAQ,IAAI,CACV,qBAAqB,EACrB,UAAU,GAAG,iBAAiB,GAAG,SAAS,GAAG,aAAa,GAAG,aAAa,CAC3E;IACD,QAAQ,CAAC,WAAW,CAAC,EAAE,kBAAkB,CAAC;IAC1C,QAAQ,CAAC,WAAW,CAAC,EAAE,kBAAkB,CAAC;IAC1C,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,IAAI,CAAC;CAC7D;AAoLD,eAAO,MAAM,gBAAgB,wHA+C5B,CAAC;AAIF,eAAe,gBAAgB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"dungeon-map.js","names":[],"sources":["../../src/react/dungeon-map.tsx"],"sourcesContent":["import { createComponent, type EventName } from \"@lit/react\";\nimport React, {\n forwardRef,\n useCallback,\n useEffect,\n useState,\n type ComponentProps,\n type CSSProperties,\n type ReactNode,\n} from \"react\";\n\nimport {\n FellowshipDungeonMapElement,\n defineFellowshipDungeonMap,\n} from \"../dungeon-map/dungeon-map.js\";\nimport type {\n DungeonMapEnemyModel,\n DungeonMapEnemyRenderContext,\n DungeonMapGroupModel,\n DungeonMapGroupRenderContext,\n DungeonMapRenderModel,\n FellowshipMapErrorEvent,\n FellowshipMapImageChangeEvent,\n FellowshipMapReadyEvent,\n FellowshipMapViewportChangeEvent,\n FellowshipMapWarningEvent,\n} from \"../dungeon-map/types.js\";\n\ndefineFellowshipDungeonMap();\n\nconst NativeDungeonMap = createComponent({\n react: React,\n tagName: \"fellowship-dungeon-map\",\n elementClass: FellowshipDungeonMapElement,\n events: {\n onReady: \"fellowship-map-ready\" as EventName<FellowshipMapReadyEvent>,\n onError: \"fellowship-map-error\" as EventName<FellowshipMapErrorEvent>,\n onWarning: \"fellowship-map-warning\" as EventName<FellowshipMapWarningEvent>,\n onMapImageChange: \"fellowship-map-image-change\" as EventName<FellowshipMapImageChangeEvent>,\n onViewportChange:\n \"fellowship-map-viewport-change\" as EventName<FellowshipMapViewportChangeEvent>,\n },\n});\n\ntype NativeDungeonMapProps = ComponentProps<typeof NativeDungeonMap>;\n\nexport type ReactEnemyRenderer = (context: DungeonMapEnemyRenderContext) => ReactNode;\nexport type ReactGroupRenderer = (context: DungeonMapGroupRenderContext<ReactNode>) => ReactNode;\n\nexport interface DungeonMapViewerProps\n extends Omit<\n NativeDungeonMapProps,\n \"children\" | \"externalOverlay\" | \"onReady\" | \"renderEnemy\" | \"renderGroup\"\n > {\n readonly renderEnemy?: ReactEnemyRenderer;\n readonly renderGroup?: ReactGroupRenderer;\n readonly onReady?: (event: FellowshipMapReadyEvent) => void;\n}\n\nconst overlayStyle: CSSProperties = {\n position: \"absolute\",\n inset: 0,\n width: \"100%\",\n height: \"100%\",\n pointerEvents: \"none\",\n};\n\nconst markerStyle: CSSProperties = {\n position: \"relative\",\n display: \"grid\",\n width: \"var(--fellowship-map-enemy-size, 32px)\",\n height: \"var(--fellowship-map-enemy-size, 32px)\",\n placeItems: \"center\",\n overflow: \"hidden\",\n border: \"2px solid var(--fellowship-map-rune, #4bc7de)\",\n borderRadius: \"50%\",\n background: \"#131a22\",\n color: \"var(--fellowship-map-ink, #f2f0e8)\",\n boxShadow: \"0 0 0 1px rgba(0,0,0,.72), 0 2px 6px rgba(0,0,0,.32)\",\n fontFamily: \"var(--fellowship-map-tactical-font-family, ui-monospace, monospace)\",\n fontSize: 10,\n fontWeight: 800,\n};\n\nconst defaultEnemy = (enemy: DungeonMapEnemyModel): ReactNode => {\n const name = enemy.enemy?.name ?? enemy.placement.id;\n const fallback = name\n .split(/\\s+/)\n .map((part) => part[0])\n .join(\"\")\n .slice(0, 2)\n .toUpperCase();\n const bossStyle = enemy.enemy?.isBoss\n ? { borderColor: \"var(--fellowship-map-ember, #ff7a2f)\", width: 36, height: 36 }\n : undefined;\n\n return (\n <span style={{ ...markerStyle, ...bossStyle }}>\n {enemy.imageUrl ? (\n <img\n src={enemy.imageUrl}\n alt=\"\"\n draggable={false}\n style={{ width: \"100%\", height: \"100%\", objectFit: \"cover\" }}\n />\n ) : (\n fallback\n )}\n </span>\n );\n};\n\nconst renderEnemyAnchor = (\n model: DungeonMapRenderModel,\n group: DungeonMapGroupModel,\n enemy: DungeonMapEnemyModel,\n renderEnemy?: ReactEnemyRenderer,\n): ReactNode => {\n const bounds = group.visualBounds;\n const name = enemy.enemy?.name ?? enemy.placement.id;\n const context: DungeonMapEnemyRenderContext = {\n model: enemy,\n group,\n dungeon: model.dungeon,\n mapImage: model.mapImage,\n };\n\n return (\n <div\n key={enemy.instanceId}\n role=\"img\"\n aria-label={name}\n title={name}\n style={{\n position: \"absolute\",\n left: `${((enemy.position.x - bounds.x) / bounds.width) * 100}%`,\n top: `${((enemy.position.y - bounds.y) / bounds.height) * 100}%`,\n width: 0,\n height: 0,\n zIndex: 2,\n pointerEvents: \"auto\",\n }}\n >\n <div\n style={{\n position: \"absolute\",\n transform: \"translate(-50%, -50%) scale(var(--fellowship-map-inverse-scale, 1))\",\n transformOrigin: \"center\",\n }}\n >\n {renderEnemy ? renderEnemy(context) : defaultEnemy(enemy)}\n </div>\n </div>\n );\n};\n\nconst defaultGroup = (group: DungeonMapGroupModel, children: readonly ReactNode[]): ReactNode => {\n const label = `G${group.id ?? \"–\"}${group.dungeonScore === null ? \"\" : ` · ${group.dungeonScore}`}`;\n return (\n <div style={{ position: \"absolute\", inset: 0 }}>\n <div\n aria-hidden=\"true\"\n style={{\n position: \"absolute\",\n inset: 0,\n border:\n \"calc(1px * var(--fellowship-map-inverse-scale, 1)) solid var(--fellowship-map-ember, #ff7a2f)\",\n borderRadius: \"50%\",\n background: \"color-mix(in srgb, var(--fellowship-map-ember, #ff7a2f) 7%, transparent)\",\n opacity: 0.5,\n }}\n />\n <span\n style={{\n position: \"absolute\",\n left: \"50%\",\n top: 0,\n minHeight: 22,\n display: \"inline-flex\",\n alignItems: \"center\",\n padding: \"0 7px\",\n border:\n \"1px solid color-mix(in srgb, var(--fellowship-map-ember, #ff7a2f) 58%, transparent)\",\n borderRadius: 4,\n background: \"var(--fellowship-map-control-surface, rgba(12,17,23,.88))\",\n color: \"var(--fellowship-map-ink, #f2f0e8)\",\n fontFamily: \"var(--fellowship-map-tactical-font-family, ui-monospace, monospace)\",\n fontSize: 11,\n fontWeight: 700,\n whiteSpace: \"nowrap\",\n transform: \"translate(-50%, -45%) scale(var(--fellowship-map-inverse-scale, 1))\",\n transformOrigin: \"center\",\n }}\n >\n {label}\n </span>\n {children}\n </div>\n );\n};\n\nconst renderReactOverlay = (\n model: DungeonMapRenderModel,\n renderEnemy?: ReactEnemyRenderer,\n renderGroup?: ReactGroupRenderer,\n): ReactNode =>\n model.groups.map((group) => {\n const bounds = group.visualBounds;\n const children = group.enemies.map((enemy) =>\n renderEnemyAnchor(model, group, enemy, renderEnemy),\n );\n const content = renderGroup\n ? renderGroup({\n group,\n children,\n dungeon: model.dungeon,\n mapImage: model.mapImage,\n })\n : defaultGroup(group, children);\n\n return (\n <div\n key={`${model.mapImage.id}:${String(group.id)}:${group.enemies[0]?.instanceId ?? \"empty\"}`}\n style={{\n position: \"absolute\",\n left: `${bounds.x * 100}%`,\n top: `${bounds.y * 100}%`,\n width: `${bounds.width * 100}%`,\n height: `${bounds.height * 100}%`,\n pointerEvents: \"none\",\n }}\n >\n {content}\n </div>\n );\n });\n\nexport const DungeonMapViewer = forwardRef<FellowshipDungeonMapElement, DungeonMapViewerProps>(\n function DungeonMapViewer(\n { renderEnemy, renderGroup, onReady, onMapImageChange, mapImageId, ...properties },\n forwardedRef,\n ) {\n const [model, setModel] = useState<DungeonMapRenderModel | null>(null);\n const [selectedMapImageId, setSelectedMapImageId] = useState(mapImageId);\n const usesReactOverlay = Boolean(renderEnemy || renderGroup);\n\n useEffect(() => {\n if (mapImageId !== undefined) {\n setSelectedMapImageId(mapImageId);\n }\n }, [mapImageId]);\n\n const handleReady = useCallback(\n (event: FellowshipMapReadyEvent) => {\n setModel(event.detail.model);\n onReady?.(event);\n },\n [onReady],\n );\n const handleMapImageChange = useCallback(\n (event: FellowshipMapImageChangeEvent) => {\n setSelectedMapImageId(event.detail.mapImageId);\n onMapImageChange?.(event);\n },\n [onMapImageChange],\n );\n\n return (\n <NativeDungeonMap\n {...properties}\n {...(mapImageId === undefined ? {} : { mapImageId: selectedMapImageId })}\n ref={forwardedRef}\n externalOverlay={usesReactOverlay}\n onReady={handleReady}\n onMapImageChange={handleMapImageChange}\n >\n {usesReactOverlay && model ? (\n <div slot=\"overlay\" style={overlayStyle}>\n {renderReactOverlay(model, renderEnemy, renderGroup)}\n </div>\n ) : null}\n </NativeDungeonMap>\n );\n },\n);\n\nDungeonMapViewer.displayName = \"DungeonMapViewer\";\n\nexport default DungeonMapViewer;\n"],"mappings":";;;;;AA4BA,EAA2B;AAE3B,IAAM,IAAmB,EAAgB;CACvC,OAAO;CACP,SAAS;CACT,cAAc;CACd,QAAQ;EACN,SAAS;EACT,SAAS;EACT,WAAW;EACX,kBAAkB;EAClB,kBACE;CACJ;AACF,CAAC,GAiBK,IAA8B;CAClC,UAAU;CACV,OAAO;CACP,OAAO;CACP,QAAQ;CACR,eAAe;AACjB,GAEM,IAA6B;CACjC,UAAU;CACV,SAAS;CACT,OAAO;CACP,QAAQ;CACR,YAAY;CACZ,UAAU;CACV,QAAQ;CACR,cAAc;CACd,YAAY;CACZ,OAAO;CACP,WAAW;CACX,YAAY;CACZ,UAAU;CACV,YAAY;AACd,GAEM,KAAgB,MAA2C;CAE/D,IAAM,KADO,EAAM,OAAO,QAAQ,EAAM,UAAU,GAAA,CAE/C,MAAM,KAAK,CAAC,CACZ,KAAK,MAAS,EAAK,EAAE,CAAC,CACtB,KAAK,EAAE,CAAC,CACR,MAAM,GAAG,CAAC,CAAC,CACX,YAAY,GACT,IAAY,EAAM,OAAO,SAC3B;EAAE,aAAa;EAAwC,OAAO;EAAI,QAAQ;CAAG,IAC7E,KAAA;CAEJ,OACE,kBAAC,QAAD;EAAM,OAAO;GAAE,GAAG;GAAa,GAAG;EAAU;YACzC,EAAM,WACL,kBAAC,OAAD;GACE,KAAK,EAAM;GACX,KAAI;GACJ,WAAW;GACX,OAAO;IAAE,OAAO;IAAQ,QAAQ;IAAQ,W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IACnB,kBAAC,OAAD;GAAK,MAAK;GAAU,OAAO;aACxB,EAAmB,GAAO,GAAa,CAAW;EAChD,CAAA,IACH;CACY,CAAA;AAEtB,CACF;AAEA,EAAiB,cAAc"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EACV,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,YAAY,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACzF,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"talent-calculator.d.ts","sourceRoot":"","sources":["../../src/react/talent-calculator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,EAAE,EAMZ,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,iCAAiC,EAGlC,MAAM,2CAA2C,CAAC;AAMnD,OAAO,KAAK,EACV,2BAA2B,EAC3B,2BAA2B,EAC3B,6BAA6B,EAE7B,mCAAmC,EACnC,uBAAuB,EACvB,0BAA0B,EAC3B,MAAM,+BAA+B,CAAC;AAIvC,QAAA,MAAM,sBAAsB;aAKe,SAAS,CAAC,2BAA2B,CAAC;aACtC,SAAS,CAAC,2BAA2B,CAAC;eAClC,SAAS,CAAC,6BAA6B,CAA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