@eveshipfit/ui-ingame 1.1.0 → 1.3.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/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@ import './style.css';
2
2
  import { c } from "react/compiler-runtime";
3
3
  import { useEffect, useId, useRef, useState } from "react";
4
4
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
- import { formatClock, formatDuration, formatNumber, useAttribute, useAttributeTooltip, useBayUsage, useCanFit, useChargeTree, useChargedModules, useCharges, useDrag, useFit, useFitHistory, useFitStore, useHardpoints, useHullTree, useImages, useLocalFits, useMissingSkills, useModuleTree, usePlacement, usePreview, useRackUsage, useSde, useSlots, useType, useViolations } from "@eveshipfit/react-hooks";
5
+ import { formatClock, formatDuration, formatNumber, useAttribute, useAttributeTooltip, useBayContents, useBayUsage, useCanFit, useChargeSearch, useChargeTree, useChargedModules, useCharges, useDrag, useDroneRoom, useFit, useFitHistory, useFitStore, useHardpoints, useHullTree, useImages, useLocalFits, useMissingSkills, useModuleSearch, useModuleTree, usePlacement, usePreview, useRackUsage, useSde, useShownSnapshot, useSlots, useSnapshot, useStats, useType } from "@eveshipfit/react-hooks";
6
6
  //#region src/primitives/Dialog/Dialog.module.css
7
7
  var Dialog_module_default = {
8
8
  "close": "kwi1cG_close",
@@ -457,6 +457,7 @@ const textures = {
457
457
  "slot-low": "classes/fitting/filtericonlowslot",
458
458
  "slot-rig": "classes/fitting/filtericonrigslot",
459
459
  "slot-subsystem": "windowicons/subsystems",
460
+ "slot-service": "classes/fitting/stationserviceslot",
460
461
  "module-unfit": "icons/38_16_200",
461
462
  "module-power": "icons/38_16_207",
462
463
  "module-info": "icons/38_16_208",
@@ -465,6 +466,7 @@ const textures = {
465
466
  collapse: "eveicon/system_icons/collapse_16px",
466
467
  checkmark: "eveicon/system_icons/checkmark_16px",
467
468
  close: "eveicon/system_icons/close_16px",
469
+ folder: "eveicon/system_icons/folder_16px",
468
470
  "fits-browser": "windowicons/browser",
469
471
  "fits-personal": "windowicons/member",
470
472
  "fits-corporation": "windowicons/corporation",
@@ -486,6 +488,7 @@ const textures = {
486
488
  statistics: "eveicon/system_icons/list_view_16px",
487
489
  cargo: "windowicons/ships",
488
490
  "drone-bay": "windowicons/dronebay",
491
+ "ammo-hold": "windowicons/itemhangar",
489
492
  "arrow-left": "shared/triangleleft",
490
493
  "arrow-right": "shared/triangleright",
491
494
  "arrow-down": "shared/triangledown",
@@ -516,7 +519,8 @@ const textures = {
516
519
  "stat-warp-speed": "classes/fitting/statsicons/warpspeed",
517
520
  "stat-align-time": "classes/fitting/statsicons/aligntime",
518
521
  "stat-drone-bandwidth": "classes/fitting/statsicons/bandwidth",
519
- "stat-drone-control-range": "classes/fitting/statsicons/controlrange"
522
+ "stat-drone-control-range": "classes/fitting/statsicons/controlrange",
523
+ "stat-fuel": "classes/fitting/statsicons/fuel"
520
524
  };
521
525
  const iconNames = Object.keys(textures);
522
526
  function Icon(t0) {
@@ -615,7 +619,10 @@ function Tooltip(t0) {
615
619
  if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
616
620
  t8 = () => show(true);
617
621
  t9 = () => show(false);
618
- t10 = (event) => show(event.target.matches(":focus-visible"));
622
+ t10 = (event) => {
623
+ const target = event.target;
624
+ setTimeout(() => show(target.matches(":focus-visible")));
625
+ };
619
626
  t11 = () => show(false);
620
627
  t12 = (event_0) => {
621
628
  if (event_0.key === "Escape") show(false);
@@ -790,51 +797,53 @@ var HistoryBar_module_default = {
790
797
  //#region src/primitives/HistoryBar/HistoryBar.tsx
791
798
  /** EVE's Simulation History. */
792
799
  function HistoryBar(t0) {
793
- const $ = c(28);
794
- const { label, length, position, onGoTo } = t0;
795
- let t1;
796
- if ($[0] !== label) {
797
- t1 = /* @__PURE__ */ jsx("span", {
800
+ const $ = c(33);
801
+ const { label, length, position, onGoTo, tooltipTitle: t1 } = t0;
802
+ const tooltipTitle = t1 === void 0 ? false : t1;
803
+ let t2;
804
+ if ($[0] !== label || $[1] !== tooltipTitle) {
805
+ t2 = !tooltipTitle && /* @__PURE__ */ jsx("span", {
798
806
  className: HistoryBar_module_default.title,
799
807
  "aria-hidden": true,
800
808
  children: label
801
809
  });
802
810
  $[0] = label;
803
- $[1] = t1;
804
- } else t1 = $[1];
805
- const t2 = position <= 0;
806
- let t3;
807
- if ($[2] !== onGoTo || $[3] !== position) {
808
- t3 = () => onGoTo(position - 1);
809
- $[2] = onGoTo;
810
- $[3] = position;
811
- $[4] = t3;
812
- } else t3 = $[4];
811
+ $[1] = tooltipTitle;
812
+ $[2] = t2;
813
+ } else t2 = $[2];
814
+ const t3 = position <= 0;
813
815
  let t4;
814
- if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
815
- t4 = /* @__PURE__ */ jsx(Icon, {
816
- name: "arrow-left",
817
- size: 10
818
- });
816
+ if ($[3] !== onGoTo || $[4] !== position) {
817
+ t4 = () => onGoTo(position - 1);
818
+ $[3] = onGoTo;
819
+ $[4] = position;
819
820
  $[5] = t4;
820
821
  } else t4 = $[5];
821
822
  let t5;
822
- if ($[6] !== t2 || $[7] !== t3) {
823
- t5 = /* @__PURE__ */ jsx("button", {
823
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
824
+ t5 = /* @__PURE__ */ jsx(Icon, {
825
+ name: "arrow-left",
826
+ size: 10
827
+ });
828
+ $[6] = t5;
829
+ } else t5 = $[6];
830
+ let t6;
831
+ if ($[7] !== t3 || $[8] !== t4) {
832
+ t6 = /* @__PURE__ */ jsx("button", {
824
833
  type: "button",
825
834
  className: HistoryBar_module_default.arrow,
826
835
  "aria-label": "Back",
827
- disabled: t2,
828
- onClick: t3,
829
- children: t4
836
+ disabled: t3,
837
+ onClick: t4,
838
+ children: t5
830
839
  });
831
- $[6] = t2;
832
840
  $[7] = t3;
833
- $[8] = t5;
834
- } else t5 = $[8];
835
- let t6;
836
- if ($[9] !== length || $[10] !== onGoTo || $[11] !== position) {
837
- t6 = /* @__PURE__ */ jsx("div", {
841
+ $[8] = t4;
842
+ $[9] = t6;
843
+ } else t6 = $[9];
844
+ let t7;
845
+ if ($[10] !== length || $[11] !== onGoTo || $[12] !== position) {
846
+ t7 = /* @__PURE__ */ jsx("div", {
838
847
  className: HistoryBar_module_default.entries,
839
848
  children: Array.from({ length }, (_, index) => /* @__PURE__ */ jsx("button", {
840
849
  type: "button",
@@ -844,69 +853,81 @@ function HistoryBar(t0) {
844
853
  onClick: () => onGoTo(index)
845
854
  }, index))
846
855
  });
847
- $[9] = length;
848
- $[10] = onGoTo;
849
- $[11] = position;
850
- $[12] = t6;
851
- } else t6 = $[12];
852
- const t7 = position >= length - 1;
853
- let t8;
854
- if ($[13] !== onGoTo || $[14] !== position) {
855
- t8 = () => onGoTo(position + 1);
856
- $[13] = onGoTo;
857
- $[14] = position;
858
- $[15] = t8;
859
- } else t8 = $[15];
856
+ $[10] = length;
857
+ $[11] = onGoTo;
858
+ $[12] = position;
859
+ $[13] = t7;
860
+ } else t7 = $[13];
861
+ const t8 = position >= length - 1;
860
862
  let t9;
861
- if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
862
- t9 = /* @__PURE__ */ jsx(Icon, {
863
- name: "arrow-right",
864
- size: 10
865
- });
863
+ if ($[14] !== onGoTo || $[15] !== position) {
864
+ t9 = () => onGoTo(position + 1);
865
+ $[14] = onGoTo;
866
+ $[15] = position;
866
867
  $[16] = t9;
867
868
  } else t9 = $[16];
868
869
  let t10;
869
- if ($[17] !== t7 || $[18] !== t8) {
870
- t10 = /* @__PURE__ */ jsx("button", {
870
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
871
+ t10 = /* @__PURE__ */ jsx(Icon, {
872
+ name: "arrow-right",
873
+ size: 10
874
+ });
875
+ $[17] = t10;
876
+ } else t10 = $[17];
877
+ let t11;
878
+ if ($[18] !== t8 || $[19] !== t9) {
879
+ t11 = /* @__PURE__ */ jsx("button", {
871
880
  type: "button",
872
881
  className: HistoryBar_module_default.arrow,
873
882
  "aria-label": "Forward",
874
- disabled: t7,
875
- onClick: t8,
876
- children: t9
883
+ disabled: t8,
884
+ onClick: t9,
885
+ children: t10
877
886
  });
878
- $[17] = t7;
879
887
  $[18] = t8;
880
- $[19] = t10;
881
- } else t10 = $[19];
882
- let t11;
883
- if ($[20] !== t10 || $[21] !== t5 || $[22] !== t6) {
884
- t11 = /* @__PURE__ */ jsxs("div", {
888
+ $[19] = t9;
889
+ $[20] = t11;
890
+ } else t11 = $[20];
891
+ let t12;
892
+ if ($[21] !== t11 || $[22] !== t6 || $[23] !== t7) {
893
+ t12 = /* @__PURE__ */ jsxs("div", {
885
894
  className: HistoryBar_module_default.row,
886
895
  children: [
887
- t5,
888
896
  t6,
889
- t10
897
+ t7,
898
+ t11
890
899
  ]
891
900
  });
892
- $[20] = t10;
893
- $[21] = t5;
901
+ $[21] = t11;
894
902
  $[22] = t6;
895
- $[23] = t11;
896
- } else t11 = $[23];
897
- let t12;
898
- if ($[24] !== label || $[25] !== t1 || $[26] !== t11) {
899
- t12 = /* @__PURE__ */ jsxs("fieldset", {
903
+ $[23] = t7;
904
+ $[24] = t12;
905
+ } else t12 = $[24];
906
+ let t13;
907
+ if ($[25] !== label || $[26] !== t12 || $[27] !== t2) {
908
+ t13 = /* @__PURE__ */ jsxs("fieldset", {
900
909
  className: HistoryBar_module_default.history,
901
910
  "aria-label": label,
902
- children: [t1, t11]
911
+ children: [t2, t12]
903
912
  });
904
- $[24] = label;
905
- $[25] = t1;
906
- $[26] = t11;
907
- $[27] = t12;
908
- } else t12 = $[27];
909
- return t12;
913
+ $[25] = label;
914
+ $[26] = t12;
915
+ $[27] = t2;
916
+ $[28] = t13;
917
+ } else t13 = $[28];
918
+ const bar = t13;
919
+ let t14;
920
+ if ($[29] !== bar || $[30] !== label || $[31] !== tooltipTitle) {
921
+ t14 = tooltipTitle ? /* @__PURE__ */ jsx(Tooltip, {
922
+ label,
923
+ children: bar
924
+ }) : bar;
925
+ $[29] = bar;
926
+ $[30] = label;
927
+ $[31] = tooltipTitle;
928
+ $[32] = t14;
929
+ } else t14 = $[32];
930
+ return t14;
910
931
  }
911
932
  //#endregion
912
933
  //#region src/primitives/Wheel/layout.ts
@@ -1088,6 +1109,94 @@ function WheelRackMarker(t0) {
1088
1109
  return t3;
1089
1110
  }
1090
1111
  //#endregion
1112
+ //#region src/primitives/SlotAction/SlotAction.module.css
1113
+ var SlotAction_module_default = { "button": "ld11eq_button" };
1114
+ //#endregion
1115
+ //#region src/primitives/SlotAction/SlotAction.tsx
1116
+ /** One of the buttons EVE shows over a hovered slot. */
1117
+ function SlotAction(t0) {
1118
+ const $ = c(9);
1119
+ const { icon, label, onPress } = t0;
1120
+ let t1;
1121
+ if ($[0] !== icon) {
1122
+ t1 = /* @__PURE__ */ jsx(Icon, { name: icon });
1123
+ $[0] = icon;
1124
+ $[1] = t1;
1125
+ } else t1 = $[1];
1126
+ let t2;
1127
+ if ($[2] !== label || $[3] !== onPress || $[4] !== t1) {
1128
+ t2 = /* @__PURE__ */ jsx("button", {
1129
+ type: "button",
1130
+ className: SlotAction_module_default.button,
1131
+ "aria-label": label,
1132
+ onClick: onPress,
1133
+ children: t1
1134
+ });
1135
+ $[2] = label;
1136
+ $[3] = onPress;
1137
+ $[4] = t1;
1138
+ $[5] = t2;
1139
+ } else t2 = $[5];
1140
+ let t3;
1141
+ if ($[6] !== label || $[7] !== t2) {
1142
+ t3 = /* @__PURE__ */ jsx(Tooltip, {
1143
+ label,
1144
+ children: t2
1145
+ });
1146
+ $[6] = label;
1147
+ $[7] = t2;
1148
+ $[8] = t3;
1149
+ } else t3 = $[8];
1150
+ return t3;
1151
+ }
1152
+ function SlotInfo() {
1153
+ const $ = c(1);
1154
+ let t0;
1155
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1156
+ t0 = /* @__PURE__ */ jsx(Tooltip, {
1157
+ label: "Show Info (not implemented yet)",
1158
+ children: /* @__PURE__ */ jsx("button", {
1159
+ type: "button",
1160
+ className: SlotAction_module_default.button,
1161
+ "aria-label": "Show Info",
1162
+ "aria-disabled": true,
1163
+ children: /* @__PURE__ */ jsx(Icon, { name: "module-info" })
1164
+ })
1165
+ });
1166
+ $[0] = t0;
1167
+ } else t0 = $[0];
1168
+ return t0;
1169
+ }
1170
+ /** Makes the whole slot a button, named `label`. */
1171
+ function SlotPress(t0) {
1172
+ const $ = c(4);
1173
+ const { className, label, onPress } = t0;
1174
+ let t1;
1175
+ if ($[0] !== className || $[1] !== label || $[2] !== onPress) {
1176
+ t1 = /* @__PURE__ */ jsx("div", {
1177
+ role: "button",
1178
+ tabIndex: 0,
1179
+ className,
1180
+ "aria-label": label,
1181
+ onClick: onPress,
1182
+ onKeyDown: _temp$8
1183
+ });
1184
+ $[0] = className;
1185
+ $[1] = label;
1186
+ $[2] = onPress;
1187
+ $[3] = t1;
1188
+ } else t1 = $[3];
1189
+ return t1;
1190
+ }
1191
+ function _temp$8(event) {
1192
+ if (event.key !== "Enter" && event.key !== " ") return;
1193
+ event.preventDefault();
1194
+ event.currentTarget.dispatchEvent(new MouseEvent("click", {
1195
+ bubbles: true,
1196
+ shiftKey: event.shiftKey
1197
+ }));
1198
+ }
1199
+ //#endregion
1091
1200
  //#region src/primitives/Wheel/WheelSlot.module.css
1092
1201
  var WheelSlot_module_default = {
1093
1202
  "action": "T6VD6G_action",
@@ -1095,7 +1204,6 @@ var WheelSlot_module_default = {
1095
1204
  "ammo": "T6VD6G_ammo",
1096
1205
  "body": "T6VD6G_body",
1097
1206
  "bridge": "T6VD6G_bridge",
1098
- "button": "T6VD6G_button",
1099
1207
  "empty": "T6VD6G_empty",
1100
1208
  "fill": "T6VD6G_fill",
1101
1209
  "frame": "T6VD6G_frame",
@@ -1215,7 +1323,7 @@ function WheelSlot(t0) {
1215
1323
  if (chargeTypeId !== void 0) {
1216
1324
  row.push(onRemoveCharge && {
1217
1325
  key: "charge",
1218
- node: /* @__PURE__ */ jsx(Action, {
1326
+ node: /* @__PURE__ */ jsx(SlotAction, {
1219
1327
  icon: "module-unfit",
1220
1328
  label: "Remove Charge",
1221
1329
  onPress: onRemoveCharge
@@ -1223,7 +1331,7 @@ function WheelSlot(t0) {
1223
1331
  });
1224
1332
  let t8;
1225
1333
  if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
1226
- t8 = /* @__PURE__ */ jsx(ShowInfo, {});
1334
+ t8 = /* @__PURE__ */ jsx(SlotInfo, {});
1227
1335
  $[34] = t8;
1228
1336
  } else t8 = $[34];
1229
1337
  row.push({
@@ -1247,7 +1355,7 @@ function WheelSlot(t0) {
1247
1355
  }
1248
1356
  row.push(onUnfit && {
1249
1357
  key: "unfit",
1250
- node: /* @__PURE__ */ jsx(Action, {
1358
+ node: /* @__PURE__ */ jsx(SlotAction, {
1251
1359
  icon: "module-unfit",
1252
1360
  label: "Unfit Module",
1253
1361
  onPress: onUnfit
@@ -1255,7 +1363,7 @@ function WheelSlot(t0) {
1255
1363
  });
1256
1364
  let t8;
1257
1365
  if ($[35] === Symbol.for("react.memo_cache_sentinel")) {
1258
- t8 = /* @__PURE__ */ jsx(ShowInfo, {});
1366
+ t8 = /* @__PURE__ */ jsx(SlotInfo, {});
1259
1367
  $[35] = t8;
1260
1368
  } else t8 = $[35];
1261
1369
  row.push({
@@ -1265,14 +1373,14 @@ function WheelSlot(t0) {
1265
1373
  const power = state === "offline" ? "Put Online" : "Put Offline";
1266
1374
  row.push(onTogglePower && {
1267
1375
  key: "power",
1268
- node: /* @__PURE__ */ jsx(Action, {
1376
+ node: /* @__PURE__ */ jsx(SlotAction, {
1269
1377
  icon: "module-power",
1270
1378
  label: power,
1271
1379
  onPress: onTogglePower
1272
1380
  })
1273
1381
  });
1274
1382
  }
1275
- t7 = row.findLastIndex(_temp$5);
1383
+ t7 = row.findLastIndex(_temp$7);
1276
1384
  $[23] = chargeTypeId;
1277
1385
  $[24] = fitted;
1278
1386
  $[25] = onRemoveCharge;
@@ -1369,13 +1477,10 @@ function WheelSlot(t0) {
1369
1477
  } else t19 = $[57];
1370
1478
  let t20;
1371
1479
  if ($[58] !== label || $[59] !== onPress) {
1372
- t20 = onPress && /* @__PURE__ */ jsx("div", {
1373
- role: "button",
1374
- tabIndex: 0,
1480
+ t20 = onPress && /* @__PURE__ */ jsx(SlotPress, {
1375
1481
  className: WheelSlot_module_default.press,
1376
- "aria-label": label,
1377
- onClick: onPress,
1378
- onKeyDown: _temp2$2
1482
+ label,
1483
+ onPress
1379
1484
  });
1380
1485
  $[58] = label;
1381
1486
  $[59] = onPress;
@@ -1449,70 +1554,9 @@ function WheelSlot(t0) {
1449
1554
  } else t23 = $[83];
1450
1555
  return t23;
1451
1556
  }
1452
- function _temp2$2(event) {
1453
- if (event.key !== "Enter" && event.key !== " ") return;
1454
- event.preventDefault();
1455
- event.currentTarget.dispatchEvent(new MouseEvent("click", {
1456
- bubbles: true,
1457
- shiftKey: event.shiftKey
1458
- }));
1459
- }
1460
- function _temp$5(action) {
1557
+ function _temp$7(action) {
1461
1558
  return action !== void 0;
1462
1559
  }
1463
- function Action(t0) {
1464
- const $ = c(9);
1465
- const { icon, label, onPress } = t0;
1466
- let t1;
1467
- if ($[0] !== icon) {
1468
- t1 = /* @__PURE__ */ jsx(Icon, { name: icon });
1469
- $[0] = icon;
1470
- $[1] = t1;
1471
- } else t1 = $[1];
1472
- let t2;
1473
- if ($[2] !== label || $[3] !== onPress || $[4] !== t1) {
1474
- t2 = /* @__PURE__ */ jsx("button", {
1475
- type: "button",
1476
- className: WheelSlot_module_default.button,
1477
- "aria-label": label,
1478
- onClick: onPress,
1479
- children: t1
1480
- });
1481
- $[2] = label;
1482
- $[3] = onPress;
1483
- $[4] = t1;
1484
- $[5] = t2;
1485
- } else t2 = $[5];
1486
- let t3;
1487
- if ($[6] !== label || $[7] !== t2) {
1488
- t3 = /* @__PURE__ */ jsx(Tooltip, {
1489
- label,
1490
- children: t2
1491
- });
1492
- $[6] = label;
1493
- $[7] = t2;
1494
- $[8] = t3;
1495
- } else t3 = $[8];
1496
- return t3;
1497
- }
1498
- function ShowInfo() {
1499
- const $ = c(1);
1500
- let t0;
1501
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1502
- t0 = /* @__PURE__ */ jsx(Tooltip, {
1503
- label: "Show Info (not implemented yet)",
1504
- children: /* @__PURE__ */ jsx("button", {
1505
- type: "button",
1506
- className: WheelSlot_module_default.button,
1507
- "aria-label": "Show Info",
1508
- "aria-disabled": true,
1509
- children: /* @__PURE__ */ jsx(Icon, { name: "module-info" })
1510
- })
1511
- });
1512
- $[0] = t0;
1513
- } else t0 = $[0];
1514
- return t0;
1515
- }
1516
1560
  function frameTexture(fitted, preview, state, activatable) {
1517
1561
  if (!fitted) return "classes/fitting/moduleframe";
1518
1562
  if (preview) return "classes/fitting/moduleframedots";
@@ -1918,11 +1962,14 @@ function StatsSection(t0) {
1918
1962
  }
1919
1963
  //#endregion
1920
1964
  //#region src/primitives/ResistanceBar/ResistanceBar.module.css
1921
- var ResistanceBar_module_default = { "bar": "QyA-_q_bar" };
1965
+ var ResistanceBar_module_default = {
1966
+ "bar": "QyA-_q_bar",
1967
+ "text": "QyA-_q_text"
1968
+ };
1922
1969
  //#endregion
1923
1970
  //#region src/primitives/ResistanceBar/ResistanceBar.tsx
1924
1971
  function ResistanceBar(t0) {
1925
- const $ = c(11);
1972
+ const $ = c(13);
1926
1973
  const { damage, label, resistance, children } = t0;
1927
1974
  let t1;
1928
1975
  if ($[0] !== resistance) {
@@ -1932,8 +1979,17 @@ function ResistanceBar(t0) {
1932
1979
  } else t1 = $[1];
1933
1980
  const t2 = t1;
1934
1981
  let t3;
1935
- if ($[2] !== children || $[3] !== damage || $[4] !== label || $[5] !== resistance || $[6] !== t2) {
1936
- t3 = /* @__PURE__ */ jsx("div", {
1982
+ if ($[2] !== children) {
1983
+ t3 = /* @__PURE__ */ jsx("span", {
1984
+ className: ResistanceBar_module_default.text,
1985
+ children
1986
+ });
1987
+ $[2] = children;
1988
+ $[3] = t3;
1989
+ } else t3 = $[3];
1990
+ let t4;
1991
+ if ($[4] !== damage || $[5] !== label || $[6] !== resistance || $[7] !== t2 || $[8] !== t3) {
1992
+ t4 = /* @__PURE__ */ jsx("div", {
1937
1993
  className: ResistanceBar_module_default.bar,
1938
1994
  role: "meter",
1939
1995
  "aria-label": label,
@@ -1942,26 +1998,26 @@ function ResistanceBar(t0) {
1942
1998
  "aria-valuenow": resistance,
1943
1999
  "data-damage": damage,
1944
2000
  style: t2,
1945
- children
2001
+ children: t3
1946
2002
  });
1947
- $[2] = children;
1948
- $[3] = damage;
1949
- $[4] = label;
1950
- $[5] = resistance;
1951
- $[6] = t2;
1952
- $[7] = t3;
1953
- } else t3 = $[7];
1954
- let t4;
1955
- if ($[8] !== label || $[9] !== t3) {
1956
- t4 = /* @__PURE__ */ jsx(Tooltip, {
2003
+ $[4] = damage;
2004
+ $[5] = label;
2005
+ $[6] = resistance;
2006
+ $[7] = t2;
2007
+ $[8] = t3;
2008
+ $[9] = t4;
2009
+ } else t4 = $[9];
2010
+ let t5;
2011
+ if ($[10] !== label || $[11] !== t4) {
2012
+ t5 = /* @__PURE__ */ jsx(Tooltip, {
1957
2013
  label,
1958
- children: t3
2014
+ children: t4
1959
2015
  });
1960
- $[8] = label;
1961
- $[9] = t3;
1962
- $[10] = t4;
1963
- } else t4 = $[10];
1964
- return t4;
2016
+ $[10] = label;
2017
+ $[11] = t4;
2018
+ $[12] = t5;
2019
+ } else t5 = $[12];
2020
+ return t5;
1965
2021
  }
1966
2022
  //#endregion
1967
2023
  //#region src/primitives/CapacitorRing/CapacitorRing.module.css
@@ -2048,9 +2104,6 @@ function CapacitorRing(t0) {
2048
2104
  return t8;
2049
2105
  }
2050
2106
  //#endregion
2051
- //#region src/components/FittingWheel/FittingWheel.module.css
2052
- var FittingWheel_module_default = { "centre": "GK_wGG_centre" };
2053
- //#endregion
2054
2107
  //#region src/components/FittingWheel/states.ts
2055
2108
  const states = [
2056
2109
  "offline",
@@ -2065,7 +2118,245 @@ function nextState(state, max, back = false) {
2065
2118
  return allowed[(allowed.indexOf(state) + step) % allowed.length];
2066
2119
  }
2067
2120
  //#endregion
2068
- //#region src/components/FittingWheel/FittingWheel.tsx
2121
+ //#region src/components/FittingWheel/fittingSlot.ts
2122
+ /** EVE does not let rigs and subsystems be put offline. */
2123
+ const switchedRacks = [
2124
+ "high",
2125
+ "medium",
2126
+ "low",
2127
+ "service"
2128
+ ];
2129
+ /** What a slot of the fit shows, and what clicking, dragging and dropping on it does. */
2130
+ function useFittingSlot(rack, index, content, available) {
2131
+ const $ = c(75);
2132
+ const store = useFitStore();
2133
+ const sde = useSde();
2134
+ const fit = useFit();
2135
+ const placement = usePlacement();
2136
+ const { show, clear } = usePreview();
2137
+ const { dragging, start, end } = useDrag();
2138
+ const item = content?.item;
2139
+ const stats = content?.stats;
2140
+ const type = useType(item?.type_id);
2141
+ const charges = useCharges(item?.type_id);
2142
+ const ref = content?.ref;
2143
+ let t0;
2144
+ if ($[0] !== rack || $[1] !== ref || $[2] !== stats) {
2145
+ t0 = ref !== void 0 && stats !== void 0 && switchedRacks.includes(rack);
2146
+ $[0] = rack;
2147
+ $[1] = ref;
2148
+ $[2] = stats;
2149
+ $[3] = t0;
2150
+ } else t0 = $[3];
2151
+ const switchable = t0;
2152
+ const target = `${rack}-${index}`;
2153
+ let t1;
2154
+ if ($[4] !== available || $[5] !== charges || $[6] !== fit || $[7] !== index || $[8] !== placement || $[9] !== rack || $[10] !== ref || $[11] !== sde) {
2155
+ t1 = (drop) => {
2156
+ if (!available || drop === void 0) return false;
2157
+ if (drop.type === "item") return movesTo(fit, drop.ref, rack, index);
2158
+ const dropped = sde.type(drop.typeId);
2159
+ if (dropped === void 0) return false;
2160
+ const place = placement(dropped);
2161
+ if (place?.type === "charge") return ref !== void 0 && charges.includes(dropped);
2162
+ return place?.type === rack && (place.type !== "subsystem" || place.index === index);
2163
+ };
2164
+ $[4] = available;
2165
+ $[5] = charges;
2166
+ $[6] = fit;
2167
+ $[7] = index;
2168
+ $[8] = placement;
2169
+ $[9] = rack;
2170
+ $[10] = ref;
2171
+ $[11] = sde;
2172
+ $[12] = t1;
2173
+ } else t1 = $[12];
2174
+ const takes = t1;
2175
+ const t2 = content?.preview;
2176
+ const t3 = item?.type_id;
2177
+ const t4 = type?.name;
2178
+ const t5 = item?.charge?.type_id;
2179
+ const t6 = charges.length > 0;
2180
+ const t7 = stats?.state;
2181
+ const t8 = stats?.maxState === "active" || stats?.maxState === "overload";
2182
+ const t9 = type && stats && `${type.name}, ${stats.state}`;
2183
+ let t10;
2184
+ if ($[13] !== ref || $[14] !== stats || $[15] !== store || $[16] !== switchable) {
2185
+ t10 = switchable ? (event) => store.setState(ref, nextState(stats.state, stats.maxState, event.shiftKey)) : void 0;
2186
+ $[13] = ref;
2187
+ $[14] = stats;
2188
+ $[15] = store;
2189
+ $[16] = switchable;
2190
+ $[17] = t10;
2191
+ } else t10 = $[17];
2192
+ let t11;
2193
+ if ($[18] !== ref || $[19] !== start || $[20] !== type?.name) {
2194
+ t11 = ref === void 0 ? void 0 : (event_0) => {
2195
+ event_0.dataTransfer.effectAllowed = "move";
2196
+ event_0.dataTransfer.setData("text/plain", type?.name ?? "");
2197
+ start({
2198
+ type: "item",
2199
+ ref
2200
+ });
2201
+ };
2202
+ $[18] = ref;
2203
+ $[19] = start;
2204
+ $[20] = type?.name;
2205
+ $[21] = t11;
2206
+ } else t11 = $[21];
2207
+ let t12;
2208
+ if ($[22] !== dragging || $[23] !== index || $[24] !== rack || $[25] !== show || $[26] !== takes || $[27] !== target) {
2209
+ t12 = () => {
2210
+ if (!takes(dragging)) return;
2211
+ const slot = {
2212
+ type: rack,
2213
+ index
2214
+ };
2215
+ if (dragging.type === "type") {
2216
+ const { typeId } = dragging;
2217
+ show((draft) => void draft.fit(typeId, slot), target);
2218
+ } else {
2219
+ const { ref: moved } = dragging;
2220
+ show((draft_0) => draft_0.move(moved, slot), target);
2221
+ }
2222
+ };
2223
+ $[22] = dragging;
2224
+ $[23] = index;
2225
+ $[24] = rack;
2226
+ $[25] = show;
2227
+ $[26] = takes;
2228
+ $[27] = target;
2229
+ $[28] = t12;
2230
+ } else t12 = $[28];
2231
+ let t13;
2232
+ if ($[29] !== clear || $[30] !== target) {
2233
+ t13 = (event_1) => {
2234
+ if (event_1.currentTarget.contains(event_1.relatedTarget)) return;
2235
+ clear(target);
2236
+ };
2237
+ $[29] = clear;
2238
+ $[30] = target;
2239
+ $[31] = t13;
2240
+ } else t13 = $[31];
2241
+ let t14;
2242
+ if ($[32] !== dragging || $[33] !== takes) {
2243
+ t14 = (event_2) => {
2244
+ if (takes(dragging)) allowDrop(event_2, dragging);
2245
+ };
2246
+ $[32] = dragging;
2247
+ $[33] = takes;
2248
+ $[34] = t14;
2249
+ } else t14 = $[34];
2250
+ let t15;
2251
+ if ($[35] !== clear || $[36] !== dragging || $[37] !== end || $[38] !== index || $[39] !== rack || $[40] !== store || $[41] !== takes || $[42] !== target) {
2252
+ t15 = (event_3) => {
2253
+ if (!takes(dragging)) return;
2254
+ event_3.preventDefault();
2255
+ clear(target);
2256
+ if (dragging.type === "type") store.fit(dragging.typeId, {
2257
+ type: rack,
2258
+ index
2259
+ });
2260
+ else store.move(dragging.ref, {
2261
+ type: rack,
2262
+ index
2263
+ });
2264
+ end();
2265
+ };
2266
+ $[35] = clear;
2267
+ $[36] = dragging;
2268
+ $[37] = end;
2269
+ $[38] = index;
2270
+ $[39] = rack;
2271
+ $[40] = store;
2272
+ $[41] = takes;
2273
+ $[42] = target;
2274
+ $[43] = t15;
2275
+ } else t15 = $[43];
2276
+ let t16;
2277
+ if ($[44] !== ref || $[45] !== store) {
2278
+ t16 = ref === void 0 ? void 0 : () => store.remove(ref);
2279
+ $[44] = ref;
2280
+ $[45] = store;
2281
+ $[46] = t16;
2282
+ } else t16 = $[46];
2283
+ let t17;
2284
+ if ($[47] !== ref || $[48] !== store) {
2285
+ t17 = ref === void 0 ? void 0 : () => store.setCharge(ref, void 0);
2286
+ $[47] = ref;
2287
+ $[48] = store;
2288
+ $[49] = t17;
2289
+ } else t17 = $[49];
2290
+ let t18;
2291
+ if ($[50] !== ref || $[51] !== stats || $[52] !== store || $[53] !== switchable) {
2292
+ t18 = switchable && stats.maxState !== "offline" ? () => store.setState(ref, stats.state === "offline" ? "online" : "offline") : void 0;
2293
+ $[50] = ref;
2294
+ $[51] = stats;
2295
+ $[52] = store;
2296
+ $[53] = switchable;
2297
+ $[54] = t18;
2298
+ } else t18 = $[54];
2299
+ let t19;
2300
+ if ($[55] !== available || $[56] !== end || $[57] !== t10 || $[58] !== t11 || $[59] !== t12 || $[60] !== t13 || $[61] !== t14 || $[62] !== t15 || $[63] !== t16 || $[64] !== t17 || $[65] !== t18 || $[66] !== t2 || $[67] !== t3 || $[68] !== t4 || $[69] !== t5 || $[70] !== t6 || $[71] !== t7 || $[72] !== t8 || $[73] !== t9) {
2301
+ t19 = {
2302
+ available,
2303
+ preview: t2,
2304
+ typeId: t3,
2305
+ typeName: t4,
2306
+ chargeTypeId: t5,
2307
+ chargeable: t6,
2308
+ state: t7,
2309
+ activatable: t8,
2310
+ label: t9,
2311
+ onPress: t10,
2312
+ onDragStart: t11,
2313
+ onDragEnd: end,
2314
+ onDragEnter: t12,
2315
+ onDragLeave: t13,
2316
+ onDragOver: t14,
2317
+ onDrop: t15,
2318
+ onUnfit: t16,
2319
+ onRemoveCharge: t17,
2320
+ onTogglePower: t18
2321
+ };
2322
+ $[55] = available;
2323
+ $[56] = end;
2324
+ $[57] = t10;
2325
+ $[58] = t11;
2326
+ $[59] = t12;
2327
+ $[60] = t13;
2328
+ $[61] = t14;
2329
+ $[62] = t15;
2330
+ $[63] = t16;
2331
+ $[64] = t17;
2332
+ $[65] = t18;
2333
+ $[66] = t2;
2334
+ $[67] = t3;
2335
+ $[68] = t4;
2336
+ $[69] = t5;
2337
+ $[70] = t6;
2338
+ $[71] = t7;
2339
+ $[72] = t8;
2340
+ $[73] = t9;
2341
+ $[74] = t19;
2342
+ } else t19 = $[74];
2343
+ return t19;
2344
+ }
2345
+ function allowDrop(event, dragging) {
2346
+ event.preventDefault();
2347
+ event.dataTransfer.dropEffect = dragging.type === "type" ? "copy" : "move";
2348
+ }
2349
+ /** Whether a fitted item can move to this slot. */
2350
+ function movesTo(fit, ref, rack, index) {
2351
+ const item = fit.items[ref];
2352
+ if (item === void 0 || rack === "subsystem" || item.slot.type !== rack) return false;
2353
+ return "index" in item.slot && item.slot.index !== index;
2354
+ }
2355
+ //#endregion
2356
+ //#region src/components/FittingWheel/FittingWheel.module.css
2357
+ var FittingWheel_module_default = { "centre": "GK_wGG_centre" };
2358
+ //#endregion
2359
+ //#region src/components/FittingWheel/FittingWheel.tsx
2069
2360
  const markedRacks = [
2070
2361
  "high",
2071
2362
  "medium",
@@ -2078,476 +2369,235 @@ const racks = [
2078
2369
  "rig",
2079
2370
  "subsystem"
2080
2371
  ];
2081
- /** EVE does not let rigs and subsystems be put offline. */
2082
- const switchedRacks = [
2083
- "high",
2084
- "medium",
2085
- "low"
2086
- ];
2087
2372
  /** The fitting wheel of the fit in the surrounding `EveShipFitProvider`. */
2088
2373
  function FittingWheel(t0) {
2089
- const $ = c(26);
2374
+ const $ = c(15);
2090
2375
  const { label: t1 } = t0;
2091
2376
  const label = t1 === void 0 ? "Fitting" : t1;
2092
2377
  const ship = useFit().ship.type_id;
2093
2378
  const { turret, launcher } = useHardpoints();
2094
- const { show, clear } = usePreview();
2095
- const previewing = useRef(void 0);
2096
2379
  let t2;
2097
- if ($[0] !== show) {
2098
- t2 = (target, edit) => {
2099
- previewing.current = target;
2100
- show(edit);
2101
- };
2102
- $[0] = show;
2380
+ if ($[0] !== ship) {
2381
+ t2 = /* @__PURE__ */ jsx(WheelHull, { typeId: ship });
2382
+ $[0] = ship;
2103
2383
  $[1] = t2;
2104
2384
  } else t2 = $[1];
2105
2385
  let t3;
2106
- if ($[2] !== clear) {
2107
- t3 = (target_0) => {
2108
- if (previewing.current !== target_0) return;
2109
- previewing.current = void 0;
2110
- clear();
2111
- };
2112
- $[2] = clear;
2113
- $[3] = t3;
2114
- } else t3 = $[3];
2115
2386
  let t4;
2116
- if ($[4] !== t2 || $[5] !== t3) {
2117
- t4 = {
2118
- show: t2,
2119
- hide: t3
2120
- };
2121
- $[4] = t2;
2122
- $[5] = t3;
2123
- $[6] = t4;
2124
- } else t4 = $[6];
2125
- const dropPreview = t4;
2126
2387
  let t5;
2127
- if ($[7] !== ship) {
2128
- t5 = /* @__PURE__ */ jsx(WheelHull, { typeId: ship });
2129
- $[7] = ship;
2130
- $[8] = t5;
2131
- } else t5 = $[8];
2388
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
2389
+ t3 = /* @__PURE__ */ jsx(FittingCentre, {});
2390
+ t4 = markedRacks.map(_temp$6);
2391
+ t5 = racks.map(_temp2$3);
2392
+ $[2] = t3;
2393
+ $[3] = t4;
2394
+ $[4] = t5;
2395
+ } else {
2396
+ t3 = $[2];
2397
+ t4 = $[3];
2398
+ t5 = $[4];
2399
+ }
2132
2400
  let t6;
2133
- if ($[9] !== dropPreview) {
2134
- t6 = /* @__PURE__ */ jsx(FittingCentre, { dropPreview });
2135
- $[9] = dropPreview;
2136
- $[10] = t6;
2137
- } else t6 = $[10];
2138
- let t7;
2139
- if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
2140
- t7 = markedRacks.map(_temp$4);
2141
- $[11] = t7;
2142
- } else t7 = $[11];
2143
- let t8;
2144
- if ($[12] !== dropPreview) {
2145
- t8 = racks.map((rack_0) => /* @__PURE__ */ jsx(FittingRack, {
2146
- rack: rack_0,
2147
- dropPreview
2148
- }, rack_0));
2149
- $[12] = dropPreview;
2150
- $[13] = t8;
2151
- } else t8 = $[13];
2152
- let t9;
2153
- if ($[14] !== launcher || $[15] !== turret) {
2154
- t9 = /* @__PURE__ */ jsx(WheelHardpoints, {
2401
+ if ($[5] !== launcher || $[6] !== turret) {
2402
+ t6 = /* @__PURE__ */ jsx(WheelHardpoints, {
2155
2403
  turrets: turret,
2156
2404
  launchers: launcher
2157
2405
  });
2158
- $[14] = launcher;
2159
- $[15] = turret;
2160
- $[16] = t9;
2161
- } else t9 = $[16];
2162
- let t10;
2163
- let t11;
2164
- let t12;
2165
- if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
2166
- t10 = /* @__PURE__ */ jsx(FittingGauge, {
2406
+ $[5] = launcher;
2407
+ $[6] = turret;
2408
+ $[7] = t6;
2409
+ } else t6 = $[7];
2410
+ let t7;
2411
+ let t8;
2412
+ let t9;
2413
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
2414
+ t7 = /* @__PURE__ */ jsx(FittingGauge, {
2167
2415
  resource: "cpu",
2168
2416
  load: "cpuLoad",
2169
2417
  output: "cpuOutput"
2170
2418
  });
2171
- t11 = /* @__PURE__ */ jsx(FittingGauge, {
2419
+ t8 = /* @__PURE__ */ jsx(FittingGauge, {
2172
2420
  resource: "powergrid",
2173
2421
  load: "powerLoad",
2174
2422
  output: "powerOutput"
2175
2423
  });
2176
- t12 = /* @__PURE__ */ jsx(FittingGauge, {
2424
+ t9 = /* @__PURE__ */ jsx(FittingGauge, {
2177
2425
  resource: "calibration",
2178
2426
  load: "upgradeLoad",
2179
2427
  output: "upgradeCapacity"
2180
2428
  });
2181
- $[17] = t10;
2182
- $[18] = t11;
2183
- $[19] = t12;
2429
+ $[8] = t7;
2430
+ $[9] = t8;
2431
+ $[10] = t9;
2184
2432
  } else {
2185
- t10 = $[17];
2186
- t11 = $[18];
2187
- t12 = $[19];
2433
+ t7 = $[8];
2434
+ t8 = $[9];
2435
+ t9 = $[10];
2188
2436
  }
2189
- let t13;
2190
- if ($[20] !== label || $[21] !== t5 || $[22] !== t6 || $[23] !== t8 || $[24] !== t9) {
2191
- t13 = /* @__PURE__ */ jsxs(Wheel, {
2437
+ let t10;
2438
+ if ($[11] !== label || $[12] !== t2 || $[13] !== t6) {
2439
+ t10 = /* @__PURE__ */ jsxs(Wheel, {
2192
2440
  label,
2193
2441
  children: [
2442
+ t2,
2443
+ t3,
2444
+ t4,
2194
2445
  t5,
2195
2446
  t6,
2196
2447
  t7,
2197
2448
  t8,
2198
- t9,
2199
- t10,
2200
- t11,
2201
- t12
2449
+ t9
2202
2450
  ]
2203
2451
  });
2204
- $[20] = label;
2205
- $[21] = t5;
2206
- $[22] = t6;
2207
- $[23] = t8;
2208
- $[24] = t9;
2209
- $[25] = t13;
2210
- } else t13 = $[25];
2211
- return t13;
2452
+ $[11] = label;
2453
+ $[12] = t2;
2454
+ $[13] = t6;
2455
+ $[14] = t10;
2456
+ } else t10 = $[14];
2457
+ return t10;
2458
+ }
2459
+ function _temp2$3(rack_0) {
2460
+ return /* @__PURE__ */ jsx(FittingRack, { rack: rack_0 }, rack_0);
2212
2461
  }
2213
- /** What a drop would do, shown while dragging over a target. */
2214
- function _temp$4(rack) {
2462
+ function _temp$6(rack) {
2215
2463
  return /* @__PURE__ */ jsx(WheelRackMarker, { rack }, rack);
2216
2464
  }
2217
2465
  function FittingRack(t0) {
2218
- const $ = c(5);
2219
- const { rack, dropPreview } = t0;
2466
+ const $ = c(4);
2467
+ const { rack } = t0;
2220
2468
  const slots = useSlots(rack);
2221
2469
  const { total } = useRackUsage(rack);
2222
2470
  let t1;
2223
- if ($[0] !== dropPreview || $[1] !== rack || $[2] !== slots || $[3] !== total) {
2471
+ if ($[0] !== rack || $[1] !== slots || $[2] !== total) {
2224
2472
  const shown = markedRacks.includes(rack) ? rackSize(rack) : Math.min(slots.length, rackSize(rack));
2225
2473
  t1 = Array.from({ length: shown }, (_, index) => /* @__PURE__ */ jsx(FittingSlot, {
2226
2474
  rack,
2227
2475
  index,
2228
2476
  content: slots[index],
2229
- available: index < total,
2230
- dropPreview
2477
+ available: index < total
2231
2478
  }, index));
2232
- $[0] = dropPreview;
2233
- $[1] = rack;
2234
- $[2] = slots;
2235
- $[3] = total;
2236
- $[4] = t1;
2237
- } else t1 = $[4];
2479
+ $[0] = rack;
2480
+ $[1] = slots;
2481
+ $[2] = total;
2482
+ $[3] = t1;
2483
+ } else t1 = $[3];
2238
2484
  return t1;
2239
2485
  }
2240
2486
  /** Fits a type dropped in the middle of the wheel, and unfits a fitted item. */
2241
- function FittingCentre(t0) {
2242
- const $ = c(21);
2243
- const { dropPreview } = t0;
2487
+ function FittingCentre() {
2488
+ const $ = c(25);
2244
2489
  const store = useFitStore();
2245
2490
  const fit = useFit();
2491
+ const { show, clear } = usePreview();
2246
2492
  const { dragging, end } = useDrag();
2493
+ let t0;
2494
+ if ($[0] !== dragging || $[1] !== store) {
2495
+ t0 = dragging?.type === "type" && placesSomewhere(store, dragging.typeId);
2496
+ $[0] = dragging;
2497
+ $[1] = store;
2498
+ $[2] = t0;
2499
+ } else t0 = $[2];
2500
+ const fits = t0;
2247
2501
  let t1;
2248
- if ($[0] !== fit) {
2249
- t1 = (item) => item !== void 0 && (item.type === "type" || fit.items[item.ref] !== void 0);
2250
- $[0] = fit;
2251
- $[1] = t1;
2252
- } else t1 = $[1];
2502
+ if ($[3] !== fit || $[4] !== fits) {
2503
+ t1 = (item) => item !== void 0 && (item.type === "type" ? fits : fit.items[item.ref] !== void 0);
2504
+ $[3] = fit;
2505
+ $[4] = fits;
2506
+ $[5] = t1;
2507
+ } else t1 = $[5];
2253
2508
  const takes = t1;
2254
2509
  let t2;
2255
- if ($[2] !== dragging || $[3] !== dropPreview) {
2510
+ if ($[6] !== dragging || $[7] !== show) {
2256
2511
  t2 = () => {
2257
2512
  if (dragging?.type !== "type") return;
2258
2513
  const { typeId } = dragging;
2259
- dropPreview.show("centre", (draft) => void draft.fit(typeId));
2514
+ show((draft) => void draft.fit(typeId), "centre");
2260
2515
  };
2261
- $[2] = dragging;
2262
- $[3] = dropPreview;
2263
- $[4] = t2;
2264
- } else t2 = $[4];
2516
+ $[6] = dragging;
2517
+ $[7] = show;
2518
+ $[8] = t2;
2519
+ } else t2 = $[8];
2265
2520
  let t3;
2266
- if ($[5] !== dropPreview) {
2267
- t3 = () => dropPreview.hide("centre");
2268
- $[5] = dropPreview;
2269
- $[6] = t3;
2270
- } else t3 = $[6];
2521
+ if ($[9] !== clear) {
2522
+ t3 = () => clear("centre");
2523
+ $[9] = clear;
2524
+ $[10] = t3;
2525
+ } else t3 = $[10];
2271
2526
  let t4;
2272
- if ($[7] !== dragging || $[8] !== takes) {
2527
+ if ($[11] !== dragging || $[12] !== takes) {
2273
2528
  t4 = (event) => {
2274
2529
  if (takes(dragging)) allowDrop(event, dragging);
2275
2530
  };
2276
- $[7] = dragging;
2277
- $[8] = takes;
2278
- $[9] = t4;
2279
- } else t4 = $[9];
2531
+ $[11] = dragging;
2532
+ $[12] = takes;
2533
+ $[13] = t4;
2534
+ } else t4 = $[13];
2280
2535
  let t5;
2281
- if ($[10] !== dragging || $[11] !== dropPreview || $[12] !== end || $[13] !== store || $[14] !== takes) {
2536
+ if ($[14] !== clear || $[15] !== dragging || $[16] !== end || $[17] !== store || $[18] !== takes) {
2282
2537
  t5 = (event_0) => {
2283
2538
  if (!takes(dragging)) return;
2284
2539
  event_0.preventDefault();
2285
- dropPreview.hide("centre");
2540
+ clear("centre");
2286
2541
  if (dragging.type === "type") store.fit(dragging.typeId);
2287
2542
  else store.remove(dragging.ref);
2288
2543
  end();
2289
2544
  };
2290
- $[10] = dragging;
2291
- $[11] = dropPreview;
2292
- $[12] = end;
2293
- $[13] = store;
2294
- $[14] = takes;
2295
- $[15] = t5;
2296
- } else t5 = $[15];
2545
+ $[14] = clear;
2546
+ $[15] = dragging;
2547
+ $[16] = end;
2548
+ $[17] = store;
2549
+ $[18] = takes;
2550
+ $[19] = t5;
2551
+ } else t5 = $[19];
2297
2552
  let t6;
2298
- if ($[16] !== t2 || $[17] !== t3 || $[18] !== t4 || $[19] !== t5) {
2553
+ if ($[20] !== t2 || $[21] !== t3 || $[22] !== t4 || $[23] !== t5) {
2299
2554
  t6 = /* @__PURE__ */ jsx("div", {
2300
2555
  className: FittingWheel_module_default.centre,
2301
2556
  "data-centre": true,
2302
2557
  onDragEnter: t2,
2303
2558
  onDragLeave: t3,
2304
- onDragOver: t4,
2305
- onDrop: t5
2306
- });
2307
- $[16] = t2;
2308
- $[17] = t3;
2309
- $[18] = t4;
2310
- $[19] = t5;
2311
- $[20] = t6;
2312
- } else t6 = $[20];
2313
- return t6;
2314
- }
2315
- function FittingSlot(t0) {
2316
- const $ = c(80);
2317
- const { rack, index, content, available, dropPreview } = t0;
2318
- const store = useFitStore();
2319
- const sde = useSde();
2320
- const fit = useFit();
2321
- const placement = usePlacement();
2322
- const { dragging, start, end } = useDrag();
2323
- const item = content?.item;
2324
- const stats = content?.stats;
2325
- const type = useType(item?.type_id);
2326
- const charges = useCharges(item?.type_id);
2327
- const ref = content?.ref;
2328
- let t1;
2329
- if ($[0] !== rack || $[1] !== ref || $[2] !== stats) {
2330
- t1 = ref !== void 0 && stats !== void 0 && switchedRacks.includes(rack);
2331
- $[0] = rack;
2332
- $[1] = ref;
2333
- $[2] = stats;
2334
- $[3] = t1;
2335
- } else t1 = $[3];
2336
- const switchable = t1;
2337
- const target = `${rack}-${index}`;
2338
- let t2;
2339
- if ($[4] !== available || $[5] !== charges || $[6] !== fit || $[7] !== index || $[8] !== placement || $[9] !== rack || $[10] !== ref || $[11] !== sde) {
2340
- t2 = (drop) => {
2341
- if (!available || drop === void 0) return false;
2342
- if (drop.type === "item") return movesTo(fit, drop.ref, rack, index);
2343
- const dropped = sde.type(drop.typeId);
2344
- if (dropped === void 0) return false;
2345
- const place = placement(dropped);
2346
- if (place?.type === "charge") return ref !== void 0 && charges.includes(dropped);
2347
- return place?.type === rack && (place.type !== "subsystem" || place.index === index);
2348
- };
2349
- $[4] = available;
2350
- $[5] = charges;
2351
- $[6] = fit;
2352
- $[7] = index;
2353
- $[8] = placement;
2354
- $[9] = rack;
2355
- $[10] = ref;
2356
- $[11] = sde;
2357
- $[12] = t2;
2358
- } else t2 = $[12];
2359
- const takes = t2;
2360
- let t3;
2361
- if ($[13] !== ref || $[14] !== stats || $[15] !== store || $[16] !== switchable) {
2362
- t3 = switchable ? (event) => store.setState(ref, nextState(stats.state, stats.maxState, event.shiftKey)) : void 0;
2363
- $[13] = ref;
2364
- $[14] = stats;
2365
- $[15] = store;
2366
- $[16] = switchable;
2367
- $[17] = t3;
2368
- } else t3 = $[17];
2369
- const onPress = t3;
2370
- let t4;
2371
- if ($[18] !== index || $[19] !== rack) {
2372
- t4 = slotAngle(rack, index);
2373
- $[18] = index;
2374
- $[19] = rack;
2375
- $[20] = t4;
2376
- } else t4 = $[20];
2377
- const t5 = content?.preview;
2378
- const t6 = item?.type_id;
2379
- const t7 = type?.name;
2380
- const t8 = item?.charge?.type_id;
2381
- const t9 = charges.length > 0;
2382
- const t10 = stats?.state;
2383
- const t11 = stats?.maxState === "active" || stats?.maxState === "overload";
2384
- const t12 = type && stats && `${type.name}, ${stats.state}`;
2385
- let t13;
2386
- if ($[21] !== ref || $[22] !== start || $[23] !== type?.name) {
2387
- t13 = ref === void 0 ? void 0 : (event_0) => {
2388
- event_0.dataTransfer.effectAllowed = "move";
2389
- event_0.dataTransfer.setData("text/plain", type?.name ?? "");
2390
- start({
2391
- type: "item",
2392
- ref
2393
- });
2394
- };
2395
- $[21] = ref;
2396
- $[22] = start;
2397
- $[23] = type?.name;
2398
- $[24] = t13;
2399
- } else t13 = $[24];
2400
- let t14;
2401
- if ($[25] !== dragging || $[26] !== dropPreview || $[27] !== index || $[28] !== rack || $[29] !== takes || $[30] !== target) {
2402
- t14 = () => {
2403
- if (!takes(dragging)) return;
2404
- const slot = {
2405
- type: rack,
2406
- index
2407
- };
2408
- if (dragging.type === "type") {
2409
- const { typeId } = dragging;
2410
- dropPreview.show(target, (draft) => void draft.fit(typeId, slot));
2411
- } else {
2412
- const { ref: moved } = dragging;
2413
- dropPreview.show(target, (draft_0) => draft_0.move(moved, slot));
2414
- }
2415
- };
2416
- $[25] = dragging;
2417
- $[26] = dropPreview;
2418
- $[27] = index;
2419
- $[28] = rack;
2420
- $[29] = takes;
2421
- $[30] = target;
2422
- $[31] = t14;
2423
- } else t14 = $[31];
2424
- let t15;
2425
- if ($[32] !== dropPreview || $[33] !== target) {
2426
- t15 = (event_1) => {
2427
- if (event_1.currentTarget.contains(event_1.relatedTarget)) return;
2428
- dropPreview.hide(target);
2429
- };
2430
- $[32] = dropPreview;
2431
- $[33] = target;
2432
- $[34] = t15;
2433
- } else t15 = $[34];
2434
- let t16;
2435
- if ($[35] !== dragging || $[36] !== takes) {
2436
- t16 = (event_2) => {
2437
- if (takes(dragging)) allowDrop(event_2, dragging);
2438
- };
2439
- $[35] = dragging;
2440
- $[36] = takes;
2441
- $[37] = t16;
2442
- } else t16 = $[37];
2443
- let t17;
2444
- if ($[38] !== dragging || $[39] !== dropPreview || $[40] !== end || $[41] !== index || $[42] !== rack || $[43] !== store || $[44] !== takes || $[45] !== target) {
2445
- t17 = (event_3) => {
2446
- if (!takes(dragging)) return;
2447
- event_3.preventDefault();
2448
- dropPreview.hide(target);
2449
- if (dragging.type === "type") store.fit(dragging.typeId, {
2450
- type: rack,
2451
- index
2452
- });
2453
- else store.move(dragging.ref, {
2454
- type: rack,
2455
- index
2456
- });
2457
- end();
2458
- };
2459
- $[38] = dragging;
2460
- $[39] = dropPreview;
2461
- $[40] = end;
2462
- $[41] = index;
2463
- $[42] = rack;
2464
- $[43] = store;
2465
- $[44] = takes;
2466
- $[45] = target;
2467
- $[46] = t17;
2468
- } else t17 = $[46];
2469
- let t18;
2470
- if ($[47] !== ref || $[48] !== store) {
2471
- t18 = ref === void 0 ? void 0 : () => store.remove(ref);
2472
- $[47] = ref;
2473
- $[48] = store;
2474
- $[49] = t18;
2475
- } else t18 = $[49];
2476
- let t19;
2477
- if ($[50] !== ref || $[51] !== store) {
2478
- t19 = ref === void 0 ? void 0 : () => store.setCharge(ref, void 0);
2479
- $[50] = ref;
2480
- $[51] = store;
2481
- $[52] = t19;
2482
- } else t19 = $[52];
2483
- let t20;
2484
- if ($[53] !== ref || $[54] !== stats || $[55] !== store || $[56] !== switchable) {
2485
- t20 = switchable && stats.maxState !== "offline" ? () => store.setState(ref, stats.state === "offline" ? "online" : "offline") : void 0;
2486
- $[53] = ref;
2487
- $[54] = stats;
2488
- $[55] = store;
2489
- $[56] = switchable;
2490
- $[57] = t20;
2491
- } else t20 = $[57];
2492
- let t21;
2493
- if ($[58] !== available || $[59] !== end || $[60] !== onPress || $[61] !== rack || $[62] !== t10 || $[63] !== t11 || $[64] !== t12 || $[65] !== t13 || $[66] !== t14 || $[67] !== t15 || $[68] !== t16 || $[69] !== t17 || $[70] !== t18 || $[71] !== t19 || $[72] !== t20 || $[73] !== t4 || $[74] !== t5 || $[75] !== t6 || $[76] !== t7 || $[77] !== t8 || $[78] !== t9) {
2494
- t21 = /* @__PURE__ */ jsx(WheelSlot, {
2495
- rack,
2496
- angle: t4,
2497
- available,
2498
- preview: t5,
2499
- typeId: t6,
2500
- typeName: t7,
2501
- chargeTypeId: t8,
2502
- chargeable: t9,
2503
- state: t10,
2504
- activatable: t11,
2505
- label: t12,
2506
- onPress,
2507
- onDragStart: t13,
2508
- onDragEnd: end,
2509
- onDragEnter: t14,
2510
- onDragLeave: t15,
2511
- onDragOver: t16,
2512
- onDrop: t17,
2513
- onUnfit: t18,
2514
- onRemoveCharge: t19,
2515
- onTogglePower: t20
2516
- });
2517
- $[58] = available;
2518
- $[59] = end;
2519
- $[60] = onPress;
2520
- $[61] = rack;
2521
- $[62] = t10;
2522
- $[63] = t11;
2523
- $[64] = t12;
2524
- $[65] = t13;
2525
- $[66] = t14;
2526
- $[67] = t15;
2527
- $[68] = t16;
2528
- $[69] = t17;
2529
- $[70] = t18;
2530
- $[71] = t19;
2531
- $[72] = t20;
2532
- $[73] = t4;
2533
- $[74] = t5;
2534
- $[75] = t6;
2535
- $[76] = t7;
2536
- $[77] = t8;
2537
- $[78] = t9;
2538
- $[79] = t21;
2539
- } else t21 = $[79];
2540
- return t21;
2559
+ onDragOver: t4,
2560
+ onDrop: t5
2561
+ });
2562
+ $[20] = t2;
2563
+ $[21] = t3;
2564
+ $[22] = t4;
2565
+ $[23] = t5;
2566
+ $[24] = t6;
2567
+ } else t6 = $[24];
2568
+ return t6;
2541
2569
  }
2542
- /** Whether a fitted item can move to this slot. */
2543
- function movesTo(fit, ref, rack, index) {
2544
- const item = fit.items[ref];
2545
- if (item === void 0 || rack === "subsystem" || item.slot.type !== rack) return false;
2546
- return "index" in item.slot && item.slot.index !== index;
2570
+ function FittingSlot(t0) {
2571
+ const $ = c(7);
2572
+ const { rack, index, content, available } = t0;
2573
+ const slot = useFittingSlot(rack, index, content, available);
2574
+ let t1;
2575
+ if ($[0] !== index || $[1] !== rack) {
2576
+ t1 = slotAngle(rack, index);
2577
+ $[0] = index;
2578
+ $[1] = rack;
2579
+ $[2] = t1;
2580
+ } else t1 = $[2];
2581
+ let t2;
2582
+ if ($[3] !== rack || $[4] !== slot || $[5] !== t1) {
2583
+ t2 = /* @__PURE__ */ jsx(WheelSlot, {
2584
+ rack,
2585
+ angle: t1,
2586
+ ...slot
2587
+ });
2588
+ $[3] = rack;
2589
+ $[4] = slot;
2590
+ $[5] = t1;
2591
+ $[6] = t2;
2592
+ } else t2 = $[6];
2593
+ return t2;
2547
2594
  }
2548
- function allowDrop(event, dragging) {
2549
- event.preventDefault();
2550
- event.dataTransfer.dropEffect = dragging.type === "type" ? "copy" : "move";
2595
+ function placesSomewhere(store, typeId) {
2596
+ let placed = false;
2597
+ store.preview((draft) => {
2598
+ placed = draft.fit(typeId) !== void 0;
2599
+ });
2600
+ return placed;
2551
2601
  }
2552
2602
  function FittingGauge(t0) {
2553
2603
  const $ = c(7);
@@ -2579,9 +2629,645 @@ function FittingGauge(t0) {
2579
2629
  return t4;
2580
2630
  }
2581
2631
  //#endregion
2632
+ //#region src/primitives/ServiceSlot/ServiceSlot.module.css
2633
+ var ServiceSlot_module_default = {
2634
+ "action": "R9jwpW_action",
2635
+ "actions": "R9jwpW_actions",
2636
+ "body": "R9jwpW_body",
2637
+ "empty": "R9jwpW_empty",
2638
+ "icon": "R9jwpW_icon",
2639
+ "press": "R9jwpW_press",
2640
+ "slot": "R9jwpW_slot"
2641
+ };
2642
+ //#endregion
2643
+ //#region src/primitives/ServiceSlot/ServiceSlot.tsx
2644
+ /** EVE's square slot of a structure service module, below the wheel. */
2645
+ function ServiceSlot(t0) {
2646
+ const $ = c(48);
2647
+ let className;
2648
+ let label;
2649
+ let onDragEnd;
2650
+ let onDragStart;
2651
+ let onPress;
2652
+ let onTogglePower;
2653
+ let onUnfit;
2654
+ let props;
2655
+ let t1;
2656
+ let t2;
2657
+ let t3;
2658
+ let typeId;
2659
+ let typeName;
2660
+ if ($[0] !== t0) {
2661
+ ({typeId, typeName, state: t1, available: t2, preview: t3, onPress, onDragStart, onDragEnd, label, onUnfit, onTogglePower, className, ...props} = t0);
2662
+ $[0] = t0;
2663
+ $[1] = className;
2664
+ $[2] = label;
2665
+ $[3] = onDragEnd;
2666
+ $[4] = onDragStart;
2667
+ $[5] = onPress;
2668
+ $[6] = onTogglePower;
2669
+ $[7] = onUnfit;
2670
+ $[8] = props;
2671
+ $[9] = t1;
2672
+ $[10] = t2;
2673
+ $[11] = t3;
2674
+ $[12] = typeId;
2675
+ $[13] = typeName;
2676
+ } else {
2677
+ className = $[1];
2678
+ label = $[2];
2679
+ onDragEnd = $[3];
2680
+ onDragStart = $[4];
2681
+ onPress = $[5];
2682
+ onTogglePower = $[6];
2683
+ onUnfit = $[7];
2684
+ props = $[8];
2685
+ t1 = $[9];
2686
+ t2 = $[10];
2687
+ t3 = $[11];
2688
+ typeId = $[12];
2689
+ typeName = $[13];
2690
+ }
2691
+ const state = t1 === void 0 ? "online" : t1;
2692
+ const available = t2 === void 0 ? true : t2;
2693
+ const preview = t3 === void 0 ? false : t3;
2694
+ const images = useImages();
2695
+ const fitted = typeId !== void 0;
2696
+ const frame = fitted && !preview ? "classes/fitting/slotpassive_structure" : "classes/fitting/stationserviceslotframe";
2697
+ const actions = fitted && !preview;
2698
+ let t4;
2699
+ if ($[14] !== className) {
2700
+ t4 = [ServiceSlot_module_default.slot, className].filter(Boolean);
2701
+ $[14] = className;
2702
+ $[15] = t4;
2703
+ } else t4 = $[15];
2704
+ const t5 = t4.join(" ");
2705
+ const t6 = fitted ? state : available ? "empty" : "unavailable";
2706
+ const t7 = preview || void 0;
2707
+ let t8;
2708
+ if ($[16] !== frame || $[17] !== images) {
2709
+ t8 = images.uiTexture(frame);
2710
+ $[16] = frame;
2711
+ $[17] = images;
2712
+ $[18] = t8;
2713
+ } else t8 = $[18];
2714
+ const t9 = `url(${t8})`;
2715
+ let t10;
2716
+ if ($[19] !== t9) {
2717
+ t10 = { "--texture": t9 };
2718
+ $[19] = t9;
2719
+ $[20] = t10;
2720
+ } else t10 = $[20];
2721
+ const t11 = t10;
2722
+ const t12 = onDragStart !== void 0 || void 0;
2723
+ let t13;
2724
+ if ($[21] !== available || $[22] !== fitted || $[23] !== typeId) {
2725
+ t13 = fitted ? /* @__PURE__ */ jsx("span", {
2726
+ className: ServiceSlot_module_default.icon,
2727
+ children: /* @__PURE__ */ jsx(TypeIcon, {
2728
+ typeId,
2729
+ size: 64,
2730
+ marker: false
2731
+ })
2732
+ }) : available && /* @__PURE__ */ jsx("span", {
2733
+ className: ServiceSlot_module_default.empty,
2734
+ children: /* @__PURE__ */ jsx(Icon, { name: "slot-service" })
2735
+ });
2736
+ $[21] = available;
2737
+ $[22] = fitted;
2738
+ $[23] = typeId;
2739
+ $[24] = t13;
2740
+ } else t13 = $[24];
2741
+ let t14;
2742
+ if ($[25] !== label || $[26] !== onPress) {
2743
+ t14 = onPress && /* @__PURE__ */ jsx(SlotPress, {
2744
+ className: ServiceSlot_module_default.press,
2745
+ label,
2746
+ onPress
2747
+ });
2748
+ $[25] = label;
2749
+ $[26] = onPress;
2750
+ $[27] = t14;
2751
+ } else t14 = $[27];
2752
+ let t15;
2753
+ if ($[28] !== onDragEnd || $[29] !== onDragStart || $[30] !== t11 || $[31] !== t12 || $[32] !== t13 || $[33] !== t14) {
2754
+ t15 = /* @__PURE__ */ jsxs("div", {
2755
+ className: ServiceSlot_module_default.body,
2756
+ style: t11,
2757
+ draggable: t12,
2758
+ onDragStart,
2759
+ onDragEnd,
2760
+ children: [t13, t14]
2761
+ });
2762
+ $[28] = onDragEnd;
2763
+ $[29] = onDragStart;
2764
+ $[30] = t11;
2765
+ $[31] = t12;
2766
+ $[32] = t13;
2767
+ $[33] = t14;
2768
+ $[34] = t15;
2769
+ } else t15 = $[34];
2770
+ let t16;
2771
+ if ($[35] !== actions || $[36] !== onTogglePower || $[37] !== onUnfit || $[38] !== state || $[39] !== typeName) {
2772
+ t16 = actions && /* @__PURE__ */ jsxs("fieldset", {
2773
+ className: ServiceSlot_module_default.actions,
2774
+ "aria-label": typeName,
2775
+ children: [
2776
+ /* @__PURE__ */ jsx("span", {
2777
+ className: ServiceSlot_module_default.action,
2778
+ children: onUnfit && /* @__PURE__ */ jsx(SlotAction, {
2779
+ icon: "module-unfit",
2780
+ label: "Unfit Module",
2781
+ onPress: onUnfit
2782
+ })
2783
+ }),
2784
+ /* @__PURE__ */ jsx("span", {
2785
+ className: ServiceSlot_module_default.action,
2786
+ children: /* @__PURE__ */ jsx(SlotInfo, {})
2787
+ }),
2788
+ onTogglePower && /* @__PURE__ */ jsx("span", {
2789
+ className: ServiceSlot_module_default.action,
2790
+ children: /* @__PURE__ */ jsx(SlotAction, {
2791
+ icon: "module-power",
2792
+ label: state === "offline" ? "Put Online" : "Put Offline",
2793
+ onPress: onTogglePower
2794
+ })
2795
+ })
2796
+ ]
2797
+ });
2798
+ $[35] = actions;
2799
+ $[36] = onTogglePower;
2800
+ $[37] = onUnfit;
2801
+ $[38] = state;
2802
+ $[39] = typeName;
2803
+ $[40] = t16;
2804
+ } else t16 = $[40];
2805
+ let t17;
2806
+ if ($[41] !== props || $[42] !== t15 || $[43] !== t16 || $[44] !== t5 || $[45] !== t6 || $[46] !== t7) {
2807
+ t17 = /* @__PURE__ */ jsxs("div", {
2808
+ ...props,
2809
+ className: t5,
2810
+ "data-state": t6,
2811
+ "data-preview": t7,
2812
+ children: [t15, t16]
2813
+ });
2814
+ $[41] = props;
2815
+ $[42] = t15;
2816
+ $[43] = t16;
2817
+ $[44] = t5;
2818
+ $[45] = t6;
2819
+ $[46] = t7;
2820
+ $[47] = t17;
2821
+ } else t17 = $[47];
2822
+ return t17;
2823
+ }
2824
+ //#endregion
2825
+ //#region src/components/ShipStatistics/AttributeTooltip.tsx
2826
+ /** What EVE shows when hovering the attribute; its name, for one without. */
2827
+ function AttributeTooltip(t0) {
2828
+ const $ = c(7);
2829
+ const { attribute } = t0;
2830
+ const sde = useSde();
2831
+ const tooltip = useAttributeTooltip(attribute);
2832
+ let t1;
2833
+ if ($[0] !== attribute || $[1] !== sde || $[2] !== tooltip?.title) {
2834
+ t1 = tooltip?.title ?? sde.attribute(sde.attributeId(attribute) ?? 0)?.displayName ?? attribute;
2835
+ $[0] = attribute;
2836
+ $[1] = sde;
2837
+ $[2] = tooltip?.title;
2838
+ $[3] = t1;
2839
+ } else t1 = $[3];
2840
+ const title = t1;
2841
+ const t2 = tooltip?.description;
2842
+ let t3;
2843
+ if ($[4] !== t2 || $[5] !== title) {
2844
+ t3 = /* @__PURE__ */ jsx(TooltipText, {
2845
+ title,
2846
+ description: t2
2847
+ });
2848
+ $[4] = t2;
2849
+ $[5] = title;
2850
+ $[6] = t3;
2851
+ } else t3 = $[6];
2852
+ return t3;
2853
+ }
2854
+ //#endregion
2855
+ //#region src/components/FittingWindow/BayContents.module.css
2856
+ var BayContents_module_default = {
2857
+ "activeDrones": "gVdevq_activeDrones",
2858
+ "box": "gVdevq_box",
2859
+ "count": "gVdevq_count",
2860
+ "icon": "gVdevq_icon",
2861
+ "list": "gVdevq_list",
2862
+ "middle": "gVdevq_middle",
2863
+ "name": "gVdevq_name",
2864
+ "panel": "gVdevq_panel",
2865
+ "quantity": "gVdevq_quantity",
2866
+ "remove": "gVdevq_remove",
2867
+ "removeAll": "gVdevq_removeAll",
2868
+ "row": "gVdevq_row",
2869
+ "selection": "gVdevq_selection",
2870
+ "steps": "gVdevq_steps",
2871
+ "times": "gVdevq_times"
2872
+ };
2873
+ //#endregion
2874
+ //#region src/components/FittingWindow/BayContents.tsx
2875
+ const emptyText = {
2876
+ cargo: "No Cargo Items Simulated",
2877
+ droneBay: "No Drones Simulated"
2878
+ };
2879
+ /** EVE's list of what is in a bay, as a popover anchored to `--bay-anchor`. */
2880
+ function BayContents(t0) {
2881
+ const $ = c(26);
2882
+ const { id, bay, label } = t0;
2883
+ const store = useFitStore();
2884
+ const contents = useBayContents(bay);
2885
+ const panel = useRef(null);
2886
+ const drones = bay === "droneBay";
2887
+ const { stats } = useSnapshot();
2888
+ let t1;
2889
+ if ($[0] !== stats.character) {
2890
+ t1 = stats.character.get("maxActiveDrones") ?? 0;
2891
+ $[0] = stats.character;
2892
+ $[1] = t1;
2893
+ } else t1 = $[1];
2894
+ const maxActive = t1;
2895
+ if (contents.length === 0) {
2896
+ const t2 = emptyText[bay];
2897
+ let t3;
2898
+ if ($[2] !== id || $[3] !== t2) {
2899
+ t3 = /* @__PURE__ */ jsx("div", {
2900
+ id,
2901
+ className: BayContents_module_default.panel,
2902
+ popover: "auto",
2903
+ "data-empty": true,
2904
+ children: t2
2905
+ });
2906
+ $[2] = id;
2907
+ $[3] = t2;
2908
+ $[4] = t3;
2909
+ } else t3 = $[4];
2910
+ return t3;
2911
+ }
2912
+ const t2 = drones || void 0;
2913
+ let t3;
2914
+ if ($[5] !== drones || $[6] !== maxActive || $[7] !== stats.ship) {
2915
+ t3 = drones && /* @__PURE__ */ jsxs("div", {
2916
+ className: BayContents_module_default.activeDrones,
2917
+ children: [
2918
+ "Active drones: ",
2919
+ stats.ship.get("droneActive") ?? 0,
2920
+ " / ",
2921
+ maxActive
2922
+ ]
2923
+ });
2924
+ $[5] = drones;
2925
+ $[6] = maxActive;
2926
+ $[7] = stats.ship;
2927
+ $[8] = t3;
2928
+ } else t3 = $[8];
2929
+ let t4;
2930
+ if ($[9] !== contents || $[10] !== drones || $[11] !== maxActive || $[12] !== store) {
2931
+ t4 = contents.map((content) => {
2932
+ const { type, quantity, refs } = content;
2933
+ return /* @__PURE__ */ jsxs("li", {
2934
+ className: BayContents_module_default.row,
2935
+ children: [
2936
+ /* @__PURE__ */ jsx(Quantity, {
2937
+ name: type.name,
2938
+ value: quantity,
2939
+ onChange: (value) => drones ? store.setDroneQuantity(type.id, value) : store.setCargoQuantity(type.id, value)
2940
+ }),
2941
+ /* @__PURE__ */ jsx("span", {
2942
+ className: BayContents_module_default.icon,
2943
+ children: /* @__PURE__ */ jsx(TypeIcon, { typeId: type.id })
2944
+ }),
2945
+ /* @__PURE__ */ jsxs("span", {
2946
+ className: BayContents_module_default.middle,
2947
+ children: [/* @__PURE__ */ jsx("span", {
2948
+ className: BayContents_module_default.name,
2949
+ children: type.name
2950
+ }), drones && /* @__PURE__ */ jsx(DroneSelection, {
2951
+ content,
2952
+ max: maxActive
2953
+ })]
2954
+ }),
2955
+ /* @__PURE__ */ jsx("button", {
2956
+ type: "button",
2957
+ className: BayContents_module_default.remove,
2958
+ "aria-label": `Remove ${type.name}`,
2959
+ onClick: (event) => {
2960
+ const row = event.currentTarget.closest("li");
2961
+ const next = row.nextElementSibling ?? row.previousElementSibling;
2962
+ store.remove(...refs);
2963
+ if (next === null) panel.current?.hidePopover();
2964
+ else next.querySelector(`.${BayContents_module_default.remove}`)?.focus();
2965
+ },
2966
+ children: /* @__PURE__ */ jsx(Icon, { name: "close" })
2967
+ })
2968
+ ]
2969
+ }, type.id);
2970
+ });
2971
+ $[9] = contents;
2972
+ $[10] = drones;
2973
+ $[11] = maxActive;
2974
+ $[12] = store;
2975
+ $[13] = t4;
2976
+ } else t4 = $[13];
2977
+ let t5;
2978
+ if ($[14] !== label || $[15] !== t4) {
2979
+ t5 = /* @__PURE__ */ jsx("ul", {
2980
+ className: BayContents_module_default.list,
2981
+ "aria-label": label,
2982
+ children: t4
2983
+ });
2984
+ $[14] = label;
2985
+ $[15] = t4;
2986
+ $[16] = t5;
2987
+ } else t5 = $[16];
2988
+ let t6;
2989
+ if ($[17] !== contents || $[18] !== store) {
2990
+ t6 = /* @__PURE__ */ jsx("button", {
2991
+ type: "button",
2992
+ className: BayContents_module_default.removeAll,
2993
+ onClick: () => {
2994
+ store.remove(...contents.flatMap(_temp$5));
2995
+ panel.current?.hidePopover();
2996
+ },
2997
+ children: "Remove All"
2998
+ });
2999
+ $[17] = contents;
3000
+ $[18] = store;
3001
+ $[19] = t6;
3002
+ } else t6 = $[19];
3003
+ let t7;
3004
+ if ($[20] !== id || $[21] !== t2 || $[22] !== t3 || $[23] !== t5 || $[24] !== t6) {
3005
+ t7 = /* @__PURE__ */ jsxs("div", {
3006
+ ref: panel,
3007
+ id,
3008
+ className: BayContents_module_default.panel,
3009
+ popover: "auto",
3010
+ "data-drones": t2,
3011
+ children: [
3012
+ t3,
3013
+ t5,
3014
+ t6
3015
+ ]
3016
+ });
3017
+ $[20] = id;
3018
+ $[21] = t2;
3019
+ $[22] = t3;
3020
+ $[23] = t5;
3021
+ $[24] = t6;
3022
+ $[25] = t7;
3023
+ } else t7 = $[25];
3024
+ return t7;
3025
+ }
3026
+ /** One box per drone the character can launch. */
3027
+ function _temp$5(t0) {
3028
+ const { refs: refs_0 } = t0;
3029
+ return refs_0;
3030
+ }
3031
+ function DroneSelection(t0) {
3032
+ const $ = c(16);
3033
+ const { content: t1, max } = t0;
3034
+ const { type, quantity, active } = t1;
3035
+ const store = useFitStore();
3036
+ const room = useDroneRoom(type);
3037
+ const t2 = `Active ${type.name}`;
3038
+ let t3;
3039
+ if ($[0] !== active || $[1] !== max || $[2] !== quantity || $[3] !== room || $[4] !== store || $[5] !== type.id) {
3040
+ let t4;
3041
+ if ($[7] !== active || $[8] !== quantity || $[9] !== room || $[10] !== store || $[11] !== type.id) {
3042
+ t4 = (_, index) => {
3043
+ const count = index + 1;
3044
+ const state = count <= active ? "active" : count > quantity ? "none" : count <= active + room ? "open" : "over";
3045
+ return /* @__PURE__ */ jsx("button", {
3046
+ type: "button",
3047
+ className: BayContents_module_default.box,
3048
+ "aria-label": `${count} active`,
3049
+ "aria-pressed": count === active,
3050
+ "data-state": state,
3051
+ disabled: state === "over" || state === "none",
3052
+ onClick: () => store.setActiveDrones(type.id, count === active ? count - 1 : count),
3053
+ children: count <= active && "×"
3054
+ }, count);
3055
+ };
3056
+ $[7] = active;
3057
+ $[8] = quantity;
3058
+ $[9] = room;
3059
+ $[10] = store;
3060
+ $[11] = type.id;
3061
+ $[12] = t4;
3062
+ } else t4 = $[12];
3063
+ t3 = Array.from({ length: Math.max(max, active) }, t4);
3064
+ $[0] = active;
3065
+ $[1] = max;
3066
+ $[2] = quantity;
3067
+ $[3] = room;
3068
+ $[4] = store;
3069
+ $[5] = type.id;
3070
+ $[6] = t3;
3071
+ } else t3 = $[6];
3072
+ let t4;
3073
+ if ($[13] !== t2 || $[14] !== t3) {
3074
+ t4 = /* @__PURE__ */ jsxs("span", {
3075
+ className: BayContents_module_default.selection,
3076
+ role: "group",
3077
+ "aria-label": t2,
3078
+ children: ["Selected:", t3]
3079
+ });
3080
+ $[13] = t2;
3081
+ $[14] = t3;
3082
+ $[15] = t4;
3083
+ } else t4 = $[15];
3084
+ return t4;
3085
+ }
3086
+ /** EVE's count of a row, which turns into a spinner on hover and focus. */
3087
+ function Quantity(t0) {
3088
+ const $ = c(43);
3089
+ const { name, value, onChange } = t0;
3090
+ const [draft, setDraft] = useState();
3091
+ const cancelled = useRef(false);
3092
+ let t1;
3093
+ if ($[0] !== draft || $[1] !== value) {
3094
+ t1 = draft !== void 0 && /^\d+$/.test(draft) ? Number(draft) : value;
3095
+ $[0] = draft;
3096
+ $[1] = value;
3097
+ $[2] = t1;
3098
+ } else t1 = $[2];
3099
+ const current = t1;
3100
+ const shown = draft ?? String(value);
3101
+ let t2;
3102
+ if ($[3] !== onChange || $[4] !== value) {
3103
+ t2 = (next) => {
3104
+ setDraft(void 0);
3105
+ if (Number.isSafeInteger(next) && next >= 1 && next !== value) onChange(next);
3106
+ };
3107
+ $[3] = onChange;
3108
+ $[4] = value;
3109
+ $[5] = t2;
3110
+ } else t2 = $[5];
3111
+ const set = t2;
3112
+ let t3;
3113
+ if ($[6] !== current || $[7] !== set) {
3114
+ t3 = (event) => {
3115
+ if (event.key === "Enter") set(current);
3116
+ if (event.key === "Escape") {
3117
+ cancelled.current = true;
3118
+ setDraft(void 0);
3119
+ }
3120
+ if (event.key === "ArrowUp" || event.key === "ArrowDown") {
3121
+ event.preventDefault();
3122
+ set(current + (event.key === "ArrowUp" ? 1 : -1));
3123
+ }
3124
+ };
3125
+ $[6] = current;
3126
+ $[7] = set;
3127
+ $[8] = t3;
3128
+ } else t3 = $[8];
3129
+ const onKeyDown = t3;
3130
+ const t4 = `${Math.max(1, shown.length)}ch`;
3131
+ let t5;
3132
+ if ($[9] !== t4) {
3133
+ t5 = { width: t4 };
3134
+ $[9] = t4;
3135
+ $[10] = t5;
3136
+ } else t5 = $[10];
3137
+ const t6 = `Number of ${name}`;
3138
+ let t7;
3139
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
3140
+ t7 = (event_0) => {
3141
+ cancelled.current = false;
3142
+ setDraft(event_0.target.value);
3143
+ };
3144
+ $[11] = t7;
3145
+ } else t7 = $[11];
3146
+ let t8;
3147
+ if ($[12] !== current || $[13] !== draft || $[14] !== set) {
3148
+ t8 = () => {
3149
+ if (draft !== void 0 && !cancelled.current) set(current);
3150
+ else setDraft(void 0);
3151
+ };
3152
+ $[12] = current;
3153
+ $[13] = draft;
3154
+ $[14] = set;
3155
+ $[15] = t8;
3156
+ } else t8 = $[15];
3157
+ let t9;
3158
+ if ($[16] !== onKeyDown || $[17] !== shown || $[18] !== t5 || $[19] !== t6 || $[20] !== t8) {
3159
+ t9 = /* @__PURE__ */ jsx("input", {
3160
+ type: "number",
3161
+ className: BayContents_module_default.count,
3162
+ style: t5,
3163
+ "aria-label": t6,
3164
+ min: 1,
3165
+ value: shown,
3166
+ onChange: t7,
3167
+ onKeyDown,
3168
+ onBlur: t8
3169
+ });
3170
+ $[16] = onKeyDown;
3171
+ $[17] = shown;
3172
+ $[18] = t5;
3173
+ $[19] = t6;
3174
+ $[20] = t8;
3175
+ $[21] = t9;
3176
+ } else t9 = $[21];
3177
+ let t10;
3178
+ if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
3179
+ t10 = /* @__PURE__ */ jsx("span", {
3180
+ className: BayContents_module_default.times,
3181
+ children: "x"
3182
+ });
3183
+ $[22] = t10;
3184
+ } else t10 = $[22];
3185
+ const t11 = `One more ${name}`;
3186
+ let t12;
3187
+ if ($[23] !== current || $[24] !== set) {
3188
+ t12 = () => set(current + 1);
3189
+ $[23] = current;
3190
+ $[24] = set;
3191
+ $[25] = t12;
3192
+ } else t12 = $[25];
3193
+ let t13;
3194
+ if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
3195
+ t13 = /* @__PURE__ */ jsx(Icon, { name: "arrow-up" });
3196
+ $[26] = t13;
3197
+ } else t13 = $[26];
3198
+ let t14;
3199
+ if ($[27] !== t11 || $[28] !== t12) {
3200
+ t14 = /* @__PURE__ */ jsx("button", {
3201
+ type: "button",
3202
+ tabIndex: -1,
3203
+ "aria-label": t11,
3204
+ onClick: t12,
3205
+ children: t13
3206
+ });
3207
+ $[27] = t11;
3208
+ $[28] = t12;
3209
+ $[29] = t14;
3210
+ } else t14 = $[29];
3211
+ const t15 = `One fewer ${name}`;
3212
+ let t16;
3213
+ if ($[30] !== current || $[31] !== set) {
3214
+ t16 = () => set(current - 1);
3215
+ $[30] = current;
3216
+ $[31] = set;
3217
+ $[32] = t16;
3218
+ } else t16 = $[32];
3219
+ let t17;
3220
+ if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
3221
+ t17 = /* @__PURE__ */ jsx(Icon, { name: "arrow-down" });
3222
+ $[33] = t17;
3223
+ } else t17 = $[33];
3224
+ let t18;
3225
+ if ($[34] !== t15 || $[35] !== t16) {
3226
+ t18 = /* @__PURE__ */ jsx("button", {
3227
+ type: "button",
3228
+ tabIndex: -1,
3229
+ "aria-label": t15,
3230
+ onClick: t16,
3231
+ children: t17
3232
+ });
3233
+ $[34] = t15;
3234
+ $[35] = t16;
3235
+ $[36] = t18;
3236
+ } else t18 = $[36];
3237
+ let t19;
3238
+ if ($[37] !== t14 || $[38] !== t18) {
3239
+ t19 = /* @__PURE__ */ jsxs("span", {
3240
+ className: BayContents_module_default.steps,
3241
+ children: [t14, t18]
3242
+ });
3243
+ $[37] = t14;
3244
+ $[38] = t18;
3245
+ $[39] = t19;
3246
+ } else t19 = $[39];
3247
+ let t20;
3248
+ if ($[40] !== t19 || $[41] !== t9) {
3249
+ t20 = /* @__PURE__ */ jsxs("span", {
3250
+ className: BayContents_module_default.quantity,
3251
+ children: [
3252
+ t9,
3253
+ t10,
3254
+ t19
3255
+ ]
3256
+ });
3257
+ $[40] = t19;
3258
+ $[41] = t9;
3259
+ $[42] = t20;
3260
+ } else t20 = $[42];
3261
+ return t20;
3262
+ }
3263
+ //#endregion
2582
3264
  //#region src/components/FittingWindow/FittingWindow.module.css
2583
3265
  var FittingWindow_module_default = {
3266
+ "alert": "L9t91q_alert",
3267
+ "alertLine": "L9t91q_alertLine",
3268
+ "alertTitle": "L9t91q_alertTitle",
2584
3269
  "bay": "L9t91q_bay",
3270
+ "bayAnchor": "L9t91q_bayAnchor",
2585
3271
  "bays": "L9t91q_bays",
2586
3272
  "browser": "L9t91q_browser",
2587
3273
  "count": "L9t91q_count",
@@ -2594,6 +3280,7 @@ var FittingWindow_module_default = {
2594
3280
  "panels": "L9t91q_panels",
2595
3281
  "resource": "L9t91q_resource",
2596
3282
  "resources": "L9t91q_resources",
3283
+ "services": "L9t91q_services",
2597
3284
  "slash": "L9t91q_slash",
2598
3285
  "slide": "L9t91q_slide",
2599
3286
  "statistics": "L9t91q_statistics",
@@ -2658,15 +3345,89 @@ function countViolations(violations) {
2658
3345
  counts.skill = skills.size;
2659
3346
  return counts;
2660
3347
  }
3348
+ const resourceTexts = {
3349
+ cpu: "CPU overloaded",
3350
+ powergrid: "Powergrid overloaded",
3351
+ calibration: "Calibration overloaded",
3352
+ cargo_bay: "Cargo hold overloaded",
3353
+ drone_bay: "Drone bay overloaded",
3354
+ drone_bandwidth: "Drone bandwidth overloaded",
3355
+ fighter_bay: "Fighter bay overloaded",
3356
+ launched_drones: "Too many drones launched",
3357
+ fighter_tubes: "Too many fighters launched",
3358
+ light_fighter_tubes: "Too many light fighters launched",
3359
+ support_fighter_tubes: "Too many support fighters launched",
3360
+ heavy_fighter_tubes: "Too many heavy fighters launched"
3361
+ };
3362
+ const rackItems = {
3363
+ high: "high slot modules",
3364
+ medium: "medium slot modules",
3365
+ low: "low slot modules",
3366
+ rig: "rigs",
3367
+ subsystem: "subsystems",
3368
+ service: "service modules",
3369
+ turret: "turrets",
3370
+ launcher: "launchers"
3371
+ };
3372
+ const slotNames = {
3373
+ high: "a high slot",
3374
+ medium: "a medium slot",
3375
+ low: "a low slot",
3376
+ rig: "a rig slot",
3377
+ subsystem: "a subsystem slot",
3378
+ service: "a service slot",
3379
+ turret: "a turret hardpoint",
3380
+ launcher: "a launcher hardpoint"
3381
+ };
3382
+ const romanLevels = [
3383
+ "I",
3384
+ "II",
3385
+ "III",
3386
+ "IV",
3387
+ "V"
3388
+ ];
3389
+ /** What is wrong, or the skill that is missing. */
3390
+ function violationText({ target, rule }, fit, names) {
3391
+ const item = target.type === "ship" ? void 0 : fit.items[target.index];
3392
+ const module = item ? names.type(item.type_id) : "";
3393
+ const charge = item?.charge ? names.type(item.charge.type_id) : "";
3394
+ const subject = target.type === "charge" ? charge : module;
3395
+ switch (rule.type) {
3396
+ case "resource": return rule.resource === "charge_capacity" ? `${charge}: too big for ${module}` : resourceTexts[rule.resource];
3397
+ case "slots": return `Too many ${rackItems[rule.slot]}`;
3398
+ case "skill": return `${names.type(rule.type_id)} ${romanLevels[rule.required - 1]}`;
3399
+ case "wrong_slot": return `${subject}: goes in ${slotNames[rule.expected]}`;
3400
+ case "slot_taken": return `${subject}: slot already taken`;
3401
+ case "wrong_slot_index": return `${subject}: goes in ${item?.slot.type} slot ${rule.expected}`;
3402
+ case "subsystem_taken": return `${subject}: another subsystem covers the same part of the ship`;
3403
+ case "rig_size": return `${subject}: rig size does not match the ship`;
3404
+ case "ship_restricted": return `${subject}: cannot be fitted to this ship`;
3405
+ case "capital_item": return `${subject}: needs a capital ship`;
3406
+ case "structure_item": return `${subject}: only fits on a structure`;
3407
+ case "ship_item": return `${subject}: does not fit on a structure`;
3408
+ case "max_group": return `${subject}: only ${rule.allowed} ${names.group(rule.group_id)} can be ${rule.limit}`;
3409
+ case "max_type": return `${subject}: only ${rule.allowed} can be fitted`;
3410
+ case "charge_group": return `${charge}: cannot be loaded in ${module}`;
3411
+ case "charge_size": return `${charge}: wrong size for ${module}`;
3412
+ }
3413
+ }
3414
+ /** Each missing skill once, at the highest level asked for. */
3415
+ function missingSkills(violations) {
3416
+ const skills = /* @__PURE__ */ new Map();
3417
+ for (const { rule } of violations) if (rule.type === "skill" && rule.required > (skills.get(rule.type_id)?.required ?? 0)) skills.set(rule.type_id, rule);
3418
+ return [...skills.values()];
3419
+ }
2661
3420
  //#endregion
2662
3421
  //#region src/components/FittingWindow/FittingWindow.tsx
2663
3422
  const oneDecimal = new Intl.NumberFormat("en-US", {
2664
3423
  minimumFractionDigits: 1,
2665
3424
  maximumFractionDigits: 1
2666
3425
  });
3426
+ /** EVE draws eight, those the structure does not have as a faint outline. */
3427
+ const SERVICE_SLOTS = 8;
2667
3428
  /** EVE's fitting window around the `FittingWheel`. */
2668
3429
  function FittingWindow(t0) {
2669
- const $ = c(32);
3430
+ const $ = c(38);
2670
3431
  const { label: t1, browser, statistics } = t0;
2671
3432
  const label = t1 === void 0 ? "Fitting Window" : t1;
2672
3433
  const [browserOpen, setBrowserOpen] = useState(true);
@@ -2675,6 +3436,7 @@ function FittingWindow(t0) {
2675
3436
  const statisticsId = useId();
2676
3437
  const browserShown = browser !== void 0 && browserOpen;
2677
3438
  const statisticsShown = statistics !== void 0 && statisticsOpen;
3439
+ const { structure } = useSnapshot().stats;
2678
3440
  const t2 = browserShown || void 0;
2679
3441
  const t3 = statisticsShown || void 0;
2680
3442
  let t4;
@@ -2756,10 +3518,16 @@ function FittingWindow(t0) {
2756
3518
  $[14] = t9;
2757
3519
  } else t9 = $[14];
2758
3520
  let t10;
2759
- if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
2760
- t10 = /* @__PURE__ */ jsxs("div", {
3521
+ let t11;
3522
+ if ($[15] !== structure) {
3523
+ t10 = /* @__PURE__ */ jsx("div", {
2761
3524
  className: FittingWindow_module_default.bays,
2762
- children: [/* @__PURE__ */ jsx(Bay, {
3525
+ children: structure ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Bay, {
3526
+ bay: "cargo",
3527
+ icon: "ammo-hold",
3528
+ label: "Ammo Hold",
3529
+ unlimited: true
3530
+ }), /* @__PURE__ */ jsx(FighterBay, {})] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Bay, {
2763
3531
  bay: "cargo",
2764
3532
  icon: "cargo",
2765
3533
  label: "Cargo Hold"
@@ -2767,21 +3535,28 @@ function FittingWindow(t0) {
2767
3535
  bay: "droneBay",
2768
3536
  icon: "drone-bay",
2769
3537
  label: "Drone Bay"
2770
- })]
3538
+ })] })
2771
3539
  });
2772
- $[15] = t10;
2773
- } else t10 = $[15];
2774
- let t11;
2775
- if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
2776
- t11 = /* @__PURE__ */ jsx("div", {
3540
+ t11 = structure && /* @__PURE__ */ jsx(ServiceRack, {});
3541
+ $[15] = structure;
3542
+ $[16] = t10;
3543
+ $[17] = t11;
3544
+ } else {
3545
+ t10 = $[16];
3546
+ t11 = $[17];
3547
+ }
3548
+ let t12;
3549
+ if ($[18] !== structure) {
3550
+ t12 = /* @__PURE__ */ jsx("div", {
2777
3551
  className: FittingWindow_module_default.history,
2778
- children: /* @__PURE__ */ jsx(SimulationHistory, {})
3552
+ children: /* @__PURE__ */ jsx(SimulationHistory, { tooltipTitle: structure })
2779
3553
  });
2780
- $[16] = t11;
2781
- } else t11 = $[16];
2782
- let t12;
2783
- if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
2784
- t12 = /* @__PURE__ */ jsxs("div", {
3554
+ $[18] = structure;
3555
+ $[19] = t12;
3556
+ } else t12 = $[19];
3557
+ let t13;
3558
+ if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
3559
+ t13 = /* @__PURE__ */ jsxs("div", {
2785
3560
  className: FittingWindow_module_default.resources,
2786
3561
  children: [/* @__PURE__ */ jsx(Resource, {
2787
3562
  title: "CPU",
@@ -2793,11 +3568,11 @@ function FittingWindow(t0) {
2793
3568
  output: "powerOutput"
2794
3569
  })]
2795
3570
  });
2796
- $[17] = t12;
2797
- } else t12 = $[17];
2798
- let t13;
2799
- if ($[18] !== t8 || $[19] !== t9) {
2800
- t13 = /* @__PURE__ */ jsxs("div", {
3571
+ $[20] = t13;
3572
+ } else t13 = $[20];
3573
+ let t14;
3574
+ if ($[21] !== t10 || $[22] !== t11 || $[23] !== t12 || $[24] !== t8 || $[25] !== t9) {
3575
+ t14 = /* @__PURE__ */ jsxs("div", {
2801
3576
  className: FittingWindow_module_default.frame,
2802
3577
  children: [
2803
3578
  t5,
@@ -2807,16 +3582,20 @@ function FittingWindow(t0) {
2807
3582
  t9,
2808
3583
  t10,
2809
3584
  t11,
2810
- t12
3585
+ t12,
3586
+ t13
2811
3587
  ]
2812
3588
  });
2813
- $[18] = t8;
2814
- $[19] = t9;
2815
- $[20] = t13;
2816
- } else t13 = $[20];
2817
- let t14;
2818
- if ($[21] !== statistics || $[22] !== statisticsId || $[23] !== statisticsShown) {
2819
- t14 = statistics !== void 0 && /* @__PURE__ */ jsx("div", {
3589
+ $[21] = t10;
3590
+ $[22] = t11;
3591
+ $[23] = t12;
3592
+ $[24] = t8;
3593
+ $[25] = t9;
3594
+ $[26] = t14;
3595
+ } else t14 = $[26];
3596
+ let t15;
3597
+ if ($[27] !== statistics || $[28] !== statisticsId || $[29] !== statisticsShown) {
3598
+ t15 = statistics !== void 0 && /* @__PURE__ */ jsx("div", {
2820
3599
  id: statisticsId,
2821
3600
  className: FittingWindow_module_default.statistics,
2822
3601
  inert: !statisticsShown,
@@ -2825,33 +3604,33 @@ function FittingWindow(t0) {
2825
3604
  children: statistics
2826
3605
  })
2827
3606
  });
2828
- $[21] = statistics;
2829
- $[22] = statisticsId;
2830
- $[23] = statisticsShown;
2831
- $[24] = t14;
2832
- } else t14 = $[24];
2833
- let t15;
2834
- if ($[25] !== label || $[26] !== t13 || $[27] !== t14 || $[28] !== t2 || $[29] !== t3 || $[30] !== t4) {
2835
- t15 = /* @__PURE__ */ jsxs("section", {
3607
+ $[27] = statistics;
3608
+ $[28] = statisticsId;
3609
+ $[29] = statisticsShown;
3610
+ $[30] = t15;
3611
+ } else t15 = $[30];
3612
+ let t16;
3613
+ if ($[31] !== label || $[32] !== t14 || $[33] !== t15 || $[34] !== t2 || $[35] !== t3 || $[36] !== t4) {
3614
+ t16 = /* @__PURE__ */ jsxs("section", {
2836
3615
  className: FittingWindow_module_default.window,
2837
3616
  "aria-label": label,
2838
3617
  "data-browser": t2,
2839
3618
  "data-statistics": t3,
2840
3619
  children: [
2841
3620
  t4,
2842
- t13,
2843
- t14
3621
+ t14,
3622
+ t15
2844
3623
  ]
2845
3624
  });
2846
- $[25] = label;
2847
- $[26] = t13;
2848
- $[27] = t14;
2849
- $[28] = t2;
2850
- $[29] = t3;
2851
- $[30] = t4;
2852
- $[31] = t15;
2853
- } else t15 = $[31];
2854
- return t15;
3625
+ $[31] = label;
3626
+ $[32] = t14;
3627
+ $[33] = t15;
3628
+ $[34] = t2;
3629
+ $[35] = t3;
3630
+ $[36] = t4;
3631
+ $[37] = t16;
3632
+ } else t16 = $[37];
3633
+ return t16;
2855
3634
  }
2856
3635
  function FitName() {
2857
3636
  const $ = c(4);
@@ -2898,64 +3677,133 @@ function FitName() {
2898
3677
  const violationKinds = [
2899
3678
  {
2900
3679
  kind: "error",
2901
- label: "Fitting Errors"
3680
+ label: "Fitting Errors",
3681
+ title: "Fitting Alert"
2902
3682
  },
2903
3683
  {
2904
3684
  kind: "skill",
2905
- label: "Missing Skills"
3685
+ label: "Missing Skills",
3686
+ title: "Missing Skills"
2906
3687
  },
2907
3688
  {
2908
3689
  kind: "notice",
2909
- label: "Fitting Warnings"
3690
+ label: "Fitting Warnings",
3691
+ title: "Fitting Warning"
2910
3692
  }
2911
3693
  ];
2912
3694
  function Violations() {
2913
- const $ = c(7);
3695
+ const $ = c(17);
2914
3696
  const images = useImages();
2915
- const t0 = useViolations();
3697
+ const sde = useSde();
3698
+ const { fit, stats } = useShownSnapshot();
3699
+ let t0;
3700
+ if ($[0] !== stats.violations) {
3701
+ t0 = countViolations(stats.violations);
3702
+ $[0] = stats.violations;
3703
+ $[1] = t0;
3704
+ } else t0 = $[1];
3705
+ const counts = t0;
3706
+ const descriptionId = useId();
2916
3707
  let t1;
2917
- if ($[0] !== t0) {
2918
- t1 = countViolations(t0);
2919
- $[0] = t0;
2920
- $[1] = t1;
2921
- } else t1 = $[1];
2922
- const counts = t1;
2923
3708
  let t2;
2924
- if ($[2] !== counts || $[3] !== images) {
2925
- t2 = violationKinds.map((t3) => {
2926
- const { kind, label } = t3;
2927
- const shown = counts[kind];
3709
+ if ($[2] !== sde) {
3710
+ t1 = (id) => sde.type(id)?.name ?? `#${id}`;
3711
+ t2 = (id_0) => sde.group(id_0)?.name ?? `#${id_0}`;
3712
+ $[2] = sde;
3713
+ $[3] = t1;
3714
+ $[4] = t2;
3715
+ } else {
3716
+ t1 = $[3];
3717
+ t2 = $[4];
3718
+ }
3719
+ let t3;
3720
+ let t4;
3721
+ if ($[5] !== counts || $[6] !== descriptionId || $[7] !== fit || $[8] !== images || $[9] !== stats.violations || $[10] !== t1 || $[11] !== t2) {
3722
+ const names = {
3723
+ type: t1,
3724
+ group: t2
3725
+ };
3726
+ const linesOf = (kind) => {
3727
+ const violations = kind === "skill" ? missingSkills(stats.violations).map(_temp$4) : stats.violations.filter((t5) => {
3728
+ const { rule: rule_0 } = t5;
3729
+ return violationKind(rule_0) === kind;
3730
+ });
3731
+ return [...new Set(violations.map((violation) => violationText(violation, fit, names)))];
3732
+ };
3733
+ t3 = FittingWindow_module_default.violations;
3734
+ t4 = violationKinds.map((t6) => {
3735
+ const { kind: kind_0, label, title } = t6;
3736
+ const shown = counts[kind_0];
2928
3737
  if (shown === 0) return null;
2929
- const texture = images.uiTexture(kind === "skill" ? "classes/fitting/warningskills" : "classes/fitting/warninggroup");
3738
+ const lines = linesOf(kind_0);
3739
+ const textureStyle = { "--texture": `url(${images.uiTexture(kind_0 === "skill" ? "classes/fitting/warningskills" : "classes/fitting/warninggroup")})` };
2930
3740
  return /* @__PURE__ */ jsx(Tooltip, {
2931
- label: `${label}: ${shown}`,
2932
- children: /* @__PURE__ */ jsx("span", {
3741
+ label: /* @__PURE__ */ jsx("span", {
3742
+ className: FittingWindow_module_default.alert,
3743
+ "data-kind": kind_0,
3744
+ style: textureStyle,
3745
+ children: /* @__PURE__ */ jsx(TooltipText, {
3746
+ title: /* @__PURE__ */ jsx("span", {
3747
+ className: FittingWindow_module_default.alertTitle,
3748
+ children: title
3749
+ }),
3750
+ description: lines.map(_temp2$2)
3751
+ })
3752
+ }),
3753
+ children: /* @__PURE__ */ jsxs("span", {
2933
3754
  className: FittingWindow_module_default.violation,
2934
3755
  role: "img",
2935
3756
  "aria-label": `${label}: ${shown}`,
2936
- "data-kind": kind,
2937
- style: { "--texture": `url(${texture})` },
2938
- children: /* @__PURE__ */ jsx("span", {
3757
+ "aria-describedby": `${descriptionId}-${kind_0}`,
3758
+ "data-kind": kind_0,
3759
+ style: textureStyle,
3760
+ children: [/* @__PURE__ */ jsx("span", {
2939
3761
  className: FittingWindow_module_default.count,
2940
3762
  children: shown
2941
- })
3763
+ }), /* @__PURE__ */ jsx("span", {
3764
+ id: `${descriptionId}-${kind_0}`,
3765
+ hidden: true,
3766
+ children: lines.join(", ")
3767
+ })]
2942
3768
  })
2943
- }, kind);
2944
- });
2945
- $[2] = counts;
2946
- $[3] = images;
2947
- $[4] = t2;
2948
- } else t2 = $[4];
2949
- let t3;
2950
- if ($[5] !== t2) {
2951
- t3 = /* @__PURE__ */ jsx("div", {
2952
- className: FittingWindow_module_default.violations,
2953
- children: t2
3769
+ }, kind_0);
3770
+ });
3771
+ $[5] = counts;
3772
+ $[6] = descriptionId;
3773
+ $[7] = fit;
3774
+ $[8] = images;
3775
+ $[9] = stats.violations;
3776
+ $[10] = t1;
3777
+ $[11] = t2;
3778
+ $[12] = t3;
3779
+ $[13] = t4;
3780
+ } else {
3781
+ t3 = $[12];
3782
+ t4 = $[13];
3783
+ }
3784
+ let t5;
3785
+ if ($[14] !== t3 || $[15] !== t4) {
3786
+ t5 = /* @__PURE__ */ jsx("div", {
3787
+ className: t3,
3788
+ children: t4
2954
3789
  });
2955
- $[5] = t2;
2956
- $[6] = t3;
2957
- } else t3 = $[6];
2958
- return t3;
3790
+ $[14] = t3;
3791
+ $[15] = t4;
3792
+ $[16] = t5;
3793
+ } else t5 = $[16];
3794
+ return t5;
3795
+ }
3796
+ function _temp2$2(line) {
3797
+ return /* @__PURE__ */ jsx("span", {
3798
+ className: FittingWindow_module_default.alertLine,
3799
+ children: line
3800
+ }, line);
3801
+ }
3802
+ function _temp$4(rule) {
3803
+ return {
3804
+ target: { type: "ship" },
3805
+ rule
3806
+ };
2959
3807
  }
2960
3808
  function NotImplementedButton(t0) {
2961
3809
  const $ = c(9);
@@ -2994,178 +3842,440 @@ function NotImplementedButton(t0) {
2994
3842
  return t4;
2995
3843
  }
2996
3844
  function Bay(t0) {
2997
- const $ = c(21);
2998
- const { bay, icon, label } = t0;
3845
+ const $ = c(24);
3846
+ const { bay, icon, label, unlimited: t1 } = t0;
3847
+ const unlimited = t1 === void 0 ? false : t1;
2999
3848
  const { used, total } = useBayUsage(bay);
3000
- const t1 = used > total || void 0;
3849
+ const id = useId();
3850
+ const drop = useBayDrop(bay);
3001
3851
  let t2;
3002
- if ($[0] !== icon) {
3003
- t2 = /* @__PURE__ */ jsx(Icon, { name: icon });
3004
- $[0] = icon;
3852
+ if ($[0] !== id) {
3853
+ let t3;
3854
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
3855
+ t3 = /[^\w-]/g;
3856
+ $[2] = t3;
3857
+ } else t3 = $[2];
3858
+ t2 = id.replace(t3, "");
3859
+ $[0] = id;
3005
3860
  $[1] = t2;
3006
3861
  } else t2 = $[1];
3007
- let t3;
3008
- if ($[2] !== used) {
3009
- t3 = oneDecimal.format(used);
3010
- $[2] = used;
3011
- $[3] = t3;
3012
- } else t3 = $[3];
3862
+ const t3 = `--bay-${t2}`;
3013
3863
  let t4;
3014
- if ($[4] !== t3) {
3015
- t4 = /* @__PURE__ */ jsx("span", {
3864
+ if ($[3] !== t3) {
3865
+ t4 = { "--bay-anchor": t3 };
3866
+ $[3] = t3;
3867
+ $[4] = t4;
3868
+ } else t4 = $[4];
3869
+ const t5 = t4;
3870
+ const t6 = !unlimited && used > total || void 0;
3871
+ let t7;
3872
+ if ($[5] !== drop || $[6] !== icon || $[7] !== id || $[8] !== label || $[9] !== t6 || $[10] !== total || $[11] !== used) {
3873
+ t7 = /* @__PURE__ */ jsx(BayButton, {
3874
+ icon,
3875
+ used,
3876
+ total,
3877
+ "aria-label": label,
3878
+ popoverTarget: id,
3879
+ "data-over": t6,
3880
+ ...drop
3881
+ });
3882
+ $[5] = drop;
3883
+ $[6] = icon;
3884
+ $[7] = id;
3885
+ $[8] = label;
3886
+ $[9] = t6;
3887
+ $[10] = total;
3888
+ $[11] = used;
3889
+ $[12] = t7;
3890
+ } else t7 = $[12];
3891
+ let t8;
3892
+ if ($[13] !== label || $[14] !== t7) {
3893
+ t8 = /* @__PURE__ */ jsx(Tooltip, {
3894
+ label,
3895
+ children: t7
3896
+ });
3897
+ $[13] = label;
3898
+ $[14] = t7;
3899
+ $[15] = t8;
3900
+ } else t8 = $[15];
3901
+ let t9;
3902
+ if ($[16] !== bay || $[17] !== id || $[18] !== label) {
3903
+ t9 = /* @__PURE__ */ jsx(BayContents, {
3904
+ id,
3905
+ bay,
3906
+ label
3907
+ });
3908
+ $[16] = bay;
3909
+ $[17] = id;
3910
+ $[18] = label;
3911
+ $[19] = t9;
3912
+ } else t9 = $[19];
3913
+ let t10;
3914
+ if ($[20] !== t5 || $[21] !== t8 || $[22] !== t9) {
3915
+ t10 = /* @__PURE__ */ jsxs("div", {
3916
+ className: FittingWindow_module_default.bayAnchor,
3917
+ style: t5,
3918
+ children: [t8, t9]
3919
+ });
3920
+ $[20] = t5;
3921
+ $[21] = t8;
3922
+ $[22] = t9;
3923
+ $[23] = t10;
3924
+ } else t10 = $[23];
3925
+ return t10;
3926
+ }
3927
+ function FighterBay() {
3928
+ const $ = c(4);
3929
+ const { used, total } = useBayUsage("fighterBay");
3930
+ const t0 = used > total || void 0;
3931
+ let t1;
3932
+ if ($[0] !== t0 || $[1] !== total || $[2] !== used) {
3933
+ t1 = /* @__PURE__ */ jsx(Tooltip, {
3934
+ label: "Fighter Bay (not implemented yet)",
3935
+ children: /* @__PURE__ */ jsx(BayButton, {
3936
+ icon: "drone-bay",
3937
+ used,
3938
+ total,
3939
+ "aria-label": "Fighter Bay",
3940
+ "aria-disabled": true,
3941
+ "data-over": t0
3942
+ })
3943
+ });
3944
+ $[0] = t0;
3945
+ $[1] = total;
3946
+ $[2] = used;
3947
+ $[3] = t1;
3948
+ } else t1 = $[3];
3949
+ return t1;
3950
+ }
3951
+ function BayButton(t0) {
3952
+ const $ = c(22);
3953
+ let icon;
3954
+ let props;
3955
+ let total;
3956
+ let used;
3957
+ if ($[0] !== t0) {
3958
+ ({icon, used, total, ...props} = t0);
3959
+ $[0] = t0;
3960
+ $[1] = icon;
3961
+ $[2] = props;
3962
+ $[3] = total;
3963
+ $[4] = used;
3964
+ } else {
3965
+ icon = $[1];
3966
+ props = $[2];
3967
+ total = $[3];
3968
+ used = $[4];
3969
+ }
3970
+ let t1;
3971
+ if ($[5] !== icon) {
3972
+ t1 = /* @__PURE__ */ jsx(Icon, { name: icon });
3973
+ $[5] = icon;
3974
+ $[6] = t1;
3975
+ } else t1 = $[6];
3976
+ let t2;
3977
+ if ($[7] !== used) {
3978
+ t2 = oneDecimal.format(used);
3979
+ $[7] = used;
3980
+ $[8] = t2;
3981
+ } else t2 = $[8];
3982
+ let t3;
3983
+ if ($[9] !== t2) {
3984
+ t3 = /* @__PURE__ */ jsx("span", {
3016
3985
  className: FittingWindow_module_default.used,
3017
- children: t3
3986
+ children: t2
3018
3987
  });
3019
- $[4] = t3;
3020
- $[5] = t4;
3021
- } else t4 = $[5];
3022
- let t5;
3023
- if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
3024
- t5 = /* @__PURE__ */ jsx("span", {
3988
+ $[9] = t2;
3989
+ $[10] = t3;
3990
+ } else t3 = $[10];
3991
+ let t4;
3992
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
3993
+ t4 = /* @__PURE__ */ jsx("span", {
3025
3994
  className: FittingWindow_module_default.slash,
3026
3995
  children: "/"
3027
3996
  });
3028
- $[6] = t5;
3029
- } else t5 = $[6];
3997
+ $[11] = t4;
3998
+ } else t4 = $[11];
3999
+ let t5;
4000
+ if ($[12] !== total) {
4001
+ t5 = oneDecimal.format(total);
4002
+ $[12] = total;
4003
+ $[13] = t5;
4004
+ } else t5 = $[13];
3030
4005
  let t6;
3031
- if ($[7] !== total) {
3032
- t6 = oneDecimal.format(total);
3033
- $[7] = total;
3034
- $[8] = t6;
3035
- } else t6 = $[8];
3036
- let t7;
3037
- if ($[9] !== t6) {
3038
- t7 = /* @__PURE__ */ jsx("span", {
4006
+ if ($[14] !== t5) {
4007
+ t6 = /* @__PURE__ */ jsx("span", {
3039
4008
  className: FittingWindow_module_default.total,
3040
- children: t6
4009
+ children: t5
3041
4010
  });
3042
- $[9] = t6;
3043
- $[10] = t7;
3044
- } else t7 = $[10];
3045
- let t8;
3046
- if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
3047
- t8 = /* @__PURE__ */ jsx("span", {
4011
+ $[14] = t5;
4012
+ $[15] = t6;
4013
+ } else t6 = $[15];
4014
+ let t7;
4015
+ if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
4016
+ t7 = /* @__PURE__ */ jsx("span", {
3048
4017
  className: FittingWindow_module_default.unit,
3049
4018
  children: "m3"
3050
4019
  });
3051
- $[11] = t8;
3052
- } else t8 = $[11];
3053
- let t9;
3054
- if ($[12] !== label || $[13] !== t1 || $[14] !== t2 || $[15] !== t4 || $[16] !== t7) {
3055
- t9 = /* @__PURE__ */ jsxs("div", {
4020
+ $[16] = t7;
4021
+ } else t7 = $[16];
4022
+ let t8;
4023
+ if ($[17] !== props || $[18] !== t1 || $[19] !== t3 || $[20] !== t6) {
4024
+ t8 = /* @__PURE__ */ jsxs("button", {
4025
+ type: "button",
3056
4026
  className: FittingWindow_module_default.bay,
3057
- role: "group",
3058
- "aria-label": label,
3059
- "data-over": t1,
4027
+ ...props,
3060
4028
  children: [
3061
- t2,
4029
+ t1,
4030
+ t3,
3062
4031
  t4,
3063
- t5,
3064
- t7,
3065
- t8
4032
+ t6,
4033
+ t7
3066
4034
  ]
3067
4035
  });
3068
- $[12] = label;
3069
- $[13] = t1;
3070
- $[14] = t2;
3071
- $[15] = t4;
3072
- $[16] = t7;
3073
- $[17] = t9;
3074
- } else t9 = $[17];
3075
- let t10;
3076
- if ($[18] !== label || $[19] !== t9) {
3077
- t10 = /* @__PURE__ */ jsx(Tooltip, {
3078
- label,
3079
- children: t9
3080
- });
3081
- $[18] = label;
3082
- $[19] = t9;
3083
- $[20] = t10;
3084
- } else t10 = $[20];
3085
- return t10;
4036
+ $[17] = props;
4037
+ $[18] = t1;
4038
+ $[19] = t3;
4039
+ $[20] = t6;
4040
+ $[21] = t8;
4041
+ } else t8 = $[21];
4042
+ return t8;
4043
+ }
4044
+ const baySlots = {
4045
+ cargo: { type: "cargo" },
4046
+ droneBay: { type: "drone_bay" }
4047
+ };
4048
+ /** Puts a type dragged onto a bay in it: anything in the cargo, drones in the drone bay. */
4049
+ function useBayDrop(bay) {
4050
+ const $ = c(29);
4051
+ const store = useFitStore();
4052
+ const sde = useSde();
4053
+ const placement = usePlacement();
4054
+ const canFit = useCanFit();
4055
+ const { dragging, end } = useDrag();
4056
+ const { show, clear } = usePreview();
4057
+ const slot = baySlots[bay];
4058
+ let t0;
4059
+ let type;
4060
+ if ($[0] !== bay || $[1] !== canFit || $[2] !== dragging || $[3] !== placement || $[4] !== sde) {
4061
+ type = dragging?.type === "type" ? sde.type(dragging.typeId) : void 0;
4062
+ t0 = type !== void 0 && (bay === "cargo" ? placement(type) !== void 0 : placement(type)?.type === "drone_bay" && canFit(type));
4063
+ $[0] = bay;
4064
+ $[1] = canFit;
4065
+ $[2] = dragging;
4066
+ $[3] = placement;
4067
+ $[4] = sde;
4068
+ $[5] = t0;
4069
+ $[6] = type;
4070
+ } else {
4071
+ t0 = $[5];
4072
+ type = $[6];
4073
+ }
4074
+ const taken = t0 ? type : void 0;
4075
+ const target = `bay-${bay}`;
4076
+ let t1;
4077
+ if ($[7] !== show || $[8] !== slot || $[9] !== taken || $[10] !== target) {
4078
+ t1 = () => {
4079
+ if (taken) show((draft) => void draft.fit(taken.id, slot), target);
4080
+ };
4081
+ $[7] = show;
4082
+ $[8] = slot;
4083
+ $[9] = taken;
4084
+ $[10] = target;
4085
+ $[11] = t1;
4086
+ } else t1 = $[11];
4087
+ let t2;
4088
+ if ($[12] !== clear || $[13] !== target) {
4089
+ t2 = () => clear(target);
4090
+ $[12] = clear;
4091
+ $[13] = target;
4092
+ $[14] = t2;
4093
+ } else t2 = $[14];
4094
+ let t3;
4095
+ if ($[15] !== taken) {
4096
+ t3 = (event) => {
4097
+ if (!taken) return;
4098
+ event.preventDefault();
4099
+ event.dataTransfer.dropEffect = "copy";
4100
+ };
4101
+ $[15] = taken;
4102
+ $[16] = t3;
4103
+ } else t3 = $[16];
4104
+ let t4;
4105
+ if ($[17] !== clear || $[18] !== end || $[19] !== slot || $[20] !== store || $[21] !== taken || $[22] !== target) {
4106
+ t4 = (event_0) => {
4107
+ if (!taken) return;
4108
+ event_0.preventDefault();
4109
+ clear(target);
4110
+ store.fit(taken.id, slot);
4111
+ end();
4112
+ };
4113
+ $[17] = clear;
4114
+ $[18] = end;
4115
+ $[19] = slot;
4116
+ $[20] = store;
4117
+ $[21] = taken;
4118
+ $[22] = target;
4119
+ $[23] = t4;
4120
+ } else t4 = $[23];
4121
+ let t5;
4122
+ if ($[24] !== t1 || $[25] !== t2 || $[26] !== t3 || $[27] !== t4) {
4123
+ t5 = {
4124
+ onDragEnter: t1,
4125
+ onDragLeave: t2,
4126
+ onDragOver: t3,
4127
+ onDrop: t4
4128
+ };
4129
+ $[24] = t1;
4130
+ $[25] = t2;
4131
+ $[26] = t3;
4132
+ $[27] = t4;
4133
+ $[28] = t5;
4134
+ } else t5 = $[28];
4135
+ return t5;
3086
4136
  }
3087
4137
  function Resource(t0) {
3088
- const $ = c(16);
4138
+ const $ = c(21);
3089
4139
  const { title, free, output } = t0;
3090
4140
  const left = useAttribute(free);
3091
4141
  const total = useAttribute(output).value ?? 0;
3092
4142
  const value = left.value ?? 0;
3093
- const t1 = value < 0 || void 0;
3094
- const t2 = left.change;
3095
- let t3;
3096
- if ($[0] !== title) {
3097
- t3 = /* @__PURE__ */ jsx("span", {
4143
+ let t1;
4144
+ if ($[0] !== output) {
4145
+ t1 = /* @__PURE__ */ jsx(AttributeTooltip, { attribute: output });
4146
+ $[0] = output;
4147
+ $[1] = t1;
4148
+ } else t1 = $[1];
4149
+ const t2 = value < 0 || void 0;
4150
+ const t3 = left.change;
4151
+ let t4;
4152
+ if ($[2] !== title) {
4153
+ t4 = /* @__PURE__ */ jsx("span", {
3098
4154
  className: FittingWindow_module_default.title,
3099
4155
  children: title
3100
4156
  });
3101
- $[0] = title;
3102
- $[1] = t3;
3103
- } else t3 = $[1];
3104
- let t4;
3105
- if ($[2] !== value) {
3106
- t4 = oneDecimal.format(value);
3107
- $[2] = value;
4157
+ $[2] = title;
3108
4158
  $[3] = t4;
3109
4159
  } else t4 = $[3];
3110
4160
  let t5;
3111
- if ($[4] !== t4) {
3112
- t5 = /* @__PURE__ */ jsx("span", {
3113
- className: FittingWindow_module_default.free,
3114
- children: t4
3115
- });
3116
- $[4] = t4;
4161
+ if ($[4] !== value) {
4162
+ t5 = oneDecimal.format(value);
4163
+ $[4] = value;
3117
4164
  $[5] = t5;
3118
4165
  } else t5 = $[5];
3119
4166
  let t6;
3120
- if ($[6] !== total) {
3121
- t6 = oneDecimal.format(total);
3122
- $[6] = total;
4167
+ if ($[6] !== t5) {
4168
+ t6 = /* @__PURE__ */ jsx("span", {
4169
+ className: FittingWindow_module_default.free,
4170
+ children: t5
4171
+ });
4172
+ $[6] = t5;
3123
4173
  $[7] = t6;
3124
4174
  } else t6 = $[7];
3125
4175
  let t7;
3126
- if ($[8] !== t5 || $[9] !== t6) {
3127
- t7 = /* @__PURE__ */ jsxs("span", { children: [
3128
- t5,
4176
+ if ($[8] !== total) {
4177
+ t7 = oneDecimal.format(total);
4178
+ $[8] = total;
4179
+ $[9] = t7;
4180
+ } else t7 = $[9];
4181
+ let t8;
4182
+ if ($[10] !== t6 || $[11] !== t7) {
4183
+ t8 = /* @__PURE__ */ jsxs("span", { children: [
4184
+ t6,
3129
4185
  "/",
3130
- t6
4186
+ t7
3131
4187
  ] });
3132
- $[8] = t5;
3133
- $[9] = t6;
3134
- $[10] = t7;
3135
- } else t7 = $[10];
3136
- let t8;
3137
- if ($[11] !== left.change || $[12] !== t1 || $[13] !== t3 || $[14] !== t7) {
3138
- t8 = /* @__PURE__ */ jsxs("div", {
4188
+ $[10] = t6;
4189
+ $[11] = t7;
4190
+ $[12] = t8;
4191
+ } else t8 = $[12];
4192
+ let t9;
4193
+ if ($[13] !== left.change || $[14] !== t2 || $[15] !== t4 || $[16] !== t8) {
4194
+ t9 = /* @__PURE__ */ jsxs("div", {
3139
4195
  className: FittingWindow_module_default.resource,
3140
- "data-over": t1,
3141
- "data-change": t2,
3142
- children: [t3, t7]
4196
+ "data-over": t2,
4197
+ "data-change": t3,
4198
+ children: [t4, t8]
3143
4199
  });
3144
- $[11] = left.change;
3145
- $[12] = t1;
3146
- $[13] = t3;
3147
- $[14] = t7;
3148
- $[15] = t8;
3149
- } else t8 = $[15];
3150
- return t8;
4200
+ $[13] = left.change;
4201
+ $[14] = t2;
4202
+ $[15] = t4;
4203
+ $[16] = t8;
4204
+ $[17] = t9;
4205
+ } else t9 = $[17];
4206
+ let t10;
4207
+ if ($[18] !== t1 || $[19] !== t9) {
4208
+ t10 = /* @__PURE__ */ jsx(Tooltip, {
4209
+ label: t1,
4210
+ children: t9
4211
+ });
4212
+ $[18] = t1;
4213
+ $[19] = t9;
4214
+ $[20] = t10;
4215
+ } else t10 = $[20];
4216
+ return t10;
4217
+ }
4218
+ function ServiceRack() {
4219
+ const $ = c(3);
4220
+ const slots = useSlots("service");
4221
+ const { total } = useRackUsage("service");
4222
+ let t0;
4223
+ if ($[0] !== slots || $[1] !== total) {
4224
+ t0 = /* @__PURE__ */ jsx("div", {
4225
+ className: FittingWindow_module_default.services,
4226
+ role: "group",
4227
+ "aria-label": "Structure Services",
4228
+ children: Array.from({ length: SERVICE_SLOTS }, (_, index) => /* @__PURE__ */ jsx(FittingServiceSlot, {
4229
+ index,
4230
+ available: index < total,
4231
+ content: slots[index]
4232
+ }, index))
4233
+ });
4234
+ $[0] = slots;
4235
+ $[1] = total;
4236
+ $[2] = t0;
4237
+ } else t0 = $[2];
4238
+ return t0;
3151
4239
  }
3152
- function SimulationHistory() {
4240
+ function FittingServiceSlot(t0) {
3153
4241
  const $ = c(4);
4242
+ const { index, available, content } = t0;
4243
+ const t1 = useFittingSlot("service", index, content, available);
4244
+ let slot;
4245
+ if ($[0] !== t1) {
4246
+ const { chargeTypeId, chargeable, activatable, onRemoveCharge, ...t2 } = t1;
4247
+ slot = t2;
4248
+ $[0] = t1;
4249
+ $[1] = slot;
4250
+ } else slot = $[1];
4251
+ let t2;
4252
+ if ($[2] !== slot) {
4253
+ t2 = /* @__PURE__ */ jsx(ServiceSlot, { ...slot });
4254
+ $[2] = slot;
4255
+ $[3] = t2;
4256
+ } else t2 = $[3];
4257
+ return t2;
4258
+ }
4259
+ function SimulationHistory(t0) {
4260
+ const $ = c(5);
4261
+ const { tooltipTitle } = t0;
3154
4262
  const history = useFitHistory();
3155
- let t0;
3156
- if ($[0] !== history.goTo || $[1] !== history.length || $[2] !== history.position) {
3157
- t0 = /* @__PURE__ */ jsx(HistoryBar, {
4263
+ let t1;
4264
+ if ($[0] !== history.goTo || $[1] !== history.length || $[2] !== history.position || $[3] !== tooltipTitle) {
4265
+ t1 = /* @__PURE__ */ jsx(HistoryBar, {
3158
4266
  label: "Simulation History",
3159
4267
  length: history.length,
3160
4268
  position: history.position,
3161
- onGoTo: history.goTo
4269
+ onGoTo: history.goTo,
4270
+ tooltipTitle
3162
4271
  });
3163
4272
  $[0] = history.goTo;
3164
4273
  $[1] = history.length;
3165
4274
  $[2] = history.position;
3166
- $[3] = t0;
3167
- } else t0 = $[3];
3168
- return t0;
4275
+ $[3] = tooltipTitle;
4276
+ $[4] = t1;
4277
+ } else t1 = $[4];
4278
+ return t1;
3169
4279
  }
3170
4280
  //#endregion
3171
4281
  //#region src/components/ItemBrowser/ItemBrowser.module.css
@@ -3175,6 +4285,7 @@ var ItemBrowser_module_default = {
3175
4285
  "count": "xFSZwa_count",
3176
4286
  "counts": "xFSZwa_counts",
3177
4287
  "dragImage": "xFSZwa_dragImage",
4288
+ "empty": "xFSZwa_empty",
3178
4289
  "field": "xFSZwa_field",
3179
4290
  "filters": "xFSZwa_filters",
3180
4291
  "flyable": "xFSZwa_flyable",
@@ -3438,8 +4549,8 @@ function TypeLeaf(t0) {
3438
4549
  }
3439
4550
  /** The types, then their faction, officer and deadspace folders. */
3440
4551
  function TypeLeaves(t0) {
3441
- const $ = c(21);
3442
- const { sorted, open, actions, icon } = t0;
4552
+ const $ = c(19);
4553
+ const { sorted, actions, icon } = t0;
3443
4554
  const images = useImages();
3444
4555
  let t1;
3445
4556
  if ($[0] !== actions || $[1] !== icon || $[2] !== sorted.types) {
@@ -3461,15 +4572,14 @@ function TypeLeaves(t0) {
3461
4572
  $[3] = t1;
3462
4573
  } else t1 = $[3];
3463
4574
  let t2;
3464
- if ($[7] !== actions || $[8] !== icon || $[9] !== images || $[10] !== open || $[11] !== sorted.folders) {
4575
+ if ($[7] !== actions || $[8] !== icon || $[9] !== images || $[10] !== sorted.folders) {
3465
4576
  let t3;
3466
- if ($[13] !== actions || $[14] !== icon || $[15] !== images || $[16] !== open) {
4577
+ if ($[12] !== actions || $[13] !== icon || $[14] !== images) {
3467
4578
  t3 = (t4) => {
3468
4579
  const { folder, types } = t4;
3469
4580
  return /* @__PURE__ */ jsx(TreeGroup, {
3470
4581
  label: folders[folder].label,
3471
4582
  icon: images.metaGroupIcon(folders[folder].metaGroupId),
3472
- defaultOpen: open,
3473
4583
  children: () => types.map((type_0) => /* @__PURE__ */ jsx(TypeLeaf, {
3474
4584
  type: type_0,
3475
4585
  actions,
@@ -3477,222 +4587,301 @@ function TypeLeaves(t0) {
3477
4587
  }, type_0.id))
3478
4588
  }, folder);
3479
4589
  };
3480
- $[13] = actions;
3481
- $[14] = icon;
3482
- $[15] = images;
3483
- $[16] = open;
3484
- $[17] = t3;
3485
- } else t3 = $[17];
4590
+ $[12] = actions;
4591
+ $[13] = icon;
4592
+ $[14] = images;
4593
+ $[15] = t3;
4594
+ } else t3 = $[15];
3486
4595
  t2 = sorted.folders.map(t3);
3487
4596
  $[7] = actions;
3488
4597
  $[8] = icon;
3489
4598
  $[9] = images;
3490
- $[10] = open;
3491
- $[11] = sorted.folders;
3492
- $[12] = t2;
3493
- } else t2 = $[12];
4599
+ $[10] = sorted.folders;
4600
+ $[11] = t2;
4601
+ } else t2 = $[11];
3494
4602
  let t3;
3495
- if ($[18] !== t1 || $[19] !== t2) {
4603
+ if ($[16] !== t1 || $[17] !== t2) {
3496
4604
  t3 = /* @__PURE__ */ jsxs(Fragment, { children: [t1, t2] });
3497
- $[18] = t1;
3498
- $[19] = t2;
3499
- $[20] = t3;
3500
- } else t3 = $[20];
4605
+ $[16] = t1;
4606
+ $[17] = t2;
4607
+ $[18] = t3;
4608
+ } else t3 = $[18];
3501
4609
  return t3;
3502
4610
  }
3503
4611
  function countLeaves(sorted) {
3504
4612
  return sorted.folders.reduce((count, folder) => count + folder.types.length, sorted.types.length);
3505
4613
  }
4614
+ /** A market group's icon, or a folder for one without. */
4615
+ function useMarketGroupIcon() {
4616
+ const $ = c(3);
4617
+ const images = useImages();
4618
+ const folder = useIconUrl("folder");
4619
+ let t0;
4620
+ if ($[0] !== folder || $[1] !== images) {
4621
+ t0 = (marketGroupId) => images.marketGroupIcon(marketGroupId) ?? folder;
4622
+ $[0] = folder;
4623
+ $[1] = images;
4624
+ $[2] = t0;
4625
+ } else t0 = $[2];
4626
+ return t0;
4627
+ }
4628
+ /** A market group: its groups, then its types. */
4629
+ function TypeGroup(t0) {
4630
+ const $ = c(10);
4631
+ const { node, actions } = t0;
4632
+ const marketGroupIcon = useMarketGroupIcon();
4633
+ const t1 = node.group.name;
4634
+ let t2;
4635
+ if ($[0] !== marketGroupIcon || $[1] !== node.group.id) {
4636
+ t2 = marketGroupIcon(node.group.id);
4637
+ $[0] = marketGroupIcon;
4638
+ $[1] = node.group.id;
4639
+ $[2] = t2;
4640
+ } else t2 = $[2];
4641
+ let t3;
4642
+ if ($[3] !== actions || $[4] !== node) {
4643
+ t3 = () => /* @__PURE__ */ jsxs(Fragment, { children: [node.children.map((child) => /* @__PURE__ */ jsx(TypeGroup, {
4644
+ node: child,
4645
+ actions
4646
+ }, child.group.id)), /* @__PURE__ */ jsx(TypeLeaves, {
4647
+ sorted: node,
4648
+ actions
4649
+ })] });
4650
+ $[3] = actions;
4651
+ $[4] = node;
4652
+ $[5] = t3;
4653
+ } else t3 = $[5];
4654
+ let t4;
4655
+ if ($[6] !== node.group.name || $[7] !== t2 || $[8] !== t3) {
4656
+ t4 = /* @__PURE__ */ jsx(TreeGroup, {
4657
+ label: t1,
4658
+ icon: t2,
4659
+ children: t3
4660
+ });
4661
+ $[6] = node.group.name;
4662
+ $[7] = t2;
4663
+ $[8] = t3;
4664
+ $[9] = t4;
4665
+ } else t4 = $[9];
4666
+ return t4;
4667
+ }
4668
+ /** Search results by root market group; a lone root shows only its types. */
4669
+ function SearchResults(t0) {
4670
+ const $ = c(8);
4671
+ const { roots, actions } = t0;
4672
+ const [only] = roots;
4673
+ if (roots.length === 1 && only !== void 0) {
4674
+ let t1;
4675
+ if ($[0] !== actions || $[1] !== only) {
4676
+ t1 = /* @__PURE__ */ jsx(TypeLeaves, {
4677
+ sorted: only,
4678
+ actions
4679
+ });
4680
+ $[0] = actions;
4681
+ $[1] = only;
4682
+ $[2] = t1;
4683
+ } else t1 = $[2];
4684
+ return t1;
4685
+ }
4686
+ let t1;
4687
+ if ($[3] !== actions || $[4] !== roots) {
4688
+ let t2;
4689
+ if ($[6] !== actions) {
4690
+ t2 = (node) => /* @__PURE__ */ jsx(TypeGroup, {
4691
+ node,
4692
+ actions
4693
+ }, node.group.id);
4694
+ $[6] = actions;
4695
+ $[7] = t2;
4696
+ } else t2 = $[7];
4697
+ t1 = roots.map(t2);
4698
+ $[3] = actions;
4699
+ $[4] = roots;
4700
+ $[5] = t1;
4701
+ } else t1 = $[5];
4702
+ return t1;
4703
+ }
3506
4704
  //#endregion
3507
4705
  //#region src/components/ItemBrowser/Charges.tsx
3508
4706
  /** The Charges tab of the `ItemBrowser`: every charge by market group, or only those a fitted module loads. */
3509
4707
  function Charges() {
3510
- const $ = c(49);
4708
+ const $ = c(48);
3511
4709
  const sde = useSde();
3512
4710
  const { actions, clear, dragImage } = useTypeActions();
3513
4711
  const modules = useChargedModules();
3514
4712
  const [picked, setPicked] = useState();
3515
4713
  const [search, setSearch] = useState("");
4714
+ const [collapses, setCollapses] = useState(0);
3516
4715
  let t0;
3517
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
3518
- t0 = { times: 0 };
3519
- $[0] = t0;
3520
- } else t0 = $[0];
3521
- const [collapsed, setCollapsed] = useState(t0);
4716
+ if ($[0] !== modules || $[1] !== picked) {
4717
+ t0 = modules.some((module) => module.id === picked) ? picked : void 0;
4718
+ $[0] = modules;
4719
+ $[1] = picked;
4720
+ $[2] = t0;
4721
+ } else t0 = $[2];
4722
+ const selected = t0;
3522
4723
  let t1;
3523
- if ($[1] !== modules || $[2] !== picked) {
3524
- t1 = modules.some((module) => module.id === picked) ? picked : void 0;
3525
- $[1] = modules;
3526
- $[2] = picked;
3527
- $[3] = t1;
3528
- } else t1 = $[3];
3529
- const selected = t1;
4724
+ if ($[3] !== search) {
4725
+ t1 = search.trim().toLowerCase();
4726
+ $[3] = search;
4727
+ $[4] = t1;
4728
+ } else t1 = $[4];
4729
+ const query = t1;
3530
4730
  let t2;
3531
- if ($[4] !== search) {
3532
- t2 = search.trim().toLowerCase();
3533
- $[4] = search;
3534
- $[5] = t2;
3535
- } else t2 = $[5];
3536
- const query = t2;
3537
- let t3;
3538
- if ($[6] !== query || $[7] !== selected) {
3539
- t3 = selected === void 0 && query !== "" ? (type) => type.name.toLowerCase().includes(query) : void 0;
3540
- $[6] = query;
3541
- $[7] = selected;
3542
- $[8] = t3;
3543
- } else t3 = $[8];
3544
- const groups = useChargeTree(t3);
4731
+ if ($[5] !== query || $[6] !== selected) {
4732
+ t2 = selected === void 0 && query !== "" ? (type) => type.name.toLowerCase().includes(query) : void 0;
4733
+ $[5] = query;
4734
+ $[6] = selected;
4735
+ $[7] = t2;
4736
+ } else t2 = $[7];
4737
+ const matches = t2;
4738
+ const groups = useChargeTree();
4739
+ const found = useChargeSearch(matches);
3545
4740
  const charges = useCharges(selected);
4741
+ let t3;
4742
+ if ($[8] !== charges || $[9] !== query || $[10] !== sde) {
4743
+ let t4;
4744
+ if ($[12] !== query) {
4745
+ t4 = (type_0) => type_0.name.toLowerCase().includes(query);
4746
+ $[12] = query;
4747
+ $[13] = t4;
4748
+ } else t4 = $[13];
4749
+ t3 = sde.sortByMeta(charges.filter(t4));
4750
+ $[8] = charges;
4751
+ $[9] = query;
4752
+ $[10] = sde;
4753
+ $[11] = t3;
4754
+ } else t3 = $[11];
4755
+ const loadable = t3;
3546
4756
  let t4;
3547
- if ($[9] !== charges || $[10] !== query || $[11] !== sde) {
3548
- let t5;
3549
- if ($[13] !== query) {
3550
- t5 = (type_0) => type_0.name.toLowerCase().includes(query);
3551
- $[13] = query;
3552
- $[14] = t5;
3553
- } else t5 = $[14];
3554
- t4 = sde.sortByMeta(charges.filter(t5));
3555
- $[9] = charges;
3556
- $[10] = query;
3557
- $[11] = sde;
3558
- $[12] = t4;
3559
- } else t4 = $[12];
3560
- const loadable = t4;
3561
- let t5;
3562
- if ($[15] !== groups || $[16] !== loadable || $[17] !== selected) {
3563
- t5 = selected === void 0 ? countTypes$1(groups) : countLeaves(loadable);
3564
- $[15] = groups;
3565
- $[16] = loadable;
4757
+ if ($[14] !== found || $[15] !== loadable || $[16] !== matches || $[17] !== selected) {
4758
+ t4 = selected === void 0 ? matches !== void 0 && found.length === 0 : countLeaves(loadable) === 0;
4759
+ $[14] = found;
4760
+ $[15] = loadable;
4761
+ $[16] = matches;
3566
4762
  $[17] = selected;
3567
- $[18] = t5;
3568
- } else t5 = $[18];
3569
- const count = t5;
3570
- const open = query !== "" && query !== collapsed.query && count <= 200;
3571
- let t6;
4763
+ $[18] = t4;
4764
+ } else t4 = $[18];
4765
+ const empty = t4;
4766
+ let t5;
3572
4767
  if ($[19] !== clear) {
3573
- t6 = (value) => {
4768
+ t5 = (value) => {
3574
4769
  clear();
3575
4770
  setSearch(value);
3576
4771
  };
3577
4772
  $[19] = clear;
3578
- $[20] = t6;
3579
- } else t6 = $[20];
4773
+ $[20] = t5;
4774
+ } else t5 = $[20];
4775
+ let t6;
4776
+ if ($[21] !== collapses) {
4777
+ t6 = () => setCollapses(collapses + 1);
4778
+ $[21] = collapses;
4779
+ $[22] = t6;
4780
+ } else t6 = $[22];
3580
4781
  let t7;
3581
- if ($[21] !== collapsed.times || $[22] !== query) {
3582
- t7 = () => setCollapsed({
3583
- times: collapsed.times + 1,
3584
- query
3585
- });
3586
- $[21] = collapsed.times;
3587
- $[22] = query;
3588
- $[23] = t7;
3589
- } else t7 = $[23];
3590
- let t8;
3591
- if ($[24] !== search || $[25] !== t6 || $[26] !== t7) {
3592
- t8 = /* @__PURE__ */ jsx(Search, {
4782
+ if ($[23] !== search || $[24] !== t5 || $[25] !== t6) {
4783
+ t7 = /* @__PURE__ */ jsx(Search, {
3593
4784
  value: search,
3594
- onChange: t6,
3595
- onCollapse: t7
4785
+ onChange: t5,
4786
+ onCollapse: t6
3596
4787
  });
3597
- $[24] = search;
4788
+ $[23] = search;
4789
+ $[24] = t5;
3598
4790
  $[25] = t6;
3599
4791
  $[26] = t7;
3600
- $[27] = t8;
3601
- } else t8 = $[27];
3602
- let t9;
3603
- if ($[28] !== modules || $[29] !== selected) {
3604
- let t10;
3605
- if ($[31] !== selected) {
3606
- t10 = (module_0) => /* @__PURE__ */ jsx(FilterToggle, {
4792
+ } else t7 = $[26];
4793
+ let t8;
4794
+ if ($[27] !== modules || $[28] !== selected) {
4795
+ let t9;
4796
+ if ($[30] !== selected) {
4797
+ t9 = (module_0) => /* @__PURE__ */ jsx(FilterToggle, {
3607
4798
  typeId: module_0.id,
3608
4799
  label: module_0.name,
3609
4800
  pressed: selected === module_0.id,
3610
4801
  onPressedChange: (pressed) => setPicked(pressed ? module_0.id : void 0)
3611
4802
  }, module_0.id);
3612
- $[31] = selected;
3613
- $[32] = t10;
3614
- } else t10 = $[32];
3615
- t9 = modules.map(t10);
3616
- $[28] = modules;
3617
- $[29] = selected;
3618
- $[30] = t9;
3619
- } else t9 = $[30];
3620
- let t10;
3621
- if ($[33] !== t9) {
3622
- t10 = /* @__PURE__ */ jsx("fieldset", {
4803
+ $[30] = selected;
4804
+ $[31] = t9;
4805
+ } else t9 = $[31];
4806
+ t8 = modules.map(t9);
4807
+ $[27] = modules;
4808
+ $[28] = selected;
4809
+ $[29] = t8;
4810
+ } else t8 = $[29];
4811
+ let t9;
4812
+ if ($[32] !== t8) {
4813
+ t9 = /* @__PURE__ */ jsx("fieldset", {
3623
4814
  className: ItemBrowser_module_default.filters,
3624
4815
  "aria-label": "Filters",
3625
- children: t9
4816
+ children: t8
3626
4817
  });
4818
+ $[32] = t8;
3627
4819
  $[33] = t9;
3628
- $[34] = t10;
3629
- } else t10 = $[34];
3630
- const t11 = `${collapsed.times}-${open}-${selected}`;
3631
- let t12;
3632
- if ($[35] !== actions || $[36] !== groups || $[37] !== loadable || $[38] !== open || $[39] !== selected) {
3633
- t12 = selected === void 0 ? groups.map((node) => /* @__PURE__ */ jsx(ChargeGroup, {
3634
- node,
3635
- open,
3636
- actions
3637
- }, node.group.id)) : /* @__PURE__ */ jsx(TypeLeaves, {
3638
- sorted: loadable,
3639
- open,
3640
- actions,
3641
- icon: true
3642
- });
3643
- $[35] = actions;
3644
- $[36] = groups;
3645
- $[37] = loadable;
3646
- $[38] = open;
3647
- $[39] = selected;
3648
- $[40] = t12;
3649
- } else t12 = $[40];
3650
- let t13;
3651
- if ($[41] !== t11 || $[42] !== t12) {
3652
- t13 = /* @__PURE__ */ jsx("div", {
4820
+ } else t9 = $[33];
4821
+ let t10;
4822
+ if ($[34] !== actions || $[35] !== collapses || $[36] !== empty || $[37] !== found || $[38] !== groups || $[39] !== loadable || $[40] !== matches || $[41] !== selected) {
4823
+ t10 = /* @__PURE__ */ jsx("div", {
3653
4824
  className: ItemBrowser_module_default.tree,
3654
- children: /* @__PURE__ */ jsx(TreeList, {
4825
+ children: empty ? /* @__PURE__ */ jsx("p", {
4826
+ className: ItemBrowser_module_default.empty,
4827
+ children: "No charges found"
4828
+ }) : /* @__PURE__ */ jsx(TreeList, {
3655
4829
  label: "Charges",
3656
- children: t12
3657
- }, t11)
3658
- });
3659
- $[41] = t11;
3660
- $[42] = t12;
3661
- $[43] = t13;
3662
- } else t13 = $[43];
3663
- let t14;
3664
- if ($[44] !== dragImage || $[45] !== t10 || $[46] !== t13 || $[47] !== t8) {
3665
- t14 = /* @__PURE__ */ jsxs(Fragment, { children: [
3666
- t8,
4830
+ children: selected !== void 0 ? /* @__PURE__ */ jsx(TypeLeaves, {
4831
+ sorted: loadable,
4832
+ actions,
4833
+ icon: true
4834
+ }) : matches !== void 0 ? /* @__PURE__ */ jsx(SearchResults, {
4835
+ roots: found,
4836
+ actions
4837
+ }) : groups.map((node) => /* @__PURE__ */ jsx(ChargeGroup, {
4838
+ node,
4839
+ actions
4840
+ }, node.group.id))
4841
+ }, `${collapses}-${selected}`)
4842
+ });
4843
+ $[34] = actions;
4844
+ $[35] = collapses;
4845
+ $[36] = empty;
4846
+ $[37] = found;
4847
+ $[38] = groups;
4848
+ $[39] = loadable;
4849
+ $[40] = matches;
4850
+ $[41] = selected;
4851
+ $[42] = t10;
4852
+ } else t10 = $[42];
4853
+ let t11;
4854
+ if ($[43] !== dragImage || $[44] !== t10 || $[45] !== t7 || $[46] !== t9) {
4855
+ t11 = /* @__PURE__ */ jsxs(Fragment, { children: [
4856
+ t7,
4857
+ t9,
3667
4858
  t10,
3668
- t13,
3669
4859
  dragImage
3670
4860
  ] });
3671
- $[44] = dragImage;
3672
- $[45] = t10;
3673
- $[46] = t13;
3674
- $[47] = t8;
3675
- $[48] = t14;
3676
- } else t14 = $[48];
3677
- return t14;
4861
+ $[43] = dragImage;
4862
+ $[44] = t10;
4863
+ $[45] = t7;
4864
+ $[46] = t9;
4865
+ $[47] = t11;
4866
+ } else t11 = $[47];
4867
+ return t11;
3678
4868
  }
3679
4869
  function ChargeGroup(t0) {
3680
- const $ = c(13);
3681
- const { node, open, actions } = t0;
3682
- const images = useImages();
4870
+ const $ = c(11);
4871
+ const { node, actions } = t0;
4872
+ const marketGroupIcon = useMarketGroupIcon();
3683
4873
  const t1 = node.group.name;
3684
4874
  let t2;
3685
- if ($[0] !== images || $[1] !== node.group.id) {
3686
- t2 = images.marketGroupIcon(node.group.id);
3687
- $[0] = images;
4875
+ if ($[0] !== marketGroupIcon || $[1] !== node.group.id) {
4876
+ t2 = marketGroupIcon(node.group.id);
4877
+ $[0] = marketGroupIcon;
3688
4878
  $[1] = node.group.id;
3689
4879
  $[2] = t2;
3690
4880
  } else t2 = $[2];
3691
4881
  let t3;
3692
- if ($[3] !== actions || $[4] !== node.children || $[5] !== node.types || $[6] !== open) {
4882
+ if ($[3] !== actions || $[4] !== node.children || $[5] !== node.types) {
3693
4883
  t3 = () => /* @__PURE__ */ jsxs(Fragment, { children: [node.children.map((child) => /* @__PURE__ */ jsx(ChargeGroup, {
3694
4884
  node: child,
3695
- open,
3696
4885
  actions
3697
4886
  }, child.group.id)), node.types.map((type) => /* @__PURE__ */ jsx(TypeLeaf, {
3698
4887
  type,
@@ -3700,35 +4889,30 @@ function ChargeGroup(t0) {
3700
4889
  }, type.id))] });
3701
4890
  $[3] = actions;
3702
4891
  $[4] = node.children;
3703
- $[5] = node.types;
3704
- $[6] = open;
3705
- $[7] = t3;
3706
- } else t3 = $[7];
4892
+ $[5] = node.types;
4893
+ $[6] = t3;
4894
+ } else t3 = $[6];
3707
4895
  let t4;
3708
- if ($[8] !== node.group.name || $[9] !== open || $[10] !== t2 || $[11] !== t3) {
4896
+ if ($[7] !== node.group.name || $[8] !== t2 || $[9] !== t3) {
3709
4897
  t4 = /* @__PURE__ */ jsx(TreeGroup, {
3710
4898
  label: t1,
3711
4899
  icon: t2,
3712
- defaultOpen: open,
3713
4900
  children: t3
3714
4901
  });
3715
- $[8] = node.group.name;
3716
- $[9] = open;
3717
- $[10] = t2;
3718
- $[11] = t3;
3719
- $[12] = t4;
3720
- } else t4 = $[12];
4902
+ $[7] = node.group.name;
4903
+ $[8] = t2;
4904
+ $[9] = t3;
4905
+ $[10] = t4;
4906
+ } else t4 = $[10];
3721
4907
  return t4;
3722
4908
  }
3723
- function countTypes$1(nodes) {
3724
- return nodes.reduce((count, node) => count + countTypes$1(node.children) + node.types.length, 0);
3725
- }
3726
4909
  //#endregion
3727
4910
  //#region src/components/ItemBrowser/HullsAndFits.tsx
3728
4911
  const noFits = [];
4912
+ const SHIPS_MARKET_GROUP_ID = 4;
3729
4913
  /** The Hulls & Fits tab of the `ItemBrowser`: EVE's hulls by group and race, with the fits saved for each. */
3730
4914
  function HullsAndFits() {
3731
- const $ = c(75);
4915
+ const $ = c(61);
3732
4916
  const currentShipId = useFit().ship.type_id;
3733
4917
  const images = useImages();
3734
4918
  const store = useFitStore();
@@ -3738,233 +4922,186 @@ function HullsAndFits() {
3738
4922
  const [browserFits, setBrowserFits] = useState(false);
3739
4923
  const [currentHull, setCurrentHull] = useState(false);
3740
4924
  const [flyable, setFlyable] = useState(false);
4925
+ const [collapses, setCollapses] = useState(0);
3741
4926
  let t0;
3742
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
3743
- t0 = {
3744
- key: 0,
3745
- open: false
3746
- };
3747
- $[0] = t0;
3748
- } else t0 = $[0];
3749
- const [tree, setTree] = useState(t0);
4927
+ if ($[0] !== search) {
4928
+ t0 = search.trim().toLowerCase();
4929
+ $[0] = search;
4930
+ $[1] = t0;
4931
+ } else t0 = $[1];
4932
+ const query = t0;
3750
4933
  let t1;
3751
- if ($[1] !== search) {
3752
- t1 = search.trim().toLowerCase();
3753
- $[1] = search;
3754
- $[2] = t1;
3755
- } else t1 = $[2];
3756
- const query = t1;
3757
- const narrowed = query !== "" || currentHull;
4934
+ if ($[2] !== query) {
4935
+ t1 = (name) => (name ?? "").toLowerCase().includes(query);
4936
+ $[2] = query;
4937
+ $[3] = t1;
4938
+ } else t1 = $[3];
4939
+ const matches = t1;
3758
4940
  let t2;
3759
- if ($[3] !== query) {
3760
- t2 = (name) => (name ?? "").toLowerCase().includes(query);
3761
- $[3] = query;
3762
- $[4] = t2;
3763
- } else t2 = $[4];
3764
- const matches = t2;
4941
+ if ($[4] !== fits) {
4942
+ t2 = Map.groupBy(fits, _temp$3);
4943
+ $[4] = fits;
4944
+ $[5] = t2;
4945
+ } else t2 = $[5];
4946
+ const fitsByHull = t2;
3765
4947
  let t3;
3766
- if ($[5] !== fits) {
3767
- t3 = Map.groupBy(fits, _temp$3);
3768
- $[5] = fits;
3769
- $[6] = t3;
3770
- } else t3 = $[6];
3771
- const fitsByHull = t3;
3772
- let t4;
3773
- if ($[7] !== fitsByHull || $[8] !== flyable || $[9] !== matches || $[10] !== missingSkills) {
3774
- t4 = (ship) => {
4948
+ if ($[6] !== fitsByHull || $[7] !== flyable || $[8] !== matches || $[9] !== missingSkills) {
4949
+ t3 = (ship) => {
3775
4950
  const saved_0 = fitsByHull.get(ship.id) ?? noFits;
3776
4951
  const kept = flyable ? saved_0.filter((one) => missingSkills(one).length === 0) : saved_0;
3777
4952
  return matches(ship.name) ? kept : kept.filter((one_0) => matches(one_0.name));
3778
4953
  };
3779
- $[7] = fitsByHull;
3780
- $[8] = flyable;
3781
- $[9] = matches;
3782
- $[10] = missingSkills;
3783
- $[11] = t4;
3784
- } else t4 = $[11];
3785
- const shownFits = t4;
3786
- let t5;
3787
- if ($[12] !== browserFits || $[13] !== currentHull || $[14] !== currentShipId || $[15] !== flyable || $[16] !== matches || $[17] !== missingSkills || $[18] !== narrowed || $[19] !== shownFits) {
3788
- t5 = narrowed || browserFits || flyable ? (ship_0) => {
4954
+ $[6] = fitsByHull;
4955
+ $[7] = flyable;
4956
+ $[8] = matches;
4957
+ $[9] = missingSkills;
4958
+ $[10] = t3;
4959
+ } else t3 = $[10];
4960
+ const shownFits = t3;
4961
+ let t4;
4962
+ if ($[11] !== browserFits || $[12] !== currentHull || $[13] !== currentShipId || $[14] !== flyable || $[15] !== matches || $[16] !== missingSkills || $[17] !== query || $[18] !== shownFits) {
4963
+ t4 = query !== "" || currentHull || browserFits || flyable ? (ship_0) => {
3789
4964
  if (currentHull && ship_0.id !== currentShipId) return false;
3790
4965
  if (flyable && missingSkills([ship_0.id]).length > 0) return false;
3791
4966
  const shown = shownFits(ship_0);
3792
4967
  if (browserFits && shown.length === 0) return false;
3793
4968
  return matches(ship_0.name) || shown.length > 0;
3794
4969
  } : void 0;
3795
- $[12] = browserFits;
3796
- $[13] = currentHull;
3797
- $[14] = currentShipId;
3798
- $[15] = flyable;
3799
- $[16] = matches;
3800
- $[17] = missingSkills;
3801
- $[18] = narrowed;
3802
- $[19] = shownFits;
3803
- $[20] = t5;
3804
- } else t5 = $[20];
3805
- const groups = useHullTree(t5);
4970
+ $[11] = browserFits;
4971
+ $[12] = currentHull;
4972
+ $[13] = currentShipId;
4973
+ $[14] = flyable;
4974
+ $[15] = matches;
4975
+ $[16] = missingSkills;
4976
+ $[17] = query;
4977
+ $[18] = shownFits;
4978
+ $[19] = t4;
4979
+ } else t4 = $[19];
4980
+ const groups = useHullTree(t4);
4981
+ let t5;
4982
+ if ($[20] !== store) {
4983
+ t5 = (shipTypeId) => store.replace({
4984
+ ship: { type_id: shipTypeId },
4985
+ items: []
4986
+ });
4987
+ $[20] = store;
4988
+ $[21] = t5;
4989
+ } else t5 = $[21];
4990
+ const simulate = t5;
3806
4991
  let t6;
3807
- if ($[21] !== narrowed || $[22] !== tree.key) {
3808
- t6 = (nextSearch, nextCurrentHull) => {
3809
- const nextNarrowed = nextSearch.trim() !== "" || nextCurrentHull;
3810
- if (nextNarrowed !== narrowed) setTree({
3811
- key: tree.key + 1,
3812
- open: nextNarrowed
3813
- });
3814
- setSearch(nextSearch);
3815
- setCurrentHull(nextCurrentHull);
3816
- };
3817
- $[21] = narrowed;
3818
- $[22] = tree.key;
4992
+ if ($[22] !== collapses) {
4993
+ t6 = () => setCollapses(collapses + 1);
4994
+ $[22] = collapses;
3819
4995
  $[23] = t6;
3820
4996
  } else t6 = $[23];
3821
- const narrow = t6;
3822
4997
  let t7;
3823
- if ($[24] !== store) {
3824
- t7 = (shipTypeId) => store.replace({
3825
- ship: { type_id: shipTypeId },
3826
- items: []
3827
- });
3828
- $[24] = store;
3829
- $[25] = t7;
3830
- } else t7 = $[25];
3831
- const simulate = t7;
3832
- let t8;
3833
- if ($[26] !== currentHull || $[27] !== narrow) {
3834
- t8 = (value) => narrow(value, currentHull);
3835
- $[26] = currentHull;
3836
- $[27] = narrow;
3837
- $[28] = t8;
3838
- } else t8 = $[28];
3839
- let t9;
3840
- if ($[29] !== tree.key) {
3841
- t9 = () => setTree({
3842
- key: tree.key + 1,
3843
- open: false
3844
- });
3845
- $[29] = tree.key;
3846
- $[30] = t9;
3847
- } else t9 = $[30];
3848
- let t10;
3849
- if ($[31] !== search || $[32] !== t8 || $[33] !== t9) {
3850
- t10 = /* @__PURE__ */ jsx(Search, {
4998
+ if ($[24] !== search || $[25] !== t6) {
4999
+ t7 = /* @__PURE__ */ jsx(Search, {
3851
5000
  value: search,
3852
- onChange: t8,
3853
- onCollapse: t9
5001
+ onChange: setSearch,
5002
+ onCollapse: t6
3854
5003
  });
3855
- $[31] = search;
3856
- $[32] = t8;
3857
- $[33] = t9;
3858
- $[34] = t10;
3859
- } else t10 = $[34];
3860
- let t11;
3861
- if ($[35] !== browserFits) {
3862
- t11 = /* @__PURE__ */ jsx(FilterToggle, {
5004
+ $[24] = search;
5005
+ $[25] = t6;
5006
+ $[26] = t7;
5007
+ } else t7 = $[26];
5008
+ let t8;
5009
+ if ($[27] !== browserFits) {
5010
+ t8 = /* @__PURE__ */ jsx(FilterToggle, {
3863
5011
  icon: "fits-browser",
3864
5012
  label: "Browser Fittings",
3865
5013
  pressed: browserFits,
3866
5014
  onPressedChange: setBrowserFits
3867
5015
  });
3868
- $[35] = browserFits;
3869
- $[36] = t11;
3870
- } else t11 = $[36];
5016
+ $[27] = browserFits;
5017
+ $[28] = t8;
5018
+ } else t8 = $[28];
5019
+ let t10;
5020
+ let t11;
3871
5021
  let t12;
3872
- let t13;
3873
- let t14;
3874
- let t15;
3875
- if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
3876
- t12 = /* @__PURE__ */ jsx(FilterToggle, {
5022
+ let t9;
5023
+ if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
5024
+ t9 = /* @__PURE__ */ jsx(FilterToggle, {
3877
5025
  icon: "fits-personal",
3878
5026
  label: "Personal Fittings"
3879
5027
  });
3880
- t13 = /* @__PURE__ */ jsx(FilterToggle, {
5028
+ t10 = /* @__PURE__ */ jsx(FilterToggle, {
3881
5029
  icon: "fits-corporation",
3882
5030
  label: "Corporation Fittings"
3883
5031
  });
3884
- t14 = /* @__PURE__ */ jsx(FilterToggle, {
5032
+ t11 = /* @__PURE__ */ jsx(FilterToggle, {
3885
5033
  icon: "fits-alliance",
3886
5034
  label: "Alliance Fittings"
3887
5035
  });
3888
- t15 = /* @__PURE__ */ jsx(FilterToggle, {
5036
+ t12 = /* @__PURE__ */ jsx(FilterToggle, {
3889
5037
  icon: "fits-community",
3890
5038
  label: "Community Fittings"
3891
5039
  });
3892
- $[37] = t12;
3893
- $[38] = t13;
3894
- $[39] = t14;
3895
- $[40] = t15;
5040
+ $[29] = t10;
5041
+ $[30] = t11;
5042
+ $[31] = t12;
5043
+ $[32] = t9;
3896
5044
  } else {
3897
- t12 = $[37];
3898
- t13 = $[38];
3899
- t14 = $[39];
3900
- t15 = $[40];
5045
+ t10 = $[29];
5046
+ t11 = $[30];
5047
+ t12 = $[31];
5048
+ t9 = $[32];
3901
5049
  }
3902
- let t16;
3903
- if ($[41] !== narrow || $[42] !== search) {
3904
- t16 = (pressed) => narrow(search, pressed);
3905
- $[41] = narrow;
3906
- $[42] = search;
3907
- $[43] = t16;
3908
- } else t16 = $[43];
3909
- let t17;
3910
- if ($[44] !== currentHull || $[45] !== t16) {
3911
- t17 = /* @__PURE__ */ jsx(FilterToggle, {
5050
+ let t13;
5051
+ if ($[33] !== currentHull) {
5052
+ t13 = /* @__PURE__ */ jsx(FilterToggle, {
3912
5053
  icon: "current-hull",
3913
5054
  label: "Current Hull",
3914
5055
  pressed: currentHull,
3915
- onPressedChange: t16
5056
+ onPressedChange: setCurrentHull
3916
5057
  });
3917
- $[44] = currentHull;
3918
- $[45] = t16;
3919
- $[46] = t17;
3920
- } else t17 = $[46];
3921
- let t18;
3922
- if ($[47] !== flyable) {
3923
- t18 = /* @__PURE__ */ jsx(FilterToggle, {
5058
+ $[33] = currentHull;
5059
+ $[34] = t13;
5060
+ } else t13 = $[34];
5061
+ let t14;
5062
+ if ($[35] !== flyable) {
5063
+ t14 = /* @__PURE__ */ jsx(FilterToggle, {
3924
5064
  icon: "skills",
3925
5065
  label: "Skills",
3926
5066
  pressed: flyable,
3927
5067
  onPressedChange: setFlyable
3928
5068
  });
3929
- $[47] = flyable;
3930
- $[48] = t18;
3931
- } else t18 = $[48];
3932
- let t19;
3933
- if ($[49] !== t11 || $[50] !== t17 || $[51] !== t18) {
3934
- t19 = /* @__PURE__ */ jsxs("fieldset", {
5069
+ $[35] = flyable;
5070
+ $[36] = t14;
5071
+ } else t14 = $[36];
5072
+ let t15;
5073
+ if ($[37] !== t13 || $[38] !== t14 || $[39] !== t8) {
5074
+ t15 = /* @__PURE__ */ jsxs("fieldset", {
3935
5075
  className: ItemBrowser_module_default.filters,
3936
5076
  "aria-label": "Filters",
3937
5077
  children: [
5078
+ t8,
5079
+ t9,
5080
+ t10,
3938
5081
  t11,
3939
5082
  t12,
3940
5083
  t13,
3941
- t14,
3942
- t15,
3943
- t17,
3944
- t18
5084
+ t14
3945
5085
  ]
3946
5086
  });
3947
- $[49] = t11;
3948
- $[50] = t17;
3949
- $[51] = t18;
3950
- $[52] = t19;
3951
- } else t19 = $[52];
3952
- const t20 = tree.key;
3953
- let t21;
3954
- if ($[53] !== fitsByHull || $[54] !== groups || $[55] !== images || $[56] !== shownFits || $[57] !== simulate || $[58] !== store || $[59] !== tree.open) {
3955
- let t22;
3956
- if ($[61] !== fitsByHull || $[62] !== images || $[63] !== shownFits || $[64] !== simulate || $[65] !== store || $[66] !== tree.open) {
3957
- t22 = (t23) => {
3958
- const { group, races } = t23;
5087
+ $[37] = t13;
5088
+ $[38] = t14;
5089
+ $[39] = t8;
5090
+ $[40] = t15;
5091
+ } else t15 = $[40];
5092
+ let t16;
5093
+ if ($[41] !== fitsByHull || $[42] !== groups || $[43] !== images || $[44] !== shownFits || $[45] !== simulate || $[46] !== store) {
5094
+ let t17;
5095
+ if ($[48] !== fitsByHull || $[49] !== images || $[50] !== shownFits || $[51] !== simulate || $[52] !== store) {
5096
+ t17 = (t18) => {
5097
+ const { group, races } = t18;
3959
5098
  return /* @__PURE__ */ jsx(TreeGroup, {
3960
5099
  label: group.name,
3961
- defaultOpen: tree.open,
3962
- children: () => races.map((t24) => {
3963
- const { race, factionId, ships } = t24;
5100
+ children: () => races.map((t19) => {
5101
+ const { race, factionId, ships } = t19;
3964
5102
  return /* @__PURE__ */ jsx(TreeGroup, {
3965
5103
  label: `${raceName(race)} [${ships.length}]`,
3966
- icon: factionId === void 0 ? void 0 : images.factionIcon(factionId),
3967
- defaultOpen: tree.open,
5104
+ icon: factionId === void 0 ? images.marketGroupIcon(SHIPS_MARKET_GROUP_ID) : images.factionIcon(factionId),
3968
5105
  children: () => ships.map((ship_1) => {
3969
5106
  const shown_0 = shownFits(ship_1);
3970
5107
  const simulateShip = /* @__PURE__ */ jsx(Tooltip, {
@@ -3977,24 +5114,15 @@ function HullsAndFits() {
3977
5114
  children: /* @__PURE__ */ jsx(Icon, { name: "simulate" })
3978
5115
  })
3979
5116
  });
3980
- if (shown_0.length === 0) return /* @__PURE__ */ jsx(TreeLeaf, {
3981
- label: /* @__PURE__ */ jsx("span", {
3982
- className: ItemBrowser_module_default.hull,
3983
- children: ship_1.name
3984
- }),
3985
- typeId: ship_1.id,
3986
- after: simulateShip
3987
- }, ship_1.id);
3988
5117
  return /* @__PURE__ */ jsx(TreeGroup, {
3989
5118
  label: /* @__PURE__ */ jsx("span", {
3990
5119
  className: ItemBrowser_module_default.hull,
3991
5120
  children: ship_1.name
3992
5121
  }),
3993
- description: /* @__PURE__ */ jsx(Counts, { browserFits: fitsByHull.get(ship_1.id)?.length ?? 0 }),
5122
+ description: shown_0.length > 0 ? /* @__PURE__ */ jsx(Counts, { browserFits: fitsByHull.get(ship_1.id)?.length ?? 0 }) : void 0,
3994
5123
  typeId: ship_1.id,
3995
- defaultOpen: tree.open,
3996
5124
  after: simulateShip,
3997
- children: () => shown_0.map((saved_1) => /* @__PURE__ */ jsx(TreeLeaf, {
5125
+ children: () => shown_0.length === 0 ? /* @__PURE__ */ jsx(TreeLeaf, { label: "No Item" }) : shown_0.map((saved_1) => /* @__PURE__ */ jsx(TreeLeaf, {
3998
5126
  label: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
3999
5127
  className: ItemBrowser_module_default.kind,
4000
5128
  children: /* @__PURE__ */ jsx(Icon, { name: "fits-browser" })
@@ -4008,50 +5136,48 @@ function HullsAndFits() {
4008
5136
  })
4009
5137
  }, group.id);
4010
5138
  };
4011
- $[61] = fitsByHull;
4012
- $[62] = images;
4013
- $[63] = shownFits;
4014
- $[64] = simulate;
4015
- $[65] = store;
4016
- $[66] = tree.open;
4017
- $[67] = t22;
4018
- } else t22 = $[67];
4019
- t21 = groups.map(t22);
4020
- $[53] = fitsByHull;
4021
- $[54] = groups;
4022
- $[55] = images;
4023
- $[56] = shownFits;
4024
- $[57] = simulate;
4025
- $[58] = store;
4026
- $[59] = tree.open;
4027
- $[60] = t21;
4028
- } else t21 = $[60];
4029
- let t22;
4030
- if ($[68] !== t21 || $[69] !== tree.key) {
4031
- t22 = /* @__PURE__ */ jsx("div", {
5139
+ $[48] = fitsByHull;
5140
+ $[49] = images;
5141
+ $[50] = shownFits;
5142
+ $[51] = simulate;
5143
+ $[52] = store;
5144
+ $[53] = t17;
5145
+ } else t17 = $[53];
5146
+ t16 = groups.map(t17);
5147
+ $[41] = fitsByHull;
5148
+ $[42] = groups;
5149
+ $[43] = images;
5150
+ $[44] = shownFits;
5151
+ $[45] = simulate;
5152
+ $[46] = store;
5153
+ $[47] = t16;
5154
+ } else t16 = $[47];
5155
+ let t17;
5156
+ if ($[54] !== collapses || $[55] !== t16) {
5157
+ t17 = /* @__PURE__ */ jsx("div", {
4032
5158
  className: ItemBrowser_module_default.tree,
4033
5159
  children: /* @__PURE__ */ jsx(TreeList, {
4034
5160
  label: "Hulls",
4035
- children: t21
4036
- }, t20)
5161
+ children: t16
5162
+ }, collapses)
4037
5163
  });
4038
- $[68] = t21;
4039
- $[69] = tree.key;
4040
- $[70] = t22;
4041
- } else t22 = $[70];
4042
- let t23;
4043
- if ($[71] !== t10 || $[72] !== t19 || $[73] !== t22) {
4044
- t23 = /* @__PURE__ */ jsxs(Fragment, { children: [
4045
- t10,
4046
- t19,
4047
- t22
5164
+ $[54] = collapses;
5165
+ $[55] = t16;
5166
+ $[56] = t17;
5167
+ } else t17 = $[56];
5168
+ let t18;
5169
+ if ($[57] !== t15 || $[58] !== t17 || $[59] !== t7) {
5170
+ t18 = /* @__PURE__ */ jsxs(Fragment, { children: [
5171
+ t7,
5172
+ t15,
5173
+ t17
4048
5174
  ] });
4049
- $[71] = t10;
4050
- $[72] = t19;
4051
- $[73] = t22;
4052
- $[74] = t23;
4053
- } else t23 = $[74];
4054
- return t23;
5175
+ $[57] = t15;
5176
+ $[58] = t17;
5177
+ $[59] = t7;
5178
+ $[60] = t18;
5179
+ } else t18 = $[60];
5180
+ return t18;
4055
5181
  }
4056
5182
  function _temp$3(saved) {
4057
5183
  return saved.ship.type_id;
@@ -4235,7 +5361,7 @@ const slotFilters = [
4235
5361
  ];
4236
5362
  /** The Modules tab of the `ItemBrowser`: what goes on a ship, by market group. */
4237
5363
  function Modules() {
4238
- const $ = c(51);
5364
+ const $ = c(44);
4239
5365
  const { actions, clear, dragImage } = useTypeActions();
4240
5366
  const placement = usePlacement();
4241
5367
  const canFit = useCanFit();
@@ -4244,32 +5370,27 @@ function Modules() {
4244
5370
  const [slots, setSlots] = useState(_temp$2);
4245
5371
  const [hullRestrictions, setHullRestrictions] = useState(false);
4246
5372
  const [flyable, setFlyable] = useState(false);
5373
+ const [collapses, setCollapses] = useState(0);
4247
5374
  let t0;
4248
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
4249
- t0 = { times: 0 };
4250
- $[0] = t0;
4251
- } else t0 = $[0];
4252
- const [collapsed, setCollapsed] = useState(t0);
5375
+ if ($[0] !== search) {
5376
+ t0 = search.trim().toLowerCase();
5377
+ $[0] = search;
5378
+ $[1] = t0;
5379
+ } else t0 = $[1];
5380
+ const query = t0;
4253
5381
  let t1;
4254
- if ($[1] !== search) {
4255
- t1 = search.trim().toLowerCase();
4256
- $[1] = search;
4257
- $[2] = t1;
4258
- } else t1 = $[2];
4259
- const query = t1;
4260
- let t2;
4261
- if ($[3] !== slots) {
4262
- t2 = new Set(slotFilters.filter((t3) => {
4263
- const { filter } = t3;
5382
+ if ($[2] !== slots) {
5383
+ t1 = new Set(slotFilters.filter((t2) => {
5384
+ const { filter } = t2;
4264
5385
  return slots.has(filter);
4265
5386
  }).flatMap(_temp2$1));
4266
- $[3] = slots;
4267
- $[4] = t2;
4268
- } else t2 = $[4];
4269
- const places = t2;
4270
- let t3;
4271
- if ($[5] !== canFit || $[6] !== flyable || $[7] !== hullRestrictions || $[8] !== missingSkills || $[9] !== placement || $[10] !== places || $[11] !== query) {
4272
- t3 = query !== "" || places.size > 0 || hullRestrictions || flyable ? (type) => {
5387
+ $[2] = slots;
5388
+ $[3] = t1;
5389
+ } else t1 = $[3];
5390
+ const places = t1;
5391
+ let t2;
5392
+ if ($[4] !== canFit || $[5] !== flyable || $[6] !== hullRestrictions || $[7] !== missingSkills || $[8] !== placement || $[9] !== places || $[10] !== query) {
5393
+ t2 = query !== "" || places.size > 0 || hullRestrictions || flyable ? (type) => {
4273
5394
  if (places.size > 0) {
4274
5395
  const place = placement(type)?.type;
4275
5396
  if (place === void 0 || !places.has(place)) return false;
@@ -4278,64 +5399,62 @@ function Modules() {
4278
5399
  if (flyable && missingSkills([type.id]).length > 0) return false;
4279
5400
  return type.name.toLowerCase().includes(query);
4280
5401
  } : void 0;
4281
- $[5] = canFit;
4282
- $[6] = flyable;
4283
- $[7] = hullRestrictions;
4284
- $[8] = missingSkills;
4285
- $[9] = placement;
4286
- $[10] = places;
4287
- $[11] = query;
4288
- $[12] = t3;
4289
- } else t3 = $[12];
4290
- const groups = useModuleTree(t3);
4291
- const open = query !== "" && query !== collapsed.query && countTypes(groups) <= 200;
4292
- let t4;
4293
- if ($[13] !== slots) {
4294
- t4 = (filter_0, pressed) => {
5402
+ $[4] = canFit;
5403
+ $[5] = flyable;
5404
+ $[6] = hullRestrictions;
5405
+ $[7] = missingSkills;
5406
+ $[8] = placement;
5407
+ $[9] = places;
5408
+ $[10] = query;
5409
+ $[11] = t2;
5410
+ } else t2 = $[11];
5411
+ const keep = t2;
5412
+ const tree = useModuleTree(query === "" ? keep : void 0);
5413
+ const found = useModuleSearch(query === "" ? void 0 : keep);
5414
+ const groups = query === "" ? tree : found;
5415
+ let t3;
5416
+ if ($[12] !== slots) {
5417
+ t3 = (filter_0, pressed) => {
4295
5418
  const next = new Set(slots);
4296
5419
  if (pressed) next.add(filter_0);
4297
5420
  else next.delete(filter_0);
4298
5421
  setSlots(next);
4299
5422
  };
4300
- $[13] = slots;
4301
- $[14] = t4;
4302
- } else t4 = $[14];
4303
- const toggleSlot = t4;
4304
- let t5;
4305
- if ($[15] !== clear) {
4306
- t5 = (value) => {
5423
+ $[12] = slots;
5424
+ $[13] = t3;
5425
+ } else t3 = $[13];
5426
+ const toggleSlot = t3;
5427
+ let t4;
5428
+ if ($[14] !== clear) {
5429
+ t4 = (value) => {
4307
5430
  clear();
4308
5431
  setSearch(value);
4309
5432
  };
4310
- $[15] = clear;
4311
- $[16] = t5;
4312
- } else t5 = $[16];
5433
+ $[14] = clear;
5434
+ $[15] = t4;
5435
+ } else t4 = $[15];
5436
+ let t5;
5437
+ if ($[16] !== collapses) {
5438
+ t5 = () => setCollapses(collapses + 1);
5439
+ $[16] = collapses;
5440
+ $[17] = t5;
5441
+ } else t5 = $[17];
4313
5442
  let t6;
4314
- if ($[17] !== collapsed.times || $[18] !== query) {
4315
- t6 = () => setCollapsed({
4316
- times: collapsed.times + 1,
4317
- query
4318
- });
4319
- $[17] = collapsed.times;
4320
- $[18] = query;
4321
- $[19] = t6;
4322
- } else t6 = $[19];
4323
- let t7;
4324
- if ($[20] !== search || $[21] !== t5 || $[22] !== t6) {
4325
- t7 = /* @__PURE__ */ jsx(Search, {
5443
+ if ($[18] !== search || $[19] !== t4 || $[20] !== t5) {
5444
+ t6 = /* @__PURE__ */ jsx(Search, {
4326
5445
  value: search,
4327
- onChange: t5,
4328
- onCollapse: t6
5446
+ onChange: t4,
5447
+ onCollapse: t5
4329
5448
  });
4330
- $[20] = search;
4331
- $[21] = t5;
4332
- $[22] = t6;
4333
- $[23] = t7;
4334
- } else t7 = $[23];
4335
- let t8;
4336
- if ($[24] !== slots || $[25] !== toggleSlot) {
4337
- t8 = slotFilters.map((t9) => {
4338
- const { filter: filter_1, icon, label } = t9;
5449
+ $[18] = search;
5450
+ $[19] = t4;
5451
+ $[20] = t5;
5452
+ $[21] = t6;
5453
+ } else t6 = $[21];
5454
+ let t7;
5455
+ if ($[22] !== slots || $[23] !== toggleSlot) {
5456
+ t7 = slotFilters.map((t8) => {
5457
+ const { filter: filter_1, icon, label } = t8;
4339
5458
  return /* @__PURE__ */ jsx(FilterToggle, {
4340
5459
  icon,
4341
5460
  label,
@@ -4343,158 +5462,102 @@ function Modules() {
4343
5462
  onPressedChange: (pressed_0) => toggleSlot(filter_1, pressed_0)
4344
5463
  }, filter_1);
4345
5464
  });
4346
- $[24] = slots;
4347
- $[25] = toggleSlot;
4348
- $[26] = t8;
4349
- } else t8 = $[26];
4350
- let t9;
4351
- if ($[27] !== hullRestrictions) {
4352
- t9 = /* @__PURE__ */ jsx(FilterToggle, {
5465
+ $[22] = slots;
5466
+ $[23] = toggleSlot;
5467
+ $[24] = t7;
5468
+ } else t7 = $[24];
5469
+ let t8;
5470
+ if ($[25] !== hullRestrictions) {
5471
+ t8 = /* @__PURE__ */ jsx(FilterToggle, {
4353
5472
  icon: "filter-hull-restrictions",
4354
5473
  label: "Hull Restrictions",
4355
5474
  pressed: hullRestrictions,
4356
5475
  onPressedChange: setHullRestrictions
4357
5476
  });
4358
- $[27] = hullRestrictions;
4359
- $[28] = t9;
4360
- } else t9 = $[28];
4361
- let t10;
4362
- if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
4363
- t10 = /* @__PURE__ */ jsx(FilterToggle, {
5477
+ $[25] = hullRestrictions;
5478
+ $[26] = t8;
5479
+ } else t8 = $[26];
5480
+ let t9;
5481
+ if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
5482
+ t9 = /* @__PURE__ */ jsx(FilterToggle, {
4364
5483
  icon: "filter-resources",
4365
5484
  label: "Resources"
4366
5485
  });
4367
- $[29] = t10;
4368
- } else t10 = $[29];
4369
- let t11;
4370
- if ($[30] !== flyable) {
4371
- t11 = /* @__PURE__ */ jsx(FilterToggle, {
5486
+ $[27] = t9;
5487
+ } else t9 = $[27];
5488
+ let t10;
5489
+ if ($[28] !== flyable) {
5490
+ t10 = /* @__PURE__ */ jsx(FilterToggle, {
4372
5491
  icon: "skills",
4373
5492
  label: "Skills",
4374
5493
  pressed: flyable,
4375
5494
  onPressedChange: setFlyable
4376
5495
  });
4377
- $[30] = flyable;
4378
- $[31] = t11;
4379
- } else t11 = $[31];
4380
- let t12;
4381
- if ($[32] !== t11 || $[33] !== t8 || $[34] !== t9) {
4382
- t12 = /* @__PURE__ */ jsxs("fieldset", {
5496
+ $[28] = flyable;
5497
+ $[29] = t10;
5498
+ } else t10 = $[29];
5499
+ let t11;
5500
+ if ($[30] !== t10 || $[31] !== t7 || $[32] !== t8) {
5501
+ t11 = /* @__PURE__ */ jsxs("fieldset", {
4383
5502
  className: ItemBrowser_module_default.filters,
4384
5503
  "aria-label": "Filters",
4385
5504
  children: [
5505
+ t7,
4386
5506
  t8,
4387
5507
  t9,
4388
- t10,
4389
- t11
5508
+ t10
4390
5509
  ]
4391
5510
  });
4392
- $[32] = t11;
4393
- $[33] = t8;
4394
- $[34] = t9;
4395
- $[35] = t12;
4396
- } else t12 = $[35];
4397
- const t13 = `${collapsed.times}-${open}`;
4398
- let t14;
4399
- if ($[36] !== actions || $[37] !== groups || $[38] !== open) {
4400
- let t15;
4401
- if ($[40] !== actions || $[41] !== open) {
4402
- t15 = (node) => /* @__PURE__ */ jsx(ModuleGroup, {
4403
- node,
4404
- open,
4405
- actions
4406
- }, node.group.id);
4407
- $[40] = actions;
4408
- $[41] = open;
4409
- $[42] = t15;
4410
- } else t15 = $[42];
4411
- t14 = groups.map(t15);
4412
- $[36] = actions;
4413
- $[37] = groups;
4414
- $[38] = open;
4415
- $[39] = t14;
4416
- } else t14 = $[39];
4417
- let t15;
4418
- if ($[43] !== t13 || $[44] !== t14) {
4419
- t15 = /* @__PURE__ */ jsx("div", {
5511
+ $[30] = t10;
5512
+ $[31] = t7;
5513
+ $[32] = t8;
5514
+ $[33] = t11;
5515
+ } else t11 = $[33];
5516
+ let t12;
5517
+ if ($[34] !== actions || $[35] !== collapses || $[36] !== groups || $[37] !== query) {
5518
+ t12 = /* @__PURE__ */ jsx("div", {
4420
5519
  className: ItemBrowser_module_default.tree,
4421
- children: /* @__PURE__ */ jsx(TreeList, {
5520
+ children: groups.length === 0 ? /* @__PURE__ */ jsx("p", {
5521
+ className: ItemBrowser_module_default.empty,
5522
+ children: "No modules found"
5523
+ }) : /* @__PURE__ */ jsx(TreeList, {
4422
5524
  label: "Modules",
4423
- children: t14
4424
- }, t13)
4425
- });
4426
- $[43] = t13;
4427
- $[44] = t14;
4428
- $[45] = t15;
4429
- } else t15 = $[45];
4430
- let t16;
4431
- if ($[46] !== dragImage || $[47] !== t12 || $[48] !== t15 || $[49] !== t7) {
4432
- t16 = /* @__PURE__ */ jsxs(Fragment, { children: [
4433
- t7,
4434
- t12,
4435
- t15,
4436
- dragImage
4437
- ] });
4438
- $[46] = dragImage;
4439
- $[47] = t12;
4440
- $[48] = t15;
4441
- $[49] = t7;
4442
- $[50] = t16;
4443
- } else t16 = $[50];
4444
- return t16;
4445
- }
4446
- function _temp2$1(slot) {
4447
- return slot.places;
4448
- }
4449
- function _temp$2() {
4450
- return /* @__PURE__ */ new Set();
4451
- }
4452
- function ModuleGroup(t0) {
4453
- const $ = c(12);
4454
- const { node, open, actions } = t0;
4455
- const images = useImages();
4456
- const t1 = node.group.name;
4457
- let t2;
4458
- if ($[0] !== images || $[1] !== node.group.id) {
4459
- t2 = images.marketGroupIcon(node.group.id);
4460
- $[0] = images;
4461
- $[1] = node.group.id;
4462
- $[2] = t2;
4463
- } else t2 = $[2];
4464
- let t3;
4465
- if ($[3] !== actions || $[4] !== node || $[5] !== open) {
4466
- t3 = () => /* @__PURE__ */ jsxs(Fragment, { children: [node.children.map((child) => /* @__PURE__ */ jsx(ModuleGroup, {
4467
- node: child,
4468
- open,
4469
- actions
4470
- }, child.group.id)), /* @__PURE__ */ jsx(TypeLeaves, {
4471
- sorted: node,
4472
- open,
4473
- actions
4474
- })] });
4475
- $[3] = actions;
4476
- $[4] = node;
4477
- $[5] = open;
4478
- $[6] = t3;
4479
- } else t3 = $[6];
4480
- let t4;
4481
- if ($[7] !== node.group.name || $[8] !== open || $[9] !== t2 || $[10] !== t3) {
4482
- t4 = /* @__PURE__ */ jsx(TreeGroup, {
4483
- label: t1,
4484
- icon: t2,
4485
- defaultOpen: open,
4486
- children: t3
5525
+ children: query === "" ? groups.map((node) => /* @__PURE__ */ jsx(TypeGroup, {
5526
+ node,
5527
+ actions
5528
+ }, node.group.id)) : /* @__PURE__ */ jsx(SearchResults, {
5529
+ roots: groups,
5530
+ actions
5531
+ })
5532
+ }, collapses)
4487
5533
  });
4488
- $[7] = node.group.name;
4489
- $[8] = open;
4490
- $[9] = t2;
4491
- $[10] = t3;
4492
- $[11] = t4;
4493
- } else t4 = $[11];
4494
- return t4;
5534
+ $[34] = actions;
5535
+ $[35] = collapses;
5536
+ $[36] = groups;
5537
+ $[37] = query;
5538
+ $[38] = t12;
5539
+ } else t12 = $[38];
5540
+ let t13;
5541
+ if ($[39] !== dragImage || $[40] !== t11 || $[41] !== t12 || $[42] !== t6) {
5542
+ t13 = /* @__PURE__ */ jsxs(Fragment, { children: [
5543
+ t6,
5544
+ t11,
5545
+ t12,
5546
+ dragImage
5547
+ ] });
5548
+ $[39] = dragImage;
5549
+ $[40] = t11;
5550
+ $[41] = t12;
5551
+ $[42] = t6;
5552
+ $[43] = t13;
5553
+ } else t13 = $[43];
5554
+ return t13;
5555
+ }
5556
+ function _temp2$1(slot) {
5557
+ return slot.places;
4495
5558
  }
4496
- function countTypes(nodes) {
4497
- return nodes.reduce((count, node) => count + countTypes(node.children) + countLeaves(node), 0);
5559
+ function _temp$2() {
5560
+ return /* @__PURE__ */ new Set();
4498
5561
  }
4499
5562
  //#endregion
4500
5563
  //#region src/components/ItemBrowser/ItemBrowser.tsx
@@ -4591,8 +5654,10 @@ var ShipStatistics_module_default = {
4591
5654
  "bad": "lebA7G_bad",
4592
5655
  "capacitor": "lebA7G_capacitor",
4593
5656
  "defense": "lebA7G_defense",
5657
+ "fighters": "lebA7G_fighters",
4594
5658
  "good": "lebA7G_good",
4595
5659
  "lines": "lebA7G_lines",
5660
+ "manage": "lebA7G_manage",
4596
5661
  "menu": "lebA7G_menu",
4597
5662
  "picker": "lebA7G_picker",
4598
5663
  "price": "lebA7G_price",
@@ -4619,41 +5684,23 @@ function AttributeText(t0) {
4619
5684
  return t1;
4620
5685
  }
4621
5686
  //#endregion
4622
- //#region src/components/ShipStatistics/AttributeTooltip.tsx
4623
- /** What EVE shows when hovering the attribute; its name, for one without. */
4624
- function AttributeTooltip(t0) {
4625
- const $ = c(7);
4626
- const { attribute } = t0;
4627
- const sde = useSde();
4628
- const tooltip = useAttributeTooltip(attribute);
4629
- let t1;
4630
- if ($[0] !== attribute || $[1] !== sde || $[2] !== tooltip?.title) {
4631
- t1 = tooltip?.title ?? sde.attribute(sde.attributeId(attribute) ?? 0)?.displayName ?? attribute;
4632
- $[0] = attribute;
4633
- $[1] = sde;
4634
- $[2] = tooltip?.title;
4635
- $[3] = t1;
4636
- } else t1 = $[3];
4637
- const title = t1;
4638
- const t2 = tooltip?.description;
4639
- let t3;
4640
- if ($[4] !== t2 || $[5] !== title) {
4641
- t3 = /* @__PURE__ */ jsx(TooltipText, {
4642
- title,
4643
- description: t2
4644
- });
4645
- $[4] = t2;
4646
- $[5] = title;
4647
- $[6] = t3;
4648
- } else t3 = $[6];
4649
- return t3;
4650
- }
4651
- //#endregion
4652
5687
  //#region src/components/ShipStatistics/units.ts
4653
5688
  /** For the `format` of `useAttribute`. */
4654
5689
  function unit(suffix, divisor = 1) {
4655
5690
  return (value, format) => `${formatNumber(value / divisor, format)}${suffix}`;
4656
5691
  }
5692
+ /** Like EVE's "0.11B hp": in billions above 100 million, in millions above 100 thousand. */
5693
+ function hitpoints(value, format) {
5694
+ const short = {
5695
+ ...format,
5696
+ decimals: 2,
5697
+ fixed: true,
5698
+ rounding: "nearest"
5699
+ };
5700
+ if (value > 1e8) return unit("B hp", 1e9)(value, short);
5701
+ if (value > 1e5) return unit("M hp", 1e6)(value, short);
5702
+ return unit(" hp")(value, format);
5703
+ }
4657
5704
  //#endregion
4658
5705
  //#region src/components/ShipStatistics/CapacitorStats.tsx
4659
5706
  function CapacitorStats() {
@@ -5057,12 +6104,8 @@ function Resistance(t0) {
5057
6104
  }
5058
6105
  //#endregion
5059
6106
  //#region src/components/ShipStatistics/DefenseStats.tsx
5060
- const hitpoints = {
5061
- decimals: 0,
5062
- format: unit(" hp")
5063
- };
5064
6107
  function DefenseStats() {
5065
- const $ = c(30);
6108
+ const $ = c(42);
5066
6109
  let t0;
5067
6110
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
5068
6111
  t0 = {
@@ -5072,143 +6115,190 @@ function DefenseStats() {
5072
6115
  $[0] = t0;
5073
6116
  } else t0 = $[0];
5074
6117
  const ehp = useAttribute("ehp", t0);
5075
- const shield = useAttribute("shieldCapacity", hitpoints);
5076
6118
  let t1;
5077
6119
  if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
5078
- t1 = { decimals: 0 };
6120
+ t1 = {
6121
+ decimals: 0,
6122
+ format: hitpoints
6123
+ };
5079
6124
  $[1] = t1;
5080
6125
  } else t1 = $[1];
5081
- const shieldRecharge = useAttribute("shieldRechargeRate", t1);
5082
- const armor = useAttribute("armorHP", hitpoints);
5083
- const structure = useAttribute("hp", hitpoints);
6126
+ const shield = useAttribute("shieldCapacity", t1);
5084
6127
  let t2;
5085
- if ($[2] !== ehp) {
5086
- t2 = /* @__PURE__ */ jsx(AttributeText, { value: ehp });
5087
- $[2] = ehp;
5088
- $[3] = t2;
5089
- } else t2 = $[3];
6128
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
6129
+ t2 = { decimals: 0 };
6130
+ $[2] = t2;
6131
+ } else t2 = $[2];
6132
+ const shieldRecharge = useAttribute("shieldRechargeRate", t2);
5090
6133
  let t3;
6134
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
6135
+ t3 = {
6136
+ decimals: 0,
6137
+ format: hitpoints
6138
+ };
6139
+ $[3] = t3;
6140
+ } else t3 = $[3];
6141
+ const armor = useAttribute("armorHP", t3);
5091
6142
  let t4;
5092
6143
  if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
5093
- t3 = /* @__PURE__ */ jsx(RepairRate, {});
5094
- t4 = damageTypes.map(_temp);
5095
- $[4] = t3;
5096
- $[5] = t4;
5097
- } else {
5098
- t3 = $[4];
5099
- t4 = $[5];
5100
- }
6144
+ t4 = {
6145
+ decimals: 0,
6146
+ format: hitpoints
6147
+ };
6148
+ $[4] = t4;
6149
+ } else t4 = $[4];
6150
+ const structure = useAttribute("hp", t4);
6151
+ const recharges = !useSnapshot().stats.structure;
5101
6152
  let t5;
5102
- if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
5103
- t5 = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(AttributeTooltip, { attribute: "shieldCapacity" }), /* @__PURE__ */ jsx(AttributeTooltip, { attribute: "shieldRechargeRate" })] });
6153
+ if ($[5] !== ehp) {
6154
+ t5 = /* @__PURE__ */ jsx(AttributeText, { value: ehp });
6155
+ $[5] = ehp;
5104
6156
  $[6] = t5;
5105
6157
  } else t5 = $[6];
5106
6158
  let t6;
5107
- if ($[7] !== shield) {
5108
- t6 = /* @__PURE__ */ jsx(AttributeText, { value: shield });
5109
- $[7] = shield;
5110
- $[8] = t6;
5111
- } else t6 = $[8];
5112
6159
  let t7;
5113
- if ($[9] !== shieldRecharge) {
5114
- t7 = /* @__PURE__ */ jsx(AttributeText, { value: shieldRecharge });
5115
- $[9] = shieldRecharge;
5116
- $[10] = t7;
5117
- } else t7 = $[10];
5118
- let t8;
5119
- if ($[11] !== t6 || $[12] !== t7) {
5120
- t8 = /* @__PURE__ */ jsx(Stat, {
5121
- icon: "stat-shield-hp",
5122
- label: "Shield Hitpoints / Recharge Time",
5123
- tooltip: t5,
5124
- children: /* @__PURE__ */ jsxs("span", {
5125
- className: ShipStatistics_module_default.lines,
5126
- children: [t6, t7]
5127
- })
5128
- });
5129
- $[11] = t6;
5130
- $[12] = t7;
5131
- $[13] = t8;
5132
- } else t8 = $[13];
6160
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
6161
+ t6 = /* @__PURE__ */ jsx(RepairRate, {});
6162
+ t7 = damageTypes.map(_temp);
6163
+ $[7] = t6;
6164
+ $[8] = t7;
6165
+ } else {
6166
+ t6 = $[7];
6167
+ t7 = $[8];
6168
+ }
6169
+ const t8 = recharges ? "Shield Hitpoints / Recharge Time" : "Shield Hitpoints";
5133
6170
  let t9;
5134
- if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
5135
- t9 = /* @__PURE__ */ jsx(Resistances, { layer: "shield" });
5136
- $[14] = t9;
5137
- } else t9 = $[14];
6171
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
6172
+ t9 = /* @__PURE__ */ jsx(AttributeTooltip, { attribute: "shieldCapacity" });
6173
+ $[9] = t9;
6174
+ } else t9 = $[9];
5138
6175
  let t10;
5139
- if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
5140
- t10 = /* @__PURE__ */ jsx(AttributeTooltip, { attribute: "armorHP" });
5141
- $[15] = t10;
5142
- } else t10 = $[15];
6176
+ if ($[10] !== recharges) {
6177
+ t10 = recharges && /* @__PURE__ */ jsx(AttributeTooltip, { attribute: "shieldRechargeRate" });
6178
+ $[10] = recharges;
6179
+ $[11] = t10;
6180
+ } else t10 = $[11];
5143
6181
  let t11;
5144
- if ($[16] !== armor) {
5145
- t11 = /* @__PURE__ */ jsx(Stat, {
5146
- icon: "stat-armor-hp",
5147
- label: "Armor Hitpoints",
5148
- tooltip: t10,
5149
- children: /* @__PURE__ */ jsx(AttributeText, { value: armor })
5150
- });
5151
- $[16] = armor;
5152
- $[17] = t11;
5153
- } else t11 = $[17];
6182
+ if ($[12] !== t10) {
6183
+ t11 = /* @__PURE__ */ jsxs(Fragment, { children: [t9, t10] });
6184
+ $[12] = t10;
6185
+ $[13] = t11;
6186
+ } else t11 = $[13];
5154
6187
  let t12;
5155
- if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
5156
- t12 = /* @__PURE__ */ jsx(Resistances, { layer: "armor" });
5157
- $[18] = t12;
5158
- } else t12 = $[18];
6188
+ if ($[14] !== shield) {
6189
+ t12 = /* @__PURE__ */ jsx(AttributeText, { value: shield });
6190
+ $[14] = shield;
6191
+ $[15] = t12;
6192
+ } else t12 = $[15];
5159
6193
  let t13;
5160
- if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
5161
- t13 = /* @__PURE__ */ jsx(AttributeTooltip, { attribute: "hp" });
5162
- $[19] = t13;
5163
- } else t13 = $[19];
6194
+ if ($[16] !== recharges || $[17] !== shieldRecharge) {
6195
+ t13 = recharges && /* @__PURE__ */ jsx(AttributeText, { value: shieldRecharge });
6196
+ $[16] = recharges;
6197
+ $[17] = shieldRecharge;
6198
+ $[18] = t13;
6199
+ } else t13 = $[18];
5164
6200
  let t14;
5165
- if ($[20] !== structure) {
5166
- t14 = /* @__PURE__ */ jsx(Stat, {
5167
- icon: "stat-structure-hp",
5168
- label: "Structure Hitpoints",
5169
- tooltip: t13,
5170
- children: /* @__PURE__ */ jsx(AttributeText, { value: structure })
6201
+ if ($[19] !== t12 || $[20] !== t13) {
6202
+ t14 = /* @__PURE__ */ jsxs("span", {
6203
+ className: ShipStatistics_module_default.lines,
6204
+ children: [t12, t13]
5171
6205
  });
5172
- $[20] = structure;
6206
+ $[19] = t12;
6207
+ $[20] = t13;
5173
6208
  $[21] = t14;
5174
6209
  } else t14 = $[21];
5175
6210
  let t15;
5176
- if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
5177
- t15 = /* @__PURE__ */ jsx(Resistances, { layer: "structure" });
5178
- $[22] = t15;
5179
- } else t15 = $[22];
6211
+ if ($[22] !== t11 || $[23] !== t14 || $[24] !== t8) {
6212
+ t15 = /* @__PURE__ */ jsx(Stat, {
6213
+ icon: "stat-shield-hp",
6214
+ label: t8,
6215
+ tooltip: t11,
6216
+ children: t14
6217
+ });
6218
+ $[22] = t11;
6219
+ $[23] = t14;
6220
+ $[24] = t8;
6221
+ $[25] = t15;
6222
+ } else t15 = $[25];
5180
6223
  let t16;
5181
- if ($[23] !== t11 || $[24] !== t14 || $[25] !== t8) {
5182
- t16 = /* @__PURE__ */ jsxs("div", {
6224
+ if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
6225
+ t16 = /* @__PURE__ */ jsx(Resistances, { layer: "shield" });
6226
+ $[26] = t16;
6227
+ } else t16 = $[26];
6228
+ let t17;
6229
+ if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
6230
+ t17 = /* @__PURE__ */ jsx(AttributeTooltip, { attribute: "armorHP" });
6231
+ $[27] = t17;
6232
+ } else t17 = $[27];
6233
+ let t18;
6234
+ if ($[28] !== armor) {
6235
+ t18 = /* @__PURE__ */ jsx(Stat, {
6236
+ icon: "stat-armor-hp",
6237
+ label: "Armor Hitpoints",
6238
+ tooltip: t17,
6239
+ children: /* @__PURE__ */ jsx(AttributeText, { value: armor })
6240
+ });
6241
+ $[28] = armor;
6242
+ $[29] = t18;
6243
+ } else t18 = $[29];
6244
+ let t19;
6245
+ if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
6246
+ t19 = /* @__PURE__ */ jsx(Resistances, { layer: "armor" });
6247
+ $[30] = t19;
6248
+ } else t19 = $[30];
6249
+ let t20;
6250
+ if ($[31] === Symbol.for("react.memo_cache_sentinel")) {
6251
+ t20 = /* @__PURE__ */ jsx(AttributeTooltip, { attribute: "hp" });
6252
+ $[31] = t20;
6253
+ } else t20 = $[31];
6254
+ let t21;
6255
+ if ($[32] !== structure) {
6256
+ t21 = /* @__PURE__ */ jsx(Stat, {
6257
+ icon: "stat-structure-hp",
6258
+ label: "Structure Hitpoints",
6259
+ tooltip: t20,
6260
+ children: /* @__PURE__ */ jsx(AttributeText, { value: structure })
6261
+ });
6262
+ $[32] = structure;
6263
+ $[33] = t21;
6264
+ } else t21 = $[33];
6265
+ let t22;
6266
+ if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
6267
+ t22 = /* @__PURE__ */ jsx(Resistances, { layer: "structure" });
6268
+ $[34] = t22;
6269
+ } else t22 = $[34];
6270
+ let t23;
6271
+ if ($[35] !== t15 || $[36] !== t18 || $[37] !== t21) {
6272
+ t23 = /* @__PURE__ */ jsxs("div", {
5183
6273
  className: ShipStatistics_module_default.defense,
5184
6274
  children: [
5185
- t3,
5186
- t4,
5187
- t8,
5188
- t9,
5189
- t11,
5190
- t12,
5191
- t14,
5192
- t15
6275
+ t6,
6276
+ t7,
6277
+ t15,
6278
+ t16,
6279
+ t18,
6280
+ t19,
6281
+ t21,
6282
+ t22
5193
6283
  ]
5194
6284
  });
5195
- $[23] = t11;
5196
- $[24] = t14;
5197
- $[25] = t8;
5198
- $[26] = t16;
5199
- } else t16 = $[26];
5200
- let t17;
5201
- if ($[27] !== t16 || $[28] !== t2) {
5202
- t17 = /* @__PURE__ */ jsx(StatsSection, {
6285
+ $[35] = t15;
6286
+ $[36] = t18;
6287
+ $[37] = t21;
6288
+ $[38] = t23;
6289
+ } else t23 = $[38];
6290
+ let t24;
6291
+ if ($[39] !== t23 || $[40] !== t5) {
6292
+ t24 = /* @__PURE__ */ jsx(StatsSection, {
5203
6293
  title: "Defense",
5204
- summary: t2,
5205
- children: t16
6294
+ summary: t5,
6295
+ children: t23
5206
6296
  });
5207
- $[27] = t16;
5208
- $[28] = t2;
5209
- $[29] = t17;
5210
- } else t17 = $[29];
5211
- return t17;
6297
+ $[39] = t23;
6298
+ $[40] = t5;
6299
+ $[41] = t24;
6300
+ } else t24 = $[41];
6301
+ return t24;
5212
6302
  }
5213
6303
  function _temp(damage) {
5214
6304
  return /* @__PURE__ */ jsx(Icon, { name: `stat-${damage}-resistance` }, damage);
@@ -5347,6 +6437,76 @@ function DroneStats() {
5347
6437
  return t12;
5348
6438
  }
5349
6439
  //#endregion
6440
+ //#region ../fitting/src/rules/attributes.ts
6441
+ /** A type's value for an attribute as the SDE has it, before any effect applies. */
6442
+ function baseValue(sde, type, name) {
6443
+ const id = sde.attributeId(name);
6444
+ return id === void 0 ? void 0 : type.attributes.get(id);
6445
+ }
6446
+ //#endregion
6447
+ //#region src/components/ShipStatistics/FighterStats.tsx
6448
+ function FighterStats() {
6449
+ const $ = c(10);
6450
+ const sde = useSde();
6451
+ const { fit } = useShownSnapshot();
6452
+ let full = 0;
6453
+ let partial = 0;
6454
+ for (const item of fit.items) {
6455
+ const type = item.slot.type === "fighter_tube" ? sde.type(item.type_id) : void 0;
6456
+ if (type === void 0) continue;
6457
+ if ((item.quantity ?? 1) >= (baseValue(sde, type, "fighterSquadronMaxSize") ?? 1)) full = full + 1;
6458
+ else partial = partial + 1;
6459
+ }
6460
+ let t0;
6461
+ if ($[0] !== full) {
6462
+ t0 = /* @__PURE__ */ jsxs("span", { children: [full, " Full Squadrons"] });
6463
+ $[0] = full;
6464
+ $[1] = t0;
6465
+ } else t0 = $[1];
6466
+ let t1;
6467
+ if ($[2] !== partial) {
6468
+ t1 = /* @__PURE__ */ jsxs("span", { children: [partial, " Partial Squadrons"] });
6469
+ $[2] = partial;
6470
+ $[3] = t1;
6471
+ } else t1 = $[3];
6472
+ let t2;
6473
+ if ($[4] !== t0 || $[5] !== t1) {
6474
+ t2 = /* @__PURE__ */ jsxs("span", {
6475
+ className: ShipStatistics_module_default.lines,
6476
+ children: [t0, t1]
6477
+ });
6478
+ $[4] = t0;
6479
+ $[5] = t1;
6480
+ $[6] = t2;
6481
+ } else t2 = $[6];
6482
+ let t3;
6483
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
6484
+ t3 = /* @__PURE__ */ jsx(Tooltip, {
6485
+ label: "Manage (not implemented yet)",
6486
+ children: /* @__PURE__ */ jsx("button", {
6487
+ type: "button",
6488
+ className: ShipStatistics_module_default.manage,
6489
+ "aria-disabled": true,
6490
+ children: "Manage"
6491
+ })
6492
+ });
6493
+ $[7] = t3;
6494
+ } else t3 = $[7];
6495
+ let t4;
6496
+ if ($[8] !== t2) {
6497
+ t4 = /* @__PURE__ */ jsx(StatsSection, {
6498
+ title: "Fighters",
6499
+ children: /* @__PURE__ */ jsxs("div", {
6500
+ className: ShipStatistics_module_default.fighters,
6501
+ children: [t2, t3]
6502
+ })
6503
+ });
6504
+ $[8] = t2;
6505
+ $[9] = t4;
6506
+ } else t4 = $[9];
6507
+ return t4;
6508
+ }
6509
+ //#endregion
5350
6510
  //#region src/components/ShipStatistics/FitPrice.tsx
5351
6511
  function FitPrice(t0) {
5352
6512
  const $ = c(5);
@@ -5384,6 +6544,48 @@ function FitPrice(t0) {
5384
6544
  return t4;
5385
6545
  }
5386
6546
  //#endregion
6547
+ //#region src/components/ShipStatistics/FuelStats.tsx
6548
+ function FuelStats() {
6549
+ const $ = c(8);
6550
+ const perDay = useStats().fuel * 24;
6551
+ const before = useSnapshot().stats.fuel * 24;
6552
+ let t0;
6553
+ if ($[0] !== perDay) {
6554
+ t0 = formatNumber(perDay, { decimals: 0 });
6555
+ $[0] = perDay;
6556
+ $[1] = t0;
6557
+ } else t0 = $[1];
6558
+ const t1 = `${t0} units/day`;
6559
+ const t2 = perDay === before ? void 0 : perDay < before ? "better" : "worse";
6560
+ let t3;
6561
+ if ($[2] !== perDay || $[3] !== t1 || $[4] !== t2) {
6562
+ t3 = {
6563
+ value: perDay,
6564
+ text: t1,
6565
+ change: t2
6566
+ };
6567
+ $[2] = perDay;
6568
+ $[3] = t1;
6569
+ $[4] = t2;
6570
+ $[5] = t3;
6571
+ } else t3 = $[5];
6572
+ const fuel = t3;
6573
+ let t4;
6574
+ if ($[6] !== fuel) {
6575
+ t4 = /* @__PURE__ */ jsx(StatsSection, {
6576
+ title: "Fuel",
6577
+ children: /* @__PURE__ */ jsx(Stat, {
6578
+ icon: "stat-fuel",
6579
+ label: "Fuel Usage",
6580
+ children: /* @__PURE__ */ jsx(AttributeText, { value: fuel })
6581
+ })
6582
+ });
6583
+ $[6] = fuel;
6584
+ $[7] = t4;
6585
+ } else t4 = $[7];
6586
+ return t4;
6587
+ }
6588
+ //#endregion
5387
6589
  //#region src/components/ShipStatistics/NavigationStats.tsx
5388
6590
  function NavigationStats() {
5389
6591
  const $ = c(24);
@@ -5779,41 +6981,61 @@ function TargetingStats() {
5779
6981
  //#region src/components/ShipStatistics/ShipStatistics.tsx
5780
6982
  /** EVE's statistics of the fit, as its fitting window shows them. */
5781
6983
  function ShipStatistics(t0) {
5782
- const $ = c(4);
6984
+ const $ = c(10);
5783
6985
  const { label: t1 } = t0;
5784
6986
  const label = t1 === void 0 ? "Statistics" : t1;
6987
+ const { structure } = useSnapshot().stats;
5785
6988
  let t2;
5786
6989
  let t3;
6990
+ let t4;
6991
+ let t5;
5787
6992
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
5788
- t2 = /* @__PURE__ */ jsxs("div", {
5789
- className: ShipStatistics_module_default.sections,
5790
- children: [
5791
- /* @__PURE__ */ jsx(CapacitorStats, {}),
5792
- /* @__PURE__ */ jsx(OffenseStats, {}),
5793
- /* @__PURE__ */ jsx(DefenseStats, {}),
5794
- /* @__PURE__ */ jsx(TargetingStats, {}),
5795
- /* @__PURE__ */ jsx(NavigationStats, {}),
5796
- /* @__PURE__ */ jsx(DroneStats, {})
5797
- ]
5798
- });
5799
- t3 = /* @__PURE__ */ jsx(FitPrice, { price: 0 });
6993
+ t2 = /* @__PURE__ */ jsx(CapacitorStats, {});
6994
+ t3 = /* @__PURE__ */ jsx(OffenseStats, {});
6995
+ t4 = /* @__PURE__ */ jsx(DefenseStats, {});
6996
+ t5 = /* @__PURE__ */ jsx(TargetingStats, {});
5800
6997
  $[0] = t2;
5801
6998
  $[1] = t3;
6999
+ $[2] = t4;
7000
+ $[3] = t5;
5802
7001
  } else {
5803
7002
  t2 = $[0];
5804
7003
  t3 = $[1];
7004
+ t4 = $[2];
7005
+ t5 = $[3];
5805
7006
  }
5806
- let t4;
5807
- if ($[2] !== label) {
5808
- t4 = /* @__PURE__ */ jsxs("section", {
7007
+ let t6;
7008
+ if ($[4] !== structure) {
7009
+ t6 = /* @__PURE__ */ jsxs("div", {
7010
+ className: ShipStatistics_module_default.sections,
7011
+ children: [
7012
+ t2,
7013
+ t3,
7014
+ t4,
7015
+ t5,
7016
+ structure ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(FighterStats, {}), /* @__PURE__ */ jsx(FuelStats, {})] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(NavigationStats, {}), /* @__PURE__ */ jsx(DroneStats, {})] })
7017
+ ]
7018
+ });
7019
+ $[4] = structure;
7020
+ $[5] = t6;
7021
+ } else t6 = $[5];
7022
+ let t7;
7023
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
7024
+ t7 = /* @__PURE__ */ jsx(FitPrice, { price: 0 });
7025
+ $[6] = t7;
7026
+ } else t7 = $[6];
7027
+ let t8;
7028
+ if ($[7] !== label || $[8] !== t6) {
7029
+ t8 = /* @__PURE__ */ jsxs("section", {
5809
7030
  className: ShipStatistics_module_default.statistics,
5810
7031
  "aria-label": label,
5811
- children: [t2, t3]
7032
+ children: [t6, t7]
5812
7033
  });
5813
- $[2] = label;
5814
- $[3] = t4;
5815
- } else t4 = $[3];
5816
- return t4;
7034
+ $[7] = label;
7035
+ $[8] = t6;
7036
+ $[9] = t8;
7037
+ } else t8 = $[9];
7038
+ return t8;
5817
7039
  }
5818
7040
  //#endregion
5819
7041
  export { CapacitorRing, CapacitorStats, DefenseStats, Dialog, DroneStats, FilterToggle, FitPrice, FittingWheel, FittingWindow, HistoryBar, Icon, ItemBrowser, NavigationStats, OffenseStats, RepairRate, ResistanceBar, Resistances, ShipStatistics, Stat, StatsSection, TargetingStats, Tooltip, TooltipText, TreeGroup, TreeLeaf, TreeList, TypeIcon, Wheel, WheelGauge, WheelHardpoints, WheelHull, WheelRackMarker, WheelSlot, iconNames, rackSize, slotAngle };