react-files-preview
Advanced tools
Comparing version 1.0.25 to 1.1.0
@@ -1,2 +0,2 @@ | ||
import Ve, { createContext as v0, useReducer as m0, useState as $e, useEffect as le, useContext as O } from "react"; | ||
import Ve, { createContext as v0, useReducer as m0, useState as $e, useEffect as J, useContext as O } from "react"; | ||
var ye = { exports: {} }, q = {}; | ||
@@ -17,12 +17,12 @@ /** | ||
ze = 1; | ||
var n = Ve, c = Symbol.for("react.element"), m = Symbol.for("react.fragment"), p = Object.prototype.hasOwnProperty, v = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, d = { key: !0, ref: !0, __self: !0, __source: !0 }; | ||
function g(b, u, k) { | ||
var n = Ve, f = Symbol.for("react.element"), m = Symbol.for("react.fragment"), p = Object.prototype.hasOwnProperty, v = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, d = { key: !0, ref: !0, __self: !0, __source: !0 }; | ||
function g(b, c, k) { | ||
var E, R = {}, F = null, M = null; | ||
k !== void 0 && (F = "" + k), u.key !== void 0 && (F = "" + u.key), u.ref !== void 0 && (M = u.ref); | ||
for (E in u) | ||
p.call(u, E) && !d.hasOwnProperty(E) && (R[E] = u[E]); | ||
k !== void 0 && (F = "" + k), c.key !== void 0 && (F = "" + c.key), c.ref !== void 0 && (M = c.ref); | ||
for (E in c) | ||
p.call(c, E) && !d.hasOwnProperty(E) && (R[E] = c[E]); | ||
if (b && b.defaultProps) | ||
for (E in u = b.defaultProps, u) | ||
R[E] === void 0 && (R[E] = u[E]); | ||
return { $$typeof: c, type: b, key: F, ref: M, props: R, _owner: v.current }; | ||
for (E in c = b.defaultProps, c) | ||
R[E] === void 0 && (R[E] = c[E]); | ||
return { $$typeof: f, type: b, key: F, ref: M, props: R, _owner: v.current }; | ||
} | ||
@@ -44,4 +44,4 @@ return q.Fragment = m, q.jsx = g, q.jsxs = g, q; | ||
return Le || (Le = 1, process.env.NODE_ENV !== "production" && function() { | ||
var n = Ve, c = Symbol.for("react.element"), m = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), v = Symbol.for("react.strict_mode"), d = Symbol.for("react.profiler"), g = Symbol.for("react.provider"), b = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), k = Symbol.for("react.suspense"), E = Symbol.for("react.suspense_list"), R = Symbol.for("react.memo"), F = Symbol.for("react.lazy"), M = Symbol.for("react.offscreen"), Z = Symbol.iterator, I = "@@iterator"; | ||
function J(e) { | ||
var n = Ve, f = Symbol.for("react.element"), m = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), v = Symbol.for("react.strict_mode"), d = Symbol.for("react.profiler"), g = Symbol.for("react.provider"), b = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), k = Symbol.for("react.suspense"), E = Symbol.for("react.suspense_list"), R = Symbol.for("react.memo"), F = Symbol.for("react.lazy"), M = Symbol.for("react.offscreen"), Z = Symbol.iterator, I = "@@iterator"; | ||
function K(e) { | ||
if (e === null || typeof e != "object") | ||
@@ -57,9 +57,9 @@ return null; | ||
a[i - 1] = arguments[i]; | ||
K("error", e, a); | ||
X("error", e, a); | ||
} | ||
} | ||
function K(e, t, a) { | ||
function X(e, t, a) { | ||
{ | ||
var i = S.ReactDebugCurrentFrame, f = i.getStackAddendum(); | ||
f !== "" && (t += "%s", a = a.concat([f])); | ||
var i = S.ReactDebugCurrentFrame, u = i.getStackAddendum(); | ||
u !== "" && (t += "%s", a = a.concat([u])); | ||
var h = a.map(function(s) { | ||
@@ -74,3 +74,3 @@ return String(s); | ||
function ce(e) { | ||
return !!(typeof e == "string" || typeof e == "function" || e === p || e === d || W || e === v || e === k || e === E || L || e === M || P || oe || se || typeof e == "object" && e !== null && (e.$$typeof === F || e.$$typeof === R || e.$$typeof === g || e.$$typeof === b || e.$$typeof === u || // This needs to include all possible module reference object | ||
return !!(typeof e == "string" || typeof e == "function" || e === p || e === d || W || e === v || e === k || e === E || L || e === M || P || oe || se || typeof e == "object" && e !== null && (e.$$typeof === F || e.$$typeof === R || e.$$typeof === g || e.$$typeof === b || e.$$typeof === c || // This needs to include all possible module reference object | ||
// types supported by any Flight configuration anywhere since | ||
@@ -85,6 +85,6 @@ // we don't know which Flight build this will end up being used | ||
return i; | ||
var f = t.displayName || t.name || ""; | ||
return f !== "" ? a + "(" + f + ")" : a; | ||
var u = t.displayName || t.name || ""; | ||
return u !== "" ? a + "(" + u + ")" : a; | ||
} | ||
function X(e) { | ||
function Q(e) { | ||
return e.displayName || "Context"; | ||
@@ -117,7 +117,7 @@ } | ||
var t = e; | ||
return X(t) + ".Consumer"; | ||
return Q(t) + ".Consumer"; | ||
case g: | ||
var a = e; | ||
return X(a._context) + ".Provider"; | ||
case u: | ||
return Q(a._context) + ".Provider"; | ||
case c: | ||
return ue(e, e.render, "ForwardRef"); | ||
@@ -128,3 +128,3 @@ case R: | ||
case F: { | ||
var f = e, h = f._payload, s = f._init; | ||
var u = e, h = u._payload, s = u._init; | ||
try { | ||
@@ -139,3 +139,3 @@ return D(s(h)); | ||
} | ||
var A = Object.assign, l = 0, w, C, fe, V, U, Q, ee; | ||
var A = Object.assign, l = 0, w, C, fe, V, U, ee, te; | ||
function be() { | ||
@@ -147,3 +147,3 @@ } | ||
if (l === 0) { | ||
w = console.log, C = console.info, fe = console.warn, V = console.error, U = console.group, Q = console.groupCollapsed, ee = console.groupEnd; | ||
w = console.log, C = console.info, fe = console.warn, V = console.error, U = console.group, ee = console.groupCollapsed, te = console.groupEnd; | ||
var e = { | ||
@@ -193,6 +193,6 @@ configurable: !0, | ||
groupCollapsed: A({}, e, { | ||
value: Q | ||
value: ee | ||
}), | ||
groupEnd: A({}, e, { | ||
value: ee | ||
value: te | ||
}) | ||
@@ -205,3 +205,3 @@ }); | ||
var de = S.ReactCurrentDispatcher, he; | ||
function te(e, t, a) { | ||
function re(e, t, a) { | ||
{ | ||
@@ -211,4 +211,4 @@ if (he === void 0) | ||
throw Error(); | ||
} catch (f) { | ||
var i = f.stack.trim().match(/\n( *(at )?)/); | ||
} catch (u) { | ||
var i = u.stack.trim().match(/\n( *(at )?)/); | ||
he = i && i[1] || ""; | ||
@@ -220,6 +220,6 @@ } | ||
} | ||
var ve = !1, re; | ||
var ve = !1, ae; | ||
{ | ||
var Be = typeof WeakMap == "function" ? WeakMap : Map; | ||
re = new Be(); | ||
ae = new Be(); | ||
} | ||
@@ -230,3 +230,3 @@ function je(e, t) { | ||
{ | ||
var a = re.get(e); | ||
var a = ae.get(e); | ||
if (a !== void 0) | ||
@@ -237,3 +237,3 @@ return a; | ||
ve = !0; | ||
var f = Error.prepareStackTrace; | ||
var u = Error.prepareStackTrace; | ||
Error.prepareStackTrace = void 0; | ||
@@ -287,3 +287,3 @@ var h; | ||
` + o[x].replace(" at new ", " at "); | ||
return e.displayName && N.includes("<anonymous>") && (N = N.replace("<anonymous>", e.displayName)), typeof e == "function" && re.set(e, N), N; | ||
return e.displayName && N.includes("<anonymous>") && (N = N.replace("<anonymous>", e.displayName)), typeof e == "function" && ae.set(e, N), N; | ||
} | ||
@@ -295,6 +295,6 @@ while (x >= 1 && y >= 0); | ||
} finally { | ||
ve = !1, de.current = h, We(), Error.prepareStackTrace = f; | ||
ve = !1, de.current = h, We(), Error.prepareStackTrace = u; | ||
} | ||
var H = e ? e.displayName || e.name : "", Ae = H ? te(H) : ""; | ||
return typeof e == "function" && re.set(e, Ae), Ae; | ||
var H = e ? e.displayName || e.name : "", Ae = H ? re(H) : ""; | ||
return typeof e == "function" && ae.set(e, Ae), Ae; | ||
} | ||
@@ -308,3 +308,3 @@ function Ue(e, t, a) { | ||
} | ||
function ae(e, t, a) { | ||
function ne(e, t, a) { | ||
if (e == null) | ||
@@ -315,19 +315,19 @@ return ""; | ||
if (typeof e == "string") | ||
return te(e); | ||
return re(e); | ||
switch (e) { | ||
case k: | ||
return te("Suspense"); | ||
return re("Suspense"); | ||
case E: | ||
return te("SuspenseList"); | ||
return re("SuspenseList"); | ||
} | ||
if (typeof e == "object") | ||
switch (e.$$typeof) { | ||
case u: | ||
case c: | ||
return Ue(e.render); | ||
case R: | ||
return ae(e.type, t, a); | ||
return ne(e.type, t, a); | ||
case F: { | ||
var i = e, f = i._payload, h = i._init; | ||
var i = e, u = i._payload, h = i._init; | ||
try { | ||
return ae(h(f), t, a); | ||
return ne(h(u), t, a); | ||
} catch { | ||
@@ -339,6 +339,6 @@ } | ||
} | ||
var ne = Object.prototype.hasOwnProperty, Ee = {}, _e = S.ReactDebugCurrentFrame; | ||
function ie(e) { | ||
var ie = Object.prototype.hasOwnProperty, Ee = {}, _e = S.ReactDebugCurrentFrame; | ||
function le(e) { | ||
if (e) { | ||
var t = e._owner, a = ae(e.type, e._source, t ? t.type : null); | ||
var t = e._owner, a = ne(e.type, e._source, t ? t.type : null); | ||
_e.setExtraStackFrame(a); | ||
@@ -348,5 +348,5 @@ } else | ||
} | ||
function qe(e, t, a, i, f) { | ||
function qe(e, t, a, i, u) { | ||
{ | ||
var h = Function.call.bind(ne); | ||
var h = Function.call.bind(ie); | ||
for (var s in e) | ||
@@ -364,3 +364,3 @@ if (h(e, s)) { | ||
} | ||
o && !(o instanceof Error) && (ie(f), j("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", i || "React class", a, s, typeof o), ie(null)), o instanceof Error && !(o.message in Ee) && (Ee[o.message] = !0, ie(f), j("Failed %s type: %s", a, o.message), ie(null)); | ||
o && !(o instanceof Error) && (le(u), j("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", i || "React class", a, s, typeof o), le(null)), o instanceof Error && !(o.message in Ee) && (Ee[o.message] = !0, le(u), j("Failed %s type: %s", a, o.message), le(null)); | ||
} | ||
@@ -401,3 +401,3 @@ } | ||
function Qe(e) { | ||
if (ne.call(e, "ref")) { | ||
if (ie.call(e, "ref")) { | ||
var t = Object.getOwnPropertyDescriptor(e, "ref").get; | ||
@@ -410,3 +410,3 @@ if (t && t.isReactWarning) | ||
function e0(e) { | ||
if (ne.call(e, "key")) { | ||
if (ie.call(e, "key")) { | ||
var t = Object.getOwnPropertyDescriptor(e, "key").get; | ||
@@ -446,6 +446,6 @@ if (t && t.isReactWarning) | ||
} | ||
var n0 = function(e, t, a, i, f, h, s) { | ||
var n0 = function(e, t, a, i, u, h, s) { | ||
var o = { | ||
// This tag allows us to uniquely identify this as a React Element | ||
$$typeof: c, | ||
$$typeof: f, | ||
// Built-in properties that belong on the element | ||
@@ -473,11 +473,11 @@ type: e, | ||
writable: !1, | ||
value: f | ||
value: u | ||
}), Object.freeze && (Object.freeze(o.props), Object.freeze(o)), o; | ||
}; | ||
function i0(e, t, a, i, f) { | ||
function i0(e, t, a, i, u) { | ||
{ | ||
var h, s = {}, o = null, _ = null; | ||
a !== void 0 && (Se(a), o = "" + a), e0(t) && (Se(t.key), o = "" + t.key), Qe(t) && (_ = t.ref, t0(t, f)); | ||
a !== void 0 && (Se(a), o = "" + a), e0(t) && (Se(t.key), o = "" + t.key), Qe(t) && (_ = t.ref, t0(t, u)); | ||
for (h in t) | ||
ne.call(t, h) && !Xe.hasOwnProperty(h) && (s[h] = t[h]); | ||
ie.call(t, h) && !Xe.hasOwnProperty(h) && (s[h] = t[h]); | ||
if (e && e.defaultProps) { | ||
@@ -492,3 +492,3 @@ var x = e.defaultProps; | ||
} | ||
return n0(e, o, _, f, i, Y.current, s); | ||
return n0(e, o, _, u, i, Y.current, s); | ||
} | ||
@@ -499,3 +499,3 @@ } | ||
if (e) { | ||
var t = e._owner, a = ae(e.type, e._source, t ? t.type : null); | ||
var t = e._owner, a = ne(e.type, e._source, t ? t.type : null); | ||
Ce.setExtraStackFrame(a); | ||
@@ -508,3 +508,3 @@ } else | ||
function we(e) { | ||
return typeof e == "object" && e !== null && e.$$typeof === c; | ||
return typeof e == "object" && e !== null && e.$$typeof === f; | ||
} | ||
@@ -572,5 +572,5 @@ function Ne() { | ||
else if (e) { | ||
var f = J(e); | ||
if (typeof f == "function" && f !== e.entries) | ||
for (var h = f.call(e), s; !(s = h.next()).done; ) | ||
var u = K(e); | ||
if (typeof u == "function" && u !== e.entries) | ||
for (var h = u.call(e), s; !(s = h.next()).done; ) | ||
we(s.value) && De(s.value, t); | ||
@@ -588,3 +588,3 @@ } | ||
a = t.propTypes; | ||
else if (typeof t == "object" && (t.$$typeof === u || // Note: Memo only checks outer props here. | ||
else if (typeof t == "object" && (t.$$typeof === c || // Note: Memo only checks outer props here. | ||
// Inner props are checked in the reconciler. | ||
@@ -600,4 +600,4 @@ t.$$typeof === R)) | ||
xe = !0; | ||
var f = D(t); | ||
j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", f || "Unknown"); | ||
var u = D(t); | ||
j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", u || "Unknown"); | ||
} | ||
@@ -619,3 +619,3 @@ typeof t.getDefaultProps == "function" && !t.getDefaultProps.isReactClassApproved && j("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); | ||
} | ||
function Pe(e, t, a, i, f, h) { | ||
function Pe(e, t, a, i, u, h) { | ||
{ | ||
@@ -626,8 +626,8 @@ var s = ce(e); | ||
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (o += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."); | ||
var _ = l0(f); | ||
var _ = l0(u); | ||
_ ? o += _ : o += Ne(); | ||
var x; | ||
e === null ? x = "null" : me(e) ? x = "array" : e !== void 0 && e.$$typeof === c ? (x = "<" + (D(e.type) || "Unknown") + " />", o = " Did you accidentally export a JSX literal instead of a component?") : x = typeof e, j("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", x, o); | ||
e === null ? x = "null" : me(e) ? x = "array" : e !== void 0 && e.$$typeof === f ? (x = "<" + (D(e.type) || "Unknown") + " />", o = " Did you accidentally export a JSX literal instead of a component?") : x = typeof e, j("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", x, o); | ||
} | ||
var y = i0(e, t, a, f, h); | ||
var y = i0(e, t, a, u, h); | ||
if (y == null) | ||
@@ -669,17 +669,17 @@ return y; | ||
"image/tiff" | ||
], x0 = (n, c) => { | ||
], x0 = (n, f) => { | ||
const m = n.fileData.length - 1; | ||
switch (c.type) { | ||
switch (f.type) { | ||
case "STORE_FILE_DATA": | ||
return { ...n, fileData: c.payload.files }; | ||
return { ...n, fileData: f.payload.files }; | ||
case "SET_COMPONENT_STATE": | ||
return { ...n, componentState: c.payload }; | ||
return { ...n, componentState: f.payload }; | ||
case "APPEND_FILE_DATA": | ||
return { ...n, fileData: [...n.fileData, ...c.payload.files] }; | ||
return { ...n, fileData: [...n.fileData, ...f.payload.files] }; | ||
case "STORE_FILE_STATE": | ||
return { ...n, fileState: c.payload }; | ||
return { ...n, fileState: f.payload }; | ||
case "REMOVE_FILE_DATA": | ||
return { | ||
...n, | ||
fileData: n.fileData.filter((b) => b.name !== c.payload.name) | ||
fileData: n.fileData.filter((b) => b.name !== f.payload.name) | ||
}; | ||
@@ -744,3 +744,3 @@ case "GET_NEXT_FILE": | ||
}), w0 = ({ children: n }) => { | ||
const [c, m] = m0(x0, { | ||
const [f, m] = m0(x0, { | ||
fileData: [], | ||
@@ -766,6 +766,6 @@ fileState: { | ||
}); | ||
return /* @__PURE__ */ r.jsx(T.Provider, { value: { state: c, dispatch: m }, children: n }); | ||
}, y0 = ({ file: n, fileSrc: c }) => { | ||
return /* @__PURE__ */ r.jsx(T.Provider, { value: { state: f, dispatch: m }, children: n }); | ||
}, y0 = ({ file: n, fileSrc: f }) => { | ||
const [m, p] = $e(null); | ||
le(() => { | ||
J(() => { | ||
n.size < 1e6 ? p(Math.floor(n.size / 1e3) + " KB") : p(Math.floor(n.size / 1e6) + " MB"); | ||
@@ -777,11 +777,11 @@ }, [n.size]); | ||
d.length > 20 && (d = d.substring(0, 5) + ".." + d.substring(d.length - 3, d.length)); | ||
const b = d + "." + g, u = O(T).state.componentState; | ||
const b = d + "." + g, c = O(T).state.componentState; | ||
return /* @__PURE__ */ r.jsxs("div", { className: "relative ", children: [ | ||
/* @__PURE__ */ r.jsx("h5", { className: "text-[12px] mt-1 font-normal break-words dark:text-white", children: b }), | ||
u.showFileSize && /* @__PURE__ */ r.jsx("span", { "data-testid": "file-size", className: "text-[10px] dark:text-white", children: m }), | ||
u.downloadFile && c && /* @__PURE__ */ r.jsx( | ||
c.showFileSize && /* @__PURE__ */ r.jsx("span", { "data-testid": "file-size", className: "text-[10px] dark:text-white", children: m }), | ||
c.downloadFile && f && /* @__PURE__ */ r.jsx( | ||
"a", | ||
{ | ||
className: "float-right absolute top-1 right-0 text-gray-500 dark:text-white", | ||
href: c, | ||
href: f, | ||
target: "_blank", | ||
@@ -839,9 +839,9 @@ download: !0, | ||
} | ||
], Ie = ["image/jpeg", "image/jpg", "image/png", "image/gif", "image/tiff"], b0 = ({ file: n, index: c }) => { | ||
], Ie = ["image/jpeg", "image/jpg", "image/png", "image/gif", "image/tiff"], b0 = ({ file: n, index: f }) => { | ||
const [m, p] = $e(null); | ||
le(() => { | ||
const u = URL.createObjectURL(n); | ||
return p(u), () => URL.revokeObjectURL(u); | ||
J(() => { | ||
const c = URL.createObjectURL(n); | ||
return p(c), () => URL.revokeObjectURL(c); | ||
}, [n]); | ||
const v = He.filter((u) => u.type == n.type), d = O(T).state.componentState, { dispatch: g } = O(T), b = () => { | ||
const v = He.filter((c) => c.type == n.type), d = O(T).state.componentState, { dispatch: g } = O(T), b = () => { | ||
g({ | ||
@@ -852,3 +852,3 @@ type: "STORE_FILE_STATE", | ||
fileSrc: m, | ||
index: c, | ||
index: f, | ||
isImage: Ie.includes(n.type), | ||
@@ -907,6 +907,6 @@ fileName: n.name, | ||
}, j0 = () => { | ||
const n = O(T).state.fileData, c = O(T).state.fileState; | ||
return /* @__PURE__ */ r.jsx("div", { id: "slider-count", className: "absolute bottom-5 right-0 left-0 flex items-center justify-center z-50", children: (c == null ? void 0 : c.index) !== null && /* @__PURE__ */ r.jsx("div", { className: "text-white text-1xl", children: `${c.index + 1} of ${n == null ? void 0 : n.length}` }) }); | ||
const n = O(T).state.fileData, f = O(T).state.fileState; | ||
return /* @__PURE__ */ r.jsx("div", { id: "slider-count", className: "absolute bottom-5 right-0 left-0 flex items-center justify-center z-50", children: (f == null ? void 0 : f.index) !== null && /* @__PURE__ */ r.jsx("div", { className: "text-white text-1xl", children: `${f.index + 1} of ${n == null ? void 0 : n.length}` }) }); | ||
}, E0 = () => { | ||
const n = O(T).state.fileState, c = O(T).state.componentState, m = He.filter((u) => u.type === n.type), { dispatch: p } = O(T), v = () => { | ||
const n = O(T).state.fileState, f = O(T).state.componentState, m = He.filter((c) => c.type === n.type), { dispatch: p } = O(T), v = () => { | ||
p({ | ||
@@ -929,4 +929,4 @@ type: "STORE_FILE_STATE", | ||
}, b = () => { | ||
const u = document.documentElement; | ||
document.fullscreenElement ? document.exitFullscreen && document.exitFullscreen() : u.requestFullscreen && u.requestFullscreen(); | ||
const c = document.documentElement; | ||
document.fullscreenElement ? document.exitFullscreen && document.exitFullscreen() : c.requestFullscreen && c.requestFullscreen(); | ||
}; | ||
@@ -1052,3 +1052,3 @@ return n.zoom ? /* @__PURE__ */ r.jsx("div", { children: /* @__PURE__ */ r.jsxs( | ||
"data-testid": "image-slider", | ||
className: `${c.rounded && "rounded-lg"} relative w-[130vh] max-sm:w-96 max-md:w-[75vh] h-[78vh] max-sm:h-52 max-md:h-80 bg-slate-400 overflow-hidden transition-all delay-750 ease-in`, | ||
className: `${f.rounded && "rounded-lg"} relative w-[130vh] max-sm:w-96 max-md:w-[75vh] h-[78vh] max-sm:h-52 max-md:h-80 bg-slate-400 overflow-hidden transition-all delay-750 ease-in`, | ||
children: n.isImage ? n.fileSrc && /* @__PURE__ */ r.jsx("img", { className: "object-fit w-full h-full ", src: n.fileSrc, alt: "Zoomed Image" }) : /* @__PURE__ */ r.jsx("span", { className: "flex w-full h-full items-center justify-center text-4xl", children: /* @__PURE__ */ r.jsx( | ||
@@ -1102,3 +1102,3 @@ "span", | ||
), | ||
c.showSliderCount ? /* @__PURE__ */ r.jsx(j0, {}) : /* @__PURE__ */ r.jsx(r.Fragment, {}) | ||
f.showSliderCount ? /* @__PURE__ */ r.jsx(j0, {}) : /* @__PURE__ */ r.jsx(r.Fragment, {}) | ||
] | ||
@@ -1109,3 +1109,3 @@ } | ||
files: n, | ||
url: c, | ||
url: f, | ||
downloadFile: m, | ||
@@ -1117,3 +1117,3 @@ removeFile: p, | ||
accept: b, | ||
maxFileSize: u, | ||
maxFileSize: c, | ||
maxFiles: k, | ||
@@ -1126,6 +1126,6 @@ width: E, | ||
onChange: I, | ||
onRemove: J, | ||
onRemove: K, | ||
onError: S, | ||
getFiles: j, | ||
onClick: K | ||
onClick: X | ||
}) => { | ||
@@ -1136,11 +1136,11 @@ const P = O(T).state.fileData, oe = O(T).state.fileState, se = O(T).state.componentState, { dispatch: L } = O(T), W = (l) => { | ||
throw w = !0, S && S(new Error(`Max ${k} files are allowed to be selected`)), new Error(`Max ${k} files are allowed to be selected`); | ||
return u && l.forEach((C) => { | ||
if (C.size > u) | ||
return c && l.forEach((C) => { | ||
if (C.size > c) | ||
throw w = !0, S && S(new Error(`File size limit exceeded: ${C.name}`)), new Error(`File size limit exceeded: ${C.name}`); | ||
}), w; | ||
}; | ||
le(() => { | ||
J(() => { | ||
async function l() { | ||
try { | ||
if (c) { | ||
if (f) { | ||
const C = [ | ||
@@ -1152,10 +1152,10 @@ { type: "image/jpeg", ext: ".jpg" }, | ||
{ type: "image/tiff", ext: ".tiff" } | ||
], V = await (await fetch(c)).blob(); | ||
], V = await (await fetch(f)).blob(); | ||
var w = null; | ||
const U = C.filter((ee) => ee.type === V.type); | ||
const U = C.filter((te) => te.type === V.type); | ||
U.length > 0 && (w = U[0].ext); | ||
const Q = new File([V], "file" + w, { | ||
const ee = new File([V], "file" + w, { | ||
type: V.type | ||
}); | ||
L({ type: "STORE_FILE_DATA", payload: { files: [Q] } }); | ||
L({ type: "STORE_FILE_DATA", payload: { files: [ee] } }); | ||
} | ||
@@ -1167,4 +1167,4 @@ } catch (C) { | ||
} | ||
l(), n && n.length > 0 && (W(n) || L({ type: "APPEND_FILE_DATA", payload: { files: n } })); | ||
}, [c, n]), le(() => { | ||
l(), n && n.length > 0 && (W(n) || L({ type: "STORE_FILE_DATA", payload: { files: n } })); | ||
}, []), J(() => { | ||
L({ | ||
@@ -1187,8 +1187,10 @@ type: "SET_COMPONENT_STATE", | ||
}, ce = (l) => { | ||
L({ type: "REMOVE_FILE_DATA", payload: l }), J && J(l); | ||
L({ type: "REMOVE_FILE_DATA", payload: l }), K && K(l); | ||
}, ue = (l) => { | ||
K && K(l); | ||
X && X(l); | ||
}; | ||
j && j(P); | ||
const X = (l) => { | ||
J(() => { | ||
j && j(P); | ||
}, [P]); | ||
const Q = (l) => { | ||
l.preventDefault(), l.dataTransfer.dropEffect = "copy"; | ||
@@ -1233,3 +1235,3 @@ }, D = (l) => { | ||
className: `${F && `overflow-auto ${F}`} ${P.length == 0 && "border-2 border-dashed border-gray-300 hover:bg-stone-200"} flex flex-row flex-wrap gap-4 p-6 bg-stone-100 shadow dark:bg-gray-800 `, | ||
onDragOver: X, | ||
onDragOver: Q, | ||
onDragLeave: D, | ||
@@ -1236,0 +1238,0 @@ onDrop: A, |
@@ -1,2 +0,2 @@ | ||
(function(M,v){typeof exports=="object"&&typeof module<"u"?v(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],v):(M=typeof globalThis<"u"?globalThis:M||self,v(M.ReactFilesPreview={},M.React))})(this,function(M,v){"use strict";var oe={exports:{}},B={};/** | ||
(function(M,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],d):(M=typeof globalThis<"u"?globalThis:M||self,d(M.ReactFilesPreview={},M.React))})(this,function(M,d){"use strict";var oe={exports:{}},B={};/** | ||
* @license React | ||
@@ -9,3 +9,3 @@ * react-jsx-runtime.production.min.js | ||
* LICENSE file in the root directory of this source tree. | ||
*/var be;function He(){if(be)return B;be=1;var n=v,c=Symbol.for("react.element"),m=Symbol.for("react.fragment"),g=Object.prototype.hasOwnProperty,p=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,d={key:!0,ref:!0,__self:!0,__source:!0};function x(j,u,C){var _,T={},F=null,I=null;C!==void 0&&(F=""+C),u.key!==void 0&&(F=""+u.key),u.ref!==void 0&&(I=u.ref);for(_ in u)g.call(u,_)&&!d.hasOwnProperty(_)&&(T[_]=u[_]);if(j&&j.defaultProps)for(_ in u=j.defaultProps,u)T[_]===void 0&&(T[_]=u[_]);return{$$typeof:c,type:j,key:F,ref:I,props:T,_owner:p.current}}return B.Fragment=m,B.jsx=x,B.jsxs=x,B}var U={};/** | ||
*/var be;function He(){if(be)return B;be=1;var n=d,f=Symbol.for("react.element"),m=Symbol.for("react.fragment"),g=Object.prototype.hasOwnProperty,p=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,h={key:!0,ref:!0,__self:!0,__source:!0};function x(j,c,C){var _,T={},D=null,I=null;C!==void 0&&(D=""+C),c.key!==void 0&&(D=""+c.key),c.ref!==void 0&&(I=c.ref);for(_ in c)g.call(c,_)&&!h.hasOwnProperty(_)&&(T[_]=c[_]);if(j&&j.defaultProps)for(_ in c=j.defaultProps,c)T[_]===void 0&&(T[_]=c[_]);return{$$typeof:f,type:j,key:D,ref:I,props:T,_owner:p.current}}return B.Fragment=m,B.jsx=x,B.jsxs=x,B}var U={};/** | ||
* @license React | ||
@@ -18,7 +18,7 @@ * react-jsx-runtime.development.js | ||
* LICENSE file in the root directory of this source tree. | ||
*/var je;function Ze(){return je||(je=1,process.env.NODE_ENV!=="production"&&function(){var n=v,c=Symbol.for("react.element"),m=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),x=Symbol.for("react.provider"),j=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),I=Symbol.for("react.offscreen"),Y=Symbol.iterator,V="@@iterator";function $(e){if(e===null||typeof e!="object")return null;var t=Y&&e[Y]||e[V];return typeof t=="function"?t:null}var k=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function E(e){{for(var t=arguments.length,a=new Array(t>1?t-1:0),i=1;i<t;i++)a[i-1]=arguments[i];Q("error",e,a)}}function Q(e,t,a){{var i=k.ReactDebugCurrentFrame,f=i.getStackAddendum();f!==""&&(t+="%s",a=a.concat([f]));var h=a.map(function(s){return String(s)});h.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,h)}}var P=!1,se=!1,ce=!1,L=!1,G=!1,J;J=Symbol.for("react.module.reference");function ue(e){return!!(typeof e=="string"||typeof e=="function"||e===g||e===d||G||e===p||e===C||e===_||L||e===I||P||se||ce||typeof e=="object"&&e!==null&&(e.$$typeof===F||e.$$typeof===T||e.$$typeof===x||e.$$typeof===j||e.$$typeof===u||e.$$typeof===J||e.getModuleId!==void 0))}function fe(e,t,a){var i=e.displayName;if(i)return i;var f=t.displayName||t.name||"";return f!==""?a+"("+f+")":a}function q(e){return e.displayName||"Context"}function D(e){if(e==null)return null;if(typeof e.tag=="number"&&E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case g:return"Fragment";case m:return"Portal";case d:return"Profiler";case p:return"StrictMode";case C:return"Suspense";case _:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case j:var t=e;return q(t)+".Consumer";case x:var a=e;return q(a._context)+".Provider";case u:return fe(e,e.render,"ForwardRef");case T:var i=e.displayName||null;return i!==null?i:D(e.type)||"Memo";case F:{var f=e,h=f._payload,s=f._init;try{return D(s(h))}catch{return null}}}return null}var A=Object.assign,l=0,y,N,de,H,K,ee,te;function Se(){}Se.__reactDisabledLog=!0;function $e(){{if(l===0){y=console.log,N=console.info,de=console.warn,H=console.error,K=console.group,ee=console.groupCollapsed,te=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Se,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}l++}}function Qe(){{if(l--,l===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:A({},e,{value:y}),info:A({},e,{value:N}),warn:A({},e,{value:de}),error:A({},e,{value:H}),group:A({},e,{value:K}),groupCollapsed:A({},e,{value:ee}),groupEnd:A({},e,{value:te})})}l<0&&E("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var he=k.ReactCurrentDispatcher,ve;function re(e,t,a){{if(ve===void 0)try{throw Error()}catch(f){var i=f.stack.trim().match(/\n( *(at )?)/);ve=i&&i[1]||""}return` | ||
`+ve+e}}var pe=!1,ae;{var qe=typeof WeakMap=="function"?WeakMap:Map;ae=new qe}function Te(e,t){if(!e||pe)return"";{var a=ae.get(e);if(a!==void 0)return a}var i;pe=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var h;h=he.current,he.current=null,$e();try{if(t){var s=function(){throw Error()};if(Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(z){i=z}Reflect.construct(e,[],s)}else{try{s.call()}catch(z){i=z}e.call(s.prototype)}}else{try{throw Error()}catch(z){i=z}e()}}catch(z){if(z&&i&&typeof z.stack=="string"){for(var o=z.stack.split(` | ||
*/var je;function Ze(){return je||(je=1,process.env.NODE_ENV!=="production"&&function(){var n=d,f=Symbol.for("react.element"),m=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),h=Symbol.for("react.profiler"),x=Symbol.for("react.provider"),j=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),I=Symbol.for("react.offscreen"),Y=Symbol.iterator,V="@@iterator";function Q(e){if(e===null||typeof e!="object")return null;var t=Y&&e[Y]||e[V];return typeof t=="function"?t:null}var k=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function E(e){{for(var t=arguments.length,a=new Array(t>1?t-1:0),i=1;i<t;i++)a[i-1]=arguments[i];$("error",e,a)}}function $(e,t,a){{var i=k.ReactDebugCurrentFrame,u=i.getStackAddendum();u!==""&&(t+="%s",a=a.concat([u]));var v=a.map(function(s){return String(s)});v.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,v)}}var P=!1,se=!1,ce=!1,L=!1,G=!1,J;J=Symbol.for("react.module.reference");function ue(e){return!!(typeof e=="string"||typeof e=="function"||e===g||e===h||G||e===p||e===C||e===_||L||e===I||P||se||ce||typeof e=="object"&&e!==null&&(e.$$typeof===D||e.$$typeof===T||e.$$typeof===x||e.$$typeof===j||e.$$typeof===c||e.$$typeof===J||e.getModuleId!==void 0))}function fe(e,t,a){var i=e.displayName;if(i)return i;var u=t.displayName||t.name||"";return u!==""?a+"("+u+")":a}function q(e){return e.displayName||"Context"}function F(e){if(e==null)return null;if(typeof e.tag=="number"&&E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case g:return"Fragment";case m:return"Portal";case h:return"Profiler";case p:return"StrictMode";case C:return"Suspense";case _:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case j:var t=e;return q(t)+".Consumer";case x:var a=e;return q(a._context)+".Provider";case c:return fe(e,e.render,"ForwardRef");case T:var i=e.displayName||null;return i!==null?i:F(e.type)||"Memo";case D:{var u=e,v=u._payload,s=u._init;try{return F(s(v))}catch{return null}}}return null}var A=Object.assign,l=0,y,N,de,H,K,ee,te;function Se(){}Se.__reactDisabledLog=!0;function Qe(){{if(l===0){y=console.log,N=console.info,de=console.warn,H=console.error,K=console.group,ee=console.groupCollapsed,te=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Se,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}l++}}function $e(){{if(l--,l===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:A({},e,{value:y}),info:A({},e,{value:N}),warn:A({},e,{value:de}),error:A({},e,{value:H}),group:A({},e,{value:K}),groupCollapsed:A({},e,{value:ee}),groupEnd:A({},e,{value:te})})}l<0&&E("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var he=k.ReactCurrentDispatcher,ve;function re(e,t,a){{if(ve===void 0)try{throw Error()}catch(u){var i=u.stack.trim().match(/\n( *(at )?)/);ve=i&&i[1]||""}return` | ||
`+ve+e}}var pe=!1,ae;{var qe=typeof WeakMap=="function"?WeakMap:Map;ae=new qe}function Te(e,t){if(!e||pe)return"";{var a=ae.get(e);if(a!==void 0)return a}var i;pe=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var v;v=he.current,he.current=null,Qe();try{if(t){var s=function(){throw Error()};if(Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(z){i=z}Reflect.construct(e,[],s)}else{try{s.call()}catch(z){i=z}e.call(s.prototype)}}else{try{throw Error()}catch(z){i=z}e()}}catch(z){if(z&&i&&typeof z.stack=="string"){for(var o=z.stack.split(` | ||
`),R=i.stack.split(` | ||
`),w=o.length-1,b=R.length-1;w>=1&&b>=0&&o[w]!==R[b];)b--;for(;w>=1&&b>=0;w--,b--)if(o[w]!==R[b]){if(w!==1||b!==1)do if(w--,b--,b<0||o[w]!==R[b]){var O=` | ||
`+o[w].replace(" at new "," at ");return e.displayName&&O.includes("<anonymous>")&&(O=O.replace("<anonymous>",e.displayName)),typeof e=="function"&&ae.set(e,O),O}while(w>=1&&b>=0);break}}}finally{pe=!1,he.current=h,Qe(),Error.prepareStackTrace=f}var W=e?e.displayName||e.name:"",Ve=W?re(W):"";return typeof e=="function"&&ae.set(e,Ve),Ve}function et(e,t,a){return Te(e,!1)}function tt(e){var t=e.prototype;return!!(t&&t.isReactComponent)}function ne(e,t,a){if(e==null)return"";if(typeof e=="function")return Te(e,tt(e));if(typeof e=="string")return re(e);switch(e){case C:return re("Suspense");case _:return re("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case u:return et(e.render);case T:return ne(e.type,t,a);case F:{var i=e,f=i._payload,h=i._init;try{return ne(h(f),t,a)}catch{}}}return""}var ie=Object.prototype.hasOwnProperty,ke={},Ce=k.ReactDebugCurrentFrame;function le(e){if(e){var t=e._owner,a=ne(e.type,e._source,t?t.type:null);Ce.setExtraStackFrame(a)}else Ce.setExtraStackFrame(null)}function rt(e,t,a,i,f){{var h=Function.call.bind(ie);for(var s in e)if(h(e,s)){var o=void 0;try{if(typeof e[s]!="function"){var R=Error((i||"React class")+": "+a+" type `"+s+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[s]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw R.name="Invariant Violation",R}o=e[s](t,s,i,a,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(w){o=w}o&&!(o instanceof Error)&&(le(f),E("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",i||"React class",a,s,typeof o),le(null)),o instanceof Error&&!(o.message in ke)&&(ke[o.message]=!0,le(f),E("Failed %s type: %s",a,o.message),le(null))}}}var at=Array.isArray;function me(e){return at(e)}function nt(e){{var t=typeof Symbol=="function"&&Symbol.toStringTag,a=t&&e[Symbol.toStringTag]||e.constructor.name||"Object";return a}}function it(e){try{return Ne(e),!1}catch{return!0}}function Ne(e){return""+e}function Oe(e){if(it(e))return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",nt(e)),Ne(e)}var X=k.ReactCurrentOwner,lt={key:!0,ref:!0,__self:!0,__source:!0},De,Fe,ge;ge={};function ot(e){if(ie.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return e.ref!==void 0}function st(e){if(ie.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function ct(e,t){if(typeof e.ref=="string"&&X.current&&t&&X.current.stateNode!==t){var a=D(X.current.type);ge[a]||(E('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',D(X.current.type),e.ref),ge[a]=!0)}}function ut(e,t){{var a=function(){De||(De=!0,E("%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://reactjs.org/link/special-props)",t))};a.isReactWarning=!0,Object.defineProperty(e,"key",{get:a,configurable:!0})}}function ft(e,t){{var a=function(){Fe||(Fe=!0,E("%s: `ref` 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://reactjs.org/link/special-props)",t))};a.isReactWarning=!0,Object.defineProperty(e,"ref",{get:a,configurable:!0})}}var dt=function(e,t,a,i,f,h,s){var o={$$typeof:c,type:e,key:t,ref:a,props:s,_owner:h};return o._store={},Object.defineProperty(o._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(o,"_self",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.defineProperty(o,"_source",{configurable:!1,enumerable:!1,writable:!1,value:f}),Object.freeze&&(Object.freeze(o.props),Object.freeze(o)),o};function ht(e,t,a,i,f){{var h,s={},o=null,R=null;a!==void 0&&(Oe(a),o=""+a),st(t)&&(Oe(t.key),o=""+t.key),ot(t)&&(R=t.ref,ct(t,f));for(h in t)ie.call(t,h)&&!lt.hasOwnProperty(h)&&(s[h]=t[h]);if(e&&e.defaultProps){var w=e.defaultProps;for(h in w)s[h]===void 0&&(s[h]=w[h])}if(o||R){var b=typeof e=="function"?e.displayName||e.name||"Unknown":e;o&&ut(s,b),R&&ft(s,b)}return dt(e,o,R,f,i,X.current,s)}}var xe=k.ReactCurrentOwner,Pe=k.ReactDebugCurrentFrame;function Z(e){if(e){var t=e._owner,a=ne(e.type,e._source,t?t.type:null);Pe.setExtraStackFrame(a)}else Pe.setExtraStackFrame(null)}var we;we=!1;function ye(e){return typeof e=="object"&&e!==null&&e.$$typeof===c}function Ae(){{if(xe.current){var e=D(xe.current.type);if(e)return` | ||
`+o[w].replace(" at new "," at ");return e.displayName&&O.includes("<anonymous>")&&(O=O.replace("<anonymous>",e.displayName)),typeof e=="function"&&ae.set(e,O),O}while(w>=1&&b>=0);break}}}finally{pe=!1,he.current=v,$e(),Error.prepareStackTrace=u}var W=e?e.displayName||e.name:"",Ve=W?re(W):"";return typeof e=="function"&&ae.set(e,Ve),Ve}function et(e,t,a){return Te(e,!1)}function tt(e){var t=e.prototype;return!!(t&&t.isReactComponent)}function ne(e,t,a){if(e==null)return"";if(typeof e=="function")return Te(e,tt(e));if(typeof e=="string")return re(e);switch(e){case C:return re("Suspense");case _:return re("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case c:return et(e.render);case T:return ne(e.type,t,a);case D:{var i=e,u=i._payload,v=i._init;try{return ne(v(u),t,a)}catch{}}}return""}var ie=Object.prototype.hasOwnProperty,ke={},Ce=k.ReactDebugCurrentFrame;function le(e){if(e){var t=e._owner,a=ne(e.type,e._source,t?t.type:null);Ce.setExtraStackFrame(a)}else Ce.setExtraStackFrame(null)}function rt(e,t,a,i,u){{var v=Function.call.bind(ie);for(var s in e)if(v(e,s)){var o=void 0;try{if(typeof e[s]!="function"){var R=Error((i||"React class")+": "+a+" type `"+s+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[s]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw R.name="Invariant Violation",R}o=e[s](t,s,i,a,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(w){o=w}o&&!(o instanceof Error)&&(le(u),E("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",i||"React class",a,s,typeof o),le(null)),o instanceof Error&&!(o.message in ke)&&(ke[o.message]=!0,le(u),E("Failed %s type: %s",a,o.message),le(null))}}}var at=Array.isArray;function me(e){return at(e)}function nt(e){{var t=typeof Symbol=="function"&&Symbol.toStringTag,a=t&&e[Symbol.toStringTag]||e.constructor.name||"Object";return a}}function it(e){try{return Ne(e),!1}catch{return!0}}function Ne(e){return""+e}function Oe(e){if(it(e))return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",nt(e)),Ne(e)}var X=k.ReactCurrentOwner,lt={key:!0,ref:!0,__self:!0,__source:!0},Fe,De,ge;ge={};function ot(e){if(ie.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return e.ref!==void 0}function st(e){if(ie.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function ct(e,t){if(typeof e.ref=="string"&&X.current&&t&&X.current.stateNode!==t){var a=F(X.current.type);ge[a]||(E('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',F(X.current.type),e.ref),ge[a]=!0)}}function ut(e,t){{var a=function(){Fe||(Fe=!0,E("%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://reactjs.org/link/special-props)",t))};a.isReactWarning=!0,Object.defineProperty(e,"key",{get:a,configurable:!0})}}function ft(e,t){{var a=function(){De||(De=!0,E("%s: `ref` 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://reactjs.org/link/special-props)",t))};a.isReactWarning=!0,Object.defineProperty(e,"ref",{get:a,configurable:!0})}}var dt=function(e,t,a,i,u,v,s){var o={$$typeof:f,type:e,key:t,ref:a,props:s,_owner:v};return o._store={},Object.defineProperty(o._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(o,"_self",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.defineProperty(o,"_source",{configurable:!1,enumerable:!1,writable:!1,value:u}),Object.freeze&&(Object.freeze(o.props),Object.freeze(o)),o};function ht(e,t,a,i,u){{var v,s={},o=null,R=null;a!==void 0&&(Oe(a),o=""+a),st(t)&&(Oe(t.key),o=""+t.key),ot(t)&&(R=t.ref,ct(t,u));for(v in t)ie.call(t,v)&&!lt.hasOwnProperty(v)&&(s[v]=t[v]);if(e&&e.defaultProps){var w=e.defaultProps;for(v in w)s[v]===void 0&&(s[v]=w[v])}if(o||R){var b=typeof e=="function"?e.displayName||e.name||"Unknown":e;o&&ut(s,b),R&&ft(s,b)}return dt(e,o,R,u,i,X.current,s)}}var xe=k.ReactCurrentOwner,Pe=k.ReactDebugCurrentFrame;function Z(e){if(e){var t=e._owner,a=ne(e.type,e._source,t?t.type:null);Pe.setExtraStackFrame(a)}else Pe.setExtraStackFrame(null)}var we;we=!1;function ye(e){return typeof e=="object"&&e!==null&&e.$$typeof===f}function Ae(){{if(xe.current){var e=F(xe.current.type);if(e)return` | ||
@@ -29,3 +29,3 @@ Check the render method of \``+e+"`."}return""}}function vt(e){{if(e!==void 0){var t=e.fileName.replace(/^.*[\\\/]/,""),a=e.lineNumber;return` | ||
Check the top-level render call using <`+a+">.")}return t}}function Le(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var a=pt(t);if(ze[a])return;ze[a]=!0;var i="";e&&e._owner&&e._owner!==xe.current&&(i=" It was passed a child from "+D(e._owner.type)+"."),Z(e),E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',a,i),Z(null)}}function Me(e,t){{if(typeof e!="object")return;if(me(e))for(var a=0;a<e.length;a++){var i=e[a];ye(i)&&Le(i,t)}else if(ye(e))e._store&&(e._store.validated=!0);else if(e){var f=$(e);if(typeof f=="function"&&f!==e.entries)for(var h=f.call(e),s;!(s=h.next()).done;)ye(s.value)&&Le(s.value,t)}}}function mt(e){{var t=e.type;if(t==null||typeof t=="string")return;var a;if(typeof t=="function")a=t.propTypes;else if(typeof t=="object"&&(t.$$typeof===u||t.$$typeof===T))a=t.propTypes;else return;if(a){var i=D(t);rt(a,e.props,"prop",i,e)}else if(t.PropTypes!==void 0&&!we){we=!0;var f=D(t);E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",f||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function gt(e){{for(var t=Object.keys(e.props),a=0;a<t.length;a++){var i=t[a];if(i!=="children"&&i!=="key"){Z(e),E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",i),Z(null);break}}e.ref!==null&&(Z(e),E("Invalid attribute `ref` supplied to `React.Fragment`."),Z(null))}}function Ie(e,t,a,i,f,h){{var s=ue(e);if(!s){var o="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(o+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var R=vt(f);R?o+=R:o+=Ae();var w;e===null?w="null":me(e)?w="array":e!==void 0&&e.$$typeof===c?(w="<"+(D(e.type)||"Unknown")+" />",o=" Did you accidentally export a JSX literal instead of a component?"):w=typeof e,E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",w,o)}var b=ht(e,t,a,f,h);if(b==null)return b;if(s){var O=t.children;if(O!==void 0)if(i)if(me(O)){for(var W=0;W<O.length;W++)Me(O[W],e);Object.freeze&&Object.freeze(O)}else E("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 Me(O,e)}return e===g?gt(b):mt(b),b}}function xt(e,t,a){return Ie(e,t,a,!0)}function wt(e,t,a){return Ie(e,t,a,!1)}var yt=wt,bt=xt;U.Fragment=g,U.jsx=yt,U.jsxs=bt}()),U}process.env.NODE_ENV==="production"?oe.exports=He():oe.exports=Ze();var r=oe.exports;const Ee=["image/jpeg","image/jpg","image/png","image/gif","image/tiff"],We=(n,c)=>{const m=n.fileData.length-1;switch(c.type){case"STORE_FILE_DATA":return{...n,fileData:c.payload.files};case"SET_COMPONENT_STATE":return{...n,componentState:c.payload};case"APPEND_FILE_DATA":return{...n,fileData:[...n.fileData,...c.payload.files]};case"STORE_FILE_STATE":return{...n,fileState:c.payload};case"REMOVE_FILE_DATA":return{...n,fileData:n.fileData.filter(j=>j.name!==c.payload.name)};case"GET_NEXT_FILE":const g=n.fileState.index+1;let p=g;return g>m&&(p=0),{...n,fileState:{zoom:!0,fileSrc:URL.createObjectURL(n.fileData[p]),index:p,isImage:Ee.includes(n.fileData[p].type),fileName:n.fileData[p].name,type:n.fileData[p].type,size:n.fileData[p].size}};case"GET_PREV_FILE":const d=n.fileState.index-1;let x=d;return d<0&&(x=m),{...n,fileState:{zoom:!0,fileSrc:URL.createObjectURL(n.fileData[x]),index:x,isImage:Ee.includes(n.fileData[x].type),fileName:n.fileData[x].name,type:n.fileData[x].type,size:n.fileData[x].size}};default:return n}},S=v.createContext({state:{fileData:[],fileState:{zoom:!1,fileSrc:null,index:0,isImage:!1,fileName:null,type:null,size:0},componentState:{showFileSize:!0,showSliderCount:!0,downloadFile:!0,removeFile:!0,rounded:!0,fileHeight:"h-32",fileWidth:"w-44"}},dispatch:()=>{}}),Be=({children:n})=>{const[c,m]=v.useReducer(We,{fileData:[],fileState:{zoom:!1,fileSrc:null,index:0,isImage:!1,fileName:null,type:null,size:0},componentState:{showFileSize:!0,showSliderCount:!0,downloadFile:!0,removeFile:!0,rounded:!0,fileHeight:"h-32",fileWidth:"w-44"}});return r.jsx(S.Provider,{value:{state:c,dispatch:m},children:n})},Ue=({file:n,fileSrc:c})=>{const[m,g]=v.useState(null);v.useEffect(()=>{n.size<1e6?g(Math.floor(n.size/1e3)+" KB"):g(Math.floor(n.size/1e6)+" MB")},[n.size]);const p=n.name.split(".");let d=p[0];const x=p.pop();d.length>20&&(d=d.substring(0,5)+".."+d.substring(d.length-3,d.length));const j=d+"."+x,u=v.useContext(S).state.componentState;return r.jsxs("div",{className:"relative ",children:[r.jsx("h5",{className:"text-[12px] mt-1 font-normal break-words dark:text-white",children:j}),u.showFileSize&&r.jsx("span",{"data-testid":"file-size",className:"text-[10px] dark:text-white",children:m}),u.downloadFile&&c&&r.jsx("a",{className:"float-right absolute top-1 right-0 text-gray-500 dark:text-white",href:c,target:"_blank",download:!0,rel:"noreferrer",children:r.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 16 16",children:[r.jsx("path",{d:"M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5z"}),r.jsx("path",{d:"M7.646 11.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V1.5a.5.5 0 0 0-1 0v8.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3z"})]})})]})},_e=[{type:"application/pdf",icon:r.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-10 fill-white",fill:"currentColor",viewBox:"0 0 16 16",children:[r.jsx("path",{d:"M5.523 10.424c.14-.082.293-.162.459-.238a7.878 7.878 0 0 1-.45.606c-.28.337-.498.516-.635.572a.266.266 0 0 1-.035.012.282.282 0 0 1-.026-.044c-.056-.11-.054-.216.04-.36.106-.165.319-.354.647-.548zm2.455-1.647c-.119.025-.237.05-.356.078a21.035 21.035 0 0 0 .5-1.05 11.96 11.96 0 0 0 .51.858c-.217.032-.436.07-.654.114zm2.525.939a3.888 3.888 0 0 1-.435-.41c.228.005.434.022.612.054.317.057.466.147.518.209a.095.095 0 0 1 .026.064.436.436 0 0 1-.06.2.307.307 0 0 1-.094.124.107.107 0 0 1-.069.015c-.09-.003-.258-.066-.498-.256zM8.278 4.97c-.04.244-.108.524-.2.829a4.86 4.86 0 0 1-.089-.346c-.076-.353-.087-.63-.046-.822.038-.177.11-.248.196-.283a.517.517 0 0 1 .145-.04c.013.03.028.092.032.198.005.122-.007.277-.038.465z"}),r.jsx("path",{fillRule:"evenodd",d:"M4 0h8a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2zm.165 11.668c.09.18.23.343.438.419.207.075.412.04.58-.03.318-.13.635-.436.926-.786.333-.401.683-.927 1.021-1.51a11.64 11.64 0 0 1 1.997-.406c.3.383.61.713.91.95.28.22.603.403.934.417a.856.856 0 0 0 .51-.138c.155-.101.27-.247.354-.416.09-.181.145-.37.138-.563a.844.844 0 0 0-.2-.518c-.226-.27-.596-.4-.96-.465a5.76 5.76 0 0 0-1.335-.05 10.954 10.954 0 0 1-.98-1.686c.25-.66.437-1.284.52-1.794.036-.218.055-.426.048-.614a1.238 1.238 0 0 0-.127-.538.7.7 0 0 0-.477-.365c-.202-.043-.41 0-.601.077-.377.15-.576.47-.651.823-.073.34-.04.736.046 1.136.088.406.238.848.43 1.295a19.707 19.707 0 0 1-1.062 2.227 7.662 7.662 0 0 0-1.482.645c-.37.22-.699.48-.897.787-.21.326-.275.714-.08 1.103z"})]}),color:"bg-red-500"},{type:"text/csv",icon:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-10 fill-white",fill:"currentColor",viewBox:"0 0 16 16",children:r.jsx("path",{fillRule:"evenodd",d:"M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM3.397 14.841a1.13 1.13 0 0 0 .401.823c.13.108.289.192.478.252.19.061.411.091.665.091.338 0 .624-.053.859-.158.236-.105.416-.252.539-.44.125-.189.187-.408.187-.656 0-.224-.045-.41-.134-.56a1.001 1.001 0 0 0-.375-.357 2.027 2.027 0 0 0-.566-.21l-.621-.144a.97.97 0 0 1-.404-.176.37.37 0 0 1-.144-.299c0-.156.062-.284.185-.384.125-.101.296-.152.512-.152.143 0 .266.023.37.068a.624.624 0 0 1 .246.181.56.56 0 0 1 .12.258h.75a1.092 1.092 0 0 0-.2-.566 1.21 1.21 0 0 0-.5-.41 1.813 1.813 0 0 0-.78-.152c-.293 0-.551.05-.776.15-.225.099-.4.24-.527.421-.127.182-.19.395-.19.639 0 .201.04.376.122.524.082.149.2.27.352.367.152.095.332.167.539.213l.618.144c.207.049.361.113.463.193a.387.387 0 0 1 .152.326.505.505 0 0 1-.085.29.559.559 0 0 1-.255.193c-.111.047-.249.07-.413.07-.117 0-.223-.013-.32-.04a.838.838 0 0 1-.248-.115.578.578 0 0 1-.255-.384h-.765ZM.806 13.693c0-.248.034-.46.102-.633a.868.868 0 0 1 .302-.399.814.814 0 0 1 .475-.137c.15 0 .283.032.398.097a.7.7 0 0 1 .272.26.85.85 0 0 1 .12.381h.765v-.072a1.33 1.33 0 0 0-.466-.964 1.441 1.441 0 0 0-.489-.272 1.838 1.838 0 0 0-.606-.097c-.356 0-.66.074-.911.223-.25.148-.44.359-.572.632-.13.274-.196.6-.196.979v.498c0 .379.064.704.193.976.131.271.322.48.572.626.25.145.554.217.914.217.293 0 .554-.055.785-.164.23-.11.414-.26.55-.454a1.27 1.27 0 0 0 .226-.674v-.076h-.764a.799.799 0 0 1-.118.363.7.7 0 0 1-.272.25.874.874 0 0 1-.401.087.845.845 0 0 1-.478-.132.833.833 0 0 1-.299-.392 1.699 1.699 0 0 1-.102-.627v-.495ZM6.78 15.29a1.176 1.176 0 0 1-.111-.449h.764a.578.578 0 0 0 .255.384c.07.049.154.087.25.114.095.028.201.041.319.041.164 0 .301-.023.413-.07a.559.559 0 0 0 .255-.193.507.507 0 0 0 .085-.29.387.387 0 0 0-.153-.326c-.101-.08-.256-.144-.463-.193l-.618-.143a1.72 1.72 0 0 1-.539-.214 1 1 0 0 1-.351-.367 1.068 1.068 0 0 1-.123-.524c0-.244.063-.457.19-.639.127-.181.303-.322.527-.422.225-.1.484-.149.777-.149.304 0 .564.05.779.152.217.102.384.239.5.41.12.17.187.359.2.566h-.75a.56.56 0 0 0-.12-.258.624.624 0 0 0-.246-.181.923.923 0 0 0-.37-.068c-.216 0-.387.05-.512.152a.472.472 0 0 0-.184.384c0 .121.047.22.143.3a.97.97 0 0 0 .404.175l.621.143c.217.05.406.12.566.211.16.09.285.21.375.358.09.148.135.335.135.56 0 .247-.063.466-.188.656a1.216 1.216 0 0 1-.539.439c-.234.105-.52.158-.858.158-.254 0-.476-.03-.665-.09a1.404 1.404 0 0 1-.478-.252 1.13 1.13 0 0 1-.29-.375Z"})}),color:"bg-emerald-600"},{type:"text/plain",icon:r.jsxs("svg",{"data-testid":"preview-icon",xmlns:"http://www.w3.org/2000/svg",className:"h-10 fill-white text-4xl",fill:"currentColor",viewBox:"0 0 16 16",children:[r.jsx("path",{d:"M5 4a.5.5 0 0 0 0 1h6a.5.5 0 0 0 0-1H5zm-.5 2.5A.5.5 0 0 1 5 6h6a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zM5 8a.5.5 0 0 0 0 1h6a.5.5 0 0 0 0-1H5zm0 2a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1H5z"}),r.jsx("path",{d:"M2 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2zm10-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1z"})]}),color:"bg-slate-500"},{type:"application/msword",icon:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-10 fill-white",fill:"currentColor",viewBox:"0 0 16 16",children:r.jsx("path",{fillRule:"evenodd",d:"M14 4.5V14a2 2 0 0 1-2 2v-1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5Zm-7.839 9.166v.522c0 .256-.039.47-.117.641a.861.861 0 0 1-.322.387.877.877 0 0 1-.469.126.883.883 0 0 1-.471-.126.868.868 0 0 1-.32-.386 1.55 1.55 0 0 1-.117-.642v-.522c0-.257.04-.471.117-.641a.868.868 0 0 1 .32-.387.868.868 0 0 1 .471-.129c.176 0 .332.043.469.13a.861.861 0 0 1 .322.386c.078.17.117.384.117.641Zm.803.519v-.513c0-.377-.068-.7-.205-.972a1.46 1.46 0 0 0-.589-.63c-.254-.147-.56-.22-.917-.22-.355 0-.662.073-.92.22a1.441 1.441 0 0 0-.589.627c-.136.271-.205.596-.205.975v.513c0 .375.069.7.205.973.137.271.333.48.59.627.257.144.564.216.92.216.357 0 .662-.072.916-.216.256-.147.452-.356.59-.627.136-.274.204-.598.204-.973ZM0 11.926v4h1.459c.402 0 .735-.08.999-.238a1.45 1.45 0 0 0 .595-.689c.13-.3.196-.662.196-1.084 0-.42-.065-.778-.196-1.075a1.426 1.426 0 0 0-.59-.68c-.263-.156-.598-.234-1.004-.234H0Zm.791.645h.563c.248 0 .45.05.609.152a.89.89 0 0 1 .354.454c.079.201.118.452.118.753a2.3 2.3 0 0 1-.068.592 1.141 1.141 0 0 1-.196.422.8.8 0 0 1-.334.252 1.298 1.298 0 0 1-.483.082H.79V12.57Zm7.422.483a1.732 1.732 0 0 0-.103.633v.495c0 .246.034.455.103.627a.834.834 0 0 0 .298.393.845.845 0 0 0 .478.131.868.868 0 0 0 .401-.088.699.699 0 0 0 .273-.248.8.8 0 0 0 .117-.364h.765v.076a1.268 1.268 0 0 1-.226.674c-.137.194-.32.345-.55.454a1.81 1.81 0 0 1-.786.164c-.36 0-.664-.072-.914-.216a1.424 1.424 0 0 1-.571-.627c-.13-.272-.194-.597-.194-.976v-.498c0-.379.066-.705.197-.978.13-.274.321-.485.571-.633.252-.149.556-.223.911-.223.219 0 .421.032.607.097.187.062.35.153.489.272a1.326 1.326 0 0 1 .466.964v.073H9.78a.85.85 0 0 0-.12-.38.7.7 0 0 0-.273-.261.802.802 0 0 0-.398-.097.814.814 0 0 0-.475.138.868.868 0 0 0-.301.398Z"})}),color:"bg-sky-600"},{type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",icon:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-10 fill-white",fill:"currentColor",viewBox:"0 0 16 16",children:r.jsx("path",{fillRule:"evenodd",d:"M14 4.5V11h-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5Zm-6.839 9.688v-.522a1.54 1.54 0 0 0-.117-.641.861.861 0 0 0-.322-.387.862.862 0 0 0-.469-.129.868.868 0 0 0-.471.13.868.868 0 0 0-.32.386 1.54 1.54 0 0 0-.117.641v.522c0 .256.04.47.117.641a.868.868 0 0 0 .32.387.883.883 0 0 0 .471.126.877.877 0 0 0 .469-.126.861.861 0 0 0 .322-.386 1.55 1.55 0 0 0 .117-.642Zm.803-.516v.513c0 .375-.068.7-.205.973a1.47 1.47 0 0 1-.589.627c-.254.144-.56.216-.917.216a1.86 1.86 0 0 1-.92-.216 1.463 1.463 0 0 1-.589-.627 2.151 2.151 0 0 1-.205-.973v-.513c0-.379.069-.704.205-.975.137-.274.333-.483.59-.627.257-.147.564-.22.92-.22.357 0 .662.073.916.22.256.146.452.356.59.63.136.271.204.595.204.972ZM1 15.925v-3.999h1.459c.406 0 .741.078 1.005.235.264.156.46.382.589.68.13.296.196.655.196 1.074 0 .422-.065.784-.196 1.084-.131.301-.33.53-.595.689-.264.158-.597.237-.999.237H1Zm1.354-3.354H1.79v2.707h.563c.185 0 .346-.028.483-.082a.8.8 0 0 0 .334-.252c.088-.114.153-.254.196-.422a2.3 2.3 0 0 0 .068-.592c0-.3-.04-.552-.118-.753a.89.89 0 0 0-.354-.454c-.158-.102-.361-.152-.61-.152Zm6.756 1.116c0-.248.034-.46.103-.633a.868.868 0 0 1 .301-.398.814.814 0 0 1 .475-.138c.15 0 .283.032.398.097a.7.7 0 0 1 .273.26.85.85 0 0 1 .12.381h.765v-.073a1.33 1.33 0 0 0-.466-.964 1.44 1.44 0 0 0-.49-.272 1.836 1.836 0 0 0-.606-.097c-.355 0-.66.074-.911.223-.25.148-.44.359-.571.633-.131.273-.197.6-.197.978v.498c0 .379.065.704.194.976.13.271.321.48.571.627.25.144.555.216.914.216.293 0 .555-.054.785-.164.23-.11.414-.26.551-.454a1.27 1.27 0 0 0 .226-.674v-.076h-.765a.8.8 0 0 1-.117.364.699.699 0 0 1-.273.248.874.874 0 0 1-.401.088.845.845 0 0 1-.478-.131.834.834 0 0 1-.298-.393 1.7 1.7 0 0 1-.103-.627v-.495Zm5.092-1.76h.894l-1.275 2.006 1.254 1.992h-.908l-.85-1.415h-.035l-.852 1.415h-.862l1.24-2.015-1.228-1.984h.932l.832 1.439h.035l.823-1.439Z"})}),color:"bg-sky-600"},{type:"application/vnd.ms-excel",icon:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-10 fill-white",fill:"currentColor",viewBox:"0 0 16 16",children:r.jsx("path",{fillRule:"evenodd",d:"M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM6.472 15.29a1.176 1.176 0 0 1-.111-.449h.765a.578.578 0 0 0 .254.384c.07.049.154.087.25.114.095.028.202.041.319.041.164 0 .302-.023.413-.07a.559.559 0 0 0 .255-.193.507.507 0 0 0 .085-.29.387.387 0 0 0-.153-.326c-.101-.08-.255-.144-.462-.193l-.619-.143a1.72 1.72 0 0 1-.539-.214 1.001 1.001 0 0 1-.351-.367 1.068 1.068 0 0 1-.123-.524c0-.244.063-.457.19-.639.127-.181.303-.322.527-.422.225-.1.484-.149.777-.149.305 0 .564.05.78.152.216.102.383.239.5.41.12.17.186.359.2.566h-.75a.56.56 0 0 0-.12-.258.625.625 0 0 0-.247-.181.923.923 0 0 0-.369-.068c-.217 0-.388.05-.513.152a.472.472 0 0 0-.184.384c0 .121.048.22.143.3a.97.97 0 0 0 .405.175l.62.143c.217.05.406.12.566.211a1 1 0 0 1 .375.358c.09.148.135.335.135.56 0 .247-.063.466-.188.656a1.216 1.216 0 0 1-.539.439c-.234.105-.52.158-.858.158-.254 0-.476-.03-.665-.09a1.404 1.404 0 0 1-.478-.252 1.13 1.13 0 0 1-.29-.375Zm-2.945-3.358h-.893L1.81 13.37h-.036l-.832-1.438h-.93l1.227 1.983L0 15.931h.861l.853-1.415h.035l.85 1.415h.908L2.253 13.94l1.274-2.007Zm2.727 3.325H4.557v-3.325h-.79v4h2.487v-.675Z"})}),color:"bg-emerald-600"},{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",icon:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-10 fill-white",fill:"currentColor",viewBox:"0 0 16 16",children:r.jsx("path",{fillRule:"evenodd",d:"M14 4.5V11h-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM7.86 14.841a1.13 1.13 0 0 0 .401.823c.13.108.29.192.479.252.19.061.411.091.665.091.338 0 .624-.053.858-.158.237-.105.416-.252.54-.44a1.17 1.17 0 0 0 .187-.656c0-.224-.045-.41-.135-.56a1.002 1.002 0 0 0-.375-.357 2.028 2.028 0 0 0-.565-.21l-.621-.144a.97.97 0 0 1-.405-.176.37.37 0 0 1-.143-.299c0-.156.061-.284.184-.384.125-.101.296-.152.513-.152.143 0 .266.023.37.068a.624.624 0 0 1 .245.181.56.56 0 0 1 .12.258h.75a1.093 1.093 0 0 0-.199-.566 1.21 1.21 0 0 0-.5-.41 1.813 1.813 0 0 0-.78-.152c-.293 0-.552.05-.777.15-.224.099-.4.24-.527.421-.127.182-.19.395-.19.639 0 .201.04.376.123.524.082.149.199.27.351.367.153.095.332.167.54.213l.618.144c.207.049.36.113.462.193a.387.387 0 0 1 .153.326.512.512 0 0 1-.085.29.558.558 0 0 1-.255.193c-.111.047-.25.07-.413.07-.117 0-.224-.013-.32-.04a.837.837 0 0 1-.249-.115.578.578 0 0 1-.255-.384h-.764Zm-3.726-2.909h.893l-1.274 2.007 1.254 1.992h-.908l-.85-1.415h-.035l-.853 1.415H1.5l1.24-2.016-1.228-1.983h.931l.832 1.438h.036l.823-1.438Zm1.923 3.325h1.697v.674H5.266v-3.999h.791v3.325Zm7.636-3.325h.893l-1.274 2.007 1.254 1.992h-.908l-.85-1.415h-.035l-.853 1.415h-.861l1.24-2.016-1.228-1.983h.931l.832 1.438h.036l.823-1.438Z"})}),color:"bg-emerald-600"}],Re=["image/jpeg","image/jpg","image/png","image/gif","image/tiff"],Ye=({file:n,index:c})=>{const[m,g]=v.useState(null);v.useEffect(()=>{const u=URL.createObjectURL(n);return g(u),()=>URL.revokeObjectURL(u)},[n]);const p=_e.filter(u=>u.type==n.type),d=v.useContext(S).state.componentState,{dispatch:x}=v.useContext(S),j=()=>{x({type:"STORE_FILE_STATE",payload:{zoom:!0,fileSrc:m,index:c,isImage:Re.includes(n.type),fileName:n.name,type:n.type,size:n.size}})};return r.jsxs(r.Fragment,{children:[r.jsx("div",{"data-testid":"file-preview",onClick:()=>j(),className:`${d.rounded&&"rounded-lg"} border-solid border-slate-200 hover:shadow-lg shadow-md hover:cursor-pointer`,children:Re.includes(n.type)?m&&r.jsx("img",{"data-testid":"image-preview",src:m,className:`${d.fileHeight} ${d.fileWidth} object-fill scale-[0.9]`}):r.jsx("div",{"data-testid":"file-icon-preview",className:`${d.fileHeight} ${d.fileWidth} flex flex-col justify-center content-center items-center`,children:r.jsx("span",{className:`${p.length>0?p[0].color:"bg-slate-400"} | ||
rounded flex w-16 justify-center h-20 items-center`,children:p.length>0?p[0].icon:r.jsxs("svg",{"data-testid":"default-icon",xmlns:"http://www.w3.org/2000/svg",className:"h-10 w-40 text-4xl",viewBox:"0 0 16 16",children:[r.jsx("path",{d:"M7 4.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0zm-.861 1.542 1.33.886 1.854-1.855a.25.25 0 0 1 .289-.047l1.888.974V7.5a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V7s1.54-1.274 1.639-1.208zM5 9a.5.5 0 0 0 0 1h6a.5.5 0 0 0 0-1H5zm0 2a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1H5z"}),r.jsx("path",{d:"M2 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2zm10-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1z"})]})})})}),r.jsx("div",{className:"h-5 w-44",children:m&&r.jsx(Ue,{file:n,fileSrc:m})})]})},Ge=()=>{const n=v.useContext(S).state.fileData,c=v.useContext(S).state.fileState;return r.jsx("div",{id:"slider-count",className:"absolute bottom-5 right-0 left-0 flex items-center justify-center z-50",children:(c==null?void 0:c.index)!==null&&r.jsx("div",{className:"text-white text-1xl",children:`${c.index+1} of ${n==null?void 0:n.length}`})})},Je=()=>{const n=v.useContext(S).state.fileState,c=v.useContext(S).state.componentState,m=_e.filter(u=>u.type===n.type),{dispatch:g}=v.useContext(S),p=()=>{g({type:"STORE_FILE_STATE",payload:{zoom:!1,fileSrc:null,index:0,isImage:!1,fileName:null,type:null,size:0}})},d=()=>{g({type:"GET_NEXT_FILE"})},x=()=>{g({type:"GET_PREV_FILE"})},j=()=>{const u=document.documentElement;document.fullscreenElement?document.exitFullscreen&&document.exitFullscreen():u.requestFullscreen&&u.requestFullscreen()};return n.zoom?r.jsx("div",{children:r.jsxs("div",{id:"slider",className:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-black bg-opacity-80 z-20",children:[r.jsxs("div",{id:"slider-header",className:"absolute top-0 left-0 right-0 flex justify-between items-center p-2 shadow-md shadow-gray-950 bg-black bg-opacity-80",children:[r.jsx("span",{className:"text-white flex-1 ml-14 max-sm:ml-1",children:n.fileName}),r.jsx("button",{className:"text-white text-sm flex items-center mr-4 max-sm:mr-1 hover:bg-white hover:text-black rounded-lg pl-2 pr-2 pt-1 pb-1",onClick:j,"aria-label":"toggle-fullscreen",children:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:"mr-1 h-4 stroke-2",viewBox:"0 0 16 16",children:r.jsx("path",{d:"M1.5 1a.5.5 0 0 0-.5.5v4a.5.5 0 0 1-1 0v-4A1.5 1.5 0 0 1 1.5 0h4a.5.5 0 0 1 0 1h-4zM10 .5a.5.5 0 0 1 .5-.5h4A1.5 1.5 0 0 1 16 1.5v4a.5.5 0 0 1-1 0v-4a.5.5 0 0 0-.5-.5h-4a.5.5 0 0 1-.5-.5zM.5 10a.5.5 0 0 1 .5.5v4a.5.5 0 0 0 .5.5h4a.5.5 0 0 1 0 1h-4A1.5 1.5 0 0 1 0 14.5v-4a.5.5 0 0 1 .5-.5zm15 0a.5.5 0 0 1 .5.5v4a1.5 1.5 0 0 1-1.5 1.5h-4a.5.5 0 0 1 0-1h4a.5.5 0 0 0 .5-.5v-4a.5.5 0 0 1 .5-.5z"})})}),n.fileSrc&&r.jsxs("a",{href:n.fileSrc,target:"_blank",download:!0,className:"text-white text-sm flex items-center mr-4 max-sm:mr-1 hover:bg-white hover:text-black rounded-lg pl-2 pr-2 pt-1 pb-1",children:[r.jsx("svg",{fill:"none",stroke:"currentColor",className:"mr-1 h-4 stroke-2",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"Download"]}),r.jsxs("button",{className:"text-white text-sm flex items-center mr-2 max-sm:mr-0 hover:bg-white hover:text-black rounded-lg pl-2 pr-2 pt-1 pb-1",onClick:p,children:[r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"mr-1 w-4 h-4",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"Close"]})]}),r.jsx("button",{id:"slider-prev-button",className:"absolute top-1/2 left-1 ml-2 p-1 max-sm:top-3/4 transform -translate-y-1/2 z-20 text-white rounded-full hover:bg-white hover:text-black",onClick:x,"data-testid":"prev-file",children:r.jsx("svg",{fill:"none",className:"h-10 w-10 stroke-white transform rotate-180 stroke-2 hover:stroke-black",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})})}),r.jsx("div",{id:"file-slider","data-testid":"image-slider",className:`${c.rounded&&"rounded-lg"} relative w-[130vh] max-sm:w-96 max-md:w-[75vh] h-[78vh] max-sm:h-52 max-md:h-80 bg-slate-400 overflow-hidden transition-all delay-750 ease-in`,children:n.isImage?n.fileSrc&&r.jsx("img",{className:"object-fit w-full h-full ",src:n.fileSrc,alt:"Zoomed Image"}):r.jsx("span",{className:"flex w-full h-full items-center justify-center text-4xl",children:r.jsx("span",{className:`${m.length>0?m[0].color:"bg-slate-400"} rounded flex justify-center w-48 h-48 items-center`,children:m.length>0?m[0].icon:r.jsxs("svg",{"data-testid":"default-icon",xmlns:"http://www.w3.org/2000/svg",className:"h-10 w-40 text-4xl",viewBox:"0 0 16 16",children:[r.jsx("path",{d:"M7 4.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0zm-.861 1.542 1.33.886 1.854-1.855a.25.25 0 0 1 .289-.047l1.888.974V7.5a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V7s1.54-1.274 1.639-1.208zM5 9a.5.5 0 0 0 0 1h6a.5.5 0 0 0 0-1H5zm0 2a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1H5z"}),r.jsx("path",{d:"M2 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2zm10-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1z"})]})})})}),r.jsx("button",{id:"slider-next-button",className:"absolute top-1/2 mr-2 p-1 right-1 max-sm:top-3/4 transform -translate-y-1/2 text-white rounded-full hover:bg-white hover:text-black",onClick:d,"data-testid":"next-file",children:r.jsx("svg",{fill:"none",className:" stroke-white h-10 w-10 stroke-2 hover:stroke-black",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})})}),c.showSliderCount?r.jsx(Ge,{}):r.jsx(r.Fragment,{})]})}):null},Ke=({files:n,url:c,downloadFile:m,removeFile:g,showFileSize:p,showSliderCount:d,multiple:x,accept:j,maxFileSize:u,maxFiles:C,width:_,rounded:T,height:F,fileHeight:I,fileWidth:Y,onChange:V,onRemove:$,onError:k,getFiles:E,onClick:Q})=>{const P=v.useContext(S).state.fileData,se=v.useContext(S).state.fileState,ce=v.useContext(S).state.componentState,{dispatch:L}=v.useContext(S),G=l=>{let y=!1;if(C&&(P.length+l.length>C||l.length>C))throw y=!0,k&&k(new Error(`Max ${C} files are allowed to be selected`)),new Error(`Max ${C} files are allowed to be selected`);return u&&l.forEach(N=>{if(N.size>u)throw y=!0,k&&k(new Error(`File size limit exceeded: ${N.name}`)),new Error(`File size limit exceeded: ${N.name}`)}),y};v.useEffect(()=>{async function l(){try{if(c){const N=[{type:"image/jpeg",ext:".jpg"},{type:"image/jpg",ext:".jpg"},{type:"image/png",ext:".png"},{type:"image/gif",ext:"gif"},{type:"image/tiff",ext:".tiff"}],H=await(await fetch(c)).blob();var y=null;const K=N.filter(te=>te.type===H.type);K.length>0&&(y=K[0].ext);const ee=new File([H],"file"+y,{type:H.type});L({type:"STORE_FILE_DATA",payload:{files:[ee]}})}}catch(N){if(N instanceof Error)throw k&&k(N),N}}l(),n&&n.length>0&&(G(n)||L({type:"APPEND_FILE_DATA",payload:{files:n}}))},[c,n]),v.useEffect(()=>{L({type:"SET_COMPONENT_STATE",payload:{downloadFile:m??!0,removeFile:g??!0,showFileSize:p??!0,showSliderCount:d??!0,rounded:T??!0,fileHeight:I??"h-32",fileWidth:Y??"w-44"}})},[m,g,p,d,I,Y,T]);const J=l=>{const y=Array.from(l.target.files||[]);G(y)||L({type:"APPEND_FILE_DATA",payload:{files:y}})},ue=l=>{L({type:"REMOVE_FILE_DATA",payload:l}),$&&$(l)},fe=l=>{Q&&Q(l)};E&&E(P);const q=l=>{l.preventDefault(),l.dataTransfer.dropEffect="copy"},D=l=>{l.preventDefault()},A=l=>{l.preventDefault();const y=Array.from(l.dataTransfer.files);y&&y.length>0&&(G(y)||L({type:"APPEND_FILE_DATA",payload:{files:y}}))};return se.zoom?r.jsx("div",{children:r.jsx(Je,{})}):r.jsx("div",{className:"w-full",children:r.jsx("div",{className:"flex flex-row max-h-2",children:r.jsxs("div",{className:`${_??"basis-11/12"} mx-auto`,children:[P.length>0?r.jsx("div",{children:r.jsxs("div",{className:"flex justify-between bg-gray-200 ",children:[r.jsx("div",{className:"h-10 text-sm pt-2 ml-2 font-medium",children:r.jsx("span",{className:"bg-gray-100 text-gray-800 text-sm font-medium mr-2 px-2.5 py-0.5 rounded dark:bg-gray-700 dark:text-gray-300",children:`Files: ${P.length}`})}),r.jsxs("label",{htmlFor:"fileInput",className:"cursor-pointer py-1 px-2 mt-1 mr-2 mb-1 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded-full border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700",children:["+ Add more",r.jsx("input",{id:"fileInput",type:"file",onChange:l=>{J(l),V&&V(l)},style:{display:"none"},multiple:x??!0,accept:j??""})]})]})}):r.jsx(r.Fragment,{}),r.jsx("div",{className:`${F&&`overflow-auto ${F}`} ${P.length==0&&"border-2 border-dashed border-gray-300 hover:bg-stone-200"} flex flex-row flex-wrap gap-4 p-6 bg-stone-100 shadow dark:bg-gray-800 `,onDragOver:q,onDragLeave:D,onDrop:A,"data-testid":"dropzone",children:P.length>0?P.map((l,y)=>r.jsxs("div",{className:"relative pb-5 group ",onClick:()=>fe(l),children:[r.jsx("div",{className:"ml-9",children:ce.removeFile?r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg","data-testid":"remove-file-button",onClick:()=>ue(l),className:"absolute -top-2 right-0 z-10 text-black opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer h-5 w-5",fill:"currentColor",viewBox:"0 0 16 16",children:r.jsx("path",{d:"M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293 5.354 4.646z"})}):r.jsx(r.Fragment,{})}),r.jsx("div",{className:"clear-right",children:r.jsx(Ye,{file:l,index:y})})]},y)):r.jsxs("label",{htmlFor:"fileInput",className:"mx-auto cursor-pointer flex items-center ",children:["Drop files here, or click to browse files",r.jsx("input",{id:"fileInput",type:"file",onChange:l=>{J(l),V&&V(l)},multiple:x??!0,accept:j??"",style:{display:"none"}})]})})]})})})},jt="",Xe=n=>r.jsx(Be,{children:r.jsx(Ke,{...n})});M.ReactFilesPreview=Xe,Object.defineProperty(M,Symbol.toStringTag,{value:"Module"})}); | ||
Check the top-level render call using <`+a+">.")}return t}}function Le(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var a=pt(t);if(ze[a])return;ze[a]=!0;var i="";e&&e._owner&&e._owner!==xe.current&&(i=" It was passed a child from "+F(e._owner.type)+"."),Z(e),E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',a,i),Z(null)}}function Me(e,t){{if(typeof e!="object")return;if(me(e))for(var a=0;a<e.length;a++){var i=e[a];ye(i)&&Le(i,t)}else if(ye(e))e._store&&(e._store.validated=!0);else if(e){var u=Q(e);if(typeof u=="function"&&u!==e.entries)for(var v=u.call(e),s;!(s=v.next()).done;)ye(s.value)&&Le(s.value,t)}}}function mt(e){{var t=e.type;if(t==null||typeof t=="string")return;var a;if(typeof t=="function")a=t.propTypes;else if(typeof t=="object"&&(t.$$typeof===c||t.$$typeof===T))a=t.propTypes;else return;if(a){var i=F(t);rt(a,e.props,"prop",i,e)}else if(t.PropTypes!==void 0&&!we){we=!0;var u=F(t);E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",u||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function gt(e){{for(var t=Object.keys(e.props),a=0;a<t.length;a++){var i=t[a];if(i!=="children"&&i!=="key"){Z(e),E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",i),Z(null);break}}e.ref!==null&&(Z(e),E("Invalid attribute `ref` supplied to `React.Fragment`."),Z(null))}}function Ie(e,t,a,i,u,v){{var s=ue(e);if(!s){var o="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(o+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var R=vt(u);R?o+=R:o+=Ae();var w;e===null?w="null":me(e)?w="array":e!==void 0&&e.$$typeof===f?(w="<"+(F(e.type)||"Unknown")+" />",o=" Did you accidentally export a JSX literal instead of a component?"):w=typeof e,E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",w,o)}var b=ht(e,t,a,u,v);if(b==null)return b;if(s){var O=t.children;if(O!==void 0)if(i)if(me(O)){for(var W=0;W<O.length;W++)Me(O[W],e);Object.freeze&&Object.freeze(O)}else E("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 Me(O,e)}return e===g?gt(b):mt(b),b}}function xt(e,t,a){return Ie(e,t,a,!0)}function wt(e,t,a){return Ie(e,t,a,!1)}var yt=wt,bt=xt;U.Fragment=g,U.jsx=yt,U.jsxs=bt}()),U}process.env.NODE_ENV==="production"?oe.exports=He():oe.exports=Ze();var r=oe.exports;const Ee=["image/jpeg","image/jpg","image/png","image/gif","image/tiff"],We=(n,f)=>{const m=n.fileData.length-1;switch(f.type){case"STORE_FILE_DATA":return{...n,fileData:f.payload.files};case"SET_COMPONENT_STATE":return{...n,componentState:f.payload};case"APPEND_FILE_DATA":return{...n,fileData:[...n.fileData,...f.payload.files]};case"STORE_FILE_STATE":return{...n,fileState:f.payload};case"REMOVE_FILE_DATA":return{...n,fileData:n.fileData.filter(j=>j.name!==f.payload.name)};case"GET_NEXT_FILE":const g=n.fileState.index+1;let p=g;return g>m&&(p=0),{...n,fileState:{zoom:!0,fileSrc:URL.createObjectURL(n.fileData[p]),index:p,isImage:Ee.includes(n.fileData[p].type),fileName:n.fileData[p].name,type:n.fileData[p].type,size:n.fileData[p].size}};case"GET_PREV_FILE":const h=n.fileState.index-1;let x=h;return h<0&&(x=m),{...n,fileState:{zoom:!0,fileSrc:URL.createObjectURL(n.fileData[x]),index:x,isImage:Ee.includes(n.fileData[x].type),fileName:n.fileData[x].name,type:n.fileData[x].type,size:n.fileData[x].size}};default:return n}},S=d.createContext({state:{fileData:[],fileState:{zoom:!1,fileSrc:null,index:0,isImage:!1,fileName:null,type:null,size:0},componentState:{showFileSize:!0,showSliderCount:!0,downloadFile:!0,removeFile:!0,rounded:!0,fileHeight:"h-32",fileWidth:"w-44"}},dispatch:()=>{}}),Be=({children:n})=>{const[f,m]=d.useReducer(We,{fileData:[],fileState:{zoom:!1,fileSrc:null,index:0,isImage:!1,fileName:null,type:null,size:0},componentState:{showFileSize:!0,showSliderCount:!0,downloadFile:!0,removeFile:!0,rounded:!0,fileHeight:"h-32",fileWidth:"w-44"}});return r.jsx(S.Provider,{value:{state:f,dispatch:m},children:n})},Ue=({file:n,fileSrc:f})=>{const[m,g]=d.useState(null);d.useEffect(()=>{n.size<1e6?g(Math.floor(n.size/1e3)+" KB"):g(Math.floor(n.size/1e6)+" MB")},[n.size]);const p=n.name.split(".");let h=p[0];const x=p.pop();h.length>20&&(h=h.substring(0,5)+".."+h.substring(h.length-3,h.length));const j=h+"."+x,c=d.useContext(S).state.componentState;return r.jsxs("div",{className:"relative ",children:[r.jsx("h5",{className:"text-[12px] mt-1 font-normal break-words dark:text-white",children:j}),c.showFileSize&&r.jsx("span",{"data-testid":"file-size",className:"text-[10px] dark:text-white",children:m}),c.downloadFile&&f&&r.jsx("a",{className:"float-right absolute top-1 right-0 text-gray-500 dark:text-white",href:f,target:"_blank",download:!0,rel:"noreferrer",children:r.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 16 16",children:[r.jsx("path",{d:"M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5z"}),r.jsx("path",{d:"M7.646 11.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V1.5a.5.5 0 0 0-1 0v8.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3z"})]})})]})},_e=[{type:"application/pdf",icon:r.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-10 fill-white",fill:"currentColor",viewBox:"0 0 16 16",children:[r.jsx("path",{d:"M5.523 10.424c.14-.082.293-.162.459-.238a7.878 7.878 0 0 1-.45.606c-.28.337-.498.516-.635.572a.266.266 0 0 1-.035.012.282.282 0 0 1-.026-.044c-.056-.11-.054-.216.04-.36.106-.165.319-.354.647-.548zm2.455-1.647c-.119.025-.237.05-.356.078a21.035 21.035 0 0 0 .5-1.05 11.96 11.96 0 0 0 .51.858c-.217.032-.436.07-.654.114zm2.525.939a3.888 3.888 0 0 1-.435-.41c.228.005.434.022.612.054.317.057.466.147.518.209a.095.095 0 0 1 .026.064.436.436 0 0 1-.06.2.307.307 0 0 1-.094.124.107.107 0 0 1-.069.015c-.09-.003-.258-.066-.498-.256zM8.278 4.97c-.04.244-.108.524-.2.829a4.86 4.86 0 0 1-.089-.346c-.076-.353-.087-.63-.046-.822.038-.177.11-.248.196-.283a.517.517 0 0 1 .145-.04c.013.03.028.092.032.198.005.122-.007.277-.038.465z"}),r.jsx("path",{fillRule:"evenodd",d:"M4 0h8a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2zm.165 11.668c.09.18.23.343.438.419.207.075.412.04.58-.03.318-.13.635-.436.926-.786.333-.401.683-.927 1.021-1.51a11.64 11.64 0 0 1 1.997-.406c.3.383.61.713.91.95.28.22.603.403.934.417a.856.856 0 0 0 .51-.138c.155-.101.27-.247.354-.416.09-.181.145-.37.138-.563a.844.844 0 0 0-.2-.518c-.226-.27-.596-.4-.96-.465a5.76 5.76 0 0 0-1.335-.05 10.954 10.954 0 0 1-.98-1.686c.25-.66.437-1.284.52-1.794.036-.218.055-.426.048-.614a1.238 1.238 0 0 0-.127-.538.7.7 0 0 0-.477-.365c-.202-.043-.41 0-.601.077-.377.15-.576.47-.651.823-.073.34-.04.736.046 1.136.088.406.238.848.43 1.295a19.707 19.707 0 0 1-1.062 2.227 7.662 7.662 0 0 0-1.482.645c-.37.22-.699.48-.897.787-.21.326-.275.714-.08 1.103z"})]}),color:"bg-red-500"},{type:"text/csv",icon:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-10 fill-white",fill:"currentColor",viewBox:"0 0 16 16",children:r.jsx("path",{fillRule:"evenodd",d:"M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM3.397 14.841a1.13 1.13 0 0 0 .401.823c.13.108.289.192.478.252.19.061.411.091.665.091.338 0 .624-.053.859-.158.236-.105.416-.252.539-.44.125-.189.187-.408.187-.656 0-.224-.045-.41-.134-.56a1.001 1.001 0 0 0-.375-.357 2.027 2.027 0 0 0-.566-.21l-.621-.144a.97.97 0 0 1-.404-.176.37.37 0 0 1-.144-.299c0-.156.062-.284.185-.384.125-.101.296-.152.512-.152.143 0 .266.023.37.068a.624.624 0 0 1 .246.181.56.56 0 0 1 .12.258h.75a1.092 1.092 0 0 0-.2-.566 1.21 1.21 0 0 0-.5-.41 1.813 1.813 0 0 0-.78-.152c-.293 0-.551.05-.776.15-.225.099-.4.24-.527.421-.127.182-.19.395-.19.639 0 .201.04.376.122.524.082.149.2.27.352.367.152.095.332.167.539.213l.618.144c.207.049.361.113.463.193a.387.387 0 0 1 .152.326.505.505 0 0 1-.085.29.559.559 0 0 1-.255.193c-.111.047-.249.07-.413.07-.117 0-.223-.013-.32-.04a.838.838 0 0 1-.248-.115.578.578 0 0 1-.255-.384h-.765ZM.806 13.693c0-.248.034-.46.102-.633a.868.868 0 0 1 .302-.399.814.814 0 0 1 .475-.137c.15 0 .283.032.398.097a.7.7 0 0 1 .272.26.85.85 0 0 1 .12.381h.765v-.072a1.33 1.33 0 0 0-.466-.964 1.441 1.441 0 0 0-.489-.272 1.838 1.838 0 0 0-.606-.097c-.356 0-.66.074-.911.223-.25.148-.44.359-.572.632-.13.274-.196.6-.196.979v.498c0 .379.064.704.193.976.131.271.322.48.572.626.25.145.554.217.914.217.293 0 .554-.055.785-.164.23-.11.414-.26.55-.454a1.27 1.27 0 0 0 .226-.674v-.076h-.764a.799.799 0 0 1-.118.363.7.7 0 0 1-.272.25.874.874 0 0 1-.401.087.845.845 0 0 1-.478-.132.833.833 0 0 1-.299-.392 1.699 1.699 0 0 1-.102-.627v-.495ZM6.78 15.29a1.176 1.176 0 0 1-.111-.449h.764a.578.578 0 0 0 .255.384c.07.049.154.087.25.114.095.028.201.041.319.041.164 0 .301-.023.413-.07a.559.559 0 0 0 .255-.193.507.507 0 0 0 .085-.29.387.387 0 0 0-.153-.326c-.101-.08-.256-.144-.463-.193l-.618-.143a1.72 1.72 0 0 1-.539-.214 1 1 0 0 1-.351-.367 1.068 1.068 0 0 1-.123-.524c0-.244.063-.457.19-.639.127-.181.303-.322.527-.422.225-.1.484-.149.777-.149.304 0 .564.05.779.152.217.102.384.239.5.41.12.17.187.359.2.566h-.75a.56.56 0 0 0-.12-.258.624.624 0 0 0-.246-.181.923.923 0 0 0-.37-.068c-.216 0-.387.05-.512.152a.472.472 0 0 0-.184.384c0 .121.047.22.143.3a.97.97 0 0 0 .404.175l.621.143c.217.05.406.12.566.211.16.09.285.21.375.358.09.148.135.335.135.56 0 .247-.063.466-.188.656a1.216 1.216 0 0 1-.539.439c-.234.105-.52.158-.858.158-.254 0-.476-.03-.665-.09a1.404 1.404 0 0 1-.478-.252 1.13 1.13 0 0 1-.29-.375Z"})}),color:"bg-emerald-600"},{type:"text/plain",icon:r.jsxs("svg",{"data-testid":"preview-icon",xmlns:"http://www.w3.org/2000/svg",className:"h-10 fill-white text-4xl",fill:"currentColor",viewBox:"0 0 16 16",children:[r.jsx("path",{d:"M5 4a.5.5 0 0 0 0 1h6a.5.5 0 0 0 0-1H5zm-.5 2.5A.5.5 0 0 1 5 6h6a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zM5 8a.5.5 0 0 0 0 1h6a.5.5 0 0 0 0-1H5zm0 2a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1H5z"}),r.jsx("path",{d:"M2 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2zm10-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1z"})]}),color:"bg-slate-500"},{type:"application/msword",icon:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-10 fill-white",fill:"currentColor",viewBox:"0 0 16 16",children:r.jsx("path",{fillRule:"evenodd",d:"M14 4.5V14a2 2 0 0 1-2 2v-1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5Zm-7.839 9.166v.522c0 .256-.039.47-.117.641a.861.861 0 0 1-.322.387.877.877 0 0 1-.469.126.883.883 0 0 1-.471-.126.868.868 0 0 1-.32-.386 1.55 1.55 0 0 1-.117-.642v-.522c0-.257.04-.471.117-.641a.868.868 0 0 1 .32-.387.868.868 0 0 1 .471-.129c.176 0 .332.043.469.13a.861.861 0 0 1 .322.386c.078.17.117.384.117.641Zm.803.519v-.513c0-.377-.068-.7-.205-.972a1.46 1.46 0 0 0-.589-.63c-.254-.147-.56-.22-.917-.22-.355 0-.662.073-.92.22a1.441 1.441 0 0 0-.589.627c-.136.271-.205.596-.205.975v.513c0 .375.069.7.205.973.137.271.333.48.59.627.257.144.564.216.92.216.357 0 .662-.072.916-.216.256-.147.452-.356.59-.627.136-.274.204-.598.204-.973ZM0 11.926v4h1.459c.402 0 .735-.08.999-.238a1.45 1.45 0 0 0 .595-.689c.13-.3.196-.662.196-1.084 0-.42-.065-.778-.196-1.075a1.426 1.426 0 0 0-.59-.68c-.263-.156-.598-.234-1.004-.234H0Zm.791.645h.563c.248 0 .45.05.609.152a.89.89 0 0 1 .354.454c.079.201.118.452.118.753a2.3 2.3 0 0 1-.068.592 1.141 1.141 0 0 1-.196.422.8.8 0 0 1-.334.252 1.298 1.298 0 0 1-.483.082H.79V12.57Zm7.422.483a1.732 1.732 0 0 0-.103.633v.495c0 .246.034.455.103.627a.834.834 0 0 0 .298.393.845.845 0 0 0 .478.131.868.868 0 0 0 .401-.088.699.699 0 0 0 .273-.248.8.8 0 0 0 .117-.364h.765v.076a1.268 1.268 0 0 1-.226.674c-.137.194-.32.345-.55.454a1.81 1.81 0 0 1-.786.164c-.36 0-.664-.072-.914-.216a1.424 1.424 0 0 1-.571-.627c-.13-.272-.194-.597-.194-.976v-.498c0-.379.066-.705.197-.978.13-.274.321-.485.571-.633.252-.149.556-.223.911-.223.219 0 .421.032.607.097.187.062.35.153.489.272a1.326 1.326 0 0 1 .466.964v.073H9.78a.85.85 0 0 0-.12-.38.7.7 0 0 0-.273-.261.802.802 0 0 0-.398-.097.814.814 0 0 0-.475.138.868.868 0 0 0-.301.398Z"})}),color:"bg-sky-600"},{type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",icon:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-10 fill-white",fill:"currentColor",viewBox:"0 0 16 16",children:r.jsx("path",{fillRule:"evenodd",d:"M14 4.5V11h-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5Zm-6.839 9.688v-.522a1.54 1.54 0 0 0-.117-.641.861.861 0 0 0-.322-.387.862.862 0 0 0-.469-.129.868.868 0 0 0-.471.13.868.868 0 0 0-.32.386 1.54 1.54 0 0 0-.117.641v.522c0 .256.04.47.117.641a.868.868 0 0 0 .32.387.883.883 0 0 0 .471.126.877.877 0 0 0 .469-.126.861.861 0 0 0 .322-.386 1.55 1.55 0 0 0 .117-.642Zm.803-.516v.513c0 .375-.068.7-.205.973a1.47 1.47 0 0 1-.589.627c-.254.144-.56.216-.917.216a1.86 1.86 0 0 1-.92-.216 1.463 1.463 0 0 1-.589-.627 2.151 2.151 0 0 1-.205-.973v-.513c0-.379.069-.704.205-.975.137-.274.333-.483.59-.627.257-.147.564-.22.92-.22.357 0 .662.073.916.22.256.146.452.356.59.63.136.271.204.595.204.972ZM1 15.925v-3.999h1.459c.406 0 .741.078 1.005.235.264.156.46.382.589.68.13.296.196.655.196 1.074 0 .422-.065.784-.196 1.084-.131.301-.33.53-.595.689-.264.158-.597.237-.999.237H1Zm1.354-3.354H1.79v2.707h.563c.185 0 .346-.028.483-.082a.8.8 0 0 0 .334-.252c.088-.114.153-.254.196-.422a2.3 2.3 0 0 0 .068-.592c0-.3-.04-.552-.118-.753a.89.89 0 0 0-.354-.454c-.158-.102-.361-.152-.61-.152Zm6.756 1.116c0-.248.034-.46.103-.633a.868.868 0 0 1 .301-.398.814.814 0 0 1 .475-.138c.15 0 .283.032.398.097a.7.7 0 0 1 .273.26.85.85 0 0 1 .12.381h.765v-.073a1.33 1.33 0 0 0-.466-.964 1.44 1.44 0 0 0-.49-.272 1.836 1.836 0 0 0-.606-.097c-.355 0-.66.074-.911.223-.25.148-.44.359-.571.633-.131.273-.197.6-.197.978v.498c0 .379.065.704.194.976.13.271.321.48.571.627.25.144.555.216.914.216.293 0 .555-.054.785-.164.23-.11.414-.26.551-.454a1.27 1.27 0 0 0 .226-.674v-.076h-.765a.8.8 0 0 1-.117.364.699.699 0 0 1-.273.248.874.874 0 0 1-.401.088.845.845 0 0 1-.478-.131.834.834 0 0 1-.298-.393 1.7 1.7 0 0 1-.103-.627v-.495Zm5.092-1.76h.894l-1.275 2.006 1.254 1.992h-.908l-.85-1.415h-.035l-.852 1.415h-.862l1.24-2.015-1.228-1.984h.932l.832 1.439h.035l.823-1.439Z"})}),color:"bg-sky-600"},{type:"application/vnd.ms-excel",icon:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-10 fill-white",fill:"currentColor",viewBox:"0 0 16 16",children:r.jsx("path",{fillRule:"evenodd",d:"M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM6.472 15.29a1.176 1.176 0 0 1-.111-.449h.765a.578.578 0 0 0 .254.384c.07.049.154.087.25.114.095.028.202.041.319.041.164 0 .302-.023.413-.07a.559.559 0 0 0 .255-.193.507.507 0 0 0 .085-.29.387.387 0 0 0-.153-.326c-.101-.08-.255-.144-.462-.193l-.619-.143a1.72 1.72 0 0 1-.539-.214 1.001 1.001 0 0 1-.351-.367 1.068 1.068 0 0 1-.123-.524c0-.244.063-.457.19-.639.127-.181.303-.322.527-.422.225-.1.484-.149.777-.149.305 0 .564.05.78.152.216.102.383.239.5.41.12.17.186.359.2.566h-.75a.56.56 0 0 0-.12-.258.625.625 0 0 0-.247-.181.923.923 0 0 0-.369-.068c-.217 0-.388.05-.513.152a.472.472 0 0 0-.184.384c0 .121.048.22.143.3a.97.97 0 0 0 .405.175l.62.143c.217.05.406.12.566.211a1 1 0 0 1 .375.358c.09.148.135.335.135.56 0 .247-.063.466-.188.656a1.216 1.216 0 0 1-.539.439c-.234.105-.52.158-.858.158-.254 0-.476-.03-.665-.09a1.404 1.404 0 0 1-.478-.252 1.13 1.13 0 0 1-.29-.375Zm-2.945-3.358h-.893L1.81 13.37h-.036l-.832-1.438h-.93l1.227 1.983L0 15.931h.861l.853-1.415h.035l.85 1.415h.908L2.253 13.94l1.274-2.007Zm2.727 3.325H4.557v-3.325h-.79v4h2.487v-.675Z"})}),color:"bg-emerald-600"},{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",icon:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-10 fill-white",fill:"currentColor",viewBox:"0 0 16 16",children:r.jsx("path",{fillRule:"evenodd",d:"M14 4.5V11h-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM7.86 14.841a1.13 1.13 0 0 0 .401.823c.13.108.29.192.479.252.19.061.411.091.665.091.338 0 .624-.053.858-.158.237-.105.416-.252.54-.44a1.17 1.17 0 0 0 .187-.656c0-.224-.045-.41-.135-.56a1.002 1.002 0 0 0-.375-.357 2.028 2.028 0 0 0-.565-.21l-.621-.144a.97.97 0 0 1-.405-.176.37.37 0 0 1-.143-.299c0-.156.061-.284.184-.384.125-.101.296-.152.513-.152.143 0 .266.023.37.068a.624.624 0 0 1 .245.181.56.56 0 0 1 .12.258h.75a1.093 1.093 0 0 0-.199-.566 1.21 1.21 0 0 0-.5-.41 1.813 1.813 0 0 0-.78-.152c-.293 0-.552.05-.777.15-.224.099-.4.24-.527.421-.127.182-.19.395-.19.639 0 .201.04.376.123.524.082.149.199.27.351.367.153.095.332.167.54.213l.618.144c.207.049.36.113.462.193a.387.387 0 0 1 .153.326.512.512 0 0 1-.085.29.558.558 0 0 1-.255.193c-.111.047-.25.07-.413.07-.117 0-.224-.013-.32-.04a.837.837 0 0 1-.249-.115.578.578 0 0 1-.255-.384h-.764Zm-3.726-2.909h.893l-1.274 2.007 1.254 1.992h-.908l-.85-1.415h-.035l-.853 1.415H1.5l1.24-2.016-1.228-1.983h.931l.832 1.438h.036l.823-1.438Zm1.923 3.325h1.697v.674H5.266v-3.999h.791v3.325Zm7.636-3.325h.893l-1.274 2.007 1.254 1.992h-.908l-.85-1.415h-.035l-.853 1.415h-.861l1.24-2.016-1.228-1.983h.931l.832 1.438h.036l.823-1.438Z"})}),color:"bg-emerald-600"}],Re=["image/jpeg","image/jpg","image/png","image/gif","image/tiff"],Ye=({file:n,index:f})=>{const[m,g]=d.useState(null);d.useEffect(()=>{const c=URL.createObjectURL(n);return g(c),()=>URL.revokeObjectURL(c)},[n]);const p=_e.filter(c=>c.type==n.type),h=d.useContext(S).state.componentState,{dispatch:x}=d.useContext(S),j=()=>{x({type:"STORE_FILE_STATE",payload:{zoom:!0,fileSrc:m,index:f,isImage:Re.includes(n.type),fileName:n.name,type:n.type,size:n.size}})};return r.jsxs(r.Fragment,{children:[r.jsx("div",{"data-testid":"file-preview",onClick:()=>j(),className:`${h.rounded&&"rounded-lg"} border-solid border-slate-200 hover:shadow-lg shadow-md hover:cursor-pointer`,children:Re.includes(n.type)?m&&r.jsx("img",{"data-testid":"image-preview",src:m,className:`${h.fileHeight} ${h.fileWidth} object-fill scale-[0.9]`}):r.jsx("div",{"data-testid":"file-icon-preview",className:`${h.fileHeight} ${h.fileWidth} flex flex-col justify-center content-center items-center`,children:r.jsx("span",{className:`${p.length>0?p[0].color:"bg-slate-400"} | ||
rounded flex w-16 justify-center h-20 items-center`,children:p.length>0?p[0].icon:r.jsxs("svg",{"data-testid":"default-icon",xmlns:"http://www.w3.org/2000/svg",className:"h-10 w-40 text-4xl",viewBox:"0 0 16 16",children:[r.jsx("path",{d:"M7 4.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0zm-.861 1.542 1.33.886 1.854-1.855a.25.25 0 0 1 .289-.047l1.888.974V7.5a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V7s1.54-1.274 1.639-1.208zM5 9a.5.5 0 0 0 0 1h6a.5.5 0 0 0 0-1H5zm0 2a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1H5z"}),r.jsx("path",{d:"M2 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2zm10-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1z"})]})})})}),r.jsx("div",{className:"h-5 w-44",children:m&&r.jsx(Ue,{file:n,fileSrc:m})})]})},Ge=()=>{const n=d.useContext(S).state.fileData,f=d.useContext(S).state.fileState;return r.jsx("div",{id:"slider-count",className:"absolute bottom-5 right-0 left-0 flex items-center justify-center z-50",children:(f==null?void 0:f.index)!==null&&r.jsx("div",{className:"text-white text-1xl",children:`${f.index+1} of ${n==null?void 0:n.length}`})})},Je=()=>{const n=d.useContext(S).state.fileState,f=d.useContext(S).state.componentState,m=_e.filter(c=>c.type===n.type),{dispatch:g}=d.useContext(S),p=()=>{g({type:"STORE_FILE_STATE",payload:{zoom:!1,fileSrc:null,index:0,isImage:!1,fileName:null,type:null,size:0}})},h=()=>{g({type:"GET_NEXT_FILE"})},x=()=>{g({type:"GET_PREV_FILE"})},j=()=>{const c=document.documentElement;document.fullscreenElement?document.exitFullscreen&&document.exitFullscreen():c.requestFullscreen&&c.requestFullscreen()};return n.zoom?r.jsx("div",{children:r.jsxs("div",{id:"slider",className:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-black bg-opacity-80 z-20",children:[r.jsxs("div",{id:"slider-header",className:"absolute top-0 left-0 right-0 flex justify-between items-center p-2 shadow-md shadow-gray-950 bg-black bg-opacity-80",children:[r.jsx("span",{className:"text-white flex-1 ml-14 max-sm:ml-1",children:n.fileName}),r.jsx("button",{className:"text-white text-sm flex items-center mr-4 max-sm:mr-1 hover:bg-white hover:text-black rounded-lg pl-2 pr-2 pt-1 pb-1",onClick:j,"aria-label":"toggle-fullscreen",children:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:"mr-1 h-4 stroke-2",viewBox:"0 0 16 16",children:r.jsx("path",{d:"M1.5 1a.5.5 0 0 0-.5.5v4a.5.5 0 0 1-1 0v-4A1.5 1.5 0 0 1 1.5 0h4a.5.5 0 0 1 0 1h-4zM10 .5a.5.5 0 0 1 .5-.5h4A1.5 1.5 0 0 1 16 1.5v4a.5.5 0 0 1-1 0v-4a.5.5 0 0 0-.5-.5h-4a.5.5 0 0 1-.5-.5zM.5 10a.5.5 0 0 1 .5.5v4a.5.5 0 0 0 .5.5h4a.5.5 0 0 1 0 1h-4A1.5 1.5 0 0 1 0 14.5v-4a.5.5 0 0 1 .5-.5zm15 0a.5.5 0 0 1 .5.5v4a1.5 1.5 0 0 1-1.5 1.5h-4a.5.5 0 0 1 0-1h4a.5.5 0 0 0 .5-.5v-4a.5.5 0 0 1 .5-.5z"})})}),n.fileSrc&&r.jsxs("a",{href:n.fileSrc,target:"_blank",download:!0,className:"text-white text-sm flex items-center mr-4 max-sm:mr-1 hover:bg-white hover:text-black rounded-lg pl-2 pr-2 pt-1 pb-1",children:[r.jsx("svg",{fill:"none",stroke:"currentColor",className:"mr-1 h-4 stroke-2",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"Download"]}),r.jsxs("button",{className:"text-white text-sm flex items-center mr-2 max-sm:mr-0 hover:bg-white hover:text-black rounded-lg pl-2 pr-2 pt-1 pb-1",onClick:p,children:[r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"mr-1 w-4 h-4",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"Close"]})]}),r.jsx("button",{id:"slider-prev-button",className:"absolute top-1/2 left-1 ml-2 p-1 max-sm:top-3/4 transform -translate-y-1/2 z-20 text-white rounded-full hover:bg-white hover:text-black",onClick:x,"data-testid":"prev-file",children:r.jsx("svg",{fill:"none",className:"h-10 w-10 stroke-white transform rotate-180 stroke-2 hover:stroke-black",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})})}),r.jsx("div",{id:"file-slider","data-testid":"image-slider",className:`${f.rounded&&"rounded-lg"} relative w-[130vh] max-sm:w-96 max-md:w-[75vh] h-[78vh] max-sm:h-52 max-md:h-80 bg-slate-400 overflow-hidden transition-all delay-750 ease-in`,children:n.isImage?n.fileSrc&&r.jsx("img",{className:"object-fit w-full h-full ",src:n.fileSrc,alt:"Zoomed Image"}):r.jsx("span",{className:"flex w-full h-full items-center justify-center text-4xl",children:r.jsx("span",{className:`${m.length>0?m[0].color:"bg-slate-400"} rounded flex justify-center w-48 h-48 items-center`,children:m.length>0?m[0].icon:r.jsxs("svg",{"data-testid":"default-icon",xmlns:"http://www.w3.org/2000/svg",className:"h-10 w-40 text-4xl",viewBox:"0 0 16 16",children:[r.jsx("path",{d:"M7 4.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0zm-.861 1.542 1.33.886 1.854-1.855a.25.25 0 0 1 .289-.047l1.888.974V7.5a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V7s1.54-1.274 1.639-1.208zM5 9a.5.5 0 0 0 0 1h6a.5.5 0 0 0 0-1H5zm0 2a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1H5z"}),r.jsx("path",{d:"M2 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2zm10-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1z"})]})})})}),r.jsx("button",{id:"slider-next-button",className:"absolute top-1/2 mr-2 p-1 right-1 max-sm:top-3/4 transform -translate-y-1/2 text-white rounded-full hover:bg-white hover:text-black",onClick:h,"data-testid":"next-file",children:r.jsx("svg",{fill:"none",className:" stroke-white h-10 w-10 stroke-2 hover:stroke-black",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})})}),f.showSliderCount?r.jsx(Ge,{}):r.jsx(r.Fragment,{})]})}):null},Ke=({files:n,url:f,downloadFile:m,removeFile:g,showFileSize:p,showSliderCount:h,multiple:x,accept:j,maxFileSize:c,maxFiles:C,width:_,rounded:T,height:D,fileHeight:I,fileWidth:Y,onChange:V,onRemove:Q,onError:k,getFiles:E,onClick:$})=>{const P=d.useContext(S).state.fileData,se=d.useContext(S).state.fileState,ce=d.useContext(S).state.componentState,{dispatch:L}=d.useContext(S),G=l=>{let y=!1;if(C&&(P.length+l.length>C||l.length>C))throw y=!0,k&&k(new Error(`Max ${C} files are allowed to be selected`)),new Error(`Max ${C} files are allowed to be selected`);return c&&l.forEach(N=>{if(N.size>c)throw y=!0,k&&k(new Error(`File size limit exceeded: ${N.name}`)),new Error(`File size limit exceeded: ${N.name}`)}),y};d.useEffect(()=>{async function l(){try{if(f){const N=[{type:"image/jpeg",ext:".jpg"},{type:"image/jpg",ext:".jpg"},{type:"image/png",ext:".png"},{type:"image/gif",ext:"gif"},{type:"image/tiff",ext:".tiff"}],H=await(await fetch(f)).blob();var y=null;const K=N.filter(te=>te.type===H.type);K.length>0&&(y=K[0].ext);const ee=new File([H],"file"+y,{type:H.type});L({type:"STORE_FILE_DATA",payload:{files:[ee]}})}}catch(N){if(N instanceof Error)throw k&&k(N),N}}l(),n&&n.length>0&&(G(n)||L({type:"STORE_FILE_DATA",payload:{files:n}}))},[]),d.useEffect(()=>{L({type:"SET_COMPONENT_STATE",payload:{downloadFile:m??!0,removeFile:g??!0,showFileSize:p??!0,showSliderCount:h??!0,rounded:T??!0,fileHeight:I??"h-32",fileWidth:Y??"w-44"}})},[m,g,p,h,I,Y,T]);const J=l=>{const y=Array.from(l.target.files||[]);G(y)||L({type:"APPEND_FILE_DATA",payload:{files:y}})},ue=l=>{L({type:"REMOVE_FILE_DATA",payload:l}),Q&&Q(l)},fe=l=>{$&&$(l)};d.useEffect(()=>{E&&E(P)},[P]);const q=l=>{l.preventDefault(),l.dataTransfer.dropEffect="copy"},F=l=>{l.preventDefault()},A=l=>{l.preventDefault();const y=Array.from(l.dataTransfer.files);y&&y.length>0&&(G(y)||L({type:"APPEND_FILE_DATA",payload:{files:y}}))};return se.zoom?r.jsx("div",{children:r.jsx(Je,{})}):r.jsx("div",{className:"w-full",children:r.jsx("div",{className:"flex flex-row max-h-2",children:r.jsxs("div",{className:`${_??"basis-11/12"} mx-auto`,children:[P.length>0?r.jsx("div",{children:r.jsxs("div",{className:"flex justify-between bg-gray-200 ",children:[r.jsx("div",{className:"h-10 text-sm pt-2 ml-2 font-medium",children:r.jsx("span",{className:"bg-gray-100 text-gray-800 text-sm font-medium mr-2 px-2.5 py-0.5 rounded dark:bg-gray-700 dark:text-gray-300",children:`Files: ${P.length}`})}),r.jsxs("label",{htmlFor:"fileInput",className:"cursor-pointer py-1 px-2 mt-1 mr-2 mb-1 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded-full border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700",children:["+ Add more",r.jsx("input",{id:"fileInput",type:"file",onChange:l=>{J(l),V&&V(l)},style:{display:"none"},multiple:x??!0,accept:j??""})]})]})}):r.jsx(r.Fragment,{}),r.jsx("div",{className:`${D&&`overflow-auto ${D}`} ${P.length==0&&"border-2 border-dashed border-gray-300 hover:bg-stone-200"} flex flex-row flex-wrap gap-4 p-6 bg-stone-100 shadow dark:bg-gray-800 `,onDragOver:q,onDragLeave:F,onDrop:A,"data-testid":"dropzone",children:P.length>0?P.map((l,y)=>r.jsxs("div",{className:"relative pb-5 group ",onClick:()=>fe(l),children:[r.jsx("div",{className:"ml-9",children:ce.removeFile?r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg","data-testid":"remove-file-button",onClick:()=>ue(l),className:"absolute -top-2 right-0 z-10 text-black opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer h-5 w-5",fill:"currentColor",viewBox:"0 0 16 16",children:r.jsx("path",{d:"M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293 5.354 4.646z"})}):r.jsx(r.Fragment,{})}),r.jsx("div",{className:"clear-right",children:r.jsx(Ye,{file:l,index:y})})]},y)):r.jsxs("label",{htmlFor:"fileInput",className:"mx-auto cursor-pointer flex items-center ",children:["Drop files here, or click to browse files",r.jsx("input",{id:"fileInput",type:"file",onChange:l=>{J(l),V&&V(l)},multiple:x??!0,accept:j??"",style:{display:"none"}})]})})]})})})},jt="",Xe=n=>r.jsx(Be,{children:r.jsx(Ke,{...n})});M.ReactFilesPreview=Xe,Object.defineProperty(M,Symbol.toStringTag,{value:"Module"})}); |
{ | ||
"name": "react-files-preview", | ||
"private": false, | ||
"version": "1.0.25", | ||
"version": "1.1.0", | ||
"author": "Usama Chouhan (musama619)", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
118002
1593