reactjs-tiptap-editor 1.0.22 → 1.0.24
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/lib/{ActionMenuButton-BBDqKvKg.cjs → ActionMenuButton-B8NhVw5m.cjs} +1 -1
- package/lib/{ActionMenuButton-B1067mIC.js → ActionMenuButton-HYlhmRvw.js} +1 -1
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.js +4 -4
- package/lib/Blockquote.cjs +1 -1
- package/lib/Blockquote.js +2 -2
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +2 -2
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +2 -2
- package/lib/{Callout-lBlBlK_w.cjs → Callout-B-S2f0Qo.cjs} +1 -1
- package/lib/{Callout-V2mO6s2Y.js → Callout-CF7Y9yJ7.js} +4 -4
- package/lib/Callout.cjs +1 -1
- package/lib/Callout.js +4 -4
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +2 -2
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +6 -6
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.js +27 -27
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +2 -2
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +3 -3
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +7 -7
- package/lib/{Drawer-Cyv27orn.js → Drawer-CaXVhxo4.js} +21 -21
- package/lib/{Drawer-BeYo9jAG.cjs → Drawer-Was4hxYH.cjs} +1 -1
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +4 -4
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +4312 -1860
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +3 -3
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.js +2 -2
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +2 -2
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +5 -5
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +9 -9
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +5 -5
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +69 -46
- package/lib/History.cjs +1 -1
- package/lib/History.js +556 -418
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +2 -2
- package/lib/{Iframe-Bx-VDxSB.cjs → Iframe-BI0sq6pd.cjs} +1 -1
- package/lib/{Iframe-D9JVKzO0.js → Iframe-Bp986fj0.js} +3 -3
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +3 -3
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +3 -3
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +47 -47
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +3 -3
- package/lib/{Indent-B5tQ5Wfg.js → Indent-E6B8DkyN.js} +4 -4
- package/lib/{Indent-CCLO0KpG.cjs → Indent-FvM52kjA.cjs} +1 -1
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +2 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +2 -2
- package/lib/{Katex-rtfVV2pl.cjs → Katex-DP6EjdKz.cjs} +1 -1
- package/lib/{Katex-w_c6vAMd.js → Katex-pzwyyiFJ.js} +5 -5
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +3 -3
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +4 -4
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +2 -2
- package/lib/LinkEditBlock-Cmkmp2fW.cjs +5 -0
- package/lib/{LinkEditBlock-CTlU8YnO.js → LinkEditBlock-OjN4F2rM.js} +222 -224
- package/lib/MarkdownPaste.cjs +1 -1
- package/lib/MarkdownPaste.js +1 -1
- package/lib/Mention.cjs +1 -1
- package/lib/Mention.js +8 -8
- package/lib/Mermaid.cjs +1 -1
- package/lib/Mermaid.js +34 -34
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +3 -3
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +2 -2
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +4 -4
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +7 -7
- package/lib/{SlashCommandNodeView-CVKjpS6r.cjs → SlashCommandNodeView-DarAytvt.cjs} +1 -1
- package/lib/{SlashCommandNodeView-DNkpJuM3.js → SlashCommandNodeView-o323V8li.js} +2 -2
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +2 -2
- package/lib/Table-CC9uNHPL.js +1984 -0
- package/lib/Table-Clnz-i4l.cjs +9 -0
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +2 -2
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +3 -3
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +3 -3
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +2 -2
- package/lib/{Twitter-BJjt8vv_.cjs → Twitter-0kmrijjL.cjs} +1 -1
- package/lib/{Twitter-CKm0M53B.js → Twitter-BVnXL8we.js} +5 -5
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +3 -3
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +3 -3
- package/lib/bubble.cjs +6 -6
- package/lib/bubble.js +1573 -1561
- package/lib/{clsx-Bg-2aTKh.js → clsx-0OU6n9va.js} +379 -353
- package/lib/clsx-D6gYQn3o.cjs +33 -0
- package/lib/{dropdown-menu-Dre693DD.cjs → dropdown-menu-BIGvxqiu.cjs} +1 -1
- package/lib/{dropdown-menu-AhMKS9PQ.js → dropdown-menu-BW2M6saA.js} +1 -1
- package/lib/index-BAb_UADw.cjs +1 -0
- package/lib/index-BF3EVCB1.cjs +2 -0
- package/lib/{index-D0EmqTpe.js → index-BblvcbTH.js} +1130 -1064
- package/lib/index-Bcj8cyOO.cjs +24 -0
- package/lib/{index-BfHAqkoX.js → index-BrsJsbds.js} +3 -3
- package/lib/index-CGjT-a9h.js +1377 -0
- package/lib/index-CPTpXLfX.cjs +11 -0
- package/lib/{index-C3dgmjIF.cjs → index-CUvjYuRp.cjs} +1 -1
- package/lib/{index-C4aGVY2E.cjs → index-CWw4s87s.cjs} +1 -1
- package/lib/{index-DXtVL0al.js → index-Cal5SPfB.js} +189 -134
- package/lib/{index-CjLxMm5d.js → index-D-Ouz0vF.js} +1 -1
- package/lib/{index-83hp1lZH.cjs → index-deubsx3z.cjs} +1 -1
- package/lib/{index-DtVRewGA.js → index-oj858lQO.js} +229 -31
- package/lib/{index-CbkpBnTX.js → index-zw-Kd38i.js} +47 -50
- package/lib/index.cjs +1 -1
- package/lib/index.js +2 -2
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.js +7 -6
- package/lib/locales/index.d.ts +199 -1
- package/lib/locales/ja.d.ts +198 -0
- package/lib/{popover-B1ptDngu.js → popover-BIVHT1W9.js} +1 -1
- package/lib/{popover-D7w_FVSV.cjs → popover-DoSfJsFS.cjs} +1 -1
- package/lib/{renderNodeView-CbxCTni3.js → renderNodeView-CfWJK4rG.js} +2 -2
- package/lib/{renderNodeView-DFVrJy0l.cjs → renderNodeView-D--fDFov.cjs} +1 -1
- package/lib/{separator-C_7KkuoG.cjs → separator-SRbPfmGa.cjs} +1 -1
- package/lib/{separator-CDoF4Z4Z.js → separator-b-qOPJmp.js} +3 -3
- package/lib/{textarea-CNzZnjjW.js → textarea-CpxXPky_.js} +1 -1
- package/lib/{textarea-CEtXap1b.cjs → textarea-DbGw9oCU.cjs} +1 -1
- package/lib/updatePosition-BwzAsiY0.js +16 -0
- package/lib/{updatePosition-CQE1ct18.cjs → updatePosition-DGPtRfWN.cjs} +1 -1
- package/package.json +60 -60
- package/lib/LinkEditBlock-_41zgSyl.cjs +0 -5
- package/lib/Table-BFiU40iW.cjs +0 -9
- package/lib/Table-yZtD5Qo1.js +0 -1945
- package/lib/clsx-DSAWW32g.cjs +0 -33
- package/lib/index-C4WLt4NA.cjs +0 -24
- package/lib/index-DlxZt4_j.cjs +0 -1
- package/lib/index-P5_MyY0i.js +0 -1362
- package/lib/index-TcJ2UKnv.cjs +0 -1
- package/lib/index-fbGGohBT.cjs +0 -12
- package/lib/updatePosition-BGD41Hbg.js +0 -16
|
@@ -0,0 +1,1377 @@
|
|
|
1
|
+
import { PluginKey as Zt, Plugin as te } from "@tiptap/pm/state";
|
|
2
|
+
import { DecorationSet as ee, Decoration as ne } from "@tiptap/pm/view";
|
|
3
|
+
import { J as oe } from "./index-BblvcbTH.js";
|
|
4
|
+
const Ft = ["top", "right", "bottom", "left"], Et = ["start", "end"], Dt = /* @__PURE__ */ Ft.reduce((t, e) => t.concat(e, e + "-" + Et[0], e + "-" + Et[1]), []), Y = Math.min, _ = Math.max, lt = Math.round, j = (t) => ({
|
|
5
|
+
x: t,
|
|
6
|
+
y: t
|
|
7
|
+
}), ie = {
|
|
8
|
+
left: "right",
|
|
9
|
+
right: "left",
|
|
10
|
+
bottom: "top",
|
|
11
|
+
top: "bottom"
|
|
12
|
+
};
|
|
13
|
+
function yt(t, e, o) {
|
|
14
|
+
return _(t, Y(e, o));
|
|
15
|
+
}
|
|
16
|
+
function z(t, e) {
|
|
17
|
+
return typeof t == "function" ? t(e) : t;
|
|
18
|
+
}
|
|
19
|
+
function F(t) {
|
|
20
|
+
return t.split("-")[0];
|
|
21
|
+
}
|
|
22
|
+
function q(t) {
|
|
23
|
+
return t.split("-")[1];
|
|
24
|
+
}
|
|
25
|
+
function It(t) {
|
|
26
|
+
return t === "x" ? "y" : "x";
|
|
27
|
+
}
|
|
28
|
+
function bt(t) {
|
|
29
|
+
return t === "y" ? "height" : "width";
|
|
30
|
+
}
|
|
31
|
+
function X(t) {
|
|
32
|
+
const e = t[0];
|
|
33
|
+
return e === "t" || e === "b" ? "y" : "x";
|
|
34
|
+
}
|
|
35
|
+
function Rt(t) {
|
|
36
|
+
return It(X(t));
|
|
37
|
+
}
|
|
38
|
+
function qt(t, e, o) {
|
|
39
|
+
o === void 0 && (o = !1);
|
|
40
|
+
const n = q(t), i = Rt(t), s = bt(i);
|
|
41
|
+
let r = i === "x" ? n === (o ? "end" : "start") ? "right" : "left" : n === "start" ? "bottom" : "top";
|
|
42
|
+
return e.reference[s] > e.floating[s] && (r = ft(r)), [r, ft(r)];
|
|
43
|
+
}
|
|
44
|
+
function se(t) {
|
|
45
|
+
const e = ft(t);
|
|
46
|
+
return [at(t), e, at(e)];
|
|
47
|
+
}
|
|
48
|
+
function at(t) {
|
|
49
|
+
return t.includes("start") ? t.replace("start", "end") : t.replace("end", "start");
|
|
50
|
+
}
|
|
51
|
+
const Tt = ["left", "right"], Lt = ["right", "left"], re = ["top", "bottom"], ce = ["bottom", "top"];
|
|
52
|
+
function le(t, e, o) {
|
|
53
|
+
switch (t) {
|
|
54
|
+
case "top":
|
|
55
|
+
case "bottom":
|
|
56
|
+
return o ? e ? Lt : Tt : e ? Tt : Lt;
|
|
57
|
+
case "left":
|
|
58
|
+
case "right":
|
|
59
|
+
return e ? re : ce;
|
|
60
|
+
default:
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function ae(t, e, o, n) {
|
|
65
|
+
const i = q(t);
|
|
66
|
+
let s = le(F(t), o === "start", n);
|
|
67
|
+
return i && (s = s.map((r) => r + "-" + i), e && (s = s.concat(s.map(at)))), s;
|
|
68
|
+
}
|
|
69
|
+
function ft(t) {
|
|
70
|
+
const e = F(t);
|
|
71
|
+
return ie[e] + t.slice(e.length);
|
|
72
|
+
}
|
|
73
|
+
function fe(t) {
|
|
74
|
+
return {
|
|
75
|
+
top: 0,
|
|
76
|
+
right: 0,
|
|
77
|
+
bottom: 0,
|
|
78
|
+
left: 0,
|
|
79
|
+
...t
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function St(t) {
|
|
83
|
+
return typeof t != "number" ? fe(t) : {
|
|
84
|
+
top: t,
|
|
85
|
+
right: t,
|
|
86
|
+
bottom: t,
|
|
87
|
+
left: t
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function tt(t) {
|
|
91
|
+
const {
|
|
92
|
+
x: e,
|
|
93
|
+
y: o,
|
|
94
|
+
width: n,
|
|
95
|
+
height: i
|
|
96
|
+
} = t;
|
|
97
|
+
return {
|
|
98
|
+
width: n,
|
|
99
|
+
height: i,
|
|
100
|
+
top: o,
|
|
101
|
+
left: e,
|
|
102
|
+
right: e + n,
|
|
103
|
+
bottom: o + i,
|
|
104
|
+
x: e,
|
|
105
|
+
y: o
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function $t(t, e, o) {
|
|
109
|
+
let {
|
|
110
|
+
reference: n,
|
|
111
|
+
floating: i
|
|
112
|
+
} = t;
|
|
113
|
+
const s = X(e), r = Rt(e), c = bt(r), f = F(e), m = s === "y", u = n.x + n.width / 2 - i.width / 2, l = n.y + n.height / 2 - i.height / 2, h = n[c] / 2 - i[c] / 2;
|
|
114
|
+
let d;
|
|
115
|
+
switch (f) {
|
|
116
|
+
case "top":
|
|
117
|
+
d = {
|
|
118
|
+
x: u,
|
|
119
|
+
y: n.y - i.height
|
|
120
|
+
};
|
|
121
|
+
break;
|
|
122
|
+
case "bottom":
|
|
123
|
+
d = {
|
|
124
|
+
x: u,
|
|
125
|
+
y: n.y + n.height
|
|
126
|
+
};
|
|
127
|
+
break;
|
|
128
|
+
case "right":
|
|
129
|
+
d = {
|
|
130
|
+
x: n.x + n.width,
|
|
131
|
+
y: l
|
|
132
|
+
};
|
|
133
|
+
break;
|
|
134
|
+
case "left":
|
|
135
|
+
d = {
|
|
136
|
+
x: n.x - i.width,
|
|
137
|
+
y: l
|
|
138
|
+
};
|
|
139
|
+
break;
|
|
140
|
+
default:
|
|
141
|
+
d = {
|
|
142
|
+
x: n.x,
|
|
143
|
+
y: n.y
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
switch (q(e)) {
|
|
147
|
+
case "start":
|
|
148
|
+
d[r] -= h * (o && m ? -1 : 1);
|
|
149
|
+
break;
|
|
150
|
+
case "end":
|
|
151
|
+
d[r] += h * (o && m ? -1 : 1);
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
return d;
|
|
155
|
+
}
|
|
156
|
+
async function ue(t, e) {
|
|
157
|
+
var o;
|
|
158
|
+
e === void 0 && (e = {});
|
|
159
|
+
const {
|
|
160
|
+
x: n,
|
|
161
|
+
y: i,
|
|
162
|
+
platform: s,
|
|
163
|
+
rects: r,
|
|
164
|
+
elements: c,
|
|
165
|
+
strategy: f
|
|
166
|
+
} = t, {
|
|
167
|
+
boundary: m = "clippingAncestors",
|
|
168
|
+
rootBoundary: u = "viewport",
|
|
169
|
+
elementContext: l = "floating",
|
|
170
|
+
altBoundary: h = !1,
|
|
171
|
+
padding: d = 0
|
|
172
|
+
} = z(e, t), p = St(d), w = c[h ? l === "floating" ? "reference" : "floating" : l], S = tt(await s.getClippingRect({
|
|
173
|
+
element: (o = await (s.isElement == null ? void 0 : s.isElement(w))) == null || o ? w : w.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(c.floating)),
|
|
174
|
+
boundary: m,
|
|
175
|
+
rootBoundary: u,
|
|
176
|
+
strategy: f
|
|
177
|
+
})), R = l === "floating" ? {
|
|
178
|
+
x: n,
|
|
179
|
+
y: i,
|
|
180
|
+
width: r.floating.width,
|
|
181
|
+
height: r.floating.height
|
|
182
|
+
} : r.reference, g = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(c.floating)), A = await (s.isElement == null ? void 0 : s.isElement(g)) ? await (s.getScale == null ? void 0 : s.getScale(g)) || {
|
|
183
|
+
x: 1,
|
|
184
|
+
y: 1
|
|
185
|
+
} : {
|
|
186
|
+
x: 1,
|
|
187
|
+
y: 1
|
|
188
|
+
}, T = tt(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
189
|
+
elements: c,
|
|
190
|
+
rect: R,
|
|
191
|
+
offsetParent: g,
|
|
192
|
+
strategy: f
|
|
193
|
+
}) : R);
|
|
194
|
+
return {
|
|
195
|
+
top: (S.top - T.top + p.top) / A.y,
|
|
196
|
+
bottom: (T.bottom - S.bottom + p.bottom) / A.y,
|
|
197
|
+
left: (S.left - T.left + p.left) / A.x,
|
|
198
|
+
right: (T.right - S.right + p.right) / A.x
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
const de = 50, me = async (t, e, o) => {
|
|
202
|
+
const {
|
|
203
|
+
placement: n = "bottom",
|
|
204
|
+
strategy: i = "absolute",
|
|
205
|
+
middleware: s = [],
|
|
206
|
+
platform: r
|
|
207
|
+
} = o, c = r.detectOverflow ? r : {
|
|
208
|
+
...r,
|
|
209
|
+
detectOverflow: ue
|
|
210
|
+
}, f = await (r.isRTL == null ? void 0 : r.isRTL(e));
|
|
211
|
+
let m = await r.getElementRects({
|
|
212
|
+
reference: t,
|
|
213
|
+
floating: e,
|
|
214
|
+
strategy: i
|
|
215
|
+
}), {
|
|
216
|
+
x: u,
|
|
217
|
+
y: l
|
|
218
|
+
} = $t(m, n, f), h = n, d = 0;
|
|
219
|
+
const p = {};
|
|
220
|
+
for (let v = 0; v < s.length; v++) {
|
|
221
|
+
const w = s[v];
|
|
222
|
+
if (!w)
|
|
223
|
+
continue;
|
|
224
|
+
const {
|
|
225
|
+
name: S,
|
|
226
|
+
fn: R
|
|
227
|
+
} = w, {
|
|
228
|
+
x: g,
|
|
229
|
+
y: A,
|
|
230
|
+
data: T,
|
|
231
|
+
reset: E
|
|
232
|
+
} = await R({
|
|
233
|
+
x: u,
|
|
234
|
+
y: l,
|
|
235
|
+
initialPlacement: n,
|
|
236
|
+
placement: h,
|
|
237
|
+
strategy: i,
|
|
238
|
+
middlewareData: p,
|
|
239
|
+
rects: m,
|
|
240
|
+
platform: c,
|
|
241
|
+
elements: {
|
|
242
|
+
reference: t,
|
|
243
|
+
floating: e
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
u = g ?? u, l = A ?? l, p[S] = {
|
|
247
|
+
...p[S],
|
|
248
|
+
...T
|
|
249
|
+
}, E && d < de && (d++, typeof E == "object" && (E.placement && (h = E.placement), E.rects && (m = E.rects === !0 ? await r.getElementRects({
|
|
250
|
+
reference: t,
|
|
251
|
+
floating: e,
|
|
252
|
+
strategy: i
|
|
253
|
+
}) : E.rects), {
|
|
254
|
+
x: u,
|
|
255
|
+
y: l
|
|
256
|
+
} = $t(m, h, f)), v = -1);
|
|
257
|
+
}
|
|
258
|
+
return {
|
|
259
|
+
x: u,
|
|
260
|
+
y: l,
|
|
261
|
+
placement: h,
|
|
262
|
+
strategy: i,
|
|
263
|
+
middlewareData: p
|
|
264
|
+
};
|
|
265
|
+
}, ge = (t) => ({
|
|
266
|
+
name: "arrow",
|
|
267
|
+
options: t,
|
|
268
|
+
async fn(e) {
|
|
269
|
+
const {
|
|
270
|
+
x: o,
|
|
271
|
+
y: n,
|
|
272
|
+
placement: i,
|
|
273
|
+
rects: s,
|
|
274
|
+
platform: r,
|
|
275
|
+
elements: c,
|
|
276
|
+
middlewareData: f
|
|
277
|
+
} = e, {
|
|
278
|
+
element: m,
|
|
279
|
+
padding: u = 0
|
|
280
|
+
} = z(t, e) || {};
|
|
281
|
+
if (m == null)
|
|
282
|
+
return {};
|
|
283
|
+
const l = St(u), h = {
|
|
284
|
+
x: o,
|
|
285
|
+
y: n
|
|
286
|
+
}, d = Rt(i), p = bt(d), v = await r.getDimensions(m), w = d === "y", S = w ? "top" : "left", R = w ? "bottom" : "right", g = w ? "clientHeight" : "clientWidth", A = s.reference[p] + s.reference[d] - h[d] - s.floating[p], T = h[d] - s.reference[d], E = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(m));
|
|
287
|
+
let M = E ? E[g] : 0;
|
|
288
|
+
(!M || !await (r.isElement == null ? void 0 : r.isElement(E))) && (M = c.floating[g] || s.floating[p]);
|
|
289
|
+
const B = A / 2 - T / 2, $ = M / 2 - v[p] / 2 - 1, a = Y(l[S], $), x = Y(l[R], $), O = a, C = M - v[p] - x, b = M / 2 - v[p] / 2 + B, P = yt(O, b, C), D = !f.arrow && q(i) != null && b !== P && s.reference[p] / 2 - (b < O ? a : x) - v[p] / 2 < 0, L = D ? b < O ? b - O : b - C : 0;
|
|
290
|
+
return {
|
|
291
|
+
[d]: h[d] + L,
|
|
292
|
+
data: {
|
|
293
|
+
[d]: P,
|
|
294
|
+
centerOffset: b - P - L,
|
|
295
|
+
...D && {
|
|
296
|
+
alignmentOffset: L
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
reset: D
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
function he(t, e, o) {
|
|
304
|
+
return (t ? [...o.filter((i) => q(i) === t), ...o.filter((i) => q(i) !== t)] : o.filter((i) => F(i) === i)).filter((i) => t ? q(i) === t || (e ? at(i) !== i : !1) : !0);
|
|
305
|
+
}
|
|
306
|
+
const pe = function(t) {
|
|
307
|
+
return t === void 0 && (t = {}), {
|
|
308
|
+
name: "autoPlacement",
|
|
309
|
+
options: t,
|
|
310
|
+
async fn(e) {
|
|
311
|
+
var o, n, i;
|
|
312
|
+
const {
|
|
313
|
+
rects: s,
|
|
314
|
+
middlewareData: r,
|
|
315
|
+
placement: c,
|
|
316
|
+
platform: f,
|
|
317
|
+
elements: m
|
|
318
|
+
} = e, {
|
|
319
|
+
crossAxis: u = !1,
|
|
320
|
+
alignment: l,
|
|
321
|
+
allowedPlacements: h = Dt,
|
|
322
|
+
autoAlignment: d = !0,
|
|
323
|
+
...p
|
|
324
|
+
} = z(t, e), v = l !== void 0 || h === Dt ? he(l || null, d, h) : h, w = await f.detectOverflow(e, p), S = ((o = r.autoPlacement) == null ? void 0 : o.index) || 0, R = v[S];
|
|
325
|
+
if (R == null)
|
|
326
|
+
return {};
|
|
327
|
+
const g = qt(R, s, await (f.isRTL == null ? void 0 : f.isRTL(m.floating)));
|
|
328
|
+
if (c !== R)
|
|
329
|
+
return {
|
|
330
|
+
reset: {
|
|
331
|
+
placement: v[0]
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
const A = [w[F(R)], w[g[0]], w[g[1]]], T = [...((n = r.autoPlacement) == null ? void 0 : n.overflows) || [], {
|
|
335
|
+
placement: R,
|
|
336
|
+
overflows: A
|
|
337
|
+
}], E = v[S + 1];
|
|
338
|
+
if (E)
|
|
339
|
+
return {
|
|
340
|
+
data: {
|
|
341
|
+
index: S + 1,
|
|
342
|
+
overflows: T
|
|
343
|
+
},
|
|
344
|
+
reset: {
|
|
345
|
+
placement: E
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
const M = T.map((a) => {
|
|
349
|
+
const x = q(a.placement);
|
|
350
|
+
return [a.placement, x && u ? (
|
|
351
|
+
// Check along the mainAxis and main crossAxis side.
|
|
352
|
+
a.overflows.slice(0, 2).reduce((O, C) => O + C, 0)
|
|
353
|
+
) : (
|
|
354
|
+
// Check only the mainAxis.
|
|
355
|
+
a.overflows[0]
|
|
356
|
+
), a.overflows];
|
|
357
|
+
}).sort((a, x) => a[1] - x[1]), $ = ((i = M.filter((a) => a[2].slice(
|
|
358
|
+
0,
|
|
359
|
+
// Aligned placements should not check their opposite crossAxis
|
|
360
|
+
// side.
|
|
361
|
+
q(a[0]) ? 2 : 3
|
|
362
|
+
).every((x) => x <= 0))[0]) == null ? void 0 : i[0]) || M[0][0];
|
|
363
|
+
return $ !== c ? {
|
|
364
|
+
data: {
|
|
365
|
+
index: S + 1,
|
|
366
|
+
overflows: T
|
|
367
|
+
},
|
|
368
|
+
reset: {
|
|
369
|
+
placement: $
|
|
370
|
+
}
|
|
371
|
+
} : {};
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
}, we = function(t) {
|
|
375
|
+
return t === void 0 && (t = {}), {
|
|
376
|
+
name: "flip",
|
|
377
|
+
options: t,
|
|
378
|
+
async fn(e) {
|
|
379
|
+
var o, n;
|
|
380
|
+
const {
|
|
381
|
+
placement: i,
|
|
382
|
+
middlewareData: s,
|
|
383
|
+
rects: r,
|
|
384
|
+
initialPlacement: c,
|
|
385
|
+
platform: f,
|
|
386
|
+
elements: m
|
|
387
|
+
} = e, {
|
|
388
|
+
mainAxis: u = !0,
|
|
389
|
+
crossAxis: l = !0,
|
|
390
|
+
fallbackPlacements: h,
|
|
391
|
+
fallbackStrategy: d = "bestFit",
|
|
392
|
+
fallbackAxisSideDirection: p = "none",
|
|
393
|
+
flipAlignment: v = !0,
|
|
394
|
+
...w
|
|
395
|
+
} = z(t, e);
|
|
396
|
+
if ((o = s.arrow) != null && o.alignmentOffset)
|
|
397
|
+
return {};
|
|
398
|
+
const S = F(i), R = X(c), g = F(c) === c, A = await (f.isRTL == null ? void 0 : f.isRTL(m.floating)), T = h || (g || !v ? [ft(c)] : se(c)), E = p !== "none";
|
|
399
|
+
!h && E && T.push(...ae(c, v, p, A));
|
|
400
|
+
const M = [c, ...T], B = await f.detectOverflow(e, w), $ = [];
|
|
401
|
+
let a = ((n = s.flip) == null ? void 0 : n.overflows) || [];
|
|
402
|
+
if (u && $.push(B[S]), l) {
|
|
403
|
+
const b = qt(i, r, A);
|
|
404
|
+
$.push(B[b[0]], B[b[1]]);
|
|
405
|
+
}
|
|
406
|
+
if (a = [...a, {
|
|
407
|
+
placement: i,
|
|
408
|
+
overflows: $
|
|
409
|
+
}], !$.every((b) => b <= 0)) {
|
|
410
|
+
var x, O;
|
|
411
|
+
const b = (((x = s.flip) == null ? void 0 : x.index) || 0) + 1, P = M[b];
|
|
412
|
+
if (P && (!(l === "alignment" ? R !== X(P) : !1) || // We leave the current main axis only if every placement on that axis
|
|
413
|
+
// overflows the main axis.
|
|
414
|
+
a.every((k) => X(k.placement) === R ? k.overflows[0] > 0 : !0)))
|
|
415
|
+
return {
|
|
416
|
+
data: {
|
|
417
|
+
index: b,
|
|
418
|
+
overflows: a
|
|
419
|
+
},
|
|
420
|
+
reset: {
|
|
421
|
+
placement: P
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
let D = (O = a.filter((L) => L.overflows[0] <= 0).sort((L, k) => L.overflows[1] - k.overflows[1])[0]) == null ? void 0 : O.placement;
|
|
425
|
+
if (!D)
|
|
426
|
+
switch (d) {
|
|
427
|
+
case "bestFit": {
|
|
428
|
+
var C;
|
|
429
|
+
const L = (C = a.filter((k) => {
|
|
430
|
+
if (E) {
|
|
431
|
+
const y = X(k.placement);
|
|
432
|
+
return y === R || // Create a bias to the `y` side axis due to horizontal
|
|
433
|
+
// reading directions favoring greater width.
|
|
434
|
+
y === "y";
|
|
435
|
+
}
|
|
436
|
+
return !0;
|
|
437
|
+
}).map((k) => [k.placement, k.overflows.filter((y) => y > 0).reduce((y, I) => y + I, 0)]).sort((k, y) => k[1] - y[1])[0]) == null ? void 0 : C[0];
|
|
438
|
+
L && (D = L);
|
|
439
|
+
break;
|
|
440
|
+
}
|
|
441
|
+
case "initialPlacement":
|
|
442
|
+
D = c;
|
|
443
|
+
break;
|
|
444
|
+
}
|
|
445
|
+
if (i !== D)
|
|
446
|
+
return {
|
|
447
|
+
reset: {
|
|
448
|
+
placement: D
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
return {};
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
};
|
|
456
|
+
function Mt(t, e) {
|
|
457
|
+
return {
|
|
458
|
+
top: t.top - e.height,
|
|
459
|
+
right: t.right - e.width,
|
|
460
|
+
bottom: t.bottom - e.height,
|
|
461
|
+
left: t.left - e.width
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
function kt(t) {
|
|
465
|
+
return Ft.some((e) => t[e] >= 0);
|
|
466
|
+
}
|
|
467
|
+
const xe = function(t) {
|
|
468
|
+
return t === void 0 && (t = {}), {
|
|
469
|
+
name: "hide",
|
|
470
|
+
options: t,
|
|
471
|
+
async fn(e) {
|
|
472
|
+
const {
|
|
473
|
+
rects: o,
|
|
474
|
+
platform: n
|
|
475
|
+
} = e, {
|
|
476
|
+
strategy: i = "referenceHidden",
|
|
477
|
+
...s
|
|
478
|
+
} = z(t, e);
|
|
479
|
+
switch (i) {
|
|
480
|
+
case "referenceHidden": {
|
|
481
|
+
const r = await n.detectOverflow(e, {
|
|
482
|
+
...s,
|
|
483
|
+
elementContext: "reference"
|
|
484
|
+
}), c = Mt(r, o.reference);
|
|
485
|
+
return {
|
|
486
|
+
data: {
|
|
487
|
+
referenceHiddenOffsets: c,
|
|
488
|
+
referenceHidden: kt(c)
|
|
489
|
+
}
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
case "escaped": {
|
|
493
|
+
const r = await n.detectOverflow(e, {
|
|
494
|
+
...s,
|
|
495
|
+
altBoundary: !0
|
|
496
|
+
}), c = Mt(r, o.floating);
|
|
497
|
+
return {
|
|
498
|
+
data: {
|
|
499
|
+
escapedOffsets: c,
|
|
500
|
+
escaped: kt(c)
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
default:
|
|
505
|
+
return {};
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
};
|
|
509
|
+
};
|
|
510
|
+
function Ht(t) {
|
|
511
|
+
const e = Y(...t.map((s) => s.left)), o = Y(...t.map((s) => s.top)), n = _(...t.map((s) => s.right)), i = _(...t.map((s) => s.bottom));
|
|
512
|
+
return {
|
|
513
|
+
x: e,
|
|
514
|
+
y: o,
|
|
515
|
+
width: n - e,
|
|
516
|
+
height: i - o
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
function ye(t) {
|
|
520
|
+
const e = t.slice().sort((i, s) => i.y - s.y), o = [];
|
|
521
|
+
let n = null;
|
|
522
|
+
for (let i = 0; i < e.length; i++) {
|
|
523
|
+
const s = e[i];
|
|
524
|
+
!n || s.y - n.y > n.height / 2 ? o.push([s]) : o[o.length - 1].push(s), n = s;
|
|
525
|
+
}
|
|
526
|
+
return o.map((i) => tt(Ht(i)));
|
|
527
|
+
}
|
|
528
|
+
const ve = function(t) {
|
|
529
|
+
return t === void 0 && (t = {}), {
|
|
530
|
+
name: "inline",
|
|
531
|
+
options: t,
|
|
532
|
+
async fn(e) {
|
|
533
|
+
const {
|
|
534
|
+
placement: o,
|
|
535
|
+
elements: n,
|
|
536
|
+
rects: i,
|
|
537
|
+
platform: s,
|
|
538
|
+
strategy: r
|
|
539
|
+
} = e, {
|
|
540
|
+
padding: c = 2,
|
|
541
|
+
x: f,
|
|
542
|
+
y: m
|
|
543
|
+
} = z(t, e), u = Array.from(await (s.getClientRects == null ? void 0 : s.getClientRects(n.reference)) || []), l = ye(u), h = tt(Ht(u)), d = St(c);
|
|
544
|
+
function p() {
|
|
545
|
+
if (l.length === 2 && l[0].left > l[1].right && f != null && m != null)
|
|
546
|
+
return l.find((w) => f > w.left - d.left && f < w.right + d.right && m > w.top - d.top && m < w.bottom + d.bottom) || h;
|
|
547
|
+
if (l.length >= 2) {
|
|
548
|
+
if (X(o) === "y") {
|
|
549
|
+
const a = l[0], x = l[l.length - 1], O = F(o) === "top", C = a.top, b = x.bottom, P = O ? a.left : x.left, D = O ? a.right : x.right, L = D - P, k = b - C;
|
|
550
|
+
return {
|
|
551
|
+
top: C,
|
|
552
|
+
bottom: b,
|
|
553
|
+
left: P,
|
|
554
|
+
right: D,
|
|
555
|
+
width: L,
|
|
556
|
+
height: k,
|
|
557
|
+
x: P,
|
|
558
|
+
y: C
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
const w = F(o) === "left", S = _(...l.map((a) => a.right)), R = Y(...l.map((a) => a.left)), g = l.filter((a) => w ? a.left === R : a.right === S), A = g[0].top, T = g[g.length - 1].bottom, E = R, M = S, B = M - E, $ = T - A;
|
|
562
|
+
return {
|
|
563
|
+
top: A,
|
|
564
|
+
bottom: T,
|
|
565
|
+
left: E,
|
|
566
|
+
right: M,
|
|
567
|
+
width: B,
|
|
568
|
+
height: $,
|
|
569
|
+
x: E,
|
|
570
|
+
y: A
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
return h;
|
|
574
|
+
}
|
|
575
|
+
const v = await s.getElementRects({
|
|
576
|
+
reference: {
|
|
577
|
+
getBoundingClientRect: p
|
|
578
|
+
},
|
|
579
|
+
floating: n.floating,
|
|
580
|
+
strategy: r
|
|
581
|
+
});
|
|
582
|
+
return i.reference.x !== v.reference.x || i.reference.y !== v.reference.y || i.reference.width !== v.reference.width || i.reference.height !== v.reference.height ? {
|
|
583
|
+
reset: {
|
|
584
|
+
rects: v
|
|
585
|
+
}
|
|
586
|
+
} : {};
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
}, be = /* @__PURE__ */ new Set(["left", "top"]);
|
|
590
|
+
async function Re(t, e) {
|
|
591
|
+
const {
|
|
592
|
+
placement: o,
|
|
593
|
+
platform: n,
|
|
594
|
+
elements: i
|
|
595
|
+
} = t, s = await (n.isRTL == null ? void 0 : n.isRTL(i.floating)), r = F(o), c = q(o), f = X(o) === "y", m = be.has(r) ? -1 : 1, u = s && f ? -1 : 1, l = z(e, t);
|
|
596
|
+
let {
|
|
597
|
+
mainAxis: h,
|
|
598
|
+
crossAxis: d,
|
|
599
|
+
alignmentAxis: p
|
|
600
|
+
} = typeof l == "number" ? {
|
|
601
|
+
mainAxis: l,
|
|
602
|
+
crossAxis: 0,
|
|
603
|
+
alignmentAxis: null
|
|
604
|
+
} : {
|
|
605
|
+
mainAxis: l.mainAxis || 0,
|
|
606
|
+
crossAxis: l.crossAxis || 0,
|
|
607
|
+
alignmentAxis: l.alignmentAxis
|
|
608
|
+
};
|
|
609
|
+
return c && typeof p == "number" && (d = c === "end" ? p * -1 : p), f ? {
|
|
610
|
+
x: d * u,
|
|
611
|
+
y: h * m
|
|
612
|
+
} : {
|
|
613
|
+
x: h * m,
|
|
614
|
+
y: d * u
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
const Se = function(t) {
|
|
618
|
+
return t === void 0 && (t = 0), {
|
|
619
|
+
name: "offset",
|
|
620
|
+
options: t,
|
|
621
|
+
async fn(e) {
|
|
622
|
+
var o, n;
|
|
623
|
+
const {
|
|
624
|
+
x: i,
|
|
625
|
+
y: s,
|
|
626
|
+
placement: r,
|
|
627
|
+
middlewareData: c
|
|
628
|
+
} = e, f = await Re(e, t);
|
|
629
|
+
return r === ((o = c.offset) == null ? void 0 : o.placement) && (n = c.arrow) != null && n.alignmentOffset ? {} : {
|
|
630
|
+
x: i + f.x,
|
|
631
|
+
y: s + f.y,
|
|
632
|
+
data: {
|
|
633
|
+
...f,
|
|
634
|
+
placement: r
|
|
635
|
+
}
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
};
|
|
639
|
+
}, Oe = function(t) {
|
|
640
|
+
return t === void 0 && (t = {}), {
|
|
641
|
+
name: "shift",
|
|
642
|
+
options: t,
|
|
643
|
+
async fn(e) {
|
|
644
|
+
const {
|
|
645
|
+
x: o,
|
|
646
|
+
y: n,
|
|
647
|
+
placement: i,
|
|
648
|
+
platform: s
|
|
649
|
+
} = e, {
|
|
650
|
+
mainAxis: r = !0,
|
|
651
|
+
crossAxis: c = !1,
|
|
652
|
+
limiter: f = {
|
|
653
|
+
fn: (S) => {
|
|
654
|
+
let {
|
|
655
|
+
x: R,
|
|
656
|
+
y: g
|
|
657
|
+
} = S;
|
|
658
|
+
return {
|
|
659
|
+
x: R,
|
|
660
|
+
y: g
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
},
|
|
664
|
+
...m
|
|
665
|
+
} = z(t, e), u = {
|
|
666
|
+
x: o,
|
|
667
|
+
y: n
|
|
668
|
+
}, l = await s.detectOverflow(e, m), h = X(F(i)), d = It(h);
|
|
669
|
+
let p = u[d], v = u[h];
|
|
670
|
+
if (r) {
|
|
671
|
+
const S = d === "y" ? "top" : "left", R = d === "y" ? "bottom" : "right", g = p + l[S], A = p - l[R];
|
|
672
|
+
p = yt(g, p, A);
|
|
673
|
+
}
|
|
674
|
+
if (c) {
|
|
675
|
+
const S = h === "y" ? "top" : "left", R = h === "y" ? "bottom" : "right", g = v + l[S], A = v - l[R];
|
|
676
|
+
v = yt(g, v, A);
|
|
677
|
+
}
|
|
678
|
+
const w = f.fn({
|
|
679
|
+
...e,
|
|
680
|
+
[d]: p,
|
|
681
|
+
[h]: v
|
|
682
|
+
});
|
|
683
|
+
return {
|
|
684
|
+
...w,
|
|
685
|
+
data: {
|
|
686
|
+
x: w.x - o,
|
|
687
|
+
y: w.y - n,
|
|
688
|
+
enabled: {
|
|
689
|
+
[d]: r,
|
|
690
|
+
[h]: c
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
}, Ae = function(t) {
|
|
697
|
+
return t === void 0 && (t = {}), {
|
|
698
|
+
name: "size",
|
|
699
|
+
options: t,
|
|
700
|
+
async fn(e) {
|
|
701
|
+
var o, n;
|
|
702
|
+
const {
|
|
703
|
+
placement: i,
|
|
704
|
+
rects: s,
|
|
705
|
+
platform: r,
|
|
706
|
+
elements: c
|
|
707
|
+
} = e, {
|
|
708
|
+
apply: f = () => {
|
|
709
|
+
},
|
|
710
|
+
...m
|
|
711
|
+
} = z(t, e), u = await r.detectOverflow(e, m), l = F(i), h = q(i), d = X(i) === "y", {
|
|
712
|
+
width: p,
|
|
713
|
+
height: v
|
|
714
|
+
} = s.floating;
|
|
715
|
+
let w, S;
|
|
716
|
+
l === "top" || l === "bottom" ? (w = l, S = h === (await (r.isRTL == null ? void 0 : r.isRTL(c.floating)) ? "start" : "end") ? "left" : "right") : (S = l, w = h === "end" ? "top" : "bottom");
|
|
717
|
+
const R = v - u.top - u.bottom, g = p - u.left - u.right, A = Y(v - u[w], R), T = Y(p - u[S], g), E = !e.middlewareData.shift;
|
|
718
|
+
let M = A, B = T;
|
|
719
|
+
if ((o = e.middlewareData.shift) != null && o.enabled.x && (B = g), (n = e.middlewareData.shift) != null && n.enabled.y && (M = R), E && !h) {
|
|
720
|
+
const a = _(u.left, 0), x = _(u.right, 0), O = _(u.top, 0), C = _(u.bottom, 0);
|
|
721
|
+
d ? B = p - 2 * (a !== 0 || x !== 0 ? a + x : _(u.left, u.right)) : M = v - 2 * (O !== 0 || C !== 0 ? O + C : _(u.top, u.bottom));
|
|
722
|
+
}
|
|
723
|
+
await f({
|
|
724
|
+
...e,
|
|
725
|
+
availableWidth: B,
|
|
726
|
+
availableHeight: M
|
|
727
|
+
});
|
|
728
|
+
const $ = await r.getDimensions(c.floating);
|
|
729
|
+
return p !== $.width || v !== $.height ? {
|
|
730
|
+
reset: {
|
|
731
|
+
rects: !0
|
|
732
|
+
}
|
|
733
|
+
} : {};
|
|
734
|
+
}
|
|
735
|
+
};
|
|
736
|
+
};
|
|
737
|
+
function ut() {
|
|
738
|
+
return typeof window < "u";
|
|
739
|
+
}
|
|
740
|
+
function nt(t) {
|
|
741
|
+
return Vt(t) ? (t.nodeName || "").toLowerCase() : "#document";
|
|
742
|
+
}
|
|
743
|
+
function W(t) {
|
|
744
|
+
var e;
|
|
745
|
+
return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
|
|
746
|
+
}
|
|
747
|
+
function K(t) {
|
|
748
|
+
var e;
|
|
749
|
+
return (e = (Vt(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
|
|
750
|
+
}
|
|
751
|
+
function Vt(t) {
|
|
752
|
+
return ut() ? t instanceof Node || t instanceof W(t).Node : !1;
|
|
753
|
+
}
|
|
754
|
+
function H(t) {
|
|
755
|
+
return ut() ? t instanceof Element || t instanceof W(t).Element : !1;
|
|
756
|
+
}
|
|
757
|
+
function U(t) {
|
|
758
|
+
return ut() ? t instanceof HTMLElement || t instanceof W(t).HTMLElement : !1;
|
|
759
|
+
}
|
|
760
|
+
function _t(t) {
|
|
761
|
+
return !ut() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof W(t).ShadowRoot;
|
|
762
|
+
}
|
|
763
|
+
function st(t) {
|
|
764
|
+
const {
|
|
765
|
+
overflow: e,
|
|
766
|
+
overflowX: o,
|
|
767
|
+
overflowY: n,
|
|
768
|
+
display: i
|
|
769
|
+
} = V(t);
|
|
770
|
+
return /auto|scroll|overlay|hidden|clip/.test(e + n + o) && i !== "inline" && i !== "contents";
|
|
771
|
+
}
|
|
772
|
+
function Ce(t) {
|
|
773
|
+
return /^(table|td|th)$/.test(nt(t));
|
|
774
|
+
}
|
|
775
|
+
function dt(t) {
|
|
776
|
+
try {
|
|
777
|
+
if (t.matches(":popover-open"))
|
|
778
|
+
return !0;
|
|
779
|
+
} catch {
|
|
780
|
+
}
|
|
781
|
+
try {
|
|
782
|
+
return t.matches(":modal");
|
|
783
|
+
} catch {
|
|
784
|
+
return !1;
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
const Pe = /transform|translate|scale|rotate|perspective|filter/, Ee = /paint|layout|strict|content/, G = (t) => !!t && t !== "none";
|
|
788
|
+
let wt;
|
|
789
|
+
function Ot(t) {
|
|
790
|
+
const e = H(t) ? V(t) : t;
|
|
791
|
+
return G(e.transform) || G(e.translate) || G(e.scale) || G(e.rotate) || G(e.perspective) || !At() && (G(e.backdropFilter) || G(e.filter)) || Pe.test(e.willChange || "") || Ee.test(e.contain || "");
|
|
792
|
+
}
|
|
793
|
+
function De(t) {
|
|
794
|
+
let e = J(t);
|
|
795
|
+
for (; U(e) && !et(e); ) {
|
|
796
|
+
if (Ot(e))
|
|
797
|
+
return e;
|
|
798
|
+
if (dt(e))
|
|
799
|
+
return null;
|
|
800
|
+
e = J(e);
|
|
801
|
+
}
|
|
802
|
+
return null;
|
|
803
|
+
}
|
|
804
|
+
function At() {
|
|
805
|
+
return wt == null && (wt = typeof CSS < "u" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none")), wt;
|
|
806
|
+
}
|
|
807
|
+
function et(t) {
|
|
808
|
+
return /^(html|body|#document)$/.test(nt(t));
|
|
809
|
+
}
|
|
810
|
+
function V(t) {
|
|
811
|
+
return W(t).getComputedStyle(t);
|
|
812
|
+
}
|
|
813
|
+
function mt(t) {
|
|
814
|
+
return H(t) ? {
|
|
815
|
+
scrollLeft: t.scrollLeft,
|
|
816
|
+
scrollTop: t.scrollTop
|
|
817
|
+
} : {
|
|
818
|
+
scrollLeft: t.scrollX,
|
|
819
|
+
scrollTop: t.scrollY
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
function J(t) {
|
|
823
|
+
if (nt(t) === "html")
|
|
824
|
+
return t;
|
|
825
|
+
const e = (
|
|
826
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
827
|
+
t.assignedSlot || // DOM Element detected.
|
|
828
|
+
t.parentNode || // ShadowRoot detected.
|
|
829
|
+
_t(t) && t.host || // Fallback.
|
|
830
|
+
K(t)
|
|
831
|
+
);
|
|
832
|
+
return _t(e) ? e.host : e;
|
|
833
|
+
}
|
|
834
|
+
function Xt(t) {
|
|
835
|
+
const e = J(t);
|
|
836
|
+
return et(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : U(e) && st(e) ? e : Xt(e);
|
|
837
|
+
}
|
|
838
|
+
function jt(t, e, o) {
|
|
839
|
+
var n;
|
|
840
|
+
e === void 0 && (e = []);
|
|
841
|
+
const i = Xt(t), s = i === ((n = t.ownerDocument) == null ? void 0 : n.body), r = W(i);
|
|
842
|
+
return s ? (vt(r), e.concat(r, r.visualViewport || [], st(i) ? i : [], [])) : e.concat(i, jt(i, []));
|
|
843
|
+
}
|
|
844
|
+
function vt(t) {
|
|
845
|
+
return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
|
|
846
|
+
}
|
|
847
|
+
function Yt(t) {
|
|
848
|
+
const e = V(t);
|
|
849
|
+
let o = parseFloat(e.width) || 0, n = parseFloat(e.height) || 0;
|
|
850
|
+
const i = U(t), s = i ? t.offsetWidth : o, r = i ? t.offsetHeight : n, c = lt(o) !== s || lt(n) !== r;
|
|
851
|
+
return c && (o = s, n = r), {
|
|
852
|
+
width: o,
|
|
853
|
+
height: n,
|
|
854
|
+
$: c
|
|
855
|
+
};
|
|
856
|
+
}
|
|
857
|
+
function zt(t) {
|
|
858
|
+
return H(t) ? t : t.contextElement;
|
|
859
|
+
}
|
|
860
|
+
function Z(t) {
|
|
861
|
+
const e = zt(t);
|
|
862
|
+
if (!U(e))
|
|
863
|
+
return j(1);
|
|
864
|
+
const o = e.getBoundingClientRect(), {
|
|
865
|
+
width: n,
|
|
866
|
+
height: i,
|
|
867
|
+
$: s
|
|
868
|
+
} = Yt(e);
|
|
869
|
+
let r = (s ? lt(o.width) : o.width) / n, c = (s ? lt(o.height) : o.height) / i;
|
|
870
|
+
return (!r || !Number.isFinite(r)) && (r = 1), (!c || !Number.isFinite(c)) && (c = 1), {
|
|
871
|
+
x: r,
|
|
872
|
+
y: c
|
|
873
|
+
};
|
|
874
|
+
}
|
|
875
|
+
const Te = /* @__PURE__ */ j(0);
|
|
876
|
+
function Kt(t) {
|
|
877
|
+
const e = W(t);
|
|
878
|
+
return !At() || !e.visualViewport ? Te : {
|
|
879
|
+
x: e.visualViewport.offsetLeft,
|
|
880
|
+
y: e.visualViewport.offsetTop
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
function Le(t, e, o) {
|
|
884
|
+
return e === void 0 && (e = !1), !o || e && o !== W(t) ? !1 : e;
|
|
885
|
+
}
|
|
886
|
+
function it(t, e, o, n) {
|
|
887
|
+
e === void 0 && (e = !1), o === void 0 && (o = !1);
|
|
888
|
+
const i = t.getBoundingClientRect(), s = zt(t);
|
|
889
|
+
let r = j(1);
|
|
890
|
+
e && (n ? H(n) && (r = Z(n)) : r = Z(t));
|
|
891
|
+
const c = Le(s, o, n) ? Kt(s) : j(0);
|
|
892
|
+
let f = (i.left + c.x) / r.x, m = (i.top + c.y) / r.y, u = i.width / r.x, l = i.height / r.y;
|
|
893
|
+
if (s) {
|
|
894
|
+
const h = W(s), d = n && H(n) ? W(n) : n;
|
|
895
|
+
let p = h, v = vt(p);
|
|
896
|
+
for (; v && n && d !== p; ) {
|
|
897
|
+
const w = Z(v), S = v.getBoundingClientRect(), R = V(v), g = S.left + (v.clientLeft + parseFloat(R.paddingLeft)) * w.x, A = S.top + (v.clientTop + parseFloat(R.paddingTop)) * w.y;
|
|
898
|
+
f *= w.x, m *= w.y, u *= w.x, l *= w.y, f += g, m += A, p = W(v), v = vt(p);
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
return tt({
|
|
902
|
+
width: u,
|
|
903
|
+
height: l,
|
|
904
|
+
x: f,
|
|
905
|
+
y: m
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
function gt(t, e) {
|
|
909
|
+
const o = mt(t).scrollLeft;
|
|
910
|
+
return e ? e.left + o : it(K(t)).left + o;
|
|
911
|
+
}
|
|
912
|
+
function Ut(t, e) {
|
|
913
|
+
const o = t.getBoundingClientRect(), n = o.left + e.scrollLeft - gt(t, o), i = o.top + e.scrollTop;
|
|
914
|
+
return {
|
|
915
|
+
x: n,
|
|
916
|
+
y: i
|
|
917
|
+
};
|
|
918
|
+
}
|
|
919
|
+
function $e(t) {
|
|
920
|
+
let {
|
|
921
|
+
elements: e,
|
|
922
|
+
rect: o,
|
|
923
|
+
offsetParent: n,
|
|
924
|
+
strategy: i
|
|
925
|
+
} = t;
|
|
926
|
+
const s = i === "fixed", r = K(n), c = e ? dt(e.floating) : !1;
|
|
927
|
+
if (n === r || c && s)
|
|
928
|
+
return o;
|
|
929
|
+
let f = {
|
|
930
|
+
scrollLeft: 0,
|
|
931
|
+
scrollTop: 0
|
|
932
|
+
}, m = j(1);
|
|
933
|
+
const u = j(0), l = U(n);
|
|
934
|
+
if ((l || !l && !s) && ((nt(n) !== "body" || st(r)) && (f = mt(n)), l)) {
|
|
935
|
+
const d = it(n);
|
|
936
|
+
m = Z(n), u.x = d.x + n.clientLeft, u.y = d.y + n.clientTop;
|
|
937
|
+
}
|
|
938
|
+
const h = r && !l && !s ? Ut(r, f) : j(0);
|
|
939
|
+
return {
|
|
940
|
+
width: o.width * m.x,
|
|
941
|
+
height: o.height * m.y,
|
|
942
|
+
x: o.x * m.x - f.scrollLeft * m.x + u.x + h.x,
|
|
943
|
+
y: o.y * m.y - f.scrollTop * m.y + u.y + h.y
|
|
944
|
+
};
|
|
945
|
+
}
|
|
946
|
+
function Me(t) {
|
|
947
|
+
return Array.from(t.getClientRects());
|
|
948
|
+
}
|
|
949
|
+
function ke(t) {
|
|
950
|
+
const e = K(t), o = mt(t), n = t.ownerDocument.body, i = _(e.scrollWidth, e.clientWidth, n.scrollWidth, n.clientWidth), s = _(e.scrollHeight, e.clientHeight, n.scrollHeight, n.clientHeight);
|
|
951
|
+
let r = -o.scrollLeft + gt(t);
|
|
952
|
+
const c = -o.scrollTop;
|
|
953
|
+
return V(n).direction === "rtl" && (r += _(e.clientWidth, n.clientWidth) - i), {
|
|
954
|
+
width: i,
|
|
955
|
+
height: s,
|
|
956
|
+
x: r,
|
|
957
|
+
y: c
|
|
958
|
+
};
|
|
959
|
+
}
|
|
960
|
+
const Bt = 25;
|
|
961
|
+
function _e(t, e) {
|
|
962
|
+
const o = W(t), n = K(t), i = o.visualViewport;
|
|
963
|
+
let s = n.clientWidth, r = n.clientHeight, c = 0, f = 0;
|
|
964
|
+
if (i) {
|
|
965
|
+
s = i.width, r = i.height;
|
|
966
|
+
const u = At();
|
|
967
|
+
(!u || u && e === "fixed") && (c = i.offsetLeft, f = i.offsetTop);
|
|
968
|
+
}
|
|
969
|
+
const m = gt(n);
|
|
970
|
+
if (m <= 0) {
|
|
971
|
+
const u = n.ownerDocument, l = u.body, h = getComputedStyle(l), d = u.compatMode === "CSS1Compat" && parseFloat(h.marginLeft) + parseFloat(h.marginRight) || 0, p = Math.abs(n.clientWidth - l.clientWidth - d);
|
|
972
|
+
p <= Bt && (s -= p);
|
|
973
|
+
} else m <= Bt && (s += m);
|
|
974
|
+
return {
|
|
975
|
+
width: s,
|
|
976
|
+
height: r,
|
|
977
|
+
x: c,
|
|
978
|
+
y: f
|
|
979
|
+
};
|
|
980
|
+
}
|
|
981
|
+
function Be(t, e) {
|
|
982
|
+
const o = it(t, !0, e === "fixed"), n = o.top + t.clientTop, i = o.left + t.clientLeft, s = U(t) ? Z(t) : j(1), r = t.clientWidth * s.x, c = t.clientHeight * s.y, f = i * s.x, m = n * s.y;
|
|
983
|
+
return {
|
|
984
|
+
width: r,
|
|
985
|
+
height: c,
|
|
986
|
+
x: f,
|
|
987
|
+
y: m
|
|
988
|
+
};
|
|
989
|
+
}
|
|
990
|
+
function Nt(t, e, o) {
|
|
991
|
+
let n;
|
|
992
|
+
if (e === "viewport")
|
|
993
|
+
n = _e(t, o);
|
|
994
|
+
else if (e === "document")
|
|
995
|
+
n = ke(K(t));
|
|
996
|
+
else if (H(e))
|
|
997
|
+
n = Be(e, o);
|
|
998
|
+
else {
|
|
999
|
+
const i = Kt(t);
|
|
1000
|
+
n = {
|
|
1001
|
+
x: e.x - i.x,
|
|
1002
|
+
y: e.y - i.y,
|
|
1003
|
+
width: e.width,
|
|
1004
|
+
height: e.height
|
|
1005
|
+
};
|
|
1006
|
+
}
|
|
1007
|
+
return tt(n);
|
|
1008
|
+
}
|
|
1009
|
+
function Jt(t, e) {
|
|
1010
|
+
const o = J(t);
|
|
1011
|
+
return o === e || !H(o) || et(o) ? !1 : V(o).position === "fixed" || Jt(o, e);
|
|
1012
|
+
}
|
|
1013
|
+
function Ne(t, e) {
|
|
1014
|
+
const o = e.get(t);
|
|
1015
|
+
if (o)
|
|
1016
|
+
return o;
|
|
1017
|
+
let n = jt(t, []).filter((c) => H(c) && nt(c) !== "body"), i = null;
|
|
1018
|
+
const s = V(t).position === "fixed";
|
|
1019
|
+
let r = s ? J(t) : t;
|
|
1020
|
+
for (; H(r) && !et(r); ) {
|
|
1021
|
+
const c = V(r), f = Ot(r);
|
|
1022
|
+
!f && c.position === "fixed" && (i = null), (s ? !f && !i : !f && c.position === "static" && !!i && (i.position === "absolute" || i.position === "fixed") || st(r) && !f && Jt(t, r)) ? n = n.filter((u) => u !== r) : i = c, r = J(r);
|
|
1023
|
+
}
|
|
1024
|
+
return e.set(t, n), n;
|
|
1025
|
+
}
|
|
1026
|
+
function We(t) {
|
|
1027
|
+
let {
|
|
1028
|
+
element: e,
|
|
1029
|
+
boundary: o,
|
|
1030
|
+
rootBoundary: n,
|
|
1031
|
+
strategy: i
|
|
1032
|
+
} = t;
|
|
1033
|
+
const r = [...o === "clippingAncestors" ? dt(e) ? [] : Ne(e, this._c) : [].concat(o), n], c = Nt(e, r[0], i);
|
|
1034
|
+
let f = c.top, m = c.right, u = c.bottom, l = c.left;
|
|
1035
|
+
for (let h = 1; h < r.length; h++) {
|
|
1036
|
+
const d = Nt(e, r[h], i);
|
|
1037
|
+
f = _(d.top, f), m = Y(d.right, m), u = Y(d.bottom, u), l = _(d.left, l);
|
|
1038
|
+
}
|
|
1039
|
+
return {
|
|
1040
|
+
width: m - l,
|
|
1041
|
+
height: u - f,
|
|
1042
|
+
x: l,
|
|
1043
|
+
y: f
|
|
1044
|
+
};
|
|
1045
|
+
}
|
|
1046
|
+
function Fe(t) {
|
|
1047
|
+
const {
|
|
1048
|
+
width: e,
|
|
1049
|
+
height: o
|
|
1050
|
+
} = Yt(t);
|
|
1051
|
+
return {
|
|
1052
|
+
width: e,
|
|
1053
|
+
height: o
|
|
1054
|
+
};
|
|
1055
|
+
}
|
|
1056
|
+
function Ie(t, e, o) {
|
|
1057
|
+
const n = U(e), i = K(e), s = o === "fixed", r = it(t, !0, s, e);
|
|
1058
|
+
let c = {
|
|
1059
|
+
scrollLeft: 0,
|
|
1060
|
+
scrollTop: 0
|
|
1061
|
+
};
|
|
1062
|
+
const f = j(0);
|
|
1063
|
+
function m() {
|
|
1064
|
+
f.x = gt(i);
|
|
1065
|
+
}
|
|
1066
|
+
if (n || !n && !s)
|
|
1067
|
+
if ((nt(e) !== "body" || st(i)) && (c = mt(e)), n) {
|
|
1068
|
+
const d = it(e, !0, s, e);
|
|
1069
|
+
f.x = d.x + e.clientLeft, f.y = d.y + e.clientTop;
|
|
1070
|
+
} else i && m();
|
|
1071
|
+
s && !n && i && m();
|
|
1072
|
+
const u = i && !n && !s ? Ut(i, c) : j(0), l = r.left + c.scrollLeft - f.x - u.x, h = r.top + c.scrollTop - f.y - u.y;
|
|
1073
|
+
return {
|
|
1074
|
+
x: l,
|
|
1075
|
+
y: h,
|
|
1076
|
+
width: r.width,
|
|
1077
|
+
height: r.height
|
|
1078
|
+
};
|
|
1079
|
+
}
|
|
1080
|
+
function xt(t) {
|
|
1081
|
+
return V(t).position === "static";
|
|
1082
|
+
}
|
|
1083
|
+
function Wt(t, e) {
|
|
1084
|
+
if (!U(t) || V(t).position === "fixed")
|
|
1085
|
+
return null;
|
|
1086
|
+
if (e)
|
|
1087
|
+
return e(t);
|
|
1088
|
+
let o = t.offsetParent;
|
|
1089
|
+
return K(t) === o && (o = o.ownerDocument.body), o;
|
|
1090
|
+
}
|
|
1091
|
+
function Gt(t, e) {
|
|
1092
|
+
const o = W(t);
|
|
1093
|
+
if (dt(t))
|
|
1094
|
+
return o;
|
|
1095
|
+
if (!U(t)) {
|
|
1096
|
+
let i = J(t);
|
|
1097
|
+
for (; i && !et(i); ) {
|
|
1098
|
+
if (H(i) && !xt(i))
|
|
1099
|
+
return i;
|
|
1100
|
+
i = J(i);
|
|
1101
|
+
}
|
|
1102
|
+
return o;
|
|
1103
|
+
}
|
|
1104
|
+
let n = Wt(t, e);
|
|
1105
|
+
for (; n && Ce(n) && xt(n); )
|
|
1106
|
+
n = Wt(n, e);
|
|
1107
|
+
return n && et(n) && xt(n) && !Ot(n) ? o : n || De(t) || o;
|
|
1108
|
+
}
|
|
1109
|
+
const qe = async function(t) {
|
|
1110
|
+
const e = this.getOffsetParent || Gt, o = this.getDimensions, n = await o(t.floating);
|
|
1111
|
+
return {
|
|
1112
|
+
reference: Ie(t.reference, await e(t.floating), t.strategy),
|
|
1113
|
+
floating: {
|
|
1114
|
+
x: 0,
|
|
1115
|
+
y: 0,
|
|
1116
|
+
width: n.width,
|
|
1117
|
+
height: n.height
|
|
1118
|
+
}
|
|
1119
|
+
};
|
|
1120
|
+
};
|
|
1121
|
+
function He(t) {
|
|
1122
|
+
return V(t).direction === "rtl";
|
|
1123
|
+
}
|
|
1124
|
+
const Ve = {
|
|
1125
|
+
convertOffsetParentRelativeRectToViewportRelativeRect: $e,
|
|
1126
|
+
getDocumentElement: K,
|
|
1127
|
+
getClippingRect: We,
|
|
1128
|
+
getOffsetParent: Gt,
|
|
1129
|
+
getElementRects: qe,
|
|
1130
|
+
getClientRects: Me,
|
|
1131
|
+
getDimensions: Fe,
|
|
1132
|
+
getScale: Z,
|
|
1133
|
+
isElement: H,
|
|
1134
|
+
isRTL: He
|
|
1135
|
+
}, Je = Se, Ge = pe, Qe = Oe, Ze = we, tn = Ae, en = xe, nn = ge, on = ve, sn = (t, e, o) => {
|
|
1136
|
+
const n = /* @__PURE__ */ new Map(), i = {
|
|
1137
|
+
platform: Ve,
|
|
1138
|
+
...o
|
|
1139
|
+
}, s = {
|
|
1140
|
+
...i.platform,
|
|
1141
|
+
_c: n
|
|
1142
|
+
};
|
|
1143
|
+
return me(t, e, {
|
|
1144
|
+
...i,
|
|
1145
|
+
platform: s
|
|
1146
|
+
});
|
|
1147
|
+
};
|
|
1148
|
+
function Xe(t) {
|
|
1149
|
+
var e;
|
|
1150
|
+
const { char: o, allowSpaces: n, allowToIncludeChar: i, allowedPrefixes: s, startOfLine: r, $position: c } = t, f = n && !i, m = oe(o), u = new RegExp(`\\s${m}$`), l = r ? "^" : "", h = i ? "" : m, d = f ? new RegExp(`${l}${m}.*?(?=\\s${h}|$)`, "gm") : new RegExp(`${l}(?:^)?${m}[^\\s${h}]*`, "gm"), p = ((e = c.nodeBefore) == null ? void 0 : e.isText) && c.nodeBefore.text;
|
|
1151
|
+
if (!p)
|
|
1152
|
+
return null;
|
|
1153
|
+
const v = c.pos - p.length, w = Array.from(p.matchAll(d)).pop();
|
|
1154
|
+
if (!w || w.input === void 0 || w.index === void 0)
|
|
1155
|
+
return null;
|
|
1156
|
+
const S = w.input.slice(Math.max(0, w.index - 1), w.index), R = new RegExp(`^[${s == null ? void 0 : s.join("")}\0]?$`).test(S);
|
|
1157
|
+
if (s !== null && !R)
|
|
1158
|
+
return null;
|
|
1159
|
+
const g = v + w.index;
|
|
1160
|
+
let A = g + w[0].length;
|
|
1161
|
+
return f && u.test(p.slice(A - 1, A + 1)) && (w[0] += " ", A += 1), g < c.pos && A >= c.pos ? {
|
|
1162
|
+
range: {
|
|
1163
|
+
from: g,
|
|
1164
|
+
to: A
|
|
1165
|
+
},
|
|
1166
|
+
query: w[0].slice(o.length),
|
|
1167
|
+
text: w[0]
|
|
1168
|
+
} : null;
|
|
1169
|
+
}
|
|
1170
|
+
function je(t) {
|
|
1171
|
+
return t.docChanged ? t.steps.some((e) => {
|
|
1172
|
+
const o = e.slice;
|
|
1173
|
+
if (!(o != null && o.content))
|
|
1174
|
+
return !1;
|
|
1175
|
+
const n = o.content.textBetween(0, o.content.size, `
|
|
1176
|
+
`);
|
|
1177
|
+
return /\s/.test(n);
|
|
1178
|
+
}) : !1;
|
|
1179
|
+
}
|
|
1180
|
+
var Ye = new Zt("suggestion");
|
|
1181
|
+
function rn({
|
|
1182
|
+
pluginKey: t = Ye,
|
|
1183
|
+
editor: e,
|
|
1184
|
+
char: o = "@",
|
|
1185
|
+
allowSpaces: n = !1,
|
|
1186
|
+
allowToIncludeChar: i = !1,
|
|
1187
|
+
allowedPrefixes: s = [" "],
|
|
1188
|
+
startOfLine: r = !1,
|
|
1189
|
+
decorationTag: c = "span",
|
|
1190
|
+
decorationClass: f = "suggestion",
|
|
1191
|
+
decorationContent: m = "",
|
|
1192
|
+
decorationEmptyClass: u = "is-empty",
|
|
1193
|
+
command: l = () => null,
|
|
1194
|
+
items: h = () => [],
|
|
1195
|
+
render: d = () => ({}),
|
|
1196
|
+
allow: p = () => !0,
|
|
1197
|
+
findSuggestionMatch: v = Xe,
|
|
1198
|
+
shouldShow: w,
|
|
1199
|
+
shouldResetDismissed: S
|
|
1200
|
+
}) {
|
|
1201
|
+
let R;
|
|
1202
|
+
const g = d == null ? void 0 : d(), A = n && !i, T = () => {
|
|
1203
|
+
const a = e.state.selection.$anchor.pos, x = e.view.coordsAtPos(a), { top: O, right: C, bottom: b, left: P } = x;
|
|
1204
|
+
try {
|
|
1205
|
+
return new DOMRect(P, O, C - P, b - O);
|
|
1206
|
+
} catch {
|
|
1207
|
+
return null;
|
|
1208
|
+
}
|
|
1209
|
+
}, E = (a, x) => x ? () => {
|
|
1210
|
+
const O = t.getState(e.state), C = O == null ? void 0 : O.decorationId, b = a.dom.querySelector(`[data-decoration-id="${C}"]`);
|
|
1211
|
+
return (b == null ? void 0 : b.getBoundingClientRect()) || null;
|
|
1212
|
+
} : T, M = ({
|
|
1213
|
+
match: a,
|
|
1214
|
+
dismissedRange: x,
|
|
1215
|
+
state: O,
|
|
1216
|
+
transaction: C
|
|
1217
|
+
}) => S != null && S({
|
|
1218
|
+
editor: e,
|
|
1219
|
+
state: O,
|
|
1220
|
+
range: x,
|
|
1221
|
+
match: a,
|
|
1222
|
+
transaction: C,
|
|
1223
|
+
allowSpaces: A
|
|
1224
|
+
}) ? !1 : A ? a.range.from === x.from : a.range.from === x.from && !je(C);
|
|
1225
|
+
function B(a, x) {
|
|
1226
|
+
var O;
|
|
1227
|
+
try {
|
|
1228
|
+
const b = t.getState(a.state), P = b != null && b.decorationId ? a.dom.querySelector(`[data-decoration-id="${b.decorationId}"]`) : null, D = {
|
|
1229
|
+
// @ts-ignore editor is available in closure
|
|
1230
|
+
editor: e,
|
|
1231
|
+
range: (b == null ? void 0 : b.range) || { from: 0, to: 0 },
|
|
1232
|
+
query: (b == null ? void 0 : b.query) || null,
|
|
1233
|
+
text: (b == null ? void 0 : b.text) || null,
|
|
1234
|
+
items: [],
|
|
1235
|
+
command: (L) => l({ editor: e, range: (b == null ? void 0 : b.range) || { from: 0, to: 0 }, props: L }),
|
|
1236
|
+
decorationNode: P,
|
|
1237
|
+
clientRect: E(a, P)
|
|
1238
|
+
};
|
|
1239
|
+
(O = g == null ? void 0 : g.onExit) == null || O.call(g, D);
|
|
1240
|
+
} catch {
|
|
1241
|
+
}
|
|
1242
|
+
const C = a.state.tr.setMeta(x, { exit: !0 });
|
|
1243
|
+
a.dispatch(C);
|
|
1244
|
+
}
|
|
1245
|
+
const $ = new te({
|
|
1246
|
+
key: t,
|
|
1247
|
+
view() {
|
|
1248
|
+
return {
|
|
1249
|
+
update: async (a, x) => {
|
|
1250
|
+
var O, C, b, P, D, L, k;
|
|
1251
|
+
const y = (O = this.key) == null ? void 0 : O.getState(x), I = (C = this.key) == null ? void 0 : C.getState(a.state), N = y.active && I.active && y.range.from !== I.range.from, rt = !y.active && I.active, Ct = y.active && !I.active, ht = !rt && !Ct && y.query !== I.query, ot = rt || N && ht, ct = ht || N, pt = Ct || N && ht;
|
|
1252
|
+
if (!ot && !ct && !pt)
|
|
1253
|
+
return;
|
|
1254
|
+
const Q = pt && !ot ? y : I, Pt = a.dom.querySelector(`[data-decoration-id="${Q.decorationId}"]`);
|
|
1255
|
+
R = {
|
|
1256
|
+
editor: e,
|
|
1257
|
+
range: Q.range,
|
|
1258
|
+
query: Q.query,
|
|
1259
|
+
text: Q.text,
|
|
1260
|
+
items: [],
|
|
1261
|
+
command: (Qt) => l({
|
|
1262
|
+
editor: e,
|
|
1263
|
+
range: Q.range,
|
|
1264
|
+
props: Qt
|
|
1265
|
+
}),
|
|
1266
|
+
decorationNode: Pt,
|
|
1267
|
+
clientRect: E(a, Pt)
|
|
1268
|
+
}, ot && ((b = g == null ? void 0 : g.onBeforeStart) == null || b.call(g, R)), ct && ((P = g == null ? void 0 : g.onBeforeUpdate) == null || P.call(g, R)), (ct || ot) && (R.items = await h({
|
|
1269
|
+
editor: e,
|
|
1270
|
+
query: Q.query
|
|
1271
|
+
})), pt && ((D = g == null ? void 0 : g.onExit) == null || D.call(g, R)), ct && ((L = g == null ? void 0 : g.onUpdate) == null || L.call(g, R)), ot && ((k = g == null ? void 0 : g.onStart) == null || k.call(g, R));
|
|
1272
|
+
},
|
|
1273
|
+
destroy: () => {
|
|
1274
|
+
var a;
|
|
1275
|
+
R && ((a = g == null ? void 0 : g.onExit) == null || a.call(g, R));
|
|
1276
|
+
}
|
|
1277
|
+
};
|
|
1278
|
+
},
|
|
1279
|
+
state: {
|
|
1280
|
+
// Initialize the plugin's internal state.
|
|
1281
|
+
init() {
|
|
1282
|
+
return {
|
|
1283
|
+
active: !1,
|
|
1284
|
+
range: {
|
|
1285
|
+
from: 0,
|
|
1286
|
+
to: 0
|
|
1287
|
+
},
|
|
1288
|
+
query: null,
|
|
1289
|
+
text: null,
|
|
1290
|
+
composing: !1,
|
|
1291
|
+
dismissedRange: null
|
|
1292
|
+
};
|
|
1293
|
+
},
|
|
1294
|
+
// Apply changes to the plugin state from a view transaction.
|
|
1295
|
+
apply(a, x, O, C) {
|
|
1296
|
+
const { isEditable: b } = e, { composing: P } = e.view, { selection: D } = a, { empty: L, from: k } = D, y = { ...x }, I = a.getMeta(t);
|
|
1297
|
+
if (I && I.exit)
|
|
1298
|
+
return y.active = !1, y.decorationId = null, y.range = { from: 0, to: 0 }, y.query = null, y.text = null, y.dismissedRange = x.active ? { ...x.range } : x.dismissedRange, y;
|
|
1299
|
+
if (y.composing = P, a.docChanged && y.dismissedRange !== null && (y.dismissedRange = {
|
|
1300
|
+
from: a.mapping.map(y.dismissedRange.from),
|
|
1301
|
+
to: a.mapping.map(y.dismissedRange.to)
|
|
1302
|
+
}), b && (L || e.view.composing)) {
|
|
1303
|
+
(k < x.range.from || k > x.range.to) && !P && !x.composing && (y.active = !1);
|
|
1304
|
+
const N = v({
|
|
1305
|
+
char: o,
|
|
1306
|
+
allowSpaces: n,
|
|
1307
|
+
allowToIncludeChar: i,
|
|
1308
|
+
allowedPrefixes: s,
|
|
1309
|
+
startOfLine: r,
|
|
1310
|
+
$position: D.$from
|
|
1311
|
+
}), rt = `id_${Math.floor(Math.random() * 4294967295)}`;
|
|
1312
|
+
N && p({
|
|
1313
|
+
editor: e,
|
|
1314
|
+
state: C,
|
|
1315
|
+
range: N.range,
|
|
1316
|
+
isActive: x.active
|
|
1317
|
+
}) && (!w || w({
|
|
1318
|
+
editor: e,
|
|
1319
|
+
range: N.range,
|
|
1320
|
+
query: N.query,
|
|
1321
|
+
text: N.text,
|
|
1322
|
+
transaction: a
|
|
1323
|
+
})) ? (y.dismissedRange !== null && !M({
|
|
1324
|
+
match: N,
|
|
1325
|
+
dismissedRange: y.dismissedRange,
|
|
1326
|
+
state: C,
|
|
1327
|
+
transaction: a
|
|
1328
|
+
}) && (y.dismissedRange = null), y.dismissedRange === null ? (y.active = !0, y.decorationId = x.decorationId ? x.decorationId : rt, y.range = N.range, y.query = N.query, y.text = N.text) : y.active = !1) : (N || (y.dismissedRange = null), y.active = !1);
|
|
1329
|
+
} else
|
|
1330
|
+
y.active = !1;
|
|
1331
|
+
return y.active || (y.decorationId = null, y.range = { from: 0, to: 0 }, y.query = null, y.text = null), y;
|
|
1332
|
+
}
|
|
1333
|
+
},
|
|
1334
|
+
props: {
|
|
1335
|
+
// Call the keydown hook if suggestion is active.
|
|
1336
|
+
handleKeyDown(a, x) {
|
|
1337
|
+
var O, C;
|
|
1338
|
+
const { active: b, range: P } = $.getState(a.state);
|
|
1339
|
+
if (!b)
|
|
1340
|
+
return !1;
|
|
1341
|
+
if (x.key === "Escape" || x.key === "Esc") {
|
|
1342
|
+
const L = $.getState(a.state);
|
|
1343
|
+
return (O = g == null ? void 0 : g.onKeyDown) == null || O.call(g, { view: a, event: x, range: L.range }), B(a, t), !0;
|
|
1344
|
+
}
|
|
1345
|
+
return ((C = g == null ? void 0 : g.onKeyDown) == null ? void 0 : C.call(g, { view: a, event: x, range: P })) || !1;
|
|
1346
|
+
},
|
|
1347
|
+
// Setup decorator on the currently active suggestion.
|
|
1348
|
+
decorations(a) {
|
|
1349
|
+
const { active: x, range: O, decorationId: C, query: b } = $.getState(a);
|
|
1350
|
+
if (!x)
|
|
1351
|
+
return null;
|
|
1352
|
+
const P = !(b != null && b.length), D = [f];
|
|
1353
|
+
return P && D.push(u), ee.create(a.doc, [
|
|
1354
|
+
ne.inline(O.from, O.to, {
|
|
1355
|
+
nodeName: c,
|
|
1356
|
+
class: D.join(" "),
|
|
1357
|
+
"data-decoration-id": C,
|
|
1358
|
+
"data-decoration-content": m
|
|
1359
|
+
})
|
|
1360
|
+
]);
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
});
|
|
1364
|
+
return $;
|
|
1365
|
+
}
|
|
1366
|
+
export {
|
|
1367
|
+
rn as S,
|
|
1368
|
+
nn as a,
|
|
1369
|
+
tn as b,
|
|
1370
|
+
sn as c,
|
|
1371
|
+
Ge as d,
|
|
1372
|
+
Ze as f,
|
|
1373
|
+
en as h,
|
|
1374
|
+
on as i,
|
|
1375
|
+
Je as o,
|
|
1376
|
+
Qe as s
|
|
1377
|
+
};
|