dgz-ui
Version:
Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript
7,670 lines • 266 kB
JavaScript
import { j as y } from "./jsx-runtime-C5mzlN2N.js";
import * as _ from "react";
import Q, { useState as Fr, useEffect as ka, useDebugValue as Br, createElement as $n, useRef as Va, useContext as $a } from "react";
import { u as pe, S as ja, c as Ha } from "./index-l1ZGtt0d.js";
import { c as At, u as ke } from "./index-Dmh__Tgi.js";
import { P as Zs, c as J } from "./index-D_OzDH1f.js";
import { u as Ct, a as fr } from "./index-rSIGk0ww.js";
import { u as pr, c as Js, R as qa, A as Ya, C as Wa, a as za } from "./index-VIo8j85K.js";
import { P as ee } from "./index-Do92jweN.js";
import { R as Xa, s as Ka, X as Qa, q as Za } from "./index-Br4MVOGV.js";
import { c as se } from "./utils-B6fNqzRf.js";
import { c as eo } from "./index-BhbquNdX.js";
import { B as Ja } from "./button-Bp2lHjov.js";
import * as to from "react-dom";
import { c as Ur } from "./index-rKs9bXHr.js";
import { a as el, c as no, R as tl, I as nl } from "./index-CCcvTltk.js";
import { u as ro } from "./index-Dz-GVg5i.js";
import { D as rl } from "./index-DqTIeHVj.js";
import { P as sl, h as ol, u as il, R as al, F as ll } from "./index-By7yjsdy.js";
import { u as cl } from "./index-DwYXX2sM.js";
import { V as dl } from "./index-CYIFqWxx.js";
import { c as so } from "./createLucideIcon-B950nf2d.js";
import { C as ul, a as fl } from "./circle-COtEidYe.js";
/**
* @license lucide-react v0.511.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const pl = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], oo = so("chevron-down", pl);
/**
* @license lucide-react v0.511.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const ml = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]], hl = so("chevron-up", ml);
function sn(e) {
const t = _.useRef({ value: e, previous: e });
return _.useMemo(() => (t.current.value !== e && (t.current.previous = t.current.value, t.current.value = e), t.current.previous), [e]);
}
var on = "Checkbox", [El, Ah] = At(on), [gl, mr] = El(on);
function Il(e) {
const {
__scopeCheckbox: t,
checked: n,
children: r,
defaultChecked: s,
disabled: i,
form: o,
name: l,
onCheckedChange: a,
required: c,
value: d = "on",
// @ts-expect-error
internal_do_not_use_render: u
} = e, [m, h] = Ct({
prop: n,
defaultProp: s ?? !1,
onChange: a,
caller: on
}), [f, p] = _.useState(null), [I, g] = _.useState(null), E = _.useRef(!1), T = f ? !!o || !!f.closest("form") : (
// We set this to true by default so that events bubble to forms without JS (SSR)
!0
), v = {
checked: m,
disabled: i,
setChecked: h,
control: f,
setControl: p,
name: l,
form: o,
value: d,
hasConsumerStoppedPropagationRef: E,
required: c,
defaultChecked: Be(s) ? !1 : s,
isFormControl: T,
bubbleInput: I,
setBubbleInput: g
};
return /* @__PURE__ */ y.jsx(
gl,
{
scope: t,
...v,
children: _l(u) ? u(v) : r
}
);
}
var io = "CheckboxTrigger", ao = _.forwardRef(
({ __scopeCheckbox: e, onKeyDown: t, onClick: n, ...r }, s) => {
const {
control: i,
value: o,
disabled: l,
checked: a,
required: c,
setControl: d,
setChecked: u,
hasConsumerStoppedPropagationRef: m,
isFormControl: h,
bubbleInput: f
} = mr(io, e), p = pe(s, d), I = _.useRef(a);
return _.useEffect(() => {
const g = i == null ? void 0 : i.form;
if (g) {
const E = () => u(I.current);
return g.addEventListener("reset", E), () => g.removeEventListener("reset", E);
}
}, [i, u]), /* @__PURE__ */ y.jsx(
ee.button,
{
type: "button",
role: "checkbox",
"aria-checked": Be(a) ? "mixed" : a,
"aria-required": c,
"data-state": po(a),
"data-disabled": l ? "" : void 0,
disabled: l,
value: o,
...r,
ref: p,
onKeyDown: J(t, (g) => {
g.key === "Enter" && g.preventDefault();
}),
onClick: J(n, (g) => {
u((E) => Be(E) ? !0 : !E), f && h && (m.current = g.isPropagationStopped(), m.current || g.stopPropagation());
})
}
);
}
);
ao.displayName = io;
var hr = _.forwardRef(
(e, t) => {
const {
__scopeCheckbox: n,
name: r,
checked: s,
defaultChecked: i,
required: o,
disabled: l,
value: a,
onCheckedChange: c,
form: d,
...u
} = e;
return /* @__PURE__ */ y.jsx(
Il,
{
__scopeCheckbox: n,
checked: s,
defaultChecked: i,
disabled: l,
required: o,
onCheckedChange: c,
name: r,
form: d,
value: a,
internal_do_not_use_render: ({ isFormControl: m }) => /* @__PURE__ */ y.jsxs(y.Fragment, { children: [
/* @__PURE__ */ y.jsx(
ao,
{
...u,
ref: t,
__scopeCheckbox: n
}
),
m && /* @__PURE__ */ y.jsx(
fo,
{
__scopeCheckbox: n
}
)
] })
}
);
}
);
hr.displayName = on;
var lo = "CheckboxIndicator", co = _.forwardRef(
(e, t) => {
const { __scopeCheckbox: n, forceMount: r, ...s } = e, i = mr(lo, n);
return /* @__PURE__ */ y.jsx(
Zs,
{
present: r || Be(i.checked) || i.checked === !0,
children: /* @__PURE__ */ y.jsx(
ee.span,
{
"data-state": po(i.checked),
"data-disabled": i.disabled ? "" : void 0,
...s,
ref: t,
style: { pointerEvents: "none", ...e.style }
}
)
}
);
}
);
co.displayName = lo;
var uo = "CheckboxBubbleInput", fo = _.forwardRef(
({ __scopeCheckbox: e, ...t }, n) => {
const {
control: r,
hasConsumerStoppedPropagationRef: s,
checked: i,
defaultChecked: o,
required: l,
disabled: a,
name: c,
value: d,
form: u,
bubbleInput: m,
setBubbleInput: h
} = mr(uo, e), f = pe(n, h), p = sn(i), I = pr(r);
_.useEffect(() => {
const E = m;
if (!E) return;
const T = window.HTMLInputElement.prototype, D = Object.getOwnPropertyDescriptor(
T,
"checked"
).set, w = !s.current;
if (p !== i && D) {
const A = new Event("click", { bubbles: w });
E.indeterminate = Be(i), D.call(E, Be(i) ? !1 : i), E.dispatchEvent(A);
}
}, [m, p, i, s]);
const g = _.useRef(Be(i) ? !1 : i);
return /* @__PURE__ */ y.jsx(
ee.input,
{
type: "checkbox",
"aria-hidden": !0,
defaultChecked: o ?? g.current,
required: l,
disabled: a,
name: c,
value: d,
form: u,
...t,
tabIndex: -1,
ref: f,
style: {
...t.style,
...I,
position: "absolute",
pointerEvents: "none",
opacity: 0,
margin: 0,
// We transform because the input is absolutely positioned but we have
// rendered it **after** the button. This pulls it back to sit on top
// of the button.
transform: "translateX(-100%)"
}
}
);
}
);
fo.displayName = uo;
function _l(e) {
return typeof e == "function";
}
function Be(e) {
return e === "indeterminate";
}
function po(e) {
return Be(e) ? "indeterminate" : e ? "checked" : "unchecked";
}
const Tl = _.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ y.jsx(
hr,
{
ref: n,
className: se(
"peer border-primary ring-offset-background focus-visible:ring-ring data-[state=checked]:text-primary size-4 shrink-0 rounded-sm border focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",
e
),
...t,
children: /* @__PURE__ */ y.jsx(
co,
{
className: se("flex size-4 items-center justify-center text-current"),
children: t.checked === "indeterminate" ? /* @__PURE__ */ y.jsx(Xa, { className: "text-primary mr-0.5 mb-0.5 size-3.5" }) : /* @__PURE__ */ y.jsx(Ka, { className: "text-primary mr-0.5 mb-0.5 size-3.5" })
}
)
}
));
Tl.displayName = hr.displayName;
const mo = eo(
"flex h-10 w-full rounded-lg border border-border-alpha-strong px-3 py-2 dark:bg-transparent file:border-0 placeholder:text-secondary placeholder:text-body-sm-regular focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-bg focus-visible:ring-offset-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
{
variants: {
variant: {
default: "focus-visible:ring-item-primary",
failure: "focus-visible:ring-item-destructive bg-item-destructive-focus placeholder:text-item-destructive border-item-destructive text-destructive",
success: "focus-visible:ring-success bg-success/20 placeholder:text-success/80 border-success text-success"
}
},
defaultVariants: {
variant: "default"
}
}
), yl = _.forwardRef(
({ className: e, type: t, variant: n, ...r }, s) => {
const [i, o] = Fr(!1), [l, a] = Fr(!1);
return ka(() => {
o(t === "password");
}, [t]), /* @__PURE__ */ y.jsxs("div", { className: "relative", children: [
/* @__PURE__ */ y.jsx(
"input",
{
type: l ? "text" : t,
className: se(
mo({ variant: n }),
e,
i && "pr-10"
),
ref: s,
...r
}
),
i && /* @__PURE__ */ y.jsx(
Ja,
{
type: "button",
size: "icon",
variant: "tertiary",
className: "absolute top-1 right-1 size-8 cursor-pointer rounded-md p-2 !ring-0 !ring-offset-0",
onClick: () => {
a(!l);
},
children: l ? /* @__PURE__ */ y.jsx(Qa, {}) : /* @__PURE__ */ y.jsx(Za, {})
}
)
] });
}
);
yl.displayName = "Input";
var _e = function() {
return _e = Object.assign || function(t) {
for (var n, r = 1, s = arguments.length; r < s; r++) {
n = arguments[r];
for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i]);
}
return t;
}, _e.apply(this, arguments);
};
function ut(e, t, n) {
if (n || arguments.length === 2) for (var r = 0, s = t.length, i; r < s; r++)
(i || !(r in t)) && (i || (i = Array.prototype.slice.call(t, 0, r)), i[r] = t[r]);
return e.concat(i || Array.prototype.slice.call(t));
}
function Rl(e) {
var t = /* @__PURE__ */ Object.create(null);
return function(n) {
return t[n] === void 0 && (t[n] = e(n)), t[n];
};
}
var Sl = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/, vl = /* @__PURE__ */ Rl(
function(e) {
return Sl.test(e) || e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110 && e.charCodeAt(2) < 91;
}
/* Z+1 */
), Z = "-ms-", Dt = "-moz-", W = "-webkit-", ho = "comm", an = "rule", Er = "decl", bl = "@import", Eo = "@keyframes", Ol = "@layer", go = Math.abs, gr = String.fromCharCode, jn = Object.assign;
function Dl(e, t) {
return ue(e, 0) ^ 45 ? (((t << 2 ^ ue(e, 0)) << 2 ^ ue(e, 1)) << 2 ^ ue(e, 2)) << 2 ^ ue(e, 3) : 0;
}
function Io(e) {
return e.trim();
}
function Le(e, t) {
return (e = t.exec(e)) ? e[0] : e;
}
function j(e, t, n) {
return e.replace(t, n);
}
function jt(e, t, n) {
return e.indexOf(t, n);
}
function ue(e, t) {
return e.charCodeAt(t) | 0;
}
function ft(e, t, n) {
return e.slice(t, n);
}
function Ne(e) {
return e.length;
}
function _o(e) {
return e.length;
}
function bt(e, t) {
return t.push(e), e;
}
function wl(e, t) {
return e.map(t).join("");
}
function kr(e, t) {
return e.filter(function(n) {
return !Le(n, t);
});
}
var ln = 1, pt = 1, To = 0, ve = 0, ie = 0, It = "";
function cn(e, t, n, r, s, i, o, l) {
return { value: e, root: t, parent: n, type: r, props: s, children: i, line: ln, column: pt, length: o, return: "", siblings: l };
}
function Fe(e, t) {
return jn(cn("", null, null, "", null, null, 0, e.siblings), e, { length: -e.length }, t);
}
function at(e) {
for (; e.root; )
e = Fe(e.root, { children: [e] });
bt(e, e.siblings);
}
function Cl() {
return ie;
}
function Al() {
return ie = ve > 0 ? ue(It, --ve) : 0, pt--, ie === 10 && (pt = 1, ln--), ie;
}
function Ae() {
return ie = ve < To ? ue(It, ve++) : 0, pt++, ie === 10 && (pt = 1, ln++), ie;
}
function Ke() {
return ue(It, ve);
}
function Ht() {
return ve;
}
function dn(e, t) {
return ft(It, e, t);
}
function Hn(e) {
switch (e) {
// \0 \t \n \r \s whitespace token
case 0:
case 9:
case 10:
case 13:
case 32:
return 5;
// ! + , / > @ ~ isolate token
case 33:
case 43:
case 44:
case 47:
case 62:
case 64:
case 126:
// ; { } breakpoint token
case 59:
case 123:
case 125:
return 4;
// : accompanied token
case 58:
return 3;
// " ' ( [ opening delimit token
case 34:
case 39:
case 40:
case 91:
return 2;
// ) ] closing delimit token
case 41:
case 93:
return 1;
}
return 0;
}
function Pl(e) {
return ln = pt = 1, To = Ne(It = e), ve = 0, [];
}
function Nl(e) {
return It = "", e;
}
function An(e) {
return Io(dn(ve - 1, qn(e === 91 ? e + 2 : e === 40 ? e + 1 : e)));
}
function Ll(e) {
for (; (ie = Ke()) && ie < 33; )
Ae();
return Hn(e) > 2 || Hn(ie) > 3 ? "" : " ";
}
function Ml(e, t) {
for (; --t && Ae() && !(ie < 48 || ie > 102 || ie > 57 && ie < 65 || ie > 70 && ie < 97); )
;
return dn(e, Ht() + (t < 6 && Ke() == 32 && Ae() == 32));
}
function qn(e) {
for (; Ae(); )
switch (ie) {
// ] ) " '
case e:
return ve;
// " '
case 34:
case 39:
e !== 34 && e !== 39 && qn(ie);
break;
// (
case 40:
e === 41 && qn(e);
break;
// \
case 92:
Ae();
break;
}
return ve;
}
function xl(e, t) {
for (; Ae() && e + ie !== 57; )
if (e + ie === 84 && Ke() === 47)
break;
return "/*" + dn(t, ve - 1) + "*" + gr(e === 47 ? e : Ae());
}
function Gl(e) {
for (; !Hn(Ke()); )
Ae();
return dn(e, ve);
}
function Fl(e) {
return Nl(qt("", null, null, null, [""], e = Pl(e), 0, [0], e));
}
function qt(e, t, n, r, s, i, o, l, a) {
for (var c = 0, d = 0, u = o, m = 0, h = 0, f = 0, p = 1, I = 1, g = 1, E = 0, T = "", v = s, D = i, w = r, A = T; I; )
switch (f = E, E = Ae()) {
// (
case 40:
if (f != 108 && ue(A, u - 1) == 58) {
jt(A += j(An(E), "&", "&\f"), "&\f", go(c ? l[c - 1] : 0)) != -1 && (g = -1);
break;
}
// " ' [
case 34:
case 39:
case 91:
A += An(E);
break;
// \t \n \r \s
case 9:
case 10:
case 13:
case 32:
A += Ll(f);
break;
// \
case 92:
A += Ml(Ht() - 1, 7);
continue;
// /
case 47:
switch (Ke()) {
case 42:
case 47:
bt(Bl(xl(Ae(), Ht()), t, n, a), a);
break;
default:
A += "/";
}
break;
// {
case 123 * p:
l[c++] = Ne(A) * g;
// } ; \0
case 125 * p:
case 59:
case 0:
switch (E) {
// \0 }
case 0:
case 125:
I = 0;
// ;
case 59 + d:
g == -1 && (A = j(A, /\f/g, "")), h > 0 && Ne(A) - u && bt(h > 32 ? $r(A + ";", r, n, u - 1, a) : $r(j(A, " ", "") + ";", r, n, u - 2, a), a);
break;
// @ ;
case 59:
A += ";";
// { rule/at-rule
default:
if (bt(w = Vr(A, t, n, c, d, s, l, T, v = [], D = [], u, i), i), E === 123)
if (d === 0)
qt(A, t, w, w, v, i, u, l, D);
else
switch (m === 99 && ue(A, 3) === 110 ? 100 : m) {
// d l m s
case 100:
case 108:
case 109:
case 115:
qt(e, w, w, r && bt(Vr(e, w, w, 0, 0, s, l, T, s, v = [], u, D), D), s, D, u, l, r ? v : D);
break;
default:
qt(A, w, w, w, [""], D, 0, l, D);
}
}
c = d = h = 0, p = g = 1, T = A = "", u = o;
break;
// :
case 58:
u = 1 + Ne(A), h = f;
default:
if (p < 1) {
if (E == 123)
--p;
else if (E == 125 && p++ == 0 && Al() == 125)
continue;
}
switch (A += gr(E), E * p) {
// &
case 38:
g = d > 0 ? 1 : (A += "\f", -1);
break;
// ,
case 44:
l[c++] = (Ne(A) - 1) * g, g = 1;
break;
// @
case 64:
Ke() === 45 && (A += An(Ae())), m = Ke(), d = u = Ne(T = A += Gl(Ht())), E++;
break;
// -
case 45:
f === 45 && Ne(A) == 2 && (p = 0);
}
}
return i;
}
function Vr(e, t, n, r, s, i, o, l, a, c, d, u) {
for (var m = s - 1, h = s === 0 ? i : [""], f = _o(h), p = 0, I = 0, g = 0; p < r; ++p)
for (var E = 0, T = ft(e, m + 1, m = go(I = o[p])), v = e; E < f; ++E)
(v = Io(I > 0 ? h[E] + " " + T : j(T, /&\f/g, h[E]))) && (a[g++] = v);
return cn(e, t, n, s === 0 ? an : l, a, c, d, u);
}
function Bl(e, t, n, r) {
return cn(e, t, n, ho, gr(Cl()), ft(e, 2, -2), 0, r);
}
function $r(e, t, n, r, s) {
return cn(e, t, n, Er, ft(e, 0, r), ft(e, r + 1, -1), r, s);
}
function yo(e, t, n) {
switch (Dl(e, t)) {
// color-adjust
case 5103:
return W + "print-" + e + e;
// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
case 5737:
case 4201:
case 3177:
case 3433:
case 1641:
case 4457:
case 2921:
// text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
case 5572:
case 6356:
case 5844:
case 3191:
case 6645:
case 3005:
// mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
case 6391:
case 5879:
case 5623:
case 6135:
case 4599:
case 4855:
// background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
case 4215:
case 6389:
case 5109:
case 5365:
case 5621:
case 3829:
return W + e + e;
// tab-size
case 4789:
return Dt + e + e;
// appearance, user-select, transform, hyphens, text-size-adjust
case 5349:
case 4246:
case 4810:
case 6968:
case 2756:
return W + e + Dt + e + Z + e + e;
// writing-mode
case 5936:
switch (ue(e, t + 11)) {
// vertical-l(r)
case 114:
return W + e + Z + j(e, /[svh]\w+-[tblr]{2}/, "tb") + e;
// vertical-r(l)
case 108:
return W + e + Z + j(e, /[svh]\w+-[tblr]{2}/, "tb-rl") + e;
// horizontal(-)tb
case 45:
return W + e + Z + j(e, /[svh]\w+-[tblr]{2}/, "lr") + e;
}
// flex, flex-direction, scroll-snap-type, writing-mode
case 6828:
case 4268:
case 2903:
return W + e + Z + e + e;
// order
case 6165:
return W + e + Z + "flex-" + e + e;
// align-items
case 5187:
return W + e + j(e, /(\w+).+(:[^]+)/, W + "box-$1$2" + Z + "flex-$1$2") + e;
// align-self
case 5443:
return W + e + Z + "flex-item-" + j(e, /flex-|-self/g, "") + (Le(e, /flex-|baseline/) ? "" : Z + "grid-row-" + j(e, /flex-|-self/g, "")) + e;
// align-content
case 4675:
return W + e + Z + "flex-line-pack" + j(e, /align-content|flex-|-self/g, "") + e;
// flex-shrink
case 5548:
return W + e + Z + j(e, "shrink", "negative") + e;
// flex-basis
case 5292:
return W + e + Z + j(e, "basis", "preferred-size") + e;
// flex-grow
case 6060:
return W + "box-" + j(e, "-grow", "") + W + e + Z + j(e, "grow", "positive") + e;
// transition
case 4554:
return W + j(e, /([^-])(transform)/g, "$1" + W + "$2") + e;
// cursor
case 6187:
return j(j(j(e, /(zoom-|grab)/, W + "$1"), /(image-set)/, W + "$1"), e, "") + e;
// background, background-image
case 5495:
case 3959:
return j(e, /(image-set\([^]*)/, W + "$1$`$1");
// justify-content
case 4968:
return j(j(e, /(.+:)(flex-)?(.*)/, W + "box-pack:$3" + Z + "flex-pack:$3"), /s.+-b[^;]+/, "justify") + W + e + e;
// justify-self
case 4200:
if (!Le(e, /flex-|baseline/)) return Z + "grid-column-align" + ft(e, t) + e;
break;
// grid-template-(columns|rows)
case 2592:
case 3360:
return Z + j(e, "template-", "") + e;
// grid-(row|column)-start
case 4384:
case 3616:
return n && n.some(function(r, s) {
return t = s, Le(r.props, /grid-\w+-end/);
}) ? ~jt(e + (n = n[t].value), "span", 0) ? e : Z + j(e, "-start", "") + e + Z + "grid-row-span:" + (~jt(n, "span", 0) ? Le(n, /\d+/) : +Le(n, /\d+/) - +Le(e, /\d+/)) + ";" : Z + j(e, "-start", "") + e;
// grid-(row|column)-end
case 4896:
case 4128:
return n && n.some(function(r) {
return Le(r.props, /grid-\w+-start/);
}) ? e : Z + j(j(e, "-end", "-span"), "span ", "") + e;
// (margin|padding)-inline-(start|end)
case 4095:
case 3583:
case 4068:
case 2532:
return j(e, /(.+)-inline(.+)/, W + "$1$2") + e;
// (min|max)?(width|height|inline-size|block-size)
case 8116:
case 7059:
case 5753:
case 5535:
case 5445:
case 5701:
case 4933:
case 4677:
case 5533:
case 5789:
case 5021:
case 4765:
if (Ne(e) - 1 - t > 6)
switch (ue(e, t + 1)) {
// (m)ax-content, (m)in-content
case 109:
if (ue(e, t + 4) !== 45)
break;
// (f)ill-available, (f)it-content
case 102:
return j(e, /(.+:)(.+)-([^]+)/, "$1" + W + "$2-$3$1" + Dt + (ue(e, t + 3) == 108 ? "$3" : "$2-$3")) + e;
// (s)tretch
case 115:
return ~jt(e, "stretch", 0) ? yo(j(e, "stretch", "fill-available"), t, n) + e : e;
}
break;
// grid-(column|row)
case 5152:
case 5920:
return j(e, /(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/, function(r, s, i, o, l, a, c) {
return Z + s + ":" + i + c + (o ? Z + s + "-span:" + (l ? a : +a - +i) + c : "") + e;
});
// position: sticky
case 4949:
if (ue(e, t + 6) === 121)
return j(e, ":", ":" + W) + e;
break;
// display: (flex|inline-flex|grid|inline-grid)
case 6444:
switch (ue(e, ue(e, 14) === 45 ? 18 : 11)) {
// (inline-)?fle(x)
case 120:
return j(e, /(.+:)([^;\s!]+)(;|(\s+)?!.+)?/, "$1" + W + (ue(e, 14) === 45 ? "inline-" : "") + "box$3$1" + W + "$2$3$1" + Z + "$2box$3") + e;
// (inline-)?gri(d)
case 100:
return j(e, ":", ":" + Z) + e;
}
break;
// scroll-margin, scroll-margin-(top|right|bottom|left)
case 5719:
case 2647:
case 2135:
case 3927:
case 2391:
return j(e, "scroll-", "scroll-snap-") + e;
}
return e;
}
function Kt(e, t) {
for (var n = "", r = 0; r < e.length; r++)
n += t(e[r], r, e, t) || "";
return n;
}
function Ul(e, t, n, r) {
switch (e.type) {
case Ol:
if (e.children.length) break;
case bl:
case Er:
return e.return = e.return || e.value;
case ho:
return "";
case Eo:
return e.return = e.value + "{" + Kt(e.children, r) + "}";
case an:
if (!Ne(e.value = e.props.join(","))) return "";
}
return Ne(n = Kt(e.children, r)) ? e.return = e.value + "{" + n + "}" : "";
}
function kl(e) {
var t = _o(e);
return function(n, r, s, i) {
for (var o = "", l = 0; l < t; l++)
o += e[l](n, r, s, i) || "";
return o;
};
}
function Vl(e) {
return function(t) {
t.root || (t = t.return) && e(t);
};
}
function $l(e, t, n, r) {
if (e.length > -1 && !e.return)
switch (e.type) {
case Er:
e.return = yo(e.value, e.length, n);
return;
case Eo:
return Kt([Fe(e, { value: j(e.value, "@", "@" + W) })], r);
case an:
if (e.length)
return wl(n = e.props, function(s) {
switch (Le(s, r = /(::plac\w+|:read-\w+)/)) {
// :read-(only|write)
case ":read-only":
case ":read-write":
at(Fe(e, { props: [j(s, /:(read-\w+)/, ":" + Dt + "$1")] })), at(Fe(e, { props: [s] })), jn(e, { props: kr(n, r) });
break;
// :placeholder
case "::placeholder":
at(Fe(e, { props: [j(s, /:(plac\w+)/, ":" + W + "input-$1")] })), at(Fe(e, { props: [j(s, /:(plac\w+)/, ":" + Dt + "$1")] })), at(Fe(e, { props: [j(s, /:(plac\w+)/, Z + "input-$1")] })), at(Fe(e, { props: [s] })), jn(e, { props: kr(n, r) });
break;
}
return "";
});
}
}
var jl = {
animationIterationCount: 1,
aspectRatio: 1,
borderImageOutset: 1,
borderImageSlice: 1,
borderImageWidth: 1,
boxFlex: 1,
boxFlexGroup: 1,
boxOrdinalGroup: 1,
columnCount: 1,
columns: 1,
flex: 1,
flexGrow: 1,
flexPositive: 1,
flexShrink: 1,
flexNegative: 1,
flexOrder: 1,
gridRow: 1,
gridRowEnd: 1,
gridRowSpan: 1,
gridRowStart: 1,
gridColumn: 1,
gridColumnEnd: 1,
gridColumnSpan: 1,
gridColumnStart: 1,
msGridRow: 1,
msGridRowSpan: 1,
msGridColumn: 1,
msGridColumnSpan: 1,
fontWeight: 1,
lineHeight: 1,
opacity: 1,
order: 1,
orphans: 1,
tabSize: 1,
widows: 1,
zIndex: 1,
zoom: 1,
WebkitLineClamp: 1,
// SVG-related properties
fillOpacity: 1,
floodOpacity: 1,
stopOpacity: 1,
strokeDasharray: 1,
strokeDashoffset: 1,
strokeMiterlimit: 1,
strokeOpacity: 1,
strokeWidth: 1
}, nt = typeof process < "u" && process.env !== void 0 && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || "data-styled", Ro = "active", So = "data-styled-version", un = "6.1.19", Ir = `/*!sc*/
`, Qt = typeof window < "u" && typeof document < "u", Hl = !!(typeof SC_DISABLE_SPEEDY == "boolean" ? SC_DISABLE_SPEEDY : typeof process < "u" && process.env !== void 0 && process.env.REACT_APP_SC_DISABLE_SPEEDY !== void 0 && process.env.REACT_APP_SC_DISABLE_SPEEDY !== "" ? process.env.REACT_APP_SC_DISABLE_SPEEDY !== "false" && process.env.REACT_APP_SC_DISABLE_SPEEDY : typeof process < "u" && process.env !== void 0 && process.env.SC_DISABLE_SPEEDY !== void 0 && process.env.SC_DISABLE_SPEEDY !== "" ? process.env.SC_DISABLE_SPEEDY !== "false" && process.env.SC_DISABLE_SPEEDY : process.env.NODE_ENV !== "production"), jr = /invalid hook call/i, Lt = /* @__PURE__ */ new Set(), ql = function(e, t) {
if (process.env.NODE_ENV !== "production") {
var n = t ? ' with the id of "'.concat(t, '"') : "", r = "The component ".concat(e).concat(n, ` has been created dynamically.
`) + `You may see this warning because you've called styled inside another component.
To resolve this only create new StyledComponents outside of any render method and function component.
See https://styled-components.com/docs/basics#define-styled-components-outside-of-the-render-method for more info.
`, s = console.error;
try {
var i = !0;
console.error = function(o) {
for (var l = [], a = 1; a < arguments.length; a++) l[a - 1] = arguments[a];
jr.test(o) ? (i = !1, Lt.delete(r)) : s.apply(void 0, ut([o], l, !1));
}, Va(), i && !Lt.has(r) && (console.warn(r), Lt.add(r));
} catch (o) {
jr.test(o.message) && Lt.delete(r);
} finally {
console.error = s;
}
}
}, fn = Object.freeze([]), mt = Object.freeze({});
function Yl(e, t, n) {
return n === void 0 && (n = mt), e.theme !== n.theme && e.theme || t || n.theme;
}
var Yn = /* @__PURE__ */ new Set(["a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "menu", "menuitem", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "u", "ul", "use", "var", "video", "wbr", "circle", "clipPath", "defs", "ellipse", "foreignObject", "g", "image", "line", "linearGradient", "marker", "mask", "path", "pattern", "polygon", "polyline", "radialGradient", "rect", "stop", "svg", "text", "tspan"]), Wl = /[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g, zl = /(^-|-$)/g;
function Hr(e) {
return e.replace(Wl, "-").replace(zl, "");
}
var Xl = /(a)(d)/gi, Mt = 52, qr = function(e) {
return String.fromCharCode(e + (e > 25 ? 39 : 97));
};
function Wn(e) {
var t, n = "";
for (t = Math.abs(e); t > Mt; t = t / Mt | 0) n = qr(t % Mt) + n;
return (qr(t % Mt) + n).replace(Xl, "$1-$2");
}
var Pn, vo = 5381, qe = function(e, t) {
for (var n = t.length; n; ) e = 33 * e ^ t.charCodeAt(--n);
return e;
}, bo = function(e) {
return qe(vo, e);
};
function Kl(e) {
return Wn(bo(e) >>> 0);
}
function Oo(e) {
return process.env.NODE_ENV !== "production" && typeof e == "string" && e || e.displayName || e.name || "Component";
}
function Nn(e) {
return typeof e == "string" && (process.env.NODE_ENV === "production" || e.charAt(0) === e.charAt(0).toLowerCase());
}
var Do = typeof Symbol == "function" && Symbol.for, wo = Do ? Symbol.for("react.memo") : 60115, Ql = Do ? Symbol.for("react.forward_ref") : 60112, Zl = { childContextTypes: !0, contextType: !0, contextTypes: !0, defaultProps: !0, displayName: !0, getDefaultProps: !0, getDerivedStateFromError: !0, getDerivedStateFromProps: !0, mixins: !0, propTypes: !0, type: !0 }, Jl = { name: !0, length: !0, prototype: !0, caller: !0, callee: !0, arguments: !0, arity: !0 }, Co = { $$typeof: !0, compare: !0, defaultProps: !0, displayName: !0, propTypes: !0, type: !0 }, ec = ((Pn = {})[Ql] = { $$typeof: !0, render: !0, defaultProps: !0, displayName: !0, propTypes: !0 }, Pn[wo] = Co, Pn);
function Yr(e) {
return ("type" in (t = e) && t.type.$$typeof) === wo ? Co : "$$typeof" in e ? ec[e.$$typeof] : Zl;
var t;
}
var tc = Object.defineProperty, nc = Object.getOwnPropertyNames, Wr = Object.getOwnPropertySymbols, rc = Object.getOwnPropertyDescriptor, sc = Object.getPrototypeOf, zr = Object.prototype;
function Ao(e, t, n) {
if (typeof t != "string") {
if (zr) {
var r = sc(t);
r && r !== zr && Ao(e, r, n);
}
var s = nc(t);
Wr && (s = s.concat(Wr(t)));
for (var i = Yr(e), o = Yr(t), l = 0; l < s.length; ++l) {
var a = s[l];
if (!(a in Jl || n && n[a] || o && a in o || i && a in i)) {
var c = rc(t, a);
try {
tc(e, a, c);
} catch {
}
}
}
}
return e;
}
function ht(e) {
return typeof e == "function";
}
function _r(e) {
return typeof e == "object" && "styledComponentId" in e;
}
function Ye(e, t) {
return e && t ? "".concat(e, " ").concat(t) : e || t || "";
}
function Xr(e, t) {
if (e.length === 0) return "";
for (var n = e[0], r = 1; r < e.length; r++) n += e[r];
return n;
}
function Et(e) {
return e !== null && typeof e == "object" && e.constructor.name === Object.name && !("props" in e && e.$$typeof);
}
function zn(e, t, n) {
if (n === void 0 && (n = !1), !n && !Et(e) && !Array.isArray(e)) return t;
if (Array.isArray(t)) for (var r = 0; r < t.length; r++) e[r] = zn(e[r], t[r]);
else if (Et(t)) for (var r in t) e[r] = zn(e[r], t[r]);
return e;
}
function Tr(e, t) {
Object.defineProperty(e, "toString", { value: t });
}
var oc = process.env.NODE_ENV !== "production" ? { 1: `Cannot create styled-component for component: %s.
`, 2: `Can't collect styles once you've consumed a \`ServerStyleSheet\`'s styles! \`ServerStyleSheet\` is a one off instance for each server-side render cycle.
- Are you trying to reuse it across renders?
- Are you accidentally calling collectStyles twice?
`, 3: `Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser.
`, 4: `The \`StyleSheetManager\` expects a valid target or sheet prop!
- Does this error occur on the client and is your target falsy?
- Does this error occur on the server and is the sheet falsy?
`, 5: `The clone method cannot be used on the client!
- Are you running in a client-like environment on the server?
- Are you trying to run SSR on the client?
`, 6: `Trying to insert a new style tag, but the given Node is unmounted!
- Are you using a custom target that isn't mounted?
- Does your document not have a valid head element?
- Have you accidentally removed a style tag manually?
`, 7: 'ThemeProvider: Please return an object from your "theme" prop function, e.g.\n\n```js\ntheme={() => ({})}\n```\n\n', 8: `ThemeProvider: Please make your "theme" prop an object.
`, 9: "Missing document `<head>`\n\n", 10: `Cannot find a StyleSheet instance. Usually this happens if there are multiple copies of styled-components loaded at once. Check out this issue for how to troubleshoot and fix the common cases where this situation can happen: https://github.com/styled-components/styled-components/issues/1941#issuecomment-417862021
`, 11: `_This error was replaced with a dev-time warning, it will be deleted for v4 final._ [createGlobalStyle] received children which will not be rendered. Please use the component without passing children elements.
`, 12: "It seems you are interpolating a keyframe declaration (%s) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css\\`\\` helper which ensures the styles are injected correctly. See https://www.styled-components.com/docs/api#css\n\n", 13: `%s is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.
`, 14: `ThemeProvider: "theme" prop is required.
`, 15: "A stylis plugin has been supplied that is not named. We need a name for each plugin to be able to prevent styling collisions between different stylis configurations within the same app. Before you pass your plugin to `<StyleSheetManager stylisPlugins={[]}>`, please make sure each plugin is uniquely-named, e.g.\n\n```js\nObject.defineProperty(importedPlugin, 'name', { value: 'some-unique-name' });\n```\n\n", 16: `Reached the limit of how many styled components may be created at group %s.
You may only create up to 1,073,741,824 components. If you're creating components dynamically,
as for instance in your render method then you may be running into this limitation.
`, 17: `CSSStyleSheet could not be found on HTMLStyleElement.
Has styled-components' style tag been unmounted or altered by another script?
`, 18: "ThemeProvider: Please make sure your useTheme hook is within a `<ThemeProvider>`" } : {};
function ic() {
for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
for (var n = e[0], r = [], s = 1, i = e.length; s < i; s += 1) r.push(e[s]);
return r.forEach(function(o) {
n = n.replace(/%[a-z]/, o);
}), n;
}
function _t(e) {
for (var t = [], n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
return process.env.NODE_ENV === "production" ? new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(e, " for more information.").concat(t.length > 0 ? " Args: ".concat(t.join(", ")) : "")) : new Error(ic.apply(void 0, ut([oc[e]], t, !1)).trim());
}
var ac = function() {
function e(t) {
this.groupSizes = new Uint32Array(512), this.length = 512, this.tag = t;
}
return e.prototype.indexOfGroup = function(t) {
for (var n = 0, r = 0; r < t; r++) n += this.groupSizes[r];
return n;
}, e.prototype.insertRules = function(t, n) {
if (t >= this.groupSizes.length) {
for (var r = this.groupSizes, s = r.length, i = s; t >= i; ) if ((i <<= 1) < 0) throw _t(16, "".concat(t));
this.groupSizes = new Uint32Array(i), this.groupSizes.set(r), this.length = i;
for (var o = s; o < i; o++) this.groupSizes[o] = 0;
}
for (var l = this.indexOfGroup(t + 1), a = (o = 0, n.length); o < a; o++) this.tag.insertRule(l, n[o]) && (this.groupSizes[t]++, l++);
}, e.prototype.clearGroup = function(t) {
if (t < this.length) {
var n = this.groupSizes[t], r = this.indexOfGroup(t), s = r + n;
this.groupSizes[t] = 0;
for (var i = r; i < s; i++) this.tag.deleteRule(r);
}
}, e.prototype.getGroup = function(t) {
var n = "";
if (t >= this.length || this.groupSizes[t] === 0) return n;
for (var r = this.groupSizes[t], s = this.indexOfGroup(t), i = s + r, o = s; o < i; o++) n += "".concat(this.tag.getRule(o)).concat(Ir);
return n;
}, e;
}(), lc = 1 << 30, Yt = /* @__PURE__ */ new Map(), Zt = /* @__PURE__ */ new Map(), Wt = 1, xt = function(e) {
if (Yt.has(e)) return Yt.get(e);
for (; Zt.has(Wt); ) Wt++;
var t = Wt++;
if (process.env.NODE_ENV !== "production" && ((0 | t) < 0 || t > lc)) throw _t(16, "".concat(t));
return Yt.set(e, t), Zt.set(t, e), t;
}, cc = function(e, t) {
Wt = t + 1, Yt.set(e, t), Zt.set(t, e);
}, dc = "style[".concat(nt, "][").concat(So, '="').concat(un, '"]'), uc = new RegExp("^".concat(nt, '\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')), fc = function(e, t, n) {
for (var r, s = n.split(","), i = 0, o = s.length; i < o; i++) (r = s[i]) && e.registerName(t, r);
}, pc = function(e, t) {
for (var n, r = ((n = t.textContent) !== null && n !== void 0 ? n : "").split(Ir), s = [], i = 0, o = r.length; i < o; i++) {
var l = r[i].trim();
if (l) {
var a = l.match(uc);
if (a) {
var c = 0 | parseInt(a[1], 10), d = a[2];
c !== 0 && (cc(d, c), fc(e, d, a[3]), e.getTag().insertRules(c, s)), s.length = 0;
} else s.push(l);
}
}
}, Kr = function(e) {
for (var t = document.querySelectorAll(dc), n = 0, r = t.length; n < r; n++) {
var s = t[n];
s && s.getAttribute(nt) !== Ro && (pc(e, s), s.parentNode && s.parentNode.removeChild(s));
}
};
function mc() {
return typeof __webpack_nonce__ < "u" ? __webpack_nonce__ : null;
}
var Po = function(e) {
var t = document.head, n = e || t, r = document.createElement("style"), s = function(l) {
var a = Array.from(l.querySelectorAll("style[".concat(nt, "]")));
return a[a.length - 1];
}(n), i = s !== void 0 ? s.nextSibling : null;
r.setAttribute(nt, Ro), r.setAttribute(So, un);
var o = mc();
return o && r.setAttribute("nonce", o), n.insertBefore(r, i), r;
}, hc = function() {
function e(t) {
this.element = Po(t), this.element.appendChild(document.createTextNode("")), this.sheet = function(n) {
if (n.sheet) return n.sheet;
for (var r = document.styleSheets, s = 0, i = r.length; s < i; s++) {
var o = r[s];
if (o.ownerNode === n) return o;
}
throw _t(17);
}(this.element), this.length = 0;
}
return e.prototype.insertRule = function(t, n) {
try {
return this.sheet.insertRule(n, t), this.length++, !0;
} catch {
return !1;
}
}, e.prototype.deleteRule = function(t) {
this.sheet.deleteRule(t), this.length--;
}, e.prototype.getRule = function(t) {
var n = this.sheet.cssRules[t];
return n && n.cssText ? n.cssText : "";
}, e;
}(), Ec = function() {
function e(t) {
this.element = Po(t), this.nodes = this.element.childNodes, this.length = 0;
}
return e.prototype.insertRule = function(t, n) {
if (t <= this.length && t >= 0) {
var r = document.createTextNode(n);
return this.element.insertBefore(r, this.nodes[t] || null), this.length++, !0;
}
return !1;
}, e.prototype.deleteRule = function(t) {
this.element.removeChild(this.nodes[t]), this.length--;
}, e.prototype.getRule = function(t) {
return t < this.length ? this.nodes[t].textContent : "";
}, e;
}(), gc = function() {
function e(t) {
this.rules = [], this.length = 0;
}
return e.prototype.insertRule = function(t, n) {
return t <= this.length && (this.rules.splice(t, 0, n), this.length++, !0);
}, e.prototype.deleteRule = function(t) {
this.rules.splice(t, 1), this.length--;
}, e.prototype.getRule = function(t) {
return t < this.length ? this.rules[t] : "";
}, e;
}(), Qr = Qt, Ic = { isServer: !Qt, useCSSOMInjection: !Hl }, No = function() {
function e(t, n, r) {
t === void 0 && (t = mt), n === void 0 && (n = {});
var s = this;
this.options = _e(_e({}, Ic), t), this.gs = n, this.names = new Map(r), this.server = !!t.isServer, !this.server && Qt && Qr && (Qr = !1, Kr(this)), Tr(this, function() {
return function(i) {
for (var o = i.getTag(), l = o.length, a = "", c = function(u) {
var m = function(g) {
return Zt.get(g);
}(u);
if (m === void 0) return "continue";
var h = i.names.get(m), f = o.getGroup(u);
if (h === void 0 || !h.size || f.length === 0) return "continue";
var p = "".concat(nt, ".g").concat(u, '[id="').concat(m, '"]'), I = "";
h !== void 0 && h.forEach(function(g) {
g.length > 0 && (I += "".concat(g, ","));
}), a += "".concat(f).concat(p, '{content:"').concat(I, '"}').concat(Ir);
}, d = 0; d < l; d++) c(d);
return a;
}(s);
});
}
return e.registerId = function(t) {
return xt(t);
}, e.prototype.rehydrate = function() {
!this.server && Qt && Kr(this);
}, e.prototype.reconstructWithOptions = function(t, n) {
return n === void 0 && (n = !0), new e(_e(_e({}, this.options), t), this.gs, n && this.names || void 0);
}, e.prototype.allocateGSInstance = function(t) {
return this.gs[t] = (this.gs[t] || 0) + 1;
}, e.prototype.getTag = function() {
return this.tag || (this.tag = (t = function(n) {
var r = n.useCSSOMInjection, s = n.target;
return n.isServer ? new gc(s) : r ? new hc(s) : new Ec(s);
}(this.options), new ac(t)));
var t;
}, e.prototype.hasNameForId = function(t, n) {
return this.names.has(t) && this.names.get(t).has(n);
}, e.prototype.registerName = function(t, n) {
if (xt(t), this.names.has(t)) this.names.get(t).add(n);
else {
var r = /* @__PURE__ */ new Set();
r.add(n), this.names.set(t, r);
}
}, e.prototype.insertRules = function(t, n, r) {
this.registerName(t, n), this.getTag().insertRules(xt(t), r);
}, e.prototype.clearNames = function(t) {
this.names.has(t) && this.names.get(t).clear();
}, e.prototype.clearRules = function(t) {
this.getTag().clearGroup(xt(t)), this.clearNames(t);
}, e.prototype.clearTag = function() {
this.tag = void 0;
}, e;
}(), _c = /&/g, Tc = /^\s*\/\/.*$/gm;
function Lo(e, t) {
return e.map(function(n) {
return n.type === "rule" && (n.value = "".concat(t, " ").concat(n.value), n.value = n.value.replaceAll(",", ",".concat(t, " ")), n.props = n.props.map(function(r) {
return "".concat(t, " ").concat(r);
})), Array.isArray(n.children) && n.type !== "@keyframes" && (n.children = Lo(n.children, t)), n;
});
}
function yc(e) {
var t, n, r, s = mt, i = s.options, o = i === void 0 ? mt : i, l = s.plugins, a = l === void 0 ? fn : l, c = function(m, h, f) {
return f.startsWith(n) && f.endsWith(n) && f.replaceAll(n, "").length > 0 ? ".".concat(t) : m;
}, d = a.slice();
d.push(function(m) {
m.type === an && m.value.includes("&") && (m.props[0] = m.props[0].replace(_c, n).replace(r, c));
}), o.prefix && d.push($l), d.push(Ul);
var u = function(m, h, f, p) {
h === void 0 && (h = ""), f === void 0 && (f = ""), p === void 0 && (p = "&"), t = p, n = h, r = new RegExp("\\".concat(n, "\\b"), "g");
var I = m.replace(Tc, ""), g = Fl(f || h ? "".concat(f, " ").concat(h, " { ").concat(I, " }") : I);
o.namespace && (g = Lo(g, o.namespace));
var E = [];
return Kt(g, kl(d.concat(Vl(function(T) {
return E.push(T);
})))), E;
};
return u.hash = a.length ? a.reduce(function(m, h) {
return h.name || _t(15), qe(m, h.name);
}, vo).toString() : "", u;
}
var Rc = new No(), Xn = yc(), Mo = Q.createContext({ shouldForwardProp: void 0, styleSheet: Rc, stylis: Xn });
Mo.Consumer;
Q.createContext(void 0);
function Zr() {
return $a(Mo);
}
var Jr = function() {
function e(t, n) {
var r = this;
this.inject = function(s, i) {
i === void 0 && (i = Xn);
var o = r.name + i.hash;
s.hasNameForId(r.id, o) || s.insertRules(r.id, o, i(r.rules, o, "@keyframes"));
}, this.name = t, this.id = "sc-keyframes-".concat(t), this.rules = n, Tr(this, function() {
throw _t(12, String(r.name));
});
}
return e.prototype.getName = function(t) {
return t === void 0 && (t = Xn), this.name + t.hash;
}, e;
}(), Sc = function(e) {
return e >= "A" && e <= "Z";
};
function es(e) {
for (var t = "", n = 0; n < e.length; n++) {
var r = e[n];
if (n === 1 && r === "-" && e[0] === "-") return e;
Sc(r) ? t += "-" + r.toLowerCase() : t += r;
}
return t.startsWith("ms-") ? "-" + t : t;
}
var xo = function(e) {
return e == null || e === !1 || e === "";
}, Go = function(e) {
var t, n, r = [];
for (var s in e) {
var i = e[s];
e.hasOwnProperty(s) && !xo(i) && (Array.isArray(i) && i.isCss || ht(i) ? r.push("".concat(es(s), ":"), i, ";") : Et(i) ? r.push.apply(r, ut(ut(["".concat(s, " {")], Go(i), !1), ["}"], !1)) : r.push("".concat(es(s), ": ").concat((t = s, (n = i) == null || typeof n == "boolean" || n === "" ? "" : typeof n != "number" || n === 0 || t in jl || t.startsWith("--") ? String(n).trim() : "".concat(n, "px")), ";")));
}
return r;
};
function Qe(e, t, n, r) {
if (xo(e)) return [];
if (_r(e)) return [".".concat(e.styledComponentId)];
if (ht(e)) {
if (!ht(i = e) || i.prototype && i.prototype.isReactComponent || !t) return [e];
var s = e(t);
return process.env.NODE_ENV === "production" || typeof s != "object" || Array.isArray(s) || s instanceof Jr || Et(s) || s === null || console.error("".concat(Oo(e), " is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.")), Qe(s, t, n, r);
}
var i;
return e instanceof Jr ? n ? (e.inject(n, r), [e.getName(r)]) : [e] : Et(e) ? Go(e) : Array.isArray(e) ? Array.prototype.concat.apply(fn, e.map(function(o) {
return Qe(o, t, n, r);
})) : [e.toString()];
}
function vc(e) {
for (var t = 0; t < e.length; t += 1) {
var n = e[t];
if (ht(n) && !_r(n)) return !1;
}
return !0;
}
var bc = bo(un), Oc = function() {
function e(t, n, r) {
this.rules = t, this.staticRulesId = "", this.isStatic = process.env.NODE_ENV === "production" && (r === void 0 || r.isStatic) && vc(t), this.componentId = n, this.baseHash = qe(bc, n), this.baseStyle = r, No.registerId(n);
}
return e.prototype.generateAndInjectStyles = function(t, n, r) {
var s = this.baseStyle ? this.baseStyle.generateAndInjectStyles(t, n, r) : "";
if (this.isStatic && !r.hash) if (this.staticRulesId && n.hasNameForId(this.componentId, this.staticRulesId)) s = Ye(s, this.staticRulesId);
else {
var i = Xr(Qe(this.rules, t, n, r)), o = Wn(qe(this.baseHash, i) >>> 0);
if (!n.hasNameForId(this.componentId, o)) {
var l = r(i, ".".concat(o), void 0, this.componentId);
n.insertRules(this.componentId, o, l);
}
s = Ye(s, o), this.staticRulesId = o;
}
else {
for (var a = qe(this.baseHash, r.hash), c = "", d = 0; d < this.rules.length; d++) {
var u = this.rules[d];
if (typeof u == "string") c += u, process.env.NODE_ENV !== "production" && (a = qe(a, u));
else if (u) {
var m = Xr(Qe(u, t, n, r));
a = qe(a, m + d), c += m;
}
}
if (c) {
var h = Wn(a >>> 0);
n.hasNameForId(this.componentId, h) || n.insertRules(this.componentId, h, r(c, ".".concat(h), void 0, this.componentId)), s = Ye(s, h);
}
}
return s;
}, e;
}(), Fo = Q.createContext(void 0);
Fo.Consumer;
var Ln = {}, ts = /* @__PURE__ */ new Set();
function Dc(e, t, n) {
var r = _r(e), s = e, i = !Nn(e), o = t.attrs, l = o === void 0 ? fn : o, a = t.componentId, c = a === void 0 ? function(v, D) {
var w = typeof v != "string" ? "sc" : Hr(v);
Ln[w] = (Ln[w] || 0) + 1;
var A = "".concat(w, "-").concat(Kl(un + w + Ln[w]));
return D ? "".concat(D, "-").concat(A) : A;
}(t.displayName, t.parentComponentId) : a, d = t.displayName, u = d === void 0 ? function(v) {
return Nn(v) ? "styled.".concat(v) : "Styled(".concat(Oo(v), ")");
}(e) : d, m = t.displayName && t.componentId ? "".concat(Hr(t.displayName), "-").concat(t.componentId) : t.componentId || c, h = r && s.attrs ? s.attrs.concat(l).filter(Boolean) : l, f = t.shouldForwardProp;
if (r && s.shouldForwardProp) {
var p = s.shouldForwardProp;
if (t.shouldForwardProp) {
var I = t.shouldForwardProp;
f = function(v, D) {
return p(v, D) && I(v, D);
};
} else f = p;
}
var g = new Oc(n, m, r ? s.componentStyle : void 0);
function E(v, D) {
return function(w, A, C) {
var L = w.attrs, V = w.componentStyle, M = w.defaultProps, G = w.foldedComponentIds, z = w.styledComponentId, O = w.target, U = Q.useContext(Fo), R = Zr(), b = w.shouldForwardProp || R.shouldForwardProp;
process.env.NODE_ENV !== "production" && Br(z);
var N = Yl(A, U, M) || mt, P = function(be, B, x) {
for (var H, K = _e(_e({}, B), { className: void 0, theme: x }), $ = 0; $ < be.length; $ += 1) {
var q = ht(H = be[$]) ? H(K) : H;
for (var Y in q) K[Y] = Y === "className" ? Ye(K[Y], q[Y]) : Y === "style" ? _e(_e({}, K[Y]), q[Y]) : q[Y];
}
return B.className && (K.className = Ye(K.className, B.className)), K;
}(L, A, N), X = P.as || O, F = {};
for (var ne in P) P[ne] === void 0 || ne[0] === "$" || ne === "as" || ne === "theme" && P.theme === N || (ne === "forwardedAs" ? F.as = P.forwardedAs : b && !b(ne, X) || (F[ne] = P[ne], b || process.env.NODE_ENV !== "development" || vl(ne) || ts.has(ne) || !Yn.has(X) || (ts.add(ne), console.warn('styled-components: it looks like an unknown prop "'.concat(ne, '" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')))));
var Pe = function(be, B) {
var x = Zr(), H = be.generateAndInjectStyles(B, x.styleSheet, x.stylis);
return process.env.NODE_ENV !== "production" && Br(H), H;
}(V, P);
process.env.NODE_ENV !== "production" && w.warnTooManyClasses && w.warnTooManyClasses(Pe);
var le = Ye(G, z);
return Pe && (le += " " + Pe), P.className && (le += " " + P.className), F[Nn(X) && !Yn.has(X) ? "class" : "className"] = le, C && (F.ref = C), $n(X, F);
}(T, v, D);
}
E.displayName = u;
var T = Q.forwardRef(E);
return T.attrs = h, T.componentStyle = g, T.displayName = u, T.shouldForwardProp = f, T.foldedComponentIds = r ? Ye(s.foldedComponentIds, s.styledComponentId) : "", T.styledComponentId = m, T.target = r ? s.target : e, Object.defineProperty(T, "defaultProps", { get: function() {
return this._foldedDefaultProps;
}, set: function(v) {
this._foldedDefaultProps = r ? function(D) {
for (var w = [], A = 1; A < arguments.length; A++) w[A - 1] = arguments[A];
for (var C = 0, L = w; C < L.length; C++) zn(D, L[C], !0);
return D;
}({}, s.defaultProps, v) : v;
} }), process.env.NODE_ENV !== "production" && (ql(u, m), T.warnTooManyClasses = /* @__PURE__ */ function(v, D) {
var w = {}, A = !1;
return function(C) {
if (!A && (w[C] = !0, Object.keys(w).length >= 200)) {
var L = D ? ' with the id of "'.concat(D, '"') : "";
console.warn("Over ".concat(200, " classes were generated for component ").concat(v).concat(L, `.
`) + `Consider using the attrs method, together with a style object for frequently changed styles.
Example:
const Component = styled.div.attrs(props => ({
style: {
background: props.background,
},
}))\`width: 100%;\`
<Component />`), A = !0, w = {};
}
};
}(u, m)), Tr(T, function() {
return ".".concat(T.styledComponentId);
}), i && Ao(T, e, { attrs: !0, componentStyle: !0, displayName: !0, foldedComponentIds: !0, shouldForwardProp: !0, styledComponentId: !0, target: !0 }), T;
}
function ns(e, t) {
for (var n = [e[0]], r = 0, s = t.length; r < s; r += 1) n.push(t[r], e[r + 1]);
return n;
}
var rs = function(e) {
return Object.assign(e, { isCss: !0 });
};
function wc(e) {
for (var t = [], n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
if (ht(e) || Et(e)) return rs(Qe(ns(fn, ut([e], t, !0))));
var r = e;
return t.length === 0 && r.length === 1 && typeof r[0] == "string" ? Qe(r) : rs(Qe(ns(r, t)));
}
function Kn(e, t, n) {
if (n === void 0 && (n = mt), !t) throw _t(1, t);
var r = function(s) {
for (var i = [], o = 1; o < arguments.length; o++) i[o - 1] = arguments[o];
return e(t, n, wc.apply(void 0, ut([s], i, !1)));
};
return r.attrs = function(s) {
return Kn(e, t, _e(_e({}, n), { attrs: Array.prototype.concat(n.attrs, s).filter(Boolean) }));
}, r.withConfig = function(s) {
return Kn(e, t, _e(_e({}, n), s));
}, r;
}
var Bo = function(e) {
return Kn(Dc, e);
}, Uo = Bo;
Yn.forEach(function(e) {
Uo[e] = Bo(e);
});
process.env.NODE_ENV !== "production" && typeof navigator < "u" && navigator.product === "ReactNative" && console.warn(`It looks like you've imported 'styled-components' on React Native.
Perhaps you're looking to import 'styled-components/native'?
Read more about this at https://www.styled-components.com/docs/basics#react-native`);
var Gt = "__sc-".concat(nt, "__");
process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && typeof window < "u" && (window[Gt] || (window[Gt] = 0), window[Gt] === 1 && console.warn(`It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.
See https://s-c.sh/2BAXzed for more info.`), window[Gt] += 1);
/*!
* FilePond 4.32.8
* Licensed under MIT, https://opensource.org/licenses/MIT/
* Please visit https://pqina.nl/filepond/ for details.
*/
const Cc = (e) => e instanceof HTMLElement, Ac = (e, t = [], n = []) => {
const r = {
...e
}, s = [], i = [], o = () => ({ ...r }), l = () => {
const f = [...s];
return s.length = 0, f;
}, a = () => {
const f = [...i];
i.length = 0, f.forEach(({ type: p, data: I }) => {
c(p, I);
});
}, c = (f, p, I) => {
if (I && !document.hidden) {
i.push({ type: f, data: p });
return;
}
h[f] && h[f](p), s.push({
type: f,
data: p
});
}, d = (f, ...p) => m[f] ? m[f](...p) : null, u = {
getState: o,
processActionQueue: l,
processDispatchQueue: a,
dispatch: c,
query: d
};
let m = {};
t.forEach((f) => {
m = {
...f(r),
...m
};
});
let h = {};
return n.forEach((f) => {
h = {
...f(c, d, r),
...h
};
}), u;
}, Pc = (e, t, n) => {
if (typeof n == "function") {
e[t] = n;
return;
}
Object.defineProperty(e, t, { ...n });
}, te = (e, t) => {
for (const n in e)
e.hasOwnProperty(n) && t(n, e[n]);
}, Ue = (e) => {
const t = {};
return te(e, (n) => {
Pc(t, n, e[n]);
}), t;
}, ce = (e, t, n = null) => {
if (n === null)
return e.getAttribute(t) || e.hasAttribute(t);
e.setAttribute(t, n);
}, Nc = "http://www.w3.org/2000/svg", Lc = ["svg", "path"], ss = (e) => Lc.includes(e), Jt = (e, t, n = {}) => {
typeof t == "object" && (n = t, t = null);
const r = ss(e) ? document.createElementNS(Nc, e) : document.createElement(e);
return t && (ss(e) ? ce(r, "class", t) : r.className = t), te(n, (s, i) => {
ce(r, s, i);
}), r;
}, Mc = (e) => (t, n) => {
typeof n < "u" && e.children[n] ? e.insertBefore(t, e.children[n]) : e.appendChild(t);
}, xc = (e, t) => (n, r) => (typeof r < "u" ? t.splice(r, 0, n) : t.push(n), n), Gc = (e, t) => (n) => (t.splice(t.indexOf(n), 1), n.element.parentNode && e.removeChild(n.element), n), Fc = typeof window < "u" && typeof window.document < "u", ko = () => Fc, Bc = ko() ? Jt("svg") : {}, Uc = "children" in Bc ? (e) => e.children.length : (e) => e.childNodes.length, Vo = (e, t, n, r) => {
const s = n[0] || e.left, i = n[1] || e.top, o = s + e.width, l = i + e.height * (r[1] || 1), a = {
// the rectangle of the element itself
element: {
...e
},
// the rectangle of the element expanded to contain its children, does not include any margins
inner: {
left: e.left,
top: e.top,
right: e.right,
bottom: e.bottom
},
// the rectangle of the element expanded to contain its children including own margin and child margins
// margins will be added after we've recalculated the size
outer: {
left: s,
top: i,
right: o,
bottom: l
}
};
return t.filter((c) => !c.isRectIgnored()).map((c) => c.rect).forEach((c) => {
os(a.inner, { ...c.inner }), os(a.outer, { ...c.outer });
}), is(a.inner), a.outer.bottom += a.element.marginBottom, a.outer.right += a.element.marginRight, is(a.outer), a;
}, os = (e, t) => {
t.top += e.top, t.right += e.left, t.bottom += e.top, t.left += e.left, t.bottom > e.bottom && (e.bottom = t.bottom), t.right > e.right && (e.right = t.right);
}, is = (e) => {
e.width = e.right - e.left, e.height = e.bottom - e.top;
}, We = (e) => typeof e == "number", kc = (e, t, n, r = 1e-3) => Math.abs(e - t) < r && Math.abs(n) < r, Vc = (
// default options
({ stiffness: e = 0.5, damping: t = 0.75, mass: n = 10 } = {}) => {
let r = null, s = null, i = 0, o = !1;
const c = Ue({
interpolate: (d, u) => {
if (o) return;
if (!(We(r) && We(s))) {
o = !0, i = 0;
return;
}
const m = -(s - r) * e;
i += m / n, s += i, i *= t, kc(s, r, i) || u ? (s = r, i = 0, o = !0, c.onupdate(s), c.oncomplete(s)) : c.onupdate(s);
},
target: {
set: (d) => {
if (We(d) && !We(s) && (s = d), r === null && (r = d, s = d), r = d, s === r || typeof r > "u") {
o = !0, i = 0, c.onupdate(s), c.oncomplete(s);
return;
}
o = !1;
},
get: () => r
},
resting: {
get: () => o
},
onupdate: (d) => {
},
oncomplete: (d) => {
}
});
return c;
}
), $c = (e) => e < 0.5 ? 2 * e * e : -1 + (4 - 2 * e) * e, jc = (
// default values
({ duration: e = 500, easing: t = $c, delay: n = 0 } = {}) => {
let r = null, s, i, o = !0, l = !1, a = null;
const d = Ue({
interpolate: (u, m) => {
o || a === null || (r === null && (r = u), !(u - r < n) && (s = u - r - n, s >= e || m ? (s = 1, i = l ? 0 : 1, d.onupdate(i * a), d.oncomplete(i * a), o = !0) : (i = s / e, d.onupdate((s >= 0 ? t(l ? 1 - i : i) : 0) * a))));
},
target: {
get: () => l ? 0 : a,
set: (u) => {
if (a === null) {
a = u, d.onupdate(u), d.oncomplete(u);
return;
}
u < a ? (a = 1, l = !0) : (l = !1, a = u), o = !1, r = null;
}
},
resting: {
get: () => o
},
onupdate: (u) => {
},
oncomplete: (u) => {
}
});
return d;
}
), as = {
spring: Vc,
tween: jc
}, Hc = (e, t, n) => {
const r = e[t] && typeof e[t][n] == "object" ? e[t][n] : e[t] || e, s = typeof r == "string" ? r : r.type, i = typeof r == "object" ? { ...r } : {};
return as[s] ? as[s](i) : null;
}, yr = (e, t, n, r = !1) => {
t = Array.isArray(t) ? t : [t], t.forEach((s) => {
e.forEach((i) => {
let o = i, l = () => n[i], a = (c) => n[i] = c;
typeof i == "object" && (o = i.key, l = i.getter || l, a = i.setter || a), !(s[o] && !r) && (s[o] = {
get: l,
set: a
});
});
});
}, qc = ({ mixinConfig: e, viewProps: t, viewInternalAPI: n, viewExternalAPI: r }) => {
const s = { ...t }, i = [];
return te(e, (o, l) => {
const a = Hc(l);
if (!a)
return;
a.onupdate = (d) => {
t[o] = d;
}, a.target = s[o], yr([{
key: o,
setter: (d) => {
a.target !== d && (a.target = d);
},
getter: () => t[o]
}], [n, r], t, !0), i.push(a);
}), {
write: (o) => {
let l = document.hidden, a = !0;
return i.forEach((c) => {
c.resting || (a = !1), c.interpolate(o, l);
}), a;
},
destroy: () => {
}
};
}, Yc = (e) => (t, n) => {
e.addEventListener(t, n);
}, Wc = (e) => (t, n) => {
e.removeEventListener(t, n);
}, zc = ({
mixinConfig: e,
viewProps: t,
viewInternalAPI: n,
viewExternalAPI: r,
viewState: s,
view: i
}) => {
const o = [], l = Yc(i.element), a = Wc(i.element);
return r.on = (c, d) => {
o.push({
type: c,
fn: d
}), l(c, d);
}, r.off = (c, d) => {
o.splice(o.findIndex((u) => u.type === c && u.fn === d), 1), a(c, d);
}, {
write: () => !0,
destroy: () => {
o.forEach((c) => {
a(c.type, c.fn);
});
}
};
}, Xc = ({ mixinConfig: e, viewProps: t, viewExternalAPI: n }) => {
yr(e, n, t);
}, me = (e) => e != null, Kc = {
opacity: 1,
scaleX: 1,
scaleY: 1,
translateX: 0,
translateY: 0,
rotateX: 0,
rotateY: 0,
rotateZ: 0,
originX: 0,
originY: 0
}, Qc = ({ mixinConfig: e, viewProps: t, viewInternalAPI: n, viewExternalAPI: r, view: s }) => {
const i = { ...t }, o = {};
yr(e, [n, r], t);
const l = () => [t.translateX || 0, t.translateY || 0], a = () => [t.scaleX || 0, t.scaleY || 0], c = () => s.rect ? Vo(s.rect, s.childViews, l(), a()) : null;
return n.rect = { get: c }, r.rect = { get: c }, e.forEach((d) => {
t[d] = typeof i[d] > "u" ? Kc[d] : i[d];
}), {
write: () => {
if (Zc(o, t))
return Jc(s.element, t), Object.assign(o, { ...t }), !0;
},
destroy: () => {
}
};
}, Zc = (e, t) => {
if (Object.keys(e).length !== Object.keys(t).length)
return !0;
for (const n in t)
if (t[n] !== e[n])
return !0;
return !1;
}, Jc = (e, {
opacity: t,
perspective: n,
translateX: r,
translateY: s,
scaleX: i,
scaleY: o,
rotateX: l,
rotateY: a,
rotateZ: c,
originX: d,
originY: u,
width: m,
height: h
}) => {
let f = "", p = "";
(me(d) || me(u)) && (p += `transform-origin: ${d || 0}px ${u || 0}px;`), me(n) && (f += `perspective(${n}px) `), (me(r) || me(s)) && (f += `translate3d(${r || 0}px, ${s || 0}px, 0) `), (me(i) || me(o)) && (f += `scale3d(${me(i) ? i : 1}, ${me(o) ? o : 1}, 1) `), me(c) && (f += `rotateZ(${c}rad) `), me(l) && (f += `rotateX(${l}rad) `), me(a) && (f += `rotateY(${a}rad) `), f.length && (p += `transform:${f};`), me(t) && (p += `opacity:${t};`, t === 0 && (p += "visibility:hidden;"), t < 1 && (p += "pointer-events:none;")), me(h) && (p += `height:${h}px;`), me(m) && (p += `width:${m}px;`);
const I = e.elementCurrentStyle || "";
(p.length !== I.length || p !== I) && (e.style.cssText = p, e.elementCurrentStyle = p);
}, ed = {
styles: Qc,
listeners: zc,
animations: qc,
apis: Xc
}, ls = (e = {}, t = {}, n = {}) => (t.layoutCalculated || (e.paddingTop = parseInt(n.paddingTop, 10) || 0, e.marginTop = parseInt(n.marginTop, 10) || 0, e.marginRight = parseInt(n.marginRight, 10) || 0, e.marginBottom = parseInt(n.marginBottom, 10) || 0, e.marginLeft = parseInt(n.marginLeft, 10) || 0, t.layoutCalculated = !0), e.left = t.offsetLeft || 0, e.top = t.offsetTop || 0, e.width = t.offsetWidth || 0, e.height = t.offsetHeight || 0, e.right = e.left + e.width, e.bottom = e.top + e.height, e.scrollTop = t.scrollTop, e.hidden = t.offsetParent === null, e), ae = (
// default view definition
({
// element definition
tag: e = "div",
name: t = null,
attributes: n = {},
// view interaction
read: r = () => {
},
write: s = () => {
},
create: i = () => {
},
destroy: o = () => {
},
// hooks
filterFrameActionsForChild: l = (h, f) => f,
didCreateView: a = () => {
},
didWriteView: c = () => {
},
// rect related
ignoreRect: d = !1,
ignoreRectUpdate: u = !1,
// mixins
mixins: m = []
} = {}) => (h, f = {}) => {
const p = Jt(e, `filepond--${t}`, n), I = window.getComputedStyle(p, null), g = ls();
let E = null, T = !1;
const v = [], D = [], w = {}, A = {}, C = [
s
// default writer
], L = [
r
// default reader
], V = [
o
// default destroy
], M = () => p, G = () => v.concat(), z = () => w, O = (B) => (x, H) => x(B, H), U = () => E || (E = Vo(g, v, [0, 0], [1, 1]), E), R = () => I, b = () => {
E = null, v.forEach((H) => H._read()), !(u && g.width && g.height) && ls(g, p, I);
const x = { root: le, props: f, rect: g };
L.forEach((H) => H(x));
}, N = (B, x, H) => {
let K = x.length === 0;
return C.forEach(($) => {
$({
props: f,
root: le,
actions: x,
timestamp: B,
shouldOptimize: H
}) === !1 && (K = !1);
}), D.forEach(($) => {
$.write(B) === !1 && (K = !1);
}), v.filter(($) => !!$.element.parentNode).forEach(($) => {
$._write(
B,
l($, x),
H
) || (K = !1);
}), v.forEach(($, q) => {
$.element.parentNode || (le.appendChild($.element, q), $._read(), $._write(
B,
l($, x),
H
), K = !1);
}), T = K, c({
props: f,
root: le,
actions: x,
timestamp: B
}), K;
}, P = () => {
D.forEach((B) => B.destroy()), V.forEach((B) => {
B({ root: le, props: f });
}), v.forEach((B) => B._destroy());
}, X = {
element: {
get: M
},
style: {
get: R
},
childViews: {
get: G
}
}, F = {
...X,
rect: {
get: U
},
// access to custom children references
ref: {
get: z
},
// dom modifiers
is: (B) => t === B,
appendChild: Mc(p),
createChildView: O(h),
linkView: (B) => (v.push(B), B),
unlinkView: (B) => {
v.splice(v.indexOf(B), 1);
},
appendChildView: xc(p, v),
removeChildView: Gc(p, v),
registerWriter: (B) => C.push(B),
registerReader: (B) => L.push(B),
registerDestroyer: (B) => V.push(B),
invalidateLayout: () => p.layoutCalculated = !1,
// access to data store
dispatch: h.dispatch,
query: h.query
}, ne = {
element: {
get: M
},
childViews: {
get: G
},
rect: {
get: U
},
resting: {
get: () => T
},
isRectIgnored: () => d,
_read: b,
_write: N,
_destroy: P
}, Pe = {
...X,
rect: {
get: () => g
}
};
Object.keys(m).sort((B, x) => B === "styles" ? 1 : x === "styles" ? -1 : 0).forEach((B) => {
const x = ed[B]({
mixinConfig: m[B],
viewProps: f,
viewState: A,
viewInternalAPI: F,
viewExternalAPI: ne,
view: Ue(Pe)
});
x && D.push(x);
});
const le = Ue(F);
i({
root: le,
props: f
});
const be = Uc(p);
return v.forEach((B, x) => {
le.appendChild(B.element, be + x);
}), a(le), Ue(ne);
}
), td = (e, t, n = 60) => {
const r = "__framePainter";
if (window[r]) {
window[r].readers.push(e), window[r].writers.push(t);
return;
}
window[r] = {
readers: [e],
writers: [t]
};
const s = window[r], i = 1e3 / n;
let o = null, l = null, a = null, c = null;
const d = () => {
document.hidden ? (a = () => window.setTimeout(() => u(performance.now()), i), c = () => window.clearTimeout(l)) : (a = () => window.requestAnimationFrame(u), c = () => window.cancelAnimationFrame(l));
};
document.addEventListener("visibilitychange", () => {
c && c(), d(), u(performance.now());
});
const u = (m) => {
l = a(u), o || (o = m);
const h = m - o;
h <= i || (o = m - h % i, s.readers.forEach((f) => f()), s.writers.forEach((f) => f(m)));
};
return d(), u(performance.now()), {
pause: () => {
c(l);
}
};
}, Ee = (e, t) => ({ root: n, props: r, actions: s = [], timestamp: i, shouldOptimize: o }) => {
s.filter((l) => e[l.type]).forEach(
(l) => e[l.type]({ root: n, props: r, action: l.data, timestamp: i, shouldOptimize: o })
), t && t({ root: n, props: r, actions: s, timestamp: i, shouldOptimize: o });
}, cs = (e, t) => t.parentNode.insertBefore(e, t), ds = (e, t) => t.parentNode.insertBefore(e, t.nextSibling), pn = (e) => Array.isArray(e), Me = (e) => e == null, nd = (e) => e.trim(), mn = (e) => "" + e, rd = (e, t = ",") => Me(e) ? [] : pn(e) ? e : mn(e).split(t).map(nd).filter((n) => n.length), $o = (e) => typeof e == "boolean", jo = (e) => $o(e) ? e : e === "true", he = (e) => typeof e == "string", Ho = (e) => We(e) ? e : he(e) ? mn(e).replace(/[a-z]+/gi, "") : 0, zt = (e) => parseInt(Ho(e), 10), us = (e) => parseFloat(Ho(e)), Tt = (e) => We(e) && isFinite(e) && Math.floor(e) === e, fs = (e, t = 1e3) => {
if (Tt(e))
return e;
let n = mn(e).trim();
return /MB$/i.test(n) ? (n = n.replace(/MB$i/, "").trim(), zt(n) * t * t) : /KB/i.test(n) ? (n = n.replace(/KB$i/, "").trim(), zt(n) * t) : zt(n);
}, ze = (e) => typeof e == "function", sd = (e) => {
let t = self, n = e.split("."), r = null;
for (; r = n.shift(); )
if (t = t[r], !t)
return null;
return t;
}, ps = {
process: "POST",
patch: "PATCH",
revert: "DELETE",
fetch: "GET",
restore: "GET",
load: "GET"
}, od = (e) => {
const t = {};
return t.url = he(e) ? e : e.url || "", t.timeout = e.timeout ? parseInt(e.timeout, 10) : 0, t.headers = e.headers ? e.headers : {}, te(ps, (n) => {
t[n] = id(n, e[n], ps[n], t.timeout, t.headers);
}), t.process = e.process || he(e) || e.url ? t.process : null, t.remove = e.remove || null, delete t.headers, t;
}, id = (e, t, n, r, s) => {
if (t === null)
return null;
if (typeof t == "function")
return t;
const i = {
url: n === "GET" || n === "PATCH" ? `?${e}=` : "",
method: n,
headers: s,
withCredentials: !1,
timeout: r,
onload: null,
ondata: null,
onerror: null
};
if (he(t))
return i.url = t, i;
if (Object.assign(i, t), he(i.headers)) {
const o = i.headers.split(/:(.+)/);
i.headers = {
header: o[0],
value: o[1]
};
}
return i.withCredentials = jo(i.withCredentials), i;
}, ad = (e) => od(e), ld = (e) => e === null, fe = (e) => typeof e == "object" && e !== null, cd = (e) => fe(e) && he(e.url) && fe(e.process) && fe(e.revert) && fe(e.restore) && fe(e.fetch), Qn = (e) => pn(e) ? "array" : ld(e) ? "null" : Tt(e) ? "int" : /^[0-9]+ ?(?:GB|MB|KB)$/gi.test(e) ? "bytes" : cd(e) ? "api" : typeof e, dd = (e) => e.replace(/{\s*'/g, '{"').replace(/'\s*}/g, '"}').replace(/'\s*:/g, '":').replace(/:\s*'/g, ':"').replace(/,\s*'/g, ',"').replace(/'\s*,/g, '",'), ud = {
array: rd,
boolean: jo,
int: (e) => Qn(e) === "bytes" ? fs(e) : zt(e),
number: us,
float: us,
bytes: fs,
string: (e) => ze(e) ? e : mn(e),
function: (e) => sd(e),
serverapi: ad,
object: (e) => {
try {
return JSON.parse(dd(e));
} catch {
return null;
}
}
}, fd = (e, t) => ud[t](e), qo = (e, t, n) => {
if (e === t)
return e;
let r = Qn(e);
if (r !== n) {
const s = fd(e, n);
if (r = Qn(s), s === null)
throw `Trying to assign value with incorrect type to "${option}", allowed type: "${n}"`;
e = s;
}
return e;
}, pd = (e, t) => {
let n = e;
return {
enumerable: !0,
get: () => n,
set: (r) => {
n = qo(r, e, t);
}
};
}, md = (e) => {
const t = {};
return te(e, (n) => {
const r = e[n];
t[n] = pd(r[0], r[1]);
}), Ue(t);
}, hd = (e) => ({
// model
items: [],
// timeout used for calling update items
listUpdateTimeout: null,
// timeout used for stacking metadata updates
itemUpdateTimeout: null,
// queue of items waiting to be processed
processingQueue: [],
// options
options: md(e)
}), hn = (e, t = "-") => e.split(/(?=[A-Z])/).map((n) => n.toLowerCase()).join(t), Ed = (e, t) => {
const n = {};
return te(t, (r) => {
n[r] = {
get: () => e.getState().options[r],
set: (s) => {
e.dispatch(`SET_${hn(r, "_").toUpperCase()}`, {
value: s
});
}
};
}), n;
}, gd = (e) => (t, n, r) => {
const s = {};
return te(e, (i) => {
const o = hn(i, "_").toUpperCase();
s[`SET_${o}`] = (l) => {
try {
r.options[i] = l.value;
} catch {
}
t(`DID_SET_${o}`, { value: r.options[i] });
};
}), s;
}, Id = (e) => (t) => {
const n = {};
return te(e, (r) => {
n[`GET_${hn(r, "_").toUpperCase()}`] = (s) => t.options[r];
}), n;
}, Se = {
API: 1,
DROP: 2,
BROWSE: 3,
PASTE: 4,
NONE: 5
}, Rr = () => Math.random().toString(36).substring(2, 11), Sr = (e, t) => e.splice(t, 1), _d = (e, t) => {
t ? e() : document.hidden ? Promise.resolve(1).then(e) : setTimeout(e, 0);
}, En = () => {
const e = [], t = (r, s) => {
Sr(
e,
e.findIndex((i) => i.event === r && (i.cb === s || !s))
);
}, n = (r, s, i) => {
e.filter((o) => o.event === r).map((o) => o.cb).forEach((o) => _d(() => o(...s), i));
};
return {
fireSync: (r, ...s) => {
n(r, s, !0);
},
fire: (r, ...s) => {
n(r, s, !1);
},
on: (r, s) => {
e.push({ event: r, cb: s });
},
onOnce: (r, s) => {
e.push({
event: r,
cb: (...i) => {
t(r, s), s(...i);
}
});
},
off: t
};
}, Yo = (e, t, n) => {
Object.getOwnPropertyNames(e).filter((r) => !n.includes(r)).forEach(
(r) => Object.defineProperty(t, r, Object.getOwnPropertyDescriptor(e, r))
);
}, Td = [
"fire",
"process",
"revert",
"load",
"on",
"off",
"onOnce",
"retryLoad",
"extend",
"archive",
"archived",
"release",
"released",
"requestProcessing",
"freeze"
], Ie = (e) => {
const t = {};
return Yo(e, t, Td), t;
}, yd = (e) => {
e.forEach((t, n) => {
t.released && Sr(e, n);
});
}, k = {
INIT: 1,
IDLE: 2,
PROCESSING_QUEUED: 9,
PROCESSING: 3,
PROCESSING_COMPLETE: 5,
PROCESSING_ERROR: 6,
PROCESSING_REVERT_ERROR: 10,
LOADING: 7,
LOAD_ERROR: 8
}, de = {
INPUT: 1,
LIMBO: 2,
LOCAL: 3
}, Wo = (e) => /[^0-9]+/.exec(e), zo = () => Wo(1.1.toLocaleString())[0], Rd = () => {
const e = zo(), t = 1e3.toLocaleString();
return t !== "1000" ? Wo(t)[0] : e === "." ? "," : ".";
}, S = {
BOOLEAN: "boolean",
INT: "int",
NUMBER: "number",
STRING: "string",
ARRAY: "array",
OBJECT: "object",
FUNCTION: "function",
ACTION: "action",
SERVER_API: "serverapi",
REGEX: "regex"
}, vr = [], De = (e, t, n) => new Promise((r, s) => {
const i = vr.filter((l) => l.key === e).map((l) => l.cb);
if (i.length === 0) {
r(t);
return;
}
const o = i.shift();
i.reduce(
// loop over promises passing value to next promise
(l, a) => l.then((c) => a(c, n)),
// call initial filter, will return a promise
o(t, n)
// all executed
).then((l) => r(l)).catch((l) => s(l));
}), ot = (e, t, n) => vr.filter((r) => r.key === e).map((r) => r.cb(t, n)), Sd = (e, t) => vr.push({ key: e, cb: t }), vd = (e) => Object.assign(lt, e), en = () => ({ ...lt }), bd = (e) => {
te(e, (t, n) => {
lt[t] && (lt[t][0] = qo(
n,
lt[t][0],
lt[t][1]
));
});
}, lt = {
// the id to add to the root element
id: [null, S.STRING],
// input field name to use
name: ["filepond", S.STRING],
// disable the field
disabled: [!1, S.BOOLEAN],
// classname to put on wrapper
className: [null, S.STRING],
// is the field required
required: [!1, S.BOOLEAN],
// Allow media capture when value is set
captureMethod: [null, S.STRING],
// - "camera", "microphone" or "camcorder",
// - Does not work with multiple on apple devices
// - If set, acceptedFileTypes must be made to match with media wildcard "image/*", "audio/*" or "video/*"
// sync `acceptedFileTypes` property with `accept` attribute
allowSyncAcceptAttribute: [!0, S.BOOLEAN],
// Feature toggles
allowDrop: [!0, S.BOOLEAN],
// Allow dropping of files
allowBrowse: [!0, S.BOOLEAN],
// Allow browsing the file system
allowPaste: [!0, S.BOOLEAN],
// Allow pasting files
allowMultiple: [!1, S.BOOLEAN],
// Allow multiple files (disabled by default, as multiple attribute is also required on input to allow multiple)
allowReplace: [!0, S.BOOLEAN],
// Allow dropping a file on other file to replace it (only works when multiple is set to false)
allowRevert: [!0, S.BOOLEAN],
// Allows user to revert file upload
allowRemove: [!0, S.BOOLEAN],
// Allow user to remove a file
allowProcess: [!0, S.BOOLEAN],
// Allows user to process a file, when set to false, this removes the file upload button
allowReorder: [!1, S.BOOLEAN],
// Allow reordering of files
allowDirectoriesOnly: [!1, S.BOOLEAN],
// Allow only selecting directories with browse (no support for filtering dnd at this point)
// Try store file if `server` not set
storeAsFile: [!1, S.BOOLEAN],
// Revert mode
forceRevert: [!1, S.BOOLEAN],
// Set to 'force' to require the file to be reverted before removal
// Input requirements
maxFiles: [null, S.INT],
// Max number of files
checkValidity: [!1, S.BOOLEAN],
// Enables custom validity messages
// Where to put file
itemInsertLocationFreedom: [!0, S.BOOLEAN],
// Set to false to always add items to begin or end of list
itemInsertLocation: ["before", S.STRING],
// Default index in list to add items that have been dropped at the top of the list
itemInsertInterval: [75, S.INT],
// Drag 'n Drop related
dropOnPage: [!1, S.BOOLEAN],
// Allow dropping of files anywhere on page (prevents browser from opening file if dropped outside of Up)
dropOnElement: [!0, S.BOOLEAN],
// Drop needs to happen on element (set to false to also load drops outside of Up)
dropValidation: [!1, S.BOOLEAN],
// Enable or disable validating files on drop
ignoredFiles: [[".ds_store", "thumbs.db", "desktop.ini"], S.ARRAY],
// Upload related
instantUpload: [!0, S.BOOLEAN],
// Should upload files immediately on drop
maxParallelUploads: [2, S.INT],
// Maximum files to upload in parallel
allowMinimumUploadDuration: [!0, S.BOOLEAN],
// if true uploads take at least 750 ms, this ensures the user sees the upload progress giving trust the upload actually happened
// Chunks
chunkUploads: [!1, S.BOOLEAN],
// Enable chunked uploads
chunkForce: [!1, S.BOOLEAN],
// Force use of chunk uploads even for files smaller than chunk size
chunkSize: [5e6, S.INT],
// Size of chunks (5MB default)
chunkRetryDelays: [[500, 1e3, 3e3], S.ARRAY],
// Amount of times to retry upload of a chunk when it fails
// The server api end points to use for uploading (see docs)
server: [null, S.SERVER_API],
// File size calculations, can set to 1024, this is only used for display, properties use file size base 1000
fileSizeBase: [1e3, S.INT],
// Labels and status messages
labelFileSizeBytes: ["bytes", S.STRING],
labelFileSizeKilobytes: ["KB", S.STRING],
labelFileSizeMegabytes: ["MB", S.STRING],
labelFileSizeGigabytes: ["GB", S.STRING],
labelDecimalSeparator: [zo(), S.STRING],
// Default is locale separator
labelThousandsSeparator: [Rd(), S.STRING],
// Default is locale separator
labelIdle: [
'Drag & Drop your files or <span class="filepond--label-action">Browse</span>',
S.STRING
],
labelInvalidField: ["Field contains invalid files", S.STRING],
labelFileWaitingForSize: ["Waiting for size", S.STRING],
labelFileSizeNotAvailable: ["Size not available", S.STRING],
labelFileCountSingular: ["file in list", S.STRING],
labelFileCountPlural: ["files in list", S.STRING],
labelFileLoading: ["Loading", S.STRING],
labelFileAdded: ["Added", S.STRING],
// assistive only
labelFileLoadError: ["Error during load", S.STRING],
labelFileRemoved: ["Removed", S.STRING],
// assistive only
labelFileRemoveError: ["Error during remove", S.STRING],
labelFileProcessing: ["Uploading", S.STRING],
labelFileProcessingComplete: ["Upload complete", S.STRING],
labelFileProcessingAborted: ["Upload cancelled", S.STRING],
labelFileProcessingError: ["Error during upload", S.STRING],
labelFileProcessingRevertError: ["Error during revert", S.STRING],
labelTapToCancel: ["tap to cancel", S.STRING],
labelTapToRetry: ["tap to retry", S.STRING],
labelTapToUndo: ["tap to undo", S.STRING],
labelButtonRemoveItem: ["Remove", S.STRING],
labelButtonAbortItemLoad: ["Abort", S.STRING],
labelButtonRetryItemLoad: ["Retry", S.STRING],
labelButtonAbortItemProcessing: ["Cancel", S.STRING],
labelButtonUndoItemProcessing: ["Undo", S.STRING],
labelButtonRetryItemProcessing: ["Retry", S.STRING],
labelButtonProcessItem: ["Upload", S.STRING],
// make sure width and height plus viewpox are even numbers so icons are nicely centered
iconRemove: [
'<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M11.586 13l-2.293 2.293a1 1 0 0 0 1.414 1.414L13 14.414l2.293 2.293a1 1 0 0 0 1.414-1.414L14.414 13l2.293-2.293a1 1 0 0 0-1.414-1.414L13 11.586l-2.293-2.293a1 1 0 0 0-1.414 1.414L11.586 13z" fill="currentColor" fill-rule="nonzero"/></svg>',
S.STRING
],
iconProcess: [
'<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M14 10.414v3.585a1 1 0 0 1-2 0v-3.585l-1.293 1.293a1 1 0 0 1-1.414-1.415l3-3a1 1 0 0 1 1.414 0l3 3a1 1 0 0 1-1.414 1.415L14 10.414zM9 18a1 1 0 0 1 0-2h8a1 1 0 0 1 0 2H9z" fill="currentColor" fill-rule="evenodd"/></svg>',
S.STRING
],
iconRetry: [
'<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M10.81 9.185l-.038.02A4.997 4.997 0 0 0 8 13.683a5 5 0 0 0 5 5 5 5 0 0 0 5-5 1 1 0 0 1 2 0A7 7 0 1 1 9.722 7.496l-.842-.21a.999.999 0 1 1 .484-1.94l3.23.806c.535.133.86.675.73 1.21l-.804 3.233a.997.997 0 0 1-1.21.73.997.997 0 0 1-.73-1.21l.23-.928v-.002z" fill="currentColor" fill-rule="nonzero"/></svg>',
S.STRING
],
iconUndo: [
'<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M9.185 10.81l.02-.038A4.997 4.997 0 0 1 13.683 8a5 5 0 0 1 5 5 5 5 0 0 1-5 5 1 1 0 0 0 0 2A7 7 0 1 0 7.496 9.722l-.21-.842a.999.999 0 1 0-1.94.484l.806 3.23c.133.535.675.86 1.21.73l3.233-.803a.997.997 0 0 0 .73-1.21.997.997 0 0 0-1.21-.73l-.928.23-.002-.001z" fill="currentColor" fill-rule="nonzero"/></svg>',
S.STRING
],
iconDone: [
'<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M18.293 9.293a1 1 0 0 1 1.414 1.414l-7.002 7a1 1 0 0 1-1.414 0l-3.998-4a1 1 0 1 1 1.414-1.414L12 15.586l6.294-6.293z" fill="currentColor" fill-rule="nonzero"/></svg>',
S.STRING
],
// event handlers
oninit: [null, S.FUNCTION],
onwarning: [null, S.FUNCTION],
onerror: [null, S.FUNCTION],
onactivatefile: [null, S.FUNCTION],
oninitfile: [null, S.FUNCTION],
onaddfilestart: [null, S.FUNCTION],
onaddfileprogress: [null, S.FUNCTION],
onaddfile: [null, S.FUNCTION],
onprocessfilestart: [null, S.FUNCTION],
onprocessfileprogress: [null, S.FUNCTION],
onprocessfileabort: [null, S.FUNCTION],
onprocessfilerevert: [null, S.FUNCTION],
onprocessfile: [null, S.FUNCTION],
onprocessfiles: [null, S.FUNCTION],
onremovefile: [null, S.FUNCTION],
onpreparefile: [null, S.FUNCTION],
onupdatefiles: [null, S.FUNCTION],
onreorderfiles: [null, S.FUNCTION],
// hooks
beforeDropFile: [null, S.FUNCTION],
beforeAddFile: [null, S.FUNCTION],
beforeRemoveFile: [null, S.FUNCTION],
beforePrepareFile: [null, S.FUNCTION],
// styles
stylePanelLayout: [null, S.STRING],
// null 'integrated', 'compact', 'circle'
stylePanelAspectRatio: [null, S.STRING],
// null or '3:2' or 1
styleItemPanelAspectRatio: [null, S.STRING],
styleButtonRemoveItemPosition: ["left", S.STRING],
styleButtonProcessItemPosition: ["right", S.STRING],
styleLoadIndicatorPosition: ["right", S.STRING],
styleProgressIndicatorPosition: ["right", S.STRING],
styleButtonRemoveItemAlign: [!1, S.BOOLEAN],
// custom initial files array
files: [[], S.ARRAY],
// show support by displaying credits
credits: [["https://pqina.nl/", "Powered by PQINA"], S.ARRAY]
}, Xe = (e, t) => Me(t) ? e[0] || null : Tt(t) ? e[t] || null : (typeof t == "object" && (t = t.id), e.find((n) => n.id === t) || null), Xo = (e) => {
if (Me(e))
return e;
if (/:/.test(e)) {
const t = e.split(":");
return t[1] / t[0];
}
return parseFloat(e);
}, we = (e) => e.filter((t) => !t.archived), Od = {
EMPTY: 0,
IDLE: 1,
// waiting
ERROR: 2,
// a file is in error state
BUSY: 3,
// busy processing or loading
READY: 4
// all files uploaded
};
let Ft = null;
const Dd = () => {
if (Ft === null)
try {
const e = new DataTransfer();
e.items.add(new File(["hello world"], "This_Works.txt"));
const t = document.createElement("input");
t.setAttribute("type", "file"), t.files = e.files, Ft = t.files.length === 1;
} catch {
Ft = !1;
}
return Ft;
}, wd = [
k.LOAD_ERROR,
k.PROCESSING_ERROR,
k.PROCESSING_REVERT_ERROR
], Cd = [
k.LOADING,
k.PROCESSING,
k.PROCESSING_QUEUED,
k.INIT
], Ad = [k.PROCESSING_COMPLETE], Pd = (e) => wd.includes(e.status), Nd = (e) => Cd.includes(e.status), Ld = (e) => Ad.includes(e.status), ms = (e) => fe(e.options.server) && (fe(e.options.server.process) || ze(e.options.server.process)), Md = (e) => ({
GET_STATUS: () => {
const t = we(e.items), { EMPTY: n, ERROR: r, BUSY: s, IDLE: i, READY: o } = Od;
return t.length === 0 ? n : t.some(Pd) ? r : t.some(Nd) ? s : t.some(Ld) ? o : i;
},
GET_ITEM: (t) => Xe(e.items, t),
GET_ACTIVE_ITEM: (t) => Xe(we(e.items), t),
GET_ACTIVE_ITEMS: () => we(e.items),
GET_ITEMS: () => e.items,
GET_ITEM_NAME: (t) => {
const n = Xe(e.items, t);
return n ? n.filename : null;
},
GET_ITEM_SIZE: (t) => {
const n = Xe(e.items, t);
return n ? n.fileSize : null;
},
GET_STYLES: () => Object.keys(e.options).filter((t) => /^style/.test(t)).map((t) => ({
name: t,
value: e.options[t]
})),
GET_PANEL_ASPECT_RATIO: () => /circle/.test(e.options.stylePanelLayout) ? 1 : Xo(e.options.stylePanelAspectRatio),
GET_ITEM_PANEL_ASPECT_RATIO: () => e.options.styleItemPanelAspectRatio,
GET_ITEMS_BY_STATUS: (t) => we(e.items).filter((n) => n.status === t),
GET_TOTAL_ITEMS: () => we(e.items).length,
SHOULD_UPDATE_FILE_INPUT: () => e.options.storeAsFile && Dd() && !ms(e),
IS_ASYNC: () => ms(e),
GET_FILE_SIZE_LABELS: (t) => ({
labelBytes: t("GET_LABEL_FILE_SIZE_BYTES") || void 0,
labelKilobytes: t("GET_LABEL_FILE_SIZE_KILOBYTES") || void 0,
labelMegabytes: t("GET_LABEL_FILE_SIZE_MEGABYTES") || void 0,
labelGigabytes: t("GET_LABEL_FILE_SIZE_GIGABYTES") || void 0
})
}), xd = (e) => {
const t = we(e.items).length;
if (!e.options.allowMultiple)
return t === 0;
const n = e.options.maxFiles;
return n === null || t < n;
}, Ko = (e, t, n) => Math.max(Math.min(n, e), t), Gd = (e, t, n) => e.splice(t, 0, n), Fd = (e, t, n) => Me(t) ? null : typeof n > "u" ? (e.push(t), t) : (n = Ko(n, 0, e.length), Gd(e, n, t), t), Zn = (e) => /^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*)\s*$/i.test(
e
), Pt = (e) => `${e}`.split("/").pop().split("?").shift(), gn = (e) => e.split(".").pop(), Bd = (e) => {
if (typeof e != "string")
return "";
const t = e.split("/").pop();
return /svg/.test(t) ? "svg" : /zip|compressed/.test(t) ? "zip" : /plain/.test(t) ? "txt" : /msword/.test(t) ? "doc" : /[a-z]+/.test(t) ? t === "jpeg" ? "jpg" : t : "";
}, Rt = (e, t = "") => (t + e).slice(-t.length), Qo = (e = /* @__PURE__ */ new Date()) => `${e.getFullYear()}-${Rt(e.getMonth() + 1, "00")}-${Rt(
e.getDate(),
"00"
)}_${Rt(e.getHours(), "00")}-${Rt(e.getMinutes(), "00")}-${Rt(
e.getSeconds(),
"00"
)}`, gt = (e, t, n = null, r = null) => {
const s = typeof n == "string" ? e.slice(0, e.size, n) : e.slice(0, e.size, e.type);
return s.lastModifiedDate = /* @__PURE__ */ new Date(), e._relativePath && (s._relativePath = e._relativePath), he(t) || (t = Qo()), t && r === null && gn(t) ? s.name = t : (r = r || Bd(s.type), s.name = t + (r ? "." + r : "")), s;
}, Ud = () => window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder, Zo = (e, t) => {
const n = Ud();
if (n) {
const r = new n();
return r.append(e), r.getBlob(t);
}
return new Blob([e], {
type: t
});
}, kd = (e, t) => {
const n = new ArrayBuffer(e.length), r = new Uint8Array(n);
for (let s = 0; s < e.length; s++)
r[s] = e.charCodeAt(s);
return Zo(n, t);
}, Jo = (e) => (/^data:(.+);/.exec(e) || [])[1] || null, Vd = (e) => e.split(",")[1].replace(/\s/g, ""), $d = (e) => atob(Vd(e)), jd = (e) => {
const t = Jo(e), n = $d(e);
return kd(n, t);
}, Hd = (e, t, n) => gt(jd(e), t, null, n), qd = (e) => {
if (!/^content-disposition:/i.test(e)) return null;
const t = e.split(/filename=|filename\*=.+''/).splice(1).map((n) => n.trim().replace(/^["']|[;"']{0,2}$/g, "")).filter((n) => n.length);
return t.length ? decodeURI(t[t.length - 1]) : null;
}, Yd = (e) => {
if (/content-length:/i.test(e)) {
const t = e.match(/[0-9]+/)[0];
return t ? parseInt(t, 10) : null;
}
return null;
}, Wd = (e) => /x-content-transfer-id:/i.test(e) && (e.split(":")[1] || "").trim() || null, br = (e) => {
const t = {
source: null,
name: null,
size: null
}, n = e.split(`
`);
for (let r of n) {
const s = qd(r);
if (s) {
t.name = s;
continue;
}
const i = Yd(r);
if (i) {
t.size = i;
continue;
}
const o = Wd(r);
if (o) {
t.source = o;
continue;
}
}
return t;
}, zd = (e) => {
const t = {
source: null,
complete: !1,
progress: 0,
size: null,
timestamp: null,
duration: 0,
request: null
}, n = () => t.progress, r = () => {
t.request && t.request.abort && t.request.abort();
}, s = () => {
const l = t.source;
o.fire("init", l), l instanceof File ? o.fire("load", l) : l instanceof Blob ? o.fire("load", gt(l, l.name)) : Zn(l) ? o.fire("load", Hd(l)) : i(l);
}, i = (l) => {
if (!e) {
o.fire("error", {
type: "error",
body: "Can't load URL",
code: 400
});
return;
}
t.timestamp = Date.now(), t.request = e(
l,
(a) => {
t.duration = Date.now() - t.timestamp, t.complete = !0, a instanceof Blob && (a = gt(a, a.name || Pt(l))), o.fire(
"load",
// if has received blob, we go with blob, if no response, we return null
a instanceof Blob ? a : a ? a.body : null
);
},
(a) => {
o.fire(
"error",
typeof a == "string" ? {
type: "error",
code: 0,
body: a
} : a
);
},
(a, c, d) => {
if (d && (t.size = d), t.duration = Date.now() - t.timestamp, !a) {
t.progress = null;
return;
}
t.progress = c / d, o.fire("progress", t.progress);
},
() => {
o.fire("abort");
},
(a) => {
const c = br(
typeof a == "string" ? a : a.headers
);
o.fire("meta", {
size: t.size || c.size,
filename: c.name,
source: c.source
});
}
);
}, o = {
...En(),
setSource: (l) => t.source = l,
getProgress: n,
// file load progress
abort: r,
// abort file load
load: s
// start load
};
return o;
}, hs = (e) => /GET|HEAD/.test(e), Ze = (e, t, n) => {
const r = {
onheaders: () => {
},
onprogress: () => {
},
onload: () => {
},
ontimeout: () => {
},
onerror: () => {
},
onabort: () => {
},
abort: () => {
s = !0, o.abort();
}
};
let s = !1, i = !1;
n = {
method: "POST",
headers: {},
withCredentials: !1,
...n
}, t = encodeURI(t), hs(n.method) && e && (t = `${t}${encodeURIComponent(typeof e == "string" ? e : JSON.stringify(e))}`);
const o = new XMLHttpRequest(), l = hs(n.method) ? o : o.upload;
return l.onprogress = (a) => {
s || r.onprogress(a.lengthComputable, a.loaded, a.total);
}, o.onreadystatechange = () => {
o.readyState < 2 || o.readyState === 4 && o.status === 0 || i || (i = !0, r.onheaders(o));
}, o.onload = () => {
o.status >= 200 && o.status < 300 ? r.onload(o) : r.onerror(o);
}, o.onerror = () => r.onerror(o), o.onabort = () => {
s = !0, r.onabort();
}, o.ontimeout = () => r.ontimeout(o), o.open(n.method, t, !0), Tt(n.timeout) && (o.timeout = n.timeout), Object.keys(n.headers).forEach((a) => {
const c = unescape(encodeURIComponent(n.headers[a]));
o.setRequestHeader(a, c);
}), n.responseType && (o.responseType = n.responseType), n.withCredentials && (o.withCredentials = !0), o.send(e), r;
}, re = (e, t, n, r) => ({
type: e,
code: t,
body: n,
headers: r
}), Je = (e) => (t) => {
e(re("error", 0, "Timeout", t.getAllResponseHeaders()));
}, Es = (e) => /\?/.test(e), wt = (...e) => {
let t = "";
return e.forEach((n) => {
t += Es(t) && Es(n) ? n.replace(/\?/, "&") : n;
}), t;
}, Mn = (e = "", t) => {
if (typeof t == "function")
return t;
if (!t || !he(t.url))
return null;
const n = t.onload || ((s) => s), r = t.onerror || ((s) => null);
return (s, i, o, l, a, c) => {
const d = Ze(s, wt(e, t.url), {
...t,
responseType: "blob"
});
return d.onload = (u) => {
const m = u.getAllResponseHeaders(), h = br(m).name || Pt(s);
i(
re(
"load",
u.status,
t.method === "HEAD" ? null : gt(n(u.response), h),
m
)
);
}, d.onerror = (u) => {
o(
re(
"error",
u.status,
r(u.response) || u.statusText,
u.getAllResponseHeaders()
)
);
}, d.onheaders = (u) => {
c(re("headers", u.status, null, u.getAllResponseHeaders()));
}, d.ontimeout = Je(o), d.onprogress = l, d.onabort = a, d;
};
}, ye = {
QUEUED: 0,
COMPLETE: 1,
PROCESSING: 2,
ERROR: 3,
WAITING: 4
}, Xd = (e, t, n, r, s, i, o, l, a, c, d) => {
const u = [], { chunkTransferId: m, chunkServer: h, chunkSize: f, chunkRetryDelays: p } = d, I = {
serverId: m,
aborted: !1
}, g = t.ondata || ((O) => O), E = t.onload || ((O, U) => U === "HEAD" ? O.getResponseHeader("Upload-Offset") : O.response), T = t.onerror || ((O) => null), v = (O) => {
const U = new FormData();
fe(s) && U.append(n, JSON.stringify(s));
const R = typeof t.headers == "function" ? t.headers(r, s) : {
...t.headers,
"Upload-Length": r.size
}, b = {
...t,
headers: R
}, N = Ze(g(U), wt(e, t.url), b);
N.onload = (P) => O(E(P, b.method)), N.onerror = (P) => o(
re(
"error",
P.status,
T(P.response) || P.statusText,
P.getAllResponseHeaders()
)
), N.ontimeout = Je(o);
}, D = (O) => {
const U = wt(e, h.url, I.serverId), b = {
headers: typeof t.headers == "function" ? t.headers(I.serverId) : {
...t.headers
},
method: "HEAD"
}, N = Ze(null, U, b);
N.onload = (P) => O(E(P, b.method)), N.onerror = (P) => o(
re(
"error",
P.status,
T(P.response) || P.statusText,
P.getAllResponseHeaders()
)
), N.ontimeout = Je(o);
}, w = Math.floor(r.size / f);
for (let O = 0; O <= w; O++) {
const U = O * f, R = r.slice(U, U + f, "application/offset+octet-stream");
u[O] = {
index: O,
size: R.size,
offset: U,
data: R,
file: r,
progress: 0,
retries: [...p],
status: ye.QUEUED,
error: null,
request: null,
timeout: null
};
}
const A = () => i(I.serverId), C = (O) => O.status === ye.QUEUED || O.status === ye.ERROR, L = (O) => {
if (I.aborted) return;
if (O = O || u.find(C), !O) {
u.every((F) => F.status === ye.COMPLETE) && A();
return;
}
O.status = ye.PROCESSING, O.progress = null;
const U = h.ondata || ((F) => F), R = h.onerror || ((F) => null), b = h.onload || (() => {
}), N = wt(e, h.url, I.serverId), P = typeof h.headers == "function" ? h.headers(O) : {
...h.headers,
"Content-Type": "application/offset+octet-stream",
"Upload-Offset": O.offset,
"Upload-Length": r.size,
"Upload-Name": r.name
}, X = O.request = Ze(U(O.data), N, {
...h,
headers: P
});
X.onload = (F) => {
b(F, O.index, u.length), O.status = ye.COMPLETE, O.request = null, G();
}, X.onprogress = (F, ne, Pe) => {
O.progress = F ? ne : null, M();
}, X.onerror = (F) => {
O.status = ye.ERROR, O.request = null, O.error = R(F.response) || F.statusText, V(O) || o(
re(
"error",
F.status,
R(F.response) || F.statusText,
F.getAllResponseHeaders()
)
);
}, X.ontimeout = (F) => {
O.status = ye.ERROR, O.request = null, V(O) || Je(o)(F);
}, X.onabort = () => {
O.status = ye.QUEUED, O.request = null, a();
};
}, V = (O) => O.retries.length === 0 ? !1 : (O.status = ye.WAITING, clearTimeout(O.timeout), O.timeout = setTimeout(() => {
L(O);
}, O.retries.shift()), !0), M = () => {
const O = u.reduce((R, b) => R === null || b.progress === null ? null : R + b.progress, 0);
if (O === null) return l(!1, 0, 0);
const U = u.reduce((R, b) => R + b.size, 0);
l(!0, O, U);
}, G = () => {
u.filter((U) => U.status === ye.PROCESSING).length >= 1 || L();
}, z = () => {
u.forEach((O) => {
clearTimeout(O.timeout), O.request && O.request.abort();
});
};
return I.serverId ? D((O) => {
I.aborted || (u.filter((U) => U.offset < O).forEach((U) => {
U.status = ye.COMPLETE, U.progress = U.size;
}), G());
}) : v((O) => {
I.aborted || (c(O), I.serverId = O, G());
}), {
abort: () => {
I.aborted = !0, z();
}
};
}, Kd = (e, t, n, r) => (s, i, o, l, a, c, d) => {
if (!s) return;
const u = r.chunkUploads, m = u && s.size > r.chunkSize, h = u && (m || r.chunkForce);
if (s instanceof Blob && h)
return Xd(
e,
t,
n,
s,
i,
o,
l,
a,
c,
d,
r
);
const f = t.ondata || ((D) => D), p = t.onload || ((D) => D), I = t.onerror || ((D) => null), g = typeof t.headers == "function" ? t.headers(s, i) || {} : {
...t.headers
}, E = {
...t,
headers: g
};
var T = new FormData();
fe(i) && T.append(n, JSON.stringify(i)), (s instanceof Blob ? [{ name: null, file: s }] : s).forEach((D) => {
T.append(
n,
D.file,
D.name === null ? D.file.name : `${D.name}${D.file.name}`
);
});
const v = Ze(f(T), wt(e, t.url), E);
return v.onload = (D) => {
o(re("load", D.status, p(D.response), D.getAllResponseHeaders()));
}, v.onerror = (D) => {
l(
re(
"error",
D.status,
I(D.response) || D.statusText,
D.getAllResponseHeaders()
)
);
}, v.ontimeout = Je(l), v.onprogress = a, v.onabort = c, v;
}, Qd = (e = "", t, n, r) => typeof t == "function" ? (...s) => t(n, ...s, r) : !t || !he(t.url) ? null : Kd(e, t, n, r), St = (e = "", t) => {
if (typeof t == "function")
return t;
if (!t || !he(t.url))
return (s, i) => i();
const n = t.onload || ((s) => s), r = t.onerror || ((s) => null);
return (s, i, o) => {
const l = Ze(
s,
e + t.url,
t
// contains method, headers and withCredentials properties
);
return l.onload = (a) => {
i(
re(
"load",
a.status,
n(a.response),
a.getAllResponseHeaders()
)
);
}, l.onerror = (a) => {
o(
re(
"error",
a.status,
r(a.response) || a.statusText,
a.getAllResponseHeaders()
)
);
}, l.ontimeout = Je(o), l;
};
}, ei = (e = 0, t = 1) => e + Math.random() * (t - e), Zd = (e, t = 1e3, n = 0, r = 25, s = 250) => {
let i = null;
const o = Date.now(), l = () => {
let a = Date.now() - o, c = ei(r, s);
a + c > t && (c = a + c - t);
let d = a / t;
if (d >= 1 || document.hidden) {
e(1);
return;
}
e(d), i = setTimeout(l, c);
};
return t > 0 && l(), {
clear: () => {
clearTimeout(i);
}
};
}, Jd = (e, t) => {
const n = {
complete: !1,
perceivedProgress: 0,
perceivedPerformanceUpdater: null,
progress: null,
timestamp: null,
perceivedDuration: 0,
duration: 0,
request: null,
response: null
}, { allowMinimumUploadDuration: r } = t, s = (d, u) => {
const m = () => {
n.duration === 0 || n.progress === null || c.fire("progress", c.getProgress());
}, h = () => {
n.complete = !0, c.fire("load-perceived", n.response.body);
};
c.fire("start"), n.timestamp = Date.now(), n.perceivedPerformanceUpdater = Zd(
(f) => {
n.perceivedProgress = f, n.perceivedDuration = Date.now() - n.timestamp, m(), n.response && n.perceivedProgress === 1 && !n.complete && h();
},
// random delay as in a list of files you start noticing
// files uploading at the exact same speed
r ? ei(750, 1500) : 0
), n.request = e(
// the file to process
d,
// the metadata to send along
u,
// callbacks (load, error, progress, abort, transfer)
// load expects the body to be a server id if
// you want to make use of revert
(f) => {
n.response = fe(f) ? f : {
type: "load",
code: 200,
body: `${f}`,
headers: {}
}, n.duration = Date.now() - n.timestamp, n.progress = 1, c.fire("load", n.response.body), (!r || r && n.perceivedProgress === 1) && h();
},
// error is expected to be an object with type, code, body
(f) => {
n.perceivedPerformanceUpdater.clear(), c.fire(
"error",
fe(f) ? f : {
type: "error",
code: 0,
body: `${f}`
}
);
},
// actual processing progress
(f, p, I) => {
n.duration = Date.now() - n.timestamp, n.progress = f ? p / I : null, m();
},
// abort does not expect a value
() => {
n.perceivedPerformanceUpdater.clear(), c.fire("abort", n.response ? n.response.body : null);
},
// register the id for this transfer
(f) => {
c.fire("transfer", f);
}
);
}, i = () => {
n.request && (n.perceivedPerformanceUpdater.clear(), n.request.abort && n.request.abort(), n.complete = !0);
}, o = () => {
i(), n.complete = !1, n.perceivedProgress = 0, n.progress = 0, n.timestamp = null, n.perceivedDuration = 0, n.duration = 0, n.request = null, n.response = null;
}, l = r ? () => n.progress ? Math.min(n.progress, n.perceivedProgress) : null : () => n.progress || null, a = r ? () => Math.min(n.duration, n.perceivedDuration) : () => n.duration, c = {
...En(),
process: s,
// start processing file
abort: i,
// abort active process request
getProgress: l,
getDuration: a,
reset: o
};
return c;
}, ti = (e) => e.substring(0, e.lastIndexOf(".")) || e, eu = (e) => {
let t = [e.name, e.size, e.type];
return e instanceof Blob || Zn(e) ? t[0] = e.name || Qo() : Zn(e) ? (t[1] = e.length, t[2] = Jo(e)) : he(e) && (t[0] = Pt(e), t[1] = 0, t[2] = "application/octet-stream"), {
name: t[0],
size: t[1],
type: t[2]
};
}, et = (e) => !!(e instanceof File || e instanceof Blob && e.name), ni = (e) => {
if (!fe(e)) return e;
const t = pn(e) ? [] : {};
for (const n in e) {
if (!e.hasOwnProperty(n)) continue;
const r = e[n];
t[n] = r && fe(r) ? ni(r) : r;
}
return t;
}, tu = (e = null, t = null, n = null) => {
const r = Rr(), s = {
// is archived
archived: !1,
// if is frozen, no longer fires events
frozen: !1,
// removed from view
released: !1,
// original source
source: null,
// file model reference
file: n,
// id of file on server
serverFileReference: t,
// id of file transfer on server
transferId: null,
// is aborted
processingAborted: !1,
// current item status
status: t ? k.PROCESSING_COMPLETE : k.INIT,
// active processes
activeLoader: null,
activeProcessor: null
};
let i = null;
const o = {}, l = (C) => s.status = C, a = (C, ...L) => {
s.released || s.frozen || w.fire(C, ...L);
}, c = () => gn(s.file.name), d = () => s.file.type, u = () => s.file.size, m = () => s.file, h = (C, L, V) => {
if (s.source = C, w.fireSync("init"), s.file) {
w.fireSync("load-skip");
return;
}
s.file = eu(C), L.on("init", () => {
a("load-init");
}), L.on("meta", (M) => {
s.file.size = M.size, s.file.filename = M.filename, M.source && (e = de.LIMBO, s.serverFileReference = M.source, s.status = k.PROCESSING_COMPLETE), a("load-meta");
}), L.on("progress", (M) => {
l(k.LOADING), a("load-progress", M);
}), L.on("error", (M) => {
l(k.LOAD_ERROR), a("load-request-error", M);
}), L.on("abort", () => {
l(k.INIT), a("load-abort");
}), L.on("load", (M) => {
s.activeLoader = null;
const G = (O) => {
s.file = et(O) ? O : s.file, e === de.LIMBO && s.serverFileReference ? l(k.PROCESSING_COMPLETE) : l(k.IDLE), a("load");
}, z = (O) => {
s.file = M, a("load-meta"), l(k.LOAD_ERROR), a("load-file-error", O);
};
if (s.serverFileReference) {
G(M);
return;
}
V(M, G, z);
}), L.setSource(C), s.activeLoader = L, L.load();
}, f = () => {
s.activeLoader && s.activeLoader.load();
}, p = () => {
if (s.activeLoader) {
s.activeLoader.abort();
return;
}
l(k.INIT), a("load-abort");
}, I = (C, L) => {
if (s.processingAborted) {
s.processingAborted = !1;
return;
}
if (l(k.PROCESSING), i = null, !(s.file instanceof Blob)) {
w.on("load", () => {
I(C, L);
});
return;
}
C.on("load", (G) => {
s.transferId = null, s.serverFileReference = G;
}), C.on("transfer", (G) => {
s.transferId = G;
}), C.on("load-perceived", (G) => {
s.activeProcessor = null, s.transferId = null, s.serverFileReference = G, l(k.PROCESSING_COMPLETE), a("process-complete", G);
}), C.on("start", () => {
a("process-start");
}), C.on("error", (G) => {
s.activeProcessor = null, l(k.PROCESSING_ERROR), a("process-error", G);
}), C.on("abort", (G) => {
s.activeProcessor = null, s.serverFileReference = G, l(k.IDLE), a("process-abort"), i && i();
}), C.on("progress", (G) => {
a("process-progress", G);
});
const V = (G) => {
s.archived || C.process(G, { ...o });
}, M = console.error;
L(s.file, V, M), s.activeProcessor = C;
}, g = () => {
s.processingAborted = !1, l(k.PROCESSING_QUEUED);
}, E = () => new Promise((C) => {
if (!s.activeProcessor) {
s.processingAborted = !0, l(k.IDLE), a("process-abort"), C();
return;
}
i = () => {
C();
}, s.activeProcessor.abort();
}), T = (C, L) => new Promise((V, M) => {
const G = s.serverFileReference !== null ? s.serverFileReference : s.transferId;
if (G === null) {
V();
return;
}
C(
G,
() => {
s.serverFileReference = null, s.transferId = null, V();
},
(z) => {
if (!L) {
V();
return;
}
l(k.PROCESSING_REVERT_ERROR), a("process-revert-error"), M(z);
}
), l(k.IDLE), a("process-revert");
}), v = (C, L, V) => {
const M = C.split("."), G = M[0], z = M.pop();
let O = o;
M.forEach((U) => O = O[U]), JSON.stringify(O[z]) !== JSON.stringify(L) && (O[z] = L, a("metadata-update", {
key: G,
value: o[G],
silent: V
}));
}, w = {
id: { get: () => r },
origin: { get: () => e, set: (C) => e = C },
serverId: { get: () => s.serverFileReference },
transferId: { get: () => s.transferId },
status: { get: () => s.status },
filename: { get: () => s.file.name },
filenameWithoutExtension: { get: () => ti(s.file.name) },
fileExtension: { get: c },
fileType: { get: d },
fileSize: { get: u },
file: { get: m },
relativePath: { get: () => s.file._relativePath },
source: { get: () => s.source },
getMetadata: (C) => ni(C ? o[C] : o),
setMetadata: (C, L, V) => {
if (fe(C)) {
const M = C;
return Object.keys(M).forEach((G) => {
v(G, M[G], L);
}), C;
}
return v(C, L, V), L;
},
extend: (C, L) => A[C] = L,
abortLoad: p,
retryLoad: f,
requestProcessing: g,
abortProcessing: E,
load: h,
process: I,
revert: T,
...En(),
freeze: () => s.frozen = !0,
release: () => s.released = !0,
released: { get: () => s.released },
archive: () => s.archived = !0,
archived: { get: () => s.archived },
// replace source and file object
setFile: (C) => s.file = C
}, A = Ue(w);
return A;
}, nu = (e, t) => Me(t) ? 0 : he(t) ? e.findIndex((n) => n.id === t) : -1, gs = (e, t) => {
const n = nu(e, t);
if (!(n < 0))
return e[n] || null;
}, Is = (e, t, n, r, s, i) => {
const o = Ze(null, e, {
method: "GET",
responseType: "blob"
});
return o.onload = (l) => {
const a = l.getAllResponseHeaders(), c = br(a).name || Pt(e);
t(re("load", l.status, gt(l.response, c), a));
}, o.onerror = (l) => {
n(re("error", l.status, l.statusText, l.getAllResponseHeaders()));
}, o.onheaders = (l) => {
i(re("headers", l.status, null, l.getAllResponseHeaders()));
}, o.ontimeout = Je(n), o.onprogress = r, o.onabort = s, o;
}, _s = (e) => (e.indexOf("//") === 0 && (e = location.protocol + e), e.toLowerCase().replace("blob:", "").replace(/([a-z])?:\/\//, "$1").split("/")[0]), ru = (e) => (e.indexOf(":") > -1 || e.indexOf("//") > -1) && _s(location.href) !== _s(e), Bt = (e) => (...t) => ze(e) ? e(...t) : e, su = (e) => !et(e.file), xn = (e, t) => {
clearTimeout(t.listUpdateTimeout), t.listUpdateTimeout = setTimeout(() => {
e("DID_UPDATE_ITEMS", { items: we(t.items) });
}, 0);
}, Ts = (e, ...t) => new Promise((n) => {
if (!e)
return n(!0);
const r = e(...t);
if (r == null)
return n(!0);
if (typeof r == "boolean")
return n(r);
typeof r.then == "function" && r.then(n);
}), Gn = (e, t) => {
e.items.sort((n, r) => t(Ie(n), Ie(r)));
}, Re = (e, t) => ({
query: n,
success: r = () => {
},
failure: s = () => {
},
...i
} = {}) => {
const o = Xe(e.items, n);
if (!o) {
s({
error: re("error", 0, "Item not found"),
file: null
});
return;
}
t(o, r, s, i || {});
}, ou = (e, t, n) => ({
/**
* Aborts all ongoing processes
*/
ABORT_ALL: () => {
we(n.items).forEach((r) => {
r.freeze(), r.abortLoad(), r.abortProcessing();
});
},
/**
* Sets initial files
*/
DID_SET_FILES: ({ value: r = [] }) => {
const s = r.map((o) => ({
source: o.source ? o.source : o,
options: o.options
}));
let i = we(n.items);
i.forEach((o) => {
s.find((l) => l.source === o.source || l.source === o.file) || e("REMOVE_ITEM", { query: o, remove: !1 });
}), i = we(n.items), s.forEach((o, l) => {
i.find((a) => a.source === o.source || a.file === o.source) || e("ADD_ITEM", {
...o,
interactionMethod: Se.NONE,
index: l
});
});
},
DID_UPDATE_ITEM_METADATA: ({ id: r, action: s, change: i }) => {
i.silent || (clearTimeout(n.itemUpdateTimeout), n.itemUpdateTimeout = setTimeout(() => {
const o = gs(n.items, r);
if (!t("IS_ASYNC")) {
De("SHOULD_PREPARE_OUTPUT", !1, {
item: o,
query: t,
action: s,
change: i
}).then((d) => {
const u = t("GET_BEFORE_PREPARE_FILE");
u && (d = u(o, d)), d && e(
"REQUEST_PREPARE_OUTPUT",
{
query: r,
item: o,
success: (m) => {
e("DID_PREPARE_OUTPUT", { id: r, file: m });
}
},
!0
);
});
return;
}
o.origin === de.LOCAL && e("DID_LOAD_ITEM", {
id: o.id,
error: null,
serverFileReference: o.source
});
const l = () => {
setTimeout(() => {
e("REQUEST_ITEM_PROCESSING", { query: r });
}, 32);
}, a = (d) => {
o.revert(
St(n.options.server.url, n.options.server.revert),
t("GET_FORCE_REVERT")
).then(d ? l : () => {
}).catch(() => {
});
}, c = (d) => {
o.abortProcessing().then(d ? l : () => {
});
};
if (o.status === k.PROCESSING_COMPLETE)
return a(n.options.instantUpload);
if (o.status === k.PROCESSING)
return c(n.options.instantUpload);
n.options.instantUpload && l();
}, 0));
},
MOVE_ITEM: ({ query: r, index: s }) => {
const i = Xe(n.items, r);
if (!i) return;
const o = n.items.indexOf(i);
s = Ko(s, 0, n.items.length - 1), o !== s && n.items.splice(s, 0, n.items.splice(o, 1)[0]);
},
SORT: ({ compare: r }) => {
Gn(n, r), e("DID_SORT_ITEMS", {
items: t("GET_ACTIVE_ITEMS")
});
},
ADD_ITEMS: ({ items: r, index: s, interactionMethod: i, success: o = () => {
}, failure: l = () => {
} }) => {
let a = s;
if (s === -1 || typeof s > "u") {
const h = t("GET_ITEM_INSERT_LOCATION"), f = t("GET_TOTAL_ITEMS");
a = h === "before" ? 0 : f;
}
const c = t("GET_IGNORED_FILES"), d = (h) => et(h) ? !c.includes(h.name.toLowerCase()) : !Me(h), m = r.filter(d).map(
(h) => new Promise((f, p) => {
e("ADD_ITEM", {
interactionMethod: i,
source: h.source || h,
success: f,
failure: p,
index: a++,
options: h.options || {}
});
})
);
Promise.all(m).then(o).catch(l);
},
/**
* @param source
* @param index
* @param interactionMethod
*/
ADD_ITEM: ({
source: r,
index: s = -1,
interactionMethod: i,
success: o = () => {
},
failure: l = () => {
},
options: a = {}
}) => {
if (Me(r)) {
l({
error: re("error", 0, "No source"),
file: null
});
return;
}
if (et(r) && n.options.ignoredFiles.includes(r.name.toLowerCase()))
return;
if (!xd(n)) {
if (n.options.allowMultiple || !n.options.allowMultiple && !n.options.allowReplace) {
const E = re("warning", 0, "Max files");
e("DID_THROW_MAX_FILES", {
source: r,
error: E
}), l({ error: E, file: null });
return;
}
const g = we(n.items)[0];
if (g.status === k.PROCESSING_COMPLETE || g.status === k.PROCESSING_REVERT_ERROR) {
const E = t("GET_FORCE_REVERT");
if (g.revert(
St(n.options.server.url, n.options.server.revert),
E
).then(() => {
E && e("ADD_ITEM", {
source: r,
index: s,
interactionMethod: i,
success: o,
failure: l,
options: a
});
}).catch(() => {
}), E) return;
}
e("REMOVE_ITEM", { query: g.id });
}
const c = a.type === "local" ? de.LOCAL : a.type === "limbo" ? de.LIMBO : de.INPUT, d = tu(
// where did this file come from
c,
// an input file never has a server file reference
c === de.INPUT ? null : r,
// file mock data, if defined
a.file
);
Object.keys(a.metadata || {}).forEach((g) => {
d.setMetadata(g, a.metadata[g]);
}), ot("DID_CREATE_ITEM", d, { query: t, dispatch: e });
const u = t("GET_ITEM_INSERT_LOCATION");
n.options.itemInsertLocationFreedom || (s = u === "before" ? -1 : n.items.length), Fd(n.items, d, s), ze(u) && r && Gn(n, u);
const m = d.id;
d.on("init", () => {
e("DID_INIT_ITEM", { id: m });
}), d.on("load-init", () => {
e("DID_START_ITEM_LOAD", { id: m });
}), d.on("load-meta", () => {
e("DID_UPDATE_ITEM_META", { id: m });
}), d.on("load-progress", (g) => {
e("DID_UPDATE_ITEM_LOAD_PROGRESS", { id: m, progress: g });
}), d.on("load-request-error", (g) => {
const E = Bt(n.options.labelFileLoadError)(g);
if (g.code >= 400 && g.code < 500) {
e("DID_THROW_ITEM_INVALID", {
id: m,
error: g,
status: {
main: E,
sub: `${g.code} (${g.body})`
}
}), l({ error: g, file: Ie(d) });
return;
}
e("DID_THROW_ITEM_LOAD_ERROR", {
id: m,
error: g,
status: {
main: E,
sub: n.options.labelTapToRetry
}
});
}), d.on("load-file-error", (g) => {
e("DID_THROW_ITEM_INVALID", {
id: m,
error: g.status,
status: g.status
}), l({ error: g.status, file: Ie(d) });
}), d.on("load-abort", () => {
e("REMOVE_ITEM", { query: m });
}), d.on("load-skip", () => {
d.on("metadata-update", (g) => {
et(d.file) && e("DID_UPDATE_ITEM_METADATA", { id: m, change: g });
}), e("COMPLETE_LOAD_ITEM", {
query: m,
item: d,
data: {
source: r,
success: o
}
});
}), d.on("load", () => {
const g = (E) => {
if (!E) {
e("REMOVE_ITEM", {
query: m
});
return;
}
d.on("metadata-update", (T) => {
e("DID_UPDATE_ITEM_METADATA", { id: m, change: T });
}), De("SHOULD_PREPARE_OUTPUT", !1, { item: d, query: t }).then(
(T) => {
const v = t("GET_BEFORE_PREPARE_FILE");
v && (T = v(d, T));
const D = () => {
e("COMPLETE_LOAD_ITEM", {
query: m,
item: d,
data: {
source: r,
success: o
}
}), xn(e, n);
};
if (T) {
e(
"REQUEST_PREPARE_OUTPUT",
{
query: m,
item: d,
success: (w) => {
e("DID_PREPARE_OUTPUT", { id: m, file: w }), D();
}
},
!0
);
return;
}
D();
}
);
};
De("DID_LOAD_ITEM", d, { query: t, dispatch: e }).then(() => {
Ts(t("GET_BEFORE_ADD_FILE"), Ie(d)).then(
g
);
}).catch((E) => {
if (!E || !E.error || !E.status) return g(!1);
e("DID_THROW_ITEM_INVALID", {
id: m,
error: E.error,
status: E.status
});
});
}), d.on("process-start", () => {
e("DID_START_ITEM_PROCESSING", { id: m });
}), d.on("process-progress", (g) => {
e("DID_UPDATE_ITEM_PROCESS_PROGRESS", { id: m, progress: g });
}), d.on("process-error", (g) => {
e("DID_THROW_ITEM_PROCESSING_ERROR", {
id: m,
error: g,
status: {
main: Bt(n.options.labelFileProcessingError)(g),
sub: n.options.labelTapToRetry
}
});
}), d.on("process-revert-error", (g) => {
e("DID_THROW_ITEM_PROCESSING_REVERT_ERROR", {
id: m,
error: g,
status: {
main: Bt(n.options.labelFileProcessingRevertError)(g),
sub: n.options.labelTapToRetry
}
});
}), d.on("process-complete", (g) => {
e("DID_COMPLETE_ITEM_PROCESSING", {
id: m,
error: null,
serverFileReference: g
}), e("DID_DEFINE_VALUE", { id: m, value: g });
}), d.on("process-abort", () => {
e("DID_ABORT_ITEM_PROCESSING", { id: m });
}), d.on("process-revert", () => {
e("DID_REVERT_ITEM_PROCESSING", { id: m }), e("DID_DEFINE_VALUE", { id: m, value: null });
}), e("DID_ADD_ITEM", { id: m, index: s, interactionMethod: i }), xn(e, n);
const { url: h, load: f, restore: p, fetch: I } = n.options.server || {};
d.load(
r,
// this creates a function that loads the file based on the type of file (string, base64, blob, file) and location of file (local, remote, limbo)
zd(
c === de.INPUT ? (
// input, if is remote, see if should use custom fetch, else use default fetchBlob
he(r) && ru(r) && I ? Mn(h, I) : Is
) : (
// limbo or local
c === de.LIMBO ? Mn(h, p) : Mn(h, f)
)
// local
),
// called when the file is loaded so it can be piped through the filters
(g, E, T) => {
De("LOAD_FILE", g, { query: t }).then(E).catch(T);
}
);
},
REQUEST_PREPARE_OUTPUT: ({ item: r, success: s, failure: i = () => {
} }) => {
const o = {
error: re("error", 0, "Item not found"),
file: null
};
if (r.archived) return i(o);
De("PREPARE_OUTPUT", r.file, { query: t, item: r }).then((l) => {
De("COMPLETE_PREPARE_OUTPUT", l, { query: t, item: r }).then((a) => {
if (r.archived) return i(o);
s(a);
});
});
},
COMPLETE_LOAD_ITEM: ({ item: r, data: s }) => {
const { success: i, source: o } = s, l = t("GET_ITEM_INSERT_LOCATION");
if (ze(l) && o && Gn(n, l), e("DID_LOAD_ITEM", {
id: r.id,
error: null,
serverFileReference: r.origin === de.INPUT ? null : o
}), i(Ie(r)), r.origin === de.LOCAL) {
e("DID_LOAD_LOCAL_ITEM", { id: r.id });
return;
}
if (r.origin === de.LIMBO) {
e("DID_COMPLETE_ITEM_PROCESSING", {
id: r.id,
error: null,
serverFileReference: o
}), e("DID_DEFINE_VALUE", {
id: r.id,
value: r.serverId || o
});
return;
}
t("IS_ASYNC") && n.options.instantUpload && e("REQUEST_ITEM_PROCESSING", { query: r.id });
},
RETRY_ITEM_LOAD: Re(n, (r) => {
r.retryLoad();
}),
REQUEST_ITEM_PREPARE: Re(n, (r, s, i) => {
e(
"REQUEST_PREPARE_OUTPUT",
{
query: r.id,
item: r,
success: (o) => {
e("DID_PREPARE_OUTPUT", { id: r.id, file: o }), s({
file: r,
output: o
});
},
failure: i
},
!0
);
}),
REQUEST_ITEM_PROCESSING: Re(n, (r, s, i) => {
if (!// waiting for something
(r.status === k.IDLE || // processing went wrong earlier
r.status === k.PROCESSING_ERROR)) {
const l = () => e("REQUEST_ITEM_PROCESSING", { query: r, success: s, failure: i }), a = () => document.hidden ? l() : setTimeout(l, 32);
r.status === k.PROCESSING_COMPLETE || r.status === k.PROCESSING_REVERT_ERROR ? r.revert(
St(n.options.server.url, n.options.server.revert),
t("GET_FORCE_REVERT")
).then(a).catch(() => {
}) : r.status === k.PROCESSING && r.abortProcessing().then(a);
return;
}
r.status !== k.PROCESSING_QUEUED && (r.requestProcessing(), e("DID_REQUEST_ITEM_PROCESSING", { id: r.id }), e("PROCESS_ITEM", { query: r, success: s, failure: i }, !0));
}),
PROCESS_ITEM: Re(n, (r, s, i) => {
const o = t("GET_MAX_PARALLEL_UPLOADS");
if (t("GET_ITEMS_BY_STATUS", k.PROCESSING).length === o) {
n.processingQueue.push({
id: r.id,
success: s,
failure: i
});
return;
}
if (r.status === k.PROCESSING) return;
const a = () => {
const d = n.processingQueue.shift();
if (!d) return;
const { id: u, success: m, failure: h } = d, f = Xe(n.items, u);
if (!f || f.archived) {
a();
return;
}
e("PROCESS_ITEM", { query: u, success: m, failure: h }, !0);
};
r.onOnce("process-complete", () => {
s(Ie(r)), a();
const d = n.options.server;
if (n.options.instantUpload && r.origin === de.LOCAL && ze(d.remove)) {
const h = () => {
};
r.origin = de.LIMBO, n.options.server.remove(r.source, h, h);
}
t("GET_ITEMS_BY_STATUS", k.PROCESSING_COMPLETE).length === n.items.length && e("DID_COMPLETE_ITEM_PROCESSING_ALL");
}), r.onOnce("process-error", (d) => {
i({ error: d, file: Ie(r) }), a();
});
const c = n.options;
r.process(
Jd(
Qd(c.server.url, c.server.process, c.name, {
chunkTransferId: r.transferId,
chunkServer: c.server.patch,
chunkUploads: c.chunkUploads,
chunkForce: c.chunkForce,
chunkSize: c.chunkSize,
chunkRetryDelays: c.chunkRetryDelays
}),
{
allowMinimumUploadDuration: t("GET_ALLOW_MINIMUM_UPLOAD_DURATION")
}
),
// called when the file is about to be processed so it can be piped through the transform filters
(d, u, m) => {
De("PREPARE_OUTPUT", d, { query: t, item: r }).then((h) => {
e("DID_PREPARE_OUTPUT", { id: r.id, file: h }), u(h);
}).catch(m);
}
);
}),
RETRY_ITEM_PROCESSING: Re(n, (r) => {
e("REQUEST_ITEM_PROCESSING", { query: r });
}),
REQUEST_REMOVE_ITEM: Re(n, (r) => {
Ts(t("GET_BEFORE_REMOVE_FILE"), Ie(r)).then((s) => {
s && e("REMOVE_ITEM", { query: r });
});
}),
RELEASE_ITEM: Re(n, (r) => {
r.release();
}),
REMOVE_ITEM: Re(n, (r, s, i, o) => {
const l = () => {
const c = r.id;
gs(n.items, c).archive(), e("DID_REMOVE_ITEM", { error: null, id: c, item: r }), xn(e, n), s(Ie(r));
}, a = n.options.server;
r.origin === de.LOCAL && a && ze(a.remove) && o.remove !== !1 ? (e("DID_START_ITEM_REMOVE", { id: r.id }), a.remove(
r.source,
() => l(),
(c) => {
e("DID_THROW_ITEM_REMOVE_ERROR", {
id: r.id,
error: re("error", 0, c, null),
status: {
main: Bt(n.options.labelFileRemoveError)(c),
sub: n.options.labelTapToRetry
}
});
}
)) : ((o.revert && r.origin !== de.LOCAL && r.serverId !== null || // if chunked uploads are enabled and we're uploading in chunks for this specific file
// or if the file isn't big enough for chunked uploads but chunkForce is set then call
// revert before removing from the view...
n.options.chunkUploads && r.file.size > n.options.chunkSize || n.options.chunkUploads && n.options.chunkForce) && r.revert(
St(n.options.server.url, n.options.server.revert),
t("GET_FORCE_REVERT")
), l());
}),
ABORT_ITEM_LOAD: Re(n, (r) => {
r.abortLoad();
}),
ABORT_ITEM_PROCESSING: Re(n, (r) => {
if (r.serverId) {
e("REVERT_ITEM_PROCESSING", { id: r.id });
return;
}
r.abortProcessing().then(() => {
n.options.instantUpload && e("REMOVE_ITEM", { query: r.id });
});
}),
REQUEST_REVERT_ITEM_PROCESSING: Re(n, (r) => {
if (!n.options.instantUpload) {
e("REVERT_ITEM_PROCESSING", { query: r });
return;
}
const s = (l) => {
l && e("REVERT_ITEM_PROCESSING", { query: r });
}, i = t("GET_BEFORE_REMOVE_FILE");
if (!i)
return s(!0);
const o = i(Ie(r));
if (o == null)
return s(!0);
if (typeof o == "boolean")
return s(o);
typeof o.then == "function" && o.then(s);
}),
REVERT_ITEM_PROCESSING: Re(n, (r) => {
r.revert(
St(n.options.server.url, n.options.server.revert),
t("GET_FORCE_REVERT")
).then(() => {
(n.options.instantUpload || su(r)) && e("REMOVE_ITEM", { query: r.id });
}).catch(() => {
});
}),
SET_OPTIONS: ({ options: r }) => {
const s = Object.keys(r), i = iu.filter((l) => s.includes(l));
[
// add prioritized first if passed to options, else remove
...i,
// prevent duplicate keys
...Object.keys(r).filter((l) => !i.includes(l))
].forEach((l) => {
e(`SET_${hn(l, "_").toUpperCase()}`, {
value: r[l]
});
});
}
}), iu = [
"server"
// must be processed before "files"
], Or = (e) => e, xe = (e) => document.createElement(e), oe = (e, t) => {
let n = e.childNodes[0];
n ? t !== n.nodeValue && (n.nodeValue = t) : (n = document.createTextNode(t), e.appendChild(n));
}, ys = (e, t, n, r) => {
const s = (r % 360 - 90) * Math.PI / 180;
return {
x: e + n * Math.cos(s),
y: t + n * Math.sin(s)
};
}, au = (e, t, n, r, s, i) => {
const o = ys(e, t, n, s), l = ys(e, t, n, r);
return ["M", o.x, o.y, "A", n, n, 0, i, 0, l.x, l.y].join(" ");
}, lu = (e, t, n, r, s) => {
let i = 1;
return s > r && s - r <= 0.5 && (i = 0), r > s && r - s >= 0.5 && (i = 0), au(
e,
t,
n,
Math.min(0.9999, r) * 360,
Math.min(0.9999, s) * 360,
i
);
}, cu = ({ root: e, props: t }) => {
t.spin = !1, t.progress = 0, t.opacity = 0;
const n = Jt("svg");
e.ref.path = Jt("path", {
"stroke-width": 2,
"stroke-linecap": "round"
}), n.appendChild(e.ref.path), e.ref.svg = n, e.appendChild(n);
}, du = ({ root: e, props: t }) => {
if (t.opacity === 0)
return;
t.align && (e.element.dataset.align = t.align);
const n = parseInt(ce(e.ref.path, "stroke-width"), 10), r = e.rect.element.width * 0.5;
let s = 0, i = 0;
t.spin ? (s = 0, i = 0.5) : (s = 0, i = t.progress);
const o = lu(r, r, r - n, s, i);
ce(e.ref.path, "d", o), ce(e.ref.path, "stroke-opacity", t.spin || t.progress > 0 ? 1 : 0);
}, Rs = ae({
tag: "div",
name: "progress-indicator",
ignoreRectUpdate: !0,
ignoreRect: !0,
create: cu,
write: du,
mixins: {
apis: ["progress", "spin", "align"],
styles: ["opacity"],
animations: {
opacity: { type: "tween", duration: 500 },
progress: {
type: "spring",
stiffness: 0.95,
damping: 0.65,
mass: 10
}
}
}
}), uu = ({ root: e, props: t }) => {
e.element.innerHTML = (t.icon || "") + `<span>${t.label}</span>`, t.isDisabled = !1;
}, fu = ({ root: e, props: t }) => {
const { isDisabled: n } = t, r = e.query("GET_DISABLED") || t.opacity === 0;
r && !n ? (t.isDisabled = !0, ce(e.element, "disabled", "disabled")) : !r && n && (t.isDisabled = !1, e.element.removeAttribute("disabled"));
}, ri = ae({
tag: "button",
attributes: {
type: "button"
},
ignoreRect: !0,
ignoreRectUpdate: !0,
name: "file-action-button",
mixins: {
apis: ["label"],
styles: ["translateX", "translateY", "scaleX", "scaleY", "opacity"],
animations: {
scaleX: "spring",
scaleY: "spring",
translateX: "spring",
translateY: "spring",
opacity: { type: "tween", duration: 250 }
},
listeners: !0
},
create: uu,
write: fu
}), si = (e, t = ".", n = 1e3, r = {}) => {
const {
labelBytes: s = "bytes",
labelKilobytes: i = "KB",
labelMegabytes: o = "MB",
labelGigabytes: l = "GB"
} = r;
e = Math.round(Math.abs(e));
const a = n, c = n * n, d = n * n * n;
return e < a ? `${e} ${s}` : e < c ? `${Math.floor(e / a)} ${i}` : e < d ? `${Ss(e / c, 1, t)} ${o}` : `${Ss(e / d, 2, t)} ${l}`;
}, Ss = (e, t, n) => e.toFixed(t).split(".").filter((r) => r !== "0").join(n), pu = ({ root: e, props: t }) => {
const n = xe("span");
n.className = "filepond--file-info-main", ce(n, "aria-hidden", "true"), e.appendChild(n), e.ref.fileName = n;
const r = xe("span");
r.className = "filepond--file-info-sub", e.appendChild(r), e.ref.fileSize = r, oe(r, e.query("GET_LABEL_FILE_WAITING_FOR_SIZE")), oe(n, Or(e.query("GET_ITEM_NAME", t.id)));
}, Jn = ({ root: e, props: t }) => {
oe(
e.ref.fileSize,
si(
e.query("GET_ITEM_SIZE", t.id),
".",
e.query("GET_FILE_SIZE_BASE"),
e.query("GET_FILE_SIZE_LABELS", e.query)
)
), oe(e.ref.fileName, Or(e.query("GET_ITEM_NAME", t.id)));
}, vs = ({ root: e, props: t }) => {
if (Tt(e.query("GET_ITEM_SIZE", t.id))) {
Jn({ root: e, props: t });
return;
}
oe(e.ref.fileSize, e.query("GET_LABEL_FILE_SIZE_NOT_AVAILABLE"));
}, mu = ae({
name: "file-info",
ignoreRect: !0,
ignoreRectUpdate: !0,
write: Ee({
DID_LOAD_ITEM: Jn,
DID_UPDATE_ITEM_META: Jn,
DID_THROW_ITEM_LOAD_ERROR: vs,
DID_THROW_ITEM_INVALID: vs
}),
didCreateView: (e) => {
ot("CREATE_VIEW", { ...e, view: e });
},
create: pu,
mixins: {
styles: ["translateX", "translateY"],
animations: {
translateX: "spring",
translateY: "spring"
}
}
}), oi = (e) => Math.round(e * 100), hu = ({ root: e }) => {
const t = xe("span");
t.className = "filepond--file-status-main", e.appendChild(t), e.ref.main = t;
const n = xe("span");
n.className = "filepond--file-status-sub", e.appendChild(n), e.ref.sub = n, ii({ root: e, action: { progress: null } });
}, ii = ({ root: e, action: t }) => {
const n = t.progress === null ? e.query("GET_LABEL_FILE_LOADING") : `${e.query("GET_LABEL_FILE_LOADING")} ${oi(t.progress)}%`;
oe(e.ref.main, n), oe(e.ref.sub, e.query("GET_LABEL_TAP_TO_CANCEL"));
}, Eu = ({ root: e, action: t }) => {
const n = t.progress === null ? e.query("GET_LABEL_FILE_PROCESSING") : `${e.query("GET_LABEL_FILE_PROCESSING")} ${oi(t.progress)}%`;
oe(e.ref.main, n), oe(e.ref.sub, e.query("GET_LABEL_TAP_TO_CANCEL"));
}, gu = ({ root: e }) => {
oe(e.ref.main, e.query("GET_LABEL_FILE_PROCESSING")), oe(e.ref.sub, e.query("GET_LABEL_TAP_TO_CANCEL"));
}, Iu = ({ root: e }) => {
oe(e.ref.main, e.query("GET_LABEL_FILE_PROCESSING_ABORTED")), oe(e.ref.sub, e.query("GET_LABEL_TAP_TO_RETRY"));
}, _u = ({ root: e }) => {
oe(e.ref.main, e.query("GET_LABEL_FILE_PROCESSING_COMPLETE")), oe(e.ref.sub, e.query("GET_LABEL_TAP_TO_UNDO"));
}, bs = ({ root: e }) => {
oe(e.ref.main, ""), oe(e.ref.sub, "");
}, vt = ({ root: e, action: t }) => {
oe(e.ref.main, t.status.main), oe(e.ref.sub, t.status.sub);
}, Tu = ae({
name: "file-status",
ignoreRect: !0,
ignoreRectUpdate: !0,
write: Ee({
DID_LOAD_ITEM: bs,
DID_REVERT_ITEM_PROCESSING: bs,
DID_REQUEST_ITEM_PROCESSING: gu,
DID_ABORT_ITEM_PROCESSING: Iu,
DID_COMPLETE_ITEM_PROCESSING: _u,
DID_UPDATE_ITEM_PROCESS_PROGRESS: Eu,
DID_UPDATE_ITEM_LOAD_PROGRESS: ii,
DID_THROW_ITEM_LOAD_ERROR: vt,
DID_THROW_ITEM_INVALID: vt,
DID_THROW_ITEM_PROCESSING_ERROR: vt,
DID_THROW_ITEM_PROCESSING_REVERT_ERROR: vt,
DID_THROW_ITEM_REMOVE_ERROR: vt
}),
didCreateView: (e) => {
ot("CREATE_VIEW", { ...e, view: e });
},
create: hu,
mixins: {
styles: ["translateX", "translateY", "opacity"],
animations: {
opacity: { type: "tween", duration: 250 },
translateX: "spring",
translateY: "spring"
}
}
}), er = {
AbortItemLoad: {
label: "GET_LABEL_BUTTON_ABORT_ITEM_LOAD",
action: "ABORT_ITEM_LOAD",
className: "filepond--action-abort-item-load",
align: "LOAD_INDICATOR_POSITION"
// right
},
RetryItemLoad: {
label: "GET_LABEL_BUTTON_RETRY_ITEM_LOAD",
action: "RETRY_ITEM_LOAD",
icon: "GET_ICON_RETRY",
className: "filepond--action-retry-item-load",
align: "BUTTON_PROCESS_ITEM_POSITION"
// right
},
RemoveItem: {
label: "GET_LABEL_BUTTON_REMOVE_ITEM",
action: "REQUEST_REMOVE_ITEM",
icon: "GET_ICON_REMOVE",
className: "filepond--action-remove-item",
align: "BUTTON_REMOVE_ITEM_POSITION"
// left
},
ProcessItem: {
label: "GET_LABEL_BUTTON_PROCESS_ITEM",
action: "REQUEST_ITEM_PROCESSING",
icon: "GET_ICON_PROCESS",
className: "filepond--action-process-item",
align: "BUTTON_PROCESS_ITEM_POSITION"
// right
},
AbortItemProcessing: {
label: "GET_LABEL_BUTTON_ABORT_ITEM_PROCESSING",
action: "ABORT_ITEM_PROCESSING",
className: "filepond--action-abort-item-processing",
align: "BUTTON_PROCESS_ITEM_POSITION"
// right
},
RetryItemProcessing: {
label: "GET_LABEL_BUTTON_RETRY_ITEM_PROCESSING",
action: "RETRY_ITEM_PROCESSING",
icon: "GET_ICON_RETRY",
className: "filepond--action-retry-item-processing",
align: "BUTTON_PROCESS_ITEM_POSITION"
// right
},
RevertItemProcessing: {
label: "GET_LABEL_BUTTON_UNDO_ITEM_PROCESSING",
action: "REQUEST_REVERT_ITEM_PROCESSING",
icon: "GET_ICON_UNDO",
className: "filepond--action-revert-item-processing",
align: "BUTTON_PROCESS_ITEM_POSITION"
// right
}
}, tr = [];
te(er, (e) => {
tr.push(e);
});
const Te = (e) => {
if (nr(e) === "right") return 0;
const t = e.ref.buttonRemoveItem.rect.element;
return t.hidden ? null : t.width + t.left;
}, yu = (e) => e.ref.buttonAbortItemLoad.rect.element.width, Ut = (e) => Math.floor(e.ref.buttonRemoveItem.rect.element.height / 4), Ru = (e) => Math.floor(e.ref.buttonRemoveItem.rect.element.left / 2), Su = (e) => e.query("GET_STYLE_LOAD_INDICATOR_POSITION"), vu = (e) => e.query("GET_STYLE_PROGRESS_INDICATOR_POSITION"), nr = (e) => e.query("GET_STYLE_BUTTON_REMOVE_ITEM_POSITION"), bu = {
buttonAbortItemLoad: { opacity: 0 },
buttonRetryItemLoad: { opacity: 0 },
buttonRemoveItem: { opacity: 0 },
buttonProcessItem: { opacity: 0 },
buttonAbortItemProcessing: { opacity: 0 },
buttonRetryItemProcessing: { opacity: 0 },
buttonRevertItemProcessing: { opacity: 0 },
loadProgressIndicator: { opacity: 0, align: Su },
processProgressIndicator: { opacity: 0, align: vu },
processingCompleteIndicator: { opacity: 0, scaleX: 0.75, scaleY: 0.75 },
info: { translateX: 0, translateY: 0, opacity: 0 },
status: { translateX: 0, translateY: 0, opacity: 0 }
}, Os = {
buttonRemoveItem: { opacity: 1 },
buttonProcessItem: { opacity: 1 },
info: { translateX: Te },
status: { translateX: Te }
}, Fn = {
buttonAbortItemProcessing: { opacity: 1 },
processProgressIndicator: { opacity: 1 },
status: { opacity: 1 }
}, ct = {
DID_THROW_ITEM_INVALID: {
buttonRemoveItem: { opacity: 1 },
info: { translateX: Te },
status: { translateX: Te, opacity: 1 }
},
DID_START_ITEM_LOAD: {
buttonAbortItemLoad: { opacity: 1 },
loadProgressIndicator: { opacity: 1 },
status: { opacity: 1 }
},
DID_THROW_ITEM_LOAD_ERROR: {
buttonRetryItemLoad: { opacity: 1 },
buttonRemoveItem: { opacity: 1 },
info: { translateX: Te },
status: { opacity: 1 }
},
DID_START_ITEM_REMOVE: {
processProgressIndicator: { opacity: 1, align: nr },
info: { translateX: Te },
status: { opacity: 0 }
},
DID_THROW_ITEM_REMOVE_ERROR: {
processProgressIndicator: { opacity: 0, align: nr },
buttonRemoveItem: { opacity: 1 },
info: { translateX: Te },
status: { opacity: 1, translateX: Te }
},
DID_LOAD_ITEM: Os,
DID_LOAD_LOCAL_ITEM: {
buttonRemoveItem: { opacity: 1 },
info: { translateX: Te },
status: { translateX: Te }
},
DID_START_ITEM_PROCESSING: Fn,
DID_REQUEST_ITEM_PROCESSING: Fn,
DID_UPDATE_ITEM_PROCESS_PROGRESS: Fn,
DID_COMPLETE_ITEM_PROCESSING: {
buttonRevertItemProcessing: { opacity: 1 },
info: { opacity: 1 },
status: { opacity: 1 }
},
DID_THROW_ITEM_PROCESSING_ERROR: {
buttonRemoveItem: { opacity: 1 },
buttonRetryItemProcessing: { opacity: 1 },
status: { opacity: 1 },
info: { translateX: Te }
},
DID_THROW_ITEM_PROCESSING_REVERT_ERROR: {
buttonRevertItemProcessing: { opacity: 1 },
status: { opacity: 1 },
info: { opacity: 1 }
},
DID_ABORT_ITEM_PROCESSING: {
buttonRemoveItem: { opacity: 1 },
buttonProcessItem: { opacity: 1 },
info: { translateX: Te },
status: { opacity: 1 }
},
DID_REVERT_ITEM_PROCESSING: Os
}, Ou = ae({
create: ({ root: e }) => {
e.element.innerHTML = e.query("GET_ICON_DONE");
},
name: "processing-complete-indicator",
ignoreRect: !0,
mixins: {
styles: ["scaleX", "scaleY", "opacity"],
animations: {
scaleX: "spring",
scaleY: "spring",
opacity: { type: "tween", duration: 250 }
}
}
}), Du = ({ root: e, props: t }) => {
const n = Object.keys(er).reduce((f, p) => (f[p] = { ...er[p] }, f), {}), { id: r } = t, s = e.query("GET_ALLOW_REVERT"), i = e.query("GET_ALLOW_REMOVE"), o = e.query("GET_ALLOW_PROCESS"), l = e.query("GET_INSTANT_UPLOAD"), a = e.query("IS_ASYNC"), c = e.query("GET_STYLE_BUTTON_REMOVE_ITEM_ALIGN");
let d;
a ? o && !s ? d = (f) => !/RevertItemProcessing/.test(f) : !o && s ? d = (f) => !/ProcessItem|RetryItemProcessing|AbortItemProcessing/.test(f) : !o && !s && (d = (f) => !/Process/.test(f)) : d = (f) => !/Process/.test(f);
const u = d ? tr.filter(d) : tr.concat();
if (l && s && (n.RevertItemProcessing.label = "GET_LABEL_BUTTON_REMOVE_ITEM", n.RevertItemProcessing.icon = "GET_ICON_REMOVE"), a && !s) {
const f = ct.DID_COMPLETE_ITEM_PROCESSING;
f.info.translateX = Ru, f.info.translateY = Ut, f.status.translateY = Ut, f.processingCompleteIndicator = { opacity: 1, scaleX: 1, scaleY: 1 };
}
if (a && !o && ([
"DID_START_ITEM_PROCESSING",
"DID_REQUEST_ITEM_PROCESSING",
"DID_UPDATE_ITEM_PROCESS_PROGRESS",
"DID_THROW_ITEM_PROCESSING_ERROR"
].forEach((f) => {
ct[f].status.translateY = Ut;
}), ct.DID_THROW_ITEM_PROCESSING_ERROR.status.translateX = yu), c && s) {
n.RevertItemProcessing.align = "BUTTON_REMOVE_ITEM_POSITION";
const f = ct.DID_COMPLETE_ITEM_PROCESSING;
f.info.translateX = Te, f.status.translateY = Ut, f.processingCompleteIndicator = { opacity: 1, scaleX: 1, scaleY: 1 };
}
i || (n.RemoveItem.disabled = !0), te(n, (f, p) => {
const I = e.createChildView(ri, {
label: e.query(p.label),
icon: e.query(p.icon),
opacity: 0
});
u.includes(f) && e.appendChildView(I), p.disabled && (I.element.setAttribute("disabled", "disabled"), I.element.setAttribute("hidden", "hidden")), I.element.dataset.align = e.query(`GET_STYLE_${p.align}`), I.element.classList.add(p.className), I.on("click", (g) => {
g.stopPropagation(), !p.disabled && e.dispatch(p.action, { query: r });
}), e.ref[`button${f}`] = I;
}), e.ref.processingCompleteIndicator = e.appendChildView(
e.createChildView(Ou)
), e.ref.processingCompleteIndicator.element.dataset.align = e.query(
"GET_STYLE_BUTTON_PROCESS_ITEM_POSITION"
), e.ref.info = e.appendChildView(e.createChildView(mu, { id: r })), e.ref.status = e.appendChildView(e.createChildView(Tu, { id: r }));
const m = e.appendChildView(
e.createChildView(Rs, {
opacity: 0,
align: e.query("GET_STYLE_LOAD_INDICATOR_POSITION")
})
);
m.element.classList.add("filepond--load-indicator"), e.ref.loadProgressIndicator = m;
const h = e.appendChildView(
e.createChildView(Rs, {
opacity: 0,
align: e.query("GET_STYLE_PROGRESS_INDICATOR_POSITION")
})
);
h.element.classList.add("filepond--process-indicator"), e.ref.processProgressIndicator = h, e.ref.activeStyles = [];
}, wu = ({ root: e, actions: t, props: n }) => {
Cu({ root: e, actions: t, props: n });
let r = t.concat().filter((s) => /^DID_/.test(s.type)).reverse().find((s) => ct[s.type]);
if (r) {
e.ref.activeStyles = [];
const s = ct[r.type];
te(bu, (i, o) => {
const l = e.ref[i];
te(o, (a, c) => {
const d = s[i] && typeof s[i][a] < "u" ? s[i][a] : c;
e.ref.activeStyles.push({ control: l, key: a, value: d });
});
});
}
e.ref.activeStyles.forEach(({ control: s, key: i, value: o }) => {
s[i] = typeof o == "function" ? o(e) : o;
});
}, Cu = Ee({
DID_SET_LABEL_BUTTON_ABORT_ITEM_PROCESSING: ({ root: e, action: t }) => {
e.ref.buttonAbortItemProcessing.label = t.value;
},
DID_SET_LABEL_BUTTON_ABORT_ITEM_LOAD: ({ root: e, action: t }) => {
e.ref.buttonAbortItemLoad.label = t.value;
},
DID_SET_LABEL_BUTTON_ABORT_ITEM_REMOVAL: ({ root: e, action: t }) => {
e.ref.buttonAbortItemRemoval.label = t.value;
},
DID_REQUEST_ITEM_PROCESSING: ({ root: e }) => {
e.ref.processProgressIndicator.spin = !0, e.ref.processProgressIndicator.progress = 0;
},
DID_START_ITEM_LOAD: ({ root: e }) => {
e.ref.loadProgressIndicator.spin = !0, e.ref.loadProgressIndicator.progress = 0;
},
DID_START_ITEM_REMOVE: ({ root: e }) => {
e.ref.processProgressIndicator.spin = !0, e.ref.processProgressIndicator.progress = 0;
},
DID_UPDATE_ITEM_LOAD_PROGRESS: ({ root: e, action: t }) => {
e.ref.loadProgressIndicator.spin = !1, e.ref.loadProgressIndicator.progress = t.progress;
},
DID_UPDATE_ITEM_PROCESS_PROGRESS: ({ root: e, action: t }) => {
e.ref.processProgressIndicator.spin = !1, e.ref.processProgressIndicator.progress = t.progress;
}
}), Au = ae({
create: Du,
write: wu,
didCreateView: (e) => {
ot("CREATE_VIEW", { ...e, view: e });
},
name: "file"
}), Pu = ({ root: e, props: t }) => {
e.ref.fileName = xe("legend"), e.appendChild(e.ref.fileName), e.ref.file = e.appendChildView(e.createChildView(Au, { id: t.id })), e.ref.data = !1;
}, Nu = ({ root: e, props: t }) => {
oe(e.ref.fileName, Or(e.query("GET_ITEM_NAME", t.id)));
}, Lu = ae({
create: Pu,
ignoreRect: !0,
write: Ee({
DID_LOAD_ITEM: Nu
}),
didCreateView: (e) => {
ot("CREATE_VIEW", { ...e, view: e });
},
tag: "fieldset",
name: "file-wrapper"
}), Ds = { type: "spring", damping: 0.6, mass: 7 }, Mu = ({ root: e, props: t }) => {
[
{
name: "top"
},
{
name: "center",
props: {
translateY: null,
scaleY: null
},
mixins: {
animations: {
scaleY: Ds
},
styles: ["translateY", "scaleY"]
}
},
{
name: "bottom",
props: {
translateY: null
},
mixins: {
animations: {
translateY: Ds
},
styles: ["translateY"]
}
}
].forEach((n) => {
xu(e, n, t.name);
}), e.element.classList.add(`filepond--${t.name}`), e.ref.scalable = null;
}, xu = (e, t, n) => {
const r = ae({
name: `panel-${t.name} filepond--${n}`,
mixins: t.mixins,
ignoreRectUpdate: !0
}), s = e.createChildView(r, t.props);
e.ref[t.name] = e.appendChildView(s);
}, Gu = ({ root: e, props: t }) => {
if ((e.ref.scalable === null || t.scalable !== e.ref.scalable) && (e.ref.scalable = $o(t.scalable) ? t.scalable : !0, e.element.dataset.scalable = e.ref.scalable), !t.height) return;
const n = e.ref.top.rect.element, r = e.ref.bottom.rect.element, s = Math.max(n.height + r.height, t.height);
e.ref.center.translateY = n.height, e.ref.center.scaleY = (s - n.height - r.height) / 100, e.ref.bottom.translateY = s - r.height;
}, ai = ae({
name: "panel",
read: ({ root: e, props: t }) => t.heightCurrent = e.ref.bottom.translateY,
write: Gu,
create: Mu,
ignoreRect: !0,
mixins: {
apis: ["height", "heightCurrent", "scalable"]
}
}), Fu = (e) => {
const t = e.map((r) => r.id);
let n;
return {
setIndex: (r) => {
n = r;
},
getIndex: () => n,
getItemIndex: (r) => t.indexOf(r.id)
};
}, ws = {
type: "spring",
stiffness: 0.75,
damping: 0.45,
mass: 10
}, Cs = "spring", As = {
DID_START_ITEM_LOAD: "busy",
DID_UPDATE_ITEM_LOAD_PROGRESS: "loading",
DID_THROW_ITEM_INVALID: "load-invalid",
DID_THROW_ITEM_LOAD_ERROR: "load-error",
DID_LOAD_ITEM: "idle",
DID_THROW_ITEM_REMOVE_ERROR: "remove-error",
DID_START_ITEM_REMOVE: "busy",
DID_START_ITEM_PROCESSING: "busy processing",
DID_REQUEST_ITEM_PROCESSING: "busy processing",
DID_UPDATE_ITEM_PROCESS_PROGRESS: "processing",
DID_COMPLETE_ITEM_PROCESSING: "processing-complete",
DID_THROW_ITEM_PROCESSING_ERROR: "processing-error",
DID_THROW_ITEM_PROCESSING_REVERT_ERROR: "processing-revert-error",
DID_ABORT_ITEM_PROCESSING: "cancelled",
DID_REVERT_ITEM_PROCESSING: "idle"
}, Bu = ({ root: e, props: t }) => {
if (e.ref.handleClick = (r) => e.dispatch("DID_ACTIVATE_ITEM", { id: t.id }), e.element.id = `filepond--item-${t.id}`, e.element.addEventListener("click", e.ref.handleClick), e.ref.container = e.appendChildView(e.createChildView(Lu, { id: t.id })), e.ref.panel = e.appendChildView(e.createChildView(ai, { name: "item-panel" })), e.ref.panel.height = null, t.markedForRemoval = !1, !e.query("GET_ALLOW_REORDER")) return;
e.element.dataset.dragState = "idle";
const n = (r) => {
if (!r.isPrimary) return;
let s = !1;
const i = {
x: r.pageX,
y: r.pageY
};
t.dragOrigin = {
x: e.translateX,
y: e.translateY
}, t.dragCenter = {
x: r.offsetX,
y: r.offsetY
};
const o = Fu(e.query("GET_ACTIVE_ITEMS"));
e.dispatch("DID_GRAB_ITEM", { id: t.id, dragState: o });
const l = (u) => {
if (!u.isPrimary) return;
u.stopPropagation(), u.preventDefault(), t.dragOffset = {
x: u.pageX - i.x,
y: u.pageY - i.y
}, t.dragOffset.x * t.dragOffset.x + t.dragOffset.y * t.dragOffset.y > 16 && !s && (s = !0, e.element.removeEventListener("click", e.ref.handleClick)), e.dispatch("DID_DRAG_ITEM", { id: t.id, dragState: o });
}, a = (u) => {
u.isPrimary && (t.dragOffset = {
x: u.pageX - i.x,
y: u.pageY - i.y
}, d());
}, c = () => {
d();
}, d = () => {
document.removeEventListener("pointercancel", c), document.removeEventListener("pointermove", l), document.removeEventListener("pointerup", a), e.dispatch("DID_DROP_ITEM", { id: t.id, dragState: o }), s && setTimeout(() => e.element.addEventListener("click", e.ref.handleClick), 0);
};
document.addEventListener("pointercancel", c), document.addEventListener("pointermove", l), document.addEventListener("pointerup", a);
};
e.element.addEventListener("pointerdown", n);
}, Uu = Ee({
DID_UPDATE_PANEL_HEIGHT: ({ root: e, action: t }) => {
e.height = t.height;
}
}), ku = Ee(
{
DID_GRAB_ITEM: ({ root: e, props: t }) => {
t.dragOrigin = {
x: e.translateX,
y: e.translateY
};
},
DID_DRAG_ITEM: ({ root: e }) => {
e.element.dataset.dragState = "drag";
},
DID_DROP_ITEM: ({ root: e, props: t }) => {
t.dragOffset = null, t.dragOrigin = null, e.element.dataset.dragState = "drop";
}
},
({ root: e, actions: t, props: n, shouldOptimize: r }) => {
e.element.dataset.dragState === "drop" && e.scaleX <= 1 && (e.element.dataset.dragState = "idle");
let s = t.concat().filter((o) => /^DID_/.test(o.type)).reverse().find((o) => As[o.type]);
s && s.type !== n.currentState && (n.currentState = s.type, e.element.dataset.filepondItemState = As[n.currentState] || "");
const i = e.query("GET_ITEM_PANEL_ASPECT_RATIO") || e.query("GET_PANEL_ASPECT_RATIO");
i ? r || (e.height = e.rect.element.width * i) : (Uu({ root: e, actions: t, props: n }), !e.height && e.ref.container.rect.element.height > 0 && (e.height = e.ref.container.rect.element.height)), r && (e.ref.panel.height = null), e.ref.panel.height = e.height;
}
), Vu = ae({
create: Bu,
write: ku,
destroy: ({ root: e, props: t }) => {
e.element.removeEventListener("click", e.ref.handleClick), e.dispatch("RELEASE_ITEM", { query: t.id });
},
tag: "li",
name: "item",
mixins: {
apis: [
"id",
"interactionMethod",
"markedForRemoval",
"spawnDate",
"dragCenter",
"dragOrigin",
"dragOffset"
],
styles: ["translateX", "translateY", "scaleX", "scaleY", "opacity", "height"],
animations: {
scaleX: Cs,
scaleY: Cs,
translateX: ws,
translateY: ws,
opacity: { type: "tween", duration: 150 }
}
}
});
var Dr = (e, t) => Math.max(1, Math.floor((e + 1) / t));
const wr = (e, t, n) => {
if (!n) return;
const r = e.rect.element.width, s = t.length;
let i = null;
if (s === 0 || n.top < t[0].rect.element.top) return -1;
const l = t[0].rect.element, a = l.marginLeft + l.marginRight, c = l.width + a, d = Dr(r, c);
if (d === 1) {
for (let h = 0; h < s; h++) {
const f = t[h], p = f.rect.outer.top + f.rect.element.height * 0.5;
if (n.top < p)
return h;
}
return s;
}
const u = l.marginTop + l.marginBottom, m = l.height + u;
for (let h = 0; h < s; h++) {
const f = h % d, p = Math.floor(h / d), I = f * c, g = p * m, E = g - l.marginTop, T = I + c, v = g + m + l.marginBottom;
if (n.top < v && n.top > E) {
if (n.left < T)
return h;
h !== s - 1 ? i = h : i = null;
}
}
return i !== null ? i : s;
}, kt = {
height: 0,
width: 0,
get getHeight() {
return this.height;
},
set setHeight(e) {
(this.height === 0 || e === 0) && (this.height = e);
},
get getWidth() {
return this.width;
},
set setWidth(e) {
(this.width === 0 || e === 0) && (this.width = e);
}
}, $u = ({ root: e }) => {
ce(e.element, "role", "list"), e.ref.lastItemSpanwDate = Date.now();
}, ju = ({ root: e, action: t }) => {
const { id: n, index: r, interactionMethod: s } = t;
e.ref.addIndex = r;
const i = Date.now();
let o = i, l = 1;
if (s !== Se.NONE) {
l = 0;
const a = e.query("GET_ITEM_INSERT_INTERVAL"), c = i - e.ref.lastItemSpanwDate;
o = c < a ? i + (a - c) : i;
}
e.ref.lastItemSpanwDate = o, e.appendChildView(
e.createChildView(
// view type
Vu,
// props
{
spawnDate: o,
id: n,
opacity: l,
interactionMethod: s
}
),
r
);
}, Ps = (e, t, n, r = 0, s = 1) => {
e.dragOffset ? (e.translateX = null, e.translateY = null, e.translateX = e.dragOrigin.x + e.dragOffset.x, e.translateY = e.dragOrigin.y + e.dragOffset.y, e.scaleX = 1.025, e.scaleY = 1.025) : (e.translateX = t, e.translateY = n, Date.now() > e.spawnDate && (e.opacity === 0 && Hu(e, t, n, r, s), e.scaleX = 1, e.scaleY = 1, e.opacity = 1));
}, Hu = (e, t, n, r, s) => {
e.interactionMethod === Se.NONE ? (e.translateX = null, e.translateX = t, e.translateY = null, e.translateY = n) : e.interactionMethod === Se.DROP ? (e.translateX = null, e.translateX = t - r * 20, e.translateY = null, e.translateY = n - s * 10, e.scaleX = 0.8, e.scaleY = 0.8) : e.interactionMethod === Se.BROWSE ? (e.translateY = null, e.translateY = n - 30) : e.interactionMethod === Se.API && (e.translateX = null, e.translateX = t - 30, e.translateY = null);
}, qu = ({ root: e, action: t }) => {
const { id: n } = t, r = e.childViews.find((s) => s.id === n);
r && (r.scaleX = 0.9, r.scaleY = 0.9, r.opacity = 0, r.markedForRemoval = !0);
}, Bn = (e) => e.rect.element.height + e.rect.element.marginBottom * 0.5 + e.rect.element.marginTop * 0.5, Yu = (e) => e.rect.element.width + e.rect.element.marginLeft * 0.5 + e.rect.element.marginRight * 0.5, Wu = ({ root: e, action: t }) => {
const { id: n, dragState: r } = t, s = e.query("GET_ITEM", { id: n }), i = e.childViews.find((I) => I.id === n), o = e.childViews.length, l = r.getItemIndex(s);
if (!i) return;
const a = {
x: i.dragOrigin.x + i.dragOffset.x + i.dragCenter.x,
y: i.dragOrigin.y + i.dragOffset.y + i.dragCenter.y
}, c = Bn(i), d = Yu(i);
let u = Math.floor(e.rect.outer.width / d);
u > o && (u = o);
const m = Math.floor(o / u + 1);
kt.setHeight = c * m, kt.setWidth = d * u;
var h = {
y: Math.floor(a.y / c),
x: Math.floor(a.x / d),
getGridIndex: function() {
return a.y > kt.getHeight || a.y < 0 || a.x > kt.getWidth || a.x < 0 ? l : this.y * u + this.x;
},
getColIndex: function() {
const g = e.query("GET_ACTIVE_ITEMS"), E = e.childViews.filter((M) => M.rect.element.height), T = g.map(
(M) => E.find((G) => G.id === M.id)
), v = T.findIndex((M) => M === i), D = Bn(i), w = T.length;
let A = w, C = 0, L = 0, V = 0;
for (let M = 0; M < w; M++)
if (C = Bn(T[M]), V = L, L = V + C, a.y < L) {
if (v > M) {
if (a.y < V + D) {
A = M;
break;
}
continue;
}
A = M;
break;
}
return A;
}
};
const f = u > 1 ? h.getGridIndex() : h.getColIndex();
e.dispatch("MOVE_ITEM", { query: i, index: f });
const p = r.getIndex();
if (p === void 0 || p !== f) {
if (r.setIndex(f), p === void 0) return;
e.dispatch("DID_REORDER_ITEMS", {
items: e.query("GET_ACTIVE_ITEMS"),
origin: l,
target: f
});
}
}, zu = Ee({
DID_ADD_ITEM: ju,
DID_REMOVE_ITEM: qu,
DID_DRAG_ITEM: Wu
}), Xu = ({ root: e, props: t, actions: n, shouldOptimize: r }) => {
zu({ root: e, props: t, actions: n });
const { dragCoordinates: s } = t, i = e.rect.element.width, o = e.childViews.filter((T) => T.rect.element.height), l = e.query("GET_ACTIVE_ITEMS").map((T) => o.find((v) => v.id === T.id)).filter((T) => T), a = s ? wr(e, l, s) : null, c = e.ref.addIndex || null;
e.ref.addIndex = null;
let d = 0, u = 0, m = 0;
if (l.length === 0) return;
const h = l[0].rect.element, f = h.marginTop + h.marginBottom, p = h.marginLeft + h.marginRight, I = h.width + p, g = h.height + f, E = Dr(i, I);
if (E === 1) {
let T = 0, v = 0;
l.forEach((D, w) => {
if (a) {
let L = w - a;
L === -2 ? v = -f * 0.25 : L === -1 ? v = -f * 0.75 : L === 0 ? v = f * 0.75 : L === 1 ? v = f * 0.25 : v = 0;
}
r && (D.translateX = null, D.translateY = null), D.markedForRemoval || Ps(D, 0, T + v);
let C = (D.rect.element.height + f) * (D.markedForRemoval ? D.opacity : 1);
T += C;
});
} else {
let T = 0, v = 0;
l.forEach((D, w) => {
w === a && (d = 1), w === c && (m += 1), D.markedForRemoval && D.opacity < 0.5 && (u -= 1);
const A = w + m + d + u, C = A % E, L = Math.floor(A / E), V = C * I, M = L * g, G = Math.sign(V - T), z = Math.sign(M - v);
T = V, v = M, !D.markedForRemoval && (r && (D.translateX = null, D.translateY = null), Ps(D, V, M, G, z));
});
}
}, Ku = (e, t) => t.filter((n) => n.data && n.data.id ? e.id === n.data.id : !0), Qu = ae({
create: $u,
write: Xu,
tag: "ul",
name: "list",
didWriteView: ({ root: e }) => {
e.childViews.filter((t) => t.markedForRemoval && t.opacity === 0 && t.resting).forEach((t) => {
t._destroy(), e.removeChildView(t);
});
},
filterFrameActionsForChild: Ku,
mixins: {
apis: ["dragCoordinates"]
}
}), Zu = ({ root: e, props: t }) => {
e.ref.list = e.appendChildView(e.createChildView(Qu)), t.dragCoordinates = null, t.overflowing = !1;
}, Ju = ({ root: e, props: t, action: n }) => {
e.query("GET_ITEM_INSERT_LOCATION_FREEDOM") && (t.dragCoordinates = {
left: n.position.scopeLeft - e.ref.list.rect.element.left,
top: n.position.scopeTop - (e.rect.outer.top + e.rect.element.marginTop + e.rect.element.scrollTop)
});
}, ef = ({ props: e }) => {
e.dragCoordinates = null;
}, tf = Ee({
DID_DRAG: Ju,
DID_END_DRAG: ef
}), nf = ({ root: e, props: t, actions: n }) => {
if (tf({ root: e, props: t, actions: n }), e.ref.list.dragCoordinates = t.dragCoordinates, t.overflowing && !t.overflow && (t.overflowing = !1, e.element.dataset.state = "", e.height = null), t.overflow) {
const r = Math.round(t.overflow);
r !== e.height && (t.overflowing = !0, e.element.dataset.state = "overflow", e.height = r);
}
}, rf = ae({
create: Zu,
write: nf,
name: "list-scroller",
mixins: {
apis: ["overflow", "dragCoordinates"],
styles: ["height", "translateY"],
animations: {
translateY: "spring"
}
}
}), Ce = (e, t, n, r = "") => {
n ? ce(e, t, r) : e.removeAttribute(t);
}, sf = (e) => {
if (!(!e || e.value === "")) {
try {
e.value = "";
} catch {
}
if (e.value) {
const t = xe("form"), n = e.parentNode, r = e.nextSibling;
t.appendChild(e), t.reset(), r ? n.insertBefore(e, r) : n.appendChild(e);
}
}
}, of = ({ root: e, props: t }) => {
e.element.id = `filepond--browser-${t.id}`, ce(e.element, "name", e.query("GET_NAME")), ce(e.element, "aria-controls", `filepond--assistant-${t.id}`), ce(e.element, "aria-labelledby", `filepond--drop-label-${t.id}`), li({ root: e, action: { value: e.query("GET_ACCEPTED_FILE_TYPES") } }), ci({ root: e, action: { value: e.query("GET_ALLOW_MULTIPLE") } }), di({ root: e, action: { value: e.query("GET_ALLOW_DIRECTORIES_ONLY") } }), rr({ root: e }), ui({ root: e, action: { value: e.query("GET_REQUIRED") } }), fi({ root: e, action: { value: e.query("GET_CAPTURE_METHOD") } }), e.ref.handleChange = (n) => {
if (!e.element.value)
return;
const r = Array.from(e.element.files).map((s) => (s._relativePath = s.webkitRelativePath, s));
setTimeout(() => {
t.onload(r), sf(e.element);
}, 250);
}, e.element.addEventListener("change", e.ref.handleChange);
}, li = ({ root: e, action: t }) => {
e.query("GET_ALLOW_SYNC_ACCEPT_ATTRIBUTE") && Ce(e.element, "accept", !!t.value, t.value ? t.value.join(",") : "");
}, ci = ({ root: e, action: t }) => {
Ce(e.element, "multiple", t.value);
}, di = ({ root: e, action: t }) => {
Ce(e.element, "webkitdirectory", t.value);
}, rr = ({ root: e }) => {
const t = e.query("GET_DISABLED"), n = e.query("GET_ALLOW_BROWSE"), r = t || !n;
Ce(e.element, "disabled", r);
}, ui = ({ root: e, action: t }) => {
t.value ? e.query("GET_TOTAL_ITEMS") === 0 && Ce(e.element, "required", !0) : Ce(e.element, "required", !1);
}, fi = ({ root: e, action: t }) => {
Ce(e.element, "capture", !!t.value, t.value === !0 ? "" : t.value);
}, Ns = ({ root: e }) => {
const { element: t } = e;
if (e.query("GET_TOTAL_ITEMS") > 0) {
Ce(t, "required", !1), Ce(t, "name", !1);
const n = e.query("GET_ACTIVE_ITEMS");
let r = !1;
for (let s = 0; s < n.length; s++)
n[s].status === k.LOAD_ERROR && (r = !0);
e.element.setCustomValidity(
r ? e.query("GET_LABEL_INVALID_FIELD") : ""
);
} else
Ce(t, "name", !0, e.query("GET_NAME")), e.query("GET_CHECK_VALIDITY") && t.setCustomValidity(""), e.query("GET_REQUIRED") && Ce(t, "required", !0);
}, af = ({ root: e }) => {
e.query("GET_CHECK_VALIDITY") && e.element.setCustomValidity(e.query("GET_LABEL_INVALID_FIELD"));
}, lf = ae({
tag: "input",
name: "browser",
ignoreRect: !0,
ignoreRectUpdate: !0,
attributes: {
type: "file"
},
create: of,
destroy: ({ root: e }) => {
e.element.removeEventListener("change", e.ref.handleChange);
},
write: Ee({
DID_LOAD_ITEM: Ns,
DID_REMOVE_ITEM: Ns,
DID_THROW_ITEM_INVALID: af,
DID_SET_DISABLED: rr,
DID_SET_ALLOW_BROWSE: rr,
DID_SET_ALLOW_DIRECTORIES_ONLY: di,
DID_SET_ALLOW_MULTIPLE: ci,
DID_SET_ACCEPTED_FILE_TYPES: li,
DID_SET_CAPTURE_METHOD: fi,
DID_SET_REQUIRED: ui
})
}), Ls = {
ENTER: 13,
SPACE: 32
}, cf = ({ root: e, props: t }) => {
const n = xe("label");
ce(n, "for", `filepond--browser-${t.id}`), ce(n, "id", `filepond--drop-label-${t.id}`), e.ref.handleKeyDown = (r) => {
(r.keyCode === Ls.ENTER || r.keyCode === Ls.SPACE) && (r.preventDefault(), e.ref.label.click());
}, e.ref.handleClick = (r) => {
r.target === n || n.contains(r.target) || e.ref.label.click();
}, n.addEventListener("keydown", e.ref.handleKeyDown), e.element.addEventListener("click", e.ref.handleClick), pi(n, t.caption), e.appendChild(n), e.ref.label = n;
}, pi = (e, t) => {
e.innerHTML = t;
const n = e.querySelector(".filepond--label-action");
return n && ce(n, "tabindex", "0"), t;
}, df = ae({
name: "drop-label",
ignoreRect: !0,
create: cf,
destroy: ({ root: e }) => {
e.ref.label.addEventListener("keydown", e.ref.handleKeyDown), e.element.removeEventListener("click", e.ref.handleClick);
},
write: Ee({
DID_SET_LABEL_IDLE: ({ root: e, action: t }) => {
pi(e.ref.label, t.value);
}
}),
mixins: {
styles: ["opacity", "translateX", "translateY"],
animations: {
opacity: { type: "tween", duration: 150 },
translateX: "spring",
translateY: "spring"
}
}
}), uf = ae({
name: "drip-blob",
ignoreRect: !0,
mixins: {
styles: ["translateX", "translateY", "scaleX", "scaleY", "opacity"],
animations: {
scaleX: "spring",
scaleY: "spring",
translateX: "spring",
translateY: "spring",
opacity: { type: "tween", duration: 250 }
}
}
}), ff = ({ root: e }) => {
const t = e.rect.element.width * 0.5, n = e.rect.element.height * 0.5;
e.ref.blob = e.appendChildView(
e.createChildView(uf, {
opacity: 0,
scaleX: 2.5,
scaleY: 2.5,
translateX: t,
translateY: n
})
);
}, pf = ({ root: e, action: t }) => {
if (!e.ref.blob) {
ff({ root: e });
return;
}
e.ref.blob.translateX = t.position.scopeLeft, e.ref.blob.translateY = t.position.scopeTop, e.ref.blob.scaleX = 1, e.ref.blob.scaleY = 1, e.ref.blob.opacity = 1;
}, mf = ({ root: e }) => {
e.ref.blob && (e.ref.blob.opacity = 0);
}, hf = ({ root: e }) => {
e.ref.blob && (e.ref.blob.scaleX = 2.5, e.ref.blob.scaleY = 2.5, e.ref.blob.opacity = 0);
}, Ef = ({ root: e, props: t, actions: n }) => {
gf({ root: e, props: t, actions: n });
const { blob: r } = e.ref;
n.length === 0 && r && r.opacity === 0 && (e.removeChildView(r), e.ref.blob = null);
}, gf = Ee({
DID_DRAG: pf,
DID_DROP: hf,
DID_END_DRAG: mf
}), If = ae({
ignoreRect: !0,
ignoreRectUpdate: !0,
name: "drip",
write: Ef
}), mi = (e, t) => {
try {
const n = new DataTransfer();
t.forEach((r) => {
r instanceof File ? n.items.add(r) : n.items.add(
new File([r], r.name, {
type: r.type
})
);
}), e.files = n.files;
} catch {
return !1;
}
return !0;
}, _f = ({ root: e }) => {
e.ref.fields = {};
const t = document.createElement("legend");
t.textContent = "Files", e.element.appendChild(t);
}, In = (e, t) => e.ref.fields[t], Cr = (e) => {
e.query("GET_ACTIVE_ITEMS").forEach((t) => {
e.ref.fields[t.id] && e.element.appendChild(e.ref.fields[t.id]);
});
}, Ms = ({ root: e }) => Cr(e), Tf = ({ root: e, action: t }) => {
const s = !(e.query("GET_ITEM", t.id).origin === de.LOCAL) && e.query("SHOULD_UPDATE_FILE_INPUT"), i = xe("input");
i.type = s ? "file" : "hidden", i.name = e.query("GET_NAME"), e.ref.fields[t.id] = i, Cr(e);
}, yf = ({ root: e, action: t }) => {
const n = In(e, t.id);
if (!n || (t.serverFileReference !== null && (n.value = t.serverFileReference), !e.query("SHOULD_UPDATE_FILE_INPUT"))) return;
const r = e.query("GET_ITEM", t.id);
mi(n, [r.file]);
}, Rf = ({ root: e, action: t }) => {
e.query("SHOULD_UPDATE_FILE_INPUT") && setTimeout(() => {
const n = In(e, t.id);
n && mi(n, [t.file]);
}, 0);
}, Sf = ({ root: e }) => {
e.element.disabled = e.query("GET_DISABLED");
}, vf = ({ root: e, action: t }) => {
const n = In(e, t.id);
n && (n.parentNode && n.parentNode.removeChild(n), delete e.ref.fields[t.id]);
}, bf = ({ root: e, action: t }) => {
const n = In(e, t.id);
n && (t.value === null ? n.removeAttribute("value") : n.type != "file" && (n.value = t.value), Cr(e));
}, Of = Ee({
DID_SET_DISABLED: Sf,
DID_ADD_ITEM: Tf,
DID_LOAD_ITEM: yf,
DID_REMOVE_ITEM: vf,
DID_DEFINE_VALUE: bf,
DID_PREPARE_OUTPUT: Rf,
DID_REORDER_ITEMS: Ms,
DID_SORT_ITEMS: Ms
}), Df = ae({
tag: "fieldset",
name: "data",
create: _f,
write: Of,
ignoreRect: !0
}), wf = (e) => "getRootNode" in e ? e.getRootNode() : document, Cf = ["jpg", "jpeg", "png", "gif", "bmp", "webp", "svg", "tiff"], Af = ["css", "csv", "html", "txt"], Pf = {
zip: "zip|compressed",
epub: "application/epub+zip"
}, hi = (e = "") => (e = e.toLowerCase(), Cf.includes(e) ? "image/" + (e === "jpg" ? "jpeg" : e === "svg" ? "svg+xml" : e) : Af.includes(e) ? "text/" + e : Pf[e] || ""), Ar = (e) => new Promise((t, n) => {
const r = Uf(e);
if (r.length && !Nf(e))
return t(r);
Lf(e).then(t);
}), Nf = (e) => e.files ? e.files.length > 0 : !1, Lf = (e) => new Promise((t, n) => {
const r = (e.items ? Array.from(e.items) : []).filter((s) => Mf(s)).map((s) => xf(s));
if (!r.length) {
t(e.files ? Array.from(e.files) : []);
return;
}
Promise.all(r).then((s) => {
const i = [];
s.forEach((o) => {
i.push.apply(i, o);
}), t(
i.filter((o) => o).map((o) => (o._relativePath || (o._relativePath = o.webkitRelativePath), o))
);
}).catch(console.error);
}), Mf = (e) => {
if (Ei(e)) {
const t = Pr(e);
if (t)
return t.isFile || t.isDirectory;
}
return e.kind === "file";
}, xf = (e) => new Promise((t, n) => {
if (Bf(e)) {
Gf(Pr(e)).then(t).catch(n);
return;
}
t([e.getAsFile()]);
}), Gf = (e) => new Promise((t, n) => {
const r = [];
let s = 0, i = 0;
const o = () => {
i === 0 && s === 0 && t(r);
}, l = (a) => {
s++;
const c = a.createReader(), d = () => {
c.readEntries((u) => {
if (u.length === 0) {
s--, o();
return;
}
u.forEach((m) => {
m.isDirectory ? l(m) : (i++, m.file((h) => {
const f = Ff(h);
m.fullPath && (f._relativePath = m.fullPath), r.push(f), i--, o();
}));
}), d();
}, n);
};
d();
};
l(e);
}), Ff = (e) => {
if (e.type.length) return e;
const t = e.lastModifiedDate, n = e.name, r = hi(gn(e.name));
return r.length && (e = e.slice(0, e.size, r), e.name = n, e.lastModifiedDate = t), e;
}, Bf = (e) => Ei(e) && (Pr(e) || {}).isDirectory, Ei = (e) => "webkitGetAsEntry" in e, Pr = (e) => e.webkitGetAsEntry(), Uf = (e) => {
let t = [];
try {
if (t = Vf(e), t.length)
return t;
t = kf(e);
} catch {
}
return t;
}, kf = (e) => {
let t = e.getData("url");
return typeof t == "string" && t.length ? [t] : [];
}, Vf = (e) => {
let t = e.getData("text/html");
if (typeof t == "string" && t.length) {
const n = t.match(/src\s*=\s*"(.+?)"/);
if (n)
return [n[1]];
}
return [];
}, tn = [], tt = (e) => ({
pageLeft: e.pageX,
pageTop: e.pageY,
scopeLeft: e.offsetX || e.layerX,
scopeTop: e.offsetY || e.layerY
}), $f = (e, t, n) => {
const r = jf(t), s = {
element: e,
filterElement: n,
state: null,
ondrop: () => {
},
onenter: () => {
},
ondrag: () => {
},
onexit: () => {
},
onload: () => {
},
allowdrop: () => {
}
};
return s.destroy = r.addListener(s), s;
}, jf = (e) => {
const t = tn.find((r) => r.element === e);
if (t)
return t;
const n = Hf(e);
return tn.push(n), n;
}, Hf = (e) => {
const t = [], n = {
dragenter: Yf,
dragover: Wf,
dragleave: Xf,
drop: zf
}, r = {};
te(n, (i, o) => {
r[i] = o(e, t), e.addEventListener(i, r[i], !1);
});
const s = {
element: e,
addListener: (i) => (t.push(i), () => {
t.splice(t.indexOf(i), 1), t.length === 0 && (tn.splice(tn.indexOf(s), 1), te(n, (o) => {
e.removeEventListener(o, r[o], !1);
}));
})
};
return s;
}, qf = (e, t) => ("elementFromPoint" in e || (e = document), e.elementFromPoint(t.x, t.y)), Nr = (e, t) => {
const n = wf(t), r = qf(n, {
x: e.pageX - window.pageXOffset,
y: e.pageY - window.pageYOffset
});
return r === t || t.contains(r);
};
let gi = null;
const Vt = (e, t) => {
try {
e.dropEffect = t;
} catch {
}
}, Yf = (e, t) => (n) => {
n.preventDefault(), gi = n.target, t.forEach((r) => {
const { element: s, onenter: i } = r;
Nr(n, s) && (r.state = "enter", i(tt(n)));
});
}, Wf = (e, t) => (n) => {
n.preventDefault();
const r = n.dataTransfer;
Ar(r).then((s) => {
let i = !1;
t.some((o) => {
const { filterElement: l, element: a, onenter: c, onexit: d, ondrag: u, allowdrop: m } = o;
Vt(r, "copy");
const h = m(s);
if (!h) {
Vt(r, "none");
return;
}
if (Nr(n, a)) {
if (i = !0, o.state === null) {
o.state = "enter", c(tt(n));
return;
}
if (o.state = "over", l && !h) {
Vt(r, "none");
return;
}
u(tt(n));
} else
l && !i && Vt(r, "none"), o.state && (o.state = null, d(tt(n)));
});
});
}, zf = (e, t) => (n) => {
n.preventDefault();
const r = n.dataTransfer;
Ar(r).then((s) => {
t.forEach((i) => {
const { filterElement: o, element: l, ondrop: a, onexit: c, allowdrop: d } = i;
if (i.state = null, !(o && !Nr(n, l))) {
if (!d(s)) return c(tt(n));
a(tt(n), s);
}
});
});
}, Xf = (e, t) => (n) => {
gi === n.target && t.forEach((r) => {
const { onexit: s } = r;
r.state = null, s(tt(n));
});
}, Kf = (e, t, n) => {
e.classList.add("filepond--hopper");
const { catchesDropsOnPage: r, requiresDropOnElement: s, filterItems: i = (d) => d } = n, o = $f(
e,
r ? document.documentElement : e,
s
);
let l = "", a = "";
o.allowdrop = (d) => t(i(d)), o.ondrop = (d, u) => {
const m = i(u);
if (!t(m)) {
c.ondragend(d);
return;
}
a = "drag-drop", c.onload(m, d);
}, o.ondrag = (d) => {
c.ondrag(d);
}, o.onenter = (d) => {
a = "drag-over", c.ondragstart(d);
}, o.onexit = (d) => {
a = "drag-exit", c.ondragend(d);
};
const c = {
updateHopperState: () => {
l !== a && (e.dataset.hopperState = a, l = a);
},
onload: () => {
},
ondragstart: () => {
},
ondrag: () => {
},
ondragend: () => {
},
destroy: () => {
o.destroy();
}
};
return c;
};
let sr = !1;
const dt = [], Ii = (e) => {
const t = document.activeElement;
if (t && (/textarea|input/i.test(t.nodeName) || t.getAttribute("contenteditable") === "true" || t.getAttribute("contenteditable") === "")) {
let r = !1, s = t;
for (; s !== document.body; ) {
if (s.classList.contains("filepond--root")) {
r = !0;
break;
}
s = s.parentNode;
}
if (!r) return;
}
Ar(e.clipboardData).then((r) => {
r.length && dt.forEach((s) => s(r));
});
}, Qf = (e) => {
dt.includes(e) || (dt.push(e), !sr && (sr = !0, document.addEventListener("paste", Ii)));
}, Zf = (e) => {
Sr(dt, dt.indexOf(e)), dt.length === 0 && (document.removeEventListener("paste", Ii), sr = !1);
}, Jf = () => {
const e = (n) => {
t.onload(n);
}, t = {
destroy: () => {
Zf(e);
},
onload: () => {
}
};
return Qf(e), t;
}, ep = ({ root: e, props: t }) => {
e.element.id = `filepond--assistant-${t.id}`, ce(e.element, "role", "alert"), ce(e.element, "aria-live", "polite"), ce(e.element, "aria-relevant", "additions");
};
let xs = null, Gs = null;
const Un = [], _n = (e, t) => {
e.element.textContent = t;
}, tp = (e) => {
e.element.textContent = "";
}, _i = (e, t, n) => {
const r = e.query("GET_TOTAL_ITEMS");
_n(
e,
`${n} ${t}, ${r} ${r === 1 ? e.query("GET_LABEL_FILE_COUNT_SINGULAR") : e.query("GET_LABEL_FILE_COUNT_PLURAL")}`
), clearTimeout(Gs), Gs = setTimeout(() => {
tp(e);
}, 1500);
}, Ti = (e) => e.element.parentNode.contains(document.activeElement), np = ({ root: e, action: t }) => {
if (!Ti(e))
return;
e.element.textContent = "";
const n = e.query("GET_ITEM", t.id);
Un.push(n.filename), clearTimeout(xs), xs = setTimeout(() => {
_i(e, Un.join(", "), e.query("GET_LABEL_FILE_ADDED")), Un.length = 0;
}, 750);
}, rp = ({ root: e, action: t }) => {
if (!Ti(e))
return;
const n = t.item;
_i(e, n.filename, e.query("GET_LABEL_FILE_REMOVED"));
}, sp = ({ root: e, action: t }) => {
const r = e.query("GET_ITEM", t.id).filename, s = e.query("GET_LABEL_FILE_PROCESSING_COMPLETE");
_n(e, `${r} ${s}`);
}, Fs = ({ root: e, action: t }) => {
const r = e.query("GET_ITEM", t.id).filename, s = e.query("GET_LABEL_FILE_PROCESSING_ABORTED");
_n(e, `${r} ${s}`);
}, $t = ({ root: e, action: t }) => {
const r = e.query("GET_ITEM", t.id).filename;
_n(e, `${t.status.main} ${r} ${t.status.sub}`);
}, op = ae({
create: ep,
ignoreRect: !0,
ignoreRectUpdate: !0,
write: Ee({
DID_LOAD_ITEM: np,
DID_REMOVE_ITEM: rp,
DID_COMPLETE_ITEM_PROCESSING: sp,
DID_ABORT_ITEM_PROCESSING: Fs,
DID_REVERT_ITEM_PROCESSING: Fs,
DID_THROW_ITEM_REMOVE_ERROR: $t,
DID_THROW_ITEM_LOAD_ERROR: $t,
DID_THROW_ITEM_INVALID: $t,
DID_THROW_ITEM_PROCESSING_ERROR: $t
}),
tag: "span",
name: "assistant"
}), yi = (e, t = "-") => e.replace(new RegExp(`${t}.`, "g"), (n) => n.charAt(1).toUpperCase()), Ri = (e, t = 16, n = !0) => {
let r = Date.now(), s = null;
return (...i) => {
clearTimeout(s);
const o = Date.now() - r, l = () => {
r = Date.now(), e(...i);
};
o < t ? n || (s = setTimeout(l, t - o)) : l();
};
}, ip = 1e6, nn = (e) => e.preventDefault(), ap = ({ root: e, props: t }) => {
const n = e.query("GET_ID");
n && (e.element.id = n);
const r = e.query("GET_CLASS_NAME");
r && r.split(" ").filter((a) => a.length).forEach((a) => {
e.element.classList.add(a);
}), e.ref.label = e.appendChildView(
e.createChildView(df, {
...t,
translateY: null,
caption: e.query("GET_LABEL_IDLE")
})
), e.ref.list = e.appendChildView(e.createChildView(rf, { translateY: null })), e.ref.panel = e.appendChildView(e.createChildView(ai, { name: "panel-root" })), e.ref.assistant = e.appendChildView(e.createChildView(op, { ...t })), e.ref.data = e.appendChildView(e.createChildView(Df, { ...t })), e.ref.measure = xe("div"), e.ref.measure.style.height = "100%", e.element.appendChild(e.ref.measure), e.ref.bounds = null, e.query("GET_STYLES").filter((a) => !Me(a.value)).map(({ name: a, value: c }) => {
e.element.dataset[a] = c;
}), e.ref.widthPrevious = null, e.ref.widthUpdated = Ri(() => {
e.ref.updateHistory = [], e.dispatch("DID_RESIZE_ROOT");
}, 250), e.ref.previousAspectRatio = null, e.ref.updateHistory = [];
const s = window.matchMedia("(pointer: fine) and (hover: hover)").matches, i = "PointerEvent" in window;
e.query("GET_ALLOW_REORDER") && i && !s && (e.element.addEventListener("touchmove", nn, { passive: !1 }), e.element.addEventListener("gesturestart", nn));
const o = e.query("GET_CREDITS");
if (o.length === 2) {
const a = document.createElement("a");
a.className = "filepond--credits", a.href = o[0], a.tabIndex = -1, a.target = "_blank", a.rel = "noopener noreferrer nofollow", a.textContent = o[1], e.element.appendChild(a), e.ref.credits = a;
}
}, lp = ({ root: e, props: t, actions: n }) => {
if (pp({ root: e, props: t, actions: n }), n.filter((w) => /^DID_SET_STYLE_/.test(w.type)).filter((w) => !Me(w.data.value)).map(({ type: w, data: A }) => {
const C = yi(w.substring(8).toLowerCase(), "_");
e.element.dataset[C] = A.value, e.invalidateLayout();
}), e.rect.element.hidden) return;
e.rect.element.width !== e.ref.widthPrevious && (e.ref.widthPrevious = e.rect.element.width, e.ref.widthUpdated());
let r = e.ref.bounds;
r || (r = e.ref.bounds = up(e), e.element.removeChild(e.ref.measure), e.ref.measure = null);
const { hopper: s, label: i, list: o, panel: l } = e.ref;
s && s.updateHopperState();
const a = e.query("GET_PANEL_ASPECT_RATIO"), c = e.query("GET_ALLOW_MULTIPLE"), d = e.query("GET_TOTAL_ITEMS"), u = c ? e.query("GET_MAX_FILES") || ip : 1, m = d === u, h = n.find((w) => w.type === "DID_ADD_ITEM");
if (m && h) {
const w = h.data.interactionMethod;
i.opacity = 0, c ? i.translateY = -40 : w === Se.API ? i.translateX = 40 : w === Se.BROWSE ? i.translateY = 40 : i.translateY = 30;
} else m || (i.opacity = 1, i.translateX = 0, i.translateY = 0);
const f = cp(e), p = dp(e), I = i.rect.element.height, g = !c || m ? 0 : I, E = m ? o.rect.element.marginTop : 0, T = d === 0 ? 0 : o.rect.element.marginBottom, v = g + E + p.visual + T, D = g + E + p.bounds + T;
if (o.translateY = Math.max(0, g - o.rect.element.marginTop) - f.top, a) {
const w = e.rect.element.width, A = w * a;
a !== e.ref.previousAspectRatio && (e.ref.previousAspectRatio = a, e.ref.updateHistory = []);
const C = e.ref.updateHistory;
C.push(w);
const L = 2;
if (C.length > L * 2) {
const M = C.length, G = M - 10;
let z = 0;
for (let O = M; O >= G; O--)
if (C[O] === C[O - 2] && z++, z >= L)
return;
}
l.scalable = !1, l.height = A;
const V = (
// the height of the panel minus the label height
A - g - // the room we leave open between the end of the list and the panel bottom
(T - f.bottom) - // if we're full we need to leave some room between the top of the panel and the list
(m ? E : 0)
);
p.visual > V ? o.overflow = V : o.overflow = null, e.height = A;
} else if (r.fixedHeight) {
l.scalable = !1;
const w = (
// the height of the panel minus the label height
r.fixedHeight - g - // the room we leave open between the end of the list and the panel bottom
(T - f.bottom) - // if we're full we need to leave some room between the top of the panel and the list
(m ? E : 0)
);
p.visual > w ? o.overflow = w : o.overflow = null;
} else if (r.cappedHeight) {
const w = v >= r.cappedHeight, A = Math.min(r.cappedHeight, v);
l.scalable = !0, l.height = w ? A : A - f.top - f.bottom;
const C = (
// the height of the panel minus the label height
A - g - // the room we leave open between the end of the list and the panel bottom
(T - f.bottom) - // if we're full we need to leave some room between the top of the panel and the list
(m ? E : 0)
);
v > r.cappedHeight && p.visual > C ? o.overflow = C : o.overflow = null, e.height = Math.min(
r.cappedHeight,
D - f.top - f.bottom
);
} else {
const w = d > 0 ? f.top + f.bottom : 0;
l.scalable = !0, l.height = Math.max(I, v - w), e.height = Math.max(I, D - w);
}
e.ref.credits && l.heightCurrent && (e.ref.credits.style.transform = `translateY(${l.heightCurrent}px)`);
}, cp = (e) => {
const t = e.ref.list.childViews[0].childViews[0];
return t ? {
top: t.rect.element.marginTop,
bottom: t.rect.element.marginBottom
} : {
top: 0,
bottom: 0
};
}, dp = (e) => {
let t = 0, n = 0;
const r = e.ref.list, s = r.childViews[0], i = s.childViews.filter((E) => E.rect.element.height), o = e.query("GET_ACTIVE_ITEMS").map((E) => i.find((T) => T.id === E.id)).filter((E) => E);
if (o.length === 0) return { visual: t, bounds: n };
const l = s.rect.element.width, a = wr(s, o, r.dragCoordinates), c = o[0].rect.element, d = c.marginTop + c.marginBottom, u = c.marginLeft + c.marginRight, m = c.width + u, h = c.height + d, f = typeof a < "u" && a >= 0 ? 1 : 0, p = o.find((E) => E.markedForRemoval && E.opacity < 0.45) ? -1 : 0, I = o.length + f + p, g = Dr(l, m);
return g === 1 ? o.forEach((E) => {
const T = E.rect.element.height + d;
n += T, t += T * E.opacity;
}) : (n = Math.ceil(I / g) * h, t = n), { visual: t, bounds: n };
}, up = (e) => {
const t = e.ref.measureHeight || null;
return {
cappedHeight: parseInt(e.style.maxHeight, 10) || null,
fixedHeight: t === 0 ? null : t
};
}, Lr = (e, t) => {
const n = e.query("GET_ALLOW_REPLACE"), r = e.query("GET_ALLOW_MULTIPLE"), s = e.query("GET_TOTAL_ITEMS");
let i = e.query("GET_MAX_FILES");
const o = t.length;
return !r && o > 1 ? (e.dispatch("DID_THROW_MAX_FILES", {
source: t,
error: re("warning", 0, "Max files")
}), !0) : (i = r ? i : 1, !r && n ? !1 : Tt(i) && s + o > i ? (e.dispatch("DID_THROW_MAX_FILES", {
source: t,
error: re("warning", 0, "Max files")
}), !0) : !1);
}, fp = (e, t, n) => {
const r = e.childViews[0];
return wr(r, t, {
left: n.scopeLeft - r.rect.element.left,
top: n.scopeTop - (e.rect.outer.top + e.rect.element.marginTop + e.rect.element.scrollTop)
});
}, Bs = (e) => {
const t = e.query("GET_ALLOW_DROP"), n = e.query("GET_DISABLED"), r = t && !n;
if (r && !e.ref.hopper) {
const s = Kf(
e.element,
(i) => {
const o = e.query("GET_BEFORE_DROP_FILE") || (() => !0);
return e.query("GET_DROP_VALIDATION") ? i.every(
(a) => ot("ALLOW_HOPPER_ITEM", a, {
query: e.query
}).every((c) => c === !0) && o(a)
) : !0;
},
{
filterItems: (i) => {
const o = e.query("GET_IGNORED_FILES");
return i.filter((l) => et(l) ? !o.includes(l.name.toLowerCase()) : !0);
},
catchesDropsOnPage: e.query("GET_DROP_ON_PAGE"),
requiresDropOnElement: e.query("GET_DROP_ON_ELEMENT")
}
);
s.onload = (i, o) => {
const a = e.ref.list.childViews[0].childViews.filter((d) => d.rect.element.height), c = e.query("GET_ACTIVE_ITEMS").map((d) => a.find((u) => u.id === d.id)).filter((d) => d);
De("ADD_ITEMS", i, { dispatch: e.dispatch }).then((d) => {
if (Lr(e, d)) return !1;
e.dispatch("ADD_ITEMS", {
items: d,
index: fp(e.ref.list, c, o),
interactionMethod: Se.DROP
});
}), e.dispatch("DID_DROP", { position: o }), e.dispatch("DID_END_DRAG", { position: o });
}, s.ondragstart = (i) => {
e.dispatch("DID_START_DRAG", { position: i });
}, s.ondrag = Ri((i) => {
e.dispatch("DID_DRAG", { position: i });
}), s.ondragend = (i) => {
e.dispatch("DID_END_DRAG", { position: i });
}, e.ref.hopper = s, e.ref.drip = e.appendChildView(e.createChildView(If));
} else !r && e.ref.hopper && (e.ref.hopper.destroy(), e.ref.hopper = null, e.removeChildView(e.ref.drip));
}, Us = (e, t) => {
const n = e.query("GET_ALLOW_BROWSE"), r = e.query("GET_DISABLED"), s = n && !r;
s && !e.ref.browser ? e.ref.browser = e.appendChildView(
e.createChildView(lf, {
...t,
onload: (i) => {
De("ADD_ITEMS", i, {
dispatch: e.dispatch
}).then((o) => {
if (Lr(e, o)) return !1;
e.dispatch("ADD_ITEMS", {
items: o,
index: -1,
interactionMethod: Se.BROWSE
});
});
}
}),
0
) : !s && e.ref.browser && (e.removeChildView(e.ref.browser), e.ref.browser = null);
}, ks = (e) => {
const t = e.query("GET_ALLOW_PASTE"), n = e.query("GET_DISABLED"), r = t && !n;
r && !e.ref.paster ? (e.ref.paster = Jf(), e.ref.paster.onload = (s) => {
De("ADD_ITEMS", s, { dispatch: e.dispatch }).then((i) => {
if (Lr(e, i)) return !1;
e.dispatch("ADD_ITEMS", {
items: i,
index: -1,
interactionMethod: Se.PASTE
});
});
}) : !r && e.ref.paster && (e.ref.paster.destroy(), e.ref.paster = null);
}, pp = Ee({
DID_SET_ALLOW_BROWSE: ({ root: e, props: t }) => {
Us(e, t);
},
DID_SET_ALLOW_DROP: ({ root: e }) => {
Bs(e);
},
DID_SET_ALLOW_PASTE: ({ root: e }) => {
ks(e);
},
DID_SET_DISABLED: ({ root: e, props: t }) => {
Bs(e), ks(e), Us(e, t), e.query("GET_DISABLED") ? e.element.dataset.disabled = "disabled" : e.element.removeAttribute("data-disabled");
}
}), mp = ae({
name: "root",
read: ({ root: e }) => {
e.ref.measure && (e.ref.measureHeight = e.ref.measure.offsetHeight);
},
create: ap,
write: lp,
destroy: ({ root: e }) => {
e.ref.paster && e.ref.paster.destroy(), e.ref.hopper && e.ref.hopper.destroy(), e.element.removeEventListener("touchmove", nn), e.element.removeEventListener("gesturestart", nn);
},
mixins: {
styles: ["height"]
}
}), hp = (e = {}) => {
let t = null;
const n = en(), r = Ac(
// initial state (should be serializable)
hd(n),
// queries
[Md, Id(n)],
// action handlers
[ou, gd(n)]
);
r.dispatch("SET_OPTIONS", { options: e });
const s = () => {
document.hidden || r.dispatch("KICK");
};
document.addEventListener("visibilitychange", s);
let i = null, o = !1, l = !1, a = null, c = null;
const d = () => {
o || (o = !0), clearTimeout(i), i = setTimeout(() => {
o = !1, a = null, c = null, l && (l = !1, r.dispatch("DID_STOP_RESIZE"));
}, 500);
};
window.addEventListener("resize", d);
const u = mp(r, { id: Rr() });
let m = !1, h = !1;
const f = {
// necessary for update loop
/**
* Reads from dom (never call manually)
* @private
*/
_read: () => {
o && (c = window.innerWidth, a || (a = c), !l && c !== a && (r.dispatch("DID_START_RESIZE"), l = !0)), h && m && (m = u.element.offsetParent === null), !m && (u._read(), h = u.rect.element.hidden);
},
/**
* Writes to dom (never call manually)
* @private
*/
_write: (R) => {
const b = r.processActionQueue().filter((N) => !/^SET_/.test(N.type));
m && !b.length || (E(b), m = u._write(R, b, l), yd(r.query("GET_ITEMS")), m && r.processDispatchQueue());
}
}, p = (R) => (b) => {
const N = {
type: R
};
if (!b)
return N;
if (b.hasOwnProperty("error") && (N.error = b.error ? { ...b.error } : null), b.status && (N.status = { ...b.status }), b.file && (N.output = b.file), b.source)
N.file = b.source;
else if (b.item || b.id) {
const P = b.item ? b.item : r.query("GET_ITEM", b.id);
N.file = P ? Ie(P) : null;
}
return b.items && (N.items = b.items.map(Ie)), /progress/.test(R) && (N.progress = b.progress), b.hasOwnProperty("origin") && b.hasOwnProperty("target") && (N.origin = b.origin, N.target = b.target), N;
}, I = {
DID_DESTROY: p("destroy"),
DID_INIT: p("init"),
DID_THROW_MAX_FILES: p("warning"),
DID_INIT_ITEM: p("initfile"),
DID_START_ITEM_LOAD: p("addfilestart"),
DID_UPDATE_ITEM_LOAD_PROGRESS: p("addfileprogress"),
DID_LOAD_ITEM: p("addfile"),
DID_THROW_ITEM_INVALID: [p("error"), p("addfile")],
DID_THROW_ITEM_LOAD_ERROR: [p("error"), p("addfile")],
DID_THROW_ITEM_REMOVE_ERROR: [p("error"), p("removefile")],
DID_PREPARE_OUTPUT: p("preparefile"),
DID_START_ITEM_PROCESSING: p("processfilestart"),
DID_UPDATE_ITEM_PROCESS_PROGRESS: p("processfileprogress"),
DID_ABORT_ITEM_PROCESSING: p("processfileabort"),
DID_COMPLETE_ITEM_PROCESSING: p("processfile"),
DID_COMPLETE_ITEM_PROCESSING_ALL: p("processfiles"),
DID_REVERT_ITEM_PROCESSING: p("processfilerevert"),
DID_THROW_ITEM_PROCESSING_ERROR: [p("error"), p("processfile")],
DID_REMOVE_ITEM: p("removefile"),
DID_UPDATE_ITEMS: p("updatefiles"),
DID_ACTIVATE_ITEM: p("activatefile"),
DID_REORDER_ITEMS: p("reorderfiles")
}, g = (R) => {
const b = { pond: U, ...R };
delete b.type, u.element.dispatchEvent(
new CustomEvent(`FilePond:${R.type}`, {
// event info
detail: b,
// event behaviour
bubbles: !0,
cancelable: !0,
composed: !0
// triggers listeners outside of shadow root
})
);
const N = [];
R.hasOwnProperty("error") && N.push(R.error), R.hasOwnProperty("file") && N.push(R.file);
const P = ["type", "error", "file"];
Object.keys(R).filter((F) => !P.includes(F)).forEach((F) => N.push(R[F])), U.fire(R.type, ...N);
const X = r.query(`GET_ON${R.type.toUpperCase()}`);
X && X(...N);
}, E = (R) => {
R.length && R.filter((b) => I[b.type]).forEach((b) => {
const N = I[b.type];
(Array.isArray(N) ? N : [N]).forEach((P) => {
b.type === "DID_INIT_ITEM" ? g(P(b.data)) : setTimeout(() => {
g(P(b.data));
}, 0);
});
});
}, T = (R) => r.dispatch("SET_OPTIONS", { options: R }), v = (R) => r.query("GET_ACTIVE_ITEM", R), D = (R) => new Promise((b, N) => {
r.dispatch("REQUEST_ITEM_PREPARE", {
query: R,
success: (P) => {
b(P);
},
failure: (P) => {
N(P);
}
});
}), w = (R, b = {}) => new Promise((N, P) => {
L([{ source: R, options: b }], { index: b.index }).then((X) => N(X && X[0])).catch(P);
}), A = (R) => R.file && R.id, C = (R, b) => (typeof R == "object" && !A(R) && !b && (b = R, R = void 0), r.dispatch("REMOVE_ITEM", { ...b, query: R }), r.query("GET_ACTIVE_ITEM", R) === null), L = (...R) => new Promise((b, N) => {
const P = [], X = {};
if (pn(R[0]))
P.push.apply(P, R[0]), Object.assign(X, R[1] || {});
else {
const F = R[R.length - 1];
typeof F == "object" && !(F instanceof Blob) && Object.assign(X, R.pop()), P.push(...R);
}
r.dispatch("ADD_ITEMS", {
items: P,
index: X.index,
interactionMethod: Se.API,
success: b,
failure: N
});
}), V = () => r.query("GET_ACTIVE_ITEMS"), M = (R) => new Promise((b, N) => {
r.dispatch("REQUEST_ITEM_PROCESSING", {
query: R,
success: (P) => {
b(P);
},
failure: (P) => {
N(P);
}
});
}), G = (...R) => {
const b = Array.isArray(R[0]) ? R[0] : R, N = b.length ? b : V();
return Promise.all(N.map(D));
}, z = (...R) => {
const b = Array.isArray(R[0]) ? R[0] : R;
if (!b.length) {
const N = V().filter(
(P) => !(P.status === k.IDLE && P.origin === de.LOCAL) && P.status !== k.PROCESSING && P.status !== k.PROCESSING_COMPLETE && P.status !== k.PROCESSING_REVERT_ERROR
);
return Promise.all(N.map(M));
}
return Promise.all(b.map(M));
}, O = (...R) => {
const b = Array.isArray(R[0]) ? R[0] : R;
let N;
typeof b[b.length - 1] == "object" ? N = b.pop() : Array.isArray(R[0]) && (N = R[1]);
const P = V();
return b.length ? b.map((F) => We(F) ? P[F] ? P[F].id : null : F).filter((F) => F).map((F) => C(F, N)) : Promise.all(P.map((F) => C(F, N)));
}, U = {
// supports events
...En(),
// inject private api methods
...f,
// inject all getters and setters
...Ed(r, n),
/**
* Override options defined in options object
* @param options
*/
setOptions: T,
/**
* Load the given file
* @param source - the source of the file (either a File, base64 data uri or url)
* @param options - object, { index: 0 }
*/
addFile: w,
/**
* Load the given files
* @param sources - the sources of the files to load
* @param options - object, { index: 0 }
*/
addFiles: L,
/**
* Returns the file objects matching the given query
* @param query { string, number, null }
*/
getFile: v,
/**
* Upload file with given name
* @param query { string, number, null }
*/
processFile: M,
/**
* Request prepare output for file with given name
* @param query { string, number, null }
*/
prepareFile: D,
/**
* Removes a file by its name
* @param query { string, number, null }
*/
removeFile: C,
/**
* Moves a file to a new location in the files list
*/
moveFile: (R, b) => r.dispatch("MOVE_ITEM", { query: R, index: b }),
/**
* Returns all files (wrapped in public api)
*/
getFiles: V,
/**
* Starts uploading all files
*/
processFiles: z,
/**
* Clears all files from the files list
*/
removeFiles: O,
/**
* Starts preparing output of all files
*/
prepareFiles: G,
/**
* Sort list of files
*/
sort: (R) => r.dispatch("SORT", { compare: R }),
/**
* Browse the file system for a file
*/
browse: () => {
var R = u.element.querySelector("input[type=file]");
R && R.click();
},
/**
* Destroys the app
*/
destroy: () => {
U.fire("destroy", u.element), r.dispatch("ABORT_ALL"), u._destroy(), window.removeEventListener("resize", d), document.removeEventListener("visibilitychange", s), r.dispatch("DID_DESTROY");
},
/**
* Inserts the plugin before the target element
*/
insertBefore: (R) => cs(u.element, R),
/**
* Inserts the plugin after the target element
*/
insertAfter: (R) => ds(u.element, R),
/**
* Appends the plugin to the target element
*/
appendTo: (R) => R.appendChild(u.element),
/**
* Replaces an element with the app
*/
replaceElement: (R) => {
cs(u.element, R), R.parentNode.removeChild(R), t = R;
},
/**
* Restores the original element
*/
restoreElement: () => {
t && (ds(t, u.element), u.element.parentNode.removeChild(u.element), t = null);
},
/**
* Returns true if the app root is attached to given element
* @param element
*/
isAttachedTo: (R) => u.element === R || t === R,
/**
* Returns the root element
*/
element: {
get: () => u.element
},
/**
* Returns the current pond status
*/
status: {
get: () => r.query("GET_STATUS")
}
};
return r.dispatch("DID_INIT"), Ue(U);
}, Si = (e = {}) => {
const t = {};
return te(en(), (r, s) => {
t[r] = s[0];
}), hp({
// default options
...t,
// custom options
...e
});
}, Ep = (e) => e.charAt(0).toLowerCase() + e.slice(1), gp = (e) => yi(e.replace(/^data-/, "")), vi = (e, t) => {
te(t, (n, r) => {
te(e, (s, i) => {
const o = new RegExp(n);
if (!o.test(s) || (delete e[s], r === !1))
return;
if (he(r)) {
e[r] = i;
return;
}
const a = r.group;
fe(r) && !e[a] && (e[a] = {}), e[a][Ep(s.replace(o, ""))] = i;
}), r.mapping && vi(e[r.group], r.mapping);
});
}, Ip = (e, t = {}) => {
const n = [];
te(e.attributes, (s) => {
n.push(e.attributes[s]);
});
const r = n.filter((s) => s.name).reduce((s, i) => {
const o = ce(e, i.name);
return s[gp(i.name)] = o === i.name ? !0 : o, s;
}, {});
return vi(r, t), r;
}, _p = (e, t = {}) => {
const n = {
// translate to other name
"^class$": "className",
"^multiple$": "allowMultiple",
"^capture$": "captureMethod",
"^webkitdirectory$": "allowDirectoriesOnly",
// group under single property
"^server": {
group: "server",
mapping: {
"^process": {
group: "process"
},
"^revert": {
group: "revert"
},
"^fetch": {
group: "fetch"
},
"^restore": {
group: "restore"
},
"^load": {
group: "load"
}
}
},
// don't include in object
"^type$": !1,
"^files$": !1
};
ot("SET_ATTRIBUTE_TO_OPTION_MAP", n);
const r = {
...t
}, s = Ip(
e.nodeName === "FIELDSET" ? e.querySelector("input[type=file]") : e,
n
);
Object.keys(s).forEach((o) => {
fe(s[o]) ? (fe(r[o]) || (r[o] = {}), Object.assign(r[o], s[o])) : r[o] = s[o];
}), r.files = (t.files || []).concat(
Array.from(e.querySelectorAll("input:not([type=file])")).map((o) => ({
source: o.value,
options: {
type: o.dataset.type
}
}))
);
const i = Si(r);
return e.files && Array.from(e.files).forEach((o) => {
i.addFile(o);
}), i.replaceElement(e), i;
}, Tp = (...e) => Cc(e[0]) ? _p(...e) : Si(...e), yp = ["fire", "_read", "_write"], Vs = (e) => {
const t = {};
return Yo(e, t, yp), t;
}, Rp = (e, t) => e.replace(/(?:{([a-zA-Z]+)})/g, (n, r) => t[r]), Sp = (e) => {
const t = new Blob(["(", e.toString(), ")()"], {
type: "application/javascript"
}), n = URL.createObjectURL(t), r = new Worker(n);
return {
transfer: (s, i) => {
},
post: (s, i, o) => {
const l = Rr();
r.onmessage = (a) => {
a.data.id === l && i(a.data.message);
}, r.postMessage(
{
id: l,
message: s
},
o
);
},
terminate: () => {
r.terminate(), URL.revokeObjectURL(n);
}
};
}, vp = (e) => new Promise((t, n) => {
const r = new Image();
r.onload = () => {
t(r);
}, r.onerror = (s) => {
n(s);
}, r.src = e;
}), bi = (e, t) => {
const n = e.slice(0, e.size, e.type);
return n.lastModifiedDate = e.lastModifiedDate, n.name = t, n;
}, bp = (e) => bi(e, e.name), $s = [], Op = (e) => {
if ($s.includes(e))
return;
$s.push(e);
const t = e({
addFilter: Sd,
utils: {
Type: S,
forin: te,
isString: he,
isFile: et,
toNaturalFileSize: si,
replaceInString: Rp,
getExtensionFromFilename: gn,
getFilenameWithoutExtension: ti,
guesstimateMimeType: hi,
getFileFromBlob: gt,
getFilenameFromURL: Pt,
createRoute: Ee,
createWorker: Sp,
createView: ae,
createItemAPI: Ie,
loadImage: vp,
copyFile: bp,
renameFile: bi,
createBlob: Zo,
applyFilterChain: De,
text: oe,
getNumericAspectRatioFromString: Xo
},
views: {
fileActionButton: ri
}
});
vd(t.options);
}, Dp = () => Object.prototype.toString.call(window.operamini) === "[object OperaMini]", wp = () => "Promise" in window, Cp = () => "slice" in Blob.prototype, Ap = () => "URL" in window && "createObjectURL" in window.URL, Pp = () => "visibilityState" in document, Np = () => "performance" in window, Lp = () => "supports" in (window.CSS || {}), Mp = () => /MSIE|Trident/.test(window.navigator.userAgent), or = (() => {
const e = (
// Has to be a browser
ko() && // Can't run on Opera Mini due to lack of everything
!Dp() && // Require these APIs to feature detect a modern browser
Pp() && wp() && Cp() && Ap() && Np() && // doesn't need CSSSupports but is a good way to detect Safari 9+ (we do want to support IE11 though)
(Lp() || Mp())
);
return () => e;
})(), Ge = {
// active app instances, used to redraw the apps and to find the later
apps: []
}, xp = "filepond", it = () => {
};
let js = {}, Xt = it, kn = it, Hs = it, qs = it, Ys = it, Ws = it, zs = it;
if (or()) {
td(
() => {
Ge.apps.forEach((n) => n._read());
},
(n) => {
Ge.apps.forEach((r) => r._write(n));
}
);
const e = () => {
document.dispatchEvent(
new CustomEvent("FilePond:loaded", {
detail: {
supported: or,
create: Xt,
destroy: kn,
parse: Hs,
find: qs,
registerPlugin: Ys,
setOptions: zs
}
})
), document.removeEventListener("DOMContentLoaded", e);
};
document.readyState !== "loading" ? setTimeout(() => e(), 0) : document.addEventListener("DOMContentLoaded", e);
const t = () => te(en(), (n, r) => {
js[n] = r[1];
});
js = {}, t(), Xt = (...n) => {
const r = Tp(...n);
return r.on("destroy", kn), Ge.apps.push(r), Vs(r);
}, kn = (n) => {
const r = Ge.apps.findIndex((s) => s.isAttachedTo(n));
return r >= 0 ? (Ge.apps.splice(r, 1)[0].restoreElement(), !0) : !1;
}, Hs = (n) => Array.from(n.querySelectorAll(`.${xp}`)).filter(
(i) => !Ge.apps.find((o) => o.isAttachedTo(i))
).map((i) => Xt(i)), qs = (n) => {
const r = Ge.apps.find((s) => s.isAttachedTo(n));
return r ? Vs(r) : null;
}, Ys = (...n) => {
n.forEach(Op), t();
}, Ws = () => {
const n = {};
return te(en(), (r, s) => {
n[r] = s[0];
}), n;
}, zs = (n) => (fe(n) && (Ge.apps.forEach((r) => {
r.setOptions(n);
}), bd(n)), Ws());
}
/*!
* react-filepond v7.1.3
* A handy FilePond adapter component for React
*
* Copyright (c) 2024 PQINA
* https://pqina.nl/filepond
*
* Licensed under the MIT license.
*/
const Gp = or(), Fp = [
"setOptions",
"on",
"off",
"onOnce",
"appendTo",
"insertAfter",
"insertBefore",
"isAttachedTo",
"replaceElement",
"restoreElement",
"destroy"
];
class Bp extends Q.Component {
constructor(t) {
super(t), this.allowFilesSync = !0;
}
// Will setup FilePond instance when mounted
componentDidMount() {
if (this._input = this._element.querySelector('input[type="file"]'), this._inputClone = this._input.cloneNode(), !Gp) return;
const t = Object.assign({}, this.props);
if (t.onupdatefiles) {
const n = t.onupdatefiles;
t.onupdatefiles = (r) => {
this.allowFilesSync = !1, n(r);
};
}
this._pond = Xt(this._input, t), Object.keys(this._pond).filter((n) => !Fp.includes(n)).forEach((n) => {
this[n] = this._pond[n];
});
}
// Will clean up FilePond instance when unmounted
componentWillUnmount() {
if (!this._pond) return;
const t = document.createElement("div");
t.append(this._pond.element), t.id = "foo", this._pond.destroy(), this._pond = void 0, this._element.append(this._inputClone);
}
shouldComponentUpdate() {
return this.allowFilesSync ? !0 : (this.allowFilesSync = !0, !1);
}
// Something changed
componentDidUpdate() {
if (!this._pond) return;
const t = Object.assign({}, this.props);
delete t.onupdatefiles, this._pond.setOptions(t);
}
// Renders basic element hook for FilePond to attach to
render() {
const {
id: t,
name: n,
className: r,
allowMultiple: s,
required: i,
captureMethod: o,
acceptedFileTypes: l
} = this.props;
return $n(
"div",
{
className: "filepond--wrapper",
ref: (a) => this._element = a
},
$n("input", {
type: "file",
name: n,
id: t,
accept: l,
multiple: s,
required: i,
className: r,
capture: o
})
);
}
}
const Up = Uo.div`
.filepond {
&--drop-label {
label {
color: ${({ $invalid: e }) => e ? "var(--color-item-primary-destructive)" : "inherit"} !important;
}
}
&--root {
margin-bottom: 0.5rem;
border-radius: 0.75rem;
}
&--panel {
border-radius: 0.8rem;
overflow: hidden;
&-root {
background-color: transparent;
}
}
&--drip {
border: 1px solid
${({ $invalid: e }) => e ? "var(--color-item-primary-destructive)" : "var(--color-border-alpha-strong)"};
background-color: transparent;
opacity: 1;
outline-offset: 2px;
border-radius: 0.75rem;
}
}
&:focus-within {
.filepond {
&--drip {
outline: 2px solid
${({ $invalid: e }) => e ? "var(--color-item-primary-destructive)" : "var(--color-item-primary-primary)"};
}
}
}
`;
function kp({
variant: e = "default",
containerClassName: t,
...n
}) {
return /* @__PURE__ */ y.jsx(
Up,
{
$invalid: e === "failure",
className: t,
children: /* @__PURE__ */ y.jsx(Bp, { credits: !1, instantUpload: !1, ...n })
}
);
}
kp.displayName = "FileUpload";
var Vp = "Label", Oi = _.forwardRef((e, t) => /* @__PURE__ */ y.jsx(
ee.label,
{
...e,
ref: t,
onMouseDown: (n) => {
var s;
n.target.closest("button, input, select, textarea") || ((s = e.onMouseDown) == null || s.call(e, n), !n.defaultPrevented && n.detail > 1 && n.preventDefault());
}
}
));
Oi.displayName = Vp;
var Di = Oi, $p = (e) => e.type === "checkbox", jp = (e) => e instanceof Date, wi = (e) => e == null;
const Hp = (e) => typeof e == "object";
var Nt = (e) => !wi(e) && !Array.isArray(e) && Hp(e) && !jp(e), qp = (e) => Nt(e) && e.target ? $p(e.target) ? e.target.checked : e.target.value : e, Yp = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Wp = (e, t) => e.has(Yp(t)), zp = (e) => {
const t = e.constructor && e.constructor.prototype;
return Nt(t) && t.hasOwnProperty("isPrototypeOf");
}, Xp = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
function Ci(e) {
let t;
const n = Array.isArray(e), r = typeof FileList < "u" ? e instanceof FileList : !1;
if (e instanceof Date)
t = new Date(e);
else if (!(Xp && (e instanceof Blob || r)) && (n || Nt(e)))
if (t = n ? [] : {}, !n && !zp(e))
t = e;
else
for (const s in e)
e.hasOwnProperty(s) && (t[s] = Ci(e[s]));
else
return e;
return t;
}
var Ai = (e) => /^\w*$/.test(e), ir = (e) => e === void 0, Kp = (e) => Array.isArray(e) ? e.filter(Boolean) : [], Pi = (e) => Kp(e.replace(/["|']|\]/g, "").split(/\.|\[/)), ge = (e, t, n) => {
if (!t || !Nt(e))
return n;
const r = (Ai(t) ? [t] : Pi(t)).reduce((s, i) => wi(s) ? s : s[i], e);
return ir(r) || r === e ? ir(e[t]) ? n : e[t] : r;
}, Vn = (e) => typeof e == "boolean", Xs = (e, t, n) => {
let r = -1;
const s = Ai(t) ? [t] : Pi(t), i = s.length, o = i - 1;
for (; ++r < i; ) {
const l = s[r];
let a = n;
if (r !== o) {
const c = e[l];
a = Nt(c) || Array.isArray(c) ? c : isNaN(+s[r + 1]) ? {} : [];
}
if (l === "__proto__" || l === "constructor" || l === "prototype")
return;
e[l] = a, e = e[l];
}
};
const Ks = {
BLUR: "blur",
CHANGE: "change"
}, Qs = {
all: "all"
}, Mr = Q.createContext(null);
Mr.displayName = "HookFormContext";
const Tn = () => Q.useContext(Mr), Qp = (e) => {
const { children: t, ...n } = e;
return Q.createElement(Mr.Provider, { value: n }, t);
};
var Zp = (e, t, n, r = !0) => {
const s = {
defaultValues: t._defaultValues
};
for (const i in e)
Object.defineProperty(s, i, {
get: () => {
const o = i;
return t._proxyFormState[o] !== Qs.all && (t._proxyFormState[o] = !r || Qs.all), n && (n[o] = !0), e[o];
}
});
return s;
};
const Ni = typeof window < "u" ? _.useLayoutEffect : _.useEffect;
function Jp(e) {
const t = Tn(), { control: n = t.control, disabled: r, name: s, exact: i } = e || {}, [o, l] = Q.useState(n._formState), a = Q.useRef({
isDirty: !1,
isLoading: !1,
dirtyFields: !1,
touchedFields: !1,
validatingFields: !1,
isValidating: !1,
isValid: !1,
errors: !1
});
return Ni(() => n._subscribe({
name: s,
formState: a.current,
exact: i,
callback: (c) => {
!r && l({
...n._formState,
...c
});
}
}), [s, r, i]), Q.useEffect(() => {
a.current.isValid && n._setValid(!0);
}, [n]), Q.useMemo(() => Zp(o, n, a.current, !1), [o, n]);
}
var em = (e) => typeof e == "string", tm = (e, t, n, r, s) => em(e) ? ge(n, e, s) : Array.isArray(e) ? e.map((i) => ge(n, i)) : n;
function nm(e) {
const t = Tn(), { control: n = t.control, name: r, defaultValue: s, disabled: i, exact: o } = e || {}, l = Q.useRef(s), [a, c] = Q.useState(n._getWatch(r, l.current));
return Ni(() => n._subscribe({
name: r,
formState: {
values: !0
},
exact: o,
callback: (d) => !i && c(tm(r, n._names, d.values || n._formValues, !1, l.current))
}), [r, n, i, o]), Q.useEffect(() => n._removeUnmounted()), a;
}
function rm(e) {
const t = Tn(), { name: n, disabled: r, control: s = t.control, shouldUnregister: i } = e, o = Wp(s._names.array, n), l = nm({
control: s,
name: n,
defaultValue: ge(s._formValues, n, ge(s._defaultValues, n, e.defaultValue)),
exact: !0
}), a = Jp({
control: s,
name: n,
exact: !0
}), c = Q.useRef(e), d = Q.useRef(s.register(n, {
...e.rules,
value: l,
...Vn(e.disabled) ? { disabled: e.disabled } : {}
})), u = Q.useMemo(() => Object.defineProperties({}, {
invalid: {
enumerable: !0,
get: () => !!ge(a.errors, n)
},
isDirty: {
enumerable: !0,
get: () => !!ge(a.dirtyFields, n)
},
isTouched: {
enumerable: !0,
get: () => !!ge(a.touchedFields, n)
},
isValidating: {
enumerable: !0,
get: () => !!ge(a.validatingFields, n)
},
error: {
enumerable: !0,
get: () => ge(a.errors, n)
}
}), [a, n]), m = Q.useCallback((I) => d.current.onChange({
target: {
value: qp(I),
name: n
},
type: Ks.CHANGE
}), [n]), h = Q.useCallback(() => d.current.onBlur({
target: {
value: ge(s._formValues, n),
name: n
},
type: Ks.BLUR
}), [n, s._formValues]), f = Q.useCallback((I) => {
const g = ge(s._fields, n);
g && I && (g._f.ref = {
focus: () => I.focus && I.focus(),
select: () => I.select && I.select(),
setCustomValidity: (E) => I.setCustomValidity(E),
reportValidity: () => I.reportValidity()
});
}, [s._fields, n]), p = Q.useMemo(() => ({
name: n,
value: l,
...Vn(r) || a.disabled ? { disabled: a.disabled || r } : {},
onChange: m,
onBlur: h,
ref: f
}), [n, r, a.disabled, m, h, f, l]);
return Q.useEffect(() => {
const I = s._options.shouldUnregister || i;
s.register(n, {
...c.current.rules,
...Vn(c.current.disabled) ? { disabled: c.current.disabled } : {}
});
const g = (E, T) => {
const v = ge(s._fields, E);
v && v._f && (v._f.mount = T);
};
if (g(n, !0), I) {
const E = Ci(ge(s._options.defaultValues, n));
Xs(s._defaultValues, n, E), ir(ge(s._formValues, n)) && Xs(s._formValues, n, E);
}
return !o && s.register(n), () => {
(o ? I && !s._state.action : I) ? s.unregister(n) : g(n, !1);
};
}, [n, s, o, i]), Q.useEffect(() => {
s._setDisabledField({
disabled: r,
name: n
});
}, [r, n, s]), Q.useMemo(() => ({
field: p,
formState: a,
fieldState: u
}), [p, a, u]);
}
const sm = (e) => e.render(rm(e)), om = eo(
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
), Li = _.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ y.jsx(
Di,
{
ref: n,
className: se(om(), e),
...t
}
));
Li.displayName = Di.displayName;
const Ph = Qp, Mi = _.createContext(
{}
), Nh = ({
...e
}) => /* @__PURE__ */ y.jsx(Mi.Provider, { value: { name: e.name }, children: /* @__PURE__ */ y.jsx(sm, { ...e }) }), yn = () => {
const e = _.useContext(Mi), t = _.useContext(xi), { getFieldState: n, formState: r } = Tn(), s = n(e.name, r);
if (!e)
throw new Error("useFormField should be used within <FormField>");
const { id: i } = t;
return {
id: i,
name: e.name,
formItemId: `${i}-form-item`,
formDescriptionId: `${i}-form-item-description`,
formMessageId: `${i}-form-item-message`,
...s
};
}, xi = _.createContext(
{}
), im = _.forwardRef(({ className: e, ...t }, n) => {
const r = _.useId();
return /* @__PURE__ */ y.jsx(xi.Provider, { value: { id: r }, children: /* @__PURE__ */ y.jsx(
"div",
{
ref: n,
className: se("relative space-y-2", e),
...t
}
) });
});
im.displayName = "FormItem";
const am = _.forwardRef(({ className: e, ...t }, n) => {
const { error: r, formItemId: s } = yn();
return /* @__PURE__ */ y.jsx(
Li,
{
ref: n,
className: se(
"!text-body-xs-medium",
e,
r && "text-destructive"
),
htmlFor: s,
...t
}
);
});
am.displayName = "FormLabel";
const lm = _.forwardRef(({ ...e }, t) => {
const { error: n, formItemId: r, formDescriptionId: s, formMessageId: i } = yn();
return /* @__PURE__ */ y.jsx(
ja,
{
ref: t,
id: r,
"aria-describedby": n ? `${s} ${i}` : `${s}`,
"aria-invalid": !!n,
...e
}
);
});
lm.displayName = "FormControl";
const cm = _.forwardRef(({ className: e, ...t }, n) => {
const { formDescriptionId: r } = yn();
return /* @__PURE__ */ y.jsx(
"p",
{
ref: n,
id: r,
className: se("text-muted-foreground text-sm", e),
...t
}
);
});
cm.displayName = "FormDescription";
const dm = _.forwardRef(({ className: e, children: t, ...n }, r) => {
const { error: s, formMessageId: i } = yn(), o = s ? String(s == null ? void 0 : s.message) : t;
return o ? /* @__PURE__ */ y.jsx(
"p",
{
ref: r,
id: i,
className: se("!text-body-xs-medium text-destructive", e),
...n,
children: o
}
) : null;
});
dm.displayName = "FormMessage";
var Rn = "Switch", [um, Lh] = At(Rn), [fm, pm] = um(Rn), Gi = _.forwardRef(
(e, t) => {
const {
__scopeSwitch: n,
name: r,
checked: s,
defaultChecked: i,
required: o,
disabled: l,
value: a = "on",
onCheckedChange: c,
form: d,
...u
} = e, [m, h] = _.useState(null), f = pe(t, (T) => h(T)), p = _.useRef(!1), I = m ? d || !!m.closest("form") : !0, [g, E] = Ct({
prop: s,
defaultProp: i ?? !1,
onChange: c,
caller: Rn
});
return /* @__PURE__ */ y.jsxs(fm, { scope: n, checked: g, disabled: l, children: [
/* @__PURE__ */ y.jsx(
ee.button,
{
type: "button",
role: "switch",
"aria-checked": g,
"aria-required": o,
"data-state": ki(g),
"data-disabled": l ? "" : void 0,
disabled: l,
value: a,
...u,
ref: f,
onClick: J(e.onClick, (T) => {
E((v) => !v), I && (p.current = T.isPropagationStopped(), p.current || T.stopPropagation());
})
}
),
I && /* @__PURE__ */ y.jsx(
Ui,
{
control: m,
bubbles: !p.current,
name: r,
value: a,
checked: g,
required: o,
disabled: l,
form: d,
style: { transform: "translateX(-100%)" }
}
)
] });
}
);
Gi.displayName = Rn;
var Fi = "SwitchThumb", Bi = _.forwardRef(
(e, t) => {
const { __scopeSwitch: n, ...r } = e, s = pm(Fi, n);
return /* @__PURE__ */ y.jsx(
ee.span,
{
"data-state": ki(s.checked),
"data-disabled": s.disabled ? "" : void 0,
...r,
ref: t
}
);
}
);
Bi.displayName = Fi;
var mm = "SwitchBubbleInput", Ui = _.forwardRef(
({
__scopeSwitch: e,
control: t,
checked: n,
bubbles: r = !0,
...s
}, i) => {
const o = _.useRef(null), l = pe(o, i), a = sn(n), c = pr(t);
return _.useEffect(() => {
const d = o.current;
if (!d) return;
const u = window.HTMLInputElement.prototype, h = Object.getOwnPropertyDescriptor(
u,
"checked"
).set;
if (a !== n && h) {
const f = new Event("click", { bubbles: r });
h.call(d, n), d.dispatchEvent(f);
}
}, [a, n, r]), /* @__PURE__ */ y.jsx(
"input",
{
type: "checkbox",
"aria-hidden": !0,
defaultChecked: n,
...s,
tabIndex: -1,
ref: l,
style: {
...s.style,
...c,
position: "absolute",
pointerEvents: "none",
opacity: 0,
margin: 0
}
}
);
}
);
Ui.displayName = mm;
function ki(e) {
return e ? "checked" : "unchecked";
}
var Vi = Gi, hm = Bi;
const Em = _.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ y.jsx(
Vi,
{
className: se(
"peer focus-visible:ring-ring focus-visible:ring-offset-background data-[state=checked]:bg-item-primary data-[state=unchecked]:bg-input inline-flex h-4 w-7 shrink-0 cursor-pointer items-center rounded-full border border-transparent transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-40",
e
),
...t,
ref: n,
children: /* @__PURE__ */ y.jsx(
hm,
{
className: se(
"bg-background pointer-events-none block size-3.5 rounded-full shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-3 data-[state=unchecked]:translate-x-0"
)
}
)
}
));
Em.displayName = Vi.displayName;
const gm = _.forwardRef(
({ className: e, variant: t, ...n }, r) => /* @__PURE__ */ y.jsx(
"textarea",
{
className: se(
"min-h-20 px-3 py-2",
mo({ variant: t }),
e
),
ref: r,
...n
}
)
);
gm.displayName = "Textarea";
var Im = [" ", "Enter", "ArrowUp", "ArrowDown"], _m = [" ", "Enter"], rt = "Select", [Sn, vn, Tm] = el(rt), [yt, Mh] = At(rt, [
Tm,
Js
]), bn = Js(), [ym, Ve] = yt(rt), [Rm, Sm] = yt(rt), $i = (e) => {
const {
__scopeSelect: t,
children: n,
open: r,
defaultOpen: s,
onOpenChange: i,
value: o,
defaultValue: l,
onValueChange: a,
dir: c,
name: d,
autoComplete: u,
disabled: m,
required: h,
form: f
} = e, p = bn(t), [I, g] = _.useState(null), [E, T] = _.useState(null), [v, D] = _.useState(!1), w = ro(c), [A, C] = Ct({
prop: r,
defaultProp: s ?? !1,
onChange: i,
caller: rt
}), [L, V] = Ct({
prop: o,
defaultProp: l,
onChange: a,
caller: rt
}), M = _.useRef(null), G = I ? f || !!I.closest("form") : !0, [z, O] = _.useState(/* @__PURE__ */ new Set()), U = Array.from(z).map((R) => R.props.value).join(";");
return /* @__PURE__ */ y.jsx(qa, { ...p, children: /* @__PURE__ */ y.jsxs(
ym,
{
required: h,
scope: t,
trigger: I,
onTriggerChange: g,
valueNode: E,
onValueNodeChange: T,
valueNodeHasChildren: v,
onValueNodeHasChildrenChange: D,
contentId: fr(),
value: L,
onValueChange: V,
open: A,
onOpenChange: C,
dir: w,
triggerPointerDownPosRef: M,
disabled: m,
children: [
/* @__PURE__ */ y.jsx(Sn.Provider, { scope: t, children: /* @__PURE__ */ y.jsx(
Rm,
{
scope: e.__scopeSelect,
onNativeOptionAdd: _.useCallback((R) => {
O((b) => new Set(b).add(R));
}, []),
onNativeOptionRemove: _.useCallback((R) => {
O((b) => {
const N = new Set(b);
return N.delete(R), N;
});
}, []),
children: n
}
) }),
G ? /* @__PURE__ */ y.jsxs(
pa,
{
"aria-hidden": !0,
required: h,
tabIndex: -1,
name: d,
autoComplete: u,
value: L,
onChange: (R) => V(R.target.value),
disabled: m,
form: f,
children: [
L === void 0 ? /* @__PURE__ */ y.jsx("option", { value: "" }) : null,
Array.from(z)
]
},
U
) : null
]
}
) });
};
$i.displayName = rt;
var ji = "SelectTrigger", Hi = _.forwardRef(
(e, t) => {
const { __scopeSelect: n, disabled: r = !1, ...s } = e, i = bn(n), o = Ve(ji, n), l = o.disabled || r, a = pe(t, o.onTriggerChange), c = vn(n), d = _.useRef("touch"), [u, m, h] = ha((p) => {
const I = c().filter((T) => !T.disabled), g = I.find((T) => T.value === o.value), E = Ea(I, p, g);
E !== void 0 && o.onValueChange(E.value);
}), f = (p) => {
l || (o.onOpenChange(!0), h()), p && (o.triggerPointerDownPosRef.current = {
x: Math.round(p.pageX),
y: Math.round(p.pageY)
});
};
return /* @__PURE__ */ y.jsx(Ya, { asChild: !0, ...i, children: /* @__PURE__ */ y.jsx(
ee.button,
{
type: "button",
role: "combobox",
"aria-controls": o.contentId,
"aria-expanded": o.open,
"aria-required": o.required,
"aria-autocomplete": "none",
dir: o.dir,
"data-state": o.open ? "open" : "closed",
disabled: l,
"data-disabled": l ? "" : void 0,
"data-placeholder": ma(o.value) ? "" : void 0,
...s,
ref: a,
onClick: J(s.onClick, (p) => {
p.currentTarget.focus(), d.current !== "mouse" && f(p);
}),
onPointerDown: J(s.onPointerDown, (p) => {
d.current = p.pointerType;
const I = p.target;
I.hasPointerCapture(p.pointerId) && I.releasePointerCapture(p.pointerId), p.button === 0 && p.ctrlKey === !1 && p.pointerType === "mouse" && (f(p), p.preventDefault());
}),
onKeyDown: J(s.onKeyDown, (p) => {
const I = u.current !== "";
!(p.ctrlKey || p.altKey || p.metaKey) && p.key.length === 1 && m(p.key), !(I && p.key === " ") && Im.includes(p.key) && (f(), p.preventDefault());
})
}
) });
}
);
Hi.displayName = ji;
var qi = "SelectValue", Yi = _.forwardRef(
(e, t) => {
const { __scopeSelect: n, className: r, style: s, children: i, placeholder: o = "", ...l } = e, a = Ve(qi, n), { onValueNodeHasChildrenChange: c } = a, d = i !== void 0, u = pe(t, a.onValueNodeChange);
return ke(() => {
c(d);
}, [c, d]), /* @__PURE__ */ y.jsx(
ee.span,
{
...l,
ref: u,
style: { pointerEvents: "none" },
children: ma(a.value) ? /* @__PURE__ */ y.jsx(y.Fragment, { children: o }) : i
}
);
}
);
Yi.displayName = qi;
var vm = "SelectIcon", Wi = _.forwardRef(
(e, t) => {
const { __scopeSelect: n, children: r, ...s } = e;
return /* @__PURE__ */ y.jsx(ee.span, { "aria-hidden": !0, ...s, ref: t, children: r || "▼" });
}
);
Wi.displayName = vm;
var bm = "SelectPortal", zi = (e) => /* @__PURE__ */ y.jsx(sl, { asChild: !0, ...e });
zi.displayName = bm;
var st = "SelectContent", Xi = _.forwardRef(
(e, t) => {
const n = Ve(st, e.__scopeSelect), [r, s] = _.useState();
if (ke(() => {
s(new DocumentFragment());
}, []), !n.open) {
const i = r;
return i ? to.createPortal(
/* @__PURE__ */ y.jsx(Ki, { scope: e.__scopeSelect, children: /* @__PURE__ */ y.jsx(Sn.Slot, { scope: e.__scopeSelect, children: /* @__PURE__ */ y.jsx("div", { children: e.children }) }) }),
i
) : null;
}
return /* @__PURE__ */ y.jsx(Qi, { ...e, ref: t });
}
);
Xi.displayName = st;
var Oe = 10, [Ki, $e] = yt(st), Om = "SelectContentImpl", Dm = Ha("SelectContent.RemoveScroll"), Qi = _.forwardRef(
(e, t) => {
const {
__scopeSelect: n,
position: r = "item-aligned",
onCloseAutoFocus: s,
onEscapeKeyDown: i,
onPointerDownOutside: o,
//
// PopperContent props
side: l,
sideOffset: a,
align: c,
alignOffset: d,
arrowPadding: u,
collisionBoundary: m,
collisionPadding: h,
sticky: f,
hideWhenDetached: p,
avoidCollisions: I,
//
...g
} = e, E = Ve(st, n), [T, v] = _.useState(null), [D, w] = _.useState(null), A = pe(t, (x) => v(x)), [C, L] = _.useState(null), [V, M] = _.useState(
null
), G = vn(n), [z, O] = _.useState(!1), U = _.useRef(!1);
_.useEffect(() => {
if (T) return ol(T);
}, [T]), il();
const R = _.useCallback(
(x) => {
const [H, ...K] = G().map((Y) => Y.ref.current), [$] = K.slice(-1), q = document.activeElement;
for (const Y of x)
if (Y === q || (Y == null || Y.scrollIntoView({ block: "nearest" }), Y === H && D && (D.scrollTop = 0), Y === $ && D && (D.scrollTop = D.scrollHeight), Y == null || Y.focus(), document.activeElement !== q)) return;
},
[G, D]
), b = _.useCallback(
() => R([C, T]),
[R, C, T]
);
_.useEffect(() => {
z && b();
}, [z, b]);
const { onOpenChange: N, triggerPointerDownPosRef: P } = E;
_.useEffect(() => {
if (T) {
let x = { x: 0, y: 0 };
const H = ($) => {
var q, Y;
x = {
x: Math.abs(Math.round($.pageX) - (((q = P.current) == null ? void 0 : q.x) ?? 0)),
y: Math.abs(Math.round($.pageY) - (((Y = P.current) == null ? void 0 : Y.y) ?? 0))
};
}, K = ($) => {
x.x <= 10 && x.y <= 10 ? $.preventDefault() : T.contains($.target) || N(!1), document.removeEventListener("pointermove", H), P.current = null;
};
return P.current !== null && (document.addEventListener("pointermove", H), document.addEventListener("pointerup", K, { capture: !0, once: !0 })), () => {
document.removeEventListener("pointermove", H), document.removeEventListener("pointerup", K, { capture: !0 });
};
}
}, [T, N, P]), _.useEffect(() => {
const x = () => N(!1);
return window.addEventListener("blur", x), window.addEventListener("resize", x), () => {
window.removeEventListener("blur", x), window.removeEventListener("resize", x);
};
}, [N]);
const [X, F] = ha((x) => {
const H = G().filter((q) => !q.disabled), K = H.find((q) => q.ref.current === document.activeElement), $ = Ea(H, x, K);
$ && setTimeout(() => $.ref.current.focus());
}), ne = _.useCallback(
(x, H, K) => {
const $ = !U.current && !K;
(E.value !== void 0 && E.value === H || $) && (L(x), $ && (U.current = !0));
},
[E.value]
), Pe = _.useCallback(() => T == null ? void 0 : T.focus(), [T]), le = _.useCallback(
(x, H, K) => {
const $ = !U.current && !K;
(E.value !== void 0 && E.value === H || $) && M(x);
},
[E.value]
), be = r === "popper" ? ar : Zi, B = be === ar ? {
side: l,
sideOffset: a,
align: c,
alignOffset: d,
arrowPadding: u,
collisionBoundary: m,
collisionPadding: h,
sticky: f,
hideWhenDetached: p,
avoidCollisions: I
} : {};
return /* @__PURE__ */ y.jsx(
Ki,
{
scope: n,
content: T,
viewport: D,
onViewportChange: w,
itemRefCallback: ne,
selectedItem: C,
onItemLeave: Pe,
itemTextRefCallback: le,
focusSelectedItem: b,
selectedItemText: V,
position: r,
isPositioned: z,
searchRef: X,
children: /* @__PURE__ */ y.jsx(al, { as: Dm, allowPinchZoom: !0, children: /* @__PURE__ */ y.jsx(
ll,
{
asChild: !0,
trapped: E.open,
onMountAutoFocus: (x) => {
x.preventDefault();
},
onUnmountAutoFocus: J(s, (x) => {
var H;
(H = E.trigger) == null || H.focus({ preventScroll: !0 }), x.preventDefault();
}),
children: /* @__PURE__ */ y.jsx(
rl,
{
asChild: !0,
disableOutsidePointerEvents: !0,
onEscapeKeyDown: i,
onPointerDownOutside: o,
onFocusOutside: (x) => x.preventDefault(),
onDismiss: () => E.onOpenChange(!1),
children: /* @__PURE__ */ y.jsx(
be,
{
role: "listbox",
id: E.contentId,
"data-state": E.open ? "open" : "closed",
dir: E.dir,
onContextMenu: (x) => x.preventDefault(),
...g,
...B,
onPlaced: () => O(!0),
ref: A,
style: {
// flex layout so we can place the scroll buttons properly
display: "flex",
flexDirection: "column",
// reset the outline by default as the content MAY get focused
outline: "none",
...g.style
},
onKeyDown: J(g.onKeyDown, (x) => {
const H = x.ctrlKey || x.altKey || x.metaKey;
if (x.key === "Tab" && x.preventDefault(), !H && x.key.length === 1 && F(x.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(x.key)) {
let $ = G().filter((q) => !q.disabled).map((q) => q.ref.current);
if (["ArrowUp", "End"].includes(x.key) && ($ = $.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(x.key)) {
const q = x.target, Y = $.indexOf(q);
$ = $.slice(Y + 1);
}
setTimeout(() => R($)), x.preventDefault();
}
})
}
)
}
)
}
) })
}
);
}
);
Qi.displayName = Om;
var wm = "SelectItemAlignedPosition", Zi = _.forwardRef((e, t) => {
const { __scopeSelect: n, onPlaced: r, ...s } = e, i = Ve(st, n), o = $e(st, n), [l, a] = _.useState(null), [c, d] = _.useState(null), u = pe(t, (A) => d(A)), m = vn(n), h = _.useRef(!1), f = _.useRef(!0), { viewport: p, selectedItem: I, selectedItemText: g, focusSelectedItem: E } = o, T = _.useCallback(() => {
if (i.trigger && i.valueNode && l && c && p && I && g) {
const A = i.trigger.getBoundingClientRect(), C = c.getBoundingClientRect(), L = i.valueNode.getBoundingClientRect(), V = g.getBoundingClientRect();
if (i.dir !== "rtl") {
const q = V.left - C.left, Y = L.left - q, je = A.left - Y, He = A.width + je, Dn = Math.max(He, C.width), wn = window.innerWidth - Oe, Cn = Ur(Y, [
Oe,
// Prevents the content from going off the starting edge of the
// viewport. It may still go off the ending edge, but this can be
// controlled by the user since they may want to manage overflow in a
// specific way.
// https://github.com/radix-ui/primitives/issues/2049
Math.max(Oe, wn - Dn)
]);
l.style.minWidth = He + "px", l.style.left = Cn + "px";
} else {
const q = C.right - V.right, Y = window.innerWidth - L.right - q, je = window.innerWidth - A.right - Y, He = A.width + je, Dn = Math.max(He, C.width), wn = window.innerWidth - Oe, Cn = Ur(Y, [
Oe,
Math.max(Oe, wn - Dn)
]);
l.style.minWidth = He + "px", l.style.right = Cn + "px";
}
const M = m(), G = window.innerHeight - Oe * 2, z = p.scrollHeight, O = window.getComputedStyle(c), U = parseInt(O.borderTopWidth, 10), R = parseInt(O.paddingTop, 10), b = parseInt(O.borderBottomWidth, 10), N = parseInt(O.paddingBottom, 10), P = U + R + z + N + b, X = Math.min(I.offsetHeight * 5, P), F = window.getComputedStyle(p), ne = parseInt(F.paddingTop, 10), Pe = parseInt(F.paddingBottom, 10), le = A.top + A.height / 2 - Oe, be = G - le, B = I.offsetHeight / 2, x = I.offsetTop + B, H = U + R + x, K = P - H;
if (H <= le) {
const q = M.length > 0 && I === M[M.length - 1].ref.current;
l.style.bottom = "0px";
const Y = c.clientHeight - p.offsetTop - p.offsetHeight, je = Math.max(
be,
B + // viewport might have padding bottom, include it to avoid a scrollable viewport
(q ? Pe : 0) + Y + b
), He = H + je;
l.style.height = He + "px";
} else {
const q = M.length > 0 && I === M[0].ref.current;
l.style.top = "0px";
const je = Math.max(
le,
U + p.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
(q ? ne : 0) + B
) + K;
l.style.height = je + "px", p.scrollTop = H - le + p.offsetTop;
}
l.style.margin = `${Oe}px 0`, l.style.minHeight = X + "px", l.style.maxHeight = G + "px", r == null || r(), requestAnimationFrame(() => h.current = !0);
}
}, [
m,
i.trigger,
i.valueNode,
l,
c,
p,
I,
g,
i.dir,
r
]);
ke(() => T(), [T]);
const [v, D] = _.useState();
ke(() => {
c && D(window.getComputedStyle(c).zIndex);
}, [c]);
const w = _.useCallback(
(A) => {
A && f.current === !0 && (T(), E == null || E(), f.current = !1);
},
[T, E]
);
return /* @__PURE__ */ y.jsx(
Am,
{
scope: n,
contentWrapper: l,
shouldExpandOnScrollRef: h,
onScrollButtonChange: w,
children: /* @__PURE__ */ y.jsx(
"div",
{
ref: a,
style: {
display: "flex",
flexDirection: "column",
position: "fixed",
zIndex: v
},
children: /* @__PURE__ */ y.jsx(
ee.div,
{
...s,
ref: u,
style: {
// When we get the height of the content, it includes borders. If we were to set
// the height without having `boxSizing: 'border-box'` it would be too big.
boxSizing: "border-box",
// We need to ensure the content doesn't get taller than the wrapper
maxHeight: "100%",
...s.style
}
}
)
}
)
}
);
});
Zi.displayName = wm;
var Cm = "SelectPopperPosition", ar = _.forwardRef((e, t) => {
const {
__scopeSelect: n,
align: r = "start",
collisionPadding: s = Oe,
...i
} = e, o = bn(n);
return /* @__PURE__ */ y.jsx(
Wa,
{
...o,
...i,
ref: t,
align: r,
collisionPadding: s,
style: {
// Ensure border-box for floating-ui calculations
boxSizing: "border-box",
...i.style,
"--radix-select-content-transform-origin": "var(--radix-popper-transform-origin)",
"--radix-select-content-available-width": "var(--radix-popper-available-width)",
"--radix-select-content-available-height": "var(--radix-popper-available-height)",
"--radix-select-trigger-width": "var(--radix-popper-anchor-width)",
"--radix-select-trigger-height": "var(--radix-popper-anchor-height)"
}
}
);
});
ar.displayName = Cm;
var [Am, xr] = yt(st, {}), lr = "SelectViewport", Ji = _.forwardRef(
(e, t) => {
const { __scopeSelect: n, nonce: r, ...s } = e, i = $e(lr, n), o = xr(lr, n), l = pe(t, i.onViewportChange), a = _.useRef(0);
return /* @__PURE__ */ y.jsxs(y.Fragment, { children: [
/* @__PURE__ */ y.jsx(
"style",
{
dangerouslySetInnerHTML: {
__html: "[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"
},
nonce: r
}
),
/* @__PURE__ */ y.jsx(Sn.Slot, { scope: n, children: /* @__PURE__ */ y.jsx(
ee.div,
{
"data-radix-select-viewport": "",
role: "presentation",
...s,
ref: l,
style: {
// we use position: 'relative' here on the `viewport` so that when we call
// `selectedItem.offsetTop` in calculations, the offset is relative to the viewport
// (independent of the scrollUpButton).
position: "relative",
flex: 1,
// Viewport should only be scrollable in the vertical direction.
// This won't work in vertical writing modes, so we'll need to
// revisit this if/when that is supported
// https://developer.chrome.com/blog/vertical-form-controls
overflow: "hidden auto",
...s.style
},
onScroll: J(s.onScroll, (c) => {
const d = c.currentTarget, { contentWrapper: u, shouldExpandOnScrollRef: m } = o;
if (m != null && m.current && u) {
const h = Math.abs(a.current - d.scrollTop);
if (h > 0) {
const f = window.innerHeight - Oe * 2, p = parseFloat(u.style.minHeight), I = parseFloat(u.style.height), g = Math.max(p, I);
if (g < f) {
const E = g + h, T = Math.min(f, E), v = E - T;
u.style.height = T + "px", u.style.bottom === "0px" && (d.scrollTop = v > 0 ? v : 0, u.style.justifyContent = "flex-end");
}
}
}
a.current = d.scrollTop;
})
}
) })
] });
}
);
Ji.displayName = lr;
var ea = "SelectGroup", [Pm, Nm] = yt(ea), ta = _.forwardRef(
(e, t) => {
const { __scopeSelect: n, ...r } = e, s = fr();
return /* @__PURE__ */ y.jsx(Pm, { scope: n, id: s, children: /* @__PURE__ */ y.jsx(ee.div, { role: "group", "aria-labelledby": s, ...r, ref: t }) });
}
);
ta.displayName = ea;
var na = "SelectLabel", ra = _.forwardRef(
(e, t) => {
const { __scopeSelect: n, ...r } = e, s = Nm(na, n);
return /* @__PURE__ */ y.jsx(ee.div, { id: s.id, ...r, ref: t });
}
);
ra.displayName = na;
var rn = "SelectItem", [Lm, sa] = yt(rn), oa = _.forwardRef(
(e, t) => {
const {
__scopeSelect: n,
value: r,
disabled: s = !1,
textValue: i,
...o
} = e, l = Ve(rn, n), a = $e(rn, n), c = l.value === r, [d, u] = _.useState(i ?? ""), [m, h] = _.useState(!1), f = pe(
t,
(E) => {
var T;
return (T = a.itemRefCallback) == null ? void 0 : T.call(a, E, r, s);
}
), p = fr(), I = _.useRef("touch"), g = () => {
s || (l.onValueChange(r), l.onOpenChange(!1));
};
if (r === "")
throw new Error(
"A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder."
);
return /* @__PURE__ */ y.jsx(
Lm,
{
scope: n,
value: r,
disabled: s,
textId: p,
isSelected: c,
onItemTextChange: _.useCallback((E) => {
u((T) => T || ((E == null ? void 0 : E.textContent) ?? "").trim());
}, []),
children: /* @__PURE__ */ y.jsx(
Sn.ItemSlot,
{
scope: n,
value: r,
disabled: s,
textValue: d,
children: /* @__PURE__ */ y.jsx(
ee.div,
{
role: "option",
"aria-labelledby": p,
"data-highlighted": m ? "" : void 0,
"aria-selected": c && m,
"data-state": c ? "checked" : "unchecked",
"aria-disabled": s || void 0,
"data-disabled": s ? "" : void 0,
tabIndex: s ? void 0 : -1,
...o,
ref: f,
onFocus: J(o.onFocus, () => h(!0)),
onBlur: J(o.onBlur, () => h(!1)),
onClick: J(o.onClick, () => {
I.current !== "mouse" && g();
}),
onPointerUp: J(o.onPointerUp, () => {
I.current === "mouse" && g();
}),
onPointerDown: J(o.onPointerDown, (E) => {
I.current = E.pointerType;
}),
onPointerMove: J(o.onPointerMove, (E) => {
var T;
I.current = E.pointerType, s ? (T = a.onItemLeave) == null || T.call(a) : I.current === "mouse" && E.currentTarget.focus({ preventScroll: !0 });
}),
onPointerLeave: J(o.onPointerLeave, (E) => {
var T;
E.currentTarget === document.activeElement && ((T = a.onItemLeave) == null || T.call(a));
}),
onKeyDown: J(o.onKeyDown, (E) => {
var v;
((v = a.searchRef) == null ? void 0 : v.current) !== "" && E.key === " " || (_m.includes(E.key) && g(), E.key === " " && E.preventDefault());
})
}
)
}
)
}
);
}
);
oa.displayName = rn;
var Ot = "SelectItemText", ia = _.forwardRef(
(e, t) => {
const { __scopeSelect: n, className: r, style: s, ...i } = e, o = Ve(Ot, n), l = $e(Ot, n), a = sa(Ot, n), c = Sm(Ot, n), [d, u] = _.useState(null), m = pe(
t,
(g) => u(g),
a.onItemTextChange,
(g) => {
var E;
return (E = l.itemTextRefCallback) == null ? void 0 : E.call(l, g, a.value, a.disabled);
}
), h = d == null ? void 0 : d.textContent, f = _.useMemo(
() => /* @__PURE__ */ y.jsx("option", { value: a.value, disabled: a.disabled, children: h }, a.value),
[a.disabled, a.value, h]
), { onNativeOptionAdd: p, onNativeOptionRemove: I } = c;
return ke(() => (p(f), () => I(f)), [p, I, f]), /* @__PURE__ */ y.jsxs(y.Fragment, { children: [
/* @__PURE__ */ y.jsx(ee.span, { id: a.textId, ...i, ref: m }),
a.isSelected && o.valueNode && !o.valueNodeHasChildren ? to.createPortal(i.children, o.valueNode) : null
] });
}
);
ia.displayName = Ot;
var aa = "SelectItemIndicator", la = _.forwardRef(
(e, t) => {
const { __scopeSelect: n, ...r } = e;
return sa(aa, n).isSelected ? /* @__PURE__ */ y.jsx(ee.span, { "aria-hidden": !0, ...r, ref: t }) : null;
}
);
la.displayName = aa;
var cr = "SelectScrollUpButton", ca = _.forwardRef((e, t) => {
const n = $e(cr, e.__scopeSelect), r = xr(cr, e.__scopeSelect), [s, i] = _.useState(!1), o = pe(t, r.onScrollButtonChange);
return ke(() => {
if (n.viewport && n.isPositioned) {
let l = function() {
const c = a.scrollTop > 0;
i(c);
};
const a = n.viewport;
return l(), a.addEventListener("scroll", l), () => a.removeEventListener("scroll", l);
}
}, [n.viewport, n.isPositioned]), s ? /* @__PURE__ */ y.jsx(
ua,
{
...e,
ref: o,
onAutoScroll: () => {
const { viewport: l, selectedItem: a } = n;
l && a && (l.scrollTop = l.scrollTop - a.offsetHeight);
}
}
) : null;
});
ca.displayName = cr;
var dr = "SelectScrollDownButton", da = _.forwardRef((e, t) => {
const n = $e(dr, e.__scopeSelect), r = xr(dr, e.__scopeSelect), [s, i] = _.useState(!1), o = pe(t, r.onScrollButtonChange);
return ke(() => {
if (n.viewport && n.isPositioned) {
let l = function() {
const c = a.scrollHeight - a.clientHeight, d = Math.ceil(a.scrollTop) < c;
i(d);
};
const a = n.viewport;
return l(), a.addEventListener("scroll", l), () => a.removeEventListener("scroll", l);
}
}, [n.viewport, n.isPositioned]), s ? /* @__PURE__ */ y.jsx(
ua,
{
...e,
ref: o,
onAutoScroll: () => {
const { viewport: l, selectedItem: a } = n;
l && a && (l.scrollTop = l.scrollTop + a.offsetHeight);
}
}
) : null;
});
da.displayName = dr;
var ua = _.forwardRef((e, t) => {
const { __scopeSelect: n, onAutoScroll: r, ...s } = e, i = $e("SelectScrollButton", n), o = _.useRef(null), l = vn(n), a = _.useCallback(() => {
o.current !== null && (window.clearInterval(o.current), o.current = null);
}, []);
return _.useEffect(() => () => a(), [a]), ke(() => {
var d;
const c = l().find((u) => u.ref.current === document.activeElement);
(d = c == null ? void 0 : c.ref.current) == null || d.scrollIntoView({ block: "nearest" });
}, [l]), /* @__PURE__ */ y.jsx(
ee.div,
{
"aria-hidden": !0,
...s,
ref: t,
style: { flexShrink: 0, ...s.style },
onPointerDown: J(s.onPointerDown, () => {
o.current === null && (o.current = window.setInterval(r, 50));
}),
onPointerMove: J(s.onPointerMove, () => {
var c;
(c = i.onItemLeave) == null || c.call(i), o.current === null && (o.current = window.setInterval(r, 50));
}),
onPointerLeave: J(s.onPointerLeave, () => {
a();
})
}
);
}), Mm = "SelectSeparator", fa = _.forwardRef(
(e, t) => {
const { __scopeSelect: n, ...r } = e;
return /* @__PURE__ */ y.jsx(ee.div, { "aria-hidden": !0, ...r, ref: t });
}
);
fa.displayName = Mm;
var ur = "SelectArrow", xm = _.forwardRef(
(e, t) => {
const { __scopeSelect: n, ...r } = e, s = bn(n), i = Ve(ur, n), o = $e(ur, n);
return i.open && o.position === "popper" ? /* @__PURE__ */ y.jsx(za, { ...s, ...r, ref: t }) : null;
}
);
xm.displayName = ur;
var Gm = "SelectBubbleInput", pa = _.forwardRef(
({ __scopeSelect: e, value: t, ...n }, r) => {
const s = _.useRef(null), i = pe(r, s), o = sn(t);
return _.useEffect(() => {
const l = s.current;
if (!l) return;
const a = window.HTMLSelectElement.prototype, d = Object.getOwnPropertyDescriptor(
a,
"value"
).set;
if (o !== t && d) {
const u = new Event("change", { bubbles: !0 });
d.call(l, t), l.dispatchEvent(u);
}
}, [o, t]), /* @__PURE__ */ y.jsx(
ee.select,
{
...n,
style: { ...dl, ...n.style },
ref: i,
defaultValue: t
}
);
}
);
pa.displayName = Gm;
function ma(e) {
return e === "" || e === void 0;
}
function ha(e) {
const t = cl(e), n = _.useRef(""), r = _.useRef(0), s = _.useCallback(
(o) => {
const l = n.current + o;
t(l), function a(c) {
n.current = c, window.clearTimeout(r.current), c !== "" && (r.current = window.setTimeout(() => a(""), 1e3));
}(l);
},
[t]
), i = _.useCallback(() => {
n.current = "", window.clearTimeout(r.current);
}, []);
return _.useEffect(() => () => window.clearTimeout(r.current), []), [n, s, i];
}
function Ea(e, t, n) {
const s = t.length > 1 && Array.from(t).every((c) => c === t[0]) ? t[0] : t, i = n ? e.indexOf(n) : -1;
let o = Fm(e, Math.max(i, 0));
s.length === 1 && (o = o.filter((c) => c !== n));
const a = o.find(
(c) => c.textValue.toLowerCase().startsWith(s.toLowerCase())
);
return a !== n ? a : void 0;
}
function Fm(e, t) {
return e.map((n, r) => e[(t + r) % e.length]);
}
var Bm = $i, ga = Hi, Um = Yi, km = Wi, Vm = zi, Ia = Xi, $m = Ji, jm = ta, _a = ra, Ta = oa, Hm = ia, qm = la, ya = ca, Ra = da, Sa = fa;
const xh = Bm, Gh = jm, Fh = Um, Ym = _.forwardRef(({ className: e, children: t, variant: n = "default", ...r }, s) => /* @__PURE__ */ y.jsxs(
ga,
{
ref: s,
className: se(
"border-border ring-offset-background placeholder:text-muted-foreground focus:ring-offset-none focus:ring-primary flex h-10 w-full items-center justify-between rounded-md border bg-white px-3 py-2 text-sm focus:ring-2 focus:ring-offset-transparent focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:bg-transparent [&>span]:line-clamp-1",
n === "failure" && "focus:ring-destructive hover:bg-destructive/20 bg-destructive/20 border-destructive !text-destructive",
e
),
...r,
children: [
t,
/* @__PURE__ */ y.jsx(km, { asChild: !0, children: /* @__PURE__ */ y.jsx(oo, { className: "h-4 w-4 opacity-50" }) })
]
}
));
Ym.displayName = ga.displayName;
const va = _.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ y.jsx(
ya,
{
ref: n,
className: se(
"flex cursor-default items-center justify-center py-1",
e
),
...t,
children: /* @__PURE__ */ y.jsx(hl, { className: "h-4 w-4" })
}
));
va.displayName = ya.displayName;
const ba = _.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ y.jsx(
Ra,
{
ref: n,
className: se(
"flex cursor-default items-center justify-center py-1",
e
),
...t,
children: /* @__PURE__ */ y.jsx(oo, { className: "h-4 w-4" })
}
));
ba.displayName = Ra.displayName;
const Wm = _.forwardRef(({ className: e, children: t, position: n = "popper", ...r }, s) => /* @__PURE__ */ y.jsx(Vm, { children: /* @__PURE__ */ y.jsxs(
Ia,
{
ref: s,
className: se(
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border shadow-md",
n === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
e
),
position: n,
...r,
children: [
/* @__PURE__ */ y.jsx(va, {}),
/* @__PURE__ */ y.jsx(
$m,
{
className: se(
"p-1",
n === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
),
children: t
}
),
/* @__PURE__ */ y.jsx(ba, {})
]
}
) }));
Wm.displayName = Ia.displayName;
const zm = _.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ y.jsx(
_a,
{
ref: n,
className: se("py-1.5 pr-2 pl-8 text-sm font-semibold", e),
...t
}
));
zm.displayName = _a.displayName;
const Xm = _.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__ */ y.jsxs(
Ta,
{
ref: r,
className: se(
"focus:bg-accent focus:text-accent-foreground relative flex w-full cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
e
),
...n,
children: [
/* @__PURE__ */ y.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ y.jsx(qm, { children: /* @__PURE__ */ y.jsx(ul, { className: "h-4 w-4" }) }) }),
/* @__PURE__ */ y.jsx(Hm, { children: t })
]
}
));
Xm.displayName = Ta.displayName;
const Km = _.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ y.jsx(
Sa,
{
ref: n,
className: se("bg-muted -mx-1 my-1 h-px", e),
...t
}
));
Km.displayName = Sa.displayName;
var Gr = "Radio", [Qm, Oa] = At(Gr), [Zm, Jm] = Qm(Gr), Da = _.forwardRef(
(e, t) => {
const {
__scopeRadio: n,
name: r,
checked: s = !1,
required: i,
disabled: o,
value: l = "on",
onCheck: a,
form: c,
...d
} = e, [u, m] = _.useState(null), h = pe(t, (I) => m(I)), f = _.useRef(!1), p = u ? c || !!u.closest("form") : !0;
return /* @__PURE__ */ y.jsxs(Zm, { scope: n, checked: s, disabled: o, children: [
/* @__PURE__ */ y.jsx(
ee.button,
{
type: "button",
role: "radio",
"aria-checked": s,
"data-state": Pa(s),
"data-disabled": o ? "" : void 0,
disabled: o,
value: l,
...d,
ref: h,
onClick: J(e.onClick, (I) => {
s || a == null || a(), p && (f.current = I.isPropagationStopped(), f.current || I.stopPropagation());
})
}
),
p && /* @__PURE__ */ y.jsx(
Aa,
{
control: u,
bubbles: !f.current,
name: r,
value: l,
checked: s,
required: i,
disabled: o,
form: c,
style: { transform: "translateX(-100%)" }
}
)
] });
}
);
Da.displayName = Gr;
var wa = "RadioIndicator", Ca = _.forwardRef(
(e, t) => {
const { __scopeRadio: n, forceMount: r, ...s } = e, i = Jm(wa, n);
return /* @__PURE__ */ y.jsx(Zs, { present: r || i.checked, children: /* @__PURE__ */ y.jsx(
ee.span,
{
"data-state": Pa(i.checked),
"data-disabled": i.disabled ? "" : void 0,
...s,
ref: t
}
) });
}
);
Ca.displayName = wa;
var eh = "RadioBubbleInput", Aa = _.forwardRef(
({
__scopeRadio: e,
control: t,
checked: n,
bubbles: r = !0,
...s
}, i) => {
const o = _.useRef(null), l = pe(o, i), a = sn(n), c = pr(t);
return _.useEffect(() => {
const d = o.current;
if (!d) return;
const u = window.HTMLInputElement.prototype, h = Object.getOwnPropertyDescriptor(
u,
"checked"
).set;
if (a !== n && h) {
const f = new Event("click", { bubbles: r });
h.call(d, n), d.dispatchEvent(f);
}
}, [a, n, r]), /* @__PURE__ */ y.jsx(
ee.input,
{
type: "radio",
"aria-hidden": !0,
defaultChecked: n,
...s,
tabIndex: -1,
ref: l,
style: {
...s.style,
...c,
position: "absolute",
pointerEvents: "none",
opacity: 0,
margin: 0
}
}
);
}
);
Aa.displayName = eh;
function Pa(e) {
return e ? "checked" : "unchecked";
}
var th = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], On = "RadioGroup", [nh, Bh] = At(On, [
no,
Oa
]), Na = no(), La = Oa(), [rh, sh] = nh(On), Ma = _.forwardRef(
(e, t) => {
const {
__scopeRadioGroup: n,
name: r,
defaultValue: s,
value: i,
required: o = !1,
disabled: l = !1,
orientation: a,
dir: c,
loop: d = !0,
onValueChange: u,
...m
} = e, h = Na(n), f = ro(c), [p, I] = Ct({
prop: i,
defaultProp: s ?? null,
onChange: u,
caller: On
});
return /* @__PURE__ */ y.jsx(
rh,
{
scope: n,
name: r,
required: o,
disabled: l,
value: p,
onValueChange: I,
children: /* @__PURE__ */ y.jsx(
tl,
{
asChild: !0,
...h,
orientation: a,
dir: f,
loop: d,
children: /* @__PURE__ */ y.jsx(
ee.div,
{
role: "radiogroup",
"aria-required": o,
"aria-orientation": a,
"data-disabled": l ? "" : void 0,
dir: f,
...m,
ref: t
}
)
}
)
}
);
}
);
Ma.displayName = On;
var xa = "RadioGroupItem", Ga = _.forwardRef(
(e, t) => {
const { __scopeRadioGroup: n, disabled: r, ...s } = e, i = sh(xa, n), o = i.disabled || r, l = Na(n), a = La(n), c = _.useRef(null), d = pe(t, c), u = i.value === s.value, m = _.useRef(!1);
return _.useEffect(() => {
const h = (p) => {
th.includes(p.key) && (m.current = !0);
}, f = () => m.current = !1;
return document.addEventListener("keydown", h), document.addEventListener("keyup", f), () => {
document.removeEventListener("keydown", h), document.removeEventListener("keyup", f);
};
}, []), /* @__PURE__ */ y.jsx(
nl,
{
asChild: !0,
...l,
focusable: !o,
active: u,
children: /* @__PURE__ */ y.jsx(
Da,
{
disabled: o,
required: i.required,
checked: u,
...a,
...s,
name: i.name,
ref: d,
onCheck: () => i.onValueChange(s.value),
onKeyDown: J((h) => {
h.key === "Enter" && h.preventDefault();
}),
onFocus: J(s.onFocus, () => {
var h;
m.current && ((h = c.current) == null || h.click());
})
}
)
}
);
}
);
Ga.displayName = xa;
var oh = "RadioGroupIndicator", Fa = _.forwardRef(
(e, t) => {
const { __scopeRadioGroup: n, ...r } = e, s = La(n);
return /* @__PURE__ */ y.jsx(Ca, { ...s, ...r, ref: t });
}
);
Fa.displayName = oh;
var Ba = Ma, Ua = Ga, ih = Fa;
const ah = _.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ y.jsx(
Ba,
{
className: se("grid gap-2", e),
...t,
ref: n
}
));
ah.displayName = Ba.displayName;
const lh = _.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ y.jsx(
Ua,
{
ref: n,
className: se(
"border-primary text-primary ring-offset-background focus-visible:ring-ring aspect-square h-4 w-4 rounded-full border focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
e
),
...t,
children: /* @__PURE__ */ y.jsx(ih, { className: "flex items-center justify-center", children: /* @__PURE__ */ y.jsx(fl, { className: "h-2.5 w-2.5 fill-current text-current" }) })
}
));
lh.displayName = Ua.displayName;
export {
Tl as C,
kp as F,
yl as I,
Li as L,
ah as R,
Em as S,
gm as T,
Ph as a,
im as b,
am as c,
lm as d,
cm as e,
dm as f,
Nh as g,
xh as h,
mo as i,
Gh as j,
Fh as k,
Ym as l,
Wm as m,
zm as n,
Xm as o,
Km as p,
va as q,
ba as r,
lh as s,
yn as u
};