@aiquants/directory-tree 3.5.1 → 3.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,20 +1,20 @@
1
- import sr, { useRef as de, useEffect as ue, useCallback as W, memo as qe, useState as ae, useMemo as q, useLayoutEffect as ar, Fragment as or, useTransition as lr } from "react";
2
- import { VirtualScroll as ir, ScrollBar as cr } from "@aiquants/virtualscroll";
1
+ import or, { useRef as ue, useEffect as me, useCallback as W, memo as Ze, useState as ie, useMemo as Z, useLayoutEffect as lr, Fragment as ir, useTransition as cr } from "react";
2
+ import { VirtualScroll as dr, ScrollBar as ur } from "@aiquants/virtualscroll";
3
3
  import { twMerge as _ } from "tailwind-merge";
4
- import { FolderIcon as dr, ChevronDownIcon as ur, ChevronRightIcon as mr } from "@heroicons/react/24/solid";
5
- import { FileMd as wt, FilePdf as kt, FileXls as Nt, FileCsv as St, FileDoc as Et, FilePpt as It, FileImage as jt, FileAudio as Tt, FileVideo as Ct, FileZip as Rt, FileCode as Pt, FileText as _t, FileIcon as fr } from "@phosphor-icons/react";
6
- var De = { exports: {} }, Ie = {};
7
- var At;
8
- function hr() {
9
- if (At) return Ie;
10
- At = 1;
4
+ import { FolderIcon as mr, ChevronDownIcon as fr, ChevronRightIcon as hr } from "@heroicons/react/24/solid";
5
+ import { FileMd as kt, FilePdf as Nt, FileXls as Et, FileCsv as It, FileDoc as jt, FilePpt as Tt, FileImage as Ct, FileAudio as Rt, FileVideo as Pt, FileZip as _t, FileCode as At, FileText as Mt, FileIcon as pr } from "@phosphor-icons/react";
6
+ var De = { exports: {} }, Te = {};
7
+ var Ot;
8
+ function yr() {
9
+ if (Ot) return Te;
10
+ Ot = 1;
11
11
  var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), t = /* @__PURE__ */ Symbol.for("react.fragment");
12
12
  function a(n, r, o) {
13
13
  var l = null;
14
14
  if (o !== void 0 && (l = "" + o), r.key !== void 0 && (l = "" + r.key), "key" in r) {
15
15
  o = {};
16
- for (var m in r)
17
- m !== "key" && (o[m] = r[m]);
16
+ for (var u in r)
17
+ u !== "key" && (o[u] = r[u]);
18
18
  } else o = r;
19
19
  return r = o.ref, {
20
20
  $$typeof: e,
@@ -24,50 +24,50 @@ function hr() {
24
24
  props: o
25
25
  };
26
26
  }
27
- return Ie.Fragment = t, Ie.jsx = a, Ie.jsxs = a, Ie;
27
+ return Te.Fragment = t, Te.jsx = a, Te.jsxs = a, Te;
28
28
  }
29
- var je = {};
30
- var Mt;
31
- function pr() {
32
- return Mt || (Mt = 1, process.env.NODE_ENV !== "production" && (function() {
29
+ var Ce = {};
30
+ var Ft;
31
+ function xr() {
32
+ return Ft || (Ft = 1, process.env.NODE_ENV !== "production" && (function() {
33
33
  function e(s) {
34
34
  if (s == null) return null;
35
35
  if (typeof s == "function")
36
- return s.$$typeof === K ? null : s.displayName || s.name || null;
36
+ return s.$$typeof === H ? null : s.displayName || s.name || null;
37
37
  if (typeof s == "string") return s;
38
38
  switch (s) {
39
- case h:
39
+ case x:
40
40
  return "Fragment";
41
- case M:
41
+ case I:
42
42
  return "Profiler";
43
- case v:
43
+ case S:
44
44
  return "StrictMode";
45
- case O:
46
- return "Suspense";
47
45
  case D:
46
+ return "Suspense";
47
+ case C:
48
48
  return "SuspenseList";
49
- case Z:
49
+ case F:
50
50
  return "Activity";
51
51
  }
52
52
  if (typeof s == "object")
53
53
  switch (typeof s.tag == "number" && console.error(
54
54
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
55
55
  ), s.$$typeof) {
56
- case f:
56
+ case m:
57
57
  return "Portal";
58
- case b:
58
+ case w:
59
59
  return s.displayName || "Context";
60
60
  case N:
61
61
  return (s._context.displayName || "Context") + ".Consumer";
62
- case p:
63
- var u = s.render;
64
- return s = s.displayName, s || (s = u.displayName || u.name || "", s = s !== "" ? "ForwardRef(" + s + ")" : "ForwardRef"), s;
65
- case L:
66
- return u = s.displayName || null, u !== null ? u : e(s.type) || "Memo";
67
- case j:
68
- u = s._payload, s = s._init;
62
+ case h:
63
+ var p = s.render;
64
+ return s = s.displayName, s || (s = p.displayName || p.name || "", s = s !== "" ? "ForwardRef(" + s + ")" : "ForwardRef"), s;
65
+ case M:
66
+ return p = s.displayName || null, p !== null ? p : e(s.type) || "Memo";
67
+ case J:
68
+ p = s._payload, s = s._init;
69
69
  try {
70
- return e(s(u));
70
+ return e(s(p));
71
71
  } catch {
72
72
  }
73
73
  }
@@ -79,74 +79,74 @@ function pr() {
79
79
  function a(s) {
80
80
  try {
81
81
  t(s);
82
- var u = !1;
82
+ var p = !1;
83
83
  } catch {
84
- u = !0;
84
+ p = !0;
85
85
  }
86
- if (u) {
87
- u = console;
88
- var w = u.error, E = typeof Symbol == "function" && Symbol.toStringTag && s[Symbol.toStringTag] || s.constructor.name || "Object";
89
- return w.call(
90
- u,
86
+ if (p) {
87
+ p = console;
88
+ var y = p.error, j = typeof Symbol == "function" && Symbol.toStringTag && s[Symbol.toStringTag] || s.constructor.name || "Object";
89
+ return y.call(
90
+ p,
91
91
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
92
- E
92
+ j
93
93
  ), t(s);
94
94
  }
95
95
  }
96
96
  function n(s) {
97
- if (s === h) return "<>";
98
- if (typeof s == "object" && s !== null && s.$$typeof === j)
97
+ if (s === x) return "<>";
98
+ if (typeof s == "object" && s !== null && s.$$typeof === J)
99
99
  return "<...>";
100
100
  try {
101
- var u = e(s);
102
- return u ? "<" + u + ">" : "<...>";
101
+ var p = e(s);
102
+ return p ? "<" + p + ">" : "<...>";
103
103
  } catch {
104
104
  return "<...>";
105
105
  }
106
106
  }
107
107
  function r() {
108
- var s = R.A;
108
+ var s = q.A;
109
109
  return s === null ? null : s.getOwner();
110
110
  }
111
111
  function o() {
112
112
  return Error("react-stack-top-frame");
113
113
  }
114
114
  function l(s) {
115
- if (z.call(s, "key")) {
116
- var u = Object.getOwnPropertyDescriptor(s, "key").get;
117
- if (u && u.isReactWarning) return !1;
115
+ if (K.call(s, "key")) {
116
+ var p = Object.getOwnPropertyDescriptor(s, "key").get;
117
+ if (p && p.isReactWarning) return !1;
118
118
  }
119
119
  return s.key !== void 0;
120
120
  }
121
- function m(s, u) {
122
- function w() {
123
- te || (te = !0, console.error(
121
+ function u(s, p) {
122
+ function y() {
123
+ B || (B = !0, console.error(
124
124
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
125
- u
125
+ p
126
126
  ));
127
127
  }
128
- w.isReactWarning = !0, Object.defineProperty(s, "key", {
129
- get: w,
128
+ y.isReactWarning = !0, Object.defineProperty(s, "key", {
129
+ get: y,
130
130
  configurable: !0
131
131
  });
132
132
  }
133
- function I() {
133
+ function E() {
134
134
  var s = e(this.type);
135
- return re[s] || (re[s] = !0, console.error(
135
+ return Y[s] || (Y[s] = !0, console.error(
136
136
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
137
137
  )), s = this.props.ref, s !== void 0 ? s : null;
138
138
  }
139
- function x(s, u, w, E, B, le) {
140
- var T = w.ref;
139
+ function b(s, p, y, j, L, G) {
140
+ var P = y.ref;
141
141
  return s = {
142
- $$typeof: S,
142
+ $$typeof: k,
143
143
  type: s,
144
- key: u,
145
- props: w,
146
- _owner: E
147
- }, (T !== void 0 ? T : null) !== null ? Object.defineProperty(s, "ref", {
144
+ key: p,
145
+ props: y,
146
+ _owner: j
147
+ }, (P !== void 0 ? P : null) !== null ? Object.defineProperty(s, "ref", {
148
148
  enumerable: !1,
149
- get: I
149
+ get: E
150
150
  }) : Object.defineProperty(s, "ref", { enumerable: !1, value: null }), s._store = {}, Object.defineProperty(s._store, "validated", {
151
151
  configurable: !1,
152
152
  enumerable: !1,
@@ -161,69 +161,69 @@ function pr() {
161
161
  configurable: !1,
162
162
  enumerable: !1,
163
163
  writable: !0,
164
- value: B
164
+ value: L
165
165
  }), Object.defineProperty(s, "_debugTask", {
166
166
  configurable: !1,
167
167
  enumerable: !1,
168
168
  writable: !0,
169
- value: le
169
+ value: G
170
170
  }), Object.freeze && (Object.freeze(s.props), Object.freeze(s)), s;
171
171
  }
172
- function c(s, u, w, E, B, le) {
173
- var T = u.children;
174
- if (T !== void 0)
175
- if (E)
176
- if (F(T)) {
177
- for (E = 0; E < T.length; E++)
178
- y(T[E]);
179
- Object.freeze && Object.freeze(T);
172
+ function d(s, p, y, j, L, G) {
173
+ var P = p.children;
174
+ if (P !== void 0)
175
+ if (j)
176
+ if (R(P)) {
177
+ for (j = 0; j < P.length; j++)
178
+ f(P[j]);
179
+ Object.freeze && Object.freeze(P);
180
180
  } else
181
181
  console.error(
182
182
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
183
183
  );
184
- else y(T);
185
- if (z.call(u, "key")) {
186
- T = e(s);
187
- var V = Object.keys(u).filter(function(ie) {
188
- return ie !== "key";
184
+ else f(P);
185
+ if (K.call(p, "key")) {
186
+ P = e(s);
187
+ var Q = Object.keys(p).filter(function(oe) {
188
+ return oe !== "key";
189
189
  });
190
- E = 0 < V.length ? "{key: someKey, " + V.join(": ..., ") + ": ...}" : "{key: someKey}", G[T + E] || (V = 0 < V.length ? "{" + V.join(": ..., ") + ": ...}" : "{}", console.error(
190
+ j = 0 < Q.length ? "{key: someKey, " + Q.join(": ..., ") + ": ...}" : "{key: someKey}", A[P + j] || (Q = 0 < Q.length ? "{" + Q.join(": ..., ") + ": ...}" : "{}", console.error(
191
191
  `A props object containing a "key" prop is being spread into JSX:
192
192
  let props = %s;
193
193
  <%s {...props} />
194
194
  React keys must be passed directly to JSX without using spread:
195
195
  let props = %s;
196
196
  <%s key={someKey} {...props} />`,
197
- E,
198
- T,
199
- V,
200
- T
201
- ), G[T + E] = !0);
197
+ j,
198
+ P,
199
+ Q,
200
+ P
201
+ ), A[P + j] = !0);
202
202
  }
203
- if (T = null, w !== void 0 && (a(w), T = "" + w), l(u) && (a(u.key), T = "" + u.key), "key" in u) {
204
- w = {};
205
- for (var ne in u)
206
- ne !== "key" && (w[ne] = u[ne]);
207
- } else w = u;
208
- return T && m(
209
- w,
203
+ if (P = null, y !== void 0 && (a(y), P = "" + y), l(p) && (a(p.key), P = "" + p.key), "key" in p) {
204
+ y = {};
205
+ for (var re in p)
206
+ re !== "key" && (y[re] = p[re]);
207
+ } else y = p;
208
+ return P && u(
209
+ y,
210
210
  typeof s == "function" ? s.displayName || s.name || "Unknown" : s
211
- ), x(
211
+ ), b(
212
212
  s,
213
- T,
214
- w,
213
+ P,
214
+ y,
215
215
  r(),
216
- B,
217
- le
216
+ L,
217
+ G
218
218
  );
219
219
  }
220
- function y(s) {
221
- k(s) ? s._store && (s._store.validated = 1) : typeof s == "object" && s !== null && s.$$typeof === j && (s._payload.status === "fulfilled" ? k(s._payload.value) && s._payload.value._store && (s._payload.value._store.validated = 1) : s._store && (s._store.validated = 1));
220
+ function f(s) {
221
+ v(s) ? s._store && (s._store.validated = 1) : typeof s == "object" && s !== null && s.$$typeof === J && (s._payload.status === "fulfilled" ? v(s._payload.value) && s._payload.value._store && (s._payload.value._store.validated = 1) : s._store && (s._store.validated = 1));
222
222
  }
223
- function k(s) {
224
- return typeof s == "object" && s !== null && s.$$typeof === S;
223
+ function v(s) {
224
+ return typeof s == "object" && s !== null && s.$$typeof === k;
225
225
  }
226
- var g = sr, S = /* @__PURE__ */ Symbol.for("react.transitional.element"), f = /* @__PURE__ */ Symbol.for("react.portal"), h = /* @__PURE__ */ Symbol.for("react.fragment"), v = /* @__PURE__ */ Symbol.for("react.strict_mode"), M = /* @__PURE__ */ Symbol.for("react.profiler"), N = /* @__PURE__ */ Symbol.for("react.consumer"), b = /* @__PURE__ */ Symbol.for("react.context"), p = /* @__PURE__ */ Symbol.for("react.forward_ref"), O = /* @__PURE__ */ Symbol.for("react.suspense"), D = /* @__PURE__ */ Symbol.for("react.suspense_list"), L = /* @__PURE__ */ Symbol.for("react.memo"), j = /* @__PURE__ */ Symbol.for("react.lazy"), Z = /* @__PURE__ */ Symbol.for("react.activity"), K = /* @__PURE__ */ Symbol.for("react.client.reference"), R = g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, z = Object.prototype.hasOwnProperty, F = Array.isArray, $ = console.createTask ? console.createTask : function() {
226
+ var g = or, k = /* @__PURE__ */ Symbol.for("react.transitional.element"), m = /* @__PURE__ */ Symbol.for("react.portal"), x = /* @__PURE__ */ Symbol.for("react.fragment"), S = /* @__PURE__ */ Symbol.for("react.strict_mode"), I = /* @__PURE__ */ Symbol.for("react.profiler"), N = /* @__PURE__ */ Symbol.for("react.consumer"), w = /* @__PURE__ */ Symbol.for("react.context"), h = /* @__PURE__ */ Symbol.for("react.forward_ref"), D = /* @__PURE__ */ Symbol.for("react.suspense"), C = /* @__PURE__ */ Symbol.for("react.suspense_list"), M = /* @__PURE__ */ Symbol.for("react.memo"), J = /* @__PURE__ */ Symbol.for("react.lazy"), F = /* @__PURE__ */ Symbol.for("react.activity"), H = /* @__PURE__ */ Symbol.for("react.client.reference"), q = g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, K = Object.prototype.hasOwnProperty, R = Array.isArray, z = console.createTask ? console.createTask : function() {
227
227
  return null;
228
228
  };
229
229
  g = {
@@ -231,39 +231,39 @@ React keys must be passed directly to JSX without using spread:
231
231
  return s();
232
232
  }
233
233
  };
234
- var te, re = {}, P = g.react_stack_bottom_frame.bind(
234
+ var B, Y = {}, ae = g.react_stack_bottom_frame.bind(
235
235
  g,
236
236
  o
237
- )(), oe = $(n(o)), G = {};
238
- je.Fragment = h, je.jsx = function(s, u, w) {
239
- var E = 1e4 > R.recentlyCreatedOwnerStacks++;
240
- return c(
237
+ )(), te = z(n(o)), A = {};
238
+ Ce.Fragment = x, Ce.jsx = function(s, p, y) {
239
+ var j = 1e4 > q.recentlyCreatedOwnerStacks++;
240
+ return d(
241
241
  s,
242
- u,
243
- w,
242
+ p,
243
+ y,
244
244
  !1,
245
- E ? Error("react-stack-top-frame") : P,
246
- E ? $(n(s)) : oe
245
+ j ? Error("react-stack-top-frame") : ae,
246
+ j ? z(n(s)) : te
247
247
  );
248
- }, je.jsxs = function(s, u, w) {
249
- var E = 1e4 > R.recentlyCreatedOwnerStacks++;
250
- return c(
248
+ }, Ce.jsxs = function(s, p, y) {
249
+ var j = 1e4 > q.recentlyCreatedOwnerStacks++;
250
+ return d(
251
251
  s,
252
- u,
253
- w,
252
+ p,
253
+ y,
254
254
  !0,
255
- E ? Error("react-stack-top-frame") : P,
256
- E ? $(n(s)) : oe
255
+ j ? Error("react-stack-top-frame") : ae,
256
+ j ? z(n(s)) : te
257
257
  );
258
258
  };
259
- })()), je;
259
+ })()), Ce;
260
260
  }
261
- var Ot;
262
- function yr() {
263
- return Ot || (Ot = 1, process.env.NODE_ENV === "production" ? De.exports = hr() : De.exports = pr()), De.exports;
261
+ var Dt;
262
+ function br() {
263
+ return Dt || (Dt = 1, process.env.NODE_ENV === "production" ? De.exports = yr() : De.exports = xr()), De.exports;
264
264
  }
265
- var i = yr();
266
- const Le = 18, Fe = 12, Dt = 10, A = {
265
+ var i = br();
266
+ const Le = 18, $e = 12, Lt = 10, O = {
267
267
  container: "directory-tree-container relative h-full transition-opacity duration-300 overflow-y-hidden pb-[3px] pr-[2px]",
268
268
  containerPending: "opacity-70",
269
269
  entry: "directory-tree-entry flex items-center cursor-pointer relative select-none text-xs leading-tight py-0.5",
@@ -282,14 +282,14 @@ const Le = 18, Fe = 12, Dt = 10, A = {
282
282
  name: _("directory-tree-name overflow-hidden text-ellipsis whitespace-nowrap ml-1 text-xs font-normal", "text-gray-700", "dark:text-gray-200"),
283
283
  nameDirectory: "directory-tree-name--directory font-medium",
284
284
  nameSelected: _("directory-tree-name--selected text-blue-800 font-semibold", "dark:text-blue-300")
285
- }, ve = (e) => {
285
+ }, ge = (e) => {
286
286
  if (!e) return "";
287
287
  const t = e.split("?")[0].split("#")[0].split("/").pop() || e, a = t.lastIndexOf(".");
288
288
  return a <= 0 ? "" : t.slice(a + 1).toLowerCase();
289
- }, Ht = ({ isDirectory: e, isExpanded: t, showExpandIcons: a, useCanvasExpandIcons: n, expandIconSize: r }) => {
289
+ }, Bt = ({ isDirectory: e, isExpanded: t, showExpandIcons: a, useCanvasExpandIcons: n, expandIconSize: r }) => {
290
290
  const o = r ? { width: r, height: r } : void 0, l = r ? "" : "h-4 w-4";
291
- return !(a && e) || n ? /* @__PURE__ */ i.jsx("span", { className: l, style: o, "aria-hidden": "true" }) : t ? /* @__PURE__ */ i.jsx(ur, { className: l, style: o }) : /* @__PURE__ */ i.jsx(mr, { className: l, style: o });
292
- }, Xe = (e, t) => {
291
+ return !(a && e) || n ? /* @__PURE__ */ i.jsx("span", { className: l, style: o, "aria-hidden": "true" }) : t ? /* @__PURE__ */ i.jsx(fr, { className: l, style: o }) : /* @__PURE__ */ i.jsx(hr, { className: l, style: o });
292
+ }, Je = (e, t) => {
293
293
  if (e == null || typeof e == "boolean") return null;
294
294
  if (typeof e == "function")
295
295
  return console.warn(`[DirectoryTree] Function returned by renderer for "${t}". Return a node.`), null;
@@ -297,7 +297,7 @@ const Le = 18, Fe = 12, Dt = 10, A = {
297
297
  if ("then" in e)
298
298
  return console.warn(`[DirectoryTree] Promise returned for "${t}". Not supported.`), null;
299
299
  if (Array.isArray(e)) {
300
- const n = e.map((r) => Xe(r, t)).filter(Boolean);
300
+ const n = e.map((r) => Je(r, t)).filter(Boolean);
301
301
  return n.length ? n : null;
302
302
  }
303
303
  const a = e.type;
@@ -305,166 +305,170 @@ const Le = 18, Fe = 12, Dt = 10, A = {
305
305
  return console.warn(`[DirectoryTree] Lazy component for "${t}". Not supported.`), null;
306
306
  }
307
307
  return e;
308
- }, xr = (e, t, a) => {
309
- const n = (t || (a ? ve(a) : "")).toLowerCase(), r = (e || "").toLowerCase();
308
+ }, vr = (e, t, a) => {
309
+ const n = (t || (a ? ge(a) : "")).toLowerCase(), r = (e || "").toLowerCase();
310
310
  if (r && r !== "application/octet-stream") {
311
311
  if (r === "text/markdown" || r === "text/x-markdown")
312
- return /* @__PURE__ */ i.jsx(wt, { className: "h-4 w-4 text-sky-500 dark:text-sky-400" });
312
+ return /* @__PURE__ */ i.jsx(kt, { className: "h-4 w-4 text-sky-500 dark:text-sky-400" });
313
313
  if (r === "application/pdf")
314
- return /* @__PURE__ */ i.jsx(kt, { className: "h-4 w-4 text-red-500 dark:text-red-400" });
314
+ return /* @__PURE__ */ i.jsx(Nt, { className: "h-4 w-4 text-red-500 dark:text-red-400" });
315
315
  if (r.includes("excel") || r.includes("spreadsheet") || r.includes("google-apps.spreadsheet"))
316
- return /* @__PURE__ */ i.jsx(Nt, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
316
+ return /* @__PURE__ */ i.jsx(Et, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
317
317
  if (r === "text/csv" || r === "text/tab-separated-values")
318
- return /* @__PURE__ */ i.jsx(St, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
318
+ return /* @__PURE__ */ i.jsx(It, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
319
319
  if (r.includes("word") || r.includes("msword") || r.includes("wordprocessingml") || r.includes("google-apps.document") || r === "application/rtf")
320
- return /* @__PURE__ */ i.jsx(Et, { className: "h-4 w-4 text-blue-600 dark:text-blue-400" });
320
+ return /* @__PURE__ */ i.jsx(jt, { className: "h-4 w-4 text-blue-600 dark:text-blue-400" });
321
321
  if (r.includes("powerpoint") || r.includes("presentation") || r.includes("google-apps.presentation"))
322
- return /* @__PURE__ */ i.jsx(It, { className: "h-4 w-4 text-orange-500 dark:text-orange-400" });
322
+ return /* @__PURE__ */ i.jsx(Tt, { className: "h-4 w-4 text-orange-500 dark:text-orange-400" });
323
323
  if (r.startsWith("image/"))
324
- return /* @__PURE__ */ i.jsx(jt, { className: "h-4 w-4 text-teal-500 dark:text-teal-400" });
324
+ return /* @__PURE__ */ i.jsx(Ct, { className: "h-4 w-4 text-teal-500 dark:text-teal-400" });
325
325
  if (r.startsWith("audio/"))
326
- return /* @__PURE__ */ i.jsx(Tt, { className: "h-4 w-4 text-pink-500 dark:text-pink-400" });
326
+ return /* @__PURE__ */ i.jsx(Rt, { className: "h-4 w-4 text-pink-500 dark:text-pink-400" });
327
327
  if (r.startsWith("video/"))
328
- return /* @__PURE__ */ i.jsx(Ct, { className: "h-4 w-4 text-violet-500 dark:text-violet-400" });
328
+ return /* @__PURE__ */ i.jsx(Pt, { className: "h-4 w-4 text-violet-500 dark:text-violet-400" });
329
329
  if (r.includes("zip") || r.includes("tar") || r.includes("compressed") || r.includes("archive"))
330
- return /* @__PURE__ */ i.jsx(Rt, { className: "h-4 w-4 text-amber-500 dark:text-amber-400" });
330
+ return /* @__PURE__ */ i.jsx(_t, { className: "h-4 w-4 text-amber-500 dark:text-amber-400" });
331
331
  if (r === "application/json" || r.includes("javascript") || r.includes("typescript") || r.includes("xml") || r.startsWith("text/html") || r.startsWith("text/css") || r.includes("x-python") || r.includes("x-sh") || r.includes("x-go") || r.includes("x-rust"))
332
- return /* @__PURE__ */ i.jsx(Pt, { className: "h-4 w-4 text-purple-500 dark:text-purple-400" });
332
+ return /* @__PURE__ */ i.jsx(At, { className: "h-4 w-4 text-purple-500 dark:text-purple-400" });
333
333
  if (r.startsWith("text/"))
334
- return /* @__PURE__ */ i.jsx(_t, { className: "h-4 w-4 text-gray-500 dark:text-gray-400" });
334
+ return /* @__PURE__ */ i.jsx(Mt, { className: "h-4 w-4 text-gray-500 dark:text-gray-400" });
335
335
  }
336
336
  if (n) {
337
337
  if (n === "md" || n === "markdown" || n === "mdx")
338
- return /* @__PURE__ */ i.jsx(wt, { className: "h-4 w-4 text-sky-500 dark:text-sky-400" });
338
+ return /* @__PURE__ */ i.jsx(kt, { className: "h-4 w-4 text-sky-500 dark:text-sky-400" });
339
339
  if (n === "pdf")
340
- return /* @__PURE__ */ i.jsx(kt, { className: "h-4 w-4 text-red-500 dark:text-red-400" });
340
+ return /* @__PURE__ */ i.jsx(Nt, { className: "h-4 w-4 text-red-500 dark:text-red-400" });
341
341
  if (["xls", "xlsx", "xlsm", "xlsb", "ods"].includes(n))
342
- return /* @__PURE__ */ i.jsx(Nt, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
342
+ return /* @__PURE__ */ i.jsx(Et, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
343
343
  if (["csv", "tsv"].includes(n))
344
- return /* @__PURE__ */ i.jsx(St, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
344
+ return /* @__PURE__ */ i.jsx(It, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
345
345
  if (["doc", "docx", "rtf", "odt"].includes(n))
346
- return /* @__PURE__ */ i.jsx(Et, { className: "h-4 w-4 text-blue-600 dark:text-blue-400" });
346
+ return /* @__PURE__ */ i.jsx(jt, { className: "h-4 w-4 text-blue-600 dark:text-blue-400" });
347
347
  if (["ppt", "pptx", "odp"].includes(n))
348
- return /* @__PURE__ */ i.jsx(It, { className: "h-4 w-4 text-orange-500 dark:text-orange-400" });
348
+ return /* @__PURE__ */ i.jsx(Tt, { className: "h-4 w-4 text-orange-500 dark:text-orange-400" });
349
349
  if (["png", "jpg", "jpeg", "gif", "svg", "webp", "ico", "bmp", "tiff", "avif"].includes(n))
350
- return /* @__PURE__ */ i.jsx(jt, { className: "h-4 w-4 text-teal-500 dark:text-teal-400" });
350
+ return /* @__PURE__ */ i.jsx(Ct, { className: "h-4 w-4 text-teal-500 dark:text-teal-400" });
351
351
  if (["js", "mjs", "cjs", "ts", "tsx", "jsx", "json", "html", "htm", "css", "scss", "py", "go", "rs", "c", "cpp", "h", "hpp", "sh", "bash", "yaml", "yml", "sql", "xml", "toml"].includes(n))
352
- return /* @__PURE__ */ i.jsx(Pt, { className: "h-4 w-4 text-purple-500 dark:text-purple-400" });
352
+ return /* @__PURE__ */ i.jsx(At, { className: "h-4 w-4 text-purple-500 dark:text-purple-400" });
353
353
  if (["mp3", "wav", "ogg", "m4a", "flac", "aac", "wma"].includes(n))
354
- return /* @__PURE__ */ i.jsx(Tt, { className: "h-4 w-4 text-pink-500 dark:text-pink-400" });
354
+ return /* @__PURE__ */ i.jsx(Rt, { className: "h-4 w-4 text-pink-500 dark:text-pink-400" });
355
355
  if (["mp4", "webm", "mov", "avi", "mkv", "wmv", "flv"].includes(n))
356
- return /* @__PURE__ */ i.jsx(Ct, { className: "h-4 w-4 text-violet-500 dark:text-violet-400" });
356
+ return /* @__PURE__ */ i.jsx(Pt, { className: "h-4 w-4 text-violet-500 dark:text-violet-400" });
357
357
  if (["zip", "tar", "gz", "7z", "rar", "tgz", "bz2"].includes(n))
358
- return /* @__PURE__ */ i.jsx(Rt, { className: "h-4 w-4 text-amber-500 dark:text-amber-400" });
358
+ return /* @__PURE__ */ i.jsx(_t, { className: "h-4 w-4 text-amber-500 dark:text-amber-400" });
359
359
  if (["txt", "log"].includes(n))
360
- return /* @__PURE__ */ i.jsx(_t, { className: "h-4 w-4 text-gray-500 dark:text-gray-400" });
360
+ return /* @__PURE__ */ i.jsx(Mt, { className: "h-4 w-4 text-gray-500 dark:text-gray-400" });
361
361
  }
362
- return /* @__PURE__ */ i.jsx(fr, { className: "h-4 w-4 text-gray-400 dark:text-gray-400" });
363
- }, Wt = (e, t) => {
362
+ return /* @__PURE__ */ i.jsx(pr, { className: "h-4 w-4 text-gray-400 dark:text-gray-400" });
363
+ }, zt = (e, t) => {
364
364
  const { entry: a, isDirectory: n, isExpanded: r, extension: o, mimeType: l } = e;
365
- let m;
366
- const I = l || a.mimeType;
367
- return a.icon !== void 0 ? m = a.icon : n ? m = r && t?.directoryExpanded || t?.directory || /* @__PURE__ */ i.jsx(dr, { className: "h-4 w-4" }) : o && t?.fileByExtension?.[o] ? m = t.fileByExtension[o] : m = t?.file || xr(I, o, a.name), Xe(typeof m == "function" ? m(e) : m, a.absolutePath);
368
- }, vr = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Bt = (e) => {
365
+ let u;
366
+ const E = l || a.mimeType;
367
+ return a.icon !== void 0 ? u = a.icon : n ? u = r && t?.directoryExpanded || t?.directory || /* @__PURE__ */ i.jsx(mr, { className: "h-4 w-4" }) : o && t?.fileByExtension?.[o] ? u = t.fileByExtension[o] : u = t?.file || vr(E, o, a.name), Je(typeof u == "function" ? u(e) : u, a.absolutePath);
368
+ }, gr = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Yt = (e) => {
369
369
  if (!e)
370
370
  return;
371
371
  const t = Object.entries(e).filter(([, a]) => a != null);
372
372
  if (t.length !== 0)
373
- return Object.fromEntries(t.map(([a, n]) => [`data-${vr(a)}`, String(n)]));
374
- }, br = 500, zt = ({ entry: e, isDirectory: t, isExpanded: a, isItemSelected: n, selectionMode: r, onSelectionChange: o, onEntryClick: l, toggleDirectory: m, onToggleDirectoryRecursive: I }) => {
375
- const x = de(null);
376
- return ue(
373
+ return Object.fromEntries(t.map(([a, n]) => [`data-${gr(a)}`, String(n)]));
374
+ }, wr = 500, Gt = ({ entry: e, isDirectory: t, isExpanded: a, isItemSelected: n, selectionMode: r, onSelectionChange: o, onEntryClick: l, toggleDirectory: u, onToggleDirectoryRecursive: E }) => {
375
+ const b = ue(null);
376
+ return me(
377
377
  () => () => {
378
- x.current && window.clearTimeout(x.current);
378
+ b.current && window.clearTimeout(b.current);
379
379
  },
380
380
  []
381
381
  ), W(
382
- (c) => {
383
- c.stopPropagation(), r !== "none" && !t && o && o(e, !n);
384
- let y = !1;
382
+ (d) => {
383
+ d.stopPropagation(), r !== "none" && !t && o && o(e, !n);
384
+ let f = !1;
385
385
  l({
386
386
  entry: e,
387
387
  isDirectory: t,
388
388
  isExpanded: a,
389
389
  preventDefault: () => {
390
- y = !0;
390
+ f = !0;
391
391
  }
392
- }), !(!t || y) && (x.current ? (window.clearTimeout(x.current), x.current = null, I(e)) : x.current = window.setTimeout(() => {
393
- m(e.absolutePath), x.current = null;
394
- }, br));
392
+ }), !(!t || f) && (b.current ? (window.clearTimeout(b.current), b.current = null, E(e)) : b.current = window.setTimeout(() => {
393
+ u(e.absolutePath), b.current = null;
394
+ }, wr));
395
395
  },
396
- [t, e, a, I, m, l, r, o, n]
396
+ [t, e, a, E, u, l, r, o, n]
397
397
  );
398
- }, Yt = (e) => e === "right" ? "dt-grid-cell--right" : e === "center" ? "dt-grid-cell--center" : "", Lt = (e, t) => e.children !== void 0 && t(e.absolutePath), Gt = (e, t) => ({
398
+ }, Vt = (e) => e === "right" ? "dt-grid-cell--right" : e === "center" ? "dt-grid-cell--center" : "", $t = (e, t) => e.children !== void 0 && t(e.absolutePath), Ut = (e, t) => ({
399
399
  width: e,
400
400
  gridTemplateColumns: t
401
- }), Vt = qe(
401
+ }), Xt = Ze(
402
402
  ({
403
403
  entry: e,
404
404
  indentLevel: t,
405
405
  positionInSet: a,
406
406
  setSize: n,
407
- rowHeight: r,
408
- isDirOpen: o,
409
- columns: l,
410
- numericTemplate: m,
411
- numericTotal: I,
412
- nameWidth: x,
413
- rowClassName: c,
414
- selection: { onEntryClick: y, selectedPath: k, mode: g = "none", selectedItems: S, onSelectionChange: f },
415
- expansion: { toggleDirectory: h, onToggleDirectoryRecursive: v },
416
- visual: { iconOverrides: M, showExpandIcons: N = !0, showDirectoryIcons: b = !0, showFileIcons: p = !0, useCanvasExpandIcons: O = !1, expandIconSize: D, indentSize: L = Fe, highlightStyles: j }
407
+ rowIndex: r,
408
+ isSelectedForAria: o,
409
+ rowHeight: l,
410
+ isDirOpen: u,
411
+ columns: E,
412
+ numericTemplate: b,
413
+ numericTotal: d,
414
+ nameWidth: f,
415
+ rowClassName: v,
416
+ selection: { onEntryClick: g, selectedPath: k, mode: m = "none", selectedItems: x, onSelectionChange: S },
417
+ expansion: { toggleDirectory: I, onToggleDirectoryRecursive: N },
418
+ visual: { iconOverrides: w, showExpandIcons: h = !0, showDirectoryIcons: D = !0, showFileIcons: C = !0, useCanvasExpandIcons: M = !1, expandIconSize: J, indentSize: F = $e, highlightStyles: H }
417
419
  }) => {
418
- const [Z, K] = ae(!1), R = e.children !== void 0, z = R && o(e.absolutePath), F = e.absolutePath === k, $ = !R && !!S?.has(e.absolutePath), te = R ? void 0 : ve(e.name) || ve(e.relativePath) || ve(e.absolutePath), re = zt({ entry: e, isDirectory: R, isExpanded: z, isItemSelected: $, selectionMode: g, onSelectionChange: f, onEntryClick: y, toggleDirectory: h, onToggleDirectoryRecursive: v }), P = Z ? j?.hoverClassName !== void 0 ? j.hoverClassName : A.entryHover : "", oe = (() => {
420
+ const [q, K] = ie(!1), R = e.children !== void 0, z = R && u(e.absolutePath), B = e.absolutePath === k, Y = !R && !!x?.has(e.absolutePath), ae = R ? void 0 : ge(e.name) || ge(e.relativePath) || ge(e.absolutePath), te = Gt({ entry: e, isDirectory: R, isExpanded: z, isItemSelected: Y, selectionMode: m, onSelectionChange: S, onEntryClick: g, toggleDirectory: I, onToggleDirectoryRecursive: N }), A = q ? H?.hoverClassName !== void 0 ? H.hoverClassName : O.entryHover : "", s = (() => {
419
421
  if (R) {
420
- if (F) return j?.directorySelectedClassName !== void 0 ? j.directorySelectedClassName : A.entrySelected;
421
- } else if (F || $)
422
- return j?.itemSelectedClassName !== void 0 ? j.itemSelectedClassName : _(F && A.entrySelected, $ && A.entryItemSelected);
422
+ if (B) return H?.directorySelectedClassName !== void 0 ? H.directorySelectedClassName : O.entrySelected;
423
+ } else if (B || Y)
424
+ return H?.itemSelectedClassName !== void 0 ? H.itemSelectedClassName : _(B && O.entrySelected, Y && O.entryItemSelected);
423
425
  return "";
424
- })(), G = typeof c == "function" ? c(e) : c, s = _("dt-grid-row cursor-pointer select-none", P, oe, G, e.className), u = _(A.expandIcon, (F || $) && A.expandIconSelected), w = _(A.typeIcon, (F || $) && A.typeIconSelected), E = _("dt-grid-name-label ml-1", "text-gray-700 dark:text-gray-200", R && A.nameDirectory, (F || $) && A.nameSelected), B = Ht({ isDirectory: R, isExpanded: z, showExpandIcons: N, useCanvasExpandIcons: O, expandIconSize: D }), le = (R ? b : p) ? Wt({ entry: e, isDirectory: R, isExpanded: z, isSelected: F, isItemSelected: $, extension: te, mimeType: e.mimeType }, M) : null, T = { indentLevel: t, isDirectory: R, isExpanded: z }, [V, ...ne] = l, ie = V?.render ? V.render(e, T) : e.label ?? e.name, ye = {
425
- ...Z ? j?.hoverStyle : {},
426
- ...R && F ? j?.directorySelectedStyle : {},
427
- ...!R && (F || $) ? j?.itemSelectedStyle : {}
426
+ })(), p = typeof v == "function" ? v(e) : v, y = _("dt-grid-row cursor-pointer select-none", A, s, p, e.className), j = _(O.expandIcon, (B || Y) && O.expandIconSelected), L = _(O.typeIcon, (B || Y) && O.typeIconSelected), G = _("dt-grid-name-label ml-1", "text-gray-700 dark:text-gray-200", R && O.nameDirectory, (B || Y) && O.nameSelected), P = Bt({ isDirectory: R, isExpanded: z, showExpandIcons: h, useCanvasExpandIcons: M, expandIconSize: J }), Q = (R ? D : C) ? zt({ entry: e, isDirectory: R, isExpanded: z, isSelected: B, isItemSelected: Y, extension: ae, mimeType: e.mimeType }, w) : null, re = { indentLevel: t, isDirectory: R, isExpanded: z }, [oe, ...we] = E, xe = oe?.render ? oe.render(e, re) : e.label ?? e.name, be = {
427
+ ...q ? H?.hoverStyle : {},
428
+ ...R && B ? H?.directorySelectedStyle : {},
429
+ ...!R && (B || Y) ? H?.itemSelectedStyle : {}
428
430
  };
429
431
  return /* @__PURE__ */ i.jsxs(
430
432
  "div",
431
433
  {
432
- className: s,
433
- style: { height: r, ...ye, ...e.style },
434
+ className: y,
435
+ style: { height: l, ...be, ...e.style },
434
436
  role: "row",
435
437
  "aria-expanded": R ? z : void 0,
436
438
  "aria-level": t + 1,
437
439
  "aria-posinset": a,
438
440
  "aria-setsize": n,
439
- ...Bt(e.data),
441
+ "aria-rowindex": r,
442
+ "aria-selected": m === "none" ? void 0 : o,
443
+ ...Yt(e.data),
440
444
  "data-entry-type": R ? "directory" : "file",
441
445
  "data-entry-expanded": R ? String(z) : void 0,
442
- "data-entry-selected": F ? "true" : void 0,
443
- "data-entry-item-selected": $ ? "true" : void 0,
444
- onClick: re,
446
+ "data-entry-selected": B ? "true" : void 0,
447
+ "data-entry-item-selected": Y ? "true" : void 0,
448
+ onClick: te,
445
449
  onMouseEnter: () => K(!0),
446
450
  onMouseLeave: () => K(!1),
447
- onKeyDown: (Q) => Q.key === "Enter" && re(Q),
451
+ onKeyDown: (ee) => ee.key === "Enter" && te(ee),
448
452
  tabIndex: 0,
449
453
  children: [
450
- /* @__PURE__ */ i.jsxs("div", { className: _("dt-grid-name-cell", V?.className), role: "gridcell", style: { width: x, paddingLeft: Math.max(0, t * L) }, children: [
451
- (N || O) && /* @__PURE__ */ i.jsx("span", { className: u, children: B }),
452
- (R ? b : p) && /* @__PURE__ */ i.jsx("span", { className: w, children: le }),
453
- /* @__PURE__ */ i.jsx("span", { className: E, children: ie })
454
+ /* @__PURE__ */ i.jsxs("div", { className: _("dt-grid-name-cell", oe?.className), role: "gridcell", style: { width: f, paddingLeft: Math.max(0, t * F) }, children: [
455
+ (h || M) && /* @__PURE__ */ i.jsx("span", { className: j, children: P }),
456
+ (R ? D : C) && /* @__PURE__ */ i.jsx("span", { className: L, children: Q }),
457
+ /* @__PURE__ */ i.jsx("span", { className: G, children: xe })
454
458
  ] }),
455
- ne.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-track", style: Gt(I, m), children: ne.map((Q) => /* @__PURE__ */ i.jsx("div", { className: _("dt-grid-cell", Yt(Q.align), Q.className), role: "gridcell", children: Q.render ? Q.render(e, T) : null }, Q.key)) }) })
459
+ we.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-track", style: Ut(d, b), children: we.map((ee) => /* @__PURE__ */ i.jsx("div", { className: _("dt-grid-cell", Vt(ee.align), ee.className), role: "gridcell", children: ee.render ? ee.render(e, re) : null }, ee.key)) }) })
456
460
  ]
457
461
  }
458
462
  );
459
463
  },
460
464
  (e, t) => {
461
465
  if (e.entry !== t.entry) return !1;
462
- const a = Lt(e.entry, e.isDirOpen), n = Lt(t.entry, t.isDirOpen);
463
- return e.indentLevel === t.indentLevel && e.positionInSet === t.positionInSet && e.setSize === t.setSize && e.rowHeight === t.rowHeight && a === n && e.columns === t.columns && e.numericTemplate === t.numericTemplate && e.numericTotal === t.numericTotal && e.nameWidth === t.nameWidth && e.rowClassName === t.rowClassName && e.selection.selectedPath === t.selection.selectedPath && e.selection.mode === t.selection.mode && e.selection.selectedItems === t.selection.selectedItems && e.visual === t.visual;
466
+ const a = $t(e.entry, e.isDirOpen), n = $t(t.entry, t.isDirOpen);
467
+ return e.indentLevel === t.indentLevel && e.positionInSet === t.positionInSet && e.setSize === t.setSize && e.rowIndex === t.rowIndex && e.isSelectedForAria === t.isSelectedForAria && e.rowHeight === t.rowHeight && a === n && e.columns === t.columns && e.numericTemplate === t.numericTemplate && e.numericTotal === t.numericTotal && e.nameWidth === t.nameWidth && e.rowClassName === t.rowClassName && e.selection.selectedPath === t.selection.selectedPath && e.selection.mode === t.selection.mode && e.selection.selectedItems === t.selection.selectedItems && e.visual === t.visual;
464
468
  }
465
469
  );
466
- Vt.displayName = "DirectoryTreeGridRow";
467
- const Ut = ({
470
+ Xt.displayName = "DirectoryTreeGridRow";
471
+ const Jt = ({
468
472
  kind: e,
469
473
  columns: t,
470
474
  numericTemplate: a,
@@ -472,28 +476,28 @@ const Ut = ({
472
476
  nameWidth: r,
473
477
  scrollBarWidth: o,
474
478
  className: l,
475
- nameContent: m,
476
- renderCell: I
479
+ nameContent: u,
480
+ renderCell: E
477
481
  }) => {
478
- const [, ...x] = t, c = e === "header" ? "dt-grid-name-header" : "dt-grid-name-footer", y = e === "header" ? "dt-grid-header" : "dt-grid-footer", k = e === "header" ? "columnheader" : "gridcell";
479
- return /* @__PURE__ */ i.jsxs("div", { className: _(y, "text-gray-600 dark:text-gray-300", l), role: "row", children: [
480
- /* @__PURE__ */ i.jsx("div", { className: _(c, "px-1", t[0]?.className), role: k, style: { width: r }, children: m }),
481
- x.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-track", style: Gt(n, a), children: x.map((g) => /* @__PURE__ */ i.jsx("div", { className: _("dt-grid-cell", Yt(g.align), g.className), role: k, children: I(g) }, g.key)) }) }),
482
+ const [, ...b] = t, d = e === "header" ? "dt-grid-name-header" : "dt-grid-name-footer", f = e === "header" ? "dt-grid-header" : "dt-grid-footer", v = e === "header" ? "columnheader" : "gridcell";
483
+ return /* @__PURE__ */ i.jsxs("div", { className: _(f, "text-gray-600 dark:text-gray-300", l), role: "row", children: [
484
+ /* @__PURE__ */ i.jsx("div", { className: _(d, "px-1", t[0]?.className), role: v, style: { width: r }, children: u }),
485
+ b.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-track", style: Ut(n, a), children: b.map((g) => /* @__PURE__ */ i.jsx("div", { className: _("dt-grid-cell", Vt(g.align), g.className), role: v, children: E(g) }, g.key)) }) }),
482
486
  /* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: o }, "aria-hidden": "true" })
483
487
  ] });
484
- }, gr = ({ columns: e, className: t, ...a }) => /* @__PURE__ */ i.jsx(Ut, { kind: "header", columns: e, className: t, nameContent: e[0]?.header ?? null, renderCell: (n) => n.header ?? null, ...a }), Ft = (e, t) => typeof e == "function" ? e(t) : e ?? null, wr = ({ columns: e, allEntries: t, className: a, ...n }) => /* @__PURE__ */ i.jsx(Ut, { kind: "footer", columns: e, className: a, nameContent: Ft(e[0]?.footer, t), renderCell: (r) => Ft(r.footer, t), ...n }), kr = 240, Xt = 96, Jt = 12, Je = (e, t) => {
488
+ }, Sr = ({ columns: e, className: t, ...a }) => /* @__PURE__ */ i.jsx(Jt, { kind: "header", columns: e, className: t, nameContent: e[0]?.header ?? null, renderCell: (n) => n.header ?? null, ...a }), Ht = (e, t) => typeof e == "function" ? e(t) : e ?? null, kr = ({ columns: e, allEntries: t, className: a, ...n }) => /* @__PURE__ */ i.jsx(Jt, { kind: "footer", columns: e, className: a, nameContent: Ht(e[0]?.footer, t), renderCell: (r) => Ht(r.footer, t), ...n }), Nr = 240, qt = 96, Zt = 12, qe = (e, t) => {
485
489
  const a = e?.width;
486
490
  return typeof a == "number" && Number.isFinite(a) && a > 0 ? a : t;
487
- }, Nr = (e) => e.slice(1).map((t) => `${Je(t, Xt)}px`).join(" "), Sr = ({ measuredWidth: e, columns: t, scrollBarWidth: a = Jt }) => {
488
- const n = Je(t[0], kr), r = t.slice(1).reduce((I, x) => I + Je(x, Xt), 0), o = Number.isFinite(e) && e > 0 ? e : 0, l = Math.max(0, o - n - Math.max(0, a)), m = Math.max(0, r - l);
489
- return { nameWidth: n, numericTotal: r, numericVisible: l, maxHScroll: m };
490
- }, Ue = (e, t) => !Number.isFinite(e) || e < 0 ? 0 : e > t ? t : e, Er = (e) => {
491
+ }, Er = (e) => e.slice(1).map((t) => `${qe(t, qt)}px`).join(" "), Ir = ({ measuredWidth: e, columns: t, scrollBarWidth: a = Zt }) => {
492
+ const n = qe(t[0], Nr), r = t.slice(1).reduce((E, b) => E + qe(b, qt), 0), o = Number.isFinite(e) && e > 0 ? e : 0, l = Math.max(0, o - n - Math.max(0, a)), u = Math.max(0, r - l);
493
+ return { nameWidth: n, numericTotal: r, numericVisible: l, maxHScroll: u };
494
+ }, Xe = (e, t) => !Number.isFinite(e) || e < 0 ? 0 : e > t ? t : e, jr = (e) => {
491
495
  const t = [], a = (n) => {
492
496
  for (const r of n)
493
497
  t.push(r), r.children && r.children.length > 0 && a(r.children);
494
498
  };
495
499
  return a(e), t;
496
- }, Ir = (e, t) => {
500
+ }, Tr = (e, t) => {
497
501
  const a = e.length - 1;
498
502
  if (a <= 0) return 0;
499
503
  let n = 0, r = a - 1, o = 0;
@@ -502,22 +506,22 @@ const Ut = ({
502
506
  e[l] <= t ? (o = l, n = l + 1) : r = l - 1;
503
507
  }
504
508
  return o;
505
- }, jr = (e, t, a) => {
509
+ }, Cr = (e, t, a) => {
506
510
  if (a <= 0 || e.length === 0 || t.length !== e.length + 1)
507
511
  return null;
508
- const n = Ir(t, a), r = e[n];
512
+ const n = Tr(t, a), r = e[n];
509
513
  return r ? {
510
514
  path: r.entry.absolutePath,
511
515
  offsetInViewport: a - t[n]
512
516
  } : null;
513
- }, Tr = (e, t, a) => {
517
+ }, Rr = (e, t, a) => {
514
518
  if (t.length === 0 || a.length !== t.length + 1)
515
519
  return null;
516
520
  for (let n = 0; n < t.length; n++)
517
521
  if (t[n].entry.absolutePath === e.path)
518
522
  return Math.max(0, a[n] + e.offsetInViewport);
519
523
  return null;
520
- }, Cr = (e, t, a) => {
524
+ }, Pr = (e, t, a) => {
521
525
  const n = [];
522
526
  for (let r = t; r < a; r++) {
523
527
  const o = e[r];
@@ -526,7 +530,7 @@ const Ut = ({
526
530
  n.push(l);
527
531
  }
528
532
  return n;
529
- }, Rr = (e, t, a) => {
533
+ }, _r = (e, t, a) => {
530
534
  const n = [];
531
535
  for (let r = t; r < a; r++) {
532
536
  const o = e[r];
@@ -535,36 +539,36 @@ const Ut = ({
535
539
  n.push(l);
536
540
  }
537
541
  return n;
538
- }, Pr = (e, t, a, n) => {
542
+ }, Ar = (e, t, a, n) => {
539
543
  const r = Math.max(1, Math.floor(t * n)), o = Math.max(1, Math.floor(a * n));
540
544
  (e.width !== r || e.height !== o) && (e.width = r, e.height = o);
541
545
  const l = e.style;
542
546
  l.width !== `${t}px` && (l.width = `${t}px`), l.height !== `${a}px` && (l.height = `${a}px`);
543
- }, _r = (e, t, a) => {
547
+ }, Mr = (e, t, a) => {
544
548
  e.lineWidth = a, e.beginPath();
545
549
  for (const n of t)
546
550
  e.moveTo(n.x1, n.y1), e.lineTo(n.x2, n.y2);
547
551
  e.stroke();
548
- }, Ar = (e, t) => {
552
+ }, Or = (e, t) => {
549
553
  const a = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());
550
554
  if (!a)
551
555
  return null;
552
556
  let n = a[1];
553
- n.length === 3 && (n = n.split("").map((m) => m + m).join(""));
557
+ n.length === 3 && (n = n.split("").map((u) => u + u).join(""));
554
558
  const r = Number.parseInt(n.slice(0, 2), 16), o = Number.parseInt(n.slice(2, 4), 16), l = Number.parseInt(n.slice(4, 6), 16);
555
559
  return `rgba(${r}, ${o}, ${l}, ${t})`;
556
- }, Mr = (e, t, a, n) => {
560
+ }, Fr = (e, t, a, n) => {
557
561
  if (t.length === 0)
558
562
  return;
559
- const r = Ar(a, 0.14), o = e.strokeStyle, l = e.fillStyle, m = e.lineWidth, I = e.lineCap, x = e.lineJoin;
563
+ const r = Or(a, 0.14), o = e.strokeStyle, l = e.fillStyle, u = e.lineWidth, E = e.lineCap, b = e.lineJoin;
560
564
  e.strokeStyle = a, e.lineCap = "round", e.lineJoin = "round";
561
- for (const c of t) {
562
- const y = n ?? c.size, k = Math.max(0, y / 2), g = Math.max(1, Math.round(y * 0.08)), S = Math.max(1, Math.round(y * 0.14)), f = Math.max(0, k - g * 0.8), h = Math.max(0, f * 0.55);
563
- r && (e.fillStyle = r, e.beginPath(), e.arc(c.centerX, c.centerY, f, 0, Math.PI * 2), e.fill()), e.lineWidth = g, e.beginPath(), e.arc(c.centerX, c.centerY, Math.max(0, k - g * 0.3), 0, Math.PI * 2), e.stroke(), e.lineWidth = S, e.beginPath(), e.moveTo(c.centerX - h, c.centerY), e.lineTo(c.centerX + h, c.centerY), e.stroke(), c.isExpanded || (e.beginPath(), e.moveTo(c.centerX, c.centerY - h), e.lineTo(c.centerX, c.centerY + h), e.stroke());
565
+ for (const d of t) {
566
+ const f = n ?? d.size, v = Math.max(0, f / 2), g = Math.max(1, Math.round(f * 0.08)), k = Math.max(1, Math.round(f * 0.14)), m = Math.max(0, v - g * 0.8), x = Math.max(0, m * 0.55);
567
+ r && (e.fillStyle = r, e.beginPath(), e.arc(d.centerX, d.centerY, m, 0, Math.PI * 2), e.fill()), e.lineWidth = g, e.beginPath(), e.arc(d.centerX, d.centerY, Math.max(0, v - g * 0.3), 0, Math.PI * 2), e.stroke(), e.lineWidth = k, e.beginPath(), e.moveTo(d.centerX - x, d.centerY), e.lineTo(d.centerX + x, d.centerY), e.stroke(), d.isExpanded || (e.beginPath(), e.moveTo(d.centerX, d.centerY - x), e.lineTo(d.centerX, d.centerY + x), e.stroke());
564
568
  }
565
- e.strokeStyle = o, e.fillStyle = l, e.lineWidth = m, e.lineCap = I, e.lineJoin = x;
566
- }, qt = qe(({ segmentsByItem: e, glyphsByItem: t, itemHeight: a, width: n, viewportHeight: r, scrollPosition: o, color: l = "#a0aec0", strokeWidth: m = 1, renderStartIndex: I, renderEndIndex: x, lookaheadEndIndex: c, devicePixelRatio: y, expandGlyphColor: k, expandGlyphSize: g }) => {
567
- const S = de(null), f = de(null), h = de({
569
+ e.strokeStyle = o, e.fillStyle = l, e.lineWidth = u, e.lineCap = E, e.lineJoin = b;
570
+ }, Kt = Ze(({ segmentsByItem: e, glyphsByItem: t, itemHeight: a, width: n, viewportHeight: r, scrollPosition: o, color: l = "#a0aec0", strokeWidth: u = 1, renderStartIndex: E, renderEndIndex: b, lookaheadEndIndex: d, devicePixelRatio: f, expandGlyphColor: v, expandGlyphSize: g }) => {
571
+ const k = ue(null), m = ue(null), x = ue({
568
572
  segmentsByItem: e,
569
573
  glyphsByItem: t,
570
574
  itemHeight: a,
@@ -572,47 +576,47 @@ const Ut = ({
572
576
  viewportHeight: r,
573
577
  scrollPosition: o,
574
578
  color: l,
575
- strokeWidth: m,
576
- renderStartIndex: I,
577
- renderEndIndex: x,
578
- lookaheadEndIndex: c,
579
- devicePixelRatio: y,
580
- expandGlyphColor: k,
579
+ strokeWidth: u,
580
+ renderStartIndex: E,
581
+ renderEndIndex: b,
582
+ lookaheadEndIndex: d,
583
+ devicePixelRatio: f,
584
+ expandGlyphColor: v,
581
585
  expandGlyphSize: g
582
- }), v = W(() => {
583
- f.current = null;
584
- const N = S.current;
586
+ }), S = W(() => {
587
+ m.current = null;
588
+ const N = k.current;
585
589
  if (!N)
586
590
  return;
587
- const b = N.getContext("2d");
588
- if (!b)
591
+ const w = N.getContext("2d");
592
+ if (!w)
589
593
  return;
590
- const p = h.current;
591
- if (p.width <= 0 || p.viewportHeight <= 0) {
592
- b.clearRect(0, 0, N.width, N.height);
594
+ const h = x.current;
595
+ if (h.width <= 0 || h.viewportHeight <= 0) {
596
+ w.clearRect(0, 0, N.width, N.height);
593
597
  return;
594
598
  }
595
- const O = Number.isFinite(p.devicePixelRatio ?? NaN) ? p.devicePixelRatio : typeof window < "u" && window.devicePixelRatio || 1;
596
- Pr(N, p.width, p.viewportHeight, O);
597
- const D = p.segmentsByItem.length, L = typeof p.renderStartIndex == "number" && Number.isFinite(p.renderStartIndex) ? Math.max(0, Math.floor(p.renderStartIndex)) : Math.max(0, Math.floor(p.scrollPosition / p.itemHeight)), j = Math.min(D, Math.ceil((p.scrollPosition + p.viewportHeight) / p.itemHeight)), Z = (() => {
598
- if (typeof p.renderEndIndex == "number" && Number.isFinite(p.renderEndIndex)) {
599
- const F = Math.floor(p.renderEndIndex);
600
- return Math.max(Math.min(D, F + 1), L);
599
+ const D = Number.isFinite(h.devicePixelRatio ?? NaN) ? h.devicePixelRatio : typeof window < "u" && window.devicePixelRatio || 1;
600
+ Ar(N, h.width, h.viewportHeight, D);
601
+ const C = h.segmentsByItem.length, M = typeof h.renderStartIndex == "number" && Number.isFinite(h.renderStartIndex) ? Math.max(0, Math.floor(h.renderStartIndex)) : Math.max(0, Math.floor(h.scrollPosition / h.itemHeight)), J = Math.min(C, Math.ceil((h.scrollPosition + h.viewportHeight) / h.itemHeight)), F = (() => {
602
+ if (typeof h.renderEndIndex == "number" && Number.isFinite(h.renderEndIndex)) {
603
+ const R = Math.floor(h.renderEndIndex);
604
+ return Math.max(Math.min(C, R + 1), M);
601
605
  }
602
- return Math.max(j, L);
603
- })(), K = (() => {
604
- if (typeof p.lookaheadEndIndex == "number" && Number.isFinite(p.lookaheadEndIndex)) {
605
- const F = Math.floor(p.lookaheadEndIndex), $ = Math.min(D, F + 1);
606
- return Math.max($, Z);
606
+ return Math.max(J, M);
607
+ })(), H = (() => {
608
+ if (typeof h.lookaheadEndIndex == "number" && Number.isFinite(h.lookaheadEndIndex)) {
609
+ const R = Math.floor(h.lookaheadEndIndex), z = Math.min(C, R + 1);
610
+ return Math.max(z, F);
607
611
  }
608
- return Math.max(j, Z);
609
- })(), R = Cr(p.segmentsByItem, L, K), z = Rr(p.glyphsByItem, L, K);
610
- b.save(), b.scale(O, O), b.clearRect(0, 0, p.width, p.viewportHeight), b.translate(0, -p.scrollPosition), b.strokeStyle = p.color, _r(b, R, p.strokeWidth), Mr(b, z, p.expandGlyphColor ?? p.color, p.expandGlyphSize), b.restore();
611
- }, []), M = W(() => {
612
- f.current === null && (f.current = window.requestAnimationFrame(v));
613
- }, [v]);
614
- return ue(() => {
615
- h.current = {
612
+ return Math.max(J, F);
613
+ })(), q = Pr(h.segmentsByItem, M, H), K = _r(h.glyphsByItem, M, H);
614
+ w.save(), w.scale(D, D), w.clearRect(0, 0, h.width, h.viewportHeight), w.translate(0, -h.scrollPosition), w.strokeStyle = h.color, Mr(w, q, h.strokeWidth), Fr(w, K, h.expandGlyphColor ?? h.color, h.expandGlyphSize), w.restore();
615
+ }, []), I = W(() => {
616
+ m.current === null && (m.current = window.requestAnimationFrame(S));
617
+ }, [S]);
618
+ return me(() => {
619
+ x.current = {
616
620
  segmentsByItem: e,
617
621
  glyphsByItem: t,
618
622
  itemHeight: a,
@@ -620,48 +624,48 @@ const Ut = ({
620
624
  viewportHeight: r,
621
625
  scrollPosition: o,
622
626
  color: l,
623
- strokeWidth: m,
624
- renderStartIndex: I,
625
- renderEndIndex: x,
626
- lookaheadEndIndex: c,
627
- devicePixelRatio: y,
628
- expandGlyphColor: k,
627
+ strokeWidth: u,
628
+ renderStartIndex: E,
629
+ renderEndIndex: b,
630
+ lookaheadEndIndex: d,
631
+ devicePixelRatio: f,
632
+ expandGlyphColor: v,
629
633
  expandGlyphSize: g
630
- }, M();
631
- }, [e, t, a, n, r, o, l, m, I, x, c, y, k, g, M]), ue(() => () => {
632
- f.current !== null && (window.cancelAnimationFrame(f.current), f.current = null);
633
- }, []), /* @__PURE__ */ i.jsx("canvas", { ref: S, className: "pointer-events-none absolute top-0 left-0 z-0" });
634
+ }, I();
635
+ }, [e, t, a, n, r, o, l, u, E, b, d, f, v, g, I]), me(() => () => {
636
+ m.current !== null && (window.cancelAnimationFrame(m.current), m.current = null);
637
+ }, []), /* @__PURE__ */ i.jsx("canvas", { ref: k, className: "pointer-events-none absolute top-0 left-0 z-0" });
634
638
  });
635
- qt.displayName = "TreeLineCanvas";
636
- const Or = {
639
+ Kt.displayName = "TreeLineCanvas";
640
+ const Dr = {
637
641
  msOverflowStyle: "none",
638
642
  scrollbarWidth: "none"
639
- }, Dr = () => {
643
+ }, Lr = () => {
640
644
  let e = document.getElementById("directory-tree-webkit-scrollbar-hide");
641
645
  e || (e = document.createElement("style"), e.id = "directory-tree-webkit-scrollbar-hide", e.textContent = ".directory-tree-container::-webkit-scrollbar { display: none; }", document.head.appendChild(e));
642
- }, Lr = (e, t, a, n, r) => {
646
+ }, $r = (e, t, a, n, r) => {
643
647
  const o = [], l = [];
644
- let m = 0;
645
- const I = (x, c, y) => {
646
- const k = r ? [...x].sort(r) : x;
647
- for (let g = 0; g < k.length; g++) {
648
- const S = k[g], f = g === k.length - 1, h = [...y, f], v = S.children !== void 0, M = v && t(S.absolutePath, S.relativePath);
649
- let N = c, b = h, p = y;
650
- n && (N = c - 1, b = h.slice(1), p = y.slice(1)), o.push({ entry: S, indentLevel: N, depth: c, positionInSet: g + 1, setSize: k.length, parentIsLast: b }), a && (N > m && (m = N), l.push({
651
- id: S.absolutePath,
652
- name: S.name,
653
- absolutePath: S.absolutePath,
648
+ let u = 0;
649
+ const E = (b, d, f) => {
650
+ const v = r ? [...b].sort(r) : b;
651
+ for (let g = 0; g < v.length; g++) {
652
+ const k = v[g], m = g === v.length - 1, x = [...f, m], S = k.children !== void 0, I = S && t(k.absolutePath, k.relativePath);
653
+ let N = d, w = x, h = f;
654
+ n && (N = d - 1, w = x.slice(1), h = f.slice(1)), o.push({ entry: k, indentLevel: N, depth: d, positionInSet: g + 1, setSize: v.length, parentIsLast: w }), a && (N > u && (u = N), l.push({
655
+ id: k.absolutePath,
656
+ name: k.name,
657
+ absolutePath: k.absolutePath,
654
658
  indentLevel: N,
655
- isLastChild: f,
656
- isDirectory: v,
657
- isExpanded: M,
658
- ancestorIsLast: [...p],
659
- hideLines: n && c === 0
660
- })), v && M && S.children && I(S.children, c + 1, h);
659
+ isLastChild: m,
660
+ isDirectory: S,
661
+ isExpanded: I,
662
+ ancestorIsLast: [...h],
663
+ hideLines: n && d === 0
664
+ })), S && I && k.children && E(k.children, d + 1, x);
661
665
  }
662
666
  };
663
- return I(e, 0, []), { flatItems: o, lineItems: l, maxIndent: m };
664
- }, $t = (e, t) => {
667
+ return E(e, 0, []), { flatItems: o, lineItems: l, maxIndent: u };
668
+ }, Wt = (e, t) => {
665
669
  const a = e.length - 1;
666
670
  if (a <= 0) return 0;
667
671
  let n = 0, r = a - 1, o = 0;
@@ -670,188 +674,190 @@ const Or = {
670
674
  e[l] <= t ? (o = l, n = l + 1) : r = l - 1;
671
675
  }
672
676
  return o;
673
- }, Fr = (e, t, a, n, r, o) => {
674
- const l = n?.renderStart ?? Math.max(0, $t(o, r)), m = t > 0 ? $t(o, r + t) + a : l + a, I = e > 0 ? Math.min(e - 1, Math.max(l, m)) : l, x = n?.renderEnd ?? I, c = e > 0 ? Math.min(e - 1, x + a) : x;
675
- return { renderStart: l, renderEnd: x, lookaheadEnd: c };
676
- }, $r = (e, t, a, n, r, o) => {
677
+ }, Hr = (e, t, a, n, r, o) => {
678
+ const l = n?.renderStart ?? Math.max(0, Wt(o, r)), u = t > 0 ? Wt(o, r + t) + a : l + a, E = e > 0 ? Math.min(e - 1, Math.max(l, u)) : l, b = n?.renderEnd ?? E, d = e > 0 ? Math.min(e - 1, b + a) : b;
679
+ return { renderStart: l, renderEnd: b, lookaheadEnd: d };
680
+ }, Wr = (e, t, a, n, r, o) => {
677
681
  if (e.length === 0)
678
682
  return { segmentsByItem: [], glyphsByItem: [] };
679
- const l = Array.from({ length: e.length }, () => []), m = Array.from({ length: e.length }, () => []), I = (c) => r ? typeof o == "number" && Number.isFinite(o) && o > 0 ? o : Math.max(8, Math.min(n * 0.9, c * 0.7)) : 0, x = 3;
680
- for (let c = 0; c < e.length; c++) {
681
- const y = e[c];
682
- if (y.hideLines)
683
+ const l = Array.from({ length: e.length }, () => []), u = Array.from({ length: e.length }, () => []), E = (d) => r ? typeof o == "number" && Number.isFinite(o) && o > 0 ? o : Math.max(8, Math.min(n * 0.9, d * 0.7)) : 0, b = 3;
684
+ for (let d = 0; d < e.length; d++) {
685
+ const f = e[d];
686
+ if (f.hideLines)
683
687
  continue;
684
- const k = [], g = t[c] ?? 0, S = a[c] ?? 0, f = S + g / 2, h = I(g), v = h > 0 ? h / 2 + 2 : n / 1.5;
685
- for (let b = 0; b < y.indentLevel; b++) {
686
- if (y.ancestorIsLast[b] ?? !1)
688
+ const v = [], g = t[d] ?? 0, k = a[d] ?? 0, m = k + g / 2, x = E(g), S = x > 0 ? x / 2 + 2 : n / 1.5;
689
+ for (let w = 0; w < f.indentLevel; w++) {
690
+ if (f.ancestorIsLast[w] ?? !1)
687
691
  continue;
688
- let O = !1;
689
- for (let D = c; D < e.length; D++) {
690
- const L = e[D];
691
- if (L.indentLevel > b && L.ancestorIsLast.length > b && !L.ancestorIsLast[b]) {
692
- O = !0;
692
+ let D = !1;
693
+ for (let C = d; C < e.length; C++) {
694
+ const M = e[C];
695
+ if (M.indentLevel > w && M.ancestorIsLast.length > w && !M.ancestorIsLast[w]) {
696
+ D = !0;
693
697
  break;
694
698
  }
695
- if (D > c && L.indentLevel === b)
699
+ if (C > d && M.indentLevel === w)
696
700
  break;
697
701
  }
698
- if (O) {
699
- const D = b * n + n / 2 + x;
700
- k.push({
701
- key: `${y.id}-ancestor-${b}`,
702
- x1: D,
703
- y1: S,
704
- x2: D,
705
- y2: S + g,
706
- itemIndex: c
702
+ if (D) {
703
+ const C = w * n + n / 2 + b;
704
+ v.push({
705
+ key: `${f.id}-ancestor-${w}`,
706
+ x1: C,
707
+ y1: k,
708
+ x2: C,
709
+ y2: k + g,
710
+ itemIndex: d
707
711
  });
708
712
  }
709
713
  }
710
- const M = y.indentLevel * n, N = M + n / 2 + x;
711
- if (y.isDirectory ? k.push({
712
- key: `${y.id}-connector-top`,
714
+ const I = f.indentLevel * n, N = I + n / 2 + b;
715
+ if (f.isDirectory ? v.push({
716
+ key: `${f.id}-connector-top`,
713
717
  x1: N,
714
- y1: S,
718
+ y1: k,
715
719
  x2: N,
716
- y2: f - v,
717
- itemIndex: c
718
- }) : k.push({
719
- key: `${y.id}-connector-top`,
720
+ y2: m - S,
721
+ itemIndex: d
722
+ }) : v.push({
723
+ key: `${f.id}-connector-top`,
720
724
  x1: N,
721
- y1: S,
725
+ y1: k,
722
726
  x2: N,
723
- y2: f,
724
- itemIndex: c
725
- }), !y.isDirectory && y.isLastChild && k.push({
726
- key: `${y.id}-connector-horizontal`,
727
+ y2: m,
728
+ itemIndex: d
729
+ }), !f.isDirectory && f.isLastChild && v.push({
730
+ key: `${f.id}-connector-horizontal`,
727
731
  x1: N,
728
- y1: f,
729
- x2: M + n + x,
730
- y2: f,
731
- itemIndex: c
732
- }), y.isLastChild || (y.isDirectory ? k.push({
733
- key: `${y.id}-connector-bottom`,
732
+ y1: m,
733
+ x2: I + n + b,
734
+ y2: m,
735
+ itemIndex: d
736
+ }), f.isLastChild || (f.isDirectory ? v.push({
737
+ key: `${f.id}-connector-bottom`,
734
738
  x1: N,
735
- y1: f + v,
739
+ y1: m + S,
736
740
  x2: N,
737
- y2: S + g,
738
- itemIndex: c
739
- }) : k.push({
740
- key: `${y.id}-connector-bottom`,
741
+ y2: k + g,
742
+ itemIndex: d
743
+ }) : v.push({
744
+ key: `${f.id}-connector-bottom`,
741
745
  x1: N,
742
- y1: f,
746
+ y1: m,
743
747
  x2: N,
744
- y2: S + g,
745
- itemIndex: c
746
- })), l[c] = k, r && y.isDirectory) {
747
- const b = h, p = N, O = f;
748
- m[c] = [
748
+ y2: k + g,
749
+ itemIndex: d
750
+ })), l[d] = v, r && f.isDirectory) {
751
+ const w = x, h = N, D = m;
752
+ u[d] = [
749
753
  {
750
- key: `${y.id}-glyph`,
751
- itemIndex: c,
752
- centerX: p,
753
- centerY: O,
754
- size: b,
755
- isExpanded: y.isExpanded
754
+ key: `${f.id}-glyph`,
755
+ itemIndex: d,
756
+ centerX: h,
757
+ centerY: D,
758
+ size: w,
759
+ isExpanded: f.isExpanded
756
760
  }
757
761
  ];
758
762
  }
759
763
  }
760
- return { segmentsByItem: l, glyphsByItem: m };
761
- }, Ze = qe(
764
+ return { segmentsByItem: l, glyphsByItem: u };
765
+ }, Ke = Ze(
762
766
  ({
763
767
  entry: e,
764
768
  indentLevel: t,
765
769
  depth: a,
766
770
  positionInSet: n,
767
771
  setSize: r,
768
- rowHeight: o,
769
- isDirOpen: l,
770
- parentIsLast: m,
771
- renderChildren: I = !0,
772
- expansion: { toggleDirectory: x, onToggleDirectoryRecursive: c },
773
- selection: { onEntryClick: y, selectedPath: k, mode: g = "none", selectedItems: S, onSelectionChange: f },
772
+ isSelectedForAria: o,
773
+ rowHeight: l,
774
+ isDirOpen: u,
775
+ parentIsLast: E,
776
+ renderChildren: b = !0,
777
+ expansion: { toggleDirectory: d, onToggleDirectoryRecursive: f },
778
+ selection: { onEntryClick: v, selectedPath: g, mode: k = "none", selectedItems: m, onSelectionChange: x },
774
779
  visual: {
775
- iconOverrides: h,
776
- showExpandIcons: v = !0,
777
- showDirectoryIcons: M = !0,
778
- showFileIcons: N = !0,
779
- useCanvasExpandIcons: b = !1,
780
- expandIconSize: p,
781
- typeIconSize: O,
782
- fontSize: D,
783
- indentSize: L = Fe,
784
- highlightStyles: j,
785
- entryClassName: Z,
786
- entryStyle: K,
787
- nameClassName: R,
788
- nameStyle: z,
789
- directoryNameClassName: F,
790
- directoryNameStyle: $,
791
- fileNameClassName: te,
792
- fileNameStyle: re
780
+ iconOverrides: S,
781
+ showExpandIcons: I = !0,
782
+ showDirectoryIcons: N = !0,
783
+ showFileIcons: w = !0,
784
+ useCanvasExpandIcons: h = !1,
785
+ expandIconSize: D,
786
+ typeIconSize: C,
787
+ fontSize: M,
788
+ indentSize: J = $e,
789
+ highlightStyles: F,
790
+ entryClassName: H,
791
+ entryStyle: q,
792
+ nameClassName: K,
793
+ nameStyle: R,
794
+ directoryNameClassName: z,
795
+ directoryNameStyle: B,
796
+ fileNameClassName: Y,
797
+ fileNameStyle: ae
793
798
  }
794
799
  }) => {
795
- const [P, oe] = ae(null), [G, s] = ae(!1), u = e.children !== void 0, w = u && l(e.absolutePath), E = e.absolutePath === k, B = !u && S?.has(e.absolutePath), le = u ? void 0 : ve(e.name) || ve(e.relativePath) || ve(e.absolutePath);
796
- ue(() => {
797
- oe(w && e.children ? e.children : null);
798
- }, [w, e.children]);
799
- const T = zt({ entry: e, isDirectory: u, isExpanded: w, isItemSelected: !!B, selectionMode: g, onSelectionChange: f, onEntryClick: y, toggleDirectory: x, onToggleDirectoryRecursive: c }), V = G ? j?.hoverClassName !== void 0 ? j.hoverClassName : A.entryHover : "", ne = (() => {
800
- if (u) {
801
- if (E)
802
- return j?.directorySelectedClassName !== void 0 ? j.directorySelectedClassName : A.entrySelected;
803
- } else if (E || B)
804
- return j?.itemSelectedClassName !== void 0 ? j.itemSelectedClassName : _(E && A.entrySelected, B && A.entryItemSelected);
800
+ const [te, A] = ie(null), [s, p] = ie(!1), y = e.children !== void 0, j = y && u(e.absolutePath), L = e.absolutePath === g, G = !y && m?.has(e.absolutePath), P = y ? void 0 : ge(e.name) || ge(e.relativePath) || ge(e.absolutePath);
801
+ me(() => {
802
+ A(j && e.children ? e.children : null);
803
+ }, [j, e.children]);
804
+ const Q = Gt({ entry: e, isDirectory: y, isExpanded: j, isItemSelected: !!G, selectionMode: k, onSelectionChange: x, onEntryClick: v, toggleDirectory: d, onToggleDirectoryRecursive: f }), re = s ? F?.hoverClassName !== void 0 ? F.hoverClassName : O.entryHover : "", oe = (() => {
805
+ if (y) {
806
+ if (L)
807
+ return F?.directorySelectedClassName !== void 0 ? F.directorySelectedClassName : O.entrySelected;
808
+ } else if (L || G)
809
+ return F?.itemSelectedClassName !== void 0 ? F.itemSelectedClassName : _(L && O.entrySelected, G && O.entryItemSelected);
805
810
  return "";
806
- })(), ie = _(A.entry, V, ne, Z, e.className), ye = _(A.expandIcon, (E || B) && A.expandIconSelected), Q = _(A.typeIcon, (E || B) && A.typeIconSelected), $e = _(A.name, R, u && A.nameDirectory, u && F, !u && te, (E || B) && A.nameSelected), be = Ht({ isDirectory: u, isExpanded: w, showExpandIcons: v, useCanvasExpandIcons: b, expandIconSize: p }), Te = (u ? M : N) ? Wt({ entry: e, isDirectory: u, isExpanded: w, isSelected: E, isItemSelected: !!B, extension: le, mimeType: e.mimeType }, h) : null, Ce = {
807
- ...G ? j?.hoverStyle : {},
808
- ...u && E ? j?.directorySelectedStyle : {},
809
- ...!u && (E || B) ? j?.itemSelectedStyle : {}
810
- }, Re = Bt(e.data), Pe = O ? { width: O, height: O } : void 0, Se = D ? { fontSize: typeof D == "number" ? `${D}px` : D } : void 0;
811
- return /* @__PURE__ */ i.jsxs(or, { children: [
811
+ })(), we = _(O.entry, re, oe, H, e.className), xe = _(O.expandIcon, (L || G) && O.expandIconSelected), be = _(O.typeIcon, (L || G) && O.typeIconSelected), ee = _(O.name, K, y && O.nameDirectory, y && z, !y && Y, (L || G) && O.nameSelected), He = Bt({ isDirectory: y, isExpanded: j, showExpandIcons: I, useCanvasExpandIcons: h, expandIconSize: D }), Se = (y ? N : w) ? zt({ entry: e, isDirectory: y, isExpanded: j, isSelected: L, isItemSelected: !!G, extension: P, mimeType: e.mimeType }, S) : null, Re = {
812
+ ...s ? F?.hoverStyle : {},
813
+ ...y && L ? F?.directorySelectedStyle : {},
814
+ ...!y && (L || G) ? F?.itemSelectedStyle : {}
815
+ }, Pe = Yt(e.data), _e = C ? { width: C, height: C } : void 0, je = M ? { fontSize: typeof M == "number" ? `${M}px` : M } : void 0;
816
+ return /* @__PURE__ */ i.jsxs(ir, { children: [
812
817
  /* @__PURE__ */ i.jsxs(
813
818
  "div",
814
819
  {
815
- className: ie,
820
+ className: we,
816
821
  style: {
817
- paddingLeft: `${Math.max(0, t * L)}px`,
818
- transform: t < 0 ? `translateX(${t * L}px)` : void 0,
819
- width: t < 0 ? `calc(100% + ${Math.abs(t * L)}px)` : void 0,
820
- height: `${o}px`,
821
- ...Se,
822
- ...Ce,
823
- ...K,
822
+ paddingLeft: `${Math.max(0, t * J)}px`,
823
+ transform: t < 0 ? `translateX(${t * J}px)` : void 0,
824
+ width: t < 0 ? `calc(100% + ${Math.abs(t * J)}px)` : void 0,
825
+ height: `${l}px`,
826
+ ...je,
827
+ ...Re,
828
+ ...q,
824
829
  ...e.style
825
830
  },
826
- ...Re,
827
- "data-entry-type": u ? "directory" : "file",
828
- "data-entry-expanded": u ? String(w) : void 0,
829
- "data-entry-selected": E ? "true" : void 0,
830
- "data-entry-item-selected": B ? "true" : void 0,
831
- onClick: T,
832
- onMouseEnter: () => s(!0),
833
- onMouseLeave: () => s(!1),
834
- onKeyDown: (U) => U.key === "Enter" && T(U),
831
+ ...Pe,
832
+ "data-entry-type": y ? "directory" : "file",
833
+ "data-entry-expanded": y ? String(j) : void 0,
834
+ "data-entry-selected": L ? "true" : void 0,
835
+ "data-entry-item-selected": G ? "true" : void 0,
836
+ onClick: Q,
837
+ onMouseEnter: () => p(!0),
838
+ onMouseLeave: () => p(!1),
839
+ onKeyDown: (ce) => ce.key === "Enter" && Q(ce),
835
840
  tabIndex: 0,
836
841
  role: "treeitem",
837
- "aria-expanded": u ? w : void 0,
842
+ "aria-expanded": y ? j : void 0,
838
843
  "aria-level": a + 1,
839
844
  "aria-posinset": n,
840
845
  "aria-setsize": r,
841
- "aria-label": `${e.name} (${u ? "directory" : "file"})`,
846
+ "aria-selected": k === "none" ? void 0 : o,
847
+ "aria-label": `${e.name} (${y ? "directory" : "file"})`,
842
848
  children: [
843
- (v || b) && /* @__PURE__ */ i.jsx("span", { className: ye, children: be }),
844
- (u ? M : N) && /* @__PURE__ */ i.jsx("span", { className: Q, style: Pe, children: Te }),
849
+ (I || h) && /* @__PURE__ */ i.jsx("span", { className: xe, children: He }),
850
+ (y ? N : w) && /* @__PURE__ */ i.jsx("span", { className: be, style: _e, children: Se }),
845
851
  /* @__PURE__ */ i.jsx(
846
852
  "span",
847
853
  {
848
- className: $e,
854
+ className: ee,
849
855
  style: {
850
- ...Se,
851
- ...z,
852
- ...u ? $ : re
856
+ ...je,
857
+ ...R,
858
+ ...y ? B : ae
853
859
  },
854
- "data-entry-type": u ? "directory" : "file",
860
+ "data-entry-type": y ? "directory" : "file",
855
861
  "data-entry-role": "name",
856
862
  children: e.label ?? e.name
857
863
  }
@@ -859,38 +865,39 @@ const Or = {
859
865
  ]
860
866
  }
861
867
  ),
862
- w && P && I && /* @__PURE__ */ i.jsx("fieldset", { children: P.map((U, Ee) => /* @__PURE__ */ i.jsx(
863
- Ze,
868
+ j && te && b && /* @__PURE__ */ i.jsx("fieldset", { children: te.map((ce, ne) => /* @__PURE__ */ i.jsx(
869
+ Ke,
864
870
  {
865
- entry: U,
871
+ entry: ce,
866
872
  indentLevel: t + 1,
867
873
  depth: a + 1,
868
- positionInSet: Ee + 1,
869
- setSize: P.length,
870
- rowHeight: o,
871
- isDirOpen: l,
872
- parentIsLast: [...m, Ee === P.length - 1],
873
- expansion: { toggleDirectory: x, onToggleDirectoryRecursive: c },
874
- selection: { onEntryClick: y, selectedPath: k, mode: g, selectedItems: S, onSelectionChange: f },
874
+ positionInSet: ne + 1,
875
+ setSize: te.length,
876
+ isSelectedForAria: !!m?.has(ce.absolutePath),
877
+ rowHeight: l,
878
+ isDirOpen: u,
879
+ parentIsLast: [...E, ne === te.length - 1],
880
+ expansion: { toggleDirectory: d, onToggleDirectoryRecursive: f },
881
+ selection: { onEntryClick: v, selectedPath: g, mode: k, selectedItems: m, onSelectionChange: x },
875
882
  visual: {
876
- iconOverrides: h,
877
- showExpandIcons: v,
878
- showDirectoryIcons: M,
879
- showFileIcons: N,
880
- useCanvasExpandIcons: b,
881
- expandIconSize: p,
882
- highlightStyles: j,
883
- entryClassName: Z,
884
- entryStyle: K,
885
- nameClassName: R,
886
- nameStyle: z,
887
- directoryNameClassName: F,
888
- directoryNameStyle: $,
889
- fileNameClassName: te,
890
- fileNameStyle: re
883
+ iconOverrides: S,
884
+ showExpandIcons: I,
885
+ showDirectoryIcons: N,
886
+ showFileIcons: w,
887
+ useCanvasExpandIcons: h,
888
+ expandIconSize: D,
889
+ highlightStyles: F,
890
+ entryClassName: H,
891
+ entryStyle: q,
892
+ nameClassName: K,
893
+ nameStyle: R,
894
+ directoryNameClassName: z,
895
+ directoryNameStyle: B,
896
+ fileNameClassName: Y,
897
+ fileNameStyle: ae
891
898
  }
892
899
  },
893
- U.absolutePath
900
+ ce.absolutePath
894
901
  )) })
895
902
  ] }, e.absolutePath);
896
903
  },
@@ -898,429 +905,447 @@ const Or = {
898
905
  if (e.entry !== t.entry) return !1;
899
906
  const a = e.entry.children !== void 0, n = t.entry.children !== void 0, r = a && e.isDirOpen(e.entry.absolutePath), o = n && t.isDirOpen(t.entry.absolutePath);
900
907
  return e.indentLevel === t.indentLevel && // 位置情報は aria として描画されるため、変化したら再描画が必要
901
- e.depth === t.depth && e.positionInSet === t.positionInSet && e.setSize === t.setSize && e.rowHeight === t.rowHeight && r === o && e.selection.selectedPath === t.selection.selectedPath && e.selection.mode === t.selection.mode && e.selection.selectedItems === t.selection.selectedItems && e.visual.iconOverrides === t.visual.iconOverrides && e.visual.showExpandIcons === t.visual.showExpandIcons && e.visual.showDirectoryIcons === t.visual.showDirectoryIcons && e.visual.showFileIcons === t.visual.showFileIcons && e.visual.useCanvasExpandIcons === t.visual.useCanvasExpandIcons && e.visual.expandIconSize === t.visual.expandIconSize && e.visual.highlightStyles === t.visual.highlightStyles && e.visual.entryClassName === t.visual.entryClassName && e.visual.entryStyle === t.visual.entryStyle && e.visual.nameClassName === t.visual.nameClassName && e.visual.nameStyle === t.visual.nameStyle && e.visual.directoryNameClassName === t.visual.directoryNameClassName && e.visual.directoryNameStyle === t.visual.directoryNameStyle && e.visual.fileNameClassName === t.visual.fileNameClassName && e.visual.fileNameStyle === t.visual.fileNameStyle && e.parentIsLast.length === t.parentIsLast.length && e.parentIsLast.every((l, m) => l === t.parentIsLast[m]);
908
+ e.depth === t.depth && e.positionInSet === t.positionInSet && e.setSize === t.setSize && e.isSelectedForAria === t.isSelectedForAria && e.rowHeight === t.rowHeight && r === o && e.selection.selectedPath === t.selection.selectedPath && e.selection.mode === t.selection.mode && e.selection.selectedItems === t.selection.selectedItems && e.visual.iconOverrides === t.visual.iconOverrides && e.visual.showExpandIcons === t.visual.showExpandIcons && e.visual.showDirectoryIcons === t.visual.showDirectoryIcons && e.visual.showFileIcons === t.visual.showFileIcons && e.visual.useCanvasExpandIcons === t.visual.useCanvasExpandIcons && e.visual.expandIconSize === t.visual.expandIconSize && e.visual.highlightStyles === t.visual.highlightStyles && e.visual.entryClassName === t.visual.entryClassName && e.visual.entryStyle === t.visual.entryStyle && e.visual.nameClassName === t.visual.nameClassName && e.visual.nameStyle === t.visual.nameStyle && e.visual.directoryNameClassName === t.visual.directoryNameClassName && e.visual.directoryNameStyle === t.visual.directoryNameStyle && e.visual.fileNameClassName === t.visual.fileNameClassName && e.visual.fileNameStyle === t.visual.fileNameStyle && e.parentIsLast.length === t.parentIsLast.length && e.parentIsLast.every((l, u) => l === t.parentIsLast[u]);
902
909
  }
903
910
  );
904
- Ze.displayName = "DirectoryEntryItem";
905
- const Zt = (e) => {
911
+ Ke.displayName = "DirectoryEntryItem";
912
+ const Qt = (e) => {
906
913
  const t = [];
907
914
  if (e.children)
908
915
  for (const a of e.children)
909
- a.type === "directory" && (t.push(a.absolutePath), t.push(...Zt(a)));
916
+ a.type === "directory" && (t.push(a.absolutePath), t.push(...Qt(a)));
910
917
  return t;
911
- }, Gr = ({
918
+ }, Ur = ({
912
919
  entries: e,
913
- expansion: { toggle: t, isExpanded: a, expandMultiple: n, collapseMultiple: r, isPending: o, alwaysExpanded: l = !1, doubleClickAction: m = "recursive" },
914
- selection: { onEntryClick: I, selectedPath: x, mode: c = "none", selectedItems: y, onSelectionChange: k },
920
+ expansion: { toggle: t, isExpanded: a, expandMultiple: n, collapseMultiple: r, isPending: o, alwaysExpanded: l = !1, doubleClickAction: u = "recursive" },
921
+ selection: { onEntryClick: E, selectedPath: b, mode: d = "none", selectedItems: f, onSelectionChange: v },
915
922
  visual: {
916
923
  className: g,
917
- style: S,
918
- lineColor: f = "#A0AEC0",
919
- showTreeLines: h = !0,
920
- showExpandIcons: v = !0,
921
- showDirectoryIcons: M = !0,
922
- showFileIcons: N = !0,
923
- iconOverrides: b,
924
- expandIconSize: p,
925
- itemHeight: O = Le,
926
- removeRootIndent: D = !1,
927
- highlightStyles: L,
928
- entryClassName: j,
929
- entryStyle: Z,
924
+ style: k,
925
+ ariaLabel: m,
926
+ ariaLabelledBy: x,
927
+ lineColor: S = "#A0AEC0",
928
+ showTreeLines: I = !0,
929
+ showExpandIcons: N = !0,
930
+ showDirectoryIcons: w = !0,
931
+ showFileIcons: h = !0,
932
+ iconOverrides: D,
933
+ expandIconSize: C,
934
+ itemHeight: M = Le,
935
+ removeRootIndent: J = !1,
936
+ highlightStyles: F,
937
+ entryClassName: H,
938
+ entryStyle: q,
930
939
  nameClassName: K,
931
940
  nameStyle: R,
932
941
  directoryNameClassName: z,
933
- directoryNameStyle: F,
934
- fileNameClassName: $,
935
- fileNameStyle: te
942
+ directoryNameStyle: B,
943
+ fileNameClassName: Y,
944
+ fileNameStyle: ae
936
945
  } = {},
937
- virtualScroll: re,
938
- grid: P,
939
- sort: oe
946
+ virtualScroll: te,
947
+ grid: A,
948
+ sort: s
940
949
  }) => {
941
- const G = P !== void 0, [s, u] = ae(!1), w = de(null), E = de(null), B = de(null), [le, T] = ae(0), [V, ne] = ae(0), [ie, ye] = ae(0), [Q, $e] = ae(null), {
942
- overscanCount: be = 15,
943
- className: Te,
944
- background: Ce,
945
- onScroll: Re,
946
- onRangeChange: Pe,
947
- initialScrollIndex: Se,
948
- initialScrollOffset: U,
949
- callbackThrottleMs: Ee = 5,
950
- contentInsets: ge,
951
- onItemFocus: Ke,
952
- viewportHeightOverride: se,
953
- scrollBarOptions: He,
954
- behaviorOptions: Qe,
955
- preserveScrollAnchor: et = !1,
956
- getItemKey: Kt,
950
+ const p = A !== void 0, [y, j] = ie(!1), L = ue(null), G = ue(null), P = ue(null), [Q, re] = ie(0), [oe, we] = ie(0), [xe, be] = ie(0), [ee, He] = ie(null), {
951
+ overscanCount: Se = 15,
952
+ className: Re,
953
+ background: Pe,
954
+ onScroll: _e,
955
+ onRangeChange: je,
956
+ initialScrollIndex: ce,
957
+ initialScrollOffset: ne,
958
+ callbackThrottleMs: Qe = 5,
959
+ contentInsets: ke,
960
+ onItemFocus: et,
961
+ viewportHeightOverride: le,
962
+ scrollBarOptions: We,
963
+ behaviorOptions: tt,
964
+ preserveScrollAnchor: rt = !1,
965
+ getItemKey: er,
957
966
  // 素通しの pass-through。型で受け付けているものは実際に転送する
958
967
  // (`role="tree"` は本コンポーネント自身のコンテナに付くため contentProps とは別要素で衝突しない)
959
- testId: tt,
960
- contentProps: rt
961
- } = re ?? {}, [_e, We] = ae(typeof U == "number" ? U : 0), Be = de(typeof U == "number" ? U : 0), nt = W(
962
- (d, C) => {
963
- Be.current = d, We(d), Re?.(d, C);
968
+ testId: nt,
969
+ contentProps: st
970
+ } = te ?? {}, [Ae, Be] = ie(typeof ne == "number" ? ne : 0), ze = ue(typeof ne == "number" ? ne : 0), at = W(
971
+ (c, T) => {
972
+ ze.current = c, Be(c), _e?.(c, T);
964
973
  },
965
- [Re]
966
- ), st = W(
967
- (d) => {
968
- const { renderingStartIndex: C, renderingEndIndex: H } = d;
969
- $e((J) => J && J.renderStart === C && J.renderEnd === H ? J : { renderStart: C, renderEnd: H }), Pe?.(d);
974
+ [_e]
975
+ ), ot = W(
976
+ (c) => {
977
+ const { renderingStartIndex: T, renderingEndIndex: $ } = c;
978
+ He((X) => X && X.renderStart === T && X.renderEnd === $ ? X : { renderStart: T, renderEnd: $ }), je?.(c);
970
979
  },
971
- [Pe]
980
+ [je]
972
981
  );
973
- ue(() => {
974
- typeof U == "number" && We(U);
975
- }, [U]), ue(() => {
976
- u(!0), Dr();
977
- }, []), ue(() => {
978
- const d = w.current, C = G ? E.current : d, H = () => {
979
- if (d) {
980
- const ee = d.clientWidth;
981
- ne((ce) => Math.abs(ce - ee) > 1 ? ee : ce);
982
+ me(() => {
983
+ typeof ne == "number" && Be(ne);
984
+ }, [ne]), me(() => {
985
+ j(!0), Lr();
986
+ }, []), me(() => {
987
+ const c = L.current, T = p ? G.current : c, $ = () => {
988
+ if (c) {
989
+ const se = c.clientWidth;
990
+ we((de) => Math.abs(de - se) > 1 ? se : de);
982
991
  }
983
- if (typeof se == "number")
984
- T((ee) => Math.abs(ee - se) > 1 ? se : ee);
985
- else if (C) {
986
- const ee = C.clientHeight;
987
- T((ce) => Math.abs(ce - ee) > 1 ? ee : ce);
992
+ if (typeof le == "number")
993
+ re((se) => Math.abs(se - le) > 1 ? le : se);
994
+ else if (T) {
995
+ const se = T.clientHeight;
996
+ re((de) => Math.abs(de - se) > 1 ? se : de);
988
997
  }
989
998
  };
990
- if (!(d || C)) return T(0);
991
- H();
992
- const J = new ResizeObserver(H);
993
- return d && J.observe(d), C && C !== d && J.observe(C), () => J.disconnect();
994
- }, [se, G]);
995
- const me = typeof se == "number" ? se : le, fe = W((d) => l || (s ? a(d) : !1), [s, a, l]), at = _(A.container, o && A.containerPending, g), ot = q(
999
+ if (!(c || T)) return re(0);
1000
+ $();
1001
+ const X = new ResizeObserver($);
1002
+ return c && X.observe(c), T && T !== c && X.observe(T), () => X.disconnect();
1003
+ }, [le, p]);
1004
+ const fe = typeof le == "number" ? le : Q, he = W((c) => l || (y ? a(c) : !1), [y, a, l]), lt = _(O.container, o && O.containerPending, g), it = Z(
996
1005
  () => ({
997
- ...Or,
998
- ...S ?? {},
999
- ...typeof se == "number" ? { height: se, minHeight: se } : {}
1006
+ ...Dr,
1007
+ ...k ?? {},
1008
+ ...typeof le == "number" ? { height: le, minHeight: le } : {}
1000
1009
  }),
1001
- [S, se]
1002
- ), ze = W(
1003
- (d, C) => {
1004
- const H = [d.absolutePath, ...Zt(d)], J = C || m;
1005
- if (H.every((Ne) => fe(Ne))) return r(H);
1006
- if (H.every((Ne) => !fe(Ne)) || J === "recursive") return n(H);
1007
- if (J === "toggle") return r(H);
1008
- console.warn(`[DirectoryTree] Unknown double click action: ${J}. No action taken.`);
1010
+ [k, le]
1011
+ ), Ye = W(
1012
+ (c, T) => {
1013
+ const $ = [c.absolutePath, ...Qt(c)], X = T || u;
1014
+ if ($.every((Ie) => he(Ie))) return r($);
1015
+ if ($.every((Ie) => !he(Ie)) || X === "recursive") return n($);
1016
+ if (X === "toggle") return r($);
1017
+ console.warn(`[DirectoryTree] Unknown double click action: ${X}. No action taken.`);
1009
1018
  },
1010
- [fe, n, r, m]
1011
- ), lt = G ? !1 : D, { flatItems: it, lineItems: Ye, maxIndent: ct } = q(() => Lr(e, fe, h, lt, oe), [e, fe, h, lt, oe]), Y = q(
1012
- () => it.map((d, C) => {
1013
- const H = typeof O == "function" ? O(d.entry, C) : O;
1014
- return { ...d, rowHeight: Number.isFinite(H) && H > 0 ? H : Le };
1019
+ [he, n, r, u]
1020
+ ), ct = p ? !1 : J, { flatItems: dt, lineItems: Ge, maxIndent: ut } = Z(() => $r(e, he, I, ct, s), [e, he, I, ct, s]), V = Z(
1021
+ () => dt.map((c, T) => {
1022
+ const $ = typeof M == "function" ? M(c.entry, T) : M;
1023
+ return { ...c, rowHeight: Number.isFinite($) && $ > 0 ? $ : Le };
1015
1024
  }),
1016
- [it, O]
1017
- ), he = q(() => Y.map((d) => d.rowHeight), [Y]), xe = q(() => {
1018
- const d = new Array(he.length + 1);
1019
- d[0] = 0;
1020
- for (let C = 0; C < he.length; C++)
1021
- d[C + 1] = d[C] + he[C];
1022
- return d;
1023
- }, [he]), dt = W((d) => Y[d]?.rowHeight ?? Le, [Y]), Qt = W((d) => Y[d]?.entry.absolutePath ?? d, [Y]), ut = Kt ?? Qt, Ae = q(
1024
- () => !h || Ye.length === 0 ? { segmentsByItem: [], glyphsByItem: [] } : $r(Ye, he, xe, Fe, h, p ?? Dt),
1025
- [Ye, he, xe, h, p]
1026
- ), Me = q(() => !h || e.length === 0 ? 0 : (ct + 2) * Fe, [e.length, ct, h]), { renderStart: mt, renderEnd: ft, lookaheadEnd: ht } = q(
1027
- () => Fr(Y.length, me, be, Q, _e, xe),
1028
- [Y.length, me, be, Q, _e, xe]
1029
- ), Ge = q(() => !h || Me <= 0 || me <= 0 || Ae.segmentsByItem.length === 0 ? null : /* @__PURE__ */ i.jsx("div", { className: "pointer-events-none absolute inset-0 z-0", "aria-hidden": "true", children: /* @__PURE__ */ i.jsx("div", { className: "absolute top-0 left-0", style: { width: Me, height: me }, children: /* @__PURE__ */ i.jsx(
1030
- qt,
1025
+ [dt, M]
1026
+ ), pe = Z(() => V.map((c) => c.rowHeight), [V]), ve = Z(() => {
1027
+ const c = new Array(pe.length + 1);
1028
+ c[0] = 0;
1029
+ for (let T = 0; T < pe.length; T++)
1030
+ c[T + 1] = c[T] + pe[T];
1031
+ return c;
1032
+ }, [pe]), mt = W((c) => V[c]?.rowHeight ?? Le, [V]), tr = W((c) => V[c]?.entry.absolutePath ?? c, [V]), ft = er ?? tr, Me = Z(
1033
+ () => !I || Ge.length === 0 ? { segmentsByItem: [], glyphsByItem: [] } : Wr(Ge, pe, ve, $e, I, C ?? Lt),
1034
+ [Ge, pe, ve, I, C]
1035
+ ), Oe = Z(() => !I || e.length === 0 ? 0 : (ut + 2) * $e, [e.length, ut, I]), { renderStart: ht, renderEnd: pt, lookaheadEnd: yt } = Z(
1036
+ () => Hr(V.length, fe, Se, ee, Ae, ve),
1037
+ [V.length, fe, Se, ee, Ae, ve]
1038
+ ), Ve = Z(() => !I || Oe <= 0 || fe <= 0 || Me.segmentsByItem.length === 0 ? null : /* @__PURE__ */ i.jsx("div", { className: "pointer-events-none absolute inset-0 z-0", "aria-hidden": "true", children: /* @__PURE__ */ i.jsx("div", { className: "absolute top-0 left-0", style: { width: Oe, height: fe }, children: /* @__PURE__ */ i.jsx(
1039
+ Kt,
1031
1040
  {
1032
- segmentsByItem: Ae.segmentsByItem,
1033
- glyphsByItem: Ae.glyphsByItem,
1034
- itemHeight: he[0] ?? Le,
1035
- width: Me,
1036
- viewportHeight: me,
1037
- scrollPosition: _e,
1038
- color: f,
1039
- expandGlyphColor: f,
1040
- expandGlyphSize: p ?? Dt,
1041
- renderStartIndex: mt,
1042
- renderEndIndex: ft,
1043
- lookaheadEndIndex: ht
1041
+ segmentsByItem: Me.segmentsByItem,
1042
+ glyphsByItem: Me.glyphsByItem,
1043
+ itemHeight: pe[0] ?? Le,
1044
+ width: Oe,
1045
+ viewportHeight: fe,
1046
+ scrollPosition: Ae,
1047
+ color: S,
1048
+ expandGlyphColor: S,
1049
+ expandGlyphSize: C ?? Lt,
1050
+ renderStartIndex: ht,
1051
+ renderEndIndex: pt,
1052
+ lookaheadEndIndex: yt
1044
1053
  }
1045
- ) }) }), [Me, me, mt, ft, ht, _e, Ae, f, h, p, he]), pt = W((d) => Y[d], [Y]), yt = de(null);
1046
- ar(() => {
1047
- const d = yt.current;
1048
- if (yt.current = { items: Y, offsets: xe }, !et || !d || d.items === Y)
1054
+ ) }) }), [Oe, fe, ht, pt, yt, Ae, Me, S, I, C, pe]), xt = W((c) => V[c], [V]), bt = ue(null);
1055
+ lr(() => {
1056
+ const c = bt.current;
1057
+ if (bt.current = { items: V, offsets: ve }, !rt || !c || c.items === V)
1049
1058
  return;
1050
- const C = B.current, H = typeof ge == "number" ? ge : ge?.top ?? 0, J = C ? C.getScrollPosition() : Be.current, ee = J - H, ce = jr(d.items, d.offsets, ee);
1051
- if (!ce)
1059
+ const T = P.current, $ = typeof ke == "number" ? ke : ke?.top ?? 0, X = T ? T.getScrollPosition() : ze.current, se = X - $, de = Cr(c.items, c.offsets, se);
1060
+ if (!de)
1052
1061
  return;
1053
- const Ne = Tr(ce, Y, xe);
1054
- if (Ne === null)
1062
+ const Ie = Rr(de, V, ve);
1063
+ if (Ie === null)
1055
1064
  return;
1056
- const Ve = Ne + H;
1057
- if (Math.abs(Ve - J) < 1)
1065
+ const Ue = Ie + $;
1066
+ if (Math.abs(Ue - X) < 1)
1058
1067
  return;
1059
- const gt = C?.scrollTo(Ve) ?? Ve;
1060
- Be.current = gt, We(gt);
1061
- }, [Y, xe, et, ge]);
1062
- const pe = P?.columns, we = P?.scrollBarWidth ?? He?.width ?? Jt, X = q(() => pe ? Sr({ measuredWidth: V, columns: pe, scrollBarWidth: we }) : null, [pe, V, we]), Oe = q(() => pe ? Nr(pe) : "", [pe]), er = q(() => P?.showFooter && pe ? Er(e) : [], [P?.showFooter, pe, e]), ke = X?.maxHScroll ?? 0;
1063
- ue(() => {
1064
- ye((d) => Ue(d, ke));
1065
- }, [ke]);
1066
- const xt = W((d) => ye((C) => Ue(C + d, ke)), [ke]), vt = q(
1067
- () => ({ iconOverrides: b, showExpandIcons: v, showDirectoryIcons: M, showFileIcons: N, useCanvasExpandIcons: h, expandIconSize: p, highlightStyles: L }),
1068
- [b, v, M, N, h, p, L]
1069
- ), bt = q(
1068
+ const St = T?.scrollTo(Ue) ?? Ue;
1069
+ ze.current = St, Be(St);
1070
+ }, [V, ve, rt, ke]);
1071
+ const ye = A?.columns, Ne = A?.scrollBarWidth ?? We?.width ?? Zt, U = Z(() => ye ? Ir({ measuredWidth: oe, columns: ye, scrollBarWidth: Ne }) : null, [ye, oe, Ne]), Fe = Z(() => ye ? Er(ye) : "", [ye]), rr = Z(() => A?.showFooter && ye ? jr(e) : [], [A?.showFooter, ye, e]), Ee = U?.maxHScroll ?? 0;
1072
+ me(() => {
1073
+ be((c) => Xe(c, Ee));
1074
+ }, [Ee]);
1075
+ const vt = W((c) => be((T) => Xe(T + c, Ee)), [Ee]), gt = Z(
1076
+ () => ({ iconOverrides: D, showExpandIcons: N, showDirectoryIcons: w, showFileIcons: h, useCanvasExpandIcons: I, expandIconSize: C, highlightStyles: F }),
1077
+ [D, N, w, h, I, C, F]
1078
+ ), wt = Z(
1070
1079
  () => /* @__PURE__ */ i.jsx(
1071
- ir,
1080
+ dr,
1072
1081
  {
1073
- ref: B,
1074
- itemCount: Y.length,
1075
- getItem: pt,
1076
- getItemHeight: dt,
1077
- getItemKey: ut,
1078
- testId: tt,
1079
- contentProps: rt,
1080
- viewportSize: me,
1081
- overscanCount: be,
1082
- onScroll: nt,
1083
- onRangeChange: st,
1084
- className: Te,
1085
- onWheelHorizontal: G ? xt : void 0,
1082
+ ref: P,
1083
+ itemCount: V.length,
1084
+ getItem: xt,
1085
+ getItemHeight: mt,
1086
+ getItemKey: ft,
1087
+ testId: nt,
1088
+ contentProps: st,
1089
+ viewportSize: fe,
1090
+ overscanCount: Se,
1091
+ onScroll: at,
1092
+ onRangeChange: ot,
1093
+ className: Re,
1094
+ onWheelHorizontal: p ? vt : void 0,
1086
1095
  background: /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
1087
- G && X ? (
1096
+ p && U ? (
1088
1097
  // Clip the connector-line canvas to the frozen name column so deep trees never bleed into the numeric region.
1089
- /* @__PURE__ */ i.jsx("div", { className: "pointer-events-none absolute top-0 left-0 z-0 h-full overflow-hidden", style: { width: X.nameWidth }, "aria-hidden": "true", children: Ge })
1090
- ) : Ge,
1091
- Ce
1098
+ /* @__PURE__ */ i.jsx("div", { className: "pointer-events-none absolute top-0 left-0 z-0 h-full overflow-hidden", style: { width: U.nameWidth }, "aria-hidden": "true", children: Ve })
1099
+ ) : Ve,
1100
+ Pe
1092
1101
  ] }),
1093
- initialScrollIndex: Se,
1094
- initialScrollOffset: U,
1095
- onItemFocus: Ke,
1096
- callbackThrottleMs: Ee,
1097
- contentInsets: ge,
1098
- scrollBarOptions: He,
1099
- behaviorOptions: Qe,
1100
- children: (d) => d ? G && P && X ? /* @__PURE__ */ i.jsx(
1101
- Vt,
1102
+ initialScrollIndex: ce,
1103
+ initialScrollOffset: ne,
1104
+ onItemFocus: et,
1105
+ callbackThrottleMs: Qe,
1106
+ contentInsets: ke,
1107
+ scrollBarOptions: We,
1108
+ behaviorOptions: tt,
1109
+ children: (c, T) => c ? p && A && U ? /* @__PURE__ */ i.jsx(
1110
+ Xt,
1102
1111
  {
1103
- entry: d.entry,
1104
- indentLevel: d.indentLevel,
1105
- positionInSet: d.positionInSet,
1106
- setSize: d.setSize,
1107
- rowHeight: d.rowHeight,
1108
- isDirOpen: fe,
1109
- columns: P.columns,
1110
- numericTemplate: Oe,
1111
- numericTotal: X.numericTotal,
1112
- nameWidth: X.nameWidth,
1113
- rowClassName: P.rowClassName,
1114
- selection: { onEntryClick: I, selectedPath: x ?? null, mode: c, selectedItems: y, onSelectionChange: k },
1115
- expansion: { toggleDirectory: t, onToggleDirectoryRecursive: ze },
1116
- visual: vt
1112
+ entry: c.entry,
1113
+ indentLevel: c.indentLevel,
1114
+ positionInSet: c.positionInSet,
1115
+ setSize: c.setSize,
1116
+ rowIndex: T + (A.showHeader ?? !0 ? 2 : 1),
1117
+ isSelectedForAria: !!f?.has(c.entry.absolutePath),
1118
+ rowHeight: c.rowHeight,
1119
+ isDirOpen: he,
1120
+ columns: A.columns,
1121
+ numericTemplate: Fe,
1122
+ numericTotal: U.numericTotal,
1123
+ nameWidth: U.nameWidth,
1124
+ rowClassName: A.rowClassName,
1125
+ selection: { onEntryClick: E, selectedPath: b ?? null, mode: d, selectedItems: f, onSelectionChange: v },
1126
+ expansion: { toggleDirectory: t, onToggleDirectoryRecursive: Ye },
1127
+ visual: gt
1117
1128
  },
1118
- d.entry.absolutePath
1129
+ c.entry.absolutePath
1119
1130
  ) : /* @__PURE__ */ i.jsx(
1120
- Ze,
1131
+ Ke,
1121
1132
  {
1122
- entry: d.entry,
1123
- indentLevel: d.indentLevel,
1124
- depth: d.depth,
1125
- positionInSet: d.positionInSet,
1126
- setSize: d.setSize,
1127
- rowHeight: d.rowHeight,
1128
- isDirOpen: fe,
1129
- parentIsLast: d.parentIsLast,
1133
+ entry: c.entry,
1134
+ indentLevel: c.indentLevel,
1135
+ depth: c.depth,
1136
+ positionInSet: c.positionInSet,
1137
+ setSize: c.setSize,
1138
+ isSelectedForAria: !!f?.has(c.entry.absolutePath),
1139
+ rowHeight: c.rowHeight,
1140
+ isDirOpen: he,
1141
+ parentIsLast: c.parentIsLast,
1130
1142
  renderChildren: !1,
1131
- expansion: { toggleDirectory: t, onToggleDirectoryRecursive: ze },
1132
- selection: { onEntryClick: I, selectedPath: x ?? null, mode: c, selectedItems: y, onSelectionChange: k },
1143
+ expansion: { toggleDirectory: t, onToggleDirectoryRecursive: Ye },
1144
+ selection: { onEntryClick: E, selectedPath: b ?? null, mode: d, selectedItems: f, onSelectionChange: v },
1133
1145
  visual: {
1134
- iconOverrides: b,
1135
- showExpandIcons: v,
1136
- showDirectoryIcons: M,
1137
- showFileIcons: N,
1138
- useCanvasExpandIcons: h,
1139
- expandIconSize: p,
1140
- highlightStyles: L,
1141
- entryClassName: j,
1142
- entryStyle: Z,
1146
+ iconOverrides: D,
1147
+ showExpandIcons: N,
1148
+ showDirectoryIcons: w,
1149
+ showFileIcons: h,
1150
+ useCanvasExpandIcons: I,
1151
+ expandIconSize: C,
1152
+ highlightStyles: F,
1153
+ entryClassName: H,
1154
+ entryStyle: q,
1143
1155
  nameClassName: K,
1144
1156
  nameStyle: R,
1145
1157
  directoryNameClassName: z,
1146
- directoryNameStyle: F,
1147
- fileNameClassName: $,
1148
- fileNameStyle: te
1158
+ directoryNameStyle: B,
1159
+ fileNameClassName: Y,
1160
+ fileNameStyle: ae
1149
1161
  }
1150
1162
  },
1151
- d.entry.absolutePath
1163
+ c.entry.absolutePath
1152
1164
  ) : null
1153
1165
  }
1154
1166
  ),
1155
1167
  [
1156
- Y.length,
1157
- pt,
1158
- dt,
1159
- ut,
1160
- tt,
1161
- rt,
1162
- me,
1163
- be,
1168
+ V.length,
1169
+ xt,
1170
+ mt,
1171
+ ft,
1164
1172
  nt,
1165
1173
  st,
1166
- Te,
1167
- G,
1168
- xt,
1169
- X,
1170
- Ge,
1171
- Ce,
1174
+ fe,
1172
1175
  Se,
1176
+ at,
1177
+ ot,
1178
+ Re,
1179
+ p,
1180
+ vt,
1173
1181
  U,
1174
- Ke,
1175
- Ee,
1176
- ge,
1177
- He,
1182
+ Ve,
1183
+ Pe,
1184
+ ce,
1185
+ ne,
1186
+ et,
1178
1187
  Qe,
1179
- P,
1180
- Oe,
1181
- fe,
1182
- I,
1183
- x,
1184
- c,
1185
- y,
1186
- k,
1187
- t,
1188
- ze,
1189
- vt,
1188
+ ke,
1189
+ We,
1190
+ tt,
1191
+ A,
1192
+ Fe,
1193
+ he,
1194
+ E,
1190
1195
  b,
1196
+ d,
1197
+ f,
1191
1198
  v,
1192
- M,
1199
+ t,
1200
+ Ye,
1201
+ gt,
1202
+ D,
1193
1203
  N,
1204
+ w,
1194
1205
  h,
1195
- p,
1196
- L,
1197
- j,
1198
- Z,
1206
+ I,
1207
+ C,
1208
+ F,
1209
+ H,
1210
+ q,
1199
1211
  K,
1200
1212
  R,
1201
1213
  z,
1202
- F,
1203
- $,
1204
- te
1214
+ B,
1215
+ Y,
1216
+ ae
1205
1217
  ]
1206
1218
  );
1207
- if (!(P && X))
1208
- return /* @__PURE__ */ i.jsx("div", { ref: w, className: at, style: ot, role: "tree", children: bt });
1209
- const tr = P.showHeader ?? !0, rr = P.showFooter ?? !1, nr = { ...ot, "--dt-hscroll": `${ie}px` };
1210
- return /* @__PURE__ */ i.jsxs("div", { ref: w, className: _(at, "dt-grid"), style: nr, role: "treegrid", children: [
1211
- tr && /* @__PURE__ */ i.jsx(gr, { columns: P.columns, numericTemplate: Oe, numericTotal: X.numericTotal, nameWidth: X.nameWidth, scrollBarWidth: we, className: P.headerClassName }),
1212
- /* @__PURE__ */ i.jsx("div", { ref: E, className: "dt-grid-body", children: bt }),
1213
- ke > 0 && /* @__PURE__ */ i.jsxs("div", { className: "dt-grid-hscrollbar-row", children: [
1214
- /* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: X.nameWidth }, "aria-hidden": "true" }),
1215
- /* @__PURE__ */ i.jsx(
1216
- cr,
1217
- {
1218
- horizontal: !0,
1219
- contentSize: X.numericTotal,
1220
- viewportSize: X.numericVisible,
1221
- scrollPosition: ie,
1222
- scrollBarWidth: we,
1223
- onScroll: (d) => {
1224
- const C = typeof d == "function" ? d(ie) : d, H = Ue(C, ke);
1225
- return ye(H), H;
1226
- }
1227
- }
1228
- ),
1229
- /* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: we }, "aria-hidden": "true" })
1230
- ] }),
1231
- rr && /* @__PURE__ */ i.jsx(wr, { columns: P.columns, numericTemplate: Oe, numericTotal: X.numericTotal, nameWidth: X.nameWidth, scrollBarWidth: we, allEntries: er, className: P.footerClassName })
1232
- ] });
1233
- }, Vr = ({ initialExpanded: e = /* @__PURE__ */ new Set(), storageKey: t } = {}) => {
1234
- const [a, n] = lr(), [r, o] = ae(() => {
1219
+ if (!(A && U))
1220
+ return /* @__PURE__ */ i.jsx("div", { ref: L, className: lt, style: it, role: "tree", "aria-label": x ? void 0 : m, "aria-labelledby": x, "aria-multiselectable": d === "multiple" ? !0 : void 0, children: wt });
1221
+ const nr = A.showHeader ?? !0, sr = A.showFooter ?? !1, ar = { ...it, "--dt-hscroll": `${xe}px` };
1222
+ return /* @__PURE__ */ i.jsxs(
1223
+ "div",
1224
+ {
1225
+ ref: L,
1226
+ className: _(lt, "dt-grid"),
1227
+ style: ar,
1228
+ role: "treegrid",
1229
+ "aria-label": x ? void 0 : m,
1230
+ "aria-labelledby": x,
1231
+ "aria-multiselectable": d === "multiple" ? !0 : void 0,
1232
+ "aria-rowcount": V.length + (A.showHeader ?? !0 ? 1 : 0),
1233
+ children: [
1234
+ nr && /* @__PURE__ */ i.jsx(Sr, { columns: A.columns, numericTemplate: Fe, numericTotal: U.numericTotal, nameWidth: U.nameWidth, scrollBarWidth: Ne, className: A.headerClassName }),
1235
+ /* @__PURE__ */ i.jsx("div", { ref: G, className: "dt-grid-body", children: wt }),
1236
+ Ee > 0 && /* @__PURE__ */ i.jsxs("div", { className: "dt-grid-hscrollbar-row", children: [
1237
+ /* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: U.nameWidth }, "aria-hidden": "true" }),
1238
+ /* @__PURE__ */ i.jsx(
1239
+ ur,
1240
+ {
1241
+ horizontal: !0,
1242
+ contentSize: U.numericTotal,
1243
+ viewportSize: U.numericVisible,
1244
+ scrollPosition: xe,
1245
+ scrollBarWidth: Ne,
1246
+ onScroll: (c) => {
1247
+ const T = typeof c == "function" ? c(xe) : c, $ = Xe(T, Ee);
1248
+ return be($), $;
1249
+ }
1250
+ }
1251
+ ),
1252
+ /* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: Ne }, "aria-hidden": "true" })
1253
+ ] }),
1254
+ sr && /* @__PURE__ */ i.jsx(kr, { columns: A.columns, numericTemplate: Fe, numericTotal: U.numericTotal, nameWidth: U.nameWidth, scrollBarWidth: Ne, allEntries: rr, className: A.footerClassName })
1255
+ ]
1256
+ }
1257
+ );
1258
+ }, Xr = ({ initialExpanded: e = /* @__PURE__ */ new Set(), storageKey: t } = {}) => {
1259
+ const [a, n] = cr(), [r, o] = ie(() => {
1235
1260
  if (typeof window < "u" && t)
1236
1261
  try {
1237
- const f = window.localStorage.getItem(t);
1238
- if (f) {
1239
- const h = JSON.parse(f);
1240
- return new Set(h);
1262
+ const m = window.localStorage.getItem(t);
1263
+ if (m) {
1264
+ const x = JSON.parse(m);
1265
+ return new Set(x);
1241
1266
  }
1242
- } catch (f) {
1243
- console.error("[useDirectoryTreeState] Error reading from localStorage", f);
1267
+ } catch (m) {
1268
+ console.error("[useDirectoryTreeState] Error reading from localStorage", m);
1244
1269
  }
1245
1270
  return e;
1246
- }), l = W((f) => {
1271
+ }), l = W((m) => {
1247
1272
  n(() => {
1248
- o((h) => {
1249
- const v = new Set(h);
1250
- return f(v), v;
1273
+ o((x) => {
1274
+ const S = new Set(x);
1275
+ return m(S), S;
1251
1276
  });
1252
1277
  });
1253
- }, []), m = W(
1254
- (f, h) => {
1255
- l((v) => {
1256
- for (const M of f)
1257
- h(v, M);
1278
+ }, []), u = W(
1279
+ (m, x) => {
1280
+ l((S) => {
1281
+ for (const I of m)
1282
+ x(S, I);
1258
1283
  });
1259
1284
  },
1260
1285
  [l]
1261
1286
  );
1262
- ue(() => {
1287
+ me(() => {
1263
1288
  if (t && typeof window < "u")
1264
1289
  try {
1265
1290
  window.localStorage.setItem(t, JSON.stringify(Array.from(r)));
1266
- } catch (f) {
1267
- console.warn(`Error setting localStorage key "${t}":`, f);
1291
+ } catch (m) {
1292
+ console.warn(`Error setting localStorage key "${t}":`, m);
1268
1293
  }
1269
1294
  }, [r, t]);
1270
- const I = W(
1271
- (f) => {
1272
- m([f], (h, v) => {
1273
- h.has(v) ? h.delete(v) : h.add(v);
1295
+ const E = W(
1296
+ (m) => {
1297
+ u([m], (x, S) => {
1298
+ x.has(S) ? x.delete(S) : x.add(S);
1274
1299
  });
1275
1300
  },
1276
- [m]
1277
- ), x = W(
1278
- (f) => {
1279
- m([f], (h, v) => {
1280
- h.add(v);
1301
+ [u]
1302
+ ), b = W(
1303
+ (m) => {
1304
+ u([m], (x, S) => {
1305
+ x.add(S);
1281
1306
  });
1282
1307
  },
1283
- [m]
1284
- ), c = W(
1285
- (f) => {
1286
- m([f], (h, v) => {
1287
- h.delete(v);
1308
+ [u]
1309
+ ), d = W(
1310
+ (m) => {
1311
+ u([m], (x, S) => {
1312
+ x.delete(S);
1288
1313
  });
1289
1314
  },
1290
- [m]
1291
- ), y = W(
1292
- (f) => {
1293
- m(f, (h, v) => {
1294
- h.delete(v);
1315
+ [u]
1316
+ ), f = W(
1317
+ (m) => {
1318
+ u(m, (x, S) => {
1319
+ x.delete(S);
1295
1320
  });
1296
1321
  },
1297
- [m]
1298
- ), k = W(
1299
- (f) => {
1300
- m(f, (h, v) => {
1301
- h.add(v);
1322
+ [u]
1323
+ ), v = W(
1324
+ (m) => {
1325
+ u(m, (x, S) => {
1326
+ x.add(S);
1302
1327
  });
1303
1328
  },
1304
- [m]
1329
+ [u]
1305
1330
  ), g = W(() => {
1306
- l((f) => {
1307
- f.clear();
1331
+ l((m) => {
1332
+ m.clear();
1308
1333
  });
1309
- }, [l]), S = W((f) => r.has(f), [r]);
1334
+ }, [l]), k = W((m) => r.has(m), [r]);
1310
1335
  return {
1311
1336
  expanded: r,
1312
- toggle: I,
1313
- expand: x,
1314
- collapse: c,
1315
- collapseMultiple: y,
1316
- expandMultiple: k,
1337
+ toggle: E,
1338
+ expand: b,
1339
+ collapse: d,
1340
+ collapseMultiple: f,
1341
+ expandMultiple: v,
1317
1342
  collapseAll: g,
1318
- isExpanded: S,
1343
+ isExpanded: k,
1319
1344
  isPending: a
1320
1345
  };
1321
1346
  };
1322
1347
  export {
1323
- Gr as DirectoryTree,
1324
- A as directoryTreeClasses,
1325
- Vr as useDirectoryTreeState
1348
+ Ur as DirectoryTree,
1349
+ O as directoryTreeClasses,
1350
+ Xr as useDirectoryTreeState
1326
1351
  };