1729 lines
56 KiB
JavaScript
1729 lines
56 KiB
JavaScript
/*
|
|
* Extracted from browser-delivered Turbopack chunk: e5665fbfc4a03fa5.7b861e1710.js
|
|
* Module id: 711694
|
|
* For reading/searching only; this factory depends on the original Turbopack runtime.
|
|
*/
|
|
|
|
const moduleFactory = (e) => {
|
|
"use strict";
|
|
var t,
|
|
r,
|
|
n,
|
|
a,
|
|
l,
|
|
o = e.i(462214),
|
|
i = e.i(358379),
|
|
s = e.i(844567),
|
|
u = e.i(7284);
|
|
function c(e, t) {
|
|
var r = {};
|
|
for (var n in e)
|
|
Object.prototype.hasOwnProperty.call(e, n) &&
|
|
0 > t.indexOf(n) &&
|
|
(r[n] = e[n]);
|
|
if (null != e && "function" == typeof Object.getOwnPropertySymbols)
|
|
for (var a = 0, n = Object.getOwnPropertySymbols(e); a < n.length; a++)
|
|
0 > t.indexOf(n[a]) &&
|
|
Object.prototype.propertyIsEnumerable.call(e, n[a]) &&
|
|
(r[n[a]] = e[n[a]]);
|
|
return r;
|
|
}
|
|
function d() {}
|
|
function f(e) {
|
|
return !!(e || "").match(/\d/);
|
|
}
|
|
function m(e) {
|
|
return null == e;
|
|
}
|
|
function p(e) {
|
|
return (
|
|
m(e) ||
|
|
("number" == typeof e && isNaN(e)) ||
|
|
("number" == typeof e && !isFinite(e))
|
|
);
|
|
}
|
|
function g(e) {
|
|
return e.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
|
|
}
|
|
function v(e, t) {
|
|
void 0 === t && (t = !0);
|
|
var r = "-" === e[0],
|
|
n = r && t,
|
|
a = (e = e.replace("-", "")).split(".");
|
|
return {
|
|
beforeDecimal: a[0],
|
|
afterDecimal: a[1] || "",
|
|
hasNegation: r,
|
|
addNegation: n,
|
|
};
|
|
}
|
|
function h(e, t, r) {
|
|
for (var n = "", a = r ? "0" : "", l = 0; l <= t - 1; l++) n += e[l] || a;
|
|
return n;
|
|
}
|
|
function x(e, t) {
|
|
return Array(t + 1).join(e);
|
|
}
|
|
function b(e) {
|
|
var t = e + "",
|
|
r = "-" === t[0] ? "-" : "";
|
|
r && (t = t.substring(1));
|
|
var n = t.split(/[eE]/g),
|
|
a = n[0],
|
|
l = n[1];
|
|
if (!(l = Number(l))) return r + a;
|
|
a = a.replace(".", "");
|
|
var o = 1 + l,
|
|
i = a.length;
|
|
return (
|
|
o < 0
|
|
? (a = "0." + x("0", Math.abs(o)) + a)
|
|
: o >= i
|
|
? (a += x("0", o - i))
|
|
: (a = (a.substring(0, o) || "0") + "." + a.substring(o)),
|
|
r + a
|
|
);
|
|
}
|
|
function y(e, t, r) {
|
|
if (-1 !== ["", "-"].indexOf(e)) return e;
|
|
var n = (-1 !== e.indexOf(".") || r) && t,
|
|
a = v(e),
|
|
l = a.beforeDecimal,
|
|
o = a.afterDecimal,
|
|
i = a.hasNegation,
|
|
s = parseFloat("0." + (o || "0")),
|
|
u = (o.length <= t ? "0." + o : s.toFixed(t)).split("."),
|
|
c = l;
|
|
return (
|
|
l &&
|
|
Number(u[0]) &&
|
|
(c = l
|
|
.split("")
|
|
.reverse()
|
|
.reduce(function (e, t, r) {
|
|
return e.length > r
|
|
? (Number(e[0]) + Number(t)).toString() +
|
|
e.substring(1, e.length)
|
|
: t + e;
|
|
}, u[0])),
|
|
(i ? "-" : "") + c + (n ? "." : "") + h(u[1] || "", t, r)
|
|
);
|
|
}
|
|
function j(e, t) {
|
|
if (((e.value = e.value), null !== e)) {
|
|
if (e.createTextRange) {
|
|
var r = e.createTextRange();
|
|
return r.move("character", t), r.select(), !0;
|
|
}
|
|
return e.selectionStart || 0 === e.selectionStart
|
|
? (e.focus(), e.setSelectionRange(t, t), !0)
|
|
: (e.focus(), !1);
|
|
}
|
|
}
|
|
((t = l || (l = {})).event = "event"), (t.props = "prop");
|
|
var w =
|
|
((r = function (e, t) {
|
|
for (
|
|
var r = 0, n = 0, a = e.length, l = t.length;
|
|
e[r] === t[r] && r < a;
|
|
|
|
)
|
|
r++;
|
|
for (; e[a - 1 - n] === t[l - 1 - n] && l - n > r && a - n > r; ) n++;
|
|
return {
|
|
from: { start: r, end: a - n },
|
|
to: { start: r, end: l - n },
|
|
};
|
|
}),
|
|
(a = void 0),
|
|
function () {
|
|
for (var e = [], t = arguments.length; t--; ) e[t] = arguments[t];
|
|
return n &&
|
|
e.length === n.length &&
|
|
e.every(function (e, t) {
|
|
return e === n[t];
|
|
})
|
|
? a
|
|
: ((n = e), (a = r.apply(void 0, e)));
|
|
}),
|
|
N = function (e, t) {
|
|
var r = Math.min(e.selectionStart, t);
|
|
return {
|
|
from: { start: r, end: e.selectionEnd },
|
|
to: { start: r, end: t },
|
|
};
|
|
};
|
|
function C(e) {
|
|
return Math.max(e.selectionStart, e.selectionEnd);
|
|
}
|
|
function S(e) {
|
|
var t = e.currentValue,
|
|
r = e.formattedValue,
|
|
n = e.currentValueIndex,
|
|
a = e.formattedValueIndex;
|
|
return t[n] === r[a];
|
|
}
|
|
function D(e, t, r, n) {
|
|
var a = e.length;
|
|
if (((t = Math.min(Math.max(t, 0), a)), "left" === n)) {
|
|
for (; t >= 0 && !r[t]; ) t--;
|
|
-1 === t && (t = r.indexOf(!0));
|
|
} else {
|
|
for (; t <= a && !r[t]; ) t++;
|
|
t > a && (t = r.lastIndexOf(!0));
|
|
}
|
|
return -1 === t && (t = a), t;
|
|
}
|
|
function k(e) {
|
|
for (
|
|
var t = Array.from({ length: e.length + 1 }).map(function () {
|
|
return !0;
|
|
}),
|
|
r = 0,
|
|
n = t.length;
|
|
r < n;
|
|
r++
|
|
)
|
|
t[r] = !!(f(e[r]) || f(e[r - 1]));
|
|
return t;
|
|
}
|
|
function V(e, t, r, n, a, l) {
|
|
void 0 === l && (l = d);
|
|
var o,
|
|
s,
|
|
u =
|
|
((o = function (e, t) {
|
|
var r, l;
|
|
return (
|
|
p(e)
|
|
? ((l = ""), (r = ""))
|
|
: (r =
|
|
"number" == typeof e || t
|
|
? n((l = "number" == typeof e ? b(e) : e))
|
|
: n((l = a(e, void 0)))),
|
|
{ formattedValue: r, numAsString: l }
|
|
);
|
|
}),
|
|
((s = (0, i.useRef)(o)).current = o),
|
|
(0, i.useRef)(function () {
|
|
for (var e = [], t = arguments.length; t--; ) e[t] = arguments[t];
|
|
return s.current.apply(s, e);
|
|
}).current),
|
|
c = (0, i.useState)(function () {
|
|
return u(m(e) ? t : e, r);
|
|
}),
|
|
f = c[0],
|
|
g = c[1],
|
|
v = e,
|
|
h = r;
|
|
m(e) && ((v = f.numAsString), (h = !0));
|
|
var x = u(v, h);
|
|
return (
|
|
(0, i.useMemo)(
|
|
function () {
|
|
g(x);
|
|
},
|
|
[x.formattedValue],
|
|
),
|
|
[
|
|
f,
|
|
function (e, t) {
|
|
e.formattedValue !== f.formattedValue &&
|
|
g({ formattedValue: e.formattedValue, numAsString: e.value }),
|
|
l(e, t);
|
|
},
|
|
]
|
|
);
|
|
}
|
|
function I(e) {
|
|
return e.replace(/[^0-9]/g, "");
|
|
}
|
|
function E(e) {
|
|
return e;
|
|
}
|
|
function M(e) {
|
|
var t = e.type;
|
|
void 0 === t && (t = "text");
|
|
var r = e.displayType;
|
|
void 0 === r && (r = "input");
|
|
var n = e.customInput,
|
|
a = e.renderText,
|
|
o = e.getInputRef,
|
|
s = e.format;
|
|
void 0 === s && (s = E);
|
|
var u = e.removeFormatting;
|
|
void 0 === u && (u = I);
|
|
var m = e.defaultValue,
|
|
p = e.valueIsNumericString,
|
|
g = e.onValueChange,
|
|
v = e.isAllowed,
|
|
h = e.onChange;
|
|
void 0 === h && (h = d);
|
|
var x = e.onKeyDown;
|
|
void 0 === x && (x = d);
|
|
var b = e.onMouseUp;
|
|
void 0 === b && (b = d);
|
|
var y = e.onFocus;
|
|
void 0 === y && (y = d);
|
|
var M = e.onBlur;
|
|
void 0 === M && (M = d);
|
|
var _ = e.value,
|
|
T = e.getCaretBoundary;
|
|
void 0 === T && (T = k);
|
|
var R = e.isValidInputCharacter;
|
|
void 0 === R && (R = f);
|
|
var A = e.isCharacterSame,
|
|
z = c(e, [
|
|
"type",
|
|
"displayType",
|
|
"customInput",
|
|
"renderText",
|
|
"getInputRef",
|
|
"format",
|
|
"removeFormatting",
|
|
"defaultValue",
|
|
"valueIsNumericString",
|
|
"onValueChange",
|
|
"isAllowed",
|
|
"onChange",
|
|
"onKeyDown",
|
|
"onMouseUp",
|
|
"onFocus",
|
|
"onBlur",
|
|
"value",
|
|
"getCaretBoundary",
|
|
"isValidInputCharacter",
|
|
"isCharacterSame",
|
|
]),
|
|
P = V(_, m, !!p, s, u, g),
|
|
O = P[0],
|
|
B = O.formattedValue,
|
|
F = O.numAsString,
|
|
L = P[1],
|
|
U = (0, i.useRef)(),
|
|
K = (0, i.useRef)({ formattedValue: B, numAsString: F }),
|
|
$ = function (e, t) {
|
|
(K.current = {
|
|
formattedValue: e.formattedValue,
|
|
numAsString: e.value,
|
|
}),
|
|
L(e, t);
|
|
},
|
|
H = (0, i.useState)(!1),
|
|
W = H[0],
|
|
G = H[1],
|
|
Z = (0, i.useRef)(null),
|
|
X = (0, i.useRef)({ setCaretTimeout: null, focusTimeout: null });
|
|
(0, i.useEffect)(function () {
|
|
return (
|
|
G(!0),
|
|
function () {
|
|
clearTimeout(X.current.setCaretTimeout),
|
|
clearTimeout(X.current.focusTimeout);
|
|
}
|
|
);
|
|
}, []);
|
|
var Y = s,
|
|
q = function (e, t) {
|
|
var r = parseFloat(t);
|
|
return {
|
|
formattedValue: e,
|
|
value: t,
|
|
floatValue: isNaN(r) ? void 0 : r,
|
|
};
|
|
},
|
|
J = function (e, t, r) {
|
|
(0 !== e.selectionStart || e.selectionEnd !== e.value.length) &&
|
|
(j(e, t),
|
|
(X.current.setCaretTimeout = setTimeout(function () {
|
|
e.value === r && e.selectionStart !== t && j(e, t);
|
|
}, 0)));
|
|
},
|
|
Q = function (e, t, r) {
|
|
return D(e, t, T(e), r);
|
|
},
|
|
ee = function (e, t, r) {
|
|
var n = T(t),
|
|
a = (function (e, t, r, n, a, l, o) {
|
|
void 0 === o && (o = S);
|
|
var i = a.findIndex(function (e) {
|
|
return e;
|
|
}),
|
|
s = e.slice(0, i);
|
|
t || r.startsWith(s) || ((t = s), (r = s + r), (n += s.length));
|
|
for (
|
|
var u = r.length, c = e.length, d = {}, f = Array(u), m = 0;
|
|
m < u;
|
|
m++
|
|
) {
|
|
f[m] = -1;
|
|
for (var p = 0; p < c; p++)
|
|
if (
|
|
o({
|
|
currentValue: r,
|
|
lastValue: t,
|
|
formattedValue: e,
|
|
currentValueIndex: m,
|
|
formattedValueIndex: p,
|
|
}) &&
|
|
!0 !== d[p]
|
|
) {
|
|
(f[m] = p), (d[p] = !0);
|
|
break;
|
|
}
|
|
}
|
|
for (var g = n; g < u && (-1 === f[g] || !l(r[g])); ) g++;
|
|
var v = g === u || -1 === f[g] ? c : f[g];
|
|
for (g = n - 1; g > 0 && -1 === f[g]; ) g--;
|
|
var h = -1 === g || -1 === f[g] ? 0 : f[g] + 1;
|
|
return h > v ? v : n - h < v - n ? h : v;
|
|
})(t, B, e, r, n, R, A);
|
|
return D(t, a, n);
|
|
},
|
|
et = function (e) {
|
|
var t,
|
|
r = e.formattedValue;
|
|
void 0 === r && (r = "");
|
|
var n = e.input,
|
|
a = e.source,
|
|
l = e.event,
|
|
o = e.numAsString;
|
|
if (n) {
|
|
var i = e.inputValue || n.value,
|
|
s = C(n);
|
|
(n.value = r), void 0 !== (t = ee(i, r, s)) && J(n, t, r);
|
|
}
|
|
r !== B && $(q(r, o), { event: l, source: a });
|
|
};
|
|
(0, i.useEffect)(
|
|
function () {
|
|
var e = K.current,
|
|
t = e.formattedValue,
|
|
r = e.numAsString;
|
|
(B !== t || F !== r) &&
|
|
$(q(B, F), { event: void 0, source: l.props });
|
|
},
|
|
[B, F],
|
|
);
|
|
var er = Z.current ? C(Z.current) : void 0;
|
|
("u" > typeof window ? i.useLayoutEffect : i.useEffect)(
|
|
function () {
|
|
var e = Z.current;
|
|
if (B !== K.current.formattedValue && e) {
|
|
var t = ee(K.current.formattedValue, B, er);
|
|
(e.value = B), J(e, t, B);
|
|
}
|
|
},
|
|
[B],
|
|
);
|
|
var en = function (e, t, r) {
|
|
var n = t.target,
|
|
a = Object.assign(
|
|
Object.assign(
|
|
{},
|
|
U.current ? N(U.current, n.selectionEnd) : w(B, e),
|
|
),
|
|
{ lastValue: B },
|
|
),
|
|
l = u(e, a),
|
|
o = Y(l);
|
|
if (((l = u(o, void 0)), v && !v(q(o, l)))) {
|
|
var i = t.target,
|
|
s = ee(e, B, C(i));
|
|
return (i.value = B), J(i, s, B), !1;
|
|
}
|
|
return (
|
|
et({
|
|
formattedValue: o,
|
|
numAsString: l,
|
|
inputValue: e,
|
|
event: t,
|
|
source: r,
|
|
input: t.target,
|
|
}),
|
|
!0
|
|
);
|
|
},
|
|
ea = function (e, t) {
|
|
void 0 === t && (t = 0),
|
|
(U.current = {
|
|
selectionStart: e.selectionStart,
|
|
selectionEnd: e.selectionEnd + t,
|
|
});
|
|
},
|
|
el = Object.assign(
|
|
{
|
|
inputMode:
|
|
W &&
|
|
"u" > typeof navigator &&
|
|
!(navigator.platform && /iPhone|iPod/.test(navigator.platform))
|
|
? "numeric"
|
|
: void 0,
|
|
},
|
|
z,
|
|
{
|
|
type: t,
|
|
value: B,
|
|
onChange: function (e) {
|
|
en(e.target.value, e, l.event) && h(e), (U.current = void 0);
|
|
},
|
|
onKeyDown: function (e) {
|
|
var t,
|
|
r = e.target,
|
|
n = e.key,
|
|
a = r.selectionStart,
|
|
l = r.selectionEnd,
|
|
o = r.value;
|
|
void 0 === o && (o = ""),
|
|
"ArrowLeft" === n || "Backspace" === n
|
|
? (t = Math.max(a - 1, 0))
|
|
: "ArrowRight" === n
|
|
? (t = Math.min(a + 1, o.length))
|
|
: "Delete" === n && (t = a);
|
|
var i = 0;
|
|
"Delete" === n && a === l && (i = 1);
|
|
var s = "ArrowLeft" === n || "ArrowRight" === n;
|
|
if (void 0 === t || (a !== l && !s)) {
|
|
x(e), ea(r, i);
|
|
return;
|
|
}
|
|
var u = t;
|
|
s
|
|
? (u = Q(o, t, "ArrowLeft" === n ? "left" : "right")) !== t &&
|
|
e.preventDefault()
|
|
: "Delete" !== n || R(o[t])
|
|
? "Backspace" !== n || R(o[t]) || (u = Q(o, t, "left"))
|
|
: (u = Q(o, t, "right")),
|
|
u !== t && J(r, u, o),
|
|
x(e),
|
|
ea(r, i);
|
|
},
|
|
onMouseUp: function (e) {
|
|
var t = e.target,
|
|
r = function () {
|
|
var e = t.selectionStart,
|
|
r = t.selectionEnd,
|
|
n = t.value;
|
|
if ((void 0 === n && (n = ""), e === r)) {
|
|
var a = Q(n, e);
|
|
a !== e && J(t, a, n);
|
|
}
|
|
};
|
|
r(),
|
|
requestAnimationFrame(function () {
|
|
r();
|
|
}),
|
|
b(e),
|
|
ea(t);
|
|
},
|
|
onFocus: function (e) {
|
|
e.persist && e.persist();
|
|
var t = e.target,
|
|
r = e.currentTarget;
|
|
(Z.current = t),
|
|
(X.current.focusTimeout = setTimeout(function () {
|
|
var n = t.selectionStart,
|
|
a = t.selectionEnd,
|
|
l = t.value;
|
|
void 0 === l && (l = "");
|
|
var o = Q(l, n);
|
|
o !== n && (0 !== n || a !== l.length) && J(t, o, l),
|
|
y(
|
|
Object.assign(Object.assign({}, e), { currentTarget: r }),
|
|
);
|
|
}, 0));
|
|
},
|
|
onBlur: function (e) {
|
|
(Z.current = null),
|
|
clearTimeout(X.current.focusTimeout),
|
|
clearTimeout(X.current.setCaretTimeout),
|
|
M(e);
|
|
},
|
|
},
|
|
);
|
|
return "text" === r
|
|
? a
|
|
? i.default.createElement(i.default.Fragment, null, a(B, z) || null)
|
|
: i.default.createElement("span", Object.assign({}, z, { ref: o }), B)
|
|
: n
|
|
? i.default.createElement(n, Object.assign({}, el, { ref: o }))
|
|
: i.default.createElement("input", Object.assign({}, el, { ref: o }));
|
|
}
|
|
function _(e, t) {
|
|
var r,
|
|
n,
|
|
a,
|
|
l = t.decimalScale,
|
|
o = t.fixedDecimalScale,
|
|
i = t.prefix;
|
|
void 0 === i && (i = "");
|
|
var s = t.suffix;
|
|
void 0 === s && (s = "");
|
|
var u = t.allowNegative,
|
|
c = t.thousandsGroupStyle;
|
|
if ((void 0 === c && (c = "thousand"), "" === e || "-" === e)) return e;
|
|
var d = T(t),
|
|
f = d.thousandSeparator,
|
|
m = d.decimalSeparator,
|
|
p = (0 !== l && -1 !== e.indexOf(".")) || (l && o),
|
|
g = v(e, u),
|
|
x = g.beforeDecimal,
|
|
b = g.afterDecimal,
|
|
y = g.addNegation;
|
|
return (
|
|
void 0 !== l && (b = h(b, l, !!o)),
|
|
f &&
|
|
((r = x),
|
|
(n = (function (e) {
|
|
switch (e) {
|
|
case "lakh":
|
|
return /(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;
|
|
case "wan":
|
|
return /(\d)(?=(\d{4})+(?!\d))/g;
|
|
default:
|
|
return /(\d)(?=(\d{3})+(?!\d))/g;
|
|
}
|
|
})(c)),
|
|
(a = -1 === (a = r.search(/[1-9]/)) ? r.length : a),
|
|
(x =
|
|
r.substring(0, a) + r.substring(a, r.length).replace(n, "$1" + f))),
|
|
i && (x = i + x),
|
|
s && (b += s),
|
|
y && (x = "-" + x),
|
|
(e = x + ((p && m) || "") + b)
|
|
);
|
|
}
|
|
function T(e) {
|
|
var t = e.decimalSeparator;
|
|
void 0 === t && (t = ".");
|
|
var r = e.thousandSeparator,
|
|
n = e.allowedDecimalSeparators;
|
|
return (
|
|
!0 === r && (r = ","),
|
|
n || (n = [t, "."]),
|
|
{
|
|
decimalSeparator: t,
|
|
thousandSeparator: r,
|
|
allowedDecimalSeparators: n,
|
|
}
|
|
);
|
|
}
|
|
function R(e) {
|
|
var t,
|
|
r,
|
|
n,
|
|
a,
|
|
o,
|
|
s,
|
|
u,
|
|
h,
|
|
x,
|
|
N,
|
|
C,
|
|
S,
|
|
D,
|
|
k,
|
|
I,
|
|
E,
|
|
R,
|
|
A,
|
|
z,
|
|
P,
|
|
O,
|
|
B,
|
|
F,
|
|
L,
|
|
U,
|
|
K,
|
|
$,
|
|
H,
|
|
W,
|
|
G =
|
|
((t = (function (e) {
|
|
var t = T(e),
|
|
r = t.thousandSeparator,
|
|
n = t.decimalSeparator,
|
|
a = e.prefix;
|
|
void 0 === a && (a = "");
|
|
var l = e.allowNegative;
|
|
if ((void 0 === l && (l = !0), r === n))
|
|
throw Error(
|
|
"\n Decimal separator can't be same as thousand separator.\n thousandSeparator: " +
|
|
r +
|
|
' (thousandSeparator = {true} is same as thousandSeparator = ",")\n decimalSeparator: ' +
|
|
n +
|
|
" (default value for decimalSeparator is .)\n ",
|
|
);
|
|
return (
|
|
a.startsWith("-") &&
|
|
l &&
|
|
(console.error(
|
|
"\n Prefix can't start with '-' when allowNegative is true.\n prefix: " +
|
|
a +
|
|
"\n allowNegative: " +
|
|
l +
|
|
"\n ",
|
|
),
|
|
(l = !1)),
|
|
Object.assign(Object.assign({}, e), { allowNegative: l })
|
|
);
|
|
})((t = e))).decimalSeparator,
|
|
t.allowedDecimalSeparators,
|
|
t.thousandsGroupStyle,
|
|
(r = t.suffix),
|
|
(n = t.allowNegative),
|
|
(a = t.allowLeadingZeros),
|
|
void 0 === (o = t.onKeyDown) && (o = d),
|
|
void 0 === (s = t.onBlur) && (s = d),
|
|
(u = t.thousandSeparator),
|
|
(h = t.decimalScale),
|
|
(x = t.fixedDecimalScale),
|
|
void 0 === (N = t.prefix) && (N = ""),
|
|
(C = t.defaultValue),
|
|
(S = t.value),
|
|
(D = t.valueIsNumericString),
|
|
(k = t.onValueChange),
|
|
(I = c(t, [
|
|
"decimalSeparator",
|
|
"allowedDecimalSeparators",
|
|
"thousandsGroupStyle",
|
|
"suffix",
|
|
"allowNegative",
|
|
"allowLeadingZeros",
|
|
"onKeyDown",
|
|
"onBlur",
|
|
"thousandSeparator",
|
|
"decimalScale",
|
|
"fixedDecimalScale",
|
|
"prefix",
|
|
"defaultValue",
|
|
"value",
|
|
"valueIsNumericString",
|
|
"onValueChange",
|
|
])),
|
|
(R = (E = T(t)).decimalSeparator),
|
|
(A = E.allowedDecimalSeparators),
|
|
(z = function (e) {
|
|
return _(e, t);
|
|
}),
|
|
(P = function (e, r) {
|
|
return (function (e, t, r) {
|
|
void 0 === t &&
|
|
(t = {
|
|
from: { start: 0, end: 0 },
|
|
to: { start: 0, end: e.length },
|
|
lastValue: "",
|
|
});
|
|
var n,
|
|
a,
|
|
l,
|
|
o,
|
|
i = r.allowNegative,
|
|
s = r.prefix;
|
|
void 0 === s && (s = "");
|
|
var u = r.suffix;
|
|
void 0 === u && (u = "");
|
|
var c = r.decimalScale,
|
|
d = t.from,
|
|
m = t.to,
|
|
p = m.start,
|
|
h = m.end,
|
|
x = T(r),
|
|
b = x.allowedDecimalSeparators,
|
|
y = x.decimalSeparator,
|
|
j = e[h] === y;
|
|
if (f(e) && (e === s || e === u) && "" === t.lastValue) return e;
|
|
if (h - p == 1 && -1 !== b.indexOf(e[p])) {
|
|
var w = 0 === c ? "" : y;
|
|
e = e.substring(0, p) + w + e.substring(p + 1, e.length);
|
|
}
|
|
var N = function (e, t, r) {
|
|
var n = !1,
|
|
a = !1;
|
|
s.startsWith("-")
|
|
? (n = !1)
|
|
: e.startsWith("--")
|
|
? ((n = !1), (a = !0))
|
|
: u.startsWith("-") && e.length === u.length
|
|
? (n = !1)
|
|
: "-" === e[0] && (n = !0);
|
|
var l = +!!n;
|
|
return (
|
|
a && (l = 2),
|
|
l && ((e = e.substring(l)), (t -= l), (r -= l)),
|
|
{ value: e, start: t, end: r, hasNegation: n }
|
|
);
|
|
},
|
|
C = N(e, p, h),
|
|
S = C.hasNegation;
|
|
(e = C.value), (p = C.start), (h = C.end);
|
|
var D = N(t.lastValue, d.start, d.end),
|
|
k = D.start,
|
|
V = D.end,
|
|
I = D.value,
|
|
E = e.substring(p, h);
|
|
e.length &&
|
|
I.length &&
|
|
(k > I.length - u.length || V < s.length) &&
|
|
!(E && u.startsWith(E)) &&
|
|
(e = I);
|
|
var M = 0;
|
|
e.startsWith(s) ? (M += s.length) : p < s.length && (M = p),
|
|
(e = e.substring(M)),
|
|
(h -= M);
|
|
var _ = e.length,
|
|
R = e.length - u.length;
|
|
e.endsWith(u)
|
|
? (_ = R)
|
|
: h > R
|
|
? (_ = h)
|
|
: h > e.length - u.length && (_ = h),
|
|
(e = e.substring(0, _)),
|
|
void 0 === (n = S ? "-" + e : e) && (n = ""),
|
|
(a = RegExp("(-)(.)*(-)")),
|
|
(l = /(-)/.test(n)),
|
|
(o = a.test(n)),
|
|
(n = n.replace(/-/g, "")),
|
|
l && !o && i && (n = "-" + n);
|
|
var A = (e = (
|
|
(e = n).match(RegExp("(^-)|[0-9]|" + g(y), "g")) || []
|
|
).join("")).indexOf(y),
|
|
z = v(
|
|
(e = e.replace(RegExp(g(y), "g"), function (e, t) {
|
|
return t === A ? "." : "";
|
|
})),
|
|
i,
|
|
),
|
|
P = z.beforeDecimal,
|
|
O = z.afterDecimal,
|
|
B = z.addNegation;
|
|
return (
|
|
m.end - m.start < d.end - d.start &&
|
|
"" === P &&
|
|
j &&
|
|
!parseFloat(O) &&
|
|
(e = B ? "-" : ""),
|
|
e
|
|
);
|
|
})(e, r, t);
|
|
}),
|
|
(O = m(S) ? C : S),
|
|
(F =
|
|
null != D
|
|
? D
|
|
: ((B = N),
|
|
"" === O ||
|
|
(!(null == B ? void 0 : B.match(/\d/)) &&
|
|
!(null == r ? void 0 : r.match(/\d/)) &&
|
|
"string" == typeof O &&
|
|
!isNaN(Number(O))))),
|
|
m(S)
|
|
? m(C) || (F = F || "number" == typeof C)
|
|
: (F = F || "number" == typeof S),
|
|
($ = (K = (U = V(
|
|
(L = function (e) {
|
|
return p(e)
|
|
? e
|
|
: ("number" == typeof e && (e = b(e)),
|
|
F && "number" == typeof h)
|
|
? y(e, h, !!x)
|
|
: e;
|
|
})(S),
|
|
L(C),
|
|
!!F,
|
|
z,
|
|
P,
|
|
k,
|
|
))[0]).numAsString),
|
|
(H = K.formattedValue),
|
|
(W = U[1]),
|
|
Object.assign(Object.assign({}, I), {
|
|
value: H,
|
|
valueIsNumericString: !1,
|
|
isValidInputCharacter: function (e) {
|
|
return e === R || f(e);
|
|
},
|
|
isCharacterSame: function (e) {
|
|
var t = e.currentValue,
|
|
r = e.lastValue,
|
|
n = e.formattedValue,
|
|
a = e.currentValueIndex,
|
|
l = e.formattedValueIndex,
|
|
o = t[a],
|
|
i = n[l],
|
|
s = w(r, t).to,
|
|
u = function (e) {
|
|
return P(e).indexOf(".") + N.length;
|
|
};
|
|
return (
|
|
!(
|
|
0 === S &&
|
|
x &&
|
|
h &&
|
|
t[s.start] === R &&
|
|
u(t) < a &&
|
|
u(n) > l
|
|
) &&
|
|
((!!(a >= s.start && a < s.end && A && A.includes(o)) &&
|
|
i === R) ||
|
|
o === i)
|
|
);
|
|
},
|
|
onValueChange: W,
|
|
format: z,
|
|
removeFormatting: P,
|
|
getCaretBoundary: function (e) {
|
|
var r, n, a, l, o, i;
|
|
return (
|
|
void 0 === (n = (r = t).prefix) && (n = ""),
|
|
void 0 === (a = r.suffix) && (a = ""),
|
|
(l = Array.from({ length: e.length + 1 }).map(function () {
|
|
return !0;
|
|
})),
|
|
(o = "-" === e[0]),
|
|
l.fill(!1, 0, n.length + +!!o),
|
|
(i = e.length),
|
|
l.fill(!1, i - a.length + 1, i + 1),
|
|
l
|
|
);
|
|
},
|
|
onKeyDown: function (e) {
|
|
var t = e.target,
|
|
r = e.key,
|
|
a = t.selectionStart,
|
|
l = t.selectionEnd,
|
|
i = t.value;
|
|
if (
|
|
(void 0 === i && (i = ""),
|
|
("Backspace" === r || "Delete" === r) && l < N.length)
|
|
)
|
|
return void e.preventDefault();
|
|
if (a !== l) return void o(e);
|
|
"Backspace" === r &&
|
|
"-" === i[0] &&
|
|
a === N.length + 1 &&
|
|
n &&
|
|
j(t, 1),
|
|
h &&
|
|
x &&
|
|
("Backspace" === r && i[a - 1] === R
|
|
? (j(t, a - 1), e.preventDefault())
|
|
: "Delete" === r && i[a] === R && e.preventDefault()),
|
|
(null == A ? void 0 : A.includes(r)) &&
|
|
i[a] === R &&
|
|
j(t, a + 1);
|
|
var s = !0 === u ? "," : u;
|
|
"Backspace" === r && i[a - 1] === s && j(t, a - 1),
|
|
"Delete" === r && i[a] === s && j(t, a + 1),
|
|
o(e);
|
|
},
|
|
onBlur: function (e) {
|
|
var r = $;
|
|
r.match(/\d/g) || (r = ""),
|
|
a ||
|
|
(r = (function (e) {
|
|
if (!e) return e;
|
|
var t = "-" === e[0];
|
|
t && (e = e.substring(1, e.length));
|
|
var r = e.split("."),
|
|
n = r[0].replace(/^0+/, "") || "0",
|
|
a = r[1] || "";
|
|
return (t ? "-" : "") + n + (a ? "." + a : "");
|
|
})(r)),
|
|
x && h && (r = y(r, h, x)),
|
|
r !== $ &&
|
|
W(
|
|
{
|
|
formattedValue: _(r, t),
|
|
value: r,
|
|
floatValue: parseFloat(r),
|
|
},
|
|
{ event: e, source: l.event },
|
|
),
|
|
s(e);
|
|
},
|
|
}));
|
|
return i.default.createElement(M, Object.assign({}, G));
|
|
}
|
|
var A = e.i(403557),
|
|
z = e.i(404059),
|
|
P = e.i(600354),
|
|
O = e.i(507945),
|
|
B = e.i(855698),
|
|
F = e.i(938202),
|
|
L = e.i(759455),
|
|
U = e.i(450943),
|
|
K = e.i(479324),
|
|
$ = e.i(593307),
|
|
H = e.i(518366),
|
|
W = e.i(606227),
|
|
G = { root: "m_e2f5cd4e", controls: "m_95e17d22", control: "m_80b4b171" };
|
|
function Z({ direction: e, style: t, ...r }) {
|
|
return (0, o.jsx)("svg", {
|
|
style: {
|
|
width: "var(--ni-chevron-size)",
|
|
height: "var(--ni-chevron-size)",
|
|
transform: "up" === e ? "rotate(180deg)" : void 0,
|
|
...t,
|
|
},
|
|
viewBox: "0 0 15 15",
|
|
fill: "none",
|
|
xmlns: "http://www.w3.org/2000/svg",
|
|
...r,
|
|
children: (0, o.jsx)("path", {
|
|
d: "M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",
|
|
fill: "currentColor",
|
|
fillRule: "evenodd",
|
|
clipRule: "evenodd",
|
|
}),
|
|
});
|
|
}
|
|
let X = /^(0\.0*|-0(\.0*)?)$/,
|
|
Y = /^-?0\d+(\.\d+)?\.?$/,
|
|
q = /\.\d*0$/,
|
|
J = /^-?\d+\.$/;
|
|
function Q(e) {
|
|
return "string" == typeof e && "" !== e && !Number.isNaN(Number(e));
|
|
}
|
|
function ee(e) {
|
|
return "number" == typeof e
|
|
? e < Number.MAX_SAFE_INTEGER
|
|
: "" === e || (Q(e) && Number(e) < Number.MAX_SAFE_INTEGER);
|
|
}
|
|
function et(e, t, r) {
|
|
return (
|
|
void 0 === e || ((void 0 === t || e >= t) && (void 0 === r || e <= r))
|
|
);
|
|
}
|
|
let er = {
|
|
step: 1,
|
|
clampBehavior: "blur",
|
|
allowDecimal: !0,
|
|
allowNegative: !0,
|
|
withKeyboardEvents: !0,
|
|
allowLeadingZeros: !0,
|
|
trimLeadingZeroesOnBlur: !0,
|
|
startValue: 0,
|
|
allowedDecimalSeparators: [".", ","],
|
|
},
|
|
en = (0, F.createVarsResolver)((e, { size: t }) => ({
|
|
controls: { "--ni-chevron-size": (0, B.getSize)(t, "ni-chevron-size") },
|
|
})),
|
|
ea = (0, $.factory)((e, t) => {
|
|
let r = (0, K.useProps)("NumberInput", er, e),
|
|
{
|
|
className: n,
|
|
classNames: a,
|
|
styles: l,
|
|
unstyled: s,
|
|
vars: c,
|
|
onChange: d,
|
|
onValueChange: f,
|
|
value: m,
|
|
defaultValue: p,
|
|
max: g,
|
|
min: v,
|
|
step: h,
|
|
hideControls: x,
|
|
rightSection: b,
|
|
isAllowed: y,
|
|
clampBehavior: j,
|
|
onBlur: w,
|
|
allowDecimal: N,
|
|
decimalScale: C,
|
|
onKeyDown: S,
|
|
onKeyDownCapture: D,
|
|
handlersRef: k,
|
|
startValue: V,
|
|
disabled: I,
|
|
rightSectionPointerEvents: E,
|
|
allowNegative: M,
|
|
readOnly: _,
|
|
size: T,
|
|
rightSectionWidth: B,
|
|
stepHoldInterval: F,
|
|
stepHoldDelay: $,
|
|
allowLeadingZeros: ea,
|
|
withKeyboardEvents: el,
|
|
trimLeadingZeroesOnBlur: eo,
|
|
allowedDecimalSeparators: ei,
|
|
attributes: es,
|
|
...eu
|
|
} = r,
|
|
ec = (0, U.useStyles)({
|
|
name: "NumberInput",
|
|
classes: G,
|
|
props: r,
|
|
classNames: a,
|
|
styles: l,
|
|
unstyled: s,
|
|
attributes: es,
|
|
vars: c,
|
|
varsResolver: en,
|
|
}),
|
|
{ resolvedClassNames: ed, resolvedStyles: ef } = (0,
|
|
L.useResolvedStylesApi)({ classNames: a, styles: l, props: r }),
|
|
[em, ep] = (0, A.useUncontrolled)({
|
|
value: m,
|
|
defaultValue: p,
|
|
finalValue: "",
|
|
onChange: d,
|
|
}),
|
|
eg = void 0 !== $ && void 0 !== F,
|
|
ev = (0, i.useRef)(null),
|
|
eh = (0, i.useRef)(null),
|
|
ex = (0, i.useRef)(0),
|
|
eb = (e) => {
|
|
let t = String(e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
|
|
return t
|
|
? Math.max(0, (t[1] ? t[1].length : 0) - (t[2] ? +t[2] : 0))
|
|
: 0;
|
|
},
|
|
ey = (e) => {
|
|
ev.current && void 0 !== e && ev.current.setSelectionRange(e, e);
|
|
},
|
|
ej = (0, i.useRef)(O.noop);
|
|
ej.current = () => {
|
|
let e;
|
|
if (!ee(em)) return;
|
|
let t = Math.max(eb(em), eb(h)),
|
|
r = 10 ** t;
|
|
if (!Q(em) && ("number" != typeof em || Number.isNaN(em)))
|
|
e = (0, z.clamp)(V, v, g);
|
|
else if (void 0 !== g) {
|
|
let t = (Math.round(Number(em) * r) + Math.round(h * r)) / r;
|
|
e = t <= g ? t : g;
|
|
} else e = (Math.round(Number(em) * r) + Math.round(h * r)) / r;
|
|
let n = e.toFixed(t);
|
|
ep(parseFloat(n)),
|
|
f?.(
|
|
{ floatValue: parseFloat(n), formattedValue: n, value: n },
|
|
{ source: "increment" },
|
|
),
|
|
setTimeout(() => ey(ev.current?.value.length), 0);
|
|
};
|
|
let ew = (0, i.useRef)(O.noop);
|
|
(ew.current = () => {
|
|
let e;
|
|
if (!ee(em)) return;
|
|
let t = void 0 !== v ? v : M ? Number.MIN_SAFE_INTEGER : 0,
|
|
r = Math.max(eb(em), eb(h)),
|
|
n = 10 ** r;
|
|
if ((!Q(em) && "number" != typeof em) || Number.isNaN(em))
|
|
e = (0, z.clamp)(V, t, g);
|
|
else {
|
|
let r = (Math.round(Number(em) * n) - Math.round(h * n)) / n;
|
|
e = void 0 !== t && r < t ? t : r;
|
|
}
|
|
let a = e.toFixed(r);
|
|
ep(parseFloat(a)),
|
|
f?.(
|
|
{ floatValue: parseFloat(a), formattedValue: a, value: a },
|
|
{ source: "decrement" },
|
|
),
|
|
setTimeout(() => ey(ev.current?.value.length), 0);
|
|
}),
|
|
(0, P.assignRef)(k, { increment: ej.current, decrement: ew.current });
|
|
let eN = (e) => {
|
|
e ? ej.current?.() : ew.current?.(), (ex.current += 1);
|
|
},
|
|
eC = (e) => {
|
|
if ((eN(e), eg)) {
|
|
let t = "number" == typeof F ? F : F(ex.current);
|
|
eh.current = window.setTimeout(() => eC(e), t);
|
|
}
|
|
},
|
|
eS = (e, t) => {
|
|
e.preventDefault(),
|
|
ev.current?.focus(),
|
|
eN(t),
|
|
eg && (eh.current = window.setTimeout(() => eC(t), $));
|
|
},
|
|
eD = () => {
|
|
eh.current && window.clearTimeout(eh.current),
|
|
(eh.current = null),
|
|
(ex.current = 0);
|
|
},
|
|
ek = (0, o.jsxs)("div", {
|
|
...ec("controls"),
|
|
children: [
|
|
(0, o.jsx)(W.UnstyledButton, {
|
|
...ec("control"),
|
|
tabIndex: -1,
|
|
"aria-hidden": !0,
|
|
disabled:
|
|
I || ("number" == typeof em && void 0 !== g && em >= g),
|
|
mod: { direction: "up" },
|
|
onMouseDown: (e) => e.preventDefault(),
|
|
onPointerDown: (e) => {
|
|
eS(e, !0);
|
|
},
|
|
onPointerUp: eD,
|
|
onPointerLeave: eD,
|
|
children: (0, o.jsx)(Z, { direction: "up" }),
|
|
}),
|
|
(0, o.jsx)(W.UnstyledButton, {
|
|
...ec("control"),
|
|
tabIndex: -1,
|
|
"aria-hidden": !0,
|
|
disabled:
|
|
I || ("number" == typeof em && void 0 !== v && em <= v),
|
|
mod: { direction: "down" },
|
|
onMouseDown: (e) => e.preventDefault(),
|
|
onPointerDown: (e) => {
|
|
eS(e, !1);
|
|
},
|
|
onPointerUp: eD,
|
|
onPointerLeave: eD,
|
|
children: (0, o.jsx)(Z, { direction: "down" }),
|
|
}),
|
|
],
|
|
});
|
|
return (0, o.jsx)(H.InputBase, {
|
|
component: R,
|
|
allowNegative: M,
|
|
className: (0, u.default)(G.root, n),
|
|
size: T,
|
|
inputMode: "decimal",
|
|
...eu,
|
|
readOnly: _,
|
|
disabled: I,
|
|
value: em,
|
|
getInputRef: (0, P.useMergedRef)(t, ev),
|
|
onValueChange: (e, t) => {
|
|
var r, n;
|
|
"event" === t.source &&
|
|
ep(
|
|
((r = e.floatValue),
|
|
(n = e.value),
|
|
("number" == typeof r
|
|
? !(r < Number.MAX_SAFE_INTEGER)
|
|
: !!Number.isNaN(Number(r))) ||
|
|
Number.isNaN(r) ||
|
|
!(14 > n.toString().replace(".", "").length) ||
|
|
"" === n ||
|
|
X.test(e.value) ||
|
|
(ea && Y.test(e.value)) ||
|
|
q.test(e.value) ||
|
|
J.test(e.value))
|
|
? e.value
|
|
: e.floatValue,
|
|
),
|
|
f?.(e, t);
|
|
},
|
|
rightSection: x || _ || !ee(em) ? b : b || ek,
|
|
classNames: ed,
|
|
styles: ef,
|
|
unstyled: s,
|
|
__staticSelector: "NumberInput",
|
|
decimalScale: N ? C : 0,
|
|
onKeyDown: (e) => {
|
|
S?.(e),
|
|
!_ &&
|
|
el &&
|
|
("ArrowUp" === e.key && (e.preventDefault(), ej.current?.()),
|
|
"ArrowDown" === e.key && (e.preventDefault(), ew.current?.()));
|
|
},
|
|
onKeyDownCapture: (e) => {
|
|
if ((D?.(e), "Backspace" === e.key)) {
|
|
let t = ev.current;
|
|
t &&
|
|
0 === t.selectionStart &&
|
|
t.selectionStart === t.selectionEnd &&
|
|
(e.preventDefault(), window.setTimeout(() => ey(0), 0));
|
|
}
|
|
},
|
|
rightSectionPointerEvents: E ?? (I ? "none" : void 0),
|
|
rightSectionWidth: B ?? `var(--ni-right-section-width-${T || "sm"})`,
|
|
allowLeadingZeros: ea,
|
|
allowedDecimalSeparators: ei,
|
|
onBlur: (e) => {
|
|
let t = em;
|
|
"blur" === j && "number" == typeof t && (t = (0, z.clamp)(t, v, g)),
|
|
eo &&
|
|
"string" == typeof t &&
|
|
15 > eb(t) &&
|
|
(t = (function (e, t, r) {
|
|
let n = e.toString(),
|
|
a = J.test(n),
|
|
l = n.replace(/^0+(?=\d)/, ""),
|
|
o = parseFloat(l);
|
|
if (Number.isNaN(o)) return l;
|
|
if (o > Number.MAX_SAFE_INTEGER) return void 0 !== t ? t : l;
|
|
let i = (0, z.clamp)(o, r, t);
|
|
if (a) {
|
|
let e = i.toString().replace(/^0+(?=\d)/, "");
|
|
return `${e}.`;
|
|
}
|
|
return i;
|
|
})(t, g, v)),
|
|
em !== t && ep(t),
|
|
w?.(e);
|
|
},
|
|
attributes: es,
|
|
isAllowed: (e) =>
|
|
"strict" === j
|
|
? y
|
|
? y(e) && et(e.floatValue, v, g)
|
|
: et(e.floatValue, v, g)
|
|
: !y || y(e),
|
|
});
|
|
});
|
|
(ea.classes = { ...H.InputBase.classes, ...G }),
|
|
(ea.displayName = "@mantine/core/NumberInput");
|
|
var el = e.i(906328),
|
|
eo = e.i(41671),
|
|
ei = e.i(677588),
|
|
es = e.i(791997),
|
|
eu = e.i(41114),
|
|
ec = e.i(295085),
|
|
ed = e.i(636820),
|
|
ef = e.i(121959),
|
|
em = e.i(629062);
|
|
function ep() {
|
|
let e = (0, i.useRef)(null);
|
|
return (
|
|
(0, i.useEffect)(() => {
|
|
let t = e.current;
|
|
return (
|
|
t && t.play().catch(() => void 0),
|
|
() => {
|
|
t && t.pause();
|
|
}
|
|
);
|
|
}, []),
|
|
(0, o.jsx)("video", {
|
|
ref: e,
|
|
src: "https://libtv-res.liblib.art/upload-images/4e303b89c099425a93084d50cdcb10f4/e5d71224e151896d9ead9955953984aff3f293e4.mp4",
|
|
autoPlay: !0,
|
|
muted: !0,
|
|
loop: !0,
|
|
playsInline: !0,
|
|
className: "h-[180px] w-[320px] rounded-lg object-cover",
|
|
})
|
|
);
|
|
}
|
|
function eg({
|
|
model: e,
|
|
isLora: t,
|
|
onRemove: r,
|
|
onClick: n,
|
|
onWeightChange: a,
|
|
}) {
|
|
let l = (0, es.useCanvasThemeStore)((e) => e.theme),
|
|
u = e.weight ?? 0.8,
|
|
[c, d] = (0, i.useState)(u);
|
|
return (
|
|
(0, i.useEffect)(() => {
|
|
d(u);
|
|
}, [u]),
|
|
(0, o.jsxs)(s.HoverCard, {
|
|
position: "top",
|
|
shadow: "md",
|
|
offset: 8,
|
|
openDelay: 150,
|
|
closeDelay: 200,
|
|
withinPortal: !0,
|
|
children: [
|
|
(0, o.jsx)(s.HoverCard.Target, {
|
|
children: (0, o.jsxs)("div", {
|
|
className: "group relative size-12 cursor-pointer",
|
|
onClick: n,
|
|
children: [
|
|
(0, o.jsxs)("div", {
|
|
className: "relative size-full overflow-hidden rounded-lg",
|
|
children: [
|
|
e.imageUrl
|
|
? (0, o.jsx)("img", {
|
|
src: (0, ec.isVideoUrl)(e.imageUrl)
|
|
? `${e.imageUrl}${e.imageUrl.includes("?") ? "&" : "?"}x-oss-process=video/snapshot,t_0,f_jpg,w_400,m_fast`
|
|
: (0, ec.getOssCompressedImage)(e.imageUrl, 400),
|
|
alt: e.name,
|
|
className: "size-full object-cover",
|
|
})
|
|
: (0, o.jsx)("div", {
|
|
className:
|
|
"border-border-default border-hair flex size-full items-center justify-center bg-gray-100",
|
|
children: (0, o.jsx)(eo.Icons.image, {
|
|
className: "text-fg-muted size-4",
|
|
}),
|
|
}),
|
|
t &&
|
|
(0, o.jsx)("div", {
|
|
className: "absolute inset-0 bg-black/45",
|
|
}),
|
|
],
|
|
}),
|
|
t &&
|
|
(0, o.jsx)("div", {
|
|
className:
|
|
"pointer-events-none absolute left-1/2 top-1/2 z-10 -translate-x-1/2 -translate-y-1/2 text-center text-xs font-semibold leading-4 text-white",
|
|
children: c.toFixed(1),
|
|
}),
|
|
(0, o.jsx)("button", {
|
|
type: "button",
|
|
className:
|
|
"absolute -right-[4.5px] -top-[4.5px] z-20 flex size-[15px] items-center justify-center rounded-full border border-white bg-[#333] opacity-0 transition-opacity group-hover:opacity-100",
|
|
onClick: (t) => {
|
|
t.stopPropagation(), r(e.uuid);
|
|
},
|
|
children: (0, o.jsx)(eo.Icons.x, {
|
|
className: "size-[7px] text-white",
|
|
}),
|
|
}),
|
|
],
|
|
}),
|
|
}),
|
|
(0, o.jsxs)(s.HoverCard.Dropdown, {
|
|
className: (0, eu.cn)(
|
|
"border-hair rounded-2xl p-3 backdrop-blur-[32px]",
|
|
"light" === l
|
|
? "canvas-light border-border-muted bg-white! shadow-[0px_4px_10px_rgba(0,0,0,0.08),0px_2px_4px_rgba(0,0,0,0.06)]"
|
|
: "border-border-muted bg-panel-background/95 shadow-[0px_4px_10px_0px_rgba(0,0,0,0.12),0px_2px_4px_0px_rgba(0,0,0,0.2)]",
|
|
),
|
|
style: { minWidth: 220 },
|
|
children: [
|
|
(0, o.jsx)("div", {
|
|
className:
|
|
"text-fg-default max-w-[200px] truncate text-[13px]",
|
|
children: e.name,
|
|
}),
|
|
t &&
|
|
(0, o.jsxs)("div", {
|
|
className: "mt-1 flex items-center gap-4",
|
|
onClick: (e) => {
|
|
e.stopPropagation(), e.preventDefault();
|
|
},
|
|
children: [
|
|
(0, o.jsx)(el.Slider, {
|
|
min: 0.1,
|
|
max: 1.5,
|
|
step: 0.1,
|
|
value: c,
|
|
onChange: d,
|
|
onChangeEnd: (t) => a?.(e.uuid, t),
|
|
size: "xs",
|
|
className: "flex-1",
|
|
}),
|
|
(0, o.jsx)(ea, {
|
|
min: 0.1,
|
|
max: 1.5,
|
|
step: 0.1,
|
|
value: c,
|
|
onChange: (t) => {
|
|
"number" == typeof t && (d(t), a?.(e.uuid, t));
|
|
},
|
|
hideControls: !0,
|
|
decimalScale: 1,
|
|
fixedDecimalScale: !0,
|
|
styles: {
|
|
input: {
|
|
width: 60,
|
|
height: 32,
|
|
minHeight: 32,
|
|
textAlign: "center",
|
|
padding: "0 8px",
|
|
borderRadius: 8,
|
|
fontSize: 12,
|
|
},
|
|
},
|
|
}),
|
|
],
|
|
}),
|
|
],
|
|
}),
|
|
],
|
|
})
|
|
);
|
|
}
|
|
function ev({ focusRegion: e, onEdit: t, onDelete: r }) {
|
|
let [n, a] = (0, i.useState)(null);
|
|
return (
|
|
(0, i.useEffect)(() => {
|
|
if (!e.imageUrl) return void a(null);
|
|
let t = e.width > 0 ? e.width : 1,
|
|
r = e.height > 0 ? e.height : 1,
|
|
n = !1;
|
|
return (
|
|
(0, ec.cropImageByNormalizedRect)(e.imageUrl, e.relX, e.relY, t, r)
|
|
.then((e) => {
|
|
n || a(e);
|
|
})
|
|
.catch(() => {
|
|
n || a(null);
|
|
}),
|
|
() => {
|
|
n = !0;
|
|
}
|
|
);
|
|
}, [e.imageUrl, e.relX, e.relY, e.width, e.height]),
|
|
(0, o.jsxs)("div", {
|
|
className: "focus-mode-toggle group relative size-12 cursor-pointer",
|
|
onClick: t,
|
|
children: [
|
|
(0, o.jsxs)("div", {
|
|
className:
|
|
"border-border-default border-hair relative flex size-full flex-col items-center justify-center gap-0.5 overflow-hidden rounded-lg p-1",
|
|
children: [
|
|
n
|
|
? (0, o.jsx)("img", {
|
|
src: n,
|
|
alt: "",
|
|
className: "absolute inset-0 size-full object-cover",
|
|
})
|
|
: e.imageUrl
|
|
? (0, o.jsx)("div", {
|
|
className: "absolute inset-0 bg-gray-800",
|
|
})
|
|
: null,
|
|
(0, o.jsx)("div", {
|
|
className: "absolute inset-0 bg-black/40",
|
|
}),
|
|
(0, o.jsxs)("span", {
|
|
className:
|
|
"relative flex flex-col items-center gap-0.5 transition-opacity group-hover:opacity-0",
|
|
children: [
|
|
(0, o.jsx)(eo.IconifyIcon, {
|
|
icon: "libtv:focus",
|
|
width: 14,
|
|
height: 14,
|
|
className: "text-white/80",
|
|
}),
|
|
(0, o.jsx)("span", {
|
|
className: "text-[11px] leading-none text-white/80",
|
|
children: "聚焦",
|
|
}),
|
|
],
|
|
}),
|
|
(0, o.jsxs)("span", {
|
|
className:
|
|
"absolute inset-0 flex flex-col items-center justify-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100",
|
|
children: [
|
|
(0, o.jsx)(eo.IconifyIcon, {
|
|
icon: "libtv:focus",
|
|
width: 14,
|
|
height: 14,
|
|
className: "text-white/80",
|
|
}),
|
|
(0, o.jsx)("span", {
|
|
className: "text-[11px] leading-none text-white/80",
|
|
children: "编辑",
|
|
}),
|
|
],
|
|
}),
|
|
],
|
|
}),
|
|
(0, o.jsx)("button", {
|
|
type: "button",
|
|
onClick: (e) => {
|
|
e.stopPropagation(), r?.();
|
|
},
|
|
className:
|
|
"absolute -right-0.5 -top-0.5 z-20 flex size-[15px] items-center justify-center rounded-full border border-white bg-[#333] opacity-0 transition-opacity group-hover:opacity-100",
|
|
"aria-label": "删除",
|
|
children: (0, o.jsx)(eo.Icons.x, {
|
|
className: "size-[7px] text-white",
|
|
}),
|
|
}),
|
|
],
|
|
})
|
|
);
|
|
}
|
|
let eh = [
|
|
{ key: "styles", type: "style" },
|
|
{ key: "lora", type: "lora" },
|
|
{ key: "template", type: "template" },
|
|
];
|
|
function ex({
|
|
onlyFineTune: e = !1,
|
|
onMarkClick: t,
|
|
isMarkActive: r,
|
|
onFocusClick: n,
|
|
isFocusActive: a,
|
|
focusRegion: l,
|
|
onFocusEdit: u,
|
|
onFocusDelete: c,
|
|
modelSchema: d,
|
|
fineTuneModels: f = [],
|
|
onFineTuneChange: m,
|
|
nodeId: p,
|
|
topToolbarLocked: g,
|
|
}) {
|
|
let v = (0, es.useCanvasThemeStore)((e) => e.theme),
|
|
[h, x] = (0, i.useState)(!1),
|
|
[b, y] = (0, i.useState)(null),
|
|
j = (0, i.useMemo)(() => {
|
|
let e = d?.properties,
|
|
t = eh.find(({ key: t }) => e?.[t]?.maxCount && e[t].maxCount > 0),
|
|
r = t ? e?.[t.key] : void 0;
|
|
return t && r
|
|
? { type: t.type, label: r.displayName, maxCount: r.maxCount }
|
|
: { type: "style", label: "风格", maxCount: 0 };
|
|
}, [d?.properties]),
|
|
[w, N] = (0, i.useState)(j.type);
|
|
(0, i.useEffect)(() => {
|
|
j.type !== w && (N(j.type), f.length > 0 && m?.([], j.type));
|
|
}, [j.type, w, f.length, m]);
|
|
let C = f.length < j.maxCount,
|
|
S = (0, i.useCallback)(() => {
|
|
(0, ei.reportLog)({ e: "libtv.canvas.image_generator.style.click" }),
|
|
y(null),
|
|
x(!0);
|
|
}, []),
|
|
D = (0, i.useCallback)((e) => {
|
|
y(e), x(!0);
|
|
}, []),
|
|
k = (0, i.useCallback)(() => {
|
|
x(!1), y(null);
|
|
}, []),
|
|
V = (0, i.useCallback)(
|
|
(e) => {
|
|
if (b) {
|
|
let t = f.map((t) => (t.uuid === b ? e : t));
|
|
m?.(t, j.type), y(null);
|
|
} else {
|
|
let t = [...f, e];
|
|
m?.(t, j.type);
|
|
}
|
|
},
|
|
[f, m, j.type, b],
|
|
),
|
|
I = (0, i.useCallback)(
|
|
(e) => {
|
|
let t = f.filter((t) => t.uuid !== e);
|
|
m?.(t, j.type);
|
|
},
|
|
[f, m, j.type],
|
|
),
|
|
E = (0, i.useCallback)(
|
|
(e, t) => {
|
|
let r = f.map((r) => (r.uuid === e ? { ...r, weight: t } : r));
|
|
m?.(r, j.type);
|
|
},
|
|
[f, m, j.type],
|
|
),
|
|
M = (0, i.useMemo)(
|
|
() => (b ? f.filter((e) => e.uuid !== b) : f),
|
|
[f, b],
|
|
);
|
|
return (0, o.jsxs)(o.Fragment, {
|
|
children: [
|
|
(0, o.jsxs)("div", {
|
|
className: (0, eu.cn)(
|
|
"flex items-center gap-2 px-1",
|
|
g && "pointer-events-none",
|
|
),
|
|
children: [
|
|
j.maxCount > 0 &&
|
|
f.map((e) =>
|
|
(0, o.jsx)(
|
|
eg,
|
|
{
|
|
model: e,
|
|
isLora: "lora" === j.type,
|
|
onRemove: I,
|
|
onClick: () => D(e.uuid),
|
|
onWeightChange: E,
|
|
},
|
|
e.uuid,
|
|
),
|
|
),
|
|
j.maxCount > 0 &&
|
|
C &&
|
|
(0, o.jsx)(ed.ActionButton, {
|
|
iconElement:
|
|
"style" === j.type || j.label.includes("风格")
|
|
? (0, o.jsx)(em.StyleIcon, {
|
|
width: 16,
|
|
height: 16,
|
|
className: g
|
|
? "text-fg-disabled canvas-light:text-fg-disabled"
|
|
: void 0,
|
|
})
|
|
: void 0,
|
|
label: j.label,
|
|
onClick: S,
|
|
disabled: g,
|
|
}),
|
|
!e &&
|
|
d?.properties?.magic === !0 &&
|
|
(0, o.jsx)(ed.ActionButton, {
|
|
icon: "libtv:mark",
|
|
label: "标记",
|
|
active: r,
|
|
onClick: t,
|
|
className: "mark-mode-toggle",
|
|
disabled: g,
|
|
}),
|
|
!e &&
|
|
d?.properties?.focus === !0 &&
|
|
(l
|
|
? (0, o.jsx)("div", {
|
|
className: (0, eu.cn)(g && "pointer-events-none"),
|
|
children: (0, o.jsx)(ev, {
|
|
focusRegion: l,
|
|
onEdit: u,
|
|
onDelete: c,
|
|
}),
|
|
})
|
|
: (0, o.jsxs)(s.HoverCard, {
|
|
position: "top",
|
|
shadow: "md",
|
|
offset: 8,
|
|
openDelay: 200,
|
|
closeDelay: 150,
|
|
withinPortal: !0,
|
|
children: [
|
|
(0, o.jsx)(s.HoverCard.Target, {
|
|
children: (0, o.jsx)("div", {
|
|
className: (0, eu.cn)(
|
|
"inline-block shrink-0 bg-transparent",
|
|
g && "pointer-events-none",
|
|
),
|
|
children: (0, o.jsx)(ed.ActionButton, {
|
|
icon: "libtv:focus",
|
|
label: "聚焦",
|
|
active: a,
|
|
onClick: n,
|
|
className: "focus-mode-toggle",
|
|
disabled: g,
|
|
}),
|
|
}),
|
|
}),
|
|
(0, o.jsx)(s.HoverCard.Dropdown, {
|
|
className: (0, eu.cn)(
|
|
"border-hair rounded-xl p-2 shadow-lg backdrop-blur-md",
|
|
"light" === v
|
|
? "canvas-light border-border-muted bg-white! shadow-[0px_4px_10px_rgba(0,0,0,0.08),0px_2px_4px_rgba(0,0,0,0.06)]"
|
|
: "border-border-muted bg-panel-background/95",
|
|
),
|
|
children: (0, o.jsx)("div", {
|
|
className: "flex flex-col gap-1.5",
|
|
children: (0, o.jsx)(ep, {}),
|
|
}),
|
|
}),
|
|
],
|
|
})),
|
|
],
|
|
}),
|
|
j.maxCount > 0 &&
|
|
(0, o.jsx)(ef.default, {
|
|
open: h,
|
|
onClose: k,
|
|
fineTuneType: j.type,
|
|
selectedModels: M,
|
|
maxCount: j.maxCount,
|
|
onSelect: V,
|
|
onDeselect: I,
|
|
modelSchema: d,
|
|
nodeId: p,
|
|
replacingUuid: b,
|
|
}),
|
|
],
|
|
});
|
|
}
|
|
e.s(["default", () => ex], 711694);
|
|
};
|
|
|
|
export default moduleFactory;
|