@harryy/react-file-browser 1.0.0 → 1.1.0

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