@aiquants/directory-tree 3.11.2 → 4.0.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,274 +1,274 @@
1
- import * as le from "react";
2
- import br, { useRef as ne, useEffect as he, useCallback as F, memo as ot, useState as ce, useMemo as K, useLayoutEffect as gr, Fragment as wr, useTransition as kr } from "react";
3
- import { VirtualScroll as Er, ScrollBar as Sr } from "@aiquants/virtualscroll";
4
- import { twMerge as A } from "tailwind-merge";
5
- import { FileMd as Dt, FilePdf as Ot, FileXls as Ft, FileCsv as Lt, FileDoc as $t, FilePpt as Ht, FileImage as Wt, FileAudio as Bt, FileVideo as zt, FileZip as Yt, FileCode as Gt, FileText as Vt, FileIcon as Nr } from "@phosphor-icons/react";
6
- var Ye = { exports: {} }, Pe = {};
7
- var Ut;
8
- function Ir() {
9
- if (Ut) return Pe;
10
- Ut = 1;
1
+ import * as pe from "react";
2
+ import ln, { useRef as z, useEffect as ke, useCallback as P, memo as Pt, useState as he, useMemo as U, useLayoutEffect as fr, useImperativeHandle as cn, Fragment as un, useTransition as dn } from "react";
3
+ import { VIRTUAL_SCROLL_LABEL_KEYS as it, VIRTUAL_SCROLL_LABEL_CATALOGS as mr, resolveVirtualScrollLocale as Mr, resolveVirtualScrollLabels as fn, VirtualScroll as mn, ScrollBar as hn } from "@aiquants/virtualscroll";
4
+ import { twMerge as O } from "tailwind-merge";
5
+ import { FileMd as hr, FilePdf as pr, FileXls as yr, FileCsv as br, FileDoc as gr, FilePpt as vr, FileImage as xr, FileAudio as wr, FileVideo as Sr, FileZip as Er, FileCode as Rr, FileText as kr, FileIcon as pn } from "@phosphor-icons/react";
6
+ var at = { exports: {} }, Ye = {};
7
+ var Ir;
8
+ function yn() {
9
+ if (Ir) return Ye;
10
+ Ir = 1;
11
11
  var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), t = /* @__PURE__ */ Symbol.for("react.fragment");
12
- function s(n, r, l) {
12
+ function r(n, o, l) {
13
13
  var c = null;
14
- if (l !== void 0 && (c = "" + l), r.key !== void 0 && (c = "" + r.key), "key" in r) {
14
+ if (l !== void 0 && (c = "" + l), o.key !== void 0 && (c = "" + o.key), "key" in o) {
15
15
  l = {};
16
- for (var u in r)
17
- u !== "key" && (l[u] = r[u]);
18
- } else l = r;
19
- return r = l.ref, {
16
+ for (var d in o)
17
+ d !== "key" && (l[d] = o[d]);
18
+ } else l = o;
19
+ return o = l.ref, {
20
20
  $$typeof: e,
21
21
  type: n,
22
22
  key: c,
23
- ref: r !== void 0 ? r : null,
23
+ ref: o !== void 0 ? o : null,
24
24
  props: l
25
25
  };
26
26
  }
27
- return Pe.Fragment = t, Pe.jsx = s, Pe.jsxs = s, Pe;
27
+ return Ye.Fragment = t, Ye.jsx = r, Ye.jsxs = r, Ye;
28
28
  }
29
- var _e = {};
30
- var Xt;
31
- function Rr() {
32
- return Xt || (Xt = 1, process.env.NODE_ENV !== "production" && (function() {
33
- function e(a) {
34
- if (a == null) return null;
35
- if (typeof a == "function")
36
- return a.$$typeof === $ ? null : a.displayName || a.name || null;
37
- if (typeof a == "string") return a;
38
- switch (a) {
39
- case y:
29
+ var Ve = {};
30
+ var jr;
31
+ function bn() {
32
+ return jr || (jr = 1, process.env.NODE_ENV !== "production" && (function() {
33
+ function e(s) {
34
+ if (s == null) return null;
35
+ if (typeof s == "function")
36
+ return s.$$typeof === q ? null : s.displayName || s.name || null;
37
+ if (typeof s == "string") return s;
38
+ switch (s) {
39
+ case v:
40
40
  return "Fragment";
41
- case j:
41
+ case $:
42
42
  return "Profiler";
43
43
  case k:
44
44
  return "StrictMode";
45
- case L:
45
+ case W:
46
46
  return "Suspense";
47
- case C:
47
+ case D:
48
48
  return "SuspenseList";
49
- case ee:
49
+ case le:
50
50
  return "Activity";
51
51
  }
52
- if (typeof a == "object")
53
- switch (typeof a.tag == "number" && console.error(
52
+ if (typeof s == "object")
53
+ switch (typeof s.tag == "number" && console.error(
54
54
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
55
- ), a.$$typeof) {
56
- case f:
55
+ ), s.$$typeof) {
56
+ case m:
57
57
  return "Portal";
58
- case E:
59
- return a.displayName || "Context";
60
58
  case I:
61
- return (a._context.displayName || "Context") + ".Consumer";
62
- case p:
63
- var m = a.render;
64
- return a = a.displayName, a || (a = m.displayName || m.name || "", a = a !== "" ? "ForwardRef(" + a + ")" : "ForwardRef"), a;
65
- case O:
66
- return m = a.displayName || null, m !== null ? m : e(a.type) || "Memo";
67
- case Q:
68
- m = a._payload, a = a._init;
59
+ return s.displayName || "Context";
60
+ case x:
61
+ return (s._context.displayName || "Context") + ".Consumer";
62
+ case b:
63
+ var h = s.render;
64
+ return s = s.displayName, s || (s = h.displayName || h.name || "", s = s !== "" ? "ForwardRef(" + s + ")" : "ForwardRef"), s;
65
+ case C:
66
+ return h = s.displayName || null, h !== null ? h : e(s.type) || "Memo";
67
+ case X:
68
+ h = s._payload, s = s._init;
69
69
  try {
70
- return e(a(m));
70
+ return e(s(h));
71
71
  } catch {
72
72
  }
73
73
  }
74
74
  return null;
75
75
  }
76
- function t(a) {
77
- return "" + a;
76
+ function t(s) {
77
+ return "" + s;
78
78
  }
79
- function s(a) {
79
+ function r(s) {
80
80
  try {
81
- t(a);
82
- var m = !1;
81
+ t(s);
82
+ var h = !1;
83
83
  } catch {
84
- m = !0;
84
+ h = !0;
85
85
  }
86
- if (m) {
87
- m = console;
88
- var T = m.error, M = typeof Symbol == "function" && Symbol.toStringTag && a[Symbol.toStringTag] || a.constructor.name || "Object";
89
- return T.call(
90
- m,
86
+ if (h) {
87
+ h = console;
88
+ var g = h.error, N = typeof Symbol == "function" && Symbol.toStringTag && s[Symbol.toStringTag] || s.constructor.name || "Object";
89
+ return g.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
- M
93
- ), t(a);
92
+ N
93
+ ), t(s);
94
94
  }
95
95
  }
96
- function n(a) {
97
- if (a === y) return "<>";
98
- if (typeof a == "object" && a !== null && a.$$typeof === Q)
96
+ function n(s) {
97
+ if (s === v) return "<>";
98
+ if (typeof s == "object" && s !== null && s.$$typeof === X)
99
99
  return "<...>";
100
100
  try {
101
- var m = e(a);
102
- return m ? "<" + m + ">" : "<...>";
101
+ var h = e(s);
102
+ return h ? "<" + h + ">" : "<...>";
103
103
  } catch {
104
104
  return "<...>";
105
105
  }
106
106
  }
107
- function r() {
108
- var a = J.A;
109
- return a === null ? null : a.getOwner();
107
+ function o() {
108
+ var s = Q.A;
109
+ return s === null ? null : s.getOwner();
110
110
  }
111
111
  function l() {
112
112
  return Error("react-stack-top-frame");
113
113
  }
114
- function c(a) {
115
- if (te.call(a, "key")) {
116
- var m = Object.getOwnPropertyDescriptor(a, "key").get;
117
- if (m && m.isReactWarning) return !1;
114
+ function c(s) {
115
+ if (oe.call(s, "key")) {
116
+ var h = Object.getOwnPropertyDescriptor(s, "key").get;
117
+ if (h && h.isReactWarning) return !1;
118
118
  }
119
- return a.key !== void 0;
119
+ return s.key !== void 0;
120
120
  }
121
- function u(a, m) {
122
- function T() {
123
- B || (B = !0, console.error(
121
+ function d(s, h) {
122
+ function g() {
123
+ ye || (ye = !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
- m
125
+ h
126
126
  ));
127
127
  }
128
- T.isReactWarning = !0, Object.defineProperty(a, "key", {
129
- get: T,
128
+ g.isReactWarning = !0, Object.defineProperty(s, "key", {
129
+ get: g,
130
130
  configurable: !0
131
131
  });
132
132
  }
133
- function R() {
134
- var a = e(this.type);
135
- return G[a] || (G[a] = !0, console.error(
133
+ function j() {
134
+ var s = e(this.type);
135
+ return ce[s] || (ce[s] = !0, console.error(
136
136
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
137
- )), a = this.props.ref, a !== void 0 ? a : null;
137
+ )), s = this.props.ref, s !== void 0 ? s : null;
138
138
  }
139
- function b(a, m, T, M, se, ie) {
140
- var v = T.ref;
141
- return a = {
142
- $$typeof: N,
143
- type: a,
144
- key: m,
145
- props: T,
146
- _owner: M
147
- }, (v !== void 0 ? v : null) !== null ? Object.defineProperty(a, "ref", {
139
+ function S(s, h, g, N, se, ue) {
140
+ var A = g.ref;
141
+ return s = {
142
+ $$typeof: T,
143
+ type: s,
144
+ key: h,
145
+ props: g,
146
+ _owner: N
147
+ }, (A !== void 0 ? A : null) !== null ? Object.defineProperty(s, "ref", {
148
148
  enumerable: !1,
149
- get: R
150
- }) : Object.defineProperty(a, "ref", { enumerable: !1, value: null }), a._store = {}, Object.defineProperty(a._store, "validated", {
149
+ get: j
150
+ }) : Object.defineProperty(s, "ref", { enumerable: !1, value: null }), s._store = {}, Object.defineProperty(s._store, "validated", {
151
151
  configurable: !1,
152
152
  enumerable: !1,
153
153
  writable: !0,
154
154
  value: 0
155
- }), Object.defineProperty(a, "_debugInfo", {
155
+ }), Object.defineProperty(s, "_debugInfo", {
156
156
  configurable: !1,
157
157
  enumerable: !1,
158
158
  writable: !0,
159
159
  value: null
160
- }), Object.defineProperty(a, "_debugStack", {
160
+ }), Object.defineProperty(s, "_debugStack", {
161
161
  configurable: !1,
162
162
  enumerable: !1,
163
163
  writable: !0,
164
164
  value: se
165
- }), Object.defineProperty(a, "_debugTask", {
165
+ }), Object.defineProperty(s, "_debugTask", {
166
166
  configurable: !1,
167
167
  enumerable: !1,
168
168
  writable: !0,
169
- value: ie
170
- }), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
169
+ value: ue
170
+ }), Object.freeze && (Object.freeze(s.props), Object.freeze(s)), s;
171
171
  }
172
- function d(a, m, T, M, se, ie) {
173
- var v = m.children;
174
- if (v !== void 0)
175
- if (M)
176
- if (S(v)) {
177
- for (M = 0; M < v.length; M++)
178
- h(v[M]);
179
- Object.freeze && Object.freeze(v);
172
+ function f(s, h, g, N, se, ue) {
173
+ var A = h.children;
174
+ if (A !== void 0)
175
+ if (N)
176
+ if (re(A)) {
177
+ for (N = 0; N < A.length; N++)
178
+ p(A[N]);
179
+ Object.freeze && Object.freeze(A);
180
180
  } else
181
181
  console.error(
182
182
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
183
183
  );
184
- else h(v);
185
- if (te.call(m, "key")) {
186
- v = e(a);
187
- var z = Object.keys(m).filter(function(V) {
188
- return V !== "key";
184
+ else p(A);
185
+ if (oe.call(h, "key")) {
186
+ A = e(s);
187
+ var ee = Object.keys(h).filter(function(de) {
188
+ return de !== "key";
189
189
  });
190
- M = 0 < z.length ? "{key: someKey, " + z.join(": ..., ") + ": ...}" : "{key: someKey}", P[v + M] || (z = 0 < z.length ? "{" + z.join(": ..., ") + ": ...}" : "{}", console.error(
190
+ N = 0 < ee.length ? "{key: someKey, " + ee.join(": ..., ") + ": ...}" : "{key: someKey}", _[A + N] || (ee = 0 < ee.length ? "{" + ee.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
- M,
198
- v,
199
- z,
200
- v
201
- ), P[v + M] = !0);
197
+ N,
198
+ A,
199
+ ee,
200
+ A
201
+ ), _[A + N] = !0);
202
202
  }
203
- if (v = null, T !== void 0 && (s(T), v = "" + T), c(m) && (s(m.key), v = "" + m.key), "key" in m) {
204
- T = {};
205
- for (var H in m)
206
- H !== "key" && (T[H] = m[H]);
207
- } else T = m;
208
- return v && u(
209
- T,
210
- typeof a == "function" ? a.displayName || a.name || "Unknown" : a
211
- ), b(
212
- a,
213
- v,
214
- T,
215
- r(),
203
+ if (A = null, g !== void 0 && (r(g), A = "" + g), c(h) && (r(h.key), A = "" + h.key), "key" in h) {
204
+ g = {};
205
+ for (var be in h)
206
+ be !== "key" && (g[be] = h[be]);
207
+ } else g = h;
208
+ return A && d(
209
+ g,
210
+ typeof s == "function" ? s.displayName || s.name || "Unknown" : s
211
+ ), S(
212
+ s,
213
+ A,
214
+ g,
215
+ o(),
216
216
  se,
217
- ie
217
+ ue
218
218
  );
219
219
  }
220
- function h(a) {
221
- g(a) ? a._store && (a._store.validated = 1) : typeof a == "object" && a !== null && a.$$typeof === Q && (a._payload.status === "fulfilled" ? g(a._payload.value) && a._payload.value._store && (a._payload.value._store.validated = 1) : a._store && (a._store.validated = 1));
220
+ function p(s) {
221
+ R(s) ? s._store && (s._store.validated = 1) : typeof s == "object" && s !== null && s.$$typeof === X && (s._payload.status === "fulfilled" ? R(s._payload.value) && s._payload.value._store && (s._payload.value._store.validated = 1) : s._store && (s._store.validated = 1));
222
222
  }
223
- function g(a) {
224
- return typeof a == "object" && a !== null && a.$$typeof === N;
223
+ function R(s) {
224
+ return typeof s == "object" && s !== null && s.$$typeof === T;
225
225
  }
226
- var w = br, N = /* @__PURE__ */ Symbol.for("react.transitional.element"), f = /* @__PURE__ */ Symbol.for("react.portal"), y = /* @__PURE__ */ Symbol.for("react.fragment"), k = /* @__PURE__ */ Symbol.for("react.strict_mode"), j = /* @__PURE__ */ Symbol.for("react.profiler"), I = /* @__PURE__ */ Symbol.for("react.consumer"), E = /* @__PURE__ */ Symbol.for("react.context"), p = /* @__PURE__ */ Symbol.for("react.forward_ref"), L = /* @__PURE__ */ Symbol.for("react.suspense"), C = /* @__PURE__ */ Symbol.for("react.suspense_list"), O = /* @__PURE__ */ Symbol.for("react.memo"), Q = /* @__PURE__ */ Symbol.for("react.lazy"), ee = /* @__PURE__ */ Symbol.for("react.activity"), $ = /* @__PURE__ */ Symbol.for("react.client.reference"), J = w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, te = Object.prototype.hasOwnProperty, S = Array.isArray, Y = console.createTask ? console.createTask : function() {
226
+ var E = ln, T = /* @__PURE__ */ Symbol.for("react.transitional.element"), m = /* @__PURE__ */ Symbol.for("react.portal"), v = /* @__PURE__ */ Symbol.for("react.fragment"), k = /* @__PURE__ */ Symbol.for("react.strict_mode"), $ = /* @__PURE__ */ Symbol.for("react.profiler"), x = /* @__PURE__ */ Symbol.for("react.consumer"), I = /* @__PURE__ */ Symbol.for("react.context"), b = /* @__PURE__ */ Symbol.for("react.forward_ref"), W = /* @__PURE__ */ Symbol.for("react.suspense"), D = /* @__PURE__ */ Symbol.for("react.suspense_list"), C = /* @__PURE__ */ Symbol.for("react.memo"), X = /* @__PURE__ */ Symbol.for("react.lazy"), le = /* @__PURE__ */ Symbol.for("react.activity"), q = /* @__PURE__ */ Symbol.for("react.client.reference"), Q = E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, oe = Object.prototype.hasOwnProperty, re = Array.isArray, H = console.createTask ? console.createTask : function() {
227
227
  return null;
228
228
  };
229
- w = {
230
- react_stack_bottom_frame: function(a) {
231
- return a();
229
+ E = {
230
+ react_stack_bottom_frame: function(s) {
231
+ return s();
232
232
  }
233
233
  };
234
- var B, G = {}, de = w.react_stack_bottom_frame.bind(
235
- w,
234
+ var ye, ce = {}, ie = E.react_stack_bottom_frame.bind(
235
+ E,
236
236
  l
237
- )(), ue = Y(n(l)), P = {};
238
- _e.Fragment = y, _e.jsx = function(a, m, T) {
239
- var M = 1e4 > J.recentlyCreatedOwnerStacks++;
240
- return d(
241
- a,
242
- m,
243
- T,
237
+ )(), G = H(n(l)), _ = {};
238
+ Ve.Fragment = v, Ve.jsx = function(s, h, g) {
239
+ var N = 1e4 > Q.recentlyCreatedOwnerStacks++;
240
+ return f(
241
+ s,
242
+ h,
243
+ g,
244
244
  !1,
245
- M ? Error("react-stack-top-frame") : de,
246
- M ? Y(n(a)) : ue
245
+ N ? Error("react-stack-top-frame") : ie,
246
+ N ? H(n(s)) : G
247
247
  );
248
- }, _e.jsxs = function(a, m, T) {
249
- var M = 1e4 > J.recentlyCreatedOwnerStacks++;
250
- return d(
251
- a,
252
- m,
253
- T,
248
+ }, Ve.jsxs = function(s, h, g) {
249
+ var N = 1e4 > Q.recentlyCreatedOwnerStacks++;
250
+ return f(
251
+ s,
252
+ h,
253
+ g,
254
254
  !0,
255
- M ? Error("react-stack-top-frame") : de,
256
- M ? Y(n(a)) : ue
255
+ N ? Error("react-stack-top-frame") : ie,
256
+ N ? H(n(s)) : G
257
257
  );
258
258
  };
259
- })()), _e;
259
+ })()), Ve;
260
260
  }
261
- var Jt;
262
- function jr() {
263
- return Jt || (Jt = 1, process.env.NODE_ENV === "production" ? Ye.exports = Ir() : Ye.exports = Rr()), Ye.exports;
261
+ var Nr;
262
+ function gn() {
263
+ return Nr || (Nr = 1, process.env.NODE_ENV === "production" ? at.exports = yn() : at.exports = bn()), at.exports;
264
264
  }
265
- var i = jr();
266
- function Tr({
265
+ var i = gn();
266
+ function vn({
267
267
  title: e,
268
268
  titleId: t,
269
- ...s
269
+ ...r
270
270
  }, n) {
271
- return /* @__PURE__ */ le.createElement("svg", Object.assign({
271
+ return /* @__PURE__ */ pe.createElement("svg", Object.assign({
272
272
  xmlns: "http://www.w3.org/2000/svg",
273
273
  viewBox: "0 0 24 24",
274
274
  fill: "currentColor",
@@ -276,21 +276,21 @@ function Tr({
276
276
  "data-slot": "icon",
277
277
  ref: n,
278
278
  "aria-labelledby": t
279
- }, s), e ? /* @__PURE__ */ le.createElement("title", {
279
+ }, r), e ? /* @__PURE__ */ pe.createElement("title", {
280
280
  id: t
281
- }, e) : null, /* @__PURE__ */ le.createElement("path", {
281
+ }, e) : null, /* @__PURE__ */ pe.createElement("path", {
282
282
  fillRule: "evenodd",
283
283
  d: "M12.53 16.28a.75.75 0 0 1-1.06 0l-7.5-7.5a.75.75 0 0 1 1.06-1.06L12 14.69l6.97-6.97a.75.75 0 1 1 1.06 1.06l-7.5 7.5Z",
284
284
  clipRule: "evenodd"
285
285
  }));
286
286
  }
287
- const Cr = /* @__PURE__ */ le.forwardRef(Tr);
288
- function Pr({
287
+ const xn = /* @__PURE__ */ pe.forwardRef(vn);
288
+ function wn({
289
289
  title: e,
290
290
  titleId: t,
291
- ...s
291
+ ...r
292
292
  }, n) {
293
- return /* @__PURE__ */ le.createElement("svg", Object.assign({
293
+ return /* @__PURE__ */ pe.createElement("svg", Object.assign({
294
294
  xmlns: "http://www.w3.org/2000/svg",
295
295
  viewBox: "0 0 24 24",
296
296
  fill: "currentColor",
@@ -298,21 +298,21 @@ function Pr({
298
298
  "data-slot": "icon",
299
299
  ref: n,
300
300
  "aria-labelledby": t
301
- }, s), e ? /* @__PURE__ */ le.createElement("title", {
301
+ }, r), e ? /* @__PURE__ */ pe.createElement("title", {
302
302
  id: t
303
- }, e) : null, /* @__PURE__ */ le.createElement("path", {
303
+ }, e) : null, /* @__PURE__ */ pe.createElement("path", {
304
304
  fillRule: "evenodd",
305
305
  d: "M16.28 11.47a.75.75 0 0 1 0 1.06l-7.5 7.5a.75.75 0 0 1-1.06-1.06L14.69 12 7.72 5.03a.75.75 0 0 1 1.06-1.06l7.5 7.5Z",
306
306
  clipRule: "evenodd"
307
307
  }));
308
308
  }
309
- const _r = /* @__PURE__ */ le.forwardRef(Pr);
310
- function Ar({
309
+ const Sn = /* @__PURE__ */ pe.forwardRef(wn);
310
+ function En({
311
311
  title: e,
312
312
  titleId: t,
313
- ...s
313
+ ...r
314
314
  }, n) {
315
- return /* @__PURE__ */ le.createElement("svg", Object.assign({
315
+ return /* @__PURE__ */ pe.createElement("svg", Object.assign({
316
316
  xmlns: "http://www.w3.org/2000/svg",
317
317
  viewBox: "0 0 24 24",
318
318
  fill: "currentColor",
@@ -320,39 +320,39 @@ function Ar({
320
320
  "data-slot": "icon",
321
321
  ref: n,
322
322
  "aria-labelledby": t
323
- }, s), e ? /* @__PURE__ */ le.createElement("title", {
323
+ }, r), e ? /* @__PURE__ */ pe.createElement("title", {
324
324
  id: t
325
- }, e) : null, /* @__PURE__ */ le.createElement("path", {
325
+ }, e) : null, /* @__PURE__ */ pe.createElement("path", {
326
326
  d: "M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z"
327
327
  }));
328
328
  }
329
- const Mr = /* @__PURE__ */ le.forwardRef(Ar), Ge = 18, Ve = 12, Zt = 8, D = {
329
+ const Rn = /* @__PURE__ */ pe.forwardRef(En), lt = 18, ct = 12, Tr = 8, M = {
330
330
  container: "directory-tree-container relative h-full transition-opacity duration-300 overflow-y-hidden pb-[3px] pr-[2px]",
331
331
  containerPending: "opacity-70",
332
332
  entry: "directory-tree-entry flex items-center cursor-pointer relative select-none text-xs leading-tight py-0.5",
333
333
  // ホバー時のスタイル(ライト/ダークモード対応)
334
- entryHover: A("directory-tree-entry--hover hover:bg-gray-400/15", "dark:hover:bg-gray-200/10"),
334
+ entryHover: O("directory-tree-entry--hover hover:bg-gray-400/15", "dark:hover:bg-gray-200/10"),
335
335
  // 選択時のスタイル(ライト/ダークモード対応)
336
- entrySelected: A("directory-tree-entry--selected bg-blue-400/10", "dark:bg-blue-400/15"),
336
+ entrySelected: O("directory-tree-entry--selected bg-blue-400/10", "dark:bg-blue-400/15"),
337
337
  // アイテム選択時のスタイル(ライト/ダークモード対応)
338
- 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)]"),
338
+ entryItemSelected: O("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)]"),
339
339
  // アイコンのスタイル
340
- expandIcon: A("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"),
341
- expandIconSelected: A("directory-tree-expand-icon--selected text-blue-700", "dark:text-blue-400"),
342
- typeIcon: A("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"),
343
- typeIconSelected: A("directory-tree-type-icon--selected text-blue-700", "dark:text-blue-400"),
340
+ expandIcon: O("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"),
341
+ expandIconSelected: O("directory-tree-expand-icon--selected text-blue-700", "dark:text-blue-400"),
342
+ typeIcon: O("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"),
343
+ typeIconSelected: O("directory-tree-type-icon--selected text-blue-700", "dark:text-blue-400"),
344
344
  // テキストのスタイル
345
- name: A("directory-tree-name overflow-hidden text-ellipsis whitespace-nowrap ml-1 text-xs font-normal", "text-gray-700", "dark:text-gray-200"),
345
+ name: O("directory-tree-name overflow-hidden text-ellipsis whitespace-nowrap ml-1 text-xs font-normal", "text-gray-700", "dark:text-gray-200"),
346
346
  nameDirectory: "directory-tree-name--directory font-medium",
347
- nameSelected: A("directory-tree-name--selected text-blue-800 font-semibold", "dark:text-blue-300")
348
- }, Ee = (e) => {
347
+ nameSelected: O("directory-tree-name--selected text-blue-800 font-semibold", "dark:text-blue-300")
348
+ }, Pe = (e) => {
349
349
  if (!e) return "";
350
- const t = e.split("?")[0].split("#")[0].split("/").pop() || e, s = t.lastIndexOf(".");
351
- return s <= 0 ? "" : t.slice(s + 1).toLowerCase();
352
- }, er = ({ isDirectory: e, isExpanded: t, showExpandIcons: s, useCanvasExpandIcons: n, expandIconSize: r }) => {
353
- const l = r ? { width: r, height: r } : void 0, c = r ? "" : "h-4 w-4";
354
- return !(s && e) || n ? /* @__PURE__ */ i.jsx("span", { className: c, style: l, "aria-hidden": "true" }) : t ? /* @__PURE__ */ i.jsx(Cr, { className: c, style: l }) : /* @__PURE__ */ i.jsx(_r, { className: c, style: l });
355
- }, st = (e, t) => {
350
+ const t = e.split("?")[0].split("#")[0].split("/").pop() || e, r = t.lastIndexOf(".");
351
+ return r <= 0 ? "" : t.slice(r + 1).toLowerCase();
352
+ }, $r = ({ isDirectory: e, isExpanded: t, showExpandIcons: r, useCanvasExpandIcons: n, expandIconSize: o }) => {
353
+ const l = o ? { width: o, height: o } : void 0, c = o ? "" : "h-4 w-4";
354
+ return !(r && e) || n ? /* @__PURE__ */ i.jsx("span", { className: c, style: l, "aria-hidden": "true" }) : t ? /* @__PURE__ */ i.jsx(xn, { className: c, style: l }) : /* @__PURE__ */ i.jsx(Sn, { className: c, style: l });
355
+ }, jt = (e, t) => {
356
356
  if (e == null || typeof e == "boolean") return null;
357
357
  if (typeof e == "function")
358
358
  return console.warn(`[DirectoryTree] Function returned by renderer for "${t}". Return a node.`), null;
@@ -360,578 +360,692 @@ const Mr = /* @__PURE__ */ le.forwardRef(Ar), Ge = 18, Ve = 12, Zt = 8, D = {
360
360
  if ("then" in e)
361
361
  return console.warn(`[DirectoryTree] Promise returned for "${t}". Not supported.`), null;
362
362
  if (Array.isArray(e)) {
363
- const n = e.map((r) => st(r, t)).filter(Boolean);
363
+ const n = e.map((o) => jt(o, t)).filter(Boolean);
364
364
  return n.length ? n : null;
365
365
  }
366
- const s = e.type;
367
- if (s && s.$$typeof === /* @__PURE__ */ Symbol.for("react.lazy"))
366
+ const r = e.type;
367
+ if (r && r.$$typeof === /* @__PURE__ */ Symbol.for("react.lazy"))
368
368
  return console.warn(`[DirectoryTree] Lazy component for "${t}". Not supported.`), null;
369
369
  }
370
370
  return e;
371
- }, Dr = (e, t, s) => {
372
- const n = (t || (s ? Ee(s) : "")).toLowerCase(), r = (e || "").toLowerCase();
373
- if (r && r !== "application/octet-stream") {
374
- if (r === "text/markdown" || r === "text/x-markdown")
375
- return /* @__PURE__ */ i.jsx(Dt, { className: "h-4 w-4 text-sky-500 dark:text-sky-400" });
376
- if (r === "application/pdf")
377
- return /* @__PURE__ */ i.jsx(Ot, { className: "h-4 w-4 text-red-500 dark:text-red-400" });
378
- if (r.includes("excel") || r.includes("spreadsheet") || r.includes("google-apps.spreadsheet"))
379
- return /* @__PURE__ */ i.jsx(Ft, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
380
- if (r === "text/csv" || r === "text/tab-separated-values")
381
- return /* @__PURE__ */ i.jsx(Lt, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
382
- if (r.includes("word") || r.includes("msword") || r.includes("wordprocessingml") || r.includes("google-apps.document") || r === "application/rtf")
383
- return /* @__PURE__ */ i.jsx($t, { className: "h-4 w-4 text-blue-600 dark:text-blue-400" });
384
- if (r.includes("powerpoint") || r.includes("presentation") || r.includes("google-apps.presentation"))
385
- return /* @__PURE__ */ i.jsx(Ht, { className: "h-4 w-4 text-orange-500 dark:text-orange-400" });
386
- if (r.startsWith("image/"))
387
- return /* @__PURE__ */ i.jsx(Wt, { className: "h-4 w-4 text-teal-500 dark:text-teal-400" });
388
- if (r.startsWith("audio/"))
389
- return /* @__PURE__ */ i.jsx(Bt, { className: "h-4 w-4 text-pink-500 dark:text-pink-400" });
390
- if (r.startsWith("video/"))
391
- return /* @__PURE__ */ i.jsx(zt, { className: "h-4 w-4 text-violet-500 dark:text-violet-400" });
392
- if (r.includes("zip") || r.includes("tar") || r.includes("compressed") || r.includes("archive"))
393
- return /* @__PURE__ */ i.jsx(Yt, { className: "h-4 w-4 text-amber-500 dark:text-amber-400" });
394
- 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"))
395
- return /* @__PURE__ */ i.jsx(Gt, { className: "h-4 w-4 text-purple-500 dark:text-purple-400" });
396
- if (r.startsWith("text/"))
397
- return /* @__PURE__ */ i.jsx(Vt, { className: "h-4 w-4 text-gray-500 dark:text-gray-400" });
371
+ }, kn = (e, t, r) => {
372
+ const n = (t || (r ? Pe(r) : "")).toLowerCase(), o = (e || "").toLowerCase();
373
+ if (o && o !== "application/octet-stream") {
374
+ if (o === "text/markdown" || o === "text/x-markdown")
375
+ return /* @__PURE__ */ i.jsx(hr, { className: "h-4 w-4 text-sky-500 dark:text-sky-400" });
376
+ if (o === "application/pdf")
377
+ return /* @__PURE__ */ i.jsx(pr, { className: "h-4 w-4 text-red-500 dark:text-red-400" });
378
+ if (o.includes("excel") || o.includes("spreadsheet") || o.includes("google-apps.spreadsheet"))
379
+ return /* @__PURE__ */ i.jsx(yr, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
380
+ if (o === "text/csv" || o === "text/tab-separated-values")
381
+ return /* @__PURE__ */ i.jsx(br, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
382
+ if (o.includes("word") || o.includes("msword") || o.includes("wordprocessingml") || o.includes("google-apps.document") || o === "application/rtf")
383
+ return /* @__PURE__ */ i.jsx(gr, { className: "h-4 w-4 text-blue-600 dark:text-blue-400" });
384
+ if (o.includes("powerpoint") || o.includes("presentation") || o.includes("google-apps.presentation"))
385
+ return /* @__PURE__ */ i.jsx(vr, { className: "h-4 w-4 text-orange-500 dark:text-orange-400" });
386
+ if (o.startsWith("image/"))
387
+ return /* @__PURE__ */ i.jsx(xr, { className: "h-4 w-4 text-teal-500 dark:text-teal-400" });
388
+ if (o.startsWith("audio/"))
389
+ return /* @__PURE__ */ i.jsx(wr, { className: "h-4 w-4 text-pink-500 dark:text-pink-400" });
390
+ if (o.startsWith("video/"))
391
+ return /* @__PURE__ */ i.jsx(Sr, { className: "h-4 w-4 text-violet-500 dark:text-violet-400" });
392
+ if (o.includes("zip") || o.includes("tar") || o.includes("compressed") || o.includes("archive"))
393
+ return /* @__PURE__ */ i.jsx(Er, { className: "h-4 w-4 text-amber-500 dark:text-amber-400" });
394
+ if (o === "application/json" || o.includes("javascript") || o.includes("typescript") || o.includes("xml") || o.startsWith("text/html") || o.startsWith("text/css") || o.includes("x-python") || o.includes("x-sh") || o.includes("x-go") || o.includes("x-rust"))
395
+ return /* @__PURE__ */ i.jsx(Rr, { className: "h-4 w-4 text-purple-500 dark:text-purple-400" });
396
+ if (o.startsWith("text/"))
397
+ return /* @__PURE__ */ i.jsx(kr, { className: "h-4 w-4 text-gray-500 dark:text-gray-400" });
398
398
  }
399
399
  if (n) {
400
400
  if (n === "md" || n === "markdown" || n === "mdx")
401
- return /* @__PURE__ */ i.jsx(Dt, { className: "h-4 w-4 text-sky-500 dark:text-sky-400" });
401
+ return /* @__PURE__ */ i.jsx(hr, { className: "h-4 w-4 text-sky-500 dark:text-sky-400" });
402
402
  if (n === "pdf")
403
- return /* @__PURE__ */ i.jsx(Ot, { className: "h-4 w-4 text-red-500 dark:text-red-400" });
403
+ return /* @__PURE__ */ i.jsx(pr, { className: "h-4 w-4 text-red-500 dark:text-red-400" });
404
404
  if (["xls", "xlsx", "xlsm", "xlsb", "ods"].includes(n))
405
- return /* @__PURE__ */ i.jsx(Ft, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
405
+ return /* @__PURE__ */ i.jsx(yr, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
406
406
  if (["csv", "tsv"].includes(n))
407
- return /* @__PURE__ */ i.jsx(Lt, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
407
+ return /* @__PURE__ */ i.jsx(br, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
408
408
  if (["doc", "docx", "rtf", "odt"].includes(n))
409
- return /* @__PURE__ */ i.jsx($t, { className: "h-4 w-4 text-blue-600 dark:text-blue-400" });
409
+ return /* @__PURE__ */ i.jsx(gr, { className: "h-4 w-4 text-blue-600 dark:text-blue-400" });
410
410
  if (["ppt", "pptx", "odp"].includes(n))
411
- return /* @__PURE__ */ i.jsx(Ht, { className: "h-4 w-4 text-orange-500 dark:text-orange-400" });
411
+ return /* @__PURE__ */ i.jsx(vr, { className: "h-4 w-4 text-orange-500 dark:text-orange-400" });
412
412
  if (["png", "jpg", "jpeg", "gif", "svg", "webp", "ico", "bmp", "tiff", "avif"].includes(n))
413
- return /* @__PURE__ */ i.jsx(Wt, { className: "h-4 w-4 text-teal-500 dark:text-teal-400" });
413
+ return /* @__PURE__ */ i.jsx(xr, { className: "h-4 w-4 text-teal-500 dark:text-teal-400" });
414
414
  if (["js", "mjs", "cjs", "ts", "tsx", "jsx", "json", "html", "htm", "css", "scss", "py", "go", "rs", "c", "cpp", "h", "hpp", "sh", "bash", "yaml", "yml", "sql", "xml", "toml"].includes(n))
415
- return /* @__PURE__ */ i.jsx(Gt, { className: "h-4 w-4 text-purple-500 dark:text-purple-400" });
415
+ return /* @__PURE__ */ i.jsx(Rr, { className: "h-4 w-4 text-purple-500 dark:text-purple-400" });
416
416
  if (["mp3", "wav", "ogg", "m4a", "flac", "aac", "wma"].includes(n))
417
- return /* @__PURE__ */ i.jsx(Bt, { className: "h-4 w-4 text-pink-500 dark:text-pink-400" });
417
+ return /* @__PURE__ */ i.jsx(wr, { className: "h-4 w-4 text-pink-500 dark:text-pink-400" });
418
418
  if (["mp4", "webm", "mov", "avi", "mkv", "wmv", "flv"].includes(n))
419
- return /* @__PURE__ */ i.jsx(zt, { className: "h-4 w-4 text-violet-500 dark:text-violet-400" });
419
+ return /* @__PURE__ */ i.jsx(Sr, { className: "h-4 w-4 text-violet-500 dark:text-violet-400" });
420
420
  if (["zip", "tar", "gz", "7z", "rar", "tgz", "bz2"].includes(n))
421
- return /* @__PURE__ */ i.jsx(Yt, { className: "h-4 w-4 text-amber-500 dark:text-amber-400" });
421
+ return /* @__PURE__ */ i.jsx(Er, { className: "h-4 w-4 text-amber-500 dark:text-amber-400" });
422
422
  if (["txt", "log"].includes(n))
423
- return /* @__PURE__ */ i.jsx(Vt, { className: "h-4 w-4 text-gray-500 dark:text-gray-400" });
423
+ return /* @__PURE__ */ i.jsx(kr, { className: "h-4 w-4 text-gray-500 dark:text-gray-400" });
424
424
  }
425
- return /* @__PURE__ */ i.jsx(Nr, { className: "h-4 w-4 text-gray-400 dark:text-gray-400" });
426
- }, tr = (e, t) => {
427
- const { entry: s, isDirectory: n, isExpanded: r, extension: l, mimeType: c } = e;
428
- let u;
429
- const R = c || s.mimeType;
430
- return s.icon !== void 0 ? u = s.icon : n ? u = r && t?.directoryExpanded || t?.directory || /* @__PURE__ */ i.jsx(Mr, { className: "h-4 w-4" }) : l && t?.fileByExtension?.[l] ? u = t.fileByExtension[l] : u = t?.file || Dr(R, l, s.name), st(typeof u == "function" ? u(e) : u, s.absolutePath);
431
- }, Or = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), rr = (e) => {
425
+ return /* @__PURE__ */ i.jsx(pn, { className: "h-4 w-4 text-gray-400 dark:text-gray-400" });
426
+ }, Hr = (e, t) => {
427
+ const { entry: r, isDirectory: n, isExpanded: o, extension: l, mimeType: c } = e;
428
+ let d;
429
+ const j = c || r.mimeType;
430
+ return r.icon !== void 0 ? d = r.icon : n ? d = o && t?.directoryExpanded || t?.directory || /* @__PURE__ */ i.jsx(Rn, { className: "h-4 w-4" }) : l && t?.fileByExtension?.[l] ? d = t.fileByExtension[l] : d = t?.file || kn(j, l, r.name), jt(typeof d == "function" ? d(e) : d, r.absolutePath);
431
+ }, In = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Wr = (e) => {
432
432
  if (!e)
433
433
  return;
434
- const t = Object.entries(e).filter(([, s]) => s != null);
434
+ const t = Object.entries(e).filter(([, r]) => r != null);
435
435
  if (t.length !== 0)
436
- return Object.fromEntries(t.map(([s, n]) => [`data-${Or(s)}`, String(n)]));
437
- }, Fr = 500, nr = ({ entry: e, isDirectory: t, isExpanded: s, isItemSelected: n, selectionMode: r, onSelectionChange: l, onEntryClick: c, toggleDirectory: u, onToggleDirectoryRecursive: R }) => {
438
- const b = ne(null);
439
- return he(
436
+ return Object.fromEntries(t.map(([r, n]) => [`data-${In(r)}`, String(n)]));
437
+ }, jn = 500, Br = ({ entry: e, isDirectory: t, isExpanded: r, isItemSelected: n, selectionMode: o, onSelectionChange: l, onEntryClick: c, toggleDirectory: d, onToggleDirectoryRecursive: j }) => {
438
+ const S = z(null);
439
+ return ke(
440
440
  () => () => {
441
- b.current && window.clearTimeout(b.current);
441
+ S.current && window.clearTimeout(S.current);
442
442
  },
443
443
  []
444
- ), F(
445
- (d) => {
446
- d.stopPropagation(), r !== "none" && !t && l && l(e, !n);
447
- let h = !1;
444
+ ), P(
445
+ (f) => {
446
+ f.stopPropagation(), o !== "none" && !t && l && l(e, !n);
447
+ let p = !1;
448
448
  c({
449
449
  entry: e,
450
450
  isDirectory: t,
451
- isExpanded: s,
451
+ isExpanded: r,
452
452
  preventDefault: () => {
453
- h = !0;
453
+ p = !0;
454
454
  }
455
- }), !(!t || h) && (b.current ? (window.clearTimeout(b.current), b.current = null, R(e)) : b.current = window.setTimeout(() => {
456
- u(e.absolutePath), b.current = null;
457
- }, Fr));
455
+ }), !(!t || p) && (S.current ? (window.clearTimeout(S.current), S.current = null, j(e)) : S.current = window.setTimeout(() => {
456
+ d(e.absolutePath), S.current = null;
457
+ }, jn));
458
458
  },
459
- [t, e, s, R, u, c, r, l, n]
459
+ [t, e, r, j, d, c, o, l, n]
460
460
  );
461
- }, sr = (e) => e === "right" ? "dt-grid-cell--right" : e === "center" ? "dt-grid-cell--center" : "", qt = (e, t) => e.children !== void 0 && t(e.absolutePath), ar = (e, t) => ({
461
+ }, zr = (e) => e === "right" ? "dt-grid-cell--right" : e === "center" ? "dt-grid-cell--center" : "", Pr = (e, t) => e.children !== void 0 && t(e.absolutePath), Gr = (e, t) => ({
462
462
  width: e,
463
463
  gridTemplateColumns: t
464
- }), or = ot(
464
+ }), Yr = Pt(
465
465
  ({
466
466
  entry: e,
467
467
  indentLevel: t,
468
- positionInSet: s,
468
+ positionInSet: r,
469
469
  setSize: n,
470
- rowIndex: r,
471
- isSelectedForAria: l,
472
- rowHeight: c,
473
- isDirOpen: u,
474
- columns: R,
475
- numericTemplate: b,
476
- numericTotal: d,
477
- nameWidth: h,
478
- rowClassName: g,
479
- selection: { onEntryClick: w, selectedPath: N, mode: f = "none", selectedItems: y, onSelectionChange: k },
480
- expansion: { toggleDirectory: j, onToggleDirectoryRecursive: I },
481
- visual: { iconOverrides: E, showExpandIcons: p = !0, showDirectoryIcons: L = !0, showFileIcons: C = !0, useCanvasExpandIcons: O = !1, expandIconSize: Q, indentSize: ee = Ve, highlightStyles: $ }
470
+ rowIndex: o,
471
+ flatIndex: l,
472
+ onRowFocus: c,
473
+ onRowBlur: d,
474
+ isSelectedForAria: j,
475
+ rowHeight: S,
476
+ isDirOpen: f,
477
+ columns: p,
478
+ numericTemplate: R,
479
+ numericTotal: E,
480
+ nameWidth: T,
481
+ rowClassName: m,
482
+ selection: { onEntryClick: v, selectedPath: k, currentPath: $, mode: x = "none", selectedItems: I, onSelectionChange: b },
483
+ expansion: { toggleDirectory: W, onToggleDirectoryRecursive: D },
484
+ visual: { iconOverrides: C, showExpandIcons: X = !0, showDirectoryIcons: le = !0, showFileIcons: q = !0, useCanvasExpandIcons: Q = !1, expandIconSize: oe, indentSize: re = ct, highlightStyles: H, expandIconClassName: ye, expandIconStyle: ce }
482
485
  }) => {
483
- const [J, te] = ce(!1), S = e.children !== void 0, Y = S && u(e.absolutePath), B = e.absolutePath === N, G = !S && !!y?.has(e.absolutePath), de = S ? void 0 : Ee(e.name) || Ee(e.relativePath) || Ee(e.absolutePath), ue = nr({ entry: e, isDirectory: S, isExpanded: Y, isItemSelected: G, selectionMode: f, onSelectionChange: k, onEntryClick: w, toggleDirectory: j, onToggleDirectoryRecursive: I }), P = J ? $?.hoverClassName !== void 0 ? $.hoverClassName : D.entryHover : "", a = (() => {
484
- if (S) {
485
- if (B) return $?.directorySelectedClassName !== void 0 ? $.directorySelectedClassName : D.entrySelected;
486
- } else if (B || G)
487
- return $?.itemSelectedClassName !== void 0 ? $.itemSelectedClassName : A(B && D.entrySelected, G && D.entryItemSelected);
486
+ const [ie, G] = he(!1), _ = e.children !== void 0, s = _ && f(e.absolutePath), h = e.absolutePath === k, g = e.absolutePath === $, N = !_ && !!I?.has(e.absolutePath), se = _ ? void 0 : Pe(e.name) || Pe(e.relativePath) || Pe(e.absolutePath), ue = Br({ entry: e, isDirectory: _, isExpanded: s, isItemSelected: N, selectionMode: x, onSelectionChange: b, onEntryClick: v, toggleDirectory: W, onToggleDirectoryRecursive: D }), A = ie ? H?.hoverClassName !== void 0 ? H.hoverClassName : M.entryHover : "", ee = (() => {
487
+ if (_) {
488
+ if (h) return H?.directorySelectedClassName !== void 0 ? H.directorySelectedClassName : M.entrySelected;
489
+ } else if (h || N)
490
+ return H?.itemSelectedClassName !== void 0 ? H.itemSelectedClassName : O(h && M.entrySelected, N && M.entryItemSelected);
488
491
  return "";
489
- })(), m = typeof g == "function" ? g(e) : g, T = A("dt-grid-row cursor-pointer select-none", P, a, m, e.className), M = A(D.expandIcon, (B || G) && D.expandIconSelected), se = A(D.typeIcon, (B || G) && D.typeIconSelected), ie = A("dt-grid-name-label ml-1", "text-gray-700 dark:text-gray-200", S && D.nameDirectory, (B || G) && D.nameSelected), v = er({ isDirectory: S, isExpanded: Y, showExpandIcons: p, useCanvasExpandIcons: O, expandIconSize: Q }), z = (S ? L : C) ? tr({ entry: e, isDirectory: S, isExpanded: Y, isSelected: B, isItemSelected: G, extension: de, mimeType: e.mimeType }, E) : null, H = { indentLevel: t, isDirectory: S, isExpanded: Y }, [V, ...Se] = R, pe = V?.render ? V.render(e, H) : e.label ?? e.name, be = {
490
- ...J ? $?.hoverStyle : {},
491
- ...S && B ? $?.directorySelectedStyle : {},
492
- ...!S && (B || G) ? $?.itemSelectedStyle : {}
492
+ })(), be = typeof m == "function" ? m(e) : m, de = O("dt-grid-row cursor-pointer select-none", A, ee, be, e.className), _e = O(M.expandIcon, ye, (h || N) && M.expandIconSelected), Ie = O(M.typeIcon, (h || N) && M.typeIconSelected), ne = O("dt-grid-name-label ml-1", "text-gray-700 dark:text-gray-200", _ && M.nameDirectory, (h || N) && M.nameSelected), L = $r({ isDirectory: _, isExpanded: s, showExpandIcons: X, useCanvasExpandIcons: Q, expandIconSize: oe }), fe = (_ ? le : q) ? Hr({ entry: e, isDirectory: _, isExpanded: s, isSelected: h, isItemSelected: N, extension: se, mimeType: e.mimeType }, C) : null, J = { indentLevel: t, isDirectory: _, isExpanded: s }, [Se, ...K] = p, Me = Se?.render ? Se.render(e, J) : e.label ?? e.name, je = {
493
+ ...ie ? H?.hoverStyle : {},
494
+ ..._ && h ? H?.directorySelectedStyle : {},
495
+ ...!_ && (h || N) ? H?.itemSelectedStyle : {}
493
496
  };
494
497
  return /* @__PURE__ */ i.jsxs(
495
498
  "div",
496
499
  {
497
- className: T,
498
- style: { height: c, ...be, ...e.style },
500
+ className: de,
501
+ style: { height: S, ...je, ...e.style },
499
502
  role: "row",
500
- "aria-expanded": S ? Y : void 0,
503
+ "aria-expanded": _ ? s : void 0,
501
504
  "aria-level": t + 1,
502
- "aria-posinset": s,
505
+ "aria-posinset": r,
503
506
  "aria-setsize": n,
504
- "aria-rowindex": r,
505
- "aria-selected": f === "none" ? void 0 : l,
506
- ...rr(e.data),
507
- "data-entry-type": S ? "directory" : "file",
508
- "data-entry-expanded": S ? String(Y) : void 0,
509
- "data-entry-selected": B ? "true" : void 0,
510
- "data-entry-item-selected": G ? "true" : void 0,
507
+ "aria-rowindex": o,
508
+ "aria-selected": x === "none" ? void 0 : j,
509
+ "aria-current": g ? "page" : void 0,
510
+ ...Wr(e.data),
511
+ "data-entry-type": _ ? "directory" : "file",
512
+ "data-entry-expanded": _ ? String(s) : void 0,
513
+ "data-entry-selected": h ? "true" : void 0,
514
+ "data-entry-item-selected": N ? "true" : void 0,
511
515
  onClick: ue,
512
- onMouseEnter: () => te(!0),
513
- onMouseLeave: () => te(!1),
514
- onKeyDown: (ae) => ae.key === "Enter" && ue(ae),
516
+ onMouseEnter: () => G(!0),
517
+ onMouseLeave: () => G(!1),
518
+ onFocus: (B) => c(l, e.absolutePath, B.currentTarget),
519
+ onBlur: (B) => d(e.absolutePath, B.currentTarget),
520
+ onKeyDown: (B) => {
521
+ if (B.key === "Enter") {
522
+ if (B.repeat) {
523
+ B.preventDefault();
524
+ return;
525
+ }
526
+ ue(B);
527
+ }
528
+ },
515
529
  tabIndex: 0,
516
530
  children: [
517
- /* @__PURE__ */ i.jsxs("div", { className: A("dt-grid-name-cell", V?.className), role: "gridcell", style: { width: h, paddingLeft: Math.max(0, t * ee) }, children: [
518
- (p || O) && /* @__PURE__ */ i.jsx("span", { className: M, children: v }),
519
- (S ? L : C) && /* @__PURE__ */ i.jsx("span", { className: se, children: z }),
520
- /* @__PURE__ */ i.jsx("span", { className: ie, children: pe })
531
+ /* @__PURE__ */ i.jsxs("div", { className: O("dt-grid-name-cell", Se?.className), role: "gridcell", style: { width: T, paddingLeft: Math.max(0, t * re) }, children: [
532
+ (X || Q) && /* @__PURE__ */ i.jsx("span", { className: _e, style: ce, children: L }),
533
+ (_ ? le : q) && /* @__PURE__ */ i.jsx("span", { className: Ie, children: fe }),
534
+ /* @__PURE__ */ i.jsx("span", { className: ne, children: Me })
521
535
  ] }),
522
- Se.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-track", style: ar(d, b), children: Se.map((ae) => /* @__PURE__ */ i.jsx("div", { className: A("dt-grid-cell", sr(ae.align), ae.className), role: "gridcell", children: ae.render ? ae.render(e, H) : null }, ae.key)) }) })
536
+ K.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-track", style: Gr(E, R), children: K.map((B) => /* @__PURE__ */ i.jsx("div", { className: O("dt-grid-cell", zr(B.align), B.className), role: "gridcell", children: B.render ? B.render(e, J) : null }, B.key)) }) })
523
537
  ]
524
538
  }
525
539
  );
526
540
  },
527
541
  (e, t) => {
528
542
  if (e.entry !== t.entry) return !1;
529
- const s = qt(e.entry, e.isDirOpen), n = qt(t.entry, t.isDirOpen);
530
- return e.indentLevel === t.indentLevel && e.positionInSet === t.positionInSet && e.setSize === t.setSize && e.rowIndex === t.rowIndex && e.isSelectedForAria === t.isSelectedForAria && e.rowHeight === t.rowHeight && s === 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;
543
+ const r = Pr(e.entry, e.isDirOpen), n = Pr(t.entry, t.isDirOpen);
544
+ return e.indentLevel === t.indentLevel && e.positionInSet === t.positionInSet && e.setSize === t.setSize && e.rowIndex === t.rowIndex && // 焦点の通知は行番号で行うため、番号が変われば描き直してハンドラへ新しい番号を渡す
545
+ e.flatIndex === t.flatIndex && e.isSelectedForAria === t.isSelectedForAria && e.rowHeight === t.rowHeight && r === 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.currentPath === t.selection.currentPath && e.selection.mode === t.selection.mode && e.selection.selectedItems === t.selection.selectedItems && e.visual === t.visual;
531
546
  }
532
547
  );
533
- or.displayName = "DirectoryTreeGridRow";
534
- const lr = ({
548
+ Yr.displayName = "DirectoryTreeGridRow";
549
+ const Vr = ({
535
550
  kind: e,
536
551
  columns: t,
537
- numericTemplate: s,
552
+ numericTemplate: r,
538
553
  numericTotal: n,
539
- nameWidth: r,
554
+ nameWidth: o,
540
555
  scrollBarWidth: l,
541
556
  className: c,
542
- nameContent: u,
543
- renderCell: R
557
+ nameContent: d,
558
+ renderCell: j
544
559
  }) => {
545
- const [, ...b] = t, d = e === "header" ? "dt-grid-name-header" : "dt-grid-name-footer", h = e === "header" ? "dt-grid-header" : "dt-grid-footer", g = e === "header" ? "columnheader" : "gridcell";
546
- return /* @__PURE__ */ i.jsxs("div", { className: A(h, "text-gray-600 dark:text-gray-300", c), role: "row", children: [
547
- /* @__PURE__ */ i.jsx("div", { className: A(d, "px-1", t[0]?.className), role: g, style: { width: r }, children: u }),
548
- b.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-track", style: ar(n, s), children: b.map((w) => /* @__PURE__ */ i.jsx("div", { className: A("dt-grid-cell", sr(w.align), w.className), role: g, children: R(w) }, w.key)) }) }),
560
+ const [, ...S] = t, f = e === "header" ? "dt-grid-name-header" : "dt-grid-name-footer", p = e === "header" ? "dt-grid-header" : "dt-grid-footer", R = e === "header" ? "columnheader" : "gridcell";
561
+ return /* @__PURE__ */ i.jsxs("div", { className: O(p, "text-gray-600 dark:text-gray-300", c), role: "row", children: [
562
+ /* @__PURE__ */ i.jsx("div", { className: O(f, "px-1", t[0]?.className), role: R, style: { width: o }, children: d }),
563
+ S.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-track", style: Gr(n, r), children: S.map((E) => /* @__PURE__ */ i.jsx("div", { className: O("dt-grid-cell", zr(E.align), E.className), role: R, children: j(E) }, E.key)) }) }),
549
564
  /* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: l }, "aria-hidden": "true" })
550
565
  ] });
551
- }, Lr = ({ columns: e, className: t, ...s }) => /* @__PURE__ */ i.jsx(lr, { kind: "header", columns: e, className: t, nameContent: e[0]?.header ?? null, renderCell: (n) => n.header ?? null, ...s }), Kt = (e, t) => typeof e == "function" ? e(t) : e ?? null, $r = ({ columns: e, allEntries: t, className: s, ...n }) => /* @__PURE__ */ i.jsx(lr, { kind: "footer", columns: e, className: s, nameContent: Kt(e[0]?.footer, t), renderCell: (r) => Kt(r.footer, t), ...n }), Hr = 240, ir = 96, cr = 12, at = (e, t) => {
552
- const s = e?.width;
553
- return typeof s == "number" && Number.isFinite(s) && s > 0 ? s : t;
554
- }, Wr = (e) => e.slice(1).map((t) => `${at(t, ir)}px`).join(" "), Br = ({ measuredWidth: e, columns: t, scrollBarWidth: s = cr }) => {
555
- const n = at(t[0], Hr), r = t.slice(1).reduce((R, b) => R + at(b, ir), 0), l = Number.isFinite(e) && e > 0 ? e : 0, c = Math.max(0, l - n - Math.max(0, s)), u = Math.max(0, r - c);
556
- return { nameWidth: n, numericTotal: r, numericVisible: c, maxHScroll: u };
557
- }, nt = (e, t) => !Number.isFinite(e) || e < 0 ? 0 : e > t ? t : e, zr = (e) => {
558
- const t = [], s = (n) => {
559
- for (const r of n)
560
- t.push(r), r.children && r.children.length > 0 && s(r.children);
566
+ }, Nn = ({ columns: e, className: t, ...r }) => /* @__PURE__ */ i.jsx(Vr, { kind: "header", columns: e, className: t, nameContent: e[0]?.header ?? null, renderCell: (n) => n.header ?? null, ...r }), _r = (e, t) => typeof e == "function" ? e(t) : e ?? null, Tn = ({ columns: e, allEntries: t, className: r, ...n }) => /* @__PURE__ */ i.jsx(Vr, { kind: "footer", columns: e, className: r, nameContent: _r(e[0]?.footer, t), renderCell: (o) => _r(o.footer, t), ...n }), Pn = 240, Ur = 96, Kr = 12, Nt = (e, t) => {
567
+ const r = e?.width;
568
+ return typeof r == "number" && Number.isFinite(r) && r > 0 ? r : t;
569
+ }, _n = (e) => e.slice(1).map((t) => `${Nt(t, Ur)}px`).join(" "), Cn = ({ measuredWidth: e, columns: t, scrollBarWidth: r = Kr }) => {
570
+ const n = Nt(t[0], Pn), o = t.slice(1).reduce((j, S) => j + Nt(S, Ur), 0), l = Number.isFinite(e) && e > 0 ? e : 0, c = Math.max(0, l - n - Math.max(0, r)), d = Math.max(0, o - c);
571
+ return { nameWidth: n, numericTotal: o, numericVisible: c, maxHScroll: d };
572
+ }, It = (e, t) => !Number.isFinite(e) || e < 0 ? 0 : e > t ? t : e, An = (e) => {
573
+ const t = [], r = (n) => {
574
+ for (const o of n)
575
+ t.push(o), o.children && o.children.length > 0 && r(o.children);
561
576
  };
562
- return s(e), t;
563
- }, Yr = (e, t) => {
564
- const s = e.length - 1;
565
- if (s <= 0) return 0;
566
- let n = 0, r = s - 1, l = 0;
567
- for (; n <= r; ) {
568
- const c = n + r >>> 1;
569
- e[c] <= t ? (l = c, n = c + 1) : r = c - 1;
577
+ return r(e), t;
578
+ }, Xr = ["entryKindDirectory", "entryKindFile"], Cr = [...it, ...Xr], Tt = Object.freeze({
579
+ en: Object.freeze({
580
+ entryKindDirectory: "directory",
581
+ entryKindFile: "file"
582
+ }),
583
+ ja: Object.freeze({
584
+ entryKindDirectory: "ディレクトリ",
585
+ entryKindFile: "ファイル"
586
+ })
587
+ }), On = Object.freeze({
588
+ en: Object.freeze({ ...mr.en, ...Tt.en }),
589
+ ja: Object.freeze({ ...mr.ja, ...Tt.ja })
590
+ }), Ar = (e) => typeof e == "string" ? JSON.stringify(e) : e === null ? "null" : typeof e, Ln = (e) => {
591
+ const t = {};
592
+ let r = !1;
593
+ for (const n of it) {
594
+ const o = Object.hasOwn(e, n) ? e[n] : void 0;
595
+ o !== void 0 && (t[n] = o, r = !0);
596
+ }
597
+ return r ? t : void 0;
598
+ }, Dn = (e, t) => {
599
+ const r = Mr(e);
600
+ if (t === void 0)
601
+ return On[r];
602
+ if (t === null || typeof t != "object")
603
+ throw new RangeError(`[directory-tree] labels must be an object; got ${Ar(t)}`);
604
+ const n = Object.getPrototypeOf(t);
605
+ if (n !== Object.prototype && n !== null)
606
+ throw new RangeError(`[directory-tree] labels must be a plain object (prototype Object.prototype or null); got ${Array.isArray(t) ? "an array" : "an object with a non-plain prototype"}`);
607
+ for (const c of Object.keys(t))
608
+ if (!Cr.includes(c))
609
+ throw new RangeError(`[directory-tree] labels.${c} is not a known label key; expected one of ${Cr.join(", ")}`);
610
+ const l = { ...fn(r, Ln(t)), ...Tt[r] };
611
+ for (const c of Xr) {
612
+ const d = Object.hasOwn(t, c) ? t[c] : void 0;
613
+ if (d !== void 0) {
614
+ if (typeof d != "string" || d.trim() === "")
615
+ throw new RangeError(`[directory-tree] labels.${c} must be a non-blank string; got ${Ar(d)}`);
616
+ l[c] = d;
617
+ }
618
+ }
619
+ return Object.freeze(l);
620
+ }, Fn = (e) => {
621
+ const t = {};
622
+ for (const r of it)
623
+ t[r] = e[r];
624
+ return Object.freeze(t);
625
+ }, Mn = (e, t, r, n, o) => {
626
+ const l = r + n;
627
+ return o === "visible" && t > r && e < l ? null : t - e > n ? e === r ? null : "top" : e < r ? "top" : t > l ? "bottom" : null;
628
+ }, $n = (e, t) => {
629
+ const r = e.length - 1;
630
+ if (r <= 0) return 0;
631
+ let n = 0, o = r - 1, l = 0;
632
+ for (; n <= o; ) {
633
+ const c = n + o >>> 1;
634
+ e[c] <= t ? (l = c, n = c + 1) : o = c - 1;
570
635
  }
571
636
  return l;
572
- }, Gr = (e, t, s) => {
573
- if (s <= 0 || e.length === 0 || t.length !== e.length + 1)
637
+ }, Hn = (e, t, r) => {
638
+ if (r <= 0 || e.length === 0 || t.length !== e.length + 1)
574
639
  return null;
575
- const n = Yr(t, s), r = e[n];
576
- return r ? {
577
- path: r.entry.absolutePath,
578
- offsetInViewport: s - t[n]
640
+ const n = $n(t, r), o = e[n];
641
+ return o ? {
642
+ path: o.entry.absolutePath,
643
+ offsetInViewport: r - t[n]
579
644
  } : null;
580
- }, Vr = (e, t, s) => {
581
- if (t.length === 0 || s.length !== t.length + 1)
645
+ }, Wn = (e, t, r) => {
646
+ if (t.length === 0 || r.length !== t.length + 1)
582
647
  return null;
583
648
  for (let n = 0; n < t.length; n++)
584
649
  if (t[n].entry.absolutePath === e.path)
585
- return Math.max(0, s[n] + e.offsetInViewport);
650
+ return Math.max(0, r[n] + e.offsetInViewport);
586
651
  return null;
587
- }, Ur = (e, t, s) => {
652
+ }, Bn = (e, t, r) => {
588
653
  const n = [];
589
- for (let r = t; r < s; r++) {
590
- const l = e[r];
654
+ for (let o = t; o < r; o++) {
655
+ const l = e[o];
591
656
  if (!(!l || l.length === 0))
592
657
  for (const c of l)
593
658
  n.push(c);
594
659
  }
595
660
  return n;
596
- }, Xr = (e, t, s) => {
661
+ }, zn = (e, t, r) => {
597
662
  const n = [];
598
- for (let r = t; r < s; r++) {
599
- const l = e[r];
663
+ for (let o = t; o < r; o++) {
664
+ const l = e[o];
600
665
  if (!(!l || l.length === 0))
601
666
  for (const c of l)
602
667
  n.push(c);
603
668
  }
604
669
  return n;
605
- }, Jr = (e, t, s, n) => {
606
- const r = Math.max(1, Math.floor(t * n)), l = Math.max(1, Math.floor(s * n));
607
- (e.width !== r || e.height !== l) && (e.width = r, e.height = l);
670
+ }, Gn = (e, t, r, n) => {
671
+ const o = Math.max(1, Math.floor(t * n)), l = Math.max(1, Math.floor(r * n));
672
+ (e.width !== o || e.height !== l) && (e.width = o, e.height = l);
608
673
  const c = e.style;
609
- c.width !== `${t}px` && (c.width = `${t}px`), c.height !== `${s}px` && (c.height = `${s}px`);
610
- }, Zr = (e, t, s) => {
611
- e.lineWidth = s, e.beginPath();
674
+ c.width !== `${t}px` && (c.width = `${t}px`), c.height !== `${r}px` && (c.height = `${r}px`);
675
+ }, Yn = (e, t, r) => {
676
+ e.lineWidth = r, e.beginPath();
612
677
  for (const n of t)
613
678
  e.moveTo(n.x1, n.y1), e.lineTo(n.x2, n.y2);
614
679
  e.stroke();
615
- }, qr = (e, t) => {
616
- const s = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());
617
- if (!s)
680
+ }, Vn = (e, t) => {
681
+ const r = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());
682
+ if (!r)
618
683
  return null;
619
- let n = s[1];
620
- n.length === 3 && (n = n.split("").map((u) => u + u).join(""));
621
- const r = Number.parseInt(n.slice(0, 2), 16), l = Number.parseInt(n.slice(2, 4), 16), c = Number.parseInt(n.slice(4, 6), 16);
622
- return `rgba(${r}, ${l}, ${c}, ${t})`;
623
- }, Kr = (e, t, s, n) => {
684
+ let n = r[1];
685
+ n.length === 3 && (n = n.split("").map((d) => d + d).join(""));
686
+ const o = Number.parseInt(n.slice(0, 2), 16), l = Number.parseInt(n.slice(2, 4), 16), c = Number.parseInt(n.slice(4, 6), 16);
687
+ return `rgba(${o}, ${l}, ${c}, ${t})`;
688
+ }, Un = (e, t, r, n) => {
624
689
  if (t.length === 0)
625
690
  return;
626
- const r = qr(s, 0.14), l = e.strokeStyle, c = e.fillStyle, u = e.lineWidth, R = e.lineCap, b = e.lineJoin;
627
- e.strokeStyle = s, e.lineCap = "round", e.lineJoin = "round";
628
- for (const d of t) {
629
- const h = n ?? d.size, g = Math.max(0, h / 2), w = Math.max(1, Math.round(h * 0.08)), N = Math.max(1, Math.round(h * 0.14)), f = Math.max(0, g - w * 0.8), y = Math.max(0, f * 0.55);
630
- r && (e.fillStyle = r, e.beginPath(), e.arc(d.centerX, d.centerY, f, 0, Math.PI * 2), e.fill()), e.lineWidth = w, e.beginPath(), e.arc(d.centerX, d.centerY, Math.max(0, g - w * 0.3), 0, Math.PI * 2), e.stroke(), e.lineWidth = N, e.beginPath(), e.moveTo(d.centerX - y, d.centerY), e.lineTo(d.centerX + y, d.centerY), e.stroke(), d.isExpanded || (e.beginPath(), e.moveTo(d.centerX, d.centerY - y), e.lineTo(d.centerX, d.centerY + y), e.stroke());
691
+ const o = Vn(r, 0.14), l = e.strokeStyle, c = e.fillStyle, d = e.lineWidth, j = e.lineCap, S = e.lineJoin;
692
+ e.strokeStyle = r, e.lineCap = "round", e.lineJoin = "round";
693
+ for (const f of t) {
694
+ const p = n ?? f.size, R = Math.max(0, p / 2), E = Math.max(1, Math.round(p * 0.08)), T = Math.max(1, Math.round(p * 0.14)), m = Math.max(0, R - E * 0.8), v = Math.max(0, m * 0.55);
695
+ o && (e.fillStyle = o, e.beginPath(), e.arc(f.centerX, f.centerY, m, 0, Math.PI * 2), e.fill()), e.lineWidth = E, e.beginPath(), e.arc(f.centerX, f.centerY, Math.max(0, R - E * 0.3), 0, Math.PI * 2), e.stroke(), e.lineWidth = T, e.beginPath(), e.moveTo(f.centerX - v, f.centerY), e.lineTo(f.centerX + v, f.centerY), e.stroke(), f.isExpanded || (e.beginPath(), e.moveTo(f.centerX, f.centerY - v), e.lineTo(f.centerX, f.centerY + v), e.stroke());
631
696
  }
632
- e.strokeStyle = l, e.fillStyle = c, e.lineWidth = u, e.lineCap = R, e.lineJoin = b;
633
- }, dr = ot(({ segmentsByItem: e, glyphsByItem: t, itemHeight: s, width: n, viewportHeight: r, scrollPosition: l, color: c = "#a0aec0", strokeWidth: u = 1, renderStartIndex: R, renderEndIndex: b, lookaheadEndIndex: d, devicePixelRatio: h, expandGlyphColor: g, expandGlyphSize: w }) => {
634
- const N = ne(null), f = ne(null), y = ne({
697
+ e.strokeStyle = l, e.fillStyle = c, e.lineWidth = d, e.lineCap = j, e.lineJoin = S;
698
+ }, Jr = Pt(({ segmentsByItem: e, glyphsByItem: t, itemHeight: r, width: n, viewportHeight: o, scrollPosition: l, color: c = "#a0aec0", strokeWidth: d = 1, renderStartIndex: j, renderEndIndex: S, lookaheadEndIndex: f, devicePixelRatio: p, expandGlyphColor: R, expandGlyphSize: E }) => {
699
+ const T = z(null), m = z(null), v = z({
635
700
  segmentsByItem: e,
636
701
  glyphsByItem: t,
637
- itemHeight: s,
702
+ itemHeight: r,
638
703
  width: n,
639
- viewportHeight: r,
704
+ viewportHeight: o,
640
705
  scrollPosition: l,
641
706
  color: c,
642
- strokeWidth: u,
643
- renderStartIndex: R,
644
- renderEndIndex: b,
645
- lookaheadEndIndex: d,
646
- devicePixelRatio: h,
647
- expandGlyphColor: g,
648
- expandGlyphSize: w
649
- }), k = F(() => {
650
- f.current = null;
651
- const I = N.current;
652
- if (!I)
707
+ strokeWidth: d,
708
+ renderStartIndex: j,
709
+ renderEndIndex: S,
710
+ lookaheadEndIndex: f,
711
+ devicePixelRatio: p,
712
+ expandGlyphColor: R,
713
+ expandGlyphSize: E
714
+ }), k = P(() => {
715
+ m.current = null;
716
+ const x = T.current;
717
+ if (!x)
653
718
  return;
654
- const E = I.getContext("2d");
655
- if (!E)
719
+ const I = x.getContext("2d");
720
+ if (!I)
656
721
  return;
657
- const p = y.current;
658
- if (p.width <= 0 || p.viewportHeight <= 0) {
659
- E.clearRect(0, 0, I.width, I.height);
722
+ const b = v.current;
723
+ if (b.width <= 0 || b.viewportHeight <= 0) {
724
+ I.clearRect(0, 0, x.width, x.height);
660
725
  return;
661
726
  }
662
- const L = Number.isFinite(p.devicePixelRatio ?? NaN) ? p.devicePixelRatio : typeof window < "u" && window.devicePixelRatio || 1;
663
- Jr(I, p.width, p.viewportHeight, L);
664
- const C = p.segmentsByItem.length, O = typeof p.renderStartIndex == "number" && Number.isFinite(p.renderStartIndex) ? Math.max(0, Math.floor(p.renderStartIndex)) : Math.max(0, Math.floor(p.scrollPosition / p.itemHeight)), Q = Math.min(C, Math.ceil((p.scrollPosition + p.viewportHeight) / p.itemHeight)), ee = (() => {
665
- if (typeof p.renderEndIndex == "number" && Number.isFinite(p.renderEndIndex)) {
666
- const S = Math.floor(p.renderEndIndex);
667
- return Math.max(Math.min(C, S + 1), O);
727
+ const W = Number.isFinite(b.devicePixelRatio ?? NaN) ? b.devicePixelRatio : typeof window < "u" && window.devicePixelRatio || 1;
728
+ Gn(x, b.width, b.viewportHeight, W);
729
+ const D = b.segmentsByItem.length, C = typeof b.renderStartIndex == "number" && Number.isFinite(b.renderStartIndex) ? Math.max(0, Math.floor(b.renderStartIndex)) : Math.max(0, Math.floor(b.scrollPosition / b.itemHeight)), X = Math.min(D, Math.ceil((b.scrollPosition + b.viewportHeight) / b.itemHeight)), le = (() => {
730
+ if (typeof b.renderEndIndex == "number" && Number.isFinite(b.renderEndIndex)) {
731
+ const re = Math.floor(b.renderEndIndex);
732
+ return Math.max(Math.min(D, re + 1), C);
668
733
  }
669
- return Math.max(Q, O);
670
- })(), $ = (() => {
671
- if (typeof p.lookaheadEndIndex == "number" && Number.isFinite(p.lookaheadEndIndex)) {
672
- const S = Math.floor(p.lookaheadEndIndex), Y = Math.min(C, S + 1);
673
- return Math.max(Y, ee);
734
+ return Math.max(X, C);
735
+ })(), q = (() => {
736
+ if (typeof b.lookaheadEndIndex == "number" && Number.isFinite(b.lookaheadEndIndex)) {
737
+ const re = Math.floor(b.lookaheadEndIndex), H = Math.min(D, re + 1);
738
+ return Math.max(H, le);
674
739
  }
675
- return Math.max(Q, ee);
676
- })(), J = Ur(p.segmentsByItem, O, $), te = Xr(p.glyphsByItem, O, $);
677
- E.save(), E.scale(L, L), E.clearRect(0, 0, p.width, p.viewportHeight), E.translate(0, -p.scrollPosition), E.strokeStyle = p.color, Zr(E, J, p.strokeWidth), Kr(E, te, p.expandGlyphColor ?? p.color, p.expandGlyphSize), E.restore();
678
- }, []), j = F(() => {
679
- f.current === null && (f.current = window.requestAnimationFrame(k));
740
+ return Math.max(X, le);
741
+ })(), Q = Bn(b.segmentsByItem, C, q), oe = zn(b.glyphsByItem, C, q);
742
+ I.save(), I.scale(W, W), I.clearRect(0, 0, b.width, b.viewportHeight), I.translate(0, -b.scrollPosition), I.strokeStyle = b.color, Yn(I, Q, b.strokeWidth), Un(I, oe, b.expandGlyphColor ?? b.color, b.expandGlyphSize), I.restore();
743
+ }, []), $ = P(() => {
744
+ m.current === null && (m.current = window.requestAnimationFrame(k));
680
745
  }, [k]);
681
- return he(() => {
682
- y.current = {
746
+ return ke(() => {
747
+ v.current = {
683
748
  segmentsByItem: e,
684
749
  glyphsByItem: t,
685
- itemHeight: s,
750
+ itemHeight: r,
686
751
  width: n,
687
- viewportHeight: r,
752
+ viewportHeight: o,
688
753
  scrollPosition: l,
689
754
  color: c,
690
- strokeWidth: u,
691
- renderStartIndex: R,
692
- renderEndIndex: b,
693
- lookaheadEndIndex: d,
694
- devicePixelRatio: h,
695
- expandGlyphColor: g,
696
- expandGlyphSize: w
697
- }, j();
698
- }, [e, t, s, n, r, l, c, u, R, b, d, h, g, w, j]), he(() => () => {
699
- f.current !== null && (window.cancelAnimationFrame(f.current), f.current = null);
700
- }, []), /* @__PURE__ */ i.jsx("canvas", { ref: N, className: "pointer-events-none absolute top-0 left-0 z-0" });
755
+ strokeWidth: d,
756
+ renderStartIndex: j,
757
+ renderEndIndex: S,
758
+ lookaheadEndIndex: f,
759
+ devicePixelRatio: p,
760
+ expandGlyphColor: R,
761
+ expandGlyphSize: E
762
+ }, $();
763
+ }, [e, t, r, n, o, l, c, d, j, S, f, p, R, E, $]), ke(() => () => {
764
+ m.current !== null && (window.cancelAnimationFrame(m.current), m.current = null);
765
+ }, []), /* @__PURE__ */ i.jsx("canvas", { ref: T, className: "pointer-events-none absolute top-0 left-0 z-0" });
701
766
  });
702
- dr.displayName = "TreeLineCanvas";
703
- const Qr = {
767
+ Jr.displayName = "TreeLineCanvas";
768
+ const Kn = (e) => {
769
+ const t = /* @__PURE__ */ new Map();
770
+ for (let r = 0; r < e.length; r++) {
771
+ const n = e[r].entry.absolutePath;
772
+ t.has(n) || t.set(n, r);
773
+ }
774
+ return t;
775
+ }, Or = (e, t) => e.selectedPath === t ? e : { selectedPath: t, selectionGeneration: e.selectionGeneration + 1, anchor: e.anchor }, Xn = (e, t) => ({ ...e, anchor: { path: t, selectionGeneration: e.selectionGeneration, focused: !0 } }), Jn = (e, t) => {
776
+ const { anchor: r, selectionGeneration: n, selectedPath: o } = t;
777
+ if (r !== null && (r.focused || r.selectionGeneration === n)) {
778
+ const l = e.get(r.path);
779
+ if (l !== void 0)
780
+ return l;
781
+ }
782
+ if (o !== null) {
783
+ const l = e.get(o);
784
+ if (l !== void 0)
785
+ return l;
786
+ }
787
+ return 0;
788
+ }, Zn = {
704
789
  msOverflowStyle: "none",
705
790
  scrollbarWidth: "none"
706
- }, en = () => {
791
+ }, qn = () => {
707
792
  let e = document.getElementById("directory-tree-webkit-scrollbar-hide");
708
793
  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));
709
- }, tn = (e, t, s, n, r) => {
794
+ }, Qn = (e) => {
795
+ const t = z(null), r = t.current;
796
+ return r !== null && it.every((n) => r[n] === e[n]) ? r : (t.current = e, e);
797
+ }, Lr = /* @__PURE__ */ new Set(["top", "bottom", "center", "nearest"]), Dr = (e) => {
798
+ const t = e?.align;
799
+ if (t === void 0)
800
+ return "top";
801
+ if (!Lr.has(t))
802
+ throw new RangeError(`[directory-tree] Unsupported scroll alignment ${JSON.stringify(t)}; expected one of ${[...Lr].join(", ")}.`);
803
+ return t;
804
+ }, eo = {
805
+ position: "absolute",
806
+ width: 1,
807
+ height: 1,
808
+ margin: -1,
809
+ padding: 0,
810
+ border: 0,
811
+ overflow: "hidden",
812
+ clipPath: "inset(50%)",
813
+ whiteSpace: "nowrap"
814
+ }, to = (e, t, r, n, o) => {
710
815
  const l = [], c = [];
711
- let u = 0;
712
- const R = (b, d, h) => {
713
- const g = r ? [...b].sort(r) : b;
714
- for (let w = 0; w < g.length; w++) {
715
- const N = g[w], f = w === g.length - 1, y = [...h, f], k = N.children !== void 0, j = k && t(N.absolutePath, N.relativePath);
716
- let I = d, E = y, p = h;
717
- n && (I = d - 1, E = y.slice(1), p = h.slice(1)), l.push({ entry: N, indentLevel: I, depth: d, positionInSet: w + 1, setSize: g.length, parentIsLast: E }), s && (I > u && (u = I), c.push({
718
- id: N.absolutePath,
719
- name: N.name,
720
- absolutePath: N.absolutePath,
721
- indentLevel: I,
722
- isLastChild: f,
816
+ let d = 0;
817
+ const j = (S, f, p) => {
818
+ const R = o ? [...S].sort(o) : S;
819
+ for (let E = 0; E < R.length; E++) {
820
+ const T = R[E], m = E === R.length - 1, v = [...p, m], k = T.children !== void 0, $ = k && t(T.absolutePath, T.relativePath);
821
+ let x = f, I = v, b = p;
822
+ n && (x = f - 1, I = v.slice(1), b = p.slice(1)), l.push({ entry: T, indentLevel: x, depth: f, positionInSet: E + 1, setSize: R.length, parentIsLast: I }), r && (x > d && (d = x), c.push({
823
+ id: T.absolutePath,
824
+ name: T.name,
825
+ absolutePath: T.absolutePath,
826
+ indentLevel: x,
827
+ isLastChild: m,
723
828
  isDirectory: k,
724
- isExpanded: j,
725
- ancestorIsLast: [...p],
726
- hideLines: n && d === 0
727
- })), k && j && N.children && R(N.children, d + 1, y);
829
+ isExpanded: $,
830
+ ancestorIsLast: [...b],
831
+ hideLines: n && f === 0
832
+ })), k && $ && T.children && j(T.children, f + 1, v);
728
833
  }
729
834
  };
730
- return R(e, 0, []), { flatItems: l, lineItems: c, maxIndent: u };
731
- }, Qt = (e, t) => {
732
- const s = e.length - 1;
733
- if (s <= 0) return 0;
734
- let n = 0, r = s - 1, l = 0;
735
- for (; n <= r; ) {
736
- const c = n + r >>> 1;
737
- e[c] <= t ? (l = c, n = c + 1) : r = c - 1;
835
+ return j(e, 0, []), { flatItems: l, lineItems: c, maxIndent: d };
836
+ }, Fr = (e, t) => {
837
+ const r = e.length - 1;
838
+ if (r <= 0) return 0;
839
+ let n = 0, o = r - 1, l = 0;
840
+ for (; n <= o; ) {
841
+ const c = n + o >>> 1;
842
+ e[c] <= t ? (l = c, n = c + 1) : o = c - 1;
738
843
  }
739
844
  return l;
740
- }, rn = (e, t, s, n, r, l) => {
741
- const c = n?.renderStart ?? Math.max(0, Qt(l, r)), u = t > 0 ? Qt(l, r + t) + s : c + s, R = e > 0 ? Math.min(e - 1, Math.max(c, u)) : c, b = n?.renderEnd ?? R, d = e > 0 ? Math.min(e - 1, b + s) : b;
742
- return { renderStart: c, renderEnd: b, lookaheadEnd: d };
743
- }, nn = (e, t, s, n, r, l) => {
845
+ }, ro = (e, t, r, n, o, l) => {
846
+ const c = n?.renderStart ?? Math.max(0, Fr(l, o)), d = t > 0 ? Fr(l, o + t) + r : c + r, j = e > 0 ? Math.min(e - 1, Math.max(c, d)) : c, S = n?.renderEnd ?? j, f = e > 0 ? Math.min(e - 1, S + r) : S;
847
+ return { renderStart: c, renderEnd: S, lookaheadEnd: f };
848
+ }, no = (e, t, r, n, o, l) => {
744
849
  if (e.length === 0)
745
850
  return { segmentsByItem: [], glyphsByItem: [] };
746
- const c = Array.from({ length: e.length }, () => []), u = Array.from({ length: e.length }, () => []), R = (d) => r ? typeof l == "number" && Number.isFinite(l) && l > 0 ? l : Math.max(8, Math.min(n * 0.9, d * 0.7)) : 0, b = 3;
747
- for (let d = 0; d < e.length; d++) {
748
- const h = e[d];
749
- if (h.hideLines)
851
+ const c = Array.from({ length: e.length }, () => []), d = Array.from({ length: e.length }, () => []), j = (f) => o ? typeof l == "number" && Number.isFinite(l) && l > 0 ? l : Math.max(8, Math.min(n * 0.9, f * 0.7)) : 0, S = 3;
852
+ for (let f = 0; f < e.length; f++) {
853
+ const p = e[f];
854
+ if (p.hideLines)
750
855
  continue;
751
- const g = [], w = t[d] ?? 0, N = s[d] ?? 0, f = N + w / 2, y = R(w), k = y > 0 ? y / 2 + 2 : n / 1.5;
752
- for (let E = 0; E < h.indentLevel; E++) {
753
- if (h.ancestorIsLast[E] ?? !1)
856
+ const R = [], E = t[f] ?? 0, T = r[f] ?? 0, m = T + E / 2, v = j(E), k = v > 0 ? v / 2 + 2 : n / 1.5;
857
+ for (let I = 0; I < p.indentLevel; I++) {
858
+ if (p.ancestorIsLast[I] ?? !1)
754
859
  continue;
755
- let L = !1;
756
- for (let C = d; C < e.length; C++) {
757
- const O = e[C];
758
- if (O.indentLevel > E && O.ancestorIsLast.length > E && !O.ancestorIsLast[E]) {
759
- L = !0;
860
+ let W = !1;
861
+ for (let D = f; D < e.length; D++) {
862
+ const C = e[D];
863
+ if (C.indentLevel > I && C.ancestorIsLast.length > I && !C.ancestorIsLast[I]) {
864
+ W = !0;
760
865
  break;
761
866
  }
762
- if (C > d && O.indentLevel === E)
867
+ if (D > f && C.indentLevel === I)
763
868
  break;
764
869
  }
765
- if (L) {
766
- const C = E * n + n / 2 + b;
767
- g.push({
768
- key: `${h.id}-ancestor-${E}`,
769
- x1: C,
770
- y1: N,
771
- x2: C,
772
- y2: N + w,
773
- itemIndex: d
870
+ if (W) {
871
+ const D = I * n + n / 2 + S;
872
+ R.push({
873
+ key: `${p.id}-ancestor-${I}`,
874
+ x1: D,
875
+ y1: T,
876
+ x2: D,
877
+ y2: T + E,
878
+ itemIndex: f
774
879
  });
775
880
  }
776
881
  }
777
- const j = h.indentLevel * n, I = j + n / 2 + b;
778
- if (h.isDirectory ? g.push({
779
- key: `${h.id}-connector-top`,
780
- x1: I,
781
- y1: N,
782
- x2: I,
783
- y2: f - k,
784
- itemIndex: d
785
- }) : g.push({
786
- key: `${h.id}-connector-top`,
787
- x1: I,
788
- y1: N,
789
- x2: I,
790
- y2: f,
791
- itemIndex: d
792
- }), !h.isDirectory && h.isLastChild && g.push({
793
- key: `${h.id}-connector-horizontal`,
794
- x1: I,
795
- y1: f,
796
- x2: j + n + b,
797
- y2: f,
798
- itemIndex: d
799
- }), h.isLastChild || (h.isDirectory ? g.push({
800
- key: `${h.id}-connector-bottom`,
801
- x1: I,
802
- y1: f + k,
803
- x2: I,
804
- y2: N + w,
805
- itemIndex: d
806
- }) : g.push({
807
- key: `${h.id}-connector-bottom`,
808
- x1: I,
809
- y1: f,
810
- x2: I,
811
- y2: N + w,
812
- itemIndex: d
813
- })), c[d] = g, r && h.isDirectory) {
814
- const E = y, p = I, L = f;
815
- u[d] = [
882
+ const $ = p.indentLevel * n, x = $ + n / 2 + S;
883
+ if (p.isDirectory ? R.push({
884
+ key: `${p.id}-connector-top`,
885
+ x1: x,
886
+ y1: T,
887
+ x2: x,
888
+ y2: m - k,
889
+ itemIndex: f
890
+ }) : R.push({
891
+ key: `${p.id}-connector-top`,
892
+ x1: x,
893
+ y1: T,
894
+ x2: x,
895
+ y2: m,
896
+ itemIndex: f
897
+ }), !p.isDirectory && p.isLastChild && R.push({
898
+ key: `${p.id}-connector-horizontal`,
899
+ x1: x,
900
+ y1: m,
901
+ x2: $ + n + S,
902
+ y2: m,
903
+ itemIndex: f
904
+ }), p.isLastChild || (p.isDirectory ? R.push({
905
+ key: `${p.id}-connector-bottom`,
906
+ x1: x,
907
+ y1: m + k,
908
+ x2: x,
909
+ y2: T + E,
910
+ itemIndex: f
911
+ }) : R.push({
912
+ key: `${p.id}-connector-bottom`,
913
+ x1: x,
914
+ y1: m,
915
+ x2: x,
916
+ y2: T + E,
917
+ itemIndex: f
918
+ })), c[f] = R, o && p.isDirectory) {
919
+ const I = v, b = x, W = m;
920
+ d[f] = [
816
921
  {
817
- key: `${h.id}-glyph`,
818
- itemIndex: d,
819
- centerX: p,
820
- centerY: L,
821
- size: E,
822
- isExpanded: h.isExpanded
922
+ key: `${p.id}-glyph`,
923
+ itemIndex: f,
924
+ centerX: b,
925
+ centerY: W,
926
+ size: I,
927
+ isExpanded: p.isExpanded
823
928
  }
824
929
  ];
825
930
  }
826
931
  }
827
- return { segmentsByItem: c, glyphsByItem: u };
828
- }, lt = ot(
932
+ return { segmentsByItem: c, glyphsByItem: d };
933
+ }, _t = Pt(
829
934
  ({
830
935
  entry: e,
831
936
  indentLevel: t,
832
- depth: s,
937
+ depth: r,
833
938
  positionInSet: n,
834
- setSize: r,
939
+ setSize: o,
835
940
  isSelectedForAria: l,
836
941
  flatIndex: c,
837
- isActive: u,
838
- registerRowRef: R,
839
- onNavigationKeyDown: b,
840
- rowHeight: d,
841
- isDirOpen: h,
842
- parentIsLast: g,
843
- renderChildren: w = !0,
844
- expansion: { toggleDirectory: N, onToggleDirectoryRecursive: f },
845
- selection: { onEntryClick: y, selectedPath: k, mode: j = "none", selectedItems: I, onSelectionChange: E },
942
+ isActive: d,
943
+ registerRowRef: j,
944
+ onNavigationKeyDown: S,
945
+ onRowFocus: f,
946
+ onRowBlur: p,
947
+ rowHeight: R,
948
+ entryKindDirectory: E,
949
+ entryKindFile: T,
950
+ isDirOpen: m,
951
+ parentIsLast: v,
952
+ renderChildren: k = !0,
953
+ expansion: { toggleDirectory: $, onToggleDirectoryRecursive: x },
954
+ selection: { onEntryClick: I, selectedPath: b, currentPath: W, mode: D = "none", selectedItems: C, onSelectionChange: X },
846
955
  visual: {
847
- iconOverrides: p,
848
- showExpandIcons: L = !0,
849
- showDirectoryIcons: C = !0,
850
- showFileIcons: O = !0,
851
- useCanvasExpandIcons: Q = !1,
852
- expandIconSize: ee,
853
- typeIconSize: $,
854
- fontSize: J,
855
- indentSize: te = Ve,
856
- highlightStyles: S,
857
- entryClassName: Y,
858
- entryStyle: B,
859
- nameClassName: G,
860
- nameStyle: de,
861
- directoryNameClassName: ue,
862
- directoryNameStyle: P,
863
- fileNameClassName: a,
864
- fileNameStyle: m
956
+ iconOverrides: le,
957
+ showExpandIcons: q = !0,
958
+ showDirectoryIcons: Q = !0,
959
+ showFileIcons: oe = !0,
960
+ useCanvasExpandIcons: re = !1,
961
+ expandIconSize: H,
962
+ typeIconSize: ye,
963
+ fontSize: ce,
964
+ indentSize: ie = ct,
965
+ highlightStyles: G,
966
+ entryClassName: _,
967
+ entryStyle: s,
968
+ nameClassName: h,
969
+ nameStyle: g,
970
+ directoryNameClassName: N,
971
+ directoryNameStyle: se,
972
+ fileNameClassName: ue,
973
+ fileNameStyle: A,
974
+ expandIconClassName: ee,
975
+ expandIconStyle: be
865
976
  }
866
977
  }) => {
867
- const [T, M] = ce(null), [se, ie] = ce(!1), v = e.children !== void 0, z = v && h(e.absolutePath), H = e.absolutePath === k, V = !v && I?.has(e.absolutePath), Se = v ? void 0 : Ee(e.name) || Ee(e.relativePath) || Ee(e.absolutePath);
868
- he(() => {
869
- M(z && e.children ? e.children : null);
870
- }, [z, e.children]);
871
- const pe = nr({ entry: e, isDirectory: v, isExpanded: z, isItemSelected: !!V, selectionMode: j, onSelectionChange: E, onEntryClick: y, toggleDirectory: N, onToggleDirectoryRecursive: f }), be = se ? S?.hoverClassName !== void 0 ? S.hoverClassName : D.entryHover : "", ae = (() => {
872
- if (v) {
873
- if (H)
874
- return S?.directorySelectedClassName !== void 0 ? S.directorySelectedClassName : D.entrySelected;
875
- } else if (H || V)
876
- return S?.itemSelectedClassName !== void 0 ? S.itemSelectedClassName : A(H && D.entrySelected, V && D.entryItemSelected);
978
+ const [de, _e] = he(null), [Ie, ne] = he(!1), L = e.children !== void 0, fe = L && m(e.absolutePath), J = e.absolutePath === b, Se = e.absolutePath === W, K = !L && C?.has(e.absolutePath), Me = P((Y) => j(c, Y), [j, c]), je = L ? void 0 : Pe(e.name) || Pe(e.relativePath) || Pe(e.absolutePath);
979
+ ke(() => {
980
+ _e(fe && e.children ? e.children : null);
981
+ }, [fe, e.children]);
982
+ const B = Br({ entry: e, isDirectory: L, isExpanded: fe, isItemSelected: !!K, selectionMode: D, onSelectionChange: X, onEntryClick: I, toggleDirectory: $, onToggleDirectoryRecursive: x }), ut = Ie ? G?.hoverClassName !== void 0 ? G.hoverClassName : M.entryHover : "", $e = (() => {
983
+ if (L) {
984
+ if (J)
985
+ return G?.directorySelectedClassName !== void 0 ? G.directorySelectedClassName : M.entrySelected;
986
+ } else if (J || K)
987
+ return G?.itemSelectedClassName !== void 0 ? G.itemSelectedClassName : O(J && M.entrySelected, K && M.entryItemSelected);
877
988
  return "";
878
- })(), Ue = A(D.entry, be, ae, Y, e.className), Ne = A(D.expandIcon, (H || V) && D.expandIconSelected), Ae = A(D.typeIcon, (H || V) && D.typeIconSelected), Me = A(D.name, G, v && D.nameDirectory, v && ue, !v && a, (H || V) && D.nameSelected), De = er({ isDirectory: v, isExpanded: z, showExpandIcons: L, useCanvasExpandIcons: Q, expandIconSize: ee }), Oe = (v ? C : O) ? tr({ entry: e, isDirectory: v, isExpanded: z, isSelected: H, isItemSelected: !!V, extension: Se, mimeType: e.mimeType }, p) : null, Fe = {
879
- ...se ? S?.hoverStyle : {},
880
- ...v && H ? S?.directorySelectedStyle : {},
881
- ...!v && (H || V) ? S?.itemSelectedStyle : {}
882
- }, ye = rr(e.data), Le = $ ? { width: $, height: $ } : void 0, Te = J ? { fontSize: typeof J == "number" ? `${J}px` : J } : void 0;
883
- return /* @__PURE__ */ i.jsxs(wr, { children: [
989
+ })(), He = O(M.entry, ut, $e, _, e.className), Ue = O(M.expandIcon, ee, (J || K) && M.expandIconSelected), dt = O(M.typeIcon, (J || K) && M.typeIconSelected), Ce = O(M.name, h, L && M.nameDirectory, L && N, !L && ue, (J || K) && M.nameSelected), Ke = $r({ isDirectory: L, isExpanded: fe, showExpandIcons: q, useCanvasExpandIcons: re, expandIconSize: H }), Xe = (L ? Q : oe) ? Hr({ entry: e, isDirectory: L, isExpanded: fe, isSelected: J, isItemSelected: !!K, extension: je, mimeType: e.mimeType }, le) : null, Je = {
990
+ ...Ie ? G?.hoverStyle : {},
991
+ ...L && J ? G?.directorySelectedStyle : {},
992
+ ...!L && (J || K) ? G?.itemSelectedStyle : {}
993
+ }, Ze = Wr(e.data), qe = ye ? { width: ye, height: ye } : void 0, We = ce ? { fontSize: typeof ce == "number" ? `${ce}px` : ce } : void 0;
994
+ return /* @__PURE__ */ i.jsxs(un, { children: [
884
995
  /* @__PURE__ */ i.jsxs(
885
996
  "div",
886
997
  {
887
- className: Ue,
998
+ className: He,
888
999
  style: {
889
- paddingLeft: `${Math.max(0, t * te)}px`,
890
- transform: t < 0 ? `translateX(${t * te}px)` : void 0,
891
- width: t < 0 ? `calc(100% + ${Math.abs(t * te)}px)` : void 0,
892
- height: `${d}px`,
893
- ...Te,
894
- ...Fe,
895
- ...B,
1000
+ paddingLeft: `${Math.max(0, t * ie)}px`,
1001
+ transform: t < 0 ? `translateX(${t * ie}px)` : void 0,
1002
+ width: t < 0 ? `calc(100% + ${Math.abs(t * ie)}px)` : void 0,
1003
+ height: `${R}px`,
1004
+ ...We,
1005
+ ...Je,
1006
+ ...s,
896
1007
  ...e.style
897
1008
  },
898
- ...ye,
899
- "data-entry-type": v ? "directory" : "file",
900
- "data-entry-expanded": v ? String(z) : void 0,
901
- "data-entry-selected": H ? "true" : void 0,
902
- "data-entry-item-selected": V ? "true" : void 0,
903
- onClick: pe,
904
- onMouseEnter: () => ie(!0),
905
- onMouseLeave: () => ie(!1),
906
- ref: (re) => R(c, re),
907
- onKeyDown: (re) => {
908
- if (re.key === "Enter" || re.key === " ") {
909
- re.preventDefault(), pe(re);
1009
+ ...Ze,
1010
+ "data-entry-type": L ? "directory" : "file",
1011
+ "data-entry-expanded": L ? String(fe) : void 0,
1012
+ "data-entry-selected": J ? "true" : void 0,
1013
+ "data-entry-item-selected": K ? "true" : void 0,
1014
+ onClick: B,
1015
+ onMouseEnter: () => ne(!0),
1016
+ onMouseLeave: () => ne(!1),
1017
+ onFocus: (Y) => f(c, e.absolutePath, Y.currentTarget),
1018
+ onBlur: (Y) => p(e.absolutePath, Y.currentTarget),
1019
+ ref: Me,
1020
+ onKeyDown: (Y) => {
1021
+ if (Y.key === "Enter" || Y.key === " ") {
1022
+ Y.preventDefault(), Y.repeat || B(Y);
910
1023
  return;
911
1024
  }
912
- b(re, c);
1025
+ S(Y, c);
913
1026
  },
914
- tabIndex: u ? 0 : -1,
1027
+ tabIndex: d ? 0 : -1,
915
1028
  role: "treeitem",
916
- "aria-expanded": v ? z : void 0,
917
- "aria-level": s + 1,
1029
+ "aria-expanded": L ? fe : void 0,
1030
+ "aria-level": r + 1,
918
1031
  "aria-posinset": n,
919
- "aria-setsize": r,
920
- "aria-selected": j === "none" ? void 0 : l,
921
- "aria-label": `${e.name} (${v ? "directory" : "file"})`,
1032
+ "aria-setsize": o,
1033
+ "aria-selected": D === "none" ? void 0 : l,
1034
+ "aria-current": Se ? "page" : void 0,
1035
+ "aria-label": `${e.name} (${L ? E : T})`,
922
1036
  children: [
923
- (L || Q) && /* @__PURE__ */ i.jsx("span", { className: Ne, children: De }),
924
- (v ? C : O) && /* @__PURE__ */ i.jsx("span", { className: Ae, style: Le, children: Oe }),
1037
+ (q || re) && /* @__PURE__ */ i.jsx("span", { className: Ue, style: be, children: Ke }),
1038
+ (L ? Q : oe) && /* @__PURE__ */ i.jsx("span", { className: dt, style: qe, children: Xe }),
925
1039
  /* @__PURE__ */ i.jsx(
926
1040
  "span",
927
1041
  {
928
- className: Me,
1042
+ className: Ce,
929
1043
  style: {
930
- ...Te,
931
- ...de,
932
- ...v ? P : m
1044
+ ...We,
1045
+ ...g,
1046
+ ...L ? se : A
933
1047
  },
934
- "data-entry-type": v ? "directory" : "file",
1048
+ "data-entry-type": L ? "directory" : "file",
935
1049
  "data-entry-role": "name",
936
1050
  children: e.label ?? e.name
937
1051
  }
@@ -939,555 +1053,671 @@ const Qr = {
939
1053
  ]
940
1054
  }
941
1055
  ),
942
- z && T && w && /* @__PURE__ */ i.jsx("fieldset", { children: T.map((re, Ce) => /* @__PURE__ */ i.jsx(
943
- lt,
1056
+ fe && de && k && /* @__PURE__ */ i.jsx("fieldset", { children: de.map((Y, ve) => /* @__PURE__ */ i.jsx(
1057
+ _t,
944
1058
  {
945
- entry: re,
1059
+ entry: Y,
946
1060
  indentLevel: t + 1,
947
- depth: s + 1,
948
- positionInSet: Ce + 1,
949
- setSize: T.length,
950
- isSelectedForAria: !!I?.has(re.absolutePath),
1061
+ depth: r + 1,
1062
+ positionInSet: ve + 1,
1063
+ setSize: de.length,
1064
+ isSelectedForAria: !!C?.has(Y.absolutePath),
951
1065
  flatIndex: -1,
952
1066
  isActive: !1,
953
- registerRowRef: R,
954
- onNavigationKeyDown: b,
955
- rowHeight: d,
956
- isDirOpen: h,
957
- parentIsLast: [...g, Ce === T.length - 1],
958
- expansion: { toggleDirectory: N, onToggleDirectoryRecursive: f },
959
- selection: { onEntryClick: y, selectedPath: k, mode: j, selectedItems: I, onSelectionChange: E },
1067
+ registerRowRef: j,
1068
+ onNavigationKeyDown: S,
1069
+ onRowFocus: f,
1070
+ onRowBlur: p,
1071
+ rowHeight: R,
1072
+ entryKindDirectory: E,
1073
+ entryKindFile: T,
1074
+ isDirOpen: m,
1075
+ parentIsLast: [...v, ve === de.length - 1],
1076
+ expansion: { toggleDirectory: $, onToggleDirectoryRecursive: x },
1077
+ selection: { onEntryClick: I, selectedPath: b, currentPath: W, mode: D, selectedItems: C, onSelectionChange: X },
960
1078
  visual: {
961
- iconOverrides: p,
962
- showExpandIcons: L,
963
- showDirectoryIcons: C,
964
- showFileIcons: O,
965
- useCanvasExpandIcons: Q,
966
- expandIconSize: ee,
967
- highlightStyles: S,
968
- entryClassName: Y,
969
- entryStyle: B,
970
- nameClassName: G,
971
- nameStyle: de,
972
- directoryNameClassName: ue,
973
- directoryNameStyle: P,
974
- fileNameClassName: a,
975
- fileNameStyle: m
1079
+ iconOverrides: le,
1080
+ showExpandIcons: q,
1081
+ showDirectoryIcons: Q,
1082
+ showFileIcons: oe,
1083
+ useCanvasExpandIcons: re,
1084
+ expandIconSize: H,
1085
+ highlightStyles: G,
1086
+ entryClassName: _,
1087
+ entryStyle: s,
1088
+ nameClassName: h,
1089
+ nameStyle: g,
1090
+ directoryNameClassName: N,
1091
+ directoryNameStyle: se,
1092
+ fileNameClassName: ue,
1093
+ fileNameStyle: A,
1094
+ expandIconClassName: ee,
1095
+ expandIconStyle: be
976
1096
  }
977
1097
  },
978
- re.absolutePath
1098
+ Y.absolutePath
979
1099
  )) })
980
1100
  ] }, e.absolutePath);
981
1101
  },
982
1102
  (e, t) => {
983
1103
  if (e.entry !== t.entry) return !1;
984
- const s = e.entry.children !== void 0, n = t.entry.children !== void 0, r = s && e.isDirOpen(e.entry.absolutePath), l = n && t.isDirOpen(t.entry.absolutePath);
1104
+ const r = e.entry.children !== void 0, n = t.entry.children !== void 0, o = r && e.isDirOpen(e.entry.absolutePath), l = n && t.isDirOpen(t.entry.absolutePath);
985
1105
  return e.indentLevel === t.indentLevel && // 位置情報は aria として描画されるため、変化したら再描画が必要
986
- e.depth === t.depth && e.positionInSet === t.positionInSet && e.setSize === t.setSize && e.isSelectedForAria === t.isSelectedForAria && e.flatIndex === t.flatIndex && e.isActive === t.isActive && e.rowHeight === t.rowHeight && r === 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((c, u) => c === t.parentIsLast[u]);
1106
+ e.depth === t.depth && e.positionInSet === t.positionInSet && e.setSize === t.setSize && e.isSelectedForAria === t.isSelectedForAria && e.flatIndex === t.flatIndex && e.isActive === t.isActive && e.rowHeight === t.rowHeight && // 種別語はアクセシブルネームとして描画されるため、ロケール / 上書きの変更で再描画が必要
1107
+ e.entryKindDirectory === t.entryKindDirectory && e.entryKindFile === t.entryKindFile && o === l && e.selection.selectedPath === t.selection.selectedPath && e.selection.currentPath === t.selection.currentPath && 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.visual.expandIconClassName === t.visual.expandIconClassName && e.visual.expandIconStyle === t.visual.expandIconStyle && e.parentIsLast.length === t.parentIsLast.length && e.parentIsLast.every((c, d) => c === t.parentIsLast[d]);
987
1108
  }
988
1109
  );
989
- lt.displayName = "DirectoryEntryItem";
990
- const ur = (e) => {
1110
+ _t.displayName = "DirectoryEntryItem";
1111
+ const Zr = (e) => {
991
1112
  const t = [];
992
1113
  if (e.children)
993
- for (const s of e.children)
994
- s.type === "directory" && (t.push(s.absolutePath), t.push(...ur(s)));
1114
+ for (const r of e.children)
1115
+ r.type === "directory" && (t.push(r.absolutePath), t.push(...Zr(r)));
995
1116
  return t;
996
- }, cn = ({
1117
+ }, co = ({
997
1118
  entries: e,
998
- expansion: { toggle: t, isExpanded: s, expandMultiple: n, collapseMultiple: r, isPending: l, alwaysExpanded: c = !1, doubleClickAction: u = "recursive" },
999
- selection: { onEntryClick: R, selectedPath: b, mode: d = "none", selectedItems: h, onSelectionChange: g },
1119
+ expansion: { toggle: t, isExpanded: r, expandMultiple: n, collapseMultiple: o, isPending: l, alwaysExpanded: c = !1, doubleClickAction: d = "recursive" },
1120
+ selection: { onEntryClick: j, selectedPath: S, currentPath: f, mode: p = "none", selectedItems: R, onSelectionChange: E },
1000
1121
  visual: {
1001
- className: w,
1002
- style: N,
1003
- ariaLabel: f,
1004
- ariaLabelledBy: y,
1005
- lineColor: k = "#A0AEC0",
1006
- showTreeLines: j = !0,
1122
+ className: T,
1123
+ style: m,
1124
+ ariaLabel: v,
1125
+ ariaLabelledBy: k,
1126
+ lineColor: $ = "#A0AEC0",
1127
+ showTreeLines: x = !0,
1007
1128
  showExpandIcons: I = !0,
1008
- showDirectoryIcons: E = !0,
1009
- showFileIcons: p = !0,
1010
- iconOverrides: L,
1129
+ showDirectoryIcons: b = !0,
1130
+ showFileIcons: W = !0,
1131
+ iconOverrides: D,
1011
1132
  expandIconSize: C,
1012
- itemHeight: O = Ge,
1013
- removeRootIndent: Q = !1,
1014
- highlightStyles: ee,
1015
- entryClassName: $,
1016
- entryStyle: J,
1017
- nameClassName: te,
1018
- nameStyle: S,
1019
- directoryNameClassName: Y,
1020
- directoryNameStyle: B,
1021
- fileNameClassName: G,
1022
- fileNameStyle: de
1133
+ itemHeight: X = lt,
1134
+ removeRootIndent: le = !1,
1135
+ highlightStyles: q,
1136
+ entryClassName: Q,
1137
+ entryStyle: oe,
1138
+ nameClassName: re,
1139
+ nameStyle: H,
1140
+ directoryNameClassName: ye,
1141
+ directoryNameStyle: ce,
1142
+ fileNameClassName: ie,
1143
+ fileNameStyle: G,
1144
+ expandIconClassName: _,
1145
+ expandIconStyle: s
1023
1146
  } = {},
1024
- virtualScroll: ue,
1025
- grid: P,
1026
- sort: a
1147
+ virtualScroll: h,
1148
+ grid: g,
1149
+ sort: N,
1150
+ locale: se,
1151
+ labels: ue,
1152
+ ref: A
1027
1153
  }) => {
1028
- const m = P !== void 0, [T, M] = ce(!1), se = ne(null), ie = ne(null), v = ne(null), [z, H] = ce(0), [V, Se] = ce(0), [pe, be] = ce(0), [ae, Ue] = ce(null), {
1029
- overscanCount: Ne = 15,
1030
- className: Ae,
1031
- background: Me,
1032
- onScroll: De,
1033
- onRangeChange: Oe,
1034
- initialScrollIndex: Fe,
1035
- initialScrollOffset: ye,
1036
- initialScrollAnchor: Le,
1037
- callbackThrottleMs: Te = 5,
1038
- contentInsets: re,
1039
- onItemFocus: Ce,
1040
- viewportHeightOverride: oe,
1041
- scrollBarOptions: Xe,
1042
- behaviorOptions: it,
1043
- preserveScrollAnchor: ct = !1,
1044
- getItemKey: fr,
1154
+ const ee = Mr(se), be = U(() => Dn(se, ue), [se, ue]), de = Qn(Fn(be)), { entryKindDirectory: _e, entryKindFile: Ie } = be, ne = g !== void 0, [L, fe] = he(!1), J = z(null), Se = z(null), K = z(null), [Me, je] = he(0), [B, ut] = he(0), [$e, He] = he(0), [Ue, dt] = he(null), {
1155
+ overscanCount: Ce = 15,
1156
+ className: Ke,
1157
+ background: Xe,
1158
+ onScroll: Je,
1159
+ onRangeChange: Ze,
1160
+ onScrollAdjust: qe,
1161
+ liveRegion: We,
1162
+ initialScrollIndex: Y,
1163
+ initialScrollOffset: ve,
1164
+ initialScrollAnchor: Ct,
1165
+ callbackThrottleMs: At = 5,
1166
+ contentInsets: Ot,
1167
+ onItemFocus: Lt,
1168
+ viewportHeightOverride: ae,
1169
+ scrollBarOptions: ft,
1170
+ behaviorOptions: Dt,
1171
+ preserveScrollAnchor: Ft = !1,
1172
+ getItemKey: qr,
1045
1173
  // 素通しの pass-through。型で受け付けているものは実際に転送する
1046
- // (`role="tree"` は本コンポーネント自身のコンテナに付くため contentProps とは別要素で衝突しない)
1047
- testId: dt,
1048
- contentProps: Je
1049
- } = ue ?? {}, ut = K(() => m ? { role: "rowgroup", ...Je } : Je, [m, Je]), [$e, ft] = ce(typeof ye == "number" ? ye : 0), Ze = ne(typeof ye == "number" ? ye : 0), mt = F(
1050
- (o, x) => {
1051
- Ze.current = o, ft(o), De?.(o, x);
1174
+ testId: Mt,
1175
+ contentProps: mt
1176
+ } = h ?? {}, $t = U(
1177
+ () => ne ? { ...mt, role: "rowgroup" } : { ...mt, role: "tree", "aria-label": k ? void 0 : v, "aria-labelledby": k, "aria-multiselectable": p === "multiple" ? !0 : void 0 },
1178
+ [ne, mt, v, k, p]
1179
+ ), Ht = U(() => ({ ...Dt, enableKeyboardNavigation: !1 }), [Dt]), [Qe, Wt] = he(typeof ve == "number" ? ve : 0), ht = z(typeof ve == "number" ? ve : 0), Bt = P(
1180
+ (a, u) => {
1181
+ ht.current = a, Wt(a), Je?.(a, u);
1052
1182
  },
1053
- [De]
1054
- ), ht = F(
1055
- (o) => {
1056
- const { renderingStartIndex: x, renderingEndIndex: _ } = o;
1057
- Ue((W) => W && W.renderStart === x && W.renderEnd === _ ? W : { renderStart: x, renderEnd: _ }), Oe?.(o);
1183
+ [Je]
1184
+ ), zt = P(
1185
+ (a) => {
1186
+ const { renderingStartIndex: u, renderingEndIndex: y } = a;
1187
+ dt((w) => w && w.renderStart === u && w.renderEnd === y ? w : { renderStart: u, renderEnd: y }), Ze?.(a);
1058
1188
  },
1059
- [Oe]
1189
+ [Ze]
1060
1190
  );
1061
- he(() => {
1062
- M(!0), en();
1063
- }, []), he(() => {
1064
- const o = se.current, x = m ? ie.current : o, _ = () => {
1065
- if (o) {
1066
- const U = o.clientWidth;
1067
- Se((Z) => Math.abs(Z - U) > 1 ? U : Z);
1191
+ ke(() => {
1192
+ fe(!0), qn();
1193
+ }, []), ke(() => {
1194
+ const a = J.current, u = ne ? Se.current : a, y = () => {
1195
+ if (a) {
1196
+ const F = a.clientWidth;
1197
+ ut((V) => Math.abs(V - F) > 1 ? F : V);
1068
1198
  }
1069
- if (typeof oe == "number")
1070
- H((U) => Math.abs(U - oe) > 1 ? oe : U);
1071
- else if (x) {
1072
- const U = x.clientHeight;
1073
- H((Z) => Math.abs(Z - U) > 1 ? U : Z);
1199
+ if (typeof ae == "number")
1200
+ je((F) => Math.abs(F - ae) > 1 ? ae : F);
1201
+ else if (u) {
1202
+ const F = u.clientHeight;
1203
+ je((V) => Math.abs(V - F) > 1 ? F : V);
1074
1204
  }
1075
1205
  };
1076
- if (!(o || x)) return H(0);
1077
- _();
1078
- const W = new ResizeObserver(_);
1079
- return o && W.observe(o), x && x !== o && W.observe(x), () => W.disconnect();
1080
- }, [oe, m]);
1081
- const Ie = typeof oe == "number" ? oe : z, fe = F((o) => c || (T ? s(o) : !1), [T, s, c]), pt = A(D.container, l && D.containerPending, w), yt = K(
1206
+ if (!(a || u)) return je(0);
1207
+ y();
1208
+ const w = new ResizeObserver(y);
1209
+ return a && w.observe(a), u && u !== a && w.observe(u), () => w.disconnect();
1210
+ }, [ae, ne]);
1211
+ const Ae = typeof ae == "number" ? ae : Me, ge = P((a) => c || (L ? r(a) : !1), [L, r, c]), Gt = O(M.container, l && M.containerPending, T), Yt = U(
1082
1212
  () => ({
1083
- ...Qr,
1084
- ...N ?? {},
1085
- ...typeof oe == "number" ? { height: oe, minHeight: oe } : {}
1213
+ ...Zn,
1214
+ ...m ?? {},
1215
+ ...typeof ae == "number" ? { height: ae, minHeight: ae } : {}
1086
1216
  }),
1087
- [N, oe]
1088
- ), qe = F(
1089
- (o, x) => {
1090
- const _ = [o.absolutePath, ...ur(o)], W = x || u;
1091
- if (_.every((me) => fe(me))) return r(_);
1092
- if (_.every((me) => !fe(me)) || W === "recursive") return n(_);
1093
- if (W === "toggle") return r(_);
1094
- console.warn(`[DirectoryTree] Unknown double click action: ${W}. No action taken.`);
1217
+ [m, ae]
1218
+ ), pt = P(
1219
+ (a, u) => {
1220
+ const y = [a.absolutePath, ...Zr(a)], w = u || d;
1221
+ if (y.every((me) => ge(me))) return o(y);
1222
+ if (y.every((me) => !ge(me)) || w === "recursive") return n(y);
1223
+ if (w === "toggle") return o(y);
1224
+ console.warn(`[DirectoryTree] Unknown double click action: ${w}. No action taken.`);
1095
1225
  },
1096
- [fe, n, r, u]
1097
- ), xt = m ? !1 : Q, { flatItems: ge, lineItems: Ke, maxIndent: vt } = K(() => tn(e, fe, j, xt, a), [e, fe, j, xt, a]), X = K(
1098
- () => ge.map((o, x) => {
1099
- const _ = typeof O == "function" ? O(o.entry, x) : O;
1100
- return { ...o, rowHeight: Number.isFinite(_) && _ > 0 ? _ : Ge };
1226
+ [ge, n, o, d]
1227
+ ), Vt = ne ? !1 : le, { flatItems: Ne, lineItems: yt, maxIndent: Ut } = U(() => to(e, ge, x, Vt, N), [e, ge, x, Vt, N]), Z = U(
1228
+ () => Ne.map((a, u) => {
1229
+ const y = typeof X == "function" ? X(a.entry, u) : X;
1230
+ return { ...a, rowHeight: Number.isFinite(y) && y > 0 ? y : lt };
1101
1231
  }),
1102
- [ge, O]
1103
- ), xe = K(() => X.map((o) => o.rowHeight), [X]), we = K(() => {
1104
- const o = new Array(xe.length + 1);
1105
- o[0] = 0;
1106
- for (let x = 0; x < xe.length; x++)
1107
- o[x + 1] = o[x] + xe[x];
1108
- return o;
1109
- }, [xe]), bt = F((o) => X[o]?.rowHeight ?? Ge, [X]), mr = F((o) => X[o]?.entry.absolutePath ?? o, [X]), gt = fr ?? mr, wt = ne(ge);
1110
- wt.current = ge;
1111
- const kt = ne(fe);
1112
- kt.current = fe;
1113
- const Qe = ne(t);
1114
- Qe.current = t;
1115
- const [Et, St] = ce(0), et = ne(/* @__PURE__ */ new Map()), tt = ne(null), Nt = F((o, x) => {
1116
- x ? (et.current.set(o, x), tt.current === o && (tt.current = null, x.focus())) : et.current.delete(o);
1117
- }, []), ke = F((o) => {
1118
- St(o);
1119
- const x = et.current.get(o);
1120
- if (x) {
1121
- x.focus();
1122
- return;
1232
+ [Ne, X]
1233
+ ), Ee = U(() => Z.map((a) => a.rowHeight), [Z]), xe = U(() => {
1234
+ const a = new Array(Ee.length + 1);
1235
+ a[0] = 0;
1236
+ for (let u = 0; u < Ee.length; u++)
1237
+ a[u + 1] = a[u] + Ee[u];
1238
+ return a;
1239
+ }, [Ee]), Kt = P((a) => Z[a]?.rowHeight ?? lt, [Z]), Qr = P((a) => Z[a]?.entry.absolutePath ?? a, [Z]), Xt = qr ?? Qr, Oe = S ?? null, bt = f ?? null, [Jt, Be] = he(() => ({ selectedPath: Oe, selectionGeneration: 0, anchor: null })), gt = Or(Jt, Oe);
1240
+ gt !== Jt && Be((a) => Or(a, Oe));
1241
+ const et = U(() => Kn(Ne), [Ne]), Le = U(() => Jn(et, gt), [et, gt]), ze = z(/* @__PURE__ */ new Map()), tt = z(null), Ge = z(null), [en, Zt] = he(!0), vt = z(Ne);
1242
+ vt.current = Ne;
1243
+ const qt = z(ge);
1244
+ qt.current = ge;
1245
+ const xt = z(t);
1246
+ xt.current = t;
1247
+ const Qt = z(et);
1248
+ Qt.current = et;
1249
+ const er = z(xe);
1250
+ er.current = xe;
1251
+ const wt = z(Le);
1252
+ wt.current = Le;
1253
+ const tr = z(Lt);
1254
+ tr.current = Lt;
1255
+ const Te = P((a, u) => {
1256
+ const y = K.current, w = er.current;
1257
+ if (!y || a < 0 || a >= w.length - 1)
1258
+ return !1;
1259
+ const F = y.getScrollPosition(), V = y.getViewportSize();
1260
+ if (F < 0 || V <= 0)
1261
+ return !1;
1262
+ const me = Mn(w[a], w[a + 1], F, V, u);
1263
+ return me === null ? !1 : (y.scrollToIndex(a, { align: me }), !0);
1264
+ }, []), we = P(
1265
+ (a) => {
1266
+ const u = ze.current.get(a);
1267
+ if (u === void 0) {
1268
+ Ge.current = a, Te(a, "whole") || (Ge.current = null);
1269
+ return;
1270
+ }
1271
+ Ge.current = null, Te(a, "whole"), u.focus({ preventScroll: !0 });
1272
+ },
1273
+ [Te]
1274
+ ), rr = P((a, u) => {
1275
+ if (u)
1276
+ ze.current.set(a, u), Ge.current === a ? (Ge.current = null, u.focus({ preventScroll: !0 })) : u.contains(u.ownerDocument.activeElement) && Be((y) => y.anchor === null ? y : { ...y, anchor: { ...y.anchor, focused: !0 } });
1277
+ else {
1278
+ const y = ze.current.get(a);
1279
+ ze.current.delete(a), y?.contains(y.ownerDocument.activeElement) && Be((w) => w.anchor === null ? w : { ...w, anchor: { ...w.anchor, focused: !1 } });
1123
1280
  }
1124
- tt.current = o, v.current?.scrollToIndex(o);
1281
+ a === wt.current && Zt(u !== null);
1125
1282
  }, []);
1126
- he(() => {
1127
- St((o) => ge.length === 0 ? 0 : Math.min(o, ge.length - 1));
1128
- }, [ge.length]);
1129
- const It = F(
1130
- (o, x) => {
1131
- const _ = wt.current, W = _.length - 1;
1132
- if (W < 0) return;
1133
- const U = _[x], Z = U?.entry.children !== void 0, me = Z && kt.current(U.entry.absolutePath);
1134
- switch (o.key) {
1283
+ fr(() => {
1284
+ Zt(ze.current.has(Le));
1285
+ }, [Le]);
1286
+ const St = P(
1287
+ (a, u, y) => {
1288
+ const w = tt.current === y;
1289
+ tt.current = null, w || (Be((F) => Xn(F, u)), Te(a, "visible")), tr.current?.(a);
1290
+ },
1291
+ [Te]
1292
+ ), Et = P((a, u) => {
1293
+ const { ownerDocument: y } = u;
1294
+ if (!y.hasFocus() && u.contains(y.activeElement)) {
1295
+ tt.current = u;
1296
+ return;
1297
+ }
1298
+ tt.current = null, Be((w) => w.anchor !== null && w.anchor.path === a ? { ...w, anchor: { ...w.anchor, focused: !1 } } : w);
1299
+ }, []), tn = P(() => we(wt.current), [we]), Rt = P(
1300
+ (a, u) => {
1301
+ const y = Dr(u), w = vt.current.length;
1302
+ if (!Number.isInteger(a) || a < 0 || a >= w)
1303
+ throw new RangeError(`[directory-tree] scrollToIndex: ${String(a)} is not a row index (${w === 0 ? "the tree has no rows" : `expected an integer in 0..${String(w - 1)}`}).`);
1304
+ if (y === "nearest") {
1305
+ Te(a, "whole");
1306
+ return;
1307
+ }
1308
+ K.current?.scrollToIndex(a, { align: y });
1309
+ },
1310
+ [Te]
1311
+ );
1312
+ cn(
1313
+ A,
1314
+ () => ({
1315
+ scrollToIndex: Rt,
1316
+ scrollToPath: (a, u) => {
1317
+ Dr(u);
1318
+ const y = Qt.current.get(a);
1319
+ return y === void 0 ? !1 : (Rt(y, u), !0);
1320
+ },
1321
+ getScrollAnchor: () => K.current?.getScrollAnchor() ?? null
1322
+ }),
1323
+ [Rt]
1324
+ );
1325
+ const nr = P(
1326
+ (a, u) => {
1327
+ if (a.altKey || a.ctrlKey || a.metaKey)
1328
+ return;
1329
+ const y = vt.current, w = y.length - 1;
1330
+ if (w < 0) return;
1331
+ const F = y[u], V = F?.entry.children !== void 0, me = V && qt.current(F.entry.absolutePath);
1332
+ switch (a.key) {
1135
1333
  case "ArrowDown":
1136
- o.preventDefault(), ke(Math.min(x + 1, W));
1334
+ a.preventDefault(), we(Math.min(u + 1, w));
1137
1335
  break;
1138
1336
  case "ArrowUp":
1139
- o.preventDefault(), ke(Math.max(x - 1, 0));
1337
+ a.preventDefault(), we(Math.max(u - 1, 0));
1140
1338
  break;
1141
1339
  case "Home":
1142
- o.preventDefault(), ke(0);
1340
+ a.preventDefault(), we(0);
1143
1341
  break;
1144
1342
  case "End":
1145
- o.preventDefault(), ke(W);
1343
+ a.preventDefault(), we(w);
1146
1344
  break;
1147
1345
  case "ArrowRight":
1148
- o.preventDefault(), Z && !me ? Qe.current(U.entry.absolutePath) : Z && x < W && ke(x + 1);
1346
+ a.preventDefault(), V && !me ? xt.current(F.entry.absolutePath) : V && u < w && y[u + 1].depth > F.depth && we(u + 1);
1149
1347
  break;
1150
1348
  case "ArrowLeft": {
1151
- if (o.preventDefault(), Z && me) {
1152
- Qe.current(U.entry.absolutePath);
1349
+ if (a.preventDefault(), V && me) {
1350
+ xt.current(F.entry.absolutePath);
1153
1351
  break;
1154
1352
  }
1155
- const vr = U?.depth ?? 0;
1156
- for (let ze = x - 1; ze >= 0; ze--)
1157
- if (_[ze].depth < vr) {
1158
- ke(ze);
1353
+ const an = F?.depth ?? 0;
1354
+ for (let st = u - 1; st >= 0; st--)
1355
+ if (y[st].depth < an) {
1356
+ we(st);
1159
1357
  break;
1160
1358
  }
1161
1359
  break;
1162
1360
  }
1163
1361
  }
1164
1362
  },
1165
- [ke]
1166
- ), He = K(
1167
- () => !j || Ke.length === 0 ? { segmentsByItem: [], glyphsByItem: [] } : nn(Ke, xe, we, Ve, j, C ?? Zt),
1168
- [Ke, xe, we, j, C]
1169
- ), We = K(() => !j || e.length === 0 ? 0 : (vt + 2) * Ve, [e.length, vt, j]), { renderStart: Rt, renderEnd: jt, lookaheadEnd: Tt } = K(
1170
- () => rn(X.length, Ie, Ne, ae, $e, we),
1171
- [X.length, Ie, Ne, ae, $e, we]
1172
- ), rt = K(() => !j || We <= 0 || Ie <= 0 || He.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: We, height: Ie }, children: /* @__PURE__ */ i.jsx(
1173
- dr,
1363
+ [we]
1364
+ ), rt = U(
1365
+ () => !x || yt.length === 0 ? { segmentsByItem: [], glyphsByItem: [] } : no(yt, Ee, xe, ct, x, C ?? Tr),
1366
+ [yt, Ee, xe, x, C]
1367
+ ), nt = U(() => !x || e.length === 0 ? 0 : (Ut + 2) * ct, [e.length, Ut, x]), { renderStart: or, renderEnd: sr, lookaheadEnd: ar } = U(
1368
+ () => ro(Z.length, Ae, Ce, Ue, Qe, xe),
1369
+ [Z.length, Ae, Ce, Ue, Qe, xe]
1370
+ ), kt = U(() => !x || nt <= 0 || Ae <= 0 || rt.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: nt, height: Ae }, children: /* @__PURE__ */ i.jsx(
1371
+ Jr,
1174
1372
  {
1175
- segmentsByItem: He.segmentsByItem,
1176
- glyphsByItem: He.glyphsByItem,
1177
- itemHeight: xe[0] ?? Ge,
1178
- width: We,
1179
- viewportHeight: Ie,
1180
- scrollPosition: $e,
1181
- color: k,
1182
- expandGlyphColor: k,
1183
- expandGlyphSize: C ?? Zt,
1184
- renderStartIndex: Rt,
1185
- renderEndIndex: jt,
1186
- lookaheadEndIndex: Tt
1373
+ segmentsByItem: rt.segmentsByItem,
1374
+ glyphsByItem: rt.glyphsByItem,
1375
+ itemHeight: Ee[0] ?? lt,
1376
+ width: nt,
1377
+ viewportHeight: Ae,
1378
+ scrollPosition: Qe,
1379
+ color: $,
1380
+ expandGlyphColor: $,
1381
+ expandGlyphSize: C ?? Tr,
1382
+ renderStartIndex: or,
1383
+ renderEndIndex: sr,
1384
+ lookaheadEndIndex: ar
1187
1385
  }
1188
- ) }) }), [We, Ie, Rt, jt, Tt, $e, He, k, j, C, xe]), Ct = F((o) => X[o], [X]), Pt = ne(null);
1189
- gr(() => {
1190
- const o = Pt.current;
1191
- if (Pt.current = { items: X, offsets: we }, !ct || !o || o.items === X)
1386
+ ) }) }), [nt, Ae, or, sr, ar, Qe, rt, $, x, C, Ee]), lr = P((a) => Z[a], [Z]), cr = z(null);
1387
+ fr(() => {
1388
+ const a = cr.current;
1389
+ if (cr.current = { items: Z, offsets: xe }, !Ft || !a || a.items === Z)
1192
1390
  return;
1193
- const x = v.current, _ = x?.getScrollPosition(), W = typeof _ == "number" && _ >= 0 ? _ : Ze.current, U = Gr(o.items, o.offsets, W);
1194
- if (!U)
1391
+ const u = K.current, y = u?.getScrollPosition(), w = typeof y == "number" && y >= 0 ? y : ht.current, F = Hn(a.items, a.offsets, w);
1392
+ if (!F)
1195
1393
  return;
1196
- const Z = Vr(U, X, we);
1197
- if (Z === null || Math.abs(Z - W) < 1)
1394
+ const V = Wn(F, Z, xe);
1395
+ if (V === null || Math.abs(V - w) < 1)
1198
1396
  return;
1199
- const me = x ? x.scrollTo(Z) : Z;
1200
- Ze.current = me, ft(me);
1201
- }, [X, we, ct]);
1202
- const ve = P?.columns, Re = P?.scrollBarWidth ?? Xe?.width ?? cr, q = K(() => ve ? Br({ measuredWidth: V, columns: ve, scrollBarWidth: Re }) : null, [ve, V, Re]), Be = K(() => ve ? Wr(ve) : "", [ve]), hr = K(() => P?.showFooter && ve ? zr(e) : [], [P?.showFooter, ve, e]), je = q?.maxHScroll ?? 0;
1203
- he(() => {
1204
- be((o) => nt(o, je));
1205
- }, [je]);
1206
- const _t = F((o) => be((x) => nt(x + o, je)), [je]), At = K(
1207
- () => ({ iconOverrides: L, showExpandIcons: I, showDirectoryIcons: E, showFileIcons: p, useCanvasExpandIcons: j, expandIconSize: C, highlightStyles: ee }),
1208
- [L, I, E, p, j, C, ee]
1209
- ), Mt = K(
1397
+ const me = u ? u.scrollTo(V) : V;
1398
+ ht.current = me, Wt(me);
1399
+ }, [Z, xe, Ft]);
1400
+ const Re = g?.columns, De = g?.scrollBarWidth ?? ft?.width ?? Kr, te = U(() => Re ? Cn({ measuredWidth: B, columns: Re, scrollBarWidth: De }) : null, [Re, B, De]), ot = U(() => Re ? _n(Re) : "", [Re]), rn = U(() => g?.showFooter && Re ? An(e) : [], [g?.showFooter, Re, e]), Fe = te?.maxHScroll ?? 0;
1401
+ ke(() => {
1402
+ He((a) => It(a, Fe));
1403
+ }, [Fe]);
1404
+ const ir = P((a) => He((u) => It(u + a, Fe)), [Fe]), ur = U(
1405
+ () => ({ iconOverrides: D, showExpandIcons: I, showDirectoryIcons: b, showFileIcons: W, useCanvasExpandIcons: x, expandIconSize: C, highlightStyles: q, expandIconClassName: _, expandIconStyle: s }),
1406
+ [D, I, b, W, x, C, q, _, s]
1407
+ ), dr = U(
1210
1408
  () => /* @__PURE__ */ i.jsx(
1211
- Er,
1409
+ mn,
1212
1410
  {
1213
- ref: v,
1214
- itemCount: X.length,
1215
- getItem: Ct,
1216
- getItemHeight: bt,
1217
- getItemKey: gt,
1218
- testId: dt,
1219
- contentProps: ut,
1220
- viewportSize: typeof oe == "number" ? oe : void 0,
1221
- overscanCount: Ne,
1222
- onScroll: mt,
1223
- onRangeChange: ht,
1224
- className: Ae,
1225
- onWheelHorizontal: m ? _t : void 0,
1411
+ ref: K,
1412
+ itemCount: Z.length,
1413
+ getItem: lr,
1414
+ getItemHeight: Kt,
1415
+ getItemKey: Xt,
1416
+ testId: Mt,
1417
+ contentProps: $t,
1418
+ locale: ee,
1419
+ labels: de,
1420
+ viewportSize: typeof ae == "number" ? ae : void 0,
1421
+ overscanCount: Ce,
1422
+ onScroll: Bt,
1423
+ onRangeChange: zt,
1424
+ onScrollAdjust: qe,
1425
+ liveRegion: We,
1426
+ className: Ke,
1427
+ onWheelHorizontal: ne ? ir : void 0,
1226
1428
  background: /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
1227
- m && q ? (
1429
+ ne && te ? (
1228
1430
  // Clip the connector-line canvas to the frozen name column so deep trees never bleed into the numeric region.
1229
- /* @__PURE__ */ i.jsx("div", { className: "pointer-events-none absolute top-0 left-0 z-0 h-full overflow-hidden", style: { width: q.nameWidth }, "aria-hidden": "true", children: rt })
1230
- ) : rt,
1231
- Me
1431
+ /* @__PURE__ */ i.jsx("div", { className: "pointer-events-none absolute top-0 left-0 z-0 h-full overflow-hidden", style: { width: te.nameWidth }, "aria-hidden": "true", children: kt })
1432
+ ) : kt,
1433
+ Xe
1232
1434
  ] }),
1233
- initialScrollIndex: Fe,
1234
- initialScrollOffset: ye,
1235
- initialScrollAnchor: Le,
1236
- onItemFocus: Ce,
1237
- callbackThrottleMs: Te,
1238
- contentInsets: re,
1239
- scrollBarOptions: Xe,
1240
- behaviorOptions: it,
1241
- children: (o, x) => o ? m && P && q ? /* @__PURE__ */ i.jsx(
1242
- or,
1435
+ initialScrollIndex: Y,
1436
+ initialScrollOffset: ve,
1437
+ initialScrollAnchor: Ct,
1438
+ callbackThrottleMs: At,
1439
+ contentInsets: Ot,
1440
+ scrollBarOptions: ft,
1441
+ behaviorOptions: Ht,
1442
+ children: (a, u) => a ? ne && g && te ? /* @__PURE__ */ i.jsx(
1443
+ Yr,
1243
1444
  {
1244
- entry: o.entry,
1245
- indentLevel: o.indentLevel,
1246
- positionInSet: o.positionInSet,
1247
- setSize: o.setSize,
1248
- rowIndex: x + (P.showHeader ?? !0 ? 2 : 1),
1249
- isSelectedForAria: !!h?.has(o.entry.absolutePath),
1250
- rowHeight: o.rowHeight,
1251
- isDirOpen: fe,
1252
- columns: P.columns,
1253
- numericTemplate: Be,
1254
- numericTotal: q.numericTotal,
1255
- nameWidth: q.nameWidth,
1256
- rowClassName: P.rowClassName,
1257
- selection: { onEntryClick: R, selectedPath: b ?? null, mode: d, selectedItems: h, onSelectionChange: g },
1258
- expansion: { toggleDirectory: t, onToggleDirectoryRecursive: qe },
1259
- visual: At
1445
+ entry: a.entry,
1446
+ indentLevel: a.indentLevel,
1447
+ positionInSet: a.positionInSet,
1448
+ setSize: a.setSize,
1449
+ rowIndex: u + (g.showHeader ?? !0 ? 2 : 1),
1450
+ flatIndex: u,
1451
+ onRowFocus: St,
1452
+ onRowBlur: Et,
1453
+ isSelectedForAria: !!R?.has(a.entry.absolutePath),
1454
+ rowHeight: a.rowHeight,
1455
+ isDirOpen: ge,
1456
+ columns: g.columns,
1457
+ numericTemplate: ot,
1458
+ numericTotal: te.numericTotal,
1459
+ nameWidth: te.nameWidth,
1460
+ rowClassName: g.rowClassName,
1461
+ selection: { onEntryClick: j, selectedPath: Oe, currentPath: bt, mode: p, selectedItems: R, onSelectionChange: E },
1462
+ expansion: { toggleDirectory: t, onToggleDirectoryRecursive: pt },
1463
+ visual: ur
1260
1464
  },
1261
- o.entry.absolutePath
1465
+ a.entry.absolutePath
1262
1466
  ) : /* @__PURE__ */ i.jsx(
1263
- lt,
1467
+ _t,
1264
1468
  {
1265
- entry: o.entry,
1266
- indentLevel: o.indentLevel,
1267
- depth: o.depth,
1268
- positionInSet: o.positionInSet,
1269
- setSize: o.setSize,
1270
- isSelectedForAria: !!h?.has(o.entry.absolutePath),
1271
- flatIndex: x,
1272
- isActive: x === Et,
1273
- registerRowRef: Nt,
1274
- onNavigationKeyDown: It,
1275
- rowHeight: o.rowHeight,
1276
- isDirOpen: fe,
1277
- parentIsLast: o.parentIsLast,
1469
+ entry: a.entry,
1470
+ indentLevel: a.indentLevel,
1471
+ depth: a.depth,
1472
+ positionInSet: a.positionInSet,
1473
+ setSize: a.setSize,
1474
+ isSelectedForAria: !!R?.has(a.entry.absolutePath),
1475
+ flatIndex: u,
1476
+ isActive: u === Le,
1477
+ registerRowRef: rr,
1478
+ onNavigationKeyDown: nr,
1479
+ onRowFocus: St,
1480
+ onRowBlur: Et,
1481
+ rowHeight: a.rowHeight,
1482
+ entryKindDirectory: _e,
1483
+ entryKindFile: Ie,
1484
+ isDirOpen: ge,
1485
+ parentIsLast: a.parentIsLast,
1278
1486
  renderChildren: !1,
1279
- expansion: { toggleDirectory: t, onToggleDirectoryRecursive: qe },
1280
- selection: { onEntryClick: R, selectedPath: b ?? null, mode: d, selectedItems: h, onSelectionChange: g },
1487
+ expansion: { toggleDirectory: t, onToggleDirectoryRecursive: pt },
1488
+ selection: { onEntryClick: j, selectedPath: Oe, currentPath: bt, mode: p, selectedItems: R, onSelectionChange: E },
1281
1489
  visual: {
1282
- iconOverrides: L,
1490
+ iconOverrides: D,
1283
1491
  showExpandIcons: I,
1284
- showDirectoryIcons: E,
1285
- showFileIcons: p,
1286
- useCanvasExpandIcons: j,
1492
+ showDirectoryIcons: b,
1493
+ showFileIcons: W,
1494
+ useCanvasExpandIcons: x,
1287
1495
  expandIconSize: C,
1288
- highlightStyles: ee,
1289
- entryClassName: $,
1290
- entryStyle: J,
1291
- nameClassName: te,
1292
- nameStyle: S,
1293
- directoryNameClassName: Y,
1294
- directoryNameStyle: B,
1295
- fileNameClassName: G,
1296
- fileNameStyle: de
1496
+ highlightStyles: q,
1497
+ entryClassName: Q,
1498
+ entryStyle: oe,
1499
+ nameClassName: re,
1500
+ nameStyle: H,
1501
+ directoryNameClassName: ye,
1502
+ directoryNameStyle: ce,
1503
+ fileNameClassName: ie,
1504
+ fileNameStyle: G,
1505
+ expandIconClassName: _,
1506
+ expandIconStyle: s
1297
1507
  }
1298
1508
  },
1299
- o.entry.absolutePath
1509
+ a.entry.absolutePath
1300
1510
  ) : null
1301
1511
  }
1302
1512
  ),
1303
1513
  [
1304
- X.length,
1305
- Ct,
1306
- bt,
1307
- gt,
1308
- dt,
1309
- ut,
1310
- Et,
1311
- Nt,
1312
- It,
1313
- oe,
1314
- Ne,
1315
- mt,
1316
- ht,
1317
- Ae,
1318
- m,
1319
- _t,
1320
- q,
1321
- rt,
1322
- Me,
1323
- Fe,
1324
- ye,
1514
+ Z.length,
1515
+ lr,
1516
+ Kt,
1517
+ Xt,
1518
+ Mt,
1519
+ $t,
1520
+ ee,
1521
+ de,
1522
+ _e,
1523
+ Ie,
1325
1524
  Le,
1525
+ rr,
1526
+ nr,
1527
+ St,
1528
+ Et,
1529
+ ae,
1326
1530
  Ce,
1327
- Te,
1328
- re,
1531
+ Bt,
1532
+ zt,
1533
+ qe,
1534
+ We,
1535
+ Ke,
1536
+ ne,
1537
+ ir,
1538
+ te,
1539
+ kt,
1329
1540
  Xe,
1330
- it,
1331
- P,
1332
- Be,
1333
- fe,
1334
- R,
1335
- b,
1336
- d,
1337
- h,
1541
+ Y,
1542
+ ve,
1543
+ Ct,
1544
+ At,
1545
+ Ot,
1546
+ ft,
1547
+ Ht,
1338
1548
  g,
1549
+ ot,
1550
+ ge,
1551
+ j,
1552
+ Oe,
1553
+ bt,
1554
+ p,
1555
+ R,
1556
+ E,
1339
1557
  t,
1340
- qe,
1341
- At,
1342
- L,
1558
+ pt,
1559
+ ur,
1560
+ D,
1343
1561
  I,
1344
- E,
1345
- p,
1346
- j,
1562
+ b,
1563
+ W,
1564
+ x,
1347
1565
  C,
1348
- ee,
1349
- $,
1350
- J,
1351
- te,
1352
- S,
1353
- Y,
1354
- B,
1566
+ q,
1567
+ Q,
1568
+ oe,
1569
+ re,
1570
+ H,
1571
+ ye,
1572
+ ce,
1573
+ ie,
1355
1574
  G,
1356
- de
1575
+ _,
1576
+ s
1357
1577
  ]
1358
1578
  );
1359
- if (!(P && q))
1360
- return /* @__PURE__ */ i.jsx("div", { ref: se, className: pt, style: yt, role: "tree", "aria-label": y ? void 0 : f, "aria-labelledby": y, "aria-multiselectable": d === "multiple" ? !0 : void 0, children: Mt });
1361
- const pr = P.showHeader ?? !0, yr = P.showFooter ?? !1, xr = { ...yt, "--dt-hscroll": `${pe}px` };
1579
+ if (!(g && te))
1580
+ return /* @__PURE__ */ i.jsxs("div", { ref: J, className: Gt, style: Yt, children: [
1581
+ Ne.length > 0 && !en && // biome-ignore lint/a11y/noNoninteractiveTabindex: 停止点の行が描画窓の外で DOM に無い間だけ Tab を受け、受けた瞬間にその行へ焦点を渡す。これが無いとツリーに Tab で入れない
1582
+ // biome-ignore lint/a11y/noStaticElementInteractions: 同上 (焦点の受け渡しだけを担い、要素自身は操作の対象ではない)
1583
+ /* @__PURE__ */ i.jsx("span", { tabIndex: 0, "data-directory-tree-tab-stop": "", style: eo, onFocus: tn }),
1584
+ dr
1585
+ ] });
1586
+ const nn = g.showHeader ?? !0, on = g.showFooter ?? !1, sn = { ...Yt, "--dt-hscroll": `${$e}px` };
1362
1587
  return /* @__PURE__ */ i.jsxs(
1363
1588
  "div",
1364
1589
  {
1365
- ref: se,
1366
- className: A(pt, "dt-grid"),
1367
- style: xr,
1590
+ ref: J,
1591
+ className: O(Gt, "dt-grid"),
1592
+ style: sn,
1368
1593
  role: "treegrid",
1369
- "aria-label": y ? void 0 : f,
1370
- "aria-labelledby": y,
1371
- "aria-multiselectable": d === "multiple" ? !0 : void 0,
1372
- "aria-rowcount": X.length + (P.showHeader ?? !0 ? 1 : 0),
1594
+ "aria-label": k ? void 0 : v,
1595
+ "aria-labelledby": k,
1596
+ "aria-multiselectable": p === "multiple" ? !0 : void 0,
1597
+ "aria-rowcount": Z.length + (g.showHeader ?? !0 ? 1 : 0),
1373
1598
  children: [
1374
- pr && // biome-ignore lint/a11y/useSemanticElements: 仮想スクロールの treegrid は絶対配置行を使うため native table 要素にできない。ARIA ロールで意味を提供する
1375
- /* @__PURE__ */ i.jsx("div", { role: "rowgroup", children: /* @__PURE__ */ i.jsx(Lr, { columns: P.columns, numericTemplate: Be, numericTotal: q.numericTotal, nameWidth: q.nameWidth, scrollBarWidth: Re, className: P.headerClassName }) }),
1376
- /* @__PURE__ */ i.jsx("div", { ref: ie, className: "dt-grid-body", children: Mt }),
1377
- je > 0 && /* @__PURE__ */ i.jsxs("div", { className: "dt-grid-hscrollbar-row", children: [
1378
- /* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: q.nameWidth }, "aria-hidden": "true" }),
1599
+ nn && // biome-ignore lint/a11y/useSemanticElements: 仮想スクロールの treegrid は絶対配置行を使うため native table 要素にできない。ARIA ロールで意味を提供する
1600
+ /* @__PURE__ */ i.jsx("div", { role: "rowgroup", children: /* @__PURE__ */ i.jsx(Nn, { columns: g.columns, numericTemplate: ot, numericTotal: te.numericTotal, nameWidth: te.nameWidth, scrollBarWidth: De, className: g.headerClassName }) }),
1601
+ /* @__PURE__ */ i.jsx("div", { ref: Se, className: "dt-grid-body", children: dr }),
1602
+ Fe > 0 && /* @__PURE__ */ i.jsxs("div", { className: "dt-grid-hscrollbar-row", children: [
1603
+ /* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: te.nameWidth }, "aria-hidden": "true" }),
1379
1604
  /* @__PURE__ */ i.jsx(
1380
- Sr,
1605
+ hn,
1381
1606
  {
1382
1607
  horizontal: !0,
1383
- contentSize: q.numericTotal,
1384
- viewportSize: q.numericVisible,
1385
- scrollPosition: pe,
1386
- scrollBarWidth: Re,
1387
- onScroll: (o) => {
1388
- const x = typeof o == "function" ? o(pe) : o, _ = nt(x, je);
1389
- return be(_), _;
1608
+ contentSize: te.numericTotal,
1609
+ viewportSize: te.numericVisible,
1610
+ scrollPosition: $e,
1611
+ scrollBarWidth: De,
1612
+ locale: ee,
1613
+ labels: de,
1614
+ onScroll: (a) => {
1615
+ const u = typeof a == "function" ? a($e) : a, y = It(u, Fe);
1616
+ return He(y), y;
1390
1617
  }
1391
1618
  }
1392
1619
  ),
1393
- /* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: Re }, "aria-hidden": "true" })
1620
+ /* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: De }, "aria-hidden": "true" })
1394
1621
  ] }),
1395
- yr && // biome-ignore lint/a11y/useSemanticElements: 同上 (フッタ行も絶対配置レイアウトの一部)
1396
- /* @__PURE__ */ i.jsx("div", { role: "rowgroup", children: /* @__PURE__ */ i.jsx($r, { columns: P.columns, numericTemplate: Be, numericTotal: q.numericTotal, nameWidth: q.nameWidth, scrollBarWidth: Re, allEntries: hr, className: P.footerClassName }) })
1622
+ on && // biome-ignore lint/a11y/useSemanticElements: 同上 (フッタ行も絶対配置レイアウトの一部)
1623
+ /* @__PURE__ */ i.jsx("div", { role: "rowgroup", children: /* @__PURE__ */ i.jsx(Tn, { columns: g.columns, numericTemplate: ot, numericTotal: te.numericTotal, nameWidth: te.nameWidth, scrollBarWidth: De, allEntries: rn, className: g.footerClassName }) })
1397
1624
  ]
1398
1625
  }
1399
1626
  );
1400
- }, dn = ({ initialExpanded: e = /* @__PURE__ */ new Set(), storageKey: t } = {}) => {
1401
- const [s, n] = kr(), [r, l] = ce(() => {
1627
+ }, io = ({ initialExpanded: e = /* @__PURE__ */ new Set(), storageKey: t } = {}) => {
1628
+ const [r, n] = dn(), [o, l] = he(() => {
1402
1629
  if (typeof window < "u" && t)
1403
1630
  try {
1404
- const f = window.localStorage.getItem(t);
1405
- if (f) {
1406
- const y = JSON.parse(f);
1407
- return new Set(y);
1631
+ const m = window.localStorage.getItem(t);
1632
+ if (m) {
1633
+ const v = JSON.parse(m);
1634
+ return new Set(v);
1408
1635
  }
1409
- } catch (f) {
1410
- console.error("[useDirectoryTreeState] Error reading from localStorage", f);
1636
+ } catch (m) {
1637
+ console.error("[useDirectoryTreeState] Error reading from localStorage", m);
1411
1638
  }
1412
1639
  return e;
1413
- }), c = F((f) => {
1640
+ }), c = P((m) => {
1414
1641
  n(() => {
1415
- l((y) => {
1416
- const k = new Set(y);
1417
- return f(k), k;
1642
+ l((v) => {
1643
+ const k = new Set(v);
1644
+ return m(k), k;
1418
1645
  });
1419
1646
  });
1420
- }, []), u = F(
1421
- (f, y) => {
1647
+ }, []), d = P(
1648
+ (m, v) => {
1422
1649
  c((k) => {
1423
- for (const j of f)
1424
- y(k, j);
1650
+ for (const $ of m)
1651
+ v(k, $);
1425
1652
  });
1426
1653
  },
1427
1654
  [c]
1428
1655
  );
1429
- he(() => {
1656
+ ke(() => {
1430
1657
  if (t && typeof window < "u")
1431
1658
  try {
1432
- window.localStorage.setItem(t, JSON.stringify(Array.from(r)));
1433
- } catch (f) {
1434
- console.warn(`Error setting localStorage key "${t}":`, f);
1659
+ window.localStorage.setItem(t, JSON.stringify(Array.from(o)));
1660
+ } catch (m) {
1661
+ console.warn(`Error setting localStorage key "${t}":`, m);
1435
1662
  }
1436
- }, [r, t]);
1437
- const R = F(
1438
- (f) => {
1439
- u([f], (y, k) => {
1440
- y.has(k) ? y.delete(k) : y.add(k);
1663
+ }, [o, t]);
1664
+ const j = P(
1665
+ (m) => {
1666
+ d([m], (v, k) => {
1667
+ v.has(k) ? v.delete(k) : v.add(k);
1441
1668
  });
1442
1669
  },
1443
- [u]
1444
- ), b = F(
1445
- (f) => {
1446
- u([f], (y, k) => {
1447
- y.add(k);
1670
+ [d]
1671
+ ), S = P(
1672
+ (m) => {
1673
+ d([m], (v, k) => {
1674
+ v.add(k);
1448
1675
  });
1449
1676
  },
1450
- [u]
1451
- ), d = F(
1452
- (f) => {
1453
- u([f], (y, k) => {
1454
- y.delete(k);
1677
+ [d]
1678
+ ), f = P(
1679
+ (m) => {
1680
+ d([m], (v, k) => {
1681
+ v.delete(k);
1455
1682
  });
1456
1683
  },
1457
- [u]
1458
- ), h = F(
1459
- (f) => {
1460
- u(f, (y, k) => {
1461
- y.delete(k);
1684
+ [d]
1685
+ ), p = P(
1686
+ (m) => {
1687
+ d(m, (v, k) => {
1688
+ v.delete(k);
1462
1689
  });
1463
1690
  },
1464
- [u]
1465
- ), g = F(
1466
- (f) => {
1467
- u(f, (y, k) => {
1468
- y.add(k);
1691
+ [d]
1692
+ ), R = P(
1693
+ (m) => {
1694
+ d(m, (v, k) => {
1695
+ v.add(k);
1469
1696
  });
1470
1697
  },
1471
- [u]
1472
- ), w = F(() => {
1473
- c((f) => {
1474
- f.clear();
1698
+ [d]
1699
+ ), E = P(() => {
1700
+ c((m) => {
1701
+ m.clear();
1475
1702
  });
1476
- }, [c]), N = F((f) => r.has(f), [r]);
1703
+ }, [c]), T = P((m) => o.has(m), [o]);
1477
1704
  return {
1478
- expanded: r,
1479
- toggle: R,
1480
- expand: b,
1481
- collapse: d,
1482
- collapseMultiple: h,
1483
- expandMultiple: g,
1484
- collapseAll: w,
1485
- isExpanded: N,
1486
- isPending: s
1705
+ expanded: o,
1706
+ toggle: j,
1707
+ expand: S,
1708
+ collapse: f,
1709
+ collapseMultiple: p,
1710
+ expandMultiple: R,
1711
+ collapseAll: E,
1712
+ isExpanded: T,
1713
+ isPending: r
1487
1714
  };
1488
1715
  };
1489
1716
  export {
1490
- cn as DirectoryTree,
1491
- D as directoryTreeClasses,
1492
- dn as useDirectoryTreeState
1717
+ On as DIRECTORY_TREE_LABEL_CATALOGS,
1718
+ Cr as DIRECTORY_TREE_LABEL_KEYS,
1719
+ co as DirectoryTree,
1720
+ M as directoryTreeClasses,
1721
+ Dn as resolveDirectoryTreeLabels,
1722
+ io as useDirectoryTreeState
1493
1723
  };