@banou/ripple 0.0.26 → 0.0.27

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 (4) hide show
  1. package/fkn.json +1 -1
  2. package/index.js +612 -589
  3. package/package.json +1 -1
  4. package/sw.js +1 -1
package/index.js CHANGED
@@ -36311,7 +36311,24 @@ var HH = "m", UH = "magnet", WH = [
36311
36311
  } catch {
36312
36312
  return !0;
36313
36313
  }
36314
- }, qW = {
36314
+ }, qW = "ripple:player-volume", JW = (e) => {
36315
+ try {
36316
+ let { volume: t, muted: n } = JSON.parse(localStorage.getItem("ripple:player-volume") ?? "{}");
36317
+ typeof t == "number" && typeof n == "boolean" && Object.assign(e, {
36318
+ volume: t,
36319
+ muted: n
36320
+ });
36321
+ } catch {}
36322
+ let t = () => {
36323
+ if (navigator.userActivation.hasBeenActive) try {
36324
+ localStorage.setItem(qW, JSON.stringify({
36325
+ volume: e.volume,
36326
+ muted: e.muted
36327
+ }));
36328
+ } catch {}
36329
+ };
36330
+ return e.addEventListener("volumechange", t), () => e.removeEventListener("volumechange", t);
36331
+ }, YW = {
36315
36332
  downloading: "Downloading",
36316
36333
  seeding: "Seeding",
36317
36334
  paused: "Paused",
@@ -36322,7 +36339,7 @@ var HH = "m", UH = "magnet", WH = [
36322
36339
  retrying: "Retrying",
36323
36340
  checking: "Checking",
36324
36341
  starting: "Starting"
36325
- }, JW = (e) => `${bS(e, !0)}/s`, YW = (e, t = Date.now()) => {
36342
+ }, XW = (e) => `${bS(e, !0)}/s`, ZW = (e, t = Date.now()) => {
36326
36343
  if (!e) return "-";
36327
36344
  let n = (t - e) / 864e5;
36328
36345
  if (n < 1) return Math.max(1, Math.round(n * 24)) + "h";
@@ -36336,10 +36353,10 @@ var HH = "m", UH = "magnet", WH = [
36336
36353
  month: "short",
36337
36354
  day: "numeric"
36338
36355
  });
36339
- }, XW = (e, t) => {
36356
+ }, QW = (e, t) => {
36340
36357
  let n = t.reason === "stalled" ? e.peers > 0 ? "Peers stopped sending data" : "Not connected to any peers" : "Stopped unexpectedly";
36341
36358
  return `${t.message ?? n} · ${t.retryInSeconds <= 0 ? "retrying now" : t.retryInSeconds < 60 ? `retrying in ${t.retryInSeconds}s` : `retrying in ${Math.ceil(t.retryInSeconds / 60)}m`}`;
36342
- }, ZW = St`
36359
+ }, $W = St`
36343
36360
  height: 100%;
36344
36361
  width: 100%;
36345
36362
  overflow: hidden;
@@ -36616,7 +36633,7 @@ var HH = "m", UH = "magnet", WH = [
36616
36633
  }
36617
36634
  }
36618
36635
  }
36619
- `, QW = () => {
36636
+ `, eG = () => {
36620
36637
  let [e] = Ra(), { fileIndex: t } = Object.fromEntries(e.entries()), n = (0, v.useMemo)(() => hU(e), [e]), r = (0, v.useMemo)(() => {
36621
36638
  let e = Number(t);
36622
36639
  return Number.isSafeInteger(e) && e >= 0 ? e : 0;
@@ -36625,38 +36642,43 @@ var HH = "m", UH = "magnet", WH = [
36625
36642
  try {
36626
36643
  localStorage.setItem(GW, e ? "1" : "0");
36627
36644
  } catch {}
36628
- }, p = OB(DB()), m = i?.files?.files[r], h = m?.size, g = m?.path.split("/").pop() || void 0, _ = (0, v.useMemo)(() => new URL(window.location.toString()).origin, []), y = (0, v.useMemo)(() => new URL("/", _).toString(), [_]), b = (0, v.useMemo)(() => new URL("/libav-worker.js", _).toString(), [_]), x = (0, v.useMemo)(() => new URL("/jassub/", _).toString(), [_]), S = (0, v.useMemo)(() => new URL("worker.js", x).toString(), [x]), C = (0, v.useMemo)(() => new URL("jassub-worker-modern.wasm", x).toString(), [x]), w = (0, v.useMemo)(() => new URL("jassub-worker.wasm", x).toString(), [x]), T = (0, v.useMemo)(() => new URL("default.woff2", x).toString(), [x]), E = i?.status, D = {
36629
- peers: E?.numPeers ?? 0,
36645
+ }, p = (0, v.useRef)(null);
36646
+ (0, v.useEffect)(() => {
36647
+ let e = p.current?.querySelector("video");
36648
+ return e ? JW(e) : void 0;
36649
+ }, []);
36650
+ let m = OB(DB()), h = i?.files?.files[r], g = h?.size, _ = h?.path.split("/").pop() || void 0, y = (0, v.useMemo)(() => new URL(window.location.toString()).origin, []), b = (0, v.useMemo)(() => new URL("/", y).toString(), [y]), x = (0, v.useMemo)(() => new URL("/libav-worker.js", y).toString(), [y]), S = (0, v.useMemo)(() => new URL("/jassub/", y).toString(), [y]), C = (0, v.useMemo)(() => new URL("worker.js", S).toString(), [S]), w = (0, v.useMemo)(() => new URL("jassub-worker-modern.wasm", S).toString(), [S]), T = (0, v.useMemo)(() => new URL("jassub-worker.wasm", S).toString(), [S]), E = (0, v.useMemo)(() => new URL("default.woff2", S).toString(), [S]), D = i?.status, O = {
36651
+ peers: D?.numPeers ?? 0,
36630
36652
  downloadSpeed: i?.displayDownloadRate ?? 0,
36631
- uploadSpeed: E?.uploadRate ?? 0
36632
- }, O = !!i?.files, k = i?.status?.totalDone ?? 0, A = a ?? (o ? "Out of storage space. Remove a download in Ripple to free room." : null) ?? (O ? null : "Loading metadata…"), j = (0, v.useMemo)(() => xS(i, r).map(([e, t]) => ({
36653
+ uploadSpeed: D?.uploadRate ?? 0
36654
+ }, k = !!i?.files, A = i?.status?.totalDone ?? 0, j = a ?? (o ? "Out of storage space. Remove a download in Ripple to free room." : null) ?? (k ? null : "Loading metadata…"), M = (0, v.useMemo)(() => xS(i, r).map(([e, t]) => ({
36633
36655
  startByteOffset: e,
36634
36656
  endByteOffset: t
36635
- })), [i, r]), M = h ? {
36657
+ })), [i, r]), N = g ? {
36636
36658
  read: s,
36637
- size: h
36638
- } : {}, N = i ? qW[pB(i)] : null, P = (0, v.useMemo)(() => {
36659
+ size: g
36660
+ } : {}, P = i ? YW[pB(i)] : null, F = (0, v.useMemo)(() => {
36639
36661
  let e = n ? SS(n) : null;
36640
- return e ? new URL(Ya(Ga.HOME, { torrent: e }), _).toString() : null;
36641
- }, [n, _]), F = (0, v.useMemo)(() => n ? new URL(`${Ja(Ga.DOWNLOAD)}?${new URLSearchParams(e).toString()}`, _).toString() : null, [
36662
+ return e ? new URL(Ya(Ga.HOME, { torrent: e }), y).toString() : null;
36663
+ }, [n, y]), I = (0, v.useMemo)(() => n ? new URL(`${Ja(Ga.DOWNLOAD)}?${new URLSearchParams(e).toString()}`, y).toString() : null, [
36642
36664
  n,
36643
36665
  e,
36644
- _
36645
- ]), I = /* @__PURE__ */ G("div", {
36666
+ y
36667
+ ]), L = /* @__PURE__ */ G("div", {
36646
36668
  className: "ripple-overlay-content",
36647
36669
  children: [
36648
36670
  /* @__PURE__ */ W("div", {
36649
36671
  className: "file-name",
36650
- children: g
36672
+ children: _
36651
36673
  }),
36652
36674
  /* @__PURE__ */ G("div", {
36653
36675
  className: "player-links",
36654
- children: [P && /* @__PURE__ */ W(NB, {
36676
+ children: [F && /* @__PURE__ */ W(NB, {
36655
36677
  id: "open-in-ripple",
36656
36678
  tooltipPlace: "bottom-end",
36657
36679
  text: /* @__PURE__ */ W("a", {
36658
36680
  className: "item link",
36659
- href: P,
36681
+ href: F,
36660
36682
  target: "_blank",
36661
36683
  rel: "noopener noreferrer",
36662
36684
  "data-testid": "open-in-ripple",
@@ -36664,71 +36686,71 @@ var HH = "m", UH = "magnet", WH = [
36664
36686
  children: /* @__PURE__ */ W(So, {})
36665
36687
  }),
36666
36688
  toolTipText: /* @__PURE__ */ W("span", { children: "Open this torrent in Ripple" })
36667
- }), F && /* @__PURE__ */ W(NB, {
36689
+ }), I && /* @__PURE__ */ W(NB, {
36668
36690
  id: "open-download-page",
36669
36691
  tooltipPlace: "bottom-end",
36670
36692
  text: /* @__PURE__ */ W("a", {
36671
36693
  className: "item link",
36672
- href: F,
36694
+ href: I,
36673
36695
  target: "_blank",
36674
36696
  rel: "noopener noreferrer",
36675
36697
  "data-testid": "open-download-page",
36676
- "aria-label": `Download ${g ?? "this torrent"}`,
36698
+ "aria-label": `Download ${_ ?? "this torrent"}`,
36677
36699
  children: /* @__PURE__ */ W(bo, {})
36678
36700
  }),
36679
- toolTipText: /* @__PURE__ */ G("span", { children: ["Download ", g ?? "this torrent"] })
36701
+ toolTipText: /* @__PURE__ */ G("span", { children: ["Download ", _ ?? "this torrent"] })
36680
36702
  })]
36681
36703
  }),
36682
- A ? /* @__PURE__ */ W("div", {
36704
+ j ? /* @__PURE__ */ W("div", {
36683
36705
  className: "loading-information",
36684
- children: A
36706
+ children: j
36685
36707
  }) : /* @__PURE__ */ G("div", {
36686
36708
  className: "downloaded",
36687
- children: ["Downloaded ", bS(k)]
36709
+ children: ["Downloaded ", bS(A)]
36688
36710
  }),
36689
36711
  /* @__PURE__ */ G("div", {
36690
36712
  className: "media-information",
36691
36713
  "data-testid": "media-information",
36692
36714
  children: [
36693
- N && /* @__PURE__ */ W(NB, {
36715
+ P && /* @__PURE__ */ W(NB, {
36694
36716
  id: "torrent-state",
36695
36717
  tooltipPlace: "bottom-end",
36696
36718
  text: /* @__PURE__ */ G("div", {
36697
36719
  className: "item state",
36698
36720
  "data-testid": "torrent-state",
36699
- children: [/* @__PURE__ */ W(so, {}), /* @__PURE__ */ W("span", { children: N })]
36721
+ children: [/* @__PURE__ */ W(so, {}), /* @__PURE__ */ W("span", { children: P })]
36700
36722
  }),
36701
- toolTipText: /* @__PURE__ */ G("span", { children: ["Torrent: ", N] })
36723
+ toolTipText: /* @__PURE__ */ G("span", { children: ["Torrent: ", P] })
36702
36724
  }),
36703
- p && /* @__PURE__ */ W(NB, {
36725
+ m && /* @__PURE__ */ W(NB, {
36704
36726
  id: "vpn",
36705
36727
  tooltipPlace: "bottom-end",
36706
36728
  text: /* @__PURE__ */ G("div", {
36707
36729
  className: "item vpn",
36708
- "data-state": p.state,
36709
- children: [/* @__PURE__ */ W(Ro, {}), /* @__PURE__ */ G("span", { children: ["VPN ", p.label] })]
36730
+ "data-state": m.state,
36731
+ children: [/* @__PURE__ */ W(Ro, {}), /* @__PURE__ */ G("span", { children: ["VPN ", m.label] })]
36710
36732
  }),
36711
- toolTipText: /* @__PURE__ */ G("span", { children: ["VPN: ", p.label] })
36733
+ toolTipText: /* @__PURE__ */ G("span", { children: ["VPN: ", m.label] })
36712
36734
  }),
36713
36735
  /* @__PURE__ */ W(NB, {
36714
36736
  id: "peers",
36715
36737
  tooltipPlace: "bottom-end",
36716
36738
  text: /* @__PURE__ */ G("div", {
36717
36739
  className: "item",
36718
- children: [/* @__PURE__ */ W(Vo, {}), /* @__PURE__ */ W("span", { children: D.peers })]
36740
+ children: [/* @__PURE__ */ W(Vo, {}), /* @__PURE__ */ W("span", { children: O.peers })]
36719
36741
  }),
36720
- toolTipText: /* @__PURE__ */ G("span", { children: ["Peers: ", D.peers] })
36742
+ toolTipText: /* @__PURE__ */ G("span", { children: ["Peers: ", O.peers] })
36721
36743
  }),
36722
36744
  /* @__PURE__ */ W(NB, {
36723
36745
  id: "download-speed",
36724
36746
  tooltipPlace: "bottom-end",
36725
36747
  text: /* @__PURE__ */ G("div", {
36726
36748
  className: "item",
36727
- children: [/* @__PURE__ */ W(co, {}), /* @__PURE__ */ G("span", { children: [bS(D.downloadSpeed, !0), "/s"] })]
36749
+ children: [/* @__PURE__ */ W(co, {}), /* @__PURE__ */ G("span", { children: [bS(O.downloadSpeed, !0), "/s"] })]
36728
36750
  }),
36729
36751
  toolTipText: /* @__PURE__ */ G("span", { children: [
36730
36752
  "Download speed: ",
36731
- bS(D.downloadSpeed),
36753
+ bS(O.downloadSpeed),
36732
36754
  "/s"
36733
36755
  ] })
36734
36756
  }),
@@ -36737,11 +36759,11 @@ var HH = "m", UH = "magnet", WH = [
36737
36759
  tooltipPlace: "bottom-end",
36738
36760
  text: /* @__PURE__ */ G("div", {
36739
36761
  className: "item",
36740
- children: [/* @__PURE__ */ W(lo, {}), /* @__PURE__ */ G("span", { children: [bS(D.uploadSpeed, !0), "/s"] })]
36762
+ children: [/* @__PURE__ */ W(lo, {}), /* @__PURE__ */ G("span", { children: [bS(O.uploadSpeed, !0), "/s"] })]
36741
36763
  }),
36742
36764
  toolTipText: /* @__PURE__ */ G("span", { children: [
36743
36765
  "Upload speed: ",
36744
- bS(D.uploadSpeed),
36766
+ bS(O.uploadSpeed),
36745
36767
  "/s"
36746
36768
  ] })
36747
36769
  })
@@ -36750,43 +36772,44 @@ var HH = "m", UH = "magnet", WH = [
36750
36772
  ]
36751
36773
  });
36752
36774
  return /* @__PURE__ */ W("div", {
36753
- css: ZW,
36775
+ css: $W,
36776
+ ref: p,
36754
36777
  children: /* @__PURE__ */ W(qx, {
36755
- ...M,
36778
+ ...N,
36756
36779
  expose: !0,
36757
- publicPath: y,
36758
- libavWorkerUrl: b,
36759
- jassubWorkerUrl: S,
36760
- jassubWasmUrl: C,
36761
- jassubLegacyWasmUrl: w,
36762
- defaultFontUrl: T,
36780
+ publicPath: b,
36781
+ libavWorkerUrl: x,
36782
+ jassubWorkerUrl: C,
36783
+ jassubWasmUrl: w,
36784
+ jassubLegacyWasmUrl: T,
36785
+ defaultFontUrl: E,
36763
36786
  normalizerWorkletUrl: Jx,
36764
36787
  normalizeVolume: u,
36765
36788
  onNormalizeVolumeChange: f,
36766
36789
  autoplay: !0,
36767
- overlay: I,
36768
- downloadedRanges: j,
36790
+ overlay: L,
36791
+ downloadedRanges: M,
36769
36792
  thumbnailRead: c,
36770
36793
  onSeek: (e) => {
36771
- h && l(e * h);
36794
+ g && l(e * g);
36772
36795
  }
36773
36796
  })
36774
36797
  });
36775
- }, $W = ({ mode: e = "watch" } = {}) => {
36798
+ }, tG = ({ mode: e = "watch" } = {}) => {
36776
36799
  let [t] = Ra(), n = (0, v.useMemo)(() => hU(t), [t]), r = (0, v.useMemo)(() => BW(t.get("files"), t.get("fileIndex")), [t]);
36777
36800
  return e === "download" ? /* @__PURE__ */ W(WW, {
36778
36801
  magnet: n,
36779
36802
  selection: r
36780
- }) : /* @__PURE__ */ W(QW, {});
36781
- }, eG = () => {
36803
+ }) : /* @__PURE__ */ W(eG, {});
36804
+ }, nG = () => {
36782
36805
  if (typeof window > "u") return !1;
36783
36806
  try {
36784
36807
  return window.top !== window.self;
36785
36808
  } catch {
36786
36809
  return !0;
36787
36810
  }
36788
- }, tG = "ripple:folder", nG = () => typeof window < "u" && "showDirectoryPicker" in window && !eG(), rG = async () => {
36789
- if (!nG()) return;
36811
+ }, rG = "ripple:folder", iG = () => typeof window < "u" && "showDirectoryPicker" in window && !nG(), aG = async () => {
36812
+ if (!iG()) return;
36790
36813
  let e = window.showDirectoryPicker;
36791
36814
  return e({
36792
36815
  id: "ripple-downloads",
@@ -36794,38 +36817,38 @@ var HH = "m", UH = "magnet", WH = [
36794
36817
  }).catch((e) => {
36795
36818
  if (e?.name !== "AbortError") throw e;
36796
36819
  });
36797
- }, iG = async (e) => {
36820
+ }, oG = async (e) => {
36798
36821
  let { queryPermission: t } = e;
36799
36822
  return await t?.call(e, { mode: "readwrite" }) ?? "granted";
36800
- }, aG = async (e) => {
36801
- if (await iG(e) === "granted") return !0;
36823
+ }, sG = async (e) => {
36824
+ if (await oG(e) === "granted") return !0;
36802
36825
  let { requestPermission: t } = e;
36803
36826
  return await t?.call(e, { mode: "readwrite" }) === "granted";
36804
- }, oG = () => {
36827
+ }, cG = () => {
36805
36828
  let [e, t] = (0, v.useState)(null), [n, r] = (0, v.useState)(!1);
36806
36829
  (0, v.useEffect)(() => {
36807
36830
  (async () => {
36808
- let e = await MR(tG);
36809
- e && (t(e), r(await iG(e) === "granted"));
36831
+ let e = await MR(rG);
36832
+ e && (t(e), r(await oG(e) === "granted"));
36810
36833
  })();
36811
36834
  }, []);
36812
36835
  let i = (0, v.useCallback)(async () => {
36813
- let e = await rG();
36814
- return e ? (await NR(tG, e), t(e), r(!0), !0) : !1;
36836
+ let e = await aG();
36837
+ return e ? (await NR(rG, e), t(e), r(!0), !0) : !1;
36815
36838
  }, []), a = (0, v.useCallback)(async () => {
36816
- e && r(await aG(e));
36839
+ e && r(await sG(e));
36817
36840
  }, [e]), o = (0, v.useCallback)(async () => {
36818
- await PR(tG), t(null), r(!1);
36841
+ await PR(rG), t(null), r(!1);
36819
36842
  }, []);
36820
36843
  return {
36821
- supported: nG(),
36844
+ supported: iG(),
36822
36845
  folder: e,
36823
36846
  permitted: n,
36824
36847
  pick: i,
36825
36848
  allow: a,
36826
36849
  clear: o
36827
36850
  };
36828
- }, sG = (e) => {
36851
+ }, lG = (e) => {
36829
36852
  let [t, n] = (0, v.useState)(null);
36830
36853
  return (0, v.useEffect)(() => {
36831
36854
  if (!e) return;
@@ -36838,7 +36861,7 @@ var HH = "m", UH = "magnet", WH = [
36838
36861
  t = !0, window.clearInterval(i);
36839
36862
  };
36840
36863
  }, [e]), t;
36841
- }, cG = 3e4, lG = (e) => {
36864
+ }, uG = 3e4, dG = (e) => {
36842
36865
  let [t, n] = (0, v.useState)(null);
36843
36866
  return (0, v.useEffect)(() => {
36844
36867
  let e = !1, t = async () => {
@@ -36855,14 +36878,14 @@ var HH = "m", UH = "magnet", WH = [
36855
36878
  t();
36856
36879
  let r = window.setInterval(() => {
36857
36880
  t();
36858
- }, cG), i = () => {
36881
+ }, uG), i = () => {
36859
36882
  t();
36860
36883
  };
36861
36884
  return document.addEventListener("visibilitychange", i), () => {
36862
36885
  e = !0, window.clearInterval(r), document.removeEventListener("visibilitychange", i);
36863
36886
  };
36864
36887
  }, [e]), t;
36865
- }, uG = ({ supported: e, folderName: t, permitted: n, defaultLocation: r }) => e ? t ? n ? r === "folder" ? {
36888
+ }, fG = ({ supported: e, folderName: t, permitted: n, defaultLocation: r }) => e ? t ? n ? r === "folder" ? {
36866
36889
  kind: "settled",
36867
36890
  folderName: t
36868
36891
  } : {
@@ -36871,7 +36894,7 @@ var HH = "m", UH = "magnet", WH = [
36871
36894
  } : {
36872
36895
  kind: "allow",
36873
36896
  folderName: t
36874
- } : { kind: "choose" } : { kind: "none" }, dG = (e) => {
36897
+ } : { kind: "choose" } : { kind: "none" }, pG = (e) => {
36875
36898
  switch (e.kind) {
36876
36899
  case "none": return {
36877
36900
  detail: "Removing a torrent frees its files.",
@@ -36894,18 +36917,18 @@ var HH = "m", UH = "magnet", WH = [
36894
36917
  action: null
36895
36918
  };
36896
36919
  }
36897
- }, fG = {
36920
+ }, mG = {
36898
36921
  storage: UB,
36899
36922
  permissions: GB
36900
- }, pG = { name: "persistent-storage" }, mG = async (e) => e.storage.estimate().then(({ quota: e }) => e ?? null).catch(() => null), hG = async (e = fG) => {
36923
+ }, hG = { name: "persistent-storage" }, gG = async (e) => e.storage.estimate().then(({ quota: e }) => e ?? null).catch(() => null), _G = async (e = mG) => {
36901
36924
  try {
36902
- return (await e.permissions.query(pG)).state;
36925
+ return (await e.permissions.query(hG)).state;
36903
36926
  } catch {
36904
36927
  return "prompt";
36905
36928
  }
36906
- }, gG = async (e = fG) => {
36929
+ }, vG = async (e = mG) => {
36907
36930
  try {
36908
- let t = await hG(e), n = await e.storage.persisted();
36931
+ let t = await _G(e), n = await e.storage.persisted();
36909
36932
  if (n || t !== "granted") return {
36910
36933
  persisted: n,
36911
36934
  permission: t,
@@ -36924,14 +36947,14 @@ var HH = "m", UH = "magnet", WH = [
36924
36947
  silentlyPersisted: !1
36925
36948
  };
36926
36949
  }
36927
- }, _G = async (e = fG) => {
36950
+ }, yG = async (e = mG) => {
36928
36951
  try {
36929
- let t = await mG(e);
36952
+ let t = await gG(e);
36930
36953
  return {
36931
36954
  attempted: !0,
36932
36955
  granted: await e.storage.persist(),
36933
36956
  quotaBefore: t,
36934
- quotaAfter: await mG(e)
36957
+ quotaAfter: await gG(e)
36935
36958
  };
36936
36959
  } catch {
36937
36960
  return {
@@ -36941,7 +36964,7 @@ var HH = "m", UH = "magnet", WH = [
36941
36964
  quotaAfter: null
36942
36965
  };
36943
36966
  }
36944
- }, vG = {
36967
+ }, bG = {
36945
36968
  persisted: !1,
36946
36969
  permission: "prompt",
36947
36970
  attempted: !1,
@@ -36949,11 +36972,11 @@ var HH = "m", UH = "magnet", WH = [
36949
36972
  quotaBefore: null,
36950
36973
  quotaAfter: null,
36951
36974
  refreshKey: 0
36952
- }, yG = () => {
36953
- let [e, t] = (0, v.useState)(vG);
36975
+ }, xG = () => {
36976
+ let [e, t] = (0, v.useState)(bG);
36954
36977
  (0, v.useEffect)(() => {
36955
36978
  let e = !1;
36956
- return gG().then(({ persisted: n, permission: r, silentlyPersisted: i }) => {
36979
+ return vG().then(({ persisted: n, permission: r, silentlyPersisted: i }) => {
36957
36980
  e || t((e) => ({
36958
36981
  ...e,
36959
36982
  persisted: n,
@@ -36965,7 +36988,7 @@ var HH = "m", UH = "magnet", WH = [
36965
36988
  };
36966
36989
  }, []);
36967
36990
  let n = (0, v.useCallback)(async () => {
36968
- let e = await _G();
36991
+ let e = await yG();
36969
36992
  t((t) => {
36970
36993
  let n = e.quotaAfter !== null && e.quotaAfter !== e.quotaBefore, r = e.granted === !0;
36971
36994
  return {
@@ -36980,7 +37003,7 @@ var HH = "m", UH = "magnet", WH = [
36980
37003
  ...e,
36981
37004
  request: n
36982
37005
  };
36983
- }, bG = ({ persisted: e, permission: t, attempted: n, granted: r }) => e || t === "denied" ? {
37006
+ }, SG = ({ persisted: e, permission: t, attempted: n, granted: r }) => e || t === "denied" ? {
36984
37007
  kind: "none",
36985
37008
  action: null
36986
37009
  } : n && !r ? {
@@ -36989,8 +37012,8 @@ var HH = "m", UH = "magnet", WH = [
36989
37012
  } : {
36990
37013
  kind: "ask",
36991
37014
  action: "Ask for more room"
36992
- }, xG = (e) => {
36993
- let t = bG(e);
37015
+ }, CG = (e) => {
37016
+ let t = SG(e);
36994
37017
  return e.persisted ? {
36995
37018
  label: "Persistent",
36996
37019
  hint: null,
@@ -37012,8 +37035,8 @@ var HH = "m", UH = "magnet", WH = [
37012
37035
  on: !1,
37013
37036
  actionable: !0
37014
37037
  };
37015
- }, SG = ({ persist: e, onAsk: t }) => {
37016
- let n = (0, v.useRef)(!1), [r, i] = (0, v.useState)(!1), a = bG(e);
37038
+ }, wG = ({ persist: e, onAsk: t }) => {
37039
+ let n = (0, v.useRef)(!1), [r, i] = (0, v.useState)(!1), a = SG(e);
37017
37040
  return a.kind === "ask" ? /* @__PURE__ */ W("button", {
37018
37041
  type: "button",
37019
37042
  disabled: r,
@@ -37022,8 +37045,8 @@ var HH = "m", UH = "magnet", WH = [
37022
37045
  },
37023
37046
  children: a.action
37024
37047
  }) : null;
37025
- }, CG = ({ storage: e, relief: t, onAct: n, persist: r, onAskPersist: i }) => {
37026
- let a = dG(t);
37048
+ }, TG = ({ storage: e, relief: t, onAct: n, persist: r, onAskPersist: i }) => {
37049
+ let a = pG(t);
37027
37050
  return /* @__PURE__ */ G("div", {
37028
37051
  className: "storage-warning surface",
37029
37052
  role: "status",
@@ -37035,7 +37058,7 @@ var HH = "m", UH = "magnet", WH = [
37035
37058
  bS(e.limitBytes, !0),
37036
37059
  " used"
37037
37060
  ] }),
37038
- /* @__PURE__ */ W(SG, {
37061
+ /* @__PURE__ */ W(wG, {
37039
37062
  persist: r,
37040
37063
  onAsk: i
37041
37064
  }),
@@ -37047,44 +37070,44 @@ var HH = "m", UH = "magnet", WH = [
37047
37070
  })
37048
37071
  ]
37049
37072
  });
37050
- }, wG = 8388608, TG = 16384, EG = [
37073
+ }, EG = 8388608, DG = 16384, OG = [
37051
37074
  0,
37052
37075
  .25,
37053
37076
  .5,
37054
37077
  .75,
37055
37078
  1
37056
- ], DG = async (e, t) => {
37079
+ ], kG = async (e, t) => {
37057
37080
  let n = t.split("/").filter(Boolean), r = n.pop(), i = e;
37058
37081
  for (let e of n) i = await i.getDirectoryHandle(e, { create: !0 });
37059
37082
  return i.getFileHandle(r, { create: !0 });
37060
- }, OG = (e, t) => {
37083
+ }, AG = (e, t) => {
37061
37084
  if (e.length !== t.length) return !1;
37062
37085
  for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !1;
37063
37086
  return !0;
37064
- }, kG = (e, t = TG) => e <= 0 ? [] : e <= t * EG.length ? [{
37087
+ }, jG = (e, t = DG) => e <= 0 ? [] : e <= t * OG.length ? [{
37065
37088
  offset: 0,
37066
37089
  length: e
37067
- }] : [...new Set(EG.map((n) => Math.min(Math.max(0, Math.round((e - t) * n)), e - t)))].sort((e, t) => e - t).map((e) => ({
37090
+ }] : [...new Set(OG.map((n) => Math.min(Math.max(0, Math.round((e - t) * n)), e - t)))].sort((e, t) => e - t).map((e) => ({
37068
37091
  offset: e,
37069
37092
  length: t
37070
- })), AG = async (e, t, n, r, i) => {
37093
+ })), MG = async (e, t, n, r, i) => {
37071
37094
  let a = await r.getFile();
37072
37095
  if (a.size !== i) return !1;
37073
37096
  if (i === 0) return !0;
37074
- for (let { offset: r, length: o } of kG(i)) {
37097
+ for (let { offset: r, length: o } of jG(i)) {
37075
37098
  let [i, s] = await Promise.all([e.read(Number(t.id), n, r, o, !1), a.slice(r, r + o).arrayBuffer()]);
37076
- if (!OG(i, new Uint8Array(s))) return !1;
37099
+ if (!AG(i, new Uint8Array(s))) return !1;
37077
37100
  }
37078
37101
  return !0;
37079
- }, jG = async (e, t, n) => {
37102
+ }, NG = async (e, t, n) => {
37080
37103
  let r = 0;
37081
37104
  for (let i of uV(t.files)) {
37082
- let a = i.index, o = await DG(n, i.name);
37083
- if (await AG(e, t, a, o, i.size)) continue;
37105
+ let a = i.index, o = await kG(n, i.name);
37106
+ if (await MG(e, t, a, o, i.size)) continue;
37084
37107
  let s = await o.createWritable();
37085
37108
  try {
37086
- for (let n = 0; n < i.size; n += wG) {
37087
- let r = Math.min(wG, i.size - n), o = await e.read(Number(t.id), a, n, r);
37109
+ for (let n = 0; n < i.size; n += EG) {
37110
+ let r = Math.min(EG, i.size - n), o = await e.read(Number(t.id), a, n, r);
37088
37111
  await s.write(o);
37089
37112
  }
37090
37113
  await s.close(), r++;
@@ -37093,17 +37116,17 @@ var HH = "m", UH = "magnet", WH = [
37093
37116
  }
37094
37117
  }
37095
37118
  return r;
37096
- }, MG = /* @__PURE__ */ new Set([
37119
+ }, PG = /* @__PURE__ */ new Set([
37097
37120
  ".DS_Store",
37098
37121
  "Thumbs.db",
37099
37122
  "desktop.ini"
37100
- ]), NG = (e) => MG.has(e), PG = (e) => typeof e.getFile == "function" ? e.getFile() : Promise.resolve(e), FG = class extends Error {
37123
+ ]), FG = (e) => PG.has(e), IG = (e) => typeof e.getFile == "function" ? e.getFile() : Promise.resolve(e), LG = class extends Error {
37101
37124
  constructor() {
37102
37125
  super("reading the folder was cancelled"), this.name = "WalkCancelled";
37103
37126
  }
37104
- }, IG = async (e, { signal: t, onFound: n } = {}) => {
37127
+ }, RG = async (e, { signal: t, onFound: n } = {}) => {
37105
37128
  let r = [], i = [], a = !1, o = async (e, s) => {
37106
- if (t?.aborted) throw new FG();
37129
+ if (t?.aborted) throw new LG();
37107
37130
  if (a) return;
37108
37131
  if (s.length >= 16) {
37109
37132
  i.push(`${s.join("/")} (nested too deep)`);
@@ -37112,7 +37135,7 @@ var HH = "m", UH = "magnet", WH = [
37112
37135
  let c = e.entries;
37113
37136
  if (!c) throw Error("this browser cannot list a picked folder");
37114
37137
  for await (let [l, u] of c.call(e)) {
37115
- if (t?.aborted) throw new FG();
37138
+ if (t?.aborted) throw new LG();
37116
37139
  if (r.length >= 2e4) {
37117
37140
  a = !0;
37118
37141
  return;
@@ -37122,7 +37145,7 @@ var HH = "m", UH = "magnet", WH = [
37122
37145
  if (await o(u, e), a) return;
37123
37146
  continue;
37124
37147
  }
37125
- if (NG(l)) {
37148
+ if (FG(l)) {
37126
37149
  i.push(e.join("/"));
37127
37150
  continue;
37128
37151
  }
@@ -37144,21 +37167,21 @@ var HH = "m", UH = "magnet", WH = [
37144
37167
  skipped: i,
37145
37168
  truncated: a
37146
37169
  };
37147
- }, LG = async (e) => {
37148
- let t = await PG(e);
37170
+ }, zG = async (e) => {
37171
+ let t = await IG(e);
37149
37172
  return {
37150
37173
  path: [e.name],
37151
37174
  size: t.size,
37152
37175
  lastModified: t.lastModified,
37153
37176
  handle: e
37154
37177
  };
37155
- }, RG = async (e, t, n) => {
37156
- let r = await PG(e.handle);
37178
+ }, BG = async (e, t, n) => {
37179
+ let r = await IG(e.handle);
37157
37180
  return new Uint8Array(await r.slice(t, t + n).arrayBuffer());
37158
- }, zG = async (e) => {
37181
+ }, VG = async (e) => {
37159
37182
  let t = [];
37160
37183
  for (let n of e) {
37161
- let e = await PG(n.handle).catch(() => null);
37184
+ let e = await IG(n.handle).catch(() => null);
37162
37185
  if (!e) {
37163
37186
  t.push({
37164
37187
  path: n.path.join("/"),
@@ -37174,16 +37197,16 @@ var HH = "m", UH = "magnet", WH = [
37174
37197
  });
37175
37198
  }
37176
37199
  return t;
37177
- }, BG = "/native", VG = (e) => `${BG}/${e}`, HG = (e) => e === "/native" || !!e?.startsWith("/native/"), UG = "/source", WG = (e) => `${UG}/${e}`, GG = (e) => e === "/source" || !!e?.startsWith("/source/"), KG = "ripple:save-location", qG = (e) => e?.saveTo === "source" || e?.created === !0, JG = (e) => {
37178
- let t = e(KG);
37200
+ }, HG = "/native", UG = (e) => `${HG}/${e}`, WG = (e) => e === "/native" || !!e?.startsWith("/native/"), GG = "/source", KG = (e) => `${GG}/${e}`, qG = (e) => e === "/source" || !!e?.startsWith("/source/"), JG = "ripple:save-location", YG = (e) => e?.saveTo === "source" || e?.created === !0, XG = (e) => {
37201
+ let t = e(JG);
37179
37202
  return t === "browser" || t === "folder" ? t : "browser";
37180
- }, YG = (e, t) => e?.saveTo === "source" ? "source" : e?.saveTo === "browser" || e?.saveTo === "folder" ? e.saveTo : t, XG = (e) => GG(e) ? "source" : HG(e) ? "folder" : "browser", ZG = (e, t) => {
37203
+ }, ZG = (e, t) => e?.saveTo === "source" ? "source" : e?.saveTo === "browser" || e?.saveTo === "folder" ? e.saveTo : t, QG = (e) => qG(e) ? "source" : WG(e) ? "folder" : "browser", $G = (e, t) => {
37181
37204
  if (e === "source") {
37182
37205
  if (!t) throw Error("a source-backed torrent needs its infohash to name its save path");
37183
- return WG(t);
37206
+ return KG(t);
37184
37207
  }
37185
- return e === "folder" ? t ? VG(t) : "/dl" : bR(t);
37186
- }, QG = ({ current: e, intended: t, complete: n, folderReady: r }) => e === "source" || t === "source" || e === t ? {
37208
+ return e === "folder" ? t ? UG(t) : "/dl" : bR(t);
37209
+ }, eK = ({ current: e, intended: t, complete: n, folderReady: r }) => e === "source" || t === "source" || e === t ? {
37187
37210
  move: !1,
37188
37211
  reason: "settled"
37189
37212
  } : r ? t === "folder" && !n ? {
@@ -37195,28 +37218,28 @@ var HH = "m", UH = "magnet", WH = [
37195
37218
  } : {
37196
37219
  move: !1,
37197
37220
  reason: "no-folder"
37198
- }, $G = (e, t) => {
37221
+ }, tK = (e, t) => {
37199
37222
  if (e.move || e.reason === "settled") return null;
37200
37223
  let n = t ?? "your folder";
37201
37224
  return e.reason === "incomplete" ? `Moves to ${n} when it finishes` : `Waiting for access to ${n}`;
37202
- }, eK = async (e, t, n) => {
37225
+ }, nK = async (e, t, n) => {
37203
37226
  let r = e;
37204
37227
  for (let e of t.split("/").filter(Boolean)) r = await r.getDirectoryHandle(e, { create: n });
37205
37228
  return r;
37206
- }, tK = async (e, t, n) => {
37229
+ }, rK = async (e, t, n) => {
37207
37230
  let r = t.split("/").filter(Boolean), i = r.pop();
37208
37231
  if (!i) throw Error("move: empty file path");
37209
- return (await eK(e, r.join("/"), n)).getFileHandle(i, { create: n });
37210
- }, nK = async ({ torrent: e, folder: t, opfsRoot: n, onProgress: r }) => {
37232
+ return (await nK(e, r.join("/"), n)).getFileHandle(i, { create: n });
37233
+ }, iK = async ({ torrent: e, folder: t, opfsRoot: n, onProgress: r }) => {
37211
37234
  if (!e.infoHash) throw Error("move: a torrent with no infohash has nowhere to go");
37212
- let i = uV(e.files), a = ZG("browser", e.infoHash), o = 0;
37235
+ let i = uV(e.files), a = $G("browser", e.infoHash), o = 0;
37213
37236
  for (let [e, s] of i.entries()) {
37214
37237
  r?.({
37215
37238
  file: e,
37216
37239
  files: i.length,
37217
37240
  name: s.name
37218
37241
  });
37219
- let c = await tK(t, s.name, !1), l = await tK(await eK(n, a, !0), s.name, !0);
37242
+ let c = await rK(t, s.name, !1), l = await rK(await nK(n, a, !0), s.name, !0);
37220
37243
  if ((await l.getFile()).size === s.size) continue;
37221
37244
  let u = await l.createWritable();
37222
37245
  try {
@@ -37226,24 +37249,24 @@ var HH = "m", UH = "magnet", WH = [
37226
37249
  }
37227
37250
  }
37228
37251
  return o;
37229
- }, rK = async ({ client: e, torrent: t, folder: n, to: r, opfsRoot: i, onProgress: a }) => {
37230
- if (r === "folder" ? await jG(e, t, n) : await nK({
37252
+ }, aK = async ({ client: e, torrent: t, folder: n, to: r, opfsRoot: i, onProgress: a }) => {
37253
+ if (r === "folder" ? await NG(e, t, n) : await iK({
37231
37254
  torrent: t,
37232
37255
  folder: n,
37233
37256
  opfsRoot: i ?? await navigator.storage.getDirectory(),
37234
37257
  onProgress: a
37235
37258
  }), !t.infoHash) throw Error("the torrent has no info hash, so the move cannot be finished safely");
37236
37259
  e.relocate(t.infoHash, r);
37237
- }, iK = /^[0-9a-f]{40}$/, aK = /^[0-9a-f]{64}$/, oK = 300, sK = (e) => {
37260
+ }, oK = /^[0-9a-f]{40}$/, sK = /^[0-9a-f]{64}$/, cK = 300, lK = (e) => {
37238
37261
  let t = wS(e, "xl");
37239
37262
  if (!t) return;
37240
37263
  let n = Number(t);
37241
37264
  return Number.isSafeInteger(n) && n > 0 ? n : void 0;
37242
- }, cK = (e) => (e.match(/[?&]tr=/g) ?? []).length, lK = (e) => {
37265
+ }, uK = (e) => (e.match(/[?&]tr=/g) ?? []).length, dK = (e) => {
37243
37266
  if (!e) return;
37244
37267
  let t = e.replace(/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u2028-\u202e\u2066-\u2069]/g, "").trim();
37245
- if (t) return t.length > oK ? t.slice(0, oK) + "…" : t;
37246
- }, uK = ({ magnet: e, name: t }) => {
37268
+ if (t) return t.length > cK ? t.slice(0, cK) + "…" : t;
37269
+ }, fK = ({ magnet: e, name: t }) => {
37247
37270
  if (!e) return {
37248
37271
  ok: !1,
37249
37272
  problem: "This link has no torrent in it."
@@ -37253,21 +37276,21 @@ var HH = "m", UH = "magnet", WH = [
37253
37276
  problem: "This is not a magnet link."
37254
37277
  };
37255
37278
  let n = SS(e);
37256
- return n ? !iK.test(n) && !aK.test(n) ? {
37279
+ return n ? !oK.test(n) && !sK.test(n) ? {
37257
37280
  ok: !1,
37258
37281
  problem: "This magnet link's info hash is malformed."
37259
37282
  } : {
37260
37283
  ok: !0,
37261
37284
  magnet: e,
37262
37285
  infoHash: n,
37263
- name: lK(wS(e, "dn")) ?? lK(t) ?? n,
37264
- trackers: cK(e),
37265
- sizeBytes: sK(e)
37286
+ name: dK(wS(e, "dn")) ?? dK(t) ?? n,
37287
+ trackers: uK(e),
37288
+ sizeBytes: lK(e)
37266
37289
  } : {
37267
37290
  ok: !1,
37268
37291
  problem: "This magnet link has no info hash."
37269
37292
  };
37270
- }, dK = /* @__PURE__ */ h(Dt(), 1), fK = St`
37293
+ }, pK = /* @__PURE__ */ h(Dt(), 1), mK = St`
37271
37294
  position: fixed;
37272
37295
  inset: 0;
37273
37296
  z-index: ${2147483646};
@@ -37281,20 +37304,20 @@ var HH = "m", UH = "magnet", WH = [
37281
37304
  softening the hairlines of the torrent table underneath. OVERLAY_BG is 75% for that reason, and
37282
37305
  alpha alone turns out to be enough to stop the list behind competing with the dialog. */
37283
37306
  background: ${lS};
37284
- `, pK = [
37307
+ `, hK = [
37285
37308
  "a[href]",
37286
37309
  "button:not([disabled])",
37287
37310
  "input:not([disabled])",
37288
37311
  "select:not([disabled])",
37289
37312
  "textarea:not([disabled])",
37290
37313
  "[tabindex]:not([tabindex=\"-1\"])"
37291
- ].join(","), mK = (e) => [...e.querySelectorAll(pK)].filter((e) => e.offsetWidth > 0 || e.offsetHeight > 0), hK = (e) => {
37314
+ ].join(","), gK = (e) => [...e.querySelectorAll(hK)].filter((e) => e.offsetWidth > 0 || e.offsetHeight > 0), _K = (e) => {
37292
37315
  let t = [];
37293
37316
  for (let n of [...document.body.children]) n instanceof HTMLElement && (n === e || n.contains(e) || n.matches("iframe[title=\"FKN\"]") || n.inert || (n.inert = !0, t.push(n)));
37294
37317
  return () => {
37295
37318
  for (let e of t) e.inert = !1;
37296
37319
  };
37297
- }, gK = ({ labelledBy: e, onClose: t, children: n, initialFocus: r }) => {
37320
+ }, vK = ({ labelledBy: e, onClose: t, children: n, initialFocus: r }) => {
37298
37321
  let i = (0, v.useRef)(null), a = (0, v.useRef)(t);
37299
37322
  a.current = t;
37300
37323
  let o = (0, v.useCallback)((e) => {
@@ -37303,7 +37326,7 @@ var HH = "m", UH = "magnet", WH = [
37303
37326
  return;
37304
37327
  }
37305
37328
  if (e.key !== "Tab" || !i.current) return;
37306
- let t = mK(i.current);
37329
+ let t = gK(i.current);
37307
37330
  if (t.length === 0) {
37308
37331
  e.preventDefault();
37309
37332
  return;
@@ -37314,13 +37337,13 @@ var HH = "m", UH = "magnet", WH = [
37314
37337
  return (0, v.useEffect)(() => {
37315
37338
  let e = i.current;
37316
37339
  if (!e) return;
37317
- let t = document.activeElement, n = hK(e);
37318
- return (r?.current ?? mK(e)[0])?.focus(), () => {
37340
+ let t = document.activeElement, n = _K(e);
37341
+ return (r?.current ?? gK(e)[0])?.focus(), () => {
37319
37342
  n(), t?.focus?.();
37320
37343
  };
37321
- }, []), (0, dK.createPortal)(/* @__PURE__ */ W("div", {
37344
+ }, []), (0, pK.createPortal)(/* @__PURE__ */ W("div", {
37322
37345
  ref: i,
37323
- css: fK,
37346
+ css: mK,
37324
37347
  role: "dialog",
37325
37348
  "aria-modal": "true",
37326
37349
  "aria-labelledby": e,
@@ -37330,32 +37353,32 @@ var HH = "m", UH = "magnet", WH = [
37330
37353
  },
37331
37354
  children: n
37332
37355
  }), document.body);
37333
- }, _K = "ripple:add-dialog", vK = ({ fileCount: e, location: t }) => ({
37356
+ }, yK = "ripple:add-dialog", bK = ({ fileCount: e, location: t }) => ({
37334
37357
  files: Array.from({ length: e }, (e, t) => t),
37335
37358
  location: t,
37336
37359
  start: !0,
37337
37360
  sequential: !1,
37338
37361
  firstLast: !1,
37339
37362
  topOfQueue: !1
37340
- }), yK = (e) => {
37363
+ }), xK = (e) => {
37341
37364
  try {
37342
- return e(_K) === "1";
37365
+ return e(yK) === "1";
37343
37366
  } catch {
37344
37367
  return !1;
37345
37368
  }
37346
- }, bK = (e, t) => ({
37369
+ }, SK = (e, t) => ({
37347
37370
  wanted: e.files.length === t ? void 0 : [...e.files].sort((e, t) => e - t),
37348
37371
  firstLast: e.firstLast
37349
- }), xK = (e) => [e.sequential ? ES.sequentialDownload : 0, ES.sequentialDownload], SK = (e) => e.files.length === 0 ? "Choose at least one file." : null, CK = (e, t) => e.files.reduce((e, n) => e + (t[n]?.size ?? 0), 0), wK = (e, t) => ({
37372
+ }), CK = (e) => [e.sequential ? ES.sequentialDownload : 0, ES.sequentialDownload], wK = (e) => e.files.length === 0 ? "Choose at least one file." : null, TK = (e, t) => e.files.reduce((e, n) => e + (t[n]?.size ?? 0), 0), EK = (e, t) => ({
37350
37373
  ...e,
37351
37374
  files: e.files.includes(t) ? e.files.filter((e) => e !== t) : [...e.files, t].sort((e, t) => e - t)
37352
- }), TK = (e, t) => ({
37375
+ }), DK = (e, t) => ({
37353
37376
  ...e,
37354
37377
  files: Array.from({ length: t }, (e, t) => t)
37355
- }), EK = (e) => ({
37378
+ }), OK = (e) => ({
37356
37379
  ...e,
37357
37380
  files: []
37358
- }), DK = St`
37381
+ }), kK = St`
37359
37382
  width: 100%;
37360
37383
  display: flex;
37361
37384
  align-items: center;
@@ -37575,23 +37598,23 @@ var HH = "m", UH = "magnet", WH = [
37575
37598
 
37576
37599
  &.small { padding: 5px 12px; font-size: 0.78rem; }
37577
37600
  }
37578
- `, OK = ({ path: e }) => {
37601
+ `, AK = ({ path: e }) => {
37579
37602
  let t = e.lastIndexOf("/");
37580
37603
  return t < 0 ? /* @__PURE__ */ W(Qa, { children: e }) : /* @__PURE__ */ G(Qa, { children: [/* @__PURE__ */ W("span", {
37581
37604
  className: "dir",
37582
37605
  children: e.slice(0, t + 1)
37583
37606
  }), e.slice(t + 1)] });
37584
- }, kK = ({ name: e, from: t, files: n, choices: r, onChoices: i, folderName: a, folderReady: o, external: s, onConfirm: c, onCancel: l, onNeverAsk: u, storage: d, persist: f, onAskPersist: p }) => {
37585
- let m = (0, v.useRef)(null), [h, g] = (0, v.useState)(!1), _ = n.length > 0, y = _ ? SK(r) : null, b = n.reduce((e, t) => e + t.size, 0), x = CK(r, n), S = d ? Math.max(0, d.limitBytes - d.usedBytes) : null, C = S !== null && x > S ? { room: S } : null, w = (e) => i({
37607
+ }, jK = ({ name: e, from: t, files: n, choices: r, onChoices: i, folderName: a, folderReady: o, external: s, onConfirm: c, onCancel: l, onNeverAsk: u, storage: d, persist: f, onAskPersist: p }) => {
37608
+ let m = (0, v.useRef)(null), [h, g] = (0, v.useState)(!1), _ = n.length > 0, y = _ ? wK(r) : null, b = n.reduce((e, t) => e + t.size, 0), x = TK(r, n), S = d ? Math.max(0, d.limitBytes - d.usedBytes) : null, C = S !== null && x > S ? { room: S } : null, w = (e) => i({
37586
37609
  ...r,
37587
37610
  ...e
37588
37611
  });
37589
- return /* @__PURE__ */ W(gK, {
37612
+ return /* @__PURE__ */ W(vK, {
37590
37613
  labelledBy: "add-torrent-title",
37591
37614
  onClose: l,
37592
37615
  initialFocus: m,
37593
37616
  children: /* @__PURE__ */ W("div", {
37594
- css: DK,
37617
+ css: kK,
37595
37618
  children: /* @__PURE__ */ G("div", {
37596
37619
  className: "card",
37597
37620
  children: [
@@ -37614,12 +37637,12 @@ var HH = "m", UH = "magnet", WH = [
37614
37637
  children: [
37615
37638
  /* @__PURE__ */ W("button", {
37616
37639
  className: "small",
37617
- onClick: () => i(TK(r, n.length)),
37640
+ onClick: () => i(DK(r, n.length)),
37618
37641
  children: "Select all"
37619
37642
  }),
37620
37643
  /* @__PURE__ */ W("button", {
37621
37644
  className: "small",
37622
- onClick: () => i(EK(r)),
37645
+ onClick: () => i(OK(r)),
37623
37646
  children: "Select none"
37624
37647
  }),
37625
37648
  /* @__PURE__ */ G("span", {
@@ -37646,11 +37669,11 @@ var HH = "m", UH = "magnet", WH = [
37646
37669
  /* @__PURE__ */ W("input", {
37647
37670
  type: "checkbox",
37648
37671
  checked: n,
37649
- onChange: () => i(wK(r, t))
37672
+ onChange: () => i(EK(r, t))
37650
37673
  }),
37651
37674
  /* @__PURE__ */ W("span", {
37652
37675
  className: "path",
37653
- children: /* @__PURE__ */ W(OK, { path: e.name })
37676
+ children: /* @__PURE__ */ W(AK, { path: e.name })
37654
37677
  }),
37655
37678
  /* @__PURE__ */ W("span", {
37656
37679
  className: "size",
@@ -37745,7 +37768,7 @@ var HH = "m", UH = "magnet", WH = [
37745
37768
  bS(C.room, !0),
37746
37769
  " free"
37747
37770
  ] }),
37748
- f && p && /* @__PURE__ */ W(SG, {
37771
+ f && p && /* @__PURE__ */ W(wG, {
37749
37772
  persist: f,
37750
37773
  onAsk: p
37751
37774
  })
@@ -37779,7 +37802,7 @@ var HH = "m", UH = "magnet", WH = [
37779
37802
  })
37780
37803
  })
37781
37804
  });
37782
- }, AK = St`
37805
+ }, MK = St`
37783
37806
  color: ${Z};
37784
37807
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
37785
37808
  max-width: min(460px, calc(100vw - 32px));
@@ -37957,16 +37980,16 @@ var HH = "m", UH = "magnet", WH = [
37957
37980
  }
37958
37981
  }
37959
37982
  }
37960
- `, jK = ({ title: e, subject: t, value: n, note: r, onCancel: i, onApply: a }) => {
37983
+ `, NK = ({ title: e, subject: t, value: n, note: r, onCancel: i, onApply: a }) => {
37961
37984
  let [o, s] = (0, v.useState)(() => RS(n)), [c, l] = (0, v.useState)(() => !(typeof n == "number" && n > 0)), u = (0, v.useRef)(null), d = (0, v.useMemo)(() => c ? 0 : LS(o), [c, o]), f = d === null ? "Enter a speed in kB/s, or tick Unlimited." : null, p = () => {
37962
37985
  d !== null && a(d);
37963
37986
  };
37964
- return /* @__PURE__ */ W(gK, {
37987
+ return /* @__PURE__ */ W(vK, {
37965
37988
  labelledBy: "rate-limit-title",
37966
37989
  onClose: i,
37967
37990
  initialFocus: u,
37968
37991
  children: /* @__PURE__ */ W("div", {
37969
- css: AK,
37992
+ css: MK,
37970
37993
  children: /* @__PURE__ */ G("div", {
37971
37994
  className: "card",
37972
37995
  children: [
@@ -38037,23 +38060,23 @@ var HH = "m", UH = "magnet", WH = [
38037
38060
  })
38038
38061
  })
38039
38062
  });
38040
- }, MK = null;
38063
+ }, PK = null;
38041
38064
  typeof window < "u" && (window.addEventListener("beforeinstallprompt", (e) => {
38042
- e.preventDefault(), MK = e;
38065
+ e.preventDefault(), PK = e;
38043
38066
  }), window.addEventListener("appinstalled", () => {
38044
- MK = null;
38067
+ PK = null;
38045
38068
  }));
38046
- var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window < "u" && !!window.matchMedia?.("(display-mode: standalone)").matches || typeof navigator < "u" && navigator.standalone === !0, FK = () => {
38069
+ var FK = () => window.location.origin + "/?magnet=%s", IK = () => typeof window < "u" && !!window.matchMedia?.("(display-mode: standalone)").matches || typeof navigator < "u" && navigator.standalone === !0, LK = () => {
38047
38070
  if (typeof navigator > "u" || typeof navigator.registerProtocolHandler != "function") return !1;
38048
38071
  try {
38049
- return navigator.registerProtocolHandler("magnet", NK()), !0;
38072
+ return navigator.registerProtocolHandler("magnet", FK()), !0;
38050
38073
  } catch {
38051
38074
  return !1;
38052
38075
  }
38053
- }, IK = async () => {
38054
- let e = MK;
38076
+ }, RK = async () => {
38077
+ let e = PK;
38055
38078
  if (!e) return "unavailable";
38056
- MK = null;
38079
+ PK = null;
38057
38080
  try {
38058
38081
  await e.prompt();
38059
38082
  let { outcome: t } = await e.userChoice;
@@ -38061,11 +38084,11 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
38061
38084
  } catch {
38062
38085
  return "unavailable";
38063
38086
  }
38064
- }, LK = async () => MK && await IK() === "accepted" ? "installed" : FK() ? "magnet-registered" : PK() ? "already-installed" : "unsupported", RK = () => {
38087
+ }, zK = async () => PK && await RK() === "accepted" ? "installed" : LK() ? "magnet-registered" : IK() ? "already-installed" : "unsupported", BK = () => {
38065
38088
  try {
38066
38089
  location.reload();
38067
38090
  } catch {}
38068
- }, zK = 9e5, BK = 1e4, VK = (e = BK) => {
38091
+ }, VK = 9e5, HK = 1e4, UK = (e = HK) => {
38069
38092
  let [t, n] = (0, v.useState)(!1), r = (0, v.useRef)(null);
38070
38093
  return (0, v.useEffect)(() => {
38071
38094
  if (typeof navigator > "u" || !("serviceWorker" in navigator)) return;
@@ -38074,7 +38097,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
38074
38097
  i = !1, c();
38075
38098
  return;
38076
38099
  }
38077
- a && RK();
38100
+ a && BK();
38078
38101
  };
38079
38102
  navigator.serviceWorker.addEventListener("controllerchange", o);
38080
38103
  let s = null, c = () => {
@@ -38096,7 +38119,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
38096
38119
  });
38097
38120
  let u = () => {
38098
38121
  s?.update().catch(() => {});
38099
- }, d = window.setInterval(u, zK), f = () => {
38122
+ }, d = window.setInterval(u, VK), f = () => {
38100
38123
  document.visibilityState === "visible" && u();
38101
38124
  };
38102
38125
  return document.addEventListener("visibilitychange", f), () => {
@@ -38106,10 +38129,10 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
38106
38129
  ready: t,
38107
38130
  update: (0, v.useCallback)(() => {
38108
38131
  let e = r.current;
38109
- e ? e.postMessage({ type: "take-over" }) : RK();
38132
+ e ? e.postMessage({ type: "take-over" }) : BK();
38110
38133
  }, [])
38111
38134
  };
38112
- }, HK = St`
38135
+ }, WK = St`
38113
38136
  color: ${Z};
38114
38137
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
38115
38138
  max-width: min(460px, calc(100vw - 32px));
@@ -38218,31 +38241,31 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
38218
38241
  }
38219
38242
  }
38220
38243
  }
38221
- `, UK = (e) => {
38244
+ `, GK = (e) => {
38222
38245
  if (!e) return !1;
38223
38246
  try {
38224
38247
  return localStorage.getItem(e) === "skip";
38225
38248
  } catch {
38226
38249
  return !1;
38227
38250
  }
38228
- }, WK = (e) => {
38251
+ }, KK = (e) => {
38229
38252
  if (e) try {
38230
38253
  localStorage.setItem(e, "skip");
38231
38254
  } catch {}
38232
- }, GK = () => {
38233
- let [e, t] = (0, v.useState)(null), [n, r] = (0, v.useState)(!1), i = (0, v.useRef)(null), a = (0, v.useRef)(null), o = (0, v.useCallback)((e) => UK(e.rememberKey) ? Promise.resolve(!0) : (r(!1), t(e), new Promise((e) => {
38255
+ }, qK = () => {
38256
+ let [e, t] = (0, v.useState)(null), [n, r] = (0, v.useState)(!1), i = (0, v.useRef)(null), a = (0, v.useRef)(null), o = (0, v.useCallback)((e) => GK(e.rememberKey) ? Promise.resolve(!0) : (r(!1), t(e), new Promise((e) => {
38234
38257
  a.current = e;
38235
38258
  })), []), s = (0, v.useCallback)((r) => {
38236
- r && n && WK(e?.rememberKey), t(null), a.current?.(r), a.current = null;
38259
+ r && n && KK(e?.rememberKey), t(null), a.current?.(r), a.current = null;
38237
38260
  }, [n, e]);
38238
38261
  return {
38239
38262
  confirm: o,
38240
- confirmElement: e ? /* @__PURE__ */ W(gK, {
38263
+ confirmElement: e ? /* @__PURE__ */ W(vK, {
38241
38264
  labelledBy: "confirm-title",
38242
38265
  onClose: () => s(!1),
38243
38266
  initialFocus: i,
38244
38267
  children: /* @__PURE__ */ W("div", {
38245
- css: HK,
38268
+ css: WK,
38246
38269
  children: /* @__PURE__ */ G("div", {
38247
38270
  className: "card",
38248
38271
  children: [
@@ -38276,7 +38299,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
38276
38299
  }) : null,
38277
38300
  confirmOpen: e != null
38278
38301
  };
38279
- }, KK = St`
38302
+ }, JK = St`
38280
38303
  width: 100%;
38281
38304
  display: flex;
38282
38305
  align-items: center;
@@ -38703,7 +38726,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
38703
38726
  @media (max-width: 700px) {
38704
38727
  .opt > label { width: auto; }
38705
38728
  }
38706
- `, qK = (e) => e.split("/").pop() || e, JK = ({ torrent: e, dragging: t, onMagnet: n, onFiles: r, onClear: i, onClose: a, onToast: o }) => {
38729
+ `, YK = (e) => e.split("/").pop() || e, XK = ({ torrent: e, dragging: t, onMagnet: n, onFiles: r, onClear: i, onClose: a, onToast: o }) => {
38707
38730
  let [s, c] = (0, v.useState)("download"), [l, u] = (0, v.useState)(""), [d, f] = (0, v.useState)(!1), p = (0, v.useRef)(null), m = e?.files, h = m?.length ?? 0, g = e?.fileCount ?? 0, [_, y] = (0, v.useState)(null), [b, x] = (0, v.useState)(null);
38708
38731
  (0, v.useEffect)(() => {
38709
38732
  y(null), x(null);
@@ -38738,12 +38761,12 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
38738
38761
  }, P = (e) => {
38739
38762
  e?.length && (f(!0), r(e));
38740
38763
  };
38741
- return /* @__PURE__ */ W(gK, {
38764
+ return /* @__PURE__ */ W(vK, {
38742
38765
  labelledBy: "share-link-title",
38743
38766
  onClose: a,
38744
38767
  initialFocus: p,
38745
38768
  children: /* @__PURE__ */ W("div", {
38746
- css: KK,
38769
+ css: JK,
38747
38770
  children: /* @__PURE__ */ G("div", {
38748
38771
  className: "card",
38749
38772
  children: [
@@ -38800,7 +38823,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
38800
38823
  children: m.map((e, t) => /* @__PURE__ */ G("option", {
38801
38824
  value: t,
38802
38825
  children: [
38803
- qK(e.name),
38826
+ YK(e.name),
38804
38827
  " · ",
38805
38828
  bS(e.size)
38806
38829
  ]
@@ -38836,7 +38859,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
38836
38859
  }),
38837
38860
  /* @__PURE__ */ W("span", {
38838
38861
  className: "name",
38839
- children: qK(e.name)
38862
+ children: YK(e.name)
38840
38863
  }),
38841
38864
  /* @__PURE__ */ W("span", {
38842
38865
  className: "size",
@@ -38950,11 +38973,11 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
38950
38973
  })
38951
38974
  })
38952
38975
  });
38953
- }, YK = [
38976
+ }, ZK = [
38954
38977
  "udp://tracker.opentrackr.org:1337/announce",
38955
38978
  "udp://explodie.org:6969/announce",
38956
38979
  "udp://tracker.torrent.eu.org:451/announce"
38957
- ], XK = ({ name: e, trackers: t, webSeeds: n = [], private: r, pieceLength: i, format: a = "v1" }) => {
38980
+ ], QK = ({ name: e, trackers: t, webSeeds: n = [], private: r, pieceLength: i, format: a = "v1" }) => {
38958
38981
  if (a !== "v1" && a !== "hybrid" && a !== "v2") return `${String(a)} is not a torrent format`;
38959
38982
  let o = t.map((e) => e.trim()).filter(Boolean);
38960
38983
  if (!e.trim()) return "Give the torrent a name";
@@ -38963,7 +38986,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
38963
38986
  for (let e of o) if (!/^(https?|udp|ws|wss):\/\/[^\s/]+/.test(e)) return `${e} is not a tracker address`;
38964
38987
  for (let e of n.map((e) => e.trim()).filter(Boolean)) if (!/^https?:\/\/[^\s/]+/.test(e)) return `${e} is not a web seed address: it has to be http or https`;
38965
38988
  return i !== void 0 && !HU(i) ? "That piece size is not one a torrent can use" : null;
38966
- }, ZK = (e, t) => e.map((e) => e.trim()).filter(Boolean).map((e) => t ? e.replace(/\/+$/, "") : e.endsWith("/") ? e : e + "/"), QK = async ({ picked: e, hashed: t, options: n, single: r }) => {
38989
+ }, $K = (e, t) => e.map((e) => e.trim()).filter(Boolean).map((e) => t ? e.replace(/\/+$/, "") : e.endsWith("/") ? e : e + "/"), eq = async ({ picked: e, hashed: t, options: n, single: r }) => {
38967
38990
  let i = n.format ?? "v1", a = JU({
38968
38991
  name: n.name,
38969
38992
  files: e.map(({ path: e, size: t }) => ({
@@ -38978,7 +39001,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
38978
39001
  pieces: t.pieces,
38979
39002
  fileHashes: t.fileHashes,
38980
39003
  trackers: o,
38981
- webSeeds: ZK(n.webSeeds ?? [], r),
39004
+ webSeeds: $K(n.webSeeds ?? [], r),
38982
39005
  private: n.private,
38983
39006
  source: n.source,
38984
39007
  comment: n.comment
@@ -39019,46 +39042,46 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
39019
39042
  size: e.size
39020
39043
  }))
39021
39044
  };
39022
- }, $K = 16384, eq = /* @__PURE__ */ new Uint8Array(32), tq = async (e) => new Uint8Array(await crypto.subtle.digest("SHA-256", new Uint8Array(e).buffer)), nq = (e, t) => {
39045
+ }, tq = 16384, nq = /* @__PURE__ */ new Uint8Array(32), rq = async (e) => new Uint8Array(await crypto.subtle.digest("SHA-256", new Uint8Array(e).buffer)), iq = (e, t) => {
39023
39046
  let n = /* @__PURE__ */ new Uint8Array(64);
39024
39047
  return n.set(e, 0), n.set(t, 32), n;
39025
- }, rq = (e) => Math.max(1, Math.floor(e / $K)), iq = (e) => {
39048
+ }, aq = (e) => Math.max(1, Math.floor(e / tq)), oq = (e) => {
39026
39049
  let t = 1;
39027
39050
  for (; t < e;) t *= 2;
39028
39051
  return t;
39029
- }, aq = (e, t) => {
39030
- let n = Math.ceil(e / $K);
39031
- return n <= 0 ? 0 : e <= t ? iq(n) : Math.ceil(e / t) * rq(t);
39032
- }, oq = async (e) => {
39033
- let t = eq;
39034
- for (let n = 0; n < e; n++) t = await tq(nq(t, t));
39052
+ }, sq = (e, t) => {
39053
+ let n = Math.ceil(e / tq);
39054
+ return n <= 0 ? 0 : e <= t ? oq(n) : Math.ceil(e / t) * aq(t);
39055
+ }, cq = async (e) => {
39056
+ let t = nq;
39057
+ for (let n = 0; n < e; n++) t = await rq(iq(t, t));
39035
39058
  return t;
39036
- }, sq = async (e) => {
39059
+ }, lq = async (e) => {
39037
39060
  let t = [];
39038
- for (let n = 0; n < e.length; n += 2) t.push(await tq(nq(e[n], e[n + 1])));
39061
+ for (let n = 0; n < e.length; n += 2) t.push(await rq(iq(e[n], e[n + 1])));
39039
39062
  return t;
39040
- }, cq = async (e, t, n) => {
39063
+ }, uq = async (e, t, n) => {
39041
39064
  if (t <= 0 || !e.length) return {
39042
39065
  root: null,
39043
39066
  layer: []
39044
39067
  };
39045
- let r = aq(t, n);
39068
+ let r = sq(t, n);
39046
39069
  if (e.length > r) throw Error(`merkle: ${e.length} leaves for a file of ${t} bytes that wants at most ${r}`);
39047
39070
  let i = [...e];
39048
- for (; i.length < r;) i.push(eq);
39049
- let a = rq(n), o = 0;
39050
- for (; i.length > 1 && 1 << o < a;) i = await sq(i), o += 1;
39051
- let s = t > n ? [...i] : [], c = await oq(o);
39052
- for (; i.length > 1;) i.length % 2 && (i = [...i, c]), i = await sq(i), c = await tq(nq(c, c));
39071
+ for (; i.length < r;) i.push(nq);
39072
+ let a = aq(n), o = 0;
39073
+ for (; i.length > 1 && 1 << o < a;) i = await lq(i), o += 1;
39074
+ let s = t > n ? [...i] : [], c = await cq(o);
39075
+ for (; i.length > 1;) i.length % 2 && (i = [...i, c]), i = await lq(i), c = await rq(iq(c, c));
39053
39076
  return {
39054
39077
  root: i[0],
39055
39078
  layer: s
39056
39079
  };
39057
- }, lq = 4194304, uq = class extends Error {
39080
+ }, dq = 4194304, fq = class extends Error {
39058
39081
  constructor() {
39059
39082
  super("hashing cancelled"), this.name = "HashCancelled";
39060
39083
  }
39061
- }, dq = async (e) => new Uint8Array(await crypto.subtle.digest("SHA-1", new Uint8Array(e).buffer)), fq = async (e, t, { signal: n, onProgress: r, maxReadBytes: i = lq } = {}) => {
39084
+ }, pq = async (e) => new Uint8Array(await crypto.subtle.digest("SHA-1", new Uint8Array(e).buffer)), mq = async (e, t, { signal: n, onProgress: r, maxReadBytes: i = dq } = {}) => {
39062
39085
  let a = IU(e.format), o = FU(e.format), s = new Uint8Array(a ? e.pieceCount * 20 : 0), c = [];
39063
39086
  if (!e.pieceCount) {
39064
39087
  if (o) for (let t = 0; t < WU(e).length; t++) c.push({
@@ -39071,7 +39094,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
39071
39094
  };
39072
39095
  }
39073
39096
  let l = new Uint8Array(a ? e.pieceLength : 0), u = 0, d = 0, f = 0, p = e.files[0].path.join("/"), m = () => {
39074
- if (n?.aborted) throw new uq();
39097
+ if (n?.aborted) throw new fq();
39075
39098
  }, h = () => r?.({
39076
39099
  hashedBytes: f,
39077
39100
  totalBytes: e.totalBytes,
@@ -39080,15 +39103,15 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
39080
39103
  path: p
39081
39104
  }), g = async (e) => {
39082
39105
  if (a) {
39083
- let t = await dq(l.subarray(0, e));
39106
+ let t = await pq(l.subarray(0, e));
39084
39107
  s.set(t, d * 20);
39085
39108
  }
39086
39109
  d += 1, u = 0, h();
39087
- }, _ = new Uint8Array(o ? $K : 0), v = 0, y = [], b = async (e) => {
39110
+ }, _ = new Uint8Array(o ? tq : 0), v = 0, y = [], b = async (e) => {
39088
39111
  let t = 0;
39089
39112
  for (; t < e.length;) {
39090
- let n = Math.min($K - v, e.length - t);
39091
- _.set(e.subarray(t, t + n), v), v += n, t += n, v === 16384 && (y.push(await tq(_)), v = 0);
39113
+ let n = Math.min(tq - v, e.length - t);
39114
+ _.set(e.subarray(t, t + n), v), v += n, t += n, v === 16384 && (y.push(await rq(_)), v = 0);
39092
39115
  }
39093
39116
  };
39094
39117
  m();
@@ -39110,7 +39133,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
39110
39133
  if (c.length !== s) throw Error(`${p} gave ${c.length} bytes of the ${s} at ${r}: the file changed while it was being read`);
39111
39134
  a && l.set(c, u), o && await b(c), u += s, r += s, f += s, a && u === e.pieceLength ? await g(e.pieceLength) : a || h();
39112
39135
  }
39113
- o && (v > 0 && y.push(await tq(_.subarray(0, v))), c.push(await cq(y, n.size, e.pieceLength)));
39136
+ o && (v > 0 && y.push(await rq(_.subarray(0, v))), c.push(await uq(y, n.size, e.pieceLength)));
39114
39137
  }
39115
39138
  if (a && u > 0 && await g(u), a && d !== e.pieceCount) throw Error(`hashed ${d} pieces where the plan wanted ${e.pieceCount}: the files no longer add up to ${e.paddedBytes} bytes`);
39116
39139
  if (o && c.length !== WU(e).length) throw Error(`built ${c.length} merkle trees for ${WU(e).length} files`);
@@ -39118,11 +39141,11 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
39118
39141
  pieces: s,
39119
39142
  fileHashes: c
39120
39143
  };
39121
- }, pq = (e, t) => {
39144
+ }, hq = (e, t) => {
39122
39145
  if (t < 1e3 || e.hashedBytes <= 0) return;
39123
39146
  let n = e.hashedBytes / (t / 1e3);
39124
39147
  if (!(n <= 0)) return Math.round((e.totalBytes - e.hashedBytes) / n);
39125
- }, mq = St`
39148
+ }, gq = St`
39126
39149
  color: ${Z};
39127
39150
  width: 100%;
39128
39151
  max-width: min(560px, calc(100vw - 32px));
@@ -39271,12 +39294,12 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
39271
39294
  .grow { flex: 1; }
39272
39295
  .skipped { max-height: 8rem; overflow-y: auto; font-size: 0.8rem; color: ${iS}; }
39273
39296
  code { font-size: 0.8rem; word-break: break-all; }
39274
- `, hq = (() => {
39297
+ `, _q = (() => {
39275
39298
  let e = [];
39276
39299
  for (let t = LU; t <= RU; t *= 2) e.push(t);
39277
39300
  return e;
39278
- })(), gq = (e) => e >= 1048576 ? `${e / 1048576} MiB` : `${e / 1024} KiB`, _q = ({ create: e, onClose: t, onShare: n, onToast: r }) => {
39279
- let { state: i, suggestedName: a } = e, [o, s] = (0, v.useState)(""), [c, l] = (0, v.useState)(YK.join("\n")), [u, d] = (0, v.useState)(!1), [f, p] = (0, v.useState)(""), [m, h] = (0, v.useState)(""), [g, _] = (0, v.useState)(""), [y, b] = (0, v.useState)(""), [x, S] = (0, v.useState)("v1"), [C, w] = (0, v.useState)(0), T = (0, v.useRef)(null);
39301
+ })(), vq = (e) => e >= 1048576 ? `${e / 1048576} MiB` : `${e / 1024} KiB`, yq = ({ create: e, onClose: t, onShare: n, onToast: r }) => {
39302
+ let { state: i, suggestedName: a } = e, [o, s] = (0, v.useState)(""), [c, l] = (0, v.useState)(ZK.join("\n")), [u, d] = (0, v.useState)(!1), [f, p] = (0, v.useState)(""), [m, h] = (0, v.useState)(""), [g, _] = (0, v.useState)(""), [y, b] = (0, v.useState)(""), [x, S] = (0, v.useState)("v1"), [C, w] = (0, v.useState)(0), T = (0, v.useRef)(null);
39280
39303
  (0, v.useEffect)(() => {
39281
39304
  s(a), S("v1"), b(""), w(0);
39282
39305
  }, [a]), (0, v.useEffect)(() => {
@@ -39304,13 +39327,13 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
39304
39327
  pieceLength: y ? Number(y) : void 0,
39305
39328
  format: x,
39306
39329
  ...t
39307
- }), O = i.stage === "reading" || i.stage === "hashing" || i.stage === "checking" || i.stage === "copying" || i.stage === "adding", k = i.progress && C ? pq(i.progress, Date.now() - C) : void 0, A = i.progress ? i.progress.hashedBytes / Math.max(1, i.progress.totalBytes) : 0, j = i.copy ? i.copy.copiedBytes / Math.max(1, i.copy.totalBytes) : 0;
39308
- return /* @__PURE__ */ W(gK, {
39330
+ }), O = i.stage === "reading" || i.stage === "hashing" || i.stage === "checking" || i.stage === "copying" || i.stage === "adding", k = i.progress && C ? hq(i.progress, Date.now() - C) : void 0, A = i.progress ? i.progress.hashedBytes / Math.max(1, i.progress.totalBytes) : 0, j = i.copy ? i.copy.copiedBytes / Math.max(1, i.copy.totalBytes) : 0;
39331
+ return /* @__PURE__ */ W(vK, {
39309
39332
  labelledBy: "create-torrent-title",
39310
39333
  onClose: O ? e.cancel : t,
39311
39334
  initialFocus: T,
39312
39335
  children: /* @__PURE__ */ W("div", {
39313
- css: mq,
39336
+ css: gq,
39314
39337
  children: /* @__PURE__ */ G("div", {
39315
39338
  className: "card",
39316
39339
  children: [
@@ -39416,12 +39439,12 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
39416
39439
  value: "",
39417
39440
  children: [
39418
39441
  "Auto (",
39419
- gq(i.plan.pieceLength),
39442
+ vq(i.plan.pieceLength),
39420
39443
  ")"
39421
39444
  ]
39422
- }), hq.map((e) => /* @__PURE__ */ W("option", {
39445
+ }), _q.map((e) => /* @__PURE__ */ W("option", {
39423
39446
  value: e,
39424
- children: gq(e)
39447
+ children: vq(e)
39425
39448
  }, e))]
39426
39449
  })]
39427
39450
  }),
@@ -39644,19 +39667,19 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
39644
39667
  })
39645
39668
  })
39646
39669
  });
39647
- }, vq = 1e9, yq = (e) => !Number.isFinite(e) || e <= 0 ? 0 : Math.min(vq, Math.floor(e * .1)), bq = (e) => {
39670
+ }, bq = 1e9, xq = (e) => !Number.isFinite(e) || e <= 0 ? 0 : Math.min(bq, Math.floor(e * .1)), Sq = (e) => {
39648
39671
  let t = new TextEncoder();
39649
39672
  for (let n of e) for (let e of n.split("/")) if (t.encode(e).length > 240) return e;
39650
39673
  return null;
39651
- }, xq = ({ totalBytes: e, usedBytes: t, limitBytes: n }) => {
39674
+ }, Cq = ({ totalBytes: e, usedBytes: t, limitBytes: n }) => {
39652
39675
  if (!Number.isFinite(n) || n <= 0 || !Number.isFinite(t) || t < 0) return { kind: "unknown" };
39653
- let r = n - t - yq(n);
39676
+ let r = n - t - xq(n);
39654
39677
  return e <= r ? { kind: "fits" } : {
39655
39678
  kind: "short",
39656
39679
  shortBy: e - r
39657
39680
  };
39658
- }, Sq = async (e, t = []) => {
39659
- let n = bq(t);
39681
+ }, wq = async (e, t = []) => {
39682
+ let n = Sq(t);
39660
39683
  if (n) return {
39661
39684
  kind: "unsafe",
39662
39685
  element: n
@@ -39664,7 +39687,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
39664
39687
  try {
39665
39688
  await UB.getDirectory();
39666
39689
  let { usage: t, quota: n } = await UB.estimate();
39667
- return t === void 0 ? { kind: "unknown" } : xq({
39690
+ return t === void 0 ? { kind: "unknown" } : Cq({
39668
39691
  totalBytes: e,
39669
39692
  usedBytes: t,
39670
39693
  limitBytes: n ?? 0
@@ -39672,19 +39695,19 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
39672
39695
  } catch {
39673
39696
  return { kind: "unknown" };
39674
39697
  }
39675
- }, Cq = async (e, t) => {
39698
+ }, Tq = async (e, t) => {
39676
39699
  let n = e;
39677
39700
  for (let e of t.split("/").filter(Boolean)) n = await n.getDirectoryHandle(e, { create: !0 });
39678
39701
  return n;
39679
- }, wq = async (e, t) => {
39702
+ }, Eq = async (e, t) => {
39680
39703
  let n = t.split("/").filter(Boolean), r = n.pop();
39681
39704
  if (!r) throw Error("copy: empty file path");
39682
- return (await Cq(e, n.join("/"))).getFileHandle(r, { create: !0 });
39683
- }, Tq = async (e) => {
39705
+ return (await Tq(e, n.join("/"))).getFileHandle(r, { create: !0 });
39706
+ }, Dq = async (e) => {
39684
39707
  let t = await vW(e.bytes);
39685
39708
  if (!t) throw Error("the torrent that was just built could not be read back");
39686
39709
  if (!t.files) throw Error("the torrent that was just built lists no files");
39687
- let n = bq(t.files.map((e) => e.name));
39710
+ let n = Sq(t.files.map((e) => e.name));
39688
39711
  if (n) throw Error(`${n.slice(0, 40)}... is too long a name for the engine to keep`);
39689
39712
  return t.files.map((t) => {
39690
39713
  let n = e.handles[t.index];
@@ -39695,8 +39718,8 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
39695
39718
  ref: n
39696
39719
  };
39697
39720
  });
39698
- }, Eq = async ({ built: e, opfsRoot: t, signal: n, onProgress: r }) => {
39699
- let i = await Tq(e), a = bR(e.infoHash), o = await Cq(t ?? await navigator.storage.getDirectory(), a), s = i.reduce((e, t) => e + t.size, 0), c = 0;
39721
+ }, Oq = async ({ built: e, opfsRoot: t, signal: n, onProgress: r }) => {
39722
+ let i = await Dq(e), a = bR(e.infoHash), o = await Tq(t ?? await navigator.storage.getDirectory(), a), s = i.reduce((e, t) => e + t.size, 0), c = 0;
39700
39723
  for (let [e, t] of i.entries()) {
39701
39724
  if (n?.aborted) throw new DOMException("the copy was cancelled", "AbortError");
39702
39725
  r?.({
@@ -39706,12 +39729,12 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
39706
39729
  copiedBytes: c,
39707
39730
  totalBytes: s
39708
39731
  });
39709
- let a = await wq(o, t.path);
39732
+ let a = await Eq(o, t.path);
39710
39733
  if ((await a.getFile()).size === t.size) {
39711
39734
  c += t.size;
39712
39735
  continue;
39713
39736
  }
39714
- let l = await PG(t.ref);
39737
+ let l = await IG(t.ref);
39715
39738
  if (l.size !== t.size) throw Error(`${t.path} is now ${l.size} bytes where the torrent describes ${t.size}`);
39716
39739
  let u = await a.createWritable();
39717
39740
  try {
@@ -39731,7 +39754,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
39731
39754
  savePath: a,
39732
39755
  copiedBytes: c
39733
39756
  };
39734
- }, Dq = {
39757
+ }, kq = {
39735
39758
  stage: "idle",
39736
39759
  plan: null,
39737
39760
  skipped: [],
@@ -39743,30 +39766,30 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
39743
39766
  reopenable: null,
39744
39767
  room: null,
39745
39768
  copy: null
39746
- }, Oq = (e) => "ripple:source:" + e, kq = { mode: "read" }, Aq = async (e) => await e.queryPermission?.call(e, kq) ?? "granted", jq = async (e) => await e.requestPermission?.call(e, kq) === "granted", Mq = () => typeof window < "u", Nq = (e) => {
39769
+ }, Aq = (e) => "ripple:source:" + e, jq = { mode: "read" }, Mq = async (e) => await e.queryPermission?.call(e, jq) ?? "granted", Nq = async (e) => await e.requestPermission?.call(e, jq) === "granted", Pq = () => typeof window < "u", Fq = (e) => {
39747
39770
  try {
39748
39771
  return structuredClone(e), !0;
39749
39772
  } catch {
39750
39773
  return !1;
39751
39774
  }
39752
- }, Pq = async (e, { signal: t, onFound: n }) => e.kind === "file" ? {
39753
- files: [await LG(e)],
39775
+ }, Iq = async (e, { signal: t, onFound: n }) => e.kind === "file" ? {
39776
+ files: [await zG(e)],
39754
39777
  skipped: [],
39755
39778
  truncated: !1,
39756
39779
  single: !0
39757
39780
  } : {
39758
- ...await IG(e, {
39781
+ ...await RG(e, {
39759
39782
  signal: t,
39760
39783
  onFound: n
39761
39784
  }),
39762
39785
  single: !1
39763
- }, Fq = (e) => {
39764
- let [t, n] = (0, v.useState)(Dq), [r, i] = (0, v.useState)(""), a = (0, v.useRef)(null), o = (0, v.useRef)(null);
39786
+ }, Lq = (e) => {
39787
+ let [t, n] = (0, v.useState)(kq), [r, i] = (0, v.useState)(""), a = (0, v.useRef)(null), o = (0, v.useRef)(null);
39765
39788
  (0, v.useEffect)(() => () => o.current?.abort(), []);
39766
39789
  let s = (e) => {
39767
39790
  let t = e?.name;
39768
- if (e instanceof uq || t === "WalkCancelled" || t === "AbortError") {
39769
- n(Dq);
39791
+ if (e instanceof fq || t === "WalkCancelled" || t === "AbortError") {
39792
+ n(kq);
39770
39793
  return;
39771
39794
  }
39772
39795
  n((t) => ({
@@ -39777,7 +39800,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
39777
39800
  }, c = (0, v.useCallback)((e, t, r) => {
39778
39801
  if (!e.files.length) throw Error("There are no files in there to put in a torrent");
39779
39802
  if (!e.files.reduce((e, t) => e + t.size, 0)) throw Error("Every file in there is empty");
39780
- let i = Nq(r);
39803
+ let i = Fq(r);
39781
39804
  a.current = {
39782
39805
  root: r,
39783
39806
  name: t,
@@ -39794,7 +39817,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
39794
39817
  single: e.single
39795
39818
  });
39796
39819
  if (n({
39797
- ...Dq,
39820
+ ...kq,
39798
39821
  stage: "ready",
39799
39822
  plan: o,
39800
39823
  skipped: e.skipped,
@@ -39803,7 +39826,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
39803
39826
  reopenable: i
39804
39827
  }), !i) {
39805
39828
  let r = e.single ? [t] : e.files.map((e) => [t, ...e.path].join("/"));
39806
- Sq(o.totalBytes, r).then((e) => {
39829
+ wq(o.totalBytes, r).then((e) => {
39807
39830
  n((t) => t.stage === "ready" ? {
39808
39831
  ...t,
39809
39832
  room: e
@@ -39813,11 +39836,11 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
39813
39836
  }, []), l = (0, v.useCallback)(async (e) => {
39814
39837
  let t = new AbortController();
39815
39838
  o.current = t, n({
39816
- ...Dq,
39839
+ ...kq,
39817
39840
  stage: "reading"
39818
39841
  }), i(e.name);
39819
39842
  try {
39820
- let r = await Pq(e, {
39843
+ let r = await Iq(e, {
39821
39844
  signal: t.signal,
39822
39845
  onFound: (e) => n((t) => t.stage === "reading" ? {
39823
39846
  ...t,
@@ -39843,7 +39866,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
39843
39866
  }, [l]), f = (0, v.useCallback)(async (t) => {
39844
39867
  let r = a.current;
39845
39868
  if (!r) return;
39846
- let i = XK(t);
39869
+ let i = QK(t);
39847
39870
  if (i) {
39848
39871
  n((e) => ({
39849
39872
  ...e,
@@ -39860,7 +39883,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
39860
39883
  progress: null
39861
39884
  }));
39862
39885
  try {
39863
- let i = await fq(JU({
39886
+ let i = await mq(JU({
39864
39887
  name: t.name,
39865
39888
  files: r.files.map(({ path: e, size: t }) => ({
39866
39889
  path: e,
@@ -39872,7 +39895,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
39872
39895
  }), (e, t, n) => {
39873
39896
  let i = r.files.find((t) => t.path.join("/") === e.path.join("/"));
39874
39897
  if (!i) throw Error(`no handle for ${e.path.join("/")}`);
39875
- return RG(i, t, n);
39898
+ return BG(i, t, n);
39876
39899
  }, {
39877
39900
  signal: c.signal,
39878
39901
  onProgress: (e) => n((t) => ({
@@ -39884,16 +39907,16 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
39884
39907
  ...e,
39885
39908
  stage: "checking"
39886
39909
  }));
39887
- let a = await zG(r.files);
39910
+ let a = await VG(r.files);
39888
39911
  if (a.length) throw Error(`${a[0].path} changed while it was being read` + (a.length > 1 ? `, along with ${a.length - 1} more` : "") + ". Try again.");
39889
- let o = await QK({
39912
+ let o = await eq({
39890
39913
  picked: r.files,
39891
39914
  hashed: i,
39892
39915
  options: t,
39893
39916
  single: r.single
39894
39917
  });
39895
39918
  if (!r.reopenable) {
39896
- let t = await Sq(o.plan.totalBytes, o.files.map((e) => e.name));
39919
+ let t = await wq(o.plan.totalBytes, o.files.map((e) => e.name));
39897
39920
  if (n((e) => ({
39898
39921
  ...e,
39899
39922
  room: t
@@ -39904,7 +39927,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
39904
39927
  copy: null
39905
39928
  })), e.reserveStorage(o.infoHash, !0);
39906
39929
  try {
39907
- let { savePath: t } = await Eq({
39930
+ let { savePath: t } = await Oq({
39908
39931
  built: o,
39909
39932
  signal: c.signal,
39910
39933
  onProgress: (e) => n((t) => ({
@@ -39936,7 +39959,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
39936
39959
  ...e,
39937
39960
  stage: "adding"
39938
39961
  }));
39939
- let s = r.reopenable ? await NR(Oq(o.infoHash), r.root).then(() => !0).catch(() => !1) : !1, l = r.reopenable ? o.handles : await Promise.all(o.handles.map((e) => e ? PG(e) : Promise.resolve(null)));
39962
+ let s = r.reopenable ? await NR(Aq(o.infoHash), r.root).then(() => !0).catch(() => !1) : !1, l = r.reopenable ? o.handles : await Promise.all(o.handles.map((e) => e ? IG(e) : Promise.resolve(null)));
39940
39963
  e.createSource({
39941
39964
  infoHash: o.infoHash,
39942
39965
  magnet: o.magnet,
@@ -39979,10 +40002,10 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
39979
40002
  }, []), m = (0, v.useCallback)(() => {
39980
40003
  o.current?.abort();
39981
40004
  }, []), h = (0, v.useCallback)(() => {
39982
- o.current?.abort(), a.current = null, n(Dq);
40005
+ o.current?.abort(), a.current = null, n(kq);
39983
40006
  }, []);
39984
40007
  return {
39985
- supported: Mq(),
40008
+ supported: Pq(),
39986
40009
  state: t,
39987
40010
  suggestedName: r,
39988
40011
  pickFolder: u,
@@ -39992,9 +40015,9 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
39992
40015
  cancel: m,
39993
40016
  reset: h
39994
40017
  };
39995
- }, Iq = (e, t, n) => {
40018
+ }, Rq = (e, t, n) => {
39996
40019
  let [r, i] = (0, v.useState)([]), a = (0, v.useRef)(/* @__PURE__ */ new Set()), o = (0, v.useCallback)(async (t, n) => {
39997
- let r = await Pq(n, {}), i = JU({
40020
+ let r = await Iq(n, {}), i = JU({
39998
40021
  name: t.name ?? n.name,
39999
40022
  files: r.files.map(({ path: e, size: t }) => ({
40000
40023
  path: e,
@@ -40019,9 +40042,9 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
40019
40042
  return (async () => {
40020
40043
  let n = t.filter((e) => gB(e) && !a.current.has(e.infoHash)), r = [];
40021
40044
  for (let e of n) {
40022
- let t = await MR(Oq(e.infoHash)).catch(() => void 0);
40045
+ let t = await MR(Aq(e.infoHash)).catch(() => void 0);
40023
40046
  if (t) {
40024
- if (await Aq(t) === "granted") {
40047
+ if (await Mq(t) === "granted") {
40025
40048
  await o(e, t).catch(() => r.push({
40026
40049
  entry: e,
40027
40050
  name: t.name
@@ -40047,8 +40070,8 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
40047
40070
  allow: (0, v.useCallback)(async (e) => {
40048
40071
  let n = t.find((t) => t.infoHash === e);
40049
40072
  if (!n) return !1;
40050
- let r = await MR(Oq(e)).catch(() => void 0);
40051
- if (!r || !await jq(r)) return !1;
40073
+ let r = await MR(Aq(e)).catch(() => void 0);
40074
+ if (!r || !await Nq(r)) return !1;
40052
40075
  try {
40053
40076
  return await o(n, r), i((t) => t.filter((t) => t.entry.infoHash !== e)), !0;
40054
40077
  } catch {
@@ -40056,8 +40079,8 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
40056
40079
  }
40057
40080
  }, [t, o])
40058
40081
  };
40059
- }, Lq = ({ persist: e, onAsk: t }) => {
40060
- let n = (0, v.useRef)(!1), [r, i] = (0, v.useState)(!1), a = xG(e);
40082
+ }, zq = ({ persist: e, onAsk: t }) => {
40083
+ let n = (0, v.useRef)(!1), [r, i] = (0, v.useState)(!1), a = CG(e);
40061
40084
  return /* @__PURE__ */ G("div", {
40062
40085
  className: "folder",
40063
40086
  children: [/* @__PURE__ */ W("span", { children: "Storage" }), /* @__PURE__ */ W("button", {
@@ -40071,18 +40094,18 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
40071
40094
  children: a.label
40072
40095
  })]
40073
40096
  });
40074
- }, Rq = {
40097
+ }, Bq = {
40075
40098
  peers: [],
40076
40099
  trackers: [],
40077
40100
  loaded: !1
40078
- }, zq = (e) => {
40079
- let t = gR(), [n, r] = (0, v.useState)(Rq);
40101
+ }, Vq = (e) => {
40102
+ let t = gR(), [n, r] = (0, v.useState)(Bq);
40080
40103
  return (0, v.useEffect)(() => {
40081
40104
  if (e == null) {
40082
- r(Rq), t.inspect(null);
40105
+ r(Bq), t.inspect(null);
40083
40106
  return;
40084
40107
  }
40085
- r(Rq), t.inspect(e);
40108
+ r(Bq), t.inspect(e);
40086
40109
  let n = t.onDetail((t) => {
40087
40110
  t && t.handle === e && r({
40088
40111
  peers: t.peers,
@@ -40094,89 +40117,89 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
40094
40117
  n(), t.inspect(null);
40095
40118
  };
40096
40119
  }, [t, e]), n;
40097
- }, Bq = [
40120
+ }, Hq = [
40098
40121
  "general",
40099
40122
  "files",
40100
40123
  "peers",
40101
40124
  "trackers"
40102
- ], Vq = {
40125
+ ], Uq = {
40103
40126
  general: "General",
40104
40127
  files: "Content",
40105
40128
  peers: "Peers",
40106
40129
  trackers: "Trackers"
40107
- }, Hq = "ripple:dock-height", Uq = 140, Wq = 720, Gq = 300, Kq = (e) => bS(e, !0), qq = (e) => `${Kq(e)}/s`, Jq = (e) => `${(e * 100).toFixed(e > 0 && e < .01 ? 2 : 0)}%`, Yq = (e) => {
40130
+ }, Wq = "ripple:dock-height", Gq = 140, Kq = 720, qq = 300, Jq = (e) => bS(e, !0), Yq = (e) => `${Jq(e)}/s`, Xq = (e) => `${(e * 100).toFixed(e > 0 && e < .01 ? 2 : 0)}%`, Zq = (e) => {
40108
40131
  let t = e.lastIndexOf("/");
40109
40132
  return t < 0 ? ["", e] : [e.slice(0, t + 1), e.slice(t + 1)];
40110
- }, Xq = (e) => e < 0 ? "-" : e < 60 ? `${e}s` : e < 3600 ? `${Math.round(e / 60)}m` : e < 86400 ? `${Math.floor(e / 3600)}h ${Math.round(e % 3600 / 60)}m` : `${Math.floor(e / 86400)}d ${Math.round(e % 86400 / 3600)}h`, Zq = (e) => e > 0 ? (/* @__PURE__ */ new Date(e * 1e3)).toLocaleString() : "Not yet", Qq = (e) => e.allTimeDownload === 0 ? e.allTimeUpload > 0 ? "∞" : "0.00" : (e.allTimeUpload / e.allTimeDownload).toFixed(2), $q = ({ label: e, value: t, mono: n }) => /* @__PURE__ */ G("div", {
40133
+ }, Qq = (e) => e < 0 ? "-" : e < 60 ? `${e}s` : e < 3600 ? `${Math.round(e / 60)}m` : e < 86400 ? `${Math.floor(e / 3600)}h ${Math.round(e % 3600 / 60)}m` : `${Math.floor(e / 86400)}d ${Math.round(e % 86400 / 3600)}h`, $q = (e) => e > 0 ? (/* @__PURE__ */ new Date(e * 1e3)).toLocaleString() : "Not yet", eJ = (e) => e.allTimeDownload === 0 ? e.allTimeUpload > 0 ? "∞" : "0.00" : (e.allTimeUpload / e.allTimeDownload).toFixed(2), tJ = ({ label: e, value: t, mono: n }) => /* @__PURE__ */ G("div", {
40111
40134
  className: "fact",
40112
40135
  children: [/* @__PURE__ */ W("label", { children: e }), /* @__PURE__ */ W("span", {
40113
40136
  className: n ? "mono" : void 0,
40114
40137
  children: t
40115
40138
  })]
40116
- }), eJ = ({ t: e }) => {
40139
+ }), nJ = ({ t: e }) => {
40117
40140
  let t = e.stats, n = Math.max(0, e.size - e.downloaded);
40118
40141
  return /* @__PURE__ */ G("div", {
40119
40142
  className: "general",
40120
40143
  children: [/* @__PURE__ */ G("section", { children: [/* @__PURE__ */ W("h3", { children: "Transfer" }), /* @__PURE__ */ G("div", {
40121
40144
  className: "facts",
40122
40145
  children: [
40123
- /* @__PURE__ */ W($q, {
40146
+ /* @__PURE__ */ W(tJ, {
40124
40147
  label: "Time active",
40125
- value: t ? `${Xq(t.activeSeconds)} (${Xq(t.sessionActiveSeconds)} this session)` : "-"
40148
+ value: t ? `${Qq(t.activeSeconds)} (${Qq(t.sessionActiveSeconds)} this session)` : "-"
40126
40149
  }),
40127
- /* @__PURE__ */ W($q, {
40150
+ /* @__PURE__ */ W(tJ, {
40128
40151
  label: "Time left",
40129
40152
  value: e.state === "downloading" && e.eta !== "-" ? e.eta : "-"
40130
40153
  }),
40131
- /* @__PURE__ */ W($q, {
40154
+ /* @__PURE__ */ W(tJ, {
40132
40155
  label: "Connections",
40133
40156
  value: t ? `${t.numConnections}${t.connectionsLimit > 0 ? ` of ${t.connectionsLimit}` : ""}` : "-"
40134
40157
  }),
40135
- /* @__PURE__ */ W($q, {
40158
+ /* @__PURE__ */ W(tJ, {
40136
40159
  label: "Downloaded",
40137
- value: t ? `${Kq(t.allTimeDownload)} (${Kq(t.sessionDownload)} this session)` : Kq(e.downloaded)
40160
+ value: t ? `${Jq(t.allTimeDownload)} (${Jq(t.sessionDownload)} this session)` : Jq(e.downloaded)
40138
40161
  }),
40139
- /* @__PURE__ */ W($q, {
40162
+ /* @__PURE__ */ W(tJ, {
40140
40163
  label: "Uploaded",
40141
- value: t ? `${Kq(t.allTimeUpload)} (${Kq(t.sessionUpload)} this session)` : "-"
40164
+ value: t ? `${Jq(t.allTimeUpload)} (${Jq(t.sessionUpload)} this session)` : "-"
40142
40165
  }),
40143
- /* @__PURE__ */ W($q, {
40166
+ /* @__PURE__ */ W(tJ, {
40144
40167
  label: "Seeds",
40145
40168
  value: t ? `${e.seeds} connected${t.swarmSeeds >= 0 ? ` of ${t.swarmSeeds} known` : ""}` : String(e.seeds)
40146
40169
  }),
40147
- /* @__PURE__ */ W($q, {
40170
+ /* @__PURE__ */ W(tJ, {
40148
40171
  label: "Download speed",
40149
- value: qq(e.down)
40172
+ value: Yq(e.down)
40150
40173
  }),
40151
- /* @__PURE__ */ W($q, {
40174
+ /* @__PURE__ */ W(tJ, {
40152
40175
  label: "Upload speed",
40153
- value: qq(e.up)
40176
+ value: Yq(e.up)
40154
40177
  }),
40155
- /* @__PURE__ */ W($q, {
40178
+ /* @__PURE__ */ W(tJ, {
40156
40179
  label: "Peers",
40157
40180
  value: t ? `${e.peers} connected${t.swarmPeers >= 0 ? ` of ${t.swarmPeers} known` : ""}` : String(e.peers)
40158
40181
  }),
40159
- /* @__PURE__ */ W($q, {
40182
+ /* @__PURE__ */ W(tJ, {
40160
40183
  label: "Share ratio",
40161
- value: t ? Qq(t) : "-"
40184
+ value: t ? eJ(t) : "-"
40162
40185
  }),
40163
- /* @__PURE__ */ W($q, {
40186
+ /* @__PURE__ */ W(tJ, {
40164
40187
  label: "Wasted",
40165
- value: t ? Kq(t.wasted) : "-"
40188
+ value: t ? Jq(t.wasted) : "-"
40166
40189
  }),
40167
- /* @__PURE__ */ W($q, {
40190
+ /* @__PURE__ */ W(tJ, {
40168
40191
  label: "Remaining",
40169
- value: n === 0 ? "Nothing" : Kq(n)
40192
+ value: n === 0 ? "Nothing" : Jq(n)
40170
40193
  }),
40171
- /* @__PURE__ */ W($q, {
40194
+ /* @__PURE__ */ W(tJ, {
40172
40195
  label: "Seeding for",
40173
- value: t ? `${Xq(t.seedingSeconds)} (${Xq(t.sessionSeedingSeconds)} this session)` : "-"
40196
+ value: t ? `${Qq(t.seedingSeconds)} (${Qq(t.sessionSeedingSeconds)} this session)` : "-"
40174
40197
  }),
40175
- /* @__PURE__ */ W($q, {
40198
+ /* @__PURE__ */ W(tJ, {
40176
40199
  label: "Availability",
40177
40200
  value: t && t.availability >= 0 ? t.availability.toFixed(2) : "-"
40178
40201
  }),
40179
- /* @__PURE__ */ W($q, {
40202
+ /* @__PURE__ */ W(tJ, {
40180
40203
  label: "Inbound peers",
40181
40204
  value: t ? t.hadIncoming ? "Yes" : "None yet" : "-"
40182
40205
  })
@@ -40184,55 +40207,55 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
40184
40207
  })] }), /* @__PURE__ */ G("section", { children: [/* @__PURE__ */ W("h3", { children: "Information" }), /* @__PURE__ */ G("div", {
40185
40208
  className: "facts",
40186
40209
  children: [
40187
- /* @__PURE__ */ W($q, {
40210
+ /* @__PURE__ */ W(tJ, {
40188
40211
  label: "Total size",
40189
- value: Kq(e.size)
40212
+ value: Jq(e.size)
40190
40213
  }),
40191
- /* @__PURE__ */ W($q, {
40214
+ /* @__PURE__ */ W(tJ, {
40192
40215
  label: "Pieces",
40193
- value: t && t.numPieces ? `${t.numPieces} x ${Kq(t.pieceLength)} (have ${t.numPiecesHave})` : "-"
40216
+ value: t && t.numPieces ? `${t.numPieces} x ${Jq(t.pieceLength)} (have ${t.numPiecesHave})` : "-"
40194
40217
  }),
40195
- /* @__PURE__ */ W($q, {
40218
+ /* @__PURE__ */ W(tJ, {
40196
40219
  label: "Progress",
40197
- value: Jq(e.progress)
40220
+ value: Xq(e.progress)
40198
40221
  }),
40199
- /* @__PURE__ */ W($q, {
40222
+ /* @__PURE__ */ W(tJ, {
40200
40223
  label: "Added on",
40201
- value: t ? Zq(t.addedAt) : "-"
40224
+ value: t ? $q(t.addedAt) : "-"
40202
40225
  }),
40203
- /* @__PURE__ */ W($q, {
40226
+ /* @__PURE__ */ W(tJ, {
40204
40227
  label: "Completed on",
40205
- value: t ? Zq(t.completedAt) : "-"
40228
+ value: t ? $q(t.completedAt) : "-"
40206
40229
  }),
40207
- /* @__PURE__ */ W($q, {
40230
+ /* @__PURE__ */ W(tJ, {
40208
40231
  label: "Last seen complete",
40209
- value: t ? Zq(t.lastSeenComplete) : "-"
40232
+ value: t ? $q(t.lastSeenComplete) : "-"
40210
40233
  }),
40211
- /* @__PURE__ */ W($q, {
40234
+ /* @__PURE__ */ W(tJ, {
40212
40235
  label: "Files",
40213
40236
  value: String(uV(e.files).length)
40214
40237
  }),
40215
- /* @__PURE__ */ W($q, {
40238
+ /* @__PURE__ */ W(tJ, {
40216
40239
  label: "Save path",
40217
40240
  value: t?.savePath || "-",
40218
40241
  mono: !0
40219
40242
  }),
40220
- e.infoHash && /* @__PURE__ */ W($q, {
40243
+ e.infoHash && /* @__PURE__ */ W(tJ, {
40221
40244
  label: "Info hash",
40222
40245
  value: e.infoHash,
40223
40246
  mono: !0
40224
40247
  }),
40225
- e.retry && /* @__PURE__ */ W($q, {
40248
+ e.retry && /* @__PURE__ */ W(tJ, {
40226
40249
  label: "Retrying",
40227
40250
  value: `attempt ${e.retry.attempt}${e.retry.message ? `, ${e.retry.message}` : ""}`
40228
40251
  })
40229
40252
  ]
40230
40253
  })] })]
40231
40254
  });
40232
- }, tJ = ({ files: e, saving: t, onSave: n }) => e.length ? /* @__PURE__ */ W("div", {
40255
+ }, rJ = ({ files: e, saving: t, onSave: n }) => e.length ? /* @__PURE__ */ W("div", {
40233
40256
  className: "rows",
40234
40257
  children: e.map((e) => {
40235
- let [r, i] = Yq(e.name), a = t[e.index];
40258
+ let [r, i] = Zq(e.name), a = t[e.index];
40236
40259
  return /* @__PURE__ */ G("div", {
40237
40260
  className: "row file",
40238
40261
  children: [
@@ -40245,7 +40268,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
40245
40268
  }),
40246
40269
  /* @__PURE__ */ W("span", {
40247
40270
  className: "num",
40248
- children: Kq(e.size)
40271
+ children: Jq(e.size)
40249
40272
  }),
40250
40273
  n && /* @__PURE__ */ W("button", {
40251
40274
  type: "button",
@@ -40259,10 +40282,10 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
40259
40282
  }) : /* @__PURE__ */ W("p", {
40260
40283
  className: "none",
40261
40284
  children: "No file list yet."
40262
- }), nJ = (e) => {
40285
+ }), iJ = (e) => {
40263
40286
  let t = [];
40264
40287
  return t.push(kS(e) === "utp" ? "uTP" : "TCP"), OS(e) && t.push("incoming"), e.flags & (TS.rc4Encrypted | TS.plaintextEncrypted) && t.push("encrypted"), e.flags & TS.seed && t.push("seed"), e.source & DS.dht ? t.push("DHT") : e.source & DS.pex ? t.push("PEX") : e.source & DS.tracker && t.push("tracker"), t;
40265
- }, rJ = ({ peers: e, loaded: t }) => {
40288
+ }, aJ = ({ peers: e, loaded: t }) => {
40266
40289
  if (!t) return /* @__PURE__ */ W("p", {
40267
40290
  className: "none",
40268
40291
  children: "Asking the engine…"
@@ -40316,7 +40339,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
40316
40339
  children: e.endpoint
40317
40340
  }), /* @__PURE__ */ W("span", {
40318
40341
  className: "tags",
40319
- children: nJ(e).map((e) => /* @__PURE__ */ W("span", {
40342
+ children: iJ(e).map((e) => /* @__PURE__ */ W("span", {
40320
40343
  className: "tag",
40321
40344
  children: e
40322
40345
  }, e))
@@ -40329,28 +40352,28 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
40329
40352
  }),
40330
40353
  /* @__PURE__ */ W("span", {
40331
40354
  className: "num",
40332
- children: Jq(e.progress)
40355
+ children: Xq(e.progress)
40333
40356
  }),
40334
40357
  /* @__PURE__ */ W("span", {
40335
40358
  className: "num",
40336
- children: e.downloadRate ? qq(e.downloadRate) : "-"
40359
+ children: e.downloadRate ? Yq(e.downloadRate) : "-"
40337
40360
  }),
40338
40361
  /* @__PURE__ */ W("span", {
40339
40362
  className: "num",
40340
- children: e.uploadRate ? qq(e.uploadRate) : "-"
40363
+ children: e.uploadRate ? Yq(e.uploadRate) : "-"
40341
40364
  }),
40342
40365
  /* @__PURE__ */ W("span", {
40343
40366
  className: "num",
40344
- children: e.totalDownload ? Kq(e.totalDownload) : "-"
40367
+ children: e.totalDownload ? Jq(e.totalDownload) : "-"
40345
40368
  }),
40346
40369
  /* @__PURE__ */ W("span", {
40347
40370
  className: "num",
40348
- children: e.totalUpload ? Kq(e.totalUpload) : "-"
40371
+ children: e.totalUpload ? Jq(e.totalUpload) : "-"
40349
40372
  })
40350
40373
  ]
40351
40374
  }, e.endpoint))]
40352
40375
  });
40353
- }, iJ = (e) => e.updating ? {
40376
+ }, oJ = (e) => e.updating ? {
40354
40377
  label: "Announcing…",
40355
40378
  tone: "idle"
40356
40379
  } : e.fails < 0 ? {
@@ -40362,7 +40385,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
40362
40385
  } : {
40363
40386
  label: `Failed ${e.fails}×`,
40364
40387
  tone: "warn"
40365
- }, aJ = ({ trackers: e, loaded: t }) => {
40388
+ }, sJ = ({ trackers: e, loaded: t }) => {
40366
40389
  if (!t) return /* @__PURE__ */ W("p", {
40367
40390
  className: "none",
40368
40391
  children: "Asking the engine…"
@@ -40403,7 +40426,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
40403
40426
  })
40404
40427
  ]
40405
40428
  }), n.map((e) => {
40406
- let t = iJ(e);
40429
+ let t = oJ(e);
40407
40430
  return /* @__PURE__ */ G("div", {
40408
40431
  className: "row",
40409
40432
  children: [
@@ -40431,19 +40454,19 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
40431
40454
  }),
40432
40455
  /* @__PURE__ */ W("span", {
40433
40456
  className: "num",
40434
- children: Xq(e.nextAnnounceIn)
40457
+ children: Qq(e.nextAnnounceIn)
40435
40458
  })
40436
40459
  ]
40437
40460
  }, e.url);
40438
40461
  })]
40439
40462
  });
40440
- }, oJ = () => {
40463
+ }, cJ = () => {
40441
40464
  try {
40442
- let e = Number(localStorage.getItem(Hq));
40443
- if (Number.isFinite(e) && e >= Uq && e <= Wq) return e;
40465
+ let e = Number(localStorage.getItem(Wq));
40466
+ if (Number.isFinite(e) && e >= Gq && e <= Kq) return e;
40444
40467
  } catch {}
40445
- return Gq;
40446
- }, sJ = St`
40468
+ return qq;
40469
+ }, lJ = St`
40447
40470
  flex: none;
40448
40471
  display: flex;
40449
40472
  flex-direction: column;
@@ -40780,16 +40803,16 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
40780
40803
  display: none;
40781
40804
  }
40782
40805
  }
40783
- `, cJ = ({ t: e, handle: t, saving: n, onSave: r, onClose: i }) => {
40784
- let [a, o] = (0, v.useState)("general"), [s, c] = (0, v.useState)(oJ), l = (0, v.useRef)(!1), u = zq(t), d = (0, v.useCallback)((e) => {
40806
+ `, uJ = ({ t: e, handle: t, saving: n, onSave: r, onClose: i }) => {
40807
+ let [a, o] = (0, v.useState)("general"), [s, c] = (0, v.useState)(cJ), l = (0, v.useRef)(!1), u = Vq(t), d = (0, v.useCallback)((e) => {
40785
40808
  e.preventDefault(), l.current = !0;
40786
40809
  let t = e.clientY, n = s, r = (e) => {
40787
- let r = Math.min(Wq, Math.max(Uq, n + (t - e.clientY)));
40810
+ let r = Math.min(Kq, Math.max(Gq, n + (t - e.clientY)));
40788
40811
  c(r);
40789
40812
  }, i = () => {
40790
40813
  l.current = !1, window.removeEventListener("pointermove", r), window.removeEventListener("pointerup", i), c((e) => {
40791
40814
  try {
40792
- localStorage.setItem(Hq, String(e));
40815
+ localStorage.setItem(Wq, String(e));
40793
40816
  } catch {}
40794
40817
  return e;
40795
40818
  });
@@ -40804,7 +40827,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
40804
40827
  };
40805
40828
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
40806
40829
  }, [i]), /* @__PURE__ */ G("section", {
40807
- css: sJ,
40830
+ css: lJ,
40808
40831
  style: { height: s },
40809
40832
  "aria-label": `Details for ${e.name}`,
40810
40833
  children: [
@@ -40830,13 +40853,13 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
40830
40853
  className: "tabs",
40831
40854
  role: "group",
40832
40855
  "aria-label": "Torrent details",
40833
- children: Bq.map((t) => /* @__PURE__ */ G("button", {
40856
+ children: Hq.map((t) => /* @__PURE__ */ G("button", {
40834
40857
  type: "button",
40835
40858
  "data-on": a === t || void 0,
40836
40859
  "aria-pressed": a === t,
40837
40860
  onClick: () => o(t),
40838
40861
  children: [
40839
- Vq[t],
40862
+ Uq[t],
40840
40863
  t === "peers" && u.peers.length > 0 && /* @__PURE__ */ W("span", {
40841
40864
  className: "count",
40842
40865
  children: u.peers.length
@@ -40851,17 +40874,17 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
40851
40874
  /* @__PURE__ */ G("div", {
40852
40875
  className: "pane",
40853
40876
  children: [
40854
- a === "general" && /* @__PURE__ */ W(eJ, { t: e }),
40855
- a === "files" && /* @__PURE__ */ W(tJ, {
40877
+ a === "general" && /* @__PURE__ */ W(nJ, { t: e }),
40878
+ a === "files" && /* @__PURE__ */ W(rJ, {
40856
40879
  files: uV(e.files),
40857
40880
  saving: n,
40858
40881
  onSave: t == null ? null : r
40859
40882
  }),
40860
- a === "peers" && /* @__PURE__ */ W(rJ, {
40883
+ a === "peers" && /* @__PURE__ */ W(aJ, {
40861
40884
  peers: u.peers,
40862
40885
  loaded: u.loaded
40863
40886
  }),
40864
- a === "trackers" && /* @__PURE__ */ W(aJ, {
40887
+ a === "trackers" && /* @__PURE__ */ W(sJ, {
40865
40888
  trackers: u.trackers,
40866
40889
  loaded: u.loaded
40867
40890
  })
@@ -40869,7 +40892,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
40869
40892
  })
40870
40893
  ]
40871
40894
  });
40872
- }, lJ = ({ className: e, style: t } = {}) => (0, v.createElement)("iframe", {
40895
+ }, dJ = ({ className: e, style: t } = {}) => (0, v.createElement)("iframe", {
40873
40896
  src: DL(),
40874
40897
  title: "Sign in to FKN",
40875
40898
  className: e,
@@ -40881,23 +40904,23 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
40881
40904
  colorScheme: "normal",
40882
40905
  ...t
40883
40906
  }
40884
- }), uJ = 8, dJ = 6, fJ = (e, t) => {
40907
+ }), fJ = 8, pJ = 6, mJ = (e, t) => {
40885
40908
  let n = window.innerWidth, r = window.innerHeight;
40886
40909
  if (e.kind === "pointer") {
40887
40910
  let { at: i } = e;
40888
40911
  return {
40889
- x: i.x + t.width + uJ > n ? Math.max(uJ, i.x - t.width) : i.x,
40890
- y: i.y + t.height + uJ > r ? Math.max(uJ, i.y - t.height) : i.y
40912
+ x: i.x + t.width + fJ > n ? Math.max(fJ, i.x - t.width) : i.x,
40913
+ y: i.y + t.height + fJ > r ? Math.max(fJ, i.y - t.height) : i.y
40891
40914
  };
40892
40915
  }
40893
40916
  let i = e.of.current?.getBoundingClientRect();
40894
40917
  if (!i) return null;
40895
- let a = Math.min(Math.max(uJ, i.right - t.width), Math.max(uJ, n - t.width - uJ)), o = i.bottom + dJ, s = i.top - dJ - t.height;
40918
+ let a = Math.min(Math.max(fJ, i.right - t.width), Math.max(fJ, n - t.width - fJ)), o = i.bottom + pJ, s = i.top - pJ - t.height;
40896
40919
  return {
40897
40920
  x: a,
40898
- y: o + t.height + uJ > r && s >= uJ ? s : o
40921
+ y: o + t.height + fJ > r && s >= fJ ? s : o
40899
40922
  };
40900
- }, pJ = St`
40923
+ }, hJ = St`
40901
40924
  position: fixed;
40902
40925
  z-index: 2000;
40903
40926
  min-width: 240px;
@@ -40991,11 +41014,11 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
40991
41014
  min-width: 0;
40992
41015
  }
40993
41016
  }
40994
- `, mJ = ({ on: e, radio: t }) => /* @__PURE__ */ W("span", {
41017
+ `, gJ = ({ on: e, radio: t }) => /* @__PURE__ */ W("span", {
40995
41018
  className: "tick",
40996
41019
  "aria-hidden": "true",
40997
41020
  children: e ? t ? "●" : "✓" : ""
40998
- }), hJ = (e) => e.disabled ? `${e.label}. ${e.disabled}` : e.hint, gJ = ({ groups: e, onChose: t }) => /* @__PURE__ */ W(Qa, { children: e.map((e) => /* @__PURE__ */ G("div", {
41021
+ }), _J = (e) => e.disabled ? `${e.label}. ${e.disabled}` : e.hint, vJ = ({ groups: e, onChose: t }) => /* @__PURE__ */ W(Qa, { children: e.map((e) => /* @__PURE__ */ G("div", {
40999
41022
  className: "group",
41000
41023
  role: "group",
41001
41024
  "aria-label": e.label,
@@ -41003,7 +41026,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
41003
41026
  let n = {
41004
41027
  type: "button",
41005
41028
  disabled: !!e.disabled,
41006
- title: hJ(e),
41029
+ title: _J(e),
41007
41030
  tabIndex: -1
41008
41031
  };
41009
41032
  return e.kind === "toggle" ? /* @__PURE__ */ G("button", {
@@ -41013,7 +41036,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
41013
41036
  onClick: () => {
41014
41037
  e.apply(!e.checked), t();
41015
41038
  },
41016
- children: [/* @__PURE__ */ W(mJ, { on: e.checked }), /* @__PURE__ */ W("span", {
41039
+ children: [/* @__PURE__ */ W(gJ, { on: e.checked }), /* @__PURE__ */ W("span", {
41017
41040
  className: "text",
41018
41041
  children: e.label
41019
41042
  })]
@@ -41024,7 +41047,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
41024
41047
  onClick: () => {
41025
41048
  e.apply(), t();
41026
41049
  },
41027
- children: [/* @__PURE__ */ W(mJ, {
41050
+ children: [/* @__PURE__ */ W(gJ, {
41028
41051
  on: e.selected,
41029
41052
  radio: !0
41030
41053
  }), /* @__PURE__ */ W("span", {
@@ -41038,13 +41061,13 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
41038
41061
  onClick: () => {
41039
41062
  e.run(), t();
41040
41063
  },
41041
- children: [/* @__PURE__ */ W(mJ, { on: !1 }), /* @__PURE__ */ W("span", {
41064
+ children: [/* @__PURE__ */ W(gJ, { on: !1 }), /* @__PURE__ */ W("span", {
41042
41065
  className: "text",
41043
41066
  children: e.label
41044
41067
  })]
41045
41068
  }, e.id);
41046
41069
  })]
41047
- }, e.id)) }), _J = ({ placement: e, label: t, onClose: n, children: r }) => {
41070
+ }, e.id)) }), yJ = ({ placement: e, label: t, onClose: n, children: r }) => {
41048
41071
  let i = (0, v.useRef)(null), [a, o] = (0, v.useState)(e.kind === "pointer" ? e.at : {
41049
41072
  x: -9999,
41050
41073
  y: -9999
@@ -41053,7 +41076,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
41053
41076
  let c = (0, v.useRef)(e.kind === "pointer").current, l = (0, v.useCallback)(() => {
41054
41077
  let e = i.current;
41055
41078
  if (!e) return;
41056
- let t = fJ(s.current, e.getBoundingClientRect());
41079
+ let t = mJ(s.current, e.getBoundingClientRect());
41057
41080
  t && o(t);
41058
41081
  }, []);
41059
41082
  (0, v.useLayoutEffect)(l, [
@@ -41121,7 +41144,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
41121
41144
  document.removeEventListener("keydown", r), document.removeEventListener("pointerdown", a, !0), window.removeEventListener("scroll", o, !0), window.removeEventListener("resize", o);
41122
41145
  };
41123
41146
  }, [c]), /* @__PURE__ */ W("div", {
41124
- css: pJ,
41147
+ css: hJ,
41125
41148
  ref: i,
41126
41149
  role: "menu",
41127
41150
  "aria-label": t,
@@ -41133,19 +41156,19 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
41133
41156
  onContextMenu: c ? (e) => e.preventDefault() : void 0,
41134
41157
  children: r
41135
41158
  });
41136
- }, vJ = ({ groups: e, at: t, label: n, onClose: r }) => /* @__PURE__ */ W(_J, {
41159
+ }, bJ = ({ groups: e, at: t, label: n, onClose: r }) => /* @__PURE__ */ W(yJ, {
41137
41160
  placement: {
41138
41161
  kind: "pointer",
41139
41162
  at: t
41140
41163
  },
41141
41164
  label: n,
41142
41165
  onClose: r,
41143
- children: /* @__PURE__ */ W(gJ, {
41166
+ children: /* @__PURE__ */ W(vJ, {
41144
41167
  groups: e,
41145
41168
  onChose: r
41146
41169
  })
41147
- }), yJ = () => Promise.race([WP.info(), new Promise((e) => setTimeout(() => e(null), 4e3))]), bJ = () => {
41148
- let [e, t] = (0, v.useState)(null), [n, r] = (0, v.useState)(!1), i = (0, v.useCallback)(() => yJ().then((e) => {
41170
+ }), xJ = () => Promise.race([WP.info(), new Promise((e) => setTimeout(() => e(null), 4e3))]), SJ = () => {
41171
+ let [e, t] = (0, v.useState)(null), [n, r] = (0, v.useState)(!1), i = (0, v.useCallback)(() => xJ().then((e) => {
41149
41172
  t(e), r(!0);
41150
41173
  }).catch(() => r(!0)), []);
41151
41174
  return (0, v.useEffect)(() => {
@@ -41166,7 +41189,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
41166
41189
  await WP.logout().catch(() => {}), await i();
41167
41190
  }, [i])
41168
41191
  };
41169
- }, xJ = "https://fkn.app/account", SJ = 8e3, CJ = St`
41192
+ }, CJ = "https://fkn.app/account", wJ = 8e3, TJ = St`
41170
41193
  flex: none;
41171
41194
  display: inline-flex;
41172
41195
  align-items: center;
@@ -41238,7 +41261,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
41238
41261
  outline: none;
41239
41262
  box-shadow: 0 0 0 2px ${cS};
41240
41263
  }
41241
- `, wJ = St`
41264
+ `, EJ = St`
41242
41265
  display: flex;
41243
41266
  align-items: center;
41244
41267
  gap: 8px;
@@ -41276,21 +41299,21 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
41276
41299
  height: 15px;
41277
41300
  color: ${Q};
41278
41301
  }
41279
- `, TJ = ({ onToast: e }) => {
41280
- let { info: t, ready: n, logout: r } = bJ(), i = (0, v.useRef)(null), [a, o] = (0, v.useState)(!1), [s, c] = (0, v.useState)(!1), l = (0, v.useRef)(0), u = (0, v.useCallback)(() => o(!1), []);
41302
+ `, DJ = ({ onToast: e }) => {
41303
+ let { info: t, ready: n, logout: r } = SJ(), i = (0, v.useRef)(null), [a, o] = (0, v.useState)(!1), [s, c] = (0, v.useState)(!1), l = (0, v.useRef)(0), u = (0, v.useCallback)(() => o(!1), []);
41281
41304
  (0, v.useEffect)(() => {
41282
41305
  t || (o(!1), c(!1), l.current && Date.now() - l.current <= 8e3 && (l.current = 0, e("Disconnected")));
41283
41306
  }, [t, e]);
41284
41307
  let d = async () => {
41285
41308
  l.current = Date.now(), c(!0);
41286
41309
  try {
41287
- await Promise.race([r(), new Promise((e) => setTimeout(e, SJ))]);
41310
+ await Promise.race([r(), new Promise((e) => setTimeout(e, wJ))]);
41288
41311
  } finally {
41289
41312
  c(!1), o(!1);
41290
41313
  }
41291
41314
  };
41292
41315
  if (!n) return null;
41293
- if (!t) return /* @__PURE__ */ W(lJ, { style: {
41316
+ if (!t) return /* @__PURE__ */ W(dJ, { style: {
41294
41317
  flex: "none",
41295
41318
  width: 140,
41296
41319
  height: 38
@@ -41298,7 +41321,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
41298
41321
  let f = t.name || "Account", p = t.premium ? "Premium" : "Free";
41299
41322
  return /* @__PURE__ */ G(Qa, { children: [/* @__PURE__ */ G("button", {
41300
41323
  className: "account-tag",
41301
- css: CJ,
41324
+ css: TJ,
41302
41325
  type: "button",
41303
41326
  ref: i,
41304
41327
  "aria-haspopup": "menu",
@@ -41318,7 +41341,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
41318
41341
  className: "chevron",
41319
41342
  "aria-hidden": "true"
41320
41343
  })]
41321
- }), a && (0, dK.createPortal)(/* @__PURE__ */ G(_J, {
41344
+ }), a && (0, pK.createPortal)(/* @__PURE__ */ G(yJ, {
41322
41345
  placement: {
41323
41346
  kind: "under",
41324
41347
  of: i
@@ -41326,10 +41349,10 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
41326
41349
  label: `Account: ${f}`,
41327
41350
  onClose: u,
41328
41351
  children: [/* @__PURE__ */ G("a", {
41329
- css: wJ,
41352
+ css: EJ,
41330
41353
  role: "menuitem",
41331
41354
  tabIndex: -1,
41332
- href: xJ,
41355
+ href: CJ,
41333
41356
  target: "_blank",
41334
41357
  rel: "noreferrer",
41335
41358
  onClick: u,
@@ -41338,7 +41361,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
41338
41361
  children: "Manage account"
41339
41362
  })]
41340
41363
  }), /* @__PURE__ */ G("button", {
41341
- css: wJ,
41364
+ css: EJ,
41342
41365
  type: "button",
41343
41366
  role: "menuitem",
41344
41367
  tabIndex: -1,
@@ -41352,7 +41375,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
41352
41375
  })]
41353
41376
  })]
41354
41377
  }), document.body)] });
41355
- }, EJ = St`
41378
+ }, OJ = St`
41356
41379
  color: ${Z};
41357
41380
  width: 100%;
41358
41381
  max-width: min(560px, calc(100vw - 32px));
@@ -41574,14 +41597,14 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
41574
41597
  }
41575
41598
  }
41576
41599
  }
41577
- `, DJ = ({ title: e, groups: t, onClose: n }) => {
41600
+ `, kJ = ({ title: e, groups: t, onClose: n }) => {
41578
41601
  let r = (0, v.useRef)(null);
41579
- return /* @__PURE__ */ W(gK, {
41602
+ return /* @__PURE__ */ W(vK, {
41580
41603
  labelledBy: "torrent-options-title",
41581
41604
  onClose: n,
41582
41605
  initialFocus: r,
41583
41606
  children: /* @__PURE__ */ W("div", {
41584
- css: EJ,
41607
+ css: OJ,
41585
41608
  children: /* @__PURE__ */ G("div", {
41586
41609
  className: "card",
41587
41610
  children: [
@@ -41671,10 +41694,10 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
41671
41694
  })
41672
41695
  })
41673
41696
  });
41674
- }, OJ = ({ dragging: e, overField: t, shareOpen: n }) => e ? n ? "share" : t ? "field" : "page" : null, kJ = Ct`
41697
+ }, AJ = ({ dragging: e, overField: t, shareOpen: n }) => e ? n ? "share" : t ? "field" : "page" : null, jJ = Ct`
41675
41698
  0%, 100% { opacity: 0.7; }
41676
41699
  50% { opacity: 0.25; }
41677
- `, AJ = St`
41700
+ `, MJ = St`
41678
41701
  .badge {
41679
41702
  flex: none;
41680
41703
  display: inline-flex;
@@ -41713,7 +41736,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
41713
41736
  color: ${Z};
41714
41737
 
41715
41738
  &::before {
41716
- animation: ${kJ} 1.6s ease-in-out infinite;
41739
+ animation: ${jJ} 1.6s ease-in-out infinite;
41717
41740
  }
41718
41741
  }
41719
41742
  &.seeding { color: ${Z}; }
@@ -41723,7 +41746,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
41723
41746
  color: ${Z};
41724
41747
 
41725
41748
  &::before {
41726
- animation: ${kJ} 1.6s ease-in-out infinite;
41749
+ animation: ${jJ} 1.6s ease-in-out infinite;
41727
41750
  }
41728
41751
  }
41729
41752
 
@@ -41733,7 +41756,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
41733
41756
  color: ${Q};
41734
41757
 
41735
41758
  &::before {
41736
- animation: ${kJ} 1.6s ease-in-out infinite;
41759
+ animation: ${jJ} 1.6s ease-in-out infinite;
41737
41760
  }
41738
41761
  }
41739
41762
 
@@ -41748,11 +41771,11 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
41748
41771
  color: ${Z};
41749
41772
 
41750
41773
  &::before {
41751
- animation: ${kJ} 1.6s ease-in-out infinite;
41774
+ animation: ${jJ} 1.6s ease-in-out infinite;
41752
41775
  }
41753
41776
  }
41754
41777
  }
41755
- `, jJ = (e) => e.ephemeral === !0, MJ = (e, t) => t === "all" ? [...e] : t === "temporary" ? e.filter(jJ) : e.filter((e) => !jJ(e)), NJ = {
41778
+ `, NJ = (e) => e.ephemeral === !0, PJ = (e, t) => t === "all" ? [...e] : t === "temporary" ? e.filter(NJ) : e.filter((e) => !NJ(e)), FJ = {
41756
41779
  added: "Date added",
41757
41780
  name: "Name",
41758
41781
  size: "Size",
@@ -41761,7 +41784,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
41761
41784
  up: "Upload speed",
41762
41785
  peers: "Peers",
41763
41786
  eta: "Time left"
41764
- }, PJ = {
41787
+ }, IJ = {
41765
41788
  added: "desc",
41766
41789
  name: "asc",
41767
41790
  size: "desc",
@@ -41770,7 +41793,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
41770
41793
  up: "desc",
41771
41794
  peers: "desc",
41772
41795
  eta: "asc"
41773
- }, FJ = (e) => e.state === "missing" ? 2 : +(e.state === "starting"), IJ = (e, t) => {
41796
+ }, LJ = (e) => e.state === "missing" ? 2 : +(e.state === "starting"), RJ = (e, t) => {
41774
41797
  let n = e.state === "starting" || e.state === "missing";
41775
41798
  switch (t) {
41776
41799
  case "name": return e.name;
@@ -41782,56 +41805,56 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
41782
41805
  case "up": return n ? null : e.up;
41783
41806
  case "peers": return n ? null : e.peers;
41784
41807
  }
41785
- }, LJ = (e, t) => (t.addedAt ?? 0) - (e.addedAt ?? 0) || e.id.localeCompare(t.id), RJ = (e, t) => (n, r) => {
41786
- if (FJ(n) !== FJ(r)) return FJ(n) - FJ(r);
41787
- let i = IJ(n, e), a = IJ(r, e);
41788
- if (i === null && a === null) return LJ(n, r);
41808
+ }, zJ = (e, t) => (t.addedAt ?? 0) - (e.addedAt ?? 0) || e.id.localeCompare(t.id), BJ = (e, t) => (n, r) => {
41809
+ if (LJ(n) !== LJ(r)) return LJ(n) - LJ(r);
41810
+ let i = RJ(n, e), a = RJ(r, e);
41811
+ if (i === null && a === null) return zJ(n, r);
41789
41812
  if (i === null) return 1;
41790
41813
  if (a === null) return -1;
41791
41814
  let o = typeof i == "string" ? i.localeCompare(a, void 0, {
41792
41815
  numeric: !0,
41793
41816
  sensitivity: "base"
41794
41817
  }) : i - a;
41795
- return o === 0 ? LJ(n, r) : t === "asc" ? o : -o;
41796
- }, zJ = (e, t, n) => [...e].sort(RJ(t, n)), BJ = [
41818
+ return o === 0 ? zJ(n, r) : t === "asc" ? o : -o;
41819
+ }, VJ = (e, t, n) => [...e].sort(BJ(t, n)), HJ = [
41797
41820
  "down",
41798
41821
  "up",
41799
41822
  "peers",
41800
41823
  "progress",
41801
41824
  "eta"
41802
- ], VJ = (e) => BJ.includes(e), HJ = ({ viewChanged: e, idsChanged: t, volatile: n, interacting: r, sinceMs: i }) => e || t || !n || i > 1e4 || i > 2e3 && !r, UJ = "ripple:list-filter", WJ = "ripple:list-sort", GJ = "ripple:list-view", KJ = (e) => e === "all" || e === "library" || e === "temporary", qJ = (e) => e === "cards" || e === "table", JJ = (e) => typeof e == "string" && e in NJ, YJ = (e) => e === "asc" || e === "desc", XJ = (e) => {
41825
+ ], UJ = (e) => HJ.includes(e), WJ = ({ viewChanged: e, idsChanged: t, volatile: n, interacting: r, sinceMs: i }) => e || t || !n || i > 1e4 || i > 2e3 && !r, GJ = "ripple:list-filter", KJ = "ripple:list-sort", qJ = "ripple:list-view", JJ = (e) => e === "all" || e === "library" || e === "temporary", YJ = (e) => e === "cards" || e === "table", XJ = (e) => typeof e == "string" && e in FJ, ZJ = (e) => e === "asc" || e === "desc", QJ = (e) => {
41803
41826
  try {
41804
- let t = e(UJ);
41805
- return KJ(t) ? t : "all";
41827
+ let t = e(GJ);
41828
+ return JJ(t) ? t : "all";
41806
41829
  } catch {
41807
41830
  return "all";
41808
41831
  }
41809
- }, ZJ = (e) => {
41832
+ }, $J = (e) => {
41810
41833
  try {
41811
- let t = e(GJ);
41812
- return qJ(t) ? t : "cards";
41834
+ let t = e(qJ);
41835
+ return YJ(t) ? t : "cards";
41813
41836
  } catch {
41814
41837
  return "cards";
41815
41838
  }
41816
- }, QJ = {
41839
+ }, eY = {
41817
41840
  key: "added",
41818
41841
  dir: "desc"
41819
- }, $J = (e) => {
41842
+ }, tY = (e) => {
41820
41843
  try {
41821
41844
  let [t, n] = (e("ripple:list-sort") ?? "").split(":");
41822
- return JJ(t) && YJ(n) ? {
41845
+ return XJ(t) && ZJ(n) ? {
41823
41846
  key: t,
41824
41847
  dir: n
41825
- } : QJ;
41848
+ } : eY;
41826
41849
  } catch {
41827
- return QJ;
41850
+ return eY;
41828
41851
  }
41829
- }, eY = (e, t) => `${e}:${t}`, tY = St`
41852
+ }, nY = (e, t) => `${e}:${t}`, rY = St`
41830
41853
  width: 100%;
41831
41854
  border-collapse: collapse;
41832
41855
  font-size: 0.82rem;
41833
41856
 
41834
- ${AJ}
41857
+ ${MJ}
41835
41858
 
41836
41859
  th, td {
41837
41860
  text-align: left;
@@ -41942,7 +41965,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
41942
41965
  @media (max-width: 940px) { .c-up { display: none; } }
41943
41966
  @media (max-width: 820px) { .c-peers { display: none; } }
41944
41967
  @media (max-width: 700px) { .c-size { display: none; } }
41945
- `, nY = [
41968
+ `, iY = [
41946
41969
  {
41947
41970
  key: "name",
41948
41971
  label: "Name"
@@ -41987,10 +42010,10 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
41987
42010
  cls: "c-added",
41988
42011
  num: !0
41989
42012
  }
41990
- ], rY = ({ torrents: e, sortKey: t, sortDir: n, onSort: r, selectedId: i, onSelect: a, onOptions: o }) => /* @__PURE__ */ G("table", {
41991
- css: tY,
42013
+ ], aY = ({ torrents: e, sortKey: t, sortDir: n, onSort: r, selectedId: i, onSelect: a, onOptions: o }) => /* @__PURE__ */ G("table", {
42014
+ css: rY,
41992
42015
  className: "torrent-table",
41993
- children: [/* @__PURE__ */ W("thead", { children: /* @__PURE__ */ W("tr", { children: nY.map((e) => {
42016
+ children: [/* @__PURE__ */ W("thead", { children: /* @__PURE__ */ W("tr", { children: iY.map((e) => {
41994
42017
  let i = e.key !== null && e.key === t;
41995
42018
  return /* @__PURE__ */ W("th", {
41996
42019
  scope: "col",
@@ -42003,8 +42026,8 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
42003
42026
  children: e.label
42004
42027
  }) : /* @__PURE__ */ G("button", {
42005
42028
  type: "button",
42006
- onClick: () => r(e.key, i ? n === "asc" ? "desc" : "asc" : PJ[e.key]),
42007
- ...GV(`Sort by ${NJ[e.key]}`),
42029
+ onClick: () => r(e.key, i ? n === "asc" ? "desc" : "asc" : IJ[e.key]),
42030
+ ...GV(`Sort by ${FJ[e.key]}`),
42008
42031
  children: [e.label, i && /* @__PURE__ */ W("span", {
42009
42032
  className: "arrow",
42010
42033
  "aria-hidden": "true",
@@ -42070,16 +42093,16 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
42070
42093
  className: "c-status",
42071
42094
  children: /* @__PURE__ */ W("span", {
42072
42095
  className: "badge " + e.state,
42073
- children: qW[e.state]
42096
+ children: YW[e.state]
42074
42097
  })
42075
42098
  }),
42076
42099
  /* @__PURE__ */ W("td", {
42077
42100
  className: "c-down num",
42078
- children: e.down > 0 ? JW(e.down) : "-"
42101
+ children: e.down > 0 ? XW(e.down) : "-"
42079
42102
  }),
42080
42103
  /* @__PURE__ */ W("td", {
42081
42104
  className: "c-up num",
42082
- children: e.up > 0 ? JW(e.up) : "-"
42105
+ children: e.up > 0 ? XW(e.up) : "-"
42083
42106
  }),
42084
42107
  /* @__PURE__ */ W("td", {
42085
42108
  className: "c-peers num",
@@ -42087,19 +42110,19 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
42087
42110
  }),
42088
42111
  /* @__PURE__ */ W("td", {
42089
42112
  className: "c-added num",
42090
- children: YW(e.addedAt)
42113
+ children: ZW(e.addedAt)
42091
42114
  })
42092
42115
  ]
42093
42116
  }, e.id)) })]
42094
- }), iY = (e, t, n, r, i = () => Date.now()) => {
42095
- let a = (0, v.useRef)([]), o = (0, v.useRef)(0), s = (0, v.useRef)(""), c = (0, v.useRef)(!1), l = MJ(e, t), u = new Map(l.map((e) => [e.id, e])), d = `${t}:${n}:${r}`;
42096
- HJ({
42117
+ }), oY = (e, t, n, r, i = () => Date.now()) => {
42118
+ let a = (0, v.useRef)([]), o = (0, v.useRef)(0), s = (0, v.useRef)(""), c = (0, v.useRef)(!1), l = PJ(e, t), u = new Map(l.map((e) => [e.id, e])), d = `${t}:${n}:${r}`;
42119
+ WJ({
42097
42120
  viewChanged: s.current !== d,
42098
42121
  idsChanged: a.current.length !== l.length || a.current.some((e) => !u.has(e)),
42099
- volatile: VJ(n),
42122
+ volatile: UJ(n),
42100
42123
  interacting: c.current,
42101
42124
  sinceMs: i() - o.current
42102
- }) && (a.current = zJ(l, n, r).map((e) => e.id), o.current = i(), s.current = d);
42125
+ }) && (a.current = VJ(l, n, r).map((e) => e.id), o.current = i(), s.current = d);
42103
42126
  let f = [], p = /* @__PURE__ */ new Set();
42104
42127
  for (let e of a.current) {
42105
42128
  let t = u.get(e);
@@ -42123,7 +42146,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
42123
42146
  }, [])
42124
42147
  }
42125
42148
  };
42126
- }, aY = St`
42149
+ }, sY = St`
42127
42150
  flex: none;
42128
42151
  display: flex;
42129
42152
  align-items: center;
@@ -42223,8 +42246,8 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
42223
42246
 
42224
42247
  /* pushed to the far end: it changes the shape of the page rather than its contents */
42225
42248
  .views { margin-left: auto; }
42226
- `, oY = ({ filter: e, onFilter: t, sortKey: n, sortDir: r, onSort: i, view: a, onView: o, temporaryCount: s }) => /* @__PURE__ */ G("div", {
42227
- css: aY,
42249
+ `, cY = ({ filter: e, onFilter: t, sortKey: n, sortDir: r, onSort: i, view: a, onView: o, temporaryCount: s }) => /* @__PURE__ */ G("div", {
42250
+ css: sY,
42228
42251
  className: "list-toolbar",
42229
42252
  children: [
42230
42253
  s > 0 && /* @__PURE__ */ G("div", {
@@ -42265,11 +42288,11 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
42265
42288
  value: n,
42266
42289
  onChange: (e) => {
42267
42290
  let t = e.target.value;
42268
- i(t, PJ[t]);
42291
+ i(t, IJ[t]);
42269
42292
  },
42270
- children: Object.keys(NJ).map((e) => /* @__PURE__ */ W("option", {
42293
+ children: Object.keys(FJ).map((e) => /* @__PURE__ */ W("option", {
42271
42294
  value: e,
42272
- children: NJ[e]
42295
+ children: FJ[e]
42273
42296
  }, e))
42274
42297
  })]
42275
42298
  }),
@@ -42300,22 +42323,22 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
42300
42323
  })]
42301
42324
  })
42302
42325
  ]
42303
- }), sY = (e, t) => (e.flags & t) !== 0, cY = (e) => e.state === "missing", lY = (e) => cY(e) || e.state === "starting", uY = (e, t, n = { savedToUserStorage: !1 }) => {
42304
- let r = lY(e) ? cY(e) ? "Not on this device" : "Still starting" : void 0, i = e.progress >= 1, a = sY(e, ES.sequentialDownload), o = uV(e.files).length > 1, s = n.sessionLimits ?? {
42326
+ }), lY = (e, t) => (e.flags & t) !== 0, uY = (e) => e.state === "missing", dY = (e) => uY(e) || e.state === "starting", fY = (e, t, n = { savedToUserStorage: !1 }) => {
42327
+ let r = dY(e) ? uY(e) ? "Not on this device" : "Still starting" : void 0, i = e.progress >= 1, a = lY(e, ES.sequentialDownload), o = uV(e.files).length > 1, s = n.sessionLimits ?? {
42305
42328
  down: 0,
42306
42329
  up: 0
42307
42330
  }, c = [];
42308
- yU(e) && !cY(e) && c.push({
42331
+ yU(e) && !uY(e) && c.push({
42309
42332
  kind: "action",
42310
42333
  id: "watch",
42311
42334
  label: "Watch",
42312
42335
  run: t.watch
42313
- }), cY(e) && e.saveTo !== "source" && c.push({
42336
+ }), uY(e) && e.saveTo !== "source" && c.push({
42314
42337
  kind: "action",
42315
42338
  id: "start",
42316
42339
  label: "Download to this device",
42317
42340
  run: t.start
42318
- }), uV(e.files).length && i && !cY(e) && c.push({
42341
+ }), uV(e.files).length && i && !uY(e) && c.push({
42319
42342
  kind: "action",
42320
42343
  id: "save",
42321
42344
  label: o ? "Save as a zip" : "Save to disk",
@@ -42334,7 +42357,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
42334
42357
  kind: "action",
42335
42358
  id: "save-torrent-file",
42336
42359
  label: "Save .torrent",
42337
- disabled: e.files?.length ? void 0 : cY(e) ? "Not on this device" : "Waiting for metadata",
42360
+ disabled: e.files?.length ? void 0 : uY(e) ? "Not on this device" : "Waiting for metadata",
42338
42361
  run: t.saveTorrentFile
42339
42362
  }));
42340
42363
  let l = [];
@@ -42361,7 +42384,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
42361
42384
  id: "retry-now",
42362
42385
  label: "Try again now",
42363
42386
  run: t.retryNow
42364
- }), cY(e) ? u.push({
42387
+ }), uY(e) ? u.push({
42365
42388
  kind: "action",
42366
42389
  id: "remove",
42367
42390
  label: "Remove from the library",
@@ -42383,8 +42406,8 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
42383
42406
  id: "maintenance",
42384
42407
  label: "Manage",
42385
42408
  items: u
42386
- }), n.folderReady && !lY(e)) {
42387
- let e = n.intended ?? "browser", r = $G(QG({
42409
+ }), n.folderReady && !dY(e)) {
42410
+ let e = n.intended ?? "browser", r = tK(eK({
42388
42411
  current: n.current ?? "browser",
42389
42412
  intended: e,
42390
42413
  complete: i,
@@ -42494,7 +42517,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
42494
42517
  kind: "toggle",
42495
42518
  id: "dht",
42496
42519
  label: "Disable DHT for this torrent",
42497
- checked: sY(e, ES.disableDht),
42520
+ checked: lY(e, ES.disableDht),
42498
42521
  disabled: r,
42499
42522
  apply: (e) => t.setFlags(e ? ES.disableDht : 0, ES.disableDht)
42500
42523
  },
@@ -42502,7 +42525,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
42502
42525
  kind: "toggle",
42503
42526
  id: "pex",
42504
42527
  label: "Disable PeX for this torrent",
42505
- checked: sY(e, ES.disablePex),
42528
+ checked: lY(e, ES.disablePex),
42506
42529
  disabled: r,
42507
42530
  apply: (e) => t.setFlags(e ? ES.disablePex : 0, ES.disablePex)
42508
42531
  },
@@ -42521,18 +42544,18 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
42521
42544
  kind: "toggle",
42522
42545
  id: "upload-only",
42523
42546
  label: "Upload mode",
42524
- checked: sY(e, ES.uploadMode),
42547
+ checked: lY(e, ES.uploadMode),
42525
42548
  disabled: r,
42526
42549
  apply: (e) => t.setFlags(e ? ES.uploadMode : 0, ES.uploadMode)
42527
42550
  }, {
42528
42551
  kind: "toggle",
42529
42552
  id: "super-seed",
42530
42553
  label: "Super seeding mode",
42531
- checked: sY(e, ES.superSeeding),
42554
+ checked: lY(e, ES.superSeeding),
42532
42555
  disabled: r ?? (i ? void 0 : "Available once downloaded"),
42533
42556
  apply: (e) => t.setFlags(e ? ES.superSeeding : 0, ES.superSeeding)
42534
42557
  }]
42535
- }), e.queuePosition >= 0 && !cY(e) && l.push({
42558
+ }), e.queuePosition >= 0 && !uY(e) && l.push({
42536
42559
  id: "queue",
42537
42560
  label: `Queue position ${e.queuePosition + 1}`,
42538
42561
  items: [
@@ -42563,7 +42586,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
42563
42586
  run: () => t.moveInQueue(r)
42564
42587
  }))
42565
42588
  }), l;
42566
- }, dY = (e) => {
42589
+ }, pY = (e) => {
42567
42590
  let [t, n] = (0, v.useState)(null), r = e?.id, i = e?.infoHash, a = e?.magnet;
42568
42591
  return (0, v.useEffect)(() => {
42569
42592
  if (r === void 0) return;
@@ -42585,13 +42608,13 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
42585
42608
  i,
42586
42609
  a
42587
42610
  ]), e && t?.id === e.id && t.from === e.magnet ? t : null;
42588
- }, fY = (e) => /^magnet:\?/i.test(e.trim()), pY = (e) => {
42611
+ }, mY = (e) => /^magnet:\?/i.test(e.trim()), hY = (e) => {
42589
42612
  let t = e?.types;
42590
42613
  return t ? [...t].some((e) => e === "Files" || e === "text/uri-list") : !1;
42591
- }, mY = (e) => {
42614
+ }, gY = (e) => {
42592
42615
  let t = e / 1e6;
42593
42616
  return t >= 1e3 ? `${Math.round(t / 1e3)} GB/s` : t >= 1 ? `${Math.round(t)} MB/s` : `${Math.round(e / 1e3)} KB/s`;
42594
- }, hY = ({ quota: e }) => e.premium ? /* @__PURE__ */ G("div", {
42617
+ }, _Y = ({ quota: e }) => e.premium ? /* @__PURE__ */ G("div", {
42595
42618
  className: "stat quota",
42596
42619
  children: [/* @__PURE__ */ W("label", { children: "FKN quota" }), /* @__PURE__ */ W("strong", {
42597
42620
  className: "ok",
@@ -42601,7 +42624,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
42601
42624
  className: "stat quota throttled",
42602
42625
  children: [
42603
42626
  /* @__PURE__ */ W("label", { children: "FKN quota" }),
42604
- /* @__PURE__ */ G("strong", { children: ["Throttled · ", mY(e.bytesPerSecond)] }),
42627
+ /* @__PURE__ */ G("strong", { children: ["Throttled · ", gY(e.bytesPerSecond)] }),
42605
42628
  /* @__PURE__ */ W("a", {
42606
42629
  href: "https://fkn.app/account",
42607
42630
  target: "_blank",
@@ -42612,14 +42635,14 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
42612
42635
  }) : /* @__PURE__ */ G("div", {
42613
42636
  className: "stat quota",
42614
42637
  children: [/* @__PURE__ */ W("label", { children: "FKN quota" }), /* @__PURE__ */ G("strong", { children: [bS(e.remainingBytes, !0), " left"] })]
42615
- }), gY = ({ storage: e, low: t }) => /* @__PURE__ */ G("div", {
42638
+ }), vY = ({ storage: e, low: t }) => /* @__PURE__ */ G("div", {
42616
42639
  className: "stat storage" + (t ? " low" : ""),
42617
42640
  children: [/* @__PURE__ */ W("label", { children: "Storage" }), /* @__PURE__ */ G("strong", { children: [
42618
42641
  bS(e.usedBytes, !0),
42619
42642
  " / ",
42620
42643
  bS(e.limitBytes, !0)
42621
42644
  ] })]
42622
- }), _Y = {
42645
+ }), yY = {
42623
42646
  "signed-out": "Connect an account to sync your library.",
42624
42647
  "no-storage-grant": "Storage did not answer. Retrying.",
42625
42648
  "broker-timeout": "FKN did not respond. Retrying.",
@@ -42629,19 +42652,19 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
42629
42652
  "read-timeout": "FKN did not respond. Retrying.",
42630
42653
  "switch-unverified": "Waiting for this account's library.",
42631
42654
  "write-failed": "Could not save your library. Retrying on the next change."
42632
- }, vY = ({ state: e }) => {
42655
+ }, bY = ({ state: e }) => {
42633
42656
  let { status: t, reason: n } = e;
42634
42657
  if (t === "off") return null;
42635
42658
  let r = t === "syncing" ? "Syncing…" : t === "error" ? "Sync failed" : "Synced";
42636
42659
  return /* @__PURE__ */ G("div", {
42637
42660
  className: "stat sync" + (t === "error" ? " error" : ""),
42638
- ...GV(n ? _Y[n] : void 0),
42661
+ ...GV(n ? yY[n] : void 0),
42639
42662
  children: [/* @__PURE__ */ W("label", { children: "Library" }), /* @__PURE__ */ W("strong", {
42640
42663
  className: t === "synced" ? "ok" : void 0,
42641
42664
  children: r
42642
42665
  })]
42643
42666
  });
42644
- }, yY = ({ reachable: e, inboundNow: t = AS }) => {
42667
+ }, xY = ({ reachable: e, inboundNow: t = AS }) => {
42645
42668
  if (!e) return null;
42646
42669
  let { port: n, inbound: r, listenFailed: i } = e, a = e.listeners ?? [], o = e.portOpen ?? !0, s = i.length > 0, c = jS(t), l = !!n && !o && a.some((e) => e.healing), u = s ? "Failed" : n ? l ? `:${n} · reconnecting` : o ? c ? `:${n} · ${c}` : `:${n}` : `:${n} · closed` : "Unreachable", d = r > 0 ? ` ${r} accepted this session.` : "", f = s ? i.join("\n") : l ? "Connection dropped. Reconnecting." : n && !o ? `Port ${n} is closed. Reload to get a new one.` : n ? t.total > 0 ? `${t.total} ${t.total === 1 ? "peer" : "peers"} connected in on port ${n}: ${c}.${d}` : `Nobody connected in on port ${n}.${d}` : void 0;
42647
42670
  return /* @__PURE__ */ G("div", {
@@ -42652,10 +42675,10 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
42652
42675
  children: u
42653
42676
  })]
42654
42677
  });
42655
- }, bY = 120, xY = 60, SY = Infinity, CY = 3e4, wY = (e, t) => {
42678
+ }, SY = 120, CY = 60, wY = Infinity, TY = 3e4, EY = (e, t) => {
42656
42679
  let n = e.infoHash;
42657
42680
  return !navigator.locks || !n ? t() : navigator.locks.request(`ripple:folder-sync:${n}`, { ifAvailable: !0 }, (e) => e ? t() : Promise.resolve(null));
42658
- }, TY = St`
42681
+ }, DY = St`
42659
42682
  /* dvh minus whatever the broker reserved at the top, so docking its header does not push the
42660
42683
  footer under the fold. See the root rule in index.tsx for what writes the variable. */
42661
42684
  height: calc(100dvh - var(--fkn-inset-top, 0px));
@@ -43206,7 +43229,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
43206
43229
  }
43207
43230
 
43208
43231
  /* the state chip, shared with the table view so there is one source for it */
43209
- ${AJ}
43232
+ ${MJ}
43210
43233
 
43211
43234
  /* why a torrent stalled and when it tries again, brighter than the meta numbers it sits among so
43212
43235
  it does not read as one more of them */
@@ -43899,8 +43922,8 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
43899
43922
  min-height: 64px;
43900
43923
  }
43901
43924
  }
43902
- `, EY = ({ history: e }) => {
43903
- let t = Math.max(...e, 1), n = bY - e.length, r = e.map((e, r) => `${((n + r) / 119 * 100).toFixed(2)},${(29 - e / t * 26).toFixed(2)}`).join(" ");
43925
+ `, OY = ({ history: e }) => {
43926
+ let t = Math.max(...e, 1), n = SY - e.length, r = e.map((e, r) => `${((n + r) / 119 * 100).toFixed(2)},${(29 - e / t * 26).toFixed(2)}`).join(" ");
43904
43927
  return r ? /* @__PURE__ */ G("svg", {
43905
43928
  className: "graph",
43906
43929
  viewBox: "0 0 100 30",
@@ -43911,9 +43934,9 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
43911
43934
  points: `${(n / 119 * 100).toFixed(2)},30 ${r} 100,30`
43912
43935
  }), /* @__PURE__ */ W("polyline", { points: r })]
43913
43936
  }) : null;
43914
- }, DY = ({ down: e, up: t }) => {
43937
+ }, kY = ({ down: e, up: t }) => {
43915
43938
  let n = Math.max(...e, ...t, 1), r = (e) => {
43916
- let t = xY - e.length;
43939
+ let t = CY - e.length;
43917
43940
  return e.map((e, r) => `${((t + r) / 59 * 100).toFixed(2)},${(25 - e / n * 23).toFixed(2)}`).join(" ");
43918
43941
  };
43919
43942
  if (!e.length) return null;
@@ -43926,7 +43949,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
43926
43949
  children: [
43927
43950
  /* @__PURE__ */ W("polygon", {
43928
43951
  className: "down-fill",
43929
- points: `${((xY - e.length) / 59 * 100).toFixed(2)},26 ${i} 100,26`
43952
+ points: `${((CY - e.length) / 59 * 100).toFixed(2)},26 ${i} 100,26`
43930
43953
  }),
43931
43954
  /* @__PURE__ */ W("polyline", {
43932
43955
  className: "down-line",
@@ -43938,16 +43961,16 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
43938
43961
  })
43939
43962
  ]
43940
43963
  });
43941
- }, OY = (e, t) => `${e}:${t}`, kY = ({ url: e }) => e ? /* @__PURE__ */ W("img", {
43964
+ }, AY = (e, t) => `${e}:${t}`, jY = ({ url: e }) => e ? /* @__PURE__ */ W("img", {
43942
43965
  className: "poster",
43943
43966
  src: e,
43944
43967
  alt: ""
43945
43968
  }) : /* @__PURE__ */ W("div", {
43946
43969
  className: "poster placeholder",
43947
43970
  children: /* @__PURE__ */ W(To, {})
43948
- }), AY = ({ t: e, poster: t }) => /* @__PURE__ */ G("div", {
43971
+ }), MY = ({ t: e, poster: t }) => /* @__PURE__ */ G("div", {
43949
43972
  className: "torrent surface starting",
43950
- children: [/* @__PURE__ */ W(kY, { url: t }), /* @__PURE__ */ W("div", {
43973
+ children: [/* @__PURE__ */ W(jY, { url: t }), /* @__PURE__ */ W("div", {
43951
43974
  className: "content",
43952
43975
  children: /* @__PURE__ */ G("div", {
43953
43976
  className: "main",
@@ -43964,12 +43987,12 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
43964
43987
  className: "side",
43965
43988
  children: /* @__PURE__ */ W("span", {
43966
43989
  className: `badge ${e.state}`,
43967
- children: qW[e.state]
43990
+ children: YW[e.state]
43968
43991
  })
43969
43992
  })]
43970
43993
  })
43971
43994
  })]
43972
- }), jY = ({ t: e, poster: t, onStart: n, onOptions: r, selected: i, onSelect: a }) => /* @__PURE__ */ G("div", {
43995
+ }), NY = ({ t: e, poster: t, onStart: n, onOptions: r, selected: i, onSelect: a }) => /* @__PURE__ */ G("div", {
43973
43996
  className: "torrent surface missing" + (i ? " selected" : ""),
43974
43997
  "aria-current": i || void 0,
43975
43998
  onClick: (t) => {
@@ -43981,7 +44004,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
43981
44004
  y: t.clientY
43982
44005
  }));
43983
44006
  },
43984
- children: [/* @__PURE__ */ W(kY, { url: t }), /* @__PURE__ */ W("div", {
44007
+ children: [/* @__PURE__ */ W(jY, { url: t }), /* @__PURE__ */ W("div", {
43985
44008
  className: "content",
43986
44009
  children: /* @__PURE__ */ G("div", {
43987
44010
  className: "main",
@@ -44005,7 +44028,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44005
44028
  className: "side",
44006
44029
  children: [/* @__PURE__ */ W("span", {
44007
44030
  className: `badge ${e.state}`,
44008
- children: qW[e.state]
44031
+ children: YW[e.state]
44009
44032
  }), /* @__PURE__ */ G("div", {
44010
44033
  className: "actions",
44011
44034
  children: [e.saveTo !== "source" && /* @__PURE__ */ W("button", {
@@ -44032,13 +44055,13 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44032
44055
  })]
44033
44056
  })
44034
44057
  })]
44035
- }), MY = ({ t: e, saving: t, onToggle: n, onSave: r, onSaveZip: i, onStart: a, onOptions: o, selected: s, onSelect: c, savedToUserStorage: l, rates: u }) => {
44058
+ }), PY = ({ t: e, saving: t, onToggle: n, onSave: r, onSaveZip: i, onStart: a, onOptions: o, selected: s, onSelect: c, savedToUserStorage: l, rates: u }) => {
44036
44059
  let d = PW(e.infoHash);
44037
- if (e.state === "starting") return /* @__PURE__ */ W(AY, {
44060
+ if (e.state === "starting") return /* @__PURE__ */ W(MY, {
44038
44061
  t: e,
44039
44062
  poster: d
44040
44063
  });
44041
- if (e.state === "missing") return /* @__PURE__ */ W(jY, {
44064
+ if (e.state === "missing") return /* @__PURE__ */ W(NY, {
44042
44065
  t: e,
44043
44066
  poster: d,
44044
44067
  onStart: a,
@@ -44046,9 +44069,9 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44046
44069
  selected: s,
44047
44070
  onSelect: c
44048
44071
  });
44049
- let f = bU(e), p = vU(e.files), m = uV(e.files).length > 1, h = t[OY(e.id, m ? -1 : p)], g = e.progress >= 1, _ = e.state !== "paused" && e.state !== "queued", v = {};
44072
+ let f = bU(e), p = vU(e.files), m = uV(e.files).length > 1, h = t[AY(e.id, m ? -1 : p)], g = e.progress >= 1, _ = e.state !== "paused" && e.state !== "queued", v = {};
44050
44073
  return e.files?.forEach((n, r) => {
44051
- let i = t[OY(e.id, r)];
44074
+ let i = t[AY(e.id, r)];
44052
44075
  i != null && (v[r] = i);
44053
44076
  }), /* @__PURE__ */ G("div", {
44054
44077
  className: "torrent surface" + (s ? " selected" : ""),
@@ -44062,7 +44085,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44062
44085
  y: t.clientY
44063
44086
  }));
44064
44087
  },
44065
- children: [/* @__PURE__ */ W(kY, { url: d }), /* @__PURE__ */ W("div", {
44088
+ children: [/* @__PURE__ */ W(jY, { url: d }), /* @__PURE__ */ W("div", {
44066
44089
  className: "content",
44067
44090
  children: /* @__PURE__ */ G("div", {
44068
44091
  className: "main",
@@ -44095,11 +44118,11 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44095
44118
  }),
44096
44119
  /* @__PURE__ */ G("span", {
44097
44120
  className: "rate",
44098
- children: ["↓ ", JW(e.down)]
44121
+ children: ["↓ ", XW(e.down)]
44099
44122
  }),
44100
44123
  /* @__PURE__ */ G("span", {
44101
44124
  className: "rate",
44102
- children: ["↑ ", JW(e.up)]
44125
+ children: ["↑ ", XW(e.up)]
44103
44126
  }),
44104
44127
  /* @__PURE__ */ G("span", {
44105
44128
  className: "peers",
@@ -44120,7 +44143,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44120
44143
  }),
44121
44144
  e.retry && /* @__PURE__ */ W("span", {
44122
44145
  className: "retry",
44123
- children: XW(e, e.retry)
44146
+ children: QW(e, e.retry)
44124
44147
  })
44125
44148
  ]
44126
44149
  }),
@@ -44133,7 +44156,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44133
44156
  })
44134
44157
  ]
44135
44158
  }),
44136
- u && /* @__PURE__ */ W(DY, {
44159
+ u && /* @__PURE__ */ W(kY, {
44137
44160
  down: u.down,
44138
44161
  up: u.up
44139
44162
  }),
@@ -44142,7 +44165,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44142
44165
  children: [
44143
44166
  /* @__PURE__ */ W("span", {
44144
44167
  className: `badge ${e.state}`,
44145
- children: qW[e.state]
44168
+ children: YW[e.state]
44146
44169
  }),
44147
44170
  /* @__PURE__ */ G("span", {
44148
44171
  className: "pct",
@@ -44202,8 +44225,8 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44202
44225
  })
44203
44226
  })]
44204
44227
  });
44205
- }, NY = () => {
44206
- let { torrents: e, list: t, inboundNow: n, addMagnet: r, addTorrentFile: i, pause: a, resume: o, retry: s, recheck: c, remove: l, start: u, removeMissing: d, storageUnavailable: f, workerError: p, reachable: m, client: h } = wB(), [g, _] = (0, v.useState)(""), [y, b] = (0, v.useState)(null), [x, S] = (0, v.useState)({}), [C, w] = (0, v.useState)(() => navigator.onLine === !1), T = (0, v.useRef)(void 0), { confirm: E, confirmElement: D, confirmOpen: O } = GK(), k = VK(), A = async () => {
44228
+ }, FY = () => {
44229
+ let { torrents: e, list: t, inboundNow: n, addMagnet: r, addTorrentFile: i, pause: a, resume: o, retry: s, recheck: c, remove: l, start: u, removeMissing: d, storageUnavailable: f, workerError: p, reachable: m, client: h } = wB(), [g, _] = (0, v.useState)(""), [y, b] = (0, v.useState)(null), [x, S] = (0, v.useState)({}), [C, w] = (0, v.useState)(() => navigator.onLine === !1), T = (0, v.useRef)(void 0), { confirm: E, confirmElement: D, confirmOpen: O } = qK(), k = UK(), A = async () => {
44207
44230
  Object.keys(x).length > 0 && !await E({
44208
44231
  title: "Update now?",
44209
44232
  body: "Updating reloads Ripple and stops the file being saved to your disk.",
@@ -44222,16 +44245,16 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44222
44245
  window.removeEventListener("online", e), window.removeEventListener("offline", e);
44223
44246
  };
44224
44247
  }, []), (0, v.useEffect)(() => h.onAddFailed(H), [h, H]), NW(h);
44225
- let [ee] = (0, v.useState)(() => !PK()), te = (0, v.useCallback)(async () => {
44226
- let e = await LK();
44248
+ let [ee] = (0, v.useState)(() => !IK()), te = (0, v.useCallback)(async () => {
44249
+ let e = await zK();
44227
44250
  H(e === "installed" ? "Ripple installed" : e === "magnet-registered" ? "Confirm the prompt to route magnet links to Ripple." : e === "already-installed" ? "Ripple is already installed" : "Use your browser menu to install Ripple as an app.");
44228
- }, [H]), [ne, re] = (0, v.useState)(() => yK((e) => localStorage.getItem(e))), ie = (e) => {
44251
+ }, [H]), [ne, re] = (0, v.useState)(() => xK((e) => localStorage.getItem(e))), ie = (e) => {
44229
44252
  re(e);
44230
44253
  try {
44231
- localStorage.setItem(_K, e ? "1" : "0");
44254
+ localStorage.setItem(yK, e ? "1" : "0");
44232
44255
  } catch {}
44233
44256
  }, [U, ae] = (0, v.useState)(null), [oe, se] = (0, v.useState)(null), ce = (0, v.useRef)(null), le = (0, v.useCallback)((e, t, n = null) => {
44234
- let r = uK({ magnet: e });
44257
+ let r = fK({ magnet: e });
44235
44258
  if (!r.ok) {
44236
44259
  H(r.problem);
44237
44260
  return;
@@ -44249,7 +44272,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44249
44272
  }), se(null);
44250
44273
  }, [h, H]), ue = (0, v.useCallback)((e) => {
44251
44274
  let t = e.trim();
44252
- if (!fY(t)) return !1;
44275
+ if (!mY(t)) return !1;
44253
44276
  let n = SS(t);
44254
44277
  return n && V.current.some((e) => e.magnet && SS(e.magnet) === n) ? (H("Already in your list"), !0) : ne ? (le(t, !1), !0) : (r(t), H("Magnet added"), !0);
44255
44278
  }, [
@@ -44328,7 +44351,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44328
44351
  let t = e.target;
44329
44352
  if (t && (t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.isContentEditable)) return;
44330
44353
  let n = e.clipboardData?.getData("text") ?? "";
44331
- fY(n) && (e.preventDefault(), ue(n));
44354
+ mY(n) && (e.preventDefault(), ue(n));
44332
44355
  };
44333
44356
  return window.addEventListener("paste", e), () => window.removeEventListener("paste", e);
44334
44357
  }, [
@@ -44341,9 +44364,9 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44341
44364
  }, []);
44342
44365
  (0, v.useEffect)(() => {
44343
44366
  let e = (e) => {
44344
- pY(e.dataTransfer) && ++be.current === 1 && ye(!0);
44367
+ hY(e.dataTransfer) && ++be.current === 1 && ye(!0);
44345
44368
  }, t = (e) => {
44346
- pY(e.dataTransfer) && --be.current <= 0 && Ce();
44369
+ hY(e.dataTransfer) && --be.current <= 0 && Ce();
44347
44370
  }, n = (e) => e.preventDefault(), r = (e) => {
44348
44371
  e.preventDefault(), Ce(), me(e.dataTransfer);
44349
44372
  };
@@ -44391,7 +44414,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44391
44414
  body: "The downloaded files stay, but its progress is forgotten.",
44392
44415
  confirmLabel: "Remove"
44393
44416
  })) && (e.infoHash && ez(e.infoHash), e.state === "missing" ? e.infoHash && d(e.infoHash) : l(Number(e.id), !1));
44394
- }, [Ae, je] = (0, v.useState)(null), [Me, Ne] = (0, v.useState)(null), Pe = Fq(h), [Fe, Ie] = (0, v.useState)(!1), Le = (0, v.useCallback)(() => Ie(!1), []), { waiting: Re, allow: ze } = Iq(h, t, h.owns()), [Be, Ve] = (0, v.useState)(null), He = (0, v.useCallback)((e) => Ve(e.id), []), Ue = (0, v.useCallback)((e, t) => {
44417
+ }, [Ae, je] = (0, v.useState)(null), [Me, Ne] = (0, v.useState)(null), Pe = Lq(h), [Fe, Ie] = (0, v.useState)(!1), Le = (0, v.useCallback)(() => Ie(!1), []), { waiting: Re, allow: ze } = Rq(h, t, h.owns()), [Be, Ve] = (0, v.useState)(null), He = (0, v.useCallback)((e) => Ve(e.id), []), Ue = (0, v.useCallback)((e, t) => {
44395
44418
  t ? (Ne(null), je({
44396
44419
  id: e.id,
44397
44420
  at: t
@@ -44451,13 +44474,13 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44451
44474
  }
44452
44475
  }), Ge = Be ? e.find((e) => e.id === Be) : void 0, Ke = {};
44453
44476
  Ge?.files?.forEach((e, t) => {
44454
- let n = x[OY(Ge.id, t)];
44477
+ let n = x[AY(Ge.id, t)];
44455
44478
  n != null && (Ke[t] = n);
44456
44479
  });
44457
- let qe = Ae ? e.find((e) => e.id === Ae.id) : void 0, Je = Me ? e.find((e) => e.id === Me) : void 0, Ye = dY(qe ?? Je), Xe = (e, t) => {
44480
+ let qe = Ae ? e.find((e) => e.id === Ae.id) : void 0, Je = Me ? e.find((e) => e.id === Me) : void 0, Ye = pY(qe ?? Je), Xe = (e, t) => {
44458
44481
  let n = e.files?.[t];
44459
44482
  if (!n) return;
44460
- let r = OY(e.id, t);
44483
+ let r = AY(e.id, t);
44461
44484
  S((e) => ({
44462
44485
  ...e,
44463
44486
  [r]: 0
@@ -44472,7 +44495,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44472
44495
  }));
44473
44496
  }, Ze = (e) => {
44474
44497
  if (!uV(e.files).length) return;
44475
- let t = OY(e.id, -1);
44498
+ let t = AY(e.id, -1);
44476
44499
  S((e) => ({
44477
44500
  ...e,
44478
44501
  [t]: 0
@@ -44485,21 +44508,21 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44485
44508
  let { [t]: n, ...r } = e;
44486
44509
  return r;
44487
44510
  }));
44488
- }, { supported: Qe, folder: $e, permitted: et, pick: tt, allow: nt, clear: rt } = oG(), [it, at] = (0, v.useState)(() => {
44511
+ }, { supported: Qe, folder: $e, permitted: et, pick: tt, allow: nt, clear: rt } = cG(), [it, at] = (0, v.useState)(() => {
44489
44512
  try {
44490
- return JG((e) => localStorage.getItem(e));
44513
+ return XG((e) => localStorage.getItem(e));
44491
44514
  } catch {
44492
44515
  return "browser";
44493
44516
  }
44494
- }), [ot, st] = (0, v.useState)(() => XJ((e) => localStorage.getItem(e))), [ct, lt] = (0, v.useState)(() => ZJ((e) => localStorage.getItem(e))), [ut, dt] = (0, v.useState)(() => $J((e) => localStorage.getItem(e))), ft = (e) => {
44517
+ }), [ot, st] = (0, v.useState)(() => QJ((e) => localStorage.getItem(e))), [ct, lt] = (0, v.useState)(() => $J((e) => localStorage.getItem(e))), [ut, dt] = (0, v.useState)(() => tY((e) => localStorage.getItem(e))), ft = (e) => {
44495
44518
  st(e);
44496
44519
  try {
44497
- localStorage.setItem(UJ, e);
44520
+ localStorage.setItem(GJ, e);
44498
44521
  } catch {}
44499
44522
  }, pt = (e) => {
44500
44523
  lt(e);
44501
44524
  try {
44502
- localStorage.setItem(GJ, e);
44525
+ localStorage.setItem(qJ, e);
44503
44526
  } catch {}
44504
44527
  }, mt = (e, t) => {
44505
44528
  dt({
@@ -44507,7 +44530,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44507
44530
  dir: t
44508
44531
  });
44509
44532
  try {
44510
- localStorage.setItem(WJ, eY(e, t));
44533
+ localStorage.setItem(KJ, nY(e, t));
44511
44534
  } catch {}
44512
44535
  }, [ht, gt] = Ra(), _t = (0, v.useRef)(null), vt = ht.get("torrent");
44513
44536
  (0, v.useEffect)(() => {
@@ -44522,7 +44545,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44522
44545
  let yt = (e) => {
44523
44546
  at(e);
44524
44547
  try {
44525
- localStorage.setItem(KG, e);
44548
+ localStorage.setItem(JG, e);
44526
44549
  } catch {}
44527
44550
  }, bt = z && typeof z.scope == "object" ? e.find((e) => e.id === z.scope.torrent) : void 0, xt = (e) => {
44528
44551
  if (!z) return;
@@ -44537,19 +44560,19 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44537
44560
  et
44538
44561
  ]);
44539
44562
  let St = (e) => ({
44540
- intended: YG(e, it),
44541
- current: XG(e.stats?.savePath)
44563
+ intended: ZG(e, it),
44564
+ current: QG(e.stats?.savePath)
44542
44565
  }), Ct = async (e, t) => {
44543
44566
  if (!e.infoHash) return;
44544
44567
  h.setLocation(e.infoHash, t);
44545
- let { current: n } = St(e), r = QG({
44568
+ let { current: n } = St(e), r = eK({
44546
44569
  current: n,
44547
44570
  intended: t,
44548
44571
  complete: e.progress >= 1,
44549
44572
  folderReady: !!$e && et
44550
44573
  });
44551
44574
  if (!r.move) {
44552
- let e = $G(r, $e?.name);
44575
+ let e = tK(r, $e?.name);
44553
44576
  e && H(e);
44554
44577
  return;
44555
44578
  }
@@ -44573,7 +44596,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44573
44596
  [e.id]: `Moving ${e.name}`
44574
44597
  }));
44575
44598
  try {
44576
- await rK({
44599
+ await aK({
44577
44600
  client: h,
44578
44601
  torrent: e,
44579
44602
  folder: $e,
@@ -44596,7 +44619,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44596
44619
  (0, v.useEffect)(() => {
44597
44620
  if ($e && et) for (let t of e) {
44598
44621
  if (t.state === "missing") continue;
44599
- let { intended: e, current: n } = St(t), r = QG({
44622
+ let { intended: e, current: n } = St(t), r = eK({
44600
44623
  current: n,
44601
44624
  intended: e,
44602
44625
  complete: t.progress >= 1,
@@ -44614,15 +44637,15 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44614
44637
  if (!$e || !et) return;
44615
44638
  let t = Date.now();
44616
44639
  for (let n of e) {
44617
- if (n.state !== "done" && n.state !== "seeding" || qG(n) || !n.files?.length || kt.current.has(n.id)) continue;
44640
+ if (n.state !== "done" && n.state !== "seeding" || YG(n) || !n.files?.length || kt.current.has(n.id)) continue;
44618
44641
  let e = Ot.current.get(n.id);
44619
- if (e !== void 0 && (e === SY || t < e)) continue;
44642
+ if (e !== void 0 && (e === wY || t < e)) continue;
44620
44643
  kt.current.add(n.id);
44621
44644
  let r = At.current;
44622
- wY(n, () => jG(h, n, $e)).then((e) => {
44623
- r === At.current && e !== null && (Ot.current.set(n.id, SY), Mt((e) => e.has(n.id) ? e : new Set(e).add(n.id)), e && H(`${n.name} saved to ${$e.name}`));
44645
+ EY(n, () => NG(h, n, $e)).then((e) => {
44646
+ r === At.current && e !== null && (Ot.current.set(n.id, wY), Mt((e) => e.has(n.id) ? e : new Set(e).add(n.id)), e && H(`${n.name} saved to ${$e.name}`));
44624
44647
  }).catch(() => {
44625
- r === At.current && (Ot.current.set(n.id, Date.now() + CY), H(`Saving ${n.name} to ${$e.name} failed, retrying`));
44648
+ r === At.current && (Ot.current.set(n.id, Date.now() + TY), H(`Saving ${n.name} to ${$e.name} failed, retrying`));
44626
44649
  }).finally(() => kt.current.delete(n.id));
44627
44650
  }
44628
44651
  }, [
@@ -44634,7 +44657,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44634
44657
  ]);
44635
44658
  let Nt = U ? e.find((e) => e.infoHash === U.infoHash && e.state !== "missing") : void 0, Pt = Nt?.files ?? [];
44636
44659
  (0, v.useEffect)(() => {
44637
- U && !oe && Pt.length !== 0 && Nt && (se(vK({
44660
+ U && !oe && Pt.length !== 0 && Nt && (se(bK({
44638
44661
  fileCount: Pt.length,
44639
44662
  location: it
44640
44663
  })), ce.current = Number(Nt.id), a(Number(Nt.id)));
@@ -44657,7 +44680,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44657
44680
  ]), Lt = (0, v.useCallback)(() => {
44658
44681
  if (!U || !oe || !Nt) return;
44659
44682
  let e = Number(Nt.id);
44660
- r(U.magnet), h.setPlan(e, bK(oe, Pt.length)), h.setFlags(e, ...xK(oe)), U.infoHash && h.setLocation(U.infoHash, oe.location), oe.topOfQueue && h.moveInQueue(e, "top"), oe.start && o(e), H(oe.start ? `${U.name} added` : `${U.name} added, paused`), Ft();
44683
+ r(U.magnet), h.setPlan(e, SK(oe, Pt.length)), h.setFlags(e, ...CK(oe)), U.infoHash && h.setLocation(U.infoHash, oe.location), oe.topOfQueue && h.moveInQueue(e, "top"), oe.start && o(e), H(oe.start ? `${U.name} added` : `${U.name} added, paused`), Ft();
44661
44684
  }, [
44662
44685
  U,
44663
44686
  oe,
@@ -44672,7 +44695,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44672
44695
  (0, v.useEffect)(() => {
44673
44696
  let e = ht.get("add");
44674
44697
  if (!e) return;
44675
- if (eG()) {
44698
+ if (nG()) {
44676
44699
  gt(new URLSearchParams(), { replace: !0 });
44677
44700
  return;
44678
44701
  }
@@ -44712,7 +44735,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44712
44735
  return n;
44713
44736
  });
44714
44737
  }, [e]);
44715
- let Ut = e.reduce((e, t) => e + t.down, 0), Wt = e.reduce((e, t) => e + t.up, 0), Gt = Math.max(...zt, 0), Kt = e.filter((e) => mB(e.state)).length, qt = e.filter(jJ).length, { rows: Jt, interaction: Yt } = iY(e, ot, ut.key, ut.dir), Xt = e.length - Jt.length, Zt = ot === "library" ? e.filter(jJ).reduce((e, t) => e + t.size, 0) : 0, Qt = sG(e.some((e) => e.state !== "missing")), $t = sB(), en = e.filter((e) => e.state === "retrying").length, tn = yG(), nn = lG(`${e.length}:${tn.refreshKey}`), rn = !!nn && nn.limitBytes - nn.usedBytes < 2e9, an = uG({
44738
+ let Ut = e.reduce((e, t) => e + t.down, 0), Wt = e.reduce((e, t) => e + t.up, 0), Gt = Math.max(...zt, 0), Kt = e.filter((e) => mB(e.state)).length, qt = e.filter(NJ).length, { rows: Jt, interaction: Yt } = oY(e, ot, ut.key, ut.dir), Xt = e.length - Jt.length, Zt = ot === "library" ? e.filter(NJ).reduce((e, t) => e + t.size, 0) : 0, Qt = lG(e.some((e) => e.state !== "missing")), $t = sB(), en = e.filter((e) => e.state === "retrying").length, tn = xG(), nn = dG(`${e.length}:${tn.refreshKey}`), rn = !!nn && nn.limitBytes - nn.usedBytes < 2e9, an = fG({
44716
44739
  supported: Qe,
44717
44740
  folderName: $e?.name,
44718
44741
  permitted: et,
@@ -44727,25 +44750,25 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44727
44750
  return;
44728
44751
  }
44729
44752
  an.kind === "move" && yt("folder");
44730
- }, sn = OJ({
44753
+ }, sn = AJ({
44731
44754
  dragging: ve,
44732
44755
  overField: xe,
44733
44756
  shareOpen: N && !F
44734
44757
  });
44735
44758
  return /* @__PURE__ */ G("div", {
44736
- css: TY,
44759
+ css: DY,
44737
44760
  "data-drag": sn === "page" || void 0,
44738
44761
  children: [
44739
44762
  D,
44740
- Ae && qe && Ye && /* @__PURE__ */ W(vJ, {
44741
- groups: uY(qe, We(qe, Ye.magnet), Rt(qe)),
44763
+ Ae && qe && Ye && /* @__PURE__ */ W(bJ, {
44764
+ groups: fY(qe, We(qe, Ye.magnet), Rt(qe)),
44742
44765
  at: Ae.at,
44743
44766
  label: `Options for ${qe.name}`,
44744
44767
  onClose: () => je(null)
44745
44768
  }),
44746
- Je && Ye && /* @__PURE__ */ W(DJ, {
44769
+ Je && Ye && /* @__PURE__ */ W(kJ, {
44747
44770
  title: Je.name,
44748
- groups: uY(Je, We(Je, Ye.magnet), Rt(Je)),
44771
+ groups: fY(Je, We(Je, Ye.magnet), Rt(Je)),
44749
44772
  onClose: () => Ne(null)
44750
44773
  }),
44751
44774
  /* @__PURE__ */ W("div", {
@@ -44852,9 +44875,9 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44852
44875
  },
44853
44876
  children: "Open torrents with Ripple"
44854
44877
  }),
44855
- /* @__PURE__ */ W(TJ, { onToast: H })
44878
+ /* @__PURE__ */ W(DJ, { onToast: H })
44856
44879
  ] }),
44857
- N && /* @__PURE__ */ W(JK, {
44880
+ N && /* @__PURE__ */ W(XK, {
44858
44881
  torrent: F,
44859
44882
  dragging: sn === "share",
44860
44883
  onMagnet: fe,
@@ -44863,7 +44886,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44863
44886
  onClose: ge,
44864
44887
  onToast: H
44865
44888
  }),
44866
- Fe && /* @__PURE__ */ W(_q, {
44889
+ Fe && /* @__PURE__ */ W(yq, {
44867
44890
  create: Pe,
44868
44891
  onClose: Le,
44869
44892
  onShare: (e) => {
@@ -44910,7 +44933,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44910
44933
  role: "status",
44911
44934
  children: /* @__PURE__ */ W("strong", { children: en === 1 ? "A download hit a problem, retrying" : `${en} downloads hit a problem, retrying` })
44912
44935
  }),
44913
- nn && rn && !f && /* @__PURE__ */ W(CG, {
44936
+ nn && rn && !f && /* @__PURE__ */ W(TG, {
44914
44937
  storage: nn,
44915
44938
  relief: an,
44916
44939
  onAct: () => void on(),
@@ -44924,15 +44947,15 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44924
44947
  children: [
44925
44948
  /* @__PURE__ */ G("div", {
44926
44949
  className: "stat big rate",
44927
- children: [/* @__PURE__ */ W("label", { children: "Download" }), /* @__PURE__ */ W("strong", { children: JW(Ut) })]
44950
+ children: [/* @__PURE__ */ W("label", { children: "Download" }), /* @__PURE__ */ W("strong", { children: XW(Ut) })]
44928
44951
  }),
44929
44952
  /* @__PURE__ */ G("div", {
44930
44953
  className: "stat rate",
44931
- children: [/* @__PURE__ */ W("label", { children: "Upload" }), /* @__PURE__ */ W("strong", { children: JW(Wt) })]
44954
+ children: [/* @__PURE__ */ W("label", { children: "Upload" }), /* @__PURE__ */ W("strong", { children: XW(Wt) })]
44932
44955
  }),
44933
44956
  /* @__PURE__ */ G("div", {
44934
44957
  className: "stat rate",
44935
- children: [/* @__PURE__ */ W("label", { children: "Peak down" }), /* @__PURE__ */ W("strong", { children: JW(Gt) })]
44958
+ children: [/* @__PURE__ */ W("label", { children: "Peak down" }), /* @__PURE__ */ W("strong", { children: XW(Gt) })]
44936
44959
  }),
44937
44960
  /* @__PURE__ */ G("div", {
44938
44961
  className: "stat",
@@ -44942,21 +44965,21 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44942
44965
  e.length
44943
44966
  ] })]
44944
44967
  }),
44945
- /* @__PURE__ */ W(yY, {
44968
+ /* @__PURE__ */ W(xY, {
44946
44969
  reachable: m,
44947
44970
  inboundNow: n
44948
44971
  }),
44949
- nn && /* @__PURE__ */ W(gY, {
44972
+ nn && /* @__PURE__ */ W(vY, {
44950
44973
  storage: nn,
44951
44974
  low: rn
44952
44975
  }),
44953
- Qt && /* @__PURE__ */ W(hY, { quota: Qt }),
44976
+ Qt && /* @__PURE__ */ W(_Y, { quota: Qt }),
44954
44977
  /* @__PURE__ */ W(YV, { reachable: m }),
44955
- /* @__PURE__ */ W(vY, { state: $t })
44978
+ /* @__PURE__ */ W(bY, { state: $t })
44956
44979
  ]
44957
- }), /* @__PURE__ */ W(EY, { history: zt })]
44980
+ }), /* @__PURE__ */ W(OY, { history: zt })]
44958
44981
  }),
44959
- e.length > 0 && /* @__PURE__ */ W(oY, {
44982
+ e.length > 0 && /* @__PURE__ */ W(cY, {
44960
44983
  filter: ot,
44961
44984
  onFilter: ft,
44962
44985
  sortKey: ut.key,
@@ -44989,7 +45012,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44989
45012
  children: "Show everything"
44990
45013
  })
44991
45014
  })]
44992
- }) : ct === "table" ? /* @__PURE__ */ W(rY, {
45015
+ }) : ct === "table" ? /* @__PURE__ */ W(aY, {
44993
45016
  torrents: Jt,
44994
45017
  sortKey: ut.key,
44995
45018
  sortDir: ut.dir,
@@ -44997,7 +45020,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
44997
45020
  selectedId: Be,
44998
45021
  onSelect: He,
44999
45022
  onOptions: Ue
45000
- }) : Jt.map((e) => /* @__PURE__ */ W(MY, {
45023
+ }) : Jt.map((e) => /* @__PURE__ */ W(PY, {
45001
45024
  t: e,
45002
45025
  saving: x,
45003
45026
  onToggle: we,
@@ -45033,19 +45056,19 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
45033
45056
  ]
45034
45057
  })]
45035
45058
  }),
45036
- Ge && /* @__PURE__ */ W(cJ, {
45059
+ Ge && /* @__PURE__ */ W(uJ, {
45037
45060
  t: Ge,
45038
45061
  handle: Number.isFinite(Number(Ge.id)) ? Number(Ge.id) : null,
45039
45062
  saving: Ke,
45040
45063
  onSave: (e) => Xe(Ge, e),
45041
45064
  onClose: () => Ve(null)
45042
45065
  }),
45043
- U && /* @__PURE__ */ W(kK, {
45066
+ U && /* @__PURE__ */ W(jK, {
45044
45067
  name: U.name,
45045
45068
  from: U.from,
45046
45069
  external: U.external,
45047
45070
  files: Pt,
45048
- choices: oe ?? vK({
45071
+ choices: oe ?? bK({
45049
45072
  fileCount: 0,
45050
45073
  location: it
45051
45074
  }),
@@ -45059,7 +45082,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
45059
45082
  onCancel: It,
45060
45083
  onNeverAsk: U.external ? void 0 : () => ie(!1)
45061
45084
  }),
45062
- z && (z.scope === "session" || bt) && /* @__PURE__ */ W(jK, {
45085
+ z && (z.scope === "session" || bt) && /* @__PURE__ */ W(NK, {
45063
45086
  title: z.direction === "down" ? z.scope === "session" ? "Total download rate limit" : "Download rate limit" : z.scope === "session" ? "Total upload rate limit" : "Upload rate limit",
45064
45087
  subject: z.scope === "session" ? "All torrents" : bt?.name,
45065
45088
  value: z.scope === "session" ? z.direction === "down" ? L.down : L.up : z.direction === "down" ? bt?.downloadLimit : bt?.uploadLimit,
@@ -45084,15 +45107,15 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
45084
45107
  }),
45085
45108
  /* @__PURE__ */ G("a", {
45086
45109
  className: "build",
45087
- href: "https://github.com/banou26/ripple/commit/23159ea5ebbb088a112b6a2097b12e0f024a486f",
45110
+ href: "https://github.com/banou26/ripple/commit/58ddc235cca2643ee0c2d3eaf8ee45473e0e9b31",
45088
45111
  target: "_blank",
45089
45112
  rel: "noreferrer",
45090
- ...GV("commit 23159ea5ebbb088a112b6a2097b12e0f024a486f"),
45113
+ ...GV("commit 58ddc235cca2643ee0c2d3eaf8ee45473e0e9b31"),
45091
45114
  children: [
45092
45115
  "v",
45093
- "0.0.26",
45116
+ "0.0.27",
45094
45117
  " · ",
45095
- "23159ea"
45118
+ "58ddc23"
45096
45119
  ]
45097
45120
  }),
45098
45121
  /* @__PURE__ */ G("div", {
@@ -45128,7 +45151,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
45128
45151
  children: ne ? "Ask what to download" : "Start straight away"
45129
45152
  })]
45130
45153
  }),
45131
- /* @__PURE__ */ W(Lq, {
45154
+ /* @__PURE__ */ W(zq, {
45132
45155
  persist: tn,
45133
45156
  onAsk: () => void tn.request()
45134
45157
  }),
@@ -45168,7 +45191,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
45168
45191
  })
45169
45192
  ]
45170
45193
  });
45171
- }, PY = St`
45194
+ }, IY = St`
45172
45195
  position: relative;
45173
45196
  /* vh minus the strip the broker reserved, same contract as the library page. A bare 100vh here
45174
45197
  would still be a full viewport tall inside a root the reservation already shortened. */
@@ -45247,8 +45270,8 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
45247
45270
  background: ${vS};
45248
45271
  }
45249
45272
  }
45250
- `, FY = ({ children: e }) => /* @__PURE__ */ W("div", {
45251
- css: PY,
45273
+ `, LY = ({ children: e }) => /* @__PURE__ */ W("div", {
45274
+ css: IY,
45252
45275
  children: /* @__PURE__ */ G("div", {
45253
45276
  className: "shell",
45254
45277
  children: [/* @__PURE__ */ W(Ma, {
@@ -45257,10 +45280,10 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
45257
45280
  children: "Ripple"
45258
45281
  }), e]
45259
45282
  })
45260
- }), IY = Oa([
45283
+ }), RY = Oa([
45261
45284
  {
45262
45285
  path: Ja(Ga.HOME),
45263
- element: /* @__PURE__ */ W(NY, {})
45286
+ element: /* @__PURE__ */ W(FY, {})
45264
45287
  },
45265
45288
  {
45266
45289
  path: Ja(Ga.ADD),
@@ -45268,15 +45291,15 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
45268
45291
  },
45269
45292
  {
45270
45293
  path: Ja(Ga.WATCH),
45271
- element: /* @__PURE__ */ W($W, {})
45294
+ element: /* @__PURE__ */ W(tG, {})
45272
45295
  },
45273
45296
  {
45274
45297
  path: Ja(Ga.DOWNLOAD),
45275
- element: /* @__PURE__ */ W($W, { mode: "download" })
45298
+ element: /* @__PURE__ */ W(tG, { mode: "download" })
45276
45299
  },
45277
45300
  {
45278
45301
  path: Ja(Ga.LEGAL),
45279
- element: /* @__PURE__ */ W(() => /* @__PURE__ */ G(FY, { children: [
45302
+ element: /* @__PURE__ */ W(() => /* @__PURE__ */ G(LY, { children: [
45280
45303
  /* @__PURE__ */ W("h1", { children: "Legal & Terms" }),
45281
45304
  /* @__PURE__ */ W("div", {
45282
45305
  className: "updated",
@@ -45318,7 +45341,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
45318
45341
  },
45319
45342
  {
45320
45343
  path: Ja(Ga.PRIVACY),
45321
- element: /* @__PURE__ */ W(() => /* @__PURE__ */ G(FY, { children: [
45344
+ element: /* @__PURE__ */ W(() => /* @__PURE__ */ G(LY, { children: [
45322
45345
  /* @__PURE__ */ W("h1", { children: "Privacy" }),
45323
45346
  /* @__PURE__ */ W("div", {
45324
45347
  className: "updated",
@@ -45369,7 +45392,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
45369
45392
  ] })
45370
45393
  ] }), {})
45371
45394
  }
45372
- ]), LY = () => /* @__PURE__ */ G(Qa, { children: [/* @__PURE__ */ W(Bi, { router: IY }), /* @__PURE__ */ W(qV, {})] }), RY = 50, zY = ({ onActive: e, onInactive: t }) => {
45395
+ ]), zY = () => /* @__PURE__ */ G(Qa, { children: [/* @__PURE__ */ W(Bi, { router: RY }), /* @__PURE__ */ W(qV, {})] }), BY = 50, VY = ({ onActive: e, onInactive: t }) => {
45373
45396
  let [n, r] = (0, v.useState)("probing"), i = (0, v.useRef)("probing"), [a, o] = (0, v.useState)(), [s] = (0, v.useState)(() => new BroadcastChannel("ripple-window-instance-guard")), c = (0, v.useRef)(e), l = (0, v.useRef)(t), u = (0, v.useRef)(void 0);
45374
45397
  c.current = e, l.current = t, u.current = a;
45375
45398
  let d = (0, v.useCallback)(() => {
@@ -45389,7 +45412,7 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
45389
45412
  window.clearTimeout(e), i.current = "inactive", r("inactive");
45390
45413
  }
45391
45414
  };
45392
- return s.addEventListener("message", t), s.postMessage("check"), e = window.setTimeout(d, RY), () => {
45415
+ return s.addEventListener("message", t), s.postMessage("check"), e = window.setTimeout(d, BY), () => {
45393
45416
  window.clearTimeout(e), s.removeEventListener("message", t);
45394
45417
  };
45395
45418
  }, [d, s]), (0, v.useEffect)(() => () => s.close(), [s]), {
@@ -45398,11 +45421,11 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
45398
45421
  value: a,
45399
45422
  activate: d
45400
45423
  };
45401
- }, BY = () => {
45424
+ }, HY = () => {
45402
45425
  (0, v.useEffect)(() => PL.onUpdateTaken(() => {
45403
- RK();
45426
+ BK();
45404
45427
  }), []);
45405
- }, VY = St`
45428
+ }, UY = St`
45406
45429
  display: flex;
45407
45430
  flex-direction: column;
45408
45431
  justify-content: center;
@@ -45413,18 +45436,18 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
45413
45436
  & > div {
45414
45437
  margin: 1rem;
45415
45438
  }
45416
- `, HY = () => {
45417
- let { claim: e, activate: t } = zY({});
45439
+ `, WY = () => {
45440
+ let { claim: e, activate: t } = VY({});
45418
45441
  return (0, v.useEffect)(() => {
45419
45442
  e === "inactive" && _R();
45420
45443
  }, [e]), e === "probing" ? null : e === "inactive" ? /* @__PURE__ */ G("div", {
45421
- css: VY,
45444
+ css: UY,
45422
45445
  children: [/* @__PURE__ */ W("div", { children: "Ripple is open in another tab." }), /* @__PURE__ */ W("div", { children: /* @__PURE__ */ W("button", {
45423
45446
  onClick: t,
45424
45447
  children: "Use it here instead"
45425
45448
  }) })]
45426
- }) : /* @__PURE__ */ W(LY, {});
45427
- }, UY = () => (BY(), eR() ? /* @__PURE__ */ W(LY, {}) : /* @__PURE__ */ W(HY, {})), WY = St`
45449
+ }) : /* @__PURE__ */ W(zY, {});
45450
+ }, GY = () => (HY(), eR() ? /* @__PURE__ */ W(zY, {}) : /* @__PURE__ */ W(WY, {})), KY = St`
45428
45451
  /*
45429
45452
  * What colours the scrollbars, the text caret, ::selection and the chrome the UA draws on form
45430
45453
  * controls. Nothing in this repo touches the first three, so for those this one keyword is the
@@ -45476,8 +45499,8 @@ var NK = () => window.location.origin + "/?magnet=%s", PK = () => typeof window
45476
45499
  body > .mount {
45477
45500
  height: 100%;
45478
45501
  }
45479
- `, GY = document.body.appendChild(document.createElement("div"));
45480
- GY.classList.add("mount"), (0, Wa.createRoot)(GY).render(/* @__PURE__ */ G(Qa, { children: [/* @__PURE__ */ W(xt, { styles: WY }), /* @__PURE__ */ W(UY, {})] })), "serviceWorker" in navigator && window.addEventListener("load", () => {
45502
+ `, qY = document.body.appendChild(document.createElement("div"));
45503
+ qY.classList.add("mount"), (0, Wa.createRoot)(qY).render(/* @__PURE__ */ G(Qa, { children: [/* @__PURE__ */ W(xt, { styles: KY }), /* @__PURE__ */ W(GY, {})] })), "serviceWorker" in navigator && window.addEventListener("load", () => {
45481
45504
  navigator.serviceWorker.register("/sw.js", { updateViaCache: "none" }).catch(() => {});
45482
45505
  });
45483
45506
  //#endregion