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