react-files-preview
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -1,2 +0,2 @@ | ||
import Ve, { createContext as v0, useReducer as m0, useState as $e, useEffect as U, useContext as N } from "react"; | ||
import Ie, { createContext as h0, useReducer as v0, useState as Ve, useEffect as Z, useContext as N } from "react"; | ||
var be = { exports: {} }, J = {}; | ||
@@ -12,19 +12,19 @@ /** | ||
*/ | ||
var ze; | ||
function p0() { | ||
if (ze) | ||
var De; | ||
function m0() { | ||
if (De) | ||
return J; | ||
ze = 1; | ||
var n = Ve, u = 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(j, f, T) { | ||
var E, R = {}, D = null, I = null; | ||
T !== void 0 && (D = "" + T), f.key !== void 0 && (D = "" + f.key), f.ref !== void 0 && (I = f.ref); | ||
for (E in f) | ||
p.call(f, E) && !d.hasOwnProperty(E) && (R[E] = f[E]); | ||
De = 1; | ||
var n = Ie, c = Symbol.for("react.element"), v = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, x = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, o = { key: !0, ref: !0, __self: !0, __source: !0 }; | ||
function p(j, u, R) { | ||
var E, S = {}, F = null, I = null; | ||
R !== void 0 && (F = "" + R), u.key !== void 0 && (F = "" + u.key), u.ref !== void 0 && (I = u.ref); | ||
for (E in u) | ||
m.call(u, E) && !o.hasOwnProperty(E) && (S[E] = u[E]); | ||
if (j && j.defaultProps) | ||
for (E in f = j.defaultProps, f) | ||
R[E] === void 0 && (R[E] = f[E]); | ||
return { $$typeof: u, type: j, key: D, ref: I, props: R, _owner: v.current }; | ||
for (E in u = j.defaultProps, u) | ||
S[E] === void 0 && (S[E] = u[E]); | ||
return { $$typeof: c, type: j, key: F, ref: I, props: S, _owner: x.current }; | ||
} | ||
return J.Fragment = m, J.jsx = g, J.jsxs = g, J; | ||
return J.Fragment = v, J.jsx = p, J.jsxs = p, J; | ||
} | ||
@@ -41,14 +41,14 @@ var K = {}; | ||
*/ | ||
var Le; | ||
function g0() { | ||
return Le || (Le = 1, process.env.NODE_ENV !== "production" && function() { | ||
var n = Ve, u = 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"), j = Symbol.for("react.context"), f = Symbol.for("react.forward_ref"), T = Symbol.for("react.suspense"), E = Symbol.for("react.suspense_list"), R = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), I = Symbol.for("react.offscreen"), Y = Symbol.iterator, P = "@@iterator"; | ||
function $(e) { | ||
var ze; | ||
function p0() { | ||
return ze || (ze = 1, process.env.NODE_ENV !== "production" && function() { | ||
var n = Ie, c = Symbol.for("react.element"), v = Symbol.for("react.portal"), m = Symbol.for("react.fragment"), x = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), p = Symbol.for("react.provider"), j = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), R = Symbol.for("react.suspense"), E = Symbol.for("react.suspense_list"), S = Symbol.for("react.memo"), F = Symbol.for("react.lazy"), I = Symbol.for("react.offscreen"), B = Symbol.iterator, z = "@@iterator"; | ||
function Y(e) { | ||
if (e === null || typeof e != "object") | ||
return null; | ||
var r = Y && e[Y] || e[P]; | ||
var r = B && e[B] || e[z]; | ||
return typeof r == "function" ? r : null; | ||
} | ||
var A = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; | ||
function x(e) { | ||
function g(e) { | ||
{ | ||
@@ -62,6 +62,6 @@ for (var r = arguments.length, a = new Array(r > 1 ? r - 1 : 0), i = 1; i < r; i++) | ||
{ | ||
var i = A.ReactDebugCurrentFrame, c = i.getStackAddendum(); | ||
c !== "" && (r += "%s", a = a.concat([c])); | ||
var h = a.map(function(o) { | ||
return String(o); | ||
var i = A.ReactDebugCurrentFrame, f = i.getStackAddendum(); | ||
f !== "" && (r += "%s", a = a.concat([f])); | ||
var h = a.map(function(s) { | ||
return String(s); | ||
}); | ||
@@ -71,10 +71,10 @@ h.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, h); | ||
} | ||
var Q = !1, F = !1, ce = !1, ue = !1, M = !1, H; | ||
H = Symbol.for("react.module.reference"); | ||
var Q = !1, P = !1, ce = !1, ue = !1, M = !1, $; | ||
$ = Symbol.for("react.module.reference"); | ||
function ee(e) { | ||
return !!(typeof e == "string" || typeof e == "function" || e === p || e === d || M || e === v || e === T || e === E || ue || e === I || Q || F || ce || typeof e == "object" && e !== null && (e.$$typeof === D || e.$$typeof === R || e.$$typeof === g || e.$$typeof === j || e.$$typeof === f || // This needs to include all possible module reference object | ||
return !!(typeof e == "string" || typeof e == "function" || e === m || e === o || M || e === x || e === R || e === E || ue || e === I || Q || P || ce || typeof e == "object" && e !== null && (e.$$typeof === F || e.$$typeof === S || e.$$typeof === p || e.$$typeof === j || e.$$typeof === u || // This needs to include all possible module reference object | ||
// types supported by any Flight configuration anywhere since | ||
// we don't know which Flight build this will end up being used | ||
// with. | ||
e.$$typeof === H || e.getModuleId !== void 0)); | ||
e.$$typeof === $ || e.getModuleId !== void 0)); | ||
} | ||
@@ -85,4 +85,4 @@ function fe(e, r, a) { | ||
return i; | ||
var c = r.displayName || r.name || ""; | ||
return c !== "" ? a + "(" + c + ")" : a; | ||
var f = r.displayName || r.name || ""; | ||
return f !== "" ? a + "(" + f + ")" : a; | ||
} | ||
@@ -95,3 +95,3 @@ function re(e) { | ||
return null; | ||
if (typeof e.tag == "number" && x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function") | ||
if (typeof e.tag == "number" && g("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; | ||
@@ -101,11 +101,11 @@ if (typeof e == "string") | ||
switch (e) { | ||
case p: | ||
case m: | ||
return "Fragment"; | ||
case m: | ||
case v: | ||
return "Portal"; | ||
case d: | ||
case o: | ||
return "Profiler"; | ||
case v: | ||
case x: | ||
return "StrictMode"; | ||
case T: | ||
case R: | ||
return "Suspense"; | ||
@@ -120,14 +120,14 @@ case E: | ||
return re(r) + ".Consumer"; | ||
case g: | ||
case p: | ||
var a = e; | ||
return re(a._context) + ".Provider"; | ||
case f: | ||
case u: | ||
return fe(e, e.render, "ForwardRef"); | ||
case R: | ||
case S: | ||
var i = e.displayName || null; | ||
return i !== null ? i : O(e.type) || "Memo"; | ||
case D: { | ||
var c = e, h = c._payload, o = c._init; | ||
case F: { | ||
var f = e, h = f._payload, s = f._init; | ||
try { | ||
return O(o(h)); | ||
return O(s(h)); | ||
} catch { | ||
@@ -140,10 +140,10 @@ return null; | ||
} | ||
var z = Object.assign, V = 0, s, y, k, de, Z, q, te; | ||
var L = Object.assign, V = 0, d, y, k, de, H, q, te; | ||
function ae() { | ||
} | ||
ae.__reactDisabledLog = !0; | ||
function Ze() { | ||
function He() { | ||
{ | ||
if (V === 0) { | ||
s = console.log, y = console.info, k = console.warn, de = console.error, Z = console.group, q = console.groupCollapsed, te = console.groupEnd; | ||
d = console.log, y = console.info, k = console.warn, de = console.error, H = console.group, q = console.groupCollapsed, te = console.groupEnd; | ||
var e = { | ||
@@ -168,3 +168,3 @@ configurable: !0, | ||
} | ||
function We() { | ||
function Ue() { | ||
{ | ||
@@ -178,21 +178,21 @@ if (V--, V === 0) { | ||
Object.defineProperties(console, { | ||
log: z({}, e, { | ||
value: s | ||
log: L({}, e, { | ||
value: d | ||
}), | ||
info: z({}, e, { | ||
info: L({}, e, { | ||
value: y | ||
}), | ||
warn: z({}, e, { | ||
warn: L({}, e, { | ||
value: k | ||
}), | ||
error: z({}, e, { | ||
error: L({}, e, { | ||
value: de | ||
}), | ||
group: z({}, e, { | ||
value: Z | ||
group: L({}, e, { | ||
value: H | ||
}), | ||
groupCollapsed: z({}, e, { | ||
groupCollapsed: L({}, e, { | ||
value: q | ||
}), | ||
groupEnd: z({}, e, { | ||
groupEnd: L({}, e, { | ||
value: te | ||
@@ -202,3 +202,3 @@ }) | ||
} | ||
V < 0 && x("disabledDepth fell below zero. This is a bug in React. Please file an issue."); | ||
V < 0 && g("disabledDepth fell below zero. This is a bug in React. Please file an issue."); | ||
} | ||
@@ -212,4 +212,4 @@ } | ||
throw Error(); | ||
} catch (c) { | ||
var i = c.stack.trim().match(/\n( *(at )?)/); | ||
} catch (f) { | ||
var i = f.stack.trim().match(/\n( *(at )?)/); | ||
ve = i && i[1] || ""; | ||
@@ -223,4 +223,4 @@ } | ||
{ | ||
var Be = typeof WeakMap == "function" ? WeakMap : Map; | ||
ie = new Be(); | ||
var We = typeof WeakMap == "function" ? WeakMap : Map; | ||
ie = new We(); | ||
} | ||
@@ -237,12 +237,12 @@ function je(e, r) { | ||
me = !0; | ||
var c = Error.prepareStackTrace; | ||
var f = Error.prepareStackTrace; | ||
Error.prepareStackTrace = void 0; | ||
var h; | ||
h = he.current, he.current = null, Ze(); | ||
h = he.current, he.current = null, He(); | ||
try { | ||
if (r) { | ||
var o = function() { | ||
var s = function() { | ||
throw Error(); | ||
}; | ||
if (Object.defineProperty(o.prototype, "props", { | ||
if (Object.defineProperty(s.prototype, "props", { | ||
set: function() { | ||
@@ -253,14 +253,14 @@ throw Error(); | ||
try { | ||
Reflect.construct(o, []); | ||
} catch (L) { | ||
i = L; | ||
Reflect.construct(s, []); | ||
} catch (D) { | ||
i = D; | ||
} | ||
Reflect.construct(e, [], o); | ||
Reflect.construct(e, [], s); | ||
} else { | ||
try { | ||
o.call(); | ||
} catch (L) { | ||
i = L; | ||
s.call(); | ||
} catch (D) { | ||
i = D; | ||
} | ||
e.call(o.prototype); | ||
e.call(s.prototype); | ||
} | ||
@@ -270,10 +270,10 @@ } else { | ||
throw Error(); | ||
} catch (L) { | ||
i = L; | ||
} catch (D) { | ||
i = D; | ||
} | ||
e(); | ||
} | ||
} catch (L) { | ||
if (L && i && typeof L.stack == "string") { | ||
for (var l = L.stack.split(` | ||
} catch (D) { | ||
if (D && i && typeof D.stack == "string") { | ||
for (var l = D.stack.split(` | ||
`), _ = i.stack.split(` | ||
@@ -296,11 +296,11 @@ `), w = l.length - 1, b = _.length - 1; w >= 1 && b >= 0 && l[w] !== _[b]; ) | ||
} finally { | ||
me = !1, he.current = h, We(), Error.prepareStackTrace = c; | ||
me = !1, he.current = h, Ue(), Error.prepareStackTrace = f; | ||
} | ||
var B = e ? e.displayName || e.name : "", Ae = B ? ne(B) : ""; | ||
return typeof e == "function" && ie.set(e, Ae), Ae; | ||
var W = e ? e.displayName || e.name : "", Le = W ? ne(W) : ""; | ||
return typeof e == "function" && ie.set(e, Le), Le; | ||
} | ||
function Ue(e, r, a) { | ||
function Ze(e, r, a) { | ||
return je(e, !1); | ||
} | ||
function Ye(e) { | ||
function Be(e) { | ||
var r = e.prototype; | ||
@@ -313,7 +313,7 @@ return !!(r && r.isReactComponent); | ||
if (typeof e == "function") | ||
return je(e, Ye(e)); | ||
return je(e, Be(e)); | ||
if (typeof e == "string") | ||
return ne(e); | ||
switch (e) { | ||
case T: | ||
case R: | ||
return ne("Suspense"); | ||
@@ -325,10 +325,10 @@ case E: | ||
switch (e.$$typeof) { | ||
case f: | ||
return Ue(e.render); | ||
case R: | ||
case u: | ||
return Ze(e.render); | ||
case S: | ||
return le(e.type, r, a); | ||
case D: { | ||
var i = e, c = i._payload, h = i._init; | ||
case F: { | ||
var i = e, f = i._payload, h = i._init; | ||
try { | ||
return le(h(c), r, a); | ||
return le(h(f), r, a); | ||
} catch { | ||
@@ -348,26 +348,26 @@ } | ||
} | ||
function qe(e, r, a, i, c) { | ||
function Ye(e, r, a, i, f) { | ||
{ | ||
var h = Function.call.bind(oe); | ||
for (var o in e) | ||
if (h(e, o)) { | ||
for (var s in e) | ||
if (h(e, s)) { | ||
var l = void 0; | ||
try { | ||
if (typeof e[o] != "function") { | ||
var _ = Error((i || "React class") + ": " + a + " type `" + o + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[o] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); | ||
if (typeof e[s] != "function") { | ||
var _ = 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 _.name = "Invariant Violation", _; | ||
} | ||
l = e[o](r, o, i, a, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); | ||
l = e[s](r, s, i, a, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); | ||
} catch (w) { | ||
l = w; | ||
} | ||
l && !(l instanceof Error) && (se(c), x("%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, o, typeof l), se(null)), l instanceof Error && !(l.message in Ee) && (Ee[l.message] = !0, se(c), x("Failed %s type: %s", a, l.message), se(null)); | ||
l && !(l instanceof Error) && (se(f), g("%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 l), se(null)), l instanceof Error && !(l.message in Ee) && (Ee[l.message] = !0, se(f), g("Failed %s type: %s", a, l.message), se(null)); | ||
} | ||
} | ||
} | ||
var Ge = Array.isArray; | ||
var qe = Array.isArray; | ||
function pe(e) { | ||
return Ge(e); | ||
return qe(e); | ||
} | ||
function Je(e) { | ||
function Ge(e) { | ||
{ | ||
@@ -378,3 +378,3 @@ var r = typeof Symbol == "function" && Symbol.toStringTag, a = r && e[Symbol.toStringTag] || e.constructor.name || "Object"; | ||
} | ||
function Ke(e) { | ||
function Je(e) { | ||
try { | ||
@@ -390,6 +390,6 @@ return Re(e), !1; | ||
function Se(e) { | ||
if (Ke(e)) | ||
return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Je(e)), Re(e); | ||
if (Je(e)) | ||
return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ge(e)), Re(e); | ||
} | ||
var G = A.ReactCurrentOwner, Xe = { | ||
var G = A.ReactCurrentOwner, Ke = { | ||
key: !0, | ||
@@ -401,3 +401,3 @@ ref: !0, | ||
ge = {}; | ||
function Qe(e) { | ||
function Xe(e) { | ||
if (oe.call(e, "ref")) { | ||
@@ -410,3 +410,3 @@ var r = Object.getOwnPropertyDescriptor(e, "ref").get; | ||
} | ||
function e0(e) { | ||
function Qe(e) { | ||
if (oe.call(e, "key")) { | ||
@@ -419,12 +419,12 @@ var r = Object.getOwnPropertyDescriptor(e, "key").get; | ||
} | ||
function r0(e, r) { | ||
function e0(e, r) { | ||
if (typeof e.ref == "string" && G.current && r && G.current.stateNode !== r) { | ||
var a = O(G.current.type); | ||
ge[a] || (x('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', O(G.current.type), e.ref), ge[a] = !0); | ||
ge[a] || (g('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', O(G.current.type), e.ref), ge[a] = !0); | ||
} | ||
} | ||
function t0(e, r) { | ||
function r0(e, r) { | ||
{ | ||
var a = function() { | ||
Te || (Te = !0, x("%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)", r)); | ||
Te || (Te = !0, g("%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)", r)); | ||
}; | ||
@@ -437,6 +437,6 @@ a.isReactWarning = !0, Object.defineProperty(e, "key", { | ||
} | ||
function a0(e, r) { | ||
function t0(e, r) { | ||
{ | ||
var a = function() { | ||
ke || (ke = !0, x("%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)", r)); | ||
ke || (ke = !0, g("%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)", r)); | ||
}; | ||
@@ -449,6 +449,6 @@ a.isReactWarning = !0, Object.defineProperty(e, "ref", { | ||
} | ||
var n0 = function(e, r, a, i, c, h, o) { | ||
var a0 = function(e, r, a, i, f, h, s) { | ||
var l = { | ||
// This tag allows us to uniquely identify this as a React Element | ||
$$typeof: u, | ||
$$typeof: c, | ||
// Built-in properties that belong on the element | ||
@@ -458,3 +458,3 @@ type: e, | ||
ref: a, | ||
props: o, | ||
props: s, | ||
// Record the component responsible for creating this element. | ||
@@ -477,25 +477,25 @@ _owner: h | ||
writable: !1, | ||
value: c | ||
value: f | ||
}), Object.freeze && (Object.freeze(l.props), Object.freeze(l)), l; | ||
}; | ||
function i0(e, r, a, i, c) { | ||
function n0(e, r, a, i, f) { | ||
{ | ||
var h, o = {}, l = null, _ = null; | ||
a !== void 0 && (Se(a), l = "" + a), e0(r) && (Se(r.key), l = "" + r.key), Qe(r) && (_ = r.ref, r0(r, c)); | ||
var h, s = {}, l = null, _ = null; | ||
a !== void 0 && (Se(a), l = "" + a), Qe(r) && (Se(r.key), l = "" + r.key), Xe(r) && (_ = r.ref, e0(r, f)); | ||
for (h in r) | ||
oe.call(r, h) && !Xe.hasOwnProperty(h) && (o[h] = r[h]); | ||
oe.call(r, h) && !Ke.hasOwnProperty(h) && (s[h] = r[h]); | ||
if (e && e.defaultProps) { | ||
var w = e.defaultProps; | ||
for (h in w) | ||
o[h] === void 0 && (o[h] = w[h]); | ||
s[h] === void 0 && (s[h] = w[h]); | ||
} | ||
if (l || _) { | ||
var b = typeof e == "function" ? e.displayName || e.name || "Unknown" : e; | ||
l && t0(o, b), _ && a0(o, b); | ||
l && r0(s, b), _ && t0(s, b); | ||
} | ||
return n0(e, l, _, c, i, G.current, o); | ||
return a0(e, l, _, f, i, G.current, s); | ||
} | ||
} | ||
var xe = A.ReactCurrentOwner, Ce = A.ReactDebugCurrentFrame; | ||
function W(e) { | ||
function U(e) { | ||
if (e) { | ||
@@ -510,3 +510,3 @@ var r = e._owner, a = le(e.type, e._source, r ? r.type : null); | ||
function ye(e) { | ||
return typeof e == "object" && e !== null && e.$$typeof === u; | ||
return typeof e == "object" && e !== null && e.$$typeof === c; | ||
} | ||
@@ -525,3 +525,3 @@ function Ne() { | ||
} | ||
function l0(e) { | ||
function i0(e) { | ||
{ | ||
@@ -538,3 +538,3 @@ if (e !== void 0) { | ||
var Oe = {}; | ||
function o0(e) { | ||
function l0(e) { | ||
{ | ||
@@ -551,3 +551,3 @@ var r = Ne(); | ||
} | ||
function De(e, r) { | ||
function Fe(e, r) { | ||
{ | ||
@@ -557,3 +557,3 @@ if (!e._store || e._store.validated || e.key != null) | ||
e._store.validated = !0; | ||
var a = o0(r); | ||
var a = l0(r); | ||
if (Oe[a]) | ||
@@ -563,6 +563,6 @@ return; | ||
var i = ""; | ||
e && e._owner && e._owner !== xe.current && (i = " It was passed a child from " + O(e._owner.type) + "."), W(e), x('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), W(null); | ||
e && e._owner && e._owner !== xe.current && (i = " It was passed a child from " + O(e._owner.type) + "."), U(e), g('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), U(null); | ||
} | ||
} | ||
function Fe(e, r) { | ||
function Pe(e, r) { | ||
{ | ||
@@ -574,3 +574,3 @@ if (typeof e != "object") | ||
var i = e[a]; | ||
ye(i) && De(i, r); | ||
ye(i) && Fe(i, r); | ||
} | ||
@@ -580,10 +580,10 @@ else if (ye(e)) | ||
else if (e) { | ||
var c = $(e); | ||
if (typeof c == "function" && c !== e.entries) | ||
for (var h = c.call(e), o; !(o = h.next()).done; ) | ||
ye(o.value) && De(o.value, r); | ||
var f = Y(e); | ||
if (typeof f == "function" && f !== e.entries) | ||
for (var h = f.call(e), s; !(s = h.next()).done; ) | ||
ye(s.value) && Fe(s.value, r); | ||
} | ||
} | ||
} | ||
function s0(e) { | ||
function o0(e) { | ||
{ | ||
@@ -596,5 +596,5 @@ var r = e.type; | ||
a = r.propTypes; | ||
else if (typeof r == "object" && (r.$$typeof === f || // Note: Memo only checks outer props here. | ||
else if (typeof r == "object" && (r.$$typeof === u || // Note: Memo only checks outer props here. | ||
// Inner props are checked in the reconciler. | ||
r.$$typeof === R)) | ||
r.$$typeof === S)) | ||
a = r.propTypes; | ||
@@ -605,12 +605,12 @@ else | ||
var i = O(r); | ||
qe(a, e.props, "prop", i, e); | ||
Ye(a, e.props, "prop", i, e); | ||
} else if (r.PropTypes !== void 0 && !we) { | ||
we = !0; | ||
var c = O(r); | ||
x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", c || "Unknown"); | ||
var f = O(r); | ||
g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", f || "Unknown"); | ||
} | ||
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); | ||
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); | ||
} | ||
} | ||
function c0(e) { | ||
function s0(e) { | ||
{ | ||
@@ -620,24 +620,24 @@ for (var r = Object.keys(e.props), a = 0; a < r.length; a++) { | ||
if (i !== "children" && i !== "key") { | ||
W(e), x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", i), W(null); | ||
U(e), g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", i), U(null); | ||
break; | ||
} | ||
} | ||
e.ref !== null && (W(e), x("Invalid attribute `ref` supplied to `React.Fragment`."), W(null)); | ||
e.ref !== null && (U(e), g("Invalid attribute `ref` supplied to `React.Fragment`."), U(null)); | ||
} | ||
} | ||
function Pe(e, r, a, i, c, h) { | ||
function Ae(e, r, a, i, f, h) { | ||
{ | ||
var o = ee(e); | ||
if (!o) { | ||
var s = ee(e); | ||
if (!s) { | ||
var l = ""; | ||
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (l += " 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(c); | ||
var _ = i0(f); | ||
_ ? l += _ : l += Ne(); | ||
var w; | ||
e === null ? w = "null" : pe(e) ? w = "array" : e !== void 0 && e.$$typeof === u ? (w = "<" + (O(e.type) || "Unknown") + " />", l = " Did you accidentally export a JSX literal instead of a component?") : w = typeof e, x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", w, l); | ||
e === null ? w = "null" : pe(e) ? w = "array" : e !== void 0 && e.$$typeof === c ? (w = "<" + (O(e.type) || "Unknown") + " />", l = " Did you accidentally export a JSX literal instead of a component?") : w = typeof e, g("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", w, l); | ||
} | ||
var b = i0(e, r, a, c, h); | ||
var b = n0(e, r, a, f, h); | ||
if (b == null) | ||
return b; | ||
if (o) { | ||
if (s) { | ||
var C = r.children; | ||
@@ -647,26 +647,26 @@ if (C !== void 0) | ||
if (pe(C)) { | ||
for (var B = 0; B < C.length; B++) | ||
Fe(C[B], e); | ||
for (var W = 0; W < C.length; W++) | ||
Pe(C[W], e); | ||
Object.freeze && Object.freeze(C); | ||
} else | ||
x("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); | ||
g("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 | ||
Fe(C, e); | ||
Pe(C, e); | ||
} | ||
return e === p ? c0(b) : s0(b), b; | ||
return e === m ? s0(b) : o0(b), b; | ||
} | ||
} | ||
function c0(e, r, a) { | ||
return Ae(e, r, a, !0); | ||
} | ||
function u0(e, r, a) { | ||
return Pe(e, r, a, !0); | ||
return Ae(e, r, a, !1); | ||
} | ||
function f0(e, r, a) { | ||
return Pe(e, r, a, !1); | ||
} | ||
var d0 = f0, h0 = u0; | ||
K.Fragment = p, K.jsx = d0, K.jsxs = h0; | ||
var f0 = u0, d0 = c0; | ||
K.Fragment = m, K.jsx = f0, K.jsxs = d0; | ||
}()), K; | ||
} | ||
process.env.NODE_ENV === "production" ? be.exports = p0() : be.exports = g0(); | ||
process.env.NODE_ENV === "production" ? be.exports = m0() : be.exports = p0(); | ||
var t = be.exports; | ||
const Me = [ | ||
const g0 = [ | ||
"image/jpeg", | ||
@@ -677,47 +677,42 @@ "image/jpg", | ||
"image/tiff" | ||
], x0 = (n, u) => { | ||
const m = n.fileData.length - 1; | ||
switch (u.type) { | ||
], x0 = (n, c) => { | ||
const v = n.fileData.length - 1, m = (o) => { | ||
const p = n.fileData[o]; | ||
return { | ||
zoom: !0, | ||
fileSrc: URL.createObjectURL(p), | ||
index: o, | ||
isImage: g0.includes(p.type), | ||
fileName: p.name, | ||
type: p.type, | ||
size: p.size | ||
}; | ||
}, x = (o) => { | ||
o && o.fileSrc && o.fileSrc.startsWith("blob:") && URL.revokeObjectURL(o.fileSrc); | ||
}; | ||
switch (c.type) { | ||
case "STORE_FILE_DATA": | ||
return { ...n, fileData: u.payload.files }; | ||
return { ...n, fileData: c.payload.files }; | ||
case "SET_COMPONENT_STATE": | ||
return { ...n, componentState: u.payload }; | ||
return { ...n, componentState: c.payload }; | ||
case "APPEND_FILE_DATA": | ||
return { ...n, fileData: [...n.fileData, ...u.payload.files] }; | ||
return { ...n, fileData: [...n.fileData, ...c.payload.files] }; | ||
case "STORE_FILE_STATE": | ||
return { ...n, fileState: u.payload }; | ||
return { ...n, fileState: c.payload }; | ||
case "REMOVE_FILE_DATA": | ||
return { | ||
...n, | ||
fileData: n.fileData.filter((j) => j.name !== u.payload.name) | ||
fileData: n.fileData.filter((R) => R.name !== c.payload.name) | ||
}; | ||
case "GET_NEXT_FILE": | ||
const p = n.fileState.index + 1; | ||
let v = p; | ||
return p > m && (v = 0), { | ||
const o = n.fileState.index + 1, p = o > v ? 0 : o; | ||
return x(n.fileState), { | ||
...n, | ||
fileState: { | ||
zoom: !0, | ||
fileSrc: URL.createObjectURL(n.fileData[v]), | ||
index: v, | ||
isImage: Me.includes(n.fileData[v].type), | ||
fileName: n.fileData[v].name, | ||
type: n.fileData[v].type, | ||
size: n.fileData[v].size | ||
} | ||
fileState: m(p) | ||
}; | ||
case "GET_PREV_FILE": | ||
const d = n.fileState.index - 1; | ||
let g = d; | ||
return d < 0 && (g = m), { | ||
const j = n.fileState.index - 1, u = j < 0 ? v : j; | ||
return x(n.fileState), { | ||
...n, | ||
fileState: { | ||
zoom: !0, | ||
fileSrc: URL.createObjectURL(n.fileData[g]), | ||
index: g, | ||
isImage: Me.includes(n.fileData[g].type), | ||
fileName: n.fileData[g].name, | ||
type: n.fileData[g].type, | ||
size: n.fileData[g].size | ||
} | ||
fileState: m(u) | ||
}; | ||
@@ -727,3 +722,3 @@ default: | ||
} | ||
}, S = v0({ | ||
}, T = h0({ | ||
state: { | ||
@@ -754,3 +749,3 @@ fileData: [], | ||
}), w0 = ({ children: n }) => { | ||
const [u, m] = m0(x0, { | ||
const [c, v] = v0(x0, { | ||
fileData: [], | ||
@@ -776,21 +771,21 @@ fileState: { | ||
}); | ||
return /* @__PURE__ */ t.jsx(S.Provider, { value: { state: u, dispatch: m }, children: n }); | ||
}, y0 = ({ file: n, fileSrc: u }) => { | ||
const [m, p] = $e(null); | ||
U(() => { | ||
n.size < 1e6 ? p(Math.floor(n.size / 1e3) + " KB") : p(Math.floor(n.size / 1e6) + " MB"); | ||
return /* @__PURE__ */ t.jsx(T.Provider, { value: { state: c, dispatch: v }, children: n }); | ||
}, y0 = ({ file: n, fileSrc: c }) => { | ||
const [v, m] = Ve(null); | ||
Z(() => { | ||
n.size < 1e6 ? m(Math.floor(n.size / 1e3) + " KB") : m(Math.floor(n.size / 1e6) + " MB"); | ||
}, [n.size]); | ||
const v = n.name.split("."); | ||
let d = v[0]; | ||
const g = v.pop(); | ||
d.length > 20 && (d = d.substring(0, 5) + ".." + d.substring(d.length - 3, d.length)); | ||
const j = d + "." + g, f = N(S).state.componentState; | ||
const x = n.name.split("."); | ||
let o = x[0]; | ||
const p = x.pop(); | ||
o.length > 20 && (o = o.substring(0, 5) + ".." + o.substring(o.length - 3, o.length)); | ||
const j = o + "." + p, u = N(T).state.componentState; | ||
return /* @__PURE__ */ t.jsxs("div", { className: "relative ", children: [ | ||
/* @__PURE__ */ t.jsx("h5", { className: "text-[12px] mt-1 font-normal break-words dark:text-white", children: j }), | ||
f.showFileSize && /* @__PURE__ */ t.jsx("span", { "data-testid": "file-size", className: "text-[10px] dark:text-white", children: m }), | ||
f.downloadFile && u && /* @__PURE__ */ t.jsx( | ||
u.showFileSize && /* @__PURE__ */ t.jsx("span", { "data-testid": "file-size", className: "text-[10px] dark:text-white", children: v }), | ||
u.downloadFile && c && /* @__PURE__ */ t.jsx( | ||
"a", | ||
{ | ||
className: "float-right absolute top-1 right-0 text-gray-500 dark:text-white", | ||
href: u, | ||
href: c, | ||
target: "_blank", | ||
@@ -806,3 +801,3 @@ download: !0, | ||
] }); | ||
}, He = [ | ||
}, $e = [ | ||
{ | ||
@@ -849,18 +844,18 @@ type: "application/pdf", | ||
} | ||
], Ie = ["image/jpeg", "image/jpg", "image/png", "image/gif", "image/tiff"], b0 = ({ file: n, index: u }) => { | ||
const [m, p] = $e(null); | ||
U(() => { | ||
], Me = ["image/jpeg", "image/jpg", "image/png", "image/gif", "image/tiff"], b0 = ({ file: n, index: c }) => { | ||
const [v, m] = Ve(null); | ||
Z(() => { | ||
if (n) { | ||
const f = URL.createObjectURL(n); | ||
p(f); | ||
const u = URL.createObjectURL(n); | ||
return m(u), () => URL.revokeObjectURL(u); | ||
} | ||
}, [n]); | ||
const v = He.filter((f) => f.type == n.type), d = N(S).state.componentState, { dispatch: g } = N(S), j = () => { | ||
g({ | ||
const x = $e.filter((u) => u.type == n.type), o = N(T).state.componentState, { dispatch: p } = N(T), j = () => { | ||
p({ | ||
type: "STORE_FILE_STATE", | ||
payload: { | ||
zoom: !0, | ||
fileSrc: m, | ||
index: u, | ||
isImage: Ie.includes(n.type), | ||
fileSrc: URL.createObjectURL(n), | ||
index: c, | ||
isImage: Me.includes(n.type), | ||
fileName: n.name, | ||
@@ -878,9 +873,9 @@ type: n.type, | ||
onClick: () => j(), | ||
className: `${d.rounded && "rounded-lg"} border-solid border-slate-200 hover:shadow-lg shadow-md hover:cursor-pointer`, | ||
children: Ie.includes(n.type) ? m && /* @__PURE__ */ t.jsx( | ||
className: `${o.rounded && "rounded-lg"} border-solid border-slate-200 hover:shadow-lg shadow-md hover:cursor-pointer`, | ||
children: Me.includes(n.type) ? v && /* @__PURE__ */ t.jsx( | ||
"img", | ||
{ | ||
"data-testid": "image-preview", | ||
src: m, | ||
className: `${d.fileHeight} ${d.fileWidth} object-fill scale-[0.9]` | ||
src: v, | ||
className: `${o.fileHeight} ${o.fileWidth} object-fill scale-[0.9]` | ||
} | ||
@@ -891,9 +886,9 @@ ) : /* @__PURE__ */ t.jsx( | ||
"data-testid": "file-icon-preview", | ||
className: `${d.fileHeight} ${d.fileWidth} flex flex-col justify-center content-center items-center`, | ||
className: `${o.fileHeight} ${o.fileWidth} flex flex-col justify-center content-center items-center`, | ||
children: /* @__PURE__ */ t.jsx( | ||
"span", | ||
{ | ||
className: `${v.length > 0 ? v[0].color : "bg-slate-400"} | ||
className: `${x.length > 0 ? x[0].color : "bg-slate-400"} | ||
rounded flex w-16 justify-center h-20 items-center`, | ||
children: v.length > 0 ? v[0].icon : /* @__PURE__ */ t.jsxs( | ||
children: x.length > 0 ? x[0].icon : /* @__PURE__ */ t.jsxs( | ||
"svg", | ||
@@ -917,10 +912,10 @@ { | ||
), | ||
/* @__PURE__ */ t.jsx("div", { className: "h-5 w-44", children: m && /* @__PURE__ */ t.jsx(y0, { file: n, fileSrc: m }) }) | ||
/* @__PURE__ */ t.jsx("div", { className: "h-5 w-44", children: v && /* @__PURE__ */ t.jsx(y0, { file: n, fileSrc: v }) }) | ||
] }); | ||
}, j0 = () => { | ||
const n = N(S).state.fileData, u = N(S).state.fileState; | ||
return /* @__PURE__ */ t.jsx("div", { id: "slider-count", className: "absolute bottom-5 right-0 left-0 flex items-center justify-center z-50", children: (u == null ? void 0 : u.index) !== null && /* @__PURE__ */ t.jsx("div", { className: "text-white text-1xl", children: `${u.index + 1} of ${n == null ? void 0 : n.length}` }) }); | ||
const n = N(T).state.fileData, c = N(T).state.fileState; | ||
return /* @__PURE__ */ t.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__ */ t.jsx("div", { className: "text-white text-1xl", children: `${c.index + 1} of ${n == null ? void 0 : n.length}` }) }); | ||
}, E0 = () => { | ||
const n = N(S).state.fileState, u = N(S).state.componentState, m = He.filter((f) => f.type === n.type), { dispatch: p } = N(S), v = () => { | ||
p({ | ||
const n = N(T).state.fileState, c = N(T).state.componentState, v = $e.filter((u) => u.type === n.type), { dispatch: m } = N(T), x = () => { | ||
n.fileSrc && URL.revokeObjectURL(n.fileSrc), m({ | ||
type: "STORE_FILE_STATE", | ||
@@ -937,9 +932,9 @@ payload: { | ||
}); | ||
}, d = () => { | ||
p({ type: "GET_NEXT_FILE" }); | ||
}, g = () => { | ||
p({ type: "GET_PREV_FILE" }); | ||
}, o = () => { | ||
m({ type: "GET_NEXT_FILE" }); | ||
}, p = () => { | ||
m({ type: "GET_PREV_FILE" }); | ||
}, j = () => { | ||
const f = document.documentElement; | ||
document.fullscreenElement ? document.exitFullscreen && document.exitFullscreen() : f.requestFullscreen && f.requestFullscreen(); | ||
const u = document.documentElement; | ||
document.fullscreenElement ? document.exitFullscreen && document.exitFullscreen() : u.requestFullscreen && u.requestFullscreen(); | ||
}; | ||
@@ -1013,3 +1008,3 @@ return n.zoom ? /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsxs( | ||
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: v, | ||
onClick: x, | ||
children: [ | ||
@@ -1040,3 +1035,3 @@ /* @__PURE__ */ t.jsx( | ||
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: g, | ||
onClick: p, | ||
"data-testid": "prev-file", | ||
@@ -1068,8 +1063,8 @@ children: /* @__PURE__ */ t.jsx( | ||
"data-testid": "image-slider", | ||
className: `${u.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: `${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 && /* @__PURE__ */ t.jsx("img", { className: "object-fit w-full h-full ", src: n.fileSrc, alt: "Zoomed Image" }) : /* @__PURE__ */ t.jsx("span", { className: "flex w-full h-full items-center justify-center text-4xl", children: /* @__PURE__ */ t.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 : /* @__PURE__ */ t.jsxs( | ||
className: `${v.length > 0 ? v[0].color : "bg-slate-400"} rounded flex justify-center w-48 h-48 items-center`, | ||
children: v.length > 0 ? v[0].icon : /* @__PURE__ */ t.jsxs( | ||
"svg", | ||
@@ -1096,3 +1091,3 @@ { | ||
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, | ||
onClick: o, | ||
"data-testid": "next-file", | ||
@@ -1119,42 +1114,68 @@ children: /* @__PURE__ */ t.jsx( | ||
), | ||
u.showSliderCount ? /* @__PURE__ */ t.jsx(j0, {}) : /* @__PURE__ */ t.jsx(t.Fragment, {}) | ||
c.showSliderCount ? /* @__PURE__ */ t.jsx(j0, {}) : /* @__PURE__ */ t.jsx(t.Fragment, {}) | ||
] | ||
} | ||
) }) : null; | ||
}, _0 = ({ | ||
}, _0 = (n) => /* @__PURE__ */ t.jsx(t.Fragment, { children: /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsxs("div", { className: "flex justify-between bg-gray-200 ", children: [ | ||
/* @__PURE__ */ t.jsx("div", { className: "h-10 text-sm pt-2 ml-2 font-medium", children: /* @__PURE__ */ t.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: ${n.fileData.length}` }) }), | ||
/* @__PURE__ */ t.jsxs( | ||
"label", | ||
{ | ||
htmlFor: "fileInput", | ||
className: `${n.disabled ? "cursor-not-allowed opacity-50 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 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" : "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", | ||
/* @__PURE__ */ t.jsx( | ||
"input", | ||
{ | ||
id: "fileInput", | ||
disabled: n.disabled, | ||
type: "file", | ||
onChange: (c) => { | ||
n.handleImage(c), n.onChange && n.onChange(c); | ||
}, | ||
style: { display: "none" }, | ||
multiple: n.multiple ?? !0, | ||
accept: n.accept ?? "" | ||
} | ||
) | ||
] | ||
} | ||
) | ||
] }) }) }), R0 = ({ | ||
files: n, | ||
url: u, | ||
downloadFile: m, | ||
removeFile: p, | ||
showFileSize: v, | ||
showSliderCount: d, | ||
multiple: g, | ||
url: c, | ||
downloadFile: v, | ||
removeFile: m, | ||
showFileSize: x, | ||
showSliderCount: o, | ||
multiple: p, | ||
accept: j, | ||
maxFileSize: f, | ||
maxFiles: T, | ||
maxFileSize: u, | ||
maxFiles: R, | ||
width: E, | ||
rounded: R, | ||
height: D, | ||
rounded: S, | ||
height: F, | ||
fileHeight: I, | ||
fileWidth: Y, | ||
disabled: P, | ||
onChange: $, | ||
fileWidth: B, | ||
disabled: z, | ||
onChange: Y, | ||
onRemove: A, | ||
onError: x, | ||
onError: g, | ||
getFiles: X, | ||
onClick: Q | ||
}) => { | ||
const F = N(S).state.fileData, ce = N(S).state.fileState, ue = N(S).state.componentState, { dispatch: M } = N(S), H = (s) => { | ||
const P = N(T).state.fileData, ce = N(T).state.fileState, ue = N(T).state.componentState, { dispatch: M } = N(T), $ = (d) => { | ||
let y = !1; | ||
if (T && (F.length + s.length > T || s.length > T)) | ||
throw y = !0, x && x(new Error(`Max ${T} files are allowed to be selected`)), new Error(`Max ${T} files are allowed to be selected`); | ||
return f && s.forEach((k) => { | ||
if (k.size > f) | ||
throw y = !0, x && x(new Error(`File size limit exceeded: ${k.name}`)), new Error(`File size limit exceeded: ${k.name}`); | ||
if (R && (P.length + d.length > R || d.length > R)) | ||
throw y = !0, g && g(new Error(`Max ${R} files are allowed to be selected`)), new Error(`Max ${R} files are allowed to be selected`); | ||
return u && d.forEach((k) => { | ||
if (k.size > u) | ||
throw y = !0, g && g(new Error(`File size limit exceeded: ${k.name}`)), new Error(`File size limit exceeded: ${k.name}`); | ||
}), y; | ||
}; | ||
U(() => { | ||
async function s() { | ||
Z(() => { | ||
async function d() { | ||
try { | ||
if (u) { | ||
if (c) { | ||
const k = [ | ||
@@ -1166,8 +1187,8 @@ { type: "image/jpeg", ext: ".jpg" }, | ||
{ type: "image/tiff", ext: ".tiff" } | ||
], Z = await (await fetch(u)).blob(); | ||
], H = await (await fetch(c)).blob(); | ||
var y = null; | ||
const q = k.filter((ae) => ae.type === Z.type); | ||
const q = k.filter((ae) => ae.type === H.type); | ||
q.length > 0 && (y = q[0].ext); | ||
const te = new File([Z], "file" + y, { | ||
type: Z.type | ||
const te = new File([H], "file" + y, { | ||
type: H.type | ||
}); | ||
@@ -1178,89 +1199,73 @@ M({ type: "STORE_FILE_DATA", payload: { files: [te] } }); | ||
if (k instanceof Error) | ||
throw x && x(k), k; | ||
throw g && g(k), k; | ||
} | ||
} | ||
s(); | ||
}, []), U(() => { | ||
n && n.length > 0 && (H(n) || M({ type: "STORE_FILE_DATA", payload: { files: n } })); | ||
}, [n]), U(() => { | ||
d(); | ||
}, []), Z(() => { | ||
n && n.length > 0 && ($(n) || M({ type: "STORE_FILE_DATA", payload: { files: n } })); | ||
}, [n]), Z(() => { | ||
M({ | ||
type: "SET_COMPONENT_STATE", | ||
payload: { | ||
downloadFile: m ?? !0, | ||
removeFile: p ?? !0, | ||
showFileSize: v ?? !0, | ||
showSliderCount: d ?? !0, | ||
rounded: R ?? !0, | ||
downloadFile: v ?? !0, | ||
removeFile: m ?? !0, | ||
showFileSize: x ?? !0, | ||
showSliderCount: o ?? !0, | ||
rounded: S ?? !0, | ||
fileHeight: I ?? "h-32", | ||
fileWidth: Y ?? "w-44", | ||
disabled: P ?? !1 | ||
fileWidth: B ?? "w-44", | ||
disabled: z ?? !1 | ||
} | ||
}); | ||
}, [ | ||
v, | ||
m, | ||
p, | ||
v, | ||
d, | ||
x, | ||
o, | ||
I, | ||
Y, | ||
R, | ||
P | ||
B, | ||
S, | ||
z | ||
]); | ||
const ee = (s) => { | ||
const y = Array.from(s.target.files || []); | ||
H(y) || M({ type: "APPEND_FILE_DATA", payload: { files: y } }); | ||
}, fe = (s) => { | ||
M({ type: "REMOVE_FILE_DATA", payload: s }), A && A(s); | ||
}, re = (s) => { | ||
Q && Q(s); | ||
const ee = (d) => { | ||
const y = Array.from(d.target.files || []); | ||
$(y) || M({ type: "APPEND_FILE_DATA", payload: { files: y } }); | ||
}, fe = (d) => { | ||
M({ type: "REMOVE_FILE_DATA", payload: d }), A && A(d); | ||
}, re = (d) => { | ||
Q && Q(d); | ||
}; | ||
U(() => { | ||
X && X(F); | ||
}, [F]); | ||
const O = (s) => { | ||
s.preventDefault(), s.dataTransfer.dropEffect = "copy"; | ||
}, z = (s) => { | ||
s.preventDefault(); | ||
}, V = (s) => { | ||
s.preventDefault(); | ||
const y = Array.from(s.dataTransfer.files); | ||
y && y.length > 0 && (H(y) || M({ type: "APPEND_FILE_DATA", payload: { files: y } })); | ||
Z(() => { | ||
X && X(P); | ||
}, [P]); | ||
const O = (d) => { | ||
d.preventDefault(), d.dataTransfer.dropEffect = "copy"; | ||
}, L = (d) => { | ||
d.preventDefault(); | ||
}, V = (d) => { | ||
d.preventDefault(); | ||
const y = Array.from(d.dataTransfer.files); | ||
y && y.length > 0 && ($(y) || M({ type: "APPEND_FILE_DATA", payload: { files: y } })); | ||
}; | ||
return ce.zoom ? /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(E0, {}) }) : /* @__PURE__ */ t.jsx("div", { className: "w-full", children: /* @__PURE__ */ t.jsx("div", { className: "flex flex-row max-h-2", children: /* @__PURE__ */ t.jsxs("div", { className: `${E ?? "basis-11/12"} mx-auto`, children: [ | ||
F.length > 0 ? /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsxs("div", { className: "flex justify-between bg-gray-200 ", children: [ | ||
/* @__PURE__ */ t.jsx("div", { className: "h-10 text-sm pt-2 ml-2 font-medium", children: /* @__PURE__ */ t.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: ${F.length}` }) }), | ||
/* @__PURE__ */ t.jsxs( | ||
"label", | ||
{ | ||
htmlFor: "fileInput", | ||
className: `${P ? "cursor-not-allowed opacity-50 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 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" : "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", | ||
/* @__PURE__ */ t.jsx( | ||
"input", | ||
{ | ||
id: "fileInput", | ||
disabled: P, | ||
type: "file", | ||
onChange: (s) => { | ||
ee(s), $ && $(s); | ||
}, | ||
style: { display: "none" }, | ||
multiple: g ?? !0, | ||
accept: j ?? "" | ||
} | ||
) | ||
] | ||
} | ||
) | ||
] }) }) : /* @__PURE__ */ t.jsx(t.Fragment, {}), | ||
P.length > 0 && /* @__PURE__ */ t.jsx( | ||
_0, | ||
{ | ||
fileData: P, | ||
multiple: p, | ||
disabled: z, | ||
accept: j, | ||
onChange: Y, | ||
handleImage: ee | ||
} | ||
), | ||
/* @__PURE__ */ t.jsx( | ||
"div", | ||
{ | ||
className: `${D && `overflow-auto ${D}`} ${F.length == 0 && `border-2 border-dashed border-gray-300 ${P ? "" : "hover:bg-stone-200"} `} flex flex-row flex-wrap gap-4 p-6 bg-stone-100 shadow dark:bg-gray-800 `, | ||
className: `${F && `overflow-auto ${F}`} ${P.length == 0 && `border-2 border-dashed border-gray-300 ${z ? "" : "hover:bg-stone-200"} `} flex flex-row flex-wrap gap-4 p-6 bg-stone-100 shadow dark:bg-gray-800 `, | ||
onDragOver: O, | ||
onDragLeave: z, | ||
onDragLeave: L, | ||
onDrop: V, | ||
"data-testid": "dropzone", | ||
children: F.length > 0 ? F.map((s, y) => /* @__PURE__ */ t.jsxs("div", { className: "relative pb-5 group ", onClick: () => re(s), children: [ | ||
children: P.length > 0 ? P.map((d, y) => /* @__PURE__ */ t.jsxs("div", { className: "relative pb-5 group", onClick: () => re(d), children: [ | ||
/* @__PURE__ */ t.jsx("div", { className: "ml-9", children: ue.removeFile ? /* @__PURE__ */ t.jsx( | ||
@@ -1271,3 +1276,3 @@ "svg", | ||
"data-testid": "remove-file-button", | ||
onClick: () => fe(s), | ||
onClick: () => fe(d), | ||
className: "absolute -top-2 right-0 z-10 text-black opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer h-5 w-5", | ||
@@ -1279,3 +1284,3 @@ fill: "currentColor", | ||
) : /* @__PURE__ */ t.jsx(t.Fragment, {}) }), | ||
/* @__PURE__ */ t.jsx("div", { className: "clear-right", children: /* @__PURE__ */ t.jsx(b0, { file: s, index: y }) }) | ||
/* @__PURE__ */ t.jsx("div", { className: "clear-right", children: /* @__PURE__ */ t.jsx(b0, { file: d, index: y }) }) | ||
] }, y)) : /* @__PURE__ */ t.jsxs( | ||
@@ -1285,3 +1290,3 @@ "label", | ||
htmlFor: "fileInput", | ||
className: `${P ? "mx-auto cursor-not-allowed flex items-center" : "mx-auto cursor-pointer flex items-center"}`, | ||
className: `${z ? "mx-auto cursor-not-allowed flex items-center" : "mx-auto cursor-pointer flex items-center"}`, | ||
children: [ | ||
@@ -1293,8 +1298,8 @@ "Drop files here, or click to browse files", | ||
id: "fileInput", | ||
disabled: P, | ||
disabled: z, | ||
type: "file", | ||
onChange: (s) => { | ||
ee(s), $ && $(s); | ||
onChange: (d) => { | ||
ee(d), Y && Y(d); | ||
}, | ||
multiple: g ?? !0, | ||
multiple: p ?? !0, | ||
accept: j ?? "", | ||
@@ -1311,5 +1316,5 @@ style: { display: "none" } | ||
}; | ||
const S0 = (n) => /* @__PURE__ */ t.jsx(w0, { children: /* @__PURE__ */ t.jsx(_0, { ...n }) }); | ||
const T0 = (n) => /* @__PURE__ */ t.jsx(w0, { children: /* @__PURE__ */ t.jsx(R0, { ...n }) }); | ||
export { | ||
S0 as ReactFilesPreview | ||
T0 as ReactFilesPreview | ||
}; |
@@ -1,2 +0,2 @@ | ||
(function(I,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],d):(I=typeof globalThis<"u"?globalThis:I||self,d(I.ReactFilesPreview={},I.React))})(this,function(I,d){"use strict";var ce={exports:{}},G={};/** | ||
(function(I,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],h):(I=typeof globalThis<"u"?globalThis:I||self,h(I.ReactFilesPreview={},I.React))})(this,function(I,h){"use strict";var ce={exports:{}},Y={};/** | ||
* @license React | ||
@@ -9,3 +9,3 @@ * react-jsx-runtime.production.min.js | ||
* LICENSE file in the root directory of this source tree. | ||
*/var je;function He(){if(je)return G;je=1;var n=d,u=Symbol.for("react.element"),p=Symbol.for("react.fragment"),g=Object.prototype.hasOwnProperty,m=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,h={key:!0,ref:!0,__self:!0,__source:!0};function x(E,f,k){var _,T={},F=null,V=null;k!==void 0&&(F=""+k),f.key!==void 0&&(F=""+f.key),f.ref!==void 0&&(V=f.ref);for(_ in f)g.call(f,_)&&!h.hasOwnProperty(_)&&(T[_]=f[_]);if(E&&E.defaultProps)for(_ in f=E.defaultProps,f)T[_]===void 0&&(T[_]=f[_]);return{$$typeof:u,type:E,key:F,ref:V,props:T,_owner:m.current}}return G.Fragment=p,G.jsx=x,G.jsxs=x,G}var J={};/** | ||
*/var je;function Ve(){if(je)return Y;je=1;var n=h,c=Symbol.for("react.element"),m=Symbol.for("react.fragment"),p=Object.prototype.hasOwnProperty,w=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function g(E,u,S){var _,k={},F=null,V=null;S!==void 0&&(F=""+S),u.key!==void 0&&(F=""+u.key),u.ref!==void 0&&(V=u.ref);for(_ in u)p.call(u,_)&&!l.hasOwnProperty(_)&&(k[_]=u[_]);if(E&&E.defaultProps)for(_ in u=E.defaultProps,u)k[_]===void 0&&(k[_]=u[_]);return{$$typeof:c,type:E,key:F,ref:V,props:k,_owner:w.current}}return Y.Fragment=m,Y.jsx=g,Y.jsxs=g,Y}var G={};/** | ||
* @license React | ||
@@ -18,13 +18,13 @@ * react-jsx-runtime.development.js | ||
* LICENSE file in the root directory of this source tree. | ||
*/var Ee;function Ze(){return Ee||(Ee=1,process.env.NODE_ENV!=="production"&&function(){var n=d,u=Symbol.for("react.element"),p=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),m=Symbol.for("react.strict_mode"),h=Symbol.for("react.profiler"),x=Symbol.for("react.provider"),E=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),V=Symbol.for("react.offscreen"),K=Symbol.iterator,P="@@iterator";function Z(e){if(e===null||typeof e!="object")return null;var t=K&&e[K]||e[P];return typeof t=="function"?t:null}var A=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(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=A.ReactDebugCurrentFrame,c=i.getStackAddendum();c!==""&&(t+="%s",a=a.concat([c]));var v=a.map(function(l){return String(l)});v.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,v)}}var q=!1,D=!1,ue=!1,fe=!1,M=!1,W;W=Symbol.for("react.module.reference");function ee(e){return!!(typeof e=="string"||typeof e=="function"||e===g||e===h||M||e===m||e===k||e===_||fe||e===V||q||D||ue||typeof e=="object"&&e!==null&&(e.$$typeof===F||e.$$typeof===T||e.$$typeof===x||e.$$typeof===E||e.$$typeof===f||e.$$typeof===W||e.getModuleId!==void 0))}function de(e,t,a){var i=e.displayName;if(i)return i;var c=t.displayName||t.name||"";return c!==""?a+"("+c+")":a}function te(e){return e.displayName||"Context"}function O(e){if(e==null)return null;if(typeof e.tag=="number"&&w("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 p:return"Portal";case h:return"Profiler";case m:return"StrictMode";case k:return"Suspense";case _:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case E:var t=e;return te(t)+".Consumer";case x:var a=e;return te(a._context)+".Provider";case f:return de(e,e.render,"ForwardRef");case T:var i=e.displayName||null;return i!==null?i:O(e.type)||"Memo";case F:{var c=e,v=c._payload,l=c._init;try{return O(l(v))}catch{return null}}}return null}var z=Object.assign,H=0,s,b,C,he,B,X,re;function ae(){}ae.__reactDisabledLog=!0;function Qe(){{if(H===0){s=console.log,b=console.info,C=console.warn,he=console.error,B=console.group,X=console.groupCollapsed,re=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ae,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}H++}}function $e(){{if(H--,H===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:z({},e,{value:s}),info:z({},e,{value:b}),warn:z({},e,{value:C}),error:z({},e,{value:he}),group:z({},e,{value:B}),groupCollapsed:z({},e,{value:X}),groupEnd:z({},e,{value:re})})}H<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ve=A.ReactCurrentDispatcher,me;function ne(e,t,a){{if(me===void 0)try{throw Error()}catch(c){var i=c.stack.trim().match(/\n( *(at )?)/);me=i&&i[1]||""}return` | ||
`+me+e}}var pe=!1,ie;{var qe=typeof WeakMap=="function"?WeakMap:Map;ie=new qe}function Te(e,t){if(!e||pe)return"";{var a=ie.get(e);if(a!==void 0)return a}var i;pe=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var v;v=ve.current,ve.current=null,Qe();try{if(t){var l=function(){throw Error()};if(Object.defineProperty(l.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(l,[])}catch(L){i=L}Reflect.construct(e,[],l)}else{try{l.call()}catch(L){i=L}e.call(l.prototype)}}else{try{throw Error()}catch(L){i=L}e()}}catch(L){if(L&&i&&typeof L.stack=="string"){for(var o=L.stack.split(` | ||
*/var Ee;function He(){return Ee||(Ee=1,process.env.NODE_ENV!=="production"&&function(){var n=h,c=Symbol.for("react.element"),m=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),E=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),V=Symbol.for("react.offscreen"),J=Symbol.iterator,z="@@iterator";function K(e){if(e===null||typeof e!="object")return null;var t=J&&e[J]||e[z];return typeof t=="function"?t:null}var A=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(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=A.ReactDebugCurrentFrame,f=i.getStackAddendum();f!==""&&(t+="%s",a=a.concat([f]));var v=a.map(function(s){return String(s)});v.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,v)}}var q=!1,P=!1,ue=!1,fe=!1,M=!1,U;U=Symbol.for("react.module.reference");function ee(e){return!!(typeof e=="string"||typeof e=="function"||e===p||e===l||M||e===w||e===S||e===_||fe||e===V||q||P||ue||typeof e=="object"&&e!==null&&(e.$$typeof===F||e.$$typeof===k||e.$$typeof===g||e.$$typeof===E||e.$$typeof===u||e.$$typeof===U||e.getModuleId!==void 0))}function de(e,t,a){var i=e.displayName;if(i)return i;var f=t.displayName||t.name||"";return f!==""?a+"("+f+")":a}function te(e){return e.displayName||"Context"}function N(e){if(e==null)return null;if(typeof e.tag=="number"&&x("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 p:return"Fragment";case m:return"Portal";case l:return"Profiler";case w:return"StrictMode";case S:return"Suspense";case _:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case E:var t=e;return te(t)+".Consumer";case g:var a=e;return te(a._context)+".Provider";case u:return de(e,e.render,"ForwardRef");case k:var i=e.displayName||null;return i!==null?i:N(e.type)||"Memo";case F:{var f=e,v=f._payload,s=f._init;try{return N(s(v))}catch{return null}}}return null}var L=Object.assign,H=0,d,b,C,he,W,X,re;function ae(){}ae.__reactDisabledLog=!0;function $e(){{if(H===0){d=console.log,b=console.info,C=console.warn,he=console.error,W=console.group,X=console.groupCollapsed,re=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ae,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}H++}}function qe(){{if(H--,H===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:L({},e,{value:d}),info:L({},e,{value:b}),warn:L({},e,{value:C}),error:L({},e,{value:he}),group:L({},e,{value:W}),groupCollapsed:L({},e,{value:X}),groupEnd:L({},e,{value:re})})}H<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ve=A.ReactCurrentDispatcher,me;function ne(e,t,a){{if(me===void 0)try{throw Error()}catch(f){var i=f.stack.trim().match(/\n( *(at )?)/);me=i&&i[1]||""}return` | ||
`+me+e}}var pe=!1,ie;{var et=typeof WeakMap=="function"?WeakMap:Map;ie=new et}function Se(e,t){if(!e||pe)return"";{var a=ie.get(e);if(a!==void 0)return a}var i;pe=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var v;v=ve.current,ve.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(D){i=D}Reflect.construct(e,[],s)}else{try{s.call()}catch(D){i=D}e.call(s.prototype)}}else{try{throw Error()}catch(D){i=D}e()}}catch(D){if(D&&i&&typeof D.stack=="string"){for(var o=D.stack.split(` | ||
`),R=i.stack.split(` | ||
`),y=o.length-1,j=R.length-1;y>=1&&j>=0&&o[y]!==R[j];)j--;for(;y>=1&&j>=0;y--,j--)if(o[y]!==R[j]){if(y!==1||j!==1)do if(y--,j--,j<0||o[y]!==R[j]){var N=` | ||
`+o[y].replace(" at new "," at ");return e.displayName&&N.includes("<anonymous>")&&(N=N.replace("<anonymous>",e.displayName)),typeof e=="function"&&ie.set(e,N),N}while(y>=1&&j>=0);break}}}finally{pe=!1,ve.current=v,$e(),Error.prepareStackTrace=c}var Y=e?e.displayName||e.name:"",Ve=Y?ne(Y):"";return typeof e=="function"&&ie.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 oe(e,t,a){if(e==null)return"";if(typeof e=="function")return Te(e,tt(e));if(typeof e=="string")return ne(e);switch(e){case k:return ne("Suspense");case _:return ne("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case f:return et(e.render);case T:return oe(e.type,t,a);case F:{var i=e,c=i._payload,v=i._init;try{return oe(v(c),t,a)}catch{}}}return""}var le=Object.prototype.hasOwnProperty,ke={},Ce=A.ReactDebugCurrentFrame;function se(e){if(e){var t=e._owner,a=oe(e.type,e._source,t?t.type:null);Ce.setExtraStackFrame(a)}else Ce.setExtraStackFrame(null)}function rt(e,t,a,i,c){{var v=Function.call.bind(le);for(var l in e)if(v(e,l)){var o=void 0;try{if(typeof e[l]!="function"){var R=Error((i||"React class")+": "+a+" type `"+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[l]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw R.name="Invariant Violation",R}o=e[l](t,l,i,a,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(y){o=y}o&&!(o instanceof Error)&&(se(c),w("%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,l,typeof o),se(null)),o instanceof Error&&!(o.message in ke)&&(ke[o.message]=!0,se(c),w("Failed %s type: %s",a,o.message),se(null))}}}var at=Array.isArray;function ge(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 w("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 Q=A.ReactCurrentOwner,ot={key:!0,ref:!0,__self:!0,__source:!0},Fe,De,xe;xe={};function lt(e){if(le.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(le.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"&&Q.current&&t&&Q.current.stateNode!==t){var a=O(Q.current.type);xe[a]||(w('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',O(Q.current.type),e.ref),xe[a]=!0)}}function ut(e,t){{var a=function(){Fe||(Fe=!0,w("%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,w("%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,c,v,l){var o={$$typeof:u,type:e,key:t,ref:a,props:l,_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:c}),Object.freeze&&(Object.freeze(o.props),Object.freeze(o)),o};function ht(e,t,a,i,c){{var v,l={},o=null,R=null;a!==void 0&&(Oe(a),o=""+a),st(t)&&(Oe(t.key),o=""+t.key),lt(t)&&(R=t.ref,ct(t,c));for(v in t)le.call(t,v)&&!ot.hasOwnProperty(v)&&(l[v]=t[v]);if(e&&e.defaultProps){var y=e.defaultProps;for(v in y)l[v]===void 0&&(l[v]=y[v])}if(o||R){var j=typeof e=="function"?e.displayName||e.name||"Unknown":e;o&&ut(l,j),R&&ft(l,j)}return dt(e,o,R,c,i,Q.current,l)}}var we=A.ReactCurrentOwner,Pe=A.ReactDebugCurrentFrame;function U(e){if(e){var t=e._owner,a=oe(e.type,e._source,t?t.type:null);Pe.setExtraStackFrame(a)}else Pe.setExtraStackFrame(null)}var ye;ye=!1;function be(e){return typeof e=="object"&&e!==null&&e.$$typeof===u}function Ae(){{if(we.current){var e=O(we.current.type);if(e)return` | ||
`),y=o.length-1,j=R.length-1;y>=1&&j>=0&&o[y]!==R[j];)j--;for(;y>=1&&j>=0;y--,j--)if(o[y]!==R[j]){if(y!==1||j!==1)do if(y--,j--,j<0||o[y]!==R[j]){var O=` | ||
`+o[y].replace(" at new "," at ");return e.displayName&&O.includes("<anonymous>")&&(O=O.replace("<anonymous>",e.displayName)),typeof e=="function"&&ie.set(e,O),O}while(y>=1&&j>=0);break}}}finally{pe=!1,ve.current=v,qe(),Error.prepareStackTrace=f}var B=e?e.displayName||e.name:"",Ie=B?ne(B):"";return typeof e=="function"&&ie.set(e,Ie),Ie}function tt(e,t,a){return Se(e,!1)}function rt(e){var t=e.prototype;return!!(t&&t.isReactComponent)}function oe(e,t,a){if(e==null)return"";if(typeof e=="function")return Se(e,rt(e));if(typeof e=="string")return ne(e);switch(e){case S:return ne("Suspense");case _:return ne("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case u:return tt(e.render);case k:return oe(e.type,t,a);case F:{var i=e,f=i._payload,v=i._init;try{return oe(v(f),t,a)}catch{}}}return""}var le=Object.prototype.hasOwnProperty,Te={},ke=A.ReactDebugCurrentFrame;function se(e){if(e){var t=e._owner,a=oe(e.type,e._source,t?t.type:null);ke.setExtraStackFrame(a)}else ke.setExtraStackFrame(null)}function at(e,t,a,i,f){{var v=Function.call.bind(le);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(y){o=y}o&&!(o instanceof Error)&&(se(f),x("%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),se(null)),o instanceof Error&&!(o.message in Te)&&(Te[o.message]=!0,se(f),x("Failed %s type: %s",a,o.message),se(null))}}}var nt=Array.isArray;function ge(e){return nt(e)}function it(e){{var t=typeof Symbol=="function"&&Symbol.toStringTag,a=t&&e[Symbol.toStringTag]||e.constructor.name||"Object";return a}}function ot(e){try{return Ce(e),!1}catch{return!0}}function Ce(e){return""+e}function Oe(e){if(ot(e))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",it(e)),Ce(e)}var Q=A.ReactCurrentOwner,lt={key:!0,ref:!0,__self:!0,__source:!0},Ne,Fe,xe;xe={};function st(e){if(le.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return e.ref!==void 0}function ct(e){if(le.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function ut(e,t){if(typeof e.ref=="string"&&Q.current&&t&&Q.current.stateNode!==t){var a=N(Q.current.type);xe[a]||(x('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',N(Q.current.type),e.ref),xe[a]=!0)}}function ft(e,t){{var a=function(){Ne||(Ne=!0,x("%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 dt(e,t){{var a=function(){Fe||(Fe=!0,x("%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 ht=function(e,t,a,i,f,v,s){var o={$$typeof:c,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:f}),Object.freeze&&(Object.freeze(o.props),Object.freeze(o)),o};function vt(e,t,a,i,f){{var v,s={},o=null,R=null;a!==void 0&&(Oe(a),o=""+a),ct(t)&&(Oe(t.key),o=""+t.key),st(t)&&(R=t.ref,ut(t,f));for(v in t)le.call(t,v)&&!lt.hasOwnProperty(v)&&(s[v]=t[v]);if(e&&e.defaultProps){var y=e.defaultProps;for(v in y)s[v]===void 0&&(s[v]=y[v])}if(o||R){var j=typeof e=="function"?e.displayName||e.name||"Unknown":e;o&&ft(s,j),R&&dt(s,j)}return ht(e,o,R,f,i,Q.current,s)}}var we=A.ReactCurrentOwner,Pe=A.ReactDebugCurrentFrame;function Z(e){if(e){var t=e._owner,a=oe(e.type,e._source,t?t.type:null);Pe.setExtraStackFrame(a)}else Pe.setExtraStackFrame(null)}var ye;ye=!1;function be(e){return typeof e=="object"&&e!==null&&e.$$typeof===c}function Ae(){{if(we.current){var e=N(we.current.type);if(e)return` | ||
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 render method of \``+e+"`."}return""}}function mt(e){{if(e!==void 0){var t=e.fileName.replace(/^.*[\\\/]/,""),a=e.lineNumber;return` | ||
Check your code at `+t+":"+a+"."}return""}}var ze={};function mt(e){{var t=Ae();if(!t){var a=typeof e=="string"?e:e.displayName||e.name;a&&(t=` | ||
Check your code at `+t+":"+a+"."}return""}}var Le={};function pt(e){{var t=Ae();if(!t){var a=typeof e=="string"?e:e.displayName||e.name;a&&(t=` | ||
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=mt(t);if(ze[a])return;ze[a]=!0;var i="";e&&e._owner&&e._owner!==we.current&&(i=" It was passed a child from "+O(e._owner.type)+"."),U(e),w('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),U(null)}}function Me(e,t){{if(typeof e!="object")return;if(ge(e))for(var a=0;a<e.length;a++){var i=e[a];be(i)&&Le(i,t)}else if(be(e))e._store&&(e._store.validated=!0);else if(e){var c=Z(e);if(typeof c=="function"&&c!==e.entries)for(var v=c.call(e),l;!(l=v.next()).done;)be(l.value)&&Le(l.value,t)}}}function pt(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===f||t.$$typeof===T))a=t.propTypes;else return;if(a){var i=O(t);rt(a,e.props,"prop",i,e)}else if(t.PropTypes!==void 0&&!ye){ye=!0;var c=O(t);w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",c||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&w("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"){U(e),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",i),U(null);break}}e.ref!==null&&(U(e),w("Invalid attribute `ref` supplied to `React.Fragment`."),U(null))}}function Ie(e,t,a,i,c,v){{var l=ee(e);if(!l){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(c);R?o+=R:o+=Ae();var y;e===null?y="null":ge(e)?y="array":e!==void 0&&e.$$typeof===u?(y="<"+(O(e.type)||"Unknown")+" />",o=" Did you accidentally export a JSX literal instead of a component?"):y=typeof e,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",y,o)}var j=ht(e,t,a,c,v);if(j==null)return j;if(l){var N=t.children;if(N!==void 0)if(i)if(ge(N)){for(var Y=0;Y<N.length;Y++)Me(N[Y],e);Object.freeze&&Object.freeze(N)}else w("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(N,e)}return e===g?gt(j):pt(j),j}}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;J.Fragment=g,J.jsx=yt,J.jsxs=bt}()),J}process.env.NODE_ENV==="production"?ce.exports=He():ce.exports=Ze();var r=ce.exports;const _e=["image/jpeg","image/jpg","image/png","image/gif","image/tiff"],We=(n,u)=>{const p=n.fileData.length-1;switch(u.type){case"STORE_FILE_DATA":return{...n,fileData:u.payload.files};case"SET_COMPONENT_STATE":return{...n,componentState:u.payload};case"APPEND_FILE_DATA":return{...n,fileData:[...n.fileData,...u.payload.files]};case"STORE_FILE_STATE":return{...n,fileState:u.payload};case"REMOVE_FILE_DATA":return{...n,fileData:n.fileData.filter(E=>E.name!==u.payload.name)};case"GET_NEXT_FILE":const g=n.fileState.index+1;let m=g;return g>p&&(m=0),{...n,fileState:{zoom:!0,fileSrc:URL.createObjectURL(n.fileData[m]),index:m,isImage:_e.includes(n.fileData[m].type),fileName:n.fileData[m].name,type:n.fileData[m].type,size:n.fileData[m].size}};case"GET_PREV_FILE":const h=n.fileState.index-1;let x=h;return h<0&&(x=p),{...n,fileState:{zoom:!0,fileSrc:URL.createObjectURL(n.fileData[x]),index:x,isImage:_e.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",disabled:!1}},dispatch:()=>{}}),Be=({children:n})=>{const[u,p]=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:u,dispatch:p},children:n})},Ue=({file:n,fileSrc:u})=>{const[p,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 m=n.name.split(".");let h=m[0];const x=m.pop();h.length>20&&(h=h.substring(0,5)+".."+h.substring(h.length-3,h.length));const E=h+"."+x,f=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:E}),f.showFileSize&&r.jsx("span",{"data-testid":"file-size",className:"text-[10px] dark:text-white",children:p}),f.downloadFile&&u&&r.jsx("a",{className:"float-right absolute top-1 right-0 text-gray-500 dark:text-white",href:u,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"})]})})]})},Re=[{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"}],Se=["image/jpeg","image/jpg","image/png","image/gif","image/tiff"],Ye=({file:n,index:u})=>{const[p,g]=d.useState(null);d.useEffect(()=>{if(n){const f=URL.createObjectURL(n);g(f)}},[n]);const m=Re.filter(f=>f.type==n.type),h=d.useContext(S).state.componentState,{dispatch:x}=d.useContext(S),E=()=>{x({type:"STORE_FILE_STATE",payload:{zoom:!0,fileSrc:p,index:u,isImage:Se.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:()=>E(),className:`${h.rounded&&"rounded-lg"} border-solid border-slate-200 hover:shadow-lg shadow-md hover:cursor-pointer`,children:Se.includes(n.type)?p&&r.jsx("img",{"data-testid":"image-preview",src:p,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:`${m.length>0?m[0].color:"bg-slate-400"} | ||
rounded flex w-16 justify-center h-20 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("div",{className:"h-5 w-44",children:p&&r.jsx(Ue,{file:n,fileSrc:p})})]})},Ge=()=>{const n=d.useContext(S).state.fileData,u=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:(u==null?void 0:u.index)!==null&&r.jsx("div",{className:"text-white text-1xl",children:`${u.index+1} of ${n==null?void 0:n.length}`})})},Je=()=>{const n=d.useContext(S).state.fileState,u=d.useContext(S).state.componentState,p=Re.filter(f=>f.type===n.type),{dispatch:g}=d.useContext(S),m=()=>{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"})},E=()=>{const f=document.documentElement;document.fullscreenElement?document.exitFullscreen&&document.exitFullscreen():f.requestFullscreen&&f.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:E,"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",rel:"noreferrer",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:m,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:`${u.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:`${p.length>0?p[0].color:"bg-slate-400"} rounded flex justify-center w-48 h-48 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("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"})})}),u.showSliderCount?r.jsx(Ge,{}):r.jsx(r.Fragment,{})]})}):null},Ke=({files:n,url:u,downloadFile:p,removeFile:g,showFileSize:m,showSliderCount:h,multiple:x,accept:E,maxFileSize:f,maxFiles:k,width:_,rounded:T,height:F,fileHeight:V,fileWidth:K,disabled:P,onChange:Z,onRemove:A,onError:w,getFiles:$,onClick:q})=>{const D=d.useContext(S).state.fileData,ue=d.useContext(S).state.fileState,fe=d.useContext(S).state.componentState,{dispatch:M}=d.useContext(S),W=s=>{let b=!1;if(k&&(D.length+s.length>k||s.length>k))throw b=!0,w&&w(new Error(`Max ${k} files are allowed to be selected`)),new Error(`Max ${k} files are allowed to be selected`);return f&&s.forEach(C=>{if(C.size>f)throw b=!0,w&&w(new Error(`File size limit exceeded: ${C.name}`)),new Error(`File size limit exceeded: ${C.name}`)}),b};d.useEffect(()=>{async function s(){try{if(u){const C=[{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"}],B=await(await fetch(u)).blob();var b=null;const X=C.filter(ae=>ae.type===B.type);X.length>0&&(b=X[0].ext);const re=new File([B],"file"+b,{type:B.type});M({type:"STORE_FILE_DATA",payload:{files:[re]}})}}catch(C){if(C instanceof Error)throw w&&w(C),C}}s()},[]),d.useEffect(()=>{n&&n.length>0&&(W(n)||M({type:"STORE_FILE_DATA",payload:{files:n}}))},[n]),d.useEffect(()=>{M({type:"SET_COMPONENT_STATE",payload:{downloadFile:p??!0,removeFile:g??!0,showFileSize:m??!0,showSliderCount:h??!0,rounded:T??!0,fileHeight:V??"h-32",fileWidth:K??"w-44",disabled:P??!1}})},[p,g,m,h,V,K,T,P]);const ee=s=>{const b=Array.from(s.target.files||[]);W(b)||M({type:"APPEND_FILE_DATA",payload:{files:b}})},de=s=>{M({type:"REMOVE_FILE_DATA",payload:s}),A&&A(s)},te=s=>{q&&q(s)};d.useEffect(()=>{$&&$(D)},[D]);const O=s=>{s.preventDefault(),s.dataTransfer.dropEffect="copy"},z=s=>{s.preventDefault()},H=s=>{s.preventDefault();const b=Array.from(s.dataTransfer.files);b&&b.length>0&&(W(b)||M({type:"APPEND_FILE_DATA",payload:{files:b}}))};return ue.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:[D.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: ${D.length}`})}),r.jsxs("label",{htmlFor:"fileInput",className:`${P?"cursor-not-allowed opacity-50 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 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":"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",disabled:P,type:"file",onChange:s=>{ee(s),Z&&Z(s)},style:{display:"none"},multiple:x??!0,accept:E??""})]})]})}):r.jsx(r.Fragment,{}),r.jsx("div",{className:`${F&&`overflow-auto ${F}`} ${D.length==0&&`border-2 border-dashed border-gray-300 ${P?"":"hover:bg-stone-200"} `} flex flex-row flex-wrap gap-4 p-6 bg-stone-100 shadow dark:bg-gray-800 `,onDragOver:O,onDragLeave:z,onDrop:H,"data-testid":"dropzone",children:D.length>0?D.map((s,b)=>r.jsxs("div",{className:"relative pb-5 group ",onClick:()=>te(s),children:[r.jsx("div",{className:"ml-9",children:fe.removeFile?r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg","data-testid":"remove-file-button",onClick:()=>de(s),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:s,index:b})})]},b)):r.jsxs("label",{htmlFor:"fileInput",className:`${P?"mx-auto cursor-not-allowed flex items-center":"mx-auto cursor-pointer flex items-center"}`,children:["Drop files here, or click to browse files",r.jsx("input",{id:"fileInput",disabled:P,type:"file",onChange:s=>{ee(s),Z&&Z(s)},multiple:x??!0,accept:E??"",style:{display:"none"}})]})})]})})})},jt="",Xe=n=>r.jsx(Be,{children:r.jsx(Ke,{...n})});I.ReactFilesPreview=Xe,Object.defineProperty(I,Symbol.toStringTag,{value:"Module"})}); | ||
Check the top-level render call using <`+a+">.")}return t}}function De(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var a=pt(t);if(Le[a])return;Le[a]=!0;var i="";e&&e._owner&&e._owner!==we.current&&(i=" It was passed a child from "+N(e._owner.type)+"."),Z(e),x('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 ze(e,t){{if(typeof e!="object")return;if(ge(e))for(var a=0;a<e.length;a++){var i=e[a];be(i)&&De(i,t)}else if(be(e))e._store&&(e._store.validated=!0);else if(e){var f=K(e);if(typeof f=="function"&&f!==e.entries)for(var v=f.call(e),s;!(s=v.next()).done;)be(s.value)&&De(s.value,t)}}}function gt(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===k))a=t.propTypes;else return;if(a){var i=N(t);at(a,e.props,"prop",i,e)}else if(t.PropTypes!==void 0&&!ye){ye=!0;var f=N(t);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",f||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function xt(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),x("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),x("Invalid attribute `ref` supplied to `React.Fragment`."),Z(null))}}function Me(e,t,a,i,f,v){{var s=ee(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=mt(f);R?o+=R:o+=Ae();var y;e===null?y="null":ge(e)?y="array":e!==void 0&&e.$$typeof===c?(y="<"+(N(e.type)||"Unknown")+" />",o=" Did you accidentally export a JSX literal instead of a component?"):y=typeof e,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",y,o)}var j=vt(e,t,a,f,v);if(j==null)return j;if(s){var O=t.children;if(O!==void 0)if(i)if(ge(O)){for(var B=0;B<O.length;B++)ze(O[B],e);Object.freeze&&Object.freeze(O)}else x("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 ze(O,e)}return e===p?xt(j):gt(j),j}}function wt(e,t,a){return Me(e,t,a,!0)}function yt(e,t,a){return Me(e,t,a,!1)}var bt=yt,jt=wt;G.Fragment=p,G.jsx=bt,G.jsxs=jt}()),G}process.env.NODE_ENV==="production"?ce.exports=Ve():ce.exports=He();var r=ce.exports;const Ue=["image/jpeg","image/jpg","image/png","image/gif","image/tiff"],We=(n,c)=>{const m=n.fileData.length-1,p=l=>{const g=n.fileData[l];return{zoom:!0,fileSrc:URL.createObjectURL(g),index:l,isImage:Ue.includes(g.type),fileName:g.name,type:g.type,size:g.size}},w=l=>{l&&l.fileSrc&&l.fileSrc.startsWith("blob:")&&URL.revokeObjectURL(l.fileSrc)};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(S=>S.name!==c.payload.name)};case"GET_NEXT_FILE":const l=n.fileState.index+1,g=l>m?0:l;return w(n.fileState),{...n,fileState:p(g)};case"GET_PREV_FILE":const E=n.fileState.index-1,u=E<0?m:E;return w(n.fileState),{...n,fileState:p(u)};default:return n}},T=h.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",disabled:!1}},dispatch:()=>{}}),Ze=({children:n})=>{const[c,m]=h.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(T.Provider,{value:{state:c,dispatch:m},children:n})},Be=({file:n,fileSrc:c})=>{const[m,p]=h.useState(null);h.useEffect(()=>{n.size<1e6?p(Math.floor(n.size/1e3)+" KB"):p(Math.floor(n.size/1e6)+" MB")},[n.size]);const w=n.name.split(".");let l=w[0];const g=w.pop();l.length>20&&(l=l.substring(0,5)+".."+l.substring(l.length-3,l.length));const E=l+"."+g,u=h.useContext(T).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:E}),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,p]=h.useState(null);h.useEffect(()=>{if(n){const u=URL.createObjectURL(n);return p(u),()=>URL.revokeObjectURL(u)}},[n]);const w=_e.filter(u=>u.type==n.type),l=h.useContext(T).state.componentState,{dispatch:g}=h.useContext(T),E=()=>{g({type:"STORE_FILE_STATE",payload:{zoom:!0,fileSrc:URL.createObjectURL(n),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:()=>E(),className:`${l.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:`${l.fileHeight} ${l.fileWidth} object-fill scale-[0.9]`}):r.jsx("div",{"data-testid":"file-icon-preview",className:`${l.fileHeight} ${l.fileWidth} flex flex-col justify-center content-center items-center`,children:r.jsx("span",{className:`${w.length>0?w[0].color:"bg-slate-400"} | ||
rounded flex w-16 justify-center h-20 items-center`,children:w.length>0?w[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(Be,{file:n,fileSrc:m})})]})},Ge=()=>{const n=h.useContext(T).state.fileData,c=h.useContext(T).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=h.useContext(T).state.fileState,c=h.useContext(T).state.componentState,m=_e.filter(u=>u.type===n.type),{dispatch:p}=h.useContext(T),w=()=>{n.fileSrc&&URL.revokeObjectURL(n.fileSrc),p({type:"STORE_FILE_STATE",payload:{zoom:!1,fileSrc:null,index:0,isImage:!1,fileName:null,type:null,size:0}})},l=()=>{p({type:"GET_NEXT_FILE"})},g=()=>{p({type:"GET_PREV_FILE"})},E=()=>{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:E,"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",rel:"noreferrer",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:w,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:g,"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:l,"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=n=>r.jsx(r.Fragment,{children: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: ${n.fileData.length}`})}),r.jsxs("label",{htmlFor:"fileInput",className:`${n.disabled?"cursor-not-allowed opacity-50 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 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":"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",disabled:n.disabled,type:"file",onChange:c=>{n.handleImage(c),n.onChange&&n.onChange(c)},style:{display:"none"},multiple:n.multiple??!0,accept:n.accept??""})]})]})})}),Xe=({files:n,url:c,downloadFile:m,removeFile:p,showFileSize:w,showSliderCount:l,multiple:g,accept:E,maxFileSize:u,maxFiles:S,width:_,rounded:k,height:F,fileHeight:V,fileWidth:J,disabled:z,onChange:K,onRemove:A,onError:x,getFiles:$,onClick:q})=>{const P=h.useContext(T).state.fileData,ue=h.useContext(T).state.fileState,fe=h.useContext(T).state.componentState,{dispatch:M}=h.useContext(T),U=d=>{let b=!1;if(S&&(P.length+d.length>S||d.length>S))throw b=!0,x&&x(new Error(`Max ${S} files are allowed to be selected`)),new Error(`Max ${S} files are allowed to be selected`);return u&&d.forEach(C=>{if(C.size>u)throw b=!0,x&&x(new Error(`File size limit exceeded: ${C.name}`)),new Error(`File size limit exceeded: ${C.name}`)}),b};h.useEffect(()=>{async function d(){try{if(c){const C=[{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"}],W=await(await fetch(c)).blob();var b=null;const X=C.filter(ae=>ae.type===W.type);X.length>0&&(b=X[0].ext);const re=new File([W],"file"+b,{type:W.type});M({type:"STORE_FILE_DATA",payload:{files:[re]}})}}catch(C){if(C instanceof Error)throw x&&x(C),C}}d()},[]),h.useEffect(()=>{n&&n.length>0&&(U(n)||M({type:"STORE_FILE_DATA",payload:{files:n}}))},[n]),h.useEffect(()=>{M({type:"SET_COMPONENT_STATE",payload:{downloadFile:m??!0,removeFile:p??!0,showFileSize:w??!0,showSliderCount:l??!0,rounded:k??!0,fileHeight:V??"h-32",fileWidth:J??"w-44",disabled:z??!1}})},[m,p,w,l,V,J,k,z]);const ee=d=>{const b=Array.from(d.target.files||[]);U(b)||M({type:"APPEND_FILE_DATA",payload:{files:b}})},de=d=>{M({type:"REMOVE_FILE_DATA",payload:d}),A&&A(d)},te=d=>{q&&q(d)};h.useEffect(()=>{$&&$(P)},[P]);const N=d=>{d.preventDefault(),d.dataTransfer.dropEffect="copy"},L=d=>{d.preventDefault()},H=d=>{d.preventDefault();const b=Array.from(d.dataTransfer.files);b&&b.length>0&&(U(b)||M({type:"APPEND_FILE_DATA",payload:{files:b}}))};return ue.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(Ke,{fileData:P,multiple:g,disabled:z,accept:E,onChange:K,handleImage:ee}),r.jsx("div",{className:`${F&&`overflow-auto ${F}`} ${P.length==0&&`border-2 border-dashed border-gray-300 ${z?"":"hover:bg-stone-200"} `} flex flex-row flex-wrap gap-4 p-6 bg-stone-100 shadow dark:bg-gray-800 `,onDragOver:N,onDragLeave:L,onDrop:H,"data-testid":"dropzone",children:P.length>0?P.map((d,b)=>r.jsxs("div",{className:"relative pb-5 group",onClick:()=>te(d),children:[r.jsx("div",{className:"ml-9",children:fe.removeFile?r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg","data-testid":"remove-file-button",onClick:()=>de(d),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:d,index:b})})]},b)):r.jsxs("label",{htmlFor:"fileInput",className:`${z?"mx-auto cursor-not-allowed flex items-center":"mx-auto cursor-pointer flex items-center"}`,children:["Drop files here, or click to browse files",r.jsx("input",{id:"fileInput",disabled:z,type:"file",onChange:d=>{ee(d),K&&K(d)},multiple:g??!0,accept:E??"",style:{display:"none"}})]})})]})})})},Et="",Qe=n=>r.jsx(Ze,{children:r.jsx(Xe,{...n})});I.ReactFilesPreview=Qe,Object.defineProperty(I,Symbol.toStringTag,{value:"Module"})}); |
{ | ||
"name": "react-files-preview", | ||
"private": false, | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"author": "Usama Chouhan (musama619)", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -0,5 +1,11 @@ | ||
![react-files-preview](https://github.com/musama619/react-files-preview/blob/main/react-files-preview.png?raw=true) | ||
[![Netlify Status](https://api.netlify.com/api/v1/badges/f1c6d960-e969-4396-bdaa-33e245a72bf6/deploy-status)](https://app.netlify.com/sites/react-file-view/deploys) ![codeql](https://github.com/musama619/react-files-preview/workflows/CodeQL/badge.svg) [![codecov](https://codecov.io/github/musama619/react-file-view/branch/main/graph/badge.svg?token=iBQkSenXLe)](https://codecov.io/github/musama619/react-file-view) [![npm](https://img.shields.io/npm/v/react-files-preview)](https://www.npmjs.com/package/react-files-preview) | ||
<div align='center'> | ||
[![Netlify Status](https://api.netlify.com/api/v1/badges/f1c6d960-e969-4396-bdaa-33e245a72bf6/deploy-status)](https://app.netlify.com/sites/react-file-view/deploys) ![codeql](https://github.com/musama619/react-files-preview/workflows/CodeQL/badge.svg) [![npm](https://img.shields.io/npm/v/react-files-preview)](https://www.npmjs.com/package/react-files-preview) | ||
</div> | ||
# react-files-preview | ||
@@ -43,2 +49,3 @@ A file view component for react. | ||
| **`showSliderCount`** | boolean | true | Show slides count under file slider | | ||
| **`disabled`** | boolean | false | If true, prevents user to add files by disabling the component | | ||
| **`multiple`** | boolean | true | Accepts one or more files | | ||
@@ -45,0 +52,0 @@ | **`accept`** | string | | Comma-separated lists of file types. See [MIME Types](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types) | |
Sorry, the diff of this file is not supported yet
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
120370
17
1640
63