@elite-dangerous-almanac/core 0.1.0-beta.8 → 0.1.0-beta.9
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.
- package/PROVENANCE/i18n/SOURCES.md +54 -5
- package/PROVENANCE/materials/SOURCES.md +33 -12
- package/README.md +15 -5
- package/THIRD_PARTY_NOTICES.md +11 -9
- package/dist/chunk-4AE22CHV.js +1 -0
- package/dist/chunk-4AE22CHV.js.map +1 -0
- package/dist/chunk-4WC5NHBJ.js +1 -0
- package/dist/chunk-4WC5NHBJ.js.map +1 -0
- package/dist/chunk-53ERRGPM.js +1 -0
- package/dist/{chunk-WASJ5U5A.js.map → chunk-53ERRGPM.js.map} +1 -1
- package/dist/chunk-BYBT5XSW.js +1 -0
- package/dist/chunk-BYBT5XSW.js.map +1 -0
- package/dist/{chunk-DHOCTGWB.js → chunk-G3AMKCOE.js} +1 -1
- package/dist/{chunk-RIT6MOO5.js → chunk-GVLDFJEY.js} +1 -1
- package/dist/{chunk-RIT6MOO5.js.map → chunk-GVLDFJEY.js.map} +1 -1
- package/dist/{chunk-IZGYEP2X.js → chunk-KLIYDSYF.js} +1 -1
- package/dist/{chunk-IZGYEP2X.js.map → chunk-KLIYDSYF.js.map} +1 -1
- package/dist/{chunk-DYFUHGJQ.js → chunk-KQDJTDLV.js} +1 -1
- package/dist/{chunk-PRFXKOCZ.js → chunk-MNXWK7PA.js} +1 -1
- package/dist/chunk-P2QOL63K.js +1 -0
- package/dist/chunk-P2QOL63K.js.map +1 -0
- package/dist/{chunk-NQ2ID6BF.js → chunk-Q22LXT53.js} +1 -1
- package/dist/chunk-QF3NYGUJ.js +1 -0
- package/dist/chunk-QF3NYGUJ.js.map +1 -0
- package/dist/chunk-UXZJMZEU.js +1 -0
- package/dist/chunk-UXZJMZEU.js.map +1 -0
- package/dist/chunk-V4C6FIE2.js +1 -0
- package/dist/{chunk-TLA6LHLN.js.map → chunk-V4C6FIE2.js.map} +1 -1
- package/dist/{chunk-ESEM3LPU.js → chunk-VARPO47V.js} +1 -1
- package/dist/{chunk-CI3ACMRA.js → chunk-WHWFKHV3.js} +1 -1
- package/dist/{chunk-CI3ACMRA.js.map → chunk-WHWFKHV3.js.map} +1 -1
- package/dist/{chunk-ELIZXUMI.js → chunk-YDBRGW4G.js} +1 -1
- package/dist/i18n/blueprints.js +1 -1
- package/dist/i18n/experimental-effects.js +1 -1
- package/dist/i18n/index.d.ts +3 -1
- package/dist/i18n/index.js +1 -1
- package/dist/i18n/materials.d.ts +31 -0
- package/dist/i18n/materials.js +1 -0
- package/dist/i18n/materials.js.map +1 -0
- package/dist/i18n/micro-resources.d.ts +31 -0
- package/dist/i18n/micro-resources.js +1 -0
- package/dist/i18n/micro-resources.js.map +1 -0
- package/dist/i18n/modules.js +1 -1
- package/dist/materials/index.js +1 -1
- package/dist/materials/materials-all.js +1 -1
- package/dist/materials/materials.js +1 -1
- package/dist/materials/micro-resources-all.d.ts +2 -2
- package/dist/materials/micro-resources-all.js +1 -1
- package/dist/materials/micro-resources-data.d.ts +3 -3
- package/dist/materials/micro-resources-data.js +1 -1
- package/dist/materials/micro-resources-item.d.ts +3 -3
- package/dist/materials/micro-resources-item.js +1 -1
- package/dist/materials/micro-resources.d.ts +8 -8
- package/dist/materials/micro-resources.js +1 -1
- package/dist/{ship-loadout-B5mQ1l-N.d.ts → ship-loadout-BsfKbvKe.d.ts} +56 -12
- package/dist/ships/distributor.d.ts +98 -0
- package/dist/ships/distributor.js +1 -0
- package/dist/ships/distributor.js.map +1 -0
- package/dist/ships/index.d.ts +4 -2
- package/dist/ships/index.js +1 -1
- package/dist/ships/modules-all.js +1 -1
- package/dist/ships/modules.js +1 -1
- package/dist/ships/pre-engineered-stats.js +1 -1
- package/dist/ships/ship-loadout.d.ts +2 -1
- package/dist/ships/ship-loadout.js +1 -1
- package/package.json +14 -2
- package/dist/chunk-5H74FKY7.js +0 -1
- package/dist/chunk-5H74FKY7.js.map +0 -1
- package/dist/chunk-HOKW2EWE.js +0 -1
- package/dist/chunk-HOKW2EWE.js.map +0 -1
- package/dist/chunk-JWRV67UY.js +0 -1
- package/dist/chunk-JWRV67UY.js.map +0 -1
- package/dist/chunk-TLA6LHLN.js +0 -1
- package/dist/chunk-WASJ5U5A.js +0 -1
- /package/dist/{chunk-DHOCTGWB.js.map → chunk-G3AMKCOE.js.map} +0 -0
- /package/dist/{chunk-DYFUHGJQ.js.map → chunk-KQDJTDLV.js.map} +0 -0
- /package/dist/{chunk-PRFXKOCZ.js.map → chunk-MNXWK7PA.js.map} +0 -0
- /package/dist/{chunk-NQ2ID6BF.js.map → chunk-Q22LXT53.js.map} +0 -0
- /package/dist/{chunk-ESEM3LPU.js.map → chunk-VARPO47V.js.map} +0 -0
- /package/dist/{chunk-ELIZXUMI.js.map → chunk-YDBRGW4G.js.map} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Localized game-name catalogues
|
|
2
2
|
|
|
3
3
|
These catalogues keep the canonical English display names already published by the
|
|
4
|
-
ships data domain and add only localized values carried explicitly by
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
ships data domain and add only localized values carried explicitly by accepted sources.
|
|
5
|
+
They are deliberately sparse: absence means that no accepted source carried a value, and
|
|
6
|
+
the lookup API returns `null` for that locale rather than treating English as a
|
|
7
|
+
translation.
|
|
8
8
|
|
|
9
9
|
## `module-names.jsonc`
|
|
10
10
|
|
|
@@ -58,6 +58,55 @@ a translation.
|
|
|
58
58
|
Spanish, French, Portuguese and Russian.
|
|
59
59
|
- **Manual corrections:** none.
|
|
60
60
|
|
|
61
|
+
## `material-names.jsonc`
|
|
62
|
+
|
|
63
|
+
- **Acquired:** 2026-08-16 UTC.
|
|
64
|
+
- **Odyssey Materials Helper revision:** commit
|
|
65
|
+
`23343c453938e724f317c56e9eb7db0dbfa71f78`.
|
|
66
|
+
- **Derivation:** each of the 146 current symbols and its canonical English name comes
|
|
67
|
+
from the three `data/materials/materials-*.jsonc` catalogues. The lower-cased symbol
|
|
68
|
+
joins directly to the final component of Odyssey Materials Helper's message key in
|
|
69
|
+
`locale/material/horizons/{raw,manufactured,encoded}.csv`; only that row's explicit
|
|
70
|
+
localized columns are copied. The source's English column is not copied because the
|
|
71
|
+
owning materials catalogues remain authoritative for canonical names. The canonical
|
|
72
|
+
English values therefore keep the existing `Segment` spelling and omit the source's
|
|
73
|
+
parenthetical Guardian and Thargoid category labels where the owning catalogue does;
|
|
74
|
+
localized columns remain verbatim source values.
|
|
75
|
+
- **Coverage:** English, Spanish and Russian cover all 146 materials. The explicit
|
|
76
|
+
translations cover 128 in German, 140 in French, 140 in Portuguese and 28 in
|
|
77
|
+
Georgian. Fourteen of the source's Georgian values are byte-for-byte equal to the
|
|
78
|
+
canonical English spelling and are retained verbatim; they are explicit source values,
|
|
79
|
+
not lookup-generated fallbacks. The pinned source carries no Simplified Chinese
|
|
80
|
+
material names.
|
|
81
|
+
- **Manual corrections:** none.
|
|
82
|
+
|
|
83
|
+
## `micro-resource-names.jsonc`
|
|
84
|
+
|
|
85
|
+
- **Acquired:** 2026-08-16 UTC.
|
|
86
|
+
- **Odyssey Materials Helper revision:** commit
|
|
87
|
+
`23343c453938e724f317c56e9eb7db0dbfa71f78`.
|
|
88
|
+
- **Supplemental source:** in-game verification, acquired 2026-08-16 UTC; immutable
|
|
89
|
+
revision unavailable.
|
|
90
|
+
- **Derivation:** each of the 226 current symbols and its canonical English name comes
|
|
91
|
+
from the four `data/materials/micro-resources-*.jsonc` catalogues. The 196 FDevIDs-backed
|
|
92
|
+
records join directly to the final component of Odyssey Materials Helper's message key
|
|
93
|
+
in `locale/material/odyssey/{asset,consumable,data,good}.csv`; only that row's explicit
|
|
94
|
+
localized columns are copied. Twenty-eight of the 30 in-game-backed records also have
|
|
95
|
+
rows in Odyssey Materials Helper, while `PowerVirus` and
|
|
96
|
+
`SmallCapacityPowerRegulator` do not. All 30 take the explicit in-game `name` values for
|
|
97
|
+
German, Spanish, French, Brazilian Portuguese and Russian. The Brazilian Portuguese
|
|
98
|
+
values are stored under `pt`, matching the existing catalogue values described below.
|
|
99
|
+
In both cases the owning catalogue remains authoritative for canonical English names.
|
|
100
|
+
- **Coverage:** English, Spanish and Russian cover all 226 micro resources. The explicit
|
|
101
|
+
translations cover 218 in German and Portuguese, 225 in French, 6 in Simplified Chinese
|
|
102
|
+
and 10 in Georgian. Five of the source's Georgian values are byte-for-byte equal to the
|
|
103
|
+
canonical English spelling and are retained verbatim; they are explicit source values,
|
|
104
|
+
not lookup-generated fallbacks.
|
|
105
|
+
- **Manual corrections:** the 30 in-game values labelled Brazilian Portuguese are stored
|
|
106
|
+
under `pt`, matching the 188 existing Portuguese entries because both sets contain the
|
|
107
|
+
same Brazilian Portuguese game text. `pt-BR` lookups resolve these values through the
|
|
108
|
+
regional-to-language fallback.
|
|
109
|
+
|
|
61
110
|
## Deliberate absence: ship names
|
|
62
111
|
|
|
63
112
|
- **Acquired:** 2026-08-14 UTC.
|
|
@@ -82,7 +131,7 @@ a translation.
|
|
|
82
131
|
|
|
83
132
|
## Known gaps
|
|
84
133
|
|
|
85
|
-
Localized coverage follows the
|
|
134
|
+
Localized coverage follows the accepted sources and is not complete for every catalogue or
|
|
86
135
|
locale. Missing values are observable as `null`, never an English fallback. Expanding
|
|
87
136
|
source-backed coverage, localized slot labels and higher-level generated text remains
|
|
88
137
|
tracked by [#245](https://github.com/DarkSession/Elite-Dangerous-Almanac/issues/245).
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Data sources — `data/materials/`
|
|
2
2
|
|
|
3
|
-
**Acquired:** 2026-07-24. **Upstream revision:** unavailable for both sources below.
|
|
4
|
-
|
|
5
3
|
## Materials — raw, manufactured, encoded
|
|
6
4
|
|
|
5
|
+
**Acquired:** 2026-07-24. **Upstream revision:** unavailable for both sources below.
|
|
6
|
+
|
|
7
7
|
- **Files:** `materials-raw.jsonc`, `materials-manufactured.jsonc`,
|
|
8
8
|
`materials-encoded.jsonc`.
|
|
9
9
|
- **Primary source:** EDCD FDevIDs, `material.csv`. It provides, for each material, the
|
|
@@ -52,18 +52,39 @@ grade 3), which is why it is used to fill the gap.
|
|
|
52
52
|
|
|
53
53
|
- **Files:** `micro-resources-component.jsonc`, `micro-resources-consumable.jsonc`,
|
|
54
54
|
`micro-resources-data.jsonc`, `micro-resources-item.jsonc`.
|
|
55
|
-
- **
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
- **Sources:**
|
|
56
|
+
- EDCD FDevIDs `microresources.csv`, acquired 2026-07-24; upstream revision
|
|
57
|
+
unavailable. It provides 196 records, including each internal symbol,
|
|
58
|
+
category (Component / Consumable / Data / Item) and English display name.
|
|
59
|
+
- In-game verification, acquired 2026-08-16 UTC; immutable revision unavailable. It
|
|
60
|
+
provides 30 player-facing identities absent from the FDevIDs snapshot, their internal
|
|
61
|
+
identifiers and English display names, and player categories for 29 of them.
|
|
62
|
+
`PowerMegashipData` is the exception documented under manual corrections.
|
|
63
|
+
- Inara component pages, acquired 2026-08-16 UTC; immutable revision unavailable. Its
|
|
64
|
+
six Power data pages independently classify Power Association Data, Power Classified
|
|
65
|
+
Data, Power Industrial Data, Power Injection Malware, Power Megaship Data and Power
|
|
66
|
+
Political Data as Odyssey data resources.
|
|
58
67
|
- **Derivation:**
|
|
59
|
-
- `symbol` is
|
|
60
|
-
with the same field and meaning as on a ship, module or material.
|
|
61
|
-
|
|
68
|
+
- `symbol` is the source's internal id (e.g. `graphene`) — what the player journal
|
|
69
|
+
reports with the same field and meaning as on a ship, module or material. Frontier's
|
|
70
|
+
numeric micro-resource id from the FDevIDs CSV is **not** carried.
|
|
62
71
|
- `name` is the English display name (`Graphene`).
|
|
63
|
-
-
|
|
64
|
-
(matching how ship modules and materials spell their category).
|
|
65
|
-
|
|
66
|
-
on every record.
|
|
72
|
+
- The source category is lower-cased to `component` / `consumable` / `data` / `item`
|
|
73
|
+
(matching how ship modules and materials spell their category). In-game `assets` map
|
|
74
|
+
to `component` and `goods` map to `item`. Each data file holds exactly one category,
|
|
75
|
+
so the category is represented by the file rather than repeated on every record.
|
|
67
76
|
- Micro resources have **no grade and no line** — those belong to the ship-side
|
|
68
77
|
engineering materials above; each data-file record is a plain `{ symbol, name }`
|
|
69
78
|
registry record.
|
|
79
|
+
- Three registered identities are deliberately absent: `FlightData` and
|
|
80
|
+
`Humanoid_ShieldGrenade_Bubble` have no localization and are not player-facing
|
|
81
|
+
resources; `NOCData_Tutorial` is the tutorial-only duplicate of `NOCData` and has the
|
|
82
|
+
same English display name. The localized, player-facing
|
|
83
|
+
`SmallCapacityPowerRegulator` record is retained.
|
|
84
|
+
- **Manual corrections:** `PowerMegashipData` is assigned to `data`. The encoded-material
|
|
85
|
+
classification attached to its in-game localization record is rejected: Inara
|
|
86
|
+
classifies it alongside the other five Power data resources, establishing that it is an
|
|
87
|
+
Odyssey micro resource with no material grade or line. The in-game English names are
|
|
88
|
+
otherwise retained verbatim, including
|
|
89
|
+
`Installation Intelligence Report`, `Personal Protective Equipment` and
|
|
90
|
+
`Contaminated Spire Compound` where the community table differs.
|
package/README.md
CHANGED
|
@@ -48,7 +48,8 @@ The package has six feature areas:
|
|
|
48
48
|
- `astro`: procedural names, id64 addresses, regions, nebulae and permit locks;
|
|
49
49
|
- `ships`: ships, modules, SLEF loadouts, engineering and build metrics;
|
|
50
50
|
- `equipment`: Odyssey suits, handheld weapons, grade upgrades and modifications;
|
|
51
|
-
- `i18n`: sparse localized module, blueprint
|
|
51
|
+
- `i18n`: sparse localized module, blueprint, experimental-effect, material and
|
|
52
|
+
micro-resource names;
|
|
52
53
|
- `materials`: ship engineering materials and Odyssey micro resources;
|
|
53
54
|
- `commodities`: standard and rare market goods.
|
|
54
55
|
|
|
@@ -126,15 +127,24 @@ do not bundle them. English names are complete; other locales return `null` wher
|
|
|
126
127
|
pinned sources carry no translation instead of silently substituting English:
|
|
127
128
|
|
|
128
129
|
```ts
|
|
129
|
-
import {
|
|
130
|
+
import {
|
|
131
|
+
getBlueprintName,
|
|
132
|
+
getMaterialName,
|
|
133
|
+
getMicroResourceName,
|
|
134
|
+
getModuleName,
|
|
135
|
+
} from '@elite-dangerous-almanac/core/i18n';
|
|
130
136
|
|
|
131
137
|
getModuleName('Int_Hyperdrive_Size6_Class5', 'de-DE'); // -> "Frameshiftantrieb"
|
|
132
138
|
getBlueprintName('FSD_LongRange', 'fr-FR'); // -> "Portée FSD améliorée"
|
|
139
|
+
getMaterialName('GridResistors', 'de'); // -> "Gitterwiderstände"
|
|
140
|
+
getMicroResourceName('graphene', 'fr'); // -> "Graphène"
|
|
133
141
|
```
|
|
134
142
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
143
|
+
The functions return an explicit source value verbatim, so a source-backed spelling may
|
|
144
|
+
happen to equal English; the library itself never supplies an English fallback.
|
|
145
|
+
Unqualified `zh` selects the source's Simplified Chinese (`zh-CN`) names. Explicitly
|
|
146
|
+
different Chinese scripts or regions such as `zh-TW` do not fall back to Simplified
|
|
147
|
+
Chinese and return `null` unless a matching source is added.
|
|
138
148
|
|
|
139
149
|
Registry lookups ignore case and surrounding whitespace. Material, commodity and
|
|
140
150
|
module lookups search their complete registry by default and accept an optional
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -33,7 +33,7 @@ a verbatim copy produced at build time — edit this file, never the copy.
|
|
|
33
33
|
boost and rotation through the thruster-mass and ENG-pip curves; shield strength and its
|
|
34
34
|
mass curve; shield collapse delay, regeneration and SYS-capacitor recovery timing; armour
|
|
35
35
|
hit points; resistance stacking with its diminishing returns; weapon DPS / capacitor
|
|
36
|
-
draw / heat; and WEP-pip recharge
|
|
36
|
+
draw / heat; SYS- and WEP-pip recharge; and weapons-capacitor endurance. It credits the
|
|
37
37
|
original Frontier-forum research the formulas come from.
|
|
38
38
|
- **The heat model** — the equilibrium heat level a thermal load settles at, how heat
|
|
39
39
|
moves towards it over time, and the multiplier a drained weapons capacitor puts on a
|
|
@@ -49,9 +49,10 @@ a verbatim copy produced at build time — edit this file, never the copy.
|
|
|
49
49
|
the game displays. Both
|
|
50
50
|
describe Frontier's game and fall under the same Frontier notice as every other stat
|
|
51
51
|
here; what differs is how they were arrived at, not who owns them.
|
|
52
|
-
- **The jump-range and fuel algorithm**, **per-axis ENG-pip handling**,
|
|
53
|
-
ammunition rounding** rule and the **build metrics
|
|
54
|
-
ported as fact from, EDSY (credited under Data below).
|
|
52
|
+
- **The jump-range and fuel algorithm**, **per-axis ENG-pip handling**, **ENG-capacitor
|
|
53
|
+
pip-scaled recharge**, the **engineered ammunition rounding** rule and the **build metrics
|
|
54
|
+
above** are cross-checked against, or ported as fact from, EDSY (credited under Data below).
|
|
55
|
+
The jump-range model derives from
|
|
55
56
|
Frontier's "mass effect on hyperspace range" description; Coriolis carries the same maths
|
|
56
57
|
for the metrics, and a clip round-up that omits EDSY's burst step, where EDSY is followed.
|
|
57
58
|
- **Galactic codex region lookup** — resolving a region from galactic coordinates or from a
|
|
@@ -91,7 +92,7 @@ a verbatim copy produced at build time — edit this file, never the copy.
|
|
|
91
92
|
- **[Inara](https://inara.cz/)** — the blueprint and outfitting registries behind the
|
|
92
93
|
Operations pre-engineered blueprints and shop rows, the ship pages used to corroborate
|
|
93
94
|
hull layouts, and the component pages that grade the Thargoid caustic / Titan materials
|
|
94
|
-
absent from FDevIDs.
|
|
95
|
+
absent from FDevIDs and classify Power Megaship Data as an Odyssey data resource.
|
|
95
96
|
- **[EliteDangerousRegionMap](https://github.com/klightspeed/EliteDangerousRegionMap)** by
|
|
96
97
|
**Ben Peddell** ([klightspeed](https://github.com/klightspeed)), **MIT** — the 42
|
|
97
98
|
galactic codex regions, their ids and their lookup geometry. Original region-boundary
|
|
@@ -117,8 +118,9 @@ a verbatim copy produced at build time — edit this file, never the copy.
|
|
|
117
118
|
**Jixxed**, **MIT** — supplies the personal suit and handheld-weapon identities, stats,
|
|
118
119
|
journal symbols, grade-upgrade recipes and engineer-applied modification recipes. A
|
|
119
120
|
CAPI response in its test resources also corroborates the six bundle-granted Vessel
|
|
120
|
-
Hangar variants.
|
|
121
|
-
|
|
121
|
+
Hangar variants. Its language tables supply localized engineering-material and Odyssey
|
|
122
|
+
micro-resource display names. The values and response are factual Elite Dangerous game
|
|
123
|
+
data. Its MIT notice is reproduced below.
|
|
122
124
|
- **[msarilar/EDEngineer](https://github.com/msarilar/EDEngineer)**, **MIT** for its code
|
|
123
125
|
— its `blueprints.json` corroborates which weapons the Overcharged recipe gives a clip
|
|
124
126
|
penalty to. The values are game data.
|
|
@@ -201,8 +203,8 @@ add it here and record the provenance where the data lives.
|
|
|
201
203
|
|
|
202
204
|
## Odyssey Materials Helper license
|
|
203
205
|
|
|
204
|
-
The personal-equipment data
|
|
205
|
-
is reproduced as required:
|
|
206
|
+
The personal-equipment data and localized material and micro-resource name tables are
|
|
207
|
+
derived from Odyssey Materials Helper, whose MIT notice is reproduced as required:
|
|
206
208
|
|
|
207
209
|
```
|
|
208
210
|
Copyright (c) 2026 Jixxed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{normalizeKey,CATALOGUE_KEY,findInKeyIndex}from"./chunk-S4DBNX2B.js";import{requireString}from"./chunk-B5TT26XE.js";var CANONICAL_LOCALE=Object.freeze({en:"en",de:"de",es:"es",fr:"fr",hu:"hu",it:"it",ka:"ka",pt:"pt","pt-br":"pt-BR",ru:"ru","zh-cn":"zh-CN"});function canonicalLocale(locale){return Object.hasOwn(CANONICAL_LOCALE,locale)?CANONICAL_LOCALE[locale]:void 0}function localeCandidates(locale,label){const normalized=requireString(locale,label).trim().replaceAll("_","-").toLowerCase();if(normalized==="zh"||normalized==="zh-hans"||normalized.startsWith("zh-hans-")){return["zh-CN"]}if(normalized.startsWith("zh-")&&normalized!=="zh-cn")return[];const exact=canonicalLocale(normalized);const language=canonicalLocale(normalized.split("-",1)[0]);if(exact===void 0)return language===void 0?[]:[language];return language===void 0||language===exact?[exact]:[exact,language]}function createLocalizedNameIndex(names){const index=/* @__PURE__ */Object.create(null);for(const[identifier,name]of Object.entries(names)){const key=normalizeKey(identifier,CATALOGUE_KEY);if(!Object.hasOwn(index,key))index[key]=name}return Object.freeze(index)}function createDeduplicatedLocalizedNameIndex(catalogue){const index=/* @__PURE__ */Object.create(null);for(const[identifier,nameKey]of Object.entries(catalogue.nameKeys)){const name=catalogue.names[nameKey];if(name===void 0)continue;const key=normalizeKey(identifier,CATALOGUE_KEY);if(!Object.hasOwn(index,key))index[key]=name}return Object.freeze(index)}function selectLocalizedName(names,locale,functionName){const candidates=localeCandidates(locale,`${functionName}: locale`);if(names===null)return null;for(const candidate of candidates){const name=names[candidate];if(name!==void 0)return name}return null}function getLocalizedName(names,identifier,locale,functionName,identifierName){const record=findInKeyIndex(names,identifier,`${functionName}: ${identifierName}`);return selectLocalizedName(record,locale,functionName)}export{createDeduplicatedLocalizedNameIndex,createLocalizedNameIndex,getLocalizedName};//# sourceMappingURL=chunk-4AE22CHV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/i18n/internal/localized-name.ts"],"names":["normalizeKey","CATALOGUE_KEY","findInKeyIndex","requireString","CANONICAL_LOCALE","Object","freeze","en","de","es","fr","hu","it","ka","pt","ru","canonicalLocale","locale","hasOwn","localeCandidates","label","normalized","trim","replaceAll","toLowerCase","startsWith","exact","language","split","createLocalizedNameIndex","names","index","create","identifier","name","entries","key","createDeduplicatedLocalizedNameIndex","catalogue","nameKey","nameKeys","selectLocalizedName","functionName","candidates","candidate","getLocalizedName","identifierName","record"],"mappings":"O,mHA4BA,IAAMI,iBAA8DC,OAAOC,OAAO,CAC9EC,GAAI,KACJC,GAAI,KACJC,GAAI,KACJC,GAAI,KACJC,GAAI,KACJC,GAAI,KACJC,GAAI,KACJC,GAAI,KACJ,QAAS,QACTC,GAAI,KACJ,QAAS,UAIb,SAASC,gBAAgBC,QACrB,OAAOZ,OAAOa,OAAOd,iBAAkBa,QAAUb,iBAAiBa,aAAU,CAChF,CAMA,SAASE,iBAAiBF,OAAgBG,OACtC,MAAMC,W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Zf,MACAG,WACAhB,OACAyB,aACAI,gBAEA,MAAMC,OAAS7C,eAAe4B,MAAOG,WAAY,GAAGS,iBAAiBI,kBACrE,OAAOL,oBAAoBM,OAAQ9B,OAAQyB,aAC/C,QAAAL,qCAAAR,yBAAAgB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DATA_MICRO_RESOURCES}from"./chunk-GVLDFJEY.js";import{ITEM_MICRO_RESOURCES}from"./chunk-WHWFKHV3.js";import{COMPONENT_MICRO_RESOURCES}from"./chunk-HTB52N6S.js";import{CONSUMABLE_MICRO_RESOURCES}from"./chunk-K7L7SMIR.js";var ALL_MICRO_RESOURCES=Object.freeze([...COMPONENT_MICRO_RESOURCES,...CONSUMABLE_MICRO_RESOURCES,...DATA_MICRO_RESOURCES,...ITEM_MICRO_RESOURCES]);export{ALL_MICRO_RESOURCES};//# sourceMappingURL=chunk-4WC5NHBJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/materials/micro-resources-all.ts"],"names":["DATA_MICRO_RESOURCES","ITEM_MICRO_RESOURCES","COMPONENT_MICRO_RESOURCES","CONSUMABLE_MICRO_RESOURCES","ALL_MICRO_RESOURCES","Object","freeze"],"mappings":"O,4NA6BO,IAAMI,oBAAgDC,OAAOC,OAAO,IACpEJ,6BACAC,8BACAH,wBACAC,8BACNG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CORE_MODULES}from"./chunk-O72KI7RP.js";import{HARDPOINT_MODULES}from"./chunk-BSOIPL4A.js";import{INTERNAL_MODULES}from"./chunk-NSSWYRHN.js";import{UTILITY_MODULES}from"./chunk-3IMWUYXJ.js";var ALL_MODULES=Object.freeze([...CORE_MODULES,...INTERNAL_MODULES,...HARDPOINT_MODULES,...UTILITY_MODULES]);export{ALL_MODULES};//# sourceMappingURL=chunk-53ERRGPM.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ships/modules-all.ts"],"names":["
|
|
1
|
+
{"version":3,"sources":["../src/ships/modules-all.ts"],"names":["CORE_MODULES","HARDPOINT_MODULES","INTERNAL_MODULES","UTILITY_MODULES","ALL_MODULES","Object","freeze"],"mappings":"O,6LA0CO,IAAMI,YAA2CC,OAAOC,OAAO,IAC/DN,gBACAE,oBACAD,qBACAE,yBACNC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{weaponsCapacitorMetrics}from"./chunk-FMPRCYKY.js";import{shieldRecovery,cellBankSummary}from"./chunk-MPZGCTRG.js";import{shieldMetrics}from"./chunk-2FHHMYDC.js";import{getShipSlots,getShipBySymbol,getShipByName}from"./chunk-IJRKEODR.js";import{parseSlef,toSlef,stringifySlef,getLoadoutModifier}from"./chunk-RKLJ7EEE.js";import{enumerateSlots,parseSlotName,SLOT_RESTRICTION_LABELS}from"./chunk-I7PIDRMU.js";import{sourcePurchaseFromLoadout,getSourceModuleValue}from"./chunk-QTDBO7R2.js";import{powerBudget}from"./chunk-76XKY2Y2.js";import{isNonOutfittingSlot,isBuiltInHullModule,cloneLoadoutModule,identifyPreEngineeredVariant,cloneModuleStats,availableBlueprintsFor,availableExperimentalsFor,blueprintAvailableFor,blueprintRoutesFor,experimentalAvailableFor,primitiveEngineeringInputsFor,missingBaseLabels,journalModifiersFor,getPreEngineeredStats,unresolvedModifiers,getPreEngineeredJournalModifiers,getPreEngineeredModifiers,matchingKeyIn,FITTED_ITEM,isFinalGuardianWeaponEngineering,scaleDamageComponents}from"./chunk-KLIYDSYF.js";import{weaponMetrics,sumWeaponMetrics,combinedRateOfFire}from"./chunk-LJI7VXJD.js";import{builtInModuleBySymbol,getBulkheadsForShip}from"./chunk-MNXWK7PA.js";import{getPreEngineeredVariants}from"./chunk-32PVERNH.js";import{singleJumpRange,frameShiftDriveMassFactor,fuelPerJump,totalRange}from"./chunk-GQ5GX5TB.js";import{completeResult,calculateUnladenMass,calculateCargoCapacity,calculateFuelCapacity}from"./chunk-RF2IKLWQ.js";import{validateLoadout}from"./chunk-5W43EQEQ.js";import{mobilityMetrics}from"./chunk-24INI4U7.js";import{calculateModuleLimits}from"./chunk-KPETDYQX.js";import{ALL_MODULES}from"./chunk-53ERRGPM.js";import{CORE_MODULES}from"./chunk-O72KI7RP.js";import{getDefaultLoadout}from"./chunk-V3DW67W2.js";import{distributorMetrics}from"./chunk-P2QOL63K.js";import{getExperimentalEffect}from"./chunk-PMJG7PHU.js";import{heatMetrics}from"./chunk-QMQHIZGS.js";import{ammunitionCapacity}from"./chunk-AA3K5XUE.js";import{armourMetrics}from"./chunk-FGXWVFN6.js";import{baseStats,computeModifiers,labelsForDamageType,scaleForLabel,fieldForLabel,labelsForField,capabilityValueForLabel,damageTypeForLabel}from"./chunk-SVZARHWP.js";import{resolveBlueprintForModule}from"./chunk-ZJB5UYNE.js";import{getExperimentalsForModule}from"./chunk-TH4S5MVD.js";import{getBlueprintGrade}from"./chunk-DNTN34M4.js";import{normalizeKey}from"./chunk-S4DBNX2B.js";import{truncate,describeValue,requireString,requireStringIfPresent}from"./chunk-B5TT26XE.js";import{deepFreeze}from"./chunk-DURKO7JU.js";var PREFIX={powerPlant:["int_powerplant","int_guardianpowerplant"],thrusters:["int_engine","int_mkiiagileboost_engine"],frameShiftDrive:["int_hyperdrive"],powerDistributor:["int_powerdistributor","int_guardianpowerdistributor"],shieldGenerator:["int_shieldgenerator"],shieldCellBank:["int_shieldcellbank"],shieldBooster:["hpt_shieldbooster"],shieldReinforcement:["int_guardianshieldreinforcement"],hullReinforcement:["int_hullreinforcement","int_guardianhullreinforcement","int_metaalloyhullreinforcement"],moduleReinforcement:["int_modulereinforcement","int_guardianmodulereinforcement"]};var startsWithAny=(symbol,prefixes)=>prefixes.some(prefix=>symbol.toLowerCase().startsWith(prefix));function isPowerDistributor(module,stats){return stats?.slot?stats.slot==="powerDistributor":startsWithAny(module.Item,PREFIX.powerDistributor)}function isEnabled(module){return module.On!==false}function priorityOf(module){return(module.Priority??0)+1}function effectiveStat(module,field,stats){const stated=statedModifier(module,field);if(stated!==void 0)return stated;const base=stats?.[field];return typeof base==="number"?base:void 0}function statedModifier(module,field){for(const label of labelsForField(field)){if(capabilityValueForLabel(label)!==null)continue;const modified=getLoadoutModifier(module,label);if(modified!==null)return modified/scaleForLabel(label)}return void 0}function effectiveCapability(module,field,stats){for(const label of labelsForField(field)){if(capabilityValueForLabel(label)===null)continue;if(module.Engineering?.Modifiers?.some(modifier=>modifier.Label.toLowerCase()===label.toLowerCase())){return true}}const base=stats[field];return typeof base==="boolean"?base:void 0}function effectiveDamageDistribution(module,stats){const fromEffect=module.Engineering?.ExperimentalEffect?getExperimentalEffect(module.Engineering.ExperimentalEffect)?.damageDistribution:void 0;const distribution={...fromEffect??stats.damageDistribution};let resolved=fromEffect!==void 0||stats.damageDistribution!==void 0;for(const modifier of module.Engineering?.Modifiers??[]){if(modifier.Value===void 0)continue;const type=damageTypeForLabel(modifier.Label);if(type===null)continue;distribution[type]=modifier.Value/scaleForLabel(modifier.Label);resolved=true}return resolved?distribution:void 0}function convertsDamage(module){if(module.Engineering?.ExperimentalEffect&&getExperimentalEffect(module.Engineering.ExperimentalEffect)?.damageDistribution){return true}return(module.Engineering?.Modifiers??[]).some(modifier=>damageTypeForLabel(modifier.Label)!==null)}function modifierRatio(module,stats,field){const base=stats?.[field];if(typeof base!=="number"||base===0)return 1;const effective=effectiveStat(module,field,stats);return effective===void 0?1:effective/base}function relatedStat(module,stats,field,ratio){const stated=statedModifier(module,field);if(stated!==void 0)return stated;const base=stats?.[field];return typeof base==="number"?base*ratio:void 0}function effectiveModule(module,stats){if(!stats||!module.Engineering)return stats;const merged={...stats};const fields=new Set(Object.keys(stats));for(const modifier of module.Engineering.Modifiers??[]){const field=fieldForLabel(modifier.Label,stats);if(field)fields.add(field)}for(const key of fields){const capability=effectiveCapability(module,key,stats);if(capability!==void 0){merged[key]=capability;continue}const value=effectiveStat(module,key,stats);if(value!==void 0)merged[key]=value}if(stats.engineeringGroup==="thrusters"){const massRatio=modifierRatio(module,stats,"optMass");const minMass=relatedStat(module,stats,"minMass",massRatio);const maxMass=relatedStat(module,stats,"maxMass",massRatio);if(minMass!==void 0)merged.minMass=minMass;if(maxMass!==void 0)merged.maxMass=maxMass}if(stats.engineeringGroup==="thrusters"||stats.engineeringGroup==="shieldGenerators"){const performanceRatio=modifierRatio(module,stats,"optMultiplier");const minMultiplier=relatedStat(module,stats,"minMultiplier",performanceRatio);const maxMultiplier=relatedStat(module,stats,"maxMultiplier",performanceRatio);if(minMultiplier!==void 0)merged.minMultiplier=minMultiplier;if(maxMultiplier!==void 0)merged.maxMultiplier=maxMultiplier;if(stats.engineeringGroup==="thrusters"){for(const field of["minSpeedMultiplier","optSpeedMultiplier","maxSpeedMultiplier","minRotationMultiplier","optRotationMultiplier","maxRotationMultiplier"]){const value=stats[field];if(value!==void 0)merged[field]=value*performanceRatio}}}const damageDistribution=effectiveDamageDistribution(module,stats);if(damageDistribution)merged.damageDistribution=damageDistribution;if(stats.category==="hardpoint")normalizeEffectiveWeapon(module,merged);if(convertsDamage(module)){delete merged.damageComponents}else if(stats.damageComponents){merged.damageComponents=scaleDamageComponents(stats.damageComponents,stats.damage,typeof merged.damage==="number"?merged.damage:void 0)}return merged}function powerConsumerFor(module,stats){const draw=effectiveStat(module,"powerDraw",stats);const parsedSlot=parseSlotName(module.Slot);const mounted=stats?.category==="hardpoint"||stats?.category==="utility";const deployedOnly=stats!==null?mounted&&stats.alwaysPowered!==true:parsedSlot?.kind==="hardpoint"?true:parsedSlot?.kind==="utility"?void 0:false;const common={priority:priorityOf(module),enabled:isEnabled(module),...deployedOnly===void 0?{}:{deployedOnly:deployedOnly},label:module.Slot};if(draw===void 0){const inherentlyPassiveSlot=parsedSlot?.kind==="armour"||parsedSlot?.kind==="core"&&(parsedSlot.core==="powerPlant"||parsedSlot.core==="fuelTank");if(stats!==null||inherentlyPassiveSlot||isNonOutfittingSlot(module.Slot))return null;return{drawUnknown:true,...common}}if(draw===0)return null;return{draw:draw,...common}}function powerAvailable(modules,statsFor){for(const module of modules){const stats=statsFor(module);const isPlant=stats?.slot?stats.slot==="powerPlant":startsWithAny(module.Item,PREFIX.powerPlant);if(!isPlant)continue;if(!isEnabled(module))return 0;return effectiveStat(module,"powerCapacity",stats)??0}return 0}function mapResistanceFields(read){return{kineticResistance:read("kineticResistance")??0,thermalResistance:read("thermalResistance")??0,explosiveResistance:read("explosiveResistance")??0,causticResistance:read("causticResistance")??0}}function resistancesOf(module,stats){return mapResistanceFields(field=>effectiveStat(module,field,stats))}function shieldInputFor(shipSymbol,modules,systemsPips,statsFor){const hull=getShipBySymbol(shipSymbol);let generator=null;const boosters=[];let reinforcement=0;for(const module of modules){if(!isEnabled(module))continue;const stats=statsFor(module);if(!generator&&startsWithAny(module.Item,PREFIX.shieldGenerator)){const massRatio=modifierRatio(module,stats,"optMass");const strengthRatio=modifierRatio(module,stats,"optMultiplier");const optMass=effectiveStat(module,"optMass",stats);const minMass=relatedStat(module,stats,"minMass",massRatio);const maxMass=relatedStat(module,stats,"maxMass",Math.max(1,massRatio));const optMultiplier=effectiveStat(module,"optMultiplier",stats);const minMultiplier=relatedStat(module,stats,"minMultiplier",strengthRatio);const maxMultiplier=relatedStat(module,stats,"maxMultiplier",strengthRatio);generator={...optMass===void 0?{}:{optMass:optMass},...minMass===void 0?{}:{minMass:minMass},...maxMass===void 0?{}:{maxMass:maxMass},...optMultiplier===void 0?{}:{optMultiplier:optMultiplier},...minMultiplier===void 0?{}:{minMultiplier:minMultiplier},...maxMultiplier===void 0?{}:{maxMultiplier:maxMultiplier},...resistancesOf(module,stats)}}else if(startsWithAny(module.Item,PREFIX.shieldBooster)){boosters.push({shieldBoost:effectiveStat(module,"shieldBoost",stats)??0,...resistancesOf(module,stats)})}else if(startsWithAny(module.Item,PREFIX.shieldReinforcement)){reinforcement+=effectiveStat(module,"shieldAddition",stats)??0}}return{hullMass:hull?.hullMass??0,baseShieldStrength:hull?.baseShieldStrength??0,generator:generator,boosters:boosters,reinforcement:reinforcement,systemsPips:systemsPips}}function mobilityInputFor(shipSymbol,modules,mass,enginesPips,statsFor){const hull=getShipBySymbol(shipSymbol);if(!hull)return null;let thrusters=null;for(const module of modules){const stats=statsFor(module);const isThruster=stats?.slot?stats.slot==="thrusters":startsWithAny(module.Item,PREFIX.thrusters);if(!isThruster)continue;if(!isEnabled(module))return null;const effective=effectiveModule(module,stats);const minMass=effective?.minMass;const optMass=effective?.optMass;const maxMass=effective?.maxMass;const minMultiplier=effective?.minMultiplier;const optMultiplier=effective?.optMultiplier;const maxMultiplier=effective?.maxMultiplier;if(minMass===void 0||optMass===void 0||maxMass===void 0||minMultiplier===void 0||optMultiplier===void 0||maxMultiplier===void 0){return null}thrusters={minMass:minMass,optMass:optMass,maxMass:maxMass,minMultiplier:minMultiplier,optMultiplier:optMultiplier,maxMultiplier:maxMultiplier,...effective?.optSpeedMultiplier===void 0?{}:{speedCurve:{minMass:minMass,optMass:optMass,maxMass:maxMass,minMultiplier:effective.minSpeedMultiplier??minMultiplier,optMultiplier:effective.optSpeedMultiplier,maxMultiplier:effective.maxSpeedMultiplier??maxMultiplier}},...effective?.optRotationMultiplier===void 0?{}:{rotationCurve:{minMass:minMass,optMass:optMass,maxMass:maxMass,minMultiplier:effective.minRotationMultiplier??minMultiplier,optMultiplier:effective.optRotationMultiplier,maxMultiplier:effective.maxRotationMultiplier??maxMultiplier}}};break}if(!thrusters)return null;return{minimumSpeed:hull.minimumSpeed,maximumSpeed:hull.maximumSpeed,boost:hull.boost,minPitch:hull.minPitch,pitch:hull.pitch,minRoll:hull.minRoll,roll:hull.roll,minYaw:hull.minYaw,yaw:hull.yaw,mass:typeof mass==="function"?mass():mass,thrusters:thrusters,enginesPips:enginesPips}}function shieldRecoveryInputFor(shipSymbol,modules,systemsPips,statsFor){let generator=null;let distributor=null;for(const module of modules){const stats=statsFor(module);if(!generator&&startsWithAny(module.Item,PREFIX.shieldGenerator)){if(!isEnabled(module))return null;generator=module}if(isPowerDistributor(module,stats)&&isEnabled(module))distributor=module}if(!generator)return null;const generatorStats=statsFor(generator);const distributorStats=distributor?statsFor(distributor):null;const strength=shieldMetrics(shieldInputFor(shipSymbol,modules,0,statsFor)).strength;return{strength:strength,regenRate:effectiveStat(generator,"shieldRegenRate",generatorStats)??0,brokenRegenRate:effectiveStat(generator,"shieldBrokenRegenRate",generatorStats)??0,distributorDraw:effectiveStat(generator,"distributorDraw",generatorStats)??.6,systemsCapacity:distributor?effectiveStat(distributor,"systemsCapacity",distributorStats)??0:0,systemsRecharge:distributor?effectiveStat(distributor,"systemsRecharge",distributorStats)??0:0,systemsPips:systemsPips}}function weaponsCapacitorInputFor(modules,weaponsPips,budget,statsFor){let weaponsCapacity=0;let weaponsRecharge=0;let sustainedEnergyPerSecond=0;for(const module of modules){if(!isEnabled(module))continue;const stats=statsFor(module);if(!poweredStates(module,stats,budget).deployed)continue;if(isPowerDistributor(module,stats)){weaponsCapacity=effectiveStat(module,"weaponsCapacity",stats)??0;weaponsRecharge=effectiveStat(module,"weaponsRecharge",stats)??0}const weapon=weaponStatsFor(module,stats);if(weapon){sustainedEnergyPerSecond+=weaponMetrics(weapon).sustainedEnergyPerSecond}}return{weaponsCapacity:weaponsCapacity,weaponsRecharge:weaponsRecharge,sustainedEnergyPerSecond:sustainedEnergyPerSecond,weaponsPips:weaponsPips}}function distributorInputFor(modules,pips,budget,statsFor){for(const module of modules){if(!isEnabled(module))continue;const stats=statsFor(module);if(!isPowerDistributor(module,stats))continue;if(!poweredStates(module,stats,budget).retracted)return null;const systemsCapacity=effectiveStat(module,"systemsCapacity",stats);const systemsRecharge=effectiveStat(module,"systemsRecharge",stats);const enginesCapacity=effectiveStat(module,"enginesCapacity",stats);const enginesRecharge=effectiveStat(module,"enginesRecharge",stats);const weaponsCapacity=effectiveStat(module,"weaponsCapacity",stats);const weaponsRecharge=effectiveStat(module,"weaponsRecharge",stats);if(systemsCapacity===void 0||systemsRecharge===void 0||enginesCapacity===void 0||enginesRecharge===void 0||weaponsCapacity===void 0||weaponsRecharge===void 0){return null}return{systemsCapacity:systemsCapacity,systemsRecharge:systemsRecharge,enginesCapacity:enginesCapacity,enginesRecharge:enginesRecharge,weaponsCapacity:weaponsCapacity,weaponsRecharge:weaponsRecharge,...pips}}return null}function heatInputFor(shipSymbol,modules,budget,statsFor){const hull=getShipBySymbol(shipSymbol);if(!hull)return null;let heatEfficiency;let thrusterHeatRate=0;let deployedThrusterHeatRate=0;let fsdHeatRate=0;let weaponsCapacity=0;const weapons=[];for(const module of modules){const stats=statsFor(module);const isPlant=stats?.slot?stats.slot==="powerPlant":startsWithAny(module.Item,PREFIX.powerPlant);if(isPlant){if(!isEnabled(module))return null;heatEfficiency=effectiveStat(module,"heatEfficiency",stats);continue}if(!isEnabled(module))continue;const running=poweredStates(module,stats,budget);if(stats?.slot?stats.slot==="thrusters":startsWithAny(module.Item,PREFIX.thrusters)){const heat=effectiveStat(module,"engineHeatRate",stats)??0;if(running.retracted)thrusterHeatRate+=heat;if(running.deployed)deployedThrusterHeatRate+=heat}else if(stats?.slot?stats.slot==="frameShiftDrive":startsWithAny(module.Item,PREFIX.frameShiftDrive)){if(running.retracted)fsdHeatRate+=effectiveStat(module,"fsdHeatRate",stats)??0}else if(isPowerDistributor(module,stats)){if(running.deployed){weaponsCapacity=effectiveStat(module,"weaponsCapacity",stats)??0}}const weapon=weaponStatsFor(module,stats);if(!weapon||!running.deployed)continue;weapons.push({heatPerSecond:weaponMetrics(weapon).sustainedHeatPerSecond,distributorDraw:weapon.distributorDraw??0})}if(heatEfficiency===void 0)return null;return{heatCapacity:hull.heatCapacity,heatDissipation:hull.heatDissipation,heatEfficiency:heatEfficiency,retractedPowerDraw:poweredDraw(budget,"retracted"),deployedPowerDraw:poweredDraw(budget,"deployed"),thrusterHeatRate:thrusterHeatRate,deployedThrusterHeatRate:deployedThrusterHeatRate,fsdHeatRate:fsdHeatRate,weaponsCapacity:weaponsCapacity,weapons:weapons,unknownDraws:budget.unknownDraws.map(consumer=>consumer.label??"(unnamed module)")}}function poweredDraw(budget,state){const powered=state==="retracted"?"poweredRetracted":"poweredDeployed";return budget.bands.reduce((total,band)=>band[powered]?total+band[state]:total,0)}function poweredStates(module,stats,budget){const draw=effectiveStat(module,"powerDraw",stats);if(draw===void 0||draw===0)return{retracted:true,deployed:true};const band=budget.bands[Math.min(budget.bands.length,Math.max(1,priorityOf(module)))-1];if(!band)return{retracted:true,deployed:true};return{retracted:band.poweredRetracted,deployed:band.poweredDeployed}}function cellBankInputsFor(modules,statsFor){const banks=[];for(const module of modules){if(!startsWithAny(module.Item,PREFIX.shieldCellBank))continue;const effective=effectiveModule(module,statsFor(module));const ammunition=effective?ammunitionCapacity(effective):null;banks.push({slot:module.Slot,symbol:module.Item,reinforcementRate:effective?.shieldBankReinforcement??0,cells:ammunition?.total??0,spinUp:effective?.shieldBankSpinUp??0,duration:effective?.shieldBankDuration??0,heat:effective?.shieldBankHeat??0})}return banks}function stockBulkhead(shipSymbol){const hull=getShipBySymbol(shipSymbol);if(!hull)return null;const variants=getBulkheadsForShip(hull.name,CORE_MODULES);return variants.find(v=>v.symbol.toLowerCase().endsWith("_default"))??variants.find(v=>v.mass===0)??variants[0]??null}function armourInputFor(shipSymbol,modules,statsFor){const hull=getShipBySymbol(shipSymbol);const reinforcements=[];const moduleReinforcements=[];let bulkhead=null;for(const module of modules){if(!isEnabled(module))continue;const stats=statsFor(module);if(module.Slot.toLowerCase()==="armour"){bulkhead={hullBoost:effectiveStat(module,"hullBoost",stats)??0,...resistancesOf(module,stats)}}else if(startsWithAny(module.Item,PREFIX.hullReinforcement)){const boost=getLoadoutModifier(module,"DefenceModifierHealthMultiplier");reinforcements.push({hullReinforcement:effectiveStat(module,"hullReinforcement",stats)??0,hullBoost:boost===null?0:boost/scaleForLabel("DefenceModifierHealthMultiplier"),...resistancesOf(module,stats)})}else if(startsWithAny(module.Item,PREFIX.moduleReinforcement)){moduleReinforcements.push({moduleProtection:effectiveStat(module,"moduleProtection",stats)??0,integrity:effectiveStat(module,"integrity",stats)??0})}}if(!bulkhead){const stock=stockBulkhead(shipSymbol);bulkhead=stock?{hullBoost:stock.hullBoost??0,...mapResistanceFields(field=>stock[field])}:null}return{baseArmour:hull?.baseArmour??0,bulkhead:bulkhead,reinforcements:reinforcements,moduleReinforcements:moduleReinforcements}}var WEAPON_FIELDS=["damage","roundsPerShot","rateOfFire","burstInterval","burstRounds","burstRateOfFire","chargeTime","clipSize","ammoMaximum","reloadTime","distributorDraw","thermalLoad","powerDraw","maximumRange","falloffRange","armourPiercing"];function weaponStatsFor(module,stats){if(!stats||stats.category!=="hardpoint")return null;const weapon={};for(const field of WEAPON_FIELDS){const value=effectiveStat(module,field,stats);if(value!==void 0)weapon[field]=value}normalizeEffectiveWeapon(module,weapon);const damageDistribution=effectiveDamageDistribution(module,stats);if(damageDistribution)weapon.damageDistribution=damageDistribution;if(stats.damageComponents&&!convertsDamage(module)){weapon.damageComponents=scaleDamageComponents(stats.damageComponents,stats.damage,typeof weapon.damage==="number"?weapon.damage:void 0)}if(stats.projectileRange)weapon.projectileRange={...stats.projectileRange};return weapon}function burstAdjustedRateOfFire(module,weapon){if(getLoadoutModifier(module,"RateOfFire")!==null)return void 0;const touched=["BurstSize","BurstRateOfFire","BurstInterval"].some(label=>getLoadoutModifier(module,label)!==null);if(!touched)return void 0;return combinedRateOfFire(weapon)}function normalizeEffectiveWeapon(module,weapon){const rate=burstAdjustedRateOfFire(module,weapon);if(rate!==void 0)weapon.rateOfFire=rate;const statedDamagePerSecond=getLoadoutModifier(module,"DamagePerSecond");const firingFactor=Number(weapon.roundsPerShot??1)*Number(weapon.rateOfFire??1);if(statedDamagePerSecond!==null&&firingFactor>0){weapon.damage=statedDamagePerSecond/firingFactor}const{maximumRange:maximumRange,falloffRange:falloffRange}=weapon;if(maximumRange!==void 0&&falloffRange!==void 0&&falloffRange>maximumRange){weapon.falloffRange=maximumRange}}var CORE_NAMES={powerPlant:"Power Plant",thrusters:"Thrusters",frameShiftDrive:"Frame Shift Drive",lifeSupport:"Life Support",powerDistributor:"Power Distributor",sensors:"Sensors",fuelTank:"Fuel Tank"};var RESTRICTED_OPTIONAL_NAMES={military:"Military Slot",cargo:"Cargo Slot",limpetController:"Limpet Controller Slot",vesselHangar:"Vessel Hangar Slot",passenger:"Passenger Slot"};function trailingDigits(key){let start=key.length;while(start>0){const code=key.charCodeAt(start-1);if(code<48||code>57)break;start--}return start===key.length?null:key.slice(start)}function loadoutSlotName(slot){switch(slot.kind){case"core":return CORE_NAMES[slot.core];case"hardpoint":{const match=/^(Small|Medium|Large|Huge)(Mining)?Hardpoint(\d+)$/.exec(slot.key);if(!match)return slot.key;return`${match[1]}${match[2]?" Mining":""} Hardpoint ${Number(match[3])}`}case"utility":{const match=/^TinyHardpoint(\d+)$/.exec(slot.key);return match?`Utility Mount ${Number(match[1])}`:slot.key}case"optional":{if(slot.restriction==="planetaryApproachSuite")return"Planetary Approach Suite";if(slot.restriction){const numbered=trailingDigits(slot.key);const label=RESTRICTED_OPTIONAL_NAMES[slot.restriction];return label&&numbered?`${label} ${Number(numbered)}`:slot.key}const optional=/^Slot(\d+)_Size(\d+)$/.exec(slot.key);return optional?`Optional Internal ${Number(optional[1])} (Size ${slot.size})`:slot.key}case"armour":return"Armour";case"cargoHatch":return"Cargo Hatch"}}var MILITARY_PREFIXES=["int_hullreinforcement","int_metaalloyhullreinforcement","int_modulereinforcement","int_shieldcellbank","int_guardianhullreinforcement","int_guardianmodulereinforcement","int_guardianshieldreinforcement"];var MINING_PREFIXES=["hpt_mininglaser","hpt_mining_abrblstr","hpt_mining_seismchrgwarhd","hpt_mining_subsurfdispmisle","hpt_human_extraction","hpt_miningtoolv2"];var CARGO_PREFIXES=["int_cargorack","int_largecargorack","int_corrosionproofcargorack","int_fueltank"];var RESTRICTED_SLOT_PREFIXES={mining:MINING_PREFIXES,military:MILITARY_PREFIXES,cargo:CARGO_PREFIXES,limpetController:["int_dronecontrol","int_multidronecontrol"],vesselHangar:["int_fighterbay"],passenger:["int_passengercabin","int_mkii_passengercabin"],planetaryApproachSuite:["int_planetapproachsuite"]};var problem=(constraint,message,params)=>({constraint:constraint,message:message,...params===void 0?{}:{params:params}});function restrictionProblem(slot,symbol){const restriction=slot.restriction;if(!restriction)return null;if(RESTRICTED_SLOT_PREFIXES[restriction].some(prefix=>symbol.startsWith(prefix))){return null}return problem("restrictedMount",`slot only takes ${SLOT_RESTRICTION_LABELS[restriction]}`,{restriction:restriction})}function moduleSlotProblem(slot,module){const required=module.restrictedToSlot;if(!required||slot.restriction===required)return null;return problem("restrictedMount",`module only fits a mount that takes ${SLOT_RESTRICTION_LABELS[required]}`,{restriction:required})}function moduleFitProblem(shipSymbol,slot,module){if(slot.kind==="cargoHatch"){return problem("immutableSlot","the cargoHatch slot cannot be changed")}if(slot.kind==="armour"){const hull=getShipBySymbol(shipSymbol);if(module.slot!=="armour"||module.ship===void 0){return problem("armourRequired","not a ship armour module")}if(!hull||module.ship.toLowerCase()!==hull.name.toLowerCase()){const armourHull=getShipByName(module.ship);return problem("wrongHullArmour",`armour belongs to ${truncate(module.ship)}, not ${truncate(hull?.name??shipSymbol)}`,{armourShipName:module.ship,...armourHull===null?{}:{armourShipSymbol:armourHull.symbol},shipSymbol:shipSymbol,...hull===null?{}:{shipName:hull.name}})}return null}const restricted=module.restrictedToShips;if(restricted&&!restricted.some(symbol2=>symbol2.toLowerCase()===shipSymbol.toLowerCase())){const allowedShipNames=restricted.map(symbol2=>{const hull=getShipBySymbol(symbol2);return hull?.name??symbol2});const labels=restricted.map((symbol2,index)=>{const name=allowedShipNames[index];return name===symbol2?symbol2:`${name} (${symbol2})`});return problem("restrictedHull",`module is restricted to ${truncate(labels.join(", "))}`,{allowedShipNames:allowedShipNames,allowedShipSymbols:[...restricted],shipSymbol:shipSymbol})}const wrongMount=moduleSlotProblem(slot,module);if(wrongMount)return wrongMount;const symbol=module.symbol.toLowerCase();const moduleSlot=module.slot;switch(slot.kind){case"core":if(moduleSlot!==slot.core){return problem("wrongCoreType",`not a ${slot.core} module`,{requiredCore:slot.core,moduleSlot:moduleSlot??"none"})}break;case"hardpoint":{if(module.category!=="hardpoint"){return problem("hardpointRequired","not a hardpoint weapon")}const restricted2=restrictionProblem(slot,symbol);if(restricted2)return restricted2;break}case"utility":if(module.category!=="utility"){return problem("utilityRequired","not a utility module")}return null;case"optional":{const isFuelTank=moduleSlot==="fuelTank";if(module.category!=="internal"&&!isFuelTank){return problem("optionalInternalRequired","not an optional-internal module")}if(moduleSlot&&!isFuelTank){return problem("coreModuleInOptionalSlot","a core module only fits its core slot")}const restricted2=restrictionProblem(slot,symbol);if(restricted2)return restricted2;break}}return module.class>slot.size?problem("oversized",`module size ${truncate(module.class)} exceeds slot size ${slot.size}`,{moduleClass:module.class,slotSize:slot.size}):null}function moduleFitError(shipSymbol,slot,module){return moduleFitProblem(shipSymbol,slot,module)?.message??null}var REBUY_FRACTION=.05;function exportLoadoutEvent(input,options){const fromSource=options.credits==="source";const source=fromSource?input.sourcePurchase:null;const totals=source!==null&&sourceTotalsHold(input.modules,source)?source:null;const hullValue=fromSource?source?.hullValue??null:input.retailHullValue;const modulesValue=fromSource?totals?.modulesValue??null:computedModulesValue(input.modules,input.statsFor);const rebuy=fromSource?totals?.rebuy??null:hullValue===null||modulesValue===null?null:Math.trunc((hullValue+modulesValue)*REBUY_FRACTION);return{event:"Loadout",Ship:input.shipSymbol.toLowerCase(),...input.shipName===void 0?{}:{ShipName:input.shipName},...input.shipIdent===void 0?{}:{ShipIdent:input.shipIdent},...hullValue===null?{}:{HullValue:hullValue},...modulesValue===null?{}:{ModulesValue:modulesValue},...input.unladenMass===null?{}:{UnladenMass:input.unladenMass},...input.cargoCapacity===null?{}:{CargoCapacity:input.cargoCapacity},...input.maxJumpRange===null?{}:{MaxJumpRange:input.maxJumpRange},...input.fuelCapacity===null?{}:{FuelCapacity:{Main:input.fuelCapacity.main,Reserve:input.fuelCapacity.reserve}},...rebuy===null?{}:{Rebuy:rebuy},Modules:exportModules(input,options,fromSource)}}function exportModules(input,options,fromSource){const ordered=options.moduleOrder==="slots"?slotOrderedModules(input.shipSymbol,input.modules,input.layout):[...input.modules.values()];return ordered.map(module=>{const on=module.On??(options.explicitPower?true:void 0);const priority=module.Priority??(options.explicitPower?0:void 0);const value=fromSource?sourceModuleValue(module,input.sourcePurchase):moduleValue(module,input.statsFor);return{Slot:module.Slot,Item:module.Item.toLowerCase(),...on===void 0?{}:{On:on},...priority===void 0?{}:{Priority:priority},...module.Health===void 0?{}:{Health:module.Health},...typeof value==="number"?{Value:value}:{},...module.Engineering===void 0?{}:{Engineering:cloneLoadoutModule(module).Engineering}}})}function slotOrderedModules(shipSymbol,modules,layout){if(!layout){throw new TypeError(`ShipLoadout.toLoadoutEvent: no slot layout for hull "${truncate(shipSymbol)}", so modules cannot be ordered by slot`)}const remaining=new Map(modules);const ordered=[];for(const slot of layout){const key=matchingKeyIn(remaining,slot.key);const module=key===null?void 0:remaining.get(key);if(module&&key!==null){ordered.push(module);remaining.delete(key)}}return[...ordered,...remaining.values()]}function computedModulesValue(modules,statsFor){let sum=0;for(const module of modules.values()){const value=moduleValue(module,statsFor);if(value==="unknown")return null;if(value!=="free")sum+=value}return sum}function moduleValue(module,statsFor){const stats=statsFor(module);if(stats!==null)return stats.cost??"unknown";return isNonOutfittingSlot(module.Slot)||isBuiltInHullModule(module)?"free":"unknown"}var SOURCE_ITEM="ShipLoadout: sourcePurchase moduleValues[].item";function sourceModuleValue(module,source){const entry=source===null?null:getSourceModuleValue(source,module.Slot);if(entry===null)return"unknown";return normalizeKey(entry.item,SOURCE_ITEM)===normalizeKey(module.Item,FITTED_ITEM)?entry.value:"unknown"}function sourceTotalsHold(modules,source){for(const entry of source.moduleValues){const key=matchingKeyIn(modules,entry.slot);const fitted=key===null?void 0:modules.get(key);if(!fitted||normalizeKey(fitted.Item,FITTED_ITEM)!==normalizeKey(entry.item,SOURCE_ITEM)){return false}}return true}function captureLoadoutEvent(event){const modules=event.Modules;const shipName=event.ShipName;const shipIdent=event.ShipIdent;const hullValue=event.HullValue;const modulesValue=event.ModulesValue;const rebuy=event.Rebuy;const unladenMass=event.UnladenMass;const cargoCapacity=event.CargoCapacity;const fuelCapacity=event.FuelCapacity;return{Ship:event.Ship,Modules:Array.isArray(modules)?captureEach(modules,captureModule):modules,...shipName===void 0?{}:{ShipName:shipName},...shipIdent===void 0?{}:{ShipIdent:shipIdent},...hullValue===void 0?{}:{HullValue:hullValue},...modulesValue===void 0?{}:{ModulesValue:modulesValue},...rebuy===void 0?{}:{Rebuy:rebuy},...unladenMass===void 0?{}:{UnladenMass:unladenMass},...cargoCapacity===void 0?{}:{CargoCapacity:cargoCapacity},...fuelCapacity===void 0?{}:{FuelCapacity:{...fuelCapacity}}}}function captureEach(values,capture){const captured=[];const{length:length}=values;for(let index=0;index<length;index++)captured.push(capture(values[index]));return captured}function captureModule(module){if(module===null||typeof module!=="object")return module;const on=module.On;const priority=module.Priority;const health=module.Health;const value=module.Value;const engineering=module.Engineering;return{Slot:module.Slot,Item:module.Item,...on===void 0?{}:{On:on},...priority===void 0?{}:{Priority:priority},...health===void 0?{}:{Health:health},...value===void 0?{}:{Value:value},...engineering===void 0?{}:{Engineering:captureEngineering(engineering)}}}function captureEngineering(engineering){if(engineering===null||typeof engineering!=="object")return engineering;const experimental=engineering.ExperimentalEffect;const experimentalLocalised=engineering.ExperimentalEffect_Localised;const modifiers=engineering.Modifiers;return{BlueprintName:engineering.BlueprintName,Level:engineering.Level,Quality:engineering.Quality,...experimental===void 0?{}:{ExperimentalEffect:experimental},...experimentalLocalised===void 0?{}:{ExperimentalEffect_Localised:experimentalLocalised},...modifiers===void 0?{}:{Modifiers:Array.isArray(modifiers)?captureEach(modifiers,modifier=>modifier!==null&&typeof modifier==="object"?{...modifier}:modifier):modifiers}}}function normalizeLoadoutEvent(rawEvent){const event=captureLoadoutEvent(rawEvent);requireStringIfPresent(event.Ship,"ShipLoadout.fromLoadout: event.Ship");if(!Array.isArray(event.Modules)){throw new TypeError(`ShipLoadout.fromLoadout: event.Modules must be an array, received ${describeValue(event.Modules)}`)}const modules=/* @__PURE__ */new Map;const slots=/* @__PURE__ */new Set;for(const module of event.Modules){if(module===null||typeof module!=="object"){throw new TypeError(`ShipLoadout.fromLoadout: event.Modules[] must hold module objects, received ${describeValue(module)}`)}requireString(module.Slot,"ShipLoadout.fromLoadout: module.Slot");requireString(module.Item,"ShipLoadout.fromLoadout: module.Item");if(module.Engineering!==void 0){if(module.Engineering===null||typeof module.Engineering!=="object"){throw new TypeError(`ShipLoadout.fromLoadout: module.Engineering must be an object, received ${describeValue(module.Engineering)}`)}requireStringIfPresent(module.Engineering.BlueprintName,"ShipLoadout.fromLoadout: module.Engineering.BlueprintName");requireStringIfPresent(module.Engineering.ExperimentalEffect,"ShipLoadout.fromLoadout: module.Engineering.ExperimentalEffect");if(module.Engineering.Modifiers!==void 0&&!Array.isArray(module.Engineering.Modifiers)){throw new TypeError(`ShipLoadout.fromLoadout: module.Engineering.Modifiers must be an array, received ${describeValue(module.Engineering.Modifiers)}`)}for(const[index,modifier]of(module.Engineering.Modifiers??[]).entries()){if(modifier===null||typeof modifier!=="object"){throw new TypeError(`ShipLoadout.fromLoadout: module.Engineering.Modifiers[${index}] must be an object, received ${describeValue(modifier)}`)}requireString(modifier.Label,`ShipLoadout.fromLoadout: module.Engineering.Modifiers[${index}].Label`)}}const normalizedSlot=module.Slot.toLowerCase();if(slots.has(normalizedSlot)){throw new TypeError(`ShipLoadout.fromLoadout: duplicate slot "${truncate(module.Slot)}"`)}slots.add(normalizedSlot);modules.set(module.Slot,cloneLoadoutModule(module))}const top={};if(event.ShipName!==void 0)top.ShipName=event.ShipName;if(event.ShipIdent!==void 0)top.ShipIdent=event.ShipIdent;if(event.HullValue!==void 0)top.HullValue=event.HullValue;if(event.ModulesValue!==void 0)top.ModulesValue=event.ModulesValue;if(event.Rebuy!==void 0)top.Rebuy=event.Rebuy;if(event.UnladenMass!==void 0)top.UnladenMass=event.UnladenMass;if(event.CargoCapacity!==void 0)top.CargoCapacity=event.CargoCapacity;if(event.FuelCapacity!==void 0)top.FuelCapacity={...event.FuelCapacity};const moduleStats=/* @__PURE__ */new Map;for(const module of modules.values()){const engineering=module.Engineering;const variant=identifyPreEngineeredVariant(module);const variantStats=variant?getPreEngineeredStats(variant):null;if(variantStats)moduleStats.set(module.Slot,cloneModuleStats(variantStats));if(variantStats?.engineeringLocked||typeof engineering?.BlueprintName!=="string"||!isFinalGuardianWeaponEngineering(module.Item,engineering.BlueprintName)){continue}const normalizedBlueprint=normalizeKey(engineering.BlueprintName,"ShipLoadout.fromLoadout: module.Engineering.BlueprintName");const normalizedExperimental=normalizeKey(engineering.ExperimentalEffect,"ShipLoadout.fromLoadout: module.Engineering.ExperimentalEffect");const exact=getPreEngineeredVariants(module.Item).find(candidate=>candidate.blueprint.toLowerCase()===normalizedBlueprint&&candidate.grade===engineering.Level&&candidate.experimental?.toLowerCase()===normalizedExperimental);const stats=exact?getPreEngineeredStats(exact):builtInModuleBySymbol(module.Item,"ShipLoadout.fromLoadout: module.Item");if(stats){moduleStats.set(module.Slot,cloneModuleStats({...stats,engineeringLocked:true}))}}return{shipSymbol:event.Ship,modules:modules,moduleStats:moduleStats,top:top,sourcePurchase:sourcePurchaseFromLoadout(event)}}var SLOT_KEY="ShipLoadout: slotKey";var requireLoadOptions=(scope,options)=>{for(const field of["fuel","cargo"]){const value=options[field];if(value!==void 0&&(!Number.isFinite(value)||value<0)){throw new RangeError(`${scope}: ${field} must be a finite non-negative number`)}}};var LoadoutEditError=class extends TypeError{code;constraint;params;constructor(message,code,params,constraint){super(message);this.code=code;this.params=deepFreeze(Object.fromEntries(Object.entries(params).map(([key,value])=>[key,Array.isArray(value)?[...value]:value])));if(constraint!==void 0)this.constraint=constraint}};var FSD_PREFIX="int_hyperdrive";var BOOSTER_PREFIX="int_guardianfsdbooster";var FUEL_TANK_PREFIX="int_fueltank";var ShipLoadout=class _ShipLoadout{#shipSymbol;#modules;#moduleStats;#primitiveModifiers=/* @__PURE__ */new Map;#top;#sourcePurchase;#version=0;#viewVersion=0;#layoutCache;#calculationCache=null;#validationCache=null;#fittedModuleCache=null;#slotCache=null;constructor(shipSymbol,modules,top,sourcePurchase=null,moduleStats=/* @__PURE__ */new Map){this.#shipSymbol=shipSymbol;this.#modules=modules;this.#top=top;this.#sourcePurchase=sourcePurchase;this.#moduleStats=moduleStats}static fromSlef(input,index=0){const entries=parseSlef(input);const entry=entries[index];if(!entry){throw new TypeError(`ShipLoadout.fromSlef: no entry at index ${truncate(index)} (have ${entries.length})`)}return _ShipLoadout.fromLoadout(entry.data)}static fromLoadout(event){if(event===null||typeof event!=="object"){throw new TypeError(`ShipLoadout.fromLoadout: event must be a Loadout event, received ${describeValue(event)}`)}const imported=normalizeLoadoutEvent(event);return new _ShipLoadout(imported.shipSymbol,imported.modules,imported.top,imported.sourcePurchase,imported.moduleStats)}static empty(shipSymbol){const layout=getShipSlots(requireString(shipSymbol,"ShipLoadout.empty: shipSymbol"));if(!layout){throw new TypeError(`ShipLoadout.empty: no slot layout for hull "${truncate(shipSymbol)}"`)}return new _ShipLoadout(layout.symbol,/* @__PURE__ */new Map,{})}static default(shipSymbol){const requested=requireString(shipSymbol,"ShipLoadout.default: shipSymbol");const loadout=getDefaultLoadout(requested);if(!loadout){throw new TypeError(`ShipLoadout.default: no default loadout for hull "${truncate(shipSymbol)}"`)}return new _ShipLoadout(loadout.symbol,new Map(loadout.modules.map(module=>[module.slot,{Slot:module.slot,Item:module.symbol}])),{})}get shipSymbol(){return this.#shipSymbol}get shipName(){return this.#top.ShipName??null}get shipIdent(){return this.#top.ShipIdent??null}get unladenMass(){return this.unladenMassResult.value}get unladenMassResult(){return this.#top.UnladenMass===void 0?this.#computedUnladenMass():completeResult(this.#top.UnladenMass)}#computedUnladenMass(){return calculateUnladenMass(getShipBySymbol(this.#shipSymbol)?.hullMass??null,this.#calculationModules())}get fuelCapacity(){return this.fuelCapacityResult.value}get fuelCapacityResult(){const cap=this.#top.FuelCapacity;if(cap?.Main!==void 0&&cap.Reserve!==void 0){return completeResult(Object.freeze({main:cap.Main,reserve:cap.Reserve}))}const computed=this.#computedFuelCapacity();if(computed.value===null)return computed;return completeResult(Object.freeze({main:cap?.Main??computed.value.main,reserve:cap?.Reserve??computed.value.reserve}))}get cargoCapacity(){return this.cargoCapacityResult.value}get cargoCapacityResult(){return this.#top.CargoCapacity===void 0?this.#computedCargoCapacity():completeResult(this.#top.CargoCapacity)}#computedCargoCapacity(){return calculateCargoCapacity(this.#calculationModules())}#computedFuelCapacity(){return calculateFuelCapacity(getShipBySymbol(this.#shipSymbol)?.reserveFuelCapacity??null,this.#calculationModules())}get hullValue(){return this.#top.HullValue??null}get modulesValue(){return this.#top.ModulesValue??null}get rebuy(){return this.#top.Rebuy??null}get sourcePurchase(){return this.#sourcePurchase}get validation(){const cached=this.#validationCache;if(cached!==null&&cached.version===this.#version)return cached.value;const slots=this.#layoutOrNull();const byKey=new Map(slots?.map(slot=>[slot.key.toLowerCase(),slot])??[]);const modules=[...this.#modules.values()].map(module=>{const stats=this.#statsFor(module);const slot=byKey.get(module.Slot.toLowerCase());const builtIn=stats===null&&isNonOutfittingSlot(module.Slot)||isBuiltInHullModule(module);const fitProblem=stats&&slot&&!builtIn?moduleFitProblem(this.#shipSymbol,slot,stats):null;return{slot:module.Slot,symbol:module.Item,known:stats!==null||builtIn,requiresKnownSlot:!builtIn,fitError:fitProblem?.message??null,...fitProblem===null?{}:{fitConstraint:fitProblem.constraint},...fitProblem?.params===void 0?{}:{fitParams:fitProblem.params},...stats?.exclusionGroup===void 0?{}:{exclusionGroup:stats.exclusionGroup},...stats?.limitGroup===void 0?{}:{limitGroup:stats.limitGroup},...stats?.limitIncrease===void 0?{}:{limitIncrease:stats.limitIncrease}}});const value=validateLoadout({shipSymbol:this.#shipSymbol,slots:slots,modules:modules});this.#validationCache={version:this.#version,value:value};return value}slots(kind){let cached=this.#slotCache;if(cached===null||cached.version!==this.#viewVersion){cached={version:this.#viewVersion,value:/* @__PURE__ */new Map};this.#slotCache=cached}const existing=cached.value.get(kind);if(existing!==void 0)return existing;const slots=kind===void 0?this.#layout():this.#layout().filter(slot=>slot.kind===kind);const currentLimits=this.#moduleLimits();const value=deepFreeze(slots.map(slot=>{const stats=this.#moduleStatsAt(slot.key);const immovableReason=slot.key.toLowerCase()==="cargohatch"?"cargoHatch":stats?.limitIncrease!==void 0&&this.#moduleLimitRegression(slot.key,null,currentLimits,stats)!==null?"moduleLimit":null;return{...slot,name:loadoutSlotName(slot),module:this.fittedModuleAt(slot.key),removable:immovableReason===null,...immovableReason===null?{}:{immovableReason:immovableReason}}}));cached.value.set(kind,value);return value}fittedModuleAt(slotKey){const module=this.#fittedModuleFor(slotKey);if(!module)return null;let cached=this.#fittedModuleCache;if(cached===null||cached.version!==this.#viewVersion){cached={version:this.#viewVersion,value:/* @__PURE__ */new Map};this.#fittedModuleCache=cached}const existing=cached.value.get(module.Slot);if(existing!==void 0)return existing;const raw=cloneLoadoutModule(module);const stats=this.#statsFor(module);const effective=effectiveModule(this.#moduleForEffectiveStats(module),stats);const value=deepFreeze({slot:module.Slot,symbol:raw.Item,on:raw.On,priority:raw.Priority,health:raw.Health,value:raw.Value,engineering:raw.Engineering,raw:raw,stats:stats===null?null:cloneModuleStats(stats),effectiveStats:effective===null?null:cloneModuleStats(effective),ammunition:ammunitionCapacity(effective),preEngineeredVariant:identifyPreEngineeredVariant(raw)});cached.value.set(module.Slot,value);return value}fittedModules(){return deepFreeze([...this.#modules.keys()].flatMap(key=>{const fitted=this.fittedModuleAt(key);return fitted===null?[]:[fitted]}))}availableBlueprints(slotKey){const module=this.#fittedModuleFor(slotKey);return deepFreeze(module?availableBlueprintsFor(module.Item,this.#statsFor(module)):[])}availableExperimentalEffects(slotKey){const module=this.#fittedModuleFor(slotKey);return deepFreeze(module?availableExperimentalsFor(module.Item,this.#statsFor(module)):[])}modulesForSlot(slotKey){const slot=this.#requireSlot(slotKey);const occupied=new Set([...this.#modules.values()].flatMap(fitted=>{if(fitted.Slot.toLowerCase()===slot.key.toLowerCase())return[];const group=this.#statsFor(fitted)?.exclusionGroup;return group===void 0?[]:[group]}));const currentLimits=this.#moduleLimits();const currentStats=this.#moduleStatsAt(slot.key);return ALL_MODULES.filter(module=>moduleFitError(this.#shipSymbol,slot,module)===null&&(module.exclusionGroup===void 0||!occupied.has(module.exclusionGroup))&&this.#moduleLimitRegression(slot.key,module,currentLimits,currentStats)===null)}setModule(slotKey,module){const slot=this.#requireSlot(slotKey);if(module===null||module===void 0){throw new TypeError(`ShipLoadout.setModule: no module supplied for "${truncate(slotKey)}" (did the module lookup return undefined?)`)}if(typeof module.symbol!=="string"){throw new TypeError(`ShipLoadout.setModule: module for "${truncate(slotKey)}" must be an outfitting module, received ${describeValue(module)}`)}const problem2=moduleFitProblem(this.#shipSymbol,slot,module);if(problem2){if(problem2.constraint==="immutableSlot"){throw new LoadoutEditError(`ShipLoadout.setModule: ${truncate(module.symbol)} → ${truncate(slotKey)}: ${problem2.message}`,"immutableSlot",{slot:slot.key})}throw new LoadoutEditError(`ShipLoadout.setModule: ${truncate(module.symbol)} → ${truncate(slotKey)}: ${problem2.message}`,"incompatibleModule",{...problem2.params,slot:slot.key,symbol:module.symbol,constraint:problem2.constraint},problem2.constraint)}if(module.exclusionGroup!==void 0){const conflict=[...this.#modules.values()].find(fitted=>fitted.Slot.toLowerCase()!==slot.key.toLowerCase()&&this.#statsFor(fitted)?.exclusionGroup===module.exclusionGroup);if(conflict){throw new LoadoutEditError(`ShipLoadout.setModule: ${truncate(module.symbol)} → ${truncate(slotKey)}: ${module.exclusionGroup} is limited to one per ship (already fitted in ${truncate(conflict.Slot)})`,"duplicateExclusiveModule",{exclusionGroup:module.exclusionGroup,slot:slot.key,symbol:module.symbol,previousSlot:conflict.Slot,previousSymbol:conflict.Item})}}const limitProblem=this.#moduleLimitRegression(slot.key,module);if(limitProblem!==null){throw new LoadoutEditError(`ShipLoadout.setModule: ${truncate(module.symbol)} → ${truncate(slotKey)}: ${limitProblem.group} would have ${limitProblem.count} modules but the ship allows ${limitProblem.limit}`,"moduleLimitExceeded",{group:limitProblem.group,count:limitProblem.count,limit:limitProblem.limit,slot:slot.key,symbol:module.symbol})}const key=this.#fittedKey(slotKey)??slot.key;this.#replaceModule(key,{Slot:key,Item:module.symbol},cloneModuleStats(module));return this}removeModule(slotKey){if(requireString(slotKey,SLOT_KEY).toLowerCase()==="cargohatch"){throw new LoadoutEditError("ShipLoadout.removeModule: the cargoHatch slot cannot be changed","immutableSlot",{slot:"CargoHatch"})}const key=this.#fittedKey(slotKey);if(key!==null){const limitProblem=this.#moduleLimitRegression(key,null);if(limitProblem!==null){const fitted=this.#modules.get(key);throw new LoadoutEditError(`ShipLoadout.removeModule: ${truncate(slotKey)}: ${limitProblem.group} would have ${limitProblem.count} modules but the ship allows ${limitProblem.limit}`,"moduleLimitExceeded",{group:limitProblem.group,count:limitProblem.count,limit:limitProblem.limit,slot:key,...fitted===void 0?{}:{symbol:fitted.Item}})}this.#replaceModule(key,null)}return this}applyBlueprint(slotKey,fdname,options){requireString(fdname,"ShipLoadout.applyBlueprint: fdname");if(options===null||typeof options!=="object"){throw new TypeError(`ShipLoadout.applyBlueprint: options must be an object with a grade, received ${describeValue(options)}`)}const wantedGrade=options.grade;const wantedQuality=options.quality;const wantedExperimental=options.experimental??void 0;requireStringIfPresent(wantedExperimental,"ShipLoadout.applyBlueprint: options.experimental");const module=this.#fittedModuleFor(slotKey);if(!module){throw new RangeError(`ShipLoadout.applyBlueprint: slot "${truncate(slotKey)}" is empty`)}const fittedStats=this.#statsFor(module);if(!fittedStats){throw new TypeError(`ShipLoadout.applyBlueprint: no stats for module "${truncate(module.Item)}"`)}const recipe=resolveBlueprintForModule(module.Item,fdname);const named=recipe===fdname?`"${truncate(fdname)}"`:`"${truncate(fdname)}" (${truncate(recipe)} on this module)`;const written=fdname.trim().toLowerCase();const resolved=recipe.trim().toLowerCase();if(getPreEngineeredVariants(module.Item).some(variant=>variant.acquisition==="eventReward"&&(variant.blueprint.toLowerCase()===written||variant.blueprint.toLowerCase()===resolved))){throw new TypeError(`ShipLoadout.applyBlueprint: ${named} is a fixed pre-engineered identity, not a craftable blueprint; use setPreEngineeredVariant to fit its fixed article`)}if(!Number.isInteger(wantedGrade)||wantedGrade<1||wantedGrade>5){throw new RangeError(`ShipLoadout.applyBlueprint: no blueprint ${named} grade ${truncate(wantedGrade)}`)}const grade=getBlueprintGrade(recipe,wantedGrade);if(!grade){throw new RangeError(`ShipLoadout.applyBlueprint: no blueprint ${named} grade ${truncate(wantedGrade)}`)}let experimental;if(wantedExperimental!==void 0){experimental=getExperimentalEffect(wantedExperimental);if(!experimental){throw new RangeError(`ShipLoadout.applyBlueprint: unknown experimental effect "${truncate(wantedExperimental)}"`)}}const quality=wantedQuality??1;if(!Number.isFinite(quality)||quality<0||quality>1){throw new RangeError(`ShipLoadout.applyBlueprint: quality must be a finite number in [0, 1]`)}if(fittedStats.engineeringLocked){throw new TypeError(`ShipLoadout.applyBlueprint: module "${truncate(module.Item)}" is a final pre-engineered article and accepts no further engineering`)}if(!blueprintAvailableFor(module.Item,fdname)){const offered=[...blueprintRoutesFor(module.Item)].map(([blueprint,route])=>`${blueprint} (${route})`);throw new TypeError(offered.length>0?`ShipLoadout.applyBlueprint: module "${truncate(module.Item)}" is not offered blueprint ${named}; available candidates are ${offered.join(", ")}`:`ShipLoadout.applyBlueprint: no registry lists an engineering menu for module "${truncate(module.Item)}"`)}if(wantedExperimental!==void 0&&!experimentalAvailableFor(module.Item,wantedExperimental)){const offered=getExperimentalsForModule(module.Item);throw new TypeError(`ShipLoadout.applyBlueprint: module "${truncate(module.Item)}" is not offered experimental effect "${truncate(wantedExperimental)}"; it takes ${offered.length>0?offered.join(", "):"no experimental effect"}`)}const stats=this.#engineeringBaseStats(module)??fittedStats;const base=baseStats(stats);const canonical=primitiveEngineeringInputsFor(stats,grade,experimental);const missing=missingBaseLabels(stats,base,canonical.grade.features,canonical.experimental?.modifiers);if(missing.length>0){throw new TypeError(`ShipLoadout.applyBlueprint: cannot compute ${named} for module "${truncate(module.Item)}"; missing base stats for ${missing.join(", ")}`)}const damageDistribution=experimental?.damageDistribution??grade.damageDistribution;const primitiveModifiers=computeModifiers(base,canonical.grade,quality,canonical.experimental);const modifiers=journalModifiersFor(stats,primitiveModifiers);if(damageDistribution){for(const type of["kinetic","thermal","explosive","absolute"]){const value=damageDistribution[type];if(value===void 0)continue;const label=labelsForDamageType(type)[0];if(label===void 0)continue;const damageModifier={Label:label,Value:value*scaleForLabel(label),OriginalValue:(stats.damageDistribution?.[type]??0)*scaleForLabel(label)};modifiers.push(damageModifier);primitiveModifiers.push(damageModifier)}}const engineering={BlueprintName:fdname,Level:wantedGrade,Quality:quality,...wantedExperimental!==void 0?{ExperimentalEffect:wantedExperimental}:{},Modifiers:modifiers};this.#replaceModule(module.Slot,{...module,Engineering:engineering},stats,primitiveModifiers);return this}setPreEngineeredVariant(slotKey,variant){if(variant===null||typeof variant!=="object"){throw new TypeError(`ShipLoadout.setPreEngineeredVariant: variant must be a pre-engineered variant, received ${describeValue(variant)}`)}requireString(variant.symbol,"ShipLoadout.setPreEngineeredVariant: variant.symbol");requireString(variant.blueprint,"ShipLoadout.setPreEngineeredVariant: variant.blueprint");requireString(variant.acquisition,"ShipLoadout.setPreEngineeredVariant: variant.acquisition");requireStringIfPresent(variant.experimental,"ShipLoadout.setPreEngineeredVariant: variant.experimental");const known=getPreEngineeredVariants(variant.symbol).find(candidate=>candidate.blueprint.toLowerCase()===variant.blueprint.toLowerCase()&&candidate.grade===variant.grade&&(candidate.experimental?.toLowerCase()??"")===(variant.experimental?.toLowerCase()??"")&&candidate.acquisition===variant.acquisition);if(!known){throw new RangeError(`ShipLoadout.setPreEngineeredVariant: no catalogued variant "${truncate(variant.blueprint)}" for module "${truncate(variant.symbol)}"`)}const stats=getPreEngineeredStats(known);const unresolved=unresolvedModifiers(known);if(unresolved.length>0){throw new TypeError(`ShipLoadout.setPreEngineeredVariant: cannot resolve "${truncate(variant.blueprint)}" for module "${truncate(variant.symbol)}"; missing base stats for ${unresolved.join(", ")}`)}this.setModule(slotKey,stats);const module=this.#fittedModuleFor(slotKey);const engineering={BlueprintName:known.blueprint,Level:known.grade,Quality:1,...known.experimental===void 0?{}:{ExperimentalEffect:known.experimental},...known.modifiers?.length?{Modifiers:getPreEngineeredJournalModifiers(known)}:{}};this.#replaceModule(module.Slot,{...module,Engineering:engineering},cloneModuleStats(stats),getPreEngineeredModifiers(known));return this}clearEngineering(slotKey){const module=this.#fittedModuleFor(slotKey);if(module&&this.#statsFor(module)?.engineeringLocked){throw new TypeError(`ShipLoadout.clearEngineering: module "${truncate(module.Item)}" is a final pre-engineered article and its engineering cannot be removed`)}if(module?.Engineering){const baseStats2=this.#engineeringBaseStats(module);const bare={Slot:module.Slot,Item:module.Item};if(module.On!==void 0)bare.On=module.On;if(module.Priority!==void 0){bare.Priority=module.Priority}if(module.Health!==void 0)bare.Health=module.Health;if(module.Value!==void 0)bare.Value=module.Value;this.#replaceModule(module.Slot,bare,baseStats2??void 0)}return this}setModuleEnabled(slotKey,on){this.#patchModule(slotKey,{On:on});return this}setModulePriority(slotKey,priority){if(!Number.isInteger(priority)||priority<0||priority>4){throw new RangeError(`ShipLoadout: power priority must be an integer 0-4, got ${truncate(priority)}`)}this.#patchModule(slotKey,{Priority:priority});return this}#patchModule(slotKey,patch){const module=this.#fittedModuleFor(slotKey);if(!module){throw new RangeError(`ShipLoadout: slot "${truncate(slotKey)}" is empty`)}this.#modules.set(module.Slot,cloneLoadoutModule({...module,...patch}));this.#viewVersion++}toLoadoutEvent(options={}){const hull=getShipBySymbol(this.#shipSymbol);const unladenMass=this.#computedUnladenMass().value;const cargoCapacity=this.#computedCargoCapacity().value;const fuel=this.#computedFuelCapacity().value;const maxJumpRange=this.#exportableJumpRange(unladenMass);return exportLoadoutEvent({shipSymbol:this.#shipSymbol,...this.#top.ShipName===void 0?{}:{shipName:this.#top.ShipName},...this.#top.ShipIdent===void 0?{}:{shipIdent:this.#top.ShipIdent},modules:this.#modules,...options.moduleOrder==="slots"?{layout:this.#layoutOrNull()}:{},sourcePurchase:this.#sourcePurchase,retailHullValue:hull?.hullCost??null,unladenMass:unladenMass,cargoCapacity:cargoCapacity,fuelCapacity:fuel,maxJumpRange:maxJumpRange,statsFor:module=>this.#statsFor(module)},options)}toSlef(options){return toSlef(this.toLoadoutEvent(options),options.header)}toSlefString(options){return stringifySlef(this.toSlef(options),{indent:options.indent??0})}#exportableJumpRange(unladenMass){if(unladenMass===null)return null;let drive;try{drive=this.#resolveDrive()}catch{return null}if(drive===null)return null;const tank=this.#computedFuelCapacity().value;if(tank===null)return null;return singleJumpRange(unladenMass,Math.min(tank.main,drive.maxFuel),drive)}get frameShiftDrive(){const drive=this.#resolveDrive();if(drive===null)throw new TypeError("ShipLoadout: build has no frame shift drive");return drive}#maxJumpFuel(fsd){return Math.min(this.#requireFuelCapacity().main,fsd.maxFuel)}frameShiftDriveMassFactor(options={}){requireLoadOptions("ShipLoadout.frameShiftDriveMassFactor",options);const fuel=options.fuel??this.#requireFuelCapacity().main;return frameShiftDriveMassFactor(this.#requireMass(options.cargo??0),fuel,this.frameShiftDrive)}maxJumpRange(){const fsd=this.frameShiftDrive;return singleJumpRange(this.#requireMass(0),this.#maxJumpFuel(fsd),fsd)}jumpRange(options={}){requireLoadOptions("ShipLoadout.jumpRange",options);const fsd=this.frameShiftDrive;const fuel=options.fuel??this.#requireFuelCapacity().main;return singleJumpRange(this.#requireMass(options.cargo??0),fuel,fsd)}ladenJumpRange(){return this.jumpRange({cargo:this.#requireCargoCapacity()})}fuelPerJump(distance,options={}){requireLoadOptions("ShipLoadout.fuelPerJump",options);const fsd=this.frameShiftDrive;const fuel=options.fuel??this.#requireFuelCapacity().main;return fuelPerJump(distance,this.#requireMass(options.cargo??0),fuel,fsd)}totalRange(options={}){requireLoadOptions("ShipLoadout.totalRange",options);return totalRange(this.#requireMass(options.cargo??0),options.fuel??this.#requireFuelCapacity().main,this.frameShiftDrive)}jumpRangeSummary(){const cargo=this.#requireCargoCapacity();const fsd=this.frameShiftDrive;const maxFuel=this.#maxJumpFuel(fsd);return{max:this.maxJumpRange(),unladen:this.jumpRange(),laden:this.jumpRange({cargo:cargo}),totalMax:this.totalRange({fuel:maxFuel}),totalUnladen:this.totalRange(),totalLaden:this.totalRange({cargo:cargo})}}powerBudget(){const modules=[...this.#modules.values()];const consumers=[];for(const module of modules){const consumer=powerConsumerFor(module,this.#statsFor(module));if(consumer)consumers.push(consumer)}return powerBudget(powerAvailable(modules,module=>this.#statsFor(module)),consumers)}heatMetrics(){const input=heatInputFor(this.#shipSymbol,this.#modulesForEffectiveStats(),this.powerBudget(),module=>this.#statsFor(module));return input?heatMetrics(input):null}mobilityMetrics(options={}){const enginesPips=options.enginesPips??4;if(!Number.isFinite(enginesPips)||enginesPips<0||enginesPips>4){throw new RangeError("ShipLoadout.mobilityMetrics: enginesPips must be a finite number from 0 to 4")}requireLoadOptions("ShipLoadout.mobilityMetrics",options);const input=mobilityInputFor(this.#shipSymbol,[...this.#modules.values()],()=>{const main=options.fuel??this.#top.FuelCapacity?.Main??this.#requireFuelCapacity().main;return this.#requireMass(options.cargo??0)+main},enginesPips,module=>this.#statsFor(module));return input?mobilityMetrics(input):null}shieldMetrics(options={}){const input=shieldInputFor(this.#shipSymbol,[...this.#modules.values()],options.systemsPips??0,module=>this.#statsFor(module));if(!input.generator)return null;return shieldMetrics(input)}shieldRecovery(options={}){const systemsPips=options.systemsPips??4;if(!Number.isFinite(systemsPips)||systemsPips<0||systemsPips>4){throw new RangeError("ShipLoadout.shieldRecovery: systemsPips must be a finite number from 0 to 4")}const input=shieldRecoveryInputFor(this.#shipSymbol,[...this.#modules.values()],systemsPips,module=>this.#statsFor(module));return input?shieldRecovery(input):null}cellBanks(){const banks=cellBankInputsFor([...this.#modules.values()],module=>this.#statsFor(module));const layout=this.#layoutOrNull();if(layout){const order=new Map(layout.map((slot,index)=>[slot.key.toLowerCase(),index]));banks.sort((left,right)=>(order.get(left.slot.toLowerCase())??Number.MAX_SAFE_INTEGER)-(order.get(right.slot.toLowerCase())??Number.MAX_SAFE_INTEGER))}return cellBankSummary(banks)}retailCredits(){const hull=getShipBySymbol(this.#shipSymbol)?.hullCost??null;let modules=0;const unpriced=[];for(const module of this.#modules.values()){const stats=this.#statsFor(module);if(stats?.cost!==void 0){modules+=stats.cost}else if(stats!==null||!isNonOutfittingSlot(module.Slot)&&!isBuiltInHullModule(module)){unpriced.push({slot:module.Slot,symbol:module.Item})}}return deepFreeze({hull:hull,modules:modules,rebuy:hull===null?null:Math.trunc((hull+modules)*.05),unpriced:unpriced})}armourMetrics(){return armourMetrics(armourInputFor(this.#shipSymbol,[...this.#modules.values()],module=>this.#statsFor(module)))}weaponMetrics(){const weapons=[];for(const module of this.#modules.values()){const record=this.#statsFor(module);const stats=weaponStatsFor(this.#moduleForEffectiveStats(module),record);if(!stats)continue;weapons.push({slot:module.Slot,symbol:module.Item,name:record?.name??module.Item,enabled:module.On!==false,metrics:weaponMetrics(stats),ammunition:ammunitionCapacity(stats)})}return{weapons:weapons,total:sumWeaponMetrics(weapons.filter(weapon=>weapon.enabled).map(weapon=>weapon.metrics))}}weaponsCapacitorMetrics(options={}){const weaponsPips=options.weaponsPips??4;if(!Number.isFinite(weaponsPips)||weaponsPips<0||weaponsPips>4){throw new RangeError("ShipLoadout.weaponsCapacitorMetrics: weaponsPips must be a finite number from 0 to 4")}return weaponsCapacitorMetrics(weaponsCapacitorInputFor(this.#modulesForEffectiveStats(),weaponsPips,this.powerBudget(),module=>this.#statsFor(module)))}distributorMetrics(options={}){const pips={systemsPips:options.systemsPips??4,enginesPips:options.enginesPips??4,weaponsPips:options.weaponsPips??4};for(const field of["systemsPips","enginesPips","weaponsPips"]){const value=pips[field];if(!Number.isFinite(value)||value<0||value>4){throw new RangeError(`ShipLoadout.distributorMetrics: ${field} must be a finite number from 0 to 4`)}}const input=distributorInputFor(this.#modulesForEffectiveStats(),pips,this.powerBudget(),module=>this.#statsFor(module));return input?distributorMetrics(input):null}#layoutOrNull(){if(this.#layoutCache===void 0){const layout=getShipSlots(this.#shipSymbol);this.#layoutCache=layout===null?null:Object.freeze(enumerateSlots(layout))}return this.#layoutCache}#invalidate(){this.#version++;this.#viewVersion++}#layout(){const layout=this.#layoutOrNull();if(!layout){throw new TypeError(`ShipLoadout: no slot layout for hull "${truncate(this.#shipSymbol)}"`)}return layout}#requireSlot(slotKey){const wanted=requireString(slotKey,SLOT_KEY).toLowerCase();const slot=this.#layout().find(s=>s.key.toLowerCase()===wanted);if(!slot){throw new RangeError(`ShipLoadout: hull "${truncate(this.#shipSymbol)}" has no slot "${truncate(slotKey)}"`)}return slot}#fittedKey(slotKey){return matchingKeyIn(this.#modules,requireString(slotKey,SLOT_KEY))}#fittedModuleFor(slotKey){const key=this.#fittedKey(slotKey);return key===null?void 0:this.#modules.get(key)}#require(result,what){if(result.value===null){throw new TypeError(`ShipLoadout: cannot determine ${what} (${result.issues.map(i=>i.message).join("; ")})`)}return result.value}#requireMass(cargo){return this.#require(this.unladenMassResult,"mass")+cargo}#requireFuelCapacity(){return this.#require(this.fuelCapacityResult,"fuel capacity")}#requireCargoCapacity(){return this.#require(this.cargoCapacityResult,"cargo capacity")}#calculationModules(){const cached=this.#calculationCache;if(cached!==null&&cached.version===this.#version)return cached.value;const value=this.#resolveCalculationModules();this.#calculationCache={version:this.#version,value:value};return value}#resolveCalculationModules(){return[...this.#modules.values()].map(module=>{const stats=this.#statsFor(module);const symbol=module.Item.toLowerCase();const parsedSlot=parseSlotName(module.Slot);const unresolvedOutfitting=stats===null&&!isNonOutfittingSlot(module.Slot)&&!isBuiltInHullModule(module);const isCargoRack=stats?.cargoCapacity!==void 0||stats?.engineeringGroup==="cargoRacks"||symbol.includes("cargorack");const isFuelTank=stats?.fuelCapacity!==void 0||stats?.slot==="fuelTank"||symbol.startsWith(FUEL_TANK_PREFIX);const mayCarryCapacity=unresolvedOutfitting&&(parsedSlot===null||parsedSlot.kind==="optional");const mayCarryFuel=mayCarryCapacity||unresolvedOutfitting&&parsedSlot?.kind==="core"&&parsedSlot.core==="fuelTank";return{slot:module.Slot,symbol:module.Item,mass:this.#moduleMass(module),...isCargoRack||mayCarryCapacity?{cargoCapacity:isCargoRack?this.#moduleCapacity(module,"CargoCapacity","cargoCapacity"):null}:{},...isFuelTank||mayCarryFuel?{fuelCapacity:isFuelTank?this.#moduleCapacity(module,"FuelCapacity","fuelCapacity"):null}:{}}})}#moduleLimits(){const entries=[...this.#modules.values()].flatMap(module=>{const stats=this.#statsFor(module);return stats===null?[]:[stats]});return calculateModuleLimits(entries)}#moduleStatsAt(slotKey){const fitted=this.#fittedModuleFor(slotKey);return fitted===void 0?null:this.#statsFor(fitted)}#engineeringBaseStats(module){const fitted=this.#statsFor(module);if(!module.Engineering||identifyPreEngineeredVariant(module)===null)return fitted;const stock=builtInModuleBySymbol(module.Item,FITTED_ITEM);if(!stock)return fitted;return fitted?.engineeringLocked?cloneModuleStats({...stock,engineeringLocked:true}):stock}#moduleForEffectiveStats(module){const modifiers=this.#primitiveModifiers.get(module.Slot);if(modifiers===void 0||module.Engineering===void 0)return module;return{...module,Engineering:{...module.Engineering,Modifiers:modifiers}}}#modulesForEffectiveStats(){return[...this.#modules.values()].map(module=>this.#moduleForEffectiveStats(module))}#moduleLimitRegression(slotKey,replacement,current=this.#moduleLimits(),previous=this.#moduleStatsAt(slotKey)){if(previous?.limitGroup===void 0&&previous?.limitIncrease===void 0&&replacement?.limitGroup===void 0&&replacement?.limitIncrease===void 0){return null}for(const usage of current){const count=usage.count-Number(previous?.limitGroup===usage.group)+Number(replacement?.limitGroup===usage.group);const increase=usage.increase-(previous?.limitIncrease?.group===usage.group?previous.limitIncrease.amount:0)+(replacement?.limitIncrease?.group===usage.group?replacement.limitIncrease.amount:0);const limit=usage.baseLimit+increase;const excess=Math.max(0,count-limit);if(excess>usage.excess){return{...usage,increase:increase,limit:limit,count:count,excess:excess}}}return null}#replaceModule(slotKey,replacement,replacementStats,primitiveModifiers){const previous=this.#modules.get(slotKey)??null;this.#adjustImportedFigures(previous,replacement,replacementStats);if(replacement===null){this.#modules.delete(slotKey);this.#moduleStats.delete(slotKey);this.#primitiveModifiers.delete(slotKey)}else{this.#modules.set(slotKey,cloneLoadoutModule(replacement));if(replacementStats!==void 0)this.#moduleStats.set(slotKey,replacementStats);if(primitiveModifiers===void 0)this.#primitiveModifiers.delete(slotKey);else this.#primitiveModifiers.set(slotKey,primitiveModifiers)}this.#invalidate()}#adjustImportedFigures(previous,next,nextStats){const previousMass=this.#moduleMass(previous);const nextMass=this.#moduleMass(next,nextStats);if(this.#top.UnladenMass!==void 0){if(previousMass===null||nextMass===null)delete this.#top.UnladenMass;else this.#top.UnladenMass+=nextMass-previousMass}const previousCargo=this.#moduleCapacity(previous,"CargoCapacity","cargoCapacity");const nextCargo=this.#moduleCapacity(next,"CargoCapacity","cargoCapacity",nextStats);if(this.#top.CargoCapacity!==void 0){if(previousCargo===null||nextCargo===null)delete this.#top.CargoCapacity;else this.#top.CargoCapacity+=nextCargo-previousCargo}const previousFuel=this.#moduleCapacity(previous,"FuelCapacity","fuelCapacity");const nextFuel=this.#moduleCapacity(next,"FuelCapacity","fuelCapacity",nextStats);if(this.#top.FuelCapacity?.Main!==void 0){const reserve=this.#top.FuelCapacity.Reserve;if(previousFuel===null||nextFuel===null){if(reserve===void 0)delete this.#top.FuelCapacity;else this.#top.FuelCapacity={Reserve:reserve}}else{this.#top.FuelCapacity={Main:this.#top.FuelCapacity.Main+nextFuel-previousFuel,...reserve===void 0?{}:{Reserve:reserve}}}}if(normalizeKey(previous?.Item,FITTED_ITEM)===normalizeKey(next?.Item,FITTED_ITEM)){return}delete this.#top.ModulesValue;delete this.#top.Rebuy}#moduleMass(module,statsOverride){if(module===null)return 0;const modified=getLoadoutModifier(module,"Mass");if(modified!==null)return modified;const stats=statsOverride??this.#statsFor(module);if(stats?.mass!==void 0)return stats.mass;if(isBuiltInHullModule(module))return 0;return stats===null&&isNonOutfittingSlot(module.Slot)?0:null}#moduleCapacity(module,modifierLabel,field,statsOverride){if(module===null)return 0;const modified=getLoadoutModifier(module,modifierLabel);if(modified!==null)return modified;const stats=statsOverride??this.#statsFor(module);if(stats?.[field]!==void 0)return stats[field];const symbol=module.Item.toLowerCase();const isFuelTank=stats?.slot?stats.slot==="fuelTank":symbol.startsWith(FUEL_TANK_PREFIX);const shouldCarryCapacity=field==="cargoCapacity"?symbol.includes("cargorack"):isFuelTank;return shouldCarryCapacity?null:0}#resolveDrive(){let fsdModule;for(const m of this.#modules.values()){const stats=this.#statsFor(m);const isDrive=stats?.slot?stats.slot==="frameShiftDrive":m.Item.toLowerCase().startsWith(FSD_PREFIX);if(isDrive){fsdModule=m;break}}if(!fsdModule)return null;const base=this.#statsFor(fsdModule);if(!base||base.fuelMul===void 0||base.fuelPower===void 0){throw new TypeError(`ShipLoadout: no jump constants in the stats catalogue for frame shift drive "${truncate(fsdModule.Item)}"`)}const optMass=getLoadoutModifier(fsdModule,"FSDOptimalMass")??base.optMass;const maxFuel=getLoadoutModifier(fsdModule,"MaxFuelPerJump")??base.maxFuel;if(optMass===void 0||maxFuel===void 0){const missing=[...optMass===void 0?["optMass"]:[],...maxFuel===void 0?["maxFuel"]:[]];throw new TypeError(`ShipLoadout: frame shift drive "${truncate(fsdModule.Item)}" has no ${missing.join(" or ")} in the stats catalogue`)}return{optMass:optMass,maxFuel:maxFuel,fuelMul:base.fuelMul,fuelPower:base.fuelPower,jumpBoost:this.#resolveJumpBoost()}}#resolveJumpBoost(){for(const m of this.#modules.values()){const stats=this.#statsFor(m);if(stats?.engineeringGroup!=="fsdBoosters"&&!m.Item.toLowerCase().startsWith(BOOSTER_PREFIX)){continue}if(m.On===false)continue;if(stats?.jumpBoost===void 0){throw new TypeError(`ShipLoadout: FSD booster "${truncate(m.Item)}" has no jumpBoost in the stats catalogue`)}return stats.jumpBoost}return 0}#statsFor(module){if(module===null)return null;const stats=this.#moduleStats.get(module.Slot)??builtInModuleBySymbol(module.Item,FITTED_ITEM);if(stats)return stats;return isBuiltInHullModule(module)?builtInModuleBySymbol("ModularCargoBayDoor","ShipLoadout: built-in module"):null}};export{LoadoutEditError,ShipLoadout};//# sourceMappingURL=chunk-BYBT5XSW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ships/internal/loadout-metrics.ts","../src/ships/internal/loadout-views.ts","../src/ships/internal/loadout-fitting.ts","../src/ships/internal/loadout-export.ts","../src/ships/internal/loadout-import.ts","../src/ships/ship-loadout.ts"],"names":["weaponsCapacitorMetrics","shieldRecovery","cellBankSummary","shieldMetrics","getShipSlots","getShipBySymbol","getShipByName","parseSlef","toSlef","stringifySlef","getLoadoutModifier","enumerateSlots","parseSlotName","SLOT_RESTRICTION_LABELS","sourcePurchaseFromLoadout","getSourceModuleValue","powerBudget","isNonOutfittingSlot","isBuiltInHullModule","cloneLoadoutModule","identifyPreEngineeredVariant","cloneModuleStats","availableBlueprintsFor","availableExperimentalsFor","blueprintAvailableFor","blueprintRoutesFor","experimentalAvailableFor","primitiveEngineeringInputsFor","missingBaseLabels","journalModifiersFor","getPreEngineeredStats","unresolvedModifiers","getPreEngineeredJournalModifiers","getPreEngineeredModifiers","matchingKeyIn","FITTED_ITEM","isFinalGuardianWeaponEngineering","scaleDamageComponents","weaponMetrics","sumWeaponMetrics","combinedRateOfFire","builtInModuleBySymbol","getBulkheadsForShip","getPreEngineeredVariants","singleJumpRange","frameShiftDriveMassFactor","fuelPerJump","totalRange","completeResult","calculateUnladenMass","calculateCargoCapacity","calculateFuelCapacity","validateLoadout","mobilityMetrics","calculateModuleLimits","ALL_MODULES","CORE_MODULES","getDefaultLoadout","distributorMetrics","getExperimentalEffect","heatMetrics","ammunitionCapacity","armourMetrics","baseStats","computeModifiers","labelsForDamageType","scaleForLabel","fieldForLabel","labelsForField","capabilityValueForLabel","damageTypeForLabel","resolveBlueprintForModule","getExperimentalsForModule","getBlueprintGrade","normalizeKey","truncate","describeValue","requireString","requireStringIfPresent","deepFreeze","PREFIX","powerPlant","thrusters","frameShiftDrive","powerDistributor","shieldGenerator","shieldCellBank","shieldBooster","shieldReinforcement","hullReinforcement","moduleReinforcement","startsWithAny","symbol","prefixes","some","prefix","toLowerCase","startsWith","isPowerDistributor","module","stats","slot","Item","isEnabled","On","priorityOf","Priority","effectiveStat","field","stated","statedModifier","base","label","modified","effectiveCapability","Engineering","Modifiers","modifier","Label","effectiveDamageDistribution","fromEffect","ExperimentalEffect","damageDistribution","distribution","resolved","Value","type","convertsDamage","modifierRatio","effective","relatedStat","ratio","effectiveModule","merged","fields","Set","Object","keys","add","key","capability","value","engineeringGroup","massRatio","minMass","maxMass","performanceRatio","minMultiplier","maxMultiplier","category","normalizeEffectiveWeapon","damageComponents","damage","powerConsumerFor","draw","parsedSlot","Slot","mounted","deployedOnly","alwaysPowered","kind","common","priority","enabled","inherentlyPassiveSlot","core","drawUnknown","powerAvailable","modules","statsFor","isPlant","mapResistanceFields","read","kineticResistance","thermalResistance","explosiveResistance","causticResistance","resistancesOf","shieldInputFor","shipSymbol","systemsPips","hull","generator","boosters","reinforcement","strengthRatio","optMass","Math","max","optMultiplier","push","shieldBoost","hullMass","baseShieldStrength","mobilityInputFor","mass","enginesPips","isThruster","optSpeedMultiplier","speedCurve","minSpeedMultiplier","maxSpeedMultiplier","optRotationMultiplier","rotationCurve","minRotationMultiplier","maxRotationMultiplier","minimumSpeed","maximumSpeed","boost","minPitch","pitch","minRoll","roll","minYaw","yaw","shieldRecoveryInputFor","distributor","generatorStats","distributorStats","strength","regenRate","brokenRegenRate","distributorDraw","systemsCapacity","systemsRecharge","weaponsCapacitorInputFor","weaponsPips","budget","weaponsCapacity","weaponsRecharge","sustainedEnergyPerSecond","poweredStates","deployed","weapon","weaponStatsFor","distributorInputFor","pips","retracted","enginesCapacity","enginesRecharge","heatInputFor","heatEfficiency","thrusterHeatRate","deployedThrusterHeatRate","fsdHeatRate","weapons","running","heat","heatPerSecond","sustainedHeatPerSecond","heatCapacity","heatDissipation","retractedPowerDraw","poweredDraw","deployedPowerDraw","unknownDraws","map","consumer","state","powered","bands","reduce","total","band","min","length","poweredRetracted","poweredDeployed","cellBankInputsFor","banks","ammunition","reinforcementRate","shieldBankReinforcement","cells","spinUp","shieldBankSpinUp","duration","shieldBankDuration","shieldBankHeat","stockBulkhead","variants","name","find","v","endsWith","armourInputFor","reinforcements","moduleReinforcements","bulkhead","hullBoost","moduleProtection","integrity","stock","baseArmour","WEAPON_FIELDS","projectileRange","burstAdjustedRateOfFire","touched","rate","rateOfFire","statedDamagePerSecond","firingFactor","Number","roundsPerShot","maximumRange","falloffRange","CORE_NAMES","lifeSupport","sensors","fuelTank","RESTRICTED_OPTIONAL_NAMES","military","cargo","limpetController","vesselHangar","passenger","trailingDigits","start","code","charCodeAt","slice","loadoutSlotName","match","exec","restriction","numbered","optional","size","MILITARY_PREFIXES","MINING_PREFIXES","CARGO_PREFIXES","RESTRICTED_SLOT_PREFIXES","mining","planetaryApproachSuite","problem","constraint","message","params","restrictionProblem","moduleSlotProblem","required","restrictedToSlot","moduleFitProblem","ship","armourHull","armourShipName","armourShipSymbol","shipName","restricted","restrictedToShips","allowedShipNames","labels","index","join","allowedShipSymbols","wrongMount","moduleSlot","requiredCore","isFuelTank","class","moduleClass","slotSize","moduleFitError","REBUY_FRACTION","exportLoadoutEvent","input","options","fromSource","credits","source","sourcePurchase","totals","sourceTotalsHold","hullValue","retailHullValue","modulesValue","computedModulesValue","rebuy","trunc","event","Ship","ShipName","shipIdent","ShipIdent","HullValue","ModulesValue","unladenMass","UnladenMass","cargoCapacity","CargoCapacity","maxJumpRange","MaxJumpRange","fuelCapacity","FuelCapacity","Main","main","Reserve","reserve","Rebuy","Modules","exportModules","ordered","moduleOrder","slotOrderedModules","layout","values","on","explicitPower","sourceModuleValue","moduleValue","Health","TypeError","remaining","Map","get","delete","sum","cost","SOURCE_ITEM","entry","item","moduleValues","fitted","captureLoadoutEvent","Array","isArray","captureEach","captureModule","capture","captured","health","engineering","captureEngineering","experimental","experimentalLocalised","ExperimentalEffect_Localised","modifiers","BlueprintName","Level","Quality","normalizeLoadoutEvent","rawEvent","slots","entries","normalizedSlot","has","set","top","moduleStats","variant","variantStats","engineeringLocked","normalizedBlueprint","normalizedExperimental","exact","candidate","blueprint","grade","SLOT_KEY","requireLoadOptions","scope","isFinite","RangeError","LoadoutEditError","constructor","super","this","fromEntries","FSD_PREFIX","BOOSTER_PREFIX","FUEL_TANK_PREFIX","ShipLoadout","_ShipLoadout","primitiveModifiers","version","viewVersion","layoutCache","calculationCache","validationCache","fittedModuleCache","slotCache","fromSlef","fromLoadout","data","imported","empty","requested","loadout","unladenMassResult","computedUnladenMass","calculationModules","fuelCapacityResult","cap","freeze","computed","computedFuelCapacity","cargoCapacityResult","computedCargoCapacity","reserveFuelCapacity","validation","cached","layoutOrNull","byKey","builtIn","fitProblem","known","requiresKnownSlot","fitError","fitConstraint","fitParams","exclusionGroup","limitGroup","limitIncrease","existing","filter","currentLimits","moduleLimits","moduleStatsAt","immovableReason","moduleLimitRegression","fittedModuleAt","removable","slotKey","fittedModuleFor","raw","moduleForEffectiveStats","effectiveStats","preEngineeredVariant","fittedModules","flatMap","availableBlueprints","availableExperimentalEffects","modulesForSlot","requireSlot","occupied","group","currentStats","setModule","conflict","previousSlot","previousSymbol","limitProblem","count","limit","fittedKey","replaceModule","removeModule","applyBlueprint","fdname","wantedGrade","wantedQuality","quality","wantedExperimental","fittedStats","recipe","named","written","trim","acquisition","isInteger","offered","route","engineeringBaseStats","canonical","missing","features","damageModifier","OriginalValue","setPreEngineeredVariant","unresolved","clearEngineering","bare","setModuleEnabled","patchModule","setModulePriority","patch","toLoadoutEvent","fuel","exportableJumpRange","hullCost","header","toSlefString","indent","drive","resolveDrive","tank","maxFuel","maxJumpFuel","fsd","requireFuelCapacity","requireMass","jumpRange","ladenJumpRange","requireCargoCapacity","distance","jumpRangeSummary","unladen","laden","totalMax","totalUnladen","totalLaden","consumers","modulesForEffectiveStats","cellBanks","order","sort","left","right","MAX_SAFE_INTEGER","retailCredits","unpriced","record","metrics","invalidate","wanted","s","require","result","what","issues","i","resolveCalculationModules","unresolvedOutfitting","isCargoRack","includes","mayCarryCapacity","mayCarryFuel","moduleMass","moduleCapacity","replacement","current","previous","usage","increase","amount","baseLimit","excess","replacementStats","adjustImportedFigures","next","nextStats","previousMass","nextMass","previousCargo","nextCargo","previousFuel","nextFuel","statsOverride","modifierLabel","shouldCarryCapacity","fsdModule","m","isDrive","fuelMul","fuelPower","jumpBoost","resolveJumpBoost"],"mappings":"O,89EAkEA,IAAMgF,OAAS,CACXC,WAAY,CAAC,iBAAkB,0BAC/BC,UAAW,CAAC,aAAc,6BAC1BC,gBAAiB,CAAC,kBAClBC,iBAAkB,CAAC,uBAAwB,gCAC3CC,gBAAiB,CAAC,uBAClBC,eAAgB,CAAC,sBACjBC,cAAe,CAAC,qBAChBC,oBAAqB,CAAC,mCACtBC,kBAAmB,CACf,wBACA,gCACA,kCAEJC,oBAAqB,CAAC,0BAA2B,oCAGrD,IAAMC,cAAgB,CAACC,OAAgBC,WACnCA,SAASC,KAAMC,QAAWH,OAAOI,cAAcC,WAAWF,SAG9D,SAASG,mBAAmBC,OAAuBC,OAC/C,OAAOA,OAAOC,KACRD,MAAMC,OAAS,mBACfV,cAAcQ,OAAOG,KAAMtB,OAAOI,iBAC5C,CAGA,SAASmB,UAAUJ,QACf,OAAOA,OAAOK,KAAO,KACzB,CAGA,SAASC,WAAWN,QAEhB,OAAQA,OAAOO,UAAY,GAAK,CACpC,CASA,SAASC,cACLR,OACAS,MACAR,OAEA,MAAMS,OAASC,eAAeX,OAAQS,OACtC,GAAIC,cAAW,EAAW,OAAOA,OACjC,MAAME,KAAOX,QAAQQ,OACrB,cAAcG,OAAS,SAAWA,UAAO,CAC7C,CAWA,SAASD,eAAeX,OAAuBS,OAC3C,IAAA,MAAWI,SAAS5C,eAAewC,OAAQ,CACvC,GAAIvC,wBAAwB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