@eveshipfit/ui-ingame 1.13.0 → 1.15.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.
Files changed (3) hide show
  1. package/dist/index.mjs +2042 -1113
  2. package/dist/style.css +1398 -1248
  3. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import './style.css';
2
2
  import { c } from "react/compiler-runtime";
3
- import { Activity, Fragment, createContext, useContext, useDeferredValue, useEffect, useEffectEvent, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
3
+ import { Activity, Fragment, createContext, useContext, useDeferredValue, useEffect, useEffectEvent, useId, useLayoutEffect, useRef, useState } from "react";
4
4
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
5
- import { UNIFORM, formatAttribute, formatClock, formatDuration, formatNumber, useAttribute, useAttributeTooltip, useBayContents, useBayUsage, useBoosters, useBrowse, useCanFit, useChargeSearch, useChargeTree, useChargedModules, useCharges, useDamageProfiles, useDrag, useDroneRoom, useEngine, useFighterTubeUsage, useFighterTubes, useFit, useFitHistory, useFitPrice, useFitStore, useHardpoints, useHasRoom, useHullRefuses, useHullTree, useImages, useImplantSearch, useImplantTree, useImplants, useInfo, useLocalFits, useMissingSkills, useModes, useModuleSearch, useModuleTree, useMutate, usePersonalFits, usePlacement, usePreview, useRackUsage, useRefusal, useSde, useShowInfo, useShownSnapshot, useSlots, useSnapshot, useStats, useType, useTypeBonuses, useTypePrice } from "@eveshipfit/react-hooks";
6
- import { baseValue, canMutate, mutaplasmidsOf, mutationRanges, mutationRollOf, parseItemLink, parseMutationText, rollFits, rollMutation, squadronSize, tubeTakes } from "@eveshipfit/fitting";
5
+ import { UNIFORM, canSaveFits, formatAttribute, formatClock, formatDuration, formatNumber, useAttribute, useAttributeTooltip, useBayContents, useBayUsage, useBoosters, useBrowse, useCanFit, useCharacters, useChargeSearch, useChargeTree, useChargedModules, useCharges, useDamageProfiles, useDrag, useDroneRoom, useEngine, useFighterTubeUsage, useFighterTubes, useFit, useFitHistory, useFitPrice, useFitSaving, useFitStore, useHardpoints, useHasRoom, useHullRefuses, useHullTree, useImages, useImplantSearch, useImplantTree, useImplants, useInfo, useLocalFits, useMissingSkills, useModes, useModuleSearch, useModuleTree, useMutate, usePersonalFits, usePlacement, usePreview, useRackUsage, useRefusal, useSde, useShowInfo, useShownSnapshot, useSlots, useSnapshot, useStats, useType, useTypeBonuses, useTypePrice } from "@eveshipfit/react-hooks";
6
+ import { baseValue, canMutate, clampToRange, mutaplasmidsOf, mutatedDronesOf, mutationRanges, mutationRollOf, parseItemLink, parseMutationText, rollFits, rollMutation, squadronSize, tubeTakes, withMutaplasmid } from "@eveshipfit/fitting";
7
7
  // src/primitives/Dialog/Dialog.module.css
8
8
  var Dialog_module_default = {
9
9
  "close": "kwi1cG_close",
@@ -978,7 +978,7 @@ function SlotPress(t0) {
978
978
  className,
979
979
  "aria-label": label,
980
980
  onClick: onPress,
981
- onKeyDown: _temp$23
981
+ onKeyDown: _temp$25
982
982
  });
983
983
  $[0] = className;
984
984
  $[1] = label;
@@ -987,7 +987,7 @@ function SlotPress(t0) {
987
987
  } else t1 = $[3];
988
988
  return t1;
989
989
  }
990
- function _temp$23(event) {
990
+ function _temp$25(event) {
991
991
  if (event.key !== "Enter" && event.key !== " ") return;
992
992
  event.preventDefault();
993
993
  event.currentTarget.dispatchEvent(new MouseEvent("click", {
@@ -1403,7 +1403,7 @@ function useDecoded(src) {
1403
1403
  image.decode().then(() => {
1404
1404
  decoded.add(src);
1405
1405
  setReady(src);
1406
- }, _temp$22);
1406
+ }, _temp$24);
1407
1407
  };
1408
1408
  t1 = [src];
1409
1409
  $[0] = src;
@@ -1423,7 +1423,7 @@ function useDecoded(src) {
1423
1423
  } else t2 = $[5];
1424
1424
  return t2;
1425
1425
  }
1426
- function _temp$22() {}
1426
+ function _temp$24() {}
1427
1427
  function WheelGauge(t0) {
1428
1428
  const $ = c(15);
1429
1429
  const { resource, used, total, valueText } = t0;
@@ -1898,18 +1898,19 @@ function Menu(t0) {
1898
1898
  role: "menu",
1899
1899
  tabIndex: -1,
1900
1900
  onToggle: t4,
1901
- onKeyDown: _temp$21,
1901
+ onKeyDown: _temp$23,
1902
1902
  onClick: stopped,
1903
1903
  onDoubleClick: stopped,
1904
1904
  onPointerDown: stopped,
1905
1905
  onMouseDown: stopped,
1906
- onContextMenu: _temp2$11,
1906
+ onContextMenu: _temp2$12,
1907
1907
  children: opened.entries.map((entry, index) => entry === "separator" ? /* @__PURE__ */ jsx("hr", { className: ContextMenu_module_default.separator }, index) : /* @__PURE__ */ jsxs("button", {
1908
1908
  type: "button",
1909
1909
  role: "menuitem",
1910
1910
  tabIndex: -1,
1911
+ disabled: entry.disabled,
1911
1912
  onClick: () => select(entry),
1912
- onPointerMove: _temp3$6,
1913
+ onPointerMove: _temp3$5,
1913
1914
  children: [/* @__PURE__ */ jsx("span", {
1914
1915
  className: ContextMenu_module_default.icon,
1915
1916
  children: entry.icon && /* @__PURE__ */ jsx(Icon, { name: entry.icon })
@@ -1922,19 +1923,19 @@ function Menu(t0) {
1922
1923
  } else t3 = $[7];
1923
1924
  return t3;
1924
1925
  }
1925
- function _temp3$6(event_2) {
1926
+ function _temp3$5(event_2) {
1926
1927
  return event_2.currentTarget.focus();
1927
1928
  }
1928
- function _temp2$11(event_1) {
1929
+ function _temp2$12(event_1) {
1929
1930
  event_1.preventDefault();
1930
1931
  event_1.stopPropagation();
1931
1932
  }
1932
- function _temp$21(event_0) {
1933
+ function _temp$23(event_0) {
1933
1934
  event_0.stopPropagation();
1934
1935
  walk(event_0);
1935
1936
  }
1936
1937
  function walk(event) {
1937
- const items = [...event.currentTarget.querySelectorAll("[role=menuitem]")];
1938
+ const items = [...event.currentTarget.querySelectorAll("[role=menuitem]:enabled")];
1938
1939
  const index = items.indexOf(document.activeElement);
1939
1940
  let next;
1940
1941
  switch (event.key) {
@@ -2827,7 +2828,7 @@ function SensorStrengths(t0) {
2827
2828
  if ($[0] !== strengths) {
2828
2829
  t4 = Symbol.for("react.early_return_sentinel");
2829
2830
  bb0: {
2830
- const shown = strengths.filter(_temp$20);
2831
+ const shown = strengths.filter(_temp$22);
2831
2832
  if (shown.length === 0) {
2832
2833
  t4 = null;
2833
2834
  break bb0;
@@ -2835,7 +2836,7 @@ function SensorStrengths(t0) {
2835
2836
  T0 = Attribute;
2836
2837
  t3 = "ECMResistance";
2837
2838
  t1 = ModuleTooltip_module_default.block;
2838
- t2 = shown.map(_temp2$10);
2839
+ t2 = shown.map(_temp2$11);
2839
2840
  }
2840
2841
  $[0] = strengths;
2841
2842
  $[1] = T0;
@@ -2875,14 +2876,14 @@ function SensorStrengths(t0) {
2875
2876
  return t6;
2876
2877
  }
2877
2878
  /** The four ECM jammer strengths, like "5.8 Gravimetric ECM Jammer Strength". */
2878
- function _temp2$10(strength) {
2879
+ function _temp2$11(strength) {
2879
2880
  return /* @__PURE__ */ jsxs("span", { children: [
2880
2881
  strength.text,
2881
2882
  " ",
2882
2883
  strength.displayName
2883
2884
  ] }, strength.name);
2884
2885
  }
2885
- function _temp$20(t0) {
2886
+ function _temp$22(t0) {
2886
2887
  const { value } = t0;
2887
2888
  return value;
2888
2889
  }
@@ -2929,14 +2930,14 @@ function Cloak(t0) {
2929
2930
  itemRef,
2930
2931
  name: "maxVelocityModifier",
2931
2932
  decimals: 0,
2932
- format: _temp$19
2933
+ format: _temp$21
2933
2934
  });
2934
2935
  $[0] = itemRef;
2935
2936
  $[1] = t1;
2936
2937
  } else t1 = $[1];
2937
2938
  return t1;
2938
2939
  }
2939
- function _temp$19(value, format) {
2940
+ function _temp$21(value, format) {
2940
2941
  return percent$1((value - 1) * 100, format);
2941
2942
  }
2942
2943
  // src/components/FittingWheel/ModuleLines/CommandBonus.tsx
@@ -3670,7 +3671,7 @@ function Resistance$1(t0) {
3670
3671
  const t1 = useLayers(itemRef);
3671
3672
  let t2;
3672
3673
  if ($[0] !== t1) {
3673
- const layers = t1.filter(_temp2$9);
3674
+ const layers = t1.filter(_temp2$10);
3674
3675
  t2 = layers.map((layer) => /* @__PURE__ */ jsx(Layer, {
3675
3676
  ...layer,
3676
3677
  withIcon: layers.length > 1
@@ -3681,11 +3682,11 @@ function Resistance$1(t0) {
3681
3682
  return t2;
3682
3683
  }
3683
3684
  /** The resistances a module gives, for every layer. */
3684
- function _temp2$9(t0) {
3685
+ function _temp2$10(t0) {
3685
3686
  const { resistances } = t0;
3686
- return resistances.some(_temp$18);
3687
+ return resistances.some(_temp$20);
3687
3688
  }
3688
- function _temp$18(t0) {
3689
+ function _temp$20(t0) {
3689
3690
  const { value } = t0;
3690
3691
  return value !== 1;
3691
3692
  }
@@ -3695,13 +3696,13 @@ function DamageControl(t0) {
3695
3696
  const t1 = useLayers(itemRef);
3696
3697
  let t2;
3697
3698
  if ($[0] !== t1) {
3698
- t2 = t1.map(_temp3$5);
3699
+ t2 = t1.map(_temp3$4);
3699
3700
  $[0] = t1;
3700
3701
  $[1] = t2;
3701
3702
  } else t2 = $[1];
3702
3703
  return t2;
3703
3704
  }
3704
- function _temp3$5(layer) {
3705
+ function _temp3$4(layer) {
3705
3706
  return /* @__PURE__ */ jsx(Layer, {
3706
3707
  ...layer,
3707
3708
  withIcon: true
@@ -3892,7 +3893,7 @@ function ResistanceBonus(t0) {
3892
3893
  t3,
3893
3894
  t4,
3894
3895
  t5
3895
- ].filter(_temp$17);
3896
+ ].filter(_temp$19);
3896
3897
  const [first] = bonuses;
3897
3898
  if (first === void 0) {
3898
3899
  t6 = null;
@@ -3927,7 +3928,7 @@ function ResistanceBonus(t0) {
3927
3928
  className: ModuleTooltip_module_default.block,
3928
3929
  children: ["Resistance Bonus:", /* @__PURE__ */ jsx("span", {
3929
3930
  className: ModuleTooltip_module_default.bonuses,
3930
- children: bonuses.map(_temp2$8)
3931
+ children: bonuses.map(_temp2$9)
3931
3932
  })]
3932
3933
  });
3933
3934
  $[7] = bonuses;
@@ -3935,14 +3936,14 @@ function ResistanceBonus(t0) {
3935
3936
  } else t7 = $[8];
3936
3937
  return t7;
3937
3938
  }
3938
- function _temp2$8(t0) {
3939
+ function _temp2$9(t0) {
3939
3940
  const { name, text } = t0;
3940
3941
  return /* @__PURE__ */ jsx(Bonus, {
3941
3942
  name,
3942
3943
  text
3943
3944
  }, name);
3944
3945
  }
3945
- function _temp$17(bonus) {
3946
+ function _temp$19(bonus) {
3946
3947
  return bonus.value;
3947
3948
  }
3948
3949
  // src/components/FittingWheel/ModuleLines/SensorBooster.tsx
@@ -4043,14 +4044,14 @@ function SignatureSuppressor(t0) {
4043
4044
  itemRef,
4044
4045
  name: "signatureSuppressorSignatureRadiusBonusPassive",
4045
4046
  decimals: 0,
4046
- format: _temp$16
4047
+ format: _temp$18
4047
4048
  });
4048
4049
  $[0] = itemRef;
4049
4050
  $[1] = t1;
4050
4051
  } else t1 = $[1];
4051
4052
  return t1;
4052
4053
  }
4053
- function _temp$16(value, format) {
4054
+ function _temp$18(value, format) {
4054
4055
  return percent$1((1 - value) * 100, format);
4055
4056
  }
4056
4057
  // src/components/FittingWheel/ModuleLines/Smartbomb.tsx
@@ -4151,7 +4152,7 @@ function StasisWebifier(props) {
4151
4152
  t0 = {
4152
4153
  of: props.itemRef,
4153
4154
  decimals: 0,
4154
- format: _temp$15
4155
+ format: _temp$17
4155
4156
  };
4156
4157
  $[0] = props.itemRef;
4157
4158
  $[1] = t0;
@@ -4181,7 +4182,7 @@ function StasisWebifier(props) {
4181
4182
  } else t3 = $[8];
4182
4183
  return t3;
4183
4184
  }
4184
- function _temp$15(value, format) {
4185
+ function _temp$17(value, format) {
4185
4186
  return percent$1(-value, format);
4186
4187
  }
4187
4188
  // src/components/FittingWheel/ModuleLines/TrackingComputer.tsx
@@ -5211,7 +5212,7 @@ function FittingAugmentations(t0) {
5211
5212
  const boosters = useBoosters();
5212
5213
  let t1;
5213
5214
  if ($[0] !== implants || $[1] !== readOnly) {
5214
- t1 = !readOnly || implants.some(_temp$14);
5215
+ t1 = !readOnly || implants.some(_temp$16);
5215
5216
  $[0] = implants;
5216
5217
  $[1] = readOnly;
5217
5218
  $[2] = t1;
@@ -5266,7 +5267,7 @@ function FittingAugmentations(t0) {
5266
5267
  } else t5 = $[15];
5267
5268
  return t5;
5268
5269
  }
5269
- function _temp$14(slot) {
5270
+ function _temp$16(slot) {
5270
5271
  return slot.item !== void 0;
5271
5272
  }
5272
5273
  function FittingAugmentation(t0) {
@@ -5540,6 +5541,21 @@ function FittingAugmentation(t0) {
5540
5541
  } else t20 = $[82];
5541
5542
  return t20;
5542
5543
  }
5544
+ // src/components/FittingWheel/fitLink.ts
5545
+ /** The eveship.fit link that opens the current fit. */
5546
+ function useFitLink() {
5547
+ const $ = c(3);
5548
+ const engine = useEngine();
5549
+ const fit = useFit();
5550
+ let t0;
5551
+ if ($[0] !== engine || $[1] !== fit) {
5552
+ t0 = engine.saveLink(fit);
5553
+ $[0] = engine;
5554
+ $[1] = fit;
5555
+ $[2] = t0;
5556
+ } else t0 = $[2];
5557
+ return `https://eveship.fit/?fit=${t0}`;
5558
+ }
5543
5559
  // src/components/FittingWheel/FittingWheel.module.css
5544
5560
  var FittingWheel_module_default = { "centre": "GK_wGG_centre" };
5545
5561
  // src/components/FittingWheel/FittingWheel.tsx
@@ -5605,11 +5621,8 @@ function onEveShipFit() {
5605
5621
  return location.hostname === "eveship.fit" || location.hostname.endsWith(".eveship.fit");
5606
5622
  }
5607
5623
  function EveShipFitLink({ text = "open on eveship.fit" }) {
5608
- const engine = useEngine();
5609
- const fit = useFit();
5610
- const href = useMemo(() => `https://eveship.fit/?fit=${engine.saveLink(fit)}`, [engine, fit]);
5611
5624
  return /* @__PURE__ */ jsx(WheelLink, {
5612
- href,
5625
+ href: useFitLink(),
5613
5626
  text
5614
5627
  });
5615
5628
  }
@@ -5706,9 +5719,9 @@ function FittingCentre() {
5706
5719
  })
5707
5720
  },
5708
5721
  "separator",
5709
- fit.items.some(_temp$13) && {
5722
+ fit.items.some(_temp$15) && {
5710
5723
  label: "Strip Fitting",
5711
- onSelect: () => store.remove(...store.getSnapshot().fit.items.flatMap(_temp2$7))
5724
+ onSelect: () => store.remove(...store.getSnapshot().fit.items.flatMap(_temp2$8))
5712
5725
  }
5713
5726
  ]);
5714
5727
  };
@@ -5800,10 +5813,10 @@ function FittingCentre() {
5800
5813
  } else t8 = $[43];
5801
5814
  return t8;
5802
5815
  }
5803
- function _temp2$7(item_0, ref) {
5816
+ function _temp2$8(item_0, ref) {
5804
5817
  return keptOnStrip.has(item_0.slot.type) ? [] : [ref];
5805
5818
  }
5806
- function _temp$13(item_1) {
5819
+ function _temp$15(item_1) {
5807
5820
  return !keptOnStrip.has(item_1.slot.type);
5808
5821
  }
5809
5822
  const copiedRacks = [
@@ -5917,7 +5930,7 @@ function FittingModes(t0) {
5917
5930
  if (modes.length === 0) return null;
5918
5931
  let t1;
5919
5932
  if ($[0] !== modes) {
5920
- t1 = modes.map(_temp3$4);
5933
+ t1 = modes.map(_temp3$3);
5921
5934
  $[0] = modes;
5922
5935
  $[1] = t1;
5923
5936
  } else t1 = $[1];
@@ -5942,7 +5955,7 @@ function FittingModes(t0) {
5942
5955
  } else t3 = $[8];
5943
5956
  return t3;
5944
5957
  }
5945
- function _temp3$4(t0) {
5958
+ function _temp3$3(t0) {
5946
5959
  const { id, name } = t0;
5947
5960
  return {
5948
5961
  typeId: id,
@@ -6103,6 +6116,204 @@ function ServiceSlot({ typeId, typeName, state = "online", available = true, pre
6103
6116
  })]
6104
6117
  });
6105
6118
  }
6119
+ // src/components/ItemBrowser/ItemBrowser.module.css
6120
+ var ItemBrowser_module_default = {
6121
+ "action": "xFSZwa_action",
6122
+ "actions": "xFSZwa_actions",
6123
+ "browser": "xFSZwa_browser",
6124
+ "collapse": "xFSZwa_collapse",
6125
+ "confirm": "xFSZwa_confirm",
6126
+ "copy": "xFSZwa_copy",
6127
+ "copyAnchor": "xFSZwa_copyAnchor",
6128
+ "count": "xFSZwa_count",
6129
+ "counts": "xFSZwa_counts",
6130
+ "dialogButtons": "xFSZwa_dialogButtons",
6131
+ "dragImage": "xFSZwa_dragImage",
6132
+ "empty": "xFSZwa_empty",
6133
+ "field": "xFSZwa_field",
6134
+ "filters": "xFSZwa_filters",
6135
+ "flyable": "xFSZwa_flyable",
6136
+ "form": "xFSZwa_form",
6137
+ "hull": "xFSZwa_hull",
6138
+ "importError": "xFSZwa_importError",
6139
+ "info": "xFSZwa_info",
6140
+ "kind": "xFSZwa_kind",
6141
+ "menu": "xFSZwa_menu",
6142
+ "menuRule": "xFSZwa_menuRule",
6143
+ "panel": "xFSZwa_panel",
6144
+ "saveAnchor": "xFSZwa_saveAnchor",
6145
+ "saveArrow": "xFSZwa_saveArrow",
6146
+ "saveMain": "xFSZwa_saveMain",
6147
+ "saveMenu": "xFSZwa_saveMenu",
6148
+ "saveName": "xFSZwa_saveName",
6149
+ "saveNote": "xFSZwa_saveNote",
6150
+ "saveUpgrade": "xFSZwa_saveUpgrade",
6151
+ "search": "xFSZwa_search",
6152
+ "simulate": "xFSZwa_simulate",
6153
+ "tab": "xFSZwa_tab",
6154
+ "tabs": "xFSZwa_tabs",
6155
+ "tick": "xFSZwa_tick",
6156
+ "tree": "xFSZwa_tree",
6157
+ "unseen": "xFSZwa_unseen",
6158
+ "views": "xFSZwa_views"
6159
+ };
6160
+ // src/components/ItemBrowser/copyFit.tsx
6161
+ const FLASH_MS = 2e3;
6162
+ /** Copies a fit to the clipboard, or shows it in `dialog` when the browser refuses; render `dialog` once. */
6163
+ function useCopyFit() {
6164
+ const $ = c(6);
6165
+ const engine = useEngine();
6166
+ const { copy, dialog } = useCopyText("Copy Fit", "fit", 12);
6167
+ let t0;
6168
+ if ($[0] !== copy || $[1] !== engine) {
6169
+ t0 = (fit, format, onCopied) => copy(engine.saveText(fit, format), onCopied);
6170
+ $[0] = copy;
6171
+ $[1] = engine;
6172
+ $[2] = t0;
6173
+ } else t0 = $[2];
6174
+ let t1;
6175
+ if ($[3] !== dialog || $[4] !== t0) {
6176
+ t1 = {
6177
+ copy: t0,
6178
+ dialog
6179
+ };
6180
+ $[3] = dialog;
6181
+ $[4] = t0;
6182
+ $[5] = t1;
6183
+ } else t1 = $[5];
6184
+ return t1;
6185
+ }
6186
+ /** Copies text to the clipboard, or shows it in `dialog` when the browser refuses; render `dialog` once. */
6187
+ function useCopyText(title, what, rows) {
6188
+ const $ = c(10);
6189
+ const [refused, setRefused] = useState();
6190
+ let t0;
6191
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
6192
+ t0 = (text, onCopied) => {
6193
+ Promise.resolve().then(() => navigator.clipboard.writeText(text)).then(onCopied, () => setRefused(text));
6194
+ };
6195
+ $[0] = t0;
6196
+ } else t0 = $[0];
6197
+ const copy = t0;
6198
+ const t1 = refused !== void 0;
6199
+ let t2;
6200
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
6201
+ t2 = () => setRefused(void 0);
6202
+ $[1] = t2;
6203
+ } else t2 = $[1];
6204
+ const t3 = refused ?? "";
6205
+ let t4;
6206
+ if ($[2] !== rows || $[3] !== t3 || $[4] !== what) {
6207
+ t4 = /* @__PURE__ */ jsx(CopyForm, {
6208
+ text: t3,
6209
+ what,
6210
+ rows
6211
+ });
6212
+ $[2] = rows;
6213
+ $[3] = t3;
6214
+ $[4] = what;
6215
+ $[5] = t4;
6216
+ } else t4 = $[5];
6217
+ let t5;
6218
+ if ($[6] !== t1 || $[7] !== t4 || $[8] !== title) {
6219
+ t5 = {
6220
+ copy,
6221
+ dialog: /* @__PURE__ */ jsx(Dialog, {
6222
+ open: t1,
6223
+ title,
6224
+ onClose: t2,
6225
+ children: t4
6226
+ })
6227
+ };
6228
+ $[6] = t1;
6229
+ $[7] = t4;
6230
+ $[8] = title;
6231
+ $[9] = t5;
6232
+ } else t5 = $[9];
6233
+ return t5;
6234
+ }
6235
+ /** `true` for a moment after calling the returned function. */
6236
+ function useFlash() {
6237
+ const $ = c(6);
6238
+ const [shown, setShown] = useState(0);
6239
+ let t0;
6240
+ let t1;
6241
+ if ($[0] !== shown) {
6242
+ t0 = () => {
6243
+ if (shown === 0) return;
6244
+ const timer = setTimeout(() => setShown(0), FLASH_MS);
6245
+ return () => clearTimeout(timer);
6246
+ };
6247
+ t1 = [shown];
6248
+ $[0] = shown;
6249
+ $[1] = t0;
6250
+ $[2] = t1;
6251
+ } else {
6252
+ t0 = $[1];
6253
+ t1 = $[2];
6254
+ }
6255
+ useEffect(t0, t1);
6256
+ const t2 = shown > 0;
6257
+ let t3;
6258
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
6259
+ t3 = () => setShown(Date.now());
6260
+ $[3] = t3;
6261
+ } else t3 = $[3];
6262
+ let t4;
6263
+ if ($[4] !== t2) {
6264
+ t4 = [t2, t3];
6265
+ $[4] = t2;
6266
+ $[5] = t4;
6267
+ } else t4 = $[5];
6268
+ return t4;
6269
+ }
6270
+ function CopyForm(t0) {
6271
+ const $ = c(10);
6272
+ const { text, what, rows } = t0;
6273
+ const id = useId();
6274
+ let t1;
6275
+ if ($[0] !== id || $[1] !== what) {
6276
+ t1 = /* @__PURE__ */ jsxs("label", {
6277
+ htmlFor: id,
6278
+ children: [
6279
+ "The browser blocked the clipboard. Copy the ",
6280
+ what,
6281
+ " from here."
6282
+ ]
6283
+ });
6284
+ $[0] = id;
6285
+ $[1] = what;
6286
+ $[2] = t1;
6287
+ } else t1 = $[2];
6288
+ let t2;
6289
+ if ($[3] !== id || $[4] !== rows || $[5] !== text) {
6290
+ t2 = /* @__PURE__ */ jsx("textarea", {
6291
+ id,
6292
+ rows,
6293
+ readOnly: true,
6294
+ value: text,
6295
+ onFocus: _temp$14
6296
+ });
6297
+ $[3] = id;
6298
+ $[4] = rows;
6299
+ $[5] = text;
6300
+ $[6] = t2;
6301
+ } else t2 = $[6];
6302
+ let t3;
6303
+ if ($[7] !== t1 || $[8] !== t2) {
6304
+ t3 = /* @__PURE__ */ jsxs("div", {
6305
+ className: ItemBrowser_module_default.form,
6306
+ children: [t1, t2]
6307
+ });
6308
+ $[7] = t1;
6309
+ $[8] = t2;
6310
+ $[9] = t3;
6311
+ } else t3 = $[9];
6312
+ return t3;
6313
+ }
6314
+ function _temp$14(event) {
6315
+ return event.currentTarget.select();
6316
+ }
6106
6317
  // src/components/ItemInfo/anchoredCard.ts
6107
6318
  /** Opens a popover card next to `anchor`; closes it when the anchor goes away or the page scrolls under it. */
6108
6319
  function useAnchoredCard(anchor, onClose) {
@@ -6596,7 +6807,7 @@ function Variations(t0) {
6596
6807
  const swapper = t6;
6597
6808
  let t7;
6598
6809
  if ($[18] !== anchor || $[19] !== sde || $[20] !== show || $[21] !== swapper || $[22] !== target.typeId || $[23] !== variations) {
6599
- const groups = Map.groupBy(variations, _temp$12);
6810
+ const groups = Map.groupBy(variations, _temp$13);
6600
6811
  t7 = /* @__PURE__ */ jsx("ul", {
6601
6812
  className: ItemInfo_module_default.list,
6602
6813
  children: [...groups].map((t8) => {
@@ -6629,7 +6840,7 @@ function Variations(t0) {
6629
6840
  } else t7 = $[24];
6630
6841
  return t7;
6631
6842
  }
6632
- function _temp$12(type_0) {
6843
+ function _temp$13(type_0) {
6633
6844
  return type_0.metaGroupId;
6634
6845
  }
6635
6846
  function Variation(t0) {
@@ -6735,6 +6946,9 @@ var Mutate_module_default = {
6735
6946
  "chartRoll": "yNZdnG_chartRoll",
6736
6947
  "chartRow": "yNZdnG_chartRow",
6737
6948
  "chartTitle": "yNZdnG_chartTitle",
6949
+ "chip": "yNZdnG_chip",
6950
+ "chipBar": "yNZdnG_chipBar",
6951
+ "chips": "yNZdnG_chips",
6738
6952
  "dice": "yNZdnG_dice",
6739
6953
  "error": "yNZdnG_error",
6740
6954
  "field": "yNZdnG_field",
@@ -6908,7 +7122,7 @@ function MutaplasmidPicker(t0) {
6908
7122
  tabIndex: -1,
6909
7123
  "data-active": mutaplasmid_0.id === active || void 0,
6910
7124
  onFocus: () => setActive(mutaplasmid_0.id),
6911
- onPointerMove: _temp$11,
7125
+ onPointerMove: _temp$12,
6912
7126
  onClick: () => choose(mutaplasmid_0.id),
6913
7127
  children: names[index_0]
6914
7128
  }, mutaplasmid_0.id))
@@ -6933,7 +7147,7 @@ function MutaplasmidPicker(t0) {
6933
7147
  } else t15 = $[24];
6934
7148
  return t15;
6935
7149
  }
6936
- function _temp$11(event_2) {
7150
+ function _temp$12(event_2) {
6937
7151
  return event_2.currentTarget.focus();
6938
7152
  }
6939
7153
  /** Each stat's range under one mutaplasmid, the widest one's behind it, and the roll. */
@@ -6956,7 +7170,7 @@ function RangeChart(t0) {
6956
7170
  if ($[7] !== rangesOf) {
6957
7171
  t3 = (t4) => {
6958
7172
  const { id } = t4;
6959
- return rangesOf(id).flatMap(_temp2$6);
7173
+ return rangesOf(id).flatMap(_temp2$7);
6960
7174
  };
6961
7175
  $[7] = rangesOf;
6962
7176
  $[8] = t3;
@@ -6987,7 +7201,7 @@ function RangeChart(t0) {
6987
7201
  let t7;
6988
7202
  if ($[12] !== at || $[13] !== mutaplasmids || $[14] !== names || $[15] !== rangesOf || $[16] !== roll.attributes || $[17] !== sde || $[18] !== shown) {
6989
7203
  const widest = mutaplasmids.at(-1)?.id ?? shown;
6990
- const behind = new Map(rangesOf(widest).map(_temp3$3));
7204
+ const behind = new Map(rangesOf(widest).map(_temp3$2));
6991
7205
  let t8;
6992
7206
  if ($[23] !== mutaplasmids || $[24] !== names) {
6993
7207
  t8 = (mutaplasmidId) => names[mutaplasmids.findIndex((t9) => {
@@ -7133,10 +7347,10 @@ function RangeChart(t0) {
7133
7347
  } else t14 = $[48];
7134
7348
  return t14;
7135
7349
  }
7136
- function _temp3$3(range_0) {
7350
+ function _temp3$2(range_0) {
7137
7351
  return [range_0.attributeId, range_0];
7138
7352
  }
7139
- function _temp2$6(range) {
7353
+ function _temp2$7(range) {
7140
7354
  return [ratio(range, range.min), ratio(range, range.max)];
7141
7355
  }
7142
7356
  function percent(value) {
@@ -7160,119 +7374,382 @@ function span(at, from, to) {
7160
7374
  function upIsGood(range) {
7161
7375
  return range.highIsGood === range.base >= 0;
7162
7376
  }
7163
- /** The names without the words they all end in, like "Large Shield Extender Mutaplasmid". */
7377
+ /** The names without the words they all have, like "Large Shield Extender Mutaplasmid". */
7164
7378
  function shortNames(names) {
7165
7379
  const words = names.map((name) => name.split(" "));
7166
- let shared = 0;
7167
- while (words.every((name) => name.length > shared + 1) && words.every((name) => name.at(-1 - shared) === words[0].at(-1 - shared))) shared++;
7168
- if (names.length === 1) shared = words[0].at(-1) === "Mutaplasmid" ? 1 : 0;
7169
- return words.map((name) => name.slice(0, name.length - shared).join(" "));
7380
+ if (words.length === 1) return [words[0].filter((word) => word !== "Mutaplasmid").join(" ")];
7381
+ const shared = words[0].filter((word) => words.every((name) => name.includes(word)));
7382
+ const short = words.map((name) => name.filter((word) => !shared.includes(word)).join(" "));
7383
+ return short.every((name) => name !== "") ? short : [...names];
7170
7384
  }
7171
7385
  // src/components/Mutate/Mutate.tsx
7172
7386
  const PREVIEW_TARGET = "mutate";
7173
- /** The window to roll a fitted module's mutation in, next to what asked for it. */
7387
+ /** The window to roll a fitted module's or the drones' mutation in, next to what asked for it. */
7174
7388
  function Mutate() {
7175
- const $ = c(20);
7389
+ const $ = c(9);
7176
7390
  const { shown, close } = useMutate();
7177
- const fit = useFit();
7178
- const sde = useSde();
7391
+ if (shown === void 0) return null;
7392
+ if (shown.slot.type === "drone_bay") {
7393
+ let t0;
7394
+ if ($[0] !== close || $[1] !== shown) {
7395
+ t0 = /* @__PURE__ */ jsx(MutateDrones, {
7396
+ shown,
7397
+ onClose: close
7398
+ }, shown.base);
7399
+ $[0] = close;
7400
+ $[1] = shown;
7401
+ $[2] = t0;
7402
+ } else t0 = $[2];
7403
+ return t0;
7404
+ }
7405
+ const t0 = shown.slot.type;
7406
+ let t1;
7407
+ if ($[3] !== shown.slot) {
7408
+ t1 = slotIndex(shown.slot);
7409
+ $[3] = shown.slot;
7410
+ $[4] = t1;
7411
+ } else t1 = $[4];
7412
+ const t2 = `${t0} ${t1}`;
7413
+ let t3;
7414
+ if ($[5] !== close || $[6] !== shown || $[7] !== t2) {
7415
+ t3 = /* @__PURE__ */ jsx(MutateModule, {
7416
+ shown,
7417
+ onClose: close
7418
+ }, t2);
7419
+ $[5] = close;
7420
+ $[6] = shown;
7421
+ $[7] = t2;
7422
+ $[8] = t3;
7423
+ } else t3 = $[8];
7424
+ return t3;
7425
+ }
7426
+ function useCloseWhenGone(gone, onClose) {
7427
+ const $ = c(5);
7428
+ const closeWhenGone = useEffectEvent(onClose);
7179
7429
  let t0;
7180
- if ($[0] !== fit || $[1] !== shown) {
7181
- t0 = shown === void 0 ? -1 : refIn(fit, shown.slot);
7182
- $[0] = fit;
7183
- $[1] = shown;
7430
+ if ($[0] !== closeWhenGone || $[1] !== gone) {
7431
+ t0 = () => {
7432
+ if (gone) closeWhenGone();
7433
+ };
7434
+ $[0] = closeWhenGone;
7435
+ $[1] = gone;
7184
7436
  $[2] = t0;
7185
7437
  } else t0 = $[2];
7186
- const ref = t0;
7438
+ let t1;
7439
+ if ($[3] !== gone) {
7440
+ t1 = [gone];
7441
+ $[3] = gone;
7442
+ $[4] = t1;
7443
+ } else t1 = $[4];
7444
+ useEffect(t0, t1);
7445
+ }
7446
+ function MutateModule(t0) {
7447
+ const $ = c(12);
7448
+ const { shown, onClose } = t0;
7449
+ const fit = useFit();
7450
+ const sde = useSde();
7451
+ const ref = refIn(fit, shown.slot);
7187
7452
  const item = fit.items[ref];
7188
7453
  let t1;
7189
- if ($[3] !== item || $[4] !== sde) {
7454
+ if ($[0] !== item || $[1] !== sde) {
7190
7455
  t1 = item && mutationRollOf(sde, item);
7191
- $[3] = item;
7192
- $[4] = sde;
7193
- $[5] = t1;
7194
- } else t1 = $[5];
7456
+ $[0] = item;
7457
+ $[1] = sde;
7458
+ $[2] = t1;
7459
+ } else t1 = $[2];
7195
7460
  const roll = t1;
7196
- const gone = shown !== void 0 && roll === void 0;
7197
- const closeWhenGone = useEffectEvent(close);
7461
+ useCloseWhenGone(roll === void 0, onClose);
7462
+ if (item === void 0 || roll === void 0) return null;
7198
7463
  let t2;
7199
- if ($[6] !== closeWhenGone || $[7] !== gone) {
7200
- t2 = () => {
7201
- if (gone) closeWhenGone();
7464
+ if ($[3] !== sde || $[4] !== shown.slot) {
7465
+ t2 = (store, change) => {
7466
+ const current = store.getSnapshot().fit;
7467
+ const target = refIn(current, shown.slot);
7468
+ const before = current.items[target] && mutationRollOf(sde, current.items[target]);
7469
+ if (before !== void 0) store.setMutation(target, change(before));
7202
7470
  };
7203
- $[6] = closeWhenGone;
7204
- $[7] = gone;
7205
- $[8] = t2;
7206
- } else t2 = $[8];
7471
+ $[3] = sde;
7472
+ $[4] = shown.slot;
7473
+ $[5] = t2;
7474
+ } else t2 = $[5];
7207
7475
  let t3;
7208
- if ($[9] !== gone) {
7209
- t3 = [gone];
7210
- $[9] = gone;
7211
- $[10] = t3;
7212
- } else t3 = $[10];
7213
- useEffect(t2, t3);
7214
- if (shown === void 0 || item === void 0 || roll === void 0) return null;
7215
- const t4 = shown.slot.type;
7216
- let t5;
7217
- if ($[11] !== shown.slot) {
7218
- t5 = slotIndex(shown.slot);
7219
- $[11] = shown.slot;
7220
- $[12] = t5;
7221
- } else t5 = $[12];
7222
- const t6 = `${t4} ${t5}`;
7223
- let t7;
7224
- if ($[13] !== close || $[14] !== item.type_id || $[15] !== ref || $[16] !== roll || $[17] !== shown || $[18] !== t6) {
7225
- t7 = /* @__PURE__ */ jsx(MutateCard, {
7476
+ if ($[6] !== item.type_id || $[7] !== onClose || $[8] !== roll || $[9] !== shown || $[10] !== t2) {
7477
+ t3 = /* @__PURE__ */ jsx(MutateCard, {
7226
7478
  shown,
7227
- itemRef: ref,
7228
7479
  typeId: item.type_id,
7229
7480
  roll,
7230
- onClose: close
7231
- }, t6);
7232
- $[13] = close;
7233
- $[14] = item.type_id;
7234
- $[15] = ref;
7235
- $[16] = roll;
7236
- $[17] = shown;
7237
- $[18] = t6;
7238
- $[19] = t7;
7239
- } else t7 = $[19];
7240
- return t7;
7481
+ apply: t2,
7482
+ onClose
7483
+ });
7484
+ $[6] = item.type_id;
7485
+ $[7] = onClose;
7486
+ $[8] = roll;
7487
+ $[9] = shown;
7488
+ $[10] = t2;
7489
+ $[11] = t3;
7490
+ } else t3 = $[11];
7491
+ return t3;
7241
7492
  }
7242
- function MutateCard(t0) {
7243
- const $ = c(42);
7244
- const { shown: t1, itemRef: ref, typeId, roll: fitted, onClose } = t0;
7245
- const { slot, anchor } = t1;
7493
+ function MutateDrones(t0) {
7494
+ const $ = c(9);
7495
+ const { shown, onClose } = t0;
7496
+ const fit = useFit();
7246
7497
  const sde = useSde();
7247
- const store = useFitStore();
7248
- const preview = usePreview();
7249
- const { card, style } = useAnchoredCard(anchor, onClose);
7250
- const { open: openMenu, menu } = useContextMenu();
7251
- const tabId = useId();
7252
- const [tab, setTab] = useState("attributes");
7253
- const [chosen, setChosen] = useState();
7254
- const [dragged, setDragged] = useState();
7255
- let t2;
7256
- if ($[0] !== fitted.base || $[1] !== sde) {
7257
- t2 = mutaplasmidsOf(sde, fitted.base);
7258
- $[0] = fitted.base;
7498
+ let t1;
7499
+ if ($[0] !== fit || $[1] !== sde || $[2] !== shown.base) {
7500
+ t1 = shown.base === void 0 ? void 0 : mutatedDronesOf(sde, fit, shown.base);
7501
+ $[0] = fit;
7259
7502
  $[1] = sde;
7260
- $[2] = t2;
7261
- } else t2 = $[2];
7262
- const mutaplasmids = t2;
7503
+ $[2] = shown.base;
7504
+ $[3] = t1;
7505
+ } else t1 = $[3];
7506
+ const drones = t1;
7507
+ useCloseWhenGone(drones === void 0, onClose);
7508
+ if (drones === void 0) return null;
7509
+ const t2 = fit.items[drones.refs[0]];
7263
7510
  let t3;
7264
- if ($[3] !== chosen || $[4] !== fitted || $[5] !== sde) {
7265
- t3 = chosen !== void 0 && rollFits(sde, {
7266
- ...fitted,
7267
- mutaplasmid: chosen
7268
- }) ? chosen : fitted.mutaplasmid;
7269
- $[3] = chosen;
7270
- $[4] = fitted;
7511
+ if ($[4] !== drones || $[5] !== onClose || $[6] !== shown || $[7] !== t2.type_id) {
7512
+ t3 = /* @__PURE__ */ jsx(DronesCard, {
7513
+ shown,
7514
+ typeId: t2.type_id,
7515
+ drones,
7516
+ onClose
7517
+ });
7518
+ $[4] = drones;
7519
+ $[5] = onClose;
7520
+ $[6] = shown;
7521
+ $[7] = t2.type_id;
7522
+ $[8] = t3;
7523
+ } else t3 = $[8];
7524
+ return t3;
7525
+ }
7526
+ /** The mutate window for the drones of a row; what is changed goes for the selected ones. */
7527
+ function DronesCard(t0) {
7528
+ const $ = c(27);
7529
+ const { shown, typeId, drones: t1, onClose } = t0;
7530
+ const { rolls, active } = t1;
7531
+ const sde = useSde();
7532
+ const store = useFitStore();
7533
+ let t2;
7534
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
7535
+ t2 = /* @__PURE__ */ new Set();
7536
+ $[0] = t2;
7537
+ } else t2 = $[0];
7538
+ const [unselected, setUnselected] = useState(t2);
7539
+ const base = rolls[0].base;
7540
+ let T0;
7541
+ let t3;
7542
+ let t4;
7543
+ let t5;
7544
+ let t6;
7545
+ let t7;
7546
+ let t8;
7547
+ if ($[1] !== active || $[2] !== base || $[3] !== rolls || $[4] !== sde || $[5] !== shown || $[6] !== store || $[7] !== typeId || $[8] !== unselected) {
7548
+ const all = rolls.map(_temp$11);
7549
+ let t9;
7550
+ if ($[16] !== unselected) {
7551
+ t9 = (index_0) => !unselected.has(index_0);
7552
+ $[16] = unselected;
7553
+ $[17] = t9;
7554
+ } else t9 = $[17];
7555
+ const picked = all.filter(t9);
7556
+ const selected = picked.length > 0 ? picked : all;
7557
+ const select = (index_1, adding) => {
7558
+ const only = selected.length === 1 && selected[0] === index_1;
7559
+ if (adding) {
7560
+ if (!only) setUnselected(new Set(all.filter((other) => selected.includes(other) === (other === index_1))));
7561
+ } else setUnselected(new Set(only ? [] : all.filter((other_0) => other_0 !== index_1)));
7562
+ };
7563
+ T0 = MutateCard;
7564
+ t3 = shown;
7565
+ t4 = typeId;
7566
+ t5 = rolls[selected[0]];
7567
+ t6 = rolls.length > 1 ? {
7568
+ disabled: selected.length > 1,
7569
+ set: (roll) => store.setMutatedDrones(base, rolls.map(() => roll))
7570
+ } : void 0;
7571
+ t7 = (target, change) => target.setMutatedDrones(base, (mutatedDronesOf(sde, target.getSnapshot().fit, base)?.rolls ?? []).map((roll_0, index_2) => selected.includes(index_2) ? change(roll_0) : roll_0));
7572
+ t8 = rolls.length > 1 && /* @__PURE__ */ jsx("div", {
7573
+ className: Mutate_module_default.chips,
7574
+ children: rolls.map((roll_1, index_3) => /* @__PURE__ */ jsx(DroneChip, {
7575
+ index: index_3,
7576
+ roll: roll_1,
7577
+ selected: selected.includes(index_3),
7578
+ launched: index_3 < active,
7579
+ onSelect: (adding_0) => select(index_3, adding_0)
7580
+ }, index_3))
7581
+ });
7582
+ $[1] = active;
7583
+ $[2] = base;
7584
+ $[3] = rolls;
7585
+ $[4] = sde;
7586
+ $[5] = shown;
7587
+ $[6] = store;
7588
+ $[7] = typeId;
7589
+ $[8] = unselected;
7590
+ $[9] = T0;
7591
+ $[10] = t3;
7592
+ $[11] = t4;
7593
+ $[12] = t5;
7594
+ $[13] = t6;
7595
+ $[14] = t7;
7596
+ $[15] = t8;
7597
+ } else {
7598
+ T0 = $[9];
7599
+ t3 = $[10];
7600
+ t4 = $[11];
7601
+ t5 = $[12];
7602
+ t6 = $[13];
7603
+ t7 = $[14];
7604
+ t8 = $[15];
7605
+ }
7606
+ let t9;
7607
+ if ($[18] !== T0 || $[19] !== onClose || $[20] !== t3 || $[21] !== t4 || $[22] !== t5 || $[23] !== t6 || $[24] !== t7 || $[25] !== t8) {
7608
+ t9 = /* @__PURE__ */ jsx(T0, {
7609
+ shown: t3,
7610
+ typeId: t4,
7611
+ roll: t5,
7612
+ setAll: t6,
7613
+ apply: t7,
7614
+ above: t8,
7615
+ onClose
7616
+ });
7617
+ $[18] = T0;
7618
+ $[19] = onClose;
7619
+ $[20] = t3;
7620
+ $[21] = t4;
7621
+ $[22] = t5;
7622
+ $[23] = t6;
7623
+ $[24] = t7;
7624
+ $[25] = t8;
7625
+ $[26] = t9;
7626
+ } else t9 = $[26];
7627
+ return t9;
7628
+ }
7629
+ function _temp$11(_, index) {
7630
+ return index;
7631
+ }
7632
+ /** One drone of a row, with how it rolled the stat that matters most. */
7633
+ function DroneChip(t0) {
7634
+ const $ = c(20);
7635
+ const { index, roll, selected, launched, onSelect } = t0;
7636
+ const sde = useSde();
7637
+ let t1;
7638
+ if ($[0] !== roll.base || $[1] !== roll.mutaplasmid || $[2] !== sde) {
7639
+ const ranges = mutationRanges(sde, roll.base, roll.mutaplasmid);
7640
+ t1 = ranges.find((t2) => {
7641
+ const { attributeId } = t2;
7642
+ return attributeId === sde.attributeId("damageMultiplier");
7643
+ }) ?? ranges[0];
7644
+ $[0] = roll.base;
7645
+ $[1] = roll.mutaplasmid;
7646
+ $[2] = sde;
7647
+ $[3] = t1;
7648
+ } else t1 = $[3];
7649
+ const range = t1;
7650
+ const value = range && (roll.attributes[range.attributeId] ?? range.base);
7651
+ const change = range && value !== void 0 && range.base !== 0 ? value / range.base - 1 : 0;
7652
+ const width = range && value !== void 0 && range.max > range.min ? (value - range.min) / (range.max - range.min) : 0;
7653
+ const t2 = Math.abs(change) * 100;
7654
+ let t3;
7655
+ if ($[4] !== t2) {
7656
+ t3 = formatNumber(t2, { decimals: 1 });
7657
+ $[4] = t2;
7658
+ $[5] = t3;
7659
+ } else t3 = $[5];
7660
+ const percent = t3;
7661
+ const better = change > 0 === (range?.highIsGood ?? true);
7662
+ const t4 = launched || void 0;
7663
+ let t5;
7664
+ if ($[6] !== onSelect) {
7665
+ t5 = (event) => onSelect(event.ctrlKey || event.metaKey || event.shiftKey);
7666
+ $[6] = onSelect;
7667
+ $[7] = t5;
7668
+ } else t5 = $[7];
7669
+ const t6 = index + 1;
7670
+ const t7 = Number(percent) === 0 ? void 0 : better ? "better" : "worse";
7671
+ const t8 = Number(percent) === 0 ? "0%" : `${change > 0 ? "+" : "-"}${percent}%`;
7672
+ let t9;
7673
+ if ($[8] !== t7 || $[9] !== t8) {
7674
+ t9 = /* @__PURE__ */ jsx("span", {
7675
+ className: Mutate_module_default.change,
7676
+ "data-change": t7,
7677
+ children: t8
7678
+ });
7679
+ $[8] = t7;
7680
+ $[9] = t8;
7681
+ $[10] = t9;
7682
+ } else t9 = $[10];
7683
+ const t10 = `${width * 100}%`;
7684
+ let t11;
7685
+ if ($[11] !== t10) {
7686
+ t11 = /* @__PURE__ */ jsx("span", {
7687
+ className: Mutate_module_default.chipBar,
7688
+ children: /* @__PURE__ */ jsx("span", { style: { width: t10 } })
7689
+ });
7690
+ $[11] = t10;
7691
+ $[12] = t11;
7692
+ } else t11 = $[12];
7693
+ let t12;
7694
+ if ($[13] !== selected || $[14] !== t11 || $[15] !== t4 || $[16] !== t5 || $[17] !== t6 || $[18] !== t9) {
7695
+ t12 = /* @__PURE__ */ jsxs("button", {
7696
+ type: "button",
7697
+ className: Mutate_module_default.chip,
7698
+ "aria-pressed": selected,
7699
+ "data-launched": t4,
7700
+ title: "Click for only this drone, Ctrl+click to add or remove it",
7701
+ onClick: t5,
7702
+ children: [
7703
+ "Drone ",
7704
+ t6,
7705
+ t9,
7706
+ t11
7707
+ ]
7708
+ });
7709
+ $[13] = selected;
7710
+ $[14] = t11;
7711
+ $[15] = t4;
7712
+ $[16] = t5;
7713
+ $[17] = t6;
7714
+ $[18] = t9;
7715
+ $[19] = t12;
7716
+ } else t12 = $[19];
7717
+ return t12;
7718
+ }
7719
+ function MutateCard(t0) {
7720
+ const $ = c(42);
7721
+ const { shown: t1, typeId, roll: fitted, setAll, apply, above, onClose } = t0;
7722
+ const { slot, anchor } = t1;
7723
+ const sde = useSde();
7724
+ const store = useFitStore();
7725
+ const preview = usePreview();
7726
+ const { card, style } = useAnchoredCard(anchor, onClose);
7727
+ const { open: openMenu, menu } = useContextMenu();
7728
+ const tabId = useId();
7729
+ const [tab, setTab] = useState("attributes");
7730
+ const [chosen, setChosen] = useState();
7731
+ const [dragged, setDragged] = useState();
7732
+ let t2;
7733
+ if ($[0] !== fitted.base || $[1] !== sde) {
7734
+ t2 = mutaplasmidsOf(sde, fitted.base);
7735
+ $[0] = fitted.base;
7736
+ $[1] = sde;
7737
+ $[2] = t2;
7738
+ } else t2 = $[2];
7739
+ const mutaplasmids = t2;
7740
+ let t3;
7741
+ if ($[3] !== chosen || $[4] !== fitted || $[5] !== sde) {
7742
+ t3 = chosen !== void 0 && rollFits(sde, {
7743
+ ...fitted,
7744
+ mutaplasmid: chosen
7745
+ }) ? chosen : fitted.mutaplasmid;
7746
+ $[3] = chosen;
7747
+ $[4] = fitted;
7271
7748
  $[5] = sde;
7272
7749
  $[6] = t3;
7273
7750
  } else t3 = $[6];
7274
7751
  const mutaplasmid = t3;
7275
- const roll = dragged ?? {
7752
+ const roll = dragged?.roll ?? {
7276
7753
  ...fitted,
7277
7754
  mutaplasmid
7278
7755
  };
@@ -7298,57 +7775,54 @@ function MutateCard(t0) {
7298
7775
  } else t6 = $[11];
7299
7776
  useEffect(t5, t6);
7300
7777
  let t7;
7301
- if ($[12] !== preview || $[13] !== ref || $[14] !== store) {
7302
- t7 = (next) => {
7778
+ if ($[12] !== apply || $[13] !== preview || $[14] !== store) {
7779
+ t7 = (change, picked) => {
7303
7780
  preview.clear(PREVIEW_TARGET);
7304
7781
  setDragged(void 0);
7305
- setChosen(next.mutaplasmid);
7306
- store.setMutation(ref, next);
7782
+ setChosen(picked);
7783
+ apply(store, change);
7307
7784
  };
7308
- $[12] = preview;
7309
- $[13] = ref;
7785
+ $[12] = apply;
7786
+ $[13] = preview;
7310
7787
  $[14] = store;
7311
7788
  $[15] = t7;
7312
7789
  } else t7 = $[15];
7313
7790
  const commit = t7;
7791
+ const setValue = (range, value) => {
7792
+ const clamped = clampToRange(value, range);
7793
+ const change_0 = (before) => ({
7794
+ ...before,
7795
+ mutaplasmid,
7796
+ attributes: {
7797
+ ...before.attributes,
7798
+ [range.attributeId]: clamped
7799
+ }
7800
+ });
7801
+ setDragged({
7802
+ roll: change_0(roll),
7803
+ change: change_0
7804
+ });
7805
+ preview.show((draft) => apply(draft, change_0), PREVIEW_TARGET);
7806
+ };
7314
7807
  let t8;
7315
- if ($[16] !== preview || $[17] !== ref) {
7316
- t8 = (next_0) => {
7317
- setDragged(next_0);
7318
- preview.show((draft) => draft.setMutation(ref, next_0), PREVIEW_TARGET);
7808
+ if ($[16] !== commit || $[17] !== dragged) {
7809
+ t8 = () => {
7810
+ if (dragged !== void 0) commit(dragged.change, dragged.roll.mutaplasmid);
7319
7811
  };
7320
- $[16] = preview;
7321
- $[17] = ref;
7812
+ $[16] = commit;
7813
+ $[17] = dragged;
7322
7814
  $[18] = t8;
7323
7815
  } else t8 = $[18];
7324
- const drag = t8;
7325
- const setValue = (range, value) => drag({
7326
- ...roll,
7327
- attributes: {
7328
- ...roll.attributes,
7329
- [range.attributeId]: clamp(value, range)
7330
- }
7331
- });
7816
+ const finish = t8;
7817
+ const reroll = (kind) => commit(() => rollMutation(sde, roll.base, roll.mutaplasmid, kind), roll.mutaplasmid);
7332
7818
  let t9;
7333
- if ($[19] !== commit || $[20] !== dragged) {
7334
- t9 = () => {
7335
- if (dragged !== void 0) commit(dragged);
7336
- };
7819
+ if ($[19] !== commit || $[20] !== sde) {
7820
+ t9 = (picked_0) => commit((before_0) => withMutaplasmid(sde, before_0, picked_0), picked_0);
7337
7821
  $[19] = commit;
7338
- $[20] = dragged;
7822
+ $[20] = sde;
7339
7823
  $[21] = t9;
7340
7824
  } else t9 = $[21];
7341
- const finish = t9;
7342
- const reroll = (kind) => commit(rollMutation(sde, roll.base, roll.mutaplasmid, kind));
7343
- const choose = (picked) => {
7344
- const attributes = {};
7345
- for (const range_0 of mutationRanges(sde, roll.base, picked)) attributes[range_0.attributeId] = clamp(roll.attributes[range_0.attributeId] ?? range_0.base, range_0);
7346
- commit({
7347
- base: roll.base,
7348
- mutaplasmid: picked,
7349
- attributes
7350
- });
7351
- };
7825
+ const choose = t9;
7352
7826
  let t10;
7353
7827
  if ($[22] !== onClose) {
7354
7828
  t10 = (event) => {
@@ -7447,30 +7921,39 @@ function MutateCard(t0) {
7447
7921
  className: Mutate_module_default.more,
7448
7922
  "aria-label": "More Rolls",
7449
7923
  "aria-haspopup": "menu",
7450
- onClick: (event_0) => openMenu(event_0, [{
7451
- label: "Best Roll",
7452
- onSelect: () => reroll("best")
7453
- }, {
7454
- label: "Worst Roll",
7455
- onSelect: () => reroll("worst")
7456
- }]),
7924
+ onClick: (event_0) => openMenu(event_0, [
7925
+ {
7926
+ label: "Best Roll",
7927
+ onSelect: () => reroll("best")
7928
+ },
7929
+ {
7930
+ label: "Worst Roll",
7931
+ onSelect: () => reroll("worst")
7932
+ },
7933
+ setAll && {
7934
+ label: "Set All Drones to Selected",
7935
+ disabled: setAll.disabled,
7936
+ onSelect: () => setAll.set(roll)
7937
+ }
7938
+ ]),
7457
7939
  children: "▾"
7458
7940
  })]
7459
7941
  })]
7460
7942
  }),
7461
7943
  menu,
7944
+ above,
7462
7945
  /* @__PURE__ */ jsx("div", {
7463
7946
  className: Mutate_module_default.stats,
7464
- children: ranges.map((range_1) => /* @__PURE__ */ jsx(Stat$1, {
7465
- range: range_1,
7466
- value: roll.attributes[range_1.attributeId] ?? range_1.base,
7467
- onChange: (value_0) => setValue(range_1, value_0),
7947
+ children: ranges.map((range_0) => /* @__PURE__ */ jsx(Stat$1, {
7948
+ range: range_0,
7949
+ value: roll.attributes[range_0.attributeId] ?? range_0.base,
7950
+ onChange: (value_0) => setValue(range_0, value_0),
7468
7951
  onFinish: finish
7469
- }, range_1.attributeId))
7952
+ }, range_0.attributeId))
7470
7953
  })
7471
7954
  ] }) : /* @__PURE__ */ jsx(Import, {
7472
- slot,
7473
7955
  current: fitted,
7956
+ apply: (next) => apply(store, () => next),
7474
7957
  onFound: (found) => {
7475
7958
  setChosen(found.mutaplasmid);
7476
7959
  setTab("attributes");
@@ -7712,12 +8195,11 @@ function Stat$1(t0) {
7712
8195
  } else t22 = $[48];
7713
8196
  return t22;
7714
8197
  }
7715
- /** Rolls this module like one pasted from Pyfa, or one in game looked up by its link or IDs. */
8198
+ /** Rolls this module or drone like one pasted from Pyfa, or one in game looked up by its link or IDs. */
7716
8199
  function Import(t0) {
7717
8200
  const $ = c(39);
7718
- const { slot, current, onFound } = t0;
8201
+ const { current, apply: applyRoll, onFound } = t0;
7719
8202
  const engine = useEngine();
7720
- const store = useFitStore();
7721
8203
  const sde = useSde();
7722
8204
  const fieldId = useId();
7723
8205
  const [text, setText] = useState("");
@@ -7739,24 +8221,21 @@ function Import(t0) {
7739
8221
  } else t2 = $[5];
7740
8222
  const ids = t2;
7741
8223
  let t3;
7742
- if ($[6] !== onFound || $[7] !== sde || $[8] !== slot || $[9] !== store) {
8224
+ if ($[6] !== applyRoll || $[7] !== current.base || $[8] !== onFound || $[9] !== sde) {
7743
8225
  t3 = (roll) => {
7744
- const { fit } = store.getSnapshot();
7745
- const ref = refIn(fit, slot);
7746
- const base = fit.items[ref]?.mutation?.base;
7747
- if (base !== roll.base) {
7748
- const name = (typeId) => typeId === void 0 ? "module" : sde.type(typeId)?.name;
7749
- setStatus({ error: `That is a ${name(roll.base)}, not a ${name(base)}` });
8226
+ if (current.base !== roll.base) {
8227
+ const name = (typeId) => sde.type(typeId)?.name;
8228
+ setStatus({ error: `That is a ${name(roll.base)}, not a ${name(current.base)}` });
7750
8229
  return;
7751
8230
  }
7752
- store.setMutation(ref, roll);
8231
+ applyRoll(roll);
7753
8232
  setStatus(void 0);
7754
8233
  onFound(roll);
7755
8234
  };
7756
- $[6] = onFound;
7757
- $[7] = sde;
7758
- $[8] = slot;
7759
- $[9] = store;
8235
+ $[6] = applyRoll;
8236
+ $[7] = current.base;
8237
+ $[8] = onFound;
8238
+ $[9] = sde;
7760
8239
  $[10] = t3;
7761
8240
  } else t3 = $[10];
7762
8241
  const apply = t3;
@@ -7792,7 +8271,7 @@ function Import(t0) {
7792
8271
  $[16] = lookUp;
7793
8272
  $[17] = t5;
7794
8273
  } else t5 = $[17];
7795
- const t6 = engine.esi === void 0 ? "Paste the module from Pyfa." : "Paste the module from Pyfa or its item link from EVE, or type its type ID and item ID.";
8274
+ const t6 = engine.esi === void 0 ? "Paste the item from Pyfa." : "Paste the item from Pyfa or its item link from EVE, or type its type ID and item ID.";
7796
8275
  let t7;
7797
8276
  if ($[18] !== fieldId || $[19] !== t6) {
7798
8277
  t7 = /* @__PURE__ */ jsx("label", {
@@ -7876,7 +8355,7 @@ function Import(t0) {
7876
8355
  } else t14 = $[38];
7877
8356
  return t14;
7878
8357
  }
7879
- /** A roll as Pyfa copies a mutated module. */
8358
+ /** A roll as Pyfa copies a mutated module or drone. */
7880
8359
  function pyfaText(sde, roll) {
7881
8360
  const values = Object.entries(roll.attributes).map(([id, value]) => `${sde.attribute(Number(id))?.name ?? id} ${Number(value.toFixed(4))}`).join(", ");
7882
8361
  return `${sde.type(roll.base)?.name ?? roll.base}\n${sde.type(roll.mutaplasmid)?.name ?? roll.mutaplasmid}\n${values}`;
@@ -7887,9 +8366,6 @@ function refIn(fit, slot) {
7887
8366
  function slotIndex(slot) {
7888
8367
  return "index" in slot ? slot.index : void 0;
7889
8368
  }
7890
- function clamp(value, range) {
7891
- return Math.min(range.max, Math.max(range.min, value));
7892
- }
7893
8369
  function Dice() {
7894
8370
  const $ = c(1);
7895
8371
  let t0;
@@ -8103,8 +8579,8 @@ var BayContents_module_default = {
8103
8579
  // src/components/FittingWindow/DroneTooltip.tsx
8104
8580
  /** What EVE shows when hovering a drone in the drone bay. */
8105
8581
  function DroneTooltip(t0) {
8106
- const $ = c(32);
8107
- const { itemRef, typeId } = t0;
8582
+ const $ = c(35);
8583
+ const { itemRef, typeId, mutatedFrom } = t0;
8108
8584
  const sde = useSde();
8109
8585
  const type = useType(typeId);
8110
8586
  const effectId = type?.defaultEffectId;
@@ -8152,55 +8628,61 @@ function DroneTooltip(t0) {
8152
8628
  $[9] = t5;
8153
8629
  } else t5 = $[9];
8154
8630
  let t6;
8155
- if ($[10] !== effectId || $[11] !== itemRef) {
8156
- t6 = effectId !== void 0 && /* @__PURE__ */ jsx(EffectRange, {
8631
+ if ($[10] !== mutatedFrom) {
8632
+ t6 = mutatedFrom !== void 0 && /* @__PURE__ */ jsx(MutatedFrom, { typeId: mutatedFrom });
8633
+ $[10] = mutatedFrom;
8634
+ $[11] = t6;
8635
+ } else t6 = $[11];
8636
+ let t7;
8637
+ if ($[12] !== effectId || $[13] !== itemRef) {
8638
+ t7 = effectId !== void 0 && /* @__PURE__ */ jsx(EffectRange, {
8157
8639
  itemRef,
8158
8640
  effectId
8159
8641
  });
8160
- $[10] = effectId;
8161
- $[11] = itemRef;
8162
- $[12] = t6;
8163
- } else t6 = $[12];
8164
- let t7;
8165
- if ($[13] !== dps.text) {
8166
- t7 = /* @__PURE__ */ jsxs(Attribute, {
8167
- name: "damageMultiplier",
8168
- children: ["Damage Per Second ", dps.text]
8169
- });
8170
- $[13] = dps.text;
8642
+ $[12] = effectId;
8643
+ $[13] = itemRef;
8171
8644
  $[14] = t7;
8172
8645
  } else t7 = $[14];
8173
8646
  let t8;
8174
- if ($[15] !== itemRef) {
8175
- t8 = /* @__PURE__ */ jsx(DamageTypes, { itemRef });
8176
- $[15] = itemRef;
8647
+ if ($[15] !== dps.text) {
8648
+ t8 = /* @__PURE__ */ jsxs(Attribute, {
8649
+ name: "damageMultiplier",
8650
+ children: ["Damage Per Second ", dps.text]
8651
+ });
8652
+ $[15] = dps.text;
8177
8653
  $[16] = t8;
8178
8654
  } else t8 = $[16];
8179
8655
  let t9;
8180
- if ($[17] !== itemRef || $[18] !== mining) {
8181
- t9 = mining && /* @__PURE__ */ jsx(MiningAmount, { itemRef });
8656
+ if ($[17] !== itemRef) {
8657
+ t9 = /* @__PURE__ */ jsx(DamageTypes, { itemRef });
8182
8658
  $[17] = itemRef;
8183
- $[18] = mining;
8184
- $[19] = t9;
8185
- } else t9 = $[19];
8659
+ $[18] = t9;
8660
+ } else t9 = $[18];
8186
8661
  let t10;
8187
- if ($[20] !== itemRef) {
8188
- t10 = /* @__PURE__ */ jsx(Tracking, { itemRef });
8189
- $[20] = itemRef;
8662
+ if ($[19] !== itemRef || $[20] !== mining) {
8663
+ t10 = mining && /* @__PURE__ */ jsx(MiningAmount, { itemRef });
8664
+ $[19] = itemRef;
8665
+ $[20] = mining;
8190
8666
  $[21] = t10;
8191
8667
  } else t10 = $[21];
8192
8668
  let t11;
8193
- if ($[22] !== bandwidth.text) {
8194
- t11 = /* @__PURE__ */ jsxs(Attribute, {
8195
- name: "droneBandwidthUsed",
8196
- children: ["Bandwidth Needed ", bandwidth.text]
8197
- });
8198
- $[22] = bandwidth.text;
8669
+ if ($[22] !== itemRef) {
8670
+ t11 = /* @__PURE__ */ jsx(Tracking, { itemRef });
8671
+ $[22] = itemRef;
8199
8672
  $[23] = t11;
8200
8673
  } else t11 = $[23];
8201
8674
  let t12;
8202
- if ($[24] !== t10 || $[25] !== t11 || $[26] !== t5 || $[27] !== t6 || $[28] !== t7 || $[29] !== t8 || $[30] !== t9) {
8203
- t12 = /* @__PURE__ */ jsxs("span", {
8675
+ if ($[24] !== bandwidth.text) {
8676
+ t12 = /* @__PURE__ */ jsxs(Attribute, {
8677
+ name: "droneBandwidthUsed",
8678
+ children: ["Bandwidth Needed ", bandwidth.text]
8679
+ });
8680
+ $[24] = bandwidth.text;
8681
+ $[25] = t12;
8682
+ } else t12 = $[25];
8683
+ let t13;
8684
+ if ($[26] !== t10 || $[27] !== t11 || $[28] !== t12 || $[29] !== t5 || $[30] !== t6 || $[31] !== t7 || $[32] !== t8 || $[33] !== t9) {
8685
+ t13 = /* @__PURE__ */ jsxs("span", {
8204
8686
  className: ModuleTooltip_module_default.tooltip,
8205
8687
  children: [
8206
8688
  t5,
@@ -8209,19 +8691,21 @@ function DroneTooltip(t0) {
8209
8691
  t8,
8210
8692
  t9,
8211
8693
  t10,
8212
- t11
8694
+ t11,
8695
+ t12
8213
8696
  ]
8214
8697
  });
8215
- $[24] = t10;
8216
- $[25] = t11;
8217
- $[26] = t5;
8218
- $[27] = t6;
8219
- $[28] = t7;
8220
- $[29] = t8;
8221
- $[30] = t9;
8222
- $[31] = t12;
8223
- } else t12 = $[31];
8224
- return t12;
8698
+ $[26] = t10;
8699
+ $[27] = t11;
8700
+ $[28] = t12;
8701
+ $[29] = t5;
8702
+ $[30] = t6;
8703
+ $[31] = t7;
8704
+ $[32] = t8;
8705
+ $[33] = t9;
8706
+ $[34] = t13;
8707
+ } else t13 = $[34];
8708
+ return t13;
8225
8709
  }
8226
8710
  // src/primitives/FighterTube/FighterTube.module.css
8227
8711
  var FighterTube_module_default = {
@@ -8856,10 +9340,13 @@ const emptyText = {
8856
9340
  };
8857
9341
  /** EVE's list of what is in a bay, as a popover anchored to `--bay-anchor`; the fighter bay's has its tubes above. */
8858
9342
  function BayContents(t0) {
8859
- const $ = c(42);
9343
+ const $ = c(34);
8860
9344
  const { id, bay, label } = t0;
8861
9345
  const store = useFitStore();
9346
+ const sde = useSde();
8862
9347
  const { start, end } = useDrag();
9348
+ const { show: showMutate } = useMutate();
9349
+ const { open, menu } = useContextMenu();
8863
9350
  const contents = useBayContents(bay);
8864
9351
  const panel = useRef(null);
8865
9352
  const drones = bay === "droneBay";
@@ -8875,7 +9362,7 @@ function BayContents(t0) {
8875
9362
  let t2;
8876
9363
  if ($[2] !== contents || $[3] !== fighters || $[4] !== fit) {
8877
9364
  const launched = fighters ? fit.items.flatMap(_temp$8) : [];
8878
- t2 = [...contents.flatMap(_temp2$5), ...launched];
9365
+ t2 = [...contents.flatMap(_temp2$6), ...launched];
8879
9366
  $[2] = contents;
8880
9367
  $[3] = fighters;
8881
9368
  $[4] = fit;
@@ -8901,8 +9388,11 @@ function BayContents(t0) {
8901
9388
  }
8902
9389
  let t3;
8903
9390
  if ($[9] !== drones || $[10] !== fighters || $[11] !== store) {
8904
- t3 = (typeId, quantity) => {
8905
- if (drones) store.setDroneQuantity(typeId, quantity);
9391
+ t3 = (t4, quantity) => {
9392
+ const { type: t5, mutatedFrom } = t4;
9393
+ const { id: typeId } = t5;
9394
+ if (mutatedFrom) store.setMutatedDroneQuantity(mutatedFrom.id, quantity);
9395
+ else if (drones) store.setDroneQuantity(typeId, quantity);
8906
9396
  else if (fighters) store.setFighterBayQuantity(typeId, quantity);
8907
9397
  else store.setCargoQuantity(typeId, quantity);
8908
9398
  };
@@ -8912,11 +9402,32 @@ function BayContents(t0) {
8912
9402
  $[12] = t3;
8913
9403
  } else t3 = $[12];
8914
9404
  const setQuantity = t3;
8915
- const t4 = drones || void 0;
8916
- const t5 = fighters || void 0;
8917
- let t6;
9405
+ const openMenu = (event, t4) => {
9406
+ const { type, mutatedFrom: mutatedFrom_0, refs: refs_0 } = t4;
9407
+ const unmutated = mutatedFrom_0 ?? type;
9408
+ if (!canMutate(sde, unmutated) || mutatedFrom_0 && !mutatedDronesOf(sde, fit, mutatedFrom_0.id)) return;
9409
+ const mutate = () => {
9410
+ if (!mutatedFrom_0) store.setDronesMutation(refs_0, rollMutation(sde, type.id, mutaplasmidsOf(sde, type.id)[0].id, "base"));
9411
+ showMutate({ type: "drone_bay" }, {
9412
+ element: panel.current.parentElement,
9413
+ side: "right"
9414
+ }, unmutated.id);
9415
+ };
9416
+ open(event, [{
9417
+ label: mutatedFrom_0 ? "Edit Mutation" : "Mutate",
9418
+ onSelect: mutate
9419
+ }, mutatedFrom_0 && {
9420
+ label: "Remove Mutation",
9421
+ onSelect: () => store.setDronesMutation(refs_0, void 0)
9422
+ }]);
9423
+ };
9424
+ const t5 = BayContents_module_default;
9425
+ const t6 = "auto";
9426
+ const t7 = drones || void 0;
9427
+ const t8 = fighters || void 0;
9428
+ let t9;
8918
9429
  if ($[13] !== drones || $[14] !== maxActive || $[15] !== stats.ship) {
8919
- t6 = drones && /* @__PURE__ */ jsxs("div", {
9430
+ t9 = drones && /* @__PURE__ */ jsxs("div", {
8920
9431
  className: BayContents_module_default.activeDrones,
8921
9432
  children: [
8922
9433
  "Active drones: ",
@@ -8928,102 +9439,91 @@ function BayContents(t0) {
8928
9439
  $[13] = drones;
8929
9440
  $[14] = maxActive;
8930
9441
  $[15] = stats.ship;
8931
- $[16] = t6;
8932
- } else t6 = $[16];
8933
- let t7;
9442
+ $[16] = t9;
9443
+ } else t9 = $[16];
9444
+ let t10;
8934
9445
  if ($[17] !== fighters) {
8935
- t7 = fighters && /* @__PURE__ */ jsx(FighterTubes, {});
9446
+ t10 = fighters && /* @__PURE__ */ jsx(FighterTubes, {});
8936
9447
  $[17] = fighters;
8937
- $[18] = t7;
8938
- } else t7 = $[18];
8939
- let t8;
8940
- if ($[19] !== bay || $[20] !== contents || $[21] !== drones || $[22] !== end || $[23] !== fighters || $[24] !== fit || $[25] !== label || $[26] !== maxActive || $[27] !== setQuantity || $[28] !== start || $[29] !== store) {
8941
- t8 = contents.length === 0 ? /* @__PURE__ */ jsx("div", {
8942
- className: BayContents_module_default.none,
8943
- children: emptyText[bay]
8944
- }) : /* @__PURE__ */ jsx("ul", {
8945
- className: BayContents_module_default.list,
8946
- "aria-label": label,
8947
- children: contents.map((content) => {
8948
- const { type, quantity: quantity_0, refs: refs_0 } = content;
8949
- const drag = {
8950
- draggable: true,
8951
- onDragStart: (event) => {
8952
- const icon = event.currentTarget.closest("li").querySelector(`.${BayContents_module_default.icon}`);
8953
- event.dataTransfer.setDragImage(icon, 0, 0);
8954
- event.dataTransfer.effectAllowed = "copy";
8955
- event.dataTransfer.setData("text/plain", type.name);
8956
- start({
8957
- type: "type",
8958
- typeId: type.id
8959
- });
8960
- },
8961
- onDragEnd: end
8962
- };
8963
- const shown = refs_0.find((ref_0) => fit.items[ref_0]?.state === "active") ?? refs_0[0];
8964
- return /* @__PURE__ */ jsxs("li", {
8965
- className: BayContents_module_default.row,
8966
- children: [
8967
- /* @__PURE__ */ jsx(Quantity, {
8968
- name: type.name,
8969
- value: quantity_0,
8970
- onChange: (value) => setQuantity(type.id, value)
8971
- }),
8972
- /* @__PURE__ */ jsx(Tooltip, {
8973
- label: drones ? /* @__PURE__ */ jsx(DroneTooltip, {
8974
- itemRef: shown,
8975
- typeId: type.id
8976
- }) : void 0,
8977
- children: /* @__PURE__ */ jsx("span", {
8978
- className: BayContents_module_default.icon,
8979
- ...drag,
8980
- children: /* @__PURE__ */ jsx(TypeIcon, { typeId: type.id })
8981
- })
8982
- }),
8983
- /* @__PURE__ */ jsxs("span", {
8984
- className: BayContents_module_default.middle,
9448
+ $[18] = t10;
9449
+ } else t10 = $[18];
9450
+ const t11 = contents.length === 0 ? /* @__PURE__ */ jsx("div", {
9451
+ className: BayContents_module_default.none,
9452
+ children: emptyText[bay]
9453
+ }) : /* @__PURE__ */ jsx("ul", {
9454
+ className: BayContents_module_default.list,
9455
+ "aria-label": label,
9456
+ children: contents.map((content) => {
9457
+ const { type: type_0, quantity: quantity_0, refs: refs_1, key, mutatedFrom: mutatedFrom_1 } = content;
9458
+ const drag = {
9459
+ draggable: mutatedFrom_1 === void 0,
9460
+ onDragStart: (event_0) => {
9461
+ const icon = event_0.currentTarget.closest("li").querySelector(`.${BayContents_module_default.icon}`);
9462
+ event_0.dataTransfer.setDragImage(icon, 0, 0);
9463
+ event_0.dataTransfer.effectAllowed = "copy";
9464
+ event_0.dataTransfer.setData("text/plain", type_0.name);
9465
+ start({
9466
+ type: "type",
9467
+ typeId: type_0.id
9468
+ });
9469
+ },
9470
+ onDragEnd: end
9471
+ };
9472
+ const shown = refs_1.find((ref_0) => fit.items[ref_0]?.state === "active") ?? refs_1[0];
9473
+ const name = mutatedFrom_1 ? `Mutated ${mutatedFrom_1.name}` : type_0.name;
9474
+ return /* @__PURE__ */ jsxs("li", {
9475
+ className: BayContents_module_default.row,
9476
+ onContextMenu: drones ? (event_1) => openMenu(event_1, content) : void 0,
9477
+ children: [
9478
+ /* @__PURE__ */ jsx(Quantity, {
9479
+ name,
9480
+ value: quantity_0,
9481
+ onChange: (value) => setQuantity(content, value)
9482
+ }),
9483
+ /* @__PURE__ */ jsx(Tooltip, {
9484
+ label: drones ? /* @__PURE__ */ jsx(DroneTooltip, {
9485
+ itemRef: shown,
9486
+ typeId: type_0.id,
9487
+ mutatedFrom: mutatedFrom_1?.id
9488
+ }) : void 0,
9489
+ children: /* @__PURE__ */ jsx("span", {
9490
+ className: BayContents_module_default.icon,
8985
9491
  ...drag,
8986
- children: [/* @__PURE__ */ jsx("span", {
8987
- className: BayContents_module_default.name,
8988
- children: type.name
8989
- }), drones && /* @__PURE__ */ jsx(DroneSelection, {
8990
- content,
8991
- max: maxActive
8992
- })]
8993
- }),
8994
- /* @__PURE__ */ jsx("button", {
8995
- type: "button",
8996
- className: BayContents_module_default.remove,
8997
- "aria-label": `Remove ${type.name}`,
8998
- onClick: (event_0) => {
8999
- const row = event_0.currentTarget.closest("li");
9000
- const next = row.nextElementSibling ?? row.previousElementSibling;
9001
- store.remove(...refs_0);
9002
- if (next !== null) next.querySelector(`.${BayContents_module_default.remove}`)?.focus();
9003
- else if (!fighters) panel.current?.hidePopover();
9004
- },
9005
- children: /* @__PURE__ */ jsx(Icon, { name: "close" })
9492
+ children: /* @__PURE__ */ jsx(TypeIcon, { typeId: type_0.id })
9006
9493
  })
9007
- ]
9008
- }, type.id);
9009
- })
9010
- });
9011
- $[19] = bay;
9012
- $[20] = contents;
9013
- $[21] = drones;
9014
- $[22] = end;
9015
- $[23] = fighters;
9016
- $[24] = fit;
9017
- $[25] = label;
9018
- $[26] = maxActive;
9019
- $[27] = setQuantity;
9020
- $[28] = start;
9021
- $[29] = store;
9022
- $[30] = t8;
9023
- } else t8 = $[30];
9024
- let t9;
9025
- if ($[31] !== all || $[32] !== store) {
9026
- t9 = all.length > 0 && /* @__PURE__ */ jsx("button", {
9494
+ }),
9495
+ /* @__PURE__ */ jsxs("span", {
9496
+ className: BayContents_module_default.middle,
9497
+ ...drag,
9498
+ children: [/* @__PURE__ */ jsx("span", {
9499
+ className: BayContents_module_default.name,
9500
+ "data-mutated": mutatedFrom_1 !== void 0 || void 0,
9501
+ children: name
9502
+ }), drones && /* @__PURE__ */ jsx(DroneSelection, {
9503
+ content,
9504
+ max: maxActive
9505
+ })]
9506
+ }),
9507
+ /* @__PURE__ */ jsx("button", {
9508
+ type: "button",
9509
+ className: BayContents_module_default.remove,
9510
+ "aria-label": `Remove ${name}`,
9511
+ onClick: (event_2) => {
9512
+ const row = event_2.currentTarget.closest("li");
9513
+ const next = row.nextElementSibling ?? row.previousElementSibling;
9514
+ store.remove(...refs_1);
9515
+ if (next !== null) next.querySelector(`.${BayContents_module_default.remove}`)?.focus();
9516
+ else if (!fighters) panel.current?.hidePopover();
9517
+ },
9518
+ children: /* @__PURE__ */ jsx(Icon, { name: "close" })
9519
+ })
9520
+ ]
9521
+ }, key);
9522
+ })
9523
+ });
9524
+ let t12;
9525
+ if ($[19] !== all || $[20] !== panel || $[21] !== store) {
9526
+ t12 = all.length > 0 && /* @__PURE__ */ jsx("button", {
9027
9527
  type: "button",
9028
9528
  className: BayContents_module_default.removeAll,
9029
9529
  onClick: () => {
@@ -9032,39 +9532,44 @@ function BayContents(t0) {
9032
9532
  },
9033
9533
  children: "Remove All"
9034
9534
  });
9035
- $[31] = all;
9036
- $[32] = store;
9037
- $[33] = t9;
9038
- } else t9 = $[33];
9039
- let t10;
9040
- if ($[34] !== id || $[35] !== t4 || $[36] !== t5 || $[37] !== t6 || $[38] !== t7 || $[39] !== t8 || $[40] !== t9) {
9041
- t10 = /* @__PURE__ */ jsxs("div", {
9535
+ $[19] = all;
9536
+ $[20] = panel;
9537
+ $[21] = store;
9538
+ $[22] = t12;
9539
+ } else t12 = $[22];
9540
+ let t13;
9541
+ if ($[23] !== id || $[24] !== menu || $[25] !== panel || $[26] !== t10 || $[27] !== t11 || $[28] !== t12 || $[29] !== t5.panel || $[30] !== t7 || $[31] !== t8 || $[32] !== t9) {
9542
+ t13 = /* @__PURE__ */ jsxs("div", {
9042
9543
  ref: panel,
9043
9544
  id,
9044
- className: BayContents_module_default.panel,
9045
- popover: "auto",
9046
- "data-drones": t4,
9047
- "data-fighters": t5,
9545
+ className: t5.panel,
9546
+ popover: t6,
9547
+ "data-drones": t7,
9548
+ "data-fighters": t8,
9048
9549
  children: [
9049
- t6,
9050
- t7,
9051
- t8,
9052
- t9
9550
+ t9,
9551
+ t10,
9552
+ menu,
9553
+ t11,
9554
+ t12
9053
9555
  ]
9054
9556
  });
9055
- $[34] = id;
9056
- $[35] = t4;
9057
- $[36] = t5;
9058
- $[37] = t6;
9059
- $[38] = t7;
9060
- $[39] = t8;
9061
- $[40] = t9;
9062
- $[41] = t10;
9063
- } else t10 = $[41];
9064
- return t10;
9557
+ $[23] = id;
9558
+ $[24] = menu;
9559
+ $[25] = panel;
9560
+ $[26] = t10;
9561
+ $[27] = t11;
9562
+ $[28] = t12;
9563
+ $[29] = t5.panel;
9564
+ $[30] = t7;
9565
+ $[31] = t8;
9566
+ $[32] = t9;
9567
+ $[33] = t13;
9568
+ } else t13 = $[33];
9569
+ return t13;
9065
9570
  }
9066
9571
  /** One box per drone the character can launch. */
9067
- function _temp2$5(t0) {
9572
+ function _temp2$6(t0) {
9068
9573
  const { refs } = t0;
9069
9574
  return refs;
9070
9575
  }
@@ -9072,59 +9577,69 @@ function _temp$8(item, ref) {
9072
9577
  return item.slot.type === "fighter_tube" ? [ref] : [];
9073
9578
  }
9074
9579
  function DroneSelection(t0) {
9075
- const $ = c(16);
9580
+ const $ = c(18);
9076
9581
  const { content: t1, max } = t0;
9077
- const { type, quantity, active } = t1;
9582
+ const { type, quantity, active, mutatedFrom } = t1;
9078
9583
  const store = useFitStore();
9079
- const room = useDroneRoom(type);
9080
- const t2 = `Active ${type.name}`;
9081
- let t3;
9082
- if ($[0] !== active || $[1] !== max || $[2] !== quantity || $[3] !== room || $[4] !== store || $[5] !== type.id) {
9083
- let t4;
9084
- if ($[7] !== active || $[8] !== quantity || $[9] !== room || $[10] !== store || $[11] !== type.id) {
9085
- t4 = (_, index) => {
9086
- const count = index + 1;
9087
- const state = count <= active ? "active" : count > quantity ? "none" : count <= active + room ? "open" : "over";
9088
- return /* @__PURE__ */ jsx("button", {
9089
- type: "button",
9584
+ const room = useDroneRoom(mutatedFrom ?? type);
9585
+ let t2;
9586
+ if ($[0] !== mutatedFrom || $[1] !== store || $[2] !== type) {
9587
+ t2 = (count) => {
9588
+ if (mutatedFrom) store.setActiveMutatedDrones(mutatedFrom.id, count);
9589
+ else store.setActiveDrones(type.id, count);
9590
+ };
9591
+ $[0] = mutatedFrom;
9592
+ $[1] = store;
9593
+ $[2] = type;
9594
+ $[3] = t2;
9595
+ } else t2 = $[3];
9596
+ const select = t2;
9597
+ const t3 = `Active ${mutatedFrom ? `Mutated ${mutatedFrom.name}` : type.name}`;
9598
+ let t4;
9599
+ if ($[4] !== active || $[5] !== max || $[6] !== quantity || $[7] !== room || $[8] !== select) {
9600
+ let t5;
9601
+ if ($[10] !== active || $[11] !== quantity || $[12] !== room || $[13] !== select) {
9602
+ t5 = (_, index) => {
9603
+ const count_0 = index + 1;
9604
+ const state = count_0 <= active ? "active" : count_0 > quantity ? "none" : count_0 <= active + room ? "open" : "over";
9605
+ return /* @__PURE__ */ jsx("button", {
9606
+ type: "button",
9090
9607
  className: BayContents_module_default.box,
9091
- "aria-label": `${count} active`,
9092
- "aria-pressed": count === active,
9608
+ "aria-label": `${count_0} active`,
9609
+ "aria-pressed": count_0 === active,
9093
9610
  "data-state": state,
9094
9611
  disabled: state === "over" || state === "none",
9095
- onClick: () => store.setActiveDrones(type.id, count === active ? count - 1 : count),
9096
- children: count <= active && "×"
9097
- }, count);
9612
+ onClick: () => select(count_0 === active ? count_0 - 1 : count_0),
9613
+ children: count_0 <= active && "×"
9614
+ }, count_0);
9098
9615
  };
9099
- $[7] = active;
9100
- $[8] = quantity;
9101
- $[9] = room;
9102
- $[10] = store;
9103
- $[11] = type.id;
9104
- $[12] = t4;
9105
- } else t4 = $[12];
9106
- t3 = Array.from({ length: Math.max(max, active) }, t4);
9107
- $[0] = active;
9108
- $[1] = max;
9109
- $[2] = quantity;
9110
- $[3] = room;
9111
- $[4] = store;
9112
- $[5] = type.id;
9113
- $[6] = t3;
9114
- } else t3 = $[6];
9115
- let t4;
9116
- if ($[13] !== t2 || $[14] !== t3) {
9117
- t4 = /* @__PURE__ */ jsxs("span", {
9616
+ $[10] = active;
9617
+ $[11] = quantity;
9618
+ $[12] = room;
9619
+ $[13] = select;
9620
+ $[14] = t5;
9621
+ } else t5 = $[14];
9622
+ t4 = Array.from({ length: Math.max(max, active) }, t5);
9623
+ $[4] = active;
9624
+ $[5] = max;
9625
+ $[6] = quantity;
9626
+ $[7] = room;
9627
+ $[8] = select;
9628
+ $[9] = t4;
9629
+ } else t4 = $[9];
9630
+ let t5;
9631
+ if ($[15] !== t3 || $[16] !== t4) {
9632
+ t5 = /* @__PURE__ */ jsxs("span", {
9118
9633
  className: BayContents_module_default.selection,
9119
9634
  role: "group",
9120
- "aria-label": t2,
9121
- children: ["Selected:", t3]
9635
+ "aria-label": t3,
9636
+ children: ["Selected:", t4]
9122
9637
  });
9123
- $[13] = t2;
9124
- $[14] = t3;
9125
- $[15] = t4;
9126
- } else t4 = $[15];
9127
- return t4;
9638
+ $[15] = t3;
9639
+ $[16] = t4;
9640
+ $[17] = t5;
9641
+ } else t5 = $[17];
9642
+ return t5;
9128
9643
  }
9129
9644
  /** EVE's count of a row, which turns into a spinner on hover and focus. */
9130
9645
  function Quantity(t0) {
@@ -9777,11 +10292,7 @@ function FitName() {
9777
10292
  } else t7 = $[16];
9778
10293
  let t8;
9779
10294
  if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
9780
- t8 = /* @__PURE__ */ jsx(NotImplementedButton, {
9781
- className: FittingWindow_module_default.icon,
9782
- icon: "link",
9783
- label: "Link Fit"
9784
- });
10295
+ t8 = /* @__PURE__ */ jsx(LinkFitButton, {});
9785
10296
  $[17] = t8;
9786
10297
  } else t8 = $[17];
9787
10298
  let t9;
@@ -9907,7 +10418,7 @@ function Violations() {
9907
10418
  group: t2
9908
10419
  };
9909
10420
  const linesOf = (kind) => {
9910
- const violations = kind === "skill" ? missingSkills(stats.violations).map(_temp2$4) : stats.violations.filter((t5) => {
10421
+ const violations = kind === "skill" ? missingSkills(stats.violations).map(_temp2$5) : stats.violations.filter((t5) => {
9911
10422
  const { rule: rule_0 } = t5;
9912
10423
  return violationKind(rule_0) === kind;
9913
10424
  });
@@ -9930,7 +10441,7 @@ function Violations() {
9930
10441
  className: FittingWindow_module_default.alertTitle,
9931
10442
  children: title
9932
10443
  }),
9933
- description: lines.map(_temp3$2)
10444
+ description: lines.map(_temp3$1)
9934
10445
  })
9935
10446
  }),
9936
10447
  children: /* @__PURE__ */ jsxs("span", {
@@ -9976,53 +10487,67 @@ function Violations() {
9976
10487
  } else t5 = $[16];
9977
10488
  return t5;
9978
10489
  }
9979
- function _temp3$2(line) {
10490
+ function _temp3$1(line) {
9980
10491
  return /* @__PURE__ */ jsx("span", {
9981
10492
  className: FittingWindow_module_default.alertLine,
9982
10493
  children: line
9983
10494
  }, line);
9984
10495
  }
9985
- function _temp2$4(rule) {
10496
+ function _temp2$5(rule) {
9986
10497
  return {
9987
10498
  target: { type: "ship" },
9988
10499
  rule
9989
10500
  };
9990
10501
  }
9991
- function NotImplementedButton(t0) {
9992
- const $ = c(9);
9993
- const { className, icon, label } = t0;
9994
- const t1 = `${label} (not implemented yet)`;
10502
+ function LinkFitButton() {
10503
+ const $ = c(13);
10504
+ const link = useFitLink();
10505
+ const { copy, dialog } = useCopyText("Link Fit", "link", 4);
10506
+ const [copied, flashCopied] = useFlash();
10507
+ const t0 = copied ? "Link copied" : "Link Fit";
10508
+ let t1;
10509
+ if ($[0] !== copy || $[1] !== flashCopied || $[2] !== link) {
10510
+ t1 = () => copy(link, flashCopied);
10511
+ $[0] = copy;
10512
+ $[1] = flashCopied;
10513
+ $[2] = link;
10514
+ $[3] = t1;
10515
+ } else t1 = $[3];
9995
10516
  let t2;
9996
- if ($[0] !== icon) {
9997
- t2 = /* @__PURE__ */ jsx(Icon, { name: icon });
9998
- $[0] = icon;
9999
- $[1] = t2;
10000
- } else t2 = $[1];
10517
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
10518
+ t2 = /* @__PURE__ */ jsx(Icon, { name: "link" });
10519
+ $[4] = t2;
10520
+ } else t2 = $[4];
10001
10521
  let t3;
10002
- if ($[2] !== className || $[3] !== label || $[4] !== t2) {
10522
+ if ($[5] !== t1) {
10003
10523
  t3 = /* @__PURE__ */ jsx("button", {
10004
10524
  type: "button",
10005
- className,
10006
- "aria-label": label,
10007
- "aria-disabled": true,
10525
+ className: FittingWindow_module_default.icon,
10526
+ "aria-label": "Link Fit",
10527
+ onClick: t1,
10008
10528
  children: t2
10009
10529
  });
10010
- $[2] = className;
10011
- $[3] = label;
10012
- $[4] = t2;
10013
- $[5] = t3;
10014
- } else t3 = $[5];
10530
+ $[5] = t1;
10531
+ $[6] = t3;
10532
+ } else t3 = $[6];
10015
10533
  let t4;
10016
- if ($[6] !== t1 || $[7] !== t3) {
10534
+ if ($[7] !== t0 || $[8] !== t3) {
10017
10535
  t4 = /* @__PURE__ */ jsx(Tooltip, {
10018
- label: t1,
10536
+ label: t0,
10019
10537
  children: t3
10020
10538
  });
10021
- $[6] = t1;
10022
- $[7] = t3;
10023
- $[8] = t4;
10024
- } else t4 = $[8];
10025
- return t4;
10539
+ $[7] = t0;
10540
+ $[8] = t3;
10541
+ $[9] = t4;
10542
+ } else t4 = $[9];
10543
+ let t5;
10544
+ if ($[10] !== dialog || $[11] !== t4) {
10545
+ t5 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t4, dialog] });
10546
+ $[10] = dialog;
10547
+ $[11] = t4;
10548
+ $[12] = t5;
10549
+ } else t5 = $[12];
10550
+ return t5;
10026
10551
  }
10027
10552
  function Bay({ bay, icon, label, unlimited = false, id: givenId, readOnly = false }) {
10028
10553
  const { used, total } = useBayUsage(bay);
@@ -10453,38 +10978,6 @@ function SimulationHistory() {
10453
10978
  } else t1 = $[9];
10454
10979
  return t1;
10455
10980
  }
10456
- // src/components/ItemBrowser/ItemBrowser.module.css
10457
- var ItemBrowser_module_default = {
10458
- "action": "xFSZwa_action",
10459
- "actions": "xFSZwa_actions",
10460
- "browser": "xFSZwa_browser",
10461
- "collapse": "xFSZwa_collapse",
10462
- "confirm": "xFSZwa_confirm",
10463
- "copy": "xFSZwa_copy",
10464
- "copyAnchor": "xFSZwa_copyAnchor",
10465
- "count": "xFSZwa_count",
10466
- "counts": "xFSZwa_counts",
10467
- "dialogButtons": "xFSZwa_dialogButtons",
10468
- "dragImage": "xFSZwa_dragImage",
10469
- "empty": "xFSZwa_empty",
10470
- "field": "xFSZwa_field",
10471
- "filters": "xFSZwa_filters",
10472
- "flyable": "xFSZwa_flyable",
10473
- "form": "xFSZwa_form",
10474
- "hull": "xFSZwa_hull",
10475
- "importError": "xFSZwa_importError",
10476
- "info": "xFSZwa_info",
10477
- "kind": "xFSZwa_kind",
10478
- "menu": "xFSZwa_menu",
10479
- "panel": "xFSZwa_panel",
10480
- "search": "xFSZwa_search",
10481
- "simulate": "xFSZwa_simulate",
10482
- "tab": "xFSZwa_tab",
10483
- "tabs": "xFSZwa_tabs",
10484
- "tree": "xFSZwa_tree",
10485
- "unseen": "xFSZwa_unseen",
10486
- "views": "xFSZwa_views"
10487
- };
10488
10981
  // src/components/ItemBrowser/Search.tsx
10489
10982
  /** The search field above a list of the `ItemBrowser`, after a button that collapses every group. */
10490
10983
  function Search(t0) {
@@ -10708,7 +11201,7 @@ function useTypeActions(noHullSelected) {
10708
11201
  if (slot !== void 0) showMutate(slot, {
10709
11202
  element: anchor,
10710
11203
  side: "right"
10711
- });
11204
+ }, type_1.id);
10712
11205
  }
10713
11206
  }
10714
11207
  ]);
@@ -11202,147 +11695,543 @@ function Charges(t0) {
11202
11695
  } else t12 = $[47];
11203
11696
  return t12;
11204
11697
  }
11205
- // src/components/ItemBrowser/copyFit.tsx
11206
- /** Copies a fit to the clipboard, or shows it in `dialog` when the browser refuses; render `dialog` once. */
11207
- function useCopyFit() {
11208
- const $ = c(11);
11698
+ // src/components/ItemBrowser/saveFit.tsx
11699
+ const MAX_ESI_NAME = 50;
11700
+ /** Saves a fit to where saves go, asking what it needs first; render `dialog` once. */
11701
+ function useSaveFit() {
11702
+ const $ = c(68);
11209
11703
  const engine = useEngine();
11210
- const [refused, setRefused] = useState();
11211
11704
  let t0;
11212
11705
  if ($[0] !== engine) {
11213
- t0 = (fit, format, onCopied) => {
11214
- const text = engine.saveText(fit, format);
11215
- Promise.resolve().then(() => navigator.clipboard.writeText(text)).then(onCopied, () => setRefused(text));
11216
- };
11706
+ t0 = (typeId) => engine.sde.type(typeId)?.name ?? String(typeId);
11217
11707
  $[0] = engine;
11218
11708
  $[1] = t0;
11219
11709
  } else t0 = $[1];
11220
- const copy = t0;
11221
- const t1 = refused !== void 0;
11710
+ const typeName = t0;
11711
+ const { characters, target, fits, pick, save: saveToTarget } = useFitSaving();
11712
+ const [asking, setAsking] = useState();
11713
+ const [notice, setNotice] = useState();
11714
+ const [saving, setSaving] = useState(false);
11715
+ let t1;
11716
+ if ($[2] !== saveToTarget || $[3] !== target) {
11717
+ t1 = (t2, t3) => {
11718
+ const { fit, onStart, onSaved } = t2;
11719
+ const replace = t3 === void 0 ? false : t3;
11720
+ setAsking(void 0);
11721
+ onStart?.(fit);
11722
+ if (target === void 0) {
11723
+ saveToTarget(fit);
11724
+ onSaved?.();
11725
+ return;
11726
+ }
11727
+ setSaving(true);
11728
+ saveToTarget(fit, replace).then(() => onSaved?.(), (error) => {
11729
+ console.error(error);
11730
+ setNotice("EVE did not save this fit. Please try again.");
11731
+ }).finally(() => setSaving(false));
11732
+ };
11733
+ $[2] = saveToTarget;
11734
+ $[3] = target;
11735
+ $[4] = t1;
11736
+ } else t1 = $[4];
11737
+ const finish = t1;
11222
11738
  let t2;
11223
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
11224
- t2 = () => setRefused(void 0);
11225
- $[2] = t2;
11226
- } else t2 = $[2];
11227
- const t3 = refused ?? "";
11739
+ if ($[5] !== engine || $[6] !== finish || $[7] !== fits || $[8] !== target) {
11740
+ t2 = (job) => {
11741
+ const existing = fits.find((one) => one.ship.type_id === job.fit.ship.type_id && one.name === job.fit.name);
11742
+ if (existing === void 0) return finish(job);
11743
+ if (target === void 0) {
11744
+ if (JSON.stringify(existing) === JSON.stringify(job.fit)) return finish(job);
11745
+ } else if (JSON.stringify(engine.saveEsiFitting(existing)) === JSON.stringify(engine.saveEsiFitting(job.fit))) {
11746
+ setAsking(void 0);
11747
+ job.onStart?.(job.fit);
11748
+ job.onSaved?.();
11749
+ return;
11750
+ }
11751
+ setAsking({
11752
+ kind: "replace",
11753
+ job
11754
+ });
11755
+ };
11756
+ $[5] = engine;
11757
+ $[6] = finish;
11758
+ $[7] = fits;
11759
+ $[8] = target;
11760
+ $[9] = t2;
11761
+ } else t2 = $[9];
11762
+ const askReplace = t2;
11763
+ let t3;
11764
+ if ($[10] !== askReplace || $[11] !== target || $[12] !== typeName) {
11765
+ t3 = (job_0) => {
11766
+ const modules = target === void 0 ? [] : job_0.fit.items.flatMap((t4) => {
11767
+ const { type_id, mutation } = t4;
11768
+ return mutation === void 0 ? [] : [`${typeName(type_id)} → ${typeName(mutation.base)}`];
11769
+ });
11770
+ if (modules.length > 0) setAsking({
11771
+ kind: "mutated",
11772
+ job: job_0,
11773
+ modules
11774
+ });
11775
+ else askReplace(job_0);
11776
+ };
11777
+ $[10] = askReplace;
11778
+ $[11] = target;
11779
+ $[12] = typeName;
11780
+ $[13] = t3;
11781
+ } else t3 = $[13];
11782
+ const askMutated = t3;
11228
11783
  let t4;
11229
- if ($[3] !== t3) {
11230
- t4 = /* @__PURE__ */ jsx(CopyForm, { text: t3 });
11231
- $[3] = t3;
11232
- $[4] = t4;
11233
- } else t4 = $[4];
11784
+ if ($[14] !== askMutated || $[15] !== engine || $[16] !== saving || $[17] !== target) {
11785
+ t4 = (fit_0, callbacks) => {
11786
+ if (saving) return;
11787
+ if (target !== void 0 && engine.saveEsiFitting(fit_0).items.length === 0) {
11788
+ setNotice("EVE can't save an empty hull. Fit a module first.");
11789
+ return;
11790
+ }
11791
+ const job_1 = {
11792
+ fit: fit_0,
11793
+ ...callbacks
11794
+ };
11795
+ if (!fit_0.name || target !== void 0 && fit_0.name.length > MAX_ESI_NAME) setAsking({
11796
+ kind: "name",
11797
+ job: job_1
11798
+ });
11799
+ else askMutated(job_1);
11800
+ };
11801
+ $[14] = askMutated;
11802
+ $[15] = engine;
11803
+ $[16] = saving;
11804
+ $[17] = target;
11805
+ $[18] = t4;
11806
+ } else t4 = $[18];
11807
+ const save = t4;
11234
11808
  let t5;
11235
- if ($[5] !== t1 || $[6] !== t4) {
11236
- t5 = /* @__PURE__ */ jsx(Dialog, {
11237
- open: t1,
11238
- title: "Copy Fit",
11239
- onClose: t2,
11240
- children: t4
11809
+ if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
11810
+ t5 = () => setAsking(void 0);
11811
+ $[19] = t5;
11812
+ } else t5 = $[19];
11813
+ const close = t5;
11814
+ const name = asking?.job.fit.name;
11815
+ const t6 = asking?.kind === "name";
11816
+ let t7;
11817
+ if ($[20] !== askMutated || $[21] !== asking || $[22] !== target) {
11818
+ t7 = asking?.kind === "name" && /* @__PURE__ */ jsx(NameForm, {
11819
+ fit: asking.job.fit,
11820
+ maxLength: target === void 0 ? void 0 : MAX_ESI_NAME,
11821
+ onCancel: close,
11822
+ onSave: (named) => askMutated({
11823
+ ...asking.job,
11824
+ fit: named
11825
+ })
11241
11826
  });
11242
- $[5] = t1;
11243
- $[6] = t4;
11244
- $[7] = t5;
11245
- } else t5 = $[7];
11246
- let t6;
11247
- if ($[8] !== copy || $[9] !== t5) {
11248
- t6 = {
11249
- copy,
11250
- dialog: t5
11251
- };
11252
- $[8] = copy;
11253
- $[9] = t5;
11254
- $[10] = t6;
11255
- } else t6 = $[10];
11256
- return t6;
11257
- }
11258
- function CopyForm(t0) {
11259
- const $ = c(8);
11260
- const { text } = t0;
11261
- const id = useId();
11262
- let t1;
11263
- if ($[0] !== id) {
11264
- t1 = /* @__PURE__ */ jsx("label", {
11265
- htmlFor: id,
11266
- children: "The browser blocked the clipboard. Copy the fit from here."
11827
+ $[20] = askMutated;
11828
+ $[21] = asking;
11829
+ $[22] = target;
11830
+ $[23] = t7;
11831
+ } else t7 = $[23];
11832
+ let t8;
11833
+ if ($[24] !== t6 || $[25] !== t7) {
11834
+ t8 = /* @__PURE__ */ jsx(Dialog, {
11835
+ open: t6,
11836
+ title: "Save Fit",
11837
+ onClose: close,
11838
+ children: t7
11267
11839
  });
11268
- $[0] = id;
11840
+ $[24] = t6;
11841
+ $[25] = t7;
11842
+ $[26] = t8;
11843
+ } else t8 = $[26];
11844
+ const t9 = asking?.kind === "mutated";
11845
+ const t10 = asking?.kind === "mutated" ? asking.modules : void 0;
11846
+ let t11;
11847
+ if ($[27] !== askReplace || $[28] !== asking) {
11848
+ t11 = () => asking && askReplace(asking.job);
11849
+ $[27] = askReplace;
11850
+ $[28] = asking;
11851
+ $[29] = t11;
11852
+ } else t11 = $[29];
11853
+ let t12;
11854
+ if ($[30] !== t10 || $[31] !== t11) {
11855
+ t12 = /* @__PURE__ */ jsx(Confirm, {
11856
+ text: "EVE can't store mutated modules. These will be saved as their normal modules:",
11857
+ list: t10,
11858
+ action: "Save anyway",
11859
+ onCancel: close,
11860
+ onConfirm: t11
11861
+ });
11862
+ $[30] = t10;
11863
+ $[31] = t11;
11864
+ $[32] = t12;
11865
+ } else t12 = $[32];
11866
+ let t13;
11867
+ if ($[33] !== t12 || $[34] !== t9) {
11868
+ t13 = /* @__PURE__ */ jsx(Dialog, {
11869
+ open: t9,
11870
+ title: "Save to EVE?",
11871
+ onClose: close,
11872
+ children: t12
11873
+ });
11874
+ $[33] = t12;
11875
+ $[34] = t9;
11876
+ $[35] = t13;
11877
+ } else t13 = $[35];
11878
+ const t14 = asking?.kind === "replace";
11879
+ const t15 = target === void 0 ? "Overwrite Fit?" : "Replace Fit?";
11880
+ const t16 = target === void 0 ? `A fit named "${name}" is already saved for this hull. Overwrite it?` : `${target.name} already has a fit named "${name}" for this hull. Replace it?`;
11881
+ const t17 = target === void 0 ? "Overwrite" : "Replace";
11882
+ let t18;
11883
+ if ($[36] !== asking || $[37] !== finish) {
11884
+ t18 = () => asking && finish(asking.job, true);
11885
+ $[36] = asking;
11886
+ $[37] = finish;
11887
+ $[38] = t18;
11888
+ } else t18 = $[38];
11889
+ let t19;
11890
+ if ($[39] !== t16 || $[40] !== t17 || $[41] !== t18) {
11891
+ t19 = /* @__PURE__ */ jsx(Confirm, {
11892
+ text: t16,
11893
+ action: t17,
11894
+ onCancel: close,
11895
+ onConfirm: t18
11896
+ });
11897
+ $[39] = t16;
11898
+ $[40] = t17;
11899
+ $[41] = t18;
11900
+ $[42] = t19;
11901
+ } else t19 = $[42];
11902
+ let t20;
11903
+ if ($[43] !== t14 || $[44] !== t15 || $[45] !== t19) {
11904
+ t20 = /* @__PURE__ */ jsx(Dialog, {
11905
+ open: t14,
11906
+ title: t15,
11907
+ onClose: close,
11908
+ children: t19
11909
+ });
11910
+ $[43] = t14;
11911
+ $[44] = t15;
11912
+ $[45] = t19;
11913
+ $[46] = t20;
11914
+ } else t20 = $[46];
11915
+ const t21 = notice !== void 0;
11916
+ let t22;
11917
+ if ($[47] === Symbol.for("react.memo_cache_sentinel")) {
11918
+ t22 = () => setNotice(void 0);
11919
+ $[47] = t22;
11920
+ } else t22 = $[47];
11921
+ let t23;
11922
+ if ($[48] !== notice) {
11923
+ t23 = /* @__PURE__ */ jsx("p", { children: notice });
11924
+ $[48] = notice;
11925
+ $[49] = t23;
11926
+ } else t23 = $[49];
11927
+ let t24;
11928
+ if ($[50] === Symbol.for("react.memo_cache_sentinel")) {
11929
+ t24 = /* @__PURE__ */ jsx("div", {
11930
+ className: ItemBrowser_module_default.dialogButtons,
11931
+ children: /* @__PURE__ */ jsx("button", {
11932
+ type: "button",
11933
+ className: ItemBrowser_module_default.action,
11934
+ onClick: () => setNotice(void 0),
11935
+ children: "Close"
11936
+ })
11937
+ });
11938
+ $[50] = t24;
11939
+ } else t24 = $[50];
11940
+ let t25;
11941
+ if ($[51] !== t23) {
11942
+ t25 = /* @__PURE__ */ jsxs("div", {
11943
+ className: ItemBrowser_module_default.confirm,
11944
+ children: [t23, t24]
11945
+ });
11946
+ $[51] = t23;
11947
+ $[52] = t25;
11948
+ } else t25 = $[52];
11949
+ let t26;
11950
+ if ($[53] !== t21 || $[54] !== t25) {
11951
+ t26 = /* @__PURE__ */ jsx(Dialog, {
11952
+ open: t21,
11953
+ title: "Save to EVE",
11954
+ onClose: t22,
11955
+ children: t25
11956
+ });
11957
+ $[53] = t21;
11958
+ $[54] = t25;
11959
+ $[55] = t26;
11960
+ } else t26 = $[55];
11961
+ let t27;
11962
+ if ($[56] !== t13 || $[57] !== t20 || $[58] !== t26 || $[59] !== t8) {
11963
+ t27 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
11964
+ t8,
11965
+ t13,
11966
+ t20,
11967
+ t26
11968
+ ] });
11969
+ $[56] = t13;
11970
+ $[57] = t20;
11971
+ $[58] = t26;
11972
+ $[59] = t8;
11973
+ $[60] = t27;
11974
+ } else t27 = $[60];
11975
+ let t28;
11976
+ if ($[61] !== characters || $[62] !== pick || $[63] !== save || $[64] !== saving || $[65] !== t27 || $[66] !== target) {
11977
+ t28 = {
11978
+ characters,
11979
+ target,
11980
+ pick,
11981
+ save,
11982
+ saving,
11983
+ dialog: t27
11984
+ };
11985
+ $[61] = characters;
11986
+ $[62] = pick;
11987
+ $[63] = save;
11988
+ $[64] = saving;
11989
+ $[65] = t27;
11990
+ $[66] = target;
11991
+ $[67] = t28;
11992
+ } else t28 = $[67];
11993
+ return t28;
11994
+ }
11995
+ function Confirm(t0) {
11996
+ const $ = c(16);
11997
+ const { text, list, action, onCancel, onConfirm } = t0;
11998
+ let t1;
11999
+ if ($[0] !== text) {
12000
+ t1 = /* @__PURE__ */ jsx("p", { children: text });
12001
+ $[0] = text;
11269
12002
  $[1] = t1;
11270
12003
  } else t1 = $[1];
11271
12004
  let t2;
11272
- if ($[2] !== id || $[3] !== text) {
11273
- t2 = /* @__PURE__ */ jsx("textarea", {
11274
- id,
11275
- rows: 12,
11276
- readOnly: true,
11277
- value: text,
11278
- onFocus: _temp$6
11279
- });
11280
- $[2] = id;
11281
- $[3] = text;
11282
- $[4] = t2;
11283
- } else t2 = $[4];
12005
+ if ($[2] !== list) {
12006
+ t2 = list !== void 0 && /* @__PURE__ */ jsx("ul", { children: list.map(_temp$6) });
12007
+ $[2] = list;
12008
+ $[3] = t2;
12009
+ } else t2 = $[3];
11284
12010
  let t3;
11285
- if ($[5] !== t1 || $[6] !== t2) {
11286
- t3 = /* @__PURE__ */ jsxs("div", {
11287
- className: ItemBrowser_module_default.form,
11288
- children: [t1, t2]
12011
+ if ($[4] !== onCancel) {
12012
+ t3 = /* @__PURE__ */ jsx("button", {
12013
+ type: "button",
12014
+ className: ItemBrowser_module_default.action,
12015
+ onClick: onCancel,
12016
+ children: "Cancel"
11289
12017
  });
11290
- $[5] = t1;
11291
- $[6] = t2;
11292
- $[7] = t3;
11293
- } else t3 = $[7];
11294
- return t3;
11295
- }
11296
- function _temp$6(event) {
11297
- return event.currentTarget.select();
11298
- }
11299
- // src/components/ItemBrowser/FitActions.tsx
11300
- const FLASH_MS = 2e3;
11301
- /** The buttons under the `ItemBrowser`: save the fit in the browser, import one, or copy it out. */
11302
- function FitActions(t0) {
11303
- const $ = c(80);
11304
- const { noHullSelected, pasteToOpen } = t0;
11305
- const engine = useEngine();
11306
- const fit = useFit();
11307
- const store = useFitStore();
11308
- const { fits, save } = useLocalFits();
11309
- const menu = useId();
11310
- const [saved, flashSaved] = useFlash();
11311
- const [copied, flashCopied] = useFlash();
11312
- const [importing, setImporting] = useState();
11313
- const [naming, setNaming] = useState(false);
11314
- const [overwriting, setOverwriting] = useState();
11315
- const { copy: copyFit, dialog: copyDialog } = useCopyFit();
12018
+ $[4] = onCancel;
12019
+ $[5] = t3;
12020
+ } else t3 = $[5];
12021
+ let t4;
12022
+ if ($[6] !== action || $[7] !== onConfirm) {
12023
+ t4 = /* @__PURE__ */ jsx("button", {
12024
+ type: "button",
12025
+ className: ItemBrowser_module_default.action,
12026
+ onClick: onConfirm,
12027
+ children: action
12028
+ });
12029
+ $[6] = action;
12030
+ $[7] = onConfirm;
12031
+ $[8] = t4;
12032
+ } else t4 = $[8];
12033
+ let t5;
12034
+ if ($[9] !== t3 || $[10] !== t4) {
12035
+ t5 = /* @__PURE__ */ jsxs("div", {
12036
+ className: ItemBrowser_module_default.dialogButtons,
12037
+ children: [t3, t4]
12038
+ });
12039
+ $[9] = t3;
12040
+ $[10] = t4;
12041
+ $[11] = t5;
12042
+ } else t5 = $[11];
12043
+ let t6;
12044
+ if ($[12] !== t1 || $[13] !== t2 || $[14] !== t5) {
12045
+ t6 = /* @__PURE__ */ jsxs("div", {
12046
+ className: ItemBrowser_module_default.confirm,
12047
+ children: [
12048
+ t1,
12049
+ t2,
12050
+ t5
12051
+ ]
12052
+ });
12053
+ $[12] = t1;
12054
+ $[13] = t2;
12055
+ $[14] = t5;
12056
+ $[15] = t6;
12057
+ } else t6 = $[15];
12058
+ return t6;
12059
+ }
12060
+ function _temp$6(line, index) {
12061
+ return /* @__PURE__ */ jsx("li", { children: line }, index);
12062
+ }
12063
+ function NameForm(t0) {
12064
+ const $ = c(32);
12065
+ const { fit, maxLength, onCancel, onSave } = t0;
12066
+ const engine = useEngine();
12067
+ const id = useId();
11316
12068
  let t1;
11317
- if ($[0] !== flashSaved || $[1] !== save || $[2] !== store) {
11318
- t1 = (named) => {
11319
- setOverwriting(void 0);
11320
- store.setName(named.name ?? "");
11321
- save(named);
11322
- flashSaved();
11323
- };
11324
- $[0] = flashSaved;
11325
- $[1] = save;
11326
- $[2] = store;
12069
+ if ($[0] !== engine || $[1] !== fit.name || $[2] !== fit.ship) {
12070
+ t1 = () => fit.name || (engine.sde.type(fit.ship.type_id)?.name ?? "");
12071
+ $[0] = engine;
12072
+ $[1] = fit.name;
12073
+ $[2] = fit.ship;
11327
12074
  $[3] = t1;
11328
12075
  } else t1 = $[3];
11329
- const saveNow = t1;
12076
+ const [name, setName] = useState(t1);
11330
12077
  let t2;
11331
- if ($[4] !== fits || $[5] !== saveNow) {
11332
- t2 = (named_0) => {
11333
- const existing = fits.find((one) => one.ship.type_id === named_0.ship.type_id && one.name === named_0.name);
11334
- if (existing === void 0 || JSON.stringify(existing) === JSON.stringify(named_0)) saveNow(named_0);
11335
- else setOverwriting(named_0);
11336
- };
11337
- $[4] = fits;
11338
- $[5] = saveNow;
11339
- $[6] = t2;
11340
- } else t2 = $[6];
11341
- const trySave = t2;
12078
+ if ($[4] !== name) {
12079
+ t2 = name.trim();
12080
+ $[4] = name;
12081
+ $[5] = t2;
12082
+ } else t2 = $[5];
12083
+ const trimmed = t2;
12084
+ const tooLong = maxLength !== void 0 && trimmed.length > maxLength;
11342
12085
  let t3;
12086
+ if ($[6] !== fit || $[7] !== onSave || $[8] !== trimmed) {
12087
+ t3 = (event) => {
12088
+ event.preventDefault();
12089
+ onSave({
12090
+ ...fit,
12091
+ name: trimmed
12092
+ });
12093
+ };
12094
+ $[6] = fit;
12095
+ $[7] = onSave;
12096
+ $[8] = trimmed;
12097
+ $[9] = t3;
12098
+ } else t3 = $[9];
11343
12099
  let t4;
11344
- if ($[7] !== engine || $[8] !== noHullSelected || $[9] !== pasteToOpen || $[10] !== store) {
11345
- t3 = () => {
12100
+ if ($[10] !== id) {
12101
+ t4 = /* @__PURE__ */ jsx("label", {
12102
+ htmlFor: id,
12103
+ children: "Name this fit."
12104
+ });
12105
+ $[10] = id;
12106
+ $[11] = t4;
12107
+ } else t4 = $[11];
12108
+ let t5;
12109
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
12110
+ t5 = (event_1) => setName(event_1.target.value);
12111
+ $[12] = t5;
12112
+ } else t5 = $[12];
12113
+ let t6;
12114
+ if ($[13] !== id || $[14] !== name) {
12115
+ t6 = /* @__PURE__ */ jsx("input", {
12116
+ id,
12117
+ value: name,
12118
+ onFocus: _temp2$4,
12119
+ onChange: t5
12120
+ });
12121
+ $[13] = id;
12122
+ $[14] = name;
12123
+ $[15] = t6;
12124
+ } else t6 = $[15];
12125
+ let t7;
12126
+ if ($[16] !== maxLength || $[17] !== tooLong) {
12127
+ t7 = tooLong && /* @__PURE__ */ jsxs("p", {
12128
+ className: ItemBrowser_module_default.importError,
12129
+ role: "alert",
12130
+ children: [
12131
+ "EVE allows ",
12132
+ maxLength,
12133
+ " characters at most."
12134
+ ]
12135
+ });
12136
+ $[16] = maxLength;
12137
+ $[17] = tooLong;
12138
+ $[18] = t7;
12139
+ } else t7 = $[18];
12140
+ let t8;
12141
+ if ($[19] !== onCancel) {
12142
+ t8 = /* @__PURE__ */ jsx("button", {
12143
+ type: "button",
12144
+ className: ItemBrowser_module_default.action,
12145
+ onClick: onCancel,
12146
+ children: "Cancel"
12147
+ });
12148
+ $[19] = onCancel;
12149
+ $[20] = t8;
12150
+ } else t8 = $[20];
12151
+ const t9 = trimmed === "" || tooLong;
12152
+ let t10;
12153
+ if ($[21] !== t9) {
12154
+ t10 = /* @__PURE__ */ jsx("button", {
12155
+ type: "submit",
12156
+ className: ItemBrowser_module_default.action,
12157
+ disabled: t9,
12158
+ children: "Save"
12159
+ });
12160
+ $[21] = t9;
12161
+ $[22] = t10;
12162
+ } else t10 = $[22];
12163
+ let t11;
12164
+ if ($[23] !== t10 || $[24] !== t8) {
12165
+ t11 = /* @__PURE__ */ jsxs("div", {
12166
+ className: ItemBrowser_module_default.dialogButtons,
12167
+ children: [t8, t10]
12168
+ });
12169
+ $[23] = t10;
12170
+ $[24] = t8;
12171
+ $[25] = t11;
12172
+ } else t11 = $[25];
12173
+ let t12;
12174
+ if ($[26] !== t11 || $[27] !== t3 || $[28] !== t4 || $[29] !== t6 || $[30] !== t7) {
12175
+ t12 = /* @__PURE__ */ jsxs("form", {
12176
+ className: ItemBrowser_module_default.form,
12177
+ onSubmit: t3,
12178
+ children: [
12179
+ t4,
12180
+ t6,
12181
+ t7,
12182
+ t11
12183
+ ]
12184
+ });
12185
+ $[26] = t11;
12186
+ $[27] = t3;
12187
+ $[28] = t4;
12188
+ $[29] = t6;
12189
+ $[30] = t7;
12190
+ $[31] = t12;
12191
+ } else t12 = $[31];
12192
+ return t12;
12193
+ }
12194
+ function _temp2$4(event_0) {
12195
+ return event_0.currentTarget.select();
12196
+ }
12197
+ // src/components/ItemBrowser/FitActions.tsx
12198
+ /** The buttons under the `ItemBrowser`: save the fit in the browser, import one, or copy it out. */
12199
+ function FitActions(t0) {
12200
+ const $ = c(56);
12201
+ const { noHullSelected, pasteToOpen } = t0;
12202
+ const engine = useEngine();
12203
+ const fit = useFit();
12204
+ const store = useFitStore();
12205
+ const menu = useId();
12206
+ const [saved, flashSaved] = useFlash();
12207
+ const [copied, flashCopied] = useFlash();
12208
+ const [importing, setImporting] = useState();
12209
+ const { copy: copyFit, dialog: copyDialog } = useCopyFit();
12210
+ const saver = useSaveFit();
12211
+ const [savedTo, setSavedTo] = useState("");
12212
+ let t1;
12213
+ if ($[0] !== fit || $[1] !== flashSaved || $[2] !== saver || $[3] !== store) {
12214
+ t1 = () => {
12215
+ const where = saver.target?.name ?? "browser";
12216
+ saver.save(fit, {
12217
+ onStart: (named) => store.setName(named.name ?? ""),
12218
+ onSaved: () => {
12219
+ setSavedTo(where);
12220
+ flashSaved();
12221
+ }
12222
+ });
12223
+ };
12224
+ $[0] = fit;
12225
+ $[1] = flashSaved;
12226
+ $[2] = saver;
12227
+ $[3] = store;
12228
+ $[4] = t1;
12229
+ } else t1 = $[4];
12230
+ const saveCurrent = t1;
12231
+ let t2;
12232
+ let t3;
12233
+ if ($[5] !== engine || $[6] !== noHullSelected || $[7] !== pasteToOpen || $[8] !== store) {
12234
+ t2 = () => {
11346
12235
  if (!pasteToOpen) return;
11347
12236
  const onPaste = (event) => {
11348
12237
  if (event.defaultPrevented) return;
@@ -11370,8 +12259,8 @@ function FitActions(t0) {
11370
12259
  }
11371
12260
  try {
11372
12261
  store.replace(engine.loadText(text, store.character));
11373
- } catch (t5) {
11374
- const failure_0 = t5;
12262
+ } catch (t4) {
12263
+ const failure_0 = t4;
11375
12264
  setImporting({
11376
12265
  text,
11377
12266
  error: failure_0 instanceof Error ? failure_0.message : String(failure_0)
@@ -11381,416 +12270,427 @@ function FitActions(t0) {
11381
12270
  document.addEventListener("paste", onPaste);
11382
12271
  return () => document.removeEventListener("paste", onPaste);
11383
12272
  };
11384
- t4 = [
12273
+ t3 = [
11385
12274
  engine,
11386
12275
  store,
11387
12276
  pasteToOpen,
11388
12277
  noHullSelected
11389
12278
  ];
11390
- $[7] = engine;
11391
- $[8] = noHullSelected;
11392
- $[9] = pasteToOpen;
11393
- $[10] = store;
11394
- $[11] = t3;
11395
- $[12] = t4;
12279
+ $[5] = engine;
12280
+ $[6] = noHullSelected;
12281
+ $[7] = pasteToOpen;
12282
+ $[8] = store;
12283
+ $[9] = t2;
12284
+ $[10] = t3;
11396
12285
  } else {
11397
- t3 = $[11];
11398
- t4 = $[12];
12286
+ t2 = $[9];
12287
+ t3 = $[10];
11399
12288
  }
11400
- useEffect(t3, t4);
11401
- let t5;
11402
- if ($[13] !== copyFit || $[14] !== fit || $[15] !== flashCopied || $[16] !== menu) {
11403
- t5 = (format) => {
12289
+ useEffect(t2, t3);
12290
+ let t4;
12291
+ if ($[11] !== copyFit || $[12] !== fit || $[13] !== flashCopied || $[14] !== menu) {
12292
+ t4 = (format) => {
11404
12293
  document.getElementById(menu)?.hidePopover();
11405
12294
  copyFit(fit, format, flashCopied);
11406
12295
  };
11407
- $[13] = copyFit;
11408
- $[14] = fit;
11409
- $[15] = flashCopied;
11410
- $[16] = menu;
11411
- $[17] = t5;
11412
- } else t5 = $[17];
11413
- const copy = t5;
11414
- let t6;
11415
- if ($[18] !== fit || $[19] !== trySave) {
11416
- t6 = () => fit.name ? trySave(fit) : setNaming(true);
11417
- $[18] = fit;
11418
- $[19] = trySave;
11419
- $[20] = t6;
11420
- } else t6 = $[20];
11421
- const t7 = saved ? "Saved" : "Save";
11422
- let t8;
11423
- if ($[21] !== noHullSelected || $[22] !== t6 || $[23] !== t7) {
11424
- t8 = /* @__PURE__ */ jsx("button", {
12296
+ $[11] = copyFit;
12297
+ $[12] = fit;
12298
+ $[13] = flashCopied;
12299
+ $[14] = menu;
12300
+ $[15] = t4;
12301
+ } else t4 = $[15];
12302
+ const copy = t4;
12303
+ let t5;
12304
+ if ($[16] !== noHullSelected || $[17] !== saveCurrent || $[18] !== saved || $[19] !== savedTo || $[20] !== saver) {
12305
+ t5 = saver.characters === void 0 ? /* @__PURE__ */ jsx("button", {
11425
12306
  type: "button",
11426
12307
  className: ItemBrowser_module_default.action,
11427
12308
  disabled: noHullSelected,
11428
- onClick: t6,
11429
- children: t7
12309
+ onClick: saveCurrent,
12310
+ children: saved ? "Saved" : "Save"
12311
+ }) : /* @__PURE__ */ jsx(SaveSplit, {
12312
+ saver,
12313
+ savedTo: saved ? savedTo : void 0,
12314
+ disabled: noHullSelected,
12315
+ onSave: saveCurrent
11430
12316
  });
11431
- $[21] = noHullSelected;
11432
- $[22] = t6;
11433
- $[23] = t7;
11434
- $[24] = t8;
11435
- } else t8 = $[24];
11436
- let t9;
11437
- if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
11438
- t9 = /* @__PURE__ */ jsx("button", {
12317
+ $[16] = noHullSelected;
12318
+ $[17] = saveCurrent;
12319
+ $[18] = saved;
12320
+ $[19] = savedTo;
12321
+ $[20] = saver;
12322
+ $[21] = t5;
12323
+ } else t5 = $[21];
12324
+ let t6;
12325
+ if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
12326
+ t6 = /* @__PURE__ */ jsx("button", {
11439
12327
  type: "button",
11440
12328
  className: ItemBrowser_module_default.action,
11441
12329
  onClick: () => setImporting({ text: "" }),
11442
12330
  children: "Import…"
11443
12331
  });
11444
- $[25] = t9;
11445
- } else t9 = $[25];
11446
- const t10 = copied ? "Copied" : "Copy";
11447
- const t11 = copied ? "checkmark" : "export";
11448
- let t12;
11449
- if ($[26] !== t11) {
11450
- t12 = /* @__PURE__ */ jsx(Icon, { name: t11 });
11451
- $[26] = t11;
11452
- $[27] = t12;
11453
- } else t12 = $[27];
11454
- let t13;
11455
- if ($[28] !== menu || $[29] !== noHullSelected || $[30] !== t12) {
11456
- t13 = /* @__PURE__ */ jsx("button", {
12332
+ $[22] = t6;
12333
+ } else t6 = $[22];
12334
+ const t7 = copied ? "Copied" : "Copy";
12335
+ const t8 = copied ? "checkmark" : "export";
12336
+ let t9;
12337
+ if ($[23] !== t8) {
12338
+ t9 = /* @__PURE__ */ jsx(Icon, { name: t8 });
12339
+ $[23] = t8;
12340
+ $[24] = t9;
12341
+ } else t9 = $[24];
12342
+ let t10;
12343
+ if ($[25] !== menu || $[26] !== noHullSelected || $[27] !== t9) {
12344
+ t10 = /* @__PURE__ */ jsx("button", {
11457
12345
  type: "button",
11458
12346
  className: `${ItemBrowser_module_default.action} ${ItemBrowser_module_default.copy}`,
11459
12347
  "aria-label": "Copy",
11460
12348
  popoverTarget: menu,
11461
12349
  disabled: noHullSelected,
11462
- children: t12
12350
+ children: t9
11463
12351
  });
11464
- $[28] = menu;
11465
- $[29] = noHullSelected;
11466
- $[30] = t12;
11467
- $[31] = t13;
11468
- } else t13 = $[31];
11469
- let t14;
11470
- if ($[32] !== t10 || $[33] !== t13) {
11471
- t14 = /* @__PURE__ */ jsx("span", {
12352
+ $[25] = menu;
12353
+ $[26] = noHullSelected;
12354
+ $[27] = t9;
12355
+ $[28] = t10;
12356
+ } else t10 = $[28];
12357
+ let t11;
12358
+ if ($[29] !== t10 || $[30] !== t7) {
12359
+ t11 = /* @__PURE__ */ jsx("span", {
11472
12360
  className: ItemBrowser_module_default.copyAnchor,
11473
12361
  children: /* @__PURE__ */ jsx(Tooltip, {
11474
- label: t10,
11475
- children: t13
12362
+ label: t7,
12363
+ children: t10
11476
12364
  })
11477
12365
  });
11478
- $[32] = t10;
11479
- $[33] = t13;
11480
- $[34] = t14;
11481
- } else t14 = $[34];
11482
- let t15;
11483
- if ($[35] !== copy) {
11484
- t15 = /* @__PURE__ */ jsx("button", {
12366
+ $[29] = t10;
12367
+ $[30] = t7;
12368
+ $[31] = t11;
12369
+ } else t11 = $[31];
12370
+ let t12;
12371
+ if ($[32] !== copy) {
12372
+ t12 = /* @__PURE__ */ jsx("button", {
11485
12373
  type: "button",
11486
12374
  role: "menuitem",
11487
12375
  onClick: () => copy("eft"),
11488
12376
  children: "Copy as EFT"
11489
12377
  });
11490
- $[35] = copy;
11491
- $[36] = t15;
11492
- } else t15 = $[36];
11493
- let t16;
11494
- if ($[37] !== copy) {
11495
- t16 = /* @__PURE__ */ jsx("button", {
12378
+ $[32] = copy;
12379
+ $[33] = t12;
12380
+ } else t12 = $[33];
12381
+ let t13;
12382
+ if ($[34] !== copy) {
12383
+ t13 = /* @__PURE__ */ jsx("button", {
11496
12384
  type: "button",
11497
12385
  role: "menuitem",
11498
12386
  onClick: () => copy("esf"),
11499
12387
  children: "Copy as esf/1"
11500
12388
  });
11501
- $[37] = copy;
11502
- $[38] = t16;
11503
- } else t16 = $[38];
11504
- let t17;
11505
- if ($[39] !== menu || $[40] !== t15 || $[41] !== t16) {
11506
- t17 = /* @__PURE__ */ jsxs("div", {
12389
+ $[34] = copy;
12390
+ $[35] = t13;
12391
+ } else t13 = $[35];
12392
+ let t14;
12393
+ if ($[36] !== menu || $[37] !== t12 || $[38] !== t13) {
12394
+ t14 = /* @__PURE__ */ jsxs("div", {
11507
12395
  id: menu,
11508
12396
  className: ItemBrowser_module_default.menu,
11509
12397
  popover: "auto",
11510
12398
  role: "menu",
11511
- children: [t15, t16]
12399
+ children: [t12, t13]
11512
12400
  });
11513
- $[39] = menu;
11514
- $[40] = t15;
11515
- $[41] = t16;
12401
+ $[36] = menu;
12402
+ $[37] = t12;
12403
+ $[38] = t13;
12404
+ $[39] = t14;
12405
+ } else t14 = $[39];
12406
+ const t15 = importing !== void 0;
12407
+ let t16;
12408
+ if ($[40] === Symbol.for("react.memo_cache_sentinel")) {
12409
+ t16 = () => setImporting(void 0);
12410
+ $[40] = t16;
12411
+ } else t16 = $[40];
12412
+ let t17;
12413
+ if ($[41] !== importing) {
12414
+ t17 = importing ?? { text: "" };
12415
+ $[41] = importing;
11516
12416
  $[42] = t17;
11517
12417
  } else t17 = $[42];
11518
12418
  let t18;
11519
12419
  if ($[43] === Symbol.for("react.memo_cache_sentinel")) {
11520
- t18 = () => setNaming(false);
12420
+ t18 = () => setImporting(void 0);
11521
12421
  $[43] = t18;
11522
12422
  } else t18 = $[43];
11523
12423
  let t19;
11524
- if ($[44] === Symbol.for("react.memo_cache_sentinel")) {
11525
- t19 = () => setNaming(false);
11526
- $[44] = t19;
11527
- } else t19 = $[44];
11528
- let t20;
11529
- if ($[45] !== trySave) {
11530
- t20 = /* @__PURE__ */ jsx(NameForm, {
11531
- onCancel: t19,
11532
- onSave: (named_1) => {
11533
- setNaming(false);
11534
- trySave(named_1);
11535
- }
11536
- });
11537
- $[45] = trySave;
11538
- $[46] = t20;
11539
- } else t20 = $[46];
11540
- let t21;
11541
- if ($[47] !== naming || $[48] !== t20) {
11542
- t21 = /* @__PURE__ */ jsx(Dialog, {
11543
- open: naming,
11544
- title: "Save Fit",
11545
- onClose: t18,
11546
- children: t20
11547
- });
11548
- $[47] = naming;
11549
- $[48] = t20;
11550
- $[49] = t21;
11551
- } else t21 = $[49];
11552
- const t22 = overwriting !== void 0;
11553
- let t23;
11554
- if ($[50] === Symbol.for("react.memo_cache_sentinel")) {
11555
- t23 = () => setOverwriting(void 0);
11556
- $[50] = t23;
11557
- } else t23 = $[50];
11558
- const t24 = overwriting?.name;
11559
- let t25;
11560
- if ($[51] !== t24) {
11561
- t25 = /* @__PURE__ */ jsxs("p", { children: [
11562
- "A fit named \"",
11563
- t24,
11564
- "\" is already saved for this hull. Overwrite it?"
11565
- ] });
11566
- $[51] = t24;
11567
- $[52] = t25;
11568
- } else t25 = $[52];
11569
- let t26;
11570
- if ($[53] === Symbol.for("react.memo_cache_sentinel")) {
11571
- t26 = /* @__PURE__ */ jsx("button", {
11572
- type: "button",
11573
- className: ItemBrowser_module_default.action,
11574
- onClick: () => setOverwriting(void 0),
11575
- children: "Cancel"
12424
+ if ($[44] !== t17) {
12425
+ t19 = /* @__PURE__ */ jsx(ImportForm, {
12426
+ draft: t17,
12427
+ onDone: t18
11576
12428
  });
11577
- $[53] = t26;
11578
- } else t26 = $[53];
11579
- let t27;
11580
- if ($[54] !== overwriting || $[55] !== saveNow) {
11581
- t27 = /* @__PURE__ */ jsxs("div", {
11582
- className: ItemBrowser_module_default.dialogButtons,
11583
- children: [t26, /* @__PURE__ */ jsx("button", {
11584
- type: "button",
11585
- className: ItemBrowser_module_default.action,
11586
- onClick: () => overwriting && saveNow(overwriting),
11587
- children: "Overwrite"
11588
- })]
11589
- });
11590
- $[54] = overwriting;
11591
- $[55] = saveNow;
11592
- $[56] = t27;
11593
- } else t27 = $[56];
11594
- let t28;
11595
- if ($[57] !== t25 || $[58] !== t27) {
11596
- t28 = /* @__PURE__ */ jsxs("div", {
11597
- className: ItemBrowser_module_default.confirm,
11598
- children: [t25, t27]
11599
- });
11600
- $[57] = t25;
11601
- $[58] = t27;
11602
- $[59] = t28;
11603
- } else t28 = $[59];
11604
- let t29;
11605
- if ($[60] !== t22 || $[61] !== t28) {
11606
- t29 = /* @__PURE__ */ jsx(Dialog, {
11607
- open: t22,
11608
- title: "Overwrite Fit?",
11609
- onClose: t23,
11610
- children: t28
11611
- });
11612
- $[60] = t22;
11613
- $[61] = t28;
11614
- $[62] = t29;
11615
- } else t29 = $[62];
11616
- const t30 = importing !== void 0;
11617
- let t31;
11618
- if ($[63] === Symbol.for("react.memo_cache_sentinel")) {
11619
- t31 = () => setImporting(void 0);
11620
- $[63] = t31;
11621
- } else t31 = $[63];
11622
- let t32;
11623
- if ($[64] !== importing) {
11624
- t32 = importing ?? { text: "" };
11625
- $[64] = importing;
11626
- $[65] = t32;
11627
- } else t32 = $[65];
11628
- let t33;
11629
- if ($[66] === Symbol.for("react.memo_cache_sentinel")) {
11630
- t33 = () => setImporting(void 0);
11631
- $[66] = t33;
11632
- } else t33 = $[66];
11633
- let t34;
11634
- if ($[67] !== t32) {
11635
- t34 = /* @__PURE__ */ jsx(ImportForm, {
11636
- draft: t32,
11637
- onDone: t33
11638
- });
11639
- $[67] = t32;
11640
- $[68] = t34;
11641
- } else t34 = $[68];
11642
- let t35;
11643
- if ($[69] !== t30 || $[70] !== t34) {
11644
- t35 = /* @__PURE__ */ jsx(Dialog, {
11645
- open: t30,
12429
+ $[44] = t17;
12430
+ $[45] = t19;
12431
+ } else t19 = $[45];
12432
+ let t20;
12433
+ if ($[46] !== t15 || $[47] !== t19) {
12434
+ t20 = /* @__PURE__ */ jsx(Dialog, {
12435
+ open: t15,
11646
12436
  title: "Import Fit",
11647
- onClose: t31,
11648
- children: t34
12437
+ onClose: t16,
12438
+ children: t19
11649
12439
  });
11650
- $[69] = t30;
11651
- $[70] = t34;
11652
- $[71] = t35;
11653
- } else t35 = $[71];
11654
- let t36;
11655
- if ($[72] !== copyDialog || $[73] !== t14 || $[74] !== t17 || $[75] !== t21 || $[76] !== t29 || $[77] !== t35 || $[78] !== t8) {
11656
- t36 = /* @__PURE__ */ jsxs("div", {
12440
+ $[46] = t15;
12441
+ $[47] = t19;
12442
+ $[48] = t20;
12443
+ } else t20 = $[48];
12444
+ let t21;
12445
+ if ($[49] !== copyDialog || $[50] !== saver.dialog || $[51] !== t11 || $[52] !== t14 || $[53] !== t20 || $[54] !== t5) {
12446
+ t21 = /* @__PURE__ */ jsxs("div", {
11657
12447
  className: ItemBrowser_module_default.actions,
11658
12448
  children: [
11659
- t8,
11660
- t9,
12449
+ t5,
12450
+ t6,
12451
+ t11,
11661
12452
  t14,
11662
- t17,
11663
- t21,
11664
- t29,
11665
- t35,
11666
- copyDialog
12453
+ t20,
12454
+ copyDialog,
12455
+ saver.dialog
11667
12456
  ]
11668
12457
  });
11669
- $[72] = copyDialog;
11670
- $[73] = t14;
11671
- $[74] = t17;
11672
- $[75] = t21;
11673
- $[76] = t29;
11674
- $[77] = t35;
11675
- $[78] = t8;
11676
- $[79] = t36;
11677
- } else t36 = $[79];
11678
- return t36;
12458
+ $[49] = copyDialog;
12459
+ $[50] = saver.dialog;
12460
+ $[51] = t11;
12461
+ $[52] = t14;
12462
+ $[53] = t20;
12463
+ $[54] = t5;
12464
+ $[55] = t21;
12465
+ } else t21 = $[55];
12466
+ return t21;
11679
12467
  }
11680
- function NameForm(t0) {
11681
- const $ = c(27);
11682
- const { onCancel, onSave } = t0;
11683
- const engine = useEngine();
11684
- const fit = useFit();
11685
- const id = useId();
11686
- let t1;
11687
- if ($[0] !== engine.sde || $[1] !== fit.ship.type_id) {
11688
- t1 = () => engine.sde.type(fit.ship.type_id)?.name ?? "";
11689
- $[0] = engine.sde;
11690
- $[1] = fit.ship.type_id;
11691
- $[2] = t1;
11692
- } else t1 = $[2];
11693
- const [name, setName] = useState(t1);
12468
+ function SaveSplit(t0) {
12469
+ const $ = c(53);
12470
+ const { saver: t1, savedTo, disabled, onSave } = t0;
12471
+ const { characters, target, pick, saving } = t1;
12472
+ const menu = useId();
12473
+ const { current, login } = useCharacters();
12474
+ const where = target?.name ?? "browser";
11694
12475
  let t2;
11695
- if ($[3] !== fit || $[4] !== name || $[5] !== onSave) {
11696
- t2 = (event) => {
11697
- event.preventDefault();
11698
- onSave({
11699
- ...fit,
11700
- name: name.trim()
11701
- });
11702
- };
11703
- $[3] = fit;
11704
- $[4] = name;
11705
- $[5] = onSave;
11706
- $[6] = t2;
11707
- } else t2 = $[6];
12476
+ if ($[0] !== menu) {
12477
+ t2 = () => document.getElementById(menu)?.hidePopover();
12478
+ $[0] = menu;
12479
+ $[1] = t2;
12480
+ } else t2 = $[1];
12481
+ const close = t2;
11708
12482
  let t3;
11709
- if ($[7] !== id) {
11710
- t3 = /* @__PURE__ */ jsx("label", {
11711
- htmlFor: id,
11712
- children: "Name this fit."
11713
- });
11714
- $[7] = id;
11715
- $[8] = t3;
11716
- } else t3 = $[8];
12483
+ if ($[2] !== close || $[3] !== pick) {
12484
+ t3 = (owner) => {
12485
+ pick(owner);
12486
+ close();
12487
+ };
12488
+ $[2] = close;
12489
+ $[3] = pick;
12490
+ $[4] = t3;
12491
+ } else t3 = $[4];
12492
+ const choose = t3;
11717
12493
  let t4;
11718
- if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
11719
- t4 = (event_1) => setName(event_1.target.value);
11720
- $[9] = t4;
11721
- } else t4 = $[9];
12494
+ if ($[5] !== close || $[6] !== login) {
12495
+ t4 = (canSave) => {
12496
+ close();
12497
+ login?.(canSave);
12498
+ };
12499
+ $[5] = close;
12500
+ $[6] = login;
12501
+ $[7] = t4;
12502
+ } else t4 = $[7];
12503
+ const logIn = t4;
11722
12504
  let t5;
11723
- if ($[10] !== id || $[11] !== name) {
11724
- t5 = /* @__PURE__ */ jsx("input", {
11725
- id,
11726
- value: name,
11727
- onFocus: _temp$5,
11728
- onChange: t4
11729
- });
11730
- $[10] = id;
11731
- $[11] = name;
12505
+ if ($[8] !== choose || $[9] !== current || $[10] !== logIn || $[11] !== target?.id) {
12506
+ t5 = (character) => {
12507
+ const writable = canSaveFits(character);
12508
+ return /* @__PURE__ */ jsxs("button", {
12509
+ type: "button",
12510
+ role: writable ? "menuitemradio" : "menuitem",
12511
+ "aria-checked": writable ? character.id === target?.id : void 0,
12512
+ "data-off": !writable || void 0,
12513
+ onClick: writable ? () => choose(character.id) : () => logIn(character.status !== "expired" || character.canWriteFits),
12514
+ children: [
12515
+ /* @__PURE__ */ jsx("span", {
12516
+ className: ItemBrowser_module_default.tick,
12517
+ children: character.id === target?.id && "✓"
12518
+ }),
12519
+ /* @__PURE__ */ jsx(Icon, { name: "fits-personal" }),
12520
+ /* @__PURE__ */ jsx("span", {
12521
+ className: ItemBrowser_module_default.saveName,
12522
+ children: character.name
12523
+ }),
12524
+ !writable && /* @__PURE__ */ jsx("span", {
12525
+ className: ItemBrowser_module_default.saveUpgrade,
12526
+ children: character.status === "expired" ? "Log in again" : "Allow saving"
12527
+ }),
12528
+ writable && String(character.id) === current && /* @__PURE__ */ jsx("span", {
12529
+ className: ItemBrowser_module_default.saveNote,
12530
+ children: "flying now"
12531
+ })
12532
+ ]
12533
+ }, character.id);
12534
+ };
12535
+ $[8] = choose;
12536
+ $[9] = current;
12537
+ $[10] = logIn;
12538
+ $[11] = target?.id;
11732
12539
  $[12] = t5;
11733
12540
  } else t5 = $[12];
11734
- let t6;
11735
- if ($[13] !== onCancel) {
11736
- t6 = /* @__PURE__ */ jsx("button", {
12541
+ const row = t5;
12542
+ const t6 = saving || void 0;
12543
+ const t7 = target === void 0 ? "fits-browser" : "fits-personal";
12544
+ let t8;
12545
+ if ($[13] !== t7) {
12546
+ t8 = /* @__PURE__ */ jsx(Icon, { name: t7 });
12547
+ $[13] = t7;
12548
+ $[14] = t8;
12549
+ } else t8 = $[14];
12550
+ const t9 = savedTo === void 0 ? `Save to ${where}` : `Saved to ${savedTo} ✓`;
12551
+ let t10;
12552
+ if ($[15] !== t9) {
12553
+ t10 = /* @__PURE__ */ jsx("span", {
12554
+ className: ItemBrowser_module_default.saveName,
12555
+ children: t9
12556
+ });
12557
+ $[15] = t9;
12558
+ $[16] = t10;
12559
+ } else t10 = $[16];
12560
+ let t11;
12561
+ if ($[17] !== disabled || $[18] !== onSave || $[19] !== t10 || $[20] !== t6 || $[21] !== t8) {
12562
+ t11 = /* @__PURE__ */ jsxs("button", {
11737
12563
  type: "button",
11738
- className: ItemBrowser_module_default.action,
11739
- onClick: onCancel,
11740
- children: "Cancel"
12564
+ className: `${ItemBrowser_module_default.action} ${ItemBrowser_module_default.saveMain}`,
12565
+ disabled,
12566
+ "aria-disabled": t6,
12567
+ onClick: onSave,
12568
+ children: [t8, t10]
12569
+ });
12570
+ $[17] = disabled;
12571
+ $[18] = onSave;
12572
+ $[19] = t10;
12573
+ $[20] = t6;
12574
+ $[21] = t8;
12575
+ $[22] = t11;
12576
+ } else t11 = $[22];
12577
+ let t12;
12578
+ if ($[23] !== menu) {
12579
+ t12 = /* @__PURE__ */ jsx("button", {
12580
+ type: "button",
12581
+ className: `${ItemBrowser_module_default.action} ${ItemBrowser_module_default.saveArrow}`,
12582
+ "aria-label": "Where to save",
12583
+ popoverTarget: menu
11741
12584
  });
11742
- $[13] = onCancel;
11743
- $[14] = t6;
11744
- } else t6 = $[14];
11745
- let t7;
11746
- if ($[15] !== name) {
11747
- t7 = name.trim();
11748
- $[15] = name;
11749
- $[16] = t7;
11750
- } else t7 = $[16];
11751
- const t8 = t7 === "";
11752
- let t9;
11753
- if ($[17] !== t8) {
11754
- t9 = /* @__PURE__ */ jsx("button", {
11755
- type: "submit",
11756
- className: ItemBrowser_module_default.action,
11757
- disabled: t8,
11758
- children: "Save"
12585
+ $[23] = menu;
12586
+ $[24] = t12;
12587
+ } else t12 = $[24];
12588
+ let t13;
12589
+ if ($[25] !== t11 || $[26] !== t12) {
12590
+ t13 = /* @__PURE__ */ jsxs("span", {
12591
+ className: ItemBrowser_module_default.saveAnchor,
12592
+ children: [t11, t12]
11759
12593
  });
11760
- $[17] = t8;
11761
- $[18] = t9;
11762
- } else t9 = $[18];
11763
- let t10;
11764
- if ($[19] !== t6 || $[20] !== t9) {
11765
- t10 = /* @__PURE__ */ jsxs("div", {
11766
- className: ItemBrowser_module_default.dialogButtons,
11767
- children: [t6, t9]
12594
+ $[25] = t11;
12595
+ $[26] = t12;
12596
+ $[27] = t13;
12597
+ } else t13 = $[27];
12598
+ const t14 = target === void 0;
12599
+ let t15;
12600
+ if ($[28] !== choose) {
12601
+ t15 = () => choose("browser");
12602
+ $[28] = choose;
12603
+ $[29] = t15;
12604
+ } else t15 = $[29];
12605
+ const t16 = target === void 0 && "✓";
12606
+ let t17;
12607
+ if ($[30] !== t16) {
12608
+ t17 = /* @__PURE__ */ jsx("span", {
12609
+ className: ItemBrowser_module_default.tick,
12610
+ children: t16
11768
12611
  });
11769
- $[19] = t6;
11770
- $[20] = t9;
11771
- $[21] = t10;
11772
- } else t10 = $[21];
11773
- let t11;
11774
- if ($[22] !== t10 || $[23] !== t2 || $[24] !== t3 || $[25] !== t5) {
11775
- t11 = /* @__PURE__ */ jsxs("form", {
11776
- className: ItemBrowser_module_default.form,
11777
- onSubmit: t2,
12612
+ $[30] = t16;
12613
+ $[31] = t17;
12614
+ } else t17 = $[31];
12615
+ let t18;
12616
+ if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
12617
+ t18 = /* @__PURE__ */ jsx(Icon, { name: "fits-browser" });
12618
+ $[32] = t18;
12619
+ } else t18 = $[32];
12620
+ let t19;
12621
+ if ($[33] !== t14 || $[34] !== t15 || $[35] !== t17) {
12622
+ t19 = /* @__PURE__ */ jsxs("button", {
12623
+ type: "button",
12624
+ role: "menuitemradio",
12625
+ "aria-checked": t14,
12626
+ onClick: t15,
11778
12627
  children: [
11779
- t3,
11780
- t5,
11781
- t10
12628
+ t17,
12629
+ t18,
12630
+ "This browser"
11782
12631
  ]
11783
12632
  });
11784
- $[22] = t10;
11785
- $[23] = t2;
11786
- $[24] = t3;
11787
- $[25] = t5;
11788
- $[26] = t11;
11789
- } else t11 = $[26];
11790
- return t11;
11791
- }
11792
- function _temp$5(event_0) {
11793
- return event_0.currentTarget.select();
12633
+ $[33] = t14;
12634
+ $[34] = t15;
12635
+ $[35] = t17;
12636
+ $[36] = t19;
12637
+ } else t19 = $[36];
12638
+ let t20;
12639
+ if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
12640
+ t20 = /* @__PURE__ */ jsx("hr", { className: ItemBrowser_module_default.menuRule });
12641
+ $[37] = t20;
12642
+ } else t20 = $[37];
12643
+ let t21;
12644
+ if ($[38] !== characters || $[39] !== row) {
12645
+ t21 = characters?.map(row);
12646
+ $[38] = characters;
12647
+ $[39] = row;
12648
+ $[40] = t21;
12649
+ } else t21 = $[40];
12650
+ let t22;
12651
+ if ($[41] !== characters?.length || $[42] !== logIn || $[43] !== login) {
12652
+ t22 = characters?.length === 0 && login && /* @__PURE__ */ jsxs("button", {
12653
+ type: "button",
12654
+ role: "menuitem",
12655
+ onClick: () => logIn(true),
12656
+ children: [/* @__PURE__ */ jsx("span", { className: ItemBrowser_module_default.tick }), /* @__PURE__ */ jsx("span", {
12657
+ className: ItemBrowser_module_default.saveUpgrade,
12658
+ children: "Log in and allow saving"
12659
+ })]
12660
+ });
12661
+ $[41] = characters?.length;
12662
+ $[42] = logIn;
12663
+ $[43] = login;
12664
+ $[44] = t22;
12665
+ } else t22 = $[44];
12666
+ let t23;
12667
+ if ($[45] !== menu || $[46] !== t19 || $[47] !== t21 || $[48] !== t22) {
12668
+ t23 = /* @__PURE__ */ jsxs("div", {
12669
+ id: menu,
12670
+ className: `${ItemBrowser_module_default.menu} ${ItemBrowser_module_default.saveMenu}`,
12671
+ popover: "auto",
12672
+ role: "menu",
12673
+ children: [
12674
+ t19,
12675
+ t20,
12676
+ t21,
12677
+ t22
12678
+ ]
12679
+ });
12680
+ $[45] = menu;
12681
+ $[46] = t19;
12682
+ $[47] = t21;
12683
+ $[48] = t22;
12684
+ $[49] = t23;
12685
+ } else t23 = $[49];
12686
+ let t24;
12687
+ if ($[50] !== t13 || $[51] !== t23) {
12688
+ t24 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t13, t23] });
12689
+ $[50] = t13;
12690
+ $[51] = t23;
12691
+ $[52] = t24;
12692
+ } else t24 = $[52];
12693
+ return t24;
11794
12694
  }
11795
12695
  function ImportForm(t0) {
11796
12696
  const $ = c(33);
@@ -11805,7 +12705,7 @@ function ImportForm(t0) {
11805
12705
  if ($[0] !== draft.text) {
11806
12706
  t1 = () => {
11807
12707
  if (draft.text !== "") return;
11808
- Promise.resolve().then(_temp2$3).then((clipboard) => setText((typed) => typed || clipboard), _temp3$1);
12708
+ Promise.resolve().then(_temp$5).then((clipboard) => setText((typed) => typed || clipboard), _temp2$3);
11809
12709
  };
11810
12710
  t2 = [draft.text];
11811
12711
  $[0] = draft.text;
@@ -11943,45 +12843,11 @@ function ImportForm(t0) {
11943
12843
  } else t14 = $[32];
11944
12844
  return t14;
11945
12845
  }
11946
- function _temp3$1() {}
11947
- function _temp2$3() {
12846
+ /** Fits a mutated item from the game in the first free slot of its rack, rolled as it is. */
12847
+ function _temp2$3() {}
12848
+ function _temp$5() {
11948
12849
  return navigator.clipboard.readText();
11949
12850
  }
11950
- function useFlash() {
11951
- const $ = c(6);
11952
- const [shown, setShown] = useState(0);
11953
- let t0;
11954
- let t1;
11955
- if ($[0] !== shown) {
11956
- t0 = () => {
11957
- if (shown === 0) return;
11958
- const timer = setTimeout(() => setShown(0), FLASH_MS);
11959
- return () => clearTimeout(timer);
11960
- };
11961
- t1 = [shown];
11962
- $[0] = shown;
11963
- $[1] = t0;
11964
- $[2] = t1;
11965
- } else {
11966
- t0 = $[1];
11967
- t1 = $[2];
11968
- }
11969
- useEffect(t0, t1);
11970
- const t2 = shown > 0;
11971
- let t3;
11972
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
11973
- t3 = () => setShown(Date.now());
11974
- $[3] = t3;
11975
- } else t3 = $[3];
11976
- let t4;
11977
- if ($[4] !== t2) {
11978
- t4 = [t2, t3];
11979
- $[4] = t2;
11980
- $[5] = t4;
11981
- } else t4 = $[5];
11982
- return t4;
11983
- }
11984
- /** Fits a mutated item from the game in the first free slot of its rack, rolled as it is. */
11985
12851
  async function fitMutated(engine, store, typeId, itemId) {
11986
12852
  const roll = await engine.loadMutation(typeId, itemId);
11987
12853
  if (store.fitMutated(roll) === void 0) throw new Error("This item does not fit on the ship");
@@ -11991,7 +12857,7 @@ const noFits = [];
11991
12857
  const SHIPS_MARKET_GROUP_ID = 4;
11992
12858
  /** The Hulls & Fits tab of the `ItemBrowser`: EVE's hulls by group and race, with the fits saved for each. */
11993
12859
  function HullsAndFits(t0) {
11994
- const $ = c(103);
12860
+ const $ = c(115);
11995
12861
  const { noHullSelected } = t0;
11996
12862
  const fitShipId = useFit().ship.type_id;
11997
12863
  const images = useImages();
@@ -12001,7 +12867,9 @@ function HullsAndFits(t0) {
12001
12867
  const { show: showInfo } = useShowInfo();
12002
12868
  const { open, menu } = useContextMenu();
12003
12869
  const { copy, dialog: copyDialog } = useCopyFit();
12870
+ const { target: saveTarget, save: saveFit, dialog: saveDialog } = useSaveFit();
12004
12871
  const [deleting, setDeleting] = useState();
12872
+ const [deleteFailed, setDeleteFailed] = useState(false);
12005
12873
  const personal = usePersonalFits();
12006
12874
  const { start, end } = useDrag();
12007
12875
  const [search, setSearch] = useState("");
@@ -12146,7 +13014,7 @@ function HullsAndFits(t0) {
12146
13014
  } else t10 = $[36];
12147
13015
  const hullMenu = t10;
12148
13016
  let t11;
12149
- if ($[37] !== copy || $[38] !== open || $[39] !== store) {
13017
+ if ($[37] !== copy || $[38] !== open || $[39] !== personal.remove || $[40] !== saveFit || $[41] !== saveTarget || $[42] !== store) {
12150
13018
  t11 = (event_0, t12) => {
12151
13019
  const { fit: fit_6, kind } = t12;
12152
13020
  open(event_0, [
@@ -12155,6 +13023,10 @@ function HullsAndFits(t0) {
12155
13023
  onSelect: () => store.replace(fit_6)
12156
13024
  },
12157
13025
  "separator",
13026
+ kind === "fits-browser" && saveTarget !== void 0 && {
13027
+ label: `Save to ${saveTarget.name}`,
13028
+ onSelect: () => saveFit(fit_6)
13029
+ },
12158
13030
  {
12159
13031
  label: "Copy as EFT",
12160
13032
  onSelect: () => copy(fit_6, "eft")
@@ -12164,61 +13036,67 @@ function HullsAndFits(t0) {
12164
13036
  onSelect: () => copy(fit_6, "esf")
12165
13037
  },
12166
13038
  "separator",
12167
- kind === "fits-browser" && {
13039
+ (kind === "fits-browser" || personal.remove !== void 0) && {
12168
13040
  label: "Delete Fitting",
12169
- onSelect: () => setDeleting(fit_6)
13041
+ onSelect: () => setDeleting({
13042
+ fit: fit_6,
13043
+ kind
13044
+ })
12170
13045
  }
12171
13046
  ]);
12172
13047
  };
12173
13048
  $[37] = copy;
12174
13049
  $[38] = open;
12175
- $[39] = store;
12176
- $[40] = t11;
12177
- } else t11 = $[40];
13050
+ $[39] = personal.remove;
13051
+ $[40] = saveFit;
13052
+ $[41] = saveTarget;
13053
+ $[42] = store;
13054
+ $[43] = t11;
13055
+ } else t11 = $[43];
12178
13056
  const fitMenu = t11;
12179
13057
  let t12;
12180
- if ($[41] !== collapses) {
13058
+ if ($[44] !== collapses) {
12181
13059
  t12 = () => setCollapses(collapses + 1);
12182
- $[41] = collapses;
12183
- $[42] = t12;
12184
- } else t12 = $[42];
13060
+ $[44] = collapses;
13061
+ $[45] = t12;
13062
+ } else t12 = $[45];
12185
13063
  let t13;
12186
- if ($[43] !== search || $[44] !== t12) {
13064
+ if ($[46] !== search || $[47] !== t12) {
12187
13065
  t13 = /* @__PURE__ */ jsx(Search, {
12188
13066
  value: search,
12189
13067
  onChange: setSearch,
12190
13068
  onCollapse: t12
12191
13069
  });
12192
- $[43] = search;
12193
- $[44] = t12;
12194
- $[45] = t13;
12195
- } else t13 = $[45];
13070
+ $[46] = search;
13071
+ $[47] = t12;
13072
+ $[48] = t13;
13073
+ } else t13 = $[48];
12196
13074
  let t14;
12197
- if ($[46] !== browserFits) {
13075
+ if ($[49] !== browserFits) {
12198
13076
  t14 = /* @__PURE__ */ jsx(FilterToggle, {
12199
13077
  icon: "fits-browser",
12200
13078
  label: "Browser Fittings",
12201
13079
  pressed: browserFits,
12202
13080
  onPressedChange: setBrowserFits
12203
13081
  });
12204
- $[46] = browserFits;
12205
- $[47] = t14;
12206
- } else t14 = $[47];
13082
+ $[49] = browserFits;
13083
+ $[50] = t14;
13084
+ } else t14 = $[50];
12207
13085
  let t15;
12208
- if ($[48] !== personalFits) {
13086
+ if ($[51] !== personalFits) {
12209
13087
  t15 = /* @__PURE__ */ jsx(FilterToggle, {
12210
13088
  icon: "fits-personal",
12211
13089
  label: "Personal Fittings",
12212
13090
  pressed: personalFits,
12213
13091
  onPressedChange: setPersonalFits
12214
13092
  });
12215
- $[48] = personalFits;
12216
- $[49] = t15;
12217
- } else t15 = $[49];
13093
+ $[51] = personalFits;
13094
+ $[52] = t15;
13095
+ } else t15 = $[52];
12218
13096
  let t16;
12219
13097
  let t17;
12220
13098
  let t18;
12221
- if ($[50] === Symbol.for("react.memo_cache_sentinel")) {
13099
+ if ($[53] === Symbol.for("react.memo_cache_sentinel")) {
12222
13100
  t16 = /* @__PURE__ */ jsx(FilterToggle, {
12223
13101
  icon: "fits-corporation",
12224
13102
  label: "Corporation Fittings"
@@ -12231,16 +13109,16 @@ function HullsAndFits(t0) {
12231
13109
  icon: "fits-community",
12232
13110
  label: "Community Fittings"
12233
13111
  });
12234
- $[50] = t16;
12235
- $[51] = t17;
12236
- $[52] = t18;
13112
+ $[53] = t16;
13113
+ $[54] = t17;
13114
+ $[55] = t18;
12237
13115
  } else {
12238
- t16 = $[50];
12239
- t17 = $[51];
12240
- t18 = $[52];
13116
+ t16 = $[53];
13117
+ t17 = $[54];
13118
+ t18 = $[55];
12241
13119
  }
12242
13120
  let t19;
12243
- if ($[53] !== currentHull || $[54] !== noHullSelected) {
13121
+ if ($[56] !== currentHull || $[57] !== noHullSelected) {
12244
13122
  t19 = /* @__PURE__ */ jsx(FilterToggle, {
12245
13123
  icon: "current-hull",
12246
13124
  label: "Current Hull",
@@ -12248,23 +13126,23 @@ function HullsAndFits(t0) {
12248
13126
  disabled: noHullSelected,
12249
13127
  onPressedChange: setCurrentHull
12250
13128
  });
12251
- $[53] = currentHull;
12252
- $[54] = noHullSelected;
12253
- $[55] = t19;
12254
- } else t19 = $[55];
13129
+ $[56] = currentHull;
13130
+ $[57] = noHullSelected;
13131
+ $[58] = t19;
13132
+ } else t19 = $[58];
12255
13133
  let t20;
12256
- if ($[56] !== flyable) {
13134
+ if ($[59] !== flyable) {
12257
13135
  t20 = /* @__PURE__ */ jsx(FilterToggle, {
12258
13136
  icon: "skills",
12259
13137
  label: "Skills",
12260
13138
  pressed: flyable,
12261
13139
  onPressedChange: setFlyable
12262
13140
  });
12263
- $[56] = flyable;
12264
- $[57] = t20;
12265
- } else t20 = $[57];
13141
+ $[59] = flyable;
13142
+ $[60] = t20;
13143
+ } else t20 = $[60];
12266
13144
  let t21;
12267
- if ($[58] !== t14 || $[59] !== t15 || $[60] !== t19 || $[61] !== t20) {
13145
+ if ($[61] !== t14 || $[62] !== t15 || $[63] !== t19 || $[64] !== t20) {
12268
13146
  t21 = /* @__PURE__ */ jsxs("fieldset", {
12269
13147
  className: ItemBrowser_module_default.filters,
12270
13148
  "aria-label": "Filters",
@@ -12278,14 +13156,14 @@ function HullsAndFits(t0) {
12278
13156
  t20
12279
13157
  ]
12280
13158
  });
12281
- $[58] = t14;
12282
- $[59] = t15;
12283
- $[60] = t19;
12284
- $[61] = t20;
12285
- $[62] = t21;
12286
- } else t21 = $[62];
13159
+ $[61] = t14;
13160
+ $[62] = t15;
13161
+ $[63] = t19;
13162
+ $[64] = t20;
13163
+ $[65] = t21;
13164
+ } else t21 = $[65];
12287
13165
  let t22;
12288
- if ($[63] !== groups.length || $[64] !== personal.character || $[65] !== personalFits) {
13166
+ if ($[66] !== groups.length || $[67] !== personal.character || $[68] !== personalFits) {
12289
13167
  t22 = personalFits && personal.character?.canReadFits !== true ? /* @__PURE__ */ jsx("p", {
12290
13168
  className: ItemBrowser_module_default.empty,
12291
13169
  children: personal.character === void 0 ? "Log in or pick a character with the Character button" : "Log in again with the Character button to see fittings"
@@ -12293,13 +13171,13 @@ function HullsAndFits(t0) {
12293
13171
  className: ItemBrowser_module_default.empty,
12294
13172
  children: "No hulls found"
12295
13173
  }) : null;
12296
- $[63] = groups.length;
12297
- $[64] = personal.character;
12298
- $[65] = personalFits;
12299
- $[66] = t22;
12300
- } else t22 = $[66];
13174
+ $[66] = groups.length;
13175
+ $[67] = personal.character;
13176
+ $[68] = personalFits;
13177
+ $[69] = t22;
13178
+ } else t22 = $[69];
12301
13179
  let t23;
12302
- if ($[67] !== browserByHull || $[68] !== collapses || $[69] !== end || $[70] !== fitMenu || $[71] !== groups || $[72] !== hullMenu || $[73] !== images || $[74] !== personalByHull || $[75] !== shownFits || $[76] !== simulate || $[77] !== start || $[78] !== store) {
13180
+ if ($[70] !== browserByHull || $[71] !== collapses || $[72] !== end || $[73] !== fitMenu || $[74] !== groups || $[75] !== hullMenu || $[76] !== images || $[77] !== personalByHull || $[78] !== shownFits || $[79] !== simulate || $[80] !== start || $[81] !== store) {
12303
13181
  t23 = groups.length > 0 && /* @__PURE__ */ jsx(TreeList, {
12304
13182
  label: "Hulls",
12305
13183
  children: groups.map((t24) => {
@@ -12365,116 +13243,167 @@ function HullsAndFits(t0) {
12365
13243
  }, group.id);
12366
13244
  })
12367
13245
  }, collapses);
12368
- $[67] = browserByHull;
12369
- $[68] = collapses;
12370
- $[69] = end;
12371
- $[70] = fitMenu;
12372
- $[71] = groups;
12373
- $[72] = hullMenu;
12374
- $[73] = images;
12375
- $[74] = personalByHull;
12376
- $[75] = shownFits;
12377
- $[76] = simulate;
12378
- $[77] = start;
12379
- $[78] = store;
12380
- $[79] = t23;
12381
- } else t23 = $[79];
13246
+ $[70] = browserByHull;
13247
+ $[71] = collapses;
13248
+ $[72] = end;
13249
+ $[73] = fitMenu;
13250
+ $[74] = groups;
13251
+ $[75] = hullMenu;
13252
+ $[76] = images;
13253
+ $[77] = personalByHull;
13254
+ $[78] = shownFits;
13255
+ $[79] = simulate;
13256
+ $[80] = start;
13257
+ $[81] = store;
13258
+ $[82] = t23;
13259
+ } else t23 = $[82];
12382
13260
  let t24;
12383
- if ($[80] !== t22 || $[81] !== t23) {
13261
+ if ($[83] !== t22 || $[84] !== t23) {
12384
13262
  t24 = /* @__PURE__ */ jsxs("div", {
12385
13263
  className: ItemBrowser_module_default.tree,
12386
13264
  children: [t22, t23]
12387
13265
  });
12388
- $[80] = t22;
12389
- $[81] = t23;
12390
- $[82] = t24;
12391
- } else t24 = $[82];
13266
+ $[83] = t22;
13267
+ $[84] = t23;
13268
+ $[85] = t24;
13269
+ } else t24 = $[85];
12392
13270
  const t25 = deleting !== void 0;
12393
13271
  let t26;
12394
- if ($[83] === Symbol.for("react.memo_cache_sentinel")) {
13272
+ if ($[86] === Symbol.for("react.memo_cache_sentinel")) {
12395
13273
  t26 = () => setDeleting(void 0);
12396
- $[83] = t26;
12397
- } else t26 = $[83];
12398
- const t27 = deleting?.name || "Unnamed";
12399
- let t28;
12400
- if ($[84] !== t27) {
12401
- t28 = /* @__PURE__ */ jsxs("p", { children: [
13274
+ $[86] = t26;
13275
+ } else t26 = $[86];
13276
+ const t27 = deleting?.fit.name || "Unnamed";
13277
+ const t28 = deleting?.kind === "fits-personal" ? `${personal.character?.name} in EVE` : "this browser";
13278
+ let t29;
13279
+ if ($[87] !== t27 || $[88] !== t28) {
13280
+ t29 = /* @__PURE__ */ jsxs("p", { children: [
12402
13281
  "Delete the fit \"",
12403
13282
  t27,
12404
- "\" from this browser?"
13283
+ "\" from",
13284
+ " ",
13285
+ t28,
13286
+ "?"
12405
13287
  ] });
12406
- $[84] = t27;
12407
- $[85] = t28;
12408
- } else t28 = $[85];
12409
- let t29;
12410
- if ($[86] === Symbol.for("react.memo_cache_sentinel")) {
12411
- t29 = /* @__PURE__ */ jsx("button", {
13288
+ $[87] = t27;
13289
+ $[88] = t28;
13290
+ $[89] = t29;
13291
+ } else t29 = $[89];
13292
+ let t30;
13293
+ if ($[90] === Symbol.for("react.memo_cache_sentinel")) {
13294
+ t30 = /* @__PURE__ */ jsx("button", {
12412
13295
  type: "button",
12413
13296
  className: ItemBrowser_module_default.action,
12414
13297
  onClick: () => setDeleting(void 0),
12415
13298
  children: "Cancel"
12416
13299
  });
12417
- $[86] = t29;
12418
- } else t29 = $[86];
12419
- let t30;
12420
- if ($[87] !== deleting || $[88] !== remove) {
12421
- t30 = /* @__PURE__ */ jsxs("div", {
13300
+ $[90] = t30;
13301
+ } else t30 = $[90];
13302
+ let t31;
13303
+ if ($[91] !== deleting || $[92] !== personal || $[93] !== remove) {
13304
+ t31 = /* @__PURE__ */ jsxs("div", {
12422
13305
  className: ItemBrowser_module_default.dialogButtons,
12423
- children: [t29, /* @__PURE__ */ jsx("button", {
13306
+ children: [t30, /* @__PURE__ */ jsx("button", {
12424
13307
  type: "button",
12425
13308
  className: ItemBrowser_module_default.action,
12426
13309
  onClick: () => {
12427
- if (deleting) remove(deleting);
13310
+ if (deleting?.kind === "fits-browser") remove(deleting.fit);
13311
+ else if (deleting) personal.remove?.(deleting.fit).catch((error) => {
13312
+ console.error(error);
13313
+ setDeleteFailed(true);
13314
+ });
12428
13315
  setDeleting(void 0);
12429
13316
  },
12430
13317
  children: "Delete"
12431
13318
  })]
12432
13319
  });
12433
- $[87] = deleting;
12434
- $[88] = remove;
12435
- $[89] = t30;
12436
- } else t30 = $[89];
12437
- let t31;
12438
- if ($[90] !== t28 || $[91] !== t30) {
12439
- t31 = /* @__PURE__ */ jsxs("div", {
13320
+ $[91] = deleting;
13321
+ $[92] = personal;
13322
+ $[93] = remove;
13323
+ $[94] = t31;
13324
+ } else t31 = $[94];
13325
+ let t32;
13326
+ if ($[95] !== t29 || $[96] !== t31) {
13327
+ t32 = /* @__PURE__ */ jsxs("div", {
12440
13328
  className: ItemBrowser_module_default.confirm,
12441
- children: [t28, t30]
13329
+ children: [t29, t31]
12442
13330
  });
12443
- $[90] = t28;
12444
- $[91] = t30;
12445
- $[92] = t31;
12446
- } else t31 = $[92];
12447
- let t32;
12448
- if ($[93] !== t25 || $[94] !== t31) {
12449
- t32 = /* @__PURE__ */ jsx(Dialog, {
13331
+ $[95] = t29;
13332
+ $[96] = t31;
13333
+ $[97] = t32;
13334
+ } else t32 = $[97];
13335
+ let t33;
13336
+ if ($[98] !== t25 || $[99] !== t32) {
13337
+ t33 = /* @__PURE__ */ jsx(Dialog, {
12450
13338
  open: t25,
12451
13339
  title: "Delete Fitting?",
12452
13340
  onClose: t26,
12453
- children: t31
13341
+ children: t32
12454
13342
  });
12455
- $[93] = t25;
12456
- $[94] = t31;
12457
- $[95] = t32;
12458
- } else t32 = $[95];
12459
- let t33;
12460
- if ($[96] !== copyDialog || $[97] !== menu || $[98] !== t13 || $[99] !== t21 || $[100] !== t24 || $[101] !== t32) {
12461
- t33 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
13343
+ $[98] = t25;
13344
+ $[99] = t32;
13345
+ $[100] = t33;
13346
+ } else t33 = $[100];
13347
+ let t34;
13348
+ if ($[101] === Symbol.for("react.memo_cache_sentinel")) {
13349
+ t34 = () => setDeleteFailed(false);
13350
+ $[101] = t34;
13351
+ } else t34 = $[101];
13352
+ let t35;
13353
+ if ($[102] === Symbol.for("react.memo_cache_sentinel")) {
13354
+ t35 = /* @__PURE__ */ jsx("p", { children: "EVE did not delete this fit. Please try again." });
13355
+ $[102] = t35;
13356
+ } else t35 = $[102];
13357
+ let t36;
13358
+ if ($[103] === Symbol.for("react.memo_cache_sentinel")) {
13359
+ t36 = /* @__PURE__ */ jsxs("div", {
13360
+ className: ItemBrowser_module_default.confirm,
13361
+ children: [t35, /* @__PURE__ */ jsx("div", {
13362
+ className: ItemBrowser_module_default.dialogButtons,
13363
+ children: /* @__PURE__ */ jsx("button", {
13364
+ type: "button",
13365
+ className: ItemBrowser_module_default.action,
13366
+ onClick: () => setDeleteFailed(false),
13367
+ children: "Close"
13368
+ })
13369
+ })]
13370
+ });
13371
+ $[103] = t36;
13372
+ } else t36 = $[103];
13373
+ let t37;
13374
+ if ($[104] !== deleteFailed) {
13375
+ t37 = /* @__PURE__ */ jsx(Dialog, {
13376
+ open: deleteFailed,
13377
+ title: "Delete Fitting",
13378
+ onClose: t34,
13379
+ children: t36
13380
+ });
13381
+ $[104] = deleteFailed;
13382
+ $[105] = t37;
13383
+ } else t37 = $[105];
13384
+ let t38;
13385
+ if ($[106] !== copyDialog || $[107] !== menu || $[108] !== saveDialog || $[109] !== t13 || $[110] !== t21 || $[111] !== t24 || $[112] !== t33 || $[113] !== t37) {
13386
+ t38 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
12462
13387
  t13,
12463
13388
  t21,
12464
13389
  t24,
12465
13390
  menu,
12466
13391
  copyDialog,
12467
- t32
13392
+ saveDialog,
13393
+ t33,
13394
+ t37
12468
13395
  ] });
12469
- $[96] = copyDialog;
12470
- $[97] = menu;
12471
- $[98] = t13;
12472
- $[99] = t21;
12473
- $[100] = t24;
12474
- $[101] = t32;
12475
- $[102] = t33;
12476
- } else t33 = $[102];
12477
- return t33;
13396
+ $[106] = copyDialog;
13397
+ $[107] = menu;
13398
+ $[108] = saveDialog;
13399
+ $[109] = t13;
13400
+ $[110] = t21;
13401
+ $[111] = t24;
13402
+ $[112] = t33;
13403
+ $[113] = t37;
13404
+ $[114] = t38;
13405
+ } else t38 = $[114];
13406
+ return t38;
12478
13407
  }
12479
13408
  function _temp6(fit_3) {
12480
13409
  return fit_3.ship.type_id;