@veevarts/design-system 1.8.0-dev.3 → 1.8.0-dev.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +8 -8
- package/dist/index.js +536 -533
- package/dist/patterns/DonationAmounts/types.d.ts +5 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as u, jsxs as A, Fragment as
|
|
1
|
+
import { jsx as u, jsxs as A, Fragment as Qe } from "react/jsx-runtime";
|
|
2
2
|
import { HeroUIProvider as ml, Button as gl, cn as L, Select as pi, SelectItem as mi, Alert as In, Card as Me, CardBody as Pe, Divider as As, Tooltip as Mt, Dropdown as Ns, DropdownTrigger as Es, DropdownMenu as Ts, DropdownItem as Ms, Input as ur, Popover as Os, PopoverTrigger as Is, PopoverContent as Ds, ButtonGroup as yl, useInput as bl, NumberInput as Ls, CardHeader as Fs, Image as xl, CardFooter as vl, Chip as gi, Skeleton as be, Autocomplete as kl, AutocompleteItem as Sl, Checkbox as Cl, Switch as wl } from "@heroui/react";
|
|
3
3
|
export * from "@heroui/react";
|
|
4
|
-
import _, { forwardRef as tn, useState as J, useRef as Dt, useEffect as
|
|
4
|
+
import _, { forwardRef as tn, useState as J, useRef as Dt, useEffect as We, useReducer as Al, useCallback as ce, useMemo as ot, createElement as dr, useId as Nl } from "react";
|
|
5
5
|
import { Globe as yi, User as bi, Heading as Ps, Check as Rs, ListTodo as $s, ListOrdered as Vs, List as Pr, AlignJustify as El, AlignRight as Tl, AlignCenter as Ml, AlignLeft as zs, CornerDownLeft as Ol, Redo2 as Il, Undo2 as Dl, Eraser as xi, Minus as Ll, Quote as Fl, CodeSquare as Pl, FileText as Rl, Link2 as $l, Highlighter as Bs, Palette as _s, Code as Vl, Underline as zl, Strikethrough as Bl, Italic as _l, Bold as Hl, X as Ul, ZoomOut as ql, ZoomIn as Kl, Link as jl, Clock as vi, CheckCircle as Wl, AlertCircle as Jl } from "lucide-react";
|
|
6
6
|
import { LazyMotion as Gl, domAnimation as Zl, m as fr, motion as hr, AnimatePresence as pr } from "framer-motion";
|
|
7
7
|
import { EditorProvider as Ql, useCurrentEditor as Hs } from "@tiptap/react";
|
|
8
|
-
import { getMarkRange as ki, Mark as nn, markPasteRule as Lt, markInputRule as Ft, mergeAttributes as
|
|
8
|
+
import { getMarkRange as ki, Mark as nn, markPasteRule as Lt, markInputRule as Ft, mergeAttributes as Ne, Node as Ue, textblockTypeInputRule as mr, wrappingInputRule as Wt, nodeInputRule as Yl, canInsertNode as Xl, isNodeSelection as ea, Extension as Rr, callOrReturn as ta, getExtensionField as na } from "@tiptap/core";
|
|
9
9
|
import { Underline as ra } from "@tiptap/extension-underline";
|
|
10
10
|
import { Color as ia } from "@tiptap/extension-color";
|
|
11
11
|
import { Highlight as sa } from "@tiptap/extension-highlight";
|
|
@@ -181,7 +181,7 @@ const ha = typeof document < "u" ? (Kn = _.useInsertionEffect) !== null && Kn !=
|
|
|
181
181
|
};
|
|
182
182
|
function $r(t, e, n) {
|
|
183
183
|
let [r, i] = J(t || e), s = Dt(r), o = Dt(t !== void 0), l = t !== void 0;
|
|
184
|
-
|
|
184
|
+
We(() => {
|
|
185
185
|
let f = o.current;
|
|
186
186
|
f !== l && process.env.NODE_ENV !== "production" && console.warn(`WARN: A component changed from ${f ? "controlled" : "uncontrolled"} to ${l ? "controlled" : "uncontrolled"}.`), o.current = l;
|
|
187
187
|
}, [
|
|
@@ -408,7 +408,7 @@ function yh() {
|
|
|
408
408
|
);
|
|
409
409
|
}
|
|
410
410
|
const bh = (t) => {
|
|
411
|
-
const e =
|
|
411
|
+
const e = ot(
|
|
412
412
|
() => JSON.stringify({ allItems: t.allItems, selected: t.selected }),
|
|
413
413
|
[t.allItems, t.selected]
|
|
414
414
|
);
|
|
@@ -424,7 +424,7 @@ const bh = (t) => {
|
|
|
424
424
|
null
|
|
425
425
|
), [f, m] = J(
|
|
426
426
|
null
|
|
427
|
-
), p =
|
|
427
|
+
), p = ot(() => new Set(e), [e]), k = ot(() => new Set(t), [t]), y = ot(
|
|
428
428
|
() => t.filter((R) => !p.has(R)),
|
|
429
429
|
[t, p]
|
|
430
430
|
), b = (R) => {
|
|
@@ -455,7 +455,7 @@ const bh = (t) => {
|
|
|
455
455
|
o(
|
|
456
456
|
$ ? s.filter((U) => U !== R) : [...s, R]
|
|
457
457
|
), a([]), d(M);
|
|
458
|
-
},
|
|
458
|
+
}, z = (R, M, P) => {
|
|
459
459
|
if (P && f !== null) {
|
|
460
460
|
a(E(e, f, M)), o([]), m(M);
|
|
461
461
|
return;
|
|
@@ -464,7 +464,7 @@ const bh = (t) => {
|
|
|
464
464
|
a(
|
|
465
465
|
$ ? l.filter((U) => U !== R) : [...l, R]
|
|
466
466
|
), o([]), m(M);
|
|
467
|
-
},
|
|
467
|
+
}, V = (R, M, P) => {
|
|
468
468
|
const $ = P === "available" ? s.includes(M) ? s : [M] : l.includes(M) ? l : [M];
|
|
469
469
|
R.dataTransfer.setData(
|
|
470
470
|
"text/plain",
|
|
@@ -506,7 +506,7 @@ const bh = (t) => {
|
|
|
506
506
|
$.shiftKey && $.preventDefault();
|
|
507
507
|
},
|
|
508
508
|
draggable: !0,
|
|
509
|
-
onDragStart: ($) =>
|
|
509
|
+
onDragStart: ($) => V($, R, "available"),
|
|
510
510
|
className: `rounded-md px-3 py-2 text-left text-sm transition ${P ? "bg-[#E4571E]/10 text-[#E4571E]" : "text-gray-700 hover:bg-gray-100"}`,
|
|
511
511
|
children: R
|
|
512
512
|
},
|
|
@@ -585,13 +585,13 @@ const bh = (t) => {
|
|
|
585
585
|
{
|
|
586
586
|
type: "button",
|
|
587
587
|
onClick: ($) => {
|
|
588
|
-
|
|
588
|
+
z(R, M, $.shiftKey);
|
|
589
589
|
},
|
|
590
590
|
onMouseDown: ($) => {
|
|
591
591
|
$.shiftKey && $.preventDefault();
|
|
592
592
|
},
|
|
593
593
|
draggable: !0,
|
|
594
|
-
onDragStart: ($) =>
|
|
594
|
+
onDragStart: ($) => V($, R, "selected"),
|
|
595
595
|
className: `rounded-md px-3 py-2 text-left text-sm transition ${P ? "bg-[#E4571E]/10 text-[#E4571E]" : "text-gray-700 hover:bg-gray-100"}`,
|
|
596
596
|
children: R
|
|
597
597
|
},
|
|
@@ -636,7 +636,7 @@ function ft({
|
|
|
636
636
|
}
|
|
637
637
|
) });
|
|
638
638
|
}
|
|
639
|
-
const
|
|
639
|
+
const Xe = {
|
|
640
640
|
// ============================================================
|
|
641
641
|
// INLINE MARKS (Marcas)
|
|
642
642
|
// ============================================================
|
|
@@ -831,7 +831,7 @@ function ba({ editor: t, levels: e = [1, 2, 3, 4, 5, 6], isDisabled: n = !1 }) {
|
|
|
831
831
|
};
|
|
832
832
|
}, [t]);
|
|
833
833
|
const i = e.find((o) => t.isActive("heading", { level: o })), s = (o) => {
|
|
834
|
-
const l = Number(o), a =
|
|
834
|
+
const l = Number(o), a = Xe.heading;
|
|
835
835
|
a && a.execute({
|
|
836
836
|
editor: t,
|
|
837
837
|
config: { type: "heading", level: l }
|
|
@@ -918,7 +918,7 @@ function xa({
|
|
|
918
918
|
selectionMode: "single",
|
|
919
919
|
selectedKeys: i ? /* @__PURE__ */ new Set([i]) : /* @__PURE__ */ new Set(),
|
|
920
920
|
onAction: (l) => {
|
|
921
|
-
const c =
|
|
921
|
+
const c = Xe[l];
|
|
922
922
|
c && c.execute({ editor: t });
|
|
923
923
|
},
|
|
924
924
|
children: e.map((l) => {
|
|
@@ -1125,7 +1125,7 @@ function Aa({ value: t, onChange: e, onApply: n, placeholder: r = "#000000" }) {
|
|
|
1125
1125
|
}
|
|
1126
1126
|
function Ci({ editor: t, type: e, allowCustomColor: n = !0, label: r, isDisabled: i = !1 }) {
|
|
1127
1127
|
const [s, o] = J(!1), [l, a] = J(""), c = e === "textColor" ? ka : Sa, d = (y) => {
|
|
1128
|
-
const b =
|
|
1128
|
+
const b = Xe[e];
|
|
1129
1129
|
b && b.execute({
|
|
1130
1130
|
editor: t,
|
|
1131
1131
|
config: { type: e, color: y }
|
|
@@ -1133,7 +1133,7 @@ function Ci({ editor: t, type: e, allowCustomColor: n = !0, label: r, isDisabled
|
|
|
1133
1133
|
}, f = (y) => {
|
|
1134
1134
|
d(y);
|
|
1135
1135
|
}, m = () => {
|
|
1136
|
-
const y =
|
|
1136
|
+
const y = Xe[e];
|
|
1137
1137
|
y && y.execute({
|
|
1138
1138
|
editor: t,
|
|
1139
1139
|
config: { type: e, color: "" }
|
|
@@ -1169,7 +1169,7 @@ function Ci({ editor: t, type: e, allowCustomColor: n = !0, label: r, isDisabled
|
|
|
1169
1169
|
)
|
|
1170
1170
|
] }),
|
|
1171
1171
|
/* @__PURE__ */ u(va, { colors: c, onColorSelect: d }),
|
|
1172
|
-
n && /* @__PURE__ */ A(
|
|
1172
|
+
n && /* @__PURE__ */ A(Qe, { children: [
|
|
1173
1173
|
/* @__PURE__ */ u(As, {}),
|
|
1174
1174
|
/* @__PURE__ */ A("div", { children: [
|
|
1175
1175
|
/* @__PURE__ */ u("p", { className: "text-xs font-semibold mb-2 text-default-700", children: "Custom Color" }),
|
|
@@ -1334,12 +1334,12 @@ function Ta({ children: t, id: e, label: n, className: r, useButtonGroup: i = !0
|
|
|
1334
1334
|
return i ? /* @__PURE__ */ u(yl, { size: "sm", id: e, "aria-label": n, className: r, children: t }) : /* @__PURE__ */ u("div", { id: e, role: "group", "aria-label": n, className: `flex items-center gap-2 ${r || ""}`, children: t });
|
|
1335
1335
|
}
|
|
1336
1336
|
function Us(t, e) {
|
|
1337
|
-
const n =
|
|
1337
|
+
const n = ot(() => {
|
|
1338
1338
|
if (!t)
|
|
1339
1339
|
return {};
|
|
1340
1340
|
const s = {};
|
|
1341
1341
|
return Array.from(new Set(e.map((l) => Jt(l)))).forEach((l) => {
|
|
1342
|
-
const a =
|
|
1342
|
+
const a = Xe[l];
|
|
1343
1343
|
if (a)
|
|
1344
1344
|
try {
|
|
1345
1345
|
const c = a.canExecute?.(t) ?? !0, d = a.isActive?.(t) ?? !1;
|
|
@@ -1357,13 +1357,13 @@ function Us(t, e) {
|
|
|
1357
1357
|
}
|
|
1358
1358
|
}), s;
|
|
1359
1359
|
}, [t, e]), [r, i] = J(n);
|
|
1360
|
-
return
|
|
1360
|
+
return We(() => {
|
|
1361
1361
|
if (!t)
|
|
1362
1362
|
return;
|
|
1363
1363
|
const s = () => {
|
|
1364
1364
|
const o = {};
|
|
1365
1365
|
Array.from(new Set(e.map((a) => Jt(a)))).forEach((a) => {
|
|
1366
|
-
const c =
|
|
1366
|
+
const c = Xe[a];
|
|
1367
1367
|
if (c)
|
|
1368
1368
|
try {
|
|
1369
1369
|
const d = c.canExecute?.(t) ?? !0, f = c.isActive?.(t) ?? !1;
|
|
@@ -1390,7 +1390,7 @@ function qs(t, e) {
|
|
|
1390
1390
|
const n = ce(
|
|
1391
1391
|
(o, l) => {
|
|
1392
1392
|
if (!t) return;
|
|
1393
|
-
const a =
|
|
1393
|
+
const a = Xe[o];
|
|
1394
1394
|
if (a)
|
|
1395
1395
|
try {
|
|
1396
1396
|
a.execute({ editor: t, config: l }), e?.({ type: "toggle", modifier: o });
|
|
@@ -1407,7 +1407,7 @@ function qs(t, e) {
|
|
|
1407
1407
|
), i = ce(
|
|
1408
1408
|
(o, l) => {
|
|
1409
1409
|
if (!t) return !1;
|
|
1410
|
-
const a =
|
|
1410
|
+
const a = Xe[o];
|
|
1411
1411
|
try {
|
|
1412
1412
|
return a?.canExecute?.(t, l) ?? !1;
|
|
1413
1413
|
} catch (c) {
|
|
@@ -1418,7 +1418,7 @@ function qs(t, e) {
|
|
|
1418
1418
|
), s = ce(
|
|
1419
1419
|
(o, l) => {
|
|
1420
1420
|
if (!t) return !1;
|
|
1421
|
-
const a =
|
|
1421
|
+
const a = Xe[o];
|
|
1422
1422
|
try {
|
|
1423
1423
|
return a?.isActive?.(t, l) ?? !1;
|
|
1424
1424
|
} catch (c) {
|
|
@@ -1494,7 +1494,7 @@ function Da({
|
|
|
1494
1494
|
if (!t) return null;
|
|
1495
1495
|
const d = e.map((T) => Jt(T)), f = d.some((T) => ["bold", "italic", "strike", "underline", "code"].includes(T)), m = d.some((T) => ["textColor", "highlight"].includes(T)), p = d.includes("heading"), k = d.includes("textAlign"), y = d.some((T) => ["bulletList", "orderedList", "taskList"].includes(T)), b = d.includes("blockquote"), v = d.includes("codeBlock"), C = d.includes("link"), I = d.includes("horizontalRule"), S = d.some((T) => ["undo", "redo"].includes(T)), w = n !== void 0 && r !== void 0;
|
|
1496
1496
|
return /* @__PURE__ */ u("div", { className: `w-full p-2 bg-background border-b border-divider ${i ? "sticky top-0 z-10" : ""} ${s || ""}`, children: /* @__PURE__ */ A("div", { className: "flex flex-row flex-wrap gap-2 w-full items-center", children: [
|
|
1497
|
-
f && /* @__PURE__ */ A(
|
|
1497
|
+
f && /* @__PURE__ */ A(Qe, { children: [
|
|
1498
1498
|
/* @__PURE__ */ u(
|
|
1499
1499
|
Ia,
|
|
1500
1500
|
{
|
|
@@ -1505,7 +1505,7 @@ function Da({
|
|
|
1505
1505
|
),
|
|
1506
1506
|
(m || p || k || y || b || v || C || I || S || w) && /* @__PURE__ */ u(dt, {})
|
|
1507
1507
|
] }),
|
|
1508
|
-
m && /* @__PURE__ */ A(
|
|
1508
|
+
m && /* @__PURE__ */ A(Qe, { children: [
|
|
1509
1509
|
/* @__PURE__ */ A("div", { className: "flex items-center gap-1", children: [
|
|
1510
1510
|
d.includes("textColor") && /* @__PURE__ */ u(
|
|
1511
1511
|
Ci,
|
|
@@ -1528,19 +1528,19 @@ function Da({
|
|
|
1528
1528
|
] }),
|
|
1529
1529
|
(p || k || y || b || v || C || I || S || w) && /* @__PURE__ */ u(dt, {})
|
|
1530
1530
|
] }),
|
|
1531
|
-
p && /* @__PURE__ */ A(
|
|
1531
|
+
p && /* @__PURE__ */ A(Qe, { children: [
|
|
1532
1532
|
/* @__PURE__ */ u(ba, { editor: t }),
|
|
1533
1533
|
(k || y || b || v || C || I || S || w) && /* @__PURE__ */ u(dt, {})
|
|
1534
1534
|
] }),
|
|
1535
|
-
k && /* @__PURE__ */ A(
|
|
1535
|
+
k && /* @__PURE__ */ A(Qe, { children: [
|
|
1536
1536
|
/* @__PURE__ */ u("div", { className: "flex items-center gap-1", children: ["left", "center", "right", "justify"].map((T) => {
|
|
1537
|
-
const
|
|
1537
|
+
const z = wa[T], V = t.isActive({ textAlign: T });
|
|
1538
1538
|
return /* @__PURE__ */ u(
|
|
1539
1539
|
ft,
|
|
1540
1540
|
{
|
|
1541
|
-
icon:
|
|
1541
|
+
icon: z,
|
|
1542
1542
|
label: `Align ${T}`,
|
|
1543
|
-
isActive:
|
|
1543
|
+
isActive: V,
|
|
1544
1544
|
onClick: () => c("textAlign", {
|
|
1545
1545
|
type: "textAlign",
|
|
1546
1546
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -1552,7 +1552,7 @@ function Da({
|
|
|
1552
1552
|
}) }),
|
|
1553
1553
|
(y || b || v || C || I || S || w) && /* @__PURE__ */ u(dt, {})
|
|
1554
1554
|
] }),
|
|
1555
|
-
y && /* @__PURE__ */ A(
|
|
1555
|
+
y && /* @__PURE__ */ A(Qe, { children: [
|
|
1556
1556
|
/* @__PURE__ */ u(
|
|
1557
1557
|
xa,
|
|
1558
1558
|
{
|
|
@@ -1564,7 +1564,7 @@ function Da({
|
|
|
1564
1564
|
),
|
|
1565
1565
|
(b || v || C || I || S || w) && /* @__PURE__ */ u(dt, {})
|
|
1566
1566
|
] }),
|
|
1567
|
-
(b || v || C || I) && /* @__PURE__ */ A(
|
|
1567
|
+
(b || v || C || I) && /* @__PURE__ */ A(Qe, { children: [
|
|
1568
1568
|
/* @__PURE__ */ A("div", { className: "flex items-center gap-1", children: [
|
|
1569
1569
|
b && /* @__PURE__ */ u(
|
|
1570
1570
|
ft,
|
|
@@ -1604,7 +1604,7 @@ function Da({
|
|
|
1604
1604
|
] }),
|
|
1605
1605
|
(S || w) && /* @__PURE__ */ u(dt, {})
|
|
1606
1606
|
] }),
|
|
1607
|
-
S && /* @__PURE__ */ A(
|
|
1607
|
+
S && /* @__PURE__ */ A(Qe, { children: [
|
|
1608
1608
|
/* @__PURE__ */ A("div", { className: "flex items-center gap-1", children: [
|
|
1609
1609
|
d.includes("undo") && /* @__PURE__ */ u(
|
|
1610
1610
|
ft,
|
|
@@ -1665,7 +1665,7 @@ const La = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Fa = /(?:^|\s
|
|
|
1665
1665
|
];
|
|
1666
1666
|
},
|
|
1667
1667
|
renderHTML({ HTMLAttributes: t }) {
|
|
1668
|
-
return ["strong",
|
|
1668
|
+
return ["strong", Ne(this.options.HTMLAttributes, t), 0];
|
|
1669
1669
|
},
|
|
1670
1670
|
addCommands() {
|
|
1671
1671
|
return {
|
|
@@ -1730,7 +1730,7 @@ const La = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Fa = /(?:^|\s
|
|
|
1730
1730
|
];
|
|
1731
1731
|
},
|
|
1732
1732
|
renderHTML({ HTMLAttributes: t }) {
|
|
1733
|
-
return ["em",
|
|
1733
|
+
return ["em", Ne(this.options.HTMLAttributes, t), 0];
|
|
1734
1734
|
},
|
|
1735
1735
|
addCommands() {
|
|
1736
1736
|
return {
|
|
@@ -1795,7 +1795,7 @@ const La = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Fa = /(?:^|\s
|
|
|
1795
1795
|
];
|
|
1796
1796
|
},
|
|
1797
1797
|
renderHTML({ HTMLAttributes: t }) {
|
|
1798
|
-
return ["s",
|
|
1798
|
+
return ["s", Ne(this.options.HTMLAttributes, t), 0];
|
|
1799
1799
|
},
|
|
1800
1800
|
addCommands() {
|
|
1801
1801
|
return {
|
|
@@ -1841,7 +1841,7 @@ const La = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Fa = /(?:^|\s
|
|
|
1841
1841
|
];
|
|
1842
1842
|
},
|
|
1843
1843
|
renderHTML({ HTMLAttributes: t }) {
|
|
1844
|
-
return ["code",
|
|
1844
|
+
return ["code", Ne(this.options.HTMLAttributes, t), 0];
|
|
1845
1845
|
},
|
|
1846
1846
|
addCommands() {
|
|
1847
1847
|
return {
|
|
@@ -1898,7 +1898,7 @@ const La = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Fa = /(?:^|\s
|
|
|
1898
1898
|
];
|
|
1899
1899
|
},
|
|
1900
1900
|
renderHTML({ HTMLAttributes: t }) {
|
|
1901
|
-
return ["span",
|
|
1901
|
+
return ["span", Ne(this.options.HTMLAttributes, t), 0];
|
|
1902
1902
|
},
|
|
1903
1903
|
addCommands() {
|
|
1904
1904
|
return {
|
|
@@ -1912,7 +1912,7 @@ const La = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Fa = /(?:^|\s
|
|
|
1912
1912
|
}
|
|
1913
1913
|
};
|
|
1914
1914
|
}
|
|
1915
|
-
}), Qa =
|
|
1915
|
+
}), Qa = Ue.create({
|
|
1916
1916
|
name: "heading",
|
|
1917
1917
|
addOptions() {
|
|
1918
1918
|
return {
|
|
@@ -1938,7 +1938,7 @@ const La = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Fa = /(?:^|\s
|
|
|
1938
1938
|
}));
|
|
1939
1939
|
},
|
|
1940
1940
|
renderHTML({ node: t, HTMLAttributes: e }) {
|
|
1941
|
-
return [`h${this.options.levels.includes(t.attrs.level) ? t.attrs.level : this.options.levels[0]}`,
|
|
1941
|
+
return [`h${this.options.levels.includes(t.attrs.level) ? t.attrs.level : this.options.levels[0]}`, Ne(this.options.HTMLAttributes, e), 0];
|
|
1942
1942
|
},
|
|
1943
1943
|
addCommands() {
|
|
1944
1944
|
return {
|
|
@@ -1961,7 +1961,7 @@ const La = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Fa = /(?:^|\s
|
|
|
1961
1961
|
}
|
|
1962
1962
|
}));
|
|
1963
1963
|
}
|
|
1964
|
-
}), Ya =
|
|
1964
|
+
}), Ya = Ue.create({
|
|
1965
1965
|
name: "paragraph",
|
|
1966
1966
|
priority: 1e3,
|
|
1967
1967
|
addOptions() {
|
|
@@ -1977,7 +1977,7 @@ const La = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Fa = /(?:^|\s
|
|
|
1977
1977
|
];
|
|
1978
1978
|
},
|
|
1979
1979
|
renderHTML({ HTMLAttributes: t }) {
|
|
1980
|
-
return ["p",
|
|
1980
|
+
return ["p", Ne(this.options.HTMLAttributes, t), 0];
|
|
1981
1981
|
},
|
|
1982
1982
|
addCommands() {
|
|
1983
1983
|
return {
|
|
@@ -1989,7 +1989,7 @@ const La = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Fa = /(?:^|\s
|
|
|
1989
1989
|
"Mod-Alt-0": () => this.editor.commands.setParagraph()
|
|
1990
1990
|
};
|
|
1991
1991
|
}
|
|
1992
|
-
}), Xa = "listItem", wi = "textStyle", Ai = /^\s*([-+*])\s$/, ec =
|
|
1992
|
+
}), Xa = "listItem", wi = "textStyle", Ai = /^\s*([-+*])\s$/, ec = Ue.create({
|
|
1993
1993
|
name: "bulletList",
|
|
1994
1994
|
addOptions() {
|
|
1995
1995
|
return {
|
|
@@ -2009,7 +2009,7 @@ const La = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Fa = /(?:^|\s
|
|
|
2009
2009
|
];
|
|
2010
2010
|
},
|
|
2011
2011
|
renderHTML({ HTMLAttributes: t }) {
|
|
2012
|
-
return ["ul",
|
|
2012
|
+
return ["ul", Ne(this.options.HTMLAttributes, t), 0];
|
|
2013
2013
|
},
|
|
2014
2014
|
addCommands() {
|
|
2015
2015
|
return {
|
|
@@ -2037,7 +2037,7 @@ const La = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Fa = /(?:^|\s
|
|
|
2037
2037
|
t
|
|
2038
2038
|
];
|
|
2039
2039
|
}
|
|
2040
|
-
}), tc = "listItem", Ni = "textStyle", Ei = /^(\d+)\.\s$/, nc =
|
|
2040
|
+
}), tc = "listItem", Ni = "textStyle", Ei = /^(\d+)\.\s$/, nc = Ue.create({
|
|
2041
2041
|
name: "orderedList",
|
|
2042
2042
|
addOptions() {
|
|
2043
2043
|
return {
|
|
@@ -2072,7 +2072,7 @@ const La = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Fa = /(?:^|\s
|
|
|
2072
2072
|
},
|
|
2073
2073
|
renderHTML({ HTMLAttributes: t }) {
|
|
2074
2074
|
const { start: e, ...n } = t;
|
|
2075
|
-
return e === 1 ? ["ol",
|
|
2075
|
+
return e === 1 ? ["ol", Ne(this.options.HTMLAttributes, n), 0] : ["ol", Ne(this.options.HTMLAttributes, t), 0];
|
|
2076
2076
|
},
|
|
2077
2077
|
addCommands() {
|
|
2078
2078
|
return {
|
|
@@ -2103,7 +2103,7 @@ const La = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Fa = /(?:^|\s
|
|
|
2103
2103
|
t
|
|
2104
2104
|
];
|
|
2105
2105
|
}
|
|
2106
|
-
}), rc =
|
|
2106
|
+
}), rc = Ue.create({
|
|
2107
2107
|
name: "listItem",
|
|
2108
2108
|
addOptions() {
|
|
2109
2109
|
return {
|
|
@@ -2122,7 +2122,7 @@ const La = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Fa = /(?:^|\s
|
|
|
2122
2122
|
];
|
|
2123
2123
|
},
|
|
2124
2124
|
renderHTML({ HTMLAttributes: t }) {
|
|
2125
|
-
return ["li",
|
|
2125
|
+
return ["li", Ne(this.options.HTMLAttributes, t), 0];
|
|
2126
2126
|
},
|
|
2127
2127
|
addKeyboardShortcuts() {
|
|
2128
2128
|
return {
|
|
@@ -3850,7 +3850,7 @@ class Zt extends ke {
|
|
|
3850
3850
|
}
|
|
3851
3851
|
}
|
|
3852
3852
|
ke.jsonID("removeNodeMark", Zt);
|
|
3853
|
-
class
|
|
3853
|
+
class Ye extends ke {
|
|
3854
3854
|
/**
|
|
3855
3855
|
The given `slice` should fit the 'gap' between `from` and
|
|
3856
3856
|
`to`—the depths must line up, and the surrounding nodes must be
|
|
@@ -3870,21 +3870,21 @@ class Qe extends ke {
|
|
|
3870
3870
|
return new De([this.from, this.to - this.from, this.slice.size]);
|
|
3871
3871
|
}
|
|
3872
3872
|
invert(e) {
|
|
3873
|
-
return new
|
|
3873
|
+
return new Ye(this.from, this.from + this.slice.size, e.slice(this.from, this.to));
|
|
3874
3874
|
}
|
|
3875
3875
|
map(e) {
|
|
3876
3876
|
let n = e.mapResult(this.from, 1), r = e.mapResult(this.to, -1);
|
|
3877
|
-
return n.deletedAcross && r.deletedAcross ? null : new
|
|
3877
|
+
return n.deletedAcross && r.deletedAcross ? null : new Ye(n.pos, Math.max(n.pos, r.pos), this.slice, this.structure);
|
|
3878
3878
|
}
|
|
3879
3879
|
merge(e) {
|
|
3880
|
-
if (!(e instanceof
|
|
3880
|
+
if (!(e instanceof Ye) || e.structure || this.structure)
|
|
3881
3881
|
return null;
|
|
3882
3882
|
if (this.from + this.slice.size == e.from && !this.slice.openEnd && !e.slice.openStart) {
|
|
3883
3883
|
let n = this.slice.size + e.slice.size == 0 ? K.empty : new K(this.slice.content.append(e.slice.content), this.slice.openStart, e.slice.openEnd);
|
|
3884
|
-
return new
|
|
3884
|
+
return new Ye(this.from, this.to + (e.to - e.from), n, this.structure);
|
|
3885
3885
|
} else if (e.to == this.from && !this.slice.openStart && !e.slice.openEnd) {
|
|
3886
3886
|
let n = this.slice.size + e.slice.size == 0 ? K.empty : new K(e.slice.content.append(this.slice.content), e.slice.openStart, this.slice.openEnd);
|
|
3887
|
-
return new
|
|
3887
|
+
return new Ye(e.from, this.to, n, this.structure);
|
|
3888
3888
|
} else
|
|
3889
3889
|
return null;
|
|
3890
3890
|
}
|
|
@@ -3898,10 +3898,10 @@ class Qe extends ke {
|
|
|
3898
3898
|
static fromJSON(e, n) {
|
|
3899
3899
|
if (typeof n.from != "number" || typeof n.to != "number")
|
|
3900
3900
|
throw new RangeError("Invalid input for ReplaceStep.fromJSON");
|
|
3901
|
-
return new
|
|
3901
|
+
return new Ye(n.from, n.to, K.fromJSON(e, n.slice), !!n.structure);
|
|
3902
3902
|
}
|
|
3903
3903
|
}
|
|
3904
|
-
ke.jsonID("replace",
|
|
3904
|
+
ke.jsonID("replace", Ye);
|
|
3905
3905
|
class Ot extends ke {
|
|
3906
3906
|
/**
|
|
3907
3907
|
Create a replace-around step with the given range and gap.
|
|
@@ -4077,7 +4077,7 @@ Qt.prototype = Object.create(Error.prototype);
|
|
|
4077
4077
|
Qt.prototype.constructor = Qt;
|
|
4078
4078
|
Qt.prototype.name = "TransformError";
|
|
4079
4079
|
const Qn = /* @__PURE__ */ Object.create(null);
|
|
4080
|
-
class
|
|
4080
|
+
class Y {
|
|
4081
4081
|
/**
|
|
4082
4082
|
Initialize a selection with the head and anchor and ranges. If no
|
|
4083
4083
|
ranges are given, constructs a single range across `$anchor` and
|
|
@@ -4171,7 +4171,7 @@ class X {
|
|
|
4171
4171
|
found.
|
|
4172
4172
|
*/
|
|
4173
4173
|
static findFrom(e, n, r = !1) {
|
|
4174
|
-
let i = e.parent.inlineContent ? new
|
|
4174
|
+
let i = e.parent.inlineContent ? new Q(e) : Nt(e.node(0), e.parent, e.pos, e.index(), n, r);
|
|
4175
4175
|
if (i)
|
|
4176
4176
|
return i;
|
|
4177
4177
|
for (let s = e.depth - 1; s >= 0; s--) {
|
|
@@ -4187,7 +4187,7 @@ class X {
|
|
|
4187
4187
|
negative, it will search backwards first.
|
|
4188
4188
|
*/
|
|
4189
4189
|
static near(e, n = 1) {
|
|
4190
|
-
return this.findFrom(e, n) || this.findFrom(e, -n) || new
|
|
4190
|
+
return this.findFrom(e, n) || this.findFrom(e, -n) || new Je(e.node(0));
|
|
4191
4191
|
}
|
|
4192
4192
|
/**
|
|
4193
4193
|
Find the cursor or leaf node selection closest to the start of
|
|
@@ -4196,14 +4196,14 @@ class X {
|
|
|
4196
4196
|
exists.
|
|
4197
4197
|
*/
|
|
4198
4198
|
static atStart(e) {
|
|
4199
|
-
return Nt(e, e, 0, 0, 1) || new
|
|
4199
|
+
return Nt(e, e, 0, 0, 1) || new Je(e);
|
|
4200
4200
|
}
|
|
4201
4201
|
/**
|
|
4202
4202
|
Find the cursor or leaf node selection closest to the end of the
|
|
4203
4203
|
given document.
|
|
4204
4204
|
*/
|
|
4205
4205
|
static atEnd(e) {
|
|
4206
|
-
return Nt(e, e, e.content.size, e.childCount, -1) || new
|
|
4206
|
+
return Nt(e, e, e.content.size, e.childCount, -1) || new Je(e);
|
|
4207
4207
|
}
|
|
4208
4208
|
/**
|
|
4209
4209
|
Deserialize the JSON representation of a selection. Must be
|
|
@@ -4238,10 +4238,10 @@ class X {
|
|
|
4238
4238
|
returns the bookmark for that.
|
|
4239
4239
|
*/
|
|
4240
4240
|
getBookmark() {
|
|
4241
|
-
return
|
|
4241
|
+
return Q.between(this.$anchor, this.$head).getBookmark();
|
|
4242
4242
|
}
|
|
4243
4243
|
}
|
|
4244
|
-
|
|
4244
|
+
Y.prototype.visible = !0;
|
|
4245
4245
|
class pc {
|
|
4246
4246
|
/**
|
|
4247
4247
|
Create a range.
|
|
@@ -4254,7 +4254,7 @@ let Pi = !1;
|
|
|
4254
4254
|
function Ri(t) {
|
|
4255
4255
|
!Pi && !t.parent.inlineContent && (Pi = !0, console.warn("TextSelection endpoint not pointing into a node with inline content (" + t.parent.type.name + ")"));
|
|
4256
4256
|
}
|
|
4257
|
-
class
|
|
4257
|
+
class Q extends Y {
|
|
4258
4258
|
/**
|
|
4259
4259
|
Construct a text selection between the given points.
|
|
4260
4260
|
*/
|
|
@@ -4271,9 +4271,9 @@ class Y extends X {
|
|
|
4271
4271
|
map(e, n) {
|
|
4272
4272
|
let r = e.resolve(n.map(this.head));
|
|
4273
4273
|
if (!r.parent.inlineContent)
|
|
4274
|
-
return
|
|
4274
|
+
return Y.near(r);
|
|
4275
4275
|
let i = e.resolve(n.map(this.anchor));
|
|
4276
|
-
return new
|
|
4276
|
+
return new Q(i.parent.inlineContent ? i : r, r);
|
|
4277
4277
|
}
|
|
4278
4278
|
replace(e, n = K.empty) {
|
|
4279
4279
|
if (super.replace(e, n), n == K.empty) {
|
|
@@ -4282,7 +4282,7 @@ class Y extends X {
|
|
|
4282
4282
|
}
|
|
4283
4283
|
}
|
|
4284
4284
|
eq(e) {
|
|
4285
|
-
return e instanceof
|
|
4285
|
+
return e instanceof Q && e.anchor == this.anchor && e.head == this.head;
|
|
4286
4286
|
}
|
|
4287
4287
|
getBookmark() {
|
|
4288
4288
|
return new Ln(this.anchor, this.head);
|
|
@@ -4296,7 +4296,7 @@ class Y extends X {
|
|
|
4296
4296
|
static fromJSON(e, n) {
|
|
4297
4297
|
if (typeof n.anchor != "number" || typeof n.head != "number")
|
|
4298
4298
|
throw new RangeError("Invalid input for TextSelection.fromJSON");
|
|
4299
|
-
return new
|
|
4299
|
+
return new Q(e.resolve(n.anchor), e.resolve(n.head));
|
|
4300
4300
|
}
|
|
4301
4301
|
/**
|
|
4302
4302
|
Create a text selection from non-resolved positions.
|
|
@@ -4316,16 +4316,16 @@ class Y extends X {
|
|
|
4316
4316
|
static between(e, n, r) {
|
|
4317
4317
|
let i = e.pos - n.pos;
|
|
4318
4318
|
if ((!r || i) && (r = i >= 0 ? 1 : -1), !n.parent.inlineContent) {
|
|
4319
|
-
let s =
|
|
4319
|
+
let s = Y.findFrom(n, r, !0) || Y.findFrom(n, -r, !0);
|
|
4320
4320
|
if (s)
|
|
4321
4321
|
n = s.$head;
|
|
4322
4322
|
else
|
|
4323
|
-
return
|
|
4323
|
+
return Y.near(n, r);
|
|
4324
4324
|
}
|
|
4325
|
-
return e.parent.inlineContent || (i == 0 ? e = n : (e = (
|
|
4325
|
+
return e.parent.inlineContent || (i == 0 ? e = n : (e = (Y.findFrom(e, -r, !0) || Y.findFrom(e, r, !0)).$anchor, e.pos < n.pos != i < 0 && (e = n))), new Q(e, n);
|
|
4326
4326
|
}
|
|
4327
4327
|
}
|
|
4328
|
-
|
|
4328
|
+
Y.jsonID("text", Q);
|
|
4329
4329
|
class Ln {
|
|
4330
4330
|
constructor(e, n) {
|
|
4331
4331
|
this.anchor = e, this.head = n;
|
|
@@ -4334,10 +4334,10 @@ class Ln {
|
|
|
4334
4334
|
return new Ln(e.map(this.anchor), e.map(this.head));
|
|
4335
4335
|
}
|
|
4336
4336
|
resolve(e) {
|
|
4337
|
-
return
|
|
4337
|
+
return Q.between(e.resolve(this.anchor), e.resolve(this.head));
|
|
4338
4338
|
}
|
|
4339
4339
|
}
|
|
4340
|
-
class j extends
|
|
4340
|
+
class j extends Y {
|
|
4341
4341
|
/**
|
|
4342
4342
|
Create a node selection. Does not verify the validity of its
|
|
4343
4343
|
argument.
|
|
@@ -4348,7 +4348,7 @@ class j extends X {
|
|
|
4348
4348
|
}
|
|
4349
4349
|
map(e, n) {
|
|
4350
4350
|
let { deleted: r, pos: i } = n.mapResult(this.anchor), s = e.resolve(i);
|
|
4351
|
-
return r ?
|
|
4351
|
+
return r ? Y.near(s) : new j(s);
|
|
4352
4352
|
}
|
|
4353
4353
|
content() {
|
|
4354
4354
|
return new K(q.from(this.node), 0, 0);
|
|
@@ -4385,7 +4385,7 @@ class j extends X {
|
|
|
4385
4385
|
}
|
|
4386
4386
|
}
|
|
4387
4387
|
j.prototype.visible = !1;
|
|
4388
|
-
|
|
4388
|
+
Y.jsonID("node", j);
|
|
4389
4389
|
class zr {
|
|
4390
4390
|
constructor(e) {
|
|
4391
4391
|
this.anchor = e;
|
|
@@ -4396,10 +4396,10 @@ class zr {
|
|
|
4396
4396
|
}
|
|
4397
4397
|
resolve(e) {
|
|
4398
4398
|
let n = e.resolve(this.anchor), r = n.nodeAfter;
|
|
4399
|
-
return r && j.isSelectable(r) ? new j(n) :
|
|
4399
|
+
return r && j.isSelectable(r) ? new j(n) : Y.near(n);
|
|
4400
4400
|
}
|
|
4401
4401
|
}
|
|
4402
|
-
class
|
|
4402
|
+
class Je extends Y {
|
|
4403
4403
|
/**
|
|
4404
4404
|
Create an all-selection over the given document.
|
|
4405
4405
|
*/
|
|
@@ -4409,7 +4409,7 @@ class We extends X {
|
|
|
4409
4409
|
replace(e, n = K.empty) {
|
|
4410
4410
|
if (n == K.empty) {
|
|
4411
4411
|
e.delete(0, e.doc.content.size);
|
|
4412
|
-
let r =
|
|
4412
|
+
let r = Y.atStart(e.doc);
|
|
4413
4413
|
r.eq(e.selection) || e.setSelection(r);
|
|
4414
4414
|
} else
|
|
4415
4415
|
super.replace(e, n);
|
|
@@ -4421,30 +4421,30 @@ class We extends X {
|
|
|
4421
4421
|
@internal
|
|
4422
4422
|
*/
|
|
4423
4423
|
static fromJSON(e) {
|
|
4424
|
-
return new
|
|
4424
|
+
return new Je(e);
|
|
4425
4425
|
}
|
|
4426
4426
|
map(e) {
|
|
4427
|
-
return new
|
|
4427
|
+
return new Je(e);
|
|
4428
4428
|
}
|
|
4429
4429
|
eq(e) {
|
|
4430
|
-
return e instanceof
|
|
4430
|
+
return e instanceof Je;
|
|
4431
4431
|
}
|
|
4432
4432
|
getBookmark() {
|
|
4433
4433
|
return mc;
|
|
4434
4434
|
}
|
|
4435
4435
|
}
|
|
4436
|
-
|
|
4436
|
+
Y.jsonID("all", Je);
|
|
4437
4437
|
const mc = {
|
|
4438
4438
|
map() {
|
|
4439
4439
|
return this;
|
|
4440
4440
|
},
|
|
4441
4441
|
resolve(t) {
|
|
4442
|
-
return new
|
|
4442
|
+
return new Je(t);
|
|
4443
4443
|
}
|
|
4444
4444
|
};
|
|
4445
4445
|
function Nt(t, e, n, r, i, s = !1) {
|
|
4446
4446
|
if (e.inlineContent)
|
|
4447
|
-
return
|
|
4447
|
+
return Q.create(t, n);
|
|
4448
4448
|
for (let o = r - (i > 0 ? 0 : 1); i > 0 ? o < e.childCount : o >= 0; o += i) {
|
|
4449
4449
|
let l = e.child(o);
|
|
4450
4450
|
if (l.isAtom) {
|
|
@@ -4464,12 +4464,12 @@ function $i(t, e, n) {
|
|
|
4464
4464
|
if (r < e)
|
|
4465
4465
|
return;
|
|
4466
4466
|
let i = t.steps[r];
|
|
4467
|
-
if (!(i instanceof
|
|
4467
|
+
if (!(i instanceof Ye || i instanceof Ot))
|
|
4468
4468
|
return;
|
|
4469
4469
|
let s = t.mapping.maps[r], o;
|
|
4470
4470
|
s.forEach((l, a, c, d) => {
|
|
4471
4471
|
o == null && (o = d);
|
|
4472
|
-
}), t.setSelection(
|
|
4472
|
+
}), t.setSelection(Y.near(t.doc.resolve(o), n));
|
|
4473
4473
|
}
|
|
4474
4474
|
function Vi(t, e) {
|
|
4475
4475
|
return !e || !t ? t : t.bind(e);
|
|
@@ -4488,7 +4488,7 @@ new cn("doc", {
|
|
|
4488
4488
|
}
|
|
4489
4489
|
}), new cn("selection", {
|
|
4490
4490
|
init(t, e) {
|
|
4491
|
-
return t.selection ||
|
|
4491
|
+
return t.selection || Y.atStart(e.doc);
|
|
4492
4492
|
},
|
|
4493
4493
|
apply(t) {
|
|
4494
4494
|
return t.selection;
|
|
@@ -4554,7 +4554,7 @@ class Br {
|
|
|
4554
4554
|
return e[this.key];
|
|
4555
4555
|
}
|
|
4556
4556
|
}
|
|
4557
|
-
const gc = /^```([a-z]+)?[\s\n]$/, yc = /^~~~([a-z]+)?[\s\n]$/, bc =
|
|
4557
|
+
const gc = /^```([a-z]+)?[\s\n]$/, yc = /^~~~([a-z]+)?[\s\n]$/, bc = Ue.create({
|
|
4558
4558
|
name: "codeBlock",
|
|
4559
4559
|
addOptions() {
|
|
4560
4560
|
return {
|
|
@@ -4594,7 +4594,7 @@ const gc = /^```([a-z]+)?[\s\n]$/, yc = /^~~~([a-z]+)?[\s\n]$/, bc = He.create({
|
|
|
4594
4594
|
renderHTML({ node: t, HTMLAttributes: e }) {
|
|
4595
4595
|
return [
|
|
4596
4596
|
"pre",
|
|
4597
|
-
|
|
4597
|
+
Ne(this.options.HTMLAttributes, e),
|
|
4598
4598
|
[
|
|
4599
4599
|
"code",
|
|
4600
4600
|
{
|
|
@@ -4638,7 +4638,7 @@ const gc = /^```([a-z]+)?[\s\n]$/, yc = /^~~~([a-z]+)?[\s\n]$/, bc = He.create({
|
|
|
4638
4638
|
if (!s || i.parent.type !== this.type || !(i.parentOffset === i.parent.nodeSize - 2))
|
|
4639
4639
|
return !1;
|
|
4640
4640
|
const l = i.after();
|
|
4641
|
-
return l === void 0 ? !1 : r.nodeAt(l) ? t.commands.command(({ tr: c }) => (c.setSelection(
|
|
4641
|
+
return l === void 0 ? !1 : r.nodeAt(l) ? t.commands.command(({ tr: c }) => (c.setSelection(Y.near(r.resolve(l))), !0)) : t.commands.exitCode();
|
|
4642
4642
|
}
|
|
4643
4643
|
};
|
|
4644
4644
|
},
|
|
@@ -4675,13 +4675,13 @@ const gc = /^```([a-z]+)?[\s\n]$/, yc = /^~~~([a-z]+)?[\s\n]$/, bc = He.create({
|
|
|
4675
4675
|
return !1;
|
|
4676
4676
|
const { tr: o, schema: l } = t.state, a = l.text(n.replace(/\r\n?/g, `
|
|
4677
4677
|
`));
|
|
4678
|
-
return o.replaceSelectionWith(this.type.create({ language: s }, a)), o.selection.$from.parent.type !== this.type && o.setSelection(
|
|
4678
|
+
return o.replaceSelectionWith(this.type.create({ language: s }, a)), o.selection.$from.parent.type !== this.type && o.setSelection(Q.near(o.doc.resolve(Math.max(0, o.selection.from - 2)))), o.setMeta("paste", !0), t.dispatch(o), !0;
|
|
4679
4679
|
}
|
|
4680
4680
|
}
|
|
4681
4681
|
})
|
|
4682
4682
|
];
|
|
4683
4683
|
}
|
|
4684
|
-
}), xc = /^\s*>\s$/, vc =
|
|
4684
|
+
}), xc = /^\s*>\s$/, vc = Ue.create({
|
|
4685
4685
|
name: "blockquote",
|
|
4686
4686
|
addOptions() {
|
|
4687
4687
|
return {
|
|
@@ -4697,7 +4697,7 @@ const gc = /^```([a-z]+)?[\s\n]$/, yc = /^~~~([a-z]+)?[\s\n]$/, bc = He.create({
|
|
|
4697
4697
|
];
|
|
4698
4698
|
},
|
|
4699
4699
|
renderHTML({ HTMLAttributes: t }) {
|
|
4700
|
-
return ["blockquote",
|
|
4700
|
+
return ["blockquote", Ne(this.options.HTMLAttributes, t), 0];
|
|
4701
4701
|
},
|
|
4702
4702
|
addCommands() {
|
|
4703
4703
|
return {
|
|
@@ -4719,7 +4719,7 @@ const gc = /^```([a-z]+)?[\s\n]$/, yc = /^~~~([a-z]+)?[\s\n]$/, bc = He.create({
|
|
|
4719
4719
|
})
|
|
4720
4720
|
];
|
|
4721
4721
|
}
|
|
4722
|
-
}), kc =
|
|
4722
|
+
}), kc = Ue.create({
|
|
4723
4723
|
name: "horizontalRule",
|
|
4724
4724
|
addOptions() {
|
|
4725
4725
|
return {
|
|
@@ -4731,7 +4731,7 @@ const gc = /^```([a-z]+)?[\s\n]$/, yc = /^~~~([a-z]+)?[\s\n]$/, bc = He.create({
|
|
|
4731
4731
|
return [{ tag: "hr" }];
|
|
4732
4732
|
},
|
|
4733
4733
|
renderHTML({ HTMLAttributes: t }) {
|
|
4734
|
-
return ["hr",
|
|
4734
|
+
return ["hr", Ne(this.options.HTMLAttributes, t)];
|
|
4735
4735
|
},
|
|
4736
4736
|
addCommands() {
|
|
4737
4737
|
return {
|
|
@@ -4751,10 +4751,10 @@ const gc = /^```([a-z]+)?[\s\n]$/, yc = /^~~~([a-z]+)?[\s\n]$/, bc = He.create({
|
|
|
4751
4751
|
if (l) {
|
|
4752
4752
|
const { $to: c } = o.selection, d = c.end();
|
|
4753
4753
|
if (c.nodeAfter)
|
|
4754
|
-
c.nodeAfter.isTextblock ? o.setSelection(
|
|
4754
|
+
c.nodeAfter.isTextblock ? o.setSelection(Q.create(o.doc, c.pos + 1)) : c.nodeAfter.isBlock ? o.setSelection(j.create(o.doc, c.pos)) : o.setSelection(Q.create(o.doc, c.pos));
|
|
4755
4755
|
else {
|
|
4756
4756
|
const f = (a = c.parent.type.contentMatch.defaultType) === null || a === void 0 ? void 0 : a.create();
|
|
4757
|
-
f && (o.insert(d, f), o.setSelection(
|
|
4757
|
+
f && (o.insert(d, f), o.setSelection(Q.create(o.doc, d + 1)));
|
|
4758
4758
|
}
|
|
4759
4759
|
o.scrollIntoView();
|
|
4760
4760
|
}
|
|
@@ -4771,7 +4771,7 @@ const gc = /^```([a-z]+)?[\s\n]$/, yc = /^~~~([a-z]+)?[\s\n]$/, bc = He.create({
|
|
|
4771
4771
|
})
|
|
4772
4772
|
];
|
|
4773
4773
|
}
|
|
4774
|
-
}), Sc =
|
|
4774
|
+
}), Sc = Ue.create({
|
|
4775
4775
|
name: "hardBreak",
|
|
4776
4776
|
addOptions() {
|
|
4777
4777
|
return {
|
|
@@ -4789,7 +4789,7 @@ const gc = /^```([a-z]+)?[\s\n]$/, yc = /^~~~([a-z]+)?[\s\n]$/, bc = He.create({
|
|
|
4789
4789
|
];
|
|
4790
4790
|
},
|
|
4791
4791
|
renderHTML({ HTMLAttributes: t }) {
|
|
4792
|
-
return ["br",
|
|
4792
|
+
return ["br", Ne(this.options.HTMLAttributes, t)];
|
|
4793
4793
|
},
|
|
4794
4794
|
renderText() {
|
|
4795
4795
|
return `
|
|
@@ -4822,36 +4822,36 @@ const gc = /^```([a-z]+)?[\s\n]$/, yc = /^~~~([a-z]+)?[\s\n]$/, bc = He.create({
|
|
|
4822
4822
|
};
|
|
4823
4823
|
}
|
|
4824
4824
|
});
|
|
4825
|
-
var vn = 200,
|
|
4825
|
+
var vn = 200, me = function() {
|
|
4826
4826
|
};
|
|
4827
|
-
|
|
4828
|
-
return e.length ? (e =
|
|
4827
|
+
me.prototype.append = function(e) {
|
|
4828
|
+
return e.length ? (e = me.from(e), !this.length && e || e.length < vn && this.leafAppend(e) || this.length < vn && e.leafPrepend(this) || this.appendInner(e)) : this;
|
|
4829
4829
|
};
|
|
4830
|
-
|
|
4831
|
-
return e.length ?
|
|
4830
|
+
me.prototype.prepend = function(e) {
|
|
4831
|
+
return e.length ? me.from(e).append(this) : this;
|
|
4832
4832
|
};
|
|
4833
|
-
|
|
4833
|
+
me.prototype.appendInner = function(e) {
|
|
4834
4834
|
return new Cc(this, e);
|
|
4835
4835
|
};
|
|
4836
|
-
|
|
4837
|
-
return e === void 0 && (e = 0), n === void 0 && (n = this.length), e >= n ?
|
|
4836
|
+
me.prototype.slice = function(e, n) {
|
|
4837
|
+
return e === void 0 && (e = 0), n === void 0 && (n = this.length), e >= n ? me.empty : this.sliceInner(Math.max(0, e), Math.min(this.length, n));
|
|
4838
4838
|
};
|
|
4839
|
-
|
|
4839
|
+
me.prototype.get = function(e) {
|
|
4840
4840
|
if (!(e < 0 || e >= this.length))
|
|
4841
4841
|
return this.getInner(e);
|
|
4842
4842
|
};
|
|
4843
|
-
|
|
4843
|
+
me.prototype.forEach = function(e, n, r) {
|
|
4844
4844
|
n === void 0 && (n = 0), r === void 0 && (r = this.length), n <= r ? this.forEachInner(e, n, r, 0) : this.forEachInvertedInner(e, n, r, 0);
|
|
4845
4845
|
};
|
|
4846
|
-
|
|
4846
|
+
me.prototype.map = function(e, n, r) {
|
|
4847
4847
|
n === void 0 && (n = 0), r === void 0 && (r = this.length);
|
|
4848
4848
|
var i = [];
|
|
4849
4849
|
return this.forEach(function(s, o) {
|
|
4850
4850
|
return i.push(e(s, o));
|
|
4851
4851
|
}, n, r), i;
|
|
4852
4852
|
};
|
|
4853
|
-
|
|
4854
|
-
return e instanceof
|
|
4853
|
+
me.from = function(e) {
|
|
4854
|
+
return e instanceof me ? e : e && e.length ? new so(e) : me.empty;
|
|
4855
4855
|
};
|
|
4856
4856
|
var so = /* @__PURE__ */ (function(t) {
|
|
4857
4857
|
function e(r) {
|
|
@@ -4884,8 +4884,8 @@ var so = /* @__PURE__ */ (function(t) {
|
|
|
4884
4884
|
}, n.depth.get = function() {
|
|
4885
4885
|
return 0;
|
|
4886
4886
|
}, Object.defineProperties(e.prototype, n), e;
|
|
4887
|
-
})(
|
|
4888
|
-
|
|
4887
|
+
})(me);
|
|
4888
|
+
me.empty = new so([]);
|
|
4889
4889
|
var Cc = /* @__PURE__ */ (function(t) {
|
|
4890
4890
|
function e(n, r) {
|
|
4891
4891
|
t.call(this), this.left = n, this.right = r, this.length = n.length + r.length, this.depth = Math.max(n.depth, r.depth) + 1;
|
|
@@ -4918,9 +4918,9 @@ var Cc = /* @__PURE__ */ (function(t) {
|
|
|
4918
4918
|
}, e.prototype.appendInner = function(r) {
|
|
4919
4919
|
return this.left.depth >= Math.max(this.right.depth, r.depth) + 1 ? new e(this.left, new e(this.right, r)) : new e(this, r);
|
|
4920
4920
|
}, e;
|
|
4921
|
-
})(
|
|
4921
|
+
})(me);
|
|
4922
4922
|
const wc = 500;
|
|
4923
|
-
class
|
|
4923
|
+
class Be {
|
|
4924
4924
|
constructor(e, n) {
|
|
4925
4925
|
this.items = e, this.eventCount = n;
|
|
4926
4926
|
}
|
|
@@ -4944,24 +4944,24 @@ class ze {
|
|
|
4944
4944
|
return;
|
|
4945
4945
|
}
|
|
4946
4946
|
if (i) {
|
|
4947
|
-
d.push(new
|
|
4947
|
+
d.push(new Ke(f.map));
|
|
4948
4948
|
let p = f.step.map(i.slice(s)), k;
|
|
4949
|
-
p && o.maybeStep(p).doc && (k = o.mapping.maps[o.mapping.maps.length - 1], c.push(new
|
|
4949
|
+
p && o.maybeStep(p).doc && (k = o.mapping.maps[o.mapping.maps.length - 1], c.push(new Ke(k, void 0, void 0, c.length + d.length))), s--, k && i.appendMap(k, s);
|
|
4950
4950
|
} else
|
|
4951
4951
|
o.maybeStep(f.step);
|
|
4952
4952
|
if (f.selection)
|
|
4953
|
-
return l = i ? f.selection.map(i.slice(s)) : f.selection, a = new
|
|
4953
|
+
return l = i ? f.selection.map(i.slice(s)) : f.selection, a = new Be(this.items.slice(0, r).append(d.reverse().concat(c)), this.eventCount - 1), !1;
|
|
4954
4954
|
}, this.items.length, 0), { remaining: a, transform: o, selection: l };
|
|
4955
4955
|
}
|
|
4956
4956
|
// Create a new branch with the given transform added.
|
|
4957
4957
|
addTransform(e, n, r, i) {
|
|
4958
4958
|
let s = [], o = this.eventCount, l = this.items, a = !i && l.length ? l.get(l.length - 1) : null;
|
|
4959
4959
|
for (let d = 0; d < e.steps.length; d++) {
|
|
4960
|
-
let f = e.steps[d].invert(e.docs[d]), m = new
|
|
4960
|
+
let f = e.steps[d].invert(e.docs[d]), m = new Ke(e.mapping.maps[d], f, n), p;
|
|
4961
4961
|
(p = a && a.merge(m)) && (m = p, d ? s.pop() : l = l.slice(0, l.length - 1)), s.push(m), n && (o++, n = void 0), i || (a = m);
|
|
4962
4962
|
}
|
|
4963
4963
|
let c = o - r.depth;
|
|
4964
|
-
return c > Nc && (l = Ac(l, c), o -= c), new
|
|
4964
|
+
return c > Nc && (l = Ac(l, c), o -= c), new Be(l.append(s), o);
|
|
4965
4965
|
}
|
|
4966
4966
|
remapping(e, n) {
|
|
4967
4967
|
let r = new bn();
|
|
@@ -4971,7 +4971,7 @@ class ze {
|
|
|
4971
4971
|
}, e, n), r;
|
|
4972
4972
|
}
|
|
4973
4973
|
addMaps(e) {
|
|
4974
|
-
return this.eventCount == 0 ? this : new
|
|
4974
|
+
return this.eventCount == 0 ? this : new Be(this.items.append(e.map((n) => new Ke(n))), this.eventCount);
|
|
4975
4975
|
}
|
|
4976
4976
|
// When the collab module receives remote changes, the history has
|
|
4977
4977
|
// to know about those, so that it can adjust the steps that were
|
|
@@ -4993,14 +4993,14 @@ class ze {
|
|
|
4993
4993
|
let k = s.maps[p];
|
|
4994
4994
|
if (m.step) {
|
|
4995
4995
|
let y = e.steps[p].invert(e.docs[p]), b = m.selection && m.selection.map(s.slice(a + 1, p));
|
|
4996
|
-
b && l++, r.push(new
|
|
4996
|
+
b && l++, r.push(new Ke(k, y, b));
|
|
4997
4997
|
} else
|
|
4998
|
-
r.push(new
|
|
4998
|
+
r.push(new Ke(k));
|
|
4999
4999
|
}, i);
|
|
5000
5000
|
let c = [];
|
|
5001
5001
|
for (let m = n; m < o; m++)
|
|
5002
|
-
c.push(new
|
|
5003
|
-
let d = this.items.slice(0, i).append(c).append(r), f = new
|
|
5002
|
+
c.push(new Ke(s.maps[m]));
|
|
5003
|
+
let d = this.items.slice(0, i).append(c).append(r), f = new Be(d, l);
|
|
5004
5004
|
return f.emptyItemCount() > wc && (f = f.compress(this.items.length - r.length)), f;
|
|
5005
5005
|
}
|
|
5006
5006
|
emptyItemCount() {
|
|
@@ -5025,14 +5025,14 @@ class ze {
|
|
|
5025
5025
|
if (r--, c && n.appendMap(c, r), a) {
|
|
5026
5026
|
let d = o.selection && o.selection.map(n.slice(r));
|
|
5027
5027
|
d && s++;
|
|
5028
|
-
let f = new
|
|
5028
|
+
let f = new Ke(c.invert(), a, d), m, p = i.length - 1;
|
|
5029
5029
|
(m = i.length && i[p].merge(f)) ? i[p] = m : i.push(f);
|
|
5030
5030
|
}
|
|
5031
5031
|
} else o.map && r--;
|
|
5032
|
-
}, this.items.length, 0), new
|
|
5032
|
+
}, this.items.length, 0), new Be(me.from(i.reverse()), s);
|
|
5033
5033
|
}
|
|
5034
5034
|
}
|
|
5035
|
-
|
|
5035
|
+
Be.empty = new Be(me.empty, 0);
|
|
5036
5036
|
function Ac(t, e) {
|
|
5037
5037
|
let n;
|
|
5038
5038
|
return t.forEach((r, i) => {
|
|
@@ -5040,7 +5040,7 @@ function Ac(t, e) {
|
|
|
5040
5040
|
return n = i, !1;
|
|
5041
5041
|
}), t.slice(n);
|
|
5042
5042
|
}
|
|
5043
|
-
class
|
|
5043
|
+
class Ke {
|
|
5044
5044
|
constructor(e, n, r, i) {
|
|
5045
5045
|
this.map = e, this.step = n, this.selection = r, this.mirrorOffset = i;
|
|
5046
5046
|
}
|
|
@@ -5048,11 +5048,11 @@ class qe {
|
|
|
5048
5048
|
if (this.step && e.step && !e.selection) {
|
|
5049
5049
|
let n = e.step.merge(this.step);
|
|
5050
5050
|
if (n)
|
|
5051
|
-
return new
|
|
5051
|
+
return new Ke(n.getMap().invert(), n, this.selection);
|
|
5052
5052
|
}
|
|
5053
5053
|
}
|
|
5054
5054
|
}
|
|
5055
|
-
class
|
|
5055
|
+
class rt {
|
|
5056
5056
|
constructor(e, n, r, i, s) {
|
|
5057
5057
|
this.done = e, this.undone = n, this.prevRanges = r, this.prevTime = i, this.prevComposition = s;
|
|
5058
5058
|
}
|
|
@@ -5062,16 +5062,16 @@ function Ec(t, e, n, r) {
|
|
|
5062
5062
|
let i = n.getMeta(bt), s;
|
|
5063
5063
|
if (i)
|
|
5064
5064
|
return i.historyState;
|
|
5065
|
-
n.getMeta(Oc) && (t = new
|
|
5065
|
+
n.getMeta(Oc) && (t = new rt(t.done, t.undone, null, 0, -1));
|
|
5066
5066
|
let o = n.getMeta("appendedTransaction");
|
|
5067
5067
|
if (n.steps.length == 0)
|
|
5068
5068
|
return t;
|
|
5069
5069
|
if (o && o.getMeta(bt))
|
|
5070
|
-
return o.getMeta(bt).redo ? new
|
|
5070
|
+
return o.getMeta(bt).redo ? new rt(t.done.addTransform(n, void 0, r, pn(e)), t.undone, zi(n.mapping.maps), t.prevTime, t.prevComposition) : new rt(t.done, t.undone.addTransform(n, void 0, r, pn(e)), null, t.prevTime, t.prevComposition);
|
|
5071
5071
|
if (n.getMeta("addToHistory") !== !1 && !(o && o.getMeta("addToHistory") === !1)) {
|
|
5072
5072
|
let l = n.getMeta("composition"), a = t.prevTime == 0 || !o && t.prevComposition != l && (t.prevTime < (n.time || 0) - r.newGroupDelay || !Tc(n, t.prevRanges)), c = o ? Xn(t.prevRanges, n.mapping) : zi(n.mapping.maps);
|
|
5073
|
-
return new
|
|
5074
|
-
} else return (s = n.getMeta("rebased")) ? new
|
|
5073
|
+
return new rt(t.done.addTransform(n, a ? e.selection.getBookmark() : void 0, r, pn(e)), Be.empty, c, n.time, l ?? t.prevComposition);
|
|
5074
|
+
} else return (s = n.getMeta("rebased")) ? new rt(t.done.rebased(n, s), t.undone.rebased(n, s), Xn(t.prevRanges, n.mapping), t.prevTime, t.prevComposition) : new rt(t.done.addMaps(n.mapping.maps), t.undone.addMaps(n.mapping.maps), Xn(t.prevRanges, n.mapping), t.prevTime, t.prevComposition);
|
|
5075
5075
|
}
|
|
5076
5076
|
function Tc(t, e) {
|
|
5077
5077
|
if (!e)
|
|
@@ -5104,7 +5104,7 @@ function Mc(t, e, n) {
|
|
|
5104
5104
|
let r = pn(e), i = bt.get(e).spec.config, s = (n ? t.undone : t.done).popEvent(e, r);
|
|
5105
5105
|
if (!s)
|
|
5106
5106
|
return null;
|
|
5107
|
-
let o = s.selection.resolve(s.transform.doc), l = (n ? t.done : t.undone).addTransform(s.transform, e.selection.getBookmark(), i, r), a = new
|
|
5107
|
+
let o = s.selection.resolve(s.transform.doc), l = (n ? t.done : t.undone).addTransform(s.transform, e.selection.getBookmark(), i, r), a = new rt(n ? l : s.remaining, n ? s.remaining : l, null, 0, -1);
|
|
5108
5108
|
return s.transform.setSelection(o).setMeta(bt, { redo: n, historyState: a });
|
|
5109
5109
|
}
|
|
5110
5110
|
let er = !1, Bi = null;
|
|
@@ -5129,7 +5129,7 @@ function Ic(t = {}) {
|
|
|
5129
5129
|
key: bt,
|
|
5130
5130
|
state: {
|
|
5131
5131
|
init() {
|
|
5132
|
-
return new
|
|
5132
|
+
return new rt(Be.empty, Be.empty, null, 0, -1);
|
|
5133
5133
|
},
|
|
5134
5134
|
apply(e, n, r) {
|
|
5135
5135
|
return Ec(n, r, e, t);
|
|
@@ -5187,11 +5187,11 @@ const lo = oo(!1, !0), ao = oo(!0, !0), _i = Rr.create({
|
|
|
5187
5187
|
"Shift-Mod-я": () => this.editor.commands.redo()
|
|
5188
5188
|
};
|
|
5189
5189
|
}
|
|
5190
|
-
}), Dc =
|
|
5190
|
+
}), Dc = Ue.create({
|
|
5191
5191
|
name: "doc",
|
|
5192
5192
|
topNode: !0,
|
|
5193
5193
|
content: "block+"
|
|
5194
|
-
}), Lc =
|
|
5194
|
+
}), Lc = Ue.create({
|
|
5195
5195
|
name: "text",
|
|
5196
5196
|
group: "inline"
|
|
5197
5197
|
});
|
|
@@ -5291,7 +5291,7 @@ const Rc = Rr.create({
|
|
|
5291
5291
|
];
|
|
5292
5292
|
}
|
|
5293
5293
|
});
|
|
5294
|
-
var
|
|
5294
|
+
var at = {
|
|
5295
5295
|
8: "Backspace",
|
|
5296
5296
|
9: "Tab",
|
|
5297
5297
|
10: "Enter",
|
|
@@ -5370,13 +5370,13 @@ var lt = {
|
|
|
5370
5370
|
221: "}",
|
|
5371
5371
|
222: '"'
|
|
5372
5372
|
}, $c = typeof navigator < "u" && /Mac/.test(navigator.platform), Vc = typeof navigator < "u" && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);
|
|
5373
|
-
for (var xe = 0; xe < 10; xe++)
|
|
5374
|
-
for (var xe = 1; xe <= 24; xe++)
|
|
5373
|
+
for (var xe = 0; xe < 10; xe++) at[48 + xe] = at[96 + xe] = String(xe);
|
|
5374
|
+
for (var xe = 1; xe <= 24; xe++) at[xe + 111] = "F" + xe;
|
|
5375
5375
|
for (var xe = 65; xe <= 90; xe++)
|
|
5376
|
-
|
|
5377
|
-
for (var tr in
|
|
5376
|
+
at[xe] = String.fromCharCode(xe + 32), kn[xe] = String.fromCharCode(xe);
|
|
5377
|
+
for (var tr in at) kn.hasOwnProperty(tr) || (kn[tr] = at[tr]);
|
|
5378
5378
|
function zc(t) {
|
|
5379
|
-
var e = $c && t.metaKey && t.shiftKey && !t.ctrlKey && !t.altKey || Vc && t.shiftKey && t.key && t.key.length == 1 || t.key == "Unidentified", n = !e && t.key || (t.shiftKey ? kn :
|
|
5379
|
+
var e = $c && t.metaKey && t.shiftKey && !t.ctrlKey && !t.altKey || Vc && t.shiftKey && t.key && t.key.length == 1 || t.key == "Unidentified", n = !e && t.key || (t.shiftKey ? kn : at)[t.keyCode] || t.key || "Unidentified";
|
|
5380
5380
|
return n == "Esc" && (n = "Escape"), n == "Del" && (n = "Delete"), n == "Left" && (n = "ArrowLeft"), n == "Up" && (n = "ArrowUp"), n == "Right" && (n = "ArrowRight"), n == "Down" && (n = "ArrowDown"), n;
|
|
5381
5381
|
}
|
|
5382
5382
|
const Bc = typeof navigator < "u" && /Mac|iP(hone|[oa]d)/.test(navigator.platform), _c = typeof navigator < "u" && /Win/.test(navigator.platform);
|
|
@@ -5423,7 +5423,7 @@ function qc(t) {
|
|
|
5423
5423
|
return !0;
|
|
5424
5424
|
}
|
|
5425
5425
|
if ((r.altKey || r.metaKey || r.ctrlKey) && // Ctrl-Alt may be used for AltGr on Windows
|
|
5426
|
-
!(_c && r.ctrlKey && r.altKey) && (s =
|
|
5426
|
+
!(_c && r.ctrlKey && r.altKey) && (s = at[r.keyCode]) && s != i) {
|
|
5427
5427
|
let l = e[nr(s, r)];
|
|
5428
5428
|
if (l && l(n.state, n.dispatch, n))
|
|
5429
5429
|
return !0;
|
|
@@ -5487,9 +5487,9 @@ function fo(t, e) {
|
|
|
5487
5487
|
let n = document.createEvent("Event");
|
|
5488
5488
|
return n.initEvent("keydown", !0, !0), n.keyCode = t, n.key = n.code = e, n;
|
|
5489
5489
|
}
|
|
5490
|
-
const
|
|
5491
|
-
Pn && +(/Firefox\/(\d+)/.exec(
|
|
5492
|
-
const Sr = !rn && /Chrome\/(\d+)/.exec(
|
|
5490
|
+
const Ge = typeof navigator < "u" ? navigator : null, Ui = typeof document < "u" ? document : null, ct = Ge && Ge.userAgent || "", vr = /Edge\/(\d+)/.exec(ct), ho = /MSIE \d/.exec(ct), kr = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ct), rn = !!(ho || kr || vr), po = ho ? document.documentMode : kr ? +kr[1] : vr ? +vr[1] : 0, Pn = !rn && /gecko\/(\d+)/i.test(ct);
|
|
5491
|
+
Pn && +(/Firefox\/(\d+)/.exec(ct) || [0, 0])[1];
|
|
5492
|
+
const Sr = !rn && /Chrome\/(\d+)/.exec(ct), et = !!Sr, mo = Sr ? +Sr[1] : 0, St = !rn && !!Ge && /Apple Computer/.test(Ge.vendor), Hr = St && (/Mobile\/\w+/.test(ct) || !!Ge && Ge.maxTouchPoints > 2), $e = Hr || (Ge ? /Mac/.test(Ge.platform) : !1), go = Ge ? /Win/.test(Ge.platform) : !1, sn = /Android \d/.test(ct), Ur = !!Ui && "webkitFontSmoothing" in Ui.documentElement.style, Wc = Ur ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
|
|
5493
5493
|
function Jc(t, e = null) {
|
|
5494
5494
|
let n = t.domSelectionRange(), r = t.state.doc;
|
|
5495
5495
|
if (!n.focusNode)
|
|
@@ -5534,7 +5534,7 @@ function yo(t) {
|
|
|
5534
5534
|
function qr(t, e = !1) {
|
|
5535
5535
|
let n = t.state.selection;
|
|
5536
5536
|
if (Qc(t, n), !!yo(t)) {
|
|
5537
|
-
if (!e && t.input.mouseDown && t.input.mouseDown.allowDefault &&
|
|
5537
|
+
if (!e && t.input.mouseDown && t.input.mouseDown.allowDefault && et) {
|
|
5538
5538
|
let r = t.domSelectionRange(), i = t.domObserver.currentSelection;
|
|
5539
5539
|
if (r.anchorNode && i.anchorNode && co(r.anchorNode, r.anchorOffset, i.anchorNode, i.anchorOffset)) {
|
|
5540
5540
|
t.input.mouseDown.delayedSelectionSync = !0, t.domObserver.setCurSelection();
|
|
@@ -5545,12 +5545,12 @@ function qr(t, e = !1) {
|
|
|
5545
5545
|
Zc(t);
|
|
5546
5546
|
else {
|
|
5547
5547
|
let { anchor: r, head: i } = n, s, o;
|
|
5548
|
-
qi && !(n instanceof
|
|
5548
|
+
qi && !(n instanceof Q) && (n.$from.parent.inlineContent || (s = Ki(t, n.from)), !n.empty && !n.$from.parent.inlineContent && (o = Ki(t, n.to))), t.docView.setSelection(r, i, t, e), qi && (s && ji(s), o && ji(o)), n.visible ? t.dom.classList.remove("ProseMirror-hideselection") : (t.dom.classList.add("ProseMirror-hideselection"), "onselectionchange" in document && Gc(t));
|
|
5549
5549
|
}
|
|
5550
5550
|
t.domObserver.setCurSelection(), t.domObserver.connectSelection();
|
|
5551
5551
|
}
|
|
5552
5552
|
}
|
|
5553
|
-
const qi = St ||
|
|
5553
|
+
const qi = St || et && mo < 63;
|
|
5554
5554
|
function Ki(t, e) {
|
|
5555
5555
|
let { node: n, offset: r } = t.docView.domFromPos(e, 0), i = r < n.childNodes.length ? n.childNodes[r] : null, s = r ? n.childNodes[r - 1] : null;
|
|
5556
5556
|
if (St && i && i.contentEditable == "false")
|
|
@@ -5596,7 +5596,7 @@ function Wi(t) {
|
|
|
5596
5596
|
t.lastSelectedViewDesc && (t.lastSelectedViewDesc.parent && t.lastSelectedViewDesc.deselectNode(), t.lastSelectedViewDesc = void 0);
|
|
5597
5597
|
}
|
|
5598
5598
|
function bo(t, e, n, r) {
|
|
5599
|
-
return t.someProp("createSelectionBetween", (i) => i(t, e, n)) ||
|
|
5599
|
+
return t.someProp("createSelectionBetween", (i) => i(t, e, n)) || Q.between(e, n, r);
|
|
5600
5600
|
}
|
|
5601
5601
|
function Yc(t) {
|
|
5602
5602
|
let e = t.domSelectionRange();
|
|
@@ -5610,38 +5610,38 @@ function Yc(t) {
|
|
|
5610
5610
|
}
|
|
5611
5611
|
function Cr(t, e) {
|
|
5612
5612
|
let { $anchor: n, $head: r } = t.selection, i = e > 0 ? n.max(r) : n.min(r), s = i.parent.inlineContent ? i.depth ? t.doc.resolve(e > 0 ? i.after() : i.before()) : null : i;
|
|
5613
|
-
return s &&
|
|
5613
|
+
return s && Y.findFrom(s, e);
|
|
5614
5614
|
}
|
|
5615
|
-
function
|
|
5615
|
+
function it(t, e) {
|
|
5616
5616
|
return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()), !0;
|
|
5617
5617
|
}
|
|
5618
5618
|
function Ji(t, e, n) {
|
|
5619
5619
|
let r = t.state.selection;
|
|
5620
|
-
if (r instanceof
|
|
5620
|
+
if (r instanceof Q)
|
|
5621
5621
|
if (n.indexOf("s") > -1) {
|
|
5622
5622
|
let { $head: i } = r, s = i.textOffset ? null : e < 0 ? i.nodeBefore : i.nodeAfter;
|
|
5623
5623
|
if (!s || s.isText || !s.isLeaf)
|
|
5624
5624
|
return !1;
|
|
5625
5625
|
let o = t.state.doc.resolve(i.pos + s.nodeSize * (e < 0 ? -1 : 1));
|
|
5626
|
-
return
|
|
5626
|
+
return it(t, new Q(r.$anchor, o));
|
|
5627
5627
|
} else if (r.empty) {
|
|
5628
5628
|
if (t.endOfTextblock(e > 0 ? "forward" : "backward")) {
|
|
5629
5629
|
let i = Cr(t.state, e);
|
|
5630
|
-
return i && i instanceof j ?
|
|
5630
|
+
return i && i instanceof j ? it(t, i) : !1;
|
|
5631
5631
|
} else if (!($e && n.indexOf("m") > -1)) {
|
|
5632
5632
|
let i = r.$head, s = i.textOffset ? null : e < 0 ? i.nodeBefore : i.nodeAfter, o;
|
|
5633
5633
|
if (!s || s.isText)
|
|
5634
5634
|
return !1;
|
|
5635
5635
|
let l = e < 0 ? i.pos - s.nodeSize : i.pos;
|
|
5636
|
-
return s.isAtom || (o = t.docView.descAt(l)) && !o.contentDOM ? j.isSelectable(s) ?
|
|
5636
|
+
return s.isAtom || (o = t.docView.descAt(l)) && !o.contentDOM ? j.isSelectable(s) ? it(t, new j(e < 0 ? t.state.doc.resolve(i.pos - s.nodeSize) : i)) : Ur ? it(t, new Q(t.state.doc.resolve(e < 0 ? l : l + s.nodeSize))) : !1 : !1;
|
|
5637
5637
|
}
|
|
5638
5638
|
} else return !1;
|
|
5639
5639
|
else {
|
|
5640
5640
|
if (r instanceof j && r.node.isInline)
|
|
5641
|
-
return
|
|
5641
|
+
return it(t, new Q(e > 0 ? r.$to : r.$from));
|
|
5642
5642
|
{
|
|
5643
5643
|
let i = Cr(t.state, e);
|
|
5644
|
-
return i ?
|
|
5644
|
+
return i ? it(t, i) : !1;
|
|
5645
5645
|
}
|
|
5646
5646
|
}
|
|
5647
5647
|
}
|
|
@@ -5771,7 +5771,7 @@ function wr(t, e, n) {
|
|
|
5771
5771
|
}
|
|
5772
5772
|
function Gi(t, e) {
|
|
5773
5773
|
let n = t.state.doc.resolve(e);
|
|
5774
|
-
if (!(
|
|
5774
|
+
if (!(et || go) && n.parent.inlineContent) {
|
|
5775
5775
|
let i = t.coordsAtPos(e);
|
|
5776
5776
|
if (e > n.start()) {
|
|
5777
5777
|
let s = t.coordsAtPos(e - 1), o = (s.top + s.bottom) / 2;
|
|
@@ -5788,22 +5788,22 @@ function Gi(t, e) {
|
|
|
5788
5788
|
}
|
|
5789
5789
|
function Zi(t, e, n) {
|
|
5790
5790
|
let r = t.state.selection;
|
|
5791
|
-
if (r instanceof
|
|
5791
|
+
if (r instanceof Q && !r.empty || n.indexOf("s") > -1 || $e && n.indexOf("m") > -1)
|
|
5792
5792
|
return !1;
|
|
5793
5793
|
let { $from: i, $to: s } = r;
|
|
5794
5794
|
if (!i.parent.inlineContent || t.endOfTextblock(e < 0 ? "up" : "down")) {
|
|
5795
5795
|
let o = Cr(t.state, e);
|
|
5796
5796
|
if (o && o instanceof j)
|
|
5797
|
-
return
|
|
5797
|
+
return it(t, o);
|
|
5798
5798
|
}
|
|
5799
5799
|
if (!i.parent.inlineContent) {
|
|
5800
|
-
let o = e < 0 ? i : s, l = r instanceof
|
|
5801
|
-
return l ?
|
|
5800
|
+
let o = e < 0 ? i : s, l = r instanceof Je ? Y.near(o, e) : Y.findFrom(o, e);
|
|
5801
|
+
return l ? it(t, l) : !1;
|
|
5802
5802
|
}
|
|
5803
5803
|
return !1;
|
|
5804
5804
|
}
|
|
5805
5805
|
function Qi(t, e) {
|
|
5806
|
-
if (!(t.state.selection instanceof
|
|
5806
|
+
if (!(t.state.selection instanceof Q))
|
|
5807
5807
|
return !0;
|
|
5808
5808
|
let { $head: n, $anchor: r, empty: i } = t.state.selection;
|
|
5809
5809
|
if (!n.sameParent(r))
|
|
@@ -6026,7 +6026,7 @@ function cu(t) {
|
|
|
6026
6026
|
return n;
|
|
6027
6027
|
}
|
|
6028
6028
|
function uu(t) {
|
|
6029
|
-
let e = t.querySelectorAll(
|
|
6029
|
+
let e = t.querySelectorAll(et ? "span:not([class]):not([style])" : "span.Apple-converted-space");
|
|
6030
6030
|
for (let n = 0; n < e.length; n++) {
|
|
6031
6031
|
let r = e[n];
|
|
6032
6032
|
r.childNodes.length == 1 && r.textContent == " " && r.parentNode && r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "), r);
|
|
@@ -6050,19 +6050,19 @@ function du(t, e) {
|
|
|
6050
6050
|
}
|
|
6051
6051
|
return new K(i, s, o);
|
|
6052
6052
|
}
|
|
6053
|
-
const
|
|
6054
|
-
function
|
|
6053
|
+
const qe = {}, Re = {};
|
|
6054
|
+
function st(t, e) {
|
|
6055
6055
|
t.input.lastSelectionOrigin = e, t.input.lastSelectionTime = Date.now();
|
|
6056
6056
|
}
|
|
6057
6057
|
Re.keydown = (t, e) => {
|
|
6058
6058
|
let n = e;
|
|
6059
|
-
if (t.input.shiftKey = n.keyCode == 16 || n.shiftKey, !To(t, n) && (t.input.lastKeyCode = n.keyCode, t.input.lastKeyCodeTime = Date.now(), !(sn &&
|
|
6059
|
+
if (t.input.shiftKey = n.keyCode == 16 || n.shiftKey, !To(t, n) && (t.input.lastKeyCode = n.keyCode, t.input.lastKeyCodeTime = Date.now(), !(sn && et && n.keyCode == 13)))
|
|
6060
6060
|
if (n.keyCode != 229 && t.domObserver.forceFlush(), Hr && n.keyCode == 13 && !n.ctrlKey && !n.altKey && !n.metaKey) {
|
|
6061
6061
|
let r = Date.now();
|
|
6062
6062
|
t.input.lastIOSEnter = r, t.input.lastIOSEnterFallbackTimeout = setTimeout(() => {
|
|
6063
6063
|
t.input.lastIOSEnter == r && (t.someProp("handleKeyDown", (i) => i(t, fo(13, "Enter"))), t.input.lastIOSEnter = 0);
|
|
6064
6064
|
}, 200);
|
|
6065
|
-
} else t.someProp("handleKeyDown", (r) => r(t, n)) || su(t, n) ? n.preventDefault() :
|
|
6065
|
+
} else t.someProp("handleKeyDown", (r) => r(t, n)) || su(t, n) ? n.preventDefault() : st(t, "key");
|
|
6066
6066
|
};
|
|
6067
6067
|
Re.keyup = (t, e) => {
|
|
6068
6068
|
e.keyCode == 16 && (t.input.shiftKey = !1);
|
|
@@ -6076,7 +6076,7 @@ Re.keypress = (t, e) => {
|
|
|
6076
6076
|
return;
|
|
6077
6077
|
}
|
|
6078
6078
|
let r = t.state.selection;
|
|
6079
|
-
if (!(r instanceof
|
|
6079
|
+
if (!(r instanceof Q) || !r.$from.sameParent(r.$to)) {
|
|
6080
6080
|
let i = String.fromCharCode(n.charCode), s = () => t.state.tr.insertText(i).scrollIntoView();
|
|
6081
6081
|
!/[\r\n]/.test(i) && !t.someProp("handleTextInput", (o) => o(t, r.$from.pos, r.$to.pos, i, s)) && t.dispatch(s()), n.preventDefault();
|
|
6082
6082
|
}
|
|
@@ -6138,12 +6138,12 @@ function bu(t, e, n) {
|
|
|
6138
6138
|
return !1;
|
|
6139
6139
|
let r = t.state.doc;
|
|
6140
6140
|
if (e == -1)
|
|
6141
|
-
return r.inlineContent ? (It(t,
|
|
6141
|
+
return r.inlineContent ? (It(t, Q.create(r, 0, r.content.size)), !0) : !1;
|
|
6142
6142
|
let i = r.resolve(e);
|
|
6143
6143
|
for (let s = i.depth + 1; s > 0; s--) {
|
|
6144
6144
|
let o = s > i.depth ? i.nodeAfter : i.node(s), l = i.before(s);
|
|
6145
6145
|
if (o.inlineContent)
|
|
6146
|
-
It(t,
|
|
6146
|
+
It(t, Q.create(r, l + 1, l + 1 + o.content.size));
|
|
6147
6147
|
else if (j.isSelectable(o))
|
|
6148
6148
|
It(t, j.create(r, l));
|
|
6149
6149
|
else
|
|
@@ -6155,13 +6155,13 @@ function jr(t) {
|
|
|
6155
6155
|
return wn(t);
|
|
6156
6156
|
}
|
|
6157
6157
|
const Eo = $e ? "metaKey" : "ctrlKey";
|
|
6158
|
-
|
|
6158
|
+
qe.mousedown = (t, e) => {
|
|
6159
6159
|
let n = e;
|
|
6160
6160
|
t.input.shiftKey = n.shiftKey;
|
|
6161
6161
|
let r = jr(t), i = Date.now(), s = "singleClick";
|
|
6162
6162
|
i - t.input.lastClick.time < 500 && fu(n, t.input.lastClick) && !n[Eo] && t.input.lastClick.button == n.button && (t.input.lastClick.type == "singleClick" ? s = "doubleClick" : t.input.lastClick.type == "doubleClick" && (s = "tripleClick")), t.input.lastClick = { time: i, x: n.clientX, y: n.clientY, type: s, button: n.button };
|
|
6163
6163
|
let o = t.posAtCoords(Rn(n));
|
|
6164
|
-
o && (s == "singleClick" ? (t.input.mouseDown && t.input.mouseDown.done(), t.input.mouseDown = new xu(t, o, n, !!r)) : (s == "doubleClick" ? gu : yu)(t, o.pos, o.inside, n) ? n.preventDefault() :
|
|
6164
|
+
o && (s == "singleClick" ? (t.input.mouseDown && t.input.mouseDown.done(), t.input.mouseDown = new xu(t, o, n, !!r)) : (s == "doubleClick" ? gu : yu)(t, o.pos, o.inside, n) ? n.preventDefault() : st(t, "pointer"));
|
|
6165
6165
|
};
|
|
6166
6166
|
class xu {
|
|
6167
6167
|
constructor(e, n, r, i) {
|
|
@@ -6183,7 +6183,7 @@ class xu {
|
|
|
6183
6183
|
setUneditable: !!(this.target && Pn && !this.target.hasAttribute("contentEditable"))
|
|
6184
6184
|
}), this.target && this.mightDrag && (this.mightDrag.addAttr || this.mightDrag.setUneditable) && (this.view.domObserver.stop(), this.mightDrag.addAttr && (this.target.draggable = !0), this.mightDrag.setUneditable && setTimeout(() => {
|
|
6185
6185
|
this.view.input.mouseDown == this && this.target.setAttribute("contentEditable", "false");
|
|
6186
|
-
}, 20), this.view.domObserver.start()), e.root.addEventListener("mouseup", this.up = this.up.bind(this)), e.root.addEventListener("mousemove", this.move = this.move.bind(this)),
|
|
6186
|
+
}, 20), this.view.domObserver.start()), e.root.addEventListener("mouseup", this.up = this.up.bind(this)), e.root.addEventListener("mousemove", this.move = this.move.bind(this)), st(e, "pointer");
|
|
6187
6187
|
}
|
|
6188
6188
|
done() {
|
|
6189
6189
|
this.view.root.removeEventListener("mouseup", this.up), this.view.root.removeEventListener("mousemove", this.move), this.mightDrag && this.target && (this.view.domObserver.stop(), this.mightDrag.addAttr && this.target.removeAttribute("draggable"), this.mightDrag.setUneditable && this.target.removeAttribute("contentEditable"), this.view.domObserver.start()), this.delayedSelectionSync && setTimeout(() => qr(this.view)), this.view.input.mouseDown = null;
|
|
@@ -6192,7 +6192,7 @@ class xu {
|
|
|
6192
6192
|
if (this.done(), !this.view.dom.contains(e.target))
|
|
6193
6193
|
return;
|
|
6194
6194
|
let n = this.pos;
|
|
6195
|
-
this.view.state.doc != this.startDoc && (n = this.view.posAtCoords(Rn(e))), this.updateAllowDefault(e), this.allowDefault || !n ?
|
|
6195
|
+
this.view.state.doc != this.startDoc && (n = this.view.posAtCoords(Rn(e))), this.updateAllowDefault(e), this.allowDefault || !n ? st(this.view, "pointer") : mu(this.view, n.pos, n.inside, e, this.selectNode) ? e.preventDefault() : e.button == 0 && (this.flushed || // Safari ignores clicks on draggable elements
|
|
6196
6196
|
St && this.mightDrag && !this.mightDrag.node.isAtom || // Chrome will sometimes treat a node selection as a
|
|
6197
6197
|
// cursor, but still report that the node is selected
|
|
6198
6198
|
// when asked through getSelection. You'll then get a
|
|
@@ -6200,22 +6200,22 @@ class xu {
|
|
|
6200
6200
|
// (hidden) cursor is doesn't change the selection, and
|
|
6201
6201
|
// thus doesn't get a reaction from ProseMirror. This
|
|
6202
6202
|
// works around that.
|
|
6203
|
-
|
|
6203
|
+
et && !this.view.state.selection.visible && Math.min(Math.abs(n.pos - this.view.state.selection.from), Math.abs(n.pos - this.view.state.selection.to)) <= 2) ? (It(this.view, Y.near(this.view.state.doc.resolve(n.pos))), e.preventDefault()) : st(this.view, "pointer");
|
|
6204
6204
|
}
|
|
6205
6205
|
move(e) {
|
|
6206
|
-
this.updateAllowDefault(e),
|
|
6206
|
+
this.updateAllowDefault(e), st(this.view, "pointer"), e.buttons == 0 && this.done();
|
|
6207
6207
|
}
|
|
6208
6208
|
updateAllowDefault(e) {
|
|
6209
6209
|
!this.allowDefault && (Math.abs(this.event.x - e.clientX) > 4 || Math.abs(this.event.y - e.clientY) > 4) && (this.allowDefault = !0);
|
|
6210
6210
|
}
|
|
6211
6211
|
}
|
|
6212
|
-
|
|
6213
|
-
t.input.lastTouch = Date.now(), jr(t),
|
|
6212
|
+
qe.touchstart = (t) => {
|
|
6213
|
+
t.input.lastTouch = Date.now(), jr(t), st(t, "pointer");
|
|
6214
6214
|
};
|
|
6215
|
-
|
|
6216
|
-
t.input.lastTouch = Date.now(),
|
|
6215
|
+
qe.touchmove = (t) => {
|
|
6216
|
+
t.input.lastTouch = Date.now(), st(t, "pointer");
|
|
6217
6217
|
};
|
|
6218
|
-
|
|
6218
|
+
qe.contextmenu = (t) => jr(t);
|
|
6219
6219
|
function To(t, e) {
|
|
6220
6220
|
return t.composing ? !0 : St && Math.abs(e.timeStamp - t.input.compositionEndedAt) < 500 ? (t.input.compositionEndedAt = -2e8, !0) : !1;
|
|
6221
6221
|
}
|
|
@@ -6224,7 +6224,7 @@ Re.compositionstart = Re.compositionupdate = (t) => {
|
|
|
6224
6224
|
if (!t.composing) {
|
|
6225
6225
|
t.domObserver.flush();
|
|
6226
6226
|
let { state: e } = t, n = e.selection.$to;
|
|
6227
|
-
if (e.selection instanceof
|
|
6227
|
+
if (e.selection instanceof Q && (e.storedMarks || !n.textOffset && n.parentOffset && n.nodeBefore.marks.some((r) => r.type.spec.inclusive === !1) || et && go && ku(t)))
|
|
6228
6228
|
t.markCursor = t.state.storedMarks || n.marks(), wn(t, !0), t.markCursor = null;
|
|
6229
6229
|
else if (wn(t, !e.selection.empty), Pn && e.selection.empty && n.parentOffset && !n.textOffset && n.nodeBefore.marks.length) {
|
|
6230
6230
|
let r = t.domSelectionRange();
|
|
@@ -6285,7 +6285,7 @@ function wu(t, e) {
|
|
|
6285
6285
|
}, 50);
|
|
6286
6286
|
}
|
|
6287
6287
|
const Yt = rn && po < 15 || Hr && Wc < 604;
|
|
6288
|
-
|
|
6288
|
+
qe.copy = Re.cut = (t, e) => {
|
|
6289
6289
|
let n = e, r = t.state.selection, i = n.type == "cut";
|
|
6290
6290
|
if (r.empty)
|
|
6291
6291
|
return;
|
|
@@ -6338,7 +6338,7 @@ function Io(t, e) {
|
|
|
6338
6338
|
let n = t.someProp("dragCopies", (r) => !r(e));
|
|
6339
6339
|
return n ?? !e[Tu];
|
|
6340
6340
|
}
|
|
6341
|
-
|
|
6341
|
+
qe.dragstart = (t, e) => {
|
|
6342
6342
|
let n = e, r = t.input.mouseDown;
|
|
6343
6343
|
if (r && r.done(), !n.dataTransfer)
|
|
6344
6344
|
return;
|
|
@@ -6352,9 +6352,9 @@ Ue.dragstart = (t, e) => {
|
|
|
6352
6352
|
}
|
|
6353
6353
|
}
|
|
6354
6354
|
let l = (o || t.state.selection).content(), { dom: a, text: c, slice: d } = vo(t, l);
|
|
6355
|
-
(!n.dataTransfer.files.length || !
|
|
6355
|
+
(!n.dataTransfer.files.length || !et || mo > 120) && n.dataTransfer.clearData(), n.dataTransfer.setData(Yt ? "Text" : "text/html", a.innerHTML), n.dataTransfer.effectAllowed = "copyMove", Yt || n.dataTransfer.setData("text/plain", c), t.dragging = new Eu(d, Io(t, n), o);
|
|
6356
6356
|
};
|
|
6357
|
-
|
|
6357
|
+
qe.dragend = (t) => {
|
|
6358
6358
|
let e = t.dragging;
|
|
6359
6359
|
window.setTimeout(() => {
|
|
6360
6360
|
t.dragging == e && (t.dragging = null);
|
|
@@ -6405,17 +6405,17 @@ function Mu(t, e, n) {
|
|
|
6405
6405
|
}
|
|
6406
6406
|
t.focus(), t.dispatch(a.setMeta("uiEvent", "drop"));
|
|
6407
6407
|
}
|
|
6408
|
-
|
|
6408
|
+
qe.focus = (t) => {
|
|
6409
6409
|
t.input.lastFocus = Date.now(), t.focused || (t.domObserver.stop(), t.dom.classList.add("ProseMirror-focused"), t.domObserver.start(), t.focused = !0, setTimeout(() => {
|
|
6410
6410
|
t.docView && t.hasFocus() && !t.domObserver.currentSelection.eq(t.domSelectionRange()) && qr(t);
|
|
6411
6411
|
}, 20));
|
|
6412
6412
|
};
|
|
6413
|
-
|
|
6413
|
+
qe.blur = (t, e) => {
|
|
6414
6414
|
let n = e;
|
|
6415
6415
|
t.focused && (t.domObserver.stop(), t.dom.classList.remove("ProseMirror-focused"), t.domObserver.start(), n.relatedTarget && t.dom.contains(n.relatedTarget) && t.domObserver.currentSelection.clear(), t.focused = !1);
|
|
6416
6416
|
};
|
|
6417
|
-
|
|
6418
|
-
if (
|
|
6417
|
+
qe.beforeinput = (t, e) => {
|
|
6418
|
+
if (et && sn && e.inputType == "deleteContentBackward") {
|
|
6419
6419
|
t.domObserver.flushSoon();
|
|
6420
6420
|
let { domChangeCount: r } = t.input;
|
|
6421
6421
|
setTimeout(() => {
|
|
@@ -6427,7 +6427,7 @@ Ue.beforeinput = (t, e) => {
|
|
|
6427
6427
|
}
|
|
6428
6428
|
};
|
|
6429
6429
|
for (let t in Re)
|
|
6430
|
-
|
|
6430
|
+
qe[t] = Re[t];
|
|
6431
6431
|
function Xt(t, e) {
|
|
6432
6432
|
if (t == e)
|
|
6433
6433
|
return !0;
|
|
@@ -6445,7 +6445,7 @@ class An {
|
|
|
6445
6445
|
}
|
|
6446
6446
|
map(e, n, r, i) {
|
|
6447
6447
|
let { pos: s, deleted: o } = e.mapResult(n.from + i, this.side < 0 ? -1 : 1);
|
|
6448
|
-
return o ? null : new
|
|
6448
|
+
return o ? null : new je(s - r, s - r, this);
|
|
6449
6449
|
}
|
|
6450
6450
|
valid() {
|
|
6451
6451
|
return !0;
|
|
@@ -6457,22 +6457,22 @@ class An {
|
|
|
6457
6457
|
this.spec.destroy && this.spec.destroy(e);
|
|
6458
6458
|
}
|
|
6459
6459
|
}
|
|
6460
|
-
class
|
|
6460
|
+
class lt {
|
|
6461
6461
|
constructor(e, n) {
|
|
6462
6462
|
this.attrs = e, this.spec = n || xt;
|
|
6463
6463
|
}
|
|
6464
6464
|
map(e, n, r, i) {
|
|
6465
6465
|
let s = e.map(n.from + i, this.spec.inclusiveStart ? -1 : 1) - r, o = e.map(n.to + i, this.spec.inclusiveEnd ? 1 : -1) - r;
|
|
6466
|
-
return s >= o ? null : new
|
|
6466
|
+
return s >= o ? null : new je(s, o, this);
|
|
6467
6467
|
}
|
|
6468
6468
|
valid(e, n) {
|
|
6469
6469
|
return n.from < n.to;
|
|
6470
6470
|
}
|
|
6471
6471
|
eq(e) {
|
|
6472
|
-
return this == e || e instanceof
|
|
6472
|
+
return this == e || e instanceof lt && Xt(this.attrs, e.attrs) && Xt(this.spec, e.spec);
|
|
6473
6473
|
}
|
|
6474
6474
|
static is(e) {
|
|
6475
|
-
return e.type instanceof
|
|
6475
|
+
return e.type instanceof lt;
|
|
6476
6476
|
}
|
|
6477
6477
|
destroy() {
|
|
6478
6478
|
}
|
|
@@ -6486,7 +6486,7 @@ class Wr {
|
|
|
6486
6486
|
if (s.deleted)
|
|
6487
6487
|
return null;
|
|
6488
6488
|
let o = e.mapResult(n.to + i, -1);
|
|
6489
|
-
return o.deleted || o.pos <= s.pos ? null : new
|
|
6489
|
+
return o.deleted || o.pos <= s.pos ? null : new je(s.pos - r, o.pos - r, this);
|
|
6490
6490
|
}
|
|
6491
6491
|
valid(e, n) {
|
|
6492
6492
|
let { index: r, offset: i } = e.content.findIndex(n.from), s;
|
|
@@ -6498,7 +6498,7 @@ class Wr {
|
|
|
6498
6498
|
destroy() {
|
|
6499
6499
|
}
|
|
6500
6500
|
}
|
|
6501
|
-
class
|
|
6501
|
+
class je {
|
|
6502
6502
|
/**
|
|
6503
6503
|
@internal
|
|
6504
6504
|
*/
|
|
@@ -6509,7 +6509,7 @@ class Ke {
|
|
|
6509
6509
|
@internal
|
|
6510
6510
|
*/
|
|
6511
6511
|
copy(e, n) {
|
|
6512
|
-
return new
|
|
6512
|
+
return new je(e, n, this.type);
|
|
6513
6513
|
}
|
|
6514
6514
|
/**
|
|
6515
6515
|
@internal
|
|
@@ -6532,14 +6532,14 @@ class Ke {
|
|
|
6532
6532
|
widget's current document position.
|
|
6533
6533
|
*/
|
|
6534
6534
|
static widget(e, n, r) {
|
|
6535
|
-
return new
|
|
6535
|
+
return new je(e, e, new An(n, r));
|
|
6536
6536
|
}
|
|
6537
6537
|
/**
|
|
6538
6538
|
Creates an inline decoration, which adds the given attributes to
|
|
6539
6539
|
each inline node between `from` and `to`.
|
|
6540
6540
|
*/
|
|
6541
6541
|
static inline(e, n, r, i) {
|
|
6542
|
-
return new
|
|
6542
|
+
return new je(e, n, new lt(r, i));
|
|
6543
6543
|
}
|
|
6544
6544
|
/**
|
|
6545
6545
|
Creates a node decoration. `from` and `to` should point precisely
|
|
@@ -6547,7 +6547,7 @@ class Ke {
|
|
|
6547
6547
|
node, will receive the given attributes.
|
|
6548
6548
|
*/
|
|
6549
6549
|
static node(e, n, r, i) {
|
|
6550
|
-
return new
|
|
6550
|
+
return new je(e, n, new Wr(r, i));
|
|
6551
6551
|
}
|
|
6552
6552
|
/**
|
|
6553
6553
|
The spec provided when creating this decoration. Can be useful
|
|
@@ -6560,7 +6560,7 @@ class Ke {
|
|
|
6560
6560
|
@internal
|
|
6561
6561
|
*/
|
|
6562
6562
|
get inline() {
|
|
6563
|
-
return this.type instanceof
|
|
6563
|
+
return this.type instanceof lt;
|
|
6564
6564
|
}
|
|
6565
6565
|
/**
|
|
6566
6566
|
@internal
|
|
@@ -6570,7 +6570,7 @@ class Ke {
|
|
|
6570
6570
|
}
|
|
6571
6571
|
}
|
|
6572
6572
|
const Et = [], xt = {};
|
|
6573
|
-
class
|
|
6573
|
+
class pe {
|
|
6574
6574
|
/**
|
|
6575
6575
|
@internal
|
|
6576
6576
|
*/
|
|
@@ -6583,7 +6583,7 @@ class me {
|
|
|
6583
6583
|
you must make a copy if you want need to preserve that.
|
|
6584
6584
|
*/
|
|
6585
6585
|
static create(e, n) {
|
|
6586
|
-
return n.length ? Nn(n, e, 0, xt) :
|
|
6586
|
+
return n.length ? Nn(n, e, 0, xt) : we;
|
|
6587
6587
|
}
|
|
6588
6588
|
/**
|
|
6589
6589
|
Find all decorations in this set which touch the given range
|
|
@@ -6613,7 +6613,7 @@ class me {
|
|
|
6613
6613
|
document.
|
|
6614
6614
|
*/
|
|
6615
6615
|
map(e, n, r) {
|
|
6616
|
-
return this ==
|
|
6616
|
+
return this == we || e.maps.length == 0 ? this : this.mapInner(e, n, 0, 0, r || xt);
|
|
6617
6617
|
}
|
|
6618
6618
|
/**
|
|
6619
6619
|
@internal
|
|
@@ -6624,7 +6624,7 @@ class me {
|
|
|
6624
6624
|
let a = this.local[l].map(e, r, i);
|
|
6625
6625
|
a && a.type.valid(n, a) ? (o || (o = [])).push(a) : s.onRemove && s.onRemove(this.local[l].spec);
|
|
6626
6626
|
}
|
|
6627
|
-
return this.children.length ? Ou(this.children, o || [], e, n, r, i, s) : o ? new
|
|
6627
|
+
return this.children.length ? Ou(this.children, o || [], e, n, r, i, s) : o ? new pe(o.sort(vt), Et) : we;
|
|
6628
6628
|
}
|
|
6629
6629
|
/**
|
|
6630
6630
|
Add the given array of decorations to the ones in the set,
|
|
@@ -6633,7 +6633,7 @@ class me {
|
|
|
6633
6633
|
structure.
|
|
6634
6634
|
*/
|
|
6635
6635
|
add(e, n) {
|
|
6636
|
-
return n.length ? this ==
|
|
6636
|
+
return n.length ? this == we ? pe.create(e, n) : this.addInner(e, n, 0) : this;
|
|
6637
6637
|
}
|
|
6638
6638
|
addInner(e, n, r) {
|
|
6639
6639
|
let i, s = 0;
|
|
@@ -6648,14 +6648,14 @@ class me {
|
|
|
6648
6648
|
let o = Do(s ? Fo(n) : n, -r);
|
|
6649
6649
|
for (let l = 0; l < o.length; l++)
|
|
6650
6650
|
o[l].type.valid(e, o[l]) || o.splice(l--, 1);
|
|
6651
|
-
return new
|
|
6651
|
+
return new pe(o.length ? this.local.concat(o).sort(vt) : this.local, i || this.children);
|
|
6652
6652
|
}
|
|
6653
6653
|
/**
|
|
6654
6654
|
Create a new set that contains the decorations in this set, minus
|
|
6655
6655
|
the ones in the given array.
|
|
6656
6656
|
*/
|
|
6657
6657
|
remove(e) {
|
|
6658
|
-
return e.length == 0 || this ==
|
|
6658
|
+
return e.length == 0 || this == we ? this : this.removeInner(e, 0);
|
|
6659
6659
|
}
|
|
6660
6660
|
removeInner(e, n) {
|
|
6661
6661
|
let r = this.children, i = this.local;
|
|
@@ -6667,7 +6667,7 @@ class me {
|
|
|
6667
6667
|
continue;
|
|
6668
6668
|
r == this.children && (r = this.children.slice());
|
|
6669
6669
|
let c = r[s + 2].removeInner(o, l + 1);
|
|
6670
|
-
c !=
|
|
6670
|
+
c != we ? r[s + 2] = c : (r.splice(s, 3), s -= 3);
|
|
6671
6671
|
}
|
|
6672
6672
|
if (i.length) {
|
|
6673
6673
|
for (let s = 0, o; s < e.length; s++)
|
|
@@ -6675,13 +6675,13 @@ class me {
|
|
|
6675
6675
|
for (let l = 0; l < i.length; l++)
|
|
6676
6676
|
i[l].eq(o, n) && (i == this.local && (i = this.local.slice()), i.splice(l--, 1));
|
|
6677
6677
|
}
|
|
6678
|
-
return r == this.children && i == this.local ? this : i.length || r.length ? new
|
|
6678
|
+
return r == this.children && i == this.local ? this : i.length || r.length ? new pe(i, r) : we;
|
|
6679
6679
|
}
|
|
6680
6680
|
forChild(e, n) {
|
|
6681
|
-
if (this ==
|
|
6681
|
+
if (this == we)
|
|
6682
6682
|
return this;
|
|
6683
6683
|
if (n.isLeaf)
|
|
6684
|
-
return
|
|
6684
|
+
return pe.empty;
|
|
6685
6685
|
let r, i;
|
|
6686
6686
|
for (let l = 0; l < this.children.length; l += 3)
|
|
6687
6687
|
if (this.children[l] >= e) {
|
|
@@ -6691,16 +6691,16 @@ class me {
|
|
|
6691
6691
|
let s = e + 1, o = s + n.content.size;
|
|
6692
6692
|
for (let l = 0; l < this.local.length; l++) {
|
|
6693
6693
|
let a = this.local[l];
|
|
6694
|
-
if (a.from < o && a.to > s && a.type instanceof
|
|
6694
|
+
if (a.from < o && a.to > s && a.type instanceof lt) {
|
|
6695
6695
|
let c = Math.max(s, a.from) - s, d = Math.min(o, a.to) - s;
|
|
6696
6696
|
c < d && (i || (i = [])).push(a.copy(c, d));
|
|
6697
6697
|
}
|
|
6698
6698
|
}
|
|
6699
6699
|
if (i) {
|
|
6700
|
-
let l = new
|
|
6700
|
+
let l = new pe(i.sort(vt), Et);
|
|
6701
6701
|
return r ? new ht([l, r]) : l;
|
|
6702
6702
|
}
|
|
6703
|
-
return r ||
|
|
6703
|
+
return r || we;
|
|
6704
6704
|
}
|
|
6705
6705
|
/**
|
|
6706
6706
|
@internal
|
|
@@ -6708,7 +6708,7 @@ class me {
|
|
|
6708
6708
|
eq(e) {
|
|
6709
6709
|
if (this == e)
|
|
6710
6710
|
return !0;
|
|
6711
|
-
if (!(e instanceof
|
|
6711
|
+
if (!(e instanceof pe) || this.local.length != e.local.length || this.children.length != e.children.length)
|
|
6712
6712
|
return !1;
|
|
6713
6713
|
for (let n = 0; n < this.local.length; n++)
|
|
6714
6714
|
if (!this.local[n].eq(e.local[n]))
|
|
@@ -6728,22 +6728,22 @@ class me {
|
|
|
6728
6728
|
@internal
|
|
6729
6729
|
*/
|
|
6730
6730
|
localsInner(e) {
|
|
6731
|
-
if (this ==
|
|
6731
|
+
if (this == we)
|
|
6732
6732
|
return Et;
|
|
6733
|
-
if (e.inlineContent || !this.local.some(
|
|
6733
|
+
if (e.inlineContent || !this.local.some(lt.is))
|
|
6734
6734
|
return this.local;
|
|
6735
6735
|
let n = [];
|
|
6736
6736
|
for (let r = 0; r < this.local.length; r++)
|
|
6737
|
-
this.local[r].type instanceof
|
|
6737
|
+
this.local[r].type instanceof lt || n.push(this.local[r]);
|
|
6738
6738
|
return n;
|
|
6739
6739
|
}
|
|
6740
6740
|
forEachSet(e) {
|
|
6741
6741
|
e(this);
|
|
6742
6742
|
}
|
|
6743
6743
|
}
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
const
|
|
6744
|
+
pe.empty = new pe([], []);
|
|
6745
|
+
pe.removeOverlap = Jr;
|
|
6746
|
+
const we = pe.empty;
|
|
6747
6747
|
class ht {
|
|
6748
6748
|
constructor(e) {
|
|
6749
6749
|
this.members = e;
|
|
@@ -6754,11 +6754,11 @@ class ht {
|
|
|
6754
6754
|
}
|
|
6755
6755
|
forChild(e, n) {
|
|
6756
6756
|
if (n.isLeaf)
|
|
6757
|
-
return
|
|
6757
|
+
return pe.empty;
|
|
6758
6758
|
let r = [];
|
|
6759
6759
|
for (let i = 0; i < this.members.length; i++) {
|
|
6760
6760
|
let s = this.members[i].forChild(e, n);
|
|
6761
|
-
s !=
|
|
6761
|
+
s != we && (s instanceof ht ? r = r.concat(s.members) : r.push(s));
|
|
6762
6762
|
}
|
|
6763
6763
|
return ht.from(r);
|
|
6764
6764
|
}
|
|
@@ -6790,11 +6790,11 @@ class ht {
|
|
|
6790
6790
|
static from(e) {
|
|
6791
6791
|
switch (e.length) {
|
|
6792
6792
|
case 0:
|
|
6793
|
-
return
|
|
6793
|
+
return we;
|
|
6794
6794
|
case 1:
|
|
6795
6795
|
return e[0];
|
|
6796
6796
|
default:
|
|
6797
|
-
return new ht(e.every((n) => n instanceof
|
|
6797
|
+
return new ht(e.every((n) => n instanceof pe) ? e : e.reduce((n, r) => n.concat(r instanceof pe ? r : r.members), []));
|
|
6798
6798
|
}
|
|
6799
6799
|
}
|
|
6800
6800
|
forEachSet(e) {
|
|
@@ -6833,7 +6833,7 @@ function Ou(t, e, n, r, i, s, o) {
|
|
|
6833
6833
|
let m = n.map(t[c + 1] + s, -1), p = m - i, { index: k, offset: y } = r.content.findIndex(f), b = r.maybeChild(k);
|
|
6834
6834
|
if (b && y == f && y + b.nodeSize == p) {
|
|
6835
6835
|
let v = l[c + 2].mapInner(n, b, d + 1, t[c] + s + 1, o);
|
|
6836
|
-
v !=
|
|
6836
|
+
v != we ? (l[c] = f, l[c + 1] = p, l[c + 2] = v) : (l[c + 1] = -2, a = !0);
|
|
6837
6837
|
} else
|
|
6838
6838
|
a = !0;
|
|
6839
6839
|
}
|
|
@@ -6849,7 +6849,7 @@ function Ou(t, e, n, r, i, s, o) {
|
|
|
6849
6849
|
l.splice(m, 0, d.children[f], d.children[f + 1], d.children[f + 2]);
|
|
6850
6850
|
}
|
|
6851
6851
|
}
|
|
6852
|
-
return new
|
|
6852
|
+
return new pe(e.sort(vt), l);
|
|
6853
6853
|
}
|
|
6854
6854
|
function Do(t, e) {
|
|
6855
6855
|
if (!e || !t.length)
|
|
@@ -6857,7 +6857,7 @@ function Do(t, e) {
|
|
|
6857
6857
|
let n = [];
|
|
6858
6858
|
for (let r = 0; r < t.length; r++) {
|
|
6859
6859
|
let i = t[r];
|
|
6860
|
-
n.push(new
|
|
6860
|
+
n.push(new je(i.from + e, i.to + e, i.type));
|
|
6861
6861
|
}
|
|
6862
6862
|
return n;
|
|
6863
6863
|
}
|
|
@@ -6895,13 +6895,13 @@ function Nn(t, e, n, r) {
|
|
|
6895
6895
|
if (c) {
|
|
6896
6896
|
s = !0;
|
|
6897
6897
|
let d = Nn(c, l, n + a + 1, r);
|
|
6898
|
-
d !=
|
|
6898
|
+
d != we && i.push(a, a + l.nodeSize, d);
|
|
6899
6899
|
}
|
|
6900
6900
|
});
|
|
6901
6901
|
let o = Do(s ? Fo(t) : t, -n).sort(vt);
|
|
6902
6902
|
for (let l = 0; l < o.length; l++)
|
|
6903
6903
|
o[l].type.valid(e, o[l]) || (r.onRemove && r.onRemove(o[l].spec), o.splice(l--, 1));
|
|
6904
|
-
return o.length || i.length ? new
|
|
6904
|
+
return o.length || i.length ? new pe(o, i) : we;
|
|
6905
6905
|
}
|
|
6906
6906
|
function vt(t, e) {
|
|
6907
6907
|
return t.from - e.from || t.to - e.to;
|
|
@@ -6929,7 +6929,7 @@ function ts(t, e, n) {
|
|
|
6929
6929
|
e++;
|
|
6930
6930
|
t.splice(e, 0, n);
|
|
6931
6931
|
}
|
|
6932
|
-
class le extends
|
|
6932
|
+
class le extends Y {
|
|
6933
6933
|
/**
|
|
6934
6934
|
Create a gap cursor.
|
|
6935
6935
|
*/
|
|
@@ -6938,7 +6938,7 @@ class le extends X {
|
|
|
6938
6938
|
}
|
|
6939
6939
|
map(e, n) {
|
|
6940
6940
|
let r = e.resolve(n.map(this.head));
|
|
6941
|
-
return le.valid(r) ? new le(r) :
|
|
6941
|
+
return le.valid(r) ? new le(r) : Y.near(r);
|
|
6942
6942
|
}
|
|
6943
6943
|
content() {
|
|
6944
6944
|
return K.empty;
|
|
@@ -7016,7 +7016,7 @@ class le extends X {
|
|
|
7016
7016
|
}
|
|
7017
7017
|
le.prototype.visible = !1;
|
|
7018
7018
|
le.findFrom = le.findGapCursorFrom;
|
|
7019
|
-
|
|
7019
|
+
Y.jsonID("gapcursor", le);
|
|
7020
7020
|
class Gr {
|
|
7021
7021
|
constructor(e) {
|
|
7022
7022
|
this.pos = e;
|
|
@@ -7026,7 +7026,7 @@ class Gr {
|
|
|
7026
7026
|
}
|
|
7027
7027
|
resolve(e) {
|
|
7028
7028
|
let n = e.resolve(this.pos);
|
|
7029
|
-
return le.valid(n) ? new le(n) :
|
|
7029
|
+
return le.valid(n) ? new le(n) : Y.near(n);
|
|
7030
7030
|
}
|
|
7031
7031
|
}
|
|
7032
7032
|
function Po(t) {
|
|
@@ -7089,7 +7089,7 @@ function un(t, e) {
|
|
|
7089
7089
|
const n = t == "vert" ? e > 0 ? "down" : "up" : e > 0 ? "right" : "left";
|
|
7090
7090
|
return function(r, i, s) {
|
|
7091
7091
|
let o = r.selection, l = e > 0 ? o.$to : o.$from, a = o.empty;
|
|
7092
|
-
if (o instanceof
|
|
7092
|
+
if (o instanceof Q) {
|
|
7093
7093
|
if (!s.endOfTextblock(n) || l.depth == 0)
|
|
7094
7094
|
return !1;
|
|
7095
7095
|
a = !1, l = r.doc.resolve(e > 0 ? l.after() : l.before());
|
|
@@ -7117,13 +7117,13 @@ function $u(t, e) {
|
|
|
7117
7117
|
for (let o = r.length - 1; o >= 0; o--)
|
|
7118
7118
|
i = q.from(r[o].createAndFill(null, i));
|
|
7119
7119
|
let s = t.state.tr.replace(n.pos, n.pos, new K(i, 0, 0));
|
|
7120
|
-
return s.setSelection(
|
|
7120
|
+
return s.setSelection(Q.near(s.doc.resolve(n.pos + 1))), t.dispatch(s), !1;
|
|
7121
7121
|
}
|
|
7122
7122
|
function Vu(t) {
|
|
7123
7123
|
if (!(t.selection instanceof le))
|
|
7124
7124
|
return null;
|
|
7125
7125
|
let e = document.createElement("div");
|
|
7126
|
-
return e.className = "ProseMirror-gapcursor",
|
|
7126
|
+
return e.className = "ProseMirror-gapcursor", pe.create(t.doc, [je.widget(t.selection.head, e, { key: "gapcursor" })]);
|
|
7127
7127
|
}
|
|
7128
7128
|
const zu = Rr.create({
|
|
7129
7129
|
name: "gapCursor",
|
|
@@ -7487,7 +7487,7 @@ const Hu = {
|
|
|
7487
7487
|
tight: "1.25",
|
|
7488
7488
|
normal: "1.5"
|
|
7489
7489
|
}
|
|
7490
|
-
},
|
|
7490
|
+
}, nt = {
|
|
7491
7491
|
brand: {
|
|
7492
7492
|
primary: {
|
|
7493
7493
|
DEFAULT: "#C14615"
|
|
@@ -7507,7 +7507,7 @@ const Hu = {
|
|
|
7507
7507
|
200: "#fde68a"
|
|
7508
7508
|
}
|
|
7509
7509
|
}
|
|
7510
|
-
},
|
|
7510
|
+
}, re = {
|
|
7511
7511
|
xs: "0.25rem",
|
|
7512
7512
|
// 4px - Fine control (½ of base unit)
|
|
7513
7513
|
sm: "0.5rem",
|
|
@@ -7519,36 +7519,36 @@ const Hu = {
|
|
|
7519
7519
|
xl: "2rem"
|
|
7520
7520
|
}, Uu = {
|
|
7521
7521
|
// Headings - using design token sizes and weights
|
|
7522
|
-
h1: `font-size: ${se.fontSize["4xl"]}; font-weight: ${se.fontWeight.semibold}; line-height: ${se.lineHeight.tight}; margin: ${
|
|
7523
|
-
h2: `font-size: ${se.fontSize["2xl"]}; font-weight: ${se.fontWeight.semibold}; line-height: ${se.lineHeight.tight}; margin: ${
|
|
7524
|
-
h3: `font-size: ${se.fontSize.xl}; font-weight: ${se.fontWeight.semibold}; line-height: ${se.lineHeight.tight}; margin: ${
|
|
7525
|
-
h4: `font-size: ${se.fontSize.lg}; font-weight: ${se.fontWeight.semibold}; line-height: ${se.lineHeight.tight}; margin: ${
|
|
7526
|
-
h5: `font-size: ${se.fontSize.base}; font-weight: ${se.fontWeight.semibold}; line-height: ${se.lineHeight.tight}; margin: ${
|
|
7527
|
-
h6: `font-size: ${se.fontSize.sm}; font-weight: ${se.fontWeight.semibold}; line-height: ${se.lineHeight.tight}; margin: ${
|
|
7522
|
+
h1: `font-size: ${se.fontSize["4xl"]}; font-weight: ${se.fontWeight.semibold}; line-height: ${se.lineHeight.tight}; margin: ${re.md} 0 ${re.sm} 0;`,
|
|
7523
|
+
h2: `font-size: ${se.fontSize["2xl"]}; font-weight: ${se.fontWeight.semibold}; line-height: ${se.lineHeight.tight}; margin: ${re.md} 0 ${re.sm} 0;`,
|
|
7524
|
+
h3: `font-size: ${se.fontSize.xl}; font-weight: ${se.fontWeight.semibold}; line-height: ${se.lineHeight.tight}; margin: ${re.md} 0 ${re.sm} 0;`,
|
|
7525
|
+
h4: `font-size: ${se.fontSize.lg}; font-weight: ${se.fontWeight.semibold}; line-height: ${se.lineHeight.tight}; margin: ${re.md} 0 ${re.sm} 0;`,
|
|
7526
|
+
h5: `font-size: ${se.fontSize.base}; font-weight: ${se.fontWeight.semibold}; line-height: ${se.lineHeight.tight}; margin: ${re.md} 0 ${re.sm} 0;`,
|
|
7527
|
+
h6: `font-size: ${se.fontSize.sm}; font-weight: ${se.fontWeight.semibold}; line-height: ${se.lineHeight.tight}; margin: ${re.md} 0 ${re.sm} 0;`,
|
|
7528
7528
|
// Paragraph
|
|
7529
7529
|
p: `min-height: ${se.lineHeight.normal}em; margin: 0;`,
|
|
7530
7530
|
// Lists
|
|
7531
|
-
ul: `list-style-type: disc; list-style-position: outside; padding-left: ${
|
|
7532
|
-
ol: `list-style-type: decimal; list-style-position: outside; padding-left: ${
|
|
7533
|
-
li: `display: list-item; margin: ${
|
|
7531
|
+
ul: `list-style-type: disc; list-style-position: outside; padding-left: ${re.xl}; margin: ${re.md} 0;`,
|
|
7532
|
+
ol: `list-style-type: decimal; list-style-position: outside; padding-left: ${re.xl}; margin: ${re.md} 0;`,
|
|
7533
|
+
li: `display: list-item; margin: ${re.xs} 0;`,
|
|
7534
7534
|
// Text formatting
|
|
7535
7535
|
strong: `font-weight: ${se.fontWeight.bold};`,
|
|
7536
7536
|
em: "font-style: italic;",
|
|
7537
7537
|
s: "text-decoration: line-through;",
|
|
7538
7538
|
u: "text-decoration: underline;",
|
|
7539
7539
|
// Code - using mono font family and token colors
|
|
7540
|
-
code: `background-color: ${
|
|
7541
|
-
pre: `background: ${
|
|
7540
|
+
code: `background-color: ${nt.neutral.gray[100]}; border-radius: 0.4rem; font-size: ${se.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${se.fontFamily.mono};`,
|
|
7541
|
+
pre: `background: ${nt.neutral.gray[800]}; border-radius: ${re.sm}; color: ${nt.neutral.gray[100]}; font-family: ${se.fontFamily.mono}; margin: ${re.lg} 0; padding: 0.75rem ${re.md}; overflow-x: auto;`,
|
|
7542
7542
|
// Blockquote
|
|
7543
|
-
blockquote: `border-left: 3px solid ${
|
|
7543
|
+
blockquote: `border-left: 3px solid ${nt.neutral.gray[300]}; margin: ${re.lg} 0; padding-left: ${re.md}; color: ${nt.neutral.gray[500]};`,
|
|
7544
7544
|
// Horizontal rule
|
|
7545
|
-
hr: `border: none; border-top: 1px solid ${
|
|
7545
|
+
hr: `border: none; border-top: 1px solid ${nt.neutral.gray[200]}; margin: ${re.xl} 0;`,
|
|
7546
7546
|
// Links - using brand primary color
|
|
7547
|
-
a: `color: ${
|
|
7547
|
+
a: `color: ${nt.brand.primary.DEFAULT}; text-decoration: underline; cursor: pointer;`,
|
|
7548
7548
|
// Mark/Highlight - using warning palette
|
|
7549
|
-
mark: `background-color: ${
|
|
7549
|
+
mark: `background-color: ${nt.palettes.warning[200]}; border-radius: ${re.xs}; padding: 0 0.125rem;`,
|
|
7550
7550
|
// Task list checkbox label
|
|
7551
|
-
label: `display: flex; align-items: center; gap: ${
|
|
7551
|
+
label: `display: flex; align-items: center; gap: ${re.sm}; cursor: pointer;`,
|
|
7552
7552
|
// Input checkbox (task items)
|
|
7553
7553
|
input: "cursor: pointer; margin: 0;"
|
|
7554
7554
|
}, qu = {
|
|
@@ -7633,7 +7633,7 @@ const ju = ({
|
|
|
7633
7633
|
isDisabled: b = !1,
|
|
7634
7634
|
includeInlineStyles: v = !0,
|
|
7635
7635
|
...C
|
|
7636
|
-
} = t, { zoom: I, setZoom: S } = Ma(), w = Si.lineHeight, E = n * w, T = i ? void 0 : r * w,
|
|
7636
|
+
} = t, { zoom: I, setZoom: S } = Ma(), w = Si.lineHeight, E = n * w, T = i ? void 0 : r * w, z = _.useMemo(() => _u(a), [a]), { Component: V, label: H, shouldLabelBeOutside: R, getBaseProps: M, getLabelProps: P, getInputWrapperProps: $ } = bl({
|
|
7637
7637
|
...C,
|
|
7638
7638
|
variant: c,
|
|
7639
7639
|
// Explicitly pass variant to ensure bordered styling
|
|
@@ -7641,14 +7641,14 @@ const ju = ({
|
|
|
7641
7641
|
isMultiline: !0
|
|
7642
7642
|
}), U = H ? /* @__PURE__ */ u("label", { ...P(), children: H }) : null, ne = _.useCallback(
|
|
7643
7643
|
({ editor: W }) => {
|
|
7644
|
-
const
|
|
7644
|
+
const ge = W.getHTML(), ae = v ? Ku(ge) : ge, ye = W.getJSON(), ze = W.getText(), X = ze.length, Ee = ze.split(/\s+/).filter((Oe) => Oe.length > 0).length, ee = {
|
|
7645
7645
|
html: ae,
|
|
7646
|
-
json:
|
|
7647
|
-
text:
|
|
7648
|
-
characters:
|
|
7649
|
-
words:
|
|
7646
|
+
json: ye,
|
|
7647
|
+
text: ze,
|
|
7648
|
+
characters: X,
|
|
7649
|
+
words: Ee
|
|
7650
7650
|
};
|
|
7651
|
-
if (m?.(
|
|
7651
|
+
if (m?.(ee), p?.(ee), "onChange" in C && typeof C.onChange == "function") {
|
|
7652
7652
|
const Oe = {
|
|
7653
7653
|
target: { value: ae },
|
|
7654
7654
|
currentTarget: { value: ae }
|
|
@@ -7658,7 +7658,7 @@ const ju = ({
|
|
|
7658
7658
|
},
|
|
7659
7659
|
[m, p, C, v]
|
|
7660
7660
|
);
|
|
7661
|
-
return /* @__PURE__ */ A(
|
|
7661
|
+
return /* @__PURE__ */ A(V, { ...M(), children: [
|
|
7662
7662
|
R ? U : null,
|
|
7663
7663
|
/* @__PURE__ */ u(
|
|
7664
7664
|
"div",
|
|
@@ -7697,7 +7697,7 @@ const ju = ({
|
|
|
7697
7697
|
class: "focus:outline-none w-full h-full"
|
|
7698
7698
|
}
|
|
7699
7699
|
},
|
|
7700
|
-
extensions:
|
|
7700
|
+
extensions: z,
|
|
7701
7701
|
content: f || d || t.defaultValue || "",
|
|
7702
7702
|
onUpdate: ne
|
|
7703
7703
|
}
|
|
@@ -7753,54 +7753,55 @@ const ns = [
|
|
|
7753
7753
|
buttonVariant: k = "bordered",
|
|
7754
7754
|
buttonColor: y = "default",
|
|
7755
7755
|
inputVariant: b = "bordered",
|
|
7756
|
-
|
|
7757
|
-
|
|
7756
|
+
size: v = "md",
|
|
7757
|
+
className: C = "",
|
|
7758
|
+
showCard: I = !0
|
|
7758
7759
|
}) => {
|
|
7759
|
-
const
|
|
7760
|
+
const S = { ...Zu, ...d }, w = Array.isArray(t) ? t : ns, E = {
|
|
7760
7761
|
2: "grid-cols-2",
|
|
7761
7762
|
3: "grid-cols-3"
|
|
7762
|
-
},
|
|
7763
|
+
}, T = {
|
|
7763
7764
|
3: "sm:grid-cols-3",
|
|
7764
7765
|
4: "sm:grid-cols-4",
|
|
7765
7766
|
5: "sm:grid-cols-5",
|
|
7766
7767
|
6: "sm:grid-cols-6"
|
|
7767
|
-
},
|
|
7768
|
+
}, z = `${E[f]} ${T[m]}`, [V, H] = $r(
|
|
7768
7769
|
e,
|
|
7769
7770
|
n,
|
|
7770
7771
|
r
|
|
7771
|
-
), [
|
|
7772
|
-
(
|
|
7772
|
+
), [R, M] = J(""), [P, $] = J(!1), [U, ne] = J(0), W = ce(
|
|
7773
|
+
(X) => {
|
|
7773
7774
|
if (p) return;
|
|
7774
|
-
const
|
|
7775
|
-
amount:
|
|
7775
|
+
const Ee = {
|
|
7776
|
+
amount: X.amount,
|
|
7776
7777
|
isCustom: !1,
|
|
7777
|
-
presetId:
|
|
7778
|
+
presetId: X.id
|
|
7778
7779
|
};
|
|
7779
|
-
|
|
7780
|
+
H(Ee), M(""), $(!1), ne((ee) => ee + 1), i?.(Ee);
|
|
7780
7781
|
},
|
|
7781
|
-
[p,
|
|
7782
|
-
),
|
|
7783
|
-
(
|
|
7782
|
+
[p, H, i]
|
|
7783
|
+
), ge = ce(
|
|
7784
|
+
(X) => {
|
|
7784
7785
|
if (p) return;
|
|
7785
|
-
if (
|
|
7786
|
-
|
|
7786
|
+
if (M(X !== void 0 ? String(X) : ""), i) {
|
|
7787
|
+
H(null);
|
|
7787
7788
|
return;
|
|
7788
7789
|
}
|
|
7789
|
-
if (
|
|
7790
|
-
|
|
7790
|
+
if (X === void 0 || isNaN(X)) {
|
|
7791
|
+
H(null);
|
|
7791
7792
|
return;
|
|
7792
7793
|
}
|
|
7793
|
-
|
|
7794
|
-
amount:
|
|
7794
|
+
H({
|
|
7795
|
+
amount: X,
|
|
7795
7796
|
isCustom: !0
|
|
7796
7797
|
});
|
|
7797
7798
|
},
|
|
7798
|
-
[p,
|
|
7799
|
-
),
|
|
7799
|
+
[p, H, i]
|
|
7800
|
+
), ae = ce(() => {
|
|
7800
7801
|
if (p) return;
|
|
7801
|
-
const
|
|
7802
|
-
|
|
7803
|
-
}, [p,
|
|
7802
|
+
const X = R !== "" ? parseFloat(R) : void 0;
|
|
7803
|
+
X === void 0 || isNaN(X) || (i?.({ amount: X, isCustom: !0 }), M(""), $(!1), ne((Ee) => Ee + 1));
|
|
7804
|
+
}, [p, R, i]), ye = _.useMemo(
|
|
7804
7805
|
() => ({
|
|
7805
7806
|
style: "currency",
|
|
7806
7807
|
currency: s,
|
|
@@ -7809,47 +7810,48 @@ const ns = [
|
|
|
7809
7810
|
// the currency and formatting match our locale prop
|
|
7810
7811
|
}),
|
|
7811
7812
|
[s]
|
|
7812
|
-
),
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
const
|
|
7813
|
+
), ze = /* @__PURE__ */ A("div", { className: "space-y-4", "data-testid": "donation-amounts-root", children: [
|
|
7814
|
+
S.title && /* @__PURE__ */ u("h2", { className: "text-base font-semibold", "data-testid": "donation-amounts-title", children: S.title }),
|
|
7815
|
+
w.length > 0 && /* @__PURE__ */ u("div", { className: L("grid gap-3", z), "data-testid": "donation-amounts-presets", children: w.map((X) => {
|
|
7816
|
+
const Ee = V !== null && !V.isCustom && V.presetId === X.id;
|
|
7816
7817
|
return /* @__PURE__ */ u(
|
|
7817
7818
|
oe,
|
|
7818
7819
|
{
|
|
7819
|
-
color:
|
|
7820
|
-
variant:
|
|
7820
|
+
color: Ee ? "primary" : y,
|
|
7821
|
+
variant: Ee ? "solid" : k,
|
|
7821
7822
|
className: "w-full",
|
|
7822
|
-
onPress: () =>
|
|
7823
|
+
onPress: () => W(X),
|
|
7823
7824
|
isDisabled: p,
|
|
7824
|
-
"data-testid": `donation-amounts-preset-${
|
|
7825
|
-
children:
|
|
7825
|
+
"data-testid": `donation-amounts-preset-${X.id}`,
|
|
7826
|
+
children: X.label || Gu(X.amount, o, s)
|
|
7826
7827
|
},
|
|
7827
|
-
|
|
7828
|
+
X.id
|
|
7828
7829
|
);
|
|
7829
7830
|
}) }),
|
|
7830
7831
|
l && /* @__PURE__ */ A("div", { className: "flex gap-3 items-start", children: [
|
|
7831
7832
|
/* @__PURE__ */ u(
|
|
7832
7833
|
Ls,
|
|
7833
7834
|
{
|
|
7834
|
-
placeholder:
|
|
7835
|
-
"aria-label":
|
|
7835
|
+
placeholder: S.customAmountPlaceholder,
|
|
7836
|
+
"aria-label": S.customAmountAriaLabel,
|
|
7836
7837
|
onInput: i ? () => {
|
|
7837
|
-
|
|
7838
|
+
H(null), $(!0);
|
|
7838
7839
|
} : void 0,
|
|
7839
7840
|
variant: b,
|
|
7840
7841
|
radius: "full",
|
|
7842
|
+
size: v,
|
|
7841
7843
|
minValue: a,
|
|
7842
7844
|
maxValue: c,
|
|
7843
7845
|
step: 0.01,
|
|
7844
|
-
formatOptions:
|
|
7845
|
-
value:
|
|
7846
|
-
onValueChange:
|
|
7846
|
+
formatOptions: ye,
|
|
7847
|
+
value: R !== "" ? parseFloat(R) : void 0,
|
|
7848
|
+
onValueChange: ge,
|
|
7847
7849
|
isDisabled: p,
|
|
7848
7850
|
className: "flex-1",
|
|
7849
7851
|
"data-testid": "donation-amounts-custom-input",
|
|
7850
7852
|
hideStepper: !0
|
|
7851
7853
|
},
|
|
7852
|
-
i ? `custom-${
|
|
7854
|
+
i ? `custom-${U}` : V?.isCustom === !1 ? V.presetId : "custom"
|
|
7853
7855
|
),
|
|
7854
7856
|
i && /* @__PURE__ */ u(
|
|
7855
7857
|
oe,
|
|
@@ -7857,16 +7859,17 @@ const ns = [
|
|
|
7857
7859
|
color: "primary",
|
|
7858
7860
|
variant: "solid",
|
|
7859
7861
|
radius: "full",
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
|
|
7862
|
+
size: v,
|
|
7863
|
+
className: "shrink-0",
|
|
7864
|
+
onPress: ae,
|
|
7865
|
+
isDisabled: p || !P,
|
|
7863
7866
|
"data-testid": "donation-amounts-add-button",
|
|
7864
|
-
children:
|
|
7867
|
+
children: S.addDonationButton
|
|
7865
7868
|
}
|
|
7866
7869
|
)
|
|
7867
7870
|
] })
|
|
7868
7871
|
] });
|
|
7869
|
-
return
|
|
7872
|
+
return I ? /* @__PURE__ */ u(Me, { className: L("w-full", C), "data-testid": "donation-amounts-card", children: /* @__PURE__ */ u(Pe, { children: ze }) }) : /* @__PURE__ */ u("div", { className: L("w-full", C), "data-testid": "donation-amounts-plain", children: ze });
|
|
7870
7873
|
};
|
|
7871
7874
|
Qu.displayName = "DonationAmounts";
|
|
7872
7875
|
const Yu = (t) => {
|
|
@@ -7923,9 +7926,9 @@ const Yu = (t) => {
|
|
|
7923
7926
|
Math.max(0, e),
|
|
7924
7927
|
n
|
|
7925
7928
|
), v = Dt(null), C = Dt(!1);
|
|
7926
|
-
|
|
7929
|
+
We(() => () => {
|
|
7927
7930
|
v.current && clearInterval(v.current);
|
|
7928
|
-
}, []),
|
|
7931
|
+
}, []), We(() => {
|
|
7929
7932
|
if (!d || y <= 0) {
|
|
7930
7933
|
v.current && (clearInterval(v.current), v.current = null);
|
|
7931
7934
|
return;
|
|
@@ -7935,7 +7938,7 @@ const Yu = (t) => {
|
|
|
7935
7938
|
}, 1e3), () => {
|
|
7936
7939
|
v.current && (clearInterval(v.current), v.current = null);
|
|
7937
7940
|
};
|
|
7938
|
-
}, [d, y, b, r]),
|
|
7941
|
+
}, [d, y, b, r]), We(() => {
|
|
7939
7942
|
y > 0 && (C.current = !1);
|
|
7940
7943
|
}, [y]);
|
|
7941
7944
|
const I = a || Xu(i), S = ed(s), w = {
|
|
@@ -8560,23 +8563,23 @@ function Rd(t, e, n, r) {
|
|
|
8560
8563
|
E.status === "pending" && (E.status = "aborted");
|
|
8561
8564
|
}), m = [];
|
|
8562
8565
|
}
|
|
8563
|
-
function S(E, T,
|
|
8564
|
-
const
|
|
8566
|
+
function S(E, T, z) {
|
|
8567
|
+
const V = T !== "success";
|
|
8565
8568
|
switch (m = m.filter((H) => H !== E), a) {
|
|
8566
8569
|
case "pending":
|
|
8567
8570
|
break;
|
|
8568
8571
|
case "failed":
|
|
8569
|
-
if (
|
|
8572
|
+
if (V || !t.dataAfterTimeout) return;
|
|
8570
8573
|
break;
|
|
8571
8574
|
default:
|
|
8572
8575
|
return;
|
|
8573
8576
|
}
|
|
8574
8577
|
if (T === "abort") {
|
|
8575
|
-
d =
|
|
8578
|
+
d = z, C();
|
|
8576
8579
|
return;
|
|
8577
8580
|
}
|
|
8578
|
-
if (
|
|
8579
|
-
d =
|
|
8581
|
+
if (V) {
|
|
8582
|
+
d = z, m.length || (o.length ? w() : C());
|
|
8580
8583
|
return;
|
|
8581
8584
|
}
|
|
8582
8585
|
if (k(), I(), !t.random) {
|
|
@@ -8584,7 +8587,7 @@ function Rd(t, e, n, r) {
|
|
|
8584
8587
|
H !== -1 && H !== t.index && (t.index = H);
|
|
8585
8588
|
}
|
|
8586
8589
|
a = "completed", p.forEach((H) => {
|
|
8587
|
-
H(
|
|
8590
|
+
H(z);
|
|
8588
8591
|
});
|
|
8589
8592
|
}
|
|
8590
8593
|
function w() {
|
|
@@ -8604,8 +8607,8 @@ function Rd(t, e, n, r) {
|
|
|
8604
8607
|
const T = {
|
|
8605
8608
|
status: "pending",
|
|
8606
8609
|
resource: E,
|
|
8607
|
-
callback: (
|
|
8608
|
-
S(T,
|
|
8610
|
+
callback: (z, V) => {
|
|
8611
|
+
S(T, z, V);
|
|
8609
8612
|
}
|
|
8610
8613
|
};
|
|
8611
8614
|
m.push(T), c++, f = setTimeout(w, t.rotate), n(E, e, T.callback);
|
|
@@ -9061,7 +9064,7 @@ function Jo(t) {
|
|
|
9061
9064
|
});
|
|
9062
9065
|
} else y && ((p = t.onLoad) === null || p === void 0 || p.call(t, k));
|
|
9063
9066
|
}
|
|
9064
|
-
|
|
9067
|
+
We(() => (n(!0), a), []), We(() => {
|
|
9065
9068
|
e && d();
|
|
9066
9069
|
}, [t.icon, e]);
|
|
9067
9070
|
const { name: f, data: m } = o;
|
|
@@ -9099,7 +9102,7 @@ const lr = ({
|
|
|
9099
9102
|
labels: c
|
|
9100
9103
|
}) => {
|
|
9101
9104
|
const [d, f] = J(!1), [m, p] = J(!1), k = Dt(null);
|
|
9102
|
-
return
|
|
9105
|
+
return We(() => {
|
|
9103
9106
|
const y = () => {
|
|
9104
9107
|
if (k.current) {
|
|
9105
9108
|
const b = k.current.scrollHeight > k.current.clientHeight;
|
|
@@ -9224,9 +9227,9 @@ const sf = {
|
|
|
9224
9227
|
}) => {
|
|
9225
9228
|
const C = { ...sf, ...o }, [I, S] = J(n), w = e !== void 0 ? e : I, E = (ae) => {
|
|
9226
9229
|
if (a) return;
|
|
9227
|
-
const
|
|
9228
|
-
e === void 0 && S(
|
|
9229
|
-
}, T =
|
|
9230
|
+
const ye = Math.max(0, w + ae);
|
|
9231
|
+
e === void 0 && S(ye), r?.(t.id, ye);
|
|
9232
|
+
}, T = ot(() => !dn(t.totalTicketsSold) || !dn(t.ticketsAllowed) ? !1 : t.totalTicketsSold >= t.ticketsAllowed, [t.totalTicketsSold, t.ticketsAllowed]), z = ot(() => T || !dn(t.ticketsAllowed) ? !1 : w >= t.ticketsAllowed - (t.totalTicketsSold ?? 0), [T, t.ticketsAllowed, t.totalTicketsSold, w]), V = rf(t.price, s, i), H = () => l?.renderName ? l.renderName(t.name, t) : /* @__PURE__ */ u("h2", { "data-testid": "offer-card-name", className: L("text-base font-medium", y.name), children: t.name }), R = () => k ? l?.renderPrice ? l.renderPrice(t.price, V, t) : /* @__PURE__ */ u("p", { "data-testid": "offer-card-price", className: L("text-primary text-base mt-1", y.price), children: V }) : null, M = () => !m || !t.description ? null : l?.renderDescription ? l.renderDescription(t.description, t) : /* @__PURE__ */ u(
|
|
9230
9233
|
"p",
|
|
9231
9234
|
{
|
|
9232
9235
|
"data-testid": "offer-card-description",
|
|
@@ -9258,13 +9261,13 @@ const sf = {
|
|
|
9258
9261
|
}
|
|
9259
9262
|
);
|
|
9260
9263
|
}, $ = () => {
|
|
9261
|
-
const ae = w === 0 || a,
|
|
9264
|
+
const ae = w === 0 || a, ye = z || a;
|
|
9262
9265
|
return l?.renderQuantitySelector ? l.renderQuantitySelector({
|
|
9263
9266
|
quantity: w,
|
|
9264
9267
|
onIncrement: () => E(1),
|
|
9265
9268
|
onDecrement: () => E(-1),
|
|
9266
9269
|
isDecrementDisabled: ae,
|
|
9267
|
-
isIncrementDisabled:
|
|
9270
|
+
isIncrementDisabled: ye,
|
|
9268
9271
|
isDisabled: a
|
|
9269
9272
|
}) : /* @__PURE__ */ A("div", { className: L("flex items-center gap-2", y.quantitySelector), children: [
|
|
9270
9273
|
/* @__PURE__ */ u(
|
|
@@ -9288,7 +9291,7 @@ const sf = {
|
|
|
9288
9291
|
{
|
|
9289
9292
|
"data-testid": "offer-card-increment-button",
|
|
9290
9293
|
onPress: () => E(1),
|
|
9291
|
-
isDisabled:
|
|
9294
|
+
isDisabled: ye,
|
|
9292
9295
|
variant: c,
|
|
9293
9296
|
color: w > 0 ? v : d,
|
|
9294
9297
|
radius: "full",
|
|
@@ -9341,7 +9344,7 @@ const sf = {
|
|
|
9341
9344
|
)
|
|
9342
9345
|
] }),
|
|
9343
9346
|
/* @__PURE__ */ u("div", { className: "space-x-2 pt-0 pb-2 md:p-2 h-full flex items-center justify-start md:justify-start lg:justify-end", children: T ? U() : $() })
|
|
9344
|
-
] }),
|
|
9347
|
+
] }), ge = z && !T && /* @__PURE__ */ u(
|
|
9345
9348
|
hr.div,
|
|
9346
9349
|
{
|
|
9347
9350
|
className: "w-full sm:max-w-[60%] md:max-w-[60%] lg:max-w-[60%]",
|
|
@@ -9354,10 +9357,10 @@ const sf = {
|
|
|
9354
9357
|
);
|
|
9355
9358
|
return f ? /* @__PURE__ */ A(Me, { className: L("w-full", y.base), "data-testid": b || `offer-card-${t.id}`, children: [
|
|
9356
9359
|
/* @__PURE__ */ u(Pe, { className: L("pt-1 pb-0", y.body), children: W }),
|
|
9357
|
-
/* @__PURE__ */ u(pr, { children:
|
|
9360
|
+
/* @__PURE__ */ u(pr, { children: ge && /* @__PURE__ */ u(vl, { className: L("w-full mt-0 pt-0", y.footer), children: ge }) })
|
|
9358
9361
|
] }) : /* @__PURE__ */ A("div", { className: L("w-full", y.base), "data-testid": b || `offer-card-${t.id}`, children: [
|
|
9359
9362
|
/* @__PURE__ */ u("div", { className: L("pt-1 pb-0", y.body), children: W }),
|
|
9360
|
-
/* @__PURE__ */ u(pr, { children:
|
|
9363
|
+
/* @__PURE__ */ u(pr, { children: ge && /* @__PURE__ */ u("div", { className: L("w-full mt-0 pt-0", y.footer), children: ge }) })
|
|
9361
9364
|
] });
|
|
9362
9365
|
};
|
|
9363
9366
|
Go.displayName = "OfferCard";
|
|
@@ -9572,19 +9575,19 @@ const df = {
|
|
|
9572
9575
|
classNames: y = {}
|
|
9573
9576
|
}) => {
|
|
9574
9577
|
const [b, v] = J(n), C = e !== void 0 ? e : b, I = ce(
|
|
9575
|
-
(
|
|
9578
|
+
(z, V) => {
|
|
9576
9579
|
const H = {
|
|
9577
9580
|
...C,
|
|
9578
|
-
[
|
|
9581
|
+
[z]: Math.max(0, V)
|
|
9579
9582
|
};
|
|
9580
|
-
e === void 0 && v(H), r?.(H), i?.(
|
|
9583
|
+
e === void 0 && v(H), r?.(H), i?.(z, H[z]);
|
|
9581
9584
|
},
|
|
9582
9585
|
[C, e, r, i]
|
|
9583
|
-
), S = [...t].sort((
|
|
9586
|
+
), S = [...t].sort((z, V) => (z.position ?? 0) - (V.position ?? 0)), w = hf[k], E = L("grid mx-auto pt-2", w, y.base), T = (z) => /* @__PURE__ */ u(
|
|
9584
9587
|
Go,
|
|
9585
9588
|
{
|
|
9586
|
-
offer:
|
|
9587
|
-
quantity: C[
|
|
9589
|
+
offer: z,
|
|
9590
|
+
quantity: C[z.id] || 0,
|
|
9588
9591
|
onQuantityChange: I,
|
|
9589
9592
|
currency: s,
|
|
9590
9593
|
locale: o,
|
|
@@ -9596,7 +9599,7 @@ const df = {
|
|
|
9596
9599
|
showCard: m,
|
|
9597
9600
|
classNames: y.card
|
|
9598
9601
|
},
|
|
9599
|
-
|
|
9602
|
+
z.id
|
|
9600
9603
|
);
|
|
9601
9604
|
return p ? /* @__PURE__ */ u(
|
|
9602
9605
|
hr.div,
|
|
@@ -9606,17 +9609,17 @@ const df = {
|
|
|
9606
9609
|
variants: df,
|
|
9607
9610
|
initial: "hidden",
|
|
9608
9611
|
animate: "show",
|
|
9609
|
-
children: /* @__PURE__ */ u(pr, { children: S.map((
|
|
9612
|
+
children: /* @__PURE__ */ u(pr, { children: S.map((z) => /* @__PURE__ */ u(
|
|
9610
9613
|
hr.div,
|
|
9611
9614
|
{
|
|
9612
|
-
"data-testid": `offer-card-list-item-${
|
|
9615
|
+
"data-testid": `offer-card-list-item-${z.id}`,
|
|
9613
9616
|
className: y.cardWrapper,
|
|
9614
9617
|
variants: ff,
|
|
9615
9618
|
exit: { opacity: 0, y: -20 },
|
|
9616
9619
|
transition: { duration: 0.3 },
|
|
9617
|
-
children: T(
|
|
9620
|
+
children: T(z)
|
|
9618
9621
|
},
|
|
9619
|
-
|
|
9622
|
+
z.id
|
|
9620
9623
|
)) })
|
|
9621
9624
|
}
|
|
9622
9625
|
) : /* @__PURE__ */ u("div", { "data-testid": "offer-card-list", className: E, children: S.map(T) });
|
|
@@ -9647,7 +9650,7 @@ var Vn = (t) => /^\w*$/.test(t), ie = (t) => t === void 0, ti = (t) => Array.isA
|
|
|
9647
9650
|
return n;
|
|
9648
9651
|
const r = (Vn(e) ? [e] : ni(e)).reduce((i, s) => Te(i) ? i : i[s], t);
|
|
9649
9652
|
return ie(r) || r === t ? ie(t[e]) ? n : t[e] : r;
|
|
9650
|
-
}, Ie = (t) => typeof t == "boolean",
|
|
9653
|
+
}, Ie = (t) => typeof t == "boolean", Ae = (t) => typeof t == "function", te = (t, e, n) => {
|
|
9651
9654
|
let r = -1;
|
|
9652
9655
|
const i = Vn(e) ? [e] : ni(e), s = i.length, o = s - 1;
|
|
9653
9656
|
for (; ++r < s; ) {
|
|
@@ -9666,13 +9669,13 @@ const Tn = {
|
|
|
9666
9669
|
BLUR: "blur",
|
|
9667
9670
|
FOCUS_OUT: "focusout",
|
|
9668
9671
|
CHANGE: "change"
|
|
9669
|
-
},
|
|
9672
|
+
}, _e = {
|
|
9670
9673
|
onBlur: "onBlur",
|
|
9671
9674
|
onChange: "onChange",
|
|
9672
9675
|
onSubmit: "onSubmit",
|
|
9673
9676
|
onTouched: "onTouched",
|
|
9674
9677
|
all: "all"
|
|
9675
|
-
},
|
|
9678
|
+
}, Ze = {
|
|
9676
9679
|
max: "max",
|
|
9677
9680
|
min: "min",
|
|
9678
9681
|
maxLength: "maxLength",
|
|
@@ -9691,7 +9694,7 @@ var el = (t, e, n, r = !0) => {
|
|
|
9691
9694
|
Object.defineProperty(i, s, {
|
|
9692
9695
|
get: () => {
|
|
9693
9696
|
const o = s;
|
|
9694
|
-
return e._proxyFormState[o] !==
|
|
9697
|
+
return e._proxyFormState[o] !== _e.all && (e._proxyFormState[o] = !r || _e.all), n && (n[o] = !0), t[o];
|
|
9695
9698
|
}
|
|
9696
9699
|
});
|
|
9697
9700
|
return i;
|
|
@@ -9723,7 +9726,7 @@ function yf(t) {
|
|
|
9723
9726
|
}, [n]), _.useMemo(() => el(o, n, a.current, !1), [o, n]);
|
|
9724
9727
|
}
|
|
9725
9728
|
var Fe = (t) => typeof t == "string", Dr = (t, e, n, r, i) => Fe(t) ? (r && e.watch.add(t), D(n, t, i)) : Array.isArray(t) ? t.map((s) => (r && e.watch.add(s), D(n, s))) : (r && (e.watchAll = !0), n), Lr = (t) => Te(t) || !Zo(t);
|
|
9726
|
-
function
|
|
9729
|
+
function He(t, e, n = /* @__PURE__ */ new WeakSet()) {
|
|
9727
9730
|
if (Lr(t) || Lr(e))
|
|
9728
9731
|
return Object.is(t, e);
|
|
9729
9732
|
if (yt(t) && yt(e))
|
|
@@ -9740,7 +9743,7 @@ function _e(t, e, n = /* @__PURE__ */ new WeakSet()) {
|
|
|
9740
9743
|
return !1;
|
|
9741
9744
|
if (s !== "ref") {
|
|
9742
9745
|
const l = e[s];
|
|
9743
|
-
if (yt(o) && yt(l) || he(o) && he(l) || Array.isArray(o) && Array.isArray(l) ? !
|
|
9746
|
+
if (yt(o) && yt(l) || he(o) && he(l) || Array.isArray(o) && Array.isArray(l) ? !He(o, l, n) : !Object.is(o, l))
|
|
9744
9747
|
return !1;
|
|
9745
9748
|
}
|
|
9746
9749
|
}
|
|
@@ -9760,12 +9763,12 @@ function bf(t) {
|
|
|
9760
9763
|
const w = Dr(r, n._names, S || n._formValues, !1, a.current);
|
|
9761
9764
|
if (c.current) {
|
|
9762
9765
|
const E = c.current(w);
|
|
9763
|
-
|
|
9766
|
+
He(E, d.current) || (k(E), d.current = E);
|
|
9764
9767
|
} else
|
|
9765
9768
|
k(w);
|
|
9766
9769
|
}
|
|
9767
9770
|
}, [n._formValues, n._names, s, r]);
|
|
9768
|
-
ii(() => ((f.current !== n || !
|
|
9771
|
+
ii(() => ((f.current !== n || !He(m.current, r)) && (f.current = n, m.current = r, b()), n._subscribe({
|
|
9769
9772
|
name: r,
|
|
9770
9773
|
formState: {
|
|
9771
9774
|
values: !0
|
|
@@ -9778,7 +9781,7 @@ function bf(t) {
|
|
|
9778
9781
|
const v = f.current !== n, C = m.current, I = _.useMemo(() => {
|
|
9779
9782
|
if (s)
|
|
9780
9783
|
return null;
|
|
9781
|
-
const S = !v && !
|
|
9784
|
+
const S = !v && !He(C, r);
|
|
9782
9785
|
return v || S ? y() : null;
|
|
9783
9786
|
}, [s, v, r, C, y]);
|
|
9784
9787
|
return I !== null ? I : p;
|
|
@@ -9835,10 +9838,10 @@ function xf(t) {
|
|
|
9835
9838
|
}), [n, i._formValues]), C = _.useCallback((S) => {
|
|
9836
9839
|
const w = D(i._fields, n);
|
|
9837
9840
|
w && w._f && S && (w._f.ref = {
|
|
9838
|
-
focus: () =>
|
|
9839
|
-
select: () =>
|
|
9840
|
-
setCustomValidity: (E) =>
|
|
9841
|
-
reportValidity: () =>
|
|
9841
|
+
focus: () => Ae(S.focus) && S.focus(),
|
|
9842
|
+
select: () => Ae(S.select) && S.select(),
|
|
9843
|
+
setCustomValidity: (E) => Ae(S.setCustomValidity) && S.setCustomValidity(E),
|
|
9844
|
+
reportValidity: () => Ae(S.reportValidity) && S.reportValidity()
|
|
9842
9845
|
});
|
|
9843
9846
|
}, [i._fields, n]), I = _.useMemo(() => ({
|
|
9844
9847
|
name: n,
|
|
@@ -9854,13 +9857,13 @@ function xf(t) {
|
|
|
9854
9857
|
...m.current.rules,
|
|
9855
9858
|
...Ie(m.current.disabled) ? { disabled: m.current.disabled } : {}
|
|
9856
9859
|
});
|
|
9857
|
-
const E = (T,
|
|
9858
|
-
const
|
|
9859
|
-
|
|
9860
|
+
const E = (T, z) => {
|
|
9861
|
+
const V = D(i._fields, T);
|
|
9862
|
+
V && V._f && (V._f.mount = z);
|
|
9860
9863
|
};
|
|
9861
9864
|
if (E(n, !0), S) {
|
|
9862
9865
|
const T = ue(D(i._options.defaultValues, n, m.current.defaultValue));
|
|
9863
|
-
|
|
9866
|
+
te(i._defaultValues, n, T), ie(D(i._formValues, n)) && te(i._formValues, n, T);
|
|
9864
9867
|
}
|
|
9865
9868
|
return !a && i.register(n), p.current = n, () => {
|
|
9866
9869
|
(a ? S && !i._state.action : S) ? i.unregister(n) : E(n, !1);
|
|
@@ -9916,7 +9919,7 @@ function tl(t, e) {
|
|
|
9916
9919
|
}
|
|
9917
9920
|
return n;
|
|
9918
9921
|
}
|
|
9919
|
-
var
|
|
9922
|
+
var Ce = (t) => he(t) && !Object.keys(t).length, si = (t) => t.type === "file", Mn = (t) => {
|
|
9920
9923
|
if (!ei)
|
|
9921
9924
|
return !1;
|
|
9922
9925
|
const e = t ? t.ownerDocument : 0;
|
|
@@ -9937,11 +9940,11 @@ function wf(t) {
|
|
|
9937
9940
|
}
|
|
9938
9941
|
function de(t, e) {
|
|
9939
9942
|
const n = Array.isArray(e) ? e : Vn(e) ? [e] : ni(e), r = n.length === 1 ? t : Cf(t, n), i = n.length - 1, s = n[i];
|
|
9940
|
-
return r && delete r[s], i !== 0 && (he(r) &&
|
|
9943
|
+
return r && delete r[s], i !== 0 && (he(r) && Ce(r) || Array.isArray(r) && wf(r)) && de(t, n.slice(0, -1)), t;
|
|
9941
9944
|
}
|
|
9942
9945
|
var Af = (t) => {
|
|
9943
9946
|
for (const e in t)
|
|
9944
|
-
if (
|
|
9947
|
+
if (Ae(t[e]))
|
|
9945
9948
|
return !0;
|
|
9946
9949
|
return !1;
|
|
9947
9950
|
};
|
|
@@ -9963,7 +9966,7 @@ function Tt(t, e, n) {
|
|
|
9963
9966
|
ie(e) || Lr(n[r]) ? n[r] = Fr(i, Array.isArray(i) ? [] : {}) : Tt(i, Te(e) ? {} : e[r], n[r]);
|
|
9964
9967
|
else {
|
|
9965
9968
|
const s = e[r];
|
|
9966
|
-
n[r] = !
|
|
9969
|
+
n[r] = !He(i, s);
|
|
9967
9970
|
}
|
|
9968
9971
|
}
|
|
9969
9972
|
return n;
|
|
@@ -10001,7 +10004,7 @@ var Nf = (t, e, n, r) => {
|
|
|
10001
10004
|
const i = {};
|
|
10002
10005
|
for (const s of t) {
|
|
10003
10006
|
const o = D(e, s);
|
|
10004
|
-
o &&
|
|
10007
|
+
o && te(i, s, o._f);
|
|
10005
10008
|
}
|
|
10006
10009
|
return {
|
|
10007
10010
|
criteriaMode: n,
|
|
@@ -10010,14 +10013,14 @@ var Nf = (t, e, n, r) => {
|
|
|
10010
10013
|
shouldUseNativeValidation: r
|
|
10011
10014
|
};
|
|
10012
10015
|
}, On = (t) => t instanceof RegExp, Bt = (t) => ie(t) ? t : On(t) ? t.source : he(t) ? On(t.value) ? t.value.source : t.value : t, xs = (t) => ({
|
|
10013
|
-
isOnSubmit: !t || t ===
|
|
10014
|
-
isOnBlur: t ===
|
|
10015
|
-
isOnChange: t ===
|
|
10016
|
-
isOnAll: t ===
|
|
10017
|
-
isOnTouch: t ===
|
|
10016
|
+
isOnSubmit: !t || t === _e.onSubmit,
|
|
10017
|
+
isOnBlur: t === _e.onBlur,
|
|
10018
|
+
isOnChange: t === _e.onChange,
|
|
10019
|
+
isOnAll: t === _e.all,
|
|
10020
|
+
isOnTouch: t === _e.onTouched
|
|
10018
10021
|
});
|
|
10019
10022
|
const vs = "AsyncFunction";
|
|
10020
|
-
var Ef = (t) => !!t && !!t.validate && !!(
|
|
10023
|
+
var Ef = (t) => !!t && !!t.validate && !!(Ae(t.validate) && t.validate.constructor.name === vs || he(t.validate) && Object.values(t.validate).find((e) => e.constructor.name === vs)), Tf = (t) => t.mount && (t.required || t.min || t.max || t.maxLength || t.minLength || t.pattern || t.validate), ks = (t, e, n) => !n && (e.watchAll || e.watch.has(t) || [...e.watch].some((r) => t.startsWith(r) && /^\.\w+/.test(t.slice(r.length))));
|
|
10021
10024
|
const jt = (t, e, n, r) => {
|
|
10022
10025
|
for (const i of n || Object.keys(t)) {
|
|
10023
10026
|
const s = D(t, i);
|
|
@@ -10066,10 +10069,10 @@ function Ss(t, e, n) {
|
|
|
10066
10069
|
var Mf = (t, e, n, r) => {
|
|
10067
10070
|
n(t);
|
|
10068
10071
|
const { name: i, ...s } = t;
|
|
10069
|
-
return
|
|
10072
|
+
return Ce(s) || Object.keys(s).length >= Object.keys(e).length || Object.keys(s).find((o) => e[o] === (!r || _e.all));
|
|
10070
10073
|
}, Of = (t, e, n) => !t || !e || t === e || Kt(t).some((r) => r && (n ? r === e : r.startsWith(e) || e.startsWith(r))), If = (t, e, n, r, i) => i.isOnAll ? !1 : !n && i.isOnTouch ? !(e || t) : (n ? r.isOnBlur : i.isOnBlur) ? !t : (n ? r.isOnChange : i.isOnChange) ? t : !0, Df = (t, e) => !ti(D(t, e)).length && de(t, e), Lf = (t, e, n) => {
|
|
10071
10074
|
const r = Kt(D(t, n));
|
|
10072
|
-
return
|
|
10075
|
+
return te(r, "root", e[n]), te(t, n, r), t;
|
|
10073
10076
|
};
|
|
10074
10077
|
function Cs(t, e, n = "validate") {
|
|
10075
10078
|
if (Fe(t) || Array.isArray(t) && t.every(Fe) || Ie(t) && !t)
|
|
@@ -10088,7 +10091,7 @@ var wt = (t) => he(t) && !On(t) ? t : {
|
|
|
10088
10091
|
return {};
|
|
10089
10092
|
const I = l ? l[0] : o, S = (M) => {
|
|
10090
10093
|
i && I.reportValidity && (I.setCustomValidity(Ie(M) ? "" : M || ""), I.reportValidity());
|
|
10091
|
-
}, w = {}, E = oi(o), T = on(o),
|
|
10094
|
+
}, w = {}, E = oi(o), T = on(o), z = E || T, V = (b || si(o)) && ie(o.value) && ie(C) || Mn(o) && o.value === "" || C === "" || Array.isArray(C) && !C.length, H = kf.bind(null, y, r, w), R = (M, P, $, U = Ze.maxLength, ne = Ze.minLength) => {
|
|
10092
10095
|
const W = M ? P : $;
|
|
10093
10096
|
w[y] = {
|
|
10094
10097
|
type: M ? U : ne,
|
|
@@ -10097,56 +10100,56 @@ var wt = (t) => he(t) && !On(t) ? t : {
|
|
|
10097
10100
|
...H(M ? U : ne, W)
|
|
10098
10101
|
};
|
|
10099
10102
|
};
|
|
10100
|
-
if (s ? !Array.isArray(C) || !C.length : a && (!
|
|
10103
|
+
if (s ? !Array.isArray(C) || !C.length : a && (!z && (V || Te(C)) || Ie(C) && !C || T && !il(l).isValid || E && !ol(l).isValid)) {
|
|
10101
10104
|
const { value: M, message: P } = Fe(a) ? { value: !!a, message: a } : wt(a);
|
|
10102
10105
|
if (M && (w[y] = {
|
|
10103
|
-
type:
|
|
10106
|
+
type: Ze.required,
|
|
10104
10107
|
message: P,
|
|
10105
10108
|
ref: I,
|
|
10106
|
-
...H(
|
|
10109
|
+
...H(Ze.required, P)
|
|
10107
10110
|
}, !r))
|
|
10108
10111
|
return S(P), w;
|
|
10109
10112
|
}
|
|
10110
|
-
if (!
|
|
10113
|
+
if (!V && (!Te(f) || !Te(m))) {
|
|
10111
10114
|
let M, P;
|
|
10112
10115
|
const $ = wt(m), U = wt(f);
|
|
10113
10116
|
if (!Te(C) && !isNaN(C)) {
|
|
10114
10117
|
const ne = o.valueAsNumber || C && +C;
|
|
10115
10118
|
Te($.value) || (M = ne > $.value), Te(U.value) || (P = ne < U.value);
|
|
10116
10119
|
} else {
|
|
10117
|
-
const ne = o.valueAsDate || new Date(C), W = (
|
|
10118
|
-
Fe($.value) && C && (M =
|
|
10120
|
+
const ne = o.valueAsDate || new Date(C), W = (ye) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + ye), ge = o.type == "time", ae = o.type == "week";
|
|
10121
|
+
Fe($.value) && C && (M = ge ? W(C) > W($.value) : ae ? C > $.value : ne > new Date($.value)), Fe(U.value) && C && (P = ge ? W(C) < W(U.value) : ae ? C < U.value : ne < new Date(U.value));
|
|
10119
10122
|
}
|
|
10120
|
-
if ((M || P) && (R(!!M, $.message, U.message,
|
|
10123
|
+
if ((M || P) && (R(!!M, $.message, U.message, Ze.max, Ze.min), !r))
|
|
10121
10124
|
return S(w[y].message), w;
|
|
10122
10125
|
}
|
|
10123
|
-
if ((c || d) && !
|
|
10126
|
+
if ((c || d) && !V && (Fe(C) || s && Array.isArray(C))) {
|
|
10124
10127
|
const M = wt(c), P = wt(d), $ = !Te(M.value) && C.length > +M.value, U = !Te(P.value) && C.length < +P.value;
|
|
10125
10128
|
if (($ || U) && (R($, M.message, P.message), !r))
|
|
10126
10129
|
return S(w[y].message), w;
|
|
10127
10130
|
}
|
|
10128
|
-
if (p && !
|
|
10131
|
+
if (p && !V && Fe(C)) {
|
|
10129
10132
|
const { value: M, message: P } = wt(p);
|
|
10130
10133
|
if (On(M) && !C.match(M) && (w[y] = {
|
|
10131
|
-
type:
|
|
10134
|
+
type: Ze.pattern,
|
|
10132
10135
|
message: P,
|
|
10133
10136
|
ref: o,
|
|
10134
|
-
...H(
|
|
10137
|
+
...H(Ze.pattern, P)
|
|
10135
10138
|
}, !r))
|
|
10136
10139
|
return S(P), w;
|
|
10137
10140
|
}
|
|
10138
10141
|
if (k) {
|
|
10139
|
-
if (
|
|
10142
|
+
if (Ae(k)) {
|
|
10140
10143
|
const M = await k(C, n), P = Cs(M, I);
|
|
10141
10144
|
if (P && (w[y] = {
|
|
10142
10145
|
...P,
|
|
10143
|
-
...H(
|
|
10146
|
+
...H(Ze.validate, P.message)
|
|
10144
10147
|
}, !r))
|
|
10145
10148
|
return S(P.message), w;
|
|
10146
10149
|
} else if (he(k)) {
|
|
10147
10150
|
let M = {};
|
|
10148
10151
|
for (const P in k) {
|
|
10149
|
-
if (!
|
|
10152
|
+
if (!Ce(M) && !r)
|
|
10150
10153
|
break;
|
|
10151
10154
|
const $ = Cs(await k[P](C, n), I, P);
|
|
10152
10155
|
$ && (M = {
|
|
@@ -10154,7 +10157,7 @@ var wt = (t) => he(t) && !On(t) ? t : {
|
|
|
10154
10157
|
...H(P, $.message)
|
|
10155
10158
|
}, S($.message), r && (w[y] = M));
|
|
10156
10159
|
}
|
|
10157
|
-
if (!
|
|
10160
|
+
if (!Ce(M) && (w[y] = {
|
|
10158
10161
|
ref: I,
|
|
10159
10162
|
...M
|
|
10160
10163
|
}, !r))
|
|
@@ -10164,8 +10167,8 @@ var wt = (t) => he(t) && !On(t) ? t : {
|
|
|
10164
10167
|
return S(!0), w;
|
|
10165
10168
|
};
|
|
10166
10169
|
const Ff = {
|
|
10167
|
-
mode:
|
|
10168
|
-
reValidateMode:
|
|
10170
|
+
mode: _e.onSubmit,
|
|
10171
|
+
reValidateMode: _e.onChange,
|
|
10169
10172
|
shouldFocusError: !0
|
|
10170
10173
|
};
|
|
10171
10174
|
function Pf(t = {}) {
|
|
@@ -10176,7 +10179,7 @@ function Pf(t = {}) {
|
|
|
10176
10179
|
submitCount: 0,
|
|
10177
10180
|
isDirty: !1,
|
|
10178
10181
|
isReady: !1,
|
|
10179
|
-
isLoading:
|
|
10182
|
+
isLoading: Ae(e.defaultValues),
|
|
10180
10183
|
isValidating: !1,
|
|
10181
10184
|
isSubmitted: !1,
|
|
10182
10185
|
isSubmitting: !1,
|
|
@@ -10216,35 +10219,35 @@ function Pf(t = {}) {
|
|
|
10216
10219
|
const p = {
|
|
10217
10220
|
array: ps(),
|
|
10218
10221
|
state: ps()
|
|
10219
|
-
}, k = e.criteriaMode ===
|
|
10222
|
+
}, k = e.criteriaMode === _e.all, y = (h) => (g) => {
|
|
10220
10223
|
clearTimeout(c), c = setTimeout(h, g);
|
|
10221
10224
|
}, b = async (h) => {
|
|
10222
10225
|
if (!o.keepIsValid && !e.disabled && (f.isValid || m.isValid || h)) {
|
|
10223
10226
|
let g;
|
|
10224
|
-
e.resolver ? (g =
|
|
10227
|
+
e.resolver ? (g = Ce((await z()).errors), v()) : g = await H(r, !0), g !== n.isValid && p.state.next({
|
|
10225
10228
|
isValid: g
|
|
10226
10229
|
});
|
|
10227
10230
|
}
|
|
10228
10231
|
}, v = (h, g) => {
|
|
10229
10232
|
!e.disabled && (f.isValidating || f.validatingFields || m.isValidating || m.validatingFields) && ((h || Array.from(l.mount)).forEach((x) => {
|
|
10230
|
-
x && (g ?
|
|
10233
|
+
x && (g ? te(n.validatingFields, x, g) : de(n.validatingFields, x));
|
|
10231
10234
|
}), p.state.next({
|
|
10232
10235
|
validatingFields: n.validatingFields,
|
|
10233
|
-
isValidating: !
|
|
10236
|
+
isValidating: !Ce(n.validatingFields)
|
|
10234
10237
|
}));
|
|
10235
10238
|
}, C = (h, g = [], x, F, O = !0, N = !0) => {
|
|
10236
10239
|
if (F && x && !e.disabled) {
|
|
10237
10240
|
if (o.action = !0, N && Array.isArray(D(r, h))) {
|
|
10238
10241
|
const B = x(D(r, h), F.argA, F.argB);
|
|
10239
|
-
O &&
|
|
10242
|
+
O && te(r, h, B);
|
|
10240
10243
|
}
|
|
10241
10244
|
if (N && Array.isArray(D(n.errors, h))) {
|
|
10242
10245
|
const B = x(D(n.errors, h), F.argA, F.argB);
|
|
10243
|
-
O &&
|
|
10246
|
+
O && te(n.errors, h, B), Df(n.errors, h);
|
|
10244
10247
|
}
|
|
10245
10248
|
if ((f.touchedFields || m.touchedFields) && N && Array.isArray(D(n.touchedFields, h))) {
|
|
10246
10249
|
const B = x(D(n.touchedFields, h), F.argA, F.argB);
|
|
10247
|
-
O &&
|
|
10250
|
+
O && te(n.touchedFields, h, B);
|
|
10248
10251
|
}
|
|
10249
10252
|
(f.dirtyFields || m.dirtyFields) && (n.dirtyFields = Tt(i, s)), p.state.next({
|
|
10250
10253
|
name: h,
|
|
@@ -10254,9 +10257,9 @@ function Pf(t = {}) {
|
|
|
10254
10257
|
isValid: n.isValid
|
|
10255
10258
|
});
|
|
10256
10259
|
} else
|
|
10257
|
-
|
|
10260
|
+
te(s, h, g);
|
|
10258
10261
|
}, I = (h, g) => {
|
|
10259
|
-
|
|
10262
|
+
te(n.errors, h, g), p.state.next({
|
|
10260
10263
|
errors: n.errors
|
|
10261
10264
|
});
|
|
10262
10265
|
}, S = (h) => {
|
|
@@ -10268,7 +10271,7 @@ function Pf(t = {}) {
|
|
|
10268
10271
|
const O = D(r, h);
|
|
10269
10272
|
if (O) {
|
|
10270
10273
|
const N = D(s, h, ie(x) ? D(i, h) : x);
|
|
10271
|
-
ie(N) || F && F.defaultChecked || g ?
|
|
10274
|
+
ie(N) || F && F.defaultChecked || g ? te(s, h, g ? N : bs(O._f)) : U(h, N), o.mount && !o.action && b();
|
|
10272
10275
|
}
|
|
10273
10276
|
}, E = (h, g, x, F, O) => {
|
|
10274
10277
|
let N = !1, B = !1;
|
|
@@ -10278,19 +10281,19 @@ function Pf(t = {}) {
|
|
|
10278
10281
|
if (!e.disabled) {
|
|
10279
10282
|
if (!x || F) {
|
|
10280
10283
|
(f.isDirty || m.isDirty) && (B = n.isDirty, n.isDirty = G.isDirty = M(), N = B !== G.isDirty);
|
|
10281
|
-
const Z =
|
|
10282
|
-
B = !!D(n.dirtyFields, h), Z ? de(n.dirtyFields, h) :
|
|
10284
|
+
const Z = He(D(i, h), g);
|
|
10285
|
+
B = !!D(n.dirtyFields, h), Z ? de(n.dirtyFields, h) : te(n.dirtyFields, h, !0), G.dirtyFields = n.dirtyFields, N = N || (f.dirtyFields || m.dirtyFields) && B !== !Z;
|
|
10283
10286
|
}
|
|
10284
10287
|
if (x) {
|
|
10285
10288
|
const Z = D(n.touchedFields, h);
|
|
10286
|
-
Z || (
|
|
10289
|
+
Z || (te(n.touchedFields, h, x), G.touchedFields = n.touchedFields, N = N || (f.touchedFields || m.touchedFields) && Z !== x);
|
|
10287
10290
|
}
|
|
10288
10291
|
N && O && p.state.next(G);
|
|
10289
10292
|
}
|
|
10290
10293
|
return N ? G : {};
|
|
10291
10294
|
}, T = (h, g, x, F) => {
|
|
10292
10295
|
const O = D(n.errors, h), N = (f.isValid || m.isValid) && Ie(g) && n.isValid !== g;
|
|
10293
|
-
if (e.delayError && x ? (a = y(() => I(h, x)), a(e.delayError)) : (clearTimeout(c), a = null, x ?
|
|
10296
|
+
if (e.delayError && x ? (a = y(() => I(h, x)), a(e.delayError)) : (clearTimeout(c), a = null, x ? te(n.errors, h, x) : de(n.errors, h)), (x ? !He(O, x) : O) || !Ce(F) || N) {
|
|
10294
10297
|
const B = {
|
|
10295
10298
|
...F,
|
|
10296
10299
|
...N && Ie(g) ? { isValid: g } : {},
|
|
@@ -10302,12 +10305,12 @@ function Pf(t = {}) {
|
|
|
10302
10305
|
...B
|
|
10303
10306
|
}, p.state.next(B);
|
|
10304
10307
|
}
|
|
10305
|
-
},
|
|
10306
|
-
const { errors: g } = await
|
|
10308
|
+
}, z = async (h) => (v(h, !0), await e.resolver(s, e.context, Nf(h || l.mount, r, e.criteriaMode, e.shouldUseNativeValidation))), V = async (h) => {
|
|
10309
|
+
const { errors: g } = await z(h);
|
|
10307
10310
|
if (v(h), h)
|
|
10308
10311
|
for (const x of h) {
|
|
10309
10312
|
const F = D(g, x);
|
|
10310
|
-
F ?
|
|
10313
|
+
F ? te(n.errors, x, F) : de(n.errors, x);
|
|
10311
10314
|
}
|
|
10312
10315
|
else
|
|
10313
10316
|
n.errors = g;
|
|
@@ -10322,12 +10325,12 @@ function Pf(t = {}) {
|
|
|
10322
10325
|
if (N) {
|
|
10323
10326
|
const G = l.array.has(N.name), Z = O._f && Ef(O._f);
|
|
10324
10327
|
Z && f.validatingFields && v([N.name], !0);
|
|
10325
|
-
const
|
|
10326
|
-
if (Z && f.validatingFields && v([N.name]),
|
|
10328
|
+
const Se = await ws(O, l.disabled, s, k, e.shouldUseNativeValidation && !g, G);
|
|
10329
|
+
if (Z && f.validatingFields && v([N.name]), Se[N.name] && (x.valid = !1, g || t.shouldUseNativeValidation))
|
|
10327
10330
|
break;
|
|
10328
|
-
!g && (D(
|
|
10331
|
+
!g && (D(Se, N.name) ? G ? Lf(n.errors, Se, N.name) : te(n.errors, N.name, Se[N.name]) : de(n.errors, N.name));
|
|
10329
10332
|
}
|
|
10330
|
-
!
|
|
10333
|
+
!Ce(B) && await H(B, g, x);
|
|
10331
10334
|
}
|
|
10332
10335
|
}
|
|
10333
10336
|
return x.valid;
|
|
@@ -10337,21 +10340,21 @@ function Pf(t = {}) {
|
|
|
10337
10340
|
g && (g._f.refs ? g._f.refs.every((x) => !ar(x)) : !ar(g._f.ref)) && Bn(h);
|
|
10338
10341
|
}
|
|
10339
10342
|
l.unMount = /* @__PURE__ */ new Set();
|
|
10340
|
-
}, M = (h, g) => !e.disabled && (h && g &&
|
|
10343
|
+
}, M = (h, g) => !e.disabled && (h && g && te(s, h, g), !He(ze(), i)), P = (h, g, x) => Dr(h, l, {
|
|
10341
10344
|
...o.mount ? s : ie(g) ? i : Fe(h) ? { [h]: g } : g
|
|
10342
10345
|
}, x, g), $ = (h) => ti(D(o.mount ? s : i, h, e.shouldUnregister ? D(i, h, []) : [])), U = (h, g, x = {}) => {
|
|
10343
10346
|
const F = D(r, h);
|
|
10344
10347
|
let O = g;
|
|
10345
10348
|
if (F) {
|
|
10346
10349
|
const N = F._f;
|
|
10347
|
-
N && (!N.disabled &&
|
|
10350
|
+
N && (!N.disabled && te(s, h, sl(g, N)), O = Mn(N.ref) && Te(g) ? "" : g, nl(N.ref) ? [...N.ref.options].forEach((B) => B.selected = O.includes(B.value)) : N.refs ? on(N.ref) ? N.refs.forEach((B) => {
|
|
10348
10351
|
(!B.defaultChecked || !B.disabled) && (Array.isArray(O) ? B.checked = !!O.find((G) => G === B.value) : B.checked = O === B.value || !!O);
|
|
10349
10352
|
}) : N.refs.forEach((B) => B.checked = B.value === O) : si(N.ref) ? N.ref.value = "" : (N.ref.value = O, N.ref.type || p.state.next({
|
|
10350
10353
|
name: h,
|
|
10351
10354
|
values: ue(s)
|
|
10352
10355
|
})));
|
|
10353
10356
|
}
|
|
10354
|
-
(x.shouldDirty || x.shouldTouch) && E(h, O, x.shouldTouch, x.shouldDirty, !0), x.shouldValidate &&
|
|
10357
|
+
(x.shouldDirty || x.shouldTouch) && E(h, O, x.shouldTouch, x.shouldDirty, !0), x.shouldValidate && ye(h);
|
|
10355
10358
|
}, ne = (h, g, x) => {
|
|
10356
10359
|
for (const F in g) {
|
|
10357
10360
|
if (!g.hasOwnProperty(F))
|
|
@@ -10361,7 +10364,7 @@ function Pf(t = {}) {
|
|
|
10361
10364
|
}
|
|
10362
10365
|
}, W = (h, g, x = {}) => {
|
|
10363
10366
|
const F = D(r, h), O = l.array.has(h), N = ue(g);
|
|
10364
|
-
|
|
10367
|
+
te(s, h, N), O ? (p.array.next({
|
|
10365
10368
|
name: h,
|
|
10366
10369
|
values: ue(s)
|
|
10367
10370
|
}), (f.isDirty || f.dirtyFields || m.isDirty || m.dirtyFields) && x.shouldDirty && p.state.next({
|
|
@@ -10376,43 +10379,43 @@ function Pf(t = {}) {
|
|
|
10376
10379
|
name: o.mount ? h : void 0,
|
|
10377
10380
|
values: ue(s)
|
|
10378
10381
|
});
|
|
10379
|
-
},
|
|
10382
|
+
}, ge = async (h) => {
|
|
10380
10383
|
o.mount = !0;
|
|
10381
10384
|
const g = h.target;
|
|
10382
10385
|
let x = g.name, F = !0;
|
|
10383
10386
|
const O = D(r, x), N = (Z) => {
|
|
10384
|
-
F = Number.isNaN(Z) || yt(Z) && isNaN(Z.getTime()) ||
|
|
10387
|
+
F = Number.isNaN(Z) || yt(Z) && isNaN(Z.getTime()) || He(Z, D(s, x, Z));
|
|
10385
10388
|
}, B = xs(e.mode), G = xs(e.reValidateMode);
|
|
10386
10389
|
if (O) {
|
|
10387
|
-
let Z,
|
|
10388
|
-
const ut = g.type ? bs(O._f) : Qo(h),
|
|
10389
|
-
|
|
10390
|
-
const qn = E(x, ut,
|
|
10391
|
-
if (!
|
|
10390
|
+
let Z, Se;
|
|
10391
|
+
const ut = g.type ? bs(O._f) : Qo(h), tt = h.type === Tn.BLUR || h.type === Tn.FOCUS_OUT, fl = !Tf(O._f) && !e.resolver && !D(n.errors, x) && !O._f.deps || If(tt, D(n.touchedFields, x), n.isSubmitted, G, B), Un = ks(x, l, tt);
|
|
10392
|
+
te(s, x, ut), tt ? (!g || !g.readOnly) && (O._f.onBlur && O._f.onBlur(h), a && a(0)) : O._f.onChange && O._f.onChange(h);
|
|
10393
|
+
const qn = E(x, ut, tt), hl = !Ce(qn) || Un;
|
|
10394
|
+
if (!tt && p.state.next({
|
|
10392
10395
|
name: x,
|
|
10393
10396
|
type: h.type,
|
|
10394
10397
|
values: ue(s)
|
|
10395
10398
|
}), fl)
|
|
10396
|
-
return (f.isValid || m.isValid) && (e.mode === "onBlur" ?
|
|
10397
|
-
if (!
|
|
10398
|
-
const { errors: fi } = await
|
|
10399
|
+
return (f.isValid || m.isValid) && (e.mode === "onBlur" ? tt && b() : tt || b()), hl && p.state.next({ name: x, ...Un ? {} : qn });
|
|
10400
|
+
if (!tt && Un && p.state.next({ ...n }), e.resolver) {
|
|
10401
|
+
const { errors: fi } = await z([x]);
|
|
10399
10402
|
if (v([x]), N(ut), F) {
|
|
10400
10403
|
const pl = Ss(n.errors, r, x), hi = Ss(fi, r, pl.name || x);
|
|
10401
|
-
Z = hi.error, x = hi.name,
|
|
10404
|
+
Z = hi.error, x = hi.name, Se = Ce(fi);
|
|
10402
10405
|
}
|
|
10403
10406
|
} else
|
|
10404
|
-
v([x], !0), Z = (await ws(O, l.disabled, s, k, e.shouldUseNativeValidation))[x], v([x]), N(ut), F && (Z ?
|
|
10405
|
-
F && (O._f.deps && (!Array.isArray(O._f.deps) || O._f.deps.length > 0) &&
|
|
10407
|
+
v([x], !0), Z = (await ws(O, l.disabled, s, k, e.shouldUseNativeValidation))[x], v([x]), N(ut), F && (Z ? Se = !1 : (f.isValid || m.isValid) && (Se = await H(r, !0)));
|
|
10408
|
+
F && (O._f.deps && (!Array.isArray(O._f.deps) || O._f.deps.length > 0) && ye(O._f.deps), T(x, Se, Z, qn));
|
|
10406
10409
|
}
|
|
10407
10410
|
}, ae = (h, g) => {
|
|
10408
10411
|
if (D(n.errors, g) && h.focus)
|
|
10409
10412
|
return h.focus(), 1;
|
|
10410
|
-
},
|
|
10413
|
+
}, ye = async (h, g = {}) => {
|
|
10411
10414
|
let x, F;
|
|
10412
10415
|
const O = Kt(h);
|
|
10413
10416
|
if (e.resolver) {
|
|
10414
|
-
const N = await
|
|
10415
|
-
x =
|
|
10417
|
+
const N = await V(ie(h) ? h : O);
|
|
10418
|
+
x = Ce(N), F = h ? !O.some((B) => D(N, B)) : x;
|
|
10416
10419
|
} else h ? (F = (await Promise.all(O.map(async (N) => {
|
|
10417
10420
|
const B = D(r, N);
|
|
10418
10421
|
return await H(B && B._f ? { [N]: B } : B);
|
|
@@ -10422,24 +10425,24 @@ function Pf(t = {}) {
|
|
|
10422
10425
|
...e.resolver || !h ? { isValid: x } : {},
|
|
10423
10426
|
errors: n.errors
|
|
10424
10427
|
}), g.shouldFocus && !F && jt(r, ae, h ? O : l.mount), F;
|
|
10425
|
-
},
|
|
10428
|
+
}, ze = (h, g) => {
|
|
10426
10429
|
let x = {
|
|
10427
10430
|
...o.mount ? s : i
|
|
10428
10431
|
};
|
|
10429
10432
|
return g && (x = tl(g.dirtyFields ? n.dirtyFields : n.touchedFields, x)), ie(h) ? x : Fe(h) ? D(x, h) : h.map((F) => D(x, F));
|
|
10430
|
-
},
|
|
10433
|
+
}, X = (h, g) => ({
|
|
10431
10434
|
invalid: !!D((g || n).errors, h),
|
|
10432
10435
|
isDirty: !!D((g || n).dirtyFields, h),
|
|
10433
10436
|
error: D((g || n).errors, h),
|
|
10434
10437
|
isValidating: !!D(n.validatingFields, h),
|
|
10435
10438
|
isTouched: !!D((g || n).touchedFields, h)
|
|
10436
|
-
}),
|
|
10439
|
+
}), Ee = (h) => {
|
|
10437
10440
|
h && Kt(h).forEach((g) => de(n.errors, g)), p.state.next({
|
|
10438
10441
|
errors: h ? n.errors : {}
|
|
10439
10442
|
});
|
|
10440
|
-
},
|
|
10443
|
+
}, ee = (h, g, x) => {
|
|
10441
10444
|
const F = (D(r, h, { _f: {} })._f || {}).ref, O = D(n.errors, h) || {}, { ref: N, message: B, type: G, ...Z } = O;
|
|
10442
|
-
|
|
10445
|
+
te(n.errors, h, {
|
|
10443
10446
|
...Z,
|
|
10444
10447
|
...g,
|
|
10445
10448
|
ref: F
|
|
@@ -10448,7 +10451,7 @@ function Pf(t = {}) {
|
|
|
10448
10451
|
errors: n.errors,
|
|
10449
10452
|
isValid: !1
|
|
10450
10453
|
}), x && x.shouldFocus && F && F.focus && F.focus();
|
|
10451
|
-
}, Oe = (h, g) =>
|
|
10454
|
+
}, Oe = (h, g) => Ae(h) ? p.state.subscribe({
|
|
10452
10455
|
next: (x) => "values" in x && h(P(void 0, g), x)
|
|
10453
10456
|
}) : P(h, g, !0), Rt = (h) => p.state.subscribe({
|
|
10454
10457
|
next: (g) => {
|
|
@@ -10485,7 +10488,7 @@ function Pf(t = {}) {
|
|
|
10485
10488
|
}, _n = (h, g = {}) => {
|
|
10486
10489
|
let x = D(r, h);
|
|
10487
10490
|
const F = Ie(g.disabled) || Ie(e.disabled);
|
|
10488
|
-
return
|
|
10491
|
+
return te(r, h, {
|
|
10489
10492
|
...x || {},
|
|
10490
10493
|
_f: {
|
|
10491
10494
|
...x && x._f ? x._f : { ref: { name: h } },
|
|
@@ -10507,15 +10510,15 @@ function Pf(t = {}) {
|
|
|
10507
10510
|
pattern: Bt(g.pattern)
|
|
10508
10511
|
} : {},
|
|
10509
10512
|
name: h,
|
|
10510
|
-
onChange:
|
|
10511
|
-
onBlur:
|
|
10513
|
+
onChange: ge,
|
|
10514
|
+
onBlur: ge,
|
|
10512
10515
|
ref: (O) => {
|
|
10513
10516
|
if (O) {
|
|
10514
10517
|
_n(h, g), x = D(r, h);
|
|
10515
10518
|
const N = ie(O.value) && O.querySelectorAll && O.querySelectorAll("input,select,textarea")[0] || O, B = Sf(N), G = x._f.refs || [];
|
|
10516
10519
|
if (B ? G.find((Z) => Z === N) : N === x._f.ref)
|
|
10517
10520
|
return;
|
|
10518
|
-
|
|
10521
|
+
te(r, h, {
|
|
10519
10522
|
_f: {
|
|
10520
10523
|
...x._f,
|
|
10521
10524
|
...B ? {
|
|
@@ -10546,14 +10549,14 @@ function Pf(t = {}) {
|
|
|
10546
10549
|
if (p.state.next({
|
|
10547
10550
|
isSubmitting: !0
|
|
10548
10551
|
}), e.resolver) {
|
|
10549
|
-
const { errors: N, values: B } = await
|
|
10552
|
+
const { errors: N, values: B } = await z();
|
|
10550
10553
|
v(), n.errors = N, O = ue(B);
|
|
10551
10554
|
} else
|
|
10552
10555
|
await H(r);
|
|
10553
10556
|
if (l.disabled.size)
|
|
10554
10557
|
for (const N of l.disabled)
|
|
10555
10558
|
de(O, N);
|
|
10556
|
-
if (de(n.errors, "root"),
|
|
10559
|
+
if (de(n.errors, "root"), Ce(n.errors)) {
|
|
10557
10560
|
p.state.next({
|
|
10558
10561
|
errors: {}
|
|
10559
10562
|
});
|
|
@@ -10567,15 +10570,15 @@ function Pf(t = {}) {
|
|
|
10567
10570
|
if (p.state.next({
|
|
10568
10571
|
isSubmitted: !0,
|
|
10569
10572
|
isSubmitting: !1,
|
|
10570
|
-
isSubmitSuccessful:
|
|
10573
|
+
isSubmitSuccessful: Ce(n.errors) && !F,
|
|
10571
10574
|
submitCount: n.submitCount + 1,
|
|
10572
10575
|
errors: n.errors
|
|
10573
10576
|
}), F)
|
|
10574
10577
|
throw F;
|
|
10575
10578
|
}, cl = (h, g = {}) => {
|
|
10576
|
-
D(r, h) && (ie(g.defaultValue) ? W(h, ue(D(i, h))) : (W(h, g.defaultValue),
|
|
10579
|
+
D(r, h) && (ie(g.defaultValue) ? W(h, ue(D(i, h))) : (W(h, g.defaultValue), te(i, h, ue(g.defaultValue))), g.keepTouched || de(n.touchedFields, h), g.keepDirty || (de(n.dirtyFields, h), n.isDirty = g.defaultValue ? M(h, ue(D(i, h))) : M()), g.keepError || (de(n.errors, h), f.isValid && b()), p.state.next({ ...n }));
|
|
10577
10580
|
}, ci = (h, g = {}) => {
|
|
10578
|
-
const x = h ? ue(h) : i, F = ue(x), O =
|
|
10581
|
+
const x = h ? ue(h) : i, F = ue(x), O = Ce(h), N = O ? i : F;
|
|
10579
10582
|
if (g.keepDefaultValues || (i = x), !g.keepValues) {
|
|
10580
10583
|
if (g.keepDirtyValues) {
|
|
10581
10584
|
const B = /* @__PURE__ */ new Set([
|
|
@@ -10583,8 +10586,8 @@ function Pf(t = {}) {
|
|
|
10583
10586
|
...Object.keys(Tt(i, s))
|
|
10584
10587
|
]);
|
|
10585
10588
|
for (const G of Array.from(B)) {
|
|
10586
|
-
const Z = D(n.dirtyFields, G),
|
|
10587
|
-
Z && !ie(
|
|
10589
|
+
const Z = D(n.dirtyFields, G), Se = D(s, G), ut = D(N, G);
|
|
10590
|
+
Z && !ie(Se) ? te(N, G, Se) : !Z && !ie(ut) && W(G, ut);
|
|
10588
10591
|
}
|
|
10589
10592
|
} else {
|
|
10590
10593
|
if (ei && ie(h))
|
|
@@ -10593,9 +10596,9 @@ function Pf(t = {}) {
|
|
|
10593
10596
|
if (G && G._f) {
|
|
10594
10597
|
const Z = Array.isArray(G._f.refs) ? G._f.refs[0] : G._f.ref;
|
|
10595
10598
|
if (Mn(Z)) {
|
|
10596
|
-
const
|
|
10597
|
-
if (
|
|
10598
|
-
|
|
10599
|
+
const Se = Z.closest("form");
|
|
10600
|
+
if (Se) {
|
|
10601
|
+
Se.reset();
|
|
10599
10602
|
break;
|
|
10600
10603
|
}
|
|
10601
10604
|
}
|
|
@@ -10621,9 +10624,9 @@ function Pf(t = {}) {
|
|
|
10621
10624
|
watch: /* @__PURE__ */ new Set(),
|
|
10622
10625
|
watchAll: !1,
|
|
10623
10626
|
focus: ""
|
|
10624
|
-
}, o.mount = !f.isValid || !!g.keepIsValid || !!g.keepDirtyValues || !e.shouldUnregister && !
|
|
10627
|
+
}, o.mount = !f.isValid || !!g.keepIsValid || !!g.keepDirtyValues || !e.shouldUnregister && !Ce(N), o.watch = !!e.shouldUnregister, o.keepIsValid = !!g.keepIsValid, o.action = !1, g.keepErrors || (n.errors = {}), p.state.next({
|
|
10625
10628
|
submitCount: g.keepSubmitCount ? n.submitCount : 0,
|
|
10626
|
-
isDirty: O ? !1 : g.keepDirty ? n.isDirty : !!(g.keepDefaultValues && !
|
|
10629
|
+
isDirty: O ? !1 : g.keepDirty ? n.isDirty : !!(g.keepDefaultValues && !He(h, i)),
|
|
10627
10630
|
isSubmitted: g.keepIsSubmitted ? n.isSubmitted : !1,
|
|
10628
10631
|
dirtyFields: O ? {} : g.keepDirtyValues ? g.keepDefaultValues && s ? Tt(i, s) : n.dirtyFields : g.keepDefaultValues && h ? Tt(i, h) : g.keepDirty ? n.dirtyFields : {},
|
|
10629
10632
|
touchedFields: g.keepTouched ? n.touchedFields : {},
|
|
@@ -10632,12 +10635,12 @@ function Pf(t = {}) {
|
|
|
10632
10635
|
isSubmitting: !1,
|
|
10633
10636
|
defaultValues: i
|
|
10634
10637
|
});
|
|
10635
|
-
}, ui = (h, g) => ci(
|
|
10638
|
+
}, ui = (h, g) => ci(Ae(h) ? h(s) : h, { ...e.resetOptions, ...g }), ul = (h, g = {}) => {
|
|
10636
10639
|
const x = D(r, h), F = x && x._f;
|
|
10637
10640
|
if (F) {
|
|
10638
10641
|
const O = F.refs ? F.refs[0] : F.ref;
|
|
10639
10642
|
O.focus && setTimeout(() => {
|
|
10640
|
-
O.focus(), g.shouldSelect &&
|
|
10643
|
+
O.focus(), g.shouldSelect && Ae(O.select) && O.select();
|
|
10641
10644
|
});
|
|
10642
10645
|
}
|
|
10643
10646
|
}, dl = (h) => {
|
|
@@ -10649,11 +10652,11 @@ function Pf(t = {}) {
|
|
|
10649
10652
|
control: {
|
|
10650
10653
|
register: _n,
|
|
10651
10654
|
unregister: Bn,
|
|
10652
|
-
getFieldState:
|
|
10655
|
+
getFieldState: X,
|
|
10653
10656
|
handleSubmit: ai,
|
|
10654
|
-
setError:
|
|
10657
|
+
setError: ee,
|
|
10655
10658
|
_subscribe: Rt,
|
|
10656
|
-
_runSchema:
|
|
10659
|
+
_runSchema: z,
|
|
10657
10660
|
_updateIsValidating: v,
|
|
10658
10661
|
_focusError: Hn,
|
|
10659
10662
|
_getWatch: P,
|
|
@@ -10664,7 +10667,7 @@ function Pf(t = {}) {
|
|
|
10664
10667
|
_setErrors: S,
|
|
10665
10668
|
_getFieldArray: $,
|
|
10666
10669
|
_reset: ci,
|
|
10667
|
-
_resetDefaultValues: () =>
|
|
10670
|
+
_resetDefaultValues: () => Ae(e.defaultValues) && e.defaultValues().then((h) => {
|
|
10668
10671
|
ui(h, e.resetOptions), p.state.next({
|
|
10669
10672
|
isLoading: !1
|
|
10670
10673
|
});
|
|
@@ -10708,19 +10711,19 @@ function Pf(t = {}) {
|
|
|
10708
10711
|
}
|
|
10709
10712
|
},
|
|
10710
10713
|
subscribe: zn,
|
|
10711
|
-
trigger:
|
|
10714
|
+
trigger: ye,
|
|
10712
10715
|
register: _n,
|
|
10713
10716
|
handleSubmit: ai,
|
|
10714
10717
|
watch: Oe,
|
|
10715
10718
|
setValue: W,
|
|
10716
|
-
getValues:
|
|
10719
|
+
getValues: ze,
|
|
10717
10720
|
reset: ui,
|
|
10718
10721
|
resetField: cl,
|
|
10719
|
-
clearErrors:
|
|
10722
|
+
clearErrors: Ee,
|
|
10720
10723
|
unregister: Bn,
|
|
10721
|
-
setError:
|
|
10724
|
+
setError: ee,
|
|
10722
10725
|
setFocus: ul,
|
|
10723
|
-
getFieldState:
|
|
10726
|
+
getFieldState: X
|
|
10724
10727
|
};
|
|
10725
10728
|
return {
|
|
10726
10729
|
...di,
|
|
@@ -10731,7 +10734,7 @@ function Rf(t = {}) {
|
|
|
10731
10734
|
const e = _.useRef(void 0), n = _.useRef(void 0), [r, i] = _.useState({
|
|
10732
10735
|
isDirty: !1,
|
|
10733
10736
|
isValidating: !1,
|
|
10734
|
-
isLoading:
|
|
10737
|
+
isLoading: Ae(t.defaultValues),
|
|
10735
10738
|
isSubmitted: !1,
|
|
10736
10739
|
isSubmitting: !1,
|
|
10737
10740
|
isSubmitSuccessful: !1,
|
|
@@ -10743,14 +10746,14 @@ function Rf(t = {}) {
|
|
|
10743
10746
|
errors: t.errors || {},
|
|
10744
10747
|
disabled: t.disabled || !1,
|
|
10745
10748
|
isReady: !1,
|
|
10746
|
-
defaultValues:
|
|
10749
|
+
defaultValues: Ae(t.defaultValues) ? void 0 : t.defaultValues
|
|
10747
10750
|
});
|
|
10748
10751
|
if (!e.current)
|
|
10749
10752
|
if (t.formControl)
|
|
10750
10753
|
e.current = {
|
|
10751
10754
|
...t.formControl,
|
|
10752
10755
|
formState: r
|
|
10753
|
-
}, t.defaultValues && !
|
|
10756
|
+
}, t.defaultValues && !Ae(t.defaultValues) && t.formControl.reset(t.defaultValues, t.resetOptions);
|
|
10754
10757
|
else {
|
|
10755
10758
|
const { formControl: o, ...l } = Pf(t);
|
|
10756
10759
|
e.current = {
|
|
@@ -10786,7 +10789,7 @@ function Rf(t = {}) {
|
|
|
10786
10789
|
}
|
|
10787
10790
|
}, [s, r.isDirty]), _.useEffect(() => {
|
|
10788
10791
|
var o;
|
|
10789
|
-
t.values && !
|
|
10792
|
+
t.values && !He(t.values, n.current) ? (s._reset(t.values, {
|
|
10790
10793
|
keepFieldsRef: !0,
|
|
10791
10794
|
...s._options.resetOptions
|
|
10792
10795
|
}), !((o = s._options.resetOptions) === null || o === void 0) && o.keepIsValid || s._setValid(), n.current = t.values, i((l) => ({ ...l }))) : s._resetDefaultValues();
|
|
@@ -10885,43 +10888,43 @@ const $f = {
|
|
|
10885
10888
|
control: S ? b : w.control,
|
|
10886
10889
|
name: S ? v : "_internal",
|
|
10887
10890
|
rules: S ? C : void 0
|
|
10888
|
-
}), [T,
|
|
10891
|
+
}), [T, z] = J(
|
|
10889
10892
|
e || cr()
|
|
10890
|
-
),
|
|
10891
|
-
(
|
|
10892
|
-
const Oe = { ...
|
|
10893
|
-
S && E.field.onChange(Oe), !S && t === void 0 &&
|
|
10893
|
+
), V = S ? E.field.value ?? cr() : t ?? T, H = S && !!E.fieldState?.error, R = S && (E.fieldState?.isTouched ?? !1), M = H || R, P = M && (!V.amount || V.amount <= 0), $ = M && !V.glAccount, [U, ne] = J(V.glAccount?.name || ""), W = ce(
|
|
10894
|
+
(ee) => {
|
|
10895
|
+
const Oe = { ...V, ...ee };
|
|
10896
|
+
S && E.field.onChange(Oe), !S && t === void 0 && z(Oe), s?.(Oe);
|
|
10894
10897
|
},
|
|
10895
|
-
[
|
|
10896
|
-
),
|
|
10897
|
-
(
|
|
10898
|
-
const Oe =
|
|
10898
|
+
[V, t, s, S, E]
|
|
10899
|
+
), ge = ce(
|
|
10900
|
+
(ee) => {
|
|
10901
|
+
const Oe = ee || 0;
|
|
10899
10902
|
W({ amount: Oe }), o?.(Oe);
|
|
10900
10903
|
},
|
|
10901
10904
|
[W, o]
|
|
10902
10905
|
), ae = ce(
|
|
10903
|
-
(
|
|
10904
|
-
ne(
|
|
10906
|
+
(ee) => {
|
|
10907
|
+
ne(ee), i?.(ee);
|
|
10905
10908
|
},
|
|
10906
10909
|
[i]
|
|
10907
|
-
),
|
|
10908
|
-
(
|
|
10909
|
-
if (
|
|
10910
|
+
), ye = ce(
|
|
10911
|
+
(ee) => {
|
|
10912
|
+
if (ee === null) {
|
|
10910
10913
|
W({ glAccount: null }), l?.(null);
|
|
10911
10914
|
return;
|
|
10912
10915
|
}
|
|
10913
|
-
const Rt = n.find((zn) => String(zn.id) === String(
|
|
10916
|
+
const Rt = n.find((zn) => String(zn.id) === String(ee)) || null;
|
|
10914
10917
|
W({ glAccount: Rt }), l?.(Rt);
|
|
10915
10918
|
},
|
|
10916
10919
|
[n, W, l]
|
|
10917
|
-
),
|
|
10920
|
+
), ze = ce(() => {
|
|
10918
10921
|
ne(""), W({ glAccount: null }), l?.(null);
|
|
10919
|
-
}, [W, l]),
|
|
10920
|
-
(
|
|
10921
|
-
W({ isTaxDeductible:
|
|
10922
|
+
}, [W, l]), X = ce(
|
|
10923
|
+
(ee) => {
|
|
10924
|
+
W({ isTaxDeductible: ee }), a?.(ee);
|
|
10922
10925
|
},
|
|
10923
10926
|
[W, a]
|
|
10924
|
-
),
|
|
10927
|
+
), Ee = ce(() => {
|
|
10925
10928
|
c?.();
|
|
10926
10929
|
}, [c]);
|
|
10927
10930
|
return /* @__PURE__ */ u(
|
|
@@ -10947,8 +10950,8 @@ const $f = {
|
|
|
10947
10950
|
}
|
|
10948
10951
|
) })
|
|
10949
10952
|
] }),
|
|
10950
|
-
value:
|
|
10951
|
-
onValueChange:
|
|
10953
|
+
value: V.amount || void 0,
|
|
10954
|
+
onValueChange: ge,
|
|
10952
10955
|
labelPlacement: "outside",
|
|
10953
10956
|
placeholder: I.amountPlaceholder,
|
|
10954
10957
|
isWheelDisabled: !0,
|
|
@@ -10984,8 +10987,8 @@ const $f = {
|
|
|
10984
10987
|
variant: "bordered",
|
|
10985
10988
|
items: n,
|
|
10986
10989
|
menuTrigger: "input",
|
|
10987
|
-
inputValue:
|
|
10988
|
-
selectedKey:
|
|
10990
|
+
inputValue: V.glAccount?.name ?? U,
|
|
10991
|
+
selectedKey: V.glAccount?.id ?? null,
|
|
10989
10992
|
isDisabled: m,
|
|
10990
10993
|
isInvalid: $,
|
|
10991
10994
|
errorMessage: $ ? "GL Account is required" : void 0,
|
|
@@ -10994,13 +10997,13 @@ const $f = {
|
|
|
10994
10997
|
},
|
|
10995
10998
|
placeholder: I.glAccountPlaceholder,
|
|
10996
10999
|
onInputChange: ae,
|
|
10997
|
-
onSelectionChange:
|
|
10998
|
-
onClear:
|
|
11000
|
+
onSelectionChange: ye,
|
|
11001
|
+
onClear: ze,
|
|
10999
11002
|
className: k.glAccountInput,
|
|
11000
|
-
children: (
|
|
11001
|
-
/* @__PURE__ */ u("span", { children:
|
|
11002
|
-
|
|
11003
|
-
] }) },
|
|
11003
|
+
children: (ee) => /* @__PURE__ */ u(Sl, { textValue: ee.name, children: /* @__PURE__ */ A("div", { className: "flex flex-col", children: [
|
|
11004
|
+
/* @__PURE__ */ u("span", { children: ee.name }),
|
|
11005
|
+
ee.code && /* @__PURE__ */ u("span", { className: "text-xs text-default-400", children: ee.code })
|
|
11006
|
+
] }) }, ee.id)
|
|
11004
11007
|
}
|
|
11005
11008
|
) }),
|
|
11006
11009
|
/* @__PURE__ */ u("div", { className: L("shrink-0 pt-6 flex items-center", k.taxDeductibleContainer), children: /* @__PURE__ */ u(
|
|
@@ -11008,8 +11011,8 @@ const $f = {
|
|
|
11008
11011
|
{
|
|
11009
11012
|
radius: "full",
|
|
11010
11013
|
"data-testid": `${y || "revenue-distribution-card"}-tax-deductible`,
|
|
11011
|
-
isSelected:
|
|
11012
|
-
onValueChange:
|
|
11014
|
+
isSelected: V.isTaxDeductible,
|
|
11015
|
+
onValueChange: X,
|
|
11013
11016
|
isDisabled: m || !f,
|
|
11014
11017
|
className: k.taxDeductibleCheckbox,
|
|
11015
11018
|
children: I.taxDeductible
|
|
@@ -11023,7 +11026,7 @@ const $f = {
|
|
|
11023
11026
|
color: "danger",
|
|
11024
11027
|
variant: "flat",
|
|
11025
11028
|
isDisabled: m || !d,
|
|
11026
|
-
onPress:
|
|
11029
|
+
onPress: Ee,
|
|
11027
11030
|
startContent: /* @__PURE__ */ u(Le, { icon: "solar:trash-bin-trash-linear", width: 16 }),
|
|
11028
11031
|
className: L("text-danger", k.deleteButton),
|
|
11029
11032
|
children: I.deleteButton
|
|
@@ -11043,7 +11046,7 @@ const zf = ({
|
|
|
11043
11046
|
renderEmpty: s
|
|
11044
11047
|
}) => {
|
|
11045
11048
|
if (s)
|
|
11046
|
-
return /* @__PURE__ */ u(
|
|
11049
|
+
return /* @__PURE__ */ u(Qe, { children: s() });
|
|
11047
11050
|
const o = /* @__PURE__ */ A("div", { className: L("flex flex-col items-center justify-center py-8", i.content), children: [
|
|
11048
11051
|
/* @__PURE__ */ u(Le, { icon: e, width: n, className: L("text-default-300 mb-4", i.icon) }),
|
|
11049
11052
|
/* @__PURE__ */ u("p", { className: L("text-default-500 text-sm text-center", i.message), children: t })
|
|
@@ -11318,7 +11321,7 @@ const Uf = {
|
|
|
11318
11321
|
disabled: r = !1
|
|
11319
11322
|
}) => {
|
|
11320
11323
|
const [i, s] = J(e);
|
|
11321
|
-
return
|
|
11324
|
+
return We(() => {
|
|
11322
11325
|
s(e);
|
|
11323
11326
|
}, [e]), /* @__PURE__ */ A(
|
|
11324
11327
|
"button",
|
|
@@ -11500,31 +11503,31 @@ const Uf = {
|
|
|
11500
11503
|
className: s = "",
|
|
11501
11504
|
onSelectionChange: o
|
|
11502
11505
|
}) => {
|
|
11503
|
-
const l =
|
|
11506
|
+
const l = ot(() => i ?? [], [i]), a = { ...jf, ...n }, [c, d] = J(!0), f = ce(() => {
|
|
11504
11507
|
const S = {};
|
|
11505
11508
|
let w = t;
|
|
11506
11509
|
for (const E of l) {
|
|
11507
11510
|
S[E.id] = {};
|
|
11508
11511
|
for (const T of E.tickets) {
|
|
11509
|
-
const
|
|
11512
|
+
const z = w > 0 ? Math.min(T.max, w) : 0;
|
|
11510
11513
|
S[E.id][T.id] = {
|
|
11511
11514
|
id: T.id,
|
|
11512
|
-
selectedQuantity:
|
|
11515
|
+
selectedQuantity: z,
|
|
11513
11516
|
originalPrice: T.originalPrice,
|
|
11514
11517
|
discountedPrice: T.price
|
|
11515
|
-
}, w -=
|
|
11518
|
+
}, w -= z;
|
|
11516
11519
|
}
|
|
11517
11520
|
}
|
|
11518
11521
|
return S;
|
|
11519
11522
|
}, [l, t]), [m, p] = J(() => f()), k = Dt(!1), y = (S = m) => {
|
|
11520
11523
|
const w = Object.values(S).reduce(
|
|
11521
|
-
(E, T) => E + Object.values(T).reduce((
|
|
11524
|
+
(E, T) => E + Object.values(T).reduce((z, V) => z + V.selectedQuantity, 0),
|
|
11522
11525
|
0
|
|
11523
11526
|
);
|
|
11524
11527
|
for (const E of l)
|
|
11525
11528
|
for (const T of E.tickets) {
|
|
11526
|
-
const
|
|
11527
|
-
if (
|
|
11529
|
+
const z = S[E.id]?.[T.id]?.selectedQuantity ?? 0, V = Math.min(T.max, t - (w - z));
|
|
11530
|
+
if (z < V && V > 0) return !1;
|
|
11528
11531
|
}
|
|
11529
11532
|
return !0;
|
|
11530
11533
|
}, b = (S, w) => m[S]?.[w]?.selectedQuantity ?? 0, v = () => Object.values(m).reduce(
|
|
@@ -11532,22 +11535,22 @@ const Uf = {
|
|
|
11532
11535
|
0
|
|
11533
11536
|
), C = (S, w, E) => {
|
|
11534
11537
|
if (Object.values(m).reduce((M, P) => M + Object.entries(P).reduce(($, [U, ne]) => P === m[S] && U === w ? $ : $ + ne.selectedQuantity, 0), 0) + E > t) return;
|
|
11535
|
-
const
|
|
11536
|
-
if (!
|
|
11537
|
-
const
|
|
11538
|
+
const z = l.find((M) => M.id === S)?.tickets.find((M) => M.id === w);
|
|
11539
|
+
if (!z) return;
|
|
11540
|
+
const V = {
|
|
11538
11541
|
...m,
|
|
11539
11542
|
[S]: {
|
|
11540
11543
|
...m[S],
|
|
11541
11544
|
[w]: {
|
|
11542
11545
|
id: w,
|
|
11543
11546
|
selectedQuantity: E,
|
|
11544
|
-
originalPrice:
|
|
11545
|
-
discountedPrice:
|
|
11547
|
+
originalPrice: z.originalPrice,
|
|
11548
|
+
discountedPrice: z.price
|
|
11546
11549
|
}
|
|
11547
11550
|
}
|
|
11548
11551
|
};
|
|
11549
|
-
p(
|
|
11550
|
-
const H = y(
|
|
11552
|
+
p(V), o?.(V);
|
|
11553
|
+
const H = y(V), R = Object.values(V).reduce(
|
|
11551
11554
|
(M, P) => M + Object.values(P).reduce(($, U) => $ + U.selectedQuantity, 0),
|
|
11552
11555
|
0
|
|
11553
11556
|
);
|
|
@@ -11571,7 +11574,7 @@ const Uf = {
|
|
|
11571
11574
|
p(w), o?.(w);
|
|
11572
11575
|
}
|
|
11573
11576
|
};
|
|
11574
|
-
return
|
|
11577
|
+
return We(() => {
|
|
11575
11578
|
!k.current && c && (o?.(m), k.current = !0);
|
|
11576
11579
|
}, [c, m, o]), /* @__PURE__ */ A(
|
|
11577
11580
|
"div",
|