@ethersphere/bee-dashboard 0.34.0 → 0.35.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 (37) hide show
  1. package/build/assets/__vite-browser-external-GBBpQyY6.js +2 -0
  2. package/build/assets/{download.browser-C9Uz7OzH.js → download.browser-BISIRUf5.js} +1 -1
  3. package/build/assets/{download.node-tVxxcrzZ.js → download.node-Cu2agz7Z.js} +1 -1
  4. package/build/assets/fs.node-C4JkI_R4.js +2 -0
  5. package/build/assets/index-DMp5phAM.css +1 -0
  6. package/build/assets/index-wYIvDrId.js +116 -0
  7. package/build/assets/vendor-ethers-BjcsqZe1.js +25 -0
  8. package/build/assets/{vendor-react-mui-CMfvLA_U.js → vendor-react-mui-Dv6xxk4a.js} +1 -1
  9. package/build/index.html +4 -4
  10. package/lib/{App-CyZvPEkk.mjs → App-D-bZmnQu.mjs} +633 -447
  11. package/lib/{App-DJxgFkgf.js → App-DREUIlty.js} +633 -447
  12. package/lib/App.cjs.js +1 -1
  13. package/lib/App.css +51 -51
  14. package/lib/App.js +1 -1
  15. package/lib/components/StampExtensionModal.d.ts +10 -4
  16. package/lib/constants.d.ts +2 -0
  17. package/lib/{download.browser-Bp7NWws0.js → download.browser-Dusbw9zM.js} +1 -1
  18. package/lib/{download.browser-Cta85Yx2.mjs → download.browser-KkaXyYZj.mjs} +1 -1
  19. package/lib/{download.node-C_IiKmHA.js → download.node-CGjezvzr.js} +1 -1
  20. package/lib/{download.node-B-ryR03L.mjs → download.node-ORcJCpF4.mjs} +1 -1
  21. package/lib/{fs.node-DOrfMQwF.js → fs.node-CtpSvQZh.js} +1 -1
  22. package/lib/{fs.node-l47yAJ14.mjs → fs.node-MZdoW1KI.mjs} +1 -1
  23. package/lib/modules/filemanager/components/ConfirmModal/ConfirmModal.d.ts +1 -1
  24. package/lib/pages/files/AssetPreview.d.ts +1 -0
  25. package/lib/{upload.node-DUSvlJwc.js → upload.node-6Fo1eWIJ.js} +3 -3
  26. package/lib/{upload.node-D_XLym_5.mjs → upload.node-vs2hmNcN.mjs} +3 -3
  27. package/lib/utils/chain.d.ts +6 -0
  28. package/lib/utils/file.d.ts +11 -0
  29. package/lib/utils/index.d.ts +0 -7
  30. package/lib/utils/stamp.d.ts +8 -0
  31. package/package.json +1 -1
  32. package/build/assets/fs.node-B2ZMKqzu.js +0 -2
  33. package/build/assets/index-BTuZ_M-A.js +0 -116
  34. package/build/assets/index-CPiKID9h.css +0 -1
  35. package/build/assets/upload.node-W5QYw_5j.js +0 -2
  36. package/build/assets/vendor-ethers-DTkFbbYN.js +0 -16
  37. package/lib/modules/filemanager/utils/view.d.ts +0 -11
@@ -48875,6 +48875,8 @@ const BEE_DESKTOP_LATEST_RELEASE_PAGE = "https://github.com/ethersphere/bee-desk
48875
48875
  const BEE_DESKTOP_LATEST_RELEASE_PAGE_API = "https://api.github.com/repos/ethersphere/bee-desktop/releases/latest";
48876
48876
  const DEFAULT_BEE_API_HOST = "http://localhost:1633";
48877
48877
  const DEFAULT_RPC_URL = "https://xdai.fairdatasociety.org";
48878
+ const MIN_STAMP_DEPTH = 17;
48879
+ const MAX_STAMP_DEPTH = 255;
48878
48880
  class AuthError extends Error {
48879
48881
  constructor() {
48880
48882
  super("Bad API key");
@@ -68469,8 +68471,18 @@ function chainIdToName(chainId) {
68469
68471
  function ethAddressString(address) {
68470
68472
  return typeof address === "string" ? getAddress(address) : getAddress(address.toHex());
68471
68473
  }
68474
+ class FixedIdJsonRpcProvider extends JsonRpcProvider {
68475
+ async _send(payload) {
68476
+ const results = await super._send(payload);
68477
+ const payloads = Array.isArray(payload) ? payload : [payload];
68478
+ return results.map((result, i2) => ({ ...result, id: payloads[i2]?.id ?? result.id }));
68479
+ }
68480
+ }
68472
68481
  function newGnosisProvider(url) {
68473
- return new JsonRpcProvider(url, GnosisNetwork, { staticNetwork: true });
68482
+ return new FixedIdJsonRpcProvider(url, GnosisNetwork, { staticNetwork: true, batchMaxCount: 1 });
68483
+ }
68484
+ function newGnosisProviderForValidation(url) {
68485
+ return new FixedIdJsonRpcProvider(url, void 0, { batchMaxCount: 1 });
68474
68486
  }
68475
68487
  const initialValues$9 = {
68476
68488
  beeApi: null,
@@ -68912,7 +68924,7 @@ const Warning = createSvgIcon(/* @__PURE__ */ jsxRuntimeExports.jsx("path", {
68912
68924
  const Web = createSvgIcon(/* @__PURE__ */ jsxRuntimeExports.jsx("path", {
68913
68925
  d: "M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m-5 14H4v-4h11zm0-5H4V9h11zm5 5h-4V9h4z"
68914
68926
  }), "Web");
68915
- const useStyles$C = makeStyles()((theme2) => ({
68927
+ const useStyles$D = makeStyles()((theme2) => ({
68916
68928
  root: {
68917
68929
  width: "100%",
68918
68930
  padding: 0,
@@ -68938,7 +68950,7 @@ const useStyles$C = makeStyles()((theme2) => ({
68938
68950
  }
68939
68951
  }));
68940
68952
  function ExpandableList({ children, label, level, defaultOpen, info }) {
68941
- const { classes: classes2 } = useStyles$C();
68953
+ const { classes: classes2 } = useStyles$D();
68942
68954
  const [open2, setOpen] = React.useState(Boolean(defaultOpen));
68943
68955
  const handleClick = () => {
68944
68956
  setOpen(!open2);
@@ -69013,7 +69025,7 @@ function requireInformationLineIcon() {
69013
69025
  }
69014
69026
  var InformationLineIconExports = requireInformationLineIcon();
69015
69027
  const Info = /* @__PURE__ */ getDefaultExportFromCjs(InformationLineIconExports);
69016
- const useStyles$B = makeStyles()((theme2) => ({
69028
+ const useStyles$C = makeStyles()((theme2) => ({
69017
69029
  header: {
69018
69030
  backgroundColor: theme2.palette.background.paper,
69019
69031
  marginBottom: theme2.spacing(0.25),
@@ -69030,16 +69042,16 @@ const useStyles$B = makeStyles()((theme2) => ({
69030
69042
  }
69031
69043
  }));
69032
69044
  function ExpandableListItem({ label, value, tooltip }) {
69033
- const { classes: classes2 } = useStyles$B();
69045
+ const { classes: classes2 } = useStyles$C();
69034
69046
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ListItemButton, { className: classes2.header, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { display: "flex", flexDirection: "row", alignItems: "center", width: "100%", children: [
69035
69047
  label && /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { flex: 2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body1", children: label }) }),
69036
- value && /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { flex: 1, textAlign: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography, { variant: "body2", children: [
69048
+ value && /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { flex: 1, textAlign: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography, { variant: "body2", component: "div", children: [
69037
69049
  value,
69038
69050
  tooltip && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { title: tooltip, placement: "top", arrow: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconButton, { size: "small", className: classes2.copyValue, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Info, { strokeWidth: 1 }) }) })
69039
69051
  ] }) })
69040
69052
  ] }) });
69041
69053
  }
69042
- const useStyles$A = makeStyles()((theme2) => ({
69054
+ const useStyles$B = makeStyles()((theme2) => ({
69043
69055
  wrapper: {
69044
69056
  display: "flex",
69045
69057
  flexDirection: "row",
@@ -69051,7 +69063,7 @@ const useStyles$A = makeStyles()((theme2) => ({
69051
69063
  }
69052
69064
  }));
69053
69065
  function ExpandableListItemActions({ children }) {
69054
- const { classes: classes2 } = useStyles$A();
69066
+ const { classes: classes2 } = useStyles$B();
69055
69067
  if (Array.isArray(children)) {
69056
69068
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classes2.wrapper, children: children.filter((x) => x).map((a2, i2) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classes2.action, children: a2 }, i2)) });
69057
69069
  }
@@ -69219,15 +69231,21 @@ function useClipboardCopy(value) {
69219
69231
  tooltipCloseHandler
69220
69232
  };
69221
69233
  }
69222
- const useStyles$z = makeStyles()((theme2) => ({
69234
+ const useStyles$A = makeStyles()((theme2) => ({
69223
69235
  header: {
69224
69236
  backgroundColor: theme2.palette.background.paper,
69225
69237
  marginBottom: theme2.spacing(0.25),
69226
- borderLeft: `${theme2.spacing(0.25)}px solid rgba(0,0,0,0)`,
69227
- wordBreak: "break-word"
69238
+ borderLeft: `${theme2.spacing(0.25)} solid rgba(0,0,0,0)`,
69239
+ wordBreak: "break-word",
69240
+ "&:hover": {
69241
+ backgroundColor: theme2.palette.background.paper
69242
+ },
69243
+ "&:focus-within": {
69244
+ backgroundColor: theme2.palette.background.paper
69245
+ }
69228
69246
  },
69229
69247
  headerOpen: {
69230
- borderLeft: `${theme2.spacing(0.25)}px solid ${theme2.palette.primary.main}`
69248
+ borderLeft: `${theme2.spacing(0.25)} solid ${theme2.palette.primary.main}`
69231
69249
  },
69232
69250
  copyValue: {
69233
69251
  cursor: "pointer",
@@ -69256,14 +69274,14 @@ const split = (s2) => {
69256
69274
  return s2.match(/(0x|.{1,8})/gi) || [];
69257
69275
  };
69258
69276
  function ExpandableListItemKey({ label, value, expanded }) {
69259
- const { classes: classes2 } = useStyles$z();
69277
+ const { classes: classes2 } = useStyles$A();
69260
69278
  const [open2, setOpen] = React.useState(expanded || false);
69261
69279
  const { copied, handleCopy, tooltipCloseHandler } = useClipboardCopy(value);
69262
69280
  const toggleOpen = () => setOpen(!open2);
69263
69281
  const splitValues = split(value);
69264
69282
  const hasPrefix = isPrefixedHexString(value);
69265
69283
  const spanText = `${hasPrefix ? `${splitValues[0]} ${splitValues[1]}` : splitValues[0]}[…]${splitValues[splitValues.length - 1]}`;
69266
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ListItemButton, { className: `${classes2.header} ${open2 ? classes2.headerOpen : ""}`, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid, { container: true, direction: "column", justifyContent: "space-between", alignItems: "stretch", children: [
69284
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ListItemButton, { className: `${classes2.header} ${open2 ? classes2.headerOpen : ""}`, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid, { container: true, direction: "column", justifyContent: "space-between", alignItems: "stretch", style: { width: "100%" }, children: [
69267
69285
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid, { container: true, direction: "row", justifyContent: "space-between", alignItems: "center", children: [
69268
69286
  label && /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body1", component: "span", children: label }),
69269
69287
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography, { variant: "body2", component: "span", children: [
@@ -69321,7 +69339,7 @@ function requirePulseLineIcon() {
69321
69339
  }
69322
69340
  var PulseLineIconExports = requirePulseLineIcon();
69323
69341
  const Activity = /* @__PURE__ */ getDefaultExportFromCjs(PulseLineIconExports);
69324
- const useStyles$y = makeStyles()((theme2) => ({
69342
+ const useStyles$z = makeStyles()((theme2) => ({
69325
69343
  root: {
69326
69344
  height: "100%"
69327
69345
  },
@@ -69337,7 +69355,7 @@ const useStyles$y = makeStyles()((theme2) => ({
69337
69355
  }
69338
69356
  }));
69339
69357
  function TroubleshootConnectionCard() {
69340
- const { classes: classes2 } = useStyles$y();
69358
+ const { classes: classes2 } = useStyles$z();
69341
69359
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid, { container: true, direction: "column", justifyContent: "center", alignItems: "center", className: classes2.root, children: [
69342
69360
  /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { className: classes2.content, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "h1", align: "center", children: "Uh oh, it looks like your node is not connected." }) }),
69343
69361
  /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { className: classes2.content, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography, { align: "center", children: [
@@ -69409,7 +69427,7 @@ function requireDownloadLineIcon() {
69409
69427
  }
69410
69428
  var DownloadLineIconExports = requireDownloadLineIcon();
69411
69429
  const Download$1 = /* @__PURE__ */ getDefaultExportFromCjs(DownloadLineIconExports);
69412
- const useStyles$x = makeStyles()((theme2) => ({
69430
+ const useStyles$y = makeStyles()((theme2) => ({
69413
69431
  link: {
69414
69432
  color: "#dd7700",
69415
69433
  textDecoration: "underline",
@@ -69421,14 +69439,14 @@ const useStyles$x = makeStyles()((theme2) => ({
69421
69439
  }
69422
69440
  },
69423
69441
  buttonSelected: {
69424
- color: "white",
69425
- backgroundColor: theme2.palette.primary.main,
69442
+ color: theme2.palette.secondary.main,
69443
+ backgroundColor: "white",
69426
69444
  "&:hover": {
69427
- color: theme2.palette.secondary.main,
69428
- backgroundColor: "white",
69445
+ color: "white",
69446
+ backgroundColor: theme2.palette.primary.main,
69429
69447
  "@media (hover: none)": {
69430
- color: "white",
69431
- backgroundColor: theme2.palette.primary.main
69448
+ color: theme2.palette.secondary.main,
69449
+ backgroundColor: "white"
69432
69450
  }
69433
69451
  }
69434
69452
  },
@@ -69447,7 +69465,7 @@ function WithdrawDepositModal({
69447
69465
  action,
69448
69466
  icon
69449
69467
  }) {
69450
- const { classes: classes2 } = useStyles$x();
69468
+ const { classes: classes2 } = useStyles$y();
69451
69469
  const [open2, setOpen] = React.useState(false);
69452
69470
  const [amount, setAmount] = React.useState("");
69453
69471
  const [amountToken, setAmountToken] = React.useState(null);
@@ -71044,26 +71062,6 @@ function shortenText(text, length2 = 20, separator = "[…]") {
71044
71062
  }
71045
71063
  return `${text.slice(0, length2)}${separator}${text.slice(-length2)}`;
71046
71064
  }
71047
- const DEFAULT_POLLING_FREQUENCY = 1e3;
71048
- const DEFAULT_STAMP_USABLE_TIMEOUT = 5 * 6e4;
71049
- function waitUntilStampUsable(batchId, bee, options) {
71050
- return waitForStamp(batchId, bee);
71051
- }
71052
- async function waitForStamp(batchId, bee, options) {
71053
- const timeout3 = DEFAULT_STAMP_USABLE_TIMEOUT;
71054
- const pollingFrequency = DEFAULT_POLLING_FREQUENCY;
71055
- for (let i2 = 0; i2 < timeout3; i2 += pollingFrequency) {
71056
- try {
71057
- const stamp = await bee.getPostageBatch(batchId);
71058
- if (stamp.usable) {
71059
- return stamp;
71060
- }
71061
- } catch {
71062
- }
71063
- await sleepMs(pollingFrequency);
71064
- }
71065
- throw new Error("Wait until stamp usable timeout has been reached");
71066
- }
71067
71065
  function mergeAccounting(balances, settlements, uncashedAmounts) {
71068
71066
  if (!balances || !settlements) return null;
71069
71067
  const accounting = {};
@@ -71289,7 +71287,7 @@ const tabMap = {
71289
71287
  FEEDS: 3,
71290
71288
  STAKING: 4
71291
71289
  };
71292
- const useStyles$w = makeStyles()((theme2) => ({
71290
+ const useStyles$x = makeStyles()((theme2) => ({
71293
71291
  root: {
71294
71292
  flexGrow: 1,
71295
71293
  marginBottom: theme2.spacing(4),
@@ -71303,7 +71301,7 @@ const useStyles$w = makeStyles()((theme2) => ({
71303
71301
  }
71304
71302
  }));
71305
71303
  function AccountNavigation({ active }) {
71306
- const { classes: classes2 } = useStyles$w();
71304
+ const { classes: classes2 } = useStyles$x();
71307
71305
  const navigate = useNavigate();
71308
71306
  const { nodeInfo } = React.useContext(Context$7);
71309
71307
  function onChange(_event, newValue) {
@@ -71525,7 +71523,7 @@ function requireDownload2LineIcon() {
71525
71523
  }
71526
71524
  var Download2LineIconExports = requireDownload2LineIcon();
71527
71525
  const DownloadIcon = /* @__PURE__ */ getDefaultExportFromCjs(Download2LineIconExports);
71528
- const useStyles$v = makeStyles()(() => ({
71526
+ const useStyles$w = makeStyles()(() => ({
71529
71527
  button: {
71530
71528
  height: "42px",
71531
71529
  position: "relative",
@@ -71563,7 +71561,7 @@ function SwarmButton({
71563
71561
  style: style2,
71564
71562
  ...other
71565
71563
  }) {
71566
- const { classes: classes2 } = useStyles$v();
71564
+ const { classes: classes2 } = useStyles$w();
71567
71565
  function getIconColor() {
71568
71566
  if (loading || disabled) {
71569
71567
  return "rgba(0, 0, 0, 0.26)";
@@ -71622,8 +71620,47 @@ function Provider$6({ children }) {
71622
71620
  }, [setIdentities]);
71623
71621
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Context$6.Provider, { value: { identities, setIdentities }, children });
71624
71622
  }
71623
+ function validateDepthInput(depthInput, onError, onSuccess) {
71624
+ let validDepthInput = "0";
71625
+ if (!depthInput) {
71626
+ onError("Required field");
71627
+ } else {
71628
+ const depth = new BigNumber(depthInput);
71629
+ if (!depth.isInteger()) {
71630
+ onError("Depth must be an integer");
71631
+ } else if (depth.isLessThan(MIN_STAMP_DEPTH)) {
71632
+ onError(`Minimal depth is ${MIN_STAMP_DEPTH}`);
71633
+ } else if (depth.isGreaterThan(MAX_STAMP_DEPTH)) {
71634
+ onError(`Depth has to be at most ${MAX_STAMP_DEPTH}`);
71635
+ } else {
71636
+ onError("");
71637
+ validDepthInput = depthInput;
71638
+ }
71639
+ }
71640
+ onSuccess(validDepthInput);
71641
+ }
71642
+ const DEFAULT_POLLING_FREQUENCY = 1e3;
71643
+ const DEFAULT_STAMP_USABLE_TIMEOUT = 5 * 6e4;
71644
+ function waitUntilStampUsable(batchId, bee, options) {
71645
+ return waitForStamp(batchId, bee);
71646
+ }
71647
+ async function waitForStamp(batchId, bee, options) {
71648
+ const timeout3 = DEFAULT_STAMP_USABLE_TIMEOUT;
71649
+ const pollingFrequency = DEFAULT_POLLING_FREQUENCY;
71650
+ for (let i2 = 0; i2 < timeout3; i2 += pollingFrequency) {
71651
+ try {
71652
+ const stamp = await bee.getPostageBatch(batchId);
71653
+ if (stamp.usable) {
71654
+ return stamp;
71655
+ }
71656
+ } catch {
71657
+ }
71658
+ await sleepMs(pollingFrequency);
71659
+ }
71660
+ throw new Error("Wait until stamp usable timeout has been reached");
71661
+ }
71625
71662
  function generateWallet() {
71626
- const privateKey = randomBytes(PrivateKey.LENGTH).toString();
71663
+ const privateKey = new Bytes(randomBytes(PrivateKey.LENGTH)).toString();
71627
71664
  return new Wallet(privateKey);
71628
71665
  }
71629
71666
  function persistIdentity(identities, identity2) {
@@ -71706,24 +71743,24 @@ function SwarmDialog({ children }) {
71706
71743
  }
71707
71744
  );
71708
71745
  }
71709
- const useStyles$u = makeStyles()((theme2) => ({
71746
+ const useStyles$v = makeStyles()((theme2) => ({
71710
71747
  wrapper: {
71711
71748
  padding: theme2.spacing(1),
71712
71749
  cursor: "pointer"
71713
71750
  }
71714
71751
  }));
71715
71752
  function CloseButton({ onClose }) {
71716
- const { classes: classes2 } = useStyles$u();
71753
+ const { classes: classes2 } = useStyles$v();
71717
71754
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classes2.wrapper, onClick: onClose, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Close, {}) });
71718
71755
  }
71719
- const useStyles$t = makeStyles()(() => ({
71756
+ const useStyles$u = makeStyles()(() => ({
71720
71757
  text: {
71721
71758
  color: "#606060",
71722
71759
  fontWeight: "bold"
71723
71760
  }
71724
71761
  }));
71725
71762
  function TitleWithClose({ children, onClose }) {
71726
- const { classes: classes2 } = useStyles$t();
71763
+ const { classes: classes2 } = useStyles$u();
71727
71764
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid, { container: true, justifyContent: "space-between", alignItems: "center", children: [
71728
71765
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: " " }),
71729
71766
  /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { className: classes2.text, align: "center", children }),
@@ -71864,7 +71901,7 @@ function requireClipboardLineIcon() {
71864
71901
  }
71865
71902
  var ClipboardLineIconExports = requireClipboardLineIcon();
71866
71903
  const Clipboard = /* @__PURE__ */ getDefaultExportFromCjs(ClipboardLineIconExports);
71867
- const useStyles$s = makeStyles()((theme2) => ({
71904
+ const useStyles$t = makeStyles()((theme2) => ({
71868
71905
  wrapper: {
71869
71906
  overflow: "scroll",
71870
71907
  background: "#ffffff"
@@ -71882,17 +71919,17 @@ function prettifyString(string) {
71882
71919
  }
71883
71920
  }
71884
71921
  function Code({ children, prettify }) {
71885
- const { classes: classes2 } = useStyles$s();
71922
+ const { classes: classes2 } = useStyles$t();
71886
71923
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classes2.wrapper, children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: classes2.pre, children: prettify ? prettifyString(children) : children }) });
71887
71924
  }
71888
- const useStyles$r = makeStyles()(() => ({
71925
+ const useStyles$s = makeStyles()(() => ({
71889
71926
  wrapper: {
71890
71927
  maxWidth: "100%"
71891
71928
  }
71892
71929
  }));
71893
71930
  function ExportFeedDialog({ identity: identity2, onClose }) {
71894
71931
  const { enqueueSnackbar } = useSnackbar();
71895
- const { classes: classes2 } = useStyles$r();
71932
+ const { classes: classes2 } = useStyles$s();
71896
71933
  function onDownload() {
71897
71934
  FileSaver_minExports.saveAs(
71898
71935
  new Blob([identity2.identity], {
@@ -74053,7 +74090,7 @@ function TextField2({ children, ...props }) {
74053
74090
  return /* @__PURE__ */ jsxRuntimeExports.jsx(TextField$1, { ...fieldToTextField(props), children });
74054
74091
  }
74055
74092
  TextField2.displayName = "FormikMaterialUITextField";
74056
- const useStyles$q = makeStyles()((theme2) => ({
74093
+ const useStyles$r = makeStyles()((theme2) => ({
74057
74094
  field: {
74058
74095
  background: theme2.palette.background.paper,
74059
74096
  "& fieldset": {
@@ -74080,7 +74117,7 @@ function SwarmTextInput({
74080
74117
  defaultValue,
74081
74118
  placeholder
74082
74119
  }) {
74083
- const { classes: classes2 } = useStyles$q();
74120
+ const { classes: classes2 } = useStyles$r();
74084
74121
  if (formik) {
74085
74122
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
74086
74123
  Field,
@@ -74094,7 +74131,7 @@ function SwarmTextInput({
74094
74131
  variant: "filled",
74095
74132
  className: classes2.field,
74096
74133
  defaultValue: defaultValue || "",
74097
- InputProps: { disableUnderline: true },
74134
+ slotProps: { input: { disableUnderline: true } },
74098
74135
  placeholder
74099
74136
  }
74100
74137
  );
@@ -74110,12 +74147,12 @@ function SwarmTextInput({
74110
74147
  className: classes2.field,
74111
74148
  defaultValue: defaultValue || "",
74112
74149
  onChange,
74113
- InputProps: { disableUnderline: true },
74150
+ slotProps: { input: { disableUnderline: true } },
74114
74151
  placeholder
74115
74152
  }
74116
74153
  );
74117
74154
  }
74118
- const useStyles$p = makeStyles()((theme2) => ({
74155
+ const useStyles$q = makeStyles()((theme2) => ({
74119
74156
  textarea: {
74120
74157
  width: "100%",
74121
74158
  border: 0,
@@ -74131,7 +74168,7 @@ function ImportFeedDialog({ onClose }) {
74131
74168
  const fileInputRef = React.useRef(null);
74132
74169
  const { identities, setIdentities } = React.useContext(Context$6);
74133
74170
  const { enqueueSnackbar } = useSnackbar();
74134
- const { classes: classes2 } = useStyles$p();
74171
+ const { classes: classes2 } = useStyles$q();
74135
74172
  async function onImport() {
74136
74173
  const feed = await importIdentity(name, textareaValue);
74137
74174
  if (feed) {
@@ -74248,7 +74285,7 @@ function AccountFeeds() {
74248
74285
  /* @__PURE__ */ jsxRuntimeExports.jsx(ExpandableListItemKey, { label: "Topic", value: NULL_TOPIC.toHex() }),
74249
74286
  x.feedHash && /* @__PURE__ */ jsxRuntimeExports.jsx(ExpandableListItemKey, { label: "Feed hash", value: x.feedHash }),
74250
74287
  /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mt: 0.75, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(ExpandableListItemActions, { children: [
74251
- /* @__PURE__ */ jsxRuntimeExports.jsx(SwarmButton, { onClick: () => viewFeed(x.uuid), iconType: Info, children: "View Feed Page" }),
74288
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SwarmButton, { onClick: () => viewFeed(x.uuid), iconType: Info, disabled: Boolean(!x.feedHash), children: "View Feed Page" }),
74252
74289
  /* @__PURE__ */ jsxRuntimeExports.jsx(SwarmButton, { onClick: () => onShowExport(x), iconType: DownloadIcon, children: "Export..." }),
74253
74290
  /* @__PURE__ */ jsxRuntimeExports.jsx(SwarmButton, { onClick: () => onShowDelete(x), iconType: Trash, children: "Delete..." })
74254
74291
  ] }) })
@@ -74487,7 +74524,7 @@ function requireTimerFlashLineIcon() {
74487
74524
  }
74488
74525
  var TimerFlashLineIconExports = requireTimerFlashLineIcon();
74489
74526
  const TimerFlashLine = /* @__PURE__ */ getDefaultExportFromCjs(TimerFlashLineIconExports);
74490
- const useStyles$o = makeStyles()((theme2) => ({
74527
+ const useStyles$p = makeStyles()((theme2) => ({
74491
74528
  root: {
74492
74529
  width: "100%",
74493
74530
  padding: 0,
@@ -74516,7 +74553,7 @@ const useStyles$o = makeStyles()((theme2) => ({
74516
74553
  }
74517
74554
  }));
74518
74555
  function ExpandableElement({ children, expandable, defaultOpen }) {
74519
- const { classes: classes2 } = useStyles$o();
74556
+ const { classes: classes2 } = useStyles$p();
74520
74557
  const [open2, setOpen] = React.useState(Boolean(defaultOpen));
74521
74558
  const handleClick = () => {
74522
74559
  setOpen(!open2);
@@ -74529,11 +74566,35 @@ function ExpandableElement({ children, expandable, defaultOpen }) {
74529
74566
  /* @__PURE__ */ jsxRuntimeExports.jsx(Collapse, { in: open2, timeout: "auto", unmountOnExit: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classes2.contentLevel12, children: expandable }) })
74530
74567
  ] });
74531
74568
  }
74532
- function StampExtensionModal({ type, icon, bee, stamp }) {
74569
+ const useStyles$o = makeStyles()((theme2) => ({
74570
+ buttonSelected: {
74571
+ color: "white",
74572
+ backgroundColor: theme2.palette.primary.main,
74573
+ "&:hover": {
74574
+ color: theme2.palette.secondary.main,
74575
+ backgroundColor: "white",
74576
+ "@media (hover: none)": {
74577
+ color: "white",
74578
+ backgroundColor: theme2.palette.primary.main
74579
+ }
74580
+ }
74581
+ },
74582
+ buttonUnselected: {
74583
+ color: "#dd7700",
74584
+ backgroundColor: "white"
74585
+ }
74586
+ }));
74587
+ var StampExtensionType = /* @__PURE__ */ ((StampExtensionType2) => {
74588
+ StampExtensionType2["Topup"] = "Topup";
74589
+ StampExtensionType2["Dilute"] = "Dilute";
74590
+ return StampExtensionType2;
74591
+ })(StampExtensionType || {});
74592
+ function StampExtensionModal({ type, icon, bee, stamp, status }) {
74593
+ const { classes: classes2 } = useStyles$o();
74533
74594
  const [open2, setOpen] = React.useState(false);
74534
74595
  const [amount, setAmount] = React.useState("");
74535
74596
  const { enqueueSnackbar } = useSnackbar();
74536
- const label = `${type} ${stamp.toHex().substring(0, 8)}`;
74597
+ const label = `${type} ${stamp.batchID.toHex().substring(0, 8)}`;
74537
74598
  const handleClickOpen = (e2) => {
74538
74599
  setOpen(true);
74539
74600
  e2.stopPropagation();
@@ -74542,28 +74603,57 @@ function StampExtensionModal({ type, icon, bee, stamp }) {
74542
74603
  setOpen(false);
74543
74604
  };
74544
74605
  const handleAction = async () => {
74606
+ if (status !== CheckState.OK) {
74607
+ enqueueSnackbar(`Node connection status is not ${CheckState.OK}: ${status}`, { variant: "error" });
74608
+ return;
74609
+ }
74545
74610
  if (type === "Topup") {
74611
+ const isAmountInvalid = BigInt(amount) <= BigInt(0);
74612
+ if (isAmountInvalid) {
74613
+ enqueueSnackbar(`Invalid amount: ${amount}, it must be greate than 0`, { variant: "error" });
74614
+ return;
74615
+ }
74546
74616
  try {
74547
- await bee.topUpBatch(stamp, amount);
74617
+ await bee.topUpBatch(stamp.batchID, amount);
74548
74618
  enqueueSnackbar(`Successfully topped up stamp, your changes will appear soon`, { variant: "success" });
74549
74619
  } catch (error) {
74550
74620
  enqueueSnackbar(`Failed to topup stamp: ${error || "Unknown reason"}`, { variant: "error" });
74551
74621
  }
74622
+ return;
74552
74623
  }
74553
74624
  if (type === "Dilute") {
74625
+ const newDepth = parseInt(amount, 10);
74626
+ const ttlDays = stamp.duration.toDays();
74627
+ const currentDepth = stamp.depth;
74628
+ const maxHalvings = Math.floor(Math.log2(ttlDays)) + currentDepth;
74629
+ const isDepthInvalid = newDepth > maxHalvings || newDepth <= currentDepth;
74630
+ if (isDepthInvalid) {
74631
+ enqueueSnackbar(`Invalid depth: ${newDepth} (${currentDepth} < new depth < ${maxHalvings})`, {
74632
+ variant: "error"
74633
+ });
74634
+ return;
74635
+ }
74636
+ if (ttlDays <= 2) {
74637
+ enqueueSnackbar(`TTL: ${ttlDays} <= 2 days, cannot dilute stamp (min. TTL is 1 day)`, {
74638
+ variant: "warning"
74639
+ });
74640
+ return;
74641
+ }
74554
74642
  try {
74555
- await bee.diluteBatch(stamp, parseInt(amount, 10));
74643
+ await bee.diluteBatch(stamp.batchID, newDepth);
74556
74644
  enqueueSnackbar(`Successfully diluted stamp, your changes will appear soon`, { variant: "success" });
74557
74645
  } catch (error) {
74558
74646
  enqueueSnackbar(`Failed to dilute stamp: ${error || "Unknown reason"}`, { variant: "error" });
74559
74647
  }
74648
+ return;
74560
74649
  }
74650
+ enqueueSnackbar(`Failed to extend stamp, unknown operation: ${type}`, { variant: "error" });
74561
74651
  };
74562
74652
  const handleChange = (event) => {
74563
74653
  setAmount(event.target.value);
74564
74654
  };
74565
74655
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { mb: 2, children: [
74566
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { variant: "contained", onClick: handleClickOpen, startIcon: icon, children: type }),
74656
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { className: classes2.buttonSelected, variant: "contained", onClick: handleClickOpen, startIcon: icon, children: type }),
74567
74657
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Dialog, { open: open2, onClose: handleClose, "aria-labelledby": "form-dialog-title", children: [
74568
74658
  /* @__PURE__ */ jsxRuntimeExports.jsx(DialogTitle, { id: "form-dialog-title", children: label }),
74569
74659
  /* @__PURE__ */ jsxRuntimeExports.jsx(DialogContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -74581,7 +74671,18 @@ function StampExtensionModal({ type, icon, bee, stamp }) {
74581
74671
  ) }),
74582
74672
  /* @__PURE__ */ jsxRuntimeExports.jsxs(DialogActions, { children: [
74583
74673
  /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { onClick: handleClose, color: "primary", children: "Cancel" }),
74584
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { disabled: amount === "", onClick: handleAction, color: "primary", children: type })
74674
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
74675
+ Button$1,
74676
+ {
74677
+ disabled: amount === "",
74678
+ onClick: async () => {
74679
+ await handleAction();
74680
+ handleClose();
74681
+ },
74682
+ color: "primary",
74683
+ children: type
74684
+ }
74685
+ )
74585
74686
  ] })
74586
74687
  ] })
74587
74688
  ] });
@@ -74769,6 +74870,102 @@ function packageFile(file, pathOverwrite) {
74769
74870
  bytes: file.bytes
74770
74871
  };
74771
74872
  }
74873
+ function getExtensionFromName(name) {
74874
+ const ext = name.split(".").pop()?.toLowerCase() || "";
74875
+ const hasExtension = name.includes(".") && ext && ext !== name;
74876
+ return hasExtension ? ext : "";
74877
+ }
74878
+ const EXT_TO_MIME = {
74879
+ mp4: "video/mp4",
74880
+ webm: "video/webm",
74881
+ ogv: "video/ogg",
74882
+ mp3: "audio/mpeg",
74883
+ m4a: "audio/mp4",
74884
+ aac: "audio/aac",
74885
+ wav: "audio/wav",
74886
+ ogg: "audio/ogg",
74887
+ png: "image/png",
74888
+ jpg: "image/jpeg",
74889
+ jpeg: "image/jpeg",
74890
+ gif: "image/gif",
74891
+ webp: "image/webp",
74892
+ avif: "image/avif",
74893
+ svg: "image/svg+xml",
74894
+ pdf: "application/pdf",
74895
+ txt: "text/plain",
74896
+ md: "text/markdown",
74897
+ json: "application/json",
74898
+ csv: "text/csv",
74899
+ html: "text/html",
74900
+ htm: "text/html",
74901
+ ico: "image/vnd.microsoft.icon"
74902
+ };
74903
+ function guessMime(name, mtdt) {
74904
+ const md = mtdt?.mimeType || mtdt?.mime || mtdt?.["content-type"];
74905
+ const ext = getExtensionFromName(name);
74906
+ if (md) return { mime: md, ext };
74907
+ const mime = EXT_TO_MIME[ext] || "application/octet-stream";
74908
+ return { mime, ext };
74909
+ }
74910
+ const VIDEO_HTML = (u2, title) => `<html><head><meta charset="utf-8"/><title>${title}</title></head><body style="margin:0;background:#000">
74911
+ <video controls autoplay style="width:100%;height:100%" src="${u2}"></video>
74912
+ </body></html>`;
74913
+ const AUDIO_HTML = (u2, title) => `<html><head><meta charset="utf-8"/><title>${title}</title></head><body>
74914
+ <audio controls autoplay style="width:100%" src="${u2}"></audio>
74915
+ </body></html>`;
74916
+ const IMAGE_HTML = (u2, title) => `<html><head><meta charset="utf-8"/><title>${title}</title></head><body style="margin:0;background:#111;display:grid;place-items:center;min-height:100vh">
74917
+ <img style="max-width:100%;max-height:100vh" src="${u2}" />
74918
+ </body></html>`;
74919
+ const VIEWERS = [
74920
+ {
74921
+ name: "video",
74922
+ test: (m) => m.startsWith("video/"),
74923
+ render: (w, url, mime, name) => {
74924
+ w.document.write(VIDEO_HTML(url, name));
74925
+ w.document.title = name;
74926
+ }
74927
+ },
74928
+ {
74929
+ name: "audio",
74930
+ test: (m) => m.startsWith("audio/"),
74931
+ render: (w, url, mime, name) => {
74932
+ w.document.write(AUDIO_HTML(url, name));
74933
+ w.document.title = name;
74934
+ }
74935
+ },
74936
+ {
74937
+ name: "image",
74938
+ test: (m) => m.startsWith("image/"),
74939
+ render: (w, url, mime, name) => {
74940
+ w.document.write(IMAGE_HTML(url, name));
74941
+ w.document.title = name;
74942
+ }
74943
+ },
74944
+ {
74945
+ name: "pdf",
74946
+ test: (m) => m === "application/pdf",
74947
+ render: (w, url, mime, name) => {
74948
+ w.document.title = name;
74949
+ w.location.href = url;
74950
+ }
74951
+ },
74952
+ {
74953
+ name: "html",
74954
+ test: (m) => m === "text/html",
74955
+ render: (w, url, mime, name) => {
74956
+ w.document.title = name;
74957
+ w.location.href = url;
74958
+ }
74959
+ },
74960
+ {
74961
+ name: "text-like",
74962
+ test: (m) => m.startsWith("text/") || m === "application/json" || m === "text/markdown",
74963
+ render: (w, url, mime, name) => {
74964
+ w.document.title = name;
74965
+ w.location.href = url;
74966
+ }
74967
+ }
74968
+ ];
74772
74969
  function Capacity({ width: width2, usage }) {
74773
74970
  const integerUsage = Math.round(usage * 100);
74774
74971
  const used = integerUsage + "%";
@@ -74789,6 +74986,7 @@ function PostageStamp({ stamp, shorten }) {
74789
74986
  }
74790
74987
  function StampsTable({ postageStamps }) {
74791
74988
  const { beeApi } = React.useContext(Context$8);
74989
+ const { status } = React.useContext(Context$7);
74792
74990
  if (!postageStamps || !beeApi) {
74793
74991
  return null;
74794
74992
  }
@@ -74802,8 +75000,8 @@ function StampsTable({ postageStamps }) {
74802
75000
  ExpandableListItem,
74803
75001
  {
74804
75002
  label: "Capacity",
74805
- value: `${getHumanReadableFileSize(2 ** stamp.depth * 4096 * stamp.usage)} / ${getHumanReadableFileSize(
74806
- 2 ** stamp.depth * 4096
75003
+ value: `${getHumanReadableFileSize(stamp.size.toBytes() - stamp.remainingSize.toBytes())} / ${getHumanReadableFileSize(
75004
+ stamp.size.toBytes()
74807
75005
  )}`
74808
75006
  }
74809
75007
  ),
@@ -74817,19 +75015,21 @@ function StampsTable({ postageStamps }) {
74817
75015
  /* @__PURE__ */ jsxRuntimeExports.jsx(
74818
75016
  StampExtensionModal,
74819
75017
  {
74820
- type: "Topup",
75018
+ type: StampExtensionType.Topup,
74821
75019
  icon: /* @__PURE__ */ jsxRuntimeExports.jsx(TimerFlashFill, { size: "1rem" }),
74822
75020
  bee: beeApi,
74823
- stamp: stamp.batchID
75021
+ stamp,
75022
+ status: status.all
74824
75023
  }
74825
75024
  ),
74826
75025
  /* @__PURE__ */ jsxRuntimeExports.jsx(
74827
75026
  StampExtensionModal,
74828
75027
  {
74829
- type: "Dilute",
75028
+ type: StampExtensionType.Dilute,
74830
75029
  icon: /* @__PURE__ */ jsxRuntimeExports.jsx(TimerFlashLine, { size: "1rem" }),
74831
75030
  bee: beeApi,
74832
- stamp: stamp.batchID
75031
+ stamp,
75032
+ status: status.all
74833
75033
  }
74834
75034
  )
74835
75035
  ] })
@@ -75192,7 +75392,7 @@ function WalletInfoCard() {
75192
75392
  4
75193
75393
  )} xBZZ | ${walletBalance.nativeTokenBalance.toSignificantDigits(4)} xDAI`;
75194
75394
  }
75195
- if (nodeInfo?.beeMode && ["light", "full", "dev"].includes(nodeInfo.beeMode)) {
75395
+ if (nodeInfo?.beeMode && [BeeModes.LIGHT, BeeModes.FULL, BeeModes.DEV].includes(nodeInfo.beeMode)) {
75196
75396
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
75197
75397
  Card$1,
75198
75398
  {
@@ -75349,6 +75549,7 @@ function SwarmSelect({
75349
75549
  value,
75350
75550
  className: classes2.select,
75351
75551
  displayEmpty: true,
75552
+ onChange,
75352
75553
  renderValue: (value2) => value2 ? renderValue(value2) : placeholder,
75353
75554
  MenuProps: { MenuListProps: { disablePadding: true }, PaperProps: { square: true } },
75354
75555
  children: options.map((x, i2) => /* @__PURE__ */ jsxRuntimeExports.jsx(MenuItem$1, { value: x.value, className: classes2.option, children: x.label }, i2))
@@ -75385,6 +75586,7 @@ const initialValues$5 = {
75385
75586
  function CreateNewFeed() {
75386
75587
  const { beeApi } = React.useContext(Context$8);
75387
75588
  const { identities, setIdentities } = React.useContext(Context$6);
75589
+ const [identityType, setIdentityType] = React.useState(IdentityType.PrivateKey);
75388
75590
  const [loading, setLoading] = React.useState(false);
75389
75591
  const { enqueueSnackbar } = useSnackbar();
75390
75592
  const navigate = useNavigate();
@@ -75395,10 +75597,19 @@ function CreateNewFeed() {
75395
75597
  setLoading(false);
75396
75598
  return;
75397
75599
  }
75398
- const wallet = generateWallet();
75399
- const stamps = await beeApi.getPostageBatches();
75600
+ let stamps = [];
75601
+ let wallet;
75602
+ try {
75603
+ wallet = generateWallet();
75604
+ stamps = (await beeApi.getPostageBatches()).filter((s2) => s2.usable);
75605
+ } catch (err) {
75606
+ console.log(err);
75607
+ enqueueSnackbar(/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Error during wallet generation or postage stamp retrieval!" }), { variant: "error" });
75608
+ setLoading(false);
75609
+ return;
75610
+ }
75400
75611
  if (!stamps || !stamps.length) {
75401
- enqueueSnackbar(/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "No stamp available" }), { variant: "error" });
75612
+ enqueueSnackbar(/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "No usable stamp available" }), { variant: "error" });
75402
75613
  setLoading(false);
75403
75614
  return;
75404
75615
  }
@@ -75407,15 +75618,25 @@ function CreateNewFeed() {
75407
75618
  setLoading(false);
75408
75619
  return;
75409
75620
  }
75410
- const identity2 = await convertWalletToIdentity(wallet, values2.type, values2.identityName, values2.password);
75411
- persistIdentity(identities, identity2);
75412
- setIdentities(identities);
75413
- navigate(ROUTES.ACCOUNT_FEEDS);
75414
- setLoading(false);
75621
+ try {
75622
+ const identity2 = await convertWalletToIdentity(wallet, values2.type, values2.identityName, values2.password);
75623
+ persistIdentity(identities, identity2);
75624
+ setIdentities(identities);
75625
+ navigate(ROUTES.ACCOUNT_FEEDS);
75626
+ } catch (err) {
75627
+ console.log(err);
75628
+ enqueueSnackbar(/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Error identity creation!" }), { variant: "error" });
75629
+ } finally {
75630
+ setLoading(false);
75631
+ }
75415
75632
  }
75416
75633
  function cancel() {
75417
75634
  navigate(-1);
75418
75635
  }
75636
+ function onIdentityTypeChange(event) {
75637
+ const type = event.target.value;
75638
+ setIdentityType(type);
75639
+ }
75419
75640
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
75420
75641
  /* @__PURE__ */ jsxRuntimeExports.jsx(HistoryHeader, { children: "Create new feed" }),
75421
75642
  /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mb: 4, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(DocumentationText, { children: [
@@ -75440,10 +75661,13 @@ function CreateNewFeed() {
75440
75661
  {
75441
75662
  formik: true,
75442
75663
  name: "type",
75664
+ label: "type",
75665
+ value: identityType,
75443
75666
  options: [
75444
75667
  { label: "Keypair Only", value: IdentityType.PrivateKey },
75445
75668
  { label: "Password Protected", value: IdentityType.V3 }
75446
- ]
75669
+ ],
75670
+ onChange: onIdentityTypeChange
75447
75671
  }
75448
75672
  ) }),
75449
75673
  values2.type === IdentityType.V3 && /* @__PURE__ */ jsxRuntimeExports.jsx(SwarmTextInput, { name: "password", label: "Password", password: true, formik: true }),
@@ -78404,8 +78628,8 @@ function UpdateFeed() {
78404
78628
  const { stamps, refresh } = React.useContext(Context$5);
78405
78629
  const { status } = React.useContext(Context$7);
78406
78630
  const { hash: hash2 } = useParams();
78407
- const [selectedStamp, setSelectedStamp] = React.useState(null);
78408
- const [selectedIdentity, setSelectedIdentity] = React.useState(null);
78631
+ const [selectedStamp, setSelectedStamp] = React.useState(stamps ? stamps[0]?.batchID.toHex() : null);
78632
+ const [selectedIdentity, setSelectedIdentity] = React.useState(identities[0] ?? null);
78409
78633
  const [loading, setLoading] = React.useState(false);
78410
78634
  const { enqueueSnackbar } = useSnackbar();
78411
78635
  const [showPasswordPrompt, setShowPasswordPrompt] = React.useState(false);
@@ -78477,18 +78701,23 @@ function UpdateFeed() {
78477
78701
  }
78478
78702
  ),
78479
78703
  /* @__PURE__ */ jsxRuntimeExports.jsx(HistoryHeader, { children: "Update feed" }),
78480
- /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mb: 2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { container: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
78704
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mb: 2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { container: true, children: identities && identities.length ? /* @__PURE__ */ jsxRuntimeExports.jsx(
78481
78705
  SwarmSelect,
78482
78706
  {
78707
+ value: selectedIdentity?.uuid ?? "",
78483
78708
  options: identities.map((x) => ({ value: x.uuid, label: `${x.name} Website` })),
78484
78709
  onChange: onFeedChange,
78485
78710
  label: "Feed"
78486
78711
  }
78487
- ) }) }),
78488
- /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mb: 4, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { container: true, children: stamps ? /* @__PURE__ */ jsxRuntimeExports.jsx(
78712
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { children: "You need to create an identiy first to be able to update its feed." }) }) }),
78713
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mb: 4, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { container: true, children: stamps && stamps.length ? /* @__PURE__ */ jsxRuntimeExports.jsx(
78489
78714
  SwarmSelect,
78490
78715
  {
78491
- options: stamps.map((x) => ({ value: x.batchID.toHex(), label: x.batchID.toHex().slice(0, 8) })),
78716
+ value: selectedStamp ?? "",
78717
+ options: stamps.map((x) => ({
78718
+ value: x.batchID.toHex(),
78719
+ label: x.label ? x.batchID.toHex().slice(0, 8) + ` (${x.label})` : x.batchID.toHex().slice(0, 8)
78720
+ })),
78492
78721
  onChange: onStampChange,
78493
78722
  label: "Stamp"
78494
78723
  }
@@ -78508,128 +78737,6 @@ function UpdateFeed() {
78508
78737
  ] })
78509
78738
  ] });
78510
78739
  }
78511
- const Ctx = React.createContext(void 0);
78512
- function SearchProvider({ children }) {
78513
- const [query, _setQuery] = React.useState("");
78514
- const [scope, setScope] = React.useState("all");
78515
- const [includeActive, setIncludeActive] = React.useState(true);
78516
- const [includeTrashed, setIncludeTrashed] = React.useState(true);
78517
- const preSearchState = React.useRef(null);
78518
- const inSearch = React.useRef(false);
78519
- const setQuery = React.useCallback(
78520
- (q) => {
78521
- const trimmed = q.trim();
78522
- if (!inSearch.current && trimmed.length > 0) {
78523
- preSearchState.current = { scope, includeActive, includeTrashed };
78524
- inSearch.current = true;
78525
- }
78526
- if (inSearch.current && trimmed.length === 0) {
78527
- const prev2 = preSearchState.current;
78528
- if (prev2) {
78529
- setScope(prev2.scope);
78530
- setIncludeActive(prev2.includeActive);
78531
- setIncludeTrashed(prev2.includeTrashed);
78532
- }
78533
- preSearchState.current = null;
78534
- inSearch.current = false;
78535
- }
78536
- _setQuery(q);
78537
- },
78538
- [scope, includeActive, includeTrashed]
78539
- );
78540
- const clear = React.useCallback(() => {
78541
- setQuery("");
78542
- }, [setQuery]);
78543
- const value = React.useMemo(
78544
- () => ({
78545
- query,
78546
- scope,
78547
- includeActive,
78548
- includeTrashed,
78549
- setQuery,
78550
- clear,
78551
- setScope,
78552
- setIncludeActive,
78553
- setIncludeTrashed
78554
- }),
78555
- [query, scope, includeActive, includeTrashed, clear, setQuery]
78556
- );
78557
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Ctx.Provider, { value, children });
78558
- }
78559
- function useSearch() {
78560
- const v = React.useContext(Ctx);
78561
- if (!v) throw new Error("useFMSearch must be used within SearchProvider");
78562
- return v;
78563
- }
78564
- var FileTransferType = /* @__PURE__ */ ((FileTransferType2) => {
78565
- FileTransferType2["Upload"] = "upload";
78566
- FileTransferType2["Download"] = "download";
78567
- FileTransferType2["Update"] = "update";
78568
- return FileTransferType2;
78569
- })(FileTransferType || {});
78570
- var TransferStatus = /* @__PURE__ */ ((TransferStatus2) => {
78571
- TransferStatus2["Uploading"] = "uploading";
78572
- TransferStatus2["Downloading"] = "downloading";
78573
- TransferStatus2["Done"] = "done";
78574
- TransferStatus2["Error"] = "error";
78575
- TransferStatus2["Queued"] = "queued";
78576
- TransferStatus2["Cancelled"] = "cancelled";
78577
- return TransferStatus2;
78578
- })(TransferStatus || {});
78579
- var TransferBarColor = /* @__PURE__ */ ((TransferBarColor2) => {
78580
- TransferBarColor2["Upload"] = "#22c55e";
78581
- TransferBarColor2["Update"] = "#f59e0b";
78582
- TransferBarColor2["Download"] = "#3b82f6";
78583
- return TransferBarColor2;
78584
- })(TransferBarColor || {});
78585
- var ViewType = /* @__PURE__ */ ((ViewType2) => {
78586
- ViewType2["File"] = "file";
78587
- ViewType2["Trash"] = "trash";
78588
- ViewType2["Expired"] = "expired";
78589
- return ViewType2;
78590
- })(ViewType || {});
78591
- var ActionTag = /* @__PURE__ */ ((ActionTag2) => {
78592
- ActionTag2["Trashed"] = "trashed";
78593
- ActionTag2["Recovered"] = "recovered";
78594
- ActionTag2["Restored"] = "restored";
78595
- return ActionTag2;
78596
- })(ActionTag || {});
78597
- var FileAction = /* @__PURE__ */ ((FileAction2) => {
78598
- FileAction2["Trash"] = "trash";
78599
- FileAction2["Forget"] = "forget";
78600
- FileAction2["Destroy"] = "destroy";
78601
- return FileAction2;
78602
- })(FileAction || {});
78603
- var DownloadState = /* @__PURE__ */ ((DownloadState2) => {
78604
- DownloadState2["InProgress"] = "in-progress";
78605
- DownloadState2["Cancelled"] = "cancelled";
78606
- DownloadState2["Error"] = "error";
78607
- return DownloadState2;
78608
- })(DownloadState || {});
78609
- const ViewContext = React.createContext(void 0);
78610
- function ViewProvider({ children }) {
78611
- const [view, setView] = React.useState(ViewType.File);
78612
- const [actualItemView, setActualItemView] = React.useState(void 0);
78613
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
78614
- ViewContext.Provider,
78615
- {
78616
- value: {
78617
- view,
78618
- setView,
78619
- actualItemView,
78620
- setActualItemView
78621
- },
78622
- children
78623
- }
78624
- );
78625
- }
78626
- function useView() {
78627
- const context = React.useContext(ViewContext);
78628
- if (!context) {
78629
- throw new Error("useView must be used within a ViewProvider");
78630
- }
78631
- return context;
78632
- }
78633
78740
  function isRecord(value) {
78634
78741
  return Types.isStrictlyObject(value) && Object.values(value).every((v) => typeof v === "string");
78635
78742
  }
@@ -78900,10 +79007,10 @@ P?.name || "";
78900
79007
  const bytesEndpoint = "bytes";
78901
79008
  async function processDownload(bee, resources, options, requestOptions) {
78902
79009
  if (O$1) {
78903
- const { downloadNode } = await Promise.resolve().then(() => require("./download.node-C_IiKmHA.js"));
79010
+ const { downloadNode } = await Promise.resolve().then(() => require("./download.node-CGjezvzr.js"));
78904
79011
  return await downloadNode(bee, Object.values(resources), options, requestOptions);
78905
79012
  }
78906
- const { downloadBrowser } = await Promise.resolve().then(() => require("./download.browser-Bp7NWws0.js"));
79013
+ const { downloadBrowser } = await Promise.resolve().then(() => require("./download.browser-Dusbw9zM.js"));
78907
79014
  return await downloadBrowser(Object.values(resources), bee.url, bytesEndpoint, options, requestOptions);
78908
79015
  }
78909
79016
  class EventEmitterBase {
@@ -78960,7 +79067,7 @@ async function processUpload(bee, driveInfo, fileOptions, uploadOptions, request
78960
79067
  return processedOptions.file;
78961
79068
  }
78962
79069
  if (O$1) {
78963
- const { processUploadNode } = await Promise.resolve().then(() => require("./upload.node-DUSvlJwc.js"));
79070
+ const { processUploadNode } = await Promise.resolve().then(() => require("./upload.node-6Fo1eWIJ.js"));
78964
79071
  const nodeOptions = processedOptions.options;
78965
79072
  return processUploadNode(bee, driveInfo, nodeOptions, uploadOptions, requestOptions);
78966
79073
  }
@@ -79744,6 +79851,51 @@ const FILE_MANAGER_EVENTS = {
79744
79851
  const POLLING_TIMEOUT_MS = 9e4;
79745
79852
  const UPLOAD_POLLING_TIMEOUT_MS = 1e4;
79746
79853
  const POLLING_INTERVAL_MS = 2e3;
79854
+ var FileTransferType = /* @__PURE__ */ ((FileTransferType2) => {
79855
+ FileTransferType2["Upload"] = "upload";
79856
+ FileTransferType2["Download"] = "download";
79857
+ FileTransferType2["Update"] = "update";
79858
+ return FileTransferType2;
79859
+ })(FileTransferType || {});
79860
+ var TransferStatus = /* @__PURE__ */ ((TransferStatus2) => {
79861
+ TransferStatus2["Uploading"] = "uploading";
79862
+ TransferStatus2["Downloading"] = "downloading";
79863
+ TransferStatus2["Done"] = "done";
79864
+ TransferStatus2["Error"] = "error";
79865
+ TransferStatus2["Queued"] = "queued";
79866
+ TransferStatus2["Cancelled"] = "cancelled";
79867
+ return TransferStatus2;
79868
+ })(TransferStatus || {});
79869
+ var TransferBarColor = /* @__PURE__ */ ((TransferBarColor2) => {
79870
+ TransferBarColor2["Upload"] = "#22c55e";
79871
+ TransferBarColor2["Update"] = "#f59e0b";
79872
+ TransferBarColor2["Download"] = "#3b82f6";
79873
+ return TransferBarColor2;
79874
+ })(TransferBarColor || {});
79875
+ var ViewType = /* @__PURE__ */ ((ViewType2) => {
79876
+ ViewType2["File"] = "file";
79877
+ ViewType2["Trash"] = "trash";
79878
+ ViewType2["Expired"] = "expired";
79879
+ return ViewType2;
79880
+ })(ViewType || {});
79881
+ var ActionTag = /* @__PURE__ */ ((ActionTag2) => {
79882
+ ActionTag2["Trashed"] = "trashed";
79883
+ ActionTag2["Recovered"] = "recovered";
79884
+ ActionTag2["Restored"] = "restored";
79885
+ return ActionTag2;
79886
+ })(ActionTag || {});
79887
+ var FileAction = /* @__PURE__ */ ((FileAction2) => {
79888
+ FileAction2["Trash"] = "trash";
79889
+ FileAction2["Forget"] = "forget";
79890
+ FileAction2["Destroy"] = "destroy";
79891
+ return FileAction2;
79892
+ })(FileAction || {});
79893
+ var DownloadState = /* @__PURE__ */ ((DownloadState2) => {
79894
+ DownloadState2["InProgress"] = "in-progress";
79895
+ DownloadState2["Cancelled"] = "cancelled";
79896
+ DownloadState2["Error"] = "error";
79897
+ return DownloadState2;
79898
+ })(DownloadState || {});
79747
79899
  const getUsableStamps = async (bee) => {
79748
79900
  try {
79749
79901
  return (await bee.getPostageBatches()).filter((s2) => s2.usable).sort((a2, b2) => (a2.label || "").localeCompare(b2.label || ""));
@@ -81362,7 +81514,12 @@ function AdminStatusBar({
81362
81514
  const isBusy = loading || isUpgrading || isCreationInProgress;
81363
81515
  const blurCls = isBusy ? " is-loading" : "";
81364
81516
  const statusVerb = isCreationInProgress ? "Creating" : "Loading";
81365
- const statusText = statusVerb + " admin drive, please do not reload";
81517
+ const statusText = /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
81518
+ statusVerb,
81519
+ " admin drive — please do not reload the page.",
81520
+ /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
81521
+ "This may take a few minutes."
81522
+ ] });
81366
81523
  const renderModalsAndOverlays = () => {
81367
81524
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
81368
81525
  isUpgradeDriveModalOpen && actualStamp && adminDrive && /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -81446,6 +81603,83 @@ function ErrorModal({ label, onClick }) {
81446
81603
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fm-error-modal-button-container", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button2, { variant: "primary", label: "OK", width: 100, onClick }) })
81447
81604
  ] }) });
81448
81605
  }
81606
+ const Ctx = React.createContext(void 0);
81607
+ function SearchProvider({ children }) {
81608
+ const [query, _setQuery] = React.useState("");
81609
+ const [scope, setScope] = React.useState("all");
81610
+ const [includeActive, setIncludeActive] = React.useState(true);
81611
+ const [includeTrashed, setIncludeTrashed] = React.useState(true);
81612
+ const preSearchState = React.useRef(null);
81613
+ const inSearch = React.useRef(false);
81614
+ const setQuery = React.useCallback(
81615
+ (q) => {
81616
+ const trimmed = q.trim();
81617
+ if (!inSearch.current && trimmed.length > 0) {
81618
+ preSearchState.current = { scope, includeActive, includeTrashed };
81619
+ inSearch.current = true;
81620
+ }
81621
+ if (inSearch.current && trimmed.length === 0) {
81622
+ const prev2 = preSearchState.current;
81623
+ if (prev2) {
81624
+ setScope(prev2.scope);
81625
+ setIncludeActive(prev2.includeActive);
81626
+ setIncludeTrashed(prev2.includeTrashed);
81627
+ }
81628
+ preSearchState.current = null;
81629
+ inSearch.current = false;
81630
+ }
81631
+ _setQuery(q);
81632
+ },
81633
+ [scope, includeActive, includeTrashed]
81634
+ );
81635
+ const clear = React.useCallback(() => {
81636
+ setQuery("");
81637
+ }, [setQuery]);
81638
+ const value = React.useMemo(
81639
+ () => ({
81640
+ query,
81641
+ scope,
81642
+ includeActive,
81643
+ includeTrashed,
81644
+ setQuery,
81645
+ clear,
81646
+ setScope,
81647
+ setIncludeActive,
81648
+ setIncludeTrashed
81649
+ }),
81650
+ [query, scope, includeActive, includeTrashed, clear, setQuery]
81651
+ );
81652
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Ctx.Provider, { value, children });
81653
+ }
81654
+ function useSearch() {
81655
+ const v = React.useContext(Ctx);
81656
+ if (!v) throw new Error("useFMSearch must be used within SearchProvider");
81657
+ return v;
81658
+ }
81659
+ const ViewContext = React.createContext(void 0);
81660
+ function ViewProvider({ children }) {
81661
+ const [view, setView] = React.useState(ViewType.File);
81662
+ const [actualItemView, setActualItemView] = React.useState(void 0);
81663
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
81664
+ ViewContext.Provider,
81665
+ {
81666
+ value: {
81667
+ view,
81668
+ setView,
81669
+ actualItemView,
81670
+ setActualItemView
81671
+ },
81672
+ children
81673
+ }
81674
+ );
81675
+ }
81676
+ function useView() {
81677
+ const context = React.useContext(ViewContext);
81678
+ if (!context) {
81679
+ throw new Error("useView must be used within a ViewProvider");
81680
+ }
81681
+ return context;
81682
+ }
81449
81683
  class AbortManager {
81450
81684
  controllers = /* @__PURE__ */ new Map();
81451
81685
  create(key) {
@@ -81579,101 +81813,6 @@ async function performBulkFileOperation({
81579
81813
  const isPickerSupported = () => typeof window.showSaveFilePicker === "function";
81580
81814
  const isDirectoryPickerSupported = () => typeof window.showDirectoryPicker === "function";
81581
81815
  const isElementPickerSupported = (el) => typeof el.showPicker === "function";
81582
- const EXT_TO_MIME = {
81583
- mp4: "video/mp4",
81584
- webm: "video/webm",
81585
- ogv: "video/ogg",
81586
- mp3: "audio/mpeg",
81587
- m4a: "audio/mp4",
81588
- aac: "audio/aac",
81589
- wav: "audio/wav",
81590
- ogg: "audio/ogg",
81591
- png: "image/png",
81592
- jpg: "image/jpeg",
81593
- jpeg: "image/jpeg",
81594
- gif: "image/gif",
81595
- webp: "image/webp",
81596
- avif: "image/avif",
81597
- svg: "image/svg+xml",
81598
- pdf: "application/pdf",
81599
- txt: "text/plain",
81600
- md: "text/markdown",
81601
- json: "application/json",
81602
- csv: "text/csv",
81603
- html: "text/html",
81604
- htm: "text/html"
81605
- };
81606
- function getExtensionFromName(name) {
81607
- const ext = name.split(".").pop()?.toLowerCase() || "";
81608
- const hasExtension = name.includes(".") && ext && ext !== name;
81609
- return hasExtension ? ext : "";
81610
- }
81611
- function guessMime(name, mtdt) {
81612
- const md = mtdt?.mimeType || mtdt?.mime || mtdt?.["content-type"];
81613
- const ext = getExtensionFromName(name);
81614
- if (md) return { mime: md, ext };
81615
- const mime = EXT_TO_MIME[ext] || "application/octet-stream";
81616
- return { mime, ext };
81617
- }
81618
- const VIDEO_HTML = (u2, title) => `<html><head><meta charset="utf-8"/><title>${title}</title></head><body style="margin:0;background:#000">
81619
- <video controls autoplay style="width:100%;height:100%" src="${u2}"></video>
81620
- </body></html>`;
81621
- const AUDIO_HTML = (u2, title) => `<html><head><meta charset="utf-8"/><title>${title}</title></head><body>
81622
- <audio controls autoplay style="width:100%" src="${u2}"></audio>
81623
- </body></html>`;
81624
- const IMAGE_HTML = (u2, title) => `<html><head><meta charset="utf-8"/><title>${title}</title></head><body style="margin:0;background:#111;display:grid;place-items:center;min-height:100vh">
81625
- <img style="max-width:100%;max-height:100vh" src="${u2}" />
81626
- </body></html>`;
81627
- const VIEWERS = [
81628
- {
81629
- name: "video",
81630
- test: (m) => m.startsWith("video/"),
81631
- render: (w, url, mime, name) => {
81632
- w.document.write(VIDEO_HTML(url, name));
81633
- w.document.title = name;
81634
- }
81635
- },
81636
- {
81637
- name: "audio",
81638
- test: (m) => m.startsWith("audio/"),
81639
- render: (w, url, mime, name) => {
81640
- w.document.write(AUDIO_HTML(url, name));
81641
- w.document.title = name;
81642
- }
81643
- },
81644
- {
81645
- name: "image",
81646
- test: (m) => m.startsWith("image/"),
81647
- render: (w, url, mime, name) => {
81648
- w.document.write(IMAGE_HTML(url, name));
81649
- w.document.title = name;
81650
- }
81651
- },
81652
- {
81653
- name: "pdf",
81654
- test: (m) => m === "application/pdf",
81655
- render: (w, url, mime, name) => {
81656
- w.document.title = name;
81657
- w.location.href = url;
81658
- }
81659
- },
81660
- {
81661
- name: "html",
81662
- test: (m) => m === "text/html",
81663
- render: (w, url, mime, name) => {
81664
- w.document.title = name;
81665
- w.location.href = url;
81666
- }
81667
- },
81668
- {
81669
- name: "text-like",
81670
- test: (m) => m.startsWith("text/") || m === "application/json" || m === "text/markdown",
81671
- render: (w, url, mime, name) => {
81672
- w.document.title = name;
81673
- w.location.href = url;
81674
- }
81675
- }
81676
- ];
81677
81816
  const DefaultDownloadFolder = "downloads";
81678
81817
  const downloadAborts = new AbortManager();
81679
81818
  function createDownloadAbort(id2) {
@@ -82254,7 +82393,7 @@ function useDragAndDrop({ onFilesDropped }) {
82254
82393
  }
82255
82394
  function useFileFiltering(props) {
82256
82395
  const { files, currentDrive, view, isSearchMode, query, scope, includeActive, includeTrashed } = props;
82257
- const q = query.trim().toLowerCase();
82396
+ const q = query.trim().toLowerCase().normalize("NFC");
82258
82397
  const statusIncluded = React.useCallback(
82259
82398
  (fi) => {
82260
82399
  const trashed = isTrashed(fi);
@@ -82267,9 +82406,9 @@ function useFileFiltering(props) {
82267
82406
  const matchesQuery = React.useCallback(
82268
82407
  (fi) => {
82269
82408
  if (!q) return true;
82270
- const name = fi.name.toLowerCase();
82271
- const mime = (fi.customMetadata?.mime || "").toLowerCase();
82272
- const topic = String(fi.topic ?? "").toLowerCase();
82409
+ const name = fi.name.toLowerCase().normalize("NFC");
82410
+ const mime = (fi.customMetadata?.mime || "").toLowerCase().normalize("NFC");
82411
+ const topic = String(fi.topic ?? "").toLowerCase().normalize("NFC");
82273
82412
  return name.includes(q) || mime.includes(q) || topic.includes(q);
82274
82413
  },
82275
82414
  [q]
@@ -89200,7 +89339,11 @@ function Sidebar({ setErrorMessage, loading }) {
89200
89339
  );
89201
89340
  }) })
89202
89341
  ] }),
89203
- isDriveCreationInProgress && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fm-sidebar-drive-creation", children: "Creating drive, please do not reload" })
89342
+ isDriveCreationInProgress && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "fm-sidebar-drive-creation", children: [
89343
+ "Creating drive — please do not reload the page.",
89344
+ /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
89345
+ "This may take a few minutes."
89346
+ ] })
89204
89347
  ] });
89205
89348
  }
89206
89349
  var SupportedPlatforms = /* @__PURE__ */ ((SupportedPlatforms2) => {
@@ -89312,6 +89455,17 @@ function LoadingBlock() {
89312
89455
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fm-loading-subtitle", children: "Please wait a few seconds" })
89313
89456
  ] }) });
89314
89457
  }
89458
+ function ChainSyncingBlock() {
89459
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fm-main", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "fm-loading", "aria-live": "polite", children: [
89460
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fm-spinner", "aria-hidden": "true" }),
89461
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fm-loading-title", children: "Bee node is syncing…" }),
89462
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "fm-loading-subtitle", children: [
89463
+ "Your Bee node is still syncing the postage batch state from the chain.",
89464
+ /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
89465
+ "File Manager will be available once the sync is complete."
89466
+ ] })
89467
+ ] }) });
89468
+ }
89315
89469
  function ErrorModalBlock({ onClick, label }) {
89316
89470
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorModal, { label, onClick });
89317
89471
  }
@@ -89362,7 +89516,7 @@ function FileManagerPage() {
89362
89516
  const [isCreationInProgress, setIsCreationInProgress] = React.useState(false);
89363
89517
  const [connectionErrorDismissed, setConnectionErrorDismissed] = React.useState(false);
89364
89518
  const [cacheHelpUrl, setCacheHelpUrl] = React.useState(cacheClearUrls[BrowserPlatform.Chrome]);
89365
- const { status } = React.useContext(Context$7);
89519
+ const { status, chainState } = React.useContext(Context$7);
89366
89520
  const { fm, initDone, shallReset, adminDrive, initializationError, notifyPkSaved } = React.useContext(Context$3);
89367
89521
  React.useEffect(() => {
89368
89522
  isMountedRef.current = true;
@@ -89389,15 +89543,18 @@ function FileManagerPage() {
89389
89543
  }
89390
89544
  }, [isConnectionError]);
89391
89545
  const pageState = React.useMemo(() => {
89546
+ const isChainSyncing = chainState === null;
89392
89547
  if (!isBeeReady && !initDone) return "connecting";
89393
89548
  if (!hasPk) return "no-pk";
89394
89549
  if (!initDone) return "loading";
89395
89550
  if (shallReset && !resetAcknowledged) return "reset";
89396
89551
  if (initializationError && !shallReset) return "init-error";
89397
- if (showAdminErrorModal) return "admin-error";
89398
89552
  const hasAdminStamp = Boolean(fm?.adminStamp);
89399
89553
  const hasAdminDrive = Boolean(adminDrive);
89400
- if (!hasAdminStamp && !hasAdminDrive && !isCreationInProgress) return "initial";
89554
+ const setupIncomplete = !hasAdminStamp && !hasAdminDrive;
89555
+ if (setupIncomplete && isChainSyncing) return "chain-syncing";
89556
+ if (showAdminErrorModal) return "admin-error";
89557
+ if (setupIncomplete && !isCreationInProgress) return "initial";
89401
89558
  return "ready";
89402
89559
  }, [
89403
89560
  isBeeReady,
@@ -89409,7 +89566,8 @@ function FileManagerPage() {
89409
89566
  showAdminErrorModal,
89410
89567
  fm,
89411
89568
  adminDrive,
89412
- isCreationInProgress
89569
+ isCreationInProgress,
89570
+ chainState
89413
89571
  ]);
89414
89572
  const handlePrivateKeySaved = React.useCallback(() => {
89415
89573
  if (!isMountedRef.current) return;
@@ -89422,6 +89580,9 @@ function FileManagerPage() {
89422
89580
  if (pageState === "connecting" || pageState === "loading") {
89423
89581
  return /* @__PURE__ */ jsxRuntimeExports.jsx(LoadingBlock, {});
89424
89582
  }
89583
+ if (pageState === "chain-syncing") {
89584
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ChainSyncingBlock, {});
89585
+ }
89425
89586
  if (pageState === "no-pk") {
89426
89587
  return /* @__PURE__ */ jsxRuntimeExports.jsx(PrivateKeyModalBlock, { onSaved: handlePrivateKeySaved });
89427
89588
  }
@@ -89453,10 +89614,11 @@ function FileManagerPage() {
89453
89614
  );
89454
89615
  }
89455
89616
  if (pageState === "admin-error") {
89617
+ const adminErrorLabel = chainState === null ? "Your Bee node is still syncing the postage batch state from the chain. Please wait for the sync to complete and try again." : errorMessage || "Error creating Admin Drive. Please try again. Possible causes include insufficient xDAI balance or a lost connection to the RPC.";
89456
89618
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
89457
89619
  ErrorModalBlock,
89458
89620
  {
89459
- label: errorMessage || "Error creating Admin Drive. Please try again. Possible causes include insufficient xDAI balance or a lost connection to the RPC.",
89621
+ label: adminErrorLabel,
89460
89622
  onClick: () => {
89461
89623
  setAdminShowErrorModal(false);
89462
89624
  setErrorMessage("");
@@ -89543,11 +89705,17 @@ const useStyles$e = makeStyles()((theme2) => ({
89543
89705
  header: {
89544
89706
  backgroundColor: theme2.palette.background.paper,
89545
89707
  marginBottom: theme2.spacing(0.25),
89546
- borderLeft: `${theme2.spacing(0.25)}px solid rgba(0,0,0,0)`,
89547
- wordBreak: "break-word"
89708
+ borderLeft: `${theme2.spacing(0.25)} solid rgba(0,0,0,0)`,
89709
+ wordBreak: "break-word",
89710
+ "&:hover": {
89711
+ backgroundColor: theme2.palette.background.paper
89712
+ },
89713
+ "&:focus-within": {
89714
+ backgroundColor: theme2.palette.background.paper
89715
+ }
89548
89716
  },
89549
89717
  headerOpen: {
89550
- borderLeft: `${theme2.spacing(0.25)}px solid ${theme2.palette.primary.main}`
89718
+ borderLeft: `${theme2.spacing(0.25)} solid ${theme2.palette.primary.main}`
89551
89719
  },
89552
89720
  copyValue: {
89553
89721
  cursor: "pointer",
@@ -89601,72 +89769,74 @@ function ExpandableListItemInput({
89601
89769
  setInputValue(newValue);
89602
89770
  if (onChange) onChange(newValue);
89603
89771
  };
89604
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ListItemButton, { className: `${classes2.header} ${open2 ? classes2.headerOpen : ""}`, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { display: "flex", flexDirection: "column", width: "100%", children: [
89605
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { display: "flex", flexDirection: "row", alignItems: "center", width: "100%", children: [
89606
- label && /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { flex: 1, minWidth: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body1", className: classes2.unselectableLabel, component: "span", children: label }) }),
89607
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { flex: 3, display: "flex", alignItems: "center", justifyContent: "flex-end", minWidth: 0, gap: 1, children: [
89608
- !open2 && value && /* @__PURE__ */ jsxRuntimeExports.jsx(
89609
- Typography,
89772
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
89773
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ListItemButton, { className: `${classes2.header} ${open2 ? classes2.headerOpen : ""}`, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { display: "flex", flexDirection: "column", width: "100%", children: [
89774
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { display: "flex", flexDirection: "row", alignItems: "center", width: "100%", children: [
89775
+ label && /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { flex: 1, minWidth: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body1", className: classes2.unselectableLabel, component: "span", children: label }) }),
89776
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { flex: 3, display: "flex", alignItems: "center", justifyContent: "flex-end", minWidth: 0, gap: 1, children: [
89777
+ !open2 && value && /* @__PURE__ */ jsxRuntimeExports.jsx(
89778
+ Typography,
89779
+ {
89780
+ variant: "body2",
89781
+ component: "span",
89782
+ sx: { minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
89783
+ children: value
89784
+ }
89785
+ ),
89786
+ !expandedOnly && !locked2 && /* @__PURE__ */ jsxRuntimeExports.jsx(IconButton, { size: "small", className: classes2.copyValue, onClick: toggleOpen, children: open2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(Minus, { strokeWidth: 1 }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Edit, { strokeWidth: 1 }) })
89787
+ ] })
89788
+ ] }),
89789
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Collapse, { in: open2, timeout: "auto", unmountOnExit: true, children: [
89790
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { display: "flex", alignItems: "center", width: "100%", minWidth: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
89791
+ InputBase,
89610
89792
  {
89611
- variant: "body2",
89612
- component: "span",
89613
- sx: { minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
89614
- children: value
89793
+ value: inputValue,
89794
+ placeholder,
89795
+ onChange: handleChange,
89796
+ fullWidth: true,
89797
+ className: classes2.content,
89798
+ autoFocus: true,
89799
+ hidden: locked2,
89800
+ inputProps: {
89801
+ style: {
89802
+ width: "100%",
89803
+ minWidth: 220,
89804
+ whiteSpace: "nowrap",
89805
+ overflow: "hidden",
89806
+ textOverflow: "ellipsis"
89807
+ },
89808
+ maxLength: 512
89809
+ }
89615
89810
  }
89616
- ),
89617
- !expandedOnly && !locked2 && /* @__PURE__ */ jsxRuntimeExports.jsx(IconButton, { size: "small", className: classes2.copyValue, onClick: toggleOpen, children: open2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(Minus, { strokeWidth: 1 }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Edit, { strokeWidth: 1 }) })
89811
+ ) }),
89812
+ helperText && /* @__PURE__ */ jsxRuntimeExports.jsx(ExpandableListItemNote, { children: helperText })
89618
89813
  ] })
89619
- ] }),
89620
- /* @__PURE__ */ jsxRuntimeExports.jsx(Collapse, { in: open2, timeout: "auto", unmountOnExit: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { display: "flex", flexDirection: "column", width: "100%", children: [
89621
- /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { display: "flex", alignItems: "center", width: "100%", minWidth: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
89622
- InputBase,
89814
+ ] }) }),
89815
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Collapse, { in: open2, timeout: "auto", unmountOnExit: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mt: 2, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(ExpandableListItemActions, { children: [
89816
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
89817
+ SwarmButton,
89623
89818
  {
89624
- value: inputValue,
89625
- placeholder,
89626
- onChange: handleChange,
89627
- fullWidth: true,
89628
- className: classes2.content,
89629
- autoFocus: true,
89630
- hidden: locked2,
89631
- inputProps: {
89632
- style: {
89633
- width: "100%",
89634
- minWidth: 220,
89635
- whiteSpace: "nowrap",
89636
- overflow: "hidden",
89637
- textOverflow: "ellipsis"
89638
- },
89639
- maxLength: 512
89640
- }
89819
+ disabled: loading || inputValue === value || Boolean(confirmLabelDisabled) || inputValue === "" && value === void 0,
89820
+ loading,
89821
+ iconType: confirmIcon ?? Check,
89822
+ onClick: () => {
89823
+ onConfirm?.(inputValue.trim());
89824
+ },
89825
+ children: confirmLabel || "Save"
89641
89826
  }
89642
- ) }),
89643
- helperText && /* @__PURE__ */ jsxRuntimeExports.jsx(ExpandableListItemNote, { children: helperText }),
89644
- /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mt: 2, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(ExpandableListItemActions, { children: [
89645
- /* @__PURE__ */ jsxRuntimeExports.jsx(
89646
- SwarmButton,
89647
- {
89648
- disabled: loading || inputValue === value || Boolean(confirmLabelDisabled) || inputValue === "" && value === void 0,
89649
- loading,
89650
- iconType: confirmIcon ?? Check,
89651
- onClick: () => {
89652
- onConfirm?.(inputValue.trim());
89653
- },
89654
- children: confirmLabel || "Save"
89655
- }
89656
- ),
89657
- /* @__PURE__ */ jsxRuntimeExports.jsx(
89658
- SwarmButton,
89659
- {
89660
- disabled: loading || inputValue === value || inputValue === "",
89661
- iconType: X,
89662
- onClick: () => setInputValue(value || ""),
89663
- cancel: true,
89664
- children: "Cancel"
89665
- }
89666
- )
89667
- ] }) })
89668
- ] }) })
89669
- ] }) });
89827
+ ),
89828
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
89829
+ SwarmButton,
89830
+ {
89831
+ disabled: loading || inputValue === value || inputValue === "",
89832
+ iconType: X,
89833
+ onClick: () => setInputValue(value || ""),
89834
+ cancel: true,
89835
+ children: "Cancel"
89836
+ }
89837
+ )
89838
+ ] }) }) })
89839
+ ] });
89670
89840
  }
89671
89841
  function getPrettyDateString(date) {
89672
89842
  const string = date.toString();
@@ -89676,11 +89846,17 @@ const useStyles$d = makeStyles()((theme2) => ({
89676
89846
  header: {
89677
89847
  backgroundColor: theme2.palette.background.paper,
89678
89848
  marginBottom: theme2.spacing(0.25),
89679
- borderLeft: `${theme2.spacing(0.25)}px solid rgba(0,0,0,0)`,
89680
- wordBreak: "break-word"
89849
+ borderLeft: `${theme2.spacing(0.25)} solid rgba(0,0,0,0)`,
89850
+ wordBreak: "break-word",
89851
+ "&:hover": {
89852
+ backgroundColor: theme2.palette.background.paper
89853
+ },
89854
+ "&:focus-within": {
89855
+ backgroundColor: theme2.palette.background.paper
89856
+ }
89681
89857
  },
89682
89858
  headerOpen: {
89683
- borderLeft: `${theme2.spacing(0.25)}px solid ${theme2.palette.primary.main}`
89859
+ borderLeft: `${theme2.spacing(0.25)} solid ${theme2.palette.primary.main}`
89684
89860
  },
89685
89861
  openLinkIcon: {
89686
89862
  cursor: "pointer",
@@ -92330,14 +92506,17 @@ function StripedWrapper({ children }) {
92330
92506
  function AssetIcon({ icon }) {
92331
92507
  return /* @__PURE__ */ jsxRuntimeExports.jsx(StripedWrapper, { children: icon });
92332
92508
  }
92333
- const getPreviewElement = (previewUri, metadata) => {
92334
- if (metadata?.isVideo) {
92509
+ const getPreviewElement = (previewUri, metadata, type) => {
92510
+ const isVideoType = Boolean(type && /.*\.(mp4|webm|ogv)$/i.test(type));
92511
+ const isAudioType = Boolean(type && /.*\.(mp3|ogg|oga|wav|webm|m4a|aac|flac)$/i.test(type));
92512
+ const isImageType = Boolean(type && /.*\.(jpg|jpeg|png|gif|webp|svg|ico)$/i.test(type));
92513
+ if (metadata?.isVideo || isVideoType) {
92335
92514
  return /* @__PURE__ */ jsxRuntimeExports.jsx(FitVideo, { src: previewUri, maxWidth: "250px", maxHeight: "175px" });
92336
92515
  }
92337
- if (metadata?.isAudio) {
92516
+ if (metadata?.isAudio || isAudioType) {
92338
92517
  return /* @__PURE__ */ jsxRuntimeExports.jsx(FitAudio, { src: previewUri, maxWidth: "250px" });
92339
92518
  }
92340
- if (metadata?.isImage) {
92519
+ if (metadata?.isImage || isImageType) {
92341
92520
  return /* @__PURE__ */ jsxRuntimeExports.jsx(FitImage, { maxWidth: "250px", maxHeight: "175px", alt: "Upload Preview", src: previewUri });
92342
92521
  }
92343
92522
  if (metadata?.isWebsite) {
@@ -92351,11 +92530,17 @@ const getPreviewElement = (previewUri, metadata) => {
92351
92530
  const getType = (metadata) => {
92352
92531
  if (metadata?.isWebsite) return "Website";
92353
92532
  if (metadata?.type === "folder") return "Folder";
92354
- return metadata?.type;
92533
+ let metadataType = metadata?.type || "unknown";
92534
+ let typeFromExtension;
92535
+ if (metadataType === "unknown" && metadata?.name) {
92536
+ const { mime } = guessMime(metadata.name);
92537
+ typeFromExtension = mime === "application/octet-stream" ? "file" : mime;
92538
+ }
92539
+ return typeFromExtension || metadataType;
92355
92540
  };
92356
92541
  function AssetPreview({ metadata, previewUri }) {
92357
- const previewElement = React.useMemo(() => getPreviewElement(previewUri, metadata), [metadata, previewUri]);
92358
92542
  const type = React.useMemo(() => getType(metadata), [metadata]);
92543
+ const previewElement = React.useMemo(() => getPreviewElement(previewUri, metadata, type), [metadata, type, previewUri]);
92359
92544
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { mb: 4, children: [
92360
92545
  /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { bgcolor: "background.paper", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid, { container: true, direction: "row", children: [
92361
92546
  previewElement,
@@ -92500,13 +92685,13 @@ function Share() {
92500
92685
  const count = Object.keys(entries).length;
92501
92686
  const isVideo = Boolean(indexDocument2 && /.*\.(mp4|webm|ogv)$/i.test(indexDocument2));
92502
92687
  const isAudio = Boolean(indexDocument2 && /.*\.(mp3|ogg|oga|wav|webm|m4a|aac|flac)$/i.test(indexDocument2));
92503
- const isImage = Boolean(indexDocument2 && /.*\.(jpg|jpeg|png|gif|webp|svg)$/i.test(indexDocument2));
92688
+ const isImage = Boolean(indexDocument2 && /.*\.(jpg|jpeg|png|gif|webp|svg|ico)$/i.test(indexDocument2));
92504
92689
  if (isImage || isVideo || isAudio) {
92505
92690
  setPreview(`${apiUrl}/bzz/${hash2}`);
92506
92691
  }
92507
92692
  setMetadata({
92508
92693
  hash: hash2,
92509
- type: count > 1 ? "folder" : "unknown",
92694
+ type: count > 1 ? "folder" : getType(),
92510
92695
  name: indexDocument2 || hash2 || "",
92511
92696
  count,
92512
92697
  isWebsite: Boolean(indexDocument2 && /.*\.html?$/i.test(indexDocument2)),
@@ -92754,7 +92939,7 @@ function PostageStampAdvancedCreation({ onFinished }) {
92754
92939
  }
92755
92940
  }
92756
92941
  function getPrice(depth, amount) {
92757
- const hasInvalidInput = amount <= 0 || isNaN(depth) || depth < 17 || depth > 255;
92942
+ const hasInvalidInput = amount <= 0 || isNaN(depth) || depth < MIN_STAMP_DEPTH || depth > MAX_STAMP_DEPTH;
92758
92943
  if (hasInvalidInput) {
92759
92944
  return "-";
92760
92945
  }
@@ -92807,32 +92992,13 @@ function PostageStampAdvancedCreation({ onFinished }) {
92807
92992
  }
92808
92993
  setAmountInput(validAmountInput);
92809
92994
  }
92810
- function validateDepthInput(depthInput2) {
92811
- let validDepthInput = "0";
92812
- if (!depthInput2) {
92813
- setDepthError("Required field");
92814
- } else {
92815
- const depth = new BigNumber(depthInput2);
92816
- if (!depth.isInteger()) {
92817
- setDepthError("Depth must be an integer");
92818
- } else if (depth.isLessThan(17)) {
92819
- setDepthError("Minimal depth is 17");
92820
- } else if (depth.isGreaterThan(255)) {
92821
- setDepthError("Depth has to be at most 255");
92822
- } else {
92823
- setDepthError("");
92824
- validDepthInput = depthInput2;
92825
- }
92826
- }
92827
- setDepthInput(validDepthInput);
92828
- }
92829
92995
  function renderStampVolumesInfo() {
92830
92996
  const depth = parseInt(depthInput, 10);
92831
- if (depthError || isNaN(depth) || depth < 17 || depth > 255) {
92997
+ if (depthError || isNaN(depth) || depth < MIN_STAMP_DEPTH || depth > MAX_STAMP_DEPTH) {
92832
92998
  return "-";
92833
92999
  }
92834
93000
  const theoreticalMaximumVolume = getHumanReadableFileSize(getStampTheoreticalBytes(depth));
92835
- const effectiveVolume = getHumanReadableFileSize(getStampEffectiveBytes(depth));
93001
+ const effectiveVolume = getHumanReadableFileSize(getStampEffectiveBytes(depth, false, RedundancyLevel.OFF));
92836
93002
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid, { container: true, alignItems: "center", className: classes2.stampVolumeWrapper, children: [
92837
93003
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography, { children: [
92838
93004
  "Theoretical: ~",
@@ -92869,7 +93035,14 @@ function PostageStampAdvancedCreation({ onFinished }) {
92869
93035
  "."
92870
93036
  ] }) }),
92871
93037
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { mb: 2, children: [
92872
- /* @__PURE__ */ jsxRuntimeExports.jsx(SwarmTextInput, { name: "depth", label: "Depth", onChange: (event) => validateDepthInput(event.target.value) }),
93038
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
93039
+ SwarmTextInput,
93040
+ {
93041
+ name: "depth",
93042
+ label: "Depth",
93043
+ onChange: (event) => validateDepthInput(event.target.value, setDepthError, setDepthInput)
93044
+ }
93045
+ ),
92873
93046
  /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mt: 0.25, sx: { bgcolor: "#f6f6f6" }, p: 2, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid, { container: true, justifyContent: "space-between", alignItems: "center", children: [
92874
93047
  /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { children: "Corresponding file size" }),
92875
93048
  renderStampVolumesInfo()
@@ -92890,7 +93063,7 @@ function PostageStampAdvancedCreation({ onFinished }) {
92890
93063
  SwarmSelect,
92891
93064
  {
92892
93065
  label: "Immutable",
92893
- value: "No",
93066
+ value: immutable ? "Yes" : "No",
92894
93067
  onChange: (event) => setImmutable(event.target.value === "Yes"),
92895
93068
  options: [
92896
93069
  { value: "Yes", label: "Yes" },
@@ -93353,7 +93526,7 @@ const bzzABI = [
93353
93526
  }
93354
93527
  ];
93355
93528
  async function getNetworkChainId(url) {
93356
- const provider = newGnosisProvider(url);
93529
+ const provider = newGnosisProviderForValidation(url);
93357
93530
  const network = await provider.getNetwork();
93358
93531
  return network.chainId;
93359
93532
  }
@@ -121948,11 +122121,16 @@ function PostageStampStandardCreation({ onFinished }) {
121948
122121
  const { classes: classes2 } = useStyles$6();
121949
122122
  const { refresh } = React.useContext(Context$5);
121950
122123
  const { beeApi } = React.useContext(Context$8);
122124
+ const { chainState } = React.useContext(Context$7);
121951
122125
  const [depthInput, setDepthInput] = React.useState(getDepthForSize(Size.fromGigabytes(4)));
121952
122126
  const [amountInput, setAmountInput] = React.useState(getAmountForDuration(Duration.fromDays(30), 26500, 5));
121953
122127
  const [labelInput, setLabelInput] = React.useState("");
121954
122128
  const [submitting, setSubmitting] = React.useState(false);
121955
122129
  const [buttonValue, setButtonValue] = React.useState(4);
122130
+ const [depthError, setDepthError] = React.useState("");
122131
+ const [sliderValue, setSliderValue] = React.useState(30);
122132
+ const pricePerBlockDefault = 24e3;
122133
+ const currentPrice = chainState?.currentPrice ?? pricePerBlockDefault;
121956
122134
  const getBatchValue = (value) => {
121957
122135
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { sx: { flex: 1 }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
121958
122136
  Button$1,
@@ -121972,15 +122150,15 @@ function PostageStampStandardCreation({ onFinished }) {
121972
122150
  if (typeof newValue !== "number") {
121973
122151
  return;
121974
122152
  }
121975
- const amountValue = getAmountForDuration(Duration.fromDays(newValue), 26500, 5);
122153
+ const amountValue = getAmountForDuration(Duration.fromDays(newValue), currentPrice, 5);
121976
122154
  setAmountInput(amountValue);
122155
+ setSliderValue(newValue);
121977
122156
  }
121978
122157
  const { enqueueSnackbar } = useSnackbar();
121979
122158
  function getTtl(amount) {
121980
- const pricePerBlock = 24e3;
121981
122159
  return `${secondsToTimeString(
121982
- getStampDuration(amount, pricePerBlock, 5).toSeconds()
121983
- )} (with price of ${pricePerBlock} PLUR per block)`;
122160
+ getStampDuration(amount, currentPrice, 5).toSeconds()
122161
+ )} (with price of ${currentPrice} PLUR per block)`;
121984
122162
  }
121985
122163
  function getPrice(depth, amount) {
121986
122164
  const price = getStampCost(depth, amount);
@@ -121995,14 +122173,14 @@ function PostageStampStandardCreation({ onFinished }) {
121995
122173
  return;
121996
122174
  }
121997
122175
  setSubmitting(true);
121998
- const amount = BigInt(amountInput);
121999
- const depth = depthInput;
122000
- const options = {
122001
- waitForUsable: false,
122002
- label: labelInput || void 0,
122003
- immutableFlag: true
122004
- };
122005
- await beeApi.createPostageBatch(amount.toString(), depth, options);
122176
+ await beeApi.buyStorage(
122177
+ Size.fromGigabytes(buttonValue),
122178
+ Duration.fromDays(sliderValue),
122179
+ { label: labelInput, immutableFlag: true },
122180
+ void 0,
122181
+ false,
122182
+ RedundancyLevel.OFF
122183
+ );
122006
122184
  await refresh();
122007
122185
  onFinished();
122008
122186
  } catch (e2) {
@@ -122013,8 +122191,8 @@ function PostageStampStandardCreation({ onFinished }) {
122013
122191
  }
122014
122192
  function handleBatchSize(gigabytes) {
122015
122193
  setButtonValue(gigabytes);
122016
- const capacity = getDepthForSize(Size.fromGigabytes(gigabytes));
122017
- setDepthInput(capacity);
122194
+ const capacity = getDepthForSize(Size.fromGigabytes(gigabytes), false, RedundancyLevel.OFF);
122195
+ validateDepthInput(String(capacity), setDepthError, (v) => setDepthInput(Number(v)));
122018
122196
  }
122019
122197
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
122020
122198
  /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mb: 4, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography, { children: [
@@ -122033,11 +122211,14 @@ function PostageStampStandardCreation({ onFinished }) {
122033
122211
  /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mb: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "h2", children: "Batch name" }) }),
122034
122212
  /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mb: 2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(SwarmTextInput, { name: "depth", label: "Label", onChange: (e2) => setLabelInput(e2.target.value) }) }),
122035
122213
  /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mb: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "h2", children: "Batch size" }) }),
122036
- /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mb: 2, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { sx: { display: "flex", gap: 1 }, children: [
122037
- getBatchValue(4),
122038
- getBatchValue(32),
122039
- getBatchValue(256)
122040
- ] }) }),
122214
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { mb: 2, children: [
122215
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { sx: { display: "flex", gap: 1 }, children: [
122216
+ getBatchValue(4),
122217
+ getBatchValue(32),
122218
+ getBatchValue(256)
122219
+ ] }),
122220
+ depthError && /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { children: depthError })
122221
+ ] }),
122041
122222
  /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mb: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "h2", children: "Data persistence" }) }),
122042
122223
  /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mb: 2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
122043
122224
  Slider,
@@ -122055,9 +122236,14 @@ function PostageStampStandardCreation({ onFinished }) {
122055
122236
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { mb: 2, children: [
122056
122237
  /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mt: 0.25, sx: { bgcolor: "#f6f6f6" }, p: 2, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid, { container: true, justifyContent: "space-between", children: [
122057
122238
  /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { children: "Corresponding TTL (Time to live)" }),
122239
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { children: amountInput ? getTtl(amountInput) : "-" }),
122058
122240
  /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { children: amountInput ? getTtl(amountInput) : "-" })
122059
122241
  ] }) }),
122060
- /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { display: "flex", justifyContent: "right", mt: 0.5, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { style: { fontSize: "10px", color: "rgba(0, 0, 0, 0.26)" }, children: "Current price of 24000 PLUR per block" }) })
122242
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { display: "flex", justifyContent: "right", mt: 0.5, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography, { style: { fontSize: "10px", color: "rgba(0, 0, 0, 0.26)" }, children: [
122243
+ "Current price of ",
122244
+ currentPrice,
122245
+ " PLUR per block"
122246
+ ] }) })
122061
122247
  ] }),
122062
122248
  /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mb: 4, sx: { bgcolor: "#fcf2e8" }, p: 2, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid, { container: true, justifyContent: "space-between", children: [
122063
122249
  /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { children: "Indicative Price" }),
@@ -122067,7 +122253,7 @@ function PostageStampStandardCreation({ onFinished }) {
122067
122253
  /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
122068
122254
  SwarmButton,
122069
122255
  {
122070
- disabled: submitting || !depthInput || !amountInput,
122256
+ disabled: submitting || !depthInput || Boolean(depthError) || !amountInput,
122071
122257
  onClick: submit,
122072
122258
  iconType: Check,
122073
122259
  loading: submitting,
@@ -159484,7 +159670,7 @@ function SideBar() {
159484
159670
  label: "File Manager",
159485
159671
  path: ROUTES.FILEMANAGER,
159486
159672
  icon: FileManagerIcon,
159487
- pathMatcherSubstring: "/filemanager/"
159673
+ pathMatcherSubstring: "/filemanager"
159488
159674
  },
159489
159675
  {
159490
159676
  label: "Account",