@aiquants/directory-tree 2.1.0 → 2.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,70 +1,70 @@
1
- import ze, { memo as $e, useRef as ce, useCallback as P, useEffect as K, useState as oe, useMemo as ie, Fragment as Ue, useTransition as qe } from "react";
2
- import { VirtualScroll as Ze } from "@aiquants/virtualscroll";
3
- import { FolderIcon as Qe, DocumentTextIcon as Ke, ChevronDownIcon as et, ChevronRightIcon as tt } from "@heroicons/react/24/solid";
4
- import { FileIcon as rt } from "@phosphor-icons/react";
5
- import { twMerge as A } from "tailwind-merge";
6
- var ge = { exports: {} }, me = {};
7
- var je;
8
- function nt() {
9
- if (je) return me;
10
- je = 1;
1
+ import et, { memo as Ye, useRef as fe, useCallback as C, useEffect as oe, useState as ie, useMemo as ee, Fragment as tt, useTransition as rt } from "react";
2
+ import { VirtualScroll as nt } from "@aiquants/virtualscroll";
3
+ import { FolderIcon as ot, DocumentTextIcon as st, ChevronDownIcon as at, ChevronRightIcon as lt } from "@heroicons/react/24/solid";
4
+ import { FileIcon as it } from "@phosphor-icons/react";
5
+ import { twMerge as Y } from "tailwind-merge";
6
+ var xe = { exports: {} }, me = {};
7
+ var $e;
8
+ function ct() {
9
+ if ($e) return me;
10
+ $e = 1;
11
11
  var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), r = /* @__PURE__ */ Symbol.for("react.fragment");
12
- function o(l, n, a) {
13
- var i = null;
14
- if (a !== void 0 && (i = "" + a), n.key !== void 0 && (i = "" + n.key), "key" in n) {
15
- a = {};
16
- for (var h in n)
17
- h !== "key" && (a[h] = n[h]);
18
- } else a = n;
19
- return n = a.ref, {
12
+ function a(n, o, l) {
13
+ var s = null;
14
+ if (l !== void 0 && (s = "" + l), o.key !== void 0 && (s = "" + o.key), "key" in o) {
15
+ l = {};
16
+ for (var m in o)
17
+ m !== "key" && (l[m] = o[m]);
18
+ } else l = o;
19
+ return o = l.ref, {
20
20
  $$typeof: e,
21
- type: l,
22
- key: i,
23
- ref: n !== void 0 ? n : null,
24
- props: a
21
+ type: n,
22
+ key: s,
23
+ ref: o !== void 0 ? o : null,
24
+ props: l
25
25
  };
26
26
  }
27
- return me.Fragment = r, me.jsx = o, me.jsxs = o, me;
27
+ return me.Fragment = r, me.jsx = a, me.jsxs = a, me;
28
28
  }
29
29
  var he = {};
30
- var Me;
31
- function ot() {
32
- return Me || (Me = 1, process.env.NODE_ENV !== "production" && (function() {
30
+ var De;
31
+ function ut() {
32
+ return De || (De = 1, process.env.NODE_ENV !== "production" && (function() {
33
33
  function e(t) {
34
34
  if (t == null) return null;
35
35
  if (typeof t == "function")
36
- return t.$$typeof === $ ? null : t.displayName || t.name || null;
36
+ return t.$$typeof === q ? null : t.displayName || t.name || null;
37
37
  if (typeof t == "string") return t;
38
38
  switch (t) {
39
- case s:
39
+ case u:
40
40
  return "Fragment";
41
- case I:
41
+ case j:
42
42
  return "Profiler";
43
- case m:
43
+ case p:
44
44
  return "StrictMode";
45
- case F:
45
+ case P:
46
46
  return "Suspense";
47
- case V:
47
+ case T:
48
48
  return "SuspenseList";
49
- case q:
49
+ case U:
50
50
  return "Activity";
51
51
  }
52
52
  if (typeof t == "object")
53
53
  switch (typeof t.tag == "number" && console.error(
54
54
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
55
55
  ), t.$$typeof) {
56
- case u:
56
+ case i:
57
57
  return "Portal";
58
- case S:
58
+ case g:
59
59
  return t.displayName || "Context";
60
- case T:
60
+ case v:
61
61
  return (t._context.displayName || "Context") + ".Consumer";
62
62
  case d:
63
63
  var f = t.render;
64
64
  return t = t.displayName, t || (t = f.displayName || f.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
65
- case Y:
65
+ case A:
66
66
  return f = t.displayName || null, f !== null ? f : e(t.type) || "Memo";
67
- case B:
67
+ case X:
68
68
  f = t._payload, t = t._init;
69
69
  try {
70
70
  return e(t(f));
@@ -76,7 +76,7 @@ function ot() {
76
76
  function r(t) {
77
77
  return "" + t;
78
78
  }
79
- function o(t) {
79
+ function a(t) {
80
80
  try {
81
81
  r(t);
82
82
  var f = !1;
@@ -85,17 +85,17 @@ function ot() {
85
85
  }
86
86
  if (f) {
87
87
  f = console;
88
- var x = f.error, w = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
88
+ var x = f.error, k = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
89
89
  return x.call(
90
90
  f,
91
91
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
92
- w
92
+ k
93
93
  ), r(t);
94
94
  }
95
95
  }
96
- function l(t) {
97
- if (t === s) return "<>";
98
- if (typeof t == "object" && t !== null && t.$$typeof === B)
96
+ function n(t) {
97
+ if (t === u) return "<>";
98
+ if (typeof t == "object" && t !== null && t.$$typeof === X)
99
99
  return "<...>";
100
100
  try {
101
101
  var f = e(t);
@@ -104,23 +104,23 @@ function ot() {
104
104
  return "<...>";
105
105
  }
106
106
  }
107
- function n() {
108
- var t = H.A;
107
+ function o() {
108
+ var t = $.A;
109
109
  return t === null ? null : t.getOwner();
110
110
  }
111
- function a() {
111
+ function l() {
112
112
  return Error("react-stack-top-frame");
113
113
  }
114
- function i(t) {
115
- if (Z.call(t, "key")) {
114
+ function s(t) {
115
+ if (V.call(t, "key")) {
116
116
  var f = Object.getOwnPropertyDescriptor(t, "key").get;
117
117
  if (f && f.isReactWarning) return !1;
118
118
  }
119
119
  return t.key !== void 0;
120
120
  }
121
- function h(t, f) {
121
+ function m(t, f) {
122
122
  function x() {
123
- g || (g = !0, console.error(
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
125
  f
126
126
  ));
@@ -130,23 +130,23 @@ function ot() {
130
130
  configurable: !0
131
131
  });
132
132
  }
133
- function E() {
133
+ function R() {
134
134
  var t = e(this.type);
135
- return M[t] || (M[t] = !0, console.error(
135
+ return S[t] || (S[t] = !0, console.error(
136
136
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
137
137
  )), t = this.props.ref, t !== void 0 ? t : null;
138
138
  }
139
- function y(t, f, x, w, z, ee) {
140
- var R = x.ref;
139
+ function w(t, f, x, k, te, Q) {
140
+ var _ = x.ref;
141
141
  return t = {
142
- $$typeof: k,
142
+ $$typeof: I,
143
143
  type: t,
144
144
  key: f,
145
145
  props: x,
146
- _owner: w
147
- }, (R !== void 0 ? R : null) !== null ? Object.defineProperty(t, "ref", {
146
+ _owner: k
147
+ }, (_ !== void 0 ? _ : null) !== null ? Object.defineProperty(t, "ref", {
148
148
  enumerable: !1,
149
- get: E
149
+ get: R
150
150
  }) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
151
151
  configurable: !1,
152
152
  enumerable: !1,
@@ -161,362 +161,371 @@ function ot() {
161
161
  configurable: !1,
162
162
  enumerable: !1,
163
163
  writable: !0,
164
- value: z
164
+ value: te
165
165
  }), Object.defineProperty(t, "_debugTask", {
166
166
  configurable: !1,
167
167
  enumerable: !1,
168
168
  writable: !0,
169
- value: ee
169
+ value: Q
170
170
  }), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
171
171
  }
172
- function c(t, f, x, w, z, ee) {
173
- var R = f.children;
174
- if (R !== void 0)
175
- if (w)
176
- if (J(R)) {
177
- for (w = 0; w < R.length; w++)
178
- b(R[w]);
179
- Object.freeze && Object.freeze(R);
172
+ function c(t, f, x, k, te, Q) {
173
+ var _ = f.children;
174
+ if (_ !== void 0)
175
+ if (k)
176
+ if (Z(_)) {
177
+ for (k = 0; k < _.length; k++)
178
+ h(_[k]);
179
+ Object.freeze && Object.freeze(_);
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 b(R);
185
- if (Z.call(f, "key")) {
186
- R = e(t);
187
- var W = Object.keys(f).filter(function(de) {
188
- return de !== "key";
184
+ else h(_);
185
+ if (V.call(f, "key")) {
186
+ _ = e(t);
187
+ var J = Object.keys(f).filter(function(ce) {
188
+ return ce !== "key";
189
189
  });
190
- w = 0 < W.length ? "{key: someKey, " + W.join(": ..., ") + ": ...}" : "{key: someKey}", ae[R + w] || (W = 0 < W.length ? "{" + W.join(": ..., ") + ": ...}" : "{}", console.error(
190
+ k = 0 < J.length ? "{key: someKey, " + J.join(": ..., ") + ": ...}" : "{key: someKey}", O[_ + k] || (J = 0 < J.length ? "{" + J.join(": ..., ") + ": ...}" : "{}", console.error(
191
191
  `A props object containing a "key" prop is being spread into JSX:
192
192
  let props = %s;
193
193
  <%s {...props} />
194
194
  React keys must be passed directly to JSX without using spread:
195
195
  let props = %s;
196
196
  <%s key={someKey} {...props} />`,
197
- w,
198
- R,
199
- W,
200
- R
201
- ), ae[R + w] = !0);
197
+ k,
198
+ _,
199
+ J,
200
+ _
201
+ ), O[_ + k] = !0);
202
202
  }
203
- if (R = null, x !== void 0 && (o(x), R = "" + x), i(f) && (o(f.key), R = "" + f.key), "key" in f) {
203
+ if (_ = null, x !== void 0 && (a(x), _ = "" + x), s(f) && (a(f.key), _ = "" + f.key), "key" in f) {
204
204
  x = {};
205
- for (var Q in f)
206
- Q !== "key" && (x[Q] = f[Q]);
205
+ for (var re in f)
206
+ re !== "key" && (x[re] = f[re]);
207
207
  } else x = f;
208
- return R && h(
208
+ return _ && m(
209
209
  x,
210
210
  typeof t == "function" ? t.displayName || t.name || "Unknown" : t
211
- ), y(
211
+ ), w(
212
212
  t,
213
- R,
213
+ _,
214
214
  x,
215
- n(),
216
- z,
217
- ee
215
+ o(),
216
+ te,
217
+ Q
218
218
  );
219
219
  }
220
- function b(t) {
221
- p(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === B && (t._payload.status === "fulfilled" ? p(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
220
+ function h(t) {
221
+ y(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === X && (t._payload.status === "fulfilled" ? y(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
222
222
  }
223
- function p(t) {
224
- return typeof t == "object" && t !== null && t.$$typeof === k;
223
+ function y(t) {
224
+ return typeof t == "object" && t !== null && t.$$typeof === I;
225
225
  }
226
- var v = ze, k = /* @__PURE__ */ Symbol.for("react.transitional.element"), u = /* @__PURE__ */ Symbol.for("react.portal"), s = /* @__PURE__ */ Symbol.for("react.fragment"), m = /* @__PURE__ */ Symbol.for("react.strict_mode"), I = /* @__PURE__ */ Symbol.for("react.profiler"), T = /* @__PURE__ */ Symbol.for("react.consumer"), S = /* @__PURE__ */ Symbol.for("react.context"), d = /* @__PURE__ */ Symbol.for("react.forward_ref"), F = /* @__PURE__ */ Symbol.for("react.suspense"), V = /* @__PURE__ */ Symbol.for("react.suspense_list"), Y = /* @__PURE__ */ Symbol.for("react.memo"), B = /* @__PURE__ */ Symbol.for("react.lazy"), q = /* @__PURE__ */ Symbol.for("react.activity"), $ = /* @__PURE__ */ Symbol.for("react.client.reference"), H = v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Z = Object.prototype.hasOwnProperty, J = Array.isArray, G = console.createTask ? console.createTask : function() {
226
+ var E = et, I = /* @__PURE__ */ Symbol.for("react.transitional.element"), i = /* @__PURE__ */ Symbol.for("react.portal"), u = /* @__PURE__ */ Symbol.for("react.fragment"), p = /* @__PURE__ */ Symbol.for("react.strict_mode"), j = /* @__PURE__ */ Symbol.for("react.profiler"), v = /* @__PURE__ */ Symbol.for("react.consumer"), g = /* @__PURE__ */ Symbol.for("react.context"), d = /* @__PURE__ */ Symbol.for("react.forward_ref"), P = /* @__PURE__ */ Symbol.for("react.suspense"), T = /* @__PURE__ */ Symbol.for("react.suspense_list"), A = /* @__PURE__ */ Symbol.for("react.memo"), X = /* @__PURE__ */ Symbol.for("react.lazy"), U = /* @__PURE__ */ Symbol.for("react.activity"), q = /* @__PURE__ */ Symbol.for("react.client.reference"), $ = E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, V = Object.prototype.hasOwnProperty, Z = Array.isArray, G = console.createTask ? console.createTask : function() {
227
227
  return null;
228
228
  };
229
- v = {
229
+ E = {
230
230
  react_stack_bottom_frame: function(t) {
231
231
  return t();
232
232
  }
233
233
  };
234
- var g, M = {}, O = v.react_stack_bottom_frame.bind(
235
- v,
236
- a
237
- )(), C = G(l(a)), ae = {};
238
- he.Fragment = s, he.jsx = function(t, f, x) {
239
- var w = 1e4 > H.recentlyCreatedOwnerStacks++;
234
+ var se, S = {}, D = E.react_stack_bottom_frame.bind(
235
+ E,
236
+ l
237
+ )(), L = G(n(l)), O = {};
238
+ he.Fragment = u, he.jsx = function(t, f, x) {
239
+ var k = 1e4 > $.recentlyCreatedOwnerStacks++;
240
240
  return c(
241
241
  t,
242
242
  f,
243
243
  x,
244
244
  !1,
245
- w ? Error("react-stack-top-frame") : O,
246
- w ? G(l(t)) : C
245
+ k ? Error("react-stack-top-frame") : D,
246
+ k ? G(n(t)) : L
247
247
  );
248
248
  }, he.jsxs = function(t, f, x) {
249
- var w = 1e4 > H.recentlyCreatedOwnerStacks++;
249
+ var k = 1e4 > $.recentlyCreatedOwnerStacks++;
250
250
  return c(
251
251
  t,
252
252
  f,
253
253
  x,
254
254
  !0,
255
- w ? Error("react-stack-top-frame") : O,
256
- w ? G(l(t)) : C
255
+ k ? Error("react-stack-top-frame") : D,
256
+ k ? G(n(t)) : L
257
257
  );
258
258
  };
259
259
  })()), he;
260
260
  }
261
- var Oe;
262
- function at() {
263
- return Oe || (Oe = 1, process.env.NODE_ENV === "production" ? ge.exports = nt() : ge.exports = ot()), ge.exports;
261
+ var Le;
262
+ function dt() {
263
+ return Le || (Le = 1, process.env.NODE_ENV === "production" ? xe.exports = ct() : xe.exports = ut()), xe.exports;
264
264
  }
265
- var N = at();
266
- const st = (e, r, o) => {
267
- const l = [];
268
- for (let n = r; n < o; n++) {
269
- const a = e[n];
270
- if (!(!a || a.length === 0))
271
- for (const i of a)
272
- l.push(i);
265
+ var N = dt();
266
+ const ft = (e, r, a) => {
267
+ const n = [];
268
+ for (let o = r; o < a; o++) {
269
+ const l = e[o];
270
+ if (!(!l || l.length === 0))
271
+ for (const s of l)
272
+ n.push(s);
273
273
  }
274
- return l;
275
- }, lt = (e, r, o) => {
276
- const l = [];
277
- for (let n = r; n < o; n++) {
278
- const a = e[n];
279
- if (!(!a || a.length === 0))
280
- for (const i of a)
281
- l.push(i);
274
+ return n;
275
+ }, mt = (e, r, a) => {
276
+ const n = [];
277
+ for (let o = r; o < a; o++) {
278
+ const l = e[o];
279
+ if (!(!l || l.length === 0))
280
+ for (const s of l)
281
+ n.push(s);
282
282
  }
283
- return l;
284
- }, it = (e, r, o, l) => {
285
- const n = Math.max(1, Math.floor(r * l)), a = Math.max(1, Math.floor(o * l));
286
- (e.width !== n || e.height !== a) && (e.width = n, e.height = a);
287
- const i = e.style;
288
- i.width !== `${r}px` && (i.width = `${r}px`), i.height !== `${o}px` && (i.height = `${o}px`);
289
- }, ct = (e, r, o) => {
290
- e.lineWidth = o, e.beginPath();
291
- for (const l of r)
292
- e.moveTo(l.x1, l.y1), e.lineTo(l.x2, l.y2);
283
+ return n;
284
+ }, ht = (e, r, a, n) => {
285
+ const o = Math.max(1, Math.floor(r * n)), l = Math.max(1, Math.floor(a * n));
286
+ (e.width !== o || e.height !== l) && (e.width = o, e.height = l);
287
+ const s = e.style;
288
+ s.width !== `${r}px` && (s.width = `${r}px`), s.height !== `${a}px` && (s.height = `${a}px`);
289
+ }, yt = (e, r, a) => {
290
+ e.lineWidth = a, e.beginPath();
291
+ for (const n of r)
292
+ e.moveTo(n.x1, n.y1), e.lineTo(n.x2, n.y2);
293
293
  e.stroke();
294
- }, ut = (e, r) => {
295
- const o = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());
296
- if (!o)
294
+ }, pt = (e, r) => {
295
+ const a = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());
296
+ if (!a)
297
297
  return null;
298
- let l = o[1];
299
- l.length === 3 && (l = l.split("").map((h) => h + h).join(""));
300
- const n = Number.parseInt(l.slice(0, 2), 16), a = Number.parseInt(l.slice(2, 4), 16), i = Number.parseInt(l.slice(4, 6), 16);
301
- return `rgba(${n}, ${a}, ${i}, ${r})`;
302
- }, dt = (e, r, o, l) => {
298
+ let n = a[1];
299
+ n.length === 3 && (n = n.split("").map((m) => m + m).join(""));
300
+ const o = Number.parseInt(n.slice(0, 2), 16), l = Number.parseInt(n.slice(2, 4), 16), s = Number.parseInt(n.slice(4, 6), 16);
301
+ return `rgba(${o}, ${l}, ${s}, ${r})`;
302
+ }, bt = (e, r, a, n) => {
303
303
  if (r.length === 0)
304
304
  return;
305
- const n = ut(o, 0.14), a = e.strokeStyle, i = e.fillStyle, h = e.lineWidth, E = e.lineCap, y = e.lineJoin;
306
- e.strokeStyle = o, e.lineCap = "round", e.lineJoin = "round";
305
+ const o = pt(a, 0.14), l = e.strokeStyle, s = e.fillStyle, m = e.lineWidth, R = e.lineCap, w = e.lineJoin;
306
+ e.strokeStyle = a, e.lineCap = "round", e.lineJoin = "round";
307
307
  for (const c of r) {
308
- const b = l ?? c.size, p = Math.max(0, b / 2), v = Math.max(1, Math.round(b * 0.08)), k = Math.max(1, Math.round(b * 0.14)), u = Math.max(0, p - v * 0.8), s = Math.max(0, u * 0.55);
309
- n && (e.fillStyle = n, e.beginPath(), e.arc(c.centerX, c.centerY, u, 0, Math.PI * 2), e.fill()), e.lineWidth = v, e.beginPath(), e.arc(c.centerX, c.centerY, Math.max(0, p - v * 0.3), 0, Math.PI * 2), e.stroke(), e.lineWidth = k, e.beginPath(), e.moveTo(c.centerX - s, c.centerY), e.lineTo(c.centerX + s, c.centerY), e.stroke(), c.isExpanded || (e.beginPath(), e.moveTo(c.centerX, c.centerY - s), e.lineTo(c.centerX, c.centerY + s), e.stroke());
308
+ const h = n ?? c.size, y = Math.max(0, h / 2), E = Math.max(1, Math.round(h * 0.08)), I = Math.max(1, Math.round(h * 0.14)), i = Math.max(0, y - E * 0.8), u = Math.max(0, i * 0.55);
309
+ o && (e.fillStyle = o, e.beginPath(), e.arc(c.centerX, c.centerY, i, 0, Math.PI * 2), e.fill()), e.lineWidth = E, e.beginPath(), e.arc(c.centerX, c.centerY, Math.max(0, y - E * 0.3), 0, Math.PI * 2), e.stroke(), e.lineWidth = I, e.beginPath(), e.moveTo(c.centerX - u, c.centerY), e.lineTo(c.centerX + u, c.centerY), e.stroke(), c.isExpanded || (e.beginPath(), e.moveTo(c.centerX, c.centerY - u), e.lineTo(c.centerX, c.centerY + u), e.stroke());
310
310
  }
311
- e.strokeStyle = a, e.fillStyle = i, e.lineWidth = h, e.lineCap = E, e.lineJoin = y;
312
- }, De = $e(({ segmentsByItem: e, glyphsByItem: r, itemHeight: o, width: l, viewportHeight: n, scrollPosition: a, color: i = "#a0aec0", strokeWidth: h = 1, renderStartIndex: E, renderEndIndex: y, lookaheadEndIndex: c, devicePixelRatio: b, expandGlyphColor: p, expandGlyphSize: v }) => {
313
- const k = ce(null), u = ce(null), s = ce({
311
+ e.strokeStyle = l, e.fillStyle = s, e.lineWidth = m, e.lineCap = R, e.lineJoin = w;
312
+ }, Be = Ye(({ segmentsByItem: e, glyphsByItem: r, itemHeight: a, width: n, viewportHeight: o, scrollPosition: l, color: s = "#a0aec0", strokeWidth: m = 1, renderStartIndex: R, renderEndIndex: w, lookaheadEndIndex: c, devicePixelRatio: h, expandGlyphColor: y, expandGlyphSize: E }) => {
313
+ const I = fe(null), i = fe(null), u = fe({
314
314
  segmentsByItem: e,
315
315
  glyphsByItem: r,
316
- itemHeight: o,
317
- width: l,
318
- viewportHeight: n,
319
- scrollPosition: a,
320
- color: i,
321
- strokeWidth: h,
322
- renderStartIndex: E,
323
- renderEndIndex: y,
316
+ itemHeight: a,
317
+ width: n,
318
+ viewportHeight: o,
319
+ scrollPosition: l,
320
+ color: s,
321
+ strokeWidth: m,
322
+ renderStartIndex: R,
323
+ renderEndIndex: w,
324
324
  lookaheadEndIndex: c,
325
- devicePixelRatio: b,
326
- expandGlyphColor: p,
327
- expandGlyphSize: v
328
- }), m = P(() => {
329
- u.current = null;
330
- const T = k.current;
331
- if (!T)
325
+ devicePixelRatio: h,
326
+ expandGlyphColor: y,
327
+ expandGlyphSize: E
328
+ }), p = C(() => {
329
+ i.current = null;
330
+ const v = I.current;
331
+ if (!v)
332
332
  return;
333
- const S = T.getContext("2d");
334
- if (!S)
333
+ const g = v.getContext("2d");
334
+ if (!g)
335
335
  return;
336
- const d = s.current;
336
+ const d = u.current;
337
337
  if (d.width <= 0 || d.viewportHeight <= 0) {
338
- S.clearRect(0, 0, T.width, T.height);
338
+ g.clearRect(0, 0, v.width, v.height);
339
339
  return;
340
340
  }
341
- const F = Number.isFinite(d.devicePixelRatio ?? NaN) ? d.devicePixelRatio : typeof window < "u" && window.devicePixelRatio || 1;
342
- it(T, d.width, d.viewportHeight, F);
343
- const V = d.segmentsByItem.length, Y = typeof d.renderStartIndex == "number" && Number.isFinite(d.renderStartIndex) ? Math.max(0, Math.floor(d.renderStartIndex)) : Math.max(0, Math.floor(d.scrollPosition / d.itemHeight)), B = Math.min(V, Math.ceil((d.scrollPosition + d.viewportHeight) / d.itemHeight)), q = (() => {
341
+ const P = Number.isFinite(d.devicePixelRatio ?? NaN) ? d.devicePixelRatio : typeof window < "u" && window.devicePixelRatio || 1;
342
+ ht(v, d.width, d.viewportHeight, P);
343
+ const T = d.segmentsByItem.length, A = typeof d.renderStartIndex == "number" && Number.isFinite(d.renderStartIndex) ? Math.max(0, Math.floor(d.renderStartIndex)) : Math.max(0, Math.floor(d.scrollPosition / d.itemHeight)), X = Math.min(T, Math.ceil((d.scrollPosition + d.viewportHeight) / d.itemHeight)), U = (() => {
344
344
  if (typeof d.renderEndIndex == "number" && Number.isFinite(d.renderEndIndex)) {
345
- const J = Math.floor(d.renderEndIndex);
346
- return Math.max(Math.min(V, J + 1), Y);
345
+ const Z = Math.floor(d.renderEndIndex);
346
+ return Math.max(Math.min(T, Z + 1), A);
347
347
  }
348
- return Math.max(B, Y);
349
- })(), $ = (() => {
348
+ return Math.max(X, A);
349
+ })(), q = (() => {
350
350
  if (typeof d.lookaheadEndIndex == "number" && Number.isFinite(d.lookaheadEndIndex)) {
351
- const J = Math.floor(d.lookaheadEndIndex), G = Math.min(V, J + 1);
352
- return Math.max(G, q);
351
+ const Z = Math.floor(d.lookaheadEndIndex), G = Math.min(T, Z + 1);
352
+ return Math.max(G, U);
353
353
  }
354
- return Math.max(B, q);
355
- })(), H = st(d.segmentsByItem, Y, $), Z = lt(d.glyphsByItem, Y, $);
356
- S.save(), S.scale(F, F), S.clearRect(0, 0, d.width, d.viewportHeight), S.translate(0, -d.scrollPosition), S.strokeStyle = d.color, ct(S, H, d.strokeWidth), dt(S, Z, d.expandGlyphColor ?? d.color, d.expandGlyphSize), S.restore();
357
- }, []), I = P(() => {
358
- u.current === null && (u.current = window.requestAnimationFrame(m));
359
- }, [m]);
360
- return K(() => {
361
- s.current = {
354
+ return Math.max(X, U);
355
+ })(), $ = ft(d.segmentsByItem, A, q), V = mt(d.glyphsByItem, A, q);
356
+ g.save(), g.scale(P, P), g.clearRect(0, 0, d.width, d.viewportHeight), g.translate(0, -d.scrollPosition), g.strokeStyle = d.color, yt(g, $, d.strokeWidth), bt(g, V, d.expandGlyphColor ?? d.color, d.expandGlyphSize), g.restore();
357
+ }, []), j = C(() => {
358
+ i.current === null && (i.current = window.requestAnimationFrame(p));
359
+ }, [p]);
360
+ return oe(() => {
361
+ u.current = {
362
362
  segmentsByItem: e,
363
363
  glyphsByItem: r,
364
- itemHeight: o,
365
- width: l,
366
- viewportHeight: n,
367
- scrollPosition: a,
368
- color: i,
369
- strokeWidth: h,
370
- renderStartIndex: E,
371
- renderEndIndex: y,
364
+ itemHeight: a,
365
+ width: n,
366
+ viewportHeight: o,
367
+ scrollPosition: l,
368
+ color: s,
369
+ strokeWidth: m,
370
+ renderStartIndex: R,
371
+ renderEndIndex: w,
372
372
  lookaheadEndIndex: c,
373
- devicePixelRatio: b,
374
- expandGlyphColor: p,
375
- expandGlyphSize: v
376
- }, I();
377
- }, [e, r, o, l, n, a, i, h, E, y, c, b, p, v, I]), K(() => () => {
378
- u.current !== null && (window.cancelAnimationFrame(u.current), u.current = null);
379
- }, []), /* @__PURE__ */ N.jsx("canvas", { ref: k, className: "pointer-events-none absolute top-0 left-0 z-0" });
373
+ devicePixelRatio: h,
374
+ expandGlyphColor: y,
375
+ expandGlyphSize: E
376
+ }, j();
377
+ }, [e, r, a, n, o, l, s, m, R, w, c, h, y, E, j]), oe(() => () => {
378
+ i.current !== null && (window.cancelAnimationFrame(i.current), i.current = null);
379
+ }, []), /* @__PURE__ */ N.jsx("canvas", { ref: I, className: "pointer-events-none absolute top-0 left-0 z-0" });
380
380
  });
381
- De.displayName = "TreeLineCanvas";
382
- const L = {
381
+ Be.displayName = "TreeLineCanvas";
382
+ const W = {
383
383
  container: "directory-tree-container relative h-full transition-opacity duration-300 overflow-y-hidden pb-[5px] pr-[3px]",
384
384
  containerPending: "opacity-70",
385
385
  entry: "directory-tree-entry flex items-center cursor-pointer relative select-none",
386
386
  // ホバー時のスタイル(ライト/ダークモード対応)
387
- entryHover: A("directory-tree-entry--hover hover:bg-gray-400/15", "dark:hover:bg-gray-200/10"),
387
+ entryHover: Y("directory-tree-entry--hover hover:bg-gray-400/15", "dark:hover:bg-gray-200/10"),
388
388
  // 選択時のスタイル(ライト/ダークモード対応)
389
- entrySelected: A("directory-tree-entry--selected bg-blue-400/10", "dark:bg-blue-400/15"),
389
+ entrySelected: Y("directory-tree-entry--selected bg-blue-400/10", "dark:bg-blue-400/15"),
390
390
  // アイテム選択時のスタイル(ライト/ダークモード対応)
391
- entryItemSelected: A("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)]"),
391
+ entryItemSelected: Y("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)]"),
392
392
  // アイコンのスタイル
393
- expandIcon: A("directory-tree-expand-icon w-5 h-5 flex-shrink-0 flex items-center justify-center", "text-gray-500", "dark:text-gray-400"),
394
- expandIconSelected: A("directory-tree-expand-icon--selected text-blue-700", "dark:text-blue-400"),
395
- typeIcon: A("directory-tree-type-icon w-5 h-5 flex-shrink-0 flex items-center justify-center", "text-gray-500", "dark:text-gray-400"),
396
- typeIconSelected: A("directory-tree-type-icon--selected text-blue-700", "dark:text-blue-400"),
393
+ expandIcon: Y("directory-tree-expand-icon w-5 h-5 flex-shrink-0 flex items-center justify-center", "text-gray-500", "dark:text-gray-400"),
394
+ expandIconSelected: Y("directory-tree-expand-icon--selected text-blue-700", "dark:text-blue-400"),
395
+ typeIcon: Y("directory-tree-type-icon w-5 h-5 flex-shrink-0 flex items-center justify-center", "text-gray-500", "dark:text-gray-400"),
396
+ typeIconSelected: Y("directory-tree-type-icon--selected text-blue-700", "dark:text-blue-400"),
397
397
  // テキストのスタイル
398
- name: A("directory-tree-name overflow-hidden text-ellipsis whitespace-nowrap ml-1", "text-gray-700", "dark:text-gray-200"),
398
+ name: Y("directory-tree-name overflow-hidden text-ellipsis whitespace-nowrap ml-1", "text-gray-700", "dark:text-gray-200"),
399
399
  nameDirectory: "directory-tree-name--directory",
400
- nameSelected: A("directory-tree-name--selected text-blue-800 font-medium", "dark:text-blue-300")
401
- }, ft = {
400
+ nameSelected: Y("directory-tree-name--selected text-blue-800 font-medium", "dark:text-blue-300")
401
+ }, vt = {
402
402
  msOverflowStyle: "none",
403
403
  scrollbarWidth: "none"
404
- }, mt = () => {
404
+ }, gt = () => {
405
405
  let e = document.getElementById("directory-tree-webkit-scrollbar-hide");
406
406
  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));
407
- }, ht = (e, r, o, l) => {
408
- const n = [], a = [];
409
- let i = 0;
410
- const h = (E, y, c) => {
411
- for (let b = 0; b < E.length; b++) {
412
- const p = E[b], v = b === E.length - 1, k = [...c, v], u = p.children !== void 0, s = u && r(p.absolutePath, p.relativePath);
413
- let m = y, I = k, T = c;
414
- l && (m = y - 1, I = k.slice(1), T = c.slice(1)), n.push({ entry: p, indentLevel: m, parentIsLast: I }), o && (m > i && (i = m), a.push({
415
- id: p.absolutePath,
416
- name: p.name,
417
- absolutePath: p.absolutePath,
418
- indentLevel: m,
419
- isLastChild: v,
420
- isDirectory: u,
421
- isExpanded: s,
422
- ancestorIsLast: [...T],
423
- hideLines: l && y === 0
424
- })), u && s && p.children && h(p.children, y + 1, k);
407
+ }, xt = (e, r, a, n) => {
408
+ const o = [], l = [];
409
+ let s = 0;
410
+ const m = (R, w, c) => {
411
+ for (let h = 0; h < R.length; h++) {
412
+ const y = R[h], E = h === R.length - 1, I = [...c, E], i = y.children !== void 0, u = i && r(y.absolutePath, y.relativePath);
413
+ let p = w, j = I, v = c;
414
+ n && (p = w - 1, j = I.slice(1), v = c.slice(1)), o.push({ entry: y, indentLevel: p, parentIsLast: j }), a && (p > s && (s = p), l.push({
415
+ id: y.absolutePath,
416
+ name: y.name,
417
+ absolutePath: y.absolutePath,
418
+ indentLevel: p,
419
+ isLastChild: E,
420
+ isDirectory: i,
421
+ isExpanded: u,
422
+ ancestorIsLast: [...v],
423
+ hideLines: n && w === 0
424
+ })), i && u && y.children && m(y.children, w + 1, I);
425
425
  }
426
426
  };
427
- return h(e, 0, []), { flatItems: n, lineItems: a, maxIndent: i };
428
- }, yt = (e, r, o, l, n) => {
429
- const a = l?.renderStart ?? Math.max(0, Math.floor(n / ue)), i = r > 0 ? Math.ceil(r / ue) + o : o, h = e > 0 ? Math.min(e - 1, a + i) : a, E = l?.renderEnd ?? h, y = e > 0 ? Math.min(e - 1, E + o) : E;
430
- return { renderStart: a, renderEnd: E, lookaheadEnd: y };
431
- }, pt = ({ isDirectory: e, isExpanded: r, showExpandIcons: o, useCanvasExpandIcons: l, expandIconSize: n }) => {
432
- const a = n ? { width: n, height: n } : void 0, i = n ? "" : "h-4 w-4";
433
- return !(o && e) || l ? /* @__PURE__ */ N.jsx("span", { className: i, style: a, "aria-hidden": "true" }) : r ? /* @__PURE__ */ N.jsx(et, { className: i, style: a }) : /* @__PURE__ */ N.jsx(tt, { className: i, style: a });
434
- }, bt = (e) => e.slice((e.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase(), vt = (e, r, o, l, n) => {
427
+ return m(e, 0, []), { flatItems: o, lineItems: l, maxIndent: s };
428
+ }, Fe = (e, r) => {
429
+ const a = e.length - 1;
430
+ if (a <= 0) return 0;
431
+ let n = 0, o = a - 1, l = 0;
432
+ for (; n <= o; ) {
433
+ const s = n + o >>> 1;
434
+ e[s] <= r ? (l = s, n = s + 1) : o = s - 1;
435
+ }
436
+ return l;
437
+ }, Et = (e, r, a, n, o, l) => {
438
+ const s = n?.renderStart ?? Math.max(0, Fe(l, o)), m = r > 0 ? Fe(l, o + r) + a : s + a, R = e > 0 ? Math.min(e - 1, Math.max(s, m)) : s, w = n?.renderEnd ?? R, c = e > 0 ? Math.min(e - 1, w + a) : w;
439
+ return { renderStart: s, renderEnd: w, lookaheadEnd: c };
440
+ }, It = ({ isDirectory: e, isExpanded: r, showExpandIcons: a, useCanvasExpandIcons: n, expandIconSize: o }) => {
441
+ const l = o ? { width: o, height: o } : void 0, s = o ? "" : "h-4 w-4";
442
+ return !(a && e) || n ? /* @__PURE__ */ N.jsx("span", { className: s, style: l, "aria-hidden": "true" }) : r ? /* @__PURE__ */ N.jsx(at, { className: s, style: l }) : /* @__PURE__ */ N.jsx(lt, { className: s, style: l });
443
+ }, St = (e) => e.slice((e.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase(), wt = (e, r, a, n, o, l) => {
435
444
  if (e.length === 0)
436
445
  return { segmentsByItem: [], glyphsByItem: [] };
437
- const a = Array.from({ length: e.length }, () => []), i = Array.from({ length: e.length }, () => []), h = l ? typeof n == "number" && Number.isFinite(n) && n > 0 ? n : Math.max(8, Math.min(o * 0.9, r * 0.7)) : 0, E = 3;
438
- for (let y = 0; y < e.length; y++) {
439
- const c = e[y];
440
- if (c.hideLines)
446
+ const s = Array.from({ length: e.length }, () => []), m = Array.from({ length: e.length }, () => []), R = (c) => o ? typeof l == "number" && Number.isFinite(l) && l > 0 ? l : Math.max(8, Math.min(n * 0.9, c * 0.7)) : 0, w = 3;
447
+ for (let c = 0; c < e.length; c++) {
448
+ const h = e[c];
449
+ if (h.hideLines)
441
450
  continue;
442
- const b = [], p = y * r, v = p + r / 2, k = h > 0 ? h / 2 + 2 : o / 1.5;
443
- for (let m = 0; m < c.indentLevel; m++) {
444
- if (c.ancestorIsLast[m] ?? !1)
451
+ const y = [], E = r[c] ?? 0, I = a[c] ?? 0, i = I + E / 2, u = R(E), p = u > 0 ? u / 2 + 2 : n / 1.5;
452
+ for (let g = 0; g < h.indentLevel; g++) {
453
+ if (h.ancestorIsLast[g] ?? !1)
445
454
  continue;
446
- let T = !1;
447
- for (let S = y; S < e.length; S++) {
448
- const d = e[S];
449
- if (d.indentLevel > m && d.ancestorIsLast.length > m && !d.ancestorIsLast[m]) {
450
- T = !0;
455
+ let P = !1;
456
+ for (let T = c; T < e.length; T++) {
457
+ const A = e[T];
458
+ if (A.indentLevel > g && A.ancestorIsLast.length > g && !A.ancestorIsLast[g]) {
459
+ P = !0;
451
460
  break;
452
461
  }
453
- if (S > y && d.indentLevel === m)
462
+ if (T > c && A.indentLevel === g)
454
463
  break;
455
464
  }
456
- if (T) {
457
- const S = m * o + o / 2 + E;
458
- b.push({
459
- key: `${c.id}-ancestor-${m}`,
460
- x1: S,
461
- y1: p,
462
- x2: S,
463
- y2: p + r,
464
- itemIndex: y
465
+ if (P) {
466
+ const T = g * n + n / 2 + w;
467
+ y.push({
468
+ key: `${h.id}-ancestor-${g}`,
469
+ x1: T,
470
+ y1: I,
471
+ x2: T,
472
+ y2: I + E,
473
+ itemIndex: c
465
474
  });
466
475
  }
467
476
  }
468
- const u = c.indentLevel * o, s = u + o / 2 + E;
469
- if (c.isDirectory ? b.push({
470
- key: `${c.id}-connector-top`,
471
- x1: s,
472
- y1: p,
473
- x2: s,
474
- y2: v - k,
475
- itemIndex: y
476
- }) : b.push({
477
- key: `${c.id}-connector-top`,
478
- x1: s,
479
- y1: p,
480
- x2: s,
481
- y2: v,
482
- itemIndex: y
483
- }), !c.isDirectory && c.isLastChild && b.push({
484
- key: `${c.id}-connector-horizontal`,
485
- x1: s,
486
- y1: v,
487
- x2: u + o + E,
488
- y2: v,
489
- itemIndex: y
490
- }), c.isLastChild || (c.isDirectory ? b.push({
491
- key: `${c.id}-connector-bottom`,
492
- x1: s,
493
- y1: v + k,
494
- x2: s,
495
- y2: p + r,
496
- itemIndex: y
497
- }) : b.push({
498
- key: `${c.id}-connector-bottom`,
499
- x1: s,
500
- y1: v,
501
- x2: s,
502
- y2: p + r,
503
- itemIndex: y
504
- })), a[y] = b, l && c.isDirectory) {
505
- const m = h, I = s, T = v;
506
- i[y] = [
477
+ const j = h.indentLevel * n, v = j + n / 2 + w;
478
+ if (h.isDirectory ? y.push({
479
+ key: `${h.id}-connector-top`,
480
+ x1: v,
481
+ y1: I,
482
+ x2: v,
483
+ y2: i - p,
484
+ itemIndex: c
485
+ }) : y.push({
486
+ key: `${h.id}-connector-top`,
487
+ x1: v,
488
+ y1: I,
489
+ x2: v,
490
+ y2: i,
491
+ itemIndex: c
492
+ }), !h.isDirectory && h.isLastChild && y.push({
493
+ key: `${h.id}-connector-horizontal`,
494
+ x1: v,
495
+ y1: i,
496
+ x2: j + n + w,
497
+ y2: i,
498
+ itemIndex: c
499
+ }), h.isLastChild || (h.isDirectory ? y.push({
500
+ key: `${h.id}-connector-bottom`,
501
+ x1: v,
502
+ y1: i + p,
503
+ x2: v,
504
+ y2: I + E,
505
+ itemIndex: c
506
+ }) : y.push({
507
+ key: `${h.id}-connector-bottom`,
508
+ x1: v,
509
+ y1: i,
510
+ x2: v,
511
+ y2: I + E,
512
+ itemIndex: c
513
+ })), s[c] = y, o && h.isDirectory) {
514
+ const g = u, d = v, P = i;
515
+ m[c] = [
507
516
  {
508
- key: `${c.id}-glyph`,
509
- itemIndex: y,
510
- centerX: I,
511
- centerY: T,
512
- size: m,
513
- isExpanded: c.isExpanded
517
+ key: `${h.id}-glyph`,
518
+ itemIndex: c,
519
+ centerX: d,
520
+ centerY: P,
521
+ size: g,
522
+ isExpanded: h.isExpanded
514
523
  }
515
524
  ];
516
525
  }
517
526
  }
518
- return { segmentsByItem: a, glyphsByItem: i };
519
- }, Se = (e, r) => {
527
+ return { segmentsByItem: s, glyphsByItem: m };
528
+ }, Re = (e, r) => {
520
529
  if (e == null || typeof e == "boolean") return null;
521
530
  if (typeof e == "function")
522
531
  return console.warn(`[DirectoryTree] Function returned by renderer for "${r}". Return a node.`), null;
@@ -524,122 +533,123 @@ const L = {
524
533
  if ("then" in e)
525
534
  return console.warn(`[DirectoryTree] Promise returned for "${r}". Not supported.`), null;
526
535
  if (Array.isArray(e)) {
527
- const l = e.map((n) => Se(n, r)).filter(Boolean);
528
- return l.length ? l : null;
536
+ const n = e.map((o) => Re(o, r)).filter(Boolean);
537
+ return n.length ? n : null;
529
538
  }
530
- const o = e.type;
531
- if (o && o.$$typeof === /* @__PURE__ */ Symbol.for("react.lazy"))
539
+ const a = e.type;
540
+ if (a && a.$$typeof === /* @__PURE__ */ Symbol.for("react.lazy"))
532
541
  return console.warn(`[DirectoryTree] Lazy component for "${r}". Not supported.`), null;
533
542
  }
534
543
  return e;
535
- }, gt = (e, r) => {
536
- const { entry: o, isDirectory: l, isExpanded: n, extension: a } = e;
537
- let i;
538
- return o.icon !== void 0 ? i = o.icon : l ? i = n && r?.directoryExpanded || r?.directory || /* @__PURE__ */ N.jsx(Qe, { className: "h-4 w-4" }) : a && r?.fileByExtension?.[a] ? i = r.fileByExtension[a] : i = r?.file || (a === "md" ? /* @__PURE__ */ N.jsx(Ke, { className: "h-4 w-4" }) : /* @__PURE__ */ N.jsx(rt, { className: "h-4 w-4" })), Se(typeof i == "function" ? i(e) : i, o.absolutePath);
539
- }, ke = $e(
544
+ }, kt = (e, r) => {
545
+ const { entry: a, isDirectory: n, isExpanded: o, extension: l } = e;
546
+ let s;
547
+ return a.icon !== void 0 ? s = a.icon : n ? s = o && r?.directoryExpanded || r?.directory || /* @__PURE__ */ N.jsx(ot, { className: "h-4 w-4" }) : l && r?.fileByExtension?.[l] ? s = r.fileByExtension[l] : s = r?.file || (l === "md" ? /* @__PURE__ */ N.jsx(st, { className: "h-4 w-4" }) : /* @__PURE__ */ N.jsx(it, { className: "h-4 w-4" })), Re(typeof s == "function" ? s(e) : s, a.absolutePath);
548
+ }, _e = Ye(
540
549
  ({
541
550
  entry: e,
542
551
  indentLevel: r,
543
- isDirOpen: o,
544
- parentIsLast: l,
545
- renderChildren: n = !0,
546
- expansion: { toggleDirectory: a, onToggleDirectoryRecursive: i },
547
- selection: { onEntryClick: h, selectedPath: E, mode: y = "none", selectedItems: c, onSelectionChange: b },
552
+ rowHeight: a,
553
+ isDirOpen: n,
554
+ parentIsLast: o,
555
+ renderChildren: l = !0,
556
+ expansion: { toggleDirectory: s, onToggleDirectoryRecursive: m },
557
+ selection: { onEntryClick: R, selectedPath: w, mode: c = "none", selectedItems: h, onSelectionChange: y },
548
558
  visual: {
549
- iconOverrides: p,
550
- showExpandIcons: v = !0,
551
- showDirectoryIcons: k = !0,
559
+ iconOverrides: E,
560
+ showExpandIcons: I = !0,
561
+ showDirectoryIcons: i = !0,
552
562
  showFileIcons: u = !0,
553
- useCanvasExpandIcons: s = !1,
554
- expandIconSize: m,
555
- highlightStyles: I,
556
- entryClassName: T,
557
- entryStyle: S,
558
- nameClassName: d,
559
- nameStyle: F,
560
- directoryNameClassName: V,
561
- directoryNameStyle: Y,
562
- fileNameClassName: B,
563
+ useCanvasExpandIcons: p = !1,
564
+ expandIconSize: j,
565
+ highlightStyles: v,
566
+ entryClassName: g,
567
+ entryStyle: d,
568
+ nameClassName: P,
569
+ nameStyle: T,
570
+ directoryNameClassName: A,
571
+ directoryNameStyle: X,
572
+ fileNameClassName: U,
563
573
  fileNameStyle: q
564
574
  }
565
575
  }) => {
566
- const $ = ce(null), [H, Z] = oe(null), [J, G] = oe(!1);
567
- K(
576
+ const $ = fe(null), [V, Z] = ie(null), [G, se] = ie(!1);
577
+ oe(
568
578
  () => () => {
569
579
  $.current && window.clearTimeout($.current);
570
580
  },
571
581
  []
572
582
  );
573
- const g = e.children !== void 0, M = g && o(e.absolutePath), O = e.absolutePath === E, C = !g && c?.has(e.absolutePath), ae = g ? void 0 : bt(e.name);
574
- K(() => {
575
- Z(M && e.children ? e.children : null);
576
- }, [M, e.children]);
577
- const t = P(
578
- (D) => {
579
- D.stopPropagation(), y !== "none" && !g && b && b(e, !C);
580
- let se = !1;
581
- h({
583
+ const S = e.children !== void 0, D = S && n(e.absolutePath), L = e.absolutePath === w, O = !S && h?.has(e.absolutePath), t = S ? void 0 : St(e.name);
584
+ oe(() => {
585
+ Z(D && e.children ? e.children : null);
586
+ }, [D, e.children]);
587
+ const f = C(
588
+ (B) => {
589
+ B.stopPropagation(), c !== "none" && !S && y && y(e, !O);
590
+ let ue = !1;
591
+ R({
582
592
  entry: e,
583
- isDirectory: g,
584
- isExpanded: M,
593
+ isDirectory: S,
594
+ isExpanded: D,
585
595
  preventDefault: () => {
586
- se = !0;
596
+ ue = !0;
587
597
  }
588
- }), !(!g || se) && ($.current ? (window.clearTimeout($.current), $.current = null, i(e)) : $.current = window.setTimeout(() => {
589
- a(e.absolutePath), $.current = null;
598
+ }), !(!S || ue) && ($.current ? (window.clearTimeout($.current), $.current = null, m(e)) : $.current = window.setTimeout(() => {
599
+ s(e.absolutePath), $.current = null;
590
600
  }, 500));
591
601
  },
592
- [g, e, M, i, a, h, y, b, C]
593
- ), f = J ? I?.hoverClassName !== void 0 ? I.hoverClassName : L.entryHover : "", x = (() => {
594
- if (g) {
595
- if (O)
596
- return I?.directorySelectedClassName !== void 0 ? I.directorySelectedClassName : L.entrySelected;
597
- } else if (O || C)
598
- return I?.itemSelectedClassName !== void 0 ? I.itemSelectedClassName : A(O && L.entrySelected, C && L.entryItemSelected);
602
+ [S, e, D, m, s, R, c, y, O]
603
+ ), x = G ? v?.hoverClassName !== void 0 ? v.hoverClassName : W.entryHover : "", k = (() => {
604
+ if (S) {
605
+ if (L)
606
+ return v?.directorySelectedClassName !== void 0 ? v.directorySelectedClassName : W.entrySelected;
607
+ } else if (L || O)
608
+ return v?.itemSelectedClassName !== void 0 ? v.itemSelectedClassName : Y(L && W.entrySelected, O && W.entryItemSelected);
599
609
  return "";
600
- })(), w = A(L.entry, f, x, T, e.className), z = A(L.expandIcon, (O || C) && L.expandIconSelected), ee = A(L.typeIcon, (O || C) && L.typeIconSelected), R = A(L.name, d, g && L.nameDirectory, g && V, !g && B, (O || C) && L.nameSelected), W = pt({ isDirectory: g, isExpanded: M, showExpandIcons: v, useCanvasExpandIcons: s, expandIconSize: m }), Q = (g ? k : u) ? gt({ entry: e, isDirectory: g, isExpanded: M, isSelected: O, isItemSelected: !!C, extension: ae }, p) : null, de = {
601
- ...J ? I?.hoverStyle : {},
602
- ...g && O ? I?.directorySelectedStyle : {},
603
- ...!g && (O || C) ? I?.itemSelectedStyle : {}
610
+ })(), te = Y(W.entry, x, k, g, e.className), Q = Y(W.expandIcon, (L || O) && W.expandIconSelected), _ = Y(W.typeIcon, (L || O) && W.typeIconSelected), J = Y(W.name, P, S && W.nameDirectory, S && A, !S && U, (L || O) && W.nameSelected), re = It({ isDirectory: S, isExpanded: D, showExpandIcons: I, useCanvasExpandIcons: p, expandIconSize: j }), ce = (S ? i : u) ? kt({ entry: e, isDirectory: S, isExpanded: D, isSelected: L, isItemSelected: !!O, extension: t }, E) : null, Ie = {
611
+ ...G ? v?.hoverStyle : {},
612
+ ...S && L ? v?.directorySelectedStyle : {},
613
+ ...!S && (L || O) ? v?.itemSelectedStyle : {}
604
614
  };
605
- return /* @__PURE__ */ N.jsxs(Ue, { children: [
615
+ return /* @__PURE__ */ N.jsxs(tt, { children: [
606
616
  /* @__PURE__ */ N.jsxs(
607
617
  "div",
608
618
  {
609
- className: w,
619
+ className: te,
610
620
  style: {
611
621
  paddingLeft: `${Math.max(0, r * ye)}px`,
612
622
  transform: r < 0 ? `translateX(${r * ye}px)` : void 0,
613
623
  width: r < 0 ? `calc(100% + ${Math.abs(r * ye)}px)` : void 0,
614
- height: `${ue}px`,
615
- ...de,
616
- ...S,
624
+ height: `${a}px`,
625
+ ...Ie,
626
+ ...d,
617
627
  ...e.style
618
628
  },
619
- "data-entry-type": g ? "directory" : "file",
620
- "data-entry-expanded": g ? String(M) : void 0,
621
- "data-entry-selected": O ? "true" : void 0,
622
- "data-entry-item-selected": C ? "true" : void 0,
623
- onClick: t,
624
- onMouseEnter: () => G(!0),
625
- onMouseLeave: () => G(!1),
626
- onKeyDown: (D) => D.key === "Enter" && t(D),
629
+ "data-entry-type": S ? "directory" : "file",
630
+ "data-entry-expanded": S ? String(D) : void 0,
631
+ "data-entry-selected": L ? "true" : void 0,
632
+ "data-entry-item-selected": O ? "true" : void 0,
633
+ onClick: f,
634
+ onMouseEnter: () => se(!0),
635
+ onMouseLeave: () => se(!1),
636
+ onKeyDown: (B) => B.key === "Enter" && f(B),
627
637
  tabIndex: 0,
628
638
  role: "treeitem",
629
- "aria-expanded": g ? M : void 0,
630
- "aria-label": `${e.name} (${g ? "directory" : "file"})`,
639
+ "aria-expanded": S ? D : void 0,
640
+ "aria-label": `${e.name} (${S ? "directory" : "file"})`,
631
641
  children: [
632
- (v || s) && /* @__PURE__ */ N.jsx("span", { className: z, children: W }),
633
- (g ? k : u) && /* @__PURE__ */ N.jsx("span", { className: ee, children: Q }),
642
+ (I || p) && /* @__PURE__ */ N.jsx("span", { className: Q, children: re }),
643
+ (S ? i : u) && /* @__PURE__ */ N.jsx("span", { className: _, children: ce }),
634
644
  /* @__PURE__ */ N.jsx(
635
645
  "span",
636
646
  {
637
- className: R,
647
+ className: J,
638
648
  style: {
639
- ...F,
640
- ...g ? Y : q
649
+ ...T,
650
+ ...S ? X : q
641
651
  },
642
- "data-entry-type": g ? "directory" : "file",
652
+ "data-entry-type": S ? "directory" : "file",
643
653
  "data-entry-role": "name",
644
654
  children: e.label ?? e.name
645
655
  }
@@ -647,306 +657,324 @@ const L = {
647
657
  ]
648
658
  }
649
659
  ),
650
- M && H && n && /* @__PURE__ */ N.jsx("fieldset", { children: H.map((D, se) => /* @__PURE__ */ N.jsx(
651
- ke,
660
+ D && V && l && /* @__PURE__ */ N.jsx("fieldset", { children: V.map((B, ue) => /* @__PURE__ */ N.jsx(
661
+ _e,
652
662
  {
653
- entry: D,
663
+ entry: B,
654
664
  indentLevel: r + 1,
655
- isDirOpen: o,
656
- parentIsLast: [...l, se === H.length - 1],
657
- expansion: { toggleDirectory: a, onToggleDirectoryRecursive: i },
658
- selection: { onEntryClick: h, selectedPath: E, mode: y, selectedItems: c, onSelectionChange: b },
665
+ rowHeight: a,
666
+ isDirOpen: n,
667
+ parentIsLast: [...o, ue === V.length - 1],
668
+ expansion: { toggleDirectory: s, onToggleDirectoryRecursive: m },
669
+ selection: { onEntryClick: R, selectedPath: w, mode: c, selectedItems: h, onSelectionChange: y },
659
670
  visual: {
660
- iconOverrides: p,
661
- showExpandIcons: v,
662
- showDirectoryIcons: k,
671
+ iconOverrides: E,
672
+ showExpandIcons: I,
673
+ showDirectoryIcons: i,
663
674
  showFileIcons: u,
664
- useCanvasExpandIcons: s,
665
- expandIconSize: m,
666
- highlightStyles: I,
667
- entryClassName: T,
668
- entryStyle: S,
669
- nameClassName: d,
670
- nameStyle: F,
671
- directoryNameClassName: V,
672
- directoryNameStyle: Y,
673
- fileNameClassName: B,
675
+ useCanvasExpandIcons: p,
676
+ expandIconSize: j,
677
+ highlightStyles: v,
678
+ entryClassName: g,
679
+ entryStyle: d,
680
+ nameClassName: P,
681
+ nameStyle: T,
682
+ directoryNameClassName: A,
683
+ directoryNameStyle: X,
684
+ fileNameClassName: U,
674
685
  fileNameStyle: q
675
686
  }
676
687
  },
677
- D.absolutePath
688
+ B.absolutePath
678
689
  )) })
679
690
  ] }, e.absolutePath);
680
691
  },
681
692
  (e, r) => {
682
693
  if (e.entry !== r.entry) return !1;
683
- const o = e.entry.children !== void 0, l = r.entry.children !== void 0, n = o && e.isDirOpen(e.entry.absolutePath), a = l && r.isDirOpen(r.entry.absolutePath);
684
- return e.indentLevel === r.indentLevel && n === a && e.selection.selectedPath === r.selection.selectedPath && e.selection.mode === r.selection.mode && e.selection.selectedItems === r.selection.selectedItems && e.visual.iconOverrides === r.visual.iconOverrides && e.visual.showExpandIcons === r.visual.showExpandIcons && e.visual.showDirectoryIcons === r.visual.showDirectoryIcons && e.visual.showFileIcons === r.visual.showFileIcons && e.visual.useCanvasExpandIcons === r.visual.useCanvasExpandIcons && e.visual.expandIconSize === r.visual.expandIconSize && e.visual.highlightStyles === r.visual.highlightStyles && e.visual.entryClassName === r.visual.entryClassName && e.visual.entryStyle === r.visual.entryStyle && e.visual.nameClassName === r.visual.nameClassName && e.visual.nameStyle === r.visual.nameStyle && e.visual.directoryNameClassName === r.visual.directoryNameClassName && e.visual.directoryNameStyle === r.visual.directoryNameStyle && e.visual.fileNameClassName === r.visual.fileNameClassName && e.visual.fileNameStyle === r.visual.fileNameStyle && e.parentIsLast.length === r.parentIsLast.length && e.parentIsLast.every((i, h) => i === r.parentIsLast[h]);
694
+ const a = e.entry.children !== void 0, n = r.entry.children !== void 0, o = a && e.isDirOpen(e.entry.absolutePath), l = n && r.isDirOpen(r.entry.absolutePath);
695
+ return e.indentLevel === r.indentLevel && e.rowHeight === r.rowHeight && o === l && e.selection.selectedPath === r.selection.selectedPath && e.selection.mode === r.selection.mode && e.selection.selectedItems === r.selection.selectedItems && e.visual.iconOverrides === r.visual.iconOverrides && e.visual.showExpandIcons === r.visual.showExpandIcons && e.visual.showDirectoryIcons === r.visual.showDirectoryIcons && e.visual.showFileIcons === r.visual.showFileIcons && e.visual.useCanvasExpandIcons === r.visual.useCanvasExpandIcons && e.visual.expandIconSize === r.visual.expandIconSize && e.visual.highlightStyles === r.visual.highlightStyles && e.visual.entryClassName === r.visual.entryClassName && e.visual.entryStyle === r.visual.entryStyle && e.visual.nameClassName === r.visual.nameClassName && e.visual.nameStyle === r.visual.nameStyle && e.visual.directoryNameClassName === r.visual.directoryNameClassName && e.visual.directoryNameStyle === r.visual.directoryNameStyle && e.visual.fileNameClassName === r.visual.fileNameClassName && e.visual.fileNameStyle === r.visual.fileNameStyle && e.parentIsLast.length === r.parentIsLast.length && e.parentIsLast.every((s, m) => s === r.parentIsLast[m]);
685
696
  }
686
697
  );
687
- ke.displayName = "DirectoryEntryItem";
688
- const ue = 20, xt = () => ue, ye = 16, Ae = 12, Le = (e) => {
698
+ _e.displayName = "DirectoryEntryItem";
699
+ const Ee = 20, ye = 16, He = 12, We = (e) => {
689
700
  const r = [];
690
701
  if (e.children)
691
- for (const o of e.children)
692
- o.type === "directory" && (r.push(o.absolutePath), r.push(...Le(o)));
702
+ for (const a of e.children)
703
+ a.type === "directory" && (r.push(a.absolutePath), r.push(...We(a)));
693
704
  return r;
694
- }, Rt = ({
705
+ }, Ct = ({
695
706
  entries: e,
696
- expansion: { toggle: r, isExpanded: o, expandMultiple: l, collapseMultiple: n, isPending: a, alwaysExpanded: i = !1, doubleClickAction: h = "recursive" },
697
- selection: { onEntryClick: E, selectedPath: y, mode: c = "none", selectedItems: b, onSelectionChange: p },
707
+ expansion: { toggle: r, isExpanded: a, expandMultiple: n, collapseMultiple: o, isPending: l, alwaysExpanded: s = !1, doubleClickAction: m = "recursive" },
708
+ selection: { onEntryClick: R, selectedPath: w, mode: c = "none", selectedItems: h, onSelectionChange: y },
698
709
  visual: {
699
- className: v,
700
- style: k,
701
- lineColor: u = "#A0AEC0",
702
- showTreeLines: s = !0,
703
- showExpandIcons: m = !0,
704
- showDirectoryIcons: I = !0,
705
- showFileIcons: T = !0,
706
- iconOverrides: S,
710
+ className: E,
711
+ style: I,
712
+ lineColor: i = "#A0AEC0",
713
+ showTreeLines: u = !0,
714
+ showExpandIcons: p = !0,
715
+ showDirectoryIcons: j = !0,
716
+ showFileIcons: v = !0,
717
+ iconOverrides: g,
707
718
  expandIconSize: d,
708
- removeRootIndent: F = !1,
709
- highlightStyles: V,
710
- entryClassName: Y,
711
- entryStyle: B,
719
+ itemHeight: P = Ee,
720
+ removeRootIndent: T = !1,
721
+ highlightStyles: A,
722
+ entryClassName: X,
723
+ entryStyle: U,
712
724
  nameClassName: q,
713
725
  nameStyle: $,
714
- directoryNameClassName: H,
726
+ directoryNameClassName: V,
715
727
  directoryNameStyle: Z,
716
- fileNameClassName: J,
717
- fileNameStyle: G
728
+ fileNameClassName: G,
729
+ fileNameStyle: se
718
730
  } = {},
719
- virtualScroll: g
731
+ virtualScroll: S
720
732
  }) => {
721
- const [M, O] = oe(!1), C = ce(null), ae = ce(null), [t, f] = oe(0), [x, w] = oe(null), {
722
- overscanCount: z = 15,
723
- className: ee,
724
- background: R,
725
- onScroll: W,
726
- onRangeChange: Q,
727
- initialScrollIndex: de,
728
- initialScrollOffset: D,
729
- callbackThrottleMs: se = 5,
730
- contentInsets: Fe,
731
- onItemFocus: Ye,
732
- viewportHeightOverride: U,
733
- scrollBarOptions: Be,
734
- behaviorOptions: He
735
- } = g ?? {}, [pe, we] = oe(typeof D == "number" ? D : 0), We = P(
736
- (_, re) => {
737
- we(_), W?.(_, re);
733
+ const [D, L] = ie(!1), O = fe(null), t = fe(null), [f, x] = ie(0), [k, te] = ie(null), {
734
+ overscanCount: Q = 15,
735
+ className: _,
736
+ background: J,
737
+ onScroll: re,
738
+ onRangeChange: ce,
739
+ initialScrollIndex: Ie,
740
+ initialScrollOffset: B,
741
+ callbackThrottleMs: ue = 5,
742
+ contentInsets: Xe,
743
+ onItemFocus: Ve,
744
+ viewportHeightOverride: z,
745
+ scrollBarOptions: Ge,
746
+ behaviorOptions: Je
747
+ } = S ?? {}, [pe, Ne] = ie(typeof B == "number" ? B : 0), ze = C(
748
+ (b, F) => {
749
+ Ne(b), re?.(b, F);
738
750
  },
739
- [W]
740
- ), Xe = P(
741
- (_) => {
742
- const { renderingStartIndex: re, renderingEndIndex: X } = _;
743
- w((j) => j && j.renderStart === re && j.renderEnd === X ? j : { renderStart: re, renderEnd: X }), Q?.(_);
751
+ [re]
752
+ ), Ue = C(
753
+ (b) => {
754
+ const { renderingStartIndex: F, renderingEndIndex: H } = b;
755
+ te((M) => M && M.renderStart === F && M.renderEnd === H ? M : { renderStart: F, renderEnd: H }), ce?.(b);
744
756
  },
745
- [Q]
757
+ [ce]
746
758
  );
747
- K(() => {
748
- typeof D == "number" && we(D);
749
- }, [D]), K(() => {
750
- O(!0), mt();
751
- }, []), K(() => {
752
- if (typeof U == "number") {
753
- f((j) => Math.abs(j - U) > 1 ? U : j);
759
+ oe(() => {
760
+ typeof B == "number" && Ne(B);
761
+ }, [B]), oe(() => {
762
+ L(!0), gt();
763
+ }, []), oe(() => {
764
+ if (typeof z == "number") {
765
+ x((M) => Math.abs(M - z) > 1 ? z : M);
754
766
  return;
755
767
  }
756
- const _ = C.current;
757
- if (!_) return f(0);
768
+ const b = O.current;
769
+ if (!b) return x(0);
758
770
  (() => {
759
- const j = _.clientHeight;
760
- f((ne) => Math.abs(ne - j) > 1 ? j : ne);
771
+ const M = b.clientHeight;
772
+ x((le) => Math.abs(le - M) > 1 ? M : le);
761
773
  })();
762
- const X = new ResizeObserver((j) => {
763
- for (const ne of j)
764
- ne.target === _ && f((Ee) => Math.abs(Ee - ne.contentRect.height) > 1 ? ne.contentRect.height : Ee);
774
+ const H = new ResizeObserver((M) => {
775
+ for (const le of M)
776
+ le.target === b && x((we) => Math.abs(we - le.contentRect.height) > 1 ? le.contentRect.height : we);
765
777
  });
766
- return X.observe(_), () => X.disconnect();
767
- }, [U]);
768
- const te = typeof U == "number" ? U : t, le = P((_) => i || (M ? o(_) : !1), [M, o, i]), Re = A(L.container, a && L.containerPending, v), _e = ie(
778
+ return H.observe(b), () => H.disconnect();
779
+ }, [z]);
780
+ const ae = typeof z == "number" ? z : f, de = C((b) => s || (D ? a(b) : !1), [D, a, s]), Te = Y(W.container, l && W.containerPending, E), Pe = ee(
769
781
  () => ({
770
- ...ft,
771
- ...k ?? {},
772
- ...typeof U == "number" ? { height: U, minHeight: U } : {}
782
+ ...vt,
783
+ ...I ?? {},
784
+ ...typeof z == "number" ? { height: z, minHeight: z } : {}
773
785
  }),
774
- [k, U]
775
- ), Ve = P(
776
- (_, re) => {
777
- const X = [_.absolutePath, ...Le(_)], j = re || h;
778
- if (X.every((Ie) => le(Ie))) return n(X);
779
- if (X.every((Ie) => !le(Ie)) || j === "recursive") return l(X);
780
- if (j === "toggle") return n(X);
781
- console.warn(`[DirectoryTree] Unknown double click action: ${j}. No action taken.`);
786
+ [I, z]
787
+ ), qe = C(
788
+ (b, F) => {
789
+ const H = [b.absolutePath, ...We(b)], M = F || m;
790
+ if (H.every((ke) => de(ke))) return o(H);
791
+ if (H.every((ke) => !de(ke)) || M === "recursive") return n(H);
792
+ if (M === "toggle") return o(H);
793
+ console.warn(`[DirectoryTree] Unknown double click action: ${M}. No action taken.`);
782
794
  },
783
- [le, l, n, h]
784
- ), { flatItems: fe, lineItems: xe, maxIndent: Ne } = ie(() => ht(e, le, s, F), [e, le, s, F]), be = ie(
785
- () => !s || xe.length === 0 ? { segmentsByItem: [], glyphsByItem: [] } : vt(xe, ue, ye, s, d ?? Ae),
786
- [xe, s, d]
787
- ), ve = ie(() => !s || e.length === 0 ? 0 : (Ne + 2) * ye, [e.length, Ne, s]), { renderStart: Te, renderEnd: Pe, lookaheadEnd: Ce } = ie(() => yt(fe.length, te, z, x, pe), [fe.length, te, z, x, pe]), Je = ie(() => !s || ve <= 0 || te <= 0 || be.segmentsByItem.length === 0 ? null : /* @__PURE__ */ N.jsx("div", { className: "pointer-events-none absolute inset-0 z-0", "aria-hidden": "true", children: /* @__PURE__ */ N.jsx("div", { className: "absolute top-0 left-0", style: { width: ve, height: te }, children: /* @__PURE__ */ N.jsx(
788
- De,
795
+ [de, n, o, m]
796
+ ), { flatItems: Ce, lineItems: Se, maxIndent: je } = ee(() => xt(e, de, u, T), [e, de, u, T]), K = ee(
797
+ () => Ce.map((b, F) => {
798
+ const H = typeof P == "function" ? P(b.entry, F) : P;
799
+ return { ...b, rowHeight: Number.isFinite(H) && H > 0 ? H : Ee };
800
+ }),
801
+ [Ce, P]
802
+ ), ne = ee(() => K.map((b) => b.rowHeight), [K]), be = ee(() => {
803
+ const b = new Array(ne.length + 1);
804
+ b[0] = 0;
805
+ for (let F = 0; F < ne.length; F++)
806
+ b[F + 1] = b[F] + ne[F];
807
+ return b;
808
+ }, [ne]), Ze = C((b) => K[b]?.rowHeight ?? Ee, [K]), ve = ee(
809
+ () => !u || Se.length === 0 ? { segmentsByItem: [], glyphsByItem: [] } : wt(Se, ne, be, ye, u, d ?? He),
810
+ [Se, ne, be, u, d]
811
+ ), ge = ee(() => !u || e.length === 0 ? 0 : (je + 2) * ye, [e.length, je, u]), { renderStart: Ae, renderEnd: Oe, lookaheadEnd: Me } = ee(
812
+ () => Et(K.length, ae, Q, k, pe, be),
813
+ [K.length, ae, Q, k, pe, be]
814
+ ), Qe = ee(() => !u || ge <= 0 || ae <= 0 || ve.segmentsByItem.length === 0 ? null : /* @__PURE__ */ N.jsx("div", { className: "pointer-events-none absolute inset-0 z-0", "aria-hidden": "true", children: /* @__PURE__ */ N.jsx("div", { className: "absolute top-0 left-0", style: { width: ge, height: ae }, children: /* @__PURE__ */ N.jsx(
815
+ Be,
789
816
  {
790
- segmentsByItem: be.segmentsByItem,
791
- glyphsByItem: be.glyphsByItem,
792
- itemHeight: ue,
793
- width: ve,
794
- viewportHeight: te,
817
+ segmentsByItem: ve.segmentsByItem,
818
+ glyphsByItem: ve.glyphsByItem,
819
+ itemHeight: ne[0] ?? Ee,
820
+ width: ge,
821
+ viewportHeight: ae,
795
822
  scrollPosition: pe,
796
- color: u,
797
- expandGlyphColor: u,
798
- expandGlyphSize: d ?? Ae,
799
- renderStartIndex: Te,
800
- renderEndIndex: Pe,
801
- lookaheadEndIndex: Ce
823
+ color: i,
824
+ expandGlyphColor: i,
825
+ expandGlyphSize: d ?? He,
826
+ renderStartIndex: Ae,
827
+ renderEndIndex: Oe,
828
+ lookaheadEndIndex: Me
802
829
  }
803
- ) }) }), [ve, te, Te, Pe, Ce, pe, be, u, s, d]), Ge = P((_) => fe[_], [fe]);
804
- return e.length === 0 ? /* @__PURE__ */ N.jsx("div", { className: Re, style: _e }) : /* @__PURE__ */ N.jsx("div", { ref: C, className: Re, style: _e, role: "tree", children: /* @__PURE__ */ N.jsx(
805
- Ze,
830
+ ) }) }), [ge, ae, Ae, Oe, Me, pe, ve, i, u, d, ne]), Ke = C((b) => K[b], [K]);
831
+ return e.length === 0 ? /* @__PURE__ */ N.jsx("div", { className: Te, style: Pe }) : /* @__PURE__ */ N.jsx("div", { ref: O, className: Te, style: Pe, role: "tree", children: /* @__PURE__ */ N.jsx(
832
+ nt,
806
833
  {
807
- ref: ae,
808
- itemCount: fe.length,
809
- getItem: Ge,
810
- getItemHeight: xt,
811
- viewportSize: te,
812
- overscanCount: z,
813
- onScroll: We,
814
- onRangeChange: Xe,
815
- className: ee,
834
+ ref: t,
835
+ itemCount: K.length,
836
+ getItem: Ke,
837
+ getItemHeight: Ze,
838
+ viewportSize: ae,
839
+ overscanCount: Q,
840
+ onScroll: ze,
841
+ onRangeChange: Ue,
842
+ className: _,
816
843
  background: /* @__PURE__ */ N.jsxs(N.Fragment, { children: [
817
- Je,
818
- R
844
+ Qe,
845
+ J
819
846
  ] }),
820
- initialScrollIndex: de,
821
- initialScrollOffset: D,
822
- onItemFocus: Ye,
823
- callbackThrottleMs: se,
824
- contentInsets: Fe,
825
- scrollBarOptions: Be,
826
- behaviorOptions: He,
827
- children: (_) => _ && /* @__PURE__ */ N.jsx(
828
- ke,
847
+ initialScrollIndex: Ie,
848
+ initialScrollOffset: B,
849
+ onItemFocus: Ve,
850
+ callbackThrottleMs: ue,
851
+ contentInsets: Xe,
852
+ scrollBarOptions: Ge,
853
+ behaviorOptions: Je,
854
+ children: (b) => b && /* @__PURE__ */ N.jsx(
855
+ _e,
829
856
  {
830
- entry: _.entry,
831
- indentLevel: _.indentLevel,
832
- isDirOpen: le,
833
- parentIsLast: _.parentIsLast,
857
+ entry: b.entry,
858
+ indentLevel: b.indentLevel,
859
+ rowHeight: b.rowHeight,
860
+ isDirOpen: de,
861
+ parentIsLast: b.parentIsLast,
834
862
  renderChildren: !1,
835
- expansion: { toggleDirectory: r, onToggleDirectoryRecursive: Ve },
836
- selection: { onEntryClick: E, selectedPath: y ?? null, mode: c, selectedItems: b, onSelectionChange: p },
863
+ expansion: { toggleDirectory: r, onToggleDirectoryRecursive: qe },
864
+ selection: { onEntryClick: R, selectedPath: w ?? null, mode: c, selectedItems: h, onSelectionChange: y },
837
865
  visual: {
838
- iconOverrides: S,
839
- showExpandIcons: m,
840
- showDirectoryIcons: I,
841
- showFileIcons: T,
842
- useCanvasExpandIcons: s,
866
+ iconOverrides: g,
867
+ showExpandIcons: p,
868
+ showDirectoryIcons: j,
869
+ showFileIcons: v,
870
+ useCanvasExpandIcons: u,
843
871
  expandIconSize: d,
844
- highlightStyles: V,
845
- entryClassName: Y,
846
- entryStyle: B,
872
+ highlightStyles: A,
873
+ entryClassName: X,
874
+ entryStyle: U,
847
875
  nameClassName: q,
848
876
  nameStyle: $,
849
- directoryNameClassName: H,
877
+ directoryNameClassName: V,
850
878
  directoryNameStyle: Z,
851
- fileNameClassName: J,
852
- fileNameStyle: G
879
+ fileNameClassName: G,
880
+ fileNameStyle: se
853
881
  }
854
882
  },
855
- _.entry.absolutePath
883
+ b.entry.absolutePath
856
884
  )
857
885
  }
858
886
  ) });
859
- }, _t = ({ initialExpanded: e = /* @__PURE__ */ new Set(), storageKey: r } = {}) => {
860
- const [o, l] = qe(), [n, a] = oe(() => {
887
+ }, jt = ({ initialExpanded: e = /* @__PURE__ */ new Set(), storageKey: r } = {}) => {
888
+ const [a, n] = rt(), [o, l] = ie(() => {
861
889
  if (typeof window < "u" && r)
862
890
  try {
863
- const u = window.localStorage.getItem(r);
864
- if (u) {
865
- const s = JSON.parse(u);
866
- return new Set(s);
891
+ const i = window.localStorage.getItem(r);
892
+ if (i) {
893
+ const u = JSON.parse(i);
894
+ return new Set(u);
867
895
  }
868
- } catch (u) {
869
- console.error("[useDirectoryTreeState] Error reading from localStorage", u);
896
+ } catch (i) {
897
+ console.error("[useDirectoryTreeState] Error reading from localStorage", i);
870
898
  }
871
899
  return e;
872
- }), i = P((u) => {
873
- l(() => {
874
- a((s) => {
875
- const m = new Set(s);
876
- return u(m), m;
900
+ }), s = C((i) => {
901
+ n(() => {
902
+ l((u) => {
903
+ const p = new Set(u);
904
+ return i(p), p;
877
905
  });
878
906
  });
879
- }, []), h = P(
880
- (u, s) => {
881
- i((m) => {
882
- for (const I of u)
883
- s(m, I);
907
+ }, []), m = C(
908
+ (i, u) => {
909
+ s((p) => {
910
+ for (const j of i)
911
+ u(p, j);
884
912
  });
885
913
  },
886
- [i]
914
+ [s]
887
915
  );
888
- K(() => {
916
+ oe(() => {
889
917
  if (r && typeof window < "u")
890
918
  try {
891
- window.localStorage.setItem(r, JSON.stringify(Array.from(n)));
892
- } catch (u) {
893
- console.warn(`Error setting localStorage key "${r}":`, u);
919
+ window.localStorage.setItem(r, JSON.stringify(Array.from(o)));
920
+ } catch (i) {
921
+ console.warn(`Error setting localStorage key "${r}":`, i);
894
922
  }
895
- }, [n, r]);
896
- const E = P(
897
- (u) => {
898
- h([u], (s, m) => {
899
- s.has(m) ? s.delete(m) : s.add(m);
923
+ }, [o, r]);
924
+ const R = C(
925
+ (i) => {
926
+ m([i], (u, p) => {
927
+ u.has(p) ? u.delete(p) : u.add(p);
900
928
  });
901
929
  },
902
- [h]
903
- ), y = P(
904
- (u) => {
905
- h([u], (s, m) => {
906
- s.add(m);
930
+ [m]
931
+ ), w = C(
932
+ (i) => {
933
+ m([i], (u, p) => {
934
+ u.add(p);
907
935
  });
908
936
  },
909
- [h]
910
- ), c = P(
911
- (u) => {
912
- h([u], (s, m) => {
913
- s.delete(m);
937
+ [m]
938
+ ), c = C(
939
+ (i) => {
940
+ m([i], (u, p) => {
941
+ u.delete(p);
914
942
  });
915
943
  },
916
- [h]
917
- ), b = P(
918
- (u) => {
919
- h(u, (s, m) => {
920
- s.delete(m);
944
+ [m]
945
+ ), h = C(
946
+ (i) => {
947
+ m(i, (u, p) => {
948
+ u.delete(p);
921
949
  });
922
950
  },
923
- [h]
924
- ), p = P(
925
- (u) => {
926
- h(u, (s, m) => {
927
- s.add(m);
951
+ [m]
952
+ ), y = C(
953
+ (i) => {
954
+ m(i, (u, p) => {
955
+ u.add(p);
928
956
  });
929
957
  },
930
- [h]
931
- ), v = P(() => {
932
- i((u) => {
933
- u.clear();
958
+ [m]
959
+ ), E = C(() => {
960
+ s((i) => {
961
+ i.clear();
934
962
  });
935
- }, [i]), k = P((u) => n.has(u), [n]);
963
+ }, [s]), I = C((i) => o.has(i), [o]);
936
964
  return {
937
- expanded: n,
938
- toggle: E,
939
- expand: y,
965
+ expanded: o,
966
+ toggle: R,
967
+ expand: w,
940
968
  collapse: c,
941
- collapseMultiple: b,
942
- expandMultiple: p,
943
- collapseAll: v,
944
- isExpanded: k,
945
- isPending: o
969
+ collapseMultiple: h,
970
+ expandMultiple: y,
971
+ collapseAll: E,
972
+ isExpanded: I,
973
+ isPending: a
946
974
  };
947
975
  };
948
976
  export {
949
- Rt as DirectoryTree,
950
- L as directoryTreeClasses,
951
- _t as useDirectoryTreeState
977
+ Ct as DirectoryTree,
978
+ W as directoryTreeClasses,
979
+ jt as useDirectoryTreeState
952
980
  };