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