@aiquants/directory-tree 6.1.0 → 6.1.1

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/README.md CHANGED
@@ -197,7 +197,8 @@ These are **not** accepted, because the tree owns them:
197
197
  of `DirectoryTree`, which also reaches the row kind words and the grid-mode horizontal scrollbar. See
198
198
  [Localization](#localization).
199
199
  - `ref`: use the tree's own handle ([Scroll handle](#scroll-handle-ref)).
200
- - `onWheelHorizontal`, `onPanHorizontal`, `horizontalKeyInputs`, `horizontalKeyStep`: the tree owns the horizontal axis.
200
+ - `onWheelHorizontal`, `onPanHorizontal`, `panHorizontalScrollable`, `horizontalKeyInputs`, `horizontalKeyStep`: the
201
+ tree owns the horizontal axis.
201
202
  - `behaviorOptions.enableKeyboardNavigation` and `behaviorOptions.enableEscapeRowReturn`: the tree's rows own the
202
203
  keyboard (see [Keyboard and focus](#keyboard-and-focus)); the tree always turns the engine's row navigation off,
203
204
  because its row wrappers would otherwise be focusable elements between `role="tree"` and the treeitems.
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react"),ye=require("@aiquants/virtualscroll"),K=require("tailwind-merge"),le=require("@phosphor-icons/react");function hn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const ue=hn(l);var ft={exports:{}},Je={};var wr;function mn(){if(wr)return Je;wr=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,a,i){var c=null;if(i!==void 0&&(c=""+i),a.key!==void 0&&(c=""+a.key),"key"in a){i={};for(var u in a)u!=="key"&&(i[u]=a[u])}else i=a;return a=i.ref,{$$typeof:e,type:n,key:c,ref:a!==void 0?a:null,props:i}}return Je.Fragment=t,Je.jsx=r,Je.jsxs=r,Je}var qe={};var Er;function pn(){return Er||(Er=1,process.env.NODE_ENV!=="production"&&(function(){function e(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===F?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case E:return"Fragment";case $:return"Profiler";case v:return"StrictMode";case M:return"Suspense";case D:return"SuspenseList";case X:return"Activity"}if(typeof o=="object")switch(typeof o.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),o.$$typeof){case y:return"Portal";case P:return o.displayName||"Context";case N:return(o._context.displayName||"Context")+".Consumer";case b:var f=o.render;return o=o.displayName,o||(o=f.displayName||f.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case O:return f=o.displayName||null,f!==null?f:e(o.type)||"Memo";case q:f=o._payload,o=o._init;try{return e(o(f))}catch{}}return null}function t(o){return""+o}function r(o){try{t(o);var f=!1}catch{f=!0}if(f){f=console;var I=f.error,R=typeof Symbol=="function"&&Symbol.toStringTag&&o[Symbol.toStringTag]||o.constructor.name||"Object";return I.call(f,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",R),t(o)}}function n(o){if(o===E)return"<>";if(typeof o=="object"&&o!==null&&o.$$typeof===q)return"<...>";try{var f=e(o);return f?"<"+f+">":"<...>"}catch{return"<...>"}}function a(){var o=H.A;return o===null?null:o.getOwner()}function i(){return Error("react-stack-top-frame")}function c(o){if(fe.call(o,"key")){var f=Object.getOwnPropertyDescriptor(o,"key").get;if(f&&f.isReactWarning)return!1}return o.key!==void 0}function u(o,f){function I(){he||(he=!0,console.error("%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)",f))}I.isReactWarning=!0,Object.defineProperty(o,"key",{get:I,configurable:!0})}function m(){var o=e(this.type);return Y[o]||(Y[o]=!0,console.error("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.")),o=this.props.ref,o!==void 0?o:null}function S(o,f,I,R,be,C){var L=I.ref;return o={$$typeof:g,type:o,key:f,props:I,_owner:R},(L!==void 0?L:null)!==null?Object.defineProperty(o,"ref",{enumerable:!1,get:m}):Object.defineProperty(o,"ref",{enumerable:!1,value:null}),o._store={},Object.defineProperty(o._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(o,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(o,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:be}),Object.defineProperty(o,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:C}),Object.freeze&&(Object.freeze(o.props),Object.freeze(o)),o}function T(o,f,I,R,be,C){var L=f.children;if(L!==void 0)if(R)if(B(L)){for(R=0;R<L.length;R++)x(L[R]);Object.freeze&&Object.freeze(L)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else x(L);if(fe.call(f,"key")){L=e(o);var Z=Object.keys(f).filter(function(Ie){return Ie!=="key"});R=0<Z.length?"{key: someKey, "+Z.join(": ..., ")+": ...}":"{key: someKey}",ge[L+R]||(Z=0<Z.length?"{"+Z.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react"),ye=require("@aiquants/virtualscroll"),K=require("tailwind-merge"),le=require("@phosphor-icons/react");function fn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const ue=fn(l);var ut={exports:{}},Je={};var vr;function hn(){if(vr)return Je;vr=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,a,i){var c=null;if(i!==void 0&&(c=""+i),a.key!==void 0&&(c=""+a.key),"key"in a){i={};for(var u in a)u!=="key"&&(i[u]=a[u])}else i=a;return a=i.ref,{$$typeof:e,type:n,key:c,ref:a!==void 0?a:null,props:i}}return Je.Fragment=t,Je.jsx=r,Je.jsxs=r,Je}var qe={};var wr;function mn(){return wr||(wr=1,process.env.NODE_ENV!=="production"&&(function(){function e(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===F?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case E:return"Fragment";case $:return"Profiler";case v:return"StrictMode";case M:return"Suspense";case D:return"SuspenseList";case X:return"Activity"}if(typeof o=="object")switch(typeof o.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),o.$$typeof){case y:return"Portal";case P:return o.displayName||"Context";case N:return(o._context.displayName||"Context")+".Consumer";case b:var f=o.render;return o=o.displayName,o||(o=f.displayName||f.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case O:return f=o.displayName||null,f!==null?f:e(o.type)||"Memo";case q:f=o._payload,o=o._init;try{return e(o(f))}catch{}}return null}function t(o){return""+o}function r(o){try{t(o);var f=!1}catch{f=!0}if(f){f=console;var I=f.error,R=typeof Symbol=="function"&&Symbol.toStringTag&&o[Symbol.toStringTag]||o.constructor.name||"Object";return I.call(f,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",R),t(o)}}function n(o){if(o===E)return"<>";if(typeof o=="object"&&o!==null&&o.$$typeof===q)return"<...>";try{var f=e(o);return f?"<"+f+">":"<...>"}catch{return"<...>"}}function a(){var o=W.A;return o===null?null:o.getOwner()}function i(){return Error("react-stack-top-frame")}function c(o){if(fe.call(o,"key")){var f=Object.getOwnPropertyDescriptor(o,"key").get;if(f&&f.isReactWarning)return!1}return o.key!==void 0}function u(o,f){function I(){he||(he=!0,console.error("%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)",f))}I.isReactWarning=!0,Object.defineProperty(o,"key",{get:I,configurable:!0})}function m(){var o=e(this.type);return Y[o]||(Y[o]=!0,console.error("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.")),o=this.props.ref,o!==void 0?o:null}function S(o,f,I,R,be,C){var L=I.ref;return o={$$typeof:g,type:o,key:f,props:I,_owner:R},(L!==void 0?L:null)!==null?Object.defineProperty(o,"ref",{enumerable:!1,get:m}):Object.defineProperty(o,"ref",{enumerable:!1,value:null}),o._store={},Object.defineProperty(o._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(o,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(o,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:be}),Object.defineProperty(o,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:C}),Object.freeze&&(Object.freeze(o.props),Object.freeze(o)),o}function T(o,f,I,R,be,C){var L=f.children;if(L!==void 0)if(R)if(B(L)){for(R=0;R<L.length;R++)x(L[R]);Object.freeze&&Object.freeze(L)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else x(L);if(fe.call(f,"key")){L=e(o);var Z=Object.keys(f).filter(function(Ie){return Ie!=="key"});R=0<Z.length?"{key: someKey, "+Z.join(": ..., ")+": ...}":"{key: someKey}",ge[L+R]||(Z=0<Z.length?"{"+Z.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
2
  let props = %s;
3
3
  <%s {...props} />
4
4
  React keys must be passed directly to JSX without using spread:
5
5
  let props = %s;
6
- <%s key={someKey} {...props} />`,R,L,Z,L),ge[L+R]=!0)}if(L=null,I!==void 0&&(r(I),L=""+I),c(f)&&(r(f.key),L=""+f.key),"key"in f){I={};for(var me in f)me!=="key"&&(I[me]=f[me])}else I=f;return L&&u(I,typeof o=="function"?o.displayName||o.name||"Unknown":o),S(o,L,I,a(),be,C)}function x(o){_(o)?o._store&&(o._store.validated=1):typeof o=="object"&&o!==null&&o.$$typeof===q&&(o._payload.status==="fulfilled"?_(o._payload.value)&&o._payload.value._store&&(o._payload.value._store.validated=1):o._store&&(o._store.validated=1))}function _(o){return typeof o=="object"&&o!==null&&o.$$typeof===g}var p=l,g=Symbol.for("react.transitional.element"),y=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),$=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),P=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),X=Symbol.for("react.activity"),F=Symbol.for("react.client.reference"),H=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,fe=Object.prototype.hasOwnProperty,B=Array.isArray,re=console.createTask?console.createTask:function(){return null};p={react_stack_bottom_frame:function(o){return o()}};var he,Y={},G=p.react_stack_bottom_frame.bind(p,i)(),Ee=re(n(i)),ge={};qe.Fragment=E,qe.jsx=function(o,f,I){var R=1e4>H.recentlyCreatedOwnerStacks++;return T(o,f,I,!1,R?Error("react-stack-top-frame"):G,R?re(n(o)):Ee)},qe.jsxs=function(o,f,I){var R=1e4>H.recentlyCreatedOwnerStacks++;return T(o,f,I,!0,R?Error("react-stack-top-frame"):G,R?re(n(o)):Ee)}})()),qe}var Rr;function yn(){return Rr||(Rr=1,process.env.NODE_ENV==="production"?ft.exports=mn():ft.exports=pn()),ft.exports}var h=yn();function gn({title:e,titleId:t,...r},n){return ue.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?ue.createElement("title",{id:t},e):null,ue.createElement("path",{fillRule:"evenodd",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",clipRule:"evenodd"}))}const bn=ue.forwardRef(gn);function Sn({title:e,titleId:t,...r},n){return ue.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?ue.createElement("title",{id:t},e):null,ue.createElement("path",{fillRule:"evenodd",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",clipRule:"evenodd"}))}const vn=ue.forwardRef(Sn);function wn({title:e,titleId:t,...r},n){return ue.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?ue.createElement("title",{id:t},e):null,ue.createElement("path",{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"}))}const En=ue.forwardRef(wn),Lr={icon:{light:"#6a7282",dark:"#99a1af"},iconSelected:{light:"#1447e6",dark:"#51a2ff"},checkedRing:{light:"#155dfc",dark:"#51a2ff"}},Rn={markdown:{light:"#0084d1",dark:"#00bcff"},pdf:{light:"#e7000b",dark:"#ff6467"},spreadsheet:{light:"#007a55",dark:"#00d492"},csv:{light:"#007a55",dark:"#00d492"},document:{light:"#155dfc",dark:"#51a2ff"},presentation:{light:"#ca3500",dark:"#ff8904"},image:{light:"#00786f",dark:"#00d5be"},audio:{light:"#e60076",dark:"#fb64b6"},video:{light:"#7f22fe",dark:"#a684ff"},archive:{light:"#bb4d00",dark:"#ffb900"},code:{light:"#9810fa",dark:"#c27aff"},text:Lr.icon},jr="#71829b",ie={rowHover:"hover:bg-[color:light-dark(#f3f4f6,#1e2939)]",rowSelected:"bg-[color:light-dark(#eff6ff,#162456)]",checkedRing:"inset-ring-1 inset-ring-[color:light-dark(#155dfc,#51a2ff)]",name:"text-[color:light-dark(#364153,#e5e7eb)]",nameSelected:"text-[color:light-dark(#193cb8,#bedbff)]",gridEdge:"text-[color:light-dark(#4a5565,#d1d5dc)]",icon:"text-[color:light-dark(#6a7282,#99a1af)]",iconSelected:"text-[color:light-dark(#1447e6,#51a2ff)]"},de={markdown:"text-[color:light-dark(#0084d1,#00bcff)]",pdf:"text-[color:light-dark(#e7000b,#ff6467)]",spreadsheet:"text-[color:light-dark(#007a55,#00d492)]",csv:"text-[color:light-dark(#007a55,#00d492)]",document:"text-[color:light-dark(#155dfc,#51a2ff)]",presentation:"text-[color:light-dark(#ca3500,#ff8904)]",image:"text-[color:light-dark(#00786f,#00d5be)]",audio:"text-[color:light-dark(#e60076,#fb64b6)]",video:"text-[color:light-dark(#7f22fe,#a684ff)]",archive:"text-[color:light-dark(#bb4d00,#ffb900)]",code:"text-[color:light-dark(#9810fa,#c27aff)]",text:"text-[color:light-dark(#6a7282,#99a1af)]"},Ar="text-[length:var(--dt-font-size-body,0.8125rem)]",xn=`${Ar} leading-[max(var(--dt-line-height-body,1.25rem),1.5em)]`,_t=44,kn=12,In=8,ce=14,Cn=14,Mr=e=>e===void 0?void 0:{fontSize:typeof e=="number"?`${e}px`:e},oe=e=>({width:e,height:e}),A={container:"directory-tree-container relative h-full overflow-y-hidden pb-[3px] pr-[2px]",containerPending:"cursor-progress",entry:`directory-tree-entry flex items-center cursor-pointer relative select-none ${xn}`,entryHover:`directory-tree-entry--hover ${ie.rowHover}`,entrySelected:`directory-tree-entry--selected ${ie.rowSelected}`,entryItemSelected:`directory-tree-entry--item-selected ${ie.rowSelected} ${ie.checkedRing}`,expandIcon:`directory-tree-expand-icon flex-shrink-0 flex items-center justify-center ${ie.icon}`,expandIconSelected:`directory-tree-expand-icon--selected ${ie.iconSelected}`,typeIcon:`directory-tree-type-icon flex-shrink-0 flex items-center justify-center ${ie.icon}`,typeIconSelected:`directory-tree-type-icon--selected ${ie.iconSelected}`,name:`directory-tree-name overflow-hidden text-ellipsis whitespace-nowrap ml-1 ${Ar} font-normal ${ie.name}`,nameDirectory:"directory-tree-name--directory font-medium",nameSelected:`directory-tree-name--selected font-semibold ${ie.nameSelected}`},Mt=e=>{const t=e.slice(e.lastIndexOf("/")+1),r=t.lastIndexOf(".");return r<=0?"":t.slice(r+1).toLowerCase()},Tn=/^[a-z][a-z\d+.-]*:\/\//i,xr=e=>Mt(Tn.test(e)?e.split(/[?#]/,1)[0]:e),Dr=e=>Mt(e.name)||xr(e.relativePath)||xr(e.absolutePath),$r=({isDirectory:e,isExpanded:t,showExpandIcons:r,useCanvasExpandIcons:n,expandIconSize:a})=>{const i=a?{width:a,height:a}:void 0,c=a?"":"h-4 w-4";return!(r&&e)||n?h.jsx("span",{className:c,style:i,"aria-hidden":"true"}):t?h.jsx(bn,{className:c,style:i}):h.jsx(vn,{className:c,style:i})},Pt=(e,t)=>{if(e==null||typeof e=="boolean")return null;if(typeof e=="function")return console.warn(`[DirectoryTree] Function returned by renderer for "${t}". Return a node.`),null;if(typeof e=="object"){if("then"in e)return console.warn(`[DirectoryTree] Promise returned for "${t}". Not supported.`),null;if(Array.isArray(e)){const n=e.map(a=>Pt(a,t)).filter(Boolean);return n.length?n:null}const r=e.type;if(r&&r.$$typeof===Symbol.for("react.lazy"))return console.warn(`[DirectoryTree] Lazy component for "${t}". Not supported.`),null}return e},_n={markdown:e=>h.jsx(le.FileMd,{className:de.markdown,style:oe(e)}),pdf:e=>h.jsx(le.FilePdf,{className:de.pdf,style:oe(e)}),spreadsheet:e=>h.jsx(le.FileXls,{className:de.spreadsheet,style:oe(e)}),csv:e=>h.jsx(le.FileCsv,{className:de.csv,style:oe(e)}),document:e=>h.jsx(le.FileDoc,{className:de.document,style:oe(e)}),presentation:e=>h.jsx(le.FilePpt,{className:de.presentation,style:oe(e)}),image:e=>h.jsx(le.FileImage,{className:de.image,style:oe(e)}),audio:e=>h.jsx(le.FileAudio,{className:de.audio,style:oe(e)}),video:e=>h.jsx(le.FileVideo,{className:de.video,style:oe(e)}),archive:e=>h.jsx(le.FileZip,{className:de.archive,style:oe(e)}),code:e=>h.jsx(le.FileCode,{className:de.code,style:oe(e)}),text:e=>h.jsx(le.FileText,{className:de.text,style:oe(e)})},Nn={markdown:["md","markdown","mdx"],pdf:["pdf"],spreadsheet:["xls","xlsx","xlsm","xlsb","ods"],csv:["csv","tsv"],document:["doc","docx","rtf","odt"],presentation:["ppt","pptx","odp"],image:["png","jpg","jpeg","gif","svg","webp","ico","bmp","tiff","avif"],audio:["mp3","wav","ogg","m4a","flac","aac","wma"],video:["mp4","webm","mov","avi","mkv","wmv","flv"],archive:["zip","tar","gz","7z","rar","tgz","bz2"],code:["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"],text:["txt","log"]},Pn=new Map(Object.entries(Nn).flatMap(([e,t])=>t.map(r=>[r,e]))),On=new Set(["","application/octet-stream","binary/octet-stream","text/plain","application/x-empty"]),Ln=e=>(e??"").split(";",1)[0].trim().toLowerCase(),jn=e=>{if(e==="text/markdown"||e==="text/x-markdown")return"markdown";if(e==="application/pdf")return"pdf";if(e.includes("excel")||e.includes("spreadsheet"))return"spreadsheet";if(e==="text/csv"||e==="text/tab-separated-values")return"csv";if(e.includes("word")||e.includes("google-apps.document")||e==="application/rtf")return"document";if(e.includes("powerpoint")||e.includes("presentation"))return"presentation";if(e.startsWith("image/"))return"image";if(e.startsWith("audio/"))return"audio";if(e.startsWith("video/"))return"video";if(e.includes("zip")||e.includes("tar")||e.includes("compressed")||e.includes("archive"))return"archive";if(e==="application/json"||e.includes("javascript")||e.includes("typescript")||e.includes("xml")||e.startsWith("text/html")||e.startsWith("text/css")||e.includes("x-python")||e.includes("x-sh")||e.includes("x-go")||e.includes("x-rust"))return"code";if(e.startsWith("text/"))return"text"},An=(e,t,r,n)=>{const a=Ln(e),i=jn(a),c=Pn.get((t||(r?Mt(r):"")).toLowerCase()),m=(On.has(a)?[c,i]:[i,c]).find(S=>S!==void 0);return m===void 0?h.jsx(le.FileIcon,{className:ie.icon,style:oe(n)}):_n[m](n)},Fr=(e,t,r)=>{const{entry:n,isDirectory:a,isExpanded:i,extension:c,mimeType:u}=e;let m;const S=u||n.mimeType;return n.icon!==void 0?m=n.icon:a?m=i&&t?.directoryExpanded||t?.directory||h.jsx(En,{style:oe(r)}):c&&t?.fileByExtension?.[c]?m=t.fileByExtension[c]:m=t?.file||An(S,c,n.name,r),Pt(typeof m=="function"?m(e):m,n.absolutePath)},Mn=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),zr=e=>{if(!e)return;const t=Object.entries(e).filter(([,r])=>r!=null);if(t.length!==0)return Object.fromEntries(t.map(([r,n])=>[`data-${Mn(r)}`,String(n)]))},Br=["color","background","backgroundColor","backgroundImage","backgroundPosition","backgroundSize","backgroundRepeat","backgroundClip","backgroundOrigin","backgroundAttachment","backgroundBlendMode","opacity","boxShadow","filter","backdropFilter","mixBlendMode","borderColor","borderRadius","outline","outlineColor","outlineStyle","outlineWidth","outlineOffset","textShadow","accentColor","caretColor","cursor","fontFamily","fontSize","fontStyle","fontWeight","fontVariant","fontFeatureSettings","fontVariationSettings","fontKerning","letterSpacing","lineHeight","textDecoration","textDecorationColor","textDecorationLine","textDecorationStyle","textDecorationThickness","textUnderlineOffset","textTransform"],Hr=["color","opacity"],Dn="the row's box belongs to the tree (height: visual.itemHeight, indent: visual.indentSize, icons: visual.typeIconSize, text size: visual.fontSize)",$n=new Set(Br),Fn=new Set(Hr),kr=(e,t)=>{const r=t===void 0?e.option:`${e.option}.${t}`;return e.absolutePath===void 0?r:`${r} of "${e.absolutePath}"`},Wr=(e,t,r,n)=>{if(e!==void 0){if(typeof e!="object"||e===null)throw new RangeError(`${kr(r,void 0)} must be an object of CSS properties or undefined, got ${e===null?"null":typeof e}.`);for(const[a,i]of Object.entries(e))if(i!==void 0&&!t.has(a))throw new RangeError(`${kr(r,a)} cannot be set: ${Dn}, so ${n}.`)}},We=(e,t)=>Wr(e,$n,t,"a row style accepts only paint and text properties (ROW_STYLE_PROPERTIES)"),zn=(e,t)=>Wr(e,Fn,t,"the expand icon style accepts only the glyph's colour and opacity (EXPAND_ICON_STYLE_PROPERTIES), and the 14 px expand box is the tree's"),Bn=500,Yr=({entry:e,isDirectory:t,isExpanded:r,isItemSelected:n,selectionMode:a,onSelectionChange:i,onEntryClick:c,toggleDirectory:u,onToggleDirectoryRecursive:m})=>{const S=l.useRef(null);return l.useEffect(()=>()=>{S.current&&window.clearTimeout(S.current)},[]),l.useCallback(T=>{T.stopPropagation(),a!=="none"&&!t&&i&&i(e,!n);let x=!1;c({entry:e,isDirectory:t,isExpanded:r,preventDefault:()=>{x=!0}}),!(!t||x)&&(S.current?(window.clearTimeout(S.current),S.current=null,m(e)):S.current=window.setTimeout(()=>{u(e.absolutePath),S.current=null},Bn))},[t,e,r,m,u,c,a,i,n])},Gr=e=>e==="right"?"dt-grid-cell--right":e==="center"?"dt-grid-cell--center":"",Ir=(e,t)=>e.children!==void 0&&t(e.absolutePath),Vr=(e,t)=>({width:e,gridTemplateColumns:t}),Kr=l.memo(({entry:e,indentLevel:t,positionInSet:r,setSize:n,rowIndex:a,flatIndex:i,onRowFocus:c,onRowBlur:u,isSelectedForAria:m,rowHeight:S,isDirOpen:T,columns:x,numericTemplate:_,numericTotal:p,nameWidth:g,rowClassName:y,selection:{onEntryClick:E,selectedPath:v,currentPath:$,mode:N="none",selectedItems:P,onSelectionChange:b},expansion:{toggleDirectory:M,onToggleDirectoryRecursive:D},visual:{iconOverrides:O,showExpandIcons:q=!0,showDirectoryIcons:X=!0,showFileIcons:F=!0,useCanvasExpandIcons:H=!1,expandIconSize:fe,typeIconSize:B,fontSize:re,indentSize:he,highlightStyles:Y,expandIconClassName:G,expandIconStyle:Ee}})=>{We(e.style,{option:"entry.style",absolutePath:e.absolutePath});const[ge,o]=l.useState(!1),f=e.children!==void 0,I=f&&T(e.absolutePath),R=e.absolutePath===v,be=e.absolutePath===$,C=!f&&!!P?.has(e.absolutePath),L=f?void 0:Dr(e),Z=Yr({entry:e,isDirectory:f,isExpanded:I,isItemSelected:C,selectionMode:N,onSelectionChange:b,onEntryClick:E,toggleDirectory:M,onToggleDirectoryRecursive:D}),me=ge?Y?.hoverClassName!==void 0?Y.hoverClassName:A.entryHover:"",Ie=(()=>{if(f){if(R)return Y?.directorySelectedClassName!==void 0?Y.directorySelectedClassName:A.entrySelected}else if(R||C)return Y?.itemSelectedClassName!==void 0?Y.itemSelectedClassName:K.twMerge(R&&A.entrySelected,C&&A.entryItemSelected);return""})(),j=typeof y=="function"?y(e):y,Se=K.twMerge("dt-grid-row cursor-pointer select-none",me,Ie,j,e.className),U=K.twMerge(A.expandIcon,G,(R||C)&&A.expandIconSelected),Ae=K.twMerge(A.typeIcon,(R||C)&&A.typeIconSelected),ne=K.twMerge("dt-grid-name-label ml-1",ie.name,f&&A.nameDirectory,(R||C)&&A.nameSelected),Q=$r({isDirectory:f,isExpanded:I,showExpandIcons:q,useCanvasExpandIcons:H,expandIconSize:fe}),se=(f?X:F)?Fr({entry:e,isDirectory:f,isExpanded:I,isSelected:R,isItemSelected:C,extension:L,mimeType:e.mimeType},O,B):null,Ce={indentLevel:t,isDirectory:f,isExpanded:I},[Pe,...Te]=x,Me=Pe?.render?Pe.render(e,Ce):e.label??e.name,Re={...ge?Y?.hoverStyle:{},...f&&R?Y?.directorySelectedStyle:{},...!f&&(R||C)?Y?.itemSelectedStyle:{}};return h.jsxs("div",{className:Se,style:{...Re,...e.style,height:S},role:"row","aria-expanded":f?I:void 0,"aria-level":t+1,"aria-posinset":r,"aria-setsize":n,"aria-rowindex":a,"aria-selected":N==="none"?void 0:m,"aria-current":be?"page":void 0,...zr(e.data),"data-entry-type":f?"directory":"file","data-entry-expanded":f?String(I):void 0,"data-entry-selected":R?"true":void 0,"data-entry-item-selected":C?"true":void 0,onClick:Z,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),onFocus:W=>c(i,e.absolutePath,W.currentTarget),onBlur:W=>u(e.absolutePath,W.currentTarget),onKeyDown:W=>{if(W.key==="Enter"){if(W.repeat){W.preventDefault();return}Z(W)}},tabIndex:0,children:[h.jsxs("div",{className:K.twMerge("dt-grid-name-cell",Pe?.className),role:"gridcell",style:{width:g,paddingLeft:Math.max(0,t*he)},children:[(q||H)&&h.jsx("span",{className:U,style:{...Ee,width:ce,height:ce},children:Q}),(f?X:F)&&h.jsx("span",{className:Ae,style:{width:B,height:B},children:se}),h.jsx("span",{className:ne,style:Mr(re),children:Me})]}),Te.length>0&&h.jsx("div",{className:"dt-grid-numeric-viewport",children:h.jsx("div",{className:"dt-grid-numeric-track",style:Vr(p,_),children:Te.map(W=>h.jsx("div",{className:K.twMerge("dt-grid-cell",Gr(W.align),W.className),role:"gridcell",children:W.render?W.render(e,Ce):null},W.key))})})]})},(e,t)=>{if(e.entry!==t.entry)return!1;const r=Ir(e.entry,e.isDirOpen),n=Ir(t.entry,t.isDirOpen);return e.indentLevel===t.indentLevel&&e.positionInSet===t.positionInSet&&e.setSize===t.setSize&&e.rowIndex===t.rowIndex&&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});Kr.displayName="DirectoryTreeGridRow";const Xr=({kind:e,columns:t,numericTemplate:r,numericTotal:n,nameWidth:a,scrollBarWidth:i,className:c,nameContent:u,renderCell:m})=>{const[,...S]=t,T=e==="header"?"dt-grid-name-header":"dt-grid-name-footer",x=e==="header"?"dt-grid-header":"dt-grid-footer",_=e==="header"?"columnheader":"gridcell";return h.jsxs("div",{className:K.twMerge(x,ie.gridEdge,c),role:"row",children:[h.jsx("div",{className:K.twMerge(T,"px-1",t[0]?.className),role:_,style:{width:a},children:u}),S.length>0&&h.jsx("div",{className:"dt-grid-numeric-viewport",children:h.jsx("div",{className:"dt-grid-numeric-track",style:Vr(n,r),children:S.map(p=>h.jsx("div",{className:K.twMerge("dt-grid-cell",Gr(p.align),p.className),role:_,children:m(p)},p.key))})}),h.jsx("div",{className:"dt-grid-scrollbar-spacer",style:{width:i},"aria-hidden":"true"})]})},Hn=({columns:e,className:t,...r})=>h.jsx(Xr,{kind:"header",columns:e,className:t,nameContent:e[0]?.header??null,renderCell:n=>n.header??null,...r}),Cr=(e,t)=>typeof e=="function"?e(t):e??null,Wn=({columns:e,allEntries:t,className:r,...n})=>h.jsx(Xr,{kind:"footer",columns:e,className:r,nameContent:Cr(e[0]?.footer,t),renderCell:a=>Cr(a.footer,t),...n}),Yn=240,Ur=96,Jr=12,Ot=(e,t)=>{const r=e?.width;return typeof r=="number"&&Number.isFinite(r)&&r>0?r:t},Gn=e=>e.slice(1).map(t=>`${Ot(t,Ur)}px`).join(" "),Vn=({measuredWidth:e,columns:t,scrollBarWidth:r=Jr})=>{const n=Ot(t[0],Yn),a=t.slice(1).reduce((m,S)=>m+Ot(S,Ur),0),i=Number.isFinite(e)&&e>0?e:0,c=Math.max(0,i-n-Math.max(0,r)),u=Math.max(0,a-c);return{nameWidth:n,numericTotal:a,numericVisible:c,maxHScroll:u}},Nt=(e,t)=>!Number.isFinite(e)||e<0?0:e>t?t:e,Kn=e=>{const t=[],r=n=>{for(const a of n)t.push(a),a.children&&a.children.length>0&&r(a.children)};return r(e),t},qr=["entryKindDirectory","entryKindFile"],Lt=[...ye.VIRTUAL_SCROLL_LABEL_KEYS,...qr],jt=Object.freeze({en:Object.freeze({entryKindDirectory:"directory",entryKindFile:"file"}),ja:Object.freeze({entryKindDirectory:"ディレクトリ",entryKindFile:"ファイル"})}),Zr=Object.freeze({en:Object.freeze({...ye.VIRTUAL_SCROLL_LABEL_CATALOGS.en,...jt.en}),ja:Object.freeze({...ye.VIRTUAL_SCROLL_LABEL_CATALOGS.ja,...jt.ja})}),Tr=e=>typeof e=="string"?JSON.stringify(e):e===null?"null":typeof e,Xn=e=>{const t={};let r=!1;for(const n of ye.VIRTUAL_SCROLL_LABEL_KEYS){const a=Object.hasOwn(e,n)?e[n]:void 0;a!==void 0&&(t[n]=a,r=!0)}return r?t:void 0},Qr=(e,t)=>{const r=ye.resolveVirtualScrollLocale(e);if(t===void 0)return Zr[r];if(t===null||typeof t!="object")throw new RangeError(`[directory-tree] labels must be an object; got ${Tr(t)}`);const n=Object.getPrototypeOf(t);if(n!==Object.prototype&&n!==null)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"}`);for(const c of Object.keys(t))if(!Lt.includes(c))throw new RangeError(`[directory-tree] labels.${c} is not a known label key; expected one of ${Lt.join(", ")}`);const i={...ye.resolveVirtualScrollLabels(r,Xn(t)),...jt[r]};for(const c of qr){const u=Object.hasOwn(t,c)?t[c]:void 0;if(u!==void 0){if(typeof u!="string"||u.trim()==="")throw new RangeError(`[directory-tree] labels.${c} must be a non-blank string; got ${Tr(u)}`);i[c]=u}}return Object.freeze(i)},Un=e=>{const t={};for(const r of ye.VIRTUAL_SCROLL_LABEL_KEYS)t[r]=e[r];return Object.freeze(t)},Jn=()=>{let e=null;return{mark:t=>{const r=t.composedPath();e=r,setTimeout(()=>{e===r&&(e=null)},0)},landedOn:t=>e?.includes(t)===!0}},Ze=e=>typeof e=="string"?JSON.stringify(e):String(e),At=(e,t)=>{if(typeof t!="number"||!Number.isFinite(t)||t<=0)throw new RangeError(`[directory-tree] visual.${e} must be a finite number greater than 0 (px); got ${Ze(t)}.`);return t},qn=e=>{if(typeof e=="string"&&e.trim()!==""||typeof e=="number"&&Number.isFinite(e)&&e>0)return e;throw new RangeError(`[directory-tree] visual.fontSize must be a finite number greater than 0 (px) or a CSS font size that is not blank; got ${Ze(e)}.`)},Zn=({indentSize:e,typeIconSize:t,fontSize:r})=>({indentSize:e===void 0?kn:At("indentSize",e),typeIconSize:t===void 0?Cn:At("typeIconSize",t),fontSize:r===void 0?void 0:qn(r)}),Qn=({indentSize:e,removeRootIndent:t,hasExpandBox:r})=>t?Math.max(0,e-(r?ce:0)):0,eo=(e,t,r)=>{if(typeof e!="function")return At("itemHeight",e);const n=e(t,r);if(typeof n!="number"||!Number.isFinite(n)||n<=0)throw new RangeError(`[directory-tree] visual.itemHeight returned ${Ze(n)} for ${JSON.stringify(t.absolutePath)} (row ${r}); it must return a finite number greater than 0 (px).`);return n},to=(e,t,r)=>{const n=t===void 0?In:t;if(typeof n!="number"||!Number.isFinite(n)||n<=0||n>ce)throw new RangeError(`[directory-tree] visual.expandIconSize must be a finite number greater than 0 and at most ${ce} (the expand box, px) while tree lines are drawn; got ${Ze(n)}.`);const{indentSize:a,typeIconSize:i}=e,c=n/2,u=ce+i-n/2;if(a<c||a>u)throw new RangeError(`[directory-tree] visual.indentSize ${Ze(a)} does not fit the tree lines: with typeIconSize ${i} and an expand glyph of ${n} px it must be from ${c} (half the glyph) to ${u} (the ${ce} px expand box + typeIconSize − half the glyph).`);return{indentSize:a,typeIconSize:i,glyphSize:n,originX:r}},ro=({indentSize:e,typeIconSize:t,glyphSize:r})=>Math.min(Math.max(ce+t/2-e,r/2),ce-r/2),no=(e,t)=>{const r=e.length-1;if(r<=0)return 0;let n=0,a=r-1,i=0;for(;n<=a;){const c=n+a>>>1;e[c]<=t?(i=c,n=c+1):a=c-1}return i},oo=(e,t,r)=>{if(r<=0||e.length===0||t.length!==e.length+1)return null;const n=no(t,r),a=e[n];return a?{path:a.entry.absolutePath,offsetInViewport:r-t[n]}:null},so=(e,t,r)=>{if(t.length===0||r.length!==t.length+1)return null;for(let n=0;n<t.length;n++)if(t[n].entry.absolutePath===e.path)return Math.max(0,r[n]+e.offsetInViewport);return null},ao=(e,t,r)=>{const n=[];for(let a=t;a<r;a++){const i=e[a];if(!(!i||i.length===0))for(const c of i)n.push(c)}return n},lo=(e,t,r)=>{const n=[];for(let a=t;a<r;a++){const i=e[a];if(!(!i||i.length===0))for(const c of i)n.push(c)}return n},io=(e,t,r,n)=>{const a=Math.max(1,Math.floor(t*n)),i=Math.max(1,Math.floor(r*n));(e.width!==a||e.height!==i)&&(e.width=a,e.height=i);const c=e.style;c.width!==`${t}px`&&(c.width=`${t}px`),c.height!==`${r}px`&&(c.height=`${r}px`)},co=(e,t,r)=>{e.lineWidth=r,e.beginPath();for(const n of t)e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2);e.stroke()},uo=(e,t,r,n)=>{if(t.length===0)return;const a=e.strokeStyle,i=e.lineWidth,c=e.lineCap,u=e.lineJoin;e.strokeStyle=r,e.lineCap="round",e.lineJoin="round";for(const m of t){const S=n??m.size,T=Math.max(0,S/2),x=Math.max(1,Math.round(S*.08)),_=Math.max(1,Math.round(S*.14)),p=Math.max(0,T-x*.8),g=Math.max(0,p*.55);e.lineWidth=x,e.beginPath(),e.arc(m.centerX,m.centerY,Math.max(0,T-x*.3),0,Math.PI*2),e.stroke(),e.lineWidth=_,e.beginPath(),e.moveTo(m.centerX-g,m.centerY),e.lineTo(m.centerX+g,m.centerY),e.stroke(),m.isExpanded||(e.beginPath(),e.moveTo(m.centerX,m.centerY-g),e.lineTo(m.centerX,m.centerY+g),e.stroke())}e.strokeStyle=a,e.lineWidth=i,e.lineCap=c,e.lineJoin=u},en=l.memo(({segmentsByItem:e,glyphsByItem:t,itemHeight:r,width:n,viewportHeight:a,scrollPosition:i,color:c=jr,strokeWidth:u=1,renderStartIndex:m,renderEndIndex:S,lookaheadEndIndex:T,devicePixelRatio:x,expandGlyphColor:_,expandGlyphSize:p})=>{const g=l.useRef(null),y=l.useRef(null),E=l.useRef({segmentsByItem:e,glyphsByItem:t,itemHeight:r,width:n,viewportHeight:a,scrollPosition:i,color:c,strokeWidth:u,renderStartIndex:m,renderEndIndex:S,lookaheadEndIndex:T,devicePixelRatio:x,expandGlyphColor:_,expandGlyphSize:p}),v=l.useCallback(()=>{y.current=null;const N=g.current;if(!N)return;const P=N.getContext("2d");if(!P)return;const b=E.current;if(b.width<=0||b.viewportHeight<=0){P.clearRect(0,0,N.width,N.height);return}const M=Number.isFinite(b.devicePixelRatio??NaN)?b.devicePixelRatio:typeof window<"u"&&window.devicePixelRatio||1;io(N,b.width,b.viewportHeight,M);const D=b.segmentsByItem.length,O=typeof b.renderStartIndex=="number"&&Number.isFinite(b.renderStartIndex)?Math.max(0,Math.floor(b.renderStartIndex)):Math.max(0,Math.floor(b.scrollPosition/b.itemHeight)),q=Math.min(D,Math.ceil((b.scrollPosition+b.viewportHeight)/b.itemHeight)),X=(()=>{if(typeof b.renderEndIndex=="number"&&Number.isFinite(b.renderEndIndex)){const B=Math.floor(b.renderEndIndex);return Math.max(Math.min(D,B+1),O)}return Math.max(q,O)})(),F=(()=>{if(typeof b.lookaheadEndIndex=="number"&&Number.isFinite(b.lookaheadEndIndex)){const B=Math.floor(b.lookaheadEndIndex),re=Math.min(D,B+1);return Math.max(re,X)}return Math.max(q,X)})(),H=ao(b.segmentsByItem,O,F),fe=lo(b.glyphsByItem,O,F);P.save(),P.scale(M,M),P.clearRect(0,0,b.width,b.viewportHeight),P.translate(0,-b.scrollPosition),P.strokeStyle=b.color,co(P,H,b.strokeWidth),uo(P,fe,b.expandGlyphColor??b.color,b.expandGlyphSize),P.restore()},[]),$=l.useCallback(()=>{y.current===null&&(y.current=window.requestAnimationFrame(v))},[v]);return l.useEffect(()=>{E.current={segmentsByItem:e,glyphsByItem:t,itemHeight:r,width:n,viewportHeight:a,scrollPosition:i,color:c,strokeWidth:u,renderStartIndex:m,renderEndIndex:S,lookaheadEndIndex:T,devicePixelRatio:x,expandGlyphColor:_,expandGlyphSize:p},$()},[e,t,r,n,a,i,c,u,m,S,T,x,_,p,$]),l.useEffect(()=>()=>{y.current!==null&&(window.cancelAnimationFrame(y.current),y.current=null)},[]),h.jsx("canvas",{ref:g,className:"pointer-events-none absolute top-0 left-0 z-0"})});en.displayName="TreeLineCanvas";const fo=e=>{const t=new Map;for(let r=0;r<e.length;r++){const n=e[r].entry.absolutePath;t.has(n)||t.set(n,r)}return t},_r=(e,t)=>e.selectedPath===t?e:{selectedPath:t,selectionGeneration:e.selectionGeneration+1,anchor:e.anchor},ho=(e,t)=>({...e,anchor:{path:t,selectionGeneration:e.selectionGeneration,focused:!0}}),mo=(e,t)=>{const{anchor:r,selectionGeneration:n,selectedPath:a}=t;if(r!==null&&(r.focused||r.selectionGeneration===n)){const i=e.get(r.path);if(i!==void 0)return i}if(a!==null){const i=e.get(a);if(i!==void 0)return i}return 0},po={msOverflowStyle:"none",scrollbarWidth:"none"},yo=()=>{let e=document.getElementById("directory-tree-webkit-scrollbar-hide");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))},go=e=>{const t=l.useRef(null),r=t.current;return r!==null&&ye.VIRTUAL_SCROLL_LABEL_KEYS.every(n=>r[n]===e[n])?r:(t.current=e,e)},Nr=new Set(["top","bottom","center","nearest"]),Pr=e=>{const t=e?.align;if(t===void 0)return"top";if(!Nr.has(t))throw new RangeError(`[directory-tree] Unsupported scroll alignment ${JSON.stringify(t)}; expected one of ${[...Nr].join(", ")}.`);return t},bo={position:"absolute",width:1,height:1,margin:-1,padding:0,border:0,overflow:"hidden",clipPath:"inset(50%)",whiteSpace:"nowrap"},So=(e,t,r,n,a)=>{const i=[],c=[];let u=0;const m=(S,T,x)=>{const _=a?[...S].sort(a):S;for(let p=0;p<_.length;p++){const g=_[p],y=p===_.length-1,E=[...x,y],v=g.children!==void 0,$=v&&t(g.absolutePath,g.relativePath);let N=T,P=x;n&&(N=T-1,P=x.slice(1)),i.push({entry:g,indentLevel:N,depth:T,positionInSet:p+1,setSize:_.length}),r&&(N>u&&(u=N),c.push({id:g.absolutePath,name:g.name,absolutePath:g.absolutePath,indentLevel:N,isLastChild:y,isDirectory:v,isExpanded:$,ancestorIsLast:[...P],hideLines:n&&T===0})),v&&$&&g.children&&m(g.children,T+1,E)}};return m(e,0,[]),{flatItems:i,lineItems:c,maxIndent:u}},Or=(e,t)=>{const r=e.length-1;if(r<=0)return 0;let n=0,a=r-1,i=0;for(;n<=a;){const c=n+a>>>1;e[c]<=t?(i=c,n=c+1):a=c-1}return i},vo=(e,t,r,n,a,i)=>{const c=n?.renderStart??Math.max(0,Or(i,a)),u=t>0?Or(i,a+t)+r:c+r,m=e>0?Math.min(e-1,Math.max(c,u)):c,S=n?.renderEnd??m,T=e>0?Math.min(e-1,S+r):S;return{renderStart:c,renderEnd:S,lookaheadEnd:T}},wo=(e,t,r,n)=>{if(e.length===0)return{segmentsByItem:[],glyphsByItem:[]};const{indentSize:a,typeIconSize:i,glyphSize:c,originX:u}=n,m=Array.from({length:e.length},()=>[]),S=Array.from({length:e.length},()=>[]),T=u+ro(n),x=p=>p*a+T,_=c/2+2;for(let p=0;p<e.length;p++){const g=e[p],y=t[p]??0,E=r[p]??0,v=E+y/2,$=e[p+1],N=v+i/2,P=E+y,b=$!==void 0&&$.indentLevel===g.indentLevel+1&&N<P?{key:`${g.id}-connector-children`,x1:x($.indentLevel),y1:N,x2:x($.indentLevel),y2:P,itemIndex:p}:null;if(g.hideLines){b!==null&&(m[p]=[b]);continue}const M=[];for(let O=0;O<g.indentLevel;O++){if(g.ancestorIsLast[O]??!1)continue;let X=!1;for(let F=p;F<e.length;F++){const H=e[F];if(H.indentLevel>O&&H.ancestorIsLast.length>O&&!H.ancestorIsLast[O]){X=!0;break}if(F>p&&H.indentLevel===O)break}if(X){const F=x(O);M.push({key:`${g.id}-ancestor-${O}`,x1:F,y1:E,x2:F,y2:E+y,itemIndex:p})}}const D=x(g.indentLevel);p>0&&M.push({key:`${g.id}-connector-top`,x1:D,y1:E,x2:D,y2:g.isDirectory?v-_:v,itemIndex:p}),!g.isDirectory&&g.isLastChild&&M.push({key:`${g.id}-connector-horizontal`,x1:D,y1:v,x2:u+g.indentLevel*a+ce,y2:v,itemIndex:p}),g.isLastChild||(g.isDirectory?M.push({key:`${g.id}-connector-bottom`,x1:D,y1:v+_,x2:D,y2:E+y,itemIndex:p}):M.push({key:`${g.id}-connector-bottom`,x1:D,y1:v,x2:D,y2:E+y,itemIndex:p})),b!==null&&M.push(b),m[p]=M,g.isDirectory&&(S[p]=[{key:`${g.id}-glyph`,itemIndex:p,centerX:D,centerY:v,size:c,isExpanded:g.isExpanded}])}return{segmentsByItem:m,glyphsByItem:S}},tn=l.memo(({entry:e,indentLevel:t,originX:r,depth:n,positionInSet:a,setSize:i,isSelectedForAria:c,flatIndex:u,isActive:m,registerRowRef:S,onNavigationKeyDown:T,onRowFocus:x,onRowBlur:_,rowHeight:p,entryKindDirectory:g,entryKindFile:y,isDirOpen:E,expansion:{toggleDirectory:v,onToggleDirectoryRecursive:$},selection:{onEntryClick:N,selectedPath:P,currentPath:b,mode:M="none",selectedItems:D,onSelectionChange:O},visual:{iconOverrides:q,showExpandIcons:X=!0,showDirectoryIcons:F=!0,showFileIcons:H=!0,useCanvasExpandIcons:fe=!1,expandIconSize:B,typeIconSize:re,fontSize:he,indentSize:Y,highlightStyles:G,entryClassName:Ee,entryStyle:ge,nameClassName:o,nameStyle:f,directoryNameClassName:I,directoryNameStyle:R,fileNameClassName:be,fileNameStyle:C,expandIconClassName:L,expandIconStyle:Z}})=>{We(e.style,{option:"entry.style",absolutePath:e.absolutePath});const[me,Ie]=l.useState(!1),j=e.children!==void 0,Se=j&&E(e.absolutePath),U=e.absolutePath===P,Ae=e.absolutePath===b,ne=!j&&D?.has(e.absolutePath),Q=l.useCallback(ee=>S(u,ee),[S,u]),se=j?void 0:Dr(e),Ce=Yr({entry:e,isDirectory:j,isExpanded:Se,isItemSelected:!!ne,selectionMode:M,onSelectionChange:O,onEntryClick:N,toggleDirectory:v,onToggleDirectoryRecursive:$}),Pe=me?G?.hoverClassName!==void 0?G.hoverClassName:A.entryHover:"",Te=(()=>{if(j){if(U)return G?.directorySelectedClassName!==void 0?G.directorySelectedClassName:A.entrySelected}else if(U||ne)return G?.itemSelectedClassName!==void 0?G.itemSelectedClassName:K.twMerge(U&&A.entrySelected,ne&&A.entryItemSelected);return""})(),Me=K.twMerge(A.entry,Pe,Te,Ee,e.className),Re=K.twMerge(A.expandIcon,L,(U||ne)&&A.expandIconSelected),W=K.twMerge(A.typeIcon,(U||ne)&&A.typeIconSelected),Ye=K.twMerge(A.name,o,j&&A.nameDirectory,j&&I,!j&&be,(U||ne)&&A.nameSelected),Qe=$r({isDirectory:j,isExpanded:Se,showExpandIcons:X&&t>=0,useCanvasExpandIcons:fe,expandIconSize:B}),ht=(j?F:H)?Fr({entry:e,isDirectory:j,isExpanded:Se,isSelected:U,isItemSelected:!!ne,extension:se,mimeType:e.mimeType},q,re):null,Ge={...me?G?.hoverStyle:{},...j&&U?G?.directorySelectedStyle:{},...!j&&(U||ne)?G?.itemSelectedStyle:{}},Ve=zr(e.data),et={width:re,height:re},tt=Mr(he),ve=r+t*Y;return h.jsxs("div",{className:Me,style:{...tt,...Ge,...ge,...e.style,paddingLeft:`${Math.max(0,ve)}px`,transform:ve<0?`translateX(${ve}px)`:void 0,width:ve<0?`calc(100% + ${-ve}px)`:void 0,height:`${p}px`},...Ve,"data-entry-type":j?"directory":"file","data-entry-expanded":j?String(Se):void 0,"data-entry-selected":U?"true":void 0,"data-entry-item-selected":ne?"true":void 0,onClick:Ce,onMouseEnter:()=>Ie(!0),onMouseLeave:()=>Ie(!1),onFocus:ee=>x(u,e.absolutePath,ee.currentTarget),onBlur:ee=>_(e.absolutePath,ee.currentTarget),ref:Q,onKeyDown:ee=>{if(ee.key==="Enter"||ee.key===" "){ee.preventDefault(),ee.repeat||Ce(ee);return}T(ee,u)},tabIndex:m?0:-1,role:"treeitem","aria-expanded":j?Se:void 0,"aria-level":n+1,"aria-posinset":a,"aria-setsize":i,"aria-selected":M==="none"?void 0:c,"aria-current":Ae?"page":void 0,"aria-label":`${e.name} (${j?g:y})`,children:[(X||fe)&&h.jsx("span",{className:Re,style:{...Z,width:ce,height:ce},children:Qe}),(j?F:H)&&h.jsx("span",{className:W,style:et,children:ht}),h.jsx("span",{className:Ye,style:{...tt,...f,...j?R:C},"data-entry-type":j?"directory":"file","data-entry-role":"name",children:e.label??e.name})]})},(e,t)=>{if(e.entry!==t.entry)return!1;const r=e.entry.children!==void 0,n=t.entry.children!==void 0,a=r&&e.isDirOpen(e.entry.absolutePath),i=n&&t.isDirOpen(t.entry.absolutePath);return e.indentLevel===t.indentLevel&&e.originX===t.originX&&e.depth===t.depth&&e.positionInSet===t.positionInSet&&e.setSize===t.setSize&&e.isSelectedForAria===t.isSelectedForAria&&e.flatIndex===t.flatIndex&&e.isActive===t.isActive&&e.rowHeight===t.rowHeight&&e.entryKindDirectory===t.entryKindDirectory&&e.entryKindFile===t.entryKindFile&&a===i&&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.typeIconSize===t.visual.typeIconSize&&e.visual.fontSize===t.visual.fontSize&&e.visual.indentSize===t.visual.indentSize&&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});tn.displayName="DirectoryEntryItem";const rn=e=>{const t=[];if(e.children)for(const r of e.children)r.type==="directory"&&(t.push(r.absolutePath),t.push(...rn(r)));return t},Eo=({entries:e,expansion:{toggle:t,isExpanded:r,expandMultiple:n,collapseMultiple:a,isPending:i,alwaysExpanded:c=!1,doubleClickAction:u="recursive"},selection:{onEntryClick:m,selectedPath:S,currentPath:T,mode:x="none",selectedItems:_,onSelectionChange:p},visual:{className:g,style:y,ariaLabel:E,ariaLabelledBy:v,lineColor:$=jr,showTreeLines:N=!0,showExpandIcons:P=!0,showDirectoryIcons:b=!0,showFileIcons:M=!0,iconOverrides:D,expandIconSize:O,typeIconSize:q,fontSize:X,indentSize:F,itemHeight:H=_t,removeRootIndent:fe=!1,highlightStyles:B,entryClassName:re,entryStyle:he,nameClassName:Y,nameStyle:G,directoryNameClassName:Ee,directoryNameStyle:ge,fileNameClassName:o,fileNameStyle:f,expandIconClassName:I,expandIconStyle:R}={},virtualScroll:be,grid:C,sort:L,locale:Z,labels:me,ref:Ie})=>{const j=ye.resolveVirtualScrollLocale(Z),Se=l.useMemo(()=>Qr(Z,me),[Z,me]),U=go(Un(Se)),{entryKindDirectory:Ae,entryKindFile:ne}=Se,Q=l.useMemo(()=>Zn({indentSize:F,typeIconSize:q,fontSize:X}),[F,q,X]);l.useMemo(()=>{We(he,{option:"visual.entryStyle"}),We(B?.hoverStyle,{option:"visual.highlightStyles.hoverStyle"}),We(B?.directorySelectedStyle,{option:"visual.highlightStyles.directorySelectedStyle"}),We(B?.itemSelectedStyle,{option:"visual.highlightStyles.itemSelectedStyle"}),zn(R,{option:"visual.expandIconStyle"})},[he,B,R]);const se=C!==void 0,[Ce,Pe]=l.useState(!1),Te=l.useRef(null),Me=l.useRef(null),Re=l.useRef(null),[W,Ye]=l.useState(0),[Qe,ht]=l.useState(0),[Ge,Ve]=l.useState(0),[et,tt]=l.useState(null),{overscanCount:ve=15,className:ee,background:Dt,onScroll:$t,onRangeChange:Ft,onScrollAdjust:zt,liveRegion:Bt,initialScrollIndex:Ht,initialScrollOffset:De,initialScrollAnchor:Wt,callbackThrottleMs:Yt=5,contentInsets:Gt,onItemFocus:Vt,viewportHeightOverride:ae,scrollBarOptions:mt,behaviorOptions:Kt,preserveScrollAnchor:Xt=!1,getItemKey:nn,testId:Ut,contentProps:pt}=be??{},Jt=l.useMemo(()=>se?{...pt,role:"rowgroup"}:{...pt,role:"tree","aria-label":v?void 0:E,"aria-labelledby":v,"aria-multiselectable":x==="multiple"?!0:void 0,"aria-busy":i?!0:void 0},[se,pt,E,v,x,i]),qt=l.useMemo(()=>({...Kt,enableKeyboardNavigation:!1}),[Kt]),[rt,Zt]=l.useState(typeof De=="number"?De:0),yt=l.useRef(typeof De=="number"?De:0),Qt=l.useCallback((s,d)=>{yt.current=s,Zt(s),$t?.(s,d)},[$t]),er=l.useCallback(s=>{const{renderingStartIndex:d,renderingEndIndex:w}=s;tt(k=>k&&k.renderStart===d&&k.renderEnd===w?k:{renderStart:d,renderEnd:w}),Ft?.(s)},[Ft]);l.useEffect(()=>{Pe(!0),yo()},[]),l.useEffect(()=>{const s=Te.current,d=se?Me.current:s,w=()=>{if(s){const z=s.clientWidth;ht(J=>Math.abs(J-z)>1?z:J)}if(typeof ae=="number")Ye(z=>Math.abs(z-ae)>1?ae:z);else if(d){const z=d.clientHeight;Ye(J=>Math.abs(J-z)>1?z:J)}};if(!(s||d))return Ye(0);w();const k=new ResizeObserver(w);return s&&k.observe(s),d&&d!==s&&k.observe(d),()=>k.disconnect()},[ae,se]);const $e=typeof ae=="number"?ae:W,we=l.useCallback(s=>c||(Ce?r(s):!1),[Ce,r,c]),tr=K.twMerge(A.container,i&&A.containerPending,g),rr=l.useMemo(()=>({...po,...y??{},...typeof ae=="number"?{height:ae,minHeight:ae}:{}}),[y,ae]),gt=l.useCallback((s,d)=>{const w=[s.absolutePath,...rn(s)],k=d||u;if(w.every(ke=>we(ke)))return a(w);if(w.every(ke=>!we(ke))||k==="recursive")return n(w);if(k==="toggle")return a(w);console.warn(`[DirectoryTree] Unknown double click action: ${k}. No action taken.`)},[we,n,a,u]),bt=se?!1:fe,{flatItems:Oe,lineItems:St,maxIndent:nr}=l.useMemo(()=>So(e,we,N,bt,L),[e,we,N,bt,L]),nt=Qn({indentSize:Q.indentSize,removeRootIndent:bt,hasExpandBox:P||N}),pe=l.useMemo(()=>N?to(Q,O,nt):null,[N,Q,O,nt]),V=l.useMemo(()=>Oe.map((s,d)=>({...s,rowHeight:eo(H,s.entry,d)})),[Oe,H]),_e=l.useMemo(()=>V.map(s=>s.rowHeight),[V]),Le=l.useMemo(()=>{const s=new Array(_e.length+1);s[0]=0;for(let d=0;d<_e.length;d++)s[d+1]=s[d]+_e[d];return s},[_e]),or=l.useCallback(s=>V[s]?.rowHeight??_t,[V]),on=l.useCallback(s=>V[s]?.entry.absolutePath??s,[V]),sr=nn??on,Fe=S??null,vt=T??null,[ar,Ke]=l.useState(()=>({selectedPath:Fe,selectionGeneration:0,anchor:null})),wt=_r(ar,Fe);wt!==ar&&Ke(s=>_r(s,Fe));const ot=l.useMemo(()=>fo(Oe),[Oe]),ze=l.useMemo(()=>mo(ot,wt),[ot,wt]),Xe=l.useRef(new Map),st=l.useRef(null),[at]=l.useState(Jn),Ue=l.useRef(null),[sn,lr]=l.useState(!0),Et=l.useRef(Oe);Et.current=Oe;const ir=l.useRef(we);ir.current=we;const Rt=l.useRef(t);Rt.current=t;const cr=l.useRef(ot);cr.current=ot;const xt=l.useRef(ze);xt.current=ze;const dr=l.useRef(Vt);dr.current=Vt;const je=l.useCallback(s=>{const d=Re.current;return!d||d.getViewportSize()<=0?!1:(d.scrollToIndex(s,{align:"nearest"}),!0)},[]),xe=l.useCallback(s=>{const d=Xe.current.get(s);if(d===void 0){Ue.current=s,je(s)||(Ue.current=null);return}Ue.current=null,je(s),d.focus({preventScroll:!0})},[je]),ur=l.useCallback((s,d)=>{if(d)Xe.current.set(s,d),Ue.current===s?(Ue.current=null,d.focus({preventScroll:!0})):d.contains(d.ownerDocument.activeElement)&&Ke(w=>w.anchor===null?w:{...w,anchor:{...w.anchor,focused:!0}});else{const w=Xe.current.get(s);Xe.current.delete(s),w?.contains(w.ownerDocument.activeElement)&&Ke(k=>k.anchor===null?k:{...k,anchor:{...k.anchor,focused:!1}})}s===xt.current&&lr(d!==null)},[]);l.useLayoutEffect(()=>{lr(Xe.current.has(ze))},[ze]);const kt=l.useCallback((s,d,w)=>{const k=st.current===w;st.current=null,k||(Ke(z=>ho(z,d)),at.landedOn(w)||je(s)),dr.current?.(s)},[je,at]),lt=l.useCallback(s=>at.mark(s.nativeEvent),[at]),It=l.useCallback((s,d)=>{const{ownerDocument:w}=d;if(!w.hasFocus()&&d.contains(w.activeElement)){st.current=d;return}st.current=null,Ke(k=>k.anchor!==null&&k.anchor.path===s?{...k,anchor:{...k.anchor,focused:!1}}:k)},[]),an=l.useCallback(()=>xe(xt.current),[xe]),Ct=l.useCallback((s,d)=>{const w=Pr(d),k=Et.current.length;if(!Number.isInteger(s)||s<0||s>=k)throw new RangeError(`[directory-tree] scrollToIndex: ${String(s)} is not a row index (${k===0?"the tree has no rows":`expected an integer in 0..${String(k-1)}`}).`);if(w==="nearest"){je(s);return}Re.current?.scrollToIndex(s,{align:w})},[je]);l.useImperativeHandle(Ie,()=>({scrollToIndex:Ct,scrollToPath:(s,d)=>{Pr(d);const w=cr.current.get(s);return w===void 0?!1:(Ct(w,d),!0)},getScrollAnchor:()=>Re.current?.getScrollAnchor()??null}),[Ct]);const fr=l.useCallback((s,d)=>{if(s.altKey||s.ctrlKey||s.metaKey)return;const w=Et.current,k=w.length-1;if(k<0)return;const z=w[d],J=z?.entry.children!==void 0,ke=J&&ir.current(z.entry.absolutePath);switch(s.key){case"ArrowDown":s.preventDefault(),xe(Math.min(d+1,k));break;case"ArrowUp":s.preventDefault(),xe(Math.max(d-1,0));break;case"Home":s.preventDefault(),xe(0);break;case"End":s.preventDefault(),xe(k);break;case"ArrowRight":s.preventDefault(),J&&!ke?Rt.current(z.entry.absolutePath):J&&d<k&&w[d+1].depth>z.depth&&xe(d+1);break;case"ArrowLeft":{if(s.preventDefault(),J&&ke){Rt.current(z.entry.absolutePath);break}const fn=z?.depth??0;for(let ut=d-1;ut>=0;ut--)if(w[ut].depth<fn){xe(ut);break}break}}},[xe]),it=l.useMemo(()=>pe===null||St.length===0?{segmentsByItem:[],glyphsByItem:[]}:wo(St,_e,Le,pe),[St,_e,Le,pe]),ct=l.useMemo(()=>pe===null||e.length===0?0:pe.originX+nr*pe.indentSize+ce+pe.typeIconSize,[e.length,nr,pe]),{renderStart:hr,renderEnd:mr,lookaheadEnd:pr}=l.useMemo(()=>vo(V.length,$e,ve,et,rt,Le),[V.length,$e,ve,et,rt,Le]),Tt=l.useMemo(()=>pe===null||ct<=0||$e<=0||it.segmentsByItem.length===0?null:h.jsx("div",{className:"pointer-events-none absolute inset-0 z-1","aria-hidden":"true",children:h.jsx("div",{className:"absolute top-0 left-0",style:{width:ct,height:$e},children:h.jsx(en,{segmentsByItem:it.segmentsByItem,glyphsByItem:it.glyphsByItem,itemHeight:_e[0]??_t,width:ct,viewportHeight:$e,scrollPosition:rt,color:$,expandGlyphColor:$,expandGlyphSize:pe.glyphSize,renderStartIndex:hr,renderEndIndex:mr,lookaheadEndIndex:pr})})}),[ct,$e,hr,mr,pr,rt,it,$,pe,_e]),yr=l.useCallback(s=>V[s],[V]),gr=l.useRef(null);l.useLayoutEffect(()=>{const s=gr.current;if(gr.current={items:V,offsets:Le},!Xt||!s||s.items===V)return;const d=Re.current,w=d?.getScrollPosition(),k=typeof w=="number"&&w>=0?w:yt.current,z=oo(s.items,s.offsets,k);if(!z)return;const J=so(z,V,Le);if(J===null||Math.abs(J-k)<1)return;const ke=d?d.scrollTo(J):J;yt.current=ke,Zt(ke)},[V,Le,Xt]);const Ne=C?.columns,Be=C?.scrollBarWidth??mt?.width??Jr,te=l.useMemo(()=>Ne?Vn({measuredWidth:Qe,columns:Ne,scrollBarWidth:Be}):null,[Ne,Qe,Be]),dt=l.useMemo(()=>Ne?Gn(Ne):"",[Ne]),ln=l.useMemo(()=>C?.showFooter&&Ne?Kn(e):[],[C?.showFooter,Ne,e]),He=te?.maxHScroll??0;l.useEffect(()=>{Ve(s=>Nt(s,He))},[He]);const br=l.useCallback(s=>Ve(d=>Nt(d+s,He)),[He]),Sr=l.useMemo(()=>({iconOverrides:D,showExpandIcons:P,showDirectoryIcons:b,showFileIcons:M,useCanvasExpandIcons:N,expandIconSize:O,typeIconSize:Q.typeIconSize,fontSize:Q.fontSize,indentSize:Q.indentSize,highlightStyles:B,expandIconClassName:I,expandIconStyle:R}),[D,P,b,M,N,O,Q,B,I,R]),vr=l.useMemo(()=>h.jsx(ye.VirtualScroll,{ref:Re,itemCount:V.length,getItem:yr,getItemHeight:or,getItemKey:sr,testId:Ut,contentProps:Jt,locale:j,labels:U,viewportSize:typeof ae=="number"?ae:void 0,overscanCount:ve,onScroll:Qt,onRangeChange:er,onScrollAdjust:zt,liveRegion:Bt,className:ee,onWheelHorizontal:se?br:void 0,background:h.jsxs(h.Fragment,{children:[se&&te?h.jsx("div",{className:"pointer-events-none absolute top-0 left-0 z-1 h-full overflow-hidden",style:{width:te.nameWidth},"aria-hidden":"true",children:Tt}):Tt,Dt]}),initialScrollIndex:Ht,initialScrollOffset:De,initialScrollAnchor:Wt,callbackThrottleMs:Yt,contentInsets:Gt,scrollBarOptions:mt,behaviorOptions:qt,children:(s,d)=>s?se&&C&&te?h.jsx(Kr,{entry:s.entry,indentLevel:s.indentLevel,positionInSet:s.positionInSet,setSize:s.setSize,rowIndex:d+(C.showHeader??!0?2:1),flatIndex:d,onRowFocus:kt,onRowBlur:It,isSelectedForAria:!!_?.has(s.entry.absolutePath),rowHeight:s.rowHeight,isDirOpen:we,columns:C.columns,numericTemplate:dt,numericTotal:te.numericTotal,nameWidth:te.nameWidth,rowClassName:C.rowClassName,selection:{onEntryClick:m,selectedPath:Fe,currentPath:vt,mode:x,selectedItems:_,onSelectionChange:p},expansion:{toggleDirectory:t,onToggleDirectoryRecursive:gt},visual:Sr},s.entry.absolutePath):h.jsx(tn,{entry:s.entry,indentLevel:s.indentLevel,originX:nt,depth:s.depth,positionInSet:s.positionInSet,setSize:s.setSize,isSelectedForAria:!!_?.has(s.entry.absolutePath),flatIndex:d,isActive:d===ze,registerRowRef:ur,onNavigationKeyDown:fr,onRowFocus:kt,onRowBlur:It,rowHeight:s.rowHeight,entryKindDirectory:Ae,entryKindFile:ne,isDirOpen:we,expansion:{toggleDirectory:t,onToggleDirectoryRecursive:gt},selection:{onEntryClick:m,selectedPath:Fe,currentPath:vt,mode:x,selectedItems:_,onSelectionChange:p},visual:{iconOverrides:D,showExpandIcons:P,showDirectoryIcons:b,showFileIcons:M,useCanvasExpandIcons:N,expandIconSize:O,typeIconSize:Q.typeIconSize,fontSize:Q.fontSize,indentSize:Q.indentSize,highlightStyles:B,entryClassName:re,entryStyle:he,nameClassName:Y,nameStyle:G,directoryNameClassName:Ee,directoryNameStyle:ge,fileNameClassName:o,fileNameStyle:f,expandIconClassName:I,expandIconStyle:R}},s.entry.absolutePath):null}),[V.length,yr,or,sr,Ut,Jt,j,U,Ae,ne,ze,ur,fr,kt,It,ae,ve,Qt,er,zt,Bt,ee,se,br,te,Tt,Dt,Ht,De,Wt,Yt,Gt,mt,qt,C,dt,we,m,Fe,vt,x,_,p,t,gt,Sr,D,P,b,M,N,O,Q,nt,B,re,he,Y,G,Ee,ge,o,f,I,R]);if(!(C&&te))return h.jsxs("div",{ref:Te,className:tr,style:rr,onPointerDownCapture:lt,onMouseDownCapture:lt,children:[Oe.length>0&&!sn&&h.jsx("span",{tabIndex:0,"data-directory-tree-tab-stop":"",style:bo,onFocus:an}),vr]});const cn=C.showHeader??!0,dn=C.showFooter??!1,un={...rr,"--dt-hscroll":`${Ge}px`};return h.jsxs("div",{ref:Te,className:K.twMerge(tr,"dt-grid"),style:un,role:"treegrid","aria-label":v?void 0:E,"aria-labelledby":v,"aria-multiselectable":x==="multiple"?!0:void 0,"aria-busy":i?!0:void 0,"aria-rowcount":V.length+(C.showHeader??!0?1:0),onPointerDownCapture:lt,onMouseDownCapture:lt,children:[cn&&h.jsx("div",{role:"rowgroup",children:h.jsx(Hn,{columns:C.columns,numericTemplate:dt,numericTotal:te.numericTotal,nameWidth:te.nameWidth,scrollBarWidth:Be,className:C.headerClassName})}),h.jsx("div",{ref:Me,className:"dt-grid-body",children:vr}),He>0&&h.jsxs("div",{className:"dt-grid-hscrollbar-row",children:[h.jsx("div",{className:"dt-grid-scrollbar-spacer",style:{width:te.nameWidth},"aria-hidden":"true"}),h.jsx(ye.ScrollBar,{horizontal:!0,contentSize:te.numericTotal,viewportSize:te.numericVisible,scrollPosition:Ge,scrollBarWidth:Be,locale:j,labels:U,onScroll:s=>{const d=typeof s=="function"?s(Ge):s,w=Nt(d,He);return Ve(w),w}}),h.jsx("div",{className:"dt-grid-scrollbar-spacer",style:{width:Be},"aria-hidden":"true"})]}),dn&&h.jsx("div",{role:"rowgroup",children:h.jsx(Wn,{columns:C.columns,numericTemplate:dt,numericTotal:te.numericTotal,nameWidth:te.nameWidth,scrollBarWidth:Be,allEntries:ln,className:C.footerClassName})})]})},Ro=({initialExpanded:e=new Set,storageKey:t}={})=>{const[r,n]=l.useTransition(),[a,i]=l.useState(()=>{if(typeof window<"u"&&t)try{const y=window.localStorage.getItem(t);if(y){const E=JSON.parse(y);return new Set(E)}}catch(y){console.error("[useDirectoryTreeState] Error reading from localStorage",y)}return e}),c=l.useCallback(y=>{n(()=>{i(E=>{const v=new Set(E);return y(v),v})})},[]),u=l.useCallback((y,E)=>{c(v=>{for(const $ of y)E(v,$)})},[c]);l.useEffect(()=>{if(t&&typeof window<"u")try{window.localStorage.setItem(t,JSON.stringify(Array.from(a)))}catch(y){console.warn(`Error setting localStorage key "${t}":`,y)}},[a,t]);const m=l.useCallback(y=>{u([y],(E,v)=>{E.has(v)?E.delete(v):E.add(v)})},[u]),S=l.useCallback(y=>{u([y],(E,v)=>{E.add(v)})},[u]),T=l.useCallback(y=>{u([y],(E,v)=>{E.delete(v)})},[u]),x=l.useCallback(y=>{u(y,(E,v)=>{E.delete(v)})},[u]),_=l.useCallback(y=>{u(y,(E,v)=>{E.add(v)})},[u]),p=l.useCallback(()=>{c(y=>{y.clear()})},[c]),g=l.useCallback(y=>a.has(y),[a]);return{expanded:a,toggle:m,expand:S,collapse:T,collapseMultiple:x,expandMultiple:_,collapseAll:p,isExpanded:g,isPending:r}};exports.DIRECTORY_TREE_LABEL_CATALOGS=Zr;exports.DIRECTORY_TREE_LABEL_KEYS=Lt;exports.DirectoryTree=Eo;exports.EXPAND_ICON_STYLE_PROPERTIES=Hr;exports.FILE_ICON_PAIRS=Rn;exports.MARK_PAIRS=Lr;exports.ROW_STYLE_PROPERTIES=Br;exports.directoryTreeClasses=A;exports.resolveDirectoryTreeLabels=Qr;exports.useDirectoryTreeState=Ro;
6
+ <%s key={someKey} {...props} />`,R,L,Z,L),ge[L+R]=!0)}if(L=null,I!==void 0&&(r(I),L=""+I),c(f)&&(r(f.key),L=""+f.key),"key"in f){I={};for(var me in f)me!=="key"&&(I[me]=f[me])}else I=f;return L&&u(I,typeof o=="function"?o.displayName||o.name||"Unknown":o),S(o,L,I,a(),be,C)}function x(o){_(o)?o._store&&(o._store.validated=1):typeof o=="object"&&o!==null&&o.$$typeof===q&&(o._payload.status==="fulfilled"?_(o._payload.value)&&o._payload.value._store&&(o._payload.value._store.validated=1):o._store&&(o._store.validated=1))}function _(o){return typeof o=="object"&&o!==null&&o.$$typeof===g}var p=l,g=Symbol.for("react.transitional.element"),y=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),$=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),P=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),X=Symbol.for("react.activity"),F=Symbol.for("react.client.reference"),W=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,fe=Object.prototype.hasOwnProperty,B=Array.isArray,re=console.createTask?console.createTask:function(){return null};p={react_stack_bottom_frame:function(o){return o()}};var he,Y={},G=p.react_stack_bottom_frame.bind(p,i)(),we=re(n(i)),ge={};qe.Fragment=E,qe.jsx=function(o,f,I){var R=1e4>W.recentlyCreatedOwnerStacks++;return T(o,f,I,!1,R?Error("react-stack-top-frame"):G,R?re(n(o)):we)},qe.jsxs=function(o,f,I){var R=1e4>W.recentlyCreatedOwnerStacks++;return T(o,f,I,!0,R?Error("react-stack-top-frame"):G,R?re(n(o)):we)}})()),qe}var Er;function pn(){return Er||(Er=1,process.env.NODE_ENV==="production"?ut.exports=hn():ut.exports=mn()),ut.exports}var h=pn();function yn({title:e,titleId:t,...r},n){return ue.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?ue.createElement("title",{id:t},e):null,ue.createElement("path",{fillRule:"evenodd",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",clipRule:"evenodd"}))}const gn=ue.forwardRef(yn);function bn({title:e,titleId:t,...r},n){return ue.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?ue.createElement("title",{id:t},e):null,ue.createElement("path",{fillRule:"evenodd",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",clipRule:"evenodd"}))}const Sn=ue.forwardRef(bn);function vn({title:e,titleId:t,...r},n){return ue.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?ue.createElement("title",{id:t},e):null,ue.createElement("path",{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"}))}const wn=ue.forwardRef(vn),Or={icon:{light:"#6a7282",dark:"#99a1af"},iconSelected:{light:"#1447e6",dark:"#51a2ff"},checkedRing:{light:"#155dfc",dark:"#51a2ff"}},En={markdown:{light:"#0084d1",dark:"#00bcff"},pdf:{light:"#e7000b",dark:"#ff6467"},spreadsheet:{light:"#007a55",dark:"#00d492"},csv:{light:"#007a55",dark:"#00d492"},document:{light:"#155dfc",dark:"#51a2ff"},presentation:{light:"#ca3500",dark:"#ff8904"},image:{light:"#00786f",dark:"#00d5be"},audio:{light:"#e60076",dark:"#fb64b6"},video:{light:"#7f22fe",dark:"#a684ff"},archive:{light:"#bb4d00",dark:"#ffb900"},code:{light:"#9810fa",dark:"#c27aff"},text:Or.icon},Lr="#71829b",ie={rowHover:"hover:bg-[color:light-dark(#f3f4f6,#1e2939)]",rowSelected:"bg-[color:light-dark(#eff6ff,#162456)]",checkedRing:"inset-ring-1 inset-ring-[color:light-dark(#155dfc,#51a2ff)]",name:"text-[color:light-dark(#364153,#e5e7eb)]",nameSelected:"text-[color:light-dark(#193cb8,#bedbff)]",gridEdge:"text-[color:light-dark(#4a5565,#d1d5dc)]",icon:"text-[color:light-dark(#6a7282,#99a1af)]",iconSelected:"text-[color:light-dark(#1447e6,#51a2ff)]"},de={markdown:"text-[color:light-dark(#0084d1,#00bcff)]",pdf:"text-[color:light-dark(#e7000b,#ff6467)]",spreadsheet:"text-[color:light-dark(#007a55,#00d492)]",csv:"text-[color:light-dark(#007a55,#00d492)]",document:"text-[color:light-dark(#155dfc,#51a2ff)]",presentation:"text-[color:light-dark(#ca3500,#ff8904)]",image:"text-[color:light-dark(#00786f,#00d5be)]",audio:"text-[color:light-dark(#e60076,#fb64b6)]",video:"text-[color:light-dark(#7f22fe,#a684ff)]",archive:"text-[color:light-dark(#bb4d00,#ffb900)]",code:"text-[color:light-dark(#9810fa,#c27aff)]",text:"text-[color:light-dark(#6a7282,#99a1af)]"},jr="text-[length:var(--dt-font-size-body,0.8125rem)]",Rn=`${jr} leading-[max(var(--dt-line-height-body,1.25rem),1.5em)]`,_t=44,xn=12,kn=8,ce=14,In=14,Ar=e=>e===void 0?void 0:{fontSize:typeof e=="number"?`${e}px`:e},oe=e=>({width:e,height:e}),A={container:"directory-tree-container relative h-full overflow-y-hidden pb-[3px] pr-[2px]",containerPending:"cursor-progress",entry:`directory-tree-entry flex items-center cursor-pointer relative select-none ${Rn}`,entryHover:`directory-tree-entry--hover ${ie.rowHover}`,entrySelected:`directory-tree-entry--selected ${ie.rowSelected}`,entryItemSelected:`directory-tree-entry--item-selected ${ie.rowSelected} ${ie.checkedRing}`,expandIcon:`directory-tree-expand-icon flex-shrink-0 flex items-center justify-center ${ie.icon}`,expandIconSelected:`directory-tree-expand-icon--selected ${ie.iconSelected}`,typeIcon:`directory-tree-type-icon flex-shrink-0 flex items-center justify-center ${ie.icon}`,typeIconSelected:`directory-tree-type-icon--selected ${ie.iconSelected}`,name:`directory-tree-name overflow-hidden text-ellipsis whitespace-nowrap ml-1 ${jr} font-normal ${ie.name}`,nameDirectory:"directory-tree-name--directory font-medium",nameSelected:`directory-tree-name--selected font-semibold ${ie.nameSelected}`},Mt=e=>{const t=e.slice(e.lastIndexOf("/")+1),r=t.lastIndexOf(".");return r<=0?"":t.slice(r+1).toLowerCase()},Cn=/^[a-z][a-z\d+.-]*:\/\//i,Rr=e=>Mt(Cn.test(e)?e.split(/[?#]/,1)[0]:e),Mr=e=>Mt(e.name)||Rr(e.relativePath)||Rr(e.absolutePath),Dr=({isDirectory:e,isExpanded:t,showExpandIcons:r,useCanvasExpandIcons:n,expandIconSize:a})=>{const i=a?{width:a,height:a}:void 0,c=a?"":"h-4 w-4";return!(r&&e)||n?h.jsx("span",{className:c,style:i,"aria-hidden":"true"}):t?h.jsx(gn,{className:c,style:i}):h.jsx(Sn,{className:c,style:i})},Pt=(e,t)=>{if(e==null||typeof e=="boolean")return null;if(typeof e=="function")return console.warn(`[DirectoryTree] Function returned by renderer for "${t}". Return a node.`),null;if(typeof e=="object"){if("then"in e)return console.warn(`[DirectoryTree] Promise returned for "${t}". Not supported.`),null;if(Array.isArray(e)){const n=e.map(a=>Pt(a,t)).filter(Boolean);return n.length?n:null}const r=e.type;if(r&&r.$$typeof===Symbol.for("react.lazy"))return console.warn(`[DirectoryTree] Lazy component for "${t}". Not supported.`),null}return e},Tn={markdown:e=>h.jsx(le.FileMd,{className:de.markdown,style:oe(e)}),pdf:e=>h.jsx(le.FilePdf,{className:de.pdf,style:oe(e)}),spreadsheet:e=>h.jsx(le.FileXls,{className:de.spreadsheet,style:oe(e)}),csv:e=>h.jsx(le.FileCsv,{className:de.csv,style:oe(e)}),document:e=>h.jsx(le.FileDoc,{className:de.document,style:oe(e)}),presentation:e=>h.jsx(le.FilePpt,{className:de.presentation,style:oe(e)}),image:e=>h.jsx(le.FileImage,{className:de.image,style:oe(e)}),audio:e=>h.jsx(le.FileAudio,{className:de.audio,style:oe(e)}),video:e=>h.jsx(le.FileVideo,{className:de.video,style:oe(e)}),archive:e=>h.jsx(le.FileZip,{className:de.archive,style:oe(e)}),code:e=>h.jsx(le.FileCode,{className:de.code,style:oe(e)}),text:e=>h.jsx(le.FileText,{className:de.text,style:oe(e)})},_n={markdown:["md","markdown","mdx"],pdf:["pdf"],spreadsheet:["xls","xlsx","xlsm","xlsb","ods"],csv:["csv","tsv"],document:["doc","docx","rtf","odt"],presentation:["ppt","pptx","odp"],image:["png","jpg","jpeg","gif","svg","webp","ico","bmp","tiff","avif"],audio:["mp3","wav","ogg","m4a","flac","aac","wma"],video:["mp4","webm","mov","avi","mkv","wmv","flv"],archive:["zip","tar","gz","7z","rar","tgz","bz2"],code:["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"],text:["txt","log"]},Nn=new Map(Object.entries(_n).flatMap(([e,t])=>t.map(r=>[r,e]))),Pn=new Set(["","application/octet-stream","binary/octet-stream","text/plain","application/x-empty"]),On=e=>(e??"").split(";",1)[0].trim().toLowerCase(),Ln=e=>{if(e==="text/markdown"||e==="text/x-markdown")return"markdown";if(e==="application/pdf")return"pdf";if(e.includes("excel")||e.includes("spreadsheet"))return"spreadsheet";if(e==="text/csv"||e==="text/tab-separated-values")return"csv";if(e.includes("word")||e.includes("google-apps.document")||e==="application/rtf")return"document";if(e.includes("powerpoint")||e.includes("presentation"))return"presentation";if(e.startsWith("image/"))return"image";if(e.startsWith("audio/"))return"audio";if(e.startsWith("video/"))return"video";if(e.includes("zip")||e.includes("tar")||e.includes("compressed")||e.includes("archive"))return"archive";if(e==="application/json"||e.includes("javascript")||e.includes("typescript")||e.includes("xml")||e.startsWith("text/html")||e.startsWith("text/css")||e.includes("x-python")||e.includes("x-sh")||e.includes("x-go")||e.includes("x-rust"))return"code";if(e.startsWith("text/"))return"text"},jn=(e,t,r,n)=>{const a=On(e),i=Ln(a),c=Nn.get((t||(r?Mt(r):"")).toLowerCase()),m=(Pn.has(a)?[c,i]:[i,c]).find(S=>S!==void 0);return m===void 0?h.jsx(le.FileIcon,{className:ie.icon,style:oe(n)}):Tn[m](n)},$r=(e,t,r)=>{const{entry:n,isDirectory:a,isExpanded:i,extension:c,mimeType:u}=e;let m;const S=u||n.mimeType;return n.icon!==void 0?m=n.icon:a?m=i&&t?.directoryExpanded||t?.directory||h.jsx(wn,{style:oe(r)}):c&&t?.fileByExtension?.[c]?m=t.fileByExtension[c]:m=t?.file||jn(S,c,n.name,r),Pt(typeof m=="function"?m(e):m,n.absolutePath)},An=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Fr=e=>{if(!e)return;const t=Object.entries(e).filter(([,r])=>r!=null);if(t.length!==0)return Object.fromEntries(t.map(([r,n])=>[`data-${An(r)}`,String(n)]))},zr=["color","background","backgroundColor","backgroundImage","backgroundPosition","backgroundSize","backgroundRepeat","backgroundClip","backgroundOrigin","backgroundAttachment","backgroundBlendMode","opacity","boxShadow","filter","backdropFilter","mixBlendMode","borderColor","borderRadius","outline","outlineColor","outlineStyle","outlineWidth","outlineOffset","textShadow","accentColor","caretColor","cursor","fontFamily","fontSize","fontStyle","fontWeight","fontVariant","fontFeatureSettings","fontVariationSettings","fontKerning","letterSpacing","lineHeight","textDecoration","textDecorationColor","textDecorationLine","textDecorationStyle","textDecorationThickness","textUnderlineOffset","textTransform"],Br=["color","opacity"],Mn="the row's box belongs to the tree (height: visual.itemHeight, indent: visual.indentSize, icons: visual.typeIconSize, text size: visual.fontSize)",Dn=new Set(zr),$n=new Set(Br),xr=(e,t)=>{const r=t===void 0?e.option:`${e.option}.${t}`;return e.absolutePath===void 0?r:`${r} of "${e.absolutePath}"`},Hr=(e,t,r,n)=>{if(e!==void 0){if(typeof e!="object"||e===null)throw new RangeError(`${xr(r,void 0)} must be an object of CSS properties or undefined, got ${e===null?"null":typeof e}.`);for(const[a,i]of Object.entries(e))if(i!==void 0&&!t.has(a))throw new RangeError(`${xr(r,a)} cannot be set: ${Mn}, so ${n}.`)}},We=(e,t)=>Hr(e,Dn,t,"a row style accepts only paint and text properties (ROW_STYLE_PROPERTIES)"),Fn=(e,t)=>Hr(e,$n,t,"the expand icon style accepts only the glyph's colour and opacity (EXPAND_ICON_STYLE_PROPERTIES), and the 14 px expand box is the tree's"),zn=500,Wr=({entry:e,isDirectory:t,isExpanded:r,isItemSelected:n,selectionMode:a,onSelectionChange:i,onEntryClick:c,toggleDirectory:u,onToggleDirectoryRecursive:m})=>{const S=l.useRef(null);return l.useEffect(()=>()=>{S.current&&window.clearTimeout(S.current)},[]),l.useCallback(T=>{T.stopPropagation(),a!=="none"&&!t&&i&&i(e,!n);let x=!1;c({entry:e,isDirectory:t,isExpanded:r,preventDefault:()=>{x=!0}}),!(!t||x)&&(S.current?(window.clearTimeout(S.current),S.current=null,m(e)):S.current=window.setTimeout(()=>{u(e.absolutePath),S.current=null},zn))},[t,e,r,m,u,c,a,i,n])},Yr=e=>e==="right"?"dt-grid-cell--right":e==="center"?"dt-grid-cell--center":"",kr=(e,t)=>e.children!==void 0&&t(e.absolutePath),Gr=(e,t)=>({width:e,gridTemplateColumns:t}),Vr=l.memo(({entry:e,indentLevel:t,positionInSet:r,setSize:n,rowIndex:a,flatIndex:i,onRowFocus:c,onRowBlur:u,isSelectedForAria:m,rowHeight:S,isDirOpen:T,columns:x,numericTemplate:_,numericTotal:p,nameWidth:g,rowClassName:y,selection:{onEntryClick:E,selectedPath:v,currentPath:$,mode:N="none",selectedItems:P,onSelectionChange:b},expansion:{toggleDirectory:M,onToggleDirectoryRecursive:D},visual:{iconOverrides:O,showExpandIcons:q=!0,showDirectoryIcons:X=!0,showFileIcons:F=!0,useCanvasExpandIcons:W=!1,expandIconSize:fe,typeIconSize:B,fontSize:re,indentSize:he,highlightStyles:Y,expandIconClassName:G,expandIconStyle:we}})=>{We(e.style,{option:"entry.style",absolutePath:e.absolutePath});const[ge,o]=l.useState(!1),f=e.children!==void 0,I=f&&T(e.absolutePath),R=e.absolutePath===v,be=e.absolutePath===$,C=!f&&!!P?.has(e.absolutePath),L=f?void 0:Mr(e),Z=Wr({entry:e,isDirectory:f,isExpanded:I,isItemSelected:C,selectionMode:N,onSelectionChange:b,onEntryClick:E,toggleDirectory:M,onToggleDirectoryRecursive:D}),me=ge?Y?.hoverClassName!==void 0?Y.hoverClassName:A.entryHover:"",Ie=(()=>{if(f){if(R)return Y?.directorySelectedClassName!==void 0?Y.directorySelectedClassName:A.entrySelected}else if(R||C)return Y?.itemSelectedClassName!==void 0?Y.itemSelectedClassName:K.twMerge(R&&A.entrySelected,C&&A.entryItemSelected);return""})(),j=typeof y=="function"?y(e):y,Se=K.twMerge("dt-grid-row cursor-pointer select-none",me,Ie,j,e.className),U=K.twMerge(A.expandIcon,G,(R||C)&&A.expandIconSelected),Me=K.twMerge(A.typeIcon,(R||C)&&A.typeIconSelected),ne=K.twMerge("dt-grid-name-label ml-1",ie.name,f&&A.nameDirectory,(R||C)&&A.nameSelected),Q=Dr({isDirectory:f,isExpanded:I,showExpandIcons:q,useCanvasExpandIcons:W,expandIconSize:fe}),se=(f?X:F)?$r({entry:e,isDirectory:f,isExpanded:I,isSelected:R,isItemSelected:C,extension:L,mimeType:e.mimeType},O,B):null,Ce={indentLevel:t,isDirectory:f,isExpanded:I},[Ee,...Pe]=x,Re=Ee?.render?Ee.render(e,Ce):e.label??e.name,Ye={...ge?Y?.hoverStyle:{},...f&&R?Y?.directorySelectedStyle:{},...!f&&(R||C)?Y?.itemSelectedStyle:{}};return h.jsxs("div",{className:Se,style:{...Ye,...e.style,height:S},role:"row","aria-expanded":f?I:void 0,"aria-level":t+1,"aria-posinset":r,"aria-setsize":n,"aria-rowindex":a,"aria-selected":N==="none"?void 0:m,"aria-current":be?"page":void 0,...Fr(e.data),"data-entry-type":f?"directory":"file","data-entry-expanded":f?String(I):void 0,"data-entry-selected":R?"true":void 0,"data-entry-item-selected":C?"true":void 0,onClick:Z,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),onFocus:H=>c(i,e.absolutePath,H.currentTarget),onBlur:H=>u(e.absolutePath,H.currentTarget),onKeyDown:H=>{if(H.key==="Enter"){if(H.repeat){H.preventDefault();return}Z(H)}},tabIndex:0,children:[h.jsxs("div",{className:K.twMerge("dt-grid-name-cell",Ee?.className),role:"gridcell",style:{width:g,paddingLeft:Math.max(0,t*he)},children:[(q||W)&&h.jsx("span",{className:U,style:{...we,width:ce,height:ce},children:Q}),(f?X:F)&&h.jsx("span",{className:Me,style:{width:B,height:B},children:se}),h.jsx("span",{className:ne,style:Ar(re),children:Re})]}),Pe.length>0&&h.jsx("div",{className:"dt-grid-numeric-viewport",children:h.jsx("div",{className:"dt-grid-numeric-track",style:Gr(p,_),children:Pe.map(H=>h.jsx("div",{className:K.twMerge("dt-grid-cell",Yr(H.align),H.className),role:"gridcell",children:H.render?H.render(e,Ce):null},H.key))})})]})},(e,t)=>{if(e.entry!==t.entry)return!1;const r=kr(e.entry,e.isDirOpen),n=kr(t.entry,t.isDirOpen);return e.indentLevel===t.indentLevel&&e.positionInSet===t.positionInSet&&e.setSize===t.setSize&&e.rowIndex===t.rowIndex&&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});Vr.displayName="DirectoryTreeGridRow";const Kr=({kind:e,columns:t,numericTemplate:r,numericTotal:n,nameWidth:a,scrollBarWidth:i,className:c,nameContent:u,renderCell:m})=>{const[,...S]=t,T=e==="header"?"dt-grid-name-header":"dt-grid-name-footer",x=e==="header"?"dt-grid-header":"dt-grid-footer",_=e==="header"?"columnheader":"gridcell";return h.jsxs("div",{className:K.twMerge(x,ie.gridEdge,c),role:"row",children:[h.jsx("div",{className:K.twMerge(T,"px-1",t[0]?.className),role:_,style:{width:a},children:u}),S.length>0&&h.jsx("div",{className:"dt-grid-numeric-viewport",children:h.jsx("div",{className:"dt-grid-numeric-track",style:Gr(n,r),children:S.map(p=>h.jsx("div",{className:K.twMerge("dt-grid-cell",Yr(p.align),p.className),role:_,children:m(p)},p.key))})}),h.jsx("div",{className:"dt-grid-scrollbar-spacer",style:{width:i},"aria-hidden":"true"})]})},Bn=({columns:e,className:t,...r})=>h.jsx(Kr,{kind:"header",columns:e,className:t,nameContent:e[0]?.header??null,renderCell:n=>n.header??null,...r}),Ir=(e,t)=>typeof e=="function"?e(t):e??null,Hn=({columns:e,allEntries:t,className:r,...n})=>h.jsx(Kr,{kind:"footer",columns:e,className:r,nameContent:Ir(e[0]?.footer,t),renderCell:a=>Ir(a.footer,t),...n}),Wn=240,Xr=96,Ur=12,Ot=(e,t)=>{const r=e?.width;return typeof r=="number"&&Number.isFinite(r)&&r>0?r:t},Yn=e=>e.slice(1).map(t=>`${Ot(t,Xr)}px`).join(" "),Gn=({measuredWidth:e,columns:t,scrollBarWidth:r=Ur})=>{const n=Ot(t[0],Wn),a=t.slice(1).reduce((m,S)=>m+Ot(S,Xr),0),i=Number.isFinite(e)&&e>0?e:0,c=Math.max(0,i-n-Math.max(0,r)),u=Math.max(0,a-c);return{nameWidth:n,numericTotal:a,numericVisible:c,maxHScroll:u}},Nt=(e,t)=>!Number.isFinite(e)||e<0?0:e>t?t:e,Vn=e=>{const t=[],r=n=>{for(const a of n)t.push(a),a.children&&a.children.length>0&&r(a.children)};return r(e),t},Jr=["entryKindDirectory","entryKindFile"],Lt=[...ye.VIRTUAL_SCROLL_LABEL_KEYS,...Jr],jt=Object.freeze({en:Object.freeze({entryKindDirectory:"directory",entryKindFile:"file"}),ja:Object.freeze({entryKindDirectory:"ディレクトリ",entryKindFile:"ファイル"})}),qr=Object.freeze({en:Object.freeze({...ye.VIRTUAL_SCROLL_LABEL_CATALOGS.en,...jt.en}),ja:Object.freeze({...ye.VIRTUAL_SCROLL_LABEL_CATALOGS.ja,...jt.ja})}),Cr=e=>typeof e=="string"?JSON.stringify(e):e===null?"null":typeof e,Kn=e=>{const t={};let r=!1;for(const n of ye.VIRTUAL_SCROLL_LABEL_KEYS){const a=Object.hasOwn(e,n)?e[n]:void 0;a!==void 0&&(t[n]=a,r=!0)}return r?t:void 0},Zr=(e,t)=>{const r=ye.resolveVirtualScrollLocale(e);if(t===void 0)return qr[r];if(t===null||typeof t!="object")throw new RangeError(`[directory-tree] labels must be an object; got ${Cr(t)}`);const n=Object.getPrototypeOf(t);if(n!==Object.prototype&&n!==null)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"}`);for(const c of Object.keys(t))if(!Lt.includes(c))throw new RangeError(`[directory-tree] labels.${c} is not a known label key; expected one of ${Lt.join(", ")}`);const i={...ye.resolveVirtualScrollLabels(r,Kn(t)),...jt[r]};for(const c of Jr){const u=Object.hasOwn(t,c)?t[c]:void 0;if(u!==void 0){if(typeof u!="string"||u.trim()==="")throw new RangeError(`[directory-tree] labels.${c} must be a non-blank string; got ${Cr(u)}`);i[c]=u}}return Object.freeze(i)},Xn=e=>{const t={};for(const r of ye.VIRTUAL_SCROLL_LABEL_KEYS)t[r]=e[r];return Object.freeze(t)},Un=()=>{let e=null;return{mark:t=>{const r=t.composedPath();e=r,setTimeout(()=>{e===r&&(e=null)},0)},landedOn:t=>e?.includes(t)===!0}},Ze=e=>typeof e=="string"?JSON.stringify(e):String(e),At=(e,t)=>{if(typeof t!="number"||!Number.isFinite(t)||t<=0)throw new RangeError(`[directory-tree] visual.${e} must be a finite number greater than 0 (px); got ${Ze(t)}.`);return t},Jn=e=>{if(typeof e=="string"&&e.trim()!==""||typeof e=="number"&&Number.isFinite(e)&&e>0)return e;throw new RangeError(`[directory-tree] visual.fontSize must be a finite number greater than 0 (px) or a CSS font size that is not blank; got ${Ze(e)}.`)},qn=({indentSize:e,typeIconSize:t,fontSize:r})=>({indentSize:e===void 0?xn:At("indentSize",e),typeIconSize:t===void 0?In:At("typeIconSize",t),fontSize:r===void 0?void 0:Jn(r)}),Zn=({indentSize:e,removeRootIndent:t,hasExpandBox:r})=>t?Math.max(0,e-(r?ce:0)):0,Qn=(e,t,r)=>{if(typeof e!="function")return At("itemHeight",e);const n=e(t,r);if(typeof n!="number"||!Number.isFinite(n)||n<=0)throw new RangeError(`[directory-tree] visual.itemHeight returned ${Ze(n)} for ${JSON.stringify(t.absolutePath)} (row ${r}); it must return a finite number greater than 0 (px).`);return n},eo=(e,t,r)=>{const n=t===void 0?kn:t;if(typeof n!="number"||!Number.isFinite(n)||n<=0||n>ce)throw new RangeError(`[directory-tree] visual.expandIconSize must be a finite number greater than 0 and at most ${ce} (the expand box, px) while tree lines are drawn; got ${Ze(n)}.`);const{indentSize:a,typeIconSize:i}=e,c=n/2,u=ce+i-n/2;if(a<c||a>u)throw new RangeError(`[directory-tree] visual.indentSize ${Ze(a)} does not fit the tree lines: with typeIconSize ${i} and an expand glyph of ${n} px it must be from ${c} (half the glyph) to ${u} (the ${ce} px expand box + typeIconSize − half the glyph).`);return{indentSize:a,typeIconSize:i,glyphSize:n,originX:r}},to=({indentSize:e,typeIconSize:t,glyphSize:r})=>Math.min(Math.max(ce+t/2-e,r/2),ce-r/2),ro=(e,t)=>{const r=e.length-1;if(r<=0)return 0;let n=0,a=r-1,i=0;for(;n<=a;){const c=n+a>>>1;e[c]<=t?(i=c,n=c+1):a=c-1}return i},no=(e,t,r)=>{if(r<=0||e.length===0||t.length!==e.length+1)return null;const n=ro(t,r),a=e[n];return a?{path:a.entry.absolutePath,offsetInViewport:r-t[n]}:null},oo=(e,t,r)=>{if(t.length===0||r.length!==t.length+1)return null;for(let n=0;n<t.length;n++)if(t[n].entry.absolutePath===e.path)return Math.max(0,r[n]+e.offsetInViewport);return null},so=(e,t,r)=>{const n=[];for(let a=t;a<r;a++){const i=e[a];if(!(!i||i.length===0))for(const c of i)n.push(c)}return n},ao=(e,t,r)=>{const n=[];for(let a=t;a<r;a++){const i=e[a];if(!(!i||i.length===0))for(const c of i)n.push(c)}return n},lo=(e,t,r,n)=>{const a=Math.max(1,Math.floor(t*n)),i=Math.max(1,Math.floor(r*n));(e.width!==a||e.height!==i)&&(e.width=a,e.height=i);const c=e.style;c.width!==`${t}px`&&(c.width=`${t}px`),c.height!==`${r}px`&&(c.height=`${r}px`)},io=(e,t,r)=>{e.lineWidth=r,e.beginPath();for(const n of t)e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2);e.stroke()},co=(e,t,r,n)=>{if(t.length===0)return;const a=e.strokeStyle,i=e.lineWidth,c=e.lineCap,u=e.lineJoin;e.strokeStyle=r,e.lineCap="round",e.lineJoin="round";for(const m of t){const S=n??m.size,T=Math.max(0,S/2),x=Math.max(1,Math.round(S*.08)),_=Math.max(1,Math.round(S*.14)),p=Math.max(0,T-x*.8),g=Math.max(0,p*.55);e.lineWidth=x,e.beginPath(),e.arc(m.centerX,m.centerY,Math.max(0,T-x*.3),0,Math.PI*2),e.stroke(),e.lineWidth=_,e.beginPath(),e.moveTo(m.centerX-g,m.centerY),e.lineTo(m.centerX+g,m.centerY),e.stroke(),m.isExpanded||(e.beginPath(),e.moveTo(m.centerX,m.centerY-g),e.lineTo(m.centerX,m.centerY+g),e.stroke())}e.strokeStyle=a,e.lineWidth=i,e.lineCap=c,e.lineJoin=u},Qr=l.memo(({segmentsByItem:e,glyphsByItem:t,itemHeight:r,width:n,viewportHeight:a,scrollPosition:i,color:c=Lr,strokeWidth:u=1,renderStartIndex:m,renderEndIndex:S,lookaheadEndIndex:T,devicePixelRatio:x,expandGlyphColor:_,expandGlyphSize:p})=>{const g=l.useRef(null),y=l.useRef(null),E=l.useRef({segmentsByItem:e,glyphsByItem:t,itemHeight:r,width:n,viewportHeight:a,scrollPosition:i,color:c,strokeWidth:u,renderStartIndex:m,renderEndIndex:S,lookaheadEndIndex:T,devicePixelRatio:x,expandGlyphColor:_,expandGlyphSize:p}),v=l.useCallback(()=>{y.current=null;const N=g.current;if(!N)return;const P=N.getContext("2d");if(!P)return;const b=E.current;if(b.width<=0||b.viewportHeight<=0){P.clearRect(0,0,N.width,N.height);return}const M=Number.isFinite(b.devicePixelRatio??NaN)?b.devicePixelRatio:typeof window<"u"&&window.devicePixelRatio||1;lo(N,b.width,b.viewportHeight,M);const D=b.segmentsByItem.length,O=typeof b.renderStartIndex=="number"&&Number.isFinite(b.renderStartIndex)?Math.max(0,Math.floor(b.renderStartIndex)):Math.max(0,Math.floor(b.scrollPosition/b.itemHeight)),q=Math.min(D,Math.ceil((b.scrollPosition+b.viewportHeight)/b.itemHeight)),X=(()=>{if(typeof b.renderEndIndex=="number"&&Number.isFinite(b.renderEndIndex)){const B=Math.floor(b.renderEndIndex);return Math.max(Math.min(D,B+1),O)}return Math.max(q,O)})(),F=(()=>{if(typeof b.lookaheadEndIndex=="number"&&Number.isFinite(b.lookaheadEndIndex)){const B=Math.floor(b.lookaheadEndIndex),re=Math.min(D,B+1);return Math.max(re,X)}return Math.max(q,X)})(),W=so(b.segmentsByItem,O,F),fe=ao(b.glyphsByItem,O,F);P.save(),P.scale(M,M),P.clearRect(0,0,b.width,b.viewportHeight),P.translate(0,-b.scrollPosition),P.strokeStyle=b.color,io(P,W,b.strokeWidth),co(P,fe,b.expandGlyphColor??b.color,b.expandGlyphSize),P.restore()},[]),$=l.useCallback(()=>{y.current===null&&(y.current=window.requestAnimationFrame(v))},[v]);return l.useEffect(()=>{E.current={segmentsByItem:e,glyphsByItem:t,itemHeight:r,width:n,viewportHeight:a,scrollPosition:i,color:c,strokeWidth:u,renderStartIndex:m,renderEndIndex:S,lookaheadEndIndex:T,devicePixelRatio:x,expandGlyphColor:_,expandGlyphSize:p},$()},[e,t,r,n,a,i,c,u,m,S,T,x,_,p,$]),l.useEffect(()=>()=>{y.current!==null&&(window.cancelAnimationFrame(y.current),y.current=null)},[]),h.jsx("canvas",{ref:g,className:"pointer-events-none absolute top-0 left-0 z-0"})});Qr.displayName="TreeLineCanvas";const uo=e=>{const t=new Map;for(let r=0;r<e.length;r++){const n=e[r].entry.absolutePath;t.has(n)||t.set(n,r)}return t},Tr=(e,t)=>e.selectedPath===t?e:{selectedPath:t,selectionGeneration:e.selectionGeneration+1,anchor:e.anchor},fo=(e,t)=>({...e,anchor:{path:t,selectionGeneration:e.selectionGeneration,focused:!0}}),ho=(e,t)=>{const{anchor:r,selectionGeneration:n,selectedPath:a}=t;if(r!==null&&(r.focused||r.selectionGeneration===n)){const i=e.get(r.path);if(i!==void 0)return i}if(a!==null){const i=e.get(a);if(i!==void 0)return i}return 0},mo={msOverflowStyle:"none",scrollbarWidth:"none"},po=()=>{let e=document.getElementById("directory-tree-webkit-scrollbar-hide");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))},yo=()=>()=>{},go=()=>!0,bo=()=>!1,So=e=>{const t=l.useRef(null),r=t.current;return r!==null&&ye.VIRTUAL_SCROLL_LABEL_KEYS.every(n=>r[n]===e[n])?r:(t.current=e,e)},_r=new Set(["top","bottom","center","nearest"]),Nr=e=>{const t=e?.align;if(t===void 0)return"top";if(!_r.has(t))throw new RangeError(`[directory-tree] Unsupported scroll alignment ${JSON.stringify(t)}; expected one of ${[..._r].join(", ")}.`);return t},vo={position:"absolute",width:1,height:1,margin:-1,padding:0,border:0,overflow:"hidden",clipPath:"inset(50%)",whiteSpace:"nowrap"},wo=(e,t,r,n,a)=>{const i=[],c=[];let u=0;const m=(S,T,x)=>{const _=a?[...S].sort(a):S;for(let p=0;p<_.length;p++){const g=_[p],y=p===_.length-1,E=[...x,y],v=g.children!==void 0,$=v&&t(g.absolutePath,g.relativePath);let N=T,P=x;n&&(N=T-1,P=x.slice(1)),i.push({entry:g,indentLevel:N,depth:T,positionInSet:p+1,setSize:_.length}),r&&(N>u&&(u=N),c.push({id:g.absolutePath,name:g.name,absolutePath:g.absolutePath,indentLevel:N,isLastChild:y,isDirectory:v,isExpanded:$,ancestorIsLast:[...P],hideLines:n&&T===0})),v&&$&&g.children&&m(g.children,T+1,E)}};return m(e,0,[]),{flatItems:i,lineItems:c,maxIndent:u}},Pr=(e,t)=>{const r=e.length-1;if(r<=0)return 0;let n=0,a=r-1,i=0;for(;n<=a;){const c=n+a>>>1;e[c]<=t?(i=c,n=c+1):a=c-1}return i},Eo=(e,t,r,n,a,i)=>{const c=n?.renderStart??Math.max(0,Pr(i,a)),u=t>0?Pr(i,a+t)+r:c+r,m=e>0?Math.min(e-1,Math.max(c,u)):c,S=n?.renderEnd??m,T=e>0?Math.min(e-1,S+r):S;return{renderStart:c,renderEnd:S,lookaheadEnd:T}},Ro=(e,t,r,n)=>{if(e.length===0)return{segmentsByItem:[],glyphsByItem:[]};const{indentSize:a,typeIconSize:i,glyphSize:c,originX:u}=n,m=Array.from({length:e.length},()=>[]),S=Array.from({length:e.length},()=>[]),T=u+to(n),x=p=>p*a+T,_=c/2+2;for(let p=0;p<e.length;p++){const g=e[p],y=t[p]??0,E=r[p]??0,v=E+y/2,$=e[p+1],N=v+i/2,P=E+y,b=$!==void 0&&$.indentLevel===g.indentLevel+1&&N<P?{key:`${g.id}-connector-children`,x1:x($.indentLevel),y1:N,x2:x($.indentLevel),y2:P,itemIndex:p}:null;if(g.hideLines){b!==null&&(m[p]=[b]);continue}const M=[];for(let O=0;O<g.indentLevel;O++){if(g.ancestorIsLast[O]??!1)continue;let X=!1;for(let F=p;F<e.length;F++){const W=e[F];if(W.indentLevel>O&&W.ancestorIsLast.length>O&&!W.ancestorIsLast[O]){X=!0;break}if(F>p&&W.indentLevel===O)break}if(X){const F=x(O);M.push({key:`${g.id}-ancestor-${O}`,x1:F,y1:E,x2:F,y2:E+y,itemIndex:p})}}const D=x(g.indentLevel);p>0&&M.push({key:`${g.id}-connector-top`,x1:D,y1:E,x2:D,y2:g.isDirectory?v-_:v,itemIndex:p}),!g.isDirectory&&g.isLastChild&&M.push({key:`${g.id}-connector-horizontal`,x1:D,y1:v,x2:u+g.indentLevel*a+ce,y2:v,itemIndex:p}),g.isLastChild||(g.isDirectory?M.push({key:`${g.id}-connector-bottom`,x1:D,y1:v+_,x2:D,y2:E+y,itemIndex:p}):M.push({key:`${g.id}-connector-bottom`,x1:D,y1:v,x2:D,y2:E+y,itemIndex:p})),b!==null&&M.push(b),m[p]=M,g.isDirectory&&(S[p]=[{key:`${g.id}-glyph`,itemIndex:p,centerX:D,centerY:v,size:c,isExpanded:g.isExpanded}])}return{segmentsByItem:m,glyphsByItem:S}},en=l.memo(({entry:e,indentLevel:t,originX:r,depth:n,positionInSet:a,setSize:i,isSelectedForAria:c,flatIndex:u,isActive:m,registerRowRef:S,onNavigationKeyDown:T,onRowFocus:x,onRowBlur:_,rowHeight:p,entryKindDirectory:g,entryKindFile:y,isDirOpen:E,expansion:{toggleDirectory:v,onToggleDirectoryRecursive:$},selection:{onEntryClick:N,selectedPath:P,currentPath:b,mode:M="none",selectedItems:D,onSelectionChange:O},visual:{iconOverrides:q,showExpandIcons:X=!0,showDirectoryIcons:F=!0,showFileIcons:W=!0,useCanvasExpandIcons:fe=!1,expandIconSize:B,typeIconSize:re,fontSize:he,indentSize:Y,highlightStyles:G,entryClassName:we,entryStyle:ge,nameClassName:o,nameStyle:f,directoryNameClassName:I,directoryNameStyle:R,fileNameClassName:be,fileNameStyle:C,expandIconClassName:L,expandIconStyle:Z}})=>{We(e.style,{option:"entry.style",absolutePath:e.absolutePath});const[me,Ie]=l.useState(!1),j=e.children!==void 0,Se=j&&E(e.absolutePath),U=e.absolutePath===P,Me=e.absolutePath===b,ne=!j&&D?.has(e.absolutePath),Q=l.useCallback(ee=>S(u,ee),[S,u]),se=j?void 0:Mr(e),Ce=Wr({entry:e,isDirectory:j,isExpanded:Se,isItemSelected:!!ne,selectionMode:M,onSelectionChange:O,onEntryClick:N,toggleDirectory:v,onToggleDirectoryRecursive:$}),Ee=me?G?.hoverClassName!==void 0?G.hoverClassName:A.entryHover:"",Pe=(()=>{if(j){if(U)return G?.directorySelectedClassName!==void 0?G.directorySelectedClassName:A.entrySelected}else if(U||ne)return G?.itemSelectedClassName!==void 0?G.itemSelectedClassName:K.twMerge(U&&A.entrySelected,ne&&A.entryItemSelected);return""})(),Re=K.twMerge(A.entry,Ee,Pe,we,e.className),Ye=K.twMerge(A.expandIcon,L,(U||ne)&&A.expandIconSelected),H=K.twMerge(A.typeIcon,(U||ne)&&A.typeIconSelected),Qe=K.twMerge(A.name,o,j&&A.nameDirectory,j&&I,!j&&be,(U||ne)&&A.nameSelected),ft=Dr({isDirectory:j,isExpanded:Se,showExpandIcons:X&&t>=0,useCanvasExpandIcons:fe,expandIconSize:B}),Ge=(j?F:W)?$r({entry:e,isDirectory:j,isExpanded:Se,isSelected:U,isItemSelected:!!ne,extension:se,mimeType:e.mimeType},q,re):null,Ve={...me?G?.hoverStyle:{},...j&&U?G?.directorySelectedStyle:{},...!j&&(U||ne)?G?.itemSelectedStyle:{}},et=Fr(e.data),ht={width:re,height:re},Oe=Ar(he),Te=r+t*Y;return h.jsxs("div",{className:Re,style:{...Oe,...Ve,...ge,...e.style,paddingLeft:`${Math.max(0,Te)}px`,transform:Te<0?`translateX(${Te}px)`:void 0,width:Te<0?`calc(100% + ${-Te}px)`:void 0,height:`${p}px`},...et,"data-entry-type":j?"directory":"file","data-entry-expanded":j?String(Se):void 0,"data-entry-selected":U?"true":void 0,"data-entry-item-selected":ne?"true":void 0,onClick:Ce,onMouseEnter:()=>Ie(!0),onMouseLeave:()=>Ie(!1),onFocus:ee=>x(u,e.absolutePath,ee.currentTarget),onBlur:ee=>_(e.absolutePath,ee.currentTarget),ref:Q,onKeyDown:ee=>{if(ee.key==="Enter"||ee.key===" "){ee.preventDefault(),ee.repeat||Ce(ee);return}T(ee,u)},tabIndex:m?0:-1,role:"treeitem","aria-expanded":j?Se:void 0,"aria-level":n+1,"aria-posinset":a,"aria-setsize":i,"aria-selected":M==="none"?void 0:c,"aria-current":Me?"page":void 0,"aria-label":`${e.name} (${j?g:y})`,children:[(X||fe)&&h.jsx("span",{className:Ye,style:{...Z,width:ce,height:ce},children:ft}),(j?F:W)&&h.jsx("span",{className:H,style:ht,children:Ge}),h.jsx("span",{className:Qe,style:{...Oe,...f,...j?R:C},"data-entry-type":j?"directory":"file","data-entry-role":"name",children:e.label??e.name})]})},(e,t)=>{if(e.entry!==t.entry)return!1;const r=e.entry.children!==void 0,n=t.entry.children!==void 0,a=r&&e.isDirOpen(e.entry.absolutePath),i=n&&t.isDirOpen(t.entry.absolutePath);return e.indentLevel===t.indentLevel&&e.originX===t.originX&&e.depth===t.depth&&e.positionInSet===t.positionInSet&&e.setSize===t.setSize&&e.isSelectedForAria===t.isSelectedForAria&&e.flatIndex===t.flatIndex&&e.isActive===t.isActive&&e.rowHeight===t.rowHeight&&e.entryKindDirectory===t.entryKindDirectory&&e.entryKindFile===t.entryKindFile&&a===i&&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.typeIconSize===t.visual.typeIconSize&&e.visual.fontSize===t.visual.fontSize&&e.visual.indentSize===t.visual.indentSize&&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});en.displayName="DirectoryEntryItem";const tn=e=>{const t=[];if(e.children)for(const r of e.children)r.type==="directory"&&(t.push(r.absolutePath),t.push(...tn(r)));return t},xo=({entries:e,expansion:{toggle:t,isExpanded:r,expandMultiple:n,collapseMultiple:a,isPending:i,alwaysExpanded:c=!1,doubleClickAction:u="recursive"},selection:{onEntryClick:m,selectedPath:S,currentPath:T,mode:x="none",selectedItems:_,onSelectionChange:p},visual:{className:g,style:y,ariaLabel:E,ariaLabelledBy:v,lineColor:$=Lr,showTreeLines:N=!0,showExpandIcons:P=!0,showDirectoryIcons:b=!0,showFileIcons:M=!0,iconOverrides:D,expandIconSize:O,typeIconSize:q,fontSize:X,indentSize:F,itemHeight:W=_t,removeRootIndent:fe=!1,highlightStyles:B,entryClassName:re,entryStyle:he,nameClassName:Y,nameStyle:G,directoryNameClassName:we,directoryNameStyle:ge,fileNameClassName:o,fileNameStyle:f,expandIconClassName:I,expandIconStyle:R}={},virtualScroll:be,grid:C,sort:L,locale:Z,labels:me,ref:Ie})=>{const j=ye.resolveVirtualScrollLocale(Z),Se=l.useMemo(()=>Zr(Z,me),[Z,me]),U=So(Xn(Se)),{entryKindDirectory:Me,entryKindFile:ne}=Se,Q=l.useMemo(()=>qn({indentSize:F,typeIconSize:q,fontSize:X}),[F,q,X]);l.useMemo(()=>{We(he,{option:"visual.entryStyle"}),We(B?.hoverStyle,{option:"visual.highlightStyles.hoverStyle"}),We(B?.directorySelectedStyle,{option:"visual.highlightStyles.directorySelectedStyle"}),We(B?.itemSelectedStyle,{option:"visual.highlightStyles.itemSelectedStyle"}),Fn(R,{option:"visual.expandIconStyle"})},[he,B,R]);const se=C!==void 0,Ce=l.useSyncExternalStore(yo,go,bo),Ee=l.useRef(null),Pe=l.useRef(null),Re=l.useRef(null),[Ye,H]=l.useState(0),[Qe,ft]=l.useState(0),[Ge,Ve]=l.useState(0),[et,ht]=l.useState(null),{overscanCount:Oe=15,className:Te,background:ee,onScroll:Dt,onRangeChange:$t,onScrollAdjust:Ft,liveRegion:zt,initialScrollIndex:Bt,initialScrollOffset:De,initialScrollAnchor:Ht,callbackThrottleMs:Wt=5,contentInsets:Yt,onItemFocus:Gt,viewportHeightOverride:ae,scrollBarOptions:mt,behaviorOptions:Vt,preserveScrollAnchor:Kt=!1,getItemKey:rn,testId:Xt,contentProps:pt}=be??{},Ut=l.useMemo(()=>se?{...pt,role:"rowgroup"}:{...pt,role:"tree","aria-label":v?void 0:E,"aria-labelledby":v,"aria-multiselectable":x==="multiple"?!0:void 0,"aria-busy":i?!0:void 0},[se,pt,E,v,x,i]),Jt=l.useMemo(()=>({...Vt,enableKeyboardNavigation:!1}),[Vt]),[tt,qt]=l.useState(typeof De=="number"?De:0),yt=l.useRef(typeof De=="number"?De:0),Zt=l.useCallback((s,d)=>{yt.current=s,qt(s),Dt?.(s,d)},[Dt]),Qt=l.useCallback(s=>{const{renderingStartIndex:d,renderingEndIndex:w}=s;ht(k=>k&&k.renderStart===d&&k.renderEnd===w?k:{renderStart:d,renderEnd:w}),$t?.(s)},[$t]);l.useEffect(()=>{po()},[]),l.useEffect(()=>{const s=Ee.current,d=se?Pe.current:s,w=()=>{if(s){const z=s.clientWidth;ft(J=>Math.abs(J-z)>1?z:J)}if(typeof ae=="number")H(z=>Math.abs(z-ae)>1?ae:z);else if(d){const z=d.clientHeight;H(J=>Math.abs(J-z)>1?z:J)}};if(!(s||d))return H(0);w();const k=new ResizeObserver(w);return s&&k.observe(s),d&&d!==s&&k.observe(d),()=>k.disconnect()},[ae,se]);const $e=typeof ae=="number"?ae:Ye,ve=l.useCallback(s=>c||(Ce?r(s):!1),[Ce,r,c]),er=K.twMerge(A.container,i&&A.containerPending,g),tr=l.useMemo(()=>({...mo,...y??{},...typeof ae=="number"?{height:ae,minHeight:ae}:{}}),[y,ae]),gt=l.useCallback((s,d)=>{const w=[s.absolutePath,...tn(s)],k=d||u;if(w.every(ke=>ve(ke)))return a(w);if(w.every(ke=>!ve(ke))||k==="recursive")return n(w);if(k==="toggle")return a(w);console.warn(`[DirectoryTree] Unknown double click action: ${k}. No action taken.`)},[ve,n,a,u]),bt=se?!1:fe,{flatItems:Le,lineItems:St,maxIndent:rr}=l.useMemo(()=>wo(e,ve,N,bt,L),[e,ve,N,bt,L]),rt=Zn({indentSize:Q.indentSize,removeRootIndent:bt,hasExpandBox:P||N}),pe=l.useMemo(()=>N?eo(Q,O,rt):null,[N,Q,O,rt]),V=l.useMemo(()=>Le.map((s,d)=>({...s,rowHeight:Qn(W,s.entry,d)})),[Le,W]),_e=l.useMemo(()=>V.map(s=>s.rowHeight),[V]),je=l.useMemo(()=>{const s=new Array(_e.length+1);s[0]=0;for(let d=0;d<_e.length;d++)s[d+1]=s[d]+_e[d];return s},[_e]),nr=l.useCallback(s=>V[s]?.rowHeight??_t,[V]),nn=l.useCallback(s=>V[s]?.entry.absolutePath??s,[V]),or=rn??nn,Fe=S??null,vt=T??null,[sr,Ke]=l.useState(()=>({selectedPath:Fe,selectionGeneration:0,anchor:null})),wt=Tr(sr,Fe);wt!==sr&&Ke(s=>Tr(s,Fe));const nt=l.useMemo(()=>uo(Le),[Le]),ze=l.useMemo(()=>ho(nt,wt),[nt,wt]),Xe=l.useRef(new Map),ot=l.useRef(null),[st]=l.useState(Un),Ue=l.useRef(null),[on,ar]=l.useState(!0),Et=l.useRef(Le);Et.current=Le;const lr=l.useRef(ve);lr.current=ve;const Rt=l.useRef(t);Rt.current=t;const ir=l.useRef(nt);ir.current=nt;const xt=l.useRef(ze);xt.current=ze;const cr=l.useRef(Gt);cr.current=Gt;const Ae=l.useCallback(s=>{const d=Re.current;return!d||d.getViewportSize()<=0?!1:(d.scrollToIndex(s,{align:"nearest"}),!0)},[]),xe=l.useCallback(s=>{const d=Xe.current.get(s);if(d===void 0){Ue.current=s,Ae(s)||(Ue.current=null);return}Ue.current=null,Ae(s),d.focus({preventScroll:!0})},[Ae]),dr=l.useCallback((s,d)=>{if(d)Xe.current.set(s,d),Ue.current===s?(Ue.current=null,d.focus({preventScroll:!0})):d.contains(d.ownerDocument.activeElement)&&Ke(w=>w.anchor===null?w:{...w,anchor:{...w.anchor,focused:!0}});else{const w=Xe.current.get(s);Xe.current.delete(s),w?.contains(w.ownerDocument.activeElement)&&Ke(k=>k.anchor===null?k:{...k,anchor:{...k.anchor,focused:!1}})}s===xt.current&&ar(d!==null)},[]);l.useLayoutEffect(()=>{ar(Xe.current.has(ze))},[ze]);const kt=l.useCallback((s,d,w)=>{const k=ot.current===w;ot.current=null,k||(Ke(z=>fo(z,d)),st.landedOn(w)||Ae(s)),cr.current?.(s)},[Ae,st]),at=l.useCallback(s=>st.mark(s.nativeEvent),[st]),It=l.useCallback((s,d)=>{const{ownerDocument:w}=d;if(!w.hasFocus()&&d.contains(w.activeElement)){ot.current=d;return}ot.current=null,Ke(k=>k.anchor!==null&&k.anchor.path===s?{...k,anchor:{...k.anchor,focused:!1}}:k)},[]),sn=l.useCallback(()=>xe(xt.current),[xe]),Ct=l.useCallback((s,d)=>{const w=Nr(d),k=Et.current.length;if(!Number.isInteger(s)||s<0||s>=k)throw new RangeError(`[directory-tree] scrollToIndex: ${String(s)} is not a row index (${k===0?"the tree has no rows":`expected an integer in 0..${String(k-1)}`}).`);if(w==="nearest"){Ae(s);return}Re.current?.scrollToIndex(s,{align:w})},[Ae]);l.useImperativeHandle(Ie,()=>({scrollToIndex:Ct,scrollToPath:(s,d)=>{Nr(d);const w=ir.current.get(s);return w===void 0?!1:(Ct(w,d),!0)},getScrollAnchor:()=>Re.current?.getScrollAnchor()??null}),[Ct]);const ur=l.useCallback((s,d)=>{if(s.altKey||s.ctrlKey||s.metaKey)return;const w=Et.current,k=w.length-1;if(k<0)return;const z=w[d],J=z?.entry.children!==void 0,ke=J&&lr.current(z.entry.absolutePath);switch(s.key){case"ArrowDown":s.preventDefault(),xe(Math.min(d+1,k));break;case"ArrowUp":s.preventDefault(),xe(Math.max(d-1,0));break;case"Home":s.preventDefault(),xe(0);break;case"End":s.preventDefault(),xe(k);break;case"ArrowRight":s.preventDefault(),J&&!ke?Rt.current(z.entry.absolutePath):J&&d<k&&w[d+1].depth>z.depth&&xe(d+1);break;case"ArrowLeft":{if(s.preventDefault(),J&&ke){Rt.current(z.entry.absolutePath);break}const un=z?.depth??0;for(let dt=d-1;dt>=0;dt--)if(w[dt].depth<un){xe(dt);break}break}}},[xe]),lt=l.useMemo(()=>pe===null||St.length===0?{segmentsByItem:[],glyphsByItem:[]}:Ro(St,_e,je,pe),[St,_e,je,pe]),it=l.useMemo(()=>pe===null||e.length===0?0:pe.originX+rr*pe.indentSize+ce+pe.typeIconSize,[e.length,rr,pe]),{renderStart:fr,renderEnd:hr,lookaheadEnd:mr}=l.useMemo(()=>Eo(V.length,$e,Oe,et,tt,je),[V.length,$e,Oe,et,tt,je]),Tt=l.useMemo(()=>pe===null||it<=0||$e<=0||lt.segmentsByItem.length===0?null:h.jsx("div",{className:"pointer-events-none absolute inset-0 z-1","aria-hidden":"true",children:h.jsx("div",{className:"absolute top-0 left-0",style:{width:it,height:$e},children:h.jsx(Qr,{segmentsByItem:lt.segmentsByItem,glyphsByItem:lt.glyphsByItem,itemHeight:_e[0]??_t,width:it,viewportHeight:$e,scrollPosition:tt,color:$,expandGlyphColor:$,expandGlyphSize:pe.glyphSize,renderStartIndex:fr,renderEndIndex:hr,lookaheadEndIndex:mr})})}),[it,$e,fr,hr,mr,tt,lt,$,pe,_e]),pr=l.useCallback(s=>V[s],[V]),yr=l.useRef(null);l.useLayoutEffect(()=>{const s=yr.current;if(yr.current={items:V,offsets:je},!Kt||!s||s.items===V)return;const d=Re.current,w=d?.getScrollPosition(),k=typeof w=="number"&&w>=0?w:yt.current,z=no(s.items,s.offsets,k);if(!z)return;const J=oo(z,V,je);if(J===null||Math.abs(J-k)<1)return;const ke=d?d.scrollTo(J):J;yt.current=ke,qt(ke)},[V,je,Kt]);const Ne=C?.columns,Be=C?.scrollBarWidth??mt?.width??Ur,te=l.useMemo(()=>Ne?Gn({measuredWidth:Qe,columns:Ne,scrollBarWidth:Be}):null,[Ne,Qe,Be]),ct=l.useMemo(()=>Ne?Yn(Ne):"",[Ne]),an=l.useMemo(()=>C?.showFooter&&Ne?Vn(e):[],[C?.showFooter,Ne,e]),He=te?.maxHScroll??0;l.useEffect(()=>{Ve(s=>Nt(s,He))},[He]);const gr=l.useCallback(s=>Ve(d=>Nt(d+s,He)),[He]),br=l.useMemo(()=>({iconOverrides:D,showExpandIcons:P,showDirectoryIcons:b,showFileIcons:M,useCanvasExpandIcons:N,expandIconSize:O,typeIconSize:Q.typeIconSize,fontSize:Q.fontSize,indentSize:Q.indentSize,highlightStyles:B,expandIconClassName:I,expandIconStyle:R}),[D,P,b,M,N,O,Q,B,I,R]),Sr=l.useMemo(()=>h.jsx(ye.VirtualScroll,{ref:Re,itemCount:V.length,getItem:pr,getItemHeight:nr,getItemKey:or,testId:Xt,contentProps:Ut,locale:j,labels:U,viewportSize:typeof ae=="number"?ae:void 0,overscanCount:Oe,onScroll:Zt,onRangeChange:Qt,onScrollAdjust:Ft,liveRegion:zt,className:Te,onWheelHorizontal:se?gr:void 0,background:h.jsxs(h.Fragment,{children:[se&&te?h.jsx("div",{className:"pointer-events-none absolute top-0 left-0 z-1 h-full overflow-hidden",style:{width:te.nameWidth},"aria-hidden":"true",children:Tt}):Tt,ee]}),initialScrollIndex:Bt,initialScrollOffset:De,initialScrollAnchor:Ht,callbackThrottleMs:Wt,contentInsets:Yt,scrollBarOptions:mt,behaviorOptions:Jt,children:(s,d)=>s?se&&C&&te?h.jsx(Vr,{entry:s.entry,indentLevel:s.indentLevel,positionInSet:s.positionInSet,setSize:s.setSize,rowIndex:d+(C.showHeader??!0?2:1),flatIndex:d,onRowFocus:kt,onRowBlur:It,isSelectedForAria:!!_?.has(s.entry.absolutePath),rowHeight:s.rowHeight,isDirOpen:ve,columns:C.columns,numericTemplate:ct,numericTotal:te.numericTotal,nameWidth:te.nameWidth,rowClassName:C.rowClassName,selection:{onEntryClick:m,selectedPath:Fe,currentPath:vt,mode:x,selectedItems:_,onSelectionChange:p},expansion:{toggleDirectory:t,onToggleDirectoryRecursive:gt},visual:br},s.entry.absolutePath):h.jsx(en,{entry:s.entry,indentLevel:s.indentLevel,originX:rt,depth:s.depth,positionInSet:s.positionInSet,setSize:s.setSize,isSelectedForAria:!!_?.has(s.entry.absolutePath),flatIndex:d,isActive:d===ze,registerRowRef:dr,onNavigationKeyDown:ur,onRowFocus:kt,onRowBlur:It,rowHeight:s.rowHeight,entryKindDirectory:Me,entryKindFile:ne,isDirOpen:ve,expansion:{toggleDirectory:t,onToggleDirectoryRecursive:gt},selection:{onEntryClick:m,selectedPath:Fe,currentPath:vt,mode:x,selectedItems:_,onSelectionChange:p},visual:{iconOverrides:D,showExpandIcons:P,showDirectoryIcons:b,showFileIcons:M,useCanvasExpandIcons:N,expandIconSize:O,typeIconSize:Q.typeIconSize,fontSize:Q.fontSize,indentSize:Q.indentSize,highlightStyles:B,entryClassName:re,entryStyle:he,nameClassName:Y,nameStyle:G,directoryNameClassName:we,directoryNameStyle:ge,fileNameClassName:o,fileNameStyle:f,expandIconClassName:I,expandIconStyle:R}},s.entry.absolutePath):null}),[V.length,pr,nr,or,Xt,Ut,j,U,Me,ne,ze,dr,ur,kt,It,ae,Oe,Zt,Qt,Ft,zt,Te,se,gr,te,Tt,ee,Bt,De,Ht,Wt,Yt,mt,Jt,C,ct,ve,m,Fe,vt,x,_,p,t,gt,br,D,P,b,M,N,O,Q,rt,B,re,he,Y,G,we,ge,o,f,I,R]);if(!(C&&te))return h.jsxs("div",{ref:Ee,className:er,style:tr,onPointerDownCapture:at,onMouseDownCapture:at,children:[Le.length>0&&!on&&h.jsx("span",{tabIndex:0,"data-directory-tree-tab-stop":"",style:vo,onFocus:sn}),Sr]});const ln=C.showHeader??!0,cn=C.showFooter??!1,dn={...tr,"--dt-hscroll":`${Ge}px`};return h.jsxs("div",{ref:Ee,className:K.twMerge(er,"dt-grid"),style:dn,role:"treegrid","aria-label":v?void 0:E,"aria-labelledby":v,"aria-multiselectable":x==="multiple"?!0:void 0,"aria-busy":i?!0:void 0,"aria-rowcount":V.length+(C.showHeader??!0?1:0),onPointerDownCapture:at,onMouseDownCapture:at,children:[ln&&h.jsx("div",{role:"rowgroup",children:h.jsx(Bn,{columns:C.columns,numericTemplate:ct,numericTotal:te.numericTotal,nameWidth:te.nameWidth,scrollBarWidth:Be,className:C.headerClassName})}),h.jsx("div",{ref:Pe,className:"dt-grid-body",children:Sr}),He>0&&h.jsxs("div",{className:"dt-grid-hscrollbar-row",children:[h.jsx("div",{className:"dt-grid-scrollbar-spacer",style:{width:te.nameWidth},"aria-hidden":"true"}),h.jsx(ye.ScrollBar,{horizontal:!0,contentSize:te.numericTotal,viewportSize:te.numericVisible,scrollPosition:Ge,scrollBarWidth:Be,locale:j,labels:U,onScroll:s=>{const d=typeof s=="function"?s(Ge):s,w=Nt(d,He);return Ve(w),w}}),h.jsx("div",{className:"dt-grid-scrollbar-spacer",style:{width:Be},"aria-hidden":"true"})]}),cn&&h.jsx("div",{role:"rowgroup",children:h.jsx(Hn,{columns:C.columns,numericTemplate:ct,numericTotal:te.numericTotal,nameWidth:te.nameWidth,scrollBarWidth:Be,allEntries:an,className:C.footerClassName})})]})},ko=({initialExpanded:e=new Set,storageKey:t}={})=>{const[r,n]=l.useTransition(),[a,i]=l.useState(()=>{if(typeof window<"u"&&t)try{const y=window.localStorage.getItem(t);if(y){const E=JSON.parse(y);return new Set(E)}}catch(y){console.error("[useDirectoryTreeState] Error reading from localStorage",y)}return e}),c=l.useCallback(y=>{n(()=>{i(E=>{const v=new Set(E);return y(v),v})})},[]),u=l.useCallback((y,E)=>{c(v=>{for(const $ of y)E(v,$)})},[c]);l.useEffect(()=>{if(t&&typeof window<"u")try{window.localStorage.setItem(t,JSON.stringify(Array.from(a)))}catch(y){console.warn(`Error setting localStorage key "${t}":`,y)}},[a,t]);const m=l.useCallback(y=>{u([y],(E,v)=>{E.has(v)?E.delete(v):E.add(v)})},[u]),S=l.useCallback(y=>{u([y],(E,v)=>{E.add(v)})},[u]),T=l.useCallback(y=>{u([y],(E,v)=>{E.delete(v)})},[u]),x=l.useCallback(y=>{u(y,(E,v)=>{E.delete(v)})},[u]),_=l.useCallback(y=>{u(y,(E,v)=>{E.add(v)})},[u]),p=l.useCallback(()=>{c(y=>{y.clear()})},[c]),g=l.useCallback(y=>a.has(y),[a]);return{expanded:a,toggle:m,expand:S,collapse:T,collapseMultiple:x,expandMultiple:_,collapseAll:p,isExpanded:g,isPending:r}};exports.DIRECTORY_TREE_LABEL_CATALOGS=qr;exports.DIRECTORY_TREE_LABEL_KEYS=Lt;exports.DirectoryTree=xo;exports.EXPAND_ICON_STYLE_PROPERTIES=Br;exports.FILE_ICON_PAIRS=En;exports.MARK_PAIRS=Or;exports.ROW_STYLE_PROPERTIES=zr;exports.directoryTreeClasses=A;exports.resolveDirectoryTreeLabels=Zr;exports.useDirectoryTreeState=ko;