@aiquants/directory-tree 3.2.0 → 3.4.0

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