@elite-dangerous-almanac/core 0.1.8 → 0.2.0
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 +2 -2
- package/PROVENANCE/ships/SOURCES.md +11 -9
- package/README.md +54 -40
- package/dist/astro/galaxy-grid.js +1 -1
- package/dist/astro/index.d.ts +1 -1
- package/dist/astro/index.js +1 -1
- package/dist/astro/naming-region-origins.d.ts +1 -1
- package/dist/astro/naming-region-origins.js +1 -1
- package/dist/astro/nebulae.d.ts +2 -2
- package/dist/astro/permit-locks.d.ts +2 -1
- package/dist/astro/permit-locks.js +1 -1
- package/dist/astro/procedural-system.d.ts +2 -1
- package/dist/astro/procedural-system.js +1 -1
- package/dist/astro/sector-name.d.ts +2 -1
- package/dist/astro/sector-name.js +1 -1
- package/dist/astro/system-address.d.ts +1 -1
- package/dist/astro/system-name.d.ts +14 -9
- package/dist/astro/system-name.js +1 -1
- package/dist/chunk-2W5MW376.js +1 -0
- package/dist/chunk-2W5MW376.js.map +1 -0
- package/dist/{chunk-VZZUNSDF.js → chunk-4KJ7CR74.js} +1 -1
- package/dist/{chunk-VZZUNSDF.js.map → chunk-4KJ7CR74.js.map} +1 -1
- package/dist/{chunk-6EUVIZAS.js → chunk-4QYTVSNR.js} +1 -1
- package/dist/{chunk-EKQCVCMK.js → chunk-5ZVYRX6Z.js} +1 -1
- package/dist/{chunk-EKQCVCMK.js.map → chunk-5ZVYRX6Z.js.map} +1 -1
- package/dist/chunk-6GJHUWMO.js +1 -0
- package/dist/chunk-6GJHUWMO.js.map +1 -0
- package/dist/chunk-6L56LWTT.js +1 -0
- package/dist/chunk-6L56LWTT.js.map +1 -0
- package/dist/{chunk-GQ5GX5TB.js → chunk-6O4NRRSB.js} +1 -1
- package/dist/chunk-6O4NRRSB.js.map +1 -0
- package/dist/{chunk-WNGQ3IAM.js → chunk-6UNAD74Z.js} +1 -1
- package/dist/{chunk-WNGQ3IAM.js.map → chunk-6UNAD74Z.js.map} +1 -1
- package/dist/{chunk-JPBMRJFC.js → chunk-77I24V6B.js} +1 -1
- package/dist/chunk-77I24V6B.js.map +1 -0
- package/dist/chunk-7ATBEOVC.js +1 -0
- package/dist/chunk-7ATBEOVC.js.map +1 -0
- package/dist/chunk-7TQ2X6Q3.js +1 -0
- package/dist/chunk-7TQ2X6Q3.js.map +1 -0
- package/dist/{chunk-6EPYVBAX.js → chunk-A6OINYNP.js} +1 -1
- package/dist/{chunk-Q3QCLNVG.js → chunk-AYAKU4YA.js} +1 -1
- package/dist/chunk-AYAKU4YA.js.map +1 -0
- package/dist/chunk-B7EYTZRK.js +1 -0
- package/dist/chunk-B7EYTZRK.js.map +1 -0
- package/dist/{chunk-EBAHNZ36.js → chunk-CIULJH3G.js} +1 -1
- package/dist/{chunk-EBAHNZ36.js.map → chunk-CIULJH3G.js.map} +1 -1
- package/dist/{chunk-SNADUQSJ.js → chunk-CJK2IBI2.js} +1 -1
- package/dist/{chunk-SNADUQSJ.js.map → chunk-CJK2IBI2.js.map} +1 -1
- package/dist/{chunk-DYPOL3CI.js → chunk-CJQ37JII.js} +1 -1
- package/dist/chunk-CJQ37JII.js.map +1 -0
- package/dist/chunk-D6YEHR5S.js +1 -0
- package/dist/chunk-D6YEHR5S.js.map +1 -0
- package/dist/{chunk-Z6XMXMVI.js → chunk-DBDCOHI4.js} +1 -1
- package/dist/chunk-DBDCOHI4.js.map +1 -0
- package/dist/{chunk-AFVYCQWL.js → chunk-DCB4COCL.js} +1 -1
- package/dist/{chunk-AFVYCQWL.js.map → chunk-DCB4COCL.js.map} +1 -1
- package/dist/{chunk-CJWFY6OX.js → chunk-DSMLYA2M.js} +1 -1
- package/dist/{chunk-CJWFY6OX.js.map → chunk-DSMLYA2M.js.map} +1 -1
- package/dist/{chunk-UXBCLFGU.js → chunk-DWRNXUAX.js} +1 -1
- package/dist/{chunk-UXBCLFGU.js.map → chunk-DWRNXUAX.js.map} +1 -1
- package/dist/chunk-EVW4Z4CB.js +1 -0
- package/dist/chunk-EVW4Z4CB.js.map +1 -0
- package/dist/{chunk-4S6WB7QR.js → chunk-FF2X4K5P.js} +1 -1
- package/dist/chunk-FF2X4K5P.js.map +1 -0
- package/dist/chunk-FYVPZBXN.js +1 -0
- package/dist/chunk-FYVPZBXN.js.map +1 -0
- package/dist/{chunk-QTZPA2FR.js → chunk-GLWPSVFV.js} +1 -1
- package/dist/chunk-GLWPSVFV.js.map +1 -0
- package/dist/chunk-GZYPQIO2.js +1 -0
- package/dist/chunk-GZYPQIO2.js.map +1 -0
- package/dist/chunk-H47K3UWG.js +1 -0
- package/dist/chunk-H47K3UWG.js.map +1 -0
- package/dist/chunk-JGOAQLYW.js +1 -0
- package/dist/chunk-JGOAQLYW.js.map +1 -0
- package/dist/{chunk-JWWYAMGD.js → chunk-MGRDB2BZ.js} +1 -1
- package/dist/{chunk-JWWYAMGD.js.map → chunk-MGRDB2BZ.js.map} +1 -1
- package/dist/{chunk-MKGJPVPS.js → chunk-MRTTQYT5.js} +1 -1
- package/dist/{chunk-MKGJPVPS.js.map → chunk-MRTTQYT5.js.map} +1 -1
- package/dist/chunk-MTJ4MS7W.js +1 -0
- package/dist/chunk-MTJ4MS7W.js.map +1 -0
- package/dist/chunk-NIURLW2F.js +1 -0
- package/dist/chunk-NIURLW2F.js.map +1 -0
- package/dist/chunk-OLKNYGGT.js +1 -0
- package/dist/chunk-OLKNYGGT.js.map +1 -0
- package/dist/chunk-OYFMHDYT.js +1 -0
- package/dist/chunk-OYFMHDYT.js.map +1 -0
- package/dist/chunk-OYR5HUQZ.js +1 -0
- package/dist/chunk-OYR5HUQZ.js.map +1 -0
- package/dist/chunk-PL75RTA2.js +1 -0
- package/dist/{chunk-2VPVZELZ.js.map → chunk-PL75RTA2.js.map} +1 -1
- package/dist/chunk-PY5L6WC5.js +1 -0
- package/dist/chunk-PY5L6WC5.js.map +1 -0
- package/dist/{chunk-W6EPHHTS.js → chunk-Q2L75GSI.js} +1 -1
- package/dist/chunk-Q2L75GSI.js.map +1 -0
- package/dist/chunk-QJ7GB6FF.js +1 -0
- package/dist/chunk-QJ7GB6FF.js.map +1 -0
- package/dist/chunk-QTAMQ6ME.js +1 -0
- package/dist/chunk-QTAMQ6ME.js.map +1 -0
- package/dist/{chunk-FMPRCYKY.js → chunk-RRYBSAPX.js} +1 -1
- package/dist/chunk-RRYBSAPX.js.map +1 -0
- package/dist/{chunk-J42ZXLBL.js → chunk-T62GO4AA.js} +1 -1
- package/dist/chunk-T62GO4AA.js.map +1 -0
- package/dist/{chunk-E3BRVGJJ.js → chunk-TBZJIQ5P.js} +1 -1
- package/dist/{chunk-E3BRVGJJ.js.map → chunk-TBZJIQ5P.js.map} +1 -1
- package/dist/chunk-V3AEUBHV.js +1 -0
- package/dist/chunk-V3AEUBHV.js.map +1 -0
- package/dist/chunk-VYDQHPY2.js +1 -0
- package/dist/chunk-VYDQHPY2.js.map +1 -0
- package/dist/chunk-XUHAPOM6.js +1 -0
- package/dist/chunk-XUHAPOM6.js.map +1 -0
- package/dist/chunk-Y6KJJMIM.js +1 -0
- package/dist/chunk-Y6KJJMIM.js.map +1 -0
- package/dist/chunk-YXPZ7QQB.js +1 -0
- package/dist/chunk-YXPZ7QQB.js.map +1 -0
- package/dist/{chunk-Y6UZWNP4.js → chunk-ZCEAPJDH.js} +1 -1
- package/dist/{chunk-Y6UZWNP4.js.map → chunk-ZCEAPJDH.js.map} +1 -1
- package/dist/commodities/commodities.d.ts +20 -10
- package/dist/commodities/commodities.js +1 -1
- package/dist/commodities/index.d.ts +15 -4
- package/dist/commodities/index.js +1 -1
- package/dist/equipment/index.js +1 -1
- package/dist/equipment/modification-costs.d.ts +2 -1
- package/dist/equipment/modification-costs.js.map +1 -1
- package/dist/equipment/modification-journal.js +1 -1
- package/dist/equipment/modifications.d.ts +2 -1
- package/dist/equipment/modifications.js +1 -1
- package/dist/equipment/suits.d.ts +6 -3
- package/dist/equipment/suits.js +1 -1
- package/dist/equipment/upgrade-costs.d.ts +8 -4
- package/dist/equipment/upgrade-costs.js +1 -1
- package/dist/equipment/upgrade-costs.js.map +1 -1
- package/dist/equipment/weapons.d.ts +13 -5
- package/dist/equipment/weapons.js +1 -1
- package/dist/i18n/blueprints.d.ts +6 -6
- package/dist/i18n/blueprints.js +1 -1
- package/dist/i18n/diagnostics.d.ts +1 -13
- package/dist/i18n/engineering-groups.d.ts +1 -0
- package/dist/i18n/engineering-groups.js +1 -1
- package/dist/i18n/experimental-effect-descriptions.d.ts +4 -3
- package/dist/i18n/experimental-effect-descriptions.js +1 -1
- package/dist/i18n/experimental-effects.d.ts +5 -4
- package/dist/i18n/experimental-effects.js +1 -1
- package/dist/i18n/index.d.ts +1 -13
- package/dist/i18n/index.js +1 -1
- package/dist/i18n/pre-engineered.d.ts +7 -6
- package/dist/i18n/pre-engineered.js +1 -1
- package/dist/materials/index.d.ts +16 -4
- package/dist/materials/index.js +1 -1
- package/dist/materials/materials.d.ts +36 -19
- package/dist/materials/materials.js +1 -1
- package/dist/materials/micro-resources.d.ts +18 -7
- package/dist/materials/micro-resources.js +1 -1
- package/dist/ships/armour.d.ts +20 -4
- package/dist/ships/armour.js +1 -1
- package/dist/ships/blueprint-costs.d.ts +20 -17
- package/dist/ships/blueprint-costs.js +1 -1
- package/dist/ships/blueprint-journal.d.ts +9 -8
- package/dist/ships/blueprint-journal.js +1 -1
- package/dist/ships/blueprints.d.ts +14 -12
- package/dist/ships/blueprints.js +1 -1
- package/dist/ships/build-metrics.d.ts +1061 -0
- package/dist/ships/build-metrics.js +1 -0
- package/dist/ships/build-metrics.js.map +1 -0
- package/dist/ships/distributor.d.ts +10 -3
- package/dist/ships/distributor.js +1 -1
- package/dist/ships/engineering-options.d.ts +8 -6
- package/dist/ships/engineering-options.js +1 -1
- package/dist/ships/engineering.d.ts +2 -16
- package/dist/ships/engineering.js +1 -1
- package/dist/ships/experimental-effect-costs.d.ts +5 -5
- package/dist/ships/experimental-effect-costs.js +1 -1
- package/dist/ships/experimental-effects.d.ts +9 -8
- package/dist/ships/experimental-effects.js +1 -1
- package/dist/ships/heat.d.ts +7 -2
- package/dist/ships/heat.js +1 -1
- package/dist/ships/index.d.ts +34 -22
- package/dist/ships/index.js +1 -1
- package/dist/ships/jump-range.d.ts +10 -3
- package/dist/ships/jump-range.js +1 -1
- package/dist/ships/loadout-calculations.d.ts +1 -1
- package/dist/ships/loadout-calculations.js +1 -1
- package/dist/ships/mobility-capacitor.d.ts +90 -0
- package/dist/ships/mobility-capacitor.js +1 -0
- package/dist/ships/mobility-capacitor.js.map +1 -0
- package/dist/ships/mobility.d.ts +29 -17
- package/dist/ships/mobility.js +1 -1
- package/dist/ships/power.d.ts +12 -5
- package/dist/ships/power.js +1 -1
- package/dist/ships/pre-engineered-stats.d.ts +10 -8
- package/dist/ships/pre-engineered-stats.js +1 -1
- package/dist/ships/pre-engineered.d.ts +6 -6
- package/dist/ships/pre-engineered.js +1 -1
- package/dist/ships/resistances.d.ts +2 -2
- package/dist/ships/resistances.js +1 -1
- package/dist/ships/shield-capacitor.d.ts +133 -0
- package/dist/ships/shield-capacitor.js +1 -0
- package/dist/ships/shield-capacitor.js.map +1 -0
- package/dist/ships/shield-recovery.d.ts +16 -2
- package/dist/ships/shield-recovery.js +1 -1
- package/dist/ships/shields.d.ts +86 -28
- package/dist/ships/shields.js +1 -1
- package/dist/ships/ship-loadout.d.ts +91 -797
- package/dist/ships/ship-loadout.js +1 -1
- package/dist/ships/ships.d.ts +7 -6
- package/dist/ships/ships.js +1 -1
- package/dist/ships/slef.d.ts +1 -1
- package/dist/ships/source-purchase.d.ts +2 -1
- package/dist/ships/source-purchase.js +1 -1
- package/dist/ships/weapons-capacitor.d.ts +10 -3
- package/dist/ships/weapons-capacitor.js +1 -1
- package/dist/ships/weapons.d.ts +22 -6
- package/dist/ships/weapons.js +1 -1
- package/dist/{system-address-DYsN1qOT.d.ts → system-address-cyJaeZIS.d.ts} +2 -1
- package/package.json +17 -2
- package/dist/chunk-2FHHMYDC.js +0 -1
- package/dist/chunk-2FHHMYDC.js.map +0 -1
- package/dist/chunk-2TW4ZBI3.js +0 -1
- package/dist/chunk-2TW4ZBI3.js.map +0 -1
- package/dist/chunk-2VPVZELZ.js +0 -1
- package/dist/chunk-3BM5BHI3.js +0 -1
- package/dist/chunk-3BM5BHI3.js.map +0 -1
- package/dist/chunk-4S6WB7QR.js.map +0 -1
- package/dist/chunk-6BO5JJNI.js +0 -1
- package/dist/chunk-6BO5JJNI.js.map +0 -1
- package/dist/chunk-CX7B67OI.js +0 -1
- package/dist/chunk-CX7B67OI.js.map +0 -1
- package/dist/chunk-DVL5RBKX.js +0 -1
- package/dist/chunk-DVL5RBKX.js.map +0 -1
- package/dist/chunk-DYPOL3CI.js.map +0 -1
- package/dist/chunk-FGXWVFN6.js +0 -1
- package/dist/chunk-FGXWVFN6.js.map +0 -1
- package/dist/chunk-FMPRCYKY.js.map +0 -1
- package/dist/chunk-G3265B27.js +0 -1
- package/dist/chunk-G3265B27.js.map +0 -1
- package/dist/chunk-GQ5GX5TB.js.map +0 -1
- package/dist/chunk-IOJXLDJN.js +0 -1
- package/dist/chunk-IOJXLDJN.js.map +0 -1
- package/dist/chunk-IYU4WLFM.js +0 -1
- package/dist/chunk-IYU4WLFM.js.map +0 -1
- package/dist/chunk-J42ZXLBL.js.map +0 -1
- package/dist/chunk-JPBMRJFC.js.map +0 -1
- package/dist/chunk-LJI7VXJD.js +0 -1
- package/dist/chunk-LJI7VXJD.js.map +0 -1
- package/dist/chunk-OCND33TO.js +0 -1
- package/dist/chunk-OCND33TO.js.map +0 -1
- package/dist/chunk-P2QOL63K.js +0 -1
- package/dist/chunk-P2QOL63K.js.map +0 -1
- package/dist/chunk-Q3QCLNVG.js.map +0 -1
- package/dist/chunk-QTZPA2FR.js.map +0 -1
- package/dist/chunk-RLUS76LZ.js +0 -1
- package/dist/chunk-RLUS76LZ.js.map +0 -1
- package/dist/chunk-TEOJCBSG.js +0 -1
- package/dist/chunk-TEOJCBSG.js.map +0 -1
- package/dist/chunk-TMMGS6TC.js +0 -1
- package/dist/chunk-TMMGS6TC.js.map +0 -1
- package/dist/chunk-W6EPHHTS.js.map +0 -1
- package/dist/chunk-Z6XMXMVI.js.map +0 -1
- package/dist/chunk-ZNCXENNB.js +0 -1
- package/dist/chunk-ZNCXENNB.js.map +0 -1
- /package/dist/{chunk-6EUVIZAS.js.map → chunk-4QYTVSNR.js.map} +0 -0
- /package/dist/{chunk-6EPYVBAX.js.map → chunk-A6OINYNP.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
export{LoadoutEditError,ShipLoadout}from"../chunk-
|
|
1
|
+
export{LoadoutEditError,ShipLoadout}from"../chunk-OYFMHDYT.js"; //# sourceMappingURL=ship-loadout.js.map
|
package/dist/ships/ships.d.ts
CHANGED
|
@@ -136,8 +136,8 @@ interface Ship {
|
|
|
136
136
|
readonly optional: readonly OptionalSlotSpec[];
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
139
|
-
* Every player-flyable ship hull, in Frontier's shipyard order
|
|
140
|
-
*
|
|
139
|
+
* Every player-flyable ship hull, in Frontier's shipyard order — roughly the order the
|
|
140
|
+
* hulls were introduced, beginning with the Sidewinder.
|
|
141
141
|
*
|
|
142
142
|
* @example
|
|
143
143
|
* ```ts
|
|
@@ -192,10 +192,11 @@ declare function getShipByName(name: string): Ship | null;
|
|
|
192
192
|
* A hull's slot layout as a self-contained {@link ShipSlots}, ready to feed
|
|
193
193
|
* {@link enumerateSlots}.
|
|
194
194
|
*
|
|
195
|
-
* @param symbol - The internal identifier, e.g. `"Anaconda"
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
* fields already on {@link Ship}
|
|
195
|
+
* @param symbol - The internal identifier, e.g. `"Anaconda"`. Leading/trailing
|
|
196
|
+
* whitespace and case are ignored.
|
|
197
|
+
* @returns The hull's slot layout, or `null` if no hull with that symbol is carried.
|
|
198
|
+
* This is a projection of the slot-bearing fields already on {@link Ship}, all four of
|
|
199
|
+
* which every carried hull has, so a symbol that resolves always has a layout.
|
|
199
200
|
* @remarks
|
|
200
201
|
* This is the **read-only** layout, for your own outfitting UI (feed it to
|
|
201
202
|
* `enumerateSlots`). To assemble and edit an actual build — fit modules, engineer
|
package/dist/ships/ships.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{SHIPS,getShipByName,getShipBySymbol,getShipSlots}from"../chunk-
|
|
1
|
+
export{SHIPS,getShipByName,getShipBySymbol,getShipSlots}from"../chunk-6UNAD74Z.js"; //# sourceMappingURL=ships.js.map
|
package/dist/ships/slef.d.ts
CHANGED
|
@@ -316,7 +316,7 @@ declare function stringifySlef(slef: Slef, options?: SlefStringifyOptions): stri
|
|
|
316
316
|
*
|
|
317
317
|
* @param module - The fitted module.
|
|
318
318
|
* @param label - The stat's journal name, e.g. `"FSDOptimalMass"`. Matched
|
|
319
|
-
* case-insensitively.
|
|
319
|
+
* case-insensitively after trimming surrounding whitespace.
|
|
320
320
|
* @returns The modifier's numeric `Value`, or `null` if the module is not
|
|
321
321
|
* engineered, states no modifiers at all, carries no such modifier, or the modifier is
|
|
322
322
|
* non-numeric.
|
|
@@ -90,7 +90,8 @@ declare function sourcePurchaseFromLoadout(event: LoadoutEvent): SourcePurchaseR
|
|
|
90
90
|
*
|
|
91
91
|
* @param record - Purchase snapshot to query.
|
|
92
92
|
* @param slotKey - Slot key such as `"PowerPlant"`. An exact spelling wins; otherwise
|
|
93
|
-
* matching
|
|
93
|
+
* matching folds case and ignores surrounding whitespace, as every identifier lookup in
|
|
94
|
+
* the library does, so journal and lower-cased SLEF keys interoperate.
|
|
94
95
|
* @returns The frozen entry, or `null` when the source priced no module in that slot.
|
|
95
96
|
* `null` never means the module was free.
|
|
96
97
|
* @throws {TypeError} If `slotKey` is present and not a string. A nullish `slotKey` is a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{getSourceModuleValue,sourcePurchaseFromLoadout,sumSourceModuleValues}from"../chunk-
|
|
1
|
+
export{getSourceModuleValue,sourcePurchaseFromLoadout,sumSourceModuleValues}from"../chunk-NIURLW2F.js"; //# sourceMappingURL=source-purchase.js.map
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* `ratedRecharge * (weaponsPips / 4) ^ 1.1`. Endurance compares that rate with
|
|
7
7
|
* the weapons' sustained draw, so magazine reloads are already folded in.
|
|
8
8
|
*
|
|
9
|
-
* This module is data-free. {@link
|
|
10
|
-
* (`./
|
|
9
|
+
* This module is data-free. {@link BuildMetrics.weaponsCapacitorMetrics}
|
|
10
|
+
* (`./build-metrics`) resolves the powered distributor and weapons for you.
|
|
11
11
|
*
|
|
12
12
|
* @remarks
|
|
13
13
|
* Reference implementation: EDCD/Coriolis, `src/app/shipyard/Calculations.js`
|
|
@@ -29,7 +29,14 @@ interface WeaponsCapacitorInput {
|
|
|
29
29
|
/** Pips assigned to WEP, in `[0, 4]`. Fractional pips are accepted; defaults to `4`. */
|
|
30
30
|
readonly weaponsPips?: number;
|
|
31
31
|
}
|
|
32
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Recharge, drain and endurance of one weapons capacitor.
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* Frozen — nested records and lists included — so a result can be held, cached and
|
|
37
|
+
* shared without a defensive copy. Derive a changed figure with a spread rather than
|
|
38
|
+
* by assigning into one.
|
|
39
|
+
*/
|
|
33
40
|
interface WeaponsCapacitorMetrics {
|
|
34
41
|
/** Pips assigned to WEP for this result, in `[0, 4]`. */
|
|
35
42
|
readonly weaponsPips: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{weaponsCapacitorMetrics}from"../chunk-
|
|
1
|
+
export{weaponsCapacitorMetrics}from"../chunk-RRYBSAPX.js"; //# sourceMappingURL=weapons-capacitor.js.map
|
package/dist/ships/weapons.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ import './slots.js';
|
|
|
23
23
|
* above collapse to the raw stats.
|
|
24
24
|
*
|
|
25
25
|
* This module is data-free — hand it a weapon's stats (a catalogue record satisfies
|
|
26
|
-
* {@link WeaponStats} as-is). {@link
|
|
26
|
+
* {@link WeaponStats} as-is). {@link BuildMetrics.weaponMetrics} (in `./build-metrics`)
|
|
27
27
|
* reads a build's hardpoints, applies their engineering, and totals them for you.
|
|
28
28
|
*
|
|
29
29
|
* @remarks
|
|
@@ -124,6 +124,11 @@ interface WeaponStats {
|
|
|
124
124
|
/**
|
|
125
125
|
* Damage split across the established, unclassified and anti-xeno types, in the same
|
|
126
126
|
* unit as the figure it splits (for example, damage per second when splitting DPS).
|
|
127
|
+
*
|
|
128
|
+
* @remarks
|
|
129
|
+
* Frozen — nested records and lists included — so a result can be held, cached and
|
|
130
|
+
* shared without a defensive copy. Derive a changed figure with a spread rather than
|
|
131
|
+
* by assigning into one.
|
|
127
132
|
*/
|
|
128
133
|
interface DamageSplit {
|
|
129
134
|
/** Kinetic share. */
|
|
@@ -142,7 +147,14 @@ interface DamageSplit {
|
|
|
142
147
|
*/
|
|
143
148
|
readonly antiXeno: number;
|
|
144
149
|
}
|
|
145
|
-
/**
|
|
150
|
+
/**
|
|
151
|
+
* What one weapon does per second, sustained and unsustained.
|
|
152
|
+
*
|
|
153
|
+
* @remarks
|
|
154
|
+
* Frozen — nested records and lists included — so a result can be held, cached and
|
|
155
|
+
* shared without a defensive copy. Derive a changed figure with a spread rather than
|
|
156
|
+
* by assigning into one.
|
|
157
|
+
*/
|
|
146
158
|
interface WeaponMetrics {
|
|
147
159
|
/** Damage of one shot — `damage × roundsPerShot`. */
|
|
148
160
|
readonly damagePerShot: number;
|
|
@@ -173,7 +185,7 @@ interface WeaponMetrics {
|
|
|
173
185
|
* {@link damagePerSecond} split by damage type.
|
|
174
186
|
*
|
|
175
187
|
* @remarks
|
|
176
|
-
* Uses the split supplied in {@link WeaponStats}. {@link
|
|
188
|
+
* Uses the split supplied in {@link WeaponStats}. {@link BuildMetrics.weaponMetrics}
|
|
177
189
|
* resolves damage-converting experimental effects, Plasma Conversion blueprints and
|
|
178
190
|
* a journal's own damage-type modifiers before calling this calculation, so fitted
|
|
179
191
|
* conversions report their resulting split.
|
|
@@ -192,6 +204,10 @@ interface WeaponMetrics {
|
|
|
192
204
|
* therefore do not appear here: adding a beam laser's cadence to a multi-cannon's does
|
|
193
205
|
* not describe either weapon or the build. Use the individual {@link WeaponMetrics}
|
|
194
206
|
* when those figures matter.
|
|
207
|
+
*
|
|
208
|
+
* Frozen — nested records and lists included — so a result can be held, cached and
|
|
209
|
+
* shared without a defensive copy. Derive a changed figure with a spread rather than
|
|
210
|
+
* by assigning into one.
|
|
195
211
|
*/
|
|
196
212
|
interface WeaponTotals {
|
|
197
213
|
/** Damage per second while firing, summed across the weapons. */
|
|
@@ -379,12 +395,12 @@ declare function weaponMetrics(weapon: WeaponStats): WeaponMetrics;
|
|
|
379
395
|
* @returns The additive {@link WeaponTotals}. An empty list returns zeroes.
|
|
380
396
|
* @example
|
|
381
397
|
* ```ts
|
|
382
|
-
* import type {
|
|
398
|
+
* import type { BuildMetrics } from '@elite-dangerous-almanac/core/ships/build-metrics';
|
|
383
399
|
* import { sumWeaponMetrics } from '@elite-dangerous-almanac/core/ships/weapons';
|
|
384
400
|
*
|
|
385
|
-
* declare const
|
|
401
|
+
* declare const metrics: BuildMetrics;
|
|
386
402
|
*
|
|
387
|
-
* sumWeaponMetrics(
|
|
403
|
+
* sumWeaponMetrics(metrics.weaponMetrics().weapons.map((w) => w.metrics)).damagePerSecond;
|
|
388
404
|
* ```
|
|
389
405
|
*/
|
|
390
406
|
declare function sumWeaponMetrics(metrics: readonly WeaponMetrics[]): WeaponTotals;
|
package/dist/ships/weapons.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{armourPiercingFactor,combinedRateOfFire,damageFalloff,damagePerSecond,energyPerSecond,heatPerSecond,splitDamage,sumWeaponMetrics,sustainedDamagePerSecond,sustainedFireFactor,weaponMetrics}from"../chunk-
|
|
1
|
+
export{armourPiercingFactor,combinedRateOfFire,damageFalloff,damagePerSecond,energyPerSecond,heatPerSecond,splitDamage,sumWeaponMetrics,sustainedDamagePerSecond,sustainedFireFactor,weaponMetrics}from"../chunk-7TQ2X6Q3.js";//# sourceMappingURL=weapons.js.map
|
|
@@ -78,7 +78,8 @@ declare function getHandAuthoredRegionOrigin(name: string): NamingRegionOrigin |
|
|
|
78
78
|
* procedural sector and its origin synthesised from the sector grid. Returns
|
|
79
79
|
* `null` only when the name is neither catalogued nor a valid procedural sector.
|
|
80
80
|
*
|
|
81
|
-
* @param name - A region (sector) name in any casing
|
|
81
|
+
* @param name - A region (sector) name in any casing, with optional surrounding
|
|
82
|
+
* whitespace.
|
|
82
83
|
* @returns The region origin, or `null` if the name cannot be resolved.
|
|
83
84
|
* @throws {TypeError} If `name` is present and not a string. A nullish
|
|
84
85
|
* `name` is a miss, answered the way an unrecognised one is.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elite-dangerous-almanac/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Elite Dangerous static data and calculations: astronomy, ships and outfitting, personal equipment and engineering, materials, and market commodities.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -305,6 +305,10 @@
|
|
|
305
305
|
"types": "./dist/ships/blueprint-journal.d.ts",
|
|
306
306
|
"import": "./dist/ships/blueprint-journal.js"
|
|
307
307
|
},
|
|
308
|
+
"./ships/build-metrics": {
|
|
309
|
+
"types": "./dist/ships/build-metrics.d.ts",
|
|
310
|
+
"import": "./dist/ships/build-metrics.js"
|
|
311
|
+
},
|
|
308
312
|
"./ships/blueprints": {
|
|
309
313
|
"types": "./dist/ships/blueprints.d.ts",
|
|
310
314
|
"import": "./dist/ships/blueprints.js"
|
|
@@ -357,6 +361,10 @@
|
|
|
357
361
|
"types": "./dist/ships/mobility.d.ts",
|
|
358
362
|
"import": "./dist/ships/mobility.js"
|
|
359
363
|
},
|
|
364
|
+
"./ships/mobility-capacitor": {
|
|
365
|
+
"types": "./dist/ships/mobility-capacitor.d.ts",
|
|
366
|
+
"import": "./dist/ships/mobility-capacitor.js"
|
|
367
|
+
},
|
|
360
368
|
"./ships/module-capabilities": {
|
|
361
369
|
"types": "./dist/ships/module-capabilities.d.ts",
|
|
362
370
|
"import": "./dist/ships/module-capabilities.js"
|
|
@@ -413,6 +421,10 @@
|
|
|
413
421
|
"types": "./dist/ships/shield-recovery.d.ts",
|
|
414
422
|
"import": "./dist/ships/shield-recovery.js"
|
|
415
423
|
},
|
|
424
|
+
"./ships/shield-capacitor": {
|
|
425
|
+
"types": "./dist/ships/shield-capacitor.d.ts",
|
|
426
|
+
"import": "./dist/ships/shield-capacitor.js"
|
|
427
|
+
},
|
|
416
428
|
"./ships/shields": {
|
|
417
429
|
"types": "./dist/ships/shields.d.ts",
|
|
418
430
|
"import": "./dist/ships/shields.js"
|
|
@@ -458,17 +470,20 @@
|
|
|
458
470
|
"scripts": {
|
|
459
471
|
"audit": "pnpm audit --audit-level=low",
|
|
460
472
|
"build": "node scripts/copy-notices.mjs && node scripts/copy-assets.mjs && tsup && node scripts/prune-sourcemap-sources.mjs && node scripts/prune-barrel-imports.mjs && node scripts/attach-barrel-docs.mjs",
|
|
461
|
-
"check": "pnpm run check:fixtures && pnpm run lint && pnpm run format:check && pnpm run typecheck && pnpm run check:examples && pnpm test",
|
|
473
|
+
"check": "pnpm run check:fixtures && pnpm run check:i18n-coverage && pnpm run lint && pnpm run format:check && pnpm run typecheck && pnpm run check:examples && pnpm run check:sizes && pnpm test",
|
|
462
474
|
"check:fixtures": "node ../scripts/fixtures/generate-schema-and-types.mjs --check",
|
|
475
|
+
"check:i18n-coverage": "node scripts/i18n-coverage.mjs --check",
|
|
463
476
|
"format": "prettier --write . ../README.md ../CONTRIBUTING.md ../SECURITY.md ../schemas/**/*.{json,md} ../scripts/**/*.mjs ../.github/*.{md,yml} ../.github/workflows/*.yml ../.github/ISSUE_TEMPLATE/*.yml",
|
|
464
477
|
"format:check": "prettier --check . ../README.md ../CONTRIBUTING.md ../SECURITY.md ../schemas/**/*.{json,md} ../scripts/**/*.mjs ../.github/*.{md,yml} ../.github/workflows/*.yml ../.github/ISSUE_TEMPLATE/*.yml",
|
|
465
478
|
"generate:fixtures": "node ../scripts/fixtures/generate-schema-and-types.mjs",
|
|
479
|
+
"generate:i18n-coverage": "node scripts/i18n-coverage.mjs",
|
|
466
480
|
"lint": "eslint .",
|
|
467
481
|
"prepublishOnly": "pnpm run check && pnpm run build && pnpm run test:package",
|
|
468
482
|
"test": "node --experimental-test-coverage --test-coverage-include=\"src/internal/**/*.ts\" --test-coverage-include=\"src/astro/**/*.ts\" --test-coverage-include=\"src/materials/**/*.ts\" --test-coverage-include=\"src/equipment/**/*.ts\" --test-coverage-include=\"src/i18n/**/*.ts\" --test-coverage-include=\"src/ships/**/*.ts\" --test-coverage-include=\"src/commodities/**/*.ts\" --test-coverage-exclude=\"src/**/*.test.ts\" --test-coverage-lines=80 --test-coverage-branches=80 --test-coverage-functions=80 --import tsx --import ./scripts/register-jsonc.mjs --test \"src/**/*.test.ts\"",
|
|
469
483
|
"typecheck": "tsc --noEmit",
|
|
470
484
|
"docs": "typedoc && node scripts/build-wiki-sidebar.mjs && node scripts/postprocess-wiki.mjs",
|
|
471
485
|
"check:examples": "node --test scripts/example-claims.test.mjs scripts/example-runtime.test.mjs && node scripts/check-examples.mjs",
|
|
486
|
+
"check:sizes": "pnpm run build && node scripts/check-sizes.mjs",
|
|
472
487
|
"test:package": "node --test package.test.mjs"
|
|
473
488
|
},
|
|
474
489
|
"devDependencies": {
|
package/dist/chunk-2FHHMYDC.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{systemsResistance,mapDamageTypes,effectiveHitPoints,stackShieldResistance}from"./chunk-ZNCXENNB.js";function shieldMassCurveMultiplier(hullMass,generator){const{minMass:minMass,optMass:optMass,maxMass:maxMass,minMultiplier:minMultiplier,optMultiplier:optMultiplier,maxMultiplier:maxMultiplier}=generator;if(minMass===void 0||optMass===void 0||maxMass===void 0||minMultiplier===void 0||optMultiplier===void 0||maxMultiplier===void 0){return 0}if(hullMass>maxMass)return 0;const span=maxMass-minMass;if(span<=0||maxMultiplier===minMultiplier)return optMultiplier;const normalised=Math.max(0,Math.min(1,(maxMass-hullMass)/span));const optNormalised=Math.min(1,(maxMass-optMass)/span);const exponent=Math.log((optMultiplier-minMultiplier)/(maxMultiplier-minMultiplier))/Math.log(optNormalised);if(!Number.isFinite(exponent))return optMultiplier;return minMultiplier+Math.pow(normalised,exponent)*(maxMultiplier-minMultiplier)}function shieldStrength(hullMass,baseShieldStrength,generator,boostMultiplier=1){return baseShieldStrength*shieldMassCurveMultiplier(hullMass,generator)*boostMultiplier}var boosterResistances=(boosters,type)=>boosters.map(booster=>booster[`${type}Resistance`]??0);function shieldMetrics(input){const boosters=input.boosters??[];const reinforcement=input.reinforcement??0;const pips=input.systemsPips??0;const sysResistance=systemsResistance(pips);const generator=input.generator??null;if(!generator){const none=mapDamageTypes(()=>0);return{strength:0,generator:0,boosters:0,reinforcement:0,massCurveMultiplier:0,boostMultiplier:1,resistances:none,effectiveHitPoints:effectiveHitPoints(0,none),systemsResistance:sysResistance}}const massCurveMultiplier=shieldMassCurveMultiplier(input.hullMass,generator);const boostMultiplier=1+boosters.reduce((sum,booster)=>sum+(booster.shieldBoost??0),0);const generatorStrength=input.baseShieldStrength*massCurveMultiplier;const boostersStrength=generatorStrength*(boostMultiplier-1);const strength=generatorStrength+boostersStrength+reinforcement;const withPips=resistance=>1-(1-resistance)*(1-sysResistance);const resistances=mapDamageTypes(type=>withPips(stackShieldResistance(generator[`${type}Resistance`]??0,boosterResistances(boosters,type))));return{strength:strength,generator:generatorStrength,boosters:boostersStrength,reinforcement:reinforcement,massCurveMultiplier:massCurveMultiplier,boostMultiplier:boostMultiplier,resistances:resistances,effectiveHitPoints:effectiveHitPoints(strength,resistances),systemsResistance:sysResistance}}export{shieldMassCurveMultiplier,shieldMetrics,shieldStrength};//# sourceMappingURL=chunk-2FHHMYDC.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ships/shields.ts"],"names":["systemsResistance","mapDamageTypes","effectiveHitPoints","stackShieldResistance","shieldMassCurveMultiplier","hullMass","generator","minMass","optMass","maxMass","minMultiplier","optMultiplier","maxMultiplier","span","normalised","Math","max","min","optNormalised","exponent","log","Number","isFinite","pow","shieldStrength","baseShieldStrength","boostMultiplier","boosterResistances","boosters","type","map","booster","shieldMetrics","input","reinforcement","pips","systemsPips","sysResistance","none","strength","massCurveMultiplier","resistances","reduce","sum","shieldBoost","generatorStrength","boostersStrength","withPips","resistance"],"mappings":"O,oGA0LO,SAASI,0BACZC,SACAC,WAEA,MAAMC,QAAEA,QAAAC,QAASA,QAAAC,QAASA,QAAAC,cAASA,cAAAC,cAAeA,cAAAC,cAAeA,eAAkBN,UACnF,GACIC,eAAY,GACZC,eAAY,GACZC,eAAY,GACZC,qBAAkB,GAClBC,qBAAkB,GAClBC,qBAAkB,EACpB,CAGE,OAAO,CACX,CAEA,GAAIP,SAAWI,QAAS,OAAO,EAC/B,MAAMI,KAAOJ,QAAUF,QACvB,GAAIM,MAAQ,GAAKD,gBAAkBF,cAAe,OAAOC,cACzD,MAAMG,WAAaC,KAAKC,IAAI,EAAGD,KAAKE,IAAI,GAAIR,QAAUJ,UAAYQ,OAClE,MAAMK,cAAgBH,KAAKE,IAAI,GAAIR,QAAUD,SAAWK,MACxD,MAAMM,SACFJ,KAAKK,KAAKT,cAAgBD,gBAAkBE,cAAgBF,gBAC5DK,KAAKK,IAAIF,eACb,IAAKG,OAAOC,SAASH,UAAW,OAAOR,cACvC,OAAOD,cAAgBK,KAAKQ,IAAIT,WAAYK,WAAaP,cAAgBF,cAC7E,CAYO,SAASc,eACZnB,SACAoB,mBACAnB,UACAoB,gBAAkB,GAElB,OAAOD,mBAAqBrB,0BAA0BC,SAAUC,WAAaoB,eACjF,CAGA,IAAMC,mBAAqB,CAACC,SAA0CC,OAClED,SAASE,IAAKC,SAAYA,QAAQ,GAAGF,mBAAqB,GAmCvD,SAASG,cAAcC,OAC1B,MAAML,SAAWK,MAAML,UAAY,GACnC,MAAMM,cAAgBD,MAAMC,eAAiB,EAC7C,MAAMC,KAAOF,MAAMG,aAAe,EAClC,MAAMC,cAAgBrC,kBAAkBmC,MACxC,MAAM7B,UAAY2B,MAAM3B,WAAa,KAErC,IAAKA,UAAW,CACZ,MAAMgC,KAAOrC,eAAe,IAAM,GAClC,MAAO,CACHsC,SAAU,EACVjC,UAAW,EACXsB,SAAU,EACVM,cAAe,EACfM,oBAAqB,EACrBd,gBAAiB,EACjBe,YAAaH,KACbpC,mBAAoBA,mBAAmB,EAAGoC,MAC1CtC,kBAAmBqC,cAE3B,CAEA,MAAMG,oBAAsBpC,0BAA0B6B,MAAM5B,SAAUC,WACtE,MAAMoB,gBACF,EAAIE,SAASc,OAAO,CAACC,IAAKZ,UAAYY,KAAOZ,QAAQa,aAAe,GAAI,GAC5E,MAAMC,kBAAoBZ,MAAMR,mBAAqBe,oBACrD,MAAMM,iBAAmBD,mBAAqBnB,gBAAkB,GAChE,MAAMa,SAAWM,kBAAoBC,iBAAmBZ,cAGxD,MAAMa,SAAYC,YAA+B,GAAK,EAAIA,aAAe,EAAIX,eAC7E,MAAMI,YAAiCxC,eAAgB4B,MACnDkB,SACI5C,sBACIG,UAAU,GAAGuB,mBAAqB,EAClCF,mBAAmBC,SAAUC,SAKzC,MAAO,CACHU,kBACAjC,UAAWuC,kBACXjB,SAAUkB,iBACVZ,4BACAM,wCACAd,gCACAe,wBACAvC,mBAAoBA,mBAAmBqC,SAAUE,aACjDzC,kBAAmBqC,cAE3B,QAAAjC,0BAAA4B,cAAAR"}
|
package/dist/chunk-2TW4ZBI3.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{getBlueprintsForModule}from"./chunk-QTZPA2FR.js";import{normalizeKey}from"./chunk-BKWLI44T.js";import{requireStringIfPresent,requireString}from"./chunk-PKWVG2JY.js";import{deepFreeze}from"./chunk-DURKO7JU.js";var blueprint_journal_names_default={MC_Overcharged:"Weapon_Overcharged",Scanner_LongRange:"Sensor_LongRange",Scanner_WideAngle:"Sensor_WideAngle"};var BLUEPRINT_JOURNAL_NAMES=deepFreeze(blueprint_journal_names_default);function resolveBlueprintForModule(symbol,fdname){requireStringIfPresent(symbol,"resolveBlueprintForModule: symbol");const wanted=normalizeKey(requireString(fdname,"resolveBlueprintForModule: fdname"),"resolveBlueprintForModule: fdname");const offered=getBlueprintsForModule(symbol);if(offered.some(id=>id.toLowerCase()===wanted))return fdname;for(const id of offered){const journalName=BLUEPRINT_JOURNAL_NAMES[id];if(journalName!==void 0&&journalName.toLowerCase()===wanted)return id}return fdname}export{resolveBlueprintForModule};//# sourceMappingURL=chunk-2TW4ZBI3.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ships/internal/blueprint-journal-names.ts","../src/ships/blueprint-journal.ts"],"names":["getBlueprintsForModule","normalizeKey","requireStringIfPresent","requireString","deepFreeze","blueprint_journal_names_default","BLUEPRINT_JOURNAL_NAMES","resolveBlueprintForModule","symbol","fdname","wanted","offered","some","id","toLowerCase","journalName"],"mappings":"O,qWAKO,IAAMM,wBAA4DF,WACrEC,iCCuEG,SAASE,0BAA0BC,OAAgBC,QACtDP,uBAAuBM,OAAQ,qCAI/B,MAAME,OAAST,aACXE,cAAcM,OAAQ,qCACtB,qCAEJ,MAAME,QAAUX,uBAAuBQ,QAGvC,GAAIG,QAAQC,KAAMC,IAAOA,GAAGC,gBAAkBJ,QAAS,OAAOD,OAC9D,IAAA,MAAWI,MAAMF,QAAS,CACtB,MAAMI,YAAcT,wBAAwBO,IAC5C,GAAIE,mBAAgB,GAAaA,YAAYD,gBAAkBJ,OAAQ,OAAOG,EAClF,CACA,OAAOJ,MACX,QAAAF"}
|
package/dist/chunk-2VPVZELZ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{filterByKey}from"./chunk-BKWLI44T.js";import{requireStringIfPresent}from"./chunk-PKWVG2JY.js";import{deepFreeze}from"./chunk-DURKO7JU.js";var pre_engineered_default=[{symbol:"Hpt_Mining_AbrBlstr_Fixed_Small",name:"Far-Reaching Abrasion Blaster",blueprint:"AbrasionBlaster_FarReaching",grade:1,acquisition:"mercenary",mercCoinCost:400},{symbol:"Hpt_CausticMissile_Fixed_Medium",name:"High-Yield Enzyme Missile Rack",blueprint:"EnzymeMissileRack_HighYield",grade:1,acquisition:"mercenary",mercCoinCost:850},{symbol:"Hpt_Slugshot_Gimbal_Small",name:"Double Screaming Fragment Cannon",blueprint:"FragmentCannonSmall_DoubleScreaming",grade:1,acquisition:"mercenary",mercCoinCost:800},{symbol:"Hpt_Slugshot_Gimbal_Large",name:"Double Screaming Fragment Cannon",blueprint:"FragmentCannonLarge_DoubleScreaming",grade:1,acquisition:"mercenary",mercCoinCost:950},{symbol:"Hpt_MiningLaser_Fixed_Small",name:"Long Range Mining Laser",blueprint:"MiningLaser_LongRange",grade:1,acquisition:"mercenary",mercCoinCost:450},{symbol:"Hpt_MultiCannon_Fixed_Medium",name:"Rapid Phase Multi-Cannon",blueprint:"MultiCannon_Rapid",grade:1,acquisition:"mercenary",mercCoinCost:850},{symbol:"Hpt_Railgun_Fixed_Medium",name:"Enduring Feedback Rail Gun",blueprint:"RailGun_LongShot",grade:1,acquisition:"mercenary",mercCoinCost:950},{symbol:"Hpt_BasicMissileRack_Fixed_Medium",name:"Drag Seeker Missile Rack",blueprint:"SeekerMissileRack_Drag",grade:1,acquisition:"mercenary",mercCoinCost:800},{symbol:"Hpt_BasicMissileRack_Fixed_Large",name:"Drag Seeker Missile Rack",blueprint:"SeekerMissileRack_Drag",grade:1,acquisition:"mercenary",mercCoinCost:900},{symbol:"Hpt_BasicMissileRack_Fixed_Medium",name:"Lightweight Thermal Seeker Missile Rack",blueprint:"SeekerMissileRack_LightWeightThermal",grade:1,acquisition:"mercenary",mercCoinCost:800},{symbol:"Hpt_BasicMissileRack_Fixed_Medium",name:"Lockdown Seeker Missile Rack",blueprint:"SeekerMissileRackMedium_Lockdown",grade:1,acquisition:"mercenary",mercCoinCost:800},{symbol:"Hpt_BasicMissileRack_Fixed_Large",name:"Lockdown Seeker Missile Rack",blueprint:"SeekerMissileRackLarge_Lockdown",grade:1,acquisition:"mercenary",mercCoinCost:900},{symbol:"Int_CargoRack_Size5_Class1",name:"Extended Cargo Rack",blueprint:"CargoRackS5C1_Extended",grade:1,acquisition:"mercenary",mercCoinCost:550},{symbol:"Int_CargoRack_Size6_Class1",name:"Extended Cargo Rack",blueprint:"CargoRackS6C1_Extended",grade:1,acquisition:"mercenary",mercCoinCost:550},{symbol:"Int_DetailedSurfaceScanner_Tiny",name:"Long Range Detailed Surface Scanner",blueprint:"DetailedSurfaceScanner_LongRange",grade:1,acquisition:"mercenary",mercCoinCost:350},{symbol:"Int_ModuleReinforcement_Size5_Class2",name:"Heavy Duty Module Reinforcement Package",blueprint:"ModuleReinforcement_HeavyDuty",grade:1,acquisition:"mercenary",mercCoinCost:450},{symbol:"Int_PowerDistributor_Size3_Class2",name:"Support Focused Power Distributor",blueprint:"PowerDistributorS3C2_SupportFocused",grade:1,acquisition:"mercenary",mercCoinCost:300},{symbol:"Int_PowerDistributor_Size3_Class5",name:"Support Focused Power Distributor",blueprint:"PowerDistributorS3C5_SupportFocused",grade:1,acquisition:"mercenary",mercCoinCost:350},{symbol:"Int_PowerDistributor_Size4_Class2",name:"Support Focused Power Distributor",blueprint:"PowerDistributorS4C2_SupportFocused",grade:1,acquisition:"mercenary",mercCoinCost:400},{symbol:"Int_PowerDistributor_Size4_Class5",name:"Support Focused Power Distributor",blueprint:"PowerDistributorS4C5_SupportFocused",grade:1,acquisition:"mercenary",mercCoinCost:450},{symbol:"Int_PowerDistributor_Size5_Class5",name:"Balanced Power Distributor",blueprint:"PowerDistributor_Balanced",grade:1,acquisition:"mercenary",mercCoinCost:500},{symbol:"Int_PowerDistributor_Size6_Class5",name:"Support Focused Power Distributor",blueprint:"PowerDistributorS6C5_SupportFocused",grade:1,acquisition:"mercenary",mercCoinCost:550},{symbol:"Hpt_Mining_AbrBlstr_Fixed_Small",name:"Abrasion Blaster",blueprint:"Weapon_LongRange",grade:5,acquisition:"communityGoal",modifiers:[{label:"DistributorDraw",method:"multiplicative",value:-.5},{label:"FalloffRange",method:"multiplicative",value:4},{label:"Integrity",method:"multiplicative",value:-.5},{label:"MaximumRange",method:"multiplicative",value:4},{label:"PowerDraw",method:"multiplicative",value:-.5},{label:"ThermalLoad",method:"multiplicative",value:-.5}]},{symbol:"Hpt_CausticMissile_Fixed_Medium",name:"Enzyme Missile Rack",blueprint:"Weapon_HighCapacity",grade:5,acquisition:"communityGoal",engineeringLocked:true,modifiers:[{label:"AmmoClipSize",method:"multiplicative",value:.75},{label:"AmmoMaximum",method:"multiplicative",value:.25},{label:"Damage",method:"multiplicative",value:.5},{label:"Mass",method:"multiplicative",value:.6},{label:"PowerDraw",method:"multiplicative",value:.2}]},{symbol:"Hpt_Slugshot_Gimbal_Small",name:"Fragment Cannon",blueprint:"Weapon_DoubleShot",grade:5,acquisition:"communityGoal",experimental:"special_screening_shell",modifiers:[{label:"AmmoClipSize",method:"multiplicative",value:1.6667},{label:"AmmoMaximum",method:"multiplicative",value:.67776},{label:"BurstInterval",method:"multiplicative",value:-.06},{label:"BurstSize",method:"overwrite",value:2},{label:"Mass",method:"multiplicative",value:.6},{label:"MaximumRange",method:"multiplicative",value:-.1},{label:"PowerDraw",method:"multiplicative",value:.2}]},{symbol:"Hpt_Slugshot_Gimbal_Large",name:"Fragment Cannon",blueprint:"Weapon_DoubleShot",grade:5,acquisition:"communityGoal",experimental:"special_screening_shell",modifiers:[{label:"AmmoClipSize",method:"multiplicative",value:1.6667},{label:"AmmoMaximum",method:"multiplicative",value:.67776},{label:"BurstInterval",method:"multiplicative",value:-.06},{label:"BurstSize",method:"overwrite",value:2},{label:"Mass",method:"multiplicative",value:.6},{label:"MaximumRange",method:"multiplicative",value:-.1},{label:"PowerDraw",method:"multiplicative",value:.2}]},{symbol:"Hpt_Guardian_ShardCannon_Fixed_Medium",name:"Guardian Shard Cannon",blueprint:"Weapon_LongRange",grade:5,acquisition:"communityGoal",engineeringLocked:true,modifiers:[{label:"ArmourPenetration",method:"multiplicative",value:1.02},{label:"DistributorDraw",method:"multiplicative",value:5.05},{label:"Jitter",method:"additive",value:-3.5},{label:"Mass",method:"multiplicative",value:.5},{label:"MaximumRange",method:"multiplicative",value:4},{label:"PowerDraw",method:"multiplicative",value:1.3},{label:"ShotSpeed",method:"overwrite",value:1258.89},{label:"ThermalLoad",method:"multiplicative",value:15.5}]},{symbol:"Hpt_MultiCannon_Fixed_Medium",name:"Multi-Cannon",blueprint:"Weapon_RapidFire",grade:1,acquisition:"communityGoal",experimental:"special_phasing_sequence",modifiers:[{label:"AmmoClipSize",method:"multiplicative",value:3},{label:"AmmoMaximum",method:"overwrite",value:6400},{label:"BurstInterval",method:"overwrite",value:.1},{label:"FalloffRange",method:"multiplicative",value:-.1},{label:"Jitter",method:"additive",value:3},{label:"MaximumRange",method:"multiplicative",value:-.5},{label:"RoundsPerShot",method:"additive",value:2}]},{symbol:"Hpt_Railgun_Fixed_Medium",name:"Rail Gun",blueprint:"Weapon_HighCapacity",grade:5,acquisition:"communityGoal",experimental:"special_feedback_cascade_cooled",modifiers:[{label:"AmmoClipSize",method:"multiplicative",value:1},{label:"AmmoMaximum",method:"multiplicative",value:1},{label:"BurstInterval",method:"multiplicative",value:-.61145},{label:"FalloffRange",method:"multiplicative",value:5},{label:"Mass",method:"multiplicative",value:.9},{label:"MaximumRange",method:"multiplicative",value:1},{label:"PowerDraw",method:"multiplicative",value:.65},{label:"ReloadTime",method:"multiplicative",value:.25}]},{symbol:"Hpt_Railgun_Fixed_Medium_Burst",name:"Imperial Hammer Rail Gun",blueprint:"Weapon_HighCapacity",grade:5,acquisition:"communityGoal",experimental:"special_super_penetrator",modifiers:[{label:"AmmoClipSize",method:"multiplicative",value:1},{label:"AmmoMaximum",method:"multiplicative",value:1},{label:"BurstInterval",method:"multiplicative",value:-.2635},{label:"Damage",method:"multiplicative",value:-.2},{label:"Mass",method:"multiplicative",value:.7},{label:"PowerDraw",method:"multiplicative",value:.25}]},{symbol:"Hpt_BasicMissileRack_Fixed_Medium",name:"Seeker Missile Rack",blueprint:"Weapon_HighCapacity",grade:1,acquisition:"communityGoal",experimental:"special_drag_munitions",modifiers:[{label:"AmmoClipSize",method:"multiplicative",value:2},{label:"AmmoMaximum",method:"multiplicative",value:2},{label:"BurstInterval",method:"multiplicative",value:-.2},{label:"DistributorDraw",method:"overwrite",value:.34},{label:"Mass",method:"multiplicative",value:1.5},{label:"PowerDraw",method:"multiplicative",value:.25}]},{symbol:"Hpt_BasicMissileRack_Fixed_Medium",name:"Seeker Missile Rack",blueprint:"Weapon_HighCapacity",grade:5,acquisition:"communityGoal",experimental:"special_fsd_interrupt",modifiers:[{label:"AmmoClipSize",method:"multiplicative",value:1},{label:"AmmoMaximum",method:"multiplicative",value:1},{label:"ArmourPenetration",method:"multiplicative",value:.4},{label:"BurstInterval",method:"multiplicative",value:-.1},{label:"Damage",method:"multiplicative",value:.35},{label:"Integrity",method:"multiplicative",value:1},{label:"Mass",method:"multiplicative",value:1.2},{label:"PowerDraw",method:"multiplicative",value:.3},{label:"ThermalLoad",method:"multiplicative",value:-.1}]},{symbol:"Hpt_BasicMissileRack_Fixed_Large",name:"Seeker Missile Rack",blueprint:"Weapon_HighCapacity",grade:5,acquisition:"communityGoal",experimental:"special_fsd_interrupt",modifiers:[{label:"AmmoClipSize",method:"multiplicative",value:1},{label:"AmmoMaximum",method:"multiplicative",value:1},{label:"ArmourPenetration",method:"multiplicative",value:.4},{label:"BurstInterval",method:"multiplicative",value:-.1},{label:"Damage",method:"multiplicative",value:.35},{label:"Integrity",method:"multiplicative",value:1},{label:"Mass",method:"multiplicative",value:1.2},{label:"PowerDraw",method:"multiplicative",value:.3},{label:"ThermalLoad",method:"multiplicative",value:-.1}]},{symbol:"Hpt_ElectronicCountermeasure_Tiny",name:"Electronic Countermeasure",blueprint:"Misc_LightWeight",grade:5,acquisition:"communityGoal",modifiers:[{label:"Integrity",method:"multiplicative",value:1},{label:"Mass",method:"multiplicative",value:-.85},{label:"PowerDraw",method:"multiplicative",value:1}]},{symbol:"Hpt_CrimeScanner_Size0_Class5",name:"Kill Warrant Scanner",blueprint:"Sensor_FastScan",grade:5,acquisition:"communityGoal",modifiers:[{label:"Integrity",method:"multiplicative",value:-.5},{label:"MaxAngle",method:"multiplicative",value:-.3},{label:"PowerDraw",method:"multiplicative",value:.5},{label:"ScannerRange",method:"multiplicative",value:.65},{label:"ScannerTimeToScan",method:"multiplicative",value:-.8}]},{symbol:"Hpt_CrimeScanner_Size0_Class3",name:"Kill Warrant Scanner",blueprint:"Sensor_FastScan",grade:5,acquisition:"communityGoal",modifiers:[{label:"Integrity",method:"multiplicative",value:-.5},{label:"MaxAngle",method:"multiplicative",value:-.3},{label:"PowerDraw",method:"multiplicative",value:.5},{label:"ScannerRange",method:"multiplicative",value:.65},{label:"ScannerTimeToScan",method:"multiplicative",value:-.8}]},{symbol:"Hpt_PlasmaPointDefence_Turret_Tiny",name:"Point Defence",blueprint:"Misc_LightWeight",grade:5,acquisition:"communityGoal",modifiers:[{label:"Integrity",method:"multiplicative",value:-.5},{label:"Mass",method:"multiplicative",value:-.85},{label:"MaximumRange",method:"multiplicative",value:1},{label:"ThermalLoad",method:"multiplicative",value:.05}]},{symbol:"Int_PowerDistributor_Size3_Class5",name:"Power Distributor",blueprint:"PowerDistributor_PrioritySystems",grade:5,acquisition:"communityGoal",modifiers:[{label:"EnginesCapacity",method:"multiplicative",value:.45},{label:"EnginesRecharge",method:"multiplicative",value:.4},{label:"SystemsCapacity",method:"multiplicative",value:.45},{label:"SystemsRecharge",method:"multiplicative",value:.4},{label:"WeaponsCapacity",method:"multiplicative",value:-.25},{label:"WeaponsRecharge",method:"multiplicative",value:-.2}]},{symbol:"Int_PowerDistributor_Size3_Class2",name:"Power Distributor",blueprint:"PowerDistributor_PrioritySystems",grade:5,acquisition:"communityGoal",modifiers:[{label:"EnginesCapacity",method:"multiplicative",value:.45},{label:"EnginesRecharge",method:"multiplicative",value:.4},{label:"SystemsCapacity",method:"multiplicative",value:.45},{label:"SystemsRecharge",method:"multiplicative",value:.4},{label:"WeaponsCapacity",method:"multiplicative",value:-.25},{label:"WeaponsRecharge",method:"multiplicative",value:-.2}]},{symbol:"Int_PowerDistributor_Size4_Class5",name:"Power Distributor",blueprint:"PowerDistributor_PrioritySystems",grade:5,acquisition:"communityGoal",modifiers:[{label:"EnginesCapacity",method:"multiplicative",value:.45},{label:"EnginesRecharge",method:"multiplicative",value:.4},{label:"SystemsCapacity",method:"multiplicative",value:.45},{label:"SystemsRecharge",method:"multiplicative",value:.4},{label:"WeaponsCapacity",method:"multiplicative",value:-.25},{label:"WeaponsRecharge",method:"multiplicative",value:-.2}]},{symbol:"Int_PowerDistributor_Size4_Class2",name:"Power Distributor",blueprint:"PowerDistributor_PrioritySystems",grade:5,acquisition:"communityGoal",modifiers:[{label:"EnginesCapacity",method:"multiplicative",value:.45},{label:"EnginesRecharge",method:"multiplicative",value:.4},{label:"SystemsCapacity",method:"multiplicative",value:.45},{label:"SystemsRecharge",method:"multiplicative",value:.4},{label:"WeaponsCapacity",method:"multiplicative",value:-.25},{label:"WeaponsRecharge",method:"multiplicative",value:-.2}]},{symbol:"Int_PowerDistributor_Size6_Class5",name:"Power Distributor",blueprint:"PowerDistributor_PrioritySystems",grade:5,acquisition:"communityGoal",modifiers:[{label:"EnginesCapacity",method:"multiplicative",value:.45},{label:"EnginesRecharge",method:"multiplicative",value:.4},{label:"SystemsCapacity",method:"multiplicative",value:.45},{label:"SystemsRecharge",method:"multiplicative",value:.4},{label:"WeaponsCapacity",method:"multiplicative",value:-.25},{label:"WeaponsRecharge",method:"multiplicative",value:-.2}]},{symbol:"Int_Powerplant_Size3_Class5",name:"Power Plant",blueprint:"PowerPlant_Armoured",grade:5,acquisition:"communityGoal",modifiers:[{label:"HeatEfficiency",method:"multiplicative",value:.13},{label:"Integrity",method:"multiplicative",value:.95},{label:"Mass",method:"multiplicative",value:.2},{label:"PowerCapacity",method:"multiplicative",value:.52}]},{symbol:"Int_Powerplant_Size3_Class5",name:"Power Plant",blueprint:"PowerPlant_Boosted",grade:5,acquisition:"communityGoal",modifiers:[{label:"HeatEfficiency",method:"multiplicative",value:.35},{label:"Integrity",method:"multiplicative",value:-.3},{label:"PowerCapacity",method:"multiplicative",value:.6}]},{symbol:"Int_Powerplant_Size4_Class5",name:"Power Plant",blueprint:"PowerPlant_Boosted",grade:5,acquisition:"communityGoal",modifiers:[{label:"HeatEfficiency",method:"multiplicative",value:.35},{label:"Integrity",method:"multiplicative",value:-.3},{label:"PowerCapacity",method:"multiplicative",value:.6}]},{symbol:"Int_Powerplant_Size5_Class5",name:"Power Plant",blueprint:"PowerPlant_Boosted",grade:5,acquisition:"communityGoal",modifiers:[{label:"HeatEfficiency",method:"multiplicative",value:.35},{label:"Integrity",method:"overwrite",value:74},{label:"PowerCapacity",method:"multiplicative",value:.6}]},{symbol:"Int_Hyperdrive_Size3_Class5",name:"Frame Shift Drive",blueprint:"FSD_LongRange",grade:5,acquisition:"communityGoal",modifiers:[{label:"BootTime",method:"multiplicative",value:-.8},{label:"FSDHeatRate",method:"multiplicative",value:.2},{label:"FSDOptimalMass",method:"multiplicative",value:.7},{label:"Integrity",method:"multiplicative",value:-.3},{label:"Mass",method:"multiplicative",value:.3},{label:"PowerDraw",method:"multiplicative",value:.15}]},{symbol:"Int_Hyperdrive_Size4_Class5",name:"Frame Shift Drive",blueprint:"FSD_LongRange",grade:5,acquisition:"communityGoal",modifiers:[{label:"BootTime",method:"multiplicative",value:-.8},{label:"FSDHeatRate",method:"multiplicative",value:.2},{label:"FSDOptimalMass",method:"multiplicative",value:.7},{label:"Integrity",method:"multiplicative",value:-.3},{label:"Mass",method:"multiplicative",value:.3},{label:"PowerDraw",method:"multiplicative",value:.15}]},{symbol:"Int_Hyperdrive_Size6_Class5",name:"Frame Shift Drive",blueprint:"FSD_LongRange",grade:5,acquisition:"communityGoal",modifiers:[{label:"BootTime",method:"multiplicative",value:-.8},{label:"FSDHeatRate",method:"multiplicative",value:.2},{label:"FSDOptimalMass",method:"multiplicative",value:.7},{label:"Integrity",method:"multiplicative",value:-.3},{label:"Mass",method:"multiplicative",value:.3},{label:"PowerDraw",method:"multiplicative",value:.15}]},{symbol:"Int_CargoRack_Size5_Class1",name:"Cargo Rack",blueprint:"CargoRack_IncreasedCapacity",grade:5,acquisition:"communityGoal",modifiers:[{label:"CargoCapacity",method:"multiplicative",value:.34375}]},{symbol:"Int_CargoRack_Size6_Class1",name:"Cargo Rack",blueprint:"CargoRack_IncreasedCapacity",grade:5,acquisition:"communityGoal",modifiers:[{label:"CargoCapacity",method:"multiplicative",value:.34375}]},{symbol:"Int_ShieldGenerator_Size3_Class5",name:"Shield Generator",blueprint:"ShieldGenerator_Kinetic",grade:5,acquisition:"communityGoal",modifiers:[{label:"Integrity",method:"multiplicative",value:.2},{label:"KineticResistance",method:"additive",value:.18},{label:"PowerDraw",method:"multiplicative",value:.4},{label:"ThermicResistance",method:"additive",value:.42}]},{symbol:"Hpt_ATDumbfireMissile_Fixed_Medium",name:"AX Missile Rack",blueprint:"Weapon_HighCapacity",grade:5,acquisition:"techBroker",engineeringLocked:true,modifiers:[{label:"AmmoClipSize",method:"multiplicative",value:1},{label:"AmmoMaximum",method:"multiplicative",value:1},{label:"BurstInterval",method:"multiplicative",value:-.3},{label:"Damage",method:"multiplicative",value:-.03},{label:"DistributorDraw",method:"multiplicative",value:-.2},{label:"Jitter",method:"additive",value:.5},{label:"Mass",method:"multiplicative",value:.7},{label:"PowerDraw",method:"multiplicative",value:.2},{label:"ReloadTime",method:"multiplicative",value:-.45}]},{symbol:"Hpt_ATDumbfireMissile_Fixed_Large",name:"AX Missile Rack",blueprint:"Weapon_HighCapacity",grade:5,acquisition:"techBroker",engineeringLocked:true,modifiers:[{label:"AmmoClipSize",method:"multiplicative",value:1},{label:"AmmoMaximum",method:"multiplicative",value:1},{label:"BurstInterval",method:"multiplicative",value:-.3},{label:"Damage",method:"multiplicative",value:-.03},{label:"DistributorDraw",method:"multiplicative",value:-.2},{label:"Jitter",method:"additive",value:.5},{label:"Mass",method:"multiplicative",value:.7},{label:"PowerDraw",method:"multiplicative",value:.2},{label:"ReloadTime",method:"multiplicative",value:-.45}]},{symbol:"Hpt_ATMultiCannon_Gimbal_Medium",name:"Enhanced AX Multi-Cannon",blueprint:"Weapon_Overcharged",grade:5,acquisition:"techBroker",experimental:"special_auto_loader",engineeringLocked:true,modifiers:[{label:"Damage",method:"multiplicative",value:.1},{label:"PowerDraw",method:"multiplicative",value:.75},{label:"ThermalLoad",method:"multiplicative",value:3}]},{symbol:"Hpt_ATMultiCannon_Gimbal_Large",name:"Enhanced AX Multi-Cannon",blueprint:"Weapon_Overcharged",grade:5,acquisition:"techBroker",experimental:"special_auto_loader",engineeringLocked:true,modifiers:[{label:"Damage",method:"multiplicative",value:.1},{label:"PowerDraw",method:"multiplicative",value:.75},{label:"ThermalLoad",method:"multiplicative",value:3}]},{symbol:"Hpt_Guardian_GaussCannon_Fixed_Small",name:"Guardian Gauss Cannon",blueprint:"Weapon_RapidFire",grade:1,acquisition:"techBroker",engineeringLocked:true,modifiers:[{label:"AmmoClipSize",method:"multiplicative",value:3},{label:"AmmoMaximum",method:"multiplicative",value:4},{label:"BurstInterval",method:"multiplicative",value:-.38237},{label:"BurstRateOfFire",method:"overwrite",value:10},{label:"BurstSize",method:"overwrite",value:4},{label:"Damage",method:"multiplicative",value:-.75214},{label:"DistributorDraw",method:"multiplicative",value:-.75},{label:"FalloffRange",method:"multiplicative",value:-.2},{label:"ThermalLoad",method:"multiplicative",value:-.75}]},{symbol:"Hpt_Guardian_GaussCannon_Fixed_Medium",name:"Guardian Gauss Cannon",blueprint:"Weapon_RapidFire",grade:1,acquisition:"techBroker",engineeringLocked:true,modifiers:[{label:"AmmoClipSize",method:"multiplicative",value:3},{label:"AmmoMaximum",method:"multiplicative",value:4},{label:"BurstInterval",method:"multiplicative",value:-.38237},{label:"BurstRateOfFire",method:"overwrite",value:10},{label:"BurstSize",method:"overwrite",value:4},{label:"Damage",method:"multiplicative",value:-.75214},{label:"DistributorDraw",method:"multiplicative",value:-.75},{label:"FalloffRange",method:"multiplicative",value:-.2},{label:"ThermalLoad",method:"multiplicative",value:-.75}]},{symbol:"Hpt_Guardian_PlasmaLauncher_Fixed_Small",name:"Guardian Plasma Charger",blueprint:"Weapon_Overcharged",grade:1,acquisition:"techBroker",engineeringLocked:true,modifiers:[{label:"AmmoClipSize",method:"overwrite",value:20},{label:"ArmourPenetration",method:"multiplicative",value:.375},{label:"Damage",method:"multiplicative",value:.66},{label:"PowerDraw",method:"multiplicative",value:.3239},{label:"ShotSpeed",method:"multiplicative",value:4},{label:"ThermalLoad",method:"multiplicative",value:.5}]},{symbol:"Hpt_Guardian_PlasmaLauncher_Fixed_Medium",name:"Guardian Plasma Charger",blueprint:"Weapon_Overcharged",grade:1,acquisition:"techBroker",engineeringLocked:true,modifiers:[{label:"AmmoClipSize",method:"overwrite",value:20},{label:"ArmourPenetration",method:"multiplicative",value:.375},{label:"Damage",method:"multiplicative",value:.66},{label:"PowerDraw",method:"multiplicative",value:.3239},{label:"ShotSpeed",method:"multiplicative",value:4},{label:"ThermalLoad",method:"multiplicative",value:.5}]},{symbol:"Hpt_Guardian_ShardCannon_Fixed_Small",name:"Guardian Shard Cannon",blueprint:"Weapon_LongRange",grade:1,acquisition:"techBroker",engineeringLocked:true,modifiers:[{label:"ArmourPenetration",method:"multiplicative",value:1.02},{label:"DistributorDraw",method:"multiplicative",value:4.2769},{label:"FalloffRange",method:"overwrite",value:1500},{label:"Jitter",method:"additive",value:-3.5},{label:"Mass",method:"multiplicative",value:.5},{label:"MaximumRange",method:"overwrite",value:3e3},{label:"PowerDraw",method:"multiplicative",value:1.3},{label:"ShotSpeed",method:"overwrite",value:3568.6},{label:"ThermalLoad",method:"multiplicative",value:15.5}]},{symbol:"Hpt_Guardian_ShardCannon_Fixed_Medium",name:"Guardian Shard Cannon",blueprint:"Weapon_LongRange",grade:1,acquisition:"techBroker",engineeringLocked:true,modifiers:[{label:"ArmourPenetration",method:"multiplicative",value:1.02},{label:"DistributorDraw",method:"overwrite",value:3.43},{label:"FalloffRange",method:"overwrite",value:1500},{label:"Jitter",method:"additive",value:-3.5},{label:"Mass",method:"multiplicative",value:.5},{label:"MaximumRange",method:"overwrite",value:3e3},{label:"PowerDraw",method:"multiplicative",value:1.3},{label:"ShotSpeed",method:"overwrite",value:6299.209},{label:"ThermalLoad",method:"multiplicative",value:15.5}]},{symbol:"Hpt_MiningLaser_Fixed_Small",name:"Mining Laser",blueprint:"Weapon_LongRange",grade:5,acquisition:"techBroker",experimental:"special_incendiary_rounds",modifiers:[{label:"Damage",method:"multiplicative",value:-.05},{label:"DistributorDraw",method:"multiplicative",value:-.5},{label:"FalloffRange",method:"multiplicative",value:7.3333},{label:"Integrity",method:"multiplicative",value:-.5},{label:"MaximumRange",method:"multiplicative",value:4},{label:"PowerDraw",method:"multiplicative",value:-.5},{label:"ThermalLoad",method:"multiplicative",value:-.83}]},{symbol:"Hpt_BasicMissileRack_Fixed_Medium",name:"Seeker Missile Rack",blueprint:"Weapon_HighCapacity",grade:5,acquisition:"techBroker",experimental:"special_thermal_cascade",modifiers:[{label:"AmmoClipSize",method:"multiplicative",value:1},{label:"AmmoMaximum",method:"multiplicative",value:1},{label:"BurstInterval",method:"multiplicative",value:-.1},{label:"DistributorDraw",method:"multiplicative",value:-.4},{label:"Integrity",method:"multiplicative",value:-.6},{label:"Mass",method:"multiplicative",value:-.9},{label:"PowerDraw",method:"multiplicative",value:-.2}]},{symbol:"Hpt_HeatSinkLauncher_Turret_Tiny",name:"Heat Sink Launcher",blueprint:"Misc_HeatSinkCapacity",grade:1,acquisition:"techBroker",modifiers:[{label:"AmmoMaximum",method:"multiplicative",value:1},{label:"ReloadTime",method:"multiplicative",value:.75}]},{symbol:"Int_Hyperdrive_Size5_Class5",name:"Frame Shift Drive",blueprint:"FSD_LongRange",grade:5,acquisition:"techBroker",modifiers:[{label:"BootTime",method:"multiplicative",value:-.8},{label:"FSDHeatRate",method:"multiplicative",value:.2},{label:"FSDOptimalMass",method:"multiplicative",value:.7},{label:"Integrity",method:"multiplicative",value:-.3},{label:"Mass",method:"multiplicative",value:.3},{label:"PowerDraw",method:"multiplicative",value:.15}]},{symbol:"Int_Hyperdrive_Overcharge_Size2_Class5",name:"Frame Shift Drive (SCO)",blueprint:"FSD_LongRange",grade:5,acquisition:"techBroker",modifiers:[{label:"BootTime",method:"multiplicative",value:-.8},{label:"FSDHeatRate",method:"multiplicative",value:.2},{label:"FSDOptimalMass",method:"multiplicative",value:.7},{label:"Integrity",method:"multiplicative",value:-.3},{label:"Mass",method:"multiplicative",value:.3},{label:"PowerDraw",method:"multiplicative",value:.15}]},{symbol:"Int_Hyperdrive_Overcharge_Size3_Class5",name:"Frame Shift Drive (SCO)",blueprint:"FSD_LongRange",grade:5,acquisition:"techBroker",modifiers:[{label:"BootTime",method:"multiplicative",value:-.8},{label:"FSDHeatRate",method:"multiplicative",value:.2},{label:"FSDOptimalMass",method:"multiplicative",value:.7},{label:"Integrity",method:"multiplicative",value:-.3},{label:"Mass",method:"multiplicative",value:.3},{label:"PowerDraw",method:"multiplicative",value:.15}]},{symbol:"Int_Hyperdrive_Overcharge_Size4_Class5",name:"Frame Shift Drive (SCO)",blueprint:"FSD_LongRange",grade:5,acquisition:"techBroker",modifiers:[{label:"BootTime",method:"multiplicative",value:-.8},{label:"FSDHeatRate",method:"multiplicative",value:.2},{label:"FSDOptimalMass",method:"multiplicative",value:.7},{label:"Integrity",method:"multiplicative",value:-.3},{label:"Mass",method:"multiplicative",value:.3},{label:"PowerDraw",method:"multiplicative",value:.15}]},{symbol:"Int_Hyperdrive_Overcharge_Size5_Class5",name:"Frame Shift Drive (SCO)",blueprint:"FSD_LongRange",grade:5,acquisition:"techBroker",modifiers:[{label:"BootTime",method:"multiplicative",value:-.8},{label:"FSDHeatRate",method:"multiplicative",value:.2},{label:"FSDOptimalMass",method:"multiplicative",value:.7},{label:"Integrity",method:"multiplicative",value:-.3},{label:"Mass",method:"multiplicative",value:.3},{label:"PowerDraw",method:"multiplicative",value:.15}]},{symbol:"Int_Hyperdrive_Overcharge_Size6_Class5",name:"Frame Shift Drive (SCO)",blueprint:"FSD_LongRange",grade:5,acquisition:"techBroker",modifiers:[{label:"BootTime",method:"multiplicative",value:-.8},{label:"FSDHeatRate",method:"multiplicative",value:.2},{label:"FSDOptimalMass",method:"multiplicative",value:.7},{label:"Integrity",method:"multiplicative",value:-.3},{label:"Mass",method:"multiplicative",value:.3},{label:"PowerDraw",method:"multiplicative",value:.15}]},{symbol:"Int_Hyperdrive_Overcharge_Size7_Class5",name:"Frame Shift Drive (SCO)",blueprint:"FSD_LongRange",grade:5,acquisition:"techBroker",modifiers:[{label:"BootTime",method:"multiplicative",value:-.8},{label:"FSDHeatRate",method:"multiplicative",value:.2},{label:"FSDOptimalMass",method:"multiplicative",value:.7},{label:"Integrity",method:"multiplicative",value:-.3},{label:"Mass",method:"multiplicative",value:.3},{label:"PowerDraw",method:"multiplicative",value:.15}]},{symbol:"Int_DetailedSurfaceScanner_Tiny",name:"Detailed Surface Scanner",blueprint:"Sensor_Expanded",grade:5,acquisition:"techBroker",modifiers:[{label:"DSS_PatchRadius",method:"multiplicative",value:1}]},{symbol:"Hpt_FlakMortar_Turret_Medium",name:"Festive Green Remote Release Flak Launcher",blueprint:"Decorative_Green",grade:5,acquisition:"eventReward",modifiers:[{label:"Damage",method:"multiplicative",value:-.99}]},{symbol:"Hpt_FlakMortar_Turret_Medium",name:"Festive Red Remote Release Flak Launcher",blueprint:"Decorative_Red",grade:5,acquisition:"eventReward",modifiers:[{label:"Damage",method:"multiplicative",value:-.99}]},{symbol:"Hpt_FlakMortar_Turret_Medium",name:"Festive Yellow Remote Release Flak Launcher",blueprint:"Decorative_Yellow",grade:5,acquisition:"eventReward",modifiers:[{label:"Damage",method:"multiplicative",value:-.99}]}];var PRE_ENGINEERED_MODULES=deepFreeze(pre_engineered_default);function getPreEngineeredVariants(symbol){return filterByKey(PRE_ENGINEERED_MODULES,"symbol",symbol,"getPreEngineeredVariants: symbol")}function isPreEngineered(symbol){requireStringIfPresent(symbol,"isPreEngineered: symbol");return getPreEngineeredVariants(symbol).length>0}export{PRE_ENGINEERED_MODULES,getPreEngineeredVariants,isPreEngineered};//# sourceMappingURL=chunk-2VPVZELZ.js.map
|
package/dist/chunk-3BM5BHI3.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{weaponsCapacitorMetrics}from"./chunk-FMPRCYKY.js";import{shieldRecovery,cellBankSummary}from"./chunk-VZZUNSDF.js";import{shieldMetrics}from"./chunk-2FHHMYDC.js";import{getShipBySymbol,getShipByName,getShipSlots}from"./chunk-WNGQ3IAM.js";import{parseSlef,toSlef,stringifySlef,getLoadoutModifier}from"./chunk-OVUHQEH5.js";import{sourcePurchaseFromLoadout,getSourceModuleValue}from"./chunk-IYU4WLFM.js";import{powerBudget}from"./chunk-RLUS76LZ.js";import{isNonOutfittingSlot,isBuiltInHullModule,cloneLoadoutModule,identifyPreEngineeredVariant,cloneModuleStats,availableBlueprintsFor,availableExperimentalsFor,ownKeyIn,FITTED_ITEM,blueprintAvailableFor,blueprintRoutesFor,experimentalAvailableFor,primitiveEngineeringInputsFor,missingBaseLabels,journalModifiersFor,getPreEngineeredStats,getPreEngineeredJournalModifiers,getPreEngineeredModifiers,ordinaryEngineeringProof,unresolvedModifiers,orderBySlotLayout,matchingKeyIn,isCargoHatchSlot,isFinalGuardianWeaponEngineering,scaleDamageComponents}from"./chunk-6BO5JJNI.js";import{weaponMetrics,sumWeaponMetrics,combinedRateOfFire}from"./chunk-LJI7VXJD.js";import{builtInModuleBySymbol,getBulkheadsForShip}from"./chunk-PA5EITW5.js";import{getPreEngineeredVariants}from"./chunk-2VPVZELZ.js";import{singleJumpRange,frameShiftDriveMassFactor,fuelPerJump,totalRange}from"./chunk-GQ5GX5TB.js";import{calculateUnladenMass,calculateCargoCapacity,calculateFuelCapacity}from"./chunk-AFVYCQWL.js";import{fixedSlotReason,validateLoadout}from"./chunk-B4ZSTOM4.js";import{mobilityMetrics}from"./chunk-CX7B67OI.js";import{calculateModuleLimits}from"./chunk-KPETDYQX.js";import{ALL_MODULES}from"./chunk-QY3L5BKN.js";import{CORE_MODULES}from"./chunk-EVJ32UF3.js";import{distributorMetrics}from"./chunk-P2QOL63K.js";import{getExperimentalEffectCost}from"./chunk-SNADUQSJ.js";import{getExperimentalEffect}from"./chunk-JPBMRJFC.js";import{heatMetrics}from"./chunk-W6EPHHTS.js";import{ammunitionCapacity}from"./chunk-AA3K5XUE.js";import{armourMetrics}from"./chunk-FGXWVFN6.js";import{getBlueprintCost}from"./chunk-TEOJCBSG.js";import{baseStats,computeModifiers,labelsForDamageType,scaleForLabel,sumMaterials,fieldForLabel,labelsForField,capabilityValueForLabel,damageTypeForLabel}from"./chunk-DYPOL3CI.js";import{resolveBlueprintForModule}from"./chunk-2TW4ZBI3.js";import{getExperimentalsForModule}from"./chunk-QTZPA2FR.js";import{getBlueprintGrade}from"./chunk-Q3QCLNVG.js";import{getDefaultLoadout}from"./chunk-GRIK3EDH.js";import{loadoutSlotName}from"./chunk-KAA4VOOB.js";import{parseSlotName,enumerateSlots,SLOT_RESTRICTION_LABELS}from"./chunk-RAO35XDF.js";import{normalizeKey}from"./chunk-BKWLI44T.js";import{truncate,describeValue,requireString,requireStringIfPresent}from"./chunk-PKWVG2JY.js";import{deepFreeze}from"./chunk-DURKO7JU.js";var NO_ISSUES=Object.freeze([]);function completeResult(value){return Object.freeze({value:value,complete:true,issues:NO_ISSUES})}function incompleteResult(issues){return Object.freeze({value:null,complete:false,issues:Object.freeze(issues.map(issue=>Object.freeze({...issue,...issue.params?{params:Object.freeze({...issue.params})}:{}})))})}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 isPowerPlant(module,stats){const parsed=parseSlotName(module.Slot);if(parsed?.kind==="core"&&parsed.core==="powerPlant")return true;return stats?.slot?stats.slot==="powerPlant":startsWithAny(module.Item,PREFIX.powerPlant)}function isThruster(module,stats){const parsed=parseSlotName(module.Slot);if(parsed?.kind==="core"&&parsed.core==="thrusters")return true;return stats?.slot?stats.slot==="thrusters":startsWithAny(module.Item,PREFIX.thrusters)}function isFrameShiftDrive(module,stats){const parsed=parseSlotName(module.Slot);if(parsed?.kind==="core"&&parsed.core==="frameShiftDrive")return true;return stats?.slot?stats.slot==="frameShiftDrive":startsWithAny(module.Item,PREFIX.frameShiftDrive)}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;const seen=/* @__PURE__ */new Set;for(const modifier of module.Engineering?.Modifiers??[]){const type=damageTypeForLabel(modifier.Label);if(type===null||seen.has(type))continue;seen.add(type);if(modifier.Value===void 0)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);if(draw===void 0||draw===0)return null;const mounted=stats?.category==="hardpoint"||stats?.category==="utility";return{draw:draw,priority:priorityOf(module),enabled:isEnabled(module),deployedOnly:mounted&&stats?.alwaysPowered!==true,label:module.Slot,symbol:module.Item}}function powerAvailable(modules,statsFor){for(const module of modules){const stats=statsFor(module);if(!isPowerPlant(module,stats))continue;if(!isEnabled(module))return 0;return effectiveStat(module,"powerCapacity",stats)??0}return 0}function metricIssue(field,reason,module){const defaultSlot=field==="powerCapacity"?"PowerPlant":field==="thrusters"?"MainEngines":void 0;const slot=module?.Slot??defaultSlot;const symbol=module?.Item;const params={field:field,reason:reason,...slot===void 0?{}:{slot:slot},...symbol===void 0?{}:{symbol:symbol}};let message;if(reason==="missing"){message=field==="powerCapacity"?"PowerPlant: no power plant is fitted":field==="thrusters"?"MainEngines: no thrusters are fitted":"no shield generator is fitted"}else if(reason==="unresolved"){const unavailable=field==="thrusters"?"thruster stats":field==="shieldGenerator"?"shield-generator stats":field==="powerCapacity"?"power capacity":field;message=`${truncate(slot??field)}: ${unavailable} unavailable for ${truncate(symbol??field)}`}else if(reason==="disabled"){message=`${truncate(slot??field)}: ${truncate(symbol??field)} is switched off`}else if(reason==="invalid"){message=`${truncate(slot??field)}: ${truncate(symbol??field)} has invalid ${field}`}else{message=`${truncate(slot??field)}: ${truncate(symbol??field)} is not powered with hardpoints retracted`}return{field:field,reason:reason,...slot===void 0?{}:{slot:slot},...symbol===void 0?{}:{symbol:symbol},message:message,params:params}}function powerPlantIssueFor(modules,statsFor){for(const module of modules){const stats=statsFor(module);if(!isPowerPlant(module,stats))continue;if(!isEnabled(module))return metricIssue("powerCapacity","disabled",module);const capacity=effectiveStat(module,"powerCapacity",stats);if(capacity===void 0)return metricIssue("powerCapacity","unresolved",module);return!Number.isFinite(capacity)||capacity<=0?metricIssue("powerCapacity","invalid",module):null}return metricIssue("powerCapacity","missing")}function powerDrawIssueFor(modules,statsFor){for(const module of modules){const consumer=powerConsumerFor(module,statsFor(module));if(consumer&&(!Number.isFinite(consumer.draw)||consumer.draw<0)){return metricIssue("powerDraw","invalid",module)}}return null}function poweredMetricBudgetFor(field,module,stats,modules,getBudget,statsFor){if(!isEnabled(module))return incompleteResult([metricIssue(field,"disabled",module)]);const plantIssue=powerPlantIssueFor(modules,statsFor);if(plantIssue)return incompleteResult([plantIssue]);const drawIssue=powerDrawIssueFor(modules,statsFor);if(drawIssue)return incompleteResult([drawIssue]);const budget=getBudget();return budget.available>0&&poweredStates(module,stats,budget).retracted?completeResult(budget):incompleteResult([metricIssue(field,"shed",module)])}function poweredShieldGeneratorResultFor(modules,getBudget,statsFor){for(const module of modules){if(!startsWithAny(module.Item,PREFIX.shieldGenerator))continue;const stats=statsFor(module);const powered=poweredMetricBudgetFor("shieldGenerator",module,stats,modules,getBudget,statsFor);if(!powered.complete)return powered;return stats===null?incompleteResult([metricIssue("shieldGenerator","unresolved",module)]):completeResult({module:module,budget:powered.value})}return incompleteResult([metricIssue("shieldGenerator","missing")])}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(ship,modules,budget,systemsPips,statsFor){let generator=null;const boosters=[];let reinforcement=0;for(const module of modules){if(!isEnabled(module))continue;const stats=statsFor(module);if(!(budget.available>0&&poweredStates(module,stats,budget).retracted))continue;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:ship.hullMass,baseShieldStrength:ship.baseShieldStrength,generator:generator,boosters:boosters,reinforcement:reinforcement,systemsPips:systemsPips}}function shieldInputResultFor(ship,modules,getBudget,systemsPips,statsFor){const fitted=poweredShieldGeneratorResultFor(modules,getBudget,statsFor);if(!fitted.complete)return fitted;const input=shieldInputFor(ship,modules,fitted.value.budget,systemsPips,statsFor);return completeResult(input)}function thrusterCurveFor(module,stats){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}return{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}}}}function fittedThrusterParamsFor(modules,statsFor){for(const module of modules){const stats=statsFor(module);if(isThruster(module,stats))return thrusterCurveFor(module,stats)}return null}function mobilityInputResultFor(ship,modules,getBudget,mass,enginesPips,statsFor){let thrusters=null;for(const module of modules){const stats=statsFor(module);if(!isThruster(module,stats))continue;const powered=poweredMetricBudgetFor("thrusters",module,stats,modules,getBudget,statsFor);if(!powered.complete)return powered;thrusters=thrusterCurveFor(module,stats);if(!thrusters)return incompleteResult([metricIssue("thrusters","unresolved",module)]);break}if(!thrusters)return incompleteResult([metricIssue("thrusters","missing")]);return completeResult({minimumSpeed:ship.minimumSpeed,maximumSpeed:ship.maximumSpeed,boost:ship.boost,minPitch:ship.minPitch,pitch:ship.pitch,minRoll:ship.minRoll,roll:ship.roll,minYaw:ship.minYaw,yaw:ship.yaw,mass:typeof mass==="function"?mass():mass,thrusters:thrusters,enginesPips:enginesPips})}function shieldRecoveryInputResultFor(ship,modules,getBudget,systemsPips,statsFor){const generator=poweredShieldGeneratorResultFor(modules,getBudget,statsFor);if(!generator.complete)return generator;const{module:generatorModule,budget:budget}=generator.value;let distributor=null;for(const module of modules){const stats=statsFor(module);if(isPowerDistributor(module,stats)&&isEnabled(module)&&budget.available>0&&poweredStates(module,stats,budget).retracted)distributor=module}const generatorStats=statsFor(generatorModule);const distributorStats=distributor?statsFor(distributor):null;const strength=shieldMetrics(shieldInputFor(ship,modules,budget,0,statsFor)).strength;return completeResult({strength:strength,regenRate:effectiveStat(generatorModule,"shieldRegenRate",generatorStats)??0,brokenRegenRate:effectiveStat(generatorModule,"shieldBrokenRegenRate",generatorStats)??0,distributorDraw:effectiveStat(generatorModule,"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(ship,modules,budget,statsFor){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);if(isPowerPlant(module,stats)){if(!isEnabled(module))return null;heatEfficiency=effectiveStat(module,"heatEfficiency",stats);continue}if(!isEnabled(module))continue;const running=poweredStates(module,stats,budget);if(isThruster(module,stats)){const heat=effectiveStat(module,"engineHeatRate",stats)??0;if(running.retracted)thrusterHeatRate+=heat;if(running.deployed)deployedThrusterHeatRate+=heat}else if(isFrameShiftDrive(module,stats)){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(!running.deployed)continue;if(!weapon)continue;weapons.push({heatPerSecond:weaponMetrics(weapon).sustainedHeatPerSecond,distributorDraw:weapon.distributorDraw??0})}if(heatEfficiency===void 0)return null;return{heatCapacity:ship.heatCapacity,heatDissipation:ship.heatDissipation,heatEfficiency:heatEfficiency,retractedPowerDraw:poweredDraw(budget,"retracted"),deployedPowerDraw:poweredDraw(budget,"deployed"),thrusterHeatRate:thrusterHeatRate,deployedThrusterHeatRate:deployedThrusterHeatRate,fsdHeatRate:fsdHeatRate,weaponsCapacity:weaponsCapacity,weapons:weapons}}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,budget,statsFor){const banks=[];for(const module of modules){if(!startsWithAny(module.Item,PREFIX.shieldCellBank))continue;const stats=statsFor(module);const effective=effectiveModule(module,stats);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,powered:budget.available>0&&isEnabled(module)&&poweredStates(module,stats,budget).deployed})}return banks}function stockBulkhead(ship){const variants=getBulkheadsForShip(ship.name,CORE_MODULES);return variants.find(v=>v.symbol.toLowerCase().endsWith("_default"))??variants.find(v=>v.mass===0)??variants[0]??null}function armourInputFor(ship,modules,statsFor){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(ship);bulkhead=stock?{hullBoost:stock.hullBoost??0,...mapResistanceFields(field=>stock[field])}:null}return{baseArmour:ship.baseArmour,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 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&&!input.sourceTotalsVoided&&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{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},UnladenMass:input.unladenMass,CargoCapacity:input.cargoCapacity,...input.maxJumpRange===null?{}:{MaxJumpRange:input.maxJumpRange},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.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(modules,layout){return orderBySlotLayout([...modules.values()],layout,module=>module.Slot)}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)return false;if(isCargoHatchSlot(entry.slot)&&entry.value===0)continue;if(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 hullLayout(shipSymbol){const slots=getShipSlots(shipSymbol);return slots?enumerateSlots(slots):[]}function fixedMountRejects(shipSymbol,layout,slot,stats){const mount=layout.find(candidate=>candidate.key.toLowerCase()===slot.toLowerCase());return mount!==void 0&&moduleFitProblem(shipSymbol,mount,stats)!==null}function normalizeLoadoutEvent(rawEvent){const event=captureLoadoutEvent(rawEvent);requireString(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};let invalidatesAggregates=false;const outcomes=[];const defaults=getDefaultLoadout(event.Ship)?.modules??[];let layout;for(const[slot,module]of modules){if(isNonOutfittingSlot(slot)||isBuiltInHullModule(module))continue;const stats=builtInModuleBySymbol(module.Item,"ShipLoadout.fromLoadout: module.Item");const slotKind=parseSlotName(slot)?.kind;const fallback=slotKind==="core"||slotKind==="armour"||slotKind==="cargoHatch"?defaults.find(candidate=>candidate.slot.toLowerCase()===slot.toLowerCase()):void 0;const rejected=fallback!==void 0&&(stats===null||slotKind==="cargoHatch"||fixedMountRejects(event.Ship,layout??=hullLayout(event.Ship),slot,stats));if(stats!==null&&!rejected)continue;if(fallback){modules.set(slot,{Slot:slot,Item:fallback.symbol,...module.On===void 0?{}:{On:module.On},...module.Priority===void 0?{}:{Priority:module.Priority},...module.Health===void 0?{}:{Health:module.Health}});outcomes.push({action:"defaulted",slot:slot,sourceSymbol:module.Item,replacementSymbol:fallback.symbol})}else{modules.delete(slot);outcomes.push({action:"emptied",slot:slot,sourceSymbol:module.Item})}invalidatesAggregates=true}for(const fallback of defaults){const slotKind=parseSlotName(fallback.slot)?.kind;if(slotKind!=="core"&&slotKind!=="armour"&&slotKind!=="cargoHatch"||matchingKeyIn(modules,fallback.slot)!==null){continue}const slot=ownKeyIn(modules,fallback.slot);modules.set(slot,{Slot:slot,Item:fallback.symbol});outcomes.push({action:"defaulted",slot:slot,sourceSymbol:null,replacementSymbol:fallback.symbol});if(slotKind==="core")invalidatesAggregates=true}if(invalidatesAggregates){delete top.ModulesValue;delete top.Rebuy;delete top.UnladenMass;delete top.CargoCapacity;delete top.FuelCapacity}const moduleStats=/* @__PURE__ */new Map;const primitiveModifiers=/* @__PURE__ */new Map;for(const module of modules.values()){const engineering=module.Engineering;const variant=identifyPreEngineeredVariant(module);const catalogueVariantStats=variant?getPreEngineeredStats(variant):null;let variantStats=catalogueVariantStats;const retainsBakedExperimental=variant?.experimental!==void 0&&typeof engineering?.ExperimentalEffect==="string"&&variant.experimental.trim().toLowerCase()===engineering.ExperimentalEffect.trim().toLowerCase();if(variant&&catalogueVariantStats&&!catalogueVariantStats.engineeringLocked&&!retainsBakedExperimental){const{experimental:originalExperimental,...withoutExperimental}=variant;const currentExperimental=engineering?.ExperimentalEffect;const currentVariant=typeof currentExperimental==="string"?{...withoutExperimental,experimental:currentExperimental}:withoutExperimental;variantStats=getPreEngineeredStats(withoutExperimental);primitiveModifiers.set(module.Slot,[...engineering?.Modifiers??[],...getPreEngineeredModifiers(currentVariant)])}if(variantStats)moduleStats.set(module.Slot,cloneModuleStats(variantStats));const guardianFinal=typeof engineering?.BlueprintName==="string"&&isFinalGuardianWeaponEngineering(module.Item,engineering.BlueprintName);if(variantStats?.engineeringLocked||typeof engineering?.BlueprintName!=="string"||!guardianFinal){continue}const normalizedBlueprint=normalizeKey(engineering.BlueprintName,"ShipLoadout.fromLoadout: module.Engineering.BlueprintName");const normalizedExperimental=normalizeKey(engineering.ExperimentalEffect,"ShipLoadout.fromLoadout: module.Engineering.ExperimentalEffect");const variants=getPreEngineeredVariants(module.Item);const exact=variants.find(candidate=>candidate.engineeringLocked===true&&candidate.blueprint.toLowerCase()===normalizedBlueprint&&candidate.grade===engineering.Level&&candidate.experimental?.toLowerCase()===normalizedExperimental);const guardianBase=variants.find(candidate=>candidate.engineeringLocked===true&&candidate.blueprint.toLowerCase()===normalizedBlueprint&&candidate.grade===engineering.Level&&candidate.experimental===void 0);const stats=exact?getPreEngineeredStats(exact):guardianBase&&engineering.ExperimentalEffect!==void 0?getPreEngineeredStats({...guardianBase,experimental:engineering.ExperimentalEffect}):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,primitiveModifiers:primitiveModifiers,top:top,sourcePurchase:sourcePurchaseFromLoadout(event),outcomes:deepFreeze(outcomes)}}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 requireEnginesPips=(scope,enginesPips)=>{if(!Number.isFinite(enginesPips)||enginesPips<0||enginesPips>4){throw new RangeError(`${scope}: enginesPips must be a finite number from 0 to 4`)}return enginesPips};var requireSystemsPips=(scope,systemsPips)=>{if(!Number.isFinite(systemsPips)||systemsPips<0||systemsPips>4){throw new RangeError(`${scope}: systemsPips must be a finite number from 0 to 4`)}return systemsPips};var LoadoutEditError=class extends TypeError{code;constraint;params;constructor(message,code,params,constraint){super(message);this.code=code;this.params=deepFreeze(structuredClone(params));if(constraint!==void 0)this.constraint=constraint}};var experimentalEffectUnsupported=(code,params)=>deepFreeze({kind:"unsupported",code:code,params:params});var engineeringNormalizationUnsupported=(code,params)=>deepFreeze({kind:"unsupported",code:code,params:params});var AGGREGATE_STATS=["mass","cargoCapacity","fuelCapacity"];var ShipLoadout=class _ShipLoadout{#ship;#shipSymbol;#modules;#moduleStats;#primitiveModifiers;#top;#sourcePurchase;#importOutcomes;#slotCache=/* @__PURE__ */new Map;#layoutCache;constructor(ship,shipSymbol,modules,top,sourcePurchase=null,moduleStats=/* @__PURE__ */new Map,primitiveModifiers=/* @__PURE__ */new Map,importOutcomes=deepFreeze([])){this.#ship=ship;this.#shipSymbol=shipSymbol;this.#modules=modules;this.#top=top;this.#sourcePurchase=sourcePurchase;this.#moduleStats=moduleStats;this.#primitiveModifiers=primitiveModifiers;this.#importOutcomes=importOutcomes}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})`)}const imported=normalizeLoadoutEvent(entry.data);const ship=getShipBySymbol(imported.shipSymbol);if(!ship){throw new TypeError(`ShipLoadout.fromSlef: unknown hull "${truncate(imported.shipSymbol)}"`)}return _ShipLoadout.#fromImported(imported,ship)}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);const ship=getShipBySymbol(imported.shipSymbol);if(!ship){throw new TypeError(`ShipLoadout.fromLoadout: unknown hull "${truncate(imported.shipSymbol)}"`)}return _ShipLoadout.#fromImported(imported,ship)}static#fromImported(imported,ship){return new _ShipLoadout(ship,imported.shipSymbol,imported.modules,imported.top,imported.sourcePurchase,imported.moduleStats,imported.primitiveModifiers,imported.outcomes)}static empty(shipSymbol){const requested=requireString(shipSymbol,"ShipLoadout.empty: shipSymbol");const ship=getShipBySymbol(requested);if(!ship){throw new TypeError(`ShipLoadout.empty: no slot layout for hull "${truncate(shipSymbol)}"`)}const fitted=(getDefaultLoadout(ship.symbol)?.modules??[]).filter(module=>{const parsed=parseSlotName(module.slot);return parsed!==null&&fixedSlotReason(parsed)!==null});return new _ShipLoadout(ship,ship.symbol,new Map(fitted.map(module=>[module.slot,{Slot:module.slot,Item:module.symbol}])),{})}static default(shipSymbol){const requested=requireString(shipSymbol,"ShipLoadout.default: shipSymbol");const ship=getShipBySymbol(requested);if(!ship){throw new TypeError(`ShipLoadout.default: no default loadout for hull "${truncate(shipSymbol)}"`)}const loadout=getDefaultLoadout(ship.symbol);return new _ShipLoadout(ship,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.#top.UnladenMass??this.#computedUnladenMass()}#computedUnladenMass(){return calculateUnladenMass(this.#ship.hullMass,this.#calculationModules())}get fuelCapacity(){const cap=this.#top.FuelCapacity;if(cap?.Main!==void 0&&cap.Reserve!==void 0){return Object.freeze({main:cap.Main,reserve:cap.Reserve})}const computed=this.#computedFuelCapacity();return Object.freeze({main:cap?.Main??computed.main,reserve:cap?.Reserve??computed.reserve})}get cargoCapacity(){return this.#top.CargoCapacity??this.#computedCargoCapacity()}#computedCargoCapacity(){return calculateCargoCapacity(this.#calculationModules())}#computedFuelCapacity(){return calculateFuelCapacity(this.#ship.reserveFuelCapacity,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 importOutcomes(){return this.#importOutcomes}get validation(){const slots=this.#layout();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,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}}});return validateLoadout({shipSymbol:this.#shipSymbol,slots:slots,modules:modules})}slots(kind){const cached=this.#slotCache.get(kind);if(cached!==void 0)return cached;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 fixedReason=fixedSlotReason(slot);const immovableReason=fixedReason!==null?fixedReason: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}}}));this.#slotCache.set(kind,value);return value}fittedModuleAt(slotKey){const module=this.#fittedModuleFor(slotKey);if(!module)return null;const raw=cloneLoadoutModule(module);const stats=this.#statsFor(module);const effective=effectiveModule(this.#moduleForEffectiveStats(module),stats);return 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)})}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)}repairFixedMount(slotKey){const requested=requireString(slotKey,SLOT_KEY);const wanted=requested.toLowerCase();const slot=this.#requireSlot(requested);const fittedKey=this.#fittedKey(requested);const resultSlot=fittedKey??requested;const canonicalKey=slot.key;if(fixedSlotReason(slot)===null){return deepFreeze({status:"refused",slot:resultSlot,reason:"notFixedMount"})}const current=this.#fittedModuleFor(requested);const currentStats=current?this.#statsFor(current):null;const valid=current!==void 0&¤tStats!==null&&(slot.kind==="cargoHatch"?isBuiltInHullModule(current):moduleFitProblem(this.#shipSymbol,slot,currentStats)===null);if(valid){return deepFreeze({status:"unchanged",slot:current.Slot,symbol:current.Item})}const defaultModule=getDefaultLoadout(this.#shipSymbol)?.modules.find(module=>module.slot.toLowerCase()===wanted);if(!defaultModule){return deepFreeze({status:"defaultUnavailable",slot:resultSlot})}const ownKey=ownKeyIn(this.#modules,canonicalKey);const replacement={Slot:ownKey,Item:defaultModule.symbol,...current?.On===void 0?{}:{On:current.On},...current?.Priority===void 0?{}:{Priority:current.Priority},...current?.Health===void 0?{}:{Health:current.Health}};const replacementStats=builtInModuleBySymbol(defaultModule.symbol,"ShipLoadout.repairFixedMount")??(isBuiltInHullModule(replacement)?builtInModuleBySymbol("ModularCargoBayDoor","ShipLoadout.repairFixedMount"):null);if(!replacementStats){return deepFreeze({status:"defaultUnavailable",slot:resultSlot,symbol:defaultModule.symbol})}this.#replaceModule(ownKey,replacement,replacementStats);return deepFreeze({status:"repaired",slot:ownKey,symbol:defaultModule.symbol})}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)}`)}module=cloneModuleStats(module);const catalogued=builtInModuleBySymbol(module.symbol,FITTED_ITEM);if(catalogued===null){throw new TypeError(`ShipLoadout.setModule: no module is catalogued as "${truncate(module.symbol)}"`)}for(const field of AGGREGATE_STATS){const stated=module[field];if(stated===void 0){if(catalogued[field]===void 0)continue;throw new TypeError(`ShipLoadout.setModule: the supplied record for "${truncate(module.symbol)}" has no ${field}`)}if(typeof stated!=="number"||!Number.isFinite(stated)){throw new TypeError(`ShipLoadout.setModule: the supplied record for "${truncate(module.symbol)}" states a ${field} of ${describeValue(stated)}`)}}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},module);return this}removeModule(slotKey){const wanted=requireString(slotKey,SLOT_KEY).toLowerCase();if(wanted==="cargohatch"){throw new LoadoutEditError("ShipLoadout.removeModule: the cargoHatch slot cannot be changed","immutableSlot",{slot:"CargoHatch"})}const parsed=parseSlotName(slotKey);const slot=this.#layout().find(candidate=>candidate.key.toLowerCase()===wanted);if(parsed!==null&&fixedSlotReason(parsed)==="requiredSlot"){const fittedKey=this.#fittedKey(slotKey);const key2=slot?.key??fittedKey??slotKey;throw new LoadoutEditError(`ShipLoadout.removeModule: the ${truncate(key2)} slot is required and cannot be emptied`,"requiredSlot",{slot:key2})}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}setExperimentalEffect(slotKey,experimental){if(experimental!==null){requireString(experimental,"ShipLoadout.setExperimentalEffect: experimental")}const wanted=experimental;const module=this.#fittedModuleFor(slotKey);if(!module)return experimentalEffectUnsupported("emptySlot",{slot:slotKey});const stats=this.#statsFor(module);if(!stats){return experimentalEffectUnsupported("unsupportedEngineering",{slot:module.Slot,symbol:module.Item})}const engineering=module.Engineering;if(!engineering){return experimentalEffectUnsupported("notEngineered",{slot:module.Slot,symbol:module.Item})}if(stats.engineeringLocked){return experimentalEffectUnsupported("finalArticle",{slot:module.Slot,symbol:module.Item})}const previous=engineering.ExperimentalEffect??null;if(previous===null&&wanted===null||previous!==null&&wanted!==null&&previous.trim().toLowerCase()===wanted.trim().toLowerCase()){return deepFreeze({kind:"unchanged",experimental:previous})}const variant=identifyPreEngineeredVariant(module);let effect;if(wanted!==null){effect=getExperimentalEffect(wanted);if(!effect){return experimentalEffectUnsupported("unknownExperimentalEffect",{slot:module.Slot,symbol:module.Item,experimental:wanted})}const restoresBakedEffect=variant?.experimental!==void 0&&variant.experimental.trim().toLowerCase()===wanted.trim().toLowerCase();if(!experimentalAvailableFor(module.Item,wanted)&&!restoresBakedEffect){return experimentalEffectUnsupported("unsupportedExperimentalEffect",{slot:module.Slot,symbol:module.Item,experimental:wanted})}}if(variant&&variant.acquisition!=="mercenary"){const stock=this.#engineeringBaseStats(module);if(!stock){return experimentalEffectUnsupported("unsupportedEngineering",{slot:module.Slot,symbol:module.Item})}const missing=missingBaseLabels(stock,baseStats(stock),[],effect?.modifiers);if(missing.length>0){return experimentalEffectUnsupported("unresolvedModifiers",{slot:module.Slot,symbol:module.Item,labels:missing})}const{experimental:originalEffect,...withoutEffect}=variant;const adjusted=wanted===null?withoutEffect:{...withoutEffect,experimental:wanted};const resolved=getPreEngineeredStats(withoutEffect);if(!resolved){return experimentalEffectUnsupported("unsupportedEngineering",{slot:module.Slot,symbol:module.Item})}const replacement={BlueprintName:engineering.BlueprintName,Level:engineering.Level,Quality:engineering.Quality,...wanted===null?{}:{ExperimentalEffect:wanted},Modifiers:getPreEngineeredJournalModifiers(adjusted)};this.#replaceModule(module.Slot,{...module,Engineering:replacement},cloneModuleStats(resolved),getPreEngineeredModifiers(adjusted))}else{const blueprint=engineering.BlueprintName;const grade=engineering.Level;const quality=engineering.Quality;if(typeof blueprint!=="string"||!Number.isInteger(grade)||grade<1||grade>5){return experimentalEffectUnsupported("unsupportedEngineering",{slot:module.Slot,symbol:module.Item})}const currentEffect=previous===null?void 0:getExperimentalEffect(previous)??null;if(ordinaryEngineeringProof(module.Item,engineering,currentEffect)==="unproven"){return experimentalEffectUnsupported("unidentifiedPreEngineeredVariant",{slot:module.Slot,symbol:module.Item,blueprint:blueprint})}const recipe=resolveBlueprintForModule(module.Item,blueprint);const blueprintGrade=getBlueprintGrade(recipe,grade);if(!blueprintGrade||!blueprintAvailableFor(module.Item,blueprint)||!Number.isFinite(quality)||quality<0||quality>1){return experimentalEffectUnsupported("unsupportedEngineering",{slot:module.Slot,symbol:module.Item,blueprint:blueprint,grade:grade})}const base=this.#engineeringBaseStats(module)??stats;const canonical=primitiveEngineeringInputsFor(base,blueprintGrade,effect);const missing=missingBaseLabels(base,baseStats(base),canonical.grade.features,canonical.experimental?.modifiers);if(missing.length>0){return experimentalEffectUnsupported("unresolvedModifiers",{slot:module.Slot,symbol:module.Item,labels:missing})}this.applyBlueprint(module.Slot,blueprint,{grade:grade,quality:quality,...wanted===null?{}:{experimental:wanted}})}return deepFreeze({kind:"updated",previousExperimental:previous,experimental:wanted})}completeEngineeringGrade(slotKey){const module=this.#fittedModuleFor(slotKey);if(!module)return engineeringNormalizationUnsupported("emptySlot",{slot:slotKey});const stats=this.#statsFor(module);if(!stats){return engineeringNormalizationUnsupported("unsupportedEngineering",{slot:module.Slot,symbol:module.Item})}const engineering=module.Engineering;if(!engineering){return engineeringNormalizationUnsupported("notEngineered",{slot:module.Slot,symbol:module.Item})}if(stats.engineeringLocked){return engineeringNormalizationUnsupported("finalArticle",{slot:module.Slot,symbol:module.Item})}if(engineering.Quality===1&&engineering.Modifiers!==void 0){return deepFreeze({kind:"unchanged"})}const previousQuality=engineering.Quality;if(!Number.isFinite(previousQuality)||previousQuality<0||previousQuality>1){return engineeringNormalizationUnsupported("invalidQuality",{slot:module.Slot,symbol:module.Item})}const experimental=engineering.ExperimentalEffect??null;const effect=experimental===null?void 0:getExperimentalEffect(experimental)??void 0;if(experimental!==null&&!effect){return engineeringNormalizationUnsupported("unknownExperimentalEffect",{slot:module.Slot,symbol:module.Item,experimental:experimental})}const blueprint=engineering.BlueprintName;const grade=engineering.Level;if(typeof blueprint!=="string"||!Number.isInteger(grade)||grade<1||grade>5){return engineeringNormalizationUnsupported("unsupportedEngineering",{slot:module.Slot,symbol:module.Item})}const variant=identifyPreEngineeredVariant(module);const restoresBakedEffect=variant?.experimental!==void 0&&variant.experimental.trim().toLowerCase()===experimental?.trim().toLowerCase();if(experimental!==null&&!experimentalAvailableFor(module.Item,experimental)&&!restoresBakedEffect){return engineeringNormalizationUnsupported("unsupportedExperimentalEffect",{slot:module.Slot,symbol:module.Item,experimental:experimental})}if(variant&&variant.acquisition!=="mercenary"){const stock=this.#engineeringBaseStats(module);if(!stock){return engineeringNormalizationUnsupported("unsupportedEngineering",{slot:module.Slot,symbol:module.Item})}const missing=missingBaseLabels(stock,baseStats(stock),[],effect?.modifiers);if(missing.length>0){return engineeringNormalizationUnsupported("unresolvedModifiers",{slot:module.Slot,symbol:module.Item,labels:missing})}const{experimental:originalEffect,...withoutEffect}=variant;const adjusted=experimental===null?withoutEffect:{...withoutEffect,experimental:experimental};const resolved=getPreEngineeredStats(withoutEffect);if(!resolved){return engineeringNormalizationUnsupported("unsupportedEngineering",{slot:module.Slot,symbol:module.Item})}const replacement={BlueprintName:engineering.BlueprintName,Level:engineering.Level,Quality:1,...experimental===null?{}:{ExperimentalEffect:experimental},Modifiers:getPreEngineeredJournalModifiers(adjusted)};this.#replaceModule(module.Slot,{...module,Engineering:replacement},cloneModuleStats(resolved),getPreEngineeredModifiers(adjusted))}else{const proof=ordinaryEngineeringProof(module.Item,engineering,effect);if(proof==="unproven"||proof==="proven"&&!blueprintAvailableFor(module.Item,blueprint)){return engineeringNormalizationUnsupported("unidentifiedPreEngineeredVariant",{slot:module.Slot,symbol:module.Item,blueprint:blueprint})}const recipe=resolveBlueprintForModule(module.Item,blueprint);const blueprintGrade=getBlueprintGrade(recipe,grade);if(!blueprintGrade||!blueprintAvailableFor(module.Item,blueprint)){return engineeringNormalizationUnsupported("unsupportedEngineering",{slot:module.Slot,symbol:module.Item,blueprint:blueprint,grade:grade})}const base=this.#engineeringBaseStats(module)??stats;const canonical=primitiveEngineeringInputsFor(base,blueprintGrade,effect);const missing=missingBaseLabels(base,baseStats(base),canonical.grade.features,canonical.experimental?.modifiers);if(missing.length>0){return engineeringNormalizationUnsupported("unresolvedModifiers",{slot:module.Slot,symbol:module.Item,labels:missing})}this.applyBlueprint(module.Slot,blueprint,{grade:grade,quality:1,...experimental===null?{}:{experimental:experimental}})}return deepFreeze({kind:"normalized",previousQuality:previousQuality,quality:1})}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.#slotCache.clear()}toLoadoutEvent(options={}){const unladenMass=this.#computedUnladenMass();const cargoCapacity=this.#computedCargoCapacity();const fuel=this.#computedFuelCapacity();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,layout:this.#layout(),sourcePurchase:this.#sourcePurchase,retailHullValue:this.#ship.hullCost,unladenMass:unladenMass,cargoCapacity:cargoCapacity,fuelCapacity:fuel,maxJumpRange:maxJumpRange,sourceTotalsVoided:this.#importOutcomes.some(outcome=>outcome.sourceSymbol===null&&parseSlotName(outcome.slot)?.kind==="core"),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){let drive;try{drive=this.#resolveDrive()}catch{return null}if(drive===null)return null;const tank=this.#computedFuelCapacity();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}get thrusters(){return fittedThrusterParamsFor([...this.#modules.values()],module=>this.#statsFor(module))}#maxJumpFuel(fsd){return Math.min(this.fuelCapacity.main,fsd.maxFuel)}frameShiftDriveMassFactor(options={}){requireLoadOptions("ShipLoadout.frameShiftDriveMassFactor",options);const fuel=options.fuel??this.fuelCapacity.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.fuelCapacity.main;return singleJumpRange(this.#requireMass(options.cargo??0),fuel,fsd)}ladenJumpRange(){return this.jumpRange({cargo:this.cargoCapacity})}fuelPerJump(distance,options={}){requireLoadOptions("ShipLoadout.fuelPerJump",options);const fsd=this.frameShiftDrive;const fuel=options.fuel??this.fuelCapacity.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.fuelCapacity.main,this.frameShiftDrive)}standardLoadResult(load){if(load!=="maximum"&&load!=="unladen"&&load!=="laden"){throw new RangeError("ShipLoadout.standardLoadResult: load must be 'maximum', 'unladen', or 'laden'")}const fuel=this.fuelCapacity;const cargo=load==="laden"?this.cargoCapacity:0;const mass=load==="maximum"?this.unladenMass:0;const issues=[];let drive=null;let maximumFuel=null;if(load==="maximum"){const fitted=this.#frameShiftDrive()?.module;let driveError=null;try{drive=this.#resolveDrive();maximumFuel=drive?.maxFuel??null}catch(error){if(!(error instanceof Error))throw error;driveError=error}if(maximumFuel===null){issues.push({field:"frameShiftDrive",reason:fitted?"unresolved":"missing",slot:fitted?.Slot??"FrameShiftDrive",...fitted?{symbol:fitted.Item}:{},message:driveError?.message??"FrameShiftDrive: no frame shift drive is fitted",params:fitted?{field:"frameShiftDrive",reason:"unresolved",slot:fitted.Slot,symbol:fitted.Item}:{field:"frameShiftDrive",reason:"missing",slot:"FrameShiftDrive"}})}}if(issues.length>0){return incompleteResult(issues)}const carriedFuel=load==="maximum"?Math.min(fuel.main,maximumFuel):fuel.main;const value=Object.freeze({fuel:carriedFuel,cargo:cargo,mass:this.unladenMass+carriedFuel+cargo});if(load==="maximum"){try{this.jumpRange(value)}catch(error){if(!(error instanceof RangeError))throw error;const fitted=this.#frameShiftDrive()?.module;const field=drive!==null&&(!Number.isFinite(drive.maxFuel)||drive.maxFuel<0)?"frameShiftDrive":!Number.isFinite(value.fuel)||value.fuel<0?"fuelCapacity":!Number.isFinite(mass)||mass<0?"mass":"frameShiftDrive";const driveParams=field==="frameShiftDrive"&&fitted?{slot:fitted.Slot,symbol:fitted.Item}:{};return incompleteResult([{field:field,reason:"invalid",...driveParams,message:error.message,params:{field:field,reason:"invalid",...driveParams}}])}}return completeResult(value)}jumpRangeSummary(){const maximum=this.#require(this.standardLoadResult("maximum"),"maximum load");const unladen=this.#require(this.standardLoadResult("unladen"),"unladen load");const laden=this.#require(this.standardLoadResult("laden"),"laden load");return{max:this.jumpRange(maximum),unladen:this.jumpRange(unladen),laden:this.jumpRange(laden),totalMax:this.totalRange(maximum),totalUnladen:this.totalRange(unladen),totalLaden:this.totalRange(laden)}}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.#ship,this.#modulesForEffectiveStats(),this.powerBudget(),module=>this.#statsFor(module));return input?heatMetrics(input):null}mobilityMetrics(options={}){requireEnginesPips("ShipLoadout.mobilityMetrics",options.enginesPips??4);requireLoadOptions("ShipLoadout.mobilityMetrics",options);return this.mobilityMetricsResult(options).value}mobilityMetricsResult(options={}){const enginesPips=requireEnginesPips("ShipLoadout.mobilityMetricsResult",options.enginesPips??4);requireLoadOptions("ShipLoadout.mobilityMetricsResult",options);const input=mobilityInputResultFor(this.#ship,[...this.#modules.values()],()=>this.powerBudget(),()=>{const main=options.fuel??this.#top.FuelCapacity?.Main??this.fuelCapacity.main;return this.#requireMass(options.cargo??0)+main},enginesPips,module=>this.#statsFor(module));if(!input.complete)return input;return completeResult(mobilityMetrics(input.value))}shieldMetrics(options={}){requireSystemsPips("ShipLoadout.shieldMetrics",options.systemsPips??0);return this.shieldMetricsResult(options).value}shieldMetricsResult(options={}){const systemsPips=requireSystemsPips("ShipLoadout.shieldMetricsResult",options.systemsPips??0);const input=shieldInputResultFor(this.#ship,[...this.#modules.values()],()=>this.powerBudget(),systemsPips,module=>this.#statsFor(module));if(!input.complete)return input;return completeResult(shieldMetrics(input.value))}shieldRecovery(options={}){requireSystemsPips("ShipLoadout.shieldRecovery",options.systemsPips??4);return this.shieldRecoveryResult(options).value}shieldRecoveryResult(options={}){const systemsPips=requireSystemsPips("ShipLoadout.shieldRecoveryResult",options.systemsPips??4);const input=shieldRecoveryInputResultFor(this.#ship,[...this.#modules.values()],()=>this.powerBudget(),systemsPips,module=>this.#statsFor(module));if(!input.complete)return input;return completeResult(shieldRecovery(input.value))}cellBanks(){const modules=[...this.#modules.values()];const banks=orderBySlotLayout(cellBankInputsFor(modules,this.powerBudget(),module=>this.#statsFor(module)),this.#layout(),bank=>bank.slot);return cellBankSummary(banks)}buildCost(){const hull=this.#ship.hullCost;let modules=0;let mercCoins=0;const unpriced=[];const materials=[];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})}const variant=identifyPreEngineeredVariant(module);mercCoins+=variant?.mercCoinCost??0;const engineering=module.Engineering;if(!engineering)continue;const grade=engineering.Level;const bought=variant?.grade??0;if(Number.isInteger(grade)&&grade>bought&&grade<=5){const climb=getBlueprintCost(engineering.BlueprintName,grade,bought);if(climb){materials.push(climb.materials);mercCoins+=climb.mercCoins}}const experimental=engineering.ExperimentalEffect;if(experimental!==void 0&&experimental.toLowerCase()!==variant?.experimental?.toLowerCase()){const cost=getExperimentalEffectCost(experimental);if(cost)materials.push(cost)}}return deepFreeze({credits:{total:hull+modules,hull:hull,modules:modules,rebuy:Math.trunc((hull+modules)*.05),unpriced:unpriced},mercCoins:mercCoins,materials:sumMaterials(...materials)})}buildMass(options={}){requireLoadOptions("ShipLoadout.buildMass",options);const hull=this.#ship.hullMass;const modules=calculateUnladenMass(0,this.#calculationModules());const unladen=this.unladenMass;const fuel=options.fuel??this.fuelCapacity.main;const cargo=options.cargo??0;return Object.freeze({hull:hull,modules:modules,unladen:unladen,fuel:fuel,cargo:cargo,total:unladen+fuel+cargo})}armourMetrics(){return armourMetrics(armourInputFor(this.#ship,[...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),...stats.maximumRange===void 0?{}:{maximumRange:stats.maximumRange},...stats.falloffRange===void 0?{}:{falloffRange:stats.falloffRange},...stats.projectileRange===void 0?{}:{projectileRange:{...stats.projectileRange}},...stats.armourPiercing===void 0?{}:{armourPiercing:stats.armourPiercing}})}const orderedWeapons=orderBySlotLayout(weapons,this.#layout(),weapon=>weapon.slot);return{weapons:orderedWeapons,total:sumWeaponMetrics(orderedWeapons.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}#layout(){if(this.#layoutCache===void 0){this.#layoutCache=Object.freeze(enumerateSlots(this.#ship))}return this.#layoutCache}#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.unladenMass+cargo}#calculationModules(){return[...this.#modules.values()].map(module=>({mass:this.#moduleMass(module),cargoCapacity:this.#moduleCapacity(module,"CargoCapacity","cargoCapacity"),fuelCapacity:this.#moduleCapacity(module,"FuelCapacity","fuelCapacity")}))}#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.#slotCache.clear()}#adjustImportedFigures(previous,next,nextStats){if(this.#top.UnladenMass!==void 0){this.#top.UnladenMass+=this.#moduleMass(next,nextStats)-this.#moduleMass(previous)}if(this.#top.CargoCapacity!==void 0){this.#top.CargoCapacity+=this.#moduleCapacity(next,"CargoCapacity","cargoCapacity",nextStats)-this.#moduleCapacity(previous,"CargoCapacity","cargoCapacity")}if(this.#top.FuelCapacity?.Main!==void 0){const reserve=this.#top.FuelCapacity.Reserve;this.#top.FuelCapacity={Main:this.#top.FuelCapacity.Main+this.#moduleCapacity(next,"FuelCapacity","fuelCapacity",nextStats)-this.#moduleCapacity(previous,"FuelCapacity","fuelCapacity"),...reserve===void 0?{}:{Reserve:reserve}}}if(normalizeKey(previous?.Item,FITTED_ITEM)===normalizeKey(next?.Item,FITTED_ITEM)){return}if(previous!==null&&isCargoHatchSlot(previous.Slot)||next!==null&&isCargoHatchSlot(next.Slot)){return}delete this.#top.ModulesValue;delete this.#top.Rebuy}#moduleMass(module,statsOverride){if(module===null)return 0;if(isCargoHatchSlot(module.Slot))return 0;const modified=getLoadoutModifier(module,"Mass");if(modified!==null)return modified;return(statsOverride??this.#statsFor(module))?.mass??0}#moduleCapacity(module,modifierLabel,field,statsOverride){if(module===null)return 0;if(isCargoHatchSlot(module.Slot))return 0;const modified=getLoadoutModifier(module,modifierLabel);if(modified!==null)return modified;return(statsOverride??this.#statsFor(module))?.[field]??0}#frameShiftDrive(){for(const m of this.#modules.values()){const stats=this.#statsFor(m);if(stats?.slot==="frameShiftDrive")return{module:m,stats:stats}}return void 0}#resolveDrive(){const fsd=this.#frameShiftDrive();if(!fsd)return null;const{module:fsdModule,stats:base}=fsd;if(base.fuelMul===void 0||base.fuelPower===void 0){throw new TypeError(`ShipLoadout: the fitted record for frame shift drive "${truncate(fsdModule.Item)}" has no jump constants`)}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: the fitted record for frame shift drive "${truncate(fsdModule.Item)}" has no ${missing.join(" or ")}`)}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"&&(stats?.jumpBoost===void 0||stats.jumpBoost===0)){continue}if(m.On===false)continue;if(stats?.jumpBoost===void 0){throw new TypeError(`ShipLoadout: the fitted record for FSD booster "${truncate(m.Item)}" has no jumpBoost`)}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-3BM5BHI3.js.map
|