@aiquants/directory-tree 3.2.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
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";
1
+ import Zt, { useRef as ce, useEffect as de, useCallback as W, memo as ze, useState as se, useMemo as q, useLayoutEffect as Qt, Fragment as Kt, useTransition as er } from "react";
2
2
  import { VirtualScroll as tr, ScrollBar as rr } from "@aiquants/virtualscroll";
3
3
  import { twMerge as M } from "tailwind-merge";
4
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 = {};
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 It, FileZip as St, FileCode as jt, FileText as Tt, FileIcon as or } from "@phosphor-icons/react";
6
+ var Me = { exports: {} }, Ee = {};
7
7
  var Rt;
8
8
  function lr() {
9
- if (Rt) return Ne;
9
+ if (Rt) return Ee;
10
10
  Rt = 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 = {};
@@ -18,176 +18,176 @@ function lr() {
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 Ee.Fragment = t, Ee.jsx = a, Ee.jsxs = a, Ee;
28
28
  }
29
- var Ee = {};
29
+ var Ie = {};
30
30
  var Ct;
31
31
  function ir() {
32
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) {
33
+ function e(n) {
34
+ if (n == null) return null;
35
+ if (typeof n == "function")
36
+ return n.$$typeof === B ? 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 T:
46
46
  return "Suspense";
47
- case $:
47
+ case R:
48
48
  return "SuspenseList";
49
- case z:
49
+ case C:
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) {
55
+ ), n.$$typeof) {
56
56
  case u:
57
57
  return "Portal";
58
+ case w:
59
+ return n.displayName || "Context";
58
60
  case N:
59
- return s.displayName || "Context";
60
- case g:
61
- return (s._context.displayName || "Context") + ".Consumer";
61
+ return (n._context.displayName || "Context") + ".Consumer";
62
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;
63
+ var h = n.render;
64
+ return n = n.displayName, n || (n = h.displayName || h.name || "", n = n !== "" ? "ForwardRef(" + n + ")" : "ForwardRef"), n;
65
+ case L:
66
+ return h = n.displayName || null, h !== null ? h : e(n.type) || "Memo";
67
+ case V:
68
+ h = n._payload, n = n._init;
69
69
  try {
70
- return e(s(y));
70
+ return e(n(h));
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 h = !1;
83
83
  } catch {
84
- y = !0;
84
+ h = !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 (h) {
87
+ h = console;
88
+ var S = h.error, _ = typeof Symbol == "function" && Symbol.toStringTag && n[Symbol.toStringTag] || n.constructor.name || "Object";
89
+ return S.call(
90
+ h,
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 === V)
99
99
  return "<...>";
100
100
  try {
101
- var y = e(s);
102
- return y ? "<" + y + ">" : "<...>";
101
+ var h = e(n);
102
+ return h ? "<" + h + ">" : "<...>";
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 (H.call(n, "key")) {
116
+ var h = Object.getOwnPropertyDescriptor(n, "key").get;
117
+ if (h && h.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 d(n, h) {
122
+ function S() {
123
+ ae || (ae = !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
+ h
126
126
  ));
127
127
  }
128
- j.isReactWarning = !0, Object.defineProperty(s, "key", {
129
- get: j,
128
+ S.isReactWarning = !0, Object.defineProperty(n, "key", {
129
+ get: S,
130
130
  configurable: !0
131
131
  });
132
132
  }
133
- function w() {
134
- var s = e(this.type);
135
- return G[s] || (G[s] = !0, console.error(
133
+ function g() {
134
+ var n = e(this.type);
135
+ return oe[n] || (oe[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, h, S, _, ee, Q) {
140
+ var P = S.ref;
141
+ return n = {
142
+ $$typeof: I,
143
+ type: n,
144
+ key: h,
145
+ props: S,
146
146
  _owner: _
147
- }, (P !== void 0 ? P : null) !== null ? Object.defineProperty(s, "ref", {
147
+ }, (P !== void 0 ? P : null) !== null ? Object.defineProperty(n, "ref", {
148
148
  enumerable: !1,
149
- get: w
150
- }) : Object.defineProperty(s, "ref", { enumerable: !1, value: null }), s._store = {}, Object.defineProperty(s._store, "validated", {
149
+ get: g
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
- value: Q
165
- }), Object.defineProperty(s, "_debugTask", {
164
+ value: ee
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: Q
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;
172
+ function c(n, h, S, _, ee, Q) {
173
+ var P = h.children;
174
174
  if (P !== void 0)
175
175
  if (_)
176
- if (X(P)) {
176
+ if (Z(P)) {
177
177
  for (_ = 0; _ < P.length; _++)
178
- h(P[_]);
178
+ y(P[_]);
179
179
  Object.freeze && Object.freeze(P);
180
180
  } else
181
181
  console.error(
182
182
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
183
183
  );
184
- else 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(P);
185
+ if (H.call(h, "key")) {
186
+ P = e(n);
187
+ var K = Object.keys(h).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}", Y[P + _] || (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} />
@@ -196,77 +196,77 @@ React keys must be passed directly to JSX without using spread:
196
196
  <%s key={someKey} {...props} />`,
197
197
  _,
198
198
  P,
199
- ee,
199
+ K,
200
200
  P
201
- ), ae[P + _] = !0);
201
+ ), Y[P + _] = !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;
203
+ if (P = null, S !== void 0 && (a(S), P = "" + S), l(h) && (a(h.key), P = "" + h.key), "key" in h) {
204
+ S = {};
205
+ for (var te in h)
206
+ te !== "key" && (S[te] = h[te]);
207
+ } else S = h;
208
208
  return P && d(
209
- j,
210
- typeof s == "function" ? s.displayName || s.name || "Unknown" : s
209
+ S,
210
+ typeof n == "function" ? n.displayName || n.name || "Unknown" : n
211
211
  ), x(
212
- s,
212
+ n,
213
213
  P,
214
- j,
214
+ S,
215
215
  r(),
216
- Q,
217
- K
216
+ ee,
217
+ Q
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
+ b(n) ? n._store && (n._store.validated = 1) : typeof n == "object" && n !== null && n.$$typeof === V && (n._payload.status === "fulfilled" ? b(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 b(n) {
224
+ return typeof n == "object" && n !== null && n.$$typeof === I;
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 k = Zt, I = /* @__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"), D = /* @__PURE__ */ Symbol.for("react.profiler"), N = /* @__PURE__ */ Symbol.for("react.consumer"), w = /* @__PURE__ */ Symbol.for("react.context"), p = /* @__PURE__ */ Symbol.for("react.forward_ref"), T = /* @__PURE__ */ Symbol.for("react.suspense"), R = /* @__PURE__ */ Symbol.for("react.suspense_list"), L = /* @__PURE__ */ Symbol.for("react.memo"), V = /* @__PURE__ */ Symbol.for("react.lazy"), C = /* @__PURE__ */ Symbol.for("react.activity"), B = /* @__PURE__ */ Symbol.for("react.client.reference"), F = k.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, H = Object.prototype.hasOwnProperty, Z = Array.isArray, U = console.createTask ? console.createTask : function() {
227
227
  return null;
228
228
  };
229
229
  k = {
230
- react_stack_bottom_frame: function(s) {
231
- return s();
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(
234
+ var ae, oe = {}, A = k.react_stack_bottom_frame.bind(
235
235
  k,
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
+ )(), E = U(s(o)), Y = {};
238
+ Ie.Fragment = f, Ie.jsx = function(n, h, S) {
239
+ var _ = 1e4 > F.recentlyCreatedOwnerStacks++;
240
240
  return c(
241
- s,
242
- y,
243
- j,
241
+ n,
242
+ h,
243
+ S,
244
244
  !1,
245
- _ ? Error("react-stack-top-frame") : E,
246
- _ ? Z(n(s)) : F
245
+ _ ? Error("react-stack-top-frame") : A,
246
+ _ ? U(s(n)) : E
247
247
  );
248
- }, Ee.jsxs = function(s, y, j) {
249
- var _ = 1e4 > L.recentlyCreatedOwnerStacks++;
248
+ }, Ie.jsxs = function(n, h, S) {
249
+ var _ = 1e4 > F.recentlyCreatedOwnerStacks++;
250
250
  return c(
251
- s,
252
- y,
253
- j,
251
+ n,
252
+ h,
253
+ S,
254
254
  !0,
255
- _ ? Error("react-stack-top-frame") : E,
256
- _ ? Z(n(s)) : F
255
+ _ ? Error("react-stack-top-frame") : A,
256
+ _ ? U(s(n)) : E
257
257
  );
258
258
  };
259
- })()), Ee;
259
+ })()), Ie;
260
260
  }
261
261
  var _t;
262
262
  function cr() {
263
- return _t || (_t = 1, process.env.NODE_ENV === "production" ? Ce.exports = lr() : Ce.exports = ir()), Ce.exports;
263
+ return _t || (_t = 1, process.env.NODE_ENV === "production" ? Me.exports = lr() : Me.exports = ir()), Me.exports;
264
264
  }
265
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]",
266
+ const Ae = 18, Oe = 12, Pt = 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
+ }, Dt = ({ 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(sr, { className: l, style: o }) : /* @__PURE__ */ i.jsx(ar, { 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,8 +297,8 @@ 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"))
@@ -306,7 +306,7 @@ const _e = 20, ke = 16, Pt = 12, A = {
306
306
  }
307
307
  return e;
308
308
  }, dr = (e, t, a) => {
309
- const n = (t || (a ? xe(a) : "")).toLowerCase(), r = (e || "").toLowerCase();
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
312
  return /* @__PURE__ */ i.jsx(xt, { className: "h-4 w-4 text-sky-500 dark:text-sky-400" });
@@ -325,133 +325,131 @@ const _e = 20, ke = 16, Pt = 12, A = {
325
325
  if (r.startsWith("audio/"))
326
326
  return /* @__PURE__ */ i.jsx(Et, { 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(It, { 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(St, { 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
332
  return /* @__PURE__ */ i.jsx(jt, { className: "h-4 w-4 text-purple-500 dark:text-purple-400" });
333
333
  if (r.startsWith("text/"))
334
334
  return /* @__PURE__ */ i.jsx(Tt, { 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")
336
+ if (s) {
337
+ if (s === "md" || s === "markdown" || s === "mdx")
338
338
  return /* @__PURE__ */ i.jsx(xt, { className: "h-4 w-4 text-sky-500 dark:text-sky-400" });
339
- if (n === "pdf")
339
+ if (s === "pdf")
340
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))
341
+ if (["xls", "xlsx", "xlsm", "xlsb", "ods"].includes(s))
342
342
  return /* @__PURE__ */ i.jsx(bt, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
343
- if (["csv", "tsv"].includes(n))
343
+ if (["csv", "tsv"].includes(s))
344
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))
345
+ if (["doc", "docx", "rtf", "odt"].includes(s))
346
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))
347
+ if (["ppt", "pptx", "odp"].includes(s))
348
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))
349
+ if (["png", "jpg", "jpeg", "gif", "svg", "webp", "ico", "bmp", "tiff", "avif"].includes(s))
350
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
- ))
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))
354
352
  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))
353
+ if (["mp3", "wav", "ogg", "m4a", "flac", "aac", "wma"].includes(s))
356
354
  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))
355
+ if (["mp4", "webm", "mov", "avi", "mkv", "wmv", "flv"].includes(s))
356
+ return /* @__PURE__ */ i.jsx(It, { 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(St, { className: "h-4 w-4 text-amber-500 dark:text-amber-400" });
359
+ if (["txt", "log"].includes(s))
362
360
  return /* @__PURE__ */ i.jsx(Tt, { className: "h-4 w-4 text-gray-500 dark:text-gray-400" });
363
361
  }
364
362
  return /* @__PURE__ */ i.jsx(or, { className: "h-4 w-4 text-gray-400 dark:text-gray-400" });
365
363
  }, Lt = (e, t) => {
366
- const { entry: a, isDirectory: n, isExpanded: r, extension: o, mimeType: l } = e;
364
+ const { entry: a, isDirectory: s, isExpanded: r, extension: o, mimeType: l } = e;
367
365
  let d;
368
- 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(
366
+ const g = l || a.mimeType;
367
+ return a.icon !== void 0 ? d = a.icon : s ? 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(g, o, a.name), Ve(typeof d == "function" ? d(e) : d, a.absolutePath);
368
+ }, ur = 500, Ft = ({ entry: e, isDirectory: t, isExpanded: a, isItemSelected: s, selectionMode: r, onSelectionChange: o, onEntryClick: l, toggleDirectory: d, onToggleDirectoryRecursive: g }) => {
369
+ const x = ce(null);
370
+ return de(
373
371
  () => () => {
374
372
  x.current && window.clearTimeout(x.current);
375
373
  },
376
374
  []
377
- ), B(
375
+ ), W(
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(() => {
386
+ }), !(!t || y) && (x.current ? (window.clearTimeout(x.current), x.current = null, g(e)) : x.current = window.setTimeout(() => {
389
387
  d(e.absolutePath), x.current = null;
390
388
  }, ur));
391
389
  },
392
- [t, e, a, w, d, l, r, o, n]
390
+ [t, e, a, g, d, l, r, o, s]
393
391
  );
394
392
  }, $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) => ({
395
393
  width: e,
396
394
  gridTemplateColumns: t
397
- }), Wt = Ye(
395
+ }), Wt = 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
404
  nameWidth: d,
407
- 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 }
405
+ rowClassName: g,
406
+ selection: { onEntryClick: x, selectedPath: c, mode: y = "none", selectedItems: b, onSelectionChange: k },
407
+ expansion: { toggleDirectory: I, onToggleDirectoryRecursive: u },
408
+ visual: { iconOverrides: f, showExpandIcons: v = !0, showDirectoryIcons: D = !0, showFileIcons: N = !0, useCanvasExpandIcons: w = !1, expandIconSize: p, indentSize: T = Oe, highlightStyles: R }
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, V] = se(!1), C = e.children !== void 0, B = C && s(e.absolutePath), F = e.absolutePath === c, H = !C && !!b?.has(e.absolutePath), Z = C ? void 0 : xe(e.name) || xe(e.relativePath) || xe(e.absolutePath), U = Ft({ entry: e, isDirectory: C, isExpanded: B, isItemSelected: H, selectionMode: y, onSelectionChange: k, onEntryClick: x, toggleDirectory: I, onToggleDirectoryRecursive: u }), ae = L ? R?.hoverClassName !== void 0 ? R.hoverClassName : O.entryHover : "", oe = (() => {
411
+ if (C) {
412
+ if (F) return R?.directorySelectedClassName !== void 0 ? R.directorySelectedClassName : O.entrySelected;
413
+ } else if (F || H)
414
+ return R?.itemSelectedClassName !== void 0 ? R.itemSelectedClassName : M(F && O.entrySelected, H && 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 g == "function" ? g(e) : g, E = M("dt-grid-row cursor-pointer select-none", ae, oe, A, e.className), Y = M(O.expandIcon, (F || H) && O.expandIconSelected), n = M(O.typeIcon, (F || H) && O.typeIconSelected), h = M("dt-grid-name-label ml-1", "text-gray-700 dark:text-gray-200", C && O.nameDirectory, (F || H) && O.nameSelected), S = Dt({ isDirectory: C, isExpanded: B, showExpandIcons: v, useCanvasExpandIcons: w, expandIconSize: p }), _ = (C ? D : N) ? Lt({ entry: e, isDirectory: C, isExpanded: B, isSelected: F, isItemSelected: H, extension: Z, mimeType: e.mimeType }, f) : null, ee = { indentLevel: t, isDirectory: C, isExpanded: B }, [Q, ...P] = r, K = Q?.render ? Q.render(e, ee) : e.label ?? e.name, te = {
417
+ ...L ? R?.hoverStyle : {},
418
+ ...C && F ? R?.directorySelectedStyle : {},
419
+ ...!C && (F || H) ? R?.itemSelectedStyle : {}
422
420
  };
423
421
  return /* @__PURE__ */ i.jsxs(
424
422
  "div",
425
423
  {
426
424
  className: E,
427
- style: { height: a, ...ee, ...e.style },
425
+ style: { height: a, ...te, ...e.style },
428
426
  role: "row",
429
- "aria-expanded": I ? z : void 0,
427
+ "aria-expanded": C ? B : 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": C ? "directory" : "file",
430
+ "data-entry-expanded": C ? String(B) : void 0,
431
+ "data-entry-selected": F ? "true" : void 0,
432
+ "data-entry-item-selected": H ? "true" : void 0,
433
+ onClick: U,
434
+ onMouseEnter: () => V(!0),
435
+ onMouseLeave: () => V(!1),
436
+ onKeyDown: (G) => G.key === "Enter" && U(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", Q?.className), role: "gridcell", style: { width: d, paddingLeft: Math.max(0, t * T) }, children: [
440
+ (v || w) && /* @__PURE__ */ i.jsx("span", { className: Y, children: S }),
441
+ (C ? D : N) && /* @__PURE__ */ i.jsx("span", { className: n, children: _ }),
442
+ /* @__PURE__ */ i.jsx("span", { className: h, 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
+ P.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: P.map((G) => /* @__PURE__ */ i.jsx("div", { className: M("dt-grid-cell", $t(G.align), G.className), role: "gridcell", children: G.render ? G.render(e, ee) : 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 = Mt(e.entry, e.isDirOpen), s = Mt(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
455
  Wt.displayName = "DirectoryTreeGridRow";
@@ -459,185 +457,185 @@ const Bt = ({
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
464
  nameContent: d,
467
- renderCell: w
465
+ renderCell: g
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: [
467
+ const [, ...x] = t, c = e === "header" ? "dt-grid-name-header" : "dt-grid-name-footer", y = e === "header" ? "dt-grid-header" : "dt-grid-footer", b = e === "header" ? "columnheader" : "gridcell";
468
+ return /* @__PURE__ */ i.jsxs("div", { className: M(y, "text-gray-600 dark:text-gray-300", l), role: "row", children: [
471
469
  /* @__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)) }) }),
470
+ x.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-track", style: Ht(s, a), children: x.map((k) => /* @__PURE__ */ i.jsx("div", { className: M("dt-grid-cell", $t(k.align), k.className), role: b, children: g(k) }, k.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
+ }, mr = ({ columns: e, className: t, ...a }) => /* @__PURE__ */ i.jsx(Bt, { kind: "header", columns: e, className: t, nameContent: e[0]?.header ?? null, renderCell: (s) => s.header ?? null, ...a }), At = (e, t) => typeof e == "function" ? e(t) : e ?? null, fr = ({ columns: e, allEntries: t, className: a, ...s }) => /* @__PURE__ */ i.jsx(Bt, { kind: "footer", columns: e, className: a, nameContent: At(e[0]?.footer, t), renderCell: (r) => At(r.footer, t), ...s }), hr = 240, Yt = 96, Gt = 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
+ }, pr = (e) => e.slice(1).map((t) => `${Ue(t, Yt)}px`).join(" "), yr = ({ measuredWidth: e, columns: t, scrollBarWidth: a = Gt }) => {
477
+ const s = Ue(t[0], hr), r = t.slice(1).reduce((g, x) => g + Ue(x, Yt), 0), o = Number.isFinite(e) && e > 0 ? e : 0, l = Math.max(0, o - s - Math.max(0, a)), d = Math.max(0, r - l);
478
+ return { nameWidth: s, numericTotal: r, numericVisible: l, maxHScroll: d };
479
+ }, Ge = (e, t) => !Number.isFinite(e) || e < 0 ? 0 : e > t ? t : e, xr = (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
485
  }, vr = (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
494
  }, br = (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 = vr(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
502
  }, gr = (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
509
  }, wr = (e, t, a) => {
512
- const n = [];
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;
517
+ return s;
520
518
  }, kr = (e, t, a) => {
521
- const n = [];
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
+ }, Nr = (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
532
  }, Er = (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
+ }, Ir = (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((d) => d + d).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
+ }, Sr = (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 = Ir(a, 0.14), o = e.strokeStyle, l = e.fillStyle, d = e.lineWidth, g = 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, b = Math.max(0, y / 2), k = Math.max(1, Math.round(y * 0.08)), I = Math.max(1, Math.round(y * 0.14)), u = Math.max(0, b - k * 0.8), f = Math.max(0, u * 0.55);
552
+ 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 = I, 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 = d, e.lineCap = g, e.lineJoin = x;
555
+ }, Vt = ze(({ segmentsByItem: e, glyphsByItem: t, itemHeight: a, width: s, viewportHeight: r, scrollPosition: o, color: l = "#a0aec0", strokeWidth: d = 1, renderStartIndex: g, renderEndIndex: x, lookaheadEndIndex: c, devicePixelRatio: y, expandGlyphColor: b, expandGlyphSize: k }) => {
556
+ const I = ce(null), u = 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
564
  strokeWidth: d,
567
- renderStartIndex: w,
565
+ renderStartIndex: g,
568
566
  renderEndIndex: x,
569
567
  lookaheadEndIndex: c,
570
- devicePixelRatio: h,
568
+ devicePixelRatio: y,
571
569
  expandGlyphColor: b,
572
570
  expandGlyphSize: k
573
- }), v = B(() => {
571
+ }), v = W(() => {
574
572
  u.current = null;
575
- const g = S.current;
576
- if (!g)
577
- return;
578
- const N = g.getContext("2d");
573
+ const N = I.current;
579
574
  if (!N)
580
575
  return;
576
+ const w = N.getContext("2d");
577
+ if (!w)
578
+ return;
581
579
  const p = f.current;
582
580
  if (p.width <= 0 || p.viewportHeight <= 0) {
583
- N.clearRect(0, 0, g.width, g.height);
581
+ w.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 = (() => {
584
+ const T = Number.isFinite(p.devicePixelRatio ?? NaN) ? p.devicePixelRatio : typeof window < "u" && window.devicePixelRatio || 1;
585
+ Nr(N, p.width, p.viewportHeight, T);
586
+ const R = p.segmentsByItem.length, L = typeof p.renderStartIndex == "number" && Number.isFinite(p.renderStartIndex) ? Math.max(0, Math.floor(p.renderStartIndex)) : Math.max(0, Math.floor(p.scrollPosition / p.itemHeight)), V = Math.min(R, Math.ceil((p.scrollPosition + p.viewportHeight) / p.itemHeight)), C = (() => {
589
587
  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);
588
+ const Z = Math.floor(p.renderEndIndex);
589
+ return Math.max(Math.min(R, Z + 1), L);
592
590
  }
593
- return Math.max(I, D);
594
- })(), H = (() => {
591
+ return Math.max(V, L);
592
+ })(), B = (() => {
595
593
  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);
594
+ const Z = Math.floor(p.lookaheadEndIndex), U = Math.min(R, Z + 1);
595
+ return Math.max(U, C);
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(() => {
597
+ return Math.max(V, C);
598
+ })(), F = wr(p.segmentsByItem, L, B), H = kr(p.glyphsByItem, L, B);
599
+ w.save(), w.scale(T, T), w.clearRect(0, 0, p.width, p.viewportHeight), w.translate(0, -p.scrollPosition), w.strokeStyle = p.color, Er(w, F, p.strokeWidth), Sr(w, H, p.expandGlyphColor ?? p.color, p.expandGlyphSize), w.restore();
600
+ }, []), D = W(() => {
603
601
  u.current === null && (u.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
612
  strokeWidth: d,
615
- renderStartIndex: w,
613
+ renderStartIndex: g,
616
614
  renderEndIndex: x,
617
615
  lookaheadEndIndex: c,
618
- devicePixelRatio: h,
616
+ devicePixelRatio: y,
619
617
  expandGlyphColor: b,
620
618
  expandGlyphSize: k
621
- }, O();
622
- }, [e, t, a, n, r, o, l, d, w, x, c, h, b, k, O]), ce(() => () => {
619
+ }, D();
620
+ }, [e, t, a, s, r, o, l, d, g, x, c, y, b, k, D]), de(() => () => {
623
621
  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" });
622
+ }, []), /* @__PURE__ */ i.jsx("canvas", { ref: I, className: "pointer-events-none absolute top-0 left-0 z-0" });
625
623
  });
626
- Gt.displayName = "TreeLineCanvas";
624
+ Vt.displayName = "TreeLineCanvas";
627
625
  const jr = {
628
626
  msOverflowStyle: "none",
629
627
  scrollbarWidth: "none"
630
628
  }, Tr = () => {
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) => {
631
+ }, Rr = (e, t, a, s) => {
634
632
  const r = [], o = [];
635
633
  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({
634
+ const d = (g, x, c) => {
635
+ for (let y = 0; y < g.length; y++) {
636
+ const b = g[y], k = y === g.length - 1, I = [...c, k], u = b.children !== void 0, f = u && t(b.absolutePath, b.relativePath);
637
+ let v = x, D = I, N = c;
638
+ s && (v = x - 1, D = I.slice(1), N = c.slice(1)), r.push({ entry: b, indentLevel: v, parentIsLast: D }), a && (v > l && (l = v), o.push({
641
639
  id: b.absolutePath,
642
640
  name: b.name,
643
641
  absolutePath: b.absolutePath,
@@ -645,191 +643,196 @@ const jr = {
645
643
  isLastChild: k,
646
644
  isDirectory: u,
647
645
  isExpanded: f,
648
- ancestorIsLast: [...g],
649
- hideLines: n && x === 0
650
- })), u && f && b.children && d(b.children, x + 1, S);
646
+ ancestorIsLast: [...N],
647
+ hideLines: s && x === 0
648
+ })), u && f && b.children && d(b.children, x + 1, I);
651
649
  }
652
650
  };
653
651
  return d(e, 0, []), { flatItems: r, lineItems: o, maxIndent: l };
654
652
  }, Ot = (e, t) => {
655
653
  const a = e.length - 1;
656
654
  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;
655
+ let s = 0, r = a - 1, o = 0;
656
+ for (; s <= r; ) {
657
+ const l = s + r >>> 1;
658
+ e[l] <= t ? (o = l, s = l + 1) : r = l - 1;
661
659
  }
662
660
  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;
661
+ }, Cr = (e, t, a, s, r, o) => {
662
+ const l = s?.renderStart ?? Math.max(0, Ot(o, r)), d = t > 0 ? Ot(o, r + t) + a : l + a, g = e > 0 ? Math.min(e - 1, Math.max(l, d)) : l, x = s?.renderEnd ?? g, c = e > 0 ? Math.min(e - 1, x + a) : x;
665
663
  return { renderStart: l, renderEnd: x, lookaheadEnd: c };
666
- }, _r = (e, t, a, n, r, o) => {
664
+ }, _r = (e, t, a, s, r, o) => {
667
665
  if (e.length === 0)
668
666
  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;
667
+ const l = Array.from({ length: e.length }, () => []), d = Array.from({ length: e.length }, () => []), g = (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
668
  for (let c = 0; c < e.length; c++) {
671
- const h = e[c];
672
- if (h.hideLines)
669
+ const y = e[c];
670
+ if (y.hideLines)
673
671
  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)
672
+ const b = [], k = t[c] ?? 0, I = a[c] ?? 0, u = I + k / 2, f = g(k), v = f > 0 ? f / 2 + 2 : s / 1.5;
673
+ for (let w = 0; w < y.indentLevel; w++) {
674
+ if (y.ancestorIsLast[w] ?? !1)
677
675
  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;
676
+ let T = !1;
677
+ for (let R = c; R < e.length; R++) {
678
+ const L = e[R];
679
+ if (L.indentLevel > w && L.ancestorIsLast.length > w && !L.ancestorIsLast[w]) {
680
+ T = !0;
683
681
  break;
684
682
  }
685
- if ($ > c && D.indentLevel === N)
683
+ if (R > c && L.indentLevel === w)
686
684
  break;
687
685
  }
688
- if (R) {
689
- const $ = N * n + n / 2 + x;
686
+ if (T) {
687
+ const R = w * s + s / 2 + x;
690
688
  b.push({
691
- key: `${h.id}-ancestor-${N}`,
692
- x1: $,
693
- y1: S,
694
- x2: $,
695
- y2: S + k,
689
+ key: `${y.id}-ancestor-${w}`,
690
+ x1: R,
691
+ y1: I,
692
+ x2: R,
693
+ y2: I + k,
696
694
  itemIndex: c
697
695
  });
698
696
  }
699
697
  }
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,
698
+ const D = y.indentLevel * s, N = D + s / 2 + x;
699
+ if (y.isDirectory ? b.push({
700
+ key: `${y.id}-connector-top`,
701
+ x1: N,
702
+ y1: I,
703
+ x2: N,
706
704
  y2: u - v,
707
705
  itemIndex: c
708
706
  }) : b.push({
709
- key: `${h.id}-connector-top`,
710
- x1: g,
711
- y1: S,
712
- x2: g,
707
+ key: `${y.id}-connector-top`,
708
+ x1: N,
709
+ y1: I,
710
+ x2: N,
713
711
  y2: u,
714
712
  itemIndex: c
715
- }), !h.isDirectory && h.isLastChild && b.push({
716
- key: `${h.id}-connector-horizontal`,
717
- x1: g,
713
+ }), !y.isDirectory && y.isLastChild && b.push({
714
+ key: `${y.id}-connector-horizontal`,
715
+ x1: N,
718
716
  y1: u,
719
- x2: O + n + x,
717
+ x2: D + s + x,
720
718
  y2: u,
721
719
  itemIndex: c
722
- }), h.isLastChild || (h.isDirectory ? b.push({
723
- key: `${h.id}-connector-bottom`,
724
- x1: g,
720
+ }), y.isLastChild || (y.isDirectory ? b.push({
721
+ key: `${y.id}-connector-bottom`,
722
+ x1: N,
725
723
  y1: u + v,
726
- x2: g,
727
- y2: S + k,
724
+ x2: N,
725
+ y2: I + k,
728
726
  itemIndex: c
729
727
  }) : b.push({
730
- key: `${h.id}-connector-bottom`,
731
- x1: g,
728
+ key: `${y.id}-connector-bottom`,
729
+ x1: N,
732
730
  y1: u,
733
- x2: g,
734
- y2: S + k,
731
+ x2: N,
732
+ y2: I + k,
735
733
  itemIndex: c
736
- })), l[c] = b, r && h.isDirectory) {
737
- const N = f, p = g, R = u;
734
+ })), l[c] = b, r && y.isDirectory) {
735
+ const w = f, p = N, T = u;
738
736
  d[c] = [
739
737
  {
740
- key: `${h.id}-glyph`,
738
+ key: `${y.id}-glyph`,
741
739
  itemIndex: c,
742
740
  centerX: p,
743
- centerY: R,
744
- size: N,
745
- isExpanded: h.isExpanded
741
+ centerY: T,
742
+ size: w,
743
+ isExpanded: y.isExpanded
746
744
  }
747
745
  ];
748
746
  }
749
747
  }
750
748
  return { segmentsByItem: l, glyphsByItem: d };
751
- }, ze = Ye(
749
+ }, Xe = ze(
752
750
  ({
753
751
  entry: e,
754
752
  indentLevel: t,
755
753
  rowHeight: a,
756
- isDirOpen: n,
754
+ isDirOpen: s,
757
755
  parentIsLast: r,
758
756
  renderChildren: o = !0,
759
757
  expansion: { toggleDirectory: l, onToggleDirectoryRecursive: d },
760
- selection: { onEntryClick: w, selectedPath: x, mode: c = "none", selectedItems: h, onSelectionChange: b },
758
+ selection: { onEntryClick: g, selectedPath: x, mode: c = "none", selectedItems: y, onSelectionChange: b },
761
759
  visual: {
762
760
  iconOverrides: k,
763
- showExpandIcons: S = !0,
761
+ showExpandIcons: I = !0,
764
762
  showDirectoryIcons: u = !0,
765
763
  showFileIcons: f = !0,
766
764
  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
765
+ expandIconSize: D,
766
+ typeIconSize: N,
767
+ fontSize: w,
768
+ indentSize: p = Oe,
769
+ highlightStyles: T,
770
+ entryClassName: R,
771
+ entryStyle: L,
772
+ nameClassName: V,
773
+ nameStyle: C,
774
+ directoryNameClassName: B,
775
+ directoryNameStyle: F,
776
+ fileNameClassName: H,
777
+ fileNameStyle: Z
777
778
  }
778
779
  }) => {
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);
780
+ const [U, ae] = se(null), [oe, A] = se(!1), E = e.children !== void 0, Y = E && s(e.absolutePath), n = e.absolutePath === x, h = !E && y?.has(e.absolutePath), S = E ? void 0 : xe(e.name) || xe(e.relativePath) || xe(e.absolutePath);
781
+ de(() => {
782
+ ae(Y && e.children ? e.children : null);
783
+ }, [Y, e.children]);
784
+ const _ = Ft({ entry: e, isDirectory: E, isExpanded: Y, isItemSelected: !!h, selectionMode: c, onSelectionChange: b, onEntryClick: g, toggleDirectory: l, onToggleDirectoryRecursive: d }), ee = oe ? T?.hoverClassName !== void 0 ? T.hoverClassName : O.entryHover : "", Q = (() => {
785
+ if (E) {
786
+ if (n)
787
+ return T?.directorySelectedClassName !== void 0 ? T.directorySelectedClassName : O.entrySelected;
788
+ } else if (n || h)
789
+ return T?.itemSelectedClassName !== void 0 ? T.itemSelectedClassName : M(n && O.entrySelected, h && O.entryItemSelected);
789
790
  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
- };
791
+ })(), P = M(O.entry, ee, Q, R, e.className), K = M(O.expandIcon, (n || h) && O.expandIconSelected), te = M(O.typeIcon, (n || h) && O.typeIconSelected), G = M(O.name, V, E && O.nameDirectory, E && B, !E && H, (n || h) && O.nameSelected), Se = Dt({ isDirectory: E, isExpanded: Y, showExpandIcons: I, useCanvasExpandIcons: v, expandIconSize: D }), De = (E ? u : f) ? Lt({ entry: e, isDirectory: E, isExpanded: Y, isSelected: n, isItemSelected: !!h, extension: S, mimeType: e.mimeType }, k) : null, ve = {
792
+ ...oe ? T?.hoverStyle : {},
793
+ ...E && n ? T?.directorySelectedStyle : {},
794
+ ...!E && (n || h) ? T?.itemSelectedStyle : {}
795
+ }, je = N ? { width: N, height: N } : void 0, Ne = w ? { fontSize: typeof w == "number" ? `${w}px` : w } : void 0;
795
796
  return /* @__PURE__ */ i.jsxs(Kt, { children: [
796
797
  /* @__PURE__ */ i.jsxs(
797
798
  "div",
798
799
  {
799
- className: _,
800
+ className: P,
800
801
  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,
802
+ paddingLeft: `${Math.max(0, t * p)}px`,
803
+ transform: t < 0 ? `translateX(${t * p}px)` : void 0,
804
+ width: t < 0 ? `calc(100% + ${Math.abs(t * p)}px)` : void 0,
804
805
  height: `${a}px`,
805
- ...pe,
806
- ...p,
806
+ ...Ne,
807
+ ...ve,
808
+ ...L,
807
809
  ...e.style
808
810
  },
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),
811
+ "data-entry-type": E ? "directory" : "file",
812
+ "data-entry-expanded": E ? String(Y) : void 0,
813
+ "data-entry-selected": n ? "true" : void 0,
814
+ "data-entry-item-selected": h ? "true" : void 0,
815
+ onClick: _,
816
+ onMouseEnter: () => A(!0),
817
+ onMouseLeave: () => A(!1),
818
+ onKeyDown: (ue) => ue.key === "Enter" && _(ue),
817
819
  tabIndex: 0,
818
820
  role: "treeitem",
819
- "aria-expanded": C ? G : void 0,
820
- "aria-label": `${e.name} (${C ? "directory" : "file"})`,
821
+ "aria-expanded": E ? Y : void 0,
822
+ "aria-label": `${e.name} (${E ? "directory" : "file"})`,
821
823
  children: [
822
- (S || v) && /* @__PURE__ */ i.jsx("span", { className: Q, children: ee }),
823
- (C ? u : f) && /* @__PURE__ */ i.jsx("span", { className: K, children: Y }),
824
+ (I || v) && /* @__PURE__ */ i.jsx("span", { className: K, children: Se }),
825
+ (E ? u : f) && /* @__PURE__ */ i.jsx("span", { className: te, style: je, children: De }),
824
826
  /* @__PURE__ */ i.jsx(
825
827
  "span",
826
828
  {
827
- className: P,
829
+ className: G,
828
830
  style: {
829
- ...$,
830
- ...C ? I : H
831
+ ...Ne,
832
+ ...C,
833
+ ...E ? F : Z
831
834
  },
832
- "data-entry-type": C ? "directory" : "file",
835
+ "data-entry-type": E ? "directory" : "file",
833
836
  "data-entry-role": "name",
834
837
  children: e.label ?? e.name
835
838
  }
@@ -837,172 +840,172 @@ const jr = {
837
840
  ]
838
841
  }
839
842
  ),
840
- G && L && o && /* @__PURE__ */ i.jsx("fieldset", { children: L.map((de, Pe) => /* @__PURE__ */ i.jsx(
841
- ze,
843
+ Y && U && o && /* @__PURE__ */ i.jsx("fieldset", { children: U.map((ue, Te) => /* @__PURE__ */ i.jsx(
844
+ Xe,
842
845
  {
843
- entry: de,
846
+ entry: ue,
844
847
  indentLevel: t + 1,
845
848
  rowHeight: a,
846
- isDirOpen: n,
847
- parentIsLast: [...r, Pe === L.length - 1],
849
+ isDirOpen: s,
850
+ parentIsLast: [...r, Te === U.length - 1],
848
851
  expansion: { toggleDirectory: l, onToggleDirectoryRecursive: d },
849
- selection: { onEntryClick: w, selectedPath: x, mode: c, selectedItems: h, onSelectionChange: b },
852
+ selection: { onEntryClick: g, selectedPath: x, mode: c, selectedItems: y, onSelectionChange: b },
850
853
  visual: {
851
854
  iconOverrides: k,
852
- showExpandIcons: S,
855
+ showExpandIcons: I,
853
856
  showDirectoryIcons: u,
854
857
  showFileIcons: f,
855
858
  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
859
+ expandIconSize: D,
860
+ highlightStyles: T,
861
+ entryClassName: R,
862
+ entryStyle: L,
863
+ nameClassName: V,
864
+ nameStyle: C,
865
+ directoryNameClassName: B,
866
+ directoryNameStyle: F,
867
+ fileNameClassName: H,
868
+ fileNameStyle: Z
866
869
  }
867
870
  },
868
- de.absolutePath
871
+ ue.absolutePath
869
872
  )) })
870
873
  ] }, e.absolutePath);
871
874
  },
872
875
  (e, t) => {
873
876
  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);
877
+ 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);
875
878
  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]);
876
879
  }
877
880
  );
878
- ze.displayName = "DirectoryEntryItem";
879
- const Vt = (e) => {
881
+ Xe.displayName = "DirectoryEntryItem";
882
+ const Ut = (e) => {
880
883
  const t = [];
881
884
  if (e.children)
882
885
  for (const a of e.children)
883
- a.type === "directory" && (t.push(a.absolutePath), t.push(...Vt(a)));
886
+ a.type === "directory" && (t.push(a.absolutePath), t.push(...Ut(a)));
884
887
  return t;
885
888
  }, Lr = ({
886
889
  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 },
890
+ expansion: { toggle: t, isExpanded: a, expandMultiple: s, collapseMultiple: r, isPending: o, alwaysExpanded: l = !1, doubleClickAction: d = "recursive" },
891
+ selection: { onEntryClick: g, selectedPath: x, mode: c = "none", selectedItems: y, onSelectionChange: b },
889
892
  visual: {
890
893
  className: k,
891
- style: S,
894
+ style: I,
892
895
  lineColor: u = "#A0AEC0",
893
896
  showTreeLines: f = !0,
894
897
  showExpandIcons: v = !0,
895
- showDirectoryIcons: O = !0,
896
- showFileIcons: g = !0,
897
- iconOverrides: N,
898
+ showDirectoryIcons: D = !0,
899
+ showFileIcons: N = !0,
900
+ iconOverrides: w,
898
901
  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
902
+ itemHeight: T = Ae,
903
+ removeRootIndent: R = !1,
904
+ highlightStyles: L,
905
+ entryClassName: V,
906
+ entryStyle: C,
907
+ nameClassName: B,
908
+ nameStyle: F,
909
+ directoryNameClassName: H,
910
+ directoryNameStyle: Z,
911
+ fileNameClassName: U,
912
+ fileNameStyle: ae
910
913
  } = {},
911
- virtualScroll: G,
912
- grid: E
914
+ virtualScroll: oe,
915
+ grid: A
913
916
  }) => {
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,
917
+ const E = A !== void 0, [Y, n] = se(!1), h = ce(null), S = ce(null), _ = ce(null), [ee, Q] = se(0), [P, K] = se(0), [te, G] = se(0), [Se, De] = se(null), {
918
+ overscanCount: ve = 15,
919
+ className: je,
920
+ background: Ne,
921
+ onScroll: ue,
922
+ onRangeChange: Te,
920
923
  initialScrollIndex: Je,
921
- initialScrollOffset: oe,
924
+ initialScrollOffset: le,
922
925
  callbackThrottleMs: qe = 5,
923
- contentInsets: ve,
926
+ contentInsets: be,
924
927
  onItemFocus: Ze,
925
928
  viewportHeightOverride: ne,
926
- scrollBarOptions: Me,
929
+ scrollBarOptions: Le,
927
930
  behaviorOptions: Qe,
928
931
  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);
932
+ } = oe ?? {}, [Re, Fe] = se(typeof le == "number" ? le : 0), $e = ce(typeof le == "number" ? le : 0), et = W(
933
+ (m, j) => {
934
+ $e.current = m, Fe(m), ue?.(m, j);
932
935
  },
933
- [Ue]
934
- ), tt = B(
936
+ [ue]
937
+ ), tt = W(
935
938
  (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
+ const { renderingStartIndex: j, renderingEndIndex: $ } = m;
940
+ De((X) => X && X.renderStart === j && X.renderEnd === $ ? X : { renderStart: j, renderEnd: $ }), Te?.(m);
938
941
  },
939
- [Xe]
942
+ [Te]
940
943
  );
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 = () => {
944
+ de(() => {
945
+ typeof le == "number" && Fe(le);
946
+ }, [le]), de(() => {
947
+ n(!0), Tr();
948
+ }, []), de(() => {
949
+ const m = h.current, j = E ? S.current : m, $ = () => {
947
950
  if (m) {
948
951
  const re = m.clientWidth;
949
- ee((le) => Math.abs(le - re) > 1 ? re : le);
952
+ K((ie) => Math.abs(ie - re) > 1 ? re : ie);
950
953
  }
951
954
  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);
955
+ Q((re) => Math.abs(re - ne) > 1 ? ne : re);
956
+ else if (j) {
957
+ const re = j.clientHeight;
958
+ Q((ie) => Math.abs(ie - re) > 1 ? re : ie);
956
959
  }
957
960
  };
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(
961
+ if (!(m || j)) return Q(0);
962
+ $();
963
+ const X = new ResizeObserver($);
964
+ return m && X.observe(m), j && j !== m && X.observe(j), () => X.disconnect();
965
+ }, [ne, E]);
966
+ const me = typeof ne == "number" ? ne : ee, fe = W((m) => l || (Y ? a(m) : !1), [Y, a, l]), rt = M(O.container, o && O.containerPending, k), nt = q(
964
967
  () => ({
965
968
  ...jr,
966
- ...S ?? {},
969
+ ...I ?? {},
967
970
  ...typeof ne == "number" ? { height: ne, minHeight: ne } : {}
968
971
  }),
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.`);
972
+ [I, ne]
973
+ ), He = W(
974
+ (m, j) => {
975
+ const $ = [m.absolutePath, ...Ut(m)], X = j || d;
976
+ if ($.every((ke) => fe(ke))) return r($);
977
+ if ($.every((ke) => !fe(ke)) || X === "recursive") return s($);
978
+ if (X === "toggle") return r($);
979
+ console.warn(`[DirectoryTree] Unknown double click action: ${X}. No action taken.`);
977
980
  },
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 };
981
+ [fe, s, r, d]
982
+ ), st = E ? !1 : R, { flatItems: at, lineItems: We, maxIndent: ot } = q(() => Rr(e, fe, f, st), [e, fe, f, st]), J = q(
983
+ () => at.map((m, j) => {
984
+ const $ = typeof T == "function" ? T(m.entry, j) : T;
985
+ return { ...m, rowHeight: Number.isFinite($) && $ > 0 ? $ : Ae };
983
986
  }),
984
- [at, R]
985
- ), fe = q(() => J.map((m) => m.rowHeight), [J]), ye = q(() => {
986
- const m = new Array(fe.length + 1);
987
+ [at, T]
988
+ ), he = q(() => J.map((m) => m.rowHeight), [J]), ye = q(() => {
989
+ const m = new Array(he.length + 1);
987
990
  m[0] = 0;
988
- for (let T = 0; T < fe.length; T++)
989
- m[T + 1] = m[T] + fe[T];
991
+ for (let j = 0; j < he.length; j++)
992
+ m[j + 1] = m[j] + he[j];
990
993
  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,
994
+ }, [he]), lt = W((m) => J[m]?.rowHeight ?? Ae, [J]), Ce = q(
995
+ () => !f || We.length === 0 ? { segmentsByItem: [], glyphsByItem: [] } : _r(We, he, ye, Oe, f, p ?? Pt),
996
+ [We, he, ye, f, p]
997
+ ), _e = q(() => !f || e.length === 0 ? 0 : (ot + 2) * Oe, [e.length, ot, f]), { renderStart: it, renderEnd: ct, lookaheadEnd: dt } = q(
998
+ () => Cr(J.length, me, ve, Se, Re, ye),
999
+ [J.length, me, ve, Se, Re, ye]
1000
+ ), Be = q(() => !f || _e <= 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: _e, height: me }, children: /* @__PURE__ */ i.jsx(
1001
+ Vt,
999
1002
  {
1000
- segmentsByItem: je.segmentsByItem,
1001
- glyphsByItem: je.glyphsByItem,
1002
- itemHeight: fe[0] ?? _e,
1003
- width: Te,
1004
- viewportHeight: ue,
1005
- scrollPosition: Ie,
1003
+ segmentsByItem: Ce.segmentsByItem,
1004
+ glyphsByItem: Ce.glyphsByItem,
1005
+ itemHeight: he[0] ?? Ae,
1006
+ width: _e,
1007
+ viewportHeight: me,
1008
+ scrollPosition: Re,
1006
1009
  color: u,
1007
1010
  expandGlyphColor: u,
1008
1011
  expandGlyphSize: p ?? Pt,
@@ -1010,30 +1013,30 @@ const Vt = (e) => {
1010
1013
  renderEndIndex: ct,
1011
1014
  lookaheadEndIndex: dt
1012
1015
  }
1013
- ) }) }), [Te, ue, it, ct, dt, Ie, je, u, f, p, fe]), ut = B((m) => J[m], [J]), mt = ie(null);
1016
+ ) }) }), [_e, me, it, ct, dt, Re, Ce, u, f, p, he]), ut = W((m) => J[m], [J]), mt = ce(null);
1014
1017
  Qt(() => {
1015
1018
  const m = mt.current;
1016
1019
  if (mt.current = { items: J, offsets: ye }, !Ke || !m || m.items === J)
1017
1020
  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)
1021
+ const j = _.current, $ = typeof be == "number" ? be : be?.top ?? 0, X = j ? j.getScrollPosition() : $e.current, re = X - $, ie = br(m.items, m.offsets, re);
1022
+ if (!ie)
1020
1023
  return;
1021
- const we = gr(le, J, ye);
1022
- if (we === null)
1024
+ const ke = gr(ie, J, ye);
1025
+ if (ke === null)
1023
1026
  return;
1024
- const $e = we + W;
1025
- if (Math.abs($e - U) < 1)
1027
+ const Ye = ke + $;
1028
+ if (Math.abs(Ye - X) < 1)
1026
1029
  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]
1030
+ const yt = j?.scrollTo(Ye) ?? Ye;
1031
+ $e.current = yt, Fe(yt);
1032
+ }, [J, ye, Ke, be]);
1033
+ const pe = A?.columns, ge = A?.scrollBarWidth ?? Le?.width ?? Gt, z = q(() => pe ? yr({ measuredWidth: P, columns: pe, scrollBarWidth: ge }) : null, [pe, P, ge]), Pe = q(() => pe ? pr(pe) : "", [pe]), zt = q(() => A?.showFooter && pe ? xr(e) : [], [A?.showFooter, pe, e]), we = z?.maxHScroll ?? 0;
1034
+ de(() => {
1035
+ G((m) => Ge(m, we));
1036
+ }, [we]);
1037
+ const ft = W((m) => G((j) => Ge(j + m, we)), [we]), ht = q(
1038
+ () => ({ iconOverrides: w, showExpandIcons: v, showDirectoryIcons: D, showFileIcons: N, useCanvasExpandIcons: f, expandIconSize: p, highlightStyles: L }),
1039
+ [w, v, D, N, f, p, L]
1037
1040
  ), pt = q(
1038
1041
  () => /* @__PURE__ */ i.jsx(
1039
1042
  tr,
@@ -1042,70 +1045,70 @@ const Vt = (e) => {
1042
1045
  itemCount: J.length,
1043
1046
  getItem: ut,
1044
1047
  getItemHeight: lt,
1045
- viewportSize: ue,
1046
- overscanCount: Se,
1048
+ viewportSize: me,
1049
+ overscanCount: ve,
1047
1050
  onScroll: et,
1048
1051
  onRangeChange: tt,
1049
- className: Ge,
1050
- onWheelHorizontal: F ? ft : void 0,
1052
+ className: je,
1053
+ onWheelHorizontal: E ? ft : void 0,
1051
1054
  background: /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
1052
- F && V ? (
1055
+ E && z ? (
1053
1056
  // 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
1057
+ /* @__PURE__ */ i.jsx("div", { className: "pointer-events-none absolute top-0 left-0 z-0 h-full overflow-hidden", style: { width: z.nameWidth }, "aria-hidden": "true", children: Be })
1058
+ ) : Be,
1059
+ Ne
1057
1060
  ] }),
1058
1061
  initialScrollIndex: Je,
1059
- initialScrollOffset: oe,
1062
+ initialScrollOffset: le,
1060
1063
  onItemFocus: Ze,
1061
1064
  callbackThrottleMs: qe,
1062
- contentInsets: ve,
1063
- scrollBarOptions: Me,
1065
+ contentInsets: be,
1066
+ scrollBarOptions: Le,
1064
1067
  behaviorOptions: Qe,
1065
- children: (m) => m ? F && E && V ? /* @__PURE__ */ i.jsx(
1068
+ children: (m) => m ? E && A && z ? /* @__PURE__ */ i.jsx(
1066
1069
  Wt,
1067
1070
  {
1068
1071
  entry: m.entry,
1069
1072
  indentLevel: m.indentLevel,
1070
1073
  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 },
1074
+ isDirOpen: fe,
1075
+ columns: A.columns,
1076
+ numericTemplate: Pe,
1077
+ numericTotal: z.numericTotal,
1078
+ nameWidth: z.nameWidth,
1079
+ rowClassName: A.rowClassName,
1080
+ selection: { onEntryClick: g, selectedPath: x ?? null, mode: c, selectedItems: y, onSelectionChange: b },
1081
+ expansion: { toggleDirectory: t, onToggleDirectoryRecursive: He },
1079
1082
  visual: ht
1080
1083
  },
1081
1084
  m.entry.absolutePath
1082
1085
  ) : /* @__PURE__ */ i.jsx(
1083
- ze,
1086
+ Xe,
1084
1087
  {
1085
1088
  entry: m.entry,
1086
1089
  indentLevel: m.indentLevel,
1087
1090
  rowHeight: m.rowHeight,
1088
- isDirOpen: me,
1091
+ isDirOpen: fe,
1089
1092
  parentIsLast: m.parentIsLast,
1090
1093
  renderChildren: !1,
1091
- expansion: { toggleDirectory: t, onToggleDirectoryRecursive: De },
1092
- selection: { onEntryClick: w, selectedPath: x ?? null, mode: c, selectedItems: h, onSelectionChange: b },
1094
+ expansion: { toggleDirectory: t, onToggleDirectoryRecursive: He },
1095
+ selection: { onEntryClick: g, selectedPath: x ?? null, mode: c, selectedItems: y, onSelectionChange: b },
1093
1096
  visual: {
1094
- iconOverrides: N,
1097
+ iconOverrides: w,
1095
1098
  showExpandIcons: v,
1096
- showDirectoryIcons: O,
1097
- showFileIcons: g,
1099
+ showDirectoryIcons: D,
1100
+ showFileIcons: N,
1098
1101
  useCanvasExpandIcons: f,
1099
1102
  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
1103
+ highlightStyles: L,
1104
+ entryClassName: V,
1105
+ entryStyle: C,
1106
+ nameClassName: B,
1107
+ nameStyle: F,
1108
+ directoryNameClassName: H,
1109
+ directoryNameStyle: Z,
1110
+ fileNameClassName: U,
1111
+ fileNameStyle: ae
1109
1112
  }
1110
1113
  },
1111
1114
  m.entry.absolutePath
@@ -1116,79 +1119,79 @@ const Vt = (e) => {
1116
1119
  J.length,
1117
1120
  ut,
1118
1121
  lt,
1119
- ue,
1120
- Se,
1122
+ me,
1123
+ ve,
1121
1124
  et,
1122
1125
  tt,
1123
- Ge,
1124
- F,
1126
+ je,
1127
+ E,
1125
1128
  ft,
1126
- V,
1127
- Fe,
1128
- Ve,
1129
+ z,
1130
+ Be,
1131
+ Ne,
1129
1132
  Je,
1130
- oe,
1133
+ le,
1131
1134
  Ze,
1132
1135
  qe,
1133
- ve,
1134
- Me,
1136
+ be,
1137
+ Le,
1135
1138
  Qe,
1136
- E,
1137
- Re,
1138
- me,
1139
- w,
1139
+ A,
1140
+ Pe,
1141
+ fe,
1142
+ g,
1140
1143
  x,
1141
1144
  c,
1142
- h,
1145
+ y,
1143
1146
  b,
1144
1147
  t,
1145
- De,
1148
+ He,
1146
1149
  ht,
1147
- N,
1150
+ w,
1148
1151
  v,
1149
- O,
1150
- g,
1152
+ D,
1153
+ N,
1151
1154
  f,
1152
1155
  p,
1153
- D,
1154
- I,
1155
- z,
1156
- H,
1157
1156
  L,
1158
- te,
1159
- X,
1157
+ V,
1158
+ C,
1159
+ B,
1160
+ F,
1161
+ H,
1160
1162
  Z,
1161
- C
1163
+ U,
1164
+ ae
1162
1165
  ]
1163
1166
  );
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" }),
1167
+ if (!(A && z))
1168
+ return /* @__PURE__ */ i.jsx("div", { ref: h, className: rt, style: nt, role: "tree", children: pt });
1169
+ const Xt = A.showHeader ?? !0, Jt = A.showFooter ?? !1, qt = { ...nt, "--dt-hscroll": `${te}px` };
1170
+ return /* @__PURE__ */ i.jsxs("div", { ref: h, className: M(rt, "dt-grid"), style: qt, role: "treegrid", children: [
1171
+ Xt && /* @__PURE__ */ i.jsx(mr, { columns: A.columns, numericTemplate: Pe, numericTotal: z.numericTotal, nameWidth: z.nameWidth, scrollBarWidth: ge, className: A.headerClassName }),
1172
+ /* @__PURE__ */ i.jsx("div", { ref: S, className: "dt-grid-body", children: pt }),
1173
+ we > 0 && /* @__PURE__ */ i.jsxs("div", { className: "dt-grid-hscrollbar-row", children: [
1174
+ /* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: z.nameWidth }, "aria-hidden": "true" }),
1172
1175
  /* @__PURE__ */ i.jsx(
1173
1176
  rr,
1174
1177
  {
1175
1178
  horizontal: !0,
1176
- contentSize: V.numericTotal,
1177
- viewportSize: V.numericVisible,
1178
- scrollPosition: Y,
1179
- scrollBarWidth: be,
1179
+ contentSize: z.numericTotal,
1180
+ viewportSize: z.numericVisible,
1181
+ scrollPosition: te,
1182
+ scrollBarWidth: ge,
1180
1183
  onScroll: (m) => {
1181
- const T = typeof m == "function" ? m(Y) : m, W = He(T, ge);
1182
- return pe(W), W;
1184
+ const j = typeof m == "function" ? m(te) : m, $ = Ge(j, we);
1185
+ return G($), $;
1183
1186
  }
1184
1187
  }
1185
1188
  ),
1186
- /* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: be }, "aria-hidden": "true" })
1189
+ /* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: ge }, "aria-hidden": "true" })
1187
1190
  ] }),
1188
- Jt && /* @__PURE__ */ i.jsx(fr, { columns: E.columns, numericTemplate: Re, numericTotal: V.numericTotal, nameWidth: V.nameWidth, scrollBarWidth: be, allEntries: Ut, className: E.footerClassName })
1191
+ Jt && /* @__PURE__ */ i.jsx(fr, { columns: A.columns, numericTemplate: Pe, numericTotal: z.numericTotal, nameWidth: z.nameWidth, scrollBarWidth: ge, allEntries: zt, className: A.footerClassName })
1189
1192
  ] });
1190
1193
  }, Fr = ({ initialExpanded: e = /* @__PURE__ */ new Set(), storageKey: t } = {}) => {
1191
- const [a, n] = er(), [r, o] = se(() => {
1194
+ const [a, s] = er(), [r, o] = se(() => {
1192
1195
  if (typeof window < "u" && t)
1193
1196
  try {
1194
1197
  const u = window.localStorage.getItem(t);
@@ -1200,23 +1203,23 @@ const Vt = (e) => {
1200
1203
  console.error("[useDirectoryTreeState] Error reading from localStorage", u);
1201
1204
  }
1202
1205
  return e;
1203
- }), l = B((u) => {
1204
- n(() => {
1206
+ }), l = W((u) => {
1207
+ s(() => {
1205
1208
  o((f) => {
1206
1209
  const v = new Set(f);
1207
1210
  return u(v), v;
1208
1211
  });
1209
1212
  });
1210
- }, []), d = B(
1213
+ }, []), d = W(
1211
1214
  (u, f) => {
1212
1215
  l((v) => {
1213
- for (const O of u)
1214
- f(v, O);
1216
+ for (const D of u)
1217
+ f(v, D);
1215
1218
  });
1216
1219
  },
1217
1220
  [l]
1218
1221
  );
1219
- ce(() => {
1222
+ de(() => {
1220
1223
  if (t && typeof window < "u")
1221
1224
  try {
1222
1225
  window.localStorage.setItem(t, JSON.stringify(Array.from(r)));
@@ -1224,60 +1227,60 @@ const Vt = (e) => {
1224
1227
  console.warn(`Error setting localStorage key "${t}":`, u);
1225
1228
  }
1226
1229
  }, [r, t]);
1227
- const w = B(
1230
+ const g = W(
1228
1231
  (u) => {
1229
1232
  d([u], (f, v) => {
1230
1233
  f.has(v) ? f.delete(v) : f.add(v);
1231
1234
  });
1232
1235
  },
1233
1236
  [d]
1234
- ), x = B(
1237
+ ), x = W(
1235
1238
  (u) => {
1236
1239
  d([u], (f, v) => {
1237
1240
  f.add(v);
1238
1241
  });
1239
1242
  },
1240
1243
  [d]
1241
- ), c = B(
1244
+ ), c = W(
1242
1245
  (u) => {
1243
1246
  d([u], (f, v) => {
1244
1247
  f.delete(v);
1245
1248
  });
1246
1249
  },
1247
1250
  [d]
1248
- ), h = B(
1251
+ ), y = W(
1249
1252
  (u) => {
1250
1253
  d(u, (f, v) => {
1251
1254
  f.delete(v);
1252
1255
  });
1253
1256
  },
1254
1257
  [d]
1255
- ), b = B(
1258
+ ), b = W(
1256
1259
  (u) => {
1257
1260
  d(u, (f, v) => {
1258
1261
  f.add(v);
1259
1262
  });
1260
1263
  },
1261
1264
  [d]
1262
- ), k = B(() => {
1265
+ ), k = W(() => {
1263
1266
  l((u) => {
1264
1267
  u.clear();
1265
1268
  });
1266
- }, [l]), S = B((u) => r.has(u), [r]);
1269
+ }, [l]), I = W((u) => r.has(u), [r]);
1267
1270
  return {
1268
1271
  expanded: r,
1269
- toggle: w,
1272
+ toggle: g,
1270
1273
  expand: x,
1271
1274
  collapse: c,
1272
- collapseMultiple: h,
1275
+ collapseMultiple: y,
1273
1276
  expandMultiple: b,
1274
1277
  collapseAll: k,
1275
- isExpanded: S,
1278
+ isExpanded: I,
1276
1279
  isPending: a
1277
1280
  };
1278
1281
  };
1279
1282
  export {
1280
1283
  Lr as DirectoryTree,
1281
- A as directoryTreeClasses,
1284
+ O as directoryTreeClasses,
1282
1285
  Fr as useDirectoryTreeState
1283
1286
  };