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