@harryy/react-file-browser 1.0.0 → 1.1.1
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/README.md +91 -5
- package/dist/adapters/cloud-adapter-base.d.ts +17 -17
- package/dist/adapters/cloud-adapter-base.d.ts.map +1 -1
- package/dist/adapters/in-memory/in-memory-file-browser-adapter.d.ts +18 -17
- package/dist/adapters/in-memory/in-memory-file-browser-adapter.d.ts.map +1 -1
- package/dist/adapters/in-memory/index.js +10 -2
- package/dist/adapters/in-memory/index.js.map +1 -1
- package/dist/adapters/r2/index.d.ts +3 -3
- package/dist/adapters/r2/index.d.ts.map +1 -1
- package/dist/adapters/r2/index.js.map +1 -1
- package/dist/adapters/s3/index.d.ts +3 -3
- package/dist/adapters/s3/index.d.ts.map +1 -1
- package/dist/adapters/s3/index.js.map +1 -1
- package/dist/adapters/s3-compatible-adapter.d.ts +16 -16
- package/dist/adapters/s3-compatible-adapter.d.ts.map +1 -1
- package/dist/adapters/supabase/index.d.ts +2 -2
- package/dist/adapters/supabase/index.d.ts.map +1 -1
- package/dist/adapters/supabase/index.js.map +1 -1
- package/dist/adapters/supabase/supabase-file-browser-adapter.d.ts +16 -16
- package/dist/adapters/supabase/supabase-file-browser-adapter.d.ts.map +1 -1
- package/dist/chunks/cloud-adapter-base-CBUoZYLS.js.map +1 -1
- package/dist/chunks/path-CPm7s9NF.js.map +1 -1
- package/dist/chunks/s3-compatible-adapter-D9agsn9e.js.map +1 -1
- package/dist/components/file-browser.d.ts +24 -4
- package/dist/components/file-browser.d.ts.map +1 -1
- package/dist/core/types.d.ts +12 -10
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/use-file-browser.d.ts +25 -13
- package/dist/core/use-file-browser.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1232 -1050
- package/dist/index.js.map +1 -1
- package/dist/transfers/file-browser-provider.d.ts.map +1 -1
- package/dist/transfers/transfer-manager.d.ts +7 -3
- package/dist/transfers/transfer-manager.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,8 +6,13 @@ import S from "react-selecto";
|
|
|
6
6
|
import { createPortal as C } from "react-dom";
|
|
7
7
|
import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
8
8
|
//#region src/core/use-file-browser.ts
|
|
9
|
-
function
|
|
10
|
-
let [
|
|
9
|
+
function ee({ adapter: n, path: i, initialPath: o = "/", onPathChange: s, searchQuery: c, initialSearchQuery: l = "", onSearchQueryChange: u }) {
|
|
10
|
+
let d = i === void 0 ? void 0 : a(i), [f, p] = b(() => a(o)), m = d ?? f, [g, x] = b("loading"), [S, C] = b([]), [w, T] = b(), [E, ee] = b(null), [O, k] = b(() => /* @__PURE__ */ new Set()), [ae, A] = b(null), [oe, j] = b(null), [M, N] = b(null), [se, P] = b("grid"), [ce, le] = b(l), F = c ?? ce, [I, ue] = b("all"), [L, de] = b("name"), [fe, pe] = b("asc"), R = y(0), z = y(m), B = y(void 0), me = y(F);
|
|
11
|
+
me.current = F;
|
|
12
|
+
let he = h((e) => {
|
|
13
|
+
let t = typeof e == "function" ? e(me.current) : e;
|
|
14
|
+
me.current = t, c === void 0 && le(t), u?.(t);
|
|
15
|
+
}, [c, u]), V = v(() => ({
|
|
11
16
|
createFolder: typeof n.createFolder == "function",
|
|
12
17
|
rename: typeof n.rename == "function",
|
|
13
18
|
move: typeof n.move == "function",
|
|
@@ -16,108 +21,116 @@ function D({ adapter: n, initialPath: i = "/" }) {
|
|
|
16
21
|
exists: typeof n.exists == "function",
|
|
17
22
|
multipart: typeof n.createMultipartUpload == "function" && typeof n.uploadPart == "function" && typeof n.completeMultipartUpload == "function",
|
|
18
23
|
bulkDownload: typeof n.bulkDownloadUrl == "function"
|
|
19
|
-
}), [n]),
|
|
20
|
-
let e =
|
|
21
|
-
return [...
|
|
24
|
+
}), [n]), H = v(() => re(Array.from(O)), [O]), U = v(() => S.filter((e) => O.has(e.path)), [S, O]), ge = v(() => {
|
|
25
|
+
let e = F.trim().toLowerCase();
|
|
26
|
+
return [...S].filter((t) => e ? t.name.toLowerCase().includes(e) : !0).filter((e) => I === "all" ? !0 : e.kind === (I === "files" ? "file" : "folder")).sort((e, t) => D(e, t, L, fe));
|
|
22
27
|
}, [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
N,
|
|
28
|
+
I,
|
|
29
|
+
S,
|
|
26
30
|
F,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
L,
|
|
32
|
+
fe
|
|
33
|
+
]), W = h(async (e, t) => {
|
|
34
|
+
let r = a(e), i = ++R.current;
|
|
35
|
+
x((e) => t === "replace" || e === "idle" ? "loading" : e), ee(null);
|
|
31
36
|
try {
|
|
32
|
-
let e = await n.list(r, { cursor: t === "append" ?
|
|
33
|
-
if (i !==
|
|
34
|
-
|
|
37
|
+
let e = await n.list(r, { cursor: t === "append" ? B.current : void 0 });
|
|
38
|
+
if (i !== R.current) return;
|
|
39
|
+
C((n) => t === "append" ? te(n, e.items) : e.items), B.current = e.cursor, T(e.cursor), x("ready");
|
|
35
40
|
} catch (e) {
|
|
36
|
-
if (i !==
|
|
37
|
-
|
|
41
|
+
if (i !== R.current) return;
|
|
42
|
+
ee(ie(e)), x("error");
|
|
38
43
|
}
|
|
39
|
-
}, [n
|
|
40
|
-
await
|
|
41
|
-
}, [
|
|
42
|
-
let
|
|
43
|
-
|
|
44
|
-
}, [
|
|
45
|
-
|
|
44
|
+
}, [n]), _e = h(async () => {
|
|
45
|
+
await W(m, "replace");
|
|
46
|
+
}, [m, W]), ve = h(async (e, t = { source: "programmatic" }) => {
|
|
47
|
+
let n = a(e);
|
|
48
|
+
n !== z.current && (s?.(n, t), d === void 0 && (z.current = n, p(n), k(/* @__PURE__ */ new Set()), A(null), j(null), B.current = void 0, T(void 0), await W(n, "replace")));
|
|
49
|
+
}, [
|
|
50
|
+
d,
|
|
51
|
+
W,
|
|
52
|
+
s
|
|
53
|
+
]), ye = h(async () => {
|
|
54
|
+
!w || g === "loading" || await W(m, "append");
|
|
46
55
|
}, [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
56
|
+
m,
|
|
57
|
+
w,
|
|
58
|
+
W,
|
|
59
|
+
g
|
|
51
60
|
]);
|
|
52
61
|
_(() => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
62
|
+
let e = m;
|
|
63
|
+
e !== z.current && (z.current = e, k(/* @__PURE__ */ new Set()), A(null), j(null)), B.current = void 0, T(void 0), Promise.resolve().then(() => W(e, "replace"));
|
|
64
|
+
}, [n, d]);
|
|
65
|
+
let be = h((e) => {
|
|
56
66
|
let t = a(e);
|
|
57
|
-
|
|
58
|
-
}, []),
|
|
67
|
+
k(/* @__PURE__ */ new Set([t])), A(t), j(t);
|
|
68
|
+
}, []), xe = h((e) => {
|
|
59
69
|
let t = a(e);
|
|
60
|
-
|
|
70
|
+
k((e) => {
|
|
61
71
|
let n = new Set(e);
|
|
62
72
|
return n.has(t) ? n.delete(t) : n.add(t), n;
|
|
63
|
-
}),
|
|
64
|
-
}, []),
|
|
65
|
-
let t = a(e), n =
|
|
73
|
+
}), A(t);
|
|
74
|
+
}, []), Se = h((e) => {
|
|
75
|
+
let t = a(e), n = oe ?? ae ?? t, r = ge.map((e) => e.path), i = r.indexOf(n), o = r.indexOf(t);
|
|
66
76
|
if (i === -1 || o === -1) {
|
|
67
|
-
|
|
77
|
+
be(t);
|
|
68
78
|
return;
|
|
69
79
|
}
|
|
70
80
|
let s = Math.min(i, o), c = Math.max(i, o);
|
|
71
|
-
|
|
81
|
+
k(new Set(r.slice(s, c + 1))), A(t);
|
|
72
82
|
}, [
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
]),
|
|
83
|
+
ge,
|
|
84
|
+
ae,
|
|
85
|
+
oe,
|
|
86
|
+
be
|
|
87
|
+
]), Ce = h((e, t = {}) => {
|
|
78
88
|
let n = e.map(a);
|
|
79
|
-
|
|
89
|
+
k((e) => {
|
|
80
90
|
let r = t.additive ? new Set(e) : /* @__PURE__ */ new Set();
|
|
81
91
|
for (let e of n) r.add(e);
|
|
82
92
|
return r;
|
|
83
|
-
}),
|
|
84
|
-
}, []),
|
|
85
|
-
|
|
86
|
-
}, [
|
|
87
|
-
|
|
88
|
-
}, []),
|
|
89
|
-
e.kind === "folder" ? await
|
|
90
|
-
|
|
93
|
+
}), A(n.at(-1) ?? null), j(n.at(0) ?? null);
|
|
94
|
+
}, []), we = h(() => {
|
|
95
|
+
k(new Set(S.map((e) => e.path))), A(S.at(0)?.path ?? null), j(S.at(0)?.path ?? null);
|
|
96
|
+
}, [S]), Te = h(() => {
|
|
97
|
+
k(/* @__PURE__ */ new Set()), A(null), j(null);
|
|
98
|
+
}, []), Ee = h(async (e) => {
|
|
99
|
+
e.kind === "folder" ? await ve(e.path, {
|
|
100
|
+
source: "item",
|
|
101
|
+
item: e
|
|
102
|
+
}) : be(e.path);
|
|
103
|
+
}, [ve, be]), De = h(async (r) => {
|
|
91
104
|
if (!n.createFolder) throw new t("not_supported", "Folder creation is not supported by this adapter");
|
|
92
|
-
let i = e(
|
|
105
|
+
let i = e(m, r.trim()), a = {
|
|
93
106
|
path: i,
|
|
94
107
|
name: r.trim(),
|
|
95
108
|
kind: "folder",
|
|
96
109
|
modifiedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
97
110
|
};
|
|
98
|
-
|
|
111
|
+
C((e) => te(e, [a]));
|
|
99
112
|
try {
|
|
100
113
|
let e = await n.createFolder(i);
|
|
101
|
-
return
|
|
114
|
+
return C((t) => te(ne(t, [i]), [e])), e;
|
|
102
115
|
} catch (e) {
|
|
103
|
-
throw
|
|
116
|
+
throw C((e) => ne(e, [i])), e;
|
|
104
117
|
}
|
|
105
|
-
}, [n,
|
|
118
|
+
}, [n, m]), Oe = h(async (e, r) => {
|
|
106
119
|
if (!n.rename) throw new t("not_supported", "Rename is not supported by this adapter");
|
|
107
|
-
let i = a(e), o =
|
|
108
|
-
|
|
120
|
+
let i = a(e), o = S;
|
|
121
|
+
C((e) => e.map((e) => e.path === i ? {
|
|
109
122
|
...e,
|
|
110
123
|
name: r.trim()
|
|
111
124
|
} : e));
|
|
112
125
|
try {
|
|
113
126
|
let e = await n.rename(i, r.trim());
|
|
114
|
-
return
|
|
127
|
+
return C((t) => t.map((t) => t.path === i ? e : t)), e;
|
|
115
128
|
} catch (e) {
|
|
116
|
-
throw
|
|
129
|
+
throw C(o), e;
|
|
117
130
|
}
|
|
118
|
-
}, [n,
|
|
119
|
-
let t = e.map(a), i =
|
|
120
|
-
|
|
131
|
+
}, [n, S]), ke = h(async (e) => {
|
|
132
|
+
let t = e.map(a), i = S, o = O;
|
|
133
|
+
C((e) => ne(e, t)), k((e) => {
|
|
121
134
|
let n = new Set(e);
|
|
122
135
|
for (let e of t) n.delete(e);
|
|
123
136
|
return n;
|
|
@@ -127,151 +140,151 @@ function D({ adapter: n, initialPath: i = "/" }) {
|
|
|
127
140
|
} catch (e) {
|
|
128
141
|
if (e instanceof r) {
|
|
129
142
|
let t = e.succeededPaths.map(a), n = e.failures.map((e) => a(e.path));
|
|
130
|
-
throw
|
|
143
|
+
throw C(ne(i, t)), k(new Set(n)), A(n.at(0) ?? null), j(n.at(0) ?? null), e;
|
|
131
144
|
}
|
|
132
|
-
throw
|
|
145
|
+
throw C(i), k(o), e;
|
|
133
146
|
}
|
|
134
147
|
}, [
|
|
135
148
|
n,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
]),
|
|
139
|
-
await
|
|
140
|
-
}, [
|
|
149
|
+
S,
|
|
150
|
+
O
|
|
151
|
+
]), Ae = h(async () => {
|
|
152
|
+
await ke(H);
|
|
153
|
+
}, [ke, H]), G = h(async (e, i) => {
|
|
141
154
|
if (!n.move) throw new t("not_supported", "Move is not supported by this adapter");
|
|
142
|
-
let
|
|
143
|
-
if (
|
|
144
|
-
let
|
|
155
|
+
let o = e.map(a);
|
|
156
|
+
if (o.length === 0) return;
|
|
157
|
+
let s = a(i);
|
|
145
158
|
try {
|
|
146
|
-
await n.move(
|
|
159
|
+
await n.move(o, s);
|
|
147
160
|
} catch (e) {
|
|
148
161
|
if (e instanceof r) {
|
|
149
162
|
let t = e.succeededPaths.map(a), n = e.failures.map((e) => a(e.path));
|
|
150
|
-
throw
|
|
163
|
+
throw s === m ? await _e() : C((e) => ne(e, t)), k(new Set(n)), A(n.at(0) ?? null), j(n.at(0) ?? null), e;
|
|
151
164
|
}
|
|
152
165
|
throw e;
|
|
153
166
|
}
|
|
154
|
-
|
|
167
|
+
k((e) => {
|
|
155
168
|
let t = new Set(e);
|
|
156
|
-
for (let e of
|
|
169
|
+
for (let e of o) t.delete(e);
|
|
157
170
|
return t;
|
|
158
|
-
}),
|
|
171
|
+
}), A(null), j(null), s === m ? await _e() : C((e) => ne(e, o));
|
|
159
172
|
}, [
|
|
160
173
|
n,
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
]),
|
|
164
|
-
await
|
|
165
|
-
}, [
|
|
166
|
-
|
|
174
|
+
m,
|
|
175
|
+
_e
|
|
176
|
+
]), je = h(async (e) => {
|
|
177
|
+
await G(H, e), N((e) => e?.type === "cut" ? null : e);
|
|
178
|
+
}, [G, H]), K = h((e = H) => {
|
|
179
|
+
N({
|
|
167
180
|
type: "copy",
|
|
168
181
|
paths: e.map(a)
|
|
169
182
|
});
|
|
170
|
-
}, [
|
|
171
|
-
|
|
183
|
+
}, [H]), Me = h((e = H) => {
|
|
184
|
+
N({
|
|
172
185
|
type: "cut",
|
|
173
186
|
paths: e.map(a)
|
|
174
187
|
});
|
|
175
|
-
}, [
|
|
176
|
-
if (!
|
|
188
|
+
}, [H]), Ne = h(async (e) => {
|
|
189
|
+
if (!M || M.paths.length === 0) return;
|
|
177
190
|
let r = a(e);
|
|
178
|
-
if (
|
|
191
|
+
if (M.type === "copy") {
|
|
179
192
|
if (!n.copy) throw new t("not_supported", "Copy is not supported by this adapter");
|
|
180
|
-
await n.copy(
|
|
193
|
+
await n.copy(M.paths, r);
|
|
181
194
|
} else {
|
|
182
195
|
if (!n.move) throw new t("not_supported", "Move is not supported by this adapter");
|
|
183
|
-
await
|
|
196
|
+
await G(M.paths, r), N(null);
|
|
184
197
|
return;
|
|
185
198
|
}
|
|
186
|
-
r ===
|
|
199
|
+
r === m && await _e();
|
|
187
200
|
}, [
|
|
188
201
|
n,
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
]),
|
|
202
|
+
M,
|
|
203
|
+
m,
|
|
204
|
+
G,
|
|
205
|
+
_e
|
|
206
|
+
]), Pe = h(async (t, r = {}) => {
|
|
194
207
|
if (r.onConflict === "skip") return [];
|
|
195
208
|
let i = Array.from(t), a = [];
|
|
196
209
|
for (let t of i) {
|
|
197
|
-
let i = e(
|
|
198
|
-
a.push(o),
|
|
210
|
+
let i = e(z.current, t.name), o = await n.upload(i, t, { onConflict: r.onConflict ?? "keep-both" });
|
|
211
|
+
a.push(o), C((e) => te(e, [o]));
|
|
199
212
|
}
|
|
200
213
|
return a;
|
|
201
214
|
}, [n]);
|
|
202
215
|
return {
|
|
203
216
|
adapter: n,
|
|
204
|
-
capabilities:
|
|
205
|
-
currentPath:
|
|
206
|
-
status:
|
|
207
|
-
items:
|
|
208
|
-
error:
|
|
209
|
-
hasMore: !!
|
|
210
|
-
selectedPaths:
|
|
211
|
-
selectedItems:
|
|
212
|
-
focusedPath:
|
|
213
|
-
clipboard:
|
|
214
|
-
view:
|
|
215
|
-
searchQuery:
|
|
216
|
-
filterKind:
|
|
217
|
-
sortBy:
|
|
218
|
-
sortDirection:
|
|
219
|
-
filteredItems:
|
|
220
|
-
setView:
|
|
221
|
-
setSearchQuery:
|
|
222
|
-
setFilterKind:
|
|
223
|
-
setSortBy:
|
|
224
|
-
setSortDirection:
|
|
225
|
-
refresh:
|
|
226
|
-
loadMore:
|
|
227
|
-
navigate:
|
|
228
|
-
open:
|
|
229
|
-
selectOnly:
|
|
230
|
-
toggleSelection:
|
|
231
|
-
selectRange:
|
|
232
|
-
setSelection:
|
|
233
|
-
selectAllLoaded:
|
|
234
|
-
clearSelection:
|
|
235
|
-
createFolder:
|
|
236
|
-
rename:
|
|
237
|
-
deleteSelected:
|
|
238
|
-
deletePaths:
|
|
239
|
-
movePathsTo:
|
|
240
|
-
moveSelectedTo:
|
|
241
|
-
copySelection:
|
|
242
|
-
cutSelection:
|
|
243
|
-
pasteInto:
|
|
244
|
-
uploadFiles:
|
|
217
|
+
capabilities: V,
|
|
218
|
+
currentPath: m,
|
|
219
|
+
status: g,
|
|
220
|
+
items: S,
|
|
221
|
+
error: E,
|
|
222
|
+
hasMore: !!w,
|
|
223
|
+
selectedPaths: H,
|
|
224
|
+
selectedItems: U,
|
|
225
|
+
focusedPath: ae,
|
|
226
|
+
clipboard: M,
|
|
227
|
+
view: se,
|
|
228
|
+
searchQuery: F,
|
|
229
|
+
filterKind: I,
|
|
230
|
+
sortBy: L,
|
|
231
|
+
sortDirection: fe,
|
|
232
|
+
filteredItems: ge,
|
|
233
|
+
setView: P,
|
|
234
|
+
setSearchQuery: he,
|
|
235
|
+
setFilterKind: ue,
|
|
236
|
+
setSortBy: de,
|
|
237
|
+
setSortDirection: pe,
|
|
238
|
+
refresh: _e,
|
|
239
|
+
loadMore: ye,
|
|
240
|
+
navigate: ve,
|
|
241
|
+
open: Ee,
|
|
242
|
+
selectOnly: be,
|
|
243
|
+
toggleSelection: xe,
|
|
244
|
+
selectRange: Se,
|
|
245
|
+
setSelection: Ce,
|
|
246
|
+
selectAllLoaded: we,
|
|
247
|
+
clearSelection: Te,
|
|
248
|
+
createFolder: De,
|
|
249
|
+
rename: Oe,
|
|
250
|
+
deleteSelected: Ae,
|
|
251
|
+
deletePaths: ke,
|
|
252
|
+
movePathsTo: G,
|
|
253
|
+
moveSelectedTo: je,
|
|
254
|
+
copySelection: K,
|
|
255
|
+
cutSelection: Me,
|
|
256
|
+
pasteInto: Ne,
|
|
257
|
+
uploadFiles: Pe
|
|
245
258
|
};
|
|
246
259
|
}
|
|
247
|
-
function
|
|
260
|
+
function te(e, t) {
|
|
248
261
|
let n = new Map(e.map((e) => [e.path, e]));
|
|
249
262
|
for (let e of t) n.set(e.path, e);
|
|
250
|
-
return Array.from(n.values()).sort((e, t) =>
|
|
263
|
+
return Array.from(n.values()).sort((e, t) => D(e, t, "name", "asc"));
|
|
251
264
|
}
|
|
252
|
-
function
|
|
265
|
+
function ne(e, t) {
|
|
253
266
|
let n = new Set(t);
|
|
254
267
|
return e.filter((e) => !n.has(e.path));
|
|
255
268
|
}
|
|
256
|
-
function
|
|
269
|
+
function D(e, t, n, r) {
|
|
257
270
|
let i = r === "asc" ? 1 : -1;
|
|
258
271
|
return e.kind === t.kind ? n === "size" ? ((e.size ?? 0) - (t.size ?? 0)) * i : n === "modifiedAt" ? String(e.modifiedAt ?? "").localeCompare(String(t.modifiedAt ?? "")) * i : e.name.localeCompare(t.name, void 0, {
|
|
259
272
|
numeric: !0,
|
|
260
273
|
sensitivity: "base"
|
|
261
274
|
}) * i : e.kind === "folder" ? -1 : 1;
|
|
262
275
|
}
|
|
263
|
-
function
|
|
276
|
+
function re(e) {
|
|
264
277
|
return [...e].sort((e, t) => e.localeCompare(t));
|
|
265
278
|
}
|
|
266
|
-
function
|
|
279
|
+
function ie(e) {
|
|
267
280
|
return e instanceof Error ? e : Error(String(e));
|
|
268
281
|
}
|
|
269
282
|
//#endregion
|
|
270
283
|
//#region node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.mjs
|
|
271
|
-
var
|
|
272
|
-
let t =
|
|
284
|
+
var O = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), k = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ae = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), A = (e) => {
|
|
285
|
+
let t = ae(e);
|
|
273
286
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
274
|
-
},
|
|
287
|
+
}, oe = {
|
|
275
288
|
xmlns: "http://www.w3.org/2000/svg",
|
|
276
289
|
width: 24,
|
|
277
290
|
height: 24,
|
|
@@ -281,37 +294,37 @@ var j = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
281
294
|
strokeWidth: 2,
|
|
282
295
|
strokeLinecap: "round",
|
|
283
296
|
strokeLinejoin: "round"
|
|
284
|
-
},
|
|
297
|
+
}, j = (e) => {
|
|
285
298
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
286
299
|
return !1;
|
|
287
|
-
},
|
|
288
|
-
let { size: l = 24, strokeWidth: u = 2, absoluteStrokeWidth: d = !1, color: f = "currentColor", className: m = "" } =
|
|
300
|
+
}, M = f({}), N = () => g(M), se = m(({ color: e, size: t, strokeWidth: n, absoluteStrokeWidth: r, className: i = "", children: a, iconNode: o, ...s }, c) => {
|
|
301
|
+
let { size: l = 24, strokeWidth: u = 2, absoluteStrokeWidth: d = !1, color: f = "currentColor", className: m = "" } = N() ?? {}, h = r ?? d ? Number(n ?? u) * 24 / Number(t ?? l) : n ?? u;
|
|
289
302
|
return p("svg", {
|
|
290
303
|
ref: c,
|
|
291
|
-
...
|
|
292
|
-
width: t ?? l ??
|
|
293
|
-
height: t ?? l ??
|
|
304
|
+
...oe,
|
|
305
|
+
width: t ?? l ?? oe.width,
|
|
306
|
+
height: t ?? l ?? oe.height,
|
|
294
307
|
stroke: e ?? f,
|
|
295
308
|
strokeWidth: h,
|
|
296
|
-
className:
|
|
297
|
-
...!a && !
|
|
309
|
+
className: O("lucide", m, i),
|
|
310
|
+
...!a && !j(s) && { "aria-hidden": "true" },
|
|
298
311
|
...s
|
|
299
312
|
}, [...o.map(([e, t]) => p(e, t)), ...Array.isArray(a) ? a : [a]]);
|
|
300
|
-
}),
|
|
301
|
-
let n = m(({ className: n, ...r }, i) => p(
|
|
313
|
+
}), P = (e, t) => {
|
|
314
|
+
let n = m(({ className: n, ...r }, i) => p(se, {
|
|
302
315
|
ref: i,
|
|
303
316
|
iconNode: t,
|
|
304
|
-
className:
|
|
317
|
+
className: O(`lucide-${k(A(e))}`, `lucide-${e}`, n),
|
|
305
318
|
...r
|
|
306
319
|
}));
|
|
307
|
-
return n.displayName =
|
|
308
|
-
},
|
|
320
|
+
return n.displayName = A(e), n;
|
|
321
|
+
}, ce = P("chevron-left", [["path", {
|
|
309
322
|
d: "m15 18-6-6 6-6",
|
|
310
323
|
key: "1wnfg3"
|
|
311
|
-
}]]),
|
|
324
|
+
}]]), le = P("chevron-right", [["path", {
|
|
312
325
|
d: "m9 18 6-6-6-6",
|
|
313
326
|
key: "mthhwq"
|
|
314
|
-
}]]),
|
|
327
|
+
}]]), F = P("copy", [["rect", {
|
|
315
328
|
width: "14",
|
|
316
329
|
height: "14",
|
|
317
330
|
x: "8",
|
|
@@ -322,7 +335,7 @@ var j = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
322
335
|
}], ["path", {
|
|
323
336
|
d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",
|
|
324
337
|
key: "zix9uf"
|
|
325
|
-
}]]),
|
|
338
|
+
}]]), I = P("download", [
|
|
326
339
|
["path", {
|
|
327
340
|
d: "M12 15V3",
|
|
328
341
|
key: "m9g1x1"
|
|
@@ -335,13 +348,13 @@ var j = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
335
348
|
d: "m7 10 5 5 5-5",
|
|
336
349
|
key: "brsn70"
|
|
337
350
|
}]
|
|
338
|
-
]),
|
|
351
|
+
]), ue = P("file", [["path", {
|
|
339
352
|
d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
|
|
340
353
|
key: "1oefj6"
|
|
341
354
|
}], ["path", {
|
|
342
355
|
d: "M14 2v5a1 1 0 0 0 1 1h5",
|
|
343
356
|
key: "wfsgrz"
|
|
344
|
-
}]]),
|
|
357
|
+
}]]), L = P("folder-input", [
|
|
345
358
|
["path", {
|
|
346
359
|
d: "M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",
|
|
347
360
|
key: "fm4g5t"
|
|
@@ -354,10 +367,10 @@ var j = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
354
367
|
d: "m9 16 3-3-3-3",
|
|
355
368
|
key: "6m91ic"
|
|
356
369
|
}]
|
|
357
|
-
]),
|
|
370
|
+
]), de = P("folder", [["path", {
|
|
358
371
|
d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",
|
|
359
372
|
key: "1kt360"
|
|
360
|
-
}]]),
|
|
373
|
+
}]]), fe = P("grid-2x2", [
|
|
361
374
|
["path", {
|
|
362
375
|
d: "M12 3v18",
|
|
363
376
|
key: "108xh3"
|
|
@@ -374,7 +387,7 @@ var j = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
374
387
|
rx: "2",
|
|
375
388
|
key: "h1oib"
|
|
376
389
|
}]
|
|
377
|
-
]),
|
|
390
|
+
]), pe = P("list", [
|
|
378
391
|
["path", {
|
|
379
392
|
d: "M3 5h.01",
|
|
380
393
|
key: "18ugdj"
|
|
@@ -399,7 +412,7 @@ var j = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
399
412
|
d: "M8 19h13",
|
|
400
413
|
key: "m83p4d"
|
|
401
414
|
}]
|
|
402
|
-
]),
|
|
415
|
+
]), R = P("pause", [["rect", {
|
|
403
416
|
x: "14",
|
|
404
417
|
y: "3",
|
|
405
418
|
width: "5",
|
|
@@ -413,16 +426,16 @@ var j = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
413
426
|
height: "18",
|
|
414
427
|
rx: "1",
|
|
415
428
|
key: "1wsw3u"
|
|
416
|
-
}]]),
|
|
429
|
+
}]]), z = P("pencil", [["path", {
|
|
417
430
|
d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
|
|
418
431
|
key: "1a8usu"
|
|
419
432
|
}], ["path", {
|
|
420
433
|
d: "m15 5 4 4",
|
|
421
434
|
key: "1mk7zo"
|
|
422
|
-
}]]), B =
|
|
435
|
+
}]]), B = P("play", [["path", {
|
|
423
436
|
d: "M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",
|
|
424
437
|
key: "10ikf1"
|
|
425
|
-
}]]), me =
|
|
438
|
+
}]]), me = P("scissors", [
|
|
426
439
|
["circle", {
|
|
427
440
|
cx: "6",
|
|
428
441
|
cy: "6",
|
|
@@ -447,7 +460,7 @@ var j = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
447
460
|
d: "M14.8 14.8 20 20",
|
|
448
461
|
key: "ptml3r"
|
|
449
462
|
}]
|
|
450
|
-
]), he =
|
|
463
|
+
]), he = P("search", [["path", {
|
|
451
464
|
d: "m21 21-4.34-4.34",
|
|
452
465
|
key: "14j7rj"
|
|
453
466
|
}], ["circle", {
|
|
@@ -455,20 +468,20 @@ var j = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
455
468
|
cy: "11",
|
|
456
469
|
r: "8",
|
|
457
470
|
key: "4ej97u"
|
|
458
|
-
}]]),
|
|
471
|
+
}]]), V = P("square-check-big", [["path", {
|
|
459
472
|
d: "M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",
|
|
460
473
|
key: "2acyp4"
|
|
461
474
|
}], ["path", {
|
|
462
475
|
d: "m9 11 3 3L22 4",
|
|
463
476
|
key: "1pflzl"
|
|
464
|
-
}]]),
|
|
477
|
+
}]]), H = P("square", [["rect", {
|
|
465
478
|
width: "18",
|
|
466
479
|
height: "18",
|
|
467
480
|
x: "3",
|
|
468
481
|
y: "3",
|
|
469
482
|
rx: "2",
|
|
470
483
|
key: "afitv7"
|
|
471
|
-
}]]),
|
|
484
|
+
}]]), U = P("trash-2", [
|
|
472
485
|
["path", {
|
|
473
486
|
d: "M10 11v6",
|
|
474
487
|
key: "nco0om"
|
|
@@ -489,7 +502,7 @@ var j = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
489
502
|
d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",
|
|
490
503
|
key: "e791ji"
|
|
491
504
|
}]
|
|
492
|
-
]),
|
|
505
|
+
]), ge = P("upload", [
|
|
493
506
|
["path", {
|
|
494
507
|
d: "M12 3v12",
|
|
495
508
|
key: "1x0j5s"
|
|
@@ -502,7 +515,7 @@ var j = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
502
515
|
d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",
|
|
503
516
|
key: "ih7n3h"
|
|
504
517
|
}]
|
|
505
|
-
]),
|
|
518
|
+
]), W = P("x", [["path", {
|
|
506
519
|
d: "M18 6 6 18",
|
|
507
520
|
key: "1bl5f8"
|
|
508
521
|
}], ["path", {
|
|
@@ -511,37 +524,37 @@ var j = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
511
524
|
}]]);
|
|
512
525
|
//#endregion
|
|
513
526
|
//#region src/core/upload-drop.ts
|
|
514
|
-
async function
|
|
527
|
+
async function _e(e) {
|
|
515
528
|
let t = Array.from(e.items).map((e) => e.webkitGetAsEntry?.()).filter((e) => !!e);
|
|
516
|
-
if (t.length === 0) return
|
|
529
|
+
if (t.length === 0) return ve(e.files);
|
|
517
530
|
let n = [];
|
|
518
|
-
for (let e of t) n.push(...await
|
|
531
|
+
for (let e of t) n.push(...await ye(e));
|
|
519
532
|
return n;
|
|
520
533
|
}
|
|
521
|
-
function
|
|
534
|
+
function ve(e) {
|
|
522
535
|
return Array.from(e).map((e) => ({
|
|
523
536
|
file: e,
|
|
524
|
-
relativePath:
|
|
537
|
+
relativePath: we(Se(e))
|
|
525
538
|
}));
|
|
526
539
|
}
|
|
527
|
-
async function
|
|
540
|
+
async function ye(e, t = "") {
|
|
528
541
|
if (e.isFile) {
|
|
529
|
-
let n = await
|
|
542
|
+
let n = await be(e);
|
|
530
543
|
return [{
|
|
531
544
|
file: n,
|
|
532
|
-
relativePath:
|
|
545
|
+
relativePath: we(Ce(t, n.name))
|
|
533
546
|
}];
|
|
534
547
|
}
|
|
535
|
-
let n =
|
|
536
|
-
for (let e of r) i.push(...await
|
|
548
|
+
let n = Ce(t, e.name), r = await xe(e), i = [];
|
|
549
|
+
for (let e of r) i.push(...await ye(e, n));
|
|
537
550
|
return i;
|
|
538
551
|
}
|
|
539
|
-
function
|
|
552
|
+
function be(e) {
|
|
540
553
|
return new Promise((t, n) => {
|
|
541
554
|
e.file(t, n);
|
|
542
555
|
});
|
|
543
556
|
}
|
|
544
|
-
async function
|
|
557
|
+
async function xe(e) {
|
|
545
558
|
let t = e.createReader(), n = [];
|
|
546
559
|
for (;;) {
|
|
547
560
|
let e = await new Promise((e, n) => {
|
|
@@ -552,30 +565,32 @@ async function Se(e) {
|
|
|
552
565
|
}
|
|
553
566
|
return n;
|
|
554
567
|
}
|
|
555
|
-
function
|
|
568
|
+
function Se(e) {
|
|
556
569
|
return e.webkitRelativePath || e.name;
|
|
557
570
|
}
|
|
558
|
-
function
|
|
571
|
+
function Ce(...e) {
|
|
559
572
|
return e.filter(Boolean).join("/");
|
|
560
573
|
}
|
|
561
|
-
function
|
|
574
|
+
function we(e) {
|
|
562
575
|
return e.replaceAll("\\", "/").split("/").filter((e) => e && e !== "." && e !== "..").join("/");
|
|
563
576
|
}
|
|
564
577
|
//#endregion
|
|
565
578
|
//#region src/transfers/transfer-manager.ts
|
|
566
|
-
var
|
|
579
|
+
var Te = "react-file-browser-transfers", Ee = 1440 * 60 * 1e3, De = class {
|
|
567
580
|
uploads = /* @__PURE__ */ new Map();
|
|
568
581
|
downloads = /* @__PURE__ */ new Map();
|
|
569
582
|
uploadSpeedSamples = /* @__PURE__ */ new Map();
|
|
570
583
|
subscribers = /* @__PURE__ */ new Set();
|
|
571
584
|
activeTasks = /* @__PURE__ */ new Set();
|
|
585
|
+
runningUploadIds = /* @__PURE__ */ new Set();
|
|
572
586
|
storage;
|
|
573
587
|
storageKey;
|
|
574
588
|
idFactory;
|
|
575
589
|
now;
|
|
590
|
+
maxConcurrentUploads;
|
|
576
591
|
snapshotCache;
|
|
577
592
|
constructor(e = {}) {
|
|
578
|
-
this.storage = e.storage, this.storageKey = e.storageKey ??
|
|
593
|
+
this.storage = e.storage ?? void 0, this.storageKey = e.storageKey ?? Te, this.idFactory = e.idFactory ?? q, this.now = e.now ?? (() => /* @__PURE__ */ new Date()), this.maxConcurrentUploads = Ie(e.maxConcurrentUploads), this.restorePersisted(), this.downloads.size > 0 && this.pruneExpiredDownloads();
|
|
579
594
|
}
|
|
580
595
|
subscribe(e) {
|
|
581
596
|
return this.subscribers.add(e), () => {
|
|
@@ -609,7 +624,7 @@ var Ee = "react-file-browser-transfers", De = 1440 * 60 * 1e3, W = class {
|
|
|
609
624
|
}
|
|
610
625
|
dismissDownload(e) {
|
|
611
626
|
let t = this.downloads.get(e);
|
|
612
|
-
t && (
|
|
627
|
+
t && (Re(t.url), this.downloads.delete(e), this.persistAndNotify());
|
|
613
628
|
}
|
|
614
629
|
hasActiveTransfers() {
|
|
615
630
|
let e = this.getSnapshot();
|
|
@@ -633,49 +648,50 @@ var Ee = "react-file-browser-transfers", De = 1440 * 60 * 1e3, W = class {
|
|
|
633
648
|
onConflict: i,
|
|
634
649
|
abortController: new AbortController()
|
|
635
650
|
};
|
|
636
|
-
return this.uploads.set(a, s), this.persistAndNotify(), this.
|
|
651
|
+
return this.uploads.set(a, s), this.persistAndNotify(), this.pumpUploadQueue(), a;
|
|
637
652
|
}
|
|
638
653
|
resumeUpload(e) {
|
|
639
654
|
let t = this.uploads.get(e);
|
|
640
|
-
return !t || !t.adapter || !t.file ? Promise.resolve() : (t.status = "queued", t.error = void 0, t.bytesPerSecond = void 0, this.uploadSpeedSamples.delete(e), t.abortController = new AbortController(), t.updatedAt = this.timestamp(), this.persistAndNotify(), this.
|
|
655
|
+
return !t || !t.adapter || !t.file || this.runningUploadIds.has(e) ? Promise.resolve() : (t.status = "queued", t.error = void 0, t.bytesPerSecond = void 0, this.uploadSpeedSamples.delete(e), t.abortController = new AbortController(), t.updatedAt = this.timestamp(), this.persistAndNotify(), this.pumpUploadQueue(), Promise.resolve());
|
|
641
656
|
}
|
|
642
657
|
resumeRestoredUpload({ adapter: e, file: t, id: n, onConflict: r }) {
|
|
643
658
|
let i = this.uploads.get(n);
|
|
644
|
-
return i ? (i.adapter = e, i.file = t, i.name = t.name, i.totalBytes = t.size, i.onConflict = r ?? i.onConflict, i.status = "queued", i.error = void 0, i.bytesPerSecond = void 0, this.uploadSpeedSamples.delete(n), i.abortController = new AbortController(), i.updatedAt = this.timestamp(), this.persistAndNotify(), this.
|
|
659
|
+
return i ? (i.adapter = e, i.file = t, i.name = t.name, i.totalBytes = t.size, i.onConflict = r ?? i.onConflict, i.status = "queued", i.error = void 0, i.bytesPerSecond = void 0, this.uploadSpeedSamples.delete(n), i.abortController = new AbortController(), i.updatedAt = this.timestamp(), this.persistAndNotify(), this.pumpUploadQueue(), Promise.resolve()) : Promise.resolve();
|
|
645
660
|
}
|
|
646
661
|
pauseUpload(e) {
|
|
647
662
|
let t = this.uploads.get(e);
|
|
648
|
-
t && (t.
|
|
663
|
+
t && (t.status = "paused", t.abortController?.abort(), this.uploadSpeedSamples.delete(e), t.updatedAt = this.timestamp(), this.persistAndNotify(), this.pumpUploadQueue());
|
|
649
664
|
}
|
|
650
665
|
async cancelUpload(e) {
|
|
651
666
|
let t = this.uploads.get(e);
|
|
652
|
-
t && (t.
|
|
667
|
+
t && (t.status = "cancelled", t.abortController?.abort(), this.uploadSpeedSamples.delete(e), t.updatedAt = this.timestamp(), this.persistAndNotify(), this.pumpUploadQueue(), t.uploadId && t.adapter?.abortMultipartUpload && await t.adapter.abortMultipartUpload(t.uploadId));
|
|
653
668
|
}
|
|
654
669
|
async waitForIdle() {
|
|
655
670
|
for (; this.activeTasks.size > 0;) await Promise.allSettled(Array.from(this.activeTasks));
|
|
656
671
|
}
|
|
657
|
-
async prepareBulkDownload({ adapter: e, paths: t, selectedBytes: n, warnZipSizeBytes: r = Infinity }) {
|
|
658
|
-
let
|
|
659
|
-
id:
|
|
672
|
+
async prepareBulkDownload({ adapter: e, paths: t, selectedBytes: n, warnZipSizeBytes: r = Infinity, allowClientZipFallback: i = !0 }) {
|
|
673
|
+
let a = this.idFactory(), o = this.timestamp(), s = {
|
|
674
|
+
id: a,
|
|
660
675
|
kind: "bulk-download",
|
|
661
676
|
status: "preparing",
|
|
662
677
|
strategy: e.bulkDownloadUrl ? "server" : "client",
|
|
663
678
|
adapter: e,
|
|
664
679
|
paths: [...t],
|
|
665
680
|
selectedBytes: n,
|
|
666
|
-
createdAt:
|
|
667
|
-
updatedAt:
|
|
681
|
+
createdAt: o,
|
|
682
|
+
updatedAt: o
|
|
668
683
|
};
|
|
669
|
-
this.downloads.set(
|
|
684
|
+
this.downloads.set(a, s), this.persistAndNotify();
|
|
670
685
|
try {
|
|
671
686
|
if (e.bulkDownloadUrl) {
|
|
672
687
|
let n = await e.bulkDownloadUrl(t);
|
|
673
|
-
|
|
674
|
-
} else n > r ? (
|
|
688
|
+
s.status = "ready", s.url = n.url, s.expiresAt = n.expiresAt;
|
|
689
|
+
} else if (i) n > r ? (s.status = "warning", s.warning = "client_zip_size") : (s.url = await Be(e, t), s.status = "ready");
|
|
690
|
+
else throw Error("Client-side ZIP fallback is disabled.");
|
|
675
691
|
} catch (e) {
|
|
676
|
-
|
|
692
|
+
s.status = "failed", s.error = ze(e);
|
|
677
693
|
}
|
|
678
|
-
return
|
|
694
|
+
return s.updatedAt = this.timestamp(), this.persistAndNotify(), K(s);
|
|
679
695
|
}
|
|
680
696
|
async prepareSingleDownload({ adapter: e, path: t, selectedBytes: n = 0 }) {
|
|
681
697
|
let r = this.idFactory(), i = this.timestamp(), a = {
|
|
@@ -693,7 +709,7 @@ var Ee = "react-file-browser-transfers", De = 1440 * 60 * 1e3, W = class {
|
|
|
693
709
|
try {
|
|
694
710
|
a.url = await e.signedUrl(t), a.status = "ready";
|
|
695
711
|
} catch (e) {
|
|
696
|
-
a.status = "failed", a.error =
|
|
712
|
+
a.status = "failed", a.error = ze(e);
|
|
697
713
|
}
|
|
698
714
|
return a.updatedAt = this.timestamp(), this.persistAndNotify(), K(a);
|
|
699
715
|
}
|
|
@@ -704,26 +720,30 @@ var Ee = "react-file-browser-transfers", De = 1440 * 60 * 1e3, W = class {
|
|
|
704
720
|
if (!t.adapter) return t.status = "failed", t.error = "This download can no longer continue in the current session.", t.updatedAt = this.timestamp(), this.persistAndNotify(), K(t);
|
|
705
721
|
t.status = "preparing", t.warning = void 0, t.updatedAt = this.timestamp(), this.persistAndNotify();
|
|
706
722
|
try {
|
|
707
|
-
t.url = await
|
|
723
|
+
t.url = await Be(t.adapter, t.paths), t.status = "ready";
|
|
708
724
|
} catch (e) {
|
|
709
|
-
t.status = "failed", t.error =
|
|
725
|
+
t.status = "failed", t.error = ze(e);
|
|
710
726
|
}
|
|
711
727
|
return t.updatedAt = this.timestamp(), this.persistAndNotify(), K(t);
|
|
712
728
|
}
|
|
713
729
|
}
|
|
714
730
|
async runUpload(e) {
|
|
715
731
|
let t = this.uploads.get(e);
|
|
716
|
-
if (!(!t?.adapter || !t.file)) {
|
|
732
|
+
if (!(!t?.adapter || !t.file || t.status !== "queued")) {
|
|
717
733
|
t.status = "uploading", t.updatedAt = this.timestamp(), this.persistAndNotify();
|
|
718
734
|
try {
|
|
719
735
|
let e = Oe(t.adapter) ? await this.runMultipartUpload(t) : await this.runSimpleUpload(t);
|
|
736
|
+
if (["paused", "cancelled"].includes(t.status)) {
|
|
737
|
+
this.uploadSpeedSamples.delete(t.id), this.persistAndNotify();
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
720
740
|
t.status = "completed", t.loadedBytes = t.totalBytes, t.result = e, this.uploadSpeedSamples.delete(t.id), t.updatedAt = this.timestamp(), this.persistAndNotify();
|
|
721
741
|
} catch (e) {
|
|
722
742
|
if (["paused", "cancelled"].includes(t.status)) {
|
|
723
743
|
this.uploadSpeedSamples.delete(t.id), this.persistAndNotify();
|
|
724
744
|
return;
|
|
725
745
|
}
|
|
726
|
-
t.status = "failed", t.error =
|
|
746
|
+
t.status = "failed", t.error = ze(e), this.uploadSpeedSamples.delete(t.id), t.updatedAt = this.timestamp(), this.persistAndNotify();
|
|
727
747
|
}
|
|
728
748
|
}
|
|
729
749
|
}
|
|
@@ -741,7 +761,7 @@ var Ee = "react-file-browser-transfers", De = 1440 * 60 * 1e3, W = class {
|
|
|
741
761
|
let t = e.adapter, n = e.file;
|
|
742
762
|
if (!t || !n || !Oe(t)) throw Error("Multipart upload is not available");
|
|
743
763
|
if (!e.uploadId || !e.partSize) {
|
|
744
|
-
await
|
|
764
|
+
await Ae(e);
|
|
745
765
|
let r = await t.createMultipartUpload(e.path, n.size);
|
|
746
766
|
e.uploadId = r.uploadId, e.partSize = r.partSize, e.updatedAt = this.timestamp(), this.persistAndNotify();
|
|
747
767
|
}
|
|
@@ -774,10 +794,18 @@ var Ee = "react-file-browser-transfers", De = 1440 * 60 * 1e3, W = class {
|
|
|
774
794
|
timeMs: i
|
|
775
795
|
}), e.updatedAt = r.toISOString(), this.persistAndNotify();
|
|
776
796
|
}
|
|
777
|
-
|
|
778
|
-
this.
|
|
779
|
-
this.
|
|
780
|
-
|
|
797
|
+
pumpUploadQueue() {
|
|
798
|
+
for (; this.runningUploadIds.size < this.maxConcurrentUploads;) {
|
|
799
|
+
let e = Array.from(this.uploads.values()).find((e) => e.status === "queued" && !!e.adapter && !!e.file && !this.runningUploadIds.has(e.id));
|
|
800
|
+
if (!e) return;
|
|
801
|
+
this.runningUploadIds.add(e.id);
|
|
802
|
+
let t = this.runUpload(e.id);
|
|
803
|
+
this.activeTasks.add(t);
|
|
804
|
+
let n = () => {
|
|
805
|
+
this.activeTasks.delete(t), this.runningUploadIds.delete(e.id), this.pumpUploadQueue();
|
|
806
|
+
};
|
|
807
|
+
t.then(n, n);
|
|
808
|
+
}
|
|
781
809
|
}
|
|
782
810
|
persistAndNotify() {
|
|
783
811
|
this.snapshotCache = void 0, this.persist();
|
|
@@ -786,13 +814,8 @@ var Ee = "react-file-browser-transfers", De = 1440 * 60 * 1e3, W = class {
|
|
|
786
814
|
persist() {
|
|
787
815
|
if (!this.storage) return;
|
|
788
816
|
let e = {
|
|
789
|
-
uploads: Array.from(this.uploads.values()).map(
|
|
790
|
-
|
|
791
|
-
file: void 0,
|
|
792
|
-
adapter: void 0,
|
|
793
|
-
abortController: void 0
|
|
794
|
-
})),
|
|
795
|
-
downloads: Array.from(this.downloads.values()).map(K)
|
|
817
|
+
uploads: Array.from(this.uploads.values()).map(Me),
|
|
818
|
+
downloads: Array.from(this.downloads.values()).map(Pe)
|
|
796
819
|
};
|
|
797
820
|
this.storage.setItem(this.storageKey, JSON.stringify(e));
|
|
798
821
|
}
|
|
@@ -801,13 +824,14 @@ var Ee = "react-file-browser-transfers", De = 1440 * 60 * 1e3, W = class {
|
|
|
801
824
|
let e = this.storage.getItem(this.storageKey);
|
|
802
825
|
if (e) try {
|
|
803
826
|
let t = JSON.parse(e);
|
|
804
|
-
for (let e of t.uploads ?? [])
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
827
|
+
for (let e of t.uploads ?? []) {
|
|
828
|
+
let t = Ne(e);
|
|
829
|
+
this.uploads.set(t.id, t);
|
|
830
|
+
}
|
|
831
|
+
for (let e of t.downloads ?? []) {
|
|
832
|
+
let t = Fe(e);
|
|
833
|
+
this.downloads.set(t.id, t);
|
|
834
|
+
}
|
|
811
835
|
} catch {
|
|
812
836
|
this.storage.removeItem(this.storageKey);
|
|
813
837
|
}
|
|
@@ -817,7 +841,7 @@ var Ee = "react-file-browser-transfers", De = 1440 * 60 * 1e3, W = class {
|
|
|
817
841
|
}
|
|
818
842
|
pruneExpiredDownloads() {
|
|
819
843
|
let e = this.now().getTime(), t = !1;
|
|
820
|
-
for (let [n, r] of this.downloads)
|
|
844
|
+
for (let [n, r] of this.downloads) Le(r, e) && (Re(r.url), this.downloads.delete(n), t = !0);
|
|
821
845
|
t && (this.snapshotCache = void 0, this.persist());
|
|
822
846
|
}
|
|
823
847
|
};
|
|
@@ -831,19 +855,19 @@ function ke(e) {
|
|
|
831
855
|
return n + Math.min(t, e.totalBytes - i);
|
|
832
856
|
}, 0);
|
|
833
857
|
}
|
|
834
|
-
async function
|
|
858
|
+
async function Ae(e) {
|
|
835
859
|
let n = e.adapter;
|
|
836
860
|
if (!n?.exists) return;
|
|
837
861
|
let r = (e) => n.exists?.(e) ?? Promise.resolve({});
|
|
838
862
|
if ((await r([e.path]))[e.path]) {
|
|
839
863
|
if (e.onConflict === "keep-both") {
|
|
840
|
-
e.path = await
|
|
864
|
+
e.path = await G(r, e.path);
|
|
841
865
|
return;
|
|
842
866
|
}
|
|
843
867
|
if (e.onConflict !== "replace") throw new t("conflict", `A file browser entry already exists at ${e.path}`);
|
|
844
868
|
}
|
|
845
869
|
}
|
|
846
|
-
async function
|
|
870
|
+
async function G(n, r) {
|
|
847
871
|
let a = o(r), s = i(r), c = s.lastIndexOf("."), l = c > 0, u = l ? s.slice(0, c) : s, d = l ? s.slice(c) : "";
|
|
848
872
|
for (let t = 1; t < 2 ** 53 - 1; t += 1) {
|
|
849
873
|
let r = e(a, `${u} (${t})${d}`);
|
|
@@ -865,26 +889,90 @@ function K(e) {
|
|
|
865
889
|
paths: [...e.paths]
|
|
866
890
|
};
|
|
867
891
|
}
|
|
868
|
-
function Me(e
|
|
892
|
+
function Me(e) {
|
|
893
|
+
return {
|
|
894
|
+
id: e.id,
|
|
895
|
+
kind: e.kind,
|
|
896
|
+
status: e.status,
|
|
897
|
+
path: e.path,
|
|
898
|
+
name: e.name,
|
|
899
|
+
loadedBytes: e.loadedBytes,
|
|
900
|
+
totalBytes: e.totalBytes,
|
|
901
|
+
bytesPerSecond: e.bytesPerSecond,
|
|
902
|
+
completedParts: e.completedParts.map((e) => ({ ...e })),
|
|
903
|
+
createdAt: e.createdAt,
|
|
904
|
+
updatedAt: e.updatedAt,
|
|
905
|
+
error: e.error,
|
|
906
|
+
uploadId: e.uploadId,
|
|
907
|
+
partSize: e.partSize,
|
|
908
|
+
onConflict: e.onConflict,
|
|
909
|
+
group: e.group ? { ...e.group } : void 0
|
|
910
|
+
};
|
|
911
|
+
}
|
|
912
|
+
function Ne(e) {
|
|
913
|
+
return {
|
|
914
|
+
id: e.id,
|
|
915
|
+
kind: "upload",
|
|
916
|
+
status: e.status,
|
|
917
|
+
path: e.path,
|
|
918
|
+
name: e.name,
|
|
919
|
+
loadedBytes: e.loadedBytes,
|
|
920
|
+
totalBytes: e.totalBytes,
|
|
921
|
+
bytesPerSecond: e.bytesPerSecond,
|
|
922
|
+
completedParts: e.completedParts.map((e) => ({ ...e })),
|
|
923
|
+
createdAt: e.createdAt,
|
|
924
|
+
updatedAt: e.updatedAt,
|
|
925
|
+
error: e.error,
|
|
926
|
+
uploadId: e.uploadId,
|
|
927
|
+
partSize: e.partSize,
|
|
928
|
+
onConflict: e.onConflict,
|
|
929
|
+
group: e.group ? { ...e.group } : void 0
|
|
930
|
+
};
|
|
931
|
+
}
|
|
932
|
+
function Pe(e) {
|
|
933
|
+
return {
|
|
934
|
+
id: e.id,
|
|
935
|
+
kind: e.kind,
|
|
936
|
+
status: e.status,
|
|
937
|
+
strategy: e.strategy,
|
|
938
|
+
paths: [...e.paths],
|
|
939
|
+
selectedBytes: e.selectedBytes,
|
|
940
|
+
createdAt: e.createdAt,
|
|
941
|
+
updatedAt: e.updatedAt,
|
|
942
|
+
url: e.url,
|
|
943
|
+
expiresAt: e.expiresAt,
|
|
944
|
+
warning: e.warning,
|
|
945
|
+
error: e.error
|
|
946
|
+
};
|
|
947
|
+
}
|
|
948
|
+
function Fe(e) {
|
|
949
|
+
return Pe(e);
|
|
950
|
+
}
|
|
951
|
+
function Ie(e) {
|
|
952
|
+
if (e === void 0) return Infinity;
|
|
953
|
+
if (!Number.isInteger(e) || e < 1) throw RangeError("maxConcurrentUploads must be a positive integer");
|
|
954
|
+
return e;
|
|
955
|
+
}
|
|
956
|
+
function Le(e, t) {
|
|
869
957
|
if (e.status === "preparing") return !1;
|
|
870
958
|
if (e.expiresAt) {
|
|
871
959
|
let n = Date.parse(e.expiresAt);
|
|
872
960
|
if (Number.isFinite(n) && n <= t) return !0;
|
|
873
961
|
}
|
|
874
962
|
let n = Date.parse(e.updatedAt);
|
|
875
|
-
return Number.isFinite(n) && t - n >
|
|
963
|
+
return Number.isFinite(n) && t - n > Ee;
|
|
876
964
|
}
|
|
877
|
-
function
|
|
965
|
+
function Re(e) {
|
|
878
966
|
!e?.startsWith("blob:") || typeof URL > "u" || typeof URL.revokeObjectURL != "function" || URL.revokeObjectURL(e);
|
|
879
967
|
}
|
|
880
|
-
function
|
|
968
|
+
function q() {
|
|
881
969
|
return `transfer-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
|
882
970
|
}
|
|
883
|
-
function
|
|
971
|
+
function ze(e) {
|
|
884
972
|
return e instanceof Error ? e.message : String(e);
|
|
885
973
|
}
|
|
886
|
-
async function
|
|
887
|
-
let n = await
|
|
974
|
+
async function Be(e, t) {
|
|
975
|
+
let n = await J(e, t), r = {};
|
|
888
976
|
for (let t of n) {
|
|
889
977
|
let n = await e.signedUrl(t.path), i = await fetch(n);
|
|
890
978
|
if (!i.ok) throw Error(`Could not fetch ${t.path} for the client zip`);
|
|
@@ -893,52 +981,52 @@ async function Ie(e, t) {
|
|
|
893
981
|
let i = d(r);
|
|
894
982
|
return URL.createObjectURL(new Blob([i], { type: "application/zip" }));
|
|
895
983
|
}
|
|
896
|
-
async function
|
|
984
|
+
async function J(e, t) {
|
|
897
985
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
898
|
-
for (let i of t) await
|
|
986
|
+
for (let i of t) await Ve(e, i, n, r);
|
|
899
987
|
return n;
|
|
900
988
|
}
|
|
901
|
-
async function
|
|
989
|
+
async function Ve(e, t, n, r) {
|
|
902
990
|
if (r.has(t)) return;
|
|
903
991
|
r.add(t);
|
|
904
|
-
let i = await
|
|
992
|
+
let i = await Ue(e, t);
|
|
905
993
|
if (i?.kind === "file") {
|
|
906
994
|
n.push({
|
|
907
995
|
path: t,
|
|
908
|
-
archivePath:
|
|
996
|
+
archivePath: Ge(t)
|
|
909
997
|
});
|
|
910
998
|
return;
|
|
911
999
|
}
|
|
912
1000
|
if (i?.kind === "folder") {
|
|
913
|
-
await
|
|
1001
|
+
await He(e, t, n, r);
|
|
914
1002
|
return;
|
|
915
1003
|
}
|
|
916
|
-
let a = await
|
|
1004
|
+
let a = await We(e, t);
|
|
917
1005
|
if (a) {
|
|
918
|
-
for (let t of a) await
|
|
1006
|
+
for (let t of a) await Ve(e, t.path, n, r);
|
|
919
1007
|
return;
|
|
920
1008
|
}
|
|
921
1009
|
n.push({
|
|
922
1010
|
path: t,
|
|
923
|
-
archivePath:
|
|
1011
|
+
archivePath: Ge(t)
|
|
924
1012
|
});
|
|
925
1013
|
}
|
|
926
|
-
async function
|
|
1014
|
+
async function He(e, t, n, r) {
|
|
927
1015
|
let i;
|
|
928
1016
|
do {
|
|
929
1017
|
let a = await e.list(t, { cursor: i });
|
|
930
|
-
for (let t of a.items) await
|
|
1018
|
+
for (let t of a.items) await Ve(e, t.path, n, r);
|
|
931
1019
|
i = a.cursor;
|
|
932
1020
|
} while (i);
|
|
933
1021
|
}
|
|
934
|
-
async function
|
|
1022
|
+
async function Ue(e, t) {
|
|
935
1023
|
if (e.stat) try {
|
|
936
1024
|
return await e.stat(t);
|
|
937
1025
|
} catch {
|
|
938
1026
|
return;
|
|
939
1027
|
}
|
|
940
1028
|
}
|
|
941
|
-
async function
|
|
1029
|
+
async function We(e, t) {
|
|
942
1030
|
try {
|
|
943
1031
|
let n, r = [];
|
|
944
1032
|
do {
|
|
@@ -950,62 +1038,62 @@ async function ze(e, t) {
|
|
|
950
1038
|
return;
|
|
951
1039
|
}
|
|
952
1040
|
}
|
|
953
|
-
function
|
|
1041
|
+
function Ge(e) {
|
|
954
1042
|
return e.replace(/^\/+/, "") || "download";
|
|
955
1043
|
}
|
|
956
1044
|
//#endregion
|
|
957
1045
|
//#region src/transfers/file-browser-provider.tsx
|
|
958
|
-
var
|
|
959
|
-
function
|
|
960
|
-
let a =
|
|
961
|
-
|
|
962
|
-
async function
|
|
1046
|
+
var Ke = f(null), qe = "transition-[background-color,border-color,color,box-shadow,opacity] duration-150 ease-out motion-reduce:transition-none", Je = "transition-[background-color,border-color,box-shadow,opacity] duration-200 ease-out motion-reduce:transition-none";
|
|
1047
|
+
function Ye({ children: e, manager: t, options: n, resolveRestoredUpload: r, showFloatingWidget: i = !0 }) {
|
|
1048
|
+
let [a] = b(() => t ?? new De(et(n))), o = t ?? a, s = Qe(o), [c, l] = b(!1), u = o.getRestorableUploads();
|
|
1049
|
+
$e(o);
|
|
1050
|
+
async function d(e) {
|
|
963
1051
|
for (let t of e) {
|
|
964
1052
|
if (t.adapter && t.file) {
|
|
965
|
-
await
|
|
1053
|
+
await o.resumeUpload(t.id);
|
|
966
1054
|
continue;
|
|
967
1055
|
}
|
|
968
1056
|
let e = await r?.(t);
|
|
969
|
-
e && await
|
|
1057
|
+
e && await o.resumeRestoredUpload({
|
|
970
1058
|
id: t.id,
|
|
971
1059
|
...e
|
|
972
1060
|
});
|
|
973
1061
|
}
|
|
974
|
-
|
|
1062
|
+
l(!0);
|
|
975
1063
|
}
|
|
976
|
-
return /* @__PURE__ */ E(
|
|
977
|
-
value:
|
|
1064
|
+
return /* @__PURE__ */ E(Ke.Provider, {
|
|
1065
|
+
value: o,
|
|
978
1066
|
children: [
|
|
979
1067
|
e,
|
|
980
|
-
i ? /* @__PURE__ */ T(
|
|
981
|
-
manager:
|
|
982
|
-
snapshot:
|
|
1068
|
+
i ? /* @__PURE__ */ T(tt, {
|
|
1069
|
+
manager: o,
|
|
1070
|
+
snapshot: s
|
|
983
1071
|
}) : null,
|
|
984
|
-
!
|
|
985
|
-
count:
|
|
1072
|
+
!c && u.length > 0 ? /* @__PURE__ */ T(rt, {
|
|
1073
|
+
count: u.length,
|
|
986
1074
|
onDismiss: () => {
|
|
987
|
-
|
|
1075
|
+
o.dismissRestoredUploads(u.map((e) => e.id)), l(!0);
|
|
988
1076
|
},
|
|
989
1077
|
onResume: () => {
|
|
990
|
-
u
|
|
1078
|
+
d(u);
|
|
991
1079
|
}
|
|
992
1080
|
}) : null
|
|
993
1081
|
]
|
|
994
1082
|
});
|
|
995
1083
|
}
|
|
996
|
-
function
|
|
997
|
-
return g(
|
|
1084
|
+
function Xe() {
|
|
1085
|
+
return g(Ke) ?? it;
|
|
998
1086
|
}
|
|
999
|
-
function
|
|
1000
|
-
return
|
|
1087
|
+
function Ze() {
|
|
1088
|
+
return Qe(Xe());
|
|
1001
1089
|
}
|
|
1002
|
-
function
|
|
1090
|
+
function Qe(e) {
|
|
1003
1091
|
return x((t) => e.subscribe(t), () => e.getSnapshot(), () => ({
|
|
1004
1092
|
uploads: [],
|
|
1005
1093
|
downloads: []
|
|
1006
1094
|
}));
|
|
1007
1095
|
}
|
|
1008
|
-
function
|
|
1096
|
+
function $e(e) {
|
|
1009
1097
|
_(() => {
|
|
1010
1098
|
let t = (t) => {
|
|
1011
1099
|
e.hasActiveTransfers() && (t.preventDefault(), t.returnValue = "");
|
|
@@ -1013,16 +1101,16 @@ function qe(e) {
|
|
|
1013
1101
|
return window.addEventListener("beforeunload", t), () => window.removeEventListener("beforeunload", t);
|
|
1014
1102
|
}, [e]);
|
|
1015
1103
|
}
|
|
1016
|
-
function
|
|
1017
|
-
if (e?.storage) return e;
|
|
1104
|
+
function et(e) {
|
|
1105
|
+
if (e?.storage !== void 0) return e;
|
|
1018
1106
|
let t = typeof window > "u" ? void 0 : window.localStorage;
|
|
1019
1107
|
return t ? {
|
|
1020
1108
|
...e,
|
|
1021
1109
|
storage: t
|
|
1022
1110
|
} : e ?? {};
|
|
1023
1111
|
}
|
|
1024
|
-
function
|
|
1025
|
-
let n = t.uploads.filter(
|
|
1112
|
+
function tt({ manager: e, snapshot: t }) {
|
|
1113
|
+
let n = t.uploads.filter(ct), r = lt(t.uploads), i = new Set(r.flatMap((e) => e.activeUploads.map((e) => e.id))), a = n.filter((e) => !i.has(e.id)), o = t.downloads.filter((e) => [
|
|
1026
1114
|
"preparing",
|
|
1027
1115
|
"warning",
|
|
1028
1116
|
"ready",
|
|
@@ -1030,7 +1118,7 @@ function Ye({ manager: e, snapshot: t }) {
|
|
|
1030
1118
|
].includes(e.status));
|
|
1031
1119
|
return n.length === 0 && o.length === 0 ? null : C(/* @__PURE__ */ E("aside", {
|
|
1032
1120
|
"aria-label": "Transfers",
|
|
1033
|
-
className: `fixed bottom-4 right-4 z-50 w-[min(360px,calc(100vw-2rem))] rounded-[var(--fb-radius)] border border-[var(--fb-border)] bg-[var(--fb-surface)] p-3 text-[12px] text-[var(--fb-text)] shadow-[0_16px_44px_color-mix(in_oklch,var(--fb-text)_16%,transparent)] ${
|
|
1121
|
+
className: `fixed bottom-4 right-4 z-50 w-[min(360px,calc(100vw-2rem))] rounded-[var(--fb-radius)] border border-[var(--fb-border)] bg-[var(--fb-surface)] p-3 text-[12px] text-[var(--fb-text)] shadow-[0_16px_44px_color-mix(in_oklch,var(--fb-text)_16%,transparent)] ${Je}`,
|
|
1034
1122
|
children: [/* @__PURE__ */ E("div", {
|
|
1035
1123
|
className: "mb-2 flex items-center justify-between gap-2",
|
|
1036
1124
|
children: [/* @__PURE__ */ T("div", {
|
|
@@ -1043,11 +1131,11 @@ function Ye({ manager: e, snapshot: t }) {
|
|
|
1043
1131
|
}), /* @__PURE__ */ E("div", {
|
|
1044
1132
|
className: "flex flex-col gap-2",
|
|
1045
1133
|
children: [
|
|
1046
|
-
r.map((t) => /* @__PURE__ */ T(
|
|
1134
|
+
r.map((t) => /* @__PURE__ */ T(nt, {
|
|
1047
1135
|
group: t,
|
|
1048
1136
|
manager: e
|
|
1049
1137
|
}, t.group.id)),
|
|
1050
|
-
a.map((t) => /* @__PURE__ */ T(
|
|
1138
|
+
a.map((t) => /* @__PURE__ */ T(Y, {
|
|
1051
1139
|
manager: e,
|
|
1052
1140
|
upload: t
|
|
1053
1141
|
}, t.id)),
|
|
@@ -1058,23 +1146,23 @@ function Ye({ manager: e, snapshot: t }) {
|
|
|
1058
1146
|
className: "flex items-center justify-between gap-2",
|
|
1059
1147
|
children: [/* @__PURE__ */ E("a", {
|
|
1060
1148
|
"aria-label": "Open prepared download",
|
|
1061
|
-
className: `inline-flex min-w-0 items-center gap-1 rounded-[calc(var(--fb-radius)-4px)] px-1.5 py-1 font-medium text-[var(--fb-accent)] hover:bg-[var(--fb-accent-soft)] ${
|
|
1149
|
+
className: `inline-flex min-w-0 items-center gap-1 rounded-[calc(var(--fb-radius)-4px)] px-1.5 py-1 font-medium text-[var(--fb-accent)] hover:bg-[var(--fb-accent-soft)] ${qe}`,
|
|
1062
1150
|
download: !0,
|
|
1063
1151
|
href: t.url,
|
|
1064
1152
|
onClick: () => e.dismissDownload(t.id),
|
|
1065
|
-
children: [/* @__PURE__ */ T(
|
|
1153
|
+
children: [/* @__PURE__ */ T(I, {
|
|
1066
1154
|
"aria-hidden": "true",
|
|
1067
1155
|
className: "size-3.5 shrink-0"
|
|
1068
1156
|
}), /* @__PURE__ */ T("span", {
|
|
1069
1157
|
className: "truncate",
|
|
1070
|
-
children:
|
|
1158
|
+
children: pt(t)
|
|
1071
1159
|
})]
|
|
1072
1160
|
}), /* @__PURE__ */ T("button", {
|
|
1073
1161
|
"aria-label": "Dismiss download",
|
|
1074
|
-
className:
|
|
1162
|
+
className: at(),
|
|
1075
1163
|
onClick: () => e.dismissDownload(t.id),
|
|
1076
1164
|
type: "button",
|
|
1077
|
-
children: /* @__PURE__ */ T(
|
|
1165
|
+
children: /* @__PURE__ */ T(W, {
|
|
1078
1166
|
"aria-hidden": "true",
|
|
1079
1167
|
className: "size-3.5"
|
|
1080
1168
|
})
|
|
@@ -1083,7 +1171,7 @@ function Ye({ manager: e, snapshot: t }) {
|
|
|
1083
1171
|
t.status === "warning" ? /* @__PURE__ */ E("div", {
|
|
1084
1172
|
className: "flex items-center justify-between gap-2",
|
|
1085
1173
|
children: [/* @__PURE__ */ T("span", { children: "Large client zip" }), /* @__PURE__ */ T("button", {
|
|
1086
|
-
className:
|
|
1174
|
+
className: ot(),
|
|
1087
1175
|
onClick: () => void e.confirmBulkDownload(t.id),
|
|
1088
1176
|
type: "button",
|
|
1089
1177
|
children: "Continue"
|
|
@@ -1100,9 +1188,9 @@ function Ye({ manager: e, snapshot: t }) {
|
|
|
1100
1188
|
})]
|
|
1101
1189
|
}), document.body);
|
|
1102
1190
|
}
|
|
1103
|
-
function
|
|
1191
|
+
function nt({ group: e, manager: t }) {
|
|
1104
1192
|
return /* @__PURE__ */ E("div", {
|
|
1105
|
-
className:
|
|
1193
|
+
className: Je,
|
|
1106
1194
|
children: [/* @__PURE__ */ E("div", {
|
|
1107
1195
|
className: "flex items-center justify-between gap-2",
|
|
1108
1196
|
children: [/* @__PURE__ */ E("div", {
|
|
@@ -1112,24 +1200,24 @@ function Xe({ group: e, manager: t }) {
|
|
|
1112
1200
|
children: ["Uploading ", e.group.name]
|
|
1113
1201
|
}), /* @__PURE__ */ T("div", {
|
|
1114
1202
|
className: "text-[11px] text-[var(--fb-muted)]",
|
|
1115
|
-
children:
|
|
1203
|
+
children: ut(e)
|
|
1116
1204
|
})]
|
|
1117
1205
|
}), /* @__PURE__ */ T("button", {
|
|
1118
1206
|
"aria-label": `Cancel upload group ${e.group.name}`,
|
|
1119
|
-
className:
|
|
1207
|
+
className: at(),
|
|
1120
1208
|
onClick: () => {
|
|
1121
1209
|
for (let n of e.activeUploads) t.cancelUpload(n.id);
|
|
1122
1210
|
},
|
|
1123
1211
|
title: "Cancel",
|
|
1124
1212
|
type: "button",
|
|
1125
|
-
children: /* @__PURE__ */ T(
|
|
1213
|
+
children: /* @__PURE__ */ T(W, {
|
|
1126
1214
|
"aria-hidden": "true",
|
|
1127
1215
|
className: "size-3.5"
|
|
1128
1216
|
})
|
|
1129
1217
|
})]
|
|
1130
1218
|
}), /* @__PURE__ */ T("div", {
|
|
1131
|
-
className: `mt-2 flex flex-col gap-1.5 border-l border-[var(--fb-border)] pl-3 ${
|
|
1132
|
-
children: e.activeUploads.map((e) => /* @__PURE__ */ T(
|
|
1219
|
+
className: `mt-2 flex flex-col gap-1.5 border-l border-[var(--fb-border)] pl-3 ${Je}`,
|
|
1220
|
+
children: e.activeUploads.map((e) => /* @__PURE__ */ T(Y, {
|
|
1133
1221
|
compact: !0,
|
|
1134
1222
|
manager: t,
|
|
1135
1223
|
upload: e
|
|
@@ -1137,9 +1225,9 @@ function Xe({ group: e, manager: t }) {
|
|
|
1137
1225
|
})]
|
|
1138
1226
|
});
|
|
1139
1227
|
}
|
|
1140
|
-
function
|
|
1228
|
+
function Y({ compact: e = !1, manager: t, upload: n }) {
|
|
1141
1229
|
return /* @__PURE__ */ E("div", {
|
|
1142
|
-
className:
|
|
1230
|
+
className: Je,
|
|
1143
1231
|
children: [/* @__PURE__ */ E("div", {
|
|
1144
1232
|
className: "flex items-center justify-between gap-2",
|
|
1145
1233
|
children: [/* @__PURE__ */ E("div", {
|
|
@@ -1149,25 +1237,25 @@ function Ze({ compact: e = !1, manager: t, upload: n }) {
|
|
|
1149
1237
|
children: n.name
|
|
1150
1238
|
}), /* @__PURE__ */ T("span", {
|
|
1151
1239
|
className: "text-[11px] text-[var(--fb-muted)]",
|
|
1152
|
-
children:
|
|
1240
|
+
children: dt(n)
|
|
1153
1241
|
})]
|
|
1154
1242
|
}), /* @__PURE__ */ E("div", {
|
|
1155
1243
|
className: "flex shrink-0 items-center gap-1",
|
|
1156
1244
|
children: [
|
|
1157
1245
|
["queued", "uploading"].includes(n.status) ? /* @__PURE__ */ T("button", {
|
|
1158
1246
|
"aria-label": `Pause upload ${n.name}`,
|
|
1159
|
-
className:
|
|
1247
|
+
className: at(),
|
|
1160
1248
|
onClick: () => t.pauseUpload(n.id),
|
|
1161
1249
|
title: "Pause",
|
|
1162
1250
|
type: "button",
|
|
1163
|
-
children: /* @__PURE__ */ T(
|
|
1251
|
+
children: /* @__PURE__ */ T(R, {
|
|
1164
1252
|
"aria-hidden": "true",
|
|
1165
1253
|
className: "size-3.5"
|
|
1166
1254
|
})
|
|
1167
1255
|
}) : null,
|
|
1168
1256
|
["failed", "paused"].includes(n.status) ? /* @__PURE__ */ T("button", {
|
|
1169
1257
|
"aria-label": `Resume upload ${n.name}`,
|
|
1170
|
-
className:
|
|
1258
|
+
className: at(),
|
|
1171
1259
|
onClick: () => void t.resumeUpload(n.id),
|
|
1172
1260
|
title: "Resume",
|
|
1173
1261
|
type: "button",
|
|
@@ -1178,11 +1266,11 @@ function Ze({ compact: e = !1, manager: t, upload: n }) {
|
|
|
1178
1266
|
}) : null,
|
|
1179
1267
|
/* @__PURE__ */ T("button", {
|
|
1180
1268
|
"aria-label": `Cancel upload ${n.name}`,
|
|
1181
|
-
className:
|
|
1269
|
+
className: at(),
|
|
1182
1270
|
onClick: () => void t.cancelUpload(n.id),
|
|
1183
1271
|
title: "Cancel",
|
|
1184
1272
|
type: "button",
|
|
1185
|
-
children: /* @__PURE__ */ T(
|
|
1273
|
+
children: /* @__PURE__ */ T(W, {
|
|
1186
1274
|
"aria-hidden": "true",
|
|
1187
1275
|
className: "size-3.5"
|
|
1188
1276
|
})
|
|
@@ -1190,7 +1278,7 @@ function Ze({ compact: e = !1, manager: t, upload: n }) {
|
|
|
1190
1278
|
]
|
|
1191
1279
|
})]
|
|
1192
1280
|
}), /* @__PURE__ */ T("div", {
|
|
1193
|
-
className: `h-1.5 overflow-hidden rounded-full bg-[var(--fb-surface-2)] ${
|
|
1281
|
+
className: `h-1.5 overflow-hidden rounded-full bg-[var(--fb-surface-2)] ${Je} ${e ? "mt-1" : "mt-1.5"}`,
|
|
1194
1282
|
children: /* @__PURE__ */ T("div", {
|
|
1195
1283
|
className: "h-full rounded-full bg-[var(--fb-accent)] transition-[width] duration-300 ease-out motion-reduce:transition-none",
|
|
1196
1284
|
style: { width: `${Math.min(100, n.totalBytes ? n.loadedBytes / n.totalBytes * 100 : 0)}%` }
|
|
@@ -1198,14 +1286,14 @@ function Ze({ compact: e = !1, manager: t, upload: n }) {
|
|
|
1198
1286
|
})]
|
|
1199
1287
|
});
|
|
1200
1288
|
}
|
|
1201
|
-
function
|
|
1289
|
+
function rt({ count: e, onDismiss: t, onResume: n }) {
|
|
1202
1290
|
return C(/* @__PURE__ */ T("div", {
|
|
1203
1291
|
"aria-label": "Resume uploads",
|
|
1204
1292
|
"aria-modal": "true",
|
|
1205
|
-
className: `fixed inset-0 z-50 grid place-items-center bg-[color-mix(in_oklch,var(--fb-text)_20%,transparent)] p-4 text-[13px] text-[var(--fb-text)] ${
|
|
1293
|
+
className: `fixed inset-0 z-50 grid place-items-center bg-[color-mix(in_oklch,var(--fb-text)_20%,transparent)] p-4 text-[13px] text-[var(--fb-text)] ${Je}`,
|
|
1206
1294
|
role: "dialog",
|
|
1207
1295
|
children: /* @__PURE__ */ E("div", {
|
|
1208
|
-
className: `w-[min(380px,100%)] rounded-[var(--fb-radius)] border border-[var(--fb-border)] bg-[var(--fb-surface)] p-4 shadow-[0_18px_50px_color-mix(in_oklch,var(--fb-text)_18%,transparent)] ${
|
|
1296
|
+
className: `w-[min(380px,100%)] rounded-[var(--fb-radius)] border border-[var(--fb-border)] bg-[var(--fb-surface)] p-4 shadow-[0_18px_50px_color-mix(in_oklch,var(--fb-text)_18%,transparent)] ${Je}`,
|
|
1209
1297
|
children: [
|
|
1210
1298
|
/* @__PURE__ */ T("h2", {
|
|
1211
1299
|
className: "m-0 text-[14px] font-semibold",
|
|
@@ -1223,12 +1311,12 @@ function Qe({ count: e, onDismiss: t, onResume: n }) {
|
|
|
1223
1311
|
/* @__PURE__ */ E("div", {
|
|
1224
1312
|
className: "mt-4 flex justify-end gap-2",
|
|
1225
1313
|
children: [/* @__PURE__ */ T("button", {
|
|
1226
|
-
className:
|
|
1314
|
+
className: ot(),
|
|
1227
1315
|
onClick: t,
|
|
1228
1316
|
type: "button",
|
|
1229
1317
|
children: "Dismiss"
|
|
1230
1318
|
}), /* @__PURE__ */ T("button", {
|
|
1231
|
-
className:
|
|
1319
|
+
className: st(),
|
|
1232
1320
|
onClick: n,
|
|
1233
1321
|
type: "button",
|
|
1234
1322
|
children: "Resume uploads"
|
|
@@ -1238,17 +1326,17 @@ function Qe({ count: e, onDismiss: t, onResume: n }) {
|
|
|
1238
1326
|
})
|
|
1239
1327
|
}), document.body);
|
|
1240
1328
|
}
|
|
1241
|
-
var
|
|
1242
|
-
function
|
|
1243
|
-
return `grid size-7 place-items-center rounded-[calc(var(--fb-radius)-4px)] border border-[var(--fb-border)] bg-[var(--fb-surface)] text-[var(--fb-muted)] outline-none hover:bg-[var(--fb-bg)] focus:ring-2 focus:ring-[var(--fb-accent-soft)] ${
|
|
1329
|
+
var it = new De();
|
|
1330
|
+
function at() {
|
|
1331
|
+
return `grid size-7 place-items-center rounded-[calc(var(--fb-radius)-4px)] border border-[var(--fb-border)] bg-[var(--fb-surface)] text-[var(--fb-muted)] outline-none hover:bg-[var(--fb-bg)] focus:ring-2 focus:ring-[var(--fb-accent-soft)] ${qe}`;
|
|
1244
1332
|
}
|
|
1245
|
-
function
|
|
1246
|
-
return `inline-flex h-7 items-center rounded-[calc(var(--fb-radius)-4px)] border border-[var(--fb-border)] bg-[var(--fb-surface)] px-2 text-[11px] font-medium text-[var(--fb-text)] outline-none hover:bg-[var(--fb-bg)] focus:ring-2 focus:ring-[var(--fb-accent-soft)] ${
|
|
1333
|
+
function ot() {
|
|
1334
|
+
return `inline-flex h-7 items-center rounded-[calc(var(--fb-radius)-4px)] border border-[var(--fb-border)] bg-[var(--fb-surface)] px-2 text-[11px] font-medium text-[var(--fb-text)] outline-none hover:bg-[var(--fb-bg)] focus:ring-2 focus:ring-[var(--fb-accent-soft)] ${qe}`;
|
|
1247
1335
|
}
|
|
1248
|
-
function
|
|
1249
|
-
return `inline-flex h-7 items-center rounded-[calc(var(--fb-radius)-4px)] border border-[var(--fb-accent)] bg-[var(--fb-accent)] px-2 text-[11px] font-semibold text-[var(--fb-surface)] outline-none hover:opacity-90 focus:ring-2 focus:ring-[var(--fb-accent-soft)] ${
|
|
1336
|
+
function st() {
|
|
1337
|
+
return `inline-flex h-7 items-center rounded-[calc(var(--fb-radius)-4px)] border border-[var(--fb-accent)] bg-[var(--fb-accent)] px-2 text-[11px] font-semibold text-[var(--fb-surface)] outline-none hover:opacity-90 focus:ring-2 focus:ring-[var(--fb-accent-soft)] ${qe}`;
|
|
1250
1338
|
}
|
|
1251
|
-
function
|
|
1339
|
+
function ct(e) {
|
|
1252
1340
|
return [
|
|
1253
1341
|
"queued",
|
|
1254
1342
|
"uploading",
|
|
@@ -1256,7 +1344,7 @@ function rt(e) {
|
|
|
1256
1344
|
"paused"
|
|
1257
1345
|
].includes(e.status);
|
|
1258
1346
|
}
|
|
1259
|
-
function
|
|
1347
|
+
function lt(e) {
|
|
1260
1348
|
let t = /* @__PURE__ */ new Map();
|
|
1261
1349
|
for (let n of e) {
|
|
1262
1350
|
if (!n.group) continue;
|
|
@@ -1266,18 +1354,18 @@ function it(e) {
|
|
|
1266
1354
|
activeUploads: [],
|
|
1267
1355
|
completedCount: 0
|
|
1268
1356
|
};
|
|
1269
|
-
e.uploads.push(n), n.status === "completed" && (e.completedCount += 1),
|
|
1357
|
+
e.uploads.push(n), n.status === "completed" && (e.completedCount += 1), ct(n) && e.activeUploads.push(n), t.set(n.group.id, e);
|
|
1270
1358
|
}
|
|
1271
1359
|
return Array.from(t.values()).filter((e) => e.activeUploads.length > 0);
|
|
1272
1360
|
}
|
|
1273
|
-
function
|
|
1361
|
+
function ut(e) {
|
|
1274
1362
|
let t = e.group.createdFolders, n = `${e.completedCount} of ${e.group.totalFiles} files`;
|
|
1275
1363
|
return t <= 0 ? n : `${n}, ${t} folder${t === 1 ? "" : "s"} created`;
|
|
1276
1364
|
}
|
|
1277
|
-
function
|
|
1278
|
-
return e.status !== "uploading" || typeof e.bytesPerSecond != "number" || !Number.isFinite(e.bytesPerSecond) || e.bytesPerSecond <= 0 ? e.status : `${e.status}, ${
|
|
1365
|
+
function dt(e) {
|
|
1366
|
+
return e.status !== "uploading" || typeof e.bytesPerSecond != "number" || !Number.isFinite(e.bytesPerSecond) || e.bytesPerSecond <= 0 ? e.status : `${e.status}, ${ft(e.bytesPerSecond)}/s`;
|
|
1279
1367
|
}
|
|
1280
|
-
function
|
|
1368
|
+
function ft(e) {
|
|
1281
1369
|
let t = [
|
|
1282
1370
|
"B",
|
|
1283
1371
|
"KB",
|
|
@@ -1288,17 +1376,21 @@ function st(e) {
|
|
|
1288
1376
|
for (; n >= 1024 && r < t.length - 1;) n /= 1024, r += 1;
|
|
1289
1377
|
return `${r === 0 || n >= 10 ? Math.round(n).toString() : n.toFixed(1)} ${t[r]}`;
|
|
1290
1378
|
}
|
|
1291
|
-
function
|
|
1292
|
-
let t = e.expiresAt ?
|
|
1379
|
+
function pt(e) {
|
|
1380
|
+
let t = e.expiresAt ? mt(e.expiresAt) : void 0;
|
|
1293
1381
|
return t ? `Download ready, expires in ${t}` : "Download ready";
|
|
1294
1382
|
}
|
|
1295
|
-
function
|
|
1383
|
+
function mt(e) {
|
|
1296
1384
|
let t = Date.parse(e) - Date.now();
|
|
1297
1385
|
if (!(!Number.isFinite(t) || t <= 0)) return t < 3600 * 1e3 ? `${Math.ceil(t / (60 * 1e3))}m` : t < 1440 * 60 * 1e3 ? `${Math.ceil(t / (3600 * 1e3))}h` : `${Math.ceil(t / (1440 * 60 * 1e3))}d`;
|
|
1298
1386
|
}
|
|
1299
1387
|
//#endregion
|
|
1300
1388
|
//#region src/components/file-browser.tsx
|
|
1301
|
-
var
|
|
1389
|
+
var ht = "application/x.react-file-browser.paths", gt = 220, _t = 5e3, X = "transition-[background-color,border-color,color,box-shadow,opacity] duration-150 ease-out motion-reduce:transition-none", Z = "transition-[background-color,border-color,box-shadow,opacity] duration-200 ease-out motion-reduce:transition-none", vt = [
|
|
1390
|
+
"skip",
|
|
1391
|
+
"replace",
|
|
1392
|
+
"keep-both"
|
|
1393
|
+
], yt = {
|
|
1302
1394
|
comfortable: {
|
|
1303
1395
|
"--fb-font": "13px",
|
|
1304
1396
|
"--fb-control-h": "32px",
|
|
@@ -1328,256 +1420,271 @@ var ut = "application/x.react-file-browser.paths", dt = 220, ft = 5e3, X = "tran
|
|
|
1328
1420
|
"--fb-panel-pad": "12px"
|
|
1329
1421
|
}
|
|
1330
1422
|
};
|
|
1331
|
-
function
|
|
1332
|
-
let
|
|
1423
|
+
function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", path: s, onPathChange: c, rootLabel: l = "Files", searchQuery: u, initialSearchQuery: d, onSearchQueryChange: f, density: p = "comfortable", readOnly: m = !1, showDetailsPanel: g = !0, uploadPolicy: x, uploadConflictResolutions: S, allowClientZipFallback: C = !0, renderItemMeta: w, renderDetailsContent: te, warnZipSizeBytes: ne }) {
|
|
1424
|
+
let D = ee({
|
|
1333
1425
|
adapter: e,
|
|
1334
|
-
initialPath:
|
|
1335
|
-
|
|
1336
|
-
|
|
1426
|
+
initialPath: a,
|
|
1427
|
+
path: s,
|
|
1428
|
+
onPathChange: c,
|
|
1429
|
+
searchQuery: u,
|
|
1430
|
+
initialSearchQuery: d,
|
|
1431
|
+
onSearchQueryChange: f
|
|
1432
|
+
}), re = Xe(), ie = Ze(), [O, k] = b(!1), [ae, A] = b(""), [oe, j] = b(null), [M, N] = b(null), [se, P] = b(""), [F, I] = b(null), [L, R] = b(null), [z, B] = b(""), [me, V] = b(null), [H, U] = b(!1), [W, ye] = b(!1), [be, xe] = b(null), [Se, Ce] = b(s ?? a), [we, Te] = b([]), [Ee, De] = b("idle"), [Oe, ke] = b(null), [Ae, G] = b(null), [je, K] = b(null), [Me, Ne] = b([]), [Pe, Fe] = b(!1), [Ie, Le] = b(null), [Re, q] = b(!1), [ze, Be] = b(null), [J, Ve] = b(null), He = y(null), Ue = y(null), We = y([]), Ge = y(null), Ke = y(null), qe = y(null), Je = y(/* @__PURE__ */ new Set()), Ye = D.selectedItems.at(0) ?? null, Qe = v(() => on(S ?? vt), [S]), $e = D.capabilities.bulkDownload || C, et = cn(D.selectedItems, $e), tt = v(() => D.filteredItems.filter((e) => e.kind === "file"), [D.filteredItems]), nt = h(async (t) => {
|
|
1433
|
+
Ve({
|
|
1337
1434
|
item: t,
|
|
1338
1435
|
status: "loading"
|
|
1339
1436
|
});
|
|
1340
1437
|
try {
|
|
1341
1438
|
let n = await e.signedUrl(t.path);
|
|
1342
|
-
|
|
1439
|
+
Ve((e) => e?.item.path === t.path ? {
|
|
1343
1440
|
item: t,
|
|
1344
1441
|
status: "ready",
|
|
1345
1442
|
url: n
|
|
1346
1443
|
} : e);
|
|
1347
1444
|
} catch (e) {
|
|
1348
|
-
|
|
1445
|
+
Ve((n) => n?.item.path === t.path ? {
|
|
1349
1446
|
item: t,
|
|
1350
1447
|
status: "error",
|
|
1351
|
-
error:
|
|
1448
|
+
error: tn(e)
|
|
1352
1449
|
} : n);
|
|
1353
1450
|
}
|
|
1354
|
-
}, [e]),
|
|
1355
|
-
|
|
1356
|
-
}, []),
|
|
1357
|
-
|
|
1451
|
+
}, [e]), Y = h(() => {
|
|
1452
|
+
Ge.current &&= (clearTimeout(Ge.current.timeoutId), null);
|
|
1453
|
+
}, []), rt = h((e) => {
|
|
1454
|
+
Y(), Ge.current = {
|
|
1358
1455
|
path: e,
|
|
1359
1456
|
timeoutId: setTimeout(() => {
|
|
1360
|
-
|
|
1361
|
-
},
|
|
1457
|
+
Ge.current?.path === e && (Ge.current = null, D.clearSelection());
|
|
1458
|
+
}, gt)
|
|
1362
1459
|
};
|
|
1363
|
-
}, [
|
|
1364
|
-
let n = Date.now(), r =
|
|
1460
|
+
}, [D, Y]), it = h((e, t) => {
|
|
1461
|
+
let n = Date.now(), r = Ke.current, i = r?.path === e && n - r.timeMs <= gt;
|
|
1365
1462
|
if ("detail" in t && t.detail > 1) {
|
|
1366
|
-
i && (
|
|
1463
|
+
i && (Y(), qe.current = e), Ke.current = {
|
|
1367
1464
|
path: e,
|
|
1368
1465
|
timeMs: n
|
|
1369
1466
|
};
|
|
1370
1467
|
return;
|
|
1371
1468
|
}
|
|
1372
|
-
|
|
1469
|
+
qe.current = null, Ke.current = {
|
|
1373
1470
|
path: e,
|
|
1374
1471
|
timeMs: n
|
|
1375
|
-
},
|
|
1376
|
-
cancelPendingSelectedItemUnselect:
|
|
1377
|
-
scheduleSelectedItemUnselect:
|
|
1472
|
+
}, qt(D, e, t, {
|
|
1473
|
+
cancelPendingSelectedItemUnselect: Y,
|
|
1474
|
+
scheduleSelectedItemUnselect: rt
|
|
1378
1475
|
});
|
|
1379
1476
|
}, [
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
]),
|
|
1384
|
-
|
|
1477
|
+
D,
|
|
1478
|
+
Y,
|
|
1479
|
+
rt
|
|
1480
|
+
]), at = h((e) => {
|
|
1481
|
+
qe.current === e.path && (qe.current = null, Y(), e.kind === "folder" ? D.open(e) : nt(e));
|
|
1385
1482
|
}, [
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1483
|
+
D,
|
|
1484
|
+
Y,
|
|
1485
|
+
nt
|
|
1389
1486
|
]);
|
|
1390
1487
|
_(() => () => {
|
|
1391
|
-
|
|
1392
|
-
}, [
|
|
1393
|
-
let
|
|
1394
|
-
let n =
|
|
1488
|
+
Y();
|
|
1489
|
+
}, [Y]);
|
|
1490
|
+
let ot = v(() => D.selectedItems.reduce((e, t) => e + (t.size ?? 0), 0), [D.selectedItems]), st = h((e, t) => {
|
|
1491
|
+
let n = D.filteredItems;
|
|
1395
1492
|
if (n.length === 0) return;
|
|
1396
|
-
let r =
|
|
1397
|
-
t ?
|
|
1398
|
-
}, [
|
|
1399
|
-
e.length !== 0 && (
|
|
1400
|
-
}, [
|
|
1401
|
-
e.length !== 0 && (
|
|
1402
|
-
}, [
|
|
1403
|
-
e.length !== 0 && (await navigator.clipboard.writeText(e.join(", ")),
|
|
1404
|
-
}, []),
|
|
1405
|
-
let t =
|
|
1406
|
-
await
|
|
1407
|
-
}, [
|
|
1493
|
+
let r = D.focusedPath ?? D.selectedPaths.at(-1), i = n.findIndex((e) => e.path === r), a = e === "ArrowUp" || e === "ArrowLeft" || e === "End" ? n.length - 1 : 0, o = n[i === -1 ? a : Xt(e, i, n.length)];
|
|
1494
|
+
t ? D.selectRange(o.path) : D.selectOnly(o.path);
|
|
1495
|
+
}, [D]), ct = h((e = D.selectedPaths) => {
|
|
1496
|
+
e.length !== 0 && (D.copySelection(e), Le(`Copied ${an(e.length)}`));
|
|
1497
|
+
}, [D]), lt = h((e = D.selectedPaths) => {
|
|
1498
|
+
e.length !== 0 && (D.cutSelection(e), Le(`Cut ${an(e.length)}`));
|
|
1499
|
+
}, [D]), ut = h(async (e) => {
|
|
1500
|
+
e.length !== 0 && (await navigator.clipboard.writeText(e.join(", ")), Le(e.length === 1 ? "Copied path" : `Copied ${e.length} paths`));
|
|
1501
|
+
}, []), dt = h(async (e) => {
|
|
1502
|
+
let t = D.clipboard?.paths.length ?? 0;
|
|
1503
|
+
await D.pasteInto(e), t > 0 && Le(`Pasted ${an(t)}`);
|
|
1504
|
+
}, [D]);
|
|
1408
1505
|
_(() => {
|
|
1409
1506
|
let e = (e) => {
|
|
1410
|
-
if (e.key === "Escape" && (
|
|
1411
|
-
if (
|
|
1412
|
-
e.preventDefault(),
|
|
1507
|
+
if (e.key === "Escape" && (D.clearSelection(), R(null), B(""), V(null), N(null), I(null), j(null), U(!1), ye(!1), xe(null), G(null), K(null), Ve(null)), !nn(e.target)) {
|
|
1508
|
+
if (Yt(e.key)) {
|
|
1509
|
+
e.preventDefault(), st(e.key, e.shiftKey);
|
|
1413
1510
|
return;
|
|
1414
1511
|
}
|
|
1415
|
-
if (!
|
|
1512
|
+
if (!m && e.key === "F2" && D.capabilities.rename && D.selectedItems.length === 1) {
|
|
1416
1513
|
e.preventDefault();
|
|
1417
|
-
let t =
|
|
1418
|
-
|
|
1514
|
+
let t = D.selectedItems[0];
|
|
1515
|
+
N(null), I(null), R(t), B(t.name), V(null);
|
|
1419
1516
|
return;
|
|
1420
1517
|
}
|
|
1421
|
-
if (!
|
|
1422
|
-
e.preventDefault(),
|
|
1518
|
+
if (!m && (e.key === "Delete" || e.key === "Backspace") && D.selectedPaths.length > 0) {
|
|
1519
|
+
e.preventDefault(), U(!0);
|
|
1423
1520
|
return;
|
|
1424
1521
|
}
|
|
1425
|
-
if ((e.metaKey || e.ctrlKey) && !
|
|
1522
|
+
if ((e.metaKey || e.ctrlKey) && !m) {
|
|
1426
1523
|
let t = e.key.toLowerCase();
|
|
1427
|
-
if (t === "c" &&
|
|
1428
|
-
e.preventDefault(),
|
|
1524
|
+
if (t === "c" && D.capabilities.copy && D.selectedPaths.length > 0) {
|
|
1525
|
+
e.preventDefault(), ct();
|
|
1429
1526
|
return;
|
|
1430
1527
|
}
|
|
1431
|
-
if (t === "x" &&
|
|
1432
|
-
e.preventDefault(),
|
|
1528
|
+
if (t === "x" && D.capabilities.move && D.selectedPaths.length > 0) {
|
|
1529
|
+
e.preventDefault(), lt();
|
|
1433
1530
|
return;
|
|
1434
1531
|
}
|
|
1435
|
-
if (t === "v" &&
|
|
1436
|
-
e.preventDefault(),
|
|
1532
|
+
if (t === "v" && D.clipboard) {
|
|
1533
|
+
e.preventDefault(), dt(D.currentPath);
|
|
1437
1534
|
return;
|
|
1438
1535
|
}
|
|
1439
1536
|
}
|
|
1440
|
-
if (e.key === "Enter" &&
|
|
1441
|
-
let e =
|
|
1442
|
-
e.kind === "folder" ?
|
|
1537
|
+
if (e.key === "Enter" && D.selectedItems.length === 1) {
|
|
1538
|
+
let e = D.selectedItems[0];
|
|
1539
|
+
e.kind === "folder" ? D.open(e) : nt(e);
|
|
1443
1540
|
}
|
|
1444
|
-
(e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "a" && (e.preventDefault(),
|
|
1541
|
+
(e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "a" && (e.preventDefault(), D.selectAllLoaded());
|
|
1445
1542
|
}
|
|
1446
1543
|
};
|
|
1447
1544
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
1448
1545
|
}, [
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1546
|
+
D,
|
|
1547
|
+
ct,
|
|
1548
|
+
lt,
|
|
1549
|
+
st,
|
|
1550
|
+
nt,
|
|
1551
|
+
dt,
|
|
1552
|
+
m
|
|
1456
1553
|
]), _(() => {
|
|
1457
|
-
|
|
1554
|
+
D.focusedPath && (He.current?.querySelector(`[data-fb-path="${Zt(D.focusedPath)}"]`))?.focus();
|
|
1458
1555
|
}, [
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1556
|
+
D.focusedPath,
|
|
1557
|
+
D.filteredItems,
|
|
1558
|
+
D.view
|
|
1462
1559
|
]), _(() => {
|
|
1463
|
-
if (!
|
|
1464
|
-
let e = () =>
|
|
1560
|
+
if (!Ae) return;
|
|
1561
|
+
let e = () => G(null);
|
|
1465
1562
|
return document.addEventListener("click", e), () => document.removeEventListener("click", e);
|
|
1466
|
-
}, [
|
|
1467
|
-
if (!
|
|
1468
|
-
let e = setTimeout(() =>
|
|
1563
|
+
}, [Ae]), _(() => {
|
|
1564
|
+
if (!Ie) return;
|
|
1565
|
+
let e = setTimeout(() => Le(null), _t);
|
|
1469
1566
|
return () => clearTimeout(e);
|
|
1470
|
-
}, [
|
|
1471
|
-
for (let e of
|
|
1472
|
-
}, [
|
|
1473
|
-
if (!
|
|
1567
|
+
}, [Ie]), _(() => {
|
|
1568
|
+
for (let e of ie.uploads) e.status !== "completed" || !e.result || Je.current.has(e.id) || (Je.current.add(e.id), o(e.result.path) === D.currentPath && D.refresh());
|
|
1569
|
+
}, [D, ie.uploads]), _(() => {
|
|
1570
|
+
if (!W) return;
|
|
1474
1571
|
let t = !1;
|
|
1475
|
-
return Promise.resolve().then(async () => t ? [] : (
|
|
1572
|
+
return Promise.resolve().then(async () => t ? [] : (De("loading"), ke(null), Tt(e, D.selectedPaths))).then((e) => {
|
|
1476
1573
|
if (t || e.length === 0) {
|
|
1477
|
-
!t && e.length === 0 && (
|
|
1574
|
+
!t && e.length === 0 && (Te([]), De("ready"));
|
|
1478
1575
|
return;
|
|
1479
1576
|
}
|
|
1480
|
-
|
|
1577
|
+
Te(e), De("ready");
|
|
1481
1578
|
}).catch((e) => {
|
|
1482
|
-
t || (
|
|
1579
|
+
t || (Te([]), De("error"), ke(tn(e)));
|
|
1483
1580
|
}), () => {
|
|
1484
1581
|
t = !0;
|
|
1485
1582
|
};
|
|
1486
1583
|
}, [
|
|
1487
1584
|
e,
|
|
1488
|
-
|
|
1489
|
-
|
|
1585
|
+
D.selectedPaths,
|
|
1586
|
+
W
|
|
1490
1587
|
]);
|
|
1491
|
-
async function
|
|
1492
|
-
if (
|
|
1493
|
-
|
|
1588
|
+
async function ft() {
|
|
1589
|
+
if (ae.trim()) {
|
|
1590
|
+
j(null);
|
|
1494
1591
|
try {
|
|
1495
|
-
await
|
|
1592
|
+
await D.createFolder(ae), A(""), k(!1);
|
|
1496
1593
|
} catch (e) {
|
|
1497
|
-
|
|
1594
|
+
j(tn(e));
|
|
1498
1595
|
}
|
|
1499
1596
|
}
|
|
1500
1597
|
}
|
|
1501
|
-
function
|
|
1502
|
-
e && (
|
|
1598
|
+
function pt(e = D.selectedItems.at(0)) {
|
|
1599
|
+
e && (R(null), B(""), V(null), N(e), P(e.name), I(null));
|
|
1503
1600
|
}
|
|
1504
|
-
async function
|
|
1505
|
-
let e =
|
|
1506
|
-
if (!(!
|
|
1507
|
-
|
|
1601
|
+
async function mt() {
|
|
1602
|
+
let e = se.trim();
|
|
1603
|
+
if (!(!M || !e)) {
|
|
1604
|
+
I(null);
|
|
1508
1605
|
try {
|
|
1509
|
-
await
|
|
1606
|
+
await D.rename(M.path, e), N(null), P("");
|
|
1510
1607
|
} catch (e) {
|
|
1511
|
-
|
|
1608
|
+
I(tn(e));
|
|
1512
1609
|
}
|
|
1513
1610
|
}
|
|
1514
1611
|
}
|
|
1515
|
-
async function
|
|
1516
|
-
let e =
|
|
1517
|
-
if (
|
|
1518
|
-
|
|
1612
|
+
async function bt() {
|
|
1613
|
+
let e = L, t = z.trim();
|
|
1614
|
+
if (V(null), !e || !t || t === e.name) {
|
|
1615
|
+
R(null), B("");
|
|
1519
1616
|
return;
|
|
1520
1617
|
}
|
|
1521
1618
|
try {
|
|
1522
|
-
await
|
|
1619
|
+
await D.rename(e.path, t), R(null), B("");
|
|
1523
1620
|
} catch (n) {
|
|
1524
|
-
|
|
1621
|
+
R(e), B(t), V(tn(n));
|
|
1525
1622
|
}
|
|
1526
1623
|
}
|
|
1527
|
-
function
|
|
1528
|
-
|
|
1624
|
+
function Et() {
|
|
1625
|
+
R(null), B(""), V(null);
|
|
1529
1626
|
}
|
|
1530
|
-
async function
|
|
1627
|
+
async function Ot() {
|
|
1628
|
+
U(!1);
|
|
1531
1629
|
try {
|
|
1532
|
-
await
|
|
1630
|
+
await D.deleteSelected();
|
|
1533
1631
|
} catch (e) {
|
|
1534
1632
|
if (e instanceof r) {
|
|
1535
|
-
|
|
1633
|
+
xe(e);
|
|
1536
1634
|
return;
|
|
1537
1635
|
}
|
|
1538
|
-
throw e;
|
|
1636
|
+
throw U(!0), e;
|
|
1539
1637
|
}
|
|
1540
1638
|
}
|
|
1541
|
-
function
|
|
1542
|
-
|
|
1639
|
+
function At() {
|
|
1640
|
+
D.selectedPaths.length !== 0 && (Ce(D.currentPath), ye(!0));
|
|
1543
1641
|
}
|
|
1544
|
-
async function
|
|
1642
|
+
async function jt() {
|
|
1545
1643
|
try {
|
|
1546
|
-
await
|
|
1644
|
+
await D.moveSelectedTo(Se), ye(!1);
|
|
1547
1645
|
} catch (e) {
|
|
1548
1646
|
if (e instanceof r) {
|
|
1549
|
-
|
|
1647
|
+
ye(!1), xe(e);
|
|
1550
1648
|
return;
|
|
1551
1649
|
}
|
|
1552
1650
|
throw e;
|
|
1553
1651
|
}
|
|
1554
1652
|
}
|
|
1555
|
-
function
|
|
1556
|
-
if (
|
|
1557
|
-
let n =
|
|
1558
|
-
|
|
1653
|
+
function Mt(e, t) {
|
|
1654
|
+
if (m || !D.capabilities.move) return;
|
|
1655
|
+
let n = D.selectedPaths.includes(e.path) ? D.selectedPaths : [e.path];
|
|
1656
|
+
We.current = n, q(!1), Be(null), D.setSelection(n), t.dataTransfer.effectAllowed = "move", t.dataTransfer.setData(ht, JSON.stringify(n));
|
|
1657
|
+
}
|
|
1658
|
+
function Q() {
|
|
1659
|
+
We.current = [], q(!1), Be(null);
|
|
1660
|
+
}
|
|
1661
|
+
function Rt(e) {
|
|
1662
|
+
let t = Qt(e);
|
|
1663
|
+
return t.length > 0 ? t : We.current;
|
|
1559
1664
|
}
|
|
1560
|
-
function
|
|
1561
|
-
|
|
1665
|
+
function Vt(e, t) {
|
|
1666
|
+
if (m || !D.capabilities.move || e.kind !== "folder") return;
|
|
1667
|
+
let n = Rt(t.dataTransfer);
|
|
1668
|
+
n.length === 0 || n.some((t) => e.path === t || e.path.startsWith(`${t}/`)) || (t.preventDefault(), t.stopPropagation(), t.dataTransfer.dropEffect = "move", q(!1), Be(e.path));
|
|
1562
1669
|
}
|
|
1563
|
-
async function
|
|
1564
|
-
if (
|
|
1565
|
-
let n =
|
|
1670
|
+
async function en(e, t) {
|
|
1671
|
+
if (m || !D.capabilities.move || e.kind !== "folder") return;
|
|
1672
|
+
let n = Rt(t.dataTransfer);
|
|
1566
1673
|
if (n.length !== 0) {
|
|
1567
|
-
t.preventDefault(), t.stopPropagation();
|
|
1674
|
+
t.preventDefault(), t.stopPropagation(), Q();
|
|
1568
1675
|
try {
|
|
1569
|
-
await
|
|
1676
|
+
await D.movePathsTo(n, e.path);
|
|
1570
1677
|
} catch (e) {
|
|
1571
1678
|
if (e instanceof r) {
|
|
1572
|
-
|
|
1679
|
+
xe(e);
|
|
1573
1680
|
return;
|
|
1574
1681
|
}
|
|
1575
1682
|
throw e;
|
|
1576
1683
|
}
|
|
1577
1684
|
}
|
|
1578
1685
|
}
|
|
1579
|
-
function
|
|
1580
|
-
t.preventDefault(), t.stopPropagation(),
|
|
1686
|
+
function rn(e, t) {
|
|
1687
|
+
t.preventDefault(), t.stopPropagation(), D.selectedPaths.includes(e.path) || D.selectOnly(e.path), G({
|
|
1581
1688
|
target: "item",
|
|
1582
1689
|
item: e,
|
|
1583
1690
|
x: t.clientX,
|
|
@@ -1585,8 +1692,8 @@ function mt({ adapter: e, initialPath: n = "/", density: i = "comfortable", read
|
|
|
1585
1692
|
mode: "context"
|
|
1586
1693
|
});
|
|
1587
1694
|
}
|
|
1588
|
-
function
|
|
1589
|
-
|
|
1695
|
+
function sn(e) {
|
|
1696
|
+
D.selectedPaths.includes(e.path) || D.selectOnly(e.path), G({
|
|
1590
1697
|
target: "item",
|
|
1591
1698
|
item: e,
|
|
1592
1699
|
x: 0,
|
|
@@ -1594,100 +1701,120 @@ function mt({ adapter: e, initialPath: n = "/", density: i = "comfortable", read
|
|
|
1594
1701
|
mode: "sheet"
|
|
1595
1702
|
});
|
|
1596
1703
|
}
|
|
1597
|
-
function
|
|
1598
|
-
e.preventDefault(),
|
|
1704
|
+
function mn(e) {
|
|
1705
|
+
e.preventDefault(), D.clearSelection(), G({
|
|
1599
1706
|
target: "empty",
|
|
1600
1707
|
x: e.clientX,
|
|
1601
1708
|
y: e.clientY,
|
|
1602
1709
|
mode: "context"
|
|
1603
1710
|
});
|
|
1604
1711
|
}
|
|
1605
|
-
function
|
|
1606
|
-
e.target !== e.currentTarget ||
|
|
1712
|
+
function hn(e) {
|
|
1713
|
+
e.target !== e.currentTarget || Jt(e) || D.clearSelection();
|
|
1607
1714
|
}
|
|
1608
|
-
function
|
|
1609
|
-
if (!
|
|
1610
|
-
let t =
|
|
1611
|
-
|
|
1715
|
+
function gn(e) {
|
|
1716
|
+
if (!J || tt.length === 0) return;
|
|
1717
|
+
let t = tt.findIndex((e) => e.path === J.item.path), n = ((t >= 0 ? t : 0) + e + tt.length) % tt.length, r = tt[n];
|
|
1718
|
+
nt(r), D.selectOnly(r.path);
|
|
1612
1719
|
}
|
|
1613
|
-
async function
|
|
1614
|
-
if (
|
|
1615
|
-
|
|
1720
|
+
async function _n() {
|
|
1721
|
+
if (!et) return;
|
|
1722
|
+
if (D.selectedItems.length === 1 && D.selectedItems[0].kind === "file") {
|
|
1723
|
+
await vn(D.selectedItems[0]);
|
|
1616
1724
|
return;
|
|
1617
1725
|
}
|
|
1618
|
-
|
|
1726
|
+
let e = D.selectedPaths;
|
|
1727
|
+
await yn(e, ot);
|
|
1619
1728
|
}
|
|
1620
|
-
async function
|
|
1729
|
+
async function vn(t) {
|
|
1621
1730
|
if (t.kind === "file") {
|
|
1622
|
-
await
|
|
1731
|
+
await re.prepareSingleDownload({
|
|
1623
1732
|
adapter: e,
|
|
1624
1733
|
path: t.path,
|
|
1625
1734
|
selectedBytes: t.size ?? 0
|
|
1626
1735
|
});
|
|
1627
1736
|
return;
|
|
1628
1737
|
}
|
|
1629
|
-
await
|
|
1738
|
+
$e && await yn([t.path], t.size ?? 0);
|
|
1630
1739
|
}
|
|
1631
|
-
async function
|
|
1632
|
-
await
|
|
1740
|
+
async function yn(t, n) {
|
|
1741
|
+
t.length === 0 || !$e || await re.prepareBulkDownload({
|
|
1742
|
+
allowClientZipFallback: C,
|
|
1633
1743
|
adapter: e,
|
|
1634
1744
|
paths: t,
|
|
1635
1745
|
selectedBytes: n,
|
|
1636
|
-
warnZipSizeBytes:
|
|
1746
|
+
warnZipSizeBytes: ne
|
|
1637
1747
|
});
|
|
1638
1748
|
}
|
|
1639
|
-
async function
|
|
1640
|
-
!e || e.length === 0 || (await
|
|
1749
|
+
async function bn(e) {
|
|
1750
|
+
!e || e.length === 0 || (await xn(e), Ue.current && (Ue.current.value = ""));
|
|
1641
1751
|
}
|
|
1642
|
-
async function
|
|
1643
|
-
await
|
|
1752
|
+
async function xn(e) {
|
|
1753
|
+
await Cn(ve(e));
|
|
1644
1754
|
}
|
|
1645
|
-
async function
|
|
1646
|
-
await
|
|
1755
|
+
async function Sn(e) {
|
|
1756
|
+
await Cn(await _e(e));
|
|
1647
1757
|
}
|
|
1648
|
-
async function
|
|
1758
|
+
async function Cn(e) {
|
|
1649
1759
|
if (e.length === 0) return;
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1760
|
+
if (x?.maxFilesPerBatch !== void 0 && e.length > x.maxFilesPerBatch) {
|
|
1761
|
+
Ne(e.map((t) => ({
|
|
1762
|
+
fileName: t.file.name,
|
|
1763
|
+
relativePath: t.relativePath,
|
|
1764
|
+
reasons: [`Batch contains ${e.length} files; maximum is ${x.maxFilesPerBatch}`]
|
|
1765
|
+
})));
|
|
1766
|
+
return;
|
|
1767
|
+
}
|
|
1768
|
+
let { acceptedCandidates: t, rejectedCandidates: n } = Dt(e, x, D.currentPath);
|
|
1769
|
+
if (n.length > 0 && Ne(n), t.length === 0) return;
|
|
1770
|
+
let r = wn(t);
|
|
1653
1771
|
if (r.length === 0) return;
|
|
1654
|
-
let i = await
|
|
1655
|
-
|
|
1772
|
+
let i = await Tn(r), a = await En(r);
|
|
1773
|
+
if (a.length > 0 && Qe.length === 0) {
|
|
1774
|
+
let e = new Set(a), t = r.filter((t) => !e.has(xt(D.currentPath, t.relativePath))), n = r.filter((t) => e.has(xt(D.currentPath, t.relativePath)));
|
|
1775
|
+
Ne((e) => [...e, ...n.map((e) => ({
|
|
1776
|
+
fileName: e.file.name,
|
|
1777
|
+
relativePath: e.relativePath,
|
|
1778
|
+
reasons: ["No upload conflict resolutions are enabled"]
|
|
1779
|
+
}))]), t.length > 0 && On(t, [], 0, void 0, wt(D.currentPath, t, i));
|
|
1780
|
+
return;
|
|
1781
|
+
}
|
|
1782
|
+
On(r, a, 0, void 0, wt(D.currentPath, r, i));
|
|
1656
1783
|
}
|
|
1657
|
-
function
|
|
1658
|
-
if (
|
|
1659
|
-
let [t, n] =
|
|
1660
|
-
return t.length > 0 &&
|
|
1784
|
+
function wn(e) {
|
|
1785
|
+
if (D.capabilities.createFolder) return e;
|
|
1786
|
+
let [t, n] = Ct(e, (e) => e.relativePath.includes("/"));
|
|
1787
|
+
return t.length > 0 && Ne((e) => [...e, ...t.map((e) => ({
|
|
1661
1788
|
fileName: e.file.name,
|
|
1662
1789
|
relativePath: e.relativePath,
|
|
1663
1790
|
reasons: ["Folder uploads require folder creation support"]
|
|
1664
1791
|
}))]), n;
|
|
1665
1792
|
}
|
|
1666
|
-
async function
|
|
1667
|
-
let r =
|
|
1793
|
+
async function Tn(n) {
|
|
1794
|
+
let r = St(n), i = 0;
|
|
1668
1795
|
if (!e.createFolder) {
|
|
1669
1796
|
if (r.length > 0) throw new t("not_supported", "Folder uploads require folder creation support");
|
|
1670
1797
|
return 0;
|
|
1671
1798
|
}
|
|
1672
1799
|
for (let n of r) try {
|
|
1673
|
-
await e.createFolder(
|
|
1800
|
+
await e.createFolder(xt(D.currentPath, n)), i += 1;
|
|
1674
1801
|
} catch (e) {
|
|
1675
1802
|
if (e instanceof t && e.code === "conflict") continue;
|
|
1676
1803
|
throw e;
|
|
1677
1804
|
}
|
|
1678
|
-
return i > 0 && await
|
|
1805
|
+
return i > 0 && await D.refresh(), i;
|
|
1679
1806
|
}
|
|
1680
|
-
async function
|
|
1681
|
-
let n = t.map((e) =>
|
|
1807
|
+
async function En(t) {
|
|
1808
|
+
let n = t.map((e) => xt(D.currentPath, e.relativePath));
|
|
1682
1809
|
if (e.exists) try {
|
|
1683
1810
|
let t = await e.exists(n);
|
|
1684
1811
|
return n.filter((e) => t[e]);
|
|
1685
1812
|
} catch {}
|
|
1686
|
-
let r = new Set(
|
|
1687
|
-
for (let e of n) (r.has(e) || await
|
|
1813
|
+
let r = new Set(D.items.map((e) => e.path)), i = [];
|
|
1814
|
+
for (let e of n) (r.has(e) || await Dn(e)) && i.push(e);
|
|
1688
1815
|
return i;
|
|
1689
1816
|
}
|
|
1690
|
-
async function
|
|
1817
|
+
async function Dn(t) {
|
|
1691
1818
|
let n = o(t), r;
|
|
1692
1819
|
do {
|
|
1693
1820
|
let i = await e.list(n, { cursor: r });
|
|
@@ -1696,65 +1823,77 @@ function mt({ adapter: e, initialPath: n = "/", density: i = "comfortable", read
|
|
|
1696
1823
|
} while (r);
|
|
1697
1824
|
return !1;
|
|
1698
1825
|
}
|
|
1699
|
-
function
|
|
1826
|
+
function On(e, t, n, r, i) {
|
|
1700
1827
|
let a = new Set(t);
|
|
1701
1828
|
for (let o = n; o < e.length; o += 1) {
|
|
1702
|
-
let n = e[o], s =
|
|
1829
|
+
let n = e[o], s = xt(D.currentPath, n.relativePath);
|
|
1703
1830
|
if (a.has(s)) {
|
|
1704
1831
|
if (!r) {
|
|
1705
|
-
|
|
1832
|
+
K({
|
|
1706
1833
|
candidates: e,
|
|
1707
1834
|
conflictPaths: t,
|
|
1708
1835
|
group: i,
|
|
1709
1836
|
index: o
|
|
1710
|
-
}),
|
|
1837
|
+
}), Fe(!1);
|
|
1711
1838
|
return;
|
|
1712
1839
|
}
|
|
1713
|
-
r !== "skip" &&
|
|
1714
|
-
} else
|
|
1840
|
+
r !== "skip" && An(n, r, i);
|
|
1841
|
+
} else An(n, void 0, i);
|
|
1715
1842
|
}
|
|
1716
|
-
|
|
1843
|
+
K(null), Fe(!1);
|
|
1717
1844
|
}
|
|
1718
|
-
function
|
|
1719
|
-
if (!
|
|
1720
|
-
let { candidates: t, conflictPaths: n, group: r, index: i } =
|
|
1721
|
-
if (
|
|
1722
|
-
|
|
1845
|
+
function kn(e) {
|
|
1846
|
+
if (!je || !Qe.includes(e)) return;
|
|
1847
|
+
let { candidates: t, conflictPaths: n, group: r, index: i } = je;
|
|
1848
|
+
if (Pe) {
|
|
1849
|
+
On(t, n, i, e, r);
|
|
1723
1850
|
return;
|
|
1724
1851
|
}
|
|
1725
1852
|
let a = t[i];
|
|
1726
|
-
e !== "skip" &&
|
|
1853
|
+
e !== "skip" && An(a, e, r), On(t, n, i + 1, void 0, r);
|
|
1727
1854
|
}
|
|
1728
|
-
function
|
|
1729
|
-
|
|
1855
|
+
function An(t, n, r) {
|
|
1856
|
+
re.enqueueUpload({
|
|
1730
1857
|
adapter: e,
|
|
1731
|
-
destinationPath:
|
|
1858
|
+
destinationPath: xt(D.currentPath, t.relativePath),
|
|
1732
1859
|
file: t.file,
|
|
1733
1860
|
group: r,
|
|
1734
1861
|
onConflict: n === "skip" ? void 0 : n
|
|
1735
1862
|
});
|
|
1736
1863
|
}
|
|
1737
1864
|
return /* @__PURE__ */ E("section", {
|
|
1738
|
-
className: `flex min-h-[520px] w-full overflow-hidden rounded-[var(--fb-radius)] border border-[var(--fb-border)] bg-[var(--fb-surface)] font-[inherit] text-[length:var(--fb-font)] text-[var(--fb-text)] ${Z}`,
|
|
1739
|
-
"data-fb-density":
|
|
1740
|
-
ref:
|
|
1741
|
-
style:
|
|
1865
|
+
className: `flex min-h-[520px] w-full overflow-hidden rounded-[var(--fb-radius)] border border-[var(--fb-border)] bg-[var(--fb-surface)] font-[inherit] text-[length:var(--fb-font)] text-[var(--fb-text)] ${Z}${n ? ` ${n}` : ""}`,
|
|
1866
|
+
"data-fb-density": p,
|
|
1867
|
+
ref: He,
|
|
1868
|
+
style: yt[p],
|
|
1742
1869
|
onDragEnter: (e) => {
|
|
1743
|
-
e.
|
|
1870
|
+
if (Rt(e.dataTransfer).length > 0) {
|
|
1871
|
+
q(!1);
|
|
1872
|
+
return;
|
|
1873
|
+
}
|
|
1874
|
+
e.preventDefault(), m || q(!0);
|
|
1744
1875
|
},
|
|
1745
1876
|
onDragLeave: (e) => {
|
|
1746
|
-
e.currentTarget === e.target &&
|
|
1877
|
+
e.currentTarget === e.target && (q(!1), Be(null));
|
|
1747
1878
|
},
|
|
1748
1879
|
onDragOver: (e) => {
|
|
1880
|
+
if (Rt(e.dataTransfer).length > 0) {
|
|
1881
|
+
q(!1), Be(null);
|
|
1882
|
+
return;
|
|
1883
|
+
}
|
|
1749
1884
|
e.preventDefault();
|
|
1750
1885
|
},
|
|
1751
1886
|
onDrop: (e) => {
|
|
1752
|
-
e.preventDefault(),
|
|
1887
|
+
if (e.preventDefault(), Rt(e.dataTransfer).length > 0) {
|
|
1888
|
+
Q();
|
|
1889
|
+
return;
|
|
1890
|
+
}
|
|
1891
|
+
q(!1), !m && Sn(e.dataTransfer);
|
|
1753
1892
|
},
|
|
1754
1893
|
onPaste: (e) => {
|
|
1755
|
-
if (
|
|
1894
|
+
if (m) return;
|
|
1756
1895
|
let t = Array.from(e.clipboardData.files).filter((e) => e.type.startsWith("image/"));
|
|
1757
|
-
t.length > 0 &&
|
|
1896
|
+
t.length > 0 && xn(t);
|
|
1758
1897
|
},
|
|
1759
1898
|
children: [
|
|
1760
1899
|
/* @__PURE__ */ T("div", {
|
|
@@ -1762,11 +1901,12 @@ function mt({ adapter: e, initialPath: n = "/", density: i = "comfortable", read
|
|
|
1762
1901
|
"aria-live": "polite",
|
|
1763
1902
|
className: "sr-only",
|
|
1764
1903
|
role: "status",
|
|
1765
|
-
children:
|
|
1766
|
-
currentPath:
|
|
1767
|
-
itemCount:
|
|
1768
|
-
|
|
1769
|
-
|
|
1904
|
+
children: ln({
|
|
1905
|
+
currentPath: D.currentPath,
|
|
1906
|
+
itemCount: D.filteredItems.length,
|
|
1907
|
+
rootLabel: l,
|
|
1908
|
+
selectedCount: D.selectedPaths.length,
|
|
1909
|
+
status: D.status
|
|
1770
1910
|
})
|
|
1771
1911
|
}),
|
|
1772
1912
|
/* @__PURE__ */ E("div", {
|
|
@@ -1775,15 +1915,16 @@ function mt({ adapter: e, initialPath: n = "/", density: i = "comfortable", read
|
|
|
1775
1915
|
/* @__PURE__ */ E("header", {
|
|
1776
1916
|
className: `flex flex-wrap items-center gap-2 border-b border-[var(--fb-border)] bg-[var(--fb-surface)] px-[var(--fb-pad)] py-[var(--fb-cell-y)] ${Z}`,
|
|
1777
1917
|
children: [
|
|
1778
|
-
/* @__PURE__ */ T(
|
|
1779
|
-
|
|
1780
|
-
|
|
1918
|
+
/* @__PURE__ */ T(Bt, {
|
|
1919
|
+
onNavigate: (e) => D.navigate(e, { source: "breadcrumb" }),
|
|
1920
|
+
path: D.currentPath,
|
|
1921
|
+
rootLabel: l
|
|
1781
1922
|
}),
|
|
1782
|
-
|
|
1923
|
+
Ie ? /* @__PURE__ */ T("span", {
|
|
1783
1924
|
"aria-label": "Clipboard status",
|
|
1784
1925
|
className: `rounded-[calc(var(--fb-radius)-4px)] bg-[var(--fb-accent-soft)] px-2 py-1 text-[12px] font-medium text-[var(--fb-accent)] ${X}`,
|
|
1785
1926
|
role: "status",
|
|
1786
|
-
children:
|
|
1927
|
+
children: Ie
|
|
1787
1928
|
}) : null,
|
|
1788
1929
|
/* @__PURE__ */ E("div", {
|
|
1789
1930
|
className: "ml-auto flex min-w-0 items-center gap-1.5",
|
|
@@ -1796,17 +1937,17 @@ function mt({ adapter: e, initialPath: n = "/", density: i = "comfortable", read
|
|
|
1796
1937
|
}), /* @__PURE__ */ T("input", {
|
|
1797
1938
|
"aria-label": "Search files",
|
|
1798
1939
|
className: `h-[var(--fb-control-h)] w-full rounded-[calc(var(--fb-radius)-3px)] border border-[var(--fb-border)] bg-[var(--fb-surface)] pl-7 pr-2 text-[12px] text-[var(--fb-text)] outline-none focus:border-[var(--fb-accent)] focus:ring-2 focus:ring-[var(--fb-accent-soft)] ${X}`,
|
|
1799
|
-
onChange: (e) =>
|
|
1940
|
+
onChange: (e) => D.setSearchQuery(e.target.value),
|
|
1800
1941
|
placeholder: "Search",
|
|
1801
1942
|
type: "search",
|
|
1802
|
-
value:
|
|
1943
|
+
value: D.searchQuery
|
|
1803
1944
|
})]
|
|
1804
1945
|
}),
|
|
1805
1946
|
/* @__PURE__ */ E("select", {
|
|
1806
1947
|
"aria-label": "Filter files",
|
|
1807
|
-
className:
|
|
1808
|
-
onChange: (e) =>
|
|
1809
|
-
value:
|
|
1948
|
+
className: pn(),
|
|
1949
|
+
onChange: (e) => D.setFilterKind(e.target.value),
|
|
1950
|
+
value: D.filterKind,
|
|
1810
1951
|
children: [
|
|
1811
1952
|
/* @__PURE__ */ T("option", {
|
|
1812
1953
|
value: "all",
|
|
@@ -1824,9 +1965,9 @@ function mt({ adapter: e, initialPath: n = "/", density: i = "comfortable", read
|
|
|
1824
1965
|
}),
|
|
1825
1966
|
/* @__PURE__ */ E("select", {
|
|
1826
1967
|
"aria-label": "Sort files",
|
|
1827
|
-
className:
|
|
1828
|
-
onChange: (e) =>
|
|
1829
|
-
value:
|
|
1968
|
+
className: pn(),
|
|
1969
|
+
onChange: (e) => D.setSortBy(e.target.value),
|
|
1970
|
+
value: D.sortBy,
|
|
1830
1971
|
children: [
|
|
1831
1972
|
/* @__PURE__ */ T("option", {
|
|
1832
1973
|
value: "name",
|
|
@@ -1844,55 +1985,56 @@ function mt({ adapter: e, initialPath: n = "/", density: i = "comfortable", read
|
|
|
1844
1985
|
}),
|
|
1845
1986
|
/* @__PURE__ */ T("button", {
|
|
1846
1987
|
"aria-label": "Toggle sort direction",
|
|
1847
|
-
className:
|
|
1848
|
-
onClick: () =>
|
|
1988
|
+
className: un(!1),
|
|
1989
|
+
onClick: () => D.setSortDirection((e) => e === "asc" ? "desc" : "asc"),
|
|
1849
1990
|
type: "button",
|
|
1850
|
-
children:
|
|
1991
|
+
children: D.sortDirection === "asc" ? "Asc" : "Desc"
|
|
1851
1992
|
}),
|
|
1852
1993
|
/* @__PURE__ */ T("button", {
|
|
1853
1994
|
"aria-label": "Grid view",
|
|
1854
|
-
className:
|
|
1855
|
-
onClick: () =>
|
|
1995
|
+
className: un(D.view === "grid"),
|
|
1996
|
+
onClick: () => D.setView("grid"),
|
|
1856
1997
|
type: "button",
|
|
1857
|
-
children: /* @__PURE__ */ T(
|
|
1998
|
+
children: /* @__PURE__ */ T(fe, {
|
|
1858
1999
|
"aria-hidden": "true",
|
|
1859
2000
|
className: "size-4"
|
|
1860
2001
|
})
|
|
1861
2002
|
}),
|
|
1862
2003
|
/* @__PURE__ */ T("button", {
|
|
1863
2004
|
"aria-label": "List view",
|
|
1864
|
-
className:
|
|
1865
|
-
onClick: () =>
|
|
2005
|
+
className: un(D.view === "list"),
|
|
2006
|
+
onClick: () => D.setView("list"),
|
|
1866
2007
|
type: "button",
|
|
1867
|
-
children: /* @__PURE__ */ T(
|
|
2008
|
+
children: /* @__PURE__ */ T(pe, {
|
|
1868
2009
|
"aria-hidden": "true",
|
|
1869
2010
|
className: "size-4"
|
|
1870
2011
|
})
|
|
1871
2012
|
}),
|
|
1872
|
-
!
|
|
2013
|
+
!m && D.capabilities.createFolder ? /* @__PURE__ */ E("button", {
|
|
1873
2014
|
className: $(!1),
|
|
1874
2015
|
onClick: () => {
|
|
1875
|
-
|
|
2016
|
+
j(null), k(!0);
|
|
1876
2017
|
},
|
|
1877
2018
|
type: "button",
|
|
1878
|
-
children: [/* @__PURE__ */ T(
|
|
2019
|
+
children: [/* @__PURE__ */ T(de, {
|
|
1879
2020
|
"aria-hidden": "true",
|
|
1880
2021
|
className: "size-4"
|
|
1881
2022
|
}), "New folder"]
|
|
1882
2023
|
}) : null,
|
|
1883
2024
|
/* @__PURE__ */ T("input", {
|
|
2025
|
+
accept: x?.allowedMimeTypes?.length ? x.allowedMimeTypes.join(",") : void 0,
|
|
1884
2026
|
"aria-label": "Upload files",
|
|
1885
2027
|
multiple: !0,
|
|
1886
|
-
onChange: (e) => void
|
|
1887
|
-
ref:
|
|
2028
|
+
onChange: (e) => void bn(e.target.files),
|
|
2029
|
+
ref: Ue,
|
|
1888
2030
|
type: "file",
|
|
1889
2031
|
className: "hidden"
|
|
1890
2032
|
}),
|
|
1891
|
-
|
|
1892
|
-
className:
|
|
1893
|
-
onClick: () =>
|
|
2033
|
+
m ? null : /* @__PURE__ */ E("button", {
|
|
2034
|
+
className: dn(),
|
|
2035
|
+
onClick: () => Ue.current?.click(),
|
|
1894
2036
|
type: "button",
|
|
1895
|
-
children: [/* @__PURE__ */ T(
|
|
2037
|
+
children: [/* @__PURE__ */ T(ge, {
|
|
1896
2038
|
"aria-hidden": "true",
|
|
1897
2039
|
className: "size-4"
|
|
1898
2040
|
}), "Upload"]
|
|
@@ -1901,79 +2043,88 @@ function mt({ adapter: e, initialPath: n = "/", density: i = "comfortable", read
|
|
|
1901
2043
|
})
|
|
1902
2044
|
]
|
|
1903
2045
|
}),
|
|
1904
|
-
/* @__PURE__ */ T(
|
|
1905
|
-
canCopy: !
|
|
1906
|
-
canCut: !
|
|
1907
|
-
canDelete: !
|
|
1908
|
-
canMove: !
|
|
1909
|
-
canRename: !
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
2046
|
+
/* @__PURE__ */ T(zt, {
|
|
2047
|
+
canCopy: !m && D.capabilities.copy,
|
|
2048
|
+
canCut: !m && D.capabilities.move,
|
|
2049
|
+
canDelete: !m,
|
|
2050
|
+
canMove: !m && D.capabilities.move,
|
|
2051
|
+
canRename: !m && D.capabilities.rename,
|
|
2052
|
+
canDownload: et,
|
|
2053
|
+
itemCount: D.filteredItems.length,
|
|
2054
|
+
onCopy: () => ct(),
|
|
2055
|
+
onCut: () => lt(),
|
|
2056
|
+
onDelete: () => U(!0),
|
|
2057
|
+
onDownload: () => void _n(),
|
|
2058
|
+
onMove: At,
|
|
2059
|
+
onRename: pt,
|
|
2060
|
+
onSelectAll: D.selectAllLoaded,
|
|
2061
|
+
onSelectNone: D.clearSelection,
|
|
2062
|
+
selectedCount: D.selectedPaths.length
|
|
1920
2063
|
}),
|
|
1921
|
-
|
|
1922
|
-
onDismiss: () =>
|
|
1923
|
-
rejections:
|
|
2064
|
+
Me.length > 0 ? /* @__PURE__ */ T(Kt, {
|
|
2065
|
+
onDismiss: () => Ne([]),
|
|
2066
|
+
rejections: Me
|
|
1924
2067
|
}) : null,
|
|
1925
2068
|
/* @__PURE__ */ E("div", {
|
|
1926
2069
|
className: `relative min-h-0 flex-1 overflow-auto bg-[var(--fb-bg)] p-[var(--fb-pad)] ${Z}`,
|
|
1927
|
-
onClick:
|
|
1928
|
-
onContextMenu:
|
|
1929
|
-
children: [
|
|
1930
|
-
title:
|
|
2070
|
+
onClick: hn,
|
|
2071
|
+
onContextMenu: mn,
|
|
2072
|
+
children: [D.status === "loading" && D.items.length === 0 ? /* @__PURE__ */ T(Wt, { rootLabel: l }) : D.status === "error" ? /* @__PURE__ */ T(Gt, {
|
|
2073
|
+
title: $t(D.error).title,
|
|
1931
2074
|
tone: "danger",
|
|
1932
|
-
value:
|
|
1933
|
-
}) :
|
|
1934
|
-
title: "This folder is empty",
|
|
1935
|
-
value: "Create a folder or upload files to start."
|
|
1936
|
-
}) :
|
|
1937
|
-
browser:
|
|
1938
|
-
canMove: !
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
2075
|
+
value: $t(D.error).value
|
|
2076
|
+
}) : D.filteredItems.length === 0 ? /* @__PURE__ */ T(Gt, {
|
|
2077
|
+
title: i ? i.title : "This folder is empty",
|
|
2078
|
+
value: i ? i.description : "Create a folder or upload files to start."
|
|
2079
|
+
}) : D.view === "grid" ? /* @__PURE__ */ T(kt, {
|
|
2080
|
+
browser: D,
|
|
2081
|
+
canMove: !m && D.capabilities.move,
|
|
2082
|
+
folderDropTargetPath: ze,
|
|
2083
|
+
inlineRenameError: me,
|
|
2084
|
+
inlineRenameLabel: L?.name ?? "",
|
|
2085
|
+
inlineRenameItem: L,
|
|
2086
|
+
inlineRenameValue: z,
|
|
2087
|
+
onDragStart: Mt,
|
|
2088
|
+
onDragEnd: Q,
|
|
2089
|
+
onFolderDragOver: Vt,
|
|
2090
|
+
onFolderDrop: (e, t) => void en(e, t),
|
|
2091
|
+
onEmptyClick: () => D.clearSelection(),
|
|
2092
|
+
onInlineRenameCancel: Et,
|
|
1948
2093
|
onInlineRenameChange: (e) => {
|
|
1949
|
-
|
|
2094
|
+
B(e), V(null);
|
|
1950
2095
|
},
|
|
1951
|
-
onInlineRenameCommit: () => void
|
|
1952
|
-
onContextMenu:
|
|
1953
|
-
onOpenItem:
|
|
1954
|
-
onSelectItem:
|
|
1955
|
-
onTouchMenu:
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
2096
|
+
onInlineRenameCommit: () => void bt(),
|
|
2097
|
+
onContextMenu: rn,
|
|
2098
|
+
onOpenItem: at,
|
|
2099
|
+
onSelectItem: it,
|
|
2100
|
+
onTouchMenu: sn,
|
|
2101
|
+
renderItemMeta: w,
|
|
2102
|
+
rootLabel: l,
|
|
2103
|
+
selectedPaths: D.selectedPaths
|
|
2104
|
+
}) : /* @__PURE__ */ T(Nt, {
|
|
2105
|
+
browser: D,
|
|
2106
|
+
canMove: !m && D.capabilities.move,
|
|
2107
|
+
folderDropTargetPath: ze,
|
|
2108
|
+
inlineRenameError: me,
|
|
2109
|
+
inlineRenameLabel: L?.name ?? "",
|
|
2110
|
+
inlineRenameItem: L,
|
|
2111
|
+
inlineRenameValue: z,
|
|
2112
|
+
onDragStart: Mt,
|
|
2113
|
+
onDragEnd: Q,
|
|
2114
|
+
onFolderDragOver: Vt,
|
|
2115
|
+
onFolderDrop: (e, t) => void en(e, t),
|
|
2116
|
+
onInlineRenameCancel: Et,
|
|
1968
2117
|
onInlineRenameChange: (e) => {
|
|
1969
|
-
|
|
2118
|
+
B(e), V(null);
|
|
1970
2119
|
},
|
|
1971
|
-
onInlineRenameCommit: () => void
|
|
1972
|
-
onContextMenu:
|
|
1973
|
-
onOpenItem:
|
|
1974
|
-
onSelectItem:
|
|
1975
|
-
|
|
1976
|
-
|
|
2120
|
+
onInlineRenameCommit: () => void bt(),
|
|
2121
|
+
onContextMenu: rn,
|
|
2122
|
+
onOpenItem: at,
|
|
2123
|
+
onSelectItem: it,
|
|
2124
|
+
renderItemMeta: w,
|
|
2125
|
+
rootLabel: l,
|
|
2126
|
+
selectedPaths: D.selectedPaths
|
|
2127
|
+
}), Re ? /* @__PURE__ */ T("div", {
|
|
1977
2128
|
className: `pointer-events-none absolute inset-3 z-10 grid place-items-center rounded-[var(--fb-radius)] border-2 border-dashed border-[var(--fb-accent)] bg-[var(--fb-accent-soft)] text-[13px] font-semibold text-[var(--fb-accent)] ${Z}`,
|
|
1978
2129
|
children: "Drop files to upload"
|
|
1979
2130
|
}) : null]
|
|
@@ -1981,44 +2132,47 @@ function mt({ adapter: e, initialPath: n = "/", density: i = "comfortable", read
|
|
|
1981
2132
|
/* @__PURE__ */ E("footer", {
|
|
1982
2133
|
className: `flex h-9 items-center justify-between border-t border-[var(--fb-border)] px-[var(--fb-pad)] text-[11px] text-[var(--fb-muted)] ${Z}`,
|
|
1983
2134
|
children: [/* @__PURE__ */ E("span", { children: [
|
|
1984
|
-
|
|
2135
|
+
D.filteredItems.length,
|
|
1985
2136
|
" items",
|
|
1986
|
-
|
|
1987
|
-
] }),
|
|
2137
|
+
D.selectedPaths.length ? ` · ${D.selectedPaths.length} selected` : ""
|
|
2138
|
+
] }), D.hasMore ? /* @__PURE__ */ T("button", {
|
|
1988
2139
|
className: `rounded-[calc(var(--fb-radius)-4px)] px-2 py-1 font-medium text-[var(--fb-accent)] hover:bg-[var(--fb-accent-soft)] ${X}`,
|
|
1989
|
-
onClick: () => void
|
|
2140
|
+
onClick: () => void D.loadMore(),
|
|
1990
2141
|
type: "button",
|
|
1991
2142
|
children: "Load more"
|
|
1992
2143
|
}) : /* @__PURE__ */ T("span", {})]
|
|
1993
2144
|
})
|
|
1994
2145
|
]
|
|
1995
2146
|
}),
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2147
|
+
g ? /* @__PURE__ */ T(Ht, {
|
|
2148
|
+
canDownload: et,
|
|
2149
|
+
item: Ye,
|
|
2150
|
+
onCopyPath: () => void ut(D.selectedPaths),
|
|
2151
|
+
onDownload: () => void _n(),
|
|
2152
|
+
renderDetailsContent: te,
|
|
2153
|
+
selectedCount: D.selectedItems.length,
|
|
2154
|
+
totalBytes: ot
|
|
2002
2155
|
}) : null,
|
|
2003
|
-
|
|
2004
|
-
browser:
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2156
|
+
Ae ? /* @__PURE__ */ T(Pt, {
|
|
2157
|
+
browser: D,
|
|
2158
|
+
canDownload: et,
|
|
2159
|
+
menu: Ae,
|
|
2160
|
+
onClose: () => G(null),
|
|
2161
|
+
onDelete: () => U(!0),
|
|
2162
|
+
onDownload: () => void _n(),
|
|
2163
|
+
onMove: At,
|
|
2010
2164
|
onNewFolder: () => {
|
|
2011
|
-
|
|
2165
|
+
j(null), k(!0);
|
|
2012
2166
|
},
|
|
2013
|
-
onCopy: () =>
|
|
2014
|
-
onCopyPath: (e) => void
|
|
2015
|
-
onCut: () =>
|
|
2016
|
-
onPaste: () => void
|
|
2017
|
-
onRename:
|
|
2018
|
-
onUpload: () =>
|
|
2019
|
-
readOnly:
|
|
2167
|
+
onCopy: () => ct(),
|
|
2168
|
+
onCopyPath: (e) => void ut(D.selectedPaths.includes(e.path) ? D.selectedPaths : [e.path]),
|
|
2169
|
+
onCut: () => lt(),
|
|
2170
|
+
onPaste: () => void dt(D.currentPath),
|
|
2171
|
+
onRename: pt,
|
|
2172
|
+
onUpload: () => Ue.current?.click(),
|
|
2173
|
+
readOnly: m
|
|
2020
2174
|
}) : null,
|
|
2021
|
-
|
|
2175
|
+
O ? /* @__PURE__ */ T("div", {
|
|
2022
2176
|
"aria-label": "New folder",
|
|
2023
2177
|
"aria-modal": "true",
|
|
2024
2178
|
className: `fixed inset-0 z-40 grid place-items-center bg-[color-mix(in_oklch,var(--fb-text)_20%,transparent)] p-4 ${Z}`,
|
|
@@ -2026,7 +2180,7 @@ function mt({ adapter: e, initialPath: n = "/", density: i = "comfortable", read
|
|
|
2026
2180
|
children: /* @__PURE__ */ E("form", {
|
|
2027
2181
|
className: `w-[min(360px,100%)] rounded-[var(--fb-radius)] border border-[var(--fb-border)] bg-[var(--fb-surface)] p-4 shadow-[0_18px_50px_color-mix(in_oklch,var(--fb-text)_18%,transparent)] ${Z}`,
|
|
2028
2182
|
onSubmit: (e) => {
|
|
2029
|
-
e.preventDefault(),
|
|
2183
|
+
e.preventDefault(), ft();
|
|
2030
2184
|
},
|
|
2031
2185
|
children: [
|
|
2032
2186
|
/* @__PURE__ */ T("h2", {
|
|
@@ -2040,27 +2194,27 @@ function mt({ adapter: e, initialPath: n = "/", density: i = "comfortable", read
|
|
|
2040
2194
|
autoFocus: !0,
|
|
2041
2195
|
className: `mt-1 h-9 w-full rounded-[calc(var(--fb-radius)-3px)] border border-[var(--fb-border)] bg-[var(--fb-surface)] px-2 text-[13px] text-[var(--fb-text)] outline-none focus:border-[var(--fb-accent)] focus:ring-2 focus:ring-[var(--fb-accent-soft)] ${X}`,
|
|
2042
2196
|
onChange: (e) => {
|
|
2043
|
-
|
|
2197
|
+
A(e.target.value), j(null);
|
|
2044
2198
|
},
|
|
2045
|
-
value:
|
|
2199
|
+
value: ae
|
|
2046
2200
|
})]
|
|
2047
2201
|
}),
|
|
2048
|
-
|
|
2202
|
+
oe ? /* @__PURE__ */ T("div", {
|
|
2049
2203
|
className: `mt-3 rounded-[calc(var(--fb-radius)-4px)] border border-[var(--fb-danger)] bg-[var(--fb-danger-soft)] px-2 py-1.5 text-[12px] text-[var(--fb-danger)] ${Z}`,
|
|
2050
2204
|
role: "alert",
|
|
2051
|
-
children:
|
|
2205
|
+
children: oe
|
|
2052
2206
|
}) : null,
|
|
2053
2207
|
/* @__PURE__ */ E("div", {
|
|
2054
2208
|
className: "mt-4 flex justify-end gap-2",
|
|
2055
2209
|
children: [/* @__PURE__ */ T("button", {
|
|
2056
2210
|
className: $(!1),
|
|
2057
2211
|
onClick: () => {
|
|
2058
|
-
|
|
2212
|
+
j(null), k(!1);
|
|
2059
2213
|
},
|
|
2060
2214
|
type: "button",
|
|
2061
2215
|
children: "Cancel"
|
|
2062
2216
|
}), /* @__PURE__ */ T("button", {
|
|
2063
|
-
className:
|
|
2217
|
+
className: dn(),
|
|
2064
2218
|
type: "submit",
|
|
2065
2219
|
children: "Create folder"
|
|
2066
2220
|
})]
|
|
@@ -2068,7 +2222,7 @@ function mt({ adapter: e, initialPath: n = "/", density: i = "comfortable", read
|
|
|
2068
2222
|
]
|
|
2069
2223
|
})
|
|
2070
2224
|
}) : null,
|
|
2071
|
-
|
|
2225
|
+
M ? /* @__PURE__ */ T("div", {
|
|
2072
2226
|
"aria-label": "Rename item",
|
|
2073
2227
|
"aria-modal": "true",
|
|
2074
2228
|
className: `fixed inset-0 z-40 grid place-items-center bg-[color-mix(in_oklch,var(--fb-text)_20%,transparent)] p-4 ${Z}`,
|
|
@@ -2076,7 +2230,7 @@ function mt({ adapter: e, initialPath: n = "/", density: i = "comfortable", read
|
|
|
2076
2230
|
children: /* @__PURE__ */ E("form", {
|
|
2077
2231
|
className: `w-[min(360px,100%)] rounded-[var(--fb-radius)] border border-[var(--fb-border)] bg-[var(--fb-surface)] p-4 shadow-[0_18px_50px_color-mix(in_oklch,var(--fb-text)_18%,transparent)] ${Z}`,
|
|
2078
2232
|
onSubmit: (e) => {
|
|
2079
|
-
e.preventDefault(),
|
|
2233
|
+
e.preventDefault(), mt();
|
|
2080
2234
|
},
|
|
2081
2235
|
children: [
|
|
2082
2236
|
/* @__PURE__ */ T("h2", {
|
|
@@ -2090,27 +2244,27 @@ function mt({ adapter: e, initialPath: n = "/", density: i = "comfortable", read
|
|
|
2090
2244
|
autoFocus: !0,
|
|
2091
2245
|
className: `mt-1 h-9 w-full rounded-[calc(var(--fb-radius)-3px)] border border-[var(--fb-border)] bg-[var(--fb-surface)] px-2 text-[13px] text-[var(--fb-text)] outline-none focus:border-[var(--fb-accent)] focus:ring-2 focus:ring-[var(--fb-accent-soft)] ${X}`,
|
|
2092
2246
|
onChange: (e) => {
|
|
2093
|
-
|
|
2247
|
+
P(e.target.value), I(null);
|
|
2094
2248
|
},
|
|
2095
|
-
value:
|
|
2249
|
+
value: se
|
|
2096
2250
|
})]
|
|
2097
2251
|
}),
|
|
2098
|
-
|
|
2252
|
+
F ? /* @__PURE__ */ T("div", {
|
|
2099
2253
|
className: `mt-3 rounded-[calc(var(--fb-radius)-4px)] border border-[var(--fb-danger)] bg-[var(--fb-danger-soft)] px-2 py-1.5 text-[12px] text-[var(--fb-danger)] ${Z}`,
|
|
2100
2254
|
role: "alert",
|
|
2101
|
-
children:
|
|
2255
|
+
children: F
|
|
2102
2256
|
}) : null,
|
|
2103
2257
|
/* @__PURE__ */ E("div", {
|
|
2104
2258
|
className: "mt-4 flex justify-end gap-2",
|
|
2105
2259
|
children: [/* @__PURE__ */ T("button", {
|
|
2106
2260
|
className: $(!1),
|
|
2107
2261
|
onClick: () => {
|
|
2108
|
-
|
|
2262
|
+
N(null), P(""), I(null);
|
|
2109
2263
|
},
|
|
2110
2264
|
type: "button",
|
|
2111
2265
|
children: "Cancel"
|
|
2112
2266
|
}), /* @__PURE__ */ T("button", {
|
|
2113
|
-
className:
|
|
2267
|
+
className: dn(),
|
|
2114
2268
|
type: "submit",
|
|
2115
2269
|
children: "Rename item"
|
|
2116
2270
|
})]
|
|
@@ -2118,7 +2272,7 @@ function mt({ adapter: e, initialPath: n = "/", density: i = "comfortable", read
|
|
|
2118
2272
|
]
|
|
2119
2273
|
})
|
|
2120
2274
|
}) : null,
|
|
2121
|
-
|
|
2275
|
+
H ? /* @__PURE__ */ T("div", {
|
|
2122
2276
|
"aria-label": "Delete selected items",
|
|
2123
2277
|
"aria-modal": "true",
|
|
2124
2278
|
className: `fixed inset-0 z-40 grid place-items-center bg-[color-mix(in_oklch,var(--fb-text)_20%,transparent)] p-4 ${Z}`,
|
|
@@ -2126,7 +2280,7 @@ function mt({ adapter: e, initialPath: n = "/", density: i = "comfortable", read
|
|
|
2126
2280
|
children: /* @__PURE__ */ E("form", {
|
|
2127
2281
|
className: `w-[min(400px,100%)] rounded-[var(--fb-radius)] border border-[var(--fb-border)] bg-[var(--fb-surface)] p-4 shadow-[0_18px_50px_color-mix(in_oklch,var(--fb-text)_18%,transparent)] ${Z}`,
|
|
2128
2282
|
onSubmit: (e) => {
|
|
2129
|
-
e.preventDefault(),
|
|
2283
|
+
e.preventDefault(), Ot();
|
|
2130
2284
|
},
|
|
2131
2285
|
children: [
|
|
2132
2286
|
/* @__PURE__ */ T("h2", {
|
|
@@ -2139,7 +2293,7 @@ function mt({ adapter: e, initialPath: n = "/", density: i = "comfortable", read
|
|
|
2139
2293
|
}),
|
|
2140
2294
|
/* @__PURE__ */ T("ul", {
|
|
2141
2295
|
className: `mt-3 max-h-32 overflow-auto rounded-[calc(var(--fb-radius)-3px)] border border-[var(--fb-border)] bg-[var(--fb-bg)] p-2 text-[12px] ${Z}`,
|
|
2142
|
-
children:
|
|
2296
|
+
children: D.selectedItems.map((e) => /* @__PURE__ */ T("li", {
|
|
2143
2297
|
className: "truncate py-1",
|
|
2144
2298
|
children: e.name
|
|
2145
2299
|
}, e.path))
|
|
@@ -2148,11 +2302,11 @@ function mt({ adapter: e, initialPath: n = "/", density: i = "comfortable", read
|
|
|
2148
2302
|
className: "mt-4 flex justify-end gap-2",
|
|
2149
2303
|
children: [/* @__PURE__ */ T("button", {
|
|
2150
2304
|
className: $(!1),
|
|
2151
|
-
onClick: () =>
|
|
2305
|
+
onClick: () => U(!1),
|
|
2152
2306
|
type: "button",
|
|
2153
2307
|
children: "Cancel"
|
|
2154
2308
|
}), /* @__PURE__ */ T("button", {
|
|
2155
|
-
className:
|
|
2309
|
+
className: fn(),
|
|
2156
2310
|
type: "submit",
|
|
2157
2311
|
children: "Delete selected"
|
|
2158
2312
|
})]
|
|
@@ -2160,7 +2314,7 @@ function mt({ adapter: e, initialPath: n = "/", density: i = "comfortable", read
|
|
|
2160
2314
|
]
|
|
2161
2315
|
})
|
|
2162
2316
|
}) : null,
|
|
2163
|
-
|
|
2317
|
+
W ? /* @__PURE__ */ T("div", {
|
|
2164
2318
|
"aria-label": "Move selected items",
|
|
2165
2319
|
"aria-modal": "true",
|
|
2166
2320
|
className: `fixed inset-0 z-40 grid place-items-center bg-[color-mix(in_oklch,var(--fb-text)_20%,transparent)] p-4 ${Z}`,
|
|
@@ -2168,7 +2322,7 @@ function mt({ adapter: e, initialPath: n = "/", density: i = "comfortable", read
|
|
|
2168
2322
|
children: /* @__PURE__ */ E("form", {
|
|
2169
2323
|
className: `w-[min(420px,100%)] rounded-[var(--fb-radius)] border border-[var(--fb-border)] bg-[var(--fb-surface)] p-4 shadow-[0_18px_50px_color-mix(in_oklch,var(--fb-text)_18%,transparent)] ${Z}`,
|
|
2170
2324
|
onSubmit: (e) => {
|
|
2171
|
-
e.preventDefault(),
|
|
2325
|
+
e.preventDefault(), jt();
|
|
2172
2326
|
},
|
|
2173
2327
|
children: [
|
|
2174
2328
|
/* @__PURE__ */ T("h2", {
|
|
@@ -2179,27 +2333,28 @@ function mt({ adapter: e, initialPath: n = "/", density: i = "comfortable", read
|
|
|
2179
2333
|
className: "mt-2 text-[12px] text-[var(--fb-muted)]",
|
|
2180
2334
|
children: "Choose a destination folder from the folder tree."
|
|
2181
2335
|
}),
|
|
2182
|
-
/* @__PURE__ */ T(
|
|
2183
|
-
currentPath:
|
|
2184
|
-
destinations:
|
|
2185
|
-
error:
|
|
2186
|
-
onSelect:
|
|
2187
|
-
|
|
2188
|
-
|
|
2336
|
+
/* @__PURE__ */ T(Lt, {
|
|
2337
|
+
currentPath: D.currentPath,
|
|
2338
|
+
destinations: we,
|
|
2339
|
+
error: Oe,
|
|
2340
|
+
onSelect: Ce,
|
|
2341
|
+
rootLabel: l,
|
|
2342
|
+
selectedPath: Se,
|
|
2343
|
+
status: Ee
|
|
2189
2344
|
}),
|
|
2190
2345
|
/* @__PURE__ */ E("div", {
|
|
2191
2346
|
className: "mt-3 truncate text-[11px] text-[var(--fb-muted)]",
|
|
2192
|
-
children: ["Destination: ",
|
|
2347
|
+
children: ["Destination: ", Se]
|
|
2193
2348
|
}),
|
|
2194
2349
|
/* @__PURE__ */ E("div", {
|
|
2195
2350
|
className: "mt-4 flex justify-end gap-2",
|
|
2196
2351
|
children: [/* @__PURE__ */ T("button", {
|
|
2197
2352
|
className: $(!1),
|
|
2198
|
-
onClick: () =>
|
|
2353
|
+
onClick: () => ye(!1),
|
|
2199
2354
|
type: "button",
|
|
2200
2355
|
children: "Cancel"
|
|
2201
2356
|
}), /* @__PURE__ */ T("button", {
|
|
2202
|
-
className:
|
|
2357
|
+
className: dn(),
|
|
2203
2358
|
type: "submit",
|
|
2204
2359
|
children: "Move here"
|
|
2205
2360
|
})]
|
|
@@ -2207,22 +2362,23 @@ function mt({ adapter: e, initialPath: n = "/", density: i = "comfortable", read
|
|
|
2207
2362
|
]
|
|
2208
2363
|
})
|
|
2209
2364
|
}) : null,
|
|
2210
|
-
|
|
2211
|
-
error:
|
|
2212
|
-
onClose: () =>
|
|
2365
|
+
be ? /* @__PURE__ */ T(It, {
|
|
2366
|
+
error: be,
|
|
2367
|
+
onClose: () => xe(null)
|
|
2213
2368
|
}) : null,
|
|
2214
|
-
|
|
2215
|
-
applyToAll:
|
|
2216
|
-
currentPath:
|
|
2217
|
-
onApplyToAllChange:
|
|
2369
|
+
je ? /* @__PURE__ */ T(Ft, {
|
|
2370
|
+
applyToAll: Pe,
|
|
2371
|
+
currentPath: D.currentPath,
|
|
2372
|
+
onApplyToAllChange: Fe,
|
|
2218
2373
|
onCancel: () => {
|
|
2219
|
-
|
|
2374
|
+
K(null), Fe(!1);
|
|
2220
2375
|
},
|
|
2221
|
-
onResolve: (e) =>
|
|
2222
|
-
queue:
|
|
2376
|
+
onResolve: (e) => kn(e),
|
|
2377
|
+
queue: je,
|
|
2378
|
+
resolutions: Qe
|
|
2223
2379
|
}) : null,
|
|
2224
|
-
|
|
2225
|
-
"aria-label": `Preview ${
|
|
2380
|
+
J ? /* @__PURE__ */ T("div", {
|
|
2381
|
+
"aria-label": `Preview ${J.item.name}`,
|
|
2226
2382
|
"aria-modal": "true",
|
|
2227
2383
|
className: `fixed inset-0 z-40 grid place-items-center bg-[color-mix(in_oklch,var(--fb-text)_35%,transparent)] p-4 ${Z}`,
|
|
2228
2384
|
role: "dialog",
|
|
@@ -2232,35 +2388,35 @@ function mt({ adapter: e, initialPath: n = "/", density: i = "comfortable", read
|
|
|
2232
2388
|
className: `flex h-12 items-center justify-between border-b border-[var(--fb-border)] px-4 ${Z}`,
|
|
2233
2389
|
children: [/* @__PURE__ */ E("div", {
|
|
2234
2390
|
className: "min-w-0 truncate font-semibold",
|
|
2235
|
-
children: ["Preview ",
|
|
2391
|
+
children: ["Preview ", J.item.name]
|
|
2236
2392
|
}), /* @__PURE__ */ E("div", {
|
|
2237
2393
|
className: "flex items-center gap-1",
|
|
2238
2394
|
children: [
|
|
2239
2395
|
/* @__PURE__ */ T("button", {
|
|
2240
2396
|
"aria-label": "Previous file",
|
|
2241
|
-
className:
|
|
2242
|
-
disabled:
|
|
2243
|
-
onClick: () =>
|
|
2397
|
+
className: un(!1),
|
|
2398
|
+
disabled: tt.length <= 1,
|
|
2399
|
+
onClick: () => gn(-1),
|
|
2244
2400
|
type: "button",
|
|
2245
|
-
children: /* @__PURE__ */ T(
|
|
2401
|
+
children: /* @__PURE__ */ T(ce, {
|
|
2246
2402
|
"aria-hidden": "true",
|
|
2247
2403
|
className: "size-4"
|
|
2248
2404
|
})
|
|
2249
2405
|
}),
|
|
2250
2406
|
/* @__PURE__ */ T("button", {
|
|
2251
2407
|
"aria-label": "Next file",
|
|
2252
|
-
className:
|
|
2253
|
-
disabled:
|
|
2254
|
-
onClick: () =>
|
|
2408
|
+
className: un(!1),
|
|
2409
|
+
disabled: tt.length <= 1,
|
|
2410
|
+
onClick: () => gn(1),
|
|
2255
2411
|
type: "button",
|
|
2256
|
-
children: /* @__PURE__ */ T(
|
|
2412
|
+
children: /* @__PURE__ */ T(le, {
|
|
2257
2413
|
"aria-hidden": "true",
|
|
2258
2414
|
className: "size-4"
|
|
2259
2415
|
})
|
|
2260
2416
|
}),
|
|
2261
2417
|
/* @__PURE__ */ T("button", {
|
|
2262
|
-
className:
|
|
2263
|
-
onClick: () =>
|
|
2418
|
+
className: un(!1),
|
|
2419
|
+
onClick: () => Ve(null),
|
|
2264
2420
|
type: "button",
|
|
2265
2421
|
children: "Close"
|
|
2266
2422
|
})
|
|
@@ -2268,34 +2424,34 @@ function mt({ adapter: e, initialPath: n = "/", density: i = "comfortable", read
|
|
|
2268
2424
|
})]
|
|
2269
2425
|
}), /* @__PURE__ */ T("div", {
|
|
2270
2426
|
className: `grid min-h-[260px] place-items-center bg-[var(--fb-bg)] p-8 ${Z}`,
|
|
2271
|
-
children:
|
|
2427
|
+
children: J.item.mimeType?.startsWith("image/") && J.url || J.item.thumbnailUrl ? /* @__PURE__ */ E("div", {
|
|
2272
2428
|
className: "text-center",
|
|
2273
2429
|
children: [/* @__PURE__ */ T("img", {
|
|
2274
|
-
alt:
|
|
2430
|
+
alt: J.item.name,
|
|
2275
2431
|
className: `max-h-[420px] max-w-full rounded-[calc(var(--fb-radius)-2px)] object-contain ${Z}`,
|
|
2276
|
-
src:
|
|
2277
|
-
}), /* @__PURE__ */ T(
|
|
2432
|
+
src: J.url ?? J.item.thumbnailUrl
|
|
2433
|
+
}), /* @__PURE__ */ T(Ut, { preview: J })]
|
|
2278
2434
|
}) : /* @__PURE__ */ E("div", {
|
|
2279
2435
|
className: "text-center",
|
|
2280
2436
|
children: [
|
|
2281
|
-
/* @__PURE__ */ T(
|
|
2437
|
+
/* @__PURE__ */ T(ue, { className: "mx-auto size-12 text-[var(--fb-muted)]" }),
|
|
2282
2438
|
/* @__PURE__ */ T("div", {
|
|
2283
2439
|
className: "mt-3 font-semibold",
|
|
2284
|
-
children:
|
|
2440
|
+
children: J.item.name
|
|
2285
2441
|
}),
|
|
2286
2442
|
/* @__PURE__ */ T("div", {
|
|
2287
2443
|
className: "mt-1 text-[12px] text-[var(--fb-muted)]",
|
|
2288
|
-
children:
|
|
2444
|
+
children: J.item.mimeType ?? "File"
|
|
2289
2445
|
}),
|
|
2290
|
-
|
|
2446
|
+
J.status === "loading" ? /* @__PURE__ */ T("div", {
|
|
2291
2447
|
className: "mt-3 text-[12px] text-[var(--fb-muted)]",
|
|
2292
2448
|
children: "Loading preview"
|
|
2293
2449
|
}) : null,
|
|
2294
|
-
|
|
2450
|
+
J.status === "error" ? /* @__PURE__ */ T("div", {
|
|
2295
2451
|
className: "mt-3 text-[12px] text-[var(--fb-danger)]",
|
|
2296
|
-
children:
|
|
2452
|
+
children: J.error ?? "Could not load preview"
|
|
2297
2453
|
}) : null,
|
|
2298
|
-
/* @__PURE__ */ T(
|
|
2454
|
+
/* @__PURE__ */ T(Ut, { preview: J })
|
|
2299
2455
|
]
|
|
2300
2456
|
})
|
|
2301
2457
|
})]
|
|
@@ -2304,10 +2460,10 @@ function mt({ adapter: e, initialPath: n = "/", density: i = "comfortable", read
|
|
|
2304
2460
|
]
|
|
2305
2461
|
});
|
|
2306
2462
|
}
|
|
2307
|
-
function
|
|
2463
|
+
function xt(t, n) {
|
|
2308
2464
|
return n.split("/").filter(Boolean).reduce((t, n) => e(t, n), t);
|
|
2309
2465
|
}
|
|
2310
|
-
function
|
|
2466
|
+
function St(e) {
|
|
2311
2467
|
let t = /* @__PURE__ */ new Set();
|
|
2312
2468
|
for (let { relativePath: n } of e) {
|
|
2313
2469
|
let e = n.split("/").filter(Boolean);
|
|
@@ -2315,22 +2471,22 @@ function gt(e) {
|
|
|
2315
2471
|
}
|
|
2316
2472
|
return Array.from(t).sort((e, t) => e.split("/").length - t.split("/").length || e.localeCompare(t));
|
|
2317
2473
|
}
|
|
2318
|
-
function
|
|
2474
|
+
function Ct(e, t) {
|
|
2319
2475
|
let n = [], r = [];
|
|
2320
2476
|
for (let i of e) t(i) ? n.push(i) : r.push(i);
|
|
2321
2477
|
return [n, r];
|
|
2322
2478
|
}
|
|
2323
|
-
function
|
|
2324
|
-
if (
|
|
2479
|
+
function wt(e, t, n = 0) {
|
|
2480
|
+
if (St(t).length === 0) return;
|
|
2325
2481
|
let r = t.map((e) => e.relativePath.split("/").filter(Boolean)[0]).filter((e) => !!e), i = Array.from(new Set(r)), o = i.length === 1 ? i[0] : "Folder upload";
|
|
2326
2482
|
return {
|
|
2327
|
-
id: i.length === 1 ?
|
|
2483
|
+
id: i.length === 1 ? xt(e, o) : `${a(e)}#folder-upload`,
|
|
2328
2484
|
name: o,
|
|
2329
2485
|
totalFiles: t.length,
|
|
2330
2486
|
createdFolders: n
|
|
2331
2487
|
};
|
|
2332
2488
|
}
|
|
2333
|
-
async function
|
|
2489
|
+
async function Tt(e, t) {
|
|
2334
2490
|
let n = [], r = t.map(a);
|
|
2335
2491
|
async function i(t, a) {
|
|
2336
2492
|
let o;
|
|
@@ -2339,7 +2495,7 @@ async function yt(e, t) {
|
|
|
2339
2495
|
numeric: !0,
|
|
2340
2496
|
sensitivity: "base"
|
|
2341
2497
|
}));
|
|
2342
|
-
for (let e of c)
|
|
2498
|
+
for (let e of c) Et(e.path, r) || (n.push({
|
|
2343
2499
|
path: e.path,
|
|
2344
2500
|
name: e.name,
|
|
2345
2501
|
depth: a
|
|
@@ -2349,11 +2505,11 @@ async function yt(e, t) {
|
|
|
2349
2505
|
}
|
|
2350
2506
|
return await i("/", 0), n;
|
|
2351
2507
|
}
|
|
2352
|
-
function
|
|
2508
|
+
function Et(e, t) {
|
|
2353
2509
|
let n = a(e);
|
|
2354
2510
|
return t.some((e) => n === e || n.startsWith(`${e}/`));
|
|
2355
2511
|
}
|
|
2356
|
-
function
|
|
2512
|
+
function Dt(e, t, n) {
|
|
2357
2513
|
if (!t) return {
|
|
2358
2514
|
acceptedCandidates: e,
|
|
2359
2515
|
rejectedCandidates: []
|
|
@@ -2361,7 +2517,7 @@ function xt(e, t, n) {
|
|
|
2361
2517
|
let r = [], i = [], a = 0;
|
|
2362
2518
|
for (let o of e) {
|
|
2363
2519
|
let e = [];
|
|
2364
|
-
t.maxFileSizeBytes !== void 0 && o.file.size > t.maxFileSizeBytes && e.push(`File is larger than ${
|
|
2520
|
+
t.maxFileSizeBytes !== void 0 && o.file.size > t.maxFileSizeBytes && e.push(`File is larger than ${rn(t.maxFileSizeBytes)}`), t.allowedMimeTypes?.length && !Ot(o.file, t.allowedMimeTypes) && e.push(`File type ${o.file.type || "unknown"} is not allowed`), t.remainingQuotaBytes !== void 0 && a + o.file.size > t.remainingQuotaBytes && e.push(`Upload exceeds remaining quota of ${rn(t.remainingQuotaBytes)}`);
|
|
2365
2521
|
let s = t.validate?.(o, {
|
|
2366
2522
|
acceptedBytes: a,
|
|
2367
2523
|
currentPath: n
|
|
@@ -2381,122 +2537,141 @@ function xt(e, t, n) {
|
|
|
2381
2537
|
rejectedCandidates: i
|
|
2382
2538
|
};
|
|
2383
2539
|
}
|
|
2384
|
-
function
|
|
2540
|
+
function Ot(e, t) {
|
|
2385
2541
|
return t.some((t) => t.endsWith("/*") ? e.type.startsWith(t.slice(0, -1)) : t.startsWith(".") ? e.name.toLowerCase().endsWith(t.toLowerCase()) : e.type === t);
|
|
2386
2542
|
}
|
|
2387
|
-
function
|
|
2388
|
-
let [
|
|
2389
|
-
function
|
|
2543
|
+
function kt({ browser: e, canMove: t, folderDropTargetPath: n, inlineRenameError: r, inlineRenameLabel: i, inlineRenameItem: a, inlineRenameValue: o, selectedPaths: s, onContextMenu: c, onDragEnd: l, onDragStart: u, onEmptyClick: d, onFolderDragOver: f, onFolderDrop: p, onInlineRenameCancel: m, onInlineRenameChange: h, onInlineRenameCommit: g, onOpenItem: _, onSelectItem: v, onTouchMenu: y, renderItemMeta: x, rootLabel: C }) {
|
|
2544
|
+
let [ee, te] = b(null);
|
|
2545
|
+
function ne(t) {
|
|
2390
2546
|
let n = t.inputEvent, r = t.selected.map((e) => e.getAttribute("data-fb-path")).filter((e) => !!e);
|
|
2391
2547
|
e.setSelection(r, { additive: !!(n?.shiftKey || n?.metaKey || n?.ctrlKey) });
|
|
2392
2548
|
}
|
|
2393
|
-
return /* @__PURE__ */ E(w, { children: [
|
|
2549
|
+
return /* @__PURE__ */ E(w, { children: [ee ? /* @__PURE__ */ T(S, {
|
|
2394
2550
|
className: "[background:var(--fb-accent-soft)!important] [border-color:var(--fb-accent)!important]",
|
|
2395
|
-
container:
|
|
2396
|
-
dragContainer:
|
|
2551
|
+
container: ee,
|
|
2552
|
+
dragContainer: ee,
|
|
2397
2553
|
hitRate: 10,
|
|
2398
|
-
onSelect:
|
|
2554
|
+
onSelect: ne,
|
|
2399
2555
|
preventClickEventOnDrag: !0,
|
|
2400
2556
|
selectByClick: !1,
|
|
2401
|
-
selectableTargets: [() => Array.from(
|
|
2557
|
+
selectableTargets: [() => Array.from(ee.querySelectorAll("[data-fb-selectable='true']"))],
|
|
2402
2558
|
selectFromInside: !1
|
|
2403
2559
|
}) : null, /* @__PURE__ */ T("div", {
|
|
2404
|
-
"aria-label":
|
|
2560
|
+
"aria-label": C,
|
|
2405
2561
|
className: "relative grid min-h-full content-start grid-cols-[repeat(auto-fill,minmax(var(--fb-card-min),1fr))] gap-[var(--fb-grid-gap)]",
|
|
2406
2562
|
onClick: (e) => {
|
|
2407
|
-
e.target === e.currentTarget && !
|
|
2563
|
+
e.target === e.currentTarget && !Jt(e) && d();
|
|
2408
2564
|
},
|
|
2409
|
-
ref:
|
|
2565
|
+
ref: te,
|
|
2410
2566
|
role: "grid",
|
|
2411
|
-
children: e.filteredItems.map((e) => /* @__PURE__ */ T(
|
|
2567
|
+
children: e.filteredItems.map((e) => /* @__PURE__ */ T(At, {
|
|
2412
2568
|
canMove: t,
|
|
2569
|
+
dropTarget: n === e.path,
|
|
2413
2570
|
item: e,
|
|
2414
|
-
onOpen: () =>
|
|
2415
|
-
onContextMenu: (t) =>
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2571
|
+
onOpen: () => _(e),
|
|
2572
|
+
onContextMenu: (t) => c(e, t),
|
|
2573
|
+
onDragEnd: l,
|
|
2574
|
+
onDragStart: (t) => u(e, t),
|
|
2575
|
+
onFolderDragOver: (t) => f(e, t),
|
|
2576
|
+
onFolderDrop: (t) => p(e, t),
|
|
2577
|
+
inlineRenameError: r,
|
|
2578
|
+
inlineRenameLabel: i,
|
|
2579
|
+
inlineRenameValue: o,
|
|
2580
|
+
isRenaming: a?.path === e.path,
|
|
2581
|
+
onInlineRenameCancel: m,
|
|
2582
|
+
onInlineRenameChange: h,
|
|
2583
|
+
onInlineRenameCommit: g,
|
|
2584
|
+
onSelect: (t) => v(e.path, t),
|
|
2585
|
+
onTouchMenu: () => y(e),
|
|
2586
|
+
renderItemMeta: x,
|
|
2587
|
+
selected: s.includes(e.path)
|
|
2429
2588
|
}, e.path))
|
|
2430
2589
|
})] });
|
|
2431
2590
|
}
|
|
2432
|
-
function
|
|
2433
|
-
let
|
|
2434
|
-
function
|
|
2435
|
-
|
|
2591
|
+
function At({ canMove: e, dropTarget: t, inlineRenameError: n, inlineRenameLabel: r, inlineRenameValue: i, isRenaming: a, item: o, selected: s, onSelect: c, onOpen: l, onContextMenu: u, onDragEnd: d, onDragStart: f, onFolderDragOver: p, onFolderDrop: m, onInlineRenameCancel: h, onInlineRenameChange: g, onInlineRenameCommit: _, onTouchMenu: v, renderItemMeta: b }) {
|
|
2592
|
+
let x = y(null);
|
|
2593
|
+
function S() {
|
|
2594
|
+
x.current &&= (clearTimeout(x.current), null);
|
|
2436
2595
|
}
|
|
2437
|
-
function
|
|
2438
|
-
|
|
2439
|
-
|
|
2596
|
+
function C() {
|
|
2597
|
+
S(), x.current = setTimeout(() => {
|
|
2598
|
+
x.current = null, v();
|
|
2440
2599
|
}, 520);
|
|
2441
2600
|
}
|
|
2442
2601
|
return /* @__PURE__ */ E("article", {
|
|
2443
|
-
"aria-selected":
|
|
2444
|
-
"data-fb-
|
|
2602
|
+
"aria-selected": s,
|
|
2603
|
+
"data-fb-drop-target": t ? "true" : void 0,
|
|
2604
|
+
"data-fb-path": o.path,
|
|
2445
2605
|
"data-fb-selectable": "true",
|
|
2446
2606
|
draggable: e,
|
|
2447
|
-
className: `group relative flex min-h-[var(--fb-card-minh)] cursor-default flex-col rounded-[calc(var(--fb-radius)-1px)] border p-[var(--fb-card-pad)] outline-none hover:shadow-[0_8px_22px_color-mix(in_oklch,var(--fb-text)_8%,transparent)] focus:ring-2 focus:ring-[var(--fb-accent-soft)] ${Z} ${
|
|
2448
|
-
onClick:
|
|
2449
|
-
onContextMenu:
|
|
2450
|
-
onDoubleClick:
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2607
|
+
className: `group relative flex min-h-[var(--fb-card-minh)] cursor-default flex-col rounded-[calc(var(--fb-radius)-1px)] border p-[var(--fb-card-pad)] outline-none hover:shadow-[0_8px_22px_color-mix(in_oklch,var(--fb-text)_8%,transparent)] focus:ring-2 focus:ring-[var(--fb-accent-soft)] ${Z} ${t ? "border-[var(--fb-accent)] bg-[var(--fb-accent-soft)] ring-2 ring-[var(--fb-accent)] ring-offset-2 ring-offset-[var(--fb-surface)]" : s ? "border-[var(--fb-accent)] bg-[var(--fb-accent-soft)]" : "border-[var(--fb-border)] bg-[var(--fb-surface)] hover:border-[var(--fb-border-strong)]"}`,
|
|
2608
|
+
onClick: c,
|
|
2609
|
+
onContextMenu: u,
|
|
2610
|
+
onDoubleClick: l,
|
|
2611
|
+
onDragEnd: e ? d : void 0,
|
|
2612
|
+
onDragOver: o.kind === "folder" ? p : void 0,
|
|
2613
|
+
onDragStart: e ? f : void 0,
|
|
2614
|
+
onDrop: o.kind === "folder" ? m : void 0,
|
|
2615
|
+
onTouchCancel: S,
|
|
2616
|
+
onTouchEnd: S,
|
|
2617
|
+
onTouchMove: S,
|
|
2618
|
+
onTouchStart: C,
|
|
2458
2619
|
role: "gridcell",
|
|
2459
2620
|
tabIndex: 0,
|
|
2460
2621
|
children: [
|
|
2461
2622
|
/* @__PURE__ */ T("span", {
|
|
2462
2623
|
"aria-hidden": "true",
|
|
2463
|
-
className: `absolute right-2 top-2 grid size-4 place-items-center rounded border text-[10px] ${X} ${
|
|
2464
|
-
children:
|
|
2624
|
+
className: `absolute right-2 top-2 grid size-4 place-items-center rounded border text-[10px] ${X} ${s ? "border-[var(--fb-accent)] bg-[var(--fb-accent)] text-[var(--fb-surface)]" : "border-[var(--fb-border)] bg-[var(--fb-surface)] opacity-0 group-hover:opacity-100"}`,
|
|
2625
|
+
children: s ? "✓" : ""
|
|
2465
2626
|
}),
|
|
2466
2627
|
/* @__PURE__ */ T("div", {
|
|
2467
2628
|
className: `grid h-[var(--fb-thumb-h)] place-items-center rounded-[calc(var(--fb-radius)-3px)] bg-[var(--fb-surface-2)] group-hover:bg-[var(--fb-bg)] ${X}`,
|
|
2468
|
-
children:
|
|
2629
|
+
children: o.kind === "folder" ? /* @__PURE__ */ T(de, {
|
|
2469
2630
|
"aria-hidden": "true",
|
|
2470
2631
|
className: "size-9 text-[var(--fb-folder)]"
|
|
2471
|
-
}) : /* @__PURE__ */ T(
|
|
2632
|
+
}) : /* @__PURE__ */ T(ue, {
|
|
2472
2633
|
"aria-hidden": "true",
|
|
2473
2634
|
className: "size-9 text-[var(--fb-muted)]"
|
|
2474
2635
|
})
|
|
2475
2636
|
}),
|
|
2476
|
-
|
|
2477
|
-
item:
|
|
2478
|
-
error:
|
|
2479
|
-
label:
|
|
2480
|
-
onCancel:
|
|
2481
|
-
onChange:
|
|
2482
|
-
onCommit:
|
|
2483
|
-
value:
|
|
2637
|
+
a ? /* @__PURE__ */ T(Mt, {
|
|
2638
|
+
item: o,
|
|
2639
|
+
error: n,
|
|
2640
|
+
label: r,
|
|
2641
|
+
onCancel: h,
|
|
2642
|
+
onChange: g,
|
|
2643
|
+
onCommit: _,
|
|
2644
|
+
value: i
|
|
2484
2645
|
}) : /* @__PURE__ */ T("button", {
|
|
2485
2646
|
className: `mt-2 min-w-0 truncate text-left text-[12.5px] font-semibold text-[var(--fb-text)] outline-none ${X}`,
|
|
2486
2647
|
onClick: (e) => {
|
|
2487
|
-
e.stopPropagation(),
|
|
2648
|
+
e.stopPropagation(), c(e);
|
|
2488
2649
|
},
|
|
2489
2650
|
type: "button",
|
|
2490
|
-
children:
|
|
2651
|
+
children: o.name
|
|
2491
2652
|
}),
|
|
2492
2653
|
/* @__PURE__ */ T("div", {
|
|
2493
2654
|
className: "mt-1 text-[11px] text-[var(--fb-muted)]",
|
|
2494
|
-
children:
|
|
2655
|
+
children: o.kind === "folder" ? "Folder" : rn(o.size ?? 0)
|
|
2656
|
+
}),
|
|
2657
|
+
/* @__PURE__ */ T(jt, {
|
|
2658
|
+
item: o,
|
|
2659
|
+
renderItemMeta: b,
|
|
2660
|
+
view: "grid"
|
|
2495
2661
|
})
|
|
2496
2662
|
]
|
|
2497
2663
|
});
|
|
2498
2664
|
}
|
|
2499
|
-
function
|
|
2665
|
+
function jt({ item: e, renderItemMeta: t, view: n }) {
|
|
2666
|
+
if (!t) return null;
|
|
2667
|
+
let r = t(e, { view: n });
|
|
2668
|
+
return r == null || r === !1 ? null : /* @__PURE__ */ T("div", {
|
|
2669
|
+
className: "mt-1 min-w-0 text-[11px]",
|
|
2670
|
+
"data-fb-item-meta": n,
|
|
2671
|
+
children: r
|
|
2672
|
+
});
|
|
2673
|
+
}
|
|
2674
|
+
function Mt({ error: e, item: t, label: n, onCancel: r, onChange: i, onCommit: a, value: o }) {
|
|
2500
2675
|
return /* @__PURE__ */ E("div", {
|
|
2501
2676
|
className: "min-w-0",
|
|
2502
2677
|
children: [/* @__PURE__ */ T("input", {
|
|
@@ -2518,9 +2693,9 @@ function Tt({ error: e, item: t, label: n, onCancel: r, onChange: i, onCommit: a
|
|
|
2518
2693
|
}) : null]
|
|
2519
2694
|
});
|
|
2520
2695
|
}
|
|
2521
|
-
function
|
|
2696
|
+
function Nt({ browser: e, canMove: t, folderDropTargetPath: n, inlineRenameError: r, inlineRenameLabel: i, inlineRenameItem: a, inlineRenameValue: o, selectedPaths: s, onContextMenu: c, onDragEnd: l, onDragStart: u, onFolderDragOver: d, onFolderDrop: f, onInlineRenameCancel: p, onInlineRenameChange: m, onInlineRenameCommit: h, onOpenItem: g, onSelectItem: _, renderItemMeta: v, rootLabel: y }) {
|
|
2522
2697
|
return /* @__PURE__ */ E("table", {
|
|
2523
|
-
"aria-label":
|
|
2698
|
+
"aria-label": y,
|
|
2524
2699
|
className: `w-full border-separate border-spacing-0 overflow-hidden rounded-[var(--fb-radius)] border border-[var(--fb-border)] bg-[var(--fb-surface)] text-left ${Z}`,
|
|
2525
2700
|
children: [/* @__PURE__ */ T("thead", {
|
|
2526
2701
|
className: "text-[11px] text-[var(--fb-muted)]",
|
|
@@ -2539,43 +2714,52 @@ function Et({ browser: e, canMove: t, inlineRenameError: n, inlineRenameLabel: r
|
|
|
2539
2714
|
})
|
|
2540
2715
|
] })
|
|
2541
2716
|
}), /* @__PURE__ */ T("tbody", { children: e.filteredItems.map((e) => /* @__PURE__ */ E("tr", {
|
|
2542
|
-
"aria-selected":
|
|
2717
|
+
"aria-selected": s.includes(e.path),
|
|
2718
|
+
"data-fb-drop-target": n === e.path ? "true" : void 0,
|
|
2543
2719
|
"data-fb-path": e.path,
|
|
2544
|
-
className:
|
|
2720
|
+
className: n === e.path ? `bg-[var(--fb-accent-soft)] ring-2 ring-inset ring-[var(--fb-accent)] ${X}` : s.includes(e.path) ? `bg-[var(--fb-accent-soft)] outline-none focus:ring-2 focus:ring-[var(--fb-accent-soft)] ${X}` : `outline-none hover:bg-[var(--fb-bg)] focus:ring-2 focus:ring-[var(--fb-accent-soft)] ${X}`,
|
|
2545
2721
|
draggable: t,
|
|
2546
|
-
onClick: (t) =>
|
|
2547
|
-
onContextMenu: (t) =>
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2722
|
+
onClick: (t) => _(e.path, t),
|
|
2723
|
+
onContextMenu: (t) => c(e, t),
|
|
2724
|
+
onDragEnd: l,
|
|
2725
|
+
onDragOver: (t) => d(e, t),
|
|
2726
|
+
onDragStart: (t) => u(e, t),
|
|
2727
|
+
onDrop: (t) => f(e, t),
|
|
2728
|
+
onDoubleClick: () => g(e),
|
|
2552
2729
|
tabIndex: 0,
|
|
2553
2730
|
children: [
|
|
2554
2731
|
/* @__PURE__ */ T("td", {
|
|
2555
2732
|
className: "border-b border-[var(--fb-border)] px-[var(--fb-cell-x)] py-[var(--fb-cell-y)]",
|
|
2556
2733
|
children: /* @__PURE__ */ E("div", {
|
|
2557
|
-
className: "flex min-w-0 items-
|
|
2558
|
-
children: [e.kind === "folder" ? /* @__PURE__ */ T(
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2734
|
+
className: "flex min-w-0 items-start gap-2",
|
|
2735
|
+
children: [e.kind === "folder" ? /* @__PURE__ */ T(de, { className: "mt-0.5 size-4 shrink-0 text-[var(--fb-folder)]" }) : /* @__PURE__ */ T(ue, { className: "mt-0.5 size-4 shrink-0 text-[var(--fb-muted)]" }), /* @__PURE__ */ E("div", {
|
|
2736
|
+
className: "min-w-0",
|
|
2737
|
+
children: [a?.path === e.path ? /* @__PURE__ */ T(Mt, {
|
|
2738
|
+
item: e,
|
|
2739
|
+
error: r,
|
|
2740
|
+
label: i,
|
|
2741
|
+
onCancel: p,
|
|
2742
|
+
onChange: m,
|
|
2743
|
+
onCommit: h,
|
|
2744
|
+
value: o
|
|
2745
|
+
}) : /* @__PURE__ */ T("button", {
|
|
2746
|
+
className: `block max-w-full truncate font-medium ${X}`,
|
|
2747
|
+
onClick: (t) => {
|
|
2748
|
+
t.stopPropagation(), _(e.path, t);
|
|
2749
|
+
},
|
|
2750
|
+
type: "button",
|
|
2751
|
+
children: e.name
|
|
2752
|
+
}), /* @__PURE__ */ T(jt, {
|
|
2753
|
+
item: e,
|
|
2754
|
+
renderItemMeta: v,
|
|
2755
|
+
view: "list"
|
|
2756
|
+
})]
|
|
2573
2757
|
})]
|
|
2574
2758
|
})
|
|
2575
2759
|
}),
|
|
2576
2760
|
/* @__PURE__ */ T("td", {
|
|
2577
2761
|
className: "border-b border-[var(--fb-border)] px-[var(--fb-cell-x)] py-[var(--fb-cell-y)] text-[12px] text-[var(--fb-muted)]",
|
|
2578
|
-
children: e.kind === "folder" ? "Folder" :
|
|
2762
|
+
children: e.kind === "folder" ? "Folder" : rn(e.size ?? 0)
|
|
2579
2763
|
}),
|
|
2580
2764
|
/* @__PURE__ */ T("td", {
|
|
2581
2765
|
className: "border-b border-[var(--fb-border)] px-[var(--fb-cell-x)] py-[var(--fb-cell-y)] text-[12px] text-[var(--fb-muted)]",
|
|
@@ -2585,61 +2769,61 @@ function Et({ browser: e, canMove: t, inlineRenameError: n, inlineRenameLabel: r
|
|
|
2585
2769
|
}, e.path)) })]
|
|
2586
2770
|
});
|
|
2587
2771
|
}
|
|
2588
|
-
function
|
|
2589
|
-
let
|
|
2590
|
-
function
|
|
2591
|
-
e(),
|
|
2772
|
+
function Pt({ browser: e, canDownload: t, menu: n, onClose: r, onDelete: i, onDownload: a, onCopy: o, onCopyPath: s, onCut: c, onMove: l, onNewFolder: u, onPaste: d, onRename: f, onUpload: p, readOnly: m }) {
|
|
2773
|
+
let h = n.target === "item", g = n.mode === "sheet";
|
|
2774
|
+
function _(e) {
|
|
2775
|
+
e(), r();
|
|
2592
2776
|
}
|
|
2593
2777
|
return /* @__PURE__ */ E("div", {
|
|
2594
|
-
"aria-label":
|
|
2595
|
-
className: `fixed z-50 rounded-[calc(var(--fb-radius)-2px)] border border-[var(--fb-border)] bg-[var(--fb-surface)] p-1 text-[12px] text-[var(--fb-text)] shadow-[0_16px_44px_color-mix(in_oklch,var(--fb-text)_16%,transparent)] ${Z} ${
|
|
2596
|
-
"data-fb-menu":
|
|
2778
|
+
"aria-label": h ? "Item actions" : "Folder actions",
|
|
2779
|
+
className: `fixed z-50 rounded-[calc(var(--fb-radius)-2px)] border border-[var(--fb-border)] bg-[var(--fb-surface)] p-1 text-[12px] text-[var(--fb-text)] shadow-[0_16px_44px_color-mix(in_oklch,var(--fb-text)_16%,transparent)] ${Z} ${g ? "inset-x-3 bottom-3 max-h-[80vh] overflow-auto" : "min-w-40"}`,
|
|
2780
|
+
"data-fb-menu": g ? "sheet" : "context",
|
|
2597
2781
|
role: "menu",
|
|
2598
|
-
style:
|
|
2599
|
-
left:
|
|
2600
|
-
top:
|
|
2782
|
+
style: g ? void 0 : {
|
|
2783
|
+
left: n.x,
|
|
2784
|
+
top: n.y
|
|
2601
2785
|
},
|
|
2602
2786
|
children: [
|
|
2603
|
-
|
|
2604
|
-
onClick: () =>
|
|
2787
|
+
h && !m && e.capabilities.rename ? /* @__PURE__ */ T(Q, {
|
|
2788
|
+
onClick: () => _(() => f(n.item)),
|
|
2605
2789
|
children: "Rename"
|
|
2606
2790
|
}) : null,
|
|
2607
|
-
|
|
2608
|
-
onClick: () =>
|
|
2791
|
+
h && !m && e.capabilities.move ? /* @__PURE__ */ T(Q, {
|
|
2792
|
+
onClick: () => _(l),
|
|
2609
2793
|
children: "Move"
|
|
2610
2794
|
}) : null,
|
|
2611
|
-
|
|
2612
|
-
onClick: () =>
|
|
2795
|
+
h && !m && e.capabilities.copy ? /* @__PURE__ */ T(Q, {
|
|
2796
|
+
onClick: () => _(o),
|
|
2613
2797
|
children: "Copy"
|
|
2614
2798
|
}) : null,
|
|
2615
|
-
|
|
2616
|
-
onClick: () =>
|
|
2799
|
+
h && !m && e.capabilities.move ? /* @__PURE__ */ T(Q, {
|
|
2800
|
+
onClick: () => _(c),
|
|
2617
2801
|
children: "Cut"
|
|
2618
2802
|
}) : null,
|
|
2619
|
-
|
|
2803
|
+
h ? /* @__PURE__ */ E(w, { children: [
|
|
2620
2804
|
/* @__PURE__ */ T(Q, {
|
|
2621
|
-
onClick: () =>
|
|
2622
|
-
children: e.selectedPaths.includes(
|
|
2805
|
+
onClick: () => _(() => s(n.item)),
|
|
2806
|
+
children: e.selectedPaths.includes(n.item.path) && e.selectedPaths.length > 1 ? "Copy paths" : "Copy path"
|
|
2623
2807
|
}),
|
|
2624
|
-
/* @__PURE__ */ T(Q, {
|
|
2625
|
-
onClick: () =>
|
|
2808
|
+
t ? /* @__PURE__ */ T(Q, {
|
|
2809
|
+
onClick: () => _(a),
|
|
2626
2810
|
children: "Download"
|
|
2627
|
-
}),
|
|
2628
|
-
|
|
2811
|
+
}) : null,
|
|
2812
|
+
m ? null : /* @__PURE__ */ T(Q, {
|
|
2629
2813
|
danger: !0,
|
|
2630
2814
|
onClick: () => {
|
|
2631
|
-
|
|
2815
|
+
i(), r();
|
|
2632
2816
|
},
|
|
2633
2817
|
children: "Delete"
|
|
2634
2818
|
})
|
|
2635
|
-
] }) : /* @__PURE__ */ E(w, { children: [
|
|
2636
|
-
onClick: () =>
|
|
2819
|
+
] }) : /* @__PURE__ */ E(w, { children: [m ? null : /* @__PURE__ */ E(w, { children: [e.capabilities.createFolder ? /* @__PURE__ */ T(Q, {
|
|
2820
|
+
onClick: () => _(u),
|
|
2637
2821
|
children: "New folder"
|
|
2638
2822
|
}) : null, /* @__PURE__ */ T(Q, {
|
|
2639
|
-
onClick: () =>
|
|
2823
|
+
onClick: () => _(p),
|
|
2640
2824
|
children: "Upload"
|
|
2641
|
-
})] }), !
|
|
2642
|
-
onClick: () =>
|
|
2825
|
+
})] }), !m && e.clipboard ? /* @__PURE__ */ T(Q, {
|
|
2826
|
+
onClick: () => _(d),
|
|
2643
2827
|
children: "Paste here"
|
|
2644
2828
|
}) : null] })
|
|
2645
2829
|
]
|
|
@@ -2654,8 +2838,8 @@ function Q({ children: e, danger: t, onClick: n }) {
|
|
|
2654
2838
|
children: e
|
|
2655
2839
|
});
|
|
2656
2840
|
}
|
|
2657
|
-
function
|
|
2658
|
-
let
|
|
2841
|
+
function Ft({ applyToAll: e, currentPath: t, onApplyToAllChange: n, onCancel: r, onResolve: i, queue: a, resolutions: o }) {
|
|
2842
|
+
let s = a.candidates[a.index], c = xt(t, s.relativePath), l = a.conflictPaths.indexOf(c) + 1;
|
|
2659
2843
|
return /* @__PURE__ */ T("div", {
|
|
2660
2844
|
"aria-label": "File conflict",
|
|
2661
2845
|
"aria-modal": "true",
|
|
@@ -2670,13 +2854,13 @@ function Ot({ applyToAll: e, currentPath: t, onApplyToAllChange: n, onCancel: r,
|
|
|
2670
2854
|
}),
|
|
2671
2855
|
/* @__PURE__ */ E("p", {
|
|
2672
2856
|
className: "mt-2 text-[12px] text-[var(--fb-muted)]",
|
|
2673
|
-
children: [
|
|
2857
|
+
children: [s.relativePath, " already exists in this folder."]
|
|
2674
2858
|
}),
|
|
2675
2859
|
/* @__PURE__ */ E("div", {
|
|
2676
2860
|
className: `mt-3 rounded-[calc(var(--fb-radius)-3px)] border border-[var(--fb-border)] bg-[var(--fb-bg)] p-2 text-[12px] ${Z}`,
|
|
2677
2861
|
children: [
|
|
2678
2862
|
"Conflict ",
|
|
2679
|
-
|
|
2863
|
+
l,
|
|
2680
2864
|
" of ",
|
|
2681
2865
|
a.conflictPaths.length
|
|
2682
2866
|
]
|
|
@@ -2691,38 +2875,23 @@ function Ot({ applyToAll: e, currentPath: t, onApplyToAllChange: n, onCancel: r,
|
|
|
2691
2875
|
}),
|
|
2692
2876
|
/* @__PURE__ */ E("div", {
|
|
2693
2877
|
className: "mt-4 flex flex-wrap justify-end gap-2",
|
|
2694
|
-
children: [
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
children: "Skip"
|
|
2706
|
-
}),
|
|
2707
|
-
/* @__PURE__ */ T("button", {
|
|
2708
|
-
className: $(!1),
|
|
2709
|
-
onClick: () => i("replace"),
|
|
2710
|
-
type: "button",
|
|
2711
|
-
children: "Replace"
|
|
2712
|
-
}),
|
|
2713
|
-
/* @__PURE__ */ T("button", {
|
|
2714
|
-
className: en(),
|
|
2715
|
-
onClick: () => i("keep-both"),
|
|
2716
|
-
type: "button",
|
|
2717
|
-
children: "Keep both"
|
|
2718
|
-
})
|
|
2719
|
-
]
|
|
2878
|
+
children: [/* @__PURE__ */ T("button", {
|
|
2879
|
+
className: $(!1),
|
|
2880
|
+
onClick: r,
|
|
2881
|
+
type: "button",
|
|
2882
|
+
children: "Cancel"
|
|
2883
|
+
}), o.map((e) => /* @__PURE__ */ T("button", {
|
|
2884
|
+
className: e === "keep-both" ? dn() : $(!1),
|
|
2885
|
+
onClick: () => i(e),
|
|
2886
|
+
type: "button",
|
|
2887
|
+
children: sn(e)
|
|
2888
|
+
}, e))]
|
|
2720
2889
|
})
|
|
2721
2890
|
]
|
|
2722
2891
|
})
|
|
2723
2892
|
});
|
|
2724
2893
|
}
|
|
2725
|
-
function
|
|
2894
|
+
function It({ error: e, onClose: t }) {
|
|
2726
2895
|
let n = e.succeededPaths.length;
|
|
2727
2896
|
return /* @__PURE__ */ T("div", {
|
|
2728
2897
|
"aria-label": "Partial bulk failure",
|
|
@@ -2761,7 +2930,7 @@ function kt({ error: e, onClose: t }) {
|
|
|
2761
2930
|
/* @__PURE__ */ T("div", {
|
|
2762
2931
|
className: "mt-4 flex justify-end",
|
|
2763
2932
|
children: /* @__PURE__ */ T("button", {
|
|
2764
|
-
className:
|
|
2933
|
+
className: dn(),
|
|
2765
2934
|
onClick: t,
|
|
2766
2935
|
type: "button",
|
|
2767
2936
|
children: "OK"
|
|
@@ -2771,36 +2940,36 @@ function kt({ error: e, onClose: t }) {
|
|
|
2771
2940
|
})
|
|
2772
2941
|
});
|
|
2773
2942
|
}
|
|
2774
|
-
function
|
|
2943
|
+
function Lt({ currentPath: e, destinations: t, error: n, onSelect: r, rootLabel: i, selectedPath: a, status: o }) {
|
|
2775
2944
|
return /* @__PURE__ */ E("div", {
|
|
2776
2945
|
className: `mt-3 max-h-64 overflow-auto rounded-[calc(var(--fb-radius)-3px)] border border-[var(--fb-border)] bg-[var(--fb-bg)] p-2 ${Z}`,
|
|
2777
2946
|
children: [
|
|
2778
|
-
/* @__PURE__ */ T(
|
|
2779
|
-
active:
|
|
2947
|
+
/* @__PURE__ */ T(Rt, {
|
|
2948
|
+
active: a === e,
|
|
2780
2949
|
label: "Current folder",
|
|
2781
2950
|
onClick: () => r(e),
|
|
2782
2951
|
path: e
|
|
2783
2952
|
}),
|
|
2784
|
-
/* @__PURE__ */ T(
|
|
2785
|
-
active:
|
|
2786
|
-
label:
|
|
2953
|
+
/* @__PURE__ */ T(Rt, {
|
|
2954
|
+
active: a === "/",
|
|
2955
|
+
label: i,
|
|
2787
2956
|
onClick: () => r("/"),
|
|
2788
2957
|
path: "/"
|
|
2789
2958
|
}),
|
|
2790
|
-
|
|
2959
|
+
o === "loading" ? /* @__PURE__ */ T("div", {
|
|
2791
2960
|
className: "px-2 py-3 text-[12px] text-[var(--fb-muted)]",
|
|
2792
2961
|
children: "Loading folders"
|
|
2793
2962
|
}) : null,
|
|
2794
|
-
|
|
2963
|
+
o === "error" ? /* @__PURE__ */ T("div", {
|
|
2795
2964
|
className: "px-2 py-3 text-[12px] text-[var(--fb-danger)]",
|
|
2796
2965
|
children: n ?? "Could not load folders"
|
|
2797
2966
|
}) : null,
|
|
2798
|
-
|
|
2967
|
+
o === "ready" && t.length === 0 ? /* @__PURE__ */ T("div", {
|
|
2799
2968
|
className: "px-2 py-3 text-[12px] text-[var(--fb-muted)]",
|
|
2800
2969
|
children: "No folders available."
|
|
2801
2970
|
}) : null,
|
|
2802
|
-
t.map((e) => /* @__PURE__ */ T(
|
|
2803
|
-
active:
|
|
2971
|
+
t.map((e) => /* @__PURE__ */ T(Rt, {
|
|
2972
|
+
active: a === e.path,
|
|
2804
2973
|
depth: e.depth,
|
|
2805
2974
|
label: e.name,
|
|
2806
2975
|
onClick: () => r(e.path),
|
|
@@ -2809,14 +2978,14 @@ function At({ currentPath: e, destinations: t, error: n, onSelect: r, selectedPa
|
|
|
2809
2978
|
]
|
|
2810
2979
|
});
|
|
2811
2980
|
}
|
|
2812
|
-
function
|
|
2981
|
+
function Rt({ active: e, depth: t = 0, label: n, onClick: r, path: i }) {
|
|
2813
2982
|
return /* @__PURE__ */ E("button", {
|
|
2814
2983
|
"aria-label": `Move destination ${i}`,
|
|
2815
2984
|
className: `mt-1 flex h-8 w-full items-center gap-2 rounded-[calc(var(--fb-radius)-4px)] px-2 text-left text-[12px] font-medium ${X} ${e ? "bg-[var(--fb-accent-soft)] text-[var(--fb-accent)]" : "hover:bg-[var(--fb-surface)]"}`,
|
|
2816
2985
|
onClick: r,
|
|
2817
2986
|
style: { paddingLeft: `calc((${t} * 6 + 2) * var(--fb-gap))` },
|
|
2818
2987
|
type: "button",
|
|
2819
|
-
children: [/* @__PURE__ */ T(
|
|
2988
|
+
children: [/* @__PURE__ */ T(de, {
|
|
2820
2989
|
"aria-hidden": "true",
|
|
2821
2990
|
className: "size-4 shrink-0"
|
|
2822
2991
|
}), /* @__PURE__ */ T("span", {
|
|
@@ -2825,11 +2994,11 @@ function jt({ active: e, depth: t = 0, label: n, onClick: r, path: i }) {
|
|
|
2825
2994
|
})]
|
|
2826
2995
|
});
|
|
2827
2996
|
}
|
|
2828
|
-
function
|
|
2829
|
-
let
|
|
2997
|
+
function zt({ selectedCount: e, itemCount: t, canRename: n, canMove: r, canCopy: i, canCut: a, canDelete: o, canDownload: s, onRename: c, onMove: l, onCopy: u, onCut: d, onDelete: f, onDownload: p, onSelectAll: m, onSelectNone: h }) {
|
|
2998
|
+
let g = e > 0;
|
|
2830
2999
|
return /* @__PURE__ */ E("div", {
|
|
2831
3000
|
"aria-label": "Selection actions",
|
|
2832
|
-
className: `flex min-h-11 flex-wrap items-center gap-2 border-b border-[var(--fb-border)] px-[var(--fb-pad)] py-1.5 ${Z} ${
|
|
3001
|
+
className: `flex min-h-11 flex-wrap items-center gap-2 border-b border-[var(--fb-border)] px-[var(--fb-pad)] py-1.5 ${Z} ${g ? "bg-[var(--fb-accent-soft)]" : "bg-[var(--fb-surface)]"}`,
|
|
2833
3002
|
role: "toolbar",
|
|
2834
3003
|
children: [
|
|
2835
3004
|
/* @__PURE__ */ E("span", {
|
|
@@ -2839,67 +3008,67 @@ function Mt({ selectedCount: e, itemCount: t, canRename: n, canMove: r, canCopy:
|
|
|
2839
3008
|
/* @__PURE__ */ E("button", {
|
|
2840
3009
|
className: $(!1),
|
|
2841
3010
|
disabled: t === 0,
|
|
2842
|
-
onClick:
|
|
3011
|
+
onClick: m,
|
|
2843
3012
|
type: "button",
|
|
2844
|
-
children: [/* @__PURE__ */ T(
|
|
3013
|
+
children: [/* @__PURE__ */ T(V, { className: "size-4" }), "Select all"]
|
|
2845
3014
|
}),
|
|
2846
3015
|
/* @__PURE__ */ E("button", {
|
|
2847
3016
|
className: $(!1),
|
|
2848
|
-
disabled: !
|
|
2849
|
-
onClick:
|
|
3017
|
+
disabled: !g,
|
|
3018
|
+
onClick: h,
|
|
2850
3019
|
type: "button",
|
|
2851
|
-
children: [/* @__PURE__ */ T(
|
|
3020
|
+
children: [/* @__PURE__ */ T(W, { className: "size-4" }), "Select none"]
|
|
2852
3021
|
}),
|
|
2853
|
-
|
|
3022
|
+
g && n && e === 1 ? /* @__PURE__ */ E("button", {
|
|
2854
3023
|
className: $(!1),
|
|
2855
|
-
onClick: () =>
|
|
3024
|
+
onClick: () => c(),
|
|
2856
3025
|
type: "button",
|
|
2857
|
-
children: [/* @__PURE__ */ T(
|
|
3026
|
+
children: [/* @__PURE__ */ T(z, { className: "size-4" }), "Rename"]
|
|
2858
3027
|
}) : null,
|
|
2859
|
-
|
|
3028
|
+
g && r ? /* @__PURE__ */ E("button", {
|
|
2860
3029
|
className: $(!1),
|
|
2861
|
-
onClick:
|
|
3030
|
+
onClick: l,
|
|
2862
3031
|
type: "button",
|
|
2863
|
-
children: [/* @__PURE__ */ T(
|
|
3032
|
+
children: [/* @__PURE__ */ T(L, { className: "size-4" }), "Move"]
|
|
2864
3033
|
}) : null,
|
|
2865
|
-
|
|
3034
|
+
g && i ? /* @__PURE__ */ E("button", {
|
|
2866
3035
|
className: $(!1),
|
|
2867
|
-
onClick:
|
|
3036
|
+
onClick: u,
|
|
2868
3037
|
type: "button",
|
|
2869
|
-
children: [/* @__PURE__ */ T(
|
|
3038
|
+
children: [/* @__PURE__ */ T(F, { className: "size-4" }), "Copy"]
|
|
2870
3039
|
}) : null,
|
|
2871
|
-
|
|
3040
|
+
g && a ? /* @__PURE__ */ E("button", {
|
|
2872
3041
|
className: $(!1),
|
|
2873
|
-
onClick:
|
|
3042
|
+
onClick: d,
|
|
2874
3043
|
type: "button",
|
|
2875
3044
|
children: [/* @__PURE__ */ T(me, { className: "size-4" }), "Cut"]
|
|
2876
3045
|
}) : null,
|
|
2877
|
-
|
|
3046
|
+
g && s ? /* @__PURE__ */ E("button", {
|
|
2878
3047
|
className: $(!1),
|
|
2879
|
-
onClick:
|
|
3048
|
+
onClick: p,
|
|
2880
3049
|
type: "button",
|
|
2881
|
-
children: [/* @__PURE__ */ T(
|
|
3050
|
+
children: [/* @__PURE__ */ T(I, { className: "size-4" }), "Download"]
|
|
2882
3051
|
}) : null,
|
|
2883
|
-
|
|
2884
|
-
className:
|
|
2885
|
-
onClick:
|
|
3052
|
+
g && o ? /* @__PURE__ */ E("button", {
|
|
3053
|
+
className: fn(),
|
|
3054
|
+
onClick: f,
|
|
2886
3055
|
type: "button",
|
|
2887
|
-
children: [/* @__PURE__ */ T(
|
|
3056
|
+
children: [/* @__PURE__ */ T(U, { className: "size-4" }), "Delete"]
|
|
2888
3057
|
}) : null
|
|
2889
3058
|
]
|
|
2890
3059
|
});
|
|
2891
3060
|
}
|
|
2892
|
-
function
|
|
2893
|
-
let
|
|
3061
|
+
function Bt({ path: e, onNavigate: t, rootLabel: n }) {
|
|
3062
|
+
let r = e.split("/").filter(Boolean);
|
|
2894
3063
|
return /* @__PURE__ */ T("nav", {
|
|
2895
3064
|
"aria-label": "Breadcrumb",
|
|
2896
3065
|
className: "flex min-w-0 items-center gap-1",
|
|
2897
|
-
children:
|
|
2898
|
-
label:
|
|
3066
|
+
children: Vt([{
|
|
3067
|
+
label: n,
|
|
2899
3068
|
path: "/"
|
|
2900
|
-
}].concat(
|
|
3069
|
+
}].concat(r.map((e, t) => ({
|
|
2901
3070
|
label: e,
|
|
2902
|
-
path: `/${
|
|
3071
|
+
path: `/${r.slice(0, t + 1).join("/")}`
|
|
2903
3072
|
})))).map((e, n) => /* @__PURE__ */ E("span", {
|
|
2904
3073
|
className: "flex min-w-0 items-center gap-1",
|
|
2905
3074
|
children: [n > 0 ? /* @__PURE__ */ T("span", {
|
|
@@ -2919,7 +3088,7 @@ function Nt({ path: e, onNavigate: t }) {
|
|
|
2919
3088
|
}, e.key))
|
|
2920
3089
|
});
|
|
2921
3090
|
}
|
|
2922
|
-
function
|
|
3091
|
+
function Vt(e) {
|
|
2923
3092
|
return e.length <= 4 ? e.map((e) => ({
|
|
2924
3093
|
...e,
|
|
2925
3094
|
kind: "crumb",
|
|
@@ -2946,18 +3115,32 @@ function Pt(e) {
|
|
|
2946
3115
|
}))
|
|
2947
3116
|
];
|
|
2948
3117
|
}
|
|
2949
|
-
function
|
|
2950
|
-
|
|
3118
|
+
function Ht({ canDownload: e, item: t, onCopyPath: n, onDownload: r, renderDetailsContent: i, selectedCount: a, totalBytes: o }) {
|
|
3119
|
+
if (!t) return /* @__PURE__ */ T("aside", {
|
|
3120
|
+
"aria-label": "Details",
|
|
3121
|
+
className: `hidden w-[var(--fb-panel-w)] shrink-0 border-l border-[var(--fb-border)] bg-[var(--fb-surface)] p-[var(--fb-panel-pad)] md:flex ${Z}`,
|
|
3122
|
+
children: /* @__PURE__ */ E("div", {
|
|
3123
|
+
className: "flex min-h-full flex-1 flex-col items-center justify-center text-center",
|
|
3124
|
+
children: [/* @__PURE__ */ T("div", {
|
|
3125
|
+
className: `grid h-28 w-full place-items-center rounded-[var(--fb-radius)] bg-[var(--fb-bg)] ${Z}`,
|
|
3126
|
+
children: /* @__PURE__ */ T(H, { className: "size-12 text-[var(--fb-muted)]" })
|
|
3127
|
+
}), /* @__PURE__ */ T("h2", {
|
|
3128
|
+
className: "mt-4 text-[14px] font-semibold",
|
|
3129
|
+
children: "No item selected"
|
|
3130
|
+
})]
|
|
3131
|
+
})
|
|
3132
|
+
});
|
|
3133
|
+
if (a > 1) return /* @__PURE__ */ E("aside", {
|
|
2951
3134
|
"aria-label": "Details",
|
|
2952
3135
|
className: `hidden w-[var(--fb-panel-w)] shrink-0 border-l border-[var(--fb-border)] bg-[var(--fb-surface)] p-[var(--fb-panel-pad)] md:block ${Z}`,
|
|
2953
3136
|
children: [
|
|
2954
3137
|
/* @__PURE__ */ T("div", {
|
|
2955
3138
|
className: `grid h-28 place-items-center rounded-[var(--fb-radius)] bg-[var(--fb-bg)] ${Z}`,
|
|
2956
|
-
children: /* @__PURE__ */ T(
|
|
3139
|
+
children: /* @__PURE__ */ T(F, { className: "size-12 text-[var(--fb-muted)]" })
|
|
2957
3140
|
}),
|
|
2958
3141
|
/* @__PURE__ */ E("h2", {
|
|
2959
3142
|
className: "mt-4 text-[14px] font-semibold",
|
|
2960
|
-
children: [
|
|
3143
|
+
children: [an(a), " selected"]
|
|
2961
3144
|
}),
|
|
2962
3145
|
/* @__PURE__ */ T("dl", {
|
|
2963
3146
|
className: "mt-3 space-y-2 text-[12px]",
|
|
@@ -2966,93 +3149,82 @@ function Ft({ item: e, onCopyPath: t, onDownload: n, selectedCount: r, totalByte
|
|
|
2966
3149
|
children: "Total size"
|
|
2967
3150
|
}), /* @__PURE__ */ T("dd", {
|
|
2968
3151
|
className: "font-medium",
|
|
2969
|
-
children:
|
|
3152
|
+
children: rn(o)
|
|
2970
3153
|
})] })
|
|
2971
3154
|
}),
|
|
2972
|
-
/* @__PURE__ */ E("button", {
|
|
2973
|
-
"aria-label": `Download ${
|
|
3155
|
+
e ? /* @__PURE__ */ E("button", {
|
|
3156
|
+
"aria-label": `Download ${an(a)}`,
|
|
2974
3157
|
className: `${$(!1)} mt-4 w-full justify-center`,
|
|
2975
|
-
onClick:
|
|
3158
|
+
onClick: r,
|
|
2976
3159
|
type: "button",
|
|
2977
|
-
children: [/* @__PURE__ */ T(
|
|
2978
|
-
}),
|
|
3160
|
+
children: [/* @__PURE__ */ T(I, { className: "size-4" }), "Download"]
|
|
3161
|
+
}) : null,
|
|
2979
3162
|
/* @__PURE__ */ E("button", {
|
|
2980
|
-
"aria-label": `Copy ${
|
|
3163
|
+
"aria-label": `Copy ${an(a)} paths`,
|
|
2981
3164
|
className: `${$(!1)} mt-2 w-full justify-center`,
|
|
2982
|
-
onClick: t,
|
|
2983
|
-
type: "button",
|
|
2984
|
-
children: [/* @__PURE__ */ T(ce, { className: "size-4" }), "Copy paths"]
|
|
2985
|
-
})
|
|
2986
|
-
]
|
|
2987
|
-
}) : /* @__PURE__ */ E("aside", {
|
|
2988
|
-
"aria-label": "Details",
|
|
2989
|
-
className: `hidden w-72 shrink-0 border-l border-[var(--fb-border)] bg-[var(--fb-surface)] p-4 md:block ${Z}`,
|
|
2990
|
-
children: [
|
|
2991
|
-
/* @__PURE__ */ T("div", {
|
|
2992
|
-
className: `grid h-28 place-items-center rounded-[var(--fb-radius)] bg-[var(--fb-bg)] ${Z}`,
|
|
2993
|
-
children: e.kind === "folder" ? /* @__PURE__ */ T(z, { className: "size-12 text-[var(--fb-folder)]" }) : /* @__PURE__ */ T(R, { className: "size-12 text-[var(--fb-muted)]" })
|
|
2994
|
-
}),
|
|
2995
|
-
/* @__PURE__ */ T("h2", {
|
|
2996
|
-
className: "mt-4 truncate text-[14px] font-semibold",
|
|
2997
|
-
children: e.name
|
|
2998
|
-
}),
|
|
2999
|
-
/* @__PURE__ */ E("dl", {
|
|
3000
|
-
className: "mt-3 space-y-2 text-[12px]",
|
|
3001
|
-
children: [
|
|
3002
|
-
/* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("dt", {
|
|
3003
|
-
className: "text-[var(--fb-muted)]",
|
|
3004
|
-
children: "Path"
|
|
3005
|
-
}), /* @__PURE__ */ T("dd", {
|
|
3006
|
-
className: "truncate font-medium",
|
|
3007
|
-
children: e.path
|
|
3008
|
-
})] }),
|
|
3009
|
-
/* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("dt", {
|
|
3010
|
-
className: "text-[var(--fb-muted)]",
|
|
3011
|
-
children: "Type"
|
|
3012
|
-
}), /* @__PURE__ */ T("dd", {
|
|
3013
|
-
className: "font-medium",
|
|
3014
|
-
children: e.kind
|
|
3015
|
-
})] }),
|
|
3016
|
-
e.kind === "file" ? /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("dt", {
|
|
3017
|
-
className: "text-[var(--fb-muted)]",
|
|
3018
|
-
children: "Size"
|
|
3019
|
-
}), /* @__PURE__ */ T("dd", {
|
|
3020
|
-
className: "font-medium",
|
|
3021
|
-
children: Xt(e.size ?? 0)
|
|
3022
|
-
})] }) : null
|
|
3023
|
-
]
|
|
3024
|
-
}),
|
|
3025
|
-
/* @__PURE__ */ E("button", {
|
|
3026
|
-
"aria-label": `Download ${e.name}`,
|
|
3027
|
-
className: `${$(!1)} mt-4 w-full justify-center`,
|
|
3028
3165
|
onClick: n,
|
|
3029
3166
|
type: "button",
|
|
3030
|
-
children: [/* @__PURE__ */ T(
|
|
3031
|
-
}),
|
|
3032
|
-
/* @__PURE__ */ E("button", {
|
|
3033
|
-
"aria-label": `Copy path of ${e.name}`,
|
|
3034
|
-
className: `${$(!1)} mt-2 w-full justify-center`,
|
|
3035
|
-
onClick: t,
|
|
3036
|
-
type: "button",
|
|
3037
|
-
children: [/* @__PURE__ */ T(ce, { className: "size-4" }), "Copy path"]
|
|
3167
|
+
children: [/* @__PURE__ */ T(F, { className: "size-4" }), "Copy paths"]
|
|
3038
3168
|
})
|
|
3039
3169
|
]
|
|
3040
|
-
})
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
className: "
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3170
|
+
});
|
|
3171
|
+
let s = /* @__PURE__ */ E(w, { children: [
|
|
3172
|
+
/* @__PURE__ */ T("div", {
|
|
3173
|
+
className: `grid h-28 place-items-center rounded-[var(--fb-radius)] bg-[var(--fb-bg)] ${Z}`,
|
|
3174
|
+
children: t.kind === "folder" ? /* @__PURE__ */ T(de, { className: "size-12 text-[var(--fb-folder)]" }) : /* @__PURE__ */ T(ue, { className: "size-12 text-[var(--fb-muted)]" })
|
|
3175
|
+
}),
|
|
3176
|
+
/* @__PURE__ */ T("h2", {
|
|
3177
|
+
className: "mt-4 truncate text-[14px] font-semibold",
|
|
3178
|
+
children: t.name
|
|
3179
|
+
}),
|
|
3180
|
+
/* @__PURE__ */ E("dl", {
|
|
3181
|
+
className: "mt-3 space-y-2 text-[12px]",
|
|
3182
|
+
children: [
|
|
3183
|
+
/* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("dt", {
|
|
3184
|
+
className: "text-[var(--fb-muted)]",
|
|
3185
|
+
children: "Path"
|
|
3186
|
+
}), /* @__PURE__ */ T("dd", {
|
|
3187
|
+
className: "truncate font-medium",
|
|
3188
|
+
children: t.path
|
|
3189
|
+
})] }),
|
|
3190
|
+
/* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("dt", {
|
|
3191
|
+
className: "text-[var(--fb-muted)]",
|
|
3192
|
+
children: "Type"
|
|
3193
|
+
}), /* @__PURE__ */ T("dd", {
|
|
3194
|
+
className: "font-medium",
|
|
3195
|
+
children: t.kind
|
|
3196
|
+
})] }),
|
|
3197
|
+
t.kind === "file" ? /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("dt", {
|
|
3198
|
+
className: "text-[var(--fb-muted)]",
|
|
3199
|
+
children: "Size"
|
|
3200
|
+
}), /* @__PURE__ */ T("dd", {
|
|
3201
|
+
className: "font-medium",
|
|
3202
|
+
children: rn(t.size ?? 0)
|
|
3203
|
+
})] }) : null
|
|
3204
|
+
]
|
|
3205
|
+
}),
|
|
3206
|
+
e ? /* @__PURE__ */ E("button", {
|
|
3207
|
+
"aria-label": `Download ${t.name}`,
|
|
3208
|
+
className: `${$(!1)} mt-4 w-full justify-center`,
|
|
3209
|
+
onClick: r,
|
|
3210
|
+
type: "button",
|
|
3211
|
+
children: [/* @__PURE__ */ T(I, { className: "size-4" }), "Download"]
|
|
3212
|
+
}) : null,
|
|
3213
|
+
/* @__PURE__ */ E("button", {
|
|
3214
|
+
"aria-label": `Copy path of ${t.name}`,
|
|
3215
|
+
className: `${$(!1)} mt-2 w-full justify-center`,
|
|
3216
|
+
onClick: n,
|
|
3217
|
+
type: "button",
|
|
3218
|
+
children: [/* @__PURE__ */ T(F, { className: "size-4" }), "Copy path"]
|
|
3052
3219
|
})
|
|
3220
|
+
] });
|
|
3221
|
+
return /* @__PURE__ */ T("aside", {
|
|
3222
|
+
"aria-label": "Details",
|
|
3223
|
+
className: `hidden w-72 shrink-0 border-l border-[var(--fb-border)] bg-[var(--fb-surface)] p-4 md:block ${Z}`,
|
|
3224
|
+
children: i ? i(t, s) : s
|
|
3053
3225
|
});
|
|
3054
3226
|
}
|
|
3055
|
-
function
|
|
3227
|
+
function Ut({ preview: e }) {
|
|
3056
3228
|
return e.url ? /* @__PURE__ */ T("a", {
|
|
3057
3229
|
"aria-label": `Open original ${e.item.name}`,
|
|
3058
3230
|
className: `mt-4 inline-flex h-8 items-center rounded-[calc(var(--fb-radius)-3px)] border border-[var(--fb-border)] bg-[var(--fb-surface)] px-2.5 text-[12px] font-medium text-[var(--fb-accent)] outline-none hover:bg-[var(--fb-bg)] focus:ring-2 focus:ring-[var(--fb-accent-soft)] ${X}`,
|
|
@@ -3062,9 +3234,9 @@ function It({ preview: e }) {
|
|
|
3062
3234
|
children: "Open original"
|
|
3063
3235
|
}) : null;
|
|
3064
3236
|
}
|
|
3065
|
-
function
|
|
3237
|
+
function Wt({ rootLabel: e }) {
|
|
3066
3238
|
return /* @__PURE__ */ T("div", {
|
|
3067
|
-
"aria-label":
|
|
3239
|
+
"aria-label": e,
|
|
3068
3240
|
className: "grid grid-cols-[repeat(auto-fill,minmax(var(--fb-card-min),1fr))] gap-[var(--fb-grid-gap)]",
|
|
3069
3241
|
role: "grid",
|
|
3070
3242
|
children: Array.from({ length: 8 }, (e, t) => /* @__PURE__ */ E("div", {
|
|
@@ -3077,19 +3249,19 @@ function Lt() {
|
|
|
3077
3249
|
}, t))
|
|
3078
3250
|
});
|
|
3079
3251
|
}
|
|
3080
|
-
function
|
|
3252
|
+
function Gt({ title: e, value: t, tone: n }) {
|
|
3081
3253
|
return /* @__PURE__ */ T("div", {
|
|
3082
3254
|
className: `grid min-h-[280px] place-items-center rounded-[var(--fb-radius)] border border-dashed border-[var(--fb-border)] bg-[var(--fb-surface)] p-8 text-center ${Z}`,
|
|
3083
3255
|
children: /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("div", {
|
|
3084
3256
|
className: `font-semibold ${n === "danger" ? "text-[var(--fb-danger)]" : ""}`,
|
|
3085
3257
|
children: e
|
|
3086
|
-
}), /* @__PURE__ */ T("div", {
|
|
3258
|
+
}), t === void 0 ? null : /* @__PURE__ */ T("div", {
|
|
3087
3259
|
className: "mt-1 text-[12px] text-[var(--fb-muted)]",
|
|
3088
3260
|
children: t
|
|
3089
3261
|
})] })
|
|
3090
3262
|
});
|
|
3091
3263
|
}
|
|
3092
|
-
function
|
|
3264
|
+
function Kt({ onDismiss: e, rejections: t }) {
|
|
3093
3265
|
return /* @__PURE__ */ T("div", {
|
|
3094
3266
|
"aria-label": "Upload rejected",
|
|
3095
3267
|
className: "border-b border-[var(--fb-border)] bg-[var(--fb-danger-soft)] px-3 py-2 text-[12px] text-[var(--fb-text)]",
|
|
@@ -3124,13 +3296,13 @@ function zt({ onDismiss: e, rejections: t }) {
|
|
|
3124
3296
|
})
|
|
3125
3297
|
});
|
|
3126
3298
|
}
|
|
3127
|
-
function
|
|
3299
|
+
function qt(e, t, n, r) {
|
|
3128
3300
|
"shiftKey" in n && n.shiftKey ? (r.cancelPendingSelectedItemUnselect(), e.selectRange(t)) : "metaKey" in n && (n.metaKey || n.ctrlKey) ? (r.cancelPendingSelectedItemUnselect(), e.toggleSelection(t)) : e.selectedPaths.length === 1 && e.selectedPaths[0] === t ? r.scheduleSelectedItemUnselect(t) : (r.cancelPendingSelectedItemUnselect(), e.selectOnly(t));
|
|
3129
3301
|
}
|
|
3130
|
-
function
|
|
3302
|
+
function Jt(e) {
|
|
3131
3303
|
return !!("shiftKey" in e && (e.shiftKey || e.metaKey || e.ctrlKey));
|
|
3132
3304
|
}
|
|
3133
|
-
function
|
|
3305
|
+
function Yt(e) {
|
|
3134
3306
|
return [
|
|
3135
3307
|
"ArrowDown",
|
|
3136
3308
|
"ArrowLeft",
|
|
@@ -3140,14 +3312,15 @@ function Ht(e) {
|
|
|
3140
3312
|
"Home"
|
|
3141
3313
|
].includes(e);
|
|
3142
3314
|
}
|
|
3143
|
-
function
|
|
3315
|
+
function Xt(e, t, n) {
|
|
3144
3316
|
return e === "Home" ? 0 : e === "End" ? n - 1 : e === "ArrowUp" || e === "ArrowLeft" ? Math.max(0, t - 1) : Math.min(n - 1, t + 1);
|
|
3145
3317
|
}
|
|
3146
|
-
function
|
|
3318
|
+
function Zt(e) {
|
|
3147
3319
|
return typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/["\\]/g, "\\$&");
|
|
3148
3320
|
}
|
|
3149
|
-
function
|
|
3150
|
-
|
|
3321
|
+
function Qt(e) {
|
|
3322
|
+
if (typeof e.getData != "function") return [];
|
|
3323
|
+
let t = e.getData(ht);
|
|
3151
3324
|
if (!t) return [];
|
|
3152
3325
|
try {
|
|
3153
3326
|
let e = JSON.parse(t);
|
|
@@ -3156,8 +3329,8 @@ function Gt(e) {
|
|
|
3156
3329
|
return [];
|
|
3157
3330
|
}
|
|
3158
3331
|
}
|
|
3159
|
-
function
|
|
3160
|
-
return
|
|
3332
|
+
function $t(e) {
|
|
3333
|
+
return en(e) ? {
|
|
3161
3334
|
title: "Access denied",
|
|
3162
3335
|
value: e?.message ?? "You do not have access to this folder."
|
|
3163
3336
|
} : {
|
|
@@ -3165,48 +3338,57 @@ function Kt(e) {
|
|
|
3165
3338
|
value: e?.message ?? "Unknown error"
|
|
3166
3339
|
};
|
|
3167
3340
|
}
|
|
3168
|
-
function
|
|
3341
|
+
function en(e) {
|
|
3169
3342
|
if (!e) return !1;
|
|
3170
3343
|
let t = e;
|
|
3171
3344
|
return t.status === 403 || t.statusCode === 403 || t.code === "access_denied" || t.code === "forbidden" || t.code === "permission_denied";
|
|
3172
3345
|
}
|
|
3173
|
-
function
|
|
3346
|
+
function tn(e) {
|
|
3174
3347
|
return e instanceof Error ? e.message : String(e);
|
|
3175
3348
|
}
|
|
3176
|
-
function
|
|
3349
|
+
function nn(e) {
|
|
3177
3350
|
return e instanceof HTMLElement ? e.isContentEditable || [
|
|
3178
3351
|
"INPUT",
|
|
3179
3352
|
"SELECT",
|
|
3180
3353
|
"TEXTAREA"
|
|
3181
3354
|
].includes(e.tagName) : !1;
|
|
3182
3355
|
}
|
|
3183
|
-
function
|
|
3356
|
+
function rn(e) {
|
|
3184
3357
|
if (e < 1024) return `${e} B`;
|
|
3185
3358
|
let t = e / 1024;
|
|
3186
3359
|
return t < 1024 ? `${t.toFixed(1)} KB` : `${(t / 1024).toFixed(1)} MB`;
|
|
3187
3360
|
}
|
|
3188
|
-
function
|
|
3361
|
+
function an(e) {
|
|
3189
3362
|
return `${e} ${e === 1 ? "item" : "items"}`;
|
|
3190
3363
|
}
|
|
3191
|
-
function
|
|
3192
|
-
return
|
|
3364
|
+
function on(e) {
|
|
3365
|
+
return Array.from(new Set(e.filter((e) => vt.includes(e))));
|
|
3193
3366
|
}
|
|
3194
|
-
function
|
|
3367
|
+
function sn(e) {
|
|
3368
|
+
return e === "keep-both" ? "Keep both" : e === "replace" ? "Replace" : "Skip";
|
|
3369
|
+
}
|
|
3370
|
+
function cn(e, t) {
|
|
3371
|
+
return e.length === 1 && e[0].kind === "file" ? !0 : e.length > 0 && t;
|
|
3372
|
+
}
|
|
3373
|
+
function ln({ currentPath: e, itemCount: t, rootLabel: n, selectedCount: r, status: i }) {
|
|
3374
|
+
return `${e === "/" ? n : e.split("/").filter(Boolean).at(-1) ?? n} ${i}. ${t} ${t === 1 ? "item" : "items"}. ${r} selected.`;
|
|
3375
|
+
}
|
|
3376
|
+
function un(e) {
|
|
3195
3377
|
return `inline-flex h-[var(--fb-control-h)] items-center justify-center gap-1 rounded-[calc(var(--fb-radius)-3px)] border px-2 text-[12px] font-medium outline-none focus:ring-2 focus:ring-[var(--fb-accent-soft)] ${X} ${e ? "border-[var(--fb-accent)] bg-[var(--fb-accent-soft)] text-[var(--fb-accent)]" : "border-[var(--fb-border)] bg-[var(--fb-surface)] text-[var(--fb-muted)] hover:bg-[var(--fb-bg)]"}`;
|
|
3196
3378
|
}
|
|
3197
3379
|
function $(e) {
|
|
3198
3380
|
return `inline-flex h-[var(--fb-control-h)] items-center gap-1.5 rounded-[calc(var(--fb-radius)-3px)] border px-2.5 text-[12px] font-medium outline-none disabled:cursor-not-allowed disabled:opacity-45 focus:ring-2 focus:ring-[var(--fb-accent-soft)] ${X} ${e ? "border-[var(--fb-accent)] bg-[var(--fb-accent-soft)] text-[var(--fb-accent)]" : "border-[var(--fb-border)] bg-[var(--fb-surface)] text-[var(--fb-text)] hover:bg-[var(--fb-bg)]"}`;
|
|
3199
3381
|
}
|
|
3200
|
-
function
|
|
3382
|
+
function dn() {
|
|
3201
3383
|
return `inline-flex h-[var(--fb-control-h)] items-center gap-1.5 rounded-[calc(var(--fb-radius)-3px)] border border-[var(--fb-accent)] bg-[var(--fb-accent)] px-2.5 text-[12px] font-semibold text-[var(--fb-surface)] outline-none hover:opacity-90 focus:ring-2 focus:ring-[var(--fb-accent-soft)] ${X}`;
|
|
3202
3384
|
}
|
|
3203
|
-
function
|
|
3385
|
+
function fn() {
|
|
3204
3386
|
return `inline-flex h-[var(--fb-control-h)] items-center gap-1.5 rounded-[calc(var(--fb-radius)-3px)] border border-[var(--fb-danger)] bg-[var(--fb-danger-soft)] px-2.5 text-[12px] font-medium text-[var(--fb-danger)] outline-none hover:bg-[var(--fb-danger-soft)] focus:ring-2 focus:ring-[var(--fb-danger-soft)] ${X}`;
|
|
3205
3387
|
}
|
|
3206
|
-
function
|
|
3388
|
+
function pn() {
|
|
3207
3389
|
return `h-[var(--fb-control-h)] rounded-[calc(var(--fb-radius)-3px)] border border-[var(--fb-border)] bg-[var(--fb-surface)] px-2 text-[12px] font-medium text-[var(--fb-text)] outline-none focus:border-[var(--fb-accent)] focus:ring-2 focus:ring-[var(--fb-accent-soft)] ${X}`;
|
|
3208
3390
|
}
|
|
3209
3391
|
//#endregion
|
|
3210
|
-
export { l as FILE_BROWSER_THEME_CONTRACT,
|
|
3392
|
+
export { l as FILE_BROWSER_THEME_CONTRACT, bt as FileBrowser, t as FileBrowserAdapterError, r as FileBrowserBulkActionError, Ye as FileBrowserProvider, c as ROOT_PATH, De as TransferManager, i as getFileBrowserBasename, u as getFileBrowserDensityAttributes, o as getFileBrowserDirname, n as isFileBrowserDescendantOrSelf, e as joinFileBrowserPath, a as normalizeFileBrowserPath, s as replaceFileBrowserPathPrefix, ee as useFileBrowser, Ze as useTransferSnapshot, Xe as useTransfers };
|
|
3211
3393
|
|
|
3212
3394
|
//# sourceMappingURL=index.js.map
|