@aiquants/directory-tree 3.12.0 → 4.1.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 he from "react";
2
+ import cn, { useRef as V, useEffect as ke, useCallback as T, memo as _t, useState as le, useMemo as Y, useLayoutEffect as mr, useImperativeHandle as un, Fragment as dn, useTransition as fn } from "react";
3
+ import { VIRTUAL_SCROLL_LABEL_KEYS as dt, VIRTUAL_SCROLL_LABEL_CATALOGS as hr, resolveVirtualScrollLocale as $r, resolveVirtualScrollLabels as mn, VirtualScroll as hn, ScrollBar as pn } from "@aiquants/virtualscroll";
4
+ import { twMerge as O } from "tailwind-merge";
5
+ import { FileMd as pr, FilePdf as yr, FileXls as br, FileCsv as gr, FileDoc as vr, FilePpt as wr, FileImage as xr, FileAudio as Sr, FileVideo as Er, FileZip as kr, FileCode as Rr, FileText as Ir, FileIcon as yn } from "@phosphor-icons/react";
6
+ var ct = { exports: {} }, Ye = {};
7
+ var jr;
8
+ function bn() {
9
+ if (jr) return Ye;
10
+ jr = 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 Nr;
31
+ function gn() {
32
+ return Nr || (Nr = 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 === Z ? 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 M:
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 ce:
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 R:
59
+ return s.displayName || "Context";
58
60
  case w:
59
- return o.displayName || "Context";
60
- 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;
61
+ return (s._context.displayName || "Context") + ".Consumer";
62
+ case y:
63
+ var h = s.render;
64
+ return s = s.displayName, s || (s = h.displayName || h.name || "", s = s !== "" ? "ForwardRef(" + s + ")" : "ForwardRef"), s;
65
+ case _:
66
+ return h = s.displayName || null, h !== null ? h : e(s.type) || "Memo";
67
+ case K:
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 === K)
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
+ pe || (pe = !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 ie[s] || (ie[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 x(s, h, g, N, se, de) {
140
+ var A = g.ref;
141
+ return s = {
142
+ $$typeof: P,
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
169
  value: de
170
- }), Object.freeze && (Object.freeze(o.props), Object.freeze(o)), o;
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, de) {
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(fe) {
188
+ return fe !== "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}", C[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
+ ), C[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
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 ye in h)
206
+ ye !== "key" && (g[ye] = h[ye]);
207
+ } else g = h;
208
+ return A && d(
209
+ g,
210
+ typeof s == "function" ? s.displayName || s.name || "Unknown" : s
211
211
  ), x(
212
- o,
213
- P,
214
- T,
215
- r(),
216
- oe,
212
+ s,
213
+ A,
214
+ g,
215
+ o(),
216
+ se,
217
217
  de
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
+ E(s) ? s._store && (s._store.validated = 1) : typeof s == "object" && s !== null && s.$$typeof === K && (s._payload.status === "fulfilled" ? E(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 E(s) {
224
+ return typeof s == "object" && s !== null && s.$$typeof === P;
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 S = cn, P = /* @__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"), M = /* @__PURE__ */ Symbol.for("react.profiler"), w = /* @__PURE__ */ Symbol.for("react.consumer"), R = /* @__PURE__ */ Symbol.for("react.context"), y = /* @__PURE__ */ Symbol.for("react.forward_ref"), W = /* @__PURE__ */ Symbol.for("react.suspense"), D = /* @__PURE__ */ Symbol.for("react.suspense_list"), _ = /* @__PURE__ */ Symbol.for("react.memo"), K = /* @__PURE__ */ Symbol.for("react.lazy"), ce = /* @__PURE__ */ Symbol.for("react.activity"), Z = /* @__PURE__ */ Symbol.for("react.client.reference"), Q = S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, oe = Object.prototype.hasOwnProperty, re = Array.isArray, $ = console.createTask ? console.createTask : function() {
227
227
  return null;
228
228
  };
229
- g = {
230
- react_stack_bottom_frame: function(o) {
231
- return o();
229
+ S = {
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 pe, ie = {}, ue = S.react_stack_bottom_frame.bind(
235
+ S,
236
+ l
237
+ )(), z = $(n(l)), C = {};
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") : ue,
246
+ N ? $(n(s)) : z
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") : ue,
256
+ N ? $(n(s)) : z
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 Pr;
262
+ function vn() {
263
+ return Pr || (Pr = 1, process.env.NODE_ENV === "production" ? ct.exports = bn() : ct.exports = gn()), ct.exports;
264
264
  }
265
- var c = zr();
266
- function Yr({
265
+ var i = vn();
266
+ function wn({
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__ */ he.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__ */ he.createElement("title", {
280
280
  id: t
281
- }, e) : null, /* @__PURE__ */ ce.createElement("path", {
281
+ }, e) : null, /* @__PURE__ */ he.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__ */ he.forwardRef(wn);
288
+ function Sn({
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__ */ he.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__ */ he.createElement("title", {
302
302
  id: t
303
- }, e) : null, /* @__PURE__ */ ce.createElement("path", {
303
+ }, e) : null, /* @__PURE__ */ he.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 En = /* @__PURE__ */ he.forwardRef(Sn);
310
+ function kn({
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__ */ he.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__ */ he.createElement("title", {
324
324
  id: t
325
- }, e) : null, /* @__PURE__ */ ce.createElement("path", {
325
+ }, e) : null, /* @__PURE__ */ he.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__ */ he.forwardRef(kn), it = 18, ut = 12, Tr = 8, F = {
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
+ }, Te = (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
+ }, Hr = ({ 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(En, { className: c, style: l });
355
+ }, Pt = (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) => Pt(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
+ }, In = (e, t, r) => {
372
+ const n = (t || (r ? Te(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(pr, { className: "h-4 w-4 text-sky-500 dark:text-sky-400" });
376
+ if (o === "application/pdf")
377
+ return /* @__PURE__ */ i.jsx(yr, { 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(br, { 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(gr, { 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(vr, { 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(wr, { 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(Sr, { className: "h-4 w-4 text-pink-500 dark:text-pink-400" });
390
+ if (o.startsWith("video/"))
391
+ return /* @__PURE__ */ i.jsx(Er, { 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(kr, { 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(Ir, { 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(pr, { 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(yr, { 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(br, { 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(gr, { 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(vr, { 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(wr, { 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(Sr, { 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(Er, { 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(kr, { 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(Ir, { 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(yn, { className: "h-4 w-4 text-gray-400 dark:text-gray-400" });
426
+ }, Wr = (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 || In(j, l, r.name), Pt(typeof d == "function" ? d(e) : d, r.absolutePath);
431
+ }, jn = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Br = (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-${jn(r)}`, String(n)]));
437
+ }, Nn = 500, zr = ({ entry: e, isDirectory: t, isExpanded: r, isItemSelected: n, selectionMode: o, onSelectionChange: l, onEntryClick: c, toggleDirectory: d, onToggleDirectoryRecursive: j }) => {
438
+ const x = V(null);
439
+ return ke(
440
440
  () => () => {
441
441
  x.current && window.clearTimeout(x.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
+ ), T(
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) && (x.current ? (window.clearTimeout(x.current), x.current = null, j(e)) : x.current = window.setTimeout(() => {
456
+ d(e.absolutePath), x.current = null;
457
+ }, Nn));
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
+ }, Gr = (e) => e === "right" ? "dt-grid-cell--right" : e === "center" ? "dt-grid-cell--center" : "", Cr = (e, t) => e.children !== void 0 && t(e.absolutePath), Yr = (e, t) => ({
462
462
  width: e,
463
463
  gridTemplateColumns: t
464
- }), vr = ut(
464
+ }), Vr = _t(
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: x,
476
+ isDirOpen: f,
477
+ columns: p,
478
+ numericTemplate: E,
479
+ numericTotal: S,
480
+ nameWidth: P,
481
+ rowClassName: m,
482
+ selection: { onEntryClick: v, selectedPath: k, currentPath: M, mode: w = "none", selectedItems: R, onSelectionChange: y },
483
+ expansion: { toggleDirectory: W, onToggleDirectoryRecursive: D },
484
+ visual: { iconOverrides: _, showExpandIcons: K = !0, showDirectoryIcons: ce = !0, showFileIcons: Z = !0, useCanvasExpandIcons: Q = !1, expandIconSize: oe, indentSize: re = ut, highlightStyles: $, expandIconClassName: pe, expandIconStyle: ie }
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 [ue, z] = le(!1), C = e.children !== void 0, s = C && f(e.absolutePath), h = e.absolutePath === k, g = e.absolutePath === M, N = !C && !!R?.has(e.absolutePath), se = C ? void 0 : Te(e.name) || Te(e.relativePath) || Te(e.absolutePath), de = zr({ entry: e, isDirectory: C, isExpanded: s, isItemSelected: N, selectionMode: w, onSelectionChange: y, onEntryClick: v, toggleDirectory: W, onToggleDirectoryRecursive: D }), A = ue ? $?.hoverClassName !== void 0 ? $.hoverClassName : F.entryHover : "", ee = (() => {
487
+ if (C) {
488
+ if (h) return $?.directorySelectedClassName !== void 0 ? $.directorySelectedClassName : F.entrySelected;
489
+ } else if (h || N)
490
+ return $?.itemSelectedClassName !== void 0 ? $.itemSelectedClassName : O(h && F.entrySelected, N && F.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
+ })(), ye = typeof m == "function" ? m(e) : m, fe = O("dt-grid-row cursor-pointer select-none", A, ee, ye, e.className), Ce = O(F.expandIcon, pe, (h || N) && F.expandIconSelected), Re = O(F.typeIcon, (h || N) && F.typeIconSelected), ne = O("dt-grid-name-label ml-1", "text-gray-700 dark:text-gray-200", C && F.nameDirectory, (h || N) && F.nameSelected), L = Hr({ isDirectory: C, isExpanded: s, showExpandIcons: K, useCanvasExpandIcons: Q, expandIconSize: oe }), me = (C ? ce : Z) ? Wr({ entry: e, isDirectory: C, isExpanded: s, isSelected: h, isItemSelected: N, extension: se, mimeType: e.mimeType }, _) : null, X = { indentLevel: t, isDirectory: C, isExpanded: s }, [xe, ...U] = p, Me = xe?.render ? xe.render(e, X) : e.label ?? e.name, Ie = {
493
+ ...ue ? $?.hoverStyle : {},
494
+ ...C && h ? $?.directorySelectedStyle : {},
495
+ ...!C && (h || N) ? $?.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: fe,
501
+ style: { height: x, ...Ie, ...e.style },
499
502
  role: "row",
500
- "aria-expanded": R ? z : void 0,
503
+ "aria-expanded": C ? 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": w === "none" ? void 0 : j,
509
+ "aria-current": g ? "page" : void 0,
510
+ ...Br(e.data),
511
+ "data-entry-type": C ? "directory" : "file",
512
+ "data-entry-expanded": C ? String(s) : void 0,
513
+ "data-entry-selected": h ? "true" : void 0,
514
+ "data-entry-item-selected": N ? "true" : void 0,
515
+ onClick: de,
516
+ onMouseEnter: () => z(!0),
517
+ onMouseLeave: () => z(!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
+ de(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", xe?.className), role: "gridcell", style: { width: P, paddingLeft: Math.max(0, t * re) }, children: [
532
+ (K || Q) && /* @__PURE__ */ i.jsx("span", { className: Ce, style: ie, children: L }),
533
+ (C ? ce : Z) && /* @__PURE__ */ i.jsx("span", { className: Re, children: me }),
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
+ U.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-track", style: Yr(S, E), children: U.map((B) => /* @__PURE__ */ i.jsx("div", { className: O("dt-grid-cell", Gr(B.align), B.className), role: "gridcell", children: B.render ? B.render(e, X) : 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 = Cr(e.entry, e.isDirOpen), n = Cr(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
+ Vr.displayName = "DirectoryTreeGridRow";
549
+ const Ur = ({
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 [, ...x] = t, f = e === "header" ? "dt-grid-name-header" : "dt-grid-name-footer", p = e === "header" ? "dt-grid-header" : "dt-grid-footer", E = 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: E, style: { width: o }, children: d }),
563
+ x.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-track", style: Yr(n, r), children: x.map((S) => /* @__PURE__ */ i.jsx("div", { className: O("dt-grid-cell", Gr(S.align), S.className), role: E, children: j(S) }, S.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
+ }, Pn = ({ columns: e, className: t, ...r }) => /* @__PURE__ */ i.jsx(Ur, { 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(Ur, { kind: "footer", columns: e, className: r, nameContent: _r(e[0]?.footer, t), renderCell: (o) => _r(o.footer, t), ...n }), Cn = 240, Kr = 96, Xr = 12, Tt = (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) => `${Tt(t, Kr)}px`).join(" "), An = ({ measuredWidth: e, columns: t, scrollBarWidth: r = Xr }) => {
570
+ const n = Tt(t[0], Cn), o = t.slice(1).reduce((j, x) => j + Tt(x, Kr), 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
+ }, Nt = (e, t) => !Number.isFinite(e) || e < 0 ? 0 : e > t ? t : e, On = (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
+ }, Jr = ["entryKindDirectory", "entryKindFile"], Ar = [...dt, ...Jr], Ct = Object.freeze({
564
579
  en: Object.freeze({
565
580
  entryKindDirectory: "directory",
566
581
  entryKindFile: "file"
@@ -569,421 +584,476 @@ 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
+ }), Ln = Object.freeze({
588
+ en: Object.freeze({ ...hr.en, ...Ct.en }),
589
+ ja: Object.freeze({ ...hr.ja, ...Ct.ja })
590
+ }), Or = (e) => typeof e == "string" ? JSON.stringify(e) : e === null ? "null" : typeof e, Dn = (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 dt) {
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
+ }, Fn = (e, t) => {
599
+ const r = $r(e);
585
600
  if (t === void 0)
586
- return on[s];
601
+ return Ln[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 ${Or(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 (!Ar.includes(c))
609
+ throw new RangeError(`[directory-tree] labels.${c} is not a known label key; expected one of ${Ar.join(", ")}`);
610
+ const l = { ...mn(r, Dn(t)), ...Ct[r] };
611
+ for (const c of Jr) {
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 ${Or(d)}`);
616
+ l[c] = d;
602
617
  }
603
618
  }
604
- return Object.freeze(i);
605
- }, cn = (e) => {
619
+ return Object.freeze(l);
620
+ }, Mn = (e) => {
606
621
  const t = {};
607
- for (const s of Xe)
608
- t[s] = e[s];
622
+ for (const r of dt)
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
+ }, $n = () => {
626
+ let e = null;
627
+ return {
628
+ mark: (t) => {
629
+ const r = t.composedPath();
630
+ e = r, setTimeout(() => {
631
+ e === r && (e = null);
632
+ }, 0);
633
+ },
634
+ landedOn: (t) => e?.includes(t) === !0
635
+ };
636
+ }, Hn = (e, t) => {
637
+ const r = e.length - 1;
638
+ if (r <= 0) return 0;
639
+ let n = 0, o = r - 1, l = 0;
640
+ for (; n <= o; ) {
641
+ const c = n + o >>> 1;
642
+ e[c] <= t ? (l = c, n = c + 1) : o = c - 1;
617
643
  }
618
- return i;
619
- }, un = (e, t, s) => {
620
- if (s <= 0 || e.length === 0 || t.length !== e.length + 1)
644
+ return l;
645
+ }, Wn = (e, t, r) => {
646
+ if (r <= 0 || e.length === 0 || t.length !== e.length + 1)
621
647
  return null;
622
- const n = dn(t, s), r = e[n];
623
- return r ? {
624
- path: r.entry.absolutePath,
625
- offsetInViewport: s - t[n]
648
+ const n = Hn(t, r), o = e[n];
649
+ return o ? {
650
+ path: o.entry.absolutePath,
651
+ offsetInViewport: r - t[n]
626
652
  } : null;
627
- }, fn = (e, t, s) => {
628
- if (t.length === 0 || s.length !== t.length + 1)
653
+ }, Bn = (e, t, r) => {
654
+ if (t.length === 0 || r.length !== t.length + 1)
629
655
  return null;
630
656
  for (let n = 0; n < t.length; n++)
631
657
  if (t[n].entry.absolutePath === e.path)
632
- return Math.max(0, s[n] + e.offsetInViewport);
658
+ return Math.max(0, r[n] + e.offsetInViewport);
633
659
  return null;
634
- }, mn = (e, t, s) => {
660
+ }, zn = (e, t, r) => {
635
661
  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);
662
+ for (let o = t; o < r; o++) {
663
+ const l = e[o];
664
+ if (!(!l || l.length === 0))
665
+ for (const c of l)
666
+ n.push(c);
641
667
  }
642
668
  return n;
643
- }, hn = (e, t, s) => {
669
+ }, Gn = (e, t, r) => {
644
670
  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);
671
+ for (let o = t; o < r; o++) {
672
+ const l = e[o];
673
+ if (!(!l || l.length === 0))
674
+ for (const c of l)
675
+ n.push(c);
650
676
  }
651
677
  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();
678
+ }, Yn = (e, t, r, n) => {
679
+ const o = Math.max(1, Math.floor(t * n)), l = Math.max(1, Math.floor(r * n));
680
+ (e.width !== o || e.height !== l) && (e.width = o, e.height = l);
681
+ const c = e.style;
682
+ c.width !== `${t}px` && (c.width = `${t}px`), c.height !== `${r}px` && (c.height = `${r}px`);
683
+ }, Vn = (e, t, r) => {
684
+ e.lineWidth = r, e.beginPath();
659
685
  for (const n of t)
660
686
  e.moveTo(n.x1, n.y1), e.lineTo(n.x2, n.y2);
661
687
  e.stroke();
662
- }, bn = (e, t) => {
663
- const s = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());
664
- if (!s)
688
+ }, Un = (e, t) => {
689
+ const r = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());
690
+ if (!r)
665
691
  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) => {
692
+ let n = r[1];
693
+ n.length === 3 && (n = n.split("").map((d) => d + d).join(""));
694
+ 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);
695
+ return `rgba(${o}, ${l}, ${c}, ${t})`;
696
+ }, Kn = (e, t, r, n) => {
671
697
  if (t.length === 0)
672
698
  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());
699
+ const o = Un(r, 0.14), l = e.strokeStyle, c = e.fillStyle, d = e.lineWidth, j = e.lineCap, x = e.lineJoin;
700
+ e.strokeStyle = r, e.lineCap = "round", e.lineJoin = "round";
701
+ for (const f of t) {
702
+ const p = n ?? f.size, E = Math.max(0, p / 2), S = Math.max(1, Math.round(p * 0.08)), P = Math.max(1, Math.round(p * 0.14)), m = Math.max(0, E - S * 0.8), v = Math.max(0, m * 0.55);
703
+ o && (e.fillStyle = o, e.beginPath(), e.arc(f.centerX, f.centerY, m, 0, Math.PI * 2), e.fill()), e.lineWidth = S, e.beginPath(), e.arc(f.centerX, f.centerY, Math.max(0, E - S * 0.3), 0, Math.PI * 2), e.stroke(), e.lineWidth = P, 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
704
  }
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({
705
+ e.strokeStyle = l, e.fillStyle = c, e.lineWidth = d, e.lineCap = j, e.lineJoin = x;
706
+ }, Zr = _t(({ segmentsByItem: e, glyphsByItem: t, itemHeight: r, width: n, viewportHeight: o, scrollPosition: l, color: c = "#a0aec0", strokeWidth: d = 1, renderStartIndex: j, renderEndIndex: x, lookaheadEndIndex: f, devicePixelRatio: p, expandGlyphColor: E, expandGlyphSize: S }) => {
707
+ const P = V(null), m = V(null), v = V({
682
708
  segmentsByItem: e,
683
709
  glyphsByItem: t,
684
- itemHeight: s,
710
+ itemHeight: r,
685
711
  width: n,
686
- viewportHeight: r,
687
- scrollPosition: i,
688
- color: l,
689
- strokeWidth: u,
690
- renderStartIndex: S,
712
+ viewportHeight: o,
713
+ scrollPosition: l,
714
+ color: c,
715
+ strokeWidth: d,
716
+ renderStartIndex: j,
691
717
  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)
700
- return;
701
- const w = I.getContext("2d");
718
+ lookaheadEndIndex: f,
719
+ devicePixelRatio: p,
720
+ expandGlyphColor: E,
721
+ expandGlyphSize: S
722
+ }), k = T(() => {
723
+ m.current = null;
724
+ const w = P.current;
702
725
  if (!w)
703
726
  return;
704
- const h = p.current;
705
- if (h.width <= 0 || h.viewportHeight <= 0) {
706
- w.clearRect(0, 0, I.width, I.height);
727
+ const R = w.getContext("2d");
728
+ if (!R)
729
+ return;
730
+ const y = v.current;
731
+ if (y.width <= 0 || y.viewportHeight <= 0) {
732
+ R.clearRect(0, 0, w.width, w.height);
707
733
  return;
708
734
  }
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);
735
+ const W = Number.isFinite(y.devicePixelRatio ?? NaN) ? y.devicePixelRatio : typeof window < "u" && window.devicePixelRatio || 1;
736
+ Yn(w, y.width, y.viewportHeight, W);
737
+ const D = y.segmentsByItem.length, _ = typeof y.renderStartIndex == "number" && Number.isFinite(y.renderStartIndex) ? Math.max(0, Math.floor(y.renderStartIndex)) : Math.max(0, Math.floor(y.scrollPosition / y.itemHeight)), K = Math.min(D, Math.ceil((y.scrollPosition + y.viewportHeight) / y.itemHeight)), ce = (() => {
738
+ if (typeof y.renderEndIndex == "number" && Number.isFinite(y.renderEndIndex)) {
739
+ const re = Math.floor(y.renderEndIndex);
740
+ return Math.max(Math.min(D, re + 1), _);
715
741
  }
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);
742
+ return Math.max(K, _);
743
+ })(), Z = (() => {
744
+ if (typeof y.lookaheadEndIndex == "number" && Number.isFinite(y.lookaheadEndIndex)) {
745
+ const re = Math.floor(y.lookaheadEndIndex), $ = Math.min(D, re + 1);
746
+ return Math.max($, ce);
721
747
  }
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 = {
748
+ return Math.max(K, ce);
749
+ })(), Q = zn(y.segmentsByItem, _, Z), oe = Gn(y.glyphsByItem, _, Z);
750
+ R.save(), R.scale(W, W), R.clearRect(0, 0, y.width, y.viewportHeight), R.translate(0, -y.scrollPosition), R.strokeStyle = y.color, Vn(R, Q, y.strokeWidth), Kn(R, oe, y.expandGlyphColor ?? y.color, y.expandGlyphSize), R.restore();
751
+ }, []), M = T(() => {
752
+ m.current === null && (m.current = window.requestAnimationFrame(k));
753
+ }, [k]);
754
+ return ke(() => {
755
+ v.current = {
730
756
  segmentsByItem: e,
731
757
  glyphsByItem: t,
732
- itemHeight: s,
758
+ itemHeight: r,
733
759
  width: n,
734
- viewportHeight: r,
735
- scrollPosition: i,
736
- color: l,
737
- strokeWidth: u,
738
- renderStartIndex: S,
760
+ viewportHeight: o,
761
+ scrollPosition: l,
762
+ color: c,
763
+ strokeWidth: d,
764
+ renderStartIndex: j,
739
765
  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" });
766
+ lookaheadEndIndex: f,
767
+ devicePixelRatio: p,
768
+ expandGlyphColor: E,
769
+ expandGlyphSize: S
770
+ }, M();
771
+ }, [e, t, r, n, o, l, c, d, j, x, f, p, E, S, M]), ke(() => () => {
772
+ m.current !== null && (window.cancelAnimationFrame(m.current), m.current = null);
773
+ }, []), /* @__PURE__ */ i.jsx("canvas", { ref: P, className: "pointer-events-none absolute top-0 left-0 z-0" });
748
774
  });
749
- Sr.displayName = "TreeLineCanvas";
750
- const vn = {
775
+ Zr.displayName = "TreeLineCanvas";
776
+ const Xn = (e) => {
777
+ const t = /* @__PURE__ */ new Map();
778
+ for (let r = 0; r < e.length; r++) {
779
+ const n = e[r].entry.absolutePath;
780
+ t.has(n) || t.set(n, r);
781
+ }
782
+ return t;
783
+ }, Lr = (e, t) => e.selectedPath === t ? e : { selectedPath: t, selectionGeneration: e.selectionGeneration + 1, anchor: e.anchor }, Jn = (e, t) => ({ ...e, anchor: { path: t, selectionGeneration: e.selectionGeneration, focused: !0 } }), Zn = (e, t) => {
784
+ const { anchor: r, selectionGeneration: n, selectedPath: o } = t;
785
+ if (r !== null && (r.focused || r.selectionGeneration === n)) {
786
+ const l = e.get(r.path);
787
+ if (l !== void 0)
788
+ return l;
789
+ }
790
+ if (o !== null) {
791
+ const l = e.get(o);
792
+ if (l !== void 0)
793
+ return l;
794
+ }
795
+ return 0;
796
+ }, qn = {
751
797
  msOverflowStyle: "none",
752
798
  scrollbarWidth: "none"
753
- }, gn = () => {
799
+ }, Qn = () => {
754
800
  let e = document.getElementById("directory-tree-webkit-scrollbar-hide");
755
801
  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);
802
+ }, eo = (e) => {
803
+ const t = V(null), r = t.current;
804
+ return r !== null && dt.every((n) => r[n] === e[n]) ? r : (t.current = e, e);
805
+ }, Dr = /* @__PURE__ */ new Set(["top", "bottom", "center", "nearest"]), Fr = (e) => {
806
+ const t = e?.align;
807
+ if (t === void 0)
808
+ return "top";
809
+ if (!Dr.has(t))
810
+ throw new RangeError(`[directory-tree] Unsupported scroll alignment ${JSON.stringify(t)}; expected one of ${[...Dr].join(", ")}.`);
811
+ return t;
812
+ }, to = {
813
+ position: "absolute",
814
+ width: 1,
815
+ height: 1,
816
+ margin: -1,
817
+ padding: 0,
818
+ border: 0,
819
+ overflow: "hidden",
820
+ clipPath: "inset(50%)",
821
+ whiteSpace: "nowrap"
822
+ }, ro = (e, t, r, n, o) => {
823
+ const l = [], c = [];
824
+ let d = 0;
825
+ const j = (x, f, p) => {
826
+ const E = o ? [...x].sort(o) : x;
827
+ for (let S = 0; S < E.length; S++) {
828
+ const P = E[S], m = S === E.length - 1, v = [...p, m], k = P.children !== void 0, M = k && t(P.absolutePath, P.relativePath);
829
+ let w = f, R = v, y = p;
830
+ n && (w = f - 1, R = v.slice(1), y = p.slice(1)), l.push({ entry: P, indentLevel: w, depth: f, positionInSet: S + 1, setSize: E.length, parentIsLast: R }), r && (w > d && (d = w), c.push({
831
+ id: P.absolutePath,
832
+ name: P.name,
833
+ absolutePath: P.absolutePath,
834
+ indentLevel: w,
835
+ isLastChild: m,
836
+ isDirectory: k,
837
+ isExpanded: M,
838
+ ancestorIsLast: [...y],
839
+ hideLines: n && f === 0
840
+ })), k && M && P.children && j(P.children, f + 1, v);
778
841
  }
779
842
  };
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;
843
+ return j(e, 0, []), { flatItems: l, lineItems: c, maxIndent: d };
844
+ }, Mr = (e, t) => {
845
+ const r = e.length - 1;
846
+ if (r <= 0) return 0;
847
+ let n = 0, o = r - 1, l = 0;
848
+ for (; n <= o; ) {
849
+ const c = n + o >>> 1;
850
+ e[c] <= t ? (l = c, n = c + 1) : o = c - 1;
788
851
  }
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) => {
852
+ return l;
853
+ }, no = (e, t, r, n, o, l) => {
854
+ const c = n?.renderStart ?? Math.max(0, Mr(l, o)), d = t > 0 ? Mr(l, o + t) + r : c + r, j = e > 0 ? Math.min(e - 1, Math.max(c, d)) : c, x = n?.renderEnd ?? j, f = e > 0 ? Math.min(e - 1, x + r) : x;
855
+ return { renderStart: c, renderEnd: x, lookaheadEnd: f };
856
+ }, oo = (e, t, r, n, o, l) => {
794
857
  if (e.length === 0)
795
858
  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)
859
+ 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, x = 3;
860
+ for (let f = 0; f < e.length; f++) {
861
+ const p = e[f];
862
+ if (p.hideLines)
800
863
  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)
864
+ const E = [], S = t[f] ?? 0, P = r[f] ?? 0, m = P + S / 2, v = j(S), k = v > 0 ? v / 2 + 2 : n / 1.5;
865
+ for (let R = 0; R < p.indentLevel; R++) {
866
+ if (p.ancestorIsLast[R] ?? !1)
804
867
  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;
868
+ let W = !1;
869
+ for (let D = f; D < e.length; D++) {
870
+ const _ = e[D];
871
+ if (_.indentLevel > R && _.ancestorIsLast.length > R && !_.ancestorIsLast[R]) {
872
+ W = !0;
810
873
  break;
811
874
  }
812
- if (C > d && F.indentLevel === w)
875
+ if (D > f && _.indentLevel === R)
813
876
  break;
814
877
  }
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
878
+ if (W) {
879
+ const D = R * n + n / 2 + x;
880
+ E.push({
881
+ key: `${p.id}-ancestor-${R}`,
882
+ x1: D,
883
+ y1: P,
884
+ x2: D,
885
+ y2: P + S,
886
+ itemIndex: f
824
887
  });
825
888
  }
826
889
  }
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] = [
890
+ const M = p.indentLevel * n, w = M + n / 2 + x;
891
+ if (p.isDirectory ? E.push({
892
+ key: `${p.id}-connector-top`,
893
+ x1: w,
894
+ y1: P,
895
+ x2: w,
896
+ y2: m - k,
897
+ itemIndex: f
898
+ }) : E.push({
899
+ key: `${p.id}-connector-top`,
900
+ x1: w,
901
+ y1: P,
902
+ x2: w,
903
+ y2: m,
904
+ itemIndex: f
905
+ }), !p.isDirectory && p.isLastChild && E.push({
906
+ key: `${p.id}-connector-horizontal`,
907
+ x1: w,
908
+ y1: m,
909
+ x2: M + n + x,
910
+ y2: m,
911
+ itemIndex: f
912
+ }), p.isLastChild || (p.isDirectory ? E.push({
913
+ key: `${p.id}-connector-bottom`,
914
+ x1: w,
915
+ y1: m + k,
916
+ x2: w,
917
+ y2: P + S,
918
+ itemIndex: f
919
+ }) : E.push({
920
+ key: `${p.id}-connector-bottom`,
921
+ x1: w,
922
+ y1: m,
923
+ x2: w,
924
+ y2: P + S,
925
+ itemIndex: f
926
+ })), c[f] = E, o && p.isDirectory) {
927
+ const R = v, y = w, W = m;
928
+ d[f] = [
866
929
  {
867
- key: `${m.id}-glyph`,
868
- itemIndex: d,
869
- centerX: h,
870
- centerY: H,
871
- size: w,
872
- isExpanded: m.isExpanded
930
+ key: `${p.id}-glyph`,
931
+ itemIndex: f,
932
+ centerX: y,
933
+ centerY: W,
934
+ size: R,
935
+ isExpanded: p.isExpanded
873
936
  }
874
937
  ];
875
938
  }
876
939
  }
877
- return { segmentsByItem: l, glyphsByItem: u };
878
- }, ft = ut(
940
+ return { segmentsByItem: c, glyphsByItem: d };
941
+ }, At = _t(
879
942
  ({
880
943
  entry: e,
881
944
  indentLevel: t,
882
- depth: s,
945
+ depth: r,
883
946
  positionInSet: n,
884
- setSize: r,
885
- isSelectedForAria: i,
886
- flatIndex: l,
887
- isActive: u,
888
- registerRowRef: S,
947
+ setSize: o,
948
+ isSelectedForAria: l,
949
+ flatIndex: c,
950
+ isActive: d,
951
+ registerRowRef: j,
889
952
  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 },
953
+ onRowFocus: f,
954
+ onRowBlur: p,
955
+ rowHeight: E,
956
+ entryKindDirectory: S,
957
+ entryKindFile: P,
958
+ isDirOpen: m,
959
+ parentIsLast: v,
960
+ renderChildren: k = !0,
961
+ expansion: { toggleDirectory: M, onToggleDirectoryRecursive: w },
962
+ selection: { onEntryClick: R, selectedPath: y, currentPath: W, mode: D = "none", selectedItems: _, onSelectionChange: K },
898
963
  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: _
964
+ iconOverrides: ce,
965
+ showExpandIcons: Z = !0,
966
+ showDirectoryIcons: Q = !0,
967
+ showFileIcons: oe = !0,
968
+ useCanvasExpandIcons: re = !1,
969
+ expandIconSize: $,
970
+ typeIconSize: pe,
971
+ fontSize: ie,
972
+ indentSize: ue = ut,
973
+ highlightStyles: z,
974
+ entryClassName: C,
975
+ entryStyle: s,
976
+ nameClassName: h,
977
+ nameStyle: g,
978
+ directoryNameClassName: N,
979
+ directoryNameStyle: se,
980
+ fileNameClassName: de,
981
+ fileNameStyle: A,
982
+ expandIconClassName: ee,
983
+ expandIconStyle: ye
917
984
  }
918
985
  }) => {
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);
986
+ const [fe, Ce] = le(null), [Re, ne] = le(!1), L = e.children !== void 0, me = L && m(e.absolutePath), X = e.absolutePath === y, xe = e.absolutePath === W, U = !L && _?.has(e.absolutePath), Me = T((G) => j(c, G), [j, c]), Ie = L ? void 0 : Te(e.name) || Te(e.relativePath) || Te(e.absolutePath);
987
+ ke(() => {
988
+ Ce(me && e.children ? e.children : null);
989
+ }, [me, e.children]);
990
+ const B = zr({ entry: e, isDirectory: L, isExpanded: me, isItemSelected: !!U, selectionMode: D, onSelectionChange: K, onEntryClick: R, toggleDirectory: M, onToggleDirectoryRecursive: w }), ft = Re ? z?.hoverClassName !== void 0 ? z.hoverClassName : F.entryHover : "", $e = (() => {
991
+ if (L) {
992
+ if (X)
993
+ return z?.directorySelectedClassName !== void 0 ? z.directorySelectedClassName : F.entrySelected;
994
+ } else if (X || U)
995
+ return z?.itemSelectedClassName !== void 0 ? z.itemSelectedClassName : O(X && F.entrySelected, U && F.entryItemSelected);
929
996
  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(
997
+ })(), He = O(F.entry, ft, $e, C, e.className), Ue = O(F.expandIcon, ee, (X || U) && F.expandIconSelected), mt = O(F.typeIcon, (X || U) && F.typeIconSelected), _e = O(F.name, h, L && F.nameDirectory, L && N, !L && de, (X || U) && F.nameSelected), Ke = Hr({ isDirectory: L, isExpanded: me, showExpandIcons: Z, useCanvasExpandIcons: re, expandIconSize: $ }), Xe = (L ? Q : oe) ? Wr({ entry: e, isDirectory: L, isExpanded: me, isSelected: X, isItemSelected: !!U, extension: Ie, mimeType: e.mimeType }, ce) : null, Je = {
998
+ ...Re ? z?.hoverStyle : {},
999
+ ...L && X ? z?.directorySelectedStyle : {},
1000
+ ...!L && (X || U) ? z?.itemSelectedStyle : {}
1001
+ }, Ze = Br(e.data), qe = pe ? { width: pe, height: pe } : void 0, We = ie ? { fontSize: typeof ie == "number" ? `${ie}px` : ie } : void 0;
1002
+ return /* @__PURE__ */ i.jsxs(dn, { children: [
1003
+ /* @__PURE__ */ i.jsxs(
937
1004
  "div",
938
1005
  {
939
- className: De,
1006
+ className: He,
940
1007
  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,
1008
+ paddingLeft: `${Math.max(0, t * ue)}px`,
1009
+ transform: t < 0 ? `translateX(${t * ue}px)` : void 0,
1010
+ width: t < 0 ? `calc(100% + ${Math.abs(t * ue)}px)` : void 0,
1011
+ height: `${E}px`,
1012
+ ...We,
1013
+ ...Je,
1014
+ ...s,
948
1015
  ...e.style
949
1016
  },
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);
1017
+ ...Ze,
1018
+ "data-entry-type": L ? "directory" : "file",
1019
+ "data-entry-expanded": L ? String(me) : void 0,
1020
+ "data-entry-selected": X ? "true" : void 0,
1021
+ "data-entry-item-selected": U ? "true" : void 0,
1022
+ onClick: B,
1023
+ onMouseEnter: () => ne(!0),
1024
+ onMouseLeave: () => ne(!1),
1025
+ onFocus: (G) => f(c, e.absolutePath, G.currentTarget),
1026
+ onBlur: (G) => p(e.absolutePath, G.currentTarget),
1027
+ ref: Me,
1028
+ onKeyDown: (G) => {
1029
+ if (G.key === "Enter" || G.key === " ") {
1030
+ G.preventDefault(), G.repeat || B(G);
962
1031
  return;
963
1032
  }
964
- x(le, l);
1033
+ x(G, c);
965
1034
  },
966
- tabIndex: u ? 0 : -1,
1035
+ tabIndex: d ? 0 : -1,
967
1036
  role: "treeitem",
968
- "aria-expanded": k ? G : void 0,
969
- "aria-level": s + 1,
1037
+ "aria-expanded": L ? me : void 0,
1038
+ "aria-level": r + 1,
970
1039
  "aria-posinset": n,
971
- "aria-setsize": r,
972
- "aria-selected": w === "none" ? void 0 : i,
973
- "aria-label": `${e.name} (${k ? m : v})`,
1040
+ "aria-setsize": o,
1041
+ "aria-selected": D === "none" ? void 0 : l,
1042
+ "aria-current": xe ? "page" : void 0,
1043
+ "aria-label": `${e.name} (${L ? S : P})`,
974
1044
  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(
1045
+ (Z || re) && /* @__PURE__ */ i.jsx("span", { className: Ue, style: ye, children: Ke }),
1046
+ (L ? Q : oe) && /* @__PURE__ */ i.jsx("span", { className: mt, style: qe, children: Xe }),
1047
+ /* @__PURE__ */ i.jsx(
978
1048
  "span",
979
1049
  {
980
1050
  className: _e,
981
1051
  style: {
982
- ...Ae,
983
- ...O,
984
- ...k ? y : _
1052
+ ...We,
1053
+ ...g,
1054
+ ...L ? se : A
985
1055
  },
986
- "data-entry-type": k ? "directory" : "file",
1056
+ "data-entry-type": L ? "directory" : "file",
987
1057
  "data-entry-role": "name",
988
1058
  children: e.label ?? e.name
989
1059
  }
@@ -991,370 +1061,449 @@ const vn = {
991
1061
  ]
992
1062
  }
993
1063
  ),
994
- G && oe && f && /* @__PURE__ */ c.jsx("fieldset", { children: oe.map((le, Pe) => /* @__PURE__ */ c.jsx(
995
- ft,
1064
+ me && fe && k && /* @__PURE__ */ i.jsx("fieldset", { children: fe.map((G, ge) => /* @__PURE__ */ i.jsx(
1065
+ At,
996
1066
  {
997
- entry: le,
1067
+ entry: G,
998
1068
  indentLevel: t + 1,
999
- depth: s + 1,
1000
- positionInSet: Pe + 1,
1001
- setSize: oe.length,
1002
- isSelectedForAria: !!h?.has(le.absolutePath),
1069
+ depth: r + 1,
1070
+ positionInSet: ge + 1,
1071
+ setSize: fe.length,
1072
+ isSelectedForAria: !!_?.has(G.absolutePath),
1003
1073
  flatIndex: -1,
1004
1074
  isActive: !1,
1005
- registerRowRef: S,
1075
+ registerRowRef: j,
1006
1076
  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 },
1077
+ onRowFocus: f,
1078
+ onRowBlur: p,
1079
+ rowHeight: E,
1080
+ entryKindDirectory: S,
1081
+ entryKindFile: P,
1082
+ isDirOpen: m,
1083
+ parentIsLast: [...v, ge === fe.length - 1],
1084
+ expansion: { toggleDirectory: M, onToggleDirectoryRecursive: w },
1085
+ selection: { onEntryClick: R, selectedPath: y, currentPath: W, mode: D, selectedItems: _, onSelectionChange: K },
1014
1086
  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: _
1087
+ iconOverrides: ce,
1088
+ showExpandIcons: Z,
1089
+ showDirectoryIcons: Q,
1090
+ showFileIcons: oe,
1091
+ useCanvasExpandIcons: re,
1092
+ expandIconSize: $,
1093
+ highlightStyles: z,
1094
+ entryClassName: C,
1095
+ entryStyle: s,
1096
+ nameClassName: h,
1097
+ nameStyle: g,
1098
+ directoryNameClassName: N,
1099
+ directoryNameStyle: se,
1100
+ fileNameClassName: de,
1101
+ fileNameStyle: A,
1102
+ expandIconClassName: ee,
1103
+ expandIconStyle: ye
1030
1104
  }
1031
1105
  },
1032
- le.absolutePath
1106
+ G.absolutePath
1033
1107
  )) })
1034
1108
  ] }, e.absolutePath);
1035
1109
  },
1036
1110
  (e, t) => {
1037
1111
  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);
1112
+ 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
1113
  return e.indentLevel === t.indentLevel && // 位置情報は aria として描画されるため、変化したら再描画が必要
1040
1114
  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]);
1115
+ 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
1116
  }
1043
1117
  );
1044
- ft.displayName = "DirectoryEntryItem";
1045
- const jr = (e) => {
1118
+ At.displayName = "DirectoryEntryItem";
1119
+ const qr = (e) => {
1046
1120
  const t = [];
1047
1121
  if (e.children)
1048
- for (const s of e.children)
1049
- s.type === "directory" && (t.push(s.absolutePath), t.push(...jr(s)));
1122
+ for (const r of e.children)
1123
+ r.type === "directory" && (t.push(r.absolutePath), t.push(...qr(r)));
1050
1124
  return t;
1051
- }, Tn = ({
1125
+ }, io = ({
1052
1126
  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 },
1127
+ expansion: { toggle: t, isExpanded: r, expandMultiple: n, collapseMultiple: o, isPending: l, alwaysExpanded: c = !1, doubleClickAction: d = "recursive" },
1128
+ selection: { onEntryClick: j, selectedPath: x, currentPath: f, mode: p = "none", selectedItems: E, onSelectionChange: S },
1055
1129
  visual: {
1056
- className: g,
1057
- style: j,
1058
- ariaLabel: f,
1059
- ariaLabelledBy: p,
1060
- lineColor: E = "#A0AEC0",
1061
- showTreeLines: N = !0,
1062
- showExpandIcons: I = !0,
1063
- showDirectoryIcons: w = !0,
1064
- showFileIcons: h = !0,
1065
- iconOverrides: H,
1066
- 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
1130
+ className: P,
1131
+ style: m,
1132
+ ariaLabel: v,
1133
+ ariaLabelledBy: k,
1134
+ lineColor: M = "#A0AEC0",
1135
+ showTreeLines: w = !0,
1136
+ showExpandIcons: R = !0,
1137
+ showDirectoryIcons: y = !0,
1138
+ showFileIcons: W = !0,
1139
+ iconOverrides: D,
1140
+ expandIconSize: _,
1141
+ itemHeight: K = it,
1142
+ removeRootIndent: ce = !1,
1143
+ highlightStyles: Z,
1144
+ entryClassName: Q,
1145
+ entryStyle: oe,
1146
+ nameClassName: re,
1147
+ nameStyle: $,
1148
+ directoryNameClassName: pe,
1149
+ directoryNameStyle: ie,
1150
+ fileNameClassName: ue,
1151
+ fileNameStyle: z,
1152
+ expandIconClassName: C,
1153
+ expandIconStyle: s
1078
1154
  } = {},
1079
- virtualScroll: me,
1080
- grid: O,
1081
- sort: o,
1082
- locale: y,
1083
- labels: T
1155
+ virtualScroll: h,
1156
+ grid: g,
1157
+ sort: N,
1158
+ locale: se,
1159
+ labels: de,
1160
+ ref: A
1084
1161
  }) => {
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,
1162
+ const ee = $r(se), ye = Y(() => Fn(se, de), [se, de]), fe = eo(Mn(ye)), { entryKindDirectory: Ce, entryKindFile: Re } = ye, ne = g !== void 0, [L, me] = le(!1), X = V(null), xe = V(null), U = V(null), [Me, Ie] = le(0), [B, ft] = le(0), [$e, He] = le(0), [Ue, mt] = le(null), {
1163
+ overscanCount: _e = 15,
1164
+ className: Ke,
1165
+ background: Xe,
1166
+ onScroll: Je,
1167
+ onRangeChange: Ze,
1168
+ onScrollAdjust: qe,
1169
+ liveRegion: We,
1170
+ initialScrollIndex: G,
1171
+ initialScrollOffset: ge,
1172
+ initialScrollAnchor: Ot,
1173
+ callbackThrottleMs: Lt = 5,
1174
+ contentInsets: Dt,
1175
+ onItemFocus: Ft,
1176
+ viewportHeightOverride: ae,
1177
+ scrollBarOptions: ht,
1178
+ behaviorOptions: Mt,
1179
+ preserveScrollAnchor: $t = !1,
1180
+ getItemKey: Qr,
1102
1181
  // 素通しの 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);
1182
+ testId: Ht,
1183
+ contentProps: pt
1184
+ } = h ?? {}, Wt = Y(
1185
+ () => ne ? { ...pt, role: "rowgroup" } : { ...pt, role: "tree", "aria-label": k ? void 0 : v, "aria-labelledby": k, "aria-multiselectable": p === "multiple" ? !0 : void 0 },
1186
+ [ne, pt, v, k, p]
1187
+ ), Bt = Y(() => ({ ...Mt, enableKeyboardNavigation: !1 }), [Mt]), [Qe, zt] = le(typeof ge == "number" ? ge : 0), yt = V(typeof ge == "number" ? ge : 0), Gt = T(
1188
+ (a, u) => {
1189
+ yt.current = a, zt(a), Je?.(a, u);
1109
1190
  },
1110
- [Ae]
1111
- ), kt = $(
1191
+ [Je]
1192
+ ), Yt = T(
1112
1193
  (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);
1194
+ const { renderingStartIndex: u, renderingEndIndex: b } = a;
1195
+ mt((I) => I && I.renderStart === u && I.renderEnd === b ? I : { renderStart: u, renderEnd: b }), Ze?.(a);
1115
1196
  },
1116
- [le]
1197
+ [Ze]
1117
1198
  );
1118
- ye(() => {
1119
- Z(!0), gn();
1120
- }, []), ye(() => {
1121
- const a = q.current, b = k ? ke.current : a, L = () => {
1199
+ ke(() => {
1200
+ me(!0), Qn();
1201
+ }, []), ke(() => {
1202
+ const a = X.current, u = ne ? xe.current : a, b = () => {
1122
1203
  if (a) {
1123
- const V = a.clientWidth;
1124
- Je((X) => Math.abs(X - V) > 1 ? V : X);
1204
+ const H = a.clientWidth;
1205
+ ft((q) => Math.abs(q - H) > 1 ? H : q);
1125
1206
  }
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);
1207
+ if (typeof ae == "number")
1208
+ Ie((H) => Math.abs(H - ae) > 1 ? ae : H);
1209
+ else if (u) {
1210
+ const H = u.clientHeight;
1211
+ Ie((q) => Math.abs(q - H) > 1 ? H : q);
1131
1212
  }
1132
1213
  };
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(
1214
+ if (!(a || u)) return Ie(0);
1215
+ b();
1216
+ const I = new ResizeObserver(b);
1217
+ return a && I.observe(a), u && u !== a && I.observe(u), () => I.disconnect();
1218
+ }, [ae, ne]);
1219
+ const Ae = typeof ae == "number" ? ae : Me, be = T((a) => c || (L ? r(a) : !1), [L, r, c]), Vt = O(F.container, l && F.containerPending, P), Ut = Y(
1139
1220
  () => ({
1140
- ...vn,
1141
- ...j ?? {},
1142
- ...typeof ie == "number" ? { height: ie, minHeight: ie } : {}
1221
+ ...qn,
1222
+ ...m ?? {},
1223
+ ...typeof ae == "number" ? { height: ae, minHeight: ae } : {}
1143
1224
  }),
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.`);
1225
+ [m, ae]
1226
+ ), bt = T(
1227
+ (a, u) => {
1228
+ const b = [a.absolutePath, ...qr(a)], I = u || d;
1229
+ if (b.every((we) => be(we))) return o(b);
1230
+ if (b.every((we) => !be(we)) || I === "recursive") return n(b);
1231
+ if (I === "toggle") return o(b);
1232
+ console.warn(`[DirectoryTree] Unknown double click action: ${I}. No action taken.`);
1152
1233
  },
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 };
1234
+ [be, n, o, d]
1235
+ ), Kt = ne ? !1 : ce, { flatItems: je, lineItems: gt, maxIndent: Xt } = Y(() => ro(e, be, w, Kt, N), [e, be, w, Kt, N]), J = Y(
1236
+ () => je.map((a, u) => {
1237
+ const b = typeof K == "function" ? K(a.entry, u) : K;
1238
+ return { ...a, rowHeight: Number.isFinite(b) && b > 0 ? b : it };
1158
1239
  }),
1159
- [ve, F]
1160
- ), be = K(() => U.map((a) => a.rowHeight), [U]), ge = K(() => {
1161
- const a = new Array(be.length + 1);
1240
+ [je, K]
1241
+ ), Se = Y(() => J.map((a) => a.rowHeight), [J]), Ne = Y(() => {
1242
+ const a = new Array(Se.length + 1);
1162
1243
  a[0] = 0;
1163
- for (let b = 0; b < be.length; b++)
1164
- a[b + 1] = a[b] + be[b];
1244
+ for (let u = 0; u < Se.length; u++)
1245
+ a[u + 1] = a[u] + Se[u];
1165
1246
  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;
1247
+ }, [Se]), Jt = T((a) => J[a]?.rowHeight ?? it, [J]), en = T((a) => J[a]?.entry.absolutePath ?? a, [J]), Zt = Qr ?? en, Oe = x ?? null, vt = f ?? null, [qt, Be] = le(() => ({ selectedPath: Oe, selectionGeneration: 0, anchor: null })), wt = Lr(qt, Oe);
1248
+ wt !== qt && Be((a) => Lr(a, Oe));
1249
+ const et = Y(() => Xn(je), [je]), Le = Y(() => Zn(et, wt), [et, wt]), ze = V(/* @__PURE__ */ new Map()), tt = V(null), [rt] = le($n), Ge = V(null), [tn, Qt] = le(!0), xt = V(je);
1250
+ xt.current = je;
1251
+ const er = V(be);
1252
+ er.current = be;
1253
+ const St = V(t);
1254
+ St.current = t;
1255
+ const tr = V(et);
1256
+ tr.current = et;
1257
+ const Et = V(Le);
1258
+ Et.current = Le;
1259
+ const rr = V(Ft);
1260
+ rr.current = Ft;
1261
+ const Pe = T((a) => {
1262
+ const u = U.current;
1263
+ return !u || u.getViewportSize() <= 0 ? !1 : (u.scrollToIndex(a, { align: "nearest" }), !0);
1264
+ }, []), ve = T(
1265
+ (a) => {
1266
+ const u = ze.current.get(a);
1267
+ if (u === void 0) {
1268
+ Ge.current = a, Pe(a) || (Ge.current = null);
1269
+ return;
1270
+ }
1271
+ Ge.current = null, Pe(a), u.focus({ preventScroll: !0 });
1272
+ },
1273
+ [Pe]
1274
+ ), nr = T((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((b) => b.anchor === null ? b : { ...b, anchor: { ...b.anchor, focused: !0 } });
1277
+ else {
1278
+ const b = ze.current.get(a);
1279
+ ze.current.delete(a), b?.contains(b.ownerDocument.activeElement) && Be((I) => I.anchor === null ? I : { ...I, anchor: { ...I.anchor, focused: !1 } });
1180
1280
  }
1181
- ot.current = a, Q.current?.scrollToIndex(a);
1281
+ a === Et.current && Qt(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
+ mr(() => {
1284
+ Qt(ze.current.has(Le));
1285
+ }, [Le]);
1286
+ const kt = T(
1287
+ (a, u, b) => {
1288
+ const I = tt.current === b;
1289
+ tt.current = null, I || (Be((H) => Jn(H, u)), rt.landedOn(b) || Pe(a)), rr.current?.(a);
1290
+ },
1291
+ [Pe, rt]
1292
+ ), nt = T((a) => rt.mark(a.nativeEvent), [rt]), Rt = T((a, u) => {
1293
+ const { ownerDocument: b } = u;
1294
+ if (!b.hasFocus() && u.contains(b.activeElement)) {
1295
+ tt.current = u;
1296
+ return;
1297
+ }
1298
+ tt.current = null, Be((I) => I.anchor !== null && I.anchor.path === a ? { ...I, anchor: { ...I.anchor, focused: !1 } } : I);
1299
+ }, []), rn = T(() => ve(Et.current), [ve]), It = T(
1300
+ (a, u) => {
1301
+ const b = Fr(u), I = xt.current.length;
1302
+ if (!Number.isInteger(a) || a < 0 || a >= I)
1303
+ throw new RangeError(`[directory-tree] scrollToIndex: ${String(a)} is not a row index (${I === 0 ? "the tree has no rows" : `expected an integer in 0..${String(I - 1)}`}).`);
1304
+ if (b === "nearest") {
1305
+ Pe(a);
1306
+ return;
1307
+ }
1308
+ U.current?.scrollToIndex(a, { align: b });
1309
+ },
1310
+ [Pe]
1311
+ );
1312
+ un(
1313
+ A,
1314
+ () => ({
1315
+ scrollToIndex: It,
1316
+ scrollToPath: (a, u) => {
1317
+ Fr(u);
1318
+ const b = tr.current.get(a);
1319
+ return b === void 0 ? !1 : (It(b, u), !0);
1320
+ },
1321
+ getScrollAnchor: () => U.current?.getScrollAnchor() ?? null
1322
+ }),
1323
+ [It]
1324
+ );
1325
+ const or = T(
1326
+ (a, u) => {
1327
+ if (a.altKey || a.ctrlKey || a.metaKey)
1328
+ return;
1329
+ const b = xt.current, I = b.length - 1;
1330
+ if (I < 0) return;
1331
+ const H = b[u], q = H?.entry.children !== void 0, we = q && er.current(H.entry.absolutePath);
1191
1332
  switch (a.key) {
1192
1333
  case "ArrowDown":
1193
- a.preventDefault(), we(Math.min(b + 1, B));
1334
+ a.preventDefault(), ve(Math.min(u + 1, I));
1194
1335
  break;
1195
1336
  case "ArrowUp":
1196
- a.preventDefault(), we(Math.max(b - 1, 0));
1337
+ a.preventDefault(), ve(Math.max(u - 1, 0));
1197
1338
  break;
1198
1339
  case "Home":
1199
- a.preventDefault(), we(0);
1340
+ a.preventDefault(), ve(0);
1200
1341
  break;
1201
1342
  case "End":
1202
- a.preventDefault(), we(B);
1343
+ a.preventDefault(), ve(I);
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(), q && !we ? St.current(H.entry.absolutePath) : q && u < I && b[u + 1].depth > H.depth && ve(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(), q && we) {
1350
+ St.current(H.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 ln = H?.depth ?? 0;
1354
+ for (let lt = u - 1; lt >= 0; lt--)
1355
+ if (b[lt].depth < ln) {
1356
+ ve(lt);
1216
1357
  break;
1217
1358
  }
1218
1359
  break;
1219
1360
  }
1220
1361
  }
1221
1362
  },
1222
- [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,
1363
+ [ve]
1364
+ ), ot = Y(
1365
+ () => !w || gt.length === 0 ? { segmentsByItem: [], glyphsByItem: [] } : oo(gt, Se, Ne, ut, w, _ ?? Tr),
1366
+ [gt, Se, Ne, w, _]
1367
+ ), st = Y(() => !w || e.length === 0 ? 0 : (Xt + 2) * ut, [e.length, Xt, w]), { renderStart: sr, renderEnd: ar, lookaheadEnd: lr } = Y(
1368
+ () => no(J.length, Ae, _e, Ue, Qe, Ne),
1369
+ [J.length, Ae, _e, Ue, Qe, Ne]
1370
+ ), jt = Y(() => !w || st <= 0 || Ae <= 0 || ot.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: st, height: Ae }, children: /* @__PURE__ */ i.jsx(
1371
+ Zr,
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: ot.segmentsByItem,
1374
+ glyphsByItem: ot.glyphsByItem,
1375
+ itemHeight: Se[0] ?? it,
1376
+ width: st,
1377
+ viewportHeight: Ae,
1378
+ scrollPosition: Qe,
1379
+ color: M,
1380
+ expandGlyphColor: M,
1381
+ expandGlyphSize: _ ?? Tr,
1382
+ renderStartIndex: sr,
1383
+ renderEndIndex: ar,
1384
+ lookaheadEndIndex: lr
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
+ ) }) }), [st, Ae, sr, ar, lr, Qe, ot, M, w, _, Se]), cr = T((a) => J[a], [J]), ir = V(null);
1387
+ mr(() => {
1388
+ const a = ir.current;
1389
+ if (ir.current = { items: J, offsets: Ne }, !$t || !a || a.items === J)
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 = U.current, b = u?.getScrollPosition(), I = typeof b == "number" && b >= 0 ? b : yt.current, H = Wn(a.items, a.offsets, I);
1392
+ if (!H)
1252
1393
  return;
1253
- const X = fn(V, U, ge);
1254
- if (X === null || Math.abs(X - B) < 1)
1394
+ const q = Bn(H, J, Ne);
1395
+ if (q === null || Math.abs(q - I) < 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 we = u ? u.scrollTo(q) : q;
1398
+ yt.current = we, zt(we);
1399
+ }, [J, Ne, $t]);
1400
+ const Ee = g?.columns, De = g?.scrollBarWidth ?? ht?.width ?? Xr, te = Y(() => Ee ? An({ measuredWidth: B, columns: Ee, scrollBarWidth: De }) : null, [Ee, B, De]), at = Y(() => Ee ? _n(Ee) : "", [Ee]), nn = Y(() => g?.showFooter && Ee ? On(e) : [], [g?.showFooter, Ee, e]), Fe = te?.maxHScroll ?? 0;
1401
+ ke(() => {
1402
+ He((a) => Nt(a, Fe));
1403
+ }, [Fe]);
1404
+ const ur = T((a) => He((u) => Nt(u + a, Fe)), [Fe]), dr = Y(
1405
+ () => ({ iconOverrides: D, showExpandIcons: R, showDirectoryIcons: y, showFileIcons: W, useCanvasExpandIcons: w, expandIconSize: _, highlightStyles: Z, expandIconClassName: C, expandIconStyle: s }),
1406
+ [D, R, y, W, w, _, Z, C, s]
1407
+ ), fr = Y(
1408
+ () => /* @__PURE__ */ i.jsx(
1409
+ hn,
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: _,
1278
- 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 ? (
1411
+ ref: U,
1412
+ itemCount: J.length,
1413
+ getItem: cr,
1414
+ getItemHeight: Jt,
1415
+ getItemKey: Zt,
1416
+ testId: Ht,
1417
+ contentProps: Wt,
1418
+ locale: ee,
1419
+ labels: fe,
1420
+ viewportSize: typeof ae == "number" ? ae : void 0,
1421
+ overscanCount: _e,
1422
+ onScroll: Gt,
1423
+ onRangeChange: Yt,
1424
+ onScrollAdjust: qe,
1425
+ liveRegion: We,
1426
+ className: Ke,
1427
+ onWheelHorizontal: ne ? ur : 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: jt })
1432
+ ) : jt,
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: G,
1436
+ initialScrollOffset: ge,
1437
+ initialScrollAnchor: Ot,
1438
+ callbackThrottleMs: Lt,
1439
+ contentInsets: Dt,
1440
+ scrollBarOptions: ht,
1441
+ behaviorOptions: Bt,
1442
+ children: (a, u) => a ? ne && g && te ? /* @__PURE__ */ i.jsx(
1443
+ Vr,
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: kt,
1452
+ onRowBlur: Rt,
1453
+ isSelectedForAria: !!E?.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: be,
1456
+ columns: g.columns,
1457
+ numericTemplate: at,
1458
+ numericTotal: te.numericTotal,
1459
+ nameWidth: te.nameWidth,
1460
+ rowClassName: g.rowClassName,
1461
+ selection: { onEntryClick: j, selectedPath: Oe, currentPath: vt, mode: p, selectedItems: E, onSelectionChange: S },
1462
+ expansion: { toggleDirectory: t, onToggleDirectoryRecursive: bt },
1463
+ visual: dr
1319
1464
  },
1320
1465
  a.entry.absolutePath
1321
- ) : /* @__PURE__ */ c.jsx(
1322
- ft,
1466
+ ) : /* @__PURE__ */ i.jsx(
1467
+ At,
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: !!E?.has(a.entry.absolutePath),
1475
+ flatIndex: u,
1476
+ isActive: u === Le,
1477
+ registerRowRef: nr,
1478
+ onNavigationKeyDown: or,
1479
+ onRowFocus: kt,
1480
+ onRowBlur: Rt,
1334
1481
  rowHeight: a.rowHeight,
1335
- entryKindDirectory: P,
1336
- entryKindFile: ae,
1337
- isDirOpen: he,
1482
+ entryKindDirectory: Ce,
1483
+ entryKindFile: Re,
1484
+ isDirOpen: be,
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: bt },
1488
+ selection: { onEntryClick: j, selectedPath: Oe, currentPath: vt, mode: p, selectedItems: E, onSelectionChange: S },
1342
1489
  visual: {
1343
- iconOverrides: H,
1344
- showExpandIcons: I,
1345
- showDirectoryIcons: w,
1346
- showFileIcons: h,
1347
- useCanvasExpandIcons: N,
1348
- 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
1490
+ iconOverrides: D,
1491
+ showExpandIcons: R,
1492
+ showDirectoryIcons: y,
1493
+ showFileIcons: W,
1494
+ useCanvasExpandIcons: w,
1495
+ expandIconSize: _,
1496
+ highlightStyles: Z,
1497
+ entryClassName: Q,
1498
+ entryStyle: oe,
1499
+ nameClassName: re,
1500
+ nameStyle: $,
1501
+ directoryNameClassName: pe,
1502
+ directoryNameStyle: ie,
1503
+ fileNameClassName: ue,
1504
+ fileNameStyle: z,
1505
+ expandIconClassName: C,
1506
+ expandIconStyle: s
1358
1507
  }
1359
1508
  },
1360
1509
  a.entry.absolutePath
@@ -1362,202 +1511,215 @@ const jr = (e) => {
1362
1511
  }
1363
1512
  ),
1364
1513
  [
1365
- U.length,
1366
- $t,
1514
+ J.length,
1515
+ cr,
1516
+ Jt,
1517
+ Zt,
1518
+ Ht,
1519
+ Wt,
1520
+ ee,
1521
+ fe,
1522
+ Ce,
1523
+ Re,
1524
+ Le,
1525
+ nr,
1526
+ or,
1527
+ kt,
1367
1528
  Rt,
1368
- Tt,
1369
- vt,
1370
- gt,
1371
- _,
1372
- de,
1373
- P,
1374
1529
  ae,
1375
- At,
1530
+ _e,
1531
+ Gt,
1532
+ Yt,
1533
+ qe,
1534
+ We,
1535
+ Ke,
1536
+ ne,
1537
+ ur,
1538
+ te,
1539
+ jt,
1540
+ Xe,
1541
+ G,
1542
+ ge,
1376
1543
  Ot,
1377
1544
  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,
1545
+ Dt,
1392
1546
  ht,
1393
- pt,
1394
- qe,
1395
- bt,
1396
- O,
1397
- ze,
1398
- he,
1547
+ Bt,
1548
+ g,
1549
+ at,
1550
+ be,
1551
+ j,
1552
+ Oe,
1553
+ vt,
1554
+ p,
1555
+ E,
1399
1556
  S,
1400
- x,
1401
- d,
1402
- m,
1403
- v,
1404
1557
  t,
1405
- tt,
1406
- Bt,
1407
- H,
1408
- I,
1409
- w,
1410
- h,
1411
- N,
1412
- C,
1413
- J,
1414
- W,
1415
- ne,
1416
- se,
1558
+ bt,
1559
+ dr,
1560
+ D,
1417
1561
  R,
1562
+ y,
1563
+ W,
1564
+ w,
1565
+ _,
1566
+ Z,
1567
+ Q,
1568
+ oe,
1569
+ re,
1570
+ $,
1571
+ pe,
1572
+ ie,
1573
+ ue,
1418
1574
  z,
1419
- A,
1420
- Y,
1421
- fe
1575
+ C,
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: X, className: Vt, style: Ut, onPointerDownCapture: nt, onMouseDownCapture: nt, children: [
1581
+ je.length > 0 && !tn && // 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: to, onFocus: rn }),
1584
+ fr
1585
+ ] });
1586
+ const on = g.showHeader ?? !0, sn = g.showFooter ?? !1, an = { ...Ut, "--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: X,
1591
+ className: O(Vt, "dt-grid"),
1592
+ style: an,
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": J.length + (g.showHeader ?? !0 ? 1 : 0),
1598
+ onPointerDownCapture: nt,
1599
+ onMouseDownCapture: nt,
1438
1600
  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,
1601
+ on && // biome-ignore lint/a11y/useSemanticElements: 仮想スクロールの treegrid は絶対配置行を使うため native table 要素にできない。ARIA ロールで意味を提供する
1602
+ /* @__PURE__ */ i.jsx("div", { role: "rowgroup", children: /* @__PURE__ */ i.jsx(Pn, { columns: g.columns, numericTemplate: at, numericTotal: te.numericTotal, nameWidth: te.nameWidth, scrollBarWidth: De, className: g.headerClassName }) }),
1603
+ /* @__PURE__ */ i.jsx("div", { ref: xe, className: "dt-grid-body", children: fr }),
1604
+ Fe > 0 && /* @__PURE__ */ i.jsxs("div", { className: "dt-grid-hscrollbar-row", children: [
1605
+ /* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: te.nameWidth }, "aria-hidden": "true" }),
1606
+ /* @__PURE__ */ i.jsx(
1607
+ pn,
1446
1608
  {
1447
1609
  horizontal: !0,
1448
- contentSize: ee.numericTotal,
1449
- viewportSize: ee.numericVisible,
1450
- scrollPosition: Ce,
1451
- scrollBarWidth: Ne,
1452
- locale: _,
1453
- labels: de,
1610
+ contentSize: te.numericTotal,
1611
+ viewportSize: te.numericVisible,
1612
+ scrollPosition: $e,
1613
+ scrollBarWidth: De,
1614
+ locale: ee,
1615
+ labels: fe,
1454
1616
  onScroll: (a) => {
1455
- const b = typeof a == "function" ? a(Ce) : a, L = lt(b, Re);
1456
- return _e(L), L;
1617
+ const u = typeof a == "function" ? a($e) : a, b = Nt(u, Fe);
1618
+ return He(b), b;
1457
1619
  }
1458
1620
  }
1459
1621
  ),
1460
- /* @__PURE__ */ c.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: Ne }, "aria-hidden": "true" })
1622
+ /* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: De }, "aria-hidden": "true" })
1461
1623
  ] }),
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 }) })
1624
+ sn && // biome-ignore lint/a11y/useSemanticElements: 同上 (フッタ行も絶対配置レイアウトの一部)
1625
+ /* @__PURE__ */ i.jsx("div", { role: "rowgroup", children: /* @__PURE__ */ i.jsx(Tn, { columns: g.columns, numericTemplate: at, numericTotal: te.numericTotal, nameWidth: te.nameWidth, scrollBarWidth: De, allEntries: nn, className: g.footerClassName }) })
1464
1626
  ]
1465
1627
  }
1466
1628
  );
1467
- }, Cn = ({ initialExpanded: e = /* @__PURE__ */ new Set(), storageKey: t } = {}) => {
1468
- const [s, n] = Dr(), [r, i] = ue(() => {
1629
+ }, uo = ({ initialExpanded: e = /* @__PURE__ */ new Set(), storageKey: t } = {}) => {
1630
+ const [r, n] = fn(), [o, l] = le(() => {
1469
1631
  if (typeof window < "u" && t)
1470
1632
  try {
1471
- const f = window.localStorage.getItem(t);
1472
- if (f) {
1473
- const p = JSON.parse(f);
1474
- return new Set(p);
1633
+ const m = window.localStorage.getItem(t);
1634
+ if (m) {
1635
+ const v = JSON.parse(m);
1636
+ return new Set(v);
1475
1637
  }
1476
- } catch (f) {
1477
- console.error("[useDirectoryTreeState] Error reading from localStorage", f);
1638
+ } catch (m) {
1639
+ console.error("[useDirectoryTreeState] Error reading from localStorage", m);
1478
1640
  }
1479
1641
  return e;
1480
- }), l = $((f) => {
1642
+ }), c = T((m) => {
1481
1643
  n(() => {
1482
- i((p) => {
1483
- const E = new Set(p);
1484
- return f(E), E;
1644
+ l((v) => {
1645
+ const k = new Set(v);
1646
+ return m(k), k;
1485
1647
  });
1486
1648
  });
1487
- }, []), u = $(
1488
- (f, p) => {
1489
- l((E) => {
1490
- for (const N of f)
1491
- p(E, N);
1649
+ }, []), d = T(
1650
+ (m, v) => {
1651
+ c((k) => {
1652
+ for (const M of m)
1653
+ v(k, M);
1492
1654
  });
1493
1655
  },
1494
- [l]
1656
+ [c]
1495
1657
  );
1496
- ye(() => {
1658
+ ke(() => {
1497
1659
  if (t && typeof window < "u")
1498
1660
  try {
1499
- window.localStorage.setItem(t, JSON.stringify(Array.from(r)));
1500
- } catch (f) {
1501
- console.warn(`Error setting localStorage key "${t}":`, f);
1661
+ window.localStorage.setItem(t, JSON.stringify(Array.from(o)));
1662
+ } catch (m) {
1663
+ console.warn(`Error setting localStorage key "${t}":`, m);
1502
1664
  }
1503
- }, [r, t]);
1504
- const S = $(
1505
- (f) => {
1506
- u([f], (p, E) => {
1507
- p.has(E) ? p.delete(E) : p.add(E);
1665
+ }, [o, t]);
1666
+ const j = T(
1667
+ (m) => {
1668
+ d([m], (v, k) => {
1669
+ v.has(k) ? v.delete(k) : v.add(k);
1508
1670
  });
1509
1671
  },
1510
- [u]
1511
- ), x = $(
1512
- (f) => {
1513
- u([f], (p, E) => {
1514
- p.add(E);
1672
+ [d]
1673
+ ), x = T(
1674
+ (m) => {
1675
+ d([m], (v, k) => {
1676
+ v.add(k);
1515
1677
  });
1516
1678
  },
1517
- [u]
1518
- ), d = $(
1519
- (f) => {
1520
- u([f], (p, E) => {
1521
- p.delete(E);
1679
+ [d]
1680
+ ), f = T(
1681
+ (m) => {
1682
+ d([m], (v, k) => {
1683
+ v.delete(k);
1522
1684
  });
1523
1685
  },
1524
- [u]
1525
- ), m = $(
1526
- (f) => {
1527
- u(f, (p, E) => {
1528
- p.delete(E);
1686
+ [d]
1687
+ ), p = T(
1688
+ (m) => {
1689
+ d(m, (v, k) => {
1690
+ v.delete(k);
1529
1691
  });
1530
1692
  },
1531
- [u]
1532
- ), v = $(
1533
- (f) => {
1534
- u(f, (p, E) => {
1535
- p.add(E);
1693
+ [d]
1694
+ ), E = T(
1695
+ (m) => {
1696
+ d(m, (v, k) => {
1697
+ v.add(k);
1536
1698
  });
1537
1699
  },
1538
- [u]
1539
- ), g = $(() => {
1540
- l((f) => {
1541
- f.clear();
1700
+ [d]
1701
+ ), S = T(() => {
1702
+ c((m) => {
1703
+ m.clear();
1542
1704
  });
1543
- }, [l]), j = $((f) => r.has(f), [r]);
1705
+ }, [c]), P = T((m) => o.has(m), [o]);
1544
1706
  return {
1545
- expanded: r,
1546
- toggle: S,
1707
+ expanded: o,
1708
+ toggle: j,
1547
1709
  expand: x,
1548
- collapse: d,
1549
- collapseMultiple: m,
1550
- expandMultiple: v,
1551
- collapseAll: g,
1552
- isExpanded: j,
1553
- isPending: s
1710
+ collapse: f,
1711
+ collapseMultiple: p,
1712
+ expandMultiple: E,
1713
+ collapseAll: S,
1714
+ isExpanded: P,
1715
+ isPending: r
1554
1716
  };
1555
1717
  };
1556
1718
  export {
1557
- on as DIRECTORY_TREE_LABEL_CATALOGS,
1558
- cr as DIRECTORY_TREE_LABEL_KEYS,
1559
- Tn as DirectoryTree,
1560
- M as directoryTreeClasses,
1561
- ln as resolveDirectoryTreeLabels,
1562
- Cn as useDirectoryTreeState
1719
+ Ln as DIRECTORY_TREE_LABEL_CATALOGS,
1720
+ Ar as DIRECTORY_TREE_LABEL_KEYS,
1721
+ io as DirectoryTree,
1722
+ F as directoryTreeClasses,
1723
+ Fn as resolveDirectoryTreeLabels,
1724
+ uo as useDirectoryTreeState
1563
1725
  };