@banou/ripple 0.0.11 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +534 -533
- package/package.json +4 -1
- package/sw.js +1 -1
- package/.well-known/fkn.json +0 -1
- package/fkn.json +0 -1
package/index.js
CHANGED
|
@@ -35823,8 +35823,15 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
35823
35823
|
magnet: n,
|
|
35824
35824
|
selection: r
|
|
35825
35825
|
}) : /* @__PURE__ */ U(wB, {});
|
|
35826
|
-
}, EB =
|
|
35827
|
-
if (
|
|
35826
|
+
}, EB = () => {
|
|
35827
|
+
if (typeof window > "u") return !1;
|
|
35828
|
+
try {
|
|
35829
|
+
return window.top !== window.self;
|
|
35830
|
+
} catch {
|
|
35831
|
+
return !0;
|
|
35832
|
+
}
|
|
35833
|
+
}, DB = "ripple:folder", OB = () => typeof window < "u" && "showDirectoryPicker" in window && !EB(), kB = async () => {
|
|
35834
|
+
if (!OB()) return;
|
|
35828
35835
|
let e = window.showDirectoryPicker;
|
|
35829
35836
|
return e({
|
|
35830
35837
|
id: "ripple-downloads",
|
|
@@ -35832,38 +35839,38 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
35832
35839
|
}).catch((e) => {
|
|
35833
35840
|
if (e?.name !== "AbortError") throw e;
|
|
35834
35841
|
});
|
|
35835
|
-
},
|
|
35842
|
+
}, AB = async (e) => {
|
|
35836
35843
|
let { queryPermission: t } = e;
|
|
35837
35844
|
return await t?.call(e, { mode: "readwrite" }) ?? "granted";
|
|
35838
|
-
},
|
|
35839
|
-
if (await
|
|
35845
|
+
}, jB = async (e) => {
|
|
35846
|
+
if (await AB(e) === "granted") return !0;
|
|
35840
35847
|
let { requestPermission: t } = e;
|
|
35841
35848
|
return await t?.call(e, { mode: "readwrite" }) === "granted";
|
|
35842
|
-
},
|
|
35849
|
+
}, MB = () => {
|
|
35843
35850
|
let [e, t] = (0, _.useState)(null), [n, r] = (0, _.useState)(!1);
|
|
35844
35851
|
(0, _.useEffect)(() => {
|
|
35845
35852
|
(async () => {
|
|
35846
|
-
let e = await CP(
|
|
35847
|
-
e && (t(e), r(await
|
|
35853
|
+
let e = await CP(DB);
|
|
35854
|
+
e && (t(e), r(await AB(e) === "granted"));
|
|
35848
35855
|
})();
|
|
35849
35856
|
}, []);
|
|
35850
35857
|
let i = (0, _.useCallback)(async () => {
|
|
35851
|
-
let e = await
|
|
35852
|
-
return e ? (await wP(
|
|
35858
|
+
let e = await kB();
|
|
35859
|
+
return e ? (await wP(DB, e), t(e), r(!0), !0) : !1;
|
|
35853
35860
|
}, []), a = (0, _.useCallback)(async () => {
|
|
35854
|
-
e && r(await
|
|
35861
|
+
e && r(await jB(e));
|
|
35855
35862
|
}, [e]), o = (0, _.useCallback)(async () => {
|
|
35856
|
-
await TP(
|
|
35863
|
+
await TP(DB), t(null), r(!1);
|
|
35857
35864
|
}, []);
|
|
35858
35865
|
return {
|
|
35859
|
-
supported:
|
|
35866
|
+
supported: OB(),
|
|
35860
35867
|
folder: e,
|
|
35861
35868
|
permitted: n,
|
|
35862
35869
|
pick: i,
|
|
35863
35870
|
allow: a,
|
|
35864
35871
|
clear: o
|
|
35865
35872
|
};
|
|
35866
|
-
},
|
|
35873
|
+
}, NB = (e) => {
|
|
35867
35874
|
let [t, n] = (0, _.useState)(null);
|
|
35868
35875
|
return (0, _.useEffect)(() => {
|
|
35869
35876
|
if (!e) return;
|
|
@@ -35876,7 +35883,7 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
35876
35883
|
t = !0, window.clearInterval(i);
|
|
35877
35884
|
};
|
|
35878
35885
|
}, [e]), t;
|
|
35879
|
-
},
|
|
35886
|
+
}, PB = 3e4, FB = (e) => {
|
|
35880
35887
|
let [t, n] = (0, _.useState)(null);
|
|
35881
35888
|
return (0, _.useEffect)(() => {
|
|
35882
35889
|
let e = !1, t = async () => {
|
|
@@ -35893,14 +35900,14 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
35893
35900
|
t();
|
|
35894
35901
|
let r = window.setInterval(() => {
|
|
35895
35902
|
t();
|
|
35896
|
-
},
|
|
35903
|
+
}, PB), i = () => {
|
|
35897
35904
|
t();
|
|
35898
35905
|
};
|
|
35899
35906
|
return document.addEventListener("visibilitychange", i), () => {
|
|
35900
35907
|
e = !0, window.clearInterval(r), document.removeEventListener("visibilitychange", i);
|
|
35901
35908
|
};
|
|
35902
35909
|
}, [e]), t;
|
|
35903
|
-
},
|
|
35910
|
+
}, IB = ({ supported: e, folderName: t, permitted: n, defaultLocation: r }) => e ? t ? n ? r === "folder" ? {
|
|
35904
35911
|
kind: "settled",
|
|
35905
35912
|
folderName: t
|
|
35906
35913
|
} : {
|
|
@@ -35909,7 +35916,7 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
35909
35916
|
} : {
|
|
35910
35917
|
kind: "allow",
|
|
35911
35918
|
folderName: t
|
|
35912
|
-
} : { kind: "choose" } : { kind: "none" },
|
|
35919
|
+
} : { kind: "choose" } : { kind: "none" }, LB = (e) => {
|
|
35913
35920
|
switch (e.kind) {
|
|
35914
35921
|
case "none": return {
|
|
35915
35922
|
detail: "Removing a torrent frees its files.",
|
|
@@ -35932,18 +35939,18 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
35932
35939
|
action: null
|
|
35933
35940
|
};
|
|
35934
35941
|
}
|
|
35935
|
-
},
|
|
35942
|
+
}, RB = {
|
|
35936
35943
|
storage: yI,
|
|
35937
35944
|
permissions: xI
|
|
35938
|
-
},
|
|
35945
|
+
}, zB = { name: "persistent-storage" }, BB = async (e) => e.storage.estimate().then(({ quota: e }) => e ?? null).catch(() => null), VB = async (e = RB) => {
|
|
35939
35946
|
try {
|
|
35940
|
-
return (await e.permissions.query(
|
|
35947
|
+
return (await e.permissions.query(zB)).state;
|
|
35941
35948
|
} catch {
|
|
35942
35949
|
return "prompt";
|
|
35943
35950
|
}
|
|
35944
|
-
},
|
|
35951
|
+
}, HB = async (e = RB) => {
|
|
35945
35952
|
try {
|
|
35946
|
-
let t = await
|
|
35953
|
+
let t = await VB(e), n = await e.storage.persisted();
|
|
35947
35954
|
if (n || t !== "granted") return {
|
|
35948
35955
|
persisted: n,
|
|
35949
35956
|
permission: t,
|
|
@@ -35962,14 +35969,14 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
35962
35969
|
silentlyPersisted: !1
|
|
35963
35970
|
};
|
|
35964
35971
|
}
|
|
35965
|
-
},
|
|
35972
|
+
}, UB = async (e = RB) => {
|
|
35966
35973
|
try {
|
|
35967
|
-
let t = await
|
|
35974
|
+
let t = await BB(e);
|
|
35968
35975
|
return {
|
|
35969
35976
|
attempted: !0,
|
|
35970
35977
|
granted: await e.storage.persist(),
|
|
35971
35978
|
quotaBefore: t,
|
|
35972
|
-
quotaAfter: await
|
|
35979
|
+
quotaAfter: await BB(e)
|
|
35973
35980
|
};
|
|
35974
35981
|
} catch {
|
|
35975
35982
|
return {
|
|
@@ -35979,7 +35986,7 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
35979
35986
|
quotaAfter: null
|
|
35980
35987
|
};
|
|
35981
35988
|
}
|
|
35982
|
-
},
|
|
35989
|
+
}, WB = {
|
|
35983
35990
|
persisted: !1,
|
|
35984
35991
|
permission: "prompt",
|
|
35985
35992
|
attempted: !1,
|
|
@@ -35987,11 +35994,11 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
35987
35994
|
quotaBefore: null,
|
|
35988
35995
|
quotaAfter: null,
|
|
35989
35996
|
refreshKey: 0
|
|
35990
|
-
},
|
|
35991
|
-
let [e, t] = (0, _.useState)(
|
|
35997
|
+
}, GB = () => {
|
|
35998
|
+
let [e, t] = (0, _.useState)(WB);
|
|
35992
35999
|
(0, _.useEffect)(() => {
|
|
35993
36000
|
let e = !1;
|
|
35994
|
-
return
|
|
36001
|
+
return HB().then(({ persisted: n, permission: r, silentlyPersisted: i }) => {
|
|
35995
36002
|
e || t((e) => ({
|
|
35996
36003
|
...e,
|
|
35997
36004
|
persisted: n,
|
|
@@ -36003,7 +36010,7 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
36003
36010
|
};
|
|
36004
36011
|
}, []);
|
|
36005
36012
|
let n = (0, _.useCallback)(async () => {
|
|
36006
|
-
let e = await
|
|
36013
|
+
let e = await UB();
|
|
36007
36014
|
t((t) => {
|
|
36008
36015
|
let n = e.quotaAfter !== null && e.quotaAfter !== e.quotaBefore, r = e.granted === !0;
|
|
36009
36016
|
return {
|
|
@@ -36018,7 +36025,7 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
36018
36025
|
...e,
|
|
36019
36026
|
request: n
|
|
36020
36027
|
};
|
|
36021
|
-
},
|
|
36028
|
+
}, KB = ({ persisted: e, permission: t, attempted: n, granted: r }) => e ? {
|
|
36022
36029
|
kind: "none",
|
|
36023
36030
|
detail: "This site is already using persistent storage, so the browser will not clear it on its own.",
|
|
36024
36031
|
action: null
|
|
@@ -36034,8 +36041,8 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
36034
36041
|
kind: "ask",
|
|
36035
36042
|
detail: "Persistent storage does two things: it stops the browser clearing this site on its own, and on some browsers it is also what sets this limit, which can come back far larger. Your browser decides, and it may answer without asking you.",
|
|
36036
36043
|
action: "Ask for more room"
|
|
36037
|
-
},
|
|
36038
|
-
let t =
|
|
36044
|
+
}, qB = (e) => {
|
|
36045
|
+
let t = KB(e);
|
|
36039
36046
|
return e.persisted ? {
|
|
36040
36047
|
label: "Persistent",
|
|
36041
36048
|
hint: t.detail,
|
|
@@ -36057,8 +36064,8 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
36057
36064
|
on: !1,
|
|
36058
36065
|
actionable: !0
|
|
36059
36066
|
};
|
|
36060
|
-
},
|
|
36061
|
-
let n = (0, _.useRef)(!1), [r, i] = (0, _.useState)(!1), a =
|
|
36067
|
+
}, JB = ({ persist: e, onAsk: t }) => {
|
|
36068
|
+
let n = (0, _.useRef)(!1), [r, i] = (0, _.useState)(!1), a = KB(e);
|
|
36062
36069
|
return a.kind === "none" ? null : /* @__PURE__ */ W(co, { children: [/* @__PURE__ */ U("span", { children: a.detail }), a.action && /* @__PURE__ */ U("button", {
|
|
36063
36070
|
type: "button",
|
|
36064
36071
|
disabled: r,
|
|
@@ -36067,8 +36074,8 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
36067
36074
|
},
|
|
36068
36075
|
children: a.action
|
|
36069
36076
|
})] });
|
|
36070
|
-
},
|
|
36071
|
-
let a =
|
|
36077
|
+
}, YB = ({ storage: e, relief: t, onAct: n, persist: r, onAskPersist: i }) => {
|
|
36078
|
+
let a = LB(t);
|
|
36072
36079
|
return /* @__PURE__ */ W("div", {
|
|
36073
36080
|
className: "storage-warning surface",
|
|
36074
36081
|
role: "status",
|
|
@@ -36083,7 +36090,7 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
36083
36090
|
" your browser allows this site, counting everything it keeps here. Downloads stop when that runs out.",
|
|
36084
36091
|
!e.persisted && " Storage here is best effort, so the browser can also clear it on its own when the device gets tight."
|
|
36085
36092
|
] }),
|
|
36086
|
-
/* @__PURE__ */ U(
|
|
36093
|
+
/* @__PURE__ */ U(JB, {
|
|
36087
36094
|
persist: r,
|
|
36088
36095
|
onAsk: i
|
|
36089
36096
|
}),
|
|
@@ -36095,44 +36102,44 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
36095
36102
|
})
|
|
36096
36103
|
]
|
|
36097
36104
|
});
|
|
36098
|
-
},
|
|
36105
|
+
}, XB = 8 * 1024 * 1024, ZB = 16 * 1024, QB = [
|
|
36099
36106
|
0,
|
|
36100
36107
|
.25,
|
|
36101
36108
|
.5,
|
|
36102
36109
|
.75,
|
|
36103
36110
|
1
|
|
36104
|
-
],
|
|
36111
|
+
], $B = async (e, t) => {
|
|
36105
36112
|
let n = t.split("/").filter(Boolean), r = n.pop(), i = e;
|
|
36106
36113
|
for (let e of n) i = await i.getDirectoryHandle(e, { create: !0 });
|
|
36107
36114
|
return i.getFileHandle(r, { create: !0 });
|
|
36108
|
-
},
|
|
36115
|
+
}, eV = (e, t) => {
|
|
36109
36116
|
if (e.length !== t.length) return !1;
|
|
36110
36117
|
for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !1;
|
|
36111
36118
|
return !0;
|
|
36112
|
-
},
|
|
36119
|
+
}, tV = (e, t = ZB) => e <= 0 ? [] : e <= t * QB.length ? [{
|
|
36113
36120
|
offset: 0,
|
|
36114
36121
|
length: e
|
|
36115
|
-
}] : [...new Set(
|
|
36122
|
+
}] : [...new Set(QB.map((n) => Math.min(Math.max(0, Math.round((e - t) * n)), e - t)))].sort((e, t) => e - t).map((e) => ({
|
|
36116
36123
|
offset: e,
|
|
36117
36124
|
length: t
|
|
36118
|
-
})),
|
|
36125
|
+
})), nV = async (e, t, n, r, i) => {
|
|
36119
36126
|
let a = await r.getFile();
|
|
36120
36127
|
if (a.size !== i) return !1;
|
|
36121
36128
|
if (i === 0) return !0;
|
|
36122
|
-
for (let { offset: r, length: o } of
|
|
36129
|
+
for (let { offset: r, length: o } of tV(i)) {
|
|
36123
36130
|
let [i, s] = await Promise.all([e.read(Number(t.id), n, r, o, !1), a.slice(r, r + o).arrayBuffer()]);
|
|
36124
|
-
if (
|
|
36131
|
+
if (!eV(i, new Uint8Array(s))) return !1;
|
|
36125
36132
|
}
|
|
36126
36133
|
return !0;
|
|
36127
|
-
},
|
|
36134
|
+
}, rV = async (e, t, n) => {
|
|
36128
36135
|
let r = 0;
|
|
36129
36136
|
for (let i of BI(t.files)) {
|
|
36130
|
-
let a = i.index, o = await
|
|
36131
|
-
if (await
|
|
36137
|
+
let a = i.index, o = await $B(n, i.name);
|
|
36138
|
+
if (await nV(e, t, a, o, i.size)) continue;
|
|
36132
36139
|
let s = await o.createWritable();
|
|
36133
36140
|
try {
|
|
36134
|
-
for (let n = 0; n < i.size; n +=
|
|
36135
|
-
let r = Math.min(
|
|
36141
|
+
for (let n = 0; n < i.size; n += XB) {
|
|
36142
|
+
let r = Math.min(XB, i.size - n), o = await e.read(Number(t.id), a, n, r);
|
|
36136
36143
|
await s.write(o);
|
|
36137
36144
|
}
|
|
36138
36145
|
await s.close(), r++;
|
|
@@ -36141,17 +36148,17 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
36141
36148
|
}
|
|
36142
36149
|
}
|
|
36143
36150
|
return r;
|
|
36144
|
-
},
|
|
36151
|
+
}, iV = /* @__PURE__ */ new Set([
|
|
36145
36152
|
".DS_Store",
|
|
36146
36153
|
"Thumbs.db",
|
|
36147
36154
|
"desktop.ini"
|
|
36148
|
-
]),
|
|
36155
|
+
]), aV = (e) => iV.has(e), oV = (e) => typeof e.getFile == "function" ? e.getFile() : Promise.resolve(e), sV = class extends Error {
|
|
36149
36156
|
constructor() {
|
|
36150
36157
|
super("reading the folder was cancelled"), this.name = "WalkCancelled";
|
|
36151
36158
|
}
|
|
36152
|
-
},
|
|
36159
|
+
}, cV = async (e, { signal: t, onFound: n } = {}) => {
|
|
36153
36160
|
let r = [], i = [], a = !1, o = async (e, s) => {
|
|
36154
|
-
if (t?.aborted) throw new
|
|
36161
|
+
if (t?.aborted) throw new sV();
|
|
36155
36162
|
if (a) return;
|
|
36156
36163
|
if (s.length >= 16) {
|
|
36157
36164
|
i.push(`${s.join("/")} (nested too deep)`);
|
|
@@ -36160,7 +36167,7 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
36160
36167
|
let c = e.entries;
|
|
36161
36168
|
if (!c) throw Error("this browser cannot list a picked folder");
|
|
36162
36169
|
for await (let [l, u] of c.call(e)) {
|
|
36163
|
-
if (t?.aborted) throw new
|
|
36170
|
+
if (t?.aborted) throw new sV();
|
|
36164
36171
|
if (r.length >= 2e4) {
|
|
36165
36172
|
a = !0;
|
|
36166
36173
|
return;
|
|
@@ -36170,7 +36177,7 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
36170
36177
|
if (await o(u, e), a) return;
|
|
36171
36178
|
continue;
|
|
36172
36179
|
}
|
|
36173
|
-
if (
|
|
36180
|
+
if (aV(l)) {
|
|
36174
36181
|
i.push(e.join("/"));
|
|
36175
36182
|
continue;
|
|
36176
36183
|
}
|
|
@@ -36192,21 +36199,21 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
36192
36199
|
skipped: i,
|
|
36193
36200
|
truncated: a
|
|
36194
36201
|
};
|
|
36195
|
-
},
|
|
36196
|
-
let t = await
|
|
36202
|
+
}, lV = async (e) => {
|
|
36203
|
+
let t = await oV(e);
|
|
36197
36204
|
return {
|
|
36198
36205
|
path: [e.name],
|
|
36199
36206
|
size: t.size,
|
|
36200
36207
|
lastModified: t.lastModified,
|
|
36201
36208
|
handle: e
|
|
36202
36209
|
};
|
|
36203
|
-
},
|
|
36204
|
-
let r = await
|
|
36210
|
+
}, uV = async (e, t, n) => {
|
|
36211
|
+
let r = await oV(e.handle);
|
|
36205
36212
|
return new Uint8Array(await r.slice(t, t + n).arrayBuffer());
|
|
36206
|
-
},
|
|
36213
|
+
}, dV = async (e) => {
|
|
36207
36214
|
let t = [];
|
|
36208
36215
|
for (let n of e) {
|
|
36209
|
-
let e = await
|
|
36216
|
+
let e = await oV(n.handle).catch(() => null);
|
|
36210
36217
|
if (!e) {
|
|
36211
36218
|
t.push({
|
|
36212
36219
|
path: n.path.join("/"),
|
|
@@ -36222,16 +36229,16 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
36222
36229
|
});
|
|
36223
36230
|
}
|
|
36224
36231
|
return t;
|
|
36225
|
-
},
|
|
36226
|
-
let t = e(
|
|
36232
|
+
}, fV = "/native", pV = (e) => `${fV}/${e}`, mV = (e) => e === "/native" || !!e?.startsWith("/native/"), hV = "/source", gV = (e) => `${hV}/${e}`, _V = (e) => e === "/source" || !!e?.startsWith("/source/"), vV = "ripple:save-location", yV = (e) => e?.saveTo === "source" || e?.created === !0, bV = (e) => {
|
|
36233
|
+
let t = e(vV);
|
|
36227
36234
|
return t === "browser" || t === "folder" ? t : "browser";
|
|
36228
|
-
},
|
|
36235
|
+
}, xV = (e, t) => e?.saveTo === "source" ? "source" : e?.saveTo === "browser" || e?.saveTo === "folder" ? e.saveTo : t, SV = (e) => _V(e) ? "source" : mV(e) ? "folder" : "browser", CV = (e, t) => {
|
|
36229
36236
|
if (e === "source") {
|
|
36230
36237
|
if (!t) throw Error("a source-backed torrent needs its infohash to name its save path");
|
|
36231
|
-
return
|
|
36238
|
+
return gV(t);
|
|
36232
36239
|
}
|
|
36233
|
-
return e === "folder" ? t ?
|
|
36234
|
-
},
|
|
36240
|
+
return e === "folder" ? t ? pV(t) : "/dl" : fP(t);
|
|
36241
|
+
}, wV = ({ current: e, intended: t, complete: n, folderReady: r }) => e === "source" || t === "source" || e === t ? {
|
|
36235
36242
|
move: !1,
|
|
36236
36243
|
reason: "settled"
|
|
36237
36244
|
} : r ? t === "folder" && !n ? {
|
|
@@ -36243,28 +36250,28 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
36243
36250
|
} : {
|
|
36244
36251
|
move: !1,
|
|
36245
36252
|
reason: "no-folder"
|
|
36246
|
-
},
|
|
36253
|
+
}, TV = (e, t) => {
|
|
36247
36254
|
if (e.move || e.reason === "settled") return null;
|
|
36248
36255
|
let n = t ?? "your folder";
|
|
36249
36256
|
return e.reason === "incomplete" ? `Moves to ${n} when it finishes` : `Waiting for access to ${n}`;
|
|
36250
|
-
},
|
|
36257
|
+
}, EV = async (e, t, n) => {
|
|
36251
36258
|
let r = e;
|
|
36252
36259
|
for (let e of t.split("/").filter(Boolean)) r = await r.getDirectoryHandle(e, { create: n });
|
|
36253
36260
|
return r;
|
|
36254
|
-
},
|
|
36261
|
+
}, DV = async (e, t, n) => {
|
|
36255
36262
|
let r = t.split("/").filter(Boolean), i = r.pop();
|
|
36256
36263
|
if (!i) throw Error("move: empty file path");
|
|
36257
|
-
return (await
|
|
36258
|
-
},
|
|
36264
|
+
return (await EV(e, r.join("/"), n)).getFileHandle(i, { create: n });
|
|
36265
|
+
}, OV = async ({ torrent: e, folder: t, opfsRoot: n, onProgress: r }) => {
|
|
36259
36266
|
if (!e.infoHash) throw Error("move: a torrent with no infohash has nowhere to go");
|
|
36260
|
-
let i = BI(e.files), a =
|
|
36267
|
+
let i = BI(e.files), a = CV("browser", e.infoHash), o = 0;
|
|
36261
36268
|
for (let [e, s] of i.entries()) {
|
|
36262
36269
|
r?.({
|
|
36263
36270
|
file: e,
|
|
36264
36271
|
files: i.length,
|
|
36265
36272
|
name: s.name
|
|
36266
36273
|
});
|
|
36267
|
-
let c = await
|
|
36274
|
+
let c = await DV(t, s.name, !1), l = await DV(await EV(n, a, !0), s.name, !0);
|
|
36268
36275
|
if ((await l.getFile()).size === s.size) continue;
|
|
36269
36276
|
let u = await l.createWritable();
|
|
36270
36277
|
try {
|
|
@@ -36274,24 +36281,24 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
36274
36281
|
}
|
|
36275
36282
|
}
|
|
36276
36283
|
return o;
|
|
36277
|
-
},
|
|
36278
|
-
if (r === "folder" ? await
|
|
36284
|
+
}, kV = async ({ client: e, torrent: t, folder: n, to: r, opfsRoot: i, onProgress: a }) => {
|
|
36285
|
+
if (r === "folder" ? await rV(e, t, n) : await OV({
|
|
36279
36286
|
torrent: t,
|
|
36280
36287
|
folder: n,
|
|
36281
36288
|
opfsRoot: i ?? await navigator.storage.getDirectory(),
|
|
36282
36289
|
onProgress: a
|
|
36283
36290
|
}), !t.infoHash) throw Error("the torrent has no info hash, so the move cannot be finished safely");
|
|
36284
36291
|
e.relocate(t.infoHash, r);
|
|
36285
|
-
},
|
|
36292
|
+
}, AV = /^[0-9a-f]{40}$/, jV = /^[0-9a-f]{64}$/, MV = 300, NV = (e) => {
|
|
36286
36293
|
let t = fw(e, "xl");
|
|
36287
36294
|
if (!t) return;
|
|
36288
36295
|
let n = Number(t);
|
|
36289
36296
|
return Number.isSafeInteger(n) && n > 0 ? n : void 0;
|
|
36290
|
-
},
|
|
36297
|
+
}, PV = (e) => (e.match(/[?&]tr=/g) ?? []).length, FV = (e) => {
|
|
36291
36298
|
if (!e) return;
|
|
36292
36299
|
let t = e.replace(/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u2028-\u202e\u2066-\u2069]/g, "").trim();
|
|
36293
|
-
if (t) return t.length >
|
|
36294
|
-
},
|
|
36300
|
+
if (t) return t.length > MV ? t.slice(0, MV) + "…" : t;
|
|
36301
|
+
}, IV = ({ magnet: e, name: t }) => {
|
|
36295
36302
|
if (!e) return {
|
|
36296
36303
|
ok: !1,
|
|
36297
36304
|
problem: "This link carried no torrent. Ripple was asked to add nothing at all."
|
|
@@ -36301,21 +36308,21 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
36301
36308
|
problem: "This link is not a magnet link, so there is nothing here Ripple can add."
|
|
36302
36309
|
};
|
|
36303
36310
|
let n = uw(e);
|
|
36304
|
-
return n ? !
|
|
36311
|
+
return n ? !AV.test(n) && !jV.test(n) ? {
|
|
36305
36312
|
ok: !1,
|
|
36306
36313
|
problem: "This magnet link's info hash is malformed, so it does not name a torrent."
|
|
36307
36314
|
} : {
|
|
36308
36315
|
ok: !0,
|
|
36309
36316
|
magnet: e,
|
|
36310
36317
|
infoHash: n,
|
|
36311
|
-
name:
|
|
36312
|
-
trackers:
|
|
36313
|
-
sizeBytes:
|
|
36318
|
+
name: FV(fw(e, "dn")) ?? FV(t) ?? n,
|
|
36319
|
+
trackers: PV(e),
|
|
36320
|
+
sizeBytes: NV(e)
|
|
36314
36321
|
} : {
|
|
36315
36322
|
ok: !1,
|
|
36316
36323
|
problem: "This magnet link has no info hash, so it does not name a torrent."
|
|
36317
36324
|
};
|
|
36318
|
-
},
|
|
36325
|
+
}, LV = /* @__PURE__ */ c(Dt(), 1), RV = St`
|
|
36319
36326
|
position: fixed;
|
|
36320
36327
|
inset: 0;
|
|
36321
36328
|
z-index: ${2147483646};
|
|
@@ -36329,20 +36336,20 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
36329
36336
|
softening the hairlines of the torrent table underneath. OVERLAY_BG is 75% for that reason, and
|
|
36330
36337
|
alpha alone turns out to be enough to stop the list behind competing with the dialog. */
|
|
36331
36338
|
background: ${ZC};
|
|
36332
|
-
`,
|
|
36339
|
+
`, zV = [
|
|
36333
36340
|
"a[href]",
|
|
36334
36341
|
"button:not([disabled])",
|
|
36335
36342
|
"input:not([disabled])",
|
|
36336
36343
|
"select:not([disabled])",
|
|
36337
36344
|
"textarea:not([disabled])",
|
|
36338
36345
|
"[tabindex]:not([tabindex=\"-1\"])"
|
|
36339
|
-
].join(","),
|
|
36346
|
+
].join(","), BV = (e) => [...e.querySelectorAll(zV)].filter((e) => e.offsetWidth > 0 || e.offsetHeight > 0), VV = (e) => {
|
|
36340
36347
|
let t = [];
|
|
36341
36348
|
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)));
|
|
36342
36349
|
return () => {
|
|
36343
36350
|
for (let e of t) e.inert = !1;
|
|
36344
36351
|
};
|
|
36345
|
-
},
|
|
36352
|
+
}, HV = ({ labelledBy: e, onClose: t, children: n, initialFocus: r }) => {
|
|
36346
36353
|
let i = (0, _.useRef)(null), a = (0, _.useRef)(t);
|
|
36347
36354
|
a.current = t;
|
|
36348
36355
|
let o = (0, _.useCallback)((e) => {
|
|
@@ -36351,7 +36358,7 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
36351
36358
|
return;
|
|
36352
36359
|
}
|
|
36353
36360
|
if (e.key !== "Tab" || !i.current) return;
|
|
36354
|
-
let t =
|
|
36361
|
+
let t = BV(i.current);
|
|
36355
36362
|
if (t.length === 0) {
|
|
36356
36363
|
e.preventDefault();
|
|
36357
36364
|
return;
|
|
@@ -36362,13 +36369,13 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
36362
36369
|
return (0, _.useEffect)(() => {
|
|
36363
36370
|
let e = i.current;
|
|
36364
36371
|
if (!e) return;
|
|
36365
|
-
let t = document.activeElement, n =
|
|
36366
|
-
return (r?.current ??
|
|
36372
|
+
let t = document.activeElement, n = VV(e);
|
|
36373
|
+
return (r?.current ?? BV(e)[0])?.focus(), () => {
|
|
36367
36374
|
n(), t?.focus?.();
|
|
36368
36375
|
};
|
|
36369
|
-
}, []), (0,
|
|
36376
|
+
}, []), (0, LV.createPortal)(/* @__PURE__ */ U("div", {
|
|
36370
36377
|
ref: i,
|
|
36371
|
-
css:
|
|
36378
|
+
css: RV,
|
|
36372
36379
|
role: "dialog",
|
|
36373
36380
|
"aria-modal": "true",
|
|
36374
36381
|
"aria-labelledby": e,
|
|
@@ -36378,32 +36385,32 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
36378
36385
|
},
|
|
36379
36386
|
children: n
|
|
36380
36387
|
}), document.body);
|
|
36381
|
-
},
|
|
36388
|
+
}, UV = "ripple:add-dialog", WV = ({ fileCount: e, location: t }) => ({
|
|
36382
36389
|
files: Array.from({ length: e }, (e, t) => t),
|
|
36383
36390
|
location: t,
|
|
36384
36391
|
start: !0,
|
|
36385
36392
|
sequential: !1,
|
|
36386
36393
|
firstLast: !1,
|
|
36387
36394
|
topOfQueue: !1
|
|
36388
|
-
}),
|
|
36395
|
+
}), GV = (e) => {
|
|
36389
36396
|
try {
|
|
36390
|
-
return e(
|
|
36397
|
+
return e(UV) === "1";
|
|
36391
36398
|
} catch {
|
|
36392
36399
|
return !1;
|
|
36393
36400
|
}
|
|
36394
|
-
},
|
|
36401
|
+
}, KV = (e, t) => ({
|
|
36395
36402
|
wanted: e.files.length === t ? void 0 : [...e.files].sort((e, t) => e - t),
|
|
36396
36403
|
firstLast: e.firstLast
|
|
36397
|
-
}),
|
|
36404
|
+
}), qV = (e) => [e.sequential ? mw.sequentialDownload : 0, mw.sequentialDownload], JV = (e) => e.files.length === 0 ? "Choose at least one file, or cancel to add nothing at all." : null, YV = (e, t) => e.files.reduce((e, n) => e + (t[n]?.size ?? 0), 0), XV = (e, t) => ({
|
|
36398
36405
|
...e,
|
|
36399
36406
|
files: e.files.includes(t) ? e.files.filter((e) => e !== t) : [...e.files, t].sort((e, t) => e - t)
|
|
36400
|
-
}),
|
|
36407
|
+
}), ZV = (e, t) => ({
|
|
36401
36408
|
...e,
|
|
36402
36409
|
files: Array.from({ length: t }, (e, t) => t)
|
|
36403
|
-
}),
|
|
36410
|
+
}), QV = (e) => ({
|
|
36404
36411
|
...e,
|
|
36405
36412
|
files: []
|
|
36406
|
-
}),
|
|
36413
|
+
}), $V = St`
|
|
36407
36414
|
width: 100%;
|
|
36408
36415
|
display: flex;
|
|
36409
36416
|
align-items: center;
|
|
@@ -36629,23 +36636,23 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
36629
36636
|
|
|
36630
36637
|
&.small { padding: 5px 12px; font-size: 0.78rem; }
|
|
36631
36638
|
}
|
|
36632
|
-
`,
|
|
36639
|
+
`, eH = ({ path: e }) => {
|
|
36633
36640
|
let t = e.lastIndexOf("/");
|
|
36634
36641
|
return t < 0 ? /* @__PURE__ */ U(co, { children: e }) : /* @__PURE__ */ W(co, { children: [/* @__PURE__ */ U("span", {
|
|
36635
36642
|
className: "dir",
|
|
36636
36643
|
children: e.slice(0, t + 1)
|
|
36637
36644
|
}), e.slice(t + 1)] });
|
|
36638
|
-
},
|
|
36639
|
-
let h = (0, _.useRef)(null), [g, v] = (0, _.useState)(!1), y = n.length > 0, b = y ?
|
|
36645
|
+
}, tH = ({ name: e, from: t, files: n, choices: r, onChoices: i, folderName: a, folderReady: o, external: s, onConfirm: c, onCancel: l, onNeverAsk: u, storage: d, relief: f, persist: p, onAskPersist: m }) => {
|
|
36646
|
+
let h = (0, _.useRef)(null), [g, v] = (0, _.useState)(!1), y = n.length > 0, b = y ? JV(r) : null, x = n.reduce((e, t) => e + t.size, 0), S = YV(r, n), C = d ? Math.max(0, d.limitBytes - d.usedBytes) : null, w = C !== null && S > C ? { room: C } : null, T = !!p && !!m && KB(p).kind === "ask", E = (e) => i({
|
|
36640
36647
|
...r,
|
|
36641
36648
|
...e
|
|
36642
36649
|
});
|
|
36643
|
-
return /* @__PURE__ */ U(
|
|
36650
|
+
return /* @__PURE__ */ U(HV, {
|
|
36644
36651
|
labelledBy: "add-torrent-title",
|
|
36645
36652
|
onClose: l,
|
|
36646
36653
|
initialFocus: h,
|
|
36647
36654
|
children: /* @__PURE__ */ U("div", {
|
|
36648
|
-
css:
|
|
36655
|
+
css: $V,
|
|
36649
36656
|
children: /* @__PURE__ */ W("div", {
|
|
36650
36657
|
className: "card",
|
|
36651
36658
|
children: [
|
|
@@ -36672,12 +36679,12 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
36672
36679
|
children: [
|
|
36673
36680
|
/* @__PURE__ */ U("button", {
|
|
36674
36681
|
className: "small",
|
|
36675
|
-
onClick: () => i(
|
|
36682
|
+
onClick: () => i(ZV(r, n.length)),
|
|
36676
36683
|
children: "Select all"
|
|
36677
36684
|
}),
|
|
36678
36685
|
/* @__PURE__ */ U("button", {
|
|
36679
36686
|
className: "small",
|
|
36680
|
-
onClick: () => i(
|
|
36687
|
+
onClick: () => i(QV(r)),
|
|
36681
36688
|
children: "Select none"
|
|
36682
36689
|
}),
|
|
36683
36690
|
/* @__PURE__ */ W("span", {
|
|
@@ -36704,11 +36711,11 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
36704
36711
|
/* @__PURE__ */ U("input", {
|
|
36705
36712
|
type: "checkbox",
|
|
36706
36713
|
checked: n,
|
|
36707
|
-
onChange: () => i(
|
|
36714
|
+
onChange: () => i(XV(r, t))
|
|
36708
36715
|
}),
|
|
36709
36716
|
/* @__PURE__ */ U("span", {
|
|
36710
36717
|
className: "path",
|
|
36711
|
-
children: /* @__PURE__ */ U(
|
|
36718
|
+
children: /* @__PURE__ */ U(eH, { path: e.name })
|
|
36712
36719
|
}),
|
|
36713
36720
|
/* @__PURE__ */ U("span", {
|
|
36714
36721
|
className: "size",
|
|
@@ -36822,11 +36829,11 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
36822
36829
|
cw(w.room, !0),
|
|
36823
36830
|
" more here. It can still be added: the download stops if the room runs out before it finishes."
|
|
36824
36831
|
] }),
|
|
36825
|
-
p && m && /* @__PURE__ */ U(
|
|
36832
|
+
p && m && /* @__PURE__ */ U(JB, {
|
|
36826
36833
|
persist: p,
|
|
36827
36834
|
onAsk: m
|
|
36828
36835
|
}),
|
|
36829
|
-
!T && f && /* @__PURE__ */ U("span", { children:
|
|
36836
|
+
!T && f && /* @__PURE__ */ U("span", { children: LB(f).detail })
|
|
36830
36837
|
]
|
|
36831
36838
|
}),
|
|
36832
36839
|
/* @__PURE__ */ W("footer", { children: [
|
|
@@ -36857,7 +36864,7 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
36857
36864
|
})
|
|
36858
36865
|
})
|
|
36859
36866
|
});
|
|
36860
|
-
},
|
|
36867
|
+
}, nH = St`
|
|
36861
36868
|
color: ${Z};
|
|
36862
36869
|
font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
|
|
36863
36870
|
max-width: min(460px, calc(100vw - 32px));
|
|
@@ -37035,16 +37042,16 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
37035
37042
|
}
|
|
37036
37043
|
}
|
|
37037
37044
|
}
|
|
37038
|
-
`,
|
|
37045
|
+
`, rH = ({ title: e, subject: t, value: n, note: r, onCancel: i, onApply: a }) => {
|
|
37039
37046
|
let [o, s] = (0, _.useState)(() => Ew(n)), [c, l] = (0, _.useState)(() => !(typeof n == "number" && n > 0)), u = (0, _.useRef)(null), d = (0, _.useMemo)(() => c ? 0 : Tw(o), [c, o]), f = d === null ? "Enter a speed in kB/s, or tick Unlimited." : null, p = () => {
|
|
37040
37047
|
d !== null && a(d);
|
|
37041
37048
|
};
|
|
37042
|
-
return /* @__PURE__ */ U(
|
|
37049
|
+
return /* @__PURE__ */ U(HV, {
|
|
37043
37050
|
labelledBy: "rate-limit-title",
|
|
37044
37051
|
onClose: i,
|
|
37045
37052
|
initialFocus: u,
|
|
37046
37053
|
children: /* @__PURE__ */ U("div", {
|
|
37047
|
-
css:
|
|
37054
|
+
css: nH,
|
|
37048
37055
|
children: /* @__PURE__ */ W("div", {
|
|
37049
37056
|
className: "card",
|
|
37050
37057
|
children: [
|
|
@@ -37115,23 +37122,23 @@ var vR = "m", yR = "magnet", bR = [
|
|
|
37115
37122
|
})
|
|
37116
37123
|
})
|
|
37117
37124
|
});
|
|
37118
|
-
},
|
|
37125
|
+
}, iH = null;
|
|
37119
37126
|
typeof window < "u" && (window.addEventListener("beforeinstallprompt", (e) => {
|
|
37120
|
-
e.preventDefault(),
|
|
37127
|
+
e.preventDefault(), iH = e;
|
|
37121
37128
|
}), window.addEventListener("appinstalled", () => {
|
|
37122
|
-
|
|
37129
|
+
iH = null;
|
|
37123
37130
|
}));
|
|
37124
|
-
var
|
|
37131
|
+
var aH = () => window.location.origin + "/?magnet=%s", oH = () => typeof window < "u" && !!window.matchMedia?.("(display-mode: standalone)").matches || typeof navigator < "u" && navigator.standalone === !0, sH = () => {
|
|
37125
37132
|
if (typeof navigator > "u" || typeof navigator.registerProtocolHandler != "function") return !1;
|
|
37126
37133
|
try {
|
|
37127
|
-
return navigator.registerProtocolHandler("magnet",
|
|
37134
|
+
return navigator.registerProtocolHandler("magnet", aH()), !0;
|
|
37128
37135
|
} catch {
|
|
37129
37136
|
return !1;
|
|
37130
37137
|
}
|
|
37131
|
-
},
|
|
37132
|
-
let e =
|
|
37138
|
+
}, cH = async () => {
|
|
37139
|
+
let e = iH;
|
|
37133
37140
|
if (!e) return "unavailable";
|
|
37134
|
-
|
|
37141
|
+
iH = null;
|
|
37135
37142
|
try {
|
|
37136
37143
|
await e.prompt();
|
|
37137
37144
|
let { outcome: t } = await e.userChoice;
|
|
@@ -37139,11 +37146,11 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
37139
37146
|
} catch {
|
|
37140
37147
|
return "unavailable";
|
|
37141
37148
|
}
|
|
37142
|
-
},
|
|
37149
|
+
}, lH = async () => iH && await cH() === "accepted" ? "installed" : sH() ? "magnet-registered" : oH() ? "already-installed" : "unsupported", uH = () => {
|
|
37143
37150
|
try {
|
|
37144
37151
|
location.reload();
|
|
37145
37152
|
} catch {}
|
|
37146
|
-
},
|
|
37153
|
+
}, dH = 15 * 6e4, fH = 1e4, pH = (e = fH) => {
|
|
37147
37154
|
let [t, n] = (0, _.useState)(!1), r = (0, _.useRef)(null);
|
|
37148
37155
|
return (0, _.useEffect)(() => {
|
|
37149
37156
|
if (typeof navigator > "u" || !("serviceWorker" in navigator)) return;
|
|
@@ -37152,7 +37159,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
37152
37159
|
i = !1, c();
|
|
37153
37160
|
return;
|
|
37154
37161
|
}
|
|
37155
|
-
a &&
|
|
37162
|
+
a && uH();
|
|
37156
37163
|
};
|
|
37157
37164
|
navigator.serviceWorker.addEventListener("controllerchange", o);
|
|
37158
37165
|
let s = null, c = () => {
|
|
@@ -37174,7 +37181,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
37174
37181
|
});
|
|
37175
37182
|
let u = () => {
|
|
37176
37183
|
s?.update().catch(() => {});
|
|
37177
|
-
}, d = window.setInterval(u,
|
|
37184
|
+
}, d = window.setInterval(u, dH), f = () => {
|
|
37178
37185
|
document.visibilityState === "visible" && u();
|
|
37179
37186
|
};
|
|
37180
37187
|
return document.addEventListener("visibilitychange", f), () => {
|
|
@@ -37184,10 +37191,10 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
37184
37191
|
ready: t,
|
|
37185
37192
|
update: (0, _.useCallback)(() => {
|
|
37186
37193
|
let e = r.current;
|
|
37187
|
-
e ? e.postMessage({ type: "take-over" }) :
|
|
37194
|
+
e ? e.postMessage({ type: "take-over" }) : uH();
|
|
37188
37195
|
}, [])
|
|
37189
37196
|
};
|
|
37190
|
-
},
|
|
37197
|
+
}, mH = St`
|
|
37191
37198
|
color: ${Z};
|
|
37192
37199
|
font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
|
|
37193
37200
|
max-width: min(460px, calc(100vw - 32px));
|
|
@@ -37296,31 +37303,31 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
37296
37303
|
}
|
|
37297
37304
|
}
|
|
37298
37305
|
}
|
|
37299
|
-
`,
|
|
37306
|
+
`, hH = (e) => {
|
|
37300
37307
|
if (!e) return !1;
|
|
37301
37308
|
try {
|
|
37302
37309
|
return localStorage.getItem(e) === "skip";
|
|
37303
37310
|
} catch {
|
|
37304
37311
|
return !1;
|
|
37305
37312
|
}
|
|
37306
|
-
},
|
|
37313
|
+
}, gH = (e) => {
|
|
37307
37314
|
if (e) try {
|
|
37308
37315
|
localStorage.setItem(e, "skip");
|
|
37309
37316
|
} catch {}
|
|
37310
|
-
},
|
|
37311
|
-
let [e, t] = (0, _.useState)(null), [n, r] = (0, _.useState)(!1), i = (0, _.useRef)(null), a = (0, _.useRef)(null), o = (0, _.useCallback)((e) =>
|
|
37317
|
+
}, _H = () => {
|
|
37318
|
+
let [e, t] = (0, _.useState)(null), [n, r] = (0, _.useState)(!1), i = (0, _.useRef)(null), a = (0, _.useRef)(null), o = (0, _.useCallback)((e) => hH(e.rememberKey) ? Promise.resolve(!0) : (r(!1), t(e), new Promise((e) => {
|
|
37312
37319
|
a.current = e;
|
|
37313
37320
|
})), []), s = (0, _.useCallback)((r) => {
|
|
37314
|
-
r && n &&
|
|
37321
|
+
r && n && gH(e?.rememberKey), t(null), a.current?.(r), a.current = null;
|
|
37315
37322
|
}, [n, e]);
|
|
37316
37323
|
return {
|
|
37317
37324
|
confirm: o,
|
|
37318
|
-
confirmElement: e ? /* @__PURE__ */ U(
|
|
37325
|
+
confirmElement: e ? /* @__PURE__ */ U(HV, {
|
|
37319
37326
|
labelledBy: "confirm-title",
|
|
37320
37327
|
onClose: () => s(!1),
|
|
37321
37328
|
initialFocus: i,
|
|
37322
37329
|
children: /* @__PURE__ */ U("div", {
|
|
37323
|
-
css:
|
|
37330
|
+
css: mH,
|
|
37324
37331
|
children: /* @__PURE__ */ W("div", {
|
|
37325
37332
|
className: "card",
|
|
37326
37333
|
children: [
|
|
@@ -37354,7 +37361,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
37354
37361
|
}) : null,
|
|
37355
37362
|
confirmOpen: e != null
|
|
37356
37363
|
};
|
|
37357
|
-
},
|
|
37364
|
+
}, vH = St`
|
|
37358
37365
|
width: 100%;
|
|
37359
37366
|
display: flex;
|
|
37360
37367
|
align-items: center;
|
|
@@ -37789,7 +37796,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
37789
37796
|
@media (max-width: 700px) {
|
|
37790
37797
|
.opt > label { width: auto; }
|
|
37791
37798
|
}
|
|
37792
|
-
`,
|
|
37799
|
+
`, yH = (e) => e.split("/").pop() || e, bH = ({ torrent: e, dragging: t, onMagnet: n, onFiles: r, onClear: i, onClose: a, onToast: o }) => {
|
|
37793
37800
|
let [s, c] = (0, _.useState)("download"), [l, u] = (0, _.useState)(""), [d, f] = (0, _.useState)(!1), p = (0, _.useRef)(null), m = e?.files, h = m?.length ?? 0, g = e?.fileCount ?? 0, [v, y] = (0, _.useState)(null), [b, x] = (0, _.useState)(null);
|
|
37794
37801
|
(0, _.useEffect)(() => {
|
|
37795
37802
|
y(null), x(null);
|
|
@@ -37824,12 +37831,12 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
37824
37831
|
}, N = (e) => {
|
|
37825
37832
|
e?.length && (f(!0), r(e));
|
|
37826
37833
|
};
|
|
37827
|
-
return /* @__PURE__ */ U(
|
|
37834
|
+
return /* @__PURE__ */ U(HV, {
|
|
37828
37835
|
labelledBy: "share-link-title",
|
|
37829
37836
|
onClose: a,
|
|
37830
37837
|
initialFocus: p,
|
|
37831
37838
|
children: /* @__PURE__ */ U("div", {
|
|
37832
|
-
css:
|
|
37839
|
+
css: vH,
|
|
37833
37840
|
children: /* @__PURE__ */ W("div", {
|
|
37834
37841
|
className: "card",
|
|
37835
37842
|
children: [
|
|
@@ -37893,7 +37900,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
37893
37900
|
children: m.map((e, t) => /* @__PURE__ */ W("option", {
|
|
37894
37901
|
value: t,
|
|
37895
37902
|
children: [
|
|
37896
|
-
|
|
37903
|
+
yH(e.name),
|
|
37897
37904
|
" · ",
|
|
37898
37905
|
cw(e.size)
|
|
37899
37906
|
]
|
|
@@ -37929,7 +37936,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
37929
37936
|
}),
|
|
37930
37937
|
/* @__PURE__ */ U("span", {
|
|
37931
37938
|
className: "name",
|
|
37932
|
-
children:
|
|
37939
|
+
children: yH(e.name)
|
|
37933
37940
|
}),
|
|
37934
37941
|
/* @__PURE__ */ U("span", {
|
|
37935
37942
|
className: "size",
|
|
@@ -38050,11 +38057,11 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
38050
38057
|
})
|
|
38051
38058
|
})
|
|
38052
38059
|
});
|
|
38053
|
-
},
|
|
38060
|
+
}, xH = [
|
|
38054
38061
|
"udp://tracker.opentrackr.org:1337/announce",
|
|
38055
38062
|
"udp://explodie.org:6969/announce",
|
|
38056
38063
|
"udp://tracker.torrent.eu.org:451/announce"
|
|
38057
|
-
],
|
|
38064
|
+
], SH = ({ name: e, trackers: t, webSeeds: n = [], private: r, pieceLength: i, format: a = "v1" }) => {
|
|
38058
38065
|
if (a !== "v1" && a !== "hybrid" && a !== "v2") return `${String(a)} is not a torrent format`;
|
|
38059
38066
|
let o = t.map((e) => e.trim()).filter(Boolean);
|
|
38060
38067
|
if (!e.trim()) return "Give the torrent a name";
|
|
@@ -38063,7 +38070,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
38063
38070
|
for (let e of o) if (!/^(https?|udp|ws|wss):\/\/[^\s/]+/.test(e)) return `${e} is not a tracker address`;
|
|
38064
38071
|
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`;
|
|
38065
38072
|
return i !== void 0 && !vz(i) ? "That piece size is not one a torrent can use" : null;
|
|
38066
|
-
},
|
|
38073
|
+
}, CH = (e, t) => e.map((e) => e.trim()).filter(Boolean).map((e) => t ? e.replace(/\/+$/, "") : e.endsWith("/") ? e : e + "/"), wH = async ({ picked: e, hashed: t, options: n, single: r }) => {
|
|
38067
38074
|
let i = n.format ?? "v1", a = wz({
|
|
38068
38075
|
name: n.name,
|
|
38069
38076
|
files: e.map(({ path: e, size: t }) => ({
|
|
@@ -38078,7 +38085,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
38078
38085
|
pieces: t.pieces,
|
|
38079
38086
|
fileHashes: t.fileHashes,
|
|
38080
38087
|
trackers: o,
|
|
38081
|
-
webSeeds:
|
|
38088
|
+
webSeeds: CH(n.webSeeds ?? [], r),
|
|
38082
38089
|
private: n.private,
|
|
38083
38090
|
source: n.source,
|
|
38084
38091
|
comment: n.comment
|
|
@@ -38119,46 +38126,46 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
38119
38126
|
size: e.size
|
|
38120
38127
|
}))
|
|
38121
38128
|
};
|
|
38122
|
-
},
|
|
38129
|
+
}, TH = 16 * 1024, EH = /* @__PURE__ */ new Uint8Array(32), DH = async (e) => new Uint8Array(await crypto.subtle.digest("SHA-256", new Uint8Array(e).buffer)), OH = (e, t) => {
|
|
38123
38130
|
let n = /* @__PURE__ */ new Uint8Array(64);
|
|
38124
38131
|
return n.set(e, 0), n.set(t, 32), n;
|
|
38125
|
-
},
|
|
38132
|
+
}, kH = (e) => Math.max(1, Math.floor(e / TH)), AH = (e) => {
|
|
38126
38133
|
let t = 1;
|
|
38127
38134
|
for (; t < e;) t *= 2;
|
|
38128
38135
|
return t;
|
|
38129
|
-
},
|
|
38130
|
-
let n = Math.ceil(e /
|
|
38131
|
-
return n <= 0 ? 0 : e <= t ?
|
|
38132
|
-
}, jH = async (e) => {
|
|
38133
|
-
let t = TH;
|
|
38134
|
-
for (let n = 0; n < e; n++) t = await EH(DH(t, t));
|
|
38135
|
-
return t;
|
|
38136
|
+
}, jH = (e, t) => {
|
|
38137
|
+
let n = Math.ceil(e / TH);
|
|
38138
|
+
return n <= 0 ? 0 : e <= t ? AH(n) : Math.ceil(e / t) * kH(t);
|
|
38136
38139
|
}, MH = async (e) => {
|
|
38140
|
+
let t = EH;
|
|
38141
|
+
for (let n = 0; n < e; n++) t = await DH(OH(t, t));
|
|
38142
|
+
return t;
|
|
38143
|
+
}, NH = async (e) => {
|
|
38137
38144
|
let t = [];
|
|
38138
|
-
for (let n = 0; n < e.length; n += 2) t.push(await
|
|
38145
|
+
for (let n = 0; n < e.length; n += 2) t.push(await DH(OH(e[n], e[n + 1])));
|
|
38139
38146
|
return t;
|
|
38140
|
-
},
|
|
38147
|
+
}, PH = async (e, t, n) => {
|
|
38141
38148
|
if (t <= 0 || !e.length) return {
|
|
38142
38149
|
root: null,
|
|
38143
38150
|
layer: []
|
|
38144
38151
|
};
|
|
38145
|
-
let r =
|
|
38152
|
+
let r = jH(t, n);
|
|
38146
38153
|
if (e.length > r) throw Error(`merkle: ${e.length} leaves for a file of ${t} bytes that wants at most ${r}`);
|
|
38147
38154
|
let i = [...e];
|
|
38148
|
-
for (; i.length < r;) i.push(
|
|
38149
|
-
let a =
|
|
38150
|
-
for (; i.length > 1 && 1 << o < a;) i = await
|
|
38151
|
-
let s = t > n ? [...i] : [], c = await
|
|
38152
|
-
for (; i.length > 1;) i.length % 2 && (i = [...i, c]), i = await
|
|
38155
|
+
for (; i.length < r;) i.push(EH);
|
|
38156
|
+
let a = kH(n), o = 0;
|
|
38157
|
+
for (; i.length > 1 && 1 << o < a;) i = await NH(i), o += 1;
|
|
38158
|
+
let s = t > n ? [...i] : [], c = await MH(o);
|
|
38159
|
+
for (; i.length > 1;) i.length % 2 && (i = [...i, c]), i = await NH(i), c = await DH(OH(c, c));
|
|
38153
38160
|
return {
|
|
38154
38161
|
root: i[0],
|
|
38155
38162
|
layer: s
|
|
38156
38163
|
};
|
|
38157
|
-
},
|
|
38164
|
+
}, FH = 4 * 1024 * 1024, IH = class extends Error {
|
|
38158
38165
|
constructor() {
|
|
38159
38166
|
super("hashing cancelled"), this.name = "HashCancelled";
|
|
38160
38167
|
}
|
|
38161
|
-
},
|
|
38168
|
+
}, LH = async (e) => new Uint8Array(await crypto.subtle.digest("SHA-1", new Uint8Array(e).buffer)), RH = async (e, t, { signal: n, onProgress: r, maxReadBytes: i = FH } = {}) => {
|
|
38162
38169
|
let a = fz(e.format), o = dz(e.format), s = new Uint8Array(a ? e.pieceCount * 20 : 0), c = [];
|
|
38163
38170
|
if (!e.pieceCount) {
|
|
38164
38171
|
if (o) for (let t = 0; t < bz(e).length; t++) c.push({
|
|
@@ -38171,7 +38178,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
38171
38178
|
};
|
|
38172
38179
|
}
|
|
38173
38180
|
let l = new Uint8Array(a ? e.pieceLength : 0), u = 0, d = 0, f = 0, p = e.files[0].path.join("/"), m = () => {
|
|
38174
|
-
if (n?.aborted) throw new
|
|
38181
|
+
if (n?.aborted) throw new IH();
|
|
38175
38182
|
}, h = () => r?.({
|
|
38176
38183
|
hashedBytes: f,
|
|
38177
38184
|
totalBytes: e.totalBytes,
|
|
@@ -38180,15 +38187,15 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
38180
38187
|
path: p
|
|
38181
38188
|
}), g = async (e) => {
|
|
38182
38189
|
if (a) {
|
|
38183
|
-
let t = await
|
|
38190
|
+
let t = await LH(l.subarray(0, e));
|
|
38184
38191
|
s.set(t, d * 20);
|
|
38185
38192
|
}
|
|
38186
38193
|
d += 1, u = 0, h();
|
|
38187
|
-
}, _ = new Uint8Array(o ?
|
|
38194
|
+
}, _ = new Uint8Array(o ? TH : 0), v = 0, y = [], b = async (e) => {
|
|
38188
38195
|
let t = 0;
|
|
38189
38196
|
for (; t < e.length;) {
|
|
38190
|
-
let n = Math.min(
|
|
38191
|
-
_.set(e.subarray(t, t + n), v), v += n, t += n, v === 16384 && (y.push(await
|
|
38197
|
+
let n = Math.min(TH - v, e.length - t);
|
|
38198
|
+
_.set(e.subarray(t, t + n), v), v += n, t += n, v === 16384 && (y.push(await DH(_)), v = 0);
|
|
38192
38199
|
}
|
|
38193
38200
|
};
|
|
38194
38201
|
m();
|
|
@@ -38210,7 +38217,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
38210
38217
|
if (c.length !== s) throw Error(`${p} gave ${c.length} bytes of the ${s} at ${r}: the file changed while it was being read`);
|
|
38211
38218
|
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();
|
|
38212
38219
|
}
|
|
38213
|
-
o && (v > 0 && y.push(await
|
|
38220
|
+
o && (v > 0 && y.push(await DH(_.subarray(0, v))), c.push(await PH(y, n.size, e.pieceLength)));
|
|
38214
38221
|
}
|
|
38215
38222
|
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`);
|
|
38216
38223
|
if (o && c.length !== bz(e).length) throw Error(`built ${c.length} merkle trees for ${bz(e).length} files`);
|
|
@@ -38218,11 +38225,11 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
38218
38225
|
pieces: s,
|
|
38219
38226
|
fileHashes: c
|
|
38220
38227
|
};
|
|
38221
|
-
},
|
|
38228
|
+
}, zH = (e, t) => {
|
|
38222
38229
|
if (t < 1e3 || e.hashedBytes <= 0) return;
|
|
38223
38230
|
let n = e.hashedBytes / (t / 1e3);
|
|
38224
38231
|
if (!(n <= 0)) return Math.round((e.totalBytes - e.hashedBytes) / n);
|
|
38225
|
-
},
|
|
38232
|
+
}, BH = St`
|
|
38226
38233
|
color: ${Z};
|
|
38227
38234
|
width: 100%;
|
|
38228
38235
|
max-width: min(560px, calc(100vw - 32px));
|
|
@@ -38371,12 +38378,12 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
38371
38378
|
.grow { flex: 1; }
|
|
38372
38379
|
.skipped { max-height: 8rem; overflow-y: auto; font-size: 0.8rem; color: ${KC}; }
|
|
38373
38380
|
code { font-size: 0.8rem; word-break: break-all; }
|
|
38374
|
-
`,
|
|
38381
|
+
`, VH = (() => {
|
|
38375
38382
|
let e = [];
|
|
38376
38383
|
for (let t = pz; t <= mz; t *= 2) e.push(t);
|
|
38377
38384
|
return e;
|
|
38378
|
-
})(),
|
|
38379
|
-
let { state: i, suggestedName: a } = e, [o, s] = (0, _.useState)(""), [c, l] = (0, _.useState)(
|
|
38385
|
+
})(), HH = (e) => e >= 1024 * 1024 ? `${e / (1024 * 1024)} MiB` : `${e / 1024} KiB`, UH = ({ create: e, onClose: t, onShare: n, onToast: r }) => {
|
|
38386
|
+
let { state: i, suggestedName: a } = e, [o, s] = (0, _.useState)(""), [c, l] = (0, _.useState)(xH.join("\n")), [u, d] = (0, _.useState)(!1), [f, p] = (0, _.useState)(""), [m, h] = (0, _.useState)(""), [g, v] = (0, _.useState)(""), [y, b] = (0, _.useState)(""), [x, S] = (0, _.useState)("v1"), [C, w] = (0, _.useState)(0), T = (0, _.useRef)(null);
|
|
38380
38387
|
(0, _.useEffect)(() => {
|
|
38381
38388
|
s(a), S("v1"), b(""), w(0);
|
|
38382
38389
|
}, [a]), (0, _.useEffect)(() => {
|
|
@@ -38404,13 +38411,13 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
38404
38411
|
pieceLength: y ? Number(y) : void 0,
|
|
38405
38412
|
format: x,
|
|
38406
38413
|
...t
|
|
38407
|
-
}), O = i.stage === "reading" || i.stage === "hashing" || i.stage === "checking" || i.stage === "copying" || i.stage === "adding", ee = i.progress && C ?
|
|
38408
|
-
return /* @__PURE__ */ U(
|
|
38414
|
+
}), O = i.stage === "reading" || i.stage === "hashing" || i.stage === "checking" || i.stage === "copying" || i.stage === "adding", ee = i.progress && C ? zH(i.progress, Date.now() - C) : void 0, k = i.progress ? i.progress.hashedBytes / Math.max(1, i.progress.totalBytes) : 0, A = i.copy ? i.copy.copiedBytes / Math.max(1, i.copy.totalBytes) : 0;
|
|
38415
|
+
return /* @__PURE__ */ U(HV, {
|
|
38409
38416
|
labelledBy: "create-torrent-title",
|
|
38410
38417
|
onClose: O ? e.cancel : t,
|
|
38411
38418
|
initialFocus: T,
|
|
38412
38419
|
children: /* @__PURE__ */ U("div", {
|
|
38413
|
-
css:
|
|
38420
|
+
css: BH,
|
|
38414
38421
|
children: /* @__PURE__ */ W("div", {
|
|
38415
38422
|
className: "card",
|
|
38416
38423
|
children: [
|
|
@@ -38522,12 +38529,12 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
38522
38529
|
value: "",
|
|
38523
38530
|
children: [
|
|
38524
38531
|
"Auto (",
|
|
38525
|
-
|
|
38532
|
+
HH(i.plan.pieceLength),
|
|
38526
38533
|
")"
|
|
38527
38534
|
]
|
|
38528
|
-
}),
|
|
38535
|
+
}), VH.map((e) => /* @__PURE__ */ U("option", {
|
|
38529
38536
|
value: e,
|
|
38530
|
-
children:
|
|
38537
|
+
children: HH(e)
|
|
38531
38538
|
}, e))]
|
|
38532
38539
|
})]
|
|
38533
38540
|
}),
|
|
@@ -38535,7 +38542,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
38535
38542
|
className: "faint",
|
|
38536
38543
|
children: [
|
|
38537
38544
|
"A piece is the smallest thing a peer can send, so at ",
|
|
38538
|
-
|
|
38545
|
+
HH(i.plan.pieceLength),
|
|
38539
38546
|
" ",
|
|
38540
38547
|
"a stream waits that long for its first frame and one failed check costs that much to fetch again."
|
|
38541
38548
|
]
|
|
@@ -38783,19 +38790,19 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
38783
38790
|
})
|
|
38784
38791
|
})
|
|
38785
38792
|
});
|
|
38786
|
-
},
|
|
38793
|
+
}, WH = 1e9, GH = (e) => !Number.isFinite(e) || e <= 0 ? 0 : Math.min(WH, Math.floor(e * .1)), KH = (e) => {
|
|
38787
38794
|
let t = new TextEncoder();
|
|
38788
38795
|
for (let n of e) for (let e of n.split("/")) if (t.encode(e).length > 240) return e;
|
|
38789
38796
|
return null;
|
|
38790
|
-
},
|
|
38797
|
+
}, qH = ({ totalBytes: e, usedBytes: t, limitBytes: n }) => {
|
|
38791
38798
|
if (!Number.isFinite(n) || n <= 0 || !Number.isFinite(t) || t < 0) return { kind: "unknown" };
|
|
38792
|
-
let r = n - t -
|
|
38799
|
+
let r = n - t - GH(n);
|
|
38793
38800
|
return e <= r ? { kind: "fits" } : {
|
|
38794
38801
|
kind: "short",
|
|
38795
38802
|
shortBy: e - r
|
|
38796
38803
|
};
|
|
38797
|
-
},
|
|
38798
|
-
let n =
|
|
38804
|
+
}, JH = async (e, t = []) => {
|
|
38805
|
+
let n = KH(t);
|
|
38799
38806
|
if (n) return {
|
|
38800
38807
|
kind: "unsafe",
|
|
38801
38808
|
element: n
|
|
@@ -38803,7 +38810,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
38803
38810
|
try {
|
|
38804
38811
|
await yI.getDirectory();
|
|
38805
38812
|
let { usage: t, quota: n } = await yI.estimate();
|
|
38806
|
-
return t === void 0 ? { kind: "unknown" } :
|
|
38813
|
+
return t === void 0 ? { kind: "unknown" } : qH({
|
|
38807
38814
|
totalBytes: e,
|
|
38808
38815
|
usedBytes: t,
|
|
38809
38816
|
limitBytes: n ?? 0
|
|
@@ -38811,19 +38818,19 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
38811
38818
|
} catch {
|
|
38812
38819
|
return { kind: "unknown" };
|
|
38813
38820
|
}
|
|
38814
|
-
},
|
|
38821
|
+
}, YH = async (e, t) => {
|
|
38815
38822
|
let n = e;
|
|
38816
38823
|
for (let e of t.split("/").filter(Boolean)) n = await n.getDirectoryHandle(e, { create: !0 });
|
|
38817
38824
|
return n;
|
|
38818
|
-
},
|
|
38825
|
+
}, XH = async (e, t) => {
|
|
38819
38826
|
let n = t.split("/").filter(Boolean), r = n.pop();
|
|
38820
38827
|
if (!r) throw Error("copy: empty file path");
|
|
38821
|
-
return (await
|
|
38822
|
-
},
|
|
38828
|
+
return (await YH(e, n.join("/"))).getFileHandle(r, { create: !0 });
|
|
38829
|
+
}, ZH = async (e) => {
|
|
38823
38830
|
let t = await Jz(e.bytes);
|
|
38824
38831
|
if (!t) throw Error("the torrent that was just built could not be read back");
|
|
38825
38832
|
if (!t.files) throw Error("the torrent that was just built lists no files");
|
|
38826
|
-
let n =
|
|
38833
|
+
let n = KH(t.files.map((e) => e.name));
|
|
38827
38834
|
if (n) throw Error(`${n.slice(0, 40)}... is too long a name for the engine to keep`);
|
|
38828
38835
|
return t.files.map((t) => {
|
|
38829
38836
|
let n = e.handles[t.index];
|
|
@@ -38834,8 +38841,8 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
38834
38841
|
ref: n
|
|
38835
38842
|
};
|
|
38836
38843
|
});
|
|
38837
|
-
},
|
|
38838
|
-
let i = await
|
|
38844
|
+
}, QH = async ({ built: e, opfsRoot: t, signal: n, onProgress: r }) => {
|
|
38845
|
+
let i = await ZH(e), a = fP(e.infoHash), o = await YH(t ?? await navigator.storage.getDirectory(), a), s = i.reduce((e, t) => e + t.size, 0), c = 0;
|
|
38839
38846
|
for (let [e, t] of i.entries()) {
|
|
38840
38847
|
if (n?.aborted) throw new DOMException("the copy was cancelled", "AbortError");
|
|
38841
38848
|
r?.({
|
|
@@ -38845,12 +38852,12 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
38845
38852
|
copiedBytes: c,
|
|
38846
38853
|
totalBytes: s
|
|
38847
38854
|
});
|
|
38848
|
-
let a = await
|
|
38855
|
+
let a = await XH(o, t.path);
|
|
38849
38856
|
if ((await a.getFile()).size === t.size) {
|
|
38850
38857
|
c += t.size;
|
|
38851
38858
|
continue;
|
|
38852
38859
|
}
|
|
38853
|
-
let l = await
|
|
38860
|
+
let l = await oV(t.ref);
|
|
38854
38861
|
if (l.size !== t.size) throw Error(`${t.path} is now ${l.size} bytes where the torrent describes ${t.size}`);
|
|
38855
38862
|
let u = await a.createWritable();
|
|
38856
38863
|
try {
|
|
@@ -38870,7 +38877,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
38870
38877
|
savePath: a,
|
|
38871
38878
|
copiedBytes: c
|
|
38872
38879
|
};
|
|
38873
|
-
},
|
|
38880
|
+
}, $H = {
|
|
38874
38881
|
stage: "idle",
|
|
38875
38882
|
plan: null,
|
|
38876
38883
|
skipped: [],
|
|
@@ -38882,30 +38889,30 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
38882
38889
|
reopenable: null,
|
|
38883
38890
|
room: null,
|
|
38884
38891
|
copy: null
|
|
38885
|
-
},
|
|
38892
|
+
}, eU = (e) => "ripple:source:" + e, tU = { mode: "read" }, nU = async (e) => await e.queryPermission?.call(e, tU) ?? "granted", rU = async (e) => await e.requestPermission?.call(e, tU) === "granted", iU = () => typeof window < "u", aU = (e) => {
|
|
38886
38893
|
try {
|
|
38887
38894
|
return structuredClone(e), !0;
|
|
38888
38895
|
} catch {
|
|
38889
38896
|
return !1;
|
|
38890
38897
|
}
|
|
38891
|
-
},
|
|
38892
|
-
files: [await
|
|
38898
|
+
}, oU = async (e, { signal: t, onFound: n }) => e.kind === "file" ? {
|
|
38899
|
+
files: [await lV(e)],
|
|
38893
38900
|
skipped: [],
|
|
38894
38901
|
truncated: !1,
|
|
38895
38902
|
single: !0
|
|
38896
38903
|
} : {
|
|
38897
|
-
...await
|
|
38904
|
+
...await cV(e, {
|
|
38898
38905
|
signal: t,
|
|
38899
38906
|
onFound: n
|
|
38900
38907
|
}),
|
|
38901
38908
|
single: !1
|
|
38902
|
-
},
|
|
38903
|
-
let [t, n] = (0, _.useState)(
|
|
38909
|
+
}, sU = (e) => {
|
|
38910
|
+
let [t, n] = (0, _.useState)($H), [r, i] = (0, _.useState)(""), a = (0, _.useRef)(null), o = (0, _.useRef)(null);
|
|
38904
38911
|
(0, _.useEffect)(() => () => o.current?.abort(), []);
|
|
38905
38912
|
let s = (e) => {
|
|
38906
38913
|
let t = e?.name;
|
|
38907
|
-
if (e instanceof
|
|
38908
|
-
n(
|
|
38914
|
+
if (e instanceof IH || t === "WalkCancelled" || t === "AbortError") {
|
|
38915
|
+
n($H);
|
|
38909
38916
|
return;
|
|
38910
38917
|
}
|
|
38911
38918
|
n((t) => ({
|
|
@@ -38916,7 +38923,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
38916
38923
|
}, c = (0, _.useCallback)((e, t, r) => {
|
|
38917
38924
|
if (!e.files.length) throw Error("There are no files in there to put in a torrent");
|
|
38918
38925
|
if (!e.files.reduce((e, t) => e + t.size, 0)) throw Error("Every file in there is empty, and a torrent needs something to share");
|
|
38919
|
-
let i =
|
|
38926
|
+
let i = aU(r);
|
|
38920
38927
|
a.current = {
|
|
38921
38928
|
root: r,
|
|
38922
38929
|
name: t,
|
|
@@ -38933,7 +38940,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
38933
38940
|
single: e.single
|
|
38934
38941
|
});
|
|
38935
38942
|
if (n({
|
|
38936
|
-
|
|
38943
|
+
...$H,
|
|
38937
38944
|
stage: "ready",
|
|
38938
38945
|
plan: o,
|
|
38939
38946
|
skipped: e.skipped,
|
|
@@ -38942,7 +38949,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
38942
38949
|
reopenable: i
|
|
38943
38950
|
}), !i) {
|
|
38944
38951
|
let r = e.single ? [t] : e.files.map((e) => [t, ...e.path].join("/"));
|
|
38945
|
-
|
|
38952
|
+
JH(o.totalBytes, r).then((e) => {
|
|
38946
38953
|
n((t) => t.stage === "ready" ? {
|
|
38947
38954
|
...t,
|
|
38948
38955
|
room: e
|
|
@@ -38952,11 +38959,11 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
38952
38959
|
}, []), l = (0, _.useCallback)(async (e) => {
|
|
38953
38960
|
let t = new AbortController();
|
|
38954
38961
|
o.current = t, n({
|
|
38955
|
-
|
|
38962
|
+
...$H,
|
|
38956
38963
|
stage: "reading"
|
|
38957
38964
|
}), i(e.name);
|
|
38958
38965
|
try {
|
|
38959
|
-
let r = await
|
|
38966
|
+
let r = await oU(e, {
|
|
38960
38967
|
signal: t.signal,
|
|
38961
38968
|
onFound: (e) => n((t) => t.stage === "reading" ? {
|
|
38962
38969
|
...t,
|
|
@@ -38982,7 +38989,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
38982
38989
|
}, [l]), f = (0, _.useCallback)(async (t) => {
|
|
38983
38990
|
let r = a.current;
|
|
38984
38991
|
if (!r) return;
|
|
38985
|
-
let i =
|
|
38992
|
+
let i = SH(t);
|
|
38986
38993
|
if (i) {
|
|
38987
38994
|
n((e) => ({
|
|
38988
38995
|
...e,
|
|
@@ -38999,7 +39006,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
38999
39006
|
progress: null
|
|
39000
39007
|
}));
|
|
39001
39008
|
try {
|
|
39002
|
-
let i = await
|
|
39009
|
+
let i = await RH(wz({
|
|
39003
39010
|
name: t.name,
|
|
39004
39011
|
files: r.files.map(({ path: e, size: t }) => ({
|
|
39005
39012
|
path: e,
|
|
@@ -39011,7 +39018,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
39011
39018
|
}), (e, t, n) => {
|
|
39012
39019
|
let i = r.files.find((t) => t.path.join("/") === e.path.join("/"));
|
|
39013
39020
|
if (!i) throw Error(`no handle for ${e.path.join("/")}`);
|
|
39014
|
-
return
|
|
39021
|
+
return uV(i, t, n);
|
|
39015
39022
|
}, {
|
|
39016
39023
|
signal: c.signal,
|
|
39017
39024
|
onProgress: (e) => n((t) => ({
|
|
@@ -39023,16 +39030,16 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
39023
39030
|
...e,
|
|
39024
39031
|
stage: "checking"
|
|
39025
39032
|
}));
|
|
39026
|
-
let a = await
|
|
39033
|
+
let a = await dV(r.files);
|
|
39027
39034
|
if (a.length) throw Error(`${a[0].path} changed while it was being read` + (a.length > 1 ? `, along with ${a.length - 1} more` : "") + ". Nothing was published; start again and it will match.");
|
|
39028
|
-
let o = await
|
|
39035
|
+
let o = await wH({
|
|
39029
39036
|
picked: r.files,
|
|
39030
39037
|
hashed: i,
|
|
39031
39038
|
options: t,
|
|
39032
39039
|
single: r.single
|
|
39033
39040
|
});
|
|
39034
39041
|
if (!r.reopenable) {
|
|
39035
|
-
let t = await
|
|
39042
|
+
let t = await JH(o.plan.totalBytes, o.files.map((e) => e.name));
|
|
39036
39043
|
if (n((e) => ({
|
|
39037
39044
|
...e,
|
|
39038
39045
|
room: t
|
|
@@ -39043,7 +39050,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
39043
39050
|
copy: null
|
|
39044
39051
|
})), e.reserveStorage(o.infoHash, !0);
|
|
39045
39052
|
try {
|
|
39046
|
-
let { savePath: t } = await
|
|
39053
|
+
let { savePath: t } = await QH({
|
|
39047
39054
|
built: o,
|
|
39048
39055
|
signal: c.signal,
|
|
39049
39056
|
onProgress: (e) => n((t) => ({
|
|
@@ -39075,7 +39082,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
39075
39082
|
...e,
|
|
39076
39083
|
stage: "adding"
|
|
39077
39084
|
}));
|
|
39078
|
-
let s = r.reopenable ? await wP(
|
|
39085
|
+
let s = r.reopenable ? await wP(eU(o.infoHash), r.root).then(() => !0).catch(() => !1) : !1, l = r.reopenable ? o.handles : await Promise.all(o.handles.map((e) => e ? oV(e) : Promise.resolve(null)));
|
|
39079
39086
|
e.createSource({
|
|
39080
39087
|
infoHash: o.infoHash,
|
|
39081
39088
|
magnet: o.magnet,
|
|
@@ -39118,10 +39125,10 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
39118
39125
|
}, []), m = (0, _.useCallback)(() => {
|
|
39119
39126
|
o.current?.abort();
|
|
39120
39127
|
}, []), h = (0, _.useCallback)(() => {
|
|
39121
|
-
o.current?.abort(), a.current = null, n(
|
|
39128
|
+
o.current?.abort(), a.current = null, n($H);
|
|
39122
39129
|
}, []);
|
|
39123
39130
|
return {
|
|
39124
|
-
supported:
|
|
39131
|
+
supported: iU(),
|
|
39125
39132
|
state: t,
|
|
39126
39133
|
suggestedName: r,
|
|
39127
39134
|
pickFolder: u,
|
|
@@ -39131,9 +39138,9 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
39131
39138
|
cancel: m,
|
|
39132
39139
|
reset: h
|
|
39133
39140
|
};
|
|
39134
|
-
},
|
|
39141
|
+
}, cU = (e, t, n) => {
|
|
39135
39142
|
let [r, i] = (0, _.useState)([]), a = (0, _.useRef)(/* @__PURE__ */ new Set()), o = (0, _.useCallback)(async (t, n) => {
|
|
39136
|
-
let r = await
|
|
39143
|
+
let r = await oU(n, {}), i = wz({
|
|
39137
39144
|
name: t.name ?? n.name,
|
|
39138
39145
|
files: r.files.map(({ path: e, size: t }) => ({
|
|
39139
39146
|
path: e,
|
|
@@ -39158,9 +39165,9 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
39158
39165
|
return (async () => {
|
|
39159
39166
|
let n = t.filter((e) => GF(e) && !a.current.has(e.infoHash)), r = [];
|
|
39160
39167
|
for (let e of n) {
|
|
39161
|
-
let t = await CP(
|
|
39168
|
+
let t = await CP(eU(e.infoHash)).catch(() => void 0);
|
|
39162
39169
|
if (t) {
|
|
39163
|
-
if (await
|
|
39170
|
+
if (await nU(t) === "granted") {
|
|
39164
39171
|
await o(e, t).catch(() => r.push({
|
|
39165
39172
|
entry: e,
|
|
39166
39173
|
name: t.name
|
|
@@ -39186,8 +39193,8 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
39186
39193
|
allow: (0, _.useCallback)(async (e) => {
|
|
39187
39194
|
let n = t.find((t) => t.infoHash === e);
|
|
39188
39195
|
if (!n) return !1;
|
|
39189
|
-
let r = await CP(
|
|
39190
|
-
if (!r || !await
|
|
39196
|
+
let r = await CP(eU(e)).catch(() => void 0);
|
|
39197
|
+
if (!r || !await rU(r)) return !1;
|
|
39191
39198
|
try {
|
|
39192
39199
|
return await o(n, r), i((t) => t.filter((t) => t.entry.infoHash !== e)), !0;
|
|
39193
39200
|
} catch {
|
|
@@ -39195,8 +39202,8 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
39195
39202
|
}
|
|
39196
39203
|
}, [t, o])
|
|
39197
39204
|
};
|
|
39198
|
-
},
|
|
39199
|
-
let n = (0, _.useRef)(!1), [r, i] = (0, _.useState)(!1), a =
|
|
39205
|
+
}, lU = ({ persist: e, onAsk: t }) => {
|
|
39206
|
+
let n = (0, _.useRef)(!1), [r, i] = (0, _.useState)(!1), a = qB(e);
|
|
39200
39207
|
return /* @__PURE__ */ W("div", {
|
|
39201
39208
|
className: "folder",
|
|
39202
39209
|
children: [/* @__PURE__ */ U("span", { children: "Storage" }), /* @__PURE__ */ U("button", {
|
|
@@ -39210,18 +39217,18 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
39210
39217
|
children: a.label
|
|
39211
39218
|
})]
|
|
39212
39219
|
});
|
|
39213
|
-
},
|
|
39220
|
+
}, uU = {
|
|
39214
39221
|
peers: [],
|
|
39215
39222
|
trackers: [],
|
|
39216
39223
|
loaded: !1
|
|
39217
|
-
},
|
|
39218
|
-
let t = cP(), [n, r] = (0, _.useState)(
|
|
39224
|
+
}, dU = (e) => {
|
|
39225
|
+
let t = cP(), [n, r] = (0, _.useState)(uU);
|
|
39219
39226
|
return (0, _.useEffect)(() => {
|
|
39220
39227
|
if (e == null) {
|
|
39221
|
-
r(
|
|
39228
|
+
r(uU), t.inspect(null);
|
|
39222
39229
|
return;
|
|
39223
39230
|
}
|
|
39224
|
-
r(
|
|
39231
|
+
r(uU), t.inspect(e);
|
|
39225
39232
|
let n = t.onDetail((t) => {
|
|
39226
39233
|
!t || t.handle !== e || r({
|
|
39227
39234
|
peers: t.peers,
|
|
@@ -39233,89 +39240,89 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
39233
39240
|
n(), t.inspect(null);
|
|
39234
39241
|
};
|
|
39235
39242
|
}, [t, e]), n;
|
|
39236
|
-
},
|
|
39243
|
+
}, fU = [
|
|
39237
39244
|
"general",
|
|
39238
39245
|
"files",
|
|
39239
39246
|
"peers",
|
|
39240
39247
|
"trackers"
|
|
39241
|
-
],
|
|
39248
|
+
], pU = {
|
|
39242
39249
|
general: "General",
|
|
39243
39250
|
files: "Content",
|
|
39244
39251
|
peers: "Peers",
|
|
39245
39252
|
trackers: "Trackers"
|
|
39246
|
-
},
|
|
39253
|
+
}, mU = "ripple:dock-height", hU = 140, gU = 720, _U = 300, vU = (e) => cw(e, !0), yU = (e) => `${vU(e)}/s`, bU = (e) => `${(e * 100).toFixed(e > 0 && e < .01 ? 2 : 0)}%`, xU = (e) => {
|
|
39247
39254
|
let t = e.lastIndexOf("/");
|
|
39248
39255
|
return t < 0 ? ["", e] : [e.slice(0, t + 1), e.slice(t + 1)];
|
|
39249
|
-
},
|
|
39256
|
+
}, SU = (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`, CU = (e) => e > 0 ? (/* @__PURE__ */ new Date(e * 1e3)).toLocaleString() : "Not yet", wU = (e) => e.allTimeDownload === 0 ? e.allTimeUpload > 0 ? "∞" : "0.00" : (e.allTimeUpload / e.allTimeDownload).toFixed(2), TU = ({ label: e, value: t, mono: n }) => /* @__PURE__ */ W("div", {
|
|
39250
39257
|
className: "fact",
|
|
39251
39258
|
children: [/* @__PURE__ */ U("label", { children: e }), /* @__PURE__ */ U("span", {
|
|
39252
39259
|
className: n ? "mono" : void 0,
|
|
39253
39260
|
children: t
|
|
39254
39261
|
})]
|
|
39255
|
-
}),
|
|
39262
|
+
}), EU = ({ t: e }) => {
|
|
39256
39263
|
let t = e.stats, n = Math.max(0, e.size - e.downloaded);
|
|
39257
39264
|
return /* @__PURE__ */ W("div", {
|
|
39258
39265
|
className: "general",
|
|
39259
39266
|
children: [/* @__PURE__ */ W("section", { children: [/* @__PURE__ */ U("h3", { children: "Transfer" }), /* @__PURE__ */ W("div", {
|
|
39260
39267
|
className: "facts",
|
|
39261
39268
|
children: [
|
|
39262
|
-
/* @__PURE__ */ U(
|
|
39269
|
+
/* @__PURE__ */ U(TU, {
|
|
39263
39270
|
label: "Time active",
|
|
39264
|
-
value: t ? `${
|
|
39271
|
+
value: t ? `${SU(t.activeSeconds)} (${SU(t.sessionActiveSeconds)} this session)` : "-"
|
|
39265
39272
|
}),
|
|
39266
|
-
/* @__PURE__ */ U(
|
|
39273
|
+
/* @__PURE__ */ U(TU, {
|
|
39267
39274
|
label: "Time left",
|
|
39268
39275
|
value: e.state === "downloading" && e.eta !== "-" ? e.eta : "-"
|
|
39269
39276
|
}),
|
|
39270
|
-
/* @__PURE__ */ U(
|
|
39277
|
+
/* @__PURE__ */ U(TU, {
|
|
39271
39278
|
label: "Connections",
|
|
39272
39279
|
value: t ? `${t.numConnections}${t.connectionsLimit > 0 ? ` of ${t.connectionsLimit}` : ""}` : "-"
|
|
39273
39280
|
}),
|
|
39274
|
-
/* @__PURE__ */ U(
|
|
39281
|
+
/* @__PURE__ */ U(TU, {
|
|
39275
39282
|
label: "Downloaded",
|
|
39276
|
-
value: t ? `${
|
|
39283
|
+
value: t ? `${vU(t.allTimeDownload)} (${vU(t.sessionDownload)} this session)` : vU(e.downloaded)
|
|
39277
39284
|
}),
|
|
39278
|
-
/* @__PURE__ */ U(
|
|
39285
|
+
/* @__PURE__ */ U(TU, {
|
|
39279
39286
|
label: "Uploaded",
|
|
39280
|
-
value: t ? `${
|
|
39287
|
+
value: t ? `${vU(t.allTimeUpload)} (${vU(t.sessionUpload)} this session)` : "-"
|
|
39281
39288
|
}),
|
|
39282
|
-
/* @__PURE__ */ U(
|
|
39289
|
+
/* @__PURE__ */ U(TU, {
|
|
39283
39290
|
label: "Seeds",
|
|
39284
39291
|
value: t ? `${e.seeds} connected${t.swarmSeeds >= 0 ? ` of ${t.swarmSeeds} known` : ""}` : String(e.seeds)
|
|
39285
39292
|
}),
|
|
39286
|
-
/* @__PURE__ */ U(
|
|
39293
|
+
/* @__PURE__ */ U(TU, {
|
|
39287
39294
|
label: "Download speed",
|
|
39288
|
-
value:
|
|
39295
|
+
value: yU(e.down)
|
|
39289
39296
|
}),
|
|
39290
|
-
/* @__PURE__ */ U(
|
|
39297
|
+
/* @__PURE__ */ U(TU, {
|
|
39291
39298
|
label: "Upload speed",
|
|
39292
|
-
value:
|
|
39299
|
+
value: yU(e.up)
|
|
39293
39300
|
}),
|
|
39294
|
-
/* @__PURE__ */ U(
|
|
39301
|
+
/* @__PURE__ */ U(TU, {
|
|
39295
39302
|
label: "Peers",
|
|
39296
39303
|
value: t ? `${e.peers} connected${t.swarmPeers >= 0 ? ` of ${t.swarmPeers} known` : ""}` : String(e.peers)
|
|
39297
39304
|
}),
|
|
39298
|
-
/* @__PURE__ */ U(
|
|
39305
|
+
/* @__PURE__ */ U(TU, {
|
|
39299
39306
|
label: "Share ratio",
|
|
39300
|
-
value: t ?
|
|
39307
|
+
value: t ? wU(t) : "-"
|
|
39301
39308
|
}),
|
|
39302
|
-
/* @__PURE__ */ U(
|
|
39309
|
+
/* @__PURE__ */ U(TU, {
|
|
39303
39310
|
label: "Wasted",
|
|
39304
|
-
value: t ?
|
|
39311
|
+
value: t ? vU(t.wasted) : "-"
|
|
39305
39312
|
}),
|
|
39306
|
-
/* @__PURE__ */ U(
|
|
39313
|
+
/* @__PURE__ */ U(TU, {
|
|
39307
39314
|
label: "Remaining",
|
|
39308
|
-
value: n === 0 ? "Nothing, it is complete" :
|
|
39315
|
+
value: n === 0 ? "Nothing, it is complete" : vU(n)
|
|
39309
39316
|
}),
|
|
39310
|
-
/* @__PURE__ */ U(
|
|
39317
|
+
/* @__PURE__ */ U(TU, {
|
|
39311
39318
|
label: "Seeding for",
|
|
39312
|
-
value: t ? `${
|
|
39319
|
+
value: t ? `${SU(t.seedingSeconds)} (${SU(t.sessionSeedingSeconds)} this session)` : "-"
|
|
39313
39320
|
}),
|
|
39314
|
-
/* @__PURE__ */ U(
|
|
39321
|
+
/* @__PURE__ */ U(TU, {
|
|
39315
39322
|
label: "Availability",
|
|
39316
39323
|
value: t && t.availability >= 0 ? t.availability.toFixed(2) : "-"
|
|
39317
39324
|
}),
|
|
39318
|
-
/* @__PURE__ */ U(
|
|
39325
|
+
/* @__PURE__ */ U(TU, {
|
|
39319
39326
|
label: "Inbound peers",
|
|
39320
39327
|
value: t ? t.hadIncoming ? "Yes, peers have dialled in" : "None yet" : "-"
|
|
39321
39328
|
})
|
|
@@ -39323,55 +39330,55 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
39323
39330
|
})] }), /* @__PURE__ */ W("section", { children: [/* @__PURE__ */ U("h3", { children: "Information" }), /* @__PURE__ */ W("div", {
|
|
39324
39331
|
className: "facts",
|
|
39325
39332
|
children: [
|
|
39326
|
-
/* @__PURE__ */ U(
|
|
39333
|
+
/* @__PURE__ */ U(TU, {
|
|
39327
39334
|
label: "Total size",
|
|
39328
|
-
value:
|
|
39335
|
+
value: vU(e.size)
|
|
39329
39336
|
}),
|
|
39330
|
-
/* @__PURE__ */ U(
|
|
39337
|
+
/* @__PURE__ */ U(TU, {
|
|
39331
39338
|
label: "Pieces",
|
|
39332
|
-
value: t && t.numPieces ? `${t.numPieces} x ${
|
|
39339
|
+
value: t && t.numPieces ? `${t.numPieces} x ${vU(t.pieceLength)} (have ${t.numPiecesHave})` : "-"
|
|
39333
39340
|
}),
|
|
39334
|
-
/* @__PURE__ */ U(
|
|
39341
|
+
/* @__PURE__ */ U(TU, {
|
|
39335
39342
|
label: "Progress",
|
|
39336
|
-
value:
|
|
39343
|
+
value: bU(e.progress)
|
|
39337
39344
|
}),
|
|
39338
|
-
/* @__PURE__ */ U(
|
|
39345
|
+
/* @__PURE__ */ U(TU, {
|
|
39339
39346
|
label: "Added on",
|
|
39340
|
-
value: t ?
|
|
39347
|
+
value: t ? CU(t.addedAt) : "-"
|
|
39341
39348
|
}),
|
|
39342
|
-
/* @__PURE__ */ U(
|
|
39349
|
+
/* @__PURE__ */ U(TU, {
|
|
39343
39350
|
label: "Completed on",
|
|
39344
|
-
value: t ?
|
|
39351
|
+
value: t ? CU(t.completedAt) : "-"
|
|
39345
39352
|
}),
|
|
39346
|
-
/* @__PURE__ */ U(
|
|
39353
|
+
/* @__PURE__ */ U(TU, {
|
|
39347
39354
|
label: "Last seen complete",
|
|
39348
|
-
value: t ?
|
|
39355
|
+
value: t ? CU(t.lastSeenComplete) : "-"
|
|
39349
39356
|
}),
|
|
39350
|
-
/* @__PURE__ */ U(
|
|
39357
|
+
/* @__PURE__ */ U(TU, {
|
|
39351
39358
|
label: "Files",
|
|
39352
39359
|
value: String(BI(e.files).length)
|
|
39353
39360
|
}),
|
|
39354
|
-
/* @__PURE__ */ U(
|
|
39361
|
+
/* @__PURE__ */ U(TU, {
|
|
39355
39362
|
label: "Save path",
|
|
39356
39363
|
value: t?.savePath || "-",
|
|
39357
39364
|
mono: !0
|
|
39358
39365
|
}),
|
|
39359
|
-
e.infoHash && /* @__PURE__ */ U(
|
|
39366
|
+
e.infoHash && /* @__PURE__ */ U(TU, {
|
|
39360
39367
|
label: "Info hash",
|
|
39361
39368
|
value: e.infoHash,
|
|
39362
39369
|
mono: !0
|
|
39363
39370
|
}),
|
|
39364
|
-
e.retry && /* @__PURE__ */ U(
|
|
39371
|
+
e.retry && /* @__PURE__ */ U(TU, {
|
|
39365
39372
|
label: "Retrying",
|
|
39366
39373
|
value: `attempt ${e.retry.attempt}${e.retry.message ? `, ${e.retry.message}` : ""}`
|
|
39367
39374
|
})
|
|
39368
39375
|
]
|
|
39369
39376
|
})] })]
|
|
39370
39377
|
});
|
|
39371
|
-
},
|
|
39378
|
+
}, DU = ({ files: e, saving: t, onSave: n }) => e.length ? /* @__PURE__ */ U("div", {
|
|
39372
39379
|
className: "rows",
|
|
39373
39380
|
children: e.map((e) => {
|
|
39374
|
-
let [r, i] =
|
|
39381
|
+
let [r, i] = xU(e.name), a = t[e.index];
|
|
39375
39382
|
return /* @__PURE__ */ W("div", {
|
|
39376
39383
|
className: "row file",
|
|
39377
39384
|
children: [
|
|
@@ -39384,7 +39391,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
39384
39391
|
}),
|
|
39385
39392
|
/* @__PURE__ */ U("span", {
|
|
39386
39393
|
className: "num",
|
|
39387
|
-
children:
|
|
39394
|
+
children: vU(e.size)
|
|
39388
39395
|
}),
|
|
39389
39396
|
n && /* @__PURE__ */ U("button", {
|
|
39390
39397
|
type: "button",
|
|
@@ -39398,10 +39405,10 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
39398
39405
|
}) : /* @__PURE__ */ U("p", {
|
|
39399
39406
|
className: "none",
|
|
39400
39407
|
children: "No file list yet. It arrives with the torrent's metadata."
|
|
39401
|
-
}),
|
|
39408
|
+
}), OU = (e) => {
|
|
39402
39409
|
let t = [];
|
|
39403
39410
|
return t.push(_w(e) === "utp" ? "uTP" : "TCP"), gw(e) && t.push("incoming"), e.flags & (pw.rc4Encrypted | pw.plaintextEncrypted) && t.push("encrypted"), e.flags & pw.seed && t.push("seed"), e.source & hw.dht ? t.push("DHT") : e.source & hw.pex ? t.push("PEX") : e.source & hw.tracker && t.push("tracker"), t;
|
|
39404
|
-
},
|
|
39411
|
+
}, kU = ({ peers: e, loaded: t }) => {
|
|
39405
39412
|
if (!t) return /* @__PURE__ */ U("p", {
|
|
39406
39413
|
className: "none",
|
|
39407
39414
|
children: "Asking the engine…"
|
|
@@ -39455,7 +39462,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
39455
39462
|
children: e.endpoint
|
|
39456
39463
|
}), /* @__PURE__ */ U("span", {
|
|
39457
39464
|
className: "tags",
|
|
39458
|
-
children:
|
|
39465
|
+
children: OU(e).map((e) => /* @__PURE__ */ U("span", {
|
|
39459
39466
|
className: "tag",
|
|
39460
39467
|
children: e
|
|
39461
39468
|
}, e))
|
|
@@ -39468,28 +39475,28 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
39468
39475
|
}),
|
|
39469
39476
|
/* @__PURE__ */ U("span", {
|
|
39470
39477
|
className: "num",
|
|
39471
|
-
children:
|
|
39478
|
+
children: bU(e.progress)
|
|
39472
39479
|
}),
|
|
39473
39480
|
/* @__PURE__ */ U("span", {
|
|
39474
39481
|
className: "num",
|
|
39475
|
-
children: e.downloadRate ?
|
|
39482
|
+
children: e.downloadRate ? yU(e.downloadRate) : "-"
|
|
39476
39483
|
}),
|
|
39477
39484
|
/* @__PURE__ */ U("span", {
|
|
39478
39485
|
className: "num",
|
|
39479
|
-
children: e.uploadRate ?
|
|
39486
|
+
children: e.uploadRate ? yU(e.uploadRate) : "-"
|
|
39480
39487
|
}),
|
|
39481
39488
|
/* @__PURE__ */ U("span", {
|
|
39482
39489
|
className: "num",
|
|
39483
|
-
children: e.totalDownload ?
|
|
39490
|
+
children: e.totalDownload ? vU(e.totalDownload) : "-"
|
|
39484
39491
|
}),
|
|
39485
39492
|
/* @__PURE__ */ U("span", {
|
|
39486
39493
|
className: "num",
|
|
39487
|
-
children: e.totalUpload ?
|
|
39494
|
+
children: e.totalUpload ? vU(e.totalUpload) : "-"
|
|
39488
39495
|
})
|
|
39489
39496
|
]
|
|
39490
39497
|
}, e.endpoint))]
|
|
39491
39498
|
});
|
|
39492
|
-
},
|
|
39499
|
+
}, AU = (e) => e.updating ? {
|
|
39493
39500
|
label: "Announcing…",
|
|
39494
39501
|
tone: "idle"
|
|
39495
39502
|
} : e.fails < 0 ? {
|
|
@@ -39501,7 +39508,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
39501
39508
|
} : {
|
|
39502
39509
|
label: `Failed ${e.fails}×`,
|
|
39503
39510
|
tone: "warn"
|
|
39504
|
-
},
|
|
39511
|
+
}, jU = ({ trackers: e, loaded: t }) => {
|
|
39505
39512
|
if (!t) return /* @__PURE__ */ U("p", {
|
|
39506
39513
|
className: "none",
|
|
39507
39514
|
children: "Asking the engine…"
|
|
@@ -39542,7 +39549,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
39542
39549
|
})
|
|
39543
39550
|
]
|
|
39544
39551
|
}), n.map((e) => {
|
|
39545
|
-
let t =
|
|
39552
|
+
let t = AU(e);
|
|
39546
39553
|
return /* @__PURE__ */ W("div", {
|
|
39547
39554
|
className: "row",
|
|
39548
39555
|
children: [
|
|
@@ -39570,19 +39577,19 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
39570
39577
|
}),
|
|
39571
39578
|
/* @__PURE__ */ U("span", {
|
|
39572
39579
|
className: "num",
|
|
39573
|
-
children:
|
|
39580
|
+
children: SU(e.nextAnnounceIn)
|
|
39574
39581
|
})
|
|
39575
39582
|
]
|
|
39576
39583
|
}, e.url);
|
|
39577
39584
|
})]
|
|
39578
39585
|
});
|
|
39579
|
-
},
|
|
39586
|
+
}, MU = () => {
|
|
39580
39587
|
try {
|
|
39581
|
-
let e = Number(localStorage.getItem(
|
|
39582
|
-
if (Number.isFinite(e) && e >=
|
|
39588
|
+
let e = Number(localStorage.getItem(mU));
|
|
39589
|
+
if (Number.isFinite(e) && e >= hU && e <= gU) return e;
|
|
39583
39590
|
} catch {}
|
|
39584
|
-
return
|
|
39585
|
-
},
|
|
39591
|
+
return _U;
|
|
39592
|
+
}, NU = St`
|
|
39586
39593
|
flex: none;
|
|
39587
39594
|
display: flex;
|
|
39588
39595
|
flex-direction: column;
|
|
@@ -39919,16 +39926,16 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
39919
39926
|
display: none;
|
|
39920
39927
|
}
|
|
39921
39928
|
}
|
|
39922
|
-
`,
|
|
39923
|
-
let [a, o] = (0, _.useState)("general"), [s, c] = (0, _.useState)(
|
|
39929
|
+
`, PU = ({ t: e, handle: t, saving: n, onSave: r, onClose: i }) => {
|
|
39930
|
+
let [a, o] = (0, _.useState)("general"), [s, c] = (0, _.useState)(MU), l = (0, _.useRef)(!1), u = dU(t), d = (0, _.useCallback)((e) => {
|
|
39924
39931
|
e.preventDefault(), l.current = !0;
|
|
39925
39932
|
let t = e.clientY, n = s, r = (e) => {
|
|
39926
|
-
let r = Math.min(
|
|
39933
|
+
let r = Math.min(gU, Math.max(hU, n + (t - e.clientY)));
|
|
39927
39934
|
c(r);
|
|
39928
39935
|
}, i = () => {
|
|
39929
39936
|
l.current = !1, window.removeEventListener("pointermove", r), window.removeEventListener("pointerup", i), c((e) => {
|
|
39930
39937
|
try {
|
|
39931
|
-
localStorage.setItem(
|
|
39938
|
+
localStorage.setItem(mU, String(e));
|
|
39932
39939
|
} catch {}
|
|
39933
39940
|
return e;
|
|
39934
39941
|
});
|
|
@@ -39943,7 +39950,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
39943
39950
|
};
|
|
39944
39951
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
39945
39952
|
}, [i]), /* @__PURE__ */ W("section", {
|
|
39946
|
-
css:
|
|
39953
|
+
css: NU,
|
|
39947
39954
|
style: { height: s },
|
|
39948
39955
|
"aria-label": `Details for ${e.name}`,
|
|
39949
39956
|
children: [
|
|
@@ -39969,13 +39976,13 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
39969
39976
|
className: "tabs",
|
|
39970
39977
|
role: "group",
|
|
39971
39978
|
"aria-label": "Torrent details",
|
|
39972
|
-
children:
|
|
39979
|
+
children: fU.map((t) => /* @__PURE__ */ W("button", {
|
|
39973
39980
|
type: "button",
|
|
39974
39981
|
"data-on": a === t || void 0,
|
|
39975
39982
|
"aria-pressed": a === t,
|
|
39976
39983
|
onClick: () => o(t),
|
|
39977
39984
|
children: [
|
|
39978
|
-
|
|
39985
|
+
pU[t],
|
|
39979
39986
|
t === "peers" && u.peers.length > 0 && /* @__PURE__ */ U("span", {
|
|
39980
39987
|
className: "count",
|
|
39981
39988
|
children: u.peers.length
|
|
@@ -39990,17 +39997,17 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
39990
39997
|
/* @__PURE__ */ W("div", {
|
|
39991
39998
|
className: "pane",
|
|
39992
39999
|
children: [
|
|
39993
|
-
a === "general" && /* @__PURE__ */ U(
|
|
39994
|
-
a === "files" && /* @__PURE__ */ U(
|
|
40000
|
+
a === "general" && /* @__PURE__ */ U(EU, { t: e }),
|
|
40001
|
+
a === "files" && /* @__PURE__ */ U(DU, {
|
|
39995
40002
|
files: BI(e.files),
|
|
39996
40003
|
saving: n,
|
|
39997
40004
|
onSave: t == null ? null : r
|
|
39998
40005
|
}),
|
|
39999
|
-
a === "peers" && /* @__PURE__ */ U(
|
|
40006
|
+
a === "peers" && /* @__PURE__ */ U(kU, {
|
|
40000
40007
|
peers: u.peers,
|
|
40001
40008
|
loaded: u.loaded
|
|
40002
40009
|
}),
|
|
40003
|
-
a === "trackers" && /* @__PURE__ */ U(
|
|
40010
|
+
a === "trackers" && /* @__PURE__ */ U(jU, {
|
|
40004
40011
|
trackers: u.trackers,
|
|
40005
40012
|
loaded: u.loaded
|
|
40006
40013
|
})
|
|
@@ -40008,7 +40015,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
40008
40015
|
})
|
|
40009
40016
|
]
|
|
40010
40017
|
});
|
|
40011
|
-
},
|
|
40018
|
+
}, FU = ({ className: e, style: t } = {}) => (0, _.createElement)("iframe", {
|
|
40012
40019
|
src: yN(),
|
|
40013
40020
|
title: "Connect your FKN account",
|
|
40014
40021
|
className: e,
|
|
@@ -40020,23 +40027,23 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
40020
40027
|
colorScheme: "normal",
|
|
40021
40028
|
...t
|
|
40022
40029
|
}
|
|
40023
|
-
}),
|
|
40030
|
+
}), IU = 8, LU = 6, RU = (e, t) => {
|
|
40024
40031
|
let n = window.innerWidth, r = window.innerHeight;
|
|
40025
40032
|
if (e.kind === "pointer") {
|
|
40026
40033
|
let { at: i } = e;
|
|
40027
40034
|
return {
|
|
40028
|
-
x: i.x + t.width +
|
|
40029
|
-
y: i.y + t.height +
|
|
40035
|
+
x: i.x + t.width + IU > n ? Math.max(IU, i.x - t.width) : i.x,
|
|
40036
|
+
y: i.y + t.height + IU > r ? Math.max(IU, i.y - t.height) : i.y
|
|
40030
40037
|
};
|
|
40031
40038
|
}
|
|
40032
40039
|
let i = e.of.current?.getBoundingClientRect();
|
|
40033
40040
|
if (!i) return null;
|
|
40034
|
-
let a = Math.min(Math.max(
|
|
40041
|
+
let a = Math.min(Math.max(IU, i.right - t.width), Math.max(IU, n - t.width - IU)), o = i.bottom + LU, s = i.top - LU - t.height;
|
|
40035
40042
|
return {
|
|
40036
40043
|
x: a,
|
|
40037
|
-
y: o + t.height +
|
|
40044
|
+
y: o + t.height + IU > r && s >= IU ? s : o
|
|
40038
40045
|
};
|
|
40039
|
-
},
|
|
40046
|
+
}, zU = St`
|
|
40040
40047
|
position: fixed;
|
|
40041
40048
|
z-index: 2000;
|
|
40042
40049
|
min-width: 240px;
|
|
@@ -40144,11 +40151,11 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
40144
40151
|
min-width: 0;
|
|
40145
40152
|
}
|
|
40146
40153
|
}
|
|
40147
|
-
`,
|
|
40154
|
+
`, BU = ({ on: e, radio: t }) => /* @__PURE__ */ U("span", {
|
|
40148
40155
|
className: "tick",
|
|
40149
40156
|
"aria-hidden": "true",
|
|
40150
40157
|
children: e ? t ? "●" : "✓" : ""
|
|
40151
|
-
}),
|
|
40158
|
+
}), VU = (e) => e.disabled ? `${e.label}. ${e.disabled}` : e.hint, HU = ({ groups: e, onChose: t }) => /* @__PURE__ */ U(co, { children: e.map((e) => /* @__PURE__ */ W("div", {
|
|
40152
40159
|
className: "group",
|
|
40153
40160
|
role: "group",
|
|
40154
40161
|
"aria-label": e.label,
|
|
@@ -40156,7 +40163,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
40156
40163
|
let n = {
|
|
40157
40164
|
type: "button",
|
|
40158
40165
|
disabled: !!e.disabled,
|
|
40159
|
-
title:
|
|
40166
|
+
title: VU(e),
|
|
40160
40167
|
tabIndex: -1
|
|
40161
40168
|
};
|
|
40162
40169
|
return e.kind === "toggle" ? /* @__PURE__ */ W("button", {
|
|
@@ -40166,7 +40173,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
40166
40173
|
onClick: () => {
|
|
40167
40174
|
e.apply(!e.checked), t();
|
|
40168
40175
|
},
|
|
40169
|
-
children: [/* @__PURE__ */ U(
|
|
40176
|
+
children: [/* @__PURE__ */ U(BU, { on: e.checked }), /* @__PURE__ */ U("span", {
|
|
40170
40177
|
className: "text",
|
|
40171
40178
|
children: e.label
|
|
40172
40179
|
})]
|
|
@@ -40177,7 +40184,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
40177
40184
|
onClick: () => {
|
|
40178
40185
|
e.apply(), t();
|
|
40179
40186
|
},
|
|
40180
|
-
children: [/* @__PURE__ */ U(
|
|
40187
|
+
children: [/* @__PURE__ */ U(BU, {
|
|
40181
40188
|
on: e.selected,
|
|
40182
40189
|
radio: !0
|
|
40183
40190
|
}), /* @__PURE__ */ U("span", {
|
|
@@ -40191,13 +40198,13 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
40191
40198
|
onClick: () => {
|
|
40192
40199
|
e.run(), t();
|
|
40193
40200
|
},
|
|
40194
|
-
children: [/* @__PURE__ */ U(
|
|
40201
|
+
children: [/* @__PURE__ */ U(BU, { on: !1 }), /* @__PURE__ */ U("span", {
|
|
40195
40202
|
className: "text",
|
|
40196
40203
|
children: e.label
|
|
40197
40204
|
})]
|
|
40198
40205
|
}, e.id);
|
|
40199
40206
|
})]
|
|
40200
|
-
}, e.id)) }),
|
|
40207
|
+
}, e.id)) }), UU = ({ placement: e, label: t, onClose: n, children: r }) => {
|
|
40201
40208
|
let i = (0, _.useRef)(null), [a, o] = (0, _.useState)(e.kind === "pointer" ? e.at : {
|
|
40202
40209
|
x: -9999,
|
|
40203
40210
|
y: -9999
|
|
@@ -40206,7 +40213,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
40206
40213
|
let c = (0, _.useRef)(e.kind === "pointer").current, l = (0, _.useCallback)(() => {
|
|
40207
40214
|
let e = i.current;
|
|
40208
40215
|
if (!e) return;
|
|
40209
|
-
let t =
|
|
40216
|
+
let t = RU(s.current, e.getBoundingClientRect());
|
|
40210
40217
|
t && o(t);
|
|
40211
40218
|
}, []);
|
|
40212
40219
|
(0, _.useLayoutEffect)(l, [
|
|
@@ -40274,7 +40281,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
40274
40281
|
document.removeEventListener("keydown", r), document.removeEventListener("pointerdown", a, !0), window.removeEventListener("scroll", o, !0), window.removeEventListener("resize", o);
|
|
40275
40282
|
};
|
|
40276
40283
|
}, [c]), /* @__PURE__ */ U("div", {
|
|
40277
|
-
css:
|
|
40284
|
+
css: zU,
|
|
40278
40285
|
ref: i,
|
|
40279
40286
|
role: "menu",
|
|
40280
40287
|
"aria-label": t,
|
|
@@ -40286,22 +40293,22 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
40286
40293
|
onContextMenu: c ? (e) => e.preventDefault() : void 0,
|
|
40287
40294
|
children: r
|
|
40288
40295
|
});
|
|
40289
|
-
},
|
|
40296
|
+
}, WU = ({ groups: e, at: t, label: n, onClose: r }) => /* @__PURE__ */ W(UU, {
|
|
40290
40297
|
placement: {
|
|
40291
40298
|
kind: "pointer",
|
|
40292
40299
|
at: t
|
|
40293
40300
|
},
|
|
40294
40301
|
label: n,
|
|
40295
40302
|
onClose: r,
|
|
40296
|
-
children: [/* @__PURE__ */ U(
|
|
40303
|
+
children: [/* @__PURE__ */ U(HU, {
|
|
40297
40304
|
groups: e,
|
|
40298
40305
|
onChose: r
|
|
40299
40306
|
}), /* @__PURE__ */ U("p", {
|
|
40300
40307
|
className: "passthrough",
|
|
40301
40308
|
children: "Shift or Ctrl + right-click for the browser menu"
|
|
40302
40309
|
})]
|
|
40303
|
-
}),
|
|
40304
|
-
let [e, t] = (0, _.useState)(null), [n, r] = (0, _.useState)(!1), i = (0, _.useCallback)(() =>
|
|
40310
|
+
}), GU = () => Promise.race([lN.info(), new Promise((e) => setTimeout(() => e(null), 4e3))]), KU = () => {
|
|
40311
|
+
let [e, t] = (0, _.useState)(null), [n, r] = (0, _.useState)(!1), i = (0, _.useCallback)(() => GU().then((e) => {
|
|
40305
40312
|
t(e), r(!0);
|
|
40306
40313
|
}).catch(() => r(!0)), []);
|
|
40307
40314
|
return (0, _.useEffect)(() => {
|
|
@@ -40322,7 +40329,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
40322
40329
|
await lN.logout().catch(() => {}), await i();
|
|
40323
40330
|
}, [i])
|
|
40324
40331
|
};
|
|
40325
|
-
},
|
|
40332
|
+
}, qU = "https://fkn.app/account", JU = 8e3, YU = St`
|
|
40326
40333
|
flex: none;
|
|
40327
40334
|
display: inline-flex;
|
|
40328
40335
|
align-items: center;
|
|
@@ -40394,7 +40401,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
40394
40401
|
outline: none;
|
|
40395
40402
|
box-shadow: 0 0 0 2px ${XC};
|
|
40396
40403
|
}
|
|
40397
|
-
`,
|
|
40404
|
+
`, XU = St`
|
|
40398
40405
|
display: flex;
|
|
40399
40406
|
align-items: center;
|
|
40400
40407
|
gap: 8px;
|
|
@@ -40432,21 +40439,21 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
40432
40439
|
height: 15px;
|
|
40433
40440
|
color: ${Q};
|
|
40434
40441
|
}
|
|
40435
|
-
`,
|
|
40436
|
-
let { info: t, ready: n, logout: r } =
|
|
40442
|
+
`, ZU = ({ onToast: e }) => {
|
|
40443
|
+
let { info: t, ready: n, logout: r } = KU(), i = (0, _.useRef)(null), [a, o] = (0, _.useState)(!1), [s, c] = (0, _.useState)(!1), l = (0, _.useRef)(0), u = (0, _.useCallback)(() => o(!1), []);
|
|
40437
40444
|
(0, _.useEffect)(() => {
|
|
40438
40445
|
t || (o(!1), c(!1), l.current && Date.now() - l.current <= 8e3 && (l.current = 0, e("Disconnected")));
|
|
40439
40446
|
}, [t, e]);
|
|
40440
40447
|
let d = async () => {
|
|
40441
40448
|
l.current = Date.now(), c(!0);
|
|
40442
40449
|
try {
|
|
40443
|
-
await Promise.race([r(), new Promise((e) => setTimeout(e,
|
|
40450
|
+
await Promise.race([r(), new Promise((e) => setTimeout(e, JU))]);
|
|
40444
40451
|
} finally {
|
|
40445
40452
|
c(!1), o(!1);
|
|
40446
40453
|
}
|
|
40447
40454
|
};
|
|
40448
40455
|
if (!n) return null;
|
|
40449
|
-
if (!t) return /* @__PURE__ */ U(
|
|
40456
|
+
if (!t) return /* @__PURE__ */ U(FU, { style: {
|
|
40450
40457
|
flex: "none",
|
|
40451
40458
|
width: 140,
|
|
40452
40459
|
height: 38
|
|
@@ -40454,7 +40461,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
40454
40461
|
let f = t.name || "Account", p = t.premium ? "Premium" : "Free";
|
|
40455
40462
|
return /* @__PURE__ */ W(co, { children: [/* @__PURE__ */ W("button", {
|
|
40456
40463
|
className: "account-tag",
|
|
40457
|
-
css:
|
|
40464
|
+
css: YU,
|
|
40458
40465
|
type: "button",
|
|
40459
40466
|
ref: i,
|
|
40460
40467
|
"aria-haspopup": "menu",
|
|
@@ -40474,7 +40481,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
40474
40481
|
className: "chevron",
|
|
40475
40482
|
"aria-hidden": "true"
|
|
40476
40483
|
})]
|
|
40477
|
-
}), a && (0,
|
|
40484
|
+
}), a && (0, LV.createPortal)(/* @__PURE__ */ W(UU, {
|
|
40478
40485
|
placement: {
|
|
40479
40486
|
kind: "under",
|
|
40480
40487
|
of: i
|
|
@@ -40482,10 +40489,10 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
40482
40489
|
label: `Account: ${f}`,
|
|
40483
40490
|
onClose: u,
|
|
40484
40491
|
children: [/* @__PURE__ */ W("a", {
|
|
40485
|
-
css:
|
|
40492
|
+
css: XU,
|
|
40486
40493
|
role: "menuitem",
|
|
40487
40494
|
tabIndex: -1,
|
|
40488
|
-
href:
|
|
40495
|
+
href: qU,
|
|
40489
40496
|
target: "_blank",
|
|
40490
40497
|
rel: "noreferrer",
|
|
40491
40498
|
onClick: u,
|
|
@@ -40494,7 +40501,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
40494
40501
|
children: "Manage account"
|
|
40495
40502
|
})]
|
|
40496
40503
|
}), /* @__PURE__ */ W("button", {
|
|
40497
|
-
css:
|
|
40504
|
+
css: XU,
|
|
40498
40505
|
type: "button",
|
|
40499
40506
|
role: "menuitem",
|
|
40500
40507
|
tabIndex: -1,
|
|
@@ -40508,7 +40515,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
40508
40515
|
})]
|
|
40509
40516
|
})]
|
|
40510
40517
|
}), document.body)] });
|
|
40511
|
-
},
|
|
40518
|
+
}, QU = St`
|
|
40512
40519
|
color: ${Z};
|
|
40513
40520
|
width: 100%;
|
|
40514
40521
|
max-width: min(560px, calc(100vw - 32px));
|
|
@@ -40730,14 +40737,14 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
40730
40737
|
}
|
|
40731
40738
|
}
|
|
40732
40739
|
}
|
|
40733
|
-
`,
|
|
40740
|
+
`, $U = ({ title: e, groups: t, onClose: n }) => {
|
|
40734
40741
|
let r = (0, _.useRef)(null);
|
|
40735
|
-
return /* @__PURE__ */ U(
|
|
40742
|
+
return /* @__PURE__ */ U(HV, {
|
|
40736
40743
|
labelledBy: "torrent-options-title",
|
|
40737
40744
|
onClose: n,
|
|
40738
40745
|
initialFocus: r,
|
|
40739
40746
|
children: /* @__PURE__ */ U("div", {
|
|
40740
|
-
css:
|
|
40747
|
+
css: QU,
|
|
40741
40748
|
children: /* @__PURE__ */ W("div", {
|
|
40742
40749
|
className: "card",
|
|
40743
40750
|
children: [
|
|
@@ -40827,10 +40834,10 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
40827
40834
|
})
|
|
40828
40835
|
})
|
|
40829
40836
|
});
|
|
40830
|
-
},
|
|
40837
|
+
}, eW = ({ dragging: e, overField: t, shareOpen: n }) => e ? n ? "share" : t ? "field" : "page" : null, tW = Ct`
|
|
40831
40838
|
0%, 100% { opacity: 0.7; }
|
|
40832
40839
|
50% { opacity: 0.25; }
|
|
40833
|
-
`,
|
|
40840
|
+
`, nW = St`
|
|
40834
40841
|
.badge {
|
|
40835
40842
|
flex: none;
|
|
40836
40843
|
display: inline-flex;
|
|
@@ -40869,7 +40876,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
40869
40876
|
color: ${Z};
|
|
40870
40877
|
|
|
40871
40878
|
&::before {
|
|
40872
|
-
animation: ${
|
|
40879
|
+
animation: ${tW} 1.6s ease-in-out infinite;
|
|
40873
40880
|
}
|
|
40874
40881
|
}
|
|
40875
40882
|
&.seeding { color: ${Z}; }
|
|
@@ -40879,7 +40886,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
40879
40886
|
color: ${Z};
|
|
40880
40887
|
|
|
40881
40888
|
&::before {
|
|
40882
|
-
animation: ${
|
|
40889
|
+
animation: ${tW} 1.6s ease-in-out infinite;
|
|
40883
40890
|
}
|
|
40884
40891
|
}
|
|
40885
40892
|
|
|
@@ -40889,7 +40896,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
40889
40896
|
color: ${Q};
|
|
40890
40897
|
|
|
40891
40898
|
&::before {
|
|
40892
|
-
animation: ${
|
|
40899
|
+
animation: ${tW} 1.6s ease-in-out infinite;
|
|
40893
40900
|
}
|
|
40894
40901
|
}
|
|
40895
40902
|
|
|
@@ -40904,11 +40911,11 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
40904
40911
|
color: ${Z};
|
|
40905
40912
|
|
|
40906
40913
|
&::before {
|
|
40907
|
-
animation: ${
|
|
40914
|
+
animation: ${tW} 1.6s ease-in-out infinite;
|
|
40908
40915
|
}
|
|
40909
40916
|
}
|
|
40910
40917
|
}
|
|
40911
|
-
`,
|
|
40918
|
+
`, rW = (e) => e.ephemeral === !0, iW = (e, t) => t === "all" ? [...e] : t === "temporary" ? e.filter(rW) : e.filter((e) => !rW(e)), aW = {
|
|
40912
40919
|
added: "Date added",
|
|
40913
40920
|
name: "Name",
|
|
40914
40921
|
size: "Size",
|
|
@@ -40917,7 +40924,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
40917
40924
|
up: "Upload speed",
|
|
40918
40925
|
peers: "Peers",
|
|
40919
40926
|
eta: "Time left"
|
|
40920
|
-
},
|
|
40927
|
+
}, oW = {
|
|
40921
40928
|
added: "desc",
|
|
40922
40929
|
name: "asc",
|
|
40923
40930
|
size: "desc",
|
|
@@ -40926,7 +40933,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
40926
40933
|
up: "desc",
|
|
40927
40934
|
peers: "desc",
|
|
40928
40935
|
eta: "asc"
|
|
40929
|
-
},
|
|
40936
|
+
}, sW = (e) => e.state === "missing" ? 2 : +(e.state === "starting"), cW = (e, t) => {
|
|
40930
40937
|
let n = e.state === "starting" || e.state === "missing";
|
|
40931
40938
|
switch (t) {
|
|
40932
40939
|
case "name": return e.name;
|
|
@@ -40938,56 +40945,56 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
40938
40945
|
case "up": return n ? null : e.up;
|
|
40939
40946
|
case "peers": return n ? null : e.peers;
|
|
40940
40947
|
}
|
|
40941
|
-
},
|
|
40942
|
-
if (
|
|
40943
|
-
let i =
|
|
40944
|
-
if (i === null && a === null) return
|
|
40948
|
+
}, lW = (e, t) => (t.addedAt ?? 0) - (e.addedAt ?? 0) || e.id.localeCompare(t.id), uW = (e, t) => (n, r) => {
|
|
40949
|
+
if (sW(n) !== sW(r)) return sW(n) - sW(r);
|
|
40950
|
+
let i = cW(n, e), a = cW(r, e);
|
|
40951
|
+
if (i === null && a === null) return lW(n, r);
|
|
40945
40952
|
if (i === null) return 1;
|
|
40946
40953
|
if (a === null) return -1;
|
|
40947
40954
|
let o = typeof i == "string" ? i.localeCompare(a, void 0, {
|
|
40948
40955
|
numeric: !0,
|
|
40949
40956
|
sensitivity: "base"
|
|
40950
40957
|
}) : i - a;
|
|
40951
|
-
return o === 0 ?
|
|
40952
|
-
},
|
|
40958
|
+
return o === 0 ? lW(n, r) : t === "asc" ? o : -o;
|
|
40959
|
+
}, dW = (e, t, n) => [...e].sort(uW(t, n)), fW = [
|
|
40953
40960
|
"down",
|
|
40954
40961
|
"up",
|
|
40955
40962
|
"peers",
|
|
40956
40963
|
"progress",
|
|
40957
40964
|
"eta"
|
|
40958
|
-
],
|
|
40965
|
+
], pW = (e) => fW.includes(e), mW = ({ viewChanged: e, idsChanged: t, volatile: n, interacting: r, sinceMs: i }) => e || t || !n || i > 1e4 || i > 2e3 && !r, hW = "ripple:list-filter", gW = "ripple:list-sort", _W = "ripple:list-view", vW = (e) => e === "all" || e === "library" || e === "temporary", yW = (e) => e === "cards" || e === "table", bW = (e) => typeof e == "string" && e in aW, xW = (e) => e === "asc" || e === "desc", SW = (e) => {
|
|
40959
40966
|
try {
|
|
40960
|
-
let t = e(
|
|
40961
|
-
return
|
|
40967
|
+
let t = e(hW);
|
|
40968
|
+
return vW(t) ? t : "all";
|
|
40962
40969
|
} catch {
|
|
40963
40970
|
return "all";
|
|
40964
40971
|
}
|
|
40965
|
-
},
|
|
40972
|
+
}, CW = (e) => {
|
|
40966
40973
|
try {
|
|
40967
|
-
let t = e(
|
|
40968
|
-
return
|
|
40974
|
+
let t = e(_W);
|
|
40975
|
+
return yW(t) ? t : "cards";
|
|
40969
40976
|
} catch {
|
|
40970
40977
|
return "cards";
|
|
40971
40978
|
}
|
|
40972
|
-
},
|
|
40979
|
+
}, wW = {
|
|
40973
40980
|
key: "added",
|
|
40974
40981
|
dir: "desc"
|
|
40975
|
-
},
|
|
40982
|
+
}, TW = (e) => {
|
|
40976
40983
|
try {
|
|
40977
40984
|
let [t, n] = (e("ripple:list-sort") ?? "").split(":");
|
|
40978
|
-
return
|
|
40985
|
+
return bW(t) && xW(n) ? {
|
|
40979
40986
|
key: t,
|
|
40980
40987
|
dir: n
|
|
40981
|
-
} :
|
|
40988
|
+
} : wW;
|
|
40982
40989
|
} catch {
|
|
40983
|
-
return
|
|
40990
|
+
return wW;
|
|
40984
40991
|
}
|
|
40985
|
-
},
|
|
40992
|
+
}, EW = (e, t) => `${e}:${t}`, DW = St`
|
|
40986
40993
|
width: 100%;
|
|
40987
40994
|
border-collapse: collapse;
|
|
40988
40995
|
font-size: 0.82rem;
|
|
40989
40996
|
|
|
40990
|
-
${
|
|
40997
|
+
${nW}
|
|
40991
40998
|
|
|
40992
40999
|
th, td {
|
|
40993
41000
|
text-align: left;
|
|
@@ -41098,7 +41105,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
41098
41105
|
@media (max-width: 940px) { .c-up { display: none; } }
|
|
41099
41106
|
@media (max-width: 820px) { .c-peers { display: none; } }
|
|
41100
41107
|
@media (max-width: 700px) { .c-size { display: none; } }
|
|
41101
|
-
`,
|
|
41108
|
+
`, OW = [
|
|
41102
41109
|
{
|
|
41103
41110
|
key: "name",
|
|
41104
41111
|
label: "Name"
|
|
@@ -41143,10 +41150,10 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
41143
41150
|
cls: "c-added",
|
|
41144
41151
|
num: !0
|
|
41145
41152
|
}
|
|
41146
|
-
],
|
|
41147
|
-
css:
|
|
41153
|
+
], kW = ({ torrents: e, sortKey: t, sortDir: n, onSort: r, selectedId: i, onSelect: a, onOptions: o }) => /* @__PURE__ */ W("table", {
|
|
41154
|
+
css: DW,
|
|
41148
41155
|
className: "torrent-table",
|
|
41149
|
-
children: [/* @__PURE__ */ U("thead", { children: /* @__PURE__ */ U("tr", { children:
|
|
41156
|
+
children: [/* @__PURE__ */ U("thead", { children: /* @__PURE__ */ U("tr", { children: OW.map((e) => {
|
|
41150
41157
|
let i = e.key !== null && e.key === t;
|
|
41151
41158
|
return /* @__PURE__ */ U("th", {
|
|
41152
41159
|
scope: "col",
|
|
@@ -41159,8 +41166,8 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
41159
41166
|
children: e.label
|
|
41160
41167
|
}) : /* @__PURE__ */ W("button", {
|
|
41161
41168
|
type: "button",
|
|
41162
|
-
onClick: () => r(e.key, i ? n === "asc" ? "desc" : "asc" :
|
|
41163
|
-
...xL(`Sort by ${
|
|
41169
|
+
onClick: () => r(e.key, i ? n === "asc" ? "desc" : "asc" : oW[e.key]),
|
|
41170
|
+
...xL(`Sort by ${aW[e.key]}`),
|
|
41164
41171
|
children: [e.label, i && /* @__PURE__ */ U("span", {
|
|
41165
41172
|
className: "arrow",
|
|
41166
41173
|
"aria-hidden": "true",
|
|
@@ -41247,15 +41254,15 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
41247
41254
|
})
|
|
41248
41255
|
]
|
|
41249
41256
|
}, e.id)) })]
|
|
41250
|
-
}),
|
|
41251
|
-
let a = (0, _.useRef)([]), o = (0, _.useRef)(0), s = (0, _.useRef)(""), c = (0, _.useRef)(!1), l =
|
|
41252
|
-
|
|
41257
|
+
}), AW = (e, t, n, r, i = () => Date.now()) => {
|
|
41258
|
+
let a = (0, _.useRef)([]), o = (0, _.useRef)(0), s = (0, _.useRef)(""), c = (0, _.useRef)(!1), l = iW(e, t), u = new Map(l.map((e) => [e.id, e])), d = `${t}:${n}:${r}`;
|
|
41259
|
+
mW({
|
|
41253
41260
|
viewChanged: s.current !== d,
|
|
41254
41261
|
idsChanged: a.current.length !== l.length || a.current.some((e) => !u.has(e)),
|
|
41255
|
-
volatile:
|
|
41262
|
+
volatile: pW(n),
|
|
41256
41263
|
interacting: c.current,
|
|
41257
41264
|
sinceMs: i() - o.current
|
|
41258
|
-
}) && (a.current =
|
|
41265
|
+
}) && (a.current = dW(l, n, r).map((e) => e.id), o.current = i(), s.current = d);
|
|
41259
41266
|
let f = [], p = /* @__PURE__ */ new Set();
|
|
41260
41267
|
for (let e of a.current) {
|
|
41261
41268
|
let t = u.get(e);
|
|
@@ -41279,7 +41286,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
41279
41286
|
}, [])
|
|
41280
41287
|
}
|
|
41281
41288
|
};
|
|
41282
|
-
},
|
|
41289
|
+
}, jW = St`
|
|
41283
41290
|
flex: none;
|
|
41284
41291
|
display: flex;
|
|
41285
41292
|
align-items: center;
|
|
@@ -41379,8 +41386,8 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
41379
41386
|
|
|
41380
41387
|
/* pushed to the far end: it changes the shape of the page rather than its contents */
|
|
41381
41388
|
.views { margin-left: auto; }
|
|
41382
|
-
`,
|
|
41383
|
-
css:
|
|
41389
|
+
`, MW = ({ filter: e, onFilter: t, sortKey: n, sortDir: r, onSort: i, view: a, onView: o, temporaryCount: s }) => /* @__PURE__ */ W("div", {
|
|
41390
|
+
css: jW,
|
|
41384
41391
|
className: "list-toolbar",
|
|
41385
41392
|
children: [
|
|
41386
41393
|
s > 0 && /* @__PURE__ */ W("div", {
|
|
@@ -41424,11 +41431,11 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
41424
41431
|
value: n,
|
|
41425
41432
|
onChange: (e) => {
|
|
41426
41433
|
let t = e.target.value;
|
|
41427
|
-
i(t,
|
|
41434
|
+
i(t, oW[t]);
|
|
41428
41435
|
},
|
|
41429
|
-
children: Object.keys(
|
|
41436
|
+
children: Object.keys(aW).map((e) => /* @__PURE__ */ U("option", {
|
|
41430
41437
|
value: e,
|
|
41431
|
-
children:
|
|
41438
|
+
children: aW[e]
|
|
41432
41439
|
}, e))
|
|
41433
41440
|
})]
|
|
41434
41441
|
}),
|
|
@@ -41461,24 +41468,24 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
41461
41468
|
})]
|
|
41462
41469
|
})
|
|
41463
41470
|
]
|
|
41464
|
-
}),
|
|
41465
|
-
let r =
|
|
41471
|
+
}), NW = (e, t) => (e.flags & t) !== 0, PW = (e) => e.state === "missing", FW = (e) => PW(e) || e.state === "starting", IW = (e, t, n = { savedToUserStorage: !1 }) => {
|
|
41472
|
+
let r = FW(e) ? PW(e) ? "This torrent is not running on this device." : "This torrent is still starting up." : void 0, i = e.progress >= 1, a = NW(e, mw.sequentialDownload), o = BI(e.files).length > 1, s = n.sessionLimits ?? {
|
|
41466
41473
|
down: 0,
|
|
41467
41474
|
up: 0
|
|
41468
41475
|
}, c = [];
|
|
41469
|
-
YR(e) && !
|
|
41476
|
+
YR(e) && !PW(e) && c.push({
|
|
41470
41477
|
kind: "action",
|
|
41471
41478
|
id: "watch",
|
|
41472
41479
|
label: "Watch",
|
|
41473
41480
|
hint: "Play it here. It streams while the rest arrives, so it does not have to finish first.",
|
|
41474
41481
|
run: t.watch
|
|
41475
|
-
}),
|
|
41482
|
+
}), PW(e) && e.saveTo !== "source" && c.push({
|
|
41476
41483
|
kind: "action",
|
|
41477
41484
|
id: "start",
|
|
41478
41485
|
label: "Download to this device",
|
|
41479
41486
|
hint: "This torrent is in your library but not on this device. This fetches it again.",
|
|
41480
41487
|
run: t.start
|
|
41481
|
-
}), BI(e.files).length && i && !
|
|
41488
|
+
}), BI(e.files).length && i && !PW(e) && c.push({
|
|
41482
41489
|
kind: "action",
|
|
41483
41490
|
id: "save",
|
|
41484
41491
|
label: o ? "Save as a zip" : "Save to disk",
|
|
@@ -41501,7 +41508,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
41501
41508
|
id: "save-torrent-file",
|
|
41502
41509
|
label: "Save .torrent",
|
|
41503
41510
|
hint: "Writes out the .torrent file for this torrent, wherever you choose.",
|
|
41504
|
-
disabled: e.files?.length ? void 0 :
|
|
41511
|
+
disabled: e.files?.length ? void 0 : PW(e) ? "This torrent is not running on this device, so its metadata cannot be read." : "The metadata has not arrived yet.",
|
|
41505
41512
|
run: t.saveTorrentFile
|
|
41506
41513
|
}));
|
|
41507
41514
|
let l = [];
|
|
@@ -41531,7 +41538,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
41531
41538
|
label: "Try again now",
|
|
41532
41539
|
hint: "Stops waiting out the retry timer and reconnects immediately.",
|
|
41533
41540
|
run: t.retryNow
|
|
41534
|
-
}),
|
|
41541
|
+
}), PW(e) ? u.push({
|
|
41535
41542
|
kind: "action",
|
|
41536
41543
|
id: "remove",
|
|
41537
41544
|
label: "Remove from the library",
|
|
@@ -41556,8 +41563,8 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
41556
41563
|
id: "maintenance",
|
|
41557
41564
|
label: "Manage",
|
|
41558
41565
|
items: u
|
|
41559
|
-
}), n.folderReady && !
|
|
41560
|
-
let e = n.intended ?? "browser", r = n.current ?? "browser", a = wV(
|
|
41566
|
+
}), n.folderReady && !FW(e)) {
|
|
41567
|
+
let e = n.intended ?? "browser", r = n.current ?? "browser", a = TV(wV({
|
|
41561
41568
|
current: r,
|
|
41562
41569
|
intended: e,
|
|
41563
41570
|
complete: i,
|
|
@@ -41675,7 +41682,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
41675
41682
|
id: "dht",
|
|
41676
41683
|
label: "Disable DHT for this torrent",
|
|
41677
41684
|
hint: "Stops looking for peers in the global peer directory. Trackers and peer exchange still apply.",
|
|
41678
|
-
checked:
|
|
41685
|
+
checked: NW(e, mw.disableDht),
|
|
41679
41686
|
disabled: r,
|
|
41680
41687
|
apply: (e) => t.setFlags(e ? mw.disableDht : 0, mw.disableDht)
|
|
41681
41688
|
},
|
|
@@ -41684,7 +41691,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
41684
41691
|
id: "pex",
|
|
41685
41692
|
label: "Disable PeX for this torrent",
|
|
41686
41693
|
hint: "Stops connected peers introducing you to the peers they know.",
|
|
41687
|
-
checked:
|
|
41694
|
+
checked: NW(e, mw.disablePex),
|
|
41688
41695
|
disabled: r,
|
|
41689
41696
|
apply: (e) => t.setFlags(e ? mw.disablePex : 0, mw.disablePex)
|
|
41690
41697
|
},
|
|
@@ -41705,7 +41712,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
41705
41712
|
id: "upload-only",
|
|
41706
41713
|
label: "Upload mode",
|
|
41707
41714
|
hint: "Keeps sharing what is already here and stops asking for anything new.",
|
|
41708
|
-
checked:
|
|
41715
|
+
checked: NW(e, mw.uploadMode),
|
|
41709
41716
|
disabled: r,
|
|
41710
41717
|
apply: (e) => t.setFlags(e ? mw.uploadMode : 0, mw.uploadMode)
|
|
41711
41718
|
}, {
|
|
@@ -41713,11 +41720,11 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
41713
41720
|
id: "super-seed",
|
|
41714
41721
|
label: "Super seeding mode",
|
|
41715
41722
|
hint: "Hands each peer a different piece so the swarm gets a full copy sooner. For rare torrents.",
|
|
41716
|
-
checked:
|
|
41723
|
+
checked: NW(e, mw.superSeeding),
|
|
41717
41724
|
disabled: r ?? (i ? void 0 : "Only available once the download has finished."),
|
|
41718
41725
|
apply: (e) => t.setFlags(e ? mw.superSeeding : 0, mw.superSeeding)
|
|
41719
41726
|
}]
|
|
41720
|
-
}), e.queuePosition >= 0 && !
|
|
41727
|
+
}), e.queuePosition >= 0 && !PW(e) && l.push({
|
|
41721
41728
|
id: "queue",
|
|
41722
41729
|
label: `Queue position ${e.queuePosition + 1}`,
|
|
41723
41730
|
items: [
|
|
@@ -41749,13 +41756,13 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
41749
41756
|
run: () => t.moveInQueue(r)
|
|
41750
41757
|
}))
|
|
41751
41758
|
}), l;
|
|
41752
|
-
},
|
|
41759
|
+
}, LW = (e) => /^magnet:\?/i.test(e.trim()), RW = (e) => {
|
|
41753
41760
|
let t = e?.types;
|
|
41754
41761
|
return t ? [...t].some((e) => e === "Files" || e === "text/uri-list") : !1;
|
|
41755
|
-
},
|
|
41762
|
+
}, zW = (e) => {
|
|
41756
41763
|
let t = e / 1e6;
|
|
41757
41764
|
return t >= 1e3 ? `${Math.round(t / 1e3)} GB/s` : t >= 1 ? `${Math.round(t)} MB/s` : `${Math.round(e / 1e3)} KB/s`;
|
|
41758
|
-
},
|
|
41765
|
+
}, BW = ({ quota: e }) => e.premium ? /* @__PURE__ */ W("div", {
|
|
41759
41766
|
className: "stat quota",
|
|
41760
41767
|
children: [/* @__PURE__ */ U("label", { children: "FKN quota" }), /* @__PURE__ */ U("strong", {
|
|
41761
41768
|
className: "ok",
|
|
@@ -41765,7 +41772,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
41765
41772
|
className: "stat quota throttled",
|
|
41766
41773
|
children: [
|
|
41767
41774
|
/* @__PURE__ */ U("label", { children: "FKN quota" }),
|
|
41768
|
-
/* @__PURE__ */ W("strong", { children: ["Throttled · ",
|
|
41775
|
+
/* @__PURE__ */ W("strong", { children: ["Throttled · ", zW(e.bytesPerSecond)] }),
|
|
41769
41776
|
/* @__PURE__ */ U("a", {
|
|
41770
41777
|
href: "https://fkn.app/account",
|
|
41771
41778
|
target: "_blank",
|
|
@@ -41776,14 +41783,14 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
41776
41783
|
}) : /* @__PURE__ */ W("div", {
|
|
41777
41784
|
className: "stat quota",
|
|
41778
41785
|
children: [/* @__PURE__ */ U("label", { children: "FKN quota" }), /* @__PURE__ */ W("strong", { children: [cw(e.remainingBytes, !0), " left"] })]
|
|
41779
|
-
}),
|
|
41786
|
+
}), VW = ({ storage: e, low: t }) => /* @__PURE__ */ W("div", {
|
|
41780
41787
|
className: "stat storage" + (t ? " low" : ""),
|
|
41781
41788
|
children: [/* @__PURE__ */ U("label", { children: "Storage" }), /* @__PURE__ */ W("strong", { children: [
|
|
41782
41789
|
cw(e.usedBytes, !0),
|
|
41783
41790
|
" / ",
|
|
41784
41791
|
cw(e.limitBytes, !0)
|
|
41785
41792
|
] })]
|
|
41786
|
-
}),
|
|
41793
|
+
}), HW = {
|
|
41787
41794
|
"signed-out": "Connect an account to keep your library across devices.",
|
|
41788
41795
|
"no-storage-grant": "Your account is connected but storage did not answer. Retrying.",
|
|
41789
41796
|
"broker-timeout": "FKN did not respond in time. Retrying.",
|
|
@@ -41793,19 +41800,19 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
41793
41800
|
"read-timeout": "FKN did not answer in time, so your saved library was left untouched. Retrying.",
|
|
41794
41801
|
"switch-unverified": "Waiting to read this account's library before replacing the one on this device.",
|
|
41795
41802
|
"write-failed": "This device's library could not be saved. It will retry on the next change."
|
|
41796
|
-
},
|
|
41803
|
+
}, UW = ({ state: e }) => {
|
|
41797
41804
|
let { status: t, reason: n } = e;
|
|
41798
41805
|
if (t === "off") return null;
|
|
41799
41806
|
let r = t === "syncing" ? "Syncing…" : t === "error" ? "Sync failed" : "Synced";
|
|
41800
41807
|
return /* @__PURE__ */ W("div", {
|
|
41801
41808
|
className: "stat sync" + (t === "error" ? " error" : ""),
|
|
41802
|
-
...xL(n ?
|
|
41809
|
+
...xL(n ? HW[n] : void 0),
|
|
41803
41810
|
children: [/* @__PURE__ */ U("label", { children: "Library" }), /* @__PURE__ */ U("strong", {
|
|
41804
41811
|
className: t === "synced" ? "ok" : void 0,
|
|
41805
41812
|
children: r
|
|
41806
41813
|
})]
|
|
41807
41814
|
});
|
|
41808
|
-
},
|
|
41815
|
+
}, WW = ({ reachable: e, inboundNow: t = vw }) => {
|
|
41809
41816
|
if (!e) return null;
|
|
41810
41817
|
let { port: n, inbound: r, listenFailed: i } = e, a = e.listeners ?? [], o = e.portOpen ?? !0, s = i.length > 0, c = yw(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} in total have been accepted on it since this session started, so the port itself works.` : "", f = s ? i.join("\n") : l ? "The connection carrying this port dropped. Reclaiming it." : n && !o ? `Peers were told to dial ${n} and nothing is holding it any more. Reload to take a new one.` : n ? t.total > 0 ? `${t.total} ${t.total === 1 ? "peer is" : "peers are"} connected in on port ${n} right now: ${c}.${d}` : `Nobody is connected in on port ${n} right now.${d || " Peers are told to dial it and none has yet."}` : void 0;
|
|
41811
41818
|
return /* @__PURE__ */ W("div", {
|
|
@@ -41816,10 +41823,10 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
41816
41823
|
children: u
|
|
41817
41824
|
})]
|
|
41818
41825
|
});
|
|
41819
|
-
},
|
|
41826
|
+
}, GW = 120, KW = 60, qW = Infinity, JW = 3e4, YW = (e, t) => {
|
|
41820
41827
|
let n = e.infoHash;
|
|
41821
41828
|
return !navigator.locks || !n ? t() : navigator.locks.request(`ripple:folder-sync:${n}`, { ifAvailable: !0 }, (e) => e ? t() : Promise.resolve(null));
|
|
41822
|
-
},
|
|
41829
|
+
}, XW = St`
|
|
41823
41830
|
/* dvh minus whatever the broker reserved at the top, so docking its header does not push the
|
|
41824
41831
|
footer under the fold. See the root rule in index.tsx for what writes the variable. */
|
|
41825
41832
|
height: calc(100dvh - var(--fkn-inset-top, 0px));
|
|
@@ -42370,7 +42377,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
42370
42377
|
}
|
|
42371
42378
|
|
|
42372
42379
|
/* the state chip, shared with the table view so there is one source for it */
|
|
42373
|
-
${
|
|
42380
|
+
${nW}
|
|
42374
42381
|
|
|
42375
42382
|
/* why a torrent stalled and when it tries again, brighter than the meta numbers it sits among so
|
|
42376
42383
|
it does not read as one more of them */
|
|
@@ -43063,8 +43070,8 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43063
43070
|
min-height: 64px;
|
|
43064
43071
|
}
|
|
43065
43072
|
}
|
|
43066
|
-
`,
|
|
43067
|
-
let t = Math.max(...e, 1), n =
|
|
43073
|
+
`, ZW = ({ history: e }) => {
|
|
43074
|
+
let t = Math.max(...e, 1), n = GW - e.length, r = e.map((e, r) => `${((n + r) / (GW - 1) * 100).toFixed(2)},${(29 - e / t * 26).toFixed(2)}`).join(" ");
|
|
43068
43075
|
return r ? /* @__PURE__ */ W("svg", {
|
|
43069
43076
|
className: "graph",
|
|
43070
43077
|
viewBox: "0 0 100 30",
|
|
@@ -43072,13 +43079,13 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43072
43079
|
"aria-hidden": "true",
|
|
43073
43080
|
children: [/* @__PURE__ */ U("polygon", {
|
|
43074
43081
|
fill: iw,
|
|
43075
|
-
points: `${(n / (
|
|
43082
|
+
points: `${(n / (GW - 1) * 100).toFixed(2)},30 ${r} 100,30`
|
|
43076
43083
|
}), /* @__PURE__ */ U("polyline", { points: r })]
|
|
43077
43084
|
}) : null;
|
|
43078
|
-
},
|
|
43085
|
+
}, QW = ({ down: e, up: t }) => {
|
|
43079
43086
|
let n = Math.max(...e, ...t, 1), r = (e) => {
|
|
43080
|
-
let t =
|
|
43081
|
-
return e.map((e, r) => `${((t + r) / (
|
|
43087
|
+
let t = KW - e.length;
|
|
43088
|
+
return e.map((e, r) => `${((t + r) / (KW - 1) * 100).toFixed(2)},${(25 - e / n * 23).toFixed(2)}`).join(" ");
|
|
43082
43089
|
};
|
|
43083
43090
|
if (!e.length) return null;
|
|
43084
43091
|
let i = r(e);
|
|
@@ -43090,7 +43097,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43090
43097
|
children: [
|
|
43091
43098
|
/* @__PURE__ */ U("polygon", {
|
|
43092
43099
|
className: "down-fill",
|
|
43093
|
-
points: `${((
|
|
43100
|
+
points: `${((KW - e.length) / (KW - 1) * 100).toFixed(2)},26 ${i} 100,26`
|
|
43094
43101
|
}),
|
|
43095
43102
|
/* @__PURE__ */ U("polyline", {
|
|
43096
43103
|
className: "down-line",
|
|
@@ -43102,16 +43109,16 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43102
43109
|
})
|
|
43103
43110
|
]
|
|
43104
43111
|
});
|
|
43105
|
-
},
|
|
43112
|
+
}, $W = (e, t) => `${e}:${t}`, eG = ({ url: e }) => e ? /* @__PURE__ */ U("img", {
|
|
43106
43113
|
className: "poster",
|
|
43107
43114
|
src: e,
|
|
43108
43115
|
alt: ""
|
|
43109
43116
|
}) : /* @__PURE__ */ U("div", {
|
|
43110
43117
|
className: "poster placeholder",
|
|
43111
43118
|
children: /* @__PURE__ */ U(vs, {})
|
|
43112
|
-
}),
|
|
43119
|
+
}), tG = ({ t: e, poster: t }) => /* @__PURE__ */ W("div", {
|
|
43113
43120
|
className: "torrent surface starting",
|
|
43114
|
-
children: [/* @__PURE__ */ U(
|
|
43121
|
+
children: [/* @__PURE__ */ U(eG, { url: t }), /* @__PURE__ */ U("div", {
|
|
43115
43122
|
className: "content",
|
|
43116
43123
|
children: /* @__PURE__ */ W("div", {
|
|
43117
43124
|
className: "main",
|
|
@@ -43133,7 +43140,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43133
43140
|
})]
|
|
43134
43141
|
})
|
|
43135
43142
|
})]
|
|
43136
|
-
}),
|
|
43143
|
+
}), nG = ({ t: e, poster: t, onStart: n, onOptions: r, selected: i, onSelect: a }) => /* @__PURE__ */ W("div", {
|
|
43137
43144
|
className: "torrent surface missing" + (i ? " selected" : ""),
|
|
43138
43145
|
"aria-current": i || void 0,
|
|
43139
43146
|
onClick: (t) => {
|
|
@@ -43145,7 +43152,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43145
43152
|
y: t.clientY
|
|
43146
43153
|
}));
|
|
43147
43154
|
},
|
|
43148
|
-
children: [/* @__PURE__ */ U(
|
|
43155
|
+
children: [/* @__PURE__ */ U(eG, { url: t }), /* @__PURE__ */ U("div", {
|
|
43149
43156
|
className: "content",
|
|
43150
43157
|
children: /* @__PURE__ */ W("div", {
|
|
43151
43158
|
className: "main",
|
|
@@ -43196,13 +43203,13 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43196
43203
|
})]
|
|
43197
43204
|
})
|
|
43198
43205
|
})]
|
|
43199
|
-
}),
|
|
43206
|
+
}), rG = ({ t: e, saving: t, onToggle: n, onSave: r, onSaveZip: i, onStart: a, onOptions: o, selected: s, onSelect: c, savedToUserStorage: l, rates: u }) => {
|
|
43200
43207
|
let d = cB(e.infoHash);
|
|
43201
|
-
if (e.state === "starting") return /* @__PURE__ */ U(
|
|
43208
|
+
if (e.state === "starting") return /* @__PURE__ */ U(tG, {
|
|
43202
43209
|
t: e,
|
|
43203
43210
|
poster: d
|
|
43204
43211
|
});
|
|
43205
|
-
if (e.state === "missing") return /* @__PURE__ */ U(
|
|
43212
|
+
if (e.state === "missing") return /* @__PURE__ */ U(nG, {
|
|
43206
43213
|
t: e,
|
|
43207
43214
|
poster: d,
|
|
43208
43215
|
onStart: a,
|
|
@@ -43210,9 +43217,9 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43210
43217
|
selected: s,
|
|
43211
43218
|
onSelect: c
|
|
43212
43219
|
});
|
|
43213
|
-
let f = XR(e), p = JR(e.files), m = BI(e.files).length > 1, h = t[
|
|
43220
|
+
let f = XR(e), p = JR(e.files), m = BI(e.files).length > 1, h = t[$W(e.id, m ? -1 : p)], g = e.progress >= 1, _ = e.state !== "paused" && e.state !== "queued", v = {};
|
|
43214
43221
|
return e.files?.forEach((n, r) => {
|
|
43215
|
-
let i = t[
|
|
43222
|
+
let i = t[$W(e.id, r)];
|
|
43216
43223
|
i != null && (v[r] = i);
|
|
43217
43224
|
}), /* @__PURE__ */ W("div", {
|
|
43218
43225
|
className: "torrent surface" + (s ? " selected" : ""),
|
|
@@ -43226,7 +43233,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43226
43233
|
y: t.clientY
|
|
43227
43234
|
}));
|
|
43228
43235
|
},
|
|
43229
|
-
children: [/* @__PURE__ */ U(
|
|
43236
|
+
children: [/* @__PURE__ */ U(eG, { url: d }), /* @__PURE__ */ U("div", {
|
|
43230
43237
|
className: "content",
|
|
43231
43238
|
children: /* @__PURE__ */ W("div", {
|
|
43232
43239
|
className: "main",
|
|
@@ -43300,7 +43307,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43300
43307
|
})
|
|
43301
43308
|
]
|
|
43302
43309
|
}),
|
|
43303
|
-
u && /* @__PURE__ */ U(
|
|
43310
|
+
u && /* @__PURE__ */ U(QW, {
|
|
43304
43311
|
down: u.down,
|
|
43305
43312
|
up: u.up
|
|
43306
43313
|
}),
|
|
@@ -43369,8 +43376,8 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43369
43376
|
})
|
|
43370
43377
|
})]
|
|
43371
43378
|
});
|
|
43372
|
-
},
|
|
43373
|
-
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 } = $F(), [g, v] = (0, _.useState)(""), [y, b] = (0, _.useState)(null), [x, S] = (0, _.useState)({}), [C, w] = (0, _.useState)(() => navigator.onLine === !1), T = (0, _.useRef)(void 0), { confirm: E, confirmElement: D, confirmOpen: O } =
|
|
43379
|
+
}, iG = () => {
|
|
43380
|
+
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 } = $F(), [g, v] = (0, _.useState)(""), [y, b] = (0, _.useState)(null), [x, S] = (0, _.useState)({}), [C, w] = (0, _.useState)(() => navigator.onLine === !1), T = (0, _.useRef)(void 0), { confirm: E, confirmElement: D, confirmOpen: O } = _H(), ee = pH(), k = async () => {
|
|
43374
43381
|
Object.keys(x).length > 0 && !await E({
|
|
43375
43382
|
title: "Update now?",
|
|
43376
43383
|
body: "A file is being saved to your disk right now. Updating reloads every Ripple page, and that save will stop part way with nothing to resume from. Downloads themselves are safe and pick up where they left off.",
|
|
@@ -43389,16 +43396,16 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43389
43396
|
window.removeEventListener("online", e), window.removeEventListener("offline", e);
|
|
43390
43397
|
};
|
|
43391
43398
|
}, []), (0, _.useEffect)(() => h.onAddFailed(V), [h, V]), sB(h);
|
|
43392
|
-
let [te] = (0, _.useState)(() => !
|
|
43393
|
-
let e = await
|
|
43399
|
+
let [te] = (0, _.useState)(() => !oH()), ne = (0, _.useCallback)(async () => {
|
|
43400
|
+
let e = await lH();
|
|
43394
43401
|
V(e === "installed" ? "Ripple installed. Torrent files and magnet links open here now." : e === "magnet-registered" ? "Confirm the prompt to route magnet links to Ripple." : e === "already-installed" ? "Ripple is already set up on this device." : "Use your browser menu to install Ripple as an app.");
|
|
43395
|
-
}, [V]), [re, ie] = (0, _.useState)(() =>
|
|
43402
|
+
}, [V]), [re, ie] = (0, _.useState)(() => GV((e) => localStorage.getItem(e))), ae = (e) => {
|
|
43396
43403
|
ie(e);
|
|
43397
43404
|
try {
|
|
43398
|
-
localStorage.setItem(
|
|
43405
|
+
localStorage.setItem(UV, e ? "1" : "0");
|
|
43399
43406
|
} catch {}
|
|
43400
43407
|
}, [H, oe] = (0, _.useState)(null), [se, ce] = (0, _.useState)(null), le = (0, _.useRef)(null), ue = (0, _.useCallback)((e, t, n = null) => {
|
|
43401
|
-
let r =
|
|
43408
|
+
let r = IV({ magnet: e });
|
|
43402
43409
|
if (!r.ok) {
|
|
43403
43410
|
V(r.problem);
|
|
43404
43411
|
return;
|
|
@@ -43416,7 +43423,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43416
43423
|
}), ce(null);
|
|
43417
43424
|
}, [h, V]), de = (0, _.useCallback)((e) => {
|
|
43418
43425
|
let t = e.trim();
|
|
43419
|
-
if (!
|
|
43426
|
+
if (!LW(t)) return !1;
|
|
43420
43427
|
let n = uw(t);
|
|
43421
43428
|
return n && B.current.some((e) => e.magnet && uw(e.magnet) === n) ? (V("Already in your list"), !0) : re ? (ue(t, !1), !0) : (r(t), V("Magnet added"), !0);
|
|
43422
43429
|
}, [
|
|
@@ -43495,7 +43502,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43495
43502
|
let t = e.target;
|
|
43496
43503
|
if (t && (t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.isContentEditable)) return;
|
|
43497
43504
|
let n = e.clipboardData?.getData("text") ?? "";
|
|
43498
|
-
|
|
43505
|
+
LW(n) && (e.preventDefault(), de(n));
|
|
43499
43506
|
};
|
|
43500
43507
|
return window.addEventListener("paste", e), () => window.removeEventListener("paste", e);
|
|
43501
43508
|
}, [
|
|
@@ -43508,9 +43515,9 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43508
43515
|
}, []);
|
|
43509
43516
|
(0, _.useEffect)(() => {
|
|
43510
43517
|
let e = (e) => {
|
|
43511
|
-
|
|
43518
|
+
RW(e.dataTransfer) && ++xe.current === 1 && be(!0);
|
|
43512
43519
|
}, t = (e) => {
|
|
43513
|
-
|
|
43520
|
+
RW(e.dataTransfer) && --xe.current <= 0 && we();
|
|
43514
43521
|
}, n = (e) => e.preventDefault(), r = (e) => {
|
|
43515
43522
|
e.preventDefault(), we(), he(e.dataTransfer);
|
|
43516
43523
|
};
|
|
@@ -43558,7 +43565,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43558
43565
|
body: "The downloaded files stay where they are. Ripple stops sharing it and forgets its progress.",
|
|
43559
43566
|
confirmLabel: "Remove"
|
|
43560
43567
|
}) || (e.infoHash && GP(e.infoHash), e.state === "missing" ? e.infoHash && d(e.infoHash) : l(Number(e.id), !1));
|
|
43561
|
-
}, [je, Me] = (0, _.useState)(null), [Ne, Pe] = (0, _.useState)(null), Fe =
|
|
43568
|
+
}, [je, Me] = (0, _.useState)(null), [Ne, Pe] = (0, _.useState)(null), Fe = sU(h), [Ie, Le] = (0, _.useState)(!1), Re = (0, _.useCallback)(() => Le(!1), []), { waiting: ze, allow: Be } = cU(h, t, h.owns()), [Ve, He] = (0, _.useState)(null), Ue = (0, _.useCallback)((e) => He(e.id), []), We = (0, _.useCallback)((e, t) => {
|
|
43562
43569
|
t ? (Pe(null), Me({
|
|
43563
43570
|
id: e.id,
|
|
43564
43571
|
at: t
|
|
@@ -43616,13 +43623,13 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43616
43623
|
}
|
|
43617
43624
|
}), Ke = Ve ? e.find((e) => e.id === Ve) : void 0, qe = {};
|
|
43618
43625
|
Ke?.files?.forEach((e, t) => {
|
|
43619
|
-
let n = x[
|
|
43626
|
+
let n = x[$W(Ke.id, t)];
|
|
43620
43627
|
n != null && (qe[t] = n);
|
|
43621
43628
|
});
|
|
43622
43629
|
let Je = je ? e.find((e) => e.id === je.id) : void 0, Ye = Ne ? e.find((e) => e.id === Ne) : void 0, Xe = (e, t) => {
|
|
43623
43630
|
let n = e.files?.[t];
|
|
43624
43631
|
if (!n) return;
|
|
43625
|
-
let r =
|
|
43632
|
+
let r = $W(e.id, t);
|
|
43626
43633
|
S((e) => ({
|
|
43627
43634
|
...e,
|
|
43628
43635
|
[r]: 0
|
|
@@ -43637,7 +43644,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43637
43644
|
}));
|
|
43638
43645
|
}, Ze = (e) => {
|
|
43639
43646
|
if (!BI(e.files).length) return;
|
|
43640
|
-
let t =
|
|
43647
|
+
let t = $W(e.id, -1);
|
|
43641
43648
|
S((e) => ({
|
|
43642
43649
|
...e,
|
|
43643
43650
|
[t]: 0
|
|
@@ -43650,21 +43657,21 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43650
43657
|
let { [t]: n, ...r } = e;
|
|
43651
43658
|
return r;
|
|
43652
43659
|
}));
|
|
43653
|
-
}, { supported: Qe, folder: $e, permitted: et, pick: tt, allow: nt, clear: rt } =
|
|
43660
|
+
}, { supported: Qe, folder: $e, permitted: et, pick: tt, allow: nt, clear: rt } = MB(), [it, at] = (0, _.useState)(() => {
|
|
43654
43661
|
try {
|
|
43655
|
-
return
|
|
43662
|
+
return bV((e) => localStorage.getItem(e));
|
|
43656
43663
|
} catch {
|
|
43657
43664
|
return "browser";
|
|
43658
43665
|
}
|
|
43659
|
-
}), [ot, st] = (0, _.useState)(() =>
|
|
43666
|
+
}), [ot, st] = (0, _.useState)(() => SW((e) => localStorage.getItem(e))), [ct, lt] = (0, _.useState)(() => CW((e) => localStorage.getItem(e))), [ut, dt] = (0, _.useState)(() => TW((e) => localStorage.getItem(e))), ft = (e) => {
|
|
43660
43667
|
st(e);
|
|
43661
43668
|
try {
|
|
43662
|
-
localStorage.setItem(
|
|
43669
|
+
localStorage.setItem(hW, e);
|
|
43663
43670
|
} catch {}
|
|
43664
43671
|
}, pt = (e) => {
|
|
43665
43672
|
lt(e);
|
|
43666
43673
|
try {
|
|
43667
|
-
localStorage.setItem(
|
|
43674
|
+
localStorage.setItem(_W, e);
|
|
43668
43675
|
} catch {}
|
|
43669
43676
|
}, mt = (e, t) => {
|
|
43670
43677
|
dt({
|
|
@@ -43672,7 +43679,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43672
43679
|
dir: t
|
|
43673
43680
|
});
|
|
43674
43681
|
try {
|
|
43675
|
-
localStorage.setItem(
|
|
43682
|
+
localStorage.setItem(gW, EW(e, t));
|
|
43676
43683
|
} catch {}
|
|
43677
43684
|
}, [ht, gt] = Ua(), _t = (0, _.useRef)(null), vt = ht.get("torrent");
|
|
43678
43685
|
(0, _.useEffect)(() => {
|
|
@@ -43687,7 +43694,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43687
43694
|
let yt = (e) => {
|
|
43688
43695
|
at(e);
|
|
43689
43696
|
try {
|
|
43690
|
-
localStorage.setItem(
|
|
43697
|
+
localStorage.setItem(vV, e);
|
|
43691
43698
|
} catch {}
|
|
43692
43699
|
}, bt = R && typeof R.scope == "object" ? e.find((e) => e.id === R.scope.torrent) : void 0, xt = (e) => {
|
|
43693
43700
|
if (!R) return;
|
|
@@ -43702,19 +43709,19 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43702
43709
|
et
|
|
43703
43710
|
]);
|
|
43704
43711
|
let St = (e) => ({
|
|
43705
|
-
intended:
|
|
43706
|
-
current:
|
|
43712
|
+
intended: xV(e, it),
|
|
43713
|
+
current: SV(e.stats?.savePath)
|
|
43707
43714
|
}), Ct = async (e, t) => {
|
|
43708
43715
|
if (!e.infoHash) return;
|
|
43709
43716
|
h.setLocation(e.infoHash, t);
|
|
43710
|
-
let { current: n } = St(e), r =
|
|
43717
|
+
let { current: n } = St(e), r = wV({
|
|
43711
43718
|
current: n,
|
|
43712
43719
|
intended: t,
|
|
43713
43720
|
complete: e.progress >= 1,
|
|
43714
43721
|
folderReady: !!$e && et
|
|
43715
43722
|
});
|
|
43716
43723
|
if (!r.move) {
|
|
43717
|
-
let e =
|
|
43724
|
+
let e = TV(r, $e?.name);
|
|
43718
43725
|
e && V(e);
|
|
43719
43726
|
return;
|
|
43720
43727
|
}
|
|
@@ -43738,7 +43745,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43738
43745
|
[e.id]: `Moving ${e.name}`
|
|
43739
43746
|
}));
|
|
43740
43747
|
try {
|
|
43741
|
-
await
|
|
43748
|
+
await kV({
|
|
43742
43749
|
client: h,
|
|
43743
43750
|
torrent: e,
|
|
43744
43751
|
folder: $e,
|
|
@@ -43761,7 +43768,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43761
43768
|
(0, _.useEffect)(() => {
|
|
43762
43769
|
if (!(!$e || !et)) for (let t of e) {
|
|
43763
43770
|
if (t.state === "missing") continue;
|
|
43764
|
-
let { intended: e, current: n } = St(t), r =
|
|
43771
|
+
let { intended: e, current: n } = St(t), r = wV({
|
|
43765
43772
|
current: n,
|
|
43766
43773
|
intended: e,
|
|
43767
43774
|
complete: t.progress >= 1,
|
|
@@ -43779,15 +43786,15 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43779
43786
|
if (!$e || !et) return;
|
|
43780
43787
|
let t = Date.now();
|
|
43781
43788
|
for (let n of e) {
|
|
43782
|
-
if (n.state !== "done" && n.state !== "seeding" ||
|
|
43789
|
+
if (n.state !== "done" && n.state !== "seeding" || yV(n) || !n.files?.length || kt.current.has(n.id)) continue;
|
|
43783
43790
|
let e = Ot.current.get(n.id);
|
|
43784
|
-
if (e !== void 0 && (e ===
|
|
43791
|
+
if (e !== void 0 && (e === qW || t < e)) continue;
|
|
43785
43792
|
kt.current.add(n.id);
|
|
43786
43793
|
let r = At.current;
|
|
43787
|
-
|
|
43788
|
-
r === At.current && e !== null && (Ot.current.set(n.id,
|
|
43794
|
+
YW(n, () => rV(h, n, $e)).then((e) => {
|
|
43795
|
+
r === At.current && e !== null && (Ot.current.set(n.id, qW), Mt((e) => e.has(n.id) ? e : new Set(e).add(n.id)), e && V(`${n.name} saved to ${$e.name}`));
|
|
43789
43796
|
}).catch(() => {
|
|
43790
|
-
r === At.current && (Ot.current.set(n.id, Date.now() +
|
|
43797
|
+
r === At.current && (Ot.current.set(n.id, Date.now() + JW), V(`Saving ${n.name} to ${$e.name} failed, retrying`));
|
|
43791
43798
|
}).finally(() => kt.current.delete(n.id));
|
|
43792
43799
|
}
|
|
43793
43800
|
}, [
|
|
@@ -43799,7 +43806,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43799
43806
|
]);
|
|
43800
43807
|
let Nt = H ? e.find((e) => e.infoHash === H.infoHash && e.state !== "missing") : void 0, Pt = Nt?.files ?? [];
|
|
43801
43808
|
(0, _.useEffect)(() => {
|
|
43802
|
-
!H || se || Pt.length === 0 || !Nt || (ce(
|
|
43809
|
+
!H || se || Pt.length === 0 || !Nt || (ce(WV({
|
|
43803
43810
|
fileCount: Pt.length,
|
|
43804
43811
|
location: it
|
|
43805
43812
|
})), le.current = Number(Nt.id), a(Number(Nt.id)));
|
|
@@ -43822,7 +43829,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43822
43829
|
]), Lt = (0, _.useCallback)(() => {
|
|
43823
43830
|
if (!H || !se || !Nt) return;
|
|
43824
43831
|
let e = Number(Nt.id);
|
|
43825
|
-
r(H.magnet), h.setPlan(e,
|
|
43832
|
+
r(H.magnet), h.setPlan(e, KV(se, Pt.length)), h.setFlags(e, ...qV(se)), H.infoHash && h.setLocation(H.infoHash, se.location), se.topOfQueue && h.moveInQueue(e, "top"), se.start && o(e), V(se.start ? `${H.name} added` : `${H.name} added, paused`), Ft();
|
|
43826
43833
|
}, [
|
|
43827
43834
|
H,
|
|
43828
43835
|
se,
|
|
@@ -43837,23 +43844,17 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43837
43844
|
(0, _.useEffect)(() => {
|
|
43838
43845
|
let e = ht.get("add");
|
|
43839
43846
|
if (!e) return;
|
|
43840
|
-
|
|
43841
|
-
try {
|
|
43842
|
-
t = window.top !== window.self;
|
|
43843
|
-
} catch {
|
|
43844
|
-
t = !0;
|
|
43845
|
-
}
|
|
43846
|
-
if (t) {
|
|
43847
|
+
if (EB()) {
|
|
43847
43848
|
gt(new URLSearchParams(), { replace: !0 });
|
|
43848
43849
|
return;
|
|
43849
43850
|
}
|
|
43850
|
-
let
|
|
43851
|
+
let t = null;
|
|
43851
43852
|
try {
|
|
43852
|
-
|
|
43853
|
+
t = document.referrer ? new URL(document.referrer).origin : null;
|
|
43853
43854
|
} catch {
|
|
43854
|
-
|
|
43855
|
+
t = null;
|
|
43855
43856
|
}
|
|
43856
|
-
|
|
43857
|
+
t === window.location.origin && (t = null), ue(e, !0, t);
|
|
43857
43858
|
}, [ht.get("add")]);
|
|
43858
43859
|
let Rt = (e) => {
|
|
43859
43860
|
let { intended: t, current: n } = St(e);
|
|
@@ -43883,7 +43884,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43883
43884
|
return n;
|
|
43884
43885
|
});
|
|
43885
43886
|
}, [e]);
|
|
43886
|
-
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) => UF(e.state)).length, qt = e.filter(
|
|
43887
|
+
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) => UF(e.state)).length, qt = e.filter(rW).length, { rows: Jt, interaction: Yt } = AW(e, ot, ut.key, ut.dir), Xt = e.length - Jt.length, Zt = ot === "library" ? e.filter(rW).reduce((e, t) => e + t.size, 0) : 0, Qt = NB(e.some((e) => e.state !== "missing")), $t = IF(), en = e.filter((e) => e.state === "retrying").length, tn = GB(), nn = FB(`${e.length}:${tn.refreshKey}`), rn = !!nn && nn.limitBytes - nn.usedBytes < 2e9, an = IB({
|
|
43887
43888
|
supported: Qe,
|
|
43888
43889
|
folderName: $e?.name,
|
|
43889
43890
|
permitted: et,
|
|
@@ -43898,25 +43899,25 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
43898
43899
|
return;
|
|
43899
43900
|
}
|
|
43900
43901
|
an.kind === "move" && yt("folder");
|
|
43901
|
-
}, sn =
|
|
43902
|
+
}, sn = eW({
|
|
43902
43903
|
dragging: ye,
|
|
43903
43904
|
overField: Se,
|
|
43904
43905
|
shareOpen: M && !P
|
|
43905
43906
|
});
|
|
43906
43907
|
return /* @__PURE__ */ W("div", {
|
|
43907
|
-
css:
|
|
43908
|
+
css: XW,
|
|
43908
43909
|
"data-drag": sn === "page" || void 0,
|
|
43909
43910
|
children: [
|
|
43910
43911
|
D,
|
|
43911
|
-
je && Je && /* @__PURE__ */ U(
|
|
43912
|
-
groups:
|
|
43912
|
+
je && Je && /* @__PURE__ */ U(WU, {
|
|
43913
|
+
groups: IW(Je, Ge(Je), Rt(Je)),
|
|
43913
43914
|
at: je.at,
|
|
43914
43915
|
label: `Options for ${Je.name}`,
|
|
43915
43916
|
onClose: () => Me(null)
|
|
43916
43917
|
}),
|
|
43917
|
-
Ye && /* @__PURE__ */ U(
|
|
43918
|
+
Ye && /* @__PURE__ */ U($U, {
|
|
43918
43919
|
title: Ye.name,
|
|
43919
|
-
groups:
|
|
43920
|
+
groups: IW(Ye, Ge(Ye), Rt(Ye)),
|
|
43920
43921
|
onClose: () => Pe(null)
|
|
43921
43922
|
}),
|
|
43922
43923
|
/* @__PURE__ */ U("div", {
|
|
@@ -44026,9 +44027,9 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
44026
44027
|
},
|
|
44027
44028
|
children: "Open torrents with Ripple"
|
|
44028
44029
|
}),
|
|
44029
|
-
/* @__PURE__ */ U(
|
|
44030
|
+
/* @__PURE__ */ U(ZU, { onToast: V })
|
|
44030
44031
|
] }),
|
|
44031
|
-
M && /* @__PURE__ */ U(
|
|
44032
|
+
M && /* @__PURE__ */ U(bH, {
|
|
44032
44033
|
torrent: P,
|
|
44033
44034
|
dragging: sn === "share",
|
|
44034
44035
|
onMagnet: pe,
|
|
@@ -44037,7 +44038,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
44037
44038
|
onClose: _e,
|
|
44038
44039
|
onToast: V
|
|
44039
44040
|
}),
|
|
44040
|
-
Ie && /* @__PURE__ */ U(
|
|
44041
|
+
Ie && /* @__PURE__ */ U(UH, {
|
|
44041
44042
|
create: Fe,
|
|
44042
44043
|
onClose: Re,
|
|
44043
44044
|
onShare: (e) => {
|
|
@@ -44096,7 +44097,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
44096
44097
|
role: "status",
|
|
44097
44098
|
children: [/* @__PURE__ */ U("strong", { children: en === 1 ? "A download hit a problem" : `${en} downloads hit a problem` }), /* @__PURE__ */ U("span", { children: "Ripple is retrying on its own. Each row shows why and when the next attempt is." })]
|
|
44098
44099
|
}),
|
|
44099
|
-
nn && rn && !f && /* @__PURE__ */ U(
|
|
44100
|
+
nn && rn && !f && /* @__PURE__ */ U(YB, {
|
|
44100
44101
|
storage: nn,
|
|
44101
44102
|
relief: an,
|
|
44102
44103
|
onAct: () => void on(),
|
|
@@ -44128,21 +44129,21 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
44128
44129
|
e.length
|
|
44129
44130
|
] })]
|
|
44130
44131
|
}),
|
|
44131
|
-
/* @__PURE__ */ U(
|
|
44132
|
+
/* @__PURE__ */ U(WW, {
|
|
44132
44133
|
reachable: m,
|
|
44133
44134
|
inboundNow: n
|
|
44134
44135
|
}),
|
|
44135
|
-
nn && /* @__PURE__ */ U(
|
|
44136
|
+
nn && /* @__PURE__ */ U(VW, {
|
|
44136
44137
|
storage: nn,
|
|
44137
44138
|
low: rn
|
|
44138
44139
|
}),
|
|
44139
|
-
Qt && /* @__PURE__ */ U(
|
|
44140
|
+
Qt && /* @__PURE__ */ U(BW, { quota: Qt }),
|
|
44140
44141
|
/* @__PURE__ */ U(TL, { reachable: m }),
|
|
44141
|
-
/* @__PURE__ */ U(
|
|
44142
|
+
/* @__PURE__ */ U(UW, { state: $t })
|
|
44142
44143
|
]
|
|
44143
|
-
}), /* @__PURE__ */ U(
|
|
44144
|
+
}), /* @__PURE__ */ U(ZW, { history: zt })]
|
|
44144
44145
|
}),
|
|
44145
|
-
e.length > 0 && /* @__PURE__ */ U(
|
|
44146
|
+
e.length > 0 && /* @__PURE__ */ U(MW, {
|
|
44146
44147
|
filter: ot,
|
|
44147
44148
|
onFilter: ft,
|
|
44148
44149
|
sortKey: ut.key,
|
|
@@ -44181,7 +44182,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
44181
44182
|
children: "Show everything"
|
|
44182
44183
|
})
|
|
44183
44184
|
})]
|
|
44184
|
-
}) : ct === "table" ? /* @__PURE__ */ U(
|
|
44185
|
+
}) : ct === "table" ? /* @__PURE__ */ U(kW, {
|
|
44185
44186
|
torrents: Jt,
|
|
44186
44187
|
sortKey: ut.key,
|
|
44187
44188
|
sortDir: ut.dir,
|
|
@@ -44189,7 +44190,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
44189
44190
|
selectedId: Ve,
|
|
44190
44191
|
onSelect: Ue,
|
|
44191
44192
|
onOptions: We
|
|
44192
|
-
}) : Jt.map((e) => /* @__PURE__ */ U(
|
|
44193
|
+
}) : Jt.map((e) => /* @__PURE__ */ U(rG, {
|
|
44193
44194
|
t: e,
|
|
44194
44195
|
saving: x,
|
|
44195
44196
|
onToggle: Te,
|
|
@@ -44223,19 +44224,19 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
44223
44224
|
]
|
|
44224
44225
|
})]
|
|
44225
44226
|
}),
|
|
44226
|
-
Ke && /* @__PURE__ */ U(
|
|
44227
|
+
Ke && /* @__PURE__ */ U(PU, {
|
|
44227
44228
|
t: Ke,
|
|
44228
44229
|
handle: Number.isFinite(Number(Ke.id)) ? Number(Ke.id) : null,
|
|
44229
44230
|
saving: qe,
|
|
44230
44231
|
onSave: (e) => Xe(Ke, e),
|
|
44231
44232
|
onClose: () => He(null)
|
|
44232
44233
|
}),
|
|
44233
|
-
H && /* @__PURE__ */ U(
|
|
44234
|
+
H && /* @__PURE__ */ U(tH, {
|
|
44234
44235
|
name: H.name,
|
|
44235
44236
|
from: H.from,
|
|
44236
44237
|
external: H.external,
|
|
44237
44238
|
files: Pt,
|
|
44238
|
-
choices: se ??
|
|
44239
|
+
choices: se ?? WV({
|
|
44239
44240
|
fileCount: 0,
|
|
44240
44241
|
location: it
|
|
44241
44242
|
}),
|
|
@@ -44250,7 +44251,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
44250
44251
|
onCancel: It,
|
|
44251
44252
|
onNeverAsk: H.external ? void 0 : () => ae(!1)
|
|
44252
44253
|
}),
|
|
44253
|
-
R && (R.scope === "session" || bt) && /* @__PURE__ */ U(
|
|
44254
|
+
R && (R.scope === "session" || bt) && /* @__PURE__ */ U(rH, {
|
|
44254
44255
|
title: R.direction === "down" ? R.scope === "session" ? "Total download rate limit" : "Download rate limit" : R.scope === "session" ? "Total upload rate limit" : "Upload rate limit",
|
|
44255
44256
|
subject: R.scope === "session" ? "Applies to every torrent at once" : bt?.name,
|
|
44256
44257
|
value: R.scope === "session" ? R.direction === "down" ? I.down : I.up : R.direction === "down" ? bt?.downloadLimit : bt?.uploadLimit,
|
|
@@ -44275,15 +44276,15 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
44275
44276
|
}),
|
|
44276
44277
|
/* @__PURE__ */ W("a", {
|
|
44277
44278
|
className: "build",
|
|
44278
|
-
href: "https://github.com/banou26/ripple/commit/
|
|
44279
|
+
href: "https://github.com/banou26/ripple/commit/e553eeb7052e03fc585598ae17ee8657d64f24ba",
|
|
44279
44280
|
target: "_blank",
|
|
44280
44281
|
rel: "noreferrer",
|
|
44281
|
-
...xL("commit
|
|
44282
|
+
...xL("commit e553eeb7052e03fc585598ae17ee8657d64f24ba"),
|
|
44282
44283
|
children: [
|
|
44283
44284
|
"v",
|
|
44284
|
-
"0.0.
|
|
44285
|
+
"0.0.12",
|
|
44285
44286
|
" · ",
|
|
44286
|
-
"
|
|
44287
|
+
"e553eeb"
|
|
44287
44288
|
]
|
|
44288
44289
|
}),
|
|
44289
44290
|
/* @__PURE__ */ W("div", {
|
|
@@ -44322,7 +44323,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
44322
44323
|
children: re ? "Ask what to download" : "Start straight away"
|
|
44323
44324
|
})]
|
|
44324
44325
|
}),
|
|
44325
|
-
/* @__PURE__ */ U(
|
|
44326
|
+
/* @__PURE__ */ U(lU, {
|
|
44326
44327
|
persist: tn,
|
|
44327
44328
|
onAsk: () => void tn.request()
|
|
44328
44329
|
}),
|
|
@@ -44363,7 +44364,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
44363
44364
|
})
|
|
44364
44365
|
]
|
|
44365
44366
|
});
|
|
44366
|
-
},
|
|
44367
|
+
}, aG = St`
|
|
44367
44368
|
position: relative;
|
|
44368
44369
|
/* vh minus the strip the broker reserved, same contract as the library page. A bare 100vh here
|
|
44369
44370
|
would still be a full viewport tall inside a root the reservation already shortened. */
|
|
@@ -44442,8 +44443,8 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
44442
44443
|
background: ${ow};
|
|
44443
44444
|
}
|
|
44444
44445
|
}
|
|
44445
|
-
`,
|
|
44446
|
-
css:
|
|
44446
|
+
`, oG = ({ children: e }) => /* @__PURE__ */ U("div", {
|
|
44447
|
+
css: aG,
|
|
44447
44448
|
children: /* @__PURE__ */ W("div", {
|
|
44448
44449
|
className: "shell",
|
|
44449
44450
|
children: [/* @__PURE__ */ U(Fa, {
|
|
@@ -44452,10 +44453,10 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
44452
44453
|
children: "Ripple"
|
|
44453
44454
|
}), e]
|
|
44454
44455
|
})
|
|
44455
|
-
}),
|
|
44456
|
+
}), sG = Aa([
|
|
44456
44457
|
{
|
|
44457
44458
|
path: io(to.HOME),
|
|
44458
|
-
element: /* @__PURE__ */ U(
|
|
44459
|
+
element: /* @__PURE__ */ U(iG, {})
|
|
44459
44460
|
},
|
|
44460
44461
|
{
|
|
44461
44462
|
path: io(to.ADD),
|
|
@@ -44471,7 +44472,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
44471
44472
|
},
|
|
44472
44473
|
{
|
|
44473
44474
|
path: io(to.LEGAL),
|
|
44474
|
-
element: /* @__PURE__ */ U(() => /* @__PURE__ */ W(
|
|
44475
|
+
element: /* @__PURE__ */ U(() => /* @__PURE__ */ W(oG, { children: [
|
|
44475
44476
|
/* @__PURE__ */ U("h1", { children: "Legal & Terms" }),
|
|
44476
44477
|
/* @__PURE__ */ U("div", {
|
|
44477
44478
|
className: "updated",
|
|
@@ -44513,7 +44514,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
44513
44514
|
},
|
|
44514
44515
|
{
|
|
44515
44516
|
path: io(to.PRIVACY),
|
|
44516
|
-
element: /* @__PURE__ */ U(() => /* @__PURE__ */ W(
|
|
44517
|
+
element: /* @__PURE__ */ U(() => /* @__PURE__ */ W(oG, { children: [
|
|
44517
44518
|
/* @__PURE__ */ U("h1", { children: "Privacy" }),
|
|
44518
44519
|
/* @__PURE__ */ U("div", {
|
|
44519
44520
|
className: "updated",
|
|
@@ -44560,7 +44561,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
44560
44561
|
] })
|
|
44561
44562
|
] }), {})
|
|
44562
44563
|
}
|
|
44563
|
-
]),
|
|
44564
|
+
]), cG = () => /* @__PURE__ */ W(co, { children: [/* @__PURE__ */ U(Hi, { router: sG }), /* @__PURE__ */ U(CL, {})] }), lG = 50, uG = ({ onActive: e, onInactive: t }) => {
|
|
44564
44565
|
let [n, r] = (0, _.useState)("probing"), i = (0, _.useRef)("probing"), [a, o] = (0, _.useState)(), [s] = (0, _.useState)(() => new BroadcastChannel("ripple-window-instance-guard")), c = (0, _.useRef)(e), l = (0, _.useRef)(t), u = (0, _.useRef)(void 0);
|
|
44565
44566
|
c.current = e, l.current = t, u.current = a;
|
|
44566
44567
|
let d = (0, _.useCallback)(() => {
|
|
@@ -44580,7 +44581,7 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
44580
44581
|
window.clearTimeout(e), i.current = "inactive", r("inactive");
|
|
44581
44582
|
}
|
|
44582
44583
|
};
|
|
44583
|
-
return s.addEventListener("message", t), s.postMessage("check"), e = window.setTimeout(d,
|
|
44584
|
+
return s.addEventListener("message", t), s.postMessage("check"), e = window.setTimeout(d, lG), () => {
|
|
44584
44585
|
window.clearTimeout(e), s.removeEventListener("message", t);
|
|
44585
44586
|
};
|
|
44586
44587
|
}, [d, s]), (0, _.useEffect)(() => () => s.close(), [s]), {
|
|
@@ -44589,11 +44590,11 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
44589
44590
|
value: a,
|
|
44590
44591
|
activate: d
|
|
44591
44592
|
};
|
|
44592
|
-
},
|
|
44593
|
+
}, dG = () => {
|
|
44593
44594
|
(0, _.useEffect)(() => EN.onUpdateTaken(() => {
|
|
44594
|
-
|
|
44595
|
+
uH();
|
|
44595
44596
|
}), []);
|
|
44596
|
-
},
|
|
44597
|
+
}, fG = St`
|
|
44597
44598
|
display: flex;
|
|
44598
44599
|
flex-direction: column;
|
|
44599
44600
|
justify-content: center;
|
|
@@ -44604,12 +44605,12 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
44604
44605
|
& > div {
|
|
44605
44606
|
margin: 1rem;
|
|
44606
44607
|
}
|
|
44607
|
-
`,
|
|
44608
|
-
let { claim: e, activate: t } =
|
|
44608
|
+
`, pG = () => {
|
|
44609
|
+
let { claim: e, activate: t } = uG({});
|
|
44609
44610
|
return (0, _.useEffect)(() => {
|
|
44610
44611
|
e === "inactive" && lP();
|
|
44611
44612
|
}, [e]), e === "probing" ? null : e === "inactive" ? /* @__PURE__ */ W("div", {
|
|
44612
|
-
css:
|
|
44613
|
+
css: fG,
|
|
44613
44614
|
children: [
|
|
44614
44615
|
/* @__PURE__ */ U("div", { children: "Only one page can be active at a time." }),
|
|
44615
44616
|
/* @__PURE__ */ U("div", { children: "Do you want this tab/window to take over? It will stop the other tab/window." }),
|
|
@@ -44618,8 +44619,8 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
44618
44619
|
children: "Yes, take over"
|
|
44619
44620
|
}) })
|
|
44620
44621
|
]
|
|
44621
|
-
}) : /* @__PURE__ */ U(
|
|
44622
|
-
},
|
|
44622
|
+
}) : /* @__PURE__ */ U(cG, {});
|
|
44623
|
+
}, mG = () => (dG(), KN() ? /* @__PURE__ */ U(cG, {}) : /* @__PURE__ */ U(pG, {})), hG = St`
|
|
44623
44624
|
/*
|
|
44624
44625
|
* What colours the scrollbars, the text caret, ::selection and the chrome the UA draws on form
|
|
44625
44626
|
* controls. Nothing in this repo touches the first three, so for those this one keyword is the
|
|
@@ -44671,8 +44672,8 @@ var iH = () => window.location.origin + "/?magnet=%s", aH = () => typeof window
|
|
|
44671
44672
|
body > .mount {
|
|
44672
44673
|
height: 100%;
|
|
44673
44674
|
}
|
|
44674
|
-
`,
|
|
44675
|
-
|
|
44675
|
+
`, gG = document.body.appendChild(document.createElement("div"));
|
|
44676
|
+
gG.classList.add("mount"), (0, eo.createRoot)(gG).render(/* @__PURE__ */ W(co, { children: [/* @__PURE__ */ U(xt, { styles: hG }), /* @__PURE__ */ U(mG, {})] })), "serviceWorker" in navigator && window.addEventListener("load", () => {
|
|
44676
44677
|
navigator.serviceWorker.register("/sw.js", { updateViaCache: "none" }).catch(() => {});
|
|
44677
44678
|
});
|
|
44678
44679
|
//#endregion
|