@floegence/floe-webapp-core 0.48.2 → 0.48.4

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.
@@ -1,161 +1,161 @@
1
- import { createComponent as Lt } from "solid-js/web";
2
- import { createSignal as h, createEffect as S, createMemo as U, useContext as _t, createContext as Ot, untrack as Tt } from "solid-js";
1
+ import { createComponent as Ot } from "solid-js/web";
2
+ import { createSignal as h, createEffect as S, createMemo as G, useContext as Tt, createContext as zt, untrack as Dt } from "solid-js";
3
3
  import { createStore as pe, produce as Se } from "solid-js/store";
4
- import { useResolvedFloeConfig as zt } from "../../context/FloeConfigContext.js";
5
- import { deferAfterPaint as Dt, deferNonBlocking as E } from "../../utils/defer.js";
6
- const Ee = Ot(), M = {
4
+ import { useResolvedFloeConfig as Nt } from "../../context/FloeConfigContext.js";
5
+ import { deferAfterPaint as Wt, deferNonBlocking as E } from "../../utils/defer.js";
6
+ const Ee = zt(), M = {
7
7
  name: 0.65,
8
8
  modifiedAt: 0.2,
9
9
  size: 0.15
10
- }, ge = "fileBrowser:listColumnRatios", xe = 220, Nt = "fileBrowser:sidebarWidth", Wt = 160, qt = 520, ye = "fileBrowser:viewMode", we = "fileBrowser:sortConfig", Ce = "fileBrowser:expandedFolders", ve = "fileBrowser:sidebarCollapsed";
11
- function G(o, c) {
12
- const i = typeof o == "number" && Number.isFinite(o) ? o : c;
13
- return Math.max(Wt, Math.min(qt, Math.round(i)));
10
+ }, ge = "fileBrowser:listColumnRatios", ye = 220, qt = "fileBrowser:sidebarWidth", Vt = 160, kt = 520, xe = "fileBrowser:viewMode", we = "fileBrowser:sortConfig", ve = "fileBrowser:expandedFolders", Ce = "fileBrowser:sidebarCollapsed";
11
+ function X(n, c) {
12
+ const r = typeof n == "number" && Number.isFinite(n) ? n : c;
13
+ return Math.max(Vt, Math.min(kt, Math.round(r)));
14
14
  }
15
- function Vt(o, c) {
16
- return o === "list" || o === "grid" ? o : c;
15
+ function Ut(n, c) {
16
+ return n === "list" || n === "grid" ? n : c;
17
17
  }
18
- function kt(o, c) {
19
- if (!o || typeof o != "object") return c;
20
- const i = o, f = i.field, l = i.direction;
18
+ function Kt(n, c) {
19
+ if (!n || typeof n != "object") return c;
20
+ const r = n, f = r.field, l = r.direction;
21
21
  return !(f === "name" || f === "size" || f === "modifiedAt" || f === "type") || !(l === "asc" || l === "desc") ? c : {
22
22
  field: f,
23
23
  direction: l
24
24
  };
25
25
  }
26
- function Kt(o) {
27
- if (!Array.isArray(o)) return ["/"];
28
- const c = [], i = /* @__PURE__ */ new Set();
29
- for (const f of o) {
26
+ function Gt(n) {
27
+ if (!Array.isArray(n)) return ["/"];
28
+ const c = [], r = /* @__PURE__ */ new Set();
29
+ for (const f of n) {
30
30
  if (typeof f != "string") continue;
31
31
  const l = f.trim();
32
- !l || i.has(l) || (i.add(l), c.push(l));
32
+ !l || r.has(l) || (r.add(l), c.push(l));
33
33
  }
34
- return i.has("/") || c.unshift("/"), c;
34
+ return r.has("/") || c.unshift("/"), c;
35
35
  }
36
- function Ae(o) {
37
- const c = [], i = /* @__PURE__ */ new Set();
38
- for (const f of o) {
36
+ function Ae(n) {
37
+ const c = [], r = /* @__PURE__ */ new Set();
38
+ for (const f of n) {
39
39
  if (typeof f != "string") continue;
40
40
  const l = f.trim();
41
- !l || i.has(l) || (i.add(l), c.push(l));
41
+ !l || r.has(l) || (r.add(l), c.push(l));
42
42
  }
43
43
  return c;
44
44
  }
45
- function Re(o) {
45
+ function Pe(n) {
46
46
  const c = {};
47
- for (const i of o)
48
- c[i] = !0;
47
+ for (const r of n)
48
+ c[r] = !0;
49
49
  return c;
50
50
  }
51
- function X(o, c) {
52
- if (o.length !== c.length) return !1;
53
- for (let i = 0; i < o.length; i += 1)
54
- if (o[i] !== c[i]) return !1;
51
+ function Y(n, c) {
52
+ if (n.length !== c.length) return !1;
53
+ for (let r = 0; r < n.length; r += 1)
54
+ if (n[r] !== c[r]) return !1;
55
55
  return !0;
56
56
  }
57
- function Pe(o) {
58
- const c = Number.isFinite(o.name) ? o.name : M.name, i = Number.isFinite(o.modifiedAt) ? o.modifiedAt : M.modifiedAt, f = Number.isFinite(o.size) ? o.size : M.size, l = Math.max(0, c), m = Math.max(0, i), v = Math.max(0, f), x = l + m + v;
59
- return x <= 0 ? M : {
60
- name: l / x,
61
- modifiedAt: m / x,
62
- size: v / x
57
+ function Re(n) {
58
+ const c = Number.isFinite(n.name) ? n.name : M.name, r = Number.isFinite(n.modifiedAt) ? n.modifiedAt : M.modifiedAt, f = Number.isFinite(n.size) ? n.size : M.size, l = Math.max(0, c), m = Math.max(0, r), C = Math.max(0, f), y = l + m + C;
59
+ return y <= 0 ? M : {
60
+ name: l / y,
61
+ modifiedAt: m / y,
62
+ size: C / y
63
63
  };
64
64
  }
65
- function be(o, c) {
65
+ function be(n, c) {
66
66
  if (!c) return [];
67
- const i = [];
67
+ const r = [];
68
68
  let f = 0;
69
69
  for (const l of c) {
70
- const m = o.indexOf(l, f);
70
+ const m = n.indexOf(l, f);
71
71
  if (m === -1) return null;
72
- i.push(m), f = m + 1;
72
+ r.push(m), f = m + 1;
73
73
  }
74
- return i;
74
+ return r;
75
75
  }
76
- function $t(o) {
77
- const c = zt(), i = (e) => {
76
+ function Zt(n) {
77
+ const c = Nt(), r = (e) => {
78
78
  const t = (e ?? "").trim();
79
79
  return t === "" ? "/" : t;
80
- }, f = (o.persistenceKey ?? "").trim(), l = !!f, m = (e) => f ? `${f}:${e}` : e, v = l ? Vt(c.persist.load(m(ye), o.initialViewMode ?? "list"), o.initialViewMode ?? "list") : o.initialViewMode ?? "list", x = {
80
+ }, f = (n.persistenceKey ?? "").trim(), l = !!f, m = (e) => f ? `${f}:${e}` : e, C = l ? Ut(c.persist.load(m(xe), n.initialViewMode ?? "list"), n.initialViewMode ?? "list") : n.initialViewMode ?? "list", y = {
81
81
  field: "name",
82
82
  direction: "asc"
83
- }, Me = l ? kt(c.persist.load(m(we), x), x) : x, Y = l ? Kt(c.persist.load(m(Ce), ["/"])) : ["/"], Be = l ? c.persist.load(m(ve), !1) === !0 : !1, Fe = () => typeof o.path == "string" ? i(o.path) : i(o.initialPath ?? "/"), [A, j] = h(Fe()), [F, Le] = pe({}), [y, _e] = h([]), [R, Oe] = h(null), [L, Q] = h(null), [H, Te] = h(v), [_, ze] = h(Me), De = Pe(c.persist.load(ge, o.initialListColumnRatios ?? M)), [$, Ne] = h(De), J = (o.sidebarWidthStorageKey ?? "").trim() || Nt, We = G(c.persist.load(J, o.initialSidebarWidth ?? xe), o.initialSidebarWidth ?? xe), [O, qe] = h(We), [T, Z] = pe(Re(Y)), [ee, te] = h(Y), [ne, Ve] = h(Be), [ke, oe] = h(null), [se, z] = h(""), [D, B] = h(""), [Ke, N] = h(!1), [W, re] = h(null);
84
- let q = 0;
83
+ }, Me = l ? Kt(c.persist.load(m(we), y), y) : y, j = l ? Gt(c.persist.load(m(ve), ["/"])) : ["/"], Be = l ? c.persist.load(m(Ce), !1) === !0 : !1, Fe = () => typeof n.path == "string" ? r(n.path) : r(n.initialPath ?? "/"), [Le, _e] = h(Fe()), B = () => typeof n.path == "string" ? r(n.path) : Le(), [L, Oe] = pe({}), [x, Te] = h([]), [A, ze] = h(null), [_, Q] = h(null), [H, De] = h(C), [O, Ne] = h(Me), We = Re(c.persist.load(ge, n.initialListColumnRatios ?? M)), [$, qe] = h(We), J = (n.sidebarWidthStorageKey ?? "").trim() || qt, Ve = X(c.persist.load(J, n.initialSidebarWidth ?? ye), n.initialSidebarWidth ?? ye), [T, ke] = h(Ve), [z, Z] = pe(Pe(j)), [ee, te] = h(j), [ne, Ue] = h(Be), [Ke, oe] = h(null), [se, D] = h(""), [N, F] = h(""), [Ge, W] = h(!1), [q, ie] = h(null);
84
+ let V = 0;
85
85
  S(() => {
86
86
  const e = se().trim();
87
- q += 1;
88
- const t = q;
87
+ V += 1;
88
+ const t = V;
89
89
  if (!e) {
90
- B("");
90
+ F("");
91
91
  return;
92
92
  }
93
- Dt(() => {
94
- t === q && B(e);
93
+ Wt(() => {
94
+ t === V && F(e);
95
95
  });
96
96
  }), S(() => {
97
97
  c.persist.debouncedSave(ge, $());
98
98
  }), S(() => {
99
- c.persist.debouncedSave(J, O());
99
+ c.persist.debouncedSave(J, T());
100
100
  }), S(() => {
101
- l && c.persist.debouncedSave(m(ye), H());
101
+ l && c.persist.debouncedSave(m(xe), H());
102
102
  }), S(() => {
103
- l && c.persist.debouncedSave(m(we), _());
103
+ l && c.persist.debouncedSave(m(we), O());
104
104
  }), S(() => {
105
105
  if (!l) return;
106
- const e = [...ee()].sort((t, n) => t.localeCompare(n));
107
- c.persist.debouncedSave(m(Ce), e);
106
+ const e = [...ee()].sort((t, o) => t.localeCompare(o));
107
+ c.persist.debouncedSave(m(ve), e);
108
108
  }), S(() => {
109
- l && c.persist.debouncedSave(m(ve), ne());
109
+ l && c.persist.debouncedSave(m(Ce), ne());
110
110
  }), S(() => {
111
- const e = o.revealRequest ?? null;
112
- re(e);
111
+ const e = n.revealRequest ?? null;
112
+ ie(e);
113
113
  });
114
- const Ue = (e) => Te(e), Ge = (e) => ze(e), Xe = (e) => G(e, O()), Ye = () => o.homeLabel ?? "Root", je = () => new Set(y()), Qe = () => new Set(ee()), He = (e) => {
115
- const t = Ae(e), n = Re(t);
116
- Le(Se((s) => {
117
- for (const r of Object.keys(s))
118
- r in n || delete s[r];
119
- for (const r of t)
120
- s[r] = !0;
121
- })), _e((s) => X(s, t) ? s : t);
122
- }, ie = (e) => {
123
- T[e] !== !0 && (Z(e, !0), te((t) => t.includes(e) ? t : [...t, e]));
124
- }, $e = (e) => {
125
- if (T[e] === !0) {
114
+ const Xe = (e) => De(e), Ye = (e) => Ne(e), je = (e) => X(e, T()), Qe = () => n.homeLabel ?? "Root", He = () => new Set(x()), $e = () => new Set(ee()), Je = (e) => {
115
+ const t = Ae(e), o = Pe(t);
116
+ Oe(Se((s) => {
117
+ for (const i of Object.keys(s))
118
+ i in o || delete s[i];
119
+ for (const i of t)
120
+ s[i] = !0;
121
+ })), Te((s) => Y(s, t) ? s : t);
122
+ }, re = (e) => {
123
+ z[e] !== !0 && (Z(e, !0), te((t) => t.includes(e) ? t : [...t, e]));
124
+ }, Ze = (e) => {
125
+ if (z[e] === !0) {
126
126
  Z(Se((t) => {
127
127
  delete t[e];
128
- })), te((t) => t.filter((n) => n !== e));
128
+ })), te((t) => t.filter((o) => o !== e));
129
129
  return;
130
130
  }
131
- ie(e);
131
+ re(e);
132
132
  }, [ce, P] = h([]);
133
- let w = null, V = {
133
+ let w = null, k = {
134
134
  top: 0,
135
135
  left: 0
136
136
  };
137
- const ae = () => o.files, le = (e) => {
138
- const t = i(e);
137
+ const ae = () => n.files, le = (e) => {
138
+ const t = r(e);
139
139
  if (t === "/") return "/";
140
- const n = t.split("/").filter(Boolean);
141
- return n.pop(), n.length ? "/" + n.join("/") : "/";
142
- }, Je = (e, t) => {
143
- const n = ce();
144
- if (n.length === 0) return e;
140
+ const o = t.split("/").filter(Boolean);
141
+ return o.pop(), o.length ? "/" + o.join("/") : "/";
142
+ }, et = (e, t) => {
143
+ const o = ce();
144
+ if (o.length === 0) return e;
145
145
  let s = [...e];
146
- const r = i(t);
147
- for (const a of n)
146
+ const i = r(t);
147
+ for (const a of o)
148
148
  switch (a.type) {
149
149
  case "remove": {
150
- const u = new Set(a.paths.map(i));
151
- s = s.filter((d) => !u.has(i(d.path)));
150
+ const u = new Set(a.paths.map(r));
151
+ s = s.filter((d) => !u.has(r(d.path)));
152
152
  break;
153
153
  }
154
154
  case "update": {
155
- const u = i(a.oldPath), d = s.findIndex((p) => i(p.path) === u);
155
+ const u = r(a.oldPath), d = s.findIndex((p) => r(p.path) === u);
156
156
  if (d !== -1) {
157
157
  const p = a.updates.path ?? s[d].path;
158
- le(p) === r ? s[d] = {
158
+ le(p) === i ? s[d] = {
159
159
  ...s[d],
160
160
  ...a.updates
161
161
  } : s.splice(d, 1);
@@ -166,25 +166,25 @@ function $t(o) {
166
166
  break;
167
167
  }
168
168
  case "insert": {
169
- i(a.parentPath) === r && (s.some((d) => i(d.path) === i(a.item.path)) || s.push(a.item));
169
+ r(a.parentPath) === i && (s.some((d) => r(d.path) === r(a.item.path)) || s.push(a.item));
170
170
  break;
171
171
  }
172
172
  }
173
173
  return s;
174
- }, Ze = U(() => {
174
+ }, tt = G(() => {
175
175
  const e = /* @__PURE__ */ new Map(), t = (s) => {
176
- for (const r of s)
177
- r.type === "folder" && (e.set(i(r.path), r.children ?? []), r.children?.length && t(r.children));
178
- }, n = ae();
179
- return e.set("/", n), t(n), e;
180
- }), k = U(() => {
181
- const e = i(A());
182
- let t = Ze().get(e) ?? [];
183
- t = Je(t, e);
184
- const n = _(), s = [...t].sort((a, u) => {
176
+ for (const i of s)
177
+ i.type === "folder" && (e.set(r(i.path), i.children ?? []), i.children?.length && t(i.children));
178
+ }, o = ae();
179
+ return e.set("/", o), t(o), e;
180
+ }), U = G(() => {
181
+ const e = r(B());
182
+ let t = tt().get(e) ?? [];
183
+ t = et(t, e);
184
+ const o = O(), s = [...t].sort((a, u) => {
185
185
  if (a.type !== u.type) return a.type === "folder" ? -1 : 1;
186
186
  let d = 0;
187
- switch (n.field) {
187
+ switch (o.field) {
188
188
  case "name":
189
189
  d = a.name.localeCompare(u.name);
190
190
  break;
@@ -198,19 +198,19 @@ function $t(o) {
198
198
  d = (a.extension ?? "").localeCompare(u.extension ?? "");
199
199
  break;
200
200
  }
201
- return n.direction === "asc" ? d : -d;
202
- }), r = /* @__PURE__ */ new Map();
201
+ return o.direction === "asc" ? d : -d;
202
+ }), i = /* @__PURE__ */ new Map();
203
203
  for (const a of s)
204
- r.set(a.id, a.name.toLowerCase());
204
+ i.set(a.id, a.name.toLowerCase());
205
205
  return {
206
206
  items: s,
207
- nameLowerById: r
207
+ nameLowerById: i
208
208
  };
209
- }), C = U(() => {
209
+ }), v = G(() => {
210
210
  const {
211
211
  items: e,
212
212
  nameLowerById: t
213
- } = k(), s = D().trim().toLowerCase(), r = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map();
213
+ } = U(), s = N().trim().toLowerCase(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map();
214
214
  if (!s) {
215
215
  for (let I = 0; I < e.length; I++) {
216
216
  const b = e[I];
@@ -218,7 +218,7 @@ function $t(o) {
218
218
  }
219
219
  return {
220
220
  items: e,
221
- matchById: r,
221
+ matchById: i,
222
222
  fileById: a,
223
223
  indexById: u
224
224
  };
@@ -227,96 +227,106 @@ function $t(o) {
227
227
  let p = 0;
228
228
  for (const I of e) {
229
229
  const b = t.get(I.id) ?? I.name.toLowerCase(), Ie = be(b, s);
230
- Ie && (d.push(I), r.set(I.id, {
230
+ Ie && (d.push(I), i.set(I.id, {
231
231
  matchedIndices: Ie
232
232
  }), a.set(I.id, I), u.set(I.id, p), p += 1);
233
233
  }
234
234
  return {
235
235
  items: d,
236
- matchById: r,
236
+ matchById: i,
237
237
  fileById: a,
238
238
  indexById: u
239
239
  };
240
- }), et = () => C().items;
240
+ }), nt = () => v().items;
241
241
  S(() => {
242
- const e = W();
243
- !e || e.clearFilter !== "if-needed" || C().fileById.has(e.targetId) || !k().items.some((s) => s.id === e.targetId) || (z(""), B(""), N(!1));
242
+ const e = q();
243
+ !e || e.clearFilter !== "if-needed" || v().fileById.has(e.targetId) || !U().items.some((s) => s.id === e.targetId) || (D(""), F(""), W(!1));
244
244
  });
245
245
  const de = (e) => {
246
- const t = C(), n = [];
246
+ const t = v(), o = [];
247
247
  for (const s of e) {
248
- const r = t.fileById.get(s);
249
- if (!r) continue;
248
+ const i = t.fileById.get(s);
249
+ if (!i) continue;
250
250
  const a = t.indexById.get(s);
251
- n.push({
251
+ o.push({
252
252
  index: a ?? Number.MAX_SAFE_INTEGER,
253
- item: r
253
+ item: i
254
254
  });
255
255
  }
256
- return n.sort((s, r) => s.index - r.index), n.map((s) => s.item);
257
- }, tt = (e) => {
258
- const t = o.onSelect;
256
+ return o.sort((s, i) => s.index - i.index), o.map((s) => s.item);
257
+ }, ot = (e) => {
258
+ const t = n.onSelect;
259
259
  if (!t) return;
260
- const n = [...e];
260
+ const o = [...e];
261
261
  E(() => {
262
- const s = Tt(() => de(n));
262
+ const s = Dt(() => de(o));
263
263
  t(s);
264
264
  });
265
265
  }, g = (e, t = {}) => {
266
- const n = Ae(e), r = (t.preserveAnchor === !0 ? R() : void 0) ?? (t.anchorId !== void 0 ? t.anchorId : n[0] ?? null), a = t.lastInteractedId !== void 0 ? t.lastInteractedId : n[n.length - 1] ?? null, u = !X(y(), n), d = R() !== r, p = L() !== a;
267
- !u && !d && !p || (He(n), Oe(r), Q(a), u && tt(n));
268
- }, nt = (e, t) => {
269
- const n = C(), s = n.indexById.get(e), r = n.indexById.get(t);
270
- if (s === void 0 || r === void 0) return [];
271
- const a = Math.min(s, r), u = Math.max(s, r);
272
- return n.items.slice(a, u + 1).map((d) => d.id);
273
- }, ot = () => {
274
- const e = R();
275
- return e && C().indexById.has(e) ? e : null;
266
+ const o = Ae(e), i = (t.preserveAnchor === !0 ? A() : void 0) ?? (t.anchorId !== void 0 ? t.anchorId : o[0] ?? null), a = t.lastInteractedId !== void 0 ? t.lastInteractedId : o[o.length - 1] ?? null, u = !Y(x(), o), d = A() !== i, p = _() !== a;
267
+ !u && !d && !p || (Je(o), ze(i), Q(a), u && ot(o));
268
+ }, st = (e, t) => {
269
+ const o = v(), s = o.indexById.get(e), i = o.indexById.get(t);
270
+ if (s === void 0 || i === void 0) return [];
271
+ const a = Math.min(s, i), u = Math.max(s, i);
272
+ return o.items.slice(a, u + 1).map((d) => d.id);
273
+ }, it = () => {
274
+ const e = A();
275
+ return e && v().indexById.has(e) ? e : null;
276
276
  }, ue = () => {
277
277
  g([], {
278
278
  anchorId: null,
279
279
  lastInteractedId: null
280
- }), z(""), B(""), N(!1);
280
+ }), D(""), F(""), W(!1);
281
281
  };
282
+ let R;
282
283
  S(() => {
283
- if (typeof o.path != "string") return;
284
- const e = i(o.path);
285
- e !== A() && (j(e), ue());
284
+ if (typeof n.path != "string") {
285
+ R = void 0;
286
+ return;
287
+ }
288
+ const e = r(n.path);
289
+ if (R === void 0) {
290
+ R = e;
291
+ return;
292
+ }
293
+ e !== R && (R = e, ue());
286
294
  });
287
295
  const K = (e) => {
288
- const t = i(e);
289
- if (t === A()) return;
290
- j(t), ue();
291
- const n = o.onNavigate;
292
- E(() => n?.(t));
293
- const s = o.onPathChange;
294
- E(() => s?.(t, "user"));
295
- }, st = (e) => {
296
- Ne(Pe(e));
297
- }, rt = () => {
298
- const e = A();
296
+ const t = r(e);
297
+ if (!(typeof n.path == "string")) {
298
+ if (t === B()) return;
299
+ _e(t), ue();
300
+ }
301
+ const s = n.onNavigate;
302
+ E(() => s?.(t));
303
+ const i = n.onPathChange;
304
+ E(() => i?.(t, "user"));
305
+ }, rt = (e) => {
306
+ qe(Re(e));
307
+ }, ct = () => {
308
+ const e = B();
299
309
  if (e === "/" || e === "") return;
300
310
  const t = e.split("/").filter(Boolean);
301
311
  t.pop(), K(t.length ? "/" + t.join("/") : "/");
302
312
  }, fe = (e) => {
303
- e.type === "folder" && (K(e.path), ie(e.path));
304
- }, it = (e, t = !1) => {
305
- const n = t ? F[e] === !0 ? y().filter((s) => s !== e) : [...y(), e] : [e];
306
- g(n, {
313
+ e.type === "folder" && (K(e.path), re(e.path));
314
+ }, at = (e, t = !1) => {
315
+ const o = t ? L[e] === !0 ? x().filter((s) => s !== e) : [...x(), e] : [e];
316
+ g(o, {
307
317
  anchorId: e,
308
318
  lastInteractedId: e
309
319
  });
310
- }, ct = (e, t = !1) => {
311
- const n = ot();
312
- if (!n) {
320
+ }, lt = (e, t = !1) => {
321
+ const o = it();
322
+ if (!o) {
313
323
  g([e], {
314
324
  anchorId: e,
315
325
  lastInteractedId: e
316
326
  });
317
327
  return;
318
328
  }
319
- const s = nt(n, e);
329
+ const s = st(o, e);
320
330
  if (s.length === 0) {
321
331
  g([e], {
322
332
  anchorId: e,
@@ -324,15 +334,15 @@ function $t(o) {
324
334
  });
325
335
  return;
326
336
  }
327
- const r = t ? [...y(), ...s] : s;
328
- g(r, {
329
- anchorId: n,
337
+ const i = t ? [...x(), ...s] : s;
338
+ g(i, {
339
+ anchorId: o,
330
340
  lastInteractedId: e
331
341
  });
332
- }, at = (e, t = {}) => {
342
+ }, dt = (e, t = {}) => {
333
343
  g(e, t);
334
- }, lt = (e) => {
335
- if (F[e] === !0) {
344
+ }, ut = (e) => {
345
+ if (L[e] === !0) {
336
346
  Q(e);
337
347
  return;
338
348
  }
@@ -340,65 +350,65 @@ function $t(o) {
340
350
  anchorId: e,
341
351
  lastInteractedId: e
342
352
  });
343
- }, dt = () => {
353
+ }, ft = () => {
344
354
  g([], {
345
355
  anchorId: null,
346
356
  lastInteractedId: null
347
357
  });
348
- }, ut = (e) => F[e] === !0, ft = (e) => $e(e), mt = (e) => T[e] === !0, ht = () => Ve((e) => !e), It = (e) => {
349
- qe((t) => G(e, t));
350
- }, pt = (e) => oe(e), St = () => oe(null), gt = (e) => {
351
- z(e);
352
- }, xt = (e) => {
353
- const t = D().trim();
358
+ }, mt = (e) => L[e] === !0, ht = (e) => Ze(e), It = (e) => z[e] === !0, pt = () => Ue((e) => !e), St = (e) => {
359
+ ke((t) => X(e, t));
360
+ }, gt = (e) => oe(e), yt = () => oe(null), xt = (e) => {
361
+ D(e);
362
+ }, wt = (e) => {
363
+ const t = N().trim();
354
364
  if (!t) return null;
355
- const n = be(e.toLowerCase(), t.toLowerCase());
356
- return n ? {
357
- matchedIndices: n
365
+ const o = be(e.toLowerCase(), t.toLowerCase());
366
+ return o ? {
367
+ matchedIndices: o
358
368
  } : null;
359
- }, yt = (e) => C().matchById.get(e) ?? null, wt = () => de(y());
369
+ }, vt = (e) => v().matchById.get(e) ?? null, Ct = () => de(x());
360
370
  S(() => {
361
- const e = new Set(k().items.map((d) => d.id)), t = y(), n = t.filter((d) => e.has(d)), s = R(), r = L(), a = s && e.has(s) ? s : n[0] ?? null, u = r && e.has(r) ? r : n[n.length - 1] ?? null;
362
- X(t, n) && s === a && r === u || g(n, {
371
+ const e = new Set(U().items.map((d) => d.id)), t = x(), o = t.filter((d) => e.has(d)), s = A(), i = _(), a = s && e.has(s) ? s : o[0] ?? null, u = i && e.has(i) ? i : o[o.length - 1] ?? null;
372
+ Y(t, o) && s === a && i === u || g(o, {
363
373
  anchorId: a,
364
374
  lastInteractedId: u
365
375
  });
366
376
  });
367
- const Ct = (e) => {
368
- const t = W();
377
+ const At = (e) => {
378
+ const t = q();
369
379
  if (!t || t.requestId !== e) return;
370
- re(null);
371
- const n = o.onRevealRequestConsumed;
372
- E(() => n?.(e));
373
- }, vt = (e) => {
380
+ ie(null);
381
+ const o = n.onRevealRequestConsumed;
382
+ E(() => o?.(e));
383
+ }, Pt = (e) => {
374
384
  if (e.type === "folder")
375
385
  fe(e);
376
386
  else {
377
- const t = o.onOpen;
387
+ const t = n.onOpen;
378
388
  E(() => t?.(e));
379
389
  }
380
- }, At = (e) => {
390
+ }, Rt = (e) => {
381
391
  e.length !== 0 && P((t) => [...t, {
382
392
  type: "remove",
383
393
  paths: e
384
394
  }]);
385
- }, Rt = (e, t) => {
386
- P((n) => [...n, {
395
+ }, bt = (e, t) => {
396
+ P((o) => [...o, {
387
397
  type: "update",
388
398
  oldPath: e,
389
399
  updates: t
390
400
  }]);
391
- }, Pt = (e, t) => {
392
- P((n) => [...n, {
401
+ }, Et = (e, t) => {
402
+ P((o) => [...o, {
393
403
  type: "insert",
394
404
  parentPath: e,
395
405
  item: t
396
406
  }]);
397
- }, bt = () => {
407
+ }, Mt = () => {
398
408
  P([]);
399
- }, Et = () => {
409
+ }, Bt = () => {
400
410
  P([]);
401
- }, Mt = () => ce().length > 0, Bt = (e) => {
411
+ }, Ft = () => ce().length > 0, Lt = (e) => {
402
412
  w = e;
403
413
  }, me = () => w ? {
404
414
  top: w.scrollTop,
@@ -408,83 +418,83 @@ function $t(o) {
408
418
  left: 0
409
419
  }, he = (e) => {
410
420
  w && (w.scrollTop = e.top, w.scrollLeft = e.left);
411
- }, Ft = {
412
- currentPath: A,
421
+ }, _t = {
422
+ currentPath: B,
413
423
  setCurrentPath: K,
414
- navigateUp: rt,
424
+ navigateUp: ct,
415
425
  navigateTo: fe,
416
- homeLabel: Ye,
417
- selectedItems: je,
418
- selectionAnchorId: R,
419
- lastInteractedId: L,
420
- selectItem: it,
421
- selectRangeTo: ct,
422
- replaceSelection: at,
423
- ensureContextMenuSelection: lt,
424
- clearSelection: dt,
425
- isSelected: ut,
426
- getSelectedItemsList: wt,
426
+ homeLabel: Qe,
427
+ selectedItems: He,
428
+ selectionAnchorId: A,
429
+ lastInteractedId: _,
430
+ selectItem: at,
431
+ selectRangeTo: lt,
432
+ replaceSelection: dt,
433
+ ensureContextMenuSelection: ut,
434
+ clearSelection: ft,
435
+ isSelected: mt,
436
+ getSelectedItemsList: Ct,
427
437
  viewMode: H,
428
- setViewMode: Ue,
429
- sortConfig: _,
430
- setSortConfig: Ge,
438
+ setViewMode: Xe,
439
+ sortConfig: O,
440
+ setSortConfig: Ye,
431
441
  listColumnRatios: $,
432
- setListColumnRatios: st,
433
- expandedFolders: Qe,
434
- toggleFolder: ft,
435
- isExpanded: mt,
442
+ setListColumnRatios: rt,
443
+ expandedFolders: $e,
444
+ toggleFolder: ht,
445
+ isExpanded: It,
436
446
  files: ae,
437
- currentFiles: et,
447
+ currentFiles: nt,
438
448
  filterQuery: se,
439
- setFilterQuery: gt,
440
- filterQueryApplied: D,
441
- isFilterActive: Ke,
442
- setFilterActive: N,
443
- getFilterMatch: xt,
444
- getFilterMatchForId: yt,
449
+ setFilterQuery: xt,
450
+ filterQueryApplied: N,
451
+ isFilterActive: Ge,
452
+ setFilterActive: W,
453
+ getFilterMatch: wt,
454
+ getFilterMatchForId: vt,
445
455
  sidebarCollapsed: ne,
446
- toggleSidebar: ht,
447
- sidebarWidth: O,
448
- clampSidebarWidth: Xe,
449
- setSidebarWidth: It,
450
- contextMenu: ke,
451
- showContextMenu: pt,
452
- hideContextMenu: St,
453
- openItem: vt,
454
- revealRequest: W,
455
- consumeRevealRequest: Ct,
456
+ toggleSidebar: pt,
457
+ sidebarWidth: T,
458
+ clampSidebarWidth: je,
459
+ setSidebarWidth: St,
460
+ contextMenu: Ke,
461
+ showContextMenu: gt,
462
+ hideContextMenu: yt,
463
+ openItem: Pt,
464
+ revealRequest: q,
465
+ consumeRevealRequest: At,
456
466
  // Optimistic updates
457
- optimisticRemove: At,
458
- optimisticUpdate: Rt,
459
- optimisticInsert: Pt,
460
- clearOptimisticUpdates: bt,
461
- rollbackOptimisticUpdates: Et,
462
- hasOptimisticUpdates: Mt,
467
+ optimisticRemove: Rt,
468
+ optimisticUpdate: bt,
469
+ optimisticInsert: Et,
470
+ clearOptimisticUpdates: Mt,
471
+ rollbackOptimisticUpdates: Bt,
472
+ hasOptimisticUpdates: Ft,
463
473
  // Scroll position management
464
- setScrollContainer: Bt,
474
+ setScrollContainer: Lt,
465
475
  getScrollPosition: me,
466
476
  setScrollPosition: he,
467
- saveScrollPosition: () => (V = me(), V),
477
+ saveScrollPosition: () => (k = me(), k),
468
478
  restoreScrollPosition: () => {
469
479
  requestAnimationFrame(() => {
470
- he(V);
480
+ he(k);
471
481
  });
472
482
  }
473
483
  };
474
- return Lt(Ee.Provider, {
475
- value: Ft,
484
+ return Ot(Ee.Provider, {
485
+ value: _t,
476
486
  get children() {
477
- return o.children;
487
+ return n.children;
478
488
  }
479
489
  });
480
490
  }
481
- function Jt() {
482
- const o = _t(Ee);
483
- if (!o)
491
+ function en() {
492
+ const n = Tt(Ee);
493
+ if (!n)
484
494
  throw new Error("useFileBrowser must be used within a FileBrowserProvider");
485
- return o;
495
+ return n;
486
496
  }
487
497
  export {
488
- $t as FileBrowserProvider,
489
- Jt as useFileBrowser
498
+ Zt as FileBrowserProvider,
499
+ en as useFileBrowser
490
500
  };