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