@valikwp/react-file-manager
Version:
React File Manager is an open-source, user-friendly component designed to easily manage files and folders within applications. With smooth drag-and-drop functionality, responsive design, and efficient navigation, it simplifies file handling in any React p
1,063 lines (1,061 loc) • 131 kB
JavaScript
import * as we from "react";
import de, { useState as L, useRef as te, useEffect as K, createContext as Ee, useContext as Pe, useLayoutEffect as pn, useCallback as zt, useMemo as Ge } from "react";
function mn(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var Ue = { exports: {} }, Ce = {};
/**
* @license React
* react-jsx-runtime.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var rt;
function vn() {
if (rt)
return Ce;
rt = 1;
var e = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
function r(s, 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: s,
key: c,
ref: a !== void 0 ? a : null,
props: i
};
}
return Ce.Fragment = n, Ce.jsx = r, Ce.jsxs = r, Ce;
}
var be = {};
/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var st;
function gn() {
return st || (st = 1, process.env.NODE_ENV !== "production" && function() {
function e(o) {
if (o == null)
return null;
if (typeof o == "function")
return o.$$typeof === R ? null : o.displayName || o.name || null;
if (typeof o == "string")
return o;
switch (o) {
case N:
return "Fragment";
case x:
return "Profiler";
case _:
return "StrictMode";
case l:
return "Suspense";
case v:
return "SuspenseList";
case y:
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 E:
return "Portal";
case F:
return (o.displayName || "Context") + ".Provider";
case I:
return (o._context.displayName || "Context") + ".Consumer";
case w:
var h = o.render;
return o = o.displayName, o || (o = h.displayName || h.name || "", o = o !== "" ? "ForwardRef(" + o + ")" : "ForwardRef"), o;
case P:
return h = o.displayName || null, h !== null ? h : e(o.type) || "Memo";
case g:
h = o._payload, o = o._init;
try {
return e(o(h));
} catch {
}
}
return null;
}
function n(o) {
return "" + o;
}
function r(o) {
try {
n(o);
var h = !1;
} catch {
h = !0;
}
if (h) {
h = console;
var T = h.error, k = typeof Symbol == "function" && Symbol.toStringTag && o[Symbol.toStringTag] || o.constructor.name || "Object";
return T.call(
h,
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
k
), n(o);
}
}
function s(o) {
if (o === N)
return "<>";
if (typeof o == "object" && o !== null && o.$$typeof === g)
return "<...>";
try {
var h = e(o);
return h ? "<" + h + ">" : "<...>";
} catch {
return "<...>";
}
}
function a() {
var o = z.A;
return o === null ? null : o.getOwner();
}
function i() {
return Error("react-stack-top-frame");
}
function c(o) {
if (M.call(o, "key")) {
var h = Object.getOwnPropertyDescriptor(o, "key").get;
if (h && h.isReactWarning)
return !1;
}
return o.key !== void 0;
}
function u(o, h) {
function T() {
ee || (ee = !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)",
h
));
}
T.isReactWarning = !0, Object.defineProperty(o, "key", {
get: T,
configurable: !0
});
}
function d() {
var o = e(this.type);
return J[o] || (J[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 p(o, h, T, k, O, $, S, B) {
return T = $.ref, o = {
$$typeof: j,
type: o,
key: h,
props: $,
_owner: O
}, (T !== void 0 ? T : null) !== null ? Object.defineProperty(o, "ref", {
enumerable: !1,
get: d
}) : 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: S
}), Object.defineProperty(o, "_debugTask", {
configurable: !1,
enumerable: !1,
writable: !0,
value: B
}), Object.freeze && (Object.freeze(o.props), Object.freeze(o)), o;
}
function f(o, h, T, k, O, $, S, B) {
var A = h.children;
if (A !== void 0)
if (k)
if (D(A)) {
for (k = 0; k < A.length; k++)
m(A[k]);
Object.freeze && Object.freeze(A);
} 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
m(A);
if (M.call(h, "key")) {
A = e(o);
var Y = Object.keys(h).filter(function(ne) {
return ne !== "key";
});
k = 0 < Y.length ? "{key: someKey, " + Y.join(": ..., ") + ": ...}" : "{key: someKey}", se[A + k] || (Y = 0 < Y.length ? "{" + Y.join(": ..., ") + ": ...}" : "{}", console.error(
`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`,
k,
A,
Y,
A
), se[A + k] = !0);
}
if (A = null, T !== void 0 && (r(T), A = "" + T), c(h) && (r(h.key), A = "" + h.key), "key" in h) {
T = {};
for (var W in h)
W !== "key" && (T[W] = h[W]);
} else
T = h;
return A && u(
T,
typeof o == "function" ? o.displayName || o.name || "Unknown" : o
), p(
o,
A,
$,
O,
a(),
T,
S,
B
);
}
function m(o) {
typeof o == "object" && o !== null && o.$$typeof === j && o._store && (o._store.validated = 1);
}
var b = de, j = Symbol.for("react.transitional.element"), E = Symbol.for("react.portal"), N = Symbol.for("react.fragment"), _ = Symbol.for("react.strict_mode"), x = Symbol.for("react.profiler"), I = Symbol.for("react.consumer"), F = Symbol.for("react.context"), w = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), v = Symbol.for("react.suspense_list"), P = Symbol.for("react.memo"), g = Symbol.for("react.lazy"), y = Symbol.for("react.activity"), R = Symbol.for("react.client.reference"), z = b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, M = Object.prototype.hasOwnProperty, D = Array.isArray, q = console.createTask ? console.createTask : function() {
return null;
};
b = {
"react-stack-bottom-frame": function(o) {
return o();
}
};
var ee, J = {}, Q = b["react-stack-bottom-frame"].bind(
b,
i
)(), X = q(s(i)), se = {};
be.Fragment = N, be.jsx = function(o, h, T, k, O) {
var $ = 1e4 > z.recentlyCreatedOwnerStacks++;
return f(
o,
h,
T,
!1,
k,
O,
$ ? Error("react-stack-top-frame") : Q,
$ ? q(s(o)) : X
);
}, be.jsxs = function(o, h, T, k, O) {
var $ = 1e4 > z.recentlyCreatedOwnerStacks++;
return f(
o,
h,
T,
!0,
k,
O,
$ ? Error("react-stack-top-frame") : Q,
$ ? q(s(o)) : X
);
};
}()), be;
}
process.env.NODE_ENV === "production" ? Ue.exports = vn() : Ue.exports = gn();
var t = Ue.exports, At = {
color: void 0,
size: void 0,
className: void 0,
style: void 0,
attr: void 0
}, ot = de.createContext && /* @__PURE__ */ de.createContext(At), yn = ["attr", "size", "title"];
function xn(e, n) {
if (e == null)
return {};
var r = jn(e, n), s, a;
if (Object.getOwnPropertySymbols) {
var i = Object.getOwnPropertySymbols(e);
for (a = 0; a < i.length; a++)
s = i[a], !(n.indexOf(s) >= 0) && Object.prototype.propertyIsEnumerable.call(e, s) && (r[s] = e[s]);
}
return r;
}
function jn(e, n) {
if (e == null)
return {};
var r = {};
for (var s in e)
if (Object.prototype.hasOwnProperty.call(e, s)) {
if (n.indexOf(s) >= 0)
continue;
r[s] = e[s];
}
return r;
}
function Fe() {
return Fe = Object.assign ? Object.assign.bind() : function(e) {
for (var n = 1; n < arguments.length; n++) {
var r = arguments[n];
for (var s in r)
Object.prototype.hasOwnProperty.call(r, s) && (e[s] = r[s]);
}
return e;
}, Fe.apply(this, arguments);
}
function at(e, n) {
var r = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var s = Object.getOwnPropertySymbols(e);
n && (s = s.filter(function(a) {
return Object.getOwnPropertyDescriptor(e, a).enumerable;
})), r.push.apply(r, s);
}
return r;
}
function Le(e) {
for (var n = 1; n < arguments.length; n++) {
var r = arguments[n] != null ? arguments[n] : {};
n % 2 ? at(Object(r), !0).forEach(function(s) {
Cn(e, s, r[s]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : at(Object(r)).forEach(function(s) {
Object.defineProperty(e, s, Object.getOwnPropertyDescriptor(r, s));
});
}
return e;
}
function Cn(e, n, r) {
return n = bn(n), n in e ? Object.defineProperty(e, n, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[n] = r, e;
}
function bn(e) {
var n = wn(e, "string");
return typeof n == "symbol" ? n : n + "";
}
function wn(e, n) {
if (typeof e != "object" || !e)
return e;
var r = e[Symbol.toPrimitive];
if (r !== void 0) {
var s = r.call(e, n);
if (typeof s != "object")
return s;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (n === "string" ? String : Number)(e);
}
function _t(e) {
return e && e.map((n, r) => /* @__PURE__ */ de.createElement(n.tag, Le({
key: r
}, n.attr), _t(n.child)));
}
function H(e) {
return (n) => /* @__PURE__ */ de.createElement(En, Fe({
attr: Le({}, e.attr)
}, n), _t(e.child));
}
function En(e) {
var n = (r) => {
var {
attr: s,
size: a,
title: i
} = e, c = xn(e, yn), u = a || r.size || "1em", d;
return r.className && (d = r.className), e.className && (d = (d ? d + " " : "") + e.className), /* @__PURE__ */ de.createElement("svg", Fe({
stroke: "currentColor",
fill: "currentColor",
strokeWidth: "0"
}, r.attr, s, c, {
className: d,
style: Le(Le({
color: e.color || r.color
}, r.style), e.style),
height: u,
width: u,
xmlns: "http://www.w3.org/2000/svg"
}), i && /* @__PURE__ */ de.createElement("title", null, i), e.children);
};
return ot !== void 0 ? /* @__PURE__ */ de.createElement(ot.Consumer, null, (r) => n(r)) : n(At);
}
function Pn(e) {
return H({ attr: { version: "1.1", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { d: "M16 8c-0.020-1.045-0.247-2.086-0.665-3.038-0.417-0.953-1.023-1.817-1.766-2.53s-1.624-1.278-2.578-1.651c-0.953-0.374-1.978-0.552-2.991-0.531-1.013 0.020-2.021 0.24-2.943 0.646-0.923 0.405-1.758 0.992-2.449 1.712s-1.237 1.574-1.597 2.497c-0.361 0.923-0.533 1.914-0.512 2.895 0.020 0.981 0.234 1.955 0.627 2.847 0.392 0.892 0.961 1.7 1.658 2.368s1.523 1.195 2.416 1.543c0.892 0.348 1.851 0.514 2.799 0.493 0.949-0.020 1.89-0.227 2.751-0.608 0.862-0.379 1.642-0.929 2.287-1.604s1.154-1.472 1.488-2.335c0.204-0.523 0.342-1.069 0.415-1.622 0.019 0.001 0.039 0.002 0.059 0.002 0.552 0 1-0.448 1-1 0-0.028-0.001-0.056-0.004-0.083h0.004zM14.411 10.655c-0.367 0.831-0.898 1.584-1.55 2.206s-1.422 1.112-2.254 1.434c-0.832 0.323-1.723 0.476-2.608 0.454-0.884-0.020-1.759-0.215-2.56-0.57-0.801-0.354-1.526-0.867-2.125-1.495s-1.071-1.371-1.38-2.173c-0.31-0.801-0.457-1.66-0.435-2.512s0.208-1.694 0.551-2.464c0.342-0.77 0.836-1.468 1.441-2.044s1.321-1.029 2.092-1.326c0.771-0.298 1.596-0.438 2.416-0.416s1.629 0.202 2.368 0.532c0.74 0.329 1.41 0.805 1.963 1.387s0.988 1.27 1.272 2.011c0.285 0.74 0.418 1.532 0.397 2.32h0.004c-0.002 0.027-0.004 0.055-0.004 0.083 0 0.516 0.39 0.94 0.892 0.994-0.097 0.544-0.258 1.075-0.481 1.578z" }, child: [] }] })(e);
}
const Ze = ({ loading: e = !1, className: n }) => e ? /* @__PURE__ */ t.jsx("div", { className: `loader-container ${n}`, children: /* @__PURE__ */ t.jsx(Pn, { className: "spinner" }) }) : null;
function Dt(e) {
return H({ attr: { fill: "currentColor", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { fillRule: "evenodd", d: "M4 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2zm2-1a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1zM2 5a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-1h1v1a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h1v1z" }, child: [] }] })(e);
}
function It(e) {
return H({ attr: { fill: "currentColor", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { d: "m.5 3 .04.87a2 2 0 0 0-.342 1.311l.637 7A2 2 0 0 0 2.826 14H9v-1H2.826a1 1 0 0 1-.995-.91l-.637-7A1 1 0 0 1 2.19 4h11.62a1 1 0 0 1 .996 1.09L14.54 8h1.005l.256-2.819A2 2 0 0 0 13.81 3H9.828a2 2 0 0 1-1.414-.586l-.828-.828A2 2 0 0 0 6.172 1H2.5a2 2 0 0 0-2 2m5.672-1a1 1 0 0 1 .707.293L7.586 3H2.19q-.362.002-.683.12L1.5 2.98a1 1 0 0 1 1-.98z" }, child: [] }, { tag: "path", attr: { d: "M13.5 9a.5.5 0 0 1 .5.5V11h1.5a.5.5 0 1 1 0 1H14v1.5a.5.5 0 1 1-1 0V12h-1.5a.5.5 0 0 1 0-1H13V9.5a.5.5 0 0 1 .5-.5" }, child: [] }] })(e);
}
function $t(e) {
return H({ attr: { fill: "currentColor", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { d: "M1 2.5A1.5 1.5 0 0 1 2.5 1h3A1.5 1.5 0 0 1 7 2.5v3A1.5 1.5 0 0 1 5.5 7h-3A1.5 1.5 0 0 1 1 5.5zm8 0A1.5 1.5 0 0 1 10.5 1h3A1.5 1.5 0 0 1 15 2.5v3A1.5 1.5 0 0 1 13.5 7h-3A1.5 1.5 0 0 1 9 5.5zm-8 8A1.5 1.5 0 0 1 2.5 9h3A1.5 1.5 0 0 1 7 10.5v3A1.5 1.5 0 0 1 5.5 15h-3A1.5 1.5 0 0 1 1 13.5zm8 0A1.5 1.5 0 0 1 10.5 9h3a1.5 1.5 0 0 1 1.5 1.5v3a1.5 1.5 0 0 1-1.5 1.5h-3A1.5 1.5 0 0 1 9 13.5z" }, child: [] }] })(e);
}
function it(e) {
return H({ attr: { fill: "currentColor", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { d: "M1 2.5A1.5 1.5 0 0 1 2.5 1h3A1.5 1.5 0 0 1 7 2.5v3A1.5 1.5 0 0 1 5.5 7h-3A1.5 1.5 0 0 1 1 5.5zM2.5 2a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h3a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5zm6.5.5A1.5 1.5 0 0 1 10.5 1h3A1.5 1.5 0 0 1 15 2.5v3A1.5 1.5 0 0 1 13.5 7h-3A1.5 1.5 0 0 1 9 5.5zm1.5-.5a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h3a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5zM1 10.5A1.5 1.5 0 0 1 2.5 9h3A1.5 1.5 0 0 1 7 10.5v3A1.5 1.5 0 0 1 5.5 15h-3A1.5 1.5 0 0 1 1 13.5zm1.5-.5a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h3a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5zm6.5.5A1.5 1.5 0 0 1 10.5 9h3a1.5 1.5 0 0 1 1.5 1.5v3a1.5 1.5 0 0 1-1.5 1.5h-3A1.5 1.5 0 0 1 9 13.5zm1.5-.5a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h3a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5z" }, child: [] }] })(e);
}
function Bt(e) {
return H({ attr: { fill: "currentColor", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { d: "M3.5 3.5c-.614-.884-.074-1.962.858-2.5L8 7.226 11.642 1c.932.538 1.472 1.616.858 2.5L8.81 8.61l1.556 2.661a2.5 2.5 0 1 1-.794.637L8 9.73l-1.572 2.177a2.5 2.5 0 1 1-.794-.637L7.19 8.61zm2.5 10a1.5 1.5 0 1 0-3 0 1.5 1.5 0 0 0 3 0m7 0a1.5 1.5 0 1 0-3 0 1.5 1.5 0 0 0 3 0" }, child: [] }] })(e);
}
function Ht(e) {
return H({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "polyline", attr: { points: "23 4 23 10 17 10" }, child: [] }, { tag: "polyline", attr: { points: "1 20 1 14 7 14" }, child: [] }, { tag: "path", attr: { d: "M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15" }, child: [] }] })(e);
}
function Rn(e) {
return H({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z" }, child: [] }] })(e);
}
function Tn(e) {
return H({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }, child: [] }] })(e);
}
function Fn(e) {
return H({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0V0z" }, child: [] }, { tag: "path", attr: { d: "M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z" }, child: [] }] })(e);
}
function Ln(e) {
return H({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }, child: [] }] })(e);
}
function Mn(e) {
return H({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" }, child: [] }] })(e);
}
function Wt(e) {
return H({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0V0z" }, child: [] }, { tag: "path", attr: { d: "M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z" }, child: [] }] })(e);
}
function Je(e) {
return H({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3h-2zm-1-4-1.41-1.41L13 12.17V4h-2v8.17L8.41 9.59 7 11l5 5 5-5z" }, child: [] }] })(e);
}
function Vt(e) {
return H({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3h-2zM7 9l1.41 1.41L11 7.83V16h2V7.83l2.59 2.58L17 9l-5-5-5 5z" }, child: [] }] })(e);
}
function Sn(e) {
return H({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0V0z" }, child: [] }, { tag: "path", attr: { d: "M10.02 6 8.61 7.41 13.19 12l-4.58 4.59L10.02 18l6-6-6-6z" }, child: [] }] })(e);
}
function Yt(e) {
return H({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M20.005 5.995h-1v2h1v8h-1v2h1c1.103 0 2-.897 2-2v-8c0-1.102-.898-2-2-2zm-14 4H15v4H6.005z" }, child: [] }, { tag: "path", attr: { d: "M17.005 17.995V4H20V2h-8v2h3.005v1.995h-11c-1.103 0-2 .897-2 2v8c0 1.103.897 2 2 2h11V20H12v2h8v-2h-2.995v-2.005zm-13-2v-8h11v8h-11z" }, child: [] }] })(e);
}
function kn(e) {
return H({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M20 2H8c-1.103 0-2 .897-2 2v12c0 1.103.897 2 2 2h12c1.103 0 2-.897 2-2V4c0-1.103-.897-2-2-2zM8 16V4h12l.002 12H8z" }, child: [] }, { tag: "path", attr: { d: "M4 8H2v12c0 1.103.897 2 2 2h12v-2H4V8zm8.933 3.519-1.726-1.726-1.414 1.414 3.274 3.274 5.702-6.84-1.538-1.282z" }, child: [] }] })(e);
}
function qt(e) {
return H({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z" }, child: [] }] })(e);
}
function Nn(e) {
return H({ attr: { viewBox: "0 0 320 512" }, child: [{ tag: "path", attr: { d: "M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z" }, child: [] }] })(e);
}
function On(e) {
return H({ attr: { viewBox: "0 0 640 512" }, child: [{ tag: "path", attr: { d: "M128 0C92.7 0 64 28.7 64 64l0 224-44.8 0C8.6 288 0 296.6 0 307.2C0 349.6 34.4 384 76.8 384L320 384l0-96-192 0 0-224 320 0 0 32 64 0 0-32c0-35.3-28.7-64-64-64L128 0zM512 128l-112 0c-26.5 0-48 21.5-48 48l0 288c0 26.5 21.5 48 48 48l192 0c26.5 0 48-21.5 48-48l0-208-96 0c-17.7 0-32-14.3-32-32l0-96zm32 0l0 96 96 0-96-96z" }, child: [] }] })(e);
}
function Me(e) {
return H({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M64 144a48 48 0 1 0 0-96 48 48 0 1 0 0 96zM192 64c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L192 64zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zM64 464a48 48 0 1 0 0-96 48 48 0 1 0 0 96zm48-208a48 48 0 1 0 -96 0 48 48 0 1 0 96 0z" }, child: [] }] })(e);
}
function ct(e) {
return H({ attr: { viewBox: "0 0 384 512" }, child: [{ tag: "path", attr: { d: "M64 464l256 0c8.8 0 16-7.2 16-16l0-288-80 0c-17.7 0-32-14.3-32-32l0-80L64 48c-8.8 0-16 7.2-16 16l0 384c0 8.8 7.2 16 16 16zM0 64C0 28.7 28.7 0 64 0L229.5 0c17 0 33.3 6.7 45.3 18.7l90.5 90.5c12 12 18.7 28.3 18.7 45.3L384 448c0 35.3-28.7 64-64 64L64 512c-35.3 0-64-28.7-64-64L0 64zM192 272l0 128c0 6.5-3.9 12.3-9.9 14.8s-12.9 1.1-17.4-3.5L129.4 376 112 376c-8.8 0-16-7.2-16-16l0-48c0-8.8 7.2-16 16-16l17.4 0 35.3-35.3c4.6-4.6 11.5-5.9 17.4-3.5s9.9 8.3 9.9 14.8zm85.8-4c11.6 20 18.2 43.3 18.2 68s-6.6 48-18.2 68c-6.6 11.5-21.3 15.4-32.8 8.8s-15.4-21.3-8.8-32.8c7.5-12.9 11.8-27.9 11.8-44s-4.3-31.1-11.8-44c-6.6-11.5-2.7-26.2 8.8-32.8s26.2-2.7 32.8 8.8z" }, child: [] }] })(e);
}
function re(e) {
return H({ attr: { viewBox: "0 0 384 512" }, child: [{ tag: "path", attr: { d: "M64 464c-8.8 0-16-7.2-16-16L48 64c0-8.8 7.2-16 16-16l160 0 0 80c0 17.7 14.3 32 32 32l80 0 0 288c0 8.8-7.2 16-16 16L64 464zM64 0C28.7 0 0 28.7 0 64L0 448c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-293.5c0-17-6.7-33.3-18.7-45.3L274.7 18.7C262.7 6.7 246.5 0 229.5 0L64 0zm97 289c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0L79 303c-9.4 9.4-9.4 24.6 0 33.9l48 48c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-31-31 31-31zM257 255c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l31 31-31 31c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l48-48c9.4-9.4 9.4-24.6 0-33.9l-48-48z" }, child: [] }] })(e);
}
function lt(e) {
return H({ attr: { viewBox: "0 0 384 512" }, child: [{ tag: "path", attr: { d: "M48 448L48 64c0-8.8 7.2-16 16-16l160 0 0 80c0 17.7 14.3 32 32 32l80 0 0 288c0 8.8-7.2 16-16 16L64 464c-8.8 0-16-7.2-16-16zM64 0C28.7 0 0 28.7 0 64L0 448c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-293.5c0-17-6.7-33.3-18.7-45.3L274.7 18.7C262.7 6.7 246.5 0 229.5 0L64 0zm90.9 233.3c-8.1-10.5-23.2-12.3-33.7-4.2s-12.3 23.2-4.2 33.7L161.6 320l-44.5 57.3c-8.1 10.5-6.3 25.5 4.2 33.7s25.5 6.3 33.7-4.2L192 359.1l37.1 47.6c8.1 10.5 23.2 12.3 33.7 4.2s12.3-23.2 4.2-33.7L222.4 320l44.5-57.3c8.1-10.5 6.3-25.5-4.2-33.7s-25.5-6.3-33.7 4.2L192 280.9l-37.1-47.6z" }, child: [] }] })(e);
}
function _e(e) {
return H({ attr: { viewBox: "0 0 384 512" }, child: [{ tag: "path", attr: { d: "M64 464c-8.8 0-16-7.2-16-16L48 64c0-8.8 7.2-16 16-16l160 0 0 80c0 17.7 14.3 32 32 32l80 0 0 288c0 8.8-7.2 16-16 16L64 464zM64 0C28.7 0 0 28.7 0 64L0 448c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-293.5c0-17-6.7-33.3-18.7-45.3L274.7 18.7C262.7 6.7 246.5 0 229.5 0L64 0zm96 256a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zm69.2 46.9c-3-4.3-7.9-6.9-13.2-6.9s-10.2 2.6-13.2 6.9l-41.3 59.7-11.9-19.1c-2.9-4.7-8.1-7.5-13.6-7.5s-10.6 2.8-13.6 7.5l-40 64c-3.1 4.9-3.2 11.1-.4 16.2s8.2 8.2 14 8.2l48 0 32 0 40 0 72 0c6 0 11.4-3.3 14.2-8.6s2.4-11.6-1-16.5l-72-104z" }, child: [] }] })(e);
}
function zn(e) {
return H({ attr: { viewBox: "0 0 384 512" }, child: [{ tag: "path", attr: { d: "M64 464c-8.8 0-16-7.2-16-16L48 64c0-8.8 7.2-16 16-16l160 0 0 80c0 17.7 14.3 32 32 32l80 0 0 288c0 8.8-7.2 16-16 16L64 464zM64 0C28.7 0 0 28.7 0 64L0 448c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-293.5c0-17-6.7-33.3-18.7-45.3L274.7 18.7C262.7 6.7 246.5 0 229.5 0L64 0zm56 256c-13.3 0-24 10.7-24 24s10.7 24 24 24l144 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-144 0zm0 96c-13.3 0-24 10.7-24 24s10.7 24 24 24l144 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-144 0z" }, child: [] }] })(e);
}
function An(e) {
return H({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M64 464l48 0 0 48-48 0c-35.3 0-64-28.7-64-64L0 64C0 28.7 28.7 0 64 0L229.5 0c17 0 33.3 6.7 45.3 18.7l90.5 90.5c12 12 18.7 28.3 18.7 45.3L384 304l-48 0 0-144-80 0c-17.7 0-32-14.3-32-32l0-80L64 48c-8.8 0-16 7.2-16 16l0 384c0 8.8 7.2 16 16 16zM176 352l32 0c30.9 0 56 25.1 56 56s-25.1 56-56 56l-16 0 0 32c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-48 0-80c0-8.8 7.2-16 16-16zm32 80c13.3 0 24-10.7 24-24s-10.7-24-24-24l-16 0 0 48 16 0zm96-80l32 0c26.5 0 48 21.5 48 48l0 64c0 26.5-21.5 48-48 48l-32 0c-8.8 0-16-7.2-16-16l0-128c0-8.8 7.2-16 16-16zm32 128c8.8 0 16-7.2 16-16l0-64c0-8.8-7.2-16-16-16l-16 0 0 96 16 0zm80-112c0-8.8 7.2-16 16-16l48 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-32 0 0 32 32 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-32 0 0 48c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-64 0-64z" }, child: [] }] })(e);
}
function ut(e) {
return H({ attr: { viewBox: "0 0 384 512" }, child: [{ tag: "path", attr: { d: "M64 464c-8.8 0-16-7.2-16-16L48 64c0-8.8 7.2-16 16-16l160 0 0 80c0 17.7 14.3 32 32 32l80 0 0 288c0 8.8-7.2 16-16 16L64 464zM64 0C28.7 0 0 28.7 0 64L0 448c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-293.5c0-17-6.7-33.3-18.7-45.3L274.7 18.7C262.7 6.7 246.5 0 229.5 0L64 0zm72 208c-13.3 0-24 10.7-24 24l0 104 0 56c0 13.3 10.7 24 24 24s24-10.7 24-24l0-32 44 0c42 0 76-34 76-76s-34-76-76-76l-68 0zm68 104l-44 0 0-56 44 0c15.5 0 28 12.5 28 28s-12.5 28-28 28z" }, child: [] }] })(e);
}
function dt(e) {
return H({ attr: { viewBox: "0 0 384 512" }, child: [{ tag: "path", attr: { d: "M320 464c8.8 0 16-7.2 16-16l0-288-80 0c-17.7 0-32-14.3-32-32l0-80L64 48c-8.8 0-16 7.2-16 16l0 384c0 8.8 7.2 16 16 16l256 0zM0 64C0 28.7 28.7 0 64 0L229.5 0c17 0 33.3 6.7 45.3 18.7l90.5 90.5c12 12 18.7 28.3 18.7 45.3L384 448c0 35.3-28.7 64-64 64L64 512c-35.3 0-64-28.7-64-64L0 64zM80 288c0-17.7 14.3-32 32-32l96 0c17.7 0 32 14.3 32 32l0 16 44.9-29.9c2-1.3 4.4-2.1 6.8-2.1c6.8 0 12.3 5.5 12.3 12.3l0 103.4c0 6.8-5.5 12.3-12.3 12.3c-2.4 0-4.8-.7-6.8-2.1L240 368l0 16c0 17.7-14.3 32-32 32l-96 0c-17.7 0-32-14.3-32-32l0-96z" }, child: [] }] })(e);
}
function ft(e) {
return H({ attr: { viewBox: "0 0 384 512" }, child: [{ tag: "path", attr: { d: "M48 448L48 64c0-8.8 7.2-16 16-16l160 0 0 80c0 17.7 14.3 32 32 32l80 0 0 288c0 8.8-7.2 16-16 16L64 464c-8.8 0-16-7.2-16-16zM64 0C28.7 0 0 28.7 0 64L0 448c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-293.5c0-17-6.7-33.3-18.7-45.3L274.7 18.7C262.7 6.7 246.5 0 229.5 0L64 0zm55 241.1c-3.8-12.7-17.2-19.9-29.9-16.1s-19.9 17.2-16.1 29.9l48 160c3 10.2 12.4 17.1 23 17.1s19.9-7 23-17.1l25-83.4 25 83.4c3 10.2 12.4 17.1 23 17.1s19.9-7 23-17.1l48-160c3.8-12.7-3.4-26.1-16.1-29.9s-26.1 3.4-29.9 16.1l-25 83.4-25-83.4c-3-10.2-12.4-17.1-23-17.1s-19.9 7-23 17.1l-25 83.4-25-83.4z" }, child: [] }] })(e);
}
function _n(e) {
return H({ attr: { viewBox: "0 0 384 512" }, child: [{ tag: "path", attr: { d: "M64 464c-8.8 0-16-7.2-16-16L48 64c0-8.8 7.2-16 16-16l48 0c0 8.8 7.2 16 16 16l32 0c8.8 0 16-7.2 16-16l48 0 0 80c0 17.7 14.3 32 32 32l80 0 0 288c0 8.8-7.2 16-16 16L64 464zM64 0C28.7 0 0 28.7 0 64L0 448c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-293.5c0-17-6.7-33.3-18.7-45.3L274.7 18.7C262.7 6.7 246.5 0 229.5 0L64 0zm48 112c0 8.8 7.2 16 16 16l32 0c8.8 0 16-7.2 16-16s-7.2-16-16-16l-32 0c-8.8 0-16 7.2-16 16zm0 64c0 8.8 7.2 16 16 16l32 0c8.8 0 16-7.2 16-16s-7.2-16-16-16l-32 0c-8.8 0-16 7.2-16 16zm-6.3 71.8L82.1 335.9c-1.4 5.4-2.1 10.9-2.1 16.4c0 35.2 28.8 63.7 64 63.7s64-28.5 64-63.7c0-5.5-.7-11.1-2.1-16.4l-23.5-88.2c-3.7-14-16.4-23.8-30.9-23.8l-14.8 0c-14.5 0-27.2 9.7-30.9 23.8zM128 336l32 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16s7.2-16 16-16z" }, child: [] }] })(e);
}
function Se(e) {
return H({ attr: { viewBox: "0 0 384 512" }, child: [{ tag: "path", attr: { d: "M320 464c8.8 0 16-7.2 16-16l0-288-80 0c-17.7 0-32-14.3-32-32l0-80L64 48c-8.8 0-16 7.2-16 16l0 384c0 8.8 7.2 16 16 16l256 0zM0 64C0 28.7 28.7 0 64 0L229.5 0c17 0 33.3 6.7 45.3 18.7l90.5 90.5c12 12 18.7 28.3 18.7 45.3L384 448c0 35.3-28.7 64-64 64L64 512c-35.3 0-64-28.7-64-64L0 64z" }, child: [] }] })(e);
}
function ht(e) {
return H({ attr: { viewBox: "0 0 576 512" }, child: [{ tag: "path", attr: { d: "M384 480l48 0c11.4 0 21.9-6 27.6-15.9l112-192c5.8-9.9 5.8-22.1 .1-32.1S555.5 224 544 224l-400 0c-11.4 0-21.9 6-27.6 15.9L48 357.1 48 96c0-8.8 7.2-16 16-16l117.5 0c4.2 0 8.3 1.7 11.3 4.7l26.5 26.5c21 21 49.5 32.8 79.2 32.8L416 144c8.8 0 16 7.2 16 16l0 32 48 0 0-32c0-35.3-28.7-64-64-64L298.5 96c-17 0-33.3-6.7-45.3-18.7L226.7 50.7c-12-12-28.3-18.7-45.3-18.7L64 32C28.7 32 0 60.7 0 96L0 416c0 35.3 28.7 64 64 64l23.7 0L384 480z" }, child: [] }] })(e);
}
function Ke(e) {
return H({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M104.6 48L64 48C28.7 48 0 76.7 0 112L0 384c0 35.3 28.7 64 64 64l96 0 0-48-96 0c-8.8 0-16-7.2-16-16l0-272c0-8.8 7.2-16 16-16l16 0c0 17.7 14.3 32 32 32l72.4 0C202 108.4 227.6 96 256 96l62 0c-7.1-27.6-32.2-48-62-48l-40.6 0C211.6 20.9 188.2 0 160 0s-51.6 20.9-55.4 48zM144 56a16 16 0 1 1 32 0 16 16 0 1 1 -32 0zM448 464l-192 0c-8.8 0-16-7.2-16-16l0-256c0-8.8 7.2-16 16-16l140.1 0L464 243.9 464 448c0 8.8-7.2 16-16 16zM256 512l192 0c35.3 0 64-28.7 64-64l0-204.1c0-12.7-5.1-24.9-14.1-33.9l-67.9-67.9c-9-9-21.2-14.1-33.9-14.1L256 128c-35.3 0-64 28.7-64 64l0 256c0 35.3 28.7 64 64 64z" }, child: [] }] })(e);
}
const Re = (e = () => {
}) => {
const [n, r] = L(!1), s = te(null), a = (i) => {
var c;
(c = s.current) != null && c.contains(i.target) ? r(!1) : (r(!0), e(i, s));
};
return K(() => (document.addEventListener("click", a, !0), document.addEventListener("mousedown", a, !0), () => {
document.removeEventListener("click", a, !0), document.removeEventListener("mousedown", a, !0);
}), []), { ref: s, isClicked: n, setIsClicked: r };
}, Ut = Ee(), Dn = ({ children: e, layout: n }) => {
const [r, s] = L(() => a(n));
function a(i) {
return ["list", "grid"].includes(i) ? i : "grid";
}
return /* @__PURE__ */ t.jsx(Ut.Provider, { value: { activeLayout: r, setActiveLayout: s }, children: e });
}, he = () => Pe(Ut), In = ({ setShowToggleViewMenu: e, onLayoutChange: n }) => {
const r = Re(() => {
e(!1);
}), { activeLayout: s, setActiveLayout: a } = he(), i = [
{
key: "grid",
name: "Grid",
icon: /* @__PURE__ */ t.jsx($t, { size: 18 })
},
{
key: "list",
name: "List",
icon: /* @__PURE__ */ t.jsx(Me, { size: 18 })
}
], c = (u) => {
a(u), n(u), e(!1);
};
return /* @__PURE__ */ t.jsx("div", { ref: r.ref, className: "toggle-view", role: "dropdown", children: /* @__PURE__ */ t.jsx("ul", { role: "menu", "aria-orientation": "vertical", children: i.map((u) => /* @__PURE__ */ t.jsxs(
"li",
{
role: "menuitem",
onClick: () => c(u.key),
onKeyDown: () => c(u.key),
children: [
/* @__PURE__ */ t.jsx("span", { children: u.key === s && /* @__PURE__ */ t.jsx(qt, { size: 13 }) }),
/* @__PURE__ */ t.jsx("span", { children: u.icon }),
/* @__PURE__ */ t.jsx("span", { children: u.name })
]
},
u.key
)) }) });
}, Kt = Ee(), $n = ({ children: e, filesData: n, onError: r }) => {
const [s, a] = L([]);
K(() => {
a(n);
}, [n]);
const i = (c) => c.isDirectory ? s.filter((u) => u.path === `${c.path}/${u.name}`) : [];
return /* @__PURE__ */ t.jsx(Kt.Provider, { value: { files: s, setFiles: a, getChildren: i, onError: r }, children: e });
}, Oe = () => Pe(Kt), pt = (e) => e.sort((n, r) => n.name.localeCompare(r.name)), Bn = (e) => {
const n = e.filter((i) => i.isDirectory), r = e.filter((i) => !i.isDirectory), s = pt(n), a = pt(r);
return [...s, ...a];
}, Xt = Ee(), Hn = ({ children: e, initialPath: n }) => {
const { files: r } = Oe(), s = te(!1), [a, i] = L(""), [c, u] = L(null), [d, p] = L([]);
return K(() => {
Array.isArray(r) && r.length > 0 && (p(() => {
const f = r.filter((m) => m.path === `${a}/${m.name}`);
return Bn(f);
}), u(() => r.find((f) => f.path === a) ?? null));
}, [r, a]), K(() => {
!s.current && Array.isArray(r) && r.length > 0 && (i(r.some((f) => f.path === n) ? n : ""), s.current = !0);
}, [n, r]), /* @__PURE__ */ t.jsx(
Xt.Provider,
{
value: {
currentPath: a,
setCurrentPath: i,
currentFolder: c,
setCurrentFolder: u,
currentPathFiles: d,
setCurrentPathFiles: p
},
children: e
}
);
}, le = () => Pe(Xt), ve = (e, n, ...r) => {
try {
if (typeof e == "function")
e(...r);
else
throw new Error(
`<FileManager /> Missing prop: Callback function "${n}" is required.`
);
} catch (s) {
console.error(s.message);
}
}, Gt = Ee(), Wn = ({ children: e, onDownload: n, onSelect: r }) => {
const [s, a] = L([]);
K(() => {
s.length && r && r(s);
}, [s]);
const i = () => {
ve(n, "onDownload", s);
};
return /* @__PURE__ */ t.jsx(Gt.Provider, { value: { selectedFiles: s, setSelectedFiles: a, handleDownload: i }, children: e });
}, fe = () => Pe(Gt), Zt = Ee(), Vn = ({ children: e, onPaste: n, onCut: r, onCopy: s }) => {
const [a, i] = L(null), { selectedFiles: c, setSelectedFiles: u } = fe(), d = (f) => {
i({
files: c,
isMoving: f
}), f ? r && r(c) : s && s(c);
}, p = (f) => {
if (f && !f.isDirectory)
return;
const m = a.files, b = a.isMoving ? "move" : "copy";
ve(n, "onPaste", m, f, b), a.isMoving && i(null), u([]);
};
return /* @__PURE__ */ t.jsx(Zt.Provider, { value: { clipBoard: a, setClipBoard: i, handleCutCopy: d, handlePasting: p }, children: e });
}, ze = () => Pe(Zt), Jt = ({
allowCreateFolder: e = !0,
allowUploadFile: n = !0,
onLayoutChange: r,
onRefresh: s,
triggerAction: a
}) => {
var w;
const [i, c] = L(!1), { currentFolder: u } = le(), { selectedFiles: d, setSelectedFiles: p, handleDownload: f } = fe(), { clipBoard: m, setClipBoard: b, handleCutCopy: j, handlePasting: E } = ze(), { activeLayout: N } = he(), _ = [
{
icon: /* @__PURE__ */ t.jsx(It, { size: 17, strokeWidth: 0.3 }),
text: "New folder",
permission: e,
onClick: () => a.show("createFolder")
},
{
icon: /* @__PURE__ */ t.jsx(Vt, { size: 18 }),
text: "Upload",
permission: n,
onClick: () => a.show("uploadFile")
},
{
icon: /* @__PURE__ */ t.jsx(Ke, { size: 18 }),
text: "Paste",
permission: !!m,
onClick: I
}
], x = [
{
icon: N === "grid" ? /* @__PURE__ */ t.jsx($t, { size: 16 }) : /* @__PURE__ */ t.jsx(Me, { size: 16 }),
title: "Change View",
onClick: () => c((l) => !l)
},
{
icon: /* @__PURE__ */ t.jsx(Ht, { size: 16 }),
title: "Refresh",
onClick: () => {
ve(s, "onRefresh"), b(null);
}
}
];
function I() {
E(u);
}
const F = () => {
f(), p([]);
};
return d.length > 0 ? /* @__PURE__ */ t.jsx("div", { className: "toolbar file-selected", children: /* @__PURE__ */ t.jsxs("div", { className: "file-action-container", children: [
/* @__PURE__ */ t.jsxs("div", { children: [
/* @__PURE__ */ t.jsxs("button", { className: "item-action file-action", onClick: () => j(!0), children: [
/* @__PURE__ */ t.jsx(Bt, { size: 18 }),
/* @__PURE__ */ t.jsx("span", { children: "Cut" })
] }),
/* @__PURE__ */ t.jsxs("button", { className: "item-action file-action", onClick: () => j(!1), children: [
/* @__PURE__ */ t.jsx(Dt, { strokeWidth: 0.1, size: 17 }),
/* @__PURE__ */ t.jsx("span", { children: "Copy" })
] }),
((w = m == null ? void 0 : m.files) == null ? void 0 : w.length) > 0 && /* @__PURE__ */ t.jsxs(
"button",
{
className: "item-action file-action",
onClick: I,
children: [
/* @__PURE__ */ t.jsx(Ke, { size: 18 }),
/* @__PURE__ */ t.jsx("span", { children: "Paste" })
]
}
),
d.length === 1 && /* @__PURE__ */ t.jsxs(
"button",
{
className: "item-action file-action",
onClick: () => a.show("rename"),
children: [
/* @__PURE__ */ t.jsx(Yt, { size: 19 }),
/* @__PURE__ */ t.jsx("span", { children: "Rename" })
]
}
),
!d.isDirectory && /* @__PURE__ */ t.jsxs("button", { className: "item-action file-action", onClick: F, children: [
/* @__PURE__ */ t.jsx(Je, { size: 19 }),
/* @__PURE__ */ t.jsx("span", { children: "Download" })
] }),
/* @__PURE__ */ t.jsxs(
"button",
{
className: "item-action file-action",
onClick: () => a.show("delete"),
children: [
/* @__PURE__ */ t.jsx(Wt, { size: 19 }),
/* @__PURE__ */ t.jsx("span", { children: "Delete" })
]
}
)
] }),
/* @__PURE__ */ t.jsxs(
"button",
{
className: "item-action file-action",
title: "Clear selection",
onClick: () => p([]),
children: [
/* @__PURE__ */ t.jsxs("span", { children: [
d.length,
" item",
d.length > 1 && "s",
" selected"
] }),
/* @__PURE__ */ t.jsx(Tn, { size: 18 })
]
}
)
] }) }) : /* @__PURE__ */ t.jsx("div", { className: "toolbar", children: /* @__PURE__ */ t.jsxs("div", { className: "fm-toolbar", children: [
/* @__PURE__ */ t.jsx("div", { children: _.filter((l) => l.permission).map((l, v) => /* @__PURE__ */ t.jsxs("button", { className: "item-action", onClick: l.onClick, children: [
l.icon,
/* @__PURE__ */ t.jsx("span", { children: l.text })
] }, v)) }),
/* @__PURE__ */ t.jsxs("div", { children: [
x.map((l, v) => /* @__PURE__ */ t.jsxs("div", { className: "toolbar-left-items", children: [
/* @__PURE__ */ t.jsx("button", { className: "item-action icon-only", title: l.title, onClick: l.onClick, children: l.icon }),
v !== x.length - 1 && /* @__PURE__ */ t.jsx("div", { className: "item-separator" })
] }, v)),
i && /* @__PURE__ */ t.jsx(
In,
{
setShowToggleViewMenu: c,
onLayoutChange: r
}
)
] })
] }) });
};
Jt.displayName = "Toolbar";
var Yn = process.env.NODE_ENV === "production";
function qn(e, n) {
if (!Yn) {
if (e)
return;
var r = "Warning: " + n;
typeof console < "u" && console.warn(r);
try {
throw Error(r);
} catch {
}
}
}
/**
* react-collapsed v4.2.0
*
* Copyright (c) 2019-2024, Rogin Farrer
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
var Un = class extends Error {
constructor(e) {
super(`react-collapsed: ${e}`);
}
}, ke = (...e) => qn(e[0], `[react-collapsed] -- ${e[1]}`);
function Qt(e) {
const n = te(e);
return K(() => {
n.current = e;
}), zt((...r) => {
var s;
return (s = n.current) == null ? void 0 : s.call(n, ...r);
}, []);
}
function Kn(e, n, r) {
const [s, a] = L(n), i = te(typeof e < "u"), c = i.current ? e : s, u = Qt(r), d = zt(
(p) => {
const m = typeof p == "function" ? p(c) : p;
i.current || a(m), u == null || u(m);
},
[u, c]
);
return K(() => {
ke(
!(i.current && e == null),
"`isExpanded` state is changing from controlled to uncontrolled. useCollapse should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled collapse for the lifetime of the component. Check the `isExpanded` prop."
), ke(
!(!i.current && e != null),
"`isExpanded` state is changing from uncontrolled to controlled. useCollapse should not switch from uncontrolled to controlled (or vice versa). Decide between using a controlled or uncontrolled collapse for the lifetime of the component. Check the `isExpanded` prop."
);
}, [e]), [c, d];
}
var Xn = "(prefers-reduced-motion: reduce)";
function Gn() {
const [e, n] = L(!1);
return K(() => {
if (typeof window > "u" || typeof window.matchMedia != "function")
return;
const r = window.matchMedia(Xn);
n(r.matches);
const s = (a) => {
n(a.matches);
};
if (r.addEventListener)
return r.addEventListener("change", s), () => {
r.removeEventListener("change", s);
};
if (r.addListener)
return r.addListener(s), () => {
r.removeListener(s);
};
}, []), e;
}
var Zn = we.useId || (() => {
});
function Jn() {
return Zn() ?? "";
}
var Qn = typeof window < "u" ? we.useLayoutEffect : we.useEffect, De = !1, er = 0, mt = () => ++er;
function tr(e) {
const n = e || (De ? mt() : null), [r, s] = we.useState(n);
return Qn(() => {
r === null && s(mt());
}, []), we.useEffect(() => {
De === !1 && (De = !0);
}, []), r != null ? String(r) : void 0;
}
function nr(e) {
const n = Jn(), r = tr(e);
return typeof e == "string" ? e : typeof n == "string" ? n : r;
}
function rr(e, n) {
const r = performance.now(), s = {};
function a() {
s.id = requestAnimationFrame((i) => {
i - r > n ? e() : a();
});
}
return a(), s;
}
function vt(e) {
e.id && cancelAnimationFrame(e.id);
}
function gt(e) {
return e != null && e.current ? e.current.scrollHeight : (ke(
!0,
"Was not able to find a ref to the collapse element via `getCollapseProps`. Ensure that the element exposes its `ref` prop. If it exposes the ref prop under a different name (like `innerRef`), use the `refKey` property to change it. Example:\n\nconst collapseProps = getCollapseProps({refKey: 'innerRef'})"
), 0);
}
function sr(e) {
if (!e || typeof e == "string")
return 0;
const n = e / 36;
return Math.round((4 + 15 * n ** 0.25 + n / 5) * 10);
}
function or(e, n) {
if (e != null)
if (typeof e == "function")
e(n);
else
try {
e.current = n;
} catch {
throw new Un(`Cannot assign value "${n}" to ref "${e}"`);
}
}
function yt(...e) {
return e.every((n) => n == null) ? null : (n) => {
e.forEach((r) => {
or(r, n);
});
};
}
function ar(e) {
let n = (r) => {
};
n = (r) => {
if (!(r != null && r.current))
return;
const { paddingTop: s, paddingBottom: a } = window.getComputedStyle(r.current);
ke(
!(s && s !== "0px" || a && a !== "0px"),
`Padding applied to the collapse element will cause the animation to break and not perform as expected. To fix, apply equivalent padding to the direct descendent of the collapse element. Example:
Before: <div {...getCollapseProps({style: {padding: 10}})}>{children}</div>
After: <div {...getCollapseProps()}>
<div style={{padding: 10}}>
{children}
</div>
</div>`
);
}, K(() => {
n(e);
}, [e]);
}
var ir = typeof window > "u" ? K : pn;
function cr({
duration: e,
easing: n = "cubic-bezier(0.4, 0, 0.2, 1)",
onTransitionStateChange: r = () => {
},
isExpanded: s,
defaultExpanded: a = !1,
hasDisabledAnimation: i,
id: c,
...u
} = {}) {
const d = Qt(r), p = nr(c ? `${c}` : void 0), [f, m] = Kn(
s,
a
), b = te(f), [j, E] = L(!1), N = Gn(), _ = i ?? N, x = te(), I = te(), F = te(null), [w, l] = L(null);
ar(F);
const v = `${u.collapsedHeight || 0}px`;
function P(g) {
if (!F.current)
return;
const y = F.current;
for (const R in g) {
const z = g[R];
z ? y.style[R] = z : y.style.removeProperty(R);
}
}
return ir(() => {
if (!F.current || f === b.current)
return;
b.current = f;
function y(M) {
return _ ? 0 : e ?? sr(M);
}
const R = (M) => `height ${y(M)}ms ${n}`, z = (M) => {
function D() {
f ? (P({
height: "",
overflow: "",
transition: "",
display: ""
}), d("expandEnd")) : (P({ transition: "" }), d("collapseEnd")), E(!1);
}
I.current && vt(I.current), I.current = rr(D, M);
};
return E(!0), f ? x.current = requestAnimationFrame(() => {
d("expandStart"), P({
display: "block",
overflow: "hidden",
height: v
}), x.current = requestAnimationFrame(() => {
d("expanding");
const M = gt(F);
z(y(M)), F.current && (F.current.style.transition = R(M), F.current.style.height = `${M}px`);
});
}) : x.current = requestAnimationFrame(() => {
d("collapseStart");
const M = gt(F);
z(y(M)), P({
transition: R(M),
height: `${M}px`
}), x.current = requestAnimationFrame(() => {
d("collapsing"), P({
height: v,
overflow: "hidden"
});
});
}), () => {
x.current && cancelAnimationFrame(x.current), I.current && vt(I.current);
};
}, [
f,
v,
_,
e,
n,
d
]), {
isExpanded: f,
setExpanded: m,
getToggleProps(g) {
const { disabled: y, onClick: R, refKey: z, ...M } = {
refKey: "ref",
onClick() {
},
disabled: !1,
...g
}, D = w ? w.tagName === "BUTTON" : void 0, q = g == null ? void 0 : g[z || "ref"], ee = {
id: `react-collapsed-toggle-${p}`,
"aria-controls": `react-collapsed-panel-${p}`,
"aria-expanded": f,
onClick(X) {
y || (R == null || R(X), m((se) => !se));
},
[z || "ref"]: yt(q, l)
}, J = {
type: "button",
disabled: y ? !0 : void 0
}, Q = {
"aria-disabled": y ? !0 : void 0,
role: "button",
tabIndex: y ? -1 : 0
};
return D === !1 ? { ...ee, ...Q, ...M } : D === !0 ? { ...ee, ...J, ...M } : {
...ee,
...J,
...Q,
...M
};
},
getCollapseProps(g) {
const { style: y, refKey: R } = { refKey: "ref", style: {}, ...g }, z = g == null ? void 0 : g[R || "ref"];
return {
id: `react-collapsed-panel-${p}`,
"aria-hidden": !f,
"aria-labelledby": `react-collapsed-toggle-${p}`,
role: "region",
...g,
[R || "ref"]: yt(F, z),
style: {
boxSizing: "border-box",
...!j && !f ? {
// collapsed and not animating
display: v === "0px" ? "none" : "block",
height: v,
overflow: "hidden"
} : {},
// additional styles passed, e.g. getCollapseProps({style: {}})
...y
}
};
}
};
}
const lr = ({ open: e, children: n }) => {
const [r, s] = L(e), { getCollapseProps: a } = cr({
isExpanded: r,
duration: 500
});
return K(() => {
s(e);
}, [e, s]), /* @__PURE__ */ t.jsx(t.Fragment, { children: /* @__PURE__ */ t.jsx("div", { ...a(), children: n }) });
};
function ur(e) {
return H({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M256 8C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 48c110.532 0 200 89.451 200 200 0 110.532-89.451 200-200 200-110.532 0-200-89.451-200-200 0-110.532 89.451-200 200-200m140.204 130.267l-22.536-22.718c-4.667-4.705-12.265-4.736-16.97-.068L215.346 303.697l-59.792-60.277c-4.667-4.705-12.265-4.736-16.97-.069l-22.719 22.536c-4.705 4.667-4.736 12.265-.068 16.971l90.781 91.516c4.667 4.705 12.265 4.736 16.97.068l172.589-171.204c4.704-4.668 4.734-12.266.067-16.971z" }, child: [] }] })(e);
}
function dr(e) {
return H({ attr: { viewBox: "0 0 384 512" }, child: [{ tag: "path", attr: { d: "M288 248v28c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-28c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12zm-12 72H108c-6.6 0-12 5.4-12 12v28c0 6.6 5.4 12 12 12h168c6.6 0 12-5.4 12-12v-28c0-6.6-5.4-12-12-12zm108-188.1V464c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V48C0 21.5 21.5 0 48 0h204.1C264.8 0 277 5.1 286 14.1L369.9 98c9 8.9 14.1 21.2 14.1 33.9zm-128-80V128h76.1L256 51.9zM336 464V176H232c-13.3 0-24-10.7-24-24V48H48v416h288z" }, child: [] }] })(e);
}
function xt(e) {
return H({ attr: { viewBox: "0 0 576 512" }, child: [{ tag: "path", attr: { d: "M527.9 224H480v-48c0-26.5-